@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
package/CHANGES.txt
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
2.0.0 (October XX, 2024)
|
|
2
2
|
- Added support for targeting rules based on large segments.
|
|
3
3
|
- Added `factory.destroy()` method, which invokes the `destroy` method on all SDK clients created by the factory.
|
|
4
|
+
- Added `SplitIO` namespace with the public TypeScript definitions to be reused by the SDKs, rather than having each SDK define its own types.
|
|
4
5
|
- Updated the handling of timers and async operations inside an `init` factory method to enable lazy initialization of the SDK in standalone mode. This update is intended for the React SDK.
|
|
5
6
|
- Bugfixing - Fixed an issue with the server-side polling manager that caused dangling timers when the SDK was destroyed before it was ready.
|
|
6
7
|
- BREAKING CHANGES:
|
|
@@ -6,8 +6,8 @@ var constants_1 = require("../utils/constants");
|
|
|
6
6
|
* Factory function for IntegrationsManager with pluggable integrations.
|
|
7
7
|
* The integrations manager instantiates integration, and bypass tracked events and impressions to them.
|
|
8
8
|
*
|
|
9
|
-
* @param integrations validated list of integration factories
|
|
10
|
-
* @param params information of the Sdk factory instance that integrations can access to
|
|
9
|
+
* @param integrations - validated list of integration factories
|
|
10
|
+
* @param params - information of the Sdk factory instance that integrations can access to
|
|
11
11
|
*
|
|
12
12
|
* @returns integration manager or undefined if `integrations` are not present in settings.
|
|
13
13
|
*/
|
package/cjs/logger/sdkLogger.js
CHANGED
|
@@ -6,7 +6,7 @@ var constants_1 = require("./constants");
|
|
|
6
6
|
/**
|
|
7
7
|
* The public Logger utility API exposed via SplitFactory, used to update the log level.
|
|
8
8
|
*
|
|
9
|
-
* @param log the factory logger instance to handle
|
|
9
|
+
* @param log - the factory logger instance to handle
|
|
10
10
|
*/
|
|
11
11
|
function createLoggerAPI(log) {
|
|
12
12
|
function setLogLevel(logLevel) {
|
|
@@ -26,7 +26,7 @@ function createLoggerAPI(log) {
|
|
|
26
26
|
},
|
|
27
27
|
/**
|
|
28
28
|
* Sets a custom log Level for the SDK.
|
|
29
|
-
* @param
|
|
29
|
+
* @param logLevel - Custom LogLevel value.
|
|
30
30
|
*/
|
|
31
31
|
setLogLevel: setLogLevel,
|
|
32
32
|
/**
|
|
@@ -12,8 +12,8 @@ var REMOVE_LISTENER_EVENT = 'removeListener';
|
|
|
12
12
|
* SdkReadinessManager factory, which provides the public status API of SDK clients and manager: ready promise, readiness event emitter and constants (SDK_READY, etc).
|
|
13
13
|
* It also updates logs related warnings and errors.
|
|
14
14
|
*
|
|
15
|
-
* @param readyTimeout time in millis to emit SDK_READY_TIME_OUT event
|
|
16
|
-
* @param readinessManager optional readinessManager to use. only used internally for `shared` method
|
|
15
|
+
* @param readyTimeout - time in millis to emit SDK_READY_TIME_OUT event
|
|
16
|
+
* @param readinessManager - optional readinessManager to use. only used internally for `shared` method
|
|
17
17
|
*/
|
|
18
18
|
function sdkReadinessManagerFactory(EventEmitter, settings, readinessManager) {
|
|
19
19
|
if (readinessManager === void 0) { readinessManager = (0, readinessManager_1.readinessManagerFactory)(EventEmitter, settings); }
|
|
@@ -76,25 +76,6 @@ function sdkReadinessManagerFactory(EventEmitter, settings, readinessManager) {
|
|
|
76
76
|
SDK_UPDATE: constants_1.SDK_UPDATE,
|
|
77
77
|
SDK_READY_TIMED_OUT: constants_1.SDK_READY_TIMED_OUT,
|
|
78
78
|
},
|
|
79
|
-
/**
|
|
80
|
-
* 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).
|
|
81
|
-
* 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
|
|
82
|
-
* SDK had timed out will return a new promise that should eventually resolve if the SDK gets ready.
|
|
83
|
-
*
|
|
84
|
-
* 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.
|
|
85
|
-
* However, when using async/await syntax, the rejection should be explicitly propagated like in the following example:
|
|
86
|
-
* ```
|
|
87
|
-
* try {
|
|
88
|
-
* await client.ready().catch((e) => { throw e; });
|
|
89
|
-
* // SDK is ready
|
|
90
|
-
* } catch(e) {
|
|
91
|
-
* // SDK has timedout
|
|
92
|
-
* }
|
|
93
|
-
* ```
|
|
94
|
-
*
|
|
95
|
-
* @function ready
|
|
96
|
-
* @returns {Promise<void>}
|
|
97
|
-
*/
|
|
98
79
|
ready: function () {
|
|
99
80
|
if (readinessManager.hasTimedout()) {
|
|
100
81
|
if (!readinessManager.isReady()) {
|
package/cjs/sdkClient/client.js
CHANGED
|
@@ -165,7 +165,6 @@ function clientFactory(params) {
|
|
|
165
165
|
getTreatmentsByFlagSet: getTreatmentsByFlagSet,
|
|
166
166
|
getTreatmentsWithConfigByFlagSet: getTreatmentsWithConfigByFlagSet,
|
|
167
167
|
track: track,
|
|
168
|
-
isClientSide: false
|
|
169
168
|
};
|
|
170
169
|
}
|
|
171
170
|
exports.clientFactory = clientFactory;
|
|
@@ -66,9 +66,9 @@ function clientAttributesDecoration(log, client) {
|
|
|
66
66
|
/**
|
|
67
67
|
* Add an attribute to client's in memory attributes storage
|
|
68
68
|
*
|
|
69
|
-
* @param
|
|
70
|
-
* @param
|
|
71
|
-
* @returns
|
|
69
|
+
* @param attributeName - Attribute name
|
|
70
|
+
* @param attributeValue - Attribute value
|
|
71
|
+
* @returns true if the attribute was stored and false otherways
|
|
72
72
|
*/
|
|
73
73
|
setAttribute: function (attributeName, attributeValue) {
|
|
74
74
|
var attribute = {};
|
|
@@ -81,8 +81,8 @@ function clientAttributesDecoration(log, client) {
|
|
|
81
81
|
/**
|
|
82
82
|
* Returns the attribute with the given name
|
|
83
83
|
*
|
|
84
|
-
* @param
|
|
85
|
-
* @returns
|
|
84
|
+
* @param attributeName - Attribute name
|
|
85
|
+
* @returns Attribute with the given name
|
|
86
86
|
*/
|
|
87
87
|
getAttribute: function (attributeName) {
|
|
88
88
|
log.debug("retrieved attribute " + attributeName);
|
|
@@ -91,7 +91,7 @@ function clientAttributesDecoration(log, client) {
|
|
|
91
91
|
/**
|
|
92
92
|
* Add to client's in memory attributes storage the attributes in 'attributes'
|
|
93
93
|
*
|
|
94
|
-
* @param
|
|
94
|
+
* @param attributes - Object with attributes to store
|
|
95
95
|
* @returns true if attributes were stored an false otherways
|
|
96
96
|
*/
|
|
97
97
|
setAttributes: function (attributes) {
|
|
@@ -102,7 +102,7 @@ function clientAttributesDecoration(log, client) {
|
|
|
102
102
|
/**
|
|
103
103
|
* Return all the attributes stored in client's in memory attributes storage
|
|
104
104
|
*
|
|
105
|
-
* @returns
|
|
105
|
+
* @returns returns all the stored attributes
|
|
106
106
|
*/
|
|
107
107
|
getAttributes: function () {
|
|
108
108
|
return attributeStorage.getAll();
|
|
@@ -110,8 +110,8 @@ function clientAttributesDecoration(log, client) {
|
|
|
110
110
|
/**
|
|
111
111
|
* Removes from client's in memory attributes storage the attribute with the given name
|
|
112
112
|
*
|
|
113
|
-
* @param
|
|
114
|
-
* @returns
|
|
113
|
+
* @param attributeName - Attribute name
|
|
114
|
+
* @returns true if attribute was removed and false otherways
|
|
115
115
|
*/
|
|
116
116
|
removeAttribute: function (attributeName) {
|
|
117
117
|
log.debug("removed attribute " + attributeName);
|
|
@@ -6,8 +6,8 @@ var clientAttributesDecoration_1 = require("./clientAttributesDecoration");
|
|
|
6
6
|
/**
|
|
7
7
|
* Decorator that binds a key to client methods
|
|
8
8
|
*
|
|
9
|
-
* @param client sync client instance
|
|
10
|
-
* @param key validated split key
|
|
9
|
+
* @param client - sync client instance
|
|
10
|
+
* @param key - validated split key
|
|
11
11
|
*/
|
|
12
12
|
function clientCSDecorator(log, client, key) {
|
|
13
13
|
var clientCS = (0, clientAttributesDecoration_1.clientAttributesDecoration)(log, client);
|
package/cjs/services/splitApi.js
CHANGED
|
@@ -12,9 +12,9 @@ function userKeyToQueryParam(userKey) {
|
|
|
12
12
|
/**
|
|
13
13
|
* Factory of SplitApi objects, which group the collection of Split HTTP endpoints used by the SDK
|
|
14
14
|
*
|
|
15
|
-
* @param settings validated settings object
|
|
16
|
-
* @param platform object containing environment-specific dependencies
|
|
17
|
-
* @param telemetryTracker telemetry tracker
|
|
15
|
+
* @param settings - validated settings object
|
|
16
|
+
* @param platform - object containing environment-specific dependencies
|
|
17
|
+
* @param telemetryTracker - telemetry tracker
|
|
18
18
|
*/
|
|
19
19
|
function splitApiFactory(settings, platform, telemetryTracker) {
|
|
20
20
|
var urls = settings.urls;
|
|
@@ -67,8 +67,8 @@ function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
67
67
|
/**
|
|
68
68
|
* Post events.
|
|
69
69
|
*
|
|
70
|
-
* @param body Events bulk payload
|
|
71
|
-
* @param headers Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
70
|
+
* @param body - Events bulk payload
|
|
71
|
+
* @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
72
72
|
*/
|
|
73
73
|
postEventsBulk: function (body, headers) {
|
|
74
74
|
var url = urls.events + "/events/bulk";
|
|
@@ -77,8 +77,8 @@ function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
77
77
|
/**
|
|
78
78
|
* Post impressions.
|
|
79
79
|
*
|
|
80
|
-
* @param body Impressions bulk payload
|
|
81
|
-
* @param headers Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
80
|
+
* @param body - Impressions bulk payload
|
|
81
|
+
* @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
82
82
|
*/
|
|
83
83
|
postTestImpressionsBulk: function (body, headers) {
|
|
84
84
|
var url = urls.events + "/testImpressions/bulk";
|
|
@@ -92,8 +92,8 @@ function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
92
92
|
/**
|
|
93
93
|
* Post impressions counts.
|
|
94
94
|
*
|
|
95
|
-
* @param body Impressions counts payload
|
|
96
|
-
* @param headers Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
95
|
+
* @param body - Impressions counts payload
|
|
96
|
+
* @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
97
97
|
*/
|
|
98
98
|
postTestImpressionsCount: function (body, headers) {
|
|
99
99
|
var url = urls.events + "/testImpressions/count";
|
|
@@ -102,8 +102,8 @@ function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
102
102
|
/**
|
|
103
103
|
* Post unique keys for client side.
|
|
104
104
|
*
|
|
105
|
-
* @param body unique keys payload
|
|
106
|
-
* @param headers Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
105
|
+
* @param body - unique keys payload
|
|
106
|
+
* @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
107
107
|
*/
|
|
108
108
|
postUniqueKeysBulkCs: function (body, headers) {
|
|
109
109
|
var url = urls.telemetry + "/v1/keys/cs";
|
|
@@ -112,8 +112,8 @@ function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
112
112
|
/**
|
|
113
113
|
* Post unique keys for server side.
|
|
114
114
|
*
|
|
115
|
-
* @param body unique keys payload
|
|
116
|
-
* @param headers Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
115
|
+
* @param body - unique keys payload
|
|
116
|
+
* @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
|
|
117
117
|
*/
|
|
118
118
|
postUniqueKeysBulkSs: function (body, headers) {
|
|
119
119
|
var url = urls.telemetry + "/v1/keys/ss";
|
|
@@ -8,8 +8,8 @@ var messageNoFetch = 'Global fetch API is not available.';
|
|
|
8
8
|
/**
|
|
9
9
|
* Factory of Split HTTP clients, which are HTTP clients with predefined headers for Split endpoints.
|
|
10
10
|
*
|
|
11
|
-
* @param settings SDK settings, used to access authorizationKey, logger instance and metadata (SDK version, ip and hostname) to set additional headers
|
|
12
|
-
* @param platform object containing environment-specific dependencies
|
|
11
|
+
* @param settings - SDK settings, used to access authorizationKey, logger instance and metadata (SDK version, ip and hostname) to set additional headers
|
|
12
|
+
* @param platform - object containing environment-specific dependencies
|
|
13
13
|
*/
|
|
14
14
|
function splitHttpClientFactory(settings, _a) {
|
|
15
15
|
var getOptions = _a.getOptions, getFetch = _a.getFetch;
|
|
@@ -25,10 +25,7 @@ var AbstractSplitsCacheAsync = /** @class */ (function () {
|
|
|
25
25
|
* Kill `name` split and set `defaultTreatment` and `changeNumber`.
|
|
26
26
|
* Used for SPLIT_KILL push notifications.
|
|
27
27
|
*
|
|
28
|
-
* @
|
|
29
|
-
* @param {string} defaultTreatment
|
|
30
|
-
* @param {number} changeNumber
|
|
31
|
-
* @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,
|
|
28
|
+
* @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,
|
|
32
29
|
* 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.
|
|
33
30
|
* The promise will never be rejected.
|
|
34
31
|
*/
|
|
@@ -41,10 +41,7 @@ var AbstractSplitsCacheSync = /** @class */ (function () {
|
|
|
41
41
|
* Kill `name` split and set `defaultTreatment` and `changeNumber`.
|
|
42
42
|
* Used for SPLIT_KILL push notifications.
|
|
43
43
|
*
|
|
44
|
-
* @
|
|
45
|
-
* @param {string} defaultTreatment
|
|
46
|
-
* @param {number} changeNumber
|
|
47
|
-
* @returns {boolean} `true` if the operation successed updating the split, or `false` if no split is updated,
|
|
44
|
+
* @returns `true` if the operation successed updating the split, or `false` if no split is updated,
|
|
48
45
|
* 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.
|
|
49
46
|
*/
|
|
50
47
|
AbstractSplitsCacheSync.prototype.killLocally = function (name, defaultTreatment, changeNumber) {
|
|
@@ -5,7 +5,7 @@ var browser_1 = require("../utils/constants/browser");
|
|
|
5
5
|
/**
|
|
6
6
|
* Factory of client-side storage loader
|
|
7
7
|
*
|
|
8
|
-
* @param preloadedData validated data following the format proposed in https://github.com/godaddy/split-javascript-data-loader
|
|
8
|
+
* @param preloadedData - validated data following the format proposed in https://github.com/godaddy/split-javascript-data-loader
|
|
9
9
|
* and extended with a `mySegmentsData` property.
|
|
10
10
|
* @returns function to preload the storage
|
|
11
11
|
*/
|
|
@@ -14,12 +14,11 @@ function dataLoaderFactory(preloadedData) {
|
|
|
14
14
|
* Storage-agnostic adaptation of `loadDataIntoLocalStorage` function
|
|
15
15
|
* (https://github.com/godaddy/split-javascript-data-loader/blob/master/src/load-data.js)
|
|
16
16
|
*
|
|
17
|
-
* @param storage object containing `splits` and `segments` cache (client-side variant)
|
|
18
|
-
* @param userId user key string of the provided MySegmentsCache
|
|
19
|
-
*
|
|
20
|
-
* @TODO extend to support SegmentsCache (server-side variant) by making `userId` optional and adding the corresponding logic.
|
|
21
|
-
* @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.
|
|
17
|
+
* @param storage - object containing `splits` and `segments` cache (client-side variant)
|
|
18
|
+
* @param userId - user key string of the provided MySegmentsCache
|
|
22
19
|
*/
|
|
20
|
+
// @TODO extend to support SegmentsCache (server-side variant) by making `userId` optional and adding the corresponding logic.
|
|
21
|
+
// @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.
|
|
23
22
|
return function loadData(storage, userId) {
|
|
24
23
|
// Do not load data if current preloadedData is empty
|
|
25
24
|
if (Object.keys(preloadedData).length === 0)
|
|
@@ -12,11 +12,6 @@ var sets_1 = require("../../utils/lang/sets");
|
|
|
12
12
|
*/
|
|
13
13
|
var SplitsCacheInLocal = /** @class */ (function (_super) {
|
|
14
14
|
(0, tslib_1.__extends)(SplitsCacheInLocal, _super);
|
|
15
|
-
/**
|
|
16
|
-
* @param {KeyBuilderCS} keys
|
|
17
|
-
* @param {number | undefined} expirationTimestamp
|
|
18
|
-
* @param {ISplitFiltersValidation} splitFiltersValidation
|
|
19
|
-
*/
|
|
20
15
|
function SplitsCacheInLocal(settings, keys, expirationTimestamp) {
|
|
21
16
|
var _this = _super.call(this) || this;
|
|
22
17
|
_this.keys = keys;
|
|
@@ -197,7 +192,7 @@ var SplitsCacheInLocal = /** @class */ (function (_super) {
|
|
|
197
192
|
/**
|
|
198
193
|
* Clean Splits cache if its `lastUpdated` timestamp is older than the given `expirationTimestamp`,
|
|
199
194
|
*
|
|
200
|
-
* @param
|
|
195
|
+
* @param expirationTimestamp - if the value is not a number, data will not be cleaned
|
|
201
196
|
*/
|
|
202
197
|
SplitsCacheInLocal.prototype._checkExpiration = function (expirationTimestamp) {
|
|
203
198
|
var value = localStorage.getItem(this.keys.buildLastUpdatedKey());
|
|
@@ -9,9 +9,9 @@ var AttributesCacheInMemory = /** @class */ (function () {
|
|
|
9
9
|
/**
|
|
10
10
|
* Create or update the value for the given attribute
|
|
11
11
|
*
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
14
|
-
* @returns
|
|
12
|
+
* @param attributeName - attribute name
|
|
13
|
+
* @param attributeValue - attribute value
|
|
14
|
+
* @returns the attribute was stored
|
|
15
15
|
*/
|
|
16
16
|
AttributesCacheInMemory.prototype.setAttribute = function (attributeName, attributeValue) {
|
|
17
17
|
this.attributesCache[attributeName] = attributeValue;
|
|
@@ -20,8 +20,8 @@ var AttributesCacheInMemory = /** @class */ (function () {
|
|
|
20
20
|
/**
|
|
21
21
|
* Retrieves the value of a given attribute
|
|
22
22
|
*
|
|
23
|
-
* @param
|
|
24
|
-
* @returns
|
|
23
|
+
* @param attributeName - attribute name
|
|
24
|
+
* @returns stored attribute value
|
|
25
25
|
*/
|
|
26
26
|
AttributesCacheInMemory.prototype.getAttribute = function (attributeName) {
|
|
27
27
|
return this.attributesCache[attributeName];
|
|
@@ -29,8 +29,8 @@ var AttributesCacheInMemory = /** @class */ (function () {
|
|
|
29
29
|
/**
|
|
30
30
|
* Create or update all the given attributes
|
|
31
31
|
*
|
|
32
|
-
* @param
|
|
33
|
-
* @returns
|
|
32
|
+
* @param attributes - attributes to create or update
|
|
33
|
+
* @returns attributes were stored
|
|
34
34
|
*/
|
|
35
35
|
AttributesCacheInMemory.prototype.setAttributes = function (attributes) {
|
|
36
36
|
this.attributesCache = (0, objectAssign_1.objectAssign)(this.attributesCache, attributes);
|
|
@@ -39,7 +39,7 @@ var AttributesCacheInMemory = /** @class */ (function () {
|
|
|
39
39
|
/**
|
|
40
40
|
* Retrieve the full attributes map
|
|
41
41
|
*
|
|
42
|
-
* @returns
|
|
42
|
+
* @returns stored attributes
|
|
43
43
|
*/
|
|
44
44
|
AttributesCacheInMemory.prototype.getAll = function () {
|
|
45
45
|
return this.attributesCache;
|
|
@@ -47,8 +47,8 @@ var AttributesCacheInMemory = /** @class */ (function () {
|
|
|
47
47
|
/**
|
|
48
48
|
* Removes a given attribute from the map
|
|
49
49
|
*
|
|
50
|
-
* @param
|
|
51
|
-
* @returns
|
|
50
|
+
* @param attributeName - attribute to remove
|
|
51
|
+
* @returns attribute removed
|
|
52
52
|
*/
|
|
53
53
|
AttributesCacheInMemory.prototype.removeAttribute = function (attributeName) {
|
|
54
54
|
if (Object.keys(this.attributesCache).indexOf(attributeName) >= 0) {
|
|
@@ -5,7 +5,7 @@ var MAX_QUEUE_BYTE_SIZE = 5 * 1024 * 1024; // 5M
|
|
|
5
5
|
var EventsCacheInMemory = /** @class */ (function () {
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
8
|
-
* @param eventsQueueSize number of queued events to call onFullQueueCb.
|
|
8
|
+
* @param eventsQueueSize - number of queued events to call onFullQueueCb.
|
|
9
9
|
* Default value is 0, that means no maximum value, in case we want to avoid this being triggered.
|
|
10
10
|
*/
|
|
11
11
|
function EventsCacheInMemory(eventsQueueSize) {
|
|
@@ -4,7 +4,7 @@ exports.ImpressionsCacheInMemory = void 0;
|
|
|
4
4
|
var ImpressionsCacheInMemory = /** @class */ (function () {
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
7
|
-
* @param impressionsQueueSize number of queued impressions to call onFullQueueCb.
|
|
7
|
+
* @param impressionsQueueSize - number of queued impressions to call onFullQueueCb.
|
|
8
8
|
* Default value is 0, that means no maximum value, in case we want to avoid this being triggered.
|
|
9
9
|
*/
|
|
10
10
|
function ImpressionsCacheInMemory(impressionsQueueSize) {
|
|
@@ -12,7 +12,7 @@ var UniqueKeysCacheInMemory_1 = require("./UniqueKeysCacheInMemory");
|
|
|
12
12
|
/**
|
|
13
13
|
* InMemory storage factory for standalone server-side SplitFactory
|
|
14
14
|
*
|
|
15
|
-
* @param params parameters required by EventsCacheSync
|
|
15
|
+
* @param params - parameters required by EventsCacheSync
|
|
16
16
|
*/
|
|
17
17
|
function InMemoryStorageFactory(params) {
|
|
18
18
|
var _a = params.settings, _b = _a.scheduler, impressionsQueueSize = _b.impressionsQueueSize, eventsQueueSize = _b.eventsQueueSize, _c = _a.sync, impressionsMode = _c.impressionsMode, __splitFiltersValidation = _c.__splitFiltersValidation;
|
|
@@ -12,7 +12,7 @@ var UniqueKeysCacheInMemoryCS_1 = require("./UniqueKeysCacheInMemoryCS");
|
|
|
12
12
|
/**
|
|
13
13
|
* InMemory storage factory for standalone client-side SplitFactory
|
|
14
14
|
*
|
|
15
|
-
* @param params parameters required by EventsCacheSync
|
|
15
|
+
* @param params - parameters required by EventsCacheSync
|
|
16
16
|
*/
|
|
17
17
|
function InMemoryStorageCSFactory(params) {
|
|
18
18
|
var _a = params.settings, _b = _a.scheduler, impressionsQueueSize = _b.impressionsQueueSize, eventsQueueSize = _b.eventsQueueSize, _c = _a.sync, impressionsMode = _c.impressionsMode, __splitFiltersValidation = _c.__splitFiltersValidation;
|
|
@@ -6,7 +6,7 @@ var sets_1 = require("../../utils/lang/sets");
|
|
|
6
6
|
var UniqueKeysCacheInMemoryCS = /** @class */ (function () {
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
9
|
-
* @param impressionsQueueSize number of queued impressions to call onFullQueueCb.
|
|
9
|
+
* @param impressionsQueueSize - number of queued impressions to call onFullQueueCb.
|
|
10
10
|
* Default value is 0, that means no maximum value, in case we want to avoid this being triggered.
|
|
11
11
|
*/
|
|
12
12
|
function UniqueKeysCacheInMemoryCS(uniqueKeysQueueSize) {
|
|
@@ -164,10 +164,8 @@ var SplitsCacheInRedis = /** @class */ (function (_super) {
|
|
|
164
164
|
* Get list of all split definitions.
|
|
165
165
|
* The returned promise is resolved with the list of split definitions,
|
|
166
166
|
* or rejected if redis operation fails.
|
|
167
|
-
*
|
|
168
|
-
* @TODO we need to benchmark which is the maximun number of commands we could
|
|
169
|
-
* pipeline without kill redis performance.
|
|
170
167
|
*/
|
|
168
|
+
// @TODO we need to benchmark which is the maximun number of commands we could pipeline without kill redis performance.
|
|
171
169
|
SplitsCacheInRedis.prototype.getAll = function () {
|
|
172
170
|
var _this = this;
|
|
173
171
|
return this.redis.keys(this.keys.searchPatternForSplitKeys())
|
|
@@ -10,9 +10,9 @@ var utils_1 = require("../utils");
|
|
|
10
10
|
var TelemetryCacheInRedis = /** @class */ (function () {
|
|
11
11
|
/**
|
|
12
12
|
* Create a Telemetry cache that uses Redis as storage.
|
|
13
|
-
* @param log Logger instance.
|
|
14
|
-
* @param keys Key builder.
|
|
15
|
-
* @param redis Redis client.
|
|
13
|
+
* @param log - Logger instance.
|
|
14
|
+
* @param keys - Key builder.
|
|
15
|
+
* @param redis - Redis client.
|
|
16
16
|
*/
|
|
17
17
|
function TelemetryCacheInRedis(log, keys, redis) {
|
|
18
18
|
this.log = log;
|
|
@@ -54,7 +54,7 @@ var UniqueKeysCacheInRedis = /** @class */ (function (_super) {
|
|
|
54
54
|
};
|
|
55
55
|
/**
|
|
56
56
|
* Async consumer API, used by synchronizer.
|
|
57
|
-
* @param count number of items to pop from the queue. If not provided or equal 0, all items will be popped.
|
|
57
|
+
* @param count - number of items to pop from the queue. If not provided or equal 0, all items will be popped.
|
|
58
58
|
*/
|
|
59
59
|
UniqueKeysCacheInRedis.prototype.popNRaw = function (count) {
|
|
60
60
|
var _this = this;
|
|
@@ -11,7 +11,7 @@ var EventsCachePluggable = /** @class */ (function () {
|
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Push given event to the storage.
|
|
14
|
-
* @param eventData Event item to push.
|
|
14
|
+
* @param eventData - Event item to push.
|
|
15
15
|
* @returns A promise that is resolved with a boolean value indicating if the push operation succeeded or failed.
|
|
16
16
|
* Unlike `impressions::track`, The promise will never be rejected.
|
|
17
17
|
*/
|
|
@@ -11,7 +11,7 @@ var ImpressionsCachePluggable = /** @class */ (function () {
|
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Push given impressions to the storage.
|
|
14
|
-
* @param impressions List of impresions to push.
|
|
14
|
+
* @param impressions - List of impresions to push.
|
|
15
15
|
* @returns A promise that is resolved if the push operation succeeded
|
|
16
16
|
* or rejected if the wrapper operation fails.
|
|
17
17
|
*/
|
|
@@ -71,7 +71,7 @@ var SegmentsCachePluggable = /** @class */ (function () {
|
|
|
71
71
|
SegmentsCachePluggable.prototype.getRegisteredSegments = function () {
|
|
72
72
|
return this.wrapper.getItems(this.keys.buildRegisteredSegmentsKey());
|
|
73
73
|
};
|
|
74
|
-
|
|
74
|
+
// @TODO implement if required by DataLoader or Producer mode
|
|
75
75
|
SegmentsCachePluggable.prototype.clear = function () {
|
|
76
76
|
return Promise.resolve(true);
|
|
77
77
|
};
|
|
@@ -13,9 +13,9 @@ var SplitsCachePluggable = /** @class */ (function (_super) {
|
|
|
13
13
|
(0, tslib_1.__extends)(SplitsCachePluggable, _super);
|
|
14
14
|
/**
|
|
15
15
|
* Create a SplitsCache that uses a storage wrapper.
|
|
16
|
-
* @param log Logger instance.
|
|
17
|
-
* @param keys Key builder.
|
|
18
|
-
* @param wrapper Adapted wrapper storage.
|
|
16
|
+
* @param log - Logger instance.
|
|
17
|
+
* @param keys - Key builder.
|
|
18
|
+
* @param wrapper - Adapted wrapper storage.
|
|
19
19
|
*/
|
|
20
20
|
function SplitsCachePluggable(log, keys, wrapper, splitFiltersValidation) {
|
|
21
21
|
var _this = _super.call(this) || this;
|
|
@@ -10,9 +10,9 @@ var utils_1 = require("../utils");
|
|
|
10
10
|
var TelemetryCachePluggable = /** @class */ (function () {
|
|
11
11
|
/**
|
|
12
12
|
* Create a Telemetry cache 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 TelemetryCachePluggable(log, keys, wrapper) {
|
|
18
18
|
this.log = log;
|
|
@@ -48,7 +48,7 @@ var UniqueKeysCachePluggable = /** @class */ (function (_super) {
|
|
|
48
48
|
};
|
|
49
49
|
/**
|
|
50
50
|
* Async consumer API, used by synchronizer.
|
|
51
|
-
* @param count number of items to pop from the queue. If not provided or equal 0, all items will be popped.
|
|
51
|
+
* @param count - number of items to pop from the queue. If not provided or equal 0, all items will be popped.
|
|
52
52
|
*/
|
|
53
53
|
UniqueKeysCachePluggable.prototype.popNRaw = function (count) {
|
|
54
54
|
var _this = this;
|
|
@@ -8,7 +8,7 @@ var sets_1 = require("../../utils/lang/sets");
|
|
|
8
8
|
* The `_cache` property is the object were items are stored.
|
|
9
9
|
* Intended for testing purposes.
|
|
10
10
|
*
|
|
11
|
-
* @param connDelay delay in millis for `connect` resolve. If not provided, `connect` resolves immediately.
|
|
11
|
+
* @param connDelay - delay in millis for `connect` resolve. If not provided, `connect` resolves immediately.
|
|
12
12
|
*/
|
|
13
13
|
function inMemoryWrapperFactory(connDelay) {
|
|
14
14
|
var _cache = {};
|
|
@@ -27,7 +27,7 @@ var NO_VALID_WRAPPER_INTERFACE = 'The provided wrapper instance doesn’t follow
|
|
|
27
27
|
/**
|
|
28
28
|
* Validate pluggable storage factory options.
|
|
29
29
|
*
|
|
30
|
-
* @param options user options
|
|
30
|
+
* @param options - user options
|
|
31
31
|
* @throws Will throw an error if the options are invalid. Example: wrapper is not provided or doesn't have some methods.
|
|
32
32
|
*/
|
|
33
33
|
function validatePluggableStorageOptions(options) {
|
|
@@ -25,8 +25,8 @@ exports.METHODS_TO_PROMISE_WRAP = [
|
|
|
25
25
|
* Adapter of the Pluggable Storage Wrapper.
|
|
26
26
|
* Used to handle exceptions as rejected promises, in order to simplify the error handling on storages.
|
|
27
27
|
*
|
|
28
|
-
* @param log logger instance
|
|
29
|
-
* @param wrapper storage wrapper to adapt
|
|
28
|
+
* @param log - logger instance
|
|
29
|
+
* @param wrapper - storage wrapper to adapt
|
|
30
30
|
* @returns an adapted version of the given storage wrapper
|
|
31
31
|
*/
|
|
32
32
|
function wrapperAdapter(log, wrapper) {
|
|
@@ -33,7 +33,7 @@ function splitsParserFromSettingsFactory() {
|
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
*
|
|
36
|
-
* @param settings validated object with mocked features mapping.
|
|
36
|
+
* @param settings - validated object with mocked features mapping.
|
|
37
37
|
*/
|
|
38
38
|
return function splitsParserFromSettings(settings) {
|
|
39
39
|
var features = settings.features || {};
|
|
@@ -11,7 +11,7 @@ function flush() {
|
|
|
11
11
|
* Offline SyncManager factory.
|
|
12
12
|
* Can be used for server-side API, and client-side API with or without multiple clients.
|
|
13
13
|
*
|
|
14
|
-
* @param splitsParser e.g., `splitsParserFromFile`, `splitsParserFromSettings`.
|
|
14
|
+
* @param splitsParser - e.g., `splitsParserFromFile`, `splitsParserFromSettings`.
|
|
15
15
|
*/
|
|
16
16
|
function syncManagerOfflineFactory(splitsParserFactory) {
|
|
17
17
|
/**
|
|
@@ -66,12 +66,12 @@ function mySegmentsUpdaterFactory(log, mySegmentsFetcher, storage, segmentsEvent
|
|
|
66
66
|
* MySegments updater returns a promise that resolves with a `false` boolean value if it fails to fetch mySegments or synchronize them with the storage.
|
|
67
67
|
* Returned promise will not be rejected.
|
|
68
68
|
*
|
|
69
|
-
* @param
|
|
69
|
+
* @param segmentsData - it can be:
|
|
70
70
|
* (1) the list of mySegments names to sync in the storage,
|
|
71
71
|
* (2) an object with a segment name and action (true: add, or false: delete) to update the storage,
|
|
72
72
|
* (3) or `undefined`, for which the updater will fetch mySegments in order to sync the storage.
|
|
73
|
-
* @param
|
|
74
|
-
* @param
|
|
73
|
+
* @param noCache - true to revalidate data to fetch
|
|
74
|
+
* @param till - query param to bypass CDN requests
|
|
75
75
|
*/
|
|
76
76
|
return function mySegmentsUpdater(segmentsData, noCache, till) {
|
|
77
77
|
return _mySegmentsUpdater(0, segmentsData, noCache, till);
|