@splitsoftware/splitio-commons 1.6.2-rc.1 → 1.6.2-rc.11
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 +72 -0
- package/cjs/storages/inMemory/UniqueKeysCacheInMemoryCS.js +76 -0
- package/cjs/storages/inRedis/EventsCacheInRedis.js +1 -1
- package/cjs/storages/inRedis/ImpressionCountsCacheInRedis.js +85 -0
- package/cjs/storages/inRedis/SplitsCacheInRedis.js +15 -9
- package/cjs/storages/inRedis/TelemetryCacheInRedis.js +100 -0
- package/cjs/storages/inRedis/UniqueKeysCacheInRedis.js +71 -0
- package/cjs/storages/inRedis/constants.js +4 -1
- package/cjs/storages/inRedis/index.js +17 -2
- package/cjs/storages/pluggable/ImpressionCountsCachePluggable.js +81 -0
- package/cjs/storages/pluggable/SplitsCachePluggable.js +14 -9
- package/cjs/storages/pluggable/TelemetryCachePluggable.js +126 -0
- package/cjs/storages/pluggable/UniqueKeysCachePluggable.js +61 -0
- package/cjs/storages/pluggable/index.js +46 -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 +68 -0
- package/esm/storages/inMemory/UniqueKeysCacheInMemoryCS.js +73 -0
- package/esm/storages/inRedis/EventsCacheInRedis.js +1 -1
- package/esm/storages/inRedis/ImpressionCountsCacheInRedis.js +82 -0
- package/esm/storages/inRedis/SplitsCacheInRedis.js +15 -9
- package/esm/storages/inRedis/TelemetryCacheInRedis.js +100 -0
- package/esm/storages/inRedis/UniqueKeysCacheInRedis.js +68 -0
- package/esm/storages/inRedis/constants.js +3 -0
- package/esm/storages/inRedis/index.js +18 -3
- package/esm/storages/pluggable/ImpressionCountsCachePluggable.js +78 -0
- package/esm/storages/pluggable/SplitsCachePluggable.js +14 -9
- package/esm/storages/pluggable/TelemetryCachePluggable.js +126 -0
- package/esm/storages/pluggable/UniqueKeysCachePluggable.js +58 -0
- package/esm/storages/pluggable/index.js +47 -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 +80 -0
- package/src/storages/inMemory/UniqueKeysCacheInMemoryCS.ts +86 -0
- package/src/storages/inRedis/EventsCacheInRedis.ts +1 -1
- package/src/storages/inRedis/ImpressionCountsCacheInRedis.ts +95 -0
- package/src/storages/inRedis/SplitsCacheInRedis.ts +21 -17
- package/src/storages/inRedis/TelemetryCacheInRedis.ts +122 -2
- package/src/storages/inRedis/UniqueKeysCacheInRedis.ts +77 -0
- package/src/storages/inRedis/constants.ts +3 -0
- package/src/storages/inRedis/index.ts +15 -5
- package/src/storages/pluggable/ImpressionCountsCachePluggable.ts +92 -0
- package/src/storages/pluggable/SplitsCachePluggable.ts +20 -17
- package/src/storages/pluggable/TelemetryCachePluggable.ts +147 -2
- package/src/storages/pluggable/UniqueKeysCachePluggable.ts +67 -0
- package/src/storages/pluggable/index.ts +51 -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 +26 -12
- 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 +35 -0
- package/types/storages/inRedis/EventsCacheInRedis.d.ts +1 -1
- package/types/storages/inRedis/ImpressionCountsCacheInRedis.d.ts +16 -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 +21 -0
- package/types/storages/pluggable/ImpressionCountsCachePluggable.d.ts +16 -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 +20 -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 +19 -12
- 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,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,21 @@
|
|
|
1
|
+
import { IUniqueKeysCacheBase } from '../types';
|
|
2
|
+
import { Redis } from 'ioredis';
|
|
3
|
+
import { UniqueKeysCacheInMemory } from '../inMemory/UniqueKeysCacheInMemory';
|
|
4
|
+
import { ILogger } from '../../logger/types';
|
|
5
|
+
import { UniqueKeysItemSs } from '../../sync/submitters/types';
|
|
6
|
+
export declare class UniqueKeysCacheInRedis extends UniqueKeysCacheInMemory implements IUniqueKeysCacheBase {
|
|
7
|
+
private readonly log;
|
|
8
|
+
private readonly key;
|
|
9
|
+
private readonly redis;
|
|
10
|
+
private readonly refreshRate;
|
|
11
|
+
private intervalId;
|
|
12
|
+
constructor(log: ILogger, key: string, redis: Redis, uniqueKeysQueueSize?: number, refreshRate?: number);
|
|
13
|
+
private postUniqueKeysInRedis;
|
|
14
|
+
start(): void;
|
|
15
|
+
stop(): Promise<boolean | import("ioredis").BooleanResponse | undefined>;
|
|
16
|
+
/**
|
|
17
|
+
* Async consumer API, used by synchronizer.
|
|
18
|
+
* @param count number of items to pop from the queue. If not provided or equal 0, all items will be popped.
|
|
19
|
+
*/
|
|
20
|
+
popNRaw(count?: number): Promise<UniqueKeysItemSs[]>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ILogger } from '../../logger/types';
|
|
2
|
+
import { ImpressionCountsPayload } from '../../sync/submitters/types';
|
|
3
|
+
import { ImpressionCountsCacheInMemory } from '../inMemory/ImpressionCountsCacheInMemory';
|
|
4
|
+
import { IPluggableStorageWrapper } from '../types';
|
|
5
|
+
export declare class ImpressionCountsCachePluggable extends ImpressionCountsCacheInMemory {
|
|
6
|
+
private readonly log;
|
|
7
|
+
private readonly key;
|
|
8
|
+
private readonly wrapper;
|
|
9
|
+
private readonly refreshRate;
|
|
10
|
+
private intervalId;
|
|
11
|
+
constructor(log: ILogger, key: string, wrapper: IPluggableStorageWrapper, impressionCountsCacheSize?: number, refreshRate?: number);
|
|
12
|
+
private storeImpressionCounts;
|
|
13
|
+
start(): void;
|
|
14
|
+
stop(): Promise<any>;
|
|
15
|
+
getImpressionsCount(): Promise<ImpressionCountsPayload | undefined>;
|
|
16
|
+
}
|
|
@@ -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,20 @@
|
|
|
1
|
+
import { IPluggableStorageWrapper, IUniqueKeysCacheBase } from '../types';
|
|
2
|
+
import { UniqueKeysCacheInMemory } from '../inMemory/UniqueKeysCacheInMemory';
|
|
3
|
+
import { ILogger } from '../../logger/types';
|
|
4
|
+
import { UniqueKeysItemSs } from '../../sync/submitters/types';
|
|
5
|
+
export declare class UniqueKeysCachePluggable extends UniqueKeysCacheInMemory implements IUniqueKeysCacheBase {
|
|
6
|
+
private readonly log;
|
|
7
|
+
private readonly key;
|
|
8
|
+
private readonly wrapper;
|
|
9
|
+
private readonly refreshRate;
|
|
10
|
+
private intervalId;
|
|
11
|
+
constructor(log: ILogger, key: string, wrapper: IPluggableStorageWrapper, uniqueKeysQueueSize?: number, refreshRate?: number);
|
|
12
|
+
storeUniqueKeys(): Promise<any>;
|
|
13
|
+
start(): void;
|
|
14
|
+
stop(): Promise<any>;
|
|
15
|
+
/**
|
|
16
|
+
* Async consumer API, used by synchronizer.
|
|
17
|
+
* @param count number of items to pop from the queue. If not provided or equal 0, all items will be popped.
|
|
18
|
+
*/
|
|
19
|
+
popNRaw(count?: number): Promise<UniqueKeysItemSs[]>;
|
|
20
|
+
}
|
|
@@ -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
|
}
|
|
@@ -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,13 +33,14 @@ export declare type ImpressionCountsPayload = {
|
|
|
32
33
|
rc: number;
|
|
33
34
|
}[];
|
|
34
35
|
};
|
|
36
|
+
export declare type UniqueKeysItemSs = {
|
|
37
|
+
/** Split name */
|
|
38
|
+
f: string;
|
|
39
|
+
/** keyNames */
|
|
40
|
+
ks: string[];
|
|
41
|
+
};
|
|
35
42
|
export declare type UniqueKeysPayloadSs = {
|
|
36
|
-
keys:
|
|
37
|
-
/** Split name */
|
|
38
|
-
f: string;
|
|
39
|
-
/** keyNames */
|
|
40
|
-
ks: string[];
|
|
41
|
-
}[];
|
|
43
|
+
keys: UniqueKeysItemSs[];
|
|
42
44
|
};
|
|
43
45
|
export declare type UniqueKeysPayloadCs = {
|
|
44
46
|
keys: {
|
|
@@ -75,6 +77,9 @@ export declare type StoredEventWithMetadata = {
|
|
|
75
77
|
/** Stored event */
|
|
76
78
|
e: SplitIO.EventData;
|
|
77
79
|
};
|
|
80
|
+
export declare type MultiMethodLatencies = IMap<string, MethodLatencies>;
|
|
81
|
+
export declare type MultiMethodExceptions = IMap<string, MethodExceptions>;
|
|
82
|
+
export declare type MultiConfigs = IMap<string, TelemetryConfigStats>;
|
|
78
83
|
/**
|
|
79
84
|
* Telemetry usage stats
|
|
80
85
|
*/
|
|
@@ -119,10 +124,12 @@ export declare type StreamingEvent = {
|
|
|
119
124
|
d?: number;
|
|
120
125
|
t: number;
|
|
121
126
|
};
|
|
122
|
-
export declare type
|
|
127
|
+
export declare type TelemetryUsageStats = {
|
|
128
|
+
mL?: MethodLatencies;
|
|
129
|
+
mE?: MethodExceptions;
|
|
130
|
+
};
|
|
131
|
+
export declare type TelemetryUsageStatsPayload = TelemetryUsageStats & {
|
|
123
132
|
lS: LastSync;
|
|
124
|
-
mL: MethodLatencies;
|
|
125
|
-
mE: MethodExceptions;
|
|
126
133
|
hE: HttpErrors;
|
|
127
134
|
hL: HttpLatencies;
|
|
128
135
|
tR: number;
|
|
@@ -130,9 +137,9 @@ export declare type TelemetryUsageStatsPayload = {
|
|
|
130
137
|
iQ: number;
|
|
131
138
|
iDe: number;
|
|
132
139
|
iDr: number;
|
|
133
|
-
spC
|
|
134
|
-
seC
|
|
135
|
-
skC
|
|
140
|
+
spC?: number;
|
|
141
|
+
seC?: number;
|
|
142
|
+
skC?: number;
|
|
136
143
|
sL?: number;
|
|
137
144
|
eQ: number;
|
|
138
145
|
eD: number;
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
import { ISdkFactoryContextSync } from '../../sdkFactory/types';
|
|
2
|
-
import { ISet } from '../../utils/lang/sets';
|
|
3
|
-
import { UniqueKeysPayloadCs, UniqueKeysPayloadSs } from './types';
|
|
4
|
-
/**
|
|
5
|
-
* Converts `uniqueKeys` data from cache into request payload for CS.
|
|
6
|
-
*/
|
|
7
|
-
export declare function fromUniqueKeysCollectorCs(uniqueKeys: {
|
|
8
|
-
[featureName: string]: ISet<string>;
|
|
9
|
-
}): UniqueKeysPayloadCs;
|
|
10
|
-
/**
|
|
11
|
-
* Converts `uniqueKeys` data from cache into request payload for SS.
|
|
12
|
-
*/
|
|
13
|
-
export declare function fromUniqueKeysCollectorSs(uniqueKeys: {
|
|
14
|
-
[featureName: string]: ISet<string>;
|
|
15
|
-
}): UniqueKeysPayloadSs;
|
|
16
2
|
/**
|
|
17
3
|
* Submitter that periodically posts impression counts
|
|
18
4
|
*/
|
|
@@ -2,7 +2,6 @@ import { SplitIO, ImpressionDTO } from '../types';
|
|
|
2
2
|
import { StreamingEventType, Method, OperationType } from '../sync/submitters/types';
|
|
3
3
|
import { IEventsCacheBase } from '../storages/types';
|
|
4
4
|
import { NetworkError } from '../services/types';
|
|
5
|
-
import { ISet } from '../utils/lang/sets';
|
|
6
5
|
/** Events tracker */
|
|
7
6
|
export interface IEventsHandler {
|
|
8
7
|
handleEvent(eventData: SplitIO.EventData): any;
|
|
@@ -34,11 +33,16 @@ export interface ITelemetryTracker {
|
|
|
34
33
|
* Records streaming event
|
|
35
34
|
*/
|
|
36
35
|
streamingEvent(e: StreamingEventType | AUTH_REJECTION, d?: number): void;
|
|
36
|
+
/**
|
|
37
|
+
* Records tag
|
|
38
|
+
*/
|
|
39
|
+
addTag(tag: string): void;
|
|
37
40
|
}
|
|
38
41
|
export interface IFilterAdapter {
|
|
39
|
-
add(
|
|
40
|
-
contains(
|
|
42
|
+
add(key: string, featureName: string): boolean;
|
|
43
|
+
contains(key: string, featureName: string): boolean;
|
|
41
44
|
clear(): void;
|
|
45
|
+
refreshRate?: number;
|
|
42
46
|
}
|
|
43
47
|
export interface IImpressionSenderAdapter {
|
|
44
48
|
recordUniqueKeys(data: Object): void;
|
|
@@ -46,14 +50,8 @@ export interface IImpressionSenderAdapter {
|
|
|
46
50
|
}
|
|
47
51
|
/** Unique keys tracker */
|
|
48
52
|
export interface IUniqueKeysTracker {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
[featureName: string]: ISet<string>;
|
|
52
|
-
}): {
|
|
53
|
-
[featureName: string]: ISet<string>;
|
|
54
|
-
};
|
|
55
|
-
clear(): void;
|
|
56
|
-
isEmpty(): boolean;
|
|
53
|
+
stop(): void;
|
|
54
|
+
track(key: string, featureName: string): void;
|
|
57
55
|
}
|
|
58
56
|
export interface IStrategyResult {
|
|
59
57
|
impressionsToStore: ImpressionDTO[];
|
|
@@ -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
|
@@ -32,6 +32,7 @@ export declare const CONSUMER_ENUM = 1;
|
|
|
32
32
|
export declare const CONSUMER_PARTIAL_ENUM = 2;
|
|
33
33
|
export declare const OPTIMIZED_ENUM = 0;
|
|
34
34
|
export declare const DEBUG_ENUM = 1;
|
|
35
|
+
export declare const NONE_ENUM = 2;
|
|
35
36
|
export declare const SPLITS = "sp";
|
|
36
37
|
export declare const IMPRESSIONS = "im";
|
|
37
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 {
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ISignalListener } from '../listeners/types';
|
|
2
|
-
import { ISdkReadinessManager } from '../readiness/types';
|
|
3
|
-
import { IStorageAsync, IStorageSync } from '../storages/types';
|
|
4
|
-
import { ISyncManager } from '../sync/types';
|
|
5
|
-
import { IEventTracker, IImpressionsTracker } from '../trackers/types';
|
|
6
|
-
import { ISettings } from '../types';
|
|
7
|
-
export interface IClientFactoryParams {
|
|
8
|
-
storage: IStorageSync | IStorageAsync;
|
|
9
|
-
sdkReadinessManager: ISdkReadinessManager;
|
|
10
|
-
settings: ISettings;
|
|
11
|
-
impressionsTracker: IImpressionsTracker;
|
|
12
|
-
eventTracker: IEventTracker;
|
|
13
|
-
}
|
|
14
|
-
export interface ISdkClientFactoryParams extends IClientFactoryParams {
|
|
15
|
-
signalListener?: ISignalListener;
|
|
16
|
-
syncManager?: ISyncManager;
|
|
17
|
-
sharedClient?: boolean;
|
|
18
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
}
|