@splitsoftware/splitio-commons 2.2.1-rc.1 → 2.2.1-rc.2

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 (140) hide show
  1. package/CHANGES.txt +2 -2
  2. package/README.md +0 -1
  3. package/cjs/evaluator/combiners/and.js +6 -2
  4. package/cjs/evaluator/combiners/ifelseif.js +6 -6
  5. package/cjs/evaluator/condition/index.js +5 -6
  6. package/cjs/evaluator/index.js +7 -7
  7. package/cjs/evaluator/matchers/index.js +1 -3
  8. package/cjs/evaluator/matchers/matcherTypes.js +0 -1
  9. package/cjs/evaluator/matchersTransform/index.js +0 -4
  10. package/cjs/evaluator/parser/index.js +2 -2
  11. package/cjs/evaluator/value/sanitize.js +0 -1
  12. package/cjs/logger/constants.js +3 -4
  13. package/cjs/logger/messages/debug.js +2 -3
  14. package/cjs/logger/messages/warn.js +1 -1
  15. package/cjs/services/splitApi.js +4 -3
  16. package/cjs/storages/AbstractSplitsCacheSync.js +2 -5
  17. package/cjs/storages/KeyBuilder.js +0 -9
  18. package/cjs/storages/KeyBuilderCS.js +0 -3
  19. package/cjs/storages/KeyBuilderSS.js +0 -3
  20. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +14 -9
  21. package/cjs/storages/inLocalStorage/index.js +1 -5
  22. package/cjs/storages/inLocalStorage/validateCache.js +1 -2
  23. package/cjs/storages/inMemory/InMemoryStorage.js +0 -3
  24. package/cjs/storages/inMemory/InMemoryStorageCS.js +0 -4
  25. package/cjs/storages/inRedis/index.js +9 -5
  26. package/cjs/storages/pluggable/index.js +0 -2
  27. package/cjs/sync/polling/fetchers/splitChangesFetcher.js +4 -51
  28. package/cjs/sync/polling/pollingManagerCS.js +7 -7
  29. package/cjs/sync/polling/syncTasks/splitsSyncTask.js +1 -1
  30. package/cjs/sync/polling/updaters/mySegmentsUpdater.js +2 -2
  31. package/cjs/sync/polling/updaters/segmentChangesUpdater.js +1 -1
  32. package/cjs/sync/polling/updaters/splitChangesUpdater.js +33 -51
  33. package/cjs/sync/streaming/SSEHandler/index.js +0 -1
  34. package/cjs/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +77 -106
  35. package/cjs/sync/streaming/constants.js +1 -2
  36. package/cjs/sync/streaming/pushManager.js +16 -3
  37. package/cjs/sync/syncManagerOnline.js +2 -2
  38. package/cjs/utils/constants/index.js +2 -3
  39. package/esm/evaluator/combiners/and.js +6 -2
  40. package/esm/evaluator/combiners/ifelseif.js +7 -7
  41. package/esm/evaluator/condition/index.js +5 -6
  42. package/esm/evaluator/index.js +7 -7
  43. package/esm/evaluator/matchers/index.js +1 -3
  44. package/esm/evaluator/matchers/matcherTypes.js +0 -1
  45. package/esm/evaluator/matchersTransform/index.js +0 -4
  46. package/esm/evaluator/parser/index.js +2 -2
  47. package/esm/evaluator/value/sanitize.js +0 -1
  48. package/esm/logger/constants.js +0 -1
  49. package/esm/logger/messages/debug.js +2 -3
  50. package/esm/logger/messages/warn.js +1 -1
  51. package/esm/services/splitApi.js +4 -3
  52. package/esm/storages/AbstractSplitsCacheSync.js +2 -5
  53. package/esm/storages/KeyBuilder.js +0 -9
  54. package/esm/storages/KeyBuilderCS.js +0 -3
  55. package/esm/storages/KeyBuilderSS.js +0 -3
  56. package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +14 -9
  57. package/esm/storages/inLocalStorage/index.js +1 -5
  58. package/esm/storages/inLocalStorage/validateCache.js +1 -2
  59. package/esm/storages/inMemory/InMemoryStorage.js +0 -3
  60. package/esm/storages/inMemory/InMemoryStorageCS.js +0 -4
  61. package/esm/storages/inRedis/index.js +9 -5
  62. package/esm/storages/pluggable/index.js +0 -2
  63. package/esm/sync/polling/fetchers/splitChangesFetcher.js +4 -51
  64. package/esm/sync/polling/pollingManagerCS.js +7 -7
  65. package/esm/sync/polling/syncTasks/splitsSyncTask.js +1 -1
  66. package/esm/sync/polling/updaters/mySegmentsUpdater.js +2 -2
  67. package/esm/sync/polling/updaters/segmentChangesUpdater.js +1 -1
  68. package/esm/sync/polling/updaters/splitChangesUpdater.js +33 -51
  69. package/esm/sync/streaming/SSEHandler/index.js +1 -2
  70. package/esm/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +73 -102
  71. package/esm/sync/streaming/constants.js +0 -1
  72. package/esm/sync/streaming/pushManager.js +19 -6
  73. package/esm/sync/syncManagerOnline.js +2 -2
  74. package/esm/utils/constants/index.js +1 -2
  75. package/package.json +1 -1
  76. package/src/dtos/types.ts +8 -32
  77. package/src/evaluator/Engine.ts +1 -1
  78. package/src/evaluator/combiners/and.ts +4 -5
  79. package/src/evaluator/combiners/ifelseif.ts +9 -7
  80. package/src/evaluator/condition/engineUtils.ts +1 -1
  81. package/src/evaluator/condition/index.ts +12 -12
  82. package/src/evaluator/index.ts +7 -7
  83. package/src/evaluator/matchers/index.ts +1 -3
  84. package/src/evaluator/matchers/matcherTypes.ts +0 -1
  85. package/src/evaluator/matchersTransform/index.ts +0 -3
  86. package/src/evaluator/parser/index.ts +3 -3
  87. package/src/evaluator/types.ts +2 -2
  88. package/src/evaluator/value/index.ts +2 -2
  89. package/src/evaluator/value/sanitize.ts +4 -5
  90. package/src/logger/constants.ts +0 -1
  91. package/src/logger/messages/debug.ts +2 -3
  92. package/src/logger/messages/warn.ts +1 -1
  93. package/src/sdkManager/index.ts +1 -1
  94. package/src/services/splitApi.ts +4 -3
  95. package/src/services/types.ts +1 -1
  96. package/src/storages/AbstractSplitsCacheSync.ts +3 -6
  97. package/src/storages/KeyBuilder.ts +0 -12
  98. package/src/storages/KeyBuilderCS.ts +0 -4
  99. package/src/storages/KeyBuilderSS.ts +0 -4
  100. package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +14 -10
  101. package/src/storages/inLocalStorage/index.ts +1 -5
  102. package/src/storages/inLocalStorage/validateCache.ts +1 -3
  103. package/src/storages/inMemory/InMemoryStorage.ts +0 -3
  104. package/src/storages/inMemory/InMemoryStorageCS.ts +0 -4
  105. package/src/storages/inRedis/index.ts +11 -7
  106. package/src/storages/pluggable/index.ts +0 -2
  107. package/src/storages/types.ts +1 -33
  108. package/src/sync/polling/fetchers/splitChangesFetcher.ts +4 -62
  109. package/src/sync/polling/fetchers/types.ts +0 -1
  110. package/src/sync/polling/pollingManagerCS.ts +7 -7
  111. package/src/sync/polling/syncTasks/splitsSyncTask.ts +1 -1
  112. package/src/sync/polling/types.ts +2 -2
  113. package/src/sync/polling/updaters/mySegmentsUpdater.ts +2 -2
  114. package/src/sync/polling/updaters/segmentChangesUpdater.ts +1 -1
  115. package/src/sync/polling/updaters/splitChangesUpdater.ts +42 -61
  116. package/src/sync/streaming/SSEHandler/index.ts +1 -2
  117. package/src/sync/streaming/SSEHandler/types.ts +2 -2
  118. package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +68 -98
  119. package/src/sync/streaming/constants.ts +0 -1
  120. package/src/sync/streaming/parseUtils.ts +2 -2
  121. package/src/sync/streaming/pushManager.ts +18 -6
  122. package/src/sync/streaming/types.ts +2 -3
  123. package/src/sync/syncManagerOnline.ts +2 -2
  124. package/src/utils/constants/index.ts +1 -2
  125. package/src/utils/lang/index.ts +1 -1
  126. package/cjs/evaluator/matchers/rbsegment.js +0 -44
  127. package/cjs/storages/inLocalStorage/RBSegmentsCacheInLocal.js +0 -117
  128. package/cjs/storages/inMemory/RBSegmentsCacheInMemory.js +0 -61
  129. package/cjs/storages/inRedis/RBSegmentsCacheInRedis.js +0 -64
  130. package/cjs/storages/pluggable/RBSegmentsCachePluggable.js +0 -64
  131. package/esm/evaluator/matchers/rbsegment.js +0 -40
  132. package/esm/storages/inLocalStorage/RBSegmentsCacheInLocal.js +0 -114
  133. package/esm/storages/inMemory/RBSegmentsCacheInMemory.js +0 -58
  134. package/esm/storages/inRedis/RBSegmentsCacheInRedis.js +0 -61
  135. package/esm/storages/pluggable/RBSegmentsCachePluggable.js +0 -61
  136. package/src/evaluator/matchers/rbsegment.ts +0 -62
  137. package/src/storages/inLocalStorage/RBSegmentsCacheInLocal.ts +0 -136
  138. package/src/storages/inMemory/RBSegmentsCacheInMemory.ts +0 -68
  139. package/src/storages/inRedis/RBSegmentsCacheInRedis.ts +0 -79
  140. package/src/storages/pluggable/RBSegmentsCachePluggable.ts +0 -76
@@ -7,14 +7,14 @@ import SplitIO from '../../../types/splitio';
7
7
  import { ILogger } from '../../logger/types';
8
8
 
9
9
  // Build Evaluation object if and only if matchingResult is true
10
- function match(log: ILogger, matchingResult: boolean, bucketingKey: string | undefined, seed?: number, treatments?: { getTreatmentFor: (x: number) => string }, label?: string): IEvaluation | boolean | undefined {
10
+ function match(log: ILogger, matchingResult: boolean, bucketingKey: string | undefined, seed: number, treatments: { getTreatmentFor: (x: number) => string }, label: string): IEvaluation | undefined {
11
11
  if (matchingResult) {
12
- return treatments ? // Feature flag
13
- {
14
- treatment: getTreatment(log, bucketingKey as string, seed, treatments),
15
- label: label!
16
- } : // Rule-based segment
17
- true;
12
+ const treatment = getTreatment(log, bucketingKey as string, seed, treatments);
13
+
14
+ return {
15
+ treatment,
16
+ label
17
+ };
18
18
  }
19
19
 
20
20
  // else we should notify the engine to continue evaluating
@@ -22,12 +22,12 @@ function match(log: ILogger, matchingResult: boolean, bucketingKey: string | und
22
22
  }
23
23
 
24
24
  // Condition factory
25
- export function conditionContext(log: ILogger, matcherEvaluator: (key: SplitIO.SplitKeyObject, attributes?: SplitIO.Attributes, splitEvaluator?: ISplitEvaluator) => MaybeThenable<boolean>, treatments?: { getTreatmentFor: (x: number) => string }, label?: string, conditionType?: 'ROLLOUT' | 'WHITELIST'): IEvaluator {
25
+ export function conditionContext(log: ILogger, matcherEvaluator: (...args: any) => MaybeThenable<boolean>, treatments: { getTreatmentFor: (x: number) => string }, label: string, conditionType: 'ROLLOUT' | 'WHITELIST'): IEvaluator {
26
26
 
27
- return function conditionEvaluator(key: SplitIO.SplitKeyObject, seed?: number, trafficAllocation?: number, trafficAllocationSeed?: number, attributes?: SplitIO.Attributes, splitEvaluator?: ISplitEvaluator) {
27
+ return function conditionEvaluator(key: SplitIO.SplitKey, seed: number, trafficAllocation?: number, trafficAllocationSeed?: number, attributes?: SplitIO.Attributes, splitEvaluator?: ISplitEvaluator) {
28
28
 
29
29
  // Whitelisting has more priority than traffic allocation, so we don't apply this filtering to those conditions.
30
- if (conditionType === 'ROLLOUT' && !shouldApplyRollout(trafficAllocation!, key.bucketingKey, trafficAllocationSeed!)) {
30
+ if (conditionType === 'ROLLOUT' && !shouldApplyRollout(trafficAllocation as number, (key as SplitIO.SplitKeyObject).bucketingKey as string, trafficAllocationSeed as number)) {
31
31
  return {
32
32
  treatment: undefined, // treatment value is assigned later
33
33
  label: NOT_IN_SPLIT
@@ -41,10 +41,10 @@ export function conditionContext(log: ILogger, matcherEvaluator: (key: SplitIO.S
41
41
  const matches = matcherEvaluator(key, attributes, splitEvaluator);
42
42
 
43
43
  if (thenable(matches)) {
44
- return matches.then(result => match(log, result, key.bucketingKey, seed, treatments, label));
44
+ return matches.then(result => match(log, result, (key as SplitIO.SplitKeyObject).bucketingKey, seed, treatments, label));
45
45
  }
46
46
 
47
- return match(log, matches, key.bucketingKey, seed, treatments, label);
47
+ return match(log, matches, (key as SplitIO.SplitKeyObject).bucketingKey, seed, treatments, label);
48
48
  };
49
49
 
50
50
  }
@@ -43,8 +43,8 @@ export function evaluateFeature(
43
43
  if (thenable(parsedSplit)) {
44
44
  return parsedSplit.then((split) => getEvaluation(
45
45
  log,
46
- key,
47
46
  split,
47
+ key,
48
48
  attributes,
49
49
  storage,
50
50
  )).catch(
@@ -56,8 +56,8 @@ export function evaluateFeature(
56
56
 
57
57
  return getEvaluation(
58
58
  log,
59
- key,
60
59
  parsedSplit,
60
+ key,
61
61
  attributes,
62
62
  storage,
63
63
  );
@@ -80,13 +80,13 @@ export function evaluateFeatures(
80
80
  }
81
81
 
82
82
  return thenable(parsedSplits) ?
83
- parsedSplits.then(splits => getEvaluations(log, key, splitNames, splits, attributes, storage))
83
+ parsedSplits.then(splits => getEvaluations(log, splitNames, splits, key, attributes, storage))
84
84
  .catch(() => {
85
85
  // Exception on async `getSplits` storage. For example, when the storage is redis or
86
86
  // pluggable and there is a connection issue and we can't retrieve the split to be evaluated
87
87
  return treatmentsException(splitNames);
88
88
  }) :
89
- getEvaluations(log, key, splitNames, parsedSplits, attributes, storage);
89
+ getEvaluations(log, splitNames, parsedSplits, key, attributes, storage);
90
90
  }
91
91
 
92
92
  export function evaluateFeaturesByFlagSets(
@@ -136,8 +136,8 @@ export function evaluateFeaturesByFlagSets(
136
136
 
137
137
  function getEvaluation(
138
138
  log: ILogger,
139
- key: SplitIO.SplitKey,
140
139
  splitJSON: ISplit | null,
140
+ key: SplitIO.SplitKey,
141
141
  attributes: SplitIO.Attributes | undefined,
142
142
  storage: IStorageSync | IStorageAsync,
143
143
  ): MaybeThenable<IEvaluationResult> {
@@ -172,9 +172,9 @@ function getEvaluation(
172
172
 
173
173
  function getEvaluations(
174
174
  log: ILogger,
175
- key: SplitIO.SplitKey,
176
175
  splitNames: string[],
177
176
  splits: Record<string, ISplit | null>,
177
+ key: SplitIO.SplitKey,
178
178
  attributes: SplitIO.Attributes | undefined,
179
179
  storage: IStorageSync | IStorageAsync,
180
180
  ): MaybeThenable<Record<string, IEvaluationResult>> {
@@ -183,8 +183,8 @@ function getEvaluations(
183
183
  splitNames.forEach(splitName => {
184
184
  const evaluation = getEvaluation(
185
185
  log,
186
- key,
187
186
  splits[splitName],
187
+ key,
188
188
  attributes,
189
189
  storage
190
190
  );
@@ -24,7 +24,6 @@ import { inListSemverMatcherContext } from './semver_inlist';
24
24
  import { IStorageAsync, IStorageSync } from '../../storages/types';
25
25
  import { IMatcher, IMatcherDto } from '../types';
26
26
  import { ILogger } from '../../logger/types';
27
- import { ruleBasedSegmentMatcherContext } from './rbsegment';
28
27
 
29
28
  const matchers = [
30
29
  undefined, // UNDEFINED: 0
@@ -51,7 +50,6 @@ const matchers = [
51
50
  betweenSemverMatcherContext, // BETWEEN_SEMVER: 21
52
51
  inListSemverMatcherContext, // IN_LIST_SEMVER: 22
53
52
  largeSegmentMatcherContext, // IN_LARGE_SEGMENT: 23
54
- ruleBasedSegmentMatcherContext // IN_RULE_BASED_SEGMENT: 24
55
53
  ];
56
54
 
57
55
  /**
@@ -66,5 +64,5 @@ export function matcherFactory(log: ILogger, matcherDto: IMatcherDto, storage?:
66
64
  let matcherFn;
67
65
  // @ts-ignore
68
66
  if (matchers[type]) matcherFn = matchers[type](value, storage, log); // There is no index-out-of-bound exception in JavaScript
69
- return matcherFn as IMatcher;
67
+ return matcherFn;
70
68
  }
@@ -23,7 +23,6 @@ export const matcherTypes: Record<string, number> = {
23
23
  BETWEEN_SEMVER: 21,
24
24
  IN_LIST_SEMVER: 22,
25
25
  IN_LARGE_SEGMENT: 23,
26
- IN_RULE_BASED_SEGMENT: 24,
27
26
  };
28
27
 
29
28
  export const matcherDataTypes = {
@@ -95,9 +95,6 @@ export function matchersTransform(matchers: ISplitMatcher[]): IMatcherDto[] {
95
95
  type === matcherTypes.LESS_THAN_OR_EQUAL_TO_SEMVER
96
96
  ) {
97
97
  value = stringMatcherData;
98
- } else if (type === matcherTypes.IN_RULE_BASED_SEGMENT) {
99
- value = segmentTransform(userDefinedSegmentMatcherData as IInSegmentMatcherData);
100
- dataType = matcherDataTypes.NOT_SPECIFIED;
101
98
  }
102
99
 
103
100
  return {
@@ -37,7 +37,7 @@ export function parser(log: ILogger, conditions: ISplitCondition[], storage: ISt
37
37
  }
38
38
 
39
39
  // Evaluator function.
40
- return (key: SplitIO.SplitKey, attributes?: SplitIO.Attributes, splitEvaluator?: ISplitEvaluator) => {
40
+ return (key: string, attributes: SplitIO.Attributes | undefined, splitEvaluator: ISplitEvaluator) => {
41
41
  const value = sanitizeValue(log, key, matcherDto, attributes);
42
42
  let result: MaybeThenable<boolean> = false;
43
43
 
@@ -71,12 +71,12 @@ export function parser(log: ILogger, conditions: ISplitCondition[], storage: ISt
71
71
  predicates.push(conditionContext(
72
72
  log,
73
73
  andCombinerContext(log, expressions),
74
- partitions && Treatments.parse(partitions),
74
+ Treatments.parse(partitions),
75
75
  label,
76
76
  conditionType
77
77
  ));
78
78
  }
79
79
 
80
- // Instantiate evaluator given the set of conditions using if else if logic
80
+ // Instanciate evaluator given the set of conditions using if else if logic
81
81
  return ifElseIfCombinerContext(log, predicates);
82
82
  }
@@ -29,6 +29,6 @@ export type IEvaluationResult = IEvaluation & { treatment: string; impressionsDi
29
29
 
30
30
  export type ISplitEvaluator = (log: ILogger, key: SplitIO.SplitKey, splitName: string, attributes: SplitIO.Attributes | undefined, storage: IStorageSync | IStorageAsync) => MaybeThenable<IEvaluation>
31
31
 
32
- export type IEvaluator = (key: SplitIO.SplitKeyObject, seed?: number, trafficAllocation?: number, trafficAllocationSeed?: number, attributes?: SplitIO.Attributes, splitEvaluator?: ISplitEvaluator) => MaybeThenable<IEvaluation | boolean | undefined>
32
+ export type IEvaluator = (key: SplitIO.SplitKey, seed: number, trafficAllocation?: number, trafficAllocationSeed?: number, attributes?: SplitIO.Attributes, splitEvaluator?: ISplitEvaluator) => MaybeThenable<IEvaluation | undefined>
33
33
 
34
- export type IMatcher = (value: string | number | boolean | string[] | IDependencyMatcherValue, splitEvaluator?: ISplitEvaluator) => MaybeThenable<boolean>
34
+ export type IMatcher = (...args: any) => MaybeThenable<boolean>
@@ -4,7 +4,7 @@ import { ILogger } from '../../logger/types';
4
4
  import { sanitize } from './sanitize';
5
5
  import { ENGINE_VALUE, ENGINE_VALUE_NO_ATTRIBUTES, ENGINE_VALUE_INVALID } from '../../logger/constants';
6
6
 
7
- function parseValue(log: ILogger, key: SplitIO.SplitKey, attributeName: string | null, attributes?: SplitIO.Attributes) {
7
+ function parseValue(log: ILogger, key: string, attributeName: string | null, attributes?: SplitIO.Attributes) {
8
8
  let value = undefined;
9
9
  if (attributeName) {
10
10
  if (attributes) {
@@ -23,7 +23,7 @@ function parseValue(log: ILogger, key: SplitIO.SplitKey, attributeName: string |
23
23
  /**
24
24
  * Defines value to be matched (key / attribute).
25
25
  */
26
- export function sanitizeValue(log: ILogger, key: SplitIO.SplitKey, matcherDto: IMatcherDto, attributes?: SplitIO.Attributes) {
26
+ export function sanitizeValue(log: ILogger, key: string, matcherDto: IMatcherDto, attributes?: SplitIO.Attributes) {
27
27
  const attributeName = matcherDto.attribute;
28
28
  const valueToMatch = parseValue(log, key, attributeName, attributes);
29
29
  const sanitizedValue = sanitize(log, matcherDto.type, valueToMatch, matcherDto.dataType, attributes);
@@ -41,7 +41,7 @@ function sanitizeBoolean(val: any): boolean | undefined {
41
41
  return undefined;
42
42
  }
43
43
 
44
- function dependencyProcessor(sanitizedValue: SplitIO.SplitKey, attributes?: SplitIO.Attributes): IDependencyMatcherValue {
44
+ function dependencyProcessor(sanitizedValue: string, attributes?: SplitIO.Attributes): IDependencyMatcherValue {
45
45
  return {
46
46
  key: sanitizedValue,
47
47
  attributes
@@ -60,7 +60,6 @@ function getProcessingFunction(matcherTypeID: number, dataType: string) {
60
60
  case matcherTypes.BETWEEN:
61
61
  return dataType === 'DATETIME' ? zeroSinceSS : undefined;
62
62
  case matcherTypes.IN_SPLIT_TREATMENT:
63
- case matcherTypes.IN_RULE_BASED_SEGMENT:
64
63
  return dependencyProcessor;
65
64
  default:
66
65
  return undefined;
@@ -70,9 +69,9 @@ function getProcessingFunction(matcherTypeID: number, dataType: string) {
70
69
  /**
71
70
  * Sanitize matcher value
72
71
  */
73
- export function sanitize(log: ILogger, matcherTypeID: number, value: string | number | boolean | Array<string | number> | SplitIO.SplitKey | undefined, dataType: string, attributes?: SplitIO.Attributes) {
72
+ export function sanitize(log: ILogger, matcherTypeID: number, value: string | number | boolean | Array<string | number> | undefined, dataType: string, attributes?: SplitIO.Attributes) {
74
73
  const processor = getProcessingFunction(matcherTypeID, dataType);
75
- let sanitizedValue: string | number | boolean | Array<string> | IDependencyMatcherValue | undefined;
74
+ let sanitizedValue: string | number | boolean | Array<string | number> | IDependencyMatcherValue | undefined;
76
75
 
77
76
  switch (dataType) {
78
77
  case matcherDataTypes.NUMBER:
@@ -89,7 +88,7 @@ export function sanitize(log: ILogger, matcherTypeID: number, value: string | nu
89
88
  sanitizedValue = sanitizeBoolean(value);
90
89
  break;
91
90
  case matcherDataTypes.NOT_SPECIFIED:
92
- sanitizedValue = value as any;
91
+ sanitizedValue = value;
93
92
  break;
94
93
  default:
95
94
  sanitizedValue = undefined;
@@ -21,7 +21,6 @@ export const RETRIEVE_MANAGER = 29;
21
21
  export const SYNC_OFFLINE_DATA = 30;
22
22
  export const SYNC_SPLITS_FETCH = 31;
23
23
  export const SYNC_SPLITS_UPDATE = 32;
24
- export const SYNC_RBS_UPDATE = 33;
25
24
  export const STREAMING_NEW_MESSAGE = 35;
26
25
  export const SYNC_TASK_START = 36;
27
26
  export const SYNC_TASK_EXECUTE = 37;
@@ -20,9 +20,8 @@ export const codesDebug: [number, string][] = codesInfo.concat([
20
20
  [c.RETRIEVE_MANAGER, 'Retrieving manager instance.'],
21
21
  // synchronizer
22
22
  [c.SYNC_OFFLINE_DATA, c.LOG_PREFIX_SYNC_OFFLINE + 'Feature flags data: \n%s'],
23
- [c.SYNC_SPLITS_FETCH, c.LOG_PREFIX_SYNC_SPLITS + 'Spin up feature flags update using since = %s and rbSince = %s.'],
24
- [c.SYNC_SPLITS_UPDATE, c.LOG_PREFIX_SYNC_SPLITS + 'New feature flags %s. Removed feature flags %s.'],
25
- [c.SYNC_RBS_UPDATE, c.LOG_PREFIX_SYNC_SPLITS + 'New rule-based segments %s. Removed rule-based segments %s.'],
23
+ [c.SYNC_SPLITS_FETCH, c.LOG_PREFIX_SYNC_SPLITS + 'Spin up feature flags update using since = %s'],
24
+ [c.SYNC_SPLITS_UPDATE, c.LOG_PREFIX_SYNC_SPLITS + 'New feature flags %s. Removed feature flags %s. Segment names collected %s'],
26
25
  [c.STREAMING_NEW_MESSAGE, c.LOG_PREFIX_SYNC_STREAMING + 'New SSE message received, with data: %s.'],
27
26
  [c.SYNC_TASK_START, c.LOG_PREFIX_SYNC + ': Starting %s. Running each %s millis'],
28
27
  [c.SYNC_TASK_EXECUTE, c.LOG_PREFIX_SYNC + ': Running %s'],
@@ -33,7 +33,7 @@ export const codesWarn: [number, string][] = codesError.concat([
33
33
  [c.WARN_SDK_KEY, c.LOG_PREFIX_SETTINGS + ': You already have %s. We recommend keeping only one instance of the factory at all times (Singleton pattern) and reusing it throughout your application'],
34
34
 
35
35
  [c.STREAMING_PARSING_MEMBERSHIPS_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching Memberships due to an error processing %s notification: %s'],
36
- [c.STREAMING_PARSING_SPLIT_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching SplitChanges due to an error processing %s notification: %s'],
36
+ [c.STREAMING_PARSING_SPLIT_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching SplitChanges due to an error processing SPLIT_UPDATE notification: %s'],
37
37
  [c.WARN_INVALID_FLAGSET, '%s: you passed %s, flag set must adhere to the regular expressions %s. This means a flag set must start with a letter or number, be in lowercase, alphanumeric and have a max length of 50 characters. %s was discarded.'],
38
38
  [c.WARN_LOWERCASE_FLAGSET, '%s: flag set %s should be all lowercase - converting string to lowercase.'],
39
39
  [c.WARN_FLAGSET_WITHOUT_FLAGS, '%s: you passed %s flag set that does not contain cached feature flag names. Please double check what flag sets are in use in the Split user interface.'],
@@ -17,7 +17,7 @@ function collectTreatments(splitObject: ISplit) {
17
17
  // Localstorage mode could fall into a no rollout conditions state. Take the first condition in that case.
18
18
  if (!allTreatmentsCondition) allTreatmentsCondition = conditions[0];
19
19
  // Then extract the treatments from the partitions
20
- return allTreatmentsCondition ? allTreatmentsCondition.partitions!.map(v => v.treatment) : [];
20
+ return allTreatmentsCondition ? allTreatmentsCondition.partitions.map(v => v.treatment) : [];
21
21
  }
22
22
 
23
23
  function objectToView(splitObject: ISplit | null): SplitIO.SplitView | null {
@@ -29,6 +29,7 @@ export function splitApiFactory(
29
29
  const urls = settings.urls;
30
30
  const filterQueryString = settings.sync.__splitFiltersValidation && settings.sync.__splitFiltersValidation.queryString;
31
31
  const SplitSDKImpressionsMode = settings.sync.impressionsMode;
32
+ const flagSpecVersion = settings.sync.flagSpecVersion;
32
33
  const splitHttpClient = splitHttpClientFactory(settings, platform);
33
34
 
34
35
  return {
@@ -44,7 +45,7 @@ export function splitApiFactory(
44
45
  },
45
46
 
46
47
  fetchAuth(userMatchingKeys?: string[]) {
47
- let url = `${urls.auth}/v2/auth?s=${settings.sync.flagSpecVersion}`;
48
+ let url = `${urls.auth}/v2/auth?s=${flagSpecVersion}`;
48
49
  if (userMatchingKeys) { // `userMatchingKeys` is undefined in server-side
49
50
  const queryParams = userMatchingKeys.map(userKeyToQueryParam).join('&');
50
51
  if (queryParams) url += '&' + queryParams;
@@ -52,8 +53,8 @@ export function splitApiFactory(
52
53
  return splitHttpClient(url, undefined, telemetryTracker.trackHttp(TOKEN));
53
54
  },
54
55
 
55
- fetchSplitChanges(since: number, noCache?: boolean, till?: number, rbSince?: number) {
56
- const url = `${urls.sdk}/splitChanges?s=${settings.sync.flagSpecVersion}&since=${since}${rbSince ? '&rbSince=' + rbSince : ''}${filterQueryString || ''}${till ? '&till=' + till : ''}`;
56
+ fetchSplitChanges(since: number, noCache?: boolean, till?: number) {
57
+ const url = `${urls.sdk}/splitChanges?s=${flagSpecVersion}&since=${since}${filterQueryString || ''}${till ? '&till=' + till : ''}`;
57
58
  return splitHttpClient(url, noCache ? noCacheHeaderOptions : undefined, telemetryTracker.trackHttp(SPLITS))
58
59
  .catch((err) => {
59
60
  if (err.statusCode === 414) settings.log.error(ERROR_TOO_MANY_SETS);
@@ -35,7 +35,7 @@ export type ISplitHttpClient = (url: string, options?: IRequestOptions, latencyT
35
35
 
36
36
  export type IFetchAuth = (userKeys?: string[]) => Promise<IResponse>
37
37
 
38
- export type IFetchSplitChanges = (since: number, noCache?: boolean, till?: number, rbSince?: number) => Promise<IResponse>
38
+ export type IFetchSplitChanges = (since: number, noCache?: boolean, till?: number) => Promise<IResponse>
39
39
 
40
40
  export type IFetchSegmentChanges = (since: number, segmentName: string, noCache?: boolean, till?: number) => Promise<IResponse>
41
41
 
@@ -1,5 +1,5 @@
1
1
  import { ISplitsCacheSync } from './types';
2
- import { IRBSegment, ISplit } from '../dtos/types';
2
+ import { ISplit } from '../dtos/types';
3
3
  import { objectAssign } from '../utils/lang/objectAssign';
4
4
  import { IN_SEGMENT, IN_LARGE_SEGMENT } from '../utils/constants';
5
5
 
@@ -72,8 +72,8 @@ export abstract class AbstractSplitsCacheSync implements ISplitsCacheSync {
72
72
  * Given a parsed split, it returns a boolean flagging if its conditions use segments matchers (rules & whitelists).
73
73
  * This util is intended to simplify the implementation of `splitsCache::usesSegments` method
74
74
  */
75
- export function usesSegments(ruleEntity: ISplit | IRBSegment) {
76
- const conditions = ruleEntity.conditions || [];
75
+ export function usesSegments(split: ISplit) {
76
+ const conditions = split.conditions || [];
77
77
  for (let i = 0; i < conditions.length; i++) {
78
78
  const matchers = conditions[i].matcherGroup.matchers;
79
79
 
@@ -83,8 +83,5 @@ export function usesSegments(ruleEntity: ISplit | IRBSegment) {
83
83
  }
84
84
  }
85
85
 
86
- const excluded = (ruleEntity as IRBSegment).excluded;
87
- if (excluded && excluded.segments && excluded.segments.length > 0) return true;
88
-
89
86
  return false;
90
87
  }
@@ -37,18 +37,6 @@ export class KeyBuilder {
37
37
  return `${this.prefix}.split.`;
38
38
  }
39
39
 
40
- buildRBSegmentKey(rbsegmentName: string) {
41
- return `${this.prefix}.rbsegment.${rbsegmentName}`;
42
- }
43
-
44
- buildRBSegmentsTillKey() {
45
- return `${this.prefix}.rbsegments.till`;
46
- }
47
-
48
- buildRBSegmentKeyPrefix() {
49
- return `${this.prefix}.rbsegment.`;
50
- }
51
-
52
40
  buildSegmentNameKey(segmentName: string) {
53
41
  return `${this.prefix}.segment.${segmentName}`;
54
42
  }
@@ -47,10 +47,6 @@ export class KeyBuilderCS extends KeyBuilder implements MySegmentsKeyBuilder {
47
47
  return startsWith(key, `${this.prefix}.split.`);
48
48
  }
49
49
 
50
- isRBSegmentKey(key: string) {
51
- return startsWith(key, `${this.prefix}.rbsegment.`);
52
- }
53
-
54
50
  buildSplitsWithSegmentCountKey() {
55
51
  return `${this.prefix}.splits.usingSegments`;
56
52
  }
@@ -53,10 +53,6 @@ export class KeyBuilderSS extends KeyBuilder {
53
53
  return `${this.buildSplitKeyPrefix()}*`;
54
54
  }
55
55
 
56
- searchPatternForRBSegmentKeys() {
57
- return `${this.buildRBSegmentKeyPrefix()}*`;
58
- }
59
-
60
56
  /* Telemetry keys */
61
57
 
62
58
  buildLatencyKey(method: Method, bucket: number) {
@@ -47,14 +47,16 @@ export class SplitsCacheInLocal extends AbstractSplitsCacheSync {
47
47
 
48
48
  private _incrementCounts(split: ISplit) {
49
49
  try {
50
- const ttKey = this.keys.buildTrafficTypeKey(split.trafficTypeName);
51
- // @ts-expect-error
52
- localStorage.setItem(ttKey, toNumber(localStorage.getItem(ttKey)) + 1);
53
-
54
- if (usesSegments(split)) {
55
- const segmentsCountKey = this.keys.buildSplitsWithSegmentCountKey();
50
+ if (split) {
51
+ const ttKey = this.keys.buildTrafficTypeKey(split.trafficTypeName);
56
52
  // @ts-expect-error
57
- localStorage.setItem(segmentsCountKey, toNumber(localStorage.getItem(segmentsCountKey)) + 1);
53
+ localStorage.setItem(ttKey, toNumber(localStorage.getItem(ttKey)) + 1);
54
+
55
+ if (usesSegments(split)) {
56
+ const segmentsCountKey = this.keys.buildSplitsWithSegmentCountKey();
57
+ // @ts-expect-error
58
+ localStorage.setItem(segmentsCountKey, toNumber(localStorage.getItem(segmentsCountKey)) + 1);
59
+ }
58
60
  }
59
61
  } catch (e) {
60
62
  this.log.error(LOG_PREFIX + e);
@@ -183,9 +185,11 @@ export class SplitsCacheInLocal extends AbstractSplitsCacheSync {
183
185
  const storedCount = localStorage.getItem(this.keys.buildSplitsWithSegmentCountKey());
184
186
  const splitsWithSegmentsCount = storedCount === null ? 0 : toNumber(storedCount);
185
187
 
186
- return isFiniteNumber(splitsWithSegmentsCount) ?
187
- splitsWithSegmentsCount > 0 :
188
- true;
188
+ if (isFiniteNumber(splitsWithSegmentsCount)) {
189
+ return splitsWithSegmentsCount > 0;
190
+ } else {
191
+ return true;
192
+ }
189
193
  }
190
194
 
191
195
  getNamesByFlagSets(flagSets: string[]): Set<string>[] {
@@ -6,7 +6,6 @@ import { validatePrefix } from '../KeyBuilder';
6
6
  import { KeyBuilderCS, myLargeSegmentsKeyBuilder } from '../KeyBuilderCS';
7
7
  import { isLocalStorageAvailable } from '../../utils/env/isLocalStorageAvailable';
8
8
  import { SplitsCacheInLocal } from './SplitsCacheInLocal';
9
- import { RBSegmentsCacheInLocal } from './RBSegmentsCacheInLocal';
10
9
  import { MySegmentsCacheInLocal } from './MySegmentsCacheInLocal';
11
10
  import { InMemoryStorageCSFactory } from '../inMemory/InMemoryStorageCS';
12
11
  import { LOG_PREFIX } from './constants';
@@ -37,13 +36,11 @@ export function InLocalStorage(options: SplitIO.InLocalStorageOptions = {}): ISt
37
36
  const keys = new KeyBuilderCS(prefix, matchingKey);
38
37
 
39
38
  const splits = new SplitsCacheInLocal(settings, keys);
40
- const rbSegments = new RBSegmentsCacheInLocal(settings, keys);
41
39
  const segments = new MySegmentsCacheInLocal(log, keys);
42
40
  const largeSegments = new MySegmentsCacheInLocal(log, myLargeSegmentsKeyBuilder(prefix, matchingKey));
43
41
 
44
42
  return {
45
43
  splits,
46
- rbSegments,
47
44
  segments,
48
45
  largeSegments,
49
46
  impressions: new ImpressionsCacheInMemory(impressionsQueueSize),
@@ -53,7 +50,7 @@ export function InLocalStorage(options: SplitIO.InLocalStorageOptions = {}): ISt
53
50
  uniqueKeys: new UniqueKeysCacheInMemoryCS(),
54
51
 
55
52
  validateCache() {
56
- return validateCache(options, settings, keys, splits, rbSegments, segments, largeSegments);
53
+ return validateCache(options, settings, keys, splits, segments, largeSegments);
57
54
  },
58
55
 
59
56
  destroy() { },
@@ -63,7 +60,6 @@ export function InLocalStorage(options: SplitIO.InLocalStorageOptions = {}): ISt
63
60
 
64
61
  return {
65
62
  splits: this.splits,
66
- rbSegments: this.rbSegments,
67
63
  segments: new MySegmentsCacheInLocal(log, new KeyBuilderCS(prefix, matchingKey)),
68
64
  largeSegments: new MySegmentsCacheInLocal(log, myLargeSegmentsKeyBuilder(prefix, matchingKey)),
69
65
  impressions: this.impressions,
@@ -3,7 +3,6 @@ import { isFiniteNumber, isNaNNumber } from '../../utils/lang';
3
3
  import { getStorageHash } from '../KeyBuilder';
4
4
  import { LOG_PREFIX } from './constants';
5
5
  import type { SplitsCacheInLocal } from './SplitsCacheInLocal';
6
- import type { RBSegmentsCacheInLocal } from './RBSegmentsCacheInLocal';
7
6
  import type { MySegmentsCacheInLocal } from './MySegmentsCacheInLocal';
8
7
  import { KeyBuilderCS } from '../KeyBuilderCS';
9
8
  import SplitIO from '../../../types/splitio';
@@ -67,14 +66,13 @@ function validateExpiration(options: SplitIO.InLocalStorageOptions, settings: IS
67
66
  *
68
67
  * @returns `true` if cache is ready to be used, `false` otherwise (cache was cleared or there is no cache)
69
68
  */
70
- export function validateCache(options: SplitIO.InLocalStorageOptions, settings: ISettings, keys: KeyBuilderCS, splits: SplitsCacheInLocal, rbSegments: RBSegmentsCacheInLocal, segments: MySegmentsCacheInLocal, largeSegments: MySegmentsCacheInLocal): boolean {
69
+ export function validateCache(options: SplitIO.InLocalStorageOptions, settings: ISettings, keys: KeyBuilderCS, splits: SplitsCacheInLocal, segments: MySegmentsCacheInLocal, largeSegments: MySegmentsCacheInLocal): boolean {
71
70
 
72
71
  const currentTimestamp = Date.now();
73
72
  const isThereCache = splits.getChangeNumber() > -1;
74
73
 
75
74
  if (validateExpiration(options, settings, keys, currentTimestamp, isThereCache)) {
76
75
  splits.clear();
77
- rbSegments.clear();
78
76
  segments.clear();
79
77
  largeSegments.clear();
80
78
 
@@ -7,7 +7,6 @@ import { ImpressionCountsCacheInMemory } from './ImpressionCountsCacheInMemory';
7
7
  import { LOCALHOST_MODE, STORAGE_MEMORY } from '../../utils/constants';
8
8
  import { shouldRecordTelemetry, TelemetryCacheInMemory } from './TelemetryCacheInMemory';
9
9
  import { UniqueKeysCacheInMemory } from './UniqueKeysCacheInMemory';
10
- import { RBSegmentsCacheInMemory } from './RBSegmentsCacheInMemory';
11
10
 
12
11
  /**
13
12
  * InMemory storage factory for standalone server-side SplitFactory
@@ -18,12 +17,10 @@ export function InMemoryStorageFactory(params: IStorageFactoryParams): IStorageS
18
17
  const { settings: { scheduler: { impressionsQueueSize, eventsQueueSize, }, sync: { __splitFiltersValidation } } } = params;
19
18
 
20
19
  const splits = new SplitsCacheInMemory(__splitFiltersValidation);
21
- const rbSegments = new RBSegmentsCacheInMemory();
22
20
  const segments = new SegmentsCacheInMemory();
23
21
 
24
22
  const storage = {
25
23
  splits,
26
- rbSegments,
27
24
  segments,
28
25
  impressions: new ImpressionsCacheInMemory(impressionsQueueSize),
29
26
  impressionCounts: new ImpressionCountsCacheInMemory(),
@@ -7,7 +7,6 @@ import { ImpressionCountsCacheInMemory } from './ImpressionCountsCacheInMemory';
7
7
  import { LOCALHOST_MODE, STORAGE_MEMORY } from '../../utils/constants';
8
8
  import { shouldRecordTelemetry, TelemetryCacheInMemory } from './TelemetryCacheInMemory';
9
9
  import { UniqueKeysCacheInMemoryCS } from './UniqueKeysCacheInMemoryCS';
10
- import { RBSegmentsCacheInMemory } from './RBSegmentsCacheInMemory';
11
10
 
12
11
  /**
13
12
  * InMemory storage factory for standalone client-side SplitFactory
@@ -18,13 +17,11 @@ export function InMemoryStorageCSFactory(params: IStorageFactoryParams): IStorag
18
17
  const { settings: { scheduler: { impressionsQueueSize, eventsQueueSize }, sync: { __splitFiltersValidation } } } = params;
19
18
 
20
19
  const splits = new SplitsCacheInMemory(__splitFiltersValidation);
21
- const rbSegments = new RBSegmentsCacheInMemory();
22
20
  const segments = new MySegmentsCacheInMemory();
23
21
  const largeSegments = new MySegmentsCacheInMemory();
24
22
 
25
23
  const storage = {
26
24
  splits,
27
- rbSegments,
28
25
  segments,
29
26
  largeSegments,
30
27
  impressions: new ImpressionsCacheInMemory(impressionsQueueSize),
@@ -39,7 +36,6 @@ export function InMemoryStorageCSFactory(params: IStorageFactoryParams): IStorag
39
36
  shared() {
40
37
  return {
41
38
  splits: this.splits,
42
- rbSegments: this.rbSegments,
43
39
  segments: new MySegmentsCacheInMemory(),
44
40
  largeSegments: new MySegmentsCacheInMemory(),
45
41
  impressions: this.impressions,
@@ -11,30 +11,35 @@ import { TelemetryCacheInRedis } from './TelemetryCacheInRedis';
11
11
  import { UniqueKeysCacheInRedis } from './UniqueKeysCacheInRedis';
12
12
  import { ImpressionCountsCacheInRedis } from './ImpressionCountsCacheInRedis';
13
13
  import { metadataBuilder } from '../utils';
14
- import { RBSegmentsCacheInRedis } from './RBSegmentsCacheInRedis';
15
14
 
16
15
  export interface InRedisStorageOptions {
17
16
  prefix?: string
18
17
  options?: Record<string, any>
19
18
  }
20
19
 
20
+ let RD: typeof RedisAdapter | undefined;
21
+
22
+ try {
23
+ // Using `require` to prevent error when bundling or importing the SDK in a .mjs file, since ioredis is a CommonJS module.
24
+ // Redis storage is not supported with .mjs files.
25
+ RD = require('./RedisAdapter').RedisAdapter;
26
+ } catch (error) { /* empty */ }
27
+
21
28
  /**
22
29
  * InRedis storage factory for consumer server-side SplitFactory, that uses `Ioredis` Redis client for Node.js
23
30
  * @see {@link https://www.npmjs.com/package/ioredis}
24
31
  */
25
32
  export function InRedisStorage(options: InRedisStorageOptions = {}): IStorageAsyncFactory {
26
33
 
27
- // Lazy loading to prevent error when bundling or importing the SDK in a .mjs file, since ioredis is a CommonJS module.
28
- // Redis storage is not supported with .mjs files.
29
- const RD = require('./RedisAdapter').RedisAdapter;
30
-
31
34
  const prefix = validatePrefix(options.prefix);
32
35
 
33
36
  function InRedisStorageFactory(params: IStorageFactoryParams): IStorageAsync {
37
+ if (!RD) throw new Error('The SDK Redis storage is not available. Your runtime environment must support CommonJS (`require`) to import the ioredis dependency.');
38
+
34
39
  const { onReadyCb, settings, settings: { log } } = params;
35
40
  const metadata = metadataBuilder(settings);
36
41
  const keys = new KeyBuilderSS(prefix, metadata);
37
- const redisClient: RedisAdapter = new RD(log, options.options || {});
42
+ const redisClient = new RD(log, options.options || {});
38
43
  const telemetry = new TelemetryCacheInRedis(log, keys, redisClient);
39
44
  const impressionCountsCache = new ImpressionCountsCacheInRedis(log, keys.buildImpressionsCountKey(), redisClient);
40
45
  const uniqueKeysCache = new UniqueKeysCacheInRedis(log, keys.buildUniqueKeysKey(), redisClient);
@@ -51,7 +56,6 @@ export function InRedisStorage(options: InRedisStorageOptions = {}): IStorageAsy
51
56
 
52
57
  return {
53
58
  splits: new SplitsCacheInRedis(log, keys, redisClient, settings.sync.__splitFiltersValidation),
54
- rbSegments: new RBSegmentsCacheInRedis(log, keys, redisClient),
55
59
  segments: new SegmentsCacheInRedis(log, keys, redisClient),
56
60
  impressions: new ImpressionsCacheInRedis(log, keys.buildImpressionsKey(), redisClient, metadata),
57
61
  impressionCounts: impressionCountsCache,
@@ -20,7 +20,6 @@ import { UniqueKeysCacheInMemory } from '../inMemory/UniqueKeysCacheInMemory';
20
20
  import { UniqueKeysCacheInMemoryCS } from '../inMemory/UniqueKeysCacheInMemoryCS';
21
21
  import { metadataBuilder } from '../utils';
22
22
  import { LOG_PREFIX } from '../pluggable/constants';
23
- import { RBSegmentsCachePluggable } from './RBSegmentsCachePluggable';
24
23
 
25
24
  const NO_VALID_WRAPPER = 'Expecting pluggable storage `wrapper` in options, but no valid wrapper instance was provided.';
26
25
  const NO_VALID_WRAPPER_INTERFACE = 'The provided wrapper instance doesn’t follow the expected interface. Check our docs.';
@@ -118,7 +117,6 @@ export function PluggableStorage(options: PluggableStorageOptions): IStorageAsyn
118
117
 
119
118
  return {
120
119
  splits: new SplitsCachePluggable(log, keys, wrapper, settings.sync.__splitFiltersValidation),
121
- rbSegments: new RBSegmentsCachePluggable(log, keys, wrapper),
122
120
  segments: new SegmentsCachePluggable(log, keys, wrapper),
123
121
  impressions: isPartialConsumer ? new ImpressionsCacheInMemory(impressionsQueueSize) : new ImpressionsCachePluggable(log, keys.buildImpressionsKey(), wrapper, metadata),
124
122
  impressionCounts: impressionCountsCache,