@splitsoftware/splitio-commons 2.0.0-rc.4 → 2.0.0-rc.6
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 +0 -5
- 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 +0 -5
- 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 +5 -6
- package/src/sdkClient/clientAttributesDecoration.ts +10 -10
- package/src/sdkClient/clientCS.ts +5 -5
- package/src/sdkClient/clientInputValidation.ts +2 -1
- package/src/sdkClient/identity.ts +1 -1
- package/src/sdkClient/sdkClient.ts +2 -2
- package/src/sdkClient/sdkClientMethod.ts +1 -1
- package/src/sdkClient/sdkClientMethodCS.ts +3 -3
- package/src/sdkFactory/index.ts +3 -3
- package/src/sdkFactory/types.ts +8 -7
- 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 +0 -5
- 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 +1019 -1381
|
@@ -9,10 +9,10 @@ var constants_2 = require("../../../logger/constants");
|
|
|
9
9
|
* - updates `segmentsCache`
|
|
10
10
|
* - uses `segmentsEventEmitter` to emit events related to segments data updates
|
|
11
11
|
*
|
|
12
|
-
* @param log logger instance
|
|
13
|
-
* @param segmentChangesFetcher fetcher of `/segmentChanges`
|
|
14
|
-
* @param segments segments storage, with sync or async methods
|
|
15
|
-
* @param readiness optional readiness manager. Not required for synchronizer or producer mode.
|
|
12
|
+
* @param log - logger instance
|
|
13
|
+
* @param segmentChangesFetcher - fetcher of `/segmentChanges`
|
|
14
|
+
* @param segments - segments storage, with sync or async methods
|
|
15
|
+
* @param readiness - optional readiness manager. Not required for synchronizer or producer mode.
|
|
16
16
|
*/
|
|
17
17
|
function segmentChangesUpdaterFactory(log, segmentChangesFetcher, segments, readiness) {
|
|
18
18
|
var readyOnAlreadyExistentState = true;
|
|
@@ -38,11 +38,11 @@ function segmentChangesUpdaterFactory(log, segmentChangesFetcher, segments, read
|
|
|
38
38
|
* Thus, a false result doesn't imply that SDK_SEGMENTS_ARRIVED was not emitted.
|
|
39
39
|
* Returned promise will not be rejected.
|
|
40
40
|
*
|
|
41
|
-
* @param
|
|
41
|
+
* @param fetchOnlyNew - if true, only fetch the segments that not exists, i.e., which `changeNumber` is equal to -1.
|
|
42
42
|
* This param is used by SplitUpdateWorker on server-side SDK, to fetch new registered segments on SPLIT_UPDATE notifications.
|
|
43
|
-
* @param
|
|
44
|
-
* @param
|
|
45
|
-
* @param
|
|
43
|
+
* @param segmentName - segment name to fetch. By passing `undefined` it fetches the list of segments registered at the storage
|
|
44
|
+
* @param noCache - true to revalidate data to fetch on a SEGMENT_UPDATE notifications.
|
|
45
|
+
* @param till - till target for the provided segmentName, for CDN bypass.
|
|
46
46
|
*/
|
|
47
47
|
return function segmentChangesUpdater(fetchOnlyNew, segmentName, noCache, till) {
|
|
48
48
|
log.debug(constants_2.LOG_PREFIX_SYNC_SEGMENTS + "Started segments update");
|
|
@@ -38,8 +38,8 @@ exports.parseSegments = parseSegments;
|
|
|
38
38
|
* If there are defined filters and one feature flag doesn't match with them, its status is changed to 'ARCHIVE' to avoid storing it
|
|
39
39
|
* If there are set filter defined, names filter is ignored
|
|
40
40
|
*
|
|
41
|
-
* @param featureFlag feature flag to be evaluated
|
|
42
|
-
* @param filters splitFiltersValidation bySet | byName
|
|
41
|
+
* @param featureFlag - feature flag to be evaluated
|
|
42
|
+
* @param filters - splitFiltersValidation bySet | byName
|
|
43
43
|
*/
|
|
44
44
|
function matchFilters(featureFlag, filters) {
|
|
45
45
|
var _a = filters.groupedFilters, setsFilter = _a.bySet, namesFilter = _a.byName, prefixFilter = _a.byPrefix;
|
|
@@ -82,13 +82,13 @@ exports.computeSplitsMutation = computeSplitsMutation;
|
|
|
82
82
|
* - updates `splitsCache`
|
|
83
83
|
* - uses `splitsEventEmitter` to emit events related to split data updates
|
|
84
84
|
*
|
|
85
|
-
* @param log Logger instance
|
|
86
|
-
* @param splitChangesFetcher Fetcher of `/splitChanges`
|
|
87
|
-
* @param splits Splits storage, with sync or async methods
|
|
88
|
-
* @param segments Segments storage, with sync or async methods
|
|
89
|
-
* @param splitsEventEmitter Optional readiness manager. Not required for synchronizer or producer mode.
|
|
90
|
-
* @param requestTimeoutBeforeReady How long the updater will wait for the request to timeout. Default 0, i.e., never timeout.
|
|
91
|
-
* @param retriesOnFailureBeforeReady How many retries on `/splitChanges` we the updater do in case of failure or timeout. Default 0, i.e., no retries.
|
|
85
|
+
* @param log - Logger instance
|
|
86
|
+
* @param splitChangesFetcher - Fetcher of `/splitChanges`
|
|
87
|
+
* @param splits - Splits storage, with sync or async methods
|
|
88
|
+
* @param segments - Segments storage, with sync or async methods
|
|
89
|
+
* @param splitsEventEmitter - Optional readiness manager. Not required for synchronizer or producer mode.
|
|
90
|
+
* @param requestTimeoutBeforeReady - How long the updater will wait for the request to timeout. Default 0, i.e., never timeout.
|
|
91
|
+
* @param retriesOnFailureBeforeReady - How many retries on `/splitChanges` we the updater do in case of failure or timeout. Default 0, i.e., no retries.
|
|
92
92
|
*/
|
|
93
93
|
function splitChangesUpdaterFactory(log, splitChangesFetcher, splits, segments, splitFiltersValidation, splitsEventEmitter, requestTimeoutBeforeReady, retriesOnFailureBeforeReady, isClientSide) {
|
|
94
94
|
if (requestTimeoutBeforeReady === void 0) { requestTimeoutBeforeReady = 0; }
|
|
@@ -115,13 +115,13 @@ function splitChangesUpdaterFactory(log, splitChangesFetcher, splits, segments,
|
|
|
115
115
|
* SplitChanges updater returns a promise that resolves with a `false` boolean value if it fails to fetch splits or synchronize them with the storage.
|
|
116
116
|
* Returned promise will not be rejected.
|
|
117
117
|
*
|
|
118
|
-
* @param
|
|
119
|
-
* @param
|
|
118
|
+
* @param noCache - true to revalidate data to fetch
|
|
119
|
+
* @param till - query param to bypass CDN requests
|
|
120
120
|
*/
|
|
121
121
|
return function splitChangesUpdater(noCache, till, splitUpdateNotification) {
|
|
122
122
|
/**
|
|
123
|
-
* @param
|
|
124
|
-
* @param
|
|
123
|
+
* @param since - current changeNumber at splitsCache
|
|
124
|
+
* @param retry - current number of retry attempts
|
|
125
125
|
*/
|
|
126
126
|
function _splitChangesUpdater(since, retry) {
|
|
127
127
|
if (retry === void 0) { retry = 0; }
|
|
@@ -8,12 +8,12 @@ var murmur3_1 = require("../../../utils/murmur3/murmur3");
|
|
|
8
8
|
/**
|
|
9
9
|
* Factory of authentication function.
|
|
10
10
|
*
|
|
11
|
-
* @param fetchAuth `SplitAPI.fetchAuth` endpoint
|
|
11
|
+
* @param fetchAuth - `SplitAPI.fetchAuth` endpoint
|
|
12
12
|
*/
|
|
13
13
|
function authenticateFactory(fetchAuth) {
|
|
14
14
|
/**
|
|
15
15
|
* Run authentication requests to Auth Server, and returns a promise that resolves with the decoded JTW token.
|
|
16
|
-
* @param
|
|
16
|
+
* @param userKeys - set of user Keys to track membership updates. It is undefined for server-side API.
|
|
17
17
|
*/
|
|
18
18
|
return function authenticate(userKeys) {
|
|
19
19
|
return fetchAuth(userKeys)
|
|
@@ -9,8 +9,8 @@ var CONTROL_CHANNEL_REGEX = /^control_/;
|
|
|
9
9
|
/**
|
|
10
10
|
* Build metadata headers for SSE connection.
|
|
11
11
|
*
|
|
12
|
-
* @param
|
|
13
|
-
* @returns
|
|
12
|
+
* @param settings - Validated settings.
|
|
13
|
+
* @returns Headers object
|
|
14
14
|
*/
|
|
15
15
|
function buildSSEHeaders(settings) {
|
|
16
16
|
var headers = {
|
|
@@ -32,8 +32,8 @@ var SSEClient = /** @class */ (function () {
|
|
|
32
32
|
/**
|
|
33
33
|
* SSEClient constructor.
|
|
34
34
|
*
|
|
35
|
-
* @param settings Validated settings.
|
|
36
|
-
* @param platform object containing environment-specific dependencies
|
|
35
|
+
* @param settings - Validated settings.
|
|
36
|
+
* @param platform - object containing environment-specific dependencies
|
|
37
37
|
* @throws 'EventSource API is not available.' if EventSource is not available.
|
|
38
38
|
*/
|
|
39
39
|
function SSEClient(settings, _a) {
|
|
@@ -51,9 +51,6 @@ var SSEClient = /** @class */ (function () {
|
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
53
|
* Open the connection with a given authToken
|
|
54
|
-
*
|
|
55
|
-
* @param {IAuthTokenPushEnabled} authToken
|
|
56
|
-
* @throws {TypeError} Will throw an error if `authToken` is undefined
|
|
57
54
|
*/
|
|
58
55
|
SSEClient.prototype.open = function (authToken) {
|
|
59
56
|
var _a;
|
|
@@ -8,7 +8,7 @@ var STREAMING_EVENT_TYPES = [constants_1.OCCUPANCY_PRI, constants_1.OCCUPANCY_SE
|
|
|
8
8
|
/**
|
|
9
9
|
* Factory of notification keeper, which process OCCUPANCY and CONTROL notifications and emits the corresponding push events.
|
|
10
10
|
*
|
|
11
|
-
* @param pushEmitter emitter for events related to streaming support
|
|
11
|
+
* @param pushEmitter - emitter for events related to streaming support
|
|
12
12
|
*/
|
|
13
13
|
// @TODO update logic to handle OCCUPANCY for any region and rename according to new spec (e.g.: PUSH_SUBSYSTEM_UP --> PUSH_SUBSYSTEM_UP)
|
|
14
14
|
function notificationKeeperFactory(pushEmitter, telemetryTracker) {
|
|
@@ -8,8 +8,9 @@ var lang_1 = require("../../../utils/lang");
|
|
|
8
8
|
* HTTP errors handled by Ably (e.g., 400 due to invalid token, 401 due to expired token, 500) have the `data` property.
|
|
9
9
|
* Other network and HTTP errors do not have this property.
|
|
10
10
|
*
|
|
11
|
-
* @param
|
|
12
|
-
* @
|
|
11
|
+
* @param error - The error event to parse
|
|
12
|
+
* @returns parsed notification error
|
|
13
|
+
* @throws SyntaxError if `error.data` is an invalid JSON string
|
|
13
14
|
*/
|
|
14
15
|
function errorParser(error) {
|
|
15
16
|
// @ts-ignore
|
|
@@ -22,10 +23,10 @@ exports.errorParser = errorParser;
|
|
|
22
23
|
* Parses the `data` JSON string of a given SSE message notifications.
|
|
23
24
|
* Also assigns the type OCCUPANCY, if it corresponds, so that all supported messages (e.g., SPLIT_UPDATE, CONTROL) have a type.
|
|
24
25
|
*
|
|
25
|
-
* @param message
|
|
26
|
+
* @param message - The message event to parse
|
|
26
27
|
* @returns parsed notification message or undefined if the given event data is falsy (e.g, '' or undefined).
|
|
27
28
|
* For example, the EventSource implementation of React-Native for iOS emits a message event with empty data for Ably keepalive comments.
|
|
28
|
-
* @throws
|
|
29
|
+
* @throws SyntaxError if `message.data` or `JSON.parse(message.data).data` are invalid JSON strings
|
|
29
30
|
*/
|
|
30
31
|
function messageParser(message) {
|
|
31
32
|
if (!message.data)
|
|
@@ -9,8 +9,8 @@ var constants_3 = require("../../../utils/constants");
|
|
|
9
9
|
/**
|
|
10
10
|
* Factory for SSEHandler, which processes SSEClient messages and emits the corresponding push events.
|
|
11
11
|
*
|
|
12
|
-
* @param log factory logger
|
|
13
|
-
* @param pushEmitter emitter for events related to streaming support
|
|
12
|
+
* @param log - factory logger
|
|
13
|
+
* @param pushEmitter - emitter for events related to streaming support
|
|
14
14
|
*/
|
|
15
15
|
function SSEHandlerFactory(log, pushEmitter, telemetryTracker) {
|
|
16
16
|
var notificationKeeper = (0, NotificationKeeper_1.notificationKeeperFactory)(pushEmitter, telemetryTracker);
|
|
@@ -79,9 +79,9 @@ function MySegmentsUpdateWorker(log, storage, mySegmentsSyncTask, telemetryTrack
|
|
|
79
79
|
/**
|
|
80
80
|
* Invoked by NotificationProcessor on MY_(LARGE)_SEGMENTS_UPDATE notifications
|
|
81
81
|
*
|
|
82
|
-
* @param changeNumber change number of the notification
|
|
83
|
-
* @param segmentsData data for KeyList or SegmentRemoval instant updates
|
|
84
|
-
* @param delay optional time to wait for BoundedFetchRequest or BoundedFetchRequest updates
|
|
82
|
+
* @param changeNumber - change number of the notification
|
|
83
|
+
* @param segmentsData - data for KeyList or SegmentRemoval instant updates
|
|
84
|
+
* @param delay - optional time to wait for BoundedFetchRequest or BoundedFetchRequest updates
|
|
85
85
|
*/
|
|
86
86
|
put: function (mySegmentsData, payload, delay) {
|
|
87
87
|
var type = mySegmentsData.type, cn = mySegmentsData.cn;
|
|
@@ -75,8 +75,8 @@ function SegmentsUpdateWorker(log, segmentsSyncTask, segmentsCache) {
|
|
|
75
75
|
/**
|
|
76
76
|
* Invoked by NotificationProcessor on SEGMENT_UPDATE event
|
|
77
77
|
*
|
|
78
|
-
* @param
|
|
79
|
-
* @param
|
|
78
|
+
* @param changeNumber - change number of the SEGMENT_UPDATE notification
|
|
79
|
+
* @param segmentName - segment name of the SEGMENT_UPDATE notification
|
|
80
80
|
*/
|
|
81
81
|
put: function (_a) {
|
|
82
82
|
var changeNumber = _a.changeNumber, segmentName = _a.segmentName;
|
|
@@ -62,7 +62,7 @@ function SplitsUpdateWorker(log, splitsCache, splitsSyncTask, splitsEventEmitter
|
|
|
62
62
|
/**
|
|
63
63
|
* Invoked by NotificationProcessor on SPLIT_UPDATE event
|
|
64
64
|
*
|
|
65
|
-
* @param
|
|
65
|
+
* @param changeNumber - change number of the SPLIT_UPDATE notification
|
|
66
66
|
*/
|
|
67
67
|
function put(_a, _payload) {
|
|
68
68
|
var changeNumber = _a.changeNumber, pcn = _a.pcn;
|
|
@@ -85,9 +85,9 @@ function SplitsUpdateWorker(log, splitsCache, splitsSyncTask, splitsEventEmitter
|
|
|
85
85
|
/**
|
|
86
86
|
* Invoked by NotificationProcessor on SPLIT_KILL event
|
|
87
87
|
*
|
|
88
|
-
* @param
|
|
89
|
-
* @param
|
|
90
|
-
* @param
|
|
88
|
+
* @param changeNumber - change number of the SPLIT_UPDATE notification
|
|
89
|
+
* @param splitName - name of split to kill
|
|
90
|
+
* @param defaultTreatment - default treatment value
|
|
91
91
|
*/
|
|
92
92
|
killSplit: function (_a) {
|
|
93
93
|
var changeNumber = _a.changeNumber, splitName = _a.splitName, defaultTreatment = _a.defaultTreatment;
|
|
@@ -16,9 +16,9 @@ function StringToUint8Array(myString) {
|
|
|
16
16
|
/**
|
|
17
17
|
* Decode and decompress 'data' with 'compression' algorithm
|
|
18
18
|
*
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
-
* @returns
|
|
19
|
+
* @param data - base64 encoded string
|
|
20
|
+
* @param compression - 1 GZIP, 2 ZLIB
|
|
21
|
+
* @returns
|
|
22
22
|
* @throws if data string cannot be decoded, decompressed or the provided compression value is invalid (not 1 or 2)
|
|
23
23
|
*/
|
|
24
24
|
function decompress(data, compression) {
|
|
@@ -35,10 +35,10 @@ function decompress(data, compression) {
|
|
|
35
35
|
/**
|
|
36
36
|
* Decode, decompress and parse the provided 'data' into a KeyList object
|
|
37
37
|
*
|
|
38
|
-
* @param
|
|
39
|
-
* @param
|
|
40
|
-
* @param
|
|
41
|
-
* @returns
|
|
38
|
+
* @param data - base64 encoded string
|
|
39
|
+
* @param compression - 1 GZIP, 2 ZLIB
|
|
40
|
+
* @param avoidPrecisionLoss - true as default, set it as false if dont need to avoid precission loss
|
|
41
|
+
* @returns keyList
|
|
42
42
|
* @throws if data string cannot be decoded, decompressed or parsed
|
|
43
43
|
*/
|
|
44
44
|
function parseKeyList(data, compression, avoidPrecisionLoss) {
|
|
@@ -54,9 +54,9 @@ exports.parseKeyList = parseKeyList;
|
|
|
54
54
|
/**
|
|
55
55
|
* Decode, decompress and parse the provided 'data' into a Bitmap object
|
|
56
56
|
*
|
|
57
|
-
* @param
|
|
58
|
-
* @param
|
|
59
|
-
* @returns
|
|
57
|
+
* @param data - base64 encoded string
|
|
58
|
+
* @param compression - 1 GZIP, 2 ZLIB
|
|
59
|
+
* @returns Bitmap
|
|
60
60
|
* @throws if data string cannot be decoded or decompressed
|
|
61
61
|
*/
|
|
62
62
|
function parseBitmap(data, compression) {
|
|
@@ -66,9 +66,9 @@ exports.parseBitmap = parseBitmap;
|
|
|
66
66
|
/**
|
|
67
67
|
* Check if the 'bitmap' bit at 'hash64hex' position is 1
|
|
68
68
|
*
|
|
69
|
-
* @param
|
|
70
|
-
* @param
|
|
71
|
-
* @returns
|
|
69
|
+
* @param bitmap - Uint8Array bitmap
|
|
70
|
+
* @param hash64hex - 16-chars string, representing a number in hexa
|
|
71
|
+
* @returns whether the provided 'hash64hex' index is set in the bitmap
|
|
72
72
|
*/
|
|
73
73
|
function isInBitmap(bitmap, hash64hex) {
|
|
74
74
|
// using the lowest 32 bits as index, to avoid losing precision when converting to number
|
|
@@ -10,9 +10,9 @@ var constants_3 = require("../utils/constants");
|
|
|
10
10
|
* Online SyncManager factory.
|
|
11
11
|
* Can be used for server-side API, and client-side API with or without multiple clients.
|
|
12
12
|
*
|
|
13
|
-
* @param pollingManagerFactory allows to specialize the SyncManager for server-side or client-side API by passing
|
|
13
|
+
* @param pollingManagerFactory - allows to specialize the SyncManager for server-side or client-side API by passing
|
|
14
14
|
* `pollingManagerSSFactory` or `pollingManagerCSFactory` respectively.
|
|
15
|
-
* @param pushManagerFactory optional to build a SyncManager with or without streaming support
|
|
15
|
+
* @param pushManagerFactory - optional to build a SyncManager with or without streaming support
|
|
16
16
|
*/
|
|
17
17
|
function syncManagerOnlineFactory(pollingManagerFactory, pushManagerFactory) {
|
|
18
18
|
/**
|
package/cjs/sync/syncTask.js
CHANGED
|
@@ -6,10 +6,10 @@ var constants_1 = require("../logger/constants");
|
|
|
6
6
|
* Creates an object that handles the periodic execution of a given task via "start" and "stop" methods.
|
|
7
7
|
* The task can be also executed by calling the "execute" method. Multiple calls run sequentially to avoid race conditions (e.g., submitters executed on SDK destroy or full queue, while periodic execution is pending).
|
|
8
8
|
*
|
|
9
|
-
* @param log Logger instance.
|
|
10
|
-
* @param task Task to execute that returns a promise that NEVER REJECTS. Otherwise, periodic execution can result in Unhandled Promise Rejections.
|
|
11
|
-
* @param period Period in milliseconds to execute the task.
|
|
12
|
-
* @param taskName Optional task name for logging.
|
|
9
|
+
* @param log - Logger instance.
|
|
10
|
+
* @param task - Task to execute that returns a promise that NEVER REJECTS. Otherwise, periodic execution can result in Unhandled Promise Rejections.
|
|
11
|
+
* @param period - Period in milliseconds to execute the task.
|
|
12
|
+
* @param taskName - Optional task name for logging.
|
|
13
13
|
* @returns A sync task that wraps the given task.
|
|
14
14
|
*/
|
|
15
15
|
function syncTaskFactory(log, task, period, taskName) {
|
|
@@ -9,8 +9,8 @@ var mode_1 = require("../utils/settingsValidation/mode");
|
|
|
9
9
|
/**
|
|
10
10
|
* Event tracker stores events in cache and pass them to the integrations manager if provided.
|
|
11
11
|
*
|
|
12
|
-
* @param eventsCache cache to save events
|
|
13
|
-
* @param integrationsManager optional event handler used for integrations
|
|
12
|
+
* @param eventsCache - cache to save events
|
|
13
|
+
* @param integrationsManager - optional event handler used for integrations
|
|
14
14
|
*/
|
|
15
15
|
function eventTrackerFactory(settings, eventsCache, whenInit, integrationsManager, telemetryCache) {
|
|
16
16
|
var log = settings.log, mode = settings.mode;
|
|
@@ -8,11 +8,11 @@ var constants_2 = require("../utils/constants");
|
|
|
8
8
|
/**
|
|
9
9
|
* Impressions tracker stores impressions in cache and pass them to the listener and integrations manager if provided.
|
|
10
10
|
*
|
|
11
|
-
* @param impressionsCache cache to save impressions
|
|
12
|
-
* @param metadata runtime metadata (ip, hostname and version)
|
|
13
|
-
* @param impressionListener optional impression listener
|
|
14
|
-
* @param integrationsManager optional integrations manager
|
|
15
|
-
* @param strategy strategy for impressions tracking.
|
|
11
|
+
* @param impressionsCache - cache to save impressions
|
|
12
|
+
* @param metadata - runtime metadata (ip, hostname and version)
|
|
13
|
+
* @param impressionListener - optional impression listener
|
|
14
|
+
* @param integrationsManager - optional integrations manager
|
|
15
|
+
* @param strategy - strategy for impressions tracking.
|
|
16
16
|
*/
|
|
17
17
|
function impressionsTrackerFactory(settings, impressionsCache, strategy, whenInit, integrationsManager, telemetryCache) {
|
|
18
18
|
var log = settings.log, impressionListener = settings.impressionListener, _a = settings.runtime, ip = _a.ip, hostname = _a.hostname, version = settings.version;
|
|
@@ -4,7 +4,7 @@ exports.strategyDebugFactory = void 0;
|
|
|
4
4
|
/**
|
|
5
5
|
* Debug strategy for impressions tracker. Wraps impressions to store and adds previousTime if it corresponds
|
|
6
6
|
*
|
|
7
|
-
* @param impressionsObserver impression observer. Previous time (pt property) is included in impression instances
|
|
7
|
+
* @param impressionsObserver - impression observer. Previous time (pt property) is included in impression instances
|
|
8
8
|
* @returns IStrategyResult
|
|
9
9
|
*/
|
|
10
10
|
function strategyDebugFactory(impressionsObserver) {
|
|
@@ -4,8 +4,8 @@ exports.strategyNoneFactory = void 0;
|
|
|
4
4
|
/**
|
|
5
5
|
* None strategy for impressions tracker.
|
|
6
6
|
*
|
|
7
|
-
* @param impressionsCounter cache to save impressions count. impressions will be deduped (OPTIMIZED mode)
|
|
8
|
-
* @param uniqueKeysTracker unique keys tracker in charge of tracking the unique keys per split.
|
|
7
|
+
* @param impressionsCounter - cache to save impressions count. impressions will be deduped (OPTIMIZED mode)
|
|
8
|
+
* @param uniqueKeysTracker - unique keys tracker in charge of tracking the unique keys per split.
|
|
9
9
|
* @returns IStrategyResult
|
|
10
10
|
*/
|
|
11
11
|
function strategyNoneFactory(impressionsCounter, uniqueKeysTracker) {
|
|
@@ -5,8 +5,8 @@ var time_1 = require("../../utils/time");
|
|
|
5
5
|
/**
|
|
6
6
|
* Optimized strategy for impressions tracker. Wraps impressions to store and adds previousTime if it corresponds
|
|
7
7
|
*
|
|
8
|
-
* @param impressionsObserver impression observer. previous time (pt property) is included in impression instances
|
|
9
|
-
* @param impressionsCounter cache to save impressions count. impressions will be deduped (OPTIMIZED mode)
|
|
8
|
+
* @param impressionsObserver - impression observer. previous time (pt property) is included in impression instances
|
|
9
|
+
* @param impressionsCounter - cache to save impressions count. impressions will be deduped (OPTIMIZED mode)
|
|
10
10
|
* @returns IStrategyResult
|
|
11
11
|
*/
|
|
12
12
|
function strategyOptimizedFactory(impressionsObserver, impressionsCounter) {
|
|
@@ -12,9 +12,9 @@ var noopFilterAdapter = {
|
|
|
12
12
|
* Unique Keys Tracker will be in charge of checking if the MTK was already sent to the BE in the last period
|
|
13
13
|
* or schedule to be sent; if not it will be added in an internal cache and sent in the next post.
|
|
14
14
|
*
|
|
15
|
-
* @param log Logger instance
|
|
16
|
-
* @param uniqueKeysCache cache to save unique keys
|
|
17
|
-
* @param filterAdapter filter adapter
|
|
15
|
+
* @param log - Logger instance
|
|
16
|
+
* @param uniqueKeysCache - cache to save unique keys
|
|
17
|
+
* @param filterAdapter - filter adapter
|
|
18
18
|
*/
|
|
19
19
|
function uniqueKeysTrackerFactory(log, uniqueKeysCache, filterAdapter) {
|
|
20
20
|
if (filterAdapter === void 0) { filterAdapter = noopFilterAdapter; }
|
package/cjs/utils/Backoff.js
CHANGED
|
@@ -4,10 +4,6 @@ exports.Backoff = void 0;
|
|
|
4
4
|
var Backoff = /** @class */ (function () {
|
|
5
5
|
/**
|
|
6
6
|
* Schedule function calls with exponential backoff
|
|
7
|
-
*
|
|
8
|
-
* @param {function} cb
|
|
9
|
-
* @param {number} baseMillis
|
|
10
|
-
* @param {number} maxMillis
|
|
11
7
|
*/
|
|
12
8
|
function Backoff(cb, baseMillis, maxMillis) {
|
|
13
9
|
this.baseMillis = Backoff.__TEST__BASE_MILLIS || baseMillis || Backoff.DEFAULT_BASE_MILLIS;
|
package/cjs/utils/Semver.js
CHANGED
|
@@ -73,7 +73,7 @@ var Semver = /** @class */ (function () {
|
|
|
73
73
|
/**
|
|
74
74
|
* Precedence comparision between 2 Semver objects.
|
|
75
75
|
*
|
|
76
|
-
* @
|
|
76
|
+
* @returns `0` if `this === toCompare`, `-1` if `this < toCompare`, and `1` if `this > toCompare`
|
|
77
77
|
*/
|
|
78
78
|
Semver.prototype.compare = function (toCompare) {
|
|
79
79
|
if (this.version === toCompare.version)
|
|
@@ -23,7 +23,7 @@ var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
|
23
23
|
/**
|
|
24
24
|
* Decode a given string value in Base64 format
|
|
25
25
|
*
|
|
26
|
-
* @param
|
|
26
|
+
* @param input - value to decode
|
|
27
27
|
*/
|
|
28
28
|
function decodeFromBase64(input) {
|
|
29
29
|
var str = (String(input)).replace(/[=]+$/, ''); // #31: ExtendScript bad parse of /=
|
|
@@ -49,7 +49,7 @@ exports.decodeFromBase64 = decodeFromBase64;
|
|
|
49
49
|
/**
|
|
50
50
|
* Encode a given string value to Base64 format.
|
|
51
51
|
*
|
|
52
|
-
* @param
|
|
52
|
+
* @param input - value to encode
|
|
53
53
|
*/
|
|
54
54
|
function encodeToBase64(input) {
|
|
55
55
|
var str = String(input);
|
|
@@ -407,8 +407,8 @@ exports.algorithms = (function iifeDecompress() {
|
|
|
407
407
|
return {
|
|
408
408
|
/**
|
|
409
409
|
* Expands GZIP data
|
|
410
|
-
* @param data The data to decompress
|
|
411
|
-
* @param out Where to write the data. GZIP already encodes the output size, so providing this doesn't save memory.
|
|
410
|
+
* @param data - The data to decompress
|
|
411
|
+
* @param out - Where to write the data. GZIP already encodes the output size, so providing this doesn't save memory.
|
|
412
412
|
* @returns The decompressed version of the data
|
|
413
413
|
*/
|
|
414
414
|
gunzipSync: function (data, out) {
|
|
@@ -416,8 +416,8 @@ exports.algorithms = (function iifeDecompress() {
|
|
|
416
416
|
},
|
|
417
417
|
/**
|
|
418
418
|
* Expands Zlib data
|
|
419
|
-
* @param data The data to decompress
|
|
420
|
-
* @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.
|
|
419
|
+
* @param data - The data to decompress
|
|
420
|
+
* @param out - Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.
|
|
421
421
|
* @returns The decompressed version of the data
|
|
422
422
|
*/
|
|
423
423
|
unzlibSync: function (data, out) {
|
|
@@ -4,8 +4,8 @@ exports.binarySearch = void 0;
|
|
|
4
4
|
/**
|
|
5
5
|
* Searches the index of the specified `value` inside an ordered array of `items` using the binary search algorithm.
|
|
6
6
|
*
|
|
7
|
-
* @param items the array to be searched
|
|
8
|
-
* @param value the value to be searched for
|
|
7
|
+
* @param items - the array to be searched
|
|
8
|
+
* @param value - the value to be searched for
|
|
9
9
|
* @returns integer number between 0 and `items.length`. This value is the index of the search value,
|
|
10
10
|
* if it is contained in the array, or the index at which the value should be inserted to keep the array ordered.
|
|
11
11
|
*/
|
|
@@ -211,7 +211,7 @@ function hash128x64(key, seed) {
|
|
|
211
211
|
/**
|
|
212
212
|
* x64 version of Murmur3 for 128bits.
|
|
213
213
|
*
|
|
214
|
-
* @param
|
|
214
|
+
* @param str - The string to hash.
|
|
215
215
|
*/
|
|
216
216
|
function hash128(str, seed) {
|
|
217
217
|
return hash128x64((0, common_1.UTF16ToUTF8)(str), seed >>> 0);
|
|
@@ -146,7 +146,7 @@ function hash128x86(key, seed) {
|
|
|
146
146
|
* x86 version of Murmur3 for 128bits.
|
|
147
147
|
* Used by hashImpression128 because in JS it is more efficient than the x64 version, no matter the underlying OS/CPU arch.
|
|
148
148
|
*
|
|
149
|
-
* @param
|
|
149
|
+
* @param str - The string to hash.
|
|
150
150
|
*/
|
|
151
151
|
function hash128(str, seed) {
|
|
152
152
|
return hash128x86((0, common_1.UTF16ToUTF8)(str), seed >>> 0);
|
|
@@ -24,7 +24,7 @@ function hex2dec(s) {
|
|
|
24
24
|
/**
|
|
25
25
|
* Gets the higher 64 bits of the x64 version of Murmur3 for 128bits, as decimal and hexadecimal number strings.
|
|
26
26
|
* Used for MySegments channel V2 notifications.
|
|
27
|
-
* @param
|
|
27
|
+
* @param str - The string to hash
|
|
28
28
|
*/
|
|
29
29
|
function hash64(str) {
|
|
30
30
|
var hex = (0, murmur3_128_1.hash128)(str).slice(0, 16);
|
|
@@ -11,10 +11,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
11
11
|
exports.stringDestination = exports.stringSource = exports.encodeUTF16toUTF8 = void 0;
|
|
12
12
|
/**
|
|
13
13
|
* Encodes UTF8 code points to UTF8 bytes.
|
|
14
|
-
* @param
|
|
14
|
+
* @param src - Code points source, either as a function returning the next code point
|
|
15
15
|
* respectively `null` if there are no more code points left or a single numeric code point.
|
|
16
|
-
* @param
|
|
17
|
-
* @expose
|
|
16
|
+
* @param dst - Bytes destination as a function successively called with the next byte
|
|
18
17
|
*/
|
|
19
18
|
function encodeUTF8(src, dst) {
|
|
20
19
|
var cp = null;
|
|
@@ -34,11 +33,10 @@ function encodeUTF8(src, dst) {
|
|
|
34
33
|
}
|
|
35
34
|
/**
|
|
36
35
|
* Converts UTF16 characters to UTF8 code points.
|
|
37
|
-
* @param
|
|
36
|
+
* @param src - Characters source as a function returning the next char code respectively
|
|
38
37
|
* `null` if there are no more characters left.
|
|
39
|
-
* @param
|
|
38
|
+
* @param dst - Code points destination as a function successively called with each converted code
|
|
40
39
|
* point.
|
|
41
|
-
* @expose
|
|
42
40
|
*/
|
|
43
41
|
function UTF16toUTF8(src, dst) {
|
|
44
42
|
var c1, c2 = null;
|
|
@@ -62,10 +60,9 @@ function UTF16toUTF8(src, dst) {
|
|
|
62
60
|
}
|
|
63
61
|
/**
|
|
64
62
|
* Converts and encodes UTF16 characters to UTF8 bytes.
|
|
65
|
-
* @param
|
|
63
|
+
* @param src - Characters source as a function returning the next char code respectively `null`
|
|
66
64
|
* if there are no more characters left.
|
|
67
|
-
* @param
|
|
68
|
-
* @expose
|
|
65
|
+
* @param dst - Bytes destination as a function successively called with the next byte.
|
|
69
66
|
*/
|
|
70
67
|
function encodeUTF16toUTF8(src, dst) {
|
|
71
68
|
UTF16toUTF8(src, function (cp) {
|
|
@@ -75,17 +72,14 @@ function encodeUTF16toUTF8(src, dst) {
|
|
|
75
72
|
exports.encodeUTF16toUTF8 = encodeUTF16toUTF8;
|
|
76
73
|
/**
|
|
77
74
|
* String.fromCharCode reference for compile time renaming.
|
|
78
|
-
* @type {!function(...[number]):string}
|
|
79
|
-
* @inner
|
|
80
75
|
*/
|
|
81
76
|
var stringFromCharCode = String.fromCharCode;
|
|
82
77
|
/**
|
|
83
78
|
* Creates a source function for a string.
|
|
84
|
-
* @param
|
|
85
|
-
* @returns
|
|
79
|
+
* @param s - String to read from
|
|
80
|
+
* @returns Source function returning the next char code respectively `null` if there are
|
|
86
81
|
* no more characters left.
|
|
87
|
-
* @throws
|
|
88
|
-
* @expose
|
|
82
|
+
* @throws If the argument is invalid
|
|
89
83
|
*/
|
|
90
84
|
function stringSource(s) {
|
|
91
85
|
if (typeof s !== 'string')
|
|
@@ -98,9 +92,8 @@ function stringSource(s) {
|
|
|
98
92
|
exports.stringSource = stringSource;
|
|
99
93
|
/**
|
|
100
94
|
* Creates a destination function for a string.
|
|
101
|
-
* @returns
|
|
95
|
+
* @returns Destination function successively called with the next char code.
|
|
102
96
|
* Returns the final string when called without arguments.
|
|
103
|
-
* @expose
|
|
104
97
|
*/
|
|
105
98
|
function stringDestination() {
|
|
106
99
|
var cs = [], ps = [];
|
|
@@ -14,8 +14,8 @@ exports.promiseWrapper = void 0;
|
|
|
14
14
|
* - If the wrapped promise is rejected when using native async/await syntax, the `defaultOnRejected` handler is invoked
|
|
15
15
|
* and neither the catch block nor the remaining try block are executed.
|
|
16
16
|
*
|
|
17
|
-
* @param customPromise promise to wrap
|
|
18
|
-
* @param defaultOnRejected default onRejected function
|
|
17
|
+
* @param customPromise - promise to wrap
|
|
18
|
+
* @param defaultOnRejected - default onRejected function
|
|
19
19
|
* @returns a promise that doesn't need to be handled for rejection (except when using async/await syntax) and
|
|
20
20
|
* includes a method named `hasOnFulfilled` that returns true if the promise has attached an onFulfilled handler.
|
|
21
21
|
*/
|
|
@@ -83,8 +83,8 @@ function fromSecondsToMillis(n) {
|
|
|
83
83
|
* Validates the given config and use it to build a settings object.
|
|
84
84
|
* NOTE: it doesn't validate the SDK Key. Call `validateApiKey` or `validateAndTrackApiKey` for that after settings validation.
|
|
85
85
|
*
|
|
86
|
-
* @param config user defined configuration
|
|
87
|
-
* @param validationParams defaults and fields validators used to validate and creates a settings object from a given config
|
|
86
|
+
* @param config - user defined configuration
|
|
87
|
+
* @param validationParams - defaults and fields validators used to validate and creates a settings object from a given config
|
|
88
88
|
*/
|
|
89
89
|
function settingsValidation(config, validationParams) {
|
|
90
90
|
var defaults = validationParams.defaults, runtime = validationParams.runtime, storage = validationParams.storage, integrations = validationParams.integrations, logger = validationParams.logger, consent = validationParams.consent, flagSpec = validationParams.flagSpec;
|
|
@@ -5,11 +5,11 @@ var constants_1 = require("../../../logger/constants");
|
|
|
5
5
|
/**
|
|
6
6
|
* This function validates `settings.integrations` object
|
|
7
7
|
*
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
8
|
+
* @param settings - config object provided by the user to initialize the sdk
|
|
9
|
+
* @param integrationValidator - filter used to remove invalid integration items
|
|
10
|
+
* @param extraWarning - optional string used to better describe why an item might be invalid
|
|
11
11
|
*
|
|
12
|
-
* @returns
|
|
12
|
+
* @returns array of valid integration items. The array might be empty if `settings` object does not have valid integrations.
|
|
13
13
|
*/
|
|
14
14
|
function validateIntegrations(settings, integrationValidator, extraWarning) {
|
|
15
15
|
var integrations = settings.integrations, log = settings.log;
|
|
@@ -6,10 +6,10 @@ var lang_1 = require("../../lang");
|
|
|
6
6
|
/**
|
|
7
7
|
* This function validates `settings.integrations` object that consists of a list of configuration items, used by the isomorphic JS SDK.
|
|
8
8
|
*
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
9
|
+
* @param settings - config object provided by the user to initialize the sdk
|
|
10
|
+
* @param validIntegrationTypes - list of integration types to filter from `settings.integrations`
|
|
11
11
|
*
|
|
12
|
-
* @returns
|
|
12
|
+
* @returns array of valid integration items. The array might be empty if `settings` object does not have valid integrations.
|
|
13
13
|
*/
|
|
14
14
|
function validateConfigurableIntegrations(settings, validIntegrationTypes) {
|
|
15
15
|
if (validIntegrationTypes === void 0) { validIntegrationTypes = []; }
|