@splitsoftware/splitio-commons 1.17.1-rc.4 → 1.17.1-rc.5
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 +28 -29
- package/LICENSE +1 -1
- package/README.md +4 -3
- package/cjs/consent/sdkUserConsent.js +4 -2
- package/cjs/evaluator/matchers/index.js +1 -3
- package/cjs/evaluator/matchers/matcherTypes.js +0 -1
- package/cjs/evaluator/matchers/segment.js +0 -6
- package/cjs/evaluator/matchersTransform/index.js +1 -4
- package/cjs/evaluator/matchersTransform/segment.js +1 -3
- package/cjs/logger/constants.js +2 -2
- package/cjs/logger/messages/info.js +1 -1
- package/cjs/logger/messages/warn.js +1 -1
- package/cjs/readiness/readinessManager.js +8 -18
- package/cjs/readiness/sdkReadinessManager.js +6 -5
- package/cjs/sdkClient/sdkClient.js +5 -5
- package/cjs/sdkClient/sdkClientMethod.js +1 -3
- package/cjs/sdkClient/sdkClientMethodCS.js +15 -9
- package/cjs/sdkClient/sdkClientMethodCSWithTT.js +15 -9
- package/cjs/sdkFactory/index.js +10 -32
- package/cjs/services/decorateHeaders.js +6 -1
- package/cjs/services/splitApi.js +5 -5
- package/cjs/services/splitHttpClient.js +5 -2
- package/cjs/storages/AbstractSegmentsCacheSync.js +33 -0
- package/cjs/storages/AbstractSplitsCacheSync.js +1 -2
- package/cjs/storages/KeyBuilderCS.js +5 -23
- package/cjs/storages/dataLoader.js +1 -1
- package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +56 -33
- package/cjs/storages/inLocalStorage/index.js +2 -6
- package/cjs/storages/inMemory/InMemoryStorageCS.js +1 -6
- package/cjs/storages/inMemory/MySegmentsCacheInMemory.js +44 -13
- package/cjs/storages/inMemory/SegmentsCacheInMemory.js +28 -14
- package/cjs/storages/inMemory/SplitsCacheInMemory.js +9 -8
- package/cjs/storages/inMemory/TelemetryCacheInMemory.js +10 -7
- package/cjs/storages/inRedis/SegmentsCacheInRedis.js +21 -15
- package/cjs/storages/inRedis/index.js +11 -5
- package/cjs/storages/pluggable/SegmentsCachePluggable.js +34 -13
- package/cjs/storages/pluggable/inMemoryWrapper.js +1 -1
- package/cjs/sync/offline/syncManagerOffline.js +11 -18
- package/cjs/sync/polling/fetchers/mySegmentsFetcher.js +8 -5
- package/cjs/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
- package/cjs/sync/polling/pollingManagerCS.js +1 -1
- package/cjs/sync/polling/syncTasks/mySegmentsSyncTask.js +2 -2
- package/cjs/sync/polling/updaters/mySegmentsUpdater.js +21 -15
- package/cjs/sync/polling/updaters/segmentChangesUpdater.js +28 -12
- package/cjs/sync/polling/updaters/splitChangesUpdater.js +1 -1
- package/cjs/sync/streaming/AuthClient/index.js +1 -1
- package/cjs/sync/streaming/SSEHandler/index.js +5 -3
- package/cjs/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +48 -107
- package/cjs/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +3 -3
- package/cjs/sync/streaming/constants.js +3 -3
- package/cjs/sync/streaming/parseUtils.js +9 -14
- package/cjs/sync/streaming/pushManager.js +67 -69
- package/cjs/sync/syncManagerOnline.js +21 -20
- package/cjs/sync/syncTask.js +2 -2
- package/cjs/trackers/eventTracker.js +10 -12
- package/cjs/trackers/impressionsTracker.js +14 -16
- package/cjs/trackers/uniqueKeysTracker.js +3 -5
- package/cjs/utils/constants/index.js +4 -5
- package/cjs/utils/settingsValidation/index.js +1 -2
- package/esm/consent/sdkUserConsent.js +4 -2
- package/esm/evaluator/matchers/index.js +1 -3
- package/esm/evaluator/matchers/matcherTypes.js +0 -1
- package/esm/evaluator/matchers/segment.js +0 -6
- package/esm/evaluator/matchersTransform/index.js +1 -4
- package/esm/evaluator/matchersTransform/segment.js +1 -3
- package/esm/logger/constants.js +1 -1
- package/esm/logger/messages/info.js +1 -1
- package/esm/logger/messages/warn.js +1 -1
- package/esm/readiness/readinessManager.js +8 -18
- package/esm/readiness/sdkReadinessManager.js +6 -5
- package/esm/sdkClient/sdkClient.js +5 -5
- package/esm/sdkClient/sdkClientMethod.js +1 -3
- package/esm/sdkClient/sdkClientMethodCS.js +13 -7
- package/esm/sdkClient/sdkClientMethodCSWithTT.js +13 -7
- package/esm/sdkFactory/index.js +10 -32
- package/esm/services/decorateHeaders.js +4 -0
- package/esm/services/splitApi.js +6 -6
- package/esm/services/splitHttpClient.js +6 -3
- package/esm/storages/AbstractSegmentsCacheSync.js +30 -0
- package/esm/storages/AbstractSplitsCacheSync.js +2 -3
- package/esm/storages/KeyBuilderCS.js +4 -21
- package/esm/storages/dataLoader.js +1 -1
- package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +56 -33
- package/esm/storages/inLocalStorage/index.js +3 -7
- package/esm/storages/inMemory/InMemoryStorageCS.js +1 -6
- package/esm/storages/inMemory/MySegmentsCacheInMemory.js +44 -13
- package/esm/storages/inMemory/SegmentsCacheInMemory.js +28 -14
- package/esm/storages/inMemory/SplitsCacheInMemory.js +9 -8
- package/esm/storages/inMemory/TelemetryCacheInMemory.js +10 -7
- package/esm/storages/inRedis/SegmentsCacheInRedis.js +21 -15
- package/esm/storages/inRedis/index.js +11 -5
- package/esm/storages/pluggable/SegmentsCachePluggable.js +34 -13
- package/esm/storages/pluggable/inMemoryWrapper.js +1 -1
- package/esm/sync/offline/syncManagerOffline.js +11 -18
- package/esm/sync/polling/fetchers/mySegmentsFetcher.js +8 -5
- package/esm/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
- package/esm/sync/polling/pollingManagerCS.js +1 -1
- package/esm/sync/polling/syncTasks/mySegmentsSyncTask.js +2 -2
- package/esm/sync/polling/updaters/mySegmentsUpdater.js +21 -15
- package/esm/sync/polling/updaters/segmentChangesUpdater.js +28 -12
- package/esm/sync/polling/updaters/splitChangesUpdater.js +1 -1
- package/esm/sync/streaming/AuthClient/index.js +1 -1
- package/esm/sync/streaming/SSEHandler/index.js +6 -4
- package/esm/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +49 -108
- package/esm/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +3 -3
- package/esm/sync/streaming/constants.js +2 -2
- package/esm/sync/streaming/parseUtils.js +8 -12
- package/esm/sync/streaming/pushManager.js +70 -72
- package/esm/sync/syncManagerOnline.js +21 -20
- package/esm/sync/syncTask.js +2 -2
- package/esm/trackers/eventTracker.js +10 -12
- package/esm/trackers/impressionsTracker.js +14 -16
- package/esm/trackers/uniqueKeysTracker.js +3 -5
- package/esm/utils/constants/index.js +2 -3
- package/esm/utils/settingsValidation/index.js +1 -2
- package/package.json +1 -1
- package/src/consent/sdkUserConsent.ts +3 -2
- package/src/dtos/types.ts +7 -21
- package/src/evaluator/matchers/index.ts +0 -2
- package/src/evaluator/matchers/matcherTypes.ts +0 -1
- package/src/evaluator/matchers/segment.ts +0 -7
- package/src/evaluator/matchersTransform/index.ts +1 -4
- package/src/evaluator/matchersTransform/segment.ts +3 -5
- package/src/logger/constants.ts +1 -1
- package/src/logger/messages/info.ts +1 -1
- package/src/logger/messages/warn.ts +1 -1
- package/src/readiness/readinessManager.ts +8 -19
- package/src/readiness/sdkReadinessManager.ts +7 -7
- package/src/readiness/types.ts +2 -5
- package/src/sdkClient/sdkClient.ts +5 -5
- package/src/sdkClient/sdkClientMethod.ts +1 -4
- package/src/sdkClient/sdkClientMethodCS.ts +15 -7
- package/src/sdkClient/sdkClientMethodCSWithTT.ts +15 -7
- package/src/sdkFactory/index.ts +12 -35
- package/src/sdkFactory/types.ts +1 -4
- package/src/services/decorateHeaders.ts +5 -0
- package/src/services/splitApi.ts +7 -7
- package/src/services/splitHttpClient.ts +7 -4
- package/src/services/types.ts +2 -2
- package/src/storages/AbstractSegmentsCacheSync.ts +68 -0
- package/src/storages/AbstractSplitsCacheSync.ts +3 -4
- package/src/storages/KeyBuilderCS.ts +5 -34
- package/src/storages/dataLoader.ts +1 -1
- package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +63 -33
- package/src/storages/inLocalStorage/index.ts +4 -8
- package/src/storages/inMemory/InMemoryStorageCS.ts +1 -6
- package/src/storages/inMemory/MySegmentsCacheInMemory.ts +47 -13
- package/src/storages/inMemory/SegmentsCacheInMemory.ts +27 -13
- package/src/storages/inMemory/SplitsCacheInMemory.ts +9 -7
- package/src/storages/inMemory/TelemetryCacheInMemory.ts +11 -7
- package/src/storages/inRedis/SegmentsCacheInRedis.ts +24 -15
- package/src/storages/inRedis/index.ts +12 -6
- package/src/storages/pluggable/SegmentsCachePluggable.ts +37 -13
- package/src/storages/pluggable/inMemoryWrapper.ts +1 -1
- package/src/storages/types.ts +17 -15
- package/src/sync/offline/syncManagerOffline.ts +13 -21
- package/src/sync/polling/fetchers/mySegmentsFetcher.ts +10 -8
- package/src/sync/polling/fetchers/segmentChangesFetcher.ts +1 -1
- package/src/sync/polling/fetchers/types.ts +2 -3
- package/src/sync/polling/pollingManagerCS.ts +4 -4
- package/src/sync/polling/syncTasks/mySegmentsSyncTask.ts +5 -4
- package/src/sync/polling/types.ts +6 -7
- package/src/sync/polling/updaters/mySegmentsUpdater.ts +22 -19
- package/src/sync/polling/updaters/segmentChangesUpdater.ts +29 -13
- package/src/sync/polling/updaters/splitChangesUpdater.ts +1 -1
- package/src/sync/streaming/AuthClient/index.ts +1 -1
- package/src/sync/streaming/SSEClient/index.ts +6 -4
- package/src/sync/streaming/SSEHandler/index.ts +8 -5
- package/src/sync/streaming/SSEHandler/types.ts +15 -15
- package/src/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.ts +49 -116
- package/src/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.ts +4 -4
- package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +1 -1
- package/src/sync/streaming/UpdateWorkers/types.ts +2 -2
- package/src/sync/streaming/constants.ts +2 -2
- package/src/sync/streaming/parseUtils.ts +11 -19
- package/src/sync/streaming/pushManager.ts +72 -73
- package/src/sync/streaming/types.ts +10 -10
- package/src/sync/submitters/types.ts +5 -8
- package/src/sync/syncManagerOnline.ts +17 -17
- package/src/sync/syncTask.ts +2 -2
- package/src/sync/types.ts +1 -1
- package/src/trackers/eventTracker.ts +8 -11
- package/src/trackers/impressionsTracker.ts +10 -13
- package/src/trackers/types.ts +0 -1
- package/src/trackers/uniqueKeysTracker.ts +4 -6
- package/src/types.ts +1 -7
- package/src/utils/constants/index.ts +2 -3
- package/src/utils/settingsValidation/index.ts +2 -3
- package/src/utils/settingsValidation/types.ts +1 -1
- package/types/dtos/types.d.ts +7 -18
- package/types/evaluator/matchersTransform/segment.d.ts +2 -2
- package/types/logger/constants.d.ts +1 -1
- package/types/readiness/readinessManager.d.ts +2 -2
- package/types/readiness/sdkReadinessManager.d.ts +3 -2
- package/types/readiness/types.d.ts +2 -5
- package/types/sdkClient/sdkClientMethod.d.ts +1 -1
- package/types/sdkFactory/types.d.ts +1 -3
- package/types/services/decorateHeaders.d.ts +1 -0
- package/types/services/splitApi.d.ts +1 -1
- package/types/services/splitHttpClient.d.ts +1 -1
- package/types/services/types.d.ts +2 -2
- package/types/storages/AbstractSegmentsCacheSync.d.ts +11 -9
- package/types/storages/AbstractSplitsCacheSync.d.ts +1 -1
- package/types/storages/KeyBuilderCS.d.ts +2 -9
- package/types/storages/inLocalStorage/MySegmentsCacheInLocal.d.ts +18 -8
- package/types/storages/inMemory/MySegmentsCacheInMemory.d.ts +13 -7
- package/types/storages/inMemory/SegmentsCacheInMemory.d.ts +8 -6
- package/types/storages/inMemory/SplitsCacheInMemory.d.ts +2 -1
- package/types/storages/inMemory/TelemetryCacheInMemory.d.ts +6 -4
- package/types/storages/inRedis/SegmentsCacheInRedis.d.ts +4 -7
- package/types/storages/inRedis/index.d.ts +1 -1
- package/types/storages/pluggable/SegmentsCachePluggable.d.ts +17 -5
- package/types/storages/pluggable/inMemoryWrapper.d.ts +1 -1
- package/types/storages/types.d.ts +15 -11
- package/types/sync/polling/fetchers/mySegmentsFetcher.d.ts +2 -2
- package/types/sync/polling/fetchers/types.d.ts +2 -2
- package/types/sync/polling/syncTasks/mySegmentsSyncTask.d.ts +2 -2
- package/types/sync/polling/types.d.ts +4 -7
- package/types/sync/polling/updaters/mySegmentsUpdater.d.ts +3 -4
- package/types/sync/streaming/SSEHandler/types.d.ts +14 -16
- package/types/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.d.ts +2 -4
- package/types/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.d.ts +1 -2
- package/types/sync/streaming/UpdateWorkers/SplitsUpdateWorker.d.ts +2 -3
- package/types/sync/streaming/UpdateWorkers/types.d.ts +2 -2
- package/types/sync/streaming/constants.d.ts +2 -2
- package/types/sync/streaming/parseUtils.d.ts +5 -4
- package/types/sync/streaming/types.d.ts +8 -8
- package/types/sync/submitters/types.d.ts +4 -7
- package/types/sync/types.d.ts +1 -1
- package/types/trackers/eventTracker.d.ts +1 -1
- package/types/trackers/impressionsTracker.d.ts +1 -1
- package/types/trackers/types.d.ts +0 -1
- package/types/types.d.ts +1 -7
- package/types/utils/constants/index.d.ts +2 -3
- package/types/utils/settingsValidation/types.d.ts +1 -1
- package/cjs/evaluator/matchers/large_segment.js +0 -16
- package/cjs/sdkClient/identity.js +0 -7
- package/cjs/storages/AbstractMySegmentsCacheSync.js +0 -60
- package/esm/evaluator/matchers/large_segment.js +0 -12
- package/esm/sdkClient/identity.js +0 -3
- package/esm/storages/AbstractMySegmentsCacheSync.js +0 -57
- package/src/evaluator/matchers/large_segment.ts +0 -18
- package/src/sdkClient/identity.ts +0 -5
- package/src/storages/AbstractMySegmentsCacheSync.ts +0 -94
- package/types/evaluator/matchers/large_segment.d.ts +0 -5
- package/types/evaluator/matchers/sember_inlist.d.ts +0 -3
- package/types/evaluator/matchersTransform/set.d.ts +0 -5
- package/types/evaluator/matchersTransform/string.d.ts +0 -7
- package/types/sdkClient/identity.d.ts +0 -2
- package/types/storages/AbstractMySegmentsCacheSync.d.ts +0 -39
- package/types/storages/AbstractSplitsCache.d.ts +0 -46
- package/types/sync/streaming/mySegmentsV2utils.d.ts +0 -27
- package/types/sync/streaming/pushManagerCS_Spec1_3.d.ts +0 -9
- package/types/sync/streaming/pushManager_Spec1_3.d.ts +0 -9
- package/types/trackers/impressionObserver/utils.d.ts +0 -5
- package/types/utils/inputValidation/sdkKey.d.ts +0 -7
- package/types/utils/inputValidation/splitExistance.d.ts +0 -7
- package/types/utils/inputValidation/trafficTypeExistance.d.ts +0 -9
- package/types/utils/redis/RedisMock.d.ts +0 -4
- package/types/utils/settingsValidation/logger/globalLogLevel.d.ts +0 -8
- /package/types/utils/{semVer.d.ts → Semver.d.ts} +0 -0
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AbstractSegmentsCacheSync } from '../AbstractSegmentsCacheSync';
|
|
2
2
|
/**
|
|
3
|
-
* Default ISplitsCacheSync implementation
|
|
3
|
+
* Default ISplitsCacheSync implementation that stores split definitions in memory.
|
|
4
|
+
* Supported by all JS runtimes.
|
|
4
5
|
*/
|
|
5
|
-
export declare class SegmentsCacheInMemory
|
|
6
|
+
export declare class SegmentsCacheInMemory extends AbstractSegmentsCacheSync {
|
|
6
7
|
private segmentCache;
|
|
7
8
|
private segmentChangeNumber;
|
|
8
|
-
|
|
9
|
+
addToSegment(name: string, segmentKeys: string[]): boolean;
|
|
10
|
+
removeFromSegment(name: string, segmentKeys: string[]): boolean;
|
|
9
11
|
isInSegment(name: string, key: string): boolean;
|
|
10
12
|
clear(): void;
|
|
11
13
|
private _registerSegment;
|
|
12
14
|
registerSegments(names: string[]): boolean;
|
|
13
15
|
getRegisteredSegments(): string[];
|
|
14
16
|
getKeysCount(): number;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
setChangeNumber(name: string, changeNumber: number): boolean;
|
|
18
|
+
getChangeNumber(name: string): number | undefined;
|
|
17
19
|
}
|
|
@@ -3,13 +3,14 @@ import { AbstractSplitsCacheSync } from '../AbstractSplitsCacheSync';
|
|
|
3
3
|
import { ISet } from '../../utils/lang/sets';
|
|
4
4
|
/**
|
|
5
5
|
* Default ISplitsCacheSync implementation that stores split definitions in memory.
|
|
6
|
+
* Supported by all JS runtimes.
|
|
6
7
|
*/
|
|
7
8
|
export declare class SplitsCacheInMemory extends AbstractSplitsCacheSync {
|
|
8
9
|
private flagSetsFilter;
|
|
9
10
|
private splitsCache;
|
|
10
11
|
private ttCache;
|
|
11
12
|
private changeNumber;
|
|
12
|
-
private
|
|
13
|
+
private splitsWithSegmentsCount;
|
|
13
14
|
private flagSetsCache;
|
|
14
15
|
constructor(splitFiltersValidation?: ISplitFiltersValidation);
|
|
15
16
|
clear(): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ImpressionDataType, EventDataType, StreamingEvent, Method, OperationType, TelemetryUsageStatsPayload, UpdatesFromSSEEnum
|
|
1
|
+
import { ImpressionDataType, EventDataType, StreamingEvent, Method, OperationType, TelemetryUsageStatsPayload, UpdatesFromSSEEnum } from '../../sync/submitters/types';
|
|
2
2
|
import { ISegmentsCacheSync, ISplitsCacheSync, IStorageFactoryParams, ITelemetryCacheSync } from '../types';
|
|
3
3
|
export declare const MAX_LATENCY_BUCKET_COUNT = 23;
|
|
4
4
|
export declare function newBuckets(): number[];
|
|
@@ -10,8 +10,7 @@ export declare function shouldRecordTelemetry({ settings }: IStorageFactoryParam
|
|
|
10
10
|
export declare class TelemetryCacheInMemory implements ITelemetryCacheSync {
|
|
11
11
|
private splits?;
|
|
12
12
|
private segments?;
|
|
13
|
-
|
|
14
|
-
constructor(splits?: ISplitsCacheSync | undefined, segments?: ISegmentsCacheSync | undefined, largeSegments?: ISegmentsCacheSync | undefined);
|
|
13
|
+
constructor(splits?: ISplitsCacheSync | undefined, segments?: ISegmentsCacheSync | undefined);
|
|
15
14
|
private e;
|
|
16
15
|
isEmpty(): boolean;
|
|
17
16
|
clear(): void;
|
|
@@ -66,6 +65,9 @@ export declare class TelemetryCacheInMemory implements ITelemetryCacheSync {
|
|
|
66
65
|
popLatencies(): Partial<Record<Method, number[]>>;
|
|
67
66
|
recordLatency(method: Method, latencyMs: number): void;
|
|
68
67
|
private updatesFromSSE;
|
|
69
|
-
popUpdatesFromSSE():
|
|
68
|
+
popUpdatesFromSSE(): {
|
|
69
|
+
sp: number;
|
|
70
|
+
ms: number;
|
|
71
|
+
};
|
|
70
72
|
recordUpdatesFromSSE(type: UpdatesFromSSEEnum): void;
|
|
71
73
|
}
|
|
@@ -7,14 +7,11 @@ export declare class SegmentsCacheInRedis implements ISegmentsCacheAsync {
|
|
|
7
7
|
private readonly redis;
|
|
8
8
|
private readonly keys;
|
|
9
9
|
constructor(log: ILogger, keys: KeyBuilderSS, redis: RedisAdapter);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* The returned promise is resolved if the operation success, with `true` if the segment was updated (i.e., some key was added or removed),
|
|
13
|
-
* or rejected if it fails (e.g., Redis operation fails).
|
|
14
|
-
*/
|
|
15
|
-
update(name: string, addedKeys: string[], removedKeys: string[], changeNumber: number): Promise<boolean>;
|
|
10
|
+
addToSegment(name: string, segmentKeys: string[]): Promise<boolean>;
|
|
11
|
+
removeFromSegment(name: string, segmentKeys: string[]): Promise<boolean>;
|
|
16
12
|
isInSegment(name: string, key: string): Promise<boolean>;
|
|
17
|
-
|
|
13
|
+
setChangeNumber(name: string, changeNumber: number): Promise<boolean>;
|
|
14
|
+
getChangeNumber(name: string): Promise<number | undefined>;
|
|
18
15
|
registerSegments(segments: string[]): Promise<boolean>;
|
|
19
16
|
getRegisteredSegments(): Promise<string[]>;
|
|
20
17
|
clear(): Promise<void>;
|
|
@@ -4,7 +4,7 @@ export interface InRedisStorageOptions {
|
|
|
4
4
|
options?: Record<string, any>;
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
|
-
* InRedis storage factory for consumer server-side SplitFactory, that uses `Ioredis` Redis client for Node.
|
|
7
|
+
* InRedis storage factory for consumer server-side SplitFactory, that uses `Ioredis` Redis client for Node.js
|
|
8
8
|
* @see {@link https://www.npmjs.com/package/ioredis}
|
|
9
9
|
*/
|
|
10
10
|
export declare function InRedisStorage(options?: InRedisStorageOptions): IStorageAsyncFactory;
|
|
@@ -10,22 +10,34 @@ export declare class SegmentsCachePluggable implements ISegmentsCacheAsync {
|
|
|
10
10
|
private readonly wrapper;
|
|
11
11
|
constructor(log: ILogger, keys: KeyBuilderSS, wrapper: IPluggableStorageWrapper);
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
* The returned promise is resolved
|
|
15
|
-
* or rejected if
|
|
13
|
+
* Add a list of `segmentKeys` to the given segment `name`.
|
|
14
|
+
* The returned promise is resolved when the operation success
|
|
15
|
+
* or rejected if wrapper operation fails.
|
|
16
|
+
*/
|
|
17
|
+
addToSegment(name: string, segmentKeys: string[]): Promise<boolean | void>;
|
|
18
|
+
/**
|
|
19
|
+
* Remove a list of `segmentKeys` from the given segment `name`.
|
|
20
|
+
* The returned promise is resolved when the operation success
|
|
21
|
+
* or rejected if wrapper operation fails.
|
|
16
22
|
*/
|
|
17
|
-
|
|
23
|
+
removeFromSegment(name: string, segmentKeys: string[]): Promise<boolean | void>;
|
|
18
24
|
/**
|
|
19
25
|
* Returns a promise that resolves with a boolean value indicating if `key` is part of `name` segment.
|
|
20
26
|
* Promise can be rejected if wrapper operation fails.
|
|
21
27
|
*/
|
|
22
28
|
isInSegment(name: string, key: string): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Set till number for the given segment `name`.
|
|
31
|
+
* The returned promise is resolved when the operation success,
|
|
32
|
+
* or rejected if it fails (e.g., wrapper operation fails).
|
|
33
|
+
*/
|
|
34
|
+
setChangeNumber(name: string, changeNumber: number): Promise<boolean | void>;
|
|
23
35
|
/**
|
|
24
36
|
* Get till number or -1 if it's not defined.
|
|
25
37
|
* The returned promise is resolved with the changeNumber or -1 if it doesn't exist or a wrapper operation fails.
|
|
26
38
|
* The promise will never be rejected.
|
|
27
39
|
*/
|
|
28
|
-
getChangeNumber(name: string): Promise<number>;
|
|
40
|
+
getChangeNumber(name: string): Promise<number | undefined>;
|
|
29
41
|
/**
|
|
30
42
|
* Add the given segment names to the set of registered segments.
|
|
31
43
|
* The returned promise is resolved when the operation success,
|
|
@@ -5,7 +5,7 @@ import { ISet } from '../../utils/lang/sets';
|
|
|
5
5
|
* The `_cache` property is the object were items are stored.
|
|
6
6
|
* Intended for testing purposes.
|
|
7
7
|
*
|
|
8
|
-
* @param connDelay delay in millis for `connect` resolve. If not provided, `connect` resolves
|
|
8
|
+
* @param connDelay delay in millis for `connect` resolve. If not provided, `connect` resolves inmediatelly.
|
|
9
9
|
*/
|
|
10
10
|
export declare function inMemoryWrapperFactory(connDelay?: number): IPluggableStorageWrapper & {
|
|
11
11
|
_cache: Record<string, string | string[] | ISet<string>>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { MaybeThenable, ISplit
|
|
2
|
-
import { MySegmentsData } from '../sync/polling/types';
|
|
1
|
+
import { MaybeThenable, ISplit } from '../dtos/types';
|
|
3
2
|
import { EventDataType, HttpErrors, HttpLatencies, ImpressionDataType, LastSync, Method, MethodExceptions, MethodLatencies, MultiMethodExceptions, MultiMethodLatencies, MultiConfigs, OperationType, StoredEventWithMetadata, StoredImpressionWithMetadata, StreamingEvent, UniqueKeysPayloadCs, UniqueKeysPayloadSs, TelemetryUsageStatsPayload, UpdatesFromSSEEnum } from '../sync/submitters/types';
|
|
4
3
|
import { SplitIO, ImpressionDTO, ISettings } from '../types';
|
|
5
4
|
import { ISet } from '../utils/lang/sets';
|
|
@@ -201,7 +200,7 @@ export interface ISplitsCacheSync extends ISplitsCacheBase {
|
|
|
201
200
|
removeSplits(names: string[]): boolean[];
|
|
202
201
|
getSplit(name: string): ISplit | null;
|
|
203
202
|
getSplits(names: string[]): Record<string, ISplit | null>;
|
|
204
|
-
setChangeNumber(changeNumber: number): boolean
|
|
203
|
+
setChangeNumber(changeNumber: number): boolean;
|
|
205
204
|
getChangeNumber(): number;
|
|
206
205
|
getAll(): ISplit[];
|
|
207
206
|
getSplitNames(): string[];
|
|
@@ -230,29 +229,35 @@ export interface ISplitsCacheAsync extends ISplitsCacheBase {
|
|
|
230
229
|
}
|
|
231
230
|
/** Segments cache */
|
|
232
231
|
export interface ISegmentsCacheBase {
|
|
232
|
+
addToSegment(name: string, segmentKeys: string[]): MaybeThenable<boolean | void>;
|
|
233
|
+
removeFromSegment(name: string, segmentKeys: string[]): MaybeThenable<boolean | void>;
|
|
233
234
|
isInSegment(name: string, key?: string): MaybeThenable<boolean>;
|
|
234
235
|
registerSegments(names: string[]): MaybeThenable<boolean | void>;
|
|
235
236
|
getRegisteredSegments(): MaybeThenable<string[]>;
|
|
236
|
-
|
|
237
|
-
|
|
237
|
+
setChangeNumber(name: string, changeNumber: number): MaybeThenable<boolean | void>;
|
|
238
|
+
getChangeNumber(name: string): MaybeThenable<number | undefined>;
|
|
238
239
|
clear(): MaybeThenable<boolean | void>;
|
|
239
240
|
}
|
|
240
241
|
export interface ISegmentsCacheSync extends ISegmentsCacheBase {
|
|
242
|
+
addToSegment(name: string, segmentKeys?: string[]): boolean;
|
|
243
|
+
removeFromSegment(name: string, segmentKeys?: string[]): boolean;
|
|
241
244
|
isInSegment(name: string, key?: string): boolean;
|
|
242
245
|
registerSegments(names: string[]): boolean;
|
|
243
246
|
getRegisteredSegments(): string[];
|
|
244
247
|
getKeysCount(): number;
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
resetSegments(
|
|
248
|
+
setChangeNumber(name: string, changeNumber: number): boolean;
|
|
249
|
+
getChangeNumber(name: string): number | undefined;
|
|
250
|
+
resetSegments(names: string[]): boolean;
|
|
248
251
|
clear(): void;
|
|
249
252
|
}
|
|
250
253
|
export interface ISegmentsCacheAsync extends ISegmentsCacheBase {
|
|
254
|
+
addToSegment(name: string, segmentKeys: string[]): Promise<boolean | void>;
|
|
255
|
+
removeFromSegment(name: string, segmentKeys: string[]): Promise<boolean | void>;
|
|
251
256
|
isInSegment(name: string, key: string): Promise<boolean>;
|
|
252
257
|
registerSegments(names: string[]): Promise<boolean | void>;
|
|
253
258
|
getRegisteredSegments(): Promise<string[]>;
|
|
254
|
-
|
|
255
|
-
|
|
259
|
+
setChangeNumber(name: string, changeNumber: number): Promise<boolean | void>;
|
|
260
|
+
getChangeNumber(name: string): Promise<number | undefined>;
|
|
256
261
|
clear(): Promise<boolean | void>;
|
|
257
262
|
}
|
|
258
263
|
/** Recorder storages (impressions, events and telemetry) */
|
|
@@ -383,7 +388,6 @@ export interface IStorageBase<TSplitsCache extends ISplitsCacheBase, TSegmentsCa
|
|
|
383
388
|
shared?: (matchingKey: string, onReadyCb: (error?: any) => void) => this;
|
|
384
389
|
}
|
|
385
390
|
export interface IStorageSync extends IStorageBase<ISplitsCacheSync, ISegmentsCacheSync, IImpressionsCacheSync, IImpressionCountsCacheSync, IEventsCacheSync, ITelemetryCacheSync, IUniqueKeysCacheSync> {
|
|
386
|
-
largeSegments?: ISegmentsCacheSync;
|
|
387
391
|
}
|
|
388
392
|
export interface IStorageAsync extends IStorageBase<ISplitsCacheAsync, ISegmentsCacheAsync, IImpressionsCacheAsync | IImpressionsCacheSync, IImpressionCountsCacheBase, IEventsCacheAsync | IEventsCacheSync, ITelemetryCacheAsync | ITelemetryCacheSync, IUniqueKeysCacheBase> {
|
|
389
393
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IFetchMySegments } from '../../../services/types';
|
|
2
2
|
import { IMySegmentsFetcher } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Factory of MySegments fetcher.
|
|
5
5
|
* MySegments fetcher is a wrapper around `mySegments` API service that parses the response and handle errors.
|
|
6
6
|
*/
|
|
7
|
-
export declare function mySegmentsFetcherFactory(
|
|
7
|
+
export declare function mySegmentsFetcherFactory(fetchMySegments: IFetchMySegments): IMySegmentsFetcher;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ISplitChangesResponse, ISegmentChangesResponse
|
|
1
|
+
import { ISplitChangesResponse, ISegmentChangesResponse } from '../../../dtos/types';
|
|
2
2
|
import { IResponse } from '../../../services/types';
|
|
3
3
|
export declare type ISplitChangesFetcher = (since: number, noCache?: boolean, till?: number, decorator?: (promise: Promise<IResponse>) => Promise<IResponse>) => Promise<ISplitChangesResponse>;
|
|
4
4
|
export declare type ISegmentChangesFetcher = (since: number, segmentName: string, noCache?: boolean, till?: number, decorator?: (promise: Promise<ISegmentChangesResponse[]>) => Promise<ISegmentChangesResponse[]>) => Promise<ISegmentChangesResponse[]>;
|
|
5
|
-
export declare type IMySegmentsFetcher = (userMatchingKey: string, noCache?: boolean,
|
|
5
|
+
export declare type IMySegmentsFetcher = (userMatchingKey: string, noCache?: boolean, decorator?: (promise: Promise<IResponse>) => Promise<IResponse>) => Promise<string[]>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IStorageSync } from '../../../storages/types';
|
|
2
2
|
import { IReadinessManager } from '../../../readiness/types';
|
|
3
3
|
import { IMySegmentsSyncTask } from '../types';
|
|
4
|
-
import {
|
|
4
|
+
import { IFetchMySegments } from '../../../services/types';
|
|
5
5
|
import { ISettings } from '../../../types';
|
|
6
6
|
/**
|
|
7
7
|
* Creates a sync task that periodically executes a `mySegmentsUpdater` task
|
|
8
8
|
*/
|
|
9
|
-
export declare function mySegmentsSyncTaskFactory(
|
|
9
|
+
export declare function mySegmentsSyncTaskFactory(fetchMySegments: IFetchMySegments, storage: IStorageSync, readiness: IReadinessManager, settings: ISettings, matchingKey: string): IMySegmentsSyncTask;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ISplit } from '../../dtos/types';
|
|
2
2
|
import { IReadinessManager } from '../../readiness/types';
|
|
3
3
|
import { IStorageSync } from '../../storages/types';
|
|
4
|
-
import { MEMBERSHIPS_LS_UPDATE, MEMBERSHIPS_MS_UPDATE } from '../streaming/types';
|
|
5
4
|
import { ITask, ISyncTask } from '../types';
|
|
6
5
|
export interface ISplitsSyncTask extends ISyncTask<[noCache?: boolean, till?: number, splitUpdateNotification?: {
|
|
7
6
|
payload: ISplit;
|
|
@@ -10,13 +9,11 @@ export interface ISplitsSyncTask extends ISyncTask<[noCache?: boolean, till?: nu
|
|
|
10
9
|
}
|
|
11
10
|
export interface ISegmentsSyncTask extends ISyncTask<[fetchOnlyNew?: boolean, segmentName?: string, noCache?: boolean, till?: number], boolean> {
|
|
12
11
|
}
|
|
13
|
-
export declare type MySegmentsData = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
added: string[];
|
|
17
|
-
removed: string[];
|
|
12
|
+
export declare type MySegmentsData = string[] | {
|
|
13
|
+
name: string;
|
|
14
|
+
add: boolean;
|
|
18
15
|
};
|
|
19
|
-
export interface IMySegmentsSyncTask extends ISyncTask<[segmentsData?: MySegmentsData, noCache?: boolean
|
|
16
|
+
export interface IMySegmentsSyncTask extends ISyncTask<[segmentsData?: MySegmentsData, noCache?: boolean], boolean> {
|
|
20
17
|
}
|
|
21
18
|
export interface IPollingManager extends ITask {
|
|
22
19
|
syncAll(): Promise<any>;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { IMySegmentsFetcher } from '../fetchers/types';
|
|
2
|
-
import {
|
|
2
|
+
import { ISegmentsCacheSync, ISplitsCacheSync } from '../../../storages/types';
|
|
3
3
|
import { ISegmentsEventEmitter } from '../../../readiness/types';
|
|
4
4
|
import { ILogger } from '../../../logger/types';
|
|
5
|
-
|
|
6
|
-
declare type IMySegmentsUpdater = (segmentsData?: MySegmentsData, noCache?: boolean, till?: number) => Promise<boolean>;
|
|
5
|
+
declare type IMySegmentsUpdater = (segmentList?: string[], noCache?: boolean) => Promise<boolean>;
|
|
7
6
|
/**
|
|
8
7
|
* factory of MySegments updater, a task that:
|
|
9
8
|
* - fetches mySegments using `mySegmentsFetcher`
|
|
10
9
|
* - updates `mySegmentsCache`
|
|
11
10
|
* - uses `segmentsEventEmitter` to emit events related to segments data updates
|
|
12
11
|
*/
|
|
13
|
-
export declare function mySegmentsUpdaterFactory(log: ILogger, mySegmentsFetcher: IMySegmentsFetcher,
|
|
12
|
+
export declare function mySegmentsUpdaterFactory(log: ILogger, mySegmentsFetcher: IMySegmentsFetcher, splitsCache: ISplitsCacheSync, mySegmentsCache: ISegmentsCacheSync, segmentsEventEmitter: ISegmentsEventEmitter, requestTimeoutBeforeReady: number, retriesOnFailureBeforeReady: number, matchingKey: string): IMySegmentsUpdater;
|
|
14
13
|
export {};
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { ControlType } from '../constants';
|
|
2
|
-
import { SEGMENT_UPDATE, SPLIT_UPDATE, SPLIT_KILL, CONTROL, OCCUPANCY
|
|
2
|
+
import { MY_SEGMENTS_UPDATE, MY_SEGMENTS_UPDATE_V2, SEGMENT_UPDATE, SPLIT_UPDATE, SPLIT_KILL, CONTROL, OCCUPANCY } from '../types';
|
|
3
|
+
export interface IMySegmentsUpdateData {
|
|
4
|
+
type: MY_SEGMENTS_UPDATE;
|
|
5
|
+
changeNumber: number;
|
|
6
|
+
includesPayload: boolean;
|
|
7
|
+
segmentList?: string[];
|
|
8
|
+
}
|
|
3
9
|
export declare enum Compression {
|
|
4
10
|
None = 0,
|
|
5
11
|
Gzip = 1,
|
|
@@ -15,20 +21,13 @@ export interface KeyList {
|
|
|
15
21
|
a?: string[];
|
|
16
22
|
r?: string[];
|
|
17
23
|
}
|
|
18
|
-
interface
|
|
19
|
-
type:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
c
|
|
23
|
-
d
|
|
24
|
+
export interface IMySegmentsUpdateV2Data {
|
|
25
|
+
type: MY_SEGMENTS_UPDATE_V2;
|
|
26
|
+
changeNumber: number;
|
|
27
|
+
segmentName: string;
|
|
28
|
+
c: Compression;
|
|
29
|
+
d: string;
|
|
24
30
|
u: UpdateStrategy;
|
|
25
|
-
i?: number;
|
|
26
|
-
h?: number;
|
|
27
|
-
s?: number;
|
|
28
|
-
}
|
|
29
|
-
export interface IMembershipMSUpdateData extends IMembershipUpdateData<MEMBERSHIPS_MS_UPDATE> {
|
|
30
|
-
}
|
|
31
|
-
export interface IMembershipLSUpdateData extends IMembershipUpdateData<MEMBERSHIPS_LS_UPDATE> {
|
|
32
31
|
}
|
|
33
32
|
export interface ISegmentUpdateData {
|
|
34
33
|
type: SEGMENT_UPDATE;
|
|
@@ -58,7 +57,7 @@ export interface IOccupancyData {
|
|
|
58
57
|
publishers: number;
|
|
59
58
|
};
|
|
60
59
|
}
|
|
61
|
-
export declare type INotificationData =
|
|
60
|
+
export declare type INotificationData = IMySegmentsUpdateData | IMySegmentsUpdateV2Data | ISegmentUpdateData | ISplitUpdateData | ISplitKillData | IControlData | IOccupancyData;
|
|
62
61
|
export declare type INotificationMessage = {
|
|
63
62
|
parsedData: INotificationData;
|
|
64
63
|
channel: string;
|
|
@@ -69,4 +68,3 @@ export declare type INotificationError = Event & {
|
|
|
69
68
|
parsedData?: any;
|
|
70
69
|
message?: string;
|
|
71
70
|
};
|
|
72
|
-
export {};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { IMySegmentsSyncTask
|
|
1
|
+
import { IMySegmentsSyncTask } from '../../polling/types';
|
|
2
2
|
import { IUpdateWorker } from './types';
|
|
3
3
|
import { ITelemetryTracker } from '../../../trackers/types';
|
|
4
|
-
import { IStorageSync } from '../../../storages/types';
|
|
5
|
-
import { ILogger } from '../../../logger/types';
|
|
6
4
|
/**
|
|
7
5
|
* MySegmentsUpdateWorker factory
|
|
8
6
|
*/
|
|
9
|
-
export declare function MySegmentsUpdateWorker(
|
|
7
|
+
export declare function MySegmentsUpdateWorker(mySegmentsSyncTask: IMySegmentsSyncTask, telemetryTracker: ITelemetryTracker): IUpdateWorker;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { ILogger } from '../../../logger/types';
|
|
2
2
|
import { ISegmentsCacheSync } from '../../../storages/types';
|
|
3
3
|
import { ISegmentsSyncTask } from '../../polling/types';
|
|
4
|
-
import { ISegmentUpdateData } from '../SSEHandler/types';
|
|
5
4
|
import { IUpdateWorker } from './types';
|
|
6
5
|
/**
|
|
7
6
|
* SegmentsUpdateWorker factory
|
|
8
7
|
*/
|
|
9
|
-
export declare function SegmentsUpdateWorker(log: ILogger, segmentsSyncTask: ISegmentsSyncTask, segmentsCache: ISegmentsCacheSync): IUpdateWorker
|
|
8
|
+
export declare function SegmentsUpdateWorker(log: ILogger, segmentsSyncTask: ISegmentsSyncTask, segmentsCache: ISegmentsCacheSync): IUpdateWorker;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { ISplit } from '../../../dtos/types';
|
|
2
1
|
import { ILogger } from '../../../logger/types';
|
|
3
2
|
import { ISplitsEventEmitter } from '../../../readiness/types';
|
|
4
3
|
import { ISplitsCacheSync } from '../../../storages/types';
|
|
5
4
|
import { ITelemetryTracker } from '../../../trackers/types';
|
|
6
5
|
import { ISegmentsSyncTask, ISplitsSyncTask } from '../../polling/types';
|
|
7
|
-
import { ISplitKillData
|
|
6
|
+
import { ISplitKillData } from '../SSEHandler/types';
|
|
8
7
|
import { IUpdateWorker } from './types';
|
|
9
8
|
/**
|
|
10
9
|
* SplitsUpdateWorker factory
|
|
11
10
|
*/
|
|
12
|
-
export declare function SplitsUpdateWorker(log: ILogger, splitsCache: ISplitsCacheSync, splitsSyncTask: ISplitsSyncTask, splitsEventEmitter: ISplitsEventEmitter, telemetryTracker: ITelemetryTracker, segmentsSyncTask?: ISegmentsSyncTask): IUpdateWorker
|
|
11
|
+
export declare function SplitsUpdateWorker(log: ILogger, splitsCache: ISplitsCacheSync, splitsSyncTask: ISplitsSyncTask, splitsEventEmitter: ISplitsEventEmitter, telemetryTracker: ITelemetryTracker, segmentsSyncTask?: ISegmentsSyncTask): IUpdateWorker & {
|
|
13
12
|
killSplit(event: ISplitKillData): void;
|
|
14
13
|
};
|
|
@@ -19,8 +19,8 @@ export declare const PUSH_SUBSYSTEM_UP = "PUSH_SUBSYSTEM_UP";
|
|
|
19
19
|
* triggers `startPolling` and `stopWorkers` calls
|
|
20
20
|
*/
|
|
21
21
|
export declare const PUSH_SUBSYSTEM_DOWN = "PUSH_SUBSYSTEM_DOWN";
|
|
22
|
-
export declare const
|
|
23
|
-
export declare const
|
|
22
|
+
export declare const MY_SEGMENTS_UPDATE = "MY_SEGMENTS_UPDATE";
|
|
23
|
+
export declare const MY_SEGMENTS_UPDATE_V2 = "MY_SEGMENTS_UPDATE_V2";
|
|
24
24
|
export declare const SEGMENT_UPDATE = "SEGMENT_UPDATE";
|
|
25
25
|
export declare const SPLIT_KILL = "SPLIT_KILL";
|
|
26
26
|
export declare const SPLIT_UPDATE = "SPLIT_UPDATE";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Compression,
|
|
2
|
-
import { ISplit } from '../../dtos/types';
|
|
1
|
+
import { Compression, KeyList } from './SSEHandler/types';
|
|
3
2
|
/**
|
|
4
3
|
* Decode, decompress and parse the provided 'data' into a KeyList object
|
|
5
4
|
*
|
|
@@ -29,6 +28,8 @@ export declare function parseBitmap(data: string, compression: Compression): Uin
|
|
|
29
28
|
export declare function isInBitmap(bitmap: Uint8Array, hash64hex: string): boolean;
|
|
30
29
|
/**
|
|
31
30
|
* Parse feature flags notifications for instant feature flag updates
|
|
31
|
+
*
|
|
32
|
+
* @param {ISplitUpdateData} data
|
|
33
|
+
* @returns {KeyList}
|
|
32
34
|
*/
|
|
33
|
-
export declare function parseFFUpdatePayload(compression: Compression, data: string):
|
|
34
|
-
export declare function getDelay(parsedData: Pick<IMembershipMSUpdateData, 'i' | 'h' | 's'>, matchingKey: string): number;
|
|
35
|
+
export declare function parseFFUpdatePayload(compression: Compression, data: string): KeyList | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IMySegmentsUpdateData, IMySegmentsUpdateV2Data, ISegmentUpdateData, ISplitUpdateData, ISplitKillData } from './SSEHandler/types';
|
|
2
2
|
import { ITask } from '../types';
|
|
3
3
|
import { IMySegmentsSyncTask } from '../polling/types';
|
|
4
4
|
import { IEventEmitter } from '../../types';
|
|
@@ -7,23 +7,23 @@ export declare type PUSH_SUBSYSTEM_UP = 'PUSH_SUBSYSTEM_UP';
|
|
|
7
7
|
export declare type PUSH_SUBSYSTEM_DOWN = 'PUSH_SUBSYSTEM_DOWN';
|
|
8
8
|
export declare type PUSH_NONRETRYABLE_ERROR = 'PUSH_NONRETRYABLE_ERROR';
|
|
9
9
|
export declare type PUSH_RETRYABLE_ERROR = 'PUSH_RETRYABLE_ERROR';
|
|
10
|
-
export declare type
|
|
11
|
-
export declare type
|
|
10
|
+
export declare type MY_SEGMENTS_UPDATE = 'MY_SEGMENTS_UPDATE';
|
|
11
|
+
export declare type MY_SEGMENTS_UPDATE_V2 = 'MY_SEGMENTS_UPDATE_V2';
|
|
12
12
|
export declare type SEGMENT_UPDATE = 'SEGMENT_UPDATE';
|
|
13
13
|
export declare type SPLIT_KILL = 'SPLIT_KILL';
|
|
14
14
|
export declare type SPLIT_UPDATE = 'SPLIT_UPDATE';
|
|
15
15
|
export declare type CONTROL = 'CONTROL';
|
|
16
16
|
export declare type OCCUPANCY = 'OCCUPANCY';
|
|
17
|
-
export declare type IPushEvent = PUSH_SUBSYSTEM_UP | PUSH_SUBSYSTEM_DOWN | PUSH_NONRETRYABLE_ERROR | PUSH_RETRYABLE_ERROR |
|
|
18
|
-
declare type IParsedData<T extends IPushEvent> = T extends
|
|
17
|
+
export declare type IPushEvent = PUSH_SUBSYSTEM_UP | PUSH_SUBSYSTEM_DOWN | PUSH_NONRETRYABLE_ERROR | PUSH_RETRYABLE_ERROR | MY_SEGMENTS_UPDATE | MY_SEGMENTS_UPDATE_V2 | SEGMENT_UPDATE | SPLIT_UPDATE | SPLIT_KILL | ControlType.STREAMING_RESET;
|
|
18
|
+
declare type IParsedData<T extends IPushEvent> = T extends MY_SEGMENTS_UPDATE ? IMySegmentsUpdateData : T extends MY_SEGMENTS_UPDATE_V2 ? IMySegmentsUpdateV2Data : T extends SEGMENT_UPDATE ? ISegmentUpdateData : T extends SPLIT_UPDATE ? ISplitUpdateData : T extends SPLIT_KILL ? ISplitKillData : undefined;
|
|
19
19
|
/**
|
|
20
20
|
* EventEmitter used as Feedback Loop between the SyncManager and PushManager,
|
|
21
21
|
* where the latter pushes messages and the former consumes it
|
|
22
22
|
*/
|
|
23
23
|
export interface IPushEventEmitter extends IEventEmitter {
|
|
24
|
-
once<T extends IPushEvent>(event: T, listener: (parsedData: IParsedData<T
|
|
25
|
-
on<T extends IPushEvent>(event: T, listener: (parsedData: IParsedData<T
|
|
26
|
-
emit<T extends IPushEvent>(event: T, parsedData?: IParsedData<T
|
|
24
|
+
once<T extends IPushEvent>(event: T, listener: (parsedData: IParsedData<T>, channel: T extends MY_SEGMENTS_UPDATE ? string : undefined) => void): this;
|
|
25
|
+
on<T extends IPushEvent>(event: T, listener: (parsedData: IParsedData<T>, channel: T extends MY_SEGMENTS_UPDATE ? string : undefined) => void): this;
|
|
26
|
+
emit<T extends IPushEvent>(event: T, parsedData?: IParsedData<T>, channel?: T extends MY_SEGMENTS_UPDATE ? string : undefined): boolean;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* PushManager
|
|
@@ -90,7 +90,7 @@ export declare type DROPPED = 1;
|
|
|
90
90
|
export declare type DEDUPED = 2;
|
|
91
91
|
export declare type ImpressionDataType = QUEUED | DROPPED | DEDUPED;
|
|
92
92
|
export declare type EventDataType = QUEUED | DROPPED;
|
|
93
|
-
export declare type UpdatesFromSSEEnum = SPLITS |
|
|
93
|
+
export declare type UpdatesFromSSEEnum = SPLITS | MY_SEGMENT;
|
|
94
94
|
export declare type SPLITS = 'sp';
|
|
95
95
|
export declare type IMPRESSIONS = 'im';
|
|
96
96
|
export declare type IMPRESSIONS_COUNT = 'ic';
|
|
@@ -98,8 +98,8 @@ export declare type EVENTS = 'ev';
|
|
|
98
98
|
export declare type TELEMETRY = 'te';
|
|
99
99
|
export declare type TOKEN = 'to';
|
|
100
100
|
export declare type SEGMENT = 'se';
|
|
101
|
-
export declare type
|
|
102
|
-
export declare type OperationType = SPLITS | IMPRESSIONS | IMPRESSIONS_COUNT | EVENTS | TELEMETRY | TOKEN | SEGMENT |
|
|
101
|
+
export declare type MY_SEGMENT = 'ms';
|
|
102
|
+
export declare type OperationType = SPLITS | IMPRESSIONS | IMPRESSIONS_COUNT | EVENTS | TELEMETRY | TOKEN | SEGMENT | MY_SEGMENT;
|
|
103
103
|
export declare type LastSync = Partial<Record<OperationType, number | undefined>>;
|
|
104
104
|
export declare type HttpErrors = Partial<Record<OperationType, {
|
|
105
105
|
[statusCode: string]: number;
|
|
@@ -136,9 +136,8 @@ export declare type TelemetryUsageStats = {
|
|
|
136
136
|
mE?: MethodExceptions;
|
|
137
137
|
};
|
|
138
138
|
export declare type UpdatesFromSSE = {
|
|
139
|
-
sp
|
|
139
|
+
sp: number;
|
|
140
140
|
ms?: number;
|
|
141
|
-
mls?: number;
|
|
142
141
|
};
|
|
143
142
|
export declare type TelemetryUsageStatsPayload = TelemetryUsageStats & {
|
|
144
143
|
lS: LastSync;
|
|
@@ -152,8 +151,6 @@ export declare type TelemetryUsageStatsPayload = TelemetryUsageStats & {
|
|
|
152
151
|
spC?: number;
|
|
153
152
|
seC?: number;
|
|
154
153
|
skC?: number;
|
|
155
|
-
lsC?: number;
|
|
156
|
-
lskC?: number;
|
|
157
154
|
sL?: number;
|
|
158
155
|
eQ: number;
|
|
159
156
|
eD: number;
|
package/types/sync/types.d.ts
CHANGED
|
@@ -39,5 +39,5 @@ export interface ISyncManager extends ITask {
|
|
|
39
39
|
submitterManager?: ISubmitterManager;
|
|
40
40
|
}
|
|
41
41
|
export interface ISyncManagerCS extends ISyncManager {
|
|
42
|
-
shared(matchingKey: string, readinessManager: IReadinessManager, storage: IStorageSync):
|
|
42
|
+
shared(matchingKey: string, readinessManager: IReadinessManager, storage: IStorageSync): ISyncManager | undefined;
|
|
43
43
|
}
|
|
@@ -7,4 +7,4 @@ import { ISettings } from '../types';
|
|
|
7
7
|
* @param eventsCache cache to save events
|
|
8
8
|
* @param integrationsManager optional event handler used for integrations
|
|
9
9
|
*/
|
|
10
|
-
export declare function eventTrackerFactory(settings: ISettings, eventsCache: IEventsCacheBase,
|
|
10
|
+
export declare function eventTrackerFactory(settings: ISettings, eventsCache: IEventsCacheBase, integrationsManager?: IEventsHandler, telemetryCache?: ITelemetryCacheSync | ITelemetryCacheAsync): IEventTracker;
|
|
@@ -10,4 +10,4 @@ import { ISettings } from '../types';
|
|
|
10
10
|
* @param integrationsManager optional integrations manager
|
|
11
11
|
* @param strategy strategy for impressions tracking.
|
|
12
12
|
*/
|
|
13
|
-
export declare function impressionsTrackerFactory(settings: ISettings, impressionsCache: IImpressionsCacheBase, strategy: IStrategy,
|
|
13
|
+
export declare function impressionsTrackerFactory(settings: ISettings, impressionsCache: IImpressionsCacheBase, strategy: IStrategy, integrationsManager?: IImpressionsHandler, telemetryCache?: ITelemetryCacheSync | ITelemetryCacheAsync): IImpressionsTracker;
|
package/types/types.d.ts
CHANGED
|
@@ -422,7 +422,7 @@ export interface IStatusInterface extends IEventEmitter {
|
|
|
422
422
|
* @interface IBasicClient
|
|
423
423
|
* @extends IStatusInterface
|
|
424
424
|
*/
|
|
425
|
-
|
|
425
|
+
interface IBasicClient extends IStatusInterface {
|
|
426
426
|
/**
|
|
427
427
|
* Flush data
|
|
428
428
|
* @function flush
|
|
@@ -452,12 +452,6 @@ interface IBasicSDK {
|
|
|
452
452
|
* @property Logger
|
|
453
453
|
*/
|
|
454
454
|
Logger: ILoggerAPI;
|
|
455
|
-
/**
|
|
456
|
-
* Destroy all the clients created by this factory.
|
|
457
|
-
* @function destroy
|
|
458
|
-
* @returns {Promise<void>}
|
|
459
|
-
*/
|
|
460
|
-
destroy(): Promise<void>;
|
|
461
455
|
}
|
|
462
456
|
/****** Exposed namespace ******/
|
|
463
457
|
/**
|
|
@@ -52,7 +52,7 @@ export declare const EVENTS = "ev";
|
|
|
52
52
|
export declare const TELEMETRY = "te";
|
|
53
53
|
export declare const TOKEN = "to";
|
|
54
54
|
export declare const SEGMENT = "se";
|
|
55
|
-
export declare const
|
|
55
|
+
export declare const MY_SEGMENT = "ms";
|
|
56
56
|
export declare const TREATMENT = "t";
|
|
57
57
|
export declare const TREATMENTS = "ts";
|
|
58
58
|
export declare const TREATMENT_WITH_CONFIG = "tc";
|
|
@@ -78,6 +78,5 @@ export declare const NON_REQUESTED = 1;
|
|
|
78
78
|
export declare const DISABLED = 0;
|
|
79
79
|
export declare const ENABLED = 1;
|
|
80
80
|
export declare const PAUSED = 2;
|
|
81
|
-
export declare const FLAG_SPEC_VERSION = "1.
|
|
81
|
+
export declare const FLAG_SPEC_VERSION = "1.1";
|
|
82
82
|
export declare const IN_SEGMENT = "IN_SEGMENT";
|
|
83
|
-
export declare const IN_LARGE_SEGMENT = "IN_LARGE_SEGMENT";
|
|
@@ -28,7 +28,7 @@ export interface ISettingsValidationParams {
|
|
|
28
28
|
/** Localhost mode validator (`settings.sync.localhostMode`) */
|
|
29
29
|
localhost?: (settings: ISettings) => ISettings['sync']['localhostMode'];
|
|
30
30
|
/** User consent validator (`settings.userConsent`) */
|
|
31
|
-
consent
|
|
31
|
+
consent: (settings: ISettings) => ISettings['userConsent'];
|
|
32
32
|
/** Flag spec version validation. Configurable by the JS Synchronizer but not by the SDKs */
|
|
33
33
|
flagSpec?: (settings: ISettings) => ISettings['sync']['flagSpecVersion'];
|
|
34
34
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.largeSegmentMatcherContext = void 0;
|
|
4
|
-
var thenable_1 = require("../../utils/promise/thenable");
|
|
5
|
-
function largeSegmentMatcherContext(largeSegmentName, storage) {
|
|
6
|
-
return function largeSegmentMatcher(key) {
|
|
7
|
-
var isInLargeSegment = storage.largeSegments ? storage.largeSegments.isInSegment(largeSegmentName, key) : false;
|
|
8
|
-
if ((0, thenable_1.thenable)(isInLargeSegment)) {
|
|
9
|
-
isInLargeSegment.then(function (result) {
|
|
10
|
-
return result;
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
return isInLargeSegment;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
exports.largeSegmentMatcherContext = largeSegmentMatcherContext;
|