UNPKG

@launchdarkly/js-server-sdk-common

Version:
49 lines 1.33 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const promisify_1 = require("../async/promisify"); /** * Provides an async interface to a feature store. * * This allows for using a store using async/await instead of callbacks. * */ class AsyncStoreFacade { constructor(store) { this._store = store; } async get(kind, key) { return (0, promisify_1.default)((cb) => { this._store.get(kind, key, cb); }); } async all(kind) { return (0, promisify_1.default)((cb) => { this._store.all(kind, cb); }); } async init(allData) { return (0, promisify_1.default)((cb) => { this._store.init(allData, cb); }); } async delete(kind, key, version) { return (0, promisify_1.default)((cb) => { this._store.delete(kind, key, version, cb); }); } async upsert(kind, data) { return (0, promisify_1.default)((cb) => { this._store.upsert(kind, data, cb); }); } async initialized() { return (0, promisify_1.default)((cb) => { this._store.initialized(cb); }); } close() { this._store.close(); } } exports.default = AsyncStoreFacade; //# sourceMappingURL=AsyncStoreFacade.js.map