@splitsoftware/splitio-commons 2.0.0-rc.2 → 2.0.0-rc.4

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