@splitsoftware/splitio-commons 2.12.0 → 3.0.0-rc.0
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 +14 -1
- package/cjs/evaluator/condition/engineUtils.js +2 -2
- package/cjs/evaluator/fallbackConfigsCalculator/fallbackSanitizer/index.js +70 -0
- package/cjs/evaluator/fallbackConfigsCalculator/index.js +25 -0
- package/cjs/evaluator/fallbackTreatmentsCalculator/fallbackSanitizer/index.js +5 -8
- package/cjs/evaluator/fallbackTreatmentsCalculator/index.js +21 -32
- package/cjs/evaluator/index.js +67 -42
- package/cjs/evaluator/matchers/whitelist.js +1 -1
- package/cjs/integrations/pluggable.js +1 -1
- package/cjs/listeners/browser.js +4 -3
- package/cjs/listeners/node.js +4 -4
- package/cjs/logger/constants.js +14 -20
- package/cjs/logger/index.js +1 -1
- package/cjs/logger/messages/debug.js +6 -7
- package/cjs/logger/messages/error.js +4 -4
- package/cjs/logger/messages/info.js +2 -4
- package/cjs/logger/messages/warn.js +9 -9
- package/cjs/platform/browser.js +15 -0
- package/cjs/platform/getEventSource/browser.js +8 -0
- package/cjs/platform/getEventSource/eventsource.js +480 -0
- package/cjs/platform/getEventSource/node.js +26 -0
- package/cjs/platform/getFetch/browser.js +9 -0
- package/cjs/platform/getFetch/node.js +27 -0
- package/cjs/platform/getOptions/node.js +25 -0
- package/cjs/platform/node.js +17 -0
- package/cjs/readiness/constants.js +2 -1
- package/cjs/sdkClient/client.js +9 -35
- package/cjs/sdkClient/clientAttributesDecoration.js +3 -3
- package/cjs/sdkClient/clientInputValidation.js +38 -81
- package/cjs/sdkClient/identity.js +1 -1
- package/cjs/sdkClient/sdkClient.js +4 -49
- package/cjs/sdkClient/sdkLifecycle.js +70 -0
- package/cjs/sdkClient/trackMethod.js +56 -0
- package/cjs/sdkFactory/index.js +8 -45
- package/cjs/sdkManager/index.js +3 -3
- package/cjs/services/splitApi.js +18 -13
- package/cjs/services/splitHttpClient.js +1 -1
- package/cjs/storages/AbstractSplitsCacheAsync.js +1 -1
- package/cjs/storages/AbstractSplitsCacheSync.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/RBSegmentsCacheInLocal.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/RBSegmentsCacheInMemory.js +1 -1
- package/cjs/storages/inMemory/SplitsCacheInMemory.js +1 -1
- package/cjs/storages/inMemory/TelemetryCacheInMemory.js +2 -2
- 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/RBSegmentsCacheInRedis.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/RBSegmentsCachePluggable.js +1 -1
- 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 +1 -1
- 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/fetchers/splitChangesFetcher.js +23 -14
- package/cjs/sync/polling/pollingManagerCS.js +11 -11
- package/cjs/sync/polling/pollingManagerSS.js +13 -13
- package/cjs/sync/polling/syncTasks/definitionsSyncTask.js +12 -0
- package/cjs/sync/polling/updaters/{splitChangesUpdater.js → definitionChangesUpdater.js} +67 -59
- package/cjs/sync/polling/updaters/mySegmentsUpdater.js +1 -1
- package/cjs/sync/polling/updaters/segmentChangesUpdater.js +6 -6
- 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 +4 -4
- package/cjs/sync/streaming/parseUtils.js +12 -12
- package/cjs/sync/streaming/pushManager.js +2 -2
- package/cjs/sync/submitters/impressionsSubmitter.js +6 -6
- package/cjs/sync/submitters/submitter.js +1 -1
- package/cjs/sync/syncManagerOnline.js +5 -2
- 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/EventEmitter.js +391 -0
- package/cjs/utils/filter/bloomFilter.js +37 -0
- package/cjs/utils/inputValidation/apiKey.js +1 -1
- package/cjs/utils/inputValidation/attribute.js +2 -2
- package/cjs/utils/inputValidation/{split.js → definition.js} +10 -10
- package/cjs/utils/inputValidation/{splitExistence.js → definitionExistence.js} +6 -6
- package/cjs/utils/inputValidation/definitions.js +25 -0
- package/cjs/utils/inputValidation/eventProperties.js +1 -1
- package/cjs/utils/inputValidation/index.js +7 -7
- package/cjs/utils/inputValidation/isOperational.js +4 -4
- package/cjs/utils/inputValidation/target.js +22 -0
- package/cjs/utils/labels/index.js +3 -3
- package/cjs/utils/lang/index.js +1 -1
- package/cjs/utils/promise/timeout.js +1 -1
- package/cjs/utils/settingsValidation/splitFilters.js +4 -4
- package/cjs/utils/settingsValidation/url.js +5 -5
- package/esm/evaluator/condition/engineUtils.js +2 -2
- package/esm/evaluator/fallbackConfigsCalculator/fallbackSanitizer/index.js +64 -0
- package/esm/evaluator/fallbackConfigsCalculator/index.js +21 -0
- package/esm/evaluator/fallbackTreatmentsCalculator/fallbackSanitizer/index.js +5 -8
- package/esm/evaluator/fallbackTreatmentsCalculator/index.js +21 -33
- package/esm/evaluator/index.js +66 -42
- package/esm/evaluator/matchers/whitelist.js +1 -1
- package/esm/integrations/pluggable.js +1 -1
- package/esm/listeners/browser.js +4 -3
- package/esm/listeners/node.js +4 -4
- package/esm/logger/constants.js +11 -17
- package/esm/logger/index.js +1 -1
- package/esm/logger/messages/debug.js +5 -6
- package/esm/logger/messages/error.js +3 -3
- package/esm/logger/messages/info.js +1 -3
- package/esm/logger/messages/warn.js +8 -8
- package/esm/platform/browser.js +12 -0
- package/esm/platform/getEventSource/browser.js +4 -0
- package/esm/platform/getEventSource/eventsource.js +480 -0
- package/esm/platform/getEventSource/node.js +20 -0
- package/esm/platform/getFetch/browser.js +5 -0
- package/esm/platform/getFetch/node.js +22 -0
- package/esm/platform/getOptions/node.js +20 -0
- package/esm/platform/node.js +14 -0
- package/esm/readiness/constants.js +1 -0
- package/esm/sdkClient/client.js +10 -37
- package/esm/sdkClient/clientAttributesDecoration.js +3 -3
- package/esm/sdkClient/clientInputValidation.js +40 -83
- package/esm/sdkClient/identity.js +1 -1
- package/esm/sdkClient/sdkClient.js +4 -49
- package/esm/sdkClient/sdkLifecycle.js +66 -0
- package/esm/sdkClient/trackMethod.js +52 -0
- package/esm/sdkFactory/index.js +8 -45
- package/esm/sdkManager/index.js +4 -4
- package/esm/services/splitApi.js +18 -13
- package/esm/services/splitHttpClient.js +1 -1
- package/esm/storages/AbstractSplitsCacheAsync.js +1 -1
- package/esm/storages/AbstractSplitsCacheSync.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/inLocalStorage/RBSegmentsCacheInLocal.js +1 -1
- package/esm/storages/inMemory/ImpressionCountsCacheInMemory.js +1 -1
- package/esm/storages/inMemory/RBSegmentsCacheInMemory.js +1 -1
- package/esm/storages/inMemory/TelemetryCacheInMemory.js +2 -2
- package/esm/storages/inRedis/EventsCacheInRedis.js +1 -1
- package/esm/storages/inRedis/ImpressionCountsCacheInRedis.js +4 -4
- package/esm/storages/inRedis/RBSegmentsCacheInRedis.js +1 -1
- 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/RBSegmentsCachePluggable.js +1 -1
- 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 +1 -1
- package/esm/storages/utils.js +6 -6
- package/esm/sync/offline/splitsParser/parseCondition.js +1 -1
- package/esm/sync/polling/fetchers/splitChangesFetcher.js +24 -15
- package/esm/sync/polling/pollingManagerCS.js +11 -11
- package/esm/sync/polling/pollingManagerSS.js +13 -13
- package/esm/sync/polling/syncTasks/definitionsSyncTask.js +8 -0
- package/esm/sync/polling/updaters/{splitChangesUpdater.js → definitionChangesUpdater.js} +67 -59
- package/esm/sync/polling/updaters/mySegmentsUpdater.js +2 -2
- package/esm/sync/polling/updaters/segmentChangesUpdater.js +7 -7
- 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 +4 -4
- package/esm/sync/streaming/parseUtils.js +10 -10
- package/esm/sync/streaming/pushManager.js +3 -3
- package/esm/sync/submitters/impressionsSubmitter.js +6 -6
- package/esm/sync/submitters/submitter.js +1 -1
- package/esm/sync/syncManagerOnline.js +5 -2
- 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/EventEmitter.js +387 -0
- package/esm/utils/filter/bloomFilter.js +33 -0
- package/esm/utils/inputValidation/apiKey.js +1 -1
- package/esm/utils/inputValidation/attribute.js +2 -2
- package/esm/utils/inputValidation/{split.js → definition.js} +8 -8
- package/esm/utils/inputValidation/definitionExistence.js +15 -0
- package/esm/utils/inputValidation/definitions.js +21 -0
- package/esm/utils/inputValidation/index.js +3 -3
- package/esm/utils/inputValidation/isOperational.js +4 -4
- package/esm/utils/inputValidation/target.js +18 -0
- package/esm/utils/labels/index.js +2 -2
- package/esm/utils/promise/timeout.js +1 -1
- package/esm/utils/settingsValidation/splitFilters.js +4 -4
- package/esm/utils/settingsValidation/url.js +5 -5
- package/package.json +15 -6
- package/src/dtos/types.ts +65 -70
- package/src/evaluator/Engine.ts +4 -4
- package/src/evaluator/combiners/and.ts +3 -3
- package/src/evaluator/combiners/ifelseif.ts +2 -2
- package/src/evaluator/condition/engineUtils.ts +2 -2
- package/src/evaluator/condition/index.ts +3 -3
- package/src/evaluator/fallbackConfigsCalculator/fallbackSanitizer/index.ts +76 -0
- package/src/evaluator/fallbackConfigsCalculator/index.ts +24 -0
- package/src/evaluator/fallbackTreatmentsCalculator/fallbackSanitizer/index.ts +5 -7
- package/src/evaluator/fallbackTreatmentsCalculator/index.ts +27 -41
- package/src/evaluator/index.ts +80 -45
- package/src/evaluator/matchers/dependency.ts +2 -2
- package/src/evaluator/matchers/matcherTypes.ts +2 -2
- package/src/evaluator/matchers/prerequisites.ts +4 -4
- package/src/evaluator/matchers/rbsegment.ts +2 -2
- package/src/evaluator/matchers/whitelist.ts +2 -2
- package/src/evaluator/matchersTransform/index.ts +2 -2
- package/src/evaluator/matchersTransform/whitelist.ts +2 -2
- package/src/evaluator/parser/index.ts +4 -4
- package/src/evaluator/treatments/index.ts +2 -2
- package/src/evaluator/types.ts +6 -6
- package/src/evaluator/value/index.ts +1 -1
- package/src/integrations/pluggable.ts +1 -1
- package/src/listeners/browser.ts +11 -8
- package/src/listeners/node.ts +2 -5
- package/src/logger/constants.ts +11 -17
- package/src/logger/messages/debug.ts +5 -6
- package/src/logger/messages/error.ts +3 -3
- package/src/logger/messages/info.ts +1 -3
- package/src/logger/messages/warn.ts +8 -8
- package/src/platform/browser.ts +14 -0
- package/src/platform/getEventSource/browser.ts +4 -0
- package/src/platform/getEventSource/eventsource.js +519 -0
- package/src/platform/getEventSource/node.ts +23 -0
- package/src/platform/getFetch/browser.ts +5 -0
- package/src/platform/getFetch/node.ts +27 -0
- package/src/platform/getOptions/node.ts +24 -0
- package/src/platform/node.ts +16 -0
- package/src/readiness/constants.ts +1 -0
- package/src/sdkClient/client.ts +11 -41
- package/src/sdkClient/clientInputValidation.ts +44 -84
- package/src/sdkClient/sdkClient.ts +5 -54
- package/src/sdkClient/sdkLifecycle.ts +78 -0
- package/src/sdkClient/trackMethod.ts +59 -0
- package/src/sdkFactory/index.ts +10 -54
- package/src/sdkFactory/types.ts +19 -16
- package/src/sdkManager/index.ts +9 -9
- package/src/services/splitApi.ts +6 -0
- package/src/services/types.ts +3 -2
- package/src/storages/AbstractSplitsCacheAsync.ts +7 -7
- package/src/storages/AbstractSplitsCacheSync.ts +10 -10
- package/src/storages/inLocalStorage/RBSegmentsCacheInLocal.ts +2 -2
- package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +6 -6
- package/src/storages/inMemory/RBSegmentsCacheInMemory.ts +2 -2
- package/src/storages/inMemory/SplitsCacheInMemory.ts +5 -5
- package/src/storages/inMemory/TelemetryCacheInMemory.ts +2 -2
- package/src/storages/inRedis/RBSegmentsCacheInRedis.ts +2 -2
- package/src/storages/inRedis/SplitsCacheInRedis.ts +9 -9
- package/src/storages/pluggable/RBSegmentsCachePluggable.ts +2 -2
- package/src/storages/pluggable/SplitsCachePluggable.ts +9 -9
- package/src/storages/types.ts +21 -16
- package/src/sync/offline/splitsParser/parseCondition.ts +2 -2
- package/src/sync/offline/splitsParser/splitsParserFromSettings.ts +3 -3
- package/src/sync/offline/splitsParser/types.ts +6 -3
- package/src/sync/offline/syncManagerOffline.ts +2 -2
- package/src/sync/offline/syncTasks/fromObjectSyncTask.ts +6 -6
- package/src/sync/polling/fetchers/splitChangesFetcher.ts +57 -22
- package/src/sync/polling/fetchers/types.ts +5 -3
- package/src/sync/polling/pollingManagerCS.ts +12 -10
- package/src/sync/polling/pollingManagerSS.ts +15 -13
- package/src/sync/polling/syncTasks/{splitsSyncTask.ts → definitionsSyncTask.ts} +10 -11
- package/src/sync/polling/types.ts +3 -3
- package/src/sync/polling/updaters/{splitChangesUpdater.ts → definitionChangesUpdater.ts} +77 -68
- package/src/sync/polling/updaters/mySegmentsUpdater.ts +2 -2
- package/src/sync/polling/updaters/segmentChangesUpdater.ts +7 -7
- package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +6 -6
- package/src/sync/streaming/parseUtils.ts +12 -12
- package/src/sync/streaming/pushManager.ts +3 -3
- package/src/sync/submitters/impressionsSubmitter.ts +9 -9
- package/src/sync/submitters/types.ts +3 -0
- package/src/sync/syncManagerOnline.ts +6 -2
- package/src/trackers/eventTracker.ts +7 -10
- package/src/trackers/impressionsTracker.ts +42 -26
- package/src/trackers/types.ts +3 -1
- package/src/utils/EventEmitter.js +444 -0
- package/src/utils/filter/bloomFilter.ts +38 -0
- package/src/utils/inputValidation/definition.ts +27 -0
- package/src/utils/inputValidation/definitionExistence.ts +19 -0
- package/src/utils/inputValidation/definitions.ts +21 -0
- package/src/utils/inputValidation/index.ts +3 -3
- package/src/utils/inputValidation/isOperational.ts +4 -4
- package/src/utils/inputValidation/target.ts +21 -0
- package/src/utils/labels/index.ts +2 -2
- package/src/utils/settingsValidation/splitFilters.ts +3 -3
- package/types/splitio.d.ts +202 -9
- package/cjs/sync/polling/syncTasks/splitsSyncTask.js +0 -13
- package/cjs/utils/inputValidation/splits.js +0 -25
- package/esm/sync/polling/syncTasks/splitsSyncTask.js +0 -9
- package/esm/utils/inputValidation/splitExistence.js +0 -15
- package/esm/utils/inputValidation/splits.js +0 -21
- package/src/utils/inputValidation/split.ts +0 -27
- package/src/utils/inputValidation/splitExistence.ts +0 -19
- package/src/utils/inputValidation/splits.ts +0 -21
package/esm/services/splitApi.js
CHANGED
|
@@ -21,15 +21,15 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
21
21
|
return {
|
|
22
22
|
// @TODO throw errors if health check requests fail, to log them in the Synchronizer
|
|
23
23
|
getSdkAPIHealthCheck: function () {
|
|
24
|
-
var url = urls.sdk
|
|
24
|
+
var url = "".concat(urls.sdk, "/version");
|
|
25
25
|
return splitHttpClient(url).then(function () { return true; }).catch(function () { return false; });
|
|
26
26
|
},
|
|
27
27
|
getEventsAPIHealthCheck: function () {
|
|
28
|
-
var url = urls.events
|
|
28
|
+
var url = "".concat(urls.events, "/version");
|
|
29
29
|
return splitHttpClient(url).then(function () { return true; }).catch(function () { return false; });
|
|
30
30
|
},
|
|
31
31
|
fetchAuth: function (userMatchingKeys) {
|
|
32
|
-
var url = urls.auth
|
|
32
|
+
var url = "".concat(urls.auth, "/v2/auth?s=").concat(settings.sync.flagSpecVersion);
|
|
33
33
|
if (userMatchingKeys) { // `userMatchingKeys` is undefined in server-side
|
|
34
34
|
var queryParams = userMatchingKeys.map(userKeyToQueryParam).join('&');
|
|
35
35
|
if (queryParams)
|
|
@@ -38,7 +38,7 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
38
38
|
return splitHttpClient(url, undefined, telemetryTracker.trackHttp(TOKEN));
|
|
39
39
|
},
|
|
40
40
|
fetchSplitChanges: function (since, noCache, till, rbSince) {
|
|
41
|
-
var url = urls.sdk
|
|
41
|
+
var url = "".concat(urls.sdk, "/splitChanges?s=").concat(settings.sync.flagSpecVersion, "&since=").concat(since).concat(rbSince ? '&rbSince=' + rbSince : '').concat(filterQueryString || '').concat(till ? '&till=' + till : '');
|
|
42
42
|
return splitHttpClient(url, noCache ? noCacheHeaderOptions : undefined, telemetryTracker.trackHttp(SPLITS))
|
|
43
43
|
.catch(function (err) {
|
|
44
44
|
if (err.statusCode === 414)
|
|
@@ -46,8 +46,13 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
46
46
|
throw err;
|
|
47
47
|
});
|
|
48
48
|
},
|
|
49
|
+
// @TODO support filterQueryString and handle ERROR_TOO_MANY_SETS error
|
|
50
|
+
fetchConfigs: function (since, noCache, till) {
|
|
51
|
+
var url = "".concat(urls.sdk, "/v1/configs?since=").concat(since).concat(filterQueryString || '').concat(till ? '&till=' + till : '');
|
|
52
|
+
return splitHttpClient(url, noCache ? noCacheHeaderOptions : undefined);
|
|
53
|
+
},
|
|
49
54
|
fetchSegmentChanges: function (since, segmentName, noCache, till) {
|
|
50
|
-
var url = urls.sdk
|
|
55
|
+
var url = "".concat(urls.sdk, "/segmentChanges/").concat(segmentName, "?since=").concat(since).concat(till ? '&till=' + till : '');
|
|
51
56
|
return splitHttpClient(url, noCache ? noCacheHeaderOptions : undefined, telemetryTracker.trackHttp(SEGMENT));
|
|
52
57
|
},
|
|
53
58
|
fetchMemberships: function (userMatchingKey, noCache, till) {
|
|
@@ -57,7 +62,7 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
57
62
|
* - avoid 404 responses. E.g.: '/api/memberships/foo/bar'
|
|
58
63
|
* - match user keys with special characters. E.g.: 'foo%bar', 'foo/bar'
|
|
59
64
|
*/
|
|
60
|
-
var url = urls.sdk
|
|
65
|
+
var url = "".concat(urls.sdk, "/memberships/").concat(encodeURIComponent(userMatchingKey)).concat(till ? '?till=' + till : '');
|
|
61
66
|
return splitHttpClient(url, noCache ? noCacheHeaderOptions : undefined, telemetryTracker.trackHttp(MEMBERSHIPS));
|
|
62
67
|
},
|
|
63
68
|
/**
|
|
@@ -67,7 +72,7 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
67
72
|
* @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
68
73
|
*/
|
|
69
74
|
postEventsBulk: function (body, headers) {
|
|
70
|
-
var url = urls.events
|
|
75
|
+
var url = "".concat(urls.events, "/events/bulk");
|
|
71
76
|
return splitHttpClient(url, { method: 'POST', body: body, headers: headers }, telemetryTracker.trackHttp(EVENTS));
|
|
72
77
|
},
|
|
73
78
|
/**
|
|
@@ -77,7 +82,7 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
77
82
|
* @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
78
83
|
*/
|
|
79
84
|
postTestImpressionsBulk: function (body, headers) {
|
|
80
|
-
var url = urls.events
|
|
85
|
+
var url = "".concat(urls.events, "/testImpressions/bulk");
|
|
81
86
|
return splitHttpClient(url, {
|
|
82
87
|
// Adding extra headers to send impressions in OPTIMIZED or DEBUG modes.
|
|
83
88
|
method: 'POST',
|
|
@@ -92,7 +97,7 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
92
97
|
* @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
93
98
|
*/
|
|
94
99
|
postTestImpressionsCount: function (body, headers) {
|
|
95
|
-
var url = urls.events
|
|
100
|
+
var url = "".concat(urls.events, "/testImpressions/count");
|
|
96
101
|
return splitHttpClient(url, { method: 'POST', body: body, headers: headers }, telemetryTracker.trackHttp(IMPRESSIONS_COUNT));
|
|
97
102
|
},
|
|
98
103
|
/**
|
|
@@ -102,7 +107,7 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
102
107
|
* @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
103
108
|
*/
|
|
104
109
|
postUniqueKeysBulkCs: function (body, headers) {
|
|
105
|
-
var url = urls.telemetry
|
|
110
|
+
var url = "".concat(urls.telemetry, "/v1/keys/cs");
|
|
106
111
|
return splitHttpClient(url, { method: 'POST', body: body, headers: headers }, telemetryTracker.trackHttp(TELEMETRY));
|
|
107
112
|
},
|
|
108
113
|
/**
|
|
@@ -112,15 +117,15 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
112
117
|
* @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
113
118
|
*/
|
|
114
119
|
postUniqueKeysBulkSs: function (body, headers) {
|
|
115
|
-
var url = urls.telemetry
|
|
120
|
+
var url = "".concat(urls.telemetry, "/v1/keys/ss");
|
|
116
121
|
return splitHttpClient(url, { method: 'POST', body: body, headers: headers }, telemetryTracker.trackHttp(TELEMETRY));
|
|
117
122
|
},
|
|
118
123
|
postMetricsConfig: function (body, headers) {
|
|
119
|
-
var url = urls.telemetry
|
|
124
|
+
var url = "".concat(urls.telemetry, "/v1/metrics/config");
|
|
120
125
|
return splitHttpClient(url, { method: 'POST', body: body, headers: headers }, telemetryTracker.trackHttp(TELEMETRY), true);
|
|
121
126
|
},
|
|
122
127
|
postMetricsUsage: function (body, headers) {
|
|
123
|
-
var url = urls.telemetry
|
|
128
|
+
var url = "".concat(urls.telemetry, "/v1/metrics/usage");
|
|
124
129
|
return splitHttpClient(url, { method: 'POST', body: body, headers: headers }, telemetryTracker.trackHttp(TELEMETRY), true);
|
|
125
130
|
}
|
|
126
131
|
};
|
|
@@ -21,7 +21,7 @@ export function splitHttpClientFactory(settings, _a) {
|
|
|
21
21
|
var commonHeaders = {
|
|
22
22
|
'Accept': 'application/json',
|
|
23
23
|
'Content-Type': 'application/json',
|
|
24
|
-
'Authorization': "Bearer "
|
|
24
|
+
'Authorization': "Bearer ".concat(authorizationKey),
|
|
25
25
|
'SplitSDKVersion': version
|
|
26
26
|
};
|
|
27
27
|
if (ip)
|
|
@@ -11,7 +11,7 @@ var AbstractSplitsCacheAsync = /** @class */ (function () {
|
|
|
11
11
|
return Promise.all([
|
|
12
12
|
this.setChangeNumber(changeNumber),
|
|
13
13
|
Promise.all(toAdd.map(function (addedFF) { return _this.addSplit(addedFF); })),
|
|
14
|
-
Promise.all(toRemove.map(function (removedFF) { return _this.removeSplit(removedFF
|
|
14
|
+
Promise.all(toRemove.map(function (removedFF) { return _this.removeSplit(removedFF); }))
|
|
15
15
|
]).then(function (_a) {
|
|
16
16
|
var added = _a[1], removed = _a[2];
|
|
17
17
|
return added.some(function (result) { return result; }) || removed.some(function (result) { return result; });
|
|
@@ -10,7 +10,7 @@ var AbstractSplitsCacheSync = /** @class */ (function () {
|
|
|
10
10
|
AbstractSplitsCacheSync.prototype.update = function (toAdd, toRemove, changeNumber) {
|
|
11
11
|
var _this = this;
|
|
12
12
|
var updated = toAdd.map(function (addedFF) { return _this.addSplit(addedFF); }).some(function (result) { return result; });
|
|
13
|
-
updated = toRemove.map(function (removedFF) { return _this.removeSplit(removedFF
|
|
13
|
+
updated = toRemove.map(function (removedFF) { return _this.removeSplit(removedFF); }).some(function (result) { return result; }) || updated;
|
|
14
14
|
this.setChangeNumber(changeNumber);
|
|
15
15
|
return updated;
|
|
16
16
|
};
|
|
@@ -10,34 +10,34 @@ var KeyBuilder = /** @class */ (function () {
|
|
|
10
10
|
this.prefix = prefix;
|
|
11
11
|
}
|
|
12
12
|
KeyBuilder.prototype.buildTrafficTypeKey = function (trafficType) {
|
|
13
|
-
return this.prefix
|
|
13
|
+
return "".concat(this.prefix, ".trafficType.").concat(trafficType);
|
|
14
14
|
};
|
|
15
15
|
KeyBuilder.prototype.buildFlagSetKey = function (flagSet) {
|
|
16
|
-
return this.prefix
|
|
16
|
+
return "".concat(this.prefix, ".flagSet.").concat(flagSet);
|
|
17
17
|
};
|
|
18
18
|
KeyBuilder.prototype.buildSplitKey = function (splitName) {
|
|
19
|
-
return this.prefix
|
|
19
|
+
return "".concat(this.prefix, ".split.").concat(splitName);
|
|
20
20
|
};
|
|
21
21
|
KeyBuilder.prototype.buildSplitsTillKey = function () {
|
|
22
|
-
return this.prefix
|
|
22
|
+
return "".concat(this.prefix, ".splits.till");
|
|
23
23
|
};
|
|
24
24
|
KeyBuilder.prototype.buildSplitKeyPrefix = function () {
|
|
25
|
-
return this.prefix
|
|
25
|
+
return "".concat(this.prefix, ".split.");
|
|
26
26
|
};
|
|
27
27
|
KeyBuilder.prototype.buildRBSegmentKey = function (rbsegmentName) {
|
|
28
|
-
return this.prefix
|
|
28
|
+
return "".concat(this.prefix, ".rbsegment.").concat(rbsegmentName);
|
|
29
29
|
};
|
|
30
30
|
KeyBuilder.prototype.buildRBSegmentsTillKey = function () {
|
|
31
|
-
return this.prefix
|
|
31
|
+
return "".concat(this.prefix, ".rbsegments.till");
|
|
32
32
|
};
|
|
33
33
|
KeyBuilder.prototype.buildRBSegmentKeyPrefix = function () {
|
|
34
|
-
return this.prefix
|
|
34
|
+
return "".concat(this.prefix, ".rbsegment.");
|
|
35
35
|
};
|
|
36
36
|
KeyBuilder.prototype.buildSegmentNameKey = function (segmentName) {
|
|
37
|
-
return this.prefix
|
|
37
|
+
return "".concat(this.prefix, ".segment.").concat(segmentName);
|
|
38
38
|
};
|
|
39
39
|
KeyBuilder.prototype.buildSegmentTillKey = function (segmentName) {
|
|
40
|
-
return this.prefix
|
|
40
|
+
return "".concat(this.prefix, ".segment.").concat(segmentName, ".till");
|
|
41
41
|
};
|
|
42
42
|
KeyBuilder.prototype.extractKey = function (builtKey) {
|
|
43
43
|
var s = builtKey.match(everythingAtTheEnd);
|
|
@@ -49,7 +49,7 @@ var KeyBuilder = /** @class */ (function () {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
KeyBuilder.prototype.buildHashKey = function () {
|
|
52
|
-
return this.prefix
|
|
52
|
+
return "".concat(this.prefix, ".hash");
|
|
53
53
|
};
|
|
54
54
|
return KeyBuilder;
|
|
55
55
|
}());
|
|
@@ -59,5 +59,5 @@ export { KeyBuilder };
|
|
|
59
59
|
* The hash is in hexadecimal format (8 characters max, 32 bits).
|
|
60
60
|
*/
|
|
61
61
|
export function getStorageHash(settings) {
|
|
62
|
-
return hash(settings.core.authorizationKey
|
|
62
|
+
return hash("".concat(settings.core.authorizationKey, "::").concat(settings.sync.__splitFiltersValidation.queryString, "::").concat(settings.sync.flagSpecVersion)).toString(16);
|
|
63
63
|
}
|
|
@@ -6,40 +6,40 @@ var KeyBuilderCS = /** @class */ (function (_super) {
|
|
|
6
6
|
function KeyBuilderCS(prefix, matchingKey) {
|
|
7
7
|
var _this = _super.call(this, prefix) || this;
|
|
8
8
|
_this.matchingKey = matchingKey;
|
|
9
|
-
_this.regexSplitsCacheKey = new RegExp("^"
|
|
9
|
+
_this.regexSplitsCacheKey = new RegExp("^".concat(prefix, "\\.(splits?|trafficType|flagSet)\\."));
|
|
10
10
|
return _this;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* @override
|
|
14
14
|
*/
|
|
15
15
|
KeyBuilderCS.prototype.buildSegmentNameKey = function (segmentName) {
|
|
16
|
-
return this.prefix
|
|
16
|
+
return "".concat(this.prefix, ".").concat(this.matchingKey, ".segment.").concat(segmentName);
|
|
17
17
|
};
|
|
18
18
|
KeyBuilderCS.prototype.extractSegmentName = function (builtSegmentKeyName) {
|
|
19
|
-
var prefix = this.prefix
|
|
19
|
+
var prefix = "".concat(this.prefix, ".").concat(this.matchingKey, ".segment.");
|
|
20
20
|
if (startsWith(builtSegmentKeyName, prefix))
|
|
21
21
|
return builtSegmentKeyName.slice(prefix.length);
|
|
22
22
|
};
|
|
23
23
|
KeyBuilderCS.prototype.buildLastUpdatedKey = function () {
|
|
24
|
-
return this.prefix
|
|
24
|
+
return "".concat(this.prefix, ".splits.lastUpdated");
|
|
25
25
|
};
|
|
26
26
|
KeyBuilderCS.prototype.isSplitsCacheKey = function (key) {
|
|
27
27
|
return this.regexSplitsCacheKey.test(key);
|
|
28
28
|
};
|
|
29
29
|
KeyBuilderCS.prototype.buildTillKey = function () {
|
|
30
|
-
return this.prefix
|
|
30
|
+
return "".concat(this.prefix, ".").concat(this.matchingKey, ".segments.till");
|
|
31
31
|
};
|
|
32
32
|
KeyBuilderCS.prototype.isSplitKey = function (key) {
|
|
33
|
-
return startsWith(key, this.prefix
|
|
33
|
+
return startsWith(key, "".concat(this.prefix, ".split."));
|
|
34
34
|
};
|
|
35
35
|
KeyBuilderCS.prototype.isRBSegmentKey = function (key) {
|
|
36
|
-
return startsWith(key, this.prefix
|
|
36
|
+
return startsWith(key, "".concat(this.prefix, ".rbsegment."));
|
|
37
37
|
};
|
|
38
38
|
KeyBuilderCS.prototype.buildSplitsWithSegmentCountKey = function () {
|
|
39
|
-
return this.prefix
|
|
39
|
+
return "".concat(this.prefix, ".splits.usingSegments");
|
|
40
40
|
};
|
|
41
41
|
KeyBuilderCS.prototype.buildLastClear = function () {
|
|
42
|
-
return this.prefix
|
|
42
|
+
return "".concat(this.prefix, ".lastClear");
|
|
43
43
|
};
|
|
44
44
|
return KeyBuilderCS;
|
|
45
45
|
}(KeyBuilder));
|
|
@@ -47,15 +47,15 @@ export { KeyBuilderCS };
|
|
|
47
47
|
export function myLargeSegmentsKeyBuilder(prefix, matchingKey) {
|
|
48
48
|
return {
|
|
49
49
|
buildSegmentNameKey: function (segmentName) {
|
|
50
|
-
return prefix
|
|
50
|
+
return "".concat(prefix, ".").concat(matchingKey, ".largeSegment.").concat(segmentName);
|
|
51
51
|
},
|
|
52
52
|
extractSegmentName: function (builtSegmentKeyName) {
|
|
53
|
-
var p = prefix
|
|
53
|
+
var p = "".concat(prefix, ".").concat(matchingKey, ".largeSegment.");
|
|
54
54
|
if (startsWith(builtSegmentKeyName, p))
|
|
55
55
|
return builtSegmentKeyName.slice(p.length);
|
|
56
56
|
},
|
|
57
57
|
buildTillKey: function () {
|
|
58
|
-
return prefix
|
|
58
|
+
return "".concat(prefix, ".").concat(matchingKey, ".largeSegments.till");
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
}
|
|
@@ -15,42 +15,42 @@ var KeyBuilderSS = /** @class */ (function (_super) {
|
|
|
15
15
|
__extends(KeyBuilderSS, _super);
|
|
16
16
|
function KeyBuilderSS(prefix, metadata) {
|
|
17
17
|
var _this = _super.call(this, prefix) || this;
|
|
18
|
-
_this.latencyPrefix = _this.prefix
|
|
19
|
-
_this.exceptionPrefix = _this.prefix
|
|
20
|
-
_this.initPrefix = _this.prefix
|
|
21
|
-
_this.versionablePrefix = metadata.s
|
|
18
|
+
_this.latencyPrefix = "".concat(_this.prefix, ".telemetry.latencies");
|
|
19
|
+
_this.exceptionPrefix = "".concat(_this.prefix, ".telemetry.exceptions");
|
|
20
|
+
_this.initPrefix = "".concat(_this.prefix, ".telemetry.init");
|
|
21
|
+
_this.versionablePrefix = "".concat(metadata.s, "/").concat(metadata.n, "/").concat(metadata.i);
|
|
22
22
|
return _this;
|
|
23
23
|
}
|
|
24
24
|
KeyBuilderSS.prototype.buildRegisteredSegmentsKey = function () {
|
|
25
|
-
return this.prefix
|
|
25
|
+
return "".concat(this.prefix, ".segments.registered");
|
|
26
26
|
};
|
|
27
27
|
KeyBuilderSS.prototype.buildImpressionsKey = function () {
|
|
28
|
-
return this.prefix
|
|
28
|
+
return "".concat(this.prefix, ".impressions");
|
|
29
29
|
};
|
|
30
30
|
KeyBuilderSS.prototype.buildImpressionsCountKey = function () {
|
|
31
|
-
return this.prefix
|
|
31
|
+
return "".concat(this.prefix, ".impressions.count");
|
|
32
32
|
};
|
|
33
33
|
KeyBuilderSS.prototype.buildUniqueKeysKey = function () {
|
|
34
|
-
return this.prefix
|
|
34
|
+
return "".concat(this.prefix, ".uniquekeys");
|
|
35
35
|
};
|
|
36
36
|
KeyBuilderSS.prototype.buildEventsKey = function () {
|
|
37
|
-
return this.prefix
|
|
37
|
+
return "".concat(this.prefix, ".events");
|
|
38
38
|
};
|
|
39
39
|
KeyBuilderSS.prototype.searchPatternForSplitKeys = function () {
|
|
40
|
-
return this.buildSplitKeyPrefix()
|
|
40
|
+
return "".concat(this.buildSplitKeyPrefix(), "*");
|
|
41
41
|
};
|
|
42
42
|
KeyBuilderSS.prototype.searchPatternForRBSegmentKeys = function () {
|
|
43
|
-
return this.buildRBSegmentKeyPrefix()
|
|
43
|
+
return "".concat(this.buildRBSegmentKeyPrefix(), "*");
|
|
44
44
|
};
|
|
45
45
|
/* Telemetry keys */
|
|
46
46
|
KeyBuilderSS.prototype.buildLatencyKey = function (method, bucket) {
|
|
47
|
-
return this.latencyPrefix
|
|
47
|
+
return "".concat(this.latencyPrefix, "::").concat(this.versionablePrefix, "/").concat(METHOD_NAMES[method], "/").concat(bucket);
|
|
48
48
|
};
|
|
49
49
|
KeyBuilderSS.prototype.buildExceptionKey = function (method) {
|
|
50
|
-
return this.exceptionPrefix
|
|
50
|
+
return "".concat(this.exceptionPrefix, "::").concat(this.versionablePrefix, "/").concat(METHOD_NAMES[method]);
|
|
51
51
|
};
|
|
52
52
|
KeyBuilderSS.prototype.buildInitKey = function () {
|
|
53
|
-
return this.initPrefix
|
|
53
|
+
return "".concat(this.initPrefix, "::").concat(this.versionablePrefix);
|
|
54
54
|
};
|
|
55
55
|
return KeyBuilderSS;
|
|
56
56
|
}(KeyBuilder));
|
|
@@ -7,7 +7,7 @@ export function getRolloutPlan(log, storage, options) {
|
|
|
7
7
|
if (options === void 0) { options = {}; }
|
|
8
8
|
var keys = options.keys, exposeSegments = options.exposeSegments;
|
|
9
9
|
var splits = storage.splits, segments = storage.segments, rbSegments = storage.rbSegments;
|
|
10
|
-
log.debug("storage: get feature flags"
|
|
10
|
+
log.debug("storage: get feature flags".concat(keys ? ", and memberships for keys: ".concat(keys) : '').concat(exposeSegments ? ', and segments' : ''));
|
|
11
11
|
return {
|
|
12
12
|
splitChanges: {
|
|
13
13
|
ff: {
|
|
@@ -16,7 +16,7 @@ var RBSegmentsCacheInLocal = /** @class */ (function () {
|
|
|
16
16
|
RBSegmentsCacheInLocal.prototype.update = function (toAdd, toRemove, changeNumber) {
|
|
17
17
|
var _this = this;
|
|
18
18
|
var updated = toAdd.map(function (toAdd) { return _this.add(toAdd); }).some(function (result) { return result; });
|
|
19
|
-
updated = toRemove.map(function (toRemove) { return _this.remove(toRemove
|
|
19
|
+
updated = toRemove.map(function (toRemove) { return _this.remove(toRemove); }).some(function (result) { return result; }) || updated;
|
|
20
20
|
this.setChangeNumber(changeNumber);
|
|
21
21
|
return updated;
|
|
22
22
|
};
|
|
@@ -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.
|
|
@@ -14,7 +14,7 @@ var RBSegmentsCacheInMemory = /** @class */ (function () {
|
|
|
14
14
|
RBSegmentsCacheInMemory.prototype.update = function (toAdd, toRemove, changeNumber) {
|
|
15
15
|
var _this = this;
|
|
16
16
|
var updated = toAdd.map(function (toAdd) { return _this.add(toAdd); }).some(function (result) { return result; });
|
|
17
|
-
updated = toRemove.map(function (toRemove) { return _this.remove(toRemove
|
|
17
|
+
updated = toRemove.map(function (toRemove) { return _this.remove(toRemove); }).some(function (result) { return result; }) || updated;
|
|
18
18
|
this.changeNumber = changeNumber;
|
|
19
19
|
return updated;
|
|
20
20
|
};
|
|
@@ -15,8 +15,8 @@ var ACCEPTANCE_RANGE = 0.001;
|
|
|
15
15
|
* All factory instances track telemetry on server-side, and 0.1% on client-side.
|
|
16
16
|
*/
|
|
17
17
|
export function shouldRecordTelemetry(_a) {
|
|
18
|
-
var settings = _a.settings;
|
|
19
|
-
return settings.mode !== LOCALHOST_MODE && (checkIfServerSide(settings) || Math.random() <= ACCEPTANCE_RANGE);
|
|
18
|
+
var settings = _a.settings, disableTelemetry = _a.disableTelemetry;
|
|
19
|
+
return !disableTelemetry && settings.mode !== LOCALHOST_MODE && (checkIfServerSide(settings) || Math.random() <= ACCEPTANCE_RANGE);
|
|
20
20
|
}
|
|
21
21
|
var TelemetryCacheInMemory = /** @class */ (function () {
|
|
22
22
|
function TelemetryCacheInMemory(splits, segments, largeSegments) {
|
|
@@ -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({
|
|
@@ -31,7 +31,7 @@ var RBSegmentsCacheInRedis = /** @class */ (function () {
|
|
|
31
31
|
return _this.redis.set(key, stringifiedNewRBSegment).then(function () { return true; });
|
|
32
32
|
})),
|
|
33
33
|
Promise.all(toRemove.map(function (toRemove) {
|
|
34
|
-
var key = _this.keys.buildRBSegmentKey(toRemove
|
|
34
|
+
var key = _this.keys.buildRBSegmentKey(toRemove);
|
|
35
35
|
return _this.redis.del(key).then(function (status) { return status === 1; });
|
|
36
36
|
}))
|
|
37
37
|
]).then(function (_a) {
|
|
@@ -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
|
};
|