All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.src.internal.cache-control-client.js Maven / Gradle / Ivy

The newest version!
"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");
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 = 60 * 1000;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FjaGUtY29udHJvbC1jbGllbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvaW50ZXJuYWwvY2FjaGUtY29udHJvbC1jbGllbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsZ0VBQW1EO0FBQ25ELElBQU8sV0FBVyxHQUFHLHlCQUFPLENBQUMsY0FBYyxDQUFDO0FBQzVDLG9FQUFxRTtBQUNyRSxxRkFBNkU7QUFDN0UsMkNBQThEO0FBQzlELDBCQVNZO0FBQ1oscURBQTJDO0FBQzNDLDhFQUFzRTtBQUd0RSx1RUFBOEU7QUFLOUUsZ0VBQTBEO0FBTzFELE1BQWEsa0JBQWtCO0lBTzdCOztPQUVHO0lBQ0gsWUFBWSxLQUF5QjtRQUNuQyxJQUFJLENBQUMsTUFBTSxHQUFHLEtBQUssQ0FBQyxhQUFhLENBQUMsZ0JBQWdCLEVBQUUsQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLENBQUM7UUFDckUsSUFBSSxDQUFDLHVCQUF1QixHQUFHLElBQUksb0RBQXVCLENBQ3hELEtBQUssQ0FBQyxhQUFhLENBQUMsZ0JBQWdCLEVBQUUsQ0FDdkMsQ0FBQztRQUNGLE1BQU0sT0FBTyxHQUFHO1lBQ2QsSUFBSSw0QkFBTSxDQUFDLGVBQWUsRUFBRSxLQUFLLENBQUMsa0JBQWtCLENBQUMsWUFBWSxFQUFFLENBQUM7W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nVnKGBEZWxldGluZyBjYWNoZTogJHtuYW1lfWApO1xuICAgIHJldHVybiBhd2FpdCBuZXcgUHJvbWlzZTxEZWxldGVDYWNoZS5SZXNwb25zZT4oKHJlc29sdmUsIHJlamVjdCkgPT4ge1xuICAgICAgdGhpcy5jbGllbnRXcmFwcGVyXG4gICAgICAgIC5nZXRDbGllbnQoKVxuICAgICAgICAuRGVsZXRlQ2FjaGUoXG4gICAgICAgICAgcmVxdWVzdCxcbiAgICAgICAgICB7aW50ZXJjZXB0b3JzOiB0aGlzLmludGVyY2VwdG9yc30sXG4gICAgICAgICAgKGVyciwgX3Jlc3ApID0+IHtcbiAgICAgICAgICAgIGlmIChlcnIpIHtcbiAgICAgICAgICAgICAgdGhpcy5jYWNoZVNlcnZpY2VFcnJvck1hcHBlci5yZXNvbHZlT3JSZWplY3RFcnJvcih7XG4gICAgICAgICAgICAgICAgZXJyOiBlcnIsXG4gICAgICAgICAgICAgICAgZXJyb3JSZXNwb25zZUZhY3RvcnlGbjogZSA9PiBuZXcgRGVsZXRlQ2FjaGUuRXJyb3IoZSksXG4gICAgICAgICAgICAgICAgcmVzb2x2ZUZuOiByZXNvbHZlLFxuICAgICAgICAgICAgICAgIHJlamVjdEZuOiByZWplY3QsXG4gICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgcmVzb2x2ZShuZXcgRGVsZXRlQ2FjaGUuU3VjY2VzcygpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICk7XG4gICAgfSk7XG4gIH1cblxuICBwdWJsaWMgYXN5bmMgZmx1c2hDYWNoZShjYWNoZU5hbWU6IHN0cmluZyk6IFByb21pc2U8Q2FjaGVGbHVzaC5SZXNwb25zZT4ge1xuICAgIHRyeSB7XG4gICAgICB2YWxpZGF0ZUNhY2hlTmFtZShjYWNoZU5hbWUpO1xuICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgcmV0dXJuIHRoaX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FxuICAgICAgICAgICAgICBlcnJvclJlc3BvbnNlRmFjdG9yeUZuOiBlID0+IG5ldyBDYWNoZUZsdXNoLkVycm9yKGUpLFxuICAgICAgICAgICAgICByZXNvbHZlRm46IHJlc29sdmUsXG4gICAgICAgICAgICAgIHJlamVjdEZuOiByZWplY3QsXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICk7XG4gICAgfSk7XG4gIH1cblxuICBwdWJsaWMgYXN5bmMgbGlzdENhY2hlcygpOiBQcm9taXNlPExpc3RDYWNoZXMuUmVzcG9uc2U+IHtcbiAgICBjb25zdCByZXF1ZXN0ID0gbmV3IGdycGNDb250cm9sLl9MaXN0Q2FjaGVzUmVxdWVzdCgpO1xuICAgIHJlcXVlc3QubmV4dF90b2tlbiA9ICcnO1xuICAgIHRoaXMubG9nZ2VyLmRlYnVnKFwiSXNzdWluZyAnbGlzdENhY2hlcycgcmVxdWVzdFwiKTtcbiAgICByZXR1cm4gYXdhaXQgbmV3IFByb21pc2U8TGlzdENhY2hlcy5SZXNwb25zZT4oKHJlc29sdmUsIHJlamVjdCkgPT4ge1xuICAgICAgdGhpcy5jbGllbnRXcmFwcGVyXG4gICAgICAgIC5nZXRDbGllbnQoKVxuICAgICAgICAuTGlzdENhY2hlcyhyZXF1ZXN0LCB7aW50ZXJjZXB0b3JzOiB0aGlzLmludGVyY2VwdG9yc30sIChlcnIsIHJlc3ApID0+IHtcbiAgICAgICAgICBpZiAoZXJyIHx8ICFyZXNwKSB7XG4gICAgICAgICAgICB0aGlzLmNhY2hlU2VydmljZUVycm9yTWFwcGVyLnJlc29sdmVPclJlamVjdEVycm9yKHtcbiAgICAgICAgICAgICAgZXJyOiBlcnIsXG4gICAgICAgICAgICAgIGVycm9yUmVzcG9uc2VGYWN0b3J5Rm46IGUgPT4gbmV3IExpc3RDYWNoZXMuRXJyb3IoZSksXG4gICAgICAgICAgICAgIHJlc29sdmVGbjogcmVzb2x2ZSxcbiAgICAgICAgICAgICAgcmVqZWN0Rm46IHJlamVjdCxcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBjb25zdCBjYWNoZXMgPSByZXNwLmNhY2hlLm1hcChjYWNoZSA9PiB7XG4gICAgICAgICAgICAgIGNvbnN0IGNhY2hlTmFtZSA9IGNhY2hlLmNhY2hlX25hbWU7XG4gICAgICAgICAgICAgIGNvbnN0IHRvcGljTGltaXRzOiBUb3BpY0xpbWl0cyA9IHtcbiAgICAgICAgICAgICAgICBtYXhQdWJsaXNoTWVzc2FnZVNpemVLYjpcbiAgICAgICAgICAgICAgICAgIGNhY2hlLnRvcGljX2xpbWl0cz8ubWF4X3B1Ymxpc2hfbWVzc2FnZV9zaXplX2tiIHx8IDAsXG4gICAgICAgICAgICAgICAgbWF4U3Vic2NyaXB0aW9uQ291bnQ6XG4gICAgICAgICAgICAgICAgICBjYWNoZS50b3BpY19saW1pdHM/Lm1heF9zdWJzY3JpcHRpb25fY291bnQgfHwgMCxcbiAgICAgICAgICAgICAgICBtYXhQdWJsaXNoUmF0ZTogY2FjaGUudG9waWNfbGltaXRzPy5tYXhfcHVibGlzaF9yYXRlIHx8IDAsXG4gICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgIGNvbnN0IGNhY2hlTGltaXRzOiBDYWNoZUxpbWl0cyA9IHtcbiAgICAgICAgICAgICAgICBtYXhUdGxTZWNvbmRzOiBjYWNoZS5jYWNoZV9saW1pdHM/Lm1heF90dGxfc2Vjb25kcyB8fCAwLFxuICAgICAgICAgICAgICAgIG1heEl0ZW1TaXplS2I6IGNhY2hlLmNhY2hlX2xpbWl0cz8ubWF4X2l0ZW1fc2l6ZV9rYiB8fCAwLFxuICAgICAgICAgICAgICAgIG1heFRocm91Z2hwdXRLYnBzOiBjYWNoZS5jYWNoZV9saW1pdHM/Lm1heF90aHJvdWdocHV0X2ticHMgfHwgMCxcbiAgICAgICAgICAgICAgICBtYXhUcmFmZmljUmF0ZTogY2FjaGUuY2FjaGVfbGltaXRzPy5tYXhfdHJhZmZpY19yYXRlIHx8IDAsXG4gICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgIHJldHVybiBuZXcgQ2FjaGVJbmZvKGNhY2hlTmFtZSwgdG9waWNMaW1pdHMsIGNhY2hlTGltaXRzKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgcmVzb2x2ZShuZXcgTGlzdENhY2hlcy5TdWNjZXNzKGNhY2hlcykpO1xuICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgfSk7XG4gIH1cbn1cbiJdfQ==




© 2015 - 2024 Weber Informatics LLC | Privacy Policy