@splitsoftware/splitio-commons 2.1.1-rc.0 → 2.1.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 (187) hide show
  1. package/CHANGES.txt +7 -0
  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/error.js +1 -1
  15. package/cjs/logger/messages/warn.js +2 -2
  16. package/cjs/readiness/readinessManager.js +6 -0
  17. package/cjs/sdkClient/client.js +29 -19
  18. package/cjs/sdkClient/clientAttributesDecoration.js +19 -25
  19. package/cjs/sdkClient/clientInputValidation.js +28 -26
  20. package/cjs/services/splitApi.js +2 -2
  21. package/cjs/storages/AbstractSplitsCacheAsync.js +0 -7
  22. package/cjs/storages/AbstractSplitsCacheSync.js +2 -12
  23. package/cjs/storages/KeyBuilder.js +0 -9
  24. package/cjs/storages/KeyBuilderCS.js +4 -4
  25. package/cjs/storages/KeyBuilderSS.js +0 -3
  26. package/cjs/storages/dataLoader.js +3 -2
  27. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +23 -76
  28. package/cjs/storages/inLocalStorage/index.js +5 -7
  29. package/cjs/storages/inLocalStorage/validateCache.js +79 -0
  30. package/cjs/storages/inMemory/InMemoryStorage.js +0 -3
  31. package/cjs/storages/inMemory/InMemoryStorageCS.js +0 -4
  32. package/cjs/storages/inRedis/index.js +0 -2
  33. package/cjs/storages/pluggable/index.js +2 -3
  34. package/cjs/storages/utils.js +1 -0
  35. package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +3 -2
  36. package/cjs/sync/polling/fetchers/splitChangesFetcher.js +2 -2
  37. package/cjs/sync/polling/pollingManagerCS.js +7 -7
  38. package/cjs/sync/polling/updaters/mySegmentsUpdater.js +2 -2
  39. package/cjs/sync/polling/updaters/segmentChangesUpdater.js +1 -1
  40. package/cjs/sync/polling/updaters/splitChangesUpdater.js +33 -60
  41. package/cjs/sync/streaming/SSEHandler/index.js +0 -1
  42. package/cjs/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +77 -106
  43. package/cjs/sync/streaming/constants.js +1 -2
  44. package/cjs/sync/streaming/pushManager.js +16 -3
  45. package/cjs/sync/submitters/impressionsSubmitter.js +3 -2
  46. package/cjs/sync/syncManagerOnline.js +10 -5
  47. package/cjs/trackers/strategy/strategyDebug.js +2 -0
  48. package/cjs/trackers/strategy/strategyOptimized.js +3 -0
  49. package/cjs/utils/constants/index.js +2 -3
  50. package/cjs/utils/inputValidation/eventProperties.js +12 -1
  51. package/cjs/utils/inputValidation/index.js +3 -1
  52. package/cjs/utils/settingsValidation/storage/storageCS.js +1 -1
  53. package/esm/evaluator/combiners/and.js +6 -2
  54. package/esm/evaluator/combiners/ifelseif.js +7 -7
  55. package/esm/evaluator/condition/index.js +5 -6
  56. package/esm/evaluator/index.js +7 -7
  57. package/esm/evaluator/matchers/index.js +1 -3
  58. package/esm/evaluator/matchers/matcherTypes.js +0 -1
  59. package/esm/evaluator/matchersTransform/index.js +0 -4
  60. package/esm/evaluator/parser/index.js +2 -2
  61. package/esm/evaluator/value/sanitize.js +0 -1
  62. package/esm/logger/constants.js +0 -1
  63. package/esm/logger/messages/debug.js +2 -3
  64. package/esm/logger/messages/error.js +1 -1
  65. package/esm/logger/messages/warn.js +2 -2
  66. package/esm/readiness/readinessManager.js +6 -0
  67. package/esm/sdkClient/client.js +29 -19
  68. package/esm/sdkClient/clientAttributesDecoration.js +19 -25
  69. package/esm/sdkClient/clientInputValidation.js +29 -27
  70. package/esm/services/splitApi.js +2 -2
  71. package/esm/storages/AbstractSplitsCacheAsync.js +0 -7
  72. package/esm/storages/AbstractSplitsCacheSync.js +2 -12
  73. package/esm/storages/KeyBuilder.js +0 -9
  74. package/esm/storages/KeyBuilderCS.js +4 -4
  75. package/esm/storages/KeyBuilderSS.js +0 -3
  76. package/esm/storages/dataLoader.js +2 -1
  77. package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +23 -76
  78. package/esm/storages/inLocalStorage/index.js +5 -7
  79. package/esm/storages/inLocalStorage/validateCache.js +75 -0
  80. package/esm/storages/inMemory/InMemoryStorage.js +0 -3
  81. package/esm/storages/inMemory/InMemoryStorageCS.js +0 -4
  82. package/esm/storages/inRedis/index.js +0 -2
  83. package/esm/storages/pluggable/index.js +2 -3
  84. package/esm/storages/utils.js +1 -0
  85. package/esm/sync/offline/syncTasks/fromObjectSyncTask.js +3 -2
  86. package/esm/sync/polling/fetchers/splitChangesFetcher.js +2 -2
  87. package/esm/sync/polling/pollingManagerCS.js +7 -7
  88. package/esm/sync/polling/updaters/mySegmentsUpdater.js +2 -2
  89. package/esm/sync/polling/updaters/segmentChangesUpdater.js +1 -1
  90. package/esm/sync/polling/updaters/splitChangesUpdater.js +34 -61
  91. package/esm/sync/streaming/SSEHandler/index.js +1 -2
  92. package/esm/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +73 -102
  93. package/esm/sync/streaming/constants.js +0 -1
  94. package/esm/sync/streaming/pushManager.js +19 -6
  95. package/esm/sync/submitters/impressionsSubmitter.js +3 -2
  96. package/esm/sync/syncManagerOnline.js +10 -5
  97. package/esm/trackers/strategy/strategyDebug.js +2 -0
  98. package/esm/trackers/strategy/strategyOptimized.js +3 -0
  99. package/esm/utils/constants/index.js +1 -2
  100. package/esm/utils/inputValidation/eventProperties.js +10 -0
  101. package/esm/utils/inputValidation/index.js +1 -0
  102. package/esm/utils/settingsValidation/storage/storageCS.js +1 -1
  103. package/package.json +1 -1
  104. package/src/dtos/types.ts +8 -32
  105. package/src/evaluator/Engine.ts +1 -1
  106. package/src/evaluator/combiners/and.ts +4 -5
  107. package/src/evaluator/combiners/ifelseif.ts +9 -7
  108. package/src/evaluator/condition/engineUtils.ts +1 -1
  109. package/src/evaluator/condition/index.ts +12 -12
  110. package/src/evaluator/index.ts +7 -7
  111. package/src/evaluator/matchers/index.ts +1 -3
  112. package/src/evaluator/matchers/matcherTypes.ts +0 -1
  113. package/src/evaluator/matchersTransform/index.ts +0 -3
  114. package/src/evaluator/parser/index.ts +3 -3
  115. package/src/evaluator/types.ts +2 -2
  116. package/src/evaluator/value/index.ts +2 -2
  117. package/src/evaluator/value/sanitize.ts +4 -5
  118. package/src/logger/constants.ts +0 -1
  119. package/src/logger/messages/debug.ts +2 -3
  120. package/src/logger/messages/error.ts +1 -1
  121. package/src/logger/messages/warn.ts +2 -2
  122. package/src/readiness/readinessManager.ts +5 -0
  123. package/src/sdkClient/client.ts +31 -21
  124. package/src/sdkClient/clientAttributesDecoration.ts +20 -27
  125. package/src/sdkClient/clientInputValidation.ts +30 -27
  126. package/src/sdkManager/index.ts +1 -1
  127. package/src/services/splitApi.ts +2 -2
  128. package/src/services/types.ts +1 -1
  129. package/src/storages/AbstractSplitsCacheAsync.ts +0 -8
  130. package/src/storages/AbstractSplitsCacheSync.ts +3 -14
  131. package/src/storages/KeyBuilder.ts +0 -12
  132. package/src/storages/KeyBuilderCS.ts +5 -5
  133. package/src/storages/KeyBuilderSS.ts +0 -4
  134. package/src/storages/dataLoader.ts +3 -1
  135. package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +26 -87
  136. package/src/storages/inLocalStorage/index.ts +8 -12
  137. package/src/storages/inLocalStorage/validateCache.ts +91 -0
  138. package/src/storages/inMemory/InMemoryStorage.ts +0 -3
  139. package/src/storages/inMemory/InMemoryStorageCS.ts +0 -4
  140. package/src/storages/inRedis/index.ts +0 -2
  141. package/src/storages/pluggable/index.ts +2 -3
  142. package/src/storages/types.ts +2 -37
  143. package/src/storages/utils.ts +1 -0
  144. package/src/sync/offline/syncTasks/fromObjectSyncTask.ts +6 -5
  145. package/src/sync/polling/fetchers/splitChangesFetcher.ts +1 -2
  146. package/src/sync/polling/fetchers/types.ts +0 -1
  147. package/src/sync/polling/pollingManagerCS.ts +7 -7
  148. package/src/sync/polling/types.ts +2 -2
  149. package/src/sync/polling/updaters/mySegmentsUpdater.ts +2 -2
  150. package/src/sync/polling/updaters/segmentChangesUpdater.ts +1 -1
  151. package/src/sync/polling/updaters/splitChangesUpdater.ts +43 -71
  152. package/src/sync/streaming/SSEHandler/index.ts +1 -2
  153. package/src/sync/streaming/SSEHandler/types.ts +2 -2
  154. package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +68 -98
  155. package/src/sync/streaming/constants.ts +0 -1
  156. package/src/sync/streaming/parseUtils.ts +2 -2
  157. package/src/sync/streaming/pushManager.ts +18 -6
  158. package/src/sync/streaming/types.ts +2 -3
  159. package/src/sync/submitters/impressionsSubmitter.ts +3 -2
  160. package/src/sync/submitters/types.ts +23 -33
  161. package/src/sync/syncManagerOnline.ts +11 -5
  162. package/src/trackers/strategy/strategyDebug.ts +2 -0
  163. package/src/trackers/strategy/strategyOptimized.ts +3 -0
  164. package/src/utils/constants/index.ts +1 -2
  165. package/src/utils/inputValidation/eventProperties.ts +10 -0
  166. package/src/utils/inputValidation/index.ts +1 -0
  167. package/src/utils/lang/index.ts +2 -2
  168. package/src/utils/settingsValidation/storage/storageCS.ts +1 -1
  169. package/types/splitio.d.ts +128 -36
  170. package/cjs/evaluator/matchers/rbsegment.js +0 -43
  171. package/cjs/storages/inLocalStorage/RBSegmentsCacheInLocal.js +0 -117
  172. package/cjs/storages/inMemory/RBSegmentsCacheInMemory.js +0 -61
  173. package/cjs/storages/inRedis/RBSegmentsCacheInRedis.js +0 -64
  174. package/cjs/storages/pluggable/RBSegmentsCachePluggable.js +0 -64
  175. package/cjs/utils/constants/browser.js +0 -5
  176. package/esm/evaluator/matchers/rbsegment.js +0 -39
  177. package/esm/storages/inLocalStorage/RBSegmentsCacheInLocal.js +0 -114
  178. package/esm/storages/inMemory/RBSegmentsCacheInMemory.js +0 -58
  179. package/esm/storages/inRedis/RBSegmentsCacheInRedis.js +0 -61
  180. package/esm/storages/pluggable/RBSegmentsCachePluggable.js +0 -61
  181. package/esm/utils/constants/browser.js +0 -2
  182. package/src/evaluator/matchers/rbsegment.ts +0 -61
  183. package/src/storages/inLocalStorage/RBSegmentsCacheInLocal.ts +0 -136
  184. package/src/storages/inMemory/RBSegmentsCacheInMemory.ts +0 -68
  185. package/src/storages/inRedis/RBSegmentsCacheInRedis.ts +0 -79
  186. package/src/storages/pluggable/RBSegmentsCachePluggable.ts +0 -76
  187. package/src/utils/constants/browser.ts +0 -2
@@ -1,4 +1,4 @@
1
- import { findIndex, isBoolean } from '../../utils/lang';
1
+ import { findIndex } from '../../utils/lang';
2
2
  import { thenable } from '../../utils/promise/thenable';
3
3
  import { UNSUPPORTED_MATCHER_TYPE } from '../../utils/labels';
4
4
  import { CONTROL } from '../../utils/constants';
@@ -11,12 +11,12 @@ export function ifElseIfCombinerContext(log, predicates) {
11
11
  label: UNSUPPORTED_MATCHER_TYPE
12
12
  };
13
13
  }
14
- function computeEvaluation(predicateResults) {
15
- for (var i = 0, len = predicateResults.length; i < len; i++) {
14
+ function computeTreatment(predicateResults) {
15
+ var len = predicateResults.length;
16
+ for (var i = 0; i < len; i++) {
16
17
  var evaluation = predicateResults[i];
17
18
  if (evaluation !== undefined) {
18
- if (!isBoolean(evaluation))
19
- log.debug(ENGINE_COMBINER_IFELSEIF, [evaluation.treatment]);
19
+ log.debug(ENGINE_COMBINER_IFELSEIF, [evaluation.treatment]);
20
20
  return evaluation;
21
21
  }
22
22
  }
@@ -30,9 +30,9 @@ export function ifElseIfCombinerContext(log, predicates) {
30
30
  var predicateResults = predicates.map(function (evaluator) { return evaluator(key, seed, trafficAllocation, trafficAllocationSeed, attributes, splitEvaluator); });
31
31
  // if we find a thenable
32
32
  if (findIndex(predicateResults, thenable) !== -1) {
33
- return Promise.all(predicateResults).then(function (results) { return computeEvaluation(results); });
33
+ return Promise.all(predicateResults).then(function (results) { return computeTreatment(results); });
34
34
  }
35
- return computeEvaluation(predicateResults);
35
+ return computeTreatment(predicateResults);
36
36
  }
37
37
  // if there is none predicates, then there was an error in parsing phase
38
38
  if (!Array.isArray(predicates) || predicates.length === 0) {
@@ -4,12 +4,11 @@ import { NOT_IN_SPLIT } from '../../utils/labels';
4
4
  // Build Evaluation object if and only if matchingResult is true
5
5
  function match(log, matchingResult, bucketingKey, seed, treatments, label) {
6
6
  if (matchingResult) {
7
- return treatments ? // Feature flag
8
- {
9
- treatment: getTreatment(log, bucketingKey, seed, treatments),
10
- label: label
11
- } : // Rule-based segment
12
- true;
7
+ var treatment = getTreatment(log, bucketingKey, seed, treatments);
8
+ return {
9
+ treatment: treatment,
10
+ label: label
11
+ };
13
12
  }
14
13
  // else we should notify the engine to continue evaluating
15
14
  return undefined;
@@ -26,12 +26,12 @@ export function evaluateFeature(log, key, splitName, attributes, storage) {
26
26
  return treatmentException;
27
27
  }
28
28
  if (thenable(parsedSplit)) {
29
- return parsedSplit.then(function (split) { return getEvaluation(log, key, split, attributes, storage); }).catch(
29
+ return parsedSplit.then(function (split) { return getEvaluation(log, split, key, attributes, storage); }).catch(
30
30
  // Exception on async `getSplit` storage. For example, when the storage is redis or
31
31
  // pluggable and there is a connection issue and we can't retrieve the split to be evaluated
32
32
  function () { return treatmentException; });
33
33
  }
34
- return getEvaluation(log, key, parsedSplit, attributes, storage);
34
+ return getEvaluation(log, parsedSplit, key, attributes, storage);
35
35
  }
36
36
  export function evaluateFeatures(log, key, splitNames, attributes, storage) {
37
37
  var parsedSplits;
@@ -43,13 +43,13 @@ export function evaluateFeatures(log, key, splitNames, attributes, storage) {
43
43
  return treatmentsException(splitNames);
44
44
  }
45
45
  return thenable(parsedSplits) ?
46
- parsedSplits.then(function (splits) { return getEvaluations(log, key, splitNames, splits, attributes, storage); })
46
+ parsedSplits.then(function (splits) { return getEvaluations(log, splitNames, splits, key, attributes, storage); })
47
47
  .catch(function () {
48
48
  // Exception on async `getSplits` storage. For example, when the storage is redis or
49
49
  // pluggable and there is a connection issue and we can't retrieve the split to be evaluated
50
50
  return treatmentsException(splitNames);
51
51
  }) :
52
- getEvaluations(log, key, splitNames, parsedSplits, attributes, storage);
52
+ getEvaluations(log, splitNames, parsedSplits, key, attributes, storage);
53
53
  }
54
54
  export function evaluateFeaturesByFlagSets(log, key, flagSets, attributes, storage, method) {
55
55
  var storedFlagNames;
@@ -84,7 +84,7 @@ export function evaluateFeaturesByFlagSets(log, key, flagSets, attributes, stora
84
84
  }) :
85
85
  evaluate(storedFlagNames);
86
86
  }
87
- function getEvaluation(log, key, splitJSON, attributes, storage) {
87
+ function getEvaluation(log, splitJSON, key, attributes, storage) {
88
88
  var evaluation = {
89
89
  treatment: CONTROL,
90
90
  label: SPLIT_NOT_FOUND,
@@ -110,11 +110,11 @@ function getEvaluation(log, key, splitJSON, attributes, storage) {
110
110
  }
111
111
  return evaluation;
112
112
  }
113
- function getEvaluations(log, key, splitNames, splits, attributes, storage) {
113
+ function getEvaluations(log, splitNames, splits, key, attributes, storage) {
114
114
  var result = {};
115
115
  var thenables = [];
116
116
  splitNames.forEach(function (splitName) {
117
- var evaluation = getEvaluation(log, key, splits[splitName], attributes, storage);
117
+ var evaluation = getEvaluation(log, splits[splitName], key, attributes, storage);
118
118
  if (thenable(evaluation)) {
119
119
  thenables.push(evaluation.then(function (res) {
120
120
  result[splitName] = res;
@@ -21,7 +21,6 @@ import { greaterThanEqualToSemverMatcherContext } from './semver_gte';
21
21
  import { lessThanEqualToSemverMatcherContext } from './semver_lte';
22
22
  import { betweenSemverMatcherContext } from './semver_between';
23
23
  import { inListSemverMatcherContext } from './semver_inlist';
24
- import { ruleBasedSegmentMatcherContext } from './rbsegment';
25
24
  var matchers = [
26
25
  undefined,
27
26
  allMatcherContext,
@@ -46,8 +45,7 @@ var matchers = [
46
45
  lessThanEqualToSemverMatcherContext,
47
46
  betweenSemverMatcherContext,
48
47
  inListSemverMatcherContext,
49
- largeSegmentMatcherContext,
50
- ruleBasedSegmentMatcherContext // IN_RULE_BASED_SEGMENT: 24
48
+ largeSegmentMatcherContext, // IN_LARGE_SEGMENT: 23
51
49
  ];
52
50
  /**
53
51
  * Matcher factory.
@@ -23,7 +23,6 @@ export var matcherTypes = {
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
  export var matcherDataTypes = {
29
28
  BOOLEAN: 'BOOLEAN',
@@ -78,10 +78,6 @@ export function matchersTransform(matchers) {
78
78
  type === matcherTypes.LESS_THAN_OR_EQUAL_TO_SEMVER) {
79
79
  value = stringMatcherData;
80
80
  }
81
- else if (type === matcherTypes.IN_RULE_BASED_SEGMENT) {
82
- value = segmentTransform(userDefinedSegmentMatcherData);
83
- dataType = matcherDataTypes.NOT_SPECIFIED;
84
- }
85
81
  return {
86
82
  attribute: attribute,
87
83
  negate: negate,
@@ -50,8 +50,8 @@ export function parser(log, conditions, storage) {
50
50
  // and break the loop
51
51
  break;
52
52
  }
53
- predicates.push(conditionContext(log, andCombinerContext(log, expressions), partitions && Treatments.parse(partitions), label, conditionType));
53
+ predicates.push(conditionContext(log, andCombinerContext(log, expressions), Treatments.parse(partitions), label, conditionType));
54
54
  }
55
- // Instantiate evaluator given the set of conditions using if else if logic
55
+ // Instanciate evaluator given the set of conditions using if else if logic
56
56
  return ifElseIfCombinerContext(log, predicates);
57
57
  }
@@ -49,7 +49,6 @@ function getProcessingFunction(matcherTypeID, dataType) {
49
49
  case matcherTypes.BETWEEN:
50
50
  return dataType === 'DATETIME' ? zeroSinceSS : undefined;
51
51
  case matcherTypes.IN_SPLIT_TREATMENT:
52
- case matcherTypes.IN_RULE_BASED_SEGMENT:
53
52
  return dependencyProcessor;
54
53
  default:
55
54
  return undefined;
@@ -21,7 +21,6 @@ export var RETRIEVE_MANAGER = 29;
21
21
  export var SYNC_OFFLINE_DATA = 30;
22
22
  export var SYNC_SPLITS_FETCH = 31;
23
23
  export var SYNC_SPLITS_UPDATE = 32;
24
- export var SYNC_RBS_UPDATE = 33;
25
24
  export var STREAMING_NEW_MESSAGE = 35;
26
25
  export var SYNC_TASK_START = 36;
27
26
  export var SYNC_TASK_EXECUTE = 37;
@@ -19,9 +19,8 @@ export var codesDebug = codesInfo.concat([
19
19
  [c.RETRIEVE_MANAGER, 'Retrieving manager instance.'],
20
20
  // synchronizer
21
21
  [c.SYNC_OFFLINE_DATA, c.LOG_PREFIX_SYNC_OFFLINE + 'Feature flags data: \n%s'],
22
- [c.SYNC_SPLITS_FETCH, c.LOG_PREFIX_SYNC_SPLITS + 'Spin up feature flags update using since = %s and rbSince = %s.'],
23
- [c.SYNC_SPLITS_UPDATE, c.LOG_PREFIX_SYNC_SPLITS + 'New feature flags %s. Removed feature flags %s.'],
24
- [c.SYNC_RBS_UPDATE, c.LOG_PREFIX_SYNC_SPLITS + 'New rule-based segments %s. Removed rule-based segments %s.'],
22
+ [c.SYNC_SPLITS_FETCH, c.LOG_PREFIX_SYNC_SPLITS + 'Spin up feature flags update using since = %s'],
23
+ [c.SYNC_SPLITS_UPDATE, c.LOG_PREFIX_SYNC_SPLITS + 'New feature flags %s. Removed feature flags %s. Segment names collected %s'],
25
24
  [c.STREAMING_NEW_MESSAGE, c.LOG_PREFIX_SYNC_STREAMING + 'New SSE message received, with data: %s.'],
26
25
  [c.SYNC_TASK_START, c.LOG_PREFIX_SYNC + ': Starting %s. Running each %s millis'],
27
26
  [c.SYNC_TASK_EXECUTE, c.LOG_PREFIX_SYNC + ': Running %s'],
@@ -20,7 +20,7 @@ export var codesError = [
20
20
  // input validation
21
21
  [c.ERROR_EVENT_TYPE_FORMAT, '%s: you passed "%s", event_type must adhere to the regular expression /^[a-zA-Z0-9][-_.:a-zA-Z0-9]{0,79}$/g. This means an event_type must be alphanumeric, cannot be more than 80 characters long, and can only include a dash, underscore, period, or colon as separators of alphanumeric characters.'],
22
22
  [c.ERROR_NOT_PLAIN_OBJECT, '%s: %s must be a plain object.'],
23
- [c.ERROR_SIZE_EXCEEDED, '%s: the maximum size allowed for the properties is 32768 bytes, which was exceeded. Event not queued.'],
23
+ [c.ERROR_SIZE_EXCEEDED, '%s: the maximum size allowed for the properties is 32768 bytes, which was exceeded.'],
24
24
  [c.ERROR_NOT_FINITE, '%s: value must be a finite number.'],
25
25
  [c.ERROR_NULL, '%s: you passed a null or undefined %s. It must be a non-empty string.'],
26
26
  [c.ERROR_TOO_LONG, '%s: %s too long. It must have 250 characters or less.'],
@@ -17,7 +17,7 @@ export var codesWarn = codesError.concat([
17
17
  [c.CLIENT_NO_LISTENER, 'No listeners for SDK Readiness detected. Incorrect control treatments could have been logged if you called getTreatment/s while the SDK was not yet ready.'],
18
18
  // input validation
19
19
  [c.WARN_SETTING_NULL, '%s: Property "%s" is of invalid type. Setting value to null.'],
20
- [c.WARN_TRIMMING_PROPERTIES, '%s: Event has more than 300 properties. Some of them will be trimmed when processed.'],
20
+ [c.WARN_TRIMMING_PROPERTIES, '%s: more than 300 properties were provided. Some of them will be trimmed when processed.'],
21
21
  [c.WARN_CONVERTING, '%s: %s "%s" is not of type string, converting.'],
22
22
  [c.WARN_TRIMMING, '%s: %s "%s" has extra whitespace, trimming.'],
23
23
  [c.WARN_NOT_EXISTENT_SPLIT, '%s: feature flag "%s" does not exist in this environment. Please double check what feature flags exist in the Split user interface.'],
@@ -31,7 +31,7 @@ export var codesWarn = codesError.concat([
31
31
  [c.WARN_SPLITS_FILTER_EMPTY, c.LOG_PREFIX_SETTINGS + ': feature flag filter configuration must be a non-empty array of filter objects.'],
32
32
  [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'],
33
33
  [c.STREAMING_PARSING_MEMBERSHIPS_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching Memberships due to an error processing %s notification: %s'],
34
- [c.STREAMING_PARSING_SPLIT_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching SplitChanges due to an error processing %s notification: %s'],
34
+ [c.STREAMING_PARSING_SPLIT_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching SplitChanges due to an error processing SPLIT_UPDATE notification: %s'],
35
35
  [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.'],
36
36
  [c.WARN_LOWERCASE_FLAGSET, '%s: flag set %s should be all lowercase - converting string to lowercase.'],
37
37
  [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.'],
@@ -1,5 +1,6 @@
1
1
  import { objectAssign } from '../utils/lang/objectAssign';
2
2
  import { SDK_SPLITS_ARRIVED, SDK_SPLITS_CACHE_LOADED, SDK_SEGMENTS_ARRIVED, SDK_READY_TIMED_OUT, SDK_READY_FROM_CACHE, SDK_UPDATE, SDK_READY } from './constants';
3
+ import { STORAGE_LOCALSTORAGE } from '../utils/constants';
3
4
  function splitsEventEmitterFactory(EventEmitter) {
4
5
  var splitsEventEmitter = objectAssign(new EventEmitter(), {
5
6
  splitsArrived: false,
@@ -80,6 +81,7 @@ export function readinessManagerFactory(EventEmitter, settings, splits, isShared
80
81
  }
81
82
  }
82
83
  function checkIsReadyOrUpdate(diff) {
84
+ var _a;
83
85
  if (isDestroyed)
84
86
  return;
85
87
  if (isReady) {
@@ -98,6 +100,10 @@ export function readinessManagerFactory(EventEmitter, settings, splits, isShared
98
100
  isReady = true;
99
101
  try {
100
102
  syncLastUpdate();
103
+ if (!isReadyFromCache && ((_a = settings.storage) === null || _a === void 0 ? void 0 : _a.type) === STORAGE_LOCALSTORAGE) {
104
+ isReadyFromCache = true;
105
+ gate.emit(SDK_READY_FROM_CACHE);
106
+ }
101
107
  gate.emit(SDK_READY);
102
108
  }
103
109
  catch (e) {
@@ -15,6 +15,14 @@ function treatmentsNotReady(featureFlagNames) {
15
15
  });
16
16
  return evaluations;
17
17
  }
18
+ function stringify(options) {
19
+ if (options && options.properties) {
20
+ try {
21
+ return JSON.stringify(options.properties);
22
+ }
23
+ catch ( /* JSON.stringify should never throw with validated options, but handling just in case */_a) { /* JSON.stringify should never throw with validated options, but handling just in case */ }
24
+ }
25
+ }
18
26
  /**
19
27
  * Creator of base client with getTreatments and track methods.
20
28
  */
@@ -22,13 +30,13 @@ export function clientFactory(params) {
22
30
  var readinessManager = params.sdkReadinessManager.readinessManager, storage = params.storage, settings = params.settings, impressionsTracker = params.impressionsTracker, eventTracker = params.eventTracker, telemetryTracker = params.telemetryTracker;
23
31
  var log = settings.log, mode = settings.mode;
24
32
  var isAsync = isConsumerMode(mode);
25
- function getTreatment(key, featureFlagName, attributes, withConfig, methodName) {
33
+ function getTreatment(key, featureFlagName, attributes, options, withConfig, methodName) {
26
34
  if (withConfig === void 0) { withConfig = false; }
27
35
  if (methodName === void 0) { methodName = GET_TREATMENT; }
28
36
  var stopTelemetryTracker = telemetryTracker.trackEval(withConfig ? TREATMENT_WITH_CONFIG : TREATMENT);
29
37
  var wrapUp = function (evaluationResult) {
30
38
  var queue = [];
31
- var treatment = processEvaluation(evaluationResult, featureFlagName, key, attributes, withConfig, methodName, queue);
39
+ var treatment = processEvaluation(evaluationResult, featureFlagName, key, stringify(options), withConfig, methodName, queue);
32
40
  impressionsTracker.track(queue, attributes);
33
41
  stopTelemetryTracker(queue[0] && queue[0].imp.label);
34
42
  return treatment;
@@ -40,18 +48,19 @@ export function clientFactory(params) {
40
48
  treatmentNotReady;
41
49
  return thenable(evaluation) ? evaluation.then(function (res) { return wrapUp(res); }) : wrapUp(evaluation);
42
50
  }
43
- function getTreatmentWithConfig(key, featureFlagName, attributes) {
44
- return getTreatment(key, featureFlagName, attributes, true, GET_TREATMENT_WITH_CONFIG);
51
+ function getTreatmentWithConfig(key, featureFlagName, attributes, options) {
52
+ return getTreatment(key, featureFlagName, attributes, options, true, GET_TREATMENT_WITH_CONFIG);
45
53
  }
46
- function getTreatments(key, featureFlagNames, attributes, withConfig, methodName) {
54
+ function getTreatments(key, featureFlagNames, attributes, options, withConfig, methodName) {
47
55
  if (withConfig === void 0) { withConfig = false; }
48
56
  if (methodName === void 0) { methodName = GET_TREATMENTS; }
49
57
  var stopTelemetryTracker = telemetryTracker.trackEval(withConfig ? TREATMENTS_WITH_CONFIG : TREATMENTS);
50
58
  var wrapUp = function (evaluationResults) {
51
59
  var queue = [];
52
60
  var treatments = {};
61
+ var properties = stringify(options);
53
62
  Object.keys(evaluationResults).forEach(function (featureFlagName) {
54
- treatments[featureFlagName] = processEvaluation(evaluationResults[featureFlagName], featureFlagName, key, attributes, withConfig, methodName, queue);
63
+ treatments[featureFlagName] = processEvaluation(evaluationResults[featureFlagName], featureFlagName, key, properties, withConfig, methodName, queue);
55
64
  });
56
65
  impressionsTracker.track(queue, attributes);
57
66
  stopTelemetryTracker(queue[0] && queue[0].imp.label);
@@ -64,10 +73,10 @@ export function clientFactory(params) {
64
73
  treatmentsNotReady(featureFlagNames);
65
74
  return thenable(evaluations) ? evaluations.then(function (res) { return wrapUp(res); }) : wrapUp(evaluations);
66
75
  }
67
- function getTreatmentsWithConfig(key, featureFlagNames, attributes) {
68
- return getTreatments(key, featureFlagNames, attributes, true, GET_TREATMENTS_WITH_CONFIG);
76
+ function getTreatmentsWithConfig(key, featureFlagNames, attributes, options) {
77
+ return getTreatments(key, featureFlagNames, attributes, options, true, GET_TREATMENTS_WITH_CONFIG);
69
78
  }
70
- function getTreatmentsByFlagSets(key, flagSetNames, attributes, withConfig, method, methodName) {
79
+ function getTreatmentsByFlagSets(key, flagSetNames, attributes, options, withConfig, method, methodName) {
71
80
  if (withConfig === void 0) { withConfig = false; }
72
81
  if (method === void 0) { method = TREATMENTS_BY_FLAGSETS; }
73
82
  if (methodName === void 0) { methodName = GET_TREATMENTS_BY_FLAG_SETS; }
@@ -75,9 +84,9 @@ export function clientFactory(params) {
75
84
  var wrapUp = function (evaluationResults) {
76
85
  var queue = [];
77
86
  var treatments = {};
78
- var evaluations = evaluationResults;
79
- Object.keys(evaluations).forEach(function (featureFlagName) {
80
- treatments[featureFlagName] = processEvaluation(evaluations[featureFlagName], featureFlagName, key, attributes, withConfig, methodName, queue);
87
+ var properties = stringify(options);
88
+ Object.keys(evaluationResults).forEach(function (featureFlagName) {
89
+ treatments[featureFlagName] = processEvaluation(evaluationResults[featureFlagName], featureFlagName, key, properties, withConfig, methodName, queue);
81
90
  });
82
91
  impressionsTracker.track(queue, attributes);
83
92
  stopTelemetryTracker(queue[0] && queue[0].imp.label);
@@ -90,17 +99,17 @@ export function clientFactory(params) {
90
99
  {};
91
100
  return thenable(evaluations) ? evaluations.then(function (res) { return wrapUp(res); }) : wrapUp(evaluations);
92
101
  }
93
- function getTreatmentsWithConfigByFlagSets(key, flagSetNames, attributes) {
94
- return getTreatmentsByFlagSets(key, flagSetNames, attributes, true, TREATMENTS_WITH_CONFIG_BY_FLAGSETS, GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SETS);
102
+ function getTreatmentsWithConfigByFlagSets(key, flagSetNames, attributes, options) {
103
+ return getTreatmentsByFlagSets(key, flagSetNames, attributes, options, true, TREATMENTS_WITH_CONFIG_BY_FLAGSETS, GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SETS);
95
104
  }
96
- function getTreatmentsByFlagSet(key, flagSetName, attributes) {
97
- return getTreatmentsByFlagSets(key, [flagSetName], attributes, false, TREATMENTS_BY_FLAGSET, GET_TREATMENTS_BY_FLAG_SET);
105
+ function getTreatmentsByFlagSet(key, flagSetName, attributes, options) {
106
+ return getTreatmentsByFlagSets(key, [flagSetName], attributes, options, false, TREATMENTS_BY_FLAGSET, GET_TREATMENTS_BY_FLAG_SET);
98
107
  }
99
- function getTreatmentsWithConfigByFlagSet(key, flagSetName, attributes) {
100
- return getTreatmentsByFlagSets(key, [flagSetName], attributes, true, TREATMENTS_WITH_CONFIG_BY_FLAGSET, GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SET);
108
+ function getTreatmentsWithConfigByFlagSet(key, flagSetName, attributes, options) {
109
+ return getTreatmentsByFlagSets(key, [flagSetName], attributes, options, true, TREATMENTS_WITH_CONFIG_BY_FLAGSET, GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SET);
101
110
  }
102
111
  // Internal function
103
- function processEvaluation(evaluation, featureFlagName, key, attributes, withConfig, invokingMethodName, queue) {
112
+ function processEvaluation(evaluation, featureFlagName, key, properties, withConfig, invokingMethodName, queue) {
104
113
  var matchingKey = getMatching(key);
105
114
  var bucketingKey = getBucketing(key);
106
115
  var treatment = evaluation.treatment, label = evaluation.label, changeNumber = evaluation.changeNumber, _a = evaluation.config, config = _a === void 0 ? null : _a, impressionsDisabled = evaluation.impressionsDisabled;
@@ -116,6 +125,7 @@ export function clientFactory(params) {
116
125
  bucketingKey: bucketingKey,
117
126
  label: label,
118
127
  changeNumber: changeNumber,
128
+ properties: properties
119
129
  },
120
130
  disabled: impressionsDisabled
121
131
  });
@@ -15,40 +15,35 @@ export function clientAttributesDecoration(log, client) {
15
15
  var clientGetTreatmentsWithConfigByFlagSets = client.getTreatmentsWithConfigByFlagSets;
16
16
  var clientGetTreatmentsByFlagSet = client.getTreatmentsByFlagSet;
17
17
  var clientGetTreatmentsWithConfigByFlagSet = client.getTreatmentsWithConfigByFlagSet;
18
- var clientTrack = client.track;
19
- function getTreatment(maybeKey, maybeFeatureFlagName, maybeAttributes) {
20
- return clientGetTreatment(maybeKey, maybeFeatureFlagName, combineAttributes(maybeAttributes));
18
+ function getTreatment(maybeKey, maybeFeatureFlagName, maybeAttributes, maybeOptions) {
19
+ return clientGetTreatment(maybeKey, maybeFeatureFlagName, combineAttributes(maybeAttributes), maybeOptions);
21
20
  }
22
- function getTreatmentWithConfig(maybeKey, maybeFeatureFlagName, maybeAttributes) {
23
- return clientGetTreatmentWithConfig(maybeKey, maybeFeatureFlagName, combineAttributes(maybeAttributes));
21
+ function getTreatmentWithConfig(maybeKey, maybeFeatureFlagName, maybeAttributes, maybeOptions) {
22
+ return clientGetTreatmentWithConfig(maybeKey, maybeFeatureFlagName, combineAttributes(maybeAttributes), maybeOptions);
24
23
  }
25
- function getTreatments(maybeKey, maybeFeatureFlagNames, maybeAttributes) {
26
- return clientGetTreatments(maybeKey, maybeFeatureFlagNames, combineAttributes(maybeAttributes));
24
+ function getTreatments(maybeKey, maybeFeatureFlagNames, maybeAttributes, maybeOptions) {
25
+ return clientGetTreatments(maybeKey, maybeFeatureFlagNames, combineAttributes(maybeAttributes), maybeOptions);
27
26
  }
28
- function getTreatmentsWithConfig(maybeKey, maybeFeatureFlagNames, maybeAttributes) {
29
- return clientGetTreatmentsWithConfig(maybeKey, maybeFeatureFlagNames, combineAttributes(maybeAttributes));
27
+ function getTreatmentsWithConfig(maybeKey, maybeFeatureFlagNames, maybeAttributes, maybeOptions) {
28
+ return clientGetTreatmentsWithConfig(maybeKey, maybeFeatureFlagNames, combineAttributes(maybeAttributes), maybeOptions);
30
29
  }
31
- function getTreatmentsByFlagSets(maybeKey, maybeFlagSets, maybeAttributes) {
32
- return clientGetTreatmentsByFlagSets(maybeKey, maybeFlagSets, combineAttributes(maybeAttributes));
30
+ function getTreatmentsByFlagSets(maybeKey, maybeFlagSets, maybeAttributes, maybeOptions) {
31
+ return clientGetTreatmentsByFlagSets(maybeKey, maybeFlagSets, combineAttributes(maybeAttributes), maybeOptions);
33
32
  }
34
- function getTreatmentsWithConfigByFlagSets(maybeKey, maybeFlagSets, maybeAttributes) {
35
- return clientGetTreatmentsWithConfigByFlagSets(maybeKey, maybeFlagSets, combineAttributes(maybeAttributes));
33
+ function getTreatmentsWithConfigByFlagSets(maybeKey, maybeFlagSets, maybeAttributes, maybeOptions) {
34
+ return clientGetTreatmentsWithConfigByFlagSets(maybeKey, maybeFlagSets, combineAttributes(maybeAttributes), maybeOptions);
36
35
  }
37
- function getTreatmentsByFlagSet(maybeKey, maybeFlagSet, maybeAttributes) {
38
- return clientGetTreatmentsByFlagSet(maybeKey, maybeFlagSet, combineAttributes(maybeAttributes));
36
+ function getTreatmentsByFlagSet(maybeKey, maybeFlagSet, maybeAttributes, maybeOptions) {
37
+ return clientGetTreatmentsByFlagSet(maybeKey, maybeFlagSet, combineAttributes(maybeAttributes), maybeOptions);
39
38
  }
40
- function getTreatmentsWithConfigByFlagSet(maybeKey, maybeFlagSet, maybeAttributes) {
41
- return clientGetTreatmentsWithConfigByFlagSet(maybeKey, maybeFlagSet, combineAttributes(maybeAttributes));
42
- }
43
- function track(maybeKey, maybeTT, maybeEvent, maybeEventValue, maybeProperties) {
44
- return clientTrack(maybeKey, maybeTT, maybeEvent, maybeEventValue, maybeProperties);
39
+ function getTreatmentsWithConfigByFlagSet(maybeKey, maybeFlagSet, maybeAttributes, maybeOptions) {
40
+ return clientGetTreatmentsWithConfigByFlagSet(maybeKey, maybeFlagSet, combineAttributes(maybeAttributes), maybeOptions);
45
41
  }
46
42
  function combineAttributes(maybeAttributes) {
47
43
  var storedAttributes = attributeStorage.getAll();
48
- if (Object.keys(storedAttributes).length > 0) {
49
- return objectAssign({}, storedAttributes, maybeAttributes);
50
- }
51
- return maybeAttributes;
44
+ return Object.keys(storedAttributes).length > 0 ?
45
+ objectAssign({}, storedAttributes, maybeAttributes) :
46
+ maybeAttributes;
52
47
  }
53
48
  return objectAssign(client, {
54
49
  getTreatment: getTreatment,
@@ -59,7 +54,6 @@ export function clientAttributesDecoration(log, client) {
59
54
  getTreatmentsWithConfigByFlagSets: getTreatmentsWithConfigByFlagSets,
60
55
  getTreatmentsByFlagSet: getTreatmentsByFlagSet,
61
56
  getTreatmentsWithConfigByFlagSet: getTreatmentsWithConfigByFlagSet,
62
- track: track,
63
57
  /**
64
58
  * Add an attribute to client's in memory attributes storage
65
59
  *
@@ -1,5 +1,5 @@
1
1
  import { objectAssign } from '../utils/lang/objectAssign';
2
- import { validateAttributes, validateEvent, validateEventValue, validateEventProperties, validateKey, validateSplit, validateSplits, validateTrafficType, validateIfNotDestroyed, validateIfOperational } from '../utils/inputValidation';
2
+ import { validateAttributes, validateEvent, validateEventValue, validateEventProperties, validateKey, validateSplit, validateSplits, validateTrafficType, validateIfNotDestroyed, validateIfOperational, validateEvaluationOptions } from '../utils/inputValidation';
3
3
  import { startsWith } from '../utils/lang';
4
4
  import { CONTROL, CONTROL_WITH_CONFIG, GET_TREATMENT, GET_TREATMENTS, GET_TREATMENTS_BY_FLAG_SET, GET_TREATMENTS_BY_FLAG_SETS, GET_TREATMENTS_WITH_CONFIG, GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SET, GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SETS, GET_TREATMENT_WITH_CONFIG, TRACK_FN_LABEL } from '../utils/constants';
5
5
  import { isConsumerMode } from '../utils/settingsValidation/mode';
@@ -14,7 +14,7 @@ export function clientInputValidationDecorator(settings, client, readinessManage
14
14
  /**
15
15
  * Avoid repeating this validations code
16
16
  */
17
- function validateEvaluationParams(maybeKey, maybeNameOrNames, maybeAttributes, methodName) {
17
+ function validateEvaluationParams(methodName, maybeKey, maybeNameOrNames, maybeAttributes, maybeOptions) {
18
18
  var key = validateKey(log, maybeKey, methodName);
19
19
  var nameOrNames = methodName.indexOf('ByFlagSet') > -1 ?
20
20
  validateFlagSets(log, methodName, maybeNameOrNames, settings.sync.__splitFiltersValidation.groupedFilters.bySet) :
@@ -23,40 +23,42 @@ export function clientInputValidationDecorator(settings, client, readinessManage
23
23
  validateSplit(log, maybeNameOrNames, methodName);
24
24
  var attributes = validateAttributes(log, maybeAttributes, methodName);
25
25
  var isNotDestroyed = validateIfNotDestroyed(log, readinessManager, methodName);
26
+ var options = validateEvaluationOptions(log, maybeOptions, methodName);
26
27
  validateIfOperational(log, readinessManager, methodName, nameOrNames);
27
28
  var valid = isNotDestroyed && key && nameOrNames && attributes !== false;
28
29
  return {
29
30
  valid: valid,
30
31
  key: key,
31
32
  nameOrNames: nameOrNames,
32
- attributes: attributes
33
+ attributes: attributes,
34
+ options: options
33
35
  };
34
36
  }
35
37
  function wrapResult(value) {
36
38
  return isAsync ? Promise.resolve(value) : value;
37
39
  }
38
- function getTreatment(maybeKey, maybeFeatureFlagName, maybeAttributes) {
39
- var params = validateEvaluationParams(maybeKey, maybeFeatureFlagName, maybeAttributes, GET_TREATMENT);
40
+ function getTreatment(maybeKey, maybeFeatureFlagName, maybeAttributes, maybeOptions) {
41
+ var params = validateEvaluationParams(GET_TREATMENT, maybeKey, maybeFeatureFlagName, maybeAttributes, maybeOptions);
40
42
  if (params.valid) {
41
- return client.getTreatment(params.key, params.nameOrNames, params.attributes);
43
+ return client.getTreatment(params.key, params.nameOrNames, params.attributes, params.options);
42
44
  }
43
45
  else {
44
46
  return wrapResult(CONTROL);
45
47
  }
46
48
  }
47
- function getTreatmentWithConfig(maybeKey, maybeFeatureFlagName, maybeAttributes) {
48
- var params = validateEvaluationParams(maybeKey, maybeFeatureFlagName, maybeAttributes, GET_TREATMENT_WITH_CONFIG);
49
+ function getTreatmentWithConfig(maybeKey, maybeFeatureFlagName, maybeAttributes, maybeOptions) {
50
+ var params = validateEvaluationParams(GET_TREATMENT_WITH_CONFIG, maybeKey, maybeFeatureFlagName, maybeAttributes, maybeOptions);
49
51
  if (params.valid) {
50
- return client.getTreatmentWithConfig(params.key, params.nameOrNames, params.attributes);
52
+ return client.getTreatmentWithConfig(params.key, params.nameOrNames, params.attributes, params.options);
51
53
  }
52
54
  else {
53
55
  return wrapResult(objectAssign({}, CONTROL_WITH_CONFIG));
54
56
  }
55
57
  }
56
- function getTreatments(maybeKey, maybeFeatureFlagNames, maybeAttributes) {
57
- var params = validateEvaluationParams(maybeKey, maybeFeatureFlagNames, maybeAttributes, GET_TREATMENTS);
58
+ function getTreatments(maybeKey, maybeFeatureFlagNames, maybeAttributes, maybeOptions) {
59
+ var params = validateEvaluationParams(GET_TREATMENTS, maybeKey, maybeFeatureFlagNames, maybeAttributes, maybeOptions);
58
60
  if (params.valid) {
59
- return client.getTreatments(params.key, params.nameOrNames, params.attributes);
61
+ return client.getTreatments(params.key, params.nameOrNames, params.attributes, params.options);
60
62
  }
61
63
  else {
62
64
  var res_1 = {};
@@ -65,10 +67,10 @@ export function clientInputValidationDecorator(settings, client, readinessManage
65
67
  return wrapResult(res_1);
66
68
  }
67
69
  }
68
- function getTreatmentsWithConfig(maybeKey, maybeFeatureFlagNames, maybeAttributes) {
69
- var params = validateEvaluationParams(maybeKey, maybeFeatureFlagNames, maybeAttributes, GET_TREATMENTS_WITH_CONFIG);
70
+ function getTreatmentsWithConfig(maybeKey, maybeFeatureFlagNames, maybeAttributes, maybeOptions) {
71
+ var params = validateEvaluationParams(GET_TREATMENTS_WITH_CONFIG, maybeKey, maybeFeatureFlagNames, maybeAttributes, maybeOptions);
70
72
  if (params.valid) {
71
- return client.getTreatmentsWithConfig(params.key, params.nameOrNames, params.attributes);
73
+ return client.getTreatmentsWithConfig(params.key, params.nameOrNames, params.attributes, params.options);
72
74
  }
73
75
  else {
74
76
  var res_2 = {};
@@ -77,37 +79,37 @@ export function clientInputValidationDecorator(settings, client, readinessManage
77
79
  return wrapResult(res_2);
78
80
  }
79
81
  }
80
- function getTreatmentsByFlagSets(maybeKey, maybeFlagSets, maybeAttributes) {
81
- var params = validateEvaluationParams(maybeKey, maybeFlagSets, maybeAttributes, GET_TREATMENTS_BY_FLAG_SETS);
82
+ function getTreatmentsByFlagSets(maybeKey, maybeFlagSets, maybeAttributes, maybeOptions) {
83
+ var params = validateEvaluationParams(GET_TREATMENTS_BY_FLAG_SETS, maybeKey, maybeFlagSets, maybeAttributes, maybeOptions);
82
84
  if (params.valid) {
83
- return client.getTreatmentsByFlagSets(params.key, params.nameOrNames, params.attributes);
85
+ return client.getTreatmentsByFlagSets(params.key, params.nameOrNames, params.attributes, params.options);
84
86
  }
85
87
  else {
86
88
  return wrapResult({});
87
89
  }
88
90
  }
89
- function getTreatmentsWithConfigByFlagSets(maybeKey, maybeFlagSets, maybeAttributes) {
90
- var params = validateEvaluationParams(maybeKey, maybeFlagSets, maybeAttributes, GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SETS);
91
+ function getTreatmentsWithConfigByFlagSets(maybeKey, maybeFlagSets, maybeAttributes, maybeOptions) {
92
+ var params = validateEvaluationParams(GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SETS, maybeKey, maybeFlagSets, maybeAttributes, maybeOptions);
91
93
  if (params.valid) {
92
- return client.getTreatmentsWithConfigByFlagSets(params.key, params.nameOrNames, params.attributes);
94
+ return client.getTreatmentsWithConfigByFlagSets(params.key, params.nameOrNames, params.attributes, params.options);
93
95
  }
94
96
  else {
95
97
  return wrapResult({});
96
98
  }
97
99
  }
98
- function getTreatmentsByFlagSet(maybeKey, maybeFlagSet, maybeAttributes) {
99
- var params = validateEvaluationParams(maybeKey, [maybeFlagSet], maybeAttributes, GET_TREATMENTS_BY_FLAG_SET);
100
+ function getTreatmentsByFlagSet(maybeKey, maybeFlagSet, maybeAttributes, maybeOptions) {
101
+ var params = validateEvaluationParams(GET_TREATMENTS_BY_FLAG_SET, maybeKey, [maybeFlagSet], maybeAttributes, maybeOptions);
100
102
  if (params.valid) {
101
- return client.getTreatmentsByFlagSet(params.key, params.nameOrNames[0], params.attributes);
103
+ return client.getTreatmentsByFlagSet(params.key, params.nameOrNames[0], params.attributes, params.options);
102
104
  }
103
105
  else {
104
106
  return wrapResult({});
105
107
  }
106
108
  }
107
- function getTreatmentsWithConfigByFlagSet(maybeKey, maybeFlagSet, maybeAttributes) {
108
- var params = validateEvaluationParams(maybeKey, [maybeFlagSet], maybeAttributes, GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SET);
109
+ function getTreatmentsWithConfigByFlagSet(maybeKey, maybeFlagSet, maybeAttributes, maybeOptions) {
110
+ var params = validateEvaluationParams(GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SET, maybeKey, [maybeFlagSet], maybeAttributes, maybeOptions);
109
111
  if (params.valid) {
110
- return client.getTreatmentsWithConfigByFlagSet(params.key, params.nameOrNames[0], params.attributes);
112
+ return client.getTreatmentsWithConfigByFlagSet(params.key, params.nameOrNames[0], params.attributes, params.options);
111
113
  }
112
114
  else {
113
115
  return wrapResult({});
@@ -38,8 +38,8 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
38
38
  }
39
39
  return splitHttpClient(url, undefined, telemetryTracker.trackHttp(TOKEN));
40
40
  },
41
- fetchSplitChanges: function (since, noCache, till, rbSince) {
42
- var url = urls.sdk + "/splitChanges?s=" + flagSpecVersion + "&since=" + since + (rbSince ? '&rbSince=' + rbSince : '') + (filterQueryString || '') + (till ? '&till=' + till : '');
41
+ fetchSplitChanges: function (since, noCache, till) {
42
+ var url = urls.sdk + "/splitChanges?s=" + flagSpecVersion + "&since=" + since + (filterQueryString || '') + (till ? '&till=' + till : '');
43
43
  return splitHttpClient(url, noCache ? noCacheHeaderOptions : undefined, telemetryTracker.trackHttp(SPLITS))
44
44
  .catch(function (err) {
45
45
  if (err.statusCode === 414)
@@ -22,13 +22,6 @@ var AbstractSplitsCacheAsync = /** @class */ (function () {
22
22
  AbstractSplitsCacheAsync.prototype.usesSegments = function () {
23
23
  return Promise.resolve(true);
24
24
  };
25
- /**
26
- * Check if the splits information is already stored in cache.
27
- * Noop, just keeping the interface. This is used by client-side implementations only.
28
- */
29
- AbstractSplitsCacheAsync.prototype.checkCache = function () {
30
- return Promise.resolve(false);
31
- };
32
25
  /**
33
26
  * Kill `name` split and set `defaultTreatment` and `changeNumber`.
34
27
  * Used for SPLIT_KILL push notifications.
@@ -25,13 +25,6 @@ var AbstractSplitsCacheSync = /** @class */ (function () {
25
25
  var _this = this;
26
26
  return this.getSplitNames().map(function (key) { return _this.getSplit(key); });
27
27
  };
28
- /**
29
- * Check if the splits information is already stored in cache. This data can be preloaded.
30
- * It is used as condition to emit SDK_SPLITS_CACHE_LOADED, and then SDK_READY_FROM_CACHE.
31
- */
32
- AbstractSplitsCacheSync.prototype.checkCache = function () {
33
- return false;
34
- };
35
28
  /**
36
29
  * Kill `name` split and set `defaultTreatment` and `changeNumber`.
37
30
  * Used for SPLIT_KILL push notifications.
@@ -57,8 +50,8 @@ export { AbstractSplitsCacheSync };
57
50
  * Given a parsed split, it returns a boolean flagging if its conditions use segments matchers (rules & whitelists).
58
51
  * This util is intended to simplify the implementation of `splitsCache::usesSegments` method
59
52
  */
60
- export function usesSegments(ruleEntity) {
61
- var conditions = ruleEntity.conditions || [];
53
+ export function usesSegments(split) {
54
+ var conditions = split.conditions || [];
62
55
  for (var i = 0; i < conditions.length; i++) {
63
56
  var matchers = conditions[i].matcherGroup.matchers;
64
57
  for (var j = 0; j < matchers.length; j++) {
@@ -67,8 +60,5 @@ export function usesSegments(ruleEntity) {
67
60
  return true;
68
61
  }
69
62
  }
70
- var excluded = ruleEntity.excluded;
71
- if (excluded && excluded.segments && excluded.segments.length > 0)
72
- return true;
73
63
  return false;
74
64
  }