@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
@@ -1,41 +0,0 @@
1
- import { ISegmentsCacheBase, ISplitsCacheBase } from '../../../storages/types';
2
- import { ISplitChangesFetcher } from '../fetchers/types';
3
- import { ISplit, ISplitFiltersValidation } from '../../../dtos/types';
4
- import { ISplitsEventEmitter } from '../../../readiness/types';
5
- import { ILogger } from '../../../logger/types';
6
- declare type ISplitChangesUpdater = (noCache?: boolean, till?: number, splitUpdateNotification?: {
7
- payload: ISplit;
8
- changeNumber: number;
9
- }) => Promise<boolean>;
10
- /**
11
- * Collect segments from a raw split definition.
12
- * Exported for testing purposes.
13
- */
14
- export declare function parseSegments({ conditions }: ISplit): Set<string>;
15
- interface ISplitMutations {
16
- added: [string, ISplit][];
17
- removed: string[];
18
- segments: string[];
19
- }
20
- /**
21
- * Given the list of splits from /splitChanges endpoint, it returns the mutations,
22
- * i.e., an object with added splits, removed splits and used segments.
23
- * Exported for testing purposes.
24
- */
25
- export declare function computeSplitsMutation(entries: ISplit[], filters: ISplitFiltersValidation): ISplitMutations;
26
- /**
27
- * factory of SplitChanges updater, a task that:
28
- * - fetches split changes using `splitChangesFetcher`
29
- * - updates `splitsCache`
30
- * - uses `splitsEventEmitter` to emit events related to split data updates
31
- *
32
- * @param log Logger instance
33
- * @param splitChangesFetcher Fetcher of `/splitChanges`
34
- * @param splits Splits storage, with sync or async methods
35
- * @param segments Segments storage, with sync or async methods
36
- * @param splitsEventEmitter Optional readiness manager. Not required for synchronizer or producer mode.
37
- * @param requestTimeoutBeforeReady How long the updater will wait for the request to timeout. Default 0, i.e., never timeout.
38
- * @param retriesOnFailureBeforeReady How many retries on `/splitChanges` we the updater do in case of failure or timeout. Default 0, i.e., no retries.
39
- */
40
- export declare function splitChangesUpdaterFactory(log: ILogger, splitChangesFetcher: ISplitChangesFetcher, splits: ISplitsCacheBase, segments: ISegmentsCacheBase, splitFiltersValidation: ISplitFiltersValidation, splitsEventEmitter?: ISplitsEventEmitter, requestTimeoutBeforeReady?: number, retriesOnFailureBeforeReady?: number, isClientSide?: boolean): ISplitChangesUpdater;
41
- export {};
@@ -1,12 +0,0 @@
1
- import { IFetchAuth } from '../../../services/types';
2
- import { IAuthenticate } from './types';
3
- /**
4
- * Factory of authentication function.
5
- *
6
- * @param fetchAuth `SplitAPI.fetchAuth` endpoint
7
- */
8
- export declare function authenticateFactory(fetchAuth: IFetchAuth): IAuthenticate;
9
- /**
10
- * Returns the hash of a given user key
11
- */
12
- export declare function hashUserKey(userKey: string): string;
@@ -1,17 +0,0 @@
1
- import { IDecodedJWTToken } from '../../../utils/jwt/types';
2
- export interface IAuthTokenPushEnabled {
3
- pushEnabled: true;
4
- token: string;
5
- decodedToken: IDecodedJWTToken;
6
- channels: {
7
- [channel: string]: string[];
8
- };
9
- connDelay?: number;
10
- }
11
- export interface IAuthTokenPushDisabled {
12
- pushEnabled: false;
13
- token: '';
14
- }
15
- export declare type IAuthToken = IAuthTokenPushDisabled | IAuthTokenPushEnabled;
16
- export declare type IAuthenticate = (userKeys?: string[]) => Promise<IAuthToken>;
17
- export declare type IAuthenticateV2 = (isClientSide?: boolean) => Promise<IAuthToken>;
@@ -1,34 +0,0 @@
1
- import { IPlatform } from '../../../sdkFactory/types';
2
- import { IEventSourceConstructor } from '../../../services/types';
3
- import { ISettings } from '../../../types';
4
- import { IAuthTokenPushEnabled } from '../AuthClient/types';
5
- import { ISSEClient, ISseEventHandler } from './types';
6
- /**
7
- * Handles streaming connections with EventSource API
8
- */
9
- export declare class SSEClient implements ISSEClient {
10
- private settings;
11
- eventSource?: IEventSourceConstructor;
12
- connection?: InstanceType<IEventSourceConstructor>;
13
- handler?: ISseEventHandler;
14
- headers: Record<string, string>;
15
- options?: object;
16
- /**
17
- * SSEClient constructor.
18
- *
19
- * @param settings Validated settings.
20
- * @param platform object containing environment-specific dependencies
21
- * @throws 'EventSource API is not available.' if EventSource is not available.
22
- */
23
- constructor(settings: ISettings, { getEventSource, getOptions }: IPlatform);
24
- setEventHandler(handler: ISseEventHandler): void;
25
- /**
26
- * Open the connection with a given authToken
27
- *
28
- * @param {IAuthTokenPushEnabled} authToken
29
- * @throws {TypeError} Will throw an error if `authToken` is undefined
30
- */
31
- open(authToken: IAuthTokenPushEnabled): void;
32
- /** Close connection */
33
- close(): void;
34
- }
@@ -1,11 +0,0 @@
1
- import { IAuthTokenPushEnabled } from '../AuthClient/types';
2
- export interface ISseEventHandler {
3
- handleError: (ev: Event) => any;
4
- handleMessage: (ev: MessageEvent) => any;
5
- handleOpen: () => any;
6
- }
7
- export interface ISSEClient {
8
- open(authToken: IAuthTokenPushEnabled): void;
9
- close(): void;
10
- setEventHandler(handler: ISseEventHandler): void;
11
- }
@@ -1,14 +0,0 @@
1
- import { ITelemetryTracker } from '../../../trackers/types';
2
- import { ControlType } from '../constants';
3
- import { IPushEventEmitter } from '../types';
4
- /**
5
- * Factory of notification keeper, which process OCCUPANCY and CONTROL notifications and emits the corresponding push events.
6
- *
7
- * @param pushEmitter emitter for events related to streaming support
8
- */
9
- export declare function notificationKeeperFactory(pushEmitter: IPushEventEmitter, telemetryTracker: ITelemetryTracker): {
10
- handleOpen(): void;
11
- isStreamingUp(): boolean;
12
- handleOccupancyEvent(publishers: number, channel: string, timestamp: number): void;
13
- handleControlEvent(controlType: ControlType, channel: string, timestamp: number): void;
14
- };
@@ -1,20 +0,0 @@
1
- import { INotificationMessage, INotificationError } from './types';
2
- /**
3
- * Parses the `data` JSON string, if exists, of a given SSE error notifications.
4
- * HTTP errors handled by Ably (e.g., 400 due to invalid token, 401 due to expired token, 500) have the `data` property.
5
- * Other network and HTTP errors do not have this property.
6
- *
7
- * @param {Object} error
8
- * @throws {SyntaxError} if `error.data` is an invalid JSON string
9
- */
10
- export declare function errorParser(error: Event): INotificationError;
11
- /**
12
- * Parses the `data` JSON string of a given SSE message notifications.
13
- * Also assigns the type OCCUPANCY, if it corresponds, so that all supported messages (e.g., SPLIT_UPDATE, CONTROL) have a type.
14
- *
15
- * @param message
16
- * @returns parsed notification message or undefined if the given event data is falsy (e.g, '' or undefined).
17
- * For example, the EventSource implementation of React-Native for iOS emits a message event with empty data for Ably keepalive comments.
18
- * @throws {SyntaxError} if `message.data` or `JSON.parse(message.data).data` are invalid JSON strings
19
- */
20
- export declare function messageParser(message: MessageEvent): INotificationMessage | undefined;
@@ -1,11 +0,0 @@
1
- import { IPushEventEmitter } from '../types';
2
- import { ISseEventHandler } from '../SSEClient/types';
3
- import { ILogger } from '../../../logger/types';
4
- import { ITelemetryTracker } from '../../../trackers/types';
5
- /**
6
- * Factory for SSEHandler, which processes SSEClient messages and emits the corresponding push events.
7
- *
8
- * @param log factory logger
9
- * @param pushEmitter emitter for events related to streaming support
10
- */
11
- export declare function SSEHandlerFactory(log: ILogger, pushEmitter: IPushEventEmitter, telemetryTracker: ITelemetryTracker): ISseEventHandler;
@@ -1,72 +0,0 @@
1
- import { ControlType } from '../constants';
2
- import { SEGMENT_UPDATE, SPLIT_UPDATE, SPLIT_KILL, CONTROL, OCCUPANCY, MEMBERSHIPS_LS_UPDATE, MEMBERSHIPS_MS_UPDATE } from '../types';
3
- export declare enum Compression {
4
- None = 0,
5
- Gzip = 1,
6
- Zlib = 2
7
- }
8
- export declare enum UpdateStrategy {
9
- UnboundedFetchRequest = 0,
10
- BoundedFetchRequest = 1,
11
- KeyList = 2,
12
- SegmentRemoval = 3
13
- }
14
- export interface KeyList {
15
- a?: string[];
16
- r?: string[];
17
- }
18
- interface IMembershipUpdateData<T extends string> {
19
- type: T;
20
- cn: number;
21
- n?: string[];
22
- c?: Compression;
23
- d?: string;
24
- u: UpdateStrategy;
25
- i?: number;
26
- h?: number;
27
- s?: number;
28
- }
29
- export interface IMembershipMSUpdateData extends IMembershipUpdateData<MEMBERSHIPS_MS_UPDATE> {
30
- }
31
- export interface IMembershipLSUpdateData extends IMembershipUpdateData<MEMBERSHIPS_LS_UPDATE> {
32
- }
33
- export interface ISegmentUpdateData {
34
- type: SEGMENT_UPDATE;
35
- changeNumber: number;
36
- segmentName: string;
37
- }
38
- export interface ISplitUpdateData {
39
- type: SPLIT_UPDATE;
40
- changeNumber: number;
41
- pcn?: number;
42
- d?: string;
43
- c?: Compression;
44
- }
45
- export interface ISplitKillData {
46
- type: SPLIT_KILL;
47
- changeNumber: number;
48
- splitName: string;
49
- defaultTreatment: string;
50
- }
51
- export interface IControlData {
52
- type: CONTROL;
53
- controlType: ControlType;
54
- }
55
- export interface IOccupancyData {
56
- type: OCCUPANCY;
57
- metrics: {
58
- publishers: number;
59
- };
60
- }
61
- export declare type INotificationData = IMembershipMSUpdateData | IMembershipLSUpdateData | ISegmentUpdateData | ISplitUpdateData | ISplitKillData | IControlData | IOccupancyData;
62
- export declare type INotificationMessage = {
63
- parsedData: INotificationData;
64
- channel: string;
65
- timestamp: number;
66
- data: string;
67
- };
68
- export declare type INotificationError = Event & {
69
- parsedData?: any;
70
- message?: string;
71
- };
72
- export {};
@@ -1,9 +0,0 @@
1
- import { IMySegmentsSyncTask, MySegmentsData } from '../../polling/types';
2
- import { IUpdateWorker } from './types';
3
- import { ITelemetryTracker } from '../../../trackers/types';
4
- import { IStorageSync } from '../../../storages/types';
5
- import { ILogger } from '../../../logger/types';
6
- /**
7
- * MySegmentsUpdateWorker factory
8
- */
9
- export declare function MySegmentsUpdateWorker(log: ILogger, storage: Pick<IStorageSync, 'segments' | 'largeSegments'>, mySegmentsSyncTask: IMySegmentsSyncTask, telemetryTracker: ITelemetryTracker): IUpdateWorker<[mySegmentsData?: Pick<MySegmentsData, 'type' | 'cn'>, payload?: Pick<MySegmentsData, 'added' | 'removed'>, delay?: number]>;
@@ -1,9 +0,0 @@
1
- import { ILogger } from '../../../logger/types';
2
- import { ISegmentsCacheSync } from '../../../storages/types';
3
- import { ISegmentsSyncTask } from '../../polling/types';
4
- import { ISegmentUpdateData } from '../SSEHandler/types';
5
- import { IUpdateWorker } from './types';
6
- /**
7
- * SegmentsUpdateWorker factory
8
- */
9
- export declare function SegmentsUpdateWorker(log: ILogger, segmentsSyncTask: ISegmentsSyncTask, segmentsCache: ISegmentsCacheSync): IUpdateWorker<[ISegmentUpdateData]>;
@@ -1,14 +0,0 @@
1
- import { ISplit } from '../../../dtos/types';
2
- import { ILogger } from '../../../logger/types';
3
- import { ISplitsEventEmitter } from '../../../readiness/types';
4
- import { ISplitsCacheSync } from '../../../storages/types';
5
- import { ITelemetryTracker } from '../../../trackers/types';
6
- import { ISegmentsSyncTask, ISplitsSyncTask } from '../../polling/types';
7
- import { ISplitKillData, ISplitUpdateData } from '../SSEHandler/types';
8
- import { IUpdateWorker } from './types';
9
- /**
10
- * SplitsUpdateWorker factory
11
- */
12
- export declare function SplitsUpdateWorker(log: ILogger, splitsCache: ISplitsCacheSync, splitsSyncTask: ISplitsSyncTask, splitsEventEmitter: ISplitsEventEmitter, telemetryTracker: ITelemetryTracker, segmentsSyncTask?: ISegmentsSyncTask): IUpdateWorker<[updateData: ISplitUpdateData, payload?: ISplit]> & {
13
- killSplit(event: ISplitKillData): void;
14
- };
@@ -1,3 +0,0 @@
1
- export declare const FETCH_BACKOFF_BASE = 10000;
2
- export declare const FETCH_BACKOFF_MAX_WAIT = 60000;
3
- export declare const FETCH_BACKOFF_MAX_RETRIES = 10;
@@ -1,4 +0,0 @@
1
- export interface IUpdateWorker<T extends any[]> {
2
- stop(): void;
3
- put(...args: T): void;
4
- }
@@ -1,34 +0,0 @@
1
- export declare const SECONDS_BEFORE_EXPIRATION = 600;
2
- /**
3
- * emitted on SSE and Authenticate non-recoverable errors, STREAMING_DISABLED control notification and authentication with pushEnabled false
4
- * triggers `handleNonRetryableError` call
5
- */
6
- export declare const PUSH_NONRETRYABLE_ERROR = "PUSH_NONRETRYABLE_ERROR";
7
- /**
8
- * emitted on SSE and Authenticate recoverable errors
9
- * triggers `handleRetryableError` call
10
- */
11
- export declare const PUSH_RETRYABLE_ERROR = "PUSH_RETRYABLE_ERROR";
12
- /**
13
- * emitted on STREAMING_RESUMED control notification, OCCUPANCY different than 0, and SSE onopen event
14
- * triggers `stopPollingAndSyncAll` call
15
- */
16
- export declare const PUSH_SUBSYSTEM_UP = "PUSH_SUBSYSTEM_UP";
17
- /**
18
- * emitted on STREAMING_PAUSED control notification, OCCUPANCY equal to 0, PUSH_NONRETRYABLE_ERROR and PUSH_RETRYABLE_ERROR events.
19
- * triggers `startPolling` and `stopWorkers` calls
20
- */
21
- export declare const PUSH_SUBSYSTEM_DOWN = "PUSH_SUBSYSTEM_DOWN";
22
- export declare const MEMBERSHIPS_MS_UPDATE = "MEMBERSHIPS_MS_UPDATE";
23
- export declare const MEMBERSHIPS_LS_UPDATE = "MEMBERSHIPS_LS_UPDATE";
24
- export declare const SEGMENT_UPDATE = "SEGMENT_UPDATE";
25
- export declare const SPLIT_KILL = "SPLIT_KILL";
26
- export declare const SPLIT_UPDATE = "SPLIT_UPDATE";
27
- export declare const CONTROL = "CONTROL";
28
- export declare const OCCUPANCY = "OCCUPANCY";
29
- export declare enum ControlType {
30
- STREAMING_DISABLED = "STREAMING_DISABLED",
31
- STREAMING_PAUSED = "STREAMING_PAUSED",
32
- STREAMING_RESUMED = "STREAMING_RESUMED",
33
- STREAMING_RESET = "STREAMING_RESET"
34
- }
@@ -1,34 +0,0 @@
1
- import { Compression, IMembershipMSUpdateData, KeyList } from './SSEHandler/types';
2
- import { ISplit } from '../../dtos/types';
3
- /**
4
- * Decode, decompress and parse the provided 'data' into a KeyList object
5
- *
6
- * @param {string} data
7
- * @param {number} compression
8
- * @param {boolean} avoidPrecisionLoss true as default, set it as false if dont need to avoid precission loss
9
- * @returns {{a?: string[], r?: string[] }}
10
- * @throws if data string cannot be decoded, decompressed or parsed
11
- */
12
- export declare function parseKeyList(data: string, compression: Compression, avoidPrecisionLoss?: boolean): KeyList;
13
- /**
14
- * Decode, decompress and parse the provided 'data' into a Bitmap object
15
- *
16
- * @param {string} data
17
- * @param {number} compression
18
- * @returns {Uint8Array}
19
- * @throws if data string cannot be decoded or decompressed
20
- */
21
- export declare function parseBitmap(data: string, compression: Compression): Uint8Array;
22
- /**
23
- * Check if the 'bitmap' bit at 'hash64hex' position is 1
24
- *
25
- * @param {Uint8Array} bitmap
26
- * @param {string} hash64hex 16-chars string, representing a number in hexa
27
- * @returns {boolean}
28
- */
29
- export declare function isInBitmap(bitmap: Uint8Array, hash64hex: string): boolean;
30
- /**
31
- * Parse feature flags notifications for instant feature flag updates
32
- */
33
- export declare function parseFFUpdatePayload(compression: Compression, data: string): ISplit | undefined;
34
- export declare function getDelay(parsedData: Pick<IMembershipMSUpdateData, 'i' | 'h' | 's'>, matchingKey: string): number;
@@ -1,9 +0,0 @@
1
- import { IPushManager } from './types';
2
- import { IPollingManager } from '../polling/types';
3
- import { ISdkFactoryContextSync } from '../../sdkFactory/types';
4
- /**
5
- * PushManager factory:
6
- * - for server-side if key is not provided in settings.
7
- * - for client-side, with support for multiple clients, if key is provided in settings
8
- */
9
- export declare function pushManagerFactory(params: ISdkFactoryContextSync, pollingManager: IPollingManager): IPushManager | undefined;
@@ -1,35 +0,0 @@
1
- import { IMembershipMSUpdateData, IMembershipLSUpdateData, ISegmentUpdateData, ISplitUpdateData, ISplitKillData, INotificationData } from './SSEHandler/types';
2
- import { ITask } from '../types';
3
- import { IMySegmentsSyncTask } from '../polling/types';
4
- import { IEventEmitter } from '../../types';
5
- import { ControlType } from './constants';
6
- export declare type PUSH_SUBSYSTEM_UP = 'PUSH_SUBSYSTEM_UP';
7
- export declare type PUSH_SUBSYSTEM_DOWN = 'PUSH_SUBSYSTEM_DOWN';
8
- export declare type PUSH_NONRETRYABLE_ERROR = 'PUSH_NONRETRYABLE_ERROR';
9
- export declare type PUSH_RETRYABLE_ERROR = 'PUSH_RETRYABLE_ERROR';
10
- export declare type MEMBERSHIPS_MS_UPDATE = 'MEMBERSHIPS_MS_UPDATE';
11
- export declare type MEMBERSHIPS_LS_UPDATE = 'MEMBERSHIPS_LS_UPDATE';
12
- export declare type SEGMENT_UPDATE = 'SEGMENT_UPDATE';
13
- export declare type SPLIT_KILL = 'SPLIT_KILL';
14
- export declare type SPLIT_UPDATE = 'SPLIT_UPDATE';
15
- export declare type CONTROL = 'CONTROL';
16
- export declare type OCCUPANCY = 'OCCUPANCY';
17
- export declare type IPushEvent = PUSH_SUBSYSTEM_UP | PUSH_SUBSYSTEM_DOWN | PUSH_NONRETRYABLE_ERROR | PUSH_RETRYABLE_ERROR | MEMBERSHIPS_MS_UPDATE | MEMBERSHIPS_LS_UPDATE | SEGMENT_UPDATE | SPLIT_UPDATE | SPLIT_KILL | ControlType.STREAMING_RESET;
18
- declare type IParsedData<T extends IPushEvent> = T extends MEMBERSHIPS_MS_UPDATE ? IMembershipMSUpdateData : T extends MEMBERSHIPS_LS_UPDATE ? IMembershipLSUpdateData : T extends SEGMENT_UPDATE ? ISegmentUpdateData : T extends SPLIT_UPDATE ? ISplitUpdateData : T extends SPLIT_KILL ? ISplitKillData : INotificationData;
19
- /**
20
- * EventEmitter used as Feedback Loop between the SyncManager and PushManager,
21
- * where the latter pushes messages and the former consumes it
22
- */
23
- export interface IPushEventEmitter extends IEventEmitter {
24
- once<T extends IPushEvent>(event: T, listener: (parsedData: IParsedData<T>) => void): this;
25
- on<T extends IPushEvent>(event: T, listener: (parsedData: IParsedData<T>) => void): this;
26
- emit<T extends IPushEvent>(event: T, parsedData?: IParsedData<T>): boolean;
27
- }
28
- /**
29
- * PushManager
30
- */
31
- export interface IPushManager extends ITask, IPushEventEmitter {
32
- add(userKey: string, mySegmentsSyncTask: IMySegmentsSyncTask): void;
33
- remove(userKey: string): void;
34
- }
35
- export {};
@@ -1,5 +0,0 @@
1
- import { ISdkFactoryContextSync } from '../../sdkFactory/types';
2
- /**
3
- * Submitter that periodically posts tracked events
4
- */
5
- export declare function eventsSubmitterFactory(params: ISdkFactoryContextSync): import("../types").ISyncTask<[], void>;
@@ -1,10 +0,0 @@
1
- import { ISdkFactoryContextSync } from '../../sdkFactory/types';
2
- import { ImpressionCountsPayload } from './types';
3
- /**
4
- * Converts `impressionCounts` data from cache into request payload.
5
- */
6
- export declare function fromImpressionCountsCollector(impressionsCount: Record<string, number>): ImpressionCountsPayload;
7
- /**
8
- * Submitter that periodically posts impression counts
9
- */
10
- export declare function impressionCountsSubmitterFactory(params: ISdkFactoryContextSync): import("../types").ISyncTask<[], void> | undefined;
@@ -1,11 +0,0 @@
1
- import { ImpressionDTO } from '../../types';
2
- import { ImpressionsPayload } from './types';
3
- import { ISdkFactoryContextSync } from '../../sdkFactory/types';
4
- /**
5
- * Converts `impressions` data from cache into request payload.
6
- */
7
- export declare function fromImpressionsCollector(sendLabels: boolean, data: ImpressionDTO[]): ImpressionsPayload;
8
- /**
9
- * Submitter that periodically posts impressions data
10
- */
11
- export declare function impressionsSubmitterFactory(params: ISdkFactoryContextSync): import("../types").ISyncTask<[], void>;
@@ -1,12 +0,0 @@
1
- import { ISyncTask } from '../types';
2
- import { IRecorderCacheSync } from '../../storages/types';
3
- import { ILogger } from '../../logger/types';
4
- import { IResponse } from '../../services/types';
5
- /**
6
- * Base function to create submitters, such as ImpressionsSubmitter and EventsSubmitter
7
- */
8
- export declare function submitterFactory<T>(log: ILogger, postClient: (body: string) => Promise<IResponse>, sourceCache: IRecorderCacheSync<T>, postRate: number, dataName: string, fromCacheToPayload?: (cacheData: T) => any, maxRetries?: number, debugLogs?: boolean): ISyncTask<[], void>;
9
- /**
10
- * Decorates a provided submitter with a first execution window
11
- */
12
- export declare function firstPushWindowDecorator(submitter: ISyncTask, firstPushWindow: number): ISyncTask<[], any>;
@@ -1,3 +0,0 @@
1
- import { ISdkFactoryContextSync } from '../../sdkFactory/types';
2
- import { ISubmitterManager } from './types';
3
- export declare function submitterManagerFactory(params: ISdkFactoryContextSync): ISubmitterManager;
@@ -1,17 +0,0 @@
1
- import { ITelemetryCacheSync } from '../../storages/types';
2
- import { TelemetryConfigStatsPayload, TelemetryConfigStats } from './types';
3
- import { ISettings, SDKMode } from '../../types';
4
- import { ISdkFactoryContextSync } from '../../sdkFactory/types';
5
- export declare function getTelemetryConfigStats(mode: SDKMode, storageType: string): TelemetryConfigStats;
6
- /**
7
- * Converts data from telemetry cache and settings into /metrics/config request payload.
8
- */
9
- export declare function telemetryCacheConfigAdapter(telemetry: ITelemetryCacheSync, settings: ISettings): {
10
- isEmpty(): boolean;
11
- clear(): void;
12
- pop(): TelemetryConfigStatsPayload;
13
- };
14
- /**
15
- * Submitter that periodically posts telemetry data
16
- */
17
- export declare function telemetrySubmitterFactory(params: ISdkFactoryContextSync): import("../types").ISyncTask<[], any> | undefined;