@splitsoftware/splitio-commons 2.11.1-rc.2 → 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 +15 -2
  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
@@ -1,55 +1,60 @@
1
1
  import { engineParser } from './Engine';
2
2
  import { thenable } from '../utils/promise/thenable';
3
- import { EXCEPTION, SPLIT_NOT_FOUND } from '../utils/labels';
3
+ import { EXCEPTION, NO_CONDITION_MATCH, DEFINITION_NOT_FOUND } from '../utils/labels';
4
4
  import { CONTROL } from '../utils/constants';
5
5
  import { returnSetsUnion, setToArray } from '../utils/lang/sets';
6
6
  import { WARN_FLAGSET_WITHOUT_FLAGS } from '../logger/constants';
7
- var treatmentException = {
7
+ var EVALUATION_EXCEPTION = {
8
8
  treatment: CONTROL,
9
9
  label: EXCEPTION,
10
10
  config: null
11
11
  };
12
- function treatmentsException(splitNames) {
12
+ var EVALUATION_DEFINITION_NOT_FOUND = {
13
+ treatment: CONTROL,
14
+ label: DEFINITION_NOT_FOUND,
15
+ config: null
16
+ };
17
+ function treatmentsException(definitionNames) {
13
18
  var evaluations = {};
14
- splitNames.forEach(function (splitName) {
15
- evaluations[splitName] = treatmentException;
19
+ definitionNames.forEach(function (definitionName) {
20
+ evaluations[definitionName] = EVALUATION_EXCEPTION;
16
21
  });
17
22
  return evaluations;
18
23
  }
19
- export function evaluateFeature(log, key, splitName, attributes, storage, options) {
20
- var parsedSplit;
24
+ export function evaluateFeature(log, key, definitionName, attributes, storage, options) {
25
+ var definition;
21
26
  try {
22
- parsedSplit = storage.splits.getSplit(splitName);
27
+ definition = storage.splits.getSplit(definitionName);
23
28
  }
24
29
  catch (e) {
25
30
  // Exception on sync `getSplit` storage. Not possible ATM with InMemory and InLocal storages.
26
- return treatmentException;
31
+ return EVALUATION_EXCEPTION;
27
32
  }
28
- if (thenable(parsedSplit)) {
29
- return parsedSplit.then(function (split) { return getEvaluation(log, key, split, attributes, storage, options); }).catch(
33
+ if (thenable(definition)) {
34
+ return definition.then(function (definition) { return getEvaluation(log, key, definition, attributes, storage, options); }).catch(
30
35
  // Exception on async `getSplit` storage. For example, when the storage is redis or
31
36
  // pluggable and there is a connection issue and we can't retrieve the split to be evaluated
32
- function () { return treatmentException; });
37
+ function () { return EVALUATION_EXCEPTION; });
33
38
  }
34
- return getEvaluation(log, key, parsedSplit, attributes, storage, options);
39
+ return getEvaluation(log, key, definition, attributes, storage, options);
35
40
  }
36
- export function evaluateFeatures(log, key, splitNames, attributes, storage, options) {
37
- var parsedSplits;
41
+ export function evaluateFeatures(log, key, definitionNames, attributes, storage, options) {
42
+ var definitions;
38
43
  try {
39
- parsedSplits = storage.splits.getSplits(splitNames);
44
+ definitions = storage.splits.getSplits(definitionNames);
40
45
  }
41
46
  catch (e) {
42
47
  // Exception on sync `getSplits` storage. Not possible ATM with InMemory and InLocal storages.
43
- return treatmentsException(splitNames);
48
+ return treatmentsException(definitionNames);
44
49
  }
45
- return thenable(parsedSplits) ?
46
- parsedSplits.then(function (splits) { return getEvaluations(log, key, splitNames, splits, attributes, storage, options); })
50
+ return thenable(definitions) ?
51
+ definitions.then(function (definitions) { return getEvaluations(log, key, definitionNames, definitions, attributes, storage, options); })
47
52
  .catch(function () {
48
53
  // Exception on async `getSplits` storage. For example, when the storage is redis or
49
54
  // pluggable and there is a connection issue and we can't retrieve the split to be evaluated
50
- return treatmentsException(splitNames);
55
+ return treatmentsException(definitionNames);
51
56
  }) :
52
- getEvaluations(log, key, splitNames, parsedSplits, attributes, storage, options);
57
+ getEvaluations(log, key, definitionNames, definitions, attributes, storage, options);
53
58
  }
54
59
  export function evaluateFeaturesByFlagSets(log, key, flagSets, attributes, storage, method, options) {
55
60
  var storedFlagNames;
@@ -84,47 +89,66 @@ export function evaluateFeaturesByFlagSets(log, key, flagSets, attributes, stora
84
89
  }) :
85
90
  evaluate(storedFlagNames);
86
91
  }
87
- function getEvaluation(log, key, splitJSON, attributes, storage, options) {
88
- var evaluation = {
89
- treatment: CONTROL,
90
- label: SPLIT_NOT_FOUND,
91
- config: null
92
- };
93
- if (splitJSON) {
94
- var split = engineParser(log, splitJSON, storage);
95
- evaluation = split.getTreatment(key, attributes, evaluateFeature);
92
+ function getEvaluation(log, key, definition, attributes, storage, options) {
93
+ if (definition) {
94
+ var split = engineParser(log, definition, storage);
95
+ var evaluation = split.getTreatment(key, attributes, evaluateFeature);
96
96
  // If the storage is async and the evaluated flag uses segments or dependencies, evaluation is thenable
97
97
  if (thenable(evaluation)) {
98
98
  return evaluation.then(function (result) {
99
- result.changeNumber = splitJSON.changeNumber;
100
- result.config = splitJSON.configurations && splitJSON.configurations[result.treatment] || null;
99
+ result.changeNumber = definition.changeNumber;
100
+ result.config = definition.configurations && definition.configurations[result.treatment] || null;
101
101
  // @ts-expect-error impressionsDisabled is not exposed in the public typings yet.
102
- result.impressionsDisabled = (options === null || options === void 0 ? void 0 : options.impressionsDisabled) || splitJSON.impressionsDisabled;
102
+ result.impressionsDisabled = (options === null || options === void 0 ? void 0 : options.impressionsDisabled) || definition.impressionsDisabled;
103
103
  return result;
104
104
  });
105
105
  }
106
106
  else {
107
- evaluation.changeNumber = splitJSON.changeNumber;
108
- evaluation.config = splitJSON.configurations && splitJSON.configurations[evaluation.treatment] || null;
107
+ evaluation.changeNumber = definition.changeNumber;
108
+ evaluation.config = definition.configurations && definition.configurations[evaluation.treatment] || null;
109
109
  // @ts-expect-error impressionsDisabled is not exposed in the public typings yet.
110
- evaluation.impressionsDisabled = (options === null || options === void 0 ? void 0 : options.impressionsDisabled) || splitJSON.impressionsDisabled;
110
+ evaluation.impressionsDisabled = (options === null || options === void 0 ? void 0 : options.impressionsDisabled) || definition.impressionsDisabled;
111
111
  }
112
+ return evaluation;
112
113
  }
113
- return evaluation;
114
+ return EVALUATION_DEFINITION_NOT_FOUND;
114
115
  }
115
- function getEvaluations(log, key, splitNames, splits, attributes, storage, options) {
116
+ function getEvaluations(log, key, definitionNames, splits, attributes, storage, options) {
116
117
  var result = {};
117
118
  var thenables = [];
118
- splitNames.forEach(function (splitName) {
119
- var evaluation = getEvaluation(log, key, splits[splitName], attributes, storage, options);
119
+ definitionNames.forEach(function (definitionName) {
120
+ var evaluation = getEvaluation(log, key, splits[definitionName], attributes, storage, options);
120
121
  if (thenable(evaluation)) {
121
122
  thenables.push(evaluation.then(function (res) {
122
- result[splitName] = res;
123
+ result[definitionName] = res;
123
124
  }));
124
125
  }
125
126
  else {
126
- result[splitName] = evaluation;
127
+ result[definitionName] = evaluation;
127
128
  }
128
129
  });
129
130
  return thenables.length > 0 ? Promise.all(thenables).then(function () { return result; }) : result;
130
131
  }
132
+ export function evaluateDefaultTreatment(definitionName, storage) {
133
+ var definition;
134
+ try {
135
+ definition = storage.splits.getSplit(definitionName);
136
+ }
137
+ catch (e) {
138
+ return EVALUATION_EXCEPTION;
139
+ }
140
+ return thenable(definition) ?
141
+ definition.then(getDefaultTreatment).catch(function () { return EVALUATION_EXCEPTION; }) :
142
+ getDefaultTreatment(definition);
143
+ }
144
+ function getDefaultTreatment(definition) {
145
+ if (definition) {
146
+ return {
147
+ treatment: definition.defaultTreatment,
148
+ label: NO_CONDITION_MATCH,
149
+ config: definition.configurations && definition.configurations[definition.defaultTreatment] || null,
150
+ changeNumber: definition.changeNumber
151
+ };
152
+ }
153
+ return EVALUATION_DEFINITION_NOT_FOUND;
154
+ }
@@ -1,5 +1,5 @@
1
1
  export function whitelistMatcherContext(ruleAttr) {
2
- var whitelistSet = new Set(ruleAttr);
2
+ var whitelistSet = new Set(ruleAttr || []);
3
3
  return function whitelistMatcher(runtimeAttr) {
4
4
  var isInWhitelist = whitelistSet.has(runtimeAttr);
5
5
  return isInWhitelist;
@@ -13,7 +13,7 @@ export function pluggableIntegrationsManagerFactory(integrations, params) {
13
13
  // No need to check if `settings.integrations` is an array of functions. It was already validated
14
14
  integrations.forEach(function (integrationFactory) {
15
15
  var integration = integrationFactory(params);
16
- if (integration && integration.queue)
16
+ if (integration)
17
17
  listeners.push(integration);
18
18
  });
19
19
  // If `listeners` is empty, not return a integration manager
@@ -10,14 +10,15 @@ var EVENT_NAME = 'for visibilitychange and pagehide events.';
10
10
  * We'll listen for events over the window object.
11
11
  */
12
12
  var BrowserSignalListener = /** @class */ (function () {
13
- function BrowserSignalListener(syncManager, settings, storage, serviceApi) {
13
+ function BrowserSignalListener(_a) {
14
+ var syncManager = _a.syncManager, settings = _a.settings, storage = _a.storage, splitApi = _a.splitApi, entityType = _a.entityType;
14
15
  this.syncManager = syncManager;
15
16
  this.settings = settings;
16
17
  this.storage = storage;
17
- this.serviceApi = serviceApi;
18
+ this.serviceApi = splitApi;
18
19
  this.flushData = this.flushData.bind(this);
19
20
  this.flushDataIfHidden = this.flushDataIfHidden.bind(this);
20
- this.fromImpressionsCollector = fromImpressionsCollector.bind(undefined, settings.core.labelsEnabled);
21
+ this.fromImpressionsCollector = fromImpressionsCollector.bind(undefined, settings.core.labelsEnabled, entityType);
21
22
  }
22
23
  /**
23
24
  * start method.
@@ -10,8 +10,8 @@ var EVENT_NAME = 'for SIGTERM signal.';
10
10
  * the process is already exiting.
11
11
  */
12
12
  var NodeSignalListener = /** @class */ (function () {
13
- function NodeSignalListener(syncManager, // private handler: () => MaybeThenable<void>,
14
- settings) {
13
+ function NodeSignalListener(_a) {
14
+ var syncManager = _a.syncManager, settings = _a.settings;
15
15
  // @TODO review handler logic when implementing Node.js SDK
16
16
  this.handler = function () {
17
17
  if (syncManager) {
@@ -44,13 +44,13 @@ var NodeSignalListener = /** @class */ (function () {
44
44
  // eslint-disable-next-line no-undef
45
45
  process.kill(process.pid, SIGTERM);
46
46
  };
47
- this.settings.log.debug(LOG_PREFIX_CLEANUP + "Split SDK graceful shutdown after SIGTERM.");
47
+ this.settings.log.debug("".concat(LOG_PREFIX_CLEANUP, "Split SDK graceful shutdown after SIGTERM."));
48
48
  var handlerResult = null;
49
49
  try {
50
50
  handlerResult = this.handler();
51
51
  }
52
52
  catch (err) {
53
- this.settings.log.error(LOG_PREFIX_CLEANUP + "Error with Split SDK graceful shutdown: " + err);
53
+ this.settings.log.error("".concat(LOG_PREFIX_CLEANUP, "Error with Split SDK graceful shutdown: ").concat(err));
54
54
  }
55
55
  if (thenable(handlerResult)) {
56
56
  // Always exit, even with errors. The promise is returned for UT purposes.
@@ -19,9 +19,8 @@ export var RETRIEVE_CLIENT_DEFAULT = 27;
19
19
  export var RETRIEVE_CLIENT_EXISTING = 28;
20
20
  export var RETRIEVE_MANAGER = 29;
21
21
  export var SYNC_OFFLINE_DATA = 30;
22
- export var SYNC_SPLITS_FETCH = 31;
23
- export var SYNC_SPLITS_UPDATE = 32;
24
- export var SYNC_RBS_UPDATE = 33;
22
+ export var SYNC_FETCH = 31;
23
+ export var SYNC_UPDATE = 32;
25
24
  export var STREAMING_NEW_MESSAGE = 35;
26
25
  export var SYNC_TASK_START = 36;
27
26
  export var SYNC_TASK_EXECUTE = 37;
@@ -31,14 +30,12 @@ export var ENGINE_MATCHER_RESULT = 40;
31
30
  export var ENGINE_DEFAULT = 41;
32
31
  export var CLIENT_READY_FROM_CACHE = 100;
33
32
  export var CLIENT_READY = 101;
34
- export var IMPRESSION = 102;
35
33
  export var IMPRESSION_QUEUEING = 103;
36
34
  export var NEW_SHARED_CLIENT = 104;
37
35
  export var NEW_FACTORY = 105;
38
36
  export var POLLING_SMART_PAUSING = 106;
39
37
  export var POLLING_START = 107;
40
38
  export var POLLING_STOP = 108;
41
- export var SYNC_SPLITS_FETCH_RETRY = 109;
42
39
  export var STREAMING_REFRESH_TOKEN = 110;
43
40
  export var STREAMING_RECONNECT = 111;
44
41
  export var STREAMING_CONNECTING = 112;
@@ -59,8 +56,8 @@ export var ENGINE_VALUE_INVALID = 200;
59
56
  export var ENGINE_VALUE_NO_ATTRIBUTES = 201;
60
57
  export var CLIENT_NO_LISTENER = 202;
61
58
  export var CLIENT_NOT_READY_FROM_CACHE = 203;
62
- export var SYNC_MYSEGMENTS_FETCH_RETRY = 204;
63
- export var SYNC_SPLITS_FETCH_FAILS = 205;
59
+ export var SYNC_FETCH_RETRY = 204;
60
+ export var SYNC_FETCH_FAILS = 205;
64
61
  export var STREAMING_PARSING_ERROR_FAILS = 206;
65
62
  export var STREAMING_PARSING_MESSAGE_FAILS = 207;
66
63
  export var STREAMING_FALLBACK = 208;
@@ -70,7 +67,7 @@ export var WARN_SETTING_NULL = 211;
70
67
  export var WARN_TRIMMING_PROPERTIES = 212;
71
68
  export var WARN_CONVERTING = 213;
72
69
  export var WARN_TRIMMING = 214;
73
- export var WARN_NOT_EXISTENT_SPLIT = 215;
70
+ export var WARN_NOT_EXISTENT_DEFINITION = 215;
74
71
  export var WARN_LOWERCASE_TRAFFIC_TYPE = 216;
75
72
  export var WARN_NOT_EXISTENT_TT = 217;
76
73
  export var WARN_INTEGRATION_INVALID = 218;
@@ -121,15 +118,12 @@ export var LOG_PREFIX_ENGINE = 'engine';
121
118
  export var LOG_PREFIX_ENGINE_COMBINER = LOG_PREFIX_ENGINE + ':combiner: ';
122
119
  export var LOG_PREFIX_ENGINE_MATCHER = LOG_PREFIX_ENGINE + ':matcher: ';
123
120
  export var LOG_PREFIX_ENGINE_VALUE = LOG_PREFIX_ENGINE + ':value: ';
124
- export var LOG_PREFIX_SYNC = 'sync';
125
- export var LOG_PREFIX_SYNC_MANAGER = LOG_PREFIX_SYNC + ':sync-manager: ';
126
- export var LOG_PREFIX_SYNC_OFFLINE = LOG_PREFIX_SYNC + ':offline: ';
127
- export var LOG_PREFIX_SYNC_STREAMING = LOG_PREFIX_SYNC + ':streaming: ';
128
- export var LOG_PREFIX_SYNC_SPLITS = LOG_PREFIX_SYNC + ':featureflag-changes: ';
129
- export var LOG_PREFIX_SYNC_SEGMENTS = LOG_PREFIX_SYNC + ':segment-changes: ';
130
- export var LOG_PREFIX_SYNC_MYSEGMENTS = LOG_PREFIX_SYNC + ':my-segments: ';
131
- export var LOG_PREFIX_SYNC_POLLING = LOG_PREFIX_SYNC + ':polling-manager: ';
132
- export var LOG_PREFIX_SYNC_SUBMITTERS = LOG_PREFIX_SYNC + ':submitter: ';
121
+ export var LOG_PREFIX_SYNC = 'sync: ';
122
+ export var LOG_PREFIX_SYNC_MANAGER = 'sync:sync-manager: ';
123
+ export var LOG_PREFIX_SYNC_OFFLINE = 'sync:offline: ';
124
+ export var LOG_PREFIX_SYNC_STREAMING = 'sync:streaming: ';
125
+ export var LOG_PREFIX_SYNC_POLLING = 'sync:polling-manager: ';
126
+ export var LOG_PREFIX_SYNC_SUBMITTERS = 'sync:submitter: ';
133
127
  export var LOG_PREFIX_IMPRESSIONS_TRACKER = 'impressions-tracker: ';
134
128
  export var LOG_PREFIX_EVENTS_TRACKER = 'events-tracker: ';
135
129
  export var LOG_PREFIX_UNIQUE_KEYS_TRACKER = 'unique-keys-tracker: ';
@@ -86,7 +86,7 @@ var Logger = /** @class */ (function () {
86
86
  Logger.prototype._log = function (method, msg, args) {
87
87
  if (typeof msg === 'number') {
88
88
  var format = this.codes.get(msg);
89
- msg = format ? _sprintf(format, args) : "Message code " + msg + (args ? ', with args: ' + args.toString() : '');
89
+ msg = format ? _sprintf(format, args) : "Message code ".concat(msg).concat(args ? ', with args: ' + args.toString() : '');
90
90
  }
91
91
  else {
92
92
  if (args)
@@ -20,13 +20,12 @@ export var codesDebug = codesInfo.concat([
20
20
  [c.RETRIEVE_MANAGER, 'Retrieving manager instance.'],
21
21
  // synchronizer
22
22
  [c.SYNC_OFFLINE_DATA, c.LOG_PREFIX_SYNC_OFFLINE + 'Feature flags data: \n%s'],
23
- [c.SYNC_SPLITS_FETCH, c.LOG_PREFIX_SYNC_SPLITS + 'Spin up feature flags update using since = %s and rbSince = %s.'],
24
- [c.SYNC_SPLITS_UPDATE, c.LOG_PREFIX_SYNC_SPLITS + 'New feature flags: %s. Removed feature flags: %s.'],
25
- [c.SYNC_RBS_UPDATE, c.LOG_PREFIX_SYNC_SPLITS + 'New rule-based segments: %s. Removed rule-based segments: %s.'],
23
+ [c.SYNC_FETCH, c.LOG_PREFIX_SYNC + 'Spin up %s updates using since = %s and rbSince = %s.'],
24
+ [c.SYNC_UPDATE, c.LOG_PREFIX_SYNC + 'New %s: %s. Removed: %s.'],
26
25
  [c.STREAMING_NEW_MESSAGE, c.LOG_PREFIX_SYNC_STREAMING + 'New SSE message received, with data: %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'],
26
+ [c.SYNC_TASK_START, c.LOG_PREFIX_SYNC + 'Starting %s. Running each %s millis'],
27
+ [c.SYNC_TASK_EXECUTE, c.LOG_PREFIX_SYNC + 'Running %s'],
28
+ [c.SYNC_TASK_STOP, c.LOG_PREFIX_SYNC + 'Stopping %s'],
30
29
  // initialization / settings validation
31
30
  [c.SETTINGS_SPLITS_FILTER, c.LOG_PREFIX_SETTINGS + ': feature flags filtering criteria is "%s".']
32
31
  ]);
@@ -1,7 +1,7 @@
1
1
  import * as c from '../constants';
2
2
  export var codesError = [
3
3
  // evaluator
4
- [c.ERROR_ENGINE_COMBINER_IFELSEIF, c.LOG_PREFIX_ENGINE_COMBINER + 'Invalid feature flag, no valid rules or unsupported targeting rule type found'],
4
+ [c.ERROR_ENGINE_COMBINER_IFELSEIF, c.LOG_PREFIX_ENGINE_COMBINER + 'Invalid definition, no valid rules or unsupported targeting rule type found'],
5
5
  [c.ENGINE_MATCHER_ERROR, c.LOG_PREFIX_ENGINE_MATCHER + '[%s] %s'],
6
6
  // SDK
7
7
  [c.ERROR_LOGLEVEL_INVALID, 'logger: Invalid Log Level - No changes to the logs will be applied.'],
@@ -12,7 +12,7 @@ export var codesError = [
12
12
  // synchronizer
13
13
  [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'],
14
14
  [c.ERROR_STREAMING_SSE, c.LOG_PREFIX_SYNC_STREAMING + 'Failed to connect or error on streaming connection, with error message: %s'],
15
- [c.ERROR_STREAMING_AUTH, c.LOG_PREFIX_SYNC_STREAMING + 'Failed to authenticate for streaming. Error: %s.'],
15
+ [c.ERROR_STREAMING_AUTH, c.LOG_PREFIX_SYNC_STREAMING + 'Failed to authenticate for streaming. Error: %s'],
16
16
  [c.ERROR_HTTP, 'HTTP request failed with %s. URL: %s. Message: %s'],
17
17
  // client status
18
18
  [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.'],
@@ -33,6 +33,6 @@ export var codesError = [
33
33
  [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".'],
34
34
  [c.ERROR_STORAGE_INVALID, c.LOG_PREFIX_SETTINGS + ': the provided storage is invalid.%s Falling back into default MEMORY storage'],
35
35
  [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'],
36
- [c.ERROR_TOO_MANY_SETS, c.LOG_PREFIX_SETTINGS + ': the amount of flag sets provided are big causing uri length error.'],
36
+ [c.ERROR_TOO_MANY_SETS, c.LOG_PREFIX_SETTINGS + ': the number of sets provided is too high, which causes a URI length error.'],
37
37
  [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.'],
38
38
  ];
@@ -6,8 +6,7 @@ export var codesInfo = codesWarn.concat([
6
6
  [c.CLIENT_READY_FROM_CACHE, READY_MSG + ' from cache'],
7
7
  [c.CLIENT_READY, READY_MSG],
8
8
  // SDK
9
- [c.IMPRESSION, c.LOG_PREFIX_IMPRESSIONS_TRACKER + 'Feature flag: %s. Key: %s. Evaluation: %s. Label: %s'],
10
- [c.IMPRESSION_QUEUEING, c.LOG_PREFIX_IMPRESSIONS_TRACKER + 'Queueing corresponding impression.'],
9
+ [c.IMPRESSION_QUEUEING, c.LOG_PREFIX_IMPRESSIONS_TRACKER + 'Queueing impression. %s: %s. Key: %s. Evaluation: %s. Label: %s'],
11
10
  [c.NEW_SHARED_CLIENT, 'New shared client instance created.'],
12
11
  [c.NEW_FACTORY, 'New Split SDK instance created. %s'],
13
12
  [c.EVENTS_TRACKER_SUCCESS, c.LOG_PREFIX_EVENTS_TRACKER + 'Successfully queued %s'],
@@ -19,7 +18,6 @@ export var codesInfo = codesWarn.concat([
19
18
  [c.POLLING_SMART_PAUSING, c.LOG_PREFIX_SYNC_POLLING + 'Turning segments data polling %s.'],
20
19
  [c.POLLING_START, c.LOG_PREFIX_SYNC_POLLING + 'Starting polling'],
21
20
  [c.POLLING_STOP, c.LOG_PREFIX_SYNC_POLLING + 'Stopping polling'],
22
- [c.SYNC_SPLITS_FETCH_RETRY, c.LOG_PREFIX_SYNC_SPLITS + 'Retrying fetch of feature flags (attempt #%s). Reason: %s'],
23
21
  [c.SUBMITTERS_PUSH_FULL_QUEUE, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Flushing full %s queue and resetting timer.'],
24
22
  [c.SUBMITTERS_PUSH, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Pushing %s.'],
25
23
  [c.SUBMITTERS_PUSH_PAGE_HIDDEN, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Flushing %s because page became hidden.'],
@@ -5,24 +5,24 @@ export var codesWarn = codesError.concat([
5
5
  [c.ENGINE_VALUE_INVALID, c.LOG_PREFIX_ENGINE_VALUE + 'Value %s doesn\'t match with expected type.'],
6
6
  [c.ENGINE_VALUE_NO_ATTRIBUTES, c.LOG_PREFIX_ENGINE_VALUE + 'Defined attribute `%s`. No attributes received.'],
7
7
  // synchronizer
8
- [c.SYNC_MYSEGMENTS_FETCH_RETRY, c.LOG_PREFIX_SYNC_MYSEGMENTS + 'Retrying fetch of memberships (attempt #%s). Reason: %s'],
9
- [c.SYNC_SPLITS_FETCH_FAILS, c.LOG_PREFIX_SYNC_SPLITS + 'Error while doing fetch of feature flags. %s'],
8
+ [c.SYNC_FETCH_RETRY, c.LOG_PREFIX_SYNC + 'Retrying fetch of %s (attempt #%s). Reason: %s'],
9
+ [c.SYNC_FETCH_FAILS, c.LOG_PREFIX_SYNC + 'Error while doing fetch of %s. %s'],
10
10
  [c.STREAMING_PARSING_ERROR_FAILS, c.LOG_PREFIX_SYNC_STREAMING + 'Error parsing SSE error notification: %s'],
11
11
  [c.STREAMING_PARSING_MESSAGE_FAILS, c.LOG_PREFIX_SYNC_STREAMING + 'Error parsing SSE message notification: %s'],
12
12
  [c.STREAMING_FALLBACK, c.LOG_PREFIX_SYNC_STREAMING + 'Falling back to polling mode. Reason: %s'],
13
- [c.SUBMITTERS_PUSH_FAILS, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Dropping %s after retry. Reason: %s.'],
14
- [c.SUBMITTERS_PUSH_RETRY, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Failed to push %s, keeping data to retry on next iteration. Reason: %s.'],
13
+ [c.SUBMITTERS_PUSH_FAILS, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Dropping %s after retry. Reason: %s'],
14
+ [c.SUBMITTERS_PUSH_RETRY, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Failed to push %s, keeping data to retry on next iteration. Reason: %s'],
15
15
  // client status
16
- [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.'],
16
+ [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.'],
17
17
  [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.'],
18
18
  // input validation
19
19
  [c.WARN_SETTING_NULL, '%s: Property "%s" is of invalid type. Setting value to null.'],
20
20
  [c.WARN_TRIMMING_PROPERTIES, '%s: more than 300 properties were provided. Some of them will be trimmed when processed.'],
21
21
  [c.WARN_CONVERTING, '%s: %s "%s" is not of type string, converting.'],
22
22
  [c.WARN_TRIMMING, '%s: %s "%s" has extra whitespace, trimming.'],
23
- [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.'],
23
+ [c.WARN_NOT_EXISTENT_DEFINITION, '%s: "%s" does not exist in this environment. Please double check that it exists in Harness UI.'],
24
24
  [c.WARN_LOWERCASE_TRAFFIC_TYPE, '%s: traffic_type_name should be all lowercase - converting string to lowercase.'],
25
- [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.'],
25
+ [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.'],
26
26
  [c.WARN_FLAGSET_NOT_CONFIGURED, '%s: you passed %s which is not part of the configured FlagSetsFilter, ignoring Flag Set.'],
27
27
  // initialization / settings validation
28
28
  [c.WARN_INTEGRATION_INVALID, c.LOG_PREFIX_SETTINGS + ': %s integration item(s) at settings is invalid. %s'],
@@ -34,5 +34,5 @@ export var codesWarn = codesError.concat([
34
34
  [c.STREAMING_PARSING_SPLIT_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching SplitChanges due to an error processing %s notification: %s'],
35
35
  [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.'],
36
36
  [c.WARN_LOWERCASE_FLAGSET, '%s: flag set %s should be all lowercase - converting string to lowercase.'],
37
- [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.'],
37
+ [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.'],
38
38
  ]);
@@ -0,0 +1,12 @@
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
+ export var platform = {
7
+ getFetch: getFetch,
8
+ getEventSource: getEventSource,
9
+ EventEmitter: EventEmitter,
10
+ now: now,
11
+ SignalListener: BrowserSignalListener
12
+ };
@@ -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
+ }