@splitsoftware/splitio-commons 1.17.1-rc.3 → 1.17.1-rc.5

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 (275) hide show
  1. package/CHANGES.txt +28 -28
  2. package/LICENSE +1 -1
  3. package/README.md +4 -3
  4. package/cjs/consent/sdkUserConsent.js +4 -2
  5. package/cjs/evaluator/matchers/index.js +1 -3
  6. package/cjs/evaluator/matchers/matcherTypes.js +0 -1
  7. package/cjs/evaluator/matchers/segment.js +0 -6
  8. package/cjs/evaluator/matchersTransform/index.js +1 -4
  9. package/cjs/evaluator/matchersTransform/segment.js +1 -3
  10. package/cjs/logger/constants.js +2 -2
  11. package/cjs/logger/messages/info.js +1 -1
  12. package/cjs/logger/messages/warn.js +1 -1
  13. package/cjs/readiness/readinessManager.js +11 -12
  14. package/cjs/readiness/sdkReadinessManager.js +6 -5
  15. package/cjs/sdkClient/sdkClient.js +5 -5
  16. package/cjs/sdkClient/sdkClientMethod.js +1 -3
  17. package/cjs/sdkClient/sdkClientMethodCS.js +17 -15
  18. package/cjs/sdkClient/sdkClientMethodCSWithTT.js +17 -15
  19. package/cjs/sdkFactory/index.js +11 -38
  20. package/cjs/services/decorateHeaders.js +6 -1
  21. package/cjs/services/splitApi.js +5 -5
  22. package/cjs/services/splitHttpClient.js +5 -2
  23. package/cjs/storages/AbstractSegmentsCacheSync.js +12 -41
  24. package/cjs/storages/AbstractSplitsCacheAsync.js +7 -0
  25. package/cjs/storages/AbstractSplitsCacheSync.js +8 -2
  26. package/cjs/storages/KeyBuilderCS.js +5 -23
  27. package/cjs/storages/dataLoader.js +33 -65
  28. package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +52 -29
  29. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +9 -1
  30. package/cjs/storages/inLocalStorage/index.js +3 -12
  31. package/cjs/storages/inMemory/InMemoryStorageCS.js +3 -20
  32. package/cjs/storages/inMemory/MySegmentsCacheInMemory.js +40 -9
  33. package/cjs/storages/inMemory/SegmentsCacheInMemory.js +1 -1
  34. package/cjs/storages/inMemory/SplitsCacheInMemory.js +8 -8
  35. package/cjs/storages/inMemory/TelemetryCacheInMemory.js +10 -7
  36. package/cjs/storages/inRedis/RedisAdapter.js +1 -1
  37. package/cjs/storages/inRedis/SegmentsCacheInRedis.js +2 -2
  38. package/cjs/storages/inRedis/index.js +11 -5
  39. package/cjs/storages/pluggable/SegmentsCachePluggable.js +2 -2
  40. package/cjs/storages/pluggable/inMemoryWrapper.js +1 -1
  41. package/cjs/storages/pluggable/index.js +32 -37
  42. package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +7 -2
  43. package/cjs/sync/polling/fetchers/mySegmentsFetcher.js +8 -5
  44. package/cjs/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
  45. package/cjs/sync/polling/pollingManagerCS.js +1 -1
  46. package/cjs/sync/polling/pollingManagerSS.js +3 -3
  47. package/cjs/sync/polling/syncTasks/mySegmentsSyncTask.js +2 -2
  48. package/cjs/sync/polling/updaters/mySegmentsUpdater.js +21 -15
  49. package/cjs/sync/polling/updaters/segmentChangesUpdater.js +2 -2
  50. package/cjs/sync/polling/updaters/splitChangesUpdater.js +11 -2
  51. package/cjs/sync/streaming/AuthClient/index.js +1 -1
  52. package/cjs/sync/streaming/SSEHandler/index.js +5 -3
  53. package/cjs/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +48 -107
  54. package/cjs/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +3 -3
  55. package/cjs/sync/streaming/constants.js +3 -3
  56. package/cjs/sync/streaming/parseUtils.js +9 -14
  57. package/cjs/sync/streaming/pushManager.js +67 -69
  58. package/cjs/sync/syncTask.js +2 -2
  59. package/cjs/trackers/eventTracker.js +9 -11
  60. package/cjs/trackers/impressionsTracker.js +13 -15
  61. package/cjs/trackers/uniqueKeysTracker.js +3 -5
  62. package/cjs/utils/constants/index.js +4 -5
  63. package/cjs/utils/settingsValidation/index.js +1 -2
  64. package/cjs/utils/settingsValidation/storage/storageCS.js +12 -1
  65. package/esm/consent/sdkUserConsent.js +4 -2
  66. package/esm/evaluator/matchers/index.js +1 -3
  67. package/esm/evaluator/matchers/matcherTypes.js +0 -1
  68. package/esm/evaluator/matchers/segment.js +0 -6
  69. package/esm/evaluator/matchersTransform/index.js +1 -4
  70. package/esm/evaluator/matchersTransform/segment.js +1 -3
  71. package/esm/logger/constants.js +1 -1
  72. package/esm/logger/messages/info.js +1 -1
  73. package/esm/logger/messages/warn.js +1 -1
  74. package/esm/readiness/readinessManager.js +11 -12
  75. package/esm/readiness/sdkReadinessManager.js +6 -5
  76. package/esm/sdkClient/sdkClient.js +5 -5
  77. package/esm/sdkClient/sdkClientMethod.js +1 -3
  78. package/esm/sdkClient/sdkClientMethodCS.js +15 -13
  79. package/esm/sdkClient/sdkClientMethodCSWithTT.js +15 -13
  80. package/esm/sdkFactory/index.js +12 -39
  81. package/esm/services/decorateHeaders.js +4 -0
  82. package/esm/services/splitApi.js +6 -6
  83. package/esm/services/splitHttpClient.js +6 -3
  84. package/esm/storages/AbstractSegmentsCacheSync.js +12 -41
  85. package/esm/storages/AbstractSplitsCacheAsync.js +7 -0
  86. package/esm/storages/AbstractSplitsCacheSync.js +9 -3
  87. package/esm/storages/KeyBuilderCS.js +4 -21
  88. package/esm/storages/dataLoader.js +31 -62
  89. package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +52 -29
  90. package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +9 -1
  91. package/esm/storages/inLocalStorage/index.js +5 -14
  92. package/esm/storages/inMemory/InMemoryStorageCS.js +3 -20
  93. package/esm/storages/inMemory/MySegmentsCacheInMemory.js +40 -9
  94. package/esm/storages/inMemory/SegmentsCacheInMemory.js +1 -1
  95. package/esm/storages/inMemory/SplitsCacheInMemory.js +8 -8
  96. package/esm/storages/inMemory/TelemetryCacheInMemory.js +10 -7
  97. package/esm/storages/inRedis/RedisAdapter.js +1 -1
  98. package/esm/storages/inRedis/SegmentsCacheInRedis.js +2 -2
  99. package/esm/storages/inRedis/index.js +11 -5
  100. package/esm/storages/pluggable/SegmentsCachePluggable.js +2 -2
  101. package/esm/storages/pluggable/inMemoryWrapper.js +1 -1
  102. package/esm/storages/pluggable/index.js +32 -37
  103. package/esm/sync/offline/syncTasks/fromObjectSyncTask.js +8 -3
  104. package/esm/sync/polling/fetchers/mySegmentsFetcher.js +8 -5
  105. package/esm/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
  106. package/esm/sync/polling/pollingManagerCS.js +1 -1
  107. package/esm/sync/polling/pollingManagerSS.js +3 -3
  108. package/esm/sync/polling/syncTasks/mySegmentsSyncTask.js +2 -2
  109. package/esm/sync/polling/updaters/mySegmentsUpdater.js +21 -15
  110. package/esm/sync/polling/updaters/segmentChangesUpdater.js +2 -2
  111. package/esm/sync/polling/updaters/splitChangesUpdater.js +12 -3
  112. package/esm/sync/streaming/AuthClient/index.js +1 -1
  113. package/esm/sync/streaming/SSEHandler/index.js +6 -4
  114. package/esm/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +49 -108
  115. package/esm/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +3 -3
  116. package/esm/sync/streaming/constants.js +2 -2
  117. package/esm/sync/streaming/parseUtils.js +8 -12
  118. package/esm/sync/streaming/pushManager.js +70 -72
  119. package/esm/sync/syncTask.js +2 -2
  120. package/esm/trackers/eventTracker.js +9 -11
  121. package/esm/trackers/impressionsTracker.js +13 -15
  122. package/esm/trackers/uniqueKeysTracker.js +3 -5
  123. package/esm/utils/constants/index.js +2 -3
  124. package/esm/utils/settingsValidation/index.js +1 -2
  125. package/esm/utils/settingsValidation/storage/storageCS.js +10 -0
  126. package/package.json +1 -1
  127. package/src/consent/sdkUserConsent.ts +3 -2
  128. package/src/dtos/types.ts +7 -21
  129. package/src/evaluator/matchers/index.ts +0 -2
  130. package/src/evaluator/matchers/matcherTypes.ts +0 -1
  131. package/src/evaluator/matchers/segment.ts +0 -7
  132. package/src/evaluator/matchersTransform/index.ts +1 -4
  133. package/src/evaluator/matchersTransform/segment.ts +3 -5
  134. package/src/logger/constants.ts +1 -1
  135. package/src/logger/messages/info.ts +1 -1
  136. package/src/logger/messages/warn.ts +1 -1
  137. package/src/readiness/readinessManager.ts +12 -16
  138. package/src/readiness/sdkReadinessManager.ts +7 -7
  139. package/src/readiness/types.ts +2 -3
  140. package/src/sdkClient/sdkClient.ts +5 -5
  141. package/src/sdkClient/sdkClientMethod.ts +1 -4
  142. package/src/sdkClient/sdkClientMethodCS.ts +14 -11
  143. package/src/sdkClient/sdkClientMethodCSWithTT.ts +14 -11
  144. package/src/sdkFactory/index.ts +13 -42
  145. package/src/sdkFactory/types.ts +1 -5
  146. package/src/services/decorateHeaders.ts +5 -0
  147. package/src/services/splitApi.ts +7 -7
  148. package/src/services/splitHttpClient.ts +7 -4
  149. package/src/services/types.ts +2 -2
  150. package/src/storages/AbstractSegmentsCacheSync.ts +12 -53
  151. package/src/storages/AbstractSplitsCacheAsync.ts +8 -0
  152. package/src/storages/AbstractSplitsCacheSync.ts +11 -4
  153. package/src/storages/KeyBuilderCS.ts +5 -34
  154. package/src/storages/dataLoader.ts +33 -63
  155. package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +59 -29
  156. package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +10 -1
  157. package/src/storages/inLocalStorage/index.ts +6 -16
  158. package/src/storages/inMemory/InMemoryStorageCS.ts +3 -23
  159. package/src/storages/inMemory/MySegmentsCacheInMemory.ts +44 -10
  160. package/src/storages/inMemory/SegmentsCacheInMemory.ts +1 -1
  161. package/src/storages/inMemory/SplitsCacheInMemory.ts +8 -7
  162. package/src/storages/inMemory/TelemetryCacheInMemory.ts +11 -7
  163. package/src/storages/inRedis/RedisAdapter.ts +1 -1
  164. package/src/storages/inRedis/SegmentsCacheInRedis.ts +2 -2
  165. package/src/storages/inRedis/index.ts +12 -6
  166. package/src/storages/pluggable/SegmentsCachePluggable.ts +2 -2
  167. package/src/storages/pluggable/inMemoryWrapper.ts +1 -1
  168. package/src/storages/pluggable/index.ts +33 -38
  169. package/src/storages/types.ts +15 -15
  170. package/src/sync/offline/syncTasks/fromObjectSyncTask.ts +7 -3
  171. package/src/sync/polling/fetchers/mySegmentsFetcher.ts +10 -8
  172. package/src/sync/polling/fetchers/segmentChangesFetcher.ts +1 -1
  173. package/src/sync/polling/fetchers/types.ts +2 -3
  174. package/src/sync/polling/pollingManagerCS.ts +4 -4
  175. package/src/sync/polling/pollingManagerSS.ts +2 -3
  176. package/src/sync/polling/syncTasks/mySegmentsSyncTask.ts +5 -4
  177. package/src/sync/polling/types.ts +6 -7
  178. package/src/sync/polling/updaters/mySegmentsUpdater.ts +22 -19
  179. package/src/sync/polling/updaters/segmentChangesUpdater.ts +2 -2
  180. package/src/sync/polling/updaters/splitChangesUpdater.ts +12 -4
  181. package/src/sync/streaming/AuthClient/index.ts +1 -1
  182. package/src/sync/streaming/SSEClient/index.ts +6 -4
  183. package/src/sync/streaming/SSEHandler/index.ts +8 -5
  184. package/src/sync/streaming/SSEHandler/types.ts +15 -15
  185. package/src/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.ts +49 -116
  186. package/src/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.ts +4 -4
  187. package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +1 -1
  188. package/src/sync/streaming/UpdateWorkers/types.ts +2 -2
  189. package/src/sync/streaming/constants.ts +2 -2
  190. package/src/sync/streaming/parseUtils.ts +11 -19
  191. package/src/sync/streaming/pushManager.ts +72 -73
  192. package/src/sync/streaming/types.ts +10 -10
  193. package/src/sync/submitters/types.ts +5 -8
  194. package/src/sync/syncTask.ts +2 -2
  195. package/src/trackers/eventTracker.ts +7 -10
  196. package/src/trackers/impressionsTracker.ts +9 -12
  197. package/src/trackers/types.ts +0 -1
  198. package/src/trackers/uniqueKeysTracker.ts +4 -6
  199. package/src/types.ts +9 -16
  200. package/src/utils/constants/index.ts +2 -3
  201. package/src/utils/settingsValidation/index.ts +2 -3
  202. package/src/utils/settingsValidation/storage/storageCS.ts +13 -0
  203. package/src/utils/settingsValidation/types.ts +1 -1
  204. package/types/dtos/types.d.ts +7 -18
  205. package/types/evaluator/matchersTransform/segment.d.ts +2 -2
  206. package/types/logger/constants.d.ts +1 -1
  207. package/types/readiness/readinessManager.d.ts +2 -2
  208. package/types/readiness/sdkReadinessManager.d.ts +3 -2
  209. package/types/readiness/types.d.ts +2 -3
  210. package/types/sdkClient/sdkClientMethod.d.ts +1 -1
  211. package/types/sdkFactory/types.d.ts +1 -4
  212. package/types/services/decorateHeaders.d.ts +1 -0
  213. package/types/services/splitApi.d.ts +1 -1
  214. package/types/services/splitHttpClient.d.ts +1 -1
  215. package/types/services/types.d.ts +2 -2
  216. package/types/storages/AbstractSegmentsCacheSync.d.ts +11 -9
  217. package/types/storages/AbstractSplitsCacheAsync.d.ts +5 -0
  218. package/types/storages/AbstractSplitsCacheSync.d.ts +6 -1
  219. package/types/storages/KeyBuilderCS.d.ts +2 -9
  220. package/types/storages/dataLoader.d.ts +6 -17
  221. package/types/storages/inLocalStorage/MySegmentsCacheInLocal.d.ts +14 -4
  222. package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +6 -0
  223. package/types/storages/inMemory/MySegmentsCacheInMemory.d.ts +9 -3
  224. package/types/storages/inMemory/SegmentsCacheInMemory.d.ts +1 -1
  225. package/types/storages/inMemory/SplitsCacheInMemory.d.ts +1 -1
  226. package/types/storages/inMemory/TelemetryCacheInMemory.d.ts +6 -4
  227. package/types/storages/inRedis/SegmentsCacheInRedis.d.ts +1 -1
  228. package/types/storages/inRedis/index.d.ts +1 -1
  229. package/types/storages/pluggable/SegmentsCachePluggable.d.ts +1 -1
  230. package/types/storages/pluggable/inMemoryWrapper.d.ts +1 -1
  231. package/types/storages/types.d.ts +11 -11
  232. package/types/sync/polling/fetchers/mySegmentsFetcher.d.ts +2 -2
  233. package/types/sync/polling/fetchers/types.d.ts +2 -2
  234. package/types/sync/polling/syncTasks/mySegmentsSyncTask.d.ts +2 -2
  235. package/types/sync/polling/types.d.ts +4 -7
  236. package/types/sync/polling/updaters/mySegmentsUpdater.d.ts +3 -4
  237. package/types/sync/streaming/SSEHandler/types.d.ts +14 -16
  238. package/types/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.d.ts +2 -4
  239. package/types/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.d.ts +1 -2
  240. package/types/sync/streaming/UpdateWorkers/SplitsUpdateWorker.d.ts +2 -3
  241. package/types/sync/streaming/UpdateWorkers/types.d.ts +2 -2
  242. package/types/sync/streaming/constants.d.ts +2 -2
  243. package/types/sync/streaming/parseUtils.d.ts +5 -4
  244. package/types/sync/streaming/types.d.ts +8 -8
  245. package/types/sync/submitters/types.d.ts +4 -7
  246. package/types/trackers/eventTracker.d.ts +1 -1
  247. package/types/trackers/impressionsTracker.d.ts +1 -1
  248. package/types/trackers/types.d.ts +0 -1
  249. package/types/types.d.ts +9 -15
  250. package/types/utils/constants/index.d.ts +2 -3
  251. package/types/utils/settingsValidation/storage/storageCS.d.ts +5 -0
  252. package/types/utils/settingsValidation/types.d.ts +1 -1
  253. package/cjs/evaluator/matchers/large_segment.js +0 -16
  254. package/cjs/sdkClient/identity.js +0 -7
  255. package/esm/evaluator/matchers/large_segment.js +0 -12
  256. package/esm/sdkClient/identity.js +0 -3
  257. package/src/evaluator/matchers/large_segment.ts +0 -18
  258. package/src/sdkClient/identity.ts +0 -5
  259. package/types/evaluator/matchers/large_segment.d.ts +0 -5
  260. package/types/evaluator/matchers/sember_inlist.d.ts +0 -3
  261. package/types/evaluator/matchersTransform/set.d.ts +0 -5
  262. package/types/evaluator/matchersTransform/string.d.ts +0 -7
  263. package/types/sdkClient/identity.d.ts +0 -2
  264. package/types/storages/AbstractMySegmentsCacheSync.d.ts +0 -39
  265. package/types/storages/AbstractSplitsCache.d.ts +0 -46
  266. package/types/sync/streaming/mySegmentsV2utils.d.ts +0 -27
  267. package/types/sync/streaming/pushManagerCS_Spec1_3.d.ts +0 -9
  268. package/types/sync/streaming/pushManager_Spec1_3.d.ts +0 -9
  269. package/types/trackers/impressionObserver/utils.d.ts +0 -5
  270. package/types/utils/inputValidation/sdkKey.d.ts +0 -7
  271. package/types/utils/inputValidation/splitExistance.d.ts +0 -7
  272. package/types/utils/inputValidation/trafficTypeExistance.d.ts +0 -9
  273. package/types/utils/redis/RedisMock.d.ts +0 -4
  274. package/types/utils/settingsValidation/logger/globalLogLevel.d.ts +0 -8
  275. /package/types/utils/{semVer.d.ts → Semver.d.ts} +0 -0
@@ -1,4 +1,4 @@
1
- import { ImpressionDataType, EventDataType, StreamingEvent, Method, OperationType, TelemetryUsageStatsPayload, UpdatesFromSSEEnum, UpdatesFromSSE } from '../../sync/submitters/types';
1
+ import { ImpressionDataType, EventDataType, StreamingEvent, Method, OperationType, TelemetryUsageStatsPayload, UpdatesFromSSEEnum } from '../../sync/submitters/types';
2
2
  import { ISegmentsCacheSync, ISplitsCacheSync, IStorageFactoryParams, ITelemetryCacheSync } from '../types';
3
3
  export declare const MAX_LATENCY_BUCKET_COUNT = 23;
4
4
  export declare function newBuckets(): number[];
@@ -10,8 +10,7 @@ export declare function shouldRecordTelemetry({ settings }: IStorageFactoryParam
10
10
  export declare class TelemetryCacheInMemory implements ITelemetryCacheSync {
11
11
  private splits?;
12
12
  private segments?;
13
- private largeSegments?;
14
- constructor(splits?: ISplitsCacheSync | undefined, segments?: ISegmentsCacheSync | undefined, largeSegments?: ISegmentsCacheSync | undefined);
13
+ constructor(splits?: ISplitsCacheSync | undefined, segments?: ISegmentsCacheSync | undefined);
15
14
  private e;
16
15
  isEmpty(): boolean;
17
16
  clear(): void;
@@ -66,6 +65,9 @@ export declare class TelemetryCacheInMemory implements ITelemetryCacheSync {
66
65
  popLatencies(): Partial<Record<Method, number[]>>;
67
66
  recordLatency(method: Method, latencyMs: number): void;
68
67
  private updatesFromSSE;
69
- popUpdatesFromSSE(): UpdatesFromSSE;
68
+ popUpdatesFromSSE(): {
69
+ sp: number;
70
+ ms: number;
71
+ };
70
72
  recordUpdatesFromSSE(type: UpdatesFromSSEEnum): void;
71
73
  }
@@ -11,7 +11,7 @@ export declare class SegmentsCacheInRedis implements ISegmentsCacheAsync {
11
11
  removeFromSegment(name: string, segmentKeys: string[]): Promise<boolean>;
12
12
  isInSegment(name: string, key: string): Promise<boolean>;
13
13
  setChangeNumber(name: string, changeNumber: number): Promise<boolean>;
14
- getChangeNumber(name: string): Promise<number>;
14
+ getChangeNumber(name: string): Promise<number | undefined>;
15
15
  registerSegments(segments: string[]): Promise<boolean>;
16
16
  getRegisteredSegments(): Promise<string[]>;
17
17
  clear(): Promise<void>;
@@ -4,7 +4,7 @@ export interface InRedisStorageOptions {
4
4
  options?: Record<string, any>;
5
5
  }
6
6
  /**
7
- * InRedis storage factory for consumer server-side SplitFactory, that uses `Ioredis` Redis client for Node.
7
+ * InRedis storage factory for consumer server-side SplitFactory, that uses `Ioredis` Redis client for Node.js
8
8
  * @see {@link https://www.npmjs.com/package/ioredis}
9
9
  */
10
10
  export declare function InRedisStorage(options?: InRedisStorageOptions): IStorageAsyncFactory;
@@ -37,7 +37,7 @@ export declare class SegmentsCachePluggable implements ISegmentsCacheAsync {
37
37
  * The returned promise is resolved with the changeNumber or -1 if it doesn't exist or a wrapper operation fails.
38
38
  * The promise will never be rejected.
39
39
  */
40
- getChangeNumber(name: string): Promise<number>;
40
+ getChangeNumber(name: string): Promise<number | undefined>;
41
41
  /**
42
42
  * Add the given segment names to the set of registered segments.
43
43
  * The returned promise is resolved when the operation success,
@@ -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 immediately.
8
+ * @param connDelay delay in millis for `connect` resolve. If not provided, `connect` resolves inmediatelly.
9
9
  */
10
10
  export declare function inMemoryWrapperFactory(connDelay?: number): IPluggableStorageWrapper & {
11
11
  _cache: Record<string, string | string[] | ISet<string>>;
@@ -1,5 +1,4 @@
1
- import { MaybeThenable, ISplit, IMySegmentsResponse } from '../dtos/types';
2
- import { MySegmentsData } from '../sync/polling/types';
1
+ import { MaybeThenable, ISplit } from '../dtos/types';
3
2
  import { EventDataType, HttpErrors, HttpLatencies, ImpressionDataType, LastSync, Method, MethodExceptions, MethodLatencies, MultiMethodExceptions, MultiMethodLatencies, MultiConfigs, OperationType, StoredEventWithMetadata, StoredImpressionWithMetadata, StreamingEvent, UniqueKeysPayloadCs, UniqueKeysPayloadSs, TelemetryUsageStatsPayload, UpdatesFromSSEEnum } from '../sync/submitters/types';
4
3
  import { SplitIO, ImpressionDTO, ISettings } from '../types';
5
4
  import { ISet } from '../utils/lang/sets';
@@ -192,6 +191,7 @@ export interface ISplitsCacheBase {
192
191
  trafficTypeExists(trafficType: string): MaybeThenable<boolean>;
193
192
  usesSegments(): MaybeThenable<boolean>;
194
193
  clear(): MaybeThenable<boolean | void>;
194
+ checkCache(): MaybeThenable<boolean>;
195
195
  killLocally(name: string, defaultTreatment: string, changeNumber: number): MaybeThenable<boolean>;
196
196
  getNamesByFlagSets(flagSets: string[]): MaybeThenable<ISet<string>[]>;
197
197
  }
@@ -200,13 +200,14 @@ export interface ISplitsCacheSync extends ISplitsCacheBase {
200
200
  removeSplits(names: string[]): boolean[];
201
201
  getSplit(name: string): ISplit | null;
202
202
  getSplits(names: string[]): Record<string, ISplit | null>;
203
- setChangeNumber(changeNumber: number): boolean | void;
203
+ setChangeNumber(changeNumber: number): boolean;
204
204
  getChangeNumber(): number;
205
205
  getAll(): ISplit[];
206
206
  getSplitNames(): string[];
207
207
  trafficTypeExists(trafficType: string): boolean;
208
208
  usesSegments(): boolean;
209
209
  clear(): void;
210
+ checkCache(): boolean;
210
211
  killLocally(name: string, defaultTreatment: string, changeNumber: number): boolean;
211
212
  getNamesByFlagSets(flagSets: string[]): ISet<string>[];
212
213
  }
@@ -222,6 +223,7 @@ export interface ISplitsCacheAsync extends ISplitsCacheBase {
222
223
  trafficTypeExists(trafficType: string): Promise<boolean>;
223
224
  usesSegments(): Promise<boolean>;
224
225
  clear(): Promise<boolean | void>;
226
+ checkCache(): Promise<boolean>;
225
227
  killLocally(name: string, defaultTreatment: string, changeNumber: number): Promise<boolean>;
226
228
  getNamesByFlagSets(flagSets: string[]): Promise<ISet<string>[]>;
227
229
  }
@@ -233,7 +235,7 @@ export interface ISegmentsCacheBase {
233
235
  registerSegments(names: string[]): MaybeThenable<boolean | void>;
234
236
  getRegisteredSegments(): MaybeThenable<string[]>;
235
237
  setChangeNumber(name: string, changeNumber: number): MaybeThenable<boolean | void>;
236
- getChangeNumber(name: string): MaybeThenable<number>;
238
+ getChangeNumber(name: string): MaybeThenable<number | undefined>;
237
239
  clear(): MaybeThenable<boolean | void>;
238
240
  }
239
241
  export interface ISegmentsCacheSync extends ISegmentsCacheBase {
@@ -243,9 +245,9 @@ export interface ISegmentsCacheSync extends ISegmentsCacheBase {
243
245
  registerSegments(names: string[]): boolean;
244
246
  getRegisteredSegments(): string[];
245
247
  getKeysCount(): number;
246
- setChangeNumber(name: string, changeNumber: number): boolean | void;
247
- getChangeNumber(name?: string): number;
248
- resetSegments(segmentsData: MySegmentsData | IMySegmentsResponse): boolean;
248
+ setChangeNumber(name: string, changeNumber: number): boolean;
249
+ getChangeNumber(name: string): number | undefined;
250
+ resetSegments(names: string[]): boolean;
249
251
  clear(): void;
250
252
  }
251
253
  export interface ISegmentsCacheAsync extends ISegmentsCacheBase {
@@ -255,7 +257,7 @@ export interface ISegmentsCacheAsync extends ISegmentsCacheBase {
255
257
  registerSegments(names: string[]): Promise<boolean | void>;
256
258
  getRegisteredSegments(): Promise<string[]>;
257
259
  setChangeNumber(name: string, changeNumber: number): Promise<boolean | void>;
258
- getChangeNumber(name: string): Promise<number>;
260
+ getChangeNumber(name: string): Promise<number | undefined>;
259
261
  clear(): Promise<boolean | void>;
260
262
  }
261
263
  /** Recorder storages (impressions, events and telemetry) */
@@ -382,16 +384,15 @@ export interface IStorageBase<TSplitsCache extends ISplitsCacheBase, TSegmentsCa
382
384
  events: TEventsCache;
383
385
  telemetry?: TTelemetryCache;
384
386
  uniqueKeys?: TUniqueKeysCache;
385
- init?: () => void | Promise<void>;
386
387
  destroy(): void | Promise<void>;
387
388
  shared?: (matchingKey: string, onReadyCb: (error?: any) => void) => this;
388
389
  }
389
390
  export interface IStorageSync extends IStorageBase<ISplitsCacheSync, ISegmentsCacheSync, IImpressionsCacheSync, IImpressionCountsCacheSync, IEventsCacheSync, ITelemetryCacheSync, IUniqueKeysCacheSync> {
390
- largeSegments?: ISegmentsCacheSync;
391
391
  }
392
392
  export interface IStorageAsync extends IStorageBase<ISplitsCacheAsync, ISegmentsCacheAsync, IImpressionsCacheAsync | IImpressionsCacheSync, IImpressionCountsCacheBase, IEventsCacheAsync | IEventsCacheSync, ITelemetryCacheAsync | ITelemetryCacheSync, IUniqueKeysCacheBase> {
393
393
  }
394
394
  /** StorageFactory */
395
+ export declare type DataLoader = (storage: IStorageSync, matchingKey: string) => void;
395
396
  export interface IStorageFactoryParams {
396
397
  settings: ISettings;
397
398
  /**
@@ -399,7 +400,6 @@ export interface IStorageFactoryParams {
399
400
  * It is meant for emitting SDK_READY event in consumer mode, and waiting before using the storage in the synchronizer.
400
401
  */
401
402
  onReadyCb: (error?: any) => void;
402
- onReadyFromCacheCb: (error?: any) => void;
403
403
  }
404
404
  export declare type StorageType = 'MEMORY' | 'LOCALSTORAGE' | 'REDIS' | 'PLUGGABLE';
405
405
  export declare type IStorageSyncFactory = {
@@ -1,7 +1,7 @@
1
- import { IFetchMemberships } from '../../../services/types';
1
+ import { IFetchMySegments } 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(fetchMemberships: IFetchMemberships): IMySegmentsFetcher;
7
+ export declare function mySegmentsFetcherFactory(fetchMySegments: IFetchMySegments): IMySegmentsFetcher;
@@ -1,5 +1,5 @@
1
- import { ISplitChangesResponse, ISegmentChangesResponse, IMembershipsResponse } from '../../../dtos/types';
1
+ import { ISplitChangesResponse, ISegmentChangesResponse } 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, till?: number, decorator?: (promise: Promise<IResponse>) => Promise<IResponse>) => Promise<IMembershipsResponse>;
5
+ export declare type IMySegmentsFetcher = (userMatchingKey: string, noCache?: boolean, decorator?: (promise: Promise<IResponse>) => Promise<IResponse>) => Promise<string[]>;
@@ -1,9 +1,9 @@
1
1
  import { IStorageSync } from '../../../storages/types';
2
2
  import { IReadinessManager } from '../../../readiness/types';
3
3
  import { IMySegmentsSyncTask } from '../types';
4
- import { IFetchMemberships } from '../../../services/types';
4
+ import { IFetchMySegments } from '../../../services/types';
5
5
  import { ISettings } from '../../../types';
6
6
  /**
7
7
  * Creates a sync task that periodically executes a `mySegmentsUpdater` task
8
8
  */
9
- export declare function mySegmentsSyncTaskFactory(fetchMemberships: IFetchMemberships, storage: IStorageSync, readiness: IReadinessManager, settings: ISettings, matchingKey: string): IMySegmentsSyncTask;
9
+ export declare function mySegmentsSyncTaskFactory(fetchMySegments: IFetchMySegments, storage: IStorageSync, readiness: IReadinessManager, settings: ISettings, matchingKey: string): IMySegmentsSyncTask;
@@ -1,7 +1,6 @@
1
1
  import { ISplit } from '../../dtos/types';
2
2
  import { IReadinessManager } from '../../readiness/types';
3
3
  import { IStorageSync } from '../../storages/types';
4
- import { MEMBERSHIPS_LS_UPDATE, MEMBERSHIPS_MS_UPDATE } from '../streaming/types';
5
4
  import { ITask, ISyncTask } from '../types';
6
5
  export interface ISplitsSyncTask extends ISyncTask<[noCache?: boolean, till?: number, splitUpdateNotification?: {
7
6
  payload: ISplit;
@@ -10,13 +9,11 @@ export interface ISplitsSyncTask extends ISyncTask<[noCache?: boolean, till?: nu
10
9
  }
11
10
  export interface ISegmentsSyncTask extends ISyncTask<[fetchOnlyNew?: boolean, segmentName?: string, noCache?: boolean, till?: number], boolean> {
12
11
  }
13
- export declare type MySegmentsData = {
14
- type: MEMBERSHIPS_MS_UPDATE | MEMBERSHIPS_LS_UPDATE;
15
- cn: number;
16
- added: string[];
17
- removed: string[];
12
+ export declare type MySegmentsData = string[] | {
13
+ name: string;
14
+ add: boolean;
18
15
  };
19
- export interface IMySegmentsSyncTask extends ISyncTask<[segmentsData?: MySegmentsData, noCache?: boolean, till?: number], boolean> {
16
+ export interface IMySegmentsSyncTask extends ISyncTask<[segmentsData?: MySegmentsData, noCache?: boolean], boolean> {
20
17
  }
21
18
  export interface IPollingManager extends ITask {
22
19
  syncAll(): Promise<any>;
@@ -1,14 +1,13 @@
1
1
  import { IMySegmentsFetcher } from '../fetchers/types';
2
- import { IStorageSync } from '../../../storages/types';
2
+ import { ISegmentsCacheSync, ISplitsCacheSync } from '../../../storages/types';
3
3
  import { ISegmentsEventEmitter } from '../../../readiness/types';
4
4
  import { ILogger } from '../../../logger/types';
5
- import { MySegmentsData } from '../types';
6
- declare type IMySegmentsUpdater = (segmentsData?: MySegmentsData, noCache?: boolean, till?: number) => Promise<boolean>;
5
+ declare type IMySegmentsUpdater = (segmentList?: string[], noCache?: boolean) => Promise<boolean>;
7
6
  /**
8
7
  * factory of MySegments updater, a task that:
9
8
  * - fetches mySegments using `mySegmentsFetcher`
10
9
  * - updates `mySegmentsCache`
11
10
  * - uses `segmentsEventEmitter` to emit events related to segments data updates
12
11
  */
13
- export declare function mySegmentsUpdaterFactory(log: ILogger, mySegmentsFetcher: IMySegmentsFetcher, storage: IStorageSync, segmentsEventEmitter: ISegmentsEventEmitter, requestTimeoutBeforeReady: number, retriesOnFailureBeforeReady: number, matchingKey: string): IMySegmentsUpdater;
12
+ export declare function mySegmentsUpdaterFactory(log: ILogger, mySegmentsFetcher: IMySegmentsFetcher, splitsCache: ISplitsCacheSync, mySegmentsCache: ISegmentsCacheSync, segmentsEventEmitter: ISegmentsEventEmitter, requestTimeoutBeforeReady: number, retriesOnFailureBeforeReady: number, matchingKey: string): IMySegmentsUpdater;
14
13
  export {};
@@ -1,5 +1,11 @@
1
1
  import { ControlType } from '../constants';
2
- import { SEGMENT_UPDATE, SPLIT_UPDATE, SPLIT_KILL, CONTROL, OCCUPANCY, MEMBERSHIPS_LS_UPDATE, MEMBERSHIPS_MS_UPDATE } from '../types';
2
+ import { MY_SEGMENTS_UPDATE, MY_SEGMENTS_UPDATE_V2, SEGMENT_UPDATE, SPLIT_UPDATE, SPLIT_KILL, CONTROL, OCCUPANCY } from '../types';
3
+ export interface IMySegmentsUpdateData {
4
+ type: MY_SEGMENTS_UPDATE;
5
+ changeNumber: number;
6
+ includesPayload: boolean;
7
+ segmentList?: string[];
8
+ }
3
9
  export declare enum Compression {
4
10
  None = 0,
5
11
  Gzip = 1,
@@ -15,20 +21,13 @@ export interface KeyList {
15
21
  a?: string[];
16
22
  r?: string[];
17
23
  }
18
- interface IMembershipUpdateData<T extends string> {
19
- type: T;
20
- cn: number;
21
- n?: string[];
22
- c?: Compression;
23
- d?: string;
24
+ export interface IMySegmentsUpdateV2Data {
25
+ type: MY_SEGMENTS_UPDATE_V2;
26
+ changeNumber: number;
27
+ segmentName: string;
28
+ c: Compression;
29
+ d: string;
24
30
  u: UpdateStrategy;
25
- i?: number;
26
- h?: number;
27
- s?: number;
28
- }
29
- export interface IMembershipMSUpdateData extends IMembershipUpdateData<MEMBERSHIPS_MS_UPDATE> {
30
- }
31
- export interface IMembershipLSUpdateData extends IMembershipUpdateData<MEMBERSHIPS_LS_UPDATE> {
32
31
  }
33
32
  export interface ISegmentUpdateData {
34
33
  type: SEGMENT_UPDATE;
@@ -58,7 +57,7 @@ export interface IOccupancyData {
58
57
  publishers: number;
59
58
  };
60
59
  }
61
- export declare type INotificationData = IMembershipMSUpdateData | IMembershipLSUpdateData | ISegmentUpdateData | ISplitUpdateData | ISplitKillData | IControlData | IOccupancyData;
60
+ export declare type INotificationData = IMySegmentsUpdateData | IMySegmentsUpdateV2Data | ISegmentUpdateData | ISplitUpdateData | ISplitKillData | IControlData | IOccupancyData;
62
61
  export declare type INotificationMessage = {
63
62
  parsedData: INotificationData;
64
63
  channel: string;
@@ -69,4 +68,3 @@ export declare type INotificationError = Event & {
69
68
  parsedData?: any;
70
69
  message?: string;
71
70
  };
72
- export {};
@@ -1,9 +1,7 @@
1
- import { IMySegmentsSyncTask, MySegmentsData } from '../../polling/types';
1
+ import { IMySegmentsSyncTask } from '../../polling/types';
2
2
  import { IUpdateWorker } from './types';
3
3
  import { ITelemetryTracker } from '../../../trackers/types';
4
- import { IStorageSync } from '../../../storages/types';
5
- import { ILogger } from '../../../logger/types';
6
4
  /**
7
5
  * MySegmentsUpdateWorker factory
8
6
  */
9
- export declare function MySegmentsUpdateWorker(log: ILogger, storage: Pick<IStorageSync, 'segments' | 'largeSegments'>, mySegmentsSyncTask: IMySegmentsSyncTask, telemetryTracker: ITelemetryTracker): IUpdateWorker<[mySegmentsData?: Pick<MySegmentsData, 'type' | 'cn'>, payload?: Pick<MySegmentsData, 'added' | 'removed'>, delay?: number]>;
7
+ export declare function MySegmentsUpdateWorker(mySegmentsSyncTask: IMySegmentsSyncTask, telemetryTracker: ITelemetryTracker): IUpdateWorker;
@@ -1,9 +1,8 @@
1
1
  import { ILogger } from '../../../logger/types';
2
2
  import { ISegmentsCacheSync } from '../../../storages/types';
3
3
  import { ISegmentsSyncTask } from '../../polling/types';
4
- import { ISegmentUpdateData } from '../SSEHandler/types';
5
4
  import { IUpdateWorker } from './types';
6
5
  /**
7
6
  * SegmentsUpdateWorker factory
8
7
  */
9
- export declare function SegmentsUpdateWorker(log: ILogger, segmentsSyncTask: ISegmentsSyncTask, segmentsCache: ISegmentsCacheSync): IUpdateWorker<[ISegmentUpdateData]>;
8
+ export declare function SegmentsUpdateWorker(log: ILogger, segmentsSyncTask: ISegmentsSyncTask, segmentsCache: ISegmentsCacheSync): IUpdateWorker;
@@ -1,14 +1,13 @@
1
- import { ISplit } from '../../../dtos/types';
2
1
  import { ILogger } from '../../../logger/types';
3
2
  import { ISplitsEventEmitter } from '../../../readiness/types';
4
3
  import { ISplitsCacheSync } from '../../../storages/types';
5
4
  import { ITelemetryTracker } from '../../../trackers/types';
6
5
  import { ISegmentsSyncTask, ISplitsSyncTask } from '../../polling/types';
7
- import { ISplitKillData, ISplitUpdateData } from '../SSEHandler/types';
6
+ import { ISplitKillData } from '../SSEHandler/types';
8
7
  import { IUpdateWorker } from './types';
9
8
  /**
10
9
  * SplitsUpdateWorker factory
11
10
  */
12
- export declare function SplitsUpdateWorker(log: ILogger, splitsCache: ISplitsCacheSync, splitsSyncTask: ISplitsSyncTask, splitsEventEmitter: ISplitsEventEmitter, telemetryTracker: ITelemetryTracker, segmentsSyncTask?: ISegmentsSyncTask): IUpdateWorker<[updateData: ISplitUpdateData, payload?: ISplit]> & {
11
+ export declare function SplitsUpdateWorker(log: ILogger, splitsCache: ISplitsCacheSync, splitsSyncTask: ISplitsSyncTask, splitsEventEmitter: ISplitsEventEmitter, telemetryTracker: ITelemetryTracker, segmentsSyncTask?: ISegmentsSyncTask): IUpdateWorker & {
13
12
  killSplit(event: ISplitKillData): void;
14
13
  };
@@ -1,4 +1,4 @@
1
- export interface IUpdateWorker<T extends any[]> {
1
+ export interface IUpdateWorker {
2
2
  stop(): void;
3
- put(...args: T): void;
3
+ put(...args: any[]): void;
4
4
  }
@@ -19,8 +19,8 @@ export declare const PUSH_SUBSYSTEM_UP = "PUSH_SUBSYSTEM_UP";
19
19
  * triggers `startPolling` and `stopWorkers` calls
20
20
  */
21
21
  export declare const PUSH_SUBSYSTEM_DOWN = "PUSH_SUBSYSTEM_DOWN";
22
- export declare const MEMBERSHIPS_MS_UPDATE = "MEMBERSHIPS_MS_UPDATE";
23
- export declare const MEMBERSHIPS_LS_UPDATE = "MEMBERSHIPS_LS_UPDATE";
22
+ export declare const MY_SEGMENTS_UPDATE = "MY_SEGMENTS_UPDATE";
23
+ export declare const MY_SEGMENTS_UPDATE_V2 = "MY_SEGMENTS_UPDATE_V2";
24
24
  export declare const SEGMENT_UPDATE = "SEGMENT_UPDATE";
25
25
  export declare const SPLIT_KILL = "SPLIT_KILL";
26
26
  export declare const SPLIT_UPDATE = "SPLIT_UPDATE";
@@ -1,5 +1,4 @@
1
- import { Compression, IMembershipMSUpdateData, KeyList } from './SSEHandler/types';
2
- import { ISplit } from '../../dtos/types';
1
+ import { Compression, KeyList } from './SSEHandler/types';
3
2
  /**
4
3
  * Decode, decompress and parse the provided 'data' into a KeyList object
5
4
  *
@@ -29,6 +28,8 @@ export declare function parseBitmap(data: string, compression: Compression): Uin
29
28
  export declare function isInBitmap(bitmap: Uint8Array, hash64hex: string): boolean;
30
29
  /**
31
30
  * Parse feature flags notifications for instant feature flag updates
31
+ *
32
+ * @param {ISplitUpdateData} data
33
+ * @returns {KeyList}
32
34
  */
33
- export declare function parseFFUpdatePayload(compression: Compression, data: string): ISplit | undefined;
34
- export declare function getDelay(parsedData: Pick<IMembershipMSUpdateData, 'i' | 'h' | 's'>, matchingKey: string): number;
35
+ export declare function parseFFUpdatePayload(compression: Compression, data: string): KeyList | undefined;
@@ -1,4 +1,4 @@
1
- import { IMembershipMSUpdateData, IMembershipLSUpdateData, ISegmentUpdateData, ISplitUpdateData, ISplitKillData, INotificationData } from './SSEHandler/types';
1
+ import { IMySegmentsUpdateData, IMySegmentsUpdateV2Data, ISegmentUpdateData, ISplitUpdateData, ISplitKillData } from './SSEHandler/types';
2
2
  import { ITask } from '../types';
3
3
  import { IMySegmentsSyncTask } from '../polling/types';
4
4
  import { IEventEmitter } from '../../types';
@@ -7,23 +7,23 @@ export declare type PUSH_SUBSYSTEM_UP = 'PUSH_SUBSYSTEM_UP';
7
7
  export declare type PUSH_SUBSYSTEM_DOWN = 'PUSH_SUBSYSTEM_DOWN';
8
8
  export declare type PUSH_NONRETRYABLE_ERROR = 'PUSH_NONRETRYABLE_ERROR';
9
9
  export declare type PUSH_RETRYABLE_ERROR = 'PUSH_RETRYABLE_ERROR';
10
- export declare type MEMBERSHIPS_MS_UPDATE = 'MEMBERSHIPS_MS_UPDATE';
11
- export declare type MEMBERSHIPS_LS_UPDATE = 'MEMBERSHIPS_LS_UPDATE';
10
+ export declare type MY_SEGMENTS_UPDATE = 'MY_SEGMENTS_UPDATE';
11
+ export declare type MY_SEGMENTS_UPDATE_V2 = 'MY_SEGMENTS_UPDATE_V2';
12
12
  export declare type SEGMENT_UPDATE = 'SEGMENT_UPDATE';
13
13
  export declare type SPLIT_KILL = 'SPLIT_KILL';
14
14
  export declare type SPLIT_UPDATE = 'SPLIT_UPDATE';
15
15
  export declare type CONTROL = 'CONTROL';
16
16
  export declare type OCCUPANCY = 'OCCUPANCY';
17
- export declare type IPushEvent = PUSH_SUBSYSTEM_UP | PUSH_SUBSYSTEM_DOWN | PUSH_NONRETRYABLE_ERROR | PUSH_RETRYABLE_ERROR | MEMBERSHIPS_MS_UPDATE | MEMBERSHIPS_LS_UPDATE | SEGMENT_UPDATE | SPLIT_UPDATE | SPLIT_KILL | ControlType.STREAMING_RESET;
18
- declare type IParsedData<T extends IPushEvent> = T extends MEMBERSHIPS_MS_UPDATE ? IMembershipMSUpdateData : T extends MEMBERSHIPS_LS_UPDATE ? IMembershipLSUpdateData : T extends SEGMENT_UPDATE ? ISegmentUpdateData : T extends SPLIT_UPDATE ? ISplitUpdateData : T extends SPLIT_KILL ? ISplitKillData : INotificationData;
17
+ export declare type IPushEvent = PUSH_SUBSYSTEM_UP | PUSH_SUBSYSTEM_DOWN | PUSH_NONRETRYABLE_ERROR | PUSH_RETRYABLE_ERROR | MY_SEGMENTS_UPDATE | MY_SEGMENTS_UPDATE_V2 | SEGMENT_UPDATE | SPLIT_UPDATE | SPLIT_KILL | ControlType.STREAMING_RESET;
18
+ declare type IParsedData<T extends IPushEvent> = T extends MY_SEGMENTS_UPDATE ? IMySegmentsUpdateData : T extends MY_SEGMENTS_UPDATE_V2 ? IMySegmentsUpdateV2Data : T extends SEGMENT_UPDATE ? ISegmentUpdateData : T extends SPLIT_UPDATE ? ISplitUpdateData : T extends SPLIT_KILL ? ISplitKillData : undefined;
19
19
  /**
20
20
  * EventEmitter used as Feedback Loop between the SyncManager and PushManager,
21
21
  * where the latter pushes messages and the former consumes it
22
22
  */
23
23
  export interface IPushEventEmitter extends IEventEmitter {
24
- once<T extends IPushEvent>(event: T, listener: (parsedData: IParsedData<T>) => void): this;
25
- on<T extends IPushEvent>(event: T, listener: (parsedData: IParsedData<T>) => void): this;
26
- emit<T extends IPushEvent>(event: T, parsedData?: IParsedData<T>): boolean;
24
+ once<T extends IPushEvent>(event: T, listener: (parsedData: IParsedData<T>, channel: T extends MY_SEGMENTS_UPDATE ? string : undefined) => void): this;
25
+ on<T extends IPushEvent>(event: T, listener: (parsedData: IParsedData<T>, channel: T extends MY_SEGMENTS_UPDATE ? string : undefined) => void): this;
26
+ emit<T extends IPushEvent>(event: T, parsedData?: IParsedData<T>, channel?: T extends MY_SEGMENTS_UPDATE ? string : undefined): boolean;
27
27
  }
28
28
  /**
29
29
  * PushManager
@@ -90,7 +90,7 @@ export declare type DROPPED = 1;
90
90
  export declare type DEDUPED = 2;
91
91
  export declare type ImpressionDataType = QUEUED | DROPPED | DEDUPED;
92
92
  export declare type EventDataType = QUEUED | DROPPED;
93
- export declare type UpdatesFromSSEEnum = SPLITS | MEMBERSHIPS;
93
+ export declare type UpdatesFromSSEEnum = SPLITS | MY_SEGMENT;
94
94
  export declare type SPLITS = 'sp';
95
95
  export declare type IMPRESSIONS = 'im';
96
96
  export declare type IMPRESSIONS_COUNT = 'ic';
@@ -98,8 +98,8 @@ export declare type EVENTS = 'ev';
98
98
  export declare type TELEMETRY = 'te';
99
99
  export declare type TOKEN = 'to';
100
100
  export declare type SEGMENT = 'se';
101
- export declare type MEMBERSHIPS = 'ms';
102
- export declare type OperationType = SPLITS | IMPRESSIONS | IMPRESSIONS_COUNT | EVENTS | TELEMETRY | TOKEN | SEGMENT | MEMBERSHIPS;
101
+ export declare type MY_SEGMENT = 'ms';
102
+ export declare type OperationType = SPLITS | IMPRESSIONS | IMPRESSIONS_COUNT | EVENTS | TELEMETRY | TOKEN | SEGMENT | MY_SEGMENT;
103
103
  export declare type LastSync = Partial<Record<OperationType, number | undefined>>;
104
104
  export declare type HttpErrors = Partial<Record<OperationType, {
105
105
  [statusCode: string]: number;
@@ -136,9 +136,8 @@ export declare type TelemetryUsageStats = {
136
136
  mE?: MethodExceptions;
137
137
  };
138
138
  export declare type UpdatesFromSSE = {
139
- sp?: number;
139
+ sp: number;
140
140
  ms?: number;
141
- mls?: number;
142
141
  };
143
142
  export declare type TelemetryUsageStatsPayload = TelemetryUsageStats & {
144
143
  lS: LastSync;
@@ -152,8 +151,6 @@ export declare type TelemetryUsageStatsPayload = TelemetryUsageStats & {
152
151
  spC?: number;
153
152
  seC?: number;
154
153
  skC?: number;
155
- lsC?: number;
156
- lskC?: number;
157
154
  sL?: number;
158
155
  eQ: number;
159
156
  eD: number;
@@ -7,4 +7,4 @@ import { ISettings } from '../types';
7
7
  * @param eventsCache cache to save events
8
8
  * @param integrationsManager optional event handler used for integrations
9
9
  */
10
- export declare function eventTrackerFactory(settings: ISettings, eventsCache: IEventsCacheBase, whenInit: (cb: () => void) => void, integrationsManager?: IEventsHandler, telemetryCache?: ITelemetryCacheSync | ITelemetryCacheAsync): IEventTracker;
10
+ export declare function eventTrackerFactory(settings: ISettings, eventsCache: IEventsCacheBase, integrationsManager?: IEventsHandler, telemetryCache?: ITelemetryCacheSync | ITelemetryCacheAsync): IEventTracker;
@@ -10,4 +10,4 @@ import { ISettings } from '../types';
10
10
  * @param integrationsManager optional integrations manager
11
11
  * @param strategy strategy for impressions tracking.
12
12
  */
13
- export declare function impressionsTrackerFactory(settings: ISettings, impressionsCache: IImpressionsCacheBase, strategy: IStrategy, whenInit: (cb: () => void) => void, integrationsManager?: IImpressionsHandler, telemetryCache?: ITelemetryCacheSync | ITelemetryCacheAsync): IImpressionsTracker;
13
+ export declare function impressionsTrackerFactory(settings: ISettings, impressionsCache: IImpressionsCacheBase, strategy: IStrategy, integrationsManager?: IImpressionsHandler, telemetryCache?: ITelemetryCacheSync | ITelemetryCacheAsync): IImpressionsTracker;
@@ -54,7 +54,6 @@ export interface IImpressionSenderAdapter {
54
54
  }
55
55
  /** Unique keys tracker */
56
56
  export interface IUniqueKeysTracker {
57
- start(): void;
58
57
  stop(): void;
59
58
  track(key: string, featureName: string): void;
60
59
  }
package/types/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ISplit, ISplitFiltersValidation } from './dtos/types';
1
+ import { ISplitFiltersValidation } from './dtos/types';
2
2
  import { IIntegration, IIntegrationFactoryParams } from './integrations/types';
3
3
  import { ILogger } from './logger/types';
4
4
  import { ISdkFactoryContext } from './sdkFactory/types';
@@ -92,7 +92,6 @@ export interface ISettings {
92
92
  eventsFirstPushWindow: number;
93
93
  };
94
94
  readonly storage: IStorageSyncFactory | IStorageAsyncFactory;
95
- readonly preloadedData?: SplitIO.PreloadedData;
96
95
  readonly integrations: Array<{
97
96
  readonly type: string;
98
97
  (params: IIntegrationFactoryParams): IIntegration | void;
@@ -423,7 +422,7 @@ export interface IStatusInterface extends IEventEmitter {
423
422
  * @interface IBasicClient
424
423
  * @extends IStatusInterface
425
424
  */
426
- export interface IBasicClient extends IStatusInterface {
425
+ interface IBasicClient extends IStatusInterface {
427
426
  /**
428
427
  * Flush data
429
428
  * @function flush
@@ -453,12 +452,6 @@ interface IBasicSDK {
453
452
  * @property Logger
454
453
  */
455
454
  Logger: ILoggerAPI;
456
- /**
457
- * Destroy all the clients created by this factory.
458
- * @function destroy
459
- * @returns {Promise<void>}
460
- */
461
- destroy(): Promise<void>;
462
455
  }
463
456
  /****** Exposed namespace ******/
464
457
  /**
@@ -771,19 +764,21 @@ export declare namespace SplitIO {
771
764
  * If this value is older than 10 days ago (expiration time policy), the data is not used to update the storage content.
772
765
  * @TODO configurable expiration time policy?
773
766
  */
767
+ lastUpdated: number;
774
768
  /**
775
769
  * Change number of the preloaded data.
776
770
  * If this value is older than the current changeNumber at the storage, the data is not used to update the storage content.
777
771
  */
778
772
  since: number;
779
773
  /**
780
- * List of feature flag definitions.
781
- * @TODO rename to flags
774
+ * Map of feature flags to their stringified definitions.
782
775
  */
783
- splitsData: ISplit[];
776
+ splitsData: {
777
+ [splitName: string]: string;
778
+ };
784
779
  /**
785
780
  * Optional map of user keys to their list of segments.
786
- * @TODO rename to memberships
781
+ * @TODO remove when releasing first version
787
782
  */
788
783
  mySegmentsData?: {
789
784
  [key: string]: string[];
@@ -791,10 +786,9 @@ export declare namespace SplitIO {
791
786
  /**
792
787
  * Optional map of segments to their stringified definitions.
793
788
  * This property is ignored if `mySegmentsData` was provided.
794
- * @TODO rename to segments
795
789
  */
796
790
  segmentsData?: {
797
- [segmentName: string]: string[];
791
+ [segmentName: string]: string;
798
792
  };
799
793
  }
800
794
  /**
@@ -52,7 +52,7 @@ export declare const EVENTS = "ev";
52
52
  export declare const TELEMETRY = "te";
53
53
  export declare const TOKEN = "to";
54
54
  export declare const SEGMENT = "se";
55
- export declare const MEMBERSHIPS = "ms";
55
+ export declare const MY_SEGMENT = "ms";
56
56
  export declare const TREATMENT = "t";
57
57
  export declare const TREATMENTS = "ts";
58
58
  export declare const TREATMENT_WITH_CONFIG = "tc";
@@ -78,6 +78,5 @@ export declare const NON_REQUESTED = 1;
78
78
  export declare const DISABLED = 0;
79
79
  export declare const ENABLED = 1;
80
80
  export declare const PAUSED = 2;
81
- export declare const FLAG_SPEC_VERSION = "1.2";
81
+ export declare const FLAG_SPEC_VERSION = "1.1";
82
82
  export declare const IN_SEGMENT = "IN_SEGMENT";
83
- export declare const IN_LARGE_SEGMENT = "IN_LARGE_SEGMENT";
@@ -1,5 +1,10 @@
1
1
  import { ISettings, SDKMode } from '../../../types';
2
2
  import { ILogger } from '../../../logger/types';
3
+ import { IStorageFactoryParams, IStorageSync } from '../../../storages/types';
4
+ export declare function __InLocalStorageMockFactory(params: IStorageFactoryParams): IStorageSync;
5
+ export declare namespace __InLocalStorageMockFactory {
6
+ var type: import("../../../storages/types").StorageType;
7
+ }
3
8
  /**
4
9
  * This function validates `settings.storage` object
5
10
  *
@@ -28,7 +28,7 @@ export interface ISettingsValidationParams {
28
28
  /** Localhost mode validator (`settings.sync.localhostMode`) */
29
29
  localhost?: (settings: ISettings) => ISettings['sync']['localhostMode'];
30
30
  /** User consent validator (`settings.userConsent`) */
31
- consent?: (settings: ISettings) => ISettings['userConsent'];
31
+ consent: (settings: ISettings) => ISettings['userConsent'];
32
32
  /** Flag spec version validation. Configurable by the JS Synchronizer but not by the SDKs */
33
33
  flagSpec?: (settings: ISettings) => ISettings['sync']['flagSpecVersion'];
34
34
  }
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.largeSegmentMatcherContext = void 0;
4
- var thenable_1 = require("../../utils/promise/thenable");
5
- function largeSegmentMatcherContext(largeSegmentName, storage) {
6
- return function largeSegmentMatcher(key) {
7
- var isInLargeSegment = storage.largeSegments ? storage.largeSegments.isInSegment(largeSegmentName, key) : false;
8
- if ((0, thenable_1.thenable)(isInLargeSegment)) {
9
- isInLargeSegment.then(function (result) {
10
- return result;
11
- });
12
- }
13
- return isInLargeSegment;
14
- };
15
- }
16
- exports.largeSegmentMatcherContext = largeSegmentMatcherContext;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildInstanceId = void 0;
4
- function buildInstanceId(key, trafficType) {
5
- return (key.matchingKey ? key.matchingKey : key) + "-" + (key.bucketingKey ? key.bucketingKey : key) + "-" + (trafficType ? trafficType : '');
6
- }
7
- exports.buildInstanceId = buildInstanceId;