@splitsoftware/splitio-commons 2.11.1-rc.2 → 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 +15 -2
- 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/evaluator/index.js
CHANGED
|
@@ -1,55 +1,60 @@
|
|
|
1
1
|
import { engineParser } from './Engine';
|
|
2
2
|
import { thenable } from '../utils/promise/thenable';
|
|
3
|
-
import { EXCEPTION,
|
|
3
|
+
import { EXCEPTION, NO_CONDITION_MATCH, DEFINITION_NOT_FOUND } from '../utils/labels';
|
|
4
4
|
import { CONTROL } from '../utils/constants';
|
|
5
5
|
import { returnSetsUnion, setToArray } from '../utils/lang/sets';
|
|
6
6
|
import { WARN_FLAGSET_WITHOUT_FLAGS } from '../logger/constants';
|
|
7
|
-
var
|
|
7
|
+
var EVALUATION_EXCEPTION = {
|
|
8
8
|
treatment: CONTROL,
|
|
9
9
|
label: EXCEPTION,
|
|
10
10
|
config: null
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
var EVALUATION_DEFINITION_NOT_FOUND = {
|
|
13
|
+
treatment: CONTROL,
|
|
14
|
+
label: DEFINITION_NOT_FOUND,
|
|
15
|
+
config: null
|
|
16
|
+
};
|
|
17
|
+
function treatmentsException(definitionNames) {
|
|
13
18
|
var evaluations = {};
|
|
14
|
-
|
|
15
|
-
evaluations[
|
|
19
|
+
definitionNames.forEach(function (definitionName) {
|
|
20
|
+
evaluations[definitionName] = EVALUATION_EXCEPTION;
|
|
16
21
|
});
|
|
17
22
|
return evaluations;
|
|
18
23
|
}
|
|
19
|
-
export function evaluateFeature(log, key,
|
|
20
|
-
var
|
|
24
|
+
export function evaluateFeature(log, key, definitionName, attributes, storage, options) {
|
|
25
|
+
var definition;
|
|
21
26
|
try {
|
|
22
|
-
|
|
27
|
+
definition = storage.splits.getSplit(definitionName);
|
|
23
28
|
}
|
|
24
29
|
catch (e) {
|
|
25
30
|
// Exception on sync `getSplit` storage. Not possible ATM with InMemory and InLocal storages.
|
|
26
|
-
return
|
|
31
|
+
return EVALUATION_EXCEPTION;
|
|
27
32
|
}
|
|
28
|
-
if (thenable(
|
|
29
|
-
return
|
|
33
|
+
if (thenable(definition)) {
|
|
34
|
+
return definition.then(function (definition) { return getEvaluation(log, key, definition, attributes, storage, options); }).catch(
|
|
30
35
|
// Exception on async `getSplit` storage. For example, when the storage is redis or
|
|
31
36
|
// pluggable and there is a connection issue and we can't retrieve the split to be evaluated
|
|
32
|
-
function () { return
|
|
37
|
+
function () { return EVALUATION_EXCEPTION; });
|
|
33
38
|
}
|
|
34
|
-
return getEvaluation(log, key,
|
|
39
|
+
return getEvaluation(log, key, definition, attributes, storage, options);
|
|
35
40
|
}
|
|
36
|
-
export function evaluateFeatures(log, key,
|
|
37
|
-
var
|
|
41
|
+
export function evaluateFeatures(log, key, definitionNames, attributes, storage, options) {
|
|
42
|
+
var definitions;
|
|
38
43
|
try {
|
|
39
|
-
|
|
44
|
+
definitions = storage.splits.getSplits(definitionNames);
|
|
40
45
|
}
|
|
41
46
|
catch (e) {
|
|
42
47
|
// Exception on sync `getSplits` storage. Not possible ATM with InMemory and InLocal storages.
|
|
43
|
-
return treatmentsException(
|
|
48
|
+
return treatmentsException(definitionNames);
|
|
44
49
|
}
|
|
45
|
-
return thenable(
|
|
46
|
-
|
|
50
|
+
return thenable(definitions) ?
|
|
51
|
+
definitions.then(function (definitions) { return getEvaluations(log, key, definitionNames, definitions, attributes, storage, options); })
|
|
47
52
|
.catch(function () {
|
|
48
53
|
// Exception on async `getSplits` storage. For example, when the storage is redis or
|
|
49
54
|
// pluggable and there is a connection issue and we can't retrieve the split to be evaluated
|
|
50
|
-
return treatmentsException(
|
|
55
|
+
return treatmentsException(definitionNames);
|
|
51
56
|
}) :
|
|
52
|
-
getEvaluations(log, key,
|
|
57
|
+
getEvaluations(log, key, definitionNames, definitions, attributes, storage, options);
|
|
53
58
|
}
|
|
54
59
|
export function evaluateFeaturesByFlagSets(log, key, flagSets, attributes, storage, method, options) {
|
|
55
60
|
var storedFlagNames;
|
|
@@ -84,47 +89,66 @@ export function evaluateFeaturesByFlagSets(log, key, flagSets, attributes, stora
|
|
|
84
89
|
}) :
|
|
85
90
|
evaluate(storedFlagNames);
|
|
86
91
|
}
|
|
87
|
-
function getEvaluation(log, key,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
config: null
|
|
92
|
-
};
|
|
93
|
-
if (splitJSON) {
|
|
94
|
-
var split = engineParser(log, splitJSON, storage);
|
|
95
|
-
evaluation = split.getTreatment(key, attributes, evaluateFeature);
|
|
92
|
+
function getEvaluation(log, key, definition, attributes, storage, options) {
|
|
93
|
+
if (definition) {
|
|
94
|
+
var split = engineParser(log, definition, storage);
|
|
95
|
+
var evaluation = split.getTreatment(key, attributes, evaluateFeature);
|
|
96
96
|
// If the storage is async and the evaluated flag uses segments or dependencies, evaluation is thenable
|
|
97
97
|
if (thenable(evaluation)) {
|
|
98
98
|
return evaluation.then(function (result) {
|
|
99
|
-
result.changeNumber =
|
|
100
|
-
result.config =
|
|
99
|
+
result.changeNumber = definition.changeNumber;
|
|
100
|
+
result.config = definition.configurations && definition.configurations[result.treatment] || null;
|
|
101
101
|
// @ts-expect-error impressionsDisabled is not exposed in the public typings yet.
|
|
102
|
-
result.impressionsDisabled = (options === null || options === void 0 ? void 0 : options.impressionsDisabled) ||
|
|
102
|
+
result.impressionsDisabled = (options === null || options === void 0 ? void 0 : options.impressionsDisabled) || definition.impressionsDisabled;
|
|
103
103
|
return result;
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
else {
|
|
107
|
-
evaluation.changeNumber =
|
|
108
|
-
evaluation.config =
|
|
107
|
+
evaluation.changeNumber = definition.changeNumber;
|
|
108
|
+
evaluation.config = definition.configurations && definition.configurations[evaluation.treatment] || null;
|
|
109
109
|
// @ts-expect-error impressionsDisabled is not exposed in the public typings yet.
|
|
110
|
-
evaluation.impressionsDisabled = (options === null || options === void 0 ? void 0 : options.impressionsDisabled) ||
|
|
110
|
+
evaluation.impressionsDisabled = (options === null || options === void 0 ? void 0 : options.impressionsDisabled) || definition.impressionsDisabled;
|
|
111
111
|
}
|
|
112
|
+
return evaluation;
|
|
112
113
|
}
|
|
113
|
-
return
|
|
114
|
+
return EVALUATION_DEFINITION_NOT_FOUND;
|
|
114
115
|
}
|
|
115
|
-
function getEvaluations(log, key,
|
|
116
|
+
function getEvaluations(log, key, definitionNames, splits, attributes, storage, options) {
|
|
116
117
|
var result = {};
|
|
117
118
|
var thenables = [];
|
|
118
|
-
|
|
119
|
-
var evaluation = getEvaluation(log, key, splits[
|
|
119
|
+
definitionNames.forEach(function (definitionName) {
|
|
120
|
+
var evaluation = getEvaluation(log, key, splits[definitionName], attributes, storage, options);
|
|
120
121
|
if (thenable(evaluation)) {
|
|
121
122
|
thenables.push(evaluation.then(function (res) {
|
|
122
|
-
result[
|
|
123
|
+
result[definitionName] = res;
|
|
123
124
|
}));
|
|
124
125
|
}
|
|
125
126
|
else {
|
|
126
|
-
result[
|
|
127
|
+
result[definitionName] = evaluation;
|
|
127
128
|
}
|
|
128
129
|
});
|
|
129
130
|
return thenables.length > 0 ? Promise.all(thenables).then(function () { return result; }) : result;
|
|
130
131
|
}
|
|
132
|
+
export function evaluateDefaultTreatment(definitionName, storage) {
|
|
133
|
+
var definition;
|
|
134
|
+
try {
|
|
135
|
+
definition = storage.splits.getSplit(definitionName);
|
|
136
|
+
}
|
|
137
|
+
catch (e) {
|
|
138
|
+
return EVALUATION_EXCEPTION;
|
|
139
|
+
}
|
|
140
|
+
return thenable(definition) ?
|
|
141
|
+
definition.then(getDefaultTreatment).catch(function () { return EVALUATION_EXCEPTION; }) :
|
|
142
|
+
getDefaultTreatment(definition);
|
|
143
|
+
}
|
|
144
|
+
function getDefaultTreatment(definition) {
|
|
145
|
+
if (definition) {
|
|
146
|
+
return {
|
|
147
|
+
treatment: definition.defaultTreatment,
|
|
148
|
+
label: NO_CONDITION_MATCH,
|
|
149
|
+
config: definition.configurations && definition.configurations[definition.defaultTreatment] || null,
|
|
150
|
+
changeNumber: definition.changeNumber
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
return EVALUATION_DEFINITION_NOT_FOUND;
|
|
154
|
+
}
|
|
@@ -13,7 +13,7 @@ export function pluggableIntegrationsManagerFactory(integrations, params) {
|
|
|
13
13
|
// No need to check if `settings.integrations` is an array of functions. It was already validated
|
|
14
14
|
integrations.forEach(function (integrationFactory) {
|
|
15
15
|
var integration = integrationFactory(params);
|
|
16
|
-
if (integration
|
|
16
|
+
if (integration)
|
|
17
17
|
listeners.push(integration);
|
|
18
18
|
});
|
|
19
19
|
// If `listeners` is empty, not return a integration manager
|
package/esm/listeners/browser.js
CHANGED
|
@@ -10,14 +10,15 @@ var EVENT_NAME = 'for visibilitychange and pagehide events.';
|
|
|
10
10
|
* We'll listen for events over the window object.
|
|
11
11
|
*/
|
|
12
12
|
var BrowserSignalListener = /** @class */ (function () {
|
|
13
|
-
function BrowserSignalListener(
|
|
13
|
+
function BrowserSignalListener(_a) {
|
|
14
|
+
var syncManager = _a.syncManager, settings = _a.settings, storage = _a.storage, splitApi = _a.splitApi, entityType = _a.entityType;
|
|
14
15
|
this.syncManager = syncManager;
|
|
15
16
|
this.settings = settings;
|
|
16
17
|
this.storage = storage;
|
|
17
|
-
this.serviceApi =
|
|
18
|
+
this.serviceApi = splitApi;
|
|
18
19
|
this.flushData = this.flushData.bind(this);
|
|
19
20
|
this.flushDataIfHidden = this.flushDataIfHidden.bind(this);
|
|
20
|
-
this.fromImpressionsCollector = fromImpressionsCollector.bind(undefined, settings.core.labelsEnabled);
|
|
21
|
+
this.fromImpressionsCollector = fromImpressionsCollector.bind(undefined, settings.core.labelsEnabled, entityType);
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
24
|
* start method.
|
package/esm/listeners/node.js
CHANGED
|
@@ -10,8 +10,8 @@ var EVENT_NAME = 'for SIGTERM signal.';
|
|
|
10
10
|
* the process is already exiting.
|
|
11
11
|
*/
|
|
12
12
|
var NodeSignalListener = /** @class */ (function () {
|
|
13
|
-
function NodeSignalListener(
|
|
14
|
-
|
|
13
|
+
function NodeSignalListener(_a) {
|
|
14
|
+
var syncManager = _a.syncManager, settings = _a.settings;
|
|
15
15
|
// @TODO review handler logic when implementing Node.js SDK
|
|
16
16
|
this.handler = function () {
|
|
17
17
|
if (syncManager) {
|
|
@@ -44,13 +44,13 @@ var NodeSignalListener = /** @class */ (function () {
|
|
|
44
44
|
// eslint-disable-next-line no-undef
|
|
45
45
|
process.kill(process.pid, SIGTERM);
|
|
46
46
|
};
|
|
47
|
-
this.settings.log.debug(LOG_PREFIX_CLEANUP
|
|
47
|
+
this.settings.log.debug("".concat(LOG_PREFIX_CLEANUP, "Split SDK graceful shutdown after SIGTERM."));
|
|
48
48
|
var handlerResult = null;
|
|
49
49
|
try {
|
|
50
50
|
handlerResult = this.handler();
|
|
51
51
|
}
|
|
52
52
|
catch (err) {
|
|
53
|
-
this.settings.log.error(LOG_PREFIX_CLEANUP
|
|
53
|
+
this.settings.log.error("".concat(LOG_PREFIX_CLEANUP, "Error with Split SDK graceful shutdown: ").concat(err));
|
|
54
54
|
}
|
|
55
55
|
if (thenable(handlerResult)) {
|
|
56
56
|
// Always exit, even with errors. The promise is returned for UT purposes.
|
package/esm/logger/constants.js
CHANGED
|
@@ -19,9 +19,8 @@ export var RETRIEVE_CLIENT_DEFAULT = 27;
|
|
|
19
19
|
export var RETRIEVE_CLIENT_EXISTING = 28;
|
|
20
20
|
export var RETRIEVE_MANAGER = 29;
|
|
21
21
|
export var SYNC_OFFLINE_DATA = 30;
|
|
22
|
-
export var
|
|
23
|
-
export var
|
|
24
|
-
export var SYNC_RBS_UPDATE = 33;
|
|
22
|
+
export var SYNC_FETCH = 31;
|
|
23
|
+
export var SYNC_UPDATE = 32;
|
|
25
24
|
export var STREAMING_NEW_MESSAGE = 35;
|
|
26
25
|
export var SYNC_TASK_START = 36;
|
|
27
26
|
export var SYNC_TASK_EXECUTE = 37;
|
|
@@ -31,14 +30,12 @@ export var ENGINE_MATCHER_RESULT = 40;
|
|
|
31
30
|
export var ENGINE_DEFAULT = 41;
|
|
32
31
|
export var CLIENT_READY_FROM_CACHE = 100;
|
|
33
32
|
export var CLIENT_READY = 101;
|
|
34
|
-
export var IMPRESSION = 102;
|
|
35
33
|
export var IMPRESSION_QUEUEING = 103;
|
|
36
34
|
export var NEW_SHARED_CLIENT = 104;
|
|
37
35
|
export var NEW_FACTORY = 105;
|
|
38
36
|
export var POLLING_SMART_PAUSING = 106;
|
|
39
37
|
export var POLLING_START = 107;
|
|
40
38
|
export var POLLING_STOP = 108;
|
|
41
|
-
export var SYNC_SPLITS_FETCH_RETRY = 109;
|
|
42
39
|
export var STREAMING_REFRESH_TOKEN = 110;
|
|
43
40
|
export var STREAMING_RECONNECT = 111;
|
|
44
41
|
export var STREAMING_CONNECTING = 112;
|
|
@@ -59,8 +56,8 @@ export var ENGINE_VALUE_INVALID = 200;
|
|
|
59
56
|
export var ENGINE_VALUE_NO_ATTRIBUTES = 201;
|
|
60
57
|
export var CLIENT_NO_LISTENER = 202;
|
|
61
58
|
export var CLIENT_NOT_READY_FROM_CACHE = 203;
|
|
62
|
-
export var
|
|
63
|
-
export var
|
|
59
|
+
export var SYNC_FETCH_RETRY = 204;
|
|
60
|
+
export var SYNC_FETCH_FAILS = 205;
|
|
64
61
|
export var STREAMING_PARSING_ERROR_FAILS = 206;
|
|
65
62
|
export var STREAMING_PARSING_MESSAGE_FAILS = 207;
|
|
66
63
|
export var STREAMING_FALLBACK = 208;
|
|
@@ -70,7 +67,7 @@ export var WARN_SETTING_NULL = 211;
|
|
|
70
67
|
export var WARN_TRIMMING_PROPERTIES = 212;
|
|
71
68
|
export var WARN_CONVERTING = 213;
|
|
72
69
|
export var WARN_TRIMMING = 214;
|
|
73
|
-
export var
|
|
70
|
+
export var WARN_NOT_EXISTENT_DEFINITION = 215;
|
|
74
71
|
export var WARN_LOWERCASE_TRAFFIC_TYPE = 216;
|
|
75
72
|
export var WARN_NOT_EXISTENT_TT = 217;
|
|
76
73
|
export var WARN_INTEGRATION_INVALID = 218;
|
|
@@ -121,15 +118,12 @@ export var LOG_PREFIX_ENGINE = 'engine';
|
|
|
121
118
|
export var LOG_PREFIX_ENGINE_COMBINER = LOG_PREFIX_ENGINE + ':combiner: ';
|
|
122
119
|
export var LOG_PREFIX_ENGINE_MATCHER = LOG_PREFIX_ENGINE + ':matcher: ';
|
|
123
120
|
export var LOG_PREFIX_ENGINE_VALUE = LOG_PREFIX_ENGINE + ':value: ';
|
|
124
|
-
export var LOG_PREFIX_SYNC = 'sync';
|
|
125
|
-
export var LOG_PREFIX_SYNC_MANAGER =
|
|
126
|
-
export var LOG_PREFIX_SYNC_OFFLINE =
|
|
127
|
-
export var LOG_PREFIX_SYNC_STREAMING =
|
|
128
|
-
export var
|
|
129
|
-
export var
|
|
130
|
-
export var LOG_PREFIX_SYNC_MYSEGMENTS = LOG_PREFIX_SYNC + ':my-segments: ';
|
|
131
|
-
export var LOG_PREFIX_SYNC_POLLING = LOG_PREFIX_SYNC + ':polling-manager: ';
|
|
132
|
-
export var LOG_PREFIX_SYNC_SUBMITTERS = LOG_PREFIX_SYNC + ':submitter: ';
|
|
121
|
+
export var LOG_PREFIX_SYNC = 'sync: ';
|
|
122
|
+
export var LOG_PREFIX_SYNC_MANAGER = 'sync:sync-manager: ';
|
|
123
|
+
export var LOG_PREFIX_SYNC_OFFLINE = 'sync:offline: ';
|
|
124
|
+
export var LOG_PREFIX_SYNC_STREAMING = 'sync:streaming: ';
|
|
125
|
+
export var LOG_PREFIX_SYNC_POLLING = 'sync:polling-manager: ';
|
|
126
|
+
export var LOG_PREFIX_SYNC_SUBMITTERS = 'sync:submitter: ';
|
|
133
127
|
export var LOG_PREFIX_IMPRESSIONS_TRACKER = 'impressions-tracker: ';
|
|
134
128
|
export var LOG_PREFIX_EVENTS_TRACKER = 'events-tracker: ';
|
|
135
129
|
export var LOG_PREFIX_UNIQUE_KEYS_TRACKER = 'unique-keys-tracker: ';
|
package/esm/logger/index.js
CHANGED
|
@@ -86,7 +86,7 @@ var Logger = /** @class */ (function () {
|
|
|
86
86
|
Logger.prototype._log = function (method, msg, args) {
|
|
87
87
|
if (typeof msg === 'number') {
|
|
88
88
|
var format = this.codes.get(msg);
|
|
89
|
-
msg = format ? _sprintf(format, args) : "Message code "
|
|
89
|
+
msg = format ? _sprintf(format, args) : "Message code ".concat(msg).concat(args ? ', with args: ' + args.toString() : '');
|
|
90
90
|
}
|
|
91
91
|
else {
|
|
92
92
|
if (args)
|
|
@@ -20,13 +20,12 @@ export var codesDebug = codesInfo.concat([
|
|
|
20
20
|
[c.RETRIEVE_MANAGER, 'Retrieving manager instance.'],
|
|
21
21
|
// synchronizer
|
|
22
22
|
[c.SYNC_OFFLINE_DATA, c.LOG_PREFIX_SYNC_OFFLINE + 'Feature flags data: \n%s'],
|
|
23
|
-
[c.
|
|
24
|
-
[c.
|
|
25
|
-
[c.SYNC_RBS_UPDATE, c.LOG_PREFIX_SYNC_SPLITS + 'New rule-based segments: %s. Removed rule-based segments: %s.'],
|
|
23
|
+
[c.SYNC_FETCH, c.LOG_PREFIX_SYNC + 'Spin up %s updates using since = %s and rbSince = %s.'],
|
|
24
|
+
[c.SYNC_UPDATE, c.LOG_PREFIX_SYNC + 'New %s: %s. Removed: %s.'],
|
|
26
25
|
[c.STREAMING_NEW_MESSAGE, c.LOG_PREFIX_SYNC_STREAMING + 'New SSE message received, with data: %s.'],
|
|
27
|
-
[c.SYNC_TASK_START, c.LOG_PREFIX_SYNC + '
|
|
28
|
-
[c.SYNC_TASK_EXECUTE, c.LOG_PREFIX_SYNC + '
|
|
29
|
-
[c.SYNC_TASK_STOP, c.LOG_PREFIX_SYNC + '
|
|
26
|
+
[c.SYNC_TASK_START, c.LOG_PREFIX_SYNC + 'Starting %s. Running each %s millis'],
|
|
27
|
+
[c.SYNC_TASK_EXECUTE, c.LOG_PREFIX_SYNC + 'Running %s'],
|
|
28
|
+
[c.SYNC_TASK_STOP, c.LOG_PREFIX_SYNC + 'Stopping %s'],
|
|
30
29
|
// initialization / settings validation
|
|
31
30
|
[c.SETTINGS_SPLITS_FILTER, c.LOG_PREFIX_SETTINGS + ': feature flags filtering criteria is "%s".']
|
|
32
31
|
]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as c from '../constants';
|
|
2
2
|
export var codesError = [
|
|
3
3
|
// evaluator
|
|
4
|
-
[c.ERROR_ENGINE_COMBINER_IFELSEIF, c.LOG_PREFIX_ENGINE_COMBINER + 'Invalid
|
|
4
|
+
[c.ERROR_ENGINE_COMBINER_IFELSEIF, c.LOG_PREFIX_ENGINE_COMBINER + 'Invalid definition, no valid rules or unsupported targeting rule type found'],
|
|
5
5
|
[c.ENGINE_MATCHER_ERROR, c.LOG_PREFIX_ENGINE_MATCHER + '[%s] %s'],
|
|
6
6
|
// SDK
|
|
7
7
|
[c.ERROR_LOGLEVEL_INVALID, 'logger: Invalid Log Level - No changes to the logs will be applied.'],
|
|
@@ -12,7 +12,7 @@ export var codesError = [
|
|
|
12
12
|
// synchronizer
|
|
13
13
|
[c.ERROR_SYNC_OFFLINE_LOADING, c.LOG_PREFIX_SYNC_OFFLINE + 'There was an issue loading the mock feature flags data. No changes will be applied to the current cache. %s'],
|
|
14
14
|
[c.ERROR_STREAMING_SSE, c.LOG_PREFIX_SYNC_STREAMING + 'Failed to connect or error on streaming connection, with error message: %s'],
|
|
15
|
-
[c.ERROR_STREAMING_AUTH, c.LOG_PREFIX_SYNC_STREAMING + 'Failed to authenticate for streaming. Error: %s
|
|
15
|
+
[c.ERROR_STREAMING_AUTH, c.LOG_PREFIX_SYNC_STREAMING + 'Failed to authenticate for streaming. Error: %s'],
|
|
16
16
|
[c.ERROR_HTTP, 'HTTP request failed with %s. URL: %s. Message: %s'],
|
|
17
17
|
// client status
|
|
18
18
|
[c.ERROR_CLIENT_LISTENER, 'A listener was added for %s on the SDK, which has already fired and won\'t be emitted again. The callback won\'t be executed.'],
|
|
@@ -33,6 +33,6 @@ export var codesError = [
|
|
|
33
33
|
[c.ERROR_INVALID_CONFIG_PARAM, c.LOG_PREFIX_SETTINGS + ': you passed an invalid "%s" config param. It should be one of the following values: %s. Defaulting to "%s".'],
|
|
34
34
|
[c.ERROR_STORAGE_INVALID, c.LOG_PREFIX_SETTINGS + ': the provided storage is invalid.%s Falling back into default MEMORY storage'],
|
|
35
35
|
[c.ERROR_MIN_CONFIG_PARAM, c.LOG_PREFIX_SETTINGS + ': the provided "%s" config param is lower than allowed. Setting to the minimum value %s seconds'],
|
|
36
|
-
[c.ERROR_TOO_MANY_SETS, c.LOG_PREFIX_SETTINGS + ': the
|
|
36
|
+
[c.ERROR_TOO_MANY_SETS, c.LOG_PREFIX_SETTINGS + ': the number of sets provided is too high, which causes a URI length error.'],
|
|
37
37
|
[c.ERROR_SETS_FILTER_EXCLUSIVE, c.LOG_PREFIX_SETTINGS + ': the Set filter is exclusive and cannot be used simultaneously with names or prefix filters. Ignoring names and prefixes.'],
|
|
38
38
|
];
|
|
@@ -6,8 +6,7 @@ export var codesInfo = codesWarn.concat([
|
|
|
6
6
|
[c.CLIENT_READY_FROM_CACHE, READY_MSG + ' from cache'],
|
|
7
7
|
[c.CLIENT_READY, READY_MSG],
|
|
8
8
|
// SDK
|
|
9
|
-
[c.
|
|
10
|
-
[c.IMPRESSION_QUEUEING, c.LOG_PREFIX_IMPRESSIONS_TRACKER + 'Queueing corresponding impression.'],
|
|
9
|
+
[c.IMPRESSION_QUEUEING, c.LOG_PREFIX_IMPRESSIONS_TRACKER + 'Queueing impression. %s: %s. Key: %s. Evaluation: %s. Label: %s'],
|
|
11
10
|
[c.NEW_SHARED_CLIENT, 'New shared client instance created.'],
|
|
12
11
|
[c.NEW_FACTORY, 'New Split SDK instance created. %s'],
|
|
13
12
|
[c.EVENTS_TRACKER_SUCCESS, c.LOG_PREFIX_EVENTS_TRACKER + 'Successfully queued %s'],
|
|
@@ -19,7 +18,6 @@ export var codesInfo = codesWarn.concat([
|
|
|
19
18
|
[c.POLLING_SMART_PAUSING, c.LOG_PREFIX_SYNC_POLLING + 'Turning segments data polling %s.'],
|
|
20
19
|
[c.POLLING_START, c.LOG_PREFIX_SYNC_POLLING + 'Starting polling'],
|
|
21
20
|
[c.POLLING_STOP, c.LOG_PREFIX_SYNC_POLLING + 'Stopping polling'],
|
|
22
|
-
[c.SYNC_SPLITS_FETCH_RETRY, c.LOG_PREFIX_SYNC_SPLITS + 'Retrying fetch of feature flags (attempt #%s). Reason: %s'],
|
|
23
21
|
[c.SUBMITTERS_PUSH_FULL_QUEUE, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Flushing full %s queue and resetting timer.'],
|
|
24
22
|
[c.SUBMITTERS_PUSH, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Pushing %s.'],
|
|
25
23
|
[c.SUBMITTERS_PUSH_PAGE_HIDDEN, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Flushing %s because page became hidden.'],
|
|
@@ -5,24 +5,24 @@ export var codesWarn = codesError.concat([
|
|
|
5
5
|
[c.ENGINE_VALUE_INVALID, c.LOG_PREFIX_ENGINE_VALUE + 'Value %s doesn\'t match with expected type.'],
|
|
6
6
|
[c.ENGINE_VALUE_NO_ATTRIBUTES, c.LOG_PREFIX_ENGINE_VALUE + 'Defined attribute `%s`. No attributes received.'],
|
|
7
7
|
// synchronizer
|
|
8
|
-
[c.
|
|
9
|
-
[c.
|
|
8
|
+
[c.SYNC_FETCH_RETRY, c.LOG_PREFIX_SYNC + 'Retrying fetch of %s (attempt #%s). Reason: %s'],
|
|
9
|
+
[c.SYNC_FETCH_FAILS, c.LOG_PREFIX_SYNC + 'Error while doing fetch of %s. %s'],
|
|
10
10
|
[c.STREAMING_PARSING_ERROR_FAILS, c.LOG_PREFIX_SYNC_STREAMING + 'Error parsing SSE error notification: %s'],
|
|
11
11
|
[c.STREAMING_PARSING_MESSAGE_FAILS, c.LOG_PREFIX_SYNC_STREAMING + 'Error parsing SSE message notification: %s'],
|
|
12
12
|
[c.STREAMING_FALLBACK, c.LOG_PREFIX_SYNC_STREAMING + 'Falling back to polling mode. Reason: %s'],
|
|
13
|
-
[c.SUBMITTERS_PUSH_FAILS, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Dropping %s after retry. Reason: %s
|
|
14
|
-
[c.SUBMITTERS_PUSH_RETRY, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Failed to push %s, keeping data to retry on next iteration. Reason: %s
|
|
13
|
+
[c.SUBMITTERS_PUSH_FAILS, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Dropping %s after retry. Reason: %s'],
|
|
14
|
+
[c.SUBMITTERS_PUSH_RETRY, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Failed to push %s, keeping data to retry on next iteration. Reason: %s'],
|
|
15
15
|
// client status
|
|
16
|
-
[c.CLIENT_NOT_READY_FROM_CACHE, '%s: the SDK is not ready to evaluate. Results may be incorrect
|
|
16
|
+
[c.CLIENT_NOT_READY_FROM_CACHE, '%s: the SDK is not ready to evaluate. Results may be incorrect. Make sure to wait for SDK readiness before using this method.'],
|
|
17
17
|
[c.CLIENT_NO_LISTENER, 'No listeners for SDK_READY event detected. Incorrect control treatments could have been logged if you called getTreatment/s while the SDK was not yet synchronized with the backend.'],
|
|
18
18
|
// input validation
|
|
19
19
|
[c.WARN_SETTING_NULL, '%s: Property "%s" is of invalid type. Setting value to null.'],
|
|
20
20
|
[c.WARN_TRIMMING_PROPERTIES, '%s: more than 300 properties were provided. Some of them will be trimmed when processed.'],
|
|
21
21
|
[c.WARN_CONVERTING, '%s: %s "%s" is not of type string, converting.'],
|
|
22
22
|
[c.WARN_TRIMMING, '%s: %s "%s" has extra whitespace, trimming.'],
|
|
23
|
-
[c.
|
|
23
|
+
[c.WARN_NOT_EXISTENT_DEFINITION, '%s: "%s" does not exist in this environment. Please double check that it exists in Harness UI.'],
|
|
24
24
|
[c.WARN_LOWERCASE_TRAFFIC_TYPE, '%s: traffic_type_name should be all lowercase - converting string to lowercase.'],
|
|
25
|
-
[c.WARN_NOT_EXISTENT_TT, '%s: traffic type "%s" does not have any corresponding feature flag in this environment, make sure you\'re tracking your events to a valid traffic type defined in
|
|
25
|
+
[c.WARN_NOT_EXISTENT_TT, '%s: traffic type "%s" does not have any corresponding feature flag in this environment, make sure you\'re tracking your events to a valid traffic type defined in Harness UI.'],
|
|
26
26
|
[c.WARN_FLAGSET_NOT_CONFIGURED, '%s: you passed %s which is not part of the configured FlagSetsFilter, ignoring Flag Set.'],
|
|
27
27
|
// initialization / settings validation
|
|
28
28
|
[c.WARN_INTEGRATION_INVALID, c.LOG_PREFIX_SETTINGS + ': %s integration item(s) at settings is invalid. %s'],
|
|
@@ -34,5 +34,5 @@ export var codesWarn = codesError.concat([
|
|
|
34
34
|
[c.STREAMING_PARSING_SPLIT_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching SplitChanges due to an error processing %s notification: %s'],
|
|
35
35
|
[c.WARN_INVALID_FLAGSET, '%s: you passed %s, flag set must adhere to the regular expressions %s. This means a flag set must start with a letter or number, be in lowercase, alphanumeric and have a max length of 50 characters. %s was discarded.'],
|
|
36
36
|
[c.WARN_LOWERCASE_FLAGSET, '%s: flag set %s should be all lowercase - converting string to lowercase.'],
|
|
37
|
-
[c.WARN_FLAGSET_WITHOUT_FLAGS, '%s: you passed %s flag set that does not contain cached feature flag names. Please double check what flag sets are in use in
|
|
37
|
+
[c.WARN_FLAGSET_WITHOUT_FLAGS, '%s: you passed %s flag set that does not contain cached feature flag names. Please double check what flag sets are in use in Harness UI.'],
|
|
38
38
|
]);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EventEmitter } from '../utils/EventEmitter';
|
|
2
|
+
import { getFetch } from '../platform/getFetch/browser';
|
|
3
|
+
import { getEventSource } from '../platform/getEventSource/browser';
|
|
4
|
+
import { BrowserSignalListener } from '../listeners/browser';
|
|
5
|
+
import { now } from '../utils/timeTracker/now/browser';
|
|
6
|
+
export var platform = {
|
|
7
|
+
getFetch: getFetch,
|
|
8
|
+
getEventSource: getEventSource,
|
|
9
|
+
EventEmitter: EventEmitter,
|
|
10
|
+
now: now,
|
|
11
|
+
SignalListener: BrowserSignalListener
|
|
12
|
+
};
|