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

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 (433) hide show
  1. package/cjs/listeners/browser.js +1 -2
  2. package/cjs/logger/constants.js +1 -2
  3. package/cjs/sdkClient/clientAttributesDecoration.js +1 -1
  4. package/cjs/sdkFactory/index.js +6 -13
  5. package/cjs/services/splitApi.js +1 -20
  6. package/cjs/storages/inMemory/AttributesCacheInMemory.js +1 -1
  7. package/cjs/sync/submitters/submitterManager.js +0 -3
  8. package/cjs/trackers/impressionsTracker.js +28 -7
  9. package/cjs/utils/constants/index.js +2 -3
  10. package/cjs/utils/key/index.js +1 -1
  11. package/cjs/utils/settingsValidation/impressionsMode.js +2 -2
  12. package/cjs/utils/settingsValidation/index.js +1 -3
  13. package/esm/listeners/browser.js +2 -3
  14. package/esm/logger/constants.js +0 -1
  15. package/esm/sdkClient/clientAttributesDecoration.js +1 -1
  16. package/esm/sdkFactory/index.js +6 -13
  17. package/esm/services/splitApi.js +1 -20
  18. package/esm/storages/inMemory/AttributesCacheInMemory.js +1 -1
  19. package/esm/sync/submitters/submitterManager.js +0 -3
  20. package/esm/trackers/impressionsTracker.js +28 -7
  21. package/esm/utils/constants/index.js +0 -1
  22. package/esm/utils/key/index.js +1 -1
  23. package/esm/utils/settingsValidation/impressionsMode.js +3 -3
  24. package/esm/utils/settingsValidation/index.js +1 -3
  25. package/package.json +4 -5
  26. package/src/consent/sdkUserConsent.ts +4 -3
  27. package/src/dtos/types.ts +0 -8
  28. package/src/evaluator/Engine.ts +3 -3
  29. package/src/evaluator/combiners/and.ts +1 -1
  30. package/src/evaluator/combiners/ifelseif.ts +3 -3
  31. package/src/evaluator/condition/engineUtils.ts +1 -1
  32. package/src/evaluator/condition/index.ts +6 -6
  33. package/src/evaluator/index.ts +10 -10
  34. package/src/evaluator/matchers/all.ts +1 -1
  35. package/src/evaluator/matchers/between.ts +1 -1
  36. package/src/evaluator/matchers/boolean.ts +1 -1
  37. package/src/evaluator/matchers/cont_all.ts +1 -1
  38. package/src/evaluator/matchers/cont_any.ts +1 -1
  39. package/src/evaluator/matchers/cont_str.ts +1 -1
  40. package/src/evaluator/matchers/dependency.ts +1 -1
  41. package/src/evaluator/matchers/eq.ts +1 -1
  42. package/src/evaluator/matchers/eq_set.ts +1 -1
  43. package/src/evaluator/matchers/ew.ts +1 -1
  44. package/src/evaluator/matchers/gte.ts +1 -1
  45. package/src/evaluator/matchers/index.ts +1 -1
  46. package/src/evaluator/matchers/lte.ts +1 -1
  47. package/src/evaluator/matchers/part_of.ts +1 -1
  48. package/src/evaluator/matchers/segment.ts +1 -1
  49. package/src/evaluator/matchers/string.ts +1 -1
  50. package/src/evaluator/matchers/sw.ts +1 -1
  51. package/src/evaluator/matchers/whitelist.ts +1 -1
  52. package/src/evaluator/parser/index.ts +3 -3
  53. package/src/evaluator/types.ts +6 -6
  54. package/src/evaluator/value/index.ts +4 -4
  55. package/src/evaluator/value/sanitize.ts +4 -4
  56. package/src/integrations/ga/GaToSplit.ts +6 -6
  57. package/src/integrations/ga/SplitToGa.ts +10 -10
  58. package/src/integrations/ga/types.ts +4 -4
  59. package/src/integrations/pluggable.ts +3 -3
  60. package/src/integrations/types.ts +2 -2
  61. package/src/listeners/browser.ts +2 -3
  62. package/src/logger/.DS_Store +0 -0
  63. package/src/logger/constants.ts +0 -1
  64. package/src/logger/index.ts +3 -3
  65. package/src/logger/sdkLogger.ts +1 -2
  66. package/src/logger/types.ts +0 -16
  67. package/src/readiness/sdkReadinessManager.ts +1 -1
  68. package/src/readiness/types.ts +2 -9
  69. package/src/sdkClient/client.ts +13 -13
  70. package/src/sdkClient/clientAttributesDecoration.ts +13 -13
  71. package/src/sdkClient/clientCS.ts +3 -4
  72. package/src/sdkClient/clientInputValidation.ts +15 -15
  73. package/src/sdkClient/sdkClient.ts +2 -2
  74. package/src/sdkClient/sdkClientMethod.ts +2 -2
  75. package/src/sdkClient/sdkClientMethodCS.ts +9 -9
  76. package/src/sdkClient/sdkClientMethodCSWithTT.ts +9 -9
  77. package/src/sdkFactory/index.ts +8 -17
  78. package/src/sdkFactory/types.ts +8 -11
  79. package/src/sdkManager/index.ts +5 -5
  80. package/src/services/splitApi.ts +1 -22
  81. package/src/services/types.ts +0 -6
  82. package/src/storages/dataLoader.ts +2 -2
  83. package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +1 -1
  84. package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +2 -2
  85. package/src/storages/inLocalStorage/index.ts +3 -2
  86. package/src/storages/inMemory/AttributesCacheInMemory.ts +13 -12
  87. package/src/storages/inMemory/EventsCacheInMemory.ts +4 -4
  88. package/src/storages/inRedis/EventsCacheInRedis.ts +4 -4
  89. package/src/storages/inRedis/ImpressionsCacheInRedis.ts +1 -1
  90. package/src/storages/inRedis/RedisAdapter.ts +1 -1
  91. package/src/storages/inRedis/SegmentsCacheInRedis.ts +1 -1
  92. package/src/storages/inRedis/SplitsCacheInRedis.ts +1 -1
  93. package/src/storages/inRedis/TelemetryCacheInRedis.ts +1 -1
  94. package/src/storages/inRedis/index.ts +3 -2
  95. package/src/storages/pluggable/EventsCachePluggable.ts +4 -4
  96. package/src/storages/pluggable/ImpressionsCachePluggable.ts +1 -1
  97. package/src/storages/pluggable/SegmentsCachePluggable.ts +1 -1
  98. package/src/storages/pluggable/SplitsCachePluggable.ts +1 -1
  99. package/src/storages/pluggable/TelemetryCachePluggable.ts +1 -1
  100. package/src/storages/pluggable/index.ts +3 -3
  101. package/src/storages/pluggable/wrapperAdapter.ts +1 -1
  102. package/src/storages/types.ts +46 -35
  103. package/src/sync/offline/LocalhostFromObject.ts +4 -4
  104. package/src/sync/offline/splitsParser/splitsParserFromSettings.ts +8 -8
  105. package/src/sync/polling/updaters/mySegmentsUpdater.ts +1 -1
  106. package/src/sync/polling/updaters/segmentChangesUpdater.ts +1 -1
  107. package/src/sync/polling/updaters/splitChangesUpdater.ts +1 -1
  108. package/src/sync/streaming/SSEHandler/index.ts +1 -1
  109. package/src/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.ts +1 -1
  110. package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +1 -1
  111. package/src/sync/submitters/submitter.ts +1 -1
  112. package/src/sync/submitters/submitterManager.ts +0 -2
  113. package/src/sync/submitters/types.ts +3 -22
  114. package/src/sync/syncTask.ts +1 -1
  115. package/src/trackers/eventTracker.ts +3 -3
  116. package/src/trackers/impressionsTracker.ts +37 -15
  117. package/src/trackers/types.ts +4 -34
  118. package/src/types.d.ts +1581 -0
  119. package/src/utils/constants/index.ts +1 -2
  120. package/src/utils/inputValidation/apiKey.ts +1 -1
  121. package/src/utils/inputValidation/attribute.ts +1 -1
  122. package/src/utils/inputValidation/attributes.ts +3 -3
  123. package/src/utils/inputValidation/event.ts +1 -1
  124. package/src/utils/inputValidation/eventProperties.ts +3 -3
  125. package/src/utils/inputValidation/eventValue.ts +1 -1
  126. package/src/utils/inputValidation/isOperational.ts +1 -1
  127. package/src/utils/inputValidation/key.ts +3 -3
  128. package/src/utils/inputValidation/preloadedData.ts +3 -3
  129. package/src/utils/inputValidation/split.ts +1 -1
  130. package/src/utils/inputValidation/splitExistance.ts +1 -1
  131. package/src/utils/inputValidation/splits.ts +1 -1
  132. package/src/utils/inputValidation/trafficType.ts +1 -1
  133. package/src/utils/inputValidation/trafficTypeExistance.ts +1 -1
  134. package/src/utils/key/index.ts +9 -9
  135. package/src/utils/settingsValidation/consent.ts +1 -2
  136. package/src/utils/settingsValidation/impressionsMode.ts +6 -6
  137. package/src/utils/settingsValidation/index.ts +1 -4
  138. package/src/utils/settingsValidation/integrations/common.ts +1 -1
  139. package/src/utils/settingsValidation/integrations/configurable.ts +1 -1
  140. package/src/utils/settingsValidation/integrations/pluggable.ts +1 -2
  141. package/src/utils/settingsValidation/localhost/builtin.ts +1 -2
  142. package/src/utils/settingsValidation/localhost/pluggable.ts +1 -2
  143. package/src/utils/settingsValidation/logger/builtinLogger.ts +1 -2
  144. package/src/utils/settingsValidation/logger/pluggableLogger.ts +1 -2
  145. package/src/utils/settingsValidation/splitFilters.ts +7 -9
  146. package/src/utils/settingsValidation/storage/storageCS.ts +1 -2
  147. package/cjs/sync/submitters/uniqueKeysSubmitter.js +0 -70
  148. package/cjs/trackers/strategy/strategyDebug.js +0 -25
  149. package/cjs/trackers/strategy/strategyNone.js +0 -29
  150. package/cjs/trackers/strategy/strategyOptimized.js +0 -34
  151. package/cjs/trackers/uniqueKeysTracker.js +0 -69
  152. package/cjs/types.js +0 -2
  153. package/esm/sync/submitters/uniqueKeysSubmitter.js +0 -64
  154. package/esm/trackers/strategy/strategyDebug.js +0 -21
  155. package/esm/trackers/strategy/strategyNone.js +0 -25
  156. package/esm/trackers/strategy/strategyOptimized.js +0 -30
  157. package/esm/trackers/uniqueKeysTracker.js +0 -65
  158. package/esm/types.js +0 -1
  159. package/src/sync/submitters/uniqueKeysSubmitter.ts +0 -79
  160. package/src/trackers/strategy/strategyDebug.ts +0 -28
  161. package/src/trackers/strategy/strategyNone.ts +0 -34
  162. package/src/trackers/strategy/strategyOptimized.ts +0 -42
  163. package/src/trackers/uniqueKeysTracker.ts +0 -80
  164. package/src/types.ts +0 -1264
  165. package/types/consent/index.d.ts +0 -2
  166. package/types/consent/sdkUserConsent.d.ts +0 -13
  167. package/types/dtos/types.d.ts +0 -172
  168. package/types/evaluator/Engine.d.ts +0 -15
  169. package/types/evaluator/combiners/and.d.ts +0 -4
  170. package/types/evaluator/combiners/ifelseif.d.ts +0 -3
  171. package/types/evaluator/condition/engineUtils.d.ts +0 -11
  172. package/types/evaluator/condition/index.d.ts +0 -6
  173. package/types/evaluator/convertions/index.d.ts +0 -2
  174. package/types/evaluator/index.d.ts +0 -7
  175. package/types/evaluator/matchers/all.d.ts +0 -2
  176. package/types/evaluator/matchers/between.d.ts +0 -3
  177. package/types/evaluator/matchers/boolean.d.ts +0 -2
  178. package/types/evaluator/matchers/cont_all.d.ts +0 -2
  179. package/types/evaluator/matchers/cont_any.d.ts +0 -2
  180. package/types/evaluator/matchers/cont_str.d.ts +0 -2
  181. package/types/evaluator/matchers/dependency.d.ts +0 -5
  182. package/types/evaluator/matchers/eq.d.ts +0 -2
  183. package/types/evaluator/matchers/eq_set.d.ts +0 -2
  184. package/types/evaluator/matchers/ew.d.ts +0 -2
  185. package/types/evaluator/matchers/gte.d.ts +0 -2
  186. package/types/evaluator/matchers/index.d.ts +0 -7
  187. package/types/evaluator/matchers/lte.d.ts +0 -2
  188. package/types/evaluator/matchers/matcherTypes.d.ts +0 -10
  189. package/types/evaluator/matchers/part_of.d.ts +0 -2
  190. package/types/evaluator/matchers/segment.d.ts +0 -6
  191. package/types/evaluator/matchers/string.d.ts +0 -2
  192. package/types/evaluator/matchers/sw.d.ts +0 -2
  193. package/types/evaluator/matchers/whitelist.d.ts +0 -3
  194. package/types/evaluator/matchersTransform/index.d.ts +0 -6
  195. package/types/evaluator/matchersTransform/segment.d.ts +0 -5
  196. package/types/evaluator/matchersTransform/set.d.ts +0 -5
  197. package/types/evaluator/matchersTransform/unaryNumeric.d.ts +0 -5
  198. package/types/evaluator/matchersTransform/whitelist.d.ts +0 -5
  199. package/types/evaluator/parser/index.d.ts +0 -5
  200. package/types/evaluator/treatments/index.d.ts +0 -8
  201. package/types/evaluator/types.d.ts +0 -28
  202. package/types/evaluator/value/index.d.ts +0 -7
  203. package/types/evaluator/value/sanitize.d.ts +0 -7
  204. package/types/index.d.ts +0 -5
  205. package/types/integrations/browser.d.ts +0 -12
  206. package/types/integrations/ga/GaToSplit.d.ts +0 -40
  207. package/types/integrations/ga/GoogleAnalyticsToSplit.d.ts +0 -3
  208. package/types/integrations/ga/SplitToGa.d.ts +0 -34
  209. package/types/integrations/ga/SplitToGoogleAnalytics.d.ts +0 -3
  210. package/types/integrations/ga/types.d.ts +0 -148
  211. package/types/integrations/pluggable.d.ts +0 -11
  212. package/types/integrations/types.d.ts +0 -17
  213. package/types/listeners/browser.d.ts +0 -40
  214. package/types/listeners/node.d.ts +0 -22
  215. package/types/listeners/types.d.ts +0 -4
  216. package/types/logger/browser/DebugLogger.d.ts +0 -2
  217. package/types/logger/browser/ErrorLogger.d.ts +0 -2
  218. package/types/logger/browser/InfoLogger.d.ts +0 -2
  219. package/types/logger/browser/WarnLogger.d.ts +0 -2
  220. package/types/logger/constants.d.ts +0 -142
  221. package/types/logger/index.d.ts +0 -22
  222. package/types/logger/messages/debug.d.ts +0 -1
  223. package/types/logger/messages/error.d.ts +0 -1
  224. package/types/logger/messages/info.d.ts +0 -1
  225. package/types/logger/messages/warn.d.ts +0 -1
  226. package/types/logger/sdkLogger.d.ts +0 -8
  227. package/types/logger/types.d.ts +0 -17
  228. package/types/readiness/constants.d.ts +0 -7
  229. package/types/readiness/readinessManager.d.ts +0 -6
  230. package/types/readiness/sdkReadinessManager.d.ts +0 -11
  231. package/types/readiness/types.d.ts +0 -60
  232. package/types/sdkClient/client.d.ts +0 -6
  233. package/types/sdkClient/clientAttributesDecoration.d.ts +0 -51
  234. package/types/sdkClient/clientCS.d.ts +0 -10
  235. package/types/sdkClient/clientInputValidation.d.ts +0 -7
  236. package/types/sdkClient/sdkClient.d.ts +0 -6
  237. package/types/sdkClient/sdkClientMethod.d.ts +0 -6
  238. package/types/sdkClient/sdkClientMethodCS.d.ts +0 -7
  239. package/types/sdkClient/sdkClientMethodCSWithTT.d.ts +0 -8
  240. package/types/sdkClient/types.d.ts +0 -18
  241. package/types/sdkFactory/index.d.ts +0 -6
  242. package/types/sdkFactory/types.d.ts +0 -82
  243. package/types/sdkManager/index.d.ts +0 -5
  244. package/types/services/splitApi.d.ts +0 -11
  245. package/types/services/splitHttpClient.d.ts +0 -10
  246. package/types/services/types.d.ts +0 -54
  247. package/types/storages/AbstractSegmentsCacheSync.d.ts +0 -55
  248. package/types/storages/AbstractSplitsCacheAsync.d.ts +0 -36
  249. package/types/storages/AbstractSplitsCacheSync.d.ts +0 -42
  250. package/types/storages/KeyBuilder.d.ts +0 -14
  251. package/types/storages/KeyBuilderCS.d.ts +0 -16
  252. package/types/storages/KeyBuilderSS.d.ts +0 -15
  253. package/types/storages/dataLoader.d.ts +0 -10
  254. package/types/storages/findLatencyIndex.d.ts +0 -7
  255. package/types/storages/inLocalStorage/MySegmentsCacheInLocal.d.ts +0 -25
  256. package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +0 -51
  257. package/types/storages/inLocalStorage/constants.d.ts +0 -2
  258. package/types/storages/inLocalStorage/index.d.ts +0 -8
  259. package/types/storages/inMemory/AttributesCacheInMemory.d.ts +0 -43
  260. package/types/storages/inMemory/CountsCacheInMemory.d.ts +0 -20
  261. package/types/storages/inMemory/EventsCacheInMemory.d.ts +0 -35
  262. package/types/storages/inMemory/ImpressionCountsCacheInMemory.d.ts +0 -24
  263. package/types/storages/inMemory/ImpressionsCacheInMemory.d.ts +0 -30
  264. package/types/storages/inMemory/InMemoryStorage.d.ts +0 -10
  265. package/types/storages/inMemory/InMemoryStorageCS.d.ts +0 -10
  266. package/types/storages/inMemory/LatenciesCacheInMemory.d.ts +0 -20
  267. package/types/storages/inMemory/MySegmentsCacheInMemory.d.ts +0 -22
  268. package/types/storages/inMemory/SegmentsCacheInMemory.d.ts +0 -19
  269. package/types/storages/inMemory/SplitsCacheInMemory.d.ts +0 -20
  270. package/types/storages/inMemory/TelemetryCacheInMemory.d.ts +0 -53
  271. package/types/storages/inRedis/CountsCacheInRedis.d.ts +0 -9
  272. package/types/storages/inRedis/EventsCacheInRedis.d.ts +0 -32
  273. package/types/storages/inRedis/ImpressionsCacheInRedis.d.ts +0 -18
  274. package/types/storages/inRedis/LatenciesCacheInRedis.d.ts +0 -9
  275. package/types/storages/inRedis/RedisAdapter.d.ts +0 -24
  276. package/types/storages/inRedis/SegmentsCacheInRedis.d.ts +0 -18
  277. package/types/storages/inRedis/SplitsCacheInRedis.d.ts +0 -91
  278. package/types/storages/inRedis/TelemetryCacheInRedis.d.ts +0 -20
  279. package/types/storages/inRedis/constants.d.ts +0 -1
  280. package/types/storages/inRedis/index.d.ts +0 -10
  281. package/types/storages/metadataBuilder.d.ts +0 -3
  282. package/types/storages/pluggable/EventsCachePluggable.d.ts +0 -38
  283. package/types/storages/pluggable/ImpressionsCachePluggable.d.ts +0 -35
  284. package/types/storages/pluggable/SegmentsCachePluggable.d.ts +0 -54
  285. package/types/storages/pluggable/SplitsCachePluggable.d.ts +0 -89
  286. package/types/storages/pluggable/TelemetryCachePluggable.d.ts +0 -18
  287. package/types/storages/pluggable/constants.d.ts +0 -1
  288. package/types/storages/pluggable/inMemoryWrapper.d.ts +0 -13
  289. package/types/storages/pluggable/index.d.ts +0 -9
  290. package/types/storages/pluggable/wrapperAdapter.d.ts +0 -12
  291. package/types/storages/types.d.ts +0 -417
  292. package/types/sync/offline/LocalhostFromFile.d.ts +0 -2
  293. package/types/sync/offline/LocalhostFromObject.d.ts +0 -2
  294. package/types/sync/offline/splitsParser/parseCondition.d.ts +0 -7
  295. package/types/sync/offline/splitsParser/splitsParserFromFile.d.ts +0 -2
  296. package/types/sync/offline/splitsParser/splitsParserFromSettings.d.ts +0 -3
  297. package/types/sync/offline/splitsParser/types.d.ts +0 -3
  298. package/types/sync/offline/syncManagerOffline.d.ts +0 -10
  299. package/types/sync/offline/syncTasks/fromObjectSyncTask.d.ts +0 -17
  300. package/types/sync/polling/fetchers/mySegmentsFetcher.d.ts +0 -7
  301. package/types/sync/polling/fetchers/segmentChangesFetcher.d.ts +0 -7
  302. package/types/sync/polling/fetchers/splitChangesFetcher.d.ts +0 -7
  303. package/types/sync/polling/fetchers/types.d.ts +0 -5
  304. package/types/sync/polling/pollingManagerCS.d.ts +0 -7
  305. package/types/sync/polling/pollingManagerSS.d.ts +0 -6
  306. package/types/sync/polling/syncTasks/mySegmentsSyncTask.d.ts +0 -9
  307. package/types/sync/polling/syncTasks/segmentsSyncTask.d.ts +0 -9
  308. package/types/sync/polling/syncTasks/splitsSyncTask.d.ts +0 -9
  309. package/types/sync/polling/types.d.ts +0 -26
  310. package/types/sync/polling/updaters/mySegmentsUpdater.d.ts +0 -13
  311. package/types/sync/polling/updaters/segmentChangesUpdater.d.ts +0 -18
  312. package/types/sync/polling/updaters/splitChangesUpdater.d.ts +0 -39
  313. package/types/sync/streaming/AuthClient/index.d.ts +0 -12
  314. package/types/sync/streaming/AuthClient/types.d.ts +0 -17
  315. package/types/sync/streaming/SSEClient/index.d.ts +0 -34
  316. package/types/sync/streaming/SSEClient/types.d.ts +0 -11
  317. package/types/sync/streaming/SSEHandler/NotificationKeeper.d.ts +0 -14
  318. package/types/sync/streaming/SSEHandler/NotificationParser.d.ts +0 -20
  319. package/types/sync/streaming/SSEHandler/index.d.ts +0 -11
  320. package/types/sync/streaming/SSEHandler/types.d.ts +0 -67
  321. package/types/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.d.ts +0 -6
  322. package/types/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.d.ts +0 -8
  323. package/types/sync/streaming/UpdateWorkers/SplitsUpdateWorker.d.ts +0 -12
  324. package/types/sync/streaming/UpdateWorkers/constants.d.ts +0 -3
  325. package/types/sync/streaming/UpdateWorkers/types.d.ts +0 -4
  326. package/types/sync/streaming/constants.d.ts +0 -34
  327. package/types/sync/streaming/mySegmentsV2utils.d.ts +0 -27
  328. package/types/sync/streaming/pushManager.d.ts +0 -9
  329. package/types/sync/streaming/types.d.ts +0 -35
  330. package/types/sync/submitters/eventsSubmitter.d.ts +0 -5
  331. package/types/sync/submitters/eventsSyncTask.d.ts +0 -8
  332. package/types/sync/submitters/impressionCountsSubmitter.d.ts +0 -10
  333. package/types/sync/submitters/impressionCountsSyncTask.d.ts +0 -13
  334. package/types/sync/submitters/impressionsSubmitter.d.ts +0 -11
  335. package/types/sync/submitters/impressionsSyncTask.d.ts +0 -14
  336. package/types/sync/submitters/metricsSyncTask.d.ts +0 -12
  337. package/types/sync/submitters/submitter.d.ts +0 -12
  338. package/types/sync/submitters/submitterManager.d.ts +0 -3
  339. package/types/sync/submitters/submitterSyncTask.d.ts +0 -10
  340. package/types/sync/submitters/telemetrySubmitter.d.ts +0 -25
  341. package/types/sync/submitters/types.d.ts +0 -194
  342. package/types/sync/submitters/uniqueKeysSubmitter.d.ts +0 -19
  343. package/types/sync/syncManagerOnline.d.ts +0 -13
  344. package/types/sync/syncTask.d.ts +0 -13
  345. package/types/sync/syncTaskComposite.d.ts +0 -5
  346. package/types/sync/types.d.ts +0 -43
  347. package/types/trackers/eventTracker.d.ts +0 -10
  348. package/types/trackers/filter/bloomFilter.d.ts +0 -10
  349. package/types/trackers/filter/dictionaryFilter.d.ts +0 -8
  350. package/types/trackers/filter/types.d.ts +0 -5
  351. package/types/trackers/impressionObserver/ImpressionObserver.d.ts +0 -8
  352. package/types/trackers/impressionObserver/buildKey.d.ts +0 -2
  353. package/types/trackers/impressionObserver/impressionObserverCS.d.ts +0 -4
  354. package/types/trackers/impressionObserver/impressionObserverSS.d.ts +0 -4
  355. package/types/trackers/impressionObserver/types.d.ts +0 -4
  356. package/types/trackers/impressionObserver/utils.d.ts +0 -13
  357. package/types/trackers/impressionsTracker.d.ts +0 -13
  358. package/types/trackers/strategy/strategyDebug.d.ts +0 -9
  359. package/types/trackers/strategy/strategyNone.d.ts +0 -10
  360. package/types/trackers/strategy/strategyOptimized.d.ts +0 -11
  361. package/types/trackers/telemetryTracker.d.ts +0 -3
  362. package/types/trackers/types.d.ts +0 -65
  363. package/types/trackers/uniqueKeysTracker.d.ts +0 -13
  364. package/types/types.d.ts +0 -1262
  365. package/types/utils/Backoff.d.ts +0 -25
  366. package/types/utils/LRUCache/LinkedList.d.ts +0 -34
  367. package/types/utils/LRUCache/index.d.ts +0 -16
  368. package/types/utils/MinEventEmitter.d.ts +0 -12
  369. package/types/utils/MinEvents.d.ts +0 -4
  370. package/types/utils/base64/index.d.ts +0 -30
  371. package/types/utils/constants/browser.d.ts +0 -3
  372. package/types/utils/constants/index.d.ts +0 -63
  373. package/types/utils/decompress/index.d.ts +0 -16
  374. package/types/utils/env/isLocalStorageAvailable.d.ts +0 -1
  375. package/types/utils/env/isNode.d.ts +0 -5
  376. package/types/utils/inputValidation/apiKey.d.ts +0 -7
  377. package/types/utils/inputValidation/attribute.d.ts +0 -2
  378. package/types/utils/inputValidation/attributes.d.ts +0 -4
  379. package/types/utils/inputValidation/event.d.ts +0 -2
  380. package/types/utils/inputValidation/eventProperties.d.ts +0 -6
  381. package/types/utils/inputValidation/eventValue.d.ts +0 -2
  382. package/types/utils/inputValidation/index.d.ts +0 -13
  383. package/types/utils/inputValidation/isOperational.d.ts +0 -4
  384. package/types/utils/inputValidation/key.d.ts +0 -3
  385. package/types/utils/inputValidation/preloadedData.d.ts +0 -3
  386. package/types/utils/inputValidation/split.d.ts +0 -2
  387. package/types/utils/inputValidation/splitExistance.d.ts +0 -7
  388. package/types/utils/inputValidation/splits.d.ts +0 -2
  389. package/types/utils/inputValidation/trafficType.d.ts +0 -2
  390. package/types/utils/inputValidation/trafficTypeExistance.d.ts +0 -9
  391. package/types/utils/jwt/index.d.ts +0 -5
  392. package/types/utils/jwt/types.d.ts +0 -5
  393. package/types/utils/key/index.d.ts +0 -8
  394. package/types/utils/labels/index.d.ts +0 -7
  395. package/types/utils/lang/binarySearch.d.ts +0 -9
  396. package/types/utils/lang/getFnName.d.ts +0 -4
  397. package/types/utils/lang/getGlobal.d.ts +0 -4
  398. package/types/utils/lang/index.d.ts +0 -105
  399. package/types/utils/lang/maps.d.ts +0 -55
  400. package/types/utils/lang/objectAssign.d.ts +0 -3
  401. package/types/utils/lang/sets.d.ts +0 -60
  402. package/types/utils/murmur3/common.d.ts +0 -12
  403. package/types/utils/murmur3/legacy.d.ts +0 -2
  404. package/types/utils/murmur3/murmur3.d.ts +0 -2
  405. package/types/utils/murmur3/murmur3_128.d.ts +0 -6
  406. package/types/utils/murmur3/murmur3_128_x86.d.ts +0 -7
  407. package/types/utils/murmur3/murmur3_64.d.ts +0 -10
  408. package/types/utils/murmur3/utfx.d.ts +0 -27
  409. package/types/utils/promise/thenable.d.ts +0 -1
  410. package/types/utils/promise/timeout.d.ts +0 -1
  411. package/types/utils/promise/wrapper.d.ts +0 -21
  412. package/types/utils/settingsValidation/consent.d.ts +0 -6
  413. package/types/utils/settingsValidation/impressionsMode.d.ts +0 -3
  414. package/types/utils/settingsValidation/index.d.ts +0 -52
  415. package/types/utils/settingsValidation/integrations/common.d.ts +0 -14
  416. package/types/utils/settingsValidation/integrations/configurable.d.ts +0 -13
  417. package/types/utils/settingsValidation/integrations/pluggable.d.ts +0 -13
  418. package/types/utils/settingsValidation/localhost/builtin.d.ts +0 -16
  419. package/types/utils/settingsValidation/localhost/pluggable.d.ts +0 -16
  420. package/types/utils/settingsValidation/logger/builtinLogger.d.ts +0 -10
  421. package/types/utils/settingsValidation/logger/commons.d.ts +0 -9
  422. package/types/utils/settingsValidation/logger/pluggableLogger.d.ts +0 -11
  423. package/types/utils/settingsValidation/mode.d.ts +0 -1
  424. package/types/utils/settingsValidation/runtime.d.ts +0 -2
  425. package/types/utils/settingsValidation/splitFilters.d.ts +0 -16
  426. package/types/utils/settingsValidation/storage/storageCS.d.ts +0 -21
  427. package/types/utils/settingsValidation/types.d.ts +0 -32
  428. package/types/utils/settingsValidation/url.d.ts +0 -10
  429. package/types/utils/time/index.d.ts +0 -4
  430. package/types/utils/timeTracker/index.d.ts +0 -70
  431. package/types/utils/timeTracker/now/browser.d.ts +0 -1
  432. package/types/utils/timeTracker/now/node.d.ts +0 -1
  433. package/types/utils/timeTracker/timer.d.ts +0 -1
package/types/types.d.ts DELETED
@@ -1,1262 +0,0 @@
1
- import { ISplitFiltersValidation } from './dtos/types';
2
- import { IIntegration, IIntegrationFactoryParams } from './integrations/types';
3
- import { ILogger } from './logger/types';
4
- import { ISdkFactoryContext } from './sdkFactory/types';
5
- import { IStorageFactoryParams, IStorageSync, IStorageAsync, IStorageSyncFactory, IStorageAsyncFactory } from './storages/types';
6
- import { ISyncManagerCS } from './sync/types';
7
- /**
8
- * Reduced version of NodeJS.EventEmitter interface with the minimal methods used by the SDK
9
- * @see {@link https://nodejs.org/api/events.html}
10
- */
11
- export interface IEventEmitter {
12
- addListener(event: string, listener: (...args: any[]) => void): this;
13
- on(event: string, listener: (...args: any[]) => void): this;
14
- once(event: string, listener: (...args: any[]) => void): this;
15
- removeListener(event: string, listener: (...args: any[]) => void): this;
16
- off(event: string, listener: (...args: any[]) => void): this;
17
- removeAllListeners(event?: string): this;
18
- emit(event: string, ...args: any[]): boolean;
19
- }
20
- /**
21
- * impression DTO generated by the Sdk client when processing evaluations
22
- */
23
- export declare type ImpressionDTO = {
24
- feature: string;
25
- keyName: string;
26
- treatment: string;
27
- time: number;
28
- bucketingKey?: string;
29
- label: string;
30
- changeNumber: number;
31
- pt?: number;
32
- };
33
- /** splitio.d.ts */
34
- /**
35
- * @typedef {Object} EventConsts
36
- * @property {string} SDK_READY The ready event.
37
- * @property {string} SDK_READY_FROM_CACHE The ready event when fired with cached data.
38
- * @property {string} SDK_READY_TIMED_OUT The timeout event.
39
- * @property {string} SDK_UPDATE The update event.
40
- */
41
- declare type EventConsts = {
42
- SDK_READY: 'init::ready';
43
- SDK_READY_FROM_CACHE: 'init::cache-ready';
44
- SDK_READY_TIMED_OUT: 'init::timeout';
45
- SDK_UPDATE: 'state::update';
46
- };
47
- /**
48
- * SDK Modes.
49
- * @typedef {string} SDKMode
50
- */
51
- export declare type SDKMode = 'standalone' | 'consumer' | 'localhost' | 'consumer_partial';
52
- /**
53
- * User consent status.
54
- * @typedef {string} ConsentStatus
55
- */
56
- export declare type ConsentStatus = 'GRANTED' | 'DECLINED' | 'UNKNOWN';
57
- /**
58
- * Settings interface. This is a representation of the settings the SDK expose, that's why
59
- * most of it's props are readonly. Only features should be rewritten when localhost mode is active.
60
- * @interface ISettings
61
- *
62
- * NOTE: same ISettings interface from public type declarations extended with private properties.
63
- */
64
- export interface ISettings {
65
- readonly core: {
66
- authorizationKey: string;
67
- key: SplitIO.SplitKey;
68
- trafficType?: string;
69
- labelsEnabled: boolean;
70
- IPAddressesEnabled: boolean;
71
- };
72
- readonly mode: SDKMode;
73
- readonly scheduler: {
74
- featuresRefreshRate: number;
75
- impressionsRefreshRate: number;
76
- impressionsQueueSize: number;
77
- uniqueKeysRefreshRate: number;
78
- /**
79
- * @deprecated
80
- */
81
- metricsRefreshRate?: number;
82
- telemetryRefreshRate: number;
83
- segmentsRefreshRate: number;
84
- offlineRefreshRate: number;
85
- eventsPushRate: number;
86
- eventsQueueSize: number;
87
- pushRetryBackoffBase: number;
88
- };
89
- readonly startup: {
90
- readyTimeout: number;
91
- requestTimeoutBeforeReady: number;
92
- retriesOnFailureBeforeReady: number;
93
- eventsFirstPushWindow: number;
94
- };
95
- readonly storage: IStorageSyncFactory | IStorageAsyncFactory;
96
- readonly integrations: Array<{
97
- readonly type: string;
98
- (params: IIntegrationFactoryParams): IIntegration | void;
99
- }>;
100
- readonly urls: {
101
- events: string;
102
- sdk: string;
103
- auth: string;
104
- streaming: string;
105
- telemetry: string;
106
- };
107
- readonly debug: boolean | LogLevel | ILogger;
108
- readonly version: string;
109
- features: SplitIO.MockedFeaturesFilePath | SplitIO.MockedFeaturesMap;
110
- readonly streamingEnabled: boolean;
111
- readonly sync: {
112
- splitFilters: SplitIO.SplitFilter[];
113
- impressionsMode: SplitIO.ImpressionsMode;
114
- __splitFiltersValidation: ISplitFiltersValidation;
115
- localhostMode?: SplitIO.LocalhostFactory;
116
- enabled: boolean;
117
- };
118
- readonly runtime: {
119
- ip: string | false;
120
- hostname: string | false;
121
- };
122
- readonly log: ILogger;
123
- readonly impressionListener?: unknown;
124
- readonly userConsent?: ConsentStatus;
125
- }
126
- /**
127
- * Log levels.
128
- * @typedef {string} LogLevel
129
- */
130
- export declare type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR' | 'NONE';
131
- /**
132
- * Logger API
133
- * @interface ILoggerAPI
134
- */
135
- export interface ILoggerAPI {
136
- /**
137
- * Enables SDK logging to the console.
138
- * @function enable
139
- * @returns {void}
140
- */
141
- enable(): void;
142
- /**
143
- * Disables SDK logging.
144
- * @function disable
145
- * @returns {void}
146
- */
147
- disable(): void;
148
- /**
149
- * Sets a log level for the SDK logs.
150
- * @function setLogLevel
151
- * @returns {void}
152
- */
153
- setLogLevel(logLevel: LogLevel): void;
154
- /**
155
- * Log level constants. Use this to pass them to setLogLevel function.
156
- */
157
- LogLevel: {
158
- [level: string]: LogLevel;
159
- };
160
- }
161
- /**
162
- * Common settings between Browser and NodeJS settings interface.
163
- * @interface ISharedSettings
164
- */
165
- interface ISharedSettings {
166
- /**
167
- * Whether the logger should be enabled or disabled by default.
168
- * @property {Boolean} debug
169
- * @default false
170
- */
171
- debug?: boolean;
172
- /**
173
- * The impression listener, which is optional. Whatever you provide here needs to comply with the SplitIO.IImpressionListener interface,
174
- * which will check for the logImpression method.
175
- * @property {IImpressionListener} impressionListener
176
- * @default undefined
177
- */
178
- impressionListener?: SplitIO.IImpressionListener;
179
- /**
180
- * Boolean flag to enable the streaming service as default synchronization mechanism. In the event of any issue with streaming,
181
- * the SDK would fallback to the polling mechanism. If false, the SDK would poll for changes as usual without attempting to use streaming.
182
- * @property {boolean} streamingEnabled
183
- * @default true
184
- */
185
- streamingEnabled?: boolean;
186
- /**
187
- * SDK synchronization settings.
188
- * @property {Object} sync
189
- */
190
- sync?: {
191
- /**
192
- * 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.
193
- * This configuration is only meaningful when the SDK is working in "standalone" mode.
194
- *
195
- * At the moment, two types of split filters are supported: by name and by prefix.
196
- * Example:
197
- * `splitFilter: [
198
- * { type: 'byName', values: ['my_split_1', 'my_split_2'] }, // will fetch splits named 'my_split_1' and 'my_split_2'
199
- * { type: 'byPrefix', values: ['testing'] } // will fetch splits whose names start with 'testing__' prefix
200
- * ]`
201
- * @property {SplitIO.SplitFilter[]} splitFilters
202
- */
203
- splitFilters?: SplitIO.SplitFilter[];
204
- /**
205
- * Impressions Collection Mode. Option to determine how impressions are going to be sent to Split Servers.
206
- * Possible values are 'DEBUG' and 'OPTIMIZED'.
207
- * - DEBUG: will send all the impressions generated (recommended only for debugging purposes).
208
- * - OPTIMIZED: will send unique impressions to Split Servers avoiding a considerable amount of traffic that duplicated impressions could generate.
209
- * @property {String} impressionsMode
210
- * @default 'OPTIMIZED'
211
- */
212
- impressionsMode?: SplitIO.ImpressionsMode;
213
- /**
214
- * Enables synchronization.
215
- * @property {boolean} enabled
216
- */
217
- enabled: boolean;
218
- };
219
- }
220
- /**
221
- * Common settings interface for SDK instances on NodeJS.
222
- * @interface INodeBasicSettings
223
- * @extends ISharedSettings
224
- */
225
- interface INodeBasicSettings extends ISharedSettings {
226
- /**
227
- * SDK Startup settings for NodeJS.
228
- * @property {Object} startup
229
- */
230
- startup?: {
231
- /**
232
- * Maximum amount of time used before notify a timeout.
233
- * @property {number} readyTimeout
234
- * @default 15
235
- */
236
- readyTimeout?: number;
237
- /**
238
- * 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'.
239
- * @property {number} requestTimeoutBeforeReady
240
- * @default 15
241
- */
242
- requestTimeoutBeforeReady?: number;
243
- /**
244
- * How many quick retries we will do while starting up the SDK.
245
- * @property {number} retriesOnFailureBeforeReady
246
- * @default 1
247
- */
248
- retriesOnFailureBeforeReady?: number;
249
- /**
250
- * For SDK posts the queued events data in bulks with a given rate, but the first push window is defined separately,
251
- * to better control on browsers. This number defines that window before the first events push.
252
- *
253
- * @property {number} eventsFirstPushWindow
254
- * @default 0
255
- */
256
- eventsFirstPushWindow?: number;
257
- };
258
- /**
259
- * SDK scheduler settings.
260
- * @property {Object} scheduler
261
- */
262
- scheduler?: {
263
- /**
264
- * The SDK polls Split servers for changes to feature roll-out plans. This parameter controls this polling period in seconds.
265
- * @property {number} featuresRefreshRate
266
- * @default 5
267
- */
268
- featuresRefreshRate?: number;
269
- /**
270
- * 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.
271
- * @property {number} impressionsRefreshRate
272
- * @default 300
273
- */
274
- impressionsRefreshRate?: number;
275
- /**
276
- * The maximum number of impression items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
277
- * If you use a 0 here, the queue will have no maximum size.
278
- * @property {number} impressionsQueueSize
279
- * @default 30000
280
- */
281
- impressionsQueueSize?: number;
282
- /**
283
- * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
284
- * @property {number} metricsRefreshRate
285
- * @default 120
286
- * @deprecated This parameter is ignored now.
287
- */
288
- metricsRefreshRate?: number;
289
- /**
290
- * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
291
- * @property {number} telemetryRefreshRate
292
- * @default 3600
293
- */
294
- telemetryRefreshRate?: number;
295
- /**
296
- * The SDK polls Split servers for changes to segment definitions. This parameter controls this polling period in seconds.
297
- * @property {number} segmentsRefreshRate
298
- * @default 60
299
- */
300
- segmentsRefreshRate?: number;
301
- /**
302
- * The SDK posts the queued events data in bulks. This parameter controls the posting rate in seconds.
303
- * @property {number} eventsPushRate
304
- * @default 60
305
- */
306
- eventsPushRate?: number;
307
- /**
308
- * The maximum number of event items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
309
- * If you use a 0 here, the queue will have no maximum size.
310
- * @property {number} eventsQueueSize
311
- * @default 500
312
- */
313
- eventsQueueSize?: number;
314
- /**
315
- * For mocking/testing only. The SDK will refresh the features mocked data when mode is set to "localhost" by defining the key.
316
- * For more information @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
317
- * @property {number} offlineRefreshRate
318
- * @default 15
319
- */
320
- offlineRefreshRate?: number;
321
- /**
322
- * When using streaming mode, seconds to wait before re attempting to connect for push notifications.
323
- * Next attempts follow intervals in power of two: base seconds, base x 2 seconds, base x 4 seconds, ...
324
- * @property {number} pushRetryBackoffBase
325
- * @default 1
326
- */
327
- pushRetryBackoffBase?: number;
328
- };
329
- /**
330
- * SDK Core settings for NodeJS.
331
- * @property {Object} core
332
- */
333
- core: {
334
- /**
335
- * Your API key. More information: @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
336
- * @property {string} authorizationKey
337
- */
338
- authorizationKey: string;
339
- /**
340
- * Disable labels from being sent to Split backend. Labels may contain sensitive information.
341
- * @property {boolean} labelsEnabled
342
- * @default true
343
- */
344
- labelsEnabled?: boolean;
345
- /**
346
- * Disable machine IP and Name from being sent to Split backend.
347
- * @property {boolean} IPAddressesEnabled
348
- * @default true
349
- */
350
- IPAddressesEnabled?: boolean;
351
- };
352
- /**
353
- * Defines which kind of storage we should instanciate.
354
- * @property {Object} storage
355
- */
356
- storage?: (params: any) => any;
357
- /**
358
- * The SDK mode. Possible values are "standalone" (which is the default) and "consumer". For "localhost" mode, use "localhost" as authorizationKey.
359
- * @property {SDKMode} mode
360
- * @default standalone
361
- */
362
- mode?: SDKMode;
363
- /**
364
- * Mocked features file path. For testing purposses only. For using this you should specify "localhost" as authorizationKey on core settings.
365
- * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
366
- * @property {MockedFeaturesFilePath} features
367
- * @default $HOME/.split
368
- */
369
- features?: SplitIO.MockedFeaturesFilePath;
370
- }
371
- /**
372
- * Common API for entities that expose status handlers.
373
- * @interface IStatusInterface
374
- * @extends IEventEmitter
375
- */
376
- export interface IStatusInterface extends IEventEmitter {
377
- /**
378
- * Constant object containing the SDK events for you to use.
379
- * @property {EventConsts} Event
380
- */
381
- Event: EventConsts;
382
- /**
383
- * 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).
384
- * 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
385
- * SDK had timed out will return a new promise that should eventually resolve if the SDK gets ready.
386
- *
387
- * 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.
388
- * However, when using async/await syntax, the rejection should be explicitly propagated like in the following example:
389
- * ```
390
- * try {
391
- * await client.ready().catch((e) => { throw e; });
392
- * // SDK is ready
393
- * } catch(e) {
394
- * // SDK has timedout
395
- * }
396
- * ```
397
- *
398
- * @function ready
399
- * @returns {Promise<void>}
400
- */
401
- ready(): Promise<void>;
402
- }
403
- /**
404
- * Common definitions between clients for different environments interface.
405
- * @interface IBasicClient
406
- * @extends IStatusInterface
407
- */
408
- interface IBasicClient extends IStatusInterface {
409
- /**
410
- * Destroy the client instance.
411
- * @function destroy
412
- * @returns {Promise<void>}
413
- */
414
- destroy(): Promise<void>;
415
- isClientSide: boolean;
416
- }
417
- /**
418
- * Common definitions between SDK instances for different environments interface.
419
- * @interface IBasicSDK
420
- */
421
- interface IBasicSDK {
422
- /**
423
- * Current settings of the SDK instance.
424
- * @property settings
425
- */
426
- settings: ISettings;
427
- /**
428
- * Logger API.
429
- * @property Logger
430
- */
431
- Logger: ILoggerAPI;
432
- }
433
- /****** Exposed namespace ******/
434
- /**
435
- * Types and interfaces for @splitsoftware/splitio package for usage when integrating javascript sdk on typescript apps.
436
- * For the SDK package information
437
- * @see {@link https://www.npmjs.com/package/@splitsoftware/splitio}
438
- */
439
- export declare namespace SplitIO {
440
- /**
441
- * Split treatment value, returned by getTreatment.
442
- * @typedef {string} Treatment
443
- */
444
- type Treatment = string;
445
- /**
446
- * Split treatment promise that will resolve to actual treatment value.
447
- * @typedef {Promise<string>} AsyncTreatment
448
- */
449
- type AsyncTreatment = Promise<string>;
450
- /**
451
- * An object with the treatments for a bulk of splits, returned by getTreatments. For example:
452
- * {
453
- * feature1: 'on',
454
- * feature2: 'off
455
- * }
456
- * @typedef {Object.<Treatment>} Treatments
457
- */
458
- type Treatments = {
459
- [featureName: string]: Treatment;
460
- };
461
- /**
462
- * Split treatments promise that will resolve to the actual SplitIO.Treatments object.
463
- * @typedef {Promise<Treatments>} AsyncTreatments
464
- */
465
- type AsyncTreatments = Promise<Treatments>;
466
- /**
467
- * Split evaluation result with treatment and configuration, returned by getTreatmentWithConfig.
468
- * @typedef {Object} TreatmentWithConfig
469
- * @property {string} treatment The treatment result
470
- * @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.
471
- */
472
- type TreatmentWithConfig = {
473
- treatment: string;
474
- config: string | null;
475
- };
476
- /**
477
- * Split treatment promise that will resolve to actual treatment with config value.
478
- * @typedef {Promise<TreatmentWithConfig>} AsyncTreatmentWithConfig
479
- */
480
- type AsyncTreatmentWithConfig = Promise<TreatmentWithConfig>;
481
- /**
482
- * An object with the treatments with configs for a bulk of splits, returned by getTreatmentsWithConfig.
483
- * Each existing configuration is a stringified version of the JSON you defined on the Split web console. For example:
484
- * {
485
- * feature1: { treatment: 'on', config: null }
486
- * feature2: { treatment: 'off', config: '{"bannerText":"Click here."}' }
487
- * }
488
- * @typedef {Object.<TreatmentWithConfig>} Treatments
489
- */
490
- type TreatmentsWithConfig = {
491
- [featureName: string]: TreatmentWithConfig;
492
- };
493
- /**
494
- * Split treatments promise that will resolve to the actual SplitIO.TreatmentsWithConfig object.
495
- * @typedef {Promise<TreatmentsWithConfig>} AsyncTreatmentsWithConfig
496
- */
497
- type AsyncTreatmentsWithConfig = Promise<TreatmentsWithConfig>;
498
- /**
499
- * Possible Split SDK events.
500
- * @typedef {string} Event
501
- */
502
- type Event = 'init::timeout' | 'init::ready' | 'init::cache-ready' | 'state::update';
503
- /**
504
- * Split attributes should be on object with values of type string or number (dates should be sent as millis since epoch).
505
- * @typedef {Object.<number, string, boolean, string[], number[]>} Attributes
506
- * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#attribute-syntax}
507
- */
508
- type Attributes = {
509
- [attributeName: string]: string | number | boolean | Array<string | number>;
510
- };
511
- /**
512
- * Split properties should be an object with values of type string, number, boolean or null. Size limit of ~31kb.
513
- * @typedef {Object.<number, string, boolean, null>} Attributes
514
- * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#track
515
- */
516
- type Properties = {
517
- [propertyName: string]: string | number | boolean | null;
518
- };
519
- /**
520
- * The SplitKey object format.
521
- * @typedef {Object.<string>} SplitKeyObject
522
- */
523
- type SplitKeyObject = {
524
- matchingKey: string;
525
- bucketingKey: string;
526
- };
527
- /**
528
- * The customer identifier. Could be a SplitKeyObject or a string.
529
- * @typedef {SplitKeyObject|string} SplitKey
530
- */
531
- type SplitKey = SplitKeyObject | string;
532
- /**
533
- * Path to file with mocked features (for node).
534
- * @typedef {string} MockedFeaturesFilePath
535
- */
536
- type MockedFeaturesFilePath = string;
537
- /**
538
- * Object with mocked features mapping (for browser). We need to specify the featureName as key, and the mocked treatment as value.
539
- * @typedef {Object} MockedFeaturesMap
540
- */
541
- type MockedFeaturesMap = {
542
- [featureName: string]: string | TreatmentWithConfig;
543
- };
544
- /**
545
- * Object with information about an impression. It contains the generated impression DTO as well as
546
- * complementary information around where and how it was generated in that way.
547
- * @typedef {Object} ImpressionData
548
- */
549
- type ImpressionData = {
550
- impression: ImpressionDTO;
551
- attributes?: SplitIO.Attributes;
552
- ip: string | false;
553
- hostname: string | false;
554
- sdkLanguageVersion: string;
555
- };
556
- /**
557
- * Data corresponding to one Split view.
558
- * @typedef {Object} SplitView
559
- */
560
- type SplitView = {
561
- /**
562
- * The name of the split.
563
- * @property {string} name
564
- */
565
- name: string;
566
- /**
567
- * The traffic type of the split.
568
- * @property {string} trafficType
569
- */
570
- trafficType: string;
571
- /**
572
- * Whether the split is killed or not.
573
- * @property {boolean} killed
574
- */
575
- killed: boolean;
576
- /**
577
- * The list of treatments available for the split.
578
- * @property {Array<string>} treatments
579
- */
580
- treatments: Array<string>;
581
- /**
582
- * Current change number of the split.
583
- * @property {number} changeNumber
584
- */
585
- changeNumber: number;
586
- /**
587
- * Map of configurations per treatment.
588
- * Each existing configuration is a stringified version of the JSON you defined on the Split web console.
589
- * @property {Object.<string>} configs
590
- */
591
- configs: {
592
- [treatmentName: string]: string;
593
- };
594
- };
595
- /**
596
- * A promise that will be resolved with that SplitView.
597
- * @typedef {Promise<SplitView>} SplitView
598
- */
599
- type SplitViewAsync = Promise<SplitView>;
600
- /**
601
- * An array containing the SplitIO.SplitView elements.
602
- */
603
- type SplitViews = Array<SplitView>;
604
- /**
605
- * A promise that will be resolved with an SplitIO.SplitViews array.
606
- * @typedef {Promise<SplitViews>} SplitViewsAsync
607
- */
608
- type SplitViewsAsync = Promise<SplitViews>;
609
- /**
610
- * An array of split names.
611
- * @typedef {Array<string>} SplitNames
612
- */
613
- type SplitNames = Array<string>;
614
- /**
615
- * A promise that will be resolved with an array of split names.
616
- * @typedef {Promise<SplitNames>} SplitNamesAsync
617
- */
618
- type SplitNamesAsync = Promise<SplitNames>;
619
- /**
620
- * Localhost mode factory.
621
- */
622
- type LocalhostFactory = {
623
- type: 'LocalhostFromObject' | 'LocalhostFromFile';
624
- (params: ISdkFactoryContext): ISyncManagerCS;
625
- };
626
- /**
627
- * Impression listener interface. This is the interface that needs to be implemented
628
- * by the element you provide to the SDK as impression listener.
629
- * @interface IImpressionListener
630
- * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#listener}
631
- */
632
- interface IImpressionListener {
633
- logImpression(data: SplitIO.ImpressionData): void;
634
- }
635
- /**
636
- * Object with information about a Split event.
637
- * @typedef {Object} EventData
638
- */
639
- type EventData = {
640
- eventTypeId: string;
641
- value?: number;
642
- properties?: Properties;
643
- trafficTypeName?: string;
644
- key?: string;
645
- timestamp: number;
646
- };
647
- /**
648
- * Object representing the data sent by Split (events and impressions).
649
- * @typedef {Object} IntegrationData
650
- * @property {string} type The type of Split data, either 'IMPRESSION' or 'EVENT'.
651
- * @property {ImpressionData | EventData} payload The data instance itself.
652
- */
653
- type IntegrationData = {
654
- type: 'IMPRESSION';
655
- payload: SplitIO.ImpressionData;
656
- } | {
657
- type: 'EVENT';
658
- payload: SplitIO.EventData;
659
- };
660
- /**
661
- * Available URL settings for the SDKs.
662
- */
663
- type UrlSettings = {
664
- /**
665
- * String property to override the base URL where the SDK will get feature flagging related data like a Split rollout plan or segments information.
666
- * @property {string} sdk
667
- * @default 'https://sdk.split.io/api'
668
- */
669
- sdk?: string;
670
- /**
671
- * String property to override the base URL where the SDK will post event-related information like impressions.
672
- * @property {string} events
673
- * @default 'https://events.split.io/api'
674
- */
675
- events?: string;
676
- /**
677
- * String property to override the base URL where the SDK will get authorization tokens to be used with functionality that requires it, like streaming.
678
- * @property {string} auth
679
- * @default 'https://auth.split.io/api'
680
- */
681
- auth?: string;
682
- /**
683
- * String property to override the base URL where the SDK will connect to receive streaming updates.
684
- * @property {string} streaming
685
- * @default 'https://streaming.split.io'
686
- */
687
- streaming?: string;
688
- /**
689
- * String property to override the base URL where the SDK will post telemetry data.
690
- * @property {string} telemetry
691
- * @default 'https://telemetry.split.io/api'
692
- */
693
- telemetry?: string;
694
- };
695
- /**
696
- * SplitFilter type.
697
- * @typedef {string} SplitFilterType
698
- */
699
- type SplitFilterType = 'byName' | 'byPrefix';
700
- /**
701
- * Defines a split filter, described by a type and list of values.
702
- */
703
- interface SplitFilter {
704
- /**
705
- * Type of the filter.
706
- * @property {SplitFilterType} type
707
- */
708
- type: SplitFilterType;
709
- /**
710
- * List of values: split names for 'byName' filter type, and split prefixes for 'byPrefix' type.
711
- * @property {string[]} values
712
- */
713
- values: string[];
714
- }
715
- /**
716
- * ImpressionsMode type
717
- * @typedef {string} ImpressionsMode
718
- */
719
- type ImpressionsMode = 'OPTIMIZED' | 'DEBUG' | 'NONE';
720
- /**
721
- * Defines the format of Split data to preload on the factory storage (cache).
722
- */
723
- interface PreloadedData {
724
- /**
725
- * Timestamp of the last moment the data was synchronized with Split servers.
726
- * If this value is older than 10 days ago (expiration time policy), the data is not used to update the storage content.
727
- * @TODO configurable expiration time policy?
728
- */
729
- lastUpdated: number;
730
- /**
731
- * Change number of the preloaded data.
732
- * If this value is older than the current changeNumber at the storage, the data is not used to update the storage content.
733
- */
734
- since: number;
735
- /**
736
- * Map of splits to their serialized definitions.
737
- */
738
- splitsData: {
739
- [splitName: string]: string;
740
- };
741
- /**
742
- * Optional map of user keys to their list of segments.
743
- * @TODO remove when releasing first version
744
- */
745
- mySegmentsData?: {
746
- [key: string]: string[];
747
- };
748
- /**
749
- * Optional map of segments to their serialized definitions.
750
- * This property is ignored if `mySegmentsData` was provided.
751
- */
752
- segmentsData?: {
753
- [segmentName: string]: string;
754
- };
755
- }
756
- /**
757
- * Settings interface for SDK instances created on the browser
758
- * @interface IBrowserSettings
759
- * @extends ISharedSettings
760
- * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#configuration}
761
- */
762
- interface IBrowserSettings extends ISharedSettings {
763
- /**
764
- * SDK Startup settings for the Browser.
765
- * @property {Object} startup
766
- */
767
- startup?: {
768
- /**
769
- * Maximum amount of time used before notify a timeout.
770
- * @property {number} readyTimeout
771
- * @default 1.5
772
- */
773
- readyTimeout?: number;
774
- /**
775
- * 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'.
776
- * @property {number} requestTimeoutBeforeReady
777
- * @default 1.5
778
- */
779
- requestTimeoutBeforeReady?: number;
780
- /**
781
- * How many quick retries we will do while starting up the SDK.
782
- * @property {number} retriesOnFailureBeforeReady
783
- * @default 1
784
- */
785
- retriesOnFailureBeforeReady?: number;
786
- /**
787
- * For SDK posts the queued events data in bulks with a given rate, but the first push window is defined separately,
788
- * to better control on browsers. This number defines that window before the first events push.
789
- *
790
- * @property {number} eventsFirstPushWindow
791
- * @default 10
792
- */
793
- eventsFirstPushWindow?: number;
794
- };
795
- /**
796
- * SDK scheduler settings.
797
- * @property {Object} scheduler
798
- */
799
- scheduler?: {
800
- /**
801
- * The SDK polls Split servers for changes to feature roll-out plans. This parameter controls this polling period in seconds.
802
- * @property {number} featuresRefreshRate
803
- * @default 30
804
- */
805
- featuresRefreshRate?: number;
806
- /**
807
- * 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.
808
- * @property {number} impressionsRefreshRate
809
- * @default 60
810
- */
811
- impressionsRefreshRate?: number;
812
- /**
813
- * The maximum number of impression items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
814
- * If you use a 0 here, the queue will have no maximum size.
815
- * @property {number} impressionsQueueSize
816
- * @default 30000
817
- */
818
- impressionsQueueSize?: number;
819
- /**
820
- * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
821
- * @property {number} metricsRefreshRate
822
- * @default 120
823
- * @deprecated This parameter is ignored now.
824
- */
825
- metricsRefreshRate?: number;
826
- /**
827
- * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
828
- * @property {number} telemetryRefreshRate
829
- * @default 3600
830
- */
831
- telemetryRefreshRate?: number;
832
- /**
833
- * The SDK polls Split servers for changes to segment definitions. This parameter controls this polling period in seconds.
834
- * @property {number} segmentsRefreshRate
835
- * @default 60
836
- */
837
- segmentsRefreshRate?: number;
838
- /**
839
- * The SDK posts the queued events data in bulks. This parameter controls the posting rate in seconds.
840
- * @property {number} eventsPushRate
841
- * @default 60
842
- */
843
- eventsPushRate?: number;
844
- /**
845
- * The maximum number of event items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
846
- * If you use a 0 here, the queue will have no maximum size.
847
- * @property {number} eventsQueueSize
848
- * @default 500
849
- */
850
- eventsQueueSize?: number;
851
- /**
852
- * For mocking/testing only. The SDK will refresh the features mocked data when mode is set to "localhost" by defining the key.
853
- * For more information @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
854
- * @property {number} offlineRefreshRate
855
- * @default 15
856
- */
857
- offlineRefreshRate?: number;
858
- /**
859
- * When using streaming mode, seconds to wait before re attempting to connect for push notifications.
860
- * Next attempts follow intervals in power of two: base seconds, base x 2 seconds, base x 4 seconds, ...
861
- * @property {number} pushRetryBackoffBase
862
- * @default 1
863
- */
864
- pushRetryBackoffBase?: number;
865
- };
866
- /**
867
- * SDK Core settings for the browser.
868
- * @property {Object} core
869
- */
870
- core: {
871
- /**
872
- * Your API key. More information: @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
873
- * @property {string} authorizationKey
874
- */
875
- authorizationKey: string;
876
- /**
877
- * Customer identifier. Whatever this means to you. @see {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
878
- * @property {SplitKey} key
879
- */
880
- key: SplitKey;
881
- /**
882
- * Traffic type associated with the customer identifier. @see {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
883
- * If no provided as a setting it will be required on the client.track() calls.
884
- * @property {string} trafficType
885
- */
886
- trafficType?: string;
887
- /**
888
- * Disable labels from being sent to Split backend. Labels may contain sensitive information.
889
- * @property {boolean} labelsEnabled
890
- * @default true
891
- */
892
- labelsEnabled?: boolean;
893
- };
894
- /**
895
- * Mocked features map. For testing purposses only. For using this you should specify "localhost" as authorizationKey on core settings.
896
- * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
897
- */
898
- features?: MockedFeaturesMap;
899
- /**
900
- * Defines which kind of storage we should instanciate.
901
- * @property {Object} storage
902
- */
903
- storage?: (params: IStorageFactoryParams) => IStorageSync | IStorageAsync;
904
- /**
905
- * List of URLs that the SDK will use as base for it's synchronization functionalities, applicable only when running as standalone.
906
- * Do not change these settings unless you're working an advanced use case, like connecting to the Split proxy.
907
- * @property {Object} urls
908
- */
909
- urls?: UrlSettings;
910
- }
911
- /**
912
- * Settings interface for SDK instances created on NodeJS.
913
- * If your storage is asynchronous (Redis for example) use SplitIO.INodeAsyncSettings instead.
914
- * @interface INodeSettings
915
- * @extends INodeBasicSettings
916
- * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#configuration}
917
- */
918
- interface INodeSettings extends INodeBasicSettings {
919
- /**
920
- * List of URLs that the SDK will use as base for it's synchronization functionalities, applicable only when running as standalone.
921
- * Do not change these settings unless you're working an advanced use case, like connecting to the Split proxy.
922
- * @property {Object} urls
923
- */
924
- urls?: UrlSettings;
925
- /**
926
- * Defines which kind of storage we should instanciate.
927
- * @property {Object} storage
928
- */
929
- storage?: (params: IStorageFactoryParams) => IStorageSync;
930
- }
931
- /**
932
- * Settings interface with async storage for SDK instances created on NodeJS.
933
- * If your storage is synchronous (by defaut we use memory, which is sync) use SplitIO.INodeSyncSettings instead.
934
- * @interface INodeAsyncSettings
935
- * @extends INodeBasicSettings
936
- * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#configuration}
937
- */
938
- interface INodeAsyncSettings extends INodeBasicSettings {
939
- storage?: (params: IStorageFactoryParams) => IStorageAsync;
940
- }
941
- /**
942
- * This represents the interface for the Server-side SDK instance with synchronous storage.
943
- * @interface ISDK
944
- * @extends IBasicSDK
945
- */
946
- interface ISDK extends IBasicSDK {
947
- /**
948
- * Returns the client instance of the SDK.
949
- * @function client
950
- * @returns {IClient} The client instance.
951
- */
952
- client(): IClient;
953
- /**
954
- * Returns a manager instance of the SDK to explore available information.
955
- * @function manager
956
- * @returns {IManager} The manager instance.
957
- */
958
- manager(): IManager;
959
- }
960
- /**
961
- * This represents the interface for the Server-side SDK instance with asynchronous storage.
962
- * @interface IAsyncSDK
963
- * @extends IBasicSDK
964
- */
965
- interface IAsyncSDK extends IBasicSDK {
966
- /**
967
- * Returns the default client instance of the SDK.
968
- * @function client
969
- * @returns {IAsyncClient} The asynchronous client instance.
970
- */
971
- client(): IAsyncClient;
972
- /**
973
- * Returns a manager instance of the SDK to explore available information.
974
- * @function manager
975
- * @returns {IManager} The manager instance.
976
- */
977
- manager(): IAsyncManager;
978
- }
979
- /**
980
- * This represents the interface for the Client-side SDK instance with synchronous storage.
981
- * @interface ICsSDK
982
- * @extends IBasicSDK
983
- */
984
- interface ICsSDK extends IBasicSDK {
985
- /**
986
- * Returns the default client instance of the SDK, with the key and optional traffic type from settings.
987
- * @function client
988
- * @returns {ICsClient} The client instance.
989
- */
990
- client(): ICsClient;
991
- /**
992
- * Returns a shared client of the SDK, with the given key and optional traffic type.
993
- * @function client
994
- * @param {SplitKey} key The key for the new client instance.
995
- * @param {string=} trafficType The traffic type of the provided key.
996
- * @returns {ICsClient} The client instance.
997
- */
998
- client(key: SplitKey, trafficType?: string): ICsClient;
999
- /**
1000
- * Returns a manager instance of the SDK to explore available information.
1001
- * @function manager
1002
- * @returns {IManager} The manager instance.
1003
- */
1004
- manager(): IManager;
1005
- }
1006
- /**
1007
- * This represents the interface for the Client instance with synchronous storage for server-side SDK, where we don't have only one key.
1008
- * @interface IClient
1009
- * @extends IBasicClient
1010
- */
1011
- interface IClient extends IBasicClient {
1012
- /**
1013
- * Returns a Treatment value, which will be (or eventually be) the treatment string for the given feature.
1014
- * @function getTreatment
1015
- * @param {string} key - The string key representing the consumer.
1016
- * @param {string} splitName - The string that represents the split we wan't to get the treatment.
1017
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1018
- * @returns {Treatment} The treatment or treatment promise which will resolve to the treatment string.
1019
- */
1020
- getTreatment(key: SplitKey, splitName: string, attributes?: Attributes): Treatment;
1021
- /**
1022
- * Returns a TreatmentWithConfig value (a map of treatment and config), which will be (or eventually be) the map with treatment and config for the given feature.
1023
- * @function getTreatmentWithConfig
1024
- * @param {string} key - The string key representing the consumer.
1025
- * @param {string} splitName - The string that represents the split we wan't to get the treatment.
1026
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1027
- * @returns {TreatmentWithConfig} The TreatmentWithConfig or TreatmentWithConfig promise which will resolve to the map containing
1028
- * the treatment and the configuration stringified JSON (or null if there was no config for that treatment).
1029
- */
1030
- getTreatmentWithConfig(key: SplitKey, splitName: string, attributes?: Attributes): TreatmentWithConfig;
1031
- /**
1032
- * Returns a Treatments value, whick will be (or eventually be) an object with the treatments for the given features.
1033
- * @function getTreatments
1034
- * @param {string} key - The string key representing the consumer.
1035
- * @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
1036
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1037
- * @returns {Treatments} The treatments or treatments promise which will resolve to the treatments object.
1038
- */
1039
- getTreatments(key: SplitKey, splitNames: string[], attributes?: Attributes): Treatments;
1040
- /**
1041
- * Returns a TreatmentsWithConfig value, whick will be an object with the TreatmentWithConfig (a map with both treatment and config string) for the given features.
1042
- * @function getTreatmentsWithConfig
1043
- * @param {string} key - The string key representing the consumer.
1044
- * @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
1045
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1046
- * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1047
- */
1048
- getTreatmentsWithConfig(key: SplitKey, splitNames: string[], attributes?: Attributes): TreatmentsWithConfig;
1049
- /**
1050
- * Tracks an event to be fed to the results product on Split Webconsole.
1051
- * @function track
1052
- * @param {SplitKey} key - The key that identifies the entity related to this event.
1053
- * @param {string} trafficType - The traffic type of the entity related to this event.
1054
- * @param {string} eventType - The event type corresponding to this event.
1055
- * @param {number=} value - The value of this event.
1056
- * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
1057
- * @returns {boolean} Whether the event was added to the queue succesfully or not.
1058
- */
1059
- track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): boolean;
1060
- }
1061
- /**
1062
- * This represents the interface for the Client instance with asynchronous storage for server-side SDK, where we don't have only one key.
1063
- * @interface IAsyncClient
1064
- * @extends IBasicClient
1065
- */
1066
- interface IAsyncClient extends IBasicClient {
1067
- /**
1068
- * Returns a Treatment value, which will be (or eventually be) the treatment string for the given feature.
1069
- * For usage on NodeJS as we don't have only one key.
1070
- * NOTE: Treatment will be a promise only in async storages, like REDIS.
1071
- * @function getTreatment
1072
- * @param {string} key - The string key representing the consumer.
1073
- * @param {string} splitName - The string that represents the split we wan't to get the treatment.
1074
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1075
- * @returns {AsyncTreatment} Treatment promise which will resolve to the treatment string.
1076
- */
1077
- getTreatment(key: SplitKey, splitName: string, attributes?: Attributes): AsyncTreatment;
1078
- /**
1079
- * Returns a TreatmentWithConfig value, which will be (or eventually be) a map with both treatment and config string for the given feature.
1080
- * For usage on NodeJS as we don't have only one key.
1081
- * NOTE: Treatment will be a promise only in async storages, like REDIS.
1082
- * @function getTreatmentWithConfig
1083
- * @param {string} key - The string key representing the consumer.
1084
- * @param {string} splitName - The string that represents the split we wan't to get the treatment.
1085
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1086
- * @returns {AsyncTreatmentWithConfig} TreatmentWithConfig promise which will resolve to the TreatmentWithConfig object.
1087
- */
1088
- getTreatmentWithConfig(key: SplitKey, splitName: string, attributes?: Attributes): AsyncTreatmentWithConfig;
1089
- /**
1090
- * Returns a Treatments value, whick will be (or eventually be) an object with the treatments for the given features.
1091
- * For usage on NodeJS as we don't have only one key.
1092
- * @function getTreatments
1093
- * @param {string} key - The string key representing the consumer.
1094
- * @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
1095
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1096
- * @returns {AsyncTreatments} Treatments promise which will resolve to the treatments object.
1097
- */
1098
- getTreatments(key: SplitKey, splitNames: string[], attributes?: Attributes): AsyncTreatments;
1099
- /**
1100
- * Returns a Treatments value, whick will be (or eventually be) an object with all the maps of treatment and config string for the given features.
1101
- * For usage on NodeJS as we don't have only one key.
1102
- * @function getTreatmentsWithConfig
1103
- * @param {string} key - The string key representing the consumer.
1104
- * @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
1105
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1106
- * @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise which will resolve to the map of TreatmentsWithConfig objects.
1107
- */
1108
- getTreatmentsWithConfig(key: SplitKey, splitNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig;
1109
- /**
1110
- * 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).
1111
- * @function track
1112
- * @param {SplitKey} key - The key that identifies the entity related to this event.
1113
- * @param {string} trafficType - The traffic type of the entity related to this event.
1114
- * @param {string} eventType - The event type corresponding to this event.
1115
- * @param {number=} value - The value of this event.
1116
- * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
1117
- * @returns {Promise<boolean>} A promise that resolves to a boolean indicating if the event was added to the queue succesfully or not.
1118
- */
1119
- track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): Promise<boolean>;
1120
- }
1121
- /**
1122
- * This represents the interface for the Client instance with synchronous storage for client-side SDK, where each client has associated a key and optionally a traffic type.
1123
- * @interface IClient
1124
- * @extends IBasicClient
1125
- */
1126
- interface ICsClient extends IBasicClient {
1127
- /**
1128
- * Returns a Treatment value, which will be the treatment string for the given feature.
1129
- * @function getTreatment
1130
- * @param {string} splitName - The string that represents the split we wan't to get the treatment.
1131
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1132
- * @returns {Treatment} The treatment result.
1133
- */
1134
- getTreatment(splitName: string, attributes?: Attributes): Treatment;
1135
- /**
1136
- * Returns a TreatmentWithConfig value, which will be a map of treatment and the config for that treatment.
1137
- * @function getTreatment
1138
- * @param {string} splitName - The string that represents the split we wan't to get the treatment.
1139
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1140
- * @returns {TreatmentWithConfig} The treatment or treatment promise which will resolve to the treatment string.
1141
- */
1142
- getTreatmentWithConfig(splitName: string, attributes?: Attributes): TreatmentWithConfig;
1143
- /**
1144
- * Returns a Treatments value, whick will be (or eventually be) an object with the treatments for the given features.
1145
- * @function getTreatments
1146
- * @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
1147
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1148
- * @returns {Treatments} The treatments or treatments promise which will resolve to the treatments object.
1149
- */
1150
- getTreatments(splitNames: string[], attributes?: Attributes): Treatments;
1151
- /**
1152
- * Returns a TreatmentsWithConfig value, whick will be an object with the TreatmentWithConfig (a map with both treatment and config string) for the given features.
1153
- * @function getTreatmentsWithConfig
1154
- * @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
1155
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1156
- * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1157
- */
1158
- getTreatmentsWithConfig(splitNames: string[], attributes?: Attributes): TreatmentsWithConfig;
1159
- /**
1160
- * Tracks an event to be fed to the results product on Split Webconsole.
1161
- * @function track
1162
- * @param {string} trafficType - The traffic type of the entity related to this event. NOTE: only has to be provided if the client doesn't have a traffic type
1163
- * @param {string} eventType - The event type corresponding to this event.
1164
- * @param {number=} value - The value of this event.
1165
- * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
1166
- * @returns {boolean} Whether the event was added to the queue succesfully or not.
1167
- */
1168
- track(...args: [trafficType: string, eventType: string, value?: number, properties?: Properties] | [eventType: string, value?: number, properties?: Properties]): boolean;
1169
- /**
1170
- * Add an attribute to client's in memory attributes storage
1171
- * @function setAttribute
1172
- * @param {string} attributeName Attrinute name
1173
- * @param {string, number, boolean, list} attributeValue Attribute value
1174
- * @returns {boolean} true if the attribute was stored and false otherways
1175
- */
1176
- setAttribute(attributeName: string, attributeValue: Object): boolean;
1177
- /**
1178
- * Returns the attribute with the given key
1179
- * @function getAttribute
1180
- * @param {string} attributeName Attribute name
1181
- * @returns {Object} Attribute with the given key
1182
- */
1183
- getAttribute(attributeName: string): Object;
1184
- /**
1185
- * Add to client's in memory attributes storage the attributes in 'attributes'
1186
- * @function setAttributes
1187
- * @param {Object} attributes Object with attributes to store
1188
- * @returns true if attributes were stored an false otherways
1189
- */
1190
- setAttributes(attributes: Record<string, Object>): boolean;
1191
- /**
1192
- * Return all the attributes stored in client's in memory attributes storage
1193
- * @function getAttributes
1194
- * @returns {Object} returns all the stored attributes
1195
- */
1196
- getAttributes(): Record<string, Object>;
1197
- /**
1198
- * Removes from client's in memory attributes storage the attribute with the given key
1199
- * @function removeAttribute
1200
- * @param {string} attributeName
1201
- * @returns {boolean} true if attribute was removed and false otherways
1202
- */
1203
- removeAttribute(attributeName: string): boolean;
1204
- /**
1205
- * Remove all the stored attributes in the client's in memory attribute storage
1206
- */
1207
- clearAttributes(): boolean;
1208
- }
1209
- /**
1210
- * Representation of a manager instance with synchronous storage of the SDK.
1211
- * @interface IManager
1212
- * @extends IStatusInterface
1213
- */
1214
- interface IManager extends IStatusInterface {
1215
- /**
1216
- * Get the array of Split names.
1217
- * @function names
1218
- * @returns {SplitNames} The lists of Split names.
1219
- */
1220
- names(): SplitNames;
1221
- /**
1222
- * Get the array of splits data in SplitView format.
1223
- * @function splits
1224
- * @returns {SplitViews} The list of SplitIO.SplitView.
1225
- */
1226
- splits(): SplitViews;
1227
- /**
1228
- * Get the data of a split in SplitView format.
1229
- * @function split
1230
- * @param {string} splitName The name of the split we wan't to get info of.
1231
- * @returns {SplitView} The SplitIO.SplitView of the given split.
1232
- */
1233
- split(splitName: string): SplitView;
1234
- }
1235
- /**
1236
- * Representation of a manager instance with asynchronous storage of the SDK.
1237
- * @interface IAsyncManager
1238
- * @extends IStatusInterface
1239
- */
1240
- interface IAsyncManager extends IStatusInterface {
1241
- /**
1242
- * Get the array of Split names.
1243
- * @function names
1244
- * @returns {SplitNamesAsync} A promise that will resolve to the array of Splitio.SplitNames.
1245
- */
1246
- names(): SplitNamesAsync;
1247
- /**
1248
- * Get the array of splits data in SplitView format.
1249
- * @function splits
1250
- * @returns {SplitViewsAsync} A promise that will resolve to the SplitIO.SplitView list.
1251
- */
1252
- splits(): SplitViewsAsync;
1253
- /**
1254
- * Get the data of a split in SplitView format.
1255
- * @function split
1256
- * @param {string} splitName The name of the split we wan't to get info of.
1257
- * @returns {SplitViewAsync} A promise that will resolve to the SplitIO.SplitView value.
1258
- */
1259
- split(splitName: string): SplitViewAsync;
1260
- }
1261
- }
1262
- export {};