@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
@@ -5,16 +5,10 @@ var sdkReadinessManager_1 = require("../readiness/sdkReadinessManager");
5
5
  var impressionsTracker_1 = require("../trackers/impressionsTracker");
6
6
  var eventTracker_1 = require("../trackers/eventTracker");
7
7
  var telemetryTracker_1 = require("../trackers/telemetryTracker");
8
- var apiKey_1 = require("../utils/inputValidation/apiKey");
9
8
  var sdkLogger_1 = require("../logger/sdkLogger");
10
9
  var constants_1 = require("../logger/constants");
11
10
  var constants_2 = require("../readiness/constants");
12
11
  var objectAssign_1 = require("../utils/lang/objectAssign");
13
- var strategyDebug_1 = require("../trackers/strategy/strategyDebug");
14
- var strategyOptimized_1 = require("../trackers/strategy/strategyOptimized");
15
- var strategyNone_1 = require("../trackers/strategy/strategyNone");
16
- var uniqueKeysTracker_1 = require("../trackers/uniqueKeysTracker");
17
- var constants_3 = require("../utils/constants");
18
12
  var setRolloutPlan_1 = require("../storages/setRolloutPlan");
19
13
  var key_1 = require("../utils/key");
20
14
  var fallbackTreatmentsCalculator_1 = require("../evaluator/fallbackTreatmentsCalculator");
@@ -22,19 +16,10 @@ var fallbackTreatmentsCalculator_1 = require("../evaluator/fallbackTreatmentsCal
22
16
  * Modular SDK factory
23
17
  */
24
18
  function sdkFactory(params) {
25
- var settings = params.settings, platform = params.platform, storageFactory = params.storageFactory, splitApiFactory = params.splitApiFactory, extraProps = params.extraProps, syncManagerFactory = params.syncManagerFactory, SignalListener = params.SignalListener, impressionsObserverFactory = params.impressionsObserverFactory, integrationsManagerFactory = params.integrationsManagerFactory, sdkManagerFactory = params.sdkManagerFactory, sdkClientMethodFactory = params.sdkClientMethodFactory, filterAdapterFactory = params.filterAdapterFactory, lazyInit = params.lazyInit;
26
- var log = settings.log, impressionsMode = settings.sync.impressionsMode, initialRolloutPlan = settings.initialRolloutPlan, key = settings.core.key;
19
+ var settings = params.settings, platform = params.platform, storageFactory = params.storageFactory, splitApiFactory = params.splitApiFactory, extraProps = params.extraProps, syncManagerFactory = params.syncManagerFactory, integrationsManagerFactory = params.integrationsManagerFactory, sdkManagerFactory = params.sdkManagerFactory, sdkClientMethodFactory = params.sdkClientMethodFactory, lazyInit = params.lazyInit;
20
+ var log = settings.log, initialRolloutPlan = settings.initialRolloutPlan, key = settings.core.key;
27
21
  // @TODO handle non-recoverable errors, such as, global `fetch` not available, invalid SDK Key, etc.
28
22
  // On non-recoverable errors, we should mark the SDK as destroyed and not start synchronization.
29
- // initialization
30
- var hasInit = false;
31
- var initCallbacks = [];
32
- function whenInit(cb) {
33
- if (hasInit)
34
- cb();
35
- else
36
- initCallbacks.push(cb);
37
- }
38
23
  var sdkReadinessManager = (0, sdkReadinessManager_1.sdkReadinessManagerFactory)(platform.EventEmitter, settings);
39
24
  var readiness = sdkReadinessManager.readinessManager;
40
25
  var storage = storageFactory({
@@ -52,7 +37,7 @@ function sdkFactory(params) {
52
37
  readiness.splits.emit(constants_2.SDK_SPLITS_CACHE_LOADED);
53
38
  }
54
39
  });
55
- var fallbackTreatmentsCalculator = new fallbackTreatmentsCalculator_1.FallbackTreatmentsCalculator(settings.fallbackTreatments);
40
+ var fallbackCalculator = (0, fallbackTreatmentsCalculator_1.FallbackTreatmentsCalculator)(settings.fallbackTreatments);
56
41
  if (initialRolloutPlan) {
57
42
  (0, setRolloutPlan_1.setRolloutPlan)(log, initialRolloutPlan, storage, key && (0, key_1.getMatching)(key));
58
43
  if (storage.splits.getChangeNumber() > -1)
@@ -61,38 +46,17 @@ function sdkFactory(params) {
61
46
  var clients = {};
62
47
  var telemetryTracker = (0, telemetryTracker_1.telemetryTrackerFactory)(storage.telemetry, platform.now);
63
48
  var integrationsManager = integrationsManagerFactory && integrationsManagerFactory({ settings: settings, storage: storage, telemetryTracker: telemetryTracker });
64
- var observer = impressionsObserverFactory();
65
- var uniqueKeysTracker = (0, uniqueKeysTracker_1.uniqueKeysTrackerFactory)(log, storage.uniqueKeys, filterAdapterFactory && filterAdapterFactory());
66
- var noneStrategy = (0, strategyNone_1.strategyNoneFactory)(storage.impressionCounts, uniqueKeysTracker);
67
- var strategy = impressionsMode === constants_3.OPTIMIZED ?
68
- (0, strategyOptimized_1.strategyOptimizedFactory)(observer, storage.impressionCounts) :
69
- impressionsMode === constants_3.DEBUG ?
70
- (0, strategyDebug_1.strategyDebugFactory)(observer) :
71
- noneStrategy;
72
- var impressionsTracker = (0, impressionsTracker_1.impressionsTrackerFactory)(settings, storage.impressions, noneStrategy, strategy, whenInit, integrationsManager, storage.telemetry);
73
- var eventTracker = (0, eventTracker_1.eventTrackerFactory)(settings, storage.events, whenInit, integrationsManager, storage.telemetry);
49
+ var impressionsTracker = (0, impressionsTracker_1.impressionsTrackerFactory)(params, storage, integrationsManager);
50
+ var eventTracker = (0, eventTracker_1.eventTrackerFactory)(settings, storage.events, integrationsManager, storage.telemetry);
74
51
  // splitApi is used by SyncManager and Browser signal listener
75
52
  var splitApi = splitApiFactory && splitApiFactory(settings, platform, telemetryTracker);
76
- var ctx = { clients: clients, splitApi: splitApi, eventTracker: eventTracker, impressionsTracker: impressionsTracker, telemetryTracker: telemetryTracker, uniqueKeysTracker: uniqueKeysTracker, sdkReadinessManager: sdkReadinessManager, readiness: readiness, settings: settings, storage: storage, platform: platform, fallbackTreatmentsCalculator: fallbackTreatmentsCalculator };
77
- var syncManager = syncManagerFactory && syncManagerFactory(ctx);
78
- ctx.syncManager = syncManager;
79
- var signalListener = SignalListener && new SignalListener(syncManager, settings, storage, splitApi);
80
- ctx.signalListener = signalListener;
53
+ var ctx = { clients: clients, splitApi: splitApi, eventTracker: eventTracker, impressionsTracker: impressionsTracker, telemetryTracker: telemetryTracker, sdkReadinessManager: sdkReadinessManager, readiness: readiness, settings: settings, storage: storage, platform: platform, fallbackCalculator: fallbackCalculator };
54
+ ctx.syncManager = syncManagerFactory && syncManagerFactory(ctx);
81
55
  // SDK client and manager
82
56
  var clientMethod = sdkClientMethodFactory(ctx);
83
57
  var managerInstance = sdkManagerFactory(settings, storage.splits, sdkReadinessManager);
84
58
  function init() {
85
- if (hasInit)
86
- return;
87
- hasInit = true;
88
- // We will just log and allow for the SDK to end up throwing an SDK_TIMEOUT event for devs to handle.
89
- (0, apiKey_1.validateAndTrackApiKey)(log, settings.core.authorizationKey);
90
- readiness.init();
91
- uniqueKeysTracker.start();
92
- syncManager && syncManager.start();
93
- signalListener && signalListener.start();
94
- initCallbacks.forEach(function (cb) { return cb(); });
95
- initCallbacks.length = 0;
59
+ Object.keys(clients).map(function (key) { return clients[key].init(); });
96
60
  }
97
61
  log.info(constants_1.NEW_FACTORY, [settings.version]);
98
62
  // @ts-ignore
@@ -108,7 +72,6 @@ function sdkFactory(params) {
108
72
  Logger: (0, sdkLogger_1.createLoggerAPI)(log),
109
73
  settings: settings,
110
74
  destroy: function () {
111
- hasInit = false;
112
75
  return Promise.all(Object.keys(clients).map(function (key) { return clients[key].destroy(); })).then(function () { });
113
76
  }
114
77
  }, extraProps && extraProps(ctx), lazyInit ? { init: init } : init());
@@ -53,18 +53,18 @@ function sdkManagerFactory(settings, splits, _a) {
53
53
  * Get the feature flag object corresponding to the given feature flag name if valid
54
54
  */
55
55
  split: function (featureFlagName) {
56
- var splitName = (0, inputValidation_1.validateSplit)(log, featureFlagName, constants_1.SPLIT_FN_LABEL);
56
+ var splitName = (0, inputValidation_1.validateDefinition)(log, featureFlagName, constants_1.SPLIT_FN_LABEL);
57
57
  if (!(0, inputValidation_1.validateIfOperational)(log, readinessManager, constants_1.SPLIT_FN_LABEL) || !splitName) {
58
58
  return isAsync ? Promise.resolve(null) : null;
59
59
  }
60
60
  var split = splits.getSplit(splitName);
61
61
  if ((0, thenable_1.thenable)(split)) {
62
62
  return split.catch(function () { return null; }).then(function (result) {
63
- (0, inputValidation_1.validateSplitExistence)(log, readinessManager, splitName, result, constants_1.SPLIT_FN_LABEL);
63
+ (0, inputValidation_1.validateDefinitionExistence)(log, readinessManager, splitName, result, constants_1.SPLIT_FN_LABEL);
64
64
  return objectToView(result);
65
65
  });
66
66
  }
67
- (0, inputValidation_1.validateSplitExistence)(log, readinessManager, splitName, split, constants_1.SPLIT_FN_LABEL);
67
+ (0, inputValidation_1.validateDefinitionExistence)(log, readinessManager, splitName, split, constants_1.SPLIT_FN_LABEL);
68
68
  return objectToView(split);
69
69
  },
70
70
  /**
@@ -24,15 +24,15 @@ function splitApiFactory(settings, platform, telemetryTracker) {
24
24
  return {
25
25
  // @TODO throw errors if health check requests fail, to log them in the Synchronizer
26
26
  getSdkAPIHealthCheck: function () {
27
- var url = urls.sdk + "/version";
27
+ var url = "".concat(urls.sdk, "/version");
28
28
  return splitHttpClient(url).then(function () { return true; }).catch(function () { return false; });
29
29
  },
30
30
  getEventsAPIHealthCheck: function () {
31
- var url = urls.events + "/version";
31
+ var url = "".concat(urls.events, "/version");
32
32
  return splitHttpClient(url).then(function () { return true; }).catch(function () { return false; });
33
33
  },
34
34
  fetchAuth: function (userMatchingKeys) {
35
- var url = urls.auth + "/v2/auth?s=" + settings.sync.flagSpecVersion;
35
+ var url = "".concat(urls.auth, "/v2/auth?s=").concat(settings.sync.flagSpecVersion);
36
36
  if (userMatchingKeys) { // `userMatchingKeys` is undefined in server-side
37
37
  var queryParams = userMatchingKeys.map(userKeyToQueryParam).join('&');
38
38
  if (queryParams)
@@ -41,7 +41,7 @@ function splitApiFactory(settings, platform, telemetryTracker) {
41
41
  return splitHttpClient(url, undefined, telemetryTracker.trackHttp(constants_1.TOKEN));
42
42
  },
43
43
  fetchSplitChanges: function (since, noCache, till, rbSince) {
44
- var url = urls.sdk + "/splitChanges?s=" + settings.sync.flagSpecVersion + "&since=" + since + (rbSince ? '&rbSince=' + rbSince : '') + (filterQueryString || '') + (till ? '&till=' + till : '');
44
+ var url = "".concat(urls.sdk, "/splitChanges?s=").concat(settings.sync.flagSpecVersion, "&since=").concat(since).concat(rbSince ? '&rbSince=' + rbSince : '').concat(filterQueryString || '').concat(till ? '&till=' + till : '');
45
45
  return splitHttpClient(url, noCache ? noCacheHeaderOptions : undefined, telemetryTracker.trackHttp(constants_1.SPLITS))
46
46
  .catch(function (err) {
47
47
  if (err.statusCode === 414)
@@ -49,8 +49,13 @@ function splitApiFactory(settings, platform, telemetryTracker) {
49
49
  throw err;
50
50
  });
51
51
  },
52
+ // @TODO support filterQueryString and handle ERROR_TOO_MANY_SETS error
53
+ fetchConfigs: function (since, noCache, till) {
54
+ var url = "".concat(urls.sdk, "/v1/configs?since=").concat(since).concat(filterQueryString || '').concat(till ? '&till=' + till : '');
55
+ return splitHttpClient(url, noCache ? noCacheHeaderOptions : undefined);
56
+ },
52
57
  fetchSegmentChanges: function (since, segmentName, noCache, till) {
53
- var url = urls.sdk + "/segmentChanges/" + segmentName + "?since=" + since + (till ? '&till=' + till : '');
58
+ var url = "".concat(urls.sdk, "/segmentChanges/").concat(segmentName, "?since=").concat(since).concat(till ? '&till=' + till : '');
54
59
  return splitHttpClient(url, noCache ? noCacheHeaderOptions : undefined, telemetryTracker.trackHttp(constants_1.SEGMENT));
55
60
  },
56
61
  fetchMemberships: function (userMatchingKey, noCache, till) {
@@ -60,7 +65,7 @@ function splitApiFactory(settings, platform, telemetryTracker) {
60
65
  * - avoid 404 responses. E.g.: '/api/memberships/foo/bar'
61
66
  * - match user keys with special characters. E.g.: 'foo%bar', 'foo/bar'
62
67
  */
63
- var url = urls.sdk + "/memberships/" + encodeURIComponent(userMatchingKey) + (till ? '?till=' + till : '');
68
+ var url = "".concat(urls.sdk, "/memberships/").concat(encodeURIComponent(userMatchingKey)).concat(till ? '?till=' + till : '');
64
69
  return splitHttpClient(url, noCache ? noCacheHeaderOptions : undefined, telemetryTracker.trackHttp(constants_1.MEMBERSHIPS));
65
70
  },
66
71
  /**
@@ -70,7 +75,7 @@ function splitApiFactory(settings, platform, telemetryTracker) {
70
75
  * @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
71
76
  */
72
77
  postEventsBulk: function (body, headers) {
73
- var url = urls.events + "/events/bulk";
78
+ var url = "".concat(urls.events, "/events/bulk");
74
79
  return splitHttpClient(url, { method: 'POST', body: body, headers: headers }, telemetryTracker.trackHttp(constants_1.EVENTS));
75
80
  },
76
81
  /**
@@ -80,7 +85,7 @@ function splitApiFactory(settings, platform, telemetryTracker) {
80
85
  * @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
81
86
  */
82
87
  postTestImpressionsBulk: function (body, headers) {
83
- var url = urls.events + "/testImpressions/bulk";
88
+ var url = "".concat(urls.events, "/testImpressions/bulk");
84
89
  return splitHttpClient(url, {
85
90
  // Adding extra headers to send impressions in OPTIMIZED or DEBUG modes.
86
91
  method: 'POST',
@@ -95,7 +100,7 @@ function splitApiFactory(settings, platform, telemetryTracker) {
95
100
  * @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
96
101
  */
97
102
  postTestImpressionsCount: function (body, headers) {
98
- var url = urls.events + "/testImpressions/count";
103
+ var url = "".concat(urls.events, "/testImpressions/count");
99
104
  return splitHttpClient(url, { method: 'POST', body: body, headers: headers }, telemetryTracker.trackHttp(constants_1.IMPRESSIONS_COUNT));
100
105
  },
101
106
  /**
@@ -105,7 +110,7 @@ function splitApiFactory(settings, platform, telemetryTracker) {
105
110
  * @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
106
111
  */
107
112
  postUniqueKeysBulkCs: function (body, headers) {
108
- var url = urls.telemetry + "/v1/keys/cs";
113
+ var url = "".concat(urls.telemetry, "/v1/keys/cs");
109
114
  return splitHttpClient(url, { method: 'POST', body: body, headers: headers }, telemetryTracker.trackHttp(constants_1.TELEMETRY));
110
115
  },
111
116
  /**
@@ -115,15 +120,15 @@ function splitApiFactory(settings, platform, telemetryTracker) {
115
120
  * @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
116
121
  */
117
122
  postUniqueKeysBulkSs: function (body, headers) {
118
- var url = urls.telemetry + "/v1/keys/ss";
123
+ var url = "".concat(urls.telemetry, "/v1/keys/ss");
119
124
  return splitHttpClient(url, { method: 'POST', body: body, headers: headers }, telemetryTracker.trackHttp(constants_1.TELEMETRY));
120
125
  },
121
126
  postMetricsConfig: function (body, headers) {
122
- var url = urls.telemetry + "/v1/metrics/config";
127
+ var url = "".concat(urls.telemetry, "/v1/metrics/config");
123
128
  return splitHttpClient(url, { method: 'POST', body: body, headers: headers }, telemetryTracker.trackHttp(constants_1.TELEMETRY), true);
124
129
  },
125
130
  postMetricsUsage: function (body, headers) {
126
- var url = urls.telemetry + "/v1/metrics/usage";
131
+ var url = "".concat(urls.telemetry, "/v1/metrics/usage");
127
132
  return splitHttpClient(url, { method: 'POST', body: body, headers: headers }, telemetryTracker.trackHttp(constants_1.TELEMETRY), true);
128
133
  }
129
134
  };
@@ -24,7 +24,7 @@ function splitHttpClientFactory(settings, _a) {
24
24
  var commonHeaders = {
25
25
  'Accept': 'application/json',
26
26
  'Content-Type': 'application/json',
27
- 'Authorization': "Bearer " + authorizationKey,
27
+ 'Authorization': "Bearer ".concat(authorizationKey),
28
28
  'SplitSDKVersion': version
29
29
  };
30
30
  if (ip)
@@ -14,7 +14,7 @@ var AbstractSplitsCacheAsync = /** @class */ (function () {
14
14
  return Promise.all([
15
15
  this.setChangeNumber(changeNumber),
16
16
  Promise.all(toAdd.map(function (addedFF) { return _this.addSplit(addedFF); })),
17
- Promise.all(toRemove.map(function (removedFF) { return _this.removeSplit(removedFF.name); }))
17
+ Promise.all(toRemove.map(function (removedFF) { return _this.removeSplit(removedFF); }))
18
18
  ]).then(function (_a) {
19
19
  var added = _a[1], removed = _a[2];
20
20
  return added.some(function (result) { return result; }) || removed.some(function (result) { return result; });
@@ -13,7 +13,7 @@ var AbstractSplitsCacheSync = /** @class */ (function () {
13
13
  AbstractSplitsCacheSync.prototype.update = function (toAdd, toRemove, changeNumber) {
14
14
  var _this = this;
15
15
  var updated = toAdd.map(function (addedFF) { return _this.addSplit(addedFF); }).some(function (result) { return result; });
16
- updated = toRemove.map(function (removedFF) { return _this.removeSplit(removedFF.name); }).some(function (result) { return result; }) || updated;
16
+ updated = toRemove.map(function (removedFF) { return _this.removeSplit(removedFF); }).some(function (result) { return result; }) || updated;
17
17
  this.setChangeNumber(changeNumber);
18
18
  return updated;
19
19
  };
@@ -14,34 +14,34 @@ var KeyBuilder = /** @class */ (function () {
14
14
  this.prefix = prefix;
15
15
  }
16
16
  KeyBuilder.prototype.buildTrafficTypeKey = function (trafficType) {
17
- return this.prefix + ".trafficType." + trafficType;
17
+ return "".concat(this.prefix, ".trafficType.").concat(trafficType);
18
18
  };
19
19
  KeyBuilder.prototype.buildFlagSetKey = function (flagSet) {
20
- return this.prefix + ".flagSet." + flagSet;
20
+ return "".concat(this.prefix, ".flagSet.").concat(flagSet);
21
21
  };
22
22
  KeyBuilder.prototype.buildSplitKey = function (splitName) {
23
- return this.prefix + ".split." + splitName;
23
+ return "".concat(this.prefix, ".split.").concat(splitName);
24
24
  };
25
25
  KeyBuilder.prototype.buildSplitsTillKey = function () {
26
- return this.prefix + ".splits.till";
26
+ return "".concat(this.prefix, ".splits.till");
27
27
  };
28
28
  KeyBuilder.prototype.buildSplitKeyPrefix = function () {
29
- return this.prefix + ".split.";
29
+ return "".concat(this.prefix, ".split.");
30
30
  };
31
31
  KeyBuilder.prototype.buildRBSegmentKey = function (rbsegmentName) {
32
- return this.prefix + ".rbsegment." + rbsegmentName;
32
+ return "".concat(this.prefix, ".rbsegment.").concat(rbsegmentName);
33
33
  };
34
34
  KeyBuilder.prototype.buildRBSegmentsTillKey = function () {
35
- return this.prefix + ".rbsegments.till";
35
+ return "".concat(this.prefix, ".rbsegments.till");
36
36
  };
37
37
  KeyBuilder.prototype.buildRBSegmentKeyPrefix = function () {
38
- return this.prefix + ".rbsegment.";
38
+ return "".concat(this.prefix, ".rbsegment.");
39
39
  };
40
40
  KeyBuilder.prototype.buildSegmentNameKey = function (segmentName) {
41
- return this.prefix + ".segment." + segmentName;
41
+ return "".concat(this.prefix, ".segment.").concat(segmentName);
42
42
  };
43
43
  KeyBuilder.prototype.buildSegmentTillKey = function (segmentName) {
44
- return this.prefix + ".segment." + segmentName + ".till";
44
+ return "".concat(this.prefix, ".segment.").concat(segmentName, ".till");
45
45
  };
46
46
  KeyBuilder.prototype.extractKey = function (builtKey) {
47
47
  var s = builtKey.match(everythingAtTheEnd);
@@ -53,7 +53,7 @@ var KeyBuilder = /** @class */ (function () {
53
53
  }
54
54
  };
55
55
  KeyBuilder.prototype.buildHashKey = function () {
56
- return this.prefix + ".hash";
56
+ return "".concat(this.prefix, ".hash");
57
57
  };
58
58
  return KeyBuilder;
59
59
  }());
@@ -63,6 +63,6 @@ exports.KeyBuilder = KeyBuilder;
63
63
  * The hash is in hexadecimal format (8 characters max, 32 bits).
64
64
  */
65
65
  function getStorageHash(settings) {
66
- return (0, murmur3_1.hash)(settings.core.authorizationKey + "::" + settings.sync.__splitFiltersValidation.queryString + "::" + settings.sync.flagSpecVersion).toString(16);
66
+ return (0, murmur3_1.hash)("".concat(settings.core.authorizationKey, "::").concat(settings.sync.__splitFiltersValidation.queryString, "::").concat(settings.sync.flagSpecVersion)).toString(16);
67
67
  }
68
68
  exports.getStorageHash = getStorageHash;
@@ -5,44 +5,44 @@ var tslib_1 = require("tslib");
5
5
  var lang_1 = require("../utils/lang");
6
6
  var KeyBuilder_1 = require("./KeyBuilder");
7
7
  var KeyBuilderCS = /** @class */ (function (_super) {
8
- (0, tslib_1.__extends)(KeyBuilderCS, _super);
8
+ tslib_1.__extends(KeyBuilderCS, _super);
9
9
  function KeyBuilderCS(prefix, matchingKey) {
10
10
  var _this = _super.call(this, prefix) || this;
11
11
  _this.matchingKey = matchingKey;
12
- _this.regexSplitsCacheKey = new RegExp("^" + prefix + "\\.(splits?|trafficType|flagSet)\\.");
12
+ _this.regexSplitsCacheKey = new RegExp("^".concat(prefix, "\\.(splits?|trafficType|flagSet)\\."));
13
13
  return _this;
14
14
  }
15
15
  /**
16
16
  * @override
17
17
  */
18
18
  KeyBuilderCS.prototype.buildSegmentNameKey = function (segmentName) {
19
- return this.prefix + "." + this.matchingKey + ".segment." + segmentName;
19
+ return "".concat(this.prefix, ".").concat(this.matchingKey, ".segment.").concat(segmentName);
20
20
  };
21
21
  KeyBuilderCS.prototype.extractSegmentName = function (builtSegmentKeyName) {
22
- var prefix = this.prefix + "." + this.matchingKey + ".segment.";
22
+ var prefix = "".concat(this.prefix, ".").concat(this.matchingKey, ".segment.");
23
23
  if ((0, lang_1.startsWith)(builtSegmentKeyName, prefix))
24
24
  return builtSegmentKeyName.slice(prefix.length);
25
25
  };
26
26
  KeyBuilderCS.prototype.buildLastUpdatedKey = function () {
27
- return this.prefix + ".splits.lastUpdated";
27
+ return "".concat(this.prefix, ".splits.lastUpdated");
28
28
  };
29
29
  KeyBuilderCS.prototype.isSplitsCacheKey = function (key) {
30
30
  return this.regexSplitsCacheKey.test(key);
31
31
  };
32
32
  KeyBuilderCS.prototype.buildTillKey = function () {
33
- return this.prefix + "." + this.matchingKey + ".segments.till";
33
+ return "".concat(this.prefix, ".").concat(this.matchingKey, ".segments.till");
34
34
  };
35
35
  KeyBuilderCS.prototype.isSplitKey = function (key) {
36
- return (0, lang_1.startsWith)(key, this.prefix + ".split.");
36
+ return (0, lang_1.startsWith)(key, "".concat(this.prefix, ".split."));
37
37
  };
38
38
  KeyBuilderCS.prototype.isRBSegmentKey = function (key) {
39
- return (0, lang_1.startsWith)(key, this.prefix + ".rbsegment.");
39
+ return (0, lang_1.startsWith)(key, "".concat(this.prefix, ".rbsegment."));
40
40
  };
41
41
  KeyBuilderCS.prototype.buildSplitsWithSegmentCountKey = function () {
42
- return this.prefix + ".splits.usingSegments";
42
+ return "".concat(this.prefix, ".splits.usingSegments");
43
43
  };
44
44
  KeyBuilderCS.prototype.buildLastClear = function () {
45
- return this.prefix + ".lastClear";
45
+ return "".concat(this.prefix, ".lastClear");
46
46
  };
47
47
  return KeyBuilderCS;
48
48
  }(KeyBuilder_1.KeyBuilder));
@@ -50,15 +50,15 @@ exports.KeyBuilderCS = KeyBuilderCS;
50
50
  function myLargeSegmentsKeyBuilder(prefix, matchingKey) {
51
51
  return {
52
52
  buildSegmentNameKey: function (segmentName) {
53
- return prefix + "." + matchingKey + ".largeSegment." + segmentName;
53
+ return "".concat(prefix, ".").concat(matchingKey, ".largeSegment.").concat(segmentName);
54
54
  },
55
55
  extractSegmentName: function (builtSegmentKeyName) {
56
- var p = prefix + "." + matchingKey + ".largeSegment.";
56
+ var p = "".concat(prefix, ".").concat(matchingKey, ".largeSegment.");
57
57
  if ((0, lang_1.startsWith)(builtSegmentKeyName, p))
58
58
  return builtSegmentKeyName.slice(p.length);
59
59
  },
60
60
  buildTillKey: function () {
61
- return prefix + "." + matchingKey + ".largeSegments.till";
61
+ return "".concat(prefix, ".").concat(matchingKey, ".largeSegments.till");
62
62
  }
63
63
  };
64
64
  }
@@ -15,45 +15,45 @@ exports.METHOD_NAMES = {
15
15
  tr: 'track'
16
16
  };
17
17
  var KeyBuilderSS = /** @class */ (function (_super) {
18
- (0, tslib_1.__extends)(KeyBuilderSS, _super);
18
+ tslib_1.__extends(KeyBuilderSS, _super);
19
19
  function KeyBuilderSS(prefix, metadata) {
20
20
  var _this = _super.call(this, prefix) || this;
21
- _this.latencyPrefix = _this.prefix + ".telemetry.latencies";
22
- _this.exceptionPrefix = _this.prefix + ".telemetry.exceptions";
23
- _this.initPrefix = _this.prefix + ".telemetry.init";
24
- _this.versionablePrefix = metadata.s + "/" + metadata.n + "/" + metadata.i;
21
+ _this.latencyPrefix = "".concat(_this.prefix, ".telemetry.latencies");
22
+ _this.exceptionPrefix = "".concat(_this.prefix, ".telemetry.exceptions");
23
+ _this.initPrefix = "".concat(_this.prefix, ".telemetry.init");
24
+ _this.versionablePrefix = "".concat(metadata.s, "/").concat(metadata.n, "/").concat(metadata.i);
25
25
  return _this;
26
26
  }
27
27
  KeyBuilderSS.prototype.buildRegisteredSegmentsKey = function () {
28
- return this.prefix + ".segments.registered";
28
+ return "".concat(this.prefix, ".segments.registered");
29
29
  };
30
30
  KeyBuilderSS.prototype.buildImpressionsKey = function () {
31
- return this.prefix + ".impressions";
31
+ return "".concat(this.prefix, ".impressions");
32
32
  };
33
33
  KeyBuilderSS.prototype.buildImpressionsCountKey = function () {
34
- return this.prefix + ".impressions.count";
34
+ return "".concat(this.prefix, ".impressions.count");
35
35
  };
36
36
  KeyBuilderSS.prototype.buildUniqueKeysKey = function () {
37
- return this.prefix + ".uniquekeys";
37
+ return "".concat(this.prefix, ".uniquekeys");
38
38
  };
39
39
  KeyBuilderSS.prototype.buildEventsKey = function () {
40
- return this.prefix + ".events";
40
+ return "".concat(this.prefix, ".events");
41
41
  };
42
42
  KeyBuilderSS.prototype.searchPatternForSplitKeys = function () {
43
- return this.buildSplitKeyPrefix() + "*";
43
+ return "".concat(this.buildSplitKeyPrefix(), "*");
44
44
  };
45
45
  KeyBuilderSS.prototype.searchPatternForRBSegmentKeys = function () {
46
- return this.buildRBSegmentKeyPrefix() + "*";
46
+ return "".concat(this.buildRBSegmentKeyPrefix(), "*");
47
47
  };
48
48
  /* Telemetry keys */
49
49
  KeyBuilderSS.prototype.buildLatencyKey = function (method, bucket) {
50
- return this.latencyPrefix + "::" + this.versionablePrefix + "/" + exports.METHOD_NAMES[method] + "/" + bucket;
50
+ return "".concat(this.latencyPrefix, "::").concat(this.versionablePrefix, "/").concat(exports.METHOD_NAMES[method], "/").concat(bucket);
51
51
  };
52
52
  KeyBuilderSS.prototype.buildExceptionKey = function (method) {
53
- return this.exceptionPrefix + "::" + this.versionablePrefix + "/" + exports.METHOD_NAMES[method];
53
+ return "".concat(this.exceptionPrefix, "::").concat(this.versionablePrefix, "/").concat(exports.METHOD_NAMES[method]);
54
54
  };
55
55
  KeyBuilderSS.prototype.buildInitKey = function () {
56
- return this.initPrefix + "::" + this.versionablePrefix;
56
+ return "".concat(this.initPrefix, "::").concat(this.versionablePrefix);
57
57
  };
58
58
  return KeyBuilderSS;
59
59
  }(KeyBuilder_1.KeyBuilder));
@@ -10,7 +10,7 @@ function getRolloutPlan(log, storage, options) {
10
10
  if (options === void 0) { options = {}; }
11
11
  var keys = options.keys, exposeSegments = options.exposeSegments;
12
12
  var splits = storage.splits, segments = storage.segments, rbSegments = storage.rbSegments;
13
- log.debug("storage: get feature flags" + (keys ? ", and memberships for keys: " + keys : '') + (exposeSegments ? ', and segments' : ''));
13
+ log.debug("storage: get feature flags".concat(keys ? ", and memberships for keys: ".concat(keys) : '').concat(exposeSegments ? ', and segments' : ''));
14
14
  return {
15
15
  splitChanges: {
16
16
  ff: {
@@ -6,7 +6,7 @@ var lang_1 = require("../../utils/lang");
6
6
  var AbstractMySegmentsCacheSync_1 = require("../AbstractMySegmentsCacheSync");
7
7
  var constants_1 = require("./constants");
8
8
  var MySegmentsCacheInLocal = /** @class */ (function (_super) {
9
- (0, tslib_1.__extends)(MySegmentsCacheInLocal, _super);
9
+ tslib_1.__extends(MySegmentsCacheInLocal, _super);
10
10
  function MySegmentsCacheInLocal(log, keys, storage) {
11
11
  var _this = _super.call(this) || this;
12
12
  _this.log = log;
@@ -19,7 +19,7 @@ var RBSegmentsCacheInLocal = /** @class */ (function () {
19
19
  RBSegmentsCacheInLocal.prototype.update = function (toAdd, toRemove, changeNumber) {
20
20
  var _this = this;
21
21
  var updated = toAdd.map(function (toAdd) { return _this.add(toAdd); }).some(function (result) { return result; });
22
- updated = toRemove.map(function (toRemove) { return _this.remove(toRemove.name); }).some(function (result) { return result; }) || updated;
22
+ updated = toRemove.map(function (toRemove) { return _this.remove(toRemove); }).some(function (result) { return result; }) || updated;
23
23
  this.setChangeNumber(changeNumber);
24
24
  return updated;
25
25
  };
@@ -7,7 +7,7 @@ var lang_1 = require("../../utils/lang");
7
7
  var constants_1 = require("./constants");
8
8
  var sets_1 = require("../../utils/lang/sets");
9
9
  var SplitsCacheInLocal = /** @class */ (function (_super) {
10
- (0, tslib_1.__extends)(SplitsCacheInLocal, _super);
10
+ tslib_1.__extends(SplitsCacheInLocal, _super);
11
11
  function SplitsCacheInLocal(settings, keys, storage) {
12
12
  var _this = _super.call(this) || this;
13
13
  _this.keys = keys;
@@ -15,7 +15,7 @@ var ImpressionCountsCacheInMemory = /** @class */ (function () {
15
15
  * Builds key to be stored in the cache with the featureName and the timeFrame truncated.
16
16
  */
17
17
  ImpressionCountsCacheInMemory.prototype._makeKey = function (featureName, timeFrame) {
18
- return featureName + "::" + (0, time_1.truncateTimeFrame)(timeFrame);
18
+ return "".concat(featureName, "::").concat((0, time_1.truncateTimeFrame)(timeFrame));
19
19
  };
20
20
  /**
21
21
  * Increments the quantity of impressions with the passed featureName and timeFrame.
@@ -8,7 +8,7 @@ var AbstractMySegmentsCacheSync_1 = require("../AbstractMySegmentsCacheSync");
8
8
  * Supported by all JS runtimes.
9
9
  */
10
10
  var MySegmentsCacheInMemory = /** @class */ (function (_super) {
11
- (0, tslib_1.__extends)(MySegmentsCacheInMemory, _super);
11
+ tslib_1.__extends(MySegmentsCacheInMemory, _super);
12
12
  function MySegmentsCacheInMemory() {
13
13
  var _this = _super !== null && _super.apply(this, arguments) || this;
14
14
  _this.segmentCache = {};
@@ -17,7 +17,7 @@ var RBSegmentsCacheInMemory = /** @class */ (function () {
17
17
  RBSegmentsCacheInMemory.prototype.update = function (toAdd, toRemove, changeNumber) {
18
18
  var _this = this;
19
19
  var updated = toAdd.map(function (toAdd) { return _this.add(toAdd); }).some(function (result) { return result; });
20
- updated = toRemove.map(function (toRemove) { return _this.remove(toRemove.name); }).some(function (result) { return result; }) || updated;
20
+ updated = toRemove.map(function (toRemove) { return _this.remove(toRemove); }).some(function (result) { return result; }) || updated;
21
21
  this.changeNumber = changeNumber;
22
22
  return updated;
23
23
  };
@@ -8,7 +8,7 @@ var lang_1 = require("../../utils/lang");
8
8
  * Default ISplitsCacheSync implementation that stores split definitions in memory.
9
9
  */
10
10
  var SplitsCacheInMemory = /** @class */ (function (_super) {
11
- (0, tslib_1.__extends)(SplitsCacheInMemory, _super);
11
+ tslib_1.__extends(SplitsCacheInMemory, _super);
12
12
  function SplitsCacheInMemory(splitFiltersValidation) {
13
13
  var _this = _super.call(this) || this;
14
14
  _this.splitsCache = {};
@@ -19,8 +19,8 @@ var ACCEPTANCE_RANGE = 0.001;
19
19
  * All factory instances track telemetry on server-side, and 0.1% on client-side.
20
20
  */
21
21
  function shouldRecordTelemetry(_a) {
22
- var settings = _a.settings;
23
- return settings.mode !== constants_1.LOCALHOST_MODE && ((0, key_1.checkIfServerSide)(settings) || Math.random() <= ACCEPTANCE_RANGE);
22
+ var settings = _a.settings, disableTelemetry = _a.disableTelemetry;
23
+ return !disableTelemetry && settings.mode !== constants_1.LOCALHOST_MODE && ((0, key_1.checkIfServerSide)(settings) || Math.random() <= ACCEPTANCE_RANGE);
24
24
  }
25
25
  exports.shouldRecordTelemetry = shouldRecordTelemetry;
26
26
  var TelemetryCacheInMemory = /** @class */ (function () {
@@ -19,7 +19,7 @@ var EventsCacheInRedis = /** @class */ (function () {
19
19
  // We use boolean values to signal successful queueing
20
20
  .then(function () { return true; })
21
21
  .catch(function (err) {
22
- _this.log.error(constants_1.LOG_PREFIX + "Error adding event to queue: " + err + ".");
22
+ _this.log.error("".concat(constants_1.LOG_PREFIX, "Error adding event to queue: ").concat(err, "."));
23
23
  return false;
24
24
  });
25
25
  };
@@ -6,7 +6,7 @@ var lang_1 = require("../../utils/lang");
6
6
  var ImpressionCountsCacheInMemory_1 = require("../inMemory/ImpressionCountsCacheInMemory");
7
7
  var constants_1 = require("./constants");
8
8
  var ImpressionCountsCacheInRedis = /** @class */ (function (_super) {
9
- (0, tslib_1.__extends)(ImpressionCountsCacheInRedis, _super);
9
+ tslib_1.__extends(ImpressionCountsCacheInRedis, _super);
10
10
  function ImpressionCountsCacheInRedis(log, key, redis, impressionCountsCacheSize, refreshRate) {
11
11
  if (refreshRate === void 0) { refreshRate = constants_1.REFRESH_RATE; }
12
12
  var _this = _super.call(this, impressionCountsCacheSize) || this;
@@ -35,7 +35,7 @@ var ImpressionCountsCacheInRedis = /** @class */ (function (_super) {
35
35
  }
36
36
  })
37
37
  .catch(function (err) {
38
- _this.log.error(constants_1.LOG_PREFIX + "Error in impression counts pipeline: " + err + ".");
38
+ _this.log.error("".concat(constants_1.LOG_PREFIX, "Error in impression counts pipeline: ").concat(err, "."));
39
39
  return false;
40
40
  });
41
41
  };
@@ -58,17 +58,17 @@ var ImpressionCountsCacheInRedis = /** @class */ (function (_super) {
58
58
  (0, lang_1.forOwn)(counts, function (count, key) {
59
59
  var nameAndTime = key.split('::');
60
60
  if (nameAndTime.length !== 2) {
61
- _this.log.error(constants_1.LOG_PREFIX + "Error spliting key " + key);
61
+ _this.log.error("".concat(constants_1.LOG_PREFIX, "Error spliting key ").concat(key));
62
62
  return;
63
63
  }
64
64
  var timeFrame = parseInt(nameAndTime[1]);
65
65
  if (isNaN(timeFrame)) {
66
- _this.log.error(constants_1.LOG_PREFIX + "Error parsing time frame " + nameAndTime[1]);
66
+ _this.log.error("".concat(constants_1.LOG_PREFIX, "Error parsing time frame ").concat(nameAndTime[1]));
67
67
  return;
68
68
  }
69
69
  var rawCount = parseInt(count);
70
70
  if (isNaN(rawCount)) {
71
- _this.log.error(constants_1.LOG_PREFIX + "Error parsing raw count " + count);
71
+ _this.log.error("".concat(constants_1.LOG_PREFIX, "Error parsing raw count ").concat(count));
72
72
  return;
73
73
  }
74
74
  pf.push({
@@ -14,7 +14,7 @@ var ImpressionsCacheInRedis = /** @class */ (function () {
14
14
  ImpressionsCacheInRedis.prototype.track = function (impressions) {
15
15
  var _a;
16
16
  var _this = this;
17
- return (_a = this.redis).rpush.apply(_a, (0, tslib_1.__spreadArray)([this.key], (0, utils_1.impressionsToJSON)(impressions, this.metadata), false)).then(function (queuedCount) {
17
+ return (_a = this.redis).rpush.apply(_a, tslib_1.__spreadArray([this.key], (0, utils_1.impressionsToJSON)(impressions, this.metadata), false)).then(function (queuedCount) {
18
18
  // If this is the creation of the key on Redis, set the expiration for it in 1hr.
19
19
  if (queuedCount === impressions.length) {
20
20
  return _this.redis.expire(_this.key, IMPRESSIONS_TTL_REFRESH);