package.dist.src.preview-storage-client.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sdk Show documentation
Show all versions of sdk Show documentation
Client SDK for Momento services
The newest version!
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PreviewStorageClient = void 0;
const clients_1 = require("@gomomento/sdk-core/dist/src/internal/clients");
const storage_control_client_1 = require("./internal/storage-control-client");
const storage_data_client_1 = require("./internal/storage-data-client");
const index_1 = require("./index");
const sdk_core_1 = require("@gomomento/sdk-core");
/**
* A client for interacting with the Momento Storage service.
* Warning: This client is in preview and may change in future releases.
*/
class PreviewStorageClient extends clients_1.AbstractStorageClient {
constructor(props) {
var _a, _b;
const allProps = {
configuration: (_a = props.configuration) !== null && _a !== void 0 ? _a : getDefaultStorageConfiguration(),
credentialProvider: (_b = props.credentialProvider) !== null && _b !== void 0 ? _b : (0, sdk_core_1.getDefaultCredentialProvider)(),
};
const controlClient = createControlClient(allProps);
const dataClient = createDataClient(allProps);
super([dataClient], controlClient);
}
close() {
this.dataClients.forEach(client => client.close());
this.controlClient.close();
}
}
exports.PreviewStorageClient = PreviewStorageClient;
function createControlClient(props) {
return new storage_control_client_1.StorageControlClient(props);
}
function createDataClient(props) {
return new storage_data_client_1.StorageDataClient(props);
}
function getDefaultStorageConfiguration() {
return index_1.StorageConfigurations.Laptop.latest();
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJldmlldy1zdG9yYWdlLWNsaWVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wcmV2aWV3LXN0b3JhZ2UtY2xpZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLDJFQUl1RDtBQUl2RCw4RUFBdUU7QUFDdkUsd0VBQWlFO0FBRWpFLG1DQUE4QztBQUM5QyxrREFBaUU7QUFFakU7OztHQUdHO0FBQ0gsTUFBYSxvQkFDWCxTQUFRL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