@splitsoftware/splitio-commons 2.12.0 → 2.12.2
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 +8 -1
- 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 +6 -6
- 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
|
@@ -12,7 +12,7 @@ var ImpressionCountsCacheInMemory = /** @class */ (function () {
|
|
|
12
12
|
* Builds key to be stored in the cache with the featureName and the timeFrame truncated.
|
|
13
13
|
*/
|
|
14
14
|
ImpressionCountsCacheInMemory.prototype._makeKey = function (featureName, timeFrame) {
|
|
15
|
-
return featureName
|
|
15
|
+
return "".concat(featureName, "::").concat(truncateTimeFrame(timeFrame));
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* Increments the quantity of impressions with the passed featureName and timeFrame.
|
|
@@ -16,7 +16,7 @@ var EventsCacheInRedis = /** @class */ (function () {
|
|
|
16
16
|
// We use boolean values to signal successful queueing
|
|
17
17
|
.then(function () { return true; })
|
|
18
18
|
.catch(function (err) {
|
|
19
|
-
_this.log.error(LOG_PREFIX
|
|
19
|
+
_this.log.error("".concat(LOG_PREFIX, "Error adding event to queue: ").concat(err, "."));
|
|
20
20
|
return false;
|
|
21
21
|
});
|
|
22
22
|
};
|
|
@@ -32,7 +32,7 @@ var ImpressionCountsCacheInRedis = /** @class */ (function (_super) {
|
|
|
32
32
|
}
|
|
33
33
|
})
|
|
34
34
|
.catch(function (err) {
|
|
35
|
-
_this.log.error(LOG_PREFIX
|
|
35
|
+
_this.log.error("".concat(LOG_PREFIX, "Error in impression counts pipeline: ").concat(err, "."));
|
|
36
36
|
return false;
|
|
37
37
|
});
|
|
38
38
|
};
|
|
@@ -55,17 +55,17 @@ var ImpressionCountsCacheInRedis = /** @class */ (function (_super) {
|
|
|
55
55
|
forOwn(counts, function (count, key) {
|
|
56
56
|
var nameAndTime = key.split('::');
|
|
57
57
|
if (nameAndTime.length !== 2) {
|
|
58
|
-
_this.log.error(LOG_PREFIX
|
|
58
|
+
_this.log.error("".concat(LOG_PREFIX, "Error spliting key ").concat(key));
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
var timeFrame = parseInt(nameAndTime[1]);
|
|
62
62
|
if (isNaN(timeFrame)) {
|
|
63
|
-
_this.log.error(LOG_PREFIX
|
|
63
|
+
_this.log.error("".concat(LOG_PREFIX, "Error parsing time frame ").concat(nameAndTime[1]));
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
var rawCount = parseInt(count);
|
|
67
67
|
if (isNaN(rawCount)) {
|
|
68
|
-
_this.log.error(LOG_PREFIX
|
|
68
|
+
_this.log.error("".concat(LOG_PREFIX, "Error parsing raw count ").concat(count));
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
pf.push({
|
|
@@ -58,9 +58,9 @@ var RedisAdapter = /** @class */ (function () {
|
|
|
58
58
|
var _this = this;
|
|
59
59
|
this.client.once('ready', function () {
|
|
60
60
|
var commandsCount = _this._notReadyCommandsQueue ? _this._notReadyCommandsQueue.length : 0;
|
|
61
|
-
_this.log.info(LOG_PREFIX +
|
|
61
|
+
_this.log.info(LOG_PREFIX + "Redis connection established. Queued commands: ".concat(commandsCount, "."));
|
|
62
62
|
_this._notReadyCommandsQueue && _this._notReadyCommandsQueue.forEach(function (queued) {
|
|
63
|
-
_this.log.info(LOG_PREFIX +
|
|
63
|
+
_this.log.info(LOG_PREFIX + "Executing queued ".concat(queued.name, " command."));
|
|
64
64
|
queued.command().then(queued.resolve).catch(queued.reject);
|
|
65
65
|
});
|
|
66
66
|
// After the SDK is ready for the first time we'll stop queueing commands. This is just so we can keep handling BUR for them.
|
|
@@ -82,7 +82,7 @@ var RedisAdapter = /** @class */ (function () {
|
|
|
82
82
|
params[_i] = arguments[_i];
|
|
83
83
|
}
|
|
84
84
|
function commandWrapper() {
|
|
85
|
-
instance.log.debug(LOG_PREFIX
|
|
85
|
+
instance.log.debug("".concat(LOG_PREFIX, "Executing ").concat(methodName, "."));
|
|
86
86
|
var result = originalMethod.apply(bindTarget, params);
|
|
87
87
|
if (thenable(result)) {
|
|
88
88
|
// For handling pending commands on disconnect, add to the set and remove once finished.
|
|
@@ -94,7 +94,7 @@ var RedisAdapter = /** @class */ (function () {
|
|
|
94
94
|
// Both success and error remove from queue.
|
|
95
95
|
result.then(cleanUpRunningCommandsCb, cleanUpRunningCommandsCb);
|
|
96
96
|
return timeout(instance._options.operationTimeout, result).catch(function (err) {
|
|
97
|
-
instance.log.error(""
|
|
97
|
+
instance.log.error("".concat(LOG_PREFIX).concat(methodName, " operation threw an error or exceeded configured timeout of ").concat(instance._options.operationTimeout, "ms. Message: ").concat(err));
|
|
98
98
|
// Handling is not the adapter responsibility.
|
|
99
99
|
throw err;
|
|
100
100
|
});
|
|
@@ -132,7 +132,7 @@ var RedisAdapter = /** @class */ (function () {
|
|
|
132
132
|
}
|
|
133
133
|
var res = originalFn.apply(instance.client, args);
|
|
134
134
|
var originalExec = res.exec;
|
|
135
|
-
res.exec = wrapCommand(originalExec, methodName
|
|
135
|
+
res.exec = wrapCommand(originalExec, "".concat(methodName, ".exec"), res);
|
|
136
136
|
return res;
|
|
137
137
|
};
|
|
138
138
|
});
|
|
@@ -147,14 +147,14 @@ var RedisAdapter = /** @class */ (function () {
|
|
|
147
147
|
}
|
|
148
148
|
setTimeout(function deferredDisconnect() {
|
|
149
149
|
if (instance._runningCommands.size > 0) {
|
|
150
|
-
instance.log.info(LOG_PREFIX +
|
|
150
|
+
instance.log.info(LOG_PREFIX + "Attempting to disconnect but there are ".concat(instance._runningCommands.size, " commands still waiting for resolution. Defering disconnection until those finish."));
|
|
151
151
|
Promise.all(setToArray(instance._runningCommands))
|
|
152
152
|
.then(function () {
|
|
153
153
|
instance.log.debug(LOG_PREFIX + 'Pending commands finished successfully, disconnecting.');
|
|
154
154
|
originalMethod.apply(instance.client, params);
|
|
155
155
|
})
|
|
156
156
|
.catch(function (e) {
|
|
157
|
-
instance.log.warn(LOG_PREFIX +
|
|
157
|
+
instance.log.warn(LOG_PREFIX + "Pending commands finished with error: ".concat(e, ". Proceeding with disconnection."));
|
|
158
158
|
originalMethod.apply(instance.client, params);
|
|
159
159
|
});
|
|
160
160
|
}
|
|
@@ -176,7 +176,7 @@ var SplitsCacheInRedis = /** @class */ (function (_super) {
|
|
|
176
176
|
var e = _a[0], value = _a[1];
|
|
177
177
|
if (e === null)
|
|
178
178
|
return value;
|
|
179
|
-
_this.log.error(LOG_PREFIX +
|
|
179
|
+
_this.log.error(LOG_PREFIX + "Could not read result from get members of flag set ".concat(flagSets[index], " due to an error: ").concat(e));
|
|
180
180
|
}) : []; })
|
|
181
181
|
.then(function (namesByFlagSets) { return namesByFlagSets.map(function (namesByFlagSet) { return new Set(namesByFlagSet); }); });
|
|
182
182
|
};
|
|
@@ -195,13 +195,13 @@ var SplitsCacheInRedis = /** @class */ (function (_super) {
|
|
|
195
195
|
return false; // if entry doesn't exist, means that TT doesn't exist
|
|
196
196
|
ttCount = parseInt(ttCount, 10);
|
|
197
197
|
if (!isFiniteNumber(ttCount) || ttCount < 0) {
|
|
198
|
-
_this.log.info(LOG_PREFIX +
|
|
198
|
+
_this.log.info(LOG_PREFIX + "Could not validate traffic type existence of ".concat(trafficType, " due to data corruption of some sorts."));
|
|
199
199
|
return false;
|
|
200
200
|
}
|
|
201
201
|
return ttCount > 0;
|
|
202
202
|
})
|
|
203
203
|
.catch(function (e) {
|
|
204
|
-
_this.log.error(LOG_PREFIX +
|
|
204
|
+
_this.log.error(LOG_PREFIX + "Could not validate traffic type existence of ".concat(trafficType, " due to an error: ").concat(e, "."));
|
|
205
205
|
// If there is an error, bypass the validation so the event can get tracked.
|
|
206
206
|
return true;
|
|
207
207
|
});
|
|
@@ -231,7 +231,7 @@ var SplitsCacheInRedis = /** @class */ (function (_super) {
|
|
|
231
231
|
return Promise.resolve(splits);
|
|
232
232
|
})
|
|
233
233
|
.catch(function (e) {
|
|
234
|
-
_this.log.error(LOG_PREFIX +
|
|
234
|
+
_this.log.error(LOG_PREFIX + "Could not grab feature flags due to an error: ".concat(e, "."));
|
|
235
235
|
return Promise.reject(e);
|
|
236
236
|
});
|
|
237
237
|
};
|
|
@@ -42,17 +42,17 @@ var TelemetryCacheInRedis = /** @class */ (function () {
|
|
|
42
42
|
Object.keys(latencies).forEach(function (field) {
|
|
43
43
|
var parsedField = parseLatencyField(field);
|
|
44
44
|
if (isString(parsedField)) {
|
|
45
|
-
_this.log.error("Ignoring invalid latency field: "
|
|
45
|
+
_this.log.error("Ignoring invalid latency field: ".concat(field, ": ").concat(parsedField));
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
var count = parseInt(latencies[field]);
|
|
49
49
|
if (isNaNNumber(count)) {
|
|
50
|
-
_this.log.error("Ignoring latency with invalid count: "
|
|
50
|
+
_this.log.error("Ignoring latency with invalid count: ".concat(latencies[field]));
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
53
|
var metadata = parsedField[0], method = parsedField[1], bucket = parsedField[2];
|
|
54
54
|
if (bucket >= MAX_LATENCY_BUCKET_COUNT) {
|
|
55
|
-
_this.log.error("Ignoring latency with invalid bucket: "
|
|
55
|
+
_this.log.error("Ignoring latency with invalid bucket: ".concat(bucket));
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
var methodLatencies = result.get(metadata) || {};
|
|
@@ -74,12 +74,12 @@ var TelemetryCacheInRedis = /** @class */ (function () {
|
|
|
74
74
|
Object.keys(exceptions).forEach(function (field) {
|
|
75
75
|
var parsedField = parseExceptionField(field);
|
|
76
76
|
if (isString(parsedField)) {
|
|
77
|
-
_this.log.error("Ignoring invalid exception field: "
|
|
77
|
+
_this.log.error("Ignoring invalid exception field: ".concat(field, ": ").concat(parsedField));
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
80
|
var count = parseInt(exceptions[field]);
|
|
81
81
|
if (isNaNNumber(count)) {
|
|
82
|
-
_this.log.error("Ignoring exception with invalid count: "
|
|
82
|
+
_this.log.error("Ignoring exception with invalid count: ".concat(exceptions[field]));
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
85
|
var metadata = parsedField[0], method = parsedField[1];
|
|
@@ -101,7 +101,7 @@ var TelemetryCacheInRedis = /** @class */ (function () {
|
|
|
101
101
|
Object.keys(configs).forEach(function (field) {
|
|
102
102
|
var parsedField = parseMetadata(field);
|
|
103
103
|
if (isString(parsedField)) {
|
|
104
|
-
_this.log.error("Ignoring invalid config field: "
|
|
104
|
+
_this.log.error("Ignoring invalid config field: ".concat(field, ": ").concat(parsedField));
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
var metadata = parsedField[0];
|
|
@@ -110,7 +110,7 @@ var TelemetryCacheInRedis = /** @class */ (function () {
|
|
|
110
110
|
result.set(metadata, config);
|
|
111
111
|
}
|
|
112
112
|
catch (e) {
|
|
113
|
-
_this.log.error("Ignoring invalid config: "
|
|
113
|
+
_this.log.error("Ignoring invalid config: ".concat(configs[field]));
|
|
114
114
|
}
|
|
115
115
|
});
|
|
116
116
|
return _this.redis.del(_this.keys.initPrefix).then(function () { return result; });
|
|
@@ -38,7 +38,7 @@ var UniqueKeysCacheInRedis = /** @class */ (function (_super) {
|
|
|
38
38
|
}
|
|
39
39
|
})
|
|
40
40
|
.catch(function (err) {
|
|
41
|
-
_this.log.error(LOG_PREFIX
|
|
41
|
+
_this.log.error("".concat(LOG_PREFIX, "Error in uniqueKeys pipeline: ").concat(err, "."));
|
|
42
42
|
return false;
|
|
43
43
|
});
|
|
44
44
|
};
|
|
@@ -18,7 +18,7 @@ var EventsCachePluggable = /** @class */ (function () {
|
|
|
18
18
|
// We use boolean values to signal successful queueing
|
|
19
19
|
.then(function () { return true; })
|
|
20
20
|
.catch(function (e) {
|
|
21
|
-
_this.log.error(LOG_PREFIX
|
|
21
|
+
_this.log.error("".concat(LOG_PREFIX, "Error adding event to queue: ").concat(e, "."));
|
|
22
22
|
return false;
|
|
23
23
|
});
|
|
24
24
|
};
|
|
@@ -21,10 +21,10 @@ var ImpressionCountsCachePluggable = /** @class */ (function (_super) {
|
|
|
21
21
|
if (!keys.length)
|
|
22
22
|
return Promise.resolve(false);
|
|
23
23
|
var pipeline = keys.reduce(function (pipeline, key) {
|
|
24
|
-
return pipeline.then(function () { return _this.wrapper.incr(_this.key
|
|
24
|
+
return pipeline.then(function () { return _this.wrapper.incr("".concat(_this.key, "::").concat(key), counts[key]); });
|
|
25
25
|
}, Promise.resolve());
|
|
26
26
|
return pipeline.catch(function (err) {
|
|
27
|
-
_this.log.error(LOG_PREFIX
|
|
27
|
+
_this.log.error("".concat(LOG_PREFIX, "Error in impression counts pipeline: ").concat(err, "."));
|
|
28
28
|
return false;
|
|
29
29
|
});
|
|
30
30
|
};
|
|
@@ -49,18 +49,18 @@ var ImpressionCountsCachePluggable = /** @class */ (function (_super) {
|
|
|
49
49
|
var count = counts[i];
|
|
50
50
|
var keyFeatureNameAndTime = key.split('::');
|
|
51
51
|
if (keyFeatureNameAndTime.length !== 3) {
|
|
52
|
-
_this.log.error(LOG_PREFIX
|
|
52
|
+
_this.log.error("".concat(LOG_PREFIX, "Error spliting key ").concat(key));
|
|
53
53
|
continue;
|
|
54
54
|
}
|
|
55
55
|
var timeFrame = parseInt(keyFeatureNameAndTime[2]);
|
|
56
56
|
if (isNaN(timeFrame)) {
|
|
57
|
-
_this.log.error(LOG_PREFIX
|
|
57
|
+
_this.log.error("".concat(LOG_PREFIX, "Error parsing time frame ").concat(keyFeatureNameAndTime[2]));
|
|
58
58
|
continue;
|
|
59
59
|
}
|
|
60
60
|
// @ts-ignore
|
|
61
61
|
var rawCount = parseInt(count);
|
|
62
62
|
if (isNaN(rawCount)) {
|
|
63
|
-
_this.log.error(LOG_PREFIX
|
|
63
|
+
_this.log.error("".concat(LOG_PREFIX, "Error parsing raw count ").concat(count));
|
|
64
64
|
continue;
|
|
65
65
|
}
|
|
66
66
|
pf.push({
|
|
@@ -167,12 +167,12 @@ var SplitsCachePluggable = /** @class */ (function (_super) {
|
|
|
167
167
|
return false; // if entry doesn't exist, means that TT doesn't exist
|
|
168
168
|
ttCount = parseInt(ttCount, 10);
|
|
169
169
|
if (!isFiniteNumber(ttCount) || ttCount < 0) {
|
|
170
|
-
_this.log.info(LOG_PREFIX +
|
|
170
|
+
_this.log.info(LOG_PREFIX + "Could not validate traffic type existence of ".concat(trafficType, " due to data corruption of some sorts."));
|
|
171
171
|
return false;
|
|
172
172
|
}
|
|
173
173
|
return ttCount > 0;
|
|
174
174
|
}).catch(function (e) {
|
|
175
|
-
_this.log.error(LOG_PREFIX +
|
|
175
|
+
_this.log.error(LOG_PREFIX + "Could not validate traffic type existence of ".concat(trafficType, " due to an error: ").concat(e, "."));
|
|
176
176
|
// If there is an error, bypass the validation so the event can get tracked.
|
|
177
177
|
return true;
|
|
178
178
|
});
|
|
@@ -42,18 +42,18 @@ var TelemetryCachePluggable = /** @class */ (function () {
|
|
|
42
42
|
var field = latencyKeys[i].split('::')[1];
|
|
43
43
|
var parsedField = parseLatencyField(field);
|
|
44
44
|
if (isString(parsedField)) {
|
|
45
|
-
_this.log.error("Ignoring invalid latency field: "
|
|
45
|
+
_this.log.error("Ignoring invalid latency field: ".concat(field, ": ").concat(parsedField));
|
|
46
46
|
continue;
|
|
47
47
|
}
|
|
48
48
|
// @ts-ignore
|
|
49
49
|
var count = parseInt(latencies[i]);
|
|
50
50
|
if (isNaNNumber(count)) {
|
|
51
|
-
_this.log.error("Ignoring latency with invalid count: "
|
|
51
|
+
_this.log.error("Ignoring latency with invalid count: ".concat(latencies[i]));
|
|
52
52
|
continue;
|
|
53
53
|
}
|
|
54
54
|
var metadata = parsedField[0], method = parsedField[1], bucket = parsedField[2];
|
|
55
55
|
if (bucket >= MAX_LATENCY_BUCKET_COUNT) {
|
|
56
|
-
_this.log.error("Ignoring latency with invalid bucket: "
|
|
56
|
+
_this.log.error("Ignoring latency with invalid bucket: ".concat(bucket));
|
|
57
57
|
continue;
|
|
58
58
|
}
|
|
59
59
|
var methodLatencies = result.get(metadata) || {};
|
|
@@ -81,13 +81,13 @@ var TelemetryCachePluggable = /** @class */ (function () {
|
|
|
81
81
|
var field = exceptionKeys[i].split('::')[1];
|
|
82
82
|
var parsedField = parseExceptionField(field);
|
|
83
83
|
if (isString(parsedField)) {
|
|
84
|
-
_this.log.error("Ignoring invalid exception field: "
|
|
84
|
+
_this.log.error("Ignoring invalid exception field: ".concat(field, ": ").concat(parsedField));
|
|
85
85
|
continue;
|
|
86
86
|
}
|
|
87
87
|
// @ts-ignore
|
|
88
88
|
var count = parseInt(exceptions[i]);
|
|
89
89
|
if (isNaNNumber(count)) {
|
|
90
|
-
_this.log.error("Ignoring exception with invalid count: "
|
|
90
|
+
_this.log.error("Ignoring exception with invalid count: ".concat(exceptions[i]));
|
|
91
91
|
continue;
|
|
92
92
|
}
|
|
93
93
|
var metadata = parsedField[0], method = parsedField[1];
|
|
@@ -115,7 +115,7 @@ var TelemetryCachePluggable = /** @class */ (function () {
|
|
|
115
115
|
var field = configKeys[i].split('::')[1];
|
|
116
116
|
var parsedField = parseMetadata(field);
|
|
117
117
|
if (isString(parsedField)) {
|
|
118
|
-
_this.log.error("Ignoring invalid config field: "
|
|
118
|
+
_this.log.error("Ignoring invalid config field: ".concat(field, ": ").concat(parsedField));
|
|
119
119
|
continue;
|
|
120
120
|
}
|
|
121
121
|
var metadata = parsedField[0];
|
|
@@ -124,7 +124,7 @@ var TelemetryCachePluggable = /** @class */ (function () {
|
|
|
124
124
|
result.set(metadata, config);
|
|
125
125
|
}
|
|
126
126
|
catch (e) {
|
|
127
|
-
_this.log.error("Ignoring invalid config: "
|
|
127
|
+
_this.log.error("Ignoring invalid config: ".concat(configs[i]));
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
return Promise.all(configKeys.map(function (configKey) { return _this.wrapper.del(configKey); })).then(function () { return result; });
|
|
@@ -32,7 +32,7 @@ var UniqueKeysCachePluggable = /** @class */ (function (_super) {
|
|
|
32
32
|
this.clear();
|
|
33
33
|
return this.wrapper.pushItems(this.key, uniqueKeysArray)
|
|
34
34
|
.catch(function (err) {
|
|
35
|
-
_this.log.error(LOG_PREFIX
|
|
35
|
+
_this.log.error("".concat(LOG_PREFIX, "Error in uniqueKeys pipeline: ").concat(err, "."));
|
|
36
36
|
return false;
|
|
37
37
|
});
|
|
38
38
|
};
|
|
@@ -35,7 +35,7 @@ function validatePluggableStorageOptions(options) {
|
|
|
35
35
|
var wrapper = options.wrapper;
|
|
36
36
|
var missingMethods = METHODS_TO_PROMISE_WRAP.filter(function (method) { return typeof wrapper[method] !== 'function'; });
|
|
37
37
|
if (missingMethods.length)
|
|
38
|
-
throw new Error(NO_VALID_WRAPPER_INTERFACE
|
|
38
|
+
throw new Error("".concat(NO_VALID_WRAPPER_INTERFACE, " The following methods are missing or invalid: ").concat(missingMethods));
|
|
39
39
|
}
|
|
40
40
|
// Async return type in `client.track` method on consumer partial mode
|
|
41
41
|
// No need to promisify impressions cache
|
|
@@ -79,7 +79,7 @@ export function PluggableStorage(options) {
|
|
|
79
79
|
var currentHash = getStorageHash(settings);
|
|
80
80
|
if (hash !== currentHash) {
|
|
81
81
|
log.info(LOG_PREFIX + 'Storage HASH has changed (SDK key, flags filter criteria or flags spec version was modified). Clearing cache');
|
|
82
|
-
return wrapper.getKeysByPrefix(keys.prefix
|
|
82
|
+
return wrapper.getKeysByPrefix("".concat(keys.prefix, ".")).then(function (storageKeys) {
|
|
83
83
|
return Promise.all(storageKeys.map(function (storageKey) { return wrapper.del(storageKey); }));
|
|
84
84
|
}).then(function () { return wrapper.set(keys.buildHashKey(), currentHash); });
|
|
85
85
|
}
|
|
@@ -31,7 +31,7 @@ export function wrapperAdapter(log, wrapper) {
|
|
|
31
31
|
METHODS_TO_PROMISE_WRAP.forEach(function (method) {
|
|
32
32
|
// Logs error and wraps it into a rejected promise.
|
|
33
33
|
function handleError(e) {
|
|
34
|
-
log.error(LOG_PREFIX
|
|
34
|
+
log.error("".concat(LOG_PREFIX, " Wrapper '").concat(method, "' operation threw an error. Message: ").concat(e));
|
|
35
35
|
return Promise.reject(e);
|
|
36
36
|
}
|
|
37
37
|
wrapperAdapter[method] = function () {
|
|
@@ -22,14 +22,14 @@ export function validateRolloutPlan(log, settings) {
|
|
|
22
22
|
export function setRolloutPlan(log, rolloutPlan, storage, matchingKey) {
|
|
23
23
|
var splits = storage.splits, rbSegments = storage.rbSegments, segments = storage.segments, largeSegments = storage.largeSegments;
|
|
24
24
|
var _a = rolloutPlan.splitChanges, ff = _a.ff, rbs = _a.rbs;
|
|
25
|
-
log.debug("storage: set feature flags and segments"
|
|
25
|
+
log.debug("storage: set feature flags and segments".concat(matchingKey ? " for key ".concat(matchingKey) : ''));
|
|
26
26
|
if (splits && ff) {
|
|
27
27
|
splits.clear();
|
|
28
|
-
splits.update(ff.d, [], ff.t);
|
|
28
|
+
splits.update(ff.d || [], [], ff.t);
|
|
29
29
|
}
|
|
30
30
|
if (rbSegments && rbs) {
|
|
31
31
|
rbSegments.clear();
|
|
32
|
-
rbSegments.update(rbs.d, [], rbs.t);
|
|
32
|
+
rbSegments.update(rbs.d || [], [], rbs.t);
|
|
33
33
|
}
|
|
34
34
|
var segmentChanges = rolloutPlan.segmentChanges;
|
|
35
35
|
if (matchingKey) { // add memberships data (client-side)
|
package/esm/storages/utils.js
CHANGED
|
@@ -37,30 +37,30 @@ var REVERSE_METHOD_NAMES = Object.keys(METHOD_NAMES).reduce(function (acc, key)
|
|
|
37
37
|
export function parseMetadata(field) {
|
|
38
38
|
var parts = field.split('/');
|
|
39
39
|
if (parts.length !== 3)
|
|
40
|
-
return "invalid subsection count. Expected 3, got: "
|
|
40
|
+
return "invalid subsection count. Expected 3, got: ".concat(parts.length);
|
|
41
41
|
var s = parts[0] /* metadata.s */, n = parts[1] /* metadata.n */, i = parts[2] /* metadata.i */;
|
|
42
42
|
return [JSON.stringify({ s: s, n: n, i: i })];
|
|
43
43
|
}
|
|
44
44
|
export function parseExceptionField(field) {
|
|
45
45
|
var parts = field.split('/');
|
|
46
46
|
if (parts.length !== 4)
|
|
47
|
-
return "invalid subsection count. Expected 4, got: "
|
|
47
|
+
return "invalid subsection count. Expected 4, got: ".concat(parts.length);
|
|
48
48
|
var s = parts[0] /* metadata.s */, n = parts[1] /* metadata.n */, i = parts[2] /* metadata.i */, m = parts[3];
|
|
49
49
|
var method = REVERSE_METHOD_NAMES[m];
|
|
50
50
|
if (!method)
|
|
51
|
-
return "unknown method '"
|
|
51
|
+
return "unknown method '".concat(m, "'");
|
|
52
52
|
return [JSON.stringify({ s: s, n: n, i: i }), method];
|
|
53
53
|
}
|
|
54
54
|
export function parseLatencyField(field) {
|
|
55
55
|
var parts = field.split('/');
|
|
56
56
|
if (parts.length !== 5)
|
|
57
|
-
return "invalid subsection count. Expected 5, got: "
|
|
57
|
+
return "invalid subsection count. Expected 5, got: ".concat(parts.length);
|
|
58
58
|
var s = parts[0] /* metadata.s */, n = parts[1] /* metadata.n */, i = parts[2] /* metadata.i */, m = parts[3], b = parts[4];
|
|
59
59
|
var method = REVERSE_METHOD_NAMES[m];
|
|
60
60
|
if (!method)
|
|
61
|
-
return "unknown method '"
|
|
61
|
+
return "unknown method '".concat(m, "'");
|
|
62
62
|
var bucket = parseInt(b);
|
|
63
63
|
if (isNaN(bucket) || bucket >= MAX_LATENCY_BUCKET_COUNT)
|
|
64
|
-
return "invalid bucket. Expected a number between 0 and "
|
|
64
|
+
return "invalid bucket. Expected a number between 0 and ".concat(MAX_LATENCY_BUCKET_COUNT - 1, ", got: ").concat(b);
|
|
65
65
|
return [JSON.stringify({ s: s, n: n, i: i }), method, bucket];
|
|
66
66
|
}
|
|
@@ -15,8 +15,8 @@ export function pollingManagerSSFactory(params) {
|
|
|
15
15
|
// Start periodic fetching (polling)
|
|
16
16
|
start: function () {
|
|
17
17
|
log.info(POLLING_START);
|
|
18
|
-
log.debug(LOG_PREFIX_SYNC_POLLING +
|
|
19
|
-
log.debug(LOG_PREFIX_SYNC_POLLING +
|
|
18
|
+
log.debug(LOG_PREFIX_SYNC_POLLING + "Splits will be refreshed each ".concat(settings.scheduler.featuresRefreshRate, " millis"));
|
|
19
|
+
log.debug(LOG_PREFIX_SYNC_POLLING + "Segments will be refreshed each ".concat(settings.scheduler.segmentsRefreshRate, " millis"));
|
|
20
20
|
var startingUp = splitsSyncTask.start();
|
|
21
21
|
if (startingUp) {
|
|
22
22
|
startingUp.then(function () {
|
|
@@ -20,7 +20,7 @@ export function segmentChangesUpdaterFactory(log, segmentChangesFetcher, segment
|
|
|
20
20
|
return promise;
|
|
21
21
|
}
|
|
22
22
|
function updateSegment(segmentName, noCache, till, fetchOnlyNew, retries) {
|
|
23
|
-
log.debug(LOG_PREFIX_SYNC_SEGMENTS
|
|
23
|
+
log.debug("".concat(LOG_PREFIX_SYNC_SEGMENTS, "Processing segment ").concat(segmentName));
|
|
24
24
|
var sincePromise = Promise.resolve(segments.getChangeNumber(segmentName));
|
|
25
25
|
return sincePromise.then(function (since) {
|
|
26
26
|
// if fetchOnlyNew flag, avoid processing already fetched segments
|
|
@@ -28,14 +28,14 @@ export function segmentChangesUpdaterFactory(log, segmentChangesFetcher, segment
|
|
|
28
28
|
false :
|
|
29
29
|
segmentChangesFetcher(since || -1, segmentName, noCache, till, _promiseDecorator).then(function (changes) {
|
|
30
30
|
return Promise.all(changes.map(function (x) {
|
|
31
|
-
log.debug(LOG_PREFIX_SYNC_SEGMENTS
|
|
31
|
+
log.debug("".concat(LOG_PREFIX_SYNC_SEGMENTS, "Processing ").concat(segmentName, " with till = ").concat(x.till, ". Added: ").concat(x.added.length, ". Removed: ").concat(x.removed.length));
|
|
32
32
|
return segments.update(segmentName, x.added, x.removed, x.till);
|
|
33
33
|
})).then(function (updates) {
|
|
34
34
|
return updates.some(function (update) { return update; });
|
|
35
35
|
});
|
|
36
36
|
}).catch(function (error) {
|
|
37
37
|
if (retries) {
|
|
38
|
-
log.warn(LOG_PREFIX_SYNC_SEGMENTS
|
|
38
|
+
log.warn("".concat(LOG_PREFIX_SYNC_SEGMENTS, "Retrying fetch of segment ").concat(segmentName, " (attempt #").concat(retries, "). Reason: ").concat(error));
|
|
39
39
|
return updateSegment(segmentName, noCache, till, fetchOnlyNew, retries - 1);
|
|
40
40
|
}
|
|
41
41
|
throw error;
|
|
@@ -54,7 +54,7 @@ export function segmentChangesUpdaterFactory(log, segmentChangesFetcher, segment
|
|
|
54
54
|
* @param till - till target for the provided segmentName, for CDN bypass.
|
|
55
55
|
*/
|
|
56
56
|
return function segmentChangesUpdater(fetchOnlyNew, segmentName, noCache, till) {
|
|
57
|
-
log.debug(LOG_PREFIX_SYNC_SEGMENTS
|
|
57
|
+
log.debug("".concat(LOG_PREFIX_SYNC_SEGMENTS, "Started segments update"));
|
|
58
58
|
// If not a segment name provided, read list of available segments names to be updated.
|
|
59
59
|
var segmentsPromise = Promise.resolve(segmentName ? [segmentName] : segments.getRegisteredSegments());
|
|
60
60
|
return segmentsPromise.then(function (segmentNames) {
|
|
@@ -81,10 +81,10 @@ export function segmentChangesUpdaterFactory(log, segmentChangesFetcher, segment
|
|
|
81
81
|
// @TODO although factory status is destroyed, synchronization is not stopped
|
|
82
82
|
if (readiness)
|
|
83
83
|
readiness.setDestroyed();
|
|
84
|
-
log.error(LOG_PREFIX_INSTANTIATION
|
|
84
|
+
log.error("".concat(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."));
|
|
85
85
|
}
|
|
86
86
|
else {
|
|
87
|
-
log.warn(LOG_PREFIX_SYNC_SEGMENTS
|
|
87
|
+
log.warn("".concat(LOG_PREFIX_SYNC_SEGMENTS, "Error while doing fetch of segments. ").concat(error));
|
|
88
88
|
}
|
|
89
89
|
return false;
|
|
90
90
|
});
|
|
@@ -21,7 +21,7 @@ function checkAllSegmentsExist(segments) {
|
|
|
21
21
|
*/
|
|
22
22
|
export function parseSegments(ruleEntity, matcherType) {
|
|
23
23
|
if (matcherType === void 0) { matcherType = IN_SEGMENT; }
|
|
24
|
-
var _a = ruleEntity,
|
|
24
|
+
var _a = ruleEntity, conditions = _a.conditions, excluded = _a.excluded;
|
|
25
25
|
var segments = new Set();
|
|
26
26
|
if (excluded && excluded.segments) {
|
|
27
27
|
excluded.segments.forEach(function (_a) {
|
|
@@ -31,12 +31,14 @@ export function parseSegments(ruleEntity, matcherType) {
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
if (conditions) {
|
|
35
|
+
for (var i = 0; i < conditions.length; i++) {
|
|
36
|
+
var matchers = conditions[i].matcherGroup.matchers;
|
|
37
|
+
matchers.forEach(function (matcher) {
|
|
38
|
+
if (matcher.matcherType === matcherType)
|
|
39
|
+
segments.add(matcher.userDefinedSegmentMatcherData.segmentName);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
40
42
|
}
|
|
41
43
|
return segments;
|
|
42
44
|
}
|
|
@@ -66,7 +68,7 @@ function matchFilters(featureFlag, filters) {
|
|
|
66
68
|
*/
|
|
67
69
|
export function computeMutation(rules, segments, filters) {
|
|
68
70
|
return rules.reduce(function (accum, ruleEntity) {
|
|
69
|
-
if (ruleEntity.status
|
|
71
|
+
if (ruleEntity.status !== 'ARCHIVED' && (!filters || matchFilters(ruleEntity, filters))) {
|
|
70
72
|
accum.added.push(ruleEntity);
|
|
71
73
|
parseSegments(ruleEntity).forEach(function (segmentName) {
|
|
72
74
|
segments.add(segmentName);
|
|
@@ -135,14 +137,14 @@ export function splitChangesUpdaterFactory(log, splitChangesFetcher, storage, sp
|
|
|
135
137
|
var updatedFlags = [];
|
|
136
138
|
var ffUpdate = false;
|
|
137
139
|
if (splitChanges.ff) {
|
|
138
|
-
var _a = computeMutation(splitChanges.ff.d, usedSegments, splitFiltersValidation), added = _a.added, removed = _a.removed, names = _a.names;
|
|
140
|
+
var _a = computeMutation(splitChanges.ff.d || [], usedSegments, splitFiltersValidation), added = _a.added, removed = _a.removed, names = _a.names;
|
|
139
141
|
updatedFlags = names;
|
|
140
142
|
log.debug(SYNC_SPLITS_UPDATE, [added.length, removed.length]);
|
|
141
143
|
ffUpdate = splits.update(added, removed, splitChanges.ff.t);
|
|
142
144
|
}
|
|
143
145
|
var rbsUpdate = false;
|
|
144
146
|
if (splitChanges.rbs) {
|
|
145
|
-
var _b = computeMutation(splitChanges.rbs.d, usedSegments), added = _b.added, removed = _b.removed;
|
|
147
|
+
var _b = computeMutation(splitChanges.rbs.d || [], usedSegments), added = _b.added, removed = _b.removed;
|
|
146
148
|
log.debug(SYNC_RBS_UPDATE, [added.length, removed.length]);
|
|
147
149
|
rbsUpdate = rbSegments.update(added, removed, splitChanges.rbs.t);
|
|
148
150
|
}
|
|
@@ -57,11 +57,11 @@ var SSEClient = /** @class */ (function () {
|
|
|
57
57
|
var params = CONTROL_CHANNEL_REGEX.test(channel) ? '[?occupancy=metrics.publishers]' : '';
|
|
58
58
|
return encodeURIComponent(params + channel);
|
|
59
59
|
}).join(',');
|
|
60
|
-
var url = this.settings.urls.streaming
|
|
60
|
+
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`
|
|
61
61
|
var isServerSide = checkIfServerSide(this.settings);
|
|
62
62
|
this.connection = new this.eventSource(
|
|
63
63
|
// 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
|
|
64
|
-
isServerSide ? url : url +
|
|
64
|
+
isServerSide ? url : url + "&SplitSDKVersion=".concat(this.headers.SplitSDKVersion, "&SplitSDKClientKey=").concat(this.headers.SplitSDKClientKey),
|
|
65
65
|
// For server-side SDKs, metadata is passed via headers
|
|
66
66
|
objectAssign(isServerSide ?
|
|
67
67
|
{ headers: decorateHeaders(this.settings, this.headers) } :
|
|
@@ -48,7 +48,7 @@ export function MySegmentsUpdateWorker(log, storage, mySegmentsSyncTask, telemet
|
|
|
48
48
|
telemetryTracker.trackUpdatesFromSSE(MEMBERSHIPS);
|
|
49
49
|
var attempts = backoff.attempts + 1;
|
|
50
50
|
if (maxChangeNumber <= currentChangeNumber) {
|
|
51
|
-
log.debug("Refresh completed"
|
|
51
|
+
log.debug("Refresh completed".concat(cdnBypass ? ' bypassing the CDN' : '', " in ").concat(attempts, " attempts."));
|
|
52
52
|
isHandlingEvent = false;
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
@@ -57,7 +57,7 @@ export function MySegmentsUpdateWorker(log, storage, mySegmentsSyncTask, telemet
|
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
59
|
if (cdnBypass) {
|
|
60
|
-
log.debug("No changes fetched after "
|
|
60
|
+
log.debug("No changes fetched after ".concat(attempts, " attempts with CDN bypassed."));
|
|
61
61
|
isHandlingEvent = false;
|
|
62
62
|
}
|
|
63
63
|
else {
|
|
@@ -25,7 +25,7 @@ export function SegmentsUpdateWorker(log, segmentsSyncTask, segmentsCache) {
|
|
|
25
25
|
else {
|
|
26
26
|
var attempts = backoff.attempts + 1;
|
|
27
27
|
if (maxChangeNumber <= (segmentsCache.getChangeNumber(segment) || -1)) {
|
|
28
|
-
log.debug("Refresh completed"
|
|
28
|
+
log.debug("Refresh completed".concat(cdnBypass ? ' bypassing the CDN' : '', " in ").concat(attempts, " attempts."));
|
|
29
29
|
isHandlingEvent = false;
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
@@ -34,7 +34,7 @@ export function SegmentsUpdateWorker(log, segmentsSyncTask, segmentsCache) {
|
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
if (cdnBypass) {
|
|
37
|
-
log.debug("No changes fetched after "
|
|
37
|
+
log.debug("No changes fetched after ".concat(attempts, " attempts with CDN bypassed."));
|
|
38
38
|
isHandlingEvent = false;
|
|
39
39
|
}
|
|
40
40
|
else {
|