botbuilder-azure

  • Version 4.22.1
  • Published
  • 155 kB
  • 10 dependencies
  • MIT license

Install

npm i botbuilder-azure
yarn add botbuilder-azure
pnpm add botbuilder-azure

Overview

Azure extensions for Microsoft BotBuilder.

Index

Variables

variable checkedCollectionsKey

const checkedCollectionsKey: Symbol;
  • Unique ket used to access the static checkedCollections property of the AzureBlobTranscriptStore. Accessing it is necessary for proper testing and debugging.

Classes

class AzureBlobTranscriptStore

class AzureBlobTranscriptStore implements TranscriptStore {}
  • Stores transcripts in an Azure Blob container.

    Remarks

    Each activity is stored as JSON blob with a structure of container/{channelId]/{conversationId}/{Timestamp.ticks}-{activity.id}.json.

    Deprecated

    This class is deprecated in favor of [BlobsTranscriptStore](xref:botbuilder-azure-blobs.BlobsTranscriptStore)

constructor

constructor(settings: BlobStorageSettings);
  • Creates a new AzureBlobTranscriptStore instance.

    Parameter settings

    Settings required for configuring an instance of BlobStorage

method deleteTranscript

deleteTranscript: (channelId: string, conversationId: string) => Promise<void>;
  • Delete a specific conversation and all of it's activities.

    Parameter channelId

    Channel Id where conversation took place.

    Parameter conversationId

    Id of the conversation to delete.

method getTranscriptActivities

getTranscriptActivities: (
channelId: string,
conversationId: string,
continuationToken?: string,
startDate?: Date
) => Promise<PagedResult<Activity>>;
  • Get activities for a conversation (Aka the transcript)

    Parameter channelId

    Channel Id.

    Parameter conversationId

    Conversation Id.

    Parameter continuationToken

    Continuation token to page through results.

    Parameter startDate

    Earliest time to include.

    Returns

    The PagedResult of activities.

method listTranscripts

listTranscripts: (
channelId: string,
continuationToken?: string
) => Promise<PagedResult<TranscriptInfo>>;
  • List conversations in the channelId.

    Parameter channelId

    Channel Id.

    Parameter continuationToken

    ContinuationToken token to page through results.

    Returns

    A promise representation of [PagedResult](xref:botbuilder-core.PagedResult)

method logActivity

logActivity: (activity: Activity) => Promise<void>;
  • Log an activity to the transcript.

    Parameter activity

    Activity being logged.

class BlobStorage

class BlobStorage implements Storage {}
  • Middleware that implements a BlobStorage based storage provider for a bot.

    Remarks

    The BlobStorage implements its storage using a single Azure Storage Blob Container. Each entity is serialized into a JSON string and stored in an individual text blob. Each blob is named after the key which is encoded and ensure it conforms a valid blob name.

    Deprecated

    This class is deprecated in favor of [BlobsStorage](xref:botbuilder-azure-blobs.BlobsStorage)

constructor

constructor(settings: BlobStorageSettings);
  • Creates a new BlobStorage instance.

    Parameter settings

    Settings for configuring an instance of BlobStorage.

method delete

delete: (keys: string[]) => Promise<void>;
  • Delete entity blobs from the configured container.

    Parameter keys

    An array of entity keys.

    Returns

    A promise representing the asynchronous operation.

method read

read: (keys: string[]) => Promise<StoreItems>;
  • Retrieve entities from the configured blob container.

    Parameter keys

    An array of entity keys.

    Returns

    The read items.

method write

write: (changes: StoreItems) => Promise<void>;
  • Store a new entity in the configured blob container.

    Parameter changes

    The changes to write to storage.

    Returns

    A promise representing the asynchronous operation.

class CosmosDbPartitionedStorage

class CosmosDbPartitionedStorage implements Storage {}
  • Implements a CosmosDB based storage provider using partitioning for a bot.

constructor

constructor(cosmosDbStorageOptions: CosmosDbPartitionedStorageOptions);
  • Initializes a new instance of the class. using the provided CosmosDB credentials, database ID, and container ID.

    Parameter cosmosDbStorageOptions

    Cosmos DB partitioned storage configuration options.

method delete

delete: (keys: string[]) => Promise<void>;
  • Delete one or more items from the Cosmos DB container.

    Parameter keys

    Array of Ids for the items to be deleted.

method initialize

initialize: () => Promise<void>;
  • Connects to the CosmosDB database and creates / gets the container.

method read

read: (keys: string[]) => Promise<StoreItems>;
  • Read one or more items with matching keys from the Cosmos DB container.

    Parameter keys

    A collection of Ids for each item to be retrieved.

    Returns

    {Promise} The read items.

method write

write: (changes: StoreItems) => Promise<void>;
  • Insert or update one or more items into the Cosmos DB container.

    Parameter changes

    Dictionary of items to be inserted or updated indexed by key.

Interfaces

interface BlobStorageSettings

interface BlobStorageSettings {}
  • Settings for configuring an instance of BlobStorage.

property containerName

containerName: string;
  • Root container name to use.

property host

host?: string | Host;
  • (Optional) azure storage host.

property storageAccessKey

storageAccessKey?: string;
  • The storage access key.

property storageAccountOrConnectionString

storageAccountOrConnectionString: string;
  • The storage account or the connection string. If this is the storage account, the storage access key must be provided.

interface CosmosDbPartitionedStorageOptions

interface CosmosDbPartitionedStorageOptions {}
  • Cosmos DB Partitioned Storage Options.

property authKey

authKey?: string;
  • The authentication key for Cosmos DB.

property compatibilityMode

compatibilityMode?: boolean;
  • Early version of CosmosDb had a max key length of 255. Keys longer than this were truncated in cosmosDbKeyEscape.escapeKey. This remains the default behavior of cosmosDbPartitionedStorage, but can be overridden by setting compatibilityMode to false.

    compatibilityMode cannot be true if keySuffix is used.

property containerId

containerId: string;
  • The container identifier.

property containerThroughput

containerThroughput?: number;
  • The throughput set when creating the Container. Defaults to 400.

property cosmosClientOptions

cosmosClientOptions?: CosmosClientOptions;
  • The options for the CosmosClient.

property cosmosDbEndpoint

cosmosDbEndpoint?: string;
  • The CosmosDB endpoint.

property databaseId

databaseId: string;
  • The database identifier for Cosmos DB instance.

property keySuffix

keySuffix?: string;
  • The suffix to be added to every key. See cosmosDbKeyEscape.escapeKey

    Note: compatibilityMode must be set to 'false' to use a KeySuffix. When KeySuffix is used, keys will NOT be truncated but an exception will be thrown if the key length is longer than allowed by CosmosDb.

    The keySuffix must contain only valid CosmosDb key characters. (e.g. not: '\', '?', '/', '#', '*')

property tokenCredential

tokenCredential?: TokenCredential;
  • The authentication tokenCredential for Cosmos DB.

interface Host

interface Host {}

    property primaryHost

    primaryHost: string;
    • Primary host address.

    property secondaryHost

    secondaryHost: string;
    • Secondary host address.

    Namespaces

    namespace CosmosDbKeyEscape

    namespace CosmosDbKeyEscape {}

      function escapeKey

      escapeKey: (
      key: string,
      keySuffix?: string,
      compatibilityMode?: boolean
      ) => string;
      • Converts the key into a DocumentID that can be used safely with CosmosDB. The following characters are restricted and cannot be used in the Id property: '/', '', '?', '#' More information at https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.documents.resource.id?view=azure-dotnet#remarks

        Parameter key

        The provided key to be escaped.

        Parameter keySuffix

        The string to add a the end of all RowKeys.

        Parameter compatibilityMode

        True if keys should be truncated in order to support previous CosmosDb max key length of 255. This behavior can be overridden by setting cosmosDbPartitionedStorageOptions.compatibilityMode to false.

        Returns

        An escaped key that can be used safely with CosmosDB.

      Package Files (5)

      Dependencies (10)

      Dev Dependencies (3)

      Peer Dependencies (0)

      No peer dependencies.

      Badge

      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/botbuilder-azure.

      • Markdown
        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/botbuilder-azure)
      • HTML
        <a href="https://www.jsdocs.io/package/botbuilder-azure"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>