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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/CHANGES.txt +1 -0
  2. package/cjs/integrations/pluggable.js +2 -2
  3. package/cjs/logger/sdkLogger.js +2 -2
  4. package/cjs/readiness/sdkReadinessManager.js +2 -21
  5. package/cjs/sdkClient/client.js +0 -1
  6. package/cjs/sdkClient/clientAttributesDecoration.js +9 -9
  7. package/cjs/sdkClient/clientCS.js +2 -2
  8. package/cjs/services/splitApi.js +13 -13
  9. package/cjs/services/splitHttpClient.js +2 -2
  10. package/cjs/storages/AbstractSplitsCacheAsync.js +1 -4
  11. package/cjs/storages/AbstractSplitsCacheSync.js +1 -4
  12. package/cjs/storages/dataLoader.js +5 -6
  13. package/cjs/storages/findLatencyIndex.js +1 -1
  14. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +1 -6
  15. package/cjs/storages/inMemory/AttributesCacheInMemory.js +10 -10
  16. package/cjs/storages/inMemory/EventsCacheInMemory.js +1 -1
  17. package/cjs/storages/inMemory/ImpressionsCacheInMemory.js +1 -1
  18. package/cjs/storages/inMemory/InMemoryStorage.js +1 -1
  19. package/cjs/storages/inMemory/InMemoryStorageCS.js +1 -1
  20. package/cjs/storages/inMemory/UniqueKeysCacheInMemoryCS.js +0 -5
  21. package/cjs/storages/inRedis/SplitsCacheInRedis.js +1 -3
  22. package/cjs/storages/inRedis/TelemetryCacheInRedis.js +3 -3
  23. package/cjs/storages/inRedis/UniqueKeysCacheInRedis.js +1 -1
  24. package/cjs/storages/pluggable/EventsCachePluggable.js +1 -1
  25. package/cjs/storages/pluggable/ImpressionsCachePluggable.js +1 -1
  26. package/cjs/storages/pluggable/SegmentsCachePluggable.js +1 -1
  27. package/cjs/storages/pluggable/SplitsCachePluggable.js +3 -3
  28. package/cjs/storages/pluggable/TelemetryCachePluggable.js +3 -3
  29. package/cjs/storages/pluggable/UniqueKeysCachePluggable.js +1 -1
  30. package/cjs/storages/pluggable/inMemoryWrapper.js +1 -1
  31. package/cjs/storages/pluggable/index.js +1 -1
  32. package/cjs/storages/pluggable/wrapperAdapter.js +2 -2
  33. package/cjs/sync/offline/splitsParser/splitsParserFromSettings.js +1 -1
  34. package/cjs/sync/offline/syncManagerOffline.js +1 -1
  35. package/cjs/sync/polling/updaters/mySegmentsUpdater.js +3 -3
  36. package/cjs/sync/polling/updaters/segmentChangesUpdater.js +8 -8
  37. package/cjs/sync/polling/updaters/splitChangesUpdater.js +13 -13
  38. package/cjs/sync/streaming/AuthClient/index.js +2 -2
  39. package/cjs/sync/streaming/SSEClient/index.js +4 -7
  40. package/cjs/sync/streaming/SSEHandler/NotificationKeeper.js +1 -1
  41. package/cjs/sync/streaming/SSEHandler/NotificationParser.js +5 -4
  42. package/cjs/sync/streaming/SSEHandler/index.js +2 -2
  43. package/cjs/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +3 -3
  44. package/cjs/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +2 -2
  45. package/cjs/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +4 -4
  46. package/cjs/sync/streaming/parseUtils.js +13 -13
  47. package/cjs/sync/syncManagerOnline.js +2 -2
  48. package/cjs/sync/syncTask.js +4 -4
  49. package/cjs/trackers/eventTracker.js +2 -2
  50. package/cjs/trackers/impressionsTracker.js +5 -5
  51. package/cjs/trackers/strategy/strategyDebug.js +1 -1
  52. package/cjs/trackers/strategy/strategyNone.js +2 -2
  53. package/cjs/trackers/strategy/strategyOptimized.js +2 -2
  54. package/cjs/trackers/uniqueKeysTracker.js +3 -3
  55. package/cjs/utils/Backoff.js +0 -4
  56. package/cjs/utils/Semver.js +1 -1
  57. package/cjs/utils/base64/index.js +2 -2
  58. package/cjs/utils/decompress/index.js +4 -4
  59. package/cjs/utils/lang/binarySearch.js +2 -2
  60. package/cjs/utils/murmur3/murmur3_128.js +1 -1
  61. package/cjs/utils/murmur3/murmur3_128_x86.js +1 -1
  62. package/cjs/utils/murmur3/murmur3_64.js +1 -1
  63. package/cjs/utils/murmur3/utfx.js +10 -17
  64. package/cjs/utils/promise/wrapper.js +2 -2
  65. package/cjs/utils/settingsValidation/index.js +2 -2
  66. package/cjs/utils/settingsValidation/integrations/common.js +4 -4
  67. package/cjs/utils/settingsValidation/integrations/configurable.js +3 -3
  68. package/cjs/utils/settingsValidation/integrations/pluggable.js +2 -2
  69. package/cjs/utils/settingsValidation/logger/builtinLogger.js +1 -1
  70. package/cjs/utils/settingsValidation/logger/commons.js +1 -1
  71. package/cjs/utils/settingsValidation/logger/pluggableLogger.js +1 -1
  72. package/cjs/utils/settingsValidation/splitFilters.js +8 -11
  73. package/cjs/utils/settingsValidation/storage/storageCS.js +2 -2
  74. package/cjs/utils/settingsValidation/url.js +3 -3
  75. package/esm/integrations/pluggable.js +2 -2
  76. package/esm/logger/sdkLogger.js +2 -2
  77. package/esm/readiness/sdkReadinessManager.js +2 -21
  78. package/esm/sdkClient/client.js +0 -1
  79. package/esm/sdkClient/clientAttributesDecoration.js +9 -9
  80. package/esm/sdkClient/clientCS.js +2 -2
  81. package/esm/services/splitApi.js +13 -13
  82. package/esm/services/splitHttpClient.js +2 -2
  83. package/esm/storages/AbstractSplitsCacheAsync.js +1 -4
  84. package/esm/storages/AbstractSplitsCacheSync.js +1 -4
  85. package/esm/storages/dataLoader.js +5 -6
  86. package/esm/storages/findLatencyIndex.js +1 -1
  87. package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +1 -6
  88. package/esm/storages/inMemory/AttributesCacheInMemory.js +10 -10
  89. package/esm/storages/inMemory/EventsCacheInMemory.js +1 -1
  90. package/esm/storages/inMemory/ImpressionsCacheInMemory.js +1 -1
  91. package/esm/storages/inMemory/InMemoryStorage.js +1 -1
  92. package/esm/storages/inMemory/InMemoryStorageCS.js +1 -1
  93. package/esm/storages/inMemory/UniqueKeysCacheInMemoryCS.js +0 -5
  94. package/esm/storages/inRedis/SplitsCacheInRedis.js +1 -3
  95. package/esm/storages/inRedis/TelemetryCacheInRedis.js +3 -3
  96. package/esm/storages/inRedis/UniqueKeysCacheInRedis.js +1 -1
  97. package/esm/storages/pluggable/EventsCachePluggable.js +1 -1
  98. package/esm/storages/pluggable/ImpressionsCachePluggable.js +1 -1
  99. package/esm/storages/pluggable/SegmentsCachePluggable.js +1 -1
  100. package/esm/storages/pluggable/SplitsCachePluggable.js +3 -3
  101. package/esm/storages/pluggable/TelemetryCachePluggable.js +3 -3
  102. package/esm/storages/pluggable/UniqueKeysCachePluggable.js +1 -1
  103. package/esm/storages/pluggable/inMemoryWrapper.js +1 -1
  104. package/esm/storages/pluggable/index.js +1 -1
  105. package/esm/storages/pluggable/wrapperAdapter.js +2 -2
  106. package/esm/sync/offline/splitsParser/splitsParserFromSettings.js +1 -1
  107. package/esm/sync/offline/syncManagerOffline.js +1 -1
  108. package/esm/sync/polling/updaters/mySegmentsUpdater.js +3 -3
  109. package/esm/sync/polling/updaters/segmentChangesUpdater.js +8 -8
  110. package/esm/sync/polling/updaters/splitChangesUpdater.js +13 -13
  111. package/esm/sync/streaming/AuthClient/index.js +2 -2
  112. package/esm/sync/streaming/SSEClient/index.js +4 -7
  113. package/esm/sync/streaming/SSEHandler/NotificationKeeper.js +1 -1
  114. package/esm/sync/streaming/SSEHandler/NotificationParser.js +5 -4
  115. package/esm/sync/streaming/SSEHandler/index.js +2 -2
  116. package/esm/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +3 -3
  117. package/esm/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +2 -2
  118. package/esm/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +4 -4
  119. package/esm/sync/streaming/parseUtils.js +13 -13
  120. package/esm/sync/syncManagerOnline.js +2 -2
  121. package/esm/sync/syncTask.js +4 -4
  122. package/esm/trackers/eventTracker.js +2 -2
  123. package/esm/trackers/impressionsTracker.js +5 -5
  124. package/esm/trackers/strategy/strategyDebug.js +1 -1
  125. package/esm/trackers/strategy/strategyNone.js +2 -2
  126. package/esm/trackers/strategy/strategyOptimized.js +2 -2
  127. package/esm/trackers/uniqueKeysTracker.js +3 -3
  128. package/esm/utils/Backoff.js +0 -4
  129. package/esm/utils/Semver.js +1 -1
  130. package/esm/utils/base64/index.js +2 -2
  131. package/esm/utils/decompress/index.js +4 -4
  132. package/esm/utils/lang/binarySearch.js +2 -2
  133. package/esm/utils/murmur3/murmur3_128.js +1 -1
  134. package/esm/utils/murmur3/murmur3_128_x86.js +1 -1
  135. package/esm/utils/murmur3/murmur3_64.js +1 -1
  136. package/esm/utils/murmur3/utfx.js +10 -17
  137. package/esm/utils/promise/wrapper.js +2 -2
  138. package/esm/utils/settingsValidation/index.js +2 -2
  139. package/esm/utils/settingsValidation/integrations/common.js +4 -4
  140. package/esm/utils/settingsValidation/integrations/configurable.js +3 -3
  141. package/esm/utils/settingsValidation/integrations/pluggable.js +2 -2
  142. package/esm/utils/settingsValidation/logger/builtinLogger.js +1 -1
  143. package/esm/utils/settingsValidation/logger/commons.js +1 -1
  144. package/esm/utils/settingsValidation/logger/pluggableLogger.js +1 -1
  145. package/esm/utils/settingsValidation/splitFilters.js +8 -11
  146. package/esm/utils/settingsValidation/storage/storageCS.js +2 -2
  147. package/esm/utils/settingsValidation/url.js +3 -3
  148. package/package.json +3 -2
  149. package/src/dtos/types.ts +1 -1
  150. package/src/evaluator/Engine.ts +1 -1
  151. package/src/evaluator/combiners/ifelseif.ts +1 -1
  152. package/src/evaluator/condition/index.ts +1 -1
  153. package/src/evaluator/index.ts +1 -1
  154. package/src/evaluator/parser/index.ts +1 -1
  155. package/src/evaluator/types.ts +1 -1
  156. package/src/evaluator/value/index.ts +1 -1
  157. package/src/evaluator/value/sanitize.ts +1 -1
  158. package/src/integrations/pluggable.ts +3 -3
  159. package/src/integrations/types.ts +3 -2
  160. package/src/listeners/browser.ts +3 -2
  161. package/src/logger/index.ts +6 -6
  162. package/src/logger/sdkLogger.ts +4 -4
  163. package/src/logger/types.ts +11 -13
  164. package/src/readiness/readinessManager.ts +5 -4
  165. package/src/readiness/sdkReadinessManager.ts +6 -23
  166. package/src/readiness/types.ts +5 -4
  167. package/src/sdkClient/client.ts +5 -6
  168. package/src/sdkClient/clientAttributesDecoration.ts +10 -10
  169. package/src/sdkClient/clientCS.ts +5 -5
  170. package/src/sdkClient/clientInputValidation.ts +2 -1
  171. package/src/sdkClient/identity.ts +1 -1
  172. package/src/sdkClient/sdkClient.ts +2 -2
  173. package/src/sdkClient/sdkClientMethod.ts +1 -1
  174. package/src/sdkClient/sdkClientMethodCS.ts +3 -3
  175. package/src/sdkFactory/index.ts +3 -3
  176. package/src/sdkFactory/types.ts +8 -7
  177. package/src/sdkManager/index.ts +2 -1
  178. package/src/services/splitApi.ts +13 -13
  179. package/src/services/splitHttpClient.ts +2 -2
  180. package/src/storages/AbstractMySegmentsCacheSync.ts +1 -1
  181. package/src/storages/AbstractSplitsCacheAsync.ts +1 -4
  182. package/src/storages/AbstractSplitsCacheSync.ts +1 -4
  183. package/src/storages/dataLoader.ts +7 -8
  184. package/src/storages/findLatencyIndex.ts +1 -1
  185. package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +1 -6
  186. package/src/storages/inMemory/AttributesCacheInMemory.ts +11 -11
  187. package/src/storages/inMemory/EventsCacheInMemory.ts +2 -2
  188. package/src/storages/inMemory/ImpressionsCacheInMemory.ts +5 -5
  189. package/src/storages/inMemory/InMemoryStorage.ts +1 -1
  190. package/src/storages/inMemory/InMemoryStorageCS.ts +1 -1
  191. package/src/storages/inMemory/UniqueKeysCacheInMemoryCS.ts +0 -5
  192. package/src/storages/inRedis/EventsCacheInRedis.ts +1 -1
  193. package/src/storages/inRedis/ImpressionsCacheInRedis.ts +2 -2
  194. package/src/storages/inRedis/SplitsCacheInRedis.ts +1 -3
  195. package/src/storages/inRedis/TelemetryCacheInRedis.ts +3 -3
  196. package/src/storages/inRedis/UniqueKeysCacheInRedis.ts +1 -1
  197. package/src/storages/pluggable/EventsCachePluggable.ts +2 -2
  198. package/src/storages/pluggable/ImpressionsCachePluggable.ts +3 -3
  199. package/src/storages/pluggable/SegmentsCachePluggable.ts +1 -1
  200. package/src/storages/pluggable/SplitsCachePluggable.ts +3 -3
  201. package/src/storages/pluggable/TelemetryCachePluggable.ts +3 -3
  202. package/src/storages/pluggable/UniqueKeysCachePluggable.ts +1 -1
  203. package/src/storages/pluggable/inMemoryWrapper.ts +1 -1
  204. package/src/storages/pluggable/index.ts +1 -1
  205. package/src/storages/pluggable/wrapperAdapter.ts +2 -2
  206. package/src/storages/types.ts +51 -68
  207. package/src/storages/utils.ts +3 -2
  208. package/src/sync/offline/splitsParser/splitsParserFromSettings.ts +3 -3
  209. package/src/sync/offline/syncManagerOffline.ts +1 -1
  210. package/src/sync/polling/updaters/mySegmentsUpdater.ts +3 -3
  211. package/src/sync/polling/updaters/segmentChangesUpdater.ts +8 -8
  212. package/src/sync/polling/updaters/splitChangesUpdater.ts +13 -13
  213. package/src/sync/streaming/AuthClient/index.ts +2 -2
  214. package/src/sync/streaming/SSEClient/index.ts +4 -7
  215. package/src/sync/streaming/SSEHandler/NotificationKeeper.ts +1 -1
  216. package/src/sync/streaming/SSEHandler/NotificationParser.ts +5 -4
  217. package/src/sync/streaming/SSEHandler/index.ts +2 -2
  218. package/src/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.ts +3 -3
  219. package/src/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.ts +2 -2
  220. package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +4 -4
  221. package/src/sync/streaming/parseUtils.ts +13 -13
  222. package/src/sync/streaming/types.ts +2 -2
  223. package/src/sync/submitters/impressionsSubmitter.ts +2 -2
  224. package/src/sync/submitters/telemetrySubmitter.ts +4 -3
  225. package/src/sync/submitters/types.ts +1 -1
  226. package/src/sync/syncManagerOnline.ts +2 -2
  227. package/src/sync/syncTask.ts +4 -4
  228. package/src/trackers/eventTracker.ts +4 -3
  229. package/src/trackers/impressionObserver/ImpressionObserver.ts +4 -4
  230. package/src/trackers/impressionObserver/buildKey.ts +2 -2
  231. package/src/trackers/impressionObserver/impressionObserverCS.ts +2 -2
  232. package/src/trackers/impressionObserver/impressionObserverSS.ts +2 -2
  233. package/src/trackers/impressionObserver/types.ts +2 -2
  234. package/src/trackers/impressionsTracker.ts +8 -7
  235. package/src/trackers/strategy/strategyDebug.ts +3 -3
  236. package/src/trackers/strategy/strategyNone.ts +4 -4
  237. package/src/trackers/strategy/strategyOptimized.ts +5 -5
  238. package/src/trackers/types.ts +5 -5
  239. package/src/trackers/uniqueKeysTracker.ts +3 -3
  240. package/src/types.ts +37 -1355
  241. package/src/utils/Backoff.ts +0 -4
  242. package/src/utils/MinEventEmitter.ts +2 -3
  243. package/src/utils/MinEvents.ts +2 -2
  244. package/src/utils/Semver.ts +1 -1
  245. package/src/utils/base64/index.ts +2 -2
  246. package/src/utils/constants/index.ts +9 -10
  247. package/src/utils/decompress/index.ts +4 -4
  248. package/src/utils/inputValidation/attributes.ts +1 -1
  249. package/src/utils/inputValidation/eventProperties.ts +1 -1
  250. package/src/utils/inputValidation/key.ts +1 -1
  251. package/src/utils/inputValidation/preloadedData.ts +1 -2
  252. package/src/utils/inputValidation/trafficTypeExistence.ts +2 -2
  253. package/src/utils/key/index.ts +1 -1
  254. package/src/utils/lang/binarySearch.ts +2 -2
  255. package/src/utils/murmur3/murmur3_128.ts +1 -1
  256. package/src/utils/murmur3/murmur3_128_x86.ts +1 -1
  257. package/src/utils/murmur3/murmur3_64.ts +1 -1
  258. package/src/utils/murmur3/utfx.ts +10 -17
  259. package/src/utils/promise/wrapper.ts +2 -2
  260. package/src/utils/settingsValidation/consent.ts +2 -2
  261. package/src/utils/settingsValidation/impressionsMode.ts +1 -1
  262. package/src/utils/settingsValidation/index.ts +2 -2
  263. package/src/utils/settingsValidation/integrations/common.ts +4 -4
  264. package/src/utils/settingsValidation/integrations/configurable.ts +3 -3
  265. package/src/utils/settingsValidation/integrations/pluggable.ts +2 -2
  266. package/src/utils/settingsValidation/logger/builtinLogger.ts +3 -3
  267. package/src/utils/settingsValidation/logger/commons.ts +3 -3
  268. package/src/utils/settingsValidation/logger/pluggableLogger.ts +3 -3
  269. package/src/utils/settingsValidation/splitFilters.ts +9 -12
  270. package/src/utils/settingsValidation/storage/storageCS.ts +5 -4
  271. package/src/utils/settingsValidation/url.ts +3 -3
  272. package/types/splitio.d.ts +1019 -1381
@@ -1,4 +1,5 @@
1
- import { IEventEmitter, IStatusInterface } from '../types';
1
+ import { IStatusInterface } from '../types';
2
+ import SplitIO from '../../types/splitio';
2
3
 
3
4
  /** Splits data emitter */
4
5
 
@@ -6,7 +7,7 @@ type SDK_SPLITS_ARRIVED = 'state::splits-arrived'
6
7
  type SDK_SPLITS_CACHE_LOADED = 'state::splits-cache-loaded'
7
8
  type ISplitsEvent = SDK_SPLITS_ARRIVED | SDK_SPLITS_CACHE_LOADED
8
9
 
9
- export interface ISplitsEventEmitter extends IEventEmitter {
10
+ export interface ISplitsEventEmitter extends SplitIO.IEventEmitter {
10
11
  emit(event: ISplitsEvent, ...args: any[]): boolean
11
12
  on(event: ISplitsEvent, listener: (...args: any[]) => void): this;
12
13
  once(event: ISplitsEvent, listener: (...args: any[]) => void): this;
@@ -21,7 +22,7 @@ export interface ISplitsEventEmitter extends IEventEmitter {
21
22
  type SDK_SEGMENTS_ARRIVED = 'state::segments-arrived'
22
23
  type ISegmentsEvent = SDK_SEGMENTS_ARRIVED
23
24
 
24
- export interface ISegmentsEventEmitter extends IEventEmitter {
25
+ export interface ISegmentsEventEmitter extends SplitIO.IEventEmitter {
25
26
  emit(event: ISegmentsEvent, ...args: any[]): boolean
26
27
  on(event: ISegmentsEvent, listener: (...args: any[]) => void): this;
27
28
  once(event: ISegmentsEvent, listener: (...args: any[]) => void): this;
@@ -37,7 +38,7 @@ export type SDK_UPDATE = 'state::update'
37
38
  export type SDK_DESTROY = 'state::destroy'
38
39
  export type IReadinessEvent = SDK_READY_TIMED_OUT | SDK_READY | SDK_READY_FROM_CACHE | SDK_UPDATE | SDK_DESTROY
39
40
 
40
- export interface IReadinessEventEmitter extends IEventEmitter {
41
+ export interface IReadinessEventEmitter extends SplitIO.IEventEmitter {
41
42
  emit(event: IReadinessEvent, ...args: any[]): boolean
42
43
  }
43
44
 
@@ -6,7 +6,7 @@ import { validateTrafficTypeExistence } from '../utils/inputValidation/trafficTy
6
6
  import { SDK_NOT_READY } from '../utils/labels';
7
7
  import { CONTROL, TREATMENT, TREATMENTS, TREATMENT_WITH_CONFIG, TREATMENTS_WITH_CONFIG, TRACK, TREATMENTS_WITH_CONFIG_BY_FLAGSETS, TREATMENTS_BY_FLAGSETS, TREATMENTS_BY_FLAGSET, TREATMENTS_WITH_CONFIG_BY_FLAGSET, GET_TREATMENTS_WITH_CONFIG, GET_TREATMENTS_BY_FLAG_SETS, GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SETS, GET_TREATMENTS_BY_FLAG_SET, GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SET, GET_TREATMENT_WITH_CONFIG, GET_TREATMENT, GET_TREATMENTS, TRACK_FN_LABEL } from '../utils/constants';
8
8
  import { IEvaluationResult } from '../evaluator/types';
9
- import { SplitIO, ImpressionDTO } from '../types';
9
+ import SplitIO from '../../types/splitio';
10
10
  import { IMPRESSION, IMPRESSION_QUEUEING } from '../logger/constants';
11
11
  import { ISdkFactoryContext } from '../sdkFactory/types';
12
12
  import { isConsumerMode } from '../utils/settingsValidation/mode';
@@ -34,7 +34,7 @@ export function clientFactory(params: ISdkFactoryContext): SplitIO.IClient | Spl
34
34
  const stopTelemetryTracker = telemetryTracker.trackEval(withConfig ? TREATMENT_WITH_CONFIG : TREATMENT);
35
35
 
36
36
  const wrapUp = (evaluationResult: IEvaluationResult) => {
37
- const queue: ImpressionDTO[] = [];
37
+ const queue: SplitIO.ImpressionDTO[] = [];
38
38
  const treatment = processEvaluation(evaluationResult, featureFlagName, key, attributes, withConfig, methodName, queue);
39
39
  impressionsTracker.track(queue, attributes);
40
40
 
@@ -59,7 +59,7 @@ export function clientFactory(params: ISdkFactoryContext): SplitIO.IClient | Spl
59
59
  const stopTelemetryTracker = telemetryTracker.trackEval(withConfig ? TREATMENTS_WITH_CONFIG : TREATMENTS);
60
60
 
61
61
  const wrapUp = (evaluationResults: Record<string, IEvaluationResult>) => {
62
- const queue: ImpressionDTO[] = [];
62
+ const queue: SplitIO.ImpressionDTO[] = [];
63
63
  const treatments: Record<string, SplitIO.Treatment | SplitIO.TreatmentWithConfig> = {};
64
64
  Object.keys(evaluationResults).forEach(featureFlagName => {
65
65
  treatments[featureFlagName] = processEvaluation(evaluationResults[featureFlagName], featureFlagName, key, attributes, withConfig, methodName, queue);
@@ -87,7 +87,7 @@ export function clientFactory(params: ISdkFactoryContext): SplitIO.IClient | Spl
87
87
  const stopTelemetryTracker = telemetryTracker.trackEval(method);
88
88
 
89
89
  const wrapUp = (evaluationResults: Record<string, IEvaluationResult>) => {
90
- const queue: ImpressionDTO[] = [];
90
+ const queue: SplitIO.ImpressionDTO[] = [];
91
91
  const treatments: Record<string, SplitIO.Treatment | SplitIO.TreatmentWithConfig> = {};
92
92
  const evaluations = evaluationResults;
93
93
  Object.keys(evaluations).forEach(featureFlagName => {
@@ -128,7 +128,7 @@ export function clientFactory(params: ISdkFactoryContext): SplitIO.IClient | Spl
128
128
  attributes: SplitIO.Attributes | undefined,
129
129
  withConfig: boolean,
130
130
  invokingMethodName: string,
131
- queue: ImpressionDTO[]
131
+ queue: SplitIO.ImpressionDTO[]
132
132
  ): SplitIO.Treatment | SplitIO.TreatmentWithConfig {
133
133
  const matchingKey = getMatching(key);
134
134
  const bucketingKey = getBucketing(key);
@@ -199,6 +199,5 @@ export function clientFactory(params: ISdkFactoryContext): SplitIO.IClient | Spl
199
199
  getTreatmentsByFlagSet,
200
200
  getTreatmentsWithConfigByFlagSet,
201
201
  track,
202
- isClientSide: false
203
202
  } as SplitIO.IClient | SplitIO.IAsyncClient;
204
203
  }
@@ -1,6 +1,6 @@
1
1
  import { AttributesCacheInMemory } from '../storages/inMemory/AttributesCacheInMemory';
2
2
  import { validateAttributesDeep } from '../utils/inputValidation/attributes';
3
- import { SplitIO } from '../types';
3
+ import SplitIO from '../../types/splitio';
4
4
  import { ILogger } from '../logger/types';
5
5
  import { objectAssign } from '../utils/lang/objectAssign';
6
6
 
@@ -80,9 +80,9 @@ export function clientAttributesDecoration<TClient extends SplitIO.IClient | Spl
80
80
  /**
81
81
  * Add an attribute to client's in memory attributes storage
82
82
  *
83
- * @param {string} attributeName Attrinute name
84
- * @param {string, number, boolean, list} attributeValue Attribute value
85
- * @returns {boolean} true if the attribute was stored and false otherways
83
+ * @param attributeName - Attribute name
84
+ * @param attributeValue - Attribute value
85
+ * @returns true if the attribute was stored and false otherways
86
86
  */
87
87
  setAttribute(attributeName: string, attributeValue: SplitIO.AttributeType) {
88
88
  const attribute: Record<string, Object> = {};
@@ -95,8 +95,8 @@ export function clientAttributesDecoration<TClient extends SplitIO.IClient | Spl
95
95
  /**
96
96
  * Returns the attribute with the given name
97
97
  *
98
- * @param {string} attributeName Attribute name
99
- * @returns {Object} Attribute with the given name
98
+ * @param attributeName - Attribute name
99
+ * @returns Attribute with the given name
100
100
  */
101
101
  getAttribute(attributeName: string) {
102
102
  log.debug(`retrieved attribute ${attributeName}`);
@@ -106,7 +106,7 @@ export function clientAttributesDecoration<TClient extends SplitIO.IClient | Spl
106
106
  /**
107
107
  * Add to client's in memory attributes storage the attributes in 'attributes'
108
108
  *
109
- * @param {Object} attributes Object with attributes to store
109
+ * @param attributes - Object with attributes to store
110
110
  * @returns true if attributes were stored an false otherways
111
111
  */
112
112
  setAttributes(attributes: Record<string, Object>) {
@@ -117,7 +117,7 @@ export function clientAttributesDecoration<TClient extends SplitIO.IClient | Spl
117
117
  /**
118
118
  * Return all the attributes stored in client's in memory attributes storage
119
119
  *
120
- * @returns {Object} returns all the stored attributes
120
+ * @returns returns all the stored attributes
121
121
  */
122
122
  getAttributes() {
123
123
  return attributeStorage.getAll();
@@ -126,8 +126,8 @@ export function clientAttributesDecoration<TClient extends SplitIO.IClient | Spl
126
126
  /**
127
127
  * Removes from client's in memory attributes storage the attribute with the given name
128
128
  *
129
- * @param {string} attributeName
130
- * @returns {boolean} true if attribute was removed and false otherways
129
+ * @param attributeName - Attribute name
130
+ * @returns true if attribute was removed and false otherways
131
131
  */
132
132
  removeAttribute(attributeName: string) {
133
133
  log.debug(`removed attribute ${attributeName}`);
@@ -1,16 +1,16 @@
1
1
  import { objectAssign } from '../utils/lang/objectAssign';
2
2
  import { ILogger } from '../logger/types';
3
- import { SplitIO } from '../types';
3
+ import SplitIO from '../../types/splitio';
4
4
  import { clientAttributesDecoration } from './clientAttributesDecoration';
5
5
 
6
6
 
7
7
  /**
8
8
  * Decorator that binds a key to client methods
9
9
  *
10
- * @param client sync client instance
11
- * @param key validated split key
10
+ * @param client - sync client instance
11
+ * @param key - validated split key
12
12
  */
13
- export function clientCSDecorator(log: ILogger, client: SplitIO.IClient, key: SplitIO.SplitKey): SplitIO.ICsClient {
13
+ export function clientCSDecorator(log: ILogger, client: SplitIO.IClient, key: SplitIO.SplitKey): SplitIO.IBrowserClient {
14
14
 
15
15
  let clientCS = clientAttributesDecoration(log, client);
16
16
 
@@ -30,5 +30,5 @@ export function clientCSDecorator(log: ILogger, client: SplitIO.IClient, key: Sp
30
30
  // Not part of the public API. These properties are used to support other modules (e.g., Split Suite)
31
31
  isClientSide: true,
32
32
  key
33
- }) as SplitIO.ICsClient;
33
+ }) as SplitIO.IBrowserClient;
34
34
  }
@@ -15,7 +15,8 @@ import { startsWith } from '../utils/lang';
15
15
  import { CONTROL, CONTROL_WITH_CONFIG, GET_TREATMENT, GET_TREATMENTS, GET_TREATMENTS_BY_FLAG_SET, GET_TREATMENTS_BY_FLAG_SETS, GET_TREATMENTS_WITH_CONFIG, GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SET, GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SETS, GET_TREATMENT_WITH_CONFIG, TRACK_FN_LABEL } from '../utils/constants';
16
16
  import { IReadinessManager } from '../readiness/types';
17
17
  import { MaybeThenable } from '../dtos/types';
18
- import { ISettings, SplitIO } from '../types';
18
+ import { ISettings } from '../types';
19
+ import SplitIO from '../../types/splitio';
19
20
  import { isConsumerMode } from '../utils/settingsValidation/mode';
20
21
  import { validateFlagSets } from '../utils/settingsValidation/splitFilters';
21
22
 
@@ -1,4 +1,4 @@
1
- import { SplitIO } from '../types';
1
+ import SplitIO from '../../types/splitio';
2
2
 
3
3
  export function buildInstanceId(key: SplitIO.SplitKey, trafficType?: string) { // @ts-ignore
4
4
  return `${key.matchingKey ? key.matchingKey : key}-${key.bucketingKey ? key.bucketingKey : key}-${trafficType ? trafficType : ''}`;
@@ -1,5 +1,5 @@
1
1
  import { objectAssign } from '../utils/lang/objectAssign';
2
- import { IStatusInterface, SplitIO } from '../types';
2
+ import SplitIO from '../../types/splitio';
3
3
  import { releaseApiKey } from '../utils/inputValidation/apiKey';
4
4
  import { clientFactory } from './client';
5
5
  import { clientInputValidationDecorator } from './clientInputValidation';
@@ -37,7 +37,7 @@ export function sdkClientFactory(params: ISdkFactoryContext, isSharedClient?: bo
37
37
 
38
38
  return objectAssign(
39
39
  // Proto-linkage of the readiness Event Emitter
40
- Object.create(sdkReadinessManager.sdkStatus) as IStatusInterface,
40
+ Object.create(sdkReadinessManager.sdkStatus) as SplitIO.IStatusInterface,
41
41
 
42
42
  // Client API (getTreatment* & track methods)
43
43
  clientInputValidationDecorator(
@@ -1,4 +1,4 @@
1
- import { SplitIO } from '../types';
1
+ import SplitIO from '../../types/splitio';
2
2
  import { sdkClientFactory } from './sdkClient';
3
3
  import { RETRIEVE_CLIENT_DEFAULT } from '../logger/constants';
4
4
  import { ISdkFactoryContext } from '../sdkFactory/types';
@@ -1,5 +1,5 @@
1
1
  import { clientCSDecorator } from './clientCS';
2
- import { SplitIO } from '../types';
2
+ import SplitIO from '../../types/splitio';
3
3
  import { validateKey } from '../utils/inputValidation/key';
4
4
  import { getMatching, keyParser } from '../utils/key';
5
5
  import { sdkClientFactory } from './sdkClient';
@@ -14,7 +14,7 @@ import { buildInstanceId } from './identity';
14
14
  * Factory of client method for the client-side API variant where TT is ignored.
15
15
  * Therefore, clients don't have a bound TT for the track method.
16
16
  */
17
- export function sdkClientMethodCSFactory(params: ISdkFactoryContext): (key?: SplitIO.SplitKey) => SplitIO.ICsClient {
17
+ export function sdkClientMethodCSFactory(params: ISdkFactoryContext): (key?: SplitIO.SplitKey) => SplitIO.IBrowserClient {
18
18
  const { clients, storage, syncManager, sdkReadinessManager, settings: { core: { key }, log } } = params;
19
19
 
20
20
  const mainClientInstance = clientCSDecorator(
@@ -80,6 +80,6 @@ export function sdkClientMethodCSFactory(params: ISdkFactoryContext): (key?: Spl
80
80
  log.debug(RETRIEVE_CLIENT_EXISTING);
81
81
  }
82
82
 
83
- return clients[instanceId] as SplitIO.ICsClient;
83
+ return clients[instanceId] as SplitIO.IBrowserClient;
84
84
  };
85
85
  }
@@ -3,7 +3,7 @@ import { sdkReadinessManagerFactory } from '../readiness/sdkReadinessManager';
3
3
  import { impressionsTrackerFactory } from '../trackers/impressionsTracker';
4
4
  import { eventTrackerFactory } from '../trackers/eventTracker';
5
5
  import { telemetryTrackerFactory } from '../trackers/telemetryTracker';
6
- import { IBasicClient, SplitIO } from '../types';
6
+ import SplitIO from '../../types/splitio';
7
7
  import { validateAndTrackApiKey } from '../utils/inputValidation/apiKey';
8
8
  import { createLoggerAPI } from '../logger/sdkLogger';
9
9
  import { NEW_FACTORY, RETRIEVE_MANAGER } from '../logger/constants';
@@ -18,7 +18,7 @@ import { NONE, OPTIMIZED } from '../utils/constants';
18
18
  /**
19
19
  * Modular SDK factory
20
20
  */
21
- export function sdkFactory(params: ISdkFactoryParams): SplitIO.ICsSDK | SplitIO.ISDK | SplitIO.IAsyncSDK {
21
+ export function sdkFactory(params: ISdkFactoryParams): SplitIO.ISDK | SplitIO.IAsyncSDK | SplitIO.IBrowserSDK | SplitIO.IBrowserAsyncSDK {
22
22
 
23
23
  const { settings, platform, storageFactory, splitApiFactory, extraProps,
24
24
  syncManagerFactory, SignalListener, impressionsObserverFactory,
@@ -54,7 +54,7 @@ export function sdkFactory(params: ISdkFactoryParams): SplitIO.ICsSDK | SplitIO.
54
54
  },
55
55
  });
56
56
  // @TODO add support for dataloader: `if (params.dataLoader) params.dataLoader(storage);`
57
- const clients: Record<string, IBasicClient> = {};
57
+ const clients: Record<string, SplitIO.IBasicClient> = {};
58
58
  const telemetryTracker = telemetryTrackerFactory(storage.telemetry, platform.now);
59
59
  const integrationsManager = integrationsManagerFactory && integrationsManagerFactory({ settings, storage, telemetryTracker });
60
60
 
@@ -8,7 +8,8 @@ import { IStorageAsync, IStorageSync, IStorageFactoryParams } from '../storages/
8
8
  import { ISyncManager } from '../sync/types';
9
9
  import { IImpressionObserver } from '../trackers/impressionObserver/types';
10
10
  import { IImpressionsTracker, IEventTracker, ITelemetryTracker, IFilterAdapter, IUniqueKeysTracker } from '../trackers/types';
11
- import { SplitIO, ISettings, IEventEmitter, IBasicClient } from '../types';
11
+ import { ISettings } from '../types';
12
+ import SplitIO from '../../types/splitio';
12
13
 
13
14
  /**
14
15
  * Environment related dependencies.
@@ -29,7 +30,7 @@ export interface IPlatform {
29
30
  /**
30
31
  * EventEmitter constructor, like NodeJS.EventEmitter or a polyfill.
31
32
  */
32
- EventEmitter: new () => IEventEmitter,
33
+ EventEmitter: new () => SplitIO.IEventEmitter,
33
34
  /**
34
35
  * Function used to track latencies for telemetry.
35
36
  */
@@ -49,7 +50,7 @@ export interface ISdkFactoryContext {
49
50
  signalListener?: ISignalListener
50
51
  splitApi?: ISplitApi
51
52
  syncManager?: ISyncManager,
52
- clients: Record<string, IBasicClient>,
53
+ clients: Record<string, SplitIO.IBasicClient>,
53
54
  }
54
55
 
55
56
  export interface ISdkFactoryContextSync extends ISdkFactoryContext {
@@ -78,7 +79,7 @@ export interface ISdkFactoryParams {
78
79
  platform: IPlatform,
79
80
 
80
81
  // Storage factory. The result storage type implies the type of the SDK:
81
- // sync SDK (`ISDK` or `ICsSDK`) with `IStorageSync`, and async SDK (`IAsyncSDK`) with `IStorageAsync`
82
+ // sync SDK (`IBrowserSDK` and `ISDK`) with `IStorageSync`, and async SDK (`IBrowserAsyncSDK` and `IAsyncSDK`) with `IStorageAsync`
82
83
  storageFactory: (params: IStorageFactoryParams) => IStorageSync | IStorageAsync,
83
84
 
84
85
  // Factory of Split Api (HTTP Client Service).
@@ -93,9 +94,9 @@ export interface ISdkFactoryParams {
93
94
  // Sdk manager factory
94
95
  sdkManagerFactory: typeof sdkManagerFactory,
95
96
 
96
- // Sdk client method factory (ISDK::client method).
97
- // It Allows to distinguish SDK clients with the client-side API (`ICsSDK`) or server-side API (`ISDK` or `IAsyncSDK`).
98
- sdkClientMethodFactory: (params: ISdkFactoryContext) => ({ (): SplitIO.ICsClient; (key: SplitIO.SplitKey): SplitIO.ICsClient; } | (() => SplitIO.IClient) | (() => SplitIO.IAsyncClient))
97
+ // Sdk client method factory.
98
+ // It Allows to distinguish SDK clients with the client-side API (`IBrowserSDK` and `IBrowserAsyncSDK`) or server-side API (`ISDK` and `IAsyncSDK`).
99
+ sdkClientMethodFactory: (params: ISdkFactoryContext) => ({ (): SplitIO.IBrowserClient; (key: SplitIO.SplitKey): SplitIO.IBrowserClient; } | (() => SplitIO.IClient) | (() => SplitIO.IAsyncClient))
99
100
 
100
101
  // Impression observer factory.
101
102
  impressionsObserverFactory: () => IImpressionObserver
@@ -5,7 +5,8 @@ import { validateSplit, validateSplitExistence, validateIfNotDestroyed, validate
5
5
  import { ISplitsCacheAsync, ISplitsCacheSync } from '../storages/types';
6
6
  import { ISdkReadinessManager } from '../readiness/types';
7
7
  import { ISplit } from '../dtos/types';
8
- import { ISettings, SplitIO } from '../types';
8
+ import { ISettings } from '../types';
9
+ import SplitIO from '../../types/splitio';
9
10
  import { isConsumerMode } from '../utils/settingsValidation/mode';
10
11
  import { SPLIT_FN_LABEL, SPLITS_FN_LABEL, NAMES_FN_LABEL } from '../utils/constants';
11
12
 
@@ -16,9 +16,9 @@ function userKeyToQueryParam(userKey: string) {
16
16
  /**
17
17
  * Factory of SplitApi objects, which group the collection of Split HTTP endpoints used by the SDK
18
18
  *
19
- * @param settings validated settings object
20
- * @param platform object containing environment-specific dependencies
21
- * @param telemetryTracker telemetry tracker
19
+ * @param settings - validated settings object
20
+ * @param platform - object containing environment-specific dependencies
21
+ * @param telemetryTracker - telemetry tracker
22
22
  */
23
23
  export function splitApiFactory(
24
24
  settings: ISettings,
@@ -81,8 +81,8 @@ export function splitApiFactory(
81
81
  /**
82
82
  * Post events.
83
83
  *
84
- * @param body Events bulk payload
85
- * @param headers Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
84
+ * @param body - Events bulk payload
85
+ * @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
86
86
  */
87
87
  postEventsBulk(body: string, headers?: Record<string, string>) {
88
88
  const url = `${urls.events}/events/bulk`;
@@ -92,8 +92,8 @@ export function splitApiFactory(
92
92
  /**
93
93
  * Post impressions.
94
94
  *
95
- * @param body Impressions bulk payload
96
- * @param headers Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
95
+ * @param body - Impressions bulk payload
96
+ * @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
97
97
  */
98
98
  postTestImpressionsBulk(body: string, headers?: Record<string, string>) {
99
99
  const url = `${urls.events}/testImpressions/bulk`;
@@ -106,8 +106,8 @@ export function splitApiFactory(
106
106
  /**
107
107
  * Post impressions counts.
108
108
  *
109
- * @param body Impressions counts payload
110
- * @param headers Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
109
+ * @param body - Impressions counts payload
110
+ * @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
111
111
  */
112
112
  postTestImpressionsCount(body: string, headers?: Record<string, string>) {
113
113
  const url = `${urls.events}/testImpressions/count`;
@@ -117,8 +117,8 @@ export function splitApiFactory(
117
117
  /**
118
118
  * Post unique keys for client side.
119
119
  *
120
- * @param body unique keys payload
121
- * @param headers Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
120
+ * @param body - unique keys payload
121
+ * @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
122
122
  */
123
123
  postUniqueKeysBulkCs(body: string, headers?: Record<string, string>) {
124
124
  const url = `${urls.telemetry}/v1/keys/cs`;
@@ -128,8 +128,8 @@ export function splitApiFactory(
128
128
  /**
129
129
  * Post unique keys for server side.
130
130
  *
131
- * @param body unique keys payload
132
- * @param headers Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
131
+ * @param body - unique keys payload
132
+ * @param headers - Optionals headers to overwrite default ones. For example, it is used in producer mode to overwrite metadata headers.
133
133
  */
134
134
  postUniqueKeysBulkSs(body: string, headers?: Record<string, string>) {
135
135
  const url = `${urls.telemetry}/v1/keys/ss`;
@@ -10,8 +10,8 @@ const messageNoFetch = 'Global fetch API is not available.';
10
10
  /**
11
11
  * Factory of Split HTTP clients, which are HTTP clients with predefined headers for Split endpoints.
12
12
  *
13
- * @param settings SDK settings, used to access authorizationKey, logger instance and metadata (SDK version, ip and hostname) to set additional headers
14
- * @param platform object containing environment-specific dependencies
13
+ * @param settings - SDK settings, used to access authorizationKey, logger instance and metadata (SDK version, ip and hostname) to set additional headers
14
+ * @param platform - object containing environment-specific dependencies
15
15
  */
16
16
  export function splitHttpClientFactory(settings: ISettings, { getOptions, getFetch }: Pick<IPlatform, 'getOptions' | 'getFetch'>): ISplitHttpClient {
17
17
 
@@ -38,8 +38,8 @@ export abstract class AbstractMySegmentsCacheSync implements ISegmentsCacheSync
38
38
 
39
39
  /**
40
40
  * Only used for the `skC`(segment keys count) telemetry stat: 1 for client-side, and total count of keys in server-side.
41
- * @TODO for client-side it should be the number of clients, but it requires a refactor of MySegments caches to simplify the code.
42
41
  */
42
+ // @TODO for client-side it should be the number of clients, but it requires a refactor of MySegments caches to simplify the code.
43
43
  abstract getKeysCount(): number
44
44
 
45
45
  abstract getChangeNumber(name: string): number
@@ -39,10 +39,7 @@ export abstract class AbstractSplitsCacheAsync implements ISplitsCacheAsync {
39
39
  * Kill `name` split and set `defaultTreatment` and `changeNumber`.
40
40
  * Used for SPLIT_KILL push notifications.
41
41
  *
42
- * @param {string} name
43
- * @param {string} defaultTreatment
44
- * @param {number} changeNumber
45
- * @returns {Promise} a promise that is resolved once the split kill operation is performed. The fulfillment value is a boolean: `true` if the operation successed updating the split or `false` if no split is updated,
42
+ * @returns a promise that is resolved once the split kill operation is performed. The fulfillment value is a boolean: `true` if the operation successed updating the split or `false` if no split is updated,
46
43
  * for instance, if the `changeNumber` is old, or if the split is not found (e.g., `/splitchanges` hasn't been fetched yet), or if the storage fails to apply the update.
47
44
  * The promise will never be rejected.
48
45
  */
@@ -59,10 +59,7 @@ export abstract class AbstractSplitsCacheSync implements ISplitsCacheSync {
59
59
  * Kill `name` split and set `defaultTreatment` and `changeNumber`.
60
60
  * Used for SPLIT_KILL push notifications.
61
61
  *
62
- * @param {string} name
63
- * @param {string} defaultTreatment
64
- * @param {number} changeNumber
65
- * @returns {boolean} `true` if the operation successed updating the split, or `false` if no split is updated,
62
+ * @returns `true` if the operation successed updating the split, or `false` if no split is updated,
66
63
  * for instance, if the `changeNumber` is old, or if the split is not found (e.g., `/splitchanges` hasn't been fetched yet), or if the storage fails to apply the update.
67
64
  */
68
65
  killLocally(name: string, defaultTreatment: string, changeNumber: number): boolean {
@@ -1,26 +1,25 @@
1
- import { SplitIO } from '../types';
1
+ import { PreloadedData } from '../types';
2
2
  import { DEFAULT_CACHE_EXPIRATION_IN_MILLIS } from '../utils/constants/browser';
3
3
  import { DataLoader, ISegmentsCacheSync, ISplitsCacheSync } from './types';
4
4
 
5
5
  /**
6
6
  * Factory of client-side storage loader
7
7
  *
8
- * @param preloadedData validated data following the format proposed in https://github.com/godaddy/split-javascript-data-loader
8
+ * @param preloadedData - validated data following the format proposed in https://github.com/godaddy/split-javascript-data-loader
9
9
  * and extended with a `mySegmentsData` property.
10
10
  * @returns function to preload the storage
11
11
  */
12
- export function dataLoaderFactory(preloadedData: SplitIO.PreloadedData): DataLoader {
12
+ export function dataLoaderFactory(preloadedData: PreloadedData): DataLoader {
13
13
 
14
14
  /**
15
15
  * Storage-agnostic adaptation of `loadDataIntoLocalStorage` function
16
16
  * (https://github.com/godaddy/split-javascript-data-loader/blob/master/src/load-data.js)
17
17
  *
18
- * @param storage object containing `splits` and `segments` cache (client-side variant)
19
- * @param userId user key string of the provided MySegmentsCache
20
- *
21
- * @TODO extend to support SegmentsCache (server-side variant) by making `userId` optional and adding the corresponding logic.
22
- * @TODO extend to load data on shared mySegments storages. Be specific when emitting SDK_READY_FROM_CACHE on shared clients. Maybe the serializer should provide the `useSegments` flag.
18
+ * @param storage - object containing `splits` and `segments` cache (client-side variant)
19
+ * @param userId - user key string of the provided MySegmentsCache
23
20
  */
21
+ // @TODO extend to support SegmentsCache (server-side variant) by making `userId` optional and adding the corresponding logic.
22
+ // @TODO extend to load data on shared mySegments storages. Be specific when emitting SDK_READY_FROM_CACHE on shared clients. Maybe the serializer should provide the `useSegments` flag.
24
23
  return function loadData(storage: { splits: ISplitsCacheSync, segments: ISegmentsCacheSync }, userId: string) {
25
24
  // Do not load data if current preloadedData is empty
26
25
  if (Object.keys(preloadedData).length === 0) return;
@@ -7,7 +7,7 @@ const BASE = 1.5;
7
7
  /**
8
8
  * Calculates buckets from latency in milliseconds
9
9
  *
10
- * @param latencyInMs
10
+ * @param latencyInMs - latency in milliseconds
11
11
  * @returns a bucket index from 0 to 22 inclusive
12
12
  */
13
13
  export function findLatencyIndex(latencyInMs: number): number {
@@ -20,11 +20,6 @@ export class SplitsCacheInLocal extends AbstractSplitsCacheSync {
20
20
  private hasSync?: boolean;
21
21
  private updateNewFilter?: boolean;
22
22
 
23
- /**
24
- * @param {KeyBuilderCS} keys
25
- * @param {number | undefined} expirationTimestamp
26
- * @param {ISplitFiltersValidation} splitFiltersValidation
27
- */
28
23
  constructor(settings: ISettings, keys: KeyBuilderCS, expirationTimestamp?: number) {
29
24
  super();
30
25
  this.keys = keys;
@@ -229,7 +224,7 @@ export class SplitsCacheInLocal extends AbstractSplitsCacheSync {
229
224
  /**
230
225
  * Clean Splits cache if its `lastUpdated` timestamp is older than the given `expirationTimestamp`,
231
226
  *
232
- * @param {number | undefined} expirationTimestamp if the value is not a number, data will not be cleaned
227
+ * @param expirationTimestamp - if the value is not a number, data will not be cleaned
233
228
  */
234
229
  private _checkExpiration(expirationTimestamp?: number) {
235
230
  let value: string | number | null = localStorage.getItem(this.keys.buildLastUpdatedKey());
@@ -1,4 +1,4 @@
1
- import { SplitIO } from '../../types';
1
+ import SplitIO from '../../../types/splitio';
2
2
  import { objectAssign } from '../../utils/lang/objectAssign';
3
3
 
4
4
  export class AttributesCacheInMemory {
@@ -9,9 +9,9 @@ export class AttributesCacheInMemory {
9
9
  /**
10
10
  * Create or update the value for the given attribute
11
11
  *
12
- * @param {string} attributeName attribute name
13
- * @param {Object} attributeValue attribute value
14
- * @returns {boolean} the attribute was stored
12
+ * @param attributeName - attribute name
13
+ * @param attributeValue - attribute value
14
+ * @returns the attribute was stored
15
15
  */
16
16
  setAttribute(attributeName: string, attributeValue: SplitIO.AttributeType) {
17
17
  this.attributesCache[attributeName] = attributeValue;
@@ -21,8 +21,8 @@ export class AttributesCacheInMemory {
21
21
  /**
22
22
  * Retrieves the value of a given attribute
23
23
  *
24
- * @param {string} attributeName attribute name
25
- * @returns {Object?} stored attribute value
24
+ * @param attributeName - attribute name
25
+ * @returns stored attribute value
26
26
  */
27
27
  getAttribute(attributeName: string) {
28
28
  return this.attributesCache[attributeName];
@@ -31,8 +31,8 @@ export class AttributesCacheInMemory {
31
31
  /**
32
32
  * Create or update all the given attributes
33
33
  *
34
- * @param {[string, Object]} attributes attributes to create or update
35
- * @returns {boolean} attributes were stored
34
+ * @param attributes - attributes to create or update
35
+ * @returns attributes were stored
36
36
  */
37
37
  setAttributes(attributes: Record<string, Object>) {
38
38
  this.attributesCache = objectAssign(this.attributesCache, attributes);
@@ -42,7 +42,7 @@ export class AttributesCacheInMemory {
42
42
  /**
43
43
  * Retrieve the full attributes map
44
44
  *
45
- * @returns {Map<string, Object>} stored attributes
45
+ * @returns stored attributes
46
46
  */
47
47
  getAll() {
48
48
  return this.attributesCache;
@@ -51,8 +51,8 @@ export class AttributesCacheInMemory {
51
51
  /**
52
52
  * Removes a given attribute from the map
53
53
  *
54
- * @param {string} attributeName attribute to remove
55
- * @returns {boolean} attribute removed
54
+ * @param attributeName - attribute to remove
55
+ * @returns attribute removed
56
56
  */
57
57
  removeAttribute(attributeName: string) {
58
58
  if (Object.keys(this.attributesCache).indexOf(attributeName) >= 0) {
@@ -1,4 +1,4 @@
1
- import { SplitIO } from '../../types';
1
+ import SplitIO from '../../../types/splitio';
2
2
  import { IEventsCacheSync } from '../types';
3
3
 
4
4
  const MAX_QUEUE_BYTE_SIZE = 5 * 1024 * 1024; // 5M
@@ -12,7 +12,7 @@ export class EventsCacheInMemory implements IEventsCacheSync {
12
12
 
13
13
  /**
14
14
  *
15
- * @param eventsQueueSize number of queued events to call onFullQueueCb.
15
+ * @param eventsQueueSize - number of queued events to call onFullQueueCb.
16
16
  * Default value is 0, that means no maximum value, in case we want to avoid this being triggered.
17
17
  */
18
18
  constructor(eventsQueueSize: number = 0) {
@@ -1,15 +1,15 @@
1
1
  import { IImpressionsCacheSync } from '../types';
2
- import { ImpressionDTO } from '../../types';
2
+ import SplitIO from '../../../types/splitio';
3
3
 
4
4
  export class ImpressionsCacheInMemory implements IImpressionsCacheSync {
5
5
 
6
6
  private onFullQueue?: () => void;
7
7
  private readonly maxQueue: number;
8
- private queue: ImpressionDTO[];
8
+ private queue: SplitIO.ImpressionDTO[];
9
9
 
10
10
  /**
11
11
  *
12
- * @param impressionsQueueSize number of queued impressions to call onFullQueueCb.
12
+ * @param impressionsQueueSize - number of queued impressions to call onFullQueueCb.
13
13
  * Default value is 0, that means no maximum value, in case we want to avoid this being triggered.
14
14
  */
15
15
  constructor(impressionsQueueSize: number = 0) {
@@ -24,7 +24,7 @@ export class ImpressionsCacheInMemory implements IImpressionsCacheSync {
24
24
  /**
25
25
  * Store impressions in sequential order
26
26
  */
27
- track(data: ImpressionDTO[]) {
27
+ track(data: SplitIO.ImpressionDTO[]) {
28
28
  this.queue.push(...data);
29
29
 
30
30
  // Check if the cache queue is full and we need to flush it.
@@ -43,7 +43,7 @@ export class ImpressionsCacheInMemory implements IImpressionsCacheSync {
43
43
  /**
44
44
  * Pop the collected data, used as payload for posting.
45
45
  */
46
- pop(toMerge?: ImpressionDTO[]) {
46
+ pop(toMerge?: SplitIO.ImpressionDTO[]) {
47
47
  const data = this.queue;
48
48
  this.clear();
49
49
  return toMerge ? toMerge.concat(data) : data;
@@ -11,7 +11,7 @@ import { UniqueKeysCacheInMemory } from './UniqueKeysCacheInMemory';
11
11
  /**
12
12
  * InMemory storage factory for standalone server-side SplitFactory
13
13
  *
14
- * @param params parameters required by EventsCacheSync
14
+ * @param params - parameters required by EventsCacheSync
15
15
  */
16
16
  export function InMemoryStorageFactory(params: IStorageFactoryParams): IStorageSync {
17
17
  const { settings: { scheduler: { impressionsQueueSize, eventsQueueSize, }, sync: { impressionsMode, __splitFiltersValidation } } } = params;