@splitsoftware/splitio-commons 2.0.0-rc.4 → 2.0.0-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 (272) hide show
  1. package/CHANGES.txt +1 -0
  2. package/cjs/integrations/pluggable.js +2 -2
  3. package/cjs/logger/sdkLogger.js +2 -2
  4. package/cjs/readiness/sdkReadinessManager.js +2 -21
  5. package/cjs/sdkClient/client.js +0 -1
  6. package/cjs/sdkClient/clientAttributesDecoration.js +9 -9
  7. package/cjs/sdkClient/clientCS.js +2 -2
  8. package/cjs/services/splitApi.js +13 -13
  9. package/cjs/services/splitHttpClient.js +2 -2
  10. package/cjs/storages/AbstractSplitsCacheAsync.js +1 -4
  11. package/cjs/storages/AbstractSplitsCacheSync.js +1 -4
  12. package/cjs/storages/dataLoader.js +5 -6
  13. package/cjs/storages/findLatencyIndex.js +1 -1
  14. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +1 -6
  15. package/cjs/storages/inMemory/AttributesCacheInMemory.js +10 -10
  16. package/cjs/storages/inMemory/EventsCacheInMemory.js +1 -1
  17. package/cjs/storages/inMemory/ImpressionsCacheInMemory.js +1 -1
  18. package/cjs/storages/inMemory/InMemoryStorage.js +1 -1
  19. package/cjs/storages/inMemory/InMemoryStorageCS.js +1 -1
  20. package/cjs/storages/inMemory/UniqueKeysCacheInMemoryCS.js +1 -1
  21. package/cjs/storages/inRedis/SplitsCacheInRedis.js +1 -3
  22. package/cjs/storages/inRedis/TelemetryCacheInRedis.js +3 -3
  23. package/cjs/storages/inRedis/UniqueKeysCacheInRedis.js +1 -1
  24. package/cjs/storages/pluggable/EventsCachePluggable.js +1 -1
  25. package/cjs/storages/pluggable/ImpressionsCachePluggable.js +1 -1
  26. package/cjs/storages/pluggable/SegmentsCachePluggable.js +1 -1
  27. package/cjs/storages/pluggable/SplitsCachePluggable.js +3 -3
  28. package/cjs/storages/pluggable/TelemetryCachePluggable.js +3 -3
  29. package/cjs/storages/pluggable/UniqueKeysCachePluggable.js +1 -1
  30. package/cjs/storages/pluggable/inMemoryWrapper.js +1 -1
  31. package/cjs/storages/pluggable/index.js +1 -1
  32. package/cjs/storages/pluggable/wrapperAdapter.js +2 -2
  33. package/cjs/sync/offline/splitsParser/splitsParserFromSettings.js +1 -1
  34. package/cjs/sync/offline/syncManagerOffline.js +1 -1
  35. package/cjs/sync/polling/updaters/mySegmentsUpdater.js +3 -3
  36. package/cjs/sync/polling/updaters/segmentChangesUpdater.js +8 -8
  37. package/cjs/sync/polling/updaters/splitChangesUpdater.js +13 -13
  38. package/cjs/sync/streaming/AuthClient/index.js +2 -2
  39. package/cjs/sync/streaming/SSEClient/index.js +4 -7
  40. package/cjs/sync/streaming/SSEHandler/NotificationKeeper.js +1 -1
  41. package/cjs/sync/streaming/SSEHandler/NotificationParser.js +5 -4
  42. package/cjs/sync/streaming/SSEHandler/index.js +2 -2
  43. package/cjs/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +3 -3
  44. package/cjs/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +2 -2
  45. package/cjs/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +4 -4
  46. package/cjs/sync/streaming/parseUtils.js +13 -13
  47. package/cjs/sync/syncManagerOnline.js +2 -2
  48. package/cjs/sync/syncTask.js +4 -4
  49. package/cjs/trackers/eventTracker.js +2 -2
  50. package/cjs/trackers/impressionsTracker.js +5 -5
  51. package/cjs/trackers/strategy/strategyDebug.js +1 -1
  52. package/cjs/trackers/strategy/strategyNone.js +2 -2
  53. package/cjs/trackers/strategy/strategyOptimized.js +2 -2
  54. package/cjs/trackers/uniqueKeysTracker.js +3 -3
  55. package/cjs/utils/Backoff.js +0 -4
  56. package/cjs/utils/Semver.js +1 -1
  57. package/cjs/utils/base64/index.js +2 -2
  58. package/cjs/utils/decompress/index.js +4 -4
  59. package/cjs/utils/lang/binarySearch.js +2 -2
  60. package/cjs/utils/murmur3/murmur3_128.js +1 -1
  61. package/cjs/utils/murmur3/murmur3_128_x86.js +1 -1
  62. package/cjs/utils/murmur3/murmur3_64.js +1 -1
  63. package/cjs/utils/murmur3/utfx.js +10 -17
  64. package/cjs/utils/promise/wrapper.js +2 -2
  65. package/cjs/utils/settingsValidation/index.js +2 -2
  66. package/cjs/utils/settingsValidation/integrations/common.js +4 -4
  67. package/cjs/utils/settingsValidation/integrations/configurable.js +3 -3
  68. package/cjs/utils/settingsValidation/integrations/pluggable.js +2 -2
  69. package/cjs/utils/settingsValidation/logger/builtinLogger.js +1 -1
  70. package/cjs/utils/settingsValidation/logger/commons.js +1 -1
  71. package/cjs/utils/settingsValidation/logger/pluggableLogger.js +1 -1
  72. package/cjs/utils/settingsValidation/splitFilters.js +8 -11
  73. package/cjs/utils/settingsValidation/storage/storageCS.js +2 -2
  74. package/cjs/utils/settingsValidation/url.js +3 -3
  75. package/esm/integrations/pluggable.js +2 -2
  76. package/esm/logger/sdkLogger.js +2 -2
  77. package/esm/readiness/sdkReadinessManager.js +2 -21
  78. package/esm/sdkClient/client.js +0 -1
  79. package/esm/sdkClient/clientAttributesDecoration.js +9 -9
  80. package/esm/sdkClient/clientCS.js +2 -2
  81. package/esm/services/splitApi.js +13 -13
  82. package/esm/services/splitHttpClient.js +2 -2
  83. package/esm/storages/AbstractSplitsCacheAsync.js +1 -4
  84. package/esm/storages/AbstractSplitsCacheSync.js +1 -4
  85. package/esm/storages/dataLoader.js +5 -6
  86. package/esm/storages/findLatencyIndex.js +1 -1
  87. package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +1 -6
  88. package/esm/storages/inMemory/AttributesCacheInMemory.js +10 -10
  89. package/esm/storages/inMemory/EventsCacheInMemory.js +1 -1
  90. package/esm/storages/inMemory/ImpressionsCacheInMemory.js +1 -1
  91. package/esm/storages/inMemory/InMemoryStorage.js +1 -1
  92. package/esm/storages/inMemory/InMemoryStorageCS.js +1 -1
  93. package/esm/storages/inMemory/UniqueKeysCacheInMemoryCS.js +1 -1
  94. package/esm/storages/inRedis/SplitsCacheInRedis.js +1 -3
  95. package/esm/storages/inRedis/TelemetryCacheInRedis.js +3 -3
  96. package/esm/storages/inRedis/UniqueKeysCacheInRedis.js +1 -1
  97. package/esm/storages/pluggable/EventsCachePluggable.js +1 -1
  98. package/esm/storages/pluggable/ImpressionsCachePluggable.js +1 -1
  99. package/esm/storages/pluggable/SegmentsCachePluggable.js +1 -1
  100. package/esm/storages/pluggable/SplitsCachePluggable.js +3 -3
  101. package/esm/storages/pluggable/TelemetryCachePluggable.js +3 -3
  102. package/esm/storages/pluggable/UniqueKeysCachePluggable.js +1 -1
  103. package/esm/storages/pluggable/inMemoryWrapper.js +1 -1
  104. package/esm/storages/pluggable/index.js +1 -1
  105. package/esm/storages/pluggable/wrapperAdapter.js +2 -2
  106. package/esm/sync/offline/splitsParser/splitsParserFromSettings.js +1 -1
  107. package/esm/sync/offline/syncManagerOffline.js +1 -1
  108. package/esm/sync/polling/updaters/mySegmentsUpdater.js +3 -3
  109. package/esm/sync/polling/updaters/segmentChangesUpdater.js +8 -8
  110. package/esm/sync/polling/updaters/splitChangesUpdater.js +13 -13
  111. package/esm/sync/streaming/AuthClient/index.js +2 -2
  112. package/esm/sync/streaming/SSEClient/index.js +4 -7
  113. package/esm/sync/streaming/SSEHandler/NotificationKeeper.js +1 -1
  114. package/esm/sync/streaming/SSEHandler/NotificationParser.js +5 -4
  115. package/esm/sync/streaming/SSEHandler/index.js +2 -2
  116. package/esm/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +3 -3
  117. package/esm/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +2 -2
  118. package/esm/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +4 -4
  119. package/esm/sync/streaming/parseUtils.js +13 -13
  120. package/esm/sync/syncManagerOnline.js +2 -2
  121. package/esm/sync/syncTask.js +4 -4
  122. package/esm/trackers/eventTracker.js +2 -2
  123. package/esm/trackers/impressionsTracker.js +5 -5
  124. package/esm/trackers/strategy/strategyDebug.js +1 -1
  125. package/esm/trackers/strategy/strategyNone.js +2 -2
  126. package/esm/trackers/strategy/strategyOptimized.js +2 -2
  127. package/esm/trackers/uniqueKeysTracker.js +3 -3
  128. package/esm/utils/Backoff.js +0 -4
  129. package/esm/utils/Semver.js +1 -1
  130. package/esm/utils/base64/index.js +2 -2
  131. package/esm/utils/decompress/index.js +4 -4
  132. package/esm/utils/lang/binarySearch.js +2 -2
  133. package/esm/utils/murmur3/murmur3_128.js +1 -1
  134. package/esm/utils/murmur3/murmur3_128_x86.js +1 -1
  135. package/esm/utils/murmur3/murmur3_64.js +1 -1
  136. package/esm/utils/murmur3/utfx.js +10 -17
  137. package/esm/utils/promise/wrapper.js +2 -2
  138. package/esm/utils/settingsValidation/index.js +2 -2
  139. package/esm/utils/settingsValidation/integrations/common.js +4 -4
  140. package/esm/utils/settingsValidation/integrations/configurable.js +3 -3
  141. package/esm/utils/settingsValidation/integrations/pluggable.js +2 -2
  142. package/esm/utils/settingsValidation/logger/builtinLogger.js +1 -1
  143. package/esm/utils/settingsValidation/logger/commons.js +1 -1
  144. package/esm/utils/settingsValidation/logger/pluggableLogger.js +1 -1
  145. package/esm/utils/settingsValidation/splitFilters.js +8 -11
  146. package/esm/utils/settingsValidation/storage/storageCS.js +2 -2
  147. package/esm/utils/settingsValidation/url.js +3 -3
  148. package/package.json +3 -2
  149. package/src/dtos/types.ts +1 -1
  150. package/src/evaluator/Engine.ts +1 -1
  151. package/src/evaluator/combiners/ifelseif.ts +1 -1
  152. package/src/evaluator/condition/index.ts +1 -1
  153. package/src/evaluator/index.ts +1 -1
  154. package/src/evaluator/parser/index.ts +1 -1
  155. package/src/evaluator/types.ts +1 -1
  156. package/src/evaluator/value/index.ts +1 -1
  157. package/src/evaluator/value/sanitize.ts +1 -1
  158. package/src/integrations/pluggable.ts +3 -3
  159. package/src/integrations/types.ts +3 -2
  160. package/src/listeners/browser.ts +3 -2
  161. package/src/logger/index.ts +6 -6
  162. package/src/logger/sdkLogger.ts +4 -4
  163. package/src/logger/types.ts +11 -13
  164. package/src/readiness/readinessManager.ts +5 -4
  165. package/src/readiness/sdkReadinessManager.ts +6 -23
  166. package/src/readiness/types.ts +5 -4
  167. package/src/sdkClient/client.ts +7 -8
  168. package/src/sdkClient/clientAttributesDecoration.ts +11 -11
  169. package/src/sdkClient/clientCS.ts +5 -5
  170. package/src/sdkClient/clientInputValidation.ts +3 -2
  171. package/src/sdkClient/identity.ts +1 -1
  172. package/src/sdkClient/sdkClient.ts +3 -3
  173. package/src/sdkClient/sdkClientMethod.ts +2 -2
  174. package/src/sdkClient/sdkClientMethodCS.ts +5 -5
  175. package/src/sdkFactory/index.ts +3 -3
  176. package/src/sdkFactory/types.ts +7 -6
  177. package/src/sdkManager/index.ts +2 -1
  178. package/src/services/splitApi.ts +13 -13
  179. package/src/services/splitHttpClient.ts +2 -2
  180. package/src/storages/AbstractMySegmentsCacheSync.ts +1 -1
  181. package/src/storages/AbstractSplitsCacheAsync.ts +1 -4
  182. package/src/storages/AbstractSplitsCacheSync.ts +1 -4
  183. package/src/storages/dataLoader.ts +7 -8
  184. package/src/storages/findLatencyIndex.ts +1 -1
  185. package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +1 -6
  186. package/src/storages/inMemory/AttributesCacheInMemory.ts +11 -11
  187. package/src/storages/inMemory/EventsCacheInMemory.ts +2 -2
  188. package/src/storages/inMemory/ImpressionsCacheInMemory.ts +5 -5
  189. package/src/storages/inMemory/InMemoryStorage.ts +1 -1
  190. package/src/storages/inMemory/InMemoryStorageCS.ts +1 -1
  191. package/src/storages/inMemory/UniqueKeysCacheInMemoryCS.ts +1 -1
  192. package/src/storages/inRedis/EventsCacheInRedis.ts +1 -1
  193. package/src/storages/inRedis/ImpressionsCacheInRedis.ts +2 -2
  194. package/src/storages/inRedis/SplitsCacheInRedis.ts +1 -3
  195. package/src/storages/inRedis/TelemetryCacheInRedis.ts +3 -3
  196. package/src/storages/inRedis/UniqueKeysCacheInRedis.ts +1 -1
  197. package/src/storages/pluggable/EventsCachePluggable.ts +2 -2
  198. package/src/storages/pluggable/ImpressionsCachePluggable.ts +3 -3
  199. package/src/storages/pluggable/SegmentsCachePluggable.ts +1 -1
  200. package/src/storages/pluggable/SplitsCachePluggable.ts +3 -3
  201. package/src/storages/pluggable/TelemetryCachePluggable.ts +3 -3
  202. package/src/storages/pluggable/UniqueKeysCachePluggable.ts +1 -1
  203. package/src/storages/pluggable/inMemoryWrapper.ts +1 -1
  204. package/src/storages/pluggable/index.ts +1 -1
  205. package/src/storages/pluggable/wrapperAdapter.ts +2 -2
  206. package/src/storages/types.ts +51 -68
  207. package/src/storages/utils.ts +3 -2
  208. package/src/sync/offline/splitsParser/splitsParserFromSettings.ts +3 -3
  209. package/src/sync/offline/syncManagerOffline.ts +1 -1
  210. package/src/sync/polling/updaters/mySegmentsUpdater.ts +3 -3
  211. package/src/sync/polling/updaters/segmentChangesUpdater.ts +8 -8
  212. package/src/sync/polling/updaters/splitChangesUpdater.ts +13 -13
  213. package/src/sync/streaming/AuthClient/index.ts +2 -2
  214. package/src/sync/streaming/SSEClient/index.ts +4 -7
  215. package/src/sync/streaming/SSEHandler/NotificationKeeper.ts +1 -1
  216. package/src/sync/streaming/SSEHandler/NotificationParser.ts +5 -4
  217. package/src/sync/streaming/SSEHandler/index.ts +2 -2
  218. package/src/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.ts +3 -3
  219. package/src/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.ts +2 -2
  220. package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +4 -4
  221. package/src/sync/streaming/parseUtils.ts +13 -13
  222. package/src/sync/streaming/types.ts +2 -2
  223. package/src/sync/submitters/impressionsSubmitter.ts +2 -2
  224. package/src/sync/submitters/telemetrySubmitter.ts +4 -3
  225. package/src/sync/submitters/types.ts +1 -1
  226. package/src/sync/syncManagerOnline.ts +2 -2
  227. package/src/sync/syncTask.ts +4 -4
  228. package/src/trackers/eventTracker.ts +4 -3
  229. package/src/trackers/impressionObserver/ImpressionObserver.ts +4 -4
  230. package/src/trackers/impressionObserver/buildKey.ts +2 -2
  231. package/src/trackers/impressionObserver/impressionObserverCS.ts +2 -2
  232. package/src/trackers/impressionObserver/impressionObserverSS.ts +2 -2
  233. package/src/trackers/impressionObserver/types.ts +2 -2
  234. package/src/trackers/impressionsTracker.ts +8 -7
  235. package/src/trackers/strategy/strategyDebug.ts +3 -3
  236. package/src/trackers/strategy/strategyNone.ts +4 -4
  237. package/src/trackers/strategy/strategyOptimized.ts +5 -5
  238. package/src/trackers/types.ts +5 -5
  239. package/src/trackers/uniqueKeysTracker.ts +3 -3
  240. package/src/types.ts +37 -1355
  241. package/src/utils/Backoff.ts +0 -4
  242. package/src/utils/MinEventEmitter.ts +2 -3
  243. package/src/utils/MinEvents.ts +2 -2
  244. package/src/utils/Semver.ts +1 -1
  245. package/src/utils/base64/index.ts +2 -2
  246. package/src/utils/constants/index.ts +9 -10
  247. package/src/utils/decompress/index.ts +4 -4
  248. package/src/utils/inputValidation/attributes.ts +1 -1
  249. package/src/utils/inputValidation/eventProperties.ts +1 -1
  250. package/src/utils/inputValidation/key.ts +1 -1
  251. package/src/utils/inputValidation/preloadedData.ts +1 -2
  252. package/src/utils/inputValidation/trafficTypeExistence.ts +2 -2
  253. package/src/utils/key/index.ts +1 -1
  254. package/src/utils/lang/binarySearch.ts +2 -2
  255. package/src/utils/murmur3/murmur3_128.ts +1 -1
  256. package/src/utils/murmur3/murmur3_128_x86.ts +1 -1
  257. package/src/utils/murmur3/murmur3_64.ts +1 -1
  258. package/src/utils/murmur3/utfx.ts +10 -17
  259. package/src/utils/promise/wrapper.ts +2 -2
  260. package/src/utils/settingsValidation/consent.ts +2 -2
  261. package/src/utils/settingsValidation/impressionsMode.ts +1 -1
  262. package/src/utils/settingsValidation/index.ts +2 -2
  263. package/src/utils/settingsValidation/integrations/common.ts +4 -4
  264. package/src/utils/settingsValidation/integrations/configurable.ts +3 -3
  265. package/src/utils/settingsValidation/integrations/pluggable.ts +2 -2
  266. package/src/utils/settingsValidation/logger/builtinLogger.ts +3 -3
  267. package/src/utils/settingsValidation/logger/commons.ts +3 -3
  268. package/src/utils/settingsValidation/logger/pluggableLogger.ts +3 -3
  269. package/src/utils/settingsValidation/splitFilters.ts +9 -12
  270. package/src/utils/settingsValidation/storage/storageCS.ts +5 -4
  271. package/src/utils/settingsValidation/url.ts +3 -3
  272. package/types/splitio.d.ts +885 -1237
@@ -1,4 +1,4 @@
1
- import { SplitIO } from '../../types';
1
+ import SplitIO from '../../../types/splitio';
2
2
  import { IEventsCacheSync } from '../types';
3
3
 
4
4
  const MAX_QUEUE_BYTE_SIZE = 5 * 1024 * 1024; // 5M
@@ -12,7 +12,7 @@ export class EventsCacheInMemory implements IEventsCacheSync {
12
12
 
13
13
  /**
14
14
  *
15
- * @param eventsQueueSize number of queued events to call onFullQueueCb.
15
+ * @param eventsQueueSize - number of queued events to call onFullQueueCb.
16
16
  * Default value is 0, that means no maximum value, in case we want to avoid this being triggered.
17
17
  */
18
18
  constructor(eventsQueueSize: number = 0) {
@@ -1,15 +1,15 @@
1
1
  import { IImpressionsCacheSync } from '../types';
2
- import { ImpressionDTO } from '../../types';
2
+ import SplitIO from '../../../types/splitio';
3
3
 
4
4
  export class ImpressionsCacheInMemory implements IImpressionsCacheSync {
5
5
 
6
6
  private onFullQueue?: () => void;
7
7
  private readonly maxQueue: number;
8
- private queue: ImpressionDTO[];
8
+ private queue: SplitIO.ImpressionDTO[];
9
9
 
10
10
  /**
11
11
  *
12
- * @param impressionsQueueSize number of queued impressions to call onFullQueueCb.
12
+ * @param impressionsQueueSize - number of queued impressions to call onFullQueueCb.
13
13
  * Default value is 0, that means no maximum value, in case we want to avoid this being triggered.
14
14
  */
15
15
  constructor(impressionsQueueSize: number = 0) {
@@ -24,7 +24,7 @@ export class ImpressionsCacheInMemory implements IImpressionsCacheSync {
24
24
  /**
25
25
  * Store impressions in sequential order
26
26
  */
27
- track(data: ImpressionDTO[]) {
27
+ track(data: SplitIO.ImpressionDTO[]) {
28
28
  this.queue.push(...data);
29
29
 
30
30
  // Check if the cache queue is full and we need to flush it.
@@ -43,7 +43,7 @@ export class ImpressionsCacheInMemory implements IImpressionsCacheSync {
43
43
  /**
44
44
  * Pop the collected data, used as payload for posting.
45
45
  */
46
- pop(toMerge?: ImpressionDTO[]) {
46
+ pop(toMerge?: SplitIO.ImpressionDTO[]) {
47
47
  const data = this.queue;
48
48
  this.clear();
49
49
  return toMerge ? toMerge.concat(data) : data;
@@ -11,7 +11,7 @@ import { UniqueKeysCacheInMemory } from './UniqueKeysCacheInMemory';
11
11
  /**
12
12
  * InMemory storage factory for standalone server-side SplitFactory
13
13
  *
14
- * @param params parameters required by EventsCacheSync
14
+ * @param params - parameters required by EventsCacheSync
15
15
  */
16
16
  export function InMemoryStorageFactory(params: IStorageFactoryParams): IStorageSync {
17
17
  const { settings: { scheduler: { impressionsQueueSize, eventsQueueSize, }, sync: { impressionsMode, __splitFiltersValidation } } } = params;
@@ -11,7 +11,7 @@ import { UniqueKeysCacheInMemoryCS } from './UniqueKeysCacheInMemoryCS';
11
11
  /**
12
12
  * InMemory storage factory for standalone client-side SplitFactory
13
13
  *
14
- * @param params parameters required by EventsCacheSync
14
+ * @param params - parameters required by EventsCacheSync
15
15
  */
16
16
  export function InMemoryStorageCSFactory(params: IStorageFactoryParams): IStorageSync {
17
17
  const { settings: { scheduler: { impressionsQueueSize, eventsQueueSize, }, sync: { impressionsMode, __splitFiltersValidation } } } = params;
@@ -12,7 +12,7 @@ export class UniqueKeysCacheInMemoryCS implements IUniqueKeysCacheBase {
12
12
 
13
13
  /**
14
14
  *
15
- * @param impressionsQueueSize number of queued impressions to call onFullQueueCb.
15
+ * @param impressionsQueueSize - number of queued impressions to call onFullQueueCb.
16
16
  * Default value is 0, that means no maximum value, in case we want to avoid this being triggered.
17
17
  */
18
18
  constructor(uniqueKeysQueueSize = DEFAULT_CACHE_SIZE) {
@@ -1,6 +1,6 @@
1
1
  import { IEventsCacheAsync } from '../types';
2
2
  import { IMetadata } from '../../dtos/types';
3
- import { SplitIO } from '../../types';
3
+ import SplitIO from '../../../types/splitio';
4
4
  import { ILogger } from '../../logger/types';
5
5
  import { LOG_PREFIX } from './constants';
6
6
  import { StoredEventWithMetadata } from '../../sync/submitters/types';
@@ -1,6 +1,6 @@
1
1
  import { IImpressionsCacheAsync } from '../types';
2
2
  import { IMetadata } from '../../dtos/types';
3
- import { ImpressionDTO } from '../../types';
3
+ import SplitIO from '../../../types/splitio';
4
4
  import { StoredImpressionWithMetadata } from '../../sync/submitters/types';
5
5
  import { ILogger } from '../../logger/types';
6
6
  import { impressionsToJSON } from '../utils';
@@ -22,7 +22,7 @@ export class ImpressionsCacheInRedis implements IImpressionsCacheAsync {
22
22
  this.metadata = metadata;
23
23
  }
24
24
 
25
- track(impressions: ImpressionDTO[]): Promise<void> { // @ts-ignore
25
+ track(impressions: SplitIO.ImpressionDTO[]): Promise<void> { // @ts-ignore
26
26
  return this.redis.rpush(
27
27
  this.key,
28
28
  impressionsToJSON(impressions, this.metadata),
@@ -186,10 +186,8 @@ export class SplitsCacheInRedis extends AbstractSplitsCacheAsync {
186
186
  * Get list of all split definitions.
187
187
  * The returned promise is resolved with the list of split definitions,
188
188
  * or rejected if redis operation fails.
189
- *
190
- * @TODO we need to benchmark which is the maximun number of commands we could
191
- * pipeline without kill redis performance.
192
189
  */
190
+ // @TODO we need to benchmark which is the maximun number of commands we could pipeline without kill redis performance.
193
191
  getAll(): Promise<ISplit[]> {
194
192
  return this.redis.keys(this.keys.searchPatternForSplitKeys())
195
193
  .then((listOfKeys) => this.redis.pipeline(listOfKeys.map(k => ['get', k])).exec())
@@ -14,9 +14,9 @@ export class TelemetryCacheInRedis implements ITelemetryCacheAsync {
14
14
 
15
15
  /**
16
16
  * Create a Telemetry cache that uses Redis as storage.
17
- * @param log Logger instance.
18
- * @param keys Key builder.
19
- * @param redis Redis client.
17
+ * @param log - Logger instance.
18
+ * @param keys - Key builder.
19
+ * @param redis - Redis client.
20
20
  */
21
21
  constructor(private readonly log: ILogger, private readonly keys: KeyBuilderSS, private readonly redis: RedisAdapter) { }
22
22
 
@@ -63,7 +63,7 @@ export class UniqueKeysCacheInRedis extends UniqueKeysCacheInMemory implements I
63
63
 
64
64
  /**
65
65
  * Async consumer API, used by synchronizer.
66
- * @param count number of items to pop from the queue. If not provided or equal 0, all items will be popped.
66
+ * @param count - number of items to pop from the queue. If not provided or equal 0, all items will be popped.
67
67
  */
68
68
  popNRaw(count = 0): Promise<UniqueKeysItemSs[]> {
69
69
  return this.redis.lrange(this.key, 0, count - 1).then(uniqueKeyItems => {
@@ -1,6 +1,6 @@
1
1
  import { IPluggableStorageWrapper, IEventsCacheAsync } from '../types';
2
2
  import { IMetadata } from '../../dtos/types';
3
- import { SplitIO } from '../../types';
3
+ import SplitIO from '../../../types/splitio';
4
4
  import { ILogger } from '../../logger/types';
5
5
  import { LOG_PREFIX } from './constants';
6
6
  import { StoredEventWithMetadata } from '../../sync/submitters/types';
@@ -21,7 +21,7 @@ export class EventsCachePluggable implements IEventsCacheAsync {
21
21
 
22
22
  /**
23
23
  * Push given event to the storage.
24
- * @param eventData Event item to push.
24
+ * @param eventData - Event item to push.
25
25
  * @returns A promise that is resolved with a boolean value indicating if the push operation succeeded or failed.
26
26
  * Unlike `impressions::track`, The promise will never be rejected.
27
27
  */
@@ -1,6 +1,6 @@
1
1
  import { IPluggableStorageWrapper, IImpressionsCacheAsync } from '../types';
2
2
  import { IMetadata } from '../../dtos/types';
3
- import { ImpressionDTO } from '../../types';
3
+ import SplitIO from '../../../types/splitio';
4
4
  import { StoredImpressionWithMetadata } from '../../sync/submitters/types';
5
5
  import { ILogger } from '../../logger/types';
6
6
  import { impressionsToJSON } from '../utils';
@@ -21,11 +21,11 @@ export class ImpressionsCachePluggable implements IImpressionsCacheAsync {
21
21
 
22
22
  /**
23
23
  * Push given impressions to the storage.
24
- * @param impressions List of impresions to push.
24
+ * @param impressions - List of impresions to push.
25
25
  * @returns A promise that is resolved if the push operation succeeded
26
26
  * or rejected if the wrapper operation fails.
27
27
  */
28
- track(impressions: ImpressionDTO[]): Promise<void> {
28
+ track(impressions: SplitIO.ImpressionDTO[]): Promise<void> {
29
29
  return this.wrapper.pushItems(
30
30
  this.key,
31
31
  impressionsToJSON(impressions, this.metadata)
@@ -83,7 +83,7 @@ export class SegmentsCachePluggable implements ISegmentsCacheAsync {
83
83
  return this.wrapper.getItems(this.keys.buildRegisteredSegmentsKey());
84
84
  }
85
85
 
86
- /** @TODO implement if required by DataLoader or Producer mode */
86
+ // @TODO implement if required by DataLoader or Producer mode
87
87
  clear(): Promise<boolean> {
88
88
  return Promise.resolve(true);
89
89
  }
@@ -19,9 +19,9 @@ export class SplitsCachePluggable extends AbstractSplitsCacheAsync {
19
19
 
20
20
  /**
21
21
  * Create a SplitsCache that uses a storage wrapper.
22
- * @param log Logger instance.
23
- * @param keys Key builder.
24
- * @param wrapper Adapted wrapper storage.
22
+ * @param log - Logger instance.
23
+ * @param keys - Key builder.
24
+ * @param wrapper - Adapted wrapper storage.
25
25
  */
26
26
  constructor(log: ILogger, keys: KeyBuilder, wrapper: IPluggableStorageWrapper, splitFiltersValidation?: ISplitFiltersValidation) {
27
27
  super();
@@ -13,9 +13,9 @@ export class TelemetryCachePluggable implements ITelemetryCacheAsync {
13
13
 
14
14
  /**
15
15
  * Create a Telemetry cache that uses a storage wrapper.
16
- * @param log Logger instance.
17
- * @param keys Key builder.
18
- * @param wrapper Adapted wrapper storage.
16
+ * @param log - Logger instance.
17
+ * @param keys - Key builder.
18
+ * @param wrapper - Adapted wrapper storage.
19
19
  */
20
20
  constructor(private readonly log: ILogger, private readonly keys: KeyBuilderSS, private readonly wrapper: IPluggableStorageWrapper) { }
21
21
 
@@ -56,7 +56,7 @@ export class UniqueKeysCachePluggable extends UniqueKeysCacheInMemory implements
56
56
 
57
57
  /**
58
58
  * Async consumer API, used by synchronizer.
59
- * @param count number of items to pop from the queue. If not provided or equal 0, all items will be popped.
59
+ * @param count - number of items to pop from the queue. If not provided or equal 0, all items will be popped.
60
60
  */
61
61
  popNRaw(count = 0): Promise<UniqueKeysItemSs[]> {
62
62
  return Promise.resolve(count || this.wrapper.getItemsCount(this.key))
@@ -7,7 +7,7 @@ import { setToArray } from '../../utils/lang/sets';
7
7
  * The `_cache` property is the object were items are stored.
8
8
  * Intended for testing purposes.
9
9
  *
10
- * @param connDelay delay in millis for `connect` resolve. If not provided, `connect` resolves immediately.
10
+ * @param connDelay - delay in millis for `connect` resolve. If not provided, `connect` resolves immediately.
11
11
  */
12
12
  export function inMemoryWrapperFactory(connDelay?: number): IPluggableStorageWrapper & { _cache: Record<string, string | string[] | Set<string>>, _setConnDelay(connDelay: number): void } {
13
13
 
@@ -32,7 +32,7 @@ export interface PluggableStorageOptions {
32
32
  /**
33
33
  * Validate pluggable storage factory options.
34
34
  *
35
- * @param options user options
35
+ * @param options - user options
36
36
  * @throws Will throw an error if the options are invalid. Example: wrapper is not provided or doesn't have some methods.
37
37
  */
38
38
  function validatePluggableStorageOptions(options: any) {
@@ -26,8 +26,8 @@ export const METHODS_TO_PROMISE_WRAP: string[] = [
26
26
  * Adapter of the Pluggable Storage Wrapper.
27
27
  * Used to handle exceptions as rejected promises, in order to simplify the error handling on storages.
28
28
  *
29
- * @param log logger instance
30
- * @param wrapper storage wrapper to adapt
29
+ * @param log - logger instance
30
+ * @param wrapper - storage wrapper to adapt
31
31
  * @returns an adapted version of the given storage wrapper
32
32
  */
33
33
  export function wrapperAdapter(log: ILogger, wrapper: IPluggableStorageWrapper): IPluggableStorageWrapper {
@@ -1,7 +1,8 @@
1
+ import SplitIO from '../../types/splitio';
1
2
  import { MaybeThenable, ISplit, IMySegmentsResponse } from '../dtos/types';
2
3
  import { MySegmentsData } from '../sync/polling/types';
3
4
  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
- import { SplitIO, ImpressionDTO, ISettings } from '../types';
5
+ import { ISettings } from '../types';
5
6
 
6
7
  /**
7
8
  * Interface of a pluggable storage wrapper.
@@ -13,56 +14,50 @@ export interface IPluggableStorageWrapper {
13
14
  /**
14
15
  * Get the value of given `key`.
15
16
  *
16
- * @function get
17
- * @param {string} key Item to retrieve
18
- * @returns {Promise<string | null>} A promise that resolves with the element value associated with the specified `key`,
17
+ * @param key - Item to retrieve
18
+ * @returns A promise that resolves with the element value associated with the specified `key`,
19
19
  * or null if the key does not exist. The promise rejects if the operation fails.
20
20
  */
21
21
  get: (key: string) => Promise<string | null>
22
22
  /**
23
23
  * Add or update an item with a specified `key` and `value`.
24
24
  *
25
- * @function set
26
- * @param {string} key Item to update
27
- * @param {string} value Value to set
28
- * @returns {Promise<void>} A promise that resolves if the operation success, whether the key was added or updated.
25
+ * @param key - Item to update
26
+ * @param value - Value to set
27
+ * @returns A promise that resolves if the operation success, whether the key was added or updated.
29
28
  * The promise rejects if the operation fails.
30
29
  */
31
30
  set: (key: string, value: string) => Promise<boolean | void>
32
31
  /**
33
32
  * Add or update an item with a specified `key` and `value`.
34
33
  *
35
- * @function getAndSet
36
- * @param {string} key Item to update
37
- * @param {string} value Value to set
38
- * @returns {Promise<string | null>} A promise that resolves with the previous value associated to the given `key`, or null if not set.
34
+ * @param key - Item to update
35
+ * @param value - Value to set
36
+ * @returns A promise that resolves with the previous value associated to the given `key`, or null if not set.
39
37
  * The promise rejects if the operation fails.
40
38
  */
41
39
  getAndSet: (key: string, value: string) => Promise<string | null>
42
40
  /**
43
41
  * Removes the specified item by `key`.
44
42
  *
45
- * @function del
46
- * @param {string} key Item to delete
47
- * @returns {Promise<boolean>} A promise that resolves if the operation success, whether the key existed and was removed (resolves with true) or it didn't exist (resolves with false).
43
+ * @param key - Item to delete
44
+ * @returns A promise that resolves if the operation success, whether the key existed and was removed (resolves with true) or it didn't exist (resolves with false).
48
45
  * The promise rejects if the operation fails, for example, if there is a connection error.
49
46
  */
50
47
  del: (key: string) => Promise<boolean>
51
48
  /**
52
49
  * Returns all keys matching the given prefix.
53
50
  *
54
- * @function getKeysByPrefix
55
- * @param {string} prefix String prefix to match
56
- * @returns {Promise<string[]>} A promise that resolves with the list of keys that match the given `prefix`.
51
+ * @param prefix - String prefix to match
52
+ * @returns A promise that resolves with the list of keys that match the given `prefix`.
57
53
  * The promise rejects if the operation fails.
58
54
  */
59
55
  getKeysByPrefix: (prefix: string) => Promise<string[]>
60
56
  /**
61
57
  * Returns the values of all given `keys`.
62
58
  *
63
- * @function getMany
64
- * @param {string[]} keys List of keys to retrieve
65
- * @returns {Promise<(string | null)[]>} A promise that resolves with the list of items associated with the specified list of `keys`.
59
+ * @param keys - List of keys to retrieve
60
+ * @returns A promise that resolves with the list of items associated with the specified list of `keys`.
66
61
  * For every key that does not hold a string value or does not exist, null is returned. The promise rejects if the operation fails.
67
62
  */
68
63
  getMany: (keys: string[]) => Promise<(string | null)[]>
@@ -72,20 +67,18 @@ export interface IPluggableStorageWrapper {
72
67
  /**
73
68
  * Increments the number stored at `key` by `increment`, or set it to `increment` if the value doesn't exist.
74
69
  *
75
- * @function incr
76
- * @param {string} key Key to increment
77
- * @param {number} increment Value to increment by. Defaults to 1.
78
- * @returns {Promise<number>} A promise that resolves with the value of key after the increment. The promise rejects if the operation fails,
70
+ * @param key - Key to increment
71
+ * @param increment - Value to increment by. Defaults to 1.
72
+ * @returns A promise that resolves with the value of key after the increment. The promise rejects if the operation fails,
79
73
  * for example, if there is a connection error or the key contains a string that can not be represented as integer.
80
74
  */
81
75
  incr: (key: string, increment?: number) => Promise<number>
82
76
  /**
83
77
  * Decrements the number stored at `key` by `decrement`, or set it to minus `decrement` if the value doesn't exist.
84
78
  *
85
- * @function decr
86
- * @param {string} key Key to decrement
87
- * @param {number} decrement Value to decrement by. Defaults to 1.
88
- * @returns {Promise<number>} A promise that resolves with the value of key after the decrement. The promise rejects if the operation fails,
79
+ * @param key - Key to decrement
80
+ * @param decrement - Value to decrement by. Defaults to 1.
81
+ * @returns A promise that resolves with the value of key after the decrement. The promise rejects if the operation fails,
89
82
  * for example, if there is a connection error or the key contains a string that can not be represented as integer.
90
83
  */
91
84
  decr: (key: string, decrement?: number) => Promise<number>
@@ -95,29 +88,26 @@ export interface IPluggableStorageWrapper {
95
88
  /**
96
89
  * Inserts given items at the tail of `key` list. If `key` does not exist, an empty list is created before pushing the items.
97
90
  *
98
- * @function pushItems
99
- * @param {string} key List key
100
- * @param {string[]} items List of items to push
101
- * @returns {Promise<void>} A promise that resolves if the operation success.
91
+ * @param key - List key
92
+ * @param items - List of items to push
93
+ * @returns A promise that resolves if the operation success.
102
94
  * The promise rejects if the operation fails, for example, if there is a connection error or the key holds a value that is not a list.
103
95
  */
104
96
  pushItems: (key: string, items: string[]) => Promise<void>
105
97
  /**
106
98
  * Removes and returns the first `count` items from a list. If `key` does not exist, an empty list is items is returned.
107
99
  *
108
- * @function popItems
109
- * @param {string} key List key
110
- * @param {number} count Number of items to pop
111
- * @returns {Promise<string[]>} A promise that resolves with the list of removed items from the list, or an empty array when key does not exist.
100
+ * @param key - List key
101
+ * @param count - Number of items to pop
102
+ * @returns A promise that resolves with the list of removed items from the list, or an empty array when key does not exist.
112
103
  * The promise rejects if the operation fails, for example, if there is a connection error or the key holds a value that is not a list.
113
104
  */
114
105
  popItems: (key: string, count: number) => Promise<string[]>
115
106
  /**
116
107
  * Returns the count of items in a list, or 0 if `key` does not exist.
117
108
  *
118
- * @function getItemsCount
119
- * @param {string} key List key
120
- * @returns {Promise<number>} A promise that resolves with the number of items at the `key` list, or 0 when `key` does not exist.
109
+ * @param key - List key
110
+ * @returns A promise that resolves with the number of items at the `key` list, or 0 when `key` does not exist.
121
111
  * The promise rejects if the operation fails, for example, if there is a connection error or the key holds a value that is not a list.
122
112
  */
123
113
  getItemsCount: (key: string) => Promise<number>
@@ -127,10 +117,9 @@ export interface IPluggableStorageWrapper {
127
117
  /**
128
118
  * Returns if item is a member of a set.
129
119
  *
130
- * @function itemContains
131
- * @param {string} key Set key
132
- * @param {string} item Item value
133
- * @returns {Promise<boolean>} A promise that resolves with true boolean value if `item` is a member of the set stored at `key`,
120
+ * @param key - Set key
121
+ * @param item - Item value
122
+ * @returns A promise that resolves with true boolean value if `item` is a member of the set stored at `key`,
134
123
  * or false if it is not a member or `key` set does not exist. The promise rejects if the operation fails, for example,
135
124
  * if there is a connection error or the key holds a value that is not a set.
136
125
  */
@@ -139,29 +128,26 @@ export interface IPluggableStorageWrapper {
139
128
  * Add the specified `items` to the set stored at `key`. Those items that are already part of the set are ignored.
140
129
  * If key does not exist, an empty set is created before adding the items.
141
130
  *
142
- * @function addItems
143
- * @param {string} key Set key
144
- * @param {string} items Items to add
145
- * @returns {Promise<boolean | void>} A promise that resolves if the operation success.
131
+ * @param key - Set key
132
+ * @param items - Items to add
133
+ * @returns A promise that resolves if the operation success.
146
134
  * The promise rejects if the operation fails, for example, if there is a connection error or the key holds a value that is not a set.
147
135
  */
148
136
  addItems: (key: string, items: string[]) => Promise<boolean | void>
149
137
  /**
150
138
  * Remove the specified `items` from the set stored at `key`. Those items that are not part of the set are ignored.
151
139
  *
152
- * @function removeItems
153
- * @param {string} key Set key
154
- * @param {string} items Items to remove
155
- * @returns {Promise<boolean | void>} A promise that resolves if the operation success. If key does not exist, the promise also resolves.
140
+ * @param key - Set key
141
+ * @param items - Items to remove
142
+ * @returns A promise that resolves if the operation success. If key does not exist, the promise also resolves.
156
143
  * The promise rejects if the operation fails, for example, if there is a connection error or the key holds a value that is not a set.
157
144
  */
158
145
  removeItems: (key: string, items: string[]) => Promise<boolean | void>
159
146
  /**
160
147
  * Returns all the items of the `key` set.
161
148
  *
162
- * @function getItems
163
- * @param {string} key Set key
164
- * @returns {Promise<string[]>} A promise that resolves with the list of items. If key does not exist, the result is an empty list.
149
+ * @param key - Set key
150
+ * @returns A promise that resolves with the list of items. If key does not exist, the result is an empty list.
165
151
  * The promise rejects if the operation fails, for example, if there is a connection error or the key holds a value that is not a set.
166
152
  */
167
153
  getItems: (key: string) => Promise<string[]>
@@ -173,8 +159,7 @@ export interface IPluggableStorageWrapper {
173
159
  * It is meant for storages that requires to be connected to some database or server. Otherwise it can just return a resolved promise.
174
160
  * Note: will be called once on SplitFactory instantiation and once per each shared client instantiation.
175
161
  *
176
- * @function connect
177
- * @returns {Promise<void>} A promise that resolves when the wrapper successfully connect to the underlying storage.
162
+ * @returns A promise that resolves when the wrapper successfully connect to the underlying storage.
178
163
  * The promise rejects with the corresponding error if the wrapper fails to connect.
179
164
  */
180
165
  connect: () => Promise<void>
@@ -183,8 +168,7 @@ export interface IPluggableStorageWrapper {
183
168
  * It is meant for storages that requires to be closed, in order to release resources. Otherwise it can just return a resolved promise.
184
169
  * Note: will be called once on SplitFactory main client destroy.
185
170
  *
186
- * @function disconnect
187
- * @returns {Promise<void>} A promise that resolves when the operation ends.
171
+ * @returns A promise that resolves when the operation ends.
188
172
  * The promise never rejects.
189
173
  */
190
174
  disconnect: () => Promise<void>
@@ -283,7 +267,7 @@ export interface ISegmentsCacheAsync extends ISegmentsCacheBase {
283
267
 
284
268
  export interface IImpressionsCacheBase {
285
269
  // Used by impressions tracker, in DEBUG and OPTIMIZED impression modes, to push impressions into the storage.
286
- track(data: ImpressionDTO[]): MaybeThenable<void>
270
+ track(data: SplitIO.ImpressionDTO[]): MaybeThenable<void>
287
271
  }
288
272
 
289
273
  export interface IEventsCacheBase {
@@ -314,8 +298,8 @@ export interface IRecorderCacheSync<T> {
314
298
  pop(toMerge?: T): T
315
299
  }
316
300
 
317
- export interface IImpressionsCacheSync extends IImpressionsCacheBase, IRecorderCacheSync<ImpressionDTO[]> {
318
- track(data: ImpressionDTO[]): void
301
+ export interface IImpressionsCacheSync extends IImpressionsCacheBase, IRecorderCacheSync<SplitIO.ImpressionDTO[]> {
302
+ track(data: SplitIO.ImpressionDTO[]): void
319
303
  /* Registers callback for full queue */
320
304
  setOnFullQueueCb(cb: () => void): void
321
305
  }
@@ -348,7 +332,7 @@ export interface IRecorderCacheAsync<T> {
348
332
  export interface IImpressionsCacheAsync extends IImpressionsCacheBase, IRecorderCacheAsync<StoredImpressionWithMetadata[]> {
349
333
  // Consumer API method, used by impressions tracker (in standalone and consumer modes) to push data into.
350
334
  // The result promise can reject.
351
- track(data: ImpressionDTO[]): Promise<void>
335
+ track(data: SplitIO.ImpressionDTO[]): Promise<void>
352
336
  }
353
337
 
354
338
  export interface IEventsCacheAsync extends IEventsCacheBase, IRecorderCacheAsync<StoredEventWithMetadata[]> {
@@ -499,14 +483,13 @@ export interface IStorageFactoryParams {
499
483
  onReadyCb: (error?: any) => void,
500
484
  }
501
485
 
502
- export type StorageType = 'MEMORY' | 'LOCALSTORAGE' | 'REDIS' | 'PLUGGABLE';
503
486
 
504
- export type IStorageSyncFactory = {
505
- readonly type: StorageType,
487
+ export type IStorageSyncFactory = SplitIO.StorageSyncFactory & {
488
+ readonly type: SplitIO.StorageType,
506
489
  (params: IStorageFactoryParams): IStorageSync
507
490
  }
508
491
 
509
- export type IStorageAsyncFactory = {
510
- type: StorageType,
492
+ export type IStorageAsyncFactory = SplitIO.StorageAsyncFactory & {
493
+ readonly type: SplitIO.StorageType,
511
494
  (params: IStorageFactoryParams): IStorageAsync
512
495
  }
@@ -2,7 +2,8 @@
2
2
 
3
3
  import { IMetadata } from '../dtos/types';
4
4
  import { Method, StoredImpressionWithMetadata } from '../sync/submitters/types';
5
- import { ImpressionDTO, ISettings } from '../types';
5
+ import { ISettings } from '../types';
6
+ import SplitIO from '../../types/splitio';
6
7
  import { UNKNOWN } from '../utils/constants';
7
8
  import { MAX_LATENCY_BUCKET_COUNT } from './inMemory/TelemetryCacheInMemory';
8
9
  import { METHOD_NAMES } from './KeyBuilderSS';
@@ -16,7 +17,7 @@ export function metadataBuilder(settings: Pick<ISettings, 'version' | 'runtime'>
16
17
  }
17
18
 
18
19
  // Converts impressions to be stored in Redis or pluggable storage.
19
- export function impressionsToJSON(impressions: ImpressionDTO[], metadata: IMetadata): string[] {
20
+ export function impressionsToJSON(impressions: SplitIO.ImpressionDTO[], metadata: IMetadata): string[] {
20
21
  return impressions.map(impression => {
21
22
  const impressionWithMetadata: StoredImpressionWithMetadata = {
22
23
  m: metadata,
@@ -1,5 +1,5 @@
1
1
  import { ISplitPartial } from '../../../dtos/types';
2
- import { ISettings, SplitIO } from '../../../types';
2
+ import SplitIO from '../../../../types/splitio';
3
3
  import { isObject, forOwn, merge } from '../../../utils/lang';
4
4
  import { parseCondition } from './parseCondition';
5
5
 
@@ -39,9 +39,9 @@ export function splitsParserFromSettingsFactory() {
39
39
 
40
40
  /**
41
41
  *
42
- * @param settings validated object with mocked features mapping.
42
+ * @param settings - validated object with mocked features mapping.
43
43
  */
44
- return function splitsParserFromSettings(settings: Pick<ISettings, 'features'>): false | Record<string, ISplitPartial> {
44
+ return function splitsParserFromSettings(settings: Pick<SplitIO.ISettings, 'features'>): false | Record<string, ISplitPartial> {
45
45
  const features = settings.features as SplitIO.MockedFeaturesMap || {};
46
46
 
47
47
  if (!mockUpdated(features)) return false;
@@ -14,7 +14,7 @@ function flush() {
14
14
  * Offline SyncManager factory.
15
15
  * Can be used for server-side API, and client-side API with or without multiple clients.
16
16
  *
17
- * @param splitsParser e.g., `splitsParserFromFile`, `splitsParserFromSettings`.
17
+ * @param splitsParser - e.g., `splitsParserFromFile`, `splitsParserFromSettings`.
18
18
  */
19
19
  export function syncManagerOfflineFactory(
20
20
  splitsParserFactory: () => ISplitsParser
@@ -87,12 +87,12 @@ export function mySegmentsUpdaterFactory(
87
87
  * MySegments updater returns a promise that resolves with a `false` boolean value if it fails to fetch mySegments or synchronize them with the storage.
88
88
  * Returned promise will not be rejected.
89
89
  *
90
- * @param {SegmentsData | undefined} segmentsData it can be:
90
+ * @param segmentsData - it can be:
91
91
  * (1) the list of mySegments names to sync in the storage,
92
92
  * (2) an object with a segment name and action (true: add, or false: delete) to update the storage,
93
93
  * (3) or `undefined`, for which the updater will fetch mySegments in order to sync the storage.
94
- * @param {boolean | undefined} noCache true to revalidate data to fetch
95
- * @param {boolean | undefined} till query param to bypass CDN requests
94
+ * @param noCache - true to revalidate data to fetch
95
+ * @param till - query param to bypass CDN requests
96
96
  */
97
97
  return function mySegmentsUpdater(segmentsData?: MySegmentsData, noCache?: boolean, till?: number) {
98
98
  return _mySegmentsUpdater(0, segmentsData, noCache, till);
@@ -13,10 +13,10 @@ type ISegmentChangesUpdater = (fetchOnlyNew?: boolean, segmentName?: string, noC
13
13
  * - updates `segmentsCache`
14
14
  * - uses `segmentsEventEmitter` to emit events related to segments data updates
15
15
  *
16
- * @param log logger instance
17
- * @param segmentChangesFetcher fetcher of `/segmentChanges`
18
- * @param segments segments storage, with sync or async methods
19
- * @param readiness optional readiness manager. Not required for synchronizer or producer mode.
16
+ * @param log - logger instance
17
+ * @param segmentChangesFetcher - fetcher of `/segmentChanges`
18
+ * @param segments - segments storage, with sync or async methods
19
+ * @param readiness - optional readiness manager. Not required for synchronizer or producer mode.
20
20
  */
21
21
  export function segmentChangesUpdaterFactory(
22
22
  log: ILogger,
@@ -50,11 +50,11 @@ export function segmentChangesUpdaterFactory(
50
50
  * Thus, a false result doesn't imply that SDK_SEGMENTS_ARRIVED was not emitted.
51
51
  * Returned promise will not be rejected.
52
52
  *
53
- * @param {boolean | undefined} fetchOnlyNew if true, only fetch the segments that not exists, i.e., which `changeNumber` is equal to -1.
53
+ * @param fetchOnlyNew - if true, only fetch the segments that not exists, i.e., which `changeNumber` is equal to -1.
54
54
  * This param is used by SplitUpdateWorker on server-side SDK, to fetch new registered segments on SPLIT_UPDATE notifications.
55
- * @param {string | undefined} segmentName segment name to fetch. By passing `undefined` it fetches the list of segments registered at the storage
56
- * @param {boolean | undefined} noCache true to revalidate data to fetch on a SEGMENT_UPDATE notifications.
57
- * @param {number | undefined} till till target for the provided segmentName, for CDN bypass.
55
+ * @param segmentName - segment name to fetch. By passing `undefined` it fetches the list of segments registered at the storage
56
+ * @param noCache - true to revalidate data to fetch on a SEGMENT_UPDATE notifications.
57
+ * @param till - till target for the provided segmentName, for CDN bypass.
58
58
  */
59
59
  return function segmentChangesUpdater(fetchOnlyNew?: boolean, segmentName?: string, noCache?: boolean, till?: number) {
60
60
  log.debug(`${LOG_PREFIX_SYNC_SEGMENTS}Started segments update`);