@splitsoftware/splitio-commons 1.16.1-rc.0 → 1.16.1-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.txt +4 -0
- package/cjs/logger/constants.js +5 -4
- package/cjs/logger/messages/info.js +2 -1
- package/cjs/logger/messages/warn.js +1 -1
- package/cjs/readiness/readinessManager.js +3 -9
- package/cjs/services/splitApi.js +4 -8
- package/cjs/storages/AbstractSegmentsCacheSync.js +1 -6
- package/cjs/storages/AbstractSplitsCacheAsync.js +2 -2
- package/cjs/storages/AbstractSplitsCacheSync.js +7 -5
- package/cjs/storages/KeyBuilder.js +0 -3
- package/cjs/storages/KeyBuilderCS.js +6 -0
- package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +23 -2
- package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +4 -16
- package/cjs/storages/inMemory/MySegmentsCacheInMemory.js +5 -1
- package/cjs/storages/inMemory/SplitsCacheInMemory.js +6 -15
- package/cjs/storages/pluggable/inMemoryWrapper.js +1 -1
- package/cjs/sync/polling/fetchers/mySegmentsFetcher.js +4 -7
- package/cjs/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
- package/cjs/sync/polling/pollingManagerCS.js +30 -54
- package/cjs/sync/polling/syncTasks/mySegmentsSyncTask.js +2 -2
- package/cjs/sync/polling/updaters/mySegmentsUpdater.js +25 -27
- package/cjs/sync/streaming/SSEHandler/index.js +7 -8
- package/cjs/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +18 -5
- package/cjs/sync/streaming/constants.js +2 -3
- package/cjs/sync/streaming/parseUtils.js +14 -9
- package/cjs/sync/streaming/pushManager.js +29 -53
- package/cjs/sync/submitters/telemetrySubmitter.js +0 -2
- package/cjs/sync/syncManagerOnline.js +14 -24
- package/cjs/utils/constants/index.js +1 -1
- package/cjs/utils/settingsValidation/index.js +1 -5
- package/esm/logger/constants.js +2 -1
- package/esm/logger/messages/info.js +2 -1
- package/esm/logger/messages/warn.js +1 -1
- package/esm/readiness/readinessManager.js +3 -9
- package/esm/services/splitApi.js +5 -9
- package/esm/storages/AbstractSegmentsCacheSync.js +1 -6
- package/esm/storages/AbstractSplitsCacheAsync.js +2 -2
- package/esm/storages/AbstractSplitsCacheSync.js +5 -3
- package/esm/storages/KeyBuilder.js +0 -3
- package/esm/storages/KeyBuilderCS.js +6 -0
- package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +23 -2
- package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +5 -17
- package/esm/storages/inMemory/MySegmentsCacheInMemory.js +5 -1
- package/esm/storages/inMemory/SplitsCacheInMemory.js +7 -16
- package/esm/storages/pluggable/inMemoryWrapper.js +1 -1
- package/esm/sync/polling/fetchers/mySegmentsFetcher.js +4 -7
- package/esm/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
- package/esm/sync/polling/pollingManagerCS.js +31 -55
- package/esm/sync/polling/syncTasks/mySegmentsSyncTask.js +2 -2
- package/esm/sync/polling/updaters/mySegmentsUpdater.js +23 -25
- package/esm/sync/streaming/SSEHandler/index.js +8 -9
- package/esm/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +18 -5
- package/esm/sync/streaming/constants.js +1 -2
- package/esm/sync/streaming/parseUtils.js +12 -8
- package/esm/sync/streaming/pushManager.js +31 -54
- package/esm/sync/submitters/telemetrySubmitter.js +0 -2
- package/esm/sync/syncManagerOnline.js +15 -25
- package/esm/utils/constants/index.js +1 -1
- package/esm/utils/settingsValidation/index.js +1 -5
- package/package.json +1 -1
- package/src/dtos/types.ts +14 -8
- package/src/logger/constants.ts +2 -1
- package/src/logger/messages/info.ts +2 -1
- package/src/logger/messages/warn.ts +1 -1
- package/src/readiness/readinessManager.ts +3 -7
- package/src/readiness/types.ts +0 -1
- package/src/services/splitApi.ts +6 -11
- package/src/services/splitHttpClient.ts +1 -1
- package/src/services/types.ts +2 -3
- package/src/storages/AbstractSegmentsCacheSync.ts +2 -6
- package/src/storages/AbstractSplitsCacheAsync.ts +2 -2
- package/src/storages/AbstractSplitsCacheSync.ts +6 -4
- package/src/storages/KeyBuilder.ts +0 -3
- package/src/storages/KeyBuilderCS.ts +9 -0
- package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +26 -2
- package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +5 -20
- package/src/storages/inMemory/MySegmentsCacheInMemory.ts +7 -1
- package/src/storages/inMemory/SplitsCacheInMemory.ts +7 -13
- package/src/storages/pluggable/inMemoryWrapper.ts +1 -1
- package/src/storages/types.ts +6 -5
- package/src/sync/polling/fetchers/mySegmentsFetcher.ts +7 -10
- package/src/sync/polling/fetchers/segmentChangesFetcher.ts +1 -1
- package/src/sync/polling/fetchers/types.ts +2 -2
- package/src/sync/polling/pollingManagerCS.ts +27 -62
- package/src/sync/polling/syncTasks/mySegmentsSyncTask.ts +11 -11
- package/src/sync/polling/types.ts +9 -8
- package/src/sync/polling/updaters/mySegmentsUpdater.ts +22 -24
- package/src/sync/streaming/SSEClient/index.ts +4 -6
- package/src/sync/streaming/SSEHandler/index.ts +11 -13
- package/src/sync/streaming/SSEHandler/types.ts +13 -25
- package/src/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.ts +21 -7
- 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 +1 -2
- package/src/sync/streaming/parseUtils.ts +19 -11
- package/src/sync/streaming/pushManager.ts +37 -65
- package/src/sync/streaming/types.ts +9 -11
- package/src/sync/submitters/telemetrySubmitter.ts +0 -2
- package/src/sync/submitters/types.ts +1 -3
- package/src/sync/syncManagerOnline.ts +11 -19
- package/src/types.ts +1 -26
- package/src/utils/constants/index.ts +1 -1
- package/src/utils/settingsValidation/index.ts +1 -5
- package/types/dtos/types.d.ts +14 -7
- package/types/logger/constants.d.ts +2 -1
- package/types/readiness/types.d.ts +0 -1
- package/types/services/decorateHeaders.d.ts +2 -0
- package/types/services/splitApi.d.ts +1 -1
- package/types/services/splitHttpClient.d.ts +1 -1
- package/types/services/types.d.ts +2 -3
- package/types/storages/AbstractSegmentsCacheSync.d.ts +2 -6
- package/types/storages/AbstractSplitsCacheAsync.d.ts +1 -1
- package/types/storages/AbstractSplitsCacheSync.d.ts +3 -3
- package/types/storages/KeyBuilder.d.ts +0 -1
- package/types/storages/KeyBuilderCS.d.ts +2 -0
- package/types/storages/inLocalStorage/MySegmentsCacheInLocal.d.ts +3 -2
- package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +1 -1
- package/types/storages/inMemory/MySegmentsCacheInMemory.d.ts +3 -1
- package/types/storages/inMemory/SplitsCacheInMemory.d.ts +1 -2
- package/types/storages/pluggable/inMemoryWrapper.d.ts +1 -1
- package/types/storages/types.d.ts +4 -4
- 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 +4 -3
- package/types/sync/polling/types.d.ts +7 -13
- package/types/sync/polling/updaters/mySegmentsUpdater.d.ts +3 -2
- package/types/sync/streaming/SSEHandler/types.d.ts +13 -22
- package/types/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.d.ts +2 -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 +1 -2
- package/types/sync/streaming/parseUtils.d.ts +4 -5
- package/types/sync/streaming/pushManager.d.ts +0 -2
- package/types/sync/streaming/pushManagerCS_Spec1_3.d.ts +9 -0
- package/types/sync/streaming/pushManager_Spec1_3.d.ts +9 -0
- package/types/sync/streaming/types.d.ts +8 -9
- package/types/sync/submitters/types.d.ts +1 -3
- package/types/types.d.ts +0 -25
- package/types/utils/constants/index.d.ts +1 -1
- package/types/utils/settingsValidation/index.d.ts +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IMySegmentsUpdateV3Data, ISegmentUpdateData, ISplitUpdateData, ISplitKillData, IMyLargeSegmentsUpdateData, INotificationData } from './SSEHandler/types';
|
|
2
2
|
import { ITask } from '../types';
|
|
3
3
|
import { IMySegmentsSyncTask } from '../polling/types';
|
|
4
4
|
import { IEventEmitter } from '../../types';
|
|
@@ -11,8 +11,7 @@ export type PUSH_NONRETRYABLE_ERROR = 'PUSH_NONRETRYABLE_ERROR'
|
|
|
11
11
|
export type PUSH_RETRYABLE_ERROR = 'PUSH_RETRYABLE_ERROR'
|
|
12
12
|
|
|
13
13
|
// Update-type push notifications, handled by NotificationProcessor
|
|
14
|
-
export type
|
|
15
|
-
export type MY_SEGMENTS_UPDATE_V2 = 'MY_SEGMENTS_UPDATE_V2';
|
|
14
|
+
export type MY_SEGMENTS_UPDATE_V3 = 'MY_SEGMENTS_UPDATE_V3';
|
|
16
15
|
export type SEGMENT_UPDATE = 'SEGMENT_UPDATE';
|
|
17
16
|
export type SPLIT_KILL = 'SPLIT_KILL';
|
|
18
17
|
export type SPLIT_UPDATE = 'SPLIT_UPDATE';
|
|
@@ -22,24 +21,23 @@ export type MY_LARGE_SEGMENTS_UPDATE = 'MY_LARGE_SEGMENTS_UPDATE';
|
|
|
22
21
|
export type CONTROL = 'CONTROL';
|
|
23
22
|
export type OCCUPANCY = 'OCCUPANCY';
|
|
24
23
|
|
|
25
|
-
export type IPushEvent = PUSH_SUBSYSTEM_UP | PUSH_SUBSYSTEM_DOWN | PUSH_NONRETRYABLE_ERROR | PUSH_RETRYABLE_ERROR |
|
|
24
|
+
export type IPushEvent = PUSH_SUBSYSTEM_UP | PUSH_SUBSYSTEM_DOWN | PUSH_NONRETRYABLE_ERROR | PUSH_RETRYABLE_ERROR | MY_SEGMENTS_UPDATE_V3 | SEGMENT_UPDATE | SPLIT_UPDATE | SPLIT_KILL | MY_LARGE_SEGMENTS_UPDATE | ControlType.STREAMING_RESET
|
|
26
25
|
|
|
27
26
|
type IParsedData<T extends IPushEvent> =
|
|
28
|
-
T extends
|
|
29
|
-
T extends MY_SEGMENTS_UPDATE_V2 ? IMySegmentsUpdateV2Data :
|
|
27
|
+
T extends MY_SEGMENTS_UPDATE_V3 ? IMySegmentsUpdateV3Data :
|
|
30
28
|
T extends MY_LARGE_SEGMENTS_UPDATE ? IMyLargeSegmentsUpdateData :
|
|
31
29
|
T extends SEGMENT_UPDATE ? ISegmentUpdateData :
|
|
32
30
|
T extends SPLIT_UPDATE ? ISplitUpdateData :
|
|
33
|
-
T extends SPLIT_KILL ? ISplitKillData :
|
|
31
|
+
T extends SPLIT_KILL ? ISplitKillData : INotificationData;
|
|
34
32
|
|
|
35
33
|
/**
|
|
36
34
|
* EventEmitter used as Feedback Loop between the SyncManager and PushManager,
|
|
37
35
|
* where the latter pushes messages and the former consumes it
|
|
38
36
|
*/
|
|
39
37
|
export interface IPushEventEmitter extends IEventEmitter {
|
|
40
|
-
once<T extends IPushEvent>(event: T, listener: (parsedData: IParsedData<T
|
|
41
|
-
on<T extends IPushEvent>(event: T, listener: (parsedData: IParsedData<T
|
|
42
|
-
emit<T extends IPushEvent>(event: T, parsedData?: IParsedData<T
|
|
38
|
+
once<T extends IPushEvent>(event: T, listener: (parsedData: IParsedData<T>) => void): this;
|
|
39
|
+
on<T extends IPushEvent>(event: T, listener: (parsedData: IParsedData<T>) => void): this;
|
|
40
|
+
emit<T extends IPushEvent>(event: T, parsedData?: IParsedData<T>): boolean;
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
/**
|
|
@@ -47,6 +45,6 @@ export interface IPushEventEmitter extends IEventEmitter {
|
|
|
47
45
|
*/
|
|
48
46
|
export interface IPushManager extends ITask, IPushEventEmitter {
|
|
49
47
|
// Methods used in client-side, to support multiple clients
|
|
50
|
-
add(userKey: string, mySegmentsSyncTask: IMySegmentsSyncTask
|
|
48
|
+
add(userKey: string, mySegmentsSyncTask: IMySegmentsSyncTask): void,
|
|
51
49
|
remove(userKey: string): void
|
|
52
50
|
}
|
|
@@ -76,12 +76,10 @@ export function telemetryCacheConfigAdapter(telemetry: ITelemetryCacheSync, sett
|
|
|
76
76
|
|
|
77
77
|
return objectAssign(getTelemetryConfigStats(settings.mode, settings.storage.type), {
|
|
78
78
|
sE: settings.streamingEnabled,
|
|
79
|
-
lE: isClientSide ? settings.sync.largeSegmentsEnabled : undefined,
|
|
80
79
|
rR: {
|
|
81
80
|
sp: scheduler.featuresRefreshRate / 1000,
|
|
82
81
|
se: isClientSide ? undefined : scheduler.segmentsRefreshRate / 1000,
|
|
83
82
|
ms: isClientSide ? scheduler.segmentsRefreshRate / 1000 : undefined,
|
|
84
|
-
mls: isClientSide && settings.sync.largeSegmentsEnabled ? scheduler.largeSegmentsRefreshRate / 1000 : undefined,
|
|
85
83
|
im: scheduler.impressionsRefreshRate / 1000,
|
|
86
84
|
ev: scheduler.eventsPushRate / 1000,
|
|
87
85
|
te: scheduler.telemetryRefreshRate / 1000,
|
|
@@ -114,7 +114,7 @@ export type TOKEN = 'to';
|
|
|
114
114
|
export type SEGMENT = 'se';
|
|
115
115
|
export type MY_SEGMENT = 'ms';
|
|
116
116
|
export type MY_LARGE_SEGMENT = 'mls';
|
|
117
|
-
export type OperationType = SPLITS | IMPRESSIONS | IMPRESSIONS_COUNT | EVENTS | TELEMETRY | TOKEN | SEGMENT | MY_SEGMENT
|
|
117
|
+
export type OperationType = SPLITS | IMPRESSIONS | IMPRESSIONS_COUNT | EVENTS | TELEMETRY | TOKEN | SEGMENT | MY_SEGMENT;
|
|
118
118
|
|
|
119
119
|
export type LastSync = Partial<Record<OperationType, number | undefined>>
|
|
120
120
|
export type HttpErrors = Partial<Record<OperationType, { [statusCode: string]: number }>>
|
|
@@ -205,7 +205,6 @@ export type RefreshRates = {
|
|
|
205
205
|
sp: number, // splits
|
|
206
206
|
se?: number, // segments
|
|
207
207
|
ms?: number, // mySegments
|
|
208
|
-
mls?: number, // myLargeSegments
|
|
209
208
|
im: number, // impressions
|
|
210
209
|
ev: number, // events
|
|
211
210
|
te: number, // telemetry
|
|
@@ -231,7 +230,6 @@ export type TelemetryConfigStats = {
|
|
|
231
230
|
// 'metrics/config' JSON request body
|
|
232
231
|
export type TelemetryConfigStatsPayload = TelemetryConfigStats & {
|
|
233
232
|
sE: boolean, // streamingEnabled
|
|
234
|
-
lE?: boolean, // largeSegmentsEnabled
|
|
235
233
|
rR: RefreshRates, // refreshRates
|
|
236
234
|
uO: UrlOverrides, // urlOverrides
|
|
237
235
|
iQ: number, // impressionsQueueSize
|
|
@@ -7,7 +7,7 @@ import { IPollingManager, IPollingManagerCS } from './polling/types';
|
|
|
7
7
|
import { PUSH_SUBSYSTEM_UP, PUSH_SUBSYSTEM_DOWN } from './streaming/constants';
|
|
8
8
|
import { SYNC_START_POLLING, SYNC_CONTINUE_POLLING, SYNC_STOP_POLLING } from '../logger/constants';
|
|
9
9
|
import { isConsentGranted } from '../consent';
|
|
10
|
-
import {
|
|
10
|
+
import { POLLING, STREAMING, SYNC_MODE_UPDATE } from '../utils/constants';
|
|
11
11
|
import { ISdkFactoryContextSync } from '../sdkFactory/types';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -141,44 +141,36 @@ export function syncManagerOnlineFactory(
|
|
|
141
141
|
shared(matchingKey: string, readinessManager: IReadinessManager, storage: IStorageSync) {
|
|
142
142
|
if (!pollingManager) return;
|
|
143
143
|
|
|
144
|
-
const
|
|
144
|
+
const mySegmentsSyncTask = (pollingManager as IPollingManagerCS).add(matchingKey, readinessManager, storage);
|
|
145
145
|
|
|
146
146
|
return {
|
|
147
|
-
isRunning:
|
|
147
|
+
isRunning: mySegmentsSyncTask.isRunning,
|
|
148
148
|
start() {
|
|
149
149
|
if (syncEnabled) {
|
|
150
150
|
if (pushManager) {
|
|
151
151
|
if (pollingManager!.isRunning()) {
|
|
152
152
|
// if doing polling, we must start the periodic fetch of data
|
|
153
|
-
if (storage.splits.
|
|
154
|
-
if (mlsSyncTask && storage.splits.usesMatcher(IN_LARGE_SEGMENT)) mlsSyncTask.start();
|
|
153
|
+
if (storage.splits.usesSegments()) mySegmentsSyncTask.start();
|
|
155
154
|
} else {
|
|
156
155
|
// if not polling, we must execute the sync task for the initial fetch
|
|
157
156
|
// of segments since `syncAll` was already executed when starting the main client
|
|
158
|
-
|
|
159
|
-
mlsSyncTask && mlsSyncTask.execute();
|
|
157
|
+
mySegmentsSyncTask.execute();
|
|
160
158
|
}
|
|
161
|
-
pushManager.add(matchingKey,
|
|
159
|
+
pushManager.add(matchingKey, mySegmentsSyncTask);
|
|
162
160
|
} else {
|
|
163
|
-
if (storage.splits.
|
|
164
|
-
if (mlsSyncTask && storage.splits.usesMatcher(IN_LARGE_SEGMENT)) mlsSyncTask.start();
|
|
161
|
+
if (storage.splits.usesSegments()) mySegmentsSyncTask.start();
|
|
165
162
|
}
|
|
166
163
|
} else {
|
|
167
|
-
if (!readinessManager.isReady())
|
|
168
|
-
msSyncTask.execute();
|
|
169
|
-
mlsSyncTask && mlsSyncTask.execute();
|
|
170
|
-
}
|
|
164
|
+
if (!readinessManager.isReady()) mySegmentsSyncTask.execute();
|
|
171
165
|
}
|
|
172
166
|
},
|
|
173
167
|
stop() {
|
|
174
168
|
// check in case `client.destroy()` has been invoked more than once for the same client
|
|
175
|
-
const
|
|
176
|
-
if (
|
|
177
|
-
const { msSyncTask, mlsSyncTask } = syncTasks;
|
|
169
|
+
const mySegmentsSyncTask = (pollingManager as IPollingManagerCS).get(matchingKey);
|
|
170
|
+
if (mySegmentsSyncTask) {
|
|
178
171
|
// stop syncing
|
|
179
172
|
if (pushManager) pushManager.remove(matchingKey);
|
|
180
|
-
if (
|
|
181
|
-
if (mlsSyncTask && mlsSyncTask.isRunning()) mlsSyncTask.stop();
|
|
173
|
+
if (mySegmentsSyncTask.isRunning()) mySegmentsSyncTask.stop();
|
|
182
174
|
|
|
183
175
|
(pollingManager as IPollingManagerCS).remove(matchingKey);
|
|
184
176
|
}
|
package/src/types.ts
CHANGED
|
@@ -86,7 +86,6 @@ export interface ISettings {
|
|
|
86
86
|
metricsRefreshRate?: number,
|
|
87
87
|
telemetryRefreshRate: number,
|
|
88
88
|
segmentsRefreshRate: number,
|
|
89
|
-
largeSegmentsRefreshRate: number,
|
|
90
89
|
offlineRefreshRate: number,
|
|
91
90
|
eventsPushRate: number,
|
|
92
91
|
eventsQueueSize: number,
|
|
@@ -96,8 +95,7 @@ export interface ISettings {
|
|
|
96
95
|
readyTimeout: number,
|
|
97
96
|
requestTimeoutBeforeReady: number,
|
|
98
97
|
retriesOnFailureBeforeReady: number,
|
|
99
|
-
eventsFirstPushWindow: number
|
|
100
|
-
waitForLargeSegments: boolean
|
|
98
|
+
eventsFirstPushWindow: number
|
|
101
99
|
},
|
|
102
100
|
readonly storage: IStorageSyncFactory | IStorageAsyncFactory,
|
|
103
101
|
readonly integrations: Array<{
|
|
@@ -121,7 +119,6 @@ export interface ISettings {
|
|
|
121
119
|
__splitFiltersValidation: ISplitFiltersValidation,
|
|
122
120
|
localhostMode?: SplitIO.LocalhostFactory,
|
|
123
121
|
enabled: boolean,
|
|
124
|
-
largeSegmentsEnabled: boolean,
|
|
125
122
|
flagSpecVersion: string
|
|
126
123
|
},
|
|
127
124
|
readonly runtime: {
|
|
@@ -816,13 +813,6 @@ export namespace SplitIO {
|
|
|
816
813
|
* @default 10
|
|
817
814
|
*/
|
|
818
815
|
eventsFirstPushWindow?: number,
|
|
819
|
-
/**
|
|
820
|
-
* Whether the SDK should wait for large segments to be ready before emitting SDK_READY event.
|
|
821
|
-
* It only applies if largeSegmentsEnabled is true.
|
|
822
|
-
* @property {number} waitForLargeSegments
|
|
823
|
-
* @default true
|
|
824
|
-
*/
|
|
825
|
-
waitForLargeSegments?: boolean
|
|
826
816
|
},
|
|
827
817
|
/**
|
|
828
818
|
* SDK scheduler settings.
|
|
@@ -867,13 +857,6 @@ export namespace SplitIO {
|
|
|
867
857
|
* @default 60
|
|
868
858
|
*/
|
|
869
859
|
segmentsRefreshRate?: number,
|
|
870
|
-
/**
|
|
871
|
-
* The SDK polls Split servers for changes to large segment definitions. This parameter controls this polling period in seconds.
|
|
872
|
-
* It only applies if largeSegmentsEnabled is true.
|
|
873
|
-
* @property {number} largeSegmentsRefreshRate
|
|
874
|
-
* @default 60
|
|
875
|
-
*/
|
|
876
|
-
largeSegmentsRefreshRate?: number,
|
|
877
860
|
/**
|
|
878
861
|
* The SDK posts the queued events data in bulks. This parameter controls the posting rate in seconds.
|
|
879
862
|
* @property {number} eventsPushRate
|
|
@@ -946,14 +929,6 @@ export namespace SplitIO {
|
|
|
946
929
|
* @property {Object} urls
|
|
947
930
|
*/
|
|
948
931
|
urls?: UrlSettings,
|
|
949
|
-
sync?: ISharedSettings['sync'] & {
|
|
950
|
-
/**
|
|
951
|
-
* Enables synchronization of large segments.
|
|
952
|
-
* @property {boolean} largeSegmentsEnabled
|
|
953
|
-
* @default false
|
|
954
|
-
*/
|
|
955
|
-
largeSegmentsEnabled?: boolean
|
|
956
|
-
}
|
|
957
932
|
}
|
|
958
933
|
/**
|
|
959
934
|
* Settings interface for SDK instances created on NodeJS.
|
|
@@ -32,8 +32,6 @@ export const base = {
|
|
|
32
32
|
featuresRefreshRate: 60,
|
|
33
33
|
// fetch segments updates each 60 sec
|
|
34
34
|
segmentsRefreshRate: 60,
|
|
35
|
-
// fetch large segments updates each 60 sec
|
|
36
|
-
largeSegmentsRefreshRate: 60,
|
|
37
35
|
// publish telemetry stats each 3600 secs (1 hour)
|
|
38
36
|
telemetryRefreshRate: 3600,
|
|
39
37
|
// publish evaluations each 300 sec (default value for OPTIMIZED impressions mode)
|
|
@@ -87,8 +85,7 @@ export const base = {
|
|
|
87
85
|
impressionsMode: OPTIMIZED,
|
|
88
86
|
localhostMode: undefined,
|
|
89
87
|
enabled: true,
|
|
90
|
-
flagSpecVersion: FLAG_SPEC_VERSION
|
|
91
|
-
largeSegmentsEnabled: false
|
|
88
|
+
flagSpecVersion: FLAG_SPEC_VERSION
|
|
92
89
|
},
|
|
93
90
|
|
|
94
91
|
// Logger
|
|
@@ -135,7 +132,6 @@ export function settingsValidation(config: unknown, validationParams: ISettingsV
|
|
|
135
132
|
const { scheduler, startup } = withDefaults;
|
|
136
133
|
scheduler.featuresRefreshRate = fromSecondsToMillis(scheduler.featuresRefreshRate);
|
|
137
134
|
scheduler.segmentsRefreshRate = fromSecondsToMillis(scheduler.segmentsRefreshRate);
|
|
138
|
-
scheduler.largeSegmentsRefreshRate = fromSecondsToMillis(scheduler.largeSegmentsRefreshRate);
|
|
139
135
|
scheduler.offlineRefreshRate = fromSecondsToMillis(scheduler.offlineRefreshRate);
|
|
140
136
|
scheduler.eventsPushRate = fromSecondsToMillis(scheduler.eventsPushRate);
|
|
141
137
|
scheduler.telemetryRefreshRate = fromSecondsToMillis(validateMinValue('telemetryRefreshRate', scheduler.telemetryRefreshRate, 60));
|
package/types/dtos/types.d.ts
CHANGED
|
@@ -177,13 +177,20 @@ export interface ISegmentChangesResponse {
|
|
|
177
177
|
since: number;
|
|
178
178
|
till: number;
|
|
179
179
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
180
|
+
/** Interface of the parsed JSON response of `/memberships/{userKey}` */
|
|
181
|
+
export interface IMembershipsResponse {
|
|
182
|
+
ms?: {
|
|
183
|
+
cn?: number;
|
|
184
|
+
k?: Array<{
|
|
185
|
+
n: string;
|
|
186
|
+
}>;
|
|
187
|
+
};
|
|
188
|
+
ls?: {
|
|
189
|
+
cn?: number;
|
|
190
|
+
k?: Array<{
|
|
191
|
+
n: string;
|
|
192
|
+
}>;
|
|
193
|
+
};
|
|
187
194
|
}
|
|
188
195
|
/** Metadata internal type for storages */
|
|
189
196
|
export interface IMetadata {
|
|
@@ -35,6 +35,7 @@ export declare const IMPRESSION = 102;
|
|
|
35
35
|
export declare const IMPRESSION_QUEUEING = 103;
|
|
36
36
|
export declare const NEW_SHARED_CLIENT = 104;
|
|
37
37
|
export declare const NEW_FACTORY = 105;
|
|
38
|
+
export declare const POLLING_SMART_PAUSING = 106;
|
|
38
39
|
export declare const POLLING_START = 107;
|
|
39
40
|
export declare const POLLING_STOP = 108;
|
|
40
41
|
export declare const SYNC_SPLITS_FETCH_RETRY = 109;
|
|
@@ -76,7 +77,7 @@ export declare const WARN_SPLITS_FILTER_IGNORED = 219;
|
|
|
76
77
|
export declare const WARN_SPLITS_FILTER_INVALID = 220;
|
|
77
78
|
export declare const WARN_SPLITS_FILTER_EMPTY = 221;
|
|
78
79
|
export declare const WARN_SDK_KEY = 222;
|
|
79
|
-
export declare const
|
|
80
|
+
export declare const STREAMING_PARSING_MY_SEGMENTS_UPDATE = 223;
|
|
80
81
|
export declare const STREAMING_PARSING_SPLIT_UPDATE = 224;
|
|
81
82
|
export declare const WARN_INVALID_FLAGSET = 225;
|
|
82
83
|
export declare const WARN_LOWERCASE_FLAGSET = 226;
|
|
@@ -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) => 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,8 +32,7 @@ export interface ISplitApi {
|
|
|
32
32
|
fetchAuth: IFetchAuth;
|
|
33
33
|
fetchSplitChanges: IFetchSplitChanges;
|
|
34
34
|
fetchSegmentChanges: IFetchSegmentChanges;
|
|
35
|
-
|
|
36
|
-
fetchMyLargeSegments: IFetchMySegments;
|
|
35
|
+
fetchMemberships: IFetchMemberships;
|
|
37
36
|
postEventsBulk: IPostEventsBulk;
|
|
38
37
|
postUniqueKeysBulkCs: IPostUniqueKeysBulkCs;
|
|
39
38
|
postUniqueKeysBulkSs: IPostUniqueKeysBulkSs;
|
|
@@ -43,14 +43,10 @@ export declare abstract class AbstractSegmentsCacheSync implements ISegmentsCach
|
|
|
43
43
|
* For client-side synchronizer: the method is not used.
|
|
44
44
|
*/
|
|
45
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.
|
|
49
|
-
*/
|
|
50
|
-
getChangeNumber(name: string): number;
|
|
46
|
+
abstract getChangeNumber(name: string): number;
|
|
51
47
|
/**
|
|
52
48
|
* For server-side synchronizer: the method is not used.
|
|
53
49
|
* For client-side synchronizer: reset the cache with the given list of segments.
|
|
54
50
|
*/
|
|
55
|
-
resetSegments(names: string[]): boolean;
|
|
51
|
+
resetSegments(names: string[], changeNumber?: number): boolean;
|
|
56
52
|
}
|
|
@@ -18,7 +18,7 @@ export declare abstract class AbstractSplitsCacheAsync implements ISplitsCacheAs
|
|
|
18
18
|
abstract getNamesByFlagSets(flagSets: string[]): Promise<ISet<string>[]>;
|
|
19
19
|
abstract trafficTypeExists(trafficType: string): Promise<boolean>;
|
|
20
20
|
abstract clear(): Promise<boolean | void>;
|
|
21
|
-
|
|
21
|
+
usesSegments(): Promise<boolean>;
|
|
22
22
|
/**
|
|
23
23
|
* Check if the splits information is already stored in cache.
|
|
24
24
|
* Noop, just keeping the interface. This is used by client-side implementations only.
|
|
@@ -17,7 +17,7 @@ export declare abstract class AbstractSplitsCacheSync implements ISplitsCacheSyn
|
|
|
17
17
|
getAll(): ISplit[];
|
|
18
18
|
abstract getSplitNames(): string[];
|
|
19
19
|
abstract trafficTypeExists(trafficType: string): boolean;
|
|
20
|
-
abstract
|
|
20
|
+
abstract usesSegments(): boolean;
|
|
21
21
|
abstract clear(): void;
|
|
22
22
|
/**
|
|
23
23
|
* Check if the splits information is already stored in cache. This data can be preloaded.
|
|
@@ -39,6 +39,6 @@ export declare abstract class AbstractSplitsCacheSync implements ISplitsCacheSyn
|
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Given a parsed split, it returns a boolean flagging if its conditions use segments matchers (rules & whitelists).
|
|
42
|
-
* This util is intended to simplify the implementation of `splitsCache::
|
|
42
|
+
* This util is intended to simplify the implementation of `splitsCache::usesSegments` method
|
|
43
43
|
*/
|
|
44
|
-
export declare function
|
|
44
|
+
export declare function usesSegments(split: ISplit): boolean;
|
|
@@ -10,7 +10,6 @@ export declare class KeyBuilder {
|
|
|
10
10
|
isSplitKey(key: string): boolean;
|
|
11
11
|
buildSplitKeyPrefix(): string;
|
|
12
12
|
buildSplitsWithSegmentCountKey(): string;
|
|
13
|
-
buildSplitsWithLargeSegmentCountKey(): string;
|
|
14
13
|
buildSegmentNameKey(segmentName: string): string;
|
|
15
14
|
buildSegmentTillKey(segmentName: string): string;
|
|
16
15
|
extractKey(builtKey: string): string;
|
|
@@ -3,6 +3,7 @@ export interface MySegmentsKeyBuilder {
|
|
|
3
3
|
buildSegmentNameKey(segmentName: string): string;
|
|
4
4
|
extractSegmentName(builtSegmentKeyName: string): string | undefined;
|
|
5
5
|
extractOldSegmentKey(builtSegmentKeyName: string): string | undefined;
|
|
6
|
+
buildTillKey(): string;
|
|
6
7
|
}
|
|
7
8
|
export declare class KeyBuilderCS extends KeyBuilder implements MySegmentsKeyBuilder {
|
|
8
9
|
protected readonly regexSplitsCacheKey: RegExp;
|
|
@@ -16,5 +17,6 @@ export declare class KeyBuilderCS extends KeyBuilder implements MySegmentsKeyBui
|
|
|
16
17
|
extractOldSegmentKey(builtSegmentKeyName: string): string | undefined;
|
|
17
18
|
buildLastUpdatedKey(): string;
|
|
18
19
|
isSplitsCacheKey(key: string): boolean;
|
|
20
|
+
buildTillKey(): string;
|
|
19
21
|
}
|
|
20
22
|
export declare function myLargeSegmentsKeyBuilder(prefix: string, matchingKey: string): MySegmentsKeyBuilder;
|
|
@@ -16,10 +16,11 @@ export declare class MySegmentsCacheInLocal extends AbstractSegmentsCacheSync {
|
|
|
16
16
|
/**
|
|
17
17
|
* Reset (update) the cached list of segments with the given list, removing and adding segments if necessary.
|
|
18
18
|
*
|
|
19
|
-
* @param {string[]}
|
|
19
|
+
* @param {string[]} names list of segment names
|
|
20
20
|
* @returns boolean indicating if the cache was updated (i.e., given list was different from the cached one)
|
|
21
21
|
*/
|
|
22
|
-
resetSegments(names: string[]): boolean;
|
|
22
|
+
resetSegments(names: string[], changeNumber?: number): boolean;
|
|
23
23
|
getRegisteredSegments(): string[];
|
|
24
24
|
getKeysCount(): number;
|
|
25
|
+
getChangeNumber(): number;
|
|
25
26
|
}
|
|
@@ -34,7 +34,7 @@ export declare class SplitsCacheInLocal extends AbstractSplitsCacheSync {
|
|
|
34
34
|
getChangeNumber(): number;
|
|
35
35
|
getSplitNames(): string[];
|
|
36
36
|
trafficTypeExists(trafficType: string): boolean;
|
|
37
|
-
|
|
37
|
+
usesSegments(): boolean;
|
|
38
38
|
/**
|
|
39
39
|
* Check if the splits information is already stored in browser LocalStorage.
|
|
40
40
|
* In this function we could add more code to check if the data is valid.
|
|
@@ -5,6 +5,7 @@ import { AbstractSegmentsCacheSync } from '../AbstractSegmentsCacheSync';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare class MySegmentsCacheInMemory extends AbstractSegmentsCacheSync {
|
|
7
7
|
private segmentCache;
|
|
8
|
+
private cn?;
|
|
8
9
|
clear(): void;
|
|
9
10
|
addToSegment(name: string): boolean;
|
|
10
11
|
removeFromSegment(name: string): boolean;
|
|
@@ -16,7 +17,8 @@ export declare class MySegmentsCacheInMemory extends AbstractSegmentsCacheSync {
|
|
|
16
17
|
* @param {string[]} names list of segment names
|
|
17
18
|
* @returns boolean indicating if the cache was updated (i.e., given list was different from the cached one)
|
|
18
19
|
*/
|
|
19
|
-
resetSegments(names: string[]): boolean;
|
|
20
|
+
resetSegments(names: string[], changeNumber?: number): boolean;
|
|
21
|
+
getChangeNumber(): number;
|
|
20
22
|
getRegisteredSegments(): string[];
|
|
21
23
|
getKeysCount(): number;
|
|
22
24
|
}
|
|
@@ -11,7 +11,6 @@ export declare class SplitsCacheInMemory extends AbstractSplitsCacheSync {
|
|
|
11
11
|
private ttCache;
|
|
12
12
|
private changeNumber;
|
|
13
13
|
private segmentsCount;
|
|
14
|
-
private largeSegmentsCount;
|
|
15
14
|
private flagSetsCache;
|
|
16
15
|
constructor(splitFiltersValidation?: ISplitFiltersValidation);
|
|
17
16
|
clear(): void;
|
|
@@ -22,7 +21,7 @@ export declare class SplitsCacheInMemory extends AbstractSplitsCacheSync {
|
|
|
22
21
|
getChangeNumber(): number;
|
|
23
22
|
getSplitNames(): string[];
|
|
24
23
|
trafficTypeExists(trafficType: string): boolean;
|
|
25
|
-
|
|
24
|
+
usesSegments(): boolean;
|
|
26
25
|
getNamesByFlagSets(flagSets: string[]): ISet<string>[];
|
|
27
26
|
private addToFlagSets;
|
|
28
27
|
private removeFromFlagSets;
|
|
@@ -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>>;
|
|
@@ -189,7 +189,7 @@ export interface ISplitsCacheBase {
|
|
|
189
189
|
getAll(): MaybeThenable<ISplit[]>;
|
|
190
190
|
getSplitNames(): MaybeThenable<string[]>;
|
|
191
191
|
trafficTypeExists(trafficType: string): MaybeThenable<boolean>;
|
|
192
|
-
|
|
192
|
+
usesSegments(): MaybeThenable<boolean>;
|
|
193
193
|
clear(): MaybeThenable<boolean | void>;
|
|
194
194
|
checkCache(): MaybeThenable<boolean>;
|
|
195
195
|
killLocally(name: string, defaultTreatment: string, changeNumber: number): MaybeThenable<boolean>;
|
|
@@ -205,7 +205,7 @@ export interface ISplitsCacheSync extends ISplitsCacheBase {
|
|
|
205
205
|
getAll(): ISplit[];
|
|
206
206
|
getSplitNames(): string[];
|
|
207
207
|
trafficTypeExists(trafficType: string): boolean;
|
|
208
|
-
|
|
208
|
+
usesSegments(): boolean;
|
|
209
209
|
clear(): void;
|
|
210
210
|
checkCache(): boolean;
|
|
211
211
|
killLocally(name: string, defaultTreatment: string, changeNumber: number): boolean;
|
|
@@ -221,7 +221,7 @@ export interface ISplitsCacheAsync extends ISplitsCacheBase {
|
|
|
221
221
|
getAll(): Promise<ISplit[]>;
|
|
222
222
|
getSplitNames(): Promise<string[]>;
|
|
223
223
|
trafficTypeExists(trafficType: string): Promise<boolean>;
|
|
224
|
-
|
|
224
|
+
usesSegments(): Promise<boolean>;
|
|
225
225
|
clear(): Promise<boolean | void>;
|
|
226
226
|
checkCache(): Promise<boolean>;
|
|
227
227
|
killLocally(name: string, defaultTreatment: string, changeNumber: number): Promise<boolean>;
|
|
@@ -247,7 +247,7 @@ export interface ISegmentsCacheSync extends ISegmentsCacheBase {
|
|
|
247
247
|
getKeysCount(): number;
|
|
248
248
|
setChangeNumber(name: string, changeNumber: number): boolean;
|
|
249
249
|
getChangeNumber(name: string): number;
|
|
250
|
-
resetSegments(names: string[]): boolean;
|
|
250
|
+
resetSegments(names: string[], changeNumber?: number): boolean;
|
|
251
251
|
clear(): void;
|
|
252
252
|
}
|
|
253
253
|
export interface ISegmentsCacheAsync extends ISegmentsCacheBase {
|
|
@@ -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, decorator?: (promise: Promise<IResponse>) => Promise<IResponse>) => Promise<IMembershipsResponse>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IStorageSync } from '../../../storages/types';
|
|
2
|
+
import { IReadinessManager } from '../../../readiness/types';
|
|
2
3
|
import { IMySegmentsSyncTask } from '../types';
|
|
3
|
-
import {
|
|
4
|
+
import { IFetchMemberships } from '../../../services/types';
|
|
4
5
|
import { ISettings } from '../../../types';
|
|
5
6
|
/**
|
|
6
7
|
* Creates a sync task that periodically executes a `mySegmentsUpdater` task
|
|
7
8
|
*/
|
|
8
|
-
export declare function mySegmentsSyncTaskFactory(
|
|
9
|
+
export declare function mySegmentsSyncTaskFactory(fetchMemberships: IFetchMemberships, storage: IStorageSync, readiness: IReadinessManager, settings: ISettings, matchingKey: string): IMySegmentsSyncTask;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ISplit } from '../../dtos/types';
|
|
1
|
+
import { IMembershipsResponse, ISplit } from '../../dtos/types';
|
|
2
2
|
import { IReadinessManager } from '../../readiness/types';
|
|
3
3
|
import { IStorageSync } from '../../storages/types';
|
|
4
4
|
import { ITask, ISyncTask } from '../types';
|
|
@@ -9,29 +9,23 @@ export interface ISplitsSyncTask extends ISyncTask<[noCache?: boolean, till?: nu
|
|
|
9
9
|
}
|
|
10
10
|
export interface ISegmentsSyncTask extends ISyncTask<[fetchOnlyNew?: boolean, segmentName?: string, noCache?: boolean, till?: number], boolean> {
|
|
11
11
|
}
|
|
12
|
-
export declare type MySegmentsData =
|
|
12
|
+
export declare type MySegmentsData = IMembershipsResponse | {
|
|
13
|
+
isLS?: boolean;
|
|
13
14
|
name: string;
|
|
14
15
|
add: boolean;
|
|
15
|
-
};
|
|
16
|
-
export interface IMySegmentsSyncTask extends ISyncTask<[segmentsData?: MySegmentsData, noCache?: boolean
|
|
16
|
+
}[];
|
|
17
|
+
export interface IMySegmentsSyncTask extends ISyncTask<[segmentsData?: MySegmentsData, noCache?: boolean], boolean> {
|
|
17
18
|
}
|
|
18
19
|
export interface IPollingManager extends ITask {
|
|
19
20
|
syncAll(): Promise<any>;
|
|
20
21
|
splitsSyncTask: ISplitsSyncTask;
|
|
21
22
|
segmentsSyncTask: ISyncTask;
|
|
22
|
-
largeSegmentsSyncTask?: ISyncTask;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* PollingManager for client-side with support for multiple clients
|
|
26
26
|
*/
|
|
27
27
|
export interface IPollingManagerCS extends IPollingManager {
|
|
28
|
-
add(matchingKey: string, readiness: IReadinessManager, storage: IStorageSync):
|
|
29
|
-
msSyncTask: IMySegmentsSyncTask;
|
|
30
|
-
mlsSyncTask?: IMySegmentsSyncTask;
|
|
31
|
-
};
|
|
28
|
+
add(matchingKey: string, readiness: IReadinessManager, storage: IStorageSync): IMySegmentsSyncTask;
|
|
32
29
|
remove(matchingKey: string): void;
|
|
33
|
-
get(matchingKey: string):
|
|
34
|
-
msSyncTask: IMySegmentsSyncTask;
|
|
35
|
-
mlsSyncTask?: IMySegmentsSyncTask;
|
|
36
|
-
} | undefined;
|
|
30
|
+
get(matchingKey: string): IMySegmentsSyncTask | undefined;
|
|
37
31
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IMySegmentsFetcher } from '../fetchers/types';
|
|
2
|
-
import {
|
|
2
|
+
import { IStorageSync } from '../../../storages/types';
|
|
3
|
+
import { ISegmentsEventEmitter } from '../../../readiness/types';
|
|
3
4
|
import { ILogger } from '../../../logger/types';
|
|
4
5
|
import { MySegmentsData } from '../types';
|
|
5
6
|
declare type IMySegmentsUpdater = (segmentList?: MySegmentsData, noCache?: boolean) => Promise<boolean>;
|
|
@@ -9,5 +10,5 @@ declare type IMySegmentsUpdater = (segmentList?: MySegmentsData, noCache?: boole
|
|
|
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 {};
|