@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
package/types/types.d.ts CHANGED
@@ -48,6 +48,11 @@ declare type EventConsts = {
48
48
  * @typedef {string} SDKMode
49
49
  */
50
50
  export declare type SDKMode = 'standalone' | 'consumer' | 'localhost' | 'consumer_partial';
51
+ /**
52
+ * User consent status.
53
+ * @typedef {string} ConsentStatus
54
+ */
55
+ export declare type ConsentStatus = 'GRANTED' | 'DECLINED' | 'UNKNOWN';
51
56
  /**
52
57
  * Settings interface. This is a representation of the settings the SDK expose, that's why
53
58
  * most of it's props are readonly. Only features should be rewritten when localhost mode is active.
@@ -67,6 +72,7 @@ export interface ISettings {
67
72
  readonly scheduler: {
68
73
  featuresRefreshRate: number;
69
74
  impressionsRefreshRate: number;
75
+ impressionsQueueSize: number;
70
76
  metricsRefreshRate: number;
71
77
  segmentsRefreshRate: number;
72
78
  offlineRefreshRate: number;
@@ -104,6 +110,7 @@ export interface ISettings {
104
110
  };
105
111
  readonly log: ILogger;
106
112
  readonly impressionListener?: unknown;
113
+ readonly userConsent?: ConsentStatus;
107
114
  }
108
115
  /**
109
116
  * Log levels.
@@ -249,6 +256,13 @@ interface INodeBasicSettings extends ISharedSettings {
249
256
  * @default 300
250
257
  */
251
258
  impressionsRefreshRate?: number;
259
+ /**
260
+ * The maximum number of impression items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
261
+ * If you use a 0 here, the queue will have no maximum size.
262
+ * @property {number} impressionsQueueSize
263
+ * @default 30000
264
+ */
265
+ impressionsQueueSize?: number;
252
266
  /**
253
267
  * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
254
268
  * @property {number} metricsRefreshRate
@@ -375,6 +389,7 @@ interface IBasicClient extends IStatusInterface {
375
389
  * @returns {Promise<void>}
376
390
  */
377
391
  destroy(): Promise<void>;
392
+ isClientSide: boolean;
378
393
  }
379
394
  /**
380
395
  * Common definitions between SDK instances for different environments interface.
@@ -765,6 +780,13 @@ export declare namespace SplitIO {
765
780
  * @default 60
766
781
  */
767
782
  impressionsRefreshRate?: number;
783
+ /**
784
+ * The maximum number of impression items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
785
+ * If you use a 0 here, the queue will have no maximum size.
786
+ * @property {number} impressionsQueueSize
787
+ * @default 30000
788
+ */
789
+ impressionsQueueSize?: number;
768
790
  /**
769
791
  * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
770
792
  * @property {number} metricsRefreshRate
@@ -0,0 +1,4 @@
1
+ import { IEventEmitter } from '../types';
2
+ export declare const EventEmitter: {
3
+ new (): IEventEmitter;
4
+ };
@@ -0,0 +1,2 @@
1
+ import { ISettings } from '../types';
2
+ export declare function isConsentGranted(settings: ISettings): boolean;
@@ -20,3 +20,6 @@ export declare const STORAGE_MEMORY: StorageType;
20
20
  export declare const STORAGE_LOCALSTORAGE: StorageType;
21
21
  export declare const STORAGE_REDIS: StorageType;
22
22
  export declare const STORAGE_PLUGGABLE: StorageType;
23
+ export declare const CONSENT_GRANTED = "GRANTED";
24
+ export declare const CONSENT_DECLINED = "DECLINED";
25
+ export declare const CONSENT_UNKNOWN = "UNKNOWN";
@@ -0,0 +1,10 @@
1
+ export declare class SplitError extends Error {
2
+ constructor(msg?: string);
3
+ }
4
+ export declare class SplitTimeoutError extends SplitError {
5
+ constructor(msg?: string);
6
+ }
7
+ export declare class SplitNetworkError extends SplitError {
8
+ statusCode?: number;
9
+ constructor(msg?: string, code?: number);
10
+ }
@@ -55,13 +55,18 @@ export declare function isIntegerNumber(val: any): boolean;
55
55
  */
56
56
  export declare function isNaNNumber(val: any): boolean;
57
57
  /**
58
- * Validates if a value is an object with the Object prototype (map object).
58
+ * Validates if a value is an object created by the Object constructor (plain object).
59
+ * It checks `constructor.name` to avoid false negatives when validating values on a separate VM context, which has its own global built-ins.
59
60
  */
60
61
  export declare function isObject(obj: any): boolean;
61
62
  /**
62
63
  * Checks if a given value is a string.
63
64
  */
64
65
  export declare function isString(val: any): val is string;
66
+ /**
67
+ * String sanitizer. Returns the provided value converted to uppercase if it is a string.
68
+ */
69
+ export declare function stringToUpperCase(val: any): any;
65
70
  /**
66
71
  * Deep copy version of Object.assign using recursion.
67
72
  * There are some assumptions here. It's for internal use and we don't need verbose errors
@@ -72,10 +77,6 @@ export declare function merge(target: {
72
77
  }, source: {
73
78
  [key: string]: any;
74
79
  }, ...rest: any[]): object;
75
- /**
76
- * Shallow clone an object
77
- */
78
- export declare function shallowClone(obj: any): any;
79
80
  /**
80
81
  * Checks if the target string starts with the sub string.
81
82
  */
@@ -44,5 +44,12 @@ interface IMapConstructor {
44
44
  new <K, V>(entries?: readonly (readonly [K, V])[] | null): IMap<K, V>;
45
45
  readonly prototype: IMap<any, any>;
46
46
  }
47
+ /**
48
+ * return the Map constructor to use. If native Map is not available or it doesn't support the required features (e.g., IE11),
49
+ * a ponyfill with minimal features is returned instead.
50
+ *
51
+ * Exported for testing purposes only.
52
+ */
53
+ export declare function __getMapConstructor(): IMapConstructor;
47
54
  export declare const _Map: IMapConstructor;
48
55
  export {};
@@ -0,0 +1,12 @@
1
+ export declare function UTF16ToUTF8(key: string): string | undefined;
2
+ /*!
3
+ * +----------------------------------------------------------------------------------+
4
+ * | murmurHash3.js v3.0.0 (http://github.com/karanlyons/murmurHash3.js) |
5
+ * | A TypeScript/JavaScript implementation of MurmurHash3's hashing algorithms. |
6
+ * |----------------------------------------------------------------------------------|
7
+ * | Copyright (c) 2012-2020 Karan Lyons. Freely distributable under the MIT license. |
8
+ * +----------------------------------------------------------------------------------+
9
+ */
10
+ export declare function x86Multiply(m: number, n: number): number;
11
+ export declare function x86Rotl(m: number, n: number): number;
12
+ export declare function x86Fmix(h: number): number;
@@ -0,0 +1,2 @@
1
+ export declare function hash(str: string, seed: number): number;
2
+ export declare function bucket(str: string, seed: number): number;
@@ -0,0 +1,3 @@
1
+ import { IMetadata } from '../../dtos/types';
2
+ import { ISettings } from '../../types';
3
+ export default function buildMetadata(settings: ISettings): IMetadata;
@@ -0,0 +1,6 @@
1
+ import { ILogger } from '../../logger/types';
2
+ import { ConsentStatus } from '../../types';
3
+ export declare function validateConsent({ userConsent, log }: {
4
+ userConsent?: any;
5
+ log: ILogger;
6
+ }): ConsentStatus;
@@ -1,3 +1,3 @@
1
1
  import { ILogger } from '../../logger/types';
2
2
  import { SplitIO } from '../../types';
3
- export declare function validImpressionsMode(log: ILogger, impressionsMode: string): SplitIO.ImpressionsMode;
3
+ export declare function validImpressionsMode(log: ILogger, impressionsMode: any): SplitIO.ImpressionsMode;
@@ -0,0 +1,9 @@
1
+ import { ISettings } from '../../../types';
2
+ /**
3
+ * This function validates `settings.storage` object
4
+ *
5
+ * @param {any} settings config object provided by the user to initialize the sdk
6
+ *
7
+ * @returns {Object} valid storage factory. It might be the default `InMemoryStorageCSFactory` if the provided storage is invalid.
8
+ */
9
+ export declare function validateLocalhost(settings: ISettings): import("../../../types").SplitIO.LocalhostFactory | undefined;
@@ -0,0 +1,11 @@
1
+ import { ILogger } from '../../logger/types';
2
+ /**
3
+ * Validates the `log` (logger) property at config.
4
+ *
5
+ * @param settings user config object
6
+ * @returns the provided logger or a no-op logger if no one is provided
7
+ * @throws throws an error if a logger was provided but is invalid
8
+ */
9
+ export default function logger(settings: {
10
+ log: unknown;
11
+ }): ILogger;
@@ -0,0 +1,2 @@
1
+ import { ISettings } from '../../../types';
2
+ export declare function validateRuntime(): ISettings['runtime'];
@@ -0,0 +1,2 @@
1
+ import { ISettings } from '../../../types';
2
+ export declare function validateRuntime(settings: ISettings): ISettings['runtime'];
@@ -0,0 +1,2 @@
1
+ import { ISettings } from '../../types';
2
+ export declare function validateRuntime(): ISettings['runtime'];
@@ -5,22 +5,28 @@ import { ISettings } from '../../types';
5
5
  */
6
6
  export interface ISettingsValidationParams {
7
7
  /**
8
- * Object of values to overwrite default settings.
9
- * Version and startup properties are mandatory, because these values are not part of the base setting.
8
+ * Object of values to overwrite base settings.
9
+ * Version and startup properties are required, because they are not defined in the base settings.
10
10
  */
11
11
  defaults: Partial<ISettings> & {
12
12
  version: string;
13
13
  } & {
14
14
  startup: ISettings['startup'];
15
15
  };
16
- /** Function to overwrite runtime values (ip and hostname) which are false by default */
17
- runtime?: (settings: ISettings) => ISettings['runtime'];
18
- /** Storage validator */
16
+ /** If true, validates core.key */
17
+ acceptKey?: boolean;
18
+ /** If true, validates core.trafficType */
19
+ acceptTT?: boolean;
20
+ /** Define runtime values (`settings.runtime`) */
21
+ runtime: (settings: ISettings) => ISettings['runtime'];
22
+ /** Storage validator (`settings.storage`) */
19
23
  storage?: (settings: ISettings) => ISettings['storage'];
20
- /** Integrations validator */
24
+ /** Integrations validator (`settings.integrations`) */
21
25
  integrations?: (settings: ISettings) => ISettings['integrations'];
22
26
  /** Logger validator (`settings.debug`) */
23
27
  logger: (settings: ISettings) => ISettings['log'];
24
28
  /** Localhost mode validator (`settings.sync.localhostMode`) */
25
29
  localhost?: (settings: ISettings) => ISettings['sync']['localhostMode'];
30
+ /** User consent validator (`settings.userConsent`) */
31
+ consent: (settings: ISettings) => ISettings['userConsent'];
26
32
  }
@@ -0,0 +1,5 @@
1
+ import { ILogger } from '../../logger/types';
2
+ export declare function validateUserConsent({ userConsent, log }: {
3
+ userConsent: any;
4
+ log: ILogger;
5
+ }): any;