@splitsoftware/splitio-commons 1.2.0 → 1.2.1-rc.10

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 (376) hide show
  1. package/cjs/evaluator/Engine.js +6 -6
  2. package/cjs/evaluator/combiners/and.js +1 -1
  3. package/cjs/evaluator/combiners/ifelseif.js +2 -2
  4. package/cjs/evaluator/condition/engineUtils.js +2 -2
  5. package/cjs/evaluator/condition/index.js +4 -4
  6. package/cjs/evaluator/index.js +5 -5
  7. package/cjs/evaluator/matchers/cont_all.js +1 -1
  8. package/cjs/evaluator/matchers/cont_any.js +1 -1
  9. package/cjs/evaluator/matchers/cont_str.js +1 -1
  10. package/cjs/evaluator/matchers/dependency.js +1 -1
  11. package/cjs/evaluator/matchers/eq_set.js +1 -1
  12. package/cjs/evaluator/matchers/ew.js +3 -3
  13. package/cjs/evaluator/matchers/part_of.js +1 -1
  14. package/cjs/evaluator/matchers/segment.js +1 -1
  15. package/cjs/evaluator/matchers/sw.js +1 -1
  16. package/cjs/evaluator/matchers/whitelist.js +1 -1
  17. package/cjs/evaluator/matchersTransform/index.js +12 -12
  18. package/cjs/evaluator/parser/index.js +6 -6
  19. package/cjs/evaluator/treatments/index.js +1 -1
  20. package/cjs/evaluator/value/index.js +1 -1
  21. package/cjs/evaluator/value/sanitize.js +4 -4
  22. package/cjs/integrations/browser.js +3 -3
  23. package/cjs/integrations/ga/GaToSplit.js +14 -14
  24. package/cjs/integrations/ga/GoogleAnalyticsToSplit.js +5 -3
  25. package/cjs/integrations/ga/SplitToGa.js +1 -1
  26. package/cjs/integrations/ga/SplitToGoogleAnalytics.js +4 -2
  27. package/cjs/listeners/browser.js +15 -11
  28. package/cjs/listeners/node.js +1 -1
  29. package/cjs/logger/constants.js +8 -3
  30. package/cjs/logger/index.js +2 -2
  31. package/cjs/logger/messages/debug.js +4 -4
  32. package/cjs/logger/messages/error.js +5 -4
  33. package/cjs/logger/messages/info.js +10 -8
  34. package/cjs/logger/messages/warn.js +1 -1
  35. package/cjs/logger/sdkLogger.js +1 -1
  36. package/cjs/readiness/readinessManager.js +2 -2
  37. package/cjs/readiness/sdkReadinessManager.js +4 -4
  38. package/cjs/sdkClient/client.js +13 -11
  39. package/cjs/sdkClient/clientAttributesDecoration.js +4 -4
  40. package/cjs/sdkClient/clientCS.js +4 -3
  41. package/cjs/sdkClient/clientInputValidation.js +20 -22
  42. package/cjs/sdkClient/sdkClient.js +3 -6
  43. package/cjs/sdkClient/sdkClientMethod.js +1 -1
  44. package/cjs/sdkClient/sdkClientMethodCS.js +6 -10
  45. package/cjs/sdkClient/sdkClientMethodCSWithTT.js +7 -15
  46. package/cjs/sdkFactory/index.js +14 -12
  47. package/cjs/sdkFactory/userConsentProps.js +37 -0
  48. package/cjs/sdkManager/index.js +11 -11
  49. package/cjs/services/splitApi.js +3 -2
  50. package/cjs/services/splitHttpClient.js +3 -3
  51. package/cjs/storages/KeyBuilder.js +2 -6
  52. package/cjs/storages/KeyBuilderCS.js +13 -3
  53. package/cjs/storages/KeyBuilderSS.js +1 -1
  54. package/cjs/storages/findLatencyIndex.js +1 -1
  55. package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +24 -4
  56. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +12 -12
  57. package/cjs/storages/inLocalStorage/index.js +4 -4
  58. package/cjs/storages/inMemory/AttributesCacheInMemory.js +1 -1
  59. package/cjs/storages/inMemory/ImpressionCountsCacheInMemory.js +1 -1
  60. package/cjs/storages/inMemory/ImpressionsCacheInMemory.js +15 -1
  61. package/cjs/storages/inMemory/InMemoryStorage.js +1 -1
  62. package/cjs/storages/inMemory/InMemoryStorageCS.js +1 -1
  63. package/cjs/storages/inMemory/LatenciesCacheInMemory.js +1 -1
  64. package/cjs/storages/inMemory/MySegmentsCacheInMemory.js +1 -1
  65. package/cjs/storages/inMemory/SegmentsCacheInMemory.js +2 -2
  66. package/cjs/storages/inMemory/SplitsCacheInMemory.js +5 -5
  67. package/cjs/storages/inRedis/LatenciesCacheInRedis.js +1 -1
  68. package/cjs/storages/inRedis/RedisAdapter.js +24 -11
  69. package/cjs/storages/inRedis/SegmentsCacheInRedis.js +1 -1
  70. package/cjs/storages/inRedis/SplitsCacheInRedis.js +3 -3
  71. package/cjs/storages/inRedis/index.js +1 -1
  72. package/cjs/storages/pluggable/SegmentsCachePluggable.js +1 -1
  73. package/cjs/storages/pluggable/SplitsCachePluggable.js +3 -3
  74. package/cjs/storages/pluggable/inMemoryWrapper.js +4 -4
  75. package/cjs/storages/pluggable/index.js +6 -6
  76. package/cjs/sync/offline/LocalhostFromFile.js +1 -1
  77. package/cjs/sync/offline/LocalhostFromObject.js +1 -1
  78. package/cjs/sync/offline/splitsParser/parseCondition.js +1 -1
  79. package/cjs/sync/offline/splitsParser/splitsParserFromFile.js +13 -13
  80. package/cjs/sync/offline/splitsParser/splitsParserFromSettings.js +3 -3
  81. package/cjs/sync/offline/syncManagerOffline.js +1 -1
  82. package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +2 -2
  83. package/cjs/sync/polling/fetchers/mySegmentsFetcher.js +2 -2
  84. package/cjs/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
  85. package/cjs/sync/polling/pollingManagerCS.js +8 -7
  86. package/cjs/sync/polling/pollingManagerSS.js +5 -4
  87. package/cjs/sync/polling/syncTasks/mySegmentsSyncTask.js +1 -1
  88. package/cjs/sync/polling/syncTasks/segmentsSyncTask.js +1 -1
  89. package/cjs/sync/polling/syncTasks/splitsSyncTask.js +1 -1
  90. package/cjs/sync/polling/updaters/mySegmentsUpdater.js +3 -3
  91. package/cjs/sync/polling/updaters/segmentChangesUpdater.js +2 -2
  92. package/cjs/sync/polling/updaters/splitChangesUpdater.js +2 -2
  93. package/cjs/sync/streaming/AuthClient/index.js +4 -5
  94. package/cjs/sync/streaming/SSEClient/index.js +2 -1
  95. package/cjs/sync/streaming/SSEHandler/NotificationParser.js +1 -1
  96. package/cjs/sync/streaming/SSEHandler/index.js +3 -3
  97. package/cjs/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +1 -1
  98. package/cjs/sync/streaming/mySegmentsV2utils.js +1 -1
  99. package/cjs/sync/streaming/pushManager.js +46 -35
  100. package/cjs/sync/submitters/eventsSyncTask.js +17 -5
  101. package/cjs/sync/submitters/impressionCountsSyncTask.js +1 -1
  102. package/cjs/sync/submitters/impressionsSyncTask.js +15 -3
  103. package/cjs/sync/submitters/metricsSyncTask.js +3 -3
  104. package/cjs/sync/submitters/submitterManager.js +6 -5
  105. package/cjs/sync/submitters/submitterSyncTask.js +1 -1
  106. package/cjs/sync/syncManagerOnline.js +21 -17
  107. package/cjs/trackers/eventTracker.js +11 -4
  108. package/cjs/trackers/impressionObserver/impressionObserverCS.js +1 -1
  109. package/cjs/trackers/impressionObserver/impressionObserverSS.js +1 -1
  110. package/cjs/trackers/impressionObserver/utils.js +8 -1
  111. package/cjs/trackers/impressionsTracker.js +9 -8
  112. package/cjs/utils/MinEvents.js +2 -1
  113. package/cjs/utils/consent.js +10 -0
  114. package/cjs/utils/constants/index.js +5 -1
  115. package/cjs/utils/inputValidation/apiKey.js +1 -1
  116. package/cjs/utils/inputValidation/attribute.js +4 -4
  117. package/cjs/utils/inputValidation/attributes.js +2 -2
  118. package/cjs/utils/inputValidation/event.js +1 -1
  119. package/cjs/utils/inputValidation/eventProperties.js +7 -5
  120. package/cjs/utils/inputValidation/eventValue.js +1 -1
  121. package/cjs/utils/inputValidation/key.js +6 -5
  122. package/cjs/utils/inputValidation/preloadedData.js +8 -8
  123. package/cjs/utils/inputValidation/split.js +1 -1
  124. package/cjs/utils/inputValidation/splits.js +2 -2
  125. package/cjs/utils/inputValidation/trafficType.js +1 -1
  126. package/cjs/utils/inputValidation/trafficTypeExistance.js +1 -1
  127. package/cjs/utils/jwt/index.js +1 -1
  128. package/cjs/utils/key/index.js +3 -3
  129. package/cjs/utils/lang/index.js +13 -16
  130. package/cjs/utils/lang/maps.js +16 -2
  131. package/cjs/utils/murmur3/common.js +1 -1
  132. package/cjs/utils/murmur3/legacy.js +44 -0
  133. package/cjs/utils/murmur3/murmur3.js +10 -10
  134. package/cjs/utils/murmur3/murmur3_128.js +1 -1
  135. package/cjs/utils/murmur3/murmur3_128_x86.js +37 -37
  136. package/cjs/utils/murmur3/murmur3_64.js +1 -1
  137. package/cjs/utils/promise/timeout.js +1 -1
  138. package/cjs/utils/settingsValidation/consent.js +16 -0
  139. package/cjs/utils/settingsValidation/impressionsMode.js +6 -6
  140. package/cjs/utils/settingsValidation/index.js +32 -14
  141. package/cjs/utils/settingsValidation/integrations/configurable.js +1 -1
  142. package/cjs/utils/settingsValidation/integrations/pluggable.js +1 -1
  143. package/cjs/utils/settingsValidation/localhost/builtin.js +2 -2
  144. package/cjs/utils/settingsValidation/logger/builtinLogger.js +3 -3
  145. package/cjs/utils/settingsValidation/logger/commons.js +1 -1
  146. package/cjs/utils/settingsValidation/logger/pluggableLogger.js +1 -1
  147. package/cjs/utils/settingsValidation/runtime.js +11 -0
  148. package/cjs/utils/settingsValidation/splitFilters.js +1 -1
  149. package/cjs/utils/settingsValidation/storage/storageCS.js +1 -1
  150. package/cjs/utils/timeTracker/index.js +3 -3
  151. package/esm/evaluator/matchers/ew.js +4 -4
  152. package/esm/integrations/ga/GoogleAnalyticsToSplit.js +4 -2
  153. package/esm/integrations/ga/SplitToGoogleAnalytics.js +4 -2
  154. package/esm/listeners/browser.js +14 -10
  155. package/esm/logger/constants.js +5 -2
  156. package/esm/logger/messages/debug.js +3 -3
  157. package/esm/logger/messages/error.js +4 -3
  158. package/esm/logger/messages/info.js +9 -7
  159. package/esm/sdkClient/client.js +4 -2
  160. package/esm/sdkClient/clientCS.js +2 -1
  161. package/esm/sdkClient/clientInputValidation.js +6 -8
  162. package/esm/sdkClient/sdkClient.js +1 -4
  163. package/esm/sdkClient/sdkClientMethodCS.js +1 -5
  164. package/esm/sdkClient/sdkClientMethodCSWithTT.js +1 -9
  165. package/esm/sdkFactory/index.js +8 -6
  166. package/esm/sdkFactory/userConsentProps.js +33 -0
  167. package/esm/services/splitApi.js +2 -1
  168. package/esm/services/splitHttpClient.js +1 -1
  169. package/esm/storages/KeyBuilder.js +2 -6
  170. package/esm/storages/KeyBuilderCS.js +11 -1
  171. package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +23 -3
  172. package/esm/storages/inLocalStorage/index.js +1 -1
  173. package/esm/storages/inMemory/ImpressionsCacheInMemory.js +15 -1
  174. package/esm/storages/inMemory/InMemoryStorage.js +1 -1
  175. package/esm/storages/inMemory/InMemoryStorageCS.js +1 -1
  176. package/esm/storages/inRedis/RedisAdapter.js +15 -2
  177. package/esm/storages/pluggable/index.js +2 -2
  178. package/esm/sync/offline/splitsParser/splitsParserFromFile.js +1 -1
  179. package/esm/sync/polling/fetchers/mySegmentsFetcher.js +2 -2
  180. package/esm/sync/polling/fetchers/segmentChangesFetcher.js +2 -2
  181. package/esm/sync/polling/pollingManagerCS.js +2 -1
  182. package/esm/sync/polling/pollingManagerSS.js +2 -1
  183. package/esm/sync/polling/syncTasks/mySegmentsSyncTask.js +1 -1
  184. package/esm/sync/polling/updaters/mySegmentsUpdater.js +2 -2
  185. package/esm/sync/streaming/AuthClient/index.js +1 -2
  186. package/esm/sync/streaming/SSEClient/index.js +2 -1
  187. package/esm/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +1 -1
  188. package/esm/sync/streaming/pushManager.js +34 -23
  189. package/esm/sync/submitters/eventsSyncTask.js +18 -6
  190. package/esm/sync/submitters/impressionsSyncTask.js +13 -1
  191. package/esm/sync/submitters/submitterManager.js +2 -1
  192. package/esm/sync/syncManagerOnline.js +21 -17
  193. package/esm/trackers/eventTracker.js +8 -1
  194. package/esm/trackers/impressionObserver/utils.js +7 -1
  195. package/esm/trackers/impressionsTracker.js +6 -5
  196. package/esm/utils/consent.js +6 -0
  197. package/esm/utils/constants/index.js +4 -0
  198. package/esm/utils/inputValidation/attributes.js +1 -1
  199. package/esm/utils/inputValidation/eventProperties.js +4 -2
  200. package/esm/utils/inputValidation/key.js +2 -1
  201. package/esm/utils/lang/index.js +12 -15
  202. package/esm/utils/lang/maps.js +14 -1
  203. package/esm/utils/murmur3/legacy.js +39 -0
  204. package/esm/utils/promise/timeout.js +1 -1
  205. package/esm/utils/settingsValidation/consent.js +12 -0
  206. package/esm/utils/settingsValidation/impressionsMode.js +7 -7
  207. package/esm/utils/settingsValidation/index.js +28 -10
  208. package/esm/utils/settingsValidation/runtime.js +7 -0
  209. package/package.json +7 -7
  210. package/src/evaluator/matchers/ew.ts +4 -4
  211. package/src/evaluator/parser/index.ts +1 -1
  212. package/src/evaluator/types.ts +2 -2
  213. package/src/evaluator/value/index.ts +2 -2
  214. package/src/evaluator/value/sanitize.ts +2 -2
  215. package/src/integrations/ga/GoogleAnalyticsToSplit.ts +7 -4
  216. package/src/integrations/ga/SplitToGoogleAnalytics.ts +7 -4
  217. package/src/integrations/pluggable.ts +2 -2
  218. package/src/integrations/types.ts +5 -0
  219. package/src/listeners/browser.ts +13 -9
  220. package/src/logger/.DS_Store +0 -0
  221. package/src/logger/constants.ts +5 -2
  222. package/src/logger/messages/debug.ts +3 -3
  223. package/src/logger/messages/error.ts +4 -3
  224. package/src/logger/messages/info.ts +9 -7
  225. package/src/logger/types.ts +4 -0
  226. package/src/sdkClient/client.ts +4 -2
  227. package/src/sdkClient/clientCS.ts +3 -1
  228. package/src/sdkClient/clientInputValidation.ts +8 -7
  229. package/src/sdkClient/sdkClient.ts +2 -5
  230. package/src/sdkClient/sdkClientMethodCS.ts +1 -6
  231. package/src/sdkClient/sdkClientMethodCSWithTT.ts +2 -11
  232. package/src/sdkFactory/index.ts +9 -7
  233. package/src/sdkFactory/types.ts +2 -1
  234. package/src/sdkFactory/userConsentProps.ts +40 -0
  235. package/src/services/splitHttpClient.ts +1 -1
  236. package/src/storages/KeyBuilder.ts +2 -6
  237. package/src/storages/KeyBuilderCS.ts +13 -1
  238. package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +23 -3
  239. package/src/storages/inLocalStorage/index.ts +1 -1
  240. package/src/storages/inMemory/ImpressionsCacheInMemory.ts +22 -1
  241. package/src/storages/inMemory/InMemoryStorage.ts +1 -1
  242. package/src/storages/inMemory/InMemoryStorageCS.ts +1 -1
  243. package/src/storages/inRedis/RedisAdapter.ts +8 -2
  244. package/src/storages/pluggable/index.ts +2 -2
  245. package/src/storages/types.ts +6 -2
  246. package/src/sync/offline/splitsParser/splitsParserFromFile.ts +1 -1
  247. package/src/sync/polling/fetchers/mySegmentsFetcher.ts +2 -1
  248. package/src/sync/polling/fetchers/types.ts +1 -0
  249. package/src/sync/polling/pollingManagerCS.ts +3 -6
  250. package/src/sync/polling/pollingManagerSS.ts +3 -8
  251. package/src/sync/polling/syncTasks/mySegmentsSyncTask.ts +2 -1
  252. package/src/sync/polling/types.ts +0 -12
  253. package/src/sync/polling/updaters/mySegmentsUpdater.ts +2 -1
  254. package/src/sync/streaming/AuthClient/index.ts +1 -2
  255. package/src/sync/streaming/SSEClient/index.ts +2 -1
  256. package/src/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.ts +1 -1
  257. package/src/sync/streaming/pushManager.ts +39 -37
  258. package/src/sync/streaming/types.ts +5 -25
  259. package/src/sync/submitters/eventsSyncTask.ts +19 -6
  260. package/src/sync/submitters/impressionsSyncTask.ts +16 -1
  261. package/src/sync/submitters/submitterManager.ts +4 -8
  262. package/src/sync/syncManagerOnline.ts +27 -27
  263. package/src/sync/types.ts +4 -1
  264. package/src/trackers/eventTracker.ts +11 -3
  265. package/src/trackers/impressionObserver/utils.ts +8 -1
  266. package/src/trackers/impressionsTracker.ts +7 -8
  267. package/src/types.ts +26 -1
  268. package/src/utils/consent.ts +8 -0
  269. package/src/utils/constants/index.ts +5 -0
  270. package/src/utils/inputValidation/attributes.ts +1 -2
  271. package/src/utils/inputValidation/eventProperties.ts +4 -2
  272. package/src/utils/lang/index.ts +15 -18
  273. package/src/utils/lang/maps.ts +15 -1
  274. package/src/utils/murmur3/legacy.ts +48 -0
  275. package/src/utils/promise/timeout.ts +1 -1
  276. package/src/utils/settingsValidation/consent.ts +16 -0
  277. package/src/utils/settingsValidation/impressionsMode.ts +8 -8
  278. package/src/utils/settingsValidation/index.ts +29 -10
  279. package/src/utils/settingsValidation/runtime.ts +9 -0
  280. package/src/utils/settingsValidation/types.ts +12 -6
  281. package/types/evaluator/types.d.ts +2 -2
  282. package/types/evaluator/value/index.d.ts +1 -1
  283. package/types/evaluator/value/sanitize.d.ts +1 -1
  284. package/types/integrations/ga/GaToSplitPlugin.d.ts +3 -0
  285. package/types/integrations/ga/GoogleAnalyticsToSplit.d.ts +2 -2
  286. package/types/integrations/ga/SplitToGaPlugin.d.ts +4 -0
  287. package/types/integrations/ga/SplitToGoogleAnalytics.d.ts +2 -3
  288. package/types/integrations/types.d.ts +4 -0
  289. package/types/logger/browser/{DebugLogger.d.ts → debugLogger.d.ts} +0 -0
  290. package/types/logger/browser/{ErrorLogger.d.ts → errorLogger.d.ts} +0 -0
  291. package/types/logger/browser/{InfoLogger.d.ts → infoLogger.d.ts} +0 -0
  292. package/types/logger/browser/{WarnLogger.d.ts → warnLogger.d.ts} +0 -0
  293. package/types/logger/codes.d.ts +2 -0
  294. package/types/logger/codesConstants.d.ts +117 -0
  295. package/types/logger/codesConstantsBrowser.d.ts +2 -0
  296. package/types/logger/codesConstantsNode.d.ts +14 -0
  297. package/types/logger/codesDebug.d.ts +1 -0
  298. package/types/logger/codesDebugBrowser.d.ts +1 -0
  299. package/types/logger/codesDebugNode.d.ts +1 -0
  300. package/types/logger/codesError.d.ts +1 -0
  301. package/types/logger/codesErrorNode.d.ts +1 -0
  302. package/types/logger/codesInfo.d.ts +1 -0
  303. package/types/logger/codesWarn.d.ts +1 -0
  304. package/types/logger/codesWarnNode.d.ts +1 -0
  305. package/types/logger/constants.d.ts +5 -2
  306. package/types/logger/debugLogger.d.ts +2 -0
  307. package/types/logger/errorLogger.d.ts +2 -0
  308. package/types/logger/infoLogger.d.ts +2 -0
  309. package/types/logger/messages/debugBrowser.d.ts +1 -0
  310. package/types/logger/messages/debugNode.d.ts +1 -0
  311. package/types/logger/messages/errorNode.d.ts +1 -0
  312. package/types/logger/messages/warnNode.d.ts +1 -0
  313. package/types/logger/noopLogger.d.ts +2 -0
  314. package/types/logger/types.d.ts +4 -0
  315. package/types/logger/warnLogger.d.ts +2 -0
  316. package/types/sdkClient/clientAttributesDecoration.d.ts +1 -1
  317. package/types/sdkClient/clientInputValidation.d.ts +2 -3
  318. package/types/sdkFactory/types.d.ts +1 -1
  319. package/types/sdkFactory/userConsentProps.d.ts +6 -0
  320. package/types/sdkManager/sdkManagerMethod.d.ts +6 -0
  321. package/types/storages/KeyBuilderCS.d.ts +2 -0
  322. package/types/storages/getRegisteredSegments.d.ts +10 -0
  323. package/types/storages/inMemory/ImpressionsCacheInMemory.d.ts +9 -0
  324. package/types/storages/inMemory/TelemetryCacheInMemory.d.ts +51 -0
  325. package/types/storages/inMemory/index.d.ts +10 -0
  326. package/types/storages/inRedis/RedisAdapter.d.ts +1 -1
  327. package/types/storages/inRedis/TelemetryCacheInRedis.d.ts +0 -0
  328. package/types/storages/parseSegments.d.ts +6 -0
  329. package/types/storages/pluggable/TelemetryCachePluggable.d.ts +2 -0
  330. package/types/storages/types.d.ts +3 -1
  331. package/types/sync/polling/fetchers/mySegmentsFetcher.d.ts +1 -1
  332. package/types/sync/polling/fetchers/types.d.ts +1 -1
  333. package/types/sync/polling/pollingManagerCS.d.ts +2 -5
  334. package/types/sync/polling/pollingManagerSS.d.ts +2 -5
  335. package/types/sync/polling/syncTasks/splitsSyncTask.copy.d.ts +35 -0
  336. package/types/sync/polling/syncTasks/splitsSyncTask.morelikeoriginal.d.ts +35 -0
  337. package/types/sync/polling/types.d.ts +0 -11
  338. package/types/sync/polling/updaters/mySegmentsUpdater.d.ts +1 -1
  339. package/types/sync/streaming/AuthClient/indexV1.d.ts +12 -0
  340. package/types/sync/streaming/AuthClient/indexV2.d.ts +8 -0
  341. package/types/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.d.ts +1 -1
  342. package/types/sync/streaming/pushManager.d.ts +3 -7
  343. package/types/sync/streaming/pushManagerCS.d.ts +1 -0
  344. package/types/sync/streaming/pushManagerNoUsers.d.ts +13 -0
  345. package/types/sync/streaming/pushManagerSS.d.ts +1 -0
  346. package/types/sync/streaming/types.d.ts +3 -23
  347. package/types/sync/submitters/submitterManager.d.ts +2 -4
  348. package/types/sync/submitters/telemetrySyncTask.d.ts +17 -0
  349. package/types/sync/syncManagerFromFile.d.ts +2 -0
  350. package/types/sync/syncManagerFromObject.d.ts +2 -0
  351. package/types/sync/syncManagerOffline.d.ts +9 -0
  352. package/types/sync/syncManagerOnline.d.ts +3 -3
  353. package/types/sync/types.d.ts +3 -0
  354. package/types/trackers/eventTracker.d.ts +2 -2
  355. package/types/trackers/impressionObserver/utils.d.ts +4 -0
  356. package/types/trackers/impressionsTracker.d.ts +2 -3
  357. package/types/trackers/telemetryRecorder.d.ts +0 -0
  358. package/types/types.d.ts +22 -0
  359. package/types/utils/EventEmitter.d.ts +4 -0
  360. package/types/utils/consent.d.ts +2 -0
  361. package/types/utils/constants/index.d.ts +3 -0
  362. package/types/utils/lang/errors.d.ts +10 -0
  363. package/types/utils/lang/index.d.ts +6 -5
  364. package/types/utils/lang/maps.d.ts +7 -0
  365. package/types/utils/murmur3/commons.d.ts +12 -0
  366. package/types/utils/murmur3/legacy.d.ts +2 -0
  367. package/types/utils/settingsValidation/buildMetadata.d.ts +3 -0
  368. package/types/utils/settingsValidation/consent.d.ts +6 -0
  369. package/types/utils/settingsValidation/impressionsMode.d.ts +1 -1
  370. package/types/utils/settingsValidation/localhost/index.d.ts +9 -0
  371. package/types/utils/settingsValidation/logger.d.ts +11 -0
  372. package/types/utils/settingsValidation/runtime/browser.d.ts +2 -0
  373. package/types/utils/settingsValidation/runtime/node.d.ts +2 -0
  374. package/types/utils/settingsValidation/runtime.d.ts +2 -0
  375. package/types/utils/settingsValidation/types.d.ts +12 -6
  376. package/types/utils/settingsValidation/userConsent.d.ts +5 -0
@@ -0,0 +1 @@
1
+ export declare const codesErrorNode: [number, string][];
@@ -0,0 +1 @@
1
+ export declare const codesWarnNode: [number, string][];
@@ -0,0 +1,2 @@
1
+ import { ILogger } from './types';
2
+ export declare const noopLogger: ILogger;
@@ -6,8 +6,12 @@ export interface ILoggerOptions {
6
6
  }
7
7
  export interface ILogger {
8
8
  setLogLevel(logLevel: LogLevel): void;
9
+ debug(msg: any): void;
9
10
  debug(msg: string | number, args?: any[]): void;
11
+ info(msg: any): void;
10
12
  info(msg: string | number, args?: any[]): void;
13
+ warn(msg: any): void;
11
14
  warn(msg: string | number, args?: any[]): void;
15
+ error(msg: any): void;
12
16
  error(msg: string | number, args?: any[]): void;
13
17
  }
@@ -0,0 +1,2 @@
1
+ import { Logger } from '.';
2
+ export declare const warnLogger: Logger;
@@ -8,7 +8,7 @@ export declare function clientAttributesDecoration<TClient extends SplitIO.IClie
8
8
  getTreatmentWithConfig: (maybeKey: SplitIO.SplitKey, maybeSplit: string, maybeAttributes?: SplitIO.Attributes | undefined) => SplitIO.TreatmentWithConfig | SplitIO.AsyncTreatmentWithConfig;
9
9
  getTreatments: (maybeKey: SplitIO.SplitKey, maybeSplits: string[], maybeAttributes?: SplitIO.Attributes | undefined) => SplitIO.Treatments | SplitIO.AsyncTreatments;
10
10
  getTreatmentsWithConfig: (maybeKey: SplitIO.SplitKey, maybeSplits: string[], maybeAttributes?: SplitIO.Attributes | undefined) => SplitIO.TreatmentsWithConfig | SplitIO.AsyncTreatmentsWithConfig;
11
- track: (maybeKey: SplitIO.SplitKey, maybeTT: string, maybeEvent: string, maybeEventValue?: number | undefined, maybeProperties?: SplitIO.Properties | undefined) => import("../dtos/types").MaybeThenable<boolean>;
11
+ track: (maybeKey: SplitIO.SplitKey, maybeTT: string, maybeEvent: string, maybeEventValue?: number | undefined, maybeProperties?: SplitIO.Properties | undefined) => boolean | Promise<boolean>;
12
12
  /**
13
13
  * Add an attribute to client's in memory attributes storage
14
14
  *
@@ -1,8 +1,7 @@
1
1
  import { IReadinessManager } from '../readiness/types';
2
- import { SplitIO } from '../types';
3
- import { ILogger } from '../logger/types';
2
+ import { ISettings, SplitIO } from '../types';
4
3
  /**
5
4
  * Decorator that validates the input before actually executing the client methods.
6
5
  * We should "guard" the client here, while not polluting the "real" implementation of those methods.
7
6
  */
8
- export declare function clientInputValidationDecorator<TClient extends SplitIO.IClient | SplitIO.IAsyncClient>(log: ILogger, client: TClient, readinessManager: IReadinessManager, isStorageSync?: boolean): TClient;
7
+ export declare function clientInputValidationDecorator<TClient extends SplitIO.IClient | SplitIO.IAsyncClient>(settings: ISettings, client: TClient, readinessManager: IReadinessManager): TClient;
@@ -36,7 +36,7 @@ export interface ISdkFactoryParams {
36
36
  settings: ISettings, // Used by BrowserSignalListener
37
37
  storage: IStorageSync | IStorageAsync, // Used by BrowserSignalListener
38
38
  serviceApi: ISplitApi | undefined) => ISignalListener;
39
- impressionListener?: SplitIO.IImpressionListener;
40
39
  integrationsManagerFactory?: (params: IIntegrationFactoryParams) => IIntegrationManager | undefined;
41
40
  impressionsObserverFactory?: () => IImpressionObserver;
41
+ extraProps?: (settings: ISettings, syncManager?: ISyncManager) => object;
42
42
  }
@@ -0,0 +1,6 @@
1
+ import { ISyncManager } from '../sync/types';
2
+ import { ISettings } from '../types';
3
+ export declare function userConsentProps(settings: ISettings, syncManager?: ISyncManager): {
4
+ setUserConsent(consent: unknown): boolean;
5
+ getUserConsent(): import("../types").ConsentStatus | undefined;
6
+ };
@@ -0,0 +1,6 @@
1
+ import { ISdkClientFactoryParams } from '../sdkClient/types';
2
+ import { SplitIO } from '../types';
3
+ /**
4
+ * Factory of client method for server-side SDKs (ISDK and IAsyncSDK)
5
+ */
6
+ export declare function sdkManagerMethodFactory(params: ISdkClientFactoryParams): () => SplitIO.IManager | SplitIO.IAsyncManager;
@@ -8,6 +8,8 @@ export declare class KeyBuilderCS extends KeyBuilder {
8
8
  */
9
9
  buildSegmentNameKey(segmentName: string): string;
10
10
  extractSegmentName(builtSegmentKeyName: string): string | undefined;
11
+ buildOldSegmentNameKey(segmentName: string): string;
12
+ extractOldSegmentKey(builtSegmentKeyName: string): string | undefined;
11
13
  buildLastUpdatedKey(): string;
12
14
  isSplitsCacheKey(key: string): boolean;
13
15
  buildSplitsFilterQueryKey(): string;
@@ -0,0 +1,10 @@
1
+ import { ISplit } from '../dtos/types';
2
+ /**
3
+ * Collect segments from a raw split definition.
4
+ * Exported for testing purposes.
5
+ */
6
+ export declare function _parseSegments({ conditions }: ISplit): import("../utils/lang/sets").ISet<string>;
7
+ /**
8
+ * Computes the set of segments used by splits.
9
+ */
10
+ export declare function getRegisteredSegments(splitDefs: string[]): string[];
@@ -1,7 +1,16 @@
1
1
  import { IImpressionsCacheSync } from '../types';
2
2
  import { ImpressionDTO } from '../../types';
3
3
  export declare class ImpressionsCacheInMemory implements IImpressionsCacheSync {
4
+ private onFullQueue?;
5
+ private readonly maxQueue;
4
6
  private queue;
7
+ /**
8
+ *
9
+ * @param impressionsQueueSize number of queued impressions to call onFullQueueCb.
10
+ * Default value is 0, that means no maximum value, in case we want to avoid this being triggered.
11
+ */
12
+ constructor(impressionsQueueSize?: number);
13
+ setOnFullQueueCb(cb: () => void): void;
5
14
  /**
6
15
  * Store impressions in sequential order
7
16
  */
@@ -0,0 +1,51 @@
1
+ import { ImpressionDataType, EventDataType, StreamingEvent, Method, OperationType } from '../../sync/submitters/types';
2
+ import { TelemetryCacheSync } from '../types';
3
+ export declare class TelemetryCacheInMemory implements TelemetryCacheSync {
4
+ private timeUntilReady?;
5
+ getTimeUntilReady(): number | undefined;
6
+ recordTimeUntilReady(ms: number): void;
7
+ private timeUntilReadyFromCache?;
8
+ getTimeUntilReadyFromCache(): number | undefined;
9
+ recordTimeUntilReadyFromCache(ms: number): void;
10
+ private notReadyUsage;
11
+ getNonReadyUsage(): number;
12
+ recordNonReadyUsage(): void;
13
+ private impressionStats;
14
+ getImpressionStats(type: ImpressionDataType): number;
15
+ recordImpressionStats(type: ImpressionDataType, count: number): void;
16
+ private eventStats;
17
+ getEventStats(type: EventDataType): number;
18
+ recordEventStats(type: EventDataType, count: number): void;
19
+ private lastSync;
20
+ getLastSynchronization(): Record<OperationType, number | undefined>;
21
+ recordSuccessfulSync(resource: OperationType, timeMs: number): void;
22
+ private httpErrors;
23
+ popHttpErrors(): Record<OperationType, {
24
+ [statusCode: string]: number;
25
+ }>;
26
+ recordSyncError(resource: OperationType, status: number): void;
27
+ private httpLatencies;
28
+ popHttpLatencies(): Record<OperationType, number[]>;
29
+ recordSyncLatency(resource: OperationType, latencyMs: number): void;
30
+ private authRejections;
31
+ popAuthRejections(): number;
32
+ recordAuthRejections(): void;
33
+ private tokenRefreshes;
34
+ popTokenRefreshes(): number;
35
+ recordTokenRefreshes(): void;
36
+ private streamingEvents;
37
+ popStreamingEvents(): StreamingEvent[];
38
+ recordStreamingEvents(streamingEvent: StreamingEvent): void;
39
+ private tags;
40
+ popTags(): string[];
41
+ addTag(tag: string): void;
42
+ private sessionLength?;
43
+ getSessionLength(): number | undefined;
44
+ recordSessionLength(ms: number): void;
45
+ private exceptions;
46
+ popExceptions(): Record<Method, number>;
47
+ recordException(method: Method): void;
48
+ private latencies;
49
+ popLatencies(): Record<Method, number[]>;
50
+ recordLatency(method: Method, latencyMs: number): void;
51
+ }
@@ -0,0 +1,10 @@
1
+ import { IStorageFactoryParams, IStorageSync } from '../types';
2
+ /**
3
+ * InMemory storage factory for standalone server-side SplitFactory
4
+ *
5
+ * @param params parameters required by EventsCacheSync
6
+ */
7
+ export declare function InMemoryStorageFactory(params: IStorageFactoryParams): IStorageSync;
8
+ export declare namespace InMemoryStorageFactory {
9
+ var type: import("../types").StorageType;
10
+ }
@@ -20,5 +20,5 @@ export declare class RedisAdapter extends ioredis {
20
20
  /**
21
21
  * Parses the options into what we care about.
22
22
  */
23
- static _defineOptions({ connectionTimeout, operationTimeout, url, host, port, db, pass }: Record<string, any>): object;
23
+ static _defineOptions({ connectionTimeout, operationTimeout, url, host, port, db, pass, tls }: Record<string, any>): object;
24
24
  }
@@ -0,0 +1,6 @@
1
+ import { ISplit } from '../dtos/types';
2
+ import { ISet } from '../utils/lang/sets';
3
+ /**
4
+ * Collect segments from a list of splits.
5
+ */
6
+ export declare function parseSegments(splits: ISplit[]): ISet<string>;
@@ -0,0 +1,2 @@
1
+ export declare class TelemetryCachePluggable {
2
+ }
@@ -269,6 +269,7 @@ export interface IRecorderCacheProducerSync<T> {
269
269
  }
270
270
  export interface IImpressionsCacheSync extends IImpressionsCacheBase, IRecorderCacheProducerSync<ImpressionDTO[]> {
271
271
  track(data: ImpressionDTO[]): void;
272
+ setOnFullQueueCb(cb: () => void): void;
272
273
  }
273
274
  export interface IEventsCacheSync extends IEventsCacheBase, IRecorderCacheProducerSync<SplitIO.EventData[]> {
274
275
  track(data: SplitIO.EventData, size?: number): boolean;
@@ -335,6 +336,7 @@ export declare type IStorageAsync = IStorageBase<ISplitsCacheAsync, ISegmentsCac
335
336
  export declare type DataLoader = (storage: IStorageSync, matchingKey: string) => void;
336
337
  export interface IStorageFactoryParams {
337
338
  log: ILogger;
339
+ impressionsQueueSize?: number;
338
340
  eventsQueueSize?: number;
339
341
  optimize?: boolean;
340
342
  matchingKey?: string;
@@ -345,7 +347,7 @@ export interface IStorageFactoryParams {
345
347
  }
346
348
  export declare type StorageType = 'MEMORY' | 'LOCALSTORAGE' | 'REDIS' | 'PLUGGABLE';
347
349
  export declare type IStorageSyncFactory = {
348
- type: StorageType;
350
+ readonly type: StorageType;
349
351
  (params: IStorageFactoryParams): IStorageSync;
350
352
  };
351
353
  export declare type IStorageAsyncFactory = {
@@ -4,4 +4,4 @@ import { IMySegmentsFetcher } from './types';
4
4
  * Factory of MySegments fetcher.
5
5
  * MySegments fetcher is a wrapper around `mySegments` API service that parses the response and handle errors.
6
6
  */
7
- export declare function mySegmentsFetcherFactory(fetchMySegments: IFetchMySegments, userMatchingKey: string): IMySegmentsFetcher;
7
+ export declare function mySegmentsFetcherFactory(fetchMySegments: IFetchMySegments): IMySegmentsFetcher;
@@ -2,4 +2,4 @@ import { ISplitChangesResponse, ISegmentChangesResponse } from '../../../dtos/ty
2
2
  import { IResponse } from '../../../services/types';
3
3
  export declare type ISplitChangesFetcher = (since: number, noCache?: boolean, decorator?: (promise: Promise<IResponse>) => Promise<IResponse>) => Promise<ISplitChangesResponse>;
4
4
  export declare type ISegmentChangesFetcher = (since: number, segmentName: string, noCache?: boolean, decorator?: (promise: Promise<ISegmentChangesResponse[]>) => Promise<ISegmentChangesResponse[]>) => Promise<ISegmentChangesResponse[]>;
5
- export declare type IMySegmentsFetcher = (noCache?: boolean, decorator?: (promise: Promise<IResponse>) => Promise<IResponse>) => Promise<string[]>;
5
+ export declare type IMySegmentsFetcher = (userMatchingKey: string, noCache?: boolean, decorator?: (promise: Promise<IResponse>) => Promise<IResponse>) => Promise<string[]>;
@@ -1,10 +1,7 @@
1
1
  import { IPollingManagerCS } from './types';
2
- import { IReadinessManager } from '../../readiness/types';
3
- import { ISplitApi } from '../../services/types';
4
- import { IStorageSync } from '../../storages/types';
5
- import { ISettings } from '../../types';
2
+ import { ISyncManagerFactoryParams } from '../types';
6
3
  /**
7
4
  * Expose start / stop mechanism for polling data from services.
8
5
  * For client-side API with multiple clients.
9
6
  */
10
- export declare function pollingManagerCSFactory(splitApi: ISplitApi, storage: IStorageSync, readiness: IReadinessManager, settings: ISettings): IPollingManagerCS;
7
+ export declare function pollingManagerCSFactory(params: ISyncManagerFactoryParams): IPollingManagerCS;
@@ -1,9 +1,6 @@
1
- import { IStorageSync } from '../../storages/types';
2
- import { IReadinessManager } from '../../readiness/types';
3
- import { ISplitApi } from '../../services/types';
4
- import { ISettings } from '../../types';
5
1
  import { IPollingManager } from './types';
2
+ import { ISyncManagerFactoryParams } from '../types';
6
3
  /**
7
4
  * Expose start / stop mechanism for pulling data from services.
8
5
  */
9
- export declare function pollingManagerSSFactory(splitApi: ISplitApi, storage: IStorageSync, readiness: IReadinessManager, settings: ISettings): IPollingManager;
6
+ export declare function pollingManagerSSFactory(params: ISyncManagerFactoryParams): IPollingManager;
@@ -0,0 +1,35 @@
1
+ import { ISet } from '../../../utils/lang/sets';
2
+ import { ISegmentsCacheSync, ISplitsCacheSync, IStorageSync } from '../../../storages/types';
3
+ import { ISplitChangesFetcher } from '../fetchers/types';
4
+ import { ISplit } from '../../../dtos/types';
5
+ import { IReadinessManager, ISplitsEventEmitter } from '../../../readiness/types';
6
+ import { ISplitsSyncTask } from '../types';
7
+ import { IFetchSplitChanges } from '../../../services/types';
8
+ import { ISettings } from '../../../types';
9
+ declare type ISplitChangesUpdater = (noCache?: boolean) => Promise<boolean>;
10
+ /**
11
+ * Collect segments from a raw split definition.
12
+ * Exported for testing purposes.
13
+ */
14
+ export declare function parseSegments({ conditions }: ISplit): ISet<string>;
15
+ interface ISplitMutations {
16
+ added: [string, string][];
17
+ removed: string[];
18
+ segments: string[];
19
+ }
20
+ /**
21
+ * Given the list of splits from /splitChanges endpoint, it returns the mutations,
22
+ * i.e., an object with added splits, removed splits and used segments.
23
+ * Exported for testing purposes.
24
+ */
25
+ export declare function computeSplitsMutation(entries: ISplit[]): ISplitMutations;
26
+ /**
27
+ * factory of SplitChanges updater (a.k.a, SplitsSyncTask), a task that:
28
+ * - fetches split changes using `splitChangesFetcher`
29
+ * - updates `splitsCache`
30
+ * - uses `splitsEventEmitter` to emit events related to split data updates
31
+ * Exported for testing purposes.
32
+ */
33
+ export declare function splitChangesUpdaterFactory(splitChangesFetcher: ISplitChangesFetcher, splitsCache: ISplitsCacheSync, segmentsCache: ISegmentsCacheSync, splitsEventEmitter: ISplitsEventEmitter, requestTimeoutBeforeReady: number, retriesOnFailureBeforeReady: number): ISplitChangesUpdater;
34
+ export default function splitsSyncTaskFactory(fetchSplitChanges: IFetchSplitChanges, storage: IStorageSync, readiness: IReadinessManager, settings: ISettings): ISplitsSyncTask;
35
+ export {};
@@ -0,0 +1,35 @@
1
+ import { ISet } from '../../../utils/lang/sets';
2
+ import { ISegmentsCacheSync, ISplitsCacheSync, IStorageSync } from '../../../storages/types';
3
+ import { ISplitChangesFetcher } from '../fetchers/types';
4
+ import { ISplit } from '../../../dtos/types';
5
+ import { IReadinessManager, ISplitsEventEmitter } from '../../../readiness/types';
6
+ import { ISplitsSyncTask } from '../types';
7
+ import { IFetchSplitChanges } from '../../../services/types';
8
+ import { ISettings } from '../../../types';
9
+ declare type ISplitChangesUpdater = (noCache?: boolean) => Promise<boolean>;
10
+ /**
11
+ * Collect segments from a raw split definition.
12
+ * Exported for testing purposes.
13
+ */
14
+ export declare function parseSegments({ conditions }: ISplit): ISet<string>;
15
+ interface ISplitMutations {
16
+ added: [string, string][];
17
+ removed: string[];
18
+ segments: string[];
19
+ }
20
+ /**
21
+ * Given the list of splits from /splitChanges endpoint, it returns the mutations,
22
+ * i.e., an object with added splits, removed splits and used segments.
23
+ * Exported for testing purposes.
24
+ */
25
+ export declare function computeSplitsMutation(entries: ISplit[]): ISplitMutations;
26
+ /**
27
+ * factory of SplitChanges updater (a.k.a, SplitsSyncTask), a task that:
28
+ * - fetches split changes using `splitChangesFetcher`
29
+ * - updates `splitsCache`
30
+ * - uses `splitsEventEmitter` to emit events related to split data updates
31
+ * Exported for testing purposes.
32
+ */
33
+ export declare function splitChangesUpdaterFactory(splitChangesFetcher: ISplitChangesFetcher, splitsCache: ISplitsCacheSync, segmentsCache: ISegmentsCacheSync, splitsEventEmitter: ISplitsEventEmitter, requestTimeoutBeforeReady: number, retriesOnFailureBeforeReady: number): ISplitChangesUpdater;
34
+ export default function splitsSyncTaskFactory(fetchSplitChanges: IFetchSplitChanges, storage: IStorageSync, readiness: IReadinessManager, settings: ISettings): ISplitsSyncTask;
35
+ export {};
@@ -1,7 +1,5 @@
1
1
  import { IReadinessManager } from '../../readiness/types';
2
- import { ISplitApi } from '../../services/types';
3
2
  import { IStorageSync } from '../../storages/types';
4
- import { ISettings } from '../../types';
5
3
  import { SegmentsData } from '../streaming/SSEHandler/types';
6
4
  import { ITask, ISyncTask } from '../types';
7
5
  export interface ISplitsSyncTask extends ISyncTask<[noCache?: boolean], boolean> {
@@ -21,12 +19,3 @@ export interface IPollingManagerCS extends IPollingManager {
21
19
  remove(matchingKey: string): void;
22
20
  get(matchingKey: string): ISegmentsSyncTask | undefined;
23
21
  }
24
- /**
25
- * Signature of polling manager factory/constructor
26
- */
27
- export declare type IPollingManagerFactoryParams = [
28
- splitApi: ISplitApi,
29
- storage: IStorageSync,
30
- readiness: IReadinessManager,
31
- settings: ISettings
32
- ];
@@ -9,5 +9,5 @@ declare type IMySegmentsUpdater = (segmentList?: string[], noCache?: boolean) =>
9
9
  * - updates `mySegmentsCache`
10
10
  * - uses `segmentsEventEmitter` to emit events related to segments data updates
11
11
  */
12
- export declare function mySegmentsUpdaterFactory(log: ILogger, mySegmentsFetcher: IMySegmentsFetcher, splitsCache: ISplitsCacheSync, mySegmentsCache: ISegmentsCacheSync, segmentsEventEmitter: ISegmentsEventEmitter, requestTimeoutBeforeReady: number, retriesOnFailureBeforeReady: number): IMySegmentsUpdater;
12
+ export declare function mySegmentsUpdaterFactory(log: ILogger, mySegmentsFetcher: IMySegmentsFetcher, splitsCache: ISplitsCacheSync, mySegmentsCache: ISegmentsCacheSync, segmentsEventEmitter: ISegmentsEventEmitter, requestTimeoutBeforeReady: number, retriesOnFailureBeforeReady: number, matchingKey: string): IMySegmentsUpdater;
13
13
  export {};
@@ -0,0 +1,12 @@
1
+ import { IFetchAuth } from '../../../services/types';
2
+ import { IAuthenticate } from './types';
3
+ /**
4
+ * Factory of authentication function.
5
+ *
6
+ * @param fetchAuth `SplitAPI.fetchAuth` endpoint
7
+ */
8
+ export declare function authenticateFactory(fetchAuth: IFetchAuth): IAuthenticate;
9
+ /**
10
+ * Returns the hash of a given user key
11
+ */
12
+ export declare function hashUserKey(userKey: string): string;
@@ -0,0 +1,8 @@
1
+ import { IFetchAuthV2 } from '../../../services/types';
2
+ import { IAuthenticateV2 } from './types';
3
+ /**
4
+ * Factory of authentication function.
5
+ *
6
+ * @param fetchAuth `SplitAPI.fetchAuth` endpoint
7
+ */
8
+ export declare function authenticateFactory(fetchAuthV2: IFetchAuthV2): IAuthenticateV2;
@@ -16,7 +16,7 @@ export declare class SegmentsUpdateWorker implements IUpdateWorker {
16
16
  * @param {Object} segmentsCache segments data cache
17
17
  * @param {Object} segmentsSyncTask task for syncing segments data
18
18
  */
19
- constructor(segmentsCache: ISegmentsCacheSync, segmentsSyncTask: ISegmentsSyncTask);
19
+ constructor(segmentsSyncTask: ISegmentsSyncTask, segmentsCache: ISegmentsCacheSync);
20
20
  __handleSegmentUpdateCall(): void;
21
21
  /**
22
22
  * Invoked by NotificationProcessor on SEGMENT_UPDATE event
@@ -1,13 +1,9 @@
1
- import { IPushManagerCS } from './types';
2
- import { IStorageSync } from '../../storages/types';
3
- import { IReadinessManager } from '../../readiness/types';
1
+ import { IPushManager } from './types';
4
2
  import { IPollingManager } from '../polling/types';
5
- import { IFetchAuth } from '../../services/types';
6
- import { ISettings } from '../../types';
7
- import { IPlatform } from '../../sdkFactory/types';
3
+ import { ISyncManagerFactoryParams } from '../types';
8
4
  /**
9
5
  * PushManager factory:
10
6
  * - for server-side if key is not provided in settings.
11
7
  * - for client-side, with support for multiple clients, if key is provided in settings
12
8
  */
13
- export declare function pushManagerFactory(pollingManager: IPollingManager, storage: IStorageSync, readiness: IReadinessManager, fetchAuth: IFetchAuth, platform: IPlatform, settings: ISettings): IPushManagerCS | undefined;
9
+ export declare function pushManagerFactory(params: ISyncManagerFactoryParams, pollingManager: IPollingManager): IPushManager | undefined;
@@ -0,0 +1 @@
1
+ export declare const pushManagerCSFactory: (params: import("../types").ISyncManagerFactoryParams, pollingManager: import("../polling/types").IPollingManager) => import("./types").IPushManager | undefined;
@@ -0,0 +1,13 @@
1
+ import { IPushManagerCS } from './types';
2
+ import { IStorageSync } from '../../storages/types';
3
+ import { IReadinessManager } from '../../readiness/types';
4
+ import { IPollingManager } from '../polling/types';
5
+ import { IFetchAuthV2 } from '../../services/types';
6
+ import { ISettings } from '../../types';
7
+ import { IPlatform } from '../../sdkFactory/types';
8
+ /**
9
+ * PushManager factory:
10
+ * - for server-side if key is not provided in settings.
11
+ * - for client-side, with support for multiple clients, if key is provided in settings
12
+ */
13
+ export default function pushManagerFactory(pollingManager: IPollingManager, storage: IStorageSync, readiness: IReadinessManager, fetchAuthV2: IFetchAuthV2, platform: IPlatform, settings: ISettings): IPushManagerCS | undefined;
@@ -0,0 +1 @@
1
+ export declare const pushManagerSSFactory: (params: import("../types").ISyncManagerFactoryParams, pollingManager: import("../polling/types").IPollingManager) => import("./types").IPushManager | undefined;
@@ -1,11 +1,7 @@
1
1
  import { IMySegmentsUpdateData, IMySegmentsUpdateV2Data, ISegmentUpdateData, ISplitUpdateData, ISplitKillData } from './SSEHandler/types';
2
2
  import { ITask } from '../types';
3
- import { IPollingManager, ISegmentsSyncTask } from '../polling/types';
4
- import { IReadinessManager } from '../../readiness/types';
5
- import { IFetchAuth } from '../../services/types';
6
- import { IStorageSync } from '../../storages/types';
7
- import { IEventEmitter, ISettings } from '../../types';
8
- import { IPlatform } from '../../sdkFactory/types';
3
+ import { ISegmentsSyncTask } from '../polling/types';
4
+ import { IEventEmitter } from '../../types';
9
5
  import { ControlType } from './constants';
10
6
  export declare type PUSH_SUBSYSTEM_UP = 'PUSH_SUBSYSTEM_UP';
11
7
  export declare type PUSH_SUBSYSTEM_DOWN = 'PUSH_SUBSYSTEM_DOWN';
@@ -30,26 +26,10 @@ export interface IPushEventEmitter extends IEventEmitter {
30
26
  emit<T extends IPushEvent>(event: T, parsedData?: IParsedData<T>, channel?: T extends MY_SEGMENTS_UPDATE ? string : undefined): boolean;
31
27
  }
32
28
  /**
33
- * PushManager for server-side
29
+ * PushManager
34
30
  */
35
31
  export interface IPushManager extends ITask, IPushEventEmitter {
36
- }
37
- /**
38
- * PushManager for client-side with support for multiple clients
39
- */
40
- export interface IPushManagerCS extends IPushManager {
41
32
  add(userKey: string, mySegmentsSyncTask: ISegmentsSyncTask): void;
42
33
  remove(userKey: string): void;
43
34
  }
44
- /**
45
- * Signature of push manager factory/constructor
46
- */
47
- export declare type IPushManagerFactoryParams = [
48
- pollingManager: IPollingManager,
49
- storage: IStorageSync,
50
- readiness: IReadinessManager,
51
- fetchAuth: IFetchAuth,
52
- platform: IPlatform,
53
- settings: ISettings
54
- ];
55
35
  export {};
@@ -1,4 +1,2 @@
1
- import { ISplitApi } from '../../services/types';
2
- import { IStorageSync } from '../../storages/types';
3
- import { ISettings } from '../../types';
4
- export declare function submitterManagerFactory(settings: ISettings, storage: IStorageSync, splitApi: ISplitApi): import("../types").ISyncTask<[], any>;
1
+ import { ISyncManagerFactoryParams } from '../types';
2
+ export declare function submitterManagerFactory(params: ISyncManagerFactoryParams): import("../types").ISyncTask<[], any>;
@@ -0,0 +1,17 @@
1
+ import { ISyncTask, ITimeTracker } from '../types';
2
+ import { IPostMetricsUsage } from '../../services/types';
3
+ import { IStorageSync, TelemetryCacheSync } from '../../storages/types';
4
+ import { TelemetryStatsPayload } from './types';
5
+ import { ILogger } from '../../logger/types';
6
+ /**
7
+ * Converts `impressions` data from cache into request payload.
8
+ */
9
+ export declare function telemetryCacheAdapter(telemetryCache: TelemetryCacheSync, storage: IStorageSync): {
10
+ isEmpty(): boolean;
11
+ clear(): void;
12
+ state(): TelemetryStatsPayload;
13
+ };
14
+ /**
15
+ * Sync task that periodically posts impressions data
16
+ */
17
+ export declare function telemetrySyncTaskFactory(log: ILogger, postMetricsUsage: IPostMetricsUsage, telemetryCache: TelemetryCacheSync, telemetryRefreshRate: number, latencyTracker: ITimeTracker, storage: IStorageSync): ISyncTask;
@@ -0,0 +1,2 @@
1
+ import { SplitIO } from '../types';
2
+ export declare function LocalhostFromFile(): SplitIO.LocalhostFactory;
@@ -0,0 +1,2 @@
1
+ import { SplitIO } from '../types';
2
+ export declare function LocalhostFromObject(): SplitIO.LocalhostFactory;
@@ -0,0 +1,9 @@
1
+ import { ISyncManagerCS, ISyncManagerFactoryParams } from './types';
2
+ import { ISplitsParser } from './offline/splitsParser/types';
3
+ /**
4
+ * Offline SyncManager factory.
5
+ * Can be used for server-side API, and client-side API with or without multiple clients.
6
+ *
7
+ * @param splitsParser e.g., `splitsParserFromFile`, `splitsParserFromSettings`.
8
+ */
9
+ export declare function syncManagerOfflineFactory(splitsParserFactory: () => ISplitsParser): (params: ISyncManagerFactoryParams) => ISyncManagerCS;
@@ -1,6 +1,6 @@
1
1
  import { ISyncManagerCS, ISyncManagerFactoryParams } from './types';
2
- import { IPushManagerFactoryParams, IPushManager } from './streaming/types';
3
- import { IPollingManager, IPollingManagerFactoryParams } from './polling/types';
2
+ import { IPushManager } from './streaming/types';
3
+ import { IPollingManager } from './polling/types';
4
4
  /**
5
5
  * Online SyncManager factory.
6
6
  * Can be used for server-side API, and client-side API with or without multiple clients.
@@ -9,4 +9,4 @@ import { IPollingManager, IPollingManagerFactoryParams } from './polling/types';
9
9
  * `pollingManagerSSFactory` or `pollingManagerCSFactory` respectively.
10
10
  * @param pushManagerFactory optional to build a SyncManager with or without streaming support
11
11
  */
12
- export declare function syncManagerOnlineFactory(pollingManagerFactory?: (...args: IPollingManagerFactoryParams) => IPollingManager, pushManagerFactory?: (...args: IPushManagerFactoryParams) => IPushManager | undefined): (params: ISyncManagerFactoryParams) => ISyncManagerCS;
12
+ export declare function syncManagerOnlineFactory(pollingManagerFactory?: (params: ISyncManagerFactoryParams) => IPollingManager, pushManagerFactory?: (params: ISyncManagerFactoryParams, pollingManager: IPollingManager) => IPushManager | undefined): (params: ISyncManagerFactoryParams) => ISyncManagerCS;
@@ -3,6 +3,7 @@ import { IPlatform } from '../sdkFactory/types';
3
3
  import { ISplitApi } from '../services/types';
4
4
  import { IStorageSync } from '../storages/types';
5
5
  import { ISettings } from '../types';
6
+ import { IPollingManager } from './polling/types';
6
7
  import { IPushManager } from './streaming/types';
7
8
  export interface ITask<Input extends any[] = []> {
8
9
  /**
@@ -39,6 +40,8 @@ export interface ITimeTracker {
39
40
  export interface ISyncManager extends ITask {
40
41
  flush(): Promise<any>;
41
42
  pushManager?: IPushManager;
43
+ pollingManager?: IPollingManager;
44
+ submitter?: ISyncTask;
42
45
  }
43
46
  export interface ISyncManagerCS extends ISyncManager {
44
47
  shared(matchingKey: string, readinessManager: IReadinessManager, storage: IStorageSync): ISyncManager | undefined;
@@ -1,10 +1,10 @@
1
1
  import { IEventsCacheBase } from '../storages/types';
2
2
  import { IEventsHandler, IEventTracker } from './types';
3
- import { ILogger } from '../logger/types';
3
+ import { ISettings } from '../types';
4
4
  /**
5
5
  * Event tracker stores events in cache and pass them to the integrations manager if provided.
6
6
  *
7
7
  * @param eventsCache cache to save events
8
8
  * @param integrationsManager optional event handler used for integrations
9
9
  */
10
- export declare function eventTrackerFactory(log: ILogger, eventsCache: IEventsCacheBase, integrationsManager?: IEventsHandler): IEventTracker;
10
+ export declare function eventTrackerFactory(settings: ISettings, eventsCache: IEventsCacheBase, integrationsManager?: IEventsHandler): IEventTracker;
@@ -7,3 +7,7 @@ export declare function shouldAddPt(settings: ISettings): boolean;
7
7
  * Checks if it should dedupe impressions or not.
8
8
  */
9
9
  export declare function shouldBeOptimized(settings: ISettings): boolean;
10
+ /**
11
+ * Storage is async if mode is consumer or partial consumer
12
+ */
13
+ export declare function isStorageSync(settings: ISettings): boolean;
@@ -1,8 +1,7 @@
1
1
  import { IImpressionCountsCacheSync, IImpressionsCacheBase } from '../storages/types';
2
2
  import { IImpressionsHandler, IImpressionsTracker } from './types';
3
- import { SplitIO, ISettings } from '../types';
3
+ import { ISettings } from '../types';
4
4
  import { IImpressionObserver } from './impressionObserver/types';
5
- import { ILogger } from '../logger/types';
6
5
  /**
7
6
  * Impressions tracker stores impressions in cache and pass them to the listener and integrations manager if provided.
8
7
  *
@@ -13,4 +12,4 @@ import { ILogger } from '../logger/types';
13
12
  * @param observer optional impression observer. If provided, previous time (pt property) is included in impression instances
14
13
  * @param countsCache optional cache to save impressions count. If provided, impressions will be deduped (OPTIMIZED mode)
15
14
  */
16
- export declare function impressionsTrackerFactory(log: ILogger, impressionsCache: IImpressionsCacheBase, { runtime: { ip, hostname }, version }: Pick<ISettings, 'version' | 'runtime'>, impressionListener?: SplitIO.IImpressionListener, integrationsManager?: IImpressionsHandler, observer?: IImpressionObserver, countsCache?: IImpressionCountsCacheSync): IImpressionsTracker;
15
+ export declare function impressionsTrackerFactory(settings: ISettings, impressionsCache: IImpressionsCacheBase, integrationsManager?: IImpressionsHandler, observer?: IImpressionObserver, countsCache?: IImpressionCountsCacheSync): IImpressionsTracker;
File without changes