@splitsoftware/splitio-commons 2.12.0 → 3.0.0-rc.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 (309) hide show
  1. package/CHANGES.txt +14 -1
  2. package/cjs/evaluator/condition/engineUtils.js +2 -2
  3. package/cjs/evaluator/fallbackConfigsCalculator/fallbackSanitizer/index.js +70 -0
  4. package/cjs/evaluator/fallbackConfigsCalculator/index.js +25 -0
  5. package/cjs/evaluator/fallbackTreatmentsCalculator/fallbackSanitizer/index.js +5 -8
  6. package/cjs/evaluator/fallbackTreatmentsCalculator/index.js +21 -32
  7. package/cjs/evaluator/index.js +67 -42
  8. package/cjs/evaluator/matchers/whitelist.js +1 -1
  9. package/cjs/integrations/pluggable.js +1 -1
  10. package/cjs/listeners/browser.js +4 -3
  11. package/cjs/listeners/node.js +4 -4
  12. package/cjs/logger/constants.js +14 -20
  13. package/cjs/logger/index.js +1 -1
  14. package/cjs/logger/messages/debug.js +6 -7
  15. package/cjs/logger/messages/error.js +4 -4
  16. package/cjs/logger/messages/info.js +2 -4
  17. package/cjs/logger/messages/warn.js +9 -9
  18. package/cjs/platform/browser.js +15 -0
  19. package/cjs/platform/getEventSource/browser.js +8 -0
  20. package/cjs/platform/getEventSource/eventsource.js +480 -0
  21. package/cjs/platform/getEventSource/node.js +26 -0
  22. package/cjs/platform/getFetch/browser.js +9 -0
  23. package/cjs/platform/getFetch/node.js +27 -0
  24. package/cjs/platform/getOptions/node.js +25 -0
  25. package/cjs/platform/node.js +17 -0
  26. package/cjs/readiness/constants.js +2 -1
  27. package/cjs/sdkClient/client.js +9 -35
  28. package/cjs/sdkClient/clientAttributesDecoration.js +3 -3
  29. package/cjs/sdkClient/clientInputValidation.js +38 -81
  30. package/cjs/sdkClient/identity.js +1 -1
  31. package/cjs/sdkClient/sdkClient.js +4 -49
  32. package/cjs/sdkClient/sdkLifecycle.js +70 -0
  33. package/cjs/sdkClient/trackMethod.js +56 -0
  34. package/cjs/sdkFactory/index.js +8 -45
  35. package/cjs/sdkManager/index.js +3 -3
  36. package/cjs/services/splitApi.js +18 -13
  37. package/cjs/services/splitHttpClient.js +1 -1
  38. package/cjs/storages/AbstractSplitsCacheAsync.js +1 -1
  39. package/cjs/storages/AbstractSplitsCacheSync.js +1 -1
  40. package/cjs/storages/KeyBuilder.js +12 -12
  41. package/cjs/storages/KeyBuilderCS.js +13 -13
  42. package/cjs/storages/KeyBuilderSS.js +15 -15
  43. package/cjs/storages/getRolloutPlan.js +1 -1
  44. package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +1 -1
  45. package/cjs/storages/inLocalStorage/RBSegmentsCacheInLocal.js +1 -1
  46. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +1 -1
  47. package/cjs/storages/inMemory/ImpressionCountsCacheInMemory.js +1 -1
  48. package/cjs/storages/inMemory/MySegmentsCacheInMemory.js +1 -1
  49. package/cjs/storages/inMemory/RBSegmentsCacheInMemory.js +1 -1
  50. package/cjs/storages/inMemory/SplitsCacheInMemory.js +1 -1
  51. package/cjs/storages/inMemory/TelemetryCacheInMemory.js +2 -2
  52. package/cjs/storages/inRedis/EventsCacheInRedis.js +1 -1
  53. package/cjs/storages/inRedis/ImpressionCountsCacheInRedis.js +5 -5
  54. package/cjs/storages/inRedis/ImpressionsCacheInRedis.js +1 -1
  55. package/cjs/storages/inRedis/RBSegmentsCacheInRedis.js +1 -1
  56. package/cjs/storages/inRedis/RedisAdapter.js +8 -8
  57. package/cjs/storages/inRedis/SplitsCacheInRedis.js +6 -6
  58. package/cjs/storages/inRedis/TelemetryCacheInRedis.js +7 -7
  59. package/cjs/storages/inRedis/UniqueKeysCacheInRedis.js +3 -3
  60. package/cjs/storages/pluggable/EventsCachePluggable.js +1 -1
  61. package/cjs/storages/pluggable/ImpressionCountsCachePluggable.js +6 -6
  62. package/cjs/storages/pluggable/RBSegmentsCachePluggable.js +1 -1
  63. package/cjs/storages/pluggable/SplitsCachePluggable.js +4 -4
  64. package/cjs/storages/pluggable/TelemetryCachePluggable.js +7 -7
  65. package/cjs/storages/pluggable/UniqueKeysCachePluggable.js +2 -2
  66. package/cjs/storages/pluggable/index.js +3 -3
  67. package/cjs/storages/pluggable/wrapperAdapter.js +1 -1
  68. package/cjs/storages/setRolloutPlan.js +1 -1
  69. package/cjs/storages/utils.js +6 -6
  70. package/cjs/sync/offline/splitsParser/parseCondition.js +1 -1
  71. package/cjs/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
  72. package/cjs/sync/polling/fetchers/splitChangesFetcher.js +23 -14
  73. package/cjs/sync/polling/pollingManagerCS.js +11 -11
  74. package/cjs/sync/polling/pollingManagerSS.js +13 -13
  75. package/cjs/sync/polling/syncTasks/definitionsSyncTask.js +12 -0
  76. package/cjs/sync/polling/updaters/{splitChangesUpdater.js → definitionChangesUpdater.js} +67 -59
  77. package/cjs/sync/polling/updaters/mySegmentsUpdater.js +1 -1
  78. package/cjs/sync/polling/updaters/segmentChangesUpdater.js +6 -6
  79. package/cjs/sync/streaming/SSEClient/index.js +2 -2
  80. package/cjs/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +2 -2
  81. package/cjs/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +2 -2
  82. package/cjs/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +4 -4
  83. package/cjs/sync/streaming/parseUtils.js +12 -12
  84. package/cjs/sync/streaming/pushManager.js +2 -2
  85. package/cjs/sync/submitters/impressionsSubmitter.js +6 -6
  86. package/cjs/sync/submitters/submitter.js +1 -1
  87. package/cjs/sync/syncManagerOnline.js +5 -2
  88. package/cjs/trackers/eventTracker.js +10 -12
  89. package/cjs/trackers/impressionObserver/buildKey.js +1 -1
  90. package/cjs/trackers/impressionsTracker.js +37 -20
  91. package/cjs/trackers/uniqueKeysTracker.js +1 -1
  92. package/cjs/utils/EventEmitter.js +391 -0
  93. package/cjs/utils/filter/bloomFilter.js +37 -0
  94. package/cjs/utils/inputValidation/apiKey.js +1 -1
  95. package/cjs/utils/inputValidation/attribute.js +2 -2
  96. package/cjs/utils/inputValidation/{split.js → definition.js} +10 -10
  97. package/cjs/utils/inputValidation/{splitExistence.js → definitionExistence.js} +6 -6
  98. package/cjs/utils/inputValidation/definitions.js +25 -0
  99. package/cjs/utils/inputValidation/eventProperties.js +1 -1
  100. package/cjs/utils/inputValidation/index.js +7 -7
  101. package/cjs/utils/inputValidation/isOperational.js +4 -4
  102. package/cjs/utils/inputValidation/target.js +22 -0
  103. package/cjs/utils/labels/index.js +3 -3
  104. package/cjs/utils/lang/index.js +1 -1
  105. package/cjs/utils/promise/timeout.js +1 -1
  106. package/cjs/utils/settingsValidation/splitFilters.js +4 -4
  107. package/cjs/utils/settingsValidation/url.js +5 -5
  108. package/esm/evaluator/condition/engineUtils.js +2 -2
  109. package/esm/evaluator/fallbackConfigsCalculator/fallbackSanitizer/index.js +64 -0
  110. package/esm/evaluator/fallbackConfigsCalculator/index.js +21 -0
  111. package/esm/evaluator/fallbackTreatmentsCalculator/fallbackSanitizer/index.js +5 -8
  112. package/esm/evaluator/fallbackTreatmentsCalculator/index.js +21 -33
  113. package/esm/evaluator/index.js +66 -42
  114. package/esm/evaluator/matchers/whitelist.js +1 -1
  115. package/esm/integrations/pluggable.js +1 -1
  116. package/esm/listeners/browser.js +4 -3
  117. package/esm/listeners/node.js +4 -4
  118. package/esm/logger/constants.js +11 -17
  119. package/esm/logger/index.js +1 -1
  120. package/esm/logger/messages/debug.js +5 -6
  121. package/esm/logger/messages/error.js +3 -3
  122. package/esm/logger/messages/info.js +1 -3
  123. package/esm/logger/messages/warn.js +8 -8
  124. package/esm/platform/browser.js +12 -0
  125. package/esm/platform/getEventSource/browser.js +4 -0
  126. package/esm/platform/getEventSource/eventsource.js +480 -0
  127. package/esm/platform/getEventSource/node.js +20 -0
  128. package/esm/platform/getFetch/browser.js +5 -0
  129. package/esm/platform/getFetch/node.js +22 -0
  130. package/esm/platform/getOptions/node.js +20 -0
  131. package/esm/platform/node.js +14 -0
  132. package/esm/readiness/constants.js +1 -0
  133. package/esm/sdkClient/client.js +10 -37
  134. package/esm/sdkClient/clientAttributesDecoration.js +3 -3
  135. package/esm/sdkClient/clientInputValidation.js +40 -83
  136. package/esm/sdkClient/identity.js +1 -1
  137. package/esm/sdkClient/sdkClient.js +4 -49
  138. package/esm/sdkClient/sdkLifecycle.js +66 -0
  139. package/esm/sdkClient/trackMethod.js +52 -0
  140. package/esm/sdkFactory/index.js +8 -45
  141. package/esm/sdkManager/index.js +4 -4
  142. package/esm/services/splitApi.js +18 -13
  143. package/esm/services/splitHttpClient.js +1 -1
  144. package/esm/storages/AbstractSplitsCacheAsync.js +1 -1
  145. package/esm/storages/AbstractSplitsCacheSync.js +1 -1
  146. package/esm/storages/KeyBuilder.js +12 -12
  147. package/esm/storages/KeyBuilderCS.js +12 -12
  148. package/esm/storages/KeyBuilderSS.js +14 -14
  149. package/esm/storages/getRolloutPlan.js +1 -1
  150. package/esm/storages/inLocalStorage/RBSegmentsCacheInLocal.js +1 -1
  151. package/esm/storages/inMemory/ImpressionCountsCacheInMemory.js +1 -1
  152. package/esm/storages/inMemory/RBSegmentsCacheInMemory.js +1 -1
  153. package/esm/storages/inMemory/TelemetryCacheInMemory.js +2 -2
  154. package/esm/storages/inRedis/EventsCacheInRedis.js +1 -1
  155. package/esm/storages/inRedis/ImpressionCountsCacheInRedis.js +4 -4
  156. package/esm/storages/inRedis/RBSegmentsCacheInRedis.js +1 -1
  157. package/esm/storages/inRedis/RedisAdapter.js +7 -7
  158. package/esm/storages/inRedis/SplitsCacheInRedis.js +4 -4
  159. package/esm/storages/inRedis/TelemetryCacheInRedis.js +7 -7
  160. package/esm/storages/inRedis/UniqueKeysCacheInRedis.js +1 -1
  161. package/esm/storages/pluggable/EventsCachePluggable.js +1 -1
  162. package/esm/storages/pluggable/ImpressionCountsCachePluggable.js +5 -5
  163. package/esm/storages/pluggable/RBSegmentsCachePluggable.js +1 -1
  164. package/esm/storages/pluggable/SplitsCachePluggable.js +2 -2
  165. package/esm/storages/pluggable/TelemetryCachePluggable.js +7 -7
  166. package/esm/storages/pluggable/UniqueKeysCachePluggable.js +1 -1
  167. package/esm/storages/pluggable/index.js +2 -2
  168. package/esm/storages/pluggable/wrapperAdapter.js +1 -1
  169. package/esm/storages/setRolloutPlan.js +1 -1
  170. package/esm/storages/utils.js +6 -6
  171. package/esm/sync/offline/splitsParser/parseCondition.js +1 -1
  172. package/esm/sync/polling/fetchers/splitChangesFetcher.js +24 -15
  173. package/esm/sync/polling/pollingManagerCS.js +11 -11
  174. package/esm/sync/polling/pollingManagerSS.js +13 -13
  175. package/esm/sync/polling/syncTasks/definitionsSyncTask.js +8 -0
  176. package/esm/sync/polling/updaters/{splitChangesUpdater.js → definitionChangesUpdater.js} +67 -59
  177. package/esm/sync/polling/updaters/mySegmentsUpdater.js +2 -2
  178. package/esm/sync/polling/updaters/segmentChangesUpdater.js +7 -7
  179. package/esm/sync/streaming/SSEClient/index.js +2 -2
  180. package/esm/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +2 -2
  181. package/esm/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +2 -2
  182. package/esm/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +4 -4
  183. package/esm/sync/streaming/parseUtils.js +10 -10
  184. package/esm/sync/streaming/pushManager.js +3 -3
  185. package/esm/sync/submitters/impressionsSubmitter.js +6 -6
  186. package/esm/sync/submitters/submitter.js +1 -1
  187. package/esm/sync/syncManagerOnline.js +5 -2
  188. package/esm/trackers/eventTracker.js +10 -12
  189. package/esm/trackers/impressionObserver/buildKey.js +1 -1
  190. package/esm/trackers/impressionsTracker.js +38 -21
  191. package/esm/trackers/uniqueKeysTracker.js +1 -1
  192. package/esm/utils/EventEmitter.js +387 -0
  193. package/esm/utils/filter/bloomFilter.js +33 -0
  194. package/esm/utils/inputValidation/apiKey.js +1 -1
  195. package/esm/utils/inputValidation/attribute.js +2 -2
  196. package/esm/utils/inputValidation/{split.js → definition.js} +8 -8
  197. package/esm/utils/inputValidation/definitionExistence.js +15 -0
  198. package/esm/utils/inputValidation/definitions.js +21 -0
  199. package/esm/utils/inputValidation/index.js +3 -3
  200. package/esm/utils/inputValidation/isOperational.js +4 -4
  201. package/esm/utils/inputValidation/target.js +18 -0
  202. package/esm/utils/labels/index.js +2 -2
  203. package/esm/utils/promise/timeout.js +1 -1
  204. package/esm/utils/settingsValidation/splitFilters.js +4 -4
  205. package/esm/utils/settingsValidation/url.js +5 -5
  206. package/package.json +15 -6
  207. package/src/dtos/types.ts +65 -70
  208. package/src/evaluator/Engine.ts +4 -4
  209. package/src/evaluator/combiners/and.ts +3 -3
  210. package/src/evaluator/combiners/ifelseif.ts +2 -2
  211. package/src/evaluator/condition/engineUtils.ts +2 -2
  212. package/src/evaluator/condition/index.ts +3 -3
  213. package/src/evaluator/fallbackConfigsCalculator/fallbackSanitizer/index.ts +76 -0
  214. package/src/evaluator/fallbackConfigsCalculator/index.ts +24 -0
  215. package/src/evaluator/fallbackTreatmentsCalculator/fallbackSanitizer/index.ts +5 -7
  216. package/src/evaluator/fallbackTreatmentsCalculator/index.ts +27 -41
  217. package/src/evaluator/index.ts +80 -45
  218. package/src/evaluator/matchers/dependency.ts +2 -2
  219. package/src/evaluator/matchers/matcherTypes.ts +2 -2
  220. package/src/evaluator/matchers/prerequisites.ts +4 -4
  221. package/src/evaluator/matchers/rbsegment.ts +2 -2
  222. package/src/evaluator/matchers/whitelist.ts +2 -2
  223. package/src/evaluator/matchersTransform/index.ts +2 -2
  224. package/src/evaluator/matchersTransform/whitelist.ts +2 -2
  225. package/src/evaluator/parser/index.ts +4 -4
  226. package/src/evaluator/treatments/index.ts +2 -2
  227. package/src/evaluator/types.ts +6 -6
  228. package/src/evaluator/value/index.ts +1 -1
  229. package/src/integrations/pluggable.ts +1 -1
  230. package/src/listeners/browser.ts +11 -8
  231. package/src/listeners/node.ts +2 -5
  232. package/src/logger/constants.ts +11 -17
  233. package/src/logger/messages/debug.ts +5 -6
  234. package/src/logger/messages/error.ts +3 -3
  235. package/src/logger/messages/info.ts +1 -3
  236. package/src/logger/messages/warn.ts +8 -8
  237. package/src/platform/browser.ts +14 -0
  238. package/src/platform/getEventSource/browser.ts +4 -0
  239. package/src/platform/getEventSource/eventsource.js +519 -0
  240. package/src/platform/getEventSource/node.ts +23 -0
  241. package/src/platform/getFetch/browser.ts +5 -0
  242. package/src/platform/getFetch/node.ts +27 -0
  243. package/src/platform/getOptions/node.ts +24 -0
  244. package/src/platform/node.ts +16 -0
  245. package/src/readiness/constants.ts +1 -0
  246. package/src/sdkClient/client.ts +11 -41
  247. package/src/sdkClient/clientInputValidation.ts +44 -84
  248. package/src/sdkClient/sdkClient.ts +5 -54
  249. package/src/sdkClient/sdkLifecycle.ts +78 -0
  250. package/src/sdkClient/trackMethod.ts +59 -0
  251. package/src/sdkFactory/index.ts +10 -54
  252. package/src/sdkFactory/types.ts +19 -16
  253. package/src/sdkManager/index.ts +9 -9
  254. package/src/services/splitApi.ts +6 -0
  255. package/src/services/types.ts +3 -2
  256. package/src/storages/AbstractSplitsCacheAsync.ts +7 -7
  257. package/src/storages/AbstractSplitsCacheSync.ts +10 -10
  258. package/src/storages/inLocalStorage/RBSegmentsCacheInLocal.ts +2 -2
  259. package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +6 -6
  260. package/src/storages/inMemory/RBSegmentsCacheInMemory.ts +2 -2
  261. package/src/storages/inMemory/SplitsCacheInMemory.ts +5 -5
  262. package/src/storages/inMemory/TelemetryCacheInMemory.ts +2 -2
  263. package/src/storages/inRedis/RBSegmentsCacheInRedis.ts +2 -2
  264. package/src/storages/inRedis/SplitsCacheInRedis.ts +9 -9
  265. package/src/storages/pluggable/RBSegmentsCachePluggable.ts +2 -2
  266. package/src/storages/pluggable/SplitsCachePluggable.ts +9 -9
  267. package/src/storages/types.ts +21 -16
  268. package/src/sync/offline/splitsParser/parseCondition.ts +2 -2
  269. package/src/sync/offline/splitsParser/splitsParserFromSettings.ts +3 -3
  270. package/src/sync/offline/splitsParser/types.ts +6 -3
  271. package/src/sync/offline/syncManagerOffline.ts +2 -2
  272. package/src/sync/offline/syncTasks/fromObjectSyncTask.ts +6 -6
  273. package/src/sync/polling/fetchers/splitChangesFetcher.ts +57 -22
  274. package/src/sync/polling/fetchers/types.ts +5 -3
  275. package/src/sync/polling/pollingManagerCS.ts +12 -10
  276. package/src/sync/polling/pollingManagerSS.ts +15 -13
  277. package/src/sync/polling/syncTasks/{splitsSyncTask.ts → definitionsSyncTask.ts} +10 -11
  278. package/src/sync/polling/types.ts +3 -3
  279. package/src/sync/polling/updaters/{splitChangesUpdater.ts → definitionChangesUpdater.ts} +77 -68
  280. package/src/sync/polling/updaters/mySegmentsUpdater.ts +2 -2
  281. package/src/sync/polling/updaters/segmentChangesUpdater.ts +7 -7
  282. package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +6 -6
  283. package/src/sync/streaming/parseUtils.ts +12 -12
  284. package/src/sync/streaming/pushManager.ts +3 -3
  285. package/src/sync/submitters/impressionsSubmitter.ts +9 -9
  286. package/src/sync/submitters/types.ts +3 -0
  287. package/src/sync/syncManagerOnline.ts +6 -2
  288. package/src/trackers/eventTracker.ts +7 -10
  289. package/src/trackers/impressionsTracker.ts +42 -26
  290. package/src/trackers/types.ts +3 -1
  291. package/src/utils/EventEmitter.js +444 -0
  292. package/src/utils/filter/bloomFilter.ts +38 -0
  293. package/src/utils/inputValidation/definition.ts +27 -0
  294. package/src/utils/inputValidation/definitionExistence.ts +19 -0
  295. package/src/utils/inputValidation/definitions.ts +21 -0
  296. package/src/utils/inputValidation/index.ts +3 -3
  297. package/src/utils/inputValidation/isOperational.ts +4 -4
  298. package/src/utils/inputValidation/target.ts +21 -0
  299. package/src/utils/labels/index.ts +2 -2
  300. package/src/utils/settingsValidation/splitFilters.ts +3 -3
  301. package/types/splitio.d.ts +202 -9
  302. package/cjs/sync/polling/syncTasks/splitsSyncTask.js +0 -13
  303. package/cjs/utils/inputValidation/splits.js +0 -25
  304. package/esm/sync/polling/syncTasks/splitsSyncTask.js +0 -9
  305. package/esm/utils/inputValidation/splitExistence.js +0 -15
  306. package/esm/utils/inputValidation/splits.js +0 -21
  307. package/src/utils/inputValidation/split.ts +0 -27
  308. package/src/utils/inputValidation/splitExistence.ts +0 -19
  309. package/src/utils/inputValidation/splits.ts +0 -21
@@ -19,9 +19,8 @@ export const RETRIEVE_CLIENT_DEFAULT = 27;
19
19
  export const RETRIEVE_CLIENT_EXISTING = 28;
20
20
  export const RETRIEVE_MANAGER = 29;
21
21
  export const SYNC_OFFLINE_DATA = 30;
22
- export const SYNC_SPLITS_FETCH = 31;
23
- export const SYNC_SPLITS_UPDATE = 32;
24
- export const SYNC_RBS_UPDATE = 33;
22
+ export const SYNC_FETCH = 31;
23
+ export const SYNC_UPDATE = 32;
25
24
  export const STREAMING_NEW_MESSAGE = 35;
26
25
  export const SYNC_TASK_START = 36;
27
26
  export const SYNC_TASK_EXECUTE = 37;
@@ -32,14 +31,12 @@ export const ENGINE_DEFAULT = 41;
32
31
 
33
32
  export const CLIENT_READY_FROM_CACHE = 100;
34
33
  export const CLIENT_READY = 101;
35
- export const IMPRESSION = 102;
36
34
  export const IMPRESSION_QUEUEING = 103;
37
35
  export const NEW_SHARED_CLIENT = 104;
38
36
  export const NEW_FACTORY = 105;
39
37
  export const POLLING_SMART_PAUSING = 106;
40
38
  export const POLLING_START = 107;
41
39
  export const POLLING_STOP = 108;
42
- export const SYNC_SPLITS_FETCH_RETRY = 109;
43
40
  export const STREAMING_REFRESH_TOKEN = 110;
44
41
  export const STREAMING_RECONNECT = 111;
45
42
  export const STREAMING_CONNECTING = 112;
@@ -61,8 +58,8 @@ export const ENGINE_VALUE_INVALID = 200;
61
58
  export const ENGINE_VALUE_NO_ATTRIBUTES = 201;
62
59
  export const CLIENT_NO_LISTENER = 202;
63
60
  export const CLIENT_NOT_READY_FROM_CACHE = 203;
64
- export const SYNC_MYSEGMENTS_FETCH_RETRY = 204;
65
- export const SYNC_SPLITS_FETCH_FAILS = 205;
61
+ export const SYNC_FETCH_RETRY = 204;
62
+ export const SYNC_FETCH_FAILS = 205;
66
63
  export const STREAMING_PARSING_ERROR_FAILS = 206;
67
64
  export const STREAMING_PARSING_MESSAGE_FAILS = 207;
68
65
  export const STREAMING_FALLBACK = 208;
@@ -72,7 +69,7 @@ export const WARN_SETTING_NULL = 211;
72
69
  export const WARN_TRIMMING_PROPERTIES = 212;
73
70
  export const WARN_CONVERTING = 213;
74
71
  export const WARN_TRIMMING = 214;
75
- export const WARN_NOT_EXISTENT_SPLIT = 215;
72
+ export const WARN_NOT_EXISTENT_DEFINITION = 215;
76
73
  export const WARN_LOWERCASE_TRAFFIC_TYPE = 216;
77
74
  export const WARN_NOT_EXISTENT_TT = 217;
78
75
  export const WARN_INTEGRATION_INVALID = 218;
@@ -125,15 +122,12 @@ export const LOG_PREFIX_ENGINE = 'engine';
125
122
  export const LOG_PREFIX_ENGINE_COMBINER = LOG_PREFIX_ENGINE + ':combiner: ';
126
123
  export const LOG_PREFIX_ENGINE_MATCHER = LOG_PREFIX_ENGINE + ':matcher: ';
127
124
  export const LOG_PREFIX_ENGINE_VALUE = LOG_PREFIX_ENGINE + ':value: ';
128
- export const LOG_PREFIX_SYNC = 'sync';
129
- export const LOG_PREFIX_SYNC_MANAGER = LOG_PREFIX_SYNC + ':sync-manager: ';
130
- export const LOG_PREFIX_SYNC_OFFLINE = LOG_PREFIX_SYNC + ':offline: ';
131
- export const LOG_PREFIX_SYNC_STREAMING = LOG_PREFIX_SYNC + ':streaming: ';
132
- export const LOG_PREFIX_SYNC_SPLITS = LOG_PREFIX_SYNC + ':featureflag-changes: ';
133
- export const LOG_PREFIX_SYNC_SEGMENTS = LOG_PREFIX_SYNC + ':segment-changes: ';
134
- export const LOG_PREFIX_SYNC_MYSEGMENTS = LOG_PREFIX_SYNC + ':my-segments: ';
135
- export const LOG_PREFIX_SYNC_POLLING = LOG_PREFIX_SYNC + ':polling-manager: ';
136
- export const LOG_PREFIX_SYNC_SUBMITTERS = LOG_PREFIX_SYNC + ':submitter: ';
125
+ export const LOG_PREFIX_SYNC = 'sync: ';
126
+ export const LOG_PREFIX_SYNC_MANAGER = 'sync:sync-manager: ';
127
+ export const LOG_PREFIX_SYNC_OFFLINE = 'sync:offline: ';
128
+ export const LOG_PREFIX_SYNC_STREAMING = 'sync:streaming: ';
129
+ export const LOG_PREFIX_SYNC_POLLING = 'sync:polling-manager: ';
130
+ export const LOG_PREFIX_SYNC_SUBMITTERS = 'sync:submitter: ';
137
131
  export const LOG_PREFIX_IMPRESSIONS_TRACKER = 'impressions-tracker: ';
138
132
  export const LOG_PREFIX_EVENTS_TRACKER = 'events-tracker: ';
139
133
  export const LOG_PREFIX_UNIQUE_KEYS_TRACKER = 'unique-keys-tracker: ';
@@ -21,13 +21,12 @@ export const codesDebug: [number, string][] = codesInfo.concat([
21
21
  [c.RETRIEVE_MANAGER, 'Retrieving manager instance.'],
22
22
  // synchronizer
23
23
  [c.SYNC_OFFLINE_DATA, c.LOG_PREFIX_SYNC_OFFLINE + 'Feature flags data: \n%s'],
24
- [c.SYNC_SPLITS_FETCH, c.LOG_PREFIX_SYNC_SPLITS + 'Spin up feature flags update using since = %s and rbSince = %s.'],
25
- [c.SYNC_SPLITS_UPDATE, c.LOG_PREFIX_SYNC_SPLITS + 'New feature flags: %s. Removed feature flags: %s.'],
26
- [c.SYNC_RBS_UPDATE, c.LOG_PREFIX_SYNC_SPLITS + 'New rule-based segments: %s. Removed rule-based segments: %s.'],
24
+ [c.SYNC_FETCH, c.LOG_PREFIX_SYNC + 'Spin up %s updates using since = %s and rbSince = %s.'],
25
+ [c.SYNC_UPDATE, c.LOG_PREFIX_SYNC + 'New %s: %s. Removed: %s.'],
27
26
  [c.STREAMING_NEW_MESSAGE, c.LOG_PREFIX_SYNC_STREAMING + 'New SSE message received, with data: %s.'],
28
- [c.SYNC_TASK_START, c.LOG_PREFIX_SYNC + ': Starting %s. Running each %s millis'],
29
- [c.SYNC_TASK_EXECUTE, c.LOG_PREFIX_SYNC + ': Running %s'],
30
- [c.SYNC_TASK_STOP, c.LOG_PREFIX_SYNC + ': Stopping %s'],
27
+ [c.SYNC_TASK_START, c.LOG_PREFIX_SYNC + 'Starting %s. Running each %s millis'],
28
+ [c.SYNC_TASK_EXECUTE, c.LOG_PREFIX_SYNC + 'Running %s'],
29
+ [c.SYNC_TASK_STOP, c.LOG_PREFIX_SYNC + 'Stopping %s'],
31
30
  // initialization / settings validation
32
31
  [c.SETTINGS_SPLITS_FILTER, c.LOG_PREFIX_SETTINGS + ': feature flags filtering criteria is "%s".']
33
32
  ]);
@@ -2,7 +2,7 @@ import * as c from '../constants';
2
2
 
3
3
  export const codesError: [number, string][] = [
4
4
  // evaluator
5
- [c.ERROR_ENGINE_COMBINER_IFELSEIF, c.LOG_PREFIX_ENGINE_COMBINER + 'Invalid feature flag, no valid rules or unsupported targeting rule type found'],
5
+ [c.ERROR_ENGINE_COMBINER_IFELSEIF, c.LOG_PREFIX_ENGINE_COMBINER + 'Invalid definition, no valid rules or unsupported targeting rule type found'],
6
6
  [c.ENGINE_MATCHER_ERROR, c.LOG_PREFIX_ENGINE_MATCHER + '[%s] %s'],
7
7
  // SDK
8
8
  [c.ERROR_LOGLEVEL_INVALID, 'logger: Invalid Log Level - No changes to the logs will be applied.'],
@@ -13,7 +13,7 @@ export const codesError: [number, string][] = [
13
13
  // synchronizer
14
14
  [c.ERROR_SYNC_OFFLINE_LOADING, c.LOG_PREFIX_SYNC_OFFLINE + 'There was an issue loading the mock feature flags data. No changes will be applied to the current cache. %s'],
15
15
  [c.ERROR_STREAMING_SSE, c.LOG_PREFIX_SYNC_STREAMING + 'Failed to connect or error on streaming connection, with error message: %s'],
16
- [c.ERROR_STREAMING_AUTH, c.LOG_PREFIX_SYNC_STREAMING + 'Failed to authenticate for streaming. Error: %s.'],
16
+ [c.ERROR_STREAMING_AUTH, c.LOG_PREFIX_SYNC_STREAMING + 'Failed to authenticate for streaming. Error: %s'],
17
17
  [c.ERROR_HTTP, 'HTTP request failed with %s. URL: %s. Message: %s'],
18
18
  // client status
19
19
  [c.ERROR_CLIENT_LISTENER, 'A listener was added for %s on the SDK, which has already fired and won\'t be emitted again. The callback won\'t be executed.'],
@@ -34,6 +34,6 @@ export const codesError: [number, string][] = [
34
34
  [c.ERROR_INVALID_CONFIG_PARAM, c.LOG_PREFIX_SETTINGS + ': you passed an invalid "%s" config param. It should be one of the following values: %s. Defaulting to "%s".'],
35
35
  [c.ERROR_STORAGE_INVALID, c.LOG_PREFIX_SETTINGS+': the provided storage is invalid.%s Falling back into default MEMORY storage'],
36
36
  [c.ERROR_MIN_CONFIG_PARAM, c.LOG_PREFIX_SETTINGS + ': the provided "%s" config param is lower than allowed. Setting to the minimum value %s seconds'],
37
- [c.ERROR_TOO_MANY_SETS, c.LOG_PREFIX_SETTINGS + ': the amount of flag sets provided are big causing uri length error.'],
37
+ [c.ERROR_TOO_MANY_SETS, c.LOG_PREFIX_SETTINGS + ': the number of sets provided is too high, which causes a URI length error.'],
38
38
  [c.ERROR_SETS_FILTER_EXCLUSIVE, c.LOG_PREFIX_SETTINGS+': the Set filter is exclusive and cannot be used simultaneously with names or prefix filters. Ignoring names and prefixes.'],
39
39
  ];
@@ -8,8 +8,7 @@ export const codesInfo: [number, string][] = codesWarn.concat([
8
8
  [c.CLIENT_READY_FROM_CACHE, READY_MSG + ' from cache'],
9
9
  [c.CLIENT_READY, READY_MSG],
10
10
  // SDK
11
- [c.IMPRESSION, c.LOG_PREFIX_IMPRESSIONS_TRACKER +'Feature flag: %s. Key: %s. Evaluation: %s. Label: %s'],
12
- [c.IMPRESSION_QUEUEING, c.LOG_PREFIX_IMPRESSIONS_TRACKER +'Queueing corresponding impression.'],
11
+ [c.IMPRESSION_QUEUEING, c.LOG_PREFIX_IMPRESSIONS_TRACKER +'Queueing impression. %s: %s. Key: %s. Evaluation: %s. Label: %s'],
13
12
  [c.NEW_SHARED_CLIENT, 'New shared client instance created.'],
14
13
  [c.NEW_FACTORY, 'New Split SDK instance created. %s'],
15
14
  [c.EVENTS_TRACKER_SUCCESS, c.LOG_PREFIX_EVENTS_TRACKER + 'Successfully queued %s'],
@@ -22,7 +21,6 @@ export const codesInfo: [number, string][] = codesWarn.concat([
22
21
  [c.POLLING_SMART_PAUSING, c.LOG_PREFIX_SYNC_POLLING + 'Turning segments data polling %s.'],
23
22
  [c.POLLING_START, c.LOG_PREFIX_SYNC_POLLING + 'Starting polling'],
24
23
  [c.POLLING_STOP, c.LOG_PREFIX_SYNC_POLLING + 'Stopping polling'],
25
- [c.SYNC_SPLITS_FETCH_RETRY, c.LOG_PREFIX_SYNC_SPLITS + 'Retrying fetch of feature flags (attempt #%s). Reason: %s'],
26
24
  [c.SUBMITTERS_PUSH_FULL_QUEUE, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Flushing full %s queue and resetting timer.'],
27
25
  [c.SUBMITTERS_PUSH, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Pushing %s.'],
28
26
  [c.SUBMITTERS_PUSH_PAGE_HIDDEN, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Flushing %s because page became hidden.'],
@@ -6,24 +6,24 @@ export const codesWarn: [number, string][] = codesError.concat([
6
6
  [c.ENGINE_VALUE_INVALID, c.LOG_PREFIX_ENGINE_VALUE + 'Value %s doesn\'t match with expected type.'],
7
7
  [c.ENGINE_VALUE_NO_ATTRIBUTES, c.LOG_PREFIX_ENGINE_VALUE + 'Defined attribute `%s`. No attributes received.'],
8
8
  // synchronizer
9
- [c.SYNC_MYSEGMENTS_FETCH_RETRY, c.LOG_PREFIX_SYNC_MYSEGMENTS + 'Retrying fetch of memberships (attempt #%s). Reason: %s'],
10
- [c.SYNC_SPLITS_FETCH_FAILS, c.LOG_PREFIX_SYNC_SPLITS + 'Error while doing fetch of feature flags. %s'],
9
+ [c.SYNC_FETCH_RETRY, c.LOG_PREFIX_SYNC + 'Retrying fetch of %s (attempt #%s). Reason: %s'],
10
+ [c.SYNC_FETCH_FAILS, c.LOG_PREFIX_SYNC + 'Error while doing fetch of %s. %s'],
11
11
  [c.STREAMING_PARSING_ERROR_FAILS, c.LOG_PREFIX_SYNC_STREAMING + 'Error parsing SSE error notification: %s'],
12
12
  [c.STREAMING_PARSING_MESSAGE_FAILS, c.LOG_PREFIX_SYNC_STREAMING + 'Error parsing SSE message notification: %s'],
13
13
  [c.STREAMING_FALLBACK, c.LOG_PREFIX_SYNC_STREAMING + 'Falling back to polling mode. Reason: %s'],
14
- [c.SUBMITTERS_PUSH_FAILS, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Dropping %s after retry. Reason: %s.'],
15
- [c.SUBMITTERS_PUSH_RETRY, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Failed to push %s, keeping data to retry on next iteration. Reason: %s.'],
14
+ [c.SUBMITTERS_PUSH_FAILS, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Dropping %s after retry. Reason: %s'],
15
+ [c.SUBMITTERS_PUSH_RETRY, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Failed to push %s, keeping data to retry on next iteration. Reason: %s'],
16
16
  // client status
17
- [c.CLIENT_NOT_READY_FROM_CACHE, '%s: the SDK is not ready to evaluate. Results may be incorrect%s. Make sure to wait for SDK readiness before using this method.'],
17
+ [c.CLIENT_NOT_READY_FROM_CACHE, '%s: the SDK is not ready to evaluate. Results may be incorrect. Make sure to wait for SDK readiness before using this method.'],
18
18
  [c.CLIENT_NO_LISTENER, 'No listeners for SDK_READY event detected. Incorrect control treatments could have been logged if you called getTreatment/s while the SDK was not yet synchronized with the backend.'],
19
19
  // input validation
20
20
  [c.WARN_SETTING_NULL, '%s: Property "%s" is of invalid type. Setting value to null.'],
21
21
  [c.WARN_TRIMMING_PROPERTIES, '%s: more than 300 properties were provided. Some of them will be trimmed when processed.'],
22
22
  [c.WARN_CONVERTING, '%s: %s "%s" is not of type string, converting.'],
23
23
  [c.WARN_TRIMMING, '%s: %s "%s" has extra whitespace, trimming.'],
24
- [c.WARN_NOT_EXISTENT_SPLIT, '%s: feature flag "%s" does not exist in this environment. Please double check what feature flags exist in the Split user interface.'],
24
+ [c.WARN_NOT_EXISTENT_DEFINITION, '%s: "%s" does not exist in this environment. Please double check that it exists in Harness UI.'],
25
25
  [c.WARN_LOWERCASE_TRAFFIC_TYPE, '%s: traffic_type_name should be all lowercase - converting string to lowercase.'],
26
- [c.WARN_NOT_EXISTENT_TT, '%s: traffic type "%s" does not have any corresponding feature flag in this environment, make sure you\'re tracking your events to a valid traffic type defined in the Split user interface.'],
26
+ [c.WARN_NOT_EXISTENT_TT, '%s: traffic type "%s" does not have any corresponding feature flag in this environment, make sure you\'re tracking your events to a valid traffic type defined in Harness UI.'],
27
27
  [c.WARN_FLAGSET_NOT_CONFIGURED, '%s: you passed %s which is not part of the configured FlagSetsFilter, ignoring Flag Set.'],
28
28
  // initialization / settings validation
29
29
  [c.WARN_INTEGRATION_INVALID, c.LOG_PREFIX_SETTINGS + ': %s integration item(s) at settings is invalid. %s'],
@@ -36,5 +36,5 @@ export const codesWarn: [number, string][] = codesError.concat([
36
36
  [c.STREAMING_PARSING_SPLIT_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching SplitChanges due to an error processing %s notification: %s'],
37
37
  [c.WARN_INVALID_FLAGSET, '%s: you passed %s, flag set must adhere to the regular expressions %s. This means a flag set must start with a letter or number, be in lowercase, alphanumeric and have a max length of 50 characters. %s was discarded.'],
38
38
  [c.WARN_LOWERCASE_FLAGSET, '%s: flag set %s should be all lowercase - converting string to lowercase.'],
39
- [c.WARN_FLAGSET_WITHOUT_FLAGS, '%s: you passed %s flag set that does not contain cached feature flag names. Please double check what flag sets are in use in the Split user interface.'],
39
+ [c.WARN_FLAGSET_WITHOUT_FLAGS, '%s: you passed %s flag set that does not contain cached feature flag names. Please double check what flag sets are in use in Harness UI.'],
40
40
  ]);
@@ -0,0 +1,14 @@
1
+ import { EventEmitter } from '../utils/EventEmitter';
2
+ import { getFetch } from '../platform/getFetch/browser';
3
+ import { getEventSource } from '../platform/getEventSource/browser';
4
+ import { BrowserSignalListener } from '../listeners/browser';
5
+ import { now } from '../utils/timeTracker/now/browser';
6
+ import { IPlatform } from '../sdkFactory/types';
7
+
8
+ export const platform: IPlatform = {
9
+ getFetch,
10
+ getEventSource,
11
+ EventEmitter,
12
+ now,
13
+ SignalListener: BrowserSignalListener as IPlatform['SignalListener']
14
+ };
@@ -0,0 +1,4 @@
1
+ export function getEventSource() {
2
+ // eslint-disable-next-line no-undef -- Feature detection for EventSource
3
+ return typeof EventSource === 'function' ? EventSource : undefined;
4
+ }