@splitsoftware/splitio-commons 1.0.1-rc.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.txt +10 -3
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/cjs/evaluator/Engine.js +6 -5
- package/cjs/evaluator/combiners/and.js +4 -4
- package/cjs/evaluator/combiners/ifelseif.js +4 -3
- package/cjs/evaluator/condition/index.js +4 -3
- package/cjs/evaluator/index.js +10 -11
- package/cjs/evaluator/matchers/all.js +2 -1
- package/cjs/evaluator/matchers/between.js +2 -1
- package/cjs/evaluator/matchers/boolean.js +2 -1
- package/cjs/evaluator/matchers/cont_all.js +3 -2
- package/cjs/evaluator/matchers/cont_any.js +3 -2
- package/cjs/evaluator/matchers/cont_str.js +2 -1
- package/cjs/evaluator/matchers/dependency.js +4 -4
- package/cjs/evaluator/matchers/eq.js +2 -1
- package/cjs/evaluator/matchers/eq_set.js +2 -1
- package/cjs/evaluator/matchers/ew.js +2 -1
- package/cjs/evaluator/matchers/gte.js +2 -1
- package/cjs/evaluator/matchers/index.js +36 -36
- package/cjs/evaluator/matchers/lte.js +2 -1
- package/cjs/evaluator/matchers/part_of.js +3 -2
- package/cjs/evaluator/matchers/segment.js +5 -5
- package/cjs/evaluator/matchers/string.js +2 -1
- package/cjs/evaluator/matchers/sw.js +2 -1
- package/cjs/evaluator/matchers/whitelist.js +2 -1
- package/cjs/evaluator/matchersTransform/index.js +12 -12
- package/cjs/evaluator/matchersTransform/segment.js +3 -2
- package/cjs/evaluator/matchersTransform/set.js +3 -2
- package/cjs/evaluator/matchersTransform/unaryNumeric.js +3 -2
- package/cjs/evaluator/matchersTransform/whitelist.js +3 -2
- package/cjs/evaluator/parser/index.js +16 -16
- package/cjs/evaluator/treatments/index.js +2 -1
- package/cjs/evaluator/value/index.js +5 -5
- package/cjs/evaluator/value/sanitize.js +2 -1
- package/cjs/integrations/browser.js +4 -4
- package/cjs/integrations/ga/GaToSplit.js +3 -4
- package/cjs/integrations/pluggable.js +3 -2
- package/cjs/listeners/browser.js +4 -4
- package/cjs/listeners/node.js +4 -4
- package/cjs/logger/index.js +2 -3
- package/cjs/logger/messages/info.js +1 -1
- package/cjs/logger/messages/warn.js +2 -2
- package/cjs/readiness/readinessManager.js +3 -4
- package/cjs/readiness/sdkReadinessManager.js +7 -7
- package/cjs/sdkClient/client.js +5 -5
- package/cjs/sdkClient/clientCS.js +4 -4
- package/cjs/sdkClient/clientInputValidation.js +5 -5
- package/cjs/sdkClient/sdkClient.js +5 -6
- package/cjs/sdkClient/sdkClientMethodCS.js +4 -5
- package/cjs/sdkClient/sdkClientMethodCSWithTT.js +4 -5
- package/cjs/sdkFactory/index.js +9 -10
- package/cjs/sdkManager/index.js +6 -7
- package/cjs/services/splitApi.js +2 -3
- package/cjs/services/splitHttpClient.js +3 -4
- package/cjs/storages/AbstractSegmentsCacheSync.js +2 -1
- package/cjs/storages/AbstractSplitsCacheAsync.js +2 -1
- package/cjs/storages/AbstractSplitsCacheSync.js +2 -2
- package/cjs/storages/KeyBuilder.js +2 -2
- package/cjs/storages/KeyBuilderCS.js +4 -3
- package/cjs/storages/KeyBuilderSS.js +4 -3
- package/cjs/storages/findLatencyIndex.js +2 -1
- package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +4 -3
- package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +4 -3
- package/cjs/storages/inLocalStorage/index.js +20 -21
- package/cjs/storages/inMemory/CountsCacheInMemory.js +2 -1
- package/cjs/storages/inMemory/EventsCacheInMemory.js +2 -1
- package/cjs/storages/inMemory/ImpressionCountsCacheInMemory.js +2 -1
- package/cjs/storages/inMemory/ImpressionsCacheInMemory.js +2 -1
- package/cjs/storages/inMemory/InMemoryStorage.js +10 -11
- package/cjs/storages/inMemory/InMemoryStorageCS.js +12 -13
- package/cjs/storages/inMemory/LatenciesCacheInMemory.js +4 -4
- package/cjs/storages/inMemory/MySegmentsCacheInMemory.js +4 -3
- package/cjs/storages/inMemory/SegmentsCacheInMemory.js +4 -3
- package/cjs/storages/inMemory/SplitsCacheInMemory.js +4 -3
- package/cjs/storages/inRedis/CountsCacheInRedis.js +2 -1
- package/cjs/storages/inRedis/EventsCacheInRedis.js +2 -1
- package/cjs/storages/inRedis/ImpressionsCacheInRedis.js +2 -1
- package/cjs/storages/inRedis/LatenciesCacheInRedis.js +4 -4
- package/cjs/storages/inRedis/RedisAdapter.js +6 -5
- package/cjs/storages/inRedis/SegmentsCacheInRedis.js +2 -1
- package/cjs/storages/inRedis/SplitsCacheInRedis.js +4 -3
- package/cjs/storages/inRedis/index.js +16 -17
- package/cjs/storages/pluggable/SplitsCachePluggable.js +2 -2
- package/cjs/storages/pluggable/index.js +8 -8
- package/cjs/sync/offline/splitsParser/parseCondition.js +2 -1
- package/cjs/sync/offline/splitsParser/splitsParserFromFile.js +3 -3
- package/cjs/sync/offline/splitsParser/splitsParserFromSettings.js +2 -3
- package/cjs/sync/offline/syncManagerOffline.js +3 -4
- package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +4 -5
- package/cjs/sync/polling/fetchers/mySegmentsFetcher.js +2 -1
- package/cjs/sync/polling/fetchers/segmentChangesFetcher.js +2 -1
- package/cjs/sync/polling/fetchers/splitChangesFetcher.js +2 -1
- package/cjs/sync/polling/pollingManagerCS.js +6 -6
- package/cjs/sync/polling/pollingManagerSS.js +8 -8
- package/cjs/sync/polling/syncTasks/mySegmentsSyncTask.js +5 -5
- package/cjs/sync/polling/syncTasks/segmentsSyncTask.js +5 -5
- package/cjs/sync/polling/syncTasks/splitsSyncTask.js +5 -5
- package/cjs/sync/polling/updaters/mySegmentsUpdater.js +2 -3
- package/cjs/sync/polling/updaters/segmentChangesUpdater.js +2 -3
- package/cjs/sync/polling/updaters/splitChangesUpdater.js +8 -6
- package/cjs/sync/streaming/AuthClient/index.js +2 -3
- package/cjs/sync/streaming/SSEClient/index.js +2 -1
- package/cjs/sync/streaming/SSEHandler/NotificationKeeper.js +2 -1
- package/cjs/sync/streaming/SSEHandler/index.js +4 -4
- package/cjs/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +4 -4
- package/cjs/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +4 -4
- package/cjs/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +4 -4
- package/cjs/sync/streaming/pushManager.js +18 -17
- package/cjs/sync/submitters/submitterSyncTask.js +2 -3
- package/cjs/sync/syncTask.js +2 -1
- package/cjs/trackers/eventTracker.js +7 -7
- package/cjs/trackers/impressionObserver/ImpressionObserver.js +4 -4
- package/cjs/trackers/impressionObserver/impressionObserverCS.js +2 -3
- package/cjs/trackers/impressionObserver/impressionObserverSS.js +2 -3
- package/cjs/trackers/impressionsTracker.js +6 -6
- package/cjs/utils/Backoff.js +2 -1
- package/cjs/utils/LRUCache/index.js +2 -1
- package/cjs/utils/MinEventEmitter.js +2 -1
- package/cjs/utils/MinEvents.js +13 -15
- package/cjs/utils/inputValidation/trafficTypeExistance.js +2 -3
- package/cjs/utils/lang/binarySearch.js +2 -1
- package/cjs/utils/lang/objectAssign.js +85 -0
- package/cjs/utils/promise/thenable.js +5 -1
- package/cjs/utils/promise/timeout.js +2 -1
- package/cjs/utils/promise/wrapper.js +2 -1
- package/cjs/utils/settingsValidation/impressionsMode.js +2 -1
- package/cjs/utils/settingsValidation/index.js +5 -6
- package/cjs/utils/settingsValidation/mode.js +2 -1
- package/cjs/utils/timeTracker/index.js +7 -8
- package/cjs/utils/timeTracker/now/browser.js +2 -2
- package/cjs/utils/timeTracker/now/node.js +2 -1
- package/cjs/utils/timeTracker/timer.js +3 -2
- package/esm/evaluator/Engine.js +3 -3
- package/esm/evaluator/combiners/and.js +2 -2
- package/esm/evaluator/combiners/ifelseif.js +2 -2
- package/esm/evaluator/condition/index.js +2 -2
- package/esm/evaluator/index.js +5 -6
- package/esm/evaluator/matchers/all.js +1 -1
- package/esm/evaluator/matchers/between.js +1 -1
- package/esm/evaluator/matchers/boolean.js +1 -1
- package/esm/evaluator/matchers/cont_all.js +1 -1
- package/esm/evaluator/matchers/cont_any.js +1 -1
- package/esm/evaluator/matchers/cont_str.js +1 -1
- package/esm/evaluator/matchers/dependency.js +2 -2
- package/esm/evaluator/matchers/eq.js +1 -1
- package/esm/evaluator/matchers/eq_set.js +1 -1
- package/esm/evaluator/matchers/ew.js +1 -1
- package/esm/evaluator/matchers/gte.js +1 -1
- package/esm/evaluator/matchers/index.js +35 -35
- package/esm/evaluator/matchers/lte.js +1 -1
- package/esm/evaluator/matchers/part_of.js +1 -1
- package/esm/evaluator/matchers/segment.js +2 -2
- package/esm/evaluator/matchers/string.js +1 -1
- package/esm/evaluator/matchers/sw.js +1 -1
- package/esm/evaluator/matchers/whitelist.js +1 -1
- package/esm/evaluator/matchersTransform/index.js +5 -5
- package/esm/evaluator/matchersTransform/segment.js +1 -1
- package/esm/evaluator/matchersTransform/set.js +1 -1
- package/esm/evaluator/matchersTransform/unaryNumeric.js +1 -1
- package/esm/evaluator/matchersTransform/whitelist.js +1 -1
- package/esm/evaluator/parser/index.js +11 -11
- package/esm/evaluator/treatments/index.js +1 -1
- package/esm/evaluator/value/index.js +3 -3
- package/esm/evaluator/value/sanitize.js +1 -1
- package/esm/integrations/browser.js +2 -2
- package/esm/integrations/ga/GaToSplit.js +1 -1
- package/esm/integrations/pluggable.js +1 -1
- package/esm/listeners/browser.js +2 -2
- package/esm/listeners/node.js +2 -2
- package/esm/logger/index.js +1 -1
- package/esm/logger/messages/info.js +1 -1
- package/esm/logger/messages/warn.js +2 -2
- package/esm/readiness/readinessManager.js +1 -1
- package/esm/readiness/sdkReadinessManager.js +3 -3
- package/esm/sdkClient/client.js +2 -2
- package/esm/sdkClient/clientCS.js +2 -2
- package/esm/sdkClient/clientInputValidation.js +2 -2
- package/esm/sdkClient/sdkClient.js +3 -3
- package/esm/sdkClient/sdkClientMethodCS.js +2 -2
- package/esm/sdkClient/sdkClientMethodCSWithTT.js +2 -2
- package/esm/sdkFactory/index.js +6 -6
- package/esm/sdkManager/index.js +2 -2
- package/esm/services/splitApi.js +1 -1
- package/esm/services/splitHttpClient.js +1 -1
- package/esm/storages/AbstractSegmentsCacheSync.js +1 -1
- package/esm/storages/AbstractSplitsCacheAsync.js +1 -1
- package/esm/storages/AbstractSplitsCacheSync.js +1 -1
- package/esm/storages/KeyBuilder.js +1 -1
- package/esm/storages/KeyBuilderCS.js +2 -2
- package/esm/storages/KeyBuilderSS.js +2 -2
- package/esm/storages/findLatencyIndex.js +1 -1
- package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +2 -2
- package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +2 -2
- package/esm/storages/inLocalStorage/index.js +8 -8
- package/esm/storages/inMemory/CountsCacheInMemory.js +1 -1
- package/esm/storages/inMemory/EventsCacheInMemory.js +1 -1
- package/esm/storages/inMemory/ImpressionCountsCacheInMemory.js +1 -1
- package/esm/storages/inMemory/ImpressionsCacheInMemory.js +1 -1
- package/esm/storages/inMemory/InMemoryStorage.js +5 -5
- package/esm/storages/inMemory/InMemoryStorageCS.js +5 -5
- package/esm/storages/inMemory/LatenciesCacheInMemory.js +2 -2
- package/esm/storages/inMemory/MySegmentsCacheInMemory.js +2 -2
- package/esm/storages/inMemory/SegmentsCacheInMemory.js +2 -2
- package/esm/storages/inMemory/SplitsCacheInMemory.js +2 -2
- package/esm/storages/inRedis/CountsCacheInRedis.js +1 -1
- package/esm/storages/inRedis/EventsCacheInRedis.js +1 -1
- package/esm/storages/inRedis/ImpressionsCacheInRedis.js +1 -1
- package/esm/storages/inRedis/LatenciesCacheInRedis.js +2 -2
- package/esm/storages/inRedis/RedisAdapter.js +3 -3
- package/esm/storages/inRedis/SegmentsCacheInRedis.js +1 -1
- package/esm/storages/inRedis/SplitsCacheInRedis.js +2 -2
- package/esm/storages/inRedis/index.js +8 -8
- package/esm/storages/pluggable/SplitsCachePluggable.js +1 -1
- package/esm/storages/pluggable/index.js +4 -4
- package/esm/sync/offline/splitsParser/parseCondition.js +1 -1
- package/esm/sync/offline/splitsParser/splitsParserFromFile.js +1 -1
- package/esm/sync/offline/splitsParser/splitsParserFromSettings.js +1 -1
- package/esm/sync/offline/syncManagerOffline.js +2 -2
- package/esm/sync/offline/syncTasks/fromObjectSyncTask.js +2 -2
- package/esm/sync/polling/fetchers/mySegmentsFetcher.js +1 -1
- package/esm/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
- package/esm/sync/polling/fetchers/splitChangesFetcher.js +1 -1
- package/esm/sync/polling/pollingManagerCS.js +3 -3
- package/esm/sync/polling/pollingManagerSS.js +4 -4
- package/esm/sync/polling/syncTasks/mySegmentsSyncTask.js +3 -3
- package/esm/sync/polling/syncTasks/segmentsSyncTask.js +3 -3
- package/esm/sync/polling/syncTasks/splitsSyncTask.js +3 -3
- package/esm/sync/polling/updaters/mySegmentsUpdater.js +1 -1
- package/esm/sync/polling/updaters/segmentChangesUpdater.js +1 -1
- package/esm/sync/polling/updaters/splitChangesUpdater.js +7 -4
- package/esm/sync/streaming/AuthClient/index.js +1 -1
- package/esm/sync/streaming/SSEClient/index.js +1 -1
- package/esm/sync/streaming/SSEHandler/NotificationKeeper.js +1 -1
- package/esm/sync/streaming/SSEHandler/index.js +2 -2
- package/esm/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +2 -2
- package/esm/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +2 -2
- package/esm/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +2 -2
- package/esm/sync/streaming/pushManager.js +10 -9
- package/esm/sync/submitters/submitterSyncTask.js +1 -1
- package/esm/sync/syncTask.js +1 -1
- package/esm/trackers/eventTracker.js +3 -3
- package/esm/trackers/impressionObserver/ImpressionObserver.js +2 -2
- package/esm/trackers/impressionObserver/impressionObserverCS.js +1 -1
- package/esm/trackers/impressionObserver/impressionObserverSS.js +1 -1
- package/esm/trackers/impressionsTracker.js +3 -3
- package/esm/utils/Backoff.js +1 -1
- package/esm/utils/LRUCache/index.js +1 -1
- package/esm/utils/MinEventEmitter.js +1 -1
- package/esm/utils/MinEvents.js +2 -5
- package/esm/utils/inputValidation/trafficTypeExistance.js +1 -1
- package/esm/utils/lang/binarySearch.js +1 -1
- package/esm/utils/lang/objectAssign.js +82 -0
- package/esm/utils/promise/thenable.js +3 -1
- package/esm/utils/promise/timeout.js +1 -1
- package/esm/utils/promise/wrapper.js +1 -1
- package/esm/utils/settingsValidation/impressionsMode.js +1 -1
- package/esm/utils/settingsValidation/index.js +3 -3
- package/esm/utils/settingsValidation/mode.js +1 -1
- package/esm/utils/timeTracker/index.js +4 -5
- package/esm/utils/timeTracker/now/browser.js +1 -2
- package/esm/utils/timeTracker/now/node.js +1 -1
- package/esm/utils/timeTracker/timer.js +1 -1
- package/package.json +2 -3
- package/src/evaluator/Engine.ts +3 -3
- package/src/evaluator/combiners/and.ts +2 -2
- package/src/evaluator/combiners/ifelseif.ts +2 -2
- package/src/evaluator/condition/index.ts +2 -2
- package/src/evaluator/index.ts +5 -6
- package/src/evaluator/matchers/all.ts +1 -1
- package/src/evaluator/matchers/between.ts +1 -1
- package/src/evaluator/matchers/boolean.ts +1 -1
- package/src/evaluator/matchers/cont_all.ts +1 -1
- package/src/evaluator/matchers/cont_any.ts +1 -1
- package/src/evaluator/matchers/cont_str.ts +1 -1
- package/src/evaluator/matchers/dependency.ts +2 -2
- package/src/evaluator/matchers/eq.ts +1 -1
- package/src/evaluator/matchers/eq_set.ts +1 -1
- package/src/evaluator/matchers/ew.ts +1 -1
- package/src/evaluator/matchers/gte.ts +1 -1
- package/src/evaluator/matchers/index.ts +35 -35
- package/src/evaluator/matchers/lte.ts +1 -1
- package/src/evaluator/matchers/part_of.ts +1 -1
- package/src/evaluator/matchers/segment.ts +2 -2
- package/src/evaluator/matchers/string.ts +1 -1
- package/src/evaluator/matchers/sw.ts +1 -1
- package/src/evaluator/matchers/whitelist.ts +1 -1
- package/src/evaluator/matchersTransform/index.ts +5 -5
- package/src/evaluator/matchersTransform/segment.ts +1 -1
- package/src/evaluator/matchersTransform/set.ts +1 -1
- package/src/evaluator/matchersTransform/unaryNumeric.ts +1 -1
- package/src/evaluator/matchersTransform/whitelist.ts +1 -1
- package/src/evaluator/parser/index.ts +12 -12
- package/src/evaluator/treatments/index.ts +1 -1
- package/src/evaluator/value/index.ts +3 -3
- package/src/evaluator/value/sanitize.ts +1 -1
- package/src/integrations/browser.ts +2 -2
- package/src/integrations/ga/GaToSplit.ts +1 -1
- package/src/integrations/pluggable.ts +1 -1
- package/src/listeners/browser.ts +2 -2
- package/src/listeners/node.ts +2 -2
- package/src/logger/index.ts +1 -1
- package/src/logger/messages/info.ts +1 -1
- package/src/logger/messages/warn.ts +2 -2
- package/src/readiness/readinessManager.ts +2 -2
- package/src/readiness/sdkReadinessManager.ts +3 -3
- package/src/sdkClient/client.ts +2 -2
- package/src/sdkClient/clientCS.ts +2 -2
- package/src/sdkClient/clientInputValidation.ts +2 -2
- package/src/sdkClient/sdkClient.ts +3 -3
- package/src/sdkClient/sdkClientMethodCS.ts +2 -2
- package/src/sdkClient/sdkClientMethodCSWithTT.ts +2 -2
- package/src/sdkFactory/index.ts +6 -6
- package/src/sdkManager/index.ts +2 -2
- package/src/services/splitApi.ts +1 -1
- package/src/services/splitHttpClient.ts +1 -1
- package/src/services/types.ts +1 -1
- package/src/storages/AbstractSegmentsCacheSync.ts +1 -1
- package/src/storages/AbstractSplitsCacheAsync.ts +1 -1
- package/src/storages/AbstractSplitsCacheSync.ts +1 -1
- package/src/storages/KeyBuilder.ts +1 -1
- package/src/storages/KeyBuilderCS.ts +2 -2
- package/src/storages/KeyBuilderSS.ts +2 -2
- package/src/storages/findLatencyIndex.ts +1 -1
- package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +3 -3
- package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +3 -3
- package/src/storages/inLocalStorage/index.ts +8 -8
- package/src/storages/inMemory/CountsCacheInMemory.ts +1 -1
- package/src/storages/inMemory/EventsCacheInMemory.ts +1 -1
- package/src/storages/inMemory/ImpressionCountsCacheInMemory.ts +1 -1
- package/src/storages/inMemory/ImpressionsCacheInMemory.ts +1 -1
- package/src/storages/inMemory/InMemoryStorage.ts +5 -5
- package/src/storages/inMemory/InMemoryStorageCS.ts +5 -5
- package/src/storages/inMemory/LatenciesCacheInMemory.ts +2 -2
- package/src/storages/inMemory/MySegmentsCacheInMemory.ts +2 -2
- package/src/storages/inMemory/SegmentsCacheInMemory.ts +2 -2
- package/src/storages/inMemory/SplitsCacheInMemory.ts +2 -2
- package/src/storages/inRedis/CountsCacheInRedis.ts +2 -2
- package/src/storages/inRedis/EventsCacheInRedis.ts +1 -1
- package/src/storages/inRedis/ImpressionsCacheInRedis.ts +1 -1
- package/src/storages/inRedis/LatenciesCacheInRedis.ts +3 -3
- package/src/storages/inRedis/RedisAdapter.ts +3 -3
- package/src/storages/inRedis/SegmentsCacheInRedis.ts +2 -2
- package/src/storages/inRedis/SplitsCacheInRedis.ts +3 -3
- package/src/storages/inRedis/index.ts +8 -8
- package/src/storages/pluggable/SegmentsCachePluggable.ts +1 -1
- package/src/storages/pluggable/SplitsCachePluggable.ts +2 -2
- package/src/storages/pluggable/index.ts +4 -4
- package/src/storages/types.ts +2 -2
- package/src/sync/offline/splitsParser/parseCondition.ts +1 -1
- package/src/sync/offline/splitsParser/splitsParserFromFile.ts +1 -1
- package/src/sync/offline/splitsParser/splitsParserFromSettings.ts +1 -1
- package/src/sync/offline/syncManagerOffline.ts +2 -2
- package/src/sync/offline/syncTasks/fromObjectSyncTask.ts +2 -2
- package/src/sync/polling/fetchers/mySegmentsFetcher.ts +1 -1
- package/src/sync/polling/fetchers/segmentChangesFetcher.ts +1 -1
- package/src/sync/polling/fetchers/splitChangesFetcher.ts +1 -1
- package/src/sync/polling/pollingManagerCS.ts +3 -3
- package/src/sync/polling/pollingManagerSS.ts +4 -4
- package/src/sync/polling/syncTasks/mySegmentsSyncTask.ts +3 -3
- package/src/sync/polling/syncTasks/segmentsSyncTask.ts +3 -3
- package/src/sync/polling/syncTasks/splitsSyncTask.ts +3 -3
- package/src/sync/polling/updaters/mySegmentsUpdater.ts +1 -1
- package/src/sync/polling/updaters/segmentChangesUpdater.ts +1 -1
- package/src/sync/polling/updaters/splitChangesUpdater.ts +6 -3
- package/src/sync/streaming/AuthClient/index.ts +1 -1
- package/src/sync/streaming/SSEClient/index.ts +1 -1
- package/src/sync/streaming/SSEHandler/NotificationKeeper.ts +1 -1
- package/src/sync/streaming/SSEHandler/index.ts +2 -2
- package/src/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.ts +2 -2
- package/src/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.ts +2 -2
- package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +2 -2
- package/src/sync/streaming/UpdateWorkers/types.ts +1 -1
- package/src/sync/streaming/pushManager.ts +10 -9
- package/src/sync/submitters/submitterSyncTask.ts +1 -1
- package/src/sync/syncTask.ts +1 -1
- package/src/trackers/eventTracker.ts +3 -3
- package/src/trackers/impressionObserver/ImpressionObserver.ts +2 -2
- package/src/trackers/impressionObserver/impressionObserverCS.ts +1 -1
- package/src/trackers/impressionObserver/impressionObserverSS.ts +1 -1
- package/src/trackers/impressionsTracker.ts +3 -3
- package/src/utils/Backoff.ts +1 -1
- package/src/utils/LRUCache/index.ts +1 -1
- package/src/utils/MinEventEmitter.ts +1 -1
- package/src/utils/MinEvents.ts +2 -7
- package/src/utils/inputValidation/trafficTypeExistance.ts +1 -1
- package/src/utils/lang/binarySearch.ts +1 -1
- package/src/utils/lang/objectAssign.ts +104 -0
- package/src/utils/promise/thenable.ts +3 -1
- package/src/utils/promise/timeout.ts +1 -1
- package/src/utils/promise/wrapper.ts +1 -1
- package/src/utils/settingsValidation/impressionsMode.ts +1 -1
- package/src/utils/settingsValidation/index.ts +3 -3
- package/src/utils/settingsValidation/mode.ts +1 -1
- package/src/utils/timeTracker/index.ts +4 -6
- package/src/utils/timeTracker/now/browser.ts +1 -3
- package/src/utils/timeTracker/now/node.ts +1 -1
- package/src/utils/timeTracker/timer.ts +1 -1
- package/types/evaluator/Engine.d.ts +1 -1
- package/types/evaluator/combiners/and.d.ts +1 -1
- package/types/evaluator/combiners/ifelseif.d.ts +1 -1
- package/types/evaluator/condition/index.d.ts +1 -1
- package/types/evaluator/matchers/all.d.ts +1 -1
- package/types/evaluator/matchers/between.d.ts +1 -1
- package/types/evaluator/matchers/boolean.d.ts +1 -1
- package/types/evaluator/matchers/cont_all.d.ts +1 -1
- package/types/evaluator/matchers/cont_any.d.ts +1 -1
- package/types/evaluator/matchers/cont_str.d.ts +1 -1
- package/types/evaluator/matchers/dependency.d.ts +1 -1
- package/types/evaluator/matchers/eq.d.ts +1 -1
- package/types/evaluator/matchers/eq_set.d.ts +1 -1
- package/types/evaluator/matchers/ew.d.ts +1 -1
- package/types/evaluator/matchers/gte.d.ts +1 -1
- package/types/evaluator/matchers/index.d.ts +1 -1
- package/types/evaluator/matchers/lte.d.ts +1 -1
- package/types/evaluator/matchers/part_of.d.ts +1 -1
- package/types/evaluator/matchers/segment.d.ts +1 -1
- package/types/evaluator/matchers/string.d.ts +1 -1
- package/types/evaluator/matchers/sw.d.ts +1 -1
- package/types/evaluator/matchers/whitelist.d.ts +1 -1
- package/types/evaluator/matchersTransform/index.d.ts +1 -1
- package/types/evaluator/matchersTransform/segment.d.ts +1 -1
- package/types/evaluator/matchersTransform/set.d.ts +1 -1
- package/types/evaluator/matchersTransform/unaryNumeric.d.ts +1 -1
- package/types/evaluator/matchersTransform/whitelist.d.ts +1 -1
- package/types/evaluator/parser/index.d.ts +1 -1
- package/types/evaluator/treatments/index.d.ts +1 -1
- package/types/evaluator/value/index.d.ts +1 -1
- package/types/evaluator/value/sanitize.d.ts +1 -1
- package/types/integrations/browser.d.ts +1 -1
- package/types/integrations/pluggable.d.ts +1 -1
- package/types/listeners/browser.d.ts +1 -1
- package/types/listeners/node.d.ts +1 -1
- package/types/readiness/sdkReadinessManager.d.ts +1 -1
- package/types/sdkClient/client.d.ts +1 -1
- package/types/sdkClient/clientCS.d.ts +1 -1
- package/types/sdkClient/clientInputValidation.d.ts +1 -1
- package/types/services/types.d.ts +1 -3
- package/types/storages/AbstractSegmentsCacheSync.d.ts +1 -1
- package/types/storages/AbstractSplitsCacheAsync.d.ts +1 -1
- package/types/storages/AbstractSplitsCacheSync.d.ts +1 -1
- package/types/storages/KeyBuilder.d.ts +1 -1
- package/types/storages/KeyBuilderCS.d.ts +2 -2
- package/types/storages/KeyBuilderSS.d.ts +2 -2
- package/types/storages/findLatencyIndex.d.ts +1 -1
- package/types/storages/inLocalStorage/MySegmentsCacheInLocal.d.ts +3 -3
- package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +3 -3
- package/types/storages/inMemory/CountsCacheInMemory.d.ts +1 -1
- package/types/storages/inMemory/EventsCacheInMemory.d.ts +1 -1
- package/types/storages/inMemory/ImpressionCountsCacheInMemory.d.ts +1 -1
- package/types/storages/inMemory/ImpressionsCacheInMemory.d.ts +1 -1
- package/types/storages/inMemory/LatenciesCacheInMemory.d.ts +1 -1
- package/types/storages/inMemory/MySegmentsCacheInMemory.d.ts +2 -2
- package/types/storages/inMemory/SegmentsCacheInMemory.d.ts +2 -2
- package/types/storages/inMemory/SplitsCacheInMemory.d.ts +2 -2
- package/types/storages/inRedis/CountsCacheInRedis.d.ts +2 -2
- package/types/storages/inRedis/EventsCacheInRedis.d.ts +1 -1
- package/types/storages/inRedis/ImpressionsCacheInRedis.d.ts +1 -1
- package/types/storages/inRedis/LatenciesCacheInRedis.d.ts +2 -2
- package/types/storages/inRedis/RedisAdapter.d.ts +1 -1
- package/types/storages/inRedis/SegmentsCacheInRedis.d.ts +2 -2
- package/types/storages/inRedis/SplitsCacheInRedis.d.ts +3 -3
- package/types/storages/pluggable/SegmentsCachePluggable.d.ts +1 -1
- package/types/storages/pluggable/SplitsCachePluggable.d.ts +2 -2
- package/types/storages/types.d.ts +2 -2
- package/types/sync/offline/splitsParser/parseCondition.d.ts +1 -1
- package/types/sync/offline/syncTasks/fromObjectSyncTask.d.ts +1 -1
- package/types/sync/polling/fetchers/mySegmentsFetcher.d.ts +1 -1
- package/types/sync/polling/fetchers/segmentChangesFetcher.d.ts +1 -1
- package/types/sync/polling/fetchers/splitChangesFetcher.d.ts +1 -1
- package/types/sync/polling/pollingManagerCS.d.ts +1 -1
- package/types/sync/polling/pollingManagerSS.d.ts +1 -1
- package/types/sync/polling/syncTasks/mySegmentsSyncTask.d.ts +1 -1
- package/types/sync/polling/syncTasks/segmentsSyncTask.d.ts +1 -1
- package/types/sync/polling/syncTasks/splitsSyncTask.d.ts +1 -1
- package/types/sync/streaming/SSEClient/index.d.ts +1 -1
- package/types/sync/streaming/SSEHandler/NotificationKeeper.d.ts +1 -1
- package/types/sync/streaming/SSEHandler/index.d.ts +1 -1
- package/types/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.d.ts +2 -2
- package/types/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.d.ts +2 -2
- package/types/sync/streaming/UpdateWorkers/SplitsUpdateWorker.d.ts +2 -2
- package/types/sync/streaming/UpdateWorkers/types.d.ts +1 -1
- package/types/sync/streaming/pushManager.d.ts +1 -1
- package/types/sync/syncTask.d.ts +1 -1
- package/types/trackers/eventTracker.d.ts +1 -1
- package/types/trackers/impressionObserver/ImpressionObserver.d.ts +1 -1
- package/types/trackers/impressionObserver/impressionObserverCS.d.ts +1 -1
- package/types/trackers/impressionObserver/impressionObserverSS.d.ts +1 -1
- package/types/trackers/impressionsTracker.d.ts +1 -1
- package/types/utils/Backoff.d.ts +1 -1
- package/types/utils/LRUCache/index.d.ts +1 -1
- package/types/utils/MinEventEmitter.d.ts +1 -1
- package/types/utils/MinEvents.d.ts +3 -2
- package/types/utils/lang/binarySearch.d.ts +1 -1
- package/types/utils/lang/objectAssign.d.ts +3 -0
- package/types/utils/promise/thenable.d.ts +1 -2
- package/types/utils/promise/timeout.d.ts +1 -1
- package/types/utils/promise/wrapper.d.ts +1 -1
- package/types/utils/settingsValidation/impressionsMode.d.ts +1 -1
- package/types/utils/settingsValidation/mode.d.ts +1 -1
- package/types/utils/timeTracker/index.d.ts +2 -2
- package/types/utils/timeTracker/now/browser.d.ts +1 -2
- package/types/utils/timeTracker/now/node.d.ts +1 -1
- package/types/utils/timeTracker/timer.d.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
|
-
import KeyBuilderSS from '../KeyBuilderSS';
|
|
2
|
+
import { KeyBuilderSS } from '../KeyBuilderSS';
|
|
3
3
|
import { SplitsCachePluggable } from './SplitsCachePluggable';
|
|
4
4
|
import { SegmentsCachePluggable } from './SegmentsCachePluggable';
|
|
5
5
|
import { ImpressionsCachePluggable } from './ImpressionsCachePluggable';
|
|
@@ -8,9 +8,9 @@ import { wrapperAdapter, METHODS_TO_PROMISE_WRAP } from './wrapperAdapter';
|
|
|
8
8
|
import { isObject } from '../../utils/lang';
|
|
9
9
|
import { validatePrefix } from '../KeyBuilder';
|
|
10
10
|
import { CONSUMER_PARTIAL_MODE, STORAGE_PLUGGABLE } from '../../utils/constants';
|
|
11
|
-
import ImpressionsCacheInMemory from '../inMemory/ImpressionsCacheInMemory';
|
|
12
|
-
import EventsCacheInMemory from '../inMemory/EventsCacheInMemory';
|
|
13
|
-
import ImpressionCountsCacheInMemory from '../inMemory/ImpressionCountsCacheInMemory';
|
|
11
|
+
import { ImpressionsCacheInMemory } from '../inMemory/ImpressionsCacheInMemory';
|
|
12
|
+
import { EventsCacheInMemory } from '../inMemory/EventsCacheInMemory';
|
|
13
|
+
import { ImpressionCountsCacheInMemory } from '../inMemory/ImpressionCountsCacheInMemory';
|
|
14
14
|
var NO_VALID_WRAPPER = 'Expecting pluggable storage `wrapper` in options, but no valid wrapper instance was provided.';
|
|
15
15
|
var NO_VALID_WRAPPER_INTERFACE = 'The provided wrapper instance doesn’t follow the expected interface. Check our docs.';
|
|
16
16
|
/**
|
|
@@ -5,7 +5,7 @@ import path from 'path';
|
|
|
5
5
|
// @ts-ignore
|
|
6
6
|
import yaml from 'js-yaml';
|
|
7
7
|
import { isString, endsWith, find, forOwn, uniq, } from '../../../utils/lang';
|
|
8
|
-
import parseCondition from './parseCondition';
|
|
8
|
+
import { parseCondition } from './parseCondition';
|
|
9
9
|
var logPrefix = 'sync:offline:splits-fetcher: ';
|
|
10
10
|
var DEFAULT_FILENAME = '.split';
|
|
11
11
|
function configFilesPath(configFilePath) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import fromObjectSyncTaskFactory from './syncTasks/fromObjectSyncTask';
|
|
2
|
-
import objectAssign from '
|
|
1
|
+
import { fromObjectSyncTaskFactory } from './syncTasks/fromObjectSyncTask';
|
|
2
|
+
import { objectAssign } from '../../utils/lang/objectAssign';
|
|
3
3
|
import { SDK_SEGMENTS_ARRIVED } from '../../readiness/constants';
|
|
4
4
|
function flush() {
|
|
5
5
|
return Promise.resolve();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { forOwn } from '../../../utils/lang';
|
|
2
|
-
import syncTaskFactory from '../../syncTask';
|
|
2
|
+
import { syncTaskFactory } from '../../syncTask';
|
|
3
3
|
import { CONTROL } from '../../../utils/constants';
|
|
4
4
|
import { SDK_SPLITS_ARRIVED, SDK_SEGMENTS_ARRIVED, SDK_SPLITS_CACHE_LOADED } from '../../../readiness/constants';
|
|
5
5
|
import { SYNC_OFFLINE_DATA, ERROR_SYNC_OFFLINE_LOADING } from '../../../logger/constants';
|
|
@@ -63,6 +63,6 @@ export function fromObjectUpdaterFactory(splitsParser, storage, readiness, setti
|
|
|
63
63
|
/**
|
|
64
64
|
* PollingManager in Offline mode
|
|
65
65
|
*/
|
|
66
|
-
export
|
|
66
|
+
export function fromObjectSyncTaskFactory(splitsParser, storage, readiness, settings) {
|
|
67
67
|
return syncTaskFactory(settings.log, fromObjectUpdaterFactory(splitsParser, storage, readiness, settings), settings.scheduler.offlineRefreshRate, 'offlineUpdater');
|
|
68
68
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Factory of MySegments fetcher.
|
|
3
3
|
* MySegments fetcher is a wrapper around `mySegments` API service that parses the response and handle errors.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export function mySegmentsFetcherFactory(fetchMySegments, userMatchingKey) {
|
|
6
6
|
return function mySegmentsFetcher(noCache,
|
|
7
7
|
// Optional decorator for `fetchMySegments` promise, such as timeout or time tracker
|
|
8
8
|
decorator) {
|
|
@@ -18,7 +18,7 @@ function greedyFetch(fetchSegmentChanges, since, segmentName, noCache) {
|
|
|
18
18
|
* Factory of SegmentChanges fetcher.
|
|
19
19
|
* SegmentChanges fetcher is a wrapper around `segmentChanges` API service that parses the response and handle errors and retries.
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export function segmentChangesFetcherFactory(fetchSegmentChanges) {
|
|
22
22
|
return function segmentChangesFetcher(since, segmentName, noCache,
|
|
23
23
|
// Optional decorator for `fetchMySegments` promise, such as timeout or time tracker
|
|
24
24
|
decorator) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Factory of SplitChanges fetcher.
|
|
3
3
|
* SplitChanges fetcher is a wrapper around `splitChanges` API service that parses the response and handle errors.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export function splitChangesFetcherFactory(fetchSplitChanges) {
|
|
6
6
|
return function splitChangesFetcher(since, noCache,
|
|
7
7
|
// Optional decorator for `fetchSplitChanges` promise, such as timeout or time tracker
|
|
8
8
|
decorator) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { forOwn } from '../../utils/lang';
|
|
2
|
-
import mySegmentsSyncTaskFactory from './syncTasks/mySegmentsSyncTask';
|
|
3
|
-
import splitsSyncTaskFactory from './syncTasks/splitsSyncTask';
|
|
2
|
+
import { mySegmentsSyncTaskFactory } from './syncTasks/mySegmentsSyncTask';
|
|
3
|
+
import { splitsSyncTaskFactory } from './syncTasks/splitsSyncTask';
|
|
4
4
|
import { getMatching } from '../../utils/key';
|
|
5
5
|
import { SDK_SPLITS_ARRIVED, SDK_SEGMENTS_ARRIVED } from '../../readiness/constants';
|
|
6
6
|
import { POLLING_SMART_PAUSING, POLLING_START, POLLING_STOP } from '../../logger/constants';
|
|
@@ -8,7 +8,7 @@ import { POLLING_SMART_PAUSING, POLLING_START, POLLING_STOP } from '../../logger
|
|
|
8
8
|
* Expose start / stop mechanism for polling data from services.
|
|
9
9
|
* For client-side API with multiple clients.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export function pollingManagerCSFactory(splitApi, storage, readiness, settings) {
|
|
12
12
|
var log = settings.log;
|
|
13
13
|
var splitsSyncTask = splitsSyncTaskFactory(splitApi.fetchSplitChanges, storage, readiness, settings);
|
|
14
14
|
// Map of matching keys to their corresponding MySegmentsSyncTask.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import splitsSyncTaskFactory from './syncTasks/splitsSyncTask';
|
|
2
|
-
import segmentsSyncTaskFactory from './syncTasks/segmentsSyncTask';
|
|
3
|
-
import thenable from '../../utils/promise/thenable';
|
|
1
|
+
import { splitsSyncTaskFactory } from './syncTasks/splitsSyncTask';
|
|
2
|
+
import { segmentsSyncTaskFactory } from './syncTasks/segmentsSyncTask';
|
|
3
|
+
import { thenable } from '../../utils/promise/thenable';
|
|
4
4
|
import { POLLING_START, POLLING_STOP, LOG_PREFIX_SYNC_POLLING } from '../../logger/constants';
|
|
5
5
|
/**
|
|
6
6
|
* Expose start / stop mechanism for pulling data from services.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export function pollingManagerSSFactory(splitApi, storage, readiness, settings) {
|
|
9
9
|
var log = settings.log;
|
|
10
10
|
var splitsSyncTask = splitsSyncTaskFactory(splitApi.fetchSplitChanges, storage, readiness, settings);
|
|
11
11
|
var segmentsSyncTask = segmentsSyncTaskFactory(splitApi.fetchSegmentChanges, storage, readiness, settings);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import syncTaskFactory from '../../syncTask';
|
|
2
|
-
import mySegmentsFetcherFactory from '../fetchers/mySegmentsFetcher';
|
|
1
|
+
import { syncTaskFactory } from '../../syncTask';
|
|
2
|
+
import { mySegmentsFetcherFactory } from '../fetchers/mySegmentsFetcher';
|
|
3
3
|
import { mySegmentsUpdaterFactory } from '../updaters/mySegmentsUpdater';
|
|
4
4
|
/**
|
|
5
5
|
* Creates a sync task that periodically executes a `mySegmentsUpdater` task
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export function mySegmentsSyncTaskFactory(fetchMySegments, storage, readiness, settings, matchingKey) {
|
|
8
8
|
return syncTaskFactory(settings.log, mySegmentsUpdaterFactory(settings.log, mySegmentsFetcherFactory(fetchMySegments, matchingKey), storage.splits, storage.segments, readiness.segments, settings.startup.requestTimeoutBeforeReady, settings.startup.retriesOnFailureBeforeReady), settings.scheduler.segmentsRefreshRate, 'mySegmentsUpdater');
|
|
9
9
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import syncTaskFactory from '../../syncTask';
|
|
2
|
-
import segmentChangesFetcherFactory from '../fetchers/segmentChangesFetcher';
|
|
1
|
+
import { syncTaskFactory } from '../../syncTask';
|
|
2
|
+
import { segmentChangesFetcherFactory } from '../fetchers/segmentChangesFetcher';
|
|
3
3
|
import { segmentChangesUpdaterFactory } from '../updaters/segmentChangesUpdater';
|
|
4
4
|
/**
|
|
5
5
|
* Creates a sync task that periodically executes a `segmentChangesUpdater` task
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export function segmentsSyncTaskFactory(fetchSegmentChanges, storage, readiness, settings) {
|
|
8
8
|
return syncTaskFactory(settings.log, segmentChangesUpdaterFactory(settings.log, segmentChangesFetcherFactory(fetchSegmentChanges), storage.segments, readiness), settings.scheduler.segmentsRefreshRate, 'segmentChangesUpdater');
|
|
9
9
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import syncTaskFactory from '../../syncTask';
|
|
2
|
-
import splitChangesFetcherFactory from '../fetchers/splitChangesFetcher';
|
|
1
|
+
import { syncTaskFactory } from '../../syncTask';
|
|
2
|
+
import { splitChangesFetcherFactory } from '../fetchers/splitChangesFetcher';
|
|
3
3
|
import { splitChangesUpdaterFactory } from '../updaters/splitChangesUpdater';
|
|
4
4
|
/**
|
|
5
5
|
* Creates a sync task that periodically executes a `splitChangesUpdater` task
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export function splitsSyncTaskFactory(fetchSplitChanges, storage, readiness, settings) {
|
|
8
8
|
return syncTaskFactory(settings.log, splitChangesUpdaterFactory(settings.log, splitChangesFetcherFactory(fetchSplitChanges), storage.splits, storage.segments, readiness.splits, settings.startup.requestTimeoutBeforeReady, settings.startup.retriesOnFailureBeforeReady), settings.scheduler.featuresRefreshRate, 'splitChangesUpdater');
|
|
9
9
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { findIndex } from '../../../utils/lang';
|
|
2
2
|
import { SDK_SEGMENTS_ARRIVED } from '../../../readiness/constants';
|
|
3
3
|
import { LOG_PREFIX_INSTANTIATION, LOG_PREFIX_SYNC_SEGMENTS } from '../../../logger/constants';
|
|
4
|
-
import thenable from '../../../utils/promise/thenable';
|
|
4
|
+
import { thenable } from '../../../utils/promise/thenable';
|
|
5
5
|
/**
|
|
6
6
|
* Factory of SegmentChanges updater, a task that:
|
|
7
7
|
* - fetches segment changes using `segmentChangesFetcher`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _Set, setToArray } from '../../../utils/lang/sets';
|
|
2
|
-
import timeout from '../../../utils/promise/timeout';
|
|
2
|
+
import { timeout } from '../../../utils/promise/timeout';
|
|
3
3
|
import { SDK_SPLITS_ARRIVED, SDK_SPLITS_CACHE_LOADED } from '../../../readiness/constants';
|
|
4
4
|
import { SYNC_SPLITS_FETCH, SYNC_SPLITS_NEW, SYNC_SPLITS_REMOVED, SYNC_SPLITS_SEGMENTS, SYNC_SPLITS_FETCH_FAILS, SYNC_SPLITS_FETCH_RETRY } from '../../../logger/constants';
|
|
5
5
|
// Checks that all registered segments have been fetched (changeNumber !== -1 for every segment).
|
|
@@ -133,10 +133,13 @@ export function splitChangesUpdaterFactory(log, splitChangesFetcher, splits, seg
|
|
|
133
133
|
}
|
|
134
134
|
return false;
|
|
135
135
|
});
|
|
136
|
-
// After triggering the requests, if we have cached splits information let's notify that.
|
|
136
|
+
// After triggering the requests, if we have cached splits information let's notify that to emit SDK_READY_FROM_CACHE.
|
|
137
|
+
// Wrapping in a promise since checkCache can be async.
|
|
137
138
|
if (splitsEventEmitter && startingUp) {
|
|
138
|
-
Promise.resolve(splits.checkCache()).then(function (
|
|
139
|
-
|
|
139
|
+
Promise.resolve(splits.checkCache()).then(function (isCacheReady) {
|
|
140
|
+
if (isCacheReady)
|
|
141
|
+
splitsEventEmitter.emit(SDK_SPLITS_CACHE_LOADED);
|
|
142
|
+
});
|
|
140
143
|
}
|
|
141
144
|
return fetcherPromise;
|
|
142
145
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import objectAssign from '
|
|
1
|
+
import { objectAssign } from '../../../utils/lang/objectAssign';
|
|
2
2
|
import { encodeToBase64 } from '../../../utils/base64';
|
|
3
3
|
import { decodeJWTtoken } from '../../../utils/jwt';
|
|
4
4
|
import { hash } from '../../../utils/murmur3/murmur3';
|
|
@@ -6,7 +6,7 @@ var CONTROL_CHANNEL_REGEXS = [/control_pri$/, /control_sec$/];
|
|
|
6
6
|
* @param pushEmitter emitter for events related to streaming support
|
|
7
7
|
*/
|
|
8
8
|
// @TODO update logic to handle OCCUPANCY for any region and rename according to new spec (e.g.: PUSH_SUBSYSTEM_UP --> PUSH_SUBSYSTEM_UP)
|
|
9
|
-
export
|
|
9
|
+
export function notificationKeeperFactory(pushEmitter) {
|
|
10
10
|
var channels = CONTROL_CHANNEL_REGEXS.map(function (regex) { return ({
|
|
11
11
|
regex: regex,
|
|
12
12
|
hasPublishers: true,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { errorParser, messageParser } from './NotificationParser';
|
|
2
|
-
import notificationKeeperFactory from './NotificationKeeper';
|
|
2
|
+
import { notificationKeeperFactory } from './NotificationKeeper';
|
|
3
3
|
import { PUSH_RETRYABLE_ERROR, PUSH_NONRETRYABLE_ERROR, OCCUPANCY, CONTROL, MY_SEGMENTS_UPDATE, MY_SEGMENTS_UPDATE_V2, SEGMENT_UPDATE, SPLIT_KILL, SPLIT_UPDATE } from '../constants';
|
|
4
4
|
import { STREAMING_PARSING_ERROR_FAILS, ERROR_STREAMING_SSE, STREAMING_PARSING_MESSAGE_FAILS, STREAMING_NEW_MESSAGE } from '../../../logger/constants';
|
|
5
5
|
function isRetryableError(error) {
|
|
@@ -21,7 +21,7 @@ function isRetryableError(error) {
|
|
|
21
21
|
* @param log factory logger
|
|
22
22
|
* @param pushEmitter emitter for events related to streaming support
|
|
23
23
|
*/
|
|
24
|
-
export
|
|
24
|
+
export function SSEHandlerFactory(log, pushEmitter) {
|
|
25
25
|
var notificationKeeper = notificationKeeperFactory(pushEmitter);
|
|
26
26
|
return {
|
|
27
27
|
handleOpen: function () {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Backoff from '../../../utils/Backoff';
|
|
1
|
+
import { Backoff } from '../../../utils/Backoff';
|
|
2
2
|
/**
|
|
3
3
|
* MySegmentsUpdateWorker class
|
|
4
4
|
*/
|
|
@@ -55,4 +55,4 @@ var MySegmentsUpdateWorker = /** @class */ (function () {
|
|
|
55
55
|
};
|
|
56
56
|
return MySegmentsUpdateWorker;
|
|
57
57
|
}());
|
|
58
|
-
export
|
|
58
|
+
export { MySegmentsUpdateWorker };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Backoff from '../../../utils/Backoff';
|
|
1
|
+
import { Backoff } from '../../../utils/Backoff';
|
|
2
2
|
/**
|
|
3
3
|
* SegmentUpdateWorker class
|
|
4
4
|
*/
|
|
@@ -68,4 +68,4 @@ var SegmentsUpdateWorker = /** @class */ (function () {
|
|
|
68
68
|
};
|
|
69
69
|
return SegmentsUpdateWorker;
|
|
70
70
|
}());
|
|
71
|
-
export
|
|
71
|
+
export { SegmentsUpdateWorker };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SDK_SPLITS_ARRIVED } from '../../../readiness/constants';
|
|
2
|
-
import Backoff from '../../../utils/Backoff';
|
|
2
|
+
import { Backoff } from '../../../utils/Backoff';
|
|
3
3
|
/**
|
|
4
4
|
* SplitsUpdateWorker class
|
|
5
5
|
*/
|
|
@@ -76,4 +76,4 @@ var SplitsUpdateWorker = /** @class */ (function () {
|
|
|
76
76
|
};
|
|
77
77
|
return SplitsUpdateWorker;
|
|
78
78
|
}());
|
|
79
|
-
export
|
|
79
|
+
export { SplitsUpdateWorker };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import objectAssign from '
|
|
2
|
-
import Backoff from '../../utils/Backoff';
|
|
3
|
-
import SSEHandlerFactory from './SSEHandler';
|
|
4
|
-
import MySegmentsUpdateWorker from './UpdateWorkers/MySegmentsUpdateWorker';
|
|
5
|
-
import SegmentsUpdateWorker from './UpdateWorkers/SegmentsUpdateWorker';
|
|
6
|
-
import SplitsUpdateWorker from './UpdateWorkers/SplitsUpdateWorker';
|
|
1
|
+
import { objectAssign } from '../../utils/lang/objectAssign';
|
|
2
|
+
import { Backoff } from '../../utils/Backoff';
|
|
3
|
+
import { SSEHandlerFactory } from './SSEHandler';
|
|
4
|
+
import { MySegmentsUpdateWorker } from './UpdateWorkers/MySegmentsUpdateWorker';
|
|
5
|
+
import { SegmentsUpdateWorker } from './UpdateWorkers/SegmentsUpdateWorker';
|
|
6
|
+
import { SplitsUpdateWorker } from './UpdateWorkers/SplitsUpdateWorker';
|
|
7
7
|
import { authenticateFactory, hashUserKey } from './AuthClient';
|
|
8
8
|
import { forOwn } from '../../utils/lang';
|
|
9
|
-
import SSEClient from './SSEClient';
|
|
9
|
+
import { SSEClient } from './SSEClient';
|
|
10
10
|
import { getMatching } from '../../utils/key';
|
|
11
11
|
import { MY_SEGMENTS_UPDATE, MY_SEGMENTS_UPDATE_V2, PUSH_NONRETRYABLE_ERROR, PUSH_SUBSYSTEM_DOWN, SECONDS_BEFORE_EXPIRATION, SEGMENT_UPDATE, SPLIT_KILL, SPLIT_UPDATE, PUSH_RETRYABLE_ERROR, PUSH_SUBSYSTEM_UP, ControlType } from './constants';
|
|
12
12
|
import { STREAMING_FALLBACK, STREAMING_REFRESH_TOKEN, STREAMING_CONNECTING, STREAMING_DISABLED, ERROR_STREAMING_AUTH, STREAMING_DISCONNECTING, STREAMING_RECONNECT, STREAMING_PARSING_MY_SEGMENTS_UPDATE_V2 } from '../../logger/constants';
|
|
@@ -19,7 +19,7 @@ import { hash64 } from '../../utils/murmur3/murmur3_64';
|
|
|
19
19
|
* - for server-side if key is not provided in settings.
|
|
20
20
|
* - for client-side, with support for multiple clients, if key is provided in settings
|
|
21
21
|
*/
|
|
22
|
-
export
|
|
22
|
+
export function pushManagerFactory(pollingManager, storage, readiness, fetchAuth, platform, settings) {
|
|
23
23
|
// `userKey` is the matching key of main client in client-side SDK.
|
|
24
24
|
// It can be used to check if running on client-side or server-side SDK.
|
|
25
25
|
var userKey = settings.core.key ? getMatching(settings.core.key) : undefined; //
|
|
@@ -87,7 +87,8 @@ export default function pushManagerFactory(pollingManager, storage, readiness, f
|
|
|
87
87
|
// Guard condition in case `stop/disconnectPush` has been called (e.g., calling SDK destroy, or app signal close/background)
|
|
88
88
|
if (disconnected)
|
|
89
89
|
return;
|
|
90
|
-
|
|
90
|
+
// @TODO distinguish log for 'Connecting' (1st time) and 'Re-connecting'
|
|
91
|
+
log.info(STREAMING_CONNECTING);
|
|
91
92
|
disconnected = false;
|
|
92
93
|
var userKeys = userKey ? Object.keys(clients) : undefined;
|
|
93
94
|
authenticate(userKeys).then(function (authData) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import syncTaskFactory from '../syncTask';
|
|
1
|
+
import { syncTaskFactory } from '../syncTask';
|
|
2
2
|
import { SUBMITTERS_PUSH, SUBMITTERS_PUSH_FAILS, SUBMITTERS_PUSH_RETRY } from '../../logger/constants';
|
|
3
3
|
/**
|
|
4
4
|
* Base function to create submitter sync tasks, such as ImpressionsSyncTask and EventsSyncTask
|
package/esm/sync/syncTask.js
CHANGED
|
@@ -10,7 +10,7 @@ import { SYNC_TASK_EXECUTE, SYNC_TASK_START, SYNC_TASK_STOP } from '../logger/co
|
|
|
10
10
|
* @param taskName Optional task name for logging.
|
|
11
11
|
* @returns A sync task that wraps the given task.
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export function syncTaskFactory(log, task, period, taskName) {
|
|
14
14
|
if (taskName === void 0) { taskName = 'task'; }
|
|
15
15
|
// Flag that indicates if the task is being executed
|
|
16
16
|
var executing = false;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import objectAssign from '
|
|
2
|
-
import thenable from '../utils/promise/thenable';
|
|
1
|
+
import { objectAssign } from '../utils/lang/objectAssign';
|
|
2
|
+
import { thenable } from '../utils/promise/thenable';
|
|
3
3
|
import { EVENTS_TRACKER_SUCCESS, ERROR_EVENTS_TRACKER } from '../logger/constants';
|
|
4
4
|
/**
|
|
5
5
|
* Event tracker stores events in cache and pass them to the integrations manager if provided.
|
|
@@ -7,7 +7,7 @@ import { EVENTS_TRACKER_SUCCESS, ERROR_EVENTS_TRACKER } from '../logger/constant
|
|
|
7
7
|
* @param eventsCache cache to save events
|
|
8
8
|
* @param integrationsManager optional event handler used for integrations
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export function eventTrackerFactory(log, eventsCache, integrationsManager) {
|
|
11
11
|
function queueEventsCallback(eventData, tracked) {
|
|
12
12
|
var eventTypeId = eventData.eventTypeId, trafficTypeName = eventData.trafficTypeName, key = eventData.key, value = eventData.value, timestamp = eventData.timestamp, properties = eventData.properties;
|
|
13
13
|
// Logging every prop would be too much.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import LRUCache from '../../utils/LRUCache';
|
|
1
|
+
import { LRUCache } from '../../utils/LRUCache';
|
|
2
2
|
var ImpressionObserver = /** @class */ (function () {
|
|
3
3
|
function ImpressionObserver(size, hasher) {
|
|
4
4
|
this.cache = new LRUCache(size);
|
|
@@ -12,4 +12,4 @@ var ImpressionObserver = /** @class */ (function () {
|
|
|
12
12
|
};
|
|
13
13
|
return ImpressionObserver;
|
|
14
14
|
}());
|
|
15
|
-
export
|
|
15
|
+
export { ImpressionObserver };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import objectAssign from '
|
|
2
|
-
import thenable from '../utils/promise/thenable';
|
|
1
|
+
import { objectAssign } from '../utils/lang/objectAssign';
|
|
2
|
+
import { thenable } from '../utils/promise/thenable';
|
|
3
3
|
import { truncateTimeFrame } from '../utils/time';
|
|
4
4
|
import { IMPRESSIONS_TRACKER_SUCCESS, ERROR_IMPRESSIONS_TRACKER, ERROR_IMPRESSIONS_LISTENER } from '../logger/constants';
|
|
5
5
|
/**
|
|
@@ -12,7 +12,7 @@ import { IMPRESSIONS_TRACKER_SUCCESS, ERROR_IMPRESSIONS_TRACKER, ERROR_IMPRESSIO
|
|
|
12
12
|
* @param observer optional impression observer. If provided, previous time (pt property) is included in impression instances
|
|
13
13
|
* @param countsCache optional cache to save impressions count. If provided, impressions will be deduped (OPTIMIZED mode)
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export function impressionsTrackerFactory(log, impressionsCache,
|
|
16
16
|
// @TODO consider passing only an optional integrationsManager to handle impressions
|
|
17
17
|
_a, impressionListener, integrationsManager,
|
|
18
18
|
// if observer is provided, it implies `shouldAddPreviousTime` flag (i.e., if impressions previous time should be added or not)
|
package/esm/utils/Backoff.js
CHANGED
package/esm/utils/MinEvents.js
CHANGED
|
@@ -35,12 +35,9 @@ var ReflectApply = R && typeof R.apply === 'function'
|
|
|
35
35
|
: function ReflectApply(target, receiver, args) {
|
|
36
36
|
return Function.prototype.apply.call(target, receiver, args);
|
|
37
37
|
};
|
|
38
|
-
function EventEmitter() {
|
|
38
|
+
export var EventEmitter = function EventEmitter() {
|
|
39
39
|
EventEmitter.init.call(this);
|
|
40
|
-
}
|
|
41
|
-
export default EventEmitter;
|
|
42
|
-
// Backwards-compat with node 0.10.x
|
|
43
|
-
EventEmitter.EventEmitter = EventEmitter;
|
|
40
|
+
};
|
|
44
41
|
EventEmitter.prototype._events = undefined;
|
|
45
42
|
EventEmitter.prototype._eventsCount = 0;
|
|
46
43
|
function checkListener(listener) {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @returns integer number between 0 and `items.length`. This value is the index of the search value,
|
|
7
7
|
* if it is contained in the array, or the index at which the value should be inserted to keep the array ordered.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export function binarySearch(items, value) {
|
|
10
10
|
var startIndex = 0;
|
|
11
11
|
var stopIndex = items.length - 1;
|
|
12
12
|
var middle = Math.floor((stopIndex + startIndex) / 2);
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Adaptation of "object-assign" library (https://www.npmjs.com/package/object-assign)
|
|
3
|
+
exported as an ES module instead of CommonJS, to avoid extra configuration steps when using
|
|
4
|
+
the ESM build of the SDK with tools that doesn't support CommonJS by default (e.g. Rollup).
|
|
5
|
+
|
|
6
|
+
object-assign
|
|
7
|
+
(c) Sindre Sorhus
|
|
8
|
+
@license MIT
|
|
9
|
+
*/
|
|
10
|
+
/* eslint-disable */
|
|
11
|
+
// @ts-nocheck
|
|
12
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
13
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
14
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
15
|
+
function toObject(val) {
|
|
16
|
+
if (val === null || val === undefined) {
|
|
17
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
18
|
+
}
|
|
19
|
+
return Object(val);
|
|
20
|
+
}
|
|
21
|
+
function shouldUseNative() {
|
|
22
|
+
try {
|
|
23
|
+
if (!Object.assign) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
// Detect buggy property enumeration order in older V8 versions.
|
|
27
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
28
|
+
var test1 = new String('abc');
|
|
29
|
+
test1[5] = 'de';
|
|
30
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
34
|
+
var test2 = {};
|
|
35
|
+
for (var i = 0; i < 10; i++) {
|
|
36
|
+
test2['_' + String.fromCharCode(i)] = i;
|
|
37
|
+
}
|
|
38
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
39
|
+
return test2[n];
|
|
40
|
+
});
|
|
41
|
+
if (order2.join('') !== '0123456789') {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
45
|
+
var test3 = {};
|
|
46
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
47
|
+
test3[letter] = letter;
|
|
48
|
+
});
|
|
49
|
+
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
50
|
+
'abcdefghijklmnopqrst') {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
// We don't expect any of the above to throw, but better to be safe.
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
61
|
+
var from;
|
|
62
|
+
var to = toObject(target);
|
|
63
|
+
var symbols;
|
|
64
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
65
|
+
from = Object(arguments[s]);
|
|
66
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
67
|
+
for (var key in from) {
|
|
68
|
+
if (hasOwnProperty.call(from, key)) {
|
|
69
|
+
to[key] = from[key];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (getOwnPropertySymbols) {
|
|
73
|
+
symbols = getOwnPropertySymbols(from);
|
|
74
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
75
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
76
|
+
to[symbols[i]] = from[symbols[i]];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return to;
|
|
82
|
+
};
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* @returns a promise that doesn't need to be handled for rejection (except when using async/await syntax) and
|
|
17
17
|
* includes a method named `hasOnFulfilled` that returns true if the promise has attached an onFulfilled handler.
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
19
|
+
export function promiseWrapper(customPromise, defaultOnRejected) {
|
|
20
20
|
var hasOnFulfilled = false;
|
|
21
21
|
var hasOnRejected = false;
|
|
22
22
|
function chain(promise) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ERROR_INVALID_IMPRESSIONS_MODE } from '../../logger/constants';
|
|
2
2
|
import { DEBUG, OPTIMIZED } from '../constants';
|
|
3
|
-
export
|
|
3
|
+
export function validImpressionsMode(log, impressionsMode) {
|
|
4
4
|
impressionsMode = impressionsMode.toUpperCase();
|
|
5
5
|
if ([DEBUG, OPTIMIZED].indexOf(impressionsMode) === -1) {
|
|
6
6
|
log.error(ERROR_INVALID_IMPRESSIONS_MODE, [[DEBUG, OPTIMIZED], OPTIMIZED]);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { merge } from '../lang';
|
|
2
|
-
import mode from './mode';
|
|
2
|
+
import { mode } from './mode';
|
|
3
3
|
import { validateSplitFilters } from './splitFilters';
|
|
4
4
|
import { STANDALONE_MODE, OPTIMIZED, LOCALHOST_MODE } from '../constants';
|
|
5
|
-
import validImpressionsMode from './impressionsMode';
|
|
5
|
+
import { validImpressionsMode } from './impressionsMode';
|
|
6
6
|
var base = {
|
|
7
7
|
// Define which kind of object you want to retrieve from SplitFactory
|
|
8
8
|
mode: STANDALONE_MODE,
|
|
@@ -100,7 +100,7 @@ export function settingsValidation(config, validationParams) {
|
|
|
100
100
|
// Startup periods
|
|
101
101
|
startup.requestTimeoutBeforeReady = fromSecondsToMillis(startup.requestTimeoutBeforeReady);
|
|
102
102
|
startup.readyTimeout = fromSecondsToMillis(startup.readyTimeout);
|
|
103
|
-
startup.eventsFirstPushWindow = fromSecondsToMillis(
|
|
103
|
+
startup.eventsFirstPushWindow = fromSecondsToMillis(startup.eventsFirstPushWindow);
|
|
104
104
|
// ensure a valid SDK mode
|
|
105
105
|
// @ts-ignore, modify readonly prop
|
|
106
106
|
withDefaults.mode = mode(withDefaults.core.authorizationKey, withDefaults.mode);
|