@splitsoftware/splitio-commons 1.6.2-rc.1 → 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/sdkClient/client.js +19 -7
- package/cjs/sdkClient/sdkClient.js +3 -1
- package/cjs/sdkFactory/index.js +15 -6
- package/cjs/sdkManager/index.js +3 -11
- package/cjs/services/splitApi.js +6 -6
- 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/telemetrySubmitter.js +8 -4
- package/cjs/sync/submitters/uniqueKeysSubmitter.js +16 -59
- package/cjs/trackers/impressionsTracker.js +17 -15
- package/cjs/trackers/strategy/strategyNone.js +1 -1
- package/cjs/trackers/strategy/strategyOptimized.js +2 -1
- package/cjs/trackers/telemetryTracker.js +6 -0
- package/cjs/trackers/uniqueKeysTracker.js +11 -42
- package/cjs/utils/constants/index.js +3 -2
- package/cjs/utils/lang/maps.js +15 -7
- package/cjs/utils/redis/RedisMock.js +31 -0
- package/cjs/utils/settingsValidation/index.js +0 -3
- package/esm/consent/sdkUserConsent.js +2 -2
- package/esm/evaluator/index.js +15 -16
- package/esm/integrations/ga/GaToSplit.js +8 -5
- package/esm/sdkClient/client.js +19 -7
- package/esm/sdkClient/sdkClient.js +3 -1
- package/esm/sdkFactory/index.js +16 -7
- package/esm/sdkManager/index.js +3 -11
- package/esm/services/splitApi.js +6 -6
- 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/telemetrySubmitter.js +9 -5
- package/esm/sync/submitters/uniqueKeysSubmitter.js +15 -56
- package/esm/trackers/impressionsTracker.js +17 -15
- package/esm/trackers/strategy/strategyNone.js +1 -1
- package/esm/trackers/strategy/strategyOptimized.js +2 -1
- package/esm/trackers/telemetryTracker.js +6 -0
- package/esm/trackers/uniqueKeysTracker.js +11 -42
- package/esm/utils/constants/index.js +1 -0
- package/esm/utils/lang/maps.js +15 -7
- package/esm/utils/redis/RedisMock.js +28 -0
- package/esm/utils/settingsValidation/index.js +0 -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/logger/.DS_Store +0 -0
- package/src/sdkClient/client.ts +21 -8
- package/src/sdkClient/sdkClient.ts +3 -1
- package/src/sdkFactory/index.ts +17 -7
- package/src/sdkManager/index.ts +3 -12
- package/src/services/splitApi.ts +6 -6
- package/src/services/types.ts +2 -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 +38 -30
- package/src/sync/offline/syncTasks/fromObjectSyncTask.ts +5 -6
- package/src/sync/polling/updaters/splitChangesUpdater.ts +2 -2
- package/src/sync/submitters/telemetrySubmitter.ts +15 -8
- package/src/sync/submitters/types.ts +18 -6
- package/src/sync/submitters/uniqueKeysSubmitter.ts +18 -61
- package/src/trackers/impressionsTracker.ts +16 -15
- package/src/trackers/strategy/strategyNone.ts +1 -1
- package/src/trackers/strategy/strategyOptimized.ts +1 -1
- package/src/trackers/telemetryTracker.ts +7 -2
- package/src/trackers/types.ts +9 -7
- package/src/trackers/uniqueKeysTracker.ts +15 -47
- package/src/types.ts +0 -1
- package/src/utils/constants/index.ts +1 -0
- package/src/utils/lang/maps.ts +20 -8
- package/src/utils/redis/RedisMock.ts +33 -0
- package/src/utils/settingsValidation/index.ts +1 -4
- package/types/integrations/types.d.ts +2 -1
- package/types/services/types.d.ts +2 -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 +35 -35
- 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 +12 -6
- package/types/sync/submitters/uniqueKeysSubmitter.d.ts +0 -14
- package/types/trackers/types.d.ts +9 -11
- package/types/trackers/uniqueKeysTracker.d.ts +3 -3
- package/types/types.d.ts +0 -1
- package/types/utils/constants/index.d.ts +1 -0
- package/types/utils/lang/maps.d.ts +6 -2
- package/types/utils/redis/RedisMock.d.ts +4 -0
- package/types/utils/settingsValidation/index.d.ts +0 -1
- package/types/sdkClient/types.d.ts +0 -18
- package/types/storages/inMemory/CountsCacheInMemory.d.ts +0 -20
- package/types/storages/inMemory/LatenciesCacheInMemory.d.ts +0 -20
- package/types/storages/inRedis/CountsCacheInRedis.d.ts +0 -9
- package/types/storages/inRedis/LatenciesCacheInRedis.d.ts +0 -9
- package/types/sync/offline/LocalhostFromFile.d.ts +0 -2
- package/types/sync/offline/splitsParser/splitsParserFromFile.d.ts +0 -2
- 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/syncTaskComposite.d.ts +0 -5
- package/types/trackers/filter/bloomFilter.d.ts +0 -10
- package/types/trackers/filter/dictionaryFilter.d.ts +0 -8
- package/types/trackers/filter/types.d.ts +0 -5
- package/types/utils/timeTracker/index.d.ts +0 -70
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { ISplitsCacheAsync } from './types';
|
|
2
|
+
import { ISplit } from '../dtos/types';
|
|
2
3
|
/**
|
|
3
4
|
* This class provides a skeletal implementation of the ISplitsCacheAsync interface
|
|
4
5
|
* to minimize the effort required to implement this interface.
|
|
5
6
|
*/
|
|
6
7
|
export declare abstract class AbstractSplitsCacheAsync implements ISplitsCacheAsync {
|
|
7
|
-
abstract addSplit(name: string, split:
|
|
8
|
-
abstract addSplits(entries: [string,
|
|
8
|
+
abstract addSplit(name: string, split: ISplit): Promise<boolean>;
|
|
9
|
+
abstract addSplits(entries: [string, ISplit][]): Promise<boolean[] | void>;
|
|
9
10
|
abstract removeSplits(names: string[]): Promise<boolean[] | void>;
|
|
10
|
-
abstract getSplit(name: string): Promise<
|
|
11
|
-
abstract getSplits(names: string[]): Promise<Record<string,
|
|
11
|
+
abstract getSplit(name: string): Promise<ISplit | null>;
|
|
12
|
+
abstract getSplits(names: string[]): Promise<Record<string, ISplit | null>>;
|
|
12
13
|
abstract setChangeNumber(changeNumber: number): Promise<boolean | void>;
|
|
13
14
|
abstract getChangeNumber(): Promise<number>;
|
|
14
|
-
abstract getAll(): Promise<
|
|
15
|
+
abstract getAll(): Promise<ISplit[]>;
|
|
15
16
|
abstract getSplitNames(): Promise<string[]>;
|
|
16
17
|
abstract trafficTypeExists(trafficType: string): Promise<boolean>;
|
|
17
18
|
abstract clear(): Promise<boolean | void>;
|
|
@@ -28,7 +29,7 @@ export declare abstract class AbstractSplitsCacheAsync implements ISplitsCacheAs
|
|
|
28
29
|
* @param {string} name
|
|
29
30
|
* @param {string} defaultTreatment
|
|
30
31
|
* @param {number} changeNumber
|
|
31
|
-
* @returns {Promise} a promise that is resolved once the split kill operation is performed. The fulfillment value is a boolean: `true` if the
|
|
32
|
+
* @returns {Promise} a promise that is resolved once the split kill operation is performed. The fulfillment value is a boolean: `true` if the operation successed updating the split or `false` if no split is updated,
|
|
32
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.
|
|
33
34
|
* The promise will never be rejected.
|
|
34
35
|
*/
|
|
@@ -5,15 +5,15 @@ import { ISplit } from '../dtos/types';
|
|
|
5
5
|
* to minimize the effort required to implement this interface.
|
|
6
6
|
*/
|
|
7
7
|
export declare abstract class AbstractSplitsCacheSync implements ISplitsCacheSync {
|
|
8
|
-
abstract addSplit(name: string, split:
|
|
9
|
-
addSplits(entries: [string,
|
|
8
|
+
abstract addSplit(name: string, split: ISplit): boolean;
|
|
9
|
+
addSplits(entries: [string, ISplit][]): boolean[];
|
|
10
10
|
abstract removeSplit(name: string): boolean;
|
|
11
11
|
removeSplits(names: string[]): boolean[];
|
|
12
|
-
abstract getSplit(name: string):
|
|
13
|
-
getSplits(names: string[]): Record<string,
|
|
12
|
+
abstract getSplit(name: string): ISplit | null;
|
|
13
|
+
getSplits(names: string[]): Record<string, ISplit | null>;
|
|
14
14
|
abstract setChangeNumber(changeNumber: number): boolean;
|
|
15
15
|
abstract getChangeNumber(): number;
|
|
16
|
-
getAll():
|
|
16
|
+
getAll(): ISplit[];
|
|
17
17
|
abstract getSplitNames(): string[];
|
|
18
18
|
abstract trafficTypeExists(trafficType: string): boolean;
|
|
19
19
|
abstract usesSegments(): boolean;
|
|
@@ -30,7 +30,7 @@ export declare abstract class AbstractSplitsCacheSync implements ISplitsCacheSyn
|
|
|
30
30
|
* @param {string} name
|
|
31
31
|
* @param {string} defaultTreatment
|
|
32
32
|
* @param {number} changeNumber
|
|
33
|
-
* @returns {
|
|
33
|
+
* @returns {boolean} `true` if the operation successed updating the split, or `false` if no split is updated,
|
|
34
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
35
|
*/
|
|
36
36
|
killLocally(name: string, defaultTreatment: string, changeNumber: number): boolean;
|
|
@@ -2,14 +2,21 @@ import { KeyBuilder } from './KeyBuilder';
|
|
|
2
2
|
import { IMetadata } from '../dtos/types';
|
|
3
3
|
import { Method } from '../sync/submitters/types';
|
|
4
4
|
export declare class KeyBuilderSS extends KeyBuilder {
|
|
5
|
-
|
|
5
|
+
latencyPrefix: string;
|
|
6
|
+
exceptionPrefix: string;
|
|
7
|
+
initPrefix: string;
|
|
8
|
+
private versionablePrefix;
|
|
6
9
|
constructor(prefix: string, metadata: IMetadata);
|
|
7
10
|
buildRegisteredSegmentsKey(): string;
|
|
8
11
|
buildImpressionsKey(): string;
|
|
12
|
+
buildImpressionsCountKey(): string;
|
|
13
|
+
buildUniqueKeysKey(): string;
|
|
9
14
|
buildEventsKey(): string;
|
|
10
15
|
searchPatternForSplitKeys(): string;
|
|
11
16
|
buildLatencyKey(method: Method, bucket: number): string;
|
|
12
17
|
buildExceptionKey(method: Method): string;
|
|
13
18
|
buildInitKey(): string;
|
|
14
|
-
private buildVersionablePrefix;
|
|
15
19
|
}
|
|
20
|
+
export declare function parseMetadata(field: string): [metadata: string] | string;
|
|
21
|
+
export declare function parseExceptionField(field: string): [metadata: string, method: Method] | string;
|
|
22
|
+
export declare function parseLatencyField(field: string): [metadata: string, method: Method, bucket: number] | string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ISplitFiltersValidation } from '../../dtos/types';
|
|
1
|
+
import { ISplit, ISplitFiltersValidation } from '../../dtos/types';
|
|
2
2
|
import { AbstractSplitsCacheSync } from '../AbstractSplitsCacheSync';
|
|
3
3
|
import { KeyBuilderCS } from '../KeyBuilderCS';
|
|
4
4
|
import { ILogger } from '../../logger/types';
|
|
@@ -26,9 +26,9 @@ export declare class SplitsCacheInLocal extends AbstractSplitsCacheSync {
|
|
|
26
26
|
* We cannot simply call `localStorage.clear()` since that implies removing user items from the storage.
|
|
27
27
|
*/
|
|
28
28
|
clear(): void;
|
|
29
|
-
addSplit(name: string, split:
|
|
29
|
+
addSplit(name: string, split: ISplit): boolean;
|
|
30
30
|
removeSplit(name: string): boolean;
|
|
31
|
-
getSplit(name: string):
|
|
31
|
+
getSplit(name: string): any;
|
|
32
32
|
setChangeNumber(changeNumber: number): boolean;
|
|
33
33
|
getChangeNumber(): number;
|
|
34
34
|
getSplitNames(): string[];
|
|
@@ -42,7 +42,6 @@ export declare class SplitsCacheInLocal extends AbstractSplitsCacheSync {
|
|
|
42
42
|
checkCache(): boolean;
|
|
43
43
|
/**
|
|
44
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
45
|
*
|
|
47
46
|
* @param {number | undefined} expirationTimestamp if the value is not a number, data will not be cleaned
|
|
48
47
|
*/
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { IImpressionCountsCacheSync } from '../types';
|
|
2
2
|
export declare class ImpressionCountsCacheInMemory implements IImpressionCountsCacheSync {
|
|
3
|
-
|
|
3
|
+
protected cache: Record<string, number>;
|
|
4
|
+
private readonly maxStorage;
|
|
5
|
+
protected onFullQueue?: () => void;
|
|
6
|
+
private cacheSize;
|
|
7
|
+
constructor(impressionCountsCacheSize?: number);
|
|
4
8
|
/**
|
|
5
9
|
* Builds key to be stored in the cache with the featureName and the timeFrame truncated.
|
|
6
10
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ISplit } from '../../dtos/types';
|
|
1
2
|
import { AbstractSplitsCacheSync } from '../AbstractSplitsCacheSync';
|
|
2
3
|
/**
|
|
3
4
|
* Default ISplitsCacheSync implementation that stores split definitions in memory.
|
|
@@ -9,9 +10,9 @@ export declare class SplitsCacheInMemory extends AbstractSplitsCacheSync {
|
|
|
9
10
|
private changeNumber;
|
|
10
11
|
private splitsWithSegmentsCount;
|
|
11
12
|
clear(): void;
|
|
12
|
-
addSplit(name: string, split:
|
|
13
|
+
addSplit(name: string, split: ISplit): boolean;
|
|
13
14
|
removeSplit(name: string): boolean;
|
|
14
|
-
getSplit(name: string):
|
|
15
|
+
getSplit(name: string): ISplit | null;
|
|
15
16
|
setChangeNumber(changeNumber: number): boolean;
|
|
16
17
|
getChangeNumber(): number;
|
|
17
18
|
getSplitNames(): string[];
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { ImpressionDataType, EventDataType, LastSync, HttpErrors, HttpLatencies, StreamingEvent, Method, OperationType, MethodExceptions, MethodLatencies } from '../../sync/submitters/types';
|
|
2
|
-
import { ITelemetryCacheSync } from '../types';
|
|
2
|
+
import { IStorageFactoryParams, ITelemetryCacheSync } from '../types';
|
|
3
|
+
export declare const MAX_LATENCY_BUCKET_COUNT = 23;
|
|
4
|
+
export declare function newBuckets(): number[];
|
|
3
5
|
/**
|
|
4
|
-
*
|
|
6
|
+
* Record telemetry if mode is not localhost.
|
|
7
|
+
* All factory instances track telemetry on server-side, and 0.1% on client-side.
|
|
5
8
|
*/
|
|
6
|
-
export declare function shouldRecordTelemetry(): boolean;
|
|
9
|
+
export declare function shouldRecordTelemetry(params: IStorageFactoryParams): boolean;
|
|
7
10
|
export declare class TelemetryCacheInMemory implements ITelemetryCacheSync {
|
|
8
11
|
private timeUntilReady?;
|
|
9
12
|
getTimeUntilReady(): number | undefined;
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { IUniqueKeysCacheBase } from '../types';
|
|
2
|
+
import { UniqueKeysPayloadCs } from '../../sync/submitters/types';
|
|
3
|
+
export declare class UniqueKeysCacheInMemoryCS implements IUniqueKeysCacheBase {
|
|
4
|
+
private onFullQueue?;
|
|
5
|
+
private readonly maxStorage;
|
|
6
|
+
private uniqueTrackerSize;
|
|
7
|
+
private uniqueKeysTracker;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param impressionsQueueSize number of queued impressions 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(uniqueKeysQueueSize?: number);
|
|
14
|
+
setOnFullQueueCb(cb: () => void): void;
|
|
15
|
+
/**
|
|
16
|
+
* Store unique keys in sequential order
|
|
17
|
+
* key: string = key.
|
|
18
|
+
* value: HashSet<string> = set of split names.
|
|
19
|
+
*/
|
|
20
|
+
track(key: string, featureName: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Clear the data stored on the cache.
|
|
23
|
+
*/
|
|
24
|
+
clear(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Pop the collected data, used as payload for posting.
|
|
27
|
+
*/
|
|
28
|
+
pop(): UniqueKeysPayloadCs;
|
|
29
|
+
/**
|
|
30
|
+
* Check if the cache is empty.
|
|
31
|
+
*/
|
|
32
|
+
isEmpty(): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Converts `uniqueKeys` data from cache into request payload.
|
|
35
|
+
*/
|
|
36
|
+
private fromUniqueKeysCollector;
|
|
37
|
+
}
|
|
@@ -23,7 +23,7 @@ export declare class EventsCacheInRedis implements IEventsCacheAsync {
|
|
|
23
23
|
drop(count?: number): Promise<any>;
|
|
24
24
|
/**
|
|
25
25
|
* Pop the given number of events from the storage.
|
|
26
|
-
* The returned promise rejects if the
|
|
26
|
+
* The returned promise rejects if the redis operation fails.
|
|
27
27
|
*
|
|
28
28
|
* NOTE: this method doesn't take into account MAX_EVENT_SIZE or MAX_QUEUE_BYTE_SIZE limits.
|
|
29
29
|
* It is the submitter responsability to handle that.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Redis } from 'ioredis';
|
|
2
|
+
import { ILogger } from '../../logger/types';
|
|
3
|
+
import { ImpressionCountsCacheInMemory } from '../inMemory/ImpressionCountsCacheInMemory';
|
|
4
|
+
export declare class ImpressionCountsCacheInRedis extends ImpressionCountsCacheInMemory {
|
|
5
|
+
private readonly log;
|
|
6
|
+
private readonly key;
|
|
7
|
+
private readonly redis;
|
|
8
|
+
private readonly refreshRate;
|
|
9
|
+
private intervalId;
|
|
10
|
+
constructor(log: ILogger, key: string, redis: Redis, impressionCountsCacheSize?: number, refreshRate?: number);
|
|
11
|
+
private postImpressionCountsInRedis;
|
|
12
|
+
start(): void;
|
|
13
|
+
stop(): Promise<boolean | import("ioredis").BooleanResponse | undefined>;
|
|
14
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { KeyBuilderSS } from '../KeyBuilderSS';
|
|
2
2
|
import { Redis } from 'ioredis';
|
|
3
3
|
import { ILogger } from '../../logger/types';
|
|
4
|
+
import { ISplit } from '../../dtos/types';
|
|
4
5
|
import { AbstractSplitsCacheAsync } from '../AbstractSplitsCacheAsync';
|
|
5
6
|
/**
|
|
6
7
|
* ISplitsCacheAsync implementation that stores split definitions in Redis.
|
|
@@ -19,13 +20,13 @@ export declare class SplitsCacheInRedis extends AbstractSplitsCacheAsync {
|
|
|
19
20
|
* The returned promise is resolved when the operation success
|
|
20
21
|
* or rejected if it fails (e.g., redis operation fails)
|
|
21
22
|
*/
|
|
22
|
-
addSplit(name: string, split:
|
|
23
|
+
addSplit(name: string, split: ISplit): Promise<boolean>;
|
|
23
24
|
/**
|
|
24
25
|
* Add a list of splits.
|
|
25
26
|
* The returned promise is resolved when the operation success
|
|
26
27
|
* or rejected if it fails (e.g., redis operation fails)
|
|
27
28
|
*/
|
|
28
|
-
addSplits(entries: [string,
|
|
29
|
+
addSplits(entries: [string, ISplit][]): Promise<boolean[]>;
|
|
29
30
|
/**
|
|
30
31
|
* Remove a given split.
|
|
31
32
|
* The returned promise is resolved when the operation success, with 1 or 0 indicating if the split existed or not.
|
|
@@ -42,7 +43,7 @@ export declare class SplitsCacheInRedis extends AbstractSplitsCacheAsync {
|
|
|
42
43
|
* Get split definition or null if it's not defined.
|
|
43
44
|
* Returned promise is rejected if redis operation fails.
|
|
44
45
|
*/
|
|
45
|
-
getSplit(name: string): Promise<
|
|
46
|
+
getSplit(name: string): Promise<ISplit | null>;
|
|
46
47
|
/**
|
|
47
48
|
* Set till number.
|
|
48
49
|
* The returned promise is resolved when the operation success,
|
|
@@ -63,7 +64,7 @@ export declare class SplitsCacheInRedis extends AbstractSplitsCacheAsync {
|
|
|
63
64
|
* @TODO we need to benchmark which is the maximun number of commands we could
|
|
64
65
|
* pipeline without kill redis performance.
|
|
65
66
|
*/
|
|
66
|
-
getAll(): Promise<
|
|
67
|
+
getAll(): Promise<ISplit[]>;
|
|
67
68
|
/**
|
|
68
69
|
* Get list of split names.
|
|
69
70
|
* The returned promise is resolved with the list of split names,
|
|
@@ -87,5 +88,5 @@ export declare class SplitsCacheInRedis extends AbstractSplitsCacheAsync {
|
|
|
87
88
|
* Fetches multiple splits definitions.
|
|
88
89
|
* Returned promise is rejected if redis operation fails.
|
|
89
90
|
*/
|
|
90
|
-
getSplits(names: string[]): Promise<Record<string,
|
|
91
|
+
getSplits(names: string[]): Promise<Record<string, ISplit | null>>;
|
|
91
92
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ILogger } from '../../logger/types';
|
|
2
|
-
import { Method } from '../../sync/submitters/types';
|
|
2
|
+
import { Method, MultiConfigs, MultiMethodExceptions, MultiMethodLatencies } from '../../sync/submitters/types';
|
|
3
3
|
import { KeyBuilderSS } from '../KeyBuilderSS';
|
|
4
4
|
import { ITelemetryCacheAsync } from '../types';
|
|
5
5
|
import { Redis } from 'ioredis';
|
|
@@ -17,4 +17,19 @@ export declare class TelemetryCacheInRedis implements ITelemetryCacheAsync {
|
|
|
17
17
|
recordLatency(method: Method, latencyMs: number): Promise<number | void>;
|
|
18
18
|
recordException(method: Method): Promise<number | void>;
|
|
19
19
|
recordConfig(): Promise<number | void>;
|
|
20
|
+
/**
|
|
21
|
+
* Pop telemetry latencies.
|
|
22
|
+
* The returned promise rejects if redis operations fail.
|
|
23
|
+
*/
|
|
24
|
+
popLatencies(): Promise<MultiMethodLatencies>;
|
|
25
|
+
/**
|
|
26
|
+
* Pop telemetry exceptions.
|
|
27
|
+
* The returned promise rejects if redis operations fail.
|
|
28
|
+
*/
|
|
29
|
+
popExceptions(): Promise<MultiMethodExceptions>;
|
|
30
|
+
/**
|
|
31
|
+
* Pop telemetry configs.
|
|
32
|
+
* The returned promise rejects if redis operations fail.
|
|
33
|
+
*/
|
|
34
|
+
popConfigs(): Promise<MultiConfigs>;
|
|
20
35
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IUniqueKeysCacheBase } from '../types';
|
|
2
|
+
import { Redis } from 'ioredis';
|
|
3
|
+
import { UniqueKeysCacheInMemory } from '../inMemory/UniqueKeysCacheInMemory';
|
|
4
|
+
import { ILogger } from '../../logger/types';
|
|
5
|
+
export declare class UniqueKeysCacheInRedis extends UniqueKeysCacheInMemory implements IUniqueKeysCacheBase {
|
|
6
|
+
private readonly log;
|
|
7
|
+
private readonly key;
|
|
8
|
+
private readonly redis;
|
|
9
|
+
private readonly refreshRate;
|
|
10
|
+
private intervalId;
|
|
11
|
+
constructor(log: ILogger, key: string, redis: Redis, uniqueKeysQueueSize?: number, refreshRate?: number);
|
|
12
|
+
private postUniqueKeysInRedis;
|
|
13
|
+
start(): void;
|
|
14
|
+
stop(): Promise<boolean | import("ioredis").BooleanResponse | undefined>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ILogger } from '../../logger/types';
|
|
2
|
+
import { ImpressionCountsCacheInMemory } from '../inMemory/ImpressionCountsCacheInMemory';
|
|
3
|
+
import { IPluggableStorageWrapper } from '../types';
|
|
4
|
+
export declare class ImpressionCountsCachePluggable extends ImpressionCountsCacheInMemory {
|
|
5
|
+
private readonly log;
|
|
6
|
+
private readonly key;
|
|
7
|
+
private readonly wrapper;
|
|
8
|
+
private readonly refreshRate;
|
|
9
|
+
private intervalId;
|
|
10
|
+
constructor(log: ILogger, key: string, wrapper: IPluggableStorageWrapper, impressionCountsCacheSize?: number, refreshRate?: number);
|
|
11
|
+
private storeImpressionCounts;
|
|
12
|
+
start(): void;
|
|
13
|
+
stop(): Promise<any>;
|
|
14
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { KeyBuilder } from '../KeyBuilder';
|
|
2
2
|
import { IPluggableStorageWrapper } from '../types';
|
|
3
3
|
import { ILogger } from '../../logger/types';
|
|
4
|
+
import { ISplit } from '../../dtos/types';
|
|
4
5
|
import { AbstractSplitsCacheAsync } from '../AbstractSplitsCacheAsync';
|
|
5
6
|
/**
|
|
6
7
|
* ISplitsCacheAsync implementation for pluggable storages.
|
|
@@ -23,13 +24,13 @@ export declare class SplitsCachePluggable extends AbstractSplitsCacheAsync {
|
|
|
23
24
|
* The returned promise is resolved when the operation success
|
|
24
25
|
* or rejected if it fails (e.g., wrapper operation fails)
|
|
25
26
|
*/
|
|
26
|
-
addSplit(name: string, split:
|
|
27
|
+
addSplit(name: string, split: ISplit): Promise<boolean>;
|
|
27
28
|
/**
|
|
28
29
|
* Add a list of splits.
|
|
29
30
|
* The returned promise is resolved when the operation success
|
|
30
31
|
* or rejected if it fails (e.g., wrapper operation fails)
|
|
31
32
|
*/
|
|
32
|
-
addSplits(entries: [string,
|
|
33
|
+
addSplits(entries: [string, ISplit][]): Promise<boolean[]>;
|
|
33
34
|
/**
|
|
34
35
|
* Remove a given split.
|
|
35
36
|
* The returned promise is resolved when the operation success, with a boolean indicating if the split existed or not.
|
|
@@ -47,19 +48,19 @@ export declare class SplitsCachePluggable extends AbstractSplitsCacheAsync {
|
|
|
47
48
|
* The returned promise is resolved with the split definition or null if it's not defined,
|
|
48
49
|
* or rejected if wrapper operation fails.
|
|
49
50
|
*/
|
|
50
|
-
getSplit(name: string): Promise<
|
|
51
|
+
getSplit(name: string): Promise<ISplit | null>;
|
|
51
52
|
/**
|
|
52
53
|
* Get list of splits.
|
|
53
54
|
* The returned promise is resolved with a map of split names to their split definition or null if it's not defined,
|
|
54
55
|
* or rejected if wrapper operation fails.
|
|
55
56
|
*/
|
|
56
|
-
getSplits(names: string[]): Promise<Record<string,
|
|
57
|
+
getSplits(names: string[]): Promise<Record<string, ISplit | null>>;
|
|
57
58
|
/**
|
|
58
59
|
* Get list of all split definitions.
|
|
59
60
|
* The returned promise is resolved with the list of split definitions,
|
|
60
61
|
* or rejected if wrapper operation fails.
|
|
61
62
|
*/
|
|
62
|
-
getAll(): Promise<
|
|
63
|
+
getAll(): Promise<ISplit[]>;
|
|
63
64
|
/**
|
|
64
65
|
* Get list of split names.
|
|
65
66
|
* The returned promise is resolved with the list of split names,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ILogger } from '../../logger/types';
|
|
2
|
-
import { Method } from '../../sync/submitters/types';
|
|
2
|
+
import { Method, MultiConfigs, MultiMethodExceptions, MultiMethodLatencies } from '../../sync/submitters/types';
|
|
3
3
|
import { KeyBuilderSS } from '../KeyBuilderSS';
|
|
4
4
|
import { IPluggableStorageWrapper, ITelemetryCacheAsync } from '../types';
|
|
5
5
|
export declare class TelemetryCachePluggable implements ITelemetryCacheAsync {
|
|
@@ -15,4 +15,20 @@ export declare class TelemetryCachePluggable implements ITelemetryCacheAsync {
|
|
|
15
15
|
constructor(log: ILogger, keys: KeyBuilderSS, wrapper: IPluggableStorageWrapper);
|
|
16
16
|
recordLatency(method: Method, latencyMs: number): Promise<number | void>;
|
|
17
17
|
recordException(method: Method): Promise<number | void>;
|
|
18
|
+
recordConfig(): Promise<boolean | void>;
|
|
19
|
+
/**
|
|
20
|
+
* Pop telemetry latencies.
|
|
21
|
+
* The returned promise rejects if wrapper operations fail.
|
|
22
|
+
*/
|
|
23
|
+
popLatencies(): Promise<MultiMethodLatencies>;
|
|
24
|
+
/**
|
|
25
|
+
* Pop telemetry exceptions.
|
|
26
|
+
* The returned promise rejects if wrapper operations fail.
|
|
27
|
+
*/
|
|
28
|
+
popExceptions(): Promise<MultiMethodExceptions>;
|
|
29
|
+
/**
|
|
30
|
+
* Pop telemetry configs.
|
|
31
|
+
* The returned promise rejects if wrapper operations fail.
|
|
32
|
+
*/
|
|
33
|
+
popConfigs(): Promise<MultiConfigs>;
|
|
18
34
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IPluggableStorageWrapper, IUniqueKeysCacheBase } from '../types';
|
|
2
|
+
import { UniqueKeysCacheInMemory } from '../inMemory/UniqueKeysCacheInMemory';
|
|
3
|
+
import { ILogger } from '../../logger/types';
|
|
4
|
+
export declare class UniqueKeysCachePluggable extends UniqueKeysCacheInMemory implements IUniqueKeysCacheBase {
|
|
5
|
+
private readonly log;
|
|
6
|
+
private readonly key;
|
|
7
|
+
private readonly wrapper;
|
|
8
|
+
private readonly refreshRate;
|
|
9
|
+
private intervalId;
|
|
10
|
+
constructor(log: ILogger, key: string, wrapper: IPluggableStorageWrapper, uniqueKeysQueueSize?: number, refreshRate?: number);
|
|
11
|
+
storeUniqueKeys(): Promise<any>;
|
|
12
|
+
start(): void;
|
|
13
|
+
stop(): Promise<any>;
|
|
14
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
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
|
-
import { ISet } from '../utils/lang/sets';
|
|
6
5
|
/**
|
|
7
6
|
* Interface of a pluggable storage wrapper.
|
|
8
7
|
*/
|
|
@@ -66,23 +65,25 @@ export interface IPluggableStorageWrapper {
|
|
|
66
65
|
getMany: (keys: string[]) => Promise<(string | null)[]>;
|
|
67
66
|
/** Integer operations */
|
|
68
67
|
/**
|
|
69
|
-
* 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.
|
|
70
69
|
*
|
|
71
70
|
* @function incr
|
|
72
71
|
* @param {string} key Key to increment
|
|
72
|
+
* @param {number} increment Value to increment by
|
|
73
73
|
* @returns {Promise<number>} A promise that resolves with the value of key after the increment. The promise rejects if the operation fails,
|
|
74
74
|
* for example, if there is a connection error or the key contains a string that can not be represented as integer.
|
|
75
75
|
*/
|
|
76
|
-
incr: (key: string) => Promise<number>;
|
|
76
|
+
incr: (key: string, increment?: number) => Promise<number>;
|
|
77
77
|
/**
|
|
78
|
-
* 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.
|
|
79
79
|
*
|
|
80
80
|
* @function decr
|
|
81
81
|
* @param {string} key Key to decrement
|
|
82
|
+
* @param {number} decrement Value to decrement by
|
|
82
83
|
* @returns {Promise<number>} A promise that resolves with the value of key after the decrement. The promise rejects if the operation fails,
|
|
83
84
|
* for example, if there is a connection error or the key contains a string that can not be represented as integer.
|
|
84
85
|
*/
|
|
85
|
-
decr: (key: string) => Promise<number>;
|
|
86
|
+
decr: (key: string, decrement?: number) => Promise<number>;
|
|
86
87
|
/** Queue operations */
|
|
87
88
|
/**
|
|
88
89
|
* Inserts given items at the tail of `key` list. If `key` does not exist, an empty list is created before pushing the items.
|
|
@@ -179,13 +180,13 @@ export interface IPluggableStorageWrapper {
|
|
|
179
180
|
}
|
|
180
181
|
/** Splits cache */
|
|
181
182
|
export interface ISplitsCacheBase {
|
|
182
|
-
addSplits(entries: [string,
|
|
183
|
+
addSplits(entries: [string, ISplit][]): MaybeThenable<boolean[] | void>;
|
|
183
184
|
removeSplits(names: string[]): MaybeThenable<boolean[] | void>;
|
|
184
|
-
getSplit(name: string): MaybeThenable<
|
|
185
|
-
getSplits(names: string[]): MaybeThenable<Record<string,
|
|
185
|
+
getSplit(name: string): MaybeThenable<ISplit | null>;
|
|
186
|
+
getSplits(names: string[]): MaybeThenable<Record<string, ISplit | null>>;
|
|
186
187
|
setChangeNumber(changeNumber: number): MaybeThenable<boolean | void>;
|
|
187
188
|
getChangeNumber(): MaybeThenable<number>;
|
|
188
|
-
getAll(): MaybeThenable<
|
|
189
|
+
getAll(): MaybeThenable<ISplit[]>;
|
|
189
190
|
getSplitNames(): MaybeThenable<string[]>;
|
|
190
191
|
trafficTypeExists(trafficType: string): MaybeThenable<boolean>;
|
|
191
192
|
usesSegments(): MaybeThenable<boolean>;
|
|
@@ -194,13 +195,13 @@ export interface ISplitsCacheBase {
|
|
|
194
195
|
killLocally(name: string, defaultTreatment: string, changeNumber: number): MaybeThenable<boolean>;
|
|
195
196
|
}
|
|
196
197
|
export interface ISplitsCacheSync extends ISplitsCacheBase {
|
|
197
|
-
addSplits(entries: [string,
|
|
198
|
+
addSplits(entries: [string, ISplit][]): boolean[];
|
|
198
199
|
removeSplits(names: string[]): boolean[];
|
|
199
|
-
getSplit(name: string):
|
|
200
|
-
getSplits(names: string[]): Record<string,
|
|
200
|
+
getSplit(name: string): ISplit | null;
|
|
201
|
+
getSplits(names: string[]): Record<string, ISplit | null>;
|
|
201
202
|
setChangeNumber(changeNumber: number): boolean;
|
|
202
203
|
getChangeNumber(): number;
|
|
203
|
-
getAll():
|
|
204
|
+
getAll(): ISplit[];
|
|
204
205
|
getSplitNames(): string[];
|
|
205
206
|
trafficTypeExists(trafficType: string): boolean;
|
|
206
207
|
usesSegments(): boolean;
|
|
@@ -209,13 +210,13 @@ export interface ISplitsCacheSync extends ISplitsCacheBase {
|
|
|
209
210
|
killLocally(name: string, defaultTreatment: string, changeNumber: number): boolean;
|
|
210
211
|
}
|
|
211
212
|
export interface ISplitsCacheAsync extends ISplitsCacheBase {
|
|
212
|
-
addSplits(entries: [string,
|
|
213
|
+
addSplits(entries: [string, ISplit][]): Promise<boolean[] | void>;
|
|
213
214
|
removeSplits(names: string[]): Promise<boolean[] | void>;
|
|
214
|
-
getSplit(name: string): Promise<
|
|
215
|
-
getSplits(names: string[]): Promise<Record<string,
|
|
215
|
+
getSplit(name: string): Promise<ISplit | null>;
|
|
216
|
+
getSplits(names: string[]): Promise<Record<string, ISplit | null>>;
|
|
216
217
|
setChangeNumber(changeNumber: number): Promise<boolean | void>;
|
|
217
218
|
getChangeNumber(): Promise<number>;
|
|
218
|
-
getAll(): Promise<
|
|
219
|
+
getAll(): Promise<ISplit[]>;
|
|
219
220
|
getSplitNames(): Promise<string[]>;
|
|
220
221
|
trafficTypeExists(trafficType: string): Promise<boolean>;
|
|
221
222
|
usesSegments(): Promise<boolean>;
|
|
@@ -298,16 +299,12 @@ export interface IImpressionCountsCacheSync extends IRecorderCacheProducerSync<R
|
|
|
298
299
|
isEmpty(): boolean;
|
|
299
300
|
pop(toMerge?: Record<string, number>): Record<string, number>;
|
|
300
301
|
}
|
|
301
|
-
export interface IUniqueKeysCacheBase
|
|
302
|
-
|
|
303
|
-
}> {
|
|
304
|
-
track(featureName: string, timeFrame: number, amount: number): void;
|
|
302
|
+
export interface IUniqueKeysCacheBase {
|
|
303
|
+
track(key: string, value: string): void;
|
|
305
304
|
isEmpty(): boolean;
|
|
306
|
-
pop(
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
[featureName: string]: ISet<string>;
|
|
310
|
-
};
|
|
305
|
+
pop(): UniqueKeysPayloadSs | UniqueKeysPayloadCs;
|
|
306
|
+
setOnFullQueueCb(cb: () => void): void;
|
|
307
|
+
clear(): void;
|
|
311
308
|
}
|
|
312
309
|
/**
|
|
313
310
|
* Telemetry storage interface for standalone and partial consumer modes.
|
|
@@ -366,32 +363,34 @@ export interface ITelemetryCacheSync extends ITelemetryStorageConsumerSync, ITel
|
|
|
366
363
|
* Methods are async because data is stored in Redis or a pluggable storage.
|
|
367
364
|
*/
|
|
368
365
|
export interface ITelemetryEvaluationConsumerAsync {
|
|
369
|
-
|
|
370
|
-
|
|
366
|
+
popLatencies(): Promise<MultiMethodLatencies>;
|
|
367
|
+
popExceptions(): Promise<MultiMethodExceptions>;
|
|
368
|
+
popConfigs(): Promise<MultiConfigs>;
|
|
371
369
|
}
|
|
372
370
|
export interface ITelemetryEvaluationProducerAsync {
|
|
373
371
|
recordLatency(method: Method, latencyMs: number): Promise<any>;
|
|
374
372
|
recordException(method: Method): Promise<any>;
|
|
373
|
+
recordConfig(): Promise<any>;
|
|
375
374
|
}
|
|
376
|
-
export interface ITelemetryCacheAsync extends ITelemetryEvaluationProducerAsync {
|
|
375
|
+
export interface ITelemetryCacheAsync extends ITelemetryEvaluationProducerAsync, ITelemetryEvaluationConsumerAsync {
|
|
377
376
|
}
|
|
378
377
|
/**
|
|
379
378
|
* Storages
|
|
380
379
|
*/
|
|
381
|
-
export interface IStorageBase<TSplitsCache extends ISplitsCacheBase, TSegmentsCache extends ISegmentsCacheBase, TImpressionsCache extends IImpressionsCacheBase, TEventsCache extends IEventsCacheBase, TTelemetryCache extends ITelemetryCacheSync | ITelemetryCacheAsync, TUniqueKeysCache extends IUniqueKeysCacheBase> {
|
|
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> {
|
|
382
381
|
splits: TSplitsCache;
|
|
383
382
|
segments: TSegmentsCache;
|
|
384
383
|
impressions: TImpressionsCache;
|
|
385
|
-
impressionCounts?:
|
|
384
|
+
impressionCounts?: TImpressionsCountCache;
|
|
386
385
|
events: TEventsCache;
|
|
387
386
|
telemetry?: TTelemetryCache;
|
|
388
387
|
uniqueKeys?: TUniqueKeysCache;
|
|
389
388
|
destroy(): void | Promise<void>;
|
|
390
389
|
shared?: (matchingKey: string, onReadyCb: (error?: any) => void) => this;
|
|
391
390
|
}
|
|
392
|
-
export interface IStorageSync extends IStorageBase<ISplitsCacheSync, ISegmentsCacheSync, IImpressionsCacheSync, IEventsCacheSync, ITelemetryCacheSync, IUniqueKeysCacheBase> {
|
|
391
|
+
export interface IStorageSync extends IStorageBase<ISplitsCacheSync, ISegmentsCacheSync, IImpressionsCacheSync, IImpressionCountsCacheSync, IEventsCacheSync, ITelemetryCacheSync, IUniqueKeysCacheBase> {
|
|
393
392
|
}
|
|
394
|
-
export interface IStorageAsync extends IStorageBase<ISplitsCacheAsync, ISegmentsCacheAsync, IImpressionsCacheAsync | IImpressionsCacheSync, IEventsCacheAsync | IEventsCacheSync, ITelemetryCacheAsync, IUniqueKeysCacheBase> {
|
|
393
|
+
export interface IStorageAsync extends IStorageBase<ISplitsCacheAsync, ISegmentsCacheAsync, IImpressionsCacheAsync | IImpressionsCacheSync, IImpressionCountsCacheSync, IEventsCacheAsync | IEventsCacheSync, ITelemetryCacheAsync | ITelemetryCacheSync, IUniqueKeysCacheBase> {
|
|
395
394
|
}
|
|
396
395
|
/** StorageFactory */
|
|
397
396
|
export declare type DataLoader = (storage: IStorageSync, matchingKey: string) => void;
|
|
@@ -401,6 +400,7 @@ export interface IStorageFactoryParams {
|
|
|
401
400
|
eventsQueueSize?: number;
|
|
402
401
|
optimize?: boolean;
|
|
403
402
|
mode: SDKMode;
|
|
403
|
+
impressionsMode?: string;
|
|
404
404
|
matchingKey?: string;
|
|
405
405
|
splitFiltersValidation?: ISplitFiltersValidation;
|
|
406
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
|
}
|