@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
package/cjs/utils/MinEvents.js
CHANGED
|
@@ -31,33 +31,31 @@
|
|
|
31
31
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
32
32
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
33
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
exports.EventEmitter = void 0;
|
|
34
35
|
var R = typeof Reflect === 'object' ? Reflect : null;
|
|
35
36
|
var ReflectApply = R && typeof R.apply === 'function'
|
|
36
37
|
? R.apply
|
|
37
38
|
: function ReflectApply(target, receiver, args) {
|
|
38
39
|
return Function.prototype.apply.call(target, receiver, args);
|
|
39
40
|
};
|
|
40
|
-
function EventEmitter() {
|
|
41
|
+
exports.EventEmitter = function EventEmitter() {
|
|
41
42
|
EventEmitter.init.call(this);
|
|
42
|
-
}
|
|
43
|
-
exports.
|
|
44
|
-
|
|
45
|
-
EventEmitter.EventEmitter = EventEmitter;
|
|
46
|
-
EventEmitter.prototype._events = undefined;
|
|
47
|
-
EventEmitter.prototype._eventsCount = 0;
|
|
43
|
+
};
|
|
44
|
+
exports.EventEmitter.prototype._events = undefined;
|
|
45
|
+
exports.EventEmitter.prototype._eventsCount = 0;
|
|
48
46
|
function checkListener(listener) {
|
|
49
47
|
if (typeof listener !== 'function') {
|
|
50
48
|
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
|
-
EventEmitter.init = function () {
|
|
51
|
+
exports.EventEmitter.init = function () {
|
|
54
52
|
if (this._events === undefined ||
|
|
55
53
|
this._events === Object.getPrototypeOf(this)._events) {
|
|
56
54
|
this._events = Object.create(null);
|
|
57
55
|
this._eventsCount = 0;
|
|
58
56
|
}
|
|
59
57
|
};
|
|
60
|
-
EventEmitter.prototype.emit = function emit(type) {
|
|
58
|
+
exports.EventEmitter.prototype.emit = function emit(type) {
|
|
61
59
|
var args = [];
|
|
62
60
|
for (var i = 1; i < arguments.length; i++)
|
|
63
61
|
args.push(arguments[i]);
|
|
@@ -137,10 +135,10 @@ function _addListener(target, type, listener, prepend) {
|
|
|
137
135
|
}
|
|
138
136
|
return target;
|
|
139
137
|
}
|
|
140
|
-
EventEmitter.prototype.addListener = function addListener(type, listener) {
|
|
138
|
+
exports.EventEmitter.prototype.addListener = function addListener(type, listener) {
|
|
141
139
|
return _addListener(this, type, listener, false);
|
|
142
140
|
};
|
|
143
|
-
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
|
141
|
+
exports.EventEmitter.prototype.on = exports.EventEmitter.prototype.addListener;
|
|
144
142
|
function onceWrapper() {
|
|
145
143
|
if (!this.fired) {
|
|
146
144
|
this.target.removeListener(this.type, this.wrapFn);
|
|
@@ -157,13 +155,13 @@ function _onceWrap(target, type, listener) {
|
|
|
157
155
|
state.wrapFn = wrapped;
|
|
158
156
|
return wrapped;
|
|
159
157
|
}
|
|
160
|
-
EventEmitter.prototype.once = function once(type, listener) {
|
|
158
|
+
exports.EventEmitter.prototype.once = function once(type, listener) {
|
|
161
159
|
checkListener(listener);
|
|
162
160
|
this.on(type, _onceWrap(this, type, listener));
|
|
163
161
|
return this;
|
|
164
162
|
};
|
|
165
163
|
// Emits a 'removeListener' event if and only if the listener was removed.
|
|
166
|
-
EventEmitter.prototype.removeListener =
|
|
164
|
+
exports.EventEmitter.prototype.removeListener =
|
|
167
165
|
function removeListener(type, listener) {
|
|
168
166
|
var list, events, position, i, originalListener;
|
|
169
167
|
checkListener(listener);
|
|
@@ -205,8 +203,8 @@ EventEmitter.prototype.removeListener =
|
|
|
205
203
|
}
|
|
206
204
|
return this;
|
|
207
205
|
};
|
|
208
|
-
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
209
|
-
EventEmitter.prototype.removeAllListeners =
|
|
206
|
+
exports.EventEmitter.prototype.off = exports.EventEmitter.prototype.removeListener;
|
|
207
|
+
exports.EventEmitter.prototype.removeAllListeners =
|
|
210
208
|
function removeAllListeners(type) {
|
|
211
209
|
var listeners, events, i;
|
|
212
210
|
events = this._events;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateAttribute = void 0;
|
|
4
|
+
var lang_1 = require("../../utils/lang");
|
|
5
|
+
function validateAttribute(log, attributeKey, attributeValue, method) {
|
|
6
|
+
if (!lang_1.isString(attributeKey) || attributeKey.length === 0) {
|
|
7
|
+
log.warn(method + ": you passed an invalid attribute name, attribute name must be a non-empty string.");
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
var isStringVal = lang_1.isString(attributeValue);
|
|
11
|
+
var isFiniteVal = lang_1.isFiniteNumber(attributeValue);
|
|
12
|
+
var isBoolVal = lang_1.isBoolean(attributeValue);
|
|
13
|
+
var isArrayVal = Array.isArray(attributeValue);
|
|
14
|
+
if (!(isStringVal || isFiniteVal || isBoolVal || isArrayVal)) { // If it's not of valid type.
|
|
15
|
+
log.warn(method + ": you passed an invalid attribute value for " + attributeKey + ". Acceptable types are: string, number, boolean and array of strings.");
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
exports.validateAttribute = validateAttribute;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateAttributes = void 0;
|
|
3
|
+
exports.validateAttributesDeep = exports.validateAttributes = void 0;
|
|
4
4
|
var lang_1 = require("../lang");
|
|
5
|
+
var attribute_1 = require("./attribute");
|
|
5
6
|
var constants_1 = require("../../logger/constants");
|
|
6
7
|
function validateAttributes(log, maybeAttrs, method) {
|
|
7
8
|
// Attributes are optional
|
|
@@ -11,3 +12,14 @@ function validateAttributes(log, maybeAttrs, method) {
|
|
|
11
12
|
return false;
|
|
12
13
|
}
|
|
13
14
|
exports.validateAttributes = validateAttributes;
|
|
15
|
+
function validateAttributesDeep(log, maybeAttributes, method) {
|
|
16
|
+
if (!validateAttributes(log, maybeAttributes, method))
|
|
17
|
+
return false;
|
|
18
|
+
var result = true;
|
|
19
|
+
Object.keys(maybeAttributes).forEach(function (attributeKey) {
|
|
20
|
+
if (!attribute_1.validateAttribute(log, attributeKey, maybeAttributes[attributeKey], method))
|
|
21
|
+
result = false;
|
|
22
|
+
});
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
exports.validateAttributesDeep = validateAttributesDeep;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateTrafficTypeExistance = void 0;
|
|
4
|
-
var
|
|
5
|
-
var thenable_1 = tslib_1.__importDefault(require("../promise/thenable"));
|
|
4
|
+
var thenable_1 = require("../promise/thenable");
|
|
6
5
|
var constants_1 = require("../constants");
|
|
7
6
|
var constants_2 = require("../../logger/constants");
|
|
8
7
|
function logTTExistanceWarning(log, maybeTT, method) {
|
|
@@ -16,7 +15,7 @@ function validateTrafficTypeExistance(log, readinessManager, splitsCache, mode,
|
|
|
16
15
|
if (!readinessManager.isReady() || mode === constants_1.LOCALHOST_MODE)
|
|
17
16
|
return true;
|
|
18
17
|
var res = splitsCache.trafficTypeExists(maybeTT); // never rejects or throws error
|
|
19
|
-
if (thenable_1.
|
|
18
|
+
if (thenable_1.thenable(res)) {
|
|
20
19
|
return res.then(function (isValid) {
|
|
21
20
|
if (!isValid)
|
|
22
21
|
logTTExistanceWarning(log, maybeTT, method);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.binarySearch = void 0;
|
|
3
4
|
/**
|
|
4
5
|
* Searches the index of the specified `value` inside an ordered array of `items` using the binary search algorithm.
|
|
5
6
|
*
|
|
@@ -38,4 +39,4 @@ function binarySearch(items, value) {
|
|
|
38
39
|
}
|
|
39
40
|
return middle;
|
|
40
41
|
}
|
|
41
|
-
exports.
|
|
42
|
+
exports.binarySearch = binarySearch;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Adaptation of "object-assign" library (https://www.npmjs.com/package/object-assign)
|
|
4
|
+
exported as an ES module instead of CommonJS, to avoid extra configuration steps when using
|
|
5
|
+
the ESM build of the SDK with tools that doesn't support CommonJS by default (e.g. Rollup).
|
|
6
|
+
|
|
7
|
+
object-assign
|
|
8
|
+
(c) Sindre Sorhus
|
|
9
|
+
@license MIT
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.objectAssign = void 0;
|
|
13
|
+
/* eslint-disable */
|
|
14
|
+
// @ts-nocheck
|
|
15
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
16
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
17
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
18
|
+
function toObject(val) {
|
|
19
|
+
if (val === null || val === undefined) {
|
|
20
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
21
|
+
}
|
|
22
|
+
return Object(val);
|
|
23
|
+
}
|
|
24
|
+
function shouldUseNative() {
|
|
25
|
+
try {
|
|
26
|
+
if (!Object.assign) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
// Detect buggy property enumeration order in older V8 versions.
|
|
30
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
31
|
+
var test1 = new String('abc');
|
|
32
|
+
test1[5] = 'de';
|
|
33
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
37
|
+
var test2 = {};
|
|
38
|
+
for (var i = 0; i < 10; i++) {
|
|
39
|
+
test2['_' + String.fromCharCode(i)] = i;
|
|
40
|
+
}
|
|
41
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
42
|
+
return test2[n];
|
|
43
|
+
});
|
|
44
|
+
if (order2.join('') !== '0123456789') {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
48
|
+
var test3 = {};
|
|
49
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
50
|
+
test3[letter] = letter;
|
|
51
|
+
});
|
|
52
|
+
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
53
|
+
'abcdefghijklmnopqrst') {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
// We don't expect any of the above to throw, but better to be safe.
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
64
|
+
var from;
|
|
65
|
+
var to = toObject(target);
|
|
66
|
+
var symbols;
|
|
67
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
68
|
+
from = Object(arguments[s]);
|
|
69
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
70
|
+
for (var key in from) {
|
|
71
|
+
if (hasOwnProperty.call(from, key)) {
|
|
72
|
+
to[key] = from[key];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (getOwnPropertySymbols) {
|
|
76
|
+
symbols = getOwnPropertySymbols(from);
|
|
77
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
78
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
79
|
+
to[symbols[i]] = from[symbols[i]];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return to;
|
|
85
|
+
};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.thenable = void 0;
|
|
3
4
|
// returns true if the given value is a thenable object
|
|
4
|
-
|
|
5
|
+
function thenable(o) {
|
|
6
|
+
return o !== undefined && o !== null && typeof o.then === 'function';
|
|
7
|
+
}
|
|
8
|
+
exports.thenable = thenable;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.timeout = void 0;
|
|
3
4
|
function timeout(ms, promise) {
|
|
4
5
|
if (ms < 1)
|
|
5
6
|
return promise;
|
|
@@ -16,4 +17,4 @@ function timeout(ms, promise) {
|
|
|
16
17
|
});
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
|
-
exports.
|
|
20
|
+
exports.timeout = timeout;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.promiseWrapper = void 0;
|
|
3
4
|
/**
|
|
4
5
|
* wraps a given promise in a new one with a default onRejected function,
|
|
5
6
|
* that handles the promise rejection if not other onRejected handler is provided.
|
|
@@ -54,4 +55,4 @@ function promiseWrapper(customPromise, defaultOnRejected) {
|
|
|
54
55
|
result.hasOnFulfilled = function () { return hasOnFulfilled; };
|
|
55
56
|
return result;
|
|
56
57
|
}
|
|
57
|
-
exports.
|
|
58
|
+
exports.promiseWrapper = promiseWrapper;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validImpressionsMode = void 0;
|
|
3
4
|
var constants_1 = require("../../logger/constants");
|
|
4
5
|
var constants_2 = require("../constants");
|
|
5
6
|
function validImpressionsMode(log, impressionsMode) {
|
|
@@ -10,4 +11,4 @@ function validImpressionsMode(log, impressionsMode) {
|
|
|
10
11
|
}
|
|
11
12
|
return impressionsMode;
|
|
12
13
|
}
|
|
13
|
-
exports.
|
|
14
|
+
exports.validImpressionsMode = validImpressionsMode;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.settingsValidation = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
4
|
var lang_1 = require("../lang");
|
|
6
|
-
var mode_1 =
|
|
5
|
+
var mode_1 = require("./mode");
|
|
7
6
|
var splitFilters_1 = require("./splitFilters");
|
|
8
7
|
var constants_1 = require("../constants");
|
|
9
|
-
var impressionsMode_1 =
|
|
8
|
+
var impressionsMode_1 = require("./impressionsMode");
|
|
10
9
|
var base = {
|
|
11
10
|
// Define which kind of object you want to retrieve from SplitFactory
|
|
12
11
|
mode: constants_1.STANDALONE_MODE,
|
|
@@ -104,10 +103,10 @@ function settingsValidation(config, validationParams) {
|
|
|
104
103
|
// Startup periods
|
|
105
104
|
startup.requestTimeoutBeforeReady = fromSecondsToMillis(startup.requestTimeoutBeforeReady);
|
|
106
105
|
startup.readyTimeout = fromSecondsToMillis(startup.readyTimeout);
|
|
107
|
-
startup.eventsFirstPushWindow = fromSecondsToMillis(
|
|
106
|
+
startup.eventsFirstPushWindow = fromSecondsToMillis(startup.eventsFirstPushWindow);
|
|
108
107
|
// ensure a valid SDK mode
|
|
109
108
|
// @ts-ignore, modify readonly prop
|
|
110
|
-
withDefaults.mode = mode_1.
|
|
109
|
+
withDefaults.mode = mode_1.mode(withDefaults.core.authorizationKey, withDefaults.mode);
|
|
111
110
|
// ensure a valid Storage based on mode defined.
|
|
112
111
|
// @ts-ignore, modify readonly prop
|
|
113
112
|
if (storage)
|
|
@@ -139,7 +138,7 @@ function settingsValidation(config, validationParams) {
|
|
|
139
138
|
withDefaults.sync.splitFilters = splitFiltersValidation.validFilters;
|
|
140
139
|
withDefaults.sync.__splitFiltersValidation = splitFiltersValidation;
|
|
141
140
|
// ensure a valid impressionsMode
|
|
142
|
-
withDefaults.sync.impressionsMode = impressionsMode_1.
|
|
141
|
+
withDefaults.sync.impressionsMode = impressionsMode_1.validImpressionsMode(log, withDefaults.sync.impressionsMode);
|
|
143
142
|
return withDefaults;
|
|
144
143
|
}
|
|
145
144
|
exports.settingsValidation = settingsValidation;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mode = void 0;
|
|
3
4
|
var constants_1 = require("../constants");
|
|
4
5
|
function mode(key, mode) {
|
|
5
6
|
// Leaving the comparison as is, in case we change the mode name but not the setting.
|
|
@@ -9,4 +10,4 @@ function mode(key, mode) {
|
|
|
9
10
|
throw Error('Invalid mode provided');
|
|
10
11
|
return mode;
|
|
11
12
|
}
|
|
12
|
-
exports.
|
|
13
|
+
exports.mode = mode;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
|
|
4
|
+
exports.TrackerAPI = void 0;
|
|
5
5
|
var lang_1 = require("../lang");
|
|
6
|
-
var timer_1 =
|
|
7
|
-
var thenable_1 =
|
|
6
|
+
var timer_1 = require("./timer");
|
|
7
|
+
var thenable_1 = require("../promise/thenable");
|
|
8
8
|
// Map we will use for storing timers data
|
|
9
9
|
var timers = {};
|
|
10
10
|
// Tasks constants
|
|
@@ -89,7 +89,8 @@ function getCallbackForTask(task, collector) {
|
|
|
89
89
|
return collector[callbackData.method];
|
|
90
90
|
return false;
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
// Our "time tracker" API
|
|
93
|
+
exports.TrackerAPI = {
|
|
93
94
|
/**
|
|
94
95
|
* "Private" method, used to attach count/countException and stop callbacks to a promise.
|
|
95
96
|
*
|
|
@@ -129,7 +130,7 @@ var TrackerAPI = {
|
|
|
129
130
|
var result;
|
|
130
131
|
// If we are registering a promise with this task, we should count the status and the exceptions as well
|
|
131
132
|
// as stopping the task when the promise resolves. Then return the promise
|
|
132
|
-
if (thenable_1.
|
|
133
|
+
if (thenable_1.thenable(promise)) {
|
|
133
134
|
result = this.__attachToPromise(log, promise, task, taskCollector, taskUniqueId);
|
|
134
135
|
}
|
|
135
136
|
else {
|
|
@@ -146,7 +147,7 @@ var TrackerAPI = {
|
|
|
146
147
|
var cb = getCallbackForTask(task, taskCollector);
|
|
147
148
|
timers[trackingKey] = {
|
|
148
149
|
cb: cb,
|
|
149
|
-
timer: timer_1.
|
|
150
|
+
timer: timer_1.timer(now)
|
|
150
151
|
};
|
|
151
152
|
return result;
|
|
152
153
|
},
|
|
@@ -193,5 +194,3 @@ var TrackerAPI = {
|
|
|
193
194
|
*/
|
|
194
195
|
TaskNames: CONSTANTS
|
|
195
196
|
};
|
|
196
|
-
// Our "time tracker" API
|
|
197
|
-
exports.default = TrackerAPI;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.now = void 0;
|
|
3
4
|
// @TODO migrate to Browser SDK package eventually
|
|
4
5
|
function nowFactory() {
|
|
5
6
|
// eslint-disable-next-line
|
|
@@ -11,5 +12,4 @@ function nowFactory() {
|
|
|
11
12
|
return Date.now;
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
exports.default = now;
|
|
15
|
+
exports.now = nowFactory();
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.now = void 0;
|
|
3
4
|
// @TODO migrate to Node SDK package eventually
|
|
4
5
|
function now() {
|
|
5
6
|
// eslint-disable-next-line no-undef
|
|
6
7
|
var time = process.hrtime();
|
|
7
8
|
return time[0] * 1e3 + time[1] * 1e-6; // convert it to milis
|
|
8
9
|
}
|
|
9
|
-
exports.
|
|
10
|
+
exports.now = now;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.timer = void 0;
|
|
4
|
+
function timer(now) {
|
|
4
5
|
var st = now ? now() : Date.now();
|
|
5
6
|
return function stop() {
|
|
6
7
|
return Math.round(now ? now() : Date.now() - st);
|
|
7
8
|
};
|
|
8
9
|
}
|
|
9
|
-
exports.
|
|
10
|
+
exports.timer = timer;
|
package/esm/evaluator/Engine.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { get } from '../utils/lang';
|
|
2
|
-
import parser from './parser';
|
|
2
|
+
import { parser } from './parser';
|
|
3
3
|
import { keyParser } from '../utils/key';
|
|
4
|
-
import thenable from '../utils/promise/thenable';
|
|
4
|
+
import { thenable } from '../utils/promise/thenable';
|
|
5
5
|
import * as LabelsConstants from '../utils/labels';
|
|
6
6
|
import { CONTROL } from '../utils/constants';
|
|
7
7
|
function evaluationResult(result, defaultTreatment) {
|
|
@@ -73,4 +73,4 @@ var Engine = /** @class */ (function () {
|
|
|
73
73
|
};
|
|
74
74
|
return Engine;
|
|
75
75
|
}());
|
|
76
|
-
export
|
|
76
|
+
export { Engine };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { findIndex } from '../../utils/lang';
|
|
2
|
-
import thenable from '../../utils/promise/thenable';
|
|
2
|
+
import { thenable } from '../../utils/promise/thenable';
|
|
3
3
|
import { ENGINE_COMBINER_AND } from '../../logger/constants';
|
|
4
|
-
export
|
|
4
|
+
export function andCombinerContext(log, matchers) {
|
|
5
5
|
function andResults(results) {
|
|
6
6
|
// Array.prototype.every is supported by target environments
|
|
7
7
|
var hasMatchedAll = results.every(function (value) { return value; });
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { findIndex } from '../../utils/lang';
|
|
2
|
-
import thenable from '../../utils/promise/thenable';
|
|
2
|
+
import { thenable } from '../../utils/promise/thenable';
|
|
3
3
|
import * as LabelsConstants from '../../utils/labels';
|
|
4
4
|
import { CONTROL } from '../../utils/constants';
|
|
5
5
|
import { ENGINE_COMBINER_IFELSEIF, ENGINE_COMBINER_IFELSEIF_NO_TREATMENT, ERROR_ENGINE_COMBINER_IFELSEIF } from '../../logger/constants';
|
|
6
|
-
export
|
|
6
|
+
export function ifElseIfCombinerContext(log, predicates) {
|
|
7
7
|
function unexpectedInputHandler() {
|
|
8
8
|
log.error(ERROR_ENGINE_COMBINER_IFELSEIF);
|
|
9
9
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getTreatment, shouldApplyRollout } from './engineUtils';
|
|
2
|
-
import thenable from '../../utils/promise/thenable';
|
|
2
|
+
import { thenable } from '../../utils/promise/thenable';
|
|
3
3
|
import * as LabelsConstants from '../../utils/labels';
|
|
4
4
|
// Build Evaluation object if and only if matchingResult is true
|
|
5
5
|
function match(log, matchingResult, bucketingKey, seed, treatments, label) {
|
|
@@ -14,7 +14,7 @@ function match(log, matchingResult, bucketingKey, seed, treatments, label) {
|
|
|
14
14
|
return undefined;
|
|
15
15
|
}
|
|
16
16
|
// Condition factory
|
|
17
|
-
export
|
|
17
|
+
export function conditionContext(log, matcherEvaluator, treatments, label, conditionType) {
|
|
18
18
|
return function conditionEvaluator(key, seed, trafficAllocation, trafficAllocationSeed, attributes, splitEvaluator) {
|
|
19
19
|
// Whitelisting has more priority than traffic allocation, so we don't apply this filtering to those conditions.
|
|
20
20
|
if (conditionType === 'ROLLOUT' && !shouldApplyRollout(trafficAllocation, key.bucketingKey, trafficAllocationSeed)) {
|
package/esm/evaluator/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import Engine from './Engine';
|
|
2
|
-
import thenable from '../utils/promise/thenable';
|
|
1
|
+
import { Engine } from './Engine';
|
|
2
|
+
import { thenable } from '../utils/promise/thenable';
|
|
3
3
|
import * as LabelsConstants from '../utils/labels';
|
|
4
|
-
import { get } from '../utils/lang';
|
|
5
4
|
import { CONTROL } from '../utils/constants';
|
|
6
5
|
var treatmentException = {
|
|
7
6
|
treatment: CONTROL,
|
|
@@ -60,17 +59,17 @@ function getEvaluation(log, stringifiedSplit, key, attributes, storage) {
|
|
|
60
59
|
var splitJSON_1 = JSON.parse(stringifiedSplit);
|
|
61
60
|
var split_1 = Engine.parse(log, splitJSON_1, storage);
|
|
62
61
|
evaluation = split_1.getTreatment(key, attributes, evaluateFeature);
|
|
63
|
-
// If the storage is async
|
|
62
|
+
// If the storage is async and the evaluated split uses segment, evaluation is thenable
|
|
64
63
|
if (thenable(evaluation)) {
|
|
65
64
|
return evaluation.then(function (result) {
|
|
66
65
|
result.changeNumber = split_1.getChangeNumber();
|
|
67
|
-
result.config =
|
|
66
|
+
result.config = splitJSON_1.configurations && splitJSON_1.configurations[result.treatment] || null;
|
|
68
67
|
return result;
|
|
69
68
|
});
|
|
70
69
|
}
|
|
71
70
|
else {
|
|
72
71
|
evaluation.changeNumber = split_1.getChangeNumber(); // Always sync and optional
|
|
73
|
-
evaluation.config =
|
|
72
|
+
evaluation.config = splitJSON_1.configurations && splitJSON_1.configurations[evaluation.treatment] || null;
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
75
|
return evaluation;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ENGINE_MATCHER_BETWEEN } from '../../logger/constants';
|
|
2
|
-
export
|
|
2
|
+
export function betweenMatcherContext(log, ruleVO) {
|
|
3
3
|
return function betweenMatcher(runtimeAttr) {
|
|
4
4
|
var isBetween = runtimeAttr >= ruleVO.start && runtimeAttr <= ruleVO.end;
|
|
5
5
|
log.debug(ENGINE_MATCHER_BETWEEN, [runtimeAttr, ruleVO.start, ruleVO.end, isBetween]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ENGINE_MATCHER_BOOLEAN } from '../../logger/constants';
|
|
2
|
-
export
|
|
2
|
+
export function booleanMatcherContext(log, ruleAttr) {
|
|
3
3
|
return function booleanMatcher(runtimeAttr) {
|
|
4
4
|
var booleanMatches = ruleAttr === runtimeAttr;
|
|
5
5
|
log.debug(ENGINE_MATCHER_BOOLEAN, [ruleAttr, runtimeAttr]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ENGINE_MATCHER_CONTAINS_ALL } from '../../logger/constants';
|
|
2
2
|
import { findIndex } from '../../utils/lang';
|
|
3
|
-
export
|
|
3
|
+
export function containsAllSetMatcherContext(log, ruleAttr) {
|
|
4
4
|
return function containsAllMatcher(runtimeAttr) {
|
|
5
5
|
var containsAll = true;
|
|
6
6
|
if (runtimeAttr.length < ruleAttr.length) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ENGINE_MATCHER_CONTAINS_ANY } from '../../logger/constants';
|
|
2
2
|
import { findIndex } from '../../utils/lang';
|
|
3
|
-
export
|
|
3
|
+
export function containsAnySetMatcherContext(log, ruleAttr) {
|
|
4
4
|
return function containsAnyMatcher(runtimeAttr) {
|
|
5
5
|
var containsAny = false;
|
|
6
6
|
var _loop_1 = function (i) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isString } from '../../utils/lang';
|
|
2
2
|
import { ENGINE_MATCHER_CONTAINS_STRING } from '../../logger/constants';
|
|
3
|
-
export
|
|
3
|
+
export function containsStringMatcherContext(log, ruleAttr) {
|
|
4
4
|
return function containsStringMatcher(runtimeAttr) {
|
|
5
5
|
var contains = ruleAttr.some(function (e) { return isString(runtimeAttr) && runtimeAttr.indexOf(e) > -1; });
|
|
6
6
|
log.debug(ENGINE_MATCHER_CONTAINS_STRING, [runtimeAttr, ruleAttr, contains]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import thenable from '../../utils/promise/thenable';
|
|
1
|
+
import { thenable } from '../../utils/promise/thenable';
|
|
2
2
|
import { ENGINE_MATCHER_DEPENDENCY, ENGINE_MATCHER_DEPENDENCY_PRE } from '../../logger/constants';
|
|
3
|
-
export
|
|
3
|
+
export function dependencyMatcherContext(log, _a, storage) {
|
|
4
4
|
var split = _a.split, treatments = _a.treatments;
|
|
5
5
|
function checkTreatment(evaluation, acceptableTreatments, parentName) {
|
|
6
6
|
var matches = false;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ENGINE_MATCHER_EQUAL } from '../../logger/constants';
|
|
2
|
-
export
|
|
2
|
+
export function equalToMatcherContext(log, ruleAttr) {
|
|
3
3
|
return function equalToMatcher(runtimeAttr) {
|
|
4
4
|
var isEqual = runtimeAttr === ruleAttr;
|
|
5
5
|
log.debug(ENGINE_MATCHER_EQUAL, [runtimeAttr, ruleAttr, isEqual]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ENGINE_MATCHER_EQUAL_TO_SET } from '../../logger/constants';
|
|
2
2
|
import { findIndex } from '../../utils/lang';
|
|
3
|
-
export
|
|
3
|
+
export function equalToSetMatcherContext(log, ruleAttr) {
|
|
4
4
|
return function equalToSetMatcher(runtimeAttr) {
|
|
5
5
|
// Length being the same is the first condition.
|
|
6
6
|
var isEqual = runtimeAttr.length === ruleAttr.length;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ENGINE_MATCHER_ENDS_WITH } from '../../logger/constants';
|
|
2
2
|
import { endsWith as strEndsWith } from '../../utils/lang';
|
|
3
|
-
export
|
|
3
|
+
export function endsWithMatcherContext(log, ruleAttr) {
|
|
4
4
|
return function endsWithMatcher(runtimeAttr) {
|
|
5
5
|
var endsWith = ruleAttr.some(function (e) { return strEndsWith(runtimeAttr, e); });
|
|
6
6
|
log.debug(ENGINE_MATCHER_ENDS_WITH, [runtimeAttr, ruleAttr, endsWith]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ENGINE_MATCHER_GREATER } from '../../logger/constants';
|
|
2
|
-
export
|
|
2
|
+
export function greaterThanEqualMatcherContext(log, ruleAttr) {
|
|
3
3
|
return function greaterThanEqualMatcher(runtimeAttr) {
|
|
4
4
|
var isGreaterEqualThan = runtimeAttr >= ruleAttr;
|
|
5
5
|
log.debug(ENGINE_MATCHER_GREATER, [runtimeAttr, ruleAttr, isGreaterEqualThan]);
|