@splitsoftware/splitio-commons 2.11.1-rc.2 → 2.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.txt +6 -2
- package/cjs/evaluator/condition/engineUtils.js +2 -2
- package/cjs/evaluator/fallbackTreatmentsCalculator/fallbackSanitizer/index.js +3 -3
- package/cjs/evaluator/fallbackTreatmentsCalculator/index.js +21 -32
- package/cjs/evaluator/matchers/whitelist.js +1 -1
- package/cjs/integrations/pluggable.js +1 -1
- package/cjs/listeners/node.js +2 -2
- package/cjs/logger/constants.js +3 -4
- package/cjs/logger/index.js +1 -1
- package/cjs/logger/messages/debug.js +1 -1
- package/cjs/logger/messages/error.js +1 -1
- package/cjs/logger/messages/info.js +2 -3
- package/cjs/logger/messages/warn.js +4 -4
- package/cjs/sdkClient/client.js +2 -3
- package/cjs/sdkClient/clientAttributesDecoration.js +3 -3
- package/cjs/sdkClient/clientInputValidation.js +36 -68
- package/cjs/sdkClient/identity.js +1 -1
- package/cjs/sdkClient/sdkClient.js +19 -7
- package/cjs/sdkFactory/index.js +8 -41
- package/cjs/services/splitApi.js +13 -13
- package/cjs/services/splitHttpClient.js +1 -1
- package/cjs/storages/KeyBuilder.js +12 -12
- package/cjs/storages/KeyBuilderCS.js +13 -13
- package/cjs/storages/KeyBuilderSS.js +15 -15
- package/cjs/storages/getRolloutPlan.js +1 -1
- package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +1 -1
- package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +1 -1
- package/cjs/storages/inMemory/ImpressionCountsCacheInMemory.js +1 -1
- package/cjs/storages/inMemory/MySegmentsCacheInMemory.js +1 -1
- package/cjs/storages/inMemory/SplitsCacheInMemory.js +1 -1
- package/cjs/storages/inRedis/EventsCacheInRedis.js +1 -1
- package/cjs/storages/inRedis/ImpressionCountsCacheInRedis.js +5 -5
- package/cjs/storages/inRedis/ImpressionsCacheInRedis.js +1 -1
- package/cjs/storages/inRedis/RedisAdapter.js +8 -8
- package/cjs/storages/inRedis/SplitsCacheInRedis.js +6 -6
- package/cjs/storages/inRedis/TelemetryCacheInRedis.js +7 -7
- package/cjs/storages/inRedis/UniqueKeysCacheInRedis.js +3 -3
- package/cjs/storages/pluggable/EventsCachePluggable.js +1 -1
- package/cjs/storages/pluggable/ImpressionCountsCachePluggable.js +6 -6
- package/cjs/storages/pluggable/SplitsCachePluggable.js +4 -4
- package/cjs/storages/pluggable/TelemetryCachePluggable.js +7 -7
- package/cjs/storages/pluggable/UniqueKeysCachePluggable.js +2 -2
- package/cjs/storages/pluggable/index.js +3 -3
- package/cjs/storages/pluggable/wrapperAdapter.js +1 -1
- package/cjs/storages/setRolloutPlan.js +3 -3
- package/cjs/storages/utils.js +6 -6
- package/cjs/sync/offline/splitsParser/parseCondition.js +1 -1
- package/cjs/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
- package/cjs/sync/polling/pollingManagerSS.js +2 -2
- package/cjs/sync/polling/updaters/segmentChangesUpdater.js +6 -6
- package/cjs/sync/polling/updaters/splitChangesUpdater.js +12 -10
- package/cjs/sync/streaming/SSEClient/index.js +2 -2
- package/cjs/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +2 -2
- package/cjs/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +2 -2
- package/cjs/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +2 -2
- package/cjs/sync/streaming/parseUtils.js +1 -1
- package/cjs/sync/submitters/submitter.js +1 -1
- package/cjs/trackers/eventTracker.js +10 -12
- package/cjs/trackers/impressionObserver/buildKey.js +1 -1
- package/cjs/trackers/impressionsTracker.js +37 -20
- package/cjs/trackers/uniqueKeysTracker.js +1 -1
- package/cjs/utils/inputValidation/apiKey.js +1 -1
- package/cjs/utils/inputValidation/attribute.js +2 -2
- package/cjs/utils/inputValidation/eventProperties.js +1 -1
- package/cjs/utils/inputValidation/isOperational.js +1 -1
- package/cjs/utils/lang/index.js +1 -1
- package/cjs/utils/lang/sets.js +4 -4
- package/cjs/utils/promise/timeout.js +1 -1
- package/cjs/utils/settingsValidation/splitFilters.js +2 -2
- package/cjs/utils/settingsValidation/url.js +5 -5
- package/esm/evaluator/condition/engineUtils.js +2 -2
- package/esm/evaluator/fallbackTreatmentsCalculator/fallbackSanitizer/index.js +3 -3
- package/esm/evaluator/fallbackTreatmentsCalculator/index.js +21 -33
- package/esm/evaluator/matchers/whitelist.js +1 -1
- package/esm/integrations/pluggable.js +1 -1
- package/esm/listeners/node.js +2 -2
- package/esm/logger/constants.js +0 -1
- package/esm/logger/index.js +1 -1
- package/esm/logger/messages/info.js +1 -2
- package/esm/logger/messages/warn.js +3 -3
- package/esm/sdkClient/client.js +3 -4
- package/esm/sdkClient/clientAttributesDecoration.js +3 -3
- package/esm/sdkClient/clientInputValidation.js +36 -68
- package/esm/sdkClient/identity.js +1 -1
- package/esm/sdkClient/sdkClient.js +20 -8
- package/esm/sdkFactory/index.js +8 -41
- package/esm/services/splitApi.js +13 -13
- package/esm/services/splitHttpClient.js +1 -1
- package/esm/storages/KeyBuilder.js +12 -12
- package/esm/storages/KeyBuilderCS.js +12 -12
- package/esm/storages/KeyBuilderSS.js +14 -14
- package/esm/storages/getRolloutPlan.js +1 -1
- package/esm/storages/inMemory/ImpressionCountsCacheInMemory.js +1 -1
- package/esm/storages/inRedis/EventsCacheInRedis.js +1 -1
- package/esm/storages/inRedis/ImpressionCountsCacheInRedis.js +4 -4
- package/esm/storages/inRedis/RedisAdapter.js +7 -7
- package/esm/storages/inRedis/SplitsCacheInRedis.js +4 -4
- package/esm/storages/inRedis/TelemetryCacheInRedis.js +7 -7
- package/esm/storages/inRedis/UniqueKeysCacheInRedis.js +1 -1
- package/esm/storages/pluggable/EventsCachePluggable.js +1 -1
- package/esm/storages/pluggable/ImpressionCountsCachePluggable.js +5 -5
- package/esm/storages/pluggable/SplitsCachePluggable.js +2 -2
- package/esm/storages/pluggable/TelemetryCachePluggable.js +7 -7
- package/esm/storages/pluggable/UniqueKeysCachePluggable.js +1 -1
- package/esm/storages/pluggable/index.js +2 -2
- package/esm/storages/pluggable/wrapperAdapter.js +1 -1
- package/esm/storages/setRolloutPlan.js +3 -3
- package/esm/storages/utils.js +6 -6
- package/esm/sync/offline/splitsParser/parseCondition.js +1 -1
- package/esm/sync/polling/pollingManagerSS.js +2 -2
- package/esm/sync/polling/updaters/segmentChangesUpdater.js +6 -6
- package/esm/sync/polling/updaters/splitChangesUpdater.js +12 -10
- package/esm/sync/streaming/SSEClient/index.js +2 -2
- package/esm/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +2 -2
- package/esm/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +2 -2
- package/esm/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +2 -2
- package/esm/sync/streaming/parseUtils.js +1 -1
- package/esm/sync/submitters/submitter.js +1 -1
- package/esm/trackers/eventTracker.js +10 -12
- package/esm/trackers/impressionObserver/buildKey.js +1 -1
- package/esm/trackers/impressionsTracker.js +38 -21
- package/esm/trackers/uniqueKeysTracker.js +1 -1
- package/esm/utils/inputValidation/apiKey.js +1 -1
- package/esm/utils/inputValidation/attribute.js +2 -2
- package/esm/utils/inputValidation/isOperational.js +1 -1
- package/esm/utils/lang/sets.js +4 -4
- package/esm/utils/promise/timeout.js +1 -1
- package/esm/utils/settingsValidation/splitFilters.js +2 -2
- package/esm/utils/settingsValidation/url.js +5 -5
- package/package.json +5 -5
- package/src/dtos/types.ts +15 -15
- package/src/evaluator/condition/engineUtils.ts +2 -2
- package/src/evaluator/fallbackTreatmentsCalculator/index.ts +23 -41
- package/src/evaluator/matchers/whitelist.ts +2 -2
- package/src/evaluator/types.ts +2 -2
- package/src/evaluator/value/index.ts +1 -1
- package/src/integrations/pluggable.ts +1 -1
- package/src/logger/constants.ts +0 -1
- package/src/logger/messages/info.ts +1 -2
- package/src/logger/messages/warn.ts +3 -3
- package/src/sdkClient/client.ts +3 -5
- package/src/sdkClient/clientInputValidation.ts +38 -61
- package/src/sdkClient/sdkClient.ts +20 -5
- package/src/sdkFactory/index.ts +10 -47
- package/src/sdkFactory/types.ts +6 -3
- package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +1 -1
- package/src/storages/inMemory/SplitsCacheInMemory.ts +1 -1
- package/src/storages/inRedis/SplitsCacheInRedis.ts +1 -1
- package/src/storages/pluggable/SplitsCachePluggable.ts +1 -1
- package/src/storages/setRolloutPlan.ts +2 -2
- package/src/sync/polling/updaters/segmentChangesUpdater.ts +1 -1
- package/src/sync/polling/updaters/splitChangesUpdater.ts +11 -9
- package/src/trackers/eventTracker.ts +7 -10
- package/src/trackers/impressionsTracker.ts +42 -26
- package/src/trackers/types.ts +3 -1
- package/src/utils/lang/sets.ts +4 -2
- package/types/splitio.d.ts +22 -18
|
@@ -21,7 +21,7 @@ function processPipelineAnswer(results) {
|
|
|
21
21
|
* Supported by Node.js
|
|
22
22
|
*/
|
|
23
23
|
var SplitsCacheInRedis = /** @class */ (function (_super) {
|
|
24
|
-
|
|
24
|
+
tslib_1.__extends(SplitsCacheInRedis, _super);
|
|
25
25
|
function SplitsCacheInRedis(log, keys, redis, splitFiltersValidation) {
|
|
26
26
|
var _this = _super.call(this) || this;
|
|
27
27
|
_this.log = log;
|
|
@@ -60,7 +60,7 @@ var SplitsCacheInRedis = /** @class */ (function (_super) {
|
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
var items = [featureFlagName];
|
|
63
|
-
return Promise.all(
|
|
63
|
+
return Promise.all(tslib_1.__spreadArray(tslib_1.__spreadArray([], removeFromFlagSets.map(function (flagSetName) { return _this.redis.srem(_this.keys.buildFlagSetKey(flagSetName), items); }), true), addToFlagSets.map(function (flagSetName) { return _this.redis.sadd(_this.keys.buildFlagSetKey(flagSetName), items); }), true));
|
|
64
64
|
};
|
|
65
65
|
/**
|
|
66
66
|
* Add a given split.
|
|
@@ -179,7 +179,7 @@ var SplitsCacheInRedis = /** @class */ (function (_super) {
|
|
|
179
179
|
var e = _a[0], value = _a[1];
|
|
180
180
|
if (e === null)
|
|
181
181
|
return value;
|
|
182
|
-
_this.log.error(constants_1.LOG_PREFIX +
|
|
182
|
+
_this.log.error(constants_1.LOG_PREFIX + "Could not read result from get members of flag set ".concat(flagSets[index], " due to an error: ").concat(e));
|
|
183
183
|
}) : []; })
|
|
184
184
|
.then(function (namesByFlagSets) { return namesByFlagSets.map(function (namesByFlagSet) { return new Set(namesByFlagSet); }); });
|
|
185
185
|
};
|
|
@@ -198,13 +198,13 @@ var SplitsCacheInRedis = /** @class */ (function (_super) {
|
|
|
198
198
|
return false; // if entry doesn't exist, means that TT doesn't exist
|
|
199
199
|
ttCount = parseInt(ttCount, 10);
|
|
200
200
|
if (!(0, lang_1.isFiniteNumber)(ttCount) || ttCount < 0) {
|
|
201
|
-
_this.log.info(constants_1.LOG_PREFIX +
|
|
201
|
+
_this.log.info(constants_1.LOG_PREFIX + "Could not validate traffic type existence of ".concat(trafficType, " due to data corruption of some sorts."));
|
|
202
202
|
return false;
|
|
203
203
|
}
|
|
204
204
|
return ttCount > 0;
|
|
205
205
|
})
|
|
206
206
|
.catch(function (e) {
|
|
207
|
-
_this.log.error(constants_1.LOG_PREFIX +
|
|
207
|
+
_this.log.error(constants_1.LOG_PREFIX + "Could not validate traffic type existence of ".concat(trafficType, " due to an error: ").concat(e, "."));
|
|
208
208
|
// If there is an error, bypass the validation so the event can get tracked.
|
|
209
209
|
return true;
|
|
210
210
|
});
|
|
@@ -234,7 +234,7 @@ var SplitsCacheInRedis = /** @class */ (function (_super) {
|
|
|
234
234
|
return Promise.resolve(splits);
|
|
235
235
|
})
|
|
236
236
|
.catch(function (e) {
|
|
237
|
-
_this.log.error(constants_1.LOG_PREFIX +
|
|
237
|
+
_this.log.error(constants_1.LOG_PREFIX + "Could not grab feature flags due to an error: ".concat(e, "."));
|
|
238
238
|
return Promise.reject(e);
|
|
239
239
|
});
|
|
240
240
|
};
|
|
@@ -45,17 +45,17 @@ var TelemetryCacheInRedis = /** @class */ (function () {
|
|
|
45
45
|
Object.keys(latencies).forEach(function (field) {
|
|
46
46
|
var parsedField = (0, utils_1.parseLatencyField)(field);
|
|
47
47
|
if ((0, lang_1.isString)(parsedField)) {
|
|
48
|
-
_this.log.error("Ignoring invalid latency field: "
|
|
48
|
+
_this.log.error("Ignoring invalid latency field: ".concat(field, ": ").concat(parsedField));
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
var count = parseInt(latencies[field]);
|
|
52
52
|
if ((0, lang_1.isNaNNumber)(count)) {
|
|
53
|
-
_this.log.error("Ignoring latency with invalid count: "
|
|
53
|
+
_this.log.error("Ignoring latency with invalid count: ".concat(latencies[field]));
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
56
|
var metadata = parsedField[0], method = parsedField[1], bucket = parsedField[2];
|
|
57
57
|
if (bucket >= TelemetryCacheInMemory_1.MAX_LATENCY_BUCKET_COUNT) {
|
|
58
|
-
_this.log.error("Ignoring latency with invalid bucket: "
|
|
58
|
+
_this.log.error("Ignoring latency with invalid bucket: ".concat(bucket));
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
var methodLatencies = result.get(metadata) || {};
|
|
@@ -77,12 +77,12 @@ var TelemetryCacheInRedis = /** @class */ (function () {
|
|
|
77
77
|
Object.keys(exceptions).forEach(function (field) {
|
|
78
78
|
var parsedField = (0, utils_1.parseExceptionField)(field);
|
|
79
79
|
if ((0, lang_1.isString)(parsedField)) {
|
|
80
|
-
_this.log.error("Ignoring invalid exception field: "
|
|
80
|
+
_this.log.error("Ignoring invalid exception field: ".concat(field, ": ").concat(parsedField));
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
var count = parseInt(exceptions[field]);
|
|
84
84
|
if ((0, lang_1.isNaNNumber)(count)) {
|
|
85
|
-
_this.log.error("Ignoring exception with invalid count: "
|
|
85
|
+
_this.log.error("Ignoring exception with invalid count: ".concat(exceptions[field]));
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
88
|
var metadata = parsedField[0], method = parsedField[1];
|
|
@@ -104,7 +104,7 @@ var TelemetryCacheInRedis = /** @class */ (function () {
|
|
|
104
104
|
Object.keys(configs).forEach(function (field) {
|
|
105
105
|
var parsedField = (0, utils_1.parseMetadata)(field);
|
|
106
106
|
if ((0, lang_1.isString)(parsedField)) {
|
|
107
|
-
_this.log.error("Ignoring invalid config field: "
|
|
107
|
+
_this.log.error("Ignoring invalid config field: ".concat(field, ": ").concat(parsedField));
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
110
|
var metadata = parsedField[0];
|
|
@@ -113,7 +113,7 @@ var TelemetryCacheInRedis = /** @class */ (function () {
|
|
|
113
113
|
result.set(metadata, config);
|
|
114
114
|
}
|
|
115
115
|
catch (e) {
|
|
116
|
-
_this.log.error("Ignoring invalid config: "
|
|
116
|
+
_this.log.error("Ignoring invalid config: ".concat(configs[field]));
|
|
117
117
|
}
|
|
118
118
|
});
|
|
119
119
|
return _this.redis.del(_this.keys.initPrefix).then(function () { return result; });
|
|
@@ -7,7 +7,7 @@ var constants_1 = require("./constants");
|
|
|
7
7
|
var constants_2 = require("./constants");
|
|
8
8
|
var sets_1 = require("../../utils/lang/sets");
|
|
9
9
|
var UniqueKeysCacheInRedis = /** @class */ (function (_super) {
|
|
10
|
-
|
|
10
|
+
tslib_1.__extends(UniqueKeysCacheInRedis, _super);
|
|
11
11
|
function UniqueKeysCacheInRedis(log, key, redis, uniqueKeysQueueSize, refreshRate) {
|
|
12
12
|
if (uniqueKeysQueueSize === void 0) { uniqueKeysQueueSize = constants_1.DEFAULT_CACHE_SIZE; }
|
|
13
13
|
if (refreshRate === void 0) { refreshRate = constants_1.REFRESH_RATE; }
|
|
@@ -34,14 +34,14 @@ var UniqueKeysCacheInRedis = /** @class */ (function (_super) {
|
|
|
34
34
|
return JSON.stringify(uniqueKeysPayload);
|
|
35
35
|
});
|
|
36
36
|
this.clear();
|
|
37
|
-
return (_a = this.redis).rpush.apply(_a,
|
|
37
|
+
return (_a = this.redis).rpush.apply(_a, tslib_1.__spreadArray([this.key], uniqueKeysArray, false)).then(function (data) {
|
|
38
38
|
// If this is the creation of the key on Redis, set the expiration for it in 3600 seconds.
|
|
39
39
|
if (data === featureNames.length) {
|
|
40
40
|
return _this.redis.expire(_this.key, constants_1.TTL_REFRESH);
|
|
41
41
|
}
|
|
42
42
|
})
|
|
43
43
|
.catch(function (err) {
|
|
44
|
-
_this.log.error(constants_2.LOG_PREFIX
|
|
44
|
+
_this.log.error("".concat(constants_2.LOG_PREFIX, "Error in uniqueKeys pipeline: ").concat(err, "."));
|
|
45
45
|
return false;
|
|
46
46
|
});
|
|
47
47
|
};
|
|
@@ -21,7 +21,7 @@ var EventsCachePluggable = /** @class */ (function () {
|
|
|
21
21
|
// We use boolean values to signal successful queueing
|
|
22
22
|
.then(function () { return true; })
|
|
23
23
|
.catch(function (e) {
|
|
24
|
-
_this.log.error(constants_1.LOG_PREFIX
|
|
24
|
+
_this.log.error("".concat(constants_1.LOG_PREFIX, "Error adding event to queue: ").concat(e, "."));
|
|
25
25
|
return false;
|
|
26
26
|
});
|
|
27
27
|
};
|
|
@@ -6,7 +6,7 @@ var ImpressionCountsCacheInMemory_1 = require("../inMemory/ImpressionCountsCache
|
|
|
6
6
|
var constants_1 = require("../inRedis/constants");
|
|
7
7
|
var constants_2 = require("./constants");
|
|
8
8
|
var ImpressionCountsCachePluggable = /** @class */ (function (_super) {
|
|
9
|
-
|
|
9
|
+
tslib_1.__extends(ImpressionCountsCachePluggable, _super);
|
|
10
10
|
function ImpressionCountsCachePluggable(log, key, wrapper, impressionCountsCacheSize, refreshRate) {
|
|
11
11
|
if (refreshRate === void 0) { refreshRate = constants_1.REFRESH_RATE; }
|
|
12
12
|
var _this = _super.call(this, impressionCountsCacheSize) || this;
|
|
@@ -24,10 +24,10 @@ var ImpressionCountsCachePluggable = /** @class */ (function (_super) {
|
|
|
24
24
|
if (!keys.length)
|
|
25
25
|
return Promise.resolve(false);
|
|
26
26
|
var pipeline = keys.reduce(function (pipeline, key) {
|
|
27
|
-
return pipeline.then(function () { return _this.wrapper.incr(_this.key
|
|
27
|
+
return pipeline.then(function () { return _this.wrapper.incr("".concat(_this.key, "::").concat(key), counts[key]); });
|
|
28
28
|
}, Promise.resolve());
|
|
29
29
|
return pipeline.catch(function (err) {
|
|
30
|
-
_this.log.error(constants_2.LOG_PREFIX
|
|
30
|
+
_this.log.error("".concat(constants_2.LOG_PREFIX, "Error in impression counts pipeline: ").concat(err, "."));
|
|
31
31
|
return false;
|
|
32
32
|
});
|
|
33
33
|
};
|
|
@@ -52,18 +52,18 @@ var ImpressionCountsCachePluggable = /** @class */ (function (_super) {
|
|
|
52
52
|
var count = counts[i];
|
|
53
53
|
var keyFeatureNameAndTime = key.split('::');
|
|
54
54
|
if (keyFeatureNameAndTime.length !== 3) {
|
|
55
|
-
_this.log.error(constants_2.LOG_PREFIX
|
|
55
|
+
_this.log.error("".concat(constants_2.LOG_PREFIX, "Error spliting key ").concat(key));
|
|
56
56
|
continue;
|
|
57
57
|
}
|
|
58
58
|
var timeFrame = parseInt(keyFeatureNameAndTime[2]);
|
|
59
59
|
if (isNaN(timeFrame)) {
|
|
60
|
-
_this.log.error(constants_2.LOG_PREFIX
|
|
60
|
+
_this.log.error("".concat(constants_2.LOG_PREFIX, "Error parsing time frame ").concat(keyFeatureNameAndTime[2]));
|
|
61
61
|
continue;
|
|
62
62
|
}
|
|
63
63
|
// @ts-ignore
|
|
64
64
|
var rawCount = parseInt(count);
|
|
65
65
|
if (isNaN(rawCount)) {
|
|
66
|
-
_this.log.error(constants_2.LOG_PREFIX
|
|
66
|
+
_this.log.error("".concat(constants_2.LOG_PREFIX, "Error parsing raw count ").concat(count));
|
|
67
67
|
continue;
|
|
68
68
|
}
|
|
69
69
|
pf.push({
|
|
@@ -10,7 +10,7 @@ var sets_1 = require("../../utils/lang/sets");
|
|
|
10
10
|
* ISplitsCacheAsync implementation for pluggable storages.
|
|
11
11
|
*/
|
|
12
12
|
var SplitsCachePluggable = /** @class */ (function (_super) {
|
|
13
|
-
|
|
13
|
+
tslib_1.__extends(SplitsCachePluggable, _super);
|
|
14
14
|
/**
|
|
15
15
|
* Create a SplitsCache that uses a storage wrapper.
|
|
16
16
|
* @param log - Logger instance.
|
|
@@ -47,7 +47,7 @@ var SplitsCachePluggable = /** @class */ (function (_super) {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
var items = [featureFlagName];
|
|
50
|
-
return Promise.all(
|
|
50
|
+
return Promise.all(tslib_1.__spreadArray(tslib_1.__spreadArray([], removeFromFlagSets.map(function (flagSetName) { return _this.wrapper.removeItems(_this.keys.buildFlagSetKey(flagSetName), items); }), true), addToFlagSets.map(function (flagSetName) { return _this.wrapper.addItems(_this.keys.buildFlagSetKey(flagSetName), items); }), true));
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
53
|
* Add a given split.
|
|
@@ -170,12 +170,12 @@ var SplitsCachePluggable = /** @class */ (function (_super) {
|
|
|
170
170
|
return false; // if entry doesn't exist, means that TT doesn't exist
|
|
171
171
|
ttCount = parseInt(ttCount, 10);
|
|
172
172
|
if (!(0, lang_1.isFiniteNumber)(ttCount) || ttCount < 0) {
|
|
173
|
-
_this.log.info(constants_1.LOG_PREFIX +
|
|
173
|
+
_this.log.info(constants_1.LOG_PREFIX + "Could not validate traffic type existence of ".concat(trafficType, " due to data corruption of some sorts."));
|
|
174
174
|
return false;
|
|
175
175
|
}
|
|
176
176
|
return ttCount > 0;
|
|
177
177
|
}).catch(function (e) {
|
|
178
|
-
_this.log.error(constants_1.LOG_PREFIX +
|
|
178
|
+
_this.log.error(constants_1.LOG_PREFIX + "Could not validate traffic type existence of ".concat(trafficType, " due to an error: ").concat(e, "."));
|
|
179
179
|
// If there is an error, bypass the validation so the event can get tracked.
|
|
180
180
|
return true;
|
|
181
181
|
});
|
|
@@ -45,18 +45,18 @@ var TelemetryCachePluggable = /** @class */ (function () {
|
|
|
45
45
|
var field = latencyKeys[i].split('::')[1];
|
|
46
46
|
var parsedField = (0, utils_1.parseLatencyField)(field);
|
|
47
47
|
if ((0, lang_1.isString)(parsedField)) {
|
|
48
|
-
_this.log.error("Ignoring invalid latency field: "
|
|
48
|
+
_this.log.error("Ignoring invalid latency field: ".concat(field, ": ").concat(parsedField));
|
|
49
49
|
continue;
|
|
50
50
|
}
|
|
51
51
|
// @ts-ignore
|
|
52
52
|
var count = parseInt(latencies[i]);
|
|
53
53
|
if ((0, lang_1.isNaNNumber)(count)) {
|
|
54
|
-
_this.log.error("Ignoring latency with invalid count: "
|
|
54
|
+
_this.log.error("Ignoring latency with invalid count: ".concat(latencies[i]));
|
|
55
55
|
continue;
|
|
56
56
|
}
|
|
57
57
|
var metadata = parsedField[0], method = parsedField[1], bucket = parsedField[2];
|
|
58
58
|
if (bucket >= TelemetryCacheInMemory_1.MAX_LATENCY_BUCKET_COUNT) {
|
|
59
|
-
_this.log.error("Ignoring latency with invalid bucket: "
|
|
59
|
+
_this.log.error("Ignoring latency with invalid bucket: ".concat(bucket));
|
|
60
60
|
continue;
|
|
61
61
|
}
|
|
62
62
|
var methodLatencies = result.get(metadata) || {};
|
|
@@ -84,13 +84,13 @@ var TelemetryCachePluggable = /** @class */ (function () {
|
|
|
84
84
|
var field = exceptionKeys[i].split('::')[1];
|
|
85
85
|
var parsedField = (0, utils_1.parseExceptionField)(field);
|
|
86
86
|
if ((0, lang_1.isString)(parsedField)) {
|
|
87
|
-
_this.log.error("Ignoring invalid exception field: "
|
|
87
|
+
_this.log.error("Ignoring invalid exception field: ".concat(field, ": ").concat(parsedField));
|
|
88
88
|
continue;
|
|
89
89
|
}
|
|
90
90
|
// @ts-ignore
|
|
91
91
|
var count = parseInt(exceptions[i]);
|
|
92
92
|
if ((0, lang_1.isNaNNumber)(count)) {
|
|
93
|
-
_this.log.error("Ignoring exception with invalid count: "
|
|
93
|
+
_this.log.error("Ignoring exception with invalid count: ".concat(exceptions[i]));
|
|
94
94
|
continue;
|
|
95
95
|
}
|
|
96
96
|
var metadata = parsedField[0], method = parsedField[1];
|
|
@@ -118,7 +118,7 @@ var TelemetryCachePluggable = /** @class */ (function () {
|
|
|
118
118
|
var field = configKeys[i].split('::')[1];
|
|
119
119
|
var parsedField = (0, utils_1.parseMetadata)(field);
|
|
120
120
|
if ((0, lang_1.isString)(parsedField)) {
|
|
121
|
-
_this.log.error("Ignoring invalid config field: "
|
|
121
|
+
_this.log.error("Ignoring invalid config field: ".concat(field, ": ").concat(parsedField));
|
|
122
122
|
continue;
|
|
123
123
|
}
|
|
124
124
|
var metadata = parsedField[0];
|
|
@@ -127,7 +127,7 @@ var TelemetryCachePluggable = /** @class */ (function () {
|
|
|
127
127
|
result.set(metadata, config);
|
|
128
128
|
}
|
|
129
129
|
catch (e) {
|
|
130
|
-
_this.log.error("Ignoring invalid config: "
|
|
130
|
+
_this.log.error("Ignoring invalid config: ".concat(configs[i]));
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
return Promise.all(configKeys.map(function (configKey) { return _this.wrapper.del(configKey); })).then(function () { return result; });
|
|
@@ -7,7 +7,7 @@ var constants_1 = require("../inRedis/constants");
|
|
|
7
7
|
var constants_2 = require("./constants");
|
|
8
8
|
var sets_1 = require("../../utils/lang/sets");
|
|
9
9
|
var UniqueKeysCachePluggable = /** @class */ (function (_super) {
|
|
10
|
-
|
|
10
|
+
tslib_1.__extends(UniqueKeysCachePluggable, _super);
|
|
11
11
|
function UniqueKeysCachePluggable(log, key, wrapper, uniqueKeysQueueSize, refreshRate) {
|
|
12
12
|
if (uniqueKeysQueueSize === void 0) { uniqueKeysQueueSize = constants_1.DEFAULT_CACHE_SIZE; }
|
|
13
13
|
if (refreshRate === void 0) { refreshRate = constants_1.REFRESH_RATE; }
|
|
@@ -35,7 +35,7 @@ var UniqueKeysCachePluggable = /** @class */ (function (_super) {
|
|
|
35
35
|
this.clear();
|
|
36
36
|
return this.wrapper.pushItems(this.key, uniqueKeysArray)
|
|
37
37
|
.catch(function (err) {
|
|
38
|
-
_this.log.error(constants_2.LOG_PREFIX
|
|
38
|
+
_this.log.error("".concat(constants_2.LOG_PREFIX, "Error in uniqueKeys pipeline: ").concat(err, "."));
|
|
39
39
|
return false;
|
|
40
40
|
});
|
|
41
41
|
};
|
|
@@ -38,7 +38,7 @@ function validatePluggableStorageOptions(options) {
|
|
|
38
38
|
var wrapper = options.wrapper;
|
|
39
39
|
var missingMethods = wrapperAdapter_1.METHODS_TO_PROMISE_WRAP.filter(function (method) { return typeof wrapper[method] !== 'function'; });
|
|
40
40
|
if (missingMethods.length)
|
|
41
|
-
throw new Error(NO_VALID_WRAPPER_INTERFACE
|
|
41
|
+
throw new Error("".concat(NO_VALID_WRAPPER_INTERFACE, " The following methods are missing or invalid: ").concat(missingMethods));
|
|
42
42
|
}
|
|
43
43
|
// Async return type in `client.track` method on consumer partial mode
|
|
44
44
|
// No need to promisify impressions cache
|
|
@@ -82,7 +82,7 @@ function PluggableStorage(options) {
|
|
|
82
82
|
var currentHash = (0, KeyBuilder_1.getStorageHash)(settings);
|
|
83
83
|
if (hash !== currentHash) {
|
|
84
84
|
log.info(constants_2.LOG_PREFIX + 'Storage HASH has changed (SDK key, flags filter criteria or flags spec version was modified). Clearing cache');
|
|
85
|
-
return wrapper.getKeysByPrefix(keys.prefix
|
|
85
|
+
return wrapper.getKeysByPrefix("".concat(keys.prefix, ".")).then(function (storageKeys) {
|
|
86
86
|
return Promise.all(storageKeys.map(function (storageKey) { return wrapper.del(storageKey); }));
|
|
87
87
|
}).then(function () { return wrapper.set(keys.buildHashKey(), currentHash); });
|
|
88
88
|
}
|
|
@@ -124,7 +124,7 @@ function PluggableStorage(options) {
|
|
|
124
124
|
// emits SDK_READY event on shared clients and returns a reference to the storage
|
|
125
125
|
shared: function (_, onReadyCb) {
|
|
126
126
|
connectPromise.then(onReadyCb);
|
|
127
|
-
return
|
|
127
|
+
return tslib_1.__assign(tslib_1.__assign({}, this), {
|
|
128
128
|
// no-op destroy, to disconnect the wrapper only when the main client is destroyed
|
|
129
129
|
destroy: function () { } });
|
|
130
130
|
}
|
|
@@ -34,7 +34,7 @@ function wrapperAdapter(log, wrapper) {
|
|
|
34
34
|
exports.METHODS_TO_PROMISE_WRAP.forEach(function (method) {
|
|
35
35
|
// Logs error and wraps it into a rejected promise.
|
|
36
36
|
function handleError(e) {
|
|
37
|
-
log.error(constants_1.LOG_PREFIX
|
|
37
|
+
log.error("".concat(constants_1.LOG_PREFIX, " Wrapper '").concat(method, "' operation threw an error. Message: ").concat(e));
|
|
38
38
|
return Promise.reject(e);
|
|
39
39
|
}
|
|
40
40
|
wrapperAdapter[method] = function () {
|
|
@@ -26,14 +26,14 @@ exports.validateRolloutPlan = validateRolloutPlan;
|
|
|
26
26
|
function setRolloutPlan(log, rolloutPlan, storage, matchingKey) {
|
|
27
27
|
var splits = storage.splits, rbSegments = storage.rbSegments, segments = storage.segments, largeSegments = storage.largeSegments;
|
|
28
28
|
var _a = rolloutPlan.splitChanges, ff = _a.ff, rbs = _a.rbs;
|
|
29
|
-
log.debug("storage: set feature flags and segments"
|
|
29
|
+
log.debug("storage: set feature flags and segments".concat(matchingKey ? " for key ".concat(matchingKey) : ''));
|
|
30
30
|
if (splits && ff) {
|
|
31
31
|
splits.clear();
|
|
32
|
-
splits.update(ff.d, [], ff.t);
|
|
32
|
+
splits.update(ff.d || [], [], ff.t);
|
|
33
33
|
}
|
|
34
34
|
if (rbSegments && rbs) {
|
|
35
35
|
rbSegments.clear();
|
|
36
|
-
rbSegments.update(rbs.d, [], rbs.t);
|
|
36
|
+
rbSegments.update(rbs.d || [], [], rbs.t);
|
|
37
37
|
}
|
|
38
38
|
var segmentChanges = rolloutPlan.segmentChanges;
|
|
39
39
|
if (matchingKey) { // add memberships data (client-side)
|
package/cjs/storages/utils.js
CHANGED
|
@@ -42,7 +42,7 @@ var REVERSE_METHOD_NAMES = Object.keys(KeyBuilderSS_1.METHOD_NAMES).reduce(funct
|
|
|
42
42
|
function parseMetadata(field) {
|
|
43
43
|
var parts = field.split('/');
|
|
44
44
|
if (parts.length !== 3)
|
|
45
|
-
return "invalid subsection count. Expected 3, got: "
|
|
45
|
+
return "invalid subsection count. Expected 3, got: ".concat(parts.length);
|
|
46
46
|
var s = parts[0] /* metadata.s */, n = parts[1] /* metadata.n */, i = parts[2] /* metadata.i */;
|
|
47
47
|
return [JSON.stringify({ s: s, n: n, i: i })];
|
|
48
48
|
}
|
|
@@ -50,25 +50,25 @@ exports.parseMetadata = parseMetadata;
|
|
|
50
50
|
function parseExceptionField(field) {
|
|
51
51
|
var parts = field.split('/');
|
|
52
52
|
if (parts.length !== 4)
|
|
53
|
-
return "invalid subsection count. Expected 4, got: "
|
|
53
|
+
return "invalid subsection count. Expected 4, got: ".concat(parts.length);
|
|
54
54
|
var s = parts[0] /* metadata.s */, n = parts[1] /* metadata.n */, i = parts[2] /* metadata.i */, m = parts[3];
|
|
55
55
|
var method = REVERSE_METHOD_NAMES[m];
|
|
56
56
|
if (!method)
|
|
57
|
-
return "unknown method '"
|
|
57
|
+
return "unknown method '".concat(m, "'");
|
|
58
58
|
return [JSON.stringify({ s: s, n: n, i: i }), method];
|
|
59
59
|
}
|
|
60
60
|
exports.parseExceptionField = parseExceptionField;
|
|
61
61
|
function parseLatencyField(field) {
|
|
62
62
|
var parts = field.split('/');
|
|
63
63
|
if (parts.length !== 5)
|
|
64
|
-
return "invalid subsection count. Expected 5, got: "
|
|
64
|
+
return "invalid subsection count. Expected 5, got: ".concat(parts.length);
|
|
65
65
|
var s = parts[0] /* metadata.s */, n = parts[1] /* metadata.n */, i = parts[2] /* metadata.i */, m = parts[3], b = parts[4];
|
|
66
66
|
var method = REVERSE_METHOD_NAMES[m];
|
|
67
67
|
if (!method)
|
|
68
|
-
return "unknown method '"
|
|
68
|
+
return "unknown method '".concat(m, "'");
|
|
69
69
|
var bucket = parseInt(b);
|
|
70
70
|
if (isNaN(bucket) || bucket >= TelemetryCacheInMemory_1.MAX_LATENCY_BUCKET_COUNT)
|
|
71
|
-
return "invalid bucket. Expected a number between 0 and "
|
|
71
|
+
return "invalid bucket. Expected a number between 0 and ".concat(TelemetryCacheInMemory_1.MAX_LATENCY_BUCKET_COUNT - 1, ", got: ").concat(b);
|
|
72
72
|
return [JSON.stringify({ s: s, n: n, i: i }), method, bucket];
|
|
73
73
|
}
|
|
74
74
|
exports.parseLatencyField = parseLatencyField;
|
|
@@ -12,7 +12,7 @@ function greedyFetch(fetchSegmentChanges, since, segmentName, noCache, targetTil
|
|
|
12
12
|
}
|
|
13
13
|
else {
|
|
14
14
|
return Promise.all([json, greedyFetch(fetchSegmentChanges, till, segmentName, noCache, targetTill)]).then(function (flatMe) {
|
|
15
|
-
return
|
|
15
|
+
return tslib_1.__spreadArray([flatMe[0]], flatMe[1], true);
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -18,8 +18,8 @@ function pollingManagerSSFactory(params) {
|
|
|
18
18
|
// Start periodic fetching (polling)
|
|
19
19
|
start: function () {
|
|
20
20
|
log.info(constants_1.POLLING_START);
|
|
21
|
-
log.debug(constants_1.LOG_PREFIX_SYNC_POLLING +
|
|
22
|
-
log.debug(constants_1.LOG_PREFIX_SYNC_POLLING +
|
|
21
|
+
log.debug(constants_1.LOG_PREFIX_SYNC_POLLING + "Splits will be refreshed each ".concat(settings.scheduler.featuresRefreshRate, " millis"));
|
|
22
|
+
log.debug(constants_1.LOG_PREFIX_SYNC_POLLING + "Segments will be refreshed each ".concat(settings.scheduler.segmentsRefreshRate, " millis"));
|
|
23
23
|
var startingUp = splitsSyncTask.start();
|
|
24
24
|
if (startingUp) {
|
|
25
25
|
startingUp.then(function () {
|
|
@@ -23,7 +23,7 @@ function segmentChangesUpdaterFactory(log, segmentChangesFetcher, segments, read
|
|
|
23
23
|
return promise;
|
|
24
24
|
}
|
|
25
25
|
function updateSegment(segmentName, noCache, till, fetchOnlyNew, retries) {
|
|
26
|
-
log.debug(constants_2.LOG_PREFIX_SYNC_SEGMENTS
|
|
26
|
+
log.debug("".concat(constants_2.LOG_PREFIX_SYNC_SEGMENTS, "Processing segment ").concat(segmentName));
|
|
27
27
|
var sincePromise = Promise.resolve(segments.getChangeNumber(segmentName));
|
|
28
28
|
return sincePromise.then(function (since) {
|
|
29
29
|
// if fetchOnlyNew flag, avoid processing already fetched segments
|
|
@@ -31,14 +31,14 @@ function segmentChangesUpdaterFactory(log, segmentChangesFetcher, segments, read
|
|
|
31
31
|
false :
|
|
32
32
|
segmentChangesFetcher(since || -1, segmentName, noCache, till, _promiseDecorator).then(function (changes) {
|
|
33
33
|
return Promise.all(changes.map(function (x) {
|
|
34
|
-
log.debug(constants_2.LOG_PREFIX_SYNC_SEGMENTS
|
|
34
|
+
log.debug("".concat(constants_2.LOG_PREFIX_SYNC_SEGMENTS, "Processing ").concat(segmentName, " with till = ").concat(x.till, ". Added: ").concat(x.added.length, ". Removed: ").concat(x.removed.length));
|
|
35
35
|
return segments.update(segmentName, x.added, x.removed, x.till);
|
|
36
36
|
})).then(function (updates) {
|
|
37
37
|
return updates.some(function (update) { return update; });
|
|
38
38
|
});
|
|
39
39
|
}).catch(function (error) {
|
|
40
40
|
if (retries) {
|
|
41
|
-
log.warn(constants_2.LOG_PREFIX_SYNC_SEGMENTS
|
|
41
|
+
log.warn("".concat(constants_2.LOG_PREFIX_SYNC_SEGMENTS, "Retrying fetch of segment ").concat(segmentName, " (attempt #").concat(retries, "). Reason: ").concat(error));
|
|
42
42
|
return updateSegment(segmentName, noCache, till, fetchOnlyNew, retries - 1);
|
|
43
43
|
}
|
|
44
44
|
throw error;
|
|
@@ -57,7 +57,7 @@ function segmentChangesUpdaterFactory(log, segmentChangesFetcher, segments, read
|
|
|
57
57
|
* @param till - till target for the provided segmentName, for CDN bypass.
|
|
58
58
|
*/
|
|
59
59
|
return function segmentChangesUpdater(fetchOnlyNew, segmentName, noCache, till) {
|
|
60
|
-
log.debug(constants_2.LOG_PREFIX_SYNC_SEGMENTS
|
|
60
|
+
log.debug("".concat(constants_2.LOG_PREFIX_SYNC_SEGMENTS, "Started segments update"));
|
|
61
61
|
// If not a segment name provided, read list of available segments names to be updated.
|
|
62
62
|
var segmentsPromise = Promise.resolve(segmentName ? [segmentName] : segments.getRegisteredSegments());
|
|
63
63
|
return segmentsPromise.then(function (segmentNames) {
|
|
@@ -84,10 +84,10 @@ function segmentChangesUpdaterFactory(log, segmentChangesFetcher, segments, read
|
|
|
84
84
|
// @TODO although factory status is destroyed, synchronization is not stopped
|
|
85
85
|
if (readiness)
|
|
86
86
|
readiness.setDestroyed();
|
|
87
|
-
log.error(constants_2.LOG_PREFIX_INSTANTIATION
|
|
87
|
+
log.error("".concat(constants_2.LOG_PREFIX_INSTANTIATION, ": you passed a client-side type authorizationKey, please grab an SDK Key from Harness FME UI that is of type server-side."));
|
|
88
88
|
}
|
|
89
89
|
else {
|
|
90
|
-
log.warn(constants_2.LOG_PREFIX_SYNC_SEGMENTS
|
|
90
|
+
log.warn("".concat(constants_2.LOG_PREFIX_SYNC_SEGMENTS, "Error while doing fetch of segments. ").concat(error));
|
|
91
91
|
}
|
|
92
92
|
return false;
|
|
93
93
|
});
|
|
@@ -24,7 +24,7 @@ function checkAllSegmentsExist(segments) {
|
|
|
24
24
|
*/
|
|
25
25
|
function parseSegments(ruleEntity, matcherType) {
|
|
26
26
|
if (matcherType === void 0) { matcherType = constants_3.IN_SEGMENT; }
|
|
27
|
-
var _a = ruleEntity,
|
|
27
|
+
var _a = ruleEntity, conditions = _a.conditions, excluded = _a.excluded;
|
|
28
28
|
var segments = new Set();
|
|
29
29
|
if (excluded && excluded.segments) {
|
|
30
30
|
excluded.segments.forEach(function (_a) {
|
|
@@ -34,12 +34,14 @@ function parseSegments(ruleEntity, matcherType) {
|
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
if (conditions) {
|
|
38
|
+
for (var i = 0; i < conditions.length; i++) {
|
|
39
|
+
var matchers = conditions[i].matcherGroup.matchers;
|
|
40
|
+
matchers.forEach(function (matcher) {
|
|
41
|
+
if (matcher.matcherType === matcherType)
|
|
42
|
+
segments.add(matcher.userDefinedSegmentMatcherData.segmentName);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
43
45
|
}
|
|
44
46
|
return segments;
|
|
45
47
|
}
|
|
@@ -70,7 +72,7 @@ function matchFilters(featureFlag, filters) {
|
|
|
70
72
|
*/
|
|
71
73
|
function computeMutation(rules, segments, filters) {
|
|
72
74
|
return rules.reduce(function (accum, ruleEntity) {
|
|
73
|
-
if (ruleEntity.status
|
|
75
|
+
if (ruleEntity.status !== 'ARCHIVED' && (!filters || matchFilters(ruleEntity, filters))) {
|
|
74
76
|
accum.added.push(ruleEntity);
|
|
75
77
|
parseSegments(ruleEntity).forEach(function (segmentName) {
|
|
76
78
|
segments.add(segmentName);
|
|
@@ -140,14 +142,14 @@ function splitChangesUpdaterFactory(log, splitChangesFetcher, storage, splitFilt
|
|
|
140
142
|
var updatedFlags = [];
|
|
141
143
|
var ffUpdate = false;
|
|
142
144
|
if (splitChanges.ff) {
|
|
143
|
-
var _a = computeMutation(splitChanges.ff.d, usedSegments, splitFiltersValidation), added = _a.added, removed = _a.removed, names = _a.names;
|
|
145
|
+
var _a = computeMutation(splitChanges.ff.d || [], usedSegments, splitFiltersValidation), added = _a.added, removed = _a.removed, names = _a.names;
|
|
144
146
|
updatedFlags = names;
|
|
145
147
|
log.debug(constants_2.SYNC_SPLITS_UPDATE, [added.length, removed.length]);
|
|
146
148
|
ffUpdate = splits.update(added, removed, splitChanges.ff.t);
|
|
147
149
|
}
|
|
148
150
|
var rbsUpdate = false;
|
|
149
151
|
if (splitChanges.rbs) {
|
|
150
|
-
var _b = computeMutation(splitChanges.rbs.d, usedSegments), added = _b.added, removed = _b.removed;
|
|
152
|
+
var _b = computeMutation(splitChanges.rbs.d || [], usedSegments), added = _b.added, removed = _b.removed;
|
|
151
153
|
log.debug(constants_2.SYNC_RBS_UPDATE, [added.length, removed.length]);
|
|
152
154
|
rbsUpdate = rbSegments.update(added, removed, splitChanges.rbs.t);
|
|
153
155
|
}
|
|
@@ -60,11 +60,11 @@ var SSEClient = /** @class */ (function () {
|
|
|
60
60
|
var params = CONTROL_CHANNEL_REGEX.test(channel) ? '[?occupancy=metrics.publishers]' : '';
|
|
61
61
|
return encodeURIComponent(params + channel);
|
|
62
62
|
}).join(',');
|
|
63
|
-
var url = this.settings.urls.streaming
|
|
63
|
+
var url = "".concat(this.settings.urls.streaming, "/sse?channels=").concat(channelsQueryParam, "&accessToken=").concat(authToken.token, "&v=").concat(ABLY_API_VERSION, "&heartbeats=true"); // same results using `&heartbeats=false`
|
|
64
64
|
var isServerSide = (0, key_1.checkIfServerSide)(this.settings);
|
|
65
65
|
this.connection = new this.eventSource(
|
|
66
66
|
// For client-side SDKs, metadata is passed as query param to avoid CORS issues and because native EventSource implementations in browsers do not support headers
|
|
67
|
-
isServerSide ? url : url +
|
|
67
|
+
isServerSide ? url : url + "&SplitSDKVersion=".concat(this.headers.SplitSDKVersion, "&SplitSDKClientKey=").concat(this.headers.SplitSDKClientKey),
|
|
68
68
|
// For server-side SDKs, metadata is passed via headers
|
|
69
69
|
(0, objectAssign_1.objectAssign)(isServerSide ?
|
|
70
70
|
{ headers: (0, decorateHeaders_1.decorateHeaders)(this.settings, this.headers) } :
|
|
@@ -51,7 +51,7 @@ function MySegmentsUpdateWorker(log, storage, mySegmentsSyncTask, telemetryTrack
|
|
|
51
51
|
telemetryTracker.trackUpdatesFromSSE(constants_1.MEMBERSHIPS);
|
|
52
52
|
var attempts = backoff.attempts + 1;
|
|
53
53
|
if (maxChangeNumber <= currentChangeNumber) {
|
|
54
|
-
log.debug("Refresh completed"
|
|
54
|
+
log.debug("Refresh completed".concat(cdnBypass ? ' bypassing the CDN' : '', " in ").concat(attempts, " attempts."));
|
|
55
55
|
isHandlingEvent = false;
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
@@ -60,7 +60,7 @@ function MySegmentsUpdateWorker(log, storage, mySegmentsSyncTask, telemetryTrack
|
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
if (cdnBypass) {
|
|
63
|
-
log.debug("No changes fetched after "
|
|
63
|
+
log.debug("No changes fetched after ".concat(attempts, " attempts with CDN bypassed."));
|
|
64
64
|
isHandlingEvent = false;
|
|
65
65
|
}
|
|
66
66
|
else {
|
|
@@ -28,7 +28,7 @@ function SegmentsUpdateWorker(log, segmentsSyncTask, segmentsCache) {
|
|
|
28
28
|
else {
|
|
29
29
|
var attempts = backoff.attempts + 1;
|
|
30
30
|
if (maxChangeNumber <= (segmentsCache.getChangeNumber(segment) || -1)) {
|
|
31
|
-
log.debug("Refresh completed"
|
|
31
|
+
log.debug("Refresh completed".concat(cdnBypass ? ' bypassing the CDN' : '', " in ").concat(attempts, " attempts."));
|
|
32
32
|
isHandlingEvent = false;
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
@@ -37,7 +37,7 @@ function SegmentsUpdateWorker(log, segmentsSyncTask, segmentsCache) {
|
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
if (cdnBypass) {
|
|
40
|
-
log.debug("No changes fetched after "
|
|
40
|
+
log.debug("No changes fetched after ".concat(attempts, " attempts with CDN bypassed."));
|
|
41
41
|
isHandlingEvent = false;
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
@@ -40,7 +40,7 @@ function SplitsUpdateWorker(log, storage, splitsSyncTask, splitsEventEmitter, te
|
|
|
40
40
|
segmentsSyncTask.execute(true);
|
|
41
41
|
var attempts = backoff.attempts + 1;
|
|
42
42
|
if (ff.isSync() && rbs.isSync()) {
|
|
43
|
-
log.debug("Refresh completed"
|
|
43
|
+
log.debug("Refresh completed".concat(cdnBypass ? ' bypassing the CDN' : '', " in ").concat(attempts, " attempts."));
|
|
44
44
|
isHandlingEvent = false;
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
@@ -49,7 +49,7 @@ function SplitsUpdateWorker(log, storage, splitsSyncTask, splitsEventEmitter, te
|
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
if (cdnBypass) {
|
|
52
|
-
log.debug("No changes fetched after "
|
|
52
|
+
log.debug("No changes fetched after ".concat(attempts, " attempts with CDN bypassed."));
|
|
53
53
|
isHandlingEvent = false;
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
@@ -30,7 +30,7 @@ function decompress(data, compression) {
|
|
|
30
30
|
return decompress_1.algorithms.gunzipSync(binData);
|
|
31
31
|
if (compression === ZLIB)
|
|
32
32
|
return decompress_1.algorithms.unzlibSync(binData);
|
|
33
|
-
throw new Error("Invalid compression algorithm #"
|
|
33
|
+
throw new Error("Invalid compression algorithm #".concat(compression));
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* Decode, decompress and parse the provided 'data' into a KeyList object
|