@splitsoftware/splitio-commons
Version:
Split JavaScript SDK common components
61 lines (60 loc) • 2.5 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.KeyBuilderSS = exports.METHOD_NAMES = void 0;
var tslib_1 = require("tslib");
var KeyBuilder_1 = require("./KeyBuilder");
exports.METHOD_NAMES = {
t: 'treatment',
ts: 'treatments',
tc: 'treatmentWithConfig',
tcs: 'treatmentsWithConfig',
tf: 'treatmentsByFlagSet',
tfs: 'treatmentsByFlagSets',
tcf: 'treatmentsWithConfigByFlagSet',
tcfs: 'treatmentsWithConfigByFlagSets',
tr: 'track'
};
var KeyBuilderSS = /** @class */ (function (_super) {
(0, tslib_1.__extends)(KeyBuilderSS, _super);
function KeyBuilderSS(prefix, metadata) {
var _this = _super.call(this, prefix) || this;
_this.latencyPrefix = _this.prefix + ".telemetry.latencies";
_this.exceptionPrefix = _this.prefix + ".telemetry.exceptions";
_this.initPrefix = _this.prefix + ".telemetry.init";
_this.versionablePrefix = metadata.s + "/" + metadata.n + "/" + metadata.i;
return _this;
}
KeyBuilderSS.prototype.buildRegisteredSegmentsKey = function () {
return this.prefix + ".segments.registered";
};
KeyBuilderSS.prototype.buildImpressionsKey = function () {
return this.prefix + ".impressions";
};
KeyBuilderSS.prototype.buildImpressionsCountKey = function () {
return this.prefix + ".impressions.count";
};
KeyBuilderSS.prototype.buildUniqueKeysKey = function () {
return this.prefix + ".uniquekeys";
};
KeyBuilderSS.prototype.buildEventsKey = function () {
return this.prefix + ".events";
};
KeyBuilderSS.prototype.searchPatternForSplitKeys = function () {
return this.buildSplitKeyPrefix() + "*";
};
KeyBuilderSS.prototype.searchPatternForRBSegmentKeys = function () {
return this.buildRBSegmentKeyPrefix() + "*";
};
/* Telemetry keys */
KeyBuilderSS.prototype.buildLatencyKey = function (method, bucket) {
return this.latencyPrefix + "::" + this.versionablePrefix + "/" + exports.METHOD_NAMES[method] + "/" + bucket;
};
KeyBuilderSS.prototype.buildExceptionKey = function (method) {
return this.exceptionPrefix + "::" + this.versionablePrefix + "/" + exports.METHOD_NAMES[method];
};
KeyBuilderSS.prototype.buildInitKey = function () {
return this.initPrefix + "::" + this.versionablePrefix;
};
return KeyBuilderSS;
}(KeyBuilder_1.KeyBuilder));
exports.KeyBuilderSS = KeyBuilderSS;
;