@splitsoftware/splitio-commons 1.6.2-rc.4 → 1.6.2-rc.7
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 +3 -0
- package/cjs/consent/sdkUserConsent.js +2 -2
- package/cjs/evaluator/index.js +10 -11
- package/cjs/integrations/ga/GaToSplit.js +8 -5
- package/cjs/listeners/browser.js +2 -1
- package/cjs/logger/constants.js +2 -1
- package/cjs/sdkClient/clientAttributesDecoration.js +1 -1
- package/cjs/sdkClient/sdkClient.js +3 -1
- package/cjs/sdkFactory/index.js +28 -8
- package/cjs/sdkManager/index.js +3 -11
- package/cjs/services/splitApi.js +20 -1
- package/cjs/storages/AbstractSplitsCacheAsync.js +7 -9
- package/cjs/storages/AbstractSplitsCacheSync.js +7 -9
- package/cjs/storages/KeyBuilderSS.js +6 -0
- package/cjs/storages/dataLoader.js +1 -1
- package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +5 -6
- package/cjs/storages/inLocalStorage/index.js +4 -0
- package/cjs/storages/inMemory/AttributesCacheInMemory.js +1 -1
- package/cjs/storages/inMemory/ImpressionCountsCacheInMemory.js +12 -1
- package/cjs/storages/inMemory/InMemoryStorage.js +5 -1
- package/cjs/storages/inMemory/InMemoryStorageCS.js +5 -1
- package/cjs/storages/inMemory/SplitsCacheInMemory.js +7 -10
- package/cjs/storages/inMemory/uniqueKeysCacheInMemory.js +73 -0
- package/cjs/storages/inMemory/uniqueKeysCacheInMemoryCS.js +78 -0
- package/cjs/storages/inRedis/ImpressionCountsCacheInRedis.js +49 -0
- package/cjs/storages/inRedis/SplitsCacheInRedis.js +15 -9
- package/cjs/storages/inRedis/constants.js +4 -1
- package/cjs/storages/inRedis/index.js +15 -1
- package/cjs/storages/inRedis/uniqueKeysCacheInRedis.js +56 -0
- package/cjs/storages/pluggable/SplitsCachePluggable.js +14 -9
- package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +2 -3
- package/cjs/sync/polling/updaters/splitChangesUpdater.js +1 -1
- package/cjs/sync/submitters/submitterManager.js +3 -0
- package/cjs/sync/submitters/telemetrySubmitter.js +1 -0
- package/cjs/sync/submitters/uniqueKeysSubmitter.js +26 -0
- package/cjs/trackers/impressionsTracker.js +22 -41
- package/cjs/trackers/strategy/strategyDebug.js +25 -0
- package/cjs/trackers/strategy/strategyNone.js +29 -0
- package/cjs/trackers/strategy/strategyOptimized.js +35 -0
- package/cjs/trackers/telemetryTracker.js +6 -0
- package/cjs/trackers/uniqueKeysTracker.js +38 -0
- package/cjs/types.js +2 -0
- package/cjs/utils/constants/index.js +4 -2
- package/cjs/utils/key/index.js +1 -1
- package/cjs/utils/settingsValidation/impressionsMode.js +2 -2
- package/cjs/utils/settingsValidation/index.js +4 -1
- package/esm/consent/sdkUserConsent.js +2 -2
- package/esm/evaluator/index.js +10 -11
- package/esm/integrations/ga/GaToSplit.js +8 -5
- package/esm/listeners/browser.js +3 -2
- package/esm/logger/constants.js +1 -0
- package/esm/sdkClient/clientAttributesDecoration.js +1 -1
- package/esm/sdkClient/sdkClient.js +3 -1
- package/esm/sdkFactory/index.js +28 -8
- package/esm/sdkManager/index.js +3 -11
- package/esm/services/splitApi.js +20 -1
- package/esm/storages/AbstractSplitsCacheAsync.js +7 -9
- package/esm/storages/AbstractSplitsCacheSync.js +7 -9
- package/esm/storages/KeyBuilderSS.js +6 -0
- package/esm/storages/dataLoader.js +1 -1
- package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +5 -6
- package/esm/storages/inLocalStorage/index.js +5 -1
- package/esm/storages/inMemory/AttributesCacheInMemory.js +1 -1
- package/esm/storages/inMemory/ImpressionCountsCacheInMemory.js +12 -1
- package/esm/storages/inMemory/InMemoryStorage.js +6 -2
- package/esm/storages/inMemory/InMemoryStorageCS.js +6 -2
- package/esm/storages/inMemory/SplitsCacheInMemory.js +7 -10
- package/esm/storages/inMemory/uniqueKeysCacheInMemory.js +70 -0
- package/esm/storages/inMemory/uniqueKeysCacheInMemoryCS.js +75 -0
- package/esm/storages/inRedis/ImpressionCountsCacheInRedis.js +46 -0
- package/esm/storages/inRedis/SplitsCacheInRedis.js +15 -9
- package/esm/storages/inRedis/constants.js +3 -0
- package/esm/storages/inRedis/index.js +16 -2
- package/esm/storages/inRedis/uniqueKeysCacheInRedis.js +53 -0
- package/esm/storages/pluggable/SplitsCachePluggable.js +14 -9
- package/esm/sync/offline/syncTasks/fromObjectSyncTask.js +2 -3
- package/esm/sync/polling/updaters/splitChangesUpdater.js +1 -1
- package/esm/sync/submitters/submitterManager.js +3 -0
- package/esm/sync/submitters/telemetrySubmitter.js +2 -1
- package/esm/sync/submitters/uniqueKeysSubmitter.js +22 -0
- package/esm/trackers/impressionsTracker.js +22 -41
- package/esm/trackers/strategy/strategyDebug.js +21 -0
- package/esm/trackers/strategy/strategyNone.js +25 -0
- package/esm/trackers/strategy/strategyOptimized.js +31 -0
- package/esm/trackers/telemetryTracker.js +6 -0
- package/esm/trackers/uniqueKeysTracker.js +34 -0
- package/esm/types.js +1 -0
- package/esm/utils/constants/index.js +2 -0
- package/esm/utils/key/index.js +1 -1
- package/esm/utils/settingsValidation/impressionsMode.js +3 -3
- package/esm/utils/settingsValidation/index.js +4 -1
- package/package.json +5 -4
- package/src/consent/sdkUserConsent.ts +5 -6
- package/src/dtos/types.ts +8 -0
- package/src/evaluator/Engine.ts +3 -3
- package/src/evaluator/combiners/and.ts +1 -1
- package/src/evaluator/combiners/ifelseif.ts +3 -3
- package/src/evaluator/condition/engineUtils.ts +1 -1
- package/src/evaluator/condition/index.ts +6 -6
- package/src/evaluator/index.ts +18 -19
- 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 +1 -1
- 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 +1 -1
- package/src/evaluator/matchers/lte.ts +1 -1
- package/src/evaluator/matchers/part_of.ts +1 -1
- package/src/evaluator/matchers/segment.ts +1 -1
- 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/parser/index.ts +3 -3
- package/src/evaluator/types.ts +6 -6
- package/src/evaluator/value/index.ts +4 -4
- package/src/evaluator/value/sanitize.ts +4 -4
- package/src/integrations/ga/GaToSplit.ts +15 -11
- package/src/integrations/ga/SplitToGa.ts +10 -10
- package/src/integrations/ga/types.ts +4 -4
- package/src/integrations/pluggable.ts +3 -3
- package/src/integrations/types.ts +4 -3
- package/src/listeners/browser.ts +3 -2
- package/src/logger/constants.ts +1 -0
- package/src/logger/index.ts +3 -3
- package/src/logger/sdkLogger.ts +2 -1
- package/src/logger/types.ts +16 -0
- package/src/readiness/sdkReadinessManager.ts +1 -1
- package/src/readiness/types.ts +9 -2
- package/src/sdkClient/client.ts +13 -13
- package/src/sdkClient/clientAttributesDecoration.ts +13 -13
- package/src/sdkClient/clientCS.ts +4 -3
- package/src/sdkClient/clientInputValidation.ts +15 -15
- package/src/sdkClient/sdkClient.ts +5 -3
- package/src/sdkClient/sdkClientMethod.ts +2 -2
- package/src/sdkClient/sdkClientMethodCS.ts +9 -9
- package/src/sdkClient/sdkClientMethodCSWithTT.ts +9 -9
- package/src/sdkFactory/index.ts +34 -11
- package/src/sdkFactory/types.ts +11 -8
- package/src/sdkManager/index.ts +7 -16
- package/src/services/splitApi.ts +22 -1
- package/src/services/types.ts +6 -0
- package/src/storages/AbstractSplitsCacheAsync.ts +12 -14
- package/src/storages/AbstractSplitsCacheSync.ts +14 -16
- package/src/storages/KeyBuilderSS.ts +8 -0
- package/src/storages/dataLoader.ts +3 -3
- package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +1 -1
- package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +10 -12
- package/src/storages/inLocalStorage/index.ts +6 -4
- package/src/storages/inMemory/AttributesCacheInMemory.ts +12 -13
- package/src/storages/inMemory/EventsCacheInMemory.ts +4 -4
- package/src/storages/inMemory/ImpressionCountsCacheInMemory.ts +16 -1
- package/src/storages/inMemory/InMemoryStorage.ts +5 -2
- package/src/storages/inMemory/InMemoryStorageCS.ts +6 -2
- package/src/storages/inMemory/SplitsCacheInMemory.ts +10 -14
- package/src/storages/inMemory/uniqueKeysCacheInMemory.ts +82 -0
- package/src/storages/inMemory/uniqueKeysCacheInMemoryCS.ts +88 -0
- package/src/storages/inRedis/EventsCacheInRedis.ts +4 -4
- package/src/storages/inRedis/ImpressionCountsCacheInRedis.ts +51 -0
- package/src/storages/inRedis/ImpressionsCacheInRedis.ts +1 -1
- package/src/storages/inRedis/RedisAdapter.ts +1 -1
- package/src/storages/inRedis/SegmentsCacheInRedis.ts +1 -1
- package/src/storages/inRedis/SplitsCacheInRedis.ts +22 -18
- package/src/storages/inRedis/TelemetryCacheInRedis.ts +1 -1
- package/src/storages/inRedis/constants.ts +3 -0
- package/src/storages/inRedis/index.ts +14 -6
- package/src/storages/inRedis/uniqueKeysCacheInRedis.ts +63 -0
- package/src/storages/pluggable/EventsCachePluggable.ts +4 -4
- package/src/storages/pluggable/ImpressionsCachePluggable.ts +1 -1
- package/src/storages/pluggable/SegmentsCachePluggable.ts +1 -1
- package/src/storages/pluggable/SplitsCachePluggable.ts +21 -18
- package/src/storages/pluggable/TelemetryCachePluggable.ts +1 -1
- package/src/storages/pluggable/index.ts +3 -3
- package/src/storages/pluggable/wrapperAdapter.ts +1 -1
- package/src/storages/types.ts +60 -62
- package/src/sync/offline/LocalhostFromObject.ts +4 -4
- package/src/sync/offline/splitsParser/splitsParserFromSettings.ts +8 -8
- package/src/sync/offline/syncTasks/fromObjectSyncTask.ts +5 -6
- 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 +3 -3
- package/src/sync/streaming/SSEHandler/index.ts +1 -1
- package/src/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.ts +1 -1
- package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +1 -1
- package/src/sync/submitters/submitter.ts +1 -1
- package/src/sync/submitters/submitterManager.ts +2 -0
- package/src/sync/submitters/telemetrySubmitter.ts +4 -3
- package/src/sync/submitters/types.ts +22 -3
- package/src/sync/submitters/uniqueKeysSubmitter.ts +35 -0
- package/src/sync/syncTask.ts +1 -1
- package/src/trackers/eventTracker.ts +3 -3
- package/src/trackers/impressionsTracker.ts +30 -51
- package/src/trackers/strategy/strategyDebug.ts +28 -0
- package/src/trackers/strategy/strategyNone.ts +34 -0
- package/src/trackers/strategy/strategyOptimized.ts +42 -0
- package/src/trackers/telemetryTracker.ts +7 -2
- package/src/trackers/types.ts +36 -4
- package/src/trackers/uniqueKeysTracker.ts +48 -0
- package/src/types.ts +1267 -0
- package/src/utils/constants/index.ts +3 -1
- package/src/utils/inputValidation/apiKey.ts +1 -1
- package/src/utils/inputValidation/attribute.ts +1 -1
- package/src/utils/inputValidation/attributes.ts +3 -3
- package/src/utils/inputValidation/event.ts +1 -1
- package/src/utils/inputValidation/eventProperties.ts +3 -3
- package/src/utils/inputValidation/eventValue.ts +1 -1
- package/src/utils/inputValidation/isOperational.ts +1 -1
- package/src/utils/inputValidation/key.ts +3 -3
- package/src/utils/inputValidation/preloadedData.ts +3 -3
- package/src/utils/inputValidation/split.ts +1 -1
- package/src/utils/inputValidation/splitExistance.ts +1 -1
- package/src/utils/inputValidation/splits.ts +1 -1
- package/src/utils/inputValidation/trafficType.ts +1 -1
- package/src/utils/inputValidation/trafficTypeExistance.ts +1 -1
- package/src/utils/key/index.ts +9 -9
- package/src/utils/settingsValidation/consent.ts +2 -1
- package/src/utils/settingsValidation/impressionsMode.ts +6 -6
- package/src/utils/settingsValidation/index.ts +5 -1
- package/src/utils/settingsValidation/integrations/common.ts +1 -1
- package/src/utils/settingsValidation/integrations/configurable.ts +1 -1
- package/src/utils/settingsValidation/integrations/pluggable.ts +2 -1
- package/src/utils/settingsValidation/localhost/builtin.ts +2 -1
- package/src/utils/settingsValidation/localhost/pluggable.ts +2 -1
- package/src/utils/settingsValidation/logger/builtinLogger.ts +2 -1
- package/src/utils/settingsValidation/logger/pluggableLogger.ts +2 -1
- package/src/utils/settingsValidation/splitFilters.ts +9 -7
- package/src/utils/settingsValidation/storage/storageCS.ts +2 -1
- package/types/consent/index.d.ts +2 -0
- package/types/consent/sdkUserConsent.d.ts +13 -0
- package/types/dtos/types.d.ts +172 -0
- package/types/evaluator/Engine.d.ts +15 -0
- package/types/evaluator/combiners/and.d.ts +4 -0
- package/types/evaluator/combiners/ifelseif.d.ts +3 -0
- package/types/evaluator/condition/engineUtils.d.ts +11 -0
- package/types/evaluator/condition/index.d.ts +6 -0
- package/types/evaluator/convertions/index.d.ts +2 -0
- package/types/evaluator/index.d.ts +7 -0
- package/types/evaluator/matchers/all.d.ts +2 -0
- package/types/evaluator/matchers/between.d.ts +3 -0
- package/types/evaluator/matchers/boolean.d.ts +2 -0
- package/types/evaluator/matchers/cont_all.d.ts +2 -0
- package/types/evaluator/matchers/cont_any.d.ts +2 -0
- package/types/evaluator/matchers/cont_str.d.ts +2 -0
- package/types/evaluator/matchers/dependency.d.ts +5 -0
- package/types/evaluator/matchers/eq.d.ts +2 -0
- package/types/evaluator/matchers/eq_set.d.ts +2 -0
- package/types/evaluator/matchers/ew.d.ts +2 -0
- package/types/evaluator/matchers/gte.d.ts +2 -0
- package/types/evaluator/matchers/index.d.ts +7 -0
- package/types/evaluator/matchers/lte.d.ts +2 -0
- package/types/evaluator/matchers/matcherTypes.d.ts +10 -0
- package/types/evaluator/matchers/part_of.d.ts +2 -0
- package/types/evaluator/matchers/segment.d.ts +6 -0
- package/types/evaluator/matchers/string.d.ts +2 -0
- package/types/evaluator/matchers/sw.d.ts +2 -0
- package/types/evaluator/matchers/whitelist.d.ts +3 -0
- package/types/evaluator/matchersTransform/index.d.ts +6 -0
- package/types/evaluator/matchersTransform/segment.d.ts +5 -0
- package/types/evaluator/matchersTransform/set.d.ts +5 -0
- package/types/evaluator/matchersTransform/unaryNumeric.d.ts +5 -0
- package/types/evaluator/matchersTransform/whitelist.d.ts +5 -0
- package/types/evaluator/parser/index.d.ts +5 -0
- package/types/evaluator/treatments/index.d.ts +8 -0
- package/types/evaluator/types.d.ts +28 -0
- package/types/evaluator/value/index.d.ts +7 -0
- package/types/evaluator/value/sanitize.d.ts +7 -0
- package/types/index.d.ts +5 -0
- package/types/integrations/browser.d.ts +12 -0
- package/types/integrations/ga/GaToSplit.d.ts +40 -0
- package/types/integrations/ga/GoogleAnalyticsToSplit.d.ts +3 -0
- package/types/integrations/ga/SplitToGa.d.ts +34 -0
- package/types/integrations/ga/SplitToGoogleAnalytics.d.ts +3 -0
- package/types/integrations/ga/types.d.ts +148 -0
- package/types/integrations/pluggable.d.ts +11 -0
- package/types/integrations/types.d.ts +18 -0
- package/types/listeners/browser.d.ts +40 -0
- package/types/listeners/node.d.ts +22 -0
- package/types/listeners/types.d.ts +4 -0
- package/types/logger/browser/DebugLogger.d.ts +2 -0
- package/types/logger/browser/ErrorLogger.d.ts +2 -0
- package/types/logger/browser/InfoLogger.d.ts +2 -0
- package/types/logger/browser/WarnLogger.d.ts +2 -0
- package/types/logger/constants.d.ts +142 -0
- package/types/logger/index.d.ts +22 -0
- package/types/logger/messages/debug.d.ts +1 -0
- package/types/logger/messages/error.d.ts +1 -0
- package/types/logger/messages/info.d.ts +1 -0
- package/types/logger/messages/warn.d.ts +1 -0
- package/types/logger/sdkLogger.d.ts +8 -0
- package/types/logger/types.d.ts +17 -0
- package/types/readiness/constants.d.ts +7 -0
- package/types/readiness/readinessManager.d.ts +6 -0
- package/types/readiness/sdkReadinessManager.d.ts +11 -0
- package/types/readiness/types.d.ts +60 -0
- package/types/sdkClient/client.d.ts +6 -0
- package/types/sdkClient/clientAttributesDecoration.d.ts +51 -0
- package/types/sdkClient/clientCS.d.ts +10 -0
- package/types/sdkClient/clientInputValidation.d.ts +7 -0
- package/types/sdkClient/sdkClient.d.ts +6 -0
- package/types/sdkClient/sdkClientMethod.d.ts +6 -0
- package/types/sdkClient/sdkClientMethodCS.d.ts +7 -0
- package/types/sdkClient/sdkClientMethodCSWithTT.d.ts +8 -0
- package/types/sdkClient/types.d.ts +18 -0
- package/types/sdkFactory/index.d.ts +6 -0
- package/types/sdkFactory/types.d.ts +82 -0
- package/types/sdkManager/index.d.ts +5 -0
- package/types/services/splitApi.d.ts +11 -0
- package/types/services/splitHttpClient.d.ts +10 -0
- package/types/services/types.d.ts +54 -0
- package/types/storages/AbstractSegmentsCacheSync.d.ts +55 -0
- package/types/storages/AbstractSplitsCacheAsync.d.ts +37 -0
- package/types/storages/AbstractSplitsCacheSync.d.ts +42 -0
- package/types/storages/KeyBuilder.d.ts +14 -0
- package/types/storages/KeyBuilderCS.d.ts +16 -0
- package/types/storages/KeyBuilderSS.d.ts +17 -0
- package/types/storages/dataLoader.d.ts +10 -0
- package/types/storages/findLatencyIndex.d.ts +7 -0
- package/types/storages/inLocalStorage/MySegmentsCacheInLocal.d.ts +25 -0
- package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +51 -0
- package/types/storages/inLocalStorage/constants.d.ts +2 -0
- package/types/storages/inLocalStorage/index.d.ts +8 -0
- package/types/storages/inMemory/AttributesCacheInMemory.d.ts +43 -0
- package/types/storages/inMemory/CountsCacheInMemory.d.ts +20 -0
- package/types/storages/inMemory/EventsCacheInMemory.d.ts +35 -0
- package/types/storages/inMemory/ImpressionCountsCacheInMemory.d.ts +28 -0
- package/types/storages/inMemory/ImpressionsCacheInMemory.d.ts +30 -0
- package/types/storages/inMemory/InMemoryStorage.d.ts +10 -0
- package/types/storages/inMemory/InMemoryStorageCS.d.ts +10 -0
- package/types/storages/inMemory/LatenciesCacheInMemory.d.ts +20 -0
- package/types/storages/inMemory/MySegmentsCacheInMemory.d.ts +22 -0
- package/types/storages/inMemory/SegmentsCacheInMemory.d.ts +19 -0
- package/types/storages/inMemory/SplitsCacheInMemory.d.ts +21 -0
- package/types/storages/inMemory/TelemetryCacheInMemory.d.ts +53 -0
- package/types/storages/inMemory/uniqueKeysCacheInMemory.d.ts +35 -0
- package/types/storages/inMemory/uniqueKeysCacheInMemoryCS.d.ts +37 -0
- package/types/storages/inRedis/CountsCacheInRedis.d.ts +9 -0
- package/types/storages/inRedis/EventsCacheInRedis.d.ts +32 -0
- package/types/storages/inRedis/ImpressionCountsCacheInRedis.d.ts +14 -0
- package/types/storages/inRedis/ImpressionsCacheInRedis.d.ts +18 -0
- package/types/storages/inRedis/LatenciesCacheInRedis.d.ts +9 -0
- package/types/storages/inRedis/RedisAdapter.d.ts +24 -0
- package/types/storages/inRedis/SegmentsCacheInRedis.d.ts +18 -0
- package/types/storages/inRedis/SplitsCacheInRedis.d.ts +92 -0
- package/types/storages/inRedis/TelemetryCacheInRedis.d.ts +20 -0
- package/types/storages/inRedis/constants.d.ts +4 -0
- package/types/storages/inRedis/index.d.ts +10 -0
- package/types/storages/inRedis/uniqueKeysCacheInRedis.d.ts +15 -0
- package/types/storages/metadataBuilder.d.ts +3 -0
- package/types/storages/pluggable/EventsCachePluggable.d.ts +38 -0
- package/types/storages/pluggable/ImpressionsCachePluggable.d.ts +35 -0
- package/types/storages/pluggable/SegmentsCachePluggable.d.ts +54 -0
- package/types/storages/pluggable/SplitsCachePluggable.d.ts +90 -0
- package/types/storages/pluggable/TelemetryCachePluggable.d.ts +18 -0
- package/types/storages/pluggable/constants.d.ts +1 -0
- package/types/storages/pluggable/inMemoryWrapper.d.ts +13 -0
- package/types/storages/pluggable/index.d.ts +9 -0
- package/types/storages/pluggable/wrapperAdapter.d.ts +12 -0
- package/types/storages/types.d.ts +417 -0
- package/types/sync/offline/LocalhostFromFile.d.ts +2 -0
- package/types/sync/offline/LocalhostFromObject.d.ts +2 -0
- package/types/sync/offline/splitsParser/parseCondition.d.ts +7 -0
- package/types/sync/offline/splitsParser/splitsParserFromFile.d.ts +2 -0
- package/types/sync/offline/splitsParser/splitsParserFromSettings.d.ts +3 -0
- package/types/sync/offline/splitsParser/types.d.ts +3 -0
- package/types/sync/offline/syncManagerOffline.d.ts +10 -0
- package/types/sync/offline/syncTasks/fromObjectSyncTask.d.ts +17 -0
- package/types/sync/polling/fetchers/mySegmentsFetcher.d.ts +7 -0
- package/types/sync/polling/fetchers/segmentChangesFetcher.d.ts +7 -0
- package/types/sync/polling/fetchers/splitChangesFetcher.d.ts +7 -0
- package/types/sync/polling/fetchers/types.d.ts +5 -0
- package/types/sync/polling/pollingManagerCS.d.ts +7 -0
- package/types/sync/polling/pollingManagerSS.d.ts +6 -0
- package/types/sync/polling/syncTasks/mySegmentsSyncTask.d.ts +9 -0
- package/types/sync/polling/syncTasks/segmentsSyncTask.d.ts +9 -0
- package/types/sync/polling/syncTasks/splitsSyncTask.d.ts +9 -0
- package/types/sync/polling/types.d.ts +26 -0
- package/types/sync/polling/updaters/mySegmentsUpdater.d.ts +13 -0
- package/types/sync/polling/updaters/segmentChangesUpdater.d.ts +18 -0
- package/types/sync/polling/updaters/splitChangesUpdater.d.ts +39 -0
- package/types/sync/streaming/AuthClient/index.d.ts +12 -0
- package/types/sync/streaming/AuthClient/types.d.ts +17 -0
- package/types/sync/streaming/SSEClient/index.d.ts +34 -0
- package/types/sync/streaming/SSEClient/types.d.ts +11 -0
- package/types/sync/streaming/SSEHandler/NotificationKeeper.d.ts +14 -0
- package/types/sync/streaming/SSEHandler/NotificationParser.d.ts +20 -0
- package/types/sync/streaming/SSEHandler/index.d.ts +11 -0
- package/types/sync/streaming/SSEHandler/types.d.ts +67 -0
- package/types/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.d.ts +6 -0
- package/types/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.d.ts +8 -0
- package/types/sync/streaming/UpdateWorkers/SplitsUpdateWorker.d.ts +12 -0
- package/types/sync/streaming/UpdateWorkers/constants.d.ts +3 -0
- package/types/sync/streaming/UpdateWorkers/types.d.ts +4 -0
- package/types/sync/streaming/constants.d.ts +34 -0
- package/types/sync/streaming/mySegmentsV2utils.d.ts +27 -0
- package/types/sync/streaming/pushManager.d.ts +9 -0
- package/types/sync/streaming/types.d.ts +35 -0
- package/types/sync/submitters/eventsSubmitter.d.ts +5 -0
- package/types/sync/submitters/eventsSyncTask.d.ts +8 -0
- package/types/sync/submitters/impressionCountsSubmitter.d.ts +10 -0
- package/types/sync/submitters/impressionCountsSubmitterInRedis.d.ts +5 -0
- package/types/sync/submitters/impressionCountsSyncTask.d.ts +13 -0
- package/types/sync/submitters/impressionsSubmitter.d.ts +11 -0
- package/types/sync/submitters/impressionsSyncTask.d.ts +14 -0
- package/types/sync/submitters/metricsSyncTask.d.ts +12 -0
- package/types/sync/submitters/submitter.d.ts +12 -0
- package/types/sync/submitters/submitterManager.d.ts +3 -0
- package/types/sync/submitters/submitterSyncTask.d.ts +10 -0
- package/types/sync/submitters/telemetrySubmitter.d.ts +25 -0
- package/types/sync/submitters/types.d.ts +194 -0
- package/types/sync/submitters/uniqueKeysSubmitter.d.ts +5 -0
- package/types/sync/submitters/uniqueKeysSubmitterInRedis.d.ts +5 -0
- package/types/sync/syncManagerOnline.d.ts +13 -0
- package/types/sync/syncTask.d.ts +13 -0
- package/types/sync/syncTaskComposite.d.ts +5 -0
- package/types/sync/types.d.ts +43 -0
- package/types/trackers/eventTracker.d.ts +10 -0
- package/types/trackers/filter/bloomFilter.d.ts +10 -0
- package/types/trackers/filter/dictionaryFilter.d.ts +8 -0
- package/types/trackers/filter/types.d.ts +5 -0
- package/types/trackers/impressionObserver/ImpressionObserver.d.ts +8 -0
- package/types/trackers/impressionObserver/buildKey.d.ts +2 -0
- package/types/trackers/impressionObserver/impressionObserverCS.d.ts +4 -0
- package/types/trackers/impressionObserver/impressionObserverSS.d.ts +4 -0
- package/types/trackers/impressionObserver/types.d.ts +4 -0
- package/types/trackers/impressionObserver/utils.d.ts +13 -0
- package/types/trackers/impressionsTracker.d.ts +13 -0
- package/types/trackers/strategy/strategyDebug.d.ts +9 -0
- package/types/trackers/strategy/strategyNone.d.ts +10 -0
- package/types/trackers/strategy/strategyOptimized.d.ts +11 -0
- package/types/trackers/telemetryTracker.d.ts +3 -0
- package/types/trackers/types.d.ts +63 -0
- package/types/trackers/uniqueKeysTracker.d.ts +13 -0
- package/types/types.d.ts +1265 -0
- package/types/utils/Backoff.d.ts +25 -0
- package/types/utils/LRUCache/LinkedList.d.ts +34 -0
- package/types/utils/LRUCache/index.d.ts +16 -0
- package/types/utils/MinEventEmitter.d.ts +12 -0
- package/types/utils/MinEvents.d.ts +4 -0
- package/types/utils/base64/index.d.ts +30 -0
- package/types/utils/constants/browser.d.ts +3 -0
- package/types/utils/constants/index.d.ts +64 -0
- package/types/utils/decompress/index.d.ts +16 -0
- package/types/utils/env/isLocalStorageAvailable.d.ts +1 -0
- package/types/utils/env/isNode.d.ts +5 -0
- package/types/utils/inputValidation/apiKey.d.ts +7 -0
- package/types/utils/inputValidation/attribute.d.ts +2 -0
- package/types/utils/inputValidation/attributes.d.ts +4 -0
- package/types/utils/inputValidation/event.d.ts +2 -0
- package/types/utils/inputValidation/eventProperties.d.ts +6 -0
- package/types/utils/inputValidation/eventValue.d.ts +2 -0
- package/types/utils/inputValidation/index.d.ts +13 -0
- package/types/utils/inputValidation/isOperational.d.ts +4 -0
- package/types/utils/inputValidation/key.d.ts +3 -0
- package/types/utils/inputValidation/preloadedData.d.ts +3 -0
- package/types/utils/inputValidation/split.d.ts +2 -0
- package/types/utils/inputValidation/splitExistance.d.ts +7 -0
- package/types/utils/inputValidation/splits.d.ts +2 -0
- package/types/utils/inputValidation/trafficType.d.ts +2 -0
- package/types/utils/inputValidation/trafficTypeExistance.d.ts +9 -0
- package/types/utils/jwt/index.d.ts +5 -0
- package/types/utils/jwt/types.d.ts +5 -0
- package/types/utils/key/index.d.ts +8 -0
- package/types/utils/labels/index.d.ts +7 -0
- package/types/utils/lang/binarySearch.d.ts +9 -0
- package/types/utils/lang/getFnName.d.ts +4 -0
- package/types/utils/lang/getGlobal.d.ts +4 -0
- package/types/utils/lang/index.d.ts +105 -0
- package/types/utils/lang/maps.d.ts +55 -0
- package/types/utils/lang/objectAssign.d.ts +3 -0
- package/types/utils/lang/sets.d.ts +60 -0
- package/types/utils/murmur3/common.d.ts +12 -0
- package/types/utils/murmur3/legacy.d.ts +2 -0
- package/types/utils/murmur3/murmur3.d.ts +2 -0
- package/types/utils/murmur3/murmur3_128.d.ts +6 -0
- package/types/utils/murmur3/murmur3_128_x86.d.ts +7 -0
- package/types/utils/murmur3/murmur3_64.d.ts +10 -0
- package/types/utils/murmur3/utfx.d.ts +27 -0
- package/types/utils/promise/thenable.d.ts +1 -0
- package/types/utils/promise/timeout.d.ts +1 -0
- package/types/utils/promise/wrapper.d.ts +21 -0
- package/types/utils/settingsValidation/consent.d.ts +6 -0
- package/types/utils/settingsValidation/impressionsMode.d.ts +3 -0
- package/types/utils/settingsValidation/index.d.ts +52 -0
- package/types/utils/settingsValidation/integrations/common.d.ts +14 -0
- package/types/utils/settingsValidation/integrations/configurable.d.ts +13 -0
- package/types/utils/settingsValidation/integrations/pluggable.d.ts +13 -0
- package/types/utils/settingsValidation/localhost/builtin.d.ts +16 -0
- package/types/utils/settingsValidation/localhost/pluggable.d.ts +16 -0
- package/types/utils/settingsValidation/logger/builtinLogger.d.ts +10 -0
- package/types/utils/settingsValidation/logger/commons.d.ts +9 -0
- package/types/utils/settingsValidation/logger/pluggableLogger.d.ts +11 -0
- package/types/utils/settingsValidation/mode.d.ts +1 -0
- package/types/utils/settingsValidation/runtime.d.ts +2 -0
- package/types/utils/settingsValidation/splitFilters.d.ts +16 -0
- package/types/utils/settingsValidation/storage/storageCS.d.ts +21 -0
- package/types/utils/settingsValidation/types.d.ts +32 -0
- package/types/utils/settingsValidation/url.d.ts +10 -0
- package/types/utils/time/index.d.ts +4 -0
- package/types/utils/timeTracker/index.d.ts +70 -0
- package/types/utils/timeTracker/now/browser.d.ts +1 -0
- package/types/utils/timeTracker/now/node.d.ts +1 -0
- package/types/utils/timeTracker/timer.d.ts +1 -0
- package/src/logger/.DS_Store +0 -0
- package/src/types.d.ts +0 -1581
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ISet } from '../../../utils/lang/sets';
|
|
2
|
+
import { ISegmentsCacheBase, ISplitsCacheBase } from '../../../storages/types';
|
|
3
|
+
import { ISplitChangesFetcher } from '../fetchers/types';
|
|
4
|
+
import { ISplit } from '../../../dtos/types';
|
|
5
|
+
import { ISplitsEventEmitter } from '../../../readiness/types';
|
|
6
|
+
import { ILogger } from '../../../logger/types';
|
|
7
|
+
declare type ISplitChangesUpdater = (noCache?: boolean, till?: number) => Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* Collect segments from a raw split definition.
|
|
10
|
+
* Exported for testing purposes.
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseSegments({ conditions }: ISplit): ISet<string>;
|
|
13
|
+
interface ISplitMutations {
|
|
14
|
+
added: [string, ISplit][];
|
|
15
|
+
removed: string[];
|
|
16
|
+
segments: string[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Given the list of splits from /splitChanges endpoint, it returns the mutations,
|
|
20
|
+
* i.e., an object with added splits, removed splits and used segments.
|
|
21
|
+
* Exported for testing purposes.
|
|
22
|
+
*/
|
|
23
|
+
export declare function computeSplitsMutation(entries: ISplit[]): ISplitMutations;
|
|
24
|
+
/**
|
|
25
|
+
* factory of SplitChanges updater, a task that:
|
|
26
|
+
* - fetches split changes using `splitChangesFetcher`
|
|
27
|
+
* - updates `splitsCache`
|
|
28
|
+
* - uses `splitsEventEmitter` to emit events related to split data updates
|
|
29
|
+
*
|
|
30
|
+
* @param log Logger instance
|
|
31
|
+
* @param splitChangesFetcher Fetcher of `/splitChanges`
|
|
32
|
+
* @param splits Splits storage, with sync or async methods
|
|
33
|
+
* @param segments Segments storage, with sync or async methods
|
|
34
|
+
* @param splitsEventEmitter Optional readiness manager. Not required for synchronizer or producer mode.
|
|
35
|
+
* @param requestTimeoutBeforeReady How long the updater will wait for the request to timeout. Default 0, i.e., never timeout.
|
|
36
|
+
* @param retriesOnFailureBeforeReady How many retries on `/splitChanges` we the updater do in case of failure or timeout. Default 0, i.e., no retries.
|
|
37
|
+
*/
|
|
38
|
+
export declare function splitChangesUpdaterFactory(log: ILogger, splitChangesFetcher: ISplitChangesFetcher, splits: ISplitsCacheBase, segments: ISegmentsCacheBase, splitsEventEmitter?: ISplitsEventEmitter, requestTimeoutBeforeReady?: number, retriesOnFailureBeforeReady?: number, isClientSide?: boolean): ISplitChangesUpdater;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IFetchAuth } from '../../../services/types';
|
|
2
|
+
import { IAuthenticate } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Factory of authentication function.
|
|
5
|
+
*
|
|
6
|
+
* @param fetchAuth `SplitAPI.fetchAuth` endpoint
|
|
7
|
+
*/
|
|
8
|
+
export declare function authenticateFactory(fetchAuth: IFetchAuth): IAuthenticate;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the hash of a given user key
|
|
11
|
+
*/
|
|
12
|
+
export declare function hashUserKey(userKey: string): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IDecodedJWTToken } from '../../../utils/jwt/types';
|
|
2
|
+
export interface IAuthTokenPushEnabled {
|
|
3
|
+
pushEnabled: true;
|
|
4
|
+
token: string;
|
|
5
|
+
decodedToken: IDecodedJWTToken;
|
|
6
|
+
channels: {
|
|
7
|
+
[channel: string]: string[];
|
|
8
|
+
};
|
|
9
|
+
connDelay?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface IAuthTokenPushDisabled {
|
|
12
|
+
pushEnabled: false;
|
|
13
|
+
token: '';
|
|
14
|
+
}
|
|
15
|
+
export declare type IAuthToken = IAuthTokenPushDisabled | IAuthTokenPushEnabled;
|
|
16
|
+
export declare type IAuthenticate = (userKeys?: string[]) => Promise<IAuthToken>;
|
|
17
|
+
export declare type IAuthenticateV2 = (isClientSide?: boolean) => Promise<IAuthToken>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { IEventSourceConstructor } from '../../../services/types';
|
|
2
|
+
import { ISettings } from '../../../types';
|
|
3
|
+
import { IAuthTokenPushEnabled } from '../AuthClient/types';
|
|
4
|
+
import { ISSEClient, ISseEventHandler } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Handles streaming connections with EventSource API
|
|
7
|
+
*/
|
|
8
|
+
export declare class SSEClient implements ISSEClient {
|
|
9
|
+
eventSource?: IEventSourceConstructor;
|
|
10
|
+
streamingUrl: string;
|
|
11
|
+
connection?: InstanceType<IEventSourceConstructor>;
|
|
12
|
+
handler?: ISseEventHandler;
|
|
13
|
+
useHeaders?: boolean;
|
|
14
|
+
headers: Record<string, string>;
|
|
15
|
+
/**
|
|
16
|
+
* SSEClient constructor.
|
|
17
|
+
*
|
|
18
|
+
* @param settings Validated settings.
|
|
19
|
+
* @param useHeaders True to send metadata as headers or false to send as query params. If `true`, the provided EventSource must support headers.
|
|
20
|
+
* @param getEventSource Function to get the EventSource constructor.
|
|
21
|
+
* @throws 'EventSource API is not available. ' if EventSource is not available.
|
|
22
|
+
*/
|
|
23
|
+
constructor(settings: ISettings, useHeaders?: boolean, getEventSource?: () => (IEventSourceConstructor | undefined));
|
|
24
|
+
setEventHandler(handler: ISseEventHandler): void;
|
|
25
|
+
/**
|
|
26
|
+
* Open the connection with a given authToken
|
|
27
|
+
*
|
|
28
|
+
* @param {IAuthTokenPushEnabled} authToken
|
|
29
|
+
* @throws {TypeError} Will throw an error if `authToken` is undefined
|
|
30
|
+
*/
|
|
31
|
+
open(authToken: IAuthTokenPushEnabled): void;
|
|
32
|
+
/** Close connection */
|
|
33
|
+
close(): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IAuthTokenPushEnabled } from '../AuthClient/types';
|
|
2
|
+
export interface ISseEventHandler {
|
|
3
|
+
handleError: (ev: Event) => any;
|
|
4
|
+
handleMessage: (ev: MessageEvent) => any;
|
|
5
|
+
handleOpen: () => any;
|
|
6
|
+
}
|
|
7
|
+
export interface ISSEClient {
|
|
8
|
+
open(authToken: IAuthTokenPushEnabled): void;
|
|
9
|
+
close(): void;
|
|
10
|
+
setEventHandler(handler: ISseEventHandler): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ITelemetryTracker } from '../../../trackers/types';
|
|
2
|
+
import { ControlType } from '../constants';
|
|
3
|
+
import { IPushEventEmitter } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Factory of notification keeper, which process OCCUPANCY and CONTROL notifications and emits the corresponding push events.
|
|
6
|
+
*
|
|
7
|
+
* @param pushEmitter emitter for events related to streaming support
|
|
8
|
+
*/
|
|
9
|
+
export declare function notificationKeeperFactory(pushEmitter: IPushEventEmitter, telemetryTracker: ITelemetryTracker): {
|
|
10
|
+
handleOpen(): void;
|
|
11
|
+
isStreamingUp(): boolean;
|
|
12
|
+
handleOccupancyEvent(publishers: number, channel: string, timestamp: number): void;
|
|
13
|
+
handleControlEvent(controlType: ControlType, channel: string, timestamp: number): void;
|
|
14
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { INotificationMessage, INotificationError } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Parses the `data` JSON string, if exists, of a given SSE error notifications.
|
|
4
|
+
* HTTP errors handled by Ably (e.g., 400 due to invalid token, 401 due to expired token, 500) have the `data` property.
|
|
5
|
+
* Other network and HTTP errors do not have this property.
|
|
6
|
+
*
|
|
7
|
+
* @param {Object} error
|
|
8
|
+
* @throws {SyntaxError} if `error.data` is an invalid JSON string
|
|
9
|
+
*/
|
|
10
|
+
export declare function errorParser(error: Event): INotificationError;
|
|
11
|
+
/**
|
|
12
|
+
* Parses the `data` JSON string of a given SSE message notifications.
|
|
13
|
+
* Also assigns the type OCCUPANCY, if it corresponds, so that all supported messages (e.g., SPLIT_UPDATE, CONTROL) have a type.
|
|
14
|
+
*
|
|
15
|
+
* @param message
|
|
16
|
+
* @returns parsed notification message or undefined if the given event data is falsy (e.g, '' or undefined).
|
|
17
|
+
* For example, the EventSource implementation of React-Native for iOS emits a message event with empty data for Ably keepalive comments.
|
|
18
|
+
* @throws {SyntaxError} if `message.data` or `JSON.parse(message.data).data` are invalid JSON strings
|
|
19
|
+
*/
|
|
20
|
+
export declare function messageParser(message: MessageEvent): INotificationMessage | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IPushEventEmitter } from '../types';
|
|
2
|
+
import { ISseEventHandler } from '../SSEClient/types';
|
|
3
|
+
import { ILogger } from '../../../logger/types';
|
|
4
|
+
import { ITelemetryTracker } from '../../../trackers/types';
|
|
5
|
+
/**
|
|
6
|
+
* Factory for SSEHandler, which processes SSEClient messages and emits the corresponding push events.
|
|
7
|
+
*
|
|
8
|
+
* @param log factory logger
|
|
9
|
+
* @param pushEmitter emitter for events related to streaming support
|
|
10
|
+
*/
|
|
11
|
+
export declare function SSEHandlerFactory(log: ILogger, pushEmitter: IPushEventEmitter, telemetryTracker: ITelemetryTracker): ISseEventHandler;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ControlType } from '../constants';
|
|
2
|
+
import { MY_SEGMENTS_UPDATE, MY_SEGMENTS_UPDATE_V2, SEGMENT_UPDATE, SPLIT_UPDATE, SPLIT_KILL, CONTROL, OCCUPANCY } from '../types';
|
|
3
|
+
export interface IMySegmentsUpdateData {
|
|
4
|
+
type: MY_SEGMENTS_UPDATE;
|
|
5
|
+
changeNumber: number;
|
|
6
|
+
includesPayload: boolean;
|
|
7
|
+
segmentList?: string[];
|
|
8
|
+
}
|
|
9
|
+
export declare enum Compression {
|
|
10
|
+
None = 0,
|
|
11
|
+
Gzip = 1,
|
|
12
|
+
Zlib = 2
|
|
13
|
+
}
|
|
14
|
+
export declare enum UpdateStrategy {
|
|
15
|
+
UnboundedFetchRequest = 0,
|
|
16
|
+
BoundedFetchRequest = 1,
|
|
17
|
+
KeyList = 2,
|
|
18
|
+
SegmentRemoval = 3
|
|
19
|
+
}
|
|
20
|
+
export interface KeyList {
|
|
21
|
+
a?: string[];
|
|
22
|
+
r?: string[];
|
|
23
|
+
}
|
|
24
|
+
export interface IMySegmentsUpdateV2Data {
|
|
25
|
+
type: MY_SEGMENTS_UPDATE_V2;
|
|
26
|
+
changeNumber: number;
|
|
27
|
+
segmentName: string;
|
|
28
|
+
c: Compression;
|
|
29
|
+
d: string;
|
|
30
|
+
u: UpdateStrategy;
|
|
31
|
+
}
|
|
32
|
+
export interface ISegmentUpdateData {
|
|
33
|
+
type: SEGMENT_UPDATE;
|
|
34
|
+
changeNumber: number;
|
|
35
|
+
segmentName: string;
|
|
36
|
+
}
|
|
37
|
+
export interface ISplitUpdateData {
|
|
38
|
+
type: SPLIT_UPDATE;
|
|
39
|
+
changeNumber: number;
|
|
40
|
+
}
|
|
41
|
+
export interface ISplitKillData {
|
|
42
|
+
type: SPLIT_KILL;
|
|
43
|
+
changeNumber: number;
|
|
44
|
+
splitName: string;
|
|
45
|
+
defaultTreatment: string;
|
|
46
|
+
}
|
|
47
|
+
export interface IControlData {
|
|
48
|
+
type: CONTROL;
|
|
49
|
+
controlType: ControlType;
|
|
50
|
+
}
|
|
51
|
+
export interface IOccupancyData {
|
|
52
|
+
type: OCCUPANCY;
|
|
53
|
+
metrics: {
|
|
54
|
+
publishers: number;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export declare type INotificationData = IMySegmentsUpdateData | IMySegmentsUpdateV2Data | ISegmentUpdateData | ISplitUpdateData | ISplitKillData | IControlData | IOccupancyData;
|
|
58
|
+
export declare type INotificationMessage = {
|
|
59
|
+
parsedData: INotificationData;
|
|
60
|
+
channel: string;
|
|
61
|
+
timestamp: number;
|
|
62
|
+
data: string;
|
|
63
|
+
};
|
|
64
|
+
export declare type INotificationError = Event & {
|
|
65
|
+
parsedData?: any;
|
|
66
|
+
message?: string;
|
|
67
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ILogger } from '../../../logger/types';
|
|
2
|
+
import { ISegmentsCacheSync } from '../../../storages/types';
|
|
3
|
+
import { ISegmentsSyncTask } from '../../polling/types';
|
|
4
|
+
import { IUpdateWorker } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* SegmentsUpdateWorker factory
|
|
7
|
+
*/
|
|
8
|
+
export declare function SegmentsUpdateWorker(log: ILogger, segmentsSyncTask: ISegmentsSyncTask, segmentsCache: ISegmentsCacheSync): IUpdateWorker;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ILogger } from '../../../logger/types';
|
|
2
|
+
import { ISplitsEventEmitter } from '../../../readiness/types';
|
|
3
|
+
import { ISplitsCacheSync } from '../../../storages/types';
|
|
4
|
+
import { ISegmentsSyncTask, ISplitsSyncTask } from '../../polling/types';
|
|
5
|
+
import { ISplitKillData } from '../SSEHandler/types';
|
|
6
|
+
import { IUpdateWorker } from './types';
|
|
7
|
+
/**
|
|
8
|
+
* SplitsUpdateWorker factory
|
|
9
|
+
*/
|
|
10
|
+
export declare function SplitsUpdateWorker(log: ILogger, splitsCache: ISplitsCacheSync, splitsSyncTask: ISplitsSyncTask, splitsEventEmitter: ISplitsEventEmitter, segmentsSyncTask?: ISegmentsSyncTask): IUpdateWorker & {
|
|
11
|
+
killSplit(event: ISplitKillData): void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const SECONDS_BEFORE_EXPIRATION = 600;
|
|
2
|
+
/**
|
|
3
|
+
* emitted on SSE and Authenticate non-recoverable errors, STREAMING_DISABLED control notification and authentication with pushEnabled false
|
|
4
|
+
* triggers `handleNonRetryableError` call
|
|
5
|
+
*/
|
|
6
|
+
export declare const PUSH_NONRETRYABLE_ERROR = "PUSH_NONRETRYABLE_ERROR";
|
|
7
|
+
/**
|
|
8
|
+
* emitted on SSE and Authenticate recoverable errors
|
|
9
|
+
* triggers `handleRetryableError` call
|
|
10
|
+
*/
|
|
11
|
+
export declare const PUSH_RETRYABLE_ERROR = "PUSH_RETRYABLE_ERROR";
|
|
12
|
+
/**
|
|
13
|
+
* emitted on STREAMING_RESUMED control notification, OCCUPANCY different than 0, and SSE onopen event
|
|
14
|
+
* triggers `stopPollingAndSyncAll` call
|
|
15
|
+
*/
|
|
16
|
+
export declare const PUSH_SUBSYSTEM_UP = "PUSH_SUBSYSTEM_UP";
|
|
17
|
+
/**
|
|
18
|
+
* emitted on STREAMING_PAUSED control notification, OCCUPANCY equal to 0, PUSH_NONRETRYABLE_ERROR and PUSH_RETRYABLE_ERROR events.
|
|
19
|
+
* triggers `startPolling` and `stopWorkers` calls
|
|
20
|
+
*/
|
|
21
|
+
export declare const PUSH_SUBSYSTEM_DOWN = "PUSH_SUBSYSTEM_DOWN";
|
|
22
|
+
export declare const MY_SEGMENTS_UPDATE = "MY_SEGMENTS_UPDATE";
|
|
23
|
+
export declare const MY_SEGMENTS_UPDATE_V2 = "MY_SEGMENTS_UPDATE_V2";
|
|
24
|
+
export declare const SEGMENT_UPDATE = "SEGMENT_UPDATE";
|
|
25
|
+
export declare const SPLIT_KILL = "SPLIT_KILL";
|
|
26
|
+
export declare const SPLIT_UPDATE = "SPLIT_UPDATE";
|
|
27
|
+
export declare const CONTROL = "CONTROL";
|
|
28
|
+
export declare const OCCUPANCY = "OCCUPANCY";
|
|
29
|
+
export declare enum ControlType {
|
|
30
|
+
STREAMING_DISABLED = "STREAMING_DISABLED",
|
|
31
|
+
STREAMING_PAUSED = "STREAMING_PAUSED",
|
|
32
|
+
STREAMING_RESUMED = "STREAMING_RESUMED",
|
|
33
|
+
STREAMING_RESET = "STREAMING_RESET"
|
|
34
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Compression, KeyList } from './SSEHandler/types';
|
|
2
|
+
/**
|
|
3
|
+
* Decode, decompress and parse the provided 'data' into a KeyList object
|
|
4
|
+
*
|
|
5
|
+
* @param {string} data
|
|
6
|
+
* @param {number} compression
|
|
7
|
+
* @returns {{a?: string[], r?: string[] }}
|
|
8
|
+
* @throws if data string cannot be decoded, decompressed or parsed
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseKeyList(data: string, compression: Compression): KeyList;
|
|
11
|
+
/**
|
|
12
|
+
* Decode, decompress and parse the provided 'data' into a Bitmap object
|
|
13
|
+
*
|
|
14
|
+
* @param {string} data
|
|
15
|
+
* @param {number} compression
|
|
16
|
+
* @returns {Uint8Array}
|
|
17
|
+
* @throws if data string cannot be decoded or decompressed
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseBitmap(data: string, compression: Compression): Uint8Array;
|
|
20
|
+
/**
|
|
21
|
+
* Check if the 'bitmap' bit at 'hash64hex' position is 1
|
|
22
|
+
*
|
|
23
|
+
* @param {Uint8Array} bitmap
|
|
24
|
+
* @param {string} hash64hex 16-chars string, representing a number in hexa
|
|
25
|
+
* @returns {boolean}
|
|
26
|
+
*/
|
|
27
|
+
export declare function isInBitmap(bitmap: Uint8Array, hash64hex: string): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IPushManager } from './types';
|
|
2
|
+
import { IPollingManager } from '../polling/types';
|
|
3
|
+
import { ISdkFactoryContextSync } from '../../sdkFactory/types';
|
|
4
|
+
/**
|
|
5
|
+
* PushManager factory:
|
|
6
|
+
* - for server-side if key is not provided in settings.
|
|
7
|
+
* - for client-side, with support for multiple clients, if key is provided in settings
|
|
8
|
+
*/
|
|
9
|
+
export declare function pushManagerFactory(params: ISdkFactoryContextSync, pollingManager: IPollingManager): IPushManager | undefined;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IMySegmentsUpdateData, IMySegmentsUpdateV2Data, ISegmentUpdateData, ISplitUpdateData, ISplitKillData } from './SSEHandler/types';
|
|
2
|
+
import { ITask } from '../types';
|
|
3
|
+
import { IMySegmentsSyncTask } from '../polling/types';
|
|
4
|
+
import { IEventEmitter } from '../../types';
|
|
5
|
+
import { ControlType } from './constants';
|
|
6
|
+
export declare type PUSH_SUBSYSTEM_UP = 'PUSH_SUBSYSTEM_UP';
|
|
7
|
+
export declare type PUSH_SUBSYSTEM_DOWN = 'PUSH_SUBSYSTEM_DOWN';
|
|
8
|
+
export declare type PUSH_NONRETRYABLE_ERROR = 'PUSH_NONRETRYABLE_ERROR';
|
|
9
|
+
export declare type PUSH_RETRYABLE_ERROR = 'PUSH_RETRYABLE_ERROR';
|
|
10
|
+
export declare type MY_SEGMENTS_UPDATE = 'MY_SEGMENTS_UPDATE';
|
|
11
|
+
export declare type MY_SEGMENTS_UPDATE_V2 = 'MY_SEGMENTS_UPDATE_V2';
|
|
12
|
+
export declare type SEGMENT_UPDATE = 'SEGMENT_UPDATE';
|
|
13
|
+
export declare type SPLIT_KILL = 'SPLIT_KILL';
|
|
14
|
+
export declare type SPLIT_UPDATE = 'SPLIT_UPDATE';
|
|
15
|
+
export declare type CONTROL = 'CONTROL';
|
|
16
|
+
export declare type OCCUPANCY = 'OCCUPANCY';
|
|
17
|
+
export declare type IPushEvent = PUSH_SUBSYSTEM_UP | PUSH_SUBSYSTEM_DOWN | PUSH_NONRETRYABLE_ERROR | PUSH_RETRYABLE_ERROR | MY_SEGMENTS_UPDATE | MY_SEGMENTS_UPDATE_V2 | SEGMENT_UPDATE | SPLIT_UPDATE | SPLIT_KILL | ControlType.STREAMING_RESET;
|
|
18
|
+
declare type IParsedData<T extends IPushEvent> = T extends MY_SEGMENTS_UPDATE ? IMySegmentsUpdateData : T extends MY_SEGMENTS_UPDATE_V2 ? IMySegmentsUpdateV2Data : T extends SEGMENT_UPDATE ? ISegmentUpdateData : T extends SPLIT_UPDATE ? ISplitUpdateData : T extends SPLIT_KILL ? ISplitKillData : undefined;
|
|
19
|
+
/**
|
|
20
|
+
* EventEmitter used as Feedback Loop between the SyncManager and PushManager,
|
|
21
|
+
* where the latter pushes messages and the former consumes it
|
|
22
|
+
*/
|
|
23
|
+
export interface IPushEventEmitter extends IEventEmitter {
|
|
24
|
+
once<T extends IPushEvent>(event: T, listener: (parsedData: IParsedData<T>, channel: T extends MY_SEGMENTS_UPDATE ? string : undefined) => void): this;
|
|
25
|
+
on<T extends IPushEvent>(event: T, listener: (parsedData: IParsedData<T>, channel: T extends MY_SEGMENTS_UPDATE ? string : undefined) => void): this;
|
|
26
|
+
emit<T extends IPushEvent>(event: T, parsedData?: IParsedData<T>, channel?: T extends MY_SEGMENTS_UPDATE ? string : undefined): boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* PushManager
|
|
30
|
+
*/
|
|
31
|
+
export interface IPushManager extends ITask, IPushEventEmitter {
|
|
32
|
+
add(userKey: string, mySegmentsSyncTask: IMySegmentsSyncTask): void;
|
|
33
|
+
remove(userKey: string): void;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IEventsCacheSync } from '../../storages/types';
|
|
2
|
+
import { IPostEventsBulk } from '../../services/types';
|
|
3
|
+
import { ISyncTask, ITimeTracker } from '../types';
|
|
4
|
+
import { ILogger } from '../../logger/types';
|
|
5
|
+
/**
|
|
6
|
+
* Sync task that periodically posts tracked events
|
|
7
|
+
*/
|
|
8
|
+
export declare function eventsSyncTaskFactory(log: ILogger, postEventsBulk: IPostEventsBulk, eventsCache: IEventsCacheSync, eventsPushRate: number, eventsFirstPushWindow: number, latencyTracker?: ITimeTracker): ISyncTask;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ISdkFactoryContextSync } from '../../sdkFactory/types';
|
|
2
|
+
import { ImpressionCountsPayload } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Converts `impressionCounts` data from cache into request payload.
|
|
5
|
+
*/
|
|
6
|
+
export declare function fromImpressionCountsCollector(impressionsCount: Record<string, number>): ImpressionCountsPayload;
|
|
7
|
+
/**
|
|
8
|
+
* Submitter that periodically posts impression counts
|
|
9
|
+
*/
|
|
10
|
+
export declare function impressionCountsSubmitterFactory(params: ISdkFactoryContextSync): import("../types").ISyncTask<[], void> | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ISyncTask, ITimeTracker } from '../types';
|
|
2
|
+
import { IPostTestImpressionsCount } from '../../services/types';
|
|
3
|
+
import { IImpressionCountsCacheSync } from '../../storages/types';
|
|
4
|
+
import { ImpressionCountsPayload } from './types';
|
|
5
|
+
import { ILogger } from '../../logger/types';
|
|
6
|
+
/**
|
|
7
|
+
* Converts `impressionCounts` data from cache into request payload.
|
|
8
|
+
*/
|
|
9
|
+
export declare function fromImpressionCountsCollector(impressionsCount: Record<string, number>): ImpressionCountsPayload;
|
|
10
|
+
/**
|
|
11
|
+
* Sync task that periodically posts impression counts
|
|
12
|
+
*/
|
|
13
|
+
export declare function impressionCountsSyncTaskFactory(log: ILogger, postTestImpressionsCount: IPostTestImpressionsCount, impressionCountsCache: IImpressionCountsCacheSync, latencyTracker?: ITimeTracker): ISyncTask;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ImpressionDTO } from '../../types';
|
|
2
|
+
import { ImpressionsPayload } from './types';
|
|
3
|
+
import { ISdkFactoryContextSync } from '../../sdkFactory/types';
|
|
4
|
+
/**
|
|
5
|
+
* Converts `impressions` data from cache into request payload.
|
|
6
|
+
*/
|
|
7
|
+
export declare function fromImpressionsCollector(sendLabels: boolean, data: ImpressionDTO[]): ImpressionsPayload;
|
|
8
|
+
/**
|
|
9
|
+
* Submitter that periodically posts impressions data
|
|
10
|
+
*/
|
|
11
|
+
export declare function impressionsSubmitterFactory(params: ISdkFactoryContextSync): import("../types").ISyncTask<[], void>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ISyncTask, ITimeTracker } from '../types';
|
|
2
|
+
import { IPostTestImpressionsBulk } from '../../services/types';
|
|
3
|
+
import { IImpressionsCacheSync } from '../../storages/types';
|
|
4
|
+
import { ImpressionDTO } from '../../types';
|
|
5
|
+
import { ImpressionsPayload } from './types';
|
|
6
|
+
import { ILogger } from '../../logger/types';
|
|
7
|
+
/**
|
|
8
|
+
* Converts `impressions` data from cache into request payload.
|
|
9
|
+
*/
|
|
10
|
+
export declare function fromImpressionsCollector(sendLabels: boolean, data: ImpressionDTO[]): ImpressionsPayload;
|
|
11
|
+
/**
|
|
12
|
+
* Sync task that periodically posts impressions data
|
|
13
|
+
*/
|
|
14
|
+
export declare function impressionsSyncTaskFactory(log: ILogger, postTestImpressionsBulk: IPostTestImpressionsBulk, impressionsCache: IImpressionsCacheSync, impressionsRefreshRate: number, sendLabels?: boolean, latencyTracker?: ITimeTracker): ISyncTask;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ICountsCacheSync, ILatenciesCacheSync } from '../../storages/types';
|
|
2
|
+
import { IPostMetricsCounters, IPostMetricsTimes } from '../../services/types';
|
|
3
|
+
import { ISyncTask, ITimeTracker } from '../types';
|
|
4
|
+
import { ILogger } from '../../logger/types';
|
|
5
|
+
/**
|
|
6
|
+
* Sync task that periodically posts telemetry counts
|
|
7
|
+
*/
|
|
8
|
+
export declare function countsSyncTaskFactory(log: ILogger, postMetricsCounters: IPostMetricsCounters, countsCache: ICountsCacheSync, metricsRefreshRate: number, latencyTracker?: ITimeTracker): ISyncTask;
|
|
9
|
+
/**
|
|
10
|
+
* Sync task that periodically posts telemetry latencies
|
|
11
|
+
*/
|
|
12
|
+
export declare function latenciesSyncTaskFactory(log: ILogger, postMetricsLatencies: IPostMetricsTimes, latenciesCache: ILatenciesCacheSync, metricsRefreshRate: number, latencyTracker?: ITimeTracker): ISyncTask;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ISyncTask } from '../types';
|
|
2
|
+
import { IRecorderCacheProducerSync } from '../../storages/types';
|
|
3
|
+
import { ILogger } from '../../logger/types';
|
|
4
|
+
import { IResponse } from '../../services/types';
|
|
5
|
+
/**
|
|
6
|
+
* Base function to create submitters, such as ImpressionsSubmitter and EventsSubmitter
|
|
7
|
+
*/
|
|
8
|
+
export declare function submitterFactory<T>(log: ILogger, postClient: (body: string) => Promise<IResponse>, sourceCache: IRecorderCacheProducerSync<T>, postRate: number, dataName: string, fromCacheToPayload?: (cacheData: T) => any, maxRetries?: number, debugLogs?: boolean): ISyncTask<[], void>;
|
|
9
|
+
/**
|
|
10
|
+
* Decorates a provided submitter with a first execution window
|
|
11
|
+
*/
|
|
12
|
+
export declare function firstPushWindowDecorator(submitter: ISyncTask, firstPushWindow: number): ISyncTask<[], any>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ISyncTask, ITimeTracker } from '../types';
|
|
2
|
+
import { IRecorderCacheProducerSync } from '../../storages/types';
|
|
3
|
+
import { ILogger } from '../../logger/types';
|
|
4
|
+
import { IResponse } from '../../services/types';
|
|
5
|
+
/**
|
|
6
|
+
* Base function to create submitter sync tasks, such as ImpressionsSyncTask and EventsSyncTask
|
|
7
|
+
*/
|
|
8
|
+
export declare function submitterSyncTaskFactory<TState extends {
|
|
9
|
+
length?: number;
|
|
10
|
+
}>(log: ILogger, postClient: (body: string) => Promise<IResponse>, sourceCache: IRecorderCacheProducerSync<TState>, postRate: number, dataName: string, latencyTracker?: ITimeTracker, fromCacheToPayload?: (cacheData: TState) => any, maxRetries?: number, debugLogs?: boolean): ISyncTask<[], void>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ISegmentsCacheSync, ISplitsCacheSync, ITelemetryCacheSync } from '../../storages/types';
|
|
2
|
+
import { TelemetryUsageStatsPayload, TelemetryConfigStatsPayload, TelemetryConfigStats } from './types';
|
|
3
|
+
import { ISettings, SDKMode } from '../../types';
|
|
4
|
+
import { ISdkFactoryContextSync } from '../../sdkFactory/types';
|
|
5
|
+
/**
|
|
6
|
+
* Converts data from telemetry cache into /metrics/usage request payload.
|
|
7
|
+
*/
|
|
8
|
+
export declare function telemetryCacheStatsAdapter(telemetry: ITelemetryCacheSync, splits: ISplitsCacheSync, segments: ISegmentsCacheSync): {
|
|
9
|
+
isEmpty(): boolean;
|
|
10
|
+
clear(): void;
|
|
11
|
+
pop(): TelemetryUsageStatsPayload;
|
|
12
|
+
};
|
|
13
|
+
export declare function getTelemetryConfigStats(mode: SDKMode, storageType: string): TelemetryConfigStats;
|
|
14
|
+
/**
|
|
15
|
+
* Converts data from telemetry cache and settings into /metrics/config request payload.
|
|
16
|
+
*/
|
|
17
|
+
export declare function telemetryCacheConfigAdapter(telemetry: ITelemetryCacheSync, settings: ISettings): {
|
|
18
|
+
isEmpty(): boolean;
|
|
19
|
+
clear(): void;
|
|
20
|
+
pop(): TelemetryConfigStatsPayload;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Submitter that periodically posts telemetry data
|
|
24
|
+
*/
|
|
25
|
+
export declare function telemetrySubmitterFactory(params: ISdkFactoryContextSync): import("../types").ISyncTask<[], any> | undefined;
|