@splitsoftware/splitio-commons 3.1.1-rc.1 → 3.1.1-rc.10

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 (239) hide show
  1. package/CHANGES.txt +10 -1
  2. package/cjs/evaluator/condition/index.js +2 -2
  3. package/cjs/evaluator/fallbackTreatmentsCalculator/fallbackSanitizer/index.js +8 -5
  4. package/cjs/evaluator/index.js +71 -76
  5. package/cjs/listeners/browser.js +1 -2
  6. package/cjs/listeners/node.js +4 -4
  7. package/cjs/logger/constants.js +20 -15
  8. package/cjs/logger/messages/debug.js +6 -5
  9. package/cjs/logger/messages/error.js +3 -3
  10. package/cjs/logger/messages/info.js +4 -3
  11. package/cjs/logger/messages/warn.js +7 -6
  12. package/cjs/presets/serverSide.js +2 -2
  13. package/cjs/readiness/constants.js +4 -5
  14. package/cjs/readiness/readinessManager.js +23 -23
  15. package/cjs/readiness/sdkReadinessManager.js +17 -1
  16. package/cjs/sdkClient/client.js +51 -27
  17. package/cjs/sdkClient/clientInputValidation.js +17 -6
  18. package/cjs/sdkClient/sdkClient.js +60 -3
  19. package/cjs/sdkFactory/index.js +15 -11
  20. package/cjs/sdkManager/index.js +5 -5
  21. package/cjs/services/decorateHeaders.js +1 -2
  22. package/cjs/services/splitApi.js +1 -14
  23. package/cjs/services/splitHttpClient.js +5 -3
  24. package/cjs/storages/AbstractSplitsCacheAsync.js +51 -0
  25. package/cjs/storages/AbstractSplitsCacheSync.js +76 -0
  26. package/cjs/storages/KeyBuilder.js +6 -6
  27. package/cjs/storages/KeyBuilderCS.js +5 -5
  28. package/cjs/storages/KeyBuilderSS.js +2 -2
  29. package/cjs/storages/getRolloutPlan.js +3 -3
  30. package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +2 -1
  31. package/cjs/storages/inLocalStorage/RBSegmentsCacheInLocal.js +10 -10
  32. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +194 -0
  33. package/cjs/storages/inLocalStorage/index.js +6 -6
  34. package/cjs/storages/inLocalStorage/validateCache.js +3 -3
  35. package/cjs/storages/inMemory/InMemoryStorage.js +4 -4
  36. package/cjs/storages/inMemory/InMemoryStorageCS.js +5 -5
  37. package/cjs/storages/inMemory/RBSegmentsCacheInMemory.js +5 -5
  38. package/cjs/storages/inMemory/SegmentsCacheInMemory.js +1 -1
  39. package/cjs/storages/inMemory/SplitsCacheInMemory.js +121 -0
  40. package/cjs/storages/inMemory/TelemetryCacheInMemory.js +5 -5
  41. package/cjs/storages/inRedis/RBSegmentsCacheInRedis.js +1 -1
  42. package/cjs/storages/inRedis/RedisAdapter.js +8 -5
  43. package/cjs/storages/inRedis/{DefinitionsCacheInRedis.js → SplitsCacheInRedis.js} +77 -77
  44. package/cjs/storages/inRedis/index.js +2 -2
  45. package/cjs/storages/pluggable/RBSegmentsCachePluggable.js +1 -1
  46. package/cjs/storages/pluggable/SplitsCachePluggable.js +212 -0
  47. package/cjs/storages/pluggable/index.js +2 -2
  48. package/cjs/storages/setRolloutPlan.js +4 -4
  49. package/cjs/storages/utils.js +0 -1
  50. package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +5 -5
  51. package/cjs/sync/polling/fetchers/splitChangesFetcher.js +15 -24
  52. package/cjs/sync/polling/pollingManagerCS.js +20 -20
  53. package/cjs/sync/polling/pollingManagerSS.js +15 -15
  54. package/cjs/sync/polling/syncTasks/segmentsSyncTask.js +3 -2
  55. package/cjs/sync/polling/syncTasks/splitsSyncTask.js +13 -0
  56. package/cjs/sync/polling/updaters/mySegmentsUpdater.js +3 -3
  57. package/cjs/sync/polling/updaters/segmentChangesUpdater.js +6 -6
  58. package/cjs/sync/polling/updaters/{definitionChangesUpdater.js → splitChangesUpdater.js} +68 -65
  59. package/cjs/sync/streaming/AuthClient/index.js +1 -1
  60. package/cjs/sync/streaming/SSEHandler/NotificationKeeper.js +1 -1
  61. package/cjs/sync/streaming/SSEHandler/index.js +1 -1
  62. package/cjs/sync/streaming/UpdateWorkers/{DefinitionsUpdateWorker.js → SplitsUpdateWorker.js} +19 -16
  63. package/cjs/sync/streaming/constants.js +3 -3
  64. package/cjs/sync/streaming/parseUtils.js +11 -11
  65. package/cjs/sync/streaming/pushManager.js +16 -16
  66. package/cjs/sync/submitters/eventsSubmitter.js +1 -1
  67. package/cjs/sync/submitters/impressionCountsSubmitter.js +1 -1
  68. package/cjs/sync/submitters/impressionsSubmitter.js +4 -5
  69. package/cjs/sync/submitters/telemetrySubmitter.js +4 -3
  70. package/cjs/sync/submitters/uniqueKeysSubmitter.js +1 -1
  71. package/cjs/sync/syncManagerOnline.js +7 -12
  72. package/cjs/utils/Backoff.js +0 -20
  73. package/cjs/utils/inputValidation/index.js +7 -7
  74. package/cjs/utils/inputValidation/isOperational.js +4 -4
  75. package/cjs/utils/inputValidation/{definition.js → split.js} +10 -10
  76. package/cjs/utils/inputValidation/{definitionExistence.js → splitExistence.js} +6 -6
  77. package/cjs/utils/inputValidation/splits.js +25 -0
  78. package/cjs/utils/labels/index.js +3 -3
  79. package/cjs/utils/settingsValidation/index.js +0 -2
  80. package/cjs/utils/settingsValidation/splitFilters.js +3 -3
  81. package/cjs/utils/settingsValidation/url.js +2 -6
  82. package/esm/evaluator/condition/index.js +2 -2
  83. package/esm/evaluator/fallbackTreatmentsCalculator/fallbackSanitizer/index.js +8 -5
  84. package/esm/evaluator/index.js +71 -75
  85. package/esm/listeners/browser.js +1 -2
  86. package/esm/listeners/node.js +4 -4
  87. package/esm/logger/constants.js +17 -12
  88. package/esm/logger/messages/debug.js +6 -5
  89. package/esm/logger/messages/error.js +3 -3
  90. package/esm/logger/messages/info.js +4 -3
  91. package/esm/logger/messages/warn.js +7 -6
  92. package/esm/presets/serverSide.js +2 -2
  93. package/esm/readiness/constants.js +3 -4
  94. package/esm/readiness/readinessManager.js +24 -24
  95. package/esm/readiness/sdkReadinessManager.js +18 -2
  96. package/esm/sdkClient/client.js +51 -26
  97. package/esm/sdkClient/clientInputValidation.js +19 -8
  98. package/esm/sdkClient/sdkClient.js +60 -3
  99. package/esm/sdkFactory/index.js +16 -12
  100. package/esm/sdkManager/index.js +6 -6
  101. package/esm/services/decorateHeaders.js +1 -2
  102. package/esm/services/splitApi.js +1 -14
  103. package/esm/services/splitHttpClient.js +5 -3
  104. package/esm/storages/AbstractSplitsCacheAsync.js +48 -0
  105. package/esm/storages/AbstractSplitsCacheSync.js +71 -0
  106. package/esm/storages/KeyBuilder.js +6 -6
  107. package/esm/storages/KeyBuilderCS.js +5 -5
  108. package/esm/storages/KeyBuilderSS.js +2 -2
  109. package/esm/storages/getRolloutPlan.js +3 -3
  110. package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +2 -1
  111. package/esm/storages/inLocalStorage/RBSegmentsCacheInLocal.js +7 -7
  112. package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +191 -0
  113. package/esm/storages/inLocalStorage/index.js +6 -6
  114. package/esm/storages/inLocalStorage/validateCache.js +3 -3
  115. package/esm/storages/inMemory/InMemoryStorage.js +4 -4
  116. package/esm/storages/inMemory/InMemoryStorageCS.js +5 -5
  117. package/esm/storages/inMemory/RBSegmentsCacheInMemory.js +2 -2
  118. package/esm/storages/inMemory/SegmentsCacheInMemory.js +1 -1
  119. package/esm/storages/inMemory/SplitsCacheInMemory.js +118 -0
  120. package/esm/storages/inMemory/TelemetryCacheInMemory.js +5 -5
  121. package/esm/storages/inRedis/RBSegmentsCacheInRedis.js +1 -1
  122. package/esm/storages/inRedis/RedisAdapter.js +8 -5
  123. package/esm/storages/inRedis/{DefinitionsCacheInRedis.js → SplitsCacheInRedis.js} +76 -76
  124. package/esm/storages/inRedis/index.js +2 -2
  125. package/esm/storages/pluggable/RBSegmentsCachePluggable.js +1 -1
  126. package/esm/storages/pluggable/SplitsCachePluggable.js +209 -0
  127. package/esm/storages/pluggable/index.js +2 -2
  128. package/esm/storages/setRolloutPlan.js +4 -4
  129. package/esm/storages/utils.js +0 -1
  130. package/esm/sync/offline/syncTasks/fromObjectSyncTask.js +6 -6
  131. package/esm/sync/polling/fetchers/splitChangesFetcher.js +16 -25
  132. package/esm/sync/polling/pollingManagerCS.js +17 -17
  133. package/esm/sync/polling/pollingManagerSS.js +15 -15
  134. package/esm/sync/polling/syncTasks/segmentsSyncTask.js +3 -2
  135. package/esm/sync/polling/syncTasks/splitsSyncTask.js +9 -0
  136. package/esm/sync/polling/updaters/mySegmentsUpdater.js +3 -3
  137. package/esm/sync/polling/updaters/segmentChangesUpdater.js +7 -7
  138. package/esm/sync/polling/updaters/{definitionChangesUpdater.js → splitChangesUpdater.js} +68 -65
  139. package/esm/sync/streaming/AuthClient/index.js +1 -1
  140. package/esm/sync/streaming/SSEHandler/NotificationKeeper.js +2 -2
  141. package/esm/sync/streaming/SSEHandler/index.js +2 -2
  142. package/esm/sync/streaming/UpdateWorkers/{DefinitionsUpdateWorker.js → SplitsUpdateWorker.js} +18 -15
  143. package/esm/sync/streaming/constants.js +2 -2
  144. package/esm/sync/streaming/parseUtils.js +9 -9
  145. package/esm/sync/streaming/pushManager.js +18 -18
  146. package/esm/sync/submitters/eventsSubmitter.js +1 -1
  147. package/esm/sync/submitters/impressionCountsSubmitter.js +1 -1
  148. package/esm/sync/submitters/impressionsSubmitter.js +4 -5
  149. package/esm/sync/submitters/telemetrySubmitter.js +4 -3
  150. package/esm/sync/submitters/uniqueKeysSubmitter.js +1 -1
  151. package/esm/sync/syncManagerOnline.js +6 -11
  152. package/esm/utils/Backoff.js +0 -20
  153. package/esm/utils/inputValidation/index.js +3 -3
  154. package/esm/utils/inputValidation/isOperational.js +4 -4
  155. package/esm/utils/inputValidation/{definition.js → split.js} +8 -8
  156. package/esm/utils/inputValidation/splitExistence.js +15 -0
  157. package/esm/utils/inputValidation/splits.js +21 -0
  158. package/esm/utils/labels/index.js +2 -2
  159. package/esm/utils/settingsValidation/index.js +0 -2
  160. package/esm/utils/settingsValidation/splitFilters.js +3 -3
  161. package/esm/utils/settingsValidation/url.js +2 -6
  162. package/package.json +6 -7
  163. package/src/dtos/types.ts +1 -1
  164. package/src/evaluator/index.ts +11 -5
  165. package/src/evaluator/types.ts +1 -0
  166. package/src/presets/serverSide.ts +3 -3
  167. package/src/sdkClient/client.ts +3 -4
  168. package/src/sdkClient/sdkLifecycle.ts +3 -0
  169. package/src/services/authProvider.ts +41 -19
  170. package/src/services/secureSplitHttpClient.ts +10 -18
  171. package/src/services/serviceApi.ts +27 -24
  172. package/src/services/splitApi.ts +10 -9
  173. package/src/services/types.ts +5 -4
  174. package/src/storages/inRedis/RedisAdapter.ts +8 -5
  175. package/src/sync/polling/pollingManagerCS.ts +80 -78
  176. package/src/sync/polling/pollingManagerSS.ts +49 -45
  177. package/src/sync/polling/updaters/definitionChangesUpdater.ts +3 -3
  178. package/src/sync/polling/updaters/segmentChangesUpdater.ts +1 -1
  179. package/src/sync/streaming/AuthClient/index.ts +14 -15
  180. package/src/sync/streaming/AuthClient/types.ts +9 -13
  181. package/src/sync/streaming/SSEClient/index.ts +2 -2
  182. package/src/sync/streaming/SSEClient/types.ts +2 -2
  183. package/src/sync/streaming/SSEHandler/index.ts +2 -1
  184. package/src/sync/streaming/SSEHandler/types.ts +2 -2
  185. package/src/sync/streaming/constants.ts +1 -0
  186. package/src/sync/streaming/pushManager.ts +32 -42
  187. package/src/sync/streaming/types.ts +3 -2
  188. package/src/sync/submitters/impressionsSubmitter.ts +3 -3
  189. package/src/sync/submitters/types.ts +2 -2
  190. package/src/sync/syncManagerOnline.ts +2 -8
  191. package/src/utils/Backoff.ts +16 -4
  192. package/types/splitio.d.ts +5 -4
  193. package/cjs/platform/browser.js +0 -15
  194. package/cjs/platform/getEventSource/browser.js +0 -8
  195. package/cjs/platform/getEventSource/eventsource.js +0 -480
  196. package/cjs/platform/getEventSource/node.js +0 -26
  197. package/cjs/platform/getFetch/browser.js +0 -9
  198. package/cjs/platform/getFetch/node.js +0 -27
  199. package/cjs/platform/getOptions/node.js +0 -25
  200. package/cjs/platform/node.js +0 -17
  201. package/cjs/sdkClient/sdkLifecycle.js +0 -72
  202. package/cjs/sdkClient/trackMethod.js +0 -56
  203. package/cjs/services/authProvider.js +0 -67
  204. package/cjs/services/secureSplitHttpClient.js +0 -39
  205. package/cjs/services/serviceApi.js +0 -145
  206. package/cjs/storages/AbstractDefinitionsCacheAsync.js +0 -51
  207. package/cjs/storages/AbstractDefinitionsCacheSync.js +0 -76
  208. package/cjs/storages/inLocalStorage/DefinitionsCacheInLocal.js +0 -194
  209. package/cjs/storages/inMemory/DefinitionsCacheInMemory.js +0 -121
  210. package/cjs/storages/pluggable/DefinitionsCachePluggable.js +0 -212
  211. package/cjs/sync/polling/syncTasks/definitionsSyncTask.js +0 -13
  212. package/cjs/utils/EventEmitter.js +0 -391
  213. package/cjs/utils/filter/bloomFilter.js +0 -37
  214. package/cjs/utils/inputValidation/definitions.js +0 -25
  215. package/cjs/utils/inputValidation/target.js +0 -22
  216. package/esm/platform/browser.js +0 -12
  217. package/esm/platform/getEventSource/browser.js +0 -4
  218. package/esm/platform/getEventSource/eventsource.js +0 -480
  219. package/esm/platform/getEventSource/node.js +0 -20
  220. package/esm/platform/getFetch/browser.js +0 -5
  221. package/esm/platform/getFetch/node.js +0 -22
  222. package/esm/platform/getOptions/node.js +0 -20
  223. package/esm/platform/node.js +0 -14
  224. package/esm/sdkClient/sdkLifecycle.js +0 -68
  225. package/esm/sdkClient/trackMethod.js +0 -52
  226. package/esm/services/authProvider.js +0 -63
  227. package/esm/services/secureSplitHttpClient.js +0 -35
  228. package/esm/services/serviceApi.js +0 -141
  229. package/esm/storages/AbstractDefinitionsCacheAsync.js +0 -48
  230. package/esm/storages/AbstractDefinitionsCacheSync.js +0 -71
  231. package/esm/storages/inLocalStorage/DefinitionsCacheInLocal.js +0 -191
  232. package/esm/storages/inMemory/DefinitionsCacheInMemory.js +0 -118
  233. package/esm/storages/pluggable/DefinitionsCachePluggable.js +0 -209
  234. package/esm/sync/polling/syncTasks/definitionsSyncTask.js +0 -9
  235. package/esm/utils/EventEmitter.js +0 -387
  236. package/esm/utils/filter/bloomFilter.js +0 -33
  237. package/esm/utils/inputValidation/definitionExistence.js +0 -15
  238. package/esm/utils/inputValidation/definitions.js +0 -21
  239. package/esm/utils/inputValidation/target.js +0 -18
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RBSegmentsCacheInMemory = void 0;
4
4
  var sets_1 = require("../../utils/lang/sets");
5
- var AbstractDefinitionsCacheSync_1 = require("../AbstractDefinitionsCacheSync");
5
+ var AbstractSplitsCacheSync_1 = require("../AbstractSplitsCacheSync");
6
6
  var RBSegmentsCacheInMemory = /** @class */ (function () {
7
7
  function RBSegmentsCacheInMemory() {
8
8
  this.cache = {};
@@ -17,17 +17,17 @@ var RBSegmentsCacheInMemory = /** @class */ (function () {
17
17
  RBSegmentsCacheInMemory.prototype.update = function (toAdd, toRemove, changeNumber) {
18
18
  var _this = this;
19
19
  var updated = toAdd.map(function (toAdd) { return _this.add(toAdd); }).some(function (result) { return result; });
20
- updated = toRemove.map(function (toRemove) { return _this.remove(toRemove); }).some(function (result) { return result; }) || updated;
20
+ updated = toRemove.map(function (toRemove) { return _this.remove(toRemove.name); }).some(function (result) { return result; }) || updated;
21
21
  this.changeNumber = changeNumber;
22
22
  return updated;
23
23
  };
24
24
  RBSegmentsCacheInMemory.prototype.add = function (rbSegment) {
25
25
  var name = rbSegment.name;
26
26
  var previous = this.get(name);
27
- if (previous && (0, AbstractDefinitionsCacheSync_1.usesSegments)(previous))
27
+ if (previous && (0, AbstractSplitsCacheSync_1.usesSegments)(previous))
28
28
  this.segmentsCount--;
29
29
  this.cache[name] = rbSegment;
30
- if ((0, AbstractDefinitionsCacheSync_1.usesSegments)(rbSegment))
30
+ if ((0, AbstractSplitsCacheSync_1.usesSegments)(rbSegment))
31
31
  this.segmentsCount++;
32
32
  return true;
33
33
  };
@@ -36,7 +36,7 @@ var RBSegmentsCacheInMemory = /** @class */ (function () {
36
36
  if (!rbSegment)
37
37
  return false;
38
38
  delete this.cache[name];
39
- if ((0, AbstractDefinitionsCacheSync_1.usesSegments)(rbSegment))
39
+ if ((0, AbstractSplitsCacheSync_1.usesSegments)(rbSegment))
40
40
  this.segmentsCount--;
41
41
  return true;
42
42
  };
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SegmentsCacheInMemory = void 0;
4
4
  var lang_1 = require("../../utils/lang");
5
5
  /**
6
- * Default IDefinitionsCacheSync implementation for server-side that stores segments definitions in memory.
6
+ * Default ISplitsCacheSync implementation for server-side that stores segments definitions in memory.
7
7
  */
8
8
  var SegmentsCacheInMemory = /** @class */ (function () {
9
9
  function SegmentsCacheInMemory() {
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SplitsCacheInMemory = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var AbstractSplitsCacheSync_1 = require("../AbstractSplitsCacheSync");
6
+ var lang_1 = require("../../utils/lang");
7
+ /**
8
+ * Default ISplitsCacheSync implementation that stores split definitions in memory.
9
+ */
10
+ var SplitsCacheInMemory = /** @class */ (function (_super) {
11
+ tslib_1.__extends(SplitsCacheInMemory, _super);
12
+ function SplitsCacheInMemory(splitFiltersValidation) {
13
+ var _this = _super.call(this) || this;
14
+ _this.splitsCache = {};
15
+ _this.ttCache = {};
16
+ _this.changeNumber = -1;
17
+ _this.segmentsCount = 0;
18
+ _this.flagSetsCache = {};
19
+ _this.flagSetsFilter = splitFiltersValidation ? splitFiltersValidation.groupedFilters.bySet : [];
20
+ return _this;
21
+ }
22
+ SplitsCacheInMemory.prototype.clear = function () {
23
+ this.splitsCache = {};
24
+ this.ttCache = {};
25
+ this.changeNumber = -1;
26
+ this.segmentsCount = 0;
27
+ this.flagSetsCache = {};
28
+ };
29
+ SplitsCacheInMemory.prototype.addSplit = function (split) {
30
+ var name = split.name;
31
+ var previousSplit = this.getSplit(name);
32
+ if (previousSplit) { // We had this Split already
33
+ var previousTtName = previousSplit.trafficTypeName;
34
+ this.ttCache[previousTtName]--;
35
+ if (!this.ttCache[previousTtName])
36
+ delete this.ttCache[previousTtName];
37
+ this.removeFromFlagSets(previousSplit.name, previousSplit.sets);
38
+ // Subtract from segments count for the previous version of this Split
39
+ if ((0, AbstractSplitsCacheSync_1.usesSegments)(previousSplit))
40
+ this.segmentsCount--;
41
+ }
42
+ // Store the Split.
43
+ this.splitsCache[name] = split;
44
+ // Update TT cache
45
+ var ttName = split.trafficTypeName;
46
+ this.ttCache[ttName] = (this.ttCache[ttName] || 0) + 1;
47
+ this.addToFlagSets(split);
48
+ // Add to segments count for the new version of the Split
49
+ if ((0, AbstractSplitsCacheSync_1.usesSegments)(split))
50
+ this.segmentsCount++;
51
+ return true;
52
+ };
53
+ SplitsCacheInMemory.prototype.removeSplit = function (name) {
54
+ var split = this.getSplit(name);
55
+ if (!split)
56
+ return false;
57
+ // Delete the Split
58
+ delete this.splitsCache[name];
59
+ var ttName = split.trafficTypeName;
60
+ this.ttCache[ttName]--; // Update tt cache
61
+ if (!this.ttCache[ttName])
62
+ delete this.ttCache[ttName];
63
+ this.removeFromFlagSets(split.name, split.sets);
64
+ // Update the segments count.
65
+ if ((0, AbstractSplitsCacheSync_1.usesSegments)(split))
66
+ this.segmentsCount--;
67
+ return true;
68
+ };
69
+ SplitsCacheInMemory.prototype.getSplit = function (name) {
70
+ return this.splitsCache[name] || null;
71
+ };
72
+ SplitsCacheInMemory.prototype.setChangeNumber = function (changeNumber) {
73
+ this.changeNumber = changeNumber;
74
+ return true;
75
+ };
76
+ SplitsCacheInMemory.prototype.getChangeNumber = function () {
77
+ return this.changeNumber;
78
+ };
79
+ SplitsCacheInMemory.prototype.getSplitNames = function () {
80
+ return Object.keys(this.splitsCache);
81
+ };
82
+ SplitsCacheInMemory.prototype.trafficTypeExists = function (trafficType) {
83
+ return (0, lang_1.isFiniteNumber)(this.ttCache[trafficType]) && this.ttCache[trafficType] > 0;
84
+ };
85
+ SplitsCacheInMemory.prototype.usesSegments = function () {
86
+ return this.getChangeNumber() === -1 || this.segmentsCount > 0;
87
+ };
88
+ SplitsCacheInMemory.prototype.getNamesByFlagSets = function (flagSets) {
89
+ var _this = this;
90
+ return flagSets.map(function (flagSet) { return _this.flagSetsCache[flagSet] || new Set(); });
91
+ };
92
+ SplitsCacheInMemory.prototype.addToFlagSets = function (featureFlag) {
93
+ var _this = this;
94
+ if (!featureFlag.sets)
95
+ return;
96
+ featureFlag.sets.forEach(function (featureFlagSet) {
97
+ if (_this.flagSetsFilter.length > 0 && !_this.flagSetsFilter.some(function (filterFlagSet) { return filterFlagSet === featureFlagSet; }))
98
+ return;
99
+ if (!_this.flagSetsCache[featureFlagSet])
100
+ _this.flagSetsCache[featureFlagSet] = new Set([]);
101
+ _this.flagSetsCache[featureFlagSet].add(featureFlag.name);
102
+ });
103
+ };
104
+ SplitsCacheInMemory.prototype.removeFromFlagSets = function (featureFlagName, flagSets) {
105
+ var _this = this;
106
+ if (!flagSets)
107
+ return;
108
+ flagSets.forEach(function (flagSet) {
109
+ _this.removeNames(flagSet, featureFlagName);
110
+ });
111
+ };
112
+ SplitsCacheInMemory.prototype.removeNames = function (flagSetName, featureFlagName) {
113
+ if (!this.flagSetsCache[flagSetName])
114
+ return;
115
+ this.flagSetsCache[flagSetName].delete(featureFlagName);
116
+ if (this.flagSetsCache[flagSetName].size === 0)
117
+ delete this.flagSetsCache[flagSetName];
118
+ };
119
+ return SplitsCacheInMemory;
120
+ }(AbstractSplitsCacheSync_1.AbstractSplitsCacheSync));
121
+ exports.SplitsCacheInMemory = SplitsCacheInMemory;
@@ -19,13 +19,13 @@ var ACCEPTANCE_RANGE = 0.001;
19
19
  * All factory instances track telemetry on server-side, and 0.1% on client-side.
20
20
  */
21
21
  function shouldRecordTelemetry(_a) {
22
- var settings = _a.settings, disableTelemetry = _a.disableTelemetry;
23
- return !disableTelemetry && settings.mode !== constants_1.LOCALHOST_MODE && ((0, key_1.checkIfServerSide)(settings) || Math.random() <= ACCEPTANCE_RANGE);
22
+ var settings = _a.settings;
23
+ return settings.mode !== constants_1.LOCALHOST_MODE && ((0, key_1.checkIfServerSide)(settings) || Math.random() <= ACCEPTANCE_RANGE);
24
24
  }
25
25
  exports.shouldRecordTelemetry = shouldRecordTelemetry;
26
26
  var TelemetryCacheInMemory = /** @class */ (function () {
27
- function TelemetryCacheInMemory(definitions, segments, largeSegments) {
28
- this.definitions = definitions;
27
+ function TelemetryCacheInMemory(splits, segments, largeSegments) {
28
+ this.splits = splits;
29
29
  this.segments = segments;
30
30
  this.largeSegments = largeSegments;
31
31
  this.name = 'telemetry stats';
@@ -61,7 +61,7 @@ var TelemetryCacheInMemory = /** @class */ (function () {
61
61
  iQ: this.getImpressionStats(constants_1.QUEUED),
62
62
  iDe: this.getImpressionStats(constants_1.DEDUPED),
63
63
  iDr: this.getImpressionStats(constants_1.DROPPED),
64
- spC: this.definitions && this.definitions.getNames().length,
64
+ spC: this.splits && this.splits.getSplitNames().length,
65
65
  seC: this.segments && this.segments.getRegisteredSegments().length,
66
66
  skC: this.segments && this.segments.getKeysCount(),
67
67
  lsC: this.largeSegments && this.largeSegments.getRegisteredSegments().length,
@@ -34,7 +34,7 @@ var RBSegmentsCacheInRedis = /** @class */ (function () {
34
34
  return _this.redis.set(key, stringifiedNewRBSegment).then(function () { return true; });
35
35
  })),
36
36
  Promise.all(toRemove.map(function (toRemove) {
37
- var key = _this.keys.buildRBSegmentKey(toRemove);
37
+ var key = _this.keys.buildRBSegmentKey(toRemove.name);
38
38
  return _this.redis.del(key).then(function (status) { return status === 1; });
39
39
  }))
40
40
  ]).then(function (_a) {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RedisAdapter = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  // Dynamically require ioredis to prevent strict TypeScript binding
6
- // and handle module export differences between v4 and v5.
6
+ // and handle module export differences between v4 and later major versions.
7
7
  var RedisConstructor;
8
8
  try {
9
9
  var ioredisLib = require('ioredis');
@@ -11,7 +11,7 @@ try {
11
11
  }
12
12
  catch (e) {
13
13
  // If we reach here, the peer dependency is missing
14
- throw new Error('ioredis is missing. Please install ioredis v4 or v5.');
14
+ throw new Error('ioredis is missing. Please install ioredis v4, v5 or v6.');
15
15
  }
16
16
  var lang_1 = require("../../utils/lang");
17
17
  var thenable_1 = require("../../utils/promise/thenable");
@@ -31,13 +31,16 @@ var DEFAULT_LIBRARY_OPTIONS = {
31
31
  enableOfflineQueue: false,
32
32
  connectTimeout: DEFAULT_OPTIONS.connectionTimeout,
33
33
  lazyConnect: false,
34
- // CRITICAL: v5 defaults this to 0 (disabled), which breaks dynamic clusters.
35
- // v4 defaulted to 5000. We explicitly set it here to ensure v5 works like v4.
34
+ // CRITICAL: v5 and v6 default this to 0 (disabled), which breaks dynamic clusters.
35
+ // v4 defaulted to 5000. We explicitly set it here to ensure v5 and v6 work like v4.
36
36
  slotsRefreshInterval: 5000,
37
+ // v6 defaults to RESP3 (`protocol: 3`). The SDK doesn't use any RESP3 feature,
38
+ // so we stick to RESP2 to keep the v4 and v5 behavior. Ignored by v4 and v5.
39
+ protocol: 2,
37
40
  };
38
41
  /**
39
42
  * Redis adapter on top of the library of choice (written with ioredis) for some extra control.
40
- * Refactored to use Composition instead of Inheritance to support both v4 and v5.
43
+ * Refactored to use Composition instead of Inheritance to support v4, v5 and v6.
41
44
  */
42
45
  var RedisAdapter = /** @class */ (function () {
43
46
  function RedisAdapter(log, storageSettings) {
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DefinitionsCacheInRedis = void 0;
3
+ exports.SplitsCacheInRedis = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var lang_1 = require("../../utils/lang");
6
6
  var constants_1 = require("./constants");
7
- var AbstractDefinitionsCacheAsync_1 = require("../AbstractDefinitionsCacheAsync");
7
+ var AbstractSplitsCacheAsync_1 = require("../AbstractSplitsCacheAsync");
8
8
  var sets_1 = require("../../utils/lang/sets");
9
9
  /**
10
10
  * Discard errors for an answer of multiple operations.
@@ -17,17 +17,17 @@ function processPipelineAnswer(results) {
17
17
  }, []) : [];
18
18
  }
19
19
  /**
20
- * IDefinitionsCacheAsync implementation that stores definitions in Redis.
20
+ * ISplitsCacheAsync implementation that stores split definitions in Redis.
21
21
  * Supported by Node.js
22
22
  */
23
- var DefinitionsCacheInRedis = /** @class */ (function (_super) {
24
- tslib_1.__extends(DefinitionsCacheInRedis, _super);
25
- function DefinitionsCacheInRedis(log, keys, redis, splitFiltersValidation) {
23
+ var SplitsCacheInRedis = /** @class */ (function (_super) {
24
+ tslib_1.__extends(SplitsCacheInRedis, _super);
25
+ function SplitsCacheInRedis(log, keys, redis, splitFiltersValidation) {
26
26
  var _this = _super.call(this) || this;
27
27
  _this.log = log;
28
28
  _this.redis = redis;
29
29
  _this.keys = keys;
30
- _this.setsFilter = splitFiltersValidation ? splitFiltersValidation.groupedFilters.bySet : [];
30
+ _this.flagSetsFilter = splitFiltersValidation ? splitFiltersValidation.groupedFilters.bySet : [];
31
31
  // There is no need to listen for redis 'error' event, because in that case ioredis calls will be rejected and handled by redis storage adapters.
32
32
  // But it is done just to avoid getting the ioredis message `Unhandled error event`.
33
33
  _this.redis.on('error', function (e) {
@@ -38,104 +38,104 @@ var DefinitionsCacheInRedis = /** @class */ (function (_super) {
38
38
  });
39
39
  return _this;
40
40
  }
41
- DefinitionsCacheInRedis.prototype._decrementCounts = function (definition) {
41
+ SplitsCacheInRedis.prototype._decrementCounts = function (split) {
42
42
  var _this = this;
43
- var ttKey = this.keys.buildTrafficTypeKey(definition.trafficTypeName);
43
+ var ttKey = this.keys.buildTrafficTypeKey(split.trafficTypeName);
44
44
  return this.redis.decr(ttKey).then(function (count) {
45
45
  if (count === 0)
46
46
  return _this.redis.del(ttKey);
47
47
  });
48
48
  };
49
- DefinitionsCacheInRedis.prototype._incrementCounts = function (definition) {
50
- var ttKey = this.keys.buildTrafficTypeKey(definition.trafficTypeName);
49
+ SplitsCacheInRedis.prototype._incrementCounts = function (split) {
50
+ var ttKey = this.keys.buildTrafficTypeKey(split.trafficTypeName);
51
51
  return this.redis.incr(ttKey);
52
52
  };
53
- DefinitionsCacheInRedis.prototype._updateSets = function (definitionName, setsOfRemovedDefinition, setsOfAddedDefinition) {
53
+ SplitsCacheInRedis.prototype._updateFlagSets = function (featureFlagName, flagSetsOfRemovedFlag, flagSetsOfAddedFlag) {
54
54
  var _this = this;
55
- var removeFromSets = (0, sets_1.returnDifference)(setsOfRemovedDefinition, setsOfAddedDefinition);
56
- var addToSets = (0, sets_1.returnDifference)(setsOfAddedDefinition, setsOfRemovedDefinition);
57
- if (this.setsFilter.length > 0) {
58
- addToSets = addToSets.filter(function (set) {
59
- return _this.setsFilter.some(function (filterSet) { return filterSet === set; });
55
+ var removeFromFlagSets = (0, sets_1.returnDifference)(flagSetsOfRemovedFlag, flagSetsOfAddedFlag);
56
+ var addToFlagSets = (0, sets_1.returnDifference)(flagSetsOfAddedFlag, flagSetsOfRemovedFlag);
57
+ if (this.flagSetsFilter.length > 0) {
58
+ addToFlagSets = addToFlagSets.filter(function (flagSet) {
59
+ return _this.flagSetsFilter.some(function (filterFlagSet) { return filterFlagSet === flagSet; });
60
60
  });
61
61
  }
62
- var items = [definitionName];
63
- return Promise.all(tslib_1.__spreadArray(tslib_1.__spreadArray([], removeFromSets.map(function (setName) { return _this.redis.srem(_this.keys.buildSetKey(setName), items); }), true), addToSets.map(function (setName) { return _this.redis.sadd(_this.keys.buildSetKey(setName), items); }), true));
62
+ var items = [featureFlagName];
63
+ return Promise.all(tslib_1.__spreadArray(tslib_1.__spreadArray([], removeFromFlagSets.map(function (flagSetName) { return _this.redis.srem(_this.keys.buildFlagSetKey(flagSetName), items); }), true), addToFlagSets.map(function (flagSetName) { return _this.redis.sadd(_this.keys.buildFlagSetKey(flagSetName), items); }), true));
64
64
  };
65
65
  /**
66
- * Add a given definition.
66
+ * Add a given split.
67
67
  * The returned promise is resolved when the operation success
68
68
  * or rejected if it fails (e.g., redis operation fails)
69
69
  */
70
- DefinitionsCacheInRedis.prototype.add = function (definition) {
70
+ SplitsCacheInRedis.prototype.addSplit = function (split) {
71
71
  var _this = this;
72
- var name = definition.name;
73
- var definitionKey = this.keys.buildDefinitionKey(name);
74
- return this.redis.get(definitionKey).then(function (definitionFromStorage) {
72
+ var name = split.name;
73
+ var splitKey = this.keys.buildSplitKey(name);
74
+ return this.redis.get(splitKey).then(function (splitFromStorage) {
75
75
  // handling parsing error
76
- var parsedPreviousDefinition, stringifiedNewDefinition;
76
+ var parsedPreviousSplit, stringifiedNewSplit;
77
77
  try {
78
- parsedPreviousDefinition = definitionFromStorage ? JSON.parse(definitionFromStorage) : undefined;
79
- stringifiedNewDefinition = JSON.stringify(definition);
78
+ parsedPreviousSplit = splitFromStorage ? JSON.parse(splitFromStorage) : undefined;
79
+ stringifiedNewSplit = JSON.stringify(split);
80
80
  }
81
81
  catch (e) {
82
82
  throw new Error('Error parsing feature flag definition: ' + e);
83
83
  }
84
- return _this.redis.set(definitionKey, stringifiedNewDefinition).then(function () {
84
+ return _this.redis.set(splitKey, stringifiedNewSplit).then(function () {
85
85
  // avoid unnecessary increment/decrement operations
86
- if (parsedPreviousDefinition && parsedPreviousDefinition.trafficTypeName === definition.trafficTypeName)
86
+ if (parsedPreviousSplit && parsedPreviousSplit.trafficTypeName === split.trafficTypeName)
87
87
  return;
88
88
  // update traffic type counts
89
- return _this._incrementCounts(definition).then(function () {
90
- if (parsedPreviousDefinition)
91
- return _this._decrementCounts(parsedPreviousDefinition);
89
+ return _this._incrementCounts(split).then(function () {
90
+ if (parsedPreviousSplit)
91
+ return _this._decrementCounts(parsedPreviousSplit);
92
92
  });
93
- }).then(function () { return _this._updateSets(name, parsedPreviousDefinition && parsedPreviousDefinition.sets, definition.sets); });
93
+ }).then(function () { return _this._updateFlagSets(name, parsedPreviousSplit && parsedPreviousSplit.sets, split.sets); });
94
94
  }).then(function () { return true; });
95
95
  };
96
96
  /**
97
- * Remove a given definition.
98
- * The returned promise is resolved when the operation success, with true or false indicating if the definition existed (and was removed) or not.
97
+ * Remove a given split.
98
+ * The returned promise is resolved when the operation success, with true or false indicating if the split existed (and was removed) or not.
99
99
  * or rejected if it fails (e.g., redis operation fails).
100
100
  */
101
- DefinitionsCacheInRedis.prototype.remove = function (name) {
101
+ SplitsCacheInRedis.prototype.removeSplit = function (name) {
102
102
  var _this = this;
103
- return this.get(name).then(function (definition) {
104
- if (definition) {
105
- return _this._decrementCounts(definition).then(function () { return _this._updateSets(name, definition.sets); });
103
+ return this.getSplit(name).then(function (split) {
104
+ if (split) {
105
+ return _this._decrementCounts(split).then(function () { return _this._updateFlagSets(name, split.sets); });
106
106
  }
107
107
  }).then(function () {
108
- return _this.redis.del(_this.keys.buildDefinitionKey(name)).then(function (status) { return status === 1; });
108
+ return _this.redis.del(_this.keys.buildSplitKey(name)).then(function (status) { return status === 1; });
109
109
  });
110
110
  };
111
111
  /**
112
- * Get definition or null if it's not defined.
112
+ * Get split definition or null if it's not defined.
113
113
  * Returned promise is rejected if redis operation fails.
114
114
  */
115
- DefinitionsCacheInRedis.prototype.get = function (name) {
115
+ SplitsCacheInRedis.prototype.getSplit = function (name) {
116
116
  if (this.redisError) {
117
117
  this.log.error(constants_1.LOG_PREFIX + this.redisError);
118
118
  return Promise.reject(this.redisError);
119
119
  }
120
- return this.redis.get(this.keys.buildDefinitionKey(name))
121
- .then(function (maybeDefinition) { return maybeDefinition && JSON.parse(maybeDefinition); });
120
+ return this.redis.get(this.keys.buildSplitKey(name))
121
+ .then(function (maybeSplit) { return maybeSplit && JSON.parse(maybeSplit); });
122
122
  };
123
123
  /**
124
124
  * Set till number.
125
125
  * The returned promise is resolved when the operation success,
126
126
  * or rejected if it fails.
127
127
  */
128
- DefinitionsCacheInRedis.prototype.setChangeNumber = function (changeNumber) {
129
- return this.redis.set(this.keys.buildDefinitionsTillKey(), changeNumber + '').then(function (status) { return status === 'OK'; });
128
+ SplitsCacheInRedis.prototype.setChangeNumber = function (changeNumber) {
129
+ return this.redis.set(this.keys.buildSplitsTillKey(), changeNumber + '').then(function (status) { return status === 'OK'; });
130
130
  };
131
131
  /**
132
132
  * Get till number or -1 if it's not defined.
133
133
  * The returned promise is resolved with the changeNumber or -1 if it doesn't exist or a redis operation fails.
134
134
  * The promise will never be rejected.
135
135
  */
136
- DefinitionsCacheInRedis.prototype.getChangeNumber = function () {
136
+ SplitsCacheInRedis.prototype.getChangeNumber = function () {
137
137
  var _this = this;
138
- return this.redis.get(this.keys.buildDefinitionsTillKey()).then(function (value) {
138
+ return this.redis.get(this.keys.buildSplitsTillKey()).then(function (value) {
139
139
  var i = parseInt(value, 10);
140
140
  return (0, lang_1.isNaNNumber)(i) ? -1 : i;
141
141
  }).catch(function (e) {
@@ -144,44 +144,44 @@ var DefinitionsCacheInRedis = /** @class */ (function (_super) {
144
144
  });
145
145
  };
146
146
  /**
147
- * Get list of all definitions.
148
- * The returned promise is resolved with the list of definitions,
147
+ * Get list of all split definitions.
148
+ * The returned promise is resolved with the list of split definitions,
149
149
  * or rejected if redis operation fails.
150
150
  */
151
151
  // @TODO we need to benchmark which is the maximun number of commands we could pipeline without kill redis performance.
152
- DefinitionsCacheInRedis.prototype.getAll = function () {
152
+ SplitsCacheInRedis.prototype.getAll = function () {
153
153
  var _this = this;
154
- return this.redis.keys(this.keys.searchPatternForDefinitionKeys())
154
+ return this.redis.keys(this.keys.searchPatternForSplitKeys())
155
155
  .then(function (listOfKeys) { return _this.redis.pipeline(listOfKeys.map(function (k) { return ['get', k]; })).exec(); })
156
156
  .then(processPipelineAnswer)
157
- .then(function (definitions) { return definitions.map(function (definition) {
158
- return JSON.parse(definition);
157
+ .then(function (splitDefinitions) { return splitDefinitions.map(function (splitDefinition) {
158
+ return JSON.parse(splitDefinition);
159
159
  }); });
160
160
  };
161
161
  /**
162
- * Get list of definition names.
163
- * The returned promise is resolved with the list of names,
162
+ * Get list of split names.
163
+ * The returned promise is resolved with the list of split names,
164
164
  * or rejected if redis operation fails.
165
165
  */
166
- DefinitionsCacheInRedis.prototype.getNames = function () {
166
+ SplitsCacheInRedis.prototype.getSplitNames = function () {
167
167
  var _this = this;
168
- return this.redis.keys(this.keys.searchPatternForDefinitionKeys()).then(function (listOfKeys) { return listOfKeys.map(_this.keys.extractKey); });
168
+ return this.redis.keys(this.keys.searchPatternForSplitKeys()).then(function (listOfKeys) { return listOfKeys.map(_this.keys.extractKey); });
169
169
  };
170
170
  /**
171
- * Get list of definition names related to a given list of set names.
172
- * The returned promise is resolved with the list of names per set,
171
+ * Get list of feature flag names related to a given list of flag set names.
172
+ * The returned promise is resolved with the list of feature flag names per flag set,
173
173
  * or rejected if the pipelined redis operation fails (e.g., timeout).
174
174
  */
175
- DefinitionsCacheInRedis.prototype.getNamesBySets = function (sets) {
175
+ SplitsCacheInRedis.prototype.getNamesByFlagSets = function (flagSets) {
176
176
  var _this = this;
177
- return this.redis.pipeline(sets.map(function (set) { return ['smembers', _this.keys.buildSetKey(set)]; })).exec()
177
+ return this.redis.pipeline(flagSets.map(function (flagSet) { return ['smembers', _this.keys.buildFlagSetKey(flagSet)]; })).exec()
178
178
  .then(function (results) { return results ? results.map(function (_a, index) {
179
179
  var e = _a[0], value = _a[1];
180
180
  if (e === null)
181
181
  return value;
182
- _this.log.error(constants_1.LOG_PREFIX + "Could not read result from get members of set ".concat(sets[index], " due to an error: ").concat(e));
182
+ _this.log.error(constants_1.LOG_PREFIX + "Could not read result from get members of flag set ".concat(flagSets[index], " due to an error: ").concat(e));
183
183
  }) : []; })
184
- .then(function (namesBySets) { return namesBySets.map(function (namesBySet) { return new Set(namesBySet); }); });
184
+ .then(function (namesByFlagSets) { return namesByFlagSets.map(function (namesByFlagSet) { return new Set(namesByFlagSet); }); });
185
185
  };
186
186
  /**
187
187
  * Check traffic type existence.
@@ -189,7 +189,7 @@ var DefinitionsCacheInRedis = /** @class */ (function (_super) {
189
189
  * In case of redis operation failure, the promise resolves with a true value, assuming that the TT might exist.
190
190
  * It will never be rejected.
191
191
  */
192
- DefinitionsCacheInRedis.prototype.trafficTypeExists = function (trafficType) {
192
+ SplitsCacheInRedis.prototype.trafficTypeExists = function (trafficType) {
193
193
  var _this = this;
194
194
  // If there is a number there should be > 0, otherwise the TT is considered as not existent.
195
195
  return this.redis.get(this.keys.buildTrafficTypeKey(trafficType))
@@ -210,34 +210,34 @@ var DefinitionsCacheInRedis = /** @class */ (function (_super) {
210
210
  });
211
211
  };
212
212
  // @TODO remove or implement. It is not being used.
213
- DefinitionsCacheInRedis.prototype.clear = function () {
213
+ SplitsCacheInRedis.prototype.clear = function () {
214
214
  return Promise.resolve();
215
215
  };
216
216
  /**
217
- * Fetches multiple definitions.
217
+ * Fetches multiple splits definitions.
218
218
  * Returned promise is rejected if redis operation fails.
219
219
  */
220
- DefinitionsCacheInRedis.prototype.getMany = function (names) {
220
+ SplitsCacheInRedis.prototype.getSplits = function (names) {
221
221
  var _a;
222
222
  var _this = this;
223
223
  if (this.redisError) {
224
224
  this.log.error(constants_1.LOG_PREFIX + this.redisError);
225
225
  return Promise.reject(this.redisError);
226
226
  }
227
- var keys = names.map(function (name) { return _this.keys.buildDefinitionKey(name); });
228
- return (_a = this.redis).mget.apply(_a, keys).then(function (stringifiedDefinitions) {
229
- var definitions = {};
227
+ var keys = names.map(function (name) { return _this.keys.buildSplitKey(name); });
228
+ return (_a = this.redis).mget.apply(_a, keys).then(function (splitDefinitions) {
229
+ var splits = {};
230
230
  names.forEach(function (name, idx) {
231
- var definition = stringifiedDefinitions[idx];
232
- definitions[name] = definition && JSON.parse(definition);
231
+ var split = splitDefinitions[idx];
232
+ splits[name] = split && JSON.parse(split);
233
233
  });
234
- return Promise.resolve(definitions);
234
+ return Promise.resolve(splits);
235
235
  })
236
236
  .catch(function (e) {
237
237
  _this.log.error(constants_1.LOG_PREFIX + "Could not grab feature flags due to an error: ".concat(e, "."));
238
238
  return Promise.reject(e);
239
239
  });
240
240
  };
241
- return DefinitionsCacheInRedis;
242
- }(AbstractDefinitionsCacheAsync_1.AbstractDefinitionsCacheAsync));
243
- exports.DefinitionsCacheInRedis = DefinitionsCacheInRedis;
241
+ return SplitsCacheInRedis;
242
+ }(AbstractSplitsCacheAsync_1.AbstractSplitsCacheAsync));
243
+ exports.SplitsCacheInRedis = SplitsCacheInRedis;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InRedisStorage = void 0;
4
4
  var KeyBuilder_1 = require("../KeyBuilder");
5
5
  var KeyBuilderSS_1 = require("../KeyBuilderSS");
6
- var DefinitionsCacheInRedis_1 = require("./DefinitionsCacheInRedis");
6
+ var SplitsCacheInRedis_1 = require("./SplitsCacheInRedis");
7
7
  var SegmentsCacheInRedis_1 = require("./SegmentsCacheInRedis");
8
8
  var ImpressionsCacheInRedis_1 = require("./ImpressionsCacheInRedis");
9
9
  var EventsCacheInRedis_1 = require("./EventsCacheInRedis");
@@ -48,7 +48,7 @@ function InRedisStorage(options) {
48
48
  telemetry.recordConfig();
49
49
  });
50
50
  return {
51
- definitions: new DefinitionsCacheInRedis_1.DefinitionsCacheInRedis(log, keys, redisClient, settings.sync.__splitFiltersValidation),
51
+ splits: new SplitsCacheInRedis_1.SplitsCacheInRedis(log, keys, redisClient, settings.sync.__splitFiltersValidation),
52
52
  rbSegments: new RBSegmentsCacheInRedis_1.RBSegmentsCacheInRedis(log, keys, redisClient),
53
53
  segments: new SegmentsCacheInRedis_1.SegmentsCacheInRedis(log, keys, redisClient),
54
54
  impressions: new ImpressionsCacheInRedis_1.ImpressionsCacheInRedis(log, keys.buildImpressionsKey(), redisClient, metadata),
@@ -34,7 +34,7 @@ var RBSegmentsCachePluggable = /** @class */ (function () {
34
34
  return _this.wrapper.set(key, stringifiedNewRBSegment).then(function () { return true; });
35
35
  })),
36
36
  Promise.all(toRemove.map(function (toRemove) {
37
- var key = _this.keys.buildRBSegmentKey(toRemove);
37
+ var key = _this.keys.buildRBSegmentKey(toRemove.name);
38
38
  return _this.wrapper.del(key);
39
39
  }))
40
40
  ]).then(function (_a) {