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