@splitsoftware/splitio-commons 1.0.1-rc.2 → 1.0.1-rc.6

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 (510) hide show
  1. package/cjs/evaluator/Engine.js +6 -5
  2. package/cjs/evaluator/combiners/and.js +4 -4
  3. package/cjs/evaluator/combiners/ifelseif.js +4 -3
  4. package/cjs/evaluator/condition/index.js +4 -3
  5. package/cjs/evaluator/index.js +10 -11
  6. package/cjs/evaluator/matchers/all.js +2 -1
  7. package/cjs/evaluator/matchers/between.js +2 -1
  8. package/cjs/evaluator/matchers/boolean.js +2 -1
  9. package/cjs/evaluator/matchers/cont_all.js +3 -2
  10. package/cjs/evaluator/matchers/cont_any.js +3 -2
  11. package/cjs/evaluator/matchers/cont_str.js +2 -1
  12. package/cjs/evaluator/matchers/dependency.js +4 -4
  13. package/cjs/evaluator/matchers/eq.js +2 -1
  14. package/cjs/evaluator/matchers/eq_set.js +2 -1
  15. package/cjs/evaluator/matchers/ew.js +2 -1
  16. package/cjs/evaluator/matchers/gte.js +2 -1
  17. package/cjs/evaluator/matchers/index.js +36 -36
  18. package/cjs/evaluator/matchers/lte.js +2 -1
  19. package/cjs/evaluator/matchers/part_of.js +3 -2
  20. package/cjs/evaluator/matchers/segment.js +5 -5
  21. package/cjs/evaluator/matchers/string.js +2 -1
  22. package/cjs/evaluator/matchers/sw.js +2 -1
  23. package/cjs/evaluator/matchers/whitelist.js +2 -1
  24. package/cjs/evaluator/matchersTransform/index.js +12 -12
  25. package/cjs/evaluator/matchersTransform/segment.js +3 -2
  26. package/cjs/evaluator/matchersTransform/set.js +3 -2
  27. package/cjs/evaluator/matchersTransform/unaryNumeric.js +3 -2
  28. package/cjs/evaluator/matchersTransform/whitelist.js +3 -2
  29. package/cjs/evaluator/parser/index.js +16 -16
  30. package/cjs/evaluator/treatments/index.js +2 -1
  31. package/cjs/evaluator/value/index.js +5 -5
  32. package/cjs/evaluator/value/sanitize.js +2 -1
  33. package/cjs/integrations/browser.js +4 -4
  34. package/cjs/integrations/ga/GaToSplit.js +3 -4
  35. package/cjs/integrations/pluggable.js +3 -2
  36. package/cjs/listeners/browser.js +4 -4
  37. package/cjs/listeners/node.js +4 -4
  38. package/cjs/logger/index.js +2 -3
  39. package/cjs/logger/messages/warn.js +2 -2
  40. package/cjs/readiness/readinessManager.js +3 -4
  41. package/cjs/readiness/sdkReadinessManager.js +7 -7
  42. package/cjs/sdkClient/client.js +5 -5
  43. package/cjs/sdkClient/clientCS.js +4 -4
  44. package/cjs/sdkClient/clientInputValidation.js +5 -5
  45. package/cjs/sdkClient/sdkClient.js +5 -6
  46. package/cjs/sdkClient/sdkClientMethodCS.js +4 -5
  47. package/cjs/sdkClient/sdkClientMethodCSWithTT.js +4 -5
  48. package/cjs/sdkFactory/index.js +7 -8
  49. package/cjs/sdkManager/index.js +6 -7
  50. package/cjs/services/splitApi.js +2 -3
  51. package/cjs/services/splitHttpClient.js +3 -4
  52. package/cjs/storages/AbstractSegmentsCacheSync.js +2 -1
  53. package/cjs/storages/AbstractSplitsCacheAsync.js +2 -1
  54. package/cjs/storages/AbstractSplitsCacheSync.js +2 -2
  55. package/cjs/storages/KeyBuilder.js +2 -2
  56. package/cjs/storages/KeyBuilderCS.js +4 -3
  57. package/cjs/storages/KeyBuilderSS.js +4 -3
  58. package/cjs/storages/findLatencyIndex.js +2 -1
  59. package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +4 -3
  60. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +4 -3
  61. package/cjs/storages/inLocalStorage/index.js +20 -21
  62. package/cjs/storages/inMemory/CountsCacheInMemory.js +2 -1
  63. package/cjs/storages/inMemory/EventsCacheInMemory.js +2 -1
  64. package/cjs/storages/inMemory/ImpressionCountsCacheInMemory.js +2 -1
  65. package/cjs/storages/inMemory/ImpressionsCacheInMemory.js +2 -1
  66. package/cjs/storages/inMemory/InMemoryStorage.js +10 -11
  67. package/cjs/storages/inMemory/InMemoryStorageCS.js +12 -13
  68. package/cjs/storages/inMemory/LatenciesCacheInMemory.js +4 -4
  69. package/cjs/storages/inMemory/MySegmentsCacheInMemory.js +4 -3
  70. package/cjs/storages/inMemory/SegmentsCacheInMemory.js +4 -3
  71. package/cjs/storages/inMemory/SplitsCacheInMemory.js +4 -3
  72. package/cjs/storages/inRedis/CountsCacheInRedis.js +2 -1
  73. package/cjs/storages/inRedis/EventsCacheInRedis.js +2 -1
  74. package/cjs/storages/inRedis/ImpressionsCacheInRedis.js +2 -1
  75. package/cjs/storages/inRedis/LatenciesCacheInRedis.js +4 -4
  76. package/cjs/storages/inRedis/RedisAdapter.js +6 -5
  77. package/cjs/storages/inRedis/SegmentsCacheInRedis.js +2 -1
  78. package/cjs/storages/inRedis/SplitsCacheInRedis.js +4 -3
  79. package/cjs/storages/inRedis/index.js +16 -17
  80. package/cjs/storages/pluggable/SplitsCachePluggable.js +2 -2
  81. package/cjs/storages/pluggable/constants.js +1 -1
  82. package/cjs/storages/pluggable/index.js +8 -8
  83. package/cjs/sync/offline/splitsParser/parseCondition.js +2 -1
  84. package/cjs/sync/offline/splitsParser/splitsParserFromFile.js +3 -3
  85. package/cjs/sync/offline/splitsParser/splitsParserFromSettings.js +2 -3
  86. package/cjs/sync/offline/syncManagerOffline.js +3 -4
  87. package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +4 -5
  88. package/cjs/sync/polling/fetchers/mySegmentsFetcher.js +2 -1
  89. package/cjs/sync/polling/fetchers/segmentChangesFetcher.js +2 -1
  90. package/cjs/sync/polling/fetchers/splitChangesFetcher.js +2 -1
  91. package/cjs/sync/polling/pollingManagerCS.js +6 -6
  92. package/cjs/sync/polling/pollingManagerSS.js +8 -8
  93. package/cjs/sync/polling/syncTasks/mySegmentsSyncTask.js +5 -5
  94. package/cjs/sync/polling/syncTasks/segmentsSyncTask.js +5 -5
  95. package/cjs/sync/polling/syncTasks/splitsSyncTask.js +5 -5
  96. package/cjs/sync/polling/updaters/mySegmentsUpdater.js +2 -3
  97. package/cjs/sync/polling/updaters/segmentChangesUpdater.js +2 -3
  98. package/cjs/sync/polling/updaters/splitChangesUpdater.js +2 -3
  99. package/cjs/sync/streaming/AuthClient/index.js +2 -3
  100. package/cjs/sync/streaming/SSEClient/index.js +2 -2
  101. package/cjs/sync/streaming/SSEHandler/NotificationKeeper.js +2 -1
  102. package/cjs/sync/streaming/SSEHandler/index.js +4 -4
  103. package/cjs/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +4 -4
  104. package/cjs/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +4 -4
  105. package/cjs/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +4 -4
  106. package/cjs/sync/streaming/pushManager.js +16 -16
  107. package/cjs/sync/submitters/submitterSyncTask.js +2 -3
  108. package/cjs/sync/syncTask.js +2 -1
  109. package/cjs/trackers/eventTracker.js +7 -7
  110. package/cjs/trackers/impressionObserver/ImpressionObserver.js +4 -4
  111. package/cjs/trackers/impressionObserver/impressionObserverCS.js +2 -3
  112. package/cjs/trackers/impressionObserver/impressionObserverSS.js +2 -3
  113. package/cjs/trackers/impressionsTracker.js +6 -6
  114. package/cjs/utils/Backoff.js +2 -1
  115. package/cjs/utils/LRUCache/index.js +2 -1
  116. package/cjs/utils/MinEventEmitter.js +7 -6
  117. package/cjs/utils/MinEvents.js +13 -15
  118. package/cjs/utils/env/isNode.js +4 -1
  119. package/cjs/utils/inputValidation/trafficTypeExistance.js +2 -3
  120. package/cjs/utils/lang/binarySearch.js +2 -1
  121. package/cjs/utils/lang/objectAssign.js +85 -0
  122. package/cjs/utils/promise/thenable.js +5 -1
  123. package/cjs/utils/promise/timeout.js +2 -1
  124. package/cjs/utils/promise/wrapper.js +2 -1
  125. package/cjs/utils/settingsValidation/impressionsMode.js +2 -1
  126. package/cjs/utils/settingsValidation/index.js +4 -5
  127. package/cjs/utils/settingsValidation/mode.js +2 -1
  128. package/cjs/utils/timeTracker/index.js +7 -8
  129. package/cjs/utils/timeTracker/now/browser.js +2 -2
  130. package/cjs/utils/timeTracker/now/node.js +2 -1
  131. package/cjs/utils/timeTracker/timer.js +3 -2
  132. package/esm/evaluator/Engine.js +3 -3
  133. package/esm/evaluator/combiners/and.js +2 -2
  134. package/esm/evaluator/combiners/ifelseif.js +2 -2
  135. package/esm/evaluator/condition/index.js +2 -2
  136. package/esm/evaluator/index.js +5 -6
  137. package/esm/evaluator/matchers/all.js +1 -1
  138. package/esm/evaluator/matchers/between.js +1 -1
  139. package/esm/evaluator/matchers/boolean.js +1 -1
  140. package/esm/evaluator/matchers/cont_all.js +1 -1
  141. package/esm/evaluator/matchers/cont_any.js +1 -1
  142. package/esm/evaluator/matchers/cont_str.js +1 -1
  143. package/esm/evaluator/matchers/dependency.js +2 -2
  144. package/esm/evaluator/matchers/eq.js +1 -1
  145. package/esm/evaluator/matchers/eq_set.js +1 -1
  146. package/esm/evaluator/matchers/ew.js +1 -1
  147. package/esm/evaluator/matchers/gte.js +1 -1
  148. package/esm/evaluator/matchers/index.js +35 -35
  149. package/esm/evaluator/matchers/lte.js +1 -1
  150. package/esm/evaluator/matchers/part_of.js +1 -1
  151. package/esm/evaluator/matchers/segment.js +2 -2
  152. package/esm/evaluator/matchers/string.js +1 -1
  153. package/esm/evaluator/matchers/sw.js +1 -1
  154. package/esm/evaluator/matchers/whitelist.js +1 -1
  155. package/esm/evaluator/matchersTransform/index.js +5 -5
  156. package/esm/evaluator/matchersTransform/segment.js +1 -1
  157. package/esm/evaluator/matchersTransform/set.js +1 -1
  158. package/esm/evaluator/matchersTransform/unaryNumeric.js +1 -1
  159. package/esm/evaluator/matchersTransform/whitelist.js +1 -1
  160. package/esm/evaluator/parser/index.js +11 -11
  161. package/esm/evaluator/treatments/index.js +1 -1
  162. package/esm/evaluator/value/index.js +3 -3
  163. package/esm/evaluator/value/sanitize.js +1 -1
  164. package/esm/integrations/browser.js +2 -2
  165. package/esm/integrations/ga/GaToSplit.js +1 -1
  166. package/esm/integrations/pluggable.js +1 -1
  167. package/esm/listeners/browser.js +2 -2
  168. package/esm/listeners/node.js +2 -2
  169. package/esm/logger/index.js +1 -1
  170. package/esm/logger/messages/warn.js +2 -2
  171. package/esm/readiness/readinessManager.js +1 -1
  172. package/esm/readiness/sdkReadinessManager.js +3 -3
  173. package/esm/sdkClient/client.js +2 -2
  174. package/esm/sdkClient/clientCS.js +2 -2
  175. package/esm/sdkClient/clientInputValidation.js +2 -2
  176. package/esm/sdkClient/sdkClient.js +3 -3
  177. package/esm/sdkClient/sdkClientMethodCS.js +2 -2
  178. package/esm/sdkClient/sdkClientMethodCSWithTT.js +2 -2
  179. package/esm/sdkFactory/index.js +4 -4
  180. package/esm/sdkManager/index.js +2 -2
  181. package/esm/services/splitApi.js +1 -1
  182. package/esm/services/splitHttpClient.js +1 -1
  183. package/esm/storages/AbstractSegmentsCacheSync.js +1 -1
  184. package/esm/storages/AbstractSplitsCacheAsync.js +1 -1
  185. package/esm/storages/AbstractSplitsCacheSync.js +1 -1
  186. package/esm/storages/KeyBuilder.js +1 -1
  187. package/esm/storages/KeyBuilderCS.js +2 -2
  188. package/esm/storages/KeyBuilderSS.js +2 -2
  189. package/esm/storages/findLatencyIndex.js +1 -1
  190. package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +2 -2
  191. package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +2 -2
  192. package/esm/storages/inLocalStorage/index.js +8 -8
  193. package/esm/storages/inMemory/CountsCacheInMemory.js +1 -1
  194. package/esm/storages/inMemory/EventsCacheInMemory.js +1 -1
  195. package/esm/storages/inMemory/ImpressionCountsCacheInMemory.js +1 -1
  196. package/esm/storages/inMemory/ImpressionsCacheInMemory.js +1 -1
  197. package/esm/storages/inMemory/InMemoryStorage.js +5 -5
  198. package/esm/storages/inMemory/InMemoryStorageCS.js +5 -5
  199. package/esm/storages/inMemory/LatenciesCacheInMemory.js +2 -2
  200. package/esm/storages/inMemory/MySegmentsCacheInMemory.js +2 -2
  201. package/esm/storages/inMemory/SegmentsCacheInMemory.js +2 -2
  202. package/esm/storages/inMemory/SplitsCacheInMemory.js +2 -2
  203. package/esm/storages/inRedis/CountsCacheInRedis.js +1 -1
  204. package/esm/storages/inRedis/EventsCacheInRedis.js +1 -1
  205. package/esm/storages/inRedis/ImpressionsCacheInRedis.js +1 -1
  206. package/esm/storages/inRedis/LatenciesCacheInRedis.js +2 -2
  207. package/esm/storages/inRedis/RedisAdapter.js +3 -3
  208. package/esm/storages/inRedis/SegmentsCacheInRedis.js +1 -1
  209. package/esm/storages/inRedis/SplitsCacheInRedis.js +2 -2
  210. package/esm/storages/inRedis/index.js +8 -8
  211. package/esm/storages/pluggable/SplitsCachePluggable.js +1 -1
  212. package/esm/storages/pluggable/constants.js +1 -1
  213. package/esm/storages/pluggable/index.js +4 -4
  214. package/esm/sync/offline/splitsParser/parseCondition.js +1 -1
  215. package/esm/sync/offline/splitsParser/splitsParserFromFile.js +1 -1
  216. package/esm/sync/offline/splitsParser/splitsParserFromSettings.js +1 -1
  217. package/esm/sync/offline/syncManagerOffline.js +2 -2
  218. package/esm/sync/offline/syncTasks/fromObjectSyncTask.js +2 -2
  219. package/esm/sync/polling/fetchers/mySegmentsFetcher.js +1 -1
  220. package/esm/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
  221. package/esm/sync/polling/fetchers/splitChangesFetcher.js +1 -1
  222. package/esm/sync/polling/pollingManagerCS.js +3 -3
  223. package/esm/sync/polling/pollingManagerSS.js +4 -4
  224. package/esm/sync/polling/syncTasks/mySegmentsSyncTask.js +3 -3
  225. package/esm/sync/polling/syncTasks/segmentsSyncTask.js +3 -3
  226. package/esm/sync/polling/syncTasks/splitsSyncTask.js +3 -3
  227. package/esm/sync/polling/updaters/mySegmentsUpdater.js +1 -1
  228. package/esm/sync/polling/updaters/segmentChangesUpdater.js +1 -1
  229. package/esm/sync/polling/updaters/splitChangesUpdater.js +1 -1
  230. package/esm/sync/streaming/AuthClient/index.js +1 -1
  231. package/esm/sync/streaming/SSEClient/index.js +1 -2
  232. package/esm/sync/streaming/SSEHandler/NotificationKeeper.js +1 -1
  233. package/esm/sync/streaming/SSEHandler/index.js +2 -2
  234. package/esm/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +2 -2
  235. package/esm/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +2 -2
  236. package/esm/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +2 -2
  237. package/esm/sync/streaming/pushManager.js +8 -8
  238. package/esm/sync/submitters/submitterSyncTask.js +1 -1
  239. package/esm/sync/syncTask.js +1 -1
  240. package/esm/trackers/eventTracker.js +3 -3
  241. package/esm/trackers/impressionObserver/ImpressionObserver.js +2 -2
  242. package/esm/trackers/impressionObserver/impressionObserverCS.js +1 -1
  243. package/esm/trackers/impressionObserver/impressionObserverSS.js +1 -1
  244. package/esm/trackers/impressionsTracker.js +3 -3
  245. package/esm/utils/Backoff.js +1 -1
  246. package/esm/utils/LRUCache/index.js +1 -1
  247. package/esm/utils/MinEventEmitter.js +6 -6
  248. package/esm/utils/MinEvents.js +2 -5
  249. package/esm/utils/env/isNode.js +4 -1
  250. package/esm/utils/inputValidation/trafficTypeExistance.js +1 -1
  251. package/esm/utils/lang/binarySearch.js +1 -1
  252. package/esm/utils/lang/objectAssign.js +82 -0
  253. package/esm/utils/promise/thenable.js +3 -1
  254. package/esm/utils/promise/timeout.js +1 -1
  255. package/esm/utils/promise/wrapper.js +1 -1
  256. package/esm/utils/settingsValidation/impressionsMode.js +1 -1
  257. package/esm/utils/settingsValidation/index.js +2 -2
  258. package/esm/utils/settingsValidation/mode.js +1 -1
  259. package/esm/utils/timeTracker/index.js +4 -5
  260. package/esm/utils/timeTracker/now/browser.js +1 -2
  261. package/esm/utils/timeTracker/now/node.js +1 -1
  262. package/esm/utils/timeTracker/timer.js +1 -1
  263. package/package.json +4 -6
  264. package/src/evaluator/Engine.ts +3 -3
  265. package/src/evaluator/combiners/and.ts +2 -2
  266. package/src/evaluator/combiners/ifelseif.ts +2 -2
  267. package/src/evaluator/condition/index.ts +2 -2
  268. package/src/evaluator/index.ts +5 -6
  269. package/src/evaluator/matchers/all.ts +1 -1
  270. package/src/evaluator/matchers/between.ts +1 -1
  271. package/src/evaluator/matchers/boolean.ts +1 -1
  272. package/src/evaluator/matchers/cont_all.ts +1 -1
  273. package/src/evaluator/matchers/cont_any.ts +1 -1
  274. package/src/evaluator/matchers/cont_str.ts +1 -1
  275. package/src/evaluator/matchers/dependency.ts +2 -2
  276. package/src/evaluator/matchers/eq.ts +1 -1
  277. package/src/evaluator/matchers/eq_set.ts +1 -1
  278. package/src/evaluator/matchers/ew.ts +1 -1
  279. package/src/evaluator/matchers/gte.ts +1 -1
  280. package/src/evaluator/matchers/index.ts +35 -35
  281. package/src/evaluator/matchers/lte.ts +1 -1
  282. package/src/evaluator/matchers/part_of.ts +1 -1
  283. package/src/evaluator/matchers/segment.ts +2 -2
  284. package/src/evaluator/matchers/string.ts +1 -1
  285. package/src/evaluator/matchers/sw.ts +1 -1
  286. package/src/evaluator/matchers/whitelist.ts +1 -1
  287. package/src/evaluator/matchersTransform/index.ts +5 -5
  288. package/src/evaluator/matchersTransform/segment.ts +1 -1
  289. package/src/evaluator/matchersTransform/set.ts +1 -1
  290. package/src/evaluator/matchersTransform/unaryNumeric.ts +1 -1
  291. package/src/evaluator/matchersTransform/whitelist.ts +1 -1
  292. package/src/evaluator/parser/index.ts +12 -12
  293. package/src/evaluator/treatments/index.ts +1 -1
  294. package/src/evaluator/value/index.ts +3 -3
  295. package/src/evaluator/value/sanitize.ts +1 -1
  296. package/src/integrations/browser.ts +2 -2
  297. package/src/integrations/ga/GaToSplit.ts +1 -1
  298. package/src/integrations/pluggable.ts +1 -1
  299. package/src/listeners/browser.ts +2 -2
  300. package/src/listeners/node.ts +2 -2
  301. package/src/logger/index.ts +1 -1
  302. package/src/logger/messages/warn.ts +2 -2
  303. package/src/readiness/readinessManager.ts +2 -2
  304. package/src/readiness/sdkReadinessManager.ts +3 -3
  305. package/src/sdkClient/client.ts +2 -2
  306. package/src/sdkClient/clientCS.ts +2 -2
  307. package/src/sdkClient/clientInputValidation.ts +2 -2
  308. package/src/sdkClient/sdkClient.ts +3 -3
  309. package/src/sdkClient/sdkClientMethodCS.ts +2 -2
  310. package/src/sdkClient/sdkClientMethodCSWithTT.ts +2 -2
  311. package/src/sdkFactory/index.ts +4 -4
  312. package/src/sdkFactory/types.ts +2 -2
  313. package/src/sdkManager/index.ts +2 -2
  314. package/src/services/splitApi.ts +1 -1
  315. package/src/services/splitHttpClient.ts +1 -1
  316. package/src/services/types.ts +16 -2
  317. package/src/storages/AbstractSegmentsCacheSync.ts +1 -1
  318. package/src/storages/AbstractSplitsCacheAsync.ts +1 -1
  319. package/src/storages/AbstractSplitsCacheSync.ts +1 -1
  320. package/src/storages/KeyBuilder.ts +1 -1
  321. package/src/storages/KeyBuilderCS.ts +2 -2
  322. package/src/storages/KeyBuilderSS.ts +2 -2
  323. package/src/storages/findLatencyIndex.ts +1 -1
  324. package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +3 -3
  325. package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +3 -3
  326. package/src/storages/inLocalStorage/index.ts +8 -8
  327. package/src/storages/inMemory/CountsCacheInMemory.ts +1 -1
  328. package/src/storages/inMemory/EventsCacheInMemory.ts +1 -1
  329. package/src/storages/inMemory/ImpressionCountsCacheInMemory.ts +1 -1
  330. package/src/storages/inMemory/ImpressionsCacheInMemory.ts +1 -1
  331. package/src/storages/inMemory/InMemoryStorage.ts +5 -5
  332. package/src/storages/inMemory/InMemoryStorageCS.ts +5 -5
  333. package/src/storages/inMemory/LatenciesCacheInMemory.ts +2 -2
  334. package/src/storages/inMemory/MySegmentsCacheInMemory.ts +2 -2
  335. package/src/storages/inMemory/SegmentsCacheInMemory.ts +2 -2
  336. package/src/storages/inMemory/SplitsCacheInMemory.ts +2 -2
  337. package/src/storages/inRedis/CountsCacheInRedis.ts +2 -2
  338. package/src/storages/inRedis/EventsCacheInRedis.ts +1 -1
  339. package/src/storages/inRedis/ImpressionsCacheInRedis.ts +1 -1
  340. package/src/storages/inRedis/LatenciesCacheInRedis.ts +3 -3
  341. package/src/storages/inRedis/RedisAdapter.ts +3 -3
  342. package/src/storages/inRedis/SegmentsCacheInRedis.ts +2 -2
  343. package/src/storages/inRedis/SplitsCacheInRedis.ts +3 -3
  344. package/src/storages/inRedis/index.ts +8 -8
  345. package/src/storages/pluggable/SegmentsCachePluggable.ts +1 -1
  346. package/src/storages/pluggable/SplitsCachePluggable.ts +2 -2
  347. package/src/storages/pluggable/constants.ts +1 -1
  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 +1 -1
  366. package/src/sync/streaming/AuthClient/index.ts +1 -1
  367. package/src/sync/streaming/SSEClient/index.ts +6 -6
  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 +8 -8
  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/types.ts +9 -8
  383. package/src/utils/Backoff.ts +1 -1
  384. package/src/utils/LRUCache/index.ts +1 -1
  385. package/src/utils/MinEventEmitter.ts +11 -11
  386. package/src/utils/MinEvents.ts +2 -7
  387. package/src/utils/env/isNode.ts +4 -1
  388. package/src/utils/inputValidation/trafficTypeExistance.ts +1 -1
  389. package/src/utils/lang/binarySearch.ts +1 -1
  390. package/src/utils/lang/objectAssign.ts +104 -0
  391. package/src/utils/promise/thenable.ts +3 -1
  392. package/src/utils/promise/timeout.ts +1 -1
  393. package/src/utils/promise/wrapper.ts +1 -1
  394. package/src/utils/settingsValidation/impressionsMode.ts +1 -1
  395. package/src/utils/settingsValidation/index.ts +2 -2
  396. package/src/utils/settingsValidation/mode.ts +1 -1
  397. package/src/utils/timeTracker/index.ts +4 -6
  398. package/src/utils/timeTracker/now/browser.ts +1 -3
  399. package/src/utils/timeTracker/now/node.ts +1 -1
  400. package/src/utils/timeTracker/timer.ts +1 -1
  401. package/types/evaluator/Engine.d.ts +1 -1
  402. package/types/evaluator/combiners/and.d.ts +1 -1
  403. package/types/evaluator/combiners/ifelseif.d.ts +1 -1
  404. package/types/evaluator/condition/index.d.ts +1 -1
  405. package/types/evaluator/matchers/all.d.ts +1 -1
  406. package/types/evaluator/matchers/between.d.ts +1 -1
  407. package/types/evaluator/matchers/boolean.d.ts +1 -1
  408. package/types/evaluator/matchers/cont_all.d.ts +1 -1
  409. package/types/evaluator/matchers/cont_any.d.ts +1 -1
  410. package/types/evaluator/matchers/cont_str.d.ts +1 -1
  411. package/types/evaluator/matchers/dependency.d.ts +1 -1
  412. package/types/evaluator/matchers/eq.d.ts +1 -1
  413. package/types/evaluator/matchers/eq_set.d.ts +1 -1
  414. package/types/evaluator/matchers/ew.d.ts +1 -1
  415. package/types/evaluator/matchers/gte.d.ts +1 -1
  416. package/types/evaluator/matchers/index.d.ts +1 -1
  417. package/types/evaluator/matchers/lte.d.ts +1 -1
  418. package/types/evaluator/matchers/part_of.d.ts +1 -1
  419. package/types/evaluator/matchers/segment.d.ts +1 -1
  420. package/types/evaluator/matchers/string.d.ts +1 -1
  421. package/types/evaluator/matchers/sw.d.ts +1 -1
  422. package/types/evaluator/matchers/whitelist.d.ts +1 -1
  423. package/types/evaluator/matchersTransform/index.d.ts +1 -1
  424. package/types/evaluator/matchersTransform/segment.d.ts +1 -1
  425. package/types/evaluator/matchersTransform/set.d.ts +1 -1
  426. package/types/evaluator/matchersTransform/unaryNumeric.d.ts +1 -1
  427. package/types/evaluator/matchersTransform/whitelist.d.ts +1 -1
  428. package/types/evaluator/parser/index.d.ts +1 -1
  429. package/types/evaluator/treatments/index.d.ts +1 -1
  430. package/types/evaluator/value/index.d.ts +1 -1
  431. package/types/evaluator/value/sanitize.d.ts +1 -1
  432. package/types/integrations/browser.d.ts +1 -1
  433. package/types/integrations/pluggable.d.ts +1 -1
  434. package/types/listeners/browser.d.ts +1 -1
  435. package/types/listeners/node.d.ts +1 -1
  436. package/types/readiness/sdkReadinessManager.d.ts +1 -1
  437. package/types/sdkClient/client.d.ts +1 -1
  438. package/types/sdkClient/clientCS.d.ts +1 -1
  439. package/types/sdkClient/clientInputValidation.d.ts +1 -1
  440. package/types/sdkFactory/types.d.ts +2 -2
  441. package/types/services/types.d.ts +11 -0
  442. package/types/storages/AbstractSegmentsCacheSync.d.ts +1 -1
  443. package/types/storages/AbstractSplitsCacheAsync.d.ts +1 -1
  444. package/types/storages/AbstractSplitsCacheSync.d.ts +1 -1
  445. package/types/storages/KeyBuilder.d.ts +1 -1
  446. package/types/storages/KeyBuilderCS.d.ts +2 -2
  447. package/types/storages/KeyBuilderSS.d.ts +2 -2
  448. package/types/storages/findLatencyIndex.d.ts +1 -1
  449. package/types/storages/inLocalStorage/MySegmentsCacheInLocal.d.ts +3 -3
  450. package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +3 -3
  451. package/types/storages/inMemory/CountsCacheInMemory.d.ts +1 -1
  452. package/types/storages/inMemory/EventsCacheInMemory.d.ts +1 -1
  453. package/types/storages/inMemory/ImpressionCountsCacheInMemory.d.ts +1 -1
  454. package/types/storages/inMemory/ImpressionsCacheInMemory.d.ts +1 -1
  455. package/types/storages/inMemory/LatenciesCacheInMemory.d.ts +1 -1
  456. package/types/storages/inMemory/MySegmentsCacheInMemory.d.ts +2 -2
  457. package/types/storages/inMemory/SegmentsCacheInMemory.d.ts +2 -2
  458. package/types/storages/inMemory/SplitsCacheInMemory.d.ts +2 -2
  459. package/types/storages/inRedis/CountsCacheInRedis.d.ts +2 -2
  460. package/types/storages/inRedis/EventsCacheInRedis.d.ts +1 -1
  461. package/types/storages/inRedis/ImpressionsCacheInRedis.d.ts +1 -1
  462. package/types/storages/inRedis/LatenciesCacheInRedis.d.ts +2 -2
  463. package/types/storages/inRedis/RedisAdapter.d.ts +1 -1
  464. package/types/storages/inRedis/SegmentsCacheInRedis.d.ts +2 -2
  465. package/types/storages/inRedis/SplitsCacheInRedis.d.ts +3 -3
  466. package/types/storages/pluggable/SegmentsCachePluggable.d.ts +1 -1
  467. package/types/storages/pluggable/SplitsCachePluggable.d.ts +2 -2
  468. package/types/storages/pluggable/constants.d.ts +1 -1
  469. package/types/storages/types.d.ts +2 -2
  470. package/types/sync/offline/splitsParser/parseCondition.d.ts +1 -1
  471. package/types/sync/offline/syncTasks/fromObjectSyncTask.d.ts +1 -1
  472. package/types/sync/polling/fetchers/mySegmentsFetcher.d.ts +1 -1
  473. package/types/sync/polling/fetchers/segmentChangesFetcher.d.ts +1 -1
  474. package/types/sync/polling/fetchers/splitChangesFetcher.d.ts +1 -1
  475. package/types/sync/polling/pollingManagerCS.d.ts +1 -1
  476. package/types/sync/polling/pollingManagerSS.d.ts +1 -1
  477. package/types/sync/polling/syncTasks/mySegmentsSyncTask.d.ts +1 -1
  478. package/types/sync/polling/syncTasks/segmentsSyncTask.d.ts +1 -1
  479. package/types/sync/polling/syncTasks/splitsSyncTask.d.ts +1 -1
  480. package/types/sync/streaming/SSEClient/index.d.ts +5 -4
  481. package/types/sync/streaming/SSEHandler/NotificationKeeper.d.ts +1 -1
  482. package/types/sync/streaming/SSEHandler/index.d.ts +1 -1
  483. package/types/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.d.ts +2 -2
  484. package/types/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.d.ts +2 -2
  485. package/types/sync/streaming/UpdateWorkers/SplitsUpdateWorker.d.ts +2 -2
  486. package/types/sync/streaming/UpdateWorkers/types.d.ts +1 -1
  487. package/types/sync/streaming/pushManager.d.ts +1 -1
  488. package/types/sync/syncTask.d.ts +1 -1
  489. package/types/trackers/eventTracker.d.ts +1 -1
  490. package/types/trackers/impressionObserver/ImpressionObserver.d.ts +1 -1
  491. package/types/trackers/impressionObserver/impressionObserverCS.d.ts +1 -1
  492. package/types/trackers/impressionObserver/impressionObserverSS.d.ts +1 -1
  493. package/types/trackers/impressionsTracker.d.ts +1 -1
  494. package/types/types.d.ts +9 -9
  495. package/types/utils/Backoff.d.ts +1 -1
  496. package/types/utils/LRUCache/index.d.ts +1 -1
  497. package/types/utils/MinEventEmitter.d.ts +7 -7
  498. package/types/utils/MinEvents.d.ts +3 -2
  499. package/types/utils/env/isNode.d.ts +4 -0
  500. package/types/utils/lang/binarySearch.d.ts +1 -1
  501. package/types/utils/lang/objectAssign.d.ts +3 -0
  502. package/types/utils/promise/thenable.d.ts +1 -2
  503. package/types/utils/promise/timeout.d.ts +1 -1
  504. package/types/utils/promise/wrapper.d.ts +1 -1
  505. package/types/utils/settingsValidation/impressionsMode.d.ts +1 -1
  506. package/types/utils/settingsValidation/mode.d.ts +1 -1
  507. package/types/utils/timeTracker/index.d.ts +2 -2
  508. package/types/utils/timeTracker/now/browser.d.ts +1 -2
  509. package/types/utils/timeTracker/now/node.d.ts +1 -1
  510. package/types/utils/timeTracker/timer.d.ts +1 -1
@@ -1,7 +1,7 @@
1
1
  var _a;
2
2
  import { uniqueId } from '../lang';
3
- import timer from './timer';
4
- import thenable from '../promise/thenable';
3
+ import { timer } from './timer';
4
+ import { thenable } from '../promise/thenable';
5
5
  // Map we will use for storing timers data
6
6
  var timers = {};
7
7
  // Tasks constants
@@ -86,7 +86,8 @@ function getCallbackForTask(task, collector) {
86
86
  return collector[callbackData.method];
87
87
  return false;
88
88
  }
89
- var TrackerAPI = {
89
+ // Our "time tracker" API
90
+ export var TrackerAPI = {
90
91
  /**
91
92
  * "Private" method, used to attach count/countException and stop callbacks to a promise.
92
93
  *
@@ -190,5 +191,3 @@ var TrackerAPI = {
190
191
  */
191
192
  TaskNames: CONSTANTS
192
193
  };
193
- // Our "time tracker" API
194
- export default TrackerAPI;
@@ -9,5 +9,4 @@ function nowFactory() {
9
9
  return Date.now;
10
10
  }
11
11
  }
12
- var now = nowFactory();
13
- export default now;
12
+ export var now = nowFactory();
@@ -1,5 +1,5 @@
1
1
  // @TODO migrate to Node SDK package eventually
2
- export default function now() {
2
+ export function now() {
3
3
  // eslint-disable-next-line no-undef
4
4
  var time = process.hrtime();
5
5
  return time[0] * 1e3 + time[1] * 1e-6; // convert it to milis
@@ -1,4 +1,4 @@
1
- export default function start(now) {
1
+ export function timer(now) {
2
2
  var st = now ? now() : Date.now();
3
3
  return function stop() {
4
4
  return Math.round(now ? now() : Date.now() - st);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splitsoftware/splitio-commons",
3
- "version": "1.0.1-rc.2",
3
+ "version": "1.0.1-rc.6",
4
4
  "description": "Split Javascript SDK common components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -44,24 +44,22 @@
44
44
  "bugs": "https://github.com/splitio/javascript-commons/issues",
45
45
  "homepage": "https://github.com/splitio/javascript-commons#readme",
46
46
  "dependencies": {
47
- "object-assign": "^4.1.1",
48
47
  "tslib": "^2.1.0"
49
48
  },
50
49
  "devDependencies": {
51
50
  "@types/google.analytics": "0.0.40",
52
- "@types/ioredis": "^4.14.1",
51
+ "@types/ioredis": "^4.28.0",
53
52
  "@types/jest": "^27.0.0",
54
53
  "@types/lodash": "^4.14.162",
55
- "@types/node": "^14.14.7",
56
- "@types/object-assign": "^4.0.30",
57
54
  "@typescript-eslint/eslint-plugin": "^4.2.0",
58
55
  "@typescript-eslint/parser": "^4.2.0",
59
56
  "cross-env": "^7.0.2",
60
57
  "csv-streamify": "^4.0.0",
61
58
  "eslint": "^7.32.0",
62
59
  "eslint-plugin-compat": "3.7.0",
60
+ "eslint-plugin-import": "^2.25.3",
63
61
  "fetch-mock": "^9.10.7",
64
- "ioredis": "^4.26.0",
62
+ "ioredis": "^4.28.0",
65
63
  "jest": "^27.2.3",
66
64
  "jest-localstorage-mock": "^2.4.3",
67
65
  "js-yaml": "^3.14.0",
@@ -1,7 +1,7 @@
1
1
  import { get } from '../utils/lang';
2
- import parser from './parser';
2
+ import { parser } from './parser';
3
3
  import { keyParser } from '../utils/key';
4
- import thenable from '../utils/promise/thenable';
4
+ import { thenable } from '../utils/promise/thenable';
5
5
  import * as LabelsConstants from '../utils/labels';
6
6
  import { CONTROL } from '../utils/constants';
7
7
  import { ISplit, MaybeThenable } from '../dtos/types';
@@ -17,7 +17,7 @@ function evaluationResult(result: IEvaluation | undefined, defaultTreatment: str
17
17
  };
18
18
  }
19
19
 
20
- export default class Engine {
20
+ export class Engine {
21
21
 
22
22
  constructor(private baseInfo: ISplit, private evaluator: IEvaluator) {
23
23
 
@@ -1,11 +1,11 @@
1
1
  import { findIndex } from '../../utils/lang';
2
2
  import { ILogger } from '../../logger/types';
3
- import thenable from '../../utils/promise/thenable';
3
+ import { thenable } from '../../utils/promise/thenable';
4
4
  import { MaybeThenable } from '../../dtos/types';
5
5
  import { IMatcher } from '../types';
6
6
  import { ENGINE_COMBINER_AND } from '../../logger/constants';
7
7
 
8
- export default function andCombinerContext(log: ILogger, matchers: IMatcher[]) {
8
+ export function andCombinerContext(log: ILogger, matchers: IMatcher[]) {
9
9
 
10
10
  function andResults(results: boolean[]): boolean {
11
11
  // Array.prototype.every is supported by target environments
@@ -1,13 +1,13 @@
1
1
  import { findIndex } from '../../utils/lang';
2
2
  import { ILogger } from '../../logger/types';
3
- import thenable from '../../utils/promise/thenable';
3
+ import { thenable } from '../../utils/promise/thenable';
4
4
  import * as LabelsConstants from '../../utils/labels';
5
5
  import { CONTROL } from '../../utils/constants';
6
6
  import { SplitIO } from '../../types';
7
7
  import { IEvaluation, IEvaluator, ISplitEvaluator } from '../types';
8
8
  import { ENGINE_COMBINER_IFELSEIF, ENGINE_COMBINER_IFELSEIF_NO_TREATMENT, ERROR_ENGINE_COMBINER_IFELSEIF } from '../../logger/constants';
9
9
 
10
- export default function ifElseIfCombinerContext(log: ILogger, predicates: IEvaluator[]): IEvaluator {
10
+ export function ifElseIfCombinerContext(log: ILogger, predicates: IEvaluator[]): IEvaluator {
11
11
 
12
12
  function unexpectedInputHandler() {
13
13
  log.error(ERROR_ENGINE_COMBINER_IFELSEIF);
@@ -1,5 +1,5 @@
1
1
  import { getTreatment, shouldApplyRollout } from './engineUtils';
2
- import thenable from '../../utils/promise/thenable';
2
+ import { thenable } from '../../utils/promise/thenable';
3
3
  import * as LabelsConstants from '../../utils/labels';
4
4
  import { MaybeThenable } from '../../dtos/types';
5
5
  import { IEvaluation, IEvaluator, ISplitEvaluator } from '../types';
@@ -22,7 +22,7 @@ function match(log: ILogger, matchingResult: boolean, bucketingKey: string | und
22
22
  }
23
23
 
24
24
  // Condition factory
25
- export default function conditionContext(log: ILogger, matcherEvaluator: (...args: any) => MaybeThenable<boolean>, treatments: { getTreatmentFor: (x: number) => string }, label: string, conditionType: 'ROLLOUT' | 'WHITELIST'): IEvaluator {
25
+ export function conditionContext(log: ILogger, matcherEvaluator: (...args: any) => MaybeThenable<boolean>, treatments: { getTreatmentFor: (x: number) => string }, label: string, conditionType: 'ROLLOUT' | 'WHITELIST'): IEvaluator {
26
26
 
27
27
  return function conditionEvaluator(key: SplitIO.SplitKey, seed: number, trafficAllocation?: number, trafficAllocationSeed?: number, attributes?: SplitIO.Attributes, splitEvaluator?: ISplitEvaluator) {
28
28
 
@@ -1,7 +1,6 @@
1
- import Engine from './Engine';
2
- import thenable from '../utils/promise/thenable';
1
+ import { Engine } from './Engine';
2
+ import { thenable } from '../utils/promise/thenable';
3
3
  import * as LabelsConstants from '../utils/labels';
4
- import { get } from '../utils/lang';
5
4
  import { CONTROL } from '../utils/constants';
6
5
  import { ISplit, MaybeThenable } from '../dtos/types';
7
6
  import { IStorageAsync, IStorageSync } from '../storages/types';
@@ -106,17 +105,17 @@ function getEvaluation(
106
105
  const split = Engine.parse(log, splitJSON, storage);
107
106
  evaluation = split.getTreatment(key, attributes, evaluateFeature);
108
107
 
109
- // If the storage is async, evaluation and changeNumber will return a thenable
108
+ // If the storage is async and the evaluated split uses segment, evaluation is thenable
110
109
  if (thenable(evaluation)) {
111
110
  return evaluation.then(result => {
112
111
  result.changeNumber = split.getChangeNumber();
113
- result.config = get(splitJSON, `configurations.${result.treatment}`, null);
112
+ result.config = splitJSON.configurations && splitJSON.configurations[result.treatment] || null;
114
113
 
115
114
  return result;
116
115
  });
117
116
  } else {
118
117
  evaluation.changeNumber = split.getChangeNumber(); // Always sync and optional
119
- evaluation.config = get(splitJSON, `configurations.${evaluation.treatment}`, null);
118
+ evaluation.config = splitJSON.configurations && splitJSON.configurations[evaluation.treatment] || null;
120
119
  }
121
120
  }
122
121
 
@@ -1,7 +1,7 @@
1
1
  import { ENGINE_MATCHER_ALL } from '../../logger/constants';
2
2
  import { ILogger } from '../../logger/types';
3
3
 
4
- export default function allMatcherContext(log: ILogger) {
4
+ export function allMatcherContext(log: ILogger) {
5
5
  return function allMatcher(runtimeAttr: string): boolean {
6
6
  log.debug(ENGINE_MATCHER_ALL);
7
7
 
@@ -2,7 +2,7 @@ import { IBetweenMatcherData } from '../../dtos/types';
2
2
  import { ENGINE_MATCHER_BETWEEN } from '../../logger/constants';
3
3
  import { ILogger } from '../../logger/types';
4
4
 
5
- export default function betweenMatcherContext(log: ILogger, ruleVO: IBetweenMatcherData) /*: Function */ {
5
+ export function betweenMatcherContext(log: ILogger, ruleVO: IBetweenMatcherData) /*: Function */ {
6
6
  return function betweenMatcher(runtimeAttr: number): boolean {
7
7
 
8
8
  let isBetween = runtimeAttr >= ruleVO.start && runtimeAttr <= ruleVO.end;
@@ -1,7 +1,7 @@
1
1
  import { ENGINE_MATCHER_BOOLEAN } from '../../logger/constants';
2
2
  import { ILogger } from '../../logger/types';
3
3
 
4
- export default function booleanMatcherContext(log: ILogger, ruleAttr: boolean) /*: Function */ {
4
+ export function booleanMatcherContext(log: ILogger, ruleAttr: boolean) /*: Function */ {
5
5
  return function booleanMatcher(runtimeAttr: boolean): boolean {
6
6
  let booleanMatches = ruleAttr === runtimeAttr;
7
7
 
@@ -2,7 +2,7 @@ import { ENGINE_MATCHER_CONTAINS_ALL } from '../../logger/constants';
2
2
  import { ILogger } from '../../logger/types';
3
3
  import { findIndex } from '../../utils/lang';
4
4
 
5
- export default function containsAllMatcherContext(log: ILogger, ruleAttr: string[]) /*: Function */ {
5
+ export function containsAllSetMatcherContext(log: ILogger, ruleAttr: string[]) /*: Function */ {
6
6
  return function containsAllMatcher(runtimeAttr: string[]): boolean {
7
7
  let containsAll = true;
8
8
 
@@ -2,7 +2,7 @@ import { ENGINE_MATCHER_CONTAINS_ANY } from '../../logger/constants';
2
2
  import { ILogger } from '../../logger/types';
3
3
  import { findIndex } from '../../utils/lang';
4
4
 
5
- export default function containsAnyMatcherContext(log: ILogger, ruleAttr: string[]) /*: Function */ {
5
+ export function containsAnySetMatcherContext(log: ILogger, ruleAttr: string[]) /*: Function */ {
6
6
  return function containsAnyMatcher(runtimeAttr: string[]): boolean {
7
7
  let containsAny = false;
8
8
 
@@ -2,7 +2,7 @@ import { isString } from '../../utils/lang';
2
2
  import { ILogger } from '../../logger/types';
3
3
  import { ENGINE_MATCHER_CONTAINS_STRING } from '../../logger/constants';
4
4
 
5
- export default function containsStringMatcherContext(log: ILogger, ruleAttr: string[]) /*: Function */ {
5
+ export function containsStringMatcherContext(log: ILogger, ruleAttr: string[]) /*: Function */ {
6
6
  return function containsStringMatcher(runtimeAttr: string): boolean {
7
7
  let contains = ruleAttr.some(e => isString(runtimeAttr) && runtimeAttr.indexOf(e) > -1);
8
8
 
@@ -1,11 +1,11 @@
1
1
  import { IDependencyMatcherData, MaybeThenable } from '../../dtos/types';
2
2
  import { IStorageAsync, IStorageSync } from '../../storages/types';
3
3
  import { ILogger } from '../../logger/types';
4
- import thenable from '../../utils/promise/thenable';
4
+ import { thenable } from '../../utils/promise/thenable';
5
5
  import { IDependencyMatcherValue, IEvaluation, ISplitEvaluator } from '../types';
6
6
  import { ENGINE_MATCHER_DEPENDENCY, ENGINE_MATCHER_DEPENDENCY_PRE } from '../../logger/constants';
7
7
 
8
- export default function dependencyMatcherContext(log: ILogger, { split, treatments }: IDependencyMatcherData, storage: IStorageSync | IStorageAsync) {
8
+ export function dependencyMatcherContext(log: ILogger, { split, treatments }: IDependencyMatcherData, storage: IStorageSync | IStorageAsync) {
9
9
 
10
10
  function checkTreatment(evaluation: IEvaluation, acceptableTreatments: string[], parentName: string) {
11
11
  let matches = false;
@@ -1,7 +1,7 @@
1
1
  import { ENGINE_MATCHER_EQUAL } from '../../logger/constants';
2
2
  import { ILogger } from '../../logger/types';
3
3
 
4
- export default function equalToMatcherContext(log: ILogger, ruleAttr: number) /*: Function */ {
4
+ export function equalToMatcherContext(log: ILogger, ruleAttr: number) /*: Function */ {
5
5
  return function equalToMatcher(runtimeAttr: number): boolean {
6
6
  let isEqual = runtimeAttr === ruleAttr;
7
7
 
@@ -2,7 +2,7 @@ import { ENGINE_MATCHER_EQUAL_TO_SET } from '../../logger/constants';
2
2
  import { ILogger } from '../../logger/types';
3
3
  import { findIndex } from '../../utils/lang';
4
4
 
5
- export default function equalToSetMatcherContext(log: ILogger, ruleAttr: string[]) /*: Function */ {
5
+ export function equalToSetMatcherContext(log: ILogger, ruleAttr: string[]) /*: Function */ {
6
6
  return function equalToSetMatcher(runtimeAttr: string[]): boolean {
7
7
  // Length being the same is the first condition.
8
8
  let isEqual = runtimeAttr.length === ruleAttr.length;
@@ -2,7 +2,7 @@ import { ENGINE_MATCHER_ENDS_WITH } from '../../logger/constants';
2
2
  import { ILogger } from '../../logger/types';
3
3
  import { endsWith as strEndsWith } from '../../utils/lang';
4
4
 
5
- export default function endsWithMatcherContext(log: ILogger, ruleAttr: string[]) /*: Function */ {
5
+ export function endsWithMatcherContext(log: ILogger, ruleAttr: string[]) /*: Function */ {
6
6
  return function endsWithMatcher(runtimeAttr: string): boolean {
7
7
  let endsWith = ruleAttr.some(e => strEndsWith(runtimeAttr, e));
8
8
 
@@ -1,7 +1,7 @@
1
1
  import { ENGINE_MATCHER_GREATER } from '../../logger/constants';
2
2
  import { ILogger } from '../../logger/types';
3
3
 
4
- export default function greaterThanEqualMatcherContext(log: ILogger, ruleAttr: number) /*: Function */ {
4
+ export function greaterThanEqualMatcherContext(log: ILogger, ruleAttr: number) /*: Function */ {
5
5
  return function greaterThanEqualMatcher(runtimeAttr: number): boolean {
6
6
  let isGreaterEqualThan = runtimeAttr >= ruleAttr;
7
7
 
@@ -1,49 +1,49 @@
1
- import allMatcher from './all';
2
- import segmentMatcher from './segment';
3
- import whitelistMatcher from './whitelist';
4
- import eqMatcher from './eq';
5
- import gteMatcher from './gte';
6
- import lteMatcher from './lte';
7
- import betweenMatcher from './between';
8
- import equalToSetMatcher from './eq_set';
9
- import containsAllSetMatcher from './cont_all';
10
- import containsAnySetMatcher from './cont_any';
11
- import partOfSetMatcher from './part_of';
12
- import swMatcher from './sw';
13
- import ewMatcher from './ew';
14
- import containsStrMatcher from './cont_str';
15
- import dependencyMatcher from './dependency';
16
- import booleanMatcher from './boolean';
17
- import stringMatcher from './string';
1
+ import { allMatcherContext } from './all';
2
+ import { segmentMatcherContext } from './segment';
3
+ import { whitelistMatcherContext } from './whitelist';
4
+ import { equalToMatcherContext } from './eq';
5
+ import { greaterThanEqualMatcherContext } from './gte';
6
+ import { lessThanEqualMatcherContext } from './lte';
7
+ import { betweenMatcherContext } from './between';
8
+ import { equalToSetMatcherContext } from './eq_set';
9
+ import { containsAnySetMatcherContext } from './cont_any';
10
+ import { containsAllSetMatcherContext } from './cont_all';
11
+ import { partOfSetMatcherContext } from './part_of';
12
+ import { endsWithMatcherContext } from './ew';
13
+ import { startsWithMatcherContext } from './sw';
14
+ import { containsStringMatcherContext } from './cont_str';
15
+ import { dependencyMatcherContext } from './dependency';
16
+ import { booleanMatcherContext } from './boolean';
17
+ import { stringMatcherContext } from './string';
18
18
  import { IStorageAsync, IStorageSync } from '../../storages/types';
19
19
  import { IMatcher, IMatcherDto } from '../types';
20
20
  import { ILogger } from '../../logger/types';
21
21
 
22
22
  const matchers = [
23
23
  undefined, // UNDEFINED: 0,
24
- allMatcher, // ALL_KEYS: 1,
25
- segmentMatcher, // IN_SEGMENT: 2,
26
- whitelistMatcher, // WHITELIST: 3,
27
- eqMatcher, // EQUAL_TO: 4,
28
- gteMatcher, // GREATER_THAN_OR_EQUAL_TO: 5,
29
- lteMatcher, // LESS_THAN_OR_EQUAL_TO: 6,
30
- betweenMatcher, // BETWEEN: 7,
31
- equalToSetMatcher, // EQUAL_TO_SET: 8,
32
- containsAnySetMatcher, // CONTAINS_ANY_OF_SET: 9,
33
- containsAllSetMatcher, // CONTAINS_ALL_OF_SET: 10,
34
- partOfSetMatcher, // PART_OF_SET: 11,
35
- ewMatcher, // ENDS_WITH: 12,
36
- swMatcher, // STARTS_WITH: 13,
37
- containsStrMatcher, // CONTAINS_STRING: 14,
38
- dependencyMatcher, // IN_SPLIT_TREATMENT: 15,
39
- booleanMatcher, // EQUAL_TO_BOOLEAN: 16,
40
- stringMatcher // MATCHES_STRING: 17
24
+ allMatcherContext, // ALL_KEYS: 1,
25
+ segmentMatcherContext, // IN_SEGMENT: 2,
26
+ whitelistMatcherContext, // WHITELIST: 3,
27
+ equalToMatcherContext, // EQUAL_TO: 4,
28
+ greaterThanEqualMatcherContext, // GREATER_THAN_OR_EQUAL_TO: 5,
29
+ lessThanEqualMatcherContext, // LESS_THAN_OR_EQUAL_TO: 6,
30
+ betweenMatcherContext, // BETWEEN: 7,
31
+ equalToSetMatcherContext, // EQUAL_TO_SET: 8,
32
+ containsAnySetMatcherContext, // CONTAINS_ANY_OF_SET: 9,
33
+ containsAllSetMatcherContext, // CONTAINS_ALL_OF_SET: 10,
34
+ partOfSetMatcherContext, // PART_OF_SET: 11,
35
+ endsWithMatcherContext, // ENDS_WITH: 12,
36
+ startsWithMatcherContext, // STARTS_WITH: 13,
37
+ containsStringMatcherContext, // CONTAINS_STRING: 14,
38
+ dependencyMatcherContext, // IN_SPLIT_TREATMENT: 15,
39
+ booleanMatcherContext, // EQUAL_TO_BOOLEAN: 16,
40
+ stringMatcherContext // MATCHES_STRING: 17
41
41
  ];
42
42
 
43
43
  /**
44
44
  * Matcher factory.
45
45
  */
46
- export default function matcherFactory(log: ILogger, matcherDto: IMatcherDto, storage?: IStorageSync | IStorageAsync): IMatcher | undefined {
46
+ export function matcherFactory(log: ILogger, matcherDto: IMatcherDto, storage?: IStorageSync | IStorageAsync): IMatcher | undefined {
47
47
  let {
48
48
  type,
49
49
  value
@@ -1,7 +1,7 @@
1
1
  import { ENGINE_MATCHER_LESS } from '../../logger/constants';
2
2
  import { ILogger } from '../../logger/types';
3
3
 
4
- export default function lessThanEqualMatcherContext(log: ILogger, ruleAttr: number) /*: function */ {
4
+ export function lessThanEqualMatcherContext(log: ILogger, ruleAttr: number) /*: function */ {
5
5
  return function lessThanEqualMatcher(runtimeAttr: number): boolean {
6
6
  let isLessEqualThan = runtimeAttr <= ruleAttr;
7
7
 
@@ -2,7 +2,7 @@ import { findIndex } from '../../utils/lang';
2
2
  import { ILogger } from '../../logger/types';
3
3
  import { ENGINE_MATCHER_PART_OF } from '../../logger/constants';
4
4
 
5
- export default function partOfMatcherContext(log: ILogger, ruleAttr: string[]) /*: Function */ {
5
+ export function partOfSetMatcherContext(log: ILogger, ruleAttr: string[]) /*: Function */ {
6
6
  return function partOfMatcher(runtimeAttr: string[]): boolean {
7
7
  // To be part of the length should be minor or equal.
8
8
  let isPartOf = runtimeAttr.length <= ruleAttr.length;
@@ -1,10 +1,10 @@
1
1
  import { MaybeThenable } from '../../dtos/types';
2
2
  import { ISegmentsCacheBase } from '../../storages/types';
3
3
  import { ILogger } from '../../logger/types';
4
- import thenable from '../../utils/promise/thenable';
4
+ import { thenable } from '../../utils/promise/thenable';
5
5
  import { ENGINE_MATCHER_SEGMENT } from '../../logger/constants';
6
6
 
7
- export default function matcherSegmentContext(log: ILogger, segmentName: string, storage: { segments: ISegmentsCacheBase }) {
7
+ export function segmentMatcherContext(log: ILogger, segmentName: string, storage: { segments: ISegmentsCacheBase }) {
8
8
 
9
9
  return function segmentMatcher(key: string): MaybeThenable<boolean> {
10
10
  const isInSegment = storage.segments.isInSegment(segmentName, key);
@@ -1,7 +1,7 @@
1
1
  import { ENGINE_MATCHER_STRING_INVALID, ENGINE_MATCHER_STRING } from '../../logger/constants';
2
2
  import { ILogger } from '../../logger/types';
3
3
 
4
- export default function stringMatcherContext(log: ILogger, ruleAttr: string) /*: Function */ {
4
+ export function stringMatcherContext(log: ILogger, ruleAttr: string) /*: Function */ {
5
5
  return function stringMatcher(runtimeAttr: string): boolean {
6
6
  let re;
7
7
 
@@ -2,7 +2,7 @@ import { ENGINE_MATCHER_STARTS_WITH } from '../../logger/constants';
2
2
  import { ILogger } from '../../logger/types';
3
3
  import { startsWith } from '../../utils/lang';
4
4
 
5
- export default function startsWithMatcherContext(log: ILogger, ruleAttr: string[]) /*: Function */ {
5
+ export function startsWithMatcherContext(log: ILogger, ruleAttr: string[]) /*: Function */ {
6
6
  return function startsWithMatcher(runtimeAttr: string): boolean {
7
7
  let matches = ruleAttr.some(e => startsWith(runtimeAttr, e));
8
8
 
@@ -2,7 +2,7 @@ import { setToArray, ISet } from '../../utils/lang/sets';
2
2
  import { ILogger } from '../../logger/types';
3
3
  import { ENGINE_MATCHER_WHITELIST } from '../../logger/constants';
4
4
 
5
- export default function whitelistMatcherContext(log: ILogger, ruleAttr: ISet<string>) /*: Function */ {
5
+ export function whitelistMatcherContext(log: ILogger, ruleAttr: ISet<string>) /*: Function */ {
6
6
  return function whitelistMatcher(runtimeAttr: string): boolean {
7
7
  let isInWhitelist = ruleAttr.has(runtimeAttr);
8
8
 
@@ -1,9 +1,9 @@
1
1
  import { findIndex } from '../../utils/lang';
2
2
  import { matcherTypes, matcherTypesMapper, matcherDataTypes } from '../matchers/matcherTypes';
3
- import segmentTransform from './segment';
4
- import whitelistTransform from './whitelist';
5
- import setTransform from './set';
6
- import numericTransform from './unaryNumeric';
3
+ import { segmentTransform } from './segment';
4
+ import { whitelistTransform } from './whitelist';
5
+ import { setTransform } from './set';
6
+ import { numericTransform } from './unaryNumeric';
7
7
  import { zeroSinceHH, zeroSinceSS } from '../convertions';
8
8
  import { IBetweenMatcherData, IInSegmentMatcherData, ISplitMatcher, IUnaryNumericMatcherData, IWhitelistMatcherData } from '../../dtos/types';
9
9
  import { IMatcherDto } from '../types';
@@ -11,7 +11,7 @@ import { IMatcherDto } from '../types';
11
11
  /**
12
12
  * Flat the complex matcherGroup structure into something handy.
13
13
  */
14
- export default function matchersTransform(matchers: ISplitMatcher[]): IMatcherDto[] {
14
+ export function matchersTransform(matchers: ISplitMatcher[]): IMatcherDto[] {
15
15
 
16
16
  let parsedMatchers = matchers.map(matcher => {
17
17
  let {
@@ -3,6 +3,6 @@ import { IInSegmentMatcherData } from '../../dtos/types';
3
3
  /**
4
4
  * Extract segment name as a plain string.
5
5
  */
6
- export default function transform(segment?: IInSegmentMatcherData) {
6
+ export function segmentTransform(segment?: IInSegmentMatcherData) {
7
7
  return segment ? segment.segmentName : undefined;
8
8
  }
@@ -3,6 +3,6 @@ import { IWhitelistMatcherData } from '../../dtos/types';
3
3
  /**
4
4
  * Extract whitelist array. Used by set and string matchers
5
5
  */
6
- export default function transform(whitelistObject: IWhitelistMatcherData) {
6
+ export function setTransform(whitelistObject: IWhitelistMatcherData) {
7
7
  return whitelistObject.whitelist;
8
8
  }
@@ -3,6 +3,6 @@ import { IUnaryNumericMatcherData } from '../../dtos/types';
3
3
  /**
4
4
  * Extract value from unary matcher data.
5
5
  */
6
- export default function transform(unaryNumericObject: IUnaryNumericMatcherData) {
6
+ export function numericTransform(unaryNumericObject: IUnaryNumericMatcherData) {
7
7
  return unaryNumericObject.value;
8
8
  }
@@ -4,6 +4,6 @@ import { _Set } from '../../utils/lang/sets';
4
4
  /**
5
5
  * Extract whitelist as a set. Used by 'WHITELIST' matcher.
6
6
  */
7
- export default function transform(whitelistObject: IWhitelistMatcherData) {
7
+ export function whitelistTransform(whitelistObject: IWhitelistMatcherData) {
8
8
  return new _Set(whitelistObject.whitelist);
9
9
  }
@@ -1,18 +1,18 @@
1
- import matchersTransform from '../matchersTransform';
2
- import Treatments from '../treatments';
3
- import matcherFactory from '../matchers';
4
- import sanitizeValue from '../value';
5
- import conditionFactory from '../condition';
6
- import ifElseIfCombiner from '../combiners/ifelseif';
7
- import andCombiner from '../combiners/and';
8
- import thenable from '../../utils/promise/thenable';
1
+ import { matchersTransform } from '../matchersTransform';
2
+ import { Treatments } from '../treatments';
3
+ import { matcherFactory } from '../matchers';
4
+ import { sanitizeValue } from '../value';
5
+ import { conditionContext } from '../condition';
6
+ import { ifElseIfCombinerContext } from '../combiners/ifelseif';
7
+ import { andCombinerContext } from '../combiners/and';
8
+ import { thenable } from '../../utils/promise/thenable';
9
9
  import { IEvaluator, IMatcherDto, ISplitEvaluator } from '../types';
10
10
  import { ISplitCondition } from '../../dtos/types';
11
11
  import { IStorageAsync, IStorageSync } from '../../storages/types';
12
12
  import { SplitIO } from '../../types';
13
13
  import { ILogger } from '../../logger/types';
14
14
 
15
- export default function parser(log: ILogger, conditions: ISplitCondition[], storage: IStorageSync | IStorageAsync): IEvaluator {
15
+ export function parser(log: ILogger, conditions: ISplitCondition[], storage: IStorageSync | IStorageAsync): IEvaluator {
16
16
  let predicates = [];
17
17
 
18
18
  for (let i = 0; i < conditions.length; i++) {
@@ -53,9 +53,9 @@ export default function parser(log: ILogger, conditions: ISplitCondition[], stor
53
53
  break;
54
54
  }
55
55
 
56
- predicates.push(conditionFactory(
56
+ predicates.push(conditionContext(
57
57
  log,
58
- andCombiner(log, expressions),
58
+ andCombinerContext(log, expressions),
59
59
  Treatments.parse(partitions),
60
60
  label,
61
61
  conditionType
@@ -63,5 +63,5 @@ export default function parser(log: ILogger, conditions: ISplitCondition[], stor
63
63
  }
64
64
 
65
65
  // Instanciate evaluator given the set of conditions using if else if logic
66
- return ifElseIfCombiner(log, predicates);
66
+ return ifElseIfCombinerContext(log, predicates);
67
67
  }
@@ -1,7 +1,7 @@
1
1
  import { ISplitPartition } from '../../dtos/types';
2
2
  import { findIndex } from '../../utils/lang';
3
3
 
4
- export default class Treatments {
4
+ export class Treatments {
5
5
 
6
6
  private _ranges: number[];
7
7
  private _treatments: string[];
@@ -1,7 +1,7 @@
1
1
  import { SplitIO } from '../../types';
2
2
  import { IMatcherDto } from '../types';
3
3
  import { ILogger } from '../../logger/types';
4
- import sanitizeValue from './sanitize';
4
+ import { sanitize } from './sanitize';
5
5
  import { ENGINE_VALUE, ENGINE_VALUE_NO_ATTRIBUTES, ENGINE_VALUE_INVALID } from '../../logger/constants';
6
6
 
7
7
  function parseValue(log: ILogger, key: string, attributeName: string | null, attributes: SplitIO.Attributes) {
@@ -23,10 +23,10 @@ function parseValue(log: ILogger, key: string, attributeName: string | null, att
23
23
  /**
24
24
  * Defines value to be matched (key / attribute).
25
25
  */
26
- export default function value(log: ILogger, key: string, matcherDto: IMatcherDto, attributes: SplitIO.Attributes) {
26
+ export function sanitizeValue(log: ILogger, key: string, matcherDto: IMatcherDto, attributes: SplitIO.Attributes) {
27
27
  const attributeName = matcherDto.attribute;
28
28
  const valueToMatch = parseValue(log, key, attributeName, attributes);
29
- const sanitizedValue = sanitizeValue(log, matcherDto.type, valueToMatch, matcherDto.dataType, attributes);
29
+ const sanitizedValue = sanitize(log, matcherDto.type, valueToMatch, matcherDto.dataType, attributes);
30
30
 
31
31
  if (sanitizedValue !== undefined) {
32
32
  return sanitizedValue;
@@ -69,7 +69,7 @@ function getProcessingFunction(matcherTypeID: number, dataType: string) {
69
69
  /**
70
70
  * Sanitize matcher value
71
71
  */
72
- export default function sanitize(log: ILogger, matcherTypeID: number, value: string | number | boolean | Array<string | number> | undefined, dataType: string, attributes: SplitIO.Attributes) {
72
+ export function sanitize(log: ILogger, matcherTypeID: number, value: string | number | boolean | Array<string | number> | undefined, dataType: string, attributes: SplitIO.Attributes) {
73
73
  const processor = getProcessingFunction(matcherTypeID, dataType);
74
74
  let sanitizedValue: string | number | boolean | Array<string | number> | IDependencyMatcherValue | undefined;
75
75