botbuilder-azure

  • Version 4.14.1
  • Published
  • 205 kB
  • 6 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.

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.

method logActivity

logActivity: (activity: any) => 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.

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: any) => Promise<void>;
  • Store a new entity in the configured blob container.

    Parameter changes

    The changes to write to storage.

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: any) => 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.

class CosmosDbStorage

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

    Remarks

    The connectionPolicyConfigurator handler can be used to further customize the connection to CosmosDB (Connection mode, retry options, timeouts). More information at http://azure.github.io/azure-documentdb-node/global.html#ConnectionPolicy

    Deprecated

    Please use CosmosDbPartitionedStorage instead.

constructor

constructor(
settings: CosmosDbStorageSettings,
connectionPolicyConfigurator?: (policy: any) => void
);
  • Creates a new CosmosDbStorage instance.

    Parameter settings

    Setting to configure the provider.

    Parameter connectionPolicyConfigurator

    (Optional) An optional delegate that accepts a ConnectionPolicy for customizing policies. More information at http://azure.github.io/azure-documentdb-node/global.html#ConnectionPolicy

method delete

delete: (keys: string[]) => Promise<void>;
  • Delete storage items from storage.

    Parameter keys

    Keys of the items to remove from the store.

method read

read: (keys: string[]) => Promise<StoreItems>;
  • Read storage items from storage.

    Parameter keys

    Keys of the items to read from the store.

    Returns

    The read items.

method write

write: (changes: any) => Promise<void>;
  • Write storage items to storage.

    Parameter changes

    Items to write to storage, 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: '\', '?', '/', '#', '*')

interface CosmosDbStorageSettings

interface CosmosDbStorageSettings {}
  • Additional settings for configuring an instance of CosmosDbStorage.

    Deprecated

    Please use CosmosDbPartitionedStorageOptions with CosmosDbPartitionedStorage instead.

property agent

agent?: Agent;
  • (Optional) http agent to use for outbound requests

property authKey

authKey: string;
  • The AuthKey used by the client from the Azure Cosmos DB service.

property collectionId

collectionId: string;
  • The Collection ID.

property databaseCreationRequestOptions

databaseCreationRequestOptions?: RequestOptions;
  • (Optional) Cosmos DB RequestOptions that are passed when the database is created.

property databaseId

databaseId: string;
  • The Database ID.

property documentCollectionRequestOptions

documentCollectionRequestOptions?: RequestOptions;
  • (Optional) Cosmos DB RequestOptiones that are passed when the document collection is created.

property partitionKey

partitionKey?: string;
  • (Optional) partitionKey that are passed when the document CosmosDbStorage is created.

    Deprecated

    Please use [[CosmosDbPartitionedStorage]]. See https://github.com/microsoft/botframework-sdk/issues/5467

property serviceEndpoint

serviceEndpoint: string;
  • The endpoint Uri for the service endpoint from the Azure Cosmos DB service.

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.

      Package Files (6)

      Dependencies (6)

      Dev Dependencies (4)

      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>