@splitsoftware/splitio-commons 1.16.1-rc.1 → 1.16.1-rc.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.txt +4 -0
- package/cjs/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 +7 -12
- package/cjs/services/splitApi.js +5 -9
- package/cjs/storages/AbstractSegmentsCacheSync.js +41 -12
- 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/dataLoader.js +1 -1
- package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +29 -52
- package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +4 -16
- package/cjs/storages/inMemory/MySegmentsCacheInMemory.js +9 -40
- package/cjs/storages/inMemory/SplitsCacheInMemory.js +6 -15
- package/cjs/sync/polling/fetchers/mySegmentsFetcher.js +4 -11
- package/cjs/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
- package/cjs/sync/polling/pollingManagerCS.js +33 -51
- package/cjs/sync/polling/syncTasks/mySegmentsSyncTask.js +2 -2
- package/cjs/sync/polling/updaters/mySegmentsUpdater.js +14 -20
- package/cjs/sync/streaming/AuthClient/index.js +1 -1
- package/cjs/sync/streaming/SSEHandler/index.js +3 -6
- package/cjs/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +15 -9
- package/cjs/sync/streaming/constants.js +3 -4
- package/cjs/sync/streaming/parseUtils.js +14 -9
- package/cjs/sync/streaming/pushManager.js +29 -55
- package/cjs/sync/submitters/telemetrySubmitter.js +0 -2
- package/cjs/sync/syncManagerOnline.js +14 -24
- package/cjs/utils/constants/index.js +4 -5
- 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 +7 -12
- package/esm/services/splitApi.js +6 -10
- package/esm/storages/AbstractSegmentsCacheSync.js +41 -12
- 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/dataLoader.js +1 -1
- package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +29 -52
- package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +5 -17
- package/esm/storages/inMemory/MySegmentsCacheInMemory.js +9 -40
- package/esm/storages/inMemory/SplitsCacheInMemory.js +7 -16
- package/esm/sync/polling/fetchers/mySegmentsFetcher.js +4 -11
- package/esm/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
- package/esm/sync/polling/pollingManagerCS.js +34 -52
- package/esm/sync/polling/syncTasks/mySegmentsSyncTask.js +2 -2
- package/esm/sync/polling/updaters/mySegmentsUpdater.js +12 -18
- package/esm/sync/streaming/AuthClient/index.js +1 -1
- package/esm/sync/streaming/SSEHandler/index.js +4 -7
- package/esm/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +15 -9
- package/esm/sync/streaming/constants.js +2 -3
- package/esm/sync/streaming/parseUtils.js +12 -8
- package/esm/sync/streaming/pushManager.js +32 -57
- package/esm/sync/submitters/telemetrySubmitter.js +0 -2
- package/esm/sync/syncManagerOnline.js +15 -25
- package/esm/utils/constants/index.js +2 -3
- package/esm/utils/settingsValidation/index.js +1 -5
- package/package.json +1 -1
- package/src/dtos/types.ts +7 -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 +7 -9
- package/src/readiness/types.ts +0 -1
- package/src/services/splitApi.ts +7 -12
- package/src/services/splitHttpClient.ts +1 -1
- package/src/services/types.ts +2 -3
- package/src/storages/AbstractSegmentsCacheSync.ts +53 -12
- package/src/storages/AbstractSplitsCacheAsync.ts +2 -2
- package/src/storages/AbstractSplitsCacheSync.ts +7 -5
- package/src/storages/KeyBuilder.ts +0 -3
- package/src/storages/KeyBuilderCS.ts +9 -0
- package/src/storages/dataLoader.ts +1 -1
- package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +26 -56
- package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +5 -20
- package/src/storages/inMemory/MySegmentsCacheInMemory.ts +10 -44
- package/src/storages/inMemory/SplitsCacheInMemory.ts +7 -13
- package/src/storages/types.ts +10 -8
- package/src/sync/polling/fetchers/mySegmentsFetcher.ts +7 -14
- package/src/sync/polling/fetchers/segmentChangesFetcher.ts +1 -1
- package/src/sync/polling/fetchers/types.ts +2 -2
- package/src/sync/polling/pollingManagerCS.ts +29 -61
- package/src/sync/polling/syncTasks/mySegmentsSyncTask.ts +12 -13
- package/src/sync/polling/types.ts +8 -8
- package/src/sync/polling/updaters/mySegmentsUpdater.ts +17 -18
- 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 -9
- package/src/sync/streaming/SSEHandler/types.ts +13 -25
- package/src/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.ts +17 -12
- 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 -3
- package/src/sync/streaming/parseUtils.ts +19 -11
- package/src/sync/streaming/pushManager.ts +38 -68
- package/src/sync/streaming/types.ts +11 -13
- package/src/sync/submitters/telemetrySubmitter.ts +0 -2
- package/src/sync/submitters/types.ts +3 -6
- package/src/sync/syncManagerOnline.ts +11 -19
- package/src/types.ts +1 -26
- package/src/utils/constants/index.ts +2 -3
- package/src/utils/settingsValidation/index.ts +1 -5
- package/types/dtos/types.d.ts +7 -8
- 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 +9 -11
- package/types/storages/AbstractSplitsCacheAsync.d.ts +1 -1
- package/types/storages/AbstractSplitsCacheSync.d.ts +4 -4
- package/types/storages/KeyBuilder.d.ts +0 -1
- package/types/storages/KeyBuilderCS.d.ts +2 -0
- package/types/storages/inLocalStorage/MySegmentsCacheInLocal.d.ts +2 -12
- package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +1 -1
- package/types/storages/inMemory/MySegmentsCacheInMemory.d.ts +3 -9
- package/types/storages/inMemory/SplitsCacheInMemory.d.ts +1 -2
- package/types/storages/types.d.ts +8 -7
- 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 +8 -12
- 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 -3
- 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 -3
- 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 +9 -10
- package/types/sync/submitters/types.d.ts +3 -6
- package/types/types.d.ts +0 -25
- package/types/utils/constants/index.d.ts +2 -3
- package/types/utils/settingsValidation/index.d.ts +0 -2
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { algorithms } from '../../utils/decompress';
|
|
2
2
|
import { decodeFromBase64 } from '../../utils/base64';
|
|
3
|
-
import {
|
|
3
|
+
import { hash } from '../../utils/murmur3/murmur3';
|
|
4
|
+
import { Compression, IMembershipMSUpdateData, KeyList } from './SSEHandler/types';
|
|
5
|
+
import { ISplit } from '../../dtos/types';
|
|
4
6
|
|
|
5
7
|
const GZIP = 1;
|
|
6
8
|
const ZLIB = 2;
|
|
@@ -42,7 +44,7 @@ function decompress(data: string, compression: Compression) {
|
|
|
42
44
|
* @returns {{a?: string[], r?: string[] }}
|
|
43
45
|
* @throws if data string cannot be decoded, decompressed or parsed
|
|
44
46
|
*/
|
|
45
|
-
export function parseKeyList(data: string, compression: Compression, avoidPrecisionLoss
|
|
47
|
+
export function parseKeyList(data: string, compression: Compression, avoidPrecisionLoss = true): KeyList {
|
|
46
48
|
const binKeyList = decompress(data, compression);
|
|
47
49
|
let strKeyList = Uint8ArrayToString(binKeyList);
|
|
48
50
|
// replace numbers to strings, to avoid losing precision
|
|
@@ -80,14 +82,20 @@ export function isInBitmap(bitmap: Uint8Array, hash64hex: string) {
|
|
|
80
82
|
|
|
81
83
|
/**
|
|
82
84
|
* Parse feature flags notifications for instant feature flag updates
|
|
83
|
-
*
|
|
84
|
-
* @param {ISplitUpdateData} data
|
|
85
|
-
* @returns {KeyList}
|
|
86
85
|
*/
|
|
87
|
-
export function parseFFUpdatePayload(compression: Compression, data: string):
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
export function parseFFUpdatePayload(compression: Compression, data: string): ISplit | undefined {
|
|
87
|
+
return compression > 0 ?
|
|
88
|
+
parseKeyList(data, compression, false) :
|
|
89
|
+
JSON.parse(decodeFromBase64(data));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const DEFAULT_MAX_INTERVAL = 60000;
|
|
93
|
+
|
|
94
|
+
export function getDelay(parsedData: Pick<IMembershipMSUpdateData, 'i' | 'h' | 's'>, matchingKey: string) {
|
|
95
|
+
if (parsedData.h === 0) return 0;
|
|
96
|
+
|
|
97
|
+
const interval = parsedData.i || DEFAULT_MAX_INTERVAL;
|
|
98
|
+
const seed = parsedData.s || 0;
|
|
99
|
+
|
|
100
|
+
return hash(matchingKey, seed) % interval;
|
|
93
101
|
}
|
|
@@ -11,24 +11,15 @@ import { authenticateFactory, hashUserKey } from './AuthClient';
|
|
|
11
11
|
import { forOwn } from '../../utils/lang';
|
|
12
12
|
import { SSEClient } from './SSEClient';
|
|
13
13
|
import { getMatching } from '../../utils/key';
|
|
14
|
-
import {
|
|
15
|
-
import { STREAMING_FALLBACK, STREAMING_REFRESH_TOKEN, STREAMING_CONNECTING, STREAMING_DISABLED, ERROR_STREAMING_AUTH, STREAMING_DISCONNECTING, STREAMING_RECONNECT,
|
|
16
|
-
import {
|
|
17
|
-
import { isInBitmap, parseBitmap, parseFFUpdatePayload, parseKeyList } from './parseUtils';
|
|
14
|
+
import { MEMBERSHIP_MS_UPDATE, MEMBERSHIP_LS_UPDATE, PUSH_NONRETRYABLE_ERROR, PUSH_SUBSYSTEM_DOWN, SECONDS_BEFORE_EXPIRATION, SEGMENT_UPDATE, SPLIT_KILL, SPLIT_UPDATE, PUSH_RETRYABLE_ERROR, PUSH_SUBSYSTEM_UP, ControlType } from './constants';
|
|
15
|
+
import { STREAMING_FALLBACK, STREAMING_REFRESH_TOKEN, STREAMING_CONNECTING, STREAMING_DISABLED, ERROR_STREAMING_AUTH, STREAMING_DISCONNECTING, STREAMING_RECONNECT, STREAMING_PARSING_MEMBERSHIP_UPDATE, STREAMING_PARSING_SPLIT_UPDATE } from '../../logger/constants';
|
|
16
|
+
import { IMembershipMSUpdateData, IMembershipLSUpdateData, KeyList, UpdateStrategy } from './SSEHandler/types';
|
|
17
|
+
import { getDelay, isInBitmap, parseBitmap, parseFFUpdatePayload, parseKeyList } from './parseUtils';
|
|
18
18
|
import { ISet, _Set } from '../../utils/lang/sets';
|
|
19
|
-
import { hash } from '../../utils/murmur3/murmur3';
|
|
20
19
|
import { Hash64, hash64 } from '../../utils/murmur3/murmur3_64';
|
|
21
20
|
import { IAuthTokenPushEnabled } from './AuthClient/types';
|
|
22
|
-
import { TOKEN_REFRESH, AUTH_REJECTION
|
|
21
|
+
import { TOKEN_REFRESH, AUTH_REJECTION } from '../../utils/constants';
|
|
23
22
|
import { ISdkFactoryContextSync } from '../../sdkFactory/types';
|
|
24
|
-
import { IUpdateWorker } from './UpdateWorkers/types';
|
|
25
|
-
|
|
26
|
-
export function getDelay(parsedData: Pick<IMyLargeSegmentsUpdateData, 'i' | 'h' | 's'>, matchingKey: string) {
|
|
27
|
-
const interval = parsedData.i || 60000;
|
|
28
|
-
const seed = parsedData.s || 0;
|
|
29
|
-
|
|
30
|
-
return hash(matchingKey, seed) % interval;
|
|
31
|
-
}
|
|
32
23
|
|
|
33
24
|
/**
|
|
34
25
|
* PushManager factory:
|
|
@@ -68,11 +59,11 @@ export function pushManagerFactory(
|
|
|
68
59
|
// For server-side we pass the segmentsSyncTask, used by SplitsUpdateWorker to fetch new segments
|
|
69
60
|
const splitsUpdateWorker = SplitsUpdateWorker(log, storage.splits, pollingManager.splitsSyncTask, readiness.splits, telemetryTracker, userKey ? undefined : pollingManager.segmentsSyncTask as ISegmentsSyncTask);
|
|
70
61
|
|
|
71
|
-
// [Only for client-side] map of hashes to user keys, to dispatch
|
|
62
|
+
// [Only for client-side] map of hashes to user keys, to dispatch membership update events to the corresponding MySegmentsUpdateWorker
|
|
72
63
|
const userKeyHashes: Record<string, string> = {};
|
|
73
64
|
// [Only for client-side] map of user keys to their corresponding hash64 and MySegmentsUpdateWorkers.
|
|
74
|
-
// Hash64 is used to process
|
|
75
|
-
const clients: Record<string, { hash64: Hash64, worker:
|
|
65
|
+
// Hash64 is used to process membership update events and dispatch actions to the corresponding MySegmentsUpdateWorker.
|
|
66
|
+
const clients: Record<string, { hash64: Hash64, worker: ReturnType<typeof MySegmentsUpdateWorker>, workerLarge: ReturnType<typeof MySegmentsUpdateWorker> }> = {};
|
|
76
67
|
|
|
77
68
|
// [Only for client-side] variable to flag that a new client was added. It is needed to reconnect streaming.
|
|
78
69
|
let connectForNewClient = false;
|
|
@@ -181,7 +172,7 @@ export function pushManagerFactory(
|
|
|
181
172
|
splitsUpdateWorker.stop();
|
|
182
173
|
if (userKey) forOwn(clients, ({ worker, workerLarge }) => {
|
|
183
174
|
worker.stop();
|
|
184
|
-
workerLarge
|
|
175
|
+
workerLarge.stop();
|
|
185
176
|
});
|
|
186
177
|
else segmentsUpdateWorker!.stop();
|
|
187
178
|
}
|
|
@@ -247,24 +238,22 @@ export function pushManagerFactory(
|
|
|
247
238
|
splitsUpdateWorker.put(parsedData);
|
|
248
239
|
});
|
|
249
240
|
|
|
250
|
-
function handleMySegmentsUpdate(parsedData:
|
|
251
|
-
const isLS = parsedData.type ===
|
|
241
|
+
function handleMySegmentsUpdate(parsedData: IMembershipMSUpdateData | IMembershipLSUpdateData) {
|
|
242
|
+
const isLS = parsedData.type === MEMBERSHIP_LS_UPDATE;
|
|
252
243
|
|
|
253
244
|
switch (parsedData.u) {
|
|
254
245
|
case UpdateStrategy.BoundedFetchRequest: {
|
|
255
246
|
let bitmap: Uint8Array;
|
|
256
247
|
try {
|
|
257
|
-
bitmap = parseBitmap(parsedData.d
|
|
248
|
+
bitmap = parseBitmap(parsedData.d!, parsedData.c!);
|
|
258
249
|
} catch (e) {
|
|
259
|
-
log.warn(
|
|
250
|
+
log.warn(STREAMING_PARSING_MEMBERSHIP_UPDATE, ['BoundedFetchRequest', e]);
|
|
260
251
|
break;
|
|
261
252
|
}
|
|
262
253
|
|
|
263
254
|
forOwn(clients, ({ hash64, worker, workerLarge }, matchingKey) => {
|
|
264
255
|
if (isInBitmap(bitmap, hash64.hex)) {
|
|
265
|
-
isLS ?
|
|
266
|
-
workerLarge && workerLarge.put(parsedData.changeNumber, undefined, getDelay(parsedData, matchingKey)) :
|
|
267
|
-
worker.put(parsedData.changeNumber);
|
|
256
|
+
(isLS ? workerLarge : worker).put(parsedData, undefined, getDelay(parsedData, matchingKey));
|
|
268
257
|
}
|
|
269
258
|
});
|
|
270
259
|
return;
|
|
@@ -272,73 +261,54 @@ export function pushManagerFactory(
|
|
|
272
261
|
case UpdateStrategy.KeyList: {
|
|
273
262
|
let keyList: KeyList, added: ISet<string>, removed: ISet<string>;
|
|
274
263
|
try {
|
|
275
|
-
keyList = parseKeyList(parsedData.d
|
|
264
|
+
keyList = parseKeyList(parsedData.d!, parsedData.c!);
|
|
276
265
|
added = new _Set(keyList.a);
|
|
277
266
|
removed = new _Set(keyList.r);
|
|
278
267
|
} catch (e) {
|
|
279
|
-
log.warn(
|
|
268
|
+
log.warn(STREAMING_PARSING_MEMBERSHIP_UPDATE, ['KeyList', e]);
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (!parsedData.n || !parsedData.n.length) {
|
|
273
|
+
log.warn(STREAMING_PARSING_MEMBERSHIP_UPDATE, ['KeyList', 'No segment name was provided']);
|
|
280
274
|
break;
|
|
281
275
|
}
|
|
282
276
|
|
|
283
277
|
forOwn(clients, ({ hash64, worker, workerLarge }) => {
|
|
284
278
|
const add = added.has(hash64.dec) ? true : removed.has(hash64.dec) ? false : undefined;
|
|
285
279
|
if (add !== undefined) {
|
|
286
|
-
isLS ?
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
}) :
|
|
291
|
-
worker.put(parsedData.changeNumber, {
|
|
292
|
-
name: parsedData.segmentName,
|
|
293
|
-
add
|
|
294
|
-
});
|
|
280
|
+
(isLS ? workerLarge : worker).put(parsedData, {
|
|
281
|
+
added: add ? [parsedData.n![0]] : [],
|
|
282
|
+
removed: add ? [] : [parsedData.n![0]]
|
|
283
|
+
});
|
|
295
284
|
}
|
|
296
285
|
});
|
|
297
286
|
return;
|
|
298
287
|
}
|
|
299
288
|
case UpdateStrategy.SegmentRemoval:
|
|
300
|
-
if (
|
|
301
|
-
log.warn(
|
|
289
|
+
if (!parsedData.n || !parsedData.n.length) {
|
|
290
|
+
log.warn(STREAMING_PARSING_MEMBERSHIP_UPDATE, ['SegmentRemoval', 'No segment name was provided']);
|
|
302
291
|
break;
|
|
303
292
|
}
|
|
304
293
|
|
|
305
294
|
forOwn(clients, ({ worker, workerLarge }) => {
|
|
306
|
-
isLS ?
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
add: false
|
|
311
|
-
});
|
|
312
|
-
}) :
|
|
313
|
-
worker.put(parsedData.changeNumber, {
|
|
314
|
-
name: parsedData.segmentName,
|
|
315
|
-
add: false
|
|
316
|
-
});
|
|
295
|
+
(isLS ? workerLarge : worker).put(parsedData, {
|
|
296
|
+
added: [],
|
|
297
|
+
removed: parsedData.n!
|
|
298
|
+
});
|
|
317
299
|
});
|
|
318
300
|
return;
|
|
319
301
|
}
|
|
320
302
|
|
|
321
303
|
// `UpdateStrategy.UnboundedFetchRequest` and fallbacks of other cases
|
|
322
304
|
forOwn(clients, ({ worker, workerLarge }, matchingKey) => {
|
|
323
|
-
isLS ?
|
|
324
|
-
workerLarge && workerLarge.put(parsedData.changeNumber, undefined, getDelay(parsedData, matchingKey)) :
|
|
325
|
-
worker.put(parsedData.changeNumber);
|
|
305
|
+
(isLS ? workerLarge : worker).put(parsedData, undefined, getDelay(parsedData, matchingKey));
|
|
326
306
|
});
|
|
327
307
|
}
|
|
328
308
|
|
|
329
309
|
if (userKey) {
|
|
330
|
-
pushEmitter.on(
|
|
331
|
-
|
|
332
|
-
const userKey = userKeyHashes[userKeyHash];
|
|
333
|
-
if (userKey && clients[userKey]) { // check existence since it can be undefined if client has been destroyed
|
|
334
|
-
clients[userKey].worker.put(
|
|
335
|
-
parsedData.changeNumber,
|
|
336
|
-
parsedData.includesPayload ? parsedData.segmentList ? parsedData.segmentList : [] : undefined);
|
|
337
|
-
}
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
pushEmitter.on(MY_SEGMENTS_UPDATE_V2, handleMySegmentsUpdate);
|
|
341
|
-
pushEmitter.on(MY_LARGE_SEGMENTS_UPDATE, handleMySegmentsUpdate);
|
|
310
|
+
pushEmitter.on(MEMBERSHIP_MS_UPDATE, handleMySegmentsUpdate);
|
|
311
|
+
pushEmitter.on(MEMBERSHIP_LS_UPDATE, handleMySegmentsUpdate);
|
|
342
312
|
} else {
|
|
343
313
|
pushEmitter.on(SEGMENT_UPDATE, segmentsUpdateWorker!.put);
|
|
344
314
|
}
|
|
@@ -361,7 +331,7 @@ export function pushManagerFactory(
|
|
|
361
331
|
if (disabled || disconnected === false) return;
|
|
362
332
|
disconnected = false;
|
|
363
333
|
|
|
364
|
-
if (userKey) this.add(userKey, pollingManager.segmentsSyncTask
|
|
334
|
+
if (userKey) this.add(userKey, pollingManager.segmentsSyncTask); // client-side
|
|
365
335
|
else setTimeout(connectPush); // server-side runs in next cycle as in client-side, for consistency with client-side
|
|
366
336
|
},
|
|
367
337
|
|
|
@@ -371,15 +341,15 @@ export function pushManagerFactory(
|
|
|
371
341
|
},
|
|
372
342
|
|
|
373
343
|
// [Only for client-side]
|
|
374
|
-
add(userKey: string, mySegmentsSyncTask: IMySegmentsSyncTask
|
|
344
|
+
add(userKey: string, mySegmentsSyncTask: IMySegmentsSyncTask) {
|
|
375
345
|
const hash = hashUserKey(userKey);
|
|
376
346
|
|
|
377
347
|
if (!userKeyHashes[hash]) {
|
|
378
348
|
userKeyHashes[hash] = userKey;
|
|
379
349
|
clients[userKey] = {
|
|
380
350
|
hash64: hash64(userKey),
|
|
381
|
-
worker: MySegmentsUpdateWorker(mySegmentsSyncTask, telemetryTracker
|
|
382
|
-
workerLarge:
|
|
351
|
+
worker: MySegmentsUpdateWorker(mySegmentsSyncTask, telemetryTracker),
|
|
352
|
+
workerLarge: MySegmentsUpdateWorker(mySegmentsSyncTask, telemetryTracker)
|
|
383
353
|
};
|
|
384
354
|
connectForNewClient = true; // we must reconnect on start, to listen the channel for the new user key
|
|
385
355
|
|
|
@@ -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';
|
|
@@ -11,35 +11,33 @@ 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
|
|
14
|
+
export type MEMBERSHIP_MS_UPDATE = 'MEMBERSHIP_MS_UPDATE';
|
|
15
|
+
export type MEMBERSHIP_LS_UPDATE = 'MEMBERSHIP_LS_UPDATE';
|
|
16
16
|
export type SEGMENT_UPDATE = 'SEGMENT_UPDATE';
|
|
17
17
|
export type SPLIT_KILL = 'SPLIT_KILL';
|
|
18
18
|
export type SPLIT_UPDATE = 'SPLIT_UPDATE';
|
|
19
|
-
export type MY_LARGE_SEGMENTS_UPDATE = 'MY_LARGE_SEGMENTS_UPDATE';
|
|
20
19
|
|
|
21
20
|
// Control-type push notifications, handled by NotificationKeeper
|
|
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 | MEMBERSHIP_MS_UPDATE | MEMBERSHIP_LS_UPDATE | SEGMENT_UPDATE | SPLIT_UPDATE | SPLIT_KILL | ControlType.STREAMING_RESET
|
|
26
25
|
|
|
27
26
|
type IParsedData<T extends IPushEvent> =
|
|
28
|
-
T extends
|
|
29
|
-
T extends
|
|
30
|
-
T extends MY_LARGE_SEGMENTS_UPDATE ? IMyLargeSegmentsUpdateData :
|
|
27
|
+
T extends MEMBERSHIP_MS_UPDATE ? IMembershipMSUpdateData :
|
|
28
|
+
T extends MEMBERSHIP_LS_UPDATE ? IMembershipLSUpdateData :
|
|
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,
|
|
@@ -103,7 +103,7 @@ export type DROPPED = 1;
|
|
|
103
103
|
export type DEDUPED = 2;
|
|
104
104
|
export type ImpressionDataType = QUEUED | DROPPED | DEDUPED
|
|
105
105
|
export type EventDataType = QUEUED | DROPPED;
|
|
106
|
-
export type UpdatesFromSSEEnum = SPLITS |
|
|
106
|
+
export type UpdatesFromSSEEnum = SPLITS | MEMBERSHIPS;
|
|
107
107
|
|
|
108
108
|
export type SPLITS = 'sp';
|
|
109
109
|
export type IMPRESSIONS = 'im';
|
|
@@ -112,9 +112,8 @@ export type EVENTS = 'ev';
|
|
|
112
112
|
export type TELEMETRY = 'te';
|
|
113
113
|
export type TOKEN = 'to';
|
|
114
114
|
export type SEGMENT = 'se';
|
|
115
|
-
export type
|
|
116
|
-
export type
|
|
117
|
-
export type OperationType = SPLITS | IMPRESSIONS | IMPRESSIONS_COUNT | EVENTS | TELEMETRY | TOKEN | SEGMENT | MY_SEGMENT | MY_LARGE_SEGMENT;
|
|
115
|
+
export type MEMBERSHIPS = 'ms';
|
|
116
|
+
export type OperationType = SPLITS | IMPRESSIONS | IMPRESSIONS_COUNT | EVENTS | TELEMETRY | TOKEN | SEGMENT | MEMBERSHIPS;
|
|
118
117
|
|
|
119
118
|
export type LastSync = Partial<Record<OperationType, number | undefined>>
|
|
120
119
|
export type HttpErrors = Partial<Record<OperationType, { [statusCode: string]: number }>>
|
|
@@ -205,7 +204,6 @@ export type RefreshRates = {
|
|
|
205
204
|
sp: number, // splits
|
|
206
205
|
se?: number, // segments
|
|
207
206
|
ms?: number, // mySegments
|
|
208
|
-
mls?: number, // myLargeSegments
|
|
209
207
|
im: number, // impressions
|
|
210
208
|
ev: number, // events
|
|
211
209
|
te: number, // telemetry
|
|
@@ -231,7 +229,6 @@ export type TelemetryConfigStats = {
|
|
|
231
229
|
// 'metrics/config' JSON request body
|
|
232
230
|
export type TelemetryConfigStatsPayload = TelemetryConfigStats & {
|
|
233
231
|
sE: boolean, // streamingEnabled
|
|
234
|
-
lE?: boolean, // largeSegmentsEnabled
|
|
235
232
|
rR: RefreshRates, // refreshRates
|
|
236
233
|
uO: UrlOverrides, // urlOverrides
|
|
237
234
|
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.
|
|
@@ -75,8 +75,7 @@ export const EVENTS = 'ev';
|
|
|
75
75
|
export const TELEMETRY = 'te';
|
|
76
76
|
export const TOKEN = 'to';
|
|
77
77
|
export const SEGMENT = 'se';
|
|
78
|
-
export const
|
|
79
|
-
export const MY_LARGE_SEGMENT = 'mls';
|
|
78
|
+
export const MEMBERSHIPS = 'ms';
|
|
80
79
|
|
|
81
80
|
export const TREATMENT = 't';
|
|
82
81
|
export const TREATMENTS = 'ts';
|
|
@@ -106,7 +105,7 @@ export const DISABLED = 0;
|
|
|
106
105
|
export const ENABLED = 1;
|
|
107
106
|
export const PAUSED = 2;
|
|
108
107
|
|
|
109
|
-
export const FLAG_SPEC_VERSION = '1.
|
|
108
|
+
export const FLAG_SPEC_VERSION = '1.2';
|
|
110
109
|
|
|
111
110
|
// Matcher types
|
|
112
111
|
export const IN_SEGMENT = 'IN_SEGMENT';
|
|
@@ -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,17 +177,16 @@ export interface ISegmentChangesResponse {
|
|
|
177
177
|
since: number;
|
|
178
178
|
till: number;
|
|
179
179
|
}
|
|
180
|
-
/** Interface of the parsed JSON response of `/mySegments/{userKey}` */
|
|
181
180
|
export interface IMySegmentsResponse {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
181
|
+
cn?: number;
|
|
182
|
+
k?: {
|
|
183
|
+
n: string;
|
|
185
184
|
}[];
|
|
186
185
|
}
|
|
187
|
-
/** Interface of the parsed JSON response of `/
|
|
188
|
-
export interface
|
|
189
|
-
|
|
190
|
-
|
|
186
|
+
/** Interface of the parsed JSON response of `/memberships/{userKey}` */
|
|
187
|
+
export interface IMembershipsResponse {
|
|
188
|
+
ms?: IMySegmentsResponse;
|
|
189
|
+
ls?: IMySegmentsResponse;
|
|
191
190
|
}
|
|
192
191
|
/** Metadata internal type for storages */
|
|
193
192
|
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_MEMBERSHIP_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;
|