@splitsoftware/splitio-commons 1.17.0 → 1.17.1-rc.0
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 +6 -0
- package/cjs/evaluator/matchers/index.js +3 -1
- package/cjs/evaluator/matchers/large_segment.js +16 -0
- package/cjs/evaluator/matchers/matcherTypes.js +1 -0
- package/cjs/evaluator/matchersTransform/index.js +4 -1
- package/cjs/evaluator/matchersTransform/segment.js +3 -1
- 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 +5 -6
- package/cjs/readiness/sdkReadinessManager.js +5 -6
- package/cjs/sdkClient/sdkClientMethodCS.js +2 -2
- package/cjs/sdkClient/sdkClientMethodCSWithTT.js +2 -2
- package/cjs/sdkFactory/index.js +1 -1
- package/cjs/services/splitApi.js +5 -5
- package/cjs/storages/AbstractSegmentsCacheSync.js +41 -12
- package/cjs/storages/AbstractSplitsCacheSync.js +2 -1
- package/cjs/storages/KeyBuilderCS.js +23 -5
- package/cjs/storages/dataLoader.js +1 -1
- package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +29 -52
- package/cjs/storages/inLocalStorage/index.js +6 -2
- package/cjs/storages/inMemory/InMemoryStorageCS.js +5 -0
- package/cjs/storages/inMemory/MySegmentsCacheInMemory.js +9 -40
- package/cjs/storages/inMemory/SplitsCacheInMemory.js +8 -8
- package/cjs/storages/inMemory/TelemetryCacheInMemory.js +7 -10
- package/cjs/storages/pluggable/inMemoryWrapper.js +1 -1
- package/cjs/sync/polling/fetchers/mySegmentsFetcher.js +5 -8
- 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 +15 -21
- package/cjs/sync/streaming/AuthClient/index.js +1 -1
- package/cjs/sync/streaming/SSEHandler/index.js +3 -5
- package/cjs/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +107 -48
- package/cjs/sync/streaming/constants.js +3 -3
- package/cjs/sync/streaming/parseUtils.js +14 -9
- package/cjs/sync/streaming/pushManager.js +69 -67
- package/cjs/utils/constants/index.js +5 -4
- package/cjs/utils/settingsValidation/index.js +2 -1
- package/esm/evaluator/matchers/index.js +3 -1
- package/esm/evaluator/matchers/large_segment.js +12 -0
- package/esm/evaluator/matchers/matcherTypes.js +1 -0
- package/esm/evaluator/matchersTransform/index.js +4 -1
- package/esm/evaluator/matchersTransform/segment.js +3 -1
- 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 +5 -6
- package/esm/readiness/sdkReadinessManager.js +5 -6
- package/esm/sdkClient/sdkClientMethodCS.js +2 -2
- package/esm/sdkClient/sdkClientMethodCSWithTT.js +2 -2
- package/esm/sdkFactory/index.js +1 -1
- package/esm/services/splitApi.js +6 -6
- package/esm/storages/AbstractSegmentsCacheSync.js +41 -12
- package/esm/storages/AbstractSplitsCacheSync.js +3 -2
- package/esm/storages/KeyBuilderCS.js +21 -4
- package/esm/storages/dataLoader.js +1 -1
- package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +29 -52
- package/esm/storages/inLocalStorage/index.js +7 -3
- package/esm/storages/inMemory/InMemoryStorageCS.js +5 -0
- package/esm/storages/inMemory/MySegmentsCacheInMemory.js +9 -40
- package/esm/storages/inMemory/SplitsCacheInMemory.js +8 -8
- package/esm/storages/inMemory/TelemetryCacheInMemory.js +7 -10
- package/esm/storages/pluggable/inMemoryWrapper.js +1 -1
- package/esm/sync/polling/fetchers/mySegmentsFetcher.js +5 -8
- 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 +15 -21
- package/esm/sync/streaming/AuthClient/index.js +1 -1
- package/esm/sync/streaming/SSEHandler/index.js +4 -6
- package/esm/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +108 -49
- package/esm/sync/streaming/constants.js +2 -2
- package/esm/sync/streaming/parseUtils.js +12 -8
- package/esm/sync/streaming/pushManager.js +72 -70
- package/esm/utils/constants/index.js +3 -2
- package/esm/utils/settingsValidation/index.js +2 -1
- package/package.json +1 -1
- package/src/dtos/types.ts +21 -7
- package/src/evaluator/matchers/index.ts +2 -0
- package/src/evaluator/matchers/large_segment.ts +18 -0
- package/src/evaluator/matchers/matcherTypes.ts +1 -0
- package/src/evaluator/matchersTransform/index.ts +4 -1
- package/src/evaluator/matchersTransform/segment.ts +5 -3
- 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 +7 -5
- package/src/readiness/sdkReadinessManager.ts +7 -7
- package/src/readiness/types.ts +2 -2
- package/src/sdkClient/sdkClientMethodCS.ts +2 -2
- package/src/sdkClient/sdkClientMethodCSWithTT.ts +2 -2
- package/src/sdkFactory/index.ts +1 -1
- package/src/services/splitApi.ts +7 -7
- package/src/services/splitHttpClient.ts +1 -1
- package/src/services/types.ts +2 -2
- package/src/storages/AbstractSegmentsCacheSync.ts +53 -12
- package/src/storages/AbstractSplitsCacheSync.ts +4 -3
- package/src/storages/KeyBuilderCS.ts +34 -5
- package/src/storages/dataLoader.ts +1 -1
- package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +29 -59
- package/src/storages/inLocalStorage/index.ts +8 -4
- package/src/storages/inMemory/InMemoryStorageCS.ts +5 -0
- package/src/storages/inMemory/MySegmentsCacheInMemory.ts +10 -44
- package/src/storages/inMemory/SplitsCacheInMemory.ts +7 -8
- package/src/storages/inMemory/TelemetryCacheInMemory.ts +7 -11
- package/src/storages/pluggable/inMemoryWrapper.ts +1 -1
- package/src/storages/types.ts +11 -7
- package/src/sync/polling/fetchers/mySegmentsFetcher.ts +8 -10
- package/src/sync/polling/fetchers/segmentChangesFetcher.ts +1 -1
- package/src/sync/polling/fetchers/types.ts +3 -2
- package/src/sync/polling/pollingManagerCS.ts +4 -4
- package/src/sync/polling/syncTasks/mySegmentsSyncTask.ts +4 -5
- package/src/sync/polling/types.ts +7 -6
- package/src/sync/polling/updaters/mySegmentsUpdater.ts +19 -22
- package/src/sync/streaming/AuthClient/index.ts +1 -1
- package/src/sync/streaming/SSEClient/index.ts +4 -6
- package/src/sync/streaming/SSEHandler/index.ts +5 -8
- package/src/sync/streaming/SSEHandler/types.ts +15 -15
- package/src/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.ts +116 -49
- package/src/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.ts +1 -1
- 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 +19 -11
- package/src/sync/streaming/pushManager.ts +73 -72
- package/src/sync/streaming/types.ts +10 -10
- package/src/sync/submitters/types.ts +8 -5
- package/src/utils/constants/index.ts +3 -2
- package/src/utils/settingsValidation/index.ts +3 -2
- package/src/utils/settingsValidation/types.ts +1 -1
- package/types/dtos/types.d.ts +18 -7
- 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 +2 -3
- package/types/readiness/types.d.ts +2 -2
- 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 +9 -11
- package/types/storages/AbstractSplitsCacheSync.d.ts +1 -1
- package/types/storages/KeyBuilderCS.d.ts +9 -2
- package/types/storages/inLocalStorage/MySegmentsCacheInLocal.d.ts +4 -14
- package/types/storages/inMemory/MySegmentsCacheInMemory.d.ts +3 -9
- package/types/storages/inMemory/SplitsCacheInMemory.d.ts +1 -1
- package/types/storages/inMemory/TelemetryCacheInMemory.d.ts +4 -6
- package/types/storages/pluggable/inMemoryWrapper.d.ts +1 -1
- package/types/storages/types.d.ts +7 -5
- 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 +7 -4
- package/types/sync/polling/updaters/mySegmentsUpdater.d.ts +4 -3
- package/types/sync/streaming/SSEHandler/types.d.ts +16 -14
- package/types/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.d.ts +4 -2
- package/types/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.d.ts +2 -1
- package/types/sync/streaming/UpdateWorkers/SplitsUpdateWorker.d.ts +3 -2
- 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 +4 -5
- package/types/sync/streaming/types.d.ts +8 -8
- package/types/sync/submitters/types.d.ts +7 -4
- package/types/utils/constants/index.d.ts +3 -2
- package/types/utils/settingsValidation/types.d.ts +1 -1
package/types/dtos/types.d.ts
CHANGED
|
@@ -21,6 +21,9 @@ export interface IWhitelistMatcherData {
|
|
|
21
21
|
export interface IInSegmentMatcherData {
|
|
22
22
|
segmentName: string;
|
|
23
23
|
}
|
|
24
|
+
export interface IInLargeSegmentMatcherData {
|
|
25
|
+
largeSegmentName: string;
|
|
26
|
+
}
|
|
24
27
|
export interface IDependencyMatcherData {
|
|
25
28
|
split: string;
|
|
26
29
|
treatments: string[];
|
|
@@ -33,6 +36,7 @@ interface ISplitMatcherBase {
|
|
|
33
36
|
attribute: string | null;
|
|
34
37
|
};
|
|
35
38
|
userDefinedSegmentMatcherData?: null | IInSegmentMatcherData;
|
|
39
|
+
userDefinedLargeSegmentMatcherData?: null | IInLargeSegmentMatcherData;
|
|
36
40
|
whitelistMatcherData?: null | IWhitelistMatcherData;
|
|
37
41
|
unaryNumericMatcherData?: null | IUnaryNumericMatcherData;
|
|
38
42
|
betweenMatcherData?: null | IBetweenMatcherData;
|
|
@@ -48,6 +52,10 @@ interface IInSegmentMatcher extends ISplitMatcherBase {
|
|
|
48
52
|
matcherType: 'IN_SEGMENT';
|
|
49
53
|
userDefinedSegmentMatcherData: IInSegmentMatcherData;
|
|
50
54
|
}
|
|
55
|
+
interface IInLargeSegmentMatcher extends ISplitMatcherBase {
|
|
56
|
+
matcherType: 'IN_LARGE_SEGMENT';
|
|
57
|
+
userDefinedLargeSegmentMatcherData: IInLargeSegmentMatcherData;
|
|
58
|
+
}
|
|
51
59
|
interface IWhitelistMatcher extends ISplitMatcherBase {
|
|
52
60
|
matcherType: 'WHITELIST';
|
|
53
61
|
whitelistMatcherData: IWhitelistMatcherData;
|
|
@@ -128,7 +136,7 @@ interface IInListSemverMatcher extends ISplitMatcherBase {
|
|
|
128
136
|
matcherType: 'IN_LIST_SEMVER';
|
|
129
137
|
whitelistMatcherData: IWhitelistMatcherData;
|
|
130
138
|
}
|
|
131
|
-
export declare type ISplitMatcher = IAllKeysMatcher | IInSegmentMatcher | IWhitelistMatcher | IEqualToMatcher | IGreaterThanOrEqualToMatcher | ILessThanOrEqualToMatcher | IBetweenMatcher | IEqualToSetMatcher | IContainsAnyOfSetMatcher | IContainsAllOfSetMatcher | IPartOfSetMatcher | IStartsWithMatcher | IEndsWithMatcher | IContainsStringMatcher | IInSplitTreatmentMatcher | IEqualToBooleanMatcher | IMatchesStringMatcher | IEqualToSemverMatcher | IGreaterThanOrEqualToSemverMatcher | ILessThanOrEqualToSemverMatcher | IBetweenSemverMatcher | IInListSemverMatcher;
|
|
139
|
+
export declare type ISplitMatcher = IAllKeysMatcher | IInSegmentMatcher | IWhitelistMatcher | IEqualToMatcher | IGreaterThanOrEqualToMatcher | ILessThanOrEqualToMatcher | IBetweenMatcher | IEqualToSetMatcher | IContainsAnyOfSetMatcher | IContainsAllOfSetMatcher | IPartOfSetMatcher | IStartsWithMatcher | IEndsWithMatcher | IContainsStringMatcher | IInSplitTreatmentMatcher | IEqualToBooleanMatcher | IMatchesStringMatcher | IEqualToSemverMatcher | IGreaterThanOrEqualToSemverMatcher | ILessThanOrEqualToSemverMatcher | IBetweenSemverMatcher | IInListSemverMatcher | IInLargeSegmentMatcher;
|
|
132
140
|
/** Split object */
|
|
133
141
|
export interface ISplitPartition {
|
|
134
142
|
treatment: string;
|
|
@@ -173,13 +181,16 @@ export interface ISegmentChangesResponse {
|
|
|
173
181
|
since: number;
|
|
174
182
|
till: number;
|
|
175
183
|
}
|
|
176
|
-
export interface IMySegmentsResponseItem {
|
|
177
|
-
id: string;
|
|
178
|
-
name: string;
|
|
179
|
-
}
|
|
180
|
-
/** Interface of the parsed JSON response of `/mySegments/{userKey}` */
|
|
181
184
|
export interface IMySegmentsResponse {
|
|
182
|
-
|
|
185
|
+
cn?: number;
|
|
186
|
+
k?: {
|
|
187
|
+
n: string;
|
|
188
|
+
}[];
|
|
189
|
+
}
|
|
190
|
+
/** Interface of the parsed JSON response of `/memberships/{userKey}` */
|
|
191
|
+
export interface IMembershipsResponse {
|
|
192
|
+
ms?: IMySegmentsResponse;
|
|
193
|
+
ls?: IMySegmentsResponse;
|
|
183
194
|
}
|
|
184
195
|
/** Metadata internal type for storages */
|
|
185
196
|
export interface IMetadata {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IInSegmentMatcherData } from '../../dtos/types';
|
|
1
|
+
import { IInSegmentMatcherData, IInLargeSegmentMatcherData } from '../../dtos/types';
|
|
2
2
|
/**
|
|
3
3
|
* Extract segment name as a plain string.
|
|
4
4
|
*/
|
|
5
|
-
export declare function segmentTransform(segment?: IInSegmentMatcherData): string | undefined;
|
|
5
|
+
export declare function segmentTransform(segment?: IInSegmentMatcherData | IInLargeSegmentMatcherData): string | undefined;
|
|
@@ -77,7 +77,7 @@ export declare const WARN_SPLITS_FILTER_IGNORED = 219;
|
|
|
77
77
|
export declare const WARN_SPLITS_FILTER_INVALID = 220;
|
|
78
78
|
export declare const WARN_SPLITS_FILTER_EMPTY = 221;
|
|
79
79
|
export declare const WARN_SDK_KEY = 222;
|
|
80
|
-
export declare const
|
|
80
|
+
export declare const STREAMING_PARSING_MEMBERSHIPS_UPDATE = 223;
|
|
81
81
|
export declare const STREAMING_PARSING_SPLIT_UPDATE = 224;
|
|
82
82
|
export declare const WARN_INVALID_FLAGSET = 225;
|
|
83
83
|
export declare const WARN_LOWERCASE_FLAGSET = 226;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IEventEmitter } from '../types';
|
|
1
|
+
import { IEventEmitter, ISettings } from '../types';
|
|
2
2
|
import { IReadinessManager, ISplitsEventEmitter } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Factory of readiness manager, which handles the ready / update event propagation.
|
|
5
5
|
*/
|
|
6
|
-
export declare function readinessManagerFactory(EventEmitter: new () => IEventEmitter,
|
|
6
|
+
export declare function readinessManagerFactory(EventEmitter: new () => IEventEmitter, settings: ISettings, splits?: ISplitsEventEmitter): IReadinessManager;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ISdkReadinessManager } from './types';
|
|
2
|
-
import { IEventEmitter } from '../types';
|
|
3
|
-
import { ILogger } from '../logger/types';
|
|
2
|
+
import { IEventEmitter, ISettings } from '../types';
|
|
4
3
|
/**
|
|
5
4
|
* SdkReadinessManager factory, which provides the public status API of SDK clients and manager: ready promise, readiness event emitter and constants (SDK_READY, etc).
|
|
6
5
|
* It also updates logs related warnings and errors.
|
|
@@ -8,4 +7,4 @@ import { ILogger } from '../logger/types';
|
|
|
8
7
|
* @param readyTimeout time in millis to emit SDK_READY_TIME_OUT event
|
|
9
8
|
* @param readinessManager optional readinessManager to use. only used internally for `shared` method
|
|
10
9
|
*/
|
|
11
|
-
export declare function sdkReadinessManagerFactory(
|
|
10
|
+
export declare function sdkReadinessManagerFactory(EventEmitter: new () => IEventEmitter, settings: ISettings, readinessManager?: import("./types").IReadinessManager): ISdkReadinessManager;
|
|
@@ -47,7 +47,7 @@ export interface IReadinessManager {
|
|
|
47
47
|
setDestroyed(): void;
|
|
48
48
|
destroy(): void;
|
|
49
49
|
/** for client-side */
|
|
50
|
-
shared(
|
|
50
|
+
shared(): IReadinessManager;
|
|
51
51
|
}
|
|
52
52
|
/** SDK readiness manager */
|
|
53
53
|
export interface ISdkReadinessManager {
|
|
@@ -59,6 +59,6 @@ export interface ISdkReadinessManager {
|
|
|
59
59
|
*/
|
|
60
60
|
incInternalReadyCbCount(): void;
|
|
61
61
|
/** for client-side */
|
|
62
|
-
shared(
|
|
62
|
+
shared(): ISdkReadinessManager;
|
|
63
63
|
}
|
|
64
64
|
export {};
|
|
@@ -9,4 +9,4 @@ import { ITelemetryTracker } from '../trackers/types';
|
|
|
9
9
|
* @param platform object containing environment-specific dependencies
|
|
10
10
|
* @param telemetryTracker telemetry tracker
|
|
11
11
|
*/
|
|
12
|
-
export declare function splitApiFactory(settings: ISettings, platform: IPlatform, telemetryTracker: ITelemetryTracker): ISplitApi;
|
|
12
|
+
export declare function splitApiFactory(settings: ISettings, platform: Pick<IPlatform, 'getOptions' | 'getFetch'>, telemetryTracker: ITelemetryTracker): ISplitApi;
|
|
@@ -7,4 +7,4 @@ import { IPlatform } from '../sdkFactory/types';
|
|
|
7
7
|
* @param settings SDK settings, used to access authorizationKey, logger instance and metadata (SDK version, ip and hostname) to set additional headers
|
|
8
8
|
* @param platform object containing environment-specific dependencies
|
|
9
9
|
*/
|
|
10
|
-
export declare function splitHttpClientFactory(settings: ISettings, { getOptions, getFetch }: IPlatform): ISplitHttpClient;
|
|
10
|
+
export declare function splitHttpClientFactory(settings: ISettings, { getOptions, getFetch }: Pick<IPlatform, 'getOptions' | 'getFetch'>): ISplitHttpClient;
|
|
@@ -18,7 +18,7 @@ export declare type ISplitHttpClient = (url: string, options?: IRequestOptions,
|
|
|
18
18
|
export declare type IFetchAuth = (userKeys?: string[]) => Promise<IResponse>;
|
|
19
19
|
export declare type IFetchSplitChanges = (since: number, noCache?: boolean, till?: number) => Promise<IResponse>;
|
|
20
20
|
export declare type IFetchSegmentChanges = (since: number, segmentName: string, noCache?: boolean, till?: number) => Promise<IResponse>;
|
|
21
|
-
export declare type
|
|
21
|
+
export declare type IFetchMemberships = (userMatchingKey: string, noCache?: boolean, till?: number) => Promise<IResponse>;
|
|
22
22
|
export declare type IPostEventsBulk = (body: string, headers?: Record<string, string>) => Promise<IResponse>;
|
|
23
23
|
export declare type IPostUniqueKeysBulkCs = (body: string, headers?: Record<string, string>) => Promise<IResponse>;
|
|
24
24
|
export declare type IPostUniqueKeysBulkSs = (body: string, headers?: Record<string, string>) => Promise<IResponse>;
|
|
@@ -32,7 +32,7 @@ export interface ISplitApi {
|
|
|
32
32
|
fetchAuth: IFetchAuth;
|
|
33
33
|
fetchSplitChanges: IFetchSplitChanges;
|
|
34
34
|
fetchSegmentChanges: IFetchSegmentChanges;
|
|
35
|
-
|
|
35
|
+
fetchMemberships: IFetchMemberships;
|
|
36
36
|
postEventsBulk: IPostEventsBulk;
|
|
37
37
|
postUniqueKeysBulkCs: IPostUniqueKeysBulkCs;
|
|
38
38
|
postUniqueKeysBulkSs: IPostUniqueKeysBulkSs;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { IMySegmentsResponse } from '../dtos/types';
|
|
2
|
+
import { MySegmentsData } from '../sync/polling/types';
|
|
1
3
|
import { ISegmentsCacheSync } from './types';
|
|
2
4
|
/**
|
|
3
5
|
* This class provides a skeletal implementation of the ISegmentsCacheSync interface
|
|
@@ -22,7 +24,7 @@ export declare abstract class AbstractSegmentsCacheSync implements ISegmentsCach
|
|
|
22
24
|
/**
|
|
23
25
|
* clear the cache.
|
|
24
26
|
*/
|
|
25
|
-
|
|
27
|
+
clear(): void;
|
|
26
28
|
/**
|
|
27
29
|
* For server-side synchronizer: add the given list of segments to the cache, with an empty list of keys. The segments that already exist are not modified.
|
|
28
30
|
* For client-side synchronizer: the method is not used.
|
|
@@ -39,18 +41,14 @@ export declare abstract class AbstractSegmentsCacheSync implements ISegmentsCach
|
|
|
39
41
|
*/
|
|
40
42
|
abstract getKeysCount(): number;
|
|
41
43
|
/**
|
|
42
|
-
* For server-side synchronizer:
|
|
43
|
-
* For client-side synchronizer:
|
|
44
|
-
*/
|
|
45
|
-
setChangeNumber(name: string, changeNumber: number): boolean;
|
|
46
|
-
/**
|
|
47
|
-
* For server-side synchronizer: get the change number of `name` segment.
|
|
48
|
-
* For client-side synchronizer: the method is not used.
|
|
44
|
+
* For server-side synchronizer: change number of `name` segment.
|
|
45
|
+
* For client-side synchronizer: change number of mySegments.
|
|
49
46
|
*/
|
|
50
|
-
|
|
47
|
+
abstract setChangeNumber(name?: string, changeNumber?: number): boolean | void;
|
|
48
|
+
abstract getChangeNumber(name: string): number;
|
|
51
49
|
/**
|
|
52
50
|
* For server-side synchronizer: the method is not used.
|
|
53
|
-
* For client-side synchronizer:
|
|
51
|
+
* For client-side synchronizer: it resets or updates the cache.
|
|
54
52
|
*/
|
|
55
|
-
resetSegments(
|
|
53
|
+
resetSegments(segmentsData: MySegmentsData | IMySegmentsResponse): boolean;
|
|
56
54
|
}
|
|
@@ -12,7 +12,7 @@ export declare abstract class AbstractSplitsCacheSync implements ISplitsCacheSyn
|
|
|
12
12
|
removeSplits(names: string[]): boolean[];
|
|
13
13
|
abstract getSplit(name: string): ISplit | null;
|
|
14
14
|
getSplits(names: string[]): Record<string, ISplit | null>;
|
|
15
|
-
abstract setChangeNumber(changeNumber: number): boolean;
|
|
15
|
+
abstract setChangeNumber(changeNumber: number): boolean | void;
|
|
16
16
|
abstract getChangeNumber(): number;
|
|
17
17
|
getAll(): ISplit[];
|
|
18
18
|
abstract getSplitNames(): string[];
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { KeyBuilder } from './KeyBuilder';
|
|
2
|
-
export
|
|
2
|
+
export interface MySegmentsKeyBuilder {
|
|
3
|
+
buildSegmentNameKey(segmentName: string): string;
|
|
4
|
+
extractSegmentName(builtSegmentKeyName: string): string | undefined;
|
|
5
|
+
extractOldSegmentKey(builtSegmentKeyName: string): string | undefined;
|
|
6
|
+
buildTillKey(): string;
|
|
7
|
+
}
|
|
8
|
+
export declare class KeyBuilderCS extends KeyBuilder implements MySegmentsKeyBuilder {
|
|
3
9
|
protected readonly regexSplitsCacheKey: RegExp;
|
|
4
10
|
protected readonly matchingKey: string;
|
|
5
11
|
constructor(prefix: string, matchingKey: string);
|
|
@@ -8,8 +14,9 @@ export declare class KeyBuilderCS extends KeyBuilder {
|
|
|
8
14
|
*/
|
|
9
15
|
buildSegmentNameKey(segmentName: string): string;
|
|
10
16
|
extractSegmentName(builtSegmentKeyName: string): string | undefined;
|
|
11
|
-
buildOldSegmentNameKey(segmentName: string): string;
|
|
12
17
|
extractOldSegmentKey(builtSegmentKeyName: string): string | undefined;
|
|
13
18
|
buildLastUpdatedKey(): string;
|
|
14
19
|
isSplitsCacheKey(key: string): boolean;
|
|
20
|
+
buildTillKey(): string;
|
|
15
21
|
}
|
|
22
|
+
export declare function myLargeSegmentsKeyBuilder(prefix: string, matchingKey: string): MySegmentsKeyBuilder;
|
|
@@ -1,25 +1,15 @@
|
|
|
1
1
|
import { ILogger } from '../../logger/types';
|
|
2
2
|
import { AbstractSegmentsCacheSync } from '../AbstractSegmentsCacheSync';
|
|
3
|
-
import {
|
|
3
|
+
import type { MySegmentsKeyBuilder } from '../KeyBuilderCS';
|
|
4
4
|
export declare class MySegmentsCacheInLocal extends AbstractSegmentsCacheSync {
|
|
5
5
|
private readonly keys;
|
|
6
6
|
private readonly log;
|
|
7
|
-
constructor(log: ILogger, keys:
|
|
8
|
-
/**
|
|
9
|
-
* Removes list of segments from localStorage
|
|
10
|
-
* @NOTE this method is not being used at the moment.
|
|
11
|
-
*/
|
|
12
|
-
clear(): void;
|
|
7
|
+
constructor(log: ILogger, keys: MySegmentsKeyBuilder);
|
|
13
8
|
addToSegment(name: string): boolean;
|
|
14
9
|
removeFromSegment(name: string): boolean;
|
|
15
10
|
isInSegment(name: string): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Reset (update) the cached list of segments with the given list, removing and adding segments if necessary.
|
|
18
|
-
*
|
|
19
|
-
* @param {string[]} segmentNames list of segment names
|
|
20
|
-
* @returns boolean indicating if the cache was updated (i.e., given list was different from the cached one)
|
|
21
|
-
*/
|
|
22
|
-
resetSegments(names: string[]): boolean;
|
|
23
11
|
getRegisteredSegments(): string[];
|
|
24
12
|
getKeysCount(): number;
|
|
13
|
+
setChangeNumber(name?: string, changeNumber?: number): void;
|
|
14
|
+
getChangeNumber(): number;
|
|
25
15
|
}
|
|
@@ -5,18 +5,12 @@ import { AbstractSegmentsCacheSync } from '../AbstractSegmentsCacheSync';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare class MySegmentsCacheInMemory extends AbstractSegmentsCacheSync {
|
|
7
7
|
private segmentCache;
|
|
8
|
-
|
|
8
|
+
private cn?;
|
|
9
9
|
addToSegment(name: string): boolean;
|
|
10
10
|
removeFromSegment(name: string): boolean;
|
|
11
11
|
isInSegment(name: string): boolean;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* @NOTE based on the way we use segments in the browser, this way is the best option
|
|
15
|
-
*
|
|
16
|
-
* @param {string[]} names list of segment names
|
|
17
|
-
* @returns boolean indicating if the cache was updated (i.e., given list was different from the cached one)
|
|
18
|
-
*/
|
|
19
|
-
resetSegments(names: string[]): boolean;
|
|
12
|
+
setChangeNumber(name?: string, changeNumber?: number): void;
|
|
13
|
+
getChangeNumber(): number;
|
|
20
14
|
getRegisteredSegments(): string[];
|
|
21
15
|
getKeysCount(): number;
|
|
22
16
|
}
|
|
@@ -10,7 +10,7 @@ export declare class SplitsCacheInMemory extends AbstractSplitsCacheSync {
|
|
|
10
10
|
private splitsCache;
|
|
11
11
|
private ttCache;
|
|
12
12
|
private changeNumber;
|
|
13
|
-
private
|
|
13
|
+
private segmentsCount;
|
|
14
14
|
private flagSetsCache;
|
|
15
15
|
constructor(splitFiltersValidation?: ISplitFiltersValidation);
|
|
16
16
|
clear(): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ImpressionDataType, EventDataType, StreamingEvent, Method, OperationType, TelemetryUsageStatsPayload, UpdatesFromSSEEnum } from '../../sync/submitters/types';
|
|
1
|
+
import { ImpressionDataType, EventDataType, StreamingEvent, Method, OperationType, TelemetryUsageStatsPayload, UpdatesFromSSEEnum, UpdatesFromSSE } 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,7 +10,8 @@ export declare function shouldRecordTelemetry({ settings }: IStorageFactoryParam
|
|
|
10
10
|
export declare class TelemetryCacheInMemory implements ITelemetryCacheSync {
|
|
11
11
|
private splits?;
|
|
12
12
|
private segments?;
|
|
13
|
-
|
|
13
|
+
private largeSegments?;
|
|
14
|
+
constructor(splits?: ISplitsCacheSync | undefined, segments?: ISegmentsCacheSync | undefined, largeSegments?: ISegmentsCacheSync | undefined);
|
|
14
15
|
private e;
|
|
15
16
|
isEmpty(): boolean;
|
|
16
17
|
clear(): void;
|
|
@@ -65,9 +66,6 @@ export declare class TelemetryCacheInMemory implements ITelemetryCacheSync {
|
|
|
65
66
|
popLatencies(): Partial<Record<Method, number[]>>;
|
|
66
67
|
recordLatency(method: Method, latencyMs: number): void;
|
|
67
68
|
private updatesFromSSE;
|
|
68
|
-
popUpdatesFromSSE():
|
|
69
|
-
sp: number;
|
|
70
|
-
ms: number;
|
|
71
|
-
};
|
|
69
|
+
popUpdatesFromSSE(): UpdatesFromSSE;
|
|
72
70
|
recordUpdatesFromSSE(type: UpdatesFromSSEEnum): void;
|
|
73
71
|
}
|
|
@@ -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 immediately.
|
|
9
9
|
*/
|
|
10
10
|
export declare function inMemoryWrapperFactory(connDelay?: number): IPluggableStorageWrapper & {
|
|
11
11
|
_cache: Record<string, string | string[] | ISet<string>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { MaybeThenable, ISplit } from '../dtos/types';
|
|
1
|
+
import { MaybeThenable, ISplit, IMySegmentsResponse } from '../dtos/types';
|
|
2
|
+
import { MySegmentsData } from '../sync/polling/types';
|
|
2
3
|
import { EventDataType, HttpErrors, HttpLatencies, ImpressionDataType, LastSync, Method, MethodExceptions, MethodLatencies, MultiMethodExceptions, MultiMethodLatencies, MultiConfigs, OperationType, StoredEventWithMetadata, StoredImpressionWithMetadata, StreamingEvent, UniqueKeysPayloadCs, UniqueKeysPayloadSs, TelemetryUsageStatsPayload, UpdatesFromSSEEnum } from '../sync/submitters/types';
|
|
3
4
|
import { SplitIO, ImpressionDTO, ISettings } from '../types';
|
|
4
5
|
import { ISet } from '../utils/lang/sets';
|
|
@@ -200,7 +201,7 @@ export interface ISplitsCacheSync extends ISplitsCacheBase {
|
|
|
200
201
|
removeSplits(names: string[]): boolean[];
|
|
201
202
|
getSplit(name: string): ISplit | null;
|
|
202
203
|
getSplits(names: string[]): Record<string, ISplit | null>;
|
|
203
|
-
setChangeNumber(changeNumber: number): boolean;
|
|
204
|
+
setChangeNumber(changeNumber: number): boolean | void;
|
|
204
205
|
getChangeNumber(): number;
|
|
205
206
|
getAll(): ISplit[];
|
|
206
207
|
getSplitNames(): string[];
|
|
@@ -245,9 +246,9 @@ export interface ISegmentsCacheSync extends ISegmentsCacheBase {
|
|
|
245
246
|
registerSegments(names: string[]): boolean;
|
|
246
247
|
getRegisteredSegments(): string[];
|
|
247
248
|
getKeysCount(): number;
|
|
248
|
-
setChangeNumber(name: string, changeNumber: number): boolean;
|
|
249
|
-
getChangeNumber(name
|
|
250
|
-
resetSegments(
|
|
249
|
+
setChangeNumber(name: string, changeNumber: number): boolean | void;
|
|
250
|
+
getChangeNumber(name?: string): number;
|
|
251
|
+
resetSegments(segmentsData: MySegmentsData | IMySegmentsResponse): boolean;
|
|
251
252
|
clear(): void;
|
|
252
253
|
}
|
|
253
254
|
export interface ISegmentsCacheAsync extends ISegmentsCacheBase {
|
|
@@ -388,6 +389,7 @@ export interface IStorageBase<TSplitsCache extends ISplitsCacheBase, TSegmentsCa
|
|
|
388
389
|
shared?: (matchingKey: string, onReadyCb: (error?: any) => void) => this;
|
|
389
390
|
}
|
|
390
391
|
export interface IStorageSync extends IStorageBase<ISplitsCacheSync, ISegmentsCacheSync, IImpressionsCacheSync, IImpressionCountsCacheSync, IEventsCacheSync, ITelemetryCacheSync, IUniqueKeysCacheSync> {
|
|
392
|
+
largeSegments?: ISegmentsCacheSync;
|
|
391
393
|
}
|
|
392
394
|
export interface IStorageAsync extends IStorageBase<ISplitsCacheAsync, ISegmentsCacheAsync, IImpressionsCacheAsync | IImpressionsCacheSync, IImpressionCountsCacheBase, IEventsCacheAsync | IEventsCacheSync, ITelemetryCacheAsync | ITelemetryCacheSync, IUniqueKeysCacheBase> {
|
|
393
395
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IFetchMemberships } 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(fetchMemberships: IFetchMemberships): IMySegmentsFetcher;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ISplitChangesResponse, ISegmentChangesResponse } from '../../../dtos/types';
|
|
1
|
+
import { ISplitChangesResponse, ISegmentChangesResponse, IMembershipsResponse } 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, decorator?: (promise: Promise<IResponse>) => Promise<IResponse>) => Promise<
|
|
5
|
+
export declare type IMySegmentsFetcher = (userMatchingKey: string, noCache?: boolean, till?: number, decorator?: (promise: Promise<IResponse>) => Promise<IResponse>) => Promise<IMembershipsResponse>;
|
|
@@ -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 { IFetchMemberships } 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(fetchMemberships: IFetchMemberships, storage: IStorageSync, readiness: IReadinessManager, settings: ISettings, matchingKey: string): IMySegmentsSyncTask;
|
|
@@ -1,6 +1,7 @@
|
|
|
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';
|
|
4
5
|
import { ITask, ISyncTask } from '../types';
|
|
5
6
|
export interface ISplitsSyncTask extends ISyncTask<[noCache?: boolean, till?: number, splitUpdateNotification?: {
|
|
6
7
|
payload: ISplit;
|
|
@@ -9,11 +10,13 @@ export interface ISplitsSyncTask extends ISyncTask<[noCache?: boolean, till?: nu
|
|
|
9
10
|
}
|
|
10
11
|
export interface ISegmentsSyncTask extends ISyncTask<[fetchOnlyNew?: boolean, segmentName?: string, noCache?: boolean, till?: number], boolean> {
|
|
11
12
|
}
|
|
12
|
-
export declare type MySegmentsData =
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
export declare type MySegmentsData = {
|
|
14
|
+
type: MEMBERSHIPS_MS_UPDATE | MEMBERSHIPS_LS_UPDATE;
|
|
15
|
+
cn: number;
|
|
16
|
+
added: string[];
|
|
17
|
+
removed: string[];
|
|
15
18
|
};
|
|
16
|
-
export interface IMySegmentsSyncTask extends ISyncTask<[segmentsData?: MySegmentsData, noCache?: boolean], boolean> {
|
|
19
|
+
export interface IMySegmentsSyncTask extends ISyncTask<[segmentsData?: MySegmentsData, noCache?: boolean, till?: number], boolean> {
|
|
17
20
|
}
|
|
18
21
|
export interface IPollingManager extends ITask {
|
|
19
22
|
syncAll(): Promise<any>;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { IMySegmentsFetcher } from '../fetchers/types';
|
|
2
|
-
import {
|
|
2
|
+
import { IStorageSync } from '../../../storages/types';
|
|
3
3
|
import { ISegmentsEventEmitter } from '../../../readiness/types';
|
|
4
4
|
import { ILogger } from '../../../logger/types';
|
|
5
|
-
|
|
5
|
+
import { MySegmentsData } from '../types';
|
|
6
|
+
declare type IMySegmentsUpdater = (segmentsData?: MySegmentsData, noCache?: boolean, till?: number) => Promise<boolean>;
|
|
6
7
|
/**
|
|
7
8
|
* factory of MySegments updater, a task that:
|
|
8
9
|
* - fetches mySegments using `mySegmentsFetcher`
|
|
9
10
|
* - updates `mySegmentsCache`
|
|
10
11
|
* - uses `segmentsEventEmitter` to emit events related to segments data updates
|
|
11
12
|
*/
|
|
12
|
-
export declare function mySegmentsUpdaterFactory(log: ILogger, mySegmentsFetcher: IMySegmentsFetcher,
|
|
13
|
+
export declare function mySegmentsUpdaterFactory(log: ILogger, mySegmentsFetcher: IMySegmentsFetcher, storage: IStorageSync, segmentsEventEmitter: ISegmentsEventEmitter, requestTimeoutBeforeReady: number, retriesOnFailureBeforeReady: number, matchingKey: string): IMySegmentsUpdater;
|
|
13
14
|
export {};
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { ControlType } from '../constants';
|
|
2
|
-
import {
|
|
3
|
-
export interface IMySegmentsUpdateData {
|
|
4
|
-
type: MY_SEGMENTS_UPDATE;
|
|
5
|
-
changeNumber: number;
|
|
6
|
-
includesPayload: boolean;
|
|
7
|
-
segmentList?: string[];
|
|
8
|
-
}
|
|
2
|
+
import { SEGMENT_UPDATE, SPLIT_UPDATE, SPLIT_KILL, CONTROL, OCCUPANCY, MEMBERSHIPS_LS_UPDATE, MEMBERSHIPS_MS_UPDATE } from '../types';
|
|
9
3
|
export declare enum Compression {
|
|
10
4
|
None = 0,
|
|
11
5
|
Gzip = 1,
|
|
@@ -21,13 +15,20 @@ export interface KeyList {
|
|
|
21
15
|
a?: string[];
|
|
22
16
|
r?: string[];
|
|
23
17
|
}
|
|
24
|
-
|
|
25
|
-
type:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
c
|
|
29
|
-
d
|
|
18
|
+
interface IMembershipUpdateData<T extends string> {
|
|
19
|
+
type: T;
|
|
20
|
+
cn: number;
|
|
21
|
+
n?: string[];
|
|
22
|
+
c?: Compression;
|
|
23
|
+
d?: string;
|
|
30
24
|
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> {
|
|
31
32
|
}
|
|
32
33
|
export interface ISegmentUpdateData {
|
|
33
34
|
type: SEGMENT_UPDATE;
|
|
@@ -57,7 +58,7 @@ export interface IOccupancyData {
|
|
|
57
58
|
publishers: number;
|
|
58
59
|
};
|
|
59
60
|
}
|
|
60
|
-
export declare type INotificationData =
|
|
61
|
+
export declare type INotificationData = IMembershipMSUpdateData | IMembershipLSUpdateData | ISegmentUpdateData | ISplitUpdateData | ISplitKillData | IControlData | IOccupancyData;
|
|
61
62
|
export declare type INotificationMessage = {
|
|
62
63
|
parsedData: INotificationData;
|
|
63
64
|
channel: string;
|
|
@@ -68,3 +69,4 @@ export declare type INotificationError = Event & {
|
|
|
68
69
|
parsedData?: any;
|
|
69
70
|
message?: string;
|
|
70
71
|
};
|
|
72
|
+
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { IMySegmentsSyncTask } from '../../polling/types';
|
|
1
|
+
import { IMySegmentsSyncTask, MySegmentsData } 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';
|
|
4
6
|
/**
|
|
5
7
|
* MySegmentsUpdateWorker factory
|
|
6
8
|
*/
|
|
7
|
-
export declare function MySegmentsUpdateWorker(mySegmentsSyncTask: IMySegmentsSyncTask, telemetryTracker: ITelemetryTracker): IUpdateWorker
|
|
9
|
+
export declare function MySegmentsUpdateWorker(log: ILogger, storage: Pick<IStorageSync, 'segments' | 'largeSegments'>, mySegmentsSyncTask: IMySegmentsSyncTask, telemetryTracker: ITelemetryTracker): IUpdateWorker<[mySegmentsData?: Pick<MySegmentsData, 'type' | 'cn'>, payload?: Pick<MySegmentsData, 'added' | 'removed'>, delay?: number]>;
|
|
@@ -1,8 +1,9 @@
|
|
|
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';
|
|
4
5
|
import { IUpdateWorker } from './types';
|
|
5
6
|
/**
|
|
6
7
|
* SegmentsUpdateWorker factory
|
|
7
8
|
*/
|
|
8
|
-
export declare function SegmentsUpdateWorker(log: ILogger, segmentsSyncTask: ISegmentsSyncTask, segmentsCache: ISegmentsCacheSync): IUpdateWorker
|
|
9
|
+
export declare function SegmentsUpdateWorker(log: ILogger, segmentsSyncTask: ISegmentsSyncTask, segmentsCache: ISegmentsCacheSync): IUpdateWorker<[ISegmentUpdateData]>;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { ISplit } from '../../../dtos/types';
|
|
1
2
|
import { ILogger } from '../../../logger/types';
|
|
2
3
|
import { ISplitsEventEmitter } from '../../../readiness/types';
|
|
3
4
|
import { ISplitsCacheSync } from '../../../storages/types';
|
|
4
5
|
import { ITelemetryTracker } from '../../../trackers/types';
|
|
5
6
|
import { ISegmentsSyncTask, ISplitsSyncTask } from '../../polling/types';
|
|
6
|
-
import { ISplitKillData } from '../SSEHandler/types';
|
|
7
|
+
import { ISplitKillData, ISplitUpdateData } from '../SSEHandler/types';
|
|
7
8
|
import { IUpdateWorker } from './types';
|
|
8
9
|
/**
|
|
9
10
|
* SplitsUpdateWorker factory
|
|
10
11
|
*/
|
|
11
|
-
export declare function SplitsUpdateWorker(log: ILogger, splitsCache: ISplitsCacheSync, splitsSyncTask: ISplitsSyncTask, splitsEventEmitter: ISplitsEventEmitter, telemetryTracker: ITelemetryTracker, segmentsSyncTask?: ISegmentsSyncTask): IUpdateWorker & {
|
|
12
|
+
export declare function SplitsUpdateWorker(log: ILogger, splitsCache: ISplitsCacheSync, splitsSyncTask: ISplitsSyncTask, splitsEventEmitter: ISplitsEventEmitter, telemetryTracker: ITelemetryTracker, segmentsSyncTask?: ISegmentsSyncTask): IUpdateWorker<[updateData: ISplitUpdateData, payload?: ISplit]> & {
|
|
12
13
|
killSplit(event: ISplitKillData): void;
|
|
13
14
|
};
|
|
@@ -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 MEMBERSHIPS_MS_UPDATE = "MEMBERSHIPS_MS_UPDATE";
|
|
23
|
+
export declare const MEMBERSHIPS_LS_UPDATE = "MEMBERSHIPS_LS_UPDATE";
|
|
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,4 +1,5 @@
|
|
|
1
|
-
import { Compression, KeyList } from './SSEHandler/types';
|
|
1
|
+
import { Compression, IMembershipMSUpdateData, KeyList } from './SSEHandler/types';
|
|
2
|
+
import { ISplit } from '../../dtos/types';
|
|
2
3
|
/**
|
|
3
4
|
* Decode, decompress and parse the provided 'data' into a KeyList object
|
|
4
5
|
*
|
|
@@ -28,8 +29,6 @@ export declare function parseBitmap(data: string, compression: Compression): Uin
|
|
|
28
29
|
export declare function isInBitmap(bitmap: Uint8Array, hash64hex: string): boolean;
|
|
29
30
|
/**
|
|
30
31
|
* Parse feature flags notifications for instant feature flag updates
|
|
31
|
-
*
|
|
32
|
-
* @param {ISplitUpdateData} data
|
|
33
|
-
* @returns {KeyList}
|
|
34
32
|
*/
|
|
35
|
-
export declare function parseFFUpdatePayload(compression: Compression, data: string):
|
|
33
|
+
export declare function parseFFUpdatePayload(compression: Compression, data: string): ISplit | undefined;
|
|
34
|
+
export declare function getDelay(parsedData: Pick<IMembershipMSUpdateData, 'i' | 'h' | 's'>, matchingKey: string): number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IMembershipMSUpdateData, IMembershipLSUpdateData, ISegmentUpdateData, ISplitUpdateData, ISplitKillData, INotificationData } 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 MEMBERSHIPS_MS_UPDATE = 'MEMBERSHIPS_MS_UPDATE';
|
|
11
|
+
export declare type MEMBERSHIPS_LS_UPDATE = 'MEMBERSHIPS_LS_UPDATE';
|
|
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 | MEMBERSHIPS_MS_UPDATE | MEMBERSHIPS_LS_UPDATE | SEGMENT_UPDATE | SPLIT_UPDATE | SPLIT_KILL | ControlType.STREAMING_RESET;
|
|
18
|
+
declare type IParsedData<T extends IPushEvent> = T extends MEMBERSHIPS_MS_UPDATE ? IMembershipMSUpdateData : T extends MEMBERSHIPS_LS_UPDATE ? IMembershipLSUpdateData : T extends SEGMENT_UPDATE ? ISegmentUpdateData : T extends SPLIT_UPDATE ? ISplitUpdateData : T extends SPLIT_KILL ? ISplitKillData : INotificationData;
|
|
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>) => void): this;
|
|
25
|
+
on<T extends IPushEvent>(event: T, listener: (parsedData: IParsedData<T>) => void): this;
|
|
26
|
+
emit<T extends IPushEvent>(event: T, parsedData?: IParsedData<T>): boolean;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* PushManager
|