@splitsoftware/splitio-commons 1.16.1-rc.10 → 1.16.1-rc.12

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.
Files changed (77) hide show
  1. package/cjs/logger/constants.js +2 -2
  2. package/cjs/logger/messages/warn.js +1 -1
  3. package/cjs/services/splitApi.js +3 -3
  4. package/cjs/storages/AbstractSegmentsCacheSync.js +41 -7
  5. package/cjs/storages/dataLoader.js +1 -1
  6. package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +19 -63
  7. package/cjs/storages/inMemory/MySegmentsCacheInMemory.js +5 -40
  8. package/cjs/storages/inMemory/TelemetryCacheInMemory.js +1 -1
  9. package/cjs/sync/polling/fetchers/mySegmentsFetcher.js +2 -2
  10. package/cjs/sync/polling/updaters/mySegmentsUpdater.js +12 -21
  11. package/cjs/sync/streaming/AuthClient/index.js +1 -1
  12. package/cjs/sync/streaming/SSEHandler/index.js +5 -7
  13. package/cjs/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +106 -63
  14. package/cjs/sync/streaming/constants.js +3 -3
  15. package/cjs/sync/streaming/pushManager.js +25 -31
  16. package/cjs/utils/constants/index.js +3 -4
  17. package/esm/logger/constants.js +1 -1
  18. package/esm/logger/messages/warn.js +1 -1
  19. package/esm/services/splitApi.js +4 -4
  20. package/esm/storages/AbstractSegmentsCacheSync.js +41 -7
  21. package/esm/storages/dataLoader.js +1 -1
  22. package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +19 -63
  23. package/esm/storages/inMemory/MySegmentsCacheInMemory.js +5 -40
  24. package/esm/storages/inMemory/TelemetryCacheInMemory.js +1 -1
  25. package/esm/sync/polling/fetchers/mySegmentsFetcher.js +2 -2
  26. package/esm/sync/polling/updaters/mySegmentsUpdater.js +12 -21
  27. package/esm/sync/streaming/AuthClient/index.js +1 -1
  28. package/esm/sync/streaming/SSEHandler/index.js +6 -8
  29. package/esm/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +106 -63
  30. package/esm/sync/streaming/constants.js +2 -2
  31. package/esm/sync/streaming/pushManager.js +28 -34
  32. package/esm/utils/constants/index.js +1 -2
  33. package/package.json +1 -1
  34. package/src/dtos/types.ts +9 -12
  35. package/src/logger/constants.ts +1 -1
  36. package/src/logger/messages/warn.ts +1 -1
  37. package/src/services/splitApi.ts +4 -4
  38. package/src/services/types.ts +1 -1
  39. package/src/storages/AbstractSegmentsCacheSync.ts +52 -7
  40. package/src/storages/AbstractSplitsCacheSync.ts +1 -1
  41. package/src/storages/dataLoader.ts +1 -1
  42. package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +15 -69
  43. package/src/storages/inMemory/MySegmentsCacheInMemory.ts +6 -46
  44. package/src/storages/inMemory/TelemetryCacheInMemory.ts +1 -1
  45. package/src/storages/types.ts +6 -5
  46. package/src/sync/polling/fetchers/mySegmentsFetcher.ts +2 -1
  47. package/src/sync/polling/fetchers/types.ts +1 -0
  48. package/src/sync/polling/types.ts +9 -10
  49. package/src/sync/polling/updaters/mySegmentsUpdater.ts +15 -19
  50. package/src/sync/streaming/AuthClient/index.ts +1 -1
  51. package/src/sync/streaming/SSEHandler/index.ts +9 -11
  52. package/src/sync/streaming/SSEHandler/types.ts +6 -6
  53. package/src/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.ts +114 -65
  54. package/src/sync/streaming/constants.ts +2 -2
  55. package/src/sync/streaming/parseUtils.ts +2 -2
  56. package/src/sync/streaming/pushManager.ts +30 -39
  57. package/src/sync/streaming/types.ts +6 -6
  58. package/src/sync/submitters/types.ts +4 -5
  59. package/src/utils/constants/index.ts +1 -2
  60. package/types/dtos/types.d.ts +8 -12
  61. package/types/logger/constants.d.ts +1 -1
  62. package/types/services/types.d.ts +1 -1
  63. package/types/storages/AbstractSegmentsCacheSync.d.ts +8 -6
  64. package/types/storages/AbstractSplitsCacheSync.d.ts +1 -1
  65. package/types/storages/inLocalStorage/MySegmentsCacheInLocal.d.ts +1 -12
  66. package/types/storages/inMemory/MySegmentsCacheInMemory.d.ts +1 -9
  67. package/types/storages/types.d.ts +6 -5
  68. package/types/sync/polling/fetchers/types.d.ts +1 -1
  69. package/types/sync/polling/types.d.ts +9 -7
  70. package/types/sync/polling/updaters/mySegmentsUpdater.d.ts +1 -1
  71. package/types/sync/streaming/SSEHandler/types.d.ts +6 -6
  72. package/types/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.d.ts +3 -2
  73. package/types/sync/streaming/constants.d.ts +2 -2
  74. package/types/sync/streaming/parseUtils.d.ts +2 -2
  75. package/types/sync/streaming/types.d.ts +5 -5
  76. package/types/sync/submitters/types.d.ts +4 -5
  77. package/types/utils/constants/index.d.ts +1 -2
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ControlType = exports.OCCUPANCY = exports.CONTROL = exports.MY_LARGE_SEGMENTS_UPDATE = exports.SPLIT_UPDATE = exports.SPLIT_KILL = exports.SEGMENT_UPDATE = exports.MY_SEGMENTS_UPDATE_V3 = exports.PUSH_SUBSYSTEM_DOWN = exports.PUSH_SUBSYSTEM_UP = exports.PUSH_RETRYABLE_ERROR = exports.PUSH_NONRETRYABLE_ERROR = exports.SECONDS_BEFORE_EXPIRATION = void 0;
3
+ exports.ControlType = exports.OCCUPANCY = exports.CONTROL = exports.SPLIT_UPDATE = exports.SPLIT_KILL = exports.SEGMENT_UPDATE = exports.MEMBERSHIPS_LS_UPDATE = exports.MEMBERSHIPS_MS_UPDATE = exports.PUSH_SUBSYSTEM_DOWN = exports.PUSH_SUBSYSTEM_UP = exports.PUSH_RETRYABLE_ERROR = exports.PUSH_NONRETRYABLE_ERROR = exports.SECONDS_BEFORE_EXPIRATION = void 0;
4
4
  // time for refresh token
5
5
  exports.SECONDS_BEFORE_EXPIRATION = 600;
6
6
  // Internal SDK events, subscribed by SyncManager and PushManager
@@ -25,11 +25,11 @@ exports.PUSH_SUBSYSTEM_UP = 'PUSH_SUBSYSTEM_UP';
25
25
  */
26
26
  exports.PUSH_SUBSYSTEM_DOWN = 'PUSH_SUBSYSTEM_DOWN';
27
27
  // Update-type push notifications, handled by NotificationProcessor
28
- exports.MY_SEGMENTS_UPDATE_V3 = 'MY_SEGMENTS_UPDATE_V3';
28
+ exports.MEMBERSHIPS_MS_UPDATE = 'MEMBERSHIPS_MS_UPDATE';
29
+ exports.MEMBERSHIPS_LS_UPDATE = 'MEMBERSHIPS_LS_UPDATE';
29
30
  exports.SEGMENT_UPDATE = 'SEGMENT_UPDATE';
30
31
  exports.SPLIT_KILL = 'SPLIT_KILL';
31
32
  exports.SPLIT_UPDATE = 'SPLIT_UPDATE';
32
- exports.MY_LARGE_SEGMENTS_UPDATE = 'MY_LARGE_SEGMENTS_UPDATE';
33
33
  // Control-type push notifications, handled by NotificationKeeper
34
34
  exports.CONTROL = 'CONTROL';
35
35
  exports.OCCUPANCY = 'OCCUPANCY';
@@ -48,10 +48,10 @@ function pushManagerFactory(params, pollingManager) {
48
48
  var segmentsUpdateWorker = userKey ? undefined : (0, SegmentsUpdateWorker_1.SegmentsUpdateWorker)(log, pollingManager.segmentsSyncTask, storage.segments);
49
49
  // For server-side we pass the segmentsSyncTask, used by SplitsUpdateWorker to fetch new segments
50
50
  var splitsUpdateWorker = (0, SplitsUpdateWorker_1.SplitsUpdateWorker)(log, storage.splits, pollingManager.splitsSyncTask, readiness.splits, telemetryTracker, userKey ? undefined : pollingManager.segmentsSyncTask);
51
- // [Only for client-side] map of hashes to user keys, to dispatch MY_SEGMENTS_UPDATE events to the corresponding MySegmentsUpdateWorker
51
+ // [Only for client-side] map of hashes to user keys, to dispatch membership update events to the corresponding MySegmentsUpdateWorker
52
52
  var userKeyHashes = {};
53
53
  // [Only for client-side] map of user keys to their corresponding hash64 and MySegmentsUpdateWorkers.
54
- // Hash64 is used to process MY_SEGMENTS_UPDATE events and dispatch actions to the corresponding MySegmentsUpdateWorker.
54
+ // Hash64 is used to process membership update events and dispatch actions to the corresponding MySegmentsUpdateWorker.
55
55
  var clients = {};
56
56
  // [Only for client-side] variable to flag that a new client was added. It is needed to reconnect streaming.
57
57
  var connectForNewClient = false;
@@ -143,9 +143,8 @@ function pushManagerFactory(params, pollingManager) {
143
143
  splitsUpdateWorker.stop();
144
144
  if (userKey)
145
145
  (0, lang_1.forOwn)(clients, function (_a) {
146
- var worker = _a.worker, workerLarge = _a.workerLarge;
147
- worker.stop();
148
- workerLarge.stop();
146
+ var worker = _a.worker;
147
+ return worker.stop();
149
148
  });
150
149
  else
151
150
  segmentsUpdateWorker.stop();
@@ -200,7 +199,6 @@ function pushManagerFactory(params, pollingManager) {
200
199
  splitsUpdateWorker.put(parsedData);
201
200
  });
202
201
  function handleMySegmentsUpdate(parsedData) {
203
- var isLS = parsedData.t === constants_1.MY_LARGE_SEGMENTS_UPDATE;
204
202
  switch (parsedData.u) {
205
203
  case types_1.UpdateStrategy.BoundedFetchRequest: {
206
204
  var bitmap_1;
@@ -208,13 +206,13 @@ function pushManagerFactory(params, pollingManager) {
208
206
  bitmap_1 = (0, parseUtils_1.parseBitmap)(parsedData.d, parsedData.c);
209
207
  }
210
208
  catch (e) {
211
- log.warn(constants_2.STREAMING_PARSING_MY_SEGMENTS_UPDATE, ['BoundedFetchRequest', e]);
209
+ log.warn(constants_2.STREAMING_PARSING_MEMBERSHIPS_UPDATE, ['BoundedFetchRequest', e]);
212
210
  break;
213
211
  }
214
212
  (0, lang_1.forOwn)(clients, function (_a, matchingKey) {
215
- var hash64 = _a.hash64, worker = _a.worker, workerLarge = _a.workerLarge;
213
+ var hash64 = _a.hash64, worker = _a.worker;
216
214
  if ((0, parseUtils_1.isInBitmap)(bitmap_1, hash64.hex)) {
217
- (isLS ? workerLarge : worker).put(parsedData.cn, undefined, (0, parseUtils_1.getDelay)(parsedData, matchingKey));
215
+ worker.put(parsedData, undefined, (0, parseUtils_1.getDelay)(parsedData, matchingKey));
218
216
  }
219
217
  });
220
218
  return;
@@ -227,51 +225,48 @@ function pushManagerFactory(params, pollingManager) {
227
225
  removed_1 = new sets_1._Set(keyList.r);
228
226
  }
229
227
  catch (e) {
230
- log.warn(constants_2.STREAMING_PARSING_MY_SEGMENTS_UPDATE, ['KeyList', e]);
228
+ log.warn(constants_2.STREAMING_PARSING_MEMBERSHIPS_UPDATE, ['KeyList', e]);
231
229
  break;
232
230
  }
233
231
  if (!parsedData.n || !parsedData.n.length) {
234
- log.warn(constants_2.STREAMING_PARSING_MY_SEGMENTS_UPDATE, ['KeyList', 'No segment name was provided']);
232
+ log.warn(constants_2.STREAMING_PARSING_MEMBERSHIPS_UPDATE, ['KeyList', 'No segment name was provided']);
235
233
  break;
236
234
  }
237
235
  (0, lang_1.forOwn)(clients, function (_a) {
238
- var hash64 = _a.hash64, worker = _a.worker, workerLarge = _a.workerLarge;
236
+ var hash64 = _a.hash64, worker = _a.worker;
239
237
  var add = added_1.has(hash64.dec) ? true : removed_1.has(hash64.dec) ? false : undefined;
240
238
  if (add !== undefined) {
241
- (isLS ? workerLarge : worker).put(parsedData.cn, [{
242
- isLS: isLS,
243
- name: parsedData.n[0],
244
- add: add,
245
- }]);
239
+ worker.put(parsedData, {
240
+ added: add ? [parsedData.n[0]] : [],
241
+ removed: add ? [] : [parsedData.n[0]]
242
+ });
246
243
  }
247
244
  });
248
245
  return;
249
246
  }
250
247
  case types_1.UpdateStrategy.SegmentRemoval:
251
248
  if (!parsedData.n || !parsedData.n.length) {
252
- log.warn(constants_2.STREAMING_PARSING_MY_SEGMENTS_UPDATE, ['SegmentRemoval', 'No segment name was provided']);
249
+ log.warn(constants_2.STREAMING_PARSING_MEMBERSHIPS_UPDATE, ['SegmentRemoval', 'No segment name was provided']);
253
250
  break;
254
251
  }
255
252
  (0, lang_1.forOwn)(clients, function (_a) {
256
- var worker = _a.worker, workerLarge = _a.workerLarge;
257
- (isLS ? workerLarge : worker).put(parsedData.cn, parsedData.n.map(function (largeSegment) { return ({
258
- isLS: isLS,
259
- name: largeSegment,
260
- add: false,
261
- cn: parsedData.cn
262
- }); }));
253
+ var worker = _a.worker;
254
+ worker.put(parsedData, {
255
+ added: [],
256
+ removed: parsedData.n
257
+ });
263
258
  });
264
259
  return;
265
260
  }
266
261
  // `UpdateStrategy.UnboundedFetchRequest` and fallbacks of other cases
267
262
  (0, lang_1.forOwn)(clients, function (_a, matchingKey) {
268
- var worker = _a.worker, workerLarge = _a.workerLarge;
269
- (isLS ? workerLarge : worker).put(parsedData.cn, undefined, (0, parseUtils_1.getDelay)(parsedData, matchingKey));
263
+ var worker = _a.worker;
264
+ worker.put(parsedData, undefined, (0, parseUtils_1.getDelay)(parsedData, matchingKey));
270
265
  });
271
266
  }
272
267
  if (userKey) {
273
- pushEmitter.on(constants_1.MY_SEGMENTS_UPDATE_V3, handleMySegmentsUpdate);
274
- pushEmitter.on(constants_1.MY_LARGE_SEGMENTS_UPDATE, handleMySegmentsUpdate);
268
+ pushEmitter.on(constants_1.MEMBERSHIPS_MS_UPDATE, handleMySegmentsUpdate);
269
+ pushEmitter.on(constants_1.MEMBERSHIPS_LS_UPDATE, handleMySegmentsUpdate);
275
270
  }
276
271
  else {
277
272
  pushEmitter.on(constants_1.SEGMENT_UPDATE, segmentsUpdateWorker.put);
@@ -309,8 +304,7 @@ function pushManagerFactory(params, pollingManager) {
309
304
  userKeyHashes[hash] = userKey;
310
305
  clients[userKey] = {
311
306
  hash64: (0, murmur3_64_1.hash64)(userKey),
312
- worker: (0, MySegmentsUpdateWorker_1.MySegmentsUpdateWorker)(mySegmentsSyncTask, telemetryTracker, constants_3.MY_SEGMENT),
313
- workerLarge: (0, MySegmentsUpdateWorker_1.MySegmentsUpdateWorker)(mySegmentsSyncTask, telemetryTracker, constants_3.MY_LARGE_SEGMENT)
307
+ worker: (0, MySegmentsUpdateWorker_1.MySegmentsUpdateWorker)(log, storage, mySegmentsSyncTask, telemetryTracker)
314
308
  };
315
309
  connectForNewClient = true; // we must reconnect on start, to listen the channel for the new user key
316
310
  // Reconnects in case of a new client.
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MY_SEGMENT = exports.SEGMENT = exports.TOKEN = exports.TELEMETRY = exports.EVENTS = exports.IMPRESSIONS_COUNT = exports.IMPRESSIONS = exports.SPLITS = exports.NONE_ENUM = exports.DEBUG_ENUM = exports.OPTIMIZED_ENUM = exports.CONSUMER_PARTIAL_ENUM = exports.CONSUMER_ENUM = exports.STANDALONE_ENUM = exports.DEDUPED = exports.DROPPED = exports.QUEUED = exports.NAMES_FN_LABEL = exports.SPLITS_FN_LABEL = exports.SPLIT_FN_LABEL = exports.TRACK_FN_LABEL = exports.GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SETS = exports.GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SET = exports.GET_TREATMENTS_BY_FLAG_SETS = exports.GET_TREATMENTS_BY_FLAG_SET = exports.GET_TREATMENTS_WITH_CONFIG = exports.GET_TREATMENT_WITH_CONFIG = exports.GET_TREATMENTS = exports.GET_TREATMENT = exports.CONSENT_UNKNOWN = exports.CONSENT_DECLINED = exports.CONSENT_GRANTED = exports.STORAGE_PLUGGABLE = exports.STORAGE_REDIS = exports.STORAGE_LOCALSTORAGE = exports.STORAGE_MEMORY = exports.CONSUMER_PARTIAL_MODE = exports.CONSUMER_MODE = exports.PRODUCER_MODE = exports.STANDALONE_MODE = exports.LOCALHOST_MODE = exports.NONE = exports.OPTIMIZED = exports.DEBUG = exports.SPLIT_EVENT = exports.SPLIT_IMPRESSION = exports.NA = exports.UNKNOWN = exports.CONTROL_WITH_CONFIG = exports.CONTROL = void 0;
4
- exports.IN_LARGE_SEGMENT = exports.IN_SEGMENT = exports.FLAG_SPEC_VERSION = exports.PAUSED = exports.ENABLED = exports.DISABLED = exports.NON_REQUESTED = exports.REQUESTED = exports.POLLING = exports.STREAMING = exports.AUTH_REJECTION = exports.SYNC_MODE_UPDATE = exports.ABLY_ERROR = exports.TOKEN_REFRESH = exports.SSE_CONNECTION_ERROR = exports.STREAMING_STATUS = exports.OCCUPANCY_SEC = exports.OCCUPANCY_PRI = exports.CONNECTION_ESTABLISHED = exports.TRACK = exports.TREATMENTS_WITH_CONFIG_BY_FLAGSETS = exports.TREATMENTS_WITH_CONFIG_BY_FLAGSET = exports.TREATMENTS_BY_FLAGSETS = exports.TREATMENTS_BY_FLAGSET = exports.TREATMENTS_WITH_CONFIG = exports.TREATMENT_WITH_CONFIG = exports.TREATMENTS = exports.TREATMENT = exports.MY_LARGE_SEGMENT = void 0;
3
+ exports.MEMBERSHIPS = exports.SEGMENT = exports.TOKEN = exports.TELEMETRY = exports.EVENTS = exports.IMPRESSIONS_COUNT = exports.IMPRESSIONS = exports.SPLITS = exports.NONE_ENUM = exports.DEBUG_ENUM = exports.OPTIMIZED_ENUM = exports.CONSUMER_PARTIAL_ENUM = exports.CONSUMER_ENUM = exports.STANDALONE_ENUM = exports.DEDUPED = exports.DROPPED = exports.QUEUED = exports.NAMES_FN_LABEL = exports.SPLITS_FN_LABEL = exports.SPLIT_FN_LABEL = exports.TRACK_FN_LABEL = exports.GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SETS = exports.GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SET = exports.GET_TREATMENTS_BY_FLAG_SETS = exports.GET_TREATMENTS_BY_FLAG_SET = exports.GET_TREATMENTS_WITH_CONFIG = exports.GET_TREATMENT_WITH_CONFIG = exports.GET_TREATMENTS = exports.GET_TREATMENT = exports.CONSENT_UNKNOWN = exports.CONSENT_DECLINED = exports.CONSENT_GRANTED = exports.STORAGE_PLUGGABLE = exports.STORAGE_REDIS = exports.STORAGE_LOCALSTORAGE = exports.STORAGE_MEMORY = exports.CONSUMER_PARTIAL_MODE = exports.CONSUMER_MODE = exports.PRODUCER_MODE = exports.STANDALONE_MODE = exports.LOCALHOST_MODE = exports.NONE = exports.OPTIMIZED = exports.DEBUG = exports.SPLIT_EVENT = exports.SPLIT_IMPRESSION = exports.NA = exports.UNKNOWN = exports.CONTROL_WITH_CONFIG = exports.CONTROL = void 0;
4
+ exports.IN_LARGE_SEGMENT = exports.IN_SEGMENT = exports.FLAG_SPEC_VERSION = exports.PAUSED = exports.ENABLED = exports.DISABLED = exports.NON_REQUESTED = exports.REQUESTED = exports.POLLING = exports.STREAMING = exports.AUTH_REJECTION = exports.SYNC_MODE_UPDATE = exports.ABLY_ERROR = exports.TOKEN_REFRESH = exports.SSE_CONNECTION_ERROR = exports.STREAMING_STATUS = exports.OCCUPANCY_SEC = exports.OCCUPANCY_PRI = exports.CONNECTION_ESTABLISHED = exports.TRACK = exports.TREATMENTS_WITH_CONFIG_BY_FLAGSETS = exports.TREATMENTS_WITH_CONFIG_BY_FLAGSET = exports.TREATMENTS_BY_FLAGSETS = exports.TREATMENTS_BY_FLAGSET = exports.TREATMENTS_WITH_CONFIG = exports.TREATMENT_WITH_CONFIG = exports.TREATMENTS = exports.TREATMENT = void 0;
5
5
  // Special treatments
6
6
  exports.CONTROL = 'control';
7
7
  exports.CONTROL_WITH_CONFIG = {
@@ -64,8 +64,7 @@ exports.EVENTS = 'ev';
64
64
  exports.TELEMETRY = 'te';
65
65
  exports.TOKEN = 'to';
66
66
  exports.SEGMENT = 'se';
67
- exports.MY_SEGMENT = 'ms';
68
- exports.MY_LARGE_SEGMENT = 'mls';
67
+ exports.MEMBERSHIPS = 'ms';
69
68
  exports.TREATMENT = 't';
70
69
  exports.TREATMENTS = 'ts';
71
70
  exports.TREATMENT_WITH_CONFIG = 'tc';
@@ -77,7 +77,7 @@ export var WARN_SPLITS_FILTER_IGNORED = 219;
77
77
  export var WARN_SPLITS_FILTER_INVALID = 220;
78
78
  export var WARN_SPLITS_FILTER_EMPTY = 221;
79
79
  export var WARN_SDK_KEY = 222;
80
- export var STREAMING_PARSING_MY_SEGMENTS_UPDATE = 223;
80
+ export var STREAMING_PARSING_MEMBERSHIPS_UPDATE = 223;
81
81
  export var STREAMING_PARSING_SPLIT_UPDATE = 224;
82
82
  export var WARN_INVALID_FLAGSET = 225;
83
83
  export var WARN_LOWERCASE_FLAGSET = 226;
@@ -30,7 +30,7 @@ export var codesWarn = codesError.concat([
30
30
  [c.WARN_SPLITS_FILTER_INVALID, c.LOG_PREFIX_SETTINGS + ': feature flag filter at position %s is invalid. It must be an object with a valid filter type ("bySet", "byName" or "byPrefix") and a list of "values".'],
31
31
  [c.WARN_SPLITS_FILTER_EMPTY, c.LOG_PREFIX_SETTINGS + ': feature flag filter configuration must be a non-empty array of filter objects.'],
32
32
  [c.WARN_SDK_KEY, c.LOG_PREFIX_SETTINGS + ': You already have %s. We recommend keeping only one instance of the factory at all times (Singleton pattern) and reusing it throughout your application'],
33
- [c.STREAMING_PARSING_MY_SEGMENTS_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching Memberships due to an error processing %s notification: %s'],
33
+ [c.STREAMING_PARSING_MEMBERSHIPS_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching Memberships due to an error processing %s notification: %s'],
34
34
  [c.STREAMING_PARSING_SPLIT_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching SplitChanges due to an error processing SPLIT_UPDATE notification: %s'],
35
35
  [c.WARN_INVALID_FLAGSET, '%s: you passed %s, flag set must adhere to the regular expressions %s. This means a flag set must start with a letter or number, be in lowercase, alphanumeric and have a max length of 50 characters. %s was discarded.'],
36
36
  [c.WARN_LOWERCASE_FLAGSET, '%s: flag set %s should be all lowercase - converting string to lowercase.'],
@@ -1,6 +1,6 @@
1
1
  import { splitHttpClientFactory } from './splitHttpClient';
2
2
  import { objectAssign } from '../utils/lang/objectAssign';
3
- import { SPLITS, IMPRESSIONS, IMPRESSIONS_COUNT, EVENTS, TELEMETRY, TOKEN, SEGMENT, MY_SEGMENT } from '../utils/constants';
3
+ import { SPLITS, IMPRESSIONS, IMPRESSIONS_COUNT, EVENTS, TELEMETRY, TOKEN, SEGMENT, MEMBERSHIPS } from '../utils/constants';
4
4
  import { ERROR_TOO_MANY_SETS } from '../logger/constants';
5
5
  var noCacheHeaderOptions = { headers: { 'Cache-Control': 'no-cache' } };
6
6
  function userKeyToQueryParam(userKey) {
@@ -51,15 +51,15 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
51
51
  var url = urls.sdk + "/segmentChanges/" + segmentName + "?since=" + since + (till ? '&till=' + till : '');
52
52
  return splitHttpClient(url, noCache ? noCacheHeaderOptions : undefined, telemetryTracker.trackHttp(SEGMENT));
53
53
  },
54
- fetchMemberships: function (userMatchingKey, noCache) {
54
+ fetchMemberships: function (userMatchingKey, noCache, till) {
55
55
  /**
56
56
  * URI encoding of user keys in order to:
57
57
  * - avoid 400 responses (due to URI malformed). E.g.: '/api/memberships/%'
58
58
  * - avoid 404 responses. E.g.: '/api/memberships/foo/bar'
59
59
  * - match user keys with special characters. E.g.: 'foo%bar', 'foo/bar'
60
60
  */
61
- var url = urls.sdk + "/memberships/" + encodeURIComponent(userMatchingKey);
62
- return splitHttpClient(url, noCache ? noCacheHeaderOptions : undefined, telemetryTracker.trackHttp(MY_SEGMENT));
61
+ var url = urls.sdk + "/memberships/" + encodeURIComponent(userMatchingKey) + (till ? '?till=' + till : '');
62
+ return splitHttpClient(url, noCache ? noCacheHeaderOptions : undefined, telemetryTracker.trackHttp(MEMBERSHIPS));
63
63
  },
64
64
  /**
65
65
  * Post events.
@@ -6,20 +6,54 @@ var AbstractSegmentsCacheSync = /** @class */ (function () {
6
6
  function AbstractSegmentsCacheSync() {
7
7
  }
8
8
  /**
9
- * For server-side synchronizer: add the given list of segments to the cache, with an empty list of keys. The segments that already exist are not modified.
10
- * For client-side synchronizer: the method is not used.
9
+ * clear the cache.
11
10
  */
12
- AbstractSegmentsCacheSync.prototype.registerSegments = function (names) { return false; };
11
+ AbstractSegmentsCacheSync.prototype.clear = function () {
12
+ this.resetSegments({});
13
+ };
13
14
  /**
14
- * For server-side synchronizer: set the change number of `name` segment.
15
+ * For server-side synchronizer: add the given list of segments to the cache, with an empty list of keys. The segments that already exist are not modified.
15
16
  * For client-side synchronizer: the method is not used.
16
17
  */
17
- AbstractSegmentsCacheSync.prototype.setChangeNumber = function (name, changeNumber) { return true; };
18
+ AbstractSegmentsCacheSync.prototype.registerSegments = function (names) { return false; };
18
19
  /**
19
20
  * For server-side synchronizer: the method is not used.
20
- * For client-side synchronizer: reset the cache with the given list of segments.
21
+ * For client-side synchronizer: it resets or updates the cache.
21
22
  */
22
- AbstractSegmentsCacheSync.prototype.resetSegments = function (names, changeNumber) { return true; };
23
+ AbstractSegmentsCacheSync.prototype.resetSegments = function (segmentsData) {
24
+ var _this = this;
25
+ this.setChangeNumber(undefined, segmentsData.cn);
26
+ var _a = segmentsData, added = _a.added, removed = _a.removed;
27
+ if (added && removed) {
28
+ var isDiff_1 = false;
29
+ added.forEach(function (segment) {
30
+ isDiff_1 = _this.addToSegment(segment) || isDiff_1;
31
+ });
32
+ removed.forEach(function (segment) {
33
+ isDiff_1 = _this.removeFromSegment(segment) || isDiff_1;
34
+ });
35
+ return isDiff_1;
36
+ }
37
+ var names = (segmentsData.k || []).map(function (s) { return s.n; }).sort();
38
+ var storedSegmentKeys = this.getRegisteredSegments().sort();
39
+ // Extreme fast => everything is empty
40
+ if (!names.length && !storedSegmentKeys.length)
41
+ return false;
42
+ var index = 0;
43
+ while (index < names.length && index < storedSegmentKeys.length && names[index] === storedSegmentKeys[index])
44
+ index++;
45
+ // Quick path => no changes
46
+ if (index === names.length && index === storedSegmentKeys.length)
47
+ return false;
48
+ // Slowest path => add and/or remove segments
49
+ for (var removeIndex = index; removeIndex < storedSegmentKeys.length; removeIndex++) {
50
+ this.removeFromSegment(storedSegmentKeys[removeIndex]);
51
+ }
52
+ for (var addIndex = index; addIndex < names.length; addIndex++) {
53
+ this.addToSegment(names[addIndex]);
54
+ }
55
+ return true;
56
+ };
23
57
  return AbstractSegmentsCacheSync;
24
58
  }());
25
59
  export { AbstractSegmentsCacheSync };
@@ -42,6 +42,6 @@ export function dataLoaderFactory(preloadedData) {
42
42
  return Array.isArray(userIds) && userIds.indexOf(userId) > -1;
43
43
  });
44
44
  }
45
- storage.segments.resetSegments(mySegmentsData);
45
+ storage.segments.resetSegments({ k: mySegmentsData.map(function (s) { return ({ n: s }); }) });
46
46
  };
47
47
  }
@@ -11,19 +11,11 @@ var MySegmentsCacheInLocal = /** @class */ (function (_super) {
11
11
  return _this;
12
12
  // There is not need to flush segments cache like splits cache, since resetSegments receives the up-to-date list of active segments
13
13
  }
14
- /**
15
- * Removes list of segments from localStorage
16
- * @NOTE this method is not being used at the moment.
17
- */
18
- MySegmentsCacheInLocal.prototype.clear = function () {
19
- this.log.info(LOG_PREFIX + 'Flushing MySegments data from localStorage');
20
- // We cannot simply call `localStorage.clear()` since that implies removing user items from the storage
21
- // We could optimize next sentence, since it implies iterating over all localStorage items
22
- this.resetSegments([]);
23
- };
24
14
  MySegmentsCacheInLocal.prototype.addToSegment = function (name) {
25
15
  var segmentKey = this.keys.buildSegmentNameKey(name);
26
16
  try {
17
+ if (localStorage.getItem(segmentKey) === DEFINED)
18
+ return false;
27
19
  localStorage.setItem(segmentKey, DEFINED);
28
20
  return true;
29
21
  }
@@ -35,6 +27,8 @@ var MySegmentsCacheInLocal = /** @class */ (function (_super) {
35
27
  MySegmentsCacheInLocal.prototype.removeFromSegment = function (name) {
36
28
  var segmentKey = this.keys.buildSegmentNameKey(name);
37
29
  try {
30
+ if (localStorage.getItem(segmentKey) !== DEFINED)
31
+ return false;
38
32
  localStorage.removeItem(segmentKey);
39
33
  return true;
40
34
  }
@@ -46,41 +40,22 @@ var MySegmentsCacheInLocal = /** @class */ (function (_super) {
46
40
  MySegmentsCacheInLocal.prototype.isInSegment = function (name) {
47
41
  return localStorage.getItem(this.keys.buildSegmentNameKey(name)) === DEFINED;
48
42
  };
49
- /**
50
- * Reset (update) the cached list of segments with the given list, removing and adding segments if necessary.
51
- *
52
- * @param {string[]} names list of segment names
53
- * @returns boolean indicating if the cache was updated (i.e., given list was different from the cached one)
54
- */
55
- MySegmentsCacheInLocal.prototype.resetSegments = function (names, changeNumber) {
43
+ MySegmentsCacheInLocal.prototype.getRegisteredSegments = function () {
56
44
  var _this = this;
57
- try {
58
- if (changeNumber) {
59
- localStorage.setItem(this.keys.buildTillKey(), changeNumber + '');
60
- }
61
- else {
62
- localStorage.removeItem(this.keys.buildTillKey());
63
- }
64
- }
65
- catch (e) {
66
- this.log.error(e);
67
- }
68
- var isDiff = false;
69
- var index;
70
45
  // Scan current values from localStorage
71
- var storedSegmentNames = Object.keys(localStorage).reduce(function (accum, key) {
46
+ return Object.keys(localStorage).reduce(function (accum, key) {
72
47
  var segmentName = _this.keys.extractSegmentName(key);
73
48
  if (segmentName) {
74
49
  accum.push(segmentName);
75
50
  }
76
51
  else {
77
- // @TODO @BREAKING: This is only to clean up "old" keys. Remove this whole else code block and reuse `getRegisteredSegments` method.
52
+ // @TODO @BREAKING: This is only to clean up "old" keys. Remove this whole else code block
78
53
  segmentName = _this.keys.extractOldSegmentKey(key);
79
54
  if (segmentName) { // this was an old segment key, let's clean up.
80
55
  var newSegmentKey = _this.keys.buildSegmentNameKey(segmentName);
81
56
  try {
82
57
  // If the new format key is not there, create it.
83
- if (!localStorage.getItem(newSegmentKey) && names.indexOf(segmentName) > -1) {
58
+ if (!localStorage.getItem(newSegmentKey)) {
84
59
  localStorage.setItem(newSegmentKey, DEFINED);
85
60
  // we are migrating a segment, let's track it.
86
61
  accum.push(segmentName);
@@ -94,40 +69,21 @@ var MySegmentsCacheInLocal = /** @class */ (function (_super) {
94
69
  }
95
70
  return accum;
96
71
  }, []);
97
- // Extreme fast => everything is empty
98
- if (names.length === 0 && storedSegmentNames.length === names.length)
99
- return isDiff;
100
- // Quick path
101
- if (storedSegmentNames.length !== names.length) {
102
- isDiff = true;
103
- storedSegmentNames.forEach(function (name) { return _this.removeFromSegment(name); });
104
- names.forEach(function (name) { return _this.addToSegment(name); });
105
- }
106
- else {
107
- // Slowest path => we need to find at least 1 difference because
108
- for (index = 0; index < names.length && storedSegmentNames.indexOf(names[index]) !== -1; index++) {
109
- // TODO: why empty statement?
110
- }
111
- if (index < names.length) {
112
- isDiff = true;
113
- storedSegmentNames.forEach(function (name) { return _this.removeFromSegment(name); });
114
- names.forEach(function (name) { return _this.addToSegment(name); });
115
- }
116
- }
117
- return isDiff;
118
- };
119
- MySegmentsCacheInLocal.prototype.getRegisteredSegments = function () {
120
- var _this = this;
121
- return Object.keys(localStorage).reduce(function (accum, key) {
122
- var segmentName = _this.keys.extractSegmentName(key);
123
- if (segmentName)
124
- accum.push(segmentName);
125
- return accum;
126
- }, []);
127
72
  };
128
73
  MySegmentsCacheInLocal.prototype.getKeysCount = function () {
129
74
  return 1;
130
75
  };
76
+ MySegmentsCacheInLocal.prototype.setChangeNumber = function (name, changeNumber) {
77
+ try {
78
+ if (changeNumber)
79
+ localStorage.setItem(this.keys.buildTillKey(), changeNumber + '');
80
+ else
81
+ localStorage.removeItem(this.keys.buildTillKey());
82
+ }
83
+ catch (e) {
84
+ this.log.error(e);
85
+ }
86
+ };
131
87
  MySegmentsCacheInLocal.prototype.getChangeNumber = function () {
132
88
  var n = -1;
133
89
  var value = localStorage.getItem(this.keys.buildTillKey());
@@ -11,58 +11,23 @@ var MySegmentsCacheInMemory = /** @class */ (function (_super) {
11
11
  _this.segmentCache = {};
12
12
  return _this;
13
13
  }
14
- MySegmentsCacheInMemory.prototype.clear = function () {
15
- this.segmentCache = {};
16
- };
17
14
  MySegmentsCacheInMemory.prototype.addToSegment = function (name) {
15
+ if (this.segmentCache[name])
16
+ return false;
18
17
  this.segmentCache[name] = true;
19
18
  return true;
20
19
  };
21
20
  MySegmentsCacheInMemory.prototype.removeFromSegment = function (name) {
21
+ if (!this.segmentCache[name])
22
+ return false;
22
23
  delete this.segmentCache[name];
23
24
  return true;
24
25
  };
25
26
  MySegmentsCacheInMemory.prototype.isInSegment = function (name) {
26
27
  return this.segmentCache[name] === true;
27
28
  };
28
- /**
29
- * Reset (update) the cached list of segments with the given list, removing and adding segments if necessary.
30
- * @NOTE based on the way we use segments in the browser, this way is the best option
31
- *
32
- * @param {string[]} names list of segment names
33
- * @returns boolean indicating if the cache was updated (i.e., given list was different from the cached one)
34
- */
35
- MySegmentsCacheInMemory.prototype.resetSegments = function (names, changeNumber) {
36
- var _this = this;
29
+ MySegmentsCacheInMemory.prototype.setChangeNumber = function (name, changeNumber) {
37
30
  this.cn = changeNumber;
38
- var isDiff = false;
39
- var index;
40
- var storedSegmentKeys = Object.keys(this.segmentCache);
41
- // Extreme fast => everything is empty
42
- if (names.length === 0 && storedSegmentKeys.length === names.length)
43
- return isDiff;
44
- // Quick path
45
- if (storedSegmentKeys.length !== names.length) {
46
- isDiff = true;
47
- this.segmentCache = {};
48
- names.forEach(function (s) {
49
- _this.addToSegment(s);
50
- });
51
- }
52
- else {
53
- // Slowest path => we need to find at least 1 difference because
54
- for (index = 0; index < names.length && this.isInSegment(names[index]); index++) {
55
- // TODO: why empty statement?
56
- }
57
- if (index < names.length) {
58
- isDiff = true;
59
- this.segmentCache = {};
60
- names.forEach(function (s) {
61
- _this.addToSegment(s);
62
- });
63
- }
64
- }
65
- return isDiff;
66
31
  };
67
32
  MySegmentsCacheInMemory.prototype.getChangeNumber = function () {
68
33
  return this.cn || -1;
@@ -57,7 +57,7 @@ var TelemetryCacheInMemory = /** @class */ (function () {
57
57
  spC: this.splits && this.splits.getSplitNames().length,
58
58
  seC: this.segments && this.segments.getRegisteredSegments().length,
59
59
  skC: this.segments && this.segments.getKeysCount(),
60
- lseC: this.largeSegments && this.largeSegments.getRegisteredSegments().length,
60
+ lsC: this.largeSegments && this.largeSegments.getRegisteredSegments().length,
61
61
  lskC: this.largeSegments && this.largeSegments.getKeysCount(),
62
62
  sL: this.getSessionLength(),
63
63
  eQ: this.getEventStats(QUEUED),
@@ -3,10 +3,10 @@
3
3
  * MySegments fetcher is a wrapper around `mySegments` API service that parses the response and handle errors.
4
4
  */
5
5
  export function mySegmentsFetcherFactory(fetchMemberships) {
6
- return function mySegmentsFetcher(userMatchingKey, noCache,
6
+ return function mySegmentsFetcher(userMatchingKey, noCache, till,
7
7
  // Optional decorator for `fetchMemberships` promise, such as timeout or time tracker
8
8
  decorator) {
9
- var mySegmentsPromise = fetchMemberships(userMatchingKey, noCache);
9
+ var mySegmentsPromise = fetchMemberships(userMatchingKey, noCache, till);
10
10
  if (decorator)
11
11
  mySegmentsPromise = decorator(mySegmentsPromise);
12
12
  return mySegmentsPromise.then(function (resp) { return resp.json(); });
@@ -1,6 +1,7 @@
1
1
  import { timeout } from '../../../utils/promise/timeout';
2
2
  import { SDK_SEGMENTS_ARRIVED } from '../../../readiness/constants';
3
3
  import { SYNC_MYSEGMENTS_FETCH_RETRY } from '../../../logger/constants';
4
+ import { MEMBERSHIPS_LS_UPDATE } from '../../streaming/constants';
4
5
  /**
5
6
  * factory of MySegments updater, a task that:
6
7
  * - fetches mySegments using `mySegmentsFetcher`
@@ -19,26 +20,15 @@ export function mySegmentsUpdaterFactory(log, mySegmentsFetcher, storage, segmen
19
20
  }
20
21
  // @TODO if allowing pluggable storages, handle async execution
21
22
  function updateSegments(segmentsData) {
22
- var _a, _b, _c, _d;
23
23
  var shouldNotifyUpdate;
24
- if (Array.isArray(segmentsData)) {
25
- // Add/Delete the segment names
26
- segmentsData.forEach(function (_a) {
27
- var isLS = _a.isLS, name = _a.name, add = _a.add;
28
- var cache = isLS ? largeSegments : segments;
29
- if (cache.isInSegment(name) !== add) {
30
- shouldNotifyUpdate = true;
31
- if (add)
32
- cache.addToSegment(name);
33
- else
34
- cache.removeFromSegment(name);
35
- }
36
- });
24
+ if (segmentsData.type !== undefined) {
25
+ shouldNotifyUpdate = segmentsData.type === MEMBERSHIPS_LS_UPDATE ?
26
+ largeSegments.resetSegments(segmentsData) :
27
+ segments.resetSegments(segmentsData);
37
28
  }
38
29
  else {
39
- // Reset the list of segment names
40
- shouldNotifyUpdate = segments.resetSegments((((_a = segmentsData.ms) === null || _a === void 0 ? void 0 : _a.k) || []).map(function (segment) { return segment.n; }), (_b = segmentsData.ms) === null || _b === void 0 ? void 0 : _b.cn);
41
- shouldNotifyUpdate = largeSegments.resetSegments((((_c = segmentsData.ls) === null || _c === void 0 ? void 0 : _c.k) || []).map(function (segment) { return segment.n; }), (_d = segmentsData.ls) === null || _d === void 0 ? void 0 : _d.cn) || shouldNotifyUpdate;
30
+ shouldNotifyUpdate = segments.resetSegments(segmentsData.ms || {});
31
+ shouldNotifyUpdate = largeSegments.resetSegments(segmentsData.ls || {}) || shouldNotifyUpdate;
42
32
  }
43
33
  // Notify update if required
44
34
  if (splits.usesSegments() && (shouldNotifyUpdate || readyOnAlreadyExistentState)) {
@@ -46,12 +36,12 @@ export function mySegmentsUpdaterFactory(log, mySegmentsFetcher, storage, segmen
46
36
  segmentsEventEmitter.emit(SDK_SEGMENTS_ARRIVED);
47
37
  }
48
38
  }
49
- function _mySegmentsUpdater(retry, segmentsData, noCache) {
39
+ function _mySegmentsUpdater(retry, segmentsData, noCache, till) {
50
40
  var updaterPromise = segmentsData ?
51
41
  // If segmentsData is provided, there is no need to fetch mySegments
52
42
  new Promise(function (res) { updateSegments(segmentsData); res(true); }) :
53
43
  // If not provided, fetch mySegments
54
- mySegmentsFetcher(matchingKey, noCache, _promiseDecorator).then(function (segments) {
44
+ mySegmentsFetcher(matchingKey, noCache, till, _promiseDecorator).then(function (segments) {
55
45
  // Only when we have downloaded segments completely, we should not keep retrying anymore
56
46
  startingUp = false;
57
47
  updateSegments(segments);
@@ -78,8 +68,9 @@ export function mySegmentsUpdaterFactory(log, mySegmentsFetcher, storage, segmen
78
68
  * (2) an object with a segment name and action (true: add, or false: delete) to update the storage,
79
69
  * (3) or `undefined`, for which the updater will fetch mySegments in order to sync the storage.
80
70
  * @param {boolean | undefined} noCache true to revalidate data to fetch
71
+ * @param {boolean | undefined} till query param to bypass CDN requests
81
72
  */
82
- return function mySegmentsUpdater(segmentsData, noCache) {
83
- return _mySegmentsUpdater(0, segmentsData, noCache);
73
+ return function mySegmentsUpdater(segmentsData, noCache, till) {
74
+ return _mySegmentsUpdater(0, segmentsData, noCache, till);
84
75
  };
85
76
  }
@@ -10,7 +10,7 @@ import { hash } from '../../../utils/murmur3/murmur3';
10
10
  export function authenticateFactory(fetchAuth) {
11
11
  /**
12
12
  * Run authentication requests to Auth Server, and returns a promise that resolves with the decoded JTW token.
13
- * @param {string[] | undefined} userKeys set of user Keys to track MY_SEGMENTS_CHANGES. It is undefined for server-side API.
13
+ * @param {string[] | undefined} userKeys set of user Keys to track membership updates. It is undefined for server-side API.
14
14
  */
15
15
  return function authenticate(userKeys) {
16
16
  return fetchAuth(userKeys)
@@ -1,6 +1,6 @@
1
1
  import { errorParser, messageParser } from './NotificationParser';
2
2
  import { notificationKeeperFactory } from './NotificationKeeper';
3
- import { PUSH_RETRYABLE_ERROR, PUSH_NONRETRYABLE_ERROR, OCCUPANCY, CONTROL, MY_SEGMENTS_UPDATE_V3, SEGMENT_UPDATE, SPLIT_KILL, SPLIT_UPDATE, MY_LARGE_SEGMENTS_UPDATE } from '../constants';
3
+ import { PUSH_RETRYABLE_ERROR, PUSH_NONRETRYABLE_ERROR, OCCUPANCY, CONTROL, SEGMENT_UPDATE, SPLIT_KILL, SPLIT_UPDATE, MEMBERSHIPS_MS_UPDATE, MEMBERSHIPS_LS_UPDATE } from '../constants';
4
4
  import { STREAMING_PARSING_ERROR_FAILS, ERROR_STREAMING_SSE, STREAMING_PARSING_MESSAGE_FAILS, STREAMING_NEW_MESSAGE } from '../../../logger/constants';
5
5
  import { ABLY_ERROR, NON_REQUESTED, SSE_CONNECTION_ERROR } from '../../../utils/constants';
6
6
  /**
@@ -66,18 +66,16 @@ export function SSEHandlerFactory(log, pushEmitter, telemetryTracker) {
66
66
  var parsedData = messageWithParsedData.parsedData, data = messageWithParsedData.data, channel = messageWithParsedData.channel, timestamp = messageWithParsedData.timestamp;
67
67
  log.debug(STREAMING_NEW_MESSAGE, [data]);
68
68
  // we only handle update events if streaming is up
69
- // @ts-expect-error
70
- var type = parsedData.type || parsedData.t;
71
- if (!notificationKeeper.isStreamingUp() && [OCCUPANCY, CONTROL].indexOf(type) === -1)
69
+ if (!notificationKeeper.isStreamingUp() && [OCCUPANCY, CONTROL].indexOf(parsedData.type) === -1)
72
70
  return;
73
- switch (type) {
71
+ switch (parsedData.type) {
74
72
  /* update events */
75
73
  case SPLIT_UPDATE:
76
74
  case SEGMENT_UPDATE:
77
- case MY_SEGMENTS_UPDATE_V3:
78
- case MY_LARGE_SEGMENTS_UPDATE:
75
+ case MEMBERSHIPS_MS_UPDATE:
76
+ case MEMBERSHIPS_LS_UPDATE:
79
77
  case SPLIT_KILL:
80
- pushEmitter.emit(type, parsedData);
78
+ pushEmitter.emit(parsedData.type, parsedData);
81
79
  break;
82
80
  /* occupancy & control events, handled by NotificationManagerKeeper */
83
81
  case OCCUPANCY: