botbuilder-core
Version:
Core components for Microsoft Bot Builder. Components in this library can run either in a browser or on the server.
64 lines • 2.22 kB
TypeScript
/**
* @module botbuilder
*/
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import { Storage, StoreItems } from './storage';
/**
* Memory based storage provider for a bot.
*
* @remarks
* This provider is most useful for simulating production storage when running locally against the
* emulator or as part of a unit test. It has the following characteristics:
*
* - Starts off completely empty when the bot is run.
* - Anything written to the store will be forgotten when the process exits.
* - Objects that are read and written to the store are cloned to properly simulate network based
* storage providers.
* - Cloned objects are serialized using `JSON.stringify()` to catch any possible serialization
* related issues that might occur when using a network based storage provider.
*
* ```JavaScript
* const { MemoryStorage } = require('botbuilder');
*
* const storage = new MemoryStorage();
* ```
*/
export declare class MemoryStorage implements Storage {
protected memory: {
[k: string]: string;
};
protected etag: number;
/**
* Creates a new MemoryStorage instance.
*
* @param memory (Optional) memory to use for storing items. By default it will create an empty JSON object `{}`.
*/
constructor(memory?: {
[k: string]: string;
});
/**
* Reads storage items from storage.
*
* @param keys Keys of the [StoreItems](xref:botbuilder-core.StoreItems) objects to read.
* @returns The read items.
*/
read(keys: string[]): Promise<StoreItems>;
/**
* Writes storage items to storage.
*
* @param changes The [StoreItems](xref:botbuilder-core.StoreItems) to write, indexed by key.
* @returns {Promise<void>} A promise representing the async operation.
*/
write(changes: StoreItems): Promise<void>;
/**
* Deletes storage items from storage.
*
* @param keys Keys of the [StoreItems](xref:botbuilder-core.StoreItems) objects to delete.
* @returns {Promise<void>} A promise representing the async operation.
*/
delete(keys: string[]): Promise<void>;
}
//# sourceMappingURL=memoryStorage.d.ts.map