@splitsoftware/splitio-commons 2.0.0-rc.4 → 2.0.0-rc.5
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 +1 -0
- package/cjs/integrations/pluggable.js +2 -2
- package/cjs/logger/sdkLogger.js +2 -2
- package/cjs/readiness/sdkReadinessManager.js +2 -21
- package/cjs/sdkClient/client.js +0 -1
- package/cjs/sdkClient/clientAttributesDecoration.js +9 -9
- package/cjs/sdkClient/clientCS.js +2 -2
- package/cjs/services/splitApi.js +13 -13
- package/cjs/services/splitHttpClient.js +2 -2
- package/cjs/storages/AbstractSplitsCacheAsync.js +1 -4
- package/cjs/storages/AbstractSplitsCacheSync.js +1 -4
- package/cjs/storages/dataLoader.js +5 -6
- package/cjs/storages/findLatencyIndex.js +1 -1
- package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +1 -6
- package/cjs/storages/inMemory/AttributesCacheInMemory.js +10 -10
- package/cjs/storages/inMemory/EventsCacheInMemory.js +1 -1
- package/cjs/storages/inMemory/ImpressionsCacheInMemory.js +1 -1
- package/cjs/storages/inMemory/InMemoryStorage.js +1 -1
- package/cjs/storages/inMemory/InMemoryStorageCS.js +1 -1
- package/cjs/storages/inMemory/UniqueKeysCacheInMemoryCS.js +1 -1
- package/cjs/storages/inRedis/SplitsCacheInRedis.js +1 -3
- package/cjs/storages/inRedis/TelemetryCacheInRedis.js +3 -3
- package/cjs/storages/inRedis/UniqueKeysCacheInRedis.js +1 -1
- package/cjs/storages/pluggable/EventsCachePluggable.js +1 -1
- package/cjs/storages/pluggable/ImpressionsCachePluggable.js +1 -1
- package/cjs/storages/pluggable/SegmentsCachePluggable.js +1 -1
- package/cjs/storages/pluggable/SplitsCachePluggable.js +3 -3
- package/cjs/storages/pluggable/TelemetryCachePluggable.js +3 -3
- package/cjs/storages/pluggable/UniqueKeysCachePluggable.js +1 -1
- package/cjs/storages/pluggable/inMemoryWrapper.js +1 -1
- package/cjs/storages/pluggable/index.js +1 -1
- package/cjs/storages/pluggable/wrapperAdapter.js +2 -2
- package/cjs/sync/offline/splitsParser/splitsParserFromSettings.js +1 -1
- package/cjs/sync/offline/syncManagerOffline.js +1 -1
- package/cjs/sync/polling/updaters/mySegmentsUpdater.js +3 -3
- package/cjs/sync/polling/updaters/segmentChangesUpdater.js +8 -8
- package/cjs/sync/polling/updaters/splitChangesUpdater.js +13 -13
- package/cjs/sync/streaming/AuthClient/index.js +2 -2
- package/cjs/sync/streaming/SSEClient/index.js +4 -7
- package/cjs/sync/streaming/SSEHandler/NotificationKeeper.js +1 -1
- package/cjs/sync/streaming/SSEHandler/NotificationParser.js +5 -4
- package/cjs/sync/streaming/SSEHandler/index.js +2 -2
- package/cjs/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +3 -3
- package/cjs/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +2 -2
- package/cjs/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +4 -4
- package/cjs/sync/streaming/parseUtils.js +13 -13
- package/cjs/sync/syncManagerOnline.js +2 -2
- package/cjs/sync/syncTask.js +4 -4
- package/cjs/trackers/eventTracker.js +2 -2
- package/cjs/trackers/impressionsTracker.js +5 -5
- package/cjs/trackers/strategy/strategyDebug.js +1 -1
- package/cjs/trackers/strategy/strategyNone.js +2 -2
- package/cjs/trackers/strategy/strategyOptimized.js +2 -2
- package/cjs/trackers/uniqueKeysTracker.js +3 -3
- package/cjs/utils/Backoff.js +0 -4
- package/cjs/utils/Semver.js +1 -1
- package/cjs/utils/base64/index.js +2 -2
- package/cjs/utils/decompress/index.js +4 -4
- package/cjs/utils/lang/binarySearch.js +2 -2
- package/cjs/utils/murmur3/murmur3_128.js +1 -1
- package/cjs/utils/murmur3/murmur3_128_x86.js +1 -1
- package/cjs/utils/murmur3/murmur3_64.js +1 -1
- package/cjs/utils/murmur3/utfx.js +10 -17
- package/cjs/utils/promise/wrapper.js +2 -2
- package/cjs/utils/settingsValidation/index.js +2 -2
- package/cjs/utils/settingsValidation/integrations/common.js +4 -4
- package/cjs/utils/settingsValidation/integrations/configurable.js +3 -3
- package/cjs/utils/settingsValidation/integrations/pluggable.js +2 -2
- package/cjs/utils/settingsValidation/logger/builtinLogger.js +1 -1
- package/cjs/utils/settingsValidation/logger/commons.js +1 -1
- package/cjs/utils/settingsValidation/logger/pluggableLogger.js +1 -1
- package/cjs/utils/settingsValidation/splitFilters.js +8 -11
- package/cjs/utils/settingsValidation/storage/storageCS.js +2 -2
- package/cjs/utils/settingsValidation/url.js +3 -3
- package/esm/integrations/pluggable.js +2 -2
- package/esm/logger/sdkLogger.js +2 -2
- package/esm/readiness/sdkReadinessManager.js +2 -21
- package/esm/sdkClient/client.js +0 -1
- package/esm/sdkClient/clientAttributesDecoration.js +9 -9
- package/esm/sdkClient/clientCS.js +2 -2
- package/esm/services/splitApi.js +13 -13
- package/esm/services/splitHttpClient.js +2 -2
- package/esm/storages/AbstractSplitsCacheAsync.js +1 -4
- package/esm/storages/AbstractSplitsCacheSync.js +1 -4
- package/esm/storages/dataLoader.js +5 -6
- package/esm/storages/findLatencyIndex.js +1 -1
- package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +1 -6
- package/esm/storages/inMemory/AttributesCacheInMemory.js +10 -10
- package/esm/storages/inMemory/EventsCacheInMemory.js +1 -1
- package/esm/storages/inMemory/ImpressionsCacheInMemory.js +1 -1
- package/esm/storages/inMemory/InMemoryStorage.js +1 -1
- package/esm/storages/inMemory/InMemoryStorageCS.js +1 -1
- package/esm/storages/inMemory/UniqueKeysCacheInMemoryCS.js +1 -1
- package/esm/storages/inRedis/SplitsCacheInRedis.js +1 -3
- package/esm/storages/inRedis/TelemetryCacheInRedis.js +3 -3
- package/esm/storages/inRedis/UniqueKeysCacheInRedis.js +1 -1
- package/esm/storages/pluggable/EventsCachePluggable.js +1 -1
- package/esm/storages/pluggable/ImpressionsCachePluggable.js +1 -1
- package/esm/storages/pluggable/SegmentsCachePluggable.js +1 -1
- package/esm/storages/pluggable/SplitsCachePluggable.js +3 -3
- package/esm/storages/pluggable/TelemetryCachePluggable.js +3 -3
- package/esm/storages/pluggable/UniqueKeysCachePluggable.js +1 -1
- package/esm/storages/pluggable/inMemoryWrapper.js +1 -1
- package/esm/storages/pluggable/index.js +1 -1
- package/esm/storages/pluggable/wrapperAdapter.js +2 -2
- package/esm/sync/offline/splitsParser/splitsParserFromSettings.js +1 -1
- package/esm/sync/offline/syncManagerOffline.js +1 -1
- package/esm/sync/polling/updaters/mySegmentsUpdater.js +3 -3
- package/esm/sync/polling/updaters/segmentChangesUpdater.js +8 -8
- package/esm/sync/polling/updaters/splitChangesUpdater.js +13 -13
- package/esm/sync/streaming/AuthClient/index.js +2 -2
- package/esm/sync/streaming/SSEClient/index.js +4 -7
- package/esm/sync/streaming/SSEHandler/NotificationKeeper.js +1 -1
- package/esm/sync/streaming/SSEHandler/NotificationParser.js +5 -4
- package/esm/sync/streaming/SSEHandler/index.js +2 -2
- package/esm/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +3 -3
- package/esm/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +2 -2
- package/esm/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +4 -4
- package/esm/sync/streaming/parseUtils.js +13 -13
- package/esm/sync/syncManagerOnline.js +2 -2
- package/esm/sync/syncTask.js +4 -4
- package/esm/trackers/eventTracker.js +2 -2
- package/esm/trackers/impressionsTracker.js +5 -5
- package/esm/trackers/strategy/strategyDebug.js +1 -1
- package/esm/trackers/strategy/strategyNone.js +2 -2
- package/esm/trackers/strategy/strategyOptimized.js +2 -2
- package/esm/trackers/uniqueKeysTracker.js +3 -3
- package/esm/utils/Backoff.js +0 -4
- package/esm/utils/Semver.js +1 -1
- package/esm/utils/base64/index.js +2 -2
- package/esm/utils/decompress/index.js +4 -4
- package/esm/utils/lang/binarySearch.js +2 -2
- package/esm/utils/murmur3/murmur3_128.js +1 -1
- package/esm/utils/murmur3/murmur3_128_x86.js +1 -1
- package/esm/utils/murmur3/murmur3_64.js +1 -1
- package/esm/utils/murmur3/utfx.js +10 -17
- package/esm/utils/promise/wrapper.js +2 -2
- package/esm/utils/settingsValidation/index.js +2 -2
- package/esm/utils/settingsValidation/integrations/common.js +4 -4
- package/esm/utils/settingsValidation/integrations/configurable.js +3 -3
- package/esm/utils/settingsValidation/integrations/pluggable.js +2 -2
- package/esm/utils/settingsValidation/logger/builtinLogger.js +1 -1
- package/esm/utils/settingsValidation/logger/commons.js +1 -1
- package/esm/utils/settingsValidation/logger/pluggableLogger.js +1 -1
- package/esm/utils/settingsValidation/splitFilters.js +8 -11
- package/esm/utils/settingsValidation/storage/storageCS.js +2 -2
- package/esm/utils/settingsValidation/url.js +3 -3
- package/package.json +3 -2
- package/src/dtos/types.ts +1 -1
- package/src/evaluator/Engine.ts +1 -1
- package/src/evaluator/combiners/ifelseif.ts +1 -1
- package/src/evaluator/condition/index.ts +1 -1
- package/src/evaluator/index.ts +1 -1
- package/src/evaluator/parser/index.ts +1 -1
- package/src/evaluator/types.ts +1 -1
- package/src/evaluator/value/index.ts +1 -1
- package/src/evaluator/value/sanitize.ts +1 -1
- package/src/integrations/pluggable.ts +3 -3
- package/src/integrations/types.ts +3 -2
- package/src/listeners/browser.ts +3 -2
- package/src/logger/index.ts +6 -6
- package/src/logger/sdkLogger.ts +4 -4
- package/src/logger/types.ts +11 -13
- package/src/readiness/readinessManager.ts +5 -4
- package/src/readiness/sdkReadinessManager.ts +6 -23
- package/src/readiness/types.ts +5 -4
- package/src/sdkClient/client.ts +7 -8
- package/src/sdkClient/clientAttributesDecoration.ts +11 -11
- package/src/sdkClient/clientCS.ts +5 -5
- package/src/sdkClient/clientInputValidation.ts +3 -2
- package/src/sdkClient/identity.ts +1 -1
- package/src/sdkClient/sdkClient.ts +3 -3
- package/src/sdkClient/sdkClientMethod.ts +2 -2
- package/src/sdkClient/sdkClientMethodCS.ts +5 -5
- package/src/sdkFactory/index.ts +3 -3
- package/src/sdkFactory/types.ts +7 -6
- package/src/sdkManager/index.ts +2 -1
- package/src/services/splitApi.ts +13 -13
- package/src/services/splitHttpClient.ts +2 -2
- package/src/storages/AbstractMySegmentsCacheSync.ts +1 -1
- package/src/storages/AbstractSplitsCacheAsync.ts +1 -4
- package/src/storages/AbstractSplitsCacheSync.ts +1 -4
- package/src/storages/dataLoader.ts +7 -8
- package/src/storages/findLatencyIndex.ts +1 -1
- package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +1 -6
- package/src/storages/inMemory/AttributesCacheInMemory.ts +11 -11
- package/src/storages/inMemory/EventsCacheInMemory.ts +2 -2
- package/src/storages/inMemory/ImpressionsCacheInMemory.ts +5 -5
- package/src/storages/inMemory/InMemoryStorage.ts +1 -1
- package/src/storages/inMemory/InMemoryStorageCS.ts +1 -1
- package/src/storages/inMemory/UniqueKeysCacheInMemoryCS.ts +1 -1
- package/src/storages/inRedis/EventsCacheInRedis.ts +1 -1
- package/src/storages/inRedis/ImpressionsCacheInRedis.ts +2 -2
- package/src/storages/inRedis/SplitsCacheInRedis.ts +1 -3
- package/src/storages/inRedis/TelemetryCacheInRedis.ts +3 -3
- package/src/storages/inRedis/UniqueKeysCacheInRedis.ts +1 -1
- package/src/storages/pluggable/EventsCachePluggable.ts +2 -2
- package/src/storages/pluggable/ImpressionsCachePluggable.ts +3 -3
- package/src/storages/pluggable/SegmentsCachePluggable.ts +1 -1
- package/src/storages/pluggable/SplitsCachePluggable.ts +3 -3
- package/src/storages/pluggable/TelemetryCachePluggable.ts +3 -3
- package/src/storages/pluggable/UniqueKeysCachePluggable.ts +1 -1
- package/src/storages/pluggable/inMemoryWrapper.ts +1 -1
- package/src/storages/pluggable/index.ts +1 -1
- package/src/storages/pluggable/wrapperAdapter.ts +2 -2
- package/src/storages/types.ts +51 -68
- package/src/storages/utils.ts +3 -2
- package/src/sync/offline/splitsParser/splitsParserFromSettings.ts +3 -3
- package/src/sync/offline/syncManagerOffline.ts +1 -1
- package/src/sync/polling/updaters/mySegmentsUpdater.ts +3 -3
- package/src/sync/polling/updaters/segmentChangesUpdater.ts +8 -8
- package/src/sync/polling/updaters/splitChangesUpdater.ts +13 -13
- package/src/sync/streaming/AuthClient/index.ts +2 -2
- package/src/sync/streaming/SSEClient/index.ts +4 -7
- package/src/sync/streaming/SSEHandler/NotificationKeeper.ts +1 -1
- package/src/sync/streaming/SSEHandler/NotificationParser.ts +5 -4
- package/src/sync/streaming/SSEHandler/index.ts +2 -2
- package/src/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.ts +3 -3
- package/src/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.ts +2 -2
- package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +4 -4
- package/src/sync/streaming/parseUtils.ts +13 -13
- package/src/sync/streaming/types.ts +2 -2
- package/src/sync/submitters/impressionsSubmitter.ts +2 -2
- package/src/sync/submitters/telemetrySubmitter.ts +4 -3
- package/src/sync/submitters/types.ts +1 -1
- package/src/sync/syncManagerOnline.ts +2 -2
- package/src/sync/syncTask.ts +4 -4
- package/src/trackers/eventTracker.ts +4 -3
- package/src/trackers/impressionObserver/ImpressionObserver.ts +4 -4
- package/src/trackers/impressionObserver/buildKey.ts +2 -2
- package/src/trackers/impressionObserver/impressionObserverCS.ts +2 -2
- package/src/trackers/impressionObserver/impressionObserverSS.ts +2 -2
- package/src/trackers/impressionObserver/types.ts +2 -2
- package/src/trackers/impressionsTracker.ts +8 -7
- package/src/trackers/strategy/strategyDebug.ts +3 -3
- package/src/trackers/strategy/strategyNone.ts +4 -4
- package/src/trackers/strategy/strategyOptimized.ts +5 -5
- package/src/trackers/types.ts +5 -5
- package/src/trackers/uniqueKeysTracker.ts +3 -3
- package/src/types.ts +37 -1355
- package/src/utils/Backoff.ts +0 -4
- package/src/utils/MinEventEmitter.ts +2 -3
- package/src/utils/MinEvents.ts +2 -2
- package/src/utils/Semver.ts +1 -1
- package/src/utils/base64/index.ts +2 -2
- package/src/utils/constants/index.ts +9 -10
- package/src/utils/decompress/index.ts +4 -4
- package/src/utils/inputValidation/attributes.ts +1 -1
- package/src/utils/inputValidation/eventProperties.ts +1 -1
- package/src/utils/inputValidation/key.ts +1 -1
- package/src/utils/inputValidation/preloadedData.ts +1 -2
- package/src/utils/inputValidation/trafficTypeExistence.ts +2 -2
- package/src/utils/key/index.ts +1 -1
- package/src/utils/lang/binarySearch.ts +2 -2
- package/src/utils/murmur3/murmur3_128.ts +1 -1
- package/src/utils/murmur3/murmur3_128_x86.ts +1 -1
- package/src/utils/murmur3/murmur3_64.ts +1 -1
- package/src/utils/murmur3/utfx.ts +10 -17
- package/src/utils/promise/wrapper.ts +2 -2
- package/src/utils/settingsValidation/consent.ts +2 -2
- package/src/utils/settingsValidation/impressionsMode.ts +1 -1
- package/src/utils/settingsValidation/index.ts +2 -2
- package/src/utils/settingsValidation/integrations/common.ts +4 -4
- package/src/utils/settingsValidation/integrations/configurable.ts +3 -3
- package/src/utils/settingsValidation/integrations/pluggable.ts +2 -2
- package/src/utils/settingsValidation/logger/builtinLogger.ts +3 -3
- package/src/utils/settingsValidation/logger/commons.ts +3 -3
- package/src/utils/settingsValidation/logger/pluggableLogger.ts +3 -3
- package/src/utils/settingsValidation/splitFilters.ts +9 -12
- package/src/utils/settingsValidation/storage/storageCS.ts +5 -4
- package/src/utils/settingsValidation/url.ts +3 -3
- package/types/splitio.d.ts +885 -1237
|
@@ -5,9 +5,9 @@ var common_1 = require("./common");
|
|
|
5
5
|
/**
|
|
6
6
|
* This function validates `settings.integrations` object that consists of a list of pluggable integration factories.
|
|
7
7
|
*
|
|
8
|
-
* @param
|
|
8
|
+
* @param settings - config object provided by the user to initialize the sdk
|
|
9
9
|
*
|
|
10
|
-
* @returns
|
|
10
|
+
* @returns array of valid integration factories. The array might be empty if `settings` object does not have valid integrations.
|
|
11
11
|
*/
|
|
12
12
|
function validatePluggableIntegrations(settings) {
|
|
13
13
|
return (0, common_1.validateIntegrations)(settings, function (integration) { return typeof integration === 'function'; }, 'Integration items must be functions that initialize the integrations');
|
|
@@ -31,7 +31,7 @@ else if ((0, logger_1.isLogLevelString)(initialState)) {
|
|
|
31
31
|
/**
|
|
32
32
|
* Validates the `debug` property at config and use it to set the log level.
|
|
33
33
|
*
|
|
34
|
-
* @param settings user config object, with an optional `debug` property of type boolean or string log level.
|
|
34
|
+
* @param settings - user config object, with an optional `debug` property of type boolean or string log level.
|
|
35
35
|
* @returns a logger instance with the log level at `settings.debug`. If `settings.debug` is invalid or not provided, `initialLogLevel` is used.
|
|
36
36
|
*/
|
|
37
37
|
function validateLogger(settings) {
|
|
@@ -6,7 +6,7 @@ var logger_1 = require("../../../logger");
|
|
|
6
6
|
* Returns the LogLevel for the given debugValue or undefined if it is invalid,
|
|
7
7
|
* i.e., if the debugValue is not a boolean or LogLevel string.
|
|
8
8
|
*
|
|
9
|
-
* @param debugValue debug value at config
|
|
9
|
+
* @param debugValue - debug value at config
|
|
10
10
|
* @returns LogLevel of the given debugValue or undefined if the provided value is invalid
|
|
11
11
|
*/
|
|
12
12
|
function getLogLevel(debugValue) {
|
|
@@ -11,7 +11,7 @@ var initialLogLevel = logger_1.LogLevels.NONE;
|
|
|
11
11
|
/**
|
|
12
12
|
* Validates the `debug` property at config and use it to set the logger.
|
|
13
13
|
*
|
|
14
|
-
* @param settings user config object, with an optional `debug` property of type boolean, string log level or a Logger object.
|
|
14
|
+
* @param settings - user config object, with an optional `debug` property of type boolean, string log level or a Logger object.
|
|
15
15
|
* @returns a logger instance, that might be: the provided logger at `settings.debug`, or one with the given `debug` log level,
|
|
16
16
|
* or one with NONE log level if `debug` is not defined or invalid.
|
|
17
17
|
*/
|
|
@@ -36,9 +36,9 @@ function validateFilterType(maybeFilterType) {
|
|
|
36
36
|
/**
|
|
37
37
|
* Validate, deduplicate and sort a given list of filter values.
|
|
38
38
|
*
|
|
39
|
-
* @param
|
|
40
|
-
* @param
|
|
41
|
-
* @param
|
|
39
|
+
* @param type - filter type string used for log messages
|
|
40
|
+
* @param values - list of values to validate, deduplicate and sort
|
|
41
|
+
* @param maxLength - max length allowed for the list of values
|
|
42
42
|
* @returns list of valid, unique and alphabetically sorted non-empty strings. The list is empty if `values` param is not a non-empty array or all its values are invalid.
|
|
43
43
|
*
|
|
44
44
|
* @throws Error if the sanitized list exceeds the length indicated by `maxLength`
|
|
@@ -67,7 +67,7 @@ function validateSplitFilter(log, type, values, maxLength) {
|
|
|
67
67
|
* - '&prefixes=<comma-separated-values>': if only `byName` filter is undefined
|
|
68
68
|
* - '&names=<comma-separated-values>&prefixes=<comma-separated-values>': if no one is undefined
|
|
69
69
|
*
|
|
70
|
-
* @param
|
|
70
|
+
* @param groupedFilters - object of filters. Each filter must be a list of valid, unique and ordered string values.
|
|
71
71
|
* @returns null or string with the `split filter query` component of the URL.
|
|
72
72
|
*/
|
|
73
73
|
function queryStringBuilder(groupedFilters) {
|
|
@@ -83,15 +83,12 @@ function queryStringBuilder(groupedFilters) {
|
|
|
83
83
|
/**
|
|
84
84
|
* Sanitizes set names list taking into account:
|
|
85
85
|
* - It should be lowercase
|
|
86
|
-
* - Must adhere the following regular expression
|
|
86
|
+
* - Must adhere the following regular expression `/^[a-z0-9][_a-z0-9]{0,49}$/` that means
|
|
87
87
|
* - must start with a letter or number
|
|
88
88
|
* - Be in lowercase
|
|
89
89
|
* - Be alphanumeric
|
|
90
90
|
* - have a max length of 50 characters
|
|
91
91
|
*
|
|
92
|
-
* @param {ILogger} log
|
|
93
|
-
* @param {string[]} flagSets
|
|
94
|
-
* @param {string} method
|
|
95
92
|
* @returns sanitized list of set names
|
|
96
93
|
*/
|
|
97
94
|
function sanitizeFlagSets(log, flagSets, method) {
|
|
@@ -120,9 +117,9 @@ function configuredFilter(validFilters, filterType) {
|
|
|
120
117
|
/**
|
|
121
118
|
* Validates `splitFilters` configuration object and parses it into a query string for filtering splits on `/splitChanges` fetch.
|
|
122
119
|
*
|
|
123
|
-
* @param
|
|
124
|
-
* @param
|
|
125
|
-
* @param
|
|
120
|
+
* @param log - logger
|
|
121
|
+
* @param maybeSplitFilters - split filters configuration param provided by the user
|
|
122
|
+
* @param mode - settings mode
|
|
126
123
|
* @returns it returns an object with the following properties:
|
|
127
124
|
* - `validFilters`: the validated `splitFilters` configuration object defined by the user.
|
|
128
125
|
* - `queryString`: the parsed split filter query. it is null if all filters are invalid or all values in filters are invalid.
|
|
@@ -14,9 +14,9 @@ __InLocalStorageMockFactory.type = constants_2.STORAGE_MEMORY;
|
|
|
14
14
|
/**
|
|
15
15
|
* This function validates `settings.storage` object
|
|
16
16
|
*
|
|
17
|
-
* @param
|
|
17
|
+
* @param settings - config object provided by the user to initialize the sdk
|
|
18
18
|
*
|
|
19
|
-
* @returns
|
|
19
|
+
* @returns valid storage factory. Default to `InMemoryStorageCSFactory` if the provided storage is invalid or not compatible with the sdk mode if mode is standalone or localhost
|
|
20
20
|
*
|
|
21
21
|
* @throws error if mode is consumer and the provided storage is not compatible
|
|
22
22
|
*/
|
|
@@ -9,9 +9,9 @@ var streamingEndpointMatcher = /^\/(sse|event-stream)/;
|
|
|
9
9
|
* Get URL based on a given target (path).
|
|
10
10
|
* ATM, it is only used for testing purposes.
|
|
11
11
|
*
|
|
12
|
-
* @param settings settings object
|
|
13
|
-
* @param target url path
|
|
14
|
-
* @
|
|
12
|
+
* @param settings - settings object
|
|
13
|
+
* @param target - url path
|
|
14
|
+
* @returns complete url
|
|
15
15
|
*/
|
|
16
16
|
function url(settings, target) {
|
|
17
17
|
if (telemetryEndpointMatcher.test(target)) {
|
|
@@ -3,8 +3,8 @@ import { SPLIT_IMPRESSION, SPLIT_EVENT } from '../utils/constants';
|
|
|
3
3
|
* Factory function for IntegrationsManager with pluggable integrations.
|
|
4
4
|
* The integrations manager instantiates integration, and bypass tracked events and impressions to them.
|
|
5
5
|
*
|
|
6
|
-
* @param integrations validated list of integration factories
|
|
7
|
-
* @param params information of the Sdk factory instance that integrations can access to
|
|
6
|
+
* @param integrations - validated list of integration factories
|
|
7
|
+
* @param params - information of the Sdk factory instance that integrations can access to
|
|
8
8
|
*
|
|
9
9
|
* @returns integration manager or undefined if `integrations` are not present in settings.
|
|
10
10
|
*/
|
package/esm/logger/sdkLogger.js
CHANGED
|
@@ -3,7 +3,7 @@ import { ERROR_LOGLEVEL_INVALID } from './constants';
|
|
|
3
3
|
/**
|
|
4
4
|
* The public Logger utility API exposed via SplitFactory, used to update the log level.
|
|
5
5
|
*
|
|
6
|
-
* @param log the factory logger instance to handle
|
|
6
|
+
* @param log - the factory logger instance to handle
|
|
7
7
|
*/
|
|
8
8
|
export function createLoggerAPI(log) {
|
|
9
9
|
function setLogLevel(logLevel) {
|
|
@@ -23,7 +23,7 @@ export function createLoggerAPI(log) {
|
|
|
23
23
|
},
|
|
24
24
|
/**
|
|
25
25
|
* Sets a custom log Level for the SDK.
|
|
26
|
-
* @param
|
|
26
|
+
* @param logLevel - Custom LogLevel value.
|
|
27
27
|
*/
|
|
28
28
|
setLogLevel: setLogLevel,
|
|
29
29
|
/**
|
|
@@ -9,8 +9,8 @@ var REMOVE_LISTENER_EVENT = 'removeListener';
|
|
|
9
9
|
* SdkReadinessManager factory, which provides the public status API of SDK clients and manager: ready promise, readiness event emitter and constants (SDK_READY, etc).
|
|
10
10
|
* It also updates logs related warnings and errors.
|
|
11
11
|
*
|
|
12
|
-
* @param readyTimeout time in millis to emit SDK_READY_TIME_OUT event
|
|
13
|
-
* @param readinessManager optional readinessManager to use. only used internally for `shared` method
|
|
12
|
+
* @param readyTimeout - time in millis to emit SDK_READY_TIME_OUT event
|
|
13
|
+
* @param readinessManager - optional readinessManager to use. only used internally for `shared` method
|
|
14
14
|
*/
|
|
15
15
|
export function sdkReadinessManagerFactory(EventEmitter, settings, readinessManager) {
|
|
16
16
|
if (readinessManager === void 0) { readinessManager = readinessManagerFactory(EventEmitter, settings); }
|
|
@@ -73,25 +73,6 @@ export function sdkReadinessManagerFactory(EventEmitter, settings, readinessMana
|
|
|
73
73
|
SDK_UPDATE: SDK_UPDATE,
|
|
74
74
|
SDK_READY_TIMED_OUT: SDK_READY_TIMED_OUT,
|
|
75
75
|
},
|
|
76
|
-
/**
|
|
77
|
-
* Returns a promise that will be resolved once the SDK has finished loading (SDK_READY event emitted) or rejected if the SDK has timedout (SDK_READY_TIMED_OUT event emitted).
|
|
78
|
-
* As it's meant to provide similar flexibility to the event approach, given that the SDK might be eventually ready after a timeout event, calling the `ready` method after the
|
|
79
|
-
* SDK had timed out will return a new promise that should eventually resolve if the SDK gets ready.
|
|
80
|
-
*
|
|
81
|
-
* Caveats: the method was designed to avoid an unhandled Promise rejection if the rejection case is not handled, so that `onRejected` handler is optional when using promises.
|
|
82
|
-
* However, when using async/await syntax, the rejection should be explicitly propagated like in the following example:
|
|
83
|
-
* ```
|
|
84
|
-
* try {
|
|
85
|
-
* await client.ready().catch((e) => { throw e; });
|
|
86
|
-
* // SDK is ready
|
|
87
|
-
* } catch(e) {
|
|
88
|
-
* // SDK has timedout
|
|
89
|
-
* }
|
|
90
|
-
* ```
|
|
91
|
-
*
|
|
92
|
-
* @function ready
|
|
93
|
-
* @returns {Promise<void>}
|
|
94
|
-
*/
|
|
95
76
|
ready: function () {
|
|
96
77
|
if (readinessManager.hasTimedout()) {
|
|
97
78
|
if (!readinessManager.isReady()) {
|
package/esm/sdkClient/client.js
CHANGED
|
@@ -63,9 +63,9 @@ export function clientAttributesDecoration(log, client) {
|
|
|
63
63
|
/**
|
|
64
64
|
* Add an attribute to client's in memory attributes storage
|
|
65
65
|
*
|
|
66
|
-
* @param
|
|
67
|
-
* @param
|
|
68
|
-
* @returns
|
|
66
|
+
* @param attributeName - Attribute name
|
|
67
|
+
* @param attributeValue - Attribute value
|
|
68
|
+
* @returns true if the attribute was stored and false otherways
|
|
69
69
|
*/
|
|
70
70
|
setAttribute: function (attributeName, attributeValue) {
|
|
71
71
|
var attribute = {};
|
|
@@ -78,8 +78,8 @@ export function clientAttributesDecoration(log, client) {
|
|
|
78
78
|
/**
|
|
79
79
|
* Returns the attribute with the given name
|
|
80
80
|
*
|
|
81
|
-
* @param
|
|
82
|
-
* @returns
|
|
81
|
+
* @param attributeName - Attribute name
|
|
82
|
+
* @returns Attribute with the given name
|
|
83
83
|
*/
|
|
84
84
|
getAttribute: function (attributeName) {
|
|
85
85
|
log.debug("retrieved attribute " + attributeName);
|
|
@@ -88,7 +88,7 @@ export function clientAttributesDecoration(log, client) {
|
|
|
88
88
|
/**
|
|
89
89
|
* Add to client's in memory attributes storage the attributes in 'attributes'
|
|
90
90
|
*
|
|
91
|
-
* @param
|
|
91
|
+
* @param attributes - Object with attributes to store
|
|
92
92
|
* @returns true if attributes were stored an false otherways
|
|
93
93
|
*/
|
|
94
94
|
setAttributes: function (attributes) {
|
|
@@ -99,7 +99,7 @@ export function clientAttributesDecoration(log, client) {
|
|
|
99
99
|
/**
|
|
100
100
|
* Return all the attributes stored in client's in memory attributes storage
|
|
101
101
|
*
|
|
102
|
-
* @returns
|
|
102
|
+
* @returns returns all the stored attributes
|
|
103
103
|
*/
|
|
104
104
|
getAttributes: function () {
|
|
105
105
|
return attributeStorage.getAll();
|
|
@@ -107,8 +107,8 @@ export function clientAttributesDecoration(log, client) {
|
|
|
107
107
|
/**
|
|
108
108
|
* Removes from client's in memory attributes storage the attribute with the given name
|
|
109
109
|
*
|
|
110
|
-
* @param
|
|
111
|
-
* @returns
|
|
110
|
+
* @param attributeName - Attribute name
|
|
111
|
+
* @returns true if attribute was removed and false otherways
|
|
112
112
|
*/
|
|
113
113
|
removeAttribute: function (attributeName) {
|
|
114
114
|
log.debug("removed attribute " + attributeName);
|
|
@@ -3,8 +3,8 @@ import { clientAttributesDecoration } from './clientAttributesDecoration';
|
|
|
3
3
|
/**
|
|
4
4
|
* Decorator that binds a key to client methods
|
|
5
5
|
*
|
|
6
|
-
* @param client sync client instance
|
|
7
|
-
* @param key validated split key
|
|
6
|
+
* @param client - sync client instance
|
|
7
|
+
* @param key - validated split key
|
|
8
8
|
*/
|
|
9
9
|
export function clientCSDecorator(log, client, key) {
|
|
10
10
|
var clientCS = clientAttributesDecoration(log, client);
|
package/esm/services/splitApi.js
CHANGED
|
@@ -9,9 +9,9 @@ function userKeyToQueryParam(userKey) {
|
|
|
9
9
|
/**
|
|
10
10
|
* Factory of SplitApi objects, which group the collection of Split HTTP endpoints used by the SDK
|
|
11
11
|
*
|
|
12
|
-
* @param settings validated settings object
|
|
13
|
-
* @param platform object containing environment-specific dependencies
|
|
14
|
-
* @param telemetryTracker telemetry tracker
|
|
12
|
+
* @param settings - validated settings object
|
|
13
|
+
* @param platform - object containing environment-specific dependencies
|
|
14
|
+
* @param telemetryTracker - telemetry tracker
|
|
15
15
|
*/
|
|
16
16
|
export function splitApiFactory(settings, platform, telemetryTracker) {
|
|
17
17
|
var urls = settings.urls;
|
|
@@ -64,8 +64,8 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
64
64
|
/**
|
|
65
65
|
* Post events.
|
|
66
66
|
*
|
|
67
|
-
* @param body Events bulk payload
|
|
68
|
-
* @param headers Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
67
|
+
* @param body - Events bulk payload
|
|
68
|
+
* @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
69
69
|
*/
|
|
70
70
|
postEventsBulk: function (body, headers) {
|
|
71
71
|
var url = urls.events + "/events/bulk";
|
|
@@ -74,8 +74,8 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
74
74
|
/**
|
|
75
75
|
* Post impressions.
|
|
76
76
|
*
|
|
77
|
-
* @param body Impressions bulk payload
|
|
78
|
-
* @param headers Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
77
|
+
* @param body - Impressions bulk payload
|
|
78
|
+
* @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
79
79
|
*/
|
|
80
80
|
postTestImpressionsBulk: function (body, headers) {
|
|
81
81
|
var url = urls.events + "/testImpressions/bulk";
|
|
@@ -89,8 +89,8 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
89
89
|
/**
|
|
90
90
|
* Post impressions counts.
|
|
91
91
|
*
|
|
92
|
-
* @param body Impressions counts payload
|
|
93
|
-
* @param headers Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
92
|
+
* @param body - Impressions counts payload
|
|
93
|
+
* @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
94
94
|
*/
|
|
95
95
|
postTestImpressionsCount: function (body, headers) {
|
|
96
96
|
var url = urls.events + "/testImpressions/count";
|
|
@@ -99,8 +99,8 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
99
99
|
/**
|
|
100
100
|
* Post unique keys for client side.
|
|
101
101
|
*
|
|
102
|
-
* @param body unique keys payload
|
|
103
|
-
* @param headers Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
102
|
+
* @param body - unique keys payload
|
|
103
|
+
* @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
104
104
|
*/
|
|
105
105
|
postUniqueKeysBulkCs: function (body, headers) {
|
|
106
106
|
var url = urls.telemetry + "/v1/keys/cs";
|
|
@@ -109,8 +109,8 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
109
109
|
/**
|
|
110
110
|
* Post unique keys for server side.
|
|
111
111
|
*
|
|
112
|
-
* @param body unique keys payload
|
|
113
|
-
* @param headers Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
112
|
+
* @param body - unique keys payload
|
|
113
|
+
* @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
114
114
|
*/
|
|
115
115
|
postUniqueKeysBulkSs: function (body, headers) {
|
|
116
116
|
var url = urls.telemetry + "/v1/keys/ss";
|
|
@@ -5,8 +5,8 @@ var messageNoFetch = 'Global fetch API is not available.';
|
|
|
5
5
|
/**
|
|
6
6
|
* Factory of Split HTTP clients, which are HTTP clients with predefined headers for Split endpoints.
|
|
7
7
|
*
|
|
8
|
-
* @param settings SDK settings, used to access authorizationKey, logger instance and metadata (SDK version, ip and hostname) to set additional headers
|
|
9
|
-
* @param platform object containing environment-specific dependencies
|
|
8
|
+
* @param settings - SDK settings, used to access authorizationKey, logger instance and metadata (SDK version, ip and hostname) to set additional headers
|
|
9
|
+
* @param platform - object containing environment-specific dependencies
|
|
10
10
|
*/
|
|
11
11
|
export function splitHttpClientFactory(settings, _a) {
|
|
12
12
|
var getOptions = _a.getOptions, getFetch = _a.getFetch;
|
|
@@ -22,10 +22,7 @@ var AbstractSplitsCacheAsync = /** @class */ (function () {
|
|
|
22
22
|
* Kill `name` split and set `defaultTreatment` and `changeNumber`.
|
|
23
23
|
* Used for SPLIT_KILL push notifications.
|
|
24
24
|
*
|
|
25
|
-
* @
|
|
26
|
-
* @param {string} defaultTreatment
|
|
27
|
-
* @param {number} changeNumber
|
|
28
|
-
* @returns {Promise} a promise that is resolved once the split kill operation is performed. The fulfillment value is a boolean: `true` if the operation successed updating the split or `false` if no split is updated,
|
|
25
|
+
* @returns a promise that is resolved once the split kill operation is performed. The fulfillment value is a boolean: `true` if the operation successed updating the split or `false` if no split is updated,
|
|
29
26
|
* for instance, if the `changeNumber` is old, or if the split is not found (e.g., `/splitchanges` hasn't been fetched yet), or if the storage fails to apply the update.
|
|
30
27
|
* The promise will never be rejected.
|
|
31
28
|
*/
|
|
@@ -38,10 +38,7 @@ var AbstractSplitsCacheSync = /** @class */ (function () {
|
|
|
38
38
|
* Kill `name` split and set `defaultTreatment` and `changeNumber`.
|
|
39
39
|
* Used for SPLIT_KILL push notifications.
|
|
40
40
|
*
|
|
41
|
-
* @
|
|
42
|
-
* @param {string} defaultTreatment
|
|
43
|
-
* @param {number} changeNumber
|
|
44
|
-
* @returns {boolean} `true` if the operation successed updating the split, or `false` if no split is updated,
|
|
41
|
+
* @returns `true` if the operation successed updating the split, or `false` if no split is updated,
|
|
45
42
|
* for instance, if the `changeNumber` is old, or if the split is not found (e.g., `/splitchanges` hasn't been fetched yet), or if the storage fails to apply the update.
|
|
46
43
|
*/
|
|
47
44
|
AbstractSplitsCacheSync.prototype.killLocally = function (name, defaultTreatment, changeNumber) {
|
|
@@ -2,7 +2,7 @@ import { DEFAULT_CACHE_EXPIRATION_IN_MILLIS } from '../utils/constants/browser';
|
|
|
2
2
|
/**
|
|
3
3
|
* Factory of client-side storage loader
|
|
4
4
|
*
|
|
5
|
-
* @param preloadedData validated data following the format proposed in https://github.com/godaddy/split-javascript-data-loader
|
|
5
|
+
* @param preloadedData - validated data following the format proposed in https://github.com/godaddy/split-javascript-data-loader
|
|
6
6
|
* and extended with a `mySegmentsData` property.
|
|
7
7
|
* @returns function to preload the storage
|
|
8
8
|
*/
|
|
@@ -11,12 +11,11 @@ export function dataLoaderFactory(preloadedData) {
|
|
|
11
11
|
* Storage-agnostic adaptation of `loadDataIntoLocalStorage` function
|
|
12
12
|
* (https://github.com/godaddy/split-javascript-data-loader/blob/master/src/load-data.js)
|
|
13
13
|
*
|
|
14
|
-
* @param storage object containing `splits` and `segments` cache (client-side variant)
|
|
15
|
-
* @param userId user key string of the provided MySegmentsCache
|
|
16
|
-
*
|
|
17
|
-
* @TODO extend to support SegmentsCache (server-side variant) by making `userId` optional and adding the corresponding logic.
|
|
18
|
-
* @TODO extend to load data on shared mySegments storages. Be specific when emitting SDK_READY_FROM_CACHE on shared clients. Maybe the serializer should provide the `useSegments` flag.
|
|
14
|
+
* @param storage - object containing `splits` and `segments` cache (client-side variant)
|
|
15
|
+
* @param userId - user key string of the provided MySegmentsCache
|
|
19
16
|
*/
|
|
17
|
+
// @TODO extend to support SegmentsCache (server-side variant) by making `userId` optional and adding the corresponding logic.
|
|
18
|
+
// @TODO extend to load data on shared mySegments storages. Be specific when emitting SDK_READY_FROM_CACHE on shared clients. Maybe the serializer should provide the `useSegments` flag.
|
|
20
19
|
return function loadData(storage, userId) {
|
|
21
20
|
// Do not load data if current preloadedData is empty
|
|
22
21
|
if (Object.keys(preloadedData).length === 0)
|
|
@@ -9,11 +9,6 @@ import { setToArray } from '../../utils/lang/sets';
|
|
|
9
9
|
*/
|
|
10
10
|
var SplitsCacheInLocal = /** @class */ (function (_super) {
|
|
11
11
|
__extends(SplitsCacheInLocal, _super);
|
|
12
|
-
/**
|
|
13
|
-
* @param {KeyBuilderCS} keys
|
|
14
|
-
* @param {number | undefined} expirationTimestamp
|
|
15
|
-
* @param {ISplitFiltersValidation} splitFiltersValidation
|
|
16
|
-
*/
|
|
17
12
|
function SplitsCacheInLocal(settings, keys, expirationTimestamp) {
|
|
18
13
|
var _this = _super.call(this) || this;
|
|
19
14
|
_this.keys = keys;
|
|
@@ -194,7 +189,7 @@ var SplitsCacheInLocal = /** @class */ (function (_super) {
|
|
|
194
189
|
/**
|
|
195
190
|
* Clean Splits cache if its `lastUpdated` timestamp is older than the given `expirationTimestamp`,
|
|
196
191
|
*
|
|
197
|
-
* @param
|
|
192
|
+
* @param expirationTimestamp - if the value is not a number, data will not be cleaned
|
|
198
193
|
*/
|
|
199
194
|
SplitsCacheInLocal.prototype._checkExpiration = function (expirationTimestamp) {
|
|
200
195
|
var value = localStorage.getItem(this.keys.buildLastUpdatedKey());
|
|
@@ -6,9 +6,9 @@ var AttributesCacheInMemory = /** @class */ (function () {
|
|
|
6
6
|
/**
|
|
7
7
|
* Create or update the value for the given attribute
|
|
8
8
|
*
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
11
|
-
* @returns
|
|
9
|
+
* @param attributeName - attribute name
|
|
10
|
+
* @param attributeValue - attribute value
|
|
11
|
+
* @returns the attribute was stored
|
|
12
12
|
*/
|
|
13
13
|
AttributesCacheInMemory.prototype.setAttribute = function (attributeName, attributeValue) {
|
|
14
14
|
this.attributesCache[attributeName] = attributeValue;
|
|
@@ -17,8 +17,8 @@ var AttributesCacheInMemory = /** @class */ (function () {
|
|
|
17
17
|
/**
|
|
18
18
|
* Retrieves the value of a given attribute
|
|
19
19
|
*
|
|
20
|
-
* @param
|
|
21
|
-
* @returns
|
|
20
|
+
* @param attributeName - attribute name
|
|
21
|
+
* @returns stored attribute value
|
|
22
22
|
*/
|
|
23
23
|
AttributesCacheInMemory.prototype.getAttribute = function (attributeName) {
|
|
24
24
|
return this.attributesCache[attributeName];
|
|
@@ -26,8 +26,8 @@ var AttributesCacheInMemory = /** @class */ (function () {
|
|
|
26
26
|
/**
|
|
27
27
|
* Create or update all the given attributes
|
|
28
28
|
*
|
|
29
|
-
* @param
|
|
30
|
-
* @returns
|
|
29
|
+
* @param attributes - attributes to create or update
|
|
30
|
+
* @returns attributes were stored
|
|
31
31
|
*/
|
|
32
32
|
AttributesCacheInMemory.prototype.setAttributes = function (attributes) {
|
|
33
33
|
this.attributesCache = objectAssign(this.attributesCache, attributes);
|
|
@@ -36,7 +36,7 @@ var AttributesCacheInMemory = /** @class */ (function () {
|
|
|
36
36
|
/**
|
|
37
37
|
* Retrieve the full attributes map
|
|
38
38
|
*
|
|
39
|
-
* @returns
|
|
39
|
+
* @returns stored attributes
|
|
40
40
|
*/
|
|
41
41
|
AttributesCacheInMemory.prototype.getAll = function () {
|
|
42
42
|
return this.attributesCache;
|
|
@@ -44,8 +44,8 @@ var AttributesCacheInMemory = /** @class */ (function () {
|
|
|
44
44
|
/**
|
|
45
45
|
* Removes a given attribute from the map
|
|
46
46
|
*
|
|
47
|
-
* @param
|
|
48
|
-
* @returns
|
|
47
|
+
* @param attributeName - attribute to remove
|
|
48
|
+
* @returns attribute removed
|
|
49
49
|
*/
|
|
50
50
|
AttributesCacheInMemory.prototype.removeAttribute = function (attributeName) {
|
|
51
51
|
if (Object.keys(this.attributesCache).indexOf(attributeName) >= 0) {
|
|
@@ -2,7 +2,7 @@ var MAX_QUEUE_BYTE_SIZE = 5 * 1024 * 1024; // 5M
|
|
|
2
2
|
var EventsCacheInMemory = /** @class */ (function () {
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
|
-
* @param eventsQueueSize number of queued events to call onFullQueueCb.
|
|
5
|
+
* @param eventsQueueSize - number of queued events to call onFullQueueCb.
|
|
6
6
|
* Default value is 0, that means no maximum value, in case we want to avoid this being triggered.
|
|
7
7
|
*/
|
|
8
8
|
function EventsCacheInMemory(eventsQueueSize) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var ImpressionsCacheInMemory = /** @class */ (function () {
|
|
2
2
|
/**
|
|
3
3
|
*
|
|
4
|
-
* @param impressionsQueueSize number of queued impressions to call onFullQueueCb.
|
|
4
|
+
* @param impressionsQueueSize - number of queued impressions to call onFullQueueCb.
|
|
5
5
|
* Default value is 0, that means no maximum value, in case we want to avoid this being triggered.
|
|
6
6
|
*/
|
|
7
7
|
function ImpressionsCacheInMemory(impressionsQueueSize) {
|
|
@@ -9,7 +9,7 @@ import { UniqueKeysCacheInMemory } from './UniqueKeysCacheInMemory';
|
|
|
9
9
|
/**
|
|
10
10
|
* InMemory storage factory for standalone server-side SplitFactory
|
|
11
11
|
*
|
|
12
|
-
* @param params parameters required by EventsCacheSync
|
|
12
|
+
* @param params - parameters required by EventsCacheSync
|
|
13
13
|
*/
|
|
14
14
|
export function InMemoryStorageFactory(params) {
|
|
15
15
|
var _a = params.settings, _b = _a.scheduler, impressionsQueueSize = _b.impressionsQueueSize, eventsQueueSize = _b.eventsQueueSize, _c = _a.sync, impressionsMode = _c.impressionsMode, __splitFiltersValidation = _c.__splitFiltersValidation;
|
|
@@ -9,7 +9,7 @@ import { UniqueKeysCacheInMemoryCS } from './UniqueKeysCacheInMemoryCS';
|
|
|
9
9
|
/**
|
|
10
10
|
* InMemory storage factory for standalone client-side SplitFactory
|
|
11
11
|
*
|
|
12
|
-
* @param params parameters required by EventsCacheSync
|
|
12
|
+
* @param params - parameters required by EventsCacheSync
|
|
13
13
|
*/
|
|
14
14
|
export function InMemoryStorageCSFactory(params) {
|
|
15
15
|
var _a = params.settings, _b = _a.scheduler, impressionsQueueSize = _b.impressionsQueueSize, eventsQueueSize = _b.eventsQueueSize, _c = _a.sync, impressionsMode = _c.impressionsMode, __splitFiltersValidation = _c.__splitFiltersValidation;
|
|
@@ -3,7 +3,7 @@ import { setToArray } from '../../utils/lang/sets';
|
|
|
3
3
|
var UniqueKeysCacheInMemoryCS = /** @class */ (function () {
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
6
|
-
* @param impressionsQueueSize number of queued impressions to call onFullQueueCb.
|
|
6
|
+
* @param impressionsQueueSize - number of queued impressions to call onFullQueueCb.
|
|
7
7
|
* Default value is 0, that means no maximum value, in case we want to avoid this being triggered.
|
|
8
8
|
*/
|
|
9
9
|
function UniqueKeysCacheInMemoryCS(uniqueKeysQueueSize) {
|
|
@@ -161,10 +161,8 @@ var SplitsCacheInRedis = /** @class */ (function (_super) {
|
|
|
161
161
|
* Get list of all split definitions.
|
|
162
162
|
* The returned promise is resolved with the list of split definitions,
|
|
163
163
|
* or rejected if redis operation fails.
|
|
164
|
-
*
|
|
165
|
-
* @TODO we need to benchmark which is the maximun number of commands we could
|
|
166
|
-
* pipeline without kill redis performance.
|
|
167
164
|
*/
|
|
165
|
+
// @TODO we need to benchmark which is the maximun number of commands we could pipeline without kill redis performance.
|
|
168
166
|
SplitsCacheInRedis.prototype.getAll = function () {
|
|
169
167
|
var _this = this;
|
|
170
168
|
return this.redis.keys(this.keys.searchPatternForSplitKeys())
|
|
@@ -7,9 +7,9 @@ import { parseLatencyField, parseExceptionField, parseMetadata } from '../utils'
|
|
|
7
7
|
var TelemetryCacheInRedis = /** @class */ (function () {
|
|
8
8
|
/**
|
|
9
9
|
* Create a Telemetry cache that uses Redis as storage.
|
|
10
|
-
* @param log Logger instance.
|
|
11
|
-
* @param keys Key builder.
|
|
12
|
-
* @param redis Redis client.
|
|
10
|
+
* @param log - Logger instance.
|
|
11
|
+
* @param keys - Key builder.
|
|
12
|
+
* @param redis - Redis client.
|
|
13
13
|
*/
|
|
14
14
|
function TelemetryCacheInRedis(log, keys, redis) {
|
|
15
15
|
this.log = log;
|
|
@@ -51,7 +51,7 @@ var UniqueKeysCacheInRedis = /** @class */ (function (_super) {
|
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
53
|
* Async consumer API, used by synchronizer.
|
|
54
|
-
* @param count number of items to pop from the queue. If not provided or equal 0, all items will be popped.
|
|
54
|
+
* @param count - number of items to pop from the queue. If not provided or equal 0, all items will be popped.
|
|
55
55
|
*/
|
|
56
56
|
UniqueKeysCacheInRedis.prototype.popNRaw = function (count) {
|
|
57
57
|
var _this = this;
|
|
@@ -8,7 +8,7 @@ var EventsCachePluggable = /** @class */ (function () {
|
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Push given event to the storage.
|
|
11
|
-
* @param eventData Event item to push.
|
|
11
|
+
* @param eventData - Event item to push.
|
|
12
12
|
* @returns A promise that is resolved with a boolean value indicating if the push operation succeeded or failed.
|
|
13
13
|
* Unlike `impressions::track`, The promise will never be rejected.
|
|
14
14
|
*/
|
|
@@ -8,7 +8,7 @@ var ImpressionsCachePluggable = /** @class */ (function () {
|
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Push given impressions to the storage.
|
|
11
|
-
* @param impressions List of impresions to push.
|
|
11
|
+
* @param impressions - List of impresions to push.
|
|
12
12
|
* @returns A promise that is resolved if the push operation succeeded
|
|
13
13
|
* or rejected if the wrapper operation fails.
|
|
14
14
|
*/
|
|
@@ -68,7 +68,7 @@ var SegmentsCachePluggable = /** @class */ (function () {
|
|
|
68
68
|
SegmentsCachePluggable.prototype.getRegisteredSegments = function () {
|
|
69
69
|
return this.wrapper.getItems(this.keys.buildRegisteredSegmentsKey());
|
|
70
70
|
};
|
|
71
|
-
|
|
71
|
+
// @TODO implement if required by DataLoader or Producer mode
|
|
72
72
|
SegmentsCachePluggable.prototype.clear = function () {
|
|
73
73
|
return Promise.resolve(true);
|
|
74
74
|
};
|
|
@@ -10,9 +10,9 @@ var SplitsCachePluggable = /** @class */ (function (_super) {
|
|
|
10
10
|
__extends(SplitsCachePluggable, _super);
|
|
11
11
|
/**
|
|
12
12
|
* Create a SplitsCache that uses a storage wrapper.
|
|
13
|
-
* @param log Logger instance.
|
|
14
|
-
* @param keys Key builder.
|
|
15
|
-
* @param wrapper Adapted wrapper storage.
|
|
13
|
+
* @param log - Logger instance.
|
|
14
|
+
* @param keys - Key builder.
|
|
15
|
+
* @param wrapper - Adapted wrapper storage.
|
|
16
16
|
*/
|
|
17
17
|
function SplitsCachePluggable(log, keys, wrapper, splitFiltersValidation) {
|
|
18
18
|
var _this = _super.call(this) || this;
|
|
@@ -7,9 +7,9 @@ import { parseLatencyField, parseExceptionField, parseMetadata } from '../utils'
|
|
|
7
7
|
var TelemetryCachePluggable = /** @class */ (function () {
|
|
8
8
|
/**
|
|
9
9
|
* Create a Telemetry cache that uses a storage wrapper.
|
|
10
|
-
* @param log Logger instance.
|
|
11
|
-
* @param keys Key builder.
|
|
12
|
-
* @param wrapper Adapted wrapper storage.
|
|
10
|
+
* @param log - Logger instance.
|
|
11
|
+
* @param keys - Key builder.
|
|
12
|
+
* @param wrapper - Adapted wrapper storage.
|
|
13
13
|
*/
|
|
14
14
|
function TelemetryCachePluggable(log, keys, wrapper) {
|
|
15
15
|
this.log = log;
|