@splitsoftware/splitio-commons 1.0.1-rc.4 → 1.1.1-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.txt +13 -3
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/cjs/evaluator/Engine.js +6 -5
- package/cjs/evaluator/combiners/and.js +4 -4
- package/cjs/evaluator/combiners/ifelseif.js +4 -3
- package/cjs/evaluator/condition/index.js +4 -3
- package/cjs/evaluator/index.js +10 -11
- package/cjs/evaluator/matchers/all.js +2 -1
- package/cjs/evaluator/matchers/between.js +2 -1
- package/cjs/evaluator/matchers/boolean.js +2 -1
- package/cjs/evaluator/matchers/cont_all.js +3 -2
- package/cjs/evaluator/matchers/cont_any.js +3 -2
- package/cjs/evaluator/matchers/cont_str.js +2 -1
- package/cjs/evaluator/matchers/dependency.js +4 -4
- package/cjs/evaluator/matchers/eq.js +2 -1
- package/cjs/evaluator/matchers/eq_set.js +2 -1
- package/cjs/evaluator/matchers/ew.js +2 -1
- package/cjs/evaluator/matchers/gte.js +2 -1
- package/cjs/evaluator/matchers/index.js +36 -36
- package/cjs/evaluator/matchers/lte.js +2 -1
- package/cjs/evaluator/matchers/part_of.js +3 -2
- package/cjs/evaluator/matchers/segment.js +5 -5
- package/cjs/evaluator/matchers/string.js +2 -1
- package/cjs/evaluator/matchers/sw.js +2 -1
- package/cjs/evaluator/matchers/whitelist.js +2 -1
- package/cjs/evaluator/matchersTransform/index.js +12 -12
- package/cjs/evaluator/matchersTransform/segment.js +3 -2
- package/cjs/evaluator/matchersTransform/set.js +3 -2
- package/cjs/evaluator/matchersTransform/unaryNumeric.js +3 -2
- package/cjs/evaluator/matchersTransform/whitelist.js +3 -2
- package/cjs/evaluator/parser/index.js +16 -16
- package/cjs/evaluator/treatments/index.js +2 -1
- package/cjs/evaluator/value/index.js +5 -5
- package/cjs/evaluator/value/sanitize.js +2 -1
- package/cjs/integrations/browser.js +4 -4
- package/cjs/integrations/ga/GaToSplit.js +3 -4
- package/cjs/integrations/pluggable.js +3 -2
- package/cjs/listeners/browser.js +4 -4
- package/cjs/listeners/node.js +4 -4
- package/cjs/logger/index.js +2 -3
- package/cjs/logger/messages/info.js +1 -1
- package/cjs/logger/messages/warn.js +2 -2
- package/cjs/readiness/readinessManager.js +3 -4
- package/cjs/readiness/sdkReadinessManager.js +7 -7
- package/cjs/sdkClient/client.js +5 -5
- package/cjs/sdkClient/clientAttributesDecoration.js +108 -0
- package/cjs/sdkClient/clientCS.js +12 -10
- package/cjs/sdkClient/clientInputValidation.js +5 -5
- package/cjs/sdkClient/sdkClient.js +5 -6
- package/cjs/sdkClient/sdkClientMethodCS.js +4 -5
- package/cjs/sdkClient/sdkClientMethodCSWithTT.js +4 -5
- package/cjs/sdkFactory/index.js +9 -10
- package/cjs/sdkManager/index.js +6 -7
- package/cjs/services/splitApi.js +2 -3
- package/cjs/services/splitHttpClient.js +3 -4
- package/cjs/storages/AbstractSegmentsCacheSync.js +2 -1
- package/cjs/storages/AbstractSplitsCacheAsync.js +2 -1
- package/cjs/storages/AbstractSplitsCacheSync.js +2 -2
- package/cjs/storages/KeyBuilder.js +2 -2
- package/cjs/storages/KeyBuilderCS.js +4 -3
- package/cjs/storages/KeyBuilderSS.js +4 -3
- package/cjs/storages/findLatencyIndex.js +2 -1
- package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +4 -3
- package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +4 -3
- package/cjs/storages/inLocalStorage/index.js +20 -21
- package/cjs/storages/inMemory/AttributesCacheInMemory.js +70 -0
- package/cjs/storages/inMemory/CountsCacheInMemory.js +2 -1
- package/cjs/storages/inMemory/EventsCacheInMemory.js +2 -1
- package/cjs/storages/inMemory/ImpressionCountsCacheInMemory.js +2 -1
- package/cjs/storages/inMemory/ImpressionsCacheInMemory.js +2 -1
- package/cjs/storages/inMemory/InMemoryStorage.js +10 -11
- package/cjs/storages/inMemory/InMemoryStorageCS.js +12 -13
- package/cjs/storages/inMemory/LatenciesCacheInMemory.js +4 -4
- package/cjs/storages/inMemory/MySegmentsCacheInMemory.js +4 -3
- package/cjs/storages/inMemory/SegmentsCacheInMemory.js +4 -3
- package/cjs/storages/inMemory/SplitsCacheInMemory.js +4 -3
- package/cjs/storages/inRedis/CountsCacheInRedis.js +2 -1
- package/cjs/storages/inRedis/EventsCacheInRedis.js +2 -1
- package/cjs/storages/inRedis/ImpressionsCacheInRedis.js +2 -1
- package/cjs/storages/inRedis/LatenciesCacheInRedis.js +4 -4
- package/cjs/storages/inRedis/RedisAdapter.js +6 -5
- package/cjs/storages/inRedis/SegmentsCacheInRedis.js +2 -1
- package/cjs/storages/inRedis/SplitsCacheInRedis.js +4 -3
- package/cjs/storages/inRedis/index.js +16 -17
- package/cjs/storages/pluggable/SplitsCachePluggable.js +2 -2
- package/cjs/storages/pluggable/index.js +8 -8
- package/cjs/sync/offline/splitsParser/parseCondition.js +2 -1
- package/cjs/sync/offline/splitsParser/splitsParserFromFile.js +3 -3
- package/cjs/sync/offline/splitsParser/splitsParserFromSettings.js +2 -3
- package/cjs/sync/offline/syncManagerOffline.js +3 -4
- package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +4 -5
- package/cjs/sync/polling/fetchers/mySegmentsFetcher.js +2 -1
- package/cjs/sync/polling/fetchers/segmentChangesFetcher.js +2 -1
- package/cjs/sync/polling/fetchers/splitChangesFetcher.js +2 -1
- package/cjs/sync/polling/pollingManagerCS.js +6 -6
- package/cjs/sync/polling/pollingManagerSS.js +8 -8
- package/cjs/sync/polling/syncTasks/mySegmentsSyncTask.js +5 -5
- package/cjs/sync/polling/syncTasks/segmentsSyncTask.js +5 -5
- package/cjs/sync/polling/syncTasks/splitsSyncTask.js +5 -5
- package/cjs/sync/polling/updaters/mySegmentsUpdater.js +2 -3
- package/cjs/sync/polling/updaters/segmentChangesUpdater.js +2 -3
- package/cjs/sync/polling/updaters/splitChangesUpdater.js +8 -6
- package/cjs/sync/streaming/AuthClient/index.js +2 -3
- package/cjs/sync/streaming/SSEClient/index.js +2 -1
- package/cjs/sync/streaming/SSEHandler/NotificationKeeper.js +2 -1
- package/cjs/sync/streaming/SSEHandler/index.js +4 -4
- package/cjs/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +4 -4
- package/cjs/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +4 -4
- package/cjs/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +4 -4
- package/cjs/sync/streaming/pushManager.js +18 -17
- package/cjs/sync/submitters/submitterSyncTask.js +2 -3
- package/cjs/sync/syncTask.js +2 -1
- package/cjs/trackers/eventTracker.js +7 -7
- package/cjs/trackers/impressionObserver/ImpressionObserver.js +4 -4
- package/cjs/trackers/impressionObserver/impressionObserverCS.js +2 -3
- package/cjs/trackers/impressionObserver/impressionObserverSS.js +2 -3
- package/cjs/trackers/impressionsTracker.js +6 -6
- package/cjs/utils/Backoff.js +2 -1
- package/cjs/utils/LRUCache/index.js +2 -1
- package/cjs/utils/MinEventEmitter.js +2 -1
- package/cjs/utils/MinEvents.js +13 -15
- package/cjs/utils/inputValidation/attribute.js +20 -0
- package/cjs/utils/inputValidation/attributes.js +13 -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 +5 -6
- package/cjs/utils/settingsValidation/mode.js +2 -1
- package/cjs/utils/timeTracker/index.js +7 -8
- package/cjs/utils/timeTracker/now/browser.js +2 -2
- package/cjs/utils/timeTracker/now/node.js +2 -1
- package/cjs/utils/timeTracker/timer.js +3 -2
- package/esm/evaluator/Engine.js +3 -3
- package/esm/evaluator/combiners/and.js +2 -2
- package/esm/evaluator/combiners/ifelseif.js +2 -2
- package/esm/evaluator/condition/index.js +2 -2
- package/esm/evaluator/index.js +5 -6
- package/esm/evaluator/matchers/all.js +1 -1
- package/esm/evaluator/matchers/between.js +1 -1
- package/esm/evaluator/matchers/boolean.js +1 -1
- package/esm/evaluator/matchers/cont_all.js +1 -1
- package/esm/evaluator/matchers/cont_any.js +1 -1
- package/esm/evaluator/matchers/cont_str.js +1 -1
- package/esm/evaluator/matchers/dependency.js +2 -2
- package/esm/evaluator/matchers/eq.js +1 -1
- package/esm/evaluator/matchers/eq_set.js +1 -1
- package/esm/evaluator/matchers/ew.js +1 -1
- package/esm/evaluator/matchers/gte.js +1 -1
- package/esm/evaluator/matchers/index.js +35 -35
- package/esm/evaluator/matchers/lte.js +1 -1
- package/esm/evaluator/matchers/part_of.js +1 -1
- package/esm/evaluator/matchers/segment.js +2 -2
- package/esm/evaluator/matchers/string.js +1 -1
- package/esm/evaluator/matchers/sw.js +1 -1
- package/esm/evaluator/matchers/whitelist.js +1 -1
- package/esm/evaluator/matchersTransform/index.js +5 -5
- package/esm/evaluator/matchersTransform/segment.js +1 -1
- package/esm/evaluator/matchersTransform/set.js +1 -1
- package/esm/evaluator/matchersTransform/unaryNumeric.js +1 -1
- package/esm/evaluator/matchersTransform/whitelist.js +1 -1
- package/esm/evaluator/parser/index.js +11 -11
- package/esm/evaluator/treatments/index.js +1 -1
- package/esm/evaluator/value/index.js +3 -3
- package/esm/evaluator/value/sanitize.js +1 -1
- package/esm/integrations/browser.js +2 -2
- package/esm/integrations/ga/GaToSplit.js +1 -1
- package/esm/integrations/pluggable.js +1 -1
- package/esm/listeners/browser.js +2 -2
- package/esm/listeners/node.js +2 -2
- package/esm/logger/index.js +1 -1
- package/esm/logger/messages/info.js +1 -1
- package/esm/logger/messages/warn.js +2 -2
- package/esm/readiness/readinessManager.js +1 -1
- package/esm/readiness/sdkReadinessManager.js +3 -3
- package/esm/sdkClient/client.js +2 -2
- package/esm/sdkClient/clientAttributesDecoration.js +104 -0
- package/esm/sdkClient/clientCS.js +10 -8
- package/esm/sdkClient/clientInputValidation.js +2 -2
- package/esm/sdkClient/sdkClient.js +3 -3
- package/esm/sdkClient/sdkClientMethodCS.js +4 -4
- package/esm/sdkClient/sdkClientMethodCSWithTT.js +4 -4
- package/esm/sdkFactory/index.js +6 -6
- package/esm/sdkManager/index.js +2 -2
- package/esm/services/splitApi.js +1 -1
- package/esm/services/splitHttpClient.js +1 -1
- package/esm/storages/AbstractSegmentsCacheSync.js +1 -1
- package/esm/storages/AbstractSplitsCacheAsync.js +1 -1
- package/esm/storages/AbstractSplitsCacheSync.js +1 -1
- package/esm/storages/KeyBuilder.js +1 -1
- package/esm/storages/KeyBuilderCS.js +2 -2
- package/esm/storages/KeyBuilderSS.js +2 -2
- package/esm/storages/findLatencyIndex.js +1 -1
- package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +2 -2
- package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +2 -2
- package/esm/storages/inLocalStorage/index.js +8 -8
- package/esm/storages/inMemory/AttributesCacheInMemory.js +67 -0
- package/esm/storages/inMemory/CountsCacheInMemory.js +1 -1
- package/esm/storages/inMemory/EventsCacheInMemory.js +1 -1
- package/esm/storages/inMemory/ImpressionCountsCacheInMemory.js +1 -1
- package/esm/storages/inMemory/ImpressionsCacheInMemory.js +1 -1
- package/esm/storages/inMemory/InMemoryStorage.js +5 -5
- package/esm/storages/inMemory/InMemoryStorageCS.js +5 -5
- package/esm/storages/inMemory/LatenciesCacheInMemory.js +2 -2
- package/esm/storages/inMemory/MySegmentsCacheInMemory.js +2 -2
- package/esm/storages/inMemory/SegmentsCacheInMemory.js +2 -2
- package/esm/storages/inMemory/SplitsCacheInMemory.js +2 -2
- package/esm/storages/inRedis/CountsCacheInRedis.js +1 -1
- package/esm/storages/inRedis/EventsCacheInRedis.js +1 -1
- package/esm/storages/inRedis/ImpressionsCacheInRedis.js +1 -1
- package/esm/storages/inRedis/LatenciesCacheInRedis.js +2 -2
- package/esm/storages/inRedis/RedisAdapter.js +3 -3
- package/esm/storages/inRedis/SegmentsCacheInRedis.js +1 -1
- package/esm/storages/inRedis/SplitsCacheInRedis.js +2 -2
- package/esm/storages/inRedis/index.js +8 -8
- package/esm/storages/pluggable/SplitsCachePluggable.js +1 -1
- package/esm/storages/pluggable/index.js +4 -4
- package/esm/sync/offline/splitsParser/parseCondition.js +1 -1
- package/esm/sync/offline/splitsParser/splitsParserFromFile.js +1 -1
- package/esm/sync/offline/splitsParser/splitsParserFromSettings.js +1 -1
- package/esm/sync/offline/syncManagerOffline.js +2 -2
- package/esm/sync/offline/syncTasks/fromObjectSyncTask.js +2 -2
- package/esm/sync/polling/fetchers/mySegmentsFetcher.js +1 -1
- package/esm/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
- package/esm/sync/polling/fetchers/splitChangesFetcher.js +1 -1
- package/esm/sync/polling/pollingManagerCS.js +3 -3
- package/esm/sync/polling/pollingManagerSS.js +4 -4
- package/esm/sync/polling/syncTasks/mySegmentsSyncTask.js +3 -3
- package/esm/sync/polling/syncTasks/segmentsSyncTask.js +3 -3
- package/esm/sync/polling/syncTasks/splitsSyncTask.js +3 -3
- package/esm/sync/polling/updaters/mySegmentsUpdater.js +1 -1
- package/esm/sync/polling/updaters/segmentChangesUpdater.js +1 -1
- package/esm/sync/polling/updaters/splitChangesUpdater.js +7 -4
- package/esm/sync/streaming/AuthClient/index.js +1 -1
- package/esm/sync/streaming/SSEClient/index.js +1 -1
- package/esm/sync/streaming/SSEHandler/NotificationKeeper.js +1 -1
- package/esm/sync/streaming/SSEHandler/index.js +2 -2
- package/esm/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +2 -2
- package/esm/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +2 -2
- package/esm/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +2 -2
- package/esm/sync/streaming/pushManager.js +10 -9
- package/esm/sync/submitters/submitterSyncTask.js +1 -1
- package/esm/sync/syncTask.js +1 -1
- package/esm/trackers/eventTracker.js +3 -3
- package/esm/trackers/impressionObserver/ImpressionObserver.js +2 -2
- package/esm/trackers/impressionObserver/impressionObserverCS.js +1 -1
- package/esm/trackers/impressionObserver/impressionObserverSS.js +1 -1
- package/esm/trackers/impressionsTracker.js +3 -3
- package/esm/utils/Backoff.js +1 -1
- package/esm/utils/LRUCache/index.js +1 -1
- package/esm/utils/MinEventEmitter.js +1 -1
- package/esm/utils/MinEvents.js +2 -5
- package/esm/utils/inputValidation/attribute.js +16 -0
- package/esm/utils/inputValidation/attributes.js +11 -0
- package/esm/utils/inputValidation/trafficTypeExistance.js +1 -1
- package/esm/utils/lang/binarySearch.js +1 -1
- package/esm/utils/lang/objectAssign.js +82 -0
- package/esm/utils/promise/thenable.js +3 -1
- package/esm/utils/promise/timeout.js +1 -1
- package/esm/utils/promise/wrapper.js +1 -1
- package/esm/utils/settingsValidation/impressionsMode.js +1 -1
- package/esm/utils/settingsValidation/index.js +3 -3
- package/esm/utils/settingsValidation/mode.js +1 -1
- package/esm/utils/timeTracker/index.js +4 -5
- package/esm/utils/timeTracker/now/browser.js +1 -2
- package/esm/utils/timeTracker/now/node.js +1 -1
- package/esm/utils/timeTracker/timer.js +1 -1
- package/package.json +2 -3
- package/src/evaluator/Engine.ts +3 -3
- package/src/evaluator/combiners/and.ts +2 -2
- package/src/evaluator/combiners/ifelseif.ts +2 -2
- package/src/evaluator/condition/index.ts +2 -2
- package/src/evaluator/index.ts +5 -6
- package/src/evaluator/matchers/all.ts +1 -1
- package/src/evaluator/matchers/between.ts +1 -1
- package/src/evaluator/matchers/boolean.ts +1 -1
- package/src/evaluator/matchers/cont_all.ts +1 -1
- package/src/evaluator/matchers/cont_any.ts +1 -1
- package/src/evaluator/matchers/cont_str.ts +1 -1
- package/src/evaluator/matchers/dependency.ts +2 -2
- package/src/evaluator/matchers/eq.ts +1 -1
- package/src/evaluator/matchers/eq_set.ts +1 -1
- package/src/evaluator/matchers/ew.ts +1 -1
- package/src/evaluator/matchers/gte.ts +1 -1
- package/src/evaluator/matchers/index.ts +35 -35
- package/src/evaluator/matchers/lte.ts +1 -1
- package/src/evaluator/matchers/part_of.ts +1 -1
- package/src/evaluator/matchers/segment.ts +2 -2
- package/src/evaluator/matchers/string.ts +1 -1
- package/src/evaluator/matchers/sw.ts +1 -1
- package/src/evaluator/matchers/whitelist.ts +1 -1
- package/src/evaluator/matchersTransform/index.ts +5 -5
- package/src/evaluator/matchersTransform/segment.ts +1 -1
- package/src/evaluator/matchersTransform/set.ts +1 -1
- package/src/evaluator/matchersTransform/unaryNumeric.ts +1 -1
- package/src/evaluator/matchersTransform/whitelist.ts +1 -1
- package/src/evaluator/parser/index.ts +12 -12
- package/src/evaluator/treatments/index.ts +1 -1
- package/src/evaluator/value/index.ts +3 -3
- package/src/evaluator/value/sanitize.ts +1 -1
- package/src/integrations/browser.ts +2 -2
- package/src/integrations/ga/GaToSplit.ts +1 -1
- package/src/integrations/pluggable.ts +1 -1
- package/src/listeners/browser.ts +2 -2
- package/src/listeners/node.ts +2 -2
- package/src/logger/index.ts +1 -1
- package/src/logger/messages/info.ts +1 -1
- package/src/logger/messages/warn.ts +2 -2
- package/src/readiness/readinessManager.ts +2 -2
- package/src/readiness/sdkReadinessManager.ts +3 -3
- package/src/sdkClient/client.ts +2 -2
- package/src/sdkClient/clientAttributesDecoration.ts +122 -0
- package/src/sdkClient/clientCS.ts +13 -8
- package/src/sdkClient/clientInputValidation.ts +2 -2
- package/src/sdkClient/sdkClient.ts +3 -3
- package/src/sdkClient/sdkClientMethodCS.ts +4 -2
- package/src/sdkClient/sdkClientMethodCSWithTT.ts +4 -2
- package/src/sdkFactory/index.ts +6 -6
- package/src/sdkManager/index.ts +2 -2
- package/src/services/splitApi.ts +1 -1
- package/src/services/splitHttpClient.ts +1 -1
- package/src/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/AttributesCacheInMemory.ts +73 -0
- package/src/storages/inMemory/CountsCacheInMemory.ts +1 -1
- package/src/storages/inMemory/EventsCacheInMemory.ts +1 -1
- package/src/storages/inMemory/ImpressionCountsCacheInMemory.ts +1 -1
- package/src/storages/inMemory/ImpressionsCacheInMemory.ts +1 -1
- package/src/storages/inMemory/InMemoryStorage.ts +5 -5
- package/src/storages/inMemory/InMemoryStorageCS.ts +5 -5
- package/src/storages/inMemory/LatenciesCacheInMemory.ts +2 -2
- package/src/storages/inMemory/MySegmentsCacheInMemory.ts +2 -2
- package/src/storages/inMemory/SegmentsCacheInMemory.ts +2 -2
- package/src/storages/inMemory/SplitsCacheInMemory.ts +2 -2
- package/src/storages/inRedis/CountsCacheInRedis.ts +2 -2
- package/src/storages/inRedis/EventsCacheInRedis.ts +1 -1
- package/src/storages/inRedis/ImpressionsCacheInRedis.ts +1 -1
- package/src/storages/inRedis/LatenciesCacheInRedis.ts +3 -3
- package/src/storages/inRedis/RedisAdapter.ts +3 -3
- package/src/storages/inRedis/SegmentsCacheInRedis.ts +2 -2
- package/src/storages/inRedis/SplitsCacheInRedis.ts +3 -3
- package/src/storages/inRedis/index.ts +8 -8
- package/src/storages/pluggable/SegmentsCachePluggable.ts +1 -1
- package/src/storages/pluggable/SplitsCachePluggable.ts +2 -2
- package/src/storages/pluggable/index.ts +4 -4
- package/src/storages/types.ts +2 -2
- package/src/sync/offline/splitsParser/parseCondition.ts +1 -1
- package/src/sync/offline/splitsParser/splitsParserFromFile.ts +1 -1
- package/src/sync/offline/splitsParser/splitsParserFromSettings.ts +1 -1
- package/src/sync/offline/syncManagerOffline.ts +2 -2
- package/src/sync/offline/syncTasks/fromObjectSyncTask.ts +2 -2
- package/src/sync/polling/fetchers/mySegmentsFetcher.ts +1 -1
- package/src/sync/polling/fetchers/segmentChangesFetcher.ts +1 -1
- package/src/sync/polling/fetchers/splitChangesFetcher.ts +1 -1
- package/src/sync/polling/pollingManagerCS.ts +3 -3
- package/src/sync/polling/pollingManagerSS.ts +4 -4
- package/src/sync/polling/syncTasks/mySegmentsSyncTask.ts +3 -3
- package/src/sync/polling/syncTasks/segmentsSyncTask.ts +3 -3
- package/src/sync/polling/syncTasks/splitsSyncTask.ts +3 -3
- package/src/sync/polling/updaters/mySegmentsUpdater.ts +1 -1
- package/src/sync/polling/updaters/segmentChangesUpdater.ts +1 -1
- package/src/sync/polling/updaters/splitChangesUpdater.ts +6 -3
- package/src/sync/streaming/AuthClient/index.ts +1 -1
- package/src/sync/streaming/SSEClient/index.ts +1 -1
- package/src/sync/streaming/SSEHandler/NotificationKeeper.ts +1 -1
- package/src/sync/streaming/SSEHandler/index.ts +2 -2
- package/src/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.ts +2 -2
- package/src/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.ts +2 -2
- package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +2 -2
- package/src/sync/streaming/UpdateWorkers/types.ts +1 -1
- package/src/sync/streaming/pushManager.ts +10 -9
- package/src/sync/submitters/submitterSyncTask.ts +1 -1
- package/src/sync/syncTask.ts +1 -1
- package/src/trackers/eventTracker.ts +3 -3
- package/src/trackers/impressionObserver/ImpressionObserver.ts +2 -2
- package/src/trackers/impressionObserver/impressionObserverCS.ts +1 -1
- package/src/trackers/impressionObserver/impressionObserverSS.ts +1 -1
- package/src/trackers/impressionsTracker.ts +3 -3
- package/src/types.ts +39 -0
- package/src/utils/Backoff.ts +1 -1
- package/src/utils/LRUCache/index.ts +1 -1
- package/src/utils/MinEventEmitter.ts +1 -1
- package/src/utils/MinEvents.ts +2 -7
- package/src/utils/inputValidation/attribute.ts +21 -0
- package/src/utils/inputValidation/attributes.ts +14 -0
- package/src/utils/inputValidation/trafficTypeExistance.ts +1 -1
- package/src/utils/lang/binarySearch.ts +1 -1
- package/src/utils/lang/objectAssign.ts +104 -0
- package/src/utils/promise/thenable.ts +3 -1
- package/src/utils/promise/timeout.ts +1 -1
- package/src/utils/promise/wrapper.ts +1 -1
- package/src/utils/settingsValidation/impressionsMode.ts +1 -1
- package/src/utils/settingsValidation/index.ts +3 -3
- package/src/utils/settingsValidation/mode.ts +1 -1
- package/src/utils/timeTracker/index.ts +4 -6
- package/src/utils/timeTracker/now/browser.ts +1 -3
- package/src/utils/timeTracker/now/node.ts +1 -1
- package/src/utils/timeTracker/timer.ts +1 -1
- package/types/evaluator/Engine.d.ts +1 -1
- package/types/evaluator/combiners/and.d.ts +1 -1
- package/types/evaluator/combiners/ifelseif.d.ts +1 -1
- package/types/evaluator/condition/index.d.ts +1 -1
- package/types/evaluator/matchers/all.d.ts +1 -1
- package/types/evaluator/matchers/between.d.ts +1 -1
- package/types/evaluator/matchers/boolean.d.ts +1 -1
- package/types/evaluator/matchers/cont_all.d.ts +1 -1
- package/types/evaluator/matchers/cont_any.d.ts +1 -1
- package/types/evaluator/matchers/cont_str.d.ts +1 -1
- package/types/evaluator/matchers/dependency.d.ts +1 -1
- package/types/evaluator/matchers/eq.d.ts +1 -1
- package/types/evaluator/matchers/eq_set.d.ts +1 -1
- package/types/evaluator/matchers/ew.d.ts +1 -1
- package/types/evaluator/matchers/gte.d.ts +1 -1
- package/types/evaluator/matchers/index.d.ts +1 -1
- package/types/evaluator/matchers/lte.d.ts +1 -1
- package/types/evaluator/matchers/part_of.d.ts +1 -1
- package/types/evaluator/matchers/segment.d.ts +1 -1
- package/types/evaluator/matchers/string.d.ts +1 -1
- package/types/evaluator/matchers/sw.d.ts +1 -1
- package/types/evaluator/matchers/whitelist.d.ts +1 -1
- package/types/evaluator/matchersTransform/index.d.ts +1 -1
- package/types/evaluator/matchersTransform/segment.d.ts +1 -1
- package/types/evaluator/matchersTransform/set.d.ts +1 -1
- package/types/evaluator/matchersTransform/unaryNumeric.d.ts +1 -1
- package/types/evaluator/matchersTransform/whitelist.d.ts +1 -1
- package/types/evaluator/parser/index.d.ts +1 -1
- package/types/evaluator/treatments/index.d.ts +1 -1
- package/types/evaluator/value/index.d.ts +1 -1
- package/types/evaluator/value/sanitize.d.ts +1 -1
- package/types/integrations/browser.d.ts +1 -1
- package/types/integrations/pluggable.d.ts +1 -1
- package/types/listeners/browser.d.ts +1 -1
- package/types/listeners/node.d.ts +1 -1
- package/types/logger/browser/{debugLogger.d.ts → DebugLogger.d.ts} +0 -0
- package/types/logger/browser/{errorLogger.d.ts → ErrorLogger.d.ts} +0 -0
- package/types/logger/browser/{infoLogger.d.ts → InfoLogger.d.ts} +0 -0
- package/types/logger/browser/{warnLogger.d.ts → WarnLogger.d.ts} +0 -0
- package/types/readiness/sdkReadinessManager.d.ts +1 -1
- package/types/sdkClient/client.d.ts +1 -1
- package/types/sdkClient/clientAttributesDecoration.d.ts +51 -0
- package/types/sdkClient/clientCS.d.ts +2 -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/AttributesCacheInMemory.d.ts +43 -0
- 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/types.d.ts +39 -0
- package/types/utils/Backoff.d.ts +1 -1
- package/types/utils/LRUCache/index.d.ts +1 -1
- package/types/utils/MinEventEmitter.d.ts +1 -1
- package/types/utils/MinEvents.d.ts +3 -2
- package/types/utils/inputValidation/attribute.d.ts +2 -0
- package/types/utils/inputValidation/attributes.d.ts +1 -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/src/logger/.DS_Store +0 -0
- package/types/integrations/ga/GaToSplitPlugin.d.ts +0 -3
- package/types/integrations/ga/SplitToGaPlugin.d.ts +0 -4
- package/types/logger/codes.d.ts +0 -2
- package/types/logger/codesConstants.d.ts +0 -117
- package/types/logger/codesConstantsBrowser.d.ts +0 -2
- package/types/logger/codesConstantsNode.d.ts +0 -14
- package/types/logger/codesDebug.d.ts +0 -1
- package/types/logger/codesDebugBrowser.d.ts +0 -1
- package/types/logger/codesDebugNode.d.ts +0 -1
- package/types/logger/codesError.d.ts +0 -1
- package/types/logger/codesErrorNode.d.ts +0 -1
- package/types/logger/codesInfo.d.ts +0 -1
- package/types/logger/codesWarn.d.ts +0 -1
- package/types/logger/codesWarnNode.d.ts +0 -1
- package/types/logger/debugLogger.d.ts +0 -2
- package/types/logger/errorLogger.d.ts +0 -2
- package/types/logger/infoLogger.d.ts +0 -2
- package/types/logger/messages/debugBrowser.d.ts +0 -1
- package/types/logger/messages/debugNode.d.ts +0 -1
- package/types/logger/messages/errorNode.d.ts +0 -1
- package/types/logger/messages/warnNode.d.ts +0 -1
- package/types/logger/noopLogger.d.ts +0 -2
- package/types/logger/warnLogger.d.ts +0 -2
- package/types/sdkManager/sdkManagerMethod.d.ts +0 -6
- package/types/storages/getRegisteredSegments.d.ts +0 -10
- package/types/sync/polling/syncTasks/splitsSyncTask.copy.d.ts +0 -35
- package/types/sync/polling/syncTasks/splitsSyncTask.morelikeoriginal.d.ts +0 -35
- package/types/sync/streaming/AuthClient/indexV1.d.ts +0 -12
- package/types/sync/streaming/AuthClient/indexV2.d.ts +0 -8
- package/types/sync/streaming/pushManagerCS.d.ts +0 -12
- package/types/sync/streaming/pushManagerNoUsers.d.ts +0 -13
- package/types/sync/streaming/pushManagerSS.d.ts +0 -11
- package/types/sync/syncManagerFromFile.d.ts +0 -2
- package/types/sync/syncManagerFromObject.d.ts +0 -2
- package/types/sync/syncManagerOffline.d.ts +0 -9
- package/types/utils/lang/errors.d.ts +0 -10
- package/types/utils/murmur3/commons.d.ts +0 -12
- package/types/utils/settingsValidation/buildMetadata.d.ts +0 -3
- package/types/utils/settingsValidation/localhost/index.d.ts +0 -9
- package/types/utils/settingsValidation/logger.d.ts +0 -11
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
1
|
+
import { allMatcherContext } from './all';
|
|
2
|
+
import { segmentMatcherContext } from './segment';
|
|
3
|
+
import { whitelistMatcherContext } from './whitelist';
|
|
4
|
+
import { equalToMatcherContext } from './eq';
|
|
5
|
+
import { greaterThanEqualMatcherContext } from './gte';
|
|
6
|
+
import { lessThanEqualMatcherContext } from './lte';
|
|
7
|
+
import { betweenMatcherContext } from './between';
|
|
8
|
+
import { equalToSetMatcherContext } from './eq_set';
|
|
9
|
+
import { containsAnySetMatcherContext } from './cont_any';
|
|
10
|
+
import { containsAllSetMatcherContext } from './cont_all';
|
|
11
|
+
import { partOfSetMatcherContext } from './part_of';
|
|
12
|
+
import { endsWithMatcherContext } from './ew';
|
|
13
|
+
import { startsWithMatcherContext } from './sw';
|
|
14
|
+
import { containsStringMatcherContext } from './cont_str';
|
|
15
|
+
import { dependencyMatcherContext } from './dependency';
|
|
16
|
+
import { booleanMatcherContext } from './boolean';
|
|
17
|
+
import { stringMatcherContext } from './string';
|
|
18
18
|
var matchers = [
|
|
19
19
|
undefined,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
20
|
+
allMatcherContext,
|
|
21
|
+
segmentMatcherContext,
|
|
22
|
+
whitelistMatcherContext,
|
|
23
|
+
equalToMatcherContext,
|
|
24
|
+
greaterThanEqualMatcherContext,
|
|
25
|
+
lessThanEqualMatcherContext,
|
|
26
|
+
betweenMatcherContext,
|
|
27
|
+
equalToSetMatcherContext,
|
|
28
|
+
containsAnySetMatcherContext,
|
|
29
|
+
containsAllSetMatcherContext,
|
|
30
|
+
partOfSetMatcherContext,
|
|
31
|
+
endsWithMatcherContext,
|
|
32
|
+
startsWithMatcherContext,
|
|
33
|
+
containsStringMatcherContext,
|
|
34
|
+
dependencyMatcherContext,
|
|
35
|
+
booleanMatcherContext,
|
|
36
|
+
stringMatcherContext // MATCHES_STRING: 17
|
|
37
37
|
];
|
|
38
38
|
/**
|
|
39
39
|
* Matcher factory.
|
|
40
40
|
*/
|
|
41
|
-
export
|
|
41
|
+
export function matcherFactory(log, matcherDto, storage) {
|
|
42
42
|
var type = matcherDto.type, value = matcherDto.value;
|
|
43
43
|
var matcherFn;
|
|
44
44
|
// @ts-ignore
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ENGINE_MATCHER_LESS } from '../../logger/constants';
|
|
2
|
-
export
|
|
2
|
+
export function lessThanEqualMatcherContext(log, ruleAttr) {
|
|
3
3
|
return function lessThanEqualMatcher(runtimeAttr) {
|
|
4
4
|
var isLessEqualThan = runtimeAttr <= ruleAttr;
|
|
5
5
|
log.debug(ENGINE_MATCHER_LESS, [runtimeAttr, ruleAttr, isLessEqualThan]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { findIndex } from '../../utils/lang';
|
|
2
2
|
import { ENGINE_MATCHER_PART_OF } from '../../logger/constants';
|
|
3
|
-
export
|
|
3
|
+
export function partOfSetMatcherContext(log, ruleAttr) {
|
|
4
4
|
return function partOfMatcher(runtimeAttr) {
|
|
5
5
|
// To be part of the length should be minor or equal.
|
|
6
6
|
var isPartOf = runtimeAttr.length <= ruleAttr.length;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import thenable from '../../utils/promise/thenable';
|
|
1
|
+
import { thenable } from '../../utils/promise/thenable';
|
|
2
2
|
import { ENGINE_MATCHER_SEGMENT } from '../../logger/constants';
|
|
3
|
-
export
|
|
3
|
+
export function segmentMatcherContext(log, segmentName, storage) {
|
|
4
4
|
return function segmentMatcher(key) {
|
|
5
5
|
var isInSegment = storage.segments.isInSegment(segmentName, key);
|
|
6
6
|
if (thenable(isInSegment)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ENGINE_MATCHER_STRING_INVALID, ENGINE_MATCHER_STRING } from '../../logger/constants';
|
|
2
|
-
export
|
|
2
|
+
export function stringMatcherContext(log, ruleAttr) {
|
|
3
3
|
return function stringMatcher(runtimeAttr) {
|
|
4
4
|
var re;
|
|
5
5
|
try {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ENGINE_MATCHER_STARTS_WITH } from '../../logger/constants';
|
|
2
2
|
import { startsWith } from '../../utils/lang';
|
|
3
|
-
export
|
|
3
|
+
export function startsWithMatcherContext(log, ruleAttr) {
|
|
4
4
|
return function startsWithMatcher(runtimeAttr) {
|
|
5
5
|
var matches = ruleAttr.some(function (e) { return startsWith(runtimeAttr, e); });
|
|
6
6
|
log.debug(ENGINE_MATCHER_STARTS_WITH, [runtimeAttr, ruleAttr, matches]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { setToArray } from '../../utils/lang/sets';
|
|
2
2
|
import { ENGINE_MATCHER_WHITELIST } from '../../logger/constants';
|
|
3
|
-
export
|
|
3
|
+
export function whitelistMatcherContext(log, ruleAttr) {
|
|
4
4
|
return function whitelistMatcher(runtimeAttr) {
|
|
5
5
|
var isInWhitelist = ruleAttr.has(runtimeAttr);
|
|
6
6
|
log.debug(ENGINE_MATCHER_WHITELIST, [runtimeAttr, setToArray(ruleAttr).join(','), isInWhitelist]);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { findIndex } from '../../utils/lang';
|
|
2
2
|
import { matcherTypes, matcherTypesMapper, matcherDataTypes } from '../matchers/matcherTypes';
|
|
3
|
-
import segmentTransform from './segment';
|
|
4
|
-
import whitelistTransform from './whitelist';
|
|
5
|
-
import setTransform from './set';
|
|
6
|
-
import numericTransform from './unaryNumeric';
|
|
3
|
+
import { segmentTransform } from './segment';
|
|
4
|
+
import { whitelistTransform } from './whitelist';
|
|
5
|
+
import { setTransform } from './set';
|
|
6
|
+
import { numericTransform } from './unaryNumeric';
|
|
7
7
|
import { zeroSinceHH, zeroSinceSS } from '../convertions';
|
|
8
8
|
/**
|
|
9
9
|
* Flat the complex matcherGroup structure into something handy.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export function matchersTransform(matchers) {
|
|
12
12
|
var parsedMatchers = matchers.map(function (matcher) {
|
|
13
13
|
var matcherType = matcher.matcherType /* string */, negate = matcher.negate /* boolean */, keySelector = matcher.keySelector /* keySelectorObject */, segmentObject = matcher.userDefinedSegmentMatcherData /* segmentObject */, whitelistObject = matcher.whitelistMatcherData /* whiteListObject, provided by 'WHITELIST', set and string matchers */, unaryNumericObject = matcher.unaryNumericMatcherData /* unaryNumericObject */, betweenObject = matcher.betweenMatcherData /* betweenObject */, dependencyObject = matcher.dependencyMatcherData /* dependencyObject */, booleanMatcherData = matcher.booleanMatcherData, stringMatcherData = matcher.stringMatcherData;
|
|
14
14
|
var attribute = keySelector && keySelector.attribute;
|
|
@@ -2,6 +2,6 @@ import { _Set } from '../../utils/lang/sets';
|
|
|
2
2
|
/**
|
|
3
3
|
* Extract whitelist as a set. Used by 'WHITELIST' matcher.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export function whitelistTransform(whitelistObject) {
|
|
6
6
|
return new _Set(whitelistObject.whitelist);
|
|
7
7
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import matchersTransform from '../matchersTransform';
|
|
2
|
-
import Treatments from '../treatments';
|
|
3
|
-
import matcherFactory from '../matchers';
|
|
4
|
-
import sanitizeValue from '../value';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import thenable from '../../utils/promise/thenable';
|
|
9
|
-
export
|
|
1
|
+
import { matchersTransform } from '../matchersTransform';
|
|
2
|
+
import { Treatments } from '../treatments';
|
|
3
|
+
import { matcherFactory } from '../matchers';
|
|
4
|
+
import { sanitizeValue } from '../value';
|
|
5
|
+
import { conditionContext } from '../condition';
|
|
6
|
+
import { ifElseIfCombinerContext } from '../combiners/ifelseif';
|
|
7
|
+
import { andCombinerContext } from '../combiners/and';
|
|
8
|
+
import { thenable } from '../../utils/promise/thenable';
|
|
9
|
+
export function parser(log, conditions, storage) {
|
|
10
10
|
var predicates = [];
|
|
11
11
|
for (var i = 0; i < conditions.length; i++) {
|
|
12
12
|
var _a = conditions[i], matcherGroup = _a.matcherGroup, partitions = _a.partitions, label = _a.label, conditionType = _a.conditionType;
|
|
@@ -35,8 +35,8 @@ export default function parser(log, conditions, storage) {
|
|
|
35
35
|
// and break the loop
|
|
36
36
|
break;
|
|
37
37
|
}
|
|
38
|
-
predicates.push(
|
|
38
|
+
predicates.push(conditionContext(log, andCombinerContext(log, expressions), Treatments.parse(partitions), label, conditionType));
|
|
39
39
|
}
|
|
40
40
|
// Instanciate evaluator given the set of conditions using if else if logic
|
|
41
|
-
return
|
|
41
|
+
return ifElseIfCombinerContext(log, predicates);
|
|
42
42
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { sanitize } from './sanitize';
|
|
2
2
|
import { ENGINE_VALUE, ENGINE_VALUE_NO_ATTRIBUTES, ENGINE_VALUE_INVALID } from '../../logger/constants';
|
|
3
3
|
function parseValue(log, key, attributeName, attributes) {
|
|
4
4
|
var value = undefined;
|
|
@@ -19,10 +19,10 @@ function parseValue(log, key, attributeName, attributes) {
|
|
|
19
19
|
/**
|
|
20
20
|
* Defines value to be matched (key / attribute).
|
|
21
21
|
*/
|
|
22
|
-
export
|
|
22
|
+
export function sanitizeValue(log, key, matcherDto, attributes) {
|
|
23
23
|
var attributeName = matcherDto.attribute;
|
|
24
24
|
var valueToMatch = parseValue(log, key, attributeName, attributes);
|
|
25
|
-
var sanitizedValue =
|
|
25
|
+
var sanitizedValue = sanitize(log, matcherDto.type, valueToMatch, matcherDto.dataType, attributes);
|
|
26
26
|
if (sanitizedValue !== undefined) {
|
|
27
27
|
return sanitizedValue;
|
|
28
28
|
}
|
|
@@ -57,7 +57,7 @@ function getProcessingFunction(matcherTypeID, dataType) {
|
|
|
57
57
|
/**
|
|
58
58
|
* Sanitize matcher value
|
|
59
59
|
*/
|
|
60
|
-
export
|
|
60
|
+
export function sanitize(log, matcherTypeID, value, dataType, attributes) {
|
|
61
61
|
var processor = getProcessingFunction(matcherTypeID, dataType);
|
|
62
62
|
var sanitizedValue;
|
|
63
63
|
switch (dataType) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GOOGLE_ANALYTICS_TO_SPLIT, SPLIT_TO_GOOGLE_ANALYTICS } from '../utils/constants/browser';
|
|
2
|
-
import pluggableIntegrationsManagerFactory from './pluggable';
|
|
2
|
+
import { pluggableIntegrationsManagerFactory } from './pluggable';
|
|
3
3
|
import { GoogleAnalyticsToSplit } from './ga/GoogleAnalyticsToSplit';
|
|
4
4
|
import { SplitToGoogleAnalytics } from './ga/SplitToGoogleAnalytics';
|
|
5
5
|
/**
|
|
@@ -11,7 +11,7 @@ import { SplitToGoogleAnalytics } from './ga/SplitToGoogleAnalytics';
|
|
|
11
11
|
*
|
|
12
12
|
* @returns integration manager or undefined if `integrations` are not present in settings.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export function integrationsManagerFactory(integrations, params) {
|
|
15
15
|
// maps integration config items into integration factories to reuse the pluggable integration manager
|
|
16
16
|
var integrationFactories = integrations
|
|
17
17
|
.map(function (integrationOptions) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-undef */
|
|
2
|
-
import objectAssign from '
|
|
2
|
+
import { objectAssign } from '../../utils/lang/objectAssign';
|
|
3
3
|
import { isString, isFiniteNumber, uniqAsStrings } from '../../utils/lang';
|
|
4
4
|
import { validateEvent, validateEventValue, validateEventProperties, validateKey, validateTrafficType, } from '../../utils/inputValidation';
|
|
5
5
|
var logPrefix = 'ga-to-split: ';
|
|
@@ -8,7 +8,7 @@ import { SPLIT_IMPRESSION, SPLIT_EVENT } from '../utils/constants';
|
|
|
8
8
|
*
|
|
9
9
|
* @returns integration manager or undefined if `integrations` are not present in settings.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export function pluggableIntegrationsManagerFactory(integrations, params) {
|
|
12
12
|
var listeners = [];
|
|
13
13
|
// No need to check if `settings.integrations` is an array of functions. It was already validated
|
|
14
14
|
integrations.forEach(function (integrationFactory) {
|
package/esm/listeners/browser.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fromImpressionsCollector } from '../sync/submitters/impressionsSyncTask';
|
|
2
2
|
import { fromImpressionCountsCollector } from '../sync/submitters/impressionCountsSyncTask';
|
|
3
3
|
import { OPTIMIZED, DEBUG } from '../utils/constants';
|
|
4
|
-
import objectAssign from '
|
|
4
|
+
import { objectAssign } from '../utils/lang/objectAssign';
|
|
5
5
|
import { CLEANUP_REGISTERING, CLEANUP_DEREGISTERING } from '../logger/constants';
|
|
6
6
|
// 'unload' event is used instead of 'beforeunload', since 'unload' is not a cancelable event, so no other listeners can stop the event from occurring.
|
|
7
7
|
var UNLOAD_DOM_EVENT = 'unload';
|
|
@@ -95,4 +95,4 @@ var BrowserSignalListener = /** @class */ (function () {
|
|
|
95
95
|
};
|
|
96
96
|
return BrowserSignalListener;
|
|
97
97
|
}());
|
|
98
|
-
export
|
|
98
|
+
export { BrowserSignalListener };
|
package/esm/listeners/node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import thenable from '../utils/promise/thenable';
|
|
1
|
+
import { thenable } from '../utils/promise/thenable';
|
|
2
2
|
import { LOG_PREFIX_CLEANUP, CLEANUP_REGISTERING, CLEANUP_DEREGISTERING } from '../logger/constants';
|
|
3
3
|
var SIGTERM = 'SIGTERM';
|
|
4
4
|
var EVENT_NAME = 'for SIGTERM signal.';
|
|
@@ -62,4 +62,4 @@ var NodeSignalListener = /** @class */ (function () {
|
|
|
62
62
|
};
|
|
63
63
|
return NodeSignalListener;
|
|
64
64
|
}());
|
|
65
|
-
export
|
|
65
|
+
export { NodeSignalListener };
|
package/esm/logger/index.js
CHANGED
|
@@ -21,7 +21,7 @@ export var codesInfo = codesWarn.concat([
|
|
|
21
21
|
[c.SUBMITTERS_PUSH, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Pushing %s %s.'],
|
|
22
22
|
[c.STREAMING_REFRESH_TOKEN, c.LOG_PREFIX_SYNC_STREAMING + 'Refreshing streaming token in %s seconds, and connecting streaming in %s seconds.'],
|
|
23
23
|
[c.STREAMING_RECONNECT, c.LOG_PREFIX_SYNC_STREAMING + 'Attempting to reconnect in %s seconds.'],
|
|
24
|
-
[c.STREAMING_CONNECTING, c.LOG_PREFIX_SYNC_STREAMING + '
|
|
24
|
+
[c.STREAMING_CONNECTING, c.LOG_PREFIX_SYNC_STREAMING + 'Connecting to streaming.'],
|
|
25
25
|
[c.STREAMING_DISABLED, c.LOG_PREFIX_SYNC_STREAMING + 'Streaming is disabled for given Api key. Switching to polling mode.'],
|
|
26
26
|
[c.STREAMING_DISCONNECTING, c.LOG_PREFIX_SYNC_STREAMING + 'Disconnecting from streaming.'],
|
|
27
27
|
[c.SYNC_START_POLLING, c.LOG_PREFIX_SYNC_MANAGER + 'Streaming not available. Starting polling.'],
|
|
@@ -20,9 +20,9 @@ export var codesWarn = codesError.concat([
|
|
|
20
20
|
[c.WARN_TRIMMING_PROPERTIES, '%s: Event has more than 300 properties. Some of them will be trimmed when processed.'],
|
|
21
21
|
[c.WARN_CONVERTING, '%s: %s "%s" is not of type string, converting.'],
|
|
22
22
|
[c.WARN_TRIMMING, '%s: %s "%s" has extra whitespace, trimming.'],
|
|
23
|
-
[c.WARN_NOT_EXISTENT_SPLIT, '%s: split "%s" does not exist in this environment, please double check what splits exist in the web console.'],
|
|
23
|
+
[c.WARN_NOT_EXISTENT_SPLIT, '%s: split "%s" does not exist in this environment, please double check what splits exist in the Split web console.'],
|
|
24
24
|
[c.WARN_LOWERCASE_TRAFFIC_TYPE, '%s: traffic_type_name should be all lowercase - converting string to lowercase.'],
|
|
25
|
-
[c.WARN_NOT_EXISTENT_TT, '%s: traffic type "%s" does not have any corresponding split in this environment, make sure you\'re tracking your events to a valid traffic type defined in the web console.'],
|
|
25
|
+
[c.WARN_NOT_EXISTENT_TT, '%s: traffic type "%s" does not have any corresponding split in this environment, make sure you\'re tracking your events to a valid traffic type defined in the Split web console.'],
|
|
26
26
|
// initialization / settings validation
|
|
27
27
|
[c.WARN_INTEGRATION_INVALID, c.LOG_PREFIX_SETTINGS + ': %s integration item(s) at settings is invalid. %s'],
|
|
28
28
|
[c.WARN_SPLITS_FILTER_IGNORED, c.LOG_PREFIX_SETTINGS + ': split filters have been configured but will have no effect if mode is not "%s", since synchronization is being deferred to an external tool.'],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import objectAssign from '
|
|
1
|
+
import { objectAssign } from '../utils/lang/objectAssign';
|
|
2
2
|
import { SDK_SPLITS_ARRIVED, SDK_SPLITS_CACHE_LOADED, SDK_SEGMENTS_ARRIVED, SDK_READY_TIMED_OUT, SDK_READY_FROM_CACHE, SDK_UPDATE, SDK_READY } from './constants';
|
|
3
3
|
function splitsEventEmitterFactory(EventEmitter) {
|
|
4
4
|
var splitsEventEmitter = objectAssign(new EventEmitter(), {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import objectAssign from '
|
|
2
|
-
import promiseWrapper from '../utils/promise/wrapper';
|
|
1
|
+
import { objectAssign } from '../utils/lang/objectAssign';
|
|
2
|
+
import { promiseWrapper } from '../utils/promise/wrapper';
|
|
3
3
|
import { readinessManagerFactory } from './readinessManager';
|
|
4
4
|
import { SDK_READY, SDK_READY_TIMED_OUT, SDK_READY_FROM_CACHE, SDK_UPDATE } from './constants';
|
|
5
5
|
import { ERROR_CLIENT_LISTENER, CLIENT_READY_FROM_CACHE, CLIENT_READY, CLIENT_NO_LISTENER } from '../logger/constants';
|
|
@@ -14,7 +14,7 @@ var REMOVE_LISTENER_EVENT = 'removeListener';
|
|
|
14
14
|
* by the SDK. It is required to properly log the warning 'No listeners for SDK Readiness detected'
|
|
15
15
|
* @param readinessManager optional readinessManager to use. only used internally for `shared` method
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export function sdkReadinessManagerFactory(log, EventEmitter, readyTimeout, internalReadyCbCount, readinessManager) {
|
|
18
18
|
if (readyTimeout === void 0) { readyTimeout = 0; }
|
|
19
19
|
if (internalReadyCbCount === void 0) { internalReadyCbCount = 0; }
|
|
20
20
|
if (readinessManager === void 0) { readinessManager = readinessManagerFactory(EventEmitter, readyTimeout); }
|
package/esm/sdkClient/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { evaluateFeature, evaluateFeatures } from '../evaluator';
|
|
2
|
-
import thenable from '../utils/promise/thenable';
|
|
2
|
+
import { thenable } from '../utils/promise/thenable';
|
|
3
3
|
import { getMatching, getBucketing } from '../utils/key';
|
|
4
4
|
import { validateSplitExistance } from '../utils/inputValidation/splitExistance';
|
|
5
5
|
import { validateTrafficTypeExistance } from '../utils/inputValidation/trafficTypeExistance';
|
|
@@ -10,7 +10,7 @@ import { IMPRESSION, IMPRESSION_QUEUEING } from '../logger/constants';
|
|
|
10
10
|
* Creator of base client with getTreatments and track methods.
|
|
11
11
|
*/
|
|
12
12
|
// @TODO missing time tracking to collect telemetry
|
|
13
|
-
export
|
|
13
|
+
export function clientFactory(params) {
|
|
14
14
|
var readinessManager = params.sdkReadinessManager.readinessManager, storage = params.storage, _a = params.settings, log = _a.log, mode = _a.mode, impressionsTracker = params.impressionsTracker, eventTracker = params.eventTracker;
|
|
15
15
|
function getTreatment(key, splitName, attributes, withConfig) {
|
|
16
16
|
if (withConfig === void 0) { withConfig = false; }
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { AttributesCacheInMemory } from '../storages/inMemory/AttributesCacheInMemory';
|
|
2
|
+
import { validateAttributesDeep } from '../utils/inputValidation/attributes';
|
|
3
|
+
import { objectAssign } from '../utils/lang/objectAssign';
|
|
4
|
+
/**
|
|
5
|
+
* Add in memory attributes storage methods and combine them with any attribute received from the getTreatment/s call
|
|
6
|
+
*/
|
|
7
|
+
export function clientAttributesDecoration(log, client) {
|
|
8
|
+
var attributeStorage = new AttributesCacheInMemory();
|
|
9
|
+
// Keep a reference to the original methods
|
|
10
|
+
var clientGetTreatment = client.getTreatment;
|
|
11
|
+
var clientGetTreatmentWithConfig = client.getTreatmentWithConfig;
|
|
12
|
+
var clientGetTreatments = client.getTreatments;
|
|
13
|
+
var clientGetTreatmentsWithConfig = client.getTreatmentsWithConfig;
|
|
14
|
+
var clientTrack = client.track;
|
|
15
|
+
function getTreatment(maybeKey, maybeSplit, maybeAttributes) {
|
|
16
|
+
return clientGetTreatment(maybeKey, maybeSplit, combineAttributes(maybeAttributes));
|
|
17
|
+
}
|
|
18
|
+
function getTreatmentWithConfig(maybeKey, maybeSplit, maybeAttributes) {
|
|
19
|
+
return clientGetTreatmentWithConfig(maybeKey, maybeSplit, combineAttributes(maybeAttributes));
|
|
20
|
+
}
|
|
21
|
+
function getTreatments(maybeKey, maybeSplits, maybeAttributes) {
|
|
22
|
+
return clientGetTreatments(maybeKey, maybeSplits, combineAttributes(maybeAttributes));
|
|
23
|
+
}
|
|
24
|
+
function getTreatmentsWithConfig(maybeKey, maybeSplits, maybeAttributes) {
|
|
25
|
+
return clientGetTreatmentsWithConfig(maybeKey, maybeSplits, combineAttributes(maybeAttributes));
|
|
26
|
+
}
|
|
27
|
+
function track(maybeKey, maybeTT, maybeEvent, maybeEventValue, maybeProperties) {
|
|
28
|
+
return clientTrack(maybeKey, maybeTT, maybeEvent, maybeEventValue, maybeProperties);
|
|
29
|
+
}
|
|
30
|
+
function combineAttributes(maybeAttributes) {
|
|
31
|
+
var storedAttributes = attributeStorage.getAll();
|
|
32
|
+
if (Object.keys(storedAttributes).length > 0) {
|
|
33
|
+
return objectAssign({}, storedAttributes, maybeAttributes);
|
|
34
|
+
}
|
|
35
|
+
return maybeAttributes;
|
|
36
|
+
}
|
|
37
|
+
return objectAssign(client, {
|
|
38
|
+
getTreatment: getTreatment,
|
|
39
|
+
getTreatmentWithConfig: getTreatmentWithConfig,
|
|
40
|
+
getTreatments: getTreatments,
|
|
41
|
+
getTreatmentsWithConfig: getTreatmentsWithConfig,
|
|
42
|
+
track: track,
|
|
43
|
+
/**
|
|
44
|
+
* Add an attribute to client's in memory attributes storage
|
|
45
|
+
*
|
|
46
|
+
* @param {string} attributeName Attrinute name
|
|
47
|
+
* @param {string, number, boolean, list} attributeValue Attribute value
|
|
48
|
+
* @returns {boolean} true if the attribute was stored and false otherways
|
|
49
|
+
*/
|
|
50
|
+
setAttribute: function (attributeName, attributeValue) {
|
|
51
|
+
var attribute = {};
|
|
52
|
+
attribute[attributeName] = attributeValue;
|
|
53
|
+
if (!validateAttributesDeep(log, attribute, 'setAttribute'))
|
|
54
|
+
return false;
|
|
55
|
+
log.debug("stored " + attributeValue + " for attribute " + attributeName);
|
|
56
|
+
return attributeStorage.setAttribute(attributeName, attributeValue);
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* Returns the attribute with the given key
|
|
60
|
+
*
|
|
61
|
+
* @param {string} attributeName Attribute name
|
|
62
|
+
* @returns {Object} Attribute with the given key
|
|
63
|
+
*/
|
|
64
|
+
getAttribute: function (attributeName) {
|
|
65
|
+
log.debug("retrieved attribute " + attributeName);
|
|
66
|
+
return attributeStorage.getAttribute(attributeName + '');
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* Add to client's in memory attributes storage the attributes in 'attributes'
|
|
70
|
+
*
|
|
71
|
+
* @param {Object} attributes Object with attributes to store
|
|
72
|
+
* @returns true if attributes were stored an false otherways
|
|
73
|
+
*/
|
|
74
|
+
setAttributes: function (attributes) {
|
|
75
|
+
if (!validateAttributesDeep(log, attributes, 'setAttributes'))
|
|
76
|
+
return false;
|
|
77
|
+
return attributeStorage.setAttributes(attributes);
|
|
78
|
+
},
|
|
79
|
+
/**
|
|
80
|
+
* Return all the attributes stored in client's in memory attributes storage
|
|
81
|
+
*
|
|
82
|
+
* @returns {Object} returns all the stored attributes
|
|
83
|
+
*/
|
|
84
|
+
getAttributes: function () {
|
|
85
|
+
return attributeStorage.getAll();
|
|
86
|
+
},
|
|
87
|
+
/**
|
|
88
|
+
* Removes from client's in memory attributes storage the attribute with the given key
|
|
89
|
+
*
|
|
90
|
+
* @param {string} attributeName
|
|
91
|
+
* @returns {boolean} true if attribute was removed and false otherways
|
|
92
|
+
*/
|
|
93
|
+
removeAttribute: function (attributeName) {
|
|
94
|
+
log.debug("removed attribute " + attributeName);
|
|
95
|
+
return attributeStorage.removeAttribute(attributeName + '');
|
|
96
|
+
},
|
|
97
|
+
/**
|
|
98
|
+
* Remove all the stored attributes in the client's in memory attribute storage
|
|
99
|
+
*/
|
|
100
|
+
clearAttributes: function () {
|
|
101
|
+
return attributeStorage.clear();
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import objectAssign from '
|
|
1
|
+
import { objectAssign } from '../utils/lang/objectAssign';
|
|
2
|
+
import { clientAttributesDecoration } from './clientAttributesDecoration';
|
|
2
3
|
/**
|
|
3
4
|
* Decorator that binds a key and (optionally) a traffic type to client methods
|
|
4
5
|
*
|
|
@@ -6,14 +7,15 @@ import objectAssign from 'object-assign';
|
|
|
6
7
|
* @param key validated split key
|
|
7
8
|
* @param trafficType validated traffic type
|
|
8
9
|
*/
|
|
9
|
-
export
|
|
10
|
-
|
|
10
|
+
export function clientCSDecorator(log, client, key, trafficType) {
|
|
11
|
+
var clientCS = clientAttributesDecoration(log, client);
|
|
12
|
+
return objectAssign(clientCS, {
|
|
11
13
|
// In the client-side API, we bind a key to the client `getTreatment*` methods
|
|
12
|
-
getTreatment:
|
|
13
|
-
getTreatmentWithConfig:
|
|
14
|
-
getTreatments:
|
|
15
|
-
getTreatmentsWithConfig:
|
|
14
|
+
getTreatment: clientCS.getTreatment.bind(clientCS, key),
|
|
15
|
+
getTreatmentWithConfig: clientCS.getTreatmentWithConfig.bind(clientCS, key),
|
|
16
|
+
getTreatments: clientCS.getTreatments.bind(clientCS, key),
|
|
17
|
+
getTreatmentsWithConfig: clientCS.getTreatmentsWithConfig.bind(clientCS, key),
|
|
16
18
|
// Key is bound to the `track` method. Same thing happens with trafficType but only if provided
|
|
17
|
-
track: trafficType ?
|
|
19
|
+
track: trafficType ? clientCS.track.bind(clientCS, key, trafficType) : clientCS.track.bind(clientCS, key)
|
|
18
20
|
});
|
|
19
21
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import objectAssign from '
|
|
1
|
+
import { objectAssign } from '../utils/lang/objectAssign';
|
|
2
2
|
import { validateAttributes, validateEvent, validateEventValue, validateEventProperties, validateKey, validateSplit, validateSplits, validateTrafficType, validateIfNotDestroyed, validateIfOperational } from '../utils/inputValidation';
|
|
3
3
|
import { startsWith } from '../utils/lang';
|
|
4
4
|
import { CONTROL, CONTROL_WITH_CONFIG } from '../utils/constants';
|
|
@@ -6,7 +6,7 @@ import { CONTROL, CONTROL_WITH_CONFIG } from '../utils/constants';
|
|
|
6
6
|
* Decorator that validates the input before actually executing the client methods.
|
|
7
7
|
* We should "guard" the client here, while not polluting the "real" implementation of those methods.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export function clientInputValidationDecorator(log, client, readinessManager, isStorageSync) {
|
|
10
10
|
if (isStorageSync === void 0) { isStorageSync = false; }
|
|
11
11
|
/**
|
|
12
12
|
* Avoid repeating this validations code
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import objectAssign from '
|
|
1
|
+
import { objectAssign } from '../utils/lang/objectAssign';
|
|
2
2
|
import { CONSUMER_MODE, CONSUMER_PARTIAL_MODE } from '../utils/constants';
|
|
3
3
|
import { releaseApiKey } from '../utils/inputValidation/apiKey';
|
|
4
|
-
import clientFactory from './client';
|
|
5
|
-
import clientInputValidationDecorator from './clientInputValidation';
|
|
4
|
+
import { clientFactory } from './client';
|
|
5
|
+
import { clientInputValidationDecorator } from './clientInputValidation';
|
|
6
6
|
/**
|
|
7
7
|
* Creates an Sdk client, i.e., a base client with status and destroy interface
|
|
8
8
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import clientCSDecorator from './clientCS';
|
|
1
|
+
import { clientCSDecorator } from './clientCS';
|
|
2
2
|
import { validateKey } from '../utils/inputValidation/key';
|
|
3
3
|
import { getMatching, keyParser } from '../utils/key';
|
|
4
4
|
import { sdkClientFactory } from './sdkClient';
|
|
5
|
-
import objectAssign from '
|
|
5
|
+
import { objectAssign } from '../utils/lang/objectAssign';
|
|
6
6
|
import { RETRIEVE_CLIENT_DEFAULT, NEW_SHARED_CLIENT, RETRIEVE_CLIENT_EXISTING } from '../logger/constants';
|
|
7
7
|
import { SDK_SEGMENTS_ARRIVED } from '../readiness/constants';
|
|
8
8
|
function buildInstanceId(key) {
|
|
@@ -20,7 +20,7 @@ export function sdkClientMethodCSFactory(params) {
|
|
|
20
20
|
// `false` value is used as binded key of the default client, but trafficType is ignored
|
|
21
21
|
// @TODO handle as a non-recoverable error
|
|
22
22
|
var validKey = validateKey(log, key, method);
|
|
23
|
-
var mainClientInstance = clientCSDecorator(sdkClientFactory(params), // @ts-ignore
|
|
23
|
+
var mainClientInstance = clientCSDecorator(log, sdkClientFactory(params), // @ts-ignore
|
|
24
24
|
validKey);
|
|
25
25
|
var parsedDefaultKey = keyParser(key);
|
|
26
26
|
var defaultInstanceId = buildInstanceId(parsedDefaultKey);
|
|
@@ -55,7 +55,7 @@ export function sdkClientMethodCSFactory(params) {
|
|
|
55
55
|
var sharedSyncManager = syncManager && sharedStorage && syncManager.shared(matchingKey, sharedSdkReadiness_1.readinessManager, sharedStorage);
|
|
56
56
|
// As shared clients reuse all the storage information, we don't need to check here if we
|
|
57
57
|
// will use offline or online mode. We should stick with the original decision.
|
|
58
|
-
clientInstances[instanceId] = clientCSDecorator(sdkClientFactory(objectAssign({}, params, {
|
|
58
|
+
clientInstances[instanceId] = clientCSDecorator(log, sdkClientFactory(objectAssign({}, params, {
|
|
59
59
|
sdkReadinessManager: sharedSdkReadiness_1,
|
|
60
60
|
storage: sharedStorage || storage,
|
|
61
61
|
syncManager: sharedSyncManager,
|