@splitsoftware/splitio-commons 1.6.2-rc.4 → 1.6.2-rc.5

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 (475) hide show
  1. package/cjs/consent/sdkUserConsent.js +2 -2
  2. package/cjs/listeners/browser.js +2 -1
  3. package/cjs/logger/constants.js +2 -1
  4. package/cjs/sdkClient/clientAttributesDecoration.js +1 -1
  5. package/cjs/sdkFactory/index.js +23 -6
  6. package/cjs/services/splitApi.js +20 -1
  7. package/cjs/storages/KeyBuilderSS.js +6 -0
  8. package/cjs/storages/inLocalStorage/index.js +4 -0
  9. package/cjs/storages/inMemory/AttributesCacheInMemory.js +1 -1
  10. package/cjs/storages/inMemory/ImpressionCountsCacheInMemory.js +12 -1
  11. package/cjs/storages/inMemory/InMemoryStorage.js +5 -1
  12. package/cjs/storages/inMemory/InMemoryStorageCS.js +5 -1
  13. package/cjs/storages/inMemory/uniqueKeysCacheInMemory.js +73 -0
  14. package/cjs/storages/inMemory/uniqueKeysCacheInMemoryCS.js +78 -0
  15. package/cjs/storages/inRedis/ImpressionCountsCacheInRedis.js +46 -0
  16. package/cjs/storages/inRedis/constants.js +4 -1
  17. package/cjs/storages/inRedis/index.js +15 -1
  18. package/cjs/storages/inRedis/uniqueKeysCacheInRedis.js +55 -0
  19. package/cjs/sync/submitters/submitterManager.js +3 -0
  20. package/cjs/sync/submitters/telemetrySubmitter.js +1 -0
  21. package/cjs/sync/submitters/uniqueKeysSubmitter.js +26 -0
  22. package/cjs/trackers/impressionsTracker.js +22 -41
  23. package/cjs/trackers/strategy/strategyDebug.js +25 -0
  24. package/cjs/trackers/strategy/strategyNone.js +29 -0
  25. package/cjs/trackers/strategy/strategyOptimized.js +34 -0
  26. package/cjs/trackers/uniqueKeysTracker.js +31 -0
  27. package/cjs/types.js +2 -0
  28. package/cjs/utils/constants/index.js +4 -2
  29. package/cjs/utils/key/index.js +1 -1
  30. package/cjs/utils/settingsValidation/impressionsMode.js +2 -2
  31. package/cjs/utils/settingsValidation/index.js +3 -1
  32. package/esm/consent/sdkUserConsent.js +2 -2
  33. package/esm/listeners/browser.js +3 -2
  34. package/esm/logger/constants.js +1 -0
  35. package/esm/sdkClient/clientAttributesDecoration.js +1 -1
  36. package/esm/sdkFactory/index.js +23 -6
  37. package/esm/services/splitApi.js +20 -1
  38. package/esm/storages/KeyBuilderSS.js +6 -0
  39. package/esm/storages/inLocalStorage/index.js +5 -1
  40. package/esm/storages/inMemory/AttributesCacheInMemory.js +1 -1
  41. package/esm/storages/inMemory/ImpressionCountsCacheInMemory.js +12 -1
  42. package/esm/storages/inMemory/InMemoryStorage.js +6 -2
  43. package/esm/storages/inMemory/InMemoryStorageCS.js +6 -2
  44. package/esm/storages/inMemory/uniqueKeysCacheInMemory.js +70 -0
  45. package/esm/storages/inMemory/uniqueKeysCacheInMemoryCS.js +75 -0
  46. package/esm/storages/inRedis/ImpressionCountsCacheInRedis.js +43 -0
  47. package/esm/storages/inRedis/constants.js +3 -0
  48. package/esm/storages/inRedis/index.js +16 -2
  49. package/esm/storages/inRedis/uniqueKeysCacheInRedis.js +52 -0
  50. package/esm/sync/submitters/submitterManager.js +3 -0
  51. package/esm/sync/submitters/telemetrySubmitter.js +2 -1
  52. package/esm/sync/submitters/uniqueKeysSubmitter.js +22 -0
  53. package/esm/trackers/impressionsTracker.js +22 -41
  54. package/esm/trackers/strategy/strategyDebug.js +21 -0
  55. package/esm/trackers/strategy/strategyNone.js +25 -0
  56. package/esm/trackers/strategy/strategyOptimized.js +30 -0
  57. package/esm/trackers/uniqueKeysTracker.js +27 -0
  58. package/esm/types.js +1 -0
  59. package/esm/utils/constants/index.js +2 -0
  60. package/esm/utils/key/index.js +1 -1
  61. package/esm/utils/settingsValidation/impressionsMode.js +3 -3
  62. package/esm/utils/settingsValidation/index.js +3 -1
  63. package/package.json +5 -4
  64. package/src/consent/sdkUserConsent.ts +5 -6
  65. package/src/dtos/types.ts +8 -0
  66. package/src/evaluator/Engine.ts +3 -3
  67. package/src/evaluator/combiners/and.ts +1 -1
  68. package/src/evaluator/combiners/ifelseif.ts +3 -3
  69. package/src/evaluator/condition/engineUtils.ts +1 -1
  70. package/src/evaluator/condition/index.ts +6 -6
  71. package/src/evaluator/index.ts +10 -10
  72. package/src/evaluator/matchers/all.ts +1 -1
  73. package/src/evaluator/matchers/between.ts +1 -1
  74. package/src/evaluator/matchers/boolean.ts +1 -1
  75. package/src/evaluator/matchers/cont_all.ts +1 -1
  76. package/src/evaluator/matchers/cont_any.ts +1 -1
  77. package/src/evaluator/matchers/cont_str.ts +1 -1
  78. package/src/evaluator/matchers/dependency.ts +1 -1
  79. package/src/evaluator/matchers/eq.ts +1 -1
  80. package/src/evaluator/matchers/eq_set.ts +1 -1
  81. package/src/evaluator/matchers/ew.ts +1 -1
  82. package/src/evaluator/matchers/gte.ts +1 -1
  83. package/src/evaluator/matchers/index.ts +1 -1
  84. package/src/evaluator/matchers/lte.ts +1 -1
  85. package/src/evaluator/matchers/part_of.ts +1 -1
  86. package/src/evaluator/matchers/segment.ts +1 -1
  87. package/src/evaluator/matchers/string.ts +1 -1
  88. package/src/evaluator/matchers/sw.ts +1 -1
  89. package/src/evaluator/matchers/whitelist.ts +1 -1
  90. package/src/evaluator/parser/index.ts +3 -3
  91. package/src/evaluator/types.ts +6 -6
  92. package/src/evaluator/value/index.ts +4 -4
  93. package/src/evaluator/value/sanitize.ts +4 -4
  94. package/src/integrations/ga/GaToSplit.ts +6 -6
  95. package/src/integrations/ga/SplitToGa.ts +10 -10
  96. package/src/integrations/ga/types.ts +4 -4
  97. package/src/integrations/pluggable.ts +3 -3
  98. package/src/integrations/types.ts +2 -2
  99. package/src/listeners/browser.ts +3 -2
  100. package/src/logger/constants.ts +1 -0
  101. package/src/logger/index.ts +3 -3
  102. package/src/logger/sdkLogger.ts +2 -1
  103. package/src/logger/types.ts +16 -0
  104. package/src/readiness/sdkReadinessManager.ts +1 -1
  105. package/src/readiness/types.ts +9 -2
  106. package/src/sdkClient/client.ts +13 -13
  107. package/src/sdkClient/clientAttributesDecoration.ts +13 -13
  108. package/src/sdkClient/clientCS.ts +4 -3
  109. package/src/sdkClient/clientInputValidation.ts +15 -15
  110. package/src/sdkClient/sdkClient.ts +2 -2
  111. package/src/sdkClient/sdkClientMethod.ts +2 -2
  112. package/src/sdkClient/sdkClientMethodCS.ts +9 -9
  113. package/src/sdkClient/sdkClientMethodCSWithTT.ts +9 -9
  114. package/src/sdkFactory/index.ts +28 -8
  115. package/src/sdkFactory/types.ts +11 -8
  116. package/src/sdkManager/index.ts +5 -5
  117. package/src/services/splitApi.ts +22 -1
  118. package/src/services/types.ts +6 -0
  119. package/src/storages/KeyBuilderSS.ts +8 -0
  120. package/src/storages/dataLoader.ts +2 -2
  121. package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +1 -1
  122. package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +2 -2
  123. package/src/storages/inLocalStorage/index.ts +6 -4
  124. package/src/storages/inMemory/AttributesCacheInMemory.ts +12 -13
  125. package/src/storages/inMemory/EventsCacheInMemory.ts +4 -4
  126. package/src/storages/inMemory/ImpressionCountsCacheInMemory.ts +16 -1
  127. package/src/storages/inMemory/InMemoryStorage.ts +5 -2
  128. package/src/storages/inMemory/InMemoryStorageCS.ts +6 -2
  129. package/src/storages/inMemory/uniqueKeysCacheInMemory.ts +82 -0
  130. package/src/storages/inMemory/uniqueKeysCacheInMemoryCS.ts +88 -0
  131. package/src/storages/inRedis/EventsCacheInRedis.ts +4 -4
  132. package/src/storages/inRedis/ImpressionCountsCacheInRedis.ts +48 -0
  133. package/src/storages/inRedis/ImpressionsCacheInRedis.ts +1 -1
  134. package/src/storages/inRedis/RedisAdapter.ts +1 -1
  135. package/src/storages/inRedis/SegmentsCacheInRedis.ts +1 -1
  136. package/src/storages/inRedis/SplitsCacheInRedis.ts +1 -1
  137. package/src/storages/inRedis/TelemetryCacheInRedis.ts +1 -1
  138. package/src/storages/inRedis/constants.ts +3 -0
  139. package/src/storages/inRedis/index.ts +14 -6
  140. package/src/storages/inRedis/uniqueKeysCacheInRedis.ts +61 -0
  141. package/src/storages/pluggable/EventsCachePluggable.ts +4 -4
  142. package/src/storages/pluggable/ImpressionsCachePluggable.ts +1 -1
  143. package/src/storages/pluggable/SegmentsCachePluggable.ts +1 -1
  144. package/src/storages/pluggable/SplitsCachePluggable.ts +1 -1
  145. package/src/storages/pluggable/TelemetryCachePluggable.ts +1 -1
  146. package/src/storages/pluggable/index.ts +3 -3
  147. package/src/storages/pluggable/wrapperAdapter.ts +1 -1
  148. package/src/storages/types.ts +45 -50
  149. package/src/sync/offline/LocalhostFromObject.ts +4 -4
  150. package/src/sync/offline/splitsParser/splitsParserFromSettings.ts +8 -8
  151. package/src/sync/polling/updaters/mySegmentsUpdater.ts +1 -1
  152. package/src/sync/polling/updaters/segmentChangesUpdater.ts +1 -1
  153. package/src/sync/polling/updaters/splitChangesUpdater.ts +1 -1
  154. package/src/sync/streaming/SSEHandler/index.ts +1 -1
  155. package/src/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.ts +1 -1
  156. package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +1 -1
  157. package/src/sync/submitters/submitter.ts +1 -1
  158. package/src/sync/submitters/submitterManager.ts +2 -0
  159. package/src/sync/submitters/telemetrySubmitter.ts +4 -3
  160. package/src/sync/submitters/types.ts +22 -3
  161. package/src/sync/submitters/uniqueKeysSubmitter.ts +35 -0
  162. package/src/sync/syncTask.ts +1 -1
  163. package/src/trackers/eventTracker.ts +3 -3
  164. package/src/trackers/impressionsTracker.ts +30 -51
  165. package/src/trackers/strategy/strategyDebug.ts +28 -0
  166. package/src/trackers/strategy/strategyNone.ts +34 -0
  167. package/src/trackers/strategy/strategyOptimized.ts +42 -0
  168. package/src/trackers/types.ts +30 -4
  169. package/src/trackers/uniqueKeysTracker.ts +37 -0
  170. package/src/types.ts +1265 -0
  171. package/src/utils/constants/index.ts +3 -1
  172. package/src/utils/inputValidation/apiKey.ts +1 -1
  173. package/src/utils/inputValidation/attribute.ts +1 -1
  174. package/src/utils/inputValidation/attributes.ts +3 -3
  175. package/src/utils/inputValidation/event.ts +1 -1
  176. package/src/utils/inputValidation/eventProperties.ts +3 -3
  177. package/src/utils/inputValidation/eventValue.ts +1 -1
  178. package/src/utils/inputValidation/isOperational.ts +1 -1
  179. package/src/utils/inputValidation/key.ts +3 -3
  180. package/src/utils/inputValidation/preloadedData.ts +3 -3
  181. package/src/utils/inputValidation/split.ts +1 -1
  182. package/src/utils/inputValidation/splitExistance.ts +1 -1
  183. package/src/utils/inputValidation/splits.ts +1 -1
  184. package/src/utils/inputValidation/trafficType.ts +1 -1
  185. package/src/utils/inputValidation/trafficTypeExistance.ts +1 -1
  186. package/src/utils/key/index.ts +9 -9
  187. package/src/utils/settingsValidation/consent.ts +2 -1
  188. package/src/utils/settingsValidation/impressionsMode.ts +6 -6
  189. package/src/utils/settingsValidation/index.ts +4 -1
  190. package/src/utils/settingsValidation/integrations/common.ts +1 -1
  191. package/src/utils/settingsValidation/integrations/configurable.ts +1 -1
  192. package/src/utils/settingsValidation/integrations/pluggable.ts +2 -1
  193. package/src/utils/settingsValidation/localhost/builtin.ts +2 -1
  194. package/src/utils/settingsValidation/localhost/pluggable.ts +2 -1
  195. package/src/utils/settingsValidation/logger/builtinLogger.ts +2 -1
  196. package/src/utils/settingsValidation/logger/pluggableLogger.ts +2 -1
  197. package/src/utils/settingsValidation/splitFilters.ts +9 -7
  198. package/src/utils/settingsValidation/storage/storageCS.ts +2 -1
  199. package/types/consent/index.d.ts +2 -0
  200. package/types/consent/sdkUserConsent.d.ts +13 -0
  201. package/types/dtos/types.d.ts +172 -0
  202. package/types/evaluator/Engine.d.ts +15 -0
  203. package/types/evaluator/combiners/and.d.ts +4 -0
  204. package/types/evaluator/combiners/ifelseif.d.ts +3 -0
  205. package/types/evaluator/condition/engineUtils.d.ts +11 -0
  206. package/types/evaluator/condition/index.d.ts +6 -0
  207. package/types/evaluator/convertions/index.d.ts +2 -0
  208. package/types/evaluator/index.d.ts +7 -0
  209. package/types/evaluator/matchers/all.d.ts +2 -0
  210. package/types/evaluator/matchers/between.d.ts +3 -0
  211. package/types/evaluator/matchers/boolean.d.ts +2 -0
  212. package/types/evaluator/matchers/cont_all.d.ts +2 -0
  213. package/types/evaluator/matchers/cont_any.d.ts +2 -0
  214. package/types/evaluator/matchers/cont_str.d.ts +2 -0
  215. package/types/evaluator/matchers/dependency.d.ts +5 -0
  216. package/types/evaluator/matchers/eq.d.ts +2 -0
  217. package/types/evaluator/matchers/eq_set.d.ts +2 -0
  218. package/types/evaluator/matchers/ew.d.ts +2 -0
  219. package/types/evaluator/matchers/gte.d.ts +2 -0
  220. package/types/evaluator/matchers/index.d.ts +7 -0
  221. package/types/evaluator/matchers/lte.d.ts +2 -0
  222. package/types/evaluator/matchers/matcherTypes.d.ts +10 -0
  223. package/types/evaluator/matchers/part_of.d.ts +2 -0
  224. package/types/evaluator/matchers/segment.d.ts +6 -0
  225. package/types/evaluator/matchers/string.d.ts +2 -0
  226. package/types/evaluator/matchers/sw.d.ts +2 -0
  227. package/types/evaluator/matchers/whitelist.d.ts +3 -0
  228. package/types/evaluator/matchersTransform/index.d.ts +6 -0
  229. package/types/evaluator/matchersTransform/segment.d.ts +5 -0
  230. package/types/evaluator/matchersTransform/set.d.ts +5 -0
  231. package/types/evaluator/matchersTransform/unaryNumeric.d.ts +5 -0
  232. package/types/evaluator/matchersTransform/whitelist.d.ts +5 -0
  233. package/types/evaluator/parser/index.d.ts +5 -0
  234. package/types/evaluator/treatments/index.d.ts +8 -0
  235. package/types/evaluator/types.d.ts +28 -0
  236. package/types/evaluator/value/index.d.ts +7 -0
  237. package/types/evaluator/value/sanitize.d.ts +7 -0
  238. package/types/index.d.ts +5 -0
  239. package/types/integrations/browser.d.ts +12 -0
  240. package/types/integrations/ga/GaToSplit.d.ts +40 -0
  241. package/types/integrations/ga/GoogleAnalyticsToSplit.d.ts +3 -0
  242. package/types/integrations/ga/SplitToGa.d.ts +34 -0
  243. package/types/integrations/ga/SplitToGoogleAnalytics.d.ts +3 -0
  244. package/types/integrations/ga/types.d.ts +148 -0
  245. package/types/integrations/pluggable.d.ts +11 -0
  246. package/types/integrations/types.d.ts +17 -0
  247. package/types/listeners/browser.d.ts +40 -0
  248. package/types/listeners/node.d.ts +22 -0
  249. package/types/listeners/types.d.ts +4 -0
  250. package/types/logger/browser/DebugLogger.d.ts +2 -0
  251. package/types/logger/browser/ErrorLogger.d.ts +2 -0
  252. package/types/logger/browser/InfoLogger.d.ts +2 -0
  253. package/types/logger/browser/WarnLogger.d.ts +2 -0
  254. package/types/logger/constants.d.ts +142 -0
  255. package/types/logger/index.d.ts +22 -0
  256. package/types/logger/messages/debug.d.ts +1 -0
  257. package/types/logger/messages/error.d.ts +1 -0
  258. package/types/logger/messages/info.d.ts +1 -0
  259. package/types/logger/messages/warn.d.ts +1 -0
  260. package/types/logger/sdkLogger.d.ts +8 -0
  261. package/types/logger/types.d.ts +17 -0
  262. package/types/readiness/constants.d.ts +7 -0
  263. package/types/readiness/readinessManager.d.ts +6 -0
  264. package/types/readiness/sdkReadinessManager.d.ts +11 -0
  265. package/types/readiness/types.d.ts +60 -0
  266. package/types/sdkClient/client.d.ts +6 -0
  267. package/types/sdkClient/clientAttributesDecoration.d.ts +51 -0
  268. package/types/sdkClient/clientCS.d.ts +10 -0
  269. package/types/sdkClient/clientInputValidation.d.ts +7 -0
  270. package/types/sdkClient/sdkClient.d.ts +6 -0
  271. package/types/sdkClient/sdkClientMethod.d.ts +6 -0
  272. package/types/sdkClient/sdkClientMethodCS.d.ts +7 -0
  273. package/types/sdkClient/sdkClientMethodCSWithTT.d.ts +8 -0
  274. package/types/sdkClient/types.d.ts +18 -0
  275. package/types/sdkFactory/index.d.ts +6 -0
  276. package/types/sdkFactory/types.d.ts +82 -0
  277. package/types/sdkManager/index.d.ts +5 -0
  278. package/types/services/splitApi.d.ts +11 -0
  279. package/types/services/splitHttpClient.d.ts +10 -0
  280. package/types/services/types.d.ts +54 -0
  281. package/types/storages/AbstractSegmentsCacheSync.d.ts +55 -0
  282. package/types/storages/AbstractSplitsCacheAsync.d.ts +36 -0
  283. package/types/storages/AbstractSplitsCacheSync.d.ts +42 -0
  284. package/types/storages/KeyBuilder.d.ts +14 -0
  285. package/types/storages/KeyBuilderCS.d.ts +16 -0
  286. package/types/storages/KeyBuilderSS.d.ts +17 -0
  287. package/types/storages/dataLoader.d.ts +10 -0
  288. package/types/storages/findLatencyIndex.d.ts +7 -0
  289. package/types/storages/inLocalStorage/MySegmentsCacheInLocal.d.ts +25 -0
  290. package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +51 -0
  291. package/types/storages/inLocalStorage/constants.d.ts +2 -0
  292. package/types/storages/inLocalStorage/index.d.ts +8 -0
  293. package/types/storages/inMemory/AttributesCacheInMemory.d.ts +43 -0
  294. package/types/storages/inMemory/CountsCacheInMemory.d.ts +20 -0
  295. package/types/storages/inMemory/EventsCacheInMemory.d.ts +35 -0
  296. package/types/storages/inMemory/ImpressionCountsCacheInMemory.d.ts +28 -0
  297. package/types/storages/inMemory/ImpressionsCacheInMemory.d.ts +30 -0
  298. package/types/storages/inMemory/InMemoryStorage.d.ts +10 -0
  299. package/types/storages/inMemory/InMemoryStorageCS.d.ts +10 -0
  300. package/types/storages/inMemory/LatenciesCacheInMemory.d.ts +20 -0
  301. package/types/storages/inMemory/MySegmentsCacheInMemory.d.ts +22 -0
  302. package/types/storages/inMemory/SegmentsCacheInMemory.d.ts +19 -0
  303. package/types/storages/inMemory/SplitsCacheInMemory.d.ts +20 -0
  304. package/types/storages/inMemory/TelemetryCacheInMemory.d.ts +53 -0
  305. package/types/storages/inMemory/uniqueKeysCacheInMemory.d.ts +35 -0
  306. package/types/storages/inMemory/uniqueKeysCacheInMemoryCS.d.ts +37 -0
  307. package/types/storages/inRedis/CountsCacheInRedis.d.ts +9 -0
  308. package/types/storages/inRedis/EventsCacheInRedis.d.ts +32 -0
  309. package/types/storages/inRedis/ImpressionCountsCacheInRedis.d.ts +13 -0
  310. package/types/storages/inRedis/ImpressionsCacheInRedis.d.ts +18 -0
  311. package/types/storages/inRedis/LatenciesCacheInRedis.d.ts +9 -0
  312. package/types/storages/inRedis/RedisAdapter.d.ts +24 -0
  313. package/types/storages/inRedis/SegmentsCacheInRedis.d.ts +18 -0
  314. package/types/storages/inRedis/SplitsCacheInRedis.d.ts +91 -0
  315. package/types/storages/inRedis/TelemetryCacheInRedis.d.ts +20 -0
  316. package/types/storages/inRedis/constants.d.ts +4 -0
  317. package/types/storages/inRedis/index.d.ts +10 -0
  318. package/types/storages/inRedis/uniqueKeysCacheInRedis.d.ts +14 -0
  319. package/types/storages/metadataBuilder.d.ts +3 -0
  320. package/types/storages/pluggable/EventsCachePluggable.d.ts +38 -0
  321. package/types/storages/pluggable/ImpressionsCachePluggable.d.ts +35 -0
  322. package/types/storages/pluggable/SegmentsCachePluggable.d.ts +54 -0
  323. package/types/storages/pluggable/SplitsCachePluggable.d.ts +89 -0
  324. package/types/storages/pluggable/TelemetryCachePluggable.d.ts +18 -0
  325. package/types/storages/pluggable/constants.d.ts +1 -0
  326. package/types/storages/pluggable/inMemoryWrapper.d.ts +13 -0
  327. package/types/storages/pluggable/index.d.ts +9 -0
  328. package/types/storages/pluggable/wrapperAdapter.d.ts +12 -0
  329. package/types/storages/types.d.ts +414 -0
  330. package/types/sync/offline/LocalhostFromFile.d.ts +2 -0
  331. package/types/sync/offline/LocalhostFromObject.d.ts +2 -0
  332. package/types/sync/offline/splitsParser/parseCondition.d.ts +7 -0
  333. package/types/sync/offline/splitsParser/splitsParserFromFile.d.ts +2 -0
  334. package/types/sync/offline/splitsParser/splitsParserFromSettings.d.ts +3 -0
  335. package/types/sync/offline/splitsParser/types.d.ts +3 -0
  336. package/types/sync/offline/syncManagerOffline.d.ts +10 -0
  337. package/types/sync/offline/syncTasks/fromObjectSyncTask.d.ts +17 -0
  338. package/types/sync/polling/fetchers/mySegmentsFetcher.d.ts +7 -0
  339. package/types/sync/polling/fetchers/segmentChangesFetcher.d.ts +7 -0
  340. package/types/sync/polling/fetchers/splitChangesFetcher.d.ts +7 -0
  341. package/types/sync/polling/fetchers/types.d.ts +5 -0
  342. package/types/sync/polling/pollingManagerCS.d.ts +7 -0
  343. package/types/sync/polling/pollingManagerSS.d.ts +6 -0
  344. package/types/sync/polling/syncTasks/mySegmentsSyncTask.d.ts +9 -0
  345. package/types/sync/polling/syncTasks/segmentsSyncTask.d.ts +9 -0
  346. package/types/sync/polling/syncTasks/splitsSyncTask.d.ts +9 -0
  347. package/types/sync/polling/types.d.ts +26 -0
  348. package/types/sync/polling/updaters/mySegmentsUpdater.d.ts +13 -0
  349. package/types/sync/polling/updaters/segmentChangesUpdater.d.ts +18 -0
  350. package/types/sync/polling/updaters/splitChangesUpdater.d.ts +39 -0
  351. package/types/sync/streaming/AuthClient/index.d.ts +12 -0
  352. package/types/sync/streaming/AuthClient/types.d.ts +17 -0
  353. package/types/sync/streaming/SSEClient/index.d.ts +34 -0
  354. package/types/sync/streaming/SSEClient/types.d.ts +11 -0
  355. package/types/sync/streaming/SSEHandler/NotificationKeeper.d.ts +14 -0
  356. package/types/sync/streaming/SSEHandler/NotificationParser.d.ts +20 -0
  357. package/types/sync/streaming/SSEHandler/index.d.ts +11 -0
  358. package/types/sync/streaming/SSEHandler/types.d.ts +67 -0
  359. package/types/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.d.ts +6 -0
  360. package/types/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.d.ts +8 -0
  361. package/types/sync/streaming/UpdateWorkers/SplitsUpdateWorker.d.ts +12 -0
  362. package/types/sync/streaming/UpdateWorkers/constants.d.ts +3 -0
  363. package/types/sync/streaming/UpdateWorkers/types.d.ts +4 -0
  364. package/types/sync/streaming/constants.d.ts +34 -0
  365. package/types/sync/streaming/mySegmentsV2utils.d.ts +27 -0
  366. package/types/sync/streaming/pushManager.d.ts +9 -0
  367. package/types/sync/streaming/types.d.ts +35 -0
  368. package/types/sync/submitters/eventsSubmitter.d.ts +5 -0
  369. package/types/sync/submitters/eventsSyncTask.d.ts +8 -0
  370. package/types/sync/submitters/impressionCountsSubmitter.d.ts +10 -0
  371. package/types/sync/submitters/impressionCountsSubmitterInRedis.d.ts +5 -0
  372. package/types/sync/submitters/impressionCountsSyncTask.d.ts +13 -0
  373. package/types/sync/submitters/impressionsSubmitter.d.ts +11 -0
  374. package/types/sync/submitters/impressionsSyncTask.d.ts +14 -0
  375. package/types/sync/submitters/metricsSyncTask.d.ts +12 -0
  376. package/types/sync/submitters/submitter.d.ts +12 -0
  377. package/types/sync/submitters/submitterManager.d.ts +3 -0
  378. package/types/sync/submitters/submitterSyncTask.d.ts +10 -0
  379. package/types/sync/submitters/telemetrySubmitter.d.ts +25 -0
  380. package/types/sync/submitters/types.d.ts +194 -0
  381. package/types/sync/submitters/uniqueKeysSubmitter.d.ts +5 -0
  382. package/types/sync/submitters/uniqueKeysSubmitterInRedis.d.ts +5 -0
  383. package/types/sync/syncManagerOnline.d.ts +13 -0
  384. package/types/sync/syncTask.d.ts +13 -0
  385. package/types/sync/syncTaskComposite.d.ts +5 -0
  386. package/types/sync/types.d.ts +43 -0
  387. package/types/trackers/eventTracker.d.ts +10 -0
  388. package/types/trackers/filter/bloomFilter.d.ts +10 -0
  389. package/types/trackers/filter/dictionaryFilter.d.ts +8 -0
  390. package/types/trackers/filter/types.d.ts +5 -0
  391. package/types/trackers/impressionObserver/ImpressionObserver.d.ts +8 -0
  392. package/types/trackers/impressionObserver/buildKey.d.ts +2 -0
  393. package/types/trackers/impressionObserver/impressionObserverCS.d.ts +4 -0
  394. package/types/trackers/impressionObserver/impressionObserverSS.d.ts +4 -0
  395. package/types/trackers/impressionObserver/types.d.ts +4 -0
  396. package/types/trackers/impressionObserver/utils.d.ts +13 -0
  397. package/types/trackers/impressionsTracker.d.ts +13 -0
  398. package/types/trackers/strategy/strategyDebug.d.ts +9 -0
  399. package/types/trackers/strategy/strategyNone.d.ts +10 -0
  400. package/types/trackers/strategy/strategyOptimized.d.ts +11 -0
  401. package/types/trackers/telemetryTracker.d.ts +3 -0
  402. package/types/trackers/types.d.ts +57 -0
  403. package/types/trackers/uniqueKeysTracker.d.ts +13 -0
  404. package/types/types.d.ts +1263 -0
  405. package/types/utils/Backoff.d.ts +25 -0
  406. package/types/utils/LRUCache/LinkedList.d.ts +34 -0
  407. package/types/utils/LRUCache/index.d.ts +16 -0
  408. package/types/utils/MinEventEmitter.d.ts +12 -0
  409. package/types/utils/MinEvents.d.ts +4 -0
  410. package/types/utils/base64/index.d.ts +30 -0
  411. package/types/utils/constants/browser.d.ts +3 -0
  412. package/types/utils/constants/index.d.ts +64 -0
  413. package/types/utils/decompress/index.d.ts +16 -0
  414. package/types/utils/env/isLocalStorageAvailable.d.ts +1 -0
  415. package/types/utils/env/isNode.d.ts +5 -0
  416. package/types/utils/inputValidation/apiKey.d.ts +7 -0
  417. package/types/utils/inputValidation/attribute.d.ts +2 -0
  418. package/types/utils/inputValidation/attributes.d.ts +4 -0
  419. package/types/utils/inputValidation/event.d.ts +2 -0
  420. package/types/utils/inputValidation/eventProperties.d.ts +6 -0
  421. package/types/utils/inputValidation/eventValue.d.ts +2 -0
  422. package/types/utils/inputValidation/index.d.ts +13 -0
  423. package/types/utils/inputValidation/isOperational.d.ts +4 -0
  424. package/types/utils/inputValidation/key.d.ts +3 -0
  425. package/types/utils/inputValidation/preloadedData.d.ts +3 -0
  426. package/types/utils/inputValidation/split.d.ts +2 -0
  427. package/types/utils/inputValidation/splitExistance.d.ts +7 -0
  428. package/types/utils/inputValidation/splits.d.ts +2 -0
  429. package/types/utils/inputValidation/trafficType.d.ts +2 -0
  430. package/types/utils/inputValidation/trafficTypeExistance.d.ts +9 -0
  431. package/types/utils/jwt/index.d.ts +5 -0
  432. package/types/utils/jwt/types.d.ts +5 -0
  433. package/types/utils/key/index.d.ts +8 -0
  434. package/types/utils/labels/index.d.ts +7 -0
  435. package/types/utils/lang/binarySearch.d.ts +9 -0
  436. package/types/utils/lang/getFnName.d.ts +4 -0
  437. package/types/utils/lang/getGlobal.d.ts +4 -0
  438. package/types/utils/lang/index.d.ts +105 -0
  439. package/types/utils/lang/maps.d.ts +55 -0
  440. package/types/utils/lang/objectAssign.d.ts +3 -0
  441. package/types/utils/lang/sets.d.ts +60 -0
  442. package/types/utils/murmur3/common.d.ts +12 -0
  443. package/types/utils/murmur3/legacy.d.ts +2 -0
  444. package/types/utils/murmur3/murmur3.d.ts +2 -0
  445. package/types/utils/murmur3/murmur3_128.d.ts +6 -0
  446. package/types/utils/murmur3/murmur3_128_x86.d.ts +7 -0
  447. package/types/utils/murmur3/murmur3_64.d.ts +10 -0
  448. package/types/utils/murmur3/utfx.d.ts +27 -0
  449. package/types/utils/promise/thenable.d.ts +1 -0
  450. package/types/utils/promise/timeout.d.ts +1 -0
  451. package/types/utils/promise/wrapper.d.ts +21 -0
  452. package/types/utils/settingsValidation/consent.d.ts +6 -0
  453. package/types/utils/settingsValidation/impressionsMode.d.ts +3 -0
  454. package/types/utils/settingsValidation/index.d.ts +52 -0
  455. package/types/utils/settingsValidation/integrations/common.d.ts +14 -0
  456. package/types/utils/settingsValidation/integrations/configurable.d.ts +13 -0
  457. package/types/utils/settingsValidation/integrations/pluggable.d.ts +13 -0
  458. package/types/utils/settingsValidation/localhost/builtin.d.ts +16 -0
  459. package/types/utils/settingsValidation/localhost/pluggable.d.ts +16 -0
  460. package/types/utils/settingsValidation/logger/builtinLogger.d.ts +10 -0
  461. package/types/utils/settingsValidation/logger/commons.d.ts +9 -0
  462. package/types/utils/settingsValidation/logger/pluggableLogger.d.ts +11 -0
  463. package/types/utils/settingsValidation/mode.d.ts +1 -0
  464. package/types/utils/settingsValidation/runtime.d.ts +2 -0
  465. package/types/utils/settingsValidation/splitFilters.d.ts +16 -0
  466. package/types/utils/settingsValidation/storage/storageCS.d.ts +21 -0
  467. package/types/utils/settingsValidation/types.d.ts +32 -0
  468. package/types/utils/settingsValidation/url.d.ts +10 -0
  469. package/types/utils/time/index.d.ts +4 -0
  470. package/types/utils/timeTracker/index.d.ts +70 -0
  471. package/types/utils/timeTracker/now/browser.d.ts +1 -0
  472. package/types/utils/timeTracker/now/node.d.ts +1 -0
  473. package/types/utils/timeTracker/timer.d.ts +1 -0
  474. package/src/logger/.DS_Store +0 -0
  475. package/src/types.d.ts +0 -1581
package/src/types.d.ts DELETED
@@ -1,1581 +0,0 @@
1
- /* eslint-disable no-use-before-define */
2
- // Common type definitions for Split Software SDKs based on Javascript
3
- // Project: http://www.split.io/
4
- // Definitions by: Nico Zelaya <https://github.com/NicoZelaya/>
5
-
6
- /// <reference types="google.analytics" />
7
-
8
- export as namespace SplitIO;
9
- export = SplitIO;
10
-
11
- /****** Exposed namespace ******/
12
- /**
13
- * Types and interfaces for @splitsoftware/splitio package for usage when integrating javascript sdk on typescript apps.
14
- * For the SDK package information
15
- * @see {@link https://www.npmjs.com/package/@splitsoftware/splitio}
16
- */
17
- declare namespace SplitIO {
18
- /**
19
- * Reduced version of NodeJS.EventEmitter interface with the minimal methods used by the SDK
20
- * @see {@link https://nodejs.org/api/events.html}
21
- */
22
- interface IEventEmitter {
23
- addListener(event: string, listener: (...args: any[]) => void): this
24
- on(event: string, listener: (...args: any[]) => void): this
25
- once(event: string, listener: (...args: any[]) => void): this
26
- removeListener(event: string, listener: (...args: any[]) => void): this
27
- off(event: string, listener: (...args: any[]) => void): this
28
- removeAllListeners(event?: string): this
29
- emit(event: string, ...args: any[]): boolean
30
- }
31
- /**
32
- * impression DTO generated by the Sdk client when processing evaluations
33
- */
34
- type ImpressionDTO = {
35
- feature: string,
36
- keyName: string,
37
- treatment: string,
38
- time: number,
39
- bucketingKey?: string,
40
- label: string,
41
- changeNumber: number,
42
- pt?: number,
43
- }
44
- /**
45
- * @typedef {Object} EventConsts
46
- * @property {string} SDK_READY The ready event.
47
- * @property {string} SDK_READY_FROM_CACHE The ready event when fired with cached data.
48
- * @property {string} SDK_READY_TIMED_OUT The timeout event.
49
- * @property {string} SDK_UPDATE The update event.
50
- */
51
- type EventConsts = {
52
- SDK_READY: 'init::ready',
53
- SDK_READY_FROM_CACHE: 'init::cache-ready',
54
- SDK_READY_TIMED_OUT: 'init::timeout',
55
- SDK_UPDATE: 'state::update'
56
- };
57
- /**
58
- * SDK Modes.
59
- * @typedef {string} SDKMode
60
- */
61
- type SDKMode = 'standalone' | 'localhost' | 'consumer' | 'consumer_partial';
62
- /**
63
- * Storage types.
64
- * @typedef {string} StorageType
65
- */
66
- type StorageType = 'MEMORY' | 'LOCALSTORAGE' | 'REDIS' | 'PLUGGABLE';
67
- /**
68
- * Settings interface. This is a representation of the settings the SDK expose, that's why
69
- * most of it's props are readonly. Only features should be rewritten when localhost mode is active.
70
- * @interface ISettings
71
- */
72
- interface ISettings {
73
- readonly core: {
74
- authorizationKey: string,
75
- key?: SplitKey,
76
- trafficType?: string,
77
- labelsEnabled: boolean,
78
- IPAddressesEnabled?: boolean
79
- },
80
- readonly mode: SDKMode,
81
- readonly scheduler: {
82
- featuresRefreshRate: number,
83
- impressionsRefreshRate: number,
84
- impressionsQueueSize: number,
85
- /**
86
- * @deprecated
87
- */
88
- metricsRefreshRate?: number,
89
- telemetryRefreshRate: number,
90
- segmentsRefreshRate: number,
91
- offlineRefreshRate: number,
92
- eventsPushRate: number,
93
- eventsQueueSize: number,
94
- pushRetryBackoffBase: number
95
- },
96
- readonly startup: {
97
- readyTimeout: number,
98
- requestTimeoutBeforeReady: number,
99
- retriesOnFailureBeforeReady: number,
100
- eventsFirstPushWindow: number
101
- },
102
- readonly storage: {
103
- prefix: string,
104
- options: Object,
105
- type: StorageType
106
- } | StorageSyncFactory | StorageAsyncFactory,
107
- readonly urls: {
108
- events: string,
109
- sdk: string,
110
- auth: string,
111
- streaming: string,
112
- telemetry: string
113
- },
114
- readonly integrations?: BrowserIntegration[] | IntegrationFactory[],
115
- readonly debug: boolean | LogLevel | ILogger,
116
- readonly version: string,
117
- /**
118
- * Mocked features map.
119
- */
120
- features?: MockedFeaturesMap | MockedFeaturesFilePath,
121
- readonly streamingEnabled: boolean,
122
- readonly sync: {
123
- splitFilters: SplitFilter[],
124
- impressionsMode: ImpressionsMode,
125
- enabled: boolean,
126
- localhostMode?: LocalhostFactory,
127
- __splitFiltersValidation: ISplitFiltersValidation,
128
- },
129
- readonly runtime: {
130
- ip: string | false
131
- hostname: string | false
132
- },
133
- readonly log: ILogger
134
- readonly impressionListener?: unknown
135
- /**
136
- * User consent status if using in browser. Undefined if using in NodeJS.
137
- */
138
- readonly userConsent?: ConsentStatus
139
- }
140
- /**
141
- * Log levels.
142
- * @typedef {string} LogLevel
143
- */
144
- type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR' | 'NONE';
145
- /**
146
- * Logger API
147
- * @interface ILoggerAPI
148
- */
149
- interface ILoggerAPI {
150
- /**
151
- * Enables SDK logging to the console.
152
- * @function enable
153
- * @returns {void}
154
- */
155
- enable(): void,
156
- /**
157
- * Disables SDK logging.
158
- * @function disable
159
- * @returns {void}
160
- */
161
- disable(): void,
162
- /**
163
- * Sets a log level for the SDK logs.
164
- * @function setLogLevel
165
- * @returns {void}
166
- */
167
- setLogLevel(logLevel: LogLevel): void,
168
- /**
169
- * Log level constants. Use this to pass them to setLogLevel function.
170
- */
171
- LogLevel: {
172
- [level in LogLevel]: LogLevel
173
- }
174
- }
175
- /**
176
- * User consent API
177
- * @interface IUserConsentAPI
178
- */
179
- interface IUserConsentAPI {
180
- /**
181
- * Set or update the user consent status. Possible values are `true` and `false`, which represent user consent `'GRANTED'` and `'DECLINED'` respectively.
182
- * - `true ('GRANTED')`: the user has granted consent for tracking events and impressions. The SDK will send them to Split cloud.
183
- * - `false ('DECLINED')`: the user has declined consent for tracking events and impressions. The SDK will not send them to Split cloud.
184
- *
185
- * NOTE: calling this method updates the user consent at a factory level, affecting all clients of the same factory.
186
- *
187
- * @function setStatus
188
- * @param {boolean} userConsent The user consent status, true for 'GRANTED' and false for 'DECLINED'.
189
- * @returns {boolean} Whether the provided param is a valid value (i.e., a boolean value) or not.
190
- */
191
- setStatus(userConsent: boolean): boolean;
192
- /**
193
- * Get the user consent status.
194
- *
195
- * @function getStatus
196
- * @returns {ConsentStatus} The user consent status.
197
- */
198
- getStatus(): ConsentStatus;
199
- /**
200
- * Consent status constants. Use this to compare with the getStatus function result.
201
- */
202
- Status: {
203
- [status in ConsentStatus]: ConsentStatus
204
- }
205
- }
206
- /**
207
- * Common settings between Browser and NodeJS settings interface.
208
- * @interface ISharedSettings
209
- */
210
- interface ISharedSettings {
211
- /**
212
- * SDK Core settings.
213
- * @property {Object} core
214
- */
215
- core: {
216
- /**
217
- * Your API key. More information: @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
218
- * @property {string} authorizationKey
219
- */
220
- authorizationKey: string,
221
- /**
222
- * Disable labels from being sent to Split backend. Labels may contain sensitive information.
223
- * This configuration is applicable if the SDK is running in "standalone" or "partial consumer" mode.
224
- * @property {boolean} labelsEnabled
225
- * @default true
226
- */
227
- labelsEnabled?: boolean
228
- },
229
- /**
230
- * The SDK mode. Possible values are "standalone", which is the default when using a synchronous storage, like 'MEMORY' and 'LOCALSTORAGE',
231
- * and "consumer", which must be set when using an asynchronous storage, like 'REDIS'. For "localhost" mode, use "localhost" as authorizationKey.
232
- * @property {SDKMode} mode
233
- * @default standalone
234
- */
235
- mode?: SDKMode,
236
- /**
237
- * The impression listener, which is optional. Whatever you provide here needs to comply with the IImpressionListener interface,
238
- * which will check for the logImpression method.
239
- * @property {IImpressionListener} impressionListener
240
- * @default undefined
241
- */
242
- impressionListener?: IImpressionListener,
243
- /**
244
- * Boolean flag to enable the streaming service as default synchronization mechanism. In the event of any issue with streaming,
245
- * the SDK would fallback to the polling mechanism. If false, the SDK would poll for changes as usual without attempting to use streaming.
246
- * This configuration is applicable if the SDK is running in "standalone" mode.
247
- * @property {boolean} streamingEnabled
248
- * @default true
249
- */
250
- streamingEnabled?: boolean,
251
- /**
252
- * SDK synchronization settings.
253
- * @property {Object} sync
254
- */
255
- sync?: {
256
- /**
257
- * List of Split filters. These filters are used to fetch a subset of the Splits definitions in your environment, in order to reduce the delay of the SDK to be ready.
258
- * This configuration is applicable if the SDK is running in "standalone" mode.
259
- *
260
- * At the moment, two types of split filters are supported: by name and by prefix.
261
- *
262
- * Example:
263
- * `splitFilter: [
264
- * { type: 'byName', values: ['my_split_1', 'my_split_2'] }, // will fetch splits named 'my_split_1' and 'my_split_2'
265
- * { type: 'byPrefix', values: ['testing'] } // will fetch splits whose names start with 'testing__' prefix
266
- * ]`
267
- * @property {SplitFilter[]} splitFilters
268
- */
269
- splitFilters?: SplitFilter[]
270
- /**
271
- * Impressions Collection Mode. Option to determine how impressions are going to be sent to Split Servers.
272
- * Possible values are 'DEBUG' and 'OPTIMIZED'.
273
- * - DEBUG: will send all the impressions generated (recommended only for debugging purposes).
274
- * - OPTIMIZED: will send unique impressions to Split Servers avoiding a considerable amount of traffic that duplicated impressions could generate.
275
- * @property {string} impressionsMode
276
- * @default 'OPTIMIZED'
277
- */
278
- impressionsMode?: ImpressionsMode,
279
- /**
280
- * Controls the SDK continuous synchronization flags.
281
- *
282
- * When `true` a running SDK will process rollout plan updates performed on the UI (default).
283
- * When false it'll just fetch all data upon init.
284
- * This configuration is applicable if the SDK is running in "standalone" mode.
285
- *
286
- * @property {boolean} enabled
287
- * @default true
288
- */
289
- enabled?: boolean
290
- },
291
- /**
292
- * List of URLs that the SDK will use as base for it's synchronization functionalities.
293
- * This configuration is applicable if the SDK is running in "standalone" or "partial consumer" mode.
294
- * Do not change these settings unless you're working an advanced use case, like connecting to the Split proxy.
295
- * @property {Object} urls
296
- */
297
- urls?: UrlSettings,
298
- }
299
- /**
300
- * Common API for entities that expose status handlers.
301
- * @interface IStatusInterface
302
- * @extends IEventEmitter
303
- */
304
- interface IStatusInterface extends IEventEmitter {
305
- /**
306
- * Constant object containing the SDK events for you to use.
307
- * @property {EventConsts} Event
308
- */
309
- Event: EventConsts,
310
- /**
311
- * Returns a promise that will be resolved once the SDK has finished loading (SDK_READY event emitted) or rejected if the SDK has timedout (SDK_READY_TIMED_OUT event emitted).
312
- * As it's meant to provide similar flexibility to the event approach, given that the SDK might be eventually ready after a timeout event, calling the `ready` method after the
313
- * SDK had timed out will return a new promise that should eventually resolve if the SDK gets ready.
314
- *
315
- * Caveats: the method was designed to avoid an unhandled Promise rejection if the rejection case is not handled, so that `onRejected` handler is optional when using promises.
316
- * However, when using async/await syntax, the rejection should be explicitly propagated like in the following example:
317
- * ```
318
- * try {
319
- * await client.ready().catch((e) => { throw e; });
320
- * // SDK is ready
321
- * } catch(e) {
322
- * // SDK has timedout
323
- * }
324
- * ```
325
- *
326
- * @function ready
327
- * @returns {Promise<void>}
328
- */
329
- ready(): Promise<void>
330
- }
331
- /**
332
- * Common definitions between clients for different environments interface.
333
- * @interface IBasicClient
334
- * @extends IStatusInterface
335
- */
336
- interface IBasicClient extends IStatusInterface {
337
- /**
338
- * Destroy the client instance.
339
- * @function destroy
340
- * @returns {Promise<void>}
341
- */
342
- destroy(): Promise<void>
343
- }
344
-
345
- /**
346
- * Split treatment value, returned by getTreatment.
347
- * @typedef {string} Treatment
348
- */
349
- type Treatment = string;
350
- /**
351
- * Split treatment promise that will resolve to actual treatment value.
352
- * @typedef {Promise<string>} AsyncTreatment
353
- */
354
- type AsyncTreatment = Promise<string>;
355
- /**
356
- * An object with the treatments for a bulk of splits, returned by getTreatments. For example:
357
- * {
358
- * feature1: 'on',
359
- * feature2: 'off
360
- * }
361
- * @typedef {Object.<Treatment>} Treatments
362
- */
363
- type Treatments = {
364
- [featureName: string]: Treatment
365
- };
366
- /**
367
- * Split treatments promise that will resolve to the actual Treatments object.
368
- * @typedef {Promise<Treatments>} AsyncTreatments
369
- */
370
- type AsyncTreatments = Promise<Treatments>;
371
- /**
372
- * Split evaluation result with treatment and configuration, returned by getTreatmentWithConfig.
373
- * @typedef {Object} TreatmentWithConfig
374
- * @property {string} treatment The treatment result
375
- * @property {string | null} config The stringified version of the JSON config defined for that treatment, null if there is no config for the resulting treatment.
376
- */
377
- type TreatmentWithConfig = {
378
- treatment: string,
379
- config: string | null
380
- };
381
- /**
382
- * Split treatment promise that will resolve to actual treatment with config value.
383
- * @typedef {Promise<TreatmentWithConfig>} AsyncTreatmentWithConfig
384
- */
385
- type AsyncTreatmentWithConfig = Promise<TreatmentWithConfig>;
386
- /**
387
- * An object with the treatments with configs for a bulk of splits, returned by getTreatmentsWithConfig.
388
- * Each existing configuration is a stringified version of the JSON you defined on the Split web console. For example:
389
- * {
390
- * feature1: { treatment: 'on', config: null }
391
- * feature2: { treatment: 'off', config: '{"bannerText":"Click here."}' }
392
- * }
393
- * @typedef {Object.<TreatmentWithConfig>} Treatments
394
- */
395
- type TreatmentsWithConfig = {
396
- [featureName: string]: TreatmentWithConfig
397
- };
398
- /**
399
- * Split treatments promise that will resolve to the actual TreatmentsWithConfig object.
400
- * @typedef {Promise<TreatmentsWithConfig>} AsyncTreatmentsWithConfig
401
- */
402
- type AsyncTreatmentsWithConfig = Promise<TreatmentsWithConfig>;
403
- /**
404
- * Possible Split SDK events.
405
- * @typedef {string} Event
406
- */
407
- type Event = 'init::timeout' | 'init::ready' | 'init::cache-ready' | 'state::update';
408
- /**
409
- * Split attributes should be on object with values of type string, boolean, number (dates should be sent as millis since epoch) or array of strings or numbers.
410
- * @typedef {Object.<AttributeType>} Attributes
411
- * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#attribute-syntax}
412
- */
413
- type Attributes = {
414
- [attributeName: string]: AttributeType
415
- };
416
- /**
417
- * Type of an attribute value
418
- * @typedef {string | number | boolean | Array<string | number>} AttributeType
419
- */
420
- type AttributeType = string | number | boolean | Array<string | number>;
421
- /**
422
- * Split properties should be an object with values of type string, number, boolean or null. Size limit of ~31kb.
423
- * @typedef {Object.<number, string, boolean, null>} Properties
424
- * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#track
425
- */
426
- type Properties = {
427
- [propertyName: string]: string | number | boolean | null
428
- };
429
- /**
430
- * The SplitKey object format.
431
- * @typedef {Object.<string>} SplitKeyObject
432
- */
433
- type SplitKeyObject = {
434
- matchingKey: string,
435
- bucketingKey: string
436
- };
437
- /**
438
- * The customer identifier. Could be a SplitKeyObject or a string.
439
- * @typedef {SplitKeyObject|string} SplitKey
440
- */
441
- type SplitKey = SplitKeyObject | string;
442
- /**
443
- * Path to file with mocked features (for node).
444
- * @typedef {string} MockedFeaturesFilePath
445
- */
446
- type MockedFeaturesFilePath = string;
447
- /**
448
- * Object with mocked features mapping (for browser). We need to specify the featureName as key, and the mocked treatment as value.
449
- * @typedef {Object} MockedFeaturesMap
450
- */
451
- type MockedFeaturesMap = {
452
- [featureName: string]: string | TreatmentWithConfig
453
- };
454
- /**
455
- * Localhost types.
456
- * @typedef {string} LocalhostType
457
- */
458
- type LocalhostType = 'LocalhostFromObject'
459
- /**
460
- * Object with information about an impression. It contains the generated impression DTO as well as
461
- * complementary information around where and how it was generated in that way.
462
- * @typedef {Object} ImpressionData
463
- */
464
- type ImpressionData = {
465
- impression: ImpressionDTO,
466
- attributes?: Attributes,
467
- ip: string | false,
468
- hostname: string | false,
469
- sdkLanguageVersion: string
470
- };
471
- /**
472
- * Data corresponding to one Split view.
473
- * @typedef {Object} SplitView
474
- */
475
- type SplitView = {
476
- /**
477
- * The name of the split.
478
- * @property {string} name
479
- */
480
- name: string,
481
- /**
482
- * The traffic type of the split.
483
- * @property {string} trafficType
484
- */
485
- trafficType: string,
486
- /**
487
- * Whether the split is killed or not.
488
- * @property {boolean} killed
489
- */
490
- killed: boolean,
491
- /**
492
- * The list of treatments available for the split.
493
- * @property {Array<string>} treatments
494
- */
495
- treatments: Array<string>,
496
- /**
497
- * Current change number of the split.
498
- * @property {number} changeNumber
499
- */
500
- changeNumber: number,
501
- /**
502
- * Map of configurations per treatment.
503
- * Each existing configuration is a stringified version of the JSON you defined on the Split web console.
504
- * @property {Object.<string>} configs
505
- */
506
- configs: {
507
- [treatmentName: string]: string
508
- }
509
- };
510
- /**
511
- * A promise that will be resolved with that SplitView or null if the split is not found.
512
- * @typedef {Promise<SplitView | null>} SplitView
513
- */
514
- type SplitViewAsync = Promise<SplitView | null>;
515
- /**
516
- * An array containing the SplitView elements.
517
- */
518
- type SplitViews = Array<SplitView>;
519
- /**
520
- * A promise that will be resolved with an SplitViews array.
521
- * @typedef {Promise<SplitViews>} SplitViewsAsync
522
- */
523
- type SplitViewsAsync = Promise<SplitViews>;
524
- /**
525
- * An array of split names.
526
- * @typedef {Array<string>} SplitNames
527
- */
528
- type SplitNames = Array<string>;
529
- /**
530
- * A promise that will be resolved with an array of split names.
531
- * @typedef {Promise<SplitNames>} SplitNamesAsync
532
- */
533
- type SplitNamesAsync = Promise<SplitNames>;
534
- /**
535
- * Synchronous storage valid types for NodeJS.
536
- * @typedef {string} NodeSyncStorage
537
- */
538
- type NodeSyncStorage = 'MEMORY';
539
- /**
540
- * Asynchronous storages valid types for NodeJS.
541
- * @typedef {string} NodeAsyncStorage
542
- */
543
- type NodeAsyncStorage = 'REDIS';
544
- /**
545
- * Storage valid types for the browser.
546
- * @typedef {string} BrowserStorage
547
- */
548
- type BrowserStorage = 'MEMORY' | 'LOCALSTORAGE';
549
- /**
550
- * Storage for synchronous (standalone) SDK.
551
- * Its interface details are not part of the public API.
552
- */
553
- type StorageSync = any;
554
- /**
555
- * Storage builder for synchronous (standalone) SDK.
556
- * By returning undefined, the SDK will use the default IN MEMORY storage.
557
- * Input parameter details are not part of the public API.
558
- */
559
- type StorageSyncFactory = {
560
- readonly type: StorageType
561
- (params: any): (StorageSync | undefined)
562
- }
563
- /**
564
- * Configuration params for `InLocalStorage`
565
- */
566
- type InLocalStorageOptions = {
567
- /**
568
- * Optional prefix to prevent any kind of data collision when having multiple factories using the same storage type.
569
- * @property {string} prefix
570
- * @default SPLITIO
571
- */
572
- prefix?: string
573
- }
574
- /**
575
- * Storage for asynchronous (consumer) SDK.
576
- * Its interface details are not part of the public API.
577
- */
578
- type StorageAsync = any
579
- /**
580
- * Storage builder for asynchronous (consumer) SDK.
581
- * Input parameter details are not part of the public API.
582
- */
583
- type StorageAsyncFactory = {
584
- readonly type: StorageType
585
- (params: any): StorageAsync
586
- }
587
- /**
588
- * Configuration params for `PluggableStorage`
589
- */
590
- type PluggableStorageOptions = {
591
- /**
592
- * Optional prefix to prevent any kind of data collision when having multiple factories using the same storage wrapper.
593
- * @property {string} prefix
594
- * @default SPLITIO
595
- */
596
- prefix?: string,
597
- /**
598
- * Storage wrapper.
599
- * @property {Object} wrapper
600
- */
601
- wrapper: Object
602
- }
603
- /**
604
- * Localhost mode factory.
605
- * Its interface details are not part of the public API.
606
- */
607
- type LocalhostFactory = {
608
- readonly type: LocalhostType
609
- (params: any): any
610
- }
611
- /**
612
- * Impression listener interface. This is the interface that needs to be implemented
613
- * by the element you provide to the SDK as impression listener.
614
- * @interface IImpressionListener
615
- * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#listener}
616
- */
617
- interface IImpressionListener {
618
- logImpression(data: ImpressionData): void
619
- }
620
- /**
621
- * SDK integration instance.
622
- * Its interface details are not part of the public API.
623
- */
624
- type Integration = any;
625
- /**
626
- * SDK integration factory.
627
- * By returning an integration, the SDK will queue events and impressions into it.
628
- * Input parameter details are not part of the public API.
629
- */
630
- type IntegrationFactory = {
631
- readonly type: string
632
- (params: any): (Integration | void)
633
- }
634
- /**
635
- * A pair of user key and it's trafficType, required for tracking valid Split events.
636
- * @typedef {Object} Identity
637
- * @property {string} key The user key.
638
- * @property {string} trafficType The key traffic type.
639
- */
640
- type Identity = {
641
- key: string;
642
- trafficType: string;
643
- };
644
- /**
645
- * Object with information about a Split event.
646
- * @typedef {Object} EventData
647
- */
648
- type EventData = {
649
- eventTypeId: string;
650
- value?: number;
651
- properties?: Properties;
652
- trafficTypeName?: string;
653
- key?: string;
654
- timestamp?: number;
655
- };
656
- /**
657
- * Enable 'Google Analytics to Split' integration, to track Google Analytics hits as Split events.
658
- *
659
- * @see {@link https://help.split.io/hc/en-us/articles/360040838752#google-analytics-to-split}
660
- */
661
- interface IGoogleAnalyticsToSplitConfig extends GoogleAnalyticsToSplitOptions {
662
- type: 'GOOGLE_ANALYTICS_TO_SPLIT',
663
- }
664
- /**
665
- * Configuration params for 'Google Analytics to Split' integration plugin, to track Google Analytics hits as Split events.
666
- *
667
- * @see {@link https://help.split.io/hc/en-us/articles/360040838752#google-analytics-to-split}
668
- */
669
- interface GoogleAnalyticsToSplitOptions {
670
- /**
671
- * Optional flag to filter GA hits from being tracked as Split events.
672
- * @property {boolean} hits
673
- * @default true
674
- */
675
- hits?: boolean,
676
- /**
677
- * Optional predicate used to define a custom filter for tracking GA hits as Split events.
678
- * For example, the following filter allows to track only 'event' hits:
679
- * `(model) => model.get('hitType') === 'event'`
680
- * By default, all hits are tracked as Split events.
681
- */
682
- filter?: (model: UniversalAnalytics.Model) => boolean,
683
- /**
684
- * Optional function useful when you need to modify the Split event before tracking it.
685
- * This function is invoked with two arguments:
686
- * 1. the GA model object representing the hit.
687
- * 2. the default format of the mapped Split event instance.
688
- * The return value must be a Split event, that can be the second argument or a new object.
689
- *
690
- * For example, the following mapper adds a custom property to events:
691
- * `(model, defaultMapping) => {
692
- * defaultMapping.properties.someProperty = SOME_VALUE;
693
- * return defaultMapping;
694
- * }`
695
- */
696
- mapper?: (model: UniversalAnalytics.Model, defaultMapping: EventData) => EventData,
697
- /**
698
- * Optional prefix for EventTypeId, to prevent any kind of data collision between events.
699
- * @property {string} prefix
700
- * @default 'ga'
701
- */
702
- prefix?: string,
703
- /**
704
- * List of Split identities (key & traffic type pairs) used to track events.
705
- * If not provided, events are sent using the key and traffic type provided at SDK config.
706
- */
707
- identities?: Identity[],
708
- /**
709
- * Optional flag to log an error if the `auto-require` script is not detected.
710
- * The auto-require script automatically requires the `splitTracker` plugin for created trackers,
711
- * and should be placed right after your Google Analytics, Google Tag Manager or gtag.js script tag.
712
- *
713
- * @see {@link https://help.split.io/hc/en-us/articles/360040838752#set-up-with-gtm-and-gtag.js}
714
- *
715
- * @property {boolean} autoRequire
716
- * @default false
717
- */
718
- autoRequire?: boolean,
719
- }
720
- /**
721
- * Object representing the data sent by Split (events and impressions).
722
- * @typedef {Object} IntegrationData
723
- * @property {string} type The type of Split data, either 'IMPRESSION' or 'EVENT'.
724
- * @property {ImpressionData | EventData} payload The data instance itself.
725
- */
726
- type IntegrationData = { type: 'IMPRESSION', payload: ImpressionData } | { type: 'EVENT', payload: EventData };
727
- /**
728
- * Enable 'Split to Google Analytics' integration, to track Split impressions and events as Google Analytics hits.
729
- *
730
- * @see {@link https://help.split.io/hc/en-us/articles/360040838752#split-to-google-analytics}
731
- */
732
- interface ISplitToGoogleAnalyticsConfig extends SplitToGoogleAnalyticsOptions {
733
- type: 'SPLIT_TO_GOOGLE_ANALYTICS',
734
- }
735
- /**
736
- * Configuration params for 'Split to Google Analytics' integration plugin, to track Split impressions and events as Google Analytics hits.
737
- *
738
- * @see {@link https://help.split.io/hc/en-us/articles/360040838752#split-to-google-analytics}
739
- */
740
- interface SplitToGoogleAnalyticsOptions {
741
- /**
742
- * Optional flag to filter Split impressions from being tracked as GA hits.
743
- * @property {boolean} impressions
744
- * @default true
745
- */
746
- impressions?: boolean,
747
- /**
748
- * Optional flag to filter Split events from being tracked as GA hits.
749
- * @property {boolean} events
750
- * @default true
751
- */
752
- events?: boolean,
753
- /**
754
- * Optional predicate used to define a custom filter for tracking Split data (events and impressions) as GA hits.
755
- * For example, the following filter allows to track only impressions, equivalent to setting events to false:
756
- * `(data) => data.type === 'IMPRESSION'`
757
- */
758
- filter?: (data: IntegrationData) => boolean,
759
- /**
760
- * Optional function useful when you need to modify the GA hit before sending it.
761
- * This function is invoked with two arguments:
762
- * 1. the input data (Split event or impression).
763
- * 2. the default format of the mapped FieldsObject instance (GA hit).
764
- * The return value must be a FieldsObject, that can be the second argument or a new object.
765
- *
766
- * For example, the following mapper adds a custom dimension to hits:
767
- * `(data, defaultMapping) => {
768
- * defaultMapping.dimension1 = SOME_VALUE;
769
- * return defaultMapping;
770
- * }`
771
- *
772
- * Default FieldsObject instance for data.type === 'IMPRESSION':
773
- * `{
774
- * hitType: 'event',
775
- * eventCategory: 'split-impression',
776
- * eventAction: 'Evaluate ' + data.payload.impression.feature,
777
- * eventLabel: 'Treatment: ' + data.payload.impression.treatment + '. Targeting rule: ' + data.payload.impression.label + '.',
778
- * nonInteraction: true,
779
- * }`
780
- * Default FieldsObject instance for data.type === 'EVENT':
781
- * `{
782
- * hitType: 'event',
783
- * eventCategory: 'split-event',
784
- * eventAction: data.payload.eventTypeId,
785
- * eventValue: data.payload.value,
786
- * nonInteraction: true,
787
- * }`
788
- */
789
- mapper?: (data: IntegrationData, defaultMapping: UniversalAnalytics.FieldsObject) => UniversalAnalytics.FieldsObject,
790
- /**
791
- * List of tracker names to send the hit. An empty string represents the default tracker.
792
- * If not provided, hits are only sent to default tracker.
793
- */
794
- trackerNames?: string[],
795
- }
796
- /**
797
- * Available URL settings for the SDKs.
798
- */
799
- type UrlSettings = {
800
- /**
801
- * String property to override the base URL where the SDK will get feature flagging related data like a Split rollout plan or segments information.
802
- * @property {string} sdk
803
- * @default 'https://sdk.split.io/api'
804
- */
805
- sdk?: string,
806
- /**
807
- * String property to override the base URL where the SDK will post event-related information like impressions.
808
- * @property {string} events
809
- * @default 'https://events.split.io/api'
810
- */
811
- events?: string,
812
- /**
813
- * String property to override the base URL where the SDK will get authorization tokens to be used with functionality that requires it, like streaming.
814
- * @property {string} auth
815
- * @default 'https://auth.split.io/api'
816
- */
817
- auth?: string,
818
- /**
819
- * String property to override the base URL where the SDK will connect to receive streaming updates.
820
- * @property {string} streaming
821
- * @default 'https://streaming.split.io'
822
- */
823
- streaming?: string,
824
- /**
825
- * String property to override the base URL where the SDK will post telemetry data.
826
- * @property {string} telemetry
827
- * @default 'https://telemetry.split.io/api'
828
- */
829
- telemetry?: string
830
- };
831
-
832
- /**
833
- * Available integration options for the browser
834
- */
835
- type BrowserIntegration = ISplitToGoogleAnalyticsConfig | IGoogleAnalyticsToSplitConfig;
836
- /**
837
- * SplitFilter type.
838
- * @typedef {string} SplitFilterType
839
- */
840
- type SplitFilterType = 'byName' | 'byPrefix';
841
- /**
842
- * Defines a split filter, described by a type and list of values.
843
- */
844
- interface SplitFilter {
845
- /**
846
- * Type of the filter.
847
- * @property {SplitFilterType} type
848
- */
849
- type: SplitFilterType,
850
- /**
851
- * List of values: split names for 'byName' filter type, and split prefixes for 'byPrefix' type.
852
- * @property {string[]} values
853
- */
854
- values: string[],
855
- }
856
- type ISplitFiltersValidation = {
857
- queryString: string | null,
858
- groupedFilters: Record<SplitFilterType, string[]>,
859
- validFilters: SplitFilter[]
860
- };
861
- /**
862
- * ImpressionsMode type
863
- * @typedef {string} ImpressionsMode
864
- */
865
- type ImpressionsMode = 'OPTIMIZED' | 'DEBUG';
866
- /**
867
- * User consent status.
868
- * @typedef {string} ConsentStatus
869
- */
870
- type ConsentStatus = 'GRANTED' | 'DECLINED' | 'UNKNOWN';
871
- /**
872
- * Logger
873
- * Its interface details are not part of the public API. It shouldn't be used directly.
874
- * @interface ILogger
875
- */
876
- interface ILogger {
877
- setLogLevel(logLevel: LogLevel): void
878
- debug(msg: any): void
879
- debug(msg: string | number, args?: any[]): void
880
- info(msg: any): void
881
- info(msg: string | number, args?: any[]): void
882
- warn(msg: any): void
883
- warn(msg: string | number, args?: any[]): void
884
- error(msg: any): void
885
- error(msg: string | number, args?: any[]): void
886
- }
887
- /**
888
- * Common settings interface with non-pluggable API (JS SDK).
889
- * @interface IStaticSettings
890
- */
891
- interface IStaticSettings {
892
- /**
893
- * Whether the logger should be enabled or disabled by default.
894
- * @property {Boolean} debug
895
- * @default false
896
- */
897
- debug?: boolean | LogLevel,
898
- }
899
- /**
900
- * Common settings interface with pluggable API (JS Browser and React Native SDKs).
901
- * @interface IPluggableSettings
902
- */
903
- interface IPluggableSettings {
904
- /**
905
- * Boolean value to indicate whether the logger should be enabled or disabled by default, or a log level string or a Logger object.
906
- * Passing a logger object is required to get descriptive log messages. Otherwise most logs will print with message codes.
907
- * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#logging}
908
- * @see {@link https://help.split.io/hc/en-us/articles/4406066357901-React-Native-SDK#logging}
909
- *
910
- * Examples:
911
- * ```typescript
912
- * config.debug = true
913
- * config.debug = 'WARN'
914
- * config.debug = ErrorLogger()
915
- * ```
916
- * @property {boolean | LogLevel | ILogger} debug
917
- * @default false
918
- */
919
- debug?: boolean | LogLevel | ILogger,
920
- }
921
- /**
922
- * Common settings interface for SDK instances on NodeJS.
923
- * @interface IServerSideSharedSettings
924
- * @extends ISharedSettings
925
- */
926
- interface IServerSideSharedSettings extends ISharedSettings {
927
- /**
928
- * SDK Core settings for NodeJS.
929
- * @property {Object} core
930
- */
931
- core: ISharedSettings['core'] & {
932
- /**
933
- * Disable machine IP and Name from being sent to Split backend.
934
- * @property {boolean} IPAddressesEnabled
935
- * @default true
936
- */
937
- IPAddressesEnabled?: boolean
938
- },
939
- /**
940
- * Mocked features file path. For testing purposses only. For using this you should specify "localhost" as authorizationKey on core settings.
941
- * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
942
- * @property {MockedFeaturesFilePath} features
943
- * @default $HOME/.split
944
- */
945
- features?: MockedFeaturesFilePath,
946
- /**
947
- * SDK Startup settings for NodeJS.
948
- * @property {Object} startup
949
- */
950
- startup?: {
951
- /**
952
- * Maximum amount of time used before notify a timeout.
953
- * @property {number} readyTimeout
954
- * @default 15
955
- */
956
- readyTimeout?: number,
957
- /**
958
- * Time to wait for a request before the SDK is ready. If this time expires, JS Sdk will retry 'retriesOnFailureBeforeReady' times before notifying its failure to be 'ready'.
959
- *
960
- * NOTE: this param is applicable in "standalone" mode.
961
- * @property {number} requestTimeoutBeforeReady
962
- * @default 15
963
- */
964
- requestTimeoutBeforeReady?: number,
965
- /**
966
- * How many quick retries we will do while starting up the SDK.
967
- *
968
- * NOTE: this param is applicable in "standalone" mode.
969
- * @property {number} retriesOnFailureBeforeReady
970
- * @default 1
971
- */
972
- retriesOnFailureBeforeReady?: number,
973
- /**
974
- * For SDK posts the queued events data in bulks with a given rate, but the first push window is defined separately,
975
- * to better control on browsers. This number defines that window before the first events push.
976
- *
977
- * NOTE: this param is ignored in "consumer" mode.
978
- * @property {number} eventsFirstPushWindow
979
- * @default 0
980
- */
981
- eventsFirstPushWindow?: number,
982
- },
983
- /**
984
- * SDK scheduler settings.
985
- * @property {Object} scheduler
986
- */
987
- scheduler?: {
988
- /**
989
- * The SDK polls Split servers for changes to feature roll-out plans. This parameter controls this polling period in seconds.
990
- *
991
- * NOTE: this param is applicable in "standalone" mode.
992
- * @property {number} featuresRefreshRate
993
- * @default 5
994
- */
995
- featuresRefreshRate?: number,
996
- /**
997
- * The SDK polls Split servers for changes to segment definitions. This parameter controls this polling period in seconds.
998
- *
999
- * NOTE: this param is applicable in "standalone" mode.
1000
- * @property {number} segmentsRefreshRate
1001
- * @default 60
1002
- */
1003
- segmentsRefreshRate?: number,
1004
- /**
1005
- * The SDK sends information on who got what treatment at what time back to Split servers to power analytics. This parameter controls how often this data is sent to Split servers. The parameter should be in seconds.
1006
- *
1007
- * NOTE: this param is ignored in "consumer" mode.
1008
- * @property {number} impressionsRefreshRate
1009
- * @default 300
1010
- */
1011
- impressionsRefreshRate?: number,
1012
- /**
1013
- * The maximum number of impression items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
1014
- * If you use a 0 here, the queue will have no maximum size.
1015
- *
1016
- * NOTE: this param is ignored in "consumer" mode.
1017
- * @property {number} impressionsQueueSize
1018
- * @default 30000
1019
- */
1020
- impressionsQueueSize?: number,
1021
- /**
1022
- * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
1023
- * @property {number} metricsRefreshRate
1024
- * @default 120
1025
- * @deprecated This parameter is ignored now. Use `telemetryRefreshRate` instead.
1026
- */
1027
- metricsRefreshRate?: number,
1028
- /**
1029
- * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
1030
- *
1031
- * NOTE: this param is ignored in "consumer" mode.
1032
- * @property {number} telemetryRefreshRate
1033
- * @default 3600
1034
- */
1035
- telemetryRefreshRate?: number,
1036
- /**
1037
- * The SDK posts the queued events data in bulks. This parameter controls the posting rate in seconds.
1038
- *
1039
- * NOTE: this param is ignored in "consumer" mode.
1040
- * @property {number} eventsPushRate
1041
- * @default 60
1042
- */
1043
- eventsPushRate?: number,
1044
- /**
1045
- * The maximum number of event items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
1046
- * If you use a 0 here, the queue will have no maximum size.
1047
- *
1048
- * NOTE: this param is ignored in "consumer" mode.
1049
- * @property {number} eventsQueueSize
1050
- * @default 500
1051
- */
1052
- eventsQueueSize?: number,
1053
- /**
1054
- * For mocking/testing only. The SDK will refresh the features mocked data when mode is set to "localhost" by defining the key.
1055
- * For more information @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
1056
- * @property {number} offlineRefreshRate
1057
- * @default 15
1058
- */
1059
- offlineRefreshRate?: number
1060
- /**
1061
- * When using streaming mode, seconds to wait before re attempting to connect for push notifications.
1062
- * Next attempts follow intervals in power of two: base seconds, base x 2 seconds, base x 4 seconds, ...
1063
- *
1064
- * NOTE: this param is applicable in "standalone" mode.
1065
- * @property {number} pushRetryBackoffBase
1066
- * @default 1
1067
- */
1068
- pushRetryBackoffBase?: number,
1069
- },
1070
- }
1071
- /**
1072
- * Common settings interface for SDK instances created on client-side (Browser & React Native).
1073
- * @interface IClientSideSharedSettings
1074
- * @extends ISharedSettings
1075
- */
1076
- interface IClientSideSharedSettings extends ISharedSettings {
1077
- /**
1078
- * SDK Core settings for client-side.
1079
- * @property {Object} core
1080
- */
1081
- core: ISharedSettings['core'] & {
1082
- /**
1083
- * Customer identifier. Whatever this means to you. @see {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
1084
- * @property {SplitKey} key
1085
- */
1086
- key: SplitKey,
1087
- },
1088
- /**
1089
- * Mocked features map. For testing purposses only. For using this you should specify "localhost" as authorizationKey on core settings.
1090
- * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#localhost-mode}
1091
- */
1092
- features?: MockedFeaturesMap,
1093
- /**
1094
- * SDK Startup settings for client-side.
1095
- * @property {Object} startup
1096
- */
1097
- startup?: {
1098
- /**
1099
- * Maximum amount of time used before notify a timeout.
1100
- * @property {number} readyTimeout
1101
- * @default 1.5
1102
- */
1103
- readyTimeout?: number,
1104
- /**
1105
- * Time to wait for a request before the SDK is ready. If this time expires, JS Sdk will retry 'retriesOnFailureBeforeReady' times before notifying its failure to be 'ready'.
1106
- *
1107
- * NOTE: this param is applicable in "standalone" mode.
1108
- * @property {number} requestTimeoutBeforeReady
1109
- * @default 1.5
1110
- */
1111
- requestTimeoutBeforeReady?: number,
1112
- /**
1113
- * How many quick retries we will do while starting up the SDK.
1114
- *
1115
- * NOTE: this param is applicable in "standalone" mode.
1116
- * @property {number} retriesOnFailureBeforeReady
1117
- * @default 1
1118
- */
1119
- retriesOnFailureBeforeReady?: number,
1120
- /**
1121
- * For SDK posts the queued events data in bulks with a given rate, but the first push window is defined separately,
1122
- * to better control on browsers. This number defines that window before the first events push.
1123
- *
1124
- * NOTE: this param is ignored in "consumer" mode.
1125
- * @property {number} eventsFirstPushWindow
1126
- * @default 10
1127
- */
1128
- eventsFirstPushWindow?: number,
1129
- },
1130
- /**
1131
- * SDK scheduler settings.
1132
- * @property {Object} scheduler
1133
- */
1134
- scheduler?: {
1135
- /**
1136
- * The SDK polls Split servers for changes to feature roll-out plans. This parameter controls this polling period in seconds.
1137
- *
1138
- * NOTE: this param is applicable in "standalone" mode.
1139
- * @property {number} featuresRefreshRate
1140
- * @default 30
1141
- */
1142
- featuresRefreshRate?: number,
1143
- /**
1144
- * The SDK polls Split servers for changes to segment definitions. This parameter controls this polling period in seconds.
1145
- *
1146
- * NOTE: this param is applicable in "standalone" mode.
1147
- * @property {number} segmentsRefreshRate
1148
- * @default 60
1149
- */
1150
- segmentsRefreshRate?: number,
1151
- /**
1152
- * The SDK sends information on who got what treatment at what time back to Split servers to power analytics. This parameter controls how often this data is sent to Split servers. The parameter should be in seconds.
1153
- *
1154
- * NOTE: this param is ignored in "consumer" mode.
1155
- * @property {number} impressionsRefreshRate
1156
- * @default 60
1157
- */
1158
- impressionsRefreshRate?: number,
1159
- /**
1160
- * The maximum number of impression items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
1161
- * If you use a 0 here, the queue will have no maximum size.
1162
- *
1163
- * NOTE: this param is ignored in "consumer" mode.
1164
- * @property {number} impressionsQueueSize
1165
- * @default 30000
1166
- */
1167
- impressionsQueueSize?: number,
1168
- /**
1169
- * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
1170
- * @property {number} metricsRefreshRate
1171
- * @default 120
1172
- * @deprecated This parameter is ignored now. Use `telemetryRefreshRate` instead.
1173
- */
1174
- metricsRefreshRate?: number,
1175
- /**
1176
- * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
1177
- *
1178
- * NOTE: this param is ignored in "consumer" mode.
1179
- * @property {number} telemetryRefreshRate
1180
- * @default 3600
1181
- */
1182
- telemetryRefreshRate?: number,
1183
- /**
1184
- * The SDK posts the queued events data in bulks. This parameter controls the posting rate in seconds.
1185
- *
1186
- * NOTE: this param is ignored in "consumer" mode.
1187
- * @property {number} eventsPushRate
1188
- * @default 60
1189
- */
1190
- eventsPushRate?: number,
1191
- /**
1192
- * The maximum number of event items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
1193
- * If you use a 0 here, the queue will have no maximum size.
1194
- *
1195
- * NOTE: this param is ignored in "consumer" mode.
1196
- * @property {number} eventsQueueSize
1197
- * @default 500
1198
- */
1199
- eventsQueueSize?: number,
1200
- /**
1201
- * For mocking/testing only. The SDK will refresh the features mocked data when mode is set to "localhost" by defining the key.
1202
- * For more information @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#localhost-mode}
1203
- * @property {number} offlineRefreshRate
1204
- * @default 15
1205
- */
1206
- offlineRefreshRate?: number,
1207
- /**
1208
- * When using streaming, seconds to wait before re attempting to connect for push notifications.
1209
- * Next attempts follow intervals in power of two: base seconds, base x 2 seconds, base x 4 seconds, ...
1210
- *
1211
- * NOTE: this param is applicable in "standalone" mode.
1212
- * @property {number} pushRetryBackoffBase
1213
- * @default 1
1214
- */
1215
- pushRetryBackoffBase?: number,
1216
- }
1217
- /**
1218
- * User consent status. Possible values are `'GRANTED'`, which is the default, `'DECLINED'` or `'UNKNOWN'`.
1219
- * - `'GRANTED'`: the user grants consent for tracking events and impressions. The SDK sends them to Split cloud.
1220
- * - `'DECLINED'`: the user declines consent for tracking events and impressions. The SDK does not send them to Split cloud.
1221
- * - `'UNKNOWN'`: the user neither grants nor declines consent for tracking events and impressions. The SDK tracks them in its internal storage, and eventually either sends
1222
- * them or not if the consent status is updated to 'GRANTED' or 'DECLINED' respectively. The status can be updated at any time with the `UserConsent.setStatus` factory method.
1223
- *
1224
- * @typedef {string} userConsent
1225
- * @default 'GRANTED'
1226
- */
1227
- userConsent?: ConsentStatus
1228
- }
1229
- /**
1230
- * Common definitions between SDK instances for different environments interface.
1231
- * @interface IBasicSDK
1232
- */
1233
- interface IBasicSDK<TClient, TManager> {
1234
- /**
1235
- * Returns the default client instance of the SDK.
1236
- * @function client
1237
- * @returns {TClient} The client instance.
1238
- */
1239
- client(): TClient,
1240
- /**
1241
- * Returns a manager instance of the SDK to explore available information.
1242
- * @function manager
1243
- * @returns {TManager} The manager instance.
1244
- */
1245
- manager(): TManager
1246
- /**
1247
- * Current settings of the SDK instance.
1248
- * @property settings
1249
- */
1250
- settings: ISettings,
1251
- /**
1252
- * Logger API.
1253
- * @property Logger
1254
- */
1255
- Logger: ILoggerAPI
1256
- }
1257
- /**
1258
- * Common interface between client-side SDK instances.
1259
- * @interface ISDKCs
1260
- */
1261
- interface ISDKWithUserConsent<TClient, TManager> extends IBasicSDK<TClient, TManager> {
1262
- /**
1263
- * User consent API.
1264
- * @property UserConsent
1265
- */
1266
- UserConsent: IUserConsentAPI
1267
- }
1268
- /**
1269
- * This represents the interface for the Client instance with synchronous method calls and server-side API, where we don't have only one key.
1270
- * @interface IClient
1271
- * @extends IBasicClient
1272
- */
1273
- interface IClientSS extends IBasicClient {
1274
- /**
1275
- * Returns a Treatment value, which is the treatment string for the given feature.
1276
- * @function getTreatment
1277
- * @param {string} key - The string key representing the consumer.
1278
- * @param {string} splitName - The string that represents the split we wan't to get the treatment.
1279
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1280
- * @returns {Treatment} The treatment string.
1281
- */
1282
- getTreatment(key: SplitKey, splitName: string, attributes?: Attributes): Treatment,
1283
- /**
1284
- * Returns a TreatmentWithConfig value, which is an object with both treatment and config string for the given feature.
1285
- * @function getTreatmentWithConfig
1286
- * @param {string} key - The string key representing the consumer.
1287
- * @param {string} splitName - The string that represents the split we wan't to get the treatment.
1288
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1289
- * @returns {TreatmentWithConfig} The TreatmentWithConfig, the object containing the treatment string and the
1290
- * configuration stringified JSON (or null if there was no config for that treatment).
1291
- */
1292
- getTreatmentWithConfig(key: SplitKey, splitName: string, attributes?: Attributes): TreatmentWithConfig,
1293
- /**
1294
- * Returns a Treatments value, which is an object map with the treatments for the given features.
1295
- * @function getTreatments
1296
- * @param {string} key - The string key representing the consumer.
1297
- * @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
1298
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1299
- * @returns {Treatments} The treatments object map.
1300
- */
1301
- getTreatments(key: SplitKey, splitNames: string[], attributes?: Attributes): Treatments,
1302
- /**
1303
- * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
1304
- * @function getTreatmentsWithConfig
1305
- * @param {string} key - The string key representing the consumer.
1306
- * @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
1307
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1308
- * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1309
- */
1310
- getTreatmentsWithConfig(key: SplitKey, splitNames: string[], attributes?: Attributes): TreatmentsWithConfig,
1311
- /**
1312
- * Tracks an event to be fed to the results product on Split Webconsole.
1313
- * @function track
1314
- * @param {SplitKey} key - The key that identifies the entity related to this event.
1315
- * @param {string} trafficType - The traffic type of the entity related to this event.
1316
- * @param {string} eventType - The event type corresponding to this event.
1317
- * @param {number=} value - The value of this event.
1318
- * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
1319
- * @returns {boolean} Whether the event was added to the queue successfully or not.
1320
- */
1321
- track(key: SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): boolean,
1322
- }
1323
- /**
1324
- * This represents the interface for the Client instance with asynchronous method calls and server-side SDK, where we don't have only one key.
1325
- * @interface IAsyncClient
1326
- * @extends IBasicClient
1327
- */
1328
- interface IAsyncClientSS extends IBasicClient {
1329
- /**
1330
- * Returns a Treatment value, which will be (or eventually be) the treatment string for the given feature.
1331
- * For usage on NodeJS as we don't have only one key.
1332
- * NOTE: Treatment will be a promise only in async storages, like REDIS.
1333
- * @function getTreatment
1334
- * @param {string} key - The string key representing the consumer.
1335
- * @param {string} splitName - The string that represents the split we wan't to get the treatment.
1336
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1337
- * @returns {AsyncTreatment} Treatment promise which will resolve to the treatment string.
1338
- */
1339
- getTreatment(key: SplitKey, splitName: string, attributes?: Attributes): AsyncTreatment,
1340
- /**
1341
- * Returns a TreatmentWithConfig value, which will be (or eventually be) an object with both treatment and config string for the given feature.
1342
- * For usage on NodeJS as we don't have only one key.
1343
- * NOTE: Treatment will be a promise only in async storages, like REDIS.
1344
- * @function getTreatmentWithConfig
1345
- * @param {string} key - The string key representing the consumer.
1346
- * @param {string} splitName - The string that represents the split we wan't to get the treatment.
1347
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1348
- * @returns {AsyncTreatmentWithConfig} TreatmentWithConfig promise which will resolve to the TreatmentWithConfig object.
1349
- */
1350
- getTreatmentWithConfig(key: SplitKey, splitName: string, attributes?: Attributes): AsyncTreatmentWithConfig,
1351
- /**
1352
- * Returns a Treatments value, which will be (or eventually be) an object map with the treatments for the given features.
1353
- * For usage on NodeJS as we don't have only one key.
1354
- * @function getTreatments
1355
- * @param {string} key - The string key representing the consumer.
1356
- * @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
1357
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1358
- * @returns {AsyncTreatments} Treatments promise which will resolve to the treatments object map.
1359
- */
1360
- getTreatments(key: SplitKey, splitNames: string[], attributes?: Attributes): AsyncTreatments,
1361
- /**
1362
- * Returns a TreatmentsWithConfig value, which will be (or eventually be) an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
1363
- * For usage on NodeJS as we don't have only one key.
1364
- * @function getTreatmentsWithConfig
1365
- * @param {string} key - The string key representing the consumer.
1366
- * @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
1367
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1368
- * @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise which will resolve to the map of TreatmentsWithConfig objects.
1369
- */
1370
- getTreatmentsWithConfig(key: SplitKey, splitNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig,
1371
- /**
1372
- * Tracks an event to be fed to the results product on Split Webconsole and returns a promise to signal when the event was successfully queued (or not).
1373
- * @function track
1374
- * @param {SplitKey} key - The key that identifies the entity related to this event.
1375
- * @param {string} trafficType - The traffic type of the entity related to this event.
1376
- * @param {string} eventType - The event type corresponding to this event.
1377
- * @param {number=} value - The value of this event.
1378
- * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
1379
- * @returns {Promise<boolean>} A promise that resolves to a boolean indicating if the event was added to the queue successfully or not.
1380
- */
1381
- track(key: SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): Promise<boolean>
1382
- }
1383
- /**
1384
- * This represents the interface for the Client instance with attributes binding
1385
- * @interface IClientWithAttributeBinding
1386
- * @extends IBasicClient
1387
- */
1388
- interface IClientWithAttributeBinding extends IBasicClient {
1389
- /**
1390
- * Add an attribute to client's in memory attributes storage.
1391
- *
1392
- * @param {string} attributeName Attribute name
1393
- * @param {AttributeType} attributeValue Attribute value
1394
- * @returns {boolean} true if the attribute was stored and false otherwise
1395
- */
1396
- setAttribute(attributeName: string, attributeValue: AttributeType): boolean,
1397
- /**
1398
- * Returns the attribute with the given key.
1399
- *
1400
- * @param {string} attributeName Attribute name
1401
- * @returns {AttributeType} Attribute with the given key
1402
- */
1403
- getAttribute(attributeName: string): AttributeType,
1404
- /**
1405
- * Removes from client's in memory attributes storage the attribute with the given key.
1406
- *
1407
- * @param {string} attributeName
1408
- * @returns {boolean} true if attribute was removed and false otherwise
1409
- */
1410
- removeAttribute(attributeName: string): boolean,
1411
- /**
1412
- * Add to client's in memory attributes storage the attributes in 'attributes'.
1413
- *
1414
- * @param {Attributes} attributes Object with attributes to store
1415
- * @returns {boolean} true if attributes were stored an false otherwise
1416
- */
1417
- setAttributes(attributes: Attributes): boolean,
1418
- /**
1419
- * Return all the attributes stored in client's in memory attributes storage.
1420
- *
1421
- * @returns {Attributes} returns all the stored attributes
1422
- */
1423
- getAttributes(): Attributes,
1424
- /**
1425
- * Remove all the stored attributes in the client's in memory attribute storage.
1426
- *
1427
- * @returns {boolean} true if all attribute were removed and false otherwise
1428
- */
1429
- clearAttributes(): boolean
1430
- }
1431
- /**
1432
- * This represents the interface for the Client instance with attributes binding, synchronous method calls, and client-side API, where each client has a key associated.
1433
- * @interface IClientWithKey
1434
- * @extends IClientWithAttributeBinding
1435
- */
1436
- interface IClientWithKey extends IClientWithAttributeBinding {
1437
- /**
1438
- * Returns a Treatment value, which is the treatment string for the given feature.
1439
- * @function getTreatment
1440
- * @param {string} splitName - The string that represents the split we wan't to get the treatment.
1441
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1442
- * @returns {Treatment} The treatment string.
1443
- */
1444
- getTreatment(splitName: string, attributes?: Attributes): Treatment,
1445
- /**
1446
- * Returns a TreatmentWithConfig value, which is an object with both treatment and config string for the given feature.
1447
- * @function getTreatmentWithConfig
1448
- * @param {string} splitName - The string that represents the split we wan't to get the treatment.
1449
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1450
- * @returns {TreatmentWithConfig} The map containing the treatment and the configuration stringified JSON (or null if there was no config for that treatment).
1451
- */
1452
- getTreatmentWithConfig(splitName: string, attributes?: Attributes): TreatmentWithConfig,
1453
- /**
1454
- * Returns a Treatments value, which is an object map with the treatments for the given features.
1455
- * @function getTreatments
1456
- * @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
1457
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1458
- * @returns {Treatments} The treatments object map.
1459
- */
1460
- getTreatments(splitNames: string[], attributes?: Attributes): Treatments,
1461
- /**
1462
- * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
1463
- * @function getTreatmentsWithConfig
1464
- * @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
1465
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1466
- * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1467
- */
1468
- getTreatmentsWithConfig(splitNames: string[], attributes?: Attributes): TreatmentsWithConfig,
1469
- /**
1470
- * Tracks an event to be fed to the results product on Split Webconsole.
1471
- * @function track
1472
- * @param {string} trafficType - The traffic type of the entity related to this event.
1473
- * @param {string} eventType - The event type corresponding to this event.
1474
- * @param {number=} value - The value of this event.
1475
- * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
1476
- * @returns {boolean} Whether the event was added to the queue successfully or not.
1477
- */
1478
- track(trafficType: string, eventType: string, value?: number, properties?: Properties): boolean,
1479
- }
1480
- /**
1481
- * This represents the interface for the Client instance with attributes binding, asynchronous method calls, and client-side API, where each client has a key associated.
1482
- * @interface IAsyncClientWithKey
1483
- * @extends IClientWithAttributeBinding
1484
- */
1485
- interface IAsyncClientWithKey extends IClientWithAttributeBinding {
1486
- /**
1487
- * Returns a Treatment value, which will be (or eventually be) the treatment string for the given feature.
1488
- * @function getTreatment
1489
- * @param {string} splitName - The string that represents the split we wan't to get the treatment.
1490
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1491
- * @returns {AsyncTreatment} Treatment promise which will resolve to the treatment string.
1492
- */
1493
- getTreatment(splitName: string, attributes?: Attributes): AsyncTreatment,
1494
- /**
1495
- * Returns a TreatmentWithConfig value, which will be (or eventually be) an object with both treatment and config string for the given feature.
1496
- * @function getTreatmentWithConfig
1497
- * @param {string} splitName - The string that represents the split we wan't to get the treatment.
1498
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1499
- * @returns {AsyncTreatmentWithConfig} TreatmentWithConfig promise which will resolve to the TreatmentWithConfig object.
1500
- */
1501
- getTreatmentWithConfig(splitName: string, attributes?: Attributes): AsyncTreatmentWithConfig,
1502
- /**
1503
- * Returns a Treatments value, which will be (or eventually be) an object map with the treatments for the given features.
1504
- * @function getTreatments
1505
- * @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
1506
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1507
- * @returns {AsyncTreatments} Treatments promise which will resolve to the treatments object map.
1508
- */
1509
- getTreatments(splitNames: string[], attributes?: Attributes): AsyncTreatments,
1510
- /**
1511
- * Returns a TreatmentsWithConfig value, which will be (or eventually be) an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
1512
- * @function getTreatmentsWithConfig
1513
- * @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
1514
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1515
- * @returns {TreatmentsWithConfig} TreatmentsWithConfig promise which will resolve to the map of TreatmentsWithConfig objects.
1516
- */
1517
- getTreatmentsWithConfig(splitNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig,
1518
- /**
1519
- * Tracks an event to be fed to the results product on Split Webconsole and returns a promise to signal when the event was successfully queued (or not).
1520
- * @function track
1521
- * @param {string} trafficType - The traffic type of the entity related to this event.
1522
- * @param {string} eventType - The event type corresponding to this event.
1523
- * @param {number=} value - The value of this event.
1524
- * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
1525
- * @returns {Promise<boolean>} A promise that resolves to a boolean indicating if the event was added to the queue successfully or not.
1526
- */
1527
- track(trafficType: string, eventType: string, value?: number, properties?: Properties): Promise<boolean>,
1528
- }
1529
- /**
1530
- * Representation of a manager instance with synchronous storage of the SDK.
1531
- * @interface IManager
1532
- * @extends IStatusInterface
1533
- */
1534
- interface IManager extends IStatusInterface {
1535
- /**
1536
- * Get the array of Split names.
1537
- * @function names
1538
- * @returns {SplitNames} The lists of Split names.
1539
- */
1540
- names(): SplitNames;
1541
- /**
1542
- * Get the array of splits data in SplitView format.
1543
- * @function splits
1544
- * @returns {SplitViews} The list of SplitView.
1545
- */
1546
- splits(): SplitViews;
1547
- /**
1548
- * Get the data of a split in SplitView format.
1549
- * @function split
1550
- * @param {string} splitName The name of the split we wan't to get info of.
1551
- * @returns {SplitView | null} The SplitView of the given split or null if the split is not found.
1552
- */
1553
- split(splitName: string): SplitView | null;
1554
- }
1555
- /**
1556
- * Representation of a manager instance with asynchronous storage of the SDK.
1557
- * @interface IAsyncManager
1558
- * @extends IStatusInterface
1559
- */
1560
- interface IAsyncManager extends IStatusInterface {
1561
- /**
1562
- * Get the array of Split names.
1563
- * @function names
1564
- * @returns {SplitNamesAsync} A promise that will resolve to the array of Splitio.SplitNames.
1565
- */
1566
- names(): SplitNamesAsync;
1567
- /**
1568
- * Get the array of splits data in SplitView format.
1569
- * @function splits
1570
- * @returns {SplitViewsAsync} A promise that will resolve to the SplitView list.
1571
- */
1572
- splits(): SplitViewsAsync;
1573
- /**
1574
- * Get the data of a split in SplitView format.
1575
- * @function split
1576
- * @param {string} splitName The name of the split we wan't to get info of.
1577
- * @returns {SplitViewAsync} A promise that will resolve to the SplitView value or null if the split is not found.
1578
- */
1579
- split(splitName: string): SplitViewAsync;
1580
- }
1581
- }