@splitsoftware/splitio-commons 1.6.2-rc.0 → 1.6.2-rc.10
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 +4 -0
- package/cjs/consent/sdkUserConsent.js +2 -2
- package/cjs/evaluator/index.js +15 -16
- 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/client.js +19 -7
- package/cjs/sdkClient/sdkClient.js +3 -1
- package/cjs/sdkFactory/index.js +24 -7
- package/cjs/sdkManager/index.js +3 -11
- package/cjs/services/splitApi.js +24 -4
- package/cjs/storages/AbstractSplitsCacheAsync.js +8 -10
- package/cjs/storages/AbstractSplitsCacheSync.js +8 -10
- package/cjs/storages/KeyBuilderSS.js +54 -9
- package/cjs/storages/dataLoader.js +1 -1
- package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +5 -7
- package/cjs/storages/inLocalStorage/index.js +5 -1
- package/cjs/storages/inMemory/ImpressionCountsCacheInMemory.js +12 -1
- package/cjs/storages/inMemory/InMemoryStorage.js +6 -2
- package/cjs/storages/inMemory/InMemoryStorageCS.js +6 -2
- package/cjs/storages/inMemory/SplitsCacheInMemory.js +7 -10
- package/cjs/storages/inMemory/TelemetryCacheInMemory.js +10 -5
- package/cjs/storages/inMemory/UniqueKeysCacheInMemory.js +73 -0
- package/cjs/storages/inMemory/UniqueKeysCacheInMemoryCS.js +78 -0
- package/cjs/storages/inRedis/EventsCacheInRedis.js +1 -1
- package/cjs/storages/inRedis/ImpressionCountsCacheInRedis.js +50 -0
- package/cjs/storages/inRedis/SplitsCacheInRedis.js +15 -9
- package/cjs/storages/inRedis/TelemetryCacheInRedis.js +100 -0
- package/cjs/storages/inRedis/UniqueKeysCacheInRedis.js +59 -0
- package/cjs/storages/inRedis/constants.js +4 -1
- package/cjs/storages/inRedis/index.js +17 -2
- package/cjs/storages/pluggable/ImpressionCountsCachePluggable.js +43 -0
- package/cjs/storages/pluggable/SplitsCachePluggable.js +14 -9
- package/cjs/storages/pluggable/TelemetryCachePluggable.js +126 -0
- package/cjs/storages/pluggable/UniqueKeysCachePluggable.js +50 -0
- package/cjs/storages/pluggable/index.js +42 -17
- 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 +8 -4
- package/cjs/sync/submitters/uniqueKeysSubmitter.js +27 -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/utils/constants/index.js +4 -2
- package/cjs/utils/lang/maps.js +15 -7
- package/cjs/utils/redis/RedisMock.js +31 -0
- package/cjs/utils/settingsValidation/impressionsMode.js +2 -2
- package/esm/consent/sdkUserConsent.js +2 -2
- package/esm/evaluator/index.js +15 -16
- 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/client.js +19 -7
- package/esm/sdkClient/sdkClient.js +3 -1
- package/esm/sdkFactory/index.js +24 -7
- package/esm/sdkManager/index.js +3 -11
- package/esm/services/splitApi.js +24 -4
- package/esm/storages/AbstractSplitsCacheAsync.js +8 -10
- package/esm/storages/AbstractSplitsCacheSync.js +8 -10
- package/esm/storages/KeyBuilderSS.js +50 -8
- package/esm/storages/dataLoader.js +1 -1
- package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +5 -7
- package/esm/storages/inLocalStorage/index.js +6 -2
- package/esm/storages/inMemory/ImpressionCountsCacheInMemory.js +12 -1
- package/esm/storages/inMemory/InMemoryStorage.js +8 -4
- package/esm/storages/inMemory/InMemoryStorageCS.js +7 -3
- package/esm/storages/inMemory/SplitsCacheInMemory.js +7 -10
- package/esm/storages/inMemory/TelemetryCacheInMemory.js +9 -5
- package/esm/storages/inMemory/UniqueKeysCacheInMemory.js +70 -0
- package/esm/storages/inMemory/UniqueKeysCacheInMemoryCS.js +75 -0
- package/esm/storages/inRedis/EventsCacheInRedis.js +1 -1
- package/esm/storages/inRedis/ImpressionCountsCacheInRedis.js +47 -0
- package/esm/storages/inRedis/SplitsCacheInRedis.js +15 -9
- package/esm/storages/inRedis/TelemetryCacheInRedis.js +100 -0
- package/esm/storages/inRedis/UniqueKeysCacheInRedis.js +56 -0
- package/esm/storages/inRedis/constants.js +3 -0
- package/esm/storages/inRedis/index.js +18 -3
- package/esm/storages/pluggable/ImpressionCountsCachePluggable.js +40 -0
- package/esm/storages/pluggable/SplitsCachePluggable.js +14 -9
- package/esm/storages/pluggable/TelemetryCachePluggable.js +126 -0
- package/esm/storages/pluggable/UniqueKeysCachePluggable.js +47 -0
- package/esm/storages/pluggable/index.js +43 -18
- 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 +9 -5
- package/esm/sync/submitters/uniqueKeysSubmitter.js +23 -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/utils/constants/index.js +2 -0
- package/esm/utils/lang/maps.js +15 -7
- package/esm/utils/redis/RedisMock.js +28 -0
- package/esm/utils/settingsValidation/impressionsMode.js +3 -3
- package/package.json +1 -2
- package/src/consent/sdkUserConsent.ts +2 -2
- package/src/evaluator/index.ts +14 -15
- package/src/integrations/ga/GaToSplit.ts +9 -5
- package/src/integrations/types.ts +2 -1
- package/src/listeners/browser.ts +3 -2
- package/src/logger/constants.ts +1 -0
- package/src/sdkClient/client.ts +21 -8
- package/src/sdkClient/sdkClient.ts +3 -1
- package/src/sdkFactory/index.ts +28 -8
- package/src/sdkFactory/types.ts +7 -4
- package/src/sdkManager/index.ts +3 -12
- package/src/services/splitApi.ts +26 -4
- package/src/services/types.ts +8 -2
- package/src/storages/AbstractSplitsCacheAsync.ts +13 -15
- package/src/storages/AbstractSplitsCacheSync.ts +15 -17
- package/src/storages/KeyBuilderSS.ts +61 -9
- package/src/storages/dataLoader.ts +1 -1
- package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +8 -11
- package/src/storages/inLocalStorage/index.ts +5 -2
- package/src/storages/inMemory/ImpressionCountsCacheInMemory.ts +16 -1
- package/src/storages/inMemory/InMemoryStorage.ts +7 -4
- package/src/storages/inMemory/InMemoryStorageCS.ts +6 -3
- package/src/storages/inMemory/SplitsCacheInMemory.ts +10 -14
- package/src/storages/inMemory/TelemetryCacheInMemory.ts +10 -6
- package/src/storages/inMemory/UniqueKeysCacheInMemory.ts +82 -0
- package/src/storages/inMemory/UniqueKeysCacheInMemoryCS.ts +88 -0
- package/src/storages/inRedis/EventsCacheInRedis.ts +1 -1
- package/src/storages/inRedis/ImpressionCountsCacheInRedis.ts +53 -0
- package/src/storages/inRedis/SplitsCacheInRedis.ts +21 -17
- package/src/storages/inRedis/TelemetryCacheInRedis.ts +122 -2
- package/src/storages/inRedis/UniqueKeysCacheInRedis.ts +65 -0
- package/src/storages/inRedis/constants.ts +3 -0
- package/src/storages/inRedis/index.ts +15 -5
- package/src/storages/pluggable/ImpressionCountsCachePluggable.ts +47 -0
- package/src/storages/pluggable/SplitsCachePluggable.ts +20 -17
- package/src/storages/pluggable/TelemetryCachePluggable.ts +147 -2
- package/src/storages/pluggable/UniqueKeysCachePluggable.ts +56 -0
- package/src/storages/pluggable/index.ts +44 -19
- package/src/storages/types.ts +50 -29
- package/src/sync/offline/syncTasks/fromObjectSyncTask.ts +5 -6
- package/src/sync/polling/updaters/splitChangesUpdater.ts +2 -2
- package/src/sync/submitters/submitterManager.ts +2 -0
- package/src/sync/submitters/telemetrySubmitter.ts +15 -8
- package/src/sync/submitters/types.ts +38 -7
- package/src/sync/submitters/uniqueKeysSubmitter.ts +36 -0
- package/src/trackers/impressionsTracker.ts +27 -48
- 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 +32 -0
- package/src/trackers/uniqueKeysTracker.ts +48 -0
- package/src/types.ts +1 -1
- package/src/utils/constants/index.ts +2 -0
- package/src/utils/lang/maps.ts +20 -8
- package/src/utils/redis/RedisMock.ts +33 -0
- package/src/utils/settingsValidation/impressionsMode.ts +3 -3
- package/src/utils/settingsValidation/index.ts +1 -0
- package/types/integrations/types.d.ts +2 -1
- package/types/logger/browser/{debugLogger.d.ts → DebugLogger.d.ts} +0 -0
- package/types/logger/browser/{errorLogger.d.ts → ErrorLogger.d.ts} +0 -0
- package/types/logger/browser/{infoLogger.d.ts → InfoLogger.d.ts} +0 -0
- package/types/logger/browser/{warnLogger.d.ts → WarnLogger.d.ts} +0 -0
- package/types/logger/constants.d.ts +1 -0
- package/types/sdkFactory/types.d.ts +4 -2
- package/types/services/types.d.ts +6 -2
- package/types/storages/AbstractSplitsCacheAsync.d.ts +7 -6
- package/types/storages/AbstractSplitsCacheSync.d.ts +6 -6
- package/types/storages/KeyBuilderSS.d.ts +9 -2
- package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +3 -4
- package/types/storages/inMemory/ImpressionCountsCacheInMemory.d.ts +5 -1
- package/types/storages/inMemory/SplitsCacheInMemory.d.ts +3 -2
- package/types/storages/inMemory/TelemetryCacheInMemory.d.ts +6 -3
- package/types/storages/inMemory/uniqueKeysCacheInMemory.d.ts +35 -0
- package/types/storages/inMemory/uniqueKeysCacheInMemoryCS.d.ts +37 -0
- package/types/storages/inRedis/EventsCacheInRedis.d.ts +1 -1
- package/types/storages/inRedis/ImpressionCountsCacheInRedis.d.ts +14 -0
- package/types/storages/inRedis/SplitsCacheInRedis.d.ts +6 -5
- package/types/storages/inRedis/TelemetryCacheInRedis.d.ts +16 -1
- package/types/storages/inRedis/constants.d.ts +3 -0
- package/types/storages/inRedis/uniqueKeysCacheInRedis.d.ts +15 -0
- package/types/storages/pluggable/ImpressionCountsCachePluggable.d.ts +14 -0
- package/types/storages/pluggable/SplitsCachePluggable.d.ts +6 -5
- package/types/storages/pluggable/TelemetryCachePluggable.d.ts +17 -1
- package/types/storages/pluggable/UniqueKeysCachePluggable.d.ts +14 -0
- package/types/storages/types.d.ts +38 -25
- package/types/sync/polling/updaters/splitChangesUpdater.d.ts +1 -1
- package/types/sync/submitters/telemetrySubmitter.d.ts +1 -1
- package/types/sync/submitters/types.d.ts +30 -7
- package/types/sync/submitters/uniqueKeysSubmitter.d.ts +0 -8
- package/types/trackers/impressionsTracker.d.ts +4 -6
- package/types/trackers/types.d.ts +27 -0
- package/types/trackers/uniqueKeysTracker.d.ts +3 -3
- package/types/types.d.ts +1 -1
- package/types/utils/constants/index.d.ts +2 -0
- package/types/utils/lang/maps.d.ts +6 -2
- package/types/utils/redis/RedisMock.d.ts +4 -0
- package/src/splitio.d.ts +0 -1602
- package/types/integrations/ga/GaToSplitPlugin.d.ts +0 -3
- package/types/integrations/ga/SplitToGaPlugin.d.ts +0 -4
- package/types/integrations/ga/autoRequire.d.ts +0 -4
- package/types/logger/codes.d.ts +0 -2
- package/types/logger/codesConstants.d.ts +0 -117
- package/types/logger/codesConstantsBrowser.d.ts +0 -2
- package/types/logger/codesConstantsNode.d.ts +0 -14
- package/types/logger/codesDebug.d.ts +0 -1
- package/types/logger/codesDebugBrowser.d.ts +0 -1
- package/types/logger/codesDebugNode.d.ts +0 -1
- package/types/logger/codesError.d.ts +0 -1
- package/types/logger/codesErrorNode.d.ts +0 -1
- package/types/logger/codesInfo.d.ts +0 -1
- package/types/logger/codesWarn.d.ts +0 -1
- package/types/logger/codesWarnNode.d.ts +0 -1
- package/types/logger/debugLogger.d.ts +0 -2
- package/types/logger/errorLogger.d.ts +0 -2
- package/types/logger/infoLogger.d.ts +0 -2
- package/types/logger/messages/debugBrowser.d.ts +0 -1
- package/types/logger/messages/debugNode.d.ts +0 -1
- package/types/logger/messages/errorNode.d.ts +0 -1
- package/types/logger/messages/warnNode.d.ts +0 -1
- package/types/logger/noopLogger.d.ts +0 -2
- package/types/logger/warnLogger.d.ts +0 -2
- package/types/sdkClient/types.d.ts +0 -18
- package/types/sdkFactory/userConsentProps.d.ts +0 -6
- package/types/sdkManager/sdkManagerMethod.d.ts +0 -6
- package/types/storages/getRegisteredSegments.d.ts +0 -10
- package/types/storages/inMemory/CountsCacheInMemory.d.ts +0 -20
- package/types/storages/inMemory/LatenciesCacheInMemory.d.ts +0 -20
- package/types/storages/inMemory/index.d.ts +0 -10
- package/types/storages/inRedis/CountsCacheInRedis.d.ts +0 -9
- package/types/storages/inRedis/LatenciesCacheInRedis.d.ts +0 -9
- package/types/storages/parseSegments.d.ts +0 -6
- package/types/sync/offline/LocalhostFromFile.d.ts +0 -2
- package/types/sync/offline/splitsParser/splitsParserFromFile.d.ts +0 -2
- package/types/sync/polling/syncTasks/splitsSyncTask.copy.d.ts +0 -35
- package/types/sync/polling/syncTasks/splitsSyncTask.morelikeoriginal.d.ts +0 -35
- package/types/sync/streaming/AuthClient/indexV1.d.ts +0 -12
- package/types/sync/streaming/AuthClient/indexV2.d.ts +0 -8
- package/types/sync/streaming/pushManagerCS.d.ts +0 -1
- package/types/sync/streaming/pushManagerNoUsers.d.ts +0 -13
- package/types/sync/streaming/pushManagerSS.d.ts +0 -1
- package/types/sync/submitters/eventsSyncTask.d.ts +0 -8
- package/types/sync/submitters/impressionCountsSyncTask.d.ts +0 -13
- package/types/sync/submitters/impressionsSyncTask.d.ts +0 -14
- package/types/sync/submitters/metricsSyncTask.d.ts +0 -12
- package/types/sync/submitters/submitterSyncTask.d.ts +0 -10
- package/types/sync/submitters/telemetrySyncTask.d.ts +0 -0
- package/types/sync/syncManagerFromFile.d.ts +0 -2
- package/types/sync/syncManagerFromObject.d.ts +0 -2
- package/types/sync/syncManagerOffline.d.ts +0 -9
- package/types/sync/syncTaskComposite.d.ts +0 -5
- package/types/trackers/telemetryRecorder.d.ts +0 -0
- package/types/utils/EventEmitter.d.ts +0 -4
- package/types/utils/consent.d.ts +0 -2
- package/types/utils/lang/errors.d.ts +0 -10
- package/types/utils/murmur3/commons.d.ts +0 -12
- package/types/utils/settingsValidation/buildMetadata.d.ts +0 -3
- package/types/utils/settingsValidation/localhost/index.d.ts +0 -9
- package/types/utils/settingsValidation/logger.d.ts +0 -11
- package/types/utils/settingsValidation/runtime/browser.d.ts +0 -2
- package/types/utils/settingsValidation/runtime/node.d.ts +0 -2
- package/types/utils/settingsValidation/userConsent.d.ts +0 -5
- package/types/utils/timeTracker/index.d.ts +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MaybeThenable, IMetadata, ISplitFiltersValidation } from '../dtos/types';
|
|
1
|
+
import { MaybeThenable, IMetadata, ISplitFiltersValidation, ISplit } from '../dtos/types';
|
|
2
2
|
import { ILogger } from '../logger/types';
|
|
3
|
-
import { EventDataType, HttpErrors, HttpLatencies, ImpressionDataType, LastSync, Method, MethodExceptions, MethodLatencies, OperationType, StoredEventWithMetadata, StoredImpressionWithMetadata, StreamingEvent } from '../sync/submitters/types';
|
|
3
|
+
import { EventDataType, HttpErrors, HttpLatencies, ImpressionDataType, LastSync, Method, MethodExceptions, MethodLatencies, MultiMethodExceptions, MultiMethodLatencies, MultiConfigs, OperationType, StoredEventWithMetadata, StoredImpressionWithMetadata, StreamingEvent, UniqueKeysPayloadCs, UniqueKeysPayloadSs } from '../sync/submitters/types';
|
|
4
4
|
import { SplitIO, ImpressionDTO, SDKMode } from '../types';
|
|
5
5
|
/**
|
|
6
6
|
* Interface of a pluggable storage wrapper.
|
|
@@ -65,23 +65,25 @@ export interface IPluggableStorageWrapper {
|
|
|
65
65
|
getMany: (keys: string[]) => Promise<(string | null)[]>;
|
|
66
66
|
/** Integer operations */
|
|
67
67
|
/**
|
|
68
|
-
* Increments
|
|
68
|
+
* Increments the number stored at `key` by `increment` (or 1 if `increment` is not provided), or set it to `increment` (or 1) if the value doesn't exist.
|
|
69
69
|
*
|
|
70
70
|
* @function incr
|
|
71
71
|
* @param {string} key Key to increment
|
|
72
|
+
* @param {number} increment Value to increment by
|
|
72
73
|
* @returns {Promise<number>} A promise that resolves with the value of key after the increment. The promise rejects if the operation fails,
|
|
73
74
|
* for example, if there is a connection error or the key contains a string that can not be represented as integer.
|
|
74
75
|
*/
|
|
75
|
-
incr: (key: string) => Promise<number>;
|
|
76
|
+
incr: (key: string, increment?: number) => Promise<number>;
|
|
76
77
|
/**
|
|
77
|
-
* Decrements
|
|
78
|
+
* Decrements the number stored at `key` by `decrement` (or 1 if `decrement` is not provided), or set it to minus `decrement` (or minus 1) if the value doesn't exist.
|
|
78
79
|
*
|
|
79
80
|
* @function decr
|
|
80
81
|
* @param {string} key Key to decrement
|
|
82
|
+
* @param {number} decrement Value to decrement by
|
|
81
83
|
* @returns {Promise<number>} A promise that resolves with the value of key after the decrement. The promise rejects if the operation fails,
|
|
82
84
|
* for example, if there is a connection error or the key contains a string that can not be represented as integer.
|
|
83
85
|
*/
|
|
84
|
-
decr: (key: string) => Promise<number>;
|
|
86
|
+
decr: (key: string, decrement?: number) => Promise<number>;
|
|
85
87
|
/** Queue operations */
|
|
86
88
|
/**
|
|
87
89
|
* Inserts given items at the tail of `key` list. If `key` does not exist, an empty list is created before pushing the items.
|
|
@@ -178,13 +180,13 @@ export interface IPluggableStorageWrapper {
|
|
|
178
180
|
}
|
|
179
181
|
/** Splits cache */
|
|
180
182
|
export interface ISplitsCacheBase {
|
|
181
|
-
addSplits(entries: [string,
|
|
183
|
+
addSplits(entries: [string, ISplit][]): MaybeThenable<boolean[] | void>;
|
|
182
184
|
removeSplits(names: string[]): MaybeThenable<boolean[] | void>;
|
|
183
|
-
getSplit(name: string): MaybeThenable<
|
|
184
|
-
getSplits(names: string[]): MaybeThenable<Record<string,
|
|
185
|
+
getSplit(name: string): MaybeThenable<ISplit | null>;
|
|
186
|
+
getSplits(names: string[]): MaybeThenable<Record<string, ISplit | null>>;
|
|
185
187
|
setChangeNumber(changeNumber: number): MaybeThenable<boolean | void>;
|
|
186
188
|
getChangeNumber(): MaybeThenable<number>;
|
|
187
|
-
getAll(): MaybeThenable<
|
|
189
|
+
getAll(): MaybeThenable<ISplit[]>;
|
|
188
190
|
getSplitNames(): MaybeThenable<string[]>;
|
|
189
191
|
trafficTypeExists(trafficType: string): MaybeThenable<boolean>;
|
|
190
192
|
usesSegments(): MaybeThenable<boolean>;
|
|
@@ -193,13 +195,13 @@ export interface ISplitsCacheBase {
|
|
|
193
195
|
killLocally(name: string, defaultTreatment: string, changeNumber: number): MaybeThenable<boolean>;
|
|
194
196
|
}
|
|
195
197
|
export interface ISplitsCacheSync extends ISplitsCacheBase {
|
|
196
|
-
addSplits(entries: [string,
|
|
198
|
+
addSplits(entries: [string, ISplit][]): boolean[];
|
|
197
199
|
removeSplits(names: string[]): boolean[];
|
|
198
|
-
getSplit(name: string):
|
|
199
|
-
getSplits(names: string[]): Record<string,
|
|
200
|
+
getSplit(name: string): ISplit | null;
|
|
201
|
+
getSplits(names: string[]): Record<string, ISplit | null>;
|
|
200
202
|
setChangeNumber(changeNumber: number): boolean;
|
|
201
203
|
getChangeNumber(): number;
|
|
202
|
-
getAll():
|
|
204
|
+
getAll(): ISplit[];
|
|
203
205
|
getSplitNames(): string[];
|
|
204
206
|
trafficTypeExists(trafficType: string): boolean;
|
|
205
207
|
usesSegments(): boolean;
|
|
@@ -208,13 +210,13 @@ export interface ISplitsCacheSync extends ISplitsCacheBase {
|
|
|
208
210
|
killLocally(name: string, defaultTreatment: string, changeNumber: number): boolean;
|
|
209
211
|
}
|
|
210
212
|
export interface ISplitsCacheAsync extends ISplitsCacheBase {
|
|
211
|
-
addSplits(entries: [string,
|
|
213
|
+
addSplits(entries: [string, ISplit][]): Promise<boolean[] | void>;
|
|
212
214
|
removeSplits(names: string[]): Promise<boolean[] | void>;
|
|
213
|
-
getSplit(name: string): Promise<
|
|
214
|
-
getSplits(names: string[]): Promise<Record<string,
|
|
215
|
+
getSplit(name: string): Promise<ISplit | null>;
|
|
216
|
+
getSplits(names: string[]): Promise<Record<string, ISplit | null>>;
|
|
215
217
|
setChangeNumber(changeNumber: number): Promise<boolean | void>;
|
|
216
218
|
getChangeNumber(): Promise<number>;
|
|
217
|
-
getAll(): Promise<
|
|
219
|
+
getAll(): Promise<ISplit[]>;
|
|
218
220
|
getSplitNames(): Promise<string[]>;
|
|
219
221
|
trafficTypeExists(trafficType: string): Promise<boolean>;
|
|
220
222
|
usesSegments(): Promise<boolean>;
|
|
@@ -297,6 +299,13 @@ export interface IImpressionCountsCacheSync extends IRecorderCacheProducerSync<R
|
|
|
297
299
|
isEmpty(): boolean;
|
|
298
300
|
pop(toMerge?: Record<string, number>): Record<string, number>;
|
|
299
301
|
}
|
|
302
|
+
export interface IUniqueKeysCacheBase {
|
|
303
|
+
track(key: string, value: string): void;
|
|
304
|
+
isEmpty(): boolean;
|
|
305
|
+
pop(): UniqueKeysPayloadSs | UniqueKeysPayloadCs;
|
|
306
|
+
setOnFullQueueCb(cb: () => void): void;
|
|
307
|
+
clear(): void;
|
|
308
|
+
}
|
|
300
309
|
/**
|
|
301
310
|
* Telemetry storage interface for standalone and partial consumer modes.
|
|
302
311
|
* Methods are sync because data is stored in memory.
|
|
@@ -354,31 +363,34 @@ export interface ITelemetryCacheSync extends ITelemetryStorageConsumerSync, ITel
|
|
|
354
363
|
* Methods are async because data is stored in Redis or a pluggable storage.
|
|
355
364
|
*/
|
|
356
365
|
export interface ITelemetryEvaluationConsumerAsync {
|
|
357
|
-
|
|
358
|
-
|
|
366
|
+
popLatencies(): Promise<MultiMethodLatencies>;
|
|
367
|
+
popExceptions(): Promise<MultiMethodExceptions>;
|
|
368
|
+
popConfigs(): Promise<MultiConfigs>;
|
|
359
369
|
}
|
|
360
370
|
export interface ITelemetryEvaluationProducerAsync {
|
|
361
371
|
recordLatency(method: Method, latencyMs: number): Promise<any>;
|
|
362
372
|
recordException(method: Method): Promise<any>;
|
|
373
|
+
recordConfig(): Promise<any>;
|
|
363
374
|
}
|
|
364
|
-
export interface ITelemetryCacheAsync extends ITelemetryEvaluationProducerAsync {
|
|
375
|
+
export interface ITelemetryCacheAsync extends ITelemetryEvaluationProducerAsync, ITelemetryEvaluationConsumerAsync {
|
|
365
376
|
}
|
|
366
377
|
/**
|
|
367
378
|
* Storages
|
|
368
379
|
*/
|
|
369
|
-
export interface IStorageBase<TSplitsCache extends ISplitsCacheBase, TSegmentsCache extends ISegmentsCacheBase, TImpressionsCache extends IImpressionsCacheBase, TEventsCache extends IEventsCacheBase, TTelemetryCache extends ITelemetryCacheSync | ITelemetryCacheAsync> {
|
|
380
|
+
export interface IStorageBase<TSplitsCache extends ISplitsCacheBase, TSegmentsCache extends ISegmentsCacheBase, TImpressionsCache extends IImpressionsCacheBase, TImpressionsCountCache extends IImpressionCountsCacheSync, TEventsCache extends IEventsCacheBase, TTelemetryCache extends ITelemetryCacheSync | ITelemetryCacheAsync, TUniqueKeysCache extends IUniqueKeysCacheBase> {
|
|
370
381
|
splits: TSplitsCache;
|
|
371
382
|
segments: TSegmentsCache;
|
|
372
383
|
impressions: TImpressionsCache;
|
|
373
|
-
impressionCounts?:
|
|
384
|
+
impressionCounts?: TImpressionsCountCache;
|
|
374
385
|
events: TEventsCache;
|
|
375
386
|
telemetry?: TTelemetryCache;
|
|
387
|
+
uniqueKeys?: TUniqueKeysCache;
|
|
376
388
|
destroy(): void | Promise<void>;
|
|
377
389
|
shared?: (matchingKey: string, onReadyCb: (error?: any) => void) => this;
|
|
378
390
|
}
|
|
379
|
-
export interface IStorageSync extends IStorageBase<ISplitsCacheSync, ISegmentsCacheSync, IImpressionsCacheSync, IEventsCacheSync, ITelemetryCacheSync> {
|
|
391
|
+
export interface IStorageSync extends IStorageBase<ISplitsCacheSync, ISegmentsCacheSync, IImpressionsCacheSync, IImpressionCountsCacheSync, IEventsCacheSync, ITelemetryCacheSync, IUniqueKeysCacheBase> {
|
|
380
392
|
}
|
|
381
|
-
export interface IStorageAsync extends IStorageBase<ISplitsCacheAsync, ISegmentsCacheAsync, IImpressionsCacheAsync | IImpressionsCacheSync, IEventsCacheAsync | IEventsCacheSync, ITelemetryCacheAsync> {
|
|
393
|
+
export interface IStorageAsync extends IStorageBase<ISplitsCacheAsync, ISegmentsCacheAsync, IImpressionsCacheAsync | IImpressionsCacheSync, IImpressionCountsCacheSync, IEventsCacheAsync | IEventsCacheSync, ITelemetryCacheAsync | ITelemetryCacheSync, IUniqueKeysCacheBase> {
|
|
382
394
|
}
|
|
383
395
|
/** StorageFactory */
|
|
384
396
|
export declare type DataLoader = (storage: IStorageSync, matchingKey: string) => void;
|
|
@@ -388,6 +400,7 @@ export interface IStorageFactoryParams {
|
|
|
388
400
|
eventsQueueSize?: number;
|
|
389
401
|
optimize?: boolean;
|
|
390
402
|
mode: SDKMode;
|
|
403
|
+
impressionsMode?: string;
|
|
391
404
|
matchingKey?: string;
|
|
392
405
|
splitFiltersValidation?: ISplitFiltersValidation;
|
|
393
406
|
onReadyCb: (error?: any) => void;
|
|
@@ -11,7 +11,7 @@ declare type ISplitChangesUpdater = (noCache?: boolean, till?: number) => Promis
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function parseSegments({ conditions }: ISplit): ISet<string>;
|
|
13
13
|
interface ISplitMutations {
|
|
14
|
-
added: [string,
|
|
14
|
+
added: [string, ISplit][];
|
|
15
15
|
removed: string[];
|
|
16
16
|
segments: string[];
|
|
17
17
|
}
|
|
@@ -5,7 +5,7 @@ import { ISdkFactoryContextSync } from '../../sdkFactory/types';
|
|
|
5
5
|
/**
|
|
6
6
|
* Converts data from telemetry cache into /metrics/usage request payload.
|
|
7
7
|
*/
|
|
8
|
-
export declare function telemetryCacheStatsAdapter(telemetry: ITelemetryCacheSync, splits
|
|
8
|
+
export declare function telemetryCacheStatsAdapter(telemetry: ITelemetryCacheSync, splits?: ISplitsCacheSync, segments?: ISegmentsCacheSync): {
|
|
9
9
|
isEmpty(): boolean;
|
|
10
10
|
clear(): void;
|
|
11
11
|
pop(): TelemetryUsageStatsPayload;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IMetadata } from '../../dtos/types';
|
|
2
2
|
import { SplitIO } from '../../types';
|
|
3
|
+
import { IMap } from '../../utils/lang/maps';
|
|
3
4
|
import { ISyncTask } from '../types';
|
|
4
5
|
export declare type ImpressionsPayload = {
|
|
5
6
|
/** Split name */
|
|
@@ -32,6 +33,22 @@ export declare type ImpressionCountsPayload = {
|
|
|
32
33
|
rc: number;
|
|
33
34
|
}[];
|
|
34
35
|
};
|
|
36
|
+
export declare type UniqueKeysPayloadSs = {
|
|
37
|
+
keys: {
|
|
38
|
+
/** Split name */
|
|
39
|
+
f: string;
|
|
40
|
+
/** keyNames */
|
|
41
|
+
ks: string[];
|
|
42
|
+
}[];
|
|
43
|
+
};
|
|
44
|
+
export declare type UniqueKeysPayloadCs = {
|
|
45
|
+
keys: {
|
|
46
|
+
/** keyNames */
|
|
47
|
+
k: string;
|
|
48
|
+
/** Split name */
|
|
49
|
+
fs: string[];
|
|
50
|
+
}[];
|
|
51
|
+
};
|
|
35
52
|
export declare type StoredImpressionWithMetadata = {
|
|
36
53
|
/** Metadata */
|
|
37
54
|
m: IMetadata;
|
|
@@ -59,6 +76,9 @@ export declare type StoredEventWithMetadata = {
|
|
|
59
76
|
/** Stored event */
|
|
60
77
|
e: SplitIO.EventData;
|
|
61
78
|
};
|
|
79
|
+
export declare type MultiMethodLatencies = IMap<string, MethodLatencies>;
|
|
80
|
+
export declare type MultiMethodExceptions = IMap<string, MethodExceptions>;
|
|
81
|
+
export declare type MultiConfigs = IMap<string, TelemetryConfigStats>;
|
|
62
82
|
/**
|
|
63
83
|
* Telemetry usage stats
|
|
64
84
|
*/
|
|
@@ -103,10 +123,12 @@ export declare type StreamingEvent = {
|
|
|
103
123
|
d?: number;
|
|
104
124
|
t: number;
|
|
105
125
|
};
|
|
106
|
-
export declare type
|
|
126
|
+
export declare type TelemetryUsageStats = {
|
|
127
|
+
mL?: MethodLatencies;
|
|
128
|
+
mE?: MethodExceptions;
|
|
129
|
+
};
|
|
130
|
+
export declare type TelemetryUsageStatsPayload = TelemetryUsageStats & {
|
|
107
131
|
lS: LastSync;
|
|
108
|
-
mL: MethodLatencies;
|
|
109
|
-
mE: MethodExceptions;
|
|
110
132
|
hE: HttpErrors;
|
|
111
133
|
hL: HttpLatencies;
|
|
112
134
|
tR: number;
|
|
@@ -114,9 +136,9 @@ export declare type TelemetryUsageStatsPayload = {
|
|
|
114
136
|
iQ: number;
|
|
115
137
|
iDe: number;
|
|
116
138
|
iDr: number;
|
|
117
|
-
spC
|
|
118
|
-
seC
|
|
119
|
-
skC
|
|
139
|
+
spC?: number;
|
|
140
|
+
seC?: number;
|
|
141
|
+
skC?: number;
|
|
120
142
|
sL?: number;
|
|
121
143
|
eQ: number;
|
|
122
144
|
eD: number;
|
|
@@ -132,7 +154,8 @@ export declare type CONSUMER_PARTIAL_ENUM = 2;
|
|
|
132
154
|
export declare type OperationMode = STANDALONE_ENUM | CONSUMER_ENUM | CONSUMER_PARTIAL_ENUM;
|
|
133
155
|
export declare type OPTIMIZED_ENUM = 0;
|
|
134
156
|
export declare type DEBUG_ENUM = 1;
|
|
135
|
-
export declare type
|
|
157
|
+
export declare type NONE_ENUM = 2;
|
|
158
|
+
export declare type ImpressionsMode = OPTIMIZED_ENUM | DEBUG_ENUM | NONE_ENUM;
|
|
136
159
|
export declare type RefreshRates = {
|
|
137
160
|
sp: number;
|
|
138
161
|
se?: number;
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import { ISdkFactoryContextSync } from '../../sdkFactory/types';
|
|
2
|
-
import { ISet } from '../../utils/lang/sets';
|
|
3
|
-
import { UniqueKeysPayload } from './types';
|
|
4
|
-
/**
|
|
5
|
-
* Converts `uniqueKeys` data from cache into request payload.
|
|
6
|
-
*/
|
|
7
|
-
export declare function fromUniqueKeysCollector(uniqueKeys: {
|
|
8
|
-
[featureName: string]: ISet<string>;
|
|
9
|
-
}): UniqueKeysPayload;
|
|
10
2
|
/**
|
|
11
3
|
* Submitter that periodically posts impression counts
|
|
12
4
|
*/
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IImpressionsHandler, IImpressionsTracker } from './types';
|
|
1
|
+
import { IImpressionsCacheBase, ITelemetryCacheSync, ITelemetryCacheAsync } from '../storages/types';
|
|
2
|
+
import { IImpressionsHandler, IImpressionsTracker, IStrategy } from './types';
|
|
3
3
|
import { ISettings } from '../types';
|
|
4
|
-
import { IImpressionObserver } from './impressionObserver/types';
|
|
5
4
|
/**
|
|
6
5
|
* Impressions tracker stores impressions in cache and pass them to the listener and integrations manager if provided.
|
|
7
6
|
*
|
|
@@ -9,7 +8,6 @@ import { IImpressionObserver } from './impressionObserver/types';
|
|
|
9
8
|
* @param metadata runtime metadata (ip, hostname and version)
|
|
10
9
|
* @param impressionListener optional impression listener
|
|
11
10
|
* @param integrationsManager optional integrations manager
|
|
12
|
-
* @param
|
|
13
|
-
* @param countsCache optional cache to save impressions count. If provided, impressions will be deduped (OPTIMIZED mode)
|
|
11
|
+
* @param strategy strategy for impressions tracking.
|
|
14
12
|
*/
|
|
15
|
-
export declare function impressionsTrackerFactory(settings: ISettings, impressionsCache: IImpressionsCacheBase,
|
|
13
|
+
export declare function impressionsTrackerFactory(settings: ISettings, impressionsCache: IImpressionsCacheBase, strategy: IStrategy, integrationsManager?: IImpressionsHandler, telemetryCache?: ITelemetryCacheSync | ITelemetryCacheAsync): IImpressionsTracker;
|
|
@@ -33,4 +33,31 @@ export interface ITelemetryTracker {
|
|
|
33
33
|
* Records streaming event
|
|
34
34
|
*/
|
|
35
35
|
streamingEvent(e: StreamingEventType | AUTH_REJECTION, d?: number): void;
|
|
36
|
+
/**
|
|
37
|
+
* Records tag
|
|
38
|
+
*/
|
|
39
|
+
addTag(tag: string): void;
|
|
40
|
+
}
|
|
41
|
+
export interface IFilterAdapter {
|
|
42
|
+
add(key: string, featureName: string): boolean;
|
|
43
|
+
contains(key: string, featureName: string): boolean;
|
|
44
|
+
clear(): void;
|
|
45
|
+
refreshRate?: number;
|
|
46
|
+
}
|
|
47
|
+
export interface IImpressionSenderAdapter {
|
|
48
|
+
recordUniqueKeys(data: Object): void;
|
|
49
|
+
recordImpressionCounts(data: Object): void;
|
|
50
|
+
}
|
|
51
|
+
/** Unique keys tracker */
|
|
52
|
+
export interface IUniqueKeysTracker {
|
|
53
|
+
stop(): void;
|
|
54
|
+
track(key: string, featureName: string): void;
|
|
55
|
+
}
|
|
56
|
+
export interface IStrategyResult {
|
|
57
|
+
impressionsToStore: ImpressionDTO[];
|
|
58
|
+
impressionsToListener: ImpressionDTO[];
|
|
59
|
+
deduped: number;
|
|
60
|
+
}
|
|
61
|
+
export interface IStrategy {
|
|
62
|
+
process(impressions: ImpressionDTO[]): IStrategyResult;
|
|
36
63
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ILogger } from '../logger/types';
|
|
2
|
+
import { IUniqueKeysCacheBase } from '../storages/types';
|
|
2
3
|
import { IFilterAdapter, IUniqueKeysTracker } from './types';
|
|
3
4
|
/**
|
|
4
5
|
* Trackes uniques keys
|
|
@@ -6,8 +7,7 @@ import { IFilterAdapter, IUniqueKeysTracker } from './types';
|
|
|
6
7
|
* or schedule to be sent; if not it will be added in an internal cache and sent in the next post.
|
|
7
8
|
*
|
|
8
9
|
* @param log Logger instance
|
|
10
|
+
* @param uniqueKeysCache cache to save unique keys
|
|
9
11
|
* @param filterAdapter filter adapter
|
|
10
|
-
* @param cacheSize optional internal cache size
|
|
11
|
-
* @param maxBulkSize optional max MTKs bulk size
|
|
12
12
|
*/
|
|
13
|
-
export declare function uniqueKeysTrackerFactory(log: ILogger,
|
|
13
|
+
export declare function uniqueKeysTrackerFactory(log: ILogger, uniqueKeysCache: IUniqueKeysCacheBase, filterAdapter?: IFilterAdapter): IUniqueKeysTracker;
|
package/types/types.d.ts
CHANGED
|
@@ -715,7 +715,7 @@ export declare namespace SplitIO {
|
|
|
715
715
|
* ImpressionsMode type
|
|
716
716
|
* @typedef {string} ImpressionsMode
|
|
717
717
|
*/
|
|
718
|
-
type ImpressionsMode = 'OPTIMIZED' | 'DEBUG';
|
|
718
|
+
type ImpressionsMode = 'OPTIMIZED' | 'DEBUG' | 'NONE';
|
|
719
719
|
/**
|
|
720
720
|
* Defines the format of Split data to preload on the factory storage (cache).
|
|
721
721
|
*/
|
|
@@ -11,6 +11,7 @@ export declare const SPLIT_IMPRESSION = "IMPRESSION";
|
|
|
11
11
|
export declare const SPLIT_EVENT = "EVENT";
|
|
12
12
|
export declare const DEBUG = "DEBUG";
|
|
13
13
|
export declare const OPTIMIZED = "OPTIMIZED";
|
|
14
|
+
export declare const NONE = "NONE";
|
|
14
15
|
export declare const LOCALHOST_MODE: SDKMode;
|
|
15
16
|
export declare const STANDALONE_MODE: SDKMode;
|
|
16
17
|
export declare const PRODUCER_MODE = "producer";
|
|
@@ -31,6 +32,7 @@ export declare const CONSUMER_ENUM = 1;
|
|
|
31
32
|
export declare const CONSUMER_PARTIAL_ENUM = 2;
|
|
32
33
|
export declare const OPTIMIZED_ENUM = 0;
|
|
33
34
|
export declare const DEBUG_ENUM = 1;
|
|
35
|
+
export declare const NONE_ENUM = 2;
|
|
34
36
|
export declare const SPLITS = "sp";
|
|
35
37
|
export declare const IMPRESSIONS = "im";
|
|
36
38
|
export declare const IMPRESSIONS_COUNT = "ic";
|
|
@@ -23,10 +23,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
**/
|
|
25
25
|
export interface IMap<K, V> {
|
|
26
|
-
set(key: K, value: V): this;
|
|
27
26
|
clear(): void;
|
|
28
27
|
delete(key: K): boolean;
|
|
28
|
+
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
|
|
29
29
|
get(key: K): V | undefined;
|
|
30
|
+
has(key: K): boolean;
|
|
31
|
+
set(key: K, value: V): this;
|
|
30
32
|
readonly size: number;
|
|
31
33
|
}
|
|
32
34
|
export declare class MapPoly<K, V> implements IMap<K, V> {
|
|
@@ -34,9 +36,11 @@ export declare class MapPoly<K, V> implements IMap<K, V> {
|
|
|
34
36
|
private __mapValuesData__;
|
|
35
37
|
constructor(entries?: readonly (readonly [K, V])[] | null);
|
|
36
38
|
clear(): void;
|
|
37
|
-
set(key: K, value: V): this;
|
|
38
39
|
delete(key: K): boolean;
|
|
40
|
+
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
|
|
39
41
|
get(key: K): V | undefined;
|
|
42
|
+
has(key: K): boolean;
|
|
43
|
+
set(key: K, value: V): this;
|
|
40
44
|
get size(): number;
|
|
41
45
|
}
|
|
42
46
|
interface IMapConstructor {
|