@splitsoftware/splitio-commons 3.1.1-rc.1 → 3.1.1-rc.10
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 +10 -1
- package/cjs/evaluator/condition/index.js +2 -2
- package/cjs/evaluator/fallbackTreatmentsCalculator/fallbackSanitizer/index.js +8 -5
- package/cjs/evaluator/index.js +71 -76
- package/cjs/listeners/browser.js +1 -2
- package/cjs/listeners/node.js +4 -4
- package/cjs/logger/constants.js +20 -15
- package/cjs/logger/messages/debug.js +6 -5
- package/cjs/logger/messages/error.js +3 -3
- package/cjs/logger/messages/info.js +4 -3
- package/cjs/logger/messages/warn.js +7 -6
- package/cjs/presets/serverSide.js +2 -2
- package/cjs/readiness/constants.js +4 -5
- package/cjs/readiness/readinessManager.js +23 -23
- package/cjs/readiness/sdkReadinessManager.js +17 -1
- package/cjs/sdkClient/client.js +51 -27
- package/cjs/sdkClient/clientInputValidation.js +17 -6
- package/cjs/sdkClient/sdkClient.js +60 -3
- package/cjs/sdkFactory/index.js +15 -11
- package/cjs/sdkManager/index.js +5 -5
- package/cjs/services/decorateHeaders.js +1 -2
- package/cjs/services/splitApi.js +1 -14
- package/cjs/services/splitHttpClient.js +5 -3
- package/cjs/storages/AbstractSplitsCacheAsync.js +51 -0
- package/cjs/storages/AbstractSplitsCacheSync.js +76 -0
- package/cjs/storages/KeyBuilder.js +6 -6
- package/cjs/storages/KeyBuilderCS.js +5 -5
- package/cjs/storages/KeyBuilderSS.js +2 -2
- package/cjs/storages/getRolloutPlan.js +3 -3
- package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +2 -1
- package/cjs/storages/inLocalStorage/RBSegmentsCacheInLocal.js +10 -10
- package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +194 -0
- package/cjs/storages/inLocalStorage/index.js +6 -6
- package/cjs/storages/inLocalStorage/validateCache.js +3 -3
- package/cjs/storages/inMemory/InMemoryStorage.js +4 -4
- package/cjs/storages/inMemory/InMemoryStorageCS.js +5 -5
- package/cjs/storages/inMemory/RBSegmentsCacheInMemory.js +5 -5
- package/cjs/storages/inMemory/SegmentsCacheInMemory.js +1 -1
- package/cjs/storages/inMemory/SplitsCacheInMemory.js +121 -0
- package/cjs/storages/inMemory/TelemetryCacheInMemory.js +5 -5
- package/cjs/storages/inRedis/RBSegmentsCacheInRedis.js +1 -1
- package/cjs/storages/inRedis/RedisAdapter.js +8 -5
- package/cjs/storages/inRedis/{DefinitionsCacheInRedis.js → SplitsCacheInRedis.js} +77 -77
- package/cjs/storages/inRedis/index.js +2 -2
- package/cjs/storages/pluggable/RBSegmentsCachePluggable.js +1 -1
- package/cjs/storages/pluggable/SplitsCachePluggable.js +212 -0
- package/cjs/storages/pluggable/index.js +2 -2
- package/cjs/storages/setRolloutPlan.js +4 -4
- package/cjs/storages/utils.js +0 -1
- package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +5 -5
- package/cjs/sync/polling/fetchers/splitChangesFetcher.js +15 -24
- package/cjs/sync/polling/pollingManagerCS.js +20 -20
- package/cjs/sync/polling/pollingManagerSS.js +15 -15
- package/cjs/sync/polling/syncTasks/segmentsSyncTask.js +3 -2
- package/cjs/sync/polling/syncTasks/splitsSyncTask.js +13 -0
- package/cjs/sync/polling/updaters/mySegmentsUpdater.js +3 -3
- package/cjs/sync/polling/updaters/segmentChangesUpdater.js +6 -6
- package/cjs/sync/polling/updaters/{definitionChangesUpdater.js → splitChangesUpdater.js} +68 -65
- package/cjs/sync/streaming/AuthClient/index.js +1 -1
- package/cjs/sync/streaming/SSEHandler/NotificationKeeper.js +1 -1
- package/cjs/sync/streaming/SSEHandler/index.js +1 -1
- package/cjs/sync/streaming/UpdateWorkers/{DefinitionsUpdateWorker.js → SplitsUpdateWorker.js} +19 -16
- package/cjs/sync/streaming/constants.js +3 -3
- package/cjs/sync/streaming/parseUtils.js +11 -11
- package/cjs/sync/streaming/pushManager.js +16 -16
- package/cjs/sync/submitters/eventsSubmitter.js +1 -1
- package/cjs/sync/submitters/impressionCountsSubmitter.js +1 -1
- package/cjs/sync/submitters/impressionsSubmitter.js +4 -5
- package/cjs/sync/submitters/telemetrySubmitter.js +4 -3
- package/cjs/sync/submitters/uniqueKeysSubmitter.js +1 -1
- package/cjs/sync/syncManagerOnline.js +7 -12
- package/cjs/utils/Backoff.js +0 -20
- package/cjs/utils/inputValidation/index.js +7 -7
- package/cjs/utils/inputValidation/isOperational.js +4 -4
- package/cjs/utils/inputValidation/{definition.js → split.js} +10 -10
- package/cjs/utils/inputValidation/{definitionExistence.js → splitExistence.js} +6 -6
- package/cjs/utils/inputValidation/splits.js +25 -0
- package/cjs/utils/labels/index.js +3 -3
- package/cjs/utils/settingsValidation/index.js +0 -2
- package/cjs/utils/settingsValidation/splitFilters.js +3 -3
- package/cjs/utils/settingsValidation/url.js +2 -6
- package/esm/evaluator/condition/index.js +2 -2
- package/esm/evaluator/fallbackTreatmentsCalculator/fallbackSanitizer/index.js +8 -5
- package/esm/evaluator/index.js +71 -75
- package/esm/listeners/browser.js +1 -2
- package/esm/listeners/node.js +4 -4
- package/esm/logger/constants.js +17 -12
- package/esm/logger/messages/debug.js +6 -5
- package/esm/logger/messages/error.js +3 -3
- package/esm/logger/messages/info.js +4 -3
- package/esm/logger/messages/warn.js +7 -6
- package/esm/presets/serverSide.js +2 -2
- package/esm/readiness/constants.js +3 -4
- package/esm/readiness/readinessManager.js +24 -24
- package/esm/readiness/sdkReadinessManager.js +18 -2
- package/esm/sdkClient/client.js +51 -26
- package/esm/sdkClient/clientInputValidation.js +19 -8
- package/esm/sdkClient/sdkClient.js +60 -3
- package/esm/sdkFactory/index.js +16 -12
- package/esm/sdkManager/index.js +6 -6
- package/esm/services/decorateHeaders.js +1 -2
- package/esm/services/splitApi.js +1 -14
- package/esm/services/splitHttpClient.js +5 -3
- package/esm/storages/AbstractSplitsCacheAsync.js +48 -0
- package/esm/storages/AbstractSplitsCacheSync.js +71 -0
- package/esm/storages/KeyBuilder.js +6 -6
- package/esm/storages/KeyBuilderCS.js +5 -5
- package/esm/storages/KeyBuilderSS.js +2 -2
- package/esm/storages/getRolloutPlan.js +3 -3
- package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +2 -1
- package/esm/storages/inLocalStorage/RBSegmentsCacheInLocal.js +7 -7
- package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +191 -0
- package/esm/storages/inLocalStorage/index.js +6 -6
- package/esm/storages/inLocalStorage/validateCache.js +3 -3
- package/esm/storages/inMemory/InMemoryStorage.js +4 -4
- package/esm/storages/inMemory/InMemoryStorageCS.js +5 -5
- package/esm/storages/inMemory/RBSegmentsCacheInMemory.js +2 -2
- package/esm/storages/inMemory/SegmentsCacheInMemory.js +1 -1
- package/esm/storages/inMemory/SplitsCacheInMemory.js +118 -0
- package/esm/storages/inMemory/TelemetryCacheInMemory.js +5 -5
- package/esm/storages/inRedis/RBSegmentsCacheInRedis.js +1 -1
- package/esm/storages/inRedis/RedisAdapter.js +8 -5
- package/esm/storages/inRedis/{DefinitionsCacheInRedis.js → SplitsCacheInRedis.js} +76 -76
- package/esm/storages/inRedis/index.js +2 -2
- package/esm/storages/pluggable/RBSegmentsCachePluggable.js +1 -1
- package/esm/storages/pluggable/SplitsCachePluggable.js +209 -0
- package/esm/storages/pluggable/index.js +2 -2
- package/esm/storages/setRolloutPlan.js +4 -4
- package/esm/storages/utils.js +0 -1
- package/esm/sync/offline/syncTasks/fromObjectSyncTask.js +6 -6
- package/esm/sync/polling/fetchers/splitChangesFetcher.js +16 -25
- package/esm/sync/polling/pollingManagerCS.js +17 -17
- package/esm/sync/polling/pollingManagerSS.js +15 -15
- package/esm/sync/polling/syncTasks/segmentsSyncTask.js +3 -2
- package/esm/sync/polling/syncTasks/splitsSyncTask.js +9 -0
- package/esm/sync/polling/updaters/mySegmentsUpdater.js +3 -3
- package/esm/sync/polling/updaters/segmentChangesUpdater.js +7 -7
- package/esm/sync/polling/updaters/{definitionChangesUpdater.js → splitChangesUpdater.js} +68 -65
- package/esm/sync/streaming/AuthClient/index.js +1 -1
- package/esm/sync/streaming/SSEHandler/NotificationKeeper.js +2 -2
- package/esm/sync/streaming/SSEHandler/index.js +2 -2
- package/esm/sync/streaming/UpdateWorkers/{DefinitionsUpdateWorker.js → SplitsUpdateWorker.js} +18 -15
- package/esm/sync/streaming/constants.js +2 -2
- package/esm/sync/streaming/parseUtils.js +9 -9
- package/esm/sync/streaming/pushManager.js +18 -18
- package/esm/sync/submitters/eventsSubmitter.js +1 -1
- package/esm/sync/submitters/impressionCountsSubmitter.js +1 -1
- package/esm/sync/submitters/impressionsSubmitter.js +4 -5
- package/esm/sync/submitters/telemetrySubmitter.js +4 -3
- package/esm/sync/submitters/uniqueKeysSubmitter.js +1 -1
- package/esm/sync/syncManagerOnline.js +6 -11
- package/esm/utils/Backoff.js +0 -20
- package/esm/utils/inputValidation/index.js +3 -3
- package/esm/utils/inputValidation/isOperational.js +4 -4
- package/esm/utils/inputValidation/{definition.js → split.js} +8 -8
- package/esm/utils/inputValidation/splitExistence.js +15 -0
- package/esm/utils/inputValidation/splits.js +21 -0
- package/esm/utils/labels/index.js +2 -2
- package/esm/utils/settingsValidation/index.js +0 -2
- package/esm/utils/settingsValidation/splitFilters.js +3 -3
- package/esm/utils/settingsValidation/url.js +2 -6
- package/package.json +6 -7
- package/src/dtos/types.ts +1 -1
- package/src/evaluator/index.ts +11 -5
- package/src/evaluator/types.ts +1 -0
- package/src/presets/serverSide.ts +3 -3
- package/src/sdkClient/client.ts +3 -4
- package/src/sdkClient/sdkLifecycle.ts +3 -0
- package/src/services/authProvider.ts +41 -19
- package/src/services/secureSplitHttpClient.ts +10 -18
- package/src/services/serviceApi.ts +27 -24
- package/src/services/splitApi.ts +10 -9
- package/src/services/types.ts +5 -4
- package/src/storages/inRedis/RedisAdapter.ts +8 -5
- package/src/sync/polling/pollingManagerCS.ts +80 -78
- package/src/sync/polling/pollingManagerSS.ts +49 -45
- package/src/sync/polling/updaters/definitionChangesUpdater.ts +3 -3
- package/src/sync/polling/updaters/segmentChangesUpdater.ts +1 -1
- package/src/sync/streaming/AuthClient/index.ts +14 -15
- package/src/sync/streaming/AuthClient/types.ts +9 -13
- package/src/sync/streaming/SSEClient/index.ts +2 -2
- package/src/sync/streaming/SSEClient/types.ts +2 -2
- package/src/sync/streaming/SSEHandler/index.ts +2 -1
- package/src/sync/streaming/SSEHandler/types.ts +2 -2
- package/src/sync/streaming/constants.ts +1 -0
- package/src/sync/streaming/pushManager.ts +32 -42
- package/src/sync/streaming/types.ts +3 -2
- package/src/sync/submitters/impressionsSubmitter.ts +3 -3
- package/src/sync/submitters/types.ts +2 -2
- package/src/sync/syncManagerOnline.ts +2 -8
- package/src/utils/Backoff.ts +16 -4
- package/types/splitio.d.ts +5 -4
- package/cjs/platform/browser.js +0 -15
- package/cjs/platform/getEventSource/browser.js +0 -8
- package/cjs/platform/getEventSource/eventsource.js +0 -480
- package/cjs/platform/getEventSource/node.js +0 -26
- package/cjs/platform/getFetch/browser.js +0 -9
- package/cjs/platform/getFetch/node.js +0 -27
- package/cjs/platform/getOptions/node.js +0 -25
- package/cjs/platform/node.js +0 -17
- package/cjs/sdkClient/sdkLifecycle.js +0 -72
- package/cjs/sdkClient/trackMethod.js +0 -56
- package/cjs/services/authProvider.js +0 -67
- package/cjs/services/secureSplitHttpClient.js +0 -39
- package/cjs/services/serviceApi.js +0 -145
- package/cjs/storages/AbstractDefinitionsCacheAsync.js +0 -51
- package/cjs/storages/AbstractDefinitionsCacheSync.js +0 -76
- package/cjs/storages/inLocalStorage/DefinitionsCacheInLocal.js +0 -194
- package/cjs/storages/inMemory/DefinitionsCacheInMemory.js +0 -121
- package/cjs/storages/pluggable/DefinitionsCachePluggable.js +0 -212
- package/cjs/sync/polling/syncTasks/definitionsSyncTask.js +0 -13
- package/cjs/utils/EventEmitter.js +0 -391
- package/cjs/utils/filter/bloomFilter.js +0 -37
- package/cjs/utils/inputValidation/definitions.js +0 -25
- package/cjs/utils/inputValidation/target.js +0 -22
- package/esm/platform/browser.js +0 -12
- package/esm/platform/getEventSource/browser.js +0 -4
- package/esm/platform/getEventSource/eventsource.js +0 -480
- package/esm/platform/getEventSource/node.js +0 -20
- package/esm/platform/getFetch/browser.js +0 -5
- package/esm/platform/getFetch/node.js +0 -22
- package/esm/platform/getOptions/node.js +0 -20
- package/esm/platform/node.js +0 -14
- package/esm/sdkClient/sdkLifecycle.js +0 -68
- package/esm/sdkClient/trackMethod.js +0 -52
- package/esm/services/authProvider.js +0 -63
- package/esm/services/secureSplitHttpClient.js +0 -35
- package/esm/services/serviceApi.js +0 -141
- package/esm/storages/AbstractDefinitionsCacheAsync.js +0 -48
- package/esm/storages/AbstractDefinitionsCacheSync.js +0 -71
- package/esm/storages/inLocalStorage/DefinitionsCacheInLocal.js +0 -191
- package/esm/storages/inMemory/DefinitionsCacheInMemory.js +0 -118
- package/esm/storages/pluggable/DefinitionsCachePluggable.js +0 -209
- package/esm/sync/polling/syncTasks/definitionsSyncTask.js +0 -9
- package/esm/utils/EventEmitter.js +0 -387
- package/esm/utils/filter/bloomFilter.js +0 -33
- package/esm/utils/inputValidation/definitionExistence.js +0 -15
- package/esm/utils/inputValidation/definitions.js +0 -21
- package/esm/utils/inputValidation/target.js +0 -18
package/CHANGES.txt
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
3.2.0 (
|
|
1
|
+
3.2.0 (XXX XX, 2026)
|
|
2
2
|
- Added support for AI configs.
|
|
3
|
+
- Added support for ioredis v6 (Related to issue https://github.com/splitio/javascript-client/issues/951). Note that ioredis v6 requires Node.js 20 or above; stay on ioredis v4 or v5 for older Node.js versions.
|
|
4
|
+
- Removed the `@types/ioredis` dependency, which is no longer required since the public type definitions don't depend on ioredis types. The `@types/node` dependency, previously installed transitively by `@types/ioredis`, is now declared explicitly, since the public type definitions use Node.js types for the `agent` and `tls` options.
|
|
3
5
|
- Removed Configs SDK-related types and modules and moved them to the Configs SDK repository.
|
|
4
6
|
|
|
5
7
|
3.1.0 (July 23, 2026)
|
|
@@ -20,6 +22,13 @@
|
|
|
20
22
|
- Removed the misleading warning log 'No listeners for SDK_READY event detected', since users can use the `whenReady` method to wait for the SDK to be ready.
|
|
21
23
|
- BREAKING CHANGES: Renamed some types and modules, and updated the signatures of others for clarity and reusability.
|
|
22
24
|
|
|
25
|
+
2.13.0 (September 24, 2026)
|
|
26
|
+
- Added support for ioredis v6 (Related to issue https://github.com/splitio/javascript-client/issues/951). Note that ioredis v6 requires Node.js 20 or above; stay on ioredis v4 or v5 for older Node.js versions.
|
|
27
|
+
- Removed the `@types/ioredis` dependency, which is no longer required since the public type definitions don't depend on ioredis types. The `@types/node` dependency, previously installed transitively by `@types/ioredis`, is now declared explicitly, since the public type definitions use Node.js types for the `agent` and `tls` options.
|
|
28
|
+
|
|
29
|
+
2.12.2 (September 23, 2026)
|
|
30
|
+
- Updated some transitive dependencies for vulnerability fixes.
|
|
31
|
+
|
|
23
32
|
2.12.1 (June 25, 2026)
|
|
24
33
|
- Updated internal modules to handle `null` values from `/splitChanges` response.
|
|
25
34
|
- Updated some dependencies for vulnerability fixes.
|
|
@@ -10,7 +10,7 @@ function match(log, matchingResult, bucketingKey, seed, treatments, label) {
|
|
|
10
10
|
return treatments ? // Feature flag
|
|
11
11
|
{
|
|
12
12
|
treatment: (0, engineUtils_1.getTreatment)(log, bucketingKey, seed, treatments),
|
|
13
|
-
label: label
|
|
13
|
+
label: label
|
|
14
14
|
} : // Rule-based segment
|
|
15
15
|
true;
|
|
16
16
|
}
|
|
@@ -23,7 +23,7 @@ function conditionContext(log, matcherEvaluator, treatments, label, conditionTyp
|
|
|
23
23
|
// Whitelisting has more priority than traffic allocation, so we don't apply this filtering to those conditions.
|
|
24
24
|
if (conditionType === 'ROLLOUT' && !(0, engineUtils_1.shouldApplyRollout)(trafficAllocation, key.bucketingKey, trafficAllocationSeed)) {
|
|
25
25
|
return {
|
|
26
|
-
|
|
26
|
+
treatment: undefined,
|
|
27
27
|
label: labels_1.NOT_IN_SPLIT
|
|
28
28
|
};
|
|
29
29
|
}
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sanitizeFallbacks = exports.isValidTreatment = exports.isValidFlagName = void 0;
|
|
4
4
|
var lang_1 = require("../../../utils/lang");
|
|
5
|
-
var
|
|
6
|
-
|
|
5
|
+
var FallbackDiscardReason;
|
|
6
|
+
(function (FallbackDiscardReason) {
|
|
7
|
+
FallbackDiscardReason["FlagName"] = "Invalid flag name (max 100 chars, no spaces)";
|
|
8
|
+
FallbackDiscardReason["Treatment"] = "Invalid treatment (max 100 chars and must match pattern)";
|
|
9
|
+
})(FallbackDiscardReason || (FallbackDiscardReason = {}));
|
|
7
10
|
var TREATMENT_PATTERN = /^[0-9]+[.a-zA-Z0-9_-]*$|^[a-zA-Z]+[a-zA-Z0-9_-]*$/;
|
|
8
11
|
function isValidFlagName(name) {
|
|
9
12
|
return name.length <= 100 && !name.includes(' ');
|
|
@@ -21,7 +24,7 @@ function sanitizeGlobal(logger, treatment) {
|
|
|
21
24
|
if (treatment === undefined)
|
|
22
25
|
return undefined;
|
|
23
26
|
if (!isValidTreatment(treatment)) {
|
|
24
|
-
logger.error("Fallback treatments - Discarded fallback: ".concat(
|
|
27
|
+
logger.error("Fallback treatments - Discarded fallback: ".concat(FallbackDiscardReason.Treatment));
|
|
25
28
|
return undefined;
|
|
26
29
|
}
|
|
27
30
|
return treatment;
|
|
@@ -33,11 +36,11 @@ function sanitizeByFlag(logger, byFlagFallbacks) {
|
|
|
33
36
|
Object.keys(byFlagFallbacks).forEach(function (flag) {
|
|
34
37
|
var t = byFlagFallbacks[flag];
|
|
35
38
|
if (!isValidFlagName(flag)) {
|
|
36
|
-
logger.error("Fallback treatments - Discarded flag '".concat(flag, "': ").concat(
|
|
39
|
+
logger.error("Fallback treatments - Discarded flag '".concat(flag, "': ").concat(FallbackDiscardReason.FlagName));
|
|
37
40
|
return;
|
|
38
41
|
}
|
|
39
42
|
if (!isValidTreatment(t)) {
|
|
40
|
-
logger.error("Fallback treatments - Discarded treatment for flag '".concat(flag, "': ").concat(
|
|
43
|
+
logger.error("Fallback treatments - Discarded treatment for flag '".concat(flag, "': ").concat(FallbackDiscardReason.Treatment));
|
|
41
44
|
return;
|
|
42
45
|
}
|
|
43
46
|
sanitizedByFlag[flag] = t;
|
package/cjs/evaluator/index.js
CHANGED
|
@@ -1,67 +1,62 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.evaluateFeaturesByFlagSets = exports.evaluateFeatures = exports.evaluateFeature = void 0;
|
|
4
4
|
var Engine_1 = require("./Engine");
|
|
5
5
|
var thenable_1 = require("../utils/promise/thenable");
|
|
6
6
|
var labels_1 = require("../utils/labels");
|
|
7
7
|
var constants_1 = require("../utils/constants");
|
|
8
8
|
var sets_1 = require("../utils/lang/sets");
|
|
9
9
|
var constants_2 = require("../logger/constants");
|
|
10
|
-
var
|
|
11
|
-
var EVALUATION_EXCEPTION = {
|
|
10
|
+
var treatmentException = {
|
|
12
11
|
treatment: constants_1.CONTROL,
|
|
13
12
|
label: labels_1.EXCEPTION,
|
|
14
13
|
config: null
|
|
15
14
|
};
|
|
16
|
-
|
|
17
|
-
treatment: constants_1.CONTROL,
|
|
18
|
-
label: labels_1.DEFINITION_NOT_FOUND,
|
|
19
|
-
config: null
|
|
20
|
-
};
|
|
21
|
-
function treatmentsException(definitionNames) {
|
|
15
|
+
function treatmentsException(splitNames) {
|
|
22
16
|
var evaluations = {};
|
|
23
|
-
|
|
24
|
-
evaluations[
|
|
17
|
+
splitNames.forEach(function (splitName) {
|
|
18
|
+
evaluations[splitName] = treatmentException;
|
|
25
19
|
});
|
|
26
20
|
return evaluations;
|
|
27
21
|
}
|
|
28
|
-
function evaluateFeature(log, key,
|
|
29
|
-
var
|
|
22
|
+
function evaluateFeature(log, key, splitName, attributes, storage, options) {
|
|
23
|
+
var parsedSplit;
|
|
30
24
|
try {
|
|
31
|
-
|
|
25
|
+
parsedSplit = storage.splits.getSplit(splitName);
|
|
32
26
|
}
|
|
33
27
|
catch (e) {
|
|
34
|
-
// Exception on sync storage. Not possible ATM with InMemory and InLocal storages.
|
|
35
|
-
return
|
|
28
|
+
// Exception on sync `getSplit` storage. Not possible ATM with InMemory and InLocal storages.
|
|
29
|
+
return treatmentException;
|
|
36
30
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
// Exception on async storage. For example, when the storage is redis or
|
|
31
|
+
if ((0, thenable_1.thenable)(parsedSplit)) {
|
|
32
|
+
return parsedSplit.then(function (split) { return getEvaluation(log, key, split, attributes, storage, options); }).catch(
|
|
33
|
+
// Exception on async `getSplit` storage. For example, when the storage is redis or
|
|
41
34
|
// pluggable and there is a connection issue and we can't retrieve the split to be evaluated
|
|
42
|
-
function () { return
|
|
43
|
-
|
|
35
|
+
function () { return treatmentException; });
|
|
36
|
+
}
|
|
37
|
+
return getEvaluation(log, key, parsedSplit, attributes, storage, options);
|
|
44
38
|
}
|
|
45
39
|
exports.evaluateFeature = evaluateFeature;
|
|
46
|
-
function evaluateFeatures(log, key,
|
|
47
|
-
var
|
|
40
|
+
function evaluateFeatures(log, key, splitNames, attributes, storage, options) {
|
|
41
|
+
var parsedSplits;
|
|
48
42
|
try {
|
|
49
|
-
|
|
43
|
+
parsedSplits = storage.splits.getSplits(splitNames);
|
|
50
44
|
}
|
|
51
45
|
catch (e) {
|
|
52
|
-
// Exception on sync storage. Not possible ATM with InMemory and InLocal storages.
|
|
53
|
-
return treatmentsException(
|
|
46
|
+
// Exception on sync `getSplits` storage. Not possible ATM with InMemory and InLocal storages.
|
|
47
|
+
return treatmentsException(splitNames);
|
|
54
48
|
}
|
|
55
|
-
return (0, thenable_1.thenable)(
|
|
56
|
-
|
|
57
|
-
.catch(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
49
|
+
return (0, thenable_1.thenable)(parsedSplits) ?
|
|
50
|
+
parsedSplits.then(function (splits) { return getEvaluations(log, key, splitNames, splits, attributes, storage, options); })
|
|
51
|
+
.catch(function () {
|
|
52
|
+
// Exception on async `getSplits` storage. For example, when the storage is redis or
|
|
53
|
+
// pluggable and there is a connection issue and we can't retrieve the split to be evaluated
|
|
54
|
+
return treatmentsException(splitNames);
|
|
55
|
+
}) :
|
|
56
|
+
getEvaluations(log, key, splitNames, parsedSplits, attributes, storage, options);
|
|
62
57
|
}
|
|
63
58
|
exports.evaluateFeatures = evaluateFeatures;
|
|
64
|
-
function evaluateFeaturesByFlagSets(log, key, flagSets, attributes, storage, method) {
|
|
59
|
+
function evaluateFeaturesByFlagSets(log, key, flagSets, attributes, storage, method, options) {
|
|
65
60
|
var storedFlagNames;
|
|
66
61
|
function evaluate(featureFlagsByFlagSets) {
|
|
67
62
|
var featureFlags = new Set();
|
|
@@ -75,12 +70,12 @@ function evaluateFeaturesByFlagSets(log, key, flagSets, attributes, storage, met
|
|
|
75
70
|
}
|
|
76
71
|
}
|
|
77
72
|
return featureFlags.size ?
|
|
78
|
-
evaluateFeatures(log, key, (0, sets_1.setToArray)(featureFlags), attributes, storage) :
|
|
73
|
+
evaluateFeatures(log, key, (0, sets_1.setToArray)(featureFlags), attributes, storage, options) :
|
|
79
74
|
{};
|
|
80
75
|
}
|
|
81
76
|
// get features by flag sets
|
|
82
77
|
try {
|
|
83
|
-
storedFlagNames = storage.
|
|
78
|
+
storedFlagNames = storage.splits.getNamesByFlagSets(flagSets);
|
|
84
79
|
}
|
|
85
80
|
catch (e) {
|
|
86
81
|
// return empty evaluations
|
|
@@ -89,53 +84,53 @@ function evaluateFeaturesByFlagSets(log, key, flagSets, attributes, storage, met
|
|
|
89
84
|
// evaluate related features
|
|
90
85
|
return (0, thenable_1.thenable)(storedFlagNames) ?
|
|
91
86
|
storedFlagNames.then(function (storedFlagNames) { return evaluate(storedFlagNames); })
|
|
92
|
-
.catch(function () {
|
|
87
|
+
.catch(function () {
|
|
88
|
+
return {};
|
|
89
|
+
}) :
|
|
93
90
|
evaluate(storedFlagNames);
|
|
94
91
|
}
|
|
95
92
|
exports.evaluateFeaturesByFlagSets = evaluateFeaturesByFlagSets;
|
|
96
|
-
function getEvaluation(log, key,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
93
|
+
function getEvaluation(log, key, splitJSON, attributes, storage, options) {
|
|
94
|
+
var evaluation = {
|
|
95
|
+
treatment: constants_1.CONTROL,
|
|
96
|
+
label: labels_1.SPLIT_NOT_FOUND,
|
|
97
|
+
config: null
|
|
98
|
+
};
|
|
99
|
+
if (splitJSON) {
|
|
100
|
+
var split = (0, Engine_1.engineParser)(log, splitJSON, storage);
|
|
101
|
+
evaluation = split.getTreatment(key, attributes, evaluateFeature);
|
|
102
|
+
// If the storage is async and the evaluated flag uses segments or dependencies, evaluation is thenable
|
|
103
|
+
if ((0, thenable_1.thenable)(evaluation)) {
|
|
104
|
+
return evaluation.then(function (result) {
|
|
105
|
+
result.changeNumber = splitJSON.changeNumber;
|
|
106
|
+
result.config = splitJSON.configurations && splitJSON.configurations[result.treatment] || null;
|
|
107
|
+
// @ts-expect-error impressionsDisabled is not exposed in the public typings yet.
|
|
108
|
+
result.impressionsDisabled = (options === null || options === void 0 ? void 0 : options.impressionsDisabled) || splitJSON.impressionsDisabled;
|
|
109
|
+
return result;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
evaluation.changeNumber = splitJSON.changeNumber;
|
|
114
|
+
evaluation.config = splitJSON.configurations && splitJSON.configurations[evaluation.treatment] || null;
|
|
115
|
+
// @ts-expect-error impressionsDisabled is not exposed in the public typings yet.
|
|
116
|
+
evaluation.impressionsDisabled = (options === null || options === void 0 ? void 0 : options.impressionsDisabled) || splitJSON.impressionsDisabled;
|
|
117
|
+
}
|
|
103
118
|
}
|
|
104
|
-
return
|
|
119
|
+
return evaluation;
|
|
105
120
|
}
|
|
106
|
-
function getEvaluations(log, key,
|
|
121
|
+
function getEvaluations(log, key, splitNames, splits, attributes, storage, options) {
|
|
107
122
|
var result = {};
|
|
108
123
|
var thenables = [];
|
|
109
|
-
|
|
110
|
-
var evaluation = getEvaluation(log, key,
|
|
111
|
-
(0, thenable_1.thenable)(evaluation)
|
|
124
|
+
splitNames.forEach(function (splitName) {
|
|
125
|
+
var evaluation = getEvaluation(log, key, splits[splitName], attributes, storage, options);
|
|
126
|
+
if ((0, thenable_1.thenable)(evaluation)) {
|
|
112
127
|
thenables.push(evaluation.then(function (res) {
|
|
113
|
-
result[
|
|
114
|
-
}))
|
|
115
|
-
|
|
128
|
+
result[splitName] = res;
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
result[splitName] = evaluation;
|
|
133
|
+
}
|
|
116
134
|
});
|
|
117
135
|
return thenables.length > 0 ? Promise.all(thenables).then(function () { return result; }) : result;
|
|
118
136
|
}
|
|
119
|
-
function evaluateDefaultTreatment(definitionName, storage) {
|
|
120
|
-
var definition;
|
|
121
|
-
try {
|
|
122
|
-
definition = storage.definitions.get(definitionName);
|
|
123
|
-
}
|
|
124
|
-
catch (e) {
|
|
125
|
-
return EVALUATION_EXCEPTION;
|
|
126
|
-
}
|
|
127
|
-
return (0, thenable_1.thenable)(definition) ?
|
|
128
|
-
definition.then(getDefaultTreatment).catch(function () { return EVALUATION_EXCEPTION; }) :
|
|
129
|
-
getDefaultTreatment(definition);
|
|
130
|
-
}
|
|
131
|
-
exports.evaluateDefaultTreatment = evaluateDefaultTreatment;
|
|
132
|
-
function getDefaultTreatment(definition) {
|
|
133
|
-
if (definition) {
|
|
134
|
-
return {
|
|
135
|
-
treatment: definition.defaultTreatment,
|
|
136
|
-
label: labels_1.NO_CONDITION_MATCH,
|
|
137
|
-
definition: definition,
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
return EVALUATION_DEFINITION_NOT_FOUND;
|
|
141
|
-
}
|
package/cjs/listeners/browser.js
CHANGED
|
@@ -13,8 +13,7 @@ var EVENT_NAME = 'for visibilitychange and pagehide events.';
|
|
|
13
13
|
* We'll listen for events over the window object.
|
|
14
14
|
*/
|
|
15
15
|
var BrowserSignalListener = /** @class */ (function () {
|
|
16
|
-
function BrowserSignalListener(
|
|
17
|
-
var syncManager = _a.syncManager, settings = _a.settings, storage = _a.storage, serviceApi = _a.serviceApi;
|
|
16
|
+
function BrowserSignalListener(syncManager, settings, storage, serviceApi) {
|
|
18
17
|
this.syncManager = syncManager;
|
|
19
18
|
this.settings = settings;
|
|
20
19
|
this.storage = storage;
|
package/cjs/listeners/node.js
CHANGED
|
@@ -13,8 +13,8 @@ var EVENT_NAME = 'for SIGTERM signal.';
|
|
|
13
13
|
* the process is already exiting.
|
|
14
14
|
*/
|
|
15
15
|
var NodeSignalListener = /** @class */ (function () {
|
|
16
|
-
function NodeSignalListener(
|
|
17
|
-
|
|
16
|
+
function NodeSignalListener(syncManager, // private handler: () => MaybeThenable<void>,
|
|
17
|
+
settings) {
|
|
18
18
|
// @TODO review handler logic when implementing Node.js SDK
|
|
19
19
|
this.handler = function () {
|
|
20
20
|
if (syncManager) {
|
|
@@ -47,13 +47,13 @@ var NodeSignalListener = /** @class */ (function () {
|
|
|
47
47
|
// eslint-disable-next-line no-undef
|
|
48
48
|
process.kill(process.pid, SIGTERM);
|
|
49
49
|
};
|
|
50
|
-
this.settings.log.debug("".concat(constants_1.LOG_PREFIX_CLEANUP, "SDK graceful shutdown after SIGTERM."));
|
|
50
|
+
this.settings.log.debug("".concat(constants_1.LOG_PREFIX_CLEANUP, "Split SDK graceful shutdown after SIGTERM."));
|
|
51
51
|
var handlerResult = null;
|
|
52
52
|
try {
|
|
53
53
|
handlerResult = this.handler();
|
|
54
54
|
}
|
|
55
55
|
catch (err) {
|
|
56
|
-
this.settings.log.error("".concat(constants_1.LOG_PREFIX_CLEANUP, "Error with SDK graceful shutdown: ").concat(err));
|
|
56
|
+
this.settings.log.error("".concat(constants_1.LOG_PREFIX_CLEANUP, "Error with Split SDK graceful shutdown: ").concat(err));
|
|
57
57
|
}
|
|
58
58
|
if ((0, thenable_1.thenable)(handlerResult)) {
|
|
59
59
|
// Always exit, even with errors. The promise is returned for UT purposes.
|
package/cjs/logger/constants.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.LOG_PREFIX_CLEANUP = exports.LOG_PREFIX_UNIQUE_KEYS_TRACKER = exports.LOG_PREFIX_EVENTS_TRACKER = exports.LOG_PREFIX_IMPRESSIONS_TRACKER = exports.LOG_PREFIX_SYNC_SUBMITTERS = exports.LOG_PREFIX_SYNC_POLLING = exports.
|
|
3
|
+
exports.ENGINE_VALUE_INVALID = exports.SUBMITTERS_PUSH_PAGE_HIDDEN = exports.USER_CONSENT_INITIAL = exports.USER_CONSENT_NOT_UPDATED = exports.USER_CONSENT_UPDATED = exports.IMPRESSIONS_TRACKER_SUCCESS = exports.EVENTS_TRACKER_SUCCESS = exports.SYNC_STOP_POLLING = exports.SYNC_CONTINUE_POLLING = exports.SYNC_START_POLLING = exports.SUBMITTERS_PUSH = exports.SUBMITTERS_PUSH_FULL_QUEUE = exports.STREAMING_DISCONNECTING = exports.STREAMING_DISABLED = exports.STREAMING_CONNECTING = exports.STREAMING_RECONNECT = exports.STREAMING_REFRESH_TOKEN = exports.SYNC_SPLITS_FETCH_RETRY = exports.POLLING_STOP = exports.POLLING_START = exports.POLLING_SMART_PAUSING = exports.NEW_FACTORY = exports.NEW_SHARED_CLIENT = exports.IMPRESSION_QUEUEING = exports.CLIENT_READY = exports.CLIENT_READY_FROM_CACHE = exports.ENGINE_DEFAULT = exports.ENGINE_MATCHER_RESULT = exports.SETTINGS_SPLITS_FILTER = exports.SYNC_TASK_STOP = exports.SYNC_TASK_EXECUTE = exports.SYNC_TASK_START = exports.STREAMING_NEW_MESSAGE = exports.SYNC_RBS_UPDATE = exports.SYNC_SPLITS_UPDATE = exports.SYNC_SPLITS_FETCH = exports.SYNC_OFFLINE_DATA = exports.RETRIEVE_MANAGER = exports.RETRIEVE_CLIENT_EXISTING = exports.RETRIEVE_CLIENT_DEFAULT = exports.CLEANUP_DEREGISTERING = exports.CLEANUP_REGISTERING = exports.ENGINE_SANITIZE = exports.ENGINE_VALUE = exports.ENGINE_MATCHER_DEPENDENCY_PRE = exports.ENGINE_MATCHER_DEPENDENCY = exports.ENGINE_BUCKET = exports.ENGINE_COMBINER_IFELSEIF_NO_TREATMENT = exports.ENGINE_COMBINER_IFELSEIF = exports.ENGINE_COMBINER_AND = void 0;
|
|
4
|
+
exports.ERROR_INVALID_CONFIG_PARAM = exports.ERROR_EMPTY_ARRAY = exports.ERROR_EMPTY = exports.ERROR_INVALID = exports.ERROR_INVALID_KEY_OBJECT = exports.ERROR_TOO_LONG = exports.ERROR_NULL = exports.ERROR_CLIENT_DESTROYED = exports.ERROR_NOT_FINITE = exports.ERROR_SIZE_EXCEEDED = exports.ERROR_NOT_PLAIN_OBJECT = exports.ERROR_EVENT_TYPE_FORMAT = exports.ERROR_EVENTS_TRACKER = exports.ERROR_IMPRESSIONS_LISTENER = exports.ERROR_IMPRESSIONS_TRACKER = exports.ERROR_STREAMING_AUTH = exports.ERROR_STREAMING_SSE = exports.ERROR_SYNC_OFFLINE_LOADING = exports.ERROR_CLIENT_CANNOT_GET_READY = exports.ERROR_CLIENT_LISTENER = exports.ERROR_LOGLEVEL_INVALID = exports.ERROR_ENGINE_COMBINER_IFELSEIF = exports.WARN_FLAGSET_WITHOUT_FLAGS = exports.WARN_FLAGSET_NOT_CONFIGURED = exports.WARN_LOWERCASE_FLAGSET = exports.WARN_INVALID_FLAGSET = exports.STREAMING_PARSING_SPLIT_UPDATE = exports.STREAMING_PARSING_MEMBERSHIPS_UPDATE = exports.WARN_SDK_KEY = exports.WARN_SPLITS_FILTER_EMPTY = exports.WARN_SPLITS_FILTER_INVALID = exports.WARN_SPLITS_FILTER_IGNORED = exports.WARN_INTEGRATION_INVALID = exports.WARN_NOT_EXISTENT_TT = exports.WARN_LOWERCASE_TRAFFIC_TYPE = exports.WARN_NOT_EXISTENT_SPLIT = exports.WARN_TRIMMING = exports.WARN_CONVERTING = exports.WARN_TRIMMING_PROPERTIES = exports.WARN_SETTING_NULL = exports.SUBMITTERS_PUSH_RETRY = exports.SUBMITTERS_PUSH_FAILS = exports.STREAMING_FALLBACK = exports.STREAMING_PARSING_MESSAGE_FAILS = exports.STREAMING_PARSING_ERROR_FAILS = exports.SYNC_SPLITS_FETCH_FAILS = exports.SYNC_MYSEGMENTS_FETCH_RETRY = exports.CLIENT_NOT_READY_FROM_CACHE = exports.CLIENT_NO_LISTENER = exports.ENGINE_VALUE_NO_ATTRIBUTES = void 0;
|
|
5
|
+
exports.LOG_PREFIX_CLEANUP = exports.LOG_PREFIX_UNIQUE_KEYS_TRACKER = exports.LOG_PREFIX_EVENTS_TRACKER = exports.LOG_PREFIX_IMPRESSIONS_TRACKER = exports.LOG_PREFIX_SYNC_SUBMITTERS = exports.LOG_PREFIX_SYNC_POLLING = exports.LOG_PREFIX_SYNC_MYSEGMENTS = exports.LOG_PREFIX_SYNC_SEGMENTS = exports.LOG_PREFIX_SYNC_SPLITS = exports.LOG_PREFIX_SYNC_STREAMING = exports.LOG_PREFIX_SYNC_OFFLINE = exports.LOG_PREFIX_SYNC_MANAGER = exports.LOG_PREFIX_SYNC = exports.LOG_PREFIX_ENGINE_VALUE = exports.LOG_PREFIX_ENGINE_MATCHER = exports.LOG_PREFIX_ENGINE_COMBINER = exports.LOG_PREFIX_ENGINE = exports.LOG_PREFIX_CLIENT_INSTANTIATION = exports.LOG_PREFIX_INSTANTIATION = exports.LOG_PREFIX_SETTINGS = exports.ENGINE_MATCHER_ERROR = exports.ERROR_SETS_FILTER_EXCLUSIVE = exports.ERROR_TOO_MANY_SETS = exports.ERROR_MIN_CONFIG_PARAM = exports.ERROR_NOT_BOOLEAN = exports.ERROR_STORAGE_INVALID = exports.ERROR_HTTP = void 0;
|
|
6
6
|
/**
|
|
7
7
|
* Message codes used to trim string log messages from commons and client-side API modules,
|
|
8
8
|
* in order to reduce the minimal SDK size for Browser and eventually other client-side environments.
|
|
@@ -24,8 +24,9 @@ exports.RETRIEVE_CLIENT_DEFAULT = 27;
|
|
|
24
24
|
exports.RETRIEVE_CLIENT_EXISTING = 28;
|
|
25
25
|
exports.RETRIEVE_MANAGER = 29;
|
|
26
26
|
exports.SYNC_OFFLINE_DATA = 30;
|
|
27
|
-
exports.
|
|
28
|
-
exports.
|
|
27
|
+
exports.SYNC_SPLITS_FETCH = 31;
|
|
28
|
+
exports.SYNC_SPLITS_UPDATE = 32;
|
|
29
|
+
exports.SYNC_RBS_UPDATE = 33;
|
|
29
30
|
exports.STREAMING_NEW_MESSAGE = 35;
|
|
30
31
|
exports.SYNC_TASK_START = 36;
|
|
31
32
|
exports.SYNC_TASK_EXECUTE = 37;
|
|
@@ -41,6 +42,7 @@ exports.NEW_FACTORY = 105;
|
|
|
41
42
|
exports.POLLING_SMART_PAUSING = 106;
|
|
42
43
|
exports.POLLING_START = 107;
|
|
43
44
|
exports.POLLING_STOP = 108;
|
|
45
|
+
exports.SYNC_SPLITS_FETCH_RETRY = 109;
|
|
44
46
|
exports.STREAMING_REFRESH_TOKEN = 110;
|
|
45
47
|
exports.STREAMING_RECONNECT = 111;
|
|
46
48
|
exports.STREAMING_CONNECTING = 112;
|
|
@@ -59,9 +61,10 @@ exports.USER_CONSENT_INITIAL = 124;
|
|
|
59
61
|
exports.SUBMITTERS_PUSH_PAGE_HIDDEN = 125;
|
|
60
62
|
exports.ENGINE_VALUE_INVALID = 200;
|
|
61
63
|
exports.ENGINE_VALUE_NO_ATTRIBUTES = 201;
|
|
64
|
+
exports.CLIENT_NO_LISTENER = 202;
|
|
62
65
|
exports.CLIENT_NOT_READY_FROM_CACHE = 203;
|
|
63
|
-
exports.
|
|
64
|
-
exports.
|
|
66
|
+
exports.SYNC_MYSEGMENTS_FETCH_RETRY = 204;
|
|
67
|
+
exports.SYNC_SPLITS_FETCH_FAILS = 205;
|
|
65
68
|
exports.STREAMING_PARSING_ERROR_FAILS = 206;
|
|
66
69
|
exports.STREAMING_PARSING_MESSAGE_FAILS = 207;
|
|
67
70
|
exports.STREAMING_FALLBACK = 208;
|
|
@@ -71,7 +74,7 @@ exports.WARN_SETTING_NULL = 211;
|
|
|
71
74
|
exports.WARN_TRIMMING_PROPERTIES = 212;
|
|
72
75
|
exports.WARN_CONVERTING = 213;
|
|
73
76
|
exports.WARN_TRIMMING = 214;
|
|
74
|
-
exports.
|
|
77
|
+
exports.WARN_NOT_EXISTENT_SPLIT = 215;
|
|
75
78
|
exports.WARN_LOWERCASE_TRAFFIC_TYPE = 216;
|
|
76
79
|
exports.WARN_NOT_EXISTENT_TT = 217;
|
|
77
80
|
exports.WARN_INTEGRATION_INVALID = 218;
|
|
@@ -122,13 +125,15 @@ exports.LOG_PREFIX_ENGINE = 'engine';
|
|
|
122
125
|
exports.LOG_PREFIX_ENGINE_COMBINER = exports.LOG_PREFIX_ENGINE + ':combiner: ';
|
|
123
126
|
exports.LOG_PREFIX_ENGINE_MATCHER = exports.LOG_PREFIX_ENGINE + ':matcher: ';
|
|
124
127
|
exports.LOG_PREFIX_ENGINE_VALUE = exports.LOG_PREFIX_ENGINE + ':value: ';
|
|
125
|
-
exports.LOG_PREFIX_SYNC = 'sync
|
|
126
|
-
exports.
|
|
127
|
-
exports.
|
|
128
|
-
exports.
|
|
129
|
-
exports.
|
|
130
|
-
exports.
|
|
131
|
-
exports.
|
|
128
|
+
exports.LOG_PREFIX_SYNC = 'sync';
|
|
129
|
+
exports.LOG_PREFIX_SYNC_MANAGER = exports.LOG_PREFIX_SYNC + ':sync-manager: ';
|
|
130
|
+
exports.LOG_PREFIX_SYNC_OFFLINE = exports.LOG_PREFIX_SYNC + ':offline: ';
|
|
131
|
+
exports.LOG_PREFIX_SYNC_STREAMING = exports.LOG_PREFIX_SYNC + ':streaming: ';
|
|
132
|
+
exports.LOG_PREFIX_SYNC_SPLITS = exports.LOG_PREFIX_SYNC + ':featureflag-changes: ';
|
|
133
|
+
exports.LOG_PREFIX_SYNC_SEGMENTS = exports.LOG_PREFIX_SYNC + ':segment-changes: ';
|
|
134
|
+
exports.LOG_PREFIX_SYNC_MYSEGMENTS = exports.LOG_PREFIX_SYNC + ':my-segments: ';
|
|
135
|
+
exports.LOG_PREFIX_SYNC_POLLING = exports.LOG_PREFIX_SYNC + ':polling-manager: ';
|
|
136
|
+
exports.LOG_PREFIX_SYNC_SUBMITTERS = exports.LOG_PREFIX_SYNC + ':submitter: ';
|
|
132
137
|
exports.LOG_PREFIX_IMPRESSIONS_TRACKER = 'impressions-tracker: ';
|
|
133
138
|
exports.LOG_PREFIX_EVENTS_TRACKER = 'events-tracker: ';
|
|
134
139
|
exports.LOG_PREFIX_UNIQUE_KEYS_TRACKER = 'unique-keys-tracker: ';
|
|
@@ -24,12 +24,13 @@ exports.codesDebug = info_1.codesInfo.concat([
|
|
|
24
24
|
[c.RETRIEVE_MANAGER, 'Retrieving manager instance.'],
|
|
25
25
|
// synchronizer
|
|
26
26
|
[c.SYNC_OFFLINE_DATA, c.LOG_PREFIX_SYNC_OFFLINE + 'Feature flags data: \n%s'],
|
|
27
|
-
[c.
|
|
28
|
-
[c.
|
|
27
|
+
[c.SYNC_SPLITS_FETCH, c.LOG_PREFIX_SYNC_SPLITS + 'Spin up feature flags update using since = %s and rbSince = %s.'],
|
|
28
|
+
[c.SYNC_SPLITS_UPDATE, c.LOG_PREFIX_SYNC_SPLITS + 'New feature flags: %s. Removed feature flags: %s.'],
|
|
29
|
+
[c.SYNC_RBS_UPDATE, c.LOG_PREFIX_SYNC_SPLITS + 'New rule-based segments: %s. Removed rule-based segments: %s.'],
|
|
29
30
|
[c.STREAMING_NEW_MESSAGE, c.LOG_PREFIX_SYNC_STREAMING + 'New SSE message received, with data: %s.'],
|
|
30
|
-
[c.SYNC_TASK_START, c.LOG_PREFIX_SYNC + 'Starting %s. Running each %s millis'],
|
|
31
|
-
[c.SYNC_TASK_EXECUTE, c.LOG_PREFIX_SYNC + 'Running %s'],
|
|
32
|
-
[c.SYNC_TASK_STOP, c.LOG_PREFIX_SYNC + 'Stopping %s'],
|
|
31
|
+
[c.SYNC_TASK_START, c.LOG_PREFIX_SYNC + ': Starting %s. Running each %s millis'],
|
|
32
|
+
[c.SYNC_TASK_EXECUTE, c.LOG_PREFIX_SYNC + ': Running %s'],
|
|
33
|
+
[c.SYNC_TASK_STOP, c.LOG_PREFIX_SYNC + ': Stopping %s'],
|
|
33
34
|
// initialization / settings validation
|
|
34
35
|
[c.SETTINGS_SPLITS_FILTER, c.LOG_PREFIX_SETTINGS + ': feature flags filtering criteria is "%s".']
|
|
35
36
|
]);
|
|
@@ -5,7 +5,7 @@ var tslib_1 = require("tslib");
|
|
|
5
5
|
var c = tslib_1.__importStar(require("../constants"));
|
|
6
6
|
exports.codesError = [
|
|
7
7
|
// evaluator
|
|
8
|
-
[c.ERROR_ENGINE_COMBINER_IFELSEIF, c.LOG_PREFIX_ENGINE_COMBINER + 'Invalid
|
|
8
|
+
[c.ERROR_ENGINE_COMBINER_IFELSEIF, c.LOG_PREFIX_ENGINE_COMBINER + 'Invalid feature flag, no valid rules or unsupported targeting rule type found'],
|
|
9
9
|
[c.ENGINE_MATCHER_ERROR, c.LOG_PREFIX_ENGINE_MATCHER + '[%s] %s'],
|
|
10
10
|
// SDK
|
|
11
11
|
[c.ERROR_LOGLEVEL_INVALID, 'logger: Invalid Log Level - No changes to the logs will be applied.'],
|
|
@@ -16,7 +16,7 @@ exports.codesError = [
|
|
|
16
16
|
// synchronizer
|
|
17
17
|
[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'],
|
|
18
18
|
[c.ERROR_STREAMING_SSE, c.LOG_PREFIX_SYNC_STREAMING + 'Failed to connect or error on streaming connection, with error message: %s'],
|
|
19
|
-
[c.ERROR_STREAMING_AUTH, c.LOG_PREFIX_SYNC_STREAMING + 'Failed to authenticate for streaming. Error: %s'],
|
|
19
|
+
[c.ERROR_STREAMING_AUTH, c.LOG_PREFIX_SYNC_STREAMING + 'Failed to authenticate for streaming. Error: %s.'],
|
|
20
20
|
[c.ERROR_HTTP, 'HTTP request failed with %s. URL: %s. Message: %s'],
|
|
21
21
|
// client status
|
|
22
22
|
[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.'],
|
|
@@ -37,6 +37,6 @@ exports.codesError = [
|
|
|
37
37
|
[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".'],
|
|
38
38
|
[c.ERROR_STORAGE_INVALID, c.LOG_PREFIX_SETTINGS + ': the provided storage is invalid.%s Falling back into default MEMORY storage'],
|
|
39
39
|
[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'],
|
|
40
|
-
[c.ERROR_TOO_MANY_SETS, c.LOG_PREFIX_SETTINGS + ': the
|
|
40
|
+
[c.ERROR_TOO_MANY_SETS, c.LOG_PREFIX_SETTINGS + ': the amount of flag sets provided are big causing uri length error.'],
|
|
41
41
|
[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.'],
|
|
42
42
|
];
|
|
@@ -4,15 +4,15 @@ exports.codesInfo = void 0;
|
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var c = tslib_1.__importStar(require("../constants"));
|
|
6
6
|
var warn_1 = require("./warn");
|
|
7
|
-
var READY_MSG = 'SDK client is ready';
|
|
7
|
+
var READY_MSG = 'Split SDK client is ready';
|
|
8
8
|
exports.codesInfo = warn_1.codesWarn.concat([
|
|
9
9
|
// client status
|
|
10
10
|
[c.CLIENT_READY_FROM_CACHE, READY_MSG + ' from cache'],
|
|
11
11
|
[c.CLIENT_READY, READY_MSG],
|
|
12
12
|
// SDK
|
|
13
|
-
[c.IMPRESSION_QUEUEING, c.LOG_PREFIX_IMPRESSIONS_TRACKER + 'Queueing impression.
|
|
13
|
+
[c.IMPRESSION_QUEUEING, c.LOG_PREFIX_IMPRESSIONS_TRACKER + 'Queueing impression. Feature flag: %s. Key: %s. Evaluation: %s. Label: %s'],
|
|
14
14
|
[c.NEW_SHARED_CLIENT, 'New shared client instance created.'],
|
|
15
|
-
[c.NEW_FACTORY, 'New SDK instance created. %s'],
|
|
15
|
+
[c.NEW_FACTORY, 'New Split SDK instance created. %s'],
|
|
16
16
|
[c.EVENTS_TRACKER_SUCCESS, c.LOG_PREFIX_EVENTS_TRACKER + 'Successfully queued %s'],
|
|
17
17
|
[c.IMPRESSIONS_TRACKER_SUCCESS, c.LOG_PREFIX_IMPRESSIONS_TRACKER + 'Successfully stored %s impression(s).'],
|
|
18
18
|
[c.USER_CONSENT_UPDATED, 'UserConsent: consent status changed from %s to %s.'],
|
|
@@ -22,6 +22,7 @@ exports.codesInfo = warn_1.codesWarn.concat([
|
|
|
22
22
|
[c.POLLING_SMART_PAUSING, c.LOG_PREFIX_SYNC_POLLING + 'Turning segments data polling %s.'],
|
|
23
23
|
[c.POLLING_START, c.LOG_PREFIX_SYNC_POLLING + 'Starting polling'],
|
|
24
24
|
[c.POLLING_STOP, c.LOG_PREFIX_SYNC_POLLING + 'Stopping polling'],
|
|
25
|
+
[c.SYNC_SPLITS_FETCH_RETRY, c.LOG_PREFIX_SYNC_SPLITS + 'Retrying fetch of feature flags (attempt #%s). Reason: %s'],
|
|
25
26
|
[c.SUBMITTERS_PUSH_FULL_QUEUE, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Flushing full %s queue and resetting timer.'],
|
|
26
27
|
[c.SUBMITTERS_PUSH, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Pushing %s.'],
|
|
27
28
|
[c.SUBMITTERS_PUSH_PAGE_HIDDEN, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Flushing %s because page became hidden.'],
|
|
@@ -9,21 +9,22 @@ exports.codesWarn = error_1.codesError.concat([
|
|
|
9
9
|
[c.ENGINE_VALUE_INVALID, c.LOG_PREFIX_ENGINE_VALUE + 'Value %s doesn\'t match with expected type.'],
|
|
10
10
|
[c.ENGINE_VALUE_NO_ATTRIBUTES, c.LOG_PREFIX_ENGINE_VALUE + 'Defined attribute `%s`. No attributes received.'],
|
|
11
11
|
// synchronizer
|
|
12
|
-
[c.
|
|
13
|
-
[c.
|
|
12
|
+
[c.SYNC_MYSEGMENTS_FETCH_RETRY, c.LOG_PREFIX_SYNC_MYSEGMENTS + 'Retrying fetch of memberships (attempt #%s). Reason: %s'],
|
|
13
|
+
[c.SYNC_SPLITS_FETCH_FAILS, c.LOG_PREFIX_SYNC_SPLITS + 'Error while doing fetch of feature flags. %s'],
|
|
14
14
|
[c.STREAMING_PARSING_ERROR_FAILS, c.LOG_PREFIX_SYNC_STREAMING + 'Error parsing SSE error notification: %s'],
|
|
15
15
|
[c.STREAMING_PARSING_MESSAGE_FAILS, c.LOG_PREFIX_SYNC_STREAMING + 'Error parsing SSE message notification: %s'],
|
|
16
16
|
[c.STREAMING_FALLBACK, c.LOG_PREFIX_SYNC_STREAMING + 'Falling back to polling mode. Reason: %s'],
|
|
17
|
-
[c.SUBMITTERS_PUSH_FAILS, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Dropping %s after retry. Reason: %s'],
|
|
18
|
-
[c.SUBMITTERS_PUSH_RETRY, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Failed to push %s, keeping data to retry on next iteration. Reason: %s'],
|
|
17
|
+
[c.SUBMITTERS_PUSH_FAILS, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Dropping %s after retry. Reason: %s.'],
|
|
18
|
+
[c.SUBMITTERS_PUSH_RETRY, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Failed to push %s, keeping data to retry on next iteration. Reason: %s.'],
|
|
19
19
|
// client status
|
|
20
|
-
[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.'],
|
|
20
|
+
[c.CLIENT_NOT_READY_FROM_CACHE, '%s: the SDK is not ready to evaluate. Results may be incorrect%s. Make sure to wait for SDK readiness before using this method.'],
|
|
21
|
+
[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.'],
|
|
21
22
|
// input validation
|
|
22
23
|
[c.WARN_SETTING_NULL, '%s: Property "%s" is of invalid type. Setting value to null.'],
|
|
23
24
|
[c.WARN_TRIMMING_PROPERTIES, '%s: more than 300 properties were provided. Some of them will be trimmed when processed.'],
|
|
24
25
|
[c.WARN_CONVERTING, '%s: %s "%s" is not of type string, converting.'],
|
|
25
26
|
[c.WARN_TRIMMING, '%s: %s "%s" has extra whitespace, trimming.'],
|
|
26
|
-
[c.
|
|
27
|
+
[c.WARN_NOT_EXISTENT_SPLIT, '%s: feature flag "%s" does not exist in this environment. Please double check what feature flags exist in Harness FME UI.'],
|
|
27
28
|
[c.WARN_LOWERCASE_TRAFFIC_TYPE, '%s: traffic_type_name should be all lowercase - converting string to lowercase.'],
|
|
28
29
|
[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 FME UI.'],
|
|
29
30
|
[c.WARN_FLAGSET_NOT_CONFIGURED, '%s: you passed %s which is not part of the configured FlagSetsFilter, ignoring Flag Set.'],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.serverSideModules = void 0;
|
|
4
|
-
var
|
|
4
|
+
var splitApi_1 = require("../services/splitApi");
|
|
5
5
|
var syncManagerOnline_1 = require("../sync/syncManagerOnline");
|
|
6
6
|
var pushManager_1 = require("../sync/streaming/pushManager");
|
|
7
7
|
var pollingManagerSS_1 = require("../sync/polling/pollingManagerSS");
|
|
@@ -12,7 +12,7 @@ var impressionObserverSS_1 = require("../trackers/impressionObserver/impressionO
|
|
|
12
12
|
var syncManagerOnlineSSFactory = (0, syncManagerOnline_1.syncManagerOnlineFactory)(pollingManagerSS_1.pollingManagerSSFactory, pushManager_1.pushManagerFactory);
|
|
13
13
|
exports.serverSideModules = {
|
|
14
14
|
storageFactory: InMemoryStorage_1.InMemoryStorageFactory,
|
|
15
|
-
|
|
15
|
+
splitApiFactory: splitApi_1.splitApiFactory,
|
|
16
16
|
syncManagerFactory: syncManagerOnlineSSFactory,
|
|
17
17
|
sdkManagerFactory: sdkManager_1.sdkManagerFactory,
|
|
18
18
|
sdkClientMethodFactory: sdkClientMethod_1.sdkClientMethodFactory,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
//
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
3
|
+
exports.SEGMENTS_UPDATE = exports.FLAGS_UPDATE = exports.SDK_UPDATE = exports.SDK_READY_FROM_CACHE = exports.SDK_READY = exports.SDK_READY_TIMED_OUT = exports.SDK_SEGMENTS_ARRIVED = exports.SDK_SPLITS_CACHE_LOADED = exports.SDK_SPLITS_ARRIVED = void 0;
|
|
4
|
+
// Splits events:
|
|
5
|
+
exports.SDK_SPLITS_ARRIVED = 'state::splits-arrived';
|
|
6
|
+
exports.SDK_SPLITS_CACHE_LOADED = 'state::splits-cache-loaded';
|
|
7
7
|
// Segments events:
|
|
8
8
|
exports.SDK_SEGMENTS_ARRIVED = 'state::segments-arrived';
|
|
9
9
|
// Readiness events:
|
|
@@ -14,4 +14,3 @@ exports.SDK_UPDATE = 'state::update';
|
|
|
14
14
|
// SdkUpdateMetadata types:
|
|
15
15
|
exports.FLAGS_UPDATE = 'FLAGS_UPDATE';
|
|
16
16
|
exports.SEGMENTS_UPDATE = 'SEGMENTS_UPDATE';
|
|
17
|
-
exports.CONFIGS_UPDATE = 'CONFIGS_UPDATE';
|