@splitsoftware/splitio-commons 1.0.1-rc.5 → 1.0.1-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/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 +7 -7
- 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/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 +7 -8
- 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 +2 -3
- 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 +16 -16
- 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/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 +4 -5
- 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 +2 -2
- 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/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 +4 -4
- 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 +1 -1
- 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 +8 -8
- 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/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 +2 -2
- 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 +2 -2
- 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/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 +4 -4
- package/src/sdkManager/index.ts +2 -2
- package/src/services/splitApi.ts +1 -1
- package/src/services/splitHttpClient.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 +1 -1
- 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 +8 -8
- 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/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 +2 -2
- 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/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/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,7 +1,7 @@
|
|
|
1
1
|
import { IMySegmentsFetcher } from '../fetchers/types';
|
|
2
2
|
import { ISegmentsCacheSync, ISplitsCacheSync } from '../../../storages/types';
|
|
3
3
|
import { ISegmentsEventEmitter } from '../../../readiness/types';
|
|
4
|
-
import timeout from '../../../utils/promise/timeout';
|
|
4
|
+
import { timeout } from '../../../utils/promise/timeout';
|
|
5
5
|
import { SDK_SEGMENTS_ARRIVED } from '../../../readiness/constants';
|
|
6
6
|
import { ILogger } from '../../../logger/types';
|
|
7
7
|
import { SYNC_MYSEGMENTS_FETCH_RETRY } from '../../../logger/constants';
|
|
@@ -6,7 +6,7 @@ import { findIndex } from '../../../utils/lang';
|
|
|
6
6
|
import { SDK_SEGMENTS_ARRIVED } from '../../../readiness/constants';
|
|
7
7
|
import { ILogger } from '../../../logger/types';
|
|
8
8
|
import { LOG_PREFIX_INSTANTIATION, LOG_PREFIX_SYNC_SEGMENTS } from '../../../logger/constants';
|
|
9
|
-
import thenable from '../../../utils/promise/thenable';
|
|
9
|
+
import { thenable } from '../../../utils/promise/thenable';
|
|
10
10
|
|
|
11
11
|
type ISegmentChangesUpdater = (segmentNames?: string[], noCache?: boolean, fetchOnlyNew?: boolean) => Promise<boolean>
|
|
12
12
|
|
|
@@ -3,7 +3,7 @@ import { ISegmentsCacheBase, ISplitsCacheBase } from '../../../storages/types';
|
|
|
3
3
|
import { ISplitChangesFetcher } from '../fetchers/types';
|
|
4
4
|
import { ISplit, ISplitChangesResponse } from '../../../dtos/types';
|
|
5
5
|
import { ISplitsEventEmitter } from '../../../readiness/types';
|
|
6
|
-
import timeout from '../../../utils/promise/timeout';
|
|
6
|
+
import { timeout } from '../../../utils/promise/timeout';
|
|
7
7
|
import { SDK_SPLITS_ARRIVED, SDK_SPLITS_CACHE_LOADED } from '../../../readiness/constants';
|
|
8
8
|
import { ILogger } from '../../../logger/types';
|
|
9
9
|
import { SYNC_SPLITS_FETCH, SYNC_SPLITS_NEW, SYNC_SPLITS_REMOVED, SYNC_SPLITS_SEGMENTS, SYNC_SPLITS_FETCH_FAILS, SYNC_SPLITS_FETCH_RETRY } from '../../../logger/constants';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IFetchAuth } from '../../../services/types';
|
|
2
2
|
import { IAuthenticate, IAuthToken } from './types';
|
|
3
|
-
import objectAssign from '
|
|
3
|
+
import { objectAssign } from '../../../utils/lang/objectAssign';
|
|
4
4
|
import { encodeToBase64 } from '../../../utils/base64';
|
|
5
5
|
import { decodeJWTtoken } from '../../../utils/jwt';
|
|
6
6
|
import { hash } from '../../../utils/murmur3/murmur3';
|
|
@@ -30,7 +30,7 @@ function buildSSEHeaders(settings: ISettings) {
|
|
|
30
30
|
/**
|
|
31
31
|
* Handles streaming connections with EventSource API
|
|
32
32
|
*/
|
|
33
|
-
export
|
|
33
|
+
export class SSEClient implements ISSEClient {
|
|
34
34
|
// Instance properties:
|
|
35
35
|
eventSource?: IEventSourceConstructor;
|
|
36
36
|
streamingUrl: string;
|
|
@@ -9,7 +9,7 @@ const CONTROL_CHANNEL_REGEXS = [/control_pri$/, /control_sec$/];
|
|
|
9
9
|
* @param pushEmitter emitter for events related to streaming support
|
|
10
10
|
*/
|
|
11
11
|
// @TODO update logic to handle OCCUPANCY for any region and rename according to new spec (e.g.: PUSH_SUBSYSTEM_UP --> PUSH_SUBSYSTEM_UP)
|
|
12
|
-
export
|
|
12
|
+
export function notificationKeeperFactory(pushEmitter: IPushEventEmitter) {
|
|
13
13
|
|
|
14
14
|
let channels = CONTROL_CHANNEL_REGEXS.map(regex => ({
|
|
15
15
|
regex,
|
|
@@ -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 { IPushEventEmitter } from '../types';
|
|
5
5
|
import { ISseEventHandler } from '../SSEClient/types';
|
|
@@ -25,7 +25,7 @@ function isRetryableError(error: INotificationError) {
|
|
|
25
25
|
* @param log factory logger
|
|
26
26
|
* @param pushEmitter emitter for events related to streaming support
|
|
27
27
|
*/
|
|
28
|
-
export
|
|
28
|
+
export function SSEHandlerFactory(log: ILogger, pushEmitter: IPushEventEmitter): ISseEventHandler {
|
|
29
29
|
|
|
30
30
|
const notificationKeeper = notificationKeeperFactory(pushEmitter);
|
|
31
31
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ISegmentsSyncTask } from '../../polling/types';
|
|
2
|
-
import Backoff from '../../../utils/Backoff';
|
|
2
|
+
import { Backoff } from '../../../utils/Backoff';
|
|
3
3
|
import { IUpdateWorker } from './types';
|
|
4
4
|
import { SegmentsData } from '../SSEHandler/types';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* MySegmentsUpdateWorker class
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export class MySegmentsUpdateWorker implements IUpdateWorker {
|
|
10
10
|
|
|
11
11
|
private readonly mySegmentsSyncTask: ISegmentsSyncTask;
|
|
12
12
|
private maxChangeNumber: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ISegmentsCacheSync } from '../../../storages/types';
|
|
2
|
-
import Backoff from '../../../utils/Backoff';
|
|
2
|
+
import { Backoff } from '../../../utils/Backoff';
|
|
3
3
|
import { ISegmentsSyncTask } from '../../polling/types';
|
|
4
4
|
import { ISegmentUpdateData } from '../SSEHandler/types';
|
|
5
5
|
import { IUpdateWorker } from './types';
|
|
@@ -7,7 +7,7 @@ import { IUpdateWorker } from './types';
|
|
|
7
7
|
/**
|
|
8
8
|
* SegmentUpdateWorker class
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export class SegmentsUpdateWorker implements IUpdateWorker {
|
|
11
11
|
|
|
12
12
|
private readonly segmentsCache: ISegmentsCacheSync;
|
|
13
13
|
private readonly segmentsSyncTask: ISegmentsSyncTask;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SDK_SPLITS_ARRIVED } from '../../../readiness/constants';
|
|
2
2
|
import { ISplitsEventEmitter } from '../../../readiness/types';
|
|
3
3
|
import { ISplitsCacheSync } from '../../../storages/types';
|
|
4
|
-
import Backoff from '../../../utils/Backoff';
|
|
4
|
+
import { Backoff } from '../../../utils/Backoff';
|
|
5
5
|
import { ISegmentsSyncTask, ISplitsSyncTask } from '../../polling/types';
|
|
6
6
|
import { ISplitKillData, ISplitUpdateData } from '../SSEHandler/types';
|
|
7
7
|
import { IUpdateWorker } from './types';
|
|
@@ -9,7 +9,7 @@ import { IUpdateWorker } from './types';
|
|
|
9
9
|
/**
|
|
10
10
|
* SplitsUpdateWorker class
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export class SplitsUpdateWorker implements IUpdateWorker {
|
|
13
13
|
|
|
14
14
|
private readonly splitsCache: ISplitsCacheSync;
|
|
15
15
|
private readonly splitsSyncTask: ISplitsSyncTask;
|
|
@@ -3,15 +3,15 @@ import { ISSEClient } from './SSEClient/types';
|
|
|
3
3
|
import { IStorageSync } from '../../storages/types';
|
|
4
4
|
import { IReadinessManager } from '../../readiness/types';
|
|
5
5
|
import { ISegmentsSyncTask, IPollingManager } from '../polling/types';
|
|
6
|
-
import objectAssign from '
|
|
7
|
-
import Backoff from '../../utils/Backoff';
|
|
8
|
-
import SSEHandlerFactory from './SSEHandler';
|
|
9
|
-
import MySegmentsUpdateWorker from './UpdateWorkers/MySegmentsUpdateWorker';
|
|
10
|
-
import SegmentsUpdateWorker from './UpdateWorkers/SegmentsUpdateWorker';
|
|
11
|
-
import SplitsUpdateWorker from './UpdateWorkers/SplitsUpdateWorker';
|
|
6
|
+
import { objectAssign } from '../../utils/lang/objectAssign';
|
|
7
|
+
import { Backoff } from '../../utils/Backoff';
|
|
8
|
+
import { SSEHandlerFactory } from './SSEHandler';
|
|
9
|
+
import { MySegmentsUpdateWorker } from './UpdateWorkers/MySegmentsUpdateWorker';
|
|
10
|
+
import { SegmentsUpdateWorker } from './UpdateWorkers/SegmentsUpdateWorker';
|
|
11
|
+
import { SplitsUpdateWorker } from './UpdateWorkers/SplitsUpdateWorker';
|
|
12
12
|
import { authenticateFactory, hashUserKey } from './AuthClient';
|
|
13
13
|
import { forOwn } from '../../utils/lang';
|
|
14
|
-
import SSEClient from './SSEClient';
|
|
14
|
+
import { SSEClient } from './SSEClient';
|
|
15
15
|
import { IFetchAuth } from '../../services/types';
|
|
16
16
|
import { ISettings } from '../../types';
|
|
17
17
|
import { getMatching } from '../../utils/key';
|
|
@@ -29,7 +29,7 @@ import { IAuthTokenPushEnabled } from './AuthClient/types';
|
|
|
29
29
|
* - for server-side if key is not provided in settings.
|
|
30
30
|
* - for client-side, with support for multiple clients, if key is provided in settings
|
|
31
31
|
*/
|
|
32
|
-
export
|
|
32
|
+
export function pushManagerFactory(
|
|
33
33
|
pollingManager: IPollingManager,
|
|
34
34
|
storage: IStorageSync,
|
|
35
35
|
readiness: IReadinessManager,
|
package/src/sync/syncTask.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { ISyncTask } from './types';
|
|
|
13
13
|
* @param taskName Optional task name for logging.
|
|
14
14
|
* @returns A sync task that wraps the given task.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export function syncTaskFactory<Input extends any[], Output = any>(log: ILogger, task: (...args: Input) => Promise<Output>, period: number, taskName = 'task'): ISyncTask<Input, Output> {
|
|
17
17
|
|
|
18
18
|
// Flag that indicates if the task is being executed
|
|
19
19
|
let 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 { IEventsCacheBase } from '../storages/types';
|
|
4
4
|
import { IEventsHandler, IEventTracker } from './types';
|
|
5
5
|
import { SplitIO } from '../types';
|
|
@@ -12,7 +12,7 @@ import { EVENTS_TRACKER_SUCCESS, ERROR_EVENTS_TRACKER } from '../logger/constant
|
|
|
12
12
|
* @param eventsCache cache to save events
|
|
13
13
|
* @param integrationsManager optional event handler used for integrations
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export function eventTrackerFactory(
|
|
16
16
|
log: ILogger,
|
|
17
17
|
eventsCache: IEventsCacheBase,
|
|
18
18
|
integrationsManager?: IEventsHandler
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ImpressionDTO } from '../../types';
|
|
2
|
-
import LRUCache from '../../utils/LRUCache';
|
|
2
|
+
import { LRUCache } from '../../utils/LRUCache';
|
|
3
3
|
import { IImpressionObserver } from './types';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export class ImpressionObserver<K extends string | number = string> implements IImpressionObserver {
|
|
6
6
|
private cache: LRUCache<K, number>;
|
|
7
7
|
private hasher: (impression: ImpressionDTO) => K;
|
|
8
8
|
|
|
@@ -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 { IImpressionCountsCacheSync, IImpressionsCacheBase } from '../storages/types';
|
|
5
5
|
import { IImpressionsHandler, IImpressionsTracker } from './types';
|
|
@@ -18,7 +18,7 @@ import { IMPRESSIONS_TRACKER_SUCCESS, ERROR_IMPRESSIONS_TRACKER, ERROR_IMPRESSIO
|
|
|
18
18
|
* @param observer optional impression observer. If provided, previous time (pt property) is included in impression instances
|
|
19
19
|
* @param countsCache optional cache to save impressions count. If provided, impressions will be deduped (OPTIMIZED mode)
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export function impressionsTrackerFactory(
|
|
22
22
|
log: ILogger,
|
|
23
23
|
impressionsCache: IImpressionsCacheBase,
|
|
24
24
|
|
package/src/utils/Backoff.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IMap, _Map } from '../lang/maps';
|
|
2
2
|
import { LinkedList, Node } from './LinkedList';
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export class LRUCache<K, V> {
|
|
5
5
|
maxLen: number;
|
|
6
6
|
items: IMap<K, Node<{ key: K, value: V }>>;
|
|
7
7
|
lru: LinkedList<{ key: K, value: V }>;
|
|
@@ -11,7 +11,7 @@ function checkListener(listener: unknown) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
// @TODO implement missing methods, check spec and add UTs
|
|
14
|
-
export
|
|
14
|
+
export class EventEmitter implements IEventEmitter {
|
|
15
15
|
|
|
16
16
|
private listeners: Record<string, Array<[
|
|
17
17
|
(...args: any[]) => void, // the event 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: number[], value: number): number {
|
|
10
10
|
let startIndex = 0;
|
|
11
11
|
let stopIndex = items.length - 1;
|
|
12
12
|
let middle = Math.floor((stopIndex + startIndex) / 2);
|
|
@@ -0,0 +1,104 @@
|
|
|
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
|
+
|
|
11
|
+
/* eslint-disable */
|
|
12
|
+
// @ts-nocheck
|
|
13
|
+
|
|
14
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
15
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
16
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
17
|
+
|
|
18
|
+
function toObject(val) {
|
|
19
|
+
if (val === null || val === undefined) {
|
|
20
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return Object(val);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function shouldUseNative() {
|
|
27
|
+
try {
|
|
28
|
+
if (!Object.assign) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Detect buggy property enumeration order in older V8 versions.
|
|
33
|
+
|
|
34
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
35
|
+
var test1 = new String('abc');
|
|
36
|
+
test1[5] = 'de';
|
|
37
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
42
|
+
var test2 = {};
|
|
43
|
+
for (var i = 0; i < 10; i++) {
|
|
44
|
+
test2['_' + String.fromCharCode(i)] = i;
|
|
45
|
+
}
|
|
46
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
47
|
+
return test2[n];
|
|
48
|
+
});
|
|
49
|
+
if (order2.join('') !== '0123456789') {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
54
|
+
var test3 = {};
|
|
55
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
56
|
+
test3[letter] = letter;
|
|
57
|
+
});
|
|
58
|
+
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
59
|
+
'abcdefghijklmnopqrst') {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return true;
|
|
64
|
+
} catch (err) {
|
|
65
|
+
// We don't expect any of the above to throw, but better to be safe.
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// https://www.npmjs.com/package/@types/object-assign
|
|
71
|
+
type ObjectAssign = (<T, U>(target: T, source: U) => T & U) &
|
|
72
|
+
(<T, U, V>(target: T, source1: U, source2: V) => T & U & V) &
|
|
73
|
+
(<T, U, V, W>(target: T, source1: U, source2: V, source3: W) => T & U & V & W) &
|
|
74
|
+
(<T, U, V, W, Q>(target: T, source1: U, source2: V, source3: W, source4: Q) => T & U & V & W & Q) &
|
|
75
|
+
(<T, U, V, W, Q, R>(target: T, source1: U, source2: V, source3: W, source4: Q, source5: R) => T & U & V & W & Q & R) &
|
|
76
|
+
((target: any, ...sources: any[]) => any);
|
|
77
|
+
|
|
78
|
+
export const objectAssign: ObjectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
79
|
+
var from;
|
|
80
|
+
var to = toObject(target);
|
|
81
|
+
var symbols;
|
|
82
|
+
|
|
83
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
84
|
+
from = Object(arguments[s]);
|
|
85
|
+
|
|
86
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
87
|
+
for (var key in from) {
|
|
88
|
+
if (hasOwnProperty.call(from, key)) {
|
|
89
|
+
to[key] = from[key];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (getOwnPropertySymbols) {
|
|
94
|
+
symbols = getOwnPropertySymbols(from);
|
|
95
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
96
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
97
|
+
to[symbols[i]] = from[symbols[i]];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return to;
|
|
104
|
+
};
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
// returns true if the given value is a thenable object
|
|
2
|
-
export
|
|
2
|
+
export function thenable(o: any): o is Promise<any> {
|
|
3
|
+
return o !== undefined && o !== null && typeof o.then === 'function';
|
|
4
|
+
}
|
|
@@ -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<T>(customPromise: Promise<T>, defaultOnRejected: (_: any) => any): Promise<T> & { hasOnFulfilled: () => boolean } {
|
|
20
20
|
|
|
21
21
|
let hasOnFulfilled = false;
|
|
22
22
|
let hasOnRejected = false;
|
|
@@ -3,7 +3,7 @@ import { ILogger } from '../../logger/types';
|
|
|
3
3
|
import { SplitIO } from '../../types';
|
|
4
4
|
import { DEBUG, OPTIMIZED } from '../constants';
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export function validImpressionsMode(log: ILogger, impressionsMode: string): SplitIO.ImpressionsMode {
|
|
7
7
|
impressionsMode = impressionsMode.toUpperCase();
|
|
8
8
|
if ([DEBUG, OPTIMIZED].indexOf(impressionsMode) === -1) {
|
|
9
9
|
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
|
import { ISettingsValidationParams } from './types';
|
|
7
7
|
import { ISettings } from '../../types';
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LOCALHOST_MODE, STANDALONE_MODE, PRODUCER_MODE, CONSUMER_MODE, CONSUMER_PARTIAL_MODE } from '../constants';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export function mode(key: string, mode: string) {
|
|
4
4
|
// Leaving the comparison as is, in case we change the mode name but not the setting.
|
|
5
5
|
if (key === 'localhost') return LOCALHOST_MODE;
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { uniqueId } from '../lang';
|
|
2
|
-
import timer from './timer';
|
|
3
|
-
import thenable from '../promise/thenable';
|
|
2
|
+
import { timer } from './timer';
|
|
3
|
+
import { thenable } from '../promise/thenable';
|
|
4
4
|
import { ILogger } from '../../logger/types';
|
|
5
5
|
import { IResponse } from '../../services/types';
|
|
6
6
|
|
|
@@ -112,7 +112,8 @@ function getCallbackForTask(task: string, collector: MetricsCollector | false):
|
|
|
112
112
|
return false;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
// Our "time tracker" API
|
|
116
|
+
export const TrackerAPI = {
|
|
116
117
|
/**
|
|
117
118
|
* "Private" method, used to attach count/countException and stop callbacks to a promise.
|
|
118
119
|
*
|
|
@@ -223,6 +224,3 @@ const TrackerAPI = {
|
|
|
223
224
|
*/
|
|
224
225
|
TaskNames: CONSTANTS
|
|
225
226
|
};
|
|
226
|
-
|
|
227
|
-
// Our "time tracker" API
|
|
228
|
-
export default TrackerAPI;
|
|
@@ -3,7 +3,7 @@ import { SplitIO } from '../types';
|
|
|
3
3
|
import { IStorageAsync, IStorageSync } from '../storages/types';
|
|
4
4
|
import { IEvaluationResult, IEvaluator, ISplitEvaluator } from './types';
|
|
5
5
|
import { ILogger } from '../logger/types';
|
|
6
|
-
export
|
|
6
|
+
export declare class Engine {
|
|
7
7
|
private baseInfo;
|
|
8
8
|
private evaluator;
|
|
9
9
|
constructor(baseInfo: ISplit, evaluator: IEvaluator);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ILogger } from '../../logger/types';
|
|
2
2
|
import { MaybeThenable } from '../../dtos/types';
|
|
3
3
|
import { IMatcher } from '../types';
|
|
4
|
-
export
|
|
4
|
+
export declare function andCombinerContext(log: ILogger, matchers: IMatcher[]): (...params: any) => MaybeThenable<boolean>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ILogger } from '../../logger/types';
|
|
2
2
|
import { IEvaluator } from '../types';
|
|
3
|
-
export
|
|
3
|
+
export declare function ifElseIfCombinerContext(log: ILogger, predicates: IEvaluator[]): IEvaluator;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MaybeThenable } from '../../dtos/types';
|
|
2
2
|
import { IEvaluator } from '../types';
|
|
3
3
|
import { ILogger } from '../../logger/types';
|
|
4
|
-
export
|
|
4
|
+
export declare function conditionContext(log: ILogger, matcherEvaluator: (...args: any) => MaybeThenable<boolean>, treatments: {
|
|
5
5
|
getTreatmentFor: (x: number) => string;
|
|
6
6
|
}, label: string, conditionType: 'ROLLOUT' | 'WHITELIST'): IEvaluator;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ILogger } from '../../logger/types';
|
|
2
|
-
export
|
|
2
|
+
export declare function allMatcherContext(log: ILogger): (runtimeAttr: string) => boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IBetweenMatcherData } from '../../dtos/types';
|
|
2
2
|
import { ILogger } from '../../logger/types';
|
|
3
|
-
export
|
|
3
|
+
export declare function betweenMatcherContext(log: ILogger, ruleVO: IBetweenMatcherData): (runtimeAttr: number) => boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ILogger } from '../../logger/types';
|
|
2
|
-
export
|
|
2
|
+
export declare function booleanMatcherContext(log: ILogger, ruleAttr: boolean): (runtimeAttr: boolean) => boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ILogger } from '../../logger/types';
|
|
2
|
-
export
|
|
2
|
+
export declare function containsAllSetMatcherContext(log: ILogger, ruleAttr: string[]): (runtimeAttr: string[]) => boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ILogger } from '../../logger/types';
|
|
2
|
-
export
|
|
2
|
+
export declare function containsAnySetMatcherContext(log: ILogger, ruleAttr: string[]): (runtimeAttr: string[]) => boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ILogger } from '../../logger/types';
|
|
2
|
-
export
|
|
2
|
+
export declare function containsStringMatcherContext(log: ILogger, ruleAttr: string[]): (runtimeAttr: string) => boolean;
|
|
@@ -2,4 +2,4 @@ import { IDependencyMatcherData, MaybeThenable } from '../../dtos/types';
|
|
|
2
2
|
import { IStorageAsync, IStorageSync } from '../../storages/types';
|
|
3
3
|
import { ILogger } from '../../logger/types';
|
|
4
4
|
import { IDependencyMatcherValue, ISplitEvaluator } from '../types';
|
|
5
|
-
export
|
|
5
|
+
export declare function dependencyMatcherContext(log: ILogger, { split, treatments }: IDependencyMatcherData, storage: IStorageSync | IStorageAsync): ({ key, attributes }: IDependencyMatcherValue, splitEvaluator: ISplitEvaluator) => MaybeThenable<boolean>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ILogger } from '../../logger/types';
|
|
2
|
-
export
|
|
2
|
+
export declare function equalToMatcherContext(log: ILogger, ruleAttr: number): (runtimeAttr: number) => boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ILogger } from '../../logger/types';
|
|
2
|
-
export
|
|
2
|
+
export declare function equalToSetMatcherContext(log: ILogger, ruleAttr: string[]): (runtimeAttr: string[]) => boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ILogger } from '../../logger/types';
|
|
2
|
-
export
|
|
2
|
+
export declare function endsWithMatcherContext(log: ILogger, ruleAttr: string[]): (runtimeAttr: string) => boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ILogger } from '../../logger/types';
|
|
2
|
-
export
|
|
2
|
+
export declare function greaterThanEqualMatcherContext(log: ILogger, ruleAttr: number): (runtimeAttr: number) => boolean;
|
|
@@ -4,4 +4,4 @@ import { ILogger } from '../../logger/types';
|
|
|
4
4
|
/**
|
|
5
5
|
* Matcher factory.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export declare function matcherFactory(log: ILogger, matcherDto: IMatcherDto, storage?: IStorageSync | IStorageAsync): IMatcher | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ILogger } from '../../logger/types';
|
|
2
|
-
export
|
|
2
|
+
export declare function lessThanEqualMatcherContext(log: ILogger, ruleAttr: number): (runtimeAttr: number) => boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ILogger } from '../../logger/types';
|
|
2
|
-
export
|
|
2
|
+
export declare function partOfSetMatcherContext(log: ILogger, ruleAttr: string[]): (runtimeAttr: string[]) => boolean;
|