@splitsoftware/splitio-commons 1.5.0 → 1.5.1-rc.2
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 +5 -0
- package/cjs/listeners/browser.js +35 -15
- package/cjs/services/splitApi.js +4 -4
- package/cjs/sync/polling/fetchers/segmentChangesFetcher.js +5 -5
- package/cjs/sync/polling/fetchers/splitChangesFetcher.js +2 -2
- package/cjs/sync/polling/updaters/segmentChangesUpdater.js +34 -34
- package/cjs/sync/polling/updaters/splitChangesUpdater.js +4 -3
- package/cjs/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +46 -46
- package/cjs/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +82 -64
- package/cjs/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +74 -58
- package/cjs/sync/streaming/UpdateWorkers/constants.js +6 -0
- package/cjs/sync/streaming/pushManager.js +6 -7
- package/cjs/sync/syncTask.js +13 -16
- package/cjs/utils/Backoff.js +3 -2
- package/esm/listeners/browser.js +35 -15
- package/esm/services/splitApi.js +4 -4
- package/esm/sync/polling/fetchers/segmentChangesFetcher.js +5 -5
- package/esm/sync/polling/fetchers/splitChangesFetcher.js +2 -2
- package/esm/sync/polling/updaters/segmentChangesUpdater.js +34 -34
- package/esm/sync/polling/updaters/splitChangesUpdater.js +4 -3
- package/esm/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +46 -47
- package/esm/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +82 -65
- package/esm/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +74 -59
- package/esm/sync/streaming/UpdateWorkers/constants.js +3 -0
- package/esm/sync/streaming/pushManager.js +6 -7
- package/esm/sync/syncTask.js +13 -16
- package/esm/utils/Backoff.js +3 -2
- package/package.json +1 -5
- package/src/listeners/browser.ts +34 -14
- package/src/logger/.DS_Store +0 -0
- package/src/services/splitApi.ts +4 -4
- package/src/services/types.ts +2 -2
- package/src/sync/polling/fetchers/segmentChangesFetcher.ts +5 -4
- package/src/sync/polling/fetchers/splitChangesFetcher.ts +2 -1
- package/src/sync/polling/fetchers/types.ts +2 -0
- package/src/sync/polling/pollingManagerCS.ts +5 -5
- package/src/sync/polling/syncTasks/mySegmentsSyncTask.ts +2 -2
- package/src/sync/polling/types.ts +14 -6
- package/src/sync/polling/updaters/mySegmentsUpdater.ts +4 -4
- package/src/sync/polling/updaters/segmentChangesUpdater.ts +34 -32
- package/src/sync/polling/updaters/splitChangesUpdater.ts +5 -4
- package/src/sync/streaming/SSEHandler/types.ts +0 -7
- package/src/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.ts +45 -54
- package/src/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.ts +78 -63
- package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +73 -61
- package/src/sync/streaming/UpdateWorkers/constants.ts +3 -0
- package/src/sync/streaming/UpdateWorkers/types.ts +2 -4
- package/src/sync/streaming/pushManager.ts +12 -12
- package/src/sync/streaming/types.ts +2 -2
- package/src/sync/syncTask.ts +16 -18
- package/src/utils/Backoff.ts +7 -2
- package/types/integrations/ga/GaToSplitPlugin.d.ts +3 -0
- package/types/integrations/ga/SplitToGaPlugin.d.ts +4 -0
- package/types/integrations/ga/autoRequire.d.ts +4 -0
- package/types/listeners/browser.d.ts +6 -6
- package/types/logger/browser/{DebugLogger.d.ts → debugLogger.d.ts} +0 -0
- package/types/logger/browser/{ErrorLogger.d.ts → errorLogger.d.ts} +0 -0
- package/types/logger/browser/{InfoLogger.d.ts → infoLogger.d.ts} +0 -0
- package/types/logger/browser/{WarnLogger.d.ts → warnLogger.d.ts} +0 -0
- package/types/logger/codes.d.ts +2 -0
- package/types/logger/codesConstants.d.ts +117 -0
- package/types/logger/codesConstantsBrowser.d.ts +2 -0
- package/types/logger/codesConstantsNode.d.ts +14 -0
- package/types/logger/codesDebug.d.ts +1 -0
- package/types/logger/codesDebugBrowser.d.ts +1 -0
- package/types/logger/codesDebugNode.d.ts +1 -0
- package/types/logger/codesError.d.ts +1 -0
- package/types/logger/codesErrorNode.d.ts +1 -0
- package/types/logger/codesInfo.d.ts +1 -0
- package/types/logger/codesWarn.d.ts +1 -0
- package/types/logger/codesWarnNode.d.ts +1 -0
- package/types/logger/debugLogger.d.ts +2 -0
- package/types/logger/errorLogger.d.ts +2 -0
- package/types/logger/infoLogger.d.ts +2 -0
- package/types/logger/messages/debugBrowser.d.ts +1 -0
- package/types/logger/messages/debugNode.d.ts +1 -0
- package/types/logger/messages/errorNode.d.ts +1 -0
- package/types/logger/messages/warnNode.d.ts +1 -0
- package/types/logger/noopLogger.d.ts +2 -0
- package/types/logger/warnLogger.d.ts +2 -0
- package/types/sdkFactory/userConsentProps.d.ts +6 -0
- package/types/sdkManager/sdkManagerMethod.d.ts +6 -0
- package/types/services/types.d.ts +2 -2
- package/types/storages/getRegisteredSegments.d.ts +10 -0
- package/types/storages/inMemory/index.d.ts +10 -0
- package/types/storages/parseSegments.d.ts +6 -0
- package/types/sync/polling/fetchers/types.d.ts +2 -2
- package/types/sync/polling/syncTasks/mySegmentsSyncTask.d.ts +2 -2
- package/types/sync/polling/syncTasks/splitsSyncTask.copy.d.ts +35 -0
- package/types/sync/polling/syncTasks/splitsSyncTask.morelikeoriginal.d.ts +35 -0
- package/types/sync/polling/types.d.ts +11 -6
- package/types/sync/polling/updaters/segmentChangesUpdater.d.ts +1 -1
- package/types/sync/polling/updaters/splitChangesUpdater.d.ts +1 -1
- package/types/sync/streaming/AuthClient/indexV1.d.ts +12 -0
- package/types/sync/streaming/AuthClient/indexV2.d.ts +8 -0
- package/types/sync/streaming/SSEHandler/types.d.ts +0 -4
- package/types/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.d.ts +3 -24
- package/types/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.d.ts +3 -23
- package/types/sync/streaming/UpdateWorkers/SplitsUpdateWorker.d.ts +6 -33
- package/types/sync/streaming/UpdateWorkers/constants.d.ts +3 -0
- package/types/sync/streaming/UpdateWorkers/types.d.ts +1 -2
- package/types/sync/streaming/pushManagerCS.d.ts +1 -0
- package/types/sync/streaming/pushManagerNoUsers.d.ts +13 -0
- package/types/sync/streaming/pushManagerSS.d.ts +1 -0
- package/types/sync/streaming/types.d.ts +2 -2
- package/types/sync/submitters/telemetrySyncTask.d.ts +0 -0
- package/types/sync/syncManagerFromFile.d.ts +2 -0
- package/types/sync/syncManagerFromObject.d.ts +2 -0
- package/types/sync/syncManagerOffline.d.ts +9 -0
- package/types/sync/syncTask.d.ts +2 -3
- package/types/trackers/telemetryRecorder.d.ts +0 -0
- package/types/utils/Backoff.d.ts +2 -0
- package/types/utils/EventEmitter.d.ts +4 -0
- package/types/utils/consent.d.ts +2 -0
- package/types/utils/lang/errors.d.ts +10 -0
- package/types/utils/murmur3/commons.d.ts +12 -0
- package/types/utils/settingsValidation/buildMetadata.d.ts +3 -0
- package/types/utils/settingsValidation/localhost/index.d.ts +9 -0
- package/types/utils/settingsValidation/logger.d.ts +11 -0
- package/types/utils/settingsValidation/runtime/browser.d.ts +2 -0
- package/types/utils/settingsValidation/runtime/node.d.ts +2 -0
- package/types/utils/settingsValidation/userConsent.d.ts +5 -0
- package/types/utils/timeTracker/index.d.ts +1 -70
- package/cjs/sync/offline/LocalhostFromFile.js +0 -13
- package/cjs/sync/offline/splitsParser/splitsParserFromFile.js +0 -151
- package/esm/sync/offline/LocalhostFromFile.js +0 -9
- package/esm/sync/offline/splitsParser/splitsParserFromFile.js +0 -146
- package/src/sync/offline/LocalhostFromFile.ts +0 -12
- package/src/sync/offline/splitsParser/splitsParserFromFile.ts +0 -182
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
export declare const DEBUG_0 = 0;
|
|
2
|
+
export declare const DEBUG_1 = 1;
|
|
3
|
+
export declare const DEBUG_2 = 2;
|
|
4
|
+
export declare const DEBUG_3 = 3;
|
|
5
|
+
export declare const DEBUG_4 = 4;
|
|
6
|
+
export declare const DEBUG_5 = 5;
|
|
7
|
+
export declare const DEBUG_6 = 6;
|
|
8
|
+
export declare const DEBUG_7 = 7;
|
|
9
|
+
export declare const DEBUG_8 = 8;
|
|
10
|
+
export declare const DEBUG_9 = 9;
|
|
11
|
+
export declare const DEBUG_10 = 10;
|
|
12
|
+
export declare const DEBUG_11 = 11;
|
|
13
|
+
export declare const DEBUG_12 = 12;
|
|
14
|
+
export declare const DEBUG_13 = 13;
|
|
15
|
+
export declare const DEBUG_14 = 14;
|
|
16
|
+
export declare const DEBUG_15 = 15;
|
|
17
|
+
export declare const DEBUG_16 = 16;
|
|
18
|
+
export declare const DEBUG_17 = 17;
|
|
19
|
+
export declare const DEBUG_18 = 18;
|
|
20
|
+
export declare const DEBUG_19 = 19;
|
|
21
|
+
export declare const DEBUG_20 = 20;
|
|
22
|
+
export declare const DEBUG_21 = 21;
|
|
23
|
+
export declare const DEBUG_22 = 22;
|
|
24
|
+
export declare const DEBUG_23 = 23;
|
|
25
|
+
export declare const DEBUG_24 = 24;
|
|
26
|
+
export declare const DEBUG_25 = 25;
|
|
27
|
+
export declare const DEBUG_31 = 31;
|
|
28
|
+
export declare const DEBUG_32 = 32;
|
|
29
|
+
export declare const DEBUG_33 = 33;
|
|
30
|
+
export declare const DEBUG_36 = 36;
|
|
31
|
+
export declare const DEBUG_42 = 42;
|
|
32
|
+
export declare const DEBUG_43 = 43;
|
|
33
|
+
export declare const DEBUG_44 = 44;
|
|
34
|
+
export declare const DEBUG_45 = 45;
|
|
35
|
+
export declare const DEBUG_46 = 46;
|
|
36
|
+
export declare const DEBUG_47 = 47;
|
|
37
|
+
export declare const DEBUG_48 = 48;
|
|
38
|
+
export declare const DEBUG_49 = 49;
|
|
39
|
+
export declare const DEBUG_50 = 50;
|
|
40
|
+
export declare const DEBUG_51 = 51;
|
|
41
|
+
export declare const INFO_0 = 100;
|
|
42
|
+
export declare const INFO_1 = 101;
|
|
43
|
+
export declare const INFO_2 = 102;
|
|
44
|
+
export declare const INFO_3 = 103;
|
|
45
|
+
export declare const INFO_4 = 104;
|
|
46
|
+
export declare const INFO_5 = 105;
|
|
47
|
+
export declare const INFO_6 = 106;
|
|
48
|
+
export declare const INFO_7 = 107;
|
|
49
|
+
export declare const INFO_8 = 108;
|
|
50
|
+
export declare const INFO_9 = 109;
|
|
51
|
+
export declare const INFO_10 = 110;
|
|
52
|
+
export declare const INFO_11 = 111;
|
|
53
|
+
export declare const INFO_12 = 112;
|
|
54
|
+
export declare const INFO_13 = 113;
|
|
55
|
+
export declare const INFO_14 = 114;
|
|
56
|
+
export declare const INFO_15 = 115;
|
|
57
|
+
export declare const INFO_16 = 116;
|
|
58
|
+
export declare const INFO_17 = 117;
|
|
59
|
+
export declare const INFO_18 = 118;
|
|
60
|
+
export declare const INFO_19 = 119;
|
|
61
|
+
export declare const INFO_20 = 120;
|
|
62
|
+
export declare const INFO_21 = 121;
|
|
63
|
+
export declare const WARN_0 = 200;
|
|
64
|
+
export declare const WARN_1 = 201;
|
|
65
|
+
export declare const WARN_2 = 202;
|
|
66
|
+
export declare const WARN_4 = 204;
|
|
67
|
+
export declare const WARN_5 = 205;
|
|
68
|
+
export declare const WARN_6 = 206;
|
|
69
|
+
export declare const WARN_7 = 207;
|
|
70
|
+
export declare const WARN_8 = 208;
|
|
71
|
+
export declare const WARN_9 = 209;
|
|
72
|
+
export declare const WARN_10 = 210;
|
|
73
|
+
export declare const WARN_11 = 211;
|
|
74
|
+
export declare const WARN_12 = 212;
|
|
75
|
+
export declare const WARN_13 = 213;
|
|
76
|
+
export declare const WARN_14 = 214;
|
|
77
|
+
export declare const WARN_15 = 215;
|
|
78
|
+
export declare const WARN_17 = 217;
|
|
79
|
+
export declare const WARN_18 = 218;
|
|
80
|
+
export declare const WARN_19 = 219;
|
|
81
|
+
export declare const WARN_20 = 220;
|
|
82
|
+
export declare const WARN_21 = 221;
|
|
83
|
+
export declare const WARN_22 = 222;
|
|
84
|
+
export declare const WARN_23 = 223;
|
|
85
|
+
export declare const WARN_24 = 224;
|
|
86
|
+
export declare const WARN_25 = 225;
|
|
87
|
+
export declare const ERROR_0 = 300;
|
|
88
|
+
export declare const ERROR_2 = 302;
|
|
89
|
+
export declare const ERROR_3 = 303;
|
|
90
|
+
export declare const ERROR_4 = 304;
|
|
91
|
+
export declare const ERROR_5 = 305;
|
|
92
|
+
export declare const ERROR_7 = 307;
|
|
93
|
+
export declare const ERROR_9 = 309;
|
|
94
|
+
export declare const ERROR_10 = 310;
|
|
95
|
+
export declare const ERROR_11 = 311;
|
|
96
|
+
export declare const ERROR_12 = 312;
|
|
97
|
+
export declare const ERROR_13 = 313;
|
|
98
|
+
export declare const ERROR_14 = 314;
|
|
99
|
+
export declare const ERROR_15 = 315;
|
|
100
|
+
export declare const ERROR_16 = 316;
|
|
101
|
+
export declare const ERROR_17 = 317;
|
|
102
|
+
export declare const ERROR_18 = 318;
|
|
103
|
+
export declare const ERROR_19 = 319;
|
|
104
|
+
export declare const ERROR_20 = 320;
|
|
105
|
+
export declare const ERROR_21 = 321;
|
|
106
|
+
export declare const ERROR_22 = 322;
|
|
107
|
+
export declare const ERROR_23 = 323;
|
|
108
|
+
export declare const ERROR_24 = 324;
|
|
109
|
+
export declare const ERROR_25 = 325;
|
|
110
|
+
export declare const ERROR_26 = 326;
|
|
111
|
+
export declare const ERROR_32 = 332;
|
|
112
|
+
export declare const ERROR_33 = 333;
|
|
113
|
+
export declare const ERROR_34 = 334;
|
|
114
|
+
export declare const ERROR_35 = 335;
|
|
115
|
+
export declare const ERROR_36 = 336;
|
|
116
|
+
export declare const ERROR_37 = 337;
|
|
117
|
+
export declare const ERROR_38 = 338;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const DEBUG_28 = 28;
|
|
2
|
+
export declare const DEBUG_29 = 29;
|
|
3
|
+
export declare const DEBUG_30 = 30;
|
|
4
|
+
export declare const ERROR_1 = 301;
|
|
5
|
+
export declare const DEBUG_39 = 39;
|
|
6
|
+
export declare const DEBUG_40 = 40;
|
|
7
|
+
export declare const DEBUG_41 = 41;
|
|
8
|
+
export declare const ERROR_8 = 308;
|
|
9
|
+
export declare const DEBUG_34 = 34;
|
|
10
|
+
export declare const DEBUG_35 = 35;
|
|
11
|
+
export declare const ERROR_6 = 306;
|
|
12
|
+
export declare const WARN_3 = 203;
|
|
13
|
+
export declare const DEBUG_37 = 37;
|
|
14
|
+
export declare const DEBUG_38 = 38;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const codesDebug: [number, string][];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const codesDebugBrowser: [number, string][];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const codesDebugNode: [number, string][];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const codesError: [number, string][];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const codesErrorNode: [number, string][];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const codesInfo: [number, string][];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const codesWarn: [number, string][];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const codesWarnNode: [number, string][];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const codesDebugBrowser: [number, string][];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const codesDebugNode: [number, string][];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const codesErrorNode: [number, string][];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const codesWarnNode: [number, string][];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ISyncManager } from '../sync/types';
|
|
2
|
+
import { ISettings } from '../types';
|
|
3
|
+
export declare function userConsentProps(settings: ISettings, syncManager?: ISyncManager): {
|
|
4
|
+
setUserConsent(consent: unknown): boolean;
|
|
5
|
+
getUserConsent(): import("../types").ConsentStatus | undefined;
|
|
6
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ISdkClientFactoryParams } from '../sdkClient/types';
|
|
2
|
+
import { SplitIO } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Factory of client method for server-side SDKs (ISDK and IAsyncSDK)
|
|
5
|
+
*/
|
|
6
|
+
export declare function sdkManagerMethodFactory(params: ISdkClientFactoryParams): () => SplitIO.IManager | SplitIO.IAsyncManager;
|
|
@@ -16,8 +16,8 @@ export declare type IFetch = (url: string, options?: IRequestOptions) => Promise
|
|
|
16
16
|
export declare type IHealthCheckAPI = () => Promise<boolean>;
|
|
17
17
|
export declare type ISplitHttpClient = (url: string, options?: IRequestOptions, latencyTracker?: (error?: NetworkError) => void, logErrorsAsInfo?: boolean) => Promise<IResponse>;
|
|
18
18
|
export declare type IFetchAuth = (userKeys?: string[]) => Promise<IResponse>;
|
|
19
|
-
export declare type IFetchSplitChanges = (since: number, noCache?: boolean) => Promise<IResponse>;
|
|
20
|
-
export declare type IFetchSegmentChanges = (since: number, segmentName: string, noCache?: boolean) => Promise<IResponse>;
|
|
19
|
+
export declare type IFetchSplitChanges = (since: number, noCache?: boolean, till?: number) => Promise<IResponse>;
|
|
20
|
+
export declare type IFetchSegmentChanges = (since: number, segmentName: string, noCache?: boolean, till?: number) => Promise<IResponse>;
|
|
21
21
|
export declare type IFetchMySegments = (userMatchingKey: string, noCache?: boolean) => Promise<IResponse>;
|
|
22
22
|
export declare type IPostEventsBulk = (body: string, headers?: Record<string, string>) => Promise<IResponse>;
|
|
23
23
|
export declare type IPostTestImpressionsBulk = (body: string, headers?: Record<string, string>) => Promise<IResponse>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ISplit } from '../dtos/types';
|
|
2
|
+
/**
|
|
3
|
+
* Collect segments from a raw split definition.
|
|
4
|
+
* Exported for testing purposes.
|
|
5
|
+
*/
|
|
6
|
+
export declare function _parseSegments({ conditions }: ISplit): import("../utils/lang/sets").ISet<string>;
|
|
7
|
+
/**
|
|
8
|
+
* Computes the set of segments used by splits.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getRegisteredSegments(splitDefs: string[]): string[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IStorageFactoryParams, IStorageSync } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* InMemory storage factory for standalone server-side SplitFactory
|
|
4
|
+
*
|
|
5
|
+
* @param params parameters required by EventsCacheSync
|
|
6
|
+
*/
|
|
7
|
+
export declare function InMemoryStorageFactory(params: IStorageFactoryParams): IStorageSync;
|
|
8
|
+
export declare namespace InMemoryStorageFactory {
|
|
9
|
+
var type: import("../types").StorageType;
|
|
10
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ISplitChangesResponse, ISegmentChangesResponse } from '../../../dtos/types';
|
|
2
2
|
import { IResponse } from '../../../services/types';
|
|
3
|
-
export declare type ISplitChangesFetcher = (since: number, noCache?: boolean, decorator?: (promise: Promise<IResponse>) => Promise<IResponse>) => Promise<ISplitChangesResponse>;
|
|
4
|
-
export declare type ISegmentChangesFetcher = (since: number, segmentName: string, noCache?: boolean, decorator?: (promise: Promise<ISegmentChangesResponse[]>) => Promise<ISegmentChangesResponse[]>) => Promise<ISegmentChangesResponse[]>;
|
|
3
|
+
export declare type ISplitChangesFetcher = (since: number, noCache?: boolean, till?: number, decorator?: (promise: Promise<IResponse>) => Promise<IResponse>) => Promise<ISplitChangesResponse>;
|
|
4
|
+
export declare type ISegmentChangesFetcher = (since: number, segmentName: string, noCache?: boolean, till?: number, decorator?: (promise: Promise<ISegmentChangesResponse[]>) => Promise<ISegmentChangesResponse[]>) => Promise<ISegmentChangesResponse[]>;
|
|
5
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
|
-
import {
|
|
3
|
+
import { IMySegmentsSyncTask } from '../types';
|
|
4
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(fetchMySegments: IFetchMySegments, storage: IStorageSync, readiness: IReadinessManager, settings: ISettings, matchingKey: string):
|
|
9
|
+
export declare function mySegmentsSyncTaskFactory(fetchMySegments: IFetchMySegments, storage: IStorageSync, readiness: IReadinessManager, settings: ISettings, matchingKey: string): IMySegmentsSyncTask;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ISet } from '../../../utils/lang/sets';
|
|
2
|
+
import { ISegmentsCacheSync, ISplitsCacheSync, IStorageSync } from '../../../storages/types';
|
|
3
|
+
import { ISplitChangesFetcher } from '../fetchers/types';
|
|
4
|
+
import { ISplit } from '../../../dtos/types';
|
|
5
|
+
import { IReadinessManager, ISplitsEventEmitter } from '../../../readiness/types';
|
|
6
|
+
import { ISplitsSyncTask } from '../types';
|
|
7
|
+
import { IFetchSplitChanges } from '../../../services/types';
|
|
8
|
+
import { ISettings } from '../../../types';
|
|
9
|
+
declare type ISplitChangesUpdater = (noCache?: boolean) => Promise<boolean>;
|
|
10
|
+
/**
|
|
11
|
+
* Collect segments from a raw split definition.
|
|
12
|
+
* Exported for testing purposes.
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseSegments({ conditions }: ISplit): ISet<string>;
|
|
15
|
+
interface ISplitMutations {
|
|
16
|
+
added: [string, string][];
|
|
17
|
+
removed: string[];
|
|
18
|
+
segments: string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Given the list of splits from /splitChanges endpoint, it returns the mutations,
|
|
22
|
+
* i.e., an object with added splits, removed splits and used segments.
|
|
23
|
+
* Exported for testing purposes.
|
|
24
|
+
*/
|
|
25
|
+
export declare function computeSplitsMutation(entries: ISplit[]): ISplitMutations;
|
|
26
|
+
/**
|
|
27
|
+
* factory of SplitChanges updater (a.k.a, SplitsSyncTask), a task that:
|
|
28
|
+
* - fetches split changes using `splitChangesFetcher`
|
|
29
|
+
* - updates `splitsCache`
|
|
30
|
+
* - uses `splitsEventEmitter` to emit events related to split data updates
|
|
31
|
+
* Exported for testing purposes.
|
|
32
|
+
*/
|
|
33
|
+
export declare function splitChangesUpdaterFactory(splitChangesFetcher: ISplitChangesFetcher, splitsCache: ISplitsCacheSync, segmentsCache: ISegmentsCacheSync, splitsEventEmitter: ISplitsEventEmitter, requestTimeoutBeforeReady: number, retriesOnFailureBeforeReady: number): ISplitChangesUpdater;
|
|
34
|
+
export default function splitsSyncTaskFactory(fetchSplitChanges: IFetchSplitChanges, storage: IStorageSync, readiness: IReadinessManager, settings: ISettings): ISplitsSyncTask;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ISet } from '../../../utils/lang/sets';
|
|
2
|
+
import { ISegmentsCacheSync, ISplitsCacheSync, IStorageSync } from '../../../storages/types';
|
|
3
|
+
import { ISplitChangesFetcher } from '../fetchers/types';
|
|
4
|
+
import { ISplit } from '../../../dtos/types';
|
|
5
|
+
import { IReadinessManager, ISplitsEventEmitter } from '../../../readiness/types';
|
|
6
|
+
import { ISplitsSyncTask } from '../types';
|
|
7
|
+
import { IFetchSplitChanges } from '../../../services/types';
|
|
8
|
+
import { ISettings } from '../../../types';
|
|
9
|
+
declare type ISplitChangesUpdater = (noCache?: boolean) => Promise<boolean>;
|
|
10
|
+
/**
|
|
11
|
+
* Collect segments from a raw split definition.
|
|
12
|
+
* Exported for testing purposes.
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseSegments({ conditions }: ISplit): ISet<string>;
|
|
15
|
+
interface ISplitMutations {
|
|
16
|
+
added: [string, string][];
|
|
17
|
+
removed: string[];
|
|
18
|
+
segments: string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Given the list of splits from /splitChanges endpoint, it returns the mutations,
|
|
22
|
+
* i.e., an object with added splits, removed splits and used segments.
|
|
23
|
+
* Exported for testing purposes.
|
|
24
|
+
*/
|
|
25
|
+
export declare function computeSplitsMutation(entries: ISplit[]): ISplitMutations;
|
|
26
|
+
/**
|
|
27
|
+
* factory of SplitChanges updater (a.k.a, SplitsSyncTask), a task that:
|
|
28
|
+
* - fetches split changes using `splitChangesFetcher`
|
|
29
|
+
* - updates `splitsCache`
|
|
30
|
+
* - uses `splitsEventEmitter` to emit events related to split data updates
|
|
31
|
+
* Exported for testing purposes.
|
|
32
|
+
*/
|
|
33
|
+
export declare function splitChangesUpdaterFactory(splitChangesFetcher: ISplitChangesFetcher, splitsCache: ISplitsCacheSync, segmentsCache: ISegmentsCacheSync, splitsEventEmitter: ISplitsEventEmitter, requestTimeoutBeforeReady: number, retriesOnFailureBeforeReady: number): ISplitChangesUpdater;
|
|
34
|
+
export default function splitsSyncTaskFactory(fetchSplitChanges: IFetchSplitChanges, storage: IStorageSync, readiness: IReadinessManager, settings: ISettings): ISplitsSyncTask;
|
|
35
|
+
export {};
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { IReadinessManager } from '../../readiness/types';
|
|
2
2
|
import { IStorageSync } from '../../storages/types';
|
|
3
|
-
import { SegmentsData } from '../streaming/SSEHandler/types';
|
|
4
3
|
import { ITask, ISyncTask } from '../types';
|
|
5
|
-
export interface ISplitsSyncTask extends ISyncTask<[noCache?: boolean], boolean> {
|
|
4
|
+
export interface ISplitsSyncTask extends ISyncTask<[noCache?: boolean, till?: number], boolean> {
|
|
6
5
|
}
|
|
7
|
-
export interface ISegmentsSyncTask extends ISyncTask<[
|
|
6
|
+
export interface ISegmentsSyncTask extends ISyncTask<[fetchOnlyNew?: boolean, segmentName?: string, noCache?: boolean, till?: number], boolean> {
|
|
7
|
+
}
|
|
8
|
+
export declare type MySegmentsData = string[] | {
|
|
9
|
+
name: string;
|
|
10
|
+
add: boolean;
|
|
11
|
+
};
|
|
12
|
+
export interface IMySegmentsSyncTask extends ISyncTask<[segmentsData?: MySegmentsData, noCache?: boolean], boolean> {
|
|
8
13
|
}
|
|
9
14
|
export interface IPollingManager extends ITask {
|
|
10
15
|
syncAll(): Promise<any>;
|
|
11
16
|
splitsSyncTask: ISplitsSyncTask;
|
|
12
|
-
segmentsSyncTask:
|
|
17
|
+
segmentsSyncTask: ISyncTask;
|
|
13
18
|
}
|
|
14
19
|
/**
|
|
15
20
|
* PollingManager for client-side with support for multiple clients
|
|
16
21
|
*/
|
|
17
22
|
export interface IPollingManagerCS extends IPollingManager {
|
|
18
|
-
add(matchingKey: string, readiness: IReadinessManager, storage: IStorageSync):
|
|
23
|
+
add(matchingKey: string, readiness: IReadinessManager, storage: IStorageSync): IMySegmentsSyncTask;
|
|
19
24
|
remove(matchingKey: string): void;
|
|
20
|
-
get(matchingKey: string):
|
|
25
|
+
get(matchingKey: string): IMySegmentsSyncTask | undefined;
|
|
21
26
|
}
|
|
@@ -2,7 +2,7 @@ import { ISegmentChangesFetcher } from '../fetchers/types';
|
|
|
2
2
|
import { ISegmentsCacheBase } from '../../../storages/types';
|
|
3
3
|
import { IReadinessManager } from '../../../readiness/types';
|
|
4
4
|
import { ILogger } from '../../../logger/types';
|
|
5
|
-
declare type ISegmentChangesUpdater = (
|
|
5
|
+
declare type ISegmentChangesUpdater = (fetchOnlyNew?: boolean, segmentName?: string, noCache?: boolean, till?: number) => Promise<boolean>;
|
|
6
6
|
/**
|
|
7
7
|
* Factory of SegmentChanges updater, a task that:
|
|
8
8
|
* - fetches segment changes using `segmentChangesFetcher`
|
|
@@ -4,7 +4,7 @@ import { ISplitChangesFetcher } from '../fetchers/types';
|
|
|
4
4
|
import { ISplit } from '../../../dtos/types';
|
|
5
5
|
import { ISplitsEventEmitter } from '../../../readiness/types';
|
|
6
6
|
import { ILogger } from '../../../logger/types';
|
|
7
|
-
declare type ISplitChangesUpdater = (noCache?: boolean) => Promise<boolean>;
|
|
7
|
+
declare type ISplitChangesUpdater = (noCache?: boolean, till?: number) => Promise<boolean>;
|
|
8
8
|
/**
|
|
9
9
|
* Collect segments from a raw split definition.
|
|
10
10
|
* Exported for testing purposes.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IFetchAuth } from '../../../services/types';
|
|
2
|
+
import { IAuthenticate } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Factory of authentication function.
|
|
5
|
+
*
|
|
6
|
+
* @param fetchAuth `SplitAPI.fetchAuth` endpoint
|
|
7
|
+
*/
|
|
8
|
+
export declare function authenticateFactory(fetchAuth: IFetchAuth): IAuthenticate;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the hash of a given user key
|
|
11
|
+
*/
|
|
12
|
+
export declare function hashUserKey(userKey: string): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IFetchAuthV2 } from '../../../services/types';
|
|
2
|
+
import { IAuthenticateV2 } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Factory of authentication function.
|
|
5
|
+
*
|
|
6
|
+
* @param fetchAuth `SplitAPI.fetchAuth` endpoint
|
|
7
|
+
*/
|
|
8
|
+
export declare function authenticateFactory(fetchAuthV2: IFetchAuthV2): IAuthenticateV2;
|
|
@@ -1,27 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Backoff } from '../../../utils/Backoff';
|
|
1
|
+
import { IMySegmentsSyncTask } from '../../polling/types';
|
|
3
2
|
import { IUpdateWorker } from './types';
|
|
4
|
-
import { SegmentsData } from '../SSEHandler/types';
|
|
5
3
|
/**
|
|
6
|
-
* MySegmentsUpdateWorker
|
|
4
|
+
* MySegmentsUpdateWorker factory
|
|
7
5
|
*/
|
|
8
|
-
export declare
|
|
9
|
-
private readonly mySegmentsSyncTask;
|
|
10
|
-
private maxChangeNumber;
|
|
11
|
-
private handleNewEvent;
|
|
12
|
-
private segmentsData?;
|
|
13
|
-
private currentChangeNumber;
|
|
14
|
-
readonly backoff: Backoff;
|
|
15
|
-
/**
|
|
16
|
-
* @param {Object} mySegmentsSyncTask task for syncing mySegments data
|
|
17
|
-
*/
|
|
18
|
-
constructor(mySegmentsSyncTask: ISegmentsSyncTask);
|
|
19
|
-
__handleMySegmentsUpdateCall(): void;
|
|
20
|
-
/**
|
|
21
|
-
* Invoked by NotificationProcessor on MY_SEGMENTS_UPDATE event
|
|
22
|
-
*
|
|
23
|
-
* @param {number} changeNumber change number of the MY_SEGMENTS_UPDATE notification
|
|
24
|
-
* @param {SegmentsData | undefined} segmentsData might be undefined
|
|
25
|
-
*/
|
|
26
|
-
put(changeNumber: number, segmentsData?: SegmentsData): void;
|
|
27
|
-
}
|
|
6
|
+
export declare function MySegmentsUpdateWorker(mySegmentsSyncTask: IMySegmentsSyncTask): IUpdateWorker;
|
|
@@ -1,28 +1,8 @@
|
|
|
1
|
+
import { ILogger } from '../../../logger/types';
|
|
1
2
|
import { ISegmentsCacheSync } from '../../../storages/types';
|
|
2
|
-
import { Backoff } from '../../../utils/Backoff';
|
|
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
|
|
10
|
-
private readonly segmentsCache;
|
|
11
|
-
private readonly segmentsSyncTask;
|
|
12
|
-
private readonly maxChangeNumbers;
|
|
13
|
-
private handleNewEvent;
|
|
14
|
-
readonly backoff: Backoff;
|
|
15
|
-
/**
|
|
16
|
-
* @param {Object} segmentsCache segments data cache
|
|
17
|
-
* @param {Object} segmentsSyncTask task for syncing segments data
|
|
18
|
-
*/
|
|
19
|
-
constructor(segmentsSyncTask: ISegmentsSyncTask, segmentsCache: ISegmentsCacheSync);
|
|
20
|
-
__handleSegmentUpdateCall(): void;
|
|
21
|
-
/**
|
|
22
|
-
* Invoked by NotificationProcessor on SEGMENT_UPDATE event
|
|
23
|
-
*
|
|
24
|
-
* @param {number} changeNumber change number of the SEGMENT_UPDATE notification
|
|
25
|
-
* @param {string} segmentName segment name of the SEGMENT_UPDATE notification
|
|
26
|
-
*/
|
|
27
|
-
put({ changeNumber, segmentName }: ISegmentUpdateData): void;
|
|
28
|
-
}
|
|
8
|
+
export declare function SegmentsUpdateWorker(log: ILogger, segmentsSyncTask: ISegmentsSyncTask, segmentsCache: ISegmentsCacheSync): IUpdateWorker;
|
|
@@ -1,39 +1,12 @@
|
|
|
1
|
+
import { ILogger } from '../../../logger/types';
|
|
1
2
|
import { ISplitsEventEmitter } from '../../../readiness/types';
|
|
2
3
|
import { ISplitsCacheSync } from '../../../storages/types';
|
|
3
|
-
import { Backoff } from '../../../utils/Backoff';
|
|
4
4
|
import { ISegmentsSyncTask, ISplitsSyncTask } from '../../polling/types';
|
|
5
|
-
import { ISplitKillData
|
|
5
|
+
import { ISplitKillData } from '../SSEHandler/types';
|
|
6
6
|
import { IUpdateWorker } from './types';
|
|
7
7
|
/**
|
|
8
|
-
* SplitsUpdateWorker
|
|
8
|
+
* SplitsUpdateWorker factory
|
|
9
9
|
*/
|
|
10
|
-
export declare
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
private readonly splitsEventEmitter;
|
|
14
|
-
private readonly segmentsSyncTask?;
|
|
15
|
-
private maxChangeNumber;
|
|
16
|
-
private handleNewEvent;
|
|
17
|
-
readonly backoff: Backoff;
|
|
18
|
-
/**
|
|
19
|
-
* @param {Object} splitsCache splits data cache
|
|
20
|
-
* @param {Object} splitsSyncTask task for syncing splits data
|
|
21
|
-
* @param {Object} splitsEventEmitter emitter for splits data events
|
|
22
|
-
*/
|
|
23
|
-
constructor(splitsCache: ISplitsCacheSync, splitsSyncTask: ISplitsSyncTask, splitsEventEmitter: ISplitsEventEmitter, segmentsSyncTask?: ISegmentsSyncTask);
|
|
24
|
-
__handleSplitUpdateCall(): void;
|
|
25
|
-
/**
|
|
26
|
-
* Invoked by NotificationProcessor on SPLIT_UPDATE event
|
|
27
|
-
*
|
|
28
|
-
* @param {number} changeNumber change number of the SPLIT_UPDATE notification
|
|
29
|
-
*/
|
|
30
|
-
put({ changeNumber }: Pick<ISplitUpdateData, 'changeNumber'>): void;
|
|
31
|
-
/**
|
|
32
|
-
* Invoked by NotificationProcessor on SPLIT_KILL event
|
|
33
|
-
*
|
|
34
|
-
* @param {number} changeNumber change number of the SPLIT_UPDATE notification
|
|
35
|
-
* @param {string} splitName name of split to kill
|
|
36
|
-
* @param {string} defaultTreatment default treatment value
|
|
37
|
-
*/
|
|
38
|
-
killSplit({ changeNumber, splitName, defaultTreatment }: ISplitKillData): void;
|
|
39
|
-
}
|
|
10
|
+
export declare function SplitsUpdateWorker(log: ILogger, splitsCache: ISplitsCacheSync, splitsSyncTask: ISplitsSyncTask, splitsEventEmitter: ISplitsEventEmitter, segmentsSyncTask?: ISegmentsSyncTask): IUpdateWorker & {
|
|
11
|
+
killSplit(event: ISplitKillData): void;
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pushManagerCSFactory: (params: import("../types").ISyncManagerFactoryParams, pollingManager: import("../polling/types").IPollingManager) => import("./types").IPushManager | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IPushManagerCS } from './types';
|
|
2
|
+
import { IStorageSync } from '../../storages/types';
|
|
3
|
+
import { IReadinessManager } from '../../readiness/types';
|
|
4
|
+
import { IPollingManager } from '../polling/types';
|
|
5
|
+
import { IFetchAuthV2 } from '../../services/types';
|
|
6
|
+
import { ISettings } from '../../types';
|
|
7
|
+
import { IPlatform } from '../../sdkFactory/types';
|
|
8
|
+
/**
|
|
9
|
+
* PushManager factory:
|
|
10
|
+
* - for server-side if key is not provided in settings.
|
|
11
|
+
* - for client-side, with support for multiple clients, if key is provided in settings
|
|
12
|
+
*/
|
|
13
|
+
export default function pushManagerFactory(pollingManager: IPollingManager, storage: IStorageSync, readiness: IReadinessManager, fetchAuthV2: IFetchAuthV2, platform: IPlatform, settings: ISettings): IPushManagerCS | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pushManagerSSFactory: (params: import("../types").ISyncManagerFactoryParams, pollingManager: import("../polling/types").IPollingManager) => import("./types").IPushManager | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IMySegmentsUpdateData, IMySegmentsUpdateV2Data, ISegmentUpdateData, ISplitUpdateData, ISplitKillData } from './SSEHandler/types';
|
|
2
2
|
import { ITask } from '../types';
|
|
3
|
-
import {
|
|
3
|
+
import { IMySegmentsSyncTask } from '../polling/types';
|
|
4
4
|
import { IEventEmitter } from '../../types';
|
|
5
5
|
import { ControlType } from './constants';
|
|
6
6
|
export declare type PUSH_SUBSYSTEM_UP = 'PUSH_SUBSYSTEM_UP';
|
|
@@ -29,7 +29,7 @@ export interface IPushEventEmitter extends IEventEmitter {
|
|
|
29
29
|
* PushManager
|
|
30
30
|
*/
|
|
31
31
|
export interface IPushManager extends ITask, IPushEventEmitter {
|
|
32
|
-
add(userKey: string, mySegmentsSyncTask:
|
|
32
|
+
add(userKey: string, mySegmentsSyncTask: IMySegmentsSyncTask): void;
|
|
33
33
|
remove(userKey: string): void;
|
|
34
34
|
}
|
|
35
35
|
export {};
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ISyncManagerCS, ISyncManagerFactoryParams } from './types';
|
|
2
|
+
import { ISplitsParser } from './offline/splitsParser/types';
|
|
3
|
+
/**
|
|
4
|
+
* Offline SyncManager factory.
|
|
5
|
+
* Can be used for server-side API, and client-side API with or without multiple clients.
|
|
6
|
+
*
|
|
7
|
+
* @param splitsParser e.g., `splitsParserFromFile`, `splitsParserFromSettings`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function syncManagerOfflineFactory(splitsParserFactory: () => ISplitsParser): (params: ISyncManagerFactoryParams) => ISyncManagerCS;
|