@splitsoftware/splitio-commons 2.0.0-rc.4 → 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 (272) 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 +3 -2
  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/splitio.d.ts +885 -1237
@@ -7,335 +7,324 @@ import { RequestOptions } from 'http';
7
7
  export as namespace SplitIO;
8
8
  export = SplitIO;
9
9
 
10
+ /****** Exposed namespace ******/
10
11
  /**
11
- * EventEmitter interface based on a subset of the NodeJS.EventEmitter methods.
12
- */
13
- interface IEventEmitter {
14
- addListener(event: string, listener: (...args: any[]) => void): this;
15
- on(event: string, listener: (...args: any[]) => void): this;
16
- once(event: string, listener: (...args: any[]) => void): this;
17
- removeListener(event: string, listener: (...args: any[]) => void): this;
18
- off(event: string, listener: (...args: any[]) => void): this;
19
- removeAllListeners(event?: string): this;
20
- emit(event: string, ...args: any[]): boolean;
21
- }
22
- /**
23
- * NodeJS.EventEmitter interface
24
- * @see {@link https://nodejs.org/api/events.html}
25
- */
26
- interface EventEmitter extends IEventEmitter {
27
- addListener(event: string | symbol, listener: (...args: any[]) => void): this;
28
- on(event: string | symbol, listener: (...args: any[]) => void): this;
29
- once(event: string | symbol, listener: (...args: any[]) => void): this;
30
- removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
31
- off(event: string | symbol, listener: (...args: any[]) => void): this;
32
- removeAllListeners(event?: string | symbol): this;
33
- emit(event: string | symbol, ...args: any[]): boolean;
34
- setMaxListeners(n: number): this;
35
- getMaxListeners(): number;
36
- listeners(event: string | symbol): Function[];
37
- rawListeners(event: string | symbol): Function[];
38
- listenerCount(type: string | symbol): number;
39
- // Added in Node 6...
40
- prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
41
- prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
42
- eventNames(): Array<string | symbol>;
43
- }
44
- /**
45
- * @typedef {Object} EventConsts
46
- * @property {string} SDK_READY The ready event.
47
- * @property {string} SDK_READY_FROM_CACHE The ready event when fired with cached data.
48
- * @property {string} SDK_READY_TIMED_OUT The timeout event.
49
- * @property {string} SDK_UPDATE The update event.
50
- */
51
- type EventConsts = {
52
- SDK_READY: 'init::ready';
53
- SDK_READY_FROM_CACHE: 'init::cache-ready';
54
- SDK_READY_TIMED_OUT: 'init::timeout';
55
- SDK_UPDATE: 'state::update';
56
- };
57
- /**
58
- * SDK Modes.
59
- * @typedef {string} SDKMode
60
- */
61
- type SDKMode = 'standalone' | 'localhost' | 'consumer' | 'consumer_partial';
62
- /**
63
- * Storage types.
64
- * @typedef {string} StorageType
65
- */
66
- type StorageType = 'MEMORY' | 'LOCALSTORAGE' | 'REDIS' | 'PLUGGABLE';
67
- /**
68
- * Settings interface. This is a representation of the settings the SDK expose, that's why
69
- * most of it's props are readonly. Only features should be rewritten when localhost mode is active.
70
- * @interface ISettings
71
- */
72
- interface ISettings {
73
- readonly core: {
74
- authorizationKey: string;
75
- key: SplitIO.SplitKey;
76
- labelsEnabled: boolean;
77
- IPAddressesEnabled: boolean;
78
- };
79
- readonly mode: SDKMode;
80
- readonly scheduler: {
81
- featuresRefreshRate: number;
82
- impressionsRefreshRate: number;
83
- impressionsQueueSize: number;
84
- /**
85
- * @deprecated
86
- */
87
- metricsRefreshRate?: number;
88
- telemetryRefreshRate: number;
89
- segmentsRefreshRate: number;
90
- offlineRefreshRate: number;
91
- eventsPushRate: number;
92
- eventsQueueSize: number;
93
- pushRetryBackoffBase: number;
94
- };
95
- readonly startup: {
96
- readyTimeout: number;
97
- requestTimeoutBeforeReady: number;
98
- retriesOnFailureBeforeReady: number;
99
- eventsFirstPushWindow: number;
100
- };
101
- readonly storage: SplitIO.StorageSyncFactory | SplitIO.StorageAsyncFactory | SplitIO.StorageOptions;
102
- readonly urls: {
103
- events: string;
104
- sdk: string;
105
- auth: string;
106
- streaming: string;
107
- telemetry: string;
108
- };
109
- readonly integrations?: SplitIO.IntegrationFactory[];
110
- readonly debug: boolean | LogLevel | SplitIO.ILogger;
111
- readonly version: string;
112
- /**
113
- * Mocked features map if using in client-side, or mocked features file path string if using in server-side (NodeJS).
114
- */
115
- features: SplitIO.MockedFeaturesMap | SplitIO.MockedFeaturesFilePath;
116
- readonly streamingEnabled: boolean;
117
- readonly sync: {
118
- splitFilters: SplitIO.SplitFilter[];
119
- impressionsMode: SplitIO.ImpressionsMode;
120
- enabled: boolean;
121
- flagSpecVersion: string;
122
- requestOptions?: {
123
- getHeaderOverrides?: (context: { headers: Record<string, string> }) => Record<string, string>;
124
- };
125
- };
126
- /**
127
- * User consent status if using in client-side. Undefined if using in server-side (NodeJS).
128
- */
129
- readonly userConsent?: SplitIO.ConsentStatus
130
- }
131
- /**
132
- * Log levels.
133
- * @typedef {string} LogLevel
134
- */
135
- type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR' | 'NONE';
136
- /**
137
- * Logger API
138
- * @interface ILoggerAPI
12
+ * Shared types and interfaces for `@splitsoftware` packages, to support integrating JavaScript SDKs with TypeScript.
139
13
  */
140
- interface ILoggerAPI {
141
- /**
142
- * Enables SDK logging to the console.
143
- * @function enable
144
- * @returns {void}
145
- */
146
- enable(): void;
14
+ declare namespace SplitIO {
15
+
147
16
  /**
148
- * Disables SDK logging.
149
- * @function disable
150
- * @returns {void}
17
+ * EventEmitter interface based on a subset of the NodeJS.EventEmitter methods.
151
18
  */
152
- disable(): void;
19
+ interface IEventEmitter {
20
+ addListener(event: string, listener: (...args: any[]) => void): this;
21
+ on(event: string, listener: (...args: any[]) => void): this;
22
+ once(event: string, listener: (...args: any[]) => void): this;
23
+ removeListener(event: string, listener: (...args: any[]) => void): this;
24
+ off(event: string, listener: (...args: any[]) => void): this;
25
+ removeAllListeners(event?: string): this;
26
+ emit(event: string, ...args: any[]): boolean;
27
+ }
153
28
  /**
154
- * Sets a log level for the SDK logs.
155
- * @function setLogLevel
156
- * @returns {void}
157
- */
158
- setLogLevel(logLevel: LogLevel): void;
29
+ * NodeJS.EventEmitter interface
30
+ * @see {@link https://nodejs.org/api/events.html}
31
+ */
32
+ interface EventEmitter extends IEventEmitter {
33
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this;
34
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
35
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
36
+ removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
37
+ off(event: string | symbol, listener: (...args: any[]) => void): this;
38
+ removeAllListeners(event?: string | symbol): this;
39
+ emit(event: string | symbol, ...args: any[]): boolean;
40
+ setMaxListeners(n: number): this;
41
+ getMaxListeners(): number;
42
+ listeners(event: string | symbol): Function[];
43
+ rawListeners(event: string | symbol): Function[];
44
+ listenerCount(type: string | symbol): number;
45
+ // Added in Node 6...
46
+ prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
47
+ prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
48
+ eventNames(): Array<string | symbol>;
49
+ }
159
50
  /**
160
- * Log level constants. Use this to pass them to setLogLevel function.
51
+ * Event constants.
161
52
  */
162
- LogLevel: {
163
- [level in LogLevel]: LogLevel;
53
+ type EventConsts = {
54
+ /**
55
+ * The ready event.
56
+ */
57
+ SDK_READY: 'init::ready';
58
+ /**
59
+ * The ready event when fired with cached data.
60
+ */
61
+ SDK_READY_FROM_CACHE: 'init::cache-ready';
62
+ /**
63
+ * The timeout event.
64
+ */
65
+ SDK_READY_TIMED_OUT: 'init::timeout';
66
+ /**
67
+ * The update event.
68
+ */
69
+ SDK_UPDATE: 'state::update';
164
70
  };
165
- }
166
- /**
167
- * User consent API
168
- * @interface IUserConsentAPI
169
- */
170
- interface IUserConsentAPI {
171
71
  /**
172
- * Sets or updates the user consent status. Possible values are `true` and `false`, which represent user consent `'GRANTED'` and `'DECLINED'` respectively.
173
- * - `true ('GRANTED')`: the user has granted consent for tracking events and impressions. The SDK will send them to Split cloud.
174
- * - `false ('DECLINED')`: the user has declined consent for tracking events and impressions. The SDK will not send them to Split cloud.
175
- *
176
- * NOTE: calling this method updates the user consent at a factory level, affecting all clients of the same factory.
177
- *
178
- * @function setStatus
179
- * @param {boolean} userConsent The user consent status, true for 'GRANTED' and false for 'DECLINED'.
180
- * @returns {boolean} Whether the provided param is a valid value (i.e., a boolean value) or not.
72
+ * SDK Modes.
181
73
  */
182
- setStatus(userConsent: boolean): boolean;
74
+ type SDKMode = 'standalone' | 'localhost' | 'consumer' | 'consumer_partial';
183
75
  /**
184
- * Gets the user consent status.
185
- *
186
- * @function getStatus
187
- * @returns {ConsentStatus} The user consent status.
76
+ * Storage types.
188
77
  */
189
- getStatus(): SplitIO.ConsentStatus;
78
+ type StorageType = 'MEMORY' | 'LOCALSTORAGE' | 'REDIS' | 'PLUGGABLE';
190
79
  /**
191
- * Consent status constants. Use this to compare with the getStatus function result.
80
+ * Settings interface. This is a representation of the settings the SDK expose, that's why
81
+ * most of it's props are readonly. Only features should be rewritten when localhost mode is active.
192
82
  */
193
- Status: {
194
- [status in SplitIO.ConsentStatus]: SplitIO.ConsentStatus;
195
- };
196
- }
197
- /**
198
- * Common API for entities that expose status handlers.
199
- * @interface IStatusInterface
200
- * @extends EventEmitter
201
- */
202
- interface IStatusInterface extends EventEmitter {
83
+ interface ISettings {
84
+ readonly core: {
85
+ authorizationKey: string;
86
+ key: SplitIO.SplitKey;
87
+ labelsEnabled: boolean;
88
+ IPAddressesEnabled: boolean;
89
+ };
90
+ readonly mode: SDKMode;
91
+ readonly scheduler: {
92
+ featuresRefreshRate: number;
93
+ impressionsRefreshRate: number;
94
+ impressionsQueueSize: number;
95
+ /**
96
+ * @deprecated Use `telemetryRefreshRate` instead.
97
+ */
98
+ metricsRefreshRate?: number;
99
+ telemetryRefreshRate: number;
100
+ segmentsRefreshRate: number;
101
+ offlineRefreshRate: number;
102
+ eventsPushRate: number;
103
+ eventsQueueSize: number;
104
+ pushRetryBackoffBase: number;
105
+ };
106
+ readonly startup: {
107
+ readyTimeout: number;
108
+ requestTimeoutBeforeReady: number;
109
+ retriesOnFailureBeforeReady: number;
110
+ eventsFirstPushWindow: number;
111
+ };
112
+ readonly storage: SplitIO.StorageSyncFactory | SplitIO.StorageAsyncFactory | SplitIO.StorageOptions;
113
+ readonly urls: {
114
+ events: string;
115
+ sdk: string;
116
+ auth: string;
117
+ streaming: string;
118
+ telemetry: string;
119
+ };
120
+ readonly integrations?: SplitIO.IntegrationFactory[];
121
+ readonly debug: boolean | LogLevel | SplitIO.ILogger;
122
+ readonly version: string;
123
+ /**
124
+ * Mocked features map if using in client-side, or mocked features file path string if using in server-side (NodeJS).
125
+ */
126
+ features: SplitIO.MockedFeaturesMap | SplitIO.MockedFeaturesFilePath;
127
+ readonly streamingEnabled: boolean;
128
+ readonly sync: {
129
+ splitFilters: SplitIO.SplitFilter[];
130
+ impressionsMode: SplitIO.ImpressionsMode;
131
+ enabled: boolean;
132
+ flagSpecVersion: string;
133
+ requestOptions?: {
134
+ getHeaderOverrides?: (context: { headers: Record<string, string> }) => Record<string, string>;
135
+ };
136
+ };
137
+ readonly runtime: {
138
+ ip: string | false;
139
+ hostname: string | false;
140
+ };
141
+ readonly impressionListener?: SplitIO.IImpressionListener;
142
+ /**
143
+ * User consent status if using in client-side. Undefined if using in server-side (NodeJS).
144
+ */
145
+ readonly userConsent?: SplitIO.ConsentStatus;
146
+ }
203
147
  /**
204
- * Constant object containing the SDK events for you to use.
205
- * @property {EventConsts} Event
148
+ * Log levels.
206
149
  */
207
- Event: EventConsts;
150
+ type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR' | 'NONE';
208
151
  /**
209
- * Returns a promise that resolves once the SDK has finished loading (`SDK_READY` event emitted) or rejected if the SDK has timedout (`SDK_READY_TIMED_OUT` event emitted).
210
- * As it's meant to provide similar flexibility to the event approach, given that the SDK might be eventually ready after a timeout event, the `ready` method will return a resolved promise once the SDK is ready.
211
- *
212
- * 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.
213
- * However, when using async/await syntax, the rejection should be explicitly propagated like in the following example:
214
- * ```
215
- * try {
216
- * await client.ready().catch((e) => { throw e; });
217
- * // SDK is ready
218
- * } catch(e) {
219
- * // SDK has timedout
220
- * }
221
- * ```
222
- *
223
- * @function ready
224
- * @returns {Promise<void>}
152
+ * Logger API
225
153
  */
226
- ready(): Promise<void>;
227
- }
228
- /**
229
- * Common definitions between clients for different environments interface.
230
- * @interface IBasicClient
231
- * @extends IStatusInterface
232
- */
233
- interface IBasicClient extends IStatusInterface {
154
+ interface ILoggerAPI {
155
+ /**
156
+ * Enables SDK logging to the console.
157
+ */
158
+ enable(): void;
159
+ /**
160
+ * Disables SDK logging.
161
+ */
162
+ disable(): void;
163
+ /**
164
+ * Sets a log level for the SDK logs.
165
+ */
166
+ setLogLevel(logLevel: LogLevel): void;
167
+ /**
168
+ * Log level constants. Use this to pass them to setLogLevel function.
169
+ */
170
+ LogLevel: {
171
+ [level in LogLevel]: LogLevel;
172
+ };
173
+ }
234
174
  /**
235
- * Destroys the client instance.
236
- *
237
- * In 'standalone' and 'partial consumer' modes, this method will flush any pending impressions and events.
238
- * In 'standalone' mode, it also stops the synchronization of feature flag definitions with the backend.
239
- * In 'consumer' and 'partial consumer' modes, this method also disconnects the SDK from the Pluggable storage.
240
- *
241
- * @function destroy
242
- * @returns {Promise<void>} A promise that resolves once the client is destroyed.
175
+ * User consent API
243
176
  */
244
- destroy(): Promise<void>;
245
- }
246
- /**
247
- * Common definitions between SDK instances for different environments interface.
248
- * @interface IBasicSDK
249
- */
250
- interface IBasicSDK {
177
+ interface IUserConsentAPI {
178
+ /**
179
+ * Sets or updates the user consent status. Possible values are `true` and `false`, which represent user consent `'GRANTED'` and `'DECLINED'` respectively.
180
+ * - `true ('GRANTED')`: the user has granted consent for tracking events and impressions. The SDK will send them to Split cloud.
181
+ * - `false ('DECLINED')`: the user has declined consent for tracking events and impressions. The SDK will not send them to Split cloud.
182
+ *
183
+ * NOTE: calling this method updates the user consent at a factory level, affecting all clients of the same factory.
184
+ *
185
+ * @param userConsent - The user consent status, true for 'GRANTED' and false for 'DECLINED'.
186
+ * @returns Whether the provided param is a valid value (i.e., a boolean value) or not.
187
+ */
188
+ setStatus(userConsent: boolean): boolean;
189
+ /**
190
+ * Gets the user consent status.
191
+ *
192
+ * @returns The user consent status.
193
+ */
194
+ getStatus(): SplitIO.ConsentStatus;
195
+ /**
196
+ * Consent status constants. Use this to compare with the getStatus function result.
197
+ */
198
+ Status: {
199
+ [status in SplitIO.ConsentStatus]: SplitIO.ConsentStatus;
200
+ };
201
+ }
251
202
  /**
252
- * Current settings of the SDK instance.
253
- * @property settings
203
+ * Common API for entities that expose status handlers.
254
204
  */
255
- settings: ISettings;
205
+ interface IStatusInterface extends EventEmitter {
206
+ /**
207
+ * Constant object containing the SDK events for you to use.
208
+ */
209
+ Event: EventConsts;
210
+ /**
211
+ * Returns a promise that resolves once the SDK has finished loading (`SDK_READY` event emitted) or rejected if the SDK has timedout (`SDK_READY_TIMED_OUT` event emitted).
212
+ * As it's meant to provide similar flexibility to the event approach, given that the SDK might be eventually ready after a timeout event, the `ready` method will return a resolved promise once the SDK is ready.
213
+ *
214
+ * 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.
215
+ * However, when using async/await syntax, the rejection should be explicitly propagated like in the following example:
216
+ * ```
217
+ * try {
218
+ * await client.ready().catch((e) => { throw e; });
219
+ * // SDK is ready
220
+ * } catch(e) {
221
+ * // SDK has timedout
222
+ * }
223
+ * ```
224
+ *
225
+ * @returns A promise that resolves once the SDK is ready or rejects if the SDK has timedout.
226
+ */
227
+ ready(): Promise<void>;
228
+ }
256
229
  /**
257
- * Logger API.
258
- * @property Logger
230
+ * Common definitions between clients for different environments interface.
259
231
  */
260
- Logger: ILoggerAPI;
232
+ interface IBasicClient extends IStatusInterface {
233
+ /**
234
+ * Destroys the client instance.
235
+ *
236
+ * In 'standalone' and 'partial consumer' modes, this method will flush any pending impressions and events.
237
+ * In 'standalone' mode, it also stops the synchronization of feature flag definitions with the backend.
238
+ * In 'consumer' and 'partial consumer' modes, this method also disconnects the SDK from the Pluggable storage.
239
+ *
240
+ * @returns A promise that resolves once the client is destroyed.
241
+ */
242
+ destroy(): Promise<void>;
243
+ }
261
244
  /**
262
- * Destroys all the clients created by this factory.
263
- * @function destroy
264
- * @returns {Promise<void>}
245
+ * Common definitions between SDK instances for different environments interface.
265
246
  */
266
- destroy(): Promise<void>;
267
- }
268
- /****** Exposed namespace ******/
269
- /**
270
- * Shared types and interfaces for `@splitsoftware` packages for usage when integrating JavaScript SDKs with TypeScript.
271
- */
272
- declare namespace SplitIO {
247
+ interface IBasicSDK {
248
+ /**
249
+ * Current settings of the SDK instance.
250
+ */
251
+ settings: ISettings;
252
+ /**
253
+ * Logger API.
254
+ */
255
+ Logger: ILoggerAPI;
256
+ /**
257
+ * Destroys all the clients created by this factory.
258
+ *
259
+ * @returns A promise that resolves once all clients are destroyed.
260
+ */
261
+ destroy(): Promise<void>;
262
+ }
273
263
  /**
274
264
  * Feature flag treatment value, returned by getTreatment.
275
- * @typedef {string} Treatment
276
265
  */
277
266
  type Treatment = string;
278
267
  /**
279
268
  * Feature flag treatment promise that resolves to actual treatment value.
280
- * @typedef {Promise<string>} AsyncTreatment
281
269
  */
282
- type AsyncTreatment = Promise<string>;
270
+ type AsyncTreatment = Promise<Treatment>;
283
271
  /**
284
272
  * An object with the treatments for a bulk of feature flags, returned by getTreatments. For example:
273
+ * ```
285
274
  * {
286
275
  * feature1: 'on',
287
- * feature2: 'off
276
+ * feature2: 'off'
288
277
  * }
289
- * @typedef {Object.<Treatment>} Treatments
278
+ * ```
290
279
  */
291
280
  type Treatments = {
292
281
  [featureName: string]: Treatment;
293
282
  };
294
283
  /**
295
284
  * Feature flag treatments promise that resolves to the actual SplitIO.Treatments object.
296
- * @typedef {Promise<Treatments>} AsyncTreatments
297
285
  */
298
286
  type AsyncTreatments = Promise<Treatments>;
299
287
  /**
300
288
  * Feature flag evaluation result with treatment and configuration, returned by getTreatmentWithConfig.
301
- * @typedef {Object} TreatmentWithConfig
302
- * @property {string} treatment The treatment string
303
- * @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.
304
289
  */
305
290
  type TreatmentWithConfig = {
291
+ /**
292
+ * The treatment string.
293
+ */
306
294
  treatment: string;
295
+ /**
296
+ * The stringified version of the JSON config defined for that treatment, null if there is no config for the resulting treatment.
297
+ */
307
298
  config: string | null;
308
299
  };
309
300
  /**
310
- * Feature flag treatment promise that resolves to actual treatment with config value.
311
- * @typedef {Promise<TreatmentWithConfig>} AsyncTreatmentWithConfig
301
+ * Feature flag treatment promise that resolves to actual SplitIO.TreatmentWithConfig object.
312
302
  */
313
303
  type AsyncTreatmentWithConfig = Promise<TreatmentWithConfig>;
314
304
  /**
315
305
  * An object with the treatments with configs for a bulk of feature flags, returned by getTreatmentsWithConfig.
316
306
  * Each existing configuration is a stringified version of the JSON you defined on the Split user interface. For example:
307
+ * ```
317
308
  * {
318
309
  * feature1: { treatment: 'on', config: null }
319
310
  * feature2: { treatment: 'off', config: '{"bannerText":"Click here."}' }
320
311
  * }
321
- * @typedef {Object.<TreatmentWithConfig>} Treatments
312
+ * ```
322
313
  */
323
314
  type TreatmentsWithConfig = {
324
315
  [featureName: string]: TreatmentWithConfig;
325
316
  };
326
317
  /**
327
318
  * Feature flag treatments promise that resolves to the actual SplitIO.TreatmentsWithConfig object.
328
- * @typedef {Promise<TreatmentsWithConfig>} AsyncTreatmentsWithConfig
329
319
  */
330
320
  type AsyncTreatmentsWithConfig = Promise<TreatmentsWithConfig>;
331
321
  /**
332
322
  * Possible Split SDK events.
333
- * @typedef {string} Event
334
323
  */
335
324
  type Event = 'init::timeout' | 'init::ready' | 'init::cache-ready' | 'state::update';
336
325
  /**
337
326
  * Attributes should be on object with values of type string, boolean, number (dates should be sent as millis since epoch) or array of strings or numbers.
338
- * @typedef {Object.<AttributeType>} Attributes
327
+ *
339
328
  * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#attribute-syntax}
340
329
  */
341
330
  type Attributes = {
@@ -343,20 +332,18 @@ declare namespace SplitIO {
343
332
  };
344
333
  /**
345
334
  * Type of an attribute value
346
- * @typedef {string | number | boolean | Array<string | number>} AttributeType
347
335
  */
348
336
  type AttributeType = string | number | boolean | Array<string | number>;
349
337
  /**
350
338
  * Properties should be an object with values of type string, number, boolean or null. Size limit of ~31kb.
351
- * @typedef {Object.<number, string, boolean, null>} Properties
352
- * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#track
339
+ *
340
+ * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#track}
353
341
  */
354
342
  type Properties = {
355
343
  [propertyName: string]: string | number | boolean | null;
356
344
  };
357
345
  /**
358
346
  * The SplitKey object format.
359
- * @typedef {Object.<string>} SplitKeyObject
360
347
  */
361
348
  type SplitKeyObject = {
362
349
  matchingKey: string;
@@ -364,128 +351,114 @@ declare namespace SplitIO {
364
351
  };
365
352
  /**
366
353
  * The customer identifier. Could be a SplitKeyObject or a string.
367
- * @typedef {SplitKeyObject|string} SplitKey
368
354
  */
369
355
  type SplitKey = SplitKeyObject | string;
370
356
  /**
371
357
  * Path to file with mocked features (for node).
372
- * @typedef {string} MockedFeaturesFilePath
373
358
  */
374
359
  type MockedFeaturesFilePath = string;
375
360
  /**
376
361
  * Object with mocked features mapping for client-side (e.g., Browser or React Native). We need to specify the featureName as key, and the mocked treatment as value.
377
- * @typedef {Object} MockedFeaturesMap
378
362
  */
379
363
  type MockedFeaturesMap = {
380
364
  [featureName: string]: string | TreatmentWithConfig;
381
365
  };
366
+ /**
367
+ * Impression DTO generated by the SDK when processing evaluations.
368
+ */
369
+ type ImpressionDTO = {
370
+ feature: string;
371
+ keyName: string;
372
+ treatment: string;
373
+ time: number;
374
+ bucketingKey?: string;
375
+ label: string;
376
+ changeNumber: number;
377
+ pt?: number;
378
+ }
382
379
  /**
383
380
  * Object with information about an impression. It contains the generated impression DTO as well as
384
381
  * complementary information around where and how it was generated in that way.
385
- * @typedef {Object} ImpressionData
386
382
  */
387
383
  type ImpressionData = {
388
- impression: {
389
- feature: string;
390
- keyName: string;
391
- treatment: string;
392
- time: number;
393
- bucketingKey?: string;
394
- label: string;
395
- changeNumber: number;
396
- pt?: number;
397
- };
384
+ impression: ImpressionDTO;
398
385
  attributes?: SplitIO.Attributes;
399
- ip: string;
400
- hostname: string;
386
+ ip: string | false;
387
+ hostname: string | false;
401
388
  sdkLanguageVersion: string;
402
389
  };
403
390
  /**
404
391
  * Data corresponding to one feature flag view.
405
- * @typedef {Object} SplitView
406
392
  */
407
393
  type SplitView = {
408
394
  /**
409
395
  * The name of the feature flag.
410
- * @property {string} name
411
396
  */
412
397
  name: string;
413
398
  /**
414
399
  * The traffic type of the feature flag.
415
- * @property {string} trafficType
416
400
  */
417
401
  trafficType: string;
418
402
  /**
419
403
  * Whether the feature flag is killed or not.
420
- * @property {boolean} killed
421
404
  */
422
405
  killed: boolean;
423
406
  /**
424
407
  * The list of treatments available for the feature flag.
425
- * @property {Array<string>} treatments
426
408
  */
427
409
  treatments: Array<string>;
428
410
  /**
429
411
  * Current change number of the feature flag.
430
- * @property {number} changeNumber
431
412
  */
432
413
  changeNumber: number;
433
414
  /**
434
415
  * Map of configurations per treatment.
435
416
  * Each existing configuration is a stringified version of the JSON you defined on the Split user interface.
436
- * @property {Object.<string>} configs
437
417
  */
438
418
  configs: {
439
419
  [treatmentName: string]: string;
440
420
  };
441
421
  /**
442
422
  * List of sets of the feature flag.
443
- * @property {string[]} sets
444
423
  */
445
424
  sets: string[];
446
425
  /**
447
426
  * The default treatment of the feature flag.
448
- * @property {string} defaultTreatment
449
427
  */
450
428
  defaultTreatment: string;
451
429
  };
452
430
  /**
453
- * A promise that resolves to a feature flag view.
454
- * @typedef {Promise<SplitView>} SplitView
431
+ * A promise that resolves to a feature flag view or null if the feature flag is not found.
455
432
  */
456
- type SplitViewAsync = Promise<SplitView>;
433
+ type SplitViewAsync = Promise<SplitView | null>;
457
434
  /**
458
435
  * An array containing the SplitIO.SplitView elements.
459
436
  */
460
437
  type SplitViews = Array<SplitView>;
461
438
  /**
462
439
  * A promise that resolves to an SplitIO.SplitViews array.
463
- * @typedef {Promise<SplitViews>} SplitViewsAsync
464
440
  */
465
441
  type SplitViewsAsync = Promise<SplitViews>;
466
442
  /**
467
443
  * An array of feature flag names.
468
- * @typedef {Array<string>} SplitNames
469
444
  */
470
445
  type SplitNames = Array<string>;
471
446
  /**
472
447
  * A promise that resolves to an array of feature flag names.
473
- * @typedef {Promise<SplitNames>} SplitNamesAsync
474
448
  */
475
449
  type SplitNamesAsync = Promise<SplitNames>;
476
450
  /**
477
451
  * Storage for synchronous (standalone) SDK.
478
452
  * Its interface details are not part of the public API.
479
453
  */
480
- type StorageSync = {};
454
+ type StorageSync = any;
481
455
  /**
482
456
  * Storage builder for synchronous (standalone) SDK.
483
- * By returning undefined, the SDK will use the default IN MEMORY storage.
484
457
  * Input parameter details are not part of the public API.
485
458
  */
486
459
  type StorageSyncFactory = {
487
460
  readonly type: StorageType;
488
- (params: {}): (StorageSync | undefined);
461
+ (params: any): (StorageSync | undefined);
489
462
  }
490
463
  /**
491
464
  * Configuration params for `InLocalStorage`
@@ -493,8 +466,8 @@ declare namespace SplitIO {
493
466
  type InLocalStorageOptions = {
494
467
  /**
495
468
  * Optional prefix to prevent any kind of data collision when having multiple factories using the same storage type.
496
- * @property {string} prefix
497
- * @default 'SPLITIO'
469
+ *
470
+ * @defaultValue `'SPLITIO'`
498
471
  */
499
472
  prefix?: string;
500
473
  }
@@ -502,14 +475,14 @@ declare namespace SplitIO {
502
475
  * Storage for asynchronous (consumer) SDK.
503
476
  * Its interface details are not part of the public API.
504
477
  */
505
- type StorageAsync = {}
478
+ type StorageAsync = any
506
479
  /**
507
480
  * Storage builder for asynchronous (consumer) SDK.
508
481
  * Input parameter details are not part of the public API.
509
482
  */
510
483
  type StorageAsyncFactory = {
511
- readonly type: 'PLUGGABLE';
512
- (params: {}): StorageAsync;
484
+ readonly type: StorageType;
485
+ (params: any): StorageAsync;
513
486
  }
514
487
  /**
515
488
  * Configuration params for `PluggableStorage`
@@ -517,29 +490,25 @@ declare namespace SplitIO {
517
490
  type PluggableStorageOptions = {
518
491
  /**
519
492
  * Optional prefix to prevent any kind of data collision when having multiple factories using the same storage wrapper.
520
- * @property {string} prefix
521
- * @default 'SPLITIO'
493
+ *
494
+ * @defaultValue `'SPLITIO'`
522
495
  */
523
496
  prefix?: string;
524
497
  /**
525
498
  * Storage wrapper.
526
- * @property {Object} wrapper
527
499
  */
528
500
  wrapper: Object;
529
501
  }
530
502
  /**
531
503
  * Synchronous storage valid types for NodeJS.
532
- * @typedef {string} NodeSyncStorage
533
504
  */
534
505
  type NodeSyncStorage = 'MEMORY';
535
506
  /**
536
507
  * Asynchronous storages valid types for NodeJS.
537
- * @typedef {string} NodeAsyncStorage
538
508
  */
539
509
  type NodeAsyncStorage = 'REDIS';
540
510
  /**
541
511
  * Storage valid types for the browser.
542
- * @typedef {string} BrowserStorage
543
512
  */
544
513
  type BrowserStorage = 'MEMORY' | 'LOCALSTORAGE';
545
514
  /**
@@ -553,7 +522,7 @@ declare namespace SplitIO {
553
522
  /**
554
523
  * Impression listener interface. This is the interface that needs to be implemented
555
524
  * by the element you provide to the SDK as impression listener.
556
- * @interface IImpressionListener
525
+ *
557
526
  * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#listener}
558
527
  */
559
528
  interface IImpressionListener {
@@ -563,7 +532,7 @@ declare namespace SplitIO {
563
532
  * SDK integration instance.
564
533
  * Its interface details are not part of the public API.
565
534
  */
566
- type Integration = {};
535
+ type Integration = any;
567
536
  /**
568
537
  * SDK integration factory.
569
538
  * By returning an integration, the SDK will queue events and impressions into it.
@@ -571,21 +540,23 @@ declare namespace SplitIO {
571
540
  */
572
541
  type IntegrationFactory = {
573
542
  readonly type: string;
574
- (params: {}): (Integration | void);
543
+ (params: any): (Integration | void);
575
544
  }
576
545
  /**
577
546
  * A pair of user key and it's trafficType, required for tracking valid Split events.
578
- * @typedef {Object} Identity
579
- * @property {string} key The user key.
580
- * @property {string} trafficType The key traffic type.
581
547
  */
582
548
  type Identity = {
549
+ /**
550
+ * The user key.
551
+ */
583
552
  key: string;
553
+ /**
554
+ * The key traffic type.
555
+ */
584
556
  trafficType: string;
585
557
  };
586
558
  /**
587
559
  * Object with information about a Split event.
588
- * @typedef {Object} EventData
589
560
  */
590
561
  type EventData = {
591
562
  eventTypeId: string;
@@ -593,55 +564,68 @@ declare namespace SplitIO {
593
564
  properties?: Properties;
594
565
  trafficTypeName?: string;
595
566
  key?: string;
596
- timestamp?: number;
567
+ timestamp: number;
597
568
  };
598
569
  /**
599
570
  * Object representing the data sent by Split (events and impressions).
600
- * @typedef {Object} IntegrationData
601
- * @property {string} type The type of Split data, either 'IMPRESSION' or 'EVENT'.
602
- * @property {ImpressionData | EventData} payload The data instance itself.
603
571
  */
604
- type IntegrationData = { type: 'IMPRESSION', payload: SplitIO.ImpressionData } | { type: 'EVENT', payload: SplitIO.EventData };
572
+ type IntegrationData = {
573
+ /**
574
+ * The type of Split data.
575
+ */
576
+ type: 'IMPRESSION',
577
+ /**
578
+ * The impression data.
579
+ */
580
+ payload: SplitIO.ImpressionData
581
+ } | {
582
+ /**
583
+ * The type of Split data.
584
+ */
585
+ type: 'EVENT',
586
+ /**
587
+ * The event data.
588
+ */
589
+ payload: SplitIO.EventData
590
+ };
605
591
  /**
606
592
  * Available URL settings for the SDKs.
607
593
  */
608
594
  type UrlSettings = {
609
595
  /**
610
596
  * String property to override the base URL where the SDK will get rollout plan related data, like feature flags and segments definitions.
611
- * @property {string} sdk
612
- * @default 'https://sdk.split.io/api'
597
+ *
598
+ * @defaultValue `'https://sdk.split.io/api'`
613
599
  */
614
600
  sdk?: string;
615
601
  /**
616
602
  * String property to override the base URL where the SDK will post event-related information like impressions.
617
- * @property {string} events
618
- * @default 'https://events.split.io/api'
603
+ *
604
+ * @defaultValue `'https://events.split.io/api'`
619
605
  */
620
606
  events?: string;
621
607
  /**
622
608
  * String property to override the base URL where the SDK will get authorization tokens to be used with functionality that requires it, like streaming.
623
- * @property {string} auth
624
- * @default 'https://auth.split.io/api'
609
+ *
610
+ * @defaultValue `'https://auth.split.io/api'`
625
611
  */
626
612
  auth?: string;
627
613
  /**
628
614
  * String property to override the base URL where the SDK will connect to receive streaming updates.
629
- * @property {string} streaming
630
- * @default 'https://streaming.split.io'
615
+ *
616
+ * @defaultValue `'https://streaming.split.io'`
631
617
  */
632
618
  streaming?: string;
633
619
  /**
634
620
  * String property to override the base URL where the SDK will post telemetry data.
635
- * @property {string} telemetry
636
- * @default 'https://telemetry.split.io/api'
621
+ *
622
+ * @defaultValue `'https://telemetry.split.io/api'`
637
623
  */
638
624
  telemetry?: string;
639
625
  };
640
626
 
641
627
  /**
642
628
  * SplitFilter type.
643
- *
644
- * @typedef {string} SplitFilterType
645
629
  */
646
630
  type SplitFilterType = 'bySet' | 'byName' | 'byPrefix';
647
631
  /**
@@ -650,97 +634,40 @@ declare namespace SplitIO {
650
634
  interface SplitFilter {
651
635
  /**
652
636
  * Type of the filter.
653
- *
654
- * @property {SplitFilterType} type
655
637
  */
656
638
  type: SplitFilterType;
657
639
  /**
658
640
  * List of values: feature flag names for 'byName' filter type, and feature flag name prefixes for 'byPrefix' type.
659
- *
660
- * @property {string[]} values
661
641
  */
662
642
  values: string[];
663
643
  }
664
644
  /**
665
645
  * ImpressionsMode type
666
- * @typedef {string} ImpressionsMode
667
646
  */
668
647
  type ImpressionsMode = 'OPTIMIZED' | 'DEBUG' | 'NONE';
669
648
  /**
670
649
  * User consent status.
671
- * @typedef {string} ConsentStatus
672
650
  */
673
651
  type ConsentStatus = 'GRANTED' | 'DECLINED' | 'UNKNOWN';
674
652
  /**
675
- * Logger
676
- * Its interface details are not part of the public API. It shouldn't be used directly.
677
- * @interface ILogger
653
+ * Logger. Its interface details are not part of the public API. It shouldn't be used directly.
678
654
  */
679
655
  interface ILogger {
680
656
  setLogLevel(logLevel: LogLevel): void;
681
657
  }
682
658
  /**
683
- * Common settings interface for SDK instances created for client-side.
684
- *
685
- * @interface IClientSideBasicSettings
659
+ * Common settings properties.
686
660
  */
687
- interface IClientSideBasicSettings {
688
- /**
689
- * SDK Core settings for client-side.
690
- * @property {Object} core
691
- */
692
- core: {
693
- /**
694
- * Your SDK key.
695
- * @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
696
- * @property {string} authorizationKey
697
- */
698
- authorizationKey: string;
699
- /**
700
- * Customer identifier. Whatever this means to you.
701
- * @see {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
702
- * @property {SplitKey} key
703
- */
704
- key: SplitKey;
705
- /**
706
- * Disable labels from being sent to Split backend. Labels may contain sensitive information.
707
- * @property {boolean} labelsEnabled
708
- * @default true
709
- */
710
- labelsEnabled?: boolean;
711
- };
712
- /**
713
- * Boolean value to indicate whether the logger should be enabled or disabled by default, or a log level string or a Logger object.
714
- * Passing a logger object is required to get descriptive log messages. Otherwise most logs will print with message codes.
715
- * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#logging}.
716
- *
717
- * Examples:
718
- * ```
719
- * config.debug = true
720
- * config.debug = 'WARN'
721
- * config.debug = ErrorLogger()
722
- * ```
723
- * @property {boolean | LogLevel | ILogger} debug
724
- * @default false
725
- */
726
- debug?: boolean | LogLevel | SplitIO.ILogger;
661
+ interface ISharedSettings {
727
662
  /**
728
663
  * The impression listener, which is optional. Whatever you provide here needs to comply with the SplitIO.IImpressionListener interface,
729
664
  * which will check for the logImpression method.
730
- * @property {IImpressionListener} impressionListener
731
- * @default undefined
665
+ *
666
+ * @defaultValue `undefined`
732
667
  */
733
668
  impressionListener?: SplitIO.IImpressionListener;
734
- /**
735
- * Boolean flag to enable the streaming service as default synchronization mechanism. In the event of any issue with streaming,
736
- * the SDK would fallback to the polling mechanism. If false, the SDK would poll for changes as usual without attempting to use streaming.
737
- * @property {boolean} streamingEnabled
738
- * @default true
739
- */
740
- streamingEnabled?: boolean;
741
669
  /**
742
670
  * SDK synchronization settings.
743
- * @property {Object} sync
744
671
  */
745
672
  sync?: {
746
673
  /**
@@ -748,12 +675,13 @@ declare namespace SplitIO {
748
675
  * This configuration is only meaningful when the SDK is working in "standalone" mode.
749
676
  *
750
677
  * Example:
751
- * `splitFilter: [
752
- * { 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'
753
- * ]`
754
- * @property {SplitIO.SplitFilter[]} splitFilters
678
+ * ```
679
+ * splitFilter: [
680
+ * { 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'
681
+ * ]
682
+ * ```
755
683
  */
756
- splitFilters?: SplitIO.SplitFilter[]
684
+ splitFilters?: SplitIO.SplitFilter[];
757
685
  /**
758
686
  * Impressions Collection Mode. Option to determine how impressions are going to be sent to Split servers.
759
687
  * Possible values are 'DEBUG', 'OPTIMIZED', and 'NONE'.
@@ -761,20 +689,9 @@ declare namespace SplitIO {
761
689
  * - OPTIMIZED: will send unique impressions to Split servers, avoiding a considerable amount of traffic that duplicated impressions could generate.
762
690
  * - NONE: will send unique keys evaluated per feature to Split servers instead of full blown impressions, avoiding a considerable amount of traffic that impressions could generate.
763
691
  *
764
- * @property {string} impressionsMode
765
- * @default 'OPTIMIZED'
692
+ * @defaultValue `'OPTIMIZED'`
766
693
  */
767
694
  impressionsMode?: SplitIO.ImpressionsMode;
768
- /**
769
- * Controls the SDK continuous synchronization flags.
770
- *
771
- * When `true` a running SDK will process rollout plan updates performed on the UI (default).
772
- * When false it'll just fetch all data upon init.
773
- *
774
- * @property {boolean} enabled
775
- * @default true
776
- */
777
- enabled?: boolean
778
695
  /**
779
696
  * Custom options object for HTTP(S) requests.
780
697
  * If provided, this object is merged with the options object passed by the SDK for EventSource and Fetch calls.
@@ -785,43 +702,166 @@ declare namespace SplitIO {
785
702
  * Custom function called before each request, allowing you to add or update headers in SDK HTTP requests.
786
703
  * Some headers, such as `SplitSDKVersion`, are required by the SDK and cannot be overridden.
787
704
  * To pass multiple headers with the same name, combine their values into a single line, separated by commas. Example: `{ 'Authorization': 'value1, value2' }`
788
- * Or provide keys with different case since headers are case-insensitive. Example: `{ 'authorization': 'value1', 'Authorization': 'value2' }`
705
+ * Or provide keys with different cases since headers are case-insensitive. Example: `{ 'authorization': 'value1', 'Authorization': 'value2' }`
789
706
  *
790
707
  * NOTE: to pass custom headers to the streaming connection in Browser, you should polyfill the `window.EventSource` object with a library that supports headers,
791
- * like https://www.npmjs.com/package/event-source-polyfill, since native EventSource does not support them and will be ignored.
708
+ * like https://www.npmjs.com/package/event-source-polyfill, since native EventSource does not support them and they will be ignored.
792
709
  *
793
- * @property getHeaderOverrides
794
- * @default undefined
710
+ * @defaultValue `undefined`
795
711
  *
796
- * @param context - The context for the request.
797
- * @param context.headers - The current headers in the request.
798
- * @returns A set of headers to be merged with the current headers.
712
+ * @param context - The context for the request, which contains the `headers` property object representing the current headers in the request.
713
+ * @returns An object representing a set of headers to be merged with the current headers.
799
714
  *
800
715
  * @example
716
+ * ```
801
717
  * const getHeaderOverrides = (context) => {
802
718
  * return {
803
719
  * 'Authorization': context.headers['Authorization'] + ', other-value',
804
720
  * 'custom-header': 'custom-value'
805
721
  * };
806
722
  * };
723
+ * ```
807
724
  */
808
725
  getHeaderOverrides?: (context: { headers: Record<string, string> }) => Record<string, string>;
809
726
  };
810
727
  };
811
728
  /**
812
- * List of URLs that the SDK will use as base for it's synchronization functionalities, applicable only when running as standalone.
729
+ * List of URLs that the SDK will use as base for it's synchronization functionalities, applicable only when running as standalone and partial consumer modes.
813
730
  * Do not change these settings unless you're working an advanced use case, like connecting to the Split proxy.
814
- * @property {Object} urls
815
731
  */
816
732
  urls?: UrlSettings;
733
+ }
734
+ /**
735
+ * Common settings properties for SDKs with synchronous API (standalone and localhost modes).
736
+ */
737
+ interface ISyncSharedSettings extends ISharedSettings {
738
+ /**
739
+ * The SDK mode. When using the default in-memory storage or `InLocalStorage` as storage, the only possible value is "standalone", which is the default.
740
+ * For "localhost" mode, use "localhost" as authorizationKey.
741
+ *
742
+ * @defaultValue `'standalone'`
743
+ */
744
+ mode?: 'standalone';
745
+ /**
746
+ * Boolean flag to enable the streaming service as default synchronization mechanism. In the event of any issue with streaming,
747
+ * the SDK would fallback to the polling mechanism. If false, the SDK would poll for changes as usual without attempting to use streaming.
748
+ *
749
+ * @defaultValue `true`
750
+ */
751
+ streamingEnabled?: boolean;
752
+ /**
753
+ * SDK synchronization settings.
754
+ */
755
+ sync?: ISharedSettings['sync'] & {
756
+ /**
757
+ * Controls the SDK continuous synchronization flags.
758
+ *
759
+ * When `true` a running SDK will process rollout plan updates performed on the UI (default).
760
+ * When false it'll just fetch all data upon init.
761
+ *
762
+ * @defaultValue `true`
763
+ */
764
+ enabled?: boolean;
765
+ };
766
+ }
767
+ /**
768
+ * Common settings properties for SDKs with pluggable configuration.
769
+ */
770
+ interface IPluggableSettings {
771
+ /**
772
+ * Boolean value to indicate whether the logger should be enabled or disabled by default, or a log level string or a Logger object.
773
+ * Passing a logger object is required to get descriptive log messages. Otherwise most logs will print with message codes.
774
+ * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#logging}.
775
+ *
776
+ * Examples:
777
+ * ```
778
+ * config.debug = true
779
+ * config.debug = 'WARN'
780
+ * config.debug = ErrorLogger()
781
+ * ```
782
+ *
783
+ * @defaultValue `false`
784
+ */
785
+ debug?: boolean | LogLevel | SplitIO.ILogger;
817
786
  /**
818
787
  * Defines an optional list of factory functions used to instantiate SDK integrations.
819
788
  *
820
789
  * NOTE: at the moment there are not integrations to plug in.
821
- *
822
- * @property {Object} integrations
823
790
  */
824
791
  integrations?: IntegrationFactory[];
792
+ }
793
+ /**
794
+ * Common settings properties for SDKs without pluggable configuration.
795
+ */
796
+ interface INonPluggableSettings {
797
+ /**
798
+ * Boolean value to indicate whether the logger should be enabled or disabled, or a log level string.
799
+ *
800
+ * Examples:
801
+ * ```
802
+ * config.debug = true
803
+ * config.debug = 'WARN'
804
+ * ```
805
+ *
806
+ * @defaultValue `false`
807
+ */
808
+ debug?: boolean | LogLevel;
809
+ }
810
+ /**
811
+ * Common settings properties for server-side SDKs.
812
+ */
813
+ interface IServerSideSharedSettings {
814
+ /**
815
+ * SDK Core settings for NodeJS.
816
+ */
817
+ core: {
818
+ /**
819
+ * Your SDK key.
820
+ *
821
+ * @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
822
+ */
823
+ authorizationKey: string;
824
+ /**
825
+ * Disable labels from being sent to Split backend. Labels may contain sensitive information.
826
+ *
827
+ * @defaultValue `true`
828
+ */
829
+ labelsEnabled?: boolean;
830
+ /**
831
+ * Disable machine IP and Name from being sent to Split backend.
832
+ *
833
+ * @defaultValue `true`
834
+ */
835
+ IPAddressesEnabled?: boolean;
836
+ };
837
+ }
838
+ /**
839
+ * Common settings properties for client-side SDKs.
840
+ */
841
+ interface IClientSideSharedSettings {
842
+ /**
843
+ * SDK Core settings for client-side.
844
+ */
845
+ core: {
846
+ /**
847
+ * Your SDK key.
848
+ *
849
+ * @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
850
+ */
851
+ authorizationKey: string;
852
+ /**
853
+ * Customer identifier. Whatever this means to you.
854
+ *
855
+ * @see {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
856
+ */
857
+ key: SplitKey;
858
+ /**
859
+ * Disable labels from being sent to Split backend. Labels may contain sensitive information.
860
+ *
861
+ * @defaultValue `true`
862
+ */
863
+ labelsEnabled?: boolean;
864
+ };
825
865
  /**
826
866
  * User consent status. Possible values are `'GRANTED'`, which is the default, `'DECLINED'` or `'UNKNOWN'`.
827
867
  * - `'GRANTED'`: the user grants consent for tracking events and impressions. The SDK sends them to Split cloud.
@@ -829,730 +869,398 @@ declare namespace SplitIO {
829
869
  * - `'UNKNOWN'`: the user neither grants nor declines consent for tracking events and impressions. The SDK tracks them in its internal storage, and eventually either sends
830
870
  * them or not if the consent status is updated to 'GRANTED' or 'DECLINED' respectively. The status can be updated at any time with the `UserConsent.setStatus` factory method.
831
871
  *
832
- * @typedef {string} userConsent
833
- * @default 'GRANTED'
872
+ * @defaultValue `'GRANTED'`
834
873
  */
835
874
  userConsent?: ConsentStatus;
836
875
  }
837
876
  /**
838
- * Settings interface for SDK instances created for client-side with synchronous storage (e.g., Browser or React Native).
839
- *
840
- * @interface IClientSideSettings
841
- * @extends IClientSideBasicSettings
842
- * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#configuration}
877
+ * Common settings properties for client-side standalone SDKs.
843
878
  */
844
- interface IClientSideSettings extends IClientSideBasicSettings {
845
- /**
846
- * The SDK mode. When using the default in memory storage or `InLocalStorage` as storage, the only possible value is "standalone", which is the default.
847
- * For "localhost" mode, use "localhost" as authorizationKey.
848
- *
849
- * @property {'standalone'} mode
850
- * @default 'standalone'
851
- */
852
- mode?: 'standalone';
879
+ interface IClientSideSyncSharedSettings extends IClientSideSharedSettings, ISyncSharedSettings {
853
880
  /**
854
881
  * Mocked features map. For testing purposes only. For using this you should specify "localhost" as authorizationKey on core settings.
855
- * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#localhost-mode}
882
+ * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#localhost-mode}
856
883
  */
857
884
  features?: MockedFeaturesMap;
858
- /**
859
- * Defines the factory function to instantiate the storage. If not provided, the default IN MEMORY storage is used.
860
- *
861
- * NOTE: at the moment there are not storages to plug in React Native SDK, only `InLocalStorage` for Browser SDK.
862
- *
863
- * Example:
864
- * ```
865
- * SplitFactory({
866
- * ...
867
- * storage: InLocalStorage()
868
- * })
869
- * ```
870
- * @property {Object} storage
871
- */
872
- storage?: StorageSyncFactory;
873
885
  /**
874
886
  * SDK Startup settings.
875
- * @property {Object} startup
876
887
  */
877
888
  startup?: {
878
889
  /**
879
890
  * Maximum amount of time used before notify a timeout.
880
- * @property {number} readyTimeout
881
- * @default 1.5
891
+ *
892
+ * @defaultValue `10`
882
893
  */
883
894
  readyTimeout?: number;
884
895
  /**
885
- * 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'.
886
- * @property {number} requestTimeoutBeforeReady
887
- * @default 1.5
896
+ * 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'.
897
+ *
898
+ * @defaultValue `5`
888
899
  */
889
900
  requestTimeoutBeforeReady?: number;
890
901
  /**
891
902
  * How many quick retries we will do while starting up the SDK.
892
- * @property {number} retriesOnFailureBeforeReady
893
- * @default 1
903
+ *
904
+ * @defaultValue `1`
894
905
  */
895
906
  retriesOnFailureBeforeReady?: number;
896
907
  /**
897
908
  * For SDK posts the queued events data in bulks with a given rate, but the first push window is defined separately,
898
909
  * to better control on browsers or mobile. This number defines that window before the first events push.
899
910
  *
900
- * @property {number} eventsFirstPushWindow
901
- * @default 10
911
+ * @defaultValue `10`
902
912
  */
903
913
  eventsFirstPushWindow?: number;
904
914
  };
905
915
  /**
906
916
  * SDK scheduler settings.
907
- * @property {Object} scheduler
908
917
  */
909
918
  scheduler?: {
910
919
  /**
911
920
  * The SDK polls Split servers for changes to feature flag definitions. This parameter controls this polling period in seconds.
912
- * @property {number} featuresRefreshRate
913
- * @default 60
921
+ *
922
+ * @defaultValue `60`
914
923
  */
915
924
  featuresRefreshRate?: number;
916
925
  /**
917
926
  * 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.
918
- * @property {number} impressionsRefreshRate
919
- * @default 60
927
+ *
928
+ * @defaultValue `60`
920
929
  */
921
930
  impressionsRefreshRate?: number;
922
931
  /**
923
932
  * The maximum number of impression items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
924
933
  * If you use a 0 here, the queue will have no maximum size.
925
- * @property {number} impressionsQueueSize
926
- * @default 30000
934
+ *
935
+ * @defaultValue `30000`
927
936
  */
928
937
  impressionsQueueSize?: number;
929
938
  /**
930
939
  * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
931
- * @property {number} telemetryRefreshRate
932
- * @default 3600
940
+ *
941
+ * @defaultValue `120`
942
+ * @deprecated This parameter is ignored now. Use `telemetryRefreshRate` instead.
943
+ */
944
+ metricsRefreshRate?: number;
945
+ /**
946
+ * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
947
+ *
948
+ * @defaultValue `3600`
933
949
  */
934
950
  telemetryRefreshRate?: number;
935
951
  /**
936
952
  * The SDK polls Split servers for changes to segment definitions. This parameter controls this polling period in seconds.
937
- * @property {number} segmentsRefreshRate
938
- * @default 60
953
+ *
954
+ * @defaultValue `60`
939
955
  */
940
956
  segmentsRefreshRate?: number;
941
957
  /**
942
958
  * The SDK posts the queued events data in bulks. This parameter controls the posting rate in seconds.
943
- * @property {number} eventsPushRate
944
- * @default 60
959
+ *
960
+ * @defaultValue `60`
945
961
  */
946
962
  eventsPushRate?: number;
947
963
  /**
948
964
  * The maximum number of event items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
949
965
  * If you use a 0 here, the queue will have no maximum size.
950
- * @property {number} eventsQueueSize
951
- * @default 500
966
+ *
967
+ * @defaultValue `500`
952
968
  */
953
969
  eventsQueueSize?: number;
954
970
  /**
955
971
  * For mocking/testing only. The SDK will refresh the features mocked data when mode is set to "localhost" by defining the key.
956
- * For more information see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#localhost-mode}
957
- * @property {number} offlineRefreshRate
958
- * @default 15
972
+ * For more information see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#localhost-mode}
973
+ *
974
+ * @defaultValue `15`
959
975
  */
960
976
  offlineRefreshRate?: number;
961
977
  /**
962
978
  * When using streaming mode, seconds to wait before re attempting to connect for push notifications.
963
979
  * Next attempts follow intervals in power of two: base seconds, base x 2 seconds, base x 4 seconds, ...
964
- * @property {number} pushRetryBackoffBase
965
- * @default 1
980
+ *
981
+ * @defaultValue `1`
966
982
  */
967
983
  pushRetryBackoffBase?: number;
968
- }
984
+ };
969
985
  }
970
986
  /**
971
- * Settings interface with async storage for SDK instances created for client-side (e.g., Serverless environments).
972
- * If your storage is synchronous (by defaut we use memory, which is sync) use SplitIO.IClientSideSettings instead.
973
- * @interface IClientSideAsyncSettings
974
- * @extends IClientSideBasicSettings
987
+ * Settings interface for Browser SDK instances created with client-side API and synchronous storage (e.g., in-memory or local storage).
988
+ *
989
+ * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#configuration}
975
990
  */
976
- interface IClientSideAsyncSettings extends IClientSideBasicSettings {
991
+ interface IClientSideSettings extends IClientSideSyncSharedSettings, IPluggableSettings {
977
992
  /**
978
- * The SDK mode. When using `PluggableStorage` as storage, the possible values are "consumer" and "consumer_partial".
993
+ * Defines the factory function to instantiate the storage. If not provided, the default in-memory storage is used.
979
994
  *
980
- * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#sharing-state-with-a-pluggable-storage}
981
- *
982
- * @property {'consumer' | 'consumer_partial'} mode
983
- */
984
- mode: 'consumer' | 'consumer_partial';
985
- /**
986
- * Defines the factory function to instantiate the storage.
995
+ * NOTE: Currently, there is no persistent storage option available for the React Native SDK; only `InLocalStorage` for the Browser SDK.
987
996
  *
988
997
  * Example:
989
998
  * ```
990
999
  * SplitFactory({
991
1000
  * ...
992
- * storage: PluggableStorage({ wrapper: SomeWrapper })
1001
+ * storage: InLocalStorage()
993
1002
  * })
994
1003
  * ```
995
- * @property {Object} storage
996
- */
997
- storage: StorageAsyncFactory;
998
- /**
999
- * SDK Startup settings.
1000
- * @property {Object} startup
1001
1004
  */
1002
- startup?: {
1003
- /**
1004
- * Maximum amount of time used before notify a timeout.
1005
- * @property {number} readyTimeout
1006
- * @default 1.5
1007
- */
1008
- readyTimeout?: number;
1009
- /**
1010
- * For SDK posts the queued events data in bulks with a given rate, but the first push window is defined separately,
1011
- * to better control on browsers or mobile. This number defines that window before the first events push.
1012
- *
1013
- * NOTE: this param is ignored in 'consumer' mode.
1014
- * @property {number} eventsFirstPushWindow
1015
- * @default 10
1016
- */
1017
- eventsFirstPushWindow?: number;
1018
- };
1019
- /**
1020
- * SDK scheduler settings.
1021
- * @property {Object} scheduler
1022
- */
1023
- scheduler?: {
1024
- /**
1025
- * 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.
1026
- *
1027
- * NOTE: this param is ignored in 'consumer' mode.
1028
- * @property {number} impressionsRefreshRate
1029
- * @default 60
1030
- */
1031
- impressionsRefreshRate?: number;
1032
- /**
1033
- * The maximum number of impression items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
1034
- * If you use a 0 here, the queue will have no maximum size.
1035
- * @property {number} impressionsQueueSize
1036
- * @default 30000
1037
- */
1038
- impressionsQueueSize?: number;
1039
- /**
1040
- * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
1041
- * @property {number} telemetryRefreshRate
1042
- * @default 3600
1043
- */
1044
- telemetryRefreshRate?: number;
1045
- /**
1046
- * The SDK posts the queued events data in bulks. This parameter controls the posting rate in seconds.
1047
- *
1048
- * NOTE: this param is ignored in 'consumer' mode.
1049
- * @property {number} eventsPushRate
1050
- * @default 60
1051
- */
1052
- eventsPushRate?: number;
1053
- /**
1054
- * The maximum number of event items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
1055
- * If you use a 0 here, the queue will have no maximum size.
1056
- *
1057
- * NOTE: this param is ignored in 'consumer' mode.
1058
- * @property {number} eventsQueueSize
1059
- * @default 500
1060
- */
1061
- eventsQueueSize?: number;
1062
- }
1005
+ storage?: StorageSyncFactory;
1063
1006
  }
1064
1007
  /**
1065
- * Common settings between Browser and NodeJS settings interface.
1066
- * @interface ISharedSettings
1008
+ * Settings interface for React Native SDK instances, with client-side API and synchronous storage.
1009
+ *
1010
+ * @see {@link https://help.split.io/hc/en-us/articles/4406066357901-React-Native-SDK#configuration}
1067
1011
  */
1068
- interface ISharedSettings {
1012
+ interface IReactNativeSettings extends IClientSideSettings { }
1013
+ /**
1014
+ * Settings interface for Browser SDK instances created with client-side API and asynchronous storage (e.g., serverless environments with a persistent storage).
1015
+ * If your storage is synchronous (by default we use memory, which is sync) use SplitIO.IClientSideSettings instead.
1016
+ *
1017
+ * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#sharing-state-with-a-pluggable-storage}
1018
+ */
1019
+ interface IClientSideAsyncSettings extends IClientSideSharedSettings, ISharedSettings, IPluggableSettings {
1069
1020
  /**
1070
- * Boolean value to indicate whether the logger should be enabled or disabled, or a log level string.
1021
+ * The SDK mode. When using `PluggableStorage` as storage, the possible values are "consumer" and "consumer_partial".
1071
1022
  *
1072
- * Examples:
1073
- * ```
1074
- * config.debug = true
1075
- * config.debug = 'WARN'
1076
- * ```
1077
- * @property {boolean | LogLevel} debug
1078
- * @default false
1079
- */
1080
- debug?: boolean | LogLevel,
1081
- /**
1082
- * The impression listener, which is optional. Whatever you provide here needs to comply with the SplitIO.IImpressionListener interface,
1083
- * which will check for the logImpression method.
1084
- * @property {IImpressionListener} impressionListener
1085
- * @default undefined
1086
- */
1087
- impressionListener?: SplitIO.IImpressionListener,
1088
- /**
1089
- * Boolean flag to enable the streaming service as default synchronization mechanism. In the event of any issue with streaming,
1090
- * the SDK would fallback to the polling mechanism. If false, the SDK would poll for changes as usual without attempting to use streaming.
1091
- * @property {boolean} streamingEnabled
1092
- * @default true
1023
+ * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#sharing-state-with-a-pluggable-storage}
1093
1024
  */
1094
- streamingEnabled?: boolean,
1025
+ mode: 'consumer' | 'consumer_partial';
1095
1026
  /**
1096
- * SDK synchronization settings.
1097
- * @property {Object} sync
1098
- */
1099
- sync?: {
1100
- /**
1101
- * 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.
1102
- * This configuration is only meaningful when the SDK is working in "standalone" mode.
1103
- *
1104
- * Example:
1105
- * `splitFilter: [
1106
- * { 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'
1107
- * ]`
1108
- * @property {SplitIO.SplitFilter[]} splitFilters
1109
- */
1110
- splitFilters?: SplitIO.SplitFilter[]
1111
- /**
1112
- * Impressions Collection Mode. Option to determine how impressions are going to be sent to Split servers.
1113
- * Possible values are 'DEBUG', 'OPTIMIZED', and 'NONE'.
1114
- * - DEBUG: will send all the impressions generated (recommended only for debugging purposes).
1115
- * - OPTIMIZED: will send unique impressions to Split servers, avoiding a considerable amount of traffic that duplicated impressions could generate.
1116
- * - NONE: will send unique keys evaluated per feature to Split servers instead of full blown impressions, avoiding a considerable amount of traffic that impressions could generate.
1117
- *
1118
- * @property {string} impressionsMode
1119
- * @default 'OPTIMIZED'
1120
- */
1121
- impressionsMode?: SplitIO.ImpressionsMode,
1122
- /**
1123
- * Controls the SDK continuous synchronization flags.
1124
- *
1125
- * When `true` a running SDK will process rollout plan updates performed on the UI (default).
1126
- * When false it'll just fetch all data upon init.
1127
- *
1128
- * @property {boolean} enabled
1129
- * @default true
1130
- */
1131
- enabled?: boolean
1132
- }
1133
- }
1134
- /**
1135
- * Common settings interface for SDK instances on NodeJS.
1136
- * @interface INodeBasicSettings
1137
- * @extends ISharedSettings
1138
- */
1139
- interface INodeBasicSettings extends ISharedSettings {
1027
+ * Defines the factory function to instantiate the storage.
1028
+ *
1029
+ * Example:
1030
+ * ```
1031
+ * SplitFactory({
1032
+ * ...
1033
+ * storage: PluggableStorage({ wrapper: SomeWrapper })
1034
+ * })
1035
+ * ```
1036
+ */
1037
+ storage: StorageAsyncFactory;
1140
1038
  /**
1141
- * SDK Startup settings for NodeJS.
1142
- * @property {Object} startup
1039
+ * SDK Startup settings.
1143
1040
  */
1144
1041
  startup?: {
1145
1042
  /**
1146
1043
  * Maximum amount of time used before notify a timeout.
1147
- * @property {number} readyTimeout
1148
- * @default 15
1149
- */
1150
- readyTimeout?: number,
1151
- /**
1152
- * 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'.
1153
- * @property {number} requestTimeoutBeforeReady
1154
- * @default 15
1155
- */
1156
- requestTimeoutBeforeReady?: number,
1157
- /**
1158
- * How many quick retries we will do while starting up the SDK.
1159
- * @property {number} retriesOnFailureBeforeReady
1160
- * @default 1
1044
+ *
1045
+ * @defaultValue `5`
1161
1046
  */
1162
- retriesOnFailureBeforeReady?: number,
1047
+ readyTimeout?: number;
1163
1048
  /**
1164
1049
  * For SDK posts the queued events data in bulks with a given rate, but the first push window is defined separately,
1165
- * to better control on browsers. This number defines that window before the first events push.
1050
+ * to better control on browsers or mobile. This number defines that window before the first events push.
1166
1051
  *
1167
- * @property {number} eventsFirstPushWindow
1168
- * @default 0
1052
+ * NOTE: this param is ignored in 'consumer' mode.
1053
+ *
1054
+ * @defaultValue `10`
1169
1055
  */
1170
- eventsFirstPushWindow?: number,
1171
- },
1056
+ eventsFirstPushWindow?: number;
1057
+ };
1172
1058
  /**
1173
1059
  * SDK scheduler settings.
1174
- * @property {Object} scheduler
1175
1060
  */
1176
1061
  scheduler?: {
1177
- /**
1178
- * The SDK polls Split servers for changes to feature flag definitions. This parameter controls this polling period in seconds.
1179
- * @property {number} featuresRefreshRate
1180
- * @default 60
1181
- */
1182
- featuresRefreshRate?: number,
1183
1062
  /**
1184
1063
  * 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.
1185
- * @property {number} impressionsRefreshRate
1186
- * @default 300
1064
+ *
1065
+ * NOTE: this param is ignored in 'consumer' mode.
1066
+ *
1067
+ * @defaultValue `60`
1187
1068
  */
1188
- impressionsRefreshRate?: number,
1069
+ impressionsRefreshRate?: number;
1189
1070
  /**
1190
1071
  * The maximum number of impression items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
1191
1072
  * If you use a 0 here, the queue will have no maximum size.
1192
- * @property {number} impressionsQueueSize
1193
- * @default 30000
1194
- */
1195
- impressionsQueueSize?: number,
1196
- /**
1197
- * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
1198
- * @property {number} metricsRefreshRate
1199
- * @default 120
1200
- * @deprecated This parameter is ignored now. Use `telemetryRefreshRate` instead.
1073
+ *
1074
+ * NOTE: this param is ignored in 'consumer' mode.
1075
+ *
1076
+ * @defaultValue `30000`
1201
1077
  */
1202
- metricsRefreshRate?: number,
1078
+ impressionsQueueSize?: number;
1203
1079
  /**
1204
1080
  * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
1205
- * @property {number} telemetryRefreshRate
1206
- * @default 3600
1207
- */
1208
- telemetryRefreshRate?: number,
1209
- /**
1210
- * The SDK polls Split servers for changes to segment definitions. This parameter controls this polling period in seconds.
1211
- * @property {number} segmentsRefreshRate
1212
- * @default 60
1081
+ *
1082
+ * NOTE: this param is ignored in 'consumer' mode.
1083
+ *
1084
+ * @defaultValue `3600`
1213
1085
  */
1214
- segmentsRefreshRate?: number,
1086
+ telemetryRefreshRate?: number;
1215
1087
  /**
1216
1088
  * The SDK posts the queued events data in bulks. This parameter controls the posting rate in seconds.
1217
- * @property {number} eventsPushRate
1218
- * @default 60
1089
+ *
1090
+ * NOTE: this param is ignored in 'consumer' mode.
1091
+ *
1092
+ * @defaultValue `60`
1219
1093
  */
1220
- eventsPushRate?: number,
1094
+ eventsPushRate?: number;
1221
1095
  /**
1222
1096
  * The maximum number of event items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
1223
1097
  * If you use a 0 here, the queue will have no maximum size.
1224
- * @property {number} eventsQueueSize
1225
- * @default 500
1226
- */
1227
- eventsQueueSize?: number,
1228
- /**
1229
- * For mocking/testing only. The SDK will refresh the features mocked data when mode is set to "localhost" by defining the key.
1230
- * For more information see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
1231
- * @property {number} offlineRefreshRate
1232
- * @default 15
1233
- */
1234
- offlineRefreshRate?: number
1235
- /**
1236
- * When using streaming mode, seconds to wait before re attempting to connect for push notifications.
1237
- * Next attempts follow intervals in power of two: base seconds, base x 2 seconds, base x 4 seconds, ...
1238
- * @property {number} pushRetryBackoffBase
1239
- * @default 1
1240
- */
1241
- pushRetryBackoffBase?: number,
1242
- },
1243
- /**
1244
- * SDK Core settings for NodeJS.
1245
- * @property {Object} core
1246
- */
1247
- core: {
1248
- /**
1249
- * Your SDK key.
1250
- * @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
1251
- * @property {string} authorizationKey
1252
- */
1253
- authorizationKey: string,
1254
- /**
1255
- * Disable labels from being sent to Split backend. Labels may contain sensitive information.
1256
- * @property {boolean} labelsEnabled
1257
- * @default true
1258
- */
1259
- labelsEnabled?: boolean
1260
- /**
1261
- * Disable machine IP and Name from being sent to Split backend.
1262
- * @property {boolean} IPAddressesEnabled
1263
- * @default true
1098
+ *
1099
+ * NOTE: this param is ignored in 'consumer' mode.
1100
+ *
1101
+ * @defaultValue `500`
1264
1102
  */
1265
- IPAddressesEnabled?: boolean
1266
- },
1103
+ eventsQueueSize?: number;
1104
+ };
1105
+ }
1106
+ /**
1107
+ * Settings interface for JavaScript SDK instances created on the browser, with client-side API and synchronous storage (e.g., in-memory or local storage).
1108
+ *
1109
+ * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#configuration}
1110
+ */
1111
+ interface IBrowserSettings extends IClientSideSyncSharedSettings, INonPluggableSettings {
1267
1112
  /**
1268
- * Defines which kind of storage we should instantiate.
1269
- * @property {Object} storage
1113
+ * Defines which kind of storage we can instantiate on the browser.
1114
+ * Possible storage types are 'MEMORY', which is the default, and 'LOCALSTORAGE'.
1270
1115
  */
1271
1116
  storage?: {
1272
1117
  /**
1273
1118
  * Storage type to be instantiated by the SDK.
1274
- * @property {StorageType} type
1275
- * @default 'MEMORY'
1276
- */
1277
- type?: StorageType,
1278
- /**
1279
- * Options to be passed to the selected storage.
1280
- * @property {Object} options
1119
+ *
1120
+ * @defaultValue `'MEMORY'`
1281
1121
  */
1282
- options?: Object,
1122
+ type?: BrowserStorage;
1283
1123
  /**
1284
1124
  * Optional prefix to prevent any kind of data collision between SDK versions.
1285
- * @property {string} prefix
1286
- * @default 'SPLITIO'
1125
+ *
1126
+ * @defaultValue `'SPLITIO'`
1287
1127
  */
1288
- prefix?: string
1289
- },
1290
- /**
1291
- * The SDK mode. Possible values are "standalone", which is the default when using a synchronous storage, like 'MEMORY' and 'LOCALSTORAGE',
1292
- * and "consumer", which must be set when using an asynchronous storage, like 'REDIS'. For "localhost" mode, use "localhost" as authorizationKey.
1293
- * @property {SDKMode} mode
1294
- * @default 'standalone'
1295
- */
1296
- mode?: SDKMode,
1297
- /**
1298
- * Mocked features file path. For testing purposes only. For using this you should specify "localhost" as authorizationKey on core settings.
1299
- * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
1300
- * @property {MockedFeaturesFilePath} features
1301
- * @default '$HOME/.split'
1302
- */
1303
- features?: SplitIO.MockedFeaturesFilePath,
1128
+ prefix?: string;
1129
+ };
1304
1130
  }
1305
1131
  /**
1306
- * Settings interface for SDK instances created on the browser
1307
- * @interface IBrowserSettings
1308
- * @extends ISharedSettings
1309
- * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#configuration}
1132
+ * Settings interface for JavaScript SDK instances created on NodeJS, with server-side API and synchronous in-memory storage.
1133
+ * If your storage is asynchronous (Redis for example) use SplitIO.INodeAsyncSettings instead.
1134
+ *
1135
+ * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#configuration}
1310
1136
  */
1311
- interface IBrowserSettings extends ISharedSettings {
1137
+ interface INodeSettings extends IServerSideSharedSettings, ISyncSharedSettings, INonPluggableSettings {
1312
1138
  /**
1313
- * SDK Startup settings for the Browser.
1314
- * @property {Object} startup
1139
+ * SDK Startup settings for NodeJS.
1315
1140
  */
1316
1141
  startup?: {
1317
1142
  /**
1318
1143
  * Maximum amount of time used before notify a timeout.
1319
- * @property {number} readyTimeout
1320
- * @default 1.5
1144
+ *
1145
+ * @defaultValue `15`
1321
1146
  */
1322
- readyTimeout?: number,
1147
+ readyTimeout?: number;
1323
1148
  /**
1324
- * 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'.
1325
- * @property {number} requestTimeoutBeforeReady
1326
- * @default 1.5
1149
+ * 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'.
1150
+ *
1151
+ * @defaultValue `15`
1327
1152
  */
1328
- requestTimeoutBeforeReady?: number,
1153
+ requestTimeoutBeforeReady?: number;
1329
1154
  /**
1330
1155
  * How many quick retries we will do while starting up the SDK.
1331
- * @property {number} retriesOnFailureBeforeReady
1332
- * @default 1
1156
+ *
1157
+ * @defaultValue `1`
1333
1158
  */
1334
- retriesOnFailureBeforeReady?: number,
1159
+ retriesOnFailureBeforeReady?: number;
1335
1160
  /**
1336
1161
  * For SDK posts the queued events data in bulks with a given rate, but the first push window is defined separately,
1337
1162
  * to better control on browsers. This number defines that window before the first events push.
1338
1163
  *
1339
- * @property {number} eventsFirstPushWindow
1340
- * @default 10
1164
+ * @defaultValue `0`
1341
1165
  */
1342
- eventsFirstPushWindow?: number,
1343
- },
1166
+ eventsFirstPushWindow?: number;
1167
+ };
1344
1168
  /**
1345
1169
  * SDK scheduler settings.
1346
- * @property {Object} scheduler
1347
1170
  */
1348
1171
  scheduler?: {
1349
1172
  /**
1350
1173
  * The SDK polls Split servers for changes to feature flag definitions. This parameter controls this polling period in seconds.
1351
- * @property {number} featuresRefreshRate
1352
- * @default 60
1174
+ *
1175
+ * @defaultValue `60`
1353
1176
  */
1354
- featuresRefreshRate?: number,
1177
+ featuresRefreshRate?: number;
1355
1178
  /**
1356
1179
  * 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.
1357
- * @property {number} impressionsRefreshRate
1358
- * @default 60
1180
+ *
1181
+ * @defaultValue `300`
1359
1182
  */
1360
- impressionsRefreshRate?: number,
1183
+ impressionsRefreshRate?: number;
1361
1184
  /**
1362
1185
  * The maximum number of impression items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
1363
1186
  * If you use a 0 here, the queue will have no maximum size.
1364
- * @property {number} impressionsQueueSize
1365
- * @default 30000
1187
+ *
1188
+ * @defaultValue `30000`
1366
1189
  */
1367
- impressionsQueueSize?: number,
1190
+ impressionsQueueSize?: number;
1368
1191
  /**
1369
1192
  * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
1370
- * @property {number} metricsRefreshRate
1371
- * @default 120
1193
+ *
1194
+ * @defaultValue `120`
1372
1195
  * @deprecated This parameter is ignored now. Use `telemetryRefreshRate` instead.
1373
1196
  */
1374
- metricsRefreshRate?: number,
1197
+ metricsRefreshRate?: number;
1375
1198
  /**
1376
1199
  * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
1377
- * @property {number} telemetryRefreshRate
1378
- * @default 3600
1200
+ *
1201
+ * @defaultValue `3600`
1379
1202
  */
1380
- telemetryRefreshRate?: number,
1203
+ telemetryRefreshRate?: number;
1381
1204
  /**
1382
1205
  * The SDK polls Split servers for changes to segment definitions. This parameter controls this polling period in seconds.
1383
- * @property {number} segmentsRefreshRate
1384
- * @default 60
1206
+ *
1207
+ * @defaultValue `60`
1385
1208
  */
1386
- segmentsRefreshRate?: number,
1209
+ segmentsRefreshRate?: number;
1387
1210
  /**
1388
1211
  * The SDK posts the queued events data in bulks. This parameter controls the posting rate in seconds.
1389
- * @property {number} eventsPushRate
1390
- * @default 60
1212
+ *
1213
+ * @defaultValue `60`
1391
1214
  */
1392
- eventsPushRate?: number,
1215
+ eventsPushRate?: number;
1393
1216
  /**
1394
1217
  * The maximum number of event items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
1395
1218
  * If you use a 0 here, the queue will have no maximum size.
1396
- * @property {number} eventsQueueSize
1397
- * @default 500
1219
+ *
1220
+ * @defaultValue `500`
1398
1221
  */
1399
- eventsQueueSize?: number,
1222
+ eventsQueueSize?: number;
1400
1223
  /**
1401
1224
  * For mocking/testing only. The SDK will refresh the features mocked data when mode is set to "localhost" by defining the key.
1402
- * For more information see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#localhost-mode}
1403
- * @property {number} offlineRefreshRate
1404
- * @default 15
1225
+ * For more information see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
1226
+ *
1227
+ * @defaultValue `15`
1405
1228
  */
1406
- offlineRefreshRate?: number,
1229
+ offlineRefreshRate?: number;
1407
1230
  /**
1408
1231
  * When using streaming mode, seconds to wait before re attempting to connect for push notifications.
1409
1232
  * Next attempts follow intervals in power of two: base seconds, base x 2 seconds, base x 4 seconds, ...
1410
- * @property {number} pushRetryBackoffBase
1411
- * @default 1
1412
- */
1413
- pushRetryBackoffBase?: number,
1414
- },
1415
- /**
1416
- * SDK Core settings for the browser.
1417
- * @property {Object} core
1418
- */
1419
- core: {
1420
- /**
1421
- * Your SDK key.
1422
- * @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
1423
- * @property {string} authorizationKey
1424
- */
1425
- authorizationKey: string,
1426
- /**
1427
- * Customer identifier. Whatever this means to you.
1428
- * @see {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
1429
- * @property {SplitKey} key
1430
- */
1431
- key: SplitKey,
1432
- /**
1433
- * Disable labels from being sent to Split backend. Labels may contain sensitive information.
1434
- * @property {boolean} labelsEnabled
1435
- * @default true
1436
- */
1437
- labelsEnabled?: boolean
1438
- },
1439
- /**
1440
- * Mocked features map. For testing purposes only. For using this you should specify "localhost" as authorizationKey on core settings.
1441
- * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#localhost-mode}
1442
- */
1443
- features?: MockedFeaturesMap,
1444
- /**
1445
- * Defines which kind of storage we can instantiate on the browser.
1446
- * Possible storage types are 'MEMORY', which is the default, and 'LOCALSTORAGE'.
1447
- * @property {Object} storage
1448
- */
1449
- storage?: {
1450
- /**
1451
- * Storage type to be instantiated by the SDK.
1452
- * @property {BrowserStorage} type
1453
- * @default 'MEMORY'
1454
- */
1455
- type?: BrowserStorage,
1456
- /**
1457
- * Optional prefix to prevent any kind of data collision between SDK versions.
1458
- * @property {string} prefix
1459
- * @default 'SPLITIO'
1233
+ *
1234
+ * @defaultValue `1`
1460
1235
  */
1461
- prefix?: string
1462
- },
1463
- /**
1464
- * List of URLs that the SDK will use as base for it's synchronization functionalities, applicable only when running as standalone.
1465
- * Do not change these settings unless you're working an advanced use case, like connecting to the Split proxy.
1466
- * @property {Object} urls
1467
- */
1468
- urls?: UrlSettings,
1236
+ pushRetryBackoffBase?: number;
1237
+ };
1469
1238
  /**
1470
- * User consent status. Possible values are `'GRANTED'`, which is the default, `'DECLINED'` or `'UNKNOWN'`.
1471
- * - `'GRANTED'`: the user grants consent for tracking events and impressions. The SDK sends them to Split cloud.
1472
- * - `'DECLINED'`: the user declines consent for tracking events and impressions. The SDK does not send them to Split cloud.
1473
- * - `'UNKNOWN'`: the user neither grants nor declines consent for tracking events and impressions. The SDK tracks them in its internal storage, and eventually either sends
1474
- * them or not if the consent status is updated to 'GRANTED' or 'DECLINED' respectively. The status can be updated at any time with the `UserConsent.setStatus` factory method.
1239
+ * Mocked features file path. For testing purposes only. For using this you should specify "localhost" as authorizationKey on core settings.
1240
+ * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
1475
1241
  *
1476
- * @typedef {string} userConsent
1477
- * @default 'GRANTED'
1478
- */
1479
- userConsent?: ConsentStatus,
1480
- sync?: ISharedSettings['sync'] & {
1481
- /**
1482
- * Custom options object for HTTP(S) requests in the Browser.
1483
- * If provided, this object is merged with the options object passed by the SDK for EventSource and Fetch calls.
1484
- */
1485
- requestOptions?: {
1486
- /**
1487
- * Custom function called before each request, allowing you to add or update headers in SDK HTTP requests.
1488
- * Some headers, such as `SplitSDKVersion`, are required by the SDK and cannot be overridden.
1489
- * To pass multiple headers with the same name, combine their values into a single line, separated by commas. Example: `{ 'Authorization': 'value1, value2' }`
1490
- * Or provide keys with different case since headers are case-insensitive. Example: `{ 'authorization': 'value1', 'Authorization': 'value2' }`
1491
- *
1492
- * NOTE: to pass custom headers to the streaming connection in Browser, you should polyfill the `window.EventSource` object with a library that supports headers,
1493
- * like https://www.npmjs.com/package/event-source-polyfill, since native EventSource does not support them and will be ignored.
1494
- *
1495
- * @property getHeaderOverrides
1496
- * @default undefined
1497
- *
1498
- * @param context - The context for the request.
1499
- * @param context.headers - The current headers in the request.
1500
- * @returns A set of headers to be merged with the current headers.
1501
- *
1502
- * @example
1503
- * const getHeaderOverrides = (context) => {
1504
- * return {
1505
- * 'Authorization': context.headers['Authorization'] + ', other-value',
1506
- * 'custom-header': 'custom-value'
1507
- * };
1508
- * };
1509
- */
1510
- getHeaderOverrides?: (context: { headers: Record<string, string> }) => Record<string, string>
1511
- },
1512
- }
1513
- }
1514
- /**
1515
- * Settings interface for SDK instances created on NodeJS.
1516
- * If your storage is asynchronous (Redis for example) use SplitIO.INodeAsyncSettings instead.
1517
- * @interface INodeSettings
1518
- * @extends INodeBasicSettings
1519
- * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#configuration}
1520
- */
1521
- interface INodeSettings extends INodeBasicSettings {
1522
- /**
1523
- * List of URLs that the SDK will use as base for it's synchronization functionalities, applicable only when running as standalone.
1524
- * Do not change these settings unless you're working an advanced use case, like connecting to the Split proxy.
1525
- * @property {Object} urls
1242
+ * @defaultValue `'$HOME/.split'`
1526
1243
  */
1527
- urls?: UrlSettings,
1244
+ features?: SplitIO.MockedFeaturesFilePath;
1528
1245
  /**
1529
1246
  * Defines which kind of storage we can instantiate on NodeJS for 'standalone' mode.
1530
1247
  * The only possible storage type is 'MEMORY', which is the default.
1531
- * @property {Object} storage
1532
1248
  */
1533
1249
  storage?: {
1534
1250
  /**
1535
1251
  * Synchronous storage type to be instantiated by the SDK.
1536
- * @property {NodeSyncStorage} type
1537
- * @default 'MEMORY'
1252
+ *
1253
+ * @defaultValue `'MEMORY'`
1538
1254
  */
1539
- type?: NodeSyncStorage,
1255
+ type?: NodeSyncStorage;
1540
1256
  /**
1541
1257
  * Optional prefix to prevent any kind of data collision between SDK versions.
1542
- * @property {string} prefix
1543
- * @default 'SPLITIO'
1258
+ *
1259
+ * @defaultValue `'SPLITIO'`
1544
1260
  */
1545
- prefix?: string
1546
- },
1547
- /**
1548
- * The SDK mode. When using the default 'MEMORY' storage, the only possible value is "standalone", which is the default.
1549
- * For "localhost" mode, use "localhost" as authorizationKey.
1550
- *
1551
- * @property {'standalone'} mode
1552
- * @default 'standalone'
1553
- */
1554
- mode?: 'standalone'
1555
- sync?: INodeBasicSettings['sync'] & {
1261
+ prefix?: string;
1262
+ };
1263
+ sync?: ISyncSharedSettings['sync'] & {
1556
1264
  /**
1557
1265
  * Custom options object for HTTP(S) requests in NodeJS.
1558
1266
  * If provided, this object is merged with the options object passed by the SDK for EventSource and Node-Fetch calls.
@@ -1563,24 +1271,24 @@ declare namespace SplitIO {
1563
1271
  * Custom function called before each request, allowing you to add or update headers in SDK HTTP requests.
1564
1272
  * Some headers, such as `SplitSDKVersion`, are required by the SDK and cannot be overridden.
1565
1273
  * To pass multiple headers with the same name, combine their values into a single line, separated by commas. Example: `{ 'Authorization': 'value1, value2' }`
1566
- * Or provide keys with different case since headers are case-insensitive. Example: `{ 'authorization': 'value1', 'Authorization': 'value2' }`
1274
+ * Or provide keys with different cases since headers are case-insensitive. Example: `{ 'authorization': 'value1', 'Authorization': 'value2' }`
1567
1275
  *
1568
- * @property getHeaderOverrides
1569
- * @default undefined
1276
+ * @defaultValue `undefined`
1570
1277
  *
1571
- * @param context - The context for the request.
1572
- * @param context.headers - The current headers in the request.
1573
- * @returns A set of headers to be merged with the current headers.
1278
+ * @param context - The context for the request, which contains the `headers` property object representing the current headers in the request.
1279
+ * @returns An object representing a set of headers to be merged with the current headers.
1574
1280
  *
1575
1281
  * @example
1282
+ * ```
1576
1283
  * const getHeaderOverrides = (context) => {
1577
1284
  * return {
1578
1285
  * 'Authorization': context.headers['Authorization'] + ', other-value',
1579
1286
  * 'custom-header': 'custom-value'
1580
1287
  * };
1581
1288
  * };
1289
+ * ```
1582
1290
  */
1583
- getHeaderOverrides?: (context: { headers: Record<string, string> }) => Record<string, string>
1291
+ getHeaderOverrides?: (context: { headers: Record<string, string> }) => Record<string, string>;
1584
1292
  /**
1585
1293
  * Custom NodeJS HTTP(S) Agent used by the SDK for HTTP(S) requests.
1586
1294
  *
@@ -1603,35 +1311,47 @@ declare namespace SplitIO {
1603
1311
  *
1604
1312
  * @see {@link https://nodejs.org/api/https.html#class-httpsagent}
1605
1313
  *
1606
- * @property {http.Agent | https.Agent} agent
1607
- * @default undefined
1314
+ * @defaultValue `undefined`
1608
1315
  */
1609
- agent?: RequestOptions["agent"]
1610
- },
1611
- }
1316
+ agent?: RequestOptions['agent'];
1317
+ };
1318
+ };
1612
1319
  }
1613
1320
  /**
1614
- * Settings interface with async storage for SDK instances created on NodeJS.
1615
- * If your storage is synchronous (by defaut we use memory, which is sync) use SplitIO.INodeSettings instead.
1616
- * @interface INodeAsyncSettings
1617
- * @extends INodeBasicSettings
1321
+ * Settings interface for JavaScript SDK instances created on NodeJS, with asynchronous storage like Redis.
1322
+ * If your storage is synchronous (by default we use memory, which is sync) use SplitIO.INodeSettings instead.
1323
+ *
1618
1324
  * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#configuration}
1619
1325
  */
1620
- interface INodeAsyncSettings extends INodeBasicSettings {
1326
+ interface INodeAsyncSettings extends IServerSideSharedSettings, ISharedSettings, INonPluggableSettings {
1327
+ /**
1328
+ * The SDK mode. When using 'REDIS' storage type, the only possible value is "consumer", which is required.
1329
+ *
1330
+ * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#state-sharing-redis-integration}
1331
+ */
1332
+ mode: 'consumer';
1333
+ /**
1334
+ * SDK Startup settings for NodeJS.
1335
+ */
1336
+ startup?: {
1337
+ /**
1338
+ * Maximum amount of time used before notify a timeout.
1339
+ *
1340
+ * @defaultValue `15`
1341
+ */
1342
+ readyTimeout?: number;
1343
+ };
1621
1344
  /**
1622
1345
  * Defines which kind of async storage we can instantiate on NodeJS for 'consumer' mode.
1623
1346
  * The only possible storage type is 'REDIS'.
1624
- * @property {Object} storage
1625
1347
  */
1626
1348
  storage: {
1627
1349
  /**
1628
1350
  * 'REDIS' storage type to be instantiated by the SDK.
1629
- * @property {NodeAsyncStorage} type
1630
1351
  */
1631
- type: NodeAsyncStorage,
1352
+ type: NodeAsyncStorage;
1632
1353
  /**
1633
1354
  * Options to be passed to the Redis storage. Use it with storage type: 'REDIS'.
1634
- * @property {Object} options
1635
1355
  */
1636
1356
  options?: {
1637
1357
  /**
@@ -1643,272 +1363,239 @@ declare namespace SplitIO {
1643
1363
  * url: '127.0.0.1:6379'
1644
1364
  * url: 'redis://:authpassword@127.0.0.1:6379/0'
1645
1365
  * ```
1646
- * @property {string=} url
1647
1366
  */
1648
- url?: string,
1367
+ url?: string;
1649
1368
  /**
1650
1369
  * Redis host.
1651
- * @property {string=} host
1652
- * @default 'localhost'
1370
+ *
1371
+ * @defaultValue `'localhost'`
1653
1372
  */
1654
- host?: string,
1373
+ host?: string;
1655
1374
  /**
1656
1375
  * Redis port.
1657
- * @property {number=} port
1658
- * @default 6379
1376
+ *
1377
+ * @defaultValue `6379`
1659
1378
  */
1660
- port?: number,
1379
+ port?: number;
1661
1380
  /**
1662
1381
  * Redis database to be used.
1663
- * @property {number=} db
1664
- * @default 0
1382
+ *
1383
+ * @defaultValue `0`
1665
1384
  */
1666
- db?: number,
1385
+ db?: number;
1667
1386
  /**
1668
1387
  * Redis password. Don't define if no password is used.
1669
- * @property {string=} pass
1670
- * @default undefined
1388
+ *
1389
+ * @defaultValue `undefined`
1671
1390
  */
1672
- pass?: string,
1391
+ pass?: string;
1673
1392
  /**
1674
1393
  * The milliseconds before a timeout occurs during the initial connection to the Redis server.
1675
- * @property {number=} connectionTimeout
1676
- * @default 10000
1394
+ *
1395
+ * @defaultValue `10000`
1677
1396
  */
1678
- connectionTimeout?: number,
1397
+ connectionTimeout?: number;
1679
1398
  /**
1680
1399
  * The milliseconds before Redis commands are timeout by the SDK.
1681
1400
  * Method calls that involve Redis commands, like `client.getTreatment` or `client.track` calls, are resolved when the commands success or timeout.
1682
- * @property {number=} operationTimeout
1683
- * @default 5000
1401
+ *
1402
+ * @defaultValue `5000`
1684
1403
  */
1685
- operationTimeout?: number,
1404
+ operationTimeout?: number;
1686
1405
  /**
1687
1406
  * TLS configuration for Redis connection.
1688
1407
  * @see {@link https://www.npmjs.com/package/ioredis#tls-options }
1689
1408
  *
1690
- * @property {Object=} tls
1691
- * @default undefined
1409
+ * @defaultValue `undefined`
1692
1410
  */
1693
- tls?: RedisOptions['tls'],
1694
- },
1411
+ tls?: RedisOptions['tls'];
1412
+ };
1695
1413
  /**
1696
1414
  * Optional prefix to prevent any kind of data collision between SDK versions.
1697
- * @property {string} prefix
1698
- * @default 'SPLITIO'
1415
+ *
1416
+ * @defaultValue `'SPLITIO'`
1699
1417
  */
1700
- prefix?: string
1701
- },
1702
- /**
1703
- * The SDK mode. When using 'REDIS' storage type, the only possible value is "consumer", which is required.
1704
- *
1705
- * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#state-sharing-redis-integration}
1706
- *
1707
- * @property {'consumer'} mode
1708
- */
1709
- mode: 'consumer'
1418
+ prefix?: string;
1419
+ };
1710
1420
  }
1711
1421
  /**
1712
1422
  * This represents the interface for the SDK instance with synchronous storage and client-side API,
1713
1423
  * i.e., where client instances have a bound user key.
1714
- * @interface ISDK
1715
- * @extends IBasicSDK
1716
1424
  */
1717
1425
  interface ISDK extends IBasicSDK {
1718
1426
  /**
1719
1427
  * Returns the default client instance of the SDK, associated with the key provided on settings.
1720
- * @function client
1721
- * @returns {IClient} The client instance.
1428
+ *
1429
+ * @returns The client instance.
1722
1430
  */
1723
1431
  client(): IClient;
1724
1432
  /**
1725
1433
  * Returns a shared client of the SDK, associated with the given key.
1726
- * @function client
1727
- * @param {SplitKey} key The key for the new client instance.
1728
- * @returns {IClient} The client instance.
1434
+ * @param key - The key for the new client instance.
1435
+ * @returns The client instance.
1729
1436
  */
1730
1437
  client(key: SplitKey): IClient;
1731
1438
  /**
1732
1439
  * Returns a manager instance of the SDK to explore available information.
1733
- * @function manager
1734
- * @returns {IManager} The manager instance.
1440
+ *
1441
+ * @returns The manager instance.
1735
1442
  */
1736
1443
  manager(): IManager;
1737
1444
  /**
1738
1445
  * User consent API.
1739
- * @property UserConsent
1740
1446
  */
1741
1447
  UserConsent: IUserConsentAPI;
1742
1448
  }
1743
1449
  /**
1744
1450
  * This represents the interface for the SDK instance with asynchronous storage and client-side API,
1745
1451
  * i.e., where client instances have a bound user key.
1746
- * @interface IAsyncSDK
1747
- * @extends IBasicSDK
1748
1452
  */
1749
1453
  interface IAsyncSDK extends IBasicSDK {
1750
1454
  /**
1751
1455
  * Returns the default client instance of the SDK, associated with the key provided on settings.
1752
- * @function client
1753
- * @returns {IAsyncClient} The asynchronous client instance.
1456
+ *
1457
+ * @returns The asynchronous client instance.
1754
1458
  */
1755
1459
  client(): IAsyncClient;
1756
1460
  /**
1757
1461
  * Returns a shared client of the SDK, associated with the given key.
1758
- * @function client
1759
- * @param {SplitKey} key The key for the new client instance.
1760
- * @returns {IAsyncClient} The asynchronous client instance.
1462
+ *
1463
+ * @param key - The key for the new client instance.
1464
+ * @returns The asynchronous client instance.
1761
1465
  */
1762
1466
  client(key: SplitKey): IAsyncClient;
1763
1467
  /**
1764
1468
  * Returns a manager instance of the SDK to explore available information.
1765
- * @function manager
1766
- * @returns {IManager} The manager instance.
1469
+ *
1470
+ * @returns The manager instance.
1767
1471
  */
1768
1472
  manager(): IAsyncManager;
1769
1473
  /**
1770
1474
  * User consent API.
1771
- * @property UserConsent
1772
1475
  */
1773
1476
  UserConsent: IUserConsentAPI;
1774
1477
  }
1775
1478
  /**
1776
1479
  * This represents the interface for the SDK instance for server-side with synchronous storage.
1777
- * @interface INodeSDK
1778
- * @extends IBasicSDK
1779
1480
  */
1780
1481
  interface INodeSDK extends IBasicSDK {
1781
1482
  /**
1782
1483
  * Returns the default client instance of the SDK.
1783
- * @function client
1784
- * @returns {INodeClient} The client instance.
1484
+ *
1485
+ * @returns The client instance.
1785
1486
  */
1786
1487
  client(): INodeClient;
1787
1488
  /**
1788
1489
  * Returns a manager instance of the SDK to explore available information.
1789
- * @function manager
1790
- * @returns {IManager} The manager instance.
1490
+ *
1491
+ * @returns The manager instance.
1791
1492
  */
1792
1493
  manager(): IManager;
1793
1494
  }
1794
1495
  /**
1795
1496
  * This represents the interface for the SDK instance for server-side with asynchronous storage.
1796
- * @interface INodeAsyncSDK
1797
- * @extends IBasicSDK
1798
1497
  */
1799
1498
  interface INodeAsyncSDK extends IBasicSDK {
1800
1499
  /**
1801
1500
  * Returns the default client instance of the SDK.
1802
- * @function client
1803
- * @returns {INodeAsyncClient} The asynchronous client instance.
1501
+ *
1502
+ * @returns The asynchronous client instance.
1804
1503
  */
1805
1504
  client(): INodeAsyncClient;
1806
1505
  /**
1807
1506
  * Returns a manager instance of the SDK to explore available information.
1808
- * @function manager
1809
- * @returns {IManager} The manager instance.
1507
+ *
1508
+ * @returns The manager instance.
1810
1509
  */
1811
1510
  manager(): IAsyncManager;
1812
1511
  }
1813
1512
  /**
1814
1513
  * This represents the interface for the Client instance on server-side, where the user key is not bound to the instance and must be provided on each method call.
1815
1514
  * This interface is available in NodeJS, or when importing the 'server' sub-package of JS SDK (e.g., `import { SplitFactory } from '@splitsoftware/splitio/server'`).
1816
- *
1817
- * @interface INodeClient
1818
- * @extends IBasicClient
1819
1515
  */
1820
1516
  interface INodeClient extends IBasicClient {
1821
1517
  /**
1822
1518
  * Returns a Treatment value, which is the treatment string for the given feature.
1823
1519
  *
1824
- * @function getTreatment
1825
- * @param {string} key - The string key representing the consumer.
1826
- * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
1827
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1828
- * @returns {Treatment} The treatment string.
1520
+ * @param key - The string key representing the consumer.
1521
+ * @param featureFlagName - The string that represents the feature flag we want to get the treatment.
1522
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1523
+ * @returns The treatment string.
1829
1524
  */
1830
1525
  getTreatment(key: SplitKey, featureFlagName: string, attributes?: Attributes): Treatment;
1831
1526
  /**
1832
1527
  * Returns a TreatmentWithConfig value, which is an object with both treatment and config string for the given feature.
1833
1528
  *
1834
- * @function getTreatmentWithConfig
1835
- * @param {string} key - The string key representing the consumer.
1836
- * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
1837
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1838
- * @returns {TreatmentWithConfig} The TreatmentWithConfig, the object containing the treatment string and the
1529
+ * @param key - The string key representing the consumer.
1530
+ * @param featureFlagName - The string that represents the feature flag we want to get the treatment.
1531
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1532
+ * @returns The TreatmentWithConfig, the object containing the treatment string and the
1839
1533
  * configuration stringified JSON (or null if there was no config for that treatment).
1840
1534
  */
1841
1535
  getTreatmentWithConfig(key: SplitKey, featureFlagName: string, attributes?: Attributes): TreatmentWithConfig;
1842
1536
  /**
1843
1537
  * Returns a Treatments value, which is an object map with the treatments for the given features.
1844
1538
  *
1845
- * @function getTreatments
1846
- * @param {string} key - The string key representing the consumer.
1847
- * @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
1848
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1849
- * @returns {Treatments} The treatments object map.
1539
+ * @param key - The string key representing the consumer.
1540
+ * @param featureFlagNames - An array of the feature flag names we want to get the treatments.
1541
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1542
+ * @returns The treatments object map.
1850
1543
  */
1851
1544
  getTreatments(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): Treatments;
1852
1545
  /**
1853
1546
  * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
1854
1547
  *
1855
- * @function getTreatmentsWithConfig
1856
- * @param {string} key - The string key representing the consumer.
1857
- * @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
1858
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1859
- * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1548
+ * @param key - The string key representing the consumer.
1549
+ * @param featureFlagNames - An array of the feature flag names we want to get the treatments.
1550
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1551
+ * @returns The map with all the TreatmentWithConfig objects
1860
1552
  */
1861
1553
  getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig;
1862
1554
  /**
1863
1555
  * Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
1864
1556
  *
1865
- * @function getTreatmentsByFlagSet
1866
- * @param {string} key - The string key representing the consumer.
1867
- * @param {string} flagSet - The flag set name we want to get the treatments.
1868
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1869
- * @returns {Treatments} The map with all the Treatment objects
1557
+ * @param key - The string key representing the consumer.
1558
+ * @param flagSet - The flag set name we want to get the treatments.
1559
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1560
+ * @returns The map with all the Treatment objects
1870
1561
  */
1871
1562
  getTreatmentsByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): Treatments;
1872
1563
  /**
1873
1564
  * 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.
1874
1565
  *
1875
- * @function getTreatmentsWithConfigByFlagSet
1876
- * @param {string} key - The string key representing the consumer.
1877
- * @param {string} flagSet - The flag set name we want to get the treatments.
1878
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1879
- * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1566
+ * @param key - The string key representing the consumer.
1567
+ * @param flagSet - The flag set name we want to get the treatments.
1568
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1569
+ * @returns The map with all the TreatmentWithConfig objects
1880
1570
  */
1881
1571
  getTreatmentsWithConfigByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): TreatmentsWithConfig;
1882
1572
  /**
1883
1573
  * 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.
1884
1574
  *
1885
- * @function getTreatmentsByFlagSets
1886
- * @param {string} key - The string key representing the consumer.
1887
- * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
1888
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1889
- * @returns {Treatments} The map with all the Treatment objects
1575
+ * @param key - The string key representing the consumer.
1576
+ * @param flagSets - An array of the flag set names we want to get the treatments.
1577
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1578
+ * @returns The map with all the Treatment objects
1890
1579
  */
1891
1580
  getTreatmentsByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): Treatments;
1892
1581
  /**
1893
1582
  * 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.
1894
1583
  *
1895
- * @function getTreatmentsWithConfigByFlagSets
1896
- * @param {string} key - The string key representing the consumer.
1897
- * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
1898
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1899
- * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1584
+ * @param key - The string key representing the consumer.
1585
+ * @param flagSets - An array of the flag set names we want to get the treatments.
1586
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1587
+ * @returns The map with all the TreatmentWithConfig objects
1900
1588
  */
1901
1589
  getTreatmentsWithConfigByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): TreatmentsWithConfig;
1902
1590
  /**
1903
1591
  * Tracks an event to be fed to the results product on Split user interface.
1904
1592
  *
1905
- * @function track
1906
- * @param {SplitKey} key - The key that identifies the entity related to this event.
1907
- * @param {string} trafficType - The traffic type of the entity related to this event. See {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
1908
- * @param {string} eventType - The event type corresponding to this event.
1909
- * @param {number=} value - The value of this event.
1910
- * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
1911
- * @returns {boolean} Whether the event was added to the queue successfully or not.
1593
+ * @param key - The key that identifies the entity related to this event.
1594
+ * @param trafficType - The traffic type of the entity related to this event. See {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
1595
+ * @param eventType - The event type corresponding to this event.
1596
+ * @param value - The value of this event.
1597
+ * @param properties - The properties of this event. Values can be string, number, boolean or null.
1598
+ * @returns Whether the event was added to the queue successfully or not.
1912
1599
  */
1913
1600
  track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): boolean;
1914
1601
  }
@@ -1916,377 +1603,338 @@ declare namespace SplitIO {
1916
1603
  * This represents the interface for the Client instance on server-side with asynchronous storage, like REDIS.
1917
1604
  * User key is not bound to the instance and must be provided on each method call, which returns a promise.
1918
1605
  * This interface is available in NodeJS, or when importing the 'server' sub-package in JS SDK (e.g., `import { SplitFactory } from '@splitsoftware/splitio/server'`).
1919
- *
1920
- * @interface INodeAsyncClient
1921
- * @extends IBasicClient
1922
1606
  */
1923
1607
  interface INodeAsyncClient extends IBasicClient {
1924
1608
  /**
1925
1609
  * Returns a Treatment value, which will be (or eventually be) the treatment string for the given feature.
1926
1610
  *
1927
- * @function getTreatment
1928
- * @param {string} key - The string key representing the consumer.
1929
- * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
1930
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1931
- * @returns {AsyncTreatment} Treatment promise that resolves to the treatment string.
1611
+ * @param key - The string key representing the consumer.
1612
+ * @param featureFlagName - The string that represents the feature flag we want to get the treatment.
1613
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1614
+ * @returns Treatment promise that resolves to the treatment string.
1932
1615
  */
1933
1616
  getTreatment(key: SplitKey, featureFlagName: string, attributes?: Attributes): AsyncTreatment;
1934
1617
  /**
1935
1618
  * Returns a TreatmentWithConfig value, which will be (or eventually be) an object with both treatment and config string for the given feature.
1936
1619
  *
1937
- * @function getTreatmentWithConfig
1938
- * @param {string} key - The string key representing the consumer.
1939
- * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
1940
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1941
- * @returns {AsyncTreatmentWithConfig} TreatmentWithConfig promise that resolves to the TreatmentWithConfig object.
1620
+ * @param key - The string key representing the consumer.
1621
+ * @param featureFlagName - The string that represents the feature flag we want to get the treatment.
1622
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1623
+ * @returns TreatmentWithConfig promise that resolves to the TreatmentWithConfig object.
1942
1624
  */
1943
1625
  getTreatmentWithConfig(key: SplitKey, featureFlagName: string, attributes?: Attributes): AsyncTreatmentWithConfig;
1944
1626
  /**
1945
1627
  * Returns a Treatments value, which will be (or eventually be) an object map with the treatments for the given features.
1946
1628
  *
1947
- * @function getTreatments
1948
- * @param {string} key - The string key representing the consumer.
1949
- * @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
1950
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1951
- * @returns {AsyncTreatments} Treatments promise that resolves to the treatments object map.
1629
+ * @param key - The string key representing the consumer.
1630
+ * @param featureFlagNames - An array of the feature flag names we want to get the treatments.
1631
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1632
+ * @returns Treatments promise that resolves to the treatments object map.
1952
1633
  */
1953
1634
  getTreatments(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): AsyncTreatments;
1954
1635
  /**
1955
1636
  * 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.
1956
1637
  *
1957
- * @function getTreatmentsWithConfig
1958
- * @param {string} key - The string key representing the consumer.
1959
- * @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
1960
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1961
- * @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the map of TreatmentsWithConfig objects.
1638
+ * @param key - The string key representing the consumer.
1639
+ * @param featureFlagNames - An array of the feature flag names we want to get the treatments.
1640
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1641
+ * @returns TreatmentsWithConfig promise that resolves to the map of TreatmentsWithConfig objects.
1962
1642
  */
1963
1643
  getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig;
1964
1644
  /**
1965
1645
  * Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
1966
1646
  *
1967
- * @function getTreatmentsByFlagSet
1968
- * @param {string} key - The string key representing the consumer.
1969
- * @param {string} flagSet - The flag set name we want to get the treatments.
1970
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1971
- * @returns {AsyncTreatments} Treatments promise that resolves to the treatments object map.
1647
+ * @param key - The string key representing the consumer.
1648
+ * @param flagSet - The flag set name we want to get the treatments.
1649
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1650
+ * @returns Treatments promise that resolves to the treatments object map.
1972
1651
  */
1973
1652
  getTreatmentsByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): AsyncTreatments;
1974
1653
  /**
1975
1654
  * 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.
1976
1655
  *
1977
- * @function getTreatmentsWithConfigByFlagSet
1978
- * @param {string} key - The string key representing the consumer.
1979
- * @param {string} flagSet - The flag set name we want to get the treatments.
1980
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1981
- * @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the map of TreatmentsWithConfig objects.
1656
+ * @param key - The string key representing the consumer.
1657
+ * @param flagSet - The flag set name we want to get the treatments.
1658
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1659
+ * @returns TreatmentsWithConfig promise that resolves to the map of TreatmentsWithConfig objects.
1982
1660
  */
1983
1661
  getTreatmentsWithConfigByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): AsyncTreatmentsWithConfig;
1984
1662
  /**
1985
1663
  * 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.
1986
1664
  *
1987
- * @function getTreatmentsByFlagSets
1988
- * @param {string} key - The string key representing the consumer.
1989
- * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
1990
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1991
- * @returns {AsyncTreatments} Treatments promise that resolves to the treatments object map.
1665
+ * @param key - The string key representing the consumer.
1666
+ * @param flagSets - An array of the flag set names we want to get the treatments.
1667
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1668
+ * @returns Treatments promise that resolves to the treatments object map.
1992
1669
  */
1993
1670
  getTreatmentsByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): AsyncTreatments;
1994
1671
  /**
1995
1672
  * 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.
1996
1673
  *
1997
- * @function getTreatmentsWithConfigByFlagSets
1998
- * @param {string} key - The string key representing the consumer.
1999
- * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
2000
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
2001
- * @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the map of TreatmentsWithConfig objects.
1674
+ * @param key - The string key representing the consumer.
1675
+ * @param flagSets - An array of the flag set names we want to get the treatments.
1676
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1677
+ * @returns TreatmentsWithConfig promise that resolves to the map of TreatmentsWithConfig objects.
2002
1678
  */
2003
1679
  getTreatmentsWithConfigByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): AsyncTreatmentsWithConfig;
2004
1680
  /**
2005
1681
  * 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).
2006
1682
  *
2007
- * @function track
2008
- * @param {SplitKey} key - The key that identifies the entity related to this event.
2009
- * @param {string} trafficType - The traffic type of the entity related to this event. See {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
2010
- * @param {string} eventType - The event type corresponding to this event.
2011
- * @param {number=} value - The value of this event.
2012
- * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
2013
- * @returns {Promise<boolean>} A promise that resolves to a boolean indicating if the event was added to the queue successfully or not.
1683
+ * @param key - The key that identifies the entity related to this event.
1684
+ * @param trafficType - The traffic type of the entity related to this event. See {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
1685
+ * @param eventType - The event type corresponding to this event.
1686
+ * @param value - The value of this event.
1687
+ * @param properties - The properties of this event. Values can be string, number, boolean or null.
1688
+ * @returns A promise that resolves to a boolean indicating if the event was added to the queue successfully or not.
2014
1689
  */
2015
1690
  track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): Promise<boolean>;
2016
1691
  }
2017
1692
  interface IClientWithAttributes extends IBasicClient {
2018
1693
  /**
2019
- * Add an attribute to client's in memory attributes storage.
1694
+ * Add an attribute to client's in-memory attributes storage.
2020
1695
  *
2021
- * @param {string} attributeName Attribute name
2022
- * @param {AttributeType} attributeValue Attribute value
2023
- * @returns {boolean} true if the attribute was stored and false otherwise
1696
+ * @param attributeName - Attribute name
1697
+ * @param attributeValue - Attribute value
1698
+ * @returns true if the attribute was stored and false otherwise
2024
1699
  */
2025
1700
  setAttribute(attributeName: string, attributeValue: AttributeType): boolean;
2026
1701
  /**
2027
1702
  * Returns the attribute with the given name.
2028
1703
  *
2029
- * @param {string} attributeName Attribute name
2030
- * @returns {AttributeType} Attribute with the given name
1704
+ * @param attributeName - Attribute name
1705
+ * @returns Attribute with the given name
2031
1706
  */
2032
1707
  getAttribute(attributeName: string): AttributeType;
2033
1708
  /**
2034
- * Removes from client's in memory attributes storage the attribute with the given name.
1709
+ * Removes from client's in-memory attributes storage the attribute with the given name.
2035
1710
  *
2036
- * @param {string} attributeName
2037
- * @returns {boolean} true if attribute was removed and false otherwise
1711
+ * @param attributeName - Attribute name
1712
+ * @returns true if attribute was removed and false otherwise
2038
1713
  */
2039
1714
  removeAttribute(attributeName: string): boolean;
2040
1715
  /**
2041
- * Add to client's in memory attributes storage the attributes in 'attributes'.
1716
+ * Add to client's in-memory attributes storage the attributes in 'attributes'.
2042
1717
  *
2043
- * @param {Attributes} attributes Object with attributes to store
1718
+ * @param attributes - Object with attributes to store
2044
1719
  * @returns true if attributes were stored an false otherwise
2045
1720
  */
2046
1721
  setAttributes(attributes: Attributes): boolean;
2047
1722
  /**
2048
- * Return all the attributes stored in client's in memory attributes storage.
1723
+ * Return all the attributes stored in client's in-memory attributes storage.
2049
1724
  *
2050
- * @returns {Attributes} returns all the stored attributes
1725
+ * @returns returns all the stored attributes
2051
1726
  */
2052
1727
  getAttributes(): Attributes;
2053
1728
  /**
2054
- * Remove all the stored attributes in the client's in memory attribute storage.
1729
+ * Remove all the stored attributes in the client's in-memory attribute storage.
2055
1730
  *
2056
- * @returns {boolean} true if all attribute were removed and false otherwise
1731
+ * @returns true if all attribute were removed and false otherwise
2057
1732
  */
2058
1733
  clearAttributes(): boolean;
2059
1734
  }
2060
1735
  /**
2061
1736
  * This represents the interface for the Client instance on client-side, where the user key is bound to the instance on creation and does not need to be provided on each method call.
2062
- *
2063
- * @interface IClient
2064
- * @extends IClientWithAttributes
2065
1737
  */
2066
1738
  interface IClient extends IClientWithAttributes {
2067
1739
  /**
2068
1740
  * Returns a Treatment value, which is the treatment string for the given feature.
2069
1741
  *
2070
- * @function getTreatment
2071
- * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
2072
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
2073
- * @returns {Treatment} The treatment string.
1742
+ * @param featureFlagName - The string that represents the feature flag we want to get the treatment.
1743
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1744
+ * @returns The treatment string.
2074
1745
  */
2075
1746
  getTreatment(featureFlagName: string, attributes?: Attributes): Treatment;
2076
1747
  /**
2077
1748
  * Returns a TreatmentWithConfig value, which is an object with both treatment and config string for the given feature.
2078
1749
  *
2079
- * @function getTreatmentWithConfig
2080
- * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
2081
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
2082
- * @returns {TreatmentWithConfig} The map containing the treatment and the configuration stringified JSON (or null if there was no config for that treatment).
1750
+ * @param featureFlagName - The string that represents the feature flag we want to get the treatment.
1751
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1752
+ * @returns The map containing the treatment and the configuration stringified JSON (or null if there was no config for that treatment).
2083
1753
  */
2084
1754
  getTreatmentWithConfig(featureFlagName: string, attributes?: Attributes): TreatmentWithConfig;
2085
1755
  /**
2086
1756
  * Returns a Treatments value, which is an object map with the treatments for the given features.
2087
1757
  *
2088
- * @function getTreatments
2089
- * @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
2090
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
2091
- * @returns {Treatments} The treatments object map.
1758
+ * @param featureFlagNames - An array of the feature flag names we want to get the treatments.
1759
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1760
+ * @returns The treatments object map.
2092
1761
  */
2093
1762
  getTreatments(featureFlagNames: string[], attributes?: Attributes): Treatments;
2094
1763
  /**
2095
1764
  * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
2096
1765
  *
2097
- * @function getTreatmentsWithConfig
2098
- * @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
2099
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
2100
- * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1766
+ * @param featureFlagNames - An array of the feature flag names we want to get the treatments.
1767
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1768
+ * @returns The map with all the TreatmentWithConfig objects
2101
1769
  */
2102
1770
  getTreatmentsWithConfig(featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig;
2103
1771
  /**
2104
1772
  * Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
2105
1773
  *
2106
- * @function getTreatmentsByFlagSet
2107
- * @param {string} flagSet - The flag set name we want to get the treatments.
2108
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
2109
- * @returns {Treatments} The map with all the Treatments objects
1774
+ * @param flagSet - The flag set name we want to get the treatments.
1775
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1776
+ * @returns The map with all the Treatments objects
2110
1777
  */
2111
1778
  getTreatmentsByFlagSet(flagSet: string, attributes?: Attributes): Treatments;
2112
1779
  /**
2113
1780
  * 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.
2114
1781
  *
2115
- * @function getTreatmentsWithConfigByFlagSet
2116
- * @param {string} flagSet - The flag set name we want to get the treatments.
2117
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
2118
- * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1782
+ * @param flagSet - The flag set name we want to get the treatments.
1783
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1784
+ * @returns The map with all the TreatmentWithConfig objects
2119
1785
  */
2120
1786
  getTreatmentsWithConfigByFlagSet(flagSet: string, attributes?: Attributes): TreatmentsWithConfig;
2121
1787
  /**
2122
1788
  * 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.
2123
1789
  *
2124
- * @function getTreatmentsByFlagSets
2125
- * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
2126
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
2127
- * @returns {Treatments} The map with all the Treatments objects
1790
+ * @param flagSets - An array of the flag set names we want to get the treatments.
1791
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1792
+ * @returns The map with all the Treatments objects
2128
1793
  */
2129
1794
  getTreatmentsByFlagSets(flagSets: string[], attributes?: Attributes): Treatments;
2130
1795
  /**
2131
1796
  * 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.
2132
1797
  *
2133
- * @function getTreatmentsWithConfigByFlagSets
2134
- * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
2135
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
2136
- * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1798
+ * @param flagSets - An array of the flag set names we want to get the treatments.
1799
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1800
+ * @returns The map with all the TreatmentWithConfig objects
2137
1801
  */
2138
1802
  getTreatmentsWithConfigByFlagSets(flagSets: string[], attributes?: Attributes): TreatmentsWithConfig;
2139
1803
  /**
2140
1804
  * Tracks an event to be fed to the results product on Split user interface.
2141
1805
  *
2142
- * @function track
2143
- * @param {string} trafficType - The traffic type of the entity related to this event. See {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
2144
- * @param {string} eventType - The event type corresponding to this event.
2145
- * @param {number=} value - The value of this event.
2146
- * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
2147
- * @returns {boolean} Whether the event was added to the queue successfully or not.
1806
+ * @param trafficType - The traffic type of the entity related to this event. See {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
1807
+ * @param eventType - The event type corresponding to this event.
1808
+ * @param value - The value of this event.
1809
+ * @param properties - The properties of this event. Values can be string, number, boolean or null.
1810
+ * @returns Whether the event was added to the queue successfully or not.
2148
1811
  */
2149
1812
  track(trafficType: string, eventType: string, value?: number, properties?: Properties): boolean;
2150
1813
  }
2151
1814
  /**
2152
1815
  * This represents the interface for the Client instance with asynchronous storage for client-side SDK, where each client has associated a key.
2153
- * @interface IAsyncClient
2154
- * @extends IClientWithAttributes
2155
1816
  */
2156
1817
  interface IAsyncClient extends IClientWithAttributes {
2157
1818
  /**
2158
1819
  * Returns a Treatment value, which will be (or eventually be) the treatment string for the given feature.
2159
1820
  *
2160
- * @function getTreatment
2161
- * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
2162
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
2163
- * @returns {AsyncTreatment} Treatment promise that resolves to the treatment string.
1821
+ * @param featureFlagName - The string that represents the feature flag we want to get the treatment.
1822
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1823
+ * @returns Treatment promise that resolves to the treatment string.
2164
1824
  */
2165
1825
  getTreatment(featureFlagName: string, attributes?: Attributes): AsyncTreatment;
2166
1826
  /**
2167
1827
  * Returns a TreatmentWithConfig value, which will be (or eventually be) an object with both treatment and config string for the given feature.
2168
1828
  *
2169
- * @function getTreatmentWithConfig
2170
- * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
2171
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
2172
- * @returns {AsyncTreatmentWithConfig} TreatmentWithConfig promise that resolves to the TreatmentWithConfig object.
1829
+ * @param featureFlagName - The string that represents the feature flag we want to get the treatment.
1830
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1831
+ * @returns TreatmentWithConfig promise that resolves to the TreatmentWithConfig object.
2173
1832
  */
2174
1833
  getTreatmentWithConfig(featureFlagName: string, attributes?: Attributes): AsyncTreatmentWithConfig;
2175
1834
  /**
2176
1835
  * Returns a Treatments value, which will be (or eventually be) an object map with the treatments for the given features.
2177
1836
  *
2178
- * @function getTreatments
2179
- * @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
2180
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
2181
- * @returns {AsyncTreatments} Treatments promise that resolves to the treatments object map.
1837
+ * @param featureFlagNames - An array of the feature flag names we want to get the treatments.
1838
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1839
+ * @returns Treatments promise that resolves to the treatments object map.
2182
1840
  */
2183
1841
  getTreatments(featureFlagNames: string[], attributes?: Attributes): AsyncTreatments;
2184
1842
  /**
2185
1843
  * 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.
2186
1844
  *
2187
- * @function getTreatmentsWithConfig
2188
- * @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
2189
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
2190
- * @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the TreatmentsWithConfig object.
1845
+ * @param featureFlagNames - An array of the feature flag names we want to get the treatments.
1846
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1847
+ * @returns TreatmentsWithConfig promise that resolves to the TreatmentsWithConfig object.
2191
1848
  */
2192
1849
  getTreatmentsWithConfig(featureFlagNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig;
2193
1850
  /**
2194
1851
  * Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
2195
1852
  *
2196
- * @function getTreatmentsByFlagSet
2197
- * @param {string} flagSet - The flag set name we want to get the treatments.
2198
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
2199
- * @returns {AsyncTreatments} Treatments promise that resolves to the treatments object map.
1853
+ * @param flagSet - The flag set name we want to get the treatments.
1854
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1855
+ * @returns Treatments promise that resolves to the treatments object map.
2200
1856
  */
2201
1857
  getTreatmentsByFlagSet(flagSet: string, attributes?: Attributes): AsyncTreatments;
2202
1858
  /**
2203
1859
  * 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.
2204
1860
  *
2205
- * @function getTreatmentsWithConfigByFlagSet
2206
- * @param {string} flagSet - The flag set name we want to get the treatments.
2207
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
2208
- * @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the TreatmentsWithConfig object.
1861
+ * @param flagSet - The flag set name we want to get the treatments.
1862
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1863
+ * @returns TreatmentsWithConfig promise that resolves to the TreatmentsWithConfig object.
2209
1864
  */
2210
1865
  getTreatmentsWithConfigByFlagSet(flagSet: string, attributes?: Attributes): AsyncTreatmentsWithConfig;
2211
1866
  /**
2212
1867
  * 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.
2213
1868
  *
2214
- * @function getTreatmentsByFlagSets
2215
- * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
2216
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
2217
- * @returns {AsyncTreatments} Treatments promise that resolves to the treatments object map.
1869
+ * @param flagSets - An array of the flag set names we want to get the treatments.
1870
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1871
+ * @returns Treatments promise that resolves to the treatments object map.
2218
1872
  */
2219
1873
  getTreatmentsByFlagSets(flagSets: string[], attributes?: Attributes): AsyncTreatments;
2220
1874
  /**
2221
1875
  * 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.
2222
1876
  *
2223
- * @function getTreatmentsWithConfigByFlagSets
2224
- * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
2225
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
2226
- * @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the TreatmentsWithConfig object.
1877
+ * @param flagSets - An array of the flag set names we want to get the treatments.
1878
+ * @param attributes - An object of type Attributes defining the attributes for the given key.
1879
+ * @returns TreatmentsWithConfig promise that resolves to the TreatmentsWithConfig object.
2227
1880
  */
2228
1881
  getTreatmentsWithConfigByFlagSets(flagSets: string[], attributes?: Attributes): AsyncTreatmentsWithConfig;
2229
1882
  /**
2230
1883
  * 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).
2231
1884
  *
2232
- * @function track
2233
- * @param {string} trafficType - The traffic type of the entity related to this event.
2234
- * @param {string} eventType - The event type corresponding to this event.
2235
- * @param {number=} value - The value of this event.
2236
- * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
2237
- * @returns {boolean} A promise that resolves to a boolean indicating if the event was added to the queue successfully or not.
1885
+ * @param trafficType - The traffic type of the entity related to this event.
1886
+ * @param eventType - The event type corresponding to this event.
1887
+ * @param value - The value of this event.
1888
+ * @param properties - The properties of this event. Values can be string, number, boolean or null.
1889
+ * @returns A promise that resolves to a boolean indicating if the event was added to the queue successfully or not.
2238
1890
  */
2239
1891
  track(trafficType: string, eventType: string, value?: number, properties?: Properties): Promise<boolean>;
2240
1892
  }
2241
1893
  /**
2242
1894
  * Representation of a manager instance with synchronous storage of the SDK.
2243
- * @interface IManager
2244
- * @extends IStatusInterface
2245
1895
  */
2246
1896
  interface IManager extends IStatusInterface {
2247
1897
  /**
2248
1898
  * Get the array of feature flag names.
2249
- * @function names
2250
- * @returns {SplitNames} The list of feature flag names.
1899
+ *
1900
+ * @returns The list of feature flag names.
2251
1901
  */
2252
1902
  names(): SplitNames;
2253
1903
  /**
2254
1904
  * Get the array of feature flags data in SplitView format.
2255
- * @function splits
2256
- * @returns {SplitViews} The list of SplitIO.SplitView.
1905
+ *
1906
+ * @returns The list of SplitIO.SplitView.
2257
1907
  */
2258
1908
  splits(): SplitViews;
2259
1909
  /**
2260
1910
  * Get the data of a feature flag in SplitView format.
2261
- * @function split
2262
- * @param {string} featureFlagName The name of the feature flag we want to get info of.
2263
- * @returns {SplitView | null} The SplitIO.SplitView of the given feature flag name or null if the feature flag is not found.
1911
+ *
1912
+ * @param featureFlagName - The name of the feature flag we want to get info of.
1913
+ * @returns The SplitIO.SplitView of the given feature flag name or null if the feature flag is not found.
2264
1914
  */
2265
1915
  split(featureFlagName: string): SplitView | null;
2266
1916
  }
2267
1917
  /**
2268
1918
  * Representation of a manager instance with asynchronous storage of the SDK.
2269
- * @interface IAsyncManager
2270
- * @extends IStatusInterface
2271
1919
  */
2272
1920
  interface IAsyncManager extends IStatusInterface {
2273
1921
  /**
2274
1922
  * Get the array of feature flag names.
2275
- * @function names
2276
- * @returns {SplitNamesAsync} A promise that resolves to the list of feature flag names.
1923
+ *
1924
+ * @returns A promise that resolves to the list of feature flag names.
2277
1925
  */
2278
1926
  names(): SplitNamesAsync;
2279
1927
  /**
2280
1928
  * Get the array of feature flags data in SplitView format.
2281
- * @function splits
2282
- * @returns {SplitViewsAsync} A promise that resolves to the SplitIO.SplitView list.
1929
+ *
1930
+ * @returns A promise that resolves to the SplitIO.SplitView list.
2283
1931
  */
2284
1932
  splits(): SplitViewsAsync;
2285
1933
  /**
2286
1934
  * Get the data of a feature flag in SplitView format.
2287
- * @function split
2288
- * @param {string} featureFlagName The name of the feature flag we want to get info of.
2289
- * @returns {SplitViewAsync} A promise that resolves to the SplitIO.SplitView value.
1935
+ *
1936
+ * @param featureFlagName - The name of the feature flag we want to get info of.
1937
+ * @returns A promise that resolves to the SplitIO.SplitView value.
2290
1938
  */
2291
1939
  split(featureFlagName: string): SplitViewAsync;
2292
1940
  }