@splitsoftware/splitio-commons 1.17.1-rc.3 → 1.17.1-rc.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/CHANGES.txt +28 -28
  2. package/LICENSE +1 -1
  3. package/README.md +4 -3
  4. package/cjs/consent/sdkUserConsent.js +4 -2
  5. package/cjs/evaluator/matchers/index.js +1 -3
  6. package/cjs/evaluator/matchers/matcherTypes.js +0 -1
  7. package/cjs/evaluator/matchers/segment.js +0 -6
  8. package/cjs/evaluator/matchersTransform/index.js +1 -4
  9. package/cjs/evaluator/matchersTransform/segment.js +1 -3
  10. package/cjs/logger/constants.js +2 -2
  11. package/cjs/logger/messages/info.js +1 -1
  12. package/cjs/logger/messages/warn.js +1 -1
  13. package/cjs/readiness/readinessManager.js +11 -12
  14. package/cjs/readiness/sdkReadinessManager.js +6 -5
  15. package/cjs/sdkClient/sdkClient.js +5 -5
  16. package/cjs/sdkClient/sdkClientMethod.js +1 -3
  17. package/cjs/sdkClient/sdkClientMethodCS.js +17 -15
  18. package/cjs/sdkClient/sdkClientMethodCSWithTT.js +17 -15
  19. package/cjs/sdkFactory/index.js +11 -38
  20. package/cjs/services/decorateHeaders.js +6 -1
  21. package/cjs/services/splitApi.js +5 -5
  22. package/cjs/services/splitHttpClient.js +5 -2
  23. package/cjs/storages/AbstractSegmentsCacheSync.js +12 -41
  24. package/cjs/storages/AbstractSplitsCacheAsync.js +7 -0
  25. package/cjs/storages/AbstractSplitsCacheSync.js +8 -2
  26. package/cjs/storages/KeyBuilderCS.js +5 -23
  27. package/cjs/storages/dataLoader.js +33 -65
  28. package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +52 -29
  29. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +9 -1
  30. package/cjs/storages/inLocalStorage/index.js +3 -12
  31. package/cjs/storages/inMemory/InMemoryStorageCS.js +3 -20
  32. package/cjs/storages/inMemory/MySegmentsCacheInMemory.js +40 -9
  33. package/cjs/storages/inMemory/SegmentsCacheInMemory.js +1 -1
  34. package/cjs/storages/inMemory/SplitsCacheInMemory.js +8 -8
  35. package/cjs/storages/inMemory/TelemetryCacheInMemory.js +10 -7
  36. package/cjs/storages/inRedis/RedisAdapter.js +1 -1
  37. package/cjs/storages/inRedis/SegmentsCacheInRedis.js +2 -2
  38. package/cjs/storages/inRedis/index.js +11 -5
  39. package/cjs/storages/pluggable/SegmentsCachePluggable.js +2 -2
  40. package/cjs/storages/pluggable/inMemoryWrapper.js +1 -1
  41. package/cjs/storages/pluggable/index.js +32 -37
  42. package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +7 -2
  43. package/cjs/sync/polling/fetchers/mySegmentsFetcher.js +8 -5
  44. package/cjs/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
  45. package/cjs/sync/polling/pollingManagerCS.js +1 -1
  46. package/cjs/sync/polling/pollingManagerSS.js +3 -3
  47. package/cjs/sync/polling/syncTasks/mySegmentsSyncTask.js +2 -2
  48. package/cjs/sync/polling/updaters/mySegmentsUpdater.js +21 -15
  49. package/cjs/sync/polling/updaters/segmentChangesUpdater.js +2 -2
  50. package/cjs/sync/polling/updaters/splitChangesUpdater.js +11 -2
  51. package/cjs/sync/streaming/AuthClient/index.js +1 -1
  52. package/cjs/sync/streaming/SSEHandler/index.js +5 -3
  53. package/cjs/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +48 -107
  54. package/cjs/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +3 -3
  55. package/cjs/sync/streaming/constants.js +3 -3
  56. package/cjs/sync/streaming/parseUtils.js +9 -14
  57. package/cjs/sync/streaming/pushManager.js +67 -69
  58. package/cjs/sync/syncTask.js +2 -2
  59. package/cjs/trackers/eventTracker.js +9 -11
  60. package/cjs/trackers/impressionsTracker.js +13 -15
  61. package/cjs/trackers/uniqueKeysTracker.js +3 -5
  62. package/cjs/utils/constants/index.js +4 -5
  63. package/cjs/utils/settingsValidation/index.js +1 -2
  64. package/cjs/utils/settingsValidation/storage/storageCS.js +12 -1
  65. package/esm/consent/sdkUserConsent.js +4 -2
  66. package/esm/evaluator/matchers/index.js +1 -3
  67. package/esm/evaluator/matchers/matcherTypes.js +0 -1
  68. package/esm/evaluator/matchers/segment.js +0 -6
  69. package/esm/evaluator/matchersTransform/index.js +1 -4
  70. package/esm/evaluator/matchersTransform/segment.js +1 -3
  71. package/esm/logger/constants.js +1 -1
  72. package/esm/logger/messages/info.js +1 -1
  73. package/esm/logger/messages/warn.js +1 -1
  74. package/esm/readiness/readinessManager.js +11 -12
  75. package/esm/readiness/sdkReadinessManager.js +6 -5
  76. package/esm/sdkClient/sdkClient.js +5 -5
  77. package/esm/sdkClient/sdkClientMethod.js +1 -3
  78. package/esm/sdkClient/sdkClientMethodCS.js +15 -13
  79. package/esm/sdkClient/sdkClientMethodCSWithTT.js +15 -13
  80. package/esm/sdkFactory/index.js +12 -39
  81. package/esm/services/decorateHeaders.js +4 -0
  82. package/esm/services/splitApi.js +6 -6
  83. package/esm/services/splitHttpClient.js +6 -3
  84. package/esm/storages/AbstractSegmentsCacheSync.js +12 -41
  85. package/esm/storages/AbstractSplitsCacheAsync.js +7 -0
  86. package/esm/storages/AbstractSplitsCacheSync.js +9 -3
  87. package/esm/storages/KeyBuilderCS.js +4 -21
  88. package/esm/storages/dataLoader.js +31 -62
  89. package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +52 -29
  90. package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +9 -1
  91. package/esm/storages/inLocalStorage/index.js +5 -14
  92. package/esm/storages/inMemory/InMemoryStorageCS.js +3 -20
  93. package/esm/storages/inMemory/MySegmentsCacheInMemory.js +40 -9
  94. package/esm/storages/inMemory/SegmentsCacheInMemory.js +1 -1
  95. package/esm/storages/inMemory/SplitsCacheInMemory.js +8 -8
  96. package/esm/storages/inMemory/TelemetryCacheInMemory.js +10 -7
  97. package/esm/storages/inRedis/RedisAdapter.js +1 -1
  98. package/esm/storages/inRedis/SegmentsCacheInRedis.js +2 -2
  99. package/esm/storages/inRedis/index.js +11 -5
  100. package/esm/storages/pluggable/SegmentsCachePluggable.js +2 -2
  101. package/esm/storages/pluggable/inMemoryWrapper.js +1 -1
  102. package/esm/storages/pluggable/index.js +32 -37
  103. package/esm/sync/offline/syncTasks/fromObjectSyncTask.js +8 -3
  104. package/esm/sync/polling/fetchers/mySegmentsFetcher.js +8 -5
  105. package/esm/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
  106. package/esm/sync/polling/pollingManagerCS.js +1 -1
  107. package/esm/sync/polling/pollingManagerSS.js +3 -3
  108. package/esm/sync/polling/syncTasks/mySegmentsSyncTask.js +2 -2
  109. package/esm/sync/polling/updaters/mySegmentsUpdater.js +21 -15
  110. package/esm/sync/polling/updaters/segmentChangesUpdater.js +2 -2
  111. package/esm/sync/polling/updaters/splitChangesUpdater.js +12 -3
  112. package/esm/sync/streaming/AuthClient/index.js +1 -1
  113. package/esm/sync/streaming/SSEHandler/index.js +6 -4
  114. package/esm/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +49 -108
  115. package/esm/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +3 -3
  116. package/esm/sync/streaming/constants.js +2 -2
  117. package/esm/sync/streaming/parseUtils.js +8 -12
  118. package/esm/sync/streaming/pushManager.js +70 -72
  119. package/esm/sync/syncTask.js +2 -2
  120. package/esm/trackers/eventTracker.js +9 -11
  121. package/esm/trackers/impressionsTracker.js +13 -15
  122. package/esm/trackers/uniqueKeysTracker.js +3 -5
  123. package/esm/utils/constants/index.js +2 -3
  124. package/esm/utils/settingsValidation/index.js +1 -2
  125. package/esm/utils/settingsValidation/storage/storageCS.js +10 -0
  126. package/package.json +1 -1
  127. package/src/consent/sdkUserConsent.ts +3 -2
  128. package/src/dtos/types.ts +7 -21
  129. package/src/evaluator/matchers/index.ts +0 -2
  130. package/src/evaluator/matchers/matcherTypes.ts +0 -1
  131. package/src/evaluator/matchers/segment.ts +0 -7
  132. package/src/evaluator/matchersTransform/index.ts +1 -4
  133. package/src/evaluator/matchersTransform/segment.ts +3 -5
  134. package/src/logger/constants.ts +1 -1
  135. package/src/logger/messages/info.ts +1 -1
  136. package/src/logger/messages/warn.ts +1 -1
  137. package/src/readiness/readinessManager.ts +12 -16
  138. package/src/readiness/sdkReadinessManager.ts +7 -7
  139. package/src/readiness/types.ts +2 -3
  140. package/src/sdkClient/sdkClient.ts +5 -5
  141. package/src/sdkClient/sdkClientMethod.ts +1 -4
  142. package/src/sdkClient/sdkClientMethodCS.ts +14 -11
  143. package/src/sdkClient/sdkClientMethodCSWithTT.ts +14 -11
  144. package/src/sdkFactory/index.ts +13 -42
  145. package/src/sdkFactory/types.ts +1 -5
  146. package/src/services/decorateHeaders.ts +5 -0
  147. package/src/services/splitApi.ts +7 -7
  148. package/src/services/splitHttpClient.ts +7 -4
  149. package/src/services/types.ts +2 -2
  150. package/src/storages/AbstractSegmentsCacheSync.ts +12 -53
  151. package/src/storages/AbstractSplitsCacheAsync.ts +8 -0
  152. package/src/storages/AbstractSplitsCacheSync.ts +11 -4
  153. package/src/storages/KeyBuilderCS.ts +5 -34
  154. package/src/storages/dataLoader.ts +33 -63
  155. package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +59 -29
  156. package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +10 -1
  157. package/src/storages/inLocalStorage/index.ts +6 -16
  158. package/src/storages/inMemory/InMemoryStorageCS.ts +3 -23
  159. package/src/storages/inMemory/MySegmentsCacheInMemory.ts +44 -10
  160. package/src/storages/inMemory/SegmentsCacheInMemory.ts +1 -1
  161. package/src/storages/inMemory/SplitsCacheInMemory.ts +8 -7
  162. package/src/storages/inMemory/TelemetryCacheInMemory.ts +11 -7
  163. package/src/storages/inRedis/RedisAdapter.ts +1 -1
  164. package/src/storages/inRedis/SegmentsCacheInRedis.ts +2 -2
  165. package/src/storages/inRedis/index.ts +12 -6
  166. package/src/storages/pluggable/SegmentsCachePluggable.ts +2 -2
  167. package/src/storages/pluggable/inMemoryWrapper.ts +1 -1
  168. package/src/storages/pluggable/index.ts +33 -38
  169. package/src/storages/types.ts +15 -15
  170. package/src/sync/offline/syncTasks/fromObjectSyncTask.ts +7 -3
  171. package/src/sync/polling/fetchers/mySegmentsFetcher.ts +10 -8
  172. package/src/sync/polling/fetchers/segmentChangesFetcher.ts +1 -1
  173. package/src/sync/polling/fetchers/types.ts +2 -3
  174. package/src/sync/polling/pollingManagerCS.ts +4 -4
  175. package/src/sync/polling/pollingManagerSS.ts +2 -3
  176. package/src/sync/polling/syncTasks/mySegmentsSyncTask.ts +5 -4
  177. package/src/sync/polling/types.ts +6 -7
  178. package/src/sync/polling/updaters/mySegmentsUpdater.ts +22 -19
  179. package/src/sync/polling/updaters/segmentChangesUpdater.ts +2 -2
  180. package/src/sync/polling/updaters/splitChangesUpdater.ts +12 -4
  181. package/src/sync/streaming/AuthClient/index.ts +1 -1
  182. package/src/sync/streaming/SSEClient/index.ts +6 -4
  183. package/src/sync/streaming/SSEHandler/index.ts +8 -5
  184. package/src/sync/streaming/SSEHandler/types.ts +15 -15
  185. package/src/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.ts +49 -116
  186. package/src/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.ts +4 -4
  187. package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +1 -1
  188. package/src/sync/streaming/UpdateWorkers/types.ts +2 -2
  189. package/src/sync/streaming/constants.ts +2 -2
  190. package/src/sync/streaming/parseUtils.ts +11 -19
  191. package/src/sync/streaming/pushManager.ts +72 -73
  192. package/src/sync/streaming/types.ts +10 -10
  193. package/src/sync/submitters/types.ts +5 -8
  194. package/src/sync/syncTask.ts +2 -2
  195. package/src/trackers/eventTracker.ts +7 -10
  196. package/src/trackers/impressionsTracker.ts +9 -12
  197. package/src/trackers/types.ts +0 -1
  198. package/src/trackers/uniqueKeysTracker.ts +4 -6
  199. package/src/types.ts +9 -16
  200. package/src/utils/constants/index.ts +2 -3
  201. package/src/utils/settingsValidation/index.ts +2 -3
  202. package/src/utils/settingsValidation/storage/storageCS.ts +13 -0
  203. package/src/utils/settingsValidation/types.ts +1 -1
  204. package/types/dtos/types.d.ts +7 -18
  205. package/types/evaluator/matchersTransform/segment.d.ts +2 -2
  206. package/types/logger/constants.d.ts +1 -1
  207. package/types/readiness/readinessManager.d.ts +2 -2
  208. package/types/readiness/sdkReadinessManager.d.ts +3 -2
  209. package/types/readiness/types.d.ts +2 -3
  210. package/types/sdkClient/sdkClientMethod.d.ts +1 -1
  211. package/types/sdkFactory/types.d.ts +1 -4
  212. package/types/services/decorateHeaders.d.ts +1 -0
  213. package/types/services/splitApi.d.ts +1 -1
  214. package/types/services/splitHttpClient.d.ts +1 -1
  215. package/types/services/types.d.ts +2 -2
  216. package/types/storages/AbstractSegmentsCacheSync.d.ts +11 -9
  217. package/types/storages/AbstractSplitsCacheAsync.d.ts +5 -0
  218. package/types/storages/AbstractSplitsCacheSync.d.ts +6 -1
  219. package/types/storages/KeyBuilderCS.d.ts +2 -9
  220. package/types/storages/dataLoader.d.ts +6 -17
  221. package/types/storages/inLocalStorage/MySegmentsCacheInLocal.d.ts +14 -4
  222. package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +6 -0
  223. package/types/storages/inMemory/MySegmentsCacheInMemory.d.ts +9 -3
  224. package/types/storages/inMemory/SegmentsCacheInMemory.d.ts +1 -1
  225. package/types/storages/inMemory/SplitsCacheInMemory.d.ts +1 -1
  226. package/types/storages/inMemory/TelemetryCacheInMemory.d.ts +6 -4
  227. package/types/storages/inRedis/SegmentsCacheInRedis.d.ts +1 -1
  228. package/types/storages/inRedis/index.d.ts +1 -1
  229. package/types/storages/pluggable/SegmentsCachePluggable.d.ts +1 -1
  230. package/types/storages/pluggable/inMemoryWrapper.d.ts +1 -1
  231. package/types/storages/types.d.ts +11 -11
  232. package/types/sync/polling/fetchers/mySegmentsFetcher.d.ts +2 -2
  233. package/types/sync/polling/fetchers/types.d.ts +2 -2
  234. package/types/sync/polling/syncTasks/mySegmentsSyncTask.d.ts +2 -2
  235. package/types/sync/polling/types.d.ts +4 -7
  236. package/types/sync/polling/updaters/mySegmentsUpdater.d.ts +3 -4
  237. package/types/sync/streaming/SSEHandler/types.d.ts +14 -16
  238. package/types/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.d.ts +2 -4
  239. package/types/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.d.ts +1 -2
  240. package/types/sync/streaming/UpdateWorkers/SplitsUpdateWorker.d.ts +2 -3
  241. package/types/sync/streaming/UpdateWorkers/types.d.ts +2 -2
  242. package/types/sync/streaming/constants.d.ts +2 -2
  243. package/types/sync/streaming/parseUtils.d.ts +5 -4
  244. package/types/sync/streaming/types.d.ts +8 -8
  245. package/types/sync/submitters/types.d.ts +4 -7
  246. package/types/trackers/eventTracker.d.ts +1 -1
  247. package/types/trackers/impressionsTracker.d.ts +1 -1
  248. package/types/trackers/types.d.ts +0 -1
  249. package/types/types.d.ts +9 -15
  250. package/types/utils/constants/index.d.ts +2 -3
  251. package/types/utils/settingsValidation/storage/storageCS.d.ts +5 -0
  252. package/types/utils/settingsValidation/types.d.ts +1 -1
  253. package/cjs/evaluator/matchers/large_segment.js +0 -16
  254. package/cjs/sdkClient/identity.js +0 -7
  255. package/esm/evaluator/matchers/large_segment.js +0 -12
  256. package/esm/sdkClient/identity.js +0 -3
  257. package/src/evaluator/matchers/large_segment.ts +0 -18
  258. package/src/sdkClient/identity.ts +0 -5
  259. package/types/evaluator/matchers/large_segment.d.ts +0 -5
  260. package/types/evaluator/matchers/sember_inlist.d.ts +0 -3
  261. package/types/evaluator/matchersTransform/set.d.ts +0 -5
  262. package/types/evaluator/matchersTransform/string.d.ts +0 -7
  263. package/types/sdkClient/identity.d.ts +0 -2
  264. package/types/storages/AbstractMySegmentsCacheSync.d.ts +0 -39
  265. package/types/storages/AbstractSplitsCache.d.ts +0 -46
  266. package/types/sync/streaming/mySegmentsV2utils.d.ts +0 -27
  267. package/types/sync/streaming/pushManagerCS_Spec1_3.d.ts +0 -9
  268. package/types/sync/streaming/pushManager_Spec1_3.d.ts +0 -9
  269. package/types/trackers/impressionObserver/utils.d.ts +0 -5
  270. package/types/utils/inputValidation/sdkKey.d.ts +0 -7
  271. package/types/utils/inputValidation/splitExistance.d.ts +0 -7
  272. package/types/utils/inputValidation/trafficTypeExistance.d.ts +0 -9
  273. package/types/utils/redis/RedisMock.d.ts +0 -4
  274. package/types/utils/settingsValidation/logger/globalLogLevel.d.ts +0 -8
  275. /package/types/utils/{semVer.d.ts → Semver.d.ts} +0 -0
@@ -1,12 +0,0 @@
1
- import { thenable } from '../../utils/promise/thenable';
2
- export function largeSegmentMatcherContext(largeSegmentName, storage) {
3
- return function largeSegmentMatcher(key) {
4
- var isInLargeSegment = storage.largeSegments ? storage.largeSegments.isInSegment(largeSegmentName, key) : false;
5
- if (thenable(isInLargeSegment)) {
6
- isInLargeSegment.then(function (result) {
7
- return result;
8
- });
9
- }
10
- return isInLargeSegment;
11
- };
12
- }
@@ -1,3 +0,0 @@
1
- export function buildInstanceId(key, trafficType) {
2
- return (key.matchingKey ? key.matchingKey : key) + "-" + (key.bucketingKey ? key.bucketingKey : key) + "-" + (trafficType ? trafficType : '');
3
- }
@@ -1,18 +0,0 @@
1
- import { MaybeThenable } from '../../dtos/types';
2
- import { ISegmentsCacheBase } from '../../storages/types';
3
- import { thenable } from '../../utils/promise/thenable';
4
-
5
- export function largeSegmentMatcherContext(largeSegmentName: string, storage: { largeSegments?: ISegmentsCacheBase }) {
6
-
7
- return function largeSegmentMatcher(key: string): MaybeThenable<boolean> {
8
- const isInLargeSegment = storage.largeSegments ? storage.largeSegments.isInSegment(largeSegmentName, key) : false;
9
-
10
- if (thenable(isInLargeSegment)) {
11
- isInLargeSegment.then(result => {
12
- return result;
13
- });
14
- }
15
-
16
- return isInLargeSegment;
17
- };
18
- }
@@ -1,5 +0,0 @@
1
- import { SplitIO } from '../types';
2
-
3
- export function buildInstanceId(key: SplitIO.SplitKey, trafficType?: string) { // @ts-ignore
4
- return `${key.matchingKey ? key.matchingKey : key}-${key.bucketingKey ? key.bucketingKey : key}-${trafficType ? trafficType : ''}`;
5
- }
@@ -1,5 +0,0 @@
1
- import { MaybeThenable } from '../../dtos/types';
2
- import { ISegmentsCacheBase } from '../../storages/types';
3
- export declare function largeSegmentMatcherContext(largeSegmentName: string, storage: {
4
- largeSegments?: ISegmentsCacheBase;
5
- }): (key: string) => MaybeThenable<boolean>;
@@ -1,3 +0,0 @@
1
- import { ISet } from '../../utils/lang/sets';
2
- import { ILogger } from '../../logger/types';
3
- export declare function inListSemverMatcherContext(log: ILogger, ruleAttr: ISet<string>): (runtimeAttr: string) => boolean;
@@ -1,5 +0,0 @@
1
- import { ISplitMatcher } from '../../dtos/types';
2
- /**
3
- * Extract whitelist array. Used by set and string matchers
4
- */
5
- export declare function setTransform(whitelistObject: ISplitMatcher['whitelistMatcherData']): string[] | null | undefined;
@@ -1,7 +0,0 @@
1
- import { ISplitMatcher } from '../../dtos/types';
2
- /**
3
- * Extract value from string matcher data.
4
- */
5
- export declare function stringTransform({ stringMatcherData }: ISplitMatcher): {
6
- value: string | null | undefined;
7
- };
@@ -1,2 +0,0 @@
1
- import { SplitIO } from '../types';
2
- export declare function buildInstanceId(key: SplitIO.SplitKey, trafficType?: string): string;
@@ -1,39 +0,0 @@
1
- import { IMySegmentsResponse } from '../dtos/types';
2
- import { MySegmentsData } from '../sync/polling/types';
3
- import { ISegmentsCacheSync } from './types';
4
- /**
5
- * This class provides a skeletal implementation of the ISegmentsCacheSync interface
6
- * to minimize the effort required to implement this interface.
7
- */
8
- export declare abstract class AbstractMySegmentsCacheSync implements ISegmentsCacheSync {
9
- protected abstract addSegment(name: string): boolean;
10
- protected abstract removeSegment(name: string): boolean;
11
- protected abstract setChangeNumber(changeNumber?: number): boolean | void;
12
- /**
13
- * For server-side synchronizer: check if `key` is in `name` segment.
14
- * For client-side synchronizer: check if `name` segment is in the cache. `key` is undefined.
15
- */
16
- abstract isInSegment(name: string, key?: string): boolean;
17
- /**
18
- * clear the cache.
19
- */
20
- clear(): void;
21
- registerSegments(): boolean;
22
- update(): boolean;
23
- /**
24
- * For server-side synchronizer: get the list of segments to fetch changes.
25
- * Also used for the `seC` (segment count) telemetry stat.
26
- */
27
- abstract getRegisteredSegments(): string[];
28
- /**
29
- * Only used for the `skC`(segment keys count) telemetry stat: 1 for client-side, and total count of keys in server-side.
30
- * @TODO for client-side it should be the number of clients, but it requires a refactor of MySegments caches to simplify the code.
31
- */
32
- abstract getKeysCount(): number;
33
- abstract getChangeNumber(name: string): number;
34
- /**
35
- * For server-side synchronizer: the method is not used.
36
- * For client-side synchronizer: it resets or updates the cache.
37
- */
38
- resetSegments(segmentsData: MySegmentsData | IMySegmentsResponse): boolean;
39
- }
@@ -1,46 +0,0 @@
1
- import { ISplit, MaybeThenable } from '../dtos/types';
2
- /**
3
- * This class provides a skeletal implementation of the ISplitsCacheAsync interface
4
- * to minimize the effort required to implement this interface.
5
- */
6
- export declare abstract class AbstractSplitsCache {
7
- /**
8
- * Check if the splits information is already stored in cache. This data can be preloaded.
9
- * It is used as condition to emit SDK_SPLITS_CACHE_LOADED, and then SDK_READY_FROM_CACHE.
10
- */
11
- checkCache(): boolean;
12
- protected abstract addSplit(name: string, split: ISplit): MaybeThenable<boolean>;
13
- /**
14
- * Add a list of splits.
15
- * The returned promise is resolved when the operation success or rejected if it fails (e.g., wrapper operation fails).
16
- */
17
- protected addSplits(entries: [string, ISplit][]): Promise<boolean[]>;
18
- protected abstract removeSplit(name: string): MaybeThenable<boolean>;
19
- /**
20
- * Remove a list of splits.
21
- * The returned promise is resolved when the operation success, with a boolean array indicating if the splits existed or not.
22
- * or rejected if it fails (e.g., wrapper operation fails).
23
- */
24
- protected removeSplits(names: string[]): Promise<boolean[]>;
25
- protected abstract setChangeNumber(changeNumber: number): MaybeThenable<boolean | void>;
26
- /**
27
- * Updates the cache with the provided changeNumber, feature flags to add and feature flags to remove.
28
- *
29
- * @returns {Promise<boolean>} a promise that resolved once the operation is performed successfully. The fulfillment value is `true` if at least one feature flag was added, modified or removed; or `false` if there was no change.
30
- * The promise will reject if some storage operation rejects.
31
- */
32
- update(changeNumber: number, toAdd: [string, ISplit][], toRemove?: string[]): Promise<boolean>;
33
- abstract getSplit(name: string): MaybeThenable<ISplit | null>;
34
- /**
35
- * Kill `name` split and set `defaultTreatment` and `changeNumber`.
36
- * Used for SPLIT_KILL push notifications.
37
- *
38
- * @param {string} name
39
- * @param {string} defaultTreatment
40
- * @param {number} changeNumber
41
- * @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
- * 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.
43
- * The promise will never be rejected.
44
- */
45
- killLocally(name: string, defaultTreatment: string, changeNumber: number): Promise<boolean>;
46
- }
@@ -1,27 +0,0 @@
1
- import { Compression, KeyList } from './SSEHandler/types';
2
- /**
3
- * Decode, decompress and parse the provided 'data' into a KeyList object
4
- *
5
- * @param {string} data
6
- * @param {number} compression
7
- * @returns {{a?: string[], r?: string[] }}
8
- * @throws if data string cannot be decoded, decompressed or parsed
9
- */
10
- export declare function parseKeyList(data: string, compression: Compression): KeyList;
11
- /**
12
- * Decode, decompress and parse the provided 'data' into a Bitmap object
13
- *
14
- * @param {string} data
15
- * @param {number} compression
16
- * @returns {Uint8Array}
17
- * @throws if data string cannot be decoded or decompressed
18
- */
19
- export declare function parseBitmap(data: string, compression: Compression): Uint8Array;
20
- /**
21
- * Check if the 'bitmap' bit at 'hash64hex' position is 1
22
- *
23
- * @param {Uint8Array} bitmap
24
- * @param {string} hash64hex 16-chars string, representing a number in hexa
25
- * @returns {boolean}
26
- */
27
- export declare function isInBitmap(bitmap: Uint8Array, hash64hex: string): boolean;
@@ -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,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,5 +0,0 @@
1
- import { ISettings } from '../../types';
2
- /**
3
- * Storage is async if mode is consumer or partial consumer
4
- */
5
- export declare function isStorageSync(settings: Pick<ISettings, 'mode'>): boolean;
@@ -1,7 +0,0 @@
1
- import { ILogger } from '../../logger/types';
2
- /** validates the given SDK key */
3
- export declare function validateApiKey(log: ILogger, maybeSdkKey: any): string | false;
4
- export declare const usedKeysMap: Record<string, number>;
5
- /** validates the given SDK key and also warns if it is in use */
6
- export declare function validateAndTrackApiKey(log: ILogger, maybeSdkKey: any): string | false;
7
- export declare function releaseApiKey(sdkKey: string): void;
@@ -1,7 +0,0 @@
1
- import { IReadinessManager } from '../../readiness/types';
2
- import { ILogger } from '../../logger/types';
3
- /**
4
- * This is defined here and in this format mostly because of the logger and the fact that it's considered a validation at product level.
5
- * But it's not going to run on the input validation layer. In any case, the most compeling reason to use it as we do is to avoid going to Redis and get a split twice.
6
- */
7
- export declare function validateSplitExistance(log: ILogger, readinessManager: IReadinessManager, splitName: string, labelOrSplitObj: any, method: string): boolean;
@@ -1,9 +0,0 @@
1
- import { ISplitsCacheBase } from '../../storages/types';
2
- import { IReadinessManager } from '../../readiness/types';
3
- import { SDKMode } from '../../types';
4
- import { MaybeThenable } from '../../dtos/types';
5
- import { ILogger } from '../../logger/types';
6
- /**
7
- * Separated from the previous method since on some cases it'll be async.
8
- */
9
- export declare function validateTrafficTypeExistance(log: ILogger, readinessManager: IReadinessManager, splitsCache: ISplitsCacheBase, mode: SDKMode, maybeTT: string, method: string): MaybeThenable<boolean>;
@@ -1,4 +0,0 @@
1
- export declare class RedisMock {
2
- private pipelineMethods;
3
- constructor();
4
- }
@@ -1,8 +0,0 @@
1
- import { LogLevel } from '../../../types';
2
- /**
3
- * The debug level can be set globally via the `localStorage.splitio_debug` item in browser, or the `SPLITIO_DEBUG` env var in NodeJS.
4
- * Acceptable values are: 'DEBUG', 'INFO', 'WARN', 'ERROR', 'NONE'.
5
- * Other acceptable values are 'on', 'enable' and 'enabled', which are equivalent to 'DEBUG'.
6
- * Any other value, like undefined, null or an invalid string, returns `undefined` and means that the global log level is not set.
7
- */
8
- export declare function getGlobalLogLevel(): LogLevel | undefined;
File without changes