package.dist.src.internal.cache-control-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
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CacheControlClient = void 0;
const generated_types_1 = require("@gomomento/generated-types");
var grpcControl = generated_types_1.control.control_client;
const headers_interceptor_1 = require("./grpc/headers-interceptor");
const cache_service_error_mapper_1 = require("../errors/cache-service-error-mapper");
const grpc_js_1 = require("@grpc/grpc-js");
const __1 = require("..");
const package_json_1 = require("../../package.json");
const idle_grpc_client_wrapper_1 = require("./grpc/idle-grpc-client-wrapper");
const utils_1 = require("@gomomento/sdk-core/dist/src/internal/utils");
const retry_interceptor_1 = require("./grpc/retry-interceptor");
const utils_2 = require("@gomomento/sdk-core/dist/src/utils");
class CacheControlClient {
/**
* @param {ControlClientProps} props
*/
constructor(props) {
this.logger = props.configuration.getLoggerFactory().getLogger(this);
this.cacheServiceErrorMapper = new cache_service_error_mapper_1.CacheServiceErrorMapper(props.configuration.getThrowOnErrors());
const headers = [
new headers_interceptor_1.Header('Authorization', props.credentialProvider.getAuthToken()),
new headers_interceptor_1.Header('agent', `nodejs:cache:${package_json_1.version}`),
new headers_interceptor_1.Header('runtime-version', `nodejs:${process.versions.node}`),
];
this.interceptors = [
headers_interceptor_1.HeaderInterceptor.createHeadersInterceptor(headers),
retry_interceptor_1.RetryInterceptor.createRetryInterceptor({
clientName: 'CacheControlClient',
loggerFactory: props.configuration.getLoggerFactory(),
overallRequestTimeoutMs: CacheControlClient.REQUEST_TIMEOUT_MS,
}),
];
this.logger.debug(`Creating control client using endpoint: '${props.credentialProvider.getControlEndpoint()}`);
this.clientWrapper = new idle_grpc_client_wrapper_1.IdleGrpcClientWrapper({
clientFactoryFn: () => new grpcControl.ScsControlClient(props.credentialProvider.getControlEndpoint(), props.credentialProvider.isControlEndpointSecure()
? grpc_js_1.ChannelCredentials.createSsl()
: grpc_js_1.ChannelCredentials.createInsecure()),
loggerFactory: props.configuration.getLoggerFactory(),
maxIdleMillis: props.configuration
.getTransportStrategy()
.getMaxIdleMillis(),
});
}
close() {
this.logger.debug('Closing cache control client');
this.clientWrapper.getClient().close();
}
async createCache(name) {
try {
(0, utils_1.validateCacheName)(name);
}
catch (err) {
return this.cacheServiceErrorMapper.returnOrThrowError(err, err => new __1.CreateCache.Error(err));
}
this.logger.debug(`Creating cache: ${name}`);
const request = new grpcControl._CreateCacheRequest({
cache_name: name,
});
return await new Promise((resolve, reject) => {
this.clientWrapper
.getClient()
.CreateCache(request, { interceptors: this.interceptors }, (err, _resp) => {
if (err) {
const sdkError = this.cacheServiceErrorMapper.convertError(err);
if (sdkError.errorCode() ===
__1.MomentoErrorCode.CACHE_ALREADY_EXISTS_ERROR) {
resolve(new __1.CreateCache.AlreadyExists());
}
else {
this.cacheServiceErrorMapper.resolveOrRejectError({
err: err,
errorResponseFactoryFn: e => new __1.CreateCache.Error(e),
resolveFn: resolve,
rejectFn: reject,
});
}
}
else {
resolve(new __1.CreateCache.Success());
}
});
});
}
async deleteCache(name) {
try {
(0, utils_1.validateCacheName)(name);
}
catch (err) {
return this.cacheServiceErrorMapper.returnOrThrowError(err, err => new __1.DeleteCache.Error(err));
}
const request = new grpcControl._DeleteCacheRequest({
cache_name: name,
});
this.logger.debug(`Deleting cache: ${name}`);
return await new Promise((resolve, reject) => {
this.clientWrapper
.getClient()
.DeleteCache(request, { interceptors: this.interceptors }, (err, _resp) => {
if (err) {
this.cacheServiceErrorMapper.resolveOrRejectError({
err: err,
errorResponseFactoryFn: e => new __1.DeleteCache.Error(e),
resolveFn: resolve,
rejectFn: reject,
});
}
else {
resolve(new __1.DeleteCache.Success());
}
});
});
}
async flushCache(cacheName) {
try {
(0, utils_1.validateCacheName)(cacheName);
}
catch (err) {
return this.cacheServiceErrorMapper.returnOrThrowError(err, err => new __1.CacheFlush.Error(err));
}
this.logger.debug(`Flushing cache: ${cacheName}`);
return await this.sendFlushCache(cacheName);
}
async sendFlushCache(cacheName) {
const request = new grpcControl._FlushCacheRequest({
cache_name: cacheName,
});
return await new Promise((resolve, reject) => {
this.clientWrapper.getClient().FlushCache(request, {
interceptors: this.interceptors,
}, (err, resp) => {
if (resp) {
resolve(new __1.CacheFlush.Success());
}
else {
this.cacheServiceErrorMapper.resolveOrRejectError({
err: err,
errorResponseFactoryFn: e => new __1.CacheFlush.Error(e),
resolveFn: resolve,
rejectFn: reject,
});
}
});
});
}
async listCaches() {
const request = new grpcControl._ListCachesRequest();
request.next_token = '';
this.logger.debug("Issuing 'listCaches' request");
return await new Promise((resolve, reject) => {
this.clientWrapper
.getClient()
.ListCaches(request, { interceptors: this.interceptors }, (err, resp) => {
if (err || !resp) {
this.cacheServiceErrorMapper.resolveOrRejectError({
err: err,
errorResponseFactoryFn: e => new __1.ListCaches.Error(e),
resolveFn: resolve,
rejectFn: reject,
});
}
else {
const caches = resp.cache.map(cache => {
var _a, _b, _c, _d, _e, _f, _g;
const cacheName = cache.cache_name;
const topicLimits = {
maxPublishMessageSizeKb: ((_a = cache.topic_limits) === null || _a === void 0 ? void 0 : _a.max_publish_message_size_kb) || 0,
maxSubscriptionCount: ((_b = cache.topic_limits) === null || _b === void 0 ? void 0 : _b.max_subscription_count) || 0,
maxPublishRate: ((_c = cache.topic_limits) === null || _c === void 0 ? void 0 : _c.max_publish_rate) || 0,
};
const cacheLimits = {
maxTtlSeconds: ((_d = cache.cache_limits) === null || _d === void 0 ? void 0 : _d.max_ttl_seconds) || 0,
maxItemSizeKb: ((_e = cache.cache_limits) === null || _e === void 0 ? void 0 : _e.max_item_size_kb) || 0,
maxThroughputKbps: ((_f = cache.cache_limits) === null || _f === void 0 ? void 0 : _f.max_throughput_kbps) || 0,
maxTrafficRate: ((_g = cache.cache_limits) === null || _g === void 0 ? void 0 : _g.max_traffic_rate) || 0,
};
return new __1.CacheInfo(cacheName, topicLimits, cacheLimits);
});
resolve(new __1.ListCaches.Success(caches));
}
});
});
}
}
exports.CacheControlClient = CacheControlClient;
CacheControlClient.REQUEST_TIMEOUT_MS = (0, utils_2.secondsToMilliseconds)(60);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FjaGUtY29udHJvbC1jbGllbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvaW50ZXJuYWwvY2FjaGUtY29udHJvbC1jbGllbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsZ0VBQW1EO0FBQ25ELElBQU8sV0FBVyxHQUFHLHlCQUFPLENBQUMsY0FBYyxDQUFDO0FBQzVDLG9FQUFxRTtBQUNyRSxxRkFBNkU7QUFDN0UsMkNBQThEO0FBQzlELDBCQVNZO0FBQ1oscURBQTJDO0FBQzNDLDhFQUFzRTtBQUd0RSx1RUFBOEU7QUFLOUUsZ0VBQTBEO0FBQzFELDhEQUF5RTtBQU96RSxNQUFhLGtCQUFrQjtJQVE3Qjs7T0FFRztJQUNILFlBQVksS0FBeUI7UUFDbkMsSUFBSSxDQUFDLE1BQU0sR0FBRyxLQUFLLENBQUMsYUFBYSxDQUFDLGdCQUFnQixFQUFFLENBQUMsU0FBUyxDQUFDLElBQUksQ0FBQyxDQUFDO1FBQ3JFLElBQUksQ0FBQyx1QkFBdUIsR0FBRyxJQUFJLG9EQUF1QixDQUN4RCxLQUFLLENBQUMsYUFBYSxDQUFDLGdCQUFnQixFQUFFLENBQ3ZDLENBQUM7UUFDRixNQUFNLE9BQU8sR0FBRztZQUNkLElBQUksNEJBQU0sQ0FBQyxlQUFlLEVBQUUsS0FBSyxDQUFDLGtCQUFrQixDQUFDLFlBQVksRUFBRSxDQUFDO1lBQ3BFLElBQUksNEJBQU0sQ0FBQyxPQUFPLEVBQUUsZ0JBQWdCLHNCQUFPLEVBQUUsQ0FBQztZQUM5QyxJQUFJLDRCQUFNLENBQUMsaUJBQWlCLEVBQUUsVUFBVSxPQUFPLENBQUMsUUF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hpcy5sb2dnZXIuZGVidWcoYERlbGV0aW5nIGNhY2hlOiAke25hbWV9YCk7XG4gICAgcmV0dXJuIGF3YWl0IG5ldyBQcm9taXNlPERlbGV0ZUNhY2hlLlJlc3BvbnNlPigocmVzb2x2ZSwgcmVqZWN0KSA9PiB7XG4gICAgICB0aGlzLmNsaWVudFdyYXBwZXJcbiAgICAgICAgLmdldENsaWVudCgpXG4gICAgICAgIC5EZWxldGVDYWNoZShcbiAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgIHtpbnRlcmNlcHRvcnM6IHRoaXMuaW50ZXJjZXB0b3JzfSxcbiAgICAgICAgICAoZXJyLCBfcmVzcCkgPT4ge1xuICAgICAgICAgICAgaWYgKGVycikge1xuICAgICAgICAgICAgICB0aGlzLmNhY2hlU2VydmljZUVycm9yTWFwcGVyLnJlc29sdmVPclJlamVjdEVycm9yKHtcbiAgICAgICAgICAgICAgICBlcnI6IGVycixcbiAgICAgICAgICAgICAgICBlcnJvclJlc3BvbnNlRmFjdG9yeUZuOiBlID0+IG5ldyBEZWxldGVDYWNoZS5FcnJvcihlKSxcbiAgICAgICAgICAgICAgICByZXNvbHZlRm46IHJlc29sdmUsXG4gICAgICAgICAgICAgICAgcmVqZWN0Rm46IHJlamVjdCxcbiAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICByZXNvbHZlKG5ldyBEZWxldGVDYWNoZS5TdWNjZXNzKCkpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgKTtcbiAgICB9KTtcbiAgfVxuXG4gIHB1YmxpYyBhc3luYyBmbHVzaENhY2hlKGNhY2hlTmFtZTogc3RyaW5nKTogUHJvbWlzZTxDYWNoZUZsdXNoLlJlc3BvbnNlPiB7XG4gICAgdHJ5IHtcbiAgICAgIHZhbGlkYXRlQ2FjaGVOYW1lKGNhY2hlTmFtZSk7XG4gICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICBy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gICAgICAgcmVzb2x2ZUZuOiByZXNvbHZlLFxuICAgICAgICAgICAgICByZWplY3RGbjogcmVqZWN0LFxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGNvbnN0IGNhY2hlcyA9IHJlc3AuY2FjaGUubWFwKGNhY2hlID0+IHtcbiAgICAgICAgICAgICAgY29uc3QgY2FjaGVOYW1lID0gY2FjaGUuY2FjaGVfbmFtZTtcbiAgICAgICAgICAgICAgY29uc3QgdG9waWNMaW1pdHM6IFRvcGljTGltaXRzID0ge1xuICAgICAgICAgICAgICAgIG1heFB1Ymxpc2hNZXNzYWdlU2l6ZUtiOlxuICAgICAgICAgICAgICAgICAgY2FjaGUudG9waWNfbGltaXRzPy5tYXhfcHVibGlzaF9tZXNzYWdlX3NpemVfa2IgfHwgMCxcbiAgICAgICAgICAgICAgICBtYXhTdWJzY3JpcHRpb25Db3VudDpcbiAgICAgICAgICAgICAgICAgIGNhY2hlLnRvcGljX2xpbWl0cz8ubWF4X3N1YnNjcmlwdGlvbl9jb3VudCB8fCAwLFxuICAgICAgICAgICAgICAgIG1heFB1Ymxpc2hSYXRlOiBjYWNoZS50b3BpY19saW1pdHM/Lm1heF9wdWJsaXNoX3JhdGUgfHwgMCxcbiAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgY29uc3QgY2FjaGVMaW1pdHM6IENhY2hlTGltaXRzID0ge1xuICAgICAgICAgICAgICAgIG1heFR0bFNlY29uZHM6IGNhY2hlLmNhY2hlX2xpbWl0cz8ubWF4X3R0bF9zZWNvbmRzIHx8IDAsXG4gICAgICAgICAgICAgICAgbWF4SXRlbVNpemVLYjogY2FjaGUuY2FjaGVfbGltaXRzPy5tYXhfaXRlbV9zaXplX2tiIHx8IDAsXG4gICAgICAgICAgICAgICAgbWF4VGhyb3VnaHB1dEticHM6IGNhY2hlLmNhY2hlX2xpbWl0cz8ubWF4X3Rocm91Z2hwdXRfa2JwcyB8fCAwLFxuICAgICAgICAgICAgICAgIG1heFRyYWZmaWNSYXRlOiBjYWNoZS5jYWNoZV9saW1pdHM/Lm1heF90cmFmZmljX3JhdGUgfHwgMCxcbiAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgcmV0dXJuIG5ldyBDYWNoZUluZm8oY2FjaGVOYW1lLCB0b3BpY0xpbWl0cywgY2FjaGVMaW1pdHMpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICByZXNvbHZlKG5ldyBMaXN0Q2FjaGVzLlN1Y2Nlc3MoY2FjaGVzKSk7XG4gICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICB9KTtcbiAgfVxufVxuIl19
© 2015 - 2025 Weber Informatics LLC | Privacy Policy