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