@splitsoftware/splitio-commons 1.0.1-rc.3 → 1.1.0

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 (504) hide show
  1. package/CHANGES.txt +10 -3
  2. package/LICENSE +1 -1
  3. package/README.md +1 -1
  4. package/cjs/evaluator/Engine.js +6 -5
  5. package/cjs/evaluator/combiners/and.js +4 -4
  6. package/cjs/evaluator/combiners/ifelseif.js +4 -3
  7. package/cjs/evaluator/condition/index.js +4 -3
  8. package/cjs/evaluator/index.js +10 -11
  9. package/cjs/evaluator/matchers/all.js +2 -1
  10. package/cjs/evaluator/matchers/between.js +2 -1
  11. package/cjs/evaluator/matchers/boolean.js +2 -1
  12. package/cjs/evaluator/matchers/cont_all.js +3 -2
  13. package/cjs/evaluator/matchers/cont_any.js +3 -2
  14. package/cjs/evaluator/matchers/cont_str.js +2 -1
  15. package/cjs/evaluator/matchers/dependency.js +4 -4
  16. package/cjs/evaluator/matchers/eq.js +2 -1
  17. package/cjs/evaluator/matchers/eq_set.js +2 -1
  18. package/cjs/evaluator/matchers/ew.js +2 -1
  19. package/cjs/evaluator/matchers/gte.js +2 -1
  20. package/cjs/evaluator/matchers/index.js +36 -36
  21. package/cjs/evaluator/matchers/lte.js +2 -1
  22. package/cjs/evaluator/matchers/part_of.js +3 -2
  23. package/cjs/evaluator/matchers/segment.js +5 -5
  24. package/cjs/evaluator/matchers/string.js +2 -1
  25. package/cjs/evaluator/matchers/sw.js +2 -1
  26. package/cjs/evaluator/matchers/whitelist.js +2 -1
  27. package/cjs/evaluator/matchersTransform/index.js +12 -12
  28. package/cjs/evaluator/matchersTransform/segment.js +3 -2
  29. package/cjs/evaluator/matchersTransform/set.js +3 -2
  30. package/cjs/evaluator/matchersTransform/unaryNumeric.js +3 -2
  31. package/cjs/evaluator/matchersTransform/whitelist.js +3 -2
  32. package/cjs/evaluator/parser/index.js +16 -16
  33. package/cjs/evaluator/treatments/index.js +2 -1
  34. package/cjs/evaluator/value/index.js +5 -5
  35. package/cjs/evaluator/value/sanitize.js +2 -1
  36. package/cjs/integrations/browser.js +4 -4
  37. package/cjs/integrations/ga/GaToSplit.js +3 -4
  38. package/cjs/integrations/pluggable.js +3 -2
  39. package/cjs/listeners/browser.js +4 -4
  40. package/cjs/listeners/node.js +4 -4
  41. package/cjs/logger/index.js +2 -3
  42. package/cjs/logger/messages/info.js +1 -1
  43. package/cjs/logger/messages/warn.js +2 -2
  44. package/cjs/readiness/readinessManager.js +3 -4
  45. package/cjs/readiness/sdkReadinessManager.js +7 -7
  46. package/cjs/sdkClient/client.js +5 -5
  47. package/cjs/sdkClient/clientCS.js +4 -4
  48. package/cjs/sdkClient/clientInputValidation.js +5 -5
  49. package/cjs/sdkClient/sdkClient.js +5 -6
  50. package/cjs/sdkClient/sdkClientMethodCS.js +4 -5
  51. package/cjs/sdkClient/sdkClientMethodCSWithTT.js +4 -5
  52. package/cjs/sdkFactory/index.js +9 -10
  53. package/cjs/sdkManager/index.js +6 -7
  54. package/cjs/services/splitApi.js +2 -3
  55. package/cjs/services/splitHttpClient.js +3 -4
  56. package/cjs/storages/AbstractSegmentsCacheSync.js +2 -1
  57. package/cjs/storages/AbstractSplitsCacheAsync.js +2 -1
  58. package/cjs/storages/AbstractSplitsCacheSync.js +2 -2
  59. package/cjs/storages/KeyBuilder.js +2 -2
  60. package/cjs/storages/KeyBuilderCS.js +4 -3
  61. package/cjs/storages/KeyBuilderSS.js +4 -3
  62. package/cjs/storages/findLatencyIndex.js +2 -1
  63. package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +4 -3
  64. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +4 -3
  65. package/cjs/storages/inLocalStorage/index.js +20 -21
  66. package/cjs/storages/inMemory/CountsCacheInMemory.js +2 -1
  67. package/cjs/storages/inMemory/EventsCacheInMemory.js +2 -1
  68. package/cjs/storages/inMemory/ImpressionCountsCacheInMemory.js +2 -1
  69. package/cjs/storages/inMemory/ImpressionsCacheInMemory.js +2 -1
  70. package/cjs/storages/inMemory/InMemoryStorage.js +10 -11
  71. package/cjs/storages/inMemory/InMemoryStorageCS.js +12 -13
  72. package/cjs/storages/inMemory/LatenciesCacheInMemory.js +4 -4
  73. package/cjs/storages/inMemory/MySegmentsCacheInMemory.js +4 -3
  74. package/cjs/storages/inMemory/SegmentsCacheInMemory.js +4 -3
  75. package/cjs/storages/inMemory/SplitsCacheInMemory.js +4 -3
  76. package/cjs/storages/inRedis/CountsCacheInRedis.js +2 -1
  77. package/cjs/storages/inRedis/EventsCacheInRedis.js +2 -1
  78. package/cjs/storages/inRedis/ImpressionsCacheInRedis.js +2 -1
  79. package/cjs/storages/inRedis/LatenciesCacheInRedis.js +4 -4
  80. package/cjs/storages/inRedis/RedisAdapter.js +6 -5
  81. package/cjs/storages/inRedis/SegmentsCacheInRedis.js +2 -1
  82. package/cjs/storages/inRedis/SplitsCacheInRedis.js +4 -3
  83. package/cjs/storages/inRedis/index.js +16 -17
  84. package/cjs/storages/pluggable/SplitsCachePluggable.js +2 -2
  85. package/cjs/storages/pluggable/index.js +8 -8
  86. package/cjs/sync/offline/splitsParser/parseCondition.js +2 -1
  87. package/cjs/sync/offline/splitsParser/splitsParserFromFile.js +3 -3
  88. package/cjs/sync/offline/splitsParser/splitsParserFromSettings.js +2 -3
  89. package/cjs/sync/offline/syncManagerOffline.js +3 -4
  90. package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +4 -5
  91. package/cjs/sync/polling/fetchers/mySegmentsFetcher.js +2 -1
  92. package/cjs/sync/polling/fetchers/segmentChangesFetcher.js +2 -1
  93. package/cjs/sync/polling/fetchers/splitChangesFetcher.js +2 -1
  94. package/cjs/sync/polling/pollingManagerCS.js +6 -6
  95. package/cjs/sync/polling/pollingManagerSS.js +8 -8
  96. package/cjs/sync/polling/syncTasks/mySegmentsSyncTask.js +5 -5
  97. package/cjs/sync/polling/syncTasks/segmentsSyncTask.js +5 -5
  98. package/cjs/sync/polling/syncTasks/splitsSyncTask.js +5 -5
  99. package/cjs/sync/polling/updaters/mySegmentsUpdater.js +2 -3
  100. package/cjs/sync/polling/updaters/segmentChangesUpdater.js +2 -3
  101. package/cjs/sync/polling/updaters/splitChangesUpdater.js +8 -6
  102. package/cjs/sync/streaming/AuthClient/index.js +2 -3
  103. package/cjs/sync/streaming/SSEClient/index.js +2 -1
  104. package/cjs/sync/streaming/SSEHandler/NotificationKeeper.js +2 -1
  105. package/cjs/sync/streaming/SSEHandler/index.js +4 -4
  106. package/cjs/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +4 -4
  107. package/cjs/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +4 -4
  108. package/cjs/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +4 -4
  109. package/cjs/sync/streaming/pushManager.js +18 -17
  110. package/cjs/sync/submitters/submitterSyncTask.js +2 -3
  111. package/cjs/sync/syncTask.js +2 -1
  112. package/cjs/trackers/eventTracker.js +7 -7
  113. package/cjs/trackers/impressionObserver/ImpressionObserver.js +4 -4
  114. package/cjs/trackers/impressionObserver/impressionObserverCS.js +2 -3
  115. package/cjs/trackers/impressionObserver/impressionObserverSS.js +2 -3
  116. package/cjs/trackers/impressionsTracker.js +6 -6
  117. package/cjs/utils/Backoff.js +2 -1
  118. package/cjs/utils/LRUCache/index.js +2 -1
  119. package/cjs/utils/MinEventEmitter.js +2 -1
  120. package/cjs/utils/MinEvents.js +13 -15
  121. package/cjs/utils/inputValidation/trafficTypeExistance.js +2 -3
  122. package/cjs/utils/lang/binarySearch.js +2 -1
  123. package/cjs/utils/lang/objectAssign.js +85 -0
  124. package/cjs/utils/promise/thenable.js +5 -1
  125. package/cjs/utils/promise/timeout.js +2 -1
  126. package/cjs/utils/promise/wrapper.js +2 -1
  127. package/cjs/utils/settingsValidation/impressionsMode.js +2 -1
  128. package/cjs/utils/settingsValidation/index.js +5 -6
  129. package/cjs/utils/settingsValidation/mode.js +2 -1
  130. package/cjs/utils/timeTracker/index.js +7 -8
  131. package/cjs/utils/timeTracker/now/browser.js +2 -2
  132. package/cjs/utils/timeTracker/now/node.js +2 -1
  133. package/cjs/utils/timeTracker/timer.js +3 -2
  134. package/esm/evaluator/Engine.js +3 -3
  135. package/esm/evaluator/combiners/and.js +2 -2
  136. package/esm/evaluator/combiners/ifelseif.js +2 -2
  137. package/esm/evaluator/condition/index.js +2 -2
  138. package/esm/evaluator/index.js +5 -6
  139. package/esm/evaluator/matchers/all.js +1 -1
  140. package/esm/evaluator/matchers/between.js +1 -1
  141. package/esm/evaluator/matchers/boolean.js +1 -1
  142. package/esm/evaluator/matchers/cont_all.js +1 -1
  143. package/esm/evaluator/matchers/cont_any.js +1 -1
  144. package/esm/evaluator/matchers/cont_str.js +1 -1
  145. package/esm/evaluator/matchers/dependency.js +2 -2
  146. package/esm/evaluator/matchers/eq.js +1 -1
  147. package/esm/evaluator/matchers/eq_set.js +1 -1
  148. package/esm/evaluator/matchers/ew.js +1 -1
  149. package/esm/evaluator/matchers/gte.js +1 -1
  150. package/esm/evaluator/matchers/index.js +35 -35
  151. package/esm/evaluator/matchers/lte.js +1 -1
  152. package/esm/evaluator/matchers/part_of.js +1 -1
  153. package/esm/evaluator/matchers/segment.js +2 -2
  154. package/esm/evaluator/matchers/string.js +1 -1
  155. package/esm/evaluator/matchers/sw.js +1 -1
  156. package/esm/evaluator/matchers/whitelist.js +1 -1
  157. package/esm/evaluator/matchersTransform/index.js +5 -5
  158. package/esm/evaluator/matchersTransform/segment.js +1 -1
  159. package/esm/evaluator/matchersTransform/set.js +1 -1
  160. package/esm/evaluator/matchersTransform/unaryNumeric.js +1 -1
  161. package/esm/evaluator/matchersTransform/whitelist.js +1 -1
  162. package/esm/evaluator/parser/index.js +11 -11
  163. package/esm/evaluator/treatments/index.js +1 -1
  164. package/esm/evaluator/value/index.js +3 -3
  165. package/esm/evaluator/value/sanitize.js +1 -1
  166. package/esm/integrations/browser.js +2 -2
  167. package/esm/integrations/ga/GaToSplit.js +1 -1
  168. package/esm/integrations/pluggable.js +1 -1
  169. package/esm/listeners/browser.js +2 -2
  170. package/esm/listeners/node.js +2 -2
  171. package/esm/logger/index.js +1 -1
  172. package/esm/logger/messages/info.js +1 -1
  173. package/esm/logger/messages/warn.js +2 -2
  174. package/esm/readiness/readinessManager.js +1 -1
  175. package/esm/readiness/sdkReadinessManager.js +3 -3
  176. package/esm/sdkClient/client.js +2 -2
  177. package/esm/sdkClient/clientCS.js +2 -2
  178. package/esm/sdkClient/clientInputValidation.js +2 -2
  179. package/esm/sdkClient/sdkClient.js +3 -3
  180. package/esm/sdkClient/sdkClientMethodCS.js +2 -2
  181. package/esm/sdkClient/sdkClientMethodCSWithTT.js +2 -2
  182. package/esm/sdkFactory/index.js +6 -6
  183. package/esm/sdkManager/index.js +2 -2
  184. package/esm/services/splitApi.js +1 -1
  185. package/esm/services/splitHttpClient.js +1 -1
  186. package/esm/storages/AbstractSegmentsCacheSync.js +1 -1
  187. package/esm/storages/AbstractSplitsCacheAsync.js +1 -1
  188. package/esm/storages/AbstractSplitsCacheSync.js +1 -1
  189. package/esm/storages/KeyBuilder.js +1 -1
  190. package/esm/storages/KeyBuilderCS.js +2 -2
  191. package/esm/storages/KeyBuilderSS.js +2 -2
  192. package/esm/storages/findLatencyIndex.js +1 -1
  193. package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +2 -2
  194. package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +2 -2
  195. package/esm/storages/inLocalStorage/index.js +8 -8
  196. package/esm/storages/inMemory/CountsCacheInMemory.js +1 -1
  197. package/esm/storages/inMemory/EventsCacheInMemory.js +1 -1
  198. package/esm/storages/inMemory/ImpressionCountsCacheInMemory.js +1 -1
  199. package/esm/storages/inMemory/ImpressionsCacheInMemory.js +1 -1
  200. package/esm/storages/inMemory/InMemoryStorage.js +5 -5
  201. package/esm/storages/inMemory/InMemoryStorageCS.js +5 -5
  202. package/esm/storages/inMemory/LatenciesCacheInMemory.js +2 -2
  203. package/esm/storages/inMemory/MySegmentsCacheInMemory.js +2 -2
  204. package/esm/storages/inMemory/SegmentsCacheInMemory.js +2 -2
  205. package/esm/storages/inMemory/SplitsCacheInMemory.js +2 -2
  206. package/esm/storages/inRedis/CountsCacheInRedis.js +1 -1
  207. package/esm/storages/inRedis/EventsCacheInRedis.js +1 -1
  208. package/esm/storages/inRedis/ImpressionsCacheInRedis.js +1 -1
  209. package/esm/storages/inRedis/LatenciesCacheInRedis.js +2 -2
  210. package/esm/storages/inRedis/RedisAdapter.js +3 -3
  211. package/esm/storages/inRedis/SegmentsCacheInRedis.js +1 -1
  212. package/esm/storages/inRedis/SplitsCacheInRedis.js +2 -2
  213. package/esm/storages/inRedis/index.js +8 -8
  214. package/esm/storages/pluggable/SplitsCachePluggable.js +1 -1
  215. package/esm/storages/pluggable/index.js +4 -4
  216. package/esm/sync/offline/splitsParser/parseCondition.js +1 -1
  217. package/esm/sync/offline/splitsParser/splitsParserFromFile.js +1 -1
  218. package/esm/sync/offline/splitsParser/splitsParserFromSettings.js +1 -1
  219. package/esm/sync/offline/syncManagerOffline.js +2 -2
  220. package/esm/sync/offline/syncTasks/fromObjectSyncTask.js +2 -2
  221. package/esm/sync/polling/fetchers/mySegmentsFetcher.js +1 -1
  222. package/esm/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
  223. package/esm/sync/polling/fetchers/splitChangesFetcher.js +1 -1
  224. package/esm/sync/polling/pollingManagerCS.js +3 -3
  225. package/esm/sync/polling/pollingManagerSS.js +4 -4
  226. package/esm/sync/polling/syncTasks/mySegmentsSyncTask.js +3 -3
  227. package/esm/sync/polling/syncTasks/segmentsSyncTask.js +3 -3
  228. package/esm/sync/polling/syncTasks/splitsSyncTask.js +3 -3
  229. package/esm/sync/polling/updaters/mySegmentsUpdater.js +1 -1
  230. package/esm/sync/polling/updaters/segmentChangesUpdater.js +1 -1
  231. package/esm/sync/polling/updaters/splitChangesUpdater.js +7 -4
  232. package/esm/sync/streaming/AuthClient/index.js +1 -1
  233. package/esm/sync/streaming/SSEClient/index.js +1 -1
  234. package/esm/sync/streaming/SSEHandler/NotificationKeeper.js +1 -1
  235. package/esm/sync/streaming/SSEHandler/index.js +2 -2
  236. package/esm/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +2 -2
  237. package/esm/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +2 -2
  238. package/esm/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +2 -2
  239. package/esm/sync/streaming/pushManager.js +10 -9
  240. package/esm/sync/submitters/submitterSyncTask.js +1 -1
  241. package/esm/sync/syncTask.js +1 -1
  242. package/esm/trackers/eventTracker.js +3 -3
  243. package/esm/trackers/impressionObserver/ImpressionObserver.js +2 -2
  244. package/esm/trackers/impressionObserver/impressionObserverCS.js +1 -1
  245. package/esm/trackers/impressionObserver/impressionObserverSS.js +1 -1
  246. package/esm/trackers/impressionsTracker.js +3 -3
  247. package/esm/utils/Backoff.js +1 -1
  248. package/esm/utils/LRUCache/index.js +1 -1
  249. package/esm/utils/MinEventEmitter.js +1 -1
  250. package/esm/utils/MinEvents.js +2 -5
  251. package/esm/utils/inputValidation/trafficTypeExistance.js +1 -1
  252. package/esm/utils/lang/binarySearch.js +1 -1
  253. package/esm/utils/lang/objectAssign.js +82 -0
  254. package/esm/utils/promise/thenable.js +3 -1
  255. package/esm/utils/promise/timeout.js +1 -1
  256. package/esm/utils/promise/wrapper.js +1 -1
  257. package/esm/utils/settingsValidation/impressionsMode.js +1 -1
  258. package/esm/utils/settingsValidation/index.js +3 -3
  259. package/esm/utils/settingsValidation/mode.js +1 -1
  260. package/esm/utils/timeTracker/index.js +4 -5
  261. package/esm/utils/timeTracker/now/browser.js +1 -2
  262. package/esm/utils/timeTracker/now/node.js +1 -1
  263. package/esm/utils/timeTracker/timer.js +1 -1
  264. package/package.json +2 -3
  265. package/src/evaluator/Engine.ts +3 -3
  266. package/src/evaluator/combiners/and.ts +2 -2
  267. package/src/evaluator/combiners/ifelseif.ts +2 -2
  268. package/src/evaluator/condition/index.ts +2 -2
  269. package/src/evaluator/index.ts +5 -6
  270. package/src/evaluator/matchers/all.ts +1 -1
  271. package/src/evaluator/matchers/between.ts +1 -1
  272. package/src/evaluator/matchers/boolean.ts +1 -1
  273. package/src/evaluator/matchers/cont_all.ts +1 -1
  274. package/src/evaluator/matchers/cont_any.ts +1 -1
  275. package/src/evaluator/matchers/cont_str.ts +1 -1
  276. package/src/evaluator/matchers/dependency.ts +2 -2
  277. package/src/evaluator/matchers/eq.ts +1 -1
  278. package/src/evaluator/matchers/eq_set.ts +1 -1
  279. package/src/evaluator/matchers/ew.ts +1 -1
  280. package/src/evaluator/matchers/gte.ts +1 -1
  281. package/src/evaluator/matchers/index.ts +35 -35
  282. package/src/evaluator/matchers/lte.ts +1 -1
  283. package/src/evaluator/matchers/part_of.ts +1 -1
  284. package/src/evaluator/matchers/segment.ts +2 -2
  285. package/src/evaluator/matchers/string.ts +1 -1
  286. package/src/evaluator/matchers/sw.ts +1 -1
  287. package/src/evaluator/matchers/whitelist.ts +1 -1
  288. package/src/evaluator/matchersTransform/index.ts +5 -5
  289. package/src/evaluator/matchersTransform/segment.ts +1 -1
  290. package/src/evaluator/matchersTransform/set.ts +1 -1
  291. package/src/evaluator/matchersTransform/unaryNumeric.ts +1 -1
  292. package/src/evaluator/matchersTransform/whitelist.ts +1 -1
  293. package/src/evaluator/parser/index.ts +12 -12
  294. package/src/evaluator/treatments/index.ts +1 -1
  295. package/src/evaluator/value/index.ts +3 -3
  296. package/src/evaluator/value/sanitize.ts +1 -1
  297. package/src/integrations/browser.ts +2 -2
  298. package/src/integrations/ga/GaToSplit.ts +1 -1
  299. package/src/integrations/pluggable.ts +1 -1
  300. package/src/listeners/browser.ts +2 -2
  301. package/src/listeners/node.ts +2 -2
  302. package/src/logger/index.ts +1 -1
  303. package/src/logger/messages/info.ts +1 -1
  304. package/src/logger/messages/warn.ts +2 -2
  305. package/src/readiness/readinessManager.ts +2 -2
  306. package/src/readiness/sdkReadinessManager.ts +3 -3
  307. package/src/sdkClient/client.ts +2 -2
  308. package/src/sdkClient/clientCS.ts +2 -2
  309. package/src/sdkClient/clientInputValidation.ts +2 -2
  310. package/src/sdkClient/sdkClient.ts +3 -3
  311. package/src/sdkClient/sdkClientMethodCS.ts +2 -2
  312. package/src/sdkClient/sdkClientMethodCSWithTT.ts +2 -2
  313. package/src/sdkFactory/index.ts +6 -6
  314. package/src/sdkManager/index.ts +2 -2
  315. package/src/services/splitApi.ts +1 -1
  316. package/src/services/splitHttpClient.ts +1 -1
  317. package/src/services/types.ts +1 -1
  318. package/src/storages/AbstractSegmentsCacheSync.ts +1 -1
  319. package/src/storages/AbstractSplitsCacheAsync.ts +1 -1
  320. package/src/storages/AbstractSplitsCacheSync.ts +1 -1
  321. package/src/storages/KeyBuilder.ts +1 -1
  322. package/src/storages/KeyBuilderCS.ts +2 -2
  323. package/src/storages/KeyBuilderSS.ts +2 -2
  324. package/src/storages/findLatencyIndex.ts +1 -1
  325. package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +3 -3
  326. package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +3 -3
  327. package/src/storages/inLocalStorage/index.ts +8 -8
  328. package/src/storages/inMemory/CountsCacheInMemory.ts +1 -1
  329. package/src/storages/inMemory/EventsCacheInMemory.ts +1 -1
  330. package/src/storages/inMemory/ImpressionCountsCacheInMemory.ts +1 -1
  331. package/src/storages/inMemory/ImpressionsCacheInMemory.ts +1 -1
  332. package/src/storages/inMemory/InMemoryStorage.ts +5 -5
  333. package/src/storages/inMemory/InMemoryStorageCS.ts +5 -5
  334. package/src/storages/inMemory/LatenciesCacheInMemory.ts +2 -2
  335. package/src/storages/inMemory/MySegmentsCacheInMemory.ts +2 -2
  336. package/src/storages/inMemory/SegmentsCacheInMemory.ts +2 -2
  337. package/src/storages/inMemory/SplitsCacheInMemory.ts +2 -2
  338. package/src/storages/inRedis/CountsCacheInRedis.ts +2 -2
  339. package/src/storages/inRedis/EventsCacheInRedis.ts +1 -1
  340. package/src/storages/inRedis/ImpressionsCacheInRedis.ts +1 -1
  341. package/src/storages/inRedis/LatenciesCacheInRedis.ts +3 -3
  342. package/src/storages/inRedis/RedisAdapter.ts +3 -3
  343. package/src/storages/inRedis/SegmentsCacheInRedis.ts +2 -2
  344. package/src/storages/inRedis/SplitsCacheInRedis.ts +3 -3
  345. package/src/storages/inRedis/index.ts +8 -8
  346. package/src/storages/pluggable/SegmentsCachePluggable.ts +1 -1
  347. package/src/storages/pluggable/SplitsCachePluggable.ts +2 -2
  348. package/src/storages/pluggable/index.ts +4 -4
  349. package/src/storages/types.ts +2 -2
  350. package/src/sync/offline/splitsParser/parseCondition.ts +1 -1
  351. package/src/sync/offline/splitsParser/splitsParserFromFile.ts +1 -1
  352. package/src/sync/offline/splitsParser/splitsParserFromSettings.ts +1 -1
  353. package/src/sync/offline/syncManagerOffline.ts +2 -2
  354. package/src/sync/offline/syncTasks/fromObjectSyncTask.ts +2 -2
  355. package/src/sync/polling/fetchers/mySegmentsFetcher.ts +1 -1
  356. package/src/sync/polling/fetchers/segmentChangesFetcher.ts +1 -1
  357. package/src/sync/polling/fetchers/splitChangesFetcher.ts +1 -1
  358. package/src/sync/polling/pollingManagerCS.ts +3 -3
  359. package/src/sync/polling/pollingManagerSS.ts +4 -4
  360. package/src/sync/polling/syncTasks/mySegmentsSyncTask.ts +3 -3
  361. package/src/sync/polling/syncTasks/segmentsSyncTask.ts +3 -3
  362. package/src/sync/polling/syncTasks/splitsSyncTask.ts +3 -3
  363. package/src/sync/polling/updaters/mySegmentsUpdater.ts +1 -1
  364. package/src/sync/polling/updaters/segmentChangesUpdater.ts +1 -1
  365. package/src/sync/polling/updaters/splitChangesUpdater.ts +6 -3
  366. package/src/sync/streaming/AuthClient/index.ts +1 -1
  367. package/src/sync/streaming/SSEClient/index.ts +1 -1
  368. package/src/sync/streaming/SSEHandler/NotificationKeeper.ts +1 -1
  369. package/src/sync/streaming/SSEHandler/index.ts +2 -2
  370. package/src/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.ts +2 -2
  371. package/src/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.ts +2 -2
  372. package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +2 -2
  373. package/src/sync/streaming/UpdateWorkers/types.ts +1 -1
  374. package/src/sync/streaming/pushManager.ts +10 -9
  375. package/src/sync/submitters/submitterSyncTask.ts +1 -1
  376. package/src/sync/syncTask.ts +1 -1
  377. package/src/trackers/eventTracker.ts +3 -3
  378. package/src/trackers/impressionObserver/ImpressionObserver.ts +2 -2
  379. package/src/trackers/impressionObserver/impressionObserverCS.ts +1 -1
  380. package/src/trackers/impressionObserver/impressionObserverSS.ts +1 -1
  381. package/src/trackers/impressionsTracker.ts +3 -3
  382. package/src/utils/Backoff.ts +1 -1
  383. package/src/utils/LRUCache/index.ts +1 -1
  384. package/src/utils/MinEventEmitter.ts +1 -1
  385. package/src/utils/MinEvents.ts +2 -7
  386. package/src/utils/inputValidation/trafficTypeExistance.ts +1 -1
  387. package/src/utils/lang/binarySearch.ts +1 -1
  388. package/src/utils/lang/objectAssign.ts +104 -0
  389. package/src/utils/promise/thenable.ts +3 -1
  390. package/src/utils/promise/timeout.ts +1 -1
  391. package/src/utils/promise/wrapper.ts +1 -1
  392. package/src/utils/settingsValidation/impressionsMode.ts +1 -1
  393. package/src/utils/settingsValidation/index.ts +3 -3
  394. package/src/utils/settingsValidation/mode.ts +1 -1
  395. package/src/utils/timeTracker/index.ts +4 -6
  396. package/src/utils/timeTracker/now/browser.ts +1 -3
  397. package/src/utils/timeTracker/now/node.ts +1 -1
  398. package/src/utils/timeTracker/timer.ts +1 -1
  399. package/types/evaluator/Engine.d.ts +1 -1
  400. package/types/evaluator/combiners/and.d.ts +1 -1
  401. package/types/evaluator/combiners/ifelseif.d.ts +1 -1
  402. package/types/evaluator/condition/index.d.ts +1 -1
  403. package/types/evaluator/matchers/all.d.ts +1 -1
  404. package/types/evaluator/matchers/between.d.ts +1 -1
  405. package/types/evaluator/matchers/boolean.d.ts +1 -1
  406. package/types/evaluator/matchers/cont_all.d.ts +1 -1
  407. package/types/evaluator/matchers/cont_any.d.ts +1 -1
  408. package/types/evaluator/matchers/cont_str.d.ts +1 -1
  409. package/types/evaluator/matchers/dependency.d.ts +1 -1
  410. package/types/evaluator/matchers/eq.d.ts +1 -1
  411. package/types/evaluator/matchers/eq_set.d.ts +1 -1
  412. package/types/evaluator/matchers/ew.d.ts +1 -1
  413. package/types/evaluator/matchers/gte.d.ts +1 -1
  414. package/types/evaluator/matchers/index.d.ts +1 -1
  415. package/types/evaluator/matchers/lte.d.ts +1 -1
  416. package/types/evaluator/matchers/part_of.d.ts +1 -1
  417. package/types/evaluator/matchers/segment.d.ts +1 -1
  418. package/types/evaluator/matchers/string.d.ts +1 -1
  419. package/types/evaluator/matchers/sw.d.ts +1 -1
  420. package/types/evaluator/matchers/whitelist.d.ts +1 -1
  421. package/types/evaluator/matchersTransform/index.d.ts +1 -1
  422. package/types/evaluator/matchersTransform/segment.d.ts +1 -1
  423. package/types/evaluator/matchersTransform/set.d.ts +1 -1
  424. package/types/evaluator/matchersTransform/unaryNumeric.d.ts +1 -1
  425. package/types/evaluator/matchersTransform/whitelist.d.ts +1 -1
  426. package/types/evaluator/parser/index.d.ts +1 -1
  427. package/types/evaluator/treatments/index.d.ts +1 -1
  428. package/types/evaluator/value/index.d.ts +1 -1
  429. package/types/evaluator/value/sanitize.d.ts +1 -1
  430. package/types/integrations/browser.d.ts +1 -1
  431. package/types/integrations/pluggable.d.ts +1 -1
  432. package/types/listeners/browser.d.ts +1 -1
  433. package/types/listeners/node.d.ts +1 -1
  434. package/types/readiness/sdkReadinessManager.d.ts +1 -1
  435. package/types/sdkClient/client.d.ts +1 -1
  436. package/types/sdkClient/clientCS.d.ts +1 -1
  437. package/types/sdkClient/clientInputValidation.d.ts +1 -1
  438. package/types/services/types.d.ts +1 -3
  439. package/types/storages/AbstractSegmentsCacheSync.d.ts +1 -1
  440. package/types/storages/AbstractSplitsCacheAsync.d.ts +1 -1
  441. package/types/storages/AbstractSplitsCacheSync.d.ts +1 -1
  442. package/types/storages/KeyBuilder.d.ts +1 -1
  443. package/types/storages/KeyBuilderCS.d.ts +2 -2
  444. package/types/storages/KeyBuilderSS.d.ts +2 -2
  445. package/types/storages/findLatencyIndex.d.ts +1 -1
  446. package/types/storages/inLocalStorage/MySegmentsCacheInLocal.d.ts +3 -3
  447. package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +3 -3
  448. package/types/storages/inMemory/CountsCacheInMemory.d.ts +1 -1
  449. package/types/storages/inMemory/EventsCacheInMemory.d.ts +1 -1
  450. package/types/storages/inMemory/ImpressionCountsCacheInMemory.d.ts +1 -1
  451. package/types/storages/inMemory/ImpressionsCacheInMemory.d.ts +1 -1
  452. package/types/storages/inMemory/LatenciesCacheInMemory.d.ts +1 -1
  453. package/types/storages/inMemory/MySegmentsCacheInMemory.d.ts +2 -2
  454. package/types/storages/inMemory/SegmentsCacheInMemory.d.ts +2 -2
  455. package/types/storages/inMemory/SplitsCacheInMemory.d.ts +2 -2
  456. package/types/storages/inRedis/CountsCacheInRedis.d.ts +2 -2
  457. package/types/storages/inRedis/EventsCacheInRedis.d.ts +1 -1
  458. package/types/storages/inRedis/ImpressionsCacheInRedis.d.ts +1 -1
  459. package/types/storages/inRedis/LatenciesCacheInRedis.d.ts +2 -2
  460. package/types/storages/inRedis/RedisAdapter.d.ts +1 -1
  461. package/types/storages/inRedis/SegmentsCacheInRedis.d.ts +2 -2
  462. package/types/storages/inRedis/SplitsCacheInRedis.d.ts +3 -3
  463. package/types/storages/pluggable/SegmentsCachePluggable.d.ts +1 -1
  464. package/types/storages/pluggable/SplitsCachePluggable.d.ts +2 -2
  465. package/types/storages/types.d.ts +2 -2
  466. package/types/sync/offline/splitsParser/parseCondition.d.ts +1 -1
  467. package/types/sync/offline/syncTasks/fromObjectSyncTask.d.ts +1 -1
  468. package/types/sync/polling/fetchers/mySegmentsFetcher.d.ts +1 -1
  469. package/types/sync/polling/fetchers/segmentChangesFetcher.d.ts +1 -1
  470. package/types/sync/polling/fetchers/splitChangesFetcher.d.ts +1 -1
  471. package/types/sync/polling/pollingManagerCS.d.ts +1 -1
  472. package/types/sync/polling/pollingManagerSS.d.ts +1 -1
  473. package/types/sync/polling/syncTasks/mySegmentsSyncTask.d.ts +1 -1
  474. package/types/sync/polling/syncTasks/segmentsSyncTask.d.ts +1 -1
  475. package/types/sync/polling/syncTasks/splitsSyncTask.d.ts +1 -1
  476. package/types/sync/streaming/SSEClient/index.d.ts +1 -1
  477. package/types/sync/streaming/SSEHandler/NotificationKeeper.d.ts +1 -1
  478. package/types/sync/streaming/SSEHandler/index.d.ts +1 -1
  479. package/types/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.d.ts +2 -2
  480. package/types/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.d.ts +2 -2
  481. package/types/sync/streaming/UpdateWorkers/SplitsUpdateWorker.d.ts +2 -2
  482. package/types/sync/streaming/UpdateWorkers/types.d.ts +1 -1
  483. package/types/sync/streaming/pushManager.d.ts +1 -1
  484. package/types/sync/syncTask.d.ts +1 -1
  485. package/types/trackers/eventTracker.d.ts +1 -1
  486. package/types/trackers/impressionObserver/ImpressionObserver.d.ts +1 -1
  487. package/types/trackers/impressionObserver/impressionObserverCS.d.ts +1 -1
  488. package/types/trackers/impressionObserver/impressionObserverSS.d.ts +1 -1
  489. package/types/trackers/impressionsTracker.d.ts +1 -1
  490. package/types/utils/Backoff.d.ts +1 -1
  491. package/types/utils/LRUCache/index.d.ts +1 -1
  492. package/types/utils/MinEventEmitter.d.ts +1 -1
  493. package/types/utils/MinEvents.d.ts +3 -2
  494. package/types/utils/lang/binarySearch.d.ts +1 -1
  495. package/types/utils/lang/objectAssign.d.ts +3 -0
  496. package/types/utils/promise/thenable.d.ts +1 -2
  497. package/types/utils/promise/timeout.d.ts +1 -1
  498. package/types/utils/promise/wrapper.d.ts +1 -1
  499. package/types/utils/settingsValidation/impressionsMode.d.ts +1 -1
  500. package/types/utils/settingsValidation/mode.d.ts +1 -1
  501. package/types/utils/timeTracker/index.d.ts +2 -2
  502. package/types/utils/timeTracker/now/browser.d.ts +1 -2
  503. package/types/utils/timeTracker/now/node.d.ts +1 -1
  504. package/types/utils/timeTracker/timer.d.ts +1 -1
@@ -2,8 +2,8 @@ import ioredis from 'ioredis';
2
2
  import { ILogger } from '../../logger/types';
3
3
  import { merge, isString } from '../../utils/lang';
4
4
  import { _Set, setToArray, ISet } from '../../utils/lang/sets';
5
- import thenable from '../../utils/promise/thenable';
6
- import timeout from '../../utils/promise/timeout';
5
+ import { thenable } from '../../utils/promise/thenable';
6
+ import { timeout } from '../../utils/promise/timeout';
7
7
 
8
8
  const LOG_PREFIX = 'storage:redis-adapter: ';
9
9
 
@@ -32,7 +32,7 @@ interface IRedisCommand {
32
32
  /**
33
33
  * Redis adapter on top of the library of choice (written with ioredis) for some extra control.
34
34
  */
35
- export default class RedisAdapter extends ioredis {
35
+ export class RedisAdapter extends ioredis {
36
36
  private readonly log: ILogger
37
37
  private _options: object;
38
38
  private _notReadyCommandsQueue?: IRedisCommand[];
@@ -2,10 +2,10 @@ import { Redis } from 'ioredis';
2
2
  import { ILogger } from '../../logger/types';
3
3
  import { isNaNNumber } from '../../utils/lang';
4
4
  import { LOG_PREFIX } from '../inLocalStorage/constants';
5
- import KeyBuilderSS from '../KeyBuilderSS';
5
+ import { KeyBuilderSS } from '../KeyBuilderSS';
6
6
  import { ISegmentsCacheAsync } from '../types';
7
7
 
8
- export default class SegmentsCacheInRedis implements ISegmentsCacheAsync {
8
+ export class SegmentsCacheInRedis implements ISegmentsCacheAsync {
9
9
 
10
10
  private readonly log: ILogger;
11
11
  private readonly redis: Redis;
@@ -1,10 +1,10 @@
1
1
  import { isFiniteNumber, isNaNNumber } from '../../utils/lang';
2
- import KeyBuilderSS from '../KeyBuilderSS';
2
+ import { KeyBuilderSS } from '../KeyBuilderSS';
3
3
  import { Redis } from 'ioredis';
4
4
  import { ILogger } from '../../logger/types';
5
5
  import { LOG_PREFIX } from './constants';
6
6
  import { ISplit } from '../../dtos/types';
7
- import AbstractSplitsCacheAsync from '../AbstractSplitsCacheAsync';
7
+ import { AbstractSplitsCacheAsync } from '../AbstractSplitsCacheAsync';
8
8
 
9
9
  /**
10
10
  * Discard errors for an answer of multiple operations.
@@ -20,7 +20,7 @@ function processPipelineAnswer(results: Array<[Error | null, string]>): string[]
20
20
  * ISplitsCacheAsync implementation that stores split definitions in Redis.
21
21
  * Supported by Node.
22
22
  */
23
- export default class SplitsCacheInRedis extends AbstractSplitsCacheAsync {
23
+ export class SplitsCacheInRedis extends AbstractSplitsCacheAsync {
24
24
 
25
25
  private readonly log: ILogger;
26
26
  private readonly redis: Redis;
@@ -1,13 +1,13 @@
1
- import RedisAdapter from './RedisAdapter';
1
+ import { RedisAdapter } from './RedisAdapter';
2
2
  import { IStorageAsync, IStorageAsyncFactory, IStorageFactoryParams } from '../types';
3
3
  import { validatePrefix } from '../KeyBuilder';
4
- import KeyBuilderSS from '../KeyBuilderSS';
5
- import SplitsCacheInRedis from './SplitsCacheInRedis';
6
- import SegmentsCacheInRedis from './SegmentsCacheInRedis';
7
- import ImpressionsCacheInRedis from './ImpressionsCacheInRedis';
8
- import EventsCacheInRedis from './EventsCacheInRedis';
9
- import LatenciesCacheInRedis from './LatenciesCacheInRedis';
10
- import CountsCacheInRedis from './CountsCacheInRedis';
4
+ import { KeyBuilderSS } from '../KeyBuilderSS';
5
+ import { SplitsCacheInRedis } from './SplitsCacheInRedis';
6
+ import { SegmentsCacheInRedis } from './SegmentsCacheInRedis';
7
+ import { ImpressionsCacheInRedis } from './ImpressionsCacheInRedis';
8
+ import { EventsCacheInRedis } from './EventsCacheInRedis';
9
+ import { LatenciesCacheInRedis } from './LatenciesCacheInRedis';
10
+ import { CountsCacheInRedis } from './CountsCacheInRedis';
11
11
  import { STORAGE_REDIS } from '../../utils/constants';
12
12
 
13
13
  export interface InRedisStorageOptions {
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
2
  /* eslint-disable no-unused-vars */
3
3
  import { isNaNNumber } from '../../utils/lang';
4
- import KeyBuilderSS from '../KeyBuilderSS';
4
+ import { KeyBuilderSS } from '../KeyBuilderSS';
5
5
  import { IPluggableStorageWrapper, ISegmentsCacheAsync } from '../types';
6
6
  import { ILogger } from '../../logger/types';
7
7
  import { LOG_PREFIX } from './constants';
@@ -1,10 +1,10 @@
1
1
  import { isFiniteNumber, isNaNNumber } from '../../utils/lang';
2
- import KeyBuilder from '../KeyBuilder';
2
+ import { KeyBuilder } from '../KeyBuilder';
3
3
  import { IPluggableStorageWrapper } from '../types';
4
4
  import { ILogger } from '../../logger/types';
5
5
  import { ISplit } from '../../dtos/types';
6
6
  import { LOG_PREFIX } from './constants';
7
- import AbstractSplitsCacheAsync from '../AbstractSplitsCacheAsync';
7
+ import { AbstractSplitsCacheAsync } from '../AbstractSplitsCacheAsync';
8
8
 
9
9
  /**
10
10
  * ISplitsCacheAsync implementation for pluggable storages.
@@ -1,6 +1,6 @@
1
1
  import { IPluggableStorageWrapper, IStorageAsync, IStorageAsyncFactory, IStorageFactoryParams } from '../types';
2
2
 
3
- import KeyBuilderSS from '../KeyBuilderSS';
3
+ import { KeyBuilderSS } from '../KeyBuilderSS';
4
4
  import { SplitsCachePluggable } from './SplitsCachePluggable';
5
5
  import { SegmentsCachePluggable } from './SegmentsCachePluggable';
6
6
  import { ImpressionsCachePluggable } from './ImpressionsCachePluggable';
@@ -9,9 +9,9 @@ import { wrapperAdapter, METHODS_TO_PROMISE_WRAP } from './wrapperAdapter';
9
9
  import { isObject } from '../../utils/lang';
10
10
  import { validatePrefix } from '../KeyBuilder';
11
11
  import { CONSUMER_PARTIAL_MODE, STORAGE_PLUGGABLE } from '../../utils/constants';
12
- import ImpressionsCacheInMemory from '../inMemory/ImpressionsCacheInMemory';
13
- import EventsCacheInMemory from '../inMemory/EventsCacheInMemory';
14
- import ImpressionCountsCacheInMemory from '../inMemory/ImpressionCountsCacheInMemory';
12
+ import { ImpressionsCacheInMemory } from '../inMemory/ImpressionsCacheInMemory';
13
+ import { EventsCacheInMemory } from '../inMemory/EventsCacheInMemory';
14
+ import { ImpressionCountsCacheInMemory } from '../inMemory/ImpressionCountsCacheInMemory';
15
15
 
16
16
  const NO_VALID_WRAPPER = 'Expecting pluggable storage `wrapper` in options, but no valid wrapper instance was provided.';
17
17
  const NO_VALID_WRAPPER_INTERFACE = 'The provided wrapper instance doesn’t follow the expected interface. Check our docs.';
@@ -70,7 +70,7 @@ export interface IPluggableStorageWrapper {
70
70
  /** Integer operations */
71
71
 
72
72
  /**
73
- * Increments in 1 the given `key` value or set it in 1 if the value doesn't exist.
73
+ * Increments in 1 the given `key` value or set it to 1 if the value doesn't exist.
74
74
  *
75
75
  * @function incr
76
76
  * @param {string} key Key to increment
@@ -79,7 +79,7 @@ export interface IPluggableStorageWrapper {
79
79
  */
80
80
  incr: (key: string) => Promise<number>
81
81
  /**
82
- * Decrements in 1 the given `key` value or set it in -1 if the value doesn't exist.
82
+ * Decrements in 1 the given `key` value or set it to -1 if the value doesn't exist.
83
83
  *
84
84
  * @function decr
85
85
  * @param {string} key Key to decrement
@@ -7,7 +7,7 @@ export interface IMockSplitEntry {
7
7
  config?: string
8
8
  }
9
9
 
10
- export default function parseCondition(data: IMockSplitEntry): ISplitCondition {
10
+ export function parseCondition(data: IMockSplitEntry): ISplitCondition {
11
11
  const treatment = data.treatment;
12
12
 
13
13
  if (data.keys) {
@@ -5,7 +5,7 @@ import path from 'path';
5
5
  // @ts-ignore
6
6
  import yaml from 'js-yaml';
7
7
  import { isString, endsWith, find, forOwn, uniq, } from '../../../utils/lang';
8
- import parseCondition, { IMockSplitEntry } from './parseCondition';
8
+ import { parseCondition, IMockSplitEntry } from './parseCondition';
9
9
  import { ISplitPartial } from '../../../dtos/types';
10
10
  import { ISettings, SplitIO } from '../../../types';
11
11
  import { ILogger } from '../../../logger/types';
@@ -1,7 +1,7 @@
1
1
  import { ISplitPartial } from '../../../dtos/types';
2
2
  import { ISettings, SplitIO } from '../../../types';
3
3
  import { isObject, forOwn } from '../../../utils/lang';
4
- import parseCondition from './parseCondition';
4
+ import { parseCondition } from './parseCondition';
5
5
 
6
6
  function hasTreatmentChanged(prev: string | SplitIO.TreatmentWithConfig, curr: string | SplitIO.TreatmentWithConfig) {
7
7
  if (typeof prev !== typeof curr) return true;
@@ -1,6 +1,6 @@
1
1
  import { ISyncManager, ISyncManagerCS, ISyncManagerFactoryParams } from '../types';
2
- import fromObjectSyncTaskFactory from './syncTasks/fromObjectSyncTask';
3
- import objectAssign from 'object-assign';
2
+ import { fromObjectSyncTaskFactory } from './syncTasks/fromObjectSyncTask';
3
+ import { objectAssign } from '../../utils/lang/objectAssign';
4
4
  import { ISplitsParser } from './splitsParser/types';
5
5
  import { IReadinessManager } from '../../readiness/types';
6
6
  import { SDK_SEGMENTS_ARRIVED } from '../../readiness/constants';
@@ -3,7 +3,7 @@ import { IReadinessManager } from '../../../readiness/types';
3
3
  import { ISplitsCacheSync } from '../../../storages/types';
4
4
  import { ISplitsParser } from '../splitsParser/types';
5
5
  import { ISplitPartial } from '../../../dtos/types';
6
- import syncTaskFactory from '../../syncTask';
6
+ import { syncTaskFactory } from '../../syncTask';
7
7
  import { ISyncTask } from '../../types';
8
8
  import { ISettings } from '../../../types';
9
9
  import { CONTROL } from '../../../utils/constants';
@@ -79,7 +79,7 @@ export function fromObjectUpdaterFactory(
79
79
  /**
80
80
  * PollingManager in Offline mode
81
81
  */
82
- export default function fromObjectSyncTaskFactory(
82
+ export function fromObjectSyncTaskFactory(
83
83
  splitsParser: ISplitsParser,
84
84
  storage: { splits: ISplitsCacheSync },
85
85
  readiness: IReadinessManager,
@@ -6,7 +6,7 @@ import { IMySegmentsFetcher } from './types';
6
6
  * Factory of MySegments fetcher.
7
7
  * MySegments fetcher is a wrapper around `mySegments` API service that parses the response and handle errors.
8
8
  */
9
- export default function mySegmentsFetcherFactory(fetchMySegments: IFetchMySegments, userMatchingKey: string): IMySegmentsFetcher {
9
+ export function mySegmentsFetcherFactory(fetchMySegments: IFetchMySegments, userMatchingKey: string): IMySegmentsFetcher {
10
10
 
11
11
  return function mySegmentsFetcher(
12
12
  noCache?: boolean,
@@ -21,7 +21,7 @@ function greedyFetch(fetchSegmentChanges: IFetchSegmentChanges, since: number, s
21
21
  * Factory of SegmentChanges fetcher.
22
22
  * SegmentChanges fetcher is a wrapper around `segmentChanges` API service that parses the response and handle errors and retries.
23
23
  */
24
- export default function segmentChangesFetcherFactory(fetchSegmentChanges: IFetchSegmentChanges): ISegmentChangesFetcher {
24
+ export function segmentChangesFetcherFactory(fetchSegmentChanges: IFetchSegmentChanges): ISegmentChangesFetcher {
25
25
 
26
26
  return function segmentChangesFetcher(
27
27
  since: number,
@@ -5,7 +5,7 @@ import { ISplitChangesFetcher } from './types';
5
5
  * Factory of SplitChanges fetcher.
6
6
  * SplitChanges fetcher is a wrapper around `splitChanges` API service that parses the response and handle errors.
7
7
  */
8
- export default function splitChangesFetcherFactory(fetchSplitChanges: IFetchSplitChanges): ISplitChangesFetcher {
8
+ export function splitChangesFetcherFactory(fetchSplitChanges: IFetchSplitChanges): ISplitChangesFetcher {
9
9
 
10
10
  return function splitChangesFetcher(
11
11
  since: number,
@@ -3,8 +3,8 @@ import { forOwn } from '../../utils/lang';
3
3
  import { IReadinessManager } from '../../readiness/types';
4
4
  import { ISplitApi } from '../../services/types';
5
5
  import { IStorageSync } from '../../storages/types';
6
- import mySegmentsSyncTaskFactory from './syncTasks/mySegmentsSyncTask';
7
- import splitsSyncTaskFactory from './syncTasks/splitsSyncTask';
6
+ import { mySegmentsSyncTaskFactory } from './syncTasks/mySegmentsSyncTask';
7
+ import { splitsSyncTaskFactory } from './syncTasks/splitsSyncTask';
8
8
  import { ISettings } from '../../types';
9
9
  import { getMatching } from '../../utils/key';
10
10
  import { SDK_SPLITS_ARRIVED, SDK_SEGMENTS_ARRIVED } from '../../readiness/constants';
@@ -14,7 +14,7 @@ import { POLLING_SMART_PAUSING, POLLING_START, POLLING_STOP } from '../../logger
14
14
  * Expose start / stop mechanism for polling data from services.
15
15
  * For client-side API with multiple clients.
16
16
  */
17
- export default function pollingManagerCSFactory(
17
+ export function pollingManagerCSFactory(
18
18
  splitApi: ISplitApi,
19
19
  storage: IStorageSync,
20
20
  readiness: IReadinessManager,
@@ -1,17 +1,17 @@
1
- import splitsSyncTaskFactory from './syncTasks/splitsSyncTask';
2
- import segmentsSyncTaskFactory from './syncTasks/segmentsSyncTask';
1
+ import { splitsSyncTaskFactory } from './syncTasks/splitsSyncTask';
2
+ import { segmentsSyncTaskFactory } from './syncTasks/segmentsSyncTask';
3
3
  import { IStorageSync } from '../../storages/types';
4
4
  import { IReadinessManager } from '../../readiness/types';
5
5
  import { ISplitApi } from '../../services/types';
6
6
  import { ISettings } from '../../types';
7
7
  import { IPollingManager, ISegmentsSyncTask, ISplitsSyncTask } from './types';
8
- import thenable from '../../utils/promise/thenable';
8
+ import { thenable } from '../../utils/promise/thenable';
9
9
  import { POLLING_START, POLLING_STOP, LOG_PREFIX_SYNC_POLLING } from '../../logger/constants';
10
10
 
11
11
  /**
12
12
  * Expose start / stop mechanism for pulling data from services.
13
13
  */
14
- export default function pollingManagerSSFactory(
14
+ export function pollingManagerSSFactory(
15
15
  splitApi: ISplitApi,
16
16
  storage: IStorageSync,
17
17
  readiness: IReadinessManager,
@@ -1,16 +1,16 @@
1
1
  import { IStorageSync } from '../../../storages/types';
2
2
  import { IReadinessManager } from '../../../readiness/types';
3
- import syncTaskFactory from '../../syncTask';
3
+ import { syncTaskFactory } from '../../syncTask';
4
4
  import { ISegmentsSyncTask } from '../types';
5
5
  import { IFetchMySegments } from '../../../services/types';
6
- import mySegmentsFetcherFactory from '../fetchers/mySegmentsFetcher';
6
+ import { mySegmentsFetcherFactory } from '../fetchers/mySegmentsFetcher';
7
7
  import { ISettings } from '../../../types';
8
8
  import { mySegmentsUpdaterFactory } from '../updaters/mySegmentsUpdater';
9
9
 
10
10
  /**
11
11
  * Creates a sync task that periodically executes a `mySegmentsUpdater` task
12
12
  */
13
- export default function mySegmentsSyncTaskFactory(
13
+ export function mySegmentsSyncTaskFactory(
14
14
  fetchMySegments: IFetchMySegments,
15
15
  storage: IStorageSync,
16
16
  readiness: IReadinessManager,
@@ -1,8 +1,8 @@
1
1
  import { IStorageSync } from '../../../storages/types';
2
2
  import { IReadinessManager } from '../../../readiness/types';
3
- import syncTaskFactory from '../../syncTask';
3
+ import { syncTaskFactory } from '../../syncTask';
4
4
  import { ISegmentsSyncTask } from '../types';
5
- import segmentChangesFetcherFactory from '../fetchers/segmentChangesFetcher';
5
+ import { segmentChangesFetcherFactory } from '../fetchers/segmentChangesFetcher';
6
6
  import { IFetchSegmentChanges } from '../../../services/types';
7
7
  import { ISettings } from '../../../types';
8
8
  import { segmentChangesUpdaterFactory } from '../updaters/segmentChangesUpdater';
@@ -10,7 +10,7 @@ import { segmentChangesUpdaterFactory } from '../updaters/segmentChangesUpdater'
10
10
  /**
11
11
  * Creates a sync task that periodically executes a `segmentChangesUpdater` task
12
12
  */
13
- export default function segmentsSyncTaskFactory(
13
+ export function segmentsSyncTaskFactory(
14
14
  fetchSegmentChanges: IFetchSegmentChanges,
15
15
  storage: IStorageSync,
16
16
  readiness: IReadinessManager,
@@ -1,8 +1,8 @@
1
1
  import { IStorageSync } from '../../../storages/types';
2
2
  import { IReadinessManager } from '../../../readiness/types';
3
- import syncTaskFactory from '../../syncTask';
3
+ import { syncTaskFactory } from '../../syncTask';
4
4
  import { ISplitsSyncTask } from '../types';
5
- import splitChangesFetcherFactory from '../fetchers/splitChangesFetcher';
5
+ import { splitChangesFetcherFactory } from '../fetchers/splitChangesFetcher';
6
6
  import { IFetchSplitChanges } from '../../../services/types';
7
7
  import { ISettings } from '../../../types';
8
8
  import { splitChangesUpdaterFactory } from '../updaters/splitChangesUpdater';
@@ -10,7 +10,7 @@ import { splitChangesUpdaterFactory } from '../updaters/splitChangesUpdater';
10
10
  /**
11
11
  * Creates a sync task that periodically executes a `splitChangesUpdater` task
12
12
  */
13
- export default function splitsSyncTaskFactory(
13
+ export function splitsSyncTaskFactory(
14
14
  fetchSplitChanges: IFetchSplitChanges,
15
15
  storage: IStorageSync,
16
16
  readiness: IReadinessManager,
@@ -1,7 +1,7 @@
1
1
  import { IMySegmentsFetcher } from '../fetchers/types';
2
2
  import { ISegmentsCacheSync, ISplitsCacheSync } from '../../../storages/types';
3
3
  import { ISegmentsEventEmitter } from '../../../readiness/types';
4
- import timeout from '../../../utils/promise/timeout';
4
+ import { timeout } from '../../../utils/promise/timeout';
5
5
  import { SDK_SEGMENTS_ARRIVED } from '../../../readiness/constants';
6
6
  import { ILogger } from '../../../logger/types';
7
7
  import { SYNC_MYSEGMENTS_FETCH_RETRY } from '../../../logger/constants';
@@ -6,7 +6,7 @@ import { findIndex } from '../../../utils/lang';
6
6
  import { SDK_SEGMENTS_ARRIVED } from '../../../readiness/constants';
7
7
  import { ILogger } from '../../../logger/types';
8
8
  import { LOG_PREFIX_INSTANTIATION, LOG_PREFIX_SYNC_SEGMENTS } from '../../../logger/constants';
9
- import thenable from '../../../utils/promise/thenable';
9
+ import { thenable } from '../../../utils/promise/thenable';
10
10
 
11
11
  type ISegmentChangesUpdater = (segmentNames?: string[], noCache?: boolean, fetchOnlyNew?: boolean) => Promise<boolean>
12
12
 
@@ -3,7 +3,7 @@ import { ISegmentsCacheBase, ISplitsCacheBase } from '../../../storages/types';
3
3
  import { ISplitChangesFetcher } from '../fetchers/types';
4
4
  import { ISplit, ISplitChangesResponse } from '../../../dtos/types';
5
5
  import { ISplitsEventEmitter } from '../../../readiness/types';
6
- import timeout from '../../../utils/promise/timeout';
6
+ import { timeout } from '../../../utils/promise/timeout';
7
7
  import { SDK_SPLITS_ARRIVED, SDK_SPLITS_CACHE_LOADED } from '../../../readiness/constants';
8
8
  import { ILogger } from '../../../logger/types';
9
9
  import { SYNC_SPLITS_FETCH, SYNC_SPLITS_NEW, SYNC_SPLITS_REMOVED, SYNC_SPLITS_SEGMENTS, SYNC_SPLITS_FETCH_FAILS, SYNC_SPLITS_FETCH_RETRY } from '../../../logger/constants';
@@ -168,9 +168,12 @@ export function splitChangesUpdaterFactory(
168
168
  return false;
169
169
  });
170
170
 
171
- // After triggering the requests, if we have cached splits information let's notify that.
171
+ // After triggering the requests, if we have cached splits information let's notify that to emit SDK_READY_FROM_CACHE.
172
+ // Wrapping in a promise since checkCache can be async.
172
173
  if (splitsEventEmitter && startingUp) {
173
- Promise.resolve(splits.checkCache()).then(cacheReady => { if (cacheReady) splitsEventEmitter.emit(SDK_SPLITS_CACHE_LOADED); });
174
+ Promise.resolve(splits.checkCache()).then(isCacheReady => {
175
+ if (isCacheReady) splitsEventEmitter.emit(SDK_SPLITS_CACHE_LOADED);
176
+ });
174
177
  }
175
178
  return fetcherPromise;
176
179
  }
@@ -1,6 +1,6 @@
1
1
  import { IFetchAuth } from '../../../services/types';
2
2
  import { IAuthenticate, IAuthToken } from './types';
3
- import objectAssign from 'object-assign';
3
+ import { objectAssign } from '../../../utils/lang/objectAssign';
4
4
  import { encodeToBase64 } from '../../../utils/base64';
5
5
  import { decodeJWTtoken } from '../../../utils/jwt';
6
6
  import { hash } from '../../../utils/murmur3/murmur3';
@@ -30,7 +30,7 @@ function buildSSEHeaders(settings: ISettings) {
30
30
  /**
31
31
  * Handles streaming connections with EventSource API
32
32
  */
33
- export default class SSEClient implements ISSEClient {
33
+ export class SSEClient implements ISSEClient {
34
34
  // Instance properties:
35
35
  eventSource?: IEventSourceConstructor;
36
36
  streamingUrl: string;
@@ -9,7 +9,7 @@ const CONTROL_CHANNEL_REGEXS = [/control_pri$/, /control_sec$/];
9
9
  * @param pushEmitter emitter for events related to streaming support
10
10
  */
11
11
  // @TODO update logic to handle OCCUPANCY for any region and rename according to new spec (e.g.: PUSH_SUBSYSTEM_UP --> PUSH_SUBSYSTEM_UP)
12
- export default function notificationKeeperFactory(pushEmitter: IPushEventEmitter) {
12
+ export function notificationKeeperFactory(pushEmitter: IPushEventEmitter) {
13
13
 
14
14
  let channels = CONTROL_CHANNEL_REGEXS.map(regex => ({
15
15
  regex,
@@ -1,5 +1,5 @@
1
1
  import { errorParser, messageParser } from './NotificationParser';
2
- import notificationKeeperFactory from './NotificationKeeper';
2
+ import { notificationKeeperFactory } from './NotificationKeeper';
3
3
  import { PUSH_RETRYABLE_ERROR, PUSH_NONRETRYABLE_ERROR, OCCUPANCY, CONTROL, MY_SEGMENTS_UPDATE, MY_SEGMENTS_UPDATE_V2, SEGMENT_UPDATE, SPLIT_KILL, SPLIT_UPDATE } from '../constants';
4
4
  import { IPushEventEmitter } from '../types';
5
5
  import { ISseEventHandler } from '../SSEClient/types';
@@ -25,7 +25,7 @@ function isRetryableError(error: INotificationError) {
25
25
  * @param log factory logger
26
26
  * @param pushEmitter emitter for events related to streaming support
27
27
  */
28
- export default function SSEHandlerFactory(log: ILogger, pushEmitter: IPushEventEmitter): ISseEventHandler {
28
+ export function SSEHandlerFactory(log: ILogger, pushEmitter: IPushEventEmitter): ISseEventHandler {
29
29
 
30
30
  const notificationKeeper = notificationKeeperFactory(pushEmitter);
31
31
 
@@ -1,12 +1,12 @@
1
1
  import { ISegmentsSyncTask } from '../../polling/types';
2
- import Backoff from '../../../utils/Backoff';
2
+ import { Backoff } from '../../../utils/Backoff';
3
3
  import { IUpdateWorker } from './types';
4
4
  import { SegmentsData } from '../SSEHandler/types';
5
5
 
6
6
  /**
7
7
  * MySegmentsUpdateWorker class
8
8
  */
9
- export default class MySegmentsUpdateWorker implements IUpdateWorker {
9
+ export class MySegmentsUpdateWorker implements IUpdateWorker {
10
10
 
11
11
  private readonly mySegmentsSyncTask: ISegmentsSyncTask;
12
12
  private maxChangeNumber: number;
@@ -1,5 +1,5 @@
1
1
  import { ISegmentsCacheSync } from '../../../storages/types';
2
- import Backoff from '../../../utils/Backoff';
2
+ import { Backoff } from '../../../utils/Backoff';
3
3
  import { ISegmentsSyncTask } from '../../polling/types';
4
4
  import { ISegmentUpdateData } from '../SSEHandler/types';
5
5
  import { IUpdateWorker } from './types';
@@ -7,7 +7,7 @@ import { IUpdateWorker } from './types';
7
7
  /**
8
8
  * SegmentUpdateWorker class
9
9
  */
10
- export default class SegmentsUpdateWorker implements IUpdateWorker {
10
+ export class SegmentsUpdateWorker implements IUpdateWorker {
11
11
 
12
12
  private readonly segmentsCache: ISegmentsCacheSync;
13
13
  private readonly segmentsSyncTask: ISegmentsSyncTask;
@@ -1,7 +1,7 @@
1
1
  import { SDK_SPLITS_ARRIVED } from '../../../readiness/constants';
2
2
  import { ISplitsEventEmitter } from '../../../readiness/types';
3
3
  import { ISplitsCacheSync } from '../../../storages/types';
4
- import Backoff from '../../../utils/Backoff';
4
+ import { Backoff } from '../../../utils/Backoff';
5
5
  import { ISegmentsSyncTask, ISplitsSyncTask } from '../../polling/types';
6
6
  import { ISplitKillData, ISplitUpdateData } from '../SSEHandler/types';
7
7
  import { IUpdateWorker } from './types';
@@ -9,7 +9,7 @@ import { IUpdateWorker } from './types';
9
9
  /**
10
10
  * SplitsUpdateWorker class
11
11
  */
12
- export default class SplitsUpdateWorker implements IUpdateWorker {
12
+ export class SplitsUpdateWorker implements IUpdateWorker {
13
13
 
14
14
  private readonly splitsCache: ISplitsCacheSync;
15
15
  private readonly splitsSyncTask: ISplitsSyncTask;
@@ -1,4 +1,4 @@
1
- import Backoff from '../../../utils/Backoff';
1
+ import { Backoff } from '../../../utils/Backoff';
2
2
 
3
3
  export interface IUpdateWorker {
4
4
  readonly backoff: Backoff,
@@ -3,15 +3,15 @@ import { ISSEClient } from './SSEClient/types';
3
3
  import { IStorageSync } from '../../storages/types';
4
4
  import { IReadinessManager } from '../../readiness/types';
5
5
  import { ISegmentsSyncTask, IPollingManager } from '../polling/types';
6
- import objectAssign from 'object-assign';
7
- import Backoff from '../../utils/Backoff';
8
- import SSEHandlerFactory from './SSEHandler';
9
- import MySegmentsUpdateWorker from './UpdateWorkers/MySegmentsUpdateWorker';
10
- import SegmentsUpdateWorker from './UpdateWorkers/SegmentsUpdateWorker';
11
- import SplitsUpdateWorker from './UpdateWorkers/SplitsUpdateWorker';
6
+ import { objectAssign } from '../../utils/lang/objectAssign';
7
+ import { Backoff } from '../../utils/Backoff';
8
+ import { SSEHandlerFactory } from './SSEHandler';
9
+ import { MySegmentsUpdateWorker } from './UpdateWorkers/MySegmentsUpdateWorker';
10
+ import { SegmentsUpdateWorker } from './UpdateWorkers/SegmentsUpdateWorker';
11
+ import { SplitsUpdateWorker } from './UpdateWorkers/SplitsUpdateWorker';
12
12
  import { authenticateFactory, hashUserKey } from './AuthClient';
13
13
  import { forOwn } from '../../utils/lang';
14
- import SSEClient from './SSEClient';
14
+ import { SSEClient } from './SSEClient';
15
15
  import { IFetchAuth } from '../../services/types';
16
16
  import { ISettings } from '../../types';
17
17
  import { getMatching } from '../../utils/key';
@@ -29,7 +29,7 @@ import { IAuthTokenPushEnabled } from './AuthClient/types';
29
29
  * - for server-side if key is not provided in settings.
30
30
  * - for client-side, with support for multiple clients, if key is provided in settings
31
31
  */
32
- export default function pushManagerFactory(
32
+ export function pushManagerFactory(
33
33
  pollingManager: IPollingManager,
34
34
  storage: IStorageSync,
35
35
  readiness: IReadinessManager,
@@ -115,7 +115,8 @@ export default function pushManagerFactory(
115
115
  function connectPush() {
116
116
  // Guard condition in case `stop/disconnectPush` has been called (e.g., calling SDK destroy, or app signal close/background)
117
117
  if (disconnected) return;
118
- log.info(STREAMING_CONNECTING, [disconnected === undefined ? '' : 'Re-']);
118
+ // @TODO distinguish log for 'Connecting' (1st time) and 'Re-connecting'
119
+ log.info(STREAMING_CONNECTING);
119
120
  disconnected = false;
120
121
 
121
122
  const userKeys = userKey ? Object.keys(clients) : undefined;
@@ -1,4 +1,4 @@
1
- import syncTaskFactory from '../syncTask';
1
+ import { syncTaskFactory } from '../syncTask';
2
2
  import { ISyncTask, ITimeTracker } from '../types';
3
3
  import { IRecorderCacheProducerSync } from '../../storages/types';
4
4
  import { ILogger } from '../../logger/types';
@@ -13,7 +13,7 @@ import { ISyncTask } from './types';
13
13
  * @param taskName Optional task name for logging.
14
14
  * @returns A sync task that wraps the given task.
15
15
  */
16
- export default function syncTaskFactory<Input extends any[], Output = any>(log: ILogger, task: (...args: Input) => Promise<Output>, period: number, taskName = 'task'): ISyncTask<Input, Output> {
16
+ export function syncTaskFactory<Input extends any[], Output = any>(log: ILogger, task: (...args: Input) => Promise<Output>, period: number, taskName = 'task'): ISyncTask<Input, Output> {
17
17
 
18
18
  // Flag that indicates if the task is being executed
19
19
  let executing = false;
@@ -1,5 +1,5 @@
1
- import objectAssign from 'object-assign';
2
- import thenable from '../utils/promise/thenable';
1
+ import { objectAssign } from '../utils/lang/objectAssign';
2
+ import { thenable } from '../utils/promise/thenable';
3
3
  import { IEventsCacheBase } from '../storages/types';
4
4
  import { IEventsHandler, IEventTracker } from './types';
5
5
  import { SplitIO } from '../types';
@@ -12,7 +12,7 @@ import { EVENTS_TRACKER_SUCCESS, ERROR_EVENTS_TRACKER } from '../logger/constant
12
12
  * @param eventsCache cache to save events
13
13
  * @param integrationsManager optional event handler used for integrations
14
14
  */
15
- export default function eventTrackerFactory(
15
+ export function eventTrackerFactory(
16
16
  log: ILogger,
17
17
  eventsCache: IEventsCacheBase,
18
18
  integrationsManager?: IEventsHandler
@@ -1,8 +1,8 @@
1
1
  import { ImpressionDTO } from '../../types';
2
- import LRUCache from '../../utils/LRUCache';
2
+ import { LRUCache } from '../../utils/LRUCache';
3
3
  import { IImpressionObserver } from './types';
4
4
 
5
- export default class ImpressionObserver<K extends string | number = string> implements IImpressionObserver {
5
+ export class ImpressionObserver<K extends string | number = string> implements IImpressionObserver {
6
6
  private cache: LRUCache<K, number>;
7
7
  private hasher: (impression: ImpressionDTO) => K;
8
8
 
@@ -1,4 +1,4 @@
1
- import ImpressionObserver from './ImpressionObserver';
1
+ import { ImpressionObserver } from './ImpressionObserver';
2
2
  import { hash } from '../../utils/murmur3/murmur3';
3
3
  import { buildKey } from './buildKey';
4
4
  import { ImpressionDTO } from '../../types';
@@ -1,4 +1,4 @@
1
- import ImpressionObserver from './ImpressionObserver';
1
+ import { ImpressionObserver } from './ImpressionObserver';
2
2
  import { hash128 } from '../../utils/murmur3/murmur3_128_x86';
3
3
  import { buildKey } from './buildKey';
4
4
  import { ImpressionDTO } from '../../types';
@@ -1,5 +1,5 @@
1
- import objectAssign from 'object-assign';
2
- import thenable from '../utils/promise/thenable';
1
+ import { objectAssign } from '../utils/lang/objectAssign';
2
+ import { thenable } from '../utils/promise/thenable';
3
3
  import { truncateTimeFrame } from '../utils/time';
4
4
  import { IImpressionCountsCacheSync, IImpressionsCacheBase } from '../storages/types';
5
5
  import { IImpressionsHandler, IImpressionsTracker } from './types';
@@ -18,7 +18,7 @@ import { IMPRESSIONS_TRACKER_SUCCESS, ERROR_IMPRESSIONS_TRACKER, ERROR_IMPRESSIO
18
18
  * @param observer optional impression observer. If provided, previous time (pt property) is included in impression instances
19
19
  * @param countsCache optional cache to save impressions count. If provided, impressions will be deduped (OPTIMIZED mode)
20
20
  */
21
- export default function impressionsTrackerFactory(
21
+ export function impressionsTrackerFactory(
22
22
  log: ILogger,
23
23
  impressionsCache: IImpressionsCacheBase,
24
24