@splitsoftware/splitio-commons 1.0.1-rc.2 → 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 +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/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/constants.js +1 -1
- 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 -2
- 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 +7 -6
- package/cjs/utils/MinEvents.js +13 -15
- package/cjs/utils/env/isNode.js +4 -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 +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/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/constants.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 -2
- 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 +6 -6
- package/esm/utils/MinEvents.js +2 -5
- package/esm/utils/env/isNode.js +4 -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 +4 -6
- 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/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/sdkFactory/types.ts +2 -2
- 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 +16 -2
- 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/constants.ts +1 -1
- 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 +6 -6
- 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/types.ts +9 -8
- package/src/utils/Backoff.ts +1 -1
- package/src/utils/LRUCache/index.ts +1 -1
- package/src/utils/MinEventEmitter.ts +11 -11
- package/src/utils/MinEvents.ts +2 -7
- package/src/utils/env/isNode.ts +4 -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/sdkFactory/types.d.ts +2 -2
- package/types/services/types.d.ts +11 -0
- 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/pluggable/constants.d.ts +1 -1
- 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 +5 -4
- 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/types.d.ts +9 -9
- package/types/utils/Backoff.d.ts +1 -1
- package/types/utils/LRUCache/index.d.ts +1 -1
- package/types/utils/MinEventEmitter.d.ts +7 -7
- package/types/utils/MinEvents.d.ts +3 -2
- package/types/utils/env/isNode.d.ts +4 -0
- 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
package/cjs/sdkManager/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sdkManagerFactory = void 0;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var thenable_1 = tslib_1.__importDefault(require("../utils/promise/thenable"));
|
|
4
|
+
var objectAssign_1 = require("../utils/lang/objectAssign");
|
|
5
|
+
var thenable_1 = require("../utils/promise/thenable");
|
|
7
6
|
var lang_1 = require("../utils/lang");
|
|
8
7
|
var inputValidation_1 = require("../utils/inputValidation");
|
|
9
8
|
function collectTreatments(splitObject) {
|
|
@@ -48,7 +47,7 @@ function objectsToViews(jsons) {
|
|
|
48
47
|
function sdkManagerFactory(log, splits, _a) {
|
|
49
48
|
var readinessManager = _a.readinessManager, sdkStatus = _a.sdkStatus;
|
|
50
49
|
var SPLIT_FN_LABEL = 'split';
|
|
51
|
-
return
|
|
50
|
+
return objectAssign_1.objectAssign(
|
|
52
51
|
// Proto-linkage of the readiness Event Emitter
|
|
53
52
|
Object.create(sdkStatus), {
|
|
54
53
|
/**
|
|
@@ -60,7 +59,7 @@ function sdkManagerFactory(log, splits, _a) {
|
|
|
60
59
|
return null;
|
|
61
60
|
}
|
|
62
61
|
var split = splits.getSplit(splitName);
|
|
63
|
-
if (thenable_1.
|
|
62
|
+
if (thenable_1.thenable(split)) {
|
|
64
63
|
return split.catch(function () { return null; }).then(function (result) {
|
|
65
64
|
inputValidation_1.validateSplitExistance(log, readinessManager, splitName, result, SPLIT_FN_LABEL);
|
|
66
65
|
return objectToView(result);
|
|
@@ -77,7 +76,7 @@ function sdkManagerFactory(log, splits, _a) {
|
|
|
77
76
|
return [];
|
|
78
77
|
}
|
|
79
78
|
var currentSplits = splits.getAll();
|
|
80
|
-
return thenable_1.
|
|
79
|
+
return thenable_1.thenable(currentSplits) ?
|
|
81
80
|
currentSplits.catch(function () { return []; }).then(objectsToViews) : // handle possible rejections when using pluggable storage
|
|
82
81
|
objectsToViews(currentSplits);
|
|
83
82
|
},
|
|
@@ -89,7 +88,7 @@ function sdkManagerFactory(log, splits, _a) {
|
|
|
89
88
|
return [];
|
|
90
89
|
}
|
|
91
90
|
var splitNames = splits.getSplitNames();
|
|
92
|
-
return thenable_1.
|
|
91
|
+
return thenable_1.thenable(splitNames) ?
|
|
93
92
|
splitNames.catch(function () { return []; }) : // handle possible rejections when using pluggable storage
|
|
94
93
|
splitNames;
|
|
95
94
|
}
|
package/cjs/services/splitApi.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.splitApiFactory = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
4
|
var splitHttpClient_1 = require("./splitHttpClient");
|
|
6
|
-
var
|
|
5
|
+
var objectAssign_1 = require("../utils/lang/objectAssign");
|
|
7
6
|
var noCacheHeaderOptions = { headers: { 'Cache-Control': 'no-cache' } };
|
|
8
7
|
function userKeyToQueryParam(userKey) {
|
|
9
8
|
return 'users=' + encodeURIComponent(userKey); // no need to check availability of `encodeURIComponent`, since it is a global highly supported.
|
|
@@ -76,7 +75,7 @@ function splitApiFactory(settings, platform) {
|
|
|
76
75
|
return splitHttpClient(url, {
|
|
77
76
|
// Adding extra headers to send impressions in OPTIMIZED or DEBUG modes.
|
|
78
77
|
method: 'POST',
|
|
79
|
-
body: body, headers:
|
|
78
|
+
body: body, headers: objectAssign_1.objectAssign({ SplitSDKImpressionsMode: SplitSDKImpressionsMode }, headers)
|
|
80
79
|
});
|
|
81
80
|
},
|
|
82
81
|
/**
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.splitHttpClientFactory = void 0;
|
|
4
|
-
var
|
|
5
|
-
var object_assign_1 = tslib_1.__importDefault(require("object-assign"));
|
|
4
|
+
var objectAssign_1 = require("../utils/lang/objectAssign");
|
|
6
5
|
var constants_1 = require("../logger/constants");
|
|
7
6
|
var messageNoFetch = 'Global fetch API is not available.';
|
|
8
7
|
/**
|
|
@@ -32,8 +31,8 @@ function splitHttpClientFactory(settings, getFetch, getOptions) {
|
|
|
32
31
|
return function httpClient(url, reqOpts, logErrorsAsInfo) {
|
|
33
32
|
if (reqOpts === void 0) { reqOpts = {}; }
|
|
34
33
|
if (logErrorsAsInfo === void 0) { logErrorsAsInfo = false; }
|
|
35
|
-
var request =
|
|
36
|
-
headers: reqOpts.headers ?
|
|
34
|
+
var request = objectAssign_1.objectAssign({
|
|
35
|
+
headers: reqOpts.headers ? objectAssign_1.objectAssign({}, headers, reqOpts.headers) : headers,
|
|
37
36
|
method: reqOpts.method || 'GET',
|
|
38
37
|
body: reqOpts.body
|
|
39
38
|
}, options);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbstractSegmentsCacheSync = void 0;
|
|
3
4
|
/**
|
|
4
5
|
* This class provides a skeletal implementation of the ISegmentsCacheSync interface
|
|
5
6
|
* to minimize the effort required to implement this interface.
|
|
@@ -34,4 +35,4 @@ var AbstractSegmentsCacheSync = /** @class */ (function () {
|
|
|
34
35
|
AbstractSegmentsCacheSync.prototype.resetSegments = function (names) { return true; };
|
|
35
36
|
return AbstractSegmentsCacheSync;
|
|
36
37
|
}());
|
|
37
|
-
exports.
|
|
38
|
+
exports.AbstractSegmentsCacheSync = AbstractSegmentsCacheSync;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbstractSplitsCacheAsync = void 0;
|
|
3
4
|
/**
|
|
4
5
|
* This class provides a skeletal implementation of the ISplitsCacheAsync interface
|
|
5
6
|
* to minimize the effort required to implement this interface.
|
|
@@ -48,4 +49,4 @@ var AbstractSplitsCacheAsync = /** @class */ (function () {
|
|
|
48
49
|
};
|
|
49
50
|
return AbstractSplitsCacheAsync;
|
|
50
51
|
}());
|
|
51
|
-
exports.
|
|
52
|
+
exports.AbstractSplitsCacheAsync = AbstractSplitsCacheAsync;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.usesSegments = void 0;
|
|
3
|
+
exports.usesSegments = exports.AbstractSplitsCacheSync = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* This class provides a skeletal implementation of the ISplitsCacheSync interface
|
|
6
6
|
* to minimize the effort required to implement this interface.
|
|
@@ -61,7 +61,7 @@ var AbstractSplitsCacheSync = /** @class */ (function () {
|
|
|
61
61
|
};
|
|
62
62
|
return AbstractSplitsCacheSync;
|
|
63
63
|
}());
|
|
64
|
-
exports.
|
|
64
|
+
exports.AbstractSplitsCacheSync = AbstractSplitsCacheSync;
|
|
65
65
|
/**
|
|
66
66
|
* Given a parsed split, it returns a boolean flagging if its conditions use segments matchers (rules & whitelists).
|
|
67
67
|
* This util is intended to simplify the implementation of `splitsCache::usesSegments` method
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validatePrefix = void 0;
|
|
3
|
+
exports.KeyBuilder = exports.validatePrefix = void 0;
|
|
4
4
|
var lang_1 = require("../utils/lang");
|
|
5
5
|
var everythingAtTheEnd = /[^.]+$/;
|
|
6
6
|
var DEFAULT_PREFIX = 'SPLITIO';
|
|
@@ -61,4 +61,4 @@ var KeyBuilder = /** @class */ (function () {
|
|
|
61
61
|
};
|
|
62
62
|
return KeyBuilder;
|
|
63
63
|
}());
|
|
64
|
-
exports.
|
|
64
|
+
exports.KeyBuilder = KeyBuilder;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KeyBuilderCS = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
5
|
var lang_1 = require("../utils/lang");
|
|
5
|
-
var KeyBuilder_1 =
|
|
6
|
+
var KeyBuilder_1 = require("./KeyBuilder");
|
|
6
7
|
var KeyBuilderCS = /** @class */ (function (_super) {
|
|
7
8
|
tslib_1.__extends(KeyBuilderCS, _super);
|
|
8
9
|
function KeyBuilderCS(prefix, matchingKey) {
|
|
@@ -32,5 +33,5 @@ var KeyBuilderCS = /** @class */ (function (_super) {
|
|
|
32
33
|
return this.prefix + ".splits.filterQuery";
|
|
33
34
|
};
|
|
34
35
|
return KeyBuilderCS;
|
|
35
|
-
}(KeyBuilder_1.
|
|
36
|
-
exports.
|
|
36
|
+
}(KeyBuilder_1.KeyBuilder));
|
|
37
|
+
exports.KeyBuilderCS = KeyBuilderCS;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KeyBuilderSS = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
|
-
var KeyBuilder_1 =
|
|
5
|
+
var KeyBuilder_1 = require("./KeyBuilder");
|
|
5
6
|
// NOT USED
|
|
6
7
|
// const everythingAfterCount = /count\.([^/]+)$/;
|
|
7
8
|
// const latencyMetricNameAndBucket = /latency\.([^/]+)\.bucket\.([0-9]+)$/;
|
|
@@ -45,5 +46,5 @@ var KeyBuilderSS = /** @class */ (function (_super) {
|
|
|
45
46
|
return this.buildSplitKeyPrefix() + "*";
|
|
46
47
|
};
|
|
47
48
|
return KeyBuilderSS;
|
|
48
|
-
}(KeyBuilder_1.
|
|
49
|
-
exports.
|
|
49
|
+
}(KeyBuilder_1.KeyBuilder));
|
|
50
|
+
exports.KeyBuilderSS = KeyBuilderSS;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findLatencyIndex = void 0;
|
|
3
4
|
var lang_1 = require("../utils/lang");
|
|
4
5
|
// @TODO add unit tests
|
|
5
6
|
function findLatencyIndex(latency, min, max, base) {
|
|
@@ -9,4 +10,4 @@ function findLatencyIndex(latency, min, max, base) {
|
|
|
9
10
|
var index = Math.min(max, Math.max(min, Math.floor(Math.log(latency) / Math.log(base))));
|
|
10
11
|
return lang_1.isNaNNumber(index) ? 0 : index; // index is NaN if latency is not a positive number
|
|
11
12
|
}
|
|
12
|
-
exports.
|
|
13
|
+
exports.findLatencyIndex = findLatencyIndex;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MySegmentsCacheInLocal = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
|
-
var AbstractSegmentsCacheSync_1 =
|
|
5
|
+
var AbstractSegmentsCacheSync_1 = require("../AbstractSegmentsCacheSync");
|
|
5
6
|
var constants_1 = require("./constants");
|
|
6
7
|
var MySegmentsCacheInLocal = /** @class */ (function (_super) {
|
|
7
8
|
tslib_1.__extends(MySegmentsCacheInLocal, _super);
|
|
@@ -87,5 +88,5 @@ var MySegmentsCacheInLocal = /** @class */ (function (_super) {
|
|
|
87
88
|
return isDiff;
|
|
88
89
|
};
|
|
89
90
|
return MySegmentsCacheInLocal;
|
|
90
|
-
}(AbstractSegmentsCacheSync_1.
|
|
91
|
-
exports.
|
|
91
|
+
}(AbstractSegmentsCacheSync_1.AbstractSegmentsCacheSync));
|
|
92
|
+
exports.MySegmentsCacheInLocal = MySegmentsCacheInLocal;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SplitsCacheInLocal = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
|
-
var AbstractSplitsCacheSync_1 =
|
|
5
|
+
var AbstractSplitsCacheSync_1 = require("../AbstractSplitsCacheSync");
|
|
5
6
|
var lang_1 = require("../../utils/lang");
|
|
6
7
|
var constants_1 = require("./constants");
|
|
7
8
|
/**
|
|
@@ -249,5 +250,5 @@ var SplitsCacheInLocal = /** @class */ (function (_super) {
|
|
|
249
250
|
// if the filter didn't change, nothing is done
|
|
250
251
|
};
|
|
251
252
|
return SplitsCacheInLocal;
|
|
252
|
-
}(AbstractSplitsCacheSync_1.
|
|
253
|
-
exports.
|
|
253
|
+
}(AbstractSplitsCacheSync_1.AbstractSplitsCacheSync));
|
|
254
|
+
exports.SplitsCacheInLocal = SplitsCacheInLocal;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InLocalStorage = void 0;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var EventsCacheInMemory_1 = tslib_1.__importDefault(require("../inMemory/EventsCacheInMemory"));
|
|
4
|
+
var ImpressionsCacheInMemory_1 = require("../inMemory/ImpressionsCacheInMemory");
|
|
5
|
+
var ImpressionCountsCacheInMemory_1 = require("../inMemory/ImpressionCountsCacheInMemory");
|
|
6
|
+
var EventsCacheInMemory_1 = require("../inMemory/EventsCacheInMemory");
|
|
8
7
|
var KeyBuilder_1 = require("../KeyBuilder");
|
|
9
|
-
var KeyBuilderCS_1 =
|
|
8
|
+
var KeyBuilderCS_1 = require("../KeyBuilderCS");
|
|
10
9
|
var isLocalStorageAvailable_1 = require("../../utils/env/isLocalStorageAvailable");
|
|
11
|
-
var SplitsCacheInLocal_1 =
|
|
12
|
-
var MySegmentsCacheInLocal_1 =
|
|
13
|
-
var MySegmentsCacheInMemory_1 =
|
|
14
|
-
var SplitsCacheInMemory_1 =
|
|
10
|
+
var SplitsCacheInLocal_1 = require("./SplitsCacheInLocal");
|
|
11
|
+
var MySegmentsCacheInLocal_1 = require("./MySegmentsCacheInLocal");
|
|
12
|
+
var MySegmentsCacheInMemory_1 = require("../inMemory/MySegmentsCacheInMemory");
|
|
13
|
+
var SplitsCacheInMemory_1 = require("../inMemory/SplitsCacheInMemory");
|
|
15
14
|
var browser_1 = require("../../utils/constants/browser");
|
|
16
15
|
var InMemoryStorageCS_1 = require("../inMemory/InMemoryStorageCS");
|
|
17
16
|
var constants_1 = require("./constants");
|
|
@@ -29,33 +28,33 @@ function InLocalStorage(options) {
|
|
|
29
28
|
return InMemoryStorageCS_1.InMemoryStorageCSFactory(params);
|
|
30
29
|
}
|
|
31
30
|
var log = params.log;
|
|
32
|
-
var keys = new KeyBuilderCS_1.
|
|
31
|
+
var keys = new KeyBuilderCS_1.KeyBuilderCS(prefix, params.matchingKey);
|
|
33
32
|
var expirationTimestamp = Date.now() - browser_1.DEFAULT_CACHE_EXPIRATION_IN_MILLIS;
|
|
34
33
|
return {
|
|
35
|
-
splits: new SplitsCacheInLocal_1.
|
|
36
|
-
segments: new MySegmentsCacheInLocal_1.
|
|
37
|
-
impressions: new ImpressionsCacheInMemory_1.
|
|
38
|
-
impressionCounts: params.optimize ? new ImpressionCountsCacheInMemory_1.
|
|
39
|
-
events: new EventsCacheInMemory_1.
|
|
34
|
+
splits: new SplitsCacheInLocal_1.SplitsCacheInLocal(log, keys, expirationTimestamp, params.splitFiltersValidation),
|
|
35
|
+
segments: new MySegmentsCacheInLocal_1.MySegmentsCacheInLocal(log, keys),
|
|
36
|
+
impressions: new ImpressionsCacheInMemory_1.ImpressionsCacheInMemory(),
|
|
37
|
+
impressionCounts: params.optimize ? new ImpressionCountsCacheInMemory_1.ImpressionCountsCacheInMemory() : undefined,
|
|
38
|
+
events: new EventsCacheInMemory_1.EventsCacheInMemory(params.eventsQueueSize),
|
|
40
39
|
destroy: function () {
|
|
41
|
-
this.splits = new SplitsCacheInMemory_1.
|
|
42
|
-
this.segments = new MySegmentsCacheInMemory_1.
|
|
40
|
+
this.splits = new SplitsCacheInMemory_1.SplitsCacheInMemory();
|
|
41
|
+
this.segments = new MySegmentsCacheInMemory_1.MySegmentsCacheInMemory();
|
|
43
42
|
this.impressions.clear();
|
|
44
43
|
this.impressionCounts && this.impressionCounts.clear();
|
|
45
44
|
this.events.clear();
|
|
46
45
|
},
|
|
47
46
|
// When using shared instanciation with MEMORY we reuse everything but segments (they are customer per key).
|
|
48
47
|
shared: function (matchingKey) {
|
|
49
|
-
var childKeysBuilder = new KeyBuilderCS_1.
|
|
48
|
+
var childKeysBuilder = new KeyBuilderCS_1.KeyBuilderCS(prefix, matchingKey);
|
|
50
49
|
return {
|
|
51
50
|
splits: this.splits,
|
|
52
|
-
segments: new MySegmentsCacheInLocal_1.
|
|
51
|
+
segments: new MySegmentsCacheInLocal_1.MySegmentsCacheInLocal(log, childKeysBuilder),
|
|
53
52
|
impressions: this.impressions,
|
|
54
53
|
impressionCounts: this.impressionCounts,
|
|
55
54
|
events: this.events,
|
|
56
55
|
destroy: function () {
|
|
57
|
-
this.splits = new SplitsCacheInMemory_1.
|
|
58
|
-
this.segments = new MySegmentsCacheInMemory_1.
|
|
56
|
+
this.splits = new SplitsCacheInMemory_1.SplitsCacheInMemory();
|
|
57
|
+
this.segments = new MySegmentsCacheInMemory_1.MySegmentsCacheInMemory();
|
|
59
58
|
}
|
|
60
59
|
};
|
|
61
60
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CountsCacheInMemory = void 0;
|
|
3
4
|
var CountsCacheInMemory = /** @class */ (function () {
|
|
4
5
|
function CountsCacheInMemory() {
|
|
5
6
|
this.counters = {};
|
|
@@ -34,4 +35,4 @@ var CountsCacheInMemory = /** @class */ (function () {
|
|
|
34
35
|
};
|
|
35
36
|
return CountsCacheInMemory;
|
|
36
37
|
}());
|
|
37
|
-
exports.
|
|
38
|
+
exports.CountsCacheInMemory = CountsCacheInMemory;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EventsCacheInMemory = void 0;
|
|
3
4
|
var MAX_QUEUE_BYTE_SIZE = 5 * 1024 * 1024; // 5M
|
|
4
5
|
var EventsCacheInMemory = /** @class */ (function () {
|
|
5
6
|
/**
|
|
@@ -57,4 +58,4 @@ var EventsCacheInMemory = /** @class */ (function () {
|
|
|
57
58
|
};
|
|
58
59
|
return EventsCacheInMemory;
|
|
59
60
|
}());
|
|
60
|
-
exports.
|
|
61
|
+
exports.EventsCacheInMemory = EventsCacheInMemory;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImpressionCountsCacheInMemory = void 0;
|
|
3
4
|
var time_1 = require("../../utils/time");
|
|
4
5
|
var ImpressionCountsCacheInMemory = /** @class */ (function () {
|
|
5
6
|
function ImpressionCountsCacheInMemory() {
|
|
@@ -33,4 +34,4 @@ var ImpressionCountsCacheInMemory = /** @class */ (function () {
|
|
|
33
34
|
};
|
|
34
35
|
return ImpressionCountsCacheInMemory;
|
|
35
36
|
}());
|
|
36
|
-
exports.
|
|
37
|
+
exports.ImpressionCountsCacheInMemory = ImpressionCountsCacheInMemory;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImpressionsCacheInMemory = void 0;
|
|
3
4
|
var ImpressionsCacheInMemory = /** @class */ (function () {
|
|
4
5
|
function ImpressionsCacheInMemory() {
|
|
5
6
|
this.queue = [];
|
|
@@ -31,4 +32,4 @@ var ImpressionsCacheInMemory = /** @class */ (function () {
|
|
|
31
32
|
};
|
|
32
33
|
return ImpressionsCacheInMemory;
|
|
33
34
|
}());
|
|
34
|
-
exports.
|
|
35
|
+
exports.ImpressionsCacheInMemory = ImpressionsCacheInMemory;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InMemoryStorageFactory = void 0;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var ImpressionCountsCacheInMemory_1 = tslib_1.__importDefault(require("./ImpressionCountsCacheInMemory"));
|
|
4
|
+
var SplitsCacheInMemory_1 = require("./SplitsCacheInMemory");
|
|
5
|
+
var SegmentsCacheInMemory_1 = require("./SegmentsCacheInMemory");
|
|
6
|
+
var ImpressionsCacheInMemory_1 = require("./ImpressionsCacheInMemory");
|
|
7
|
+
var EventsCacheInMemory_1 = require("./EventsCacheInMemory");
|
|
8
|
+
var ImpressionCountsCacheInMemory_1 = require("./ImpressionCountsCacheInMemory");
|
|
10
9
|
var constants_1 = require("../../utils/constants");
|
|
11
10
|
/**
|
|
12
11
|
* InMemory storage factory for standalone server-side SplitFactory
|
|
@@ -15,11 +14,11 @@ var constants_1 = require("../../utils/constants");
|
|
|
15
14
|
*/
|
|
16
15
|
function InMemoryStorageFactory(params) {
|
|
17
16
|
return {
|
|
18
|
-
splits: new SplitsCacheInMemory_1.
|
|
19
|
-
segments: new SegmentsCacheInMemory_1.
|
|
20
|
-
impressions: new ImpressionsCacheInMemory_1.
|
|
21
|
-
impressionCounts: params.optimize ? new ImpressionCountsCacheInMemory_1.
|
|
22
|
-
events: new EventsCacheInMemory_1.
|
|
17
|
+
splits: new SplitsCacheInMemory_1.SplitsCacheInMemory(),
|
|
18
|
+
segments: new SegmentsCacheInMemory_1.SegmentsCacheInMemory(),
|
|
19
|
+
impressions: new ImpressionsCacheInMemory_1.ImpressionsCacheInMemory(),
|
|
20
|
+
impressionCounts: params.optimize ? new ImpressionCountsCacheInMemory_1.ImpressionCountsCacheInMemory() : undefined,
|
|
21
|
+
events: new EventsCacheInMemory_1.EventsCacheInMemory(params.eventsQueueSize),
|
|
23
22
|
// When using MEMORY we should clean all the caches to leave them empty
|
|
24
23
|
destroy: function () {
|
|
25
24
|
this.splits.clear();
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InMemoryStorageCSFactory = void 0;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var ImpressionCountsCacheInMemory_1 = tslib_1.__importDefault(require("./ImpressionCountsCacheInMemory"));
|
|
4
|
+
var SplitsCacheInMemory_1 = require("./SplitsCacheInMemory");
|
|
5
|
+
var MySegmentsCacheInMemory_1 = require("./MySegmentsCacheInMemory");
|
|
6
|
+
var ImpressionsCacheInMemory_1 = require("./ImpressionsCacheInMemory");
|
|
7
|
+
var EventsCacheInMemory_1 = require("./EventsCacheInMemory");
|
|
8
|
+
var ImpressionCountsCacheInMemory_1 = require("./ImpressionCountsCacheInMemory");
|
|
10
9
|
var constants_1 = require("../../utils/constants");
|
|
11
10
|
/**
|
|
12
11
|
* InMemory storage factory for standalone client-side SplitFactory
|
|
@@ -15,11 +14,11 @@ var constants_1 = require("../../utils/constants");
|
|
|
15
14
|
*/
|
|
16
15
|
function InMemoryStorageCSFactory(params) {
|
|
17
16
|
return {
|
|
18
|
-
splits: new SplitsCacheInMemory_1.
|
|
19
|
-
segments: new MySegmentsCacheInMemory_1.
|
|
20
|
-
impressions: new ImpressionsCacheInMemory_1.
|
|
21
|
-
impressionCounts: params.optimize ? new ImpressionCountsCacheInMemory_1.
|
|
22
|
-
events: new EventsCacheInMemory_1.
|
|
17
|
+
splits: new SplitsCacheInMemory_1.SplitsCacheInMemory(),
|
|
18
|
+
segments: new MySegmentsCacheInMemory_1.MySegmentsCacheInMemory(),
|
|
19
|
+
impressions: new ImpressionsCacheInMemory_1.ImpressionsCacheInMemory(),
|
|
20
|
+
impressionCounts: params.optimize ? new ImpressionCountsCacheInMemory_1.ImpressionCountsCacheInMemory() : undefined,
|
|
21
|
+
events: new EventsCacheInMemory_1.EventsCacheInMemory(params.eventsQueueSize),
|
|
23
22
|
// When using MEMORY we should clean all the caches to leave them empty
|
|
24
23
|
destroy: function () {
|
|
25
24
|
this.splits.clear();
|
|
@@ -32,13 +31,13 @@ function InMemoryStorageCSFactory(params) {
|
|
|
32
31
|
shared: function () {
|
|
33
32
|
return {
|
|
34
33
|
splits: this.splits,
|
|
35
|
-
segments: new MySegmentsCacheInMemory_1.
|
|
34
|
+
segments: new MySegmentsCacheInMemory_1.MySegmentsCacheInMemory(),
|
|
36
35
|
impressions: this.impressions,
|
|
37
36
|
impressionCounts: this.impressionCounts,
|
|
38
37
|
events: this.events,
|
|
39
38
|
// Set a new splits cache to clean it for the client without affecting other clients
|
|
40
39
|
destroy: function () {
|
|
41
|
-
this.splits = new SplitsCacheInMemory_1.
|
|
40
|
+
this.splits = new SplitsCacheInMemory_1.SplitsCacheInMemory();
|
|
42
41
|
this.segments.clear();
|
|
43
42
|
}
|
|
44
43
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
var findLatencyIndex_1 =
|
|
3
|
+
exports.LatenciesCacheInMemory = void 0;
|
|
4
|
+
var findLatencyIndex_1 = require("../findLatencyIndex");
|
|
5
5
|
var LatenciesCacheInMemory = /** @class */ (function () {
|
|
6
6
|
function LatenciesCacheInMemory() {
|
|
7
7
|
this.counters = {};
|
|
@@ -17,7 +17,7 @@ var LatenciesCacheInMemory = /** @class */ (function () {
|
|
|
17
17
|
];
|
|
18
18
|
}
|
|
19
19
|
// +1 based on the latency number
|
|
20
|
-
this.counters[metricName][findLatencyIndex_1.
|
|
20
|
+
this.counters[metricName][findLatencyIndex_1.findLatencyIndex(latency)]++;
|
|
21
21
|
return true;
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
@@ -40,4 +40,4 @@ var LatenciesCacheInMemory = /** @class */ (function () {
|
|
|
40
40
|
};
|
|
41
41
|
return LatenciesCacheInMemory;
|
|
42
42
|
}());
|
|
43
|
-
exports.
|
|
43
|
+
exports.LatenciesCacheInMemory = LatenciesCacheInMemory;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MySegmentsCacheInMemory = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
|
-
var AbstractSegmentsCacheSync_1 =
|
|
5
|
+
var AbstractSegmentsCacheSync_1 = require("../AbstractSegmentsCacheSync");
|
|
5
6
|
/**
|
|
6
7
|
* Default MySegmentsCacheInMemory implementation that stores MySegments in memory.
|
|
7
8
|
* Supported by all JS runtimes.
|
|
@@ -66,5 +67,5 @@ var MySegmentsCacheInMemory = /** @class */ (function (_super) {
|
|
|
66
67
|
return isDiff;
|
|
67
68
|
};
|
|
68
69
|
return MySegmentsCacheInMemory;
|
|
69
|
-
}(AbstractSegmentsCacheSync_1.
|
|
70
|
-
exports.
|
|
70
|
+
}(AbstractSegmentsCacheSync_1.AbstractSegmentsCacheSync));
|
|
71
|
+
exports.MySegmentsCacheInMemory = MySegmentsCacheInMemory;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SegmentsCacheInMemory = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
|
-
var AbstractSegmentsCacheSync_1 =
|
|
5
|
+
var AbstractSegmentsCacheSync_1 = require("../AbstractSegmentsCacheSync");
|
|
5
6
|
var sets_1 = require("../../utils/lang/sets");
|
|
6
7
|
var lang_1 = require("../../utils/lang");
|
|
7
8
|
/**
|
|
@@ -65,5 +66,5 @@ var SegmentsCacheInMemory = /** @class */ (function (_super) {
|
|
|
65
66
|
return lang_1.isIntegerNumber(value) ? value : -1;
|
|
66
67
|
};
|
|
67
68
|
return SegmentsCacheInMemory;
|
|
68
|
-
}(AbstractSegmentsCacheSync_1.
|
|
69
|
-
exports.
|
|
69
|
+
}(AbstractSegmentsCacheSync_1.AbstractSegmentsCacheSync));
|
|
70
|
+
exports.SegmentsCacheInMemory = SegmentsCacheInMemory;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SplitsCacheInMemory = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
|
-
var AbstractSplitsCacheSync_1 =
|
|
5
|
+
var AbstractSplitsCacheSync_1 = require("../AbstractSplitsCacheSync");
|
|
5
6
|
var lang_1 = require("../../utils/lang");
|
|
6
7
|
/**
|
|
7
8
|
* Default ISplitsCacheSync implementation that stores split definitions in memory.
|
|
@@ -98,5 +99,5 @@ var SplitsCacheInMemory = /** @class */ (function (_super) {
|
|
|
98
99
|
return this.getChangeNumber() === -1 || this.splitsWithSegmentsCount > 0;
|
|
99
100
|
};
|
|
100
101
|
return SplitsCacheInMemory;
|
|
101
|
-
}(AbstractSplitsCacheSync_1.
|
|
102
|
-
exports.
|
|
102
|
+
}(AbstractSplitsCacheSync_1.AbstractSplitsCacheSync));
|
|
103
|
+
exports.SplitsCacheInMemory = SplitsCacheInMemory;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CountsCacheInRedis = void 0;
|
|
3
4
|
var CountsCacheInRedis = /** @class */ (function () {
|
|
4
5
|
function CountsCacheInRedis(keys, redis) {
|
|
5
6
|
this.keys = keys;
|
|
@@ -12,4 +13,4 @@ var CountsCacheInRedis = /** @class */ (function () {
|
|
|
12
13
|
};
|
|
13
14
|
return CountsCacheInRedis;
|
|
14
15
|
}());
|
|
15
|
-
exports.
|
|
16
|
+
exports.CountsCacheInRedis = CountsCacheInRedis;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EventsCacheInRedis = void 0;
|
|
3
4
|
var constants_1 = require("./constants");
|
|
4
5
|
var EventsCacheInRedis = /** @class */ (function () {
|
|
5
6
|
function EventsCacheInRedis(log, key, redis, metadata) {
|
|
@@ -56,4 +57,4 @@ var EventsCacheInRedis = /** @class */ (function () {
|
|
|
56
57
|
};
|
|
57
58
|
return EventsCacheInRedis;
|
|
58
59
|
}());
|
|
59
|
-
exports.
|
|
60
|
+
exports.EventsCacheInRedis = EventsCacheInRedis;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImpressionsCacheInRedis = void 0;
|
|
3
4
|
var IMPRESSIONS_TTL_REFRESH = 3600; // 1 hr
|
|
4
5
|
var ImpressionsCacheInRedis = /** @class */ (function () {
|
|
5
6
|
function ImpressionsCacheInRedis(log, key, redis, metadata) {
|
|
@@ -58,4 +59,4 @@ var ImpressionsCacheInRedis = /** @class */ (function () {
|
|
|
58
59
|
};
|
|
59
60
|
return ImpressionsCacheInRedis;
|
|
60
61
|
}());
|
|
61
|
-
exports.
|
|
62
|
+
exports.ImpressionsCacheInRedis = ImpressionsCacheInRedis;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
var findLatencyIndex_1 =
|
|
3
|
+
exports.LatenciesCacheInRedis = void 0;
|
|
4
|
+
var findLatencyIndex_1 = require("../findLatencyIndex");
|
|
5
5
|
var LatenciesCacheInRedis = /** @class */ (function () {
|
|
6
6
|
function LatenciesCacheInRedis(keys, redis) {
|
|
7
7
|
this.keys = keys;
|
|
8
8
|
this.redis = redis;
|
|
9
9
|
}
|
|
10
10
|
LatenciesCacheInRedis.prototype.track = function (metricName, latency) {
|
|
11
|
-
var bucketNumber = findLatencyIndex_1.
|
|
11
|
+
var bucketNumber = findLatencyIndex_1.findLatencyIndex(latency);
|
|
12
12
|
return this.redis.incr(this.keys.buildLatencyKey(metricName, bucketNumber)).catch(function () {
|
|
13
13
|
// noop, for telemetry metrics there's no need to throw.
|
|
14
14
|
}).then(function () { return true; });
|
|
15
15
|
};
|
|
16
16
|
return LatenciesCacheInRedis;
|
|
17
17
|
}());
|
|
18
|
-
exports.
|
|
18
|
+
exports.LatenciesCacheInRedis = LatenciesCacheInRedis;
|