UNPKG

3.13 kBTypeScriptView Raw
1import { Storage, StoreItems } from 'botbuilder';
2export interface Host {
3 /**
4 * Primary host address.
5 */
6 primaryHost: string;
7 /**
8 * Secondary host address.
9 */
10 secondaryHost: string;
11}
12/**
13 * Settings for configuring an instance of `BlobStorage`.
14 */
15export interface BlobStorageSettings {
16 /**
17 * Root container name to use.
18 */
19 containerName: string;
20 /**
21 * The storage account or the connection string. If this is the storage account, the storage access key must be provided.
22 */
23 storageAccountOrConnectionString: string;
24 /**
25 * The storage access key.
26 */
27 storageAccessKey?: string;
28 /**
29 * (Optional) azure storage host.
30 */
31 host?: string | Host;
32}
33/**
34 * Middleware that implements a BlobStorage based storage provider for a bot.
35 *
36 * @remarks
37 * The BlobStorage implements its storage using a single Azure Storage Blob Container. Each entity
38 * is serialized into a JSON string and stored in an individual text blob. Each blob
39 * is named after the key which is encoded and ensure it conforms a valid blob name.
40 *
41 * @deprecated This class is deprecated in favor of [BlobsStorage](xref:botbuilder-azure-blobs.BlobsStorage)
42 */
43export declare class BlobStorage implements Storage {
44 private settings;
45 private client;
46 private useEmulator;
47 /**
48 * Creates a new BlobStorage instance.
49 *
50 * @param settings Settings for configuring an instance of BlobStorage.
51 */
52 constructor(settings: BlobStorageSettings);
53 /**
54 * Retrieve entities from the configured blob container.
55 *
56 * @param keys An array of entity keys.
57 * @returns The read items.
58 */
59 read(keys: string[]): Promise<StoreItems>;
60 /**
61 * Store a new entity in the configured blob container.
62 *
63 * @param changes The changes to write to storage.
64 */
65 write(changes: StoreItems): Promise<void>;
66 /**
67 * Delete entity blobs from the configured container.
68 *
69 * @param keys An array of entity keys.
70 */
71 delete(keys: string[]): Promise<void>;
72 /**
73 * Get a blob name validated representation of an entity to be used as a key.
74 *
75 * @param key The key used to identify the entity.
76 */
77 private sanitizeKey;
78 /**
79 * Check if a container name is valid.
80 *
81 * @param container String representing the container name to validate.
82 * @returns A boolean value that indicates whether or not the name is valid.
83 */
84 private checkContainerName;
85 /**
86 * Delay Container creation if it does not exist.
87 */
88 private ensureContainerExists;
89 /**
90 * Create a Blob Service.
91 *
92 * @param storageAccountOrConnectionString Azure CloudStorageAccount instance or Connection String.
93 * @param storageAccessKey Blob Service Access Key.
94 * @param host Blob Service Host.
95 * @returns The blob services created.
96 */
97 private createBlobService;
98 /**
99 * @private
100 * Turn a cb based azure method into a Promisified one.
101 */
102 private denodeify;
103}
104//# sourceMappingURL=blobStorage.d.ts.map
\No newline at end of file