UNPKG

3.44 kBTypeScriptView Raw
1/**
2 * @module botbuilder-azure
3 */
4/**
5 * Copyright (c) Microsoft Corporation. All rights reserved.
6 * Licensed under the MIT License.
7 */
8/// <reference types="node" />
9import type { Agent } from 'http';
10import { ConnectionPolicy, RequestOptions } from 'documentdb';
11import { Storage, StoreItems } from 'botbuilder';
12/**
13 * Additional settings for configuring an instance of `CosmosDbStorage`.
14 *
15 * @deprecated Please use CosmosDbPartitionedStorageOptions with CosmosDbPartitionedStorage instead.
16 */
17export interface CosmosDbStorageSettings {
18 /**
19 * The endpoint Uri for the service endpoint from the Azure Cosmos DB service.
20 */
21 serviceEndpoint: string;
22 /**
23 * The AuthKey used by the client from the Azure Cosmos DB service.
24 */
25 authKey: string;
26 /**
27 * The Database ID.
28 */
29 databaseId: string;
30 /**
31 * The Collection ID.
32 */
33 collectionId: string;
34 /**
35 * (Optional) Cosmos DB RequestOptions that are passed when the database is created.
36 */
37 databaseCreationRequestOptions?: RequestOptions;
38 /**
39 * (Optional) Cosmos DB RequestOptiones that are passed when the document collection is created.
40 */
41 documentCollectionRequestOptions?: RequestOptions;
42 /**
43 * (Optional) partitionKey that are passed when the document CosmosDbStorage is created.
44 *
45 * @deprecated Please use [[CosmosDbPartitionedStorage]]. See https://github.com/microsoft/botframework-sdk/issues/5467
46 */
47 partitionKey?: string;
48 /**
49 * (Optional) http agent to use for outbound requests
50 */
51 agent?: Agent;
52}
53/**
54 * Middleware that implements a CosmosDB based storage provider for a bot.
55 *
56 * @deprecated Please use CosmosDbPartitionedStorage instead.
57 *
58 * @remarks
59 * The `connectionPolicyConfigurator` handler can be used to further customize the connection to
60 * CosmosDB (Connection mode, retry options, timeouts). More information at
61 * http://azure.github.io/azure-documentdb-node/global.html#ConnectionPolicy
62 */
63export declare class CosmosDbStorage implements Storage {
64 private settings;
65 private client;
66 private collectionExists;
67 private documentCollectionCreationRequestOption;
68 private databaseCreationRequestOption;
69 /**
70 * Creates a new CosmosDbStorage instance.
71 *
72 * @param settings Setting to configure the provider.
73 * @param 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
74 */
75 constructor(settings: CosmosDbStorageSettings, connectionPolicyConfigurator?: (policy: ConnectionPolicy) => void);
76 /**
77 * Read storage items from storage.
78 *
79 * @param keys Keys of the items to read from the store.
80 * @returns The read items.
81 */
82 read(keys: string[]): Promise<StoreItems>;
83 /**
84 * Write storage items to storage.
85 *
86 * @param changes Items to write to storage, indexed by key.
87 */
88 write(changes: StoreItems): Promise<void>;
89 /**
90 * Delete storage items from storage.
91 *
92 * @param keys Keys of the items to remove from the store.
93 */
94 delete(keys: string[]): Promise<void>;
95 /**
96 * Delayed Database and Collection creation if they do not exist.
97 */
98 private ensureCollectionExists;
99}
100//# sourceMappingURL=cosmosDbStorage.d.ts.map
\No newline at end of file