@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,55 @@
|
|
|
1
|
+
import { ISegmentsCacheSync } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* This class provides a skeletal implementation of the ISegmentsCacheSync interface
|
|
4
|
+
* to minimize the effort required to implement this interface.
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class AbstractSegmentsCacheSync implements ISegmentsCacheSync {
|
|
7
|
+
/**
|
|
8
|
+
* For server-side synchronizer: add `segmentKeys` list of keys to `name` segment.
|
|
9
|
+
* For client-side synchronizer: add `name` segment to the cache. `segmentKeys` is undefined.
|
|
10
|
+
*/
|
|
11
|
+
abstract addToSegment(name: string, segmentKeys?: string[]): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* For server-side synchronizer: remove `segmentKeys` list of keys from `name` segment.
|
|
14
|
+
* For client-side synchronizer: remove `name` segment from the cache. `segmentKeys` is undefined.
|
|
15
|
+
*/
|
|
16
|
+
abstract removeFromSegment(name: string, segmentKeys?: string[]): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* For server-side synchronizer: check if `key` is in `name` segment.
|
|
19
|
+
* For client-side synchronizer: check if `name` segment is in the cache. `key` is undefined.
|
|
20
|
+
*/
|
|
21
|
+
abstract isInSegment(name: string, key?: string): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* clear the cache.
|
|
24
|
+
*/
|
|
25
|
+
abstract clear(): void;
|
|
26
|
+
/**
|
|
27
|
+
* For server-side synchronizer: add the given list of segments to the cache, with an empty list of keys. The segments that already exist are not modified.
|
|
28
|
+
* For client-side synchronizer: the method is not used.
|
|
29
|
+
*/
|
|
30
|
+
registerSegments(names: string[]): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* For server-side synchronizer: get the list of segments to fetch changes.
|
|
33
|
+
* Also used for the `seC` (segment count) telemetry stat.
|
|
34
|
+
*/
|
|
35
|
+
abstract getRegisteredSegments(): string[];
|
|
36
|
+
/**
|
|
37
|
+
* Only used for the `skC`(segment keys count) telemetry stat: 1 for client-side, and total count of keys in server-side.
|
|
38
|
+
*/
|
|
39
|
+
abstract getKeysCount(): number;
|
|
40
|
+
/**
|
|
41
|
+
* For server-side synchronizer: set the change number of `name` segment.
|
|
42
|
+
* For client-side synchronizer: the method is not used.
|
|
43
|
+
*/
|
|
44
|
+
setChangeNumber(name: string, changeNumber: number): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* For server-side synchronizer: get the change number of `name` segment.
|
|
47
|
+
* For client-side synchronizer: the method is not used.
|
|
48
|
+
*/
|
|
49
|
+
getChangeNumber(name: string): number;
|
|
50
|
+
/**
|
|
51
|
+
* For server-side synchronizer: the method is not used.
|
|
52
|
+
* For client-side synchronizer: reset the cache with the given list of segments.
|
|
53
|
+
*/
|
|
54
|
+
resetSegments(names: string[]): boolean;
|
|
55
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ISplitsCacheAsync } from './types';
|
|
2
|
+
import { ISplit } from '../dtos/types';
|
|
3
|
+
/**
|
|
4
|
+
* This class provides a skeletal implementation of the ISplitsCacheAsync interface
|
|
5
|
+
* to minimize the effort required to implement this interface.
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class AbstractSplitsCacheAsync implements ISplitsCacheAsync {
|
|
8
|
+
abstract addSplit(name: string, split: ISplit): Promise<boolean>;
|
|
9
|
+
abstract addSplits(entries: [string, ISplit][]): Promise<boolean[] | void>;
|
|
10
|
+
abstract removeSplits(names: string[]): Promise<boolean[] | void>;
|
|
11
|
+
abstract getSplit(name: string): Promise<ISplit | null>;
|
|
12
|
+
abstract getSplits(names: string[]): Promise<Record<string, ISplit | null>>;
|
|
13
|
+
abstract setChangeNumber(changeNumber: number): Promise<boolean | void>;
|
|
14
|
+
abstract getChangeNumber(): Promise<number>;
|
|
15
|
+
abstract getAll(): Promise<ISplit[]>;
|
|
16
|
+
abstract getSplitNames(): Promise<string[]>;
|
|
17
|
+
abstract trafficTypeExists(trafficType: string): Promise<boolean>;
|
|
18
|
+
abstract clear(): Promise<boolean | void>;
|
|
19
|
+
usesSegments(): Promise<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* Check if the splits information is already stored in cache.
|
|
22
|
+
* Noop, just keeping the interface. This is used by client-side implementations only.
|
|
23
|
+
*/
|
|
24
|
+
checkCache(): Promise<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* Kill `name` split and set `defaultTreatment` and `changeNumber`.
|
|
27
|
+
* Used for SPLIT_KILL push notifications.
|
|
28
|
+
*
|
|
29
|
+
* @param {string} name
|
|
30
|
+
* @param {string} defaultTreatment
|
|
31
|
+
* @param {number} changeNumber
|
|
32
|
+
* @returns {Promise} a promise that is resolved once the split kill operation is performed. The fulfillment value is a boolean: `true` if the kill success updating the split or `false` if no split is updated,
|
|
33
|
+
* for instance, if the `changeNumber` is old, or if the split is not found (e.g., `/splitchanges` hasn't been fetched yet), or if the storage fails to apply the update.
|
|
34
|
+
* The promise will never be rejected.
|
|
35
|
+
*/
|
|
36
|
+
killLocally(name: string, defaultTreatment: string, changeNumber: number): Promise<boolean>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ISplitsCacheSync } from './types';
|
|
2
|
+
import { ISplit } from '../dtos/types';
|
|
3
|
+
/**
|
|
4
|
+
* This class provides a skeletal implementation of the ISplitsCacheSync interface
|
|
5
|
+
* to minimize the effort required to implement this interface.
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class AbstractSplitsCacheSync implements ISplitsCacheSync {
|
|
8
|
+
abstract addSplit(name: string, split: ISplit): boolean;
|
|
9
|
+
addSplits(entries: [string, ISplit][]): boolean[];
|
|
10
|
+
abstract removeSplit(name: string): boolean;
|
|
11
|
+
removeSplits(names: string[]): boolean[];
|
|
12
|
+
abstract getSplit(name: string): ISplit | null;
|
|
13
|
+
getSplits(names: string[]): Record<string, ISplit | null>;
|
|
14
|
+
abstract setChangeNumber(changeNumber: number): boolean;
|
|
15
|
+
abstract getChangeNumber(): number;
|
|
16
|
+
getAll(): ISplit[];
|
|
17
|
+
abstract getSplitNames(): string[];
|
|
18
|
+
abstract trafficTypeExists(trafficType: string): boolean;
|
|
19
|
+
abstract usesSegments(): boolean;
|
|
20
|
+
abstract clear(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Check if the splits information is already stored in cache. This data can be preloaded.
|
|
23
|
+
* It is used as condition to emit SDK_SPLITS_CACHE_LOADED, and then SDK_READY_FROM_CACHE.
|
|
24
|
+
*/
|
|
25
|
+
checkCache(): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Kill `name` split and set `defaultTreatment` and `changeNumber`.
|
|
28
|
+
* Used for SPLIT_KILL push notifications.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} name
|
|
31
|
+
* @param {string} defaultTreatment
|
|
32
|
+
* @param {number} changeNumber
|
|
33
|
+
* @returns {Promise} a promise that is resolved once the split kill is performed. The fulfillment value is a boolean: `true` if the kill success updating the split or `false` if no split is updated,
|
|
34
|
+
* for instance, if the `changeNumber` is old, or if the split is not found (e.g., `/splitchanges` hasn't been fetched yet), or if the storage fails to apply the update.
|
|
35
|
+
*/
|
|
36
|
+
killLocally(name: string, defaultTreatment: string, changeNumber: number): boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Given a parsed split, it returns a boolean flagging if its conditions use segments matchers (rules & whitelists).
|
|
40
|
+
* This util is intended to simplify the implementation of `splitsCache::usesSegments` method
|
|
41
|
+
*/
|
|
42
|
+
export declare function usesSegments(split: ISplit): boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare function validatePrefix(prefix: unknown): string;
|
|
2
|
+
export declare class KeyBuilder {
|
|
3
|
+
protected readonly prefix: string;
|
|
4
|
+
constructor(prefix?: string);
|
|
5
|
+
buildTrafficTypeKey(trafficType: string): string;
|
|
6
|
+
buildSplitKey(splitName: string): string;
|
|
7
|
+
buildSplitsTillKey(): string;
|
|
8
|
+
isSplitKey(key: string): boolean;
|
|
9
|
+
buildSplitKeyPrefix(): string;
|
|
10
|
+
buildSplitsWithSegmentCountKey(): string;
|
|
11
|
+
buildSegmentNameKey(segmentName: string): string;
|
|
12
|
+
buildSegmentTillKey(segmentName: string): string;
|
|
13
|
+
extractKey(builtKey: string): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { KeyBuilder } from './KeyBuilder';
|
|
2
|
+
export declare class KeyBuilderCS extends KeyBuilder {
|
|
3
|
+
protected readonly regexSplitsCacheKey: RegExp;
|
|
4
|
+
protected readonly matchingKey: string;
|
|
5
|
+
constructor(prefix: string, matchingKey: string);
|
|
6
|
+
/**
|
|
7
|
+
* @override
|
|
8
|
+
*/
|
|
9
|
+
buildSegmentNameKey(segmentName: string): string;
|
|
10
|
+
extractSegmentName(builtSegmentKeyName: string): string | undefined;
|
|
11
|
+
buildOldSegmentNameKey(segmentName: string): string;
|
|
12
|
+
extractOldSegmentKey(builtSegmentKeyName: string): string | undefined;
|
|
13
|
+
buildLastUpdatedKey(): string;
|
|
14
|
+
isSplitsCacheKey(key: string): boolean;
|
|
15
|
+
buildSplitsFilterQueryKey(): string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { KeyBuilder } from './KeyBuilder';
|
|
2
|
+
import { IMetadata } from '../dtos/types';
|
|
3
|
+
import { Method } from '../sync/submitters/types';
|
|
4
|
+
export declare class KeyBuilderSS extends KeyBuilder {
|
|
5
|
+
protected readonly metadata: IMetadata;
|
|
6
|
+
constructor(prefix: string, metadata: IMetadata);
|
|
7
|
+
buildRegisteredSegmentsKey(): string;
|
|
8
|
+
buildImpressionsKey(): string;
|
|
9
|
+
buildImpressionsCountKey(): string;
|
|
10
|
+
buildUniqueKeysKey(): string;
|
|
11
|
+
buildEventsKey(): string;
|
|
12
|
+
searchPatternForSplitKeys(): string;
|
|
13
|
+
buildLatencyKey(method: Method, bucket: number): string;
|
|
14
|
+
buildExceptionKey(method: Method): string;
|
|
15
|
+
buildInitKey(): string;
|
|
16
|
+
private buildVersionablePrefix;
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SplitIO } from '../types';
|
|
2
|
+
import { DataLoader } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Factory of client-side storage loader
|
|
5
|
+
*
|
|
6
|
+
* @param preloadedData validated data following the format proposed in https://github.com/godaddy/split-javascript-data-loader
|
|
7
|
+
* and extended with a `mySegmentsData` property.
|
|
8
|
+
* @returns function to preload the storage
|
|
9
|
+
*/
|
|
10
|
+
export declare function dataLoaderFactory(preloadedData: SplitIO.PreloadedData): DataLoader;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ILogger } from '../../logger/types';
|
|
2
|
+
import { AbstractSegmentsCacheSync } from '../AbstractSegmentsCacheSync';
|
|
3
|
+
import { KeyBuilderCS } from '../KeyBuilderCS';
|
|
4
|
+
export declare class MySegmentsCacheInLocal extends AbstractSegmentsCacheSync {
|
|
5
|
+
private readonly keys;
|
|
6
|
+
private readonly log;
|
|
7
|
+
constructor(log: ILogger, keys: KeyBuilderCS);
|
|
8
|
+
/**
|
|
9
|
+
* Removes list of segments from localStorage
|
|
10
|
+
* @NOTE this method is not being used at the moment.
|
|
11
|
+
*/
|
|
12
|
+
clear(): void;
|
|
13
|
+
addToSegment(name: string): boolean;
|
|
14
|
+
removeFromSegment(name: string): boolean;
|
|
15
|
+
isInSegment(name: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Reset (update) the cached list of segments with the given list, removing and adding segments if necessary.
|
|
18
|
+
*
|
|
19
|
+
* @param {string[]} segmentNames list of segment names
|
|
20
|
+
* @returns boolean indicating if the cache was updated (i.e., given list was different from the cached one)
|
|
21
|
+
*/
|
|
22
|
+
resetSegments(names: string[]): boolean;
|
|
23
|
+
getRegisteredSegments(): string[];
|
|
24
|
+
getKeysCount(): number;
|
|
25
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ISplit, ISplitFiltersValidation } from '../../dtos/types';
|
|
2
|
+
import { AbstractSplitsCacheSync } from '../AbstractSplitsCacheSync';
|
|
3
|
+
import { KeyBuilderCS } from '../KeyBuilderCS';
|
|
4
|
+
import { ILogger } from '../../logger/types';
|
|
5
|
+
/**
|
|
6
|
+
* ISplitsCacheSync implementation that stores split definitions in browser LocalStorage.
|
|
7
|
+
*/
|
|
8
|
+
export declare class SplitsCacheInLocal extends AbstractSplitsCacheSync {
|
|
9
|
+
private readonly log;
|
|
10
|
+
private readonly keys;
|
|
11
|
+
private readonly splitFiltersValidation;
|
|
12
|
+
private hasSync?;
|
|
13
|
+
private cacheReadyButNeedsToFlush;
|
|
14
|
+
private updateNewFilter?;
|
|
15
|
+
/**
|
|
16
|
+
* @param {KeyBuilderCS} keys
|
|
17
|
+
* @param {number | undefined} expirationTimestamp
|
|
18
|
+
* @param {ISplitFiltersValidation} splitFiltersValidation
|
|
19
|
+
*/
|
|
20
|
+
constructor(log: ILogger, keys: KeyBuilderCS, expirationTimestamp?: number, splitFiltersValidation?: ISplitFiltersValidation);
|
|
21
|
+
private _decrementCount;
|
|
22
|
+
private _decrementCounts;
|
|
23
|
+
private _incrementCounts;
|
|
24
|
+
/**
|
|
25
|
+
* Removes all splits cache related data from localStorage (splits, counters, changeNumber and lastUpdated).
|
|
26
|
+
* We cannot simply call `localStorage.clear()` since that implies removing user items from the storage.
|
|
27
|
+
*/
|
|
28
|
+
clear(): void;
|
|
29
|
+
addSplit(name: string, split: ISplit): boolean;
|
|
30
|
+
removeSplit(name: string): boolean;
|
|
31
|
+
getSplit(name: string): any;
|
|
32
|
+
setChangeNumber(changeNumber: number): boolean;
|
|
33
|
+
getChangeNumber(): number;
|
|
34
|
+
getSplitNames(): string[];
|
|
35
|
+
trafficTypeExists(trafficType: string): boolean;
|
|
36
|
+
usesSegments(): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Check if the splits information is already stored in browser LocalStorage.
|
|
39
|
+
* In this function we could add more code to check if the data is valid.
|
|
40
|
+
* @override
|
|
41
|
+
*/
|
|
42
|
+
checkCache(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Clean Splits cache if its `lastUpdated` timestamp is older than the given `expirationTimestamp`,
|
|
45
|
+
* Clean operation (clear) also updates `lastUpdated` timestamp with current time.
|
|
46
|
+
*
|
|
47
|
+
* @param {number | undefined} expirationTimestamp if the value is not a number, data will not be cleaned
|
|
48
|
+
*/
|
|
49
|
+
private _checkExpiration;
|
|
50
|
+
private _checkFilterQuery;
|
|
51
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IStorageSyncFactory } from '../types';
|
|
2
|
+
export interface InLocalStorageOptions {
|
|
3
|
+
prefix?: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* InLocal storage factory for standalone client-side SplitFactory
|
|
7
|
+
*/
|
|
8
|
+
export declare function InLocalStorage(options?: InLocalStorageOptions): IStorageSyncFactory;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare class AttributesCacheInMemory {
|
|
2
|
+
private attributesCache;
|
|
3
|
+
/**
|
|
4
|
+
* Create or update the value for the given attribute
|
|
5
|
+
*
|
|
6
|
+
* @param {string} attributeName attribute name
|
|
7
|
+
* @param {Object} attributeValue attribute value
|
|
8
|
+
* @returns {boolean} the attribute was stored
|
|
9
|
+
*/
|
|
10
|
+
setAttribute(attributeName: string, attributeValue: Object): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves the value of a given attribute
|
|
13
|
+
*
|
|
14
|
+
* @param {string} attributeName attribute name
|
|
15
|
+
* @returns {Object?} stored attribute value
|
|
16
|
+
*/
|
|
17
|
+
getAttribute(attributeName: string): Object;
|
|
18
|
+
/**
|
|
19
|
+
* Create or update all the given attributes
|
|
20
|
+
*
|
|
21
|
+
* @param {[string, Object]} attributes attributes to create or update
|
|
22
|
+
* @returns {boolean} attributes were stored
|
|
23
|
+
*/
|
|
24
|
+
setAttributes(attributes: Record<string, Object>): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Retrieve the full attributes map
|
|
27
|
+
*
|
|
28
|
+
* @returns {Map<string, Object>} stored attributes
|
|
29
|
+
*/
|
|
30
|
+
getAll(): Record<string, Object>;
|
|
31
|
+
/**
|
|
32
|
+
* Removes a given attribute from the map
|
|
33
|
+
*
|
|
34
|
+
* @param {string} attributeName attribute to remove
|
|
35
|
+
* @returns {boolean} attribute removed
|
|
36
|
+
*/
|
|
37
|
+
removeAttribute(attributeName: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Clears all attributes stored in the SDK
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
clear(): boolean;
|
|
43
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ICountsCacheSync } from '../types';
|
|
2
|
+
export declare class CountsCacheInMemory implements ICountsCacheSync {
|
|
3
|
+
private counters;
|
|
4
|
+
/**
|
|
5
|
+
* Add counts.
|
|
6
|
+
*/
|
|
7
|
+
track(metricName: string): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Clear the collector
|
|
10
|
+
*/
|
|
11
|
+
clear(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Get the collected data, used as payload for posting.
|
|
14
|
+
*/
|
|
15
|
+
state(): Record<string, number>;
|
|
16
|
+
/**
|
|
17
|
+
* Check if the cache is empty.
|
|
18
|
+
*/
|
|
19
|
+
isEmpty(): boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SplitIO } from '../../types';
|
|
2
|
+
import { IEventsCacheSync } from '../types';
|
|
3
|
+
export declare class EventsCacheInMemory implements IEventsCacheSync {
|
|
4
|
+
private onFullQueue?;
|
|
5
|
+
private readonly maxQueue;
|
|
6
|
+
private queue;
|
|
7
|
+
private queueByteSize;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param eventsQueueSize number of queued events to call onFullQueueCb.
|
|
11
|
+
* Default value is 0, that means no maximum value, in case we want to avoid this being triggered.
|
|
12
|
+
*/
|
|
13
|
+
constructor(eventsQueueSize?: number);
|
|
14
|
+
setOnFullQueueCb(cb: () => void): void;
|
|
15
|
+
/**
|
|
16
|
+
* Add a new event object at the end of the queue.
|
|
17
|
+
*/
|
|
18
|
+
track(data: SplitIO.EventData, size?: number): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Clear the data stored on the cache.
|
|
21
|
+
*/
|
|
22
|
+
clear(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Pop the collected data, used as payload for posting.
|
|
25
|
+
*/
|
|
26
|
+
pop(toMerge?: SplitIO.EventData[]): SplitIO.EventData[];
|
|
27
|
+
/**
|
|
28
|
+
* Check if the cache is empty.
|
|
29
|
+
*/
|
|
30
|
+
isEmpty(): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Check if the cache queue is full and we need to flush it.
|
|
33
|
+
*/
|
|
34
|
+
private _checkForFlush;
|
|
35
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IImpressionCountsCacheSync } from '../types';
|
|
2
|
+
export declare class ImpressionCountsCacheInMemory implements IImpressionCountsCacheSync {
|
|
3
|
+
protected cache: Record<string, number>;
|
|
4
|
+
private readonly maxStorage;
|
|
5
|
+
protected onFullQueue?: () => void;
|
|
6
|
+
private cacheSize;
|
|
7
|
+
constructor(impressionCountsCacheSize?: number);
|
|
8
|
+
/**
|
|
9
|
+
* Builds key to be stored in the cache with the featureName and the timeFrame truncated.
|
|
10
|
+
*/
|
|
11
|
+
private _makeKey;
|
|
12
|
+
/**
|
|
13
|
+
* Increments the quantity of impressions with the passed featureName and timeFrame.
|
|
14
|
+
*/
|
|
15
|
+
track(featureName: string, timeFrame: number, amount: number): void;
|
|
16
|
+
/**
|
|
17
|
+
* Pop the collected data, used as payload for posting.
|
|
18
|
+
*/
|
|
19
|
+
pop(toMerge?: Record<string, number>): Record<string, number>;
|
|
20
|
+
/**
|
|
21
|
+
* Clear the data stored on the cache.
|
|
22
|
+
*/
|
|
23
|
+
clear(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Check if the cache is empty.
|
|
26
|
+
*/
|
|
27
|
+
isEmpty(): boolean;
|
|
28
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { IImpressionsCacheSync } from '../types';
|
|
2
|
+
import { ImpressionDTO } from '../../types';
|
|
3
|
+
export declare class ImpressionsCacheInMemory implements IImpressionsCacheSync {
|
|
4
|
+
private onFullQueue?;
|
|
5
|
+
private readonly maxQueue;
|
|
6
|
+
private queue;
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param impressionsQueueSize number of queued impressions to call onFullQueueCb.
|
|
10
|
+
* Default value is 0, that means no maximum value, in case we want to avoid this being triggered.
|
|
11
|
+
*/
|
|
12
|
+
constructor(impressionsQueueSize?: number);
|
|
13
|
+
setOnFullQueueCb(cb: () => void): void;
|
|
14
|
+
/**
|
|
15
|
+
* Store impressions in sequential order
|
|
16
|
+
*/
|
|
17
|
+
track(data: ImpressionDTO[]): void;
|
|
18
|
+
/**
|
|
19
|
+
* Clear the data stored on the cache.
|
|
20
|
+
*/
|
|
21
|
+
clear(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Pop the collected data, used as payload for posting.
|
|
24
|
+
*/
|
|
25
|
+
pop(toMerge?: ImpressionDTO[]): ImpressionDTO[];
|
|
26
|
+
/**
|
|
27
|
+
* Check if the cache is empty.
|
|
28
|
+
*/
|
|
29
|
+
isEmpty(): boolean;
|
|
30
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IStorageFactoryParams, IStorageSync } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* InMemory storage factory for standalone server-side SplitFactory
|
|
4
|
+
*
|
|
5
|
+
* @param params parameters required by EventsCacheSync
|
|
6
|
+
*/
|
|
7
|
+
export declare function InMemoryStorageFactory(params: IStorageFactoryParams): IStorageSync;
|
|
8
|
+
export declare namespace InMemoryStorageFactory {
|
|
9
|
+
var type: import("../types").StorageType;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IStorageSync, IStorageFactoryParams } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* InMemory storage factory for standalone client-side SplitFactory
|
|
4
|
+
*
|
|
5
|
+
* @param params parameters required by EventsCacheSync
|
|
6
|
+
*/
|
|
7
|
+
export declare function InMemoryStorageCSFactory(params: IStorageFactoryParams): IStorageSync;
|
|
8
|
+
export declare namespace InMemoryStorageCSFactory {
|
|
9
|
+
var type: import("../types").StorageType;
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ILatenciesCacheSync } from '../types';
|
|
2
|
+
export declare class LatenciesCacheInMemory implements ILatenciesCacheSync {
|
|
3
|
+
private counters;
|
|
4
|
+
/**
|
|
5
|
+
* Add latencies.
|
|
6
|
+
*/
|
|
7
|
+
track(metricName: string, latency: number): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Clear the collector
|
|
10
|
+
*/
|
|
11
|
+
clear(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Get the collected data, used as payload for posting.
|
|
14
|
+
*/
|
|
15
|
+
state(): Record<string, number[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Check if the cache is empty.
|
|
18
|
+
*/
|
|
19
|
+
isEmpty(): boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AbstractSegmentsCacheSync } from '../AbstractSegmentsCacheSync';
|
|
2
|
+
/**
|
|
3
|
+
* Default MySegmentsCacheInMemory implementation that stores MySegments in memory.
|
|
4
|
+
* Supported by all JS runtimes.
|
|
5
|
+
*/
|
|
6
|
+
export declare class MySegmentsCacheInMemory extends AbstractSegmentsCacheSync {
|
|
7
|
+
private segmentCache;
|
|
8
|
+
clear(): void;
|
|
9
|
+
addToSegment(name: string): boolean;
|
|
10
|
+
removeFromSegment(name: string): boolean;
|
|
11
|
+
isInSegment(name: string): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Reset (update) the cached list of segments with the given list, removing and adding segments if necessary.
|
|
14
|
+
* @NOTE based on the way we use segments in the browser, this way is the best option
|
|
15
|
+
*
|
|
16
|
+
* @param {string[]} names list of segment names
|
|
17
|
+
* @returns boolean indicating if the cache was updated (i.e., given list was different from the cached one)
|
|
18
|
+
*/
|
|
19
|
+
resetSegments(names: string[]): boolean;
|
|
20
|
+
getRegisteredSegments(): string[];
|
|
21
|
+
getKeysCount(): number;
|
|
22
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AbstractSegmentsCacheSync } from '../AbstractSegmentsCacheSync';
|
|
2
|
+
/**
|
|
3
|
+
* Default ISplitsCacheSync implementation that stores split definitions in memory.
|
|
4
|
+
* Supported by all JS runtimes.
|
|
5
|
+
*/
|
|
6
|
+
export declare class SegmentsCacheInMemory extends AbstractSegmentsCacheSync {
|
|
7
|
+
private segmentCache;
|
|
8
|
+
private segmentChangeNumber;
|
|
9
|
+
addToSegment(name: string, segmentKeys: string[]): boolean;
|
|
10
|
+
removeFromSegment(name: string, segmentKeys: string[]): boolean;
|
|
11
|
+
isInSegment(name: string, key: string): boolean;
|
|
12
|
+
clear(): void;
|
|
13
|
+
private _registerSegment;
|
|
14
|
+
registerSegments(names: string[]): boolean;
|
|
15
|
+
getRegisteredSegments(): string[];
|
|
16
|
+
getKeysCount(): number;
|
|
17
|
+
setChangeNumber(name: string, changeNumber: number): boolean;
|
|
18
|
+
getChangeNumber(name: string): number;
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ISplit } from '../../dtos/types';
|
|
2
|
+
import { AbstractSplitsCacheSync } from '../AbstractSplitsCacheSync';
|
|
3
|
+
/**
|
|
4
|
+
* Default ISplitsCacheSync implementation that stores split definitions in memory.
|
|
5
|
+
* Supported by all JS runtimes.
|
|
6
|
+
*/
|
|
7
|
+
export declare class SplitsCacheInMemory extends AbstractSplitsCacheSync {
|
|
8
|
+
private splitsCache;
|
|
9
|
+
private ttCache;
|
|
10
|
+
private changeNumber;
|
|
11
|
+
private splitsWithSegmentsCount;
|
|
12
|
+
clear(): void;
|
|
13
|
+
addSplit(name: string, split: ISplit): boolean;
|
|
14
|
+
removeSplit(name: string): boolean;
|
|
15
|
+
getSplit(name: string): ISplit | null;
|
|
16
|
+
setChangeNumber(changeNumber: number): boolean;
|
|
17
|
+
getChangeNumber(): number;
|
|
18
|
+
getSplitNames(): string[];
|
|
19
|
+
trafficTypeExists(trafficType: string): boolean;
|
|
20
|
+
usesSegments(): boolean;
|
|
21
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ImpressionDataType, EventDataType, LastSync, HttpErrors, HttpLatencies, StreamingEvent, Method, OperationType, MethodExceptions, MethodLatencies } from '../../sync/submitters/types';
|
|
2
|
+
import { ITelemetryCacheSync } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Used on client-side. 0.1% of instances will track telemetry
|
|
5
|
+
*/
|
|
6
|
+
export declare function shouldRecordTelemetry(): boolean;
|
|
7
|
+
export declare class TelemetryCacheInMemory implements ITelemetryCacheSync {
|
|
8
|
+
private timeUntilReady?;
|
|
9
|
+
getTimeUntilReady(): number | undefined;
|
|
10
|
+
recordTimeUntilReady(ms: number): void;
|
|
11
|
+
private timeUntilReadyFromCache?;
|
|
12
|
+
getTimeUntilReadyFromCache(): number | undefined;
|
|
13
|
+
recordTimeUntilReadyFromCache(ms: number): void;
|
|
14
|
+
private notReadyUsage;
|
|
15
|
+
getNonReadyUsage(): number;
|
|
16
|
+
recordNonReadyUsage(): void;
|
|
17
|
+
private impressionStats;
|
|
18
|
+
getImpressionStats(type: ImpressionDataType): number;
|
|
19
|
+
recordImpressionStats(type: ImpressionDataType, count: number): void;
|
|
20
|
+
private eventStats;
|
|
21
|
+
getEventStats(type: EventDataType): number;
|
|
22
|
+
recordEventStats(type: EventDataType, count: number): void;
|
|
23
|
+
private lastSync;
|
|
24
|
+
getLastSynchronization(): LastSync;
|
|
25
|
+
recordSuccessfulSync(resource: OperationType, timeMs: number): void;
|
|
26
|
+
private httpErrors;
|
|
27
|
+
popHttpErrors(): HttpErrors;
|
|
28
|
+
recordHttpError(resource: OperationType, status: number): void;
|
|
29
|
+
private httpLatencies;
|
|
30
|
+
popHttpLatencies(): HttpLatencies;
|
|
31
|
+
recordHttpLatency(resource: OperationType, latencyMs: number): void;
|
|
32
|
+
private authRejections;
|
|
33
|
+
popAuthRejections(): number;
|
|
34
|
+
recordAuthRejections(): void;
|
|
35
|
+
private tokenRefreshes;
|
|
36
|
+
popTokenRefreshes(): number;
|
|
37
|
+
recordTokenRefreshes(): void;
|
|
38
|
+
private streamingEvents;
|
|
39
|
+
popStreamingEvents(): StreamingEvent[];
|
|
40
|
+
recordStreamingEvents(streamingEvent: StreamingEvent): void;
|
|
41
|
+
private tags;
|
|
42
|
+
popTags(): string[];
|
|
43
|
+
addTag(tag: string): void;
|
|
44
|
+
private sessionLength?;
|
|
45
|
+
getSessionLength(): number | undefined;
|
|
46
|
+
recordSessionLength(ms: number): void;
|
|
47
|
+
private exceptions;
|
|
48
|
+
popExceptions(): MethodExceptions;
|
|
49
|
+
recordException(method: Method): void;
|
|
50
|
+
private latencies;
|
|
51
|
+
popLatencies(): MethodLatencies;
|
|
52
|
+
recordLatency(method: Method, latencyMs: number): void;
|
|
53
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IUniqueKeysCacheBase } from '../types';
|
|
2
|
+
import { ISet } from '../../utils/lang/sets';
|
|
3
|
+
import { UniqueKeysPayloadSs } from '../../sync/submitters/types';
|
|
4
|
+
export declare class UniqueKeysCacheInMemory implements IUniqueKeysCacheBase {
|
|
5
|
+
protected onFullQueue?: () => void;
|
|
6
|
+
private readonly maxStorage;
|
|
7
|
+
private uniqueTrackerSize;
|
|
8
|
+
protected uniqueKeysTracker: {
|
|
9
|
+
[keys: string]: ISet<string>;
|
|
10
|
+
};
|
|
11
|
+
constructor(uniqueKeysQueueSize?: number);
|
|
12
|
+
setOnFullQueueCb(cb: () => void): void;
|
|
13
|
+
/**
|
|
14
|
+
* Store unique keys in sequential order
|
|
15
|
+
* key: string = feature name.
|
|
16
|
+
* value: Set<string> = set of unique keys.
|
|
17
|
+
*/
|
|
18
|
+
track(key: string, featureName: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Clear the data stored on the cache.
|
|
21
|
+
*/
|
|
22
|
+
clear(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Pop the collected data, used as payload for posting.
|
|
25
|
+
*/
|
|
26
|
+
pop(): UniqueKeysPayloadSs;
|
|
27
|
+
/**
|
|
28
|
+
* Check if the cache is empty.
|
|
29
|
+
*/
|
|
30
|
+
isEmpty(): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Converts `uniqueKeys` data from cache into request payload for SS.
|
|
33
|
+
*/
|
|
34
|
+
private fromUniqueKeysCollector;
|
|
35
|
+
}
|