@splitsoftware/splitio-commons 1.13.2-rc.9 → 1.14.0

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 (116) hide show
  1. package/CHANGES.txt +1 -1
  2. package/cjs/evaluator/matchers/all.js +1 -3
  3. package/cjs/evaluator/matchers/between.js +1 -3
  4. package/cjs/evaluator/matchers/boolean.js +1 -3
  5. package/cjs/evaluator/matchers/cont_all.js +1 -3
  6. package/cjs/evaluator/matchers/cont_any.js +1 -3
  7. package/cjs/evaluator/matchers/cont_str.js +1 -3
  8. package/cjs/evaluator/matchers/dependency.js +1 -1
  9. package/cjs/evaluator/matchers/eq.js +1 -3
  10. package/cjs/evaluator/matchers/eq_set.js +1 -3
  11. package/cjs/evaluator/matchers/ew.js +1 -3
  12. package/cjs/evaluator/matchers/gte.js +1 -3
  13. package/cjs/evaluator/matchers/index.js +1 -1
  14. package/cjs/evaluator/matchers/lte.js +1 -3
  15. package/cjs/evaluator/matchers/part_of.js +1 -3
  16. package/cjs/evaluator/matchers/segment.js +1 -6
  17. package/cjs/evaluator/matchers/semver_between.js +1 -1
  18. package/cjs/evaluator/matchers/semver_eq.js +1 -1
  19. package/cjs/evaluator/matchers/semver_gte.js +1 -1
  20. package/cjs/evaluator/matchers/semver_inlist.js +1 -1
  21. package/cjs/evaluator/matchers/semver_lte.js +1 -1
  22. package/cjs/evaluator/matchers/string.js +1 -3
  23. package/cjs/evaluator/matchers/sw.js +1 -3
  24. package/cjs/evaluator/matchers/whitelist.js +1 -3
  25. package/cjs/evaluator/parser/index.js +7 -4
  26. package/cjs/logger/constants.js +4 -19
  27. package/cjs/logger/messages/debug.js +5 -20
  28. package/cjs/logger/messages/warn.js +1 -1
  29. package/esm/evaluator/matchers/all.js +1 -3
  30. package/esm/evaluator/matchers/between.js +1 -3
  31. package/esm/evaluator/matchers/boolean.js +1 -3
  32. package/esm/evaluator/matchers/cont_all.js +1 -3
  33. package/esm/evaluator/matchers/cont_any.js +1 -3
  34. package/esm/evaluator/matchers/cont_str.js +1 -3
  35. package/esm/evaluator/matchers/dependency.js +1 -1
  36. package/esm/evaluator/matchers/eq.js +1 -3
  37. package/esm/evaluator/matchers/eq_set.js +1 -3
  38. package/esm/evaluator/matchers/ew.js +1 -3
  39. package/esm/evaluator/matchers/gte.js +1 -3
  40. package/esm/evaluator/matchers/index.js +1 -1
  41. package/esm/evaluator/matchers/lte.js +1 -3
  42. package/esm/evaluator/matchers/part_of.js +1 -3
  43. package/esm/evaluator/matchers/segment.js +1 -6
  44. package/esm/evaluator/matchers/semver_between.js +1 -1
  45. package/esm/evaluator/matchers/semver_eq.js +1 -1
  46. package/esm/evaluator/matchers/semver_gte.js +1 -1
  47. package/esm/evaluator/matchers/semver_inlist.js +1 -1
  48. package/esm/evaluator/matchers/semver_lte.js +1 -1
  49. package/esm/evaluator/matchers/string.js +1 -3
  50. package/esm/evaluator/matchers/sw.js +1 -3
  51. package/esm/evaluator/matchers/whitelist.js +1 -3
  52. package/esm/evaluator/parser/index.js +8 -5
  53. package/esm/logger/constants.js +1 -16
  54. package/esm/logger/messages/debug.js +5 -20
  55. package/esm/logger/messages/warn.js +1 -1
  56. package/package.json +1 -1
  57. package/src/evaluator/matchers/all.ts +1 -5
  58. package/src/evaluator/matchers/between.ts +3 -7
  59. package/src/evaluator/matchers/boolean.ts +2 -6
  60. package/src/evaluator/matchers/cont_all.ts +1 -5
  61. package/src/evaluator/matchers/cont_any.ts +1 -5
  62. package/src/evaluator/matchers/cont_str.ts +2 -6
  63. package/src/evaluator/matchers/dependency.ts +1 -1
  64. package/src/evaluator/matchers/eq.ts +2 -6
  65. package/src/evaluator/matchers/eq_set.ts +1 -5
  66. package/src/evaluator/matchers/ew.ts +2 -6
  67. package/src/evaluator/matchers/gte.ts +2 -6
  68. package/src/evaluator/matchers/index.ts +1 -1
  69. package/src/evaluator/matchers/lte.ts +2 -6
  70. package/src/evaluator/matchers/part_of.ts +1 -5
  71. package/src/evaluator/matchers/segment.ts +1 -8
  72. package/src/evaluator/matchers/semver_between.ts +1 -2
  73. package/src/evaluator/matchers/semver_eq.ts +1 -2
  74. package/src/evaluator/matchers/semver_gte.ts +1 -2
  75. package/src/evaluator/matchers/semver_inlist.ts +2 -2
  76. package/src/evaluator/matchers/semver_lte.ts +1 -2
  77. package/src/evaluator/matchers/string.ts +1 -6
  78. package/src/evaluator/matchers/sw.ts +2 -6
  79. package/src/evaluator/matchers/whitelist.ts +1 -5
  80. package/src/evaluator/parser/index.ts +9 -5
  81. package/src/logger/constants.ts +1 -16
  82. package/src/logger/messages/debug.ts +5 -20
  83. package/src/logger/messages/warn.ts +1 -1
  84. package/types/evaluator/matchers/all.d.ts +1 -2
  85. package/types/evaluator/matchers/between.d.ts +1 -2
  86. package/types/evaluator/matchers/boolean.d.ts +1 -2
  87. package/types/evaluator/matchers/cont_all.d.ts +1 -2
  88. package/types/evaluator/matchers/cont_any.d.ts +1 -2
  89. package/types/evaluator/matchers/cont_str.d.ts +1 -2
  90. package/types/evaluator/matchers/dependency.d.ts +1 -1
  91. package/types/evaluator/matchers/eq.d.ts +1 -2
  92. package/types/evaluator/matchers/eq_set.d.ts +1 -2
  93. package/types/evaluator/matchers/ew.d.ts +1 -2
  94. package/types/evaluator/matchers/gte.d.ts +1 -2
  95. package/types/evaluator/matchers/lte.d.ts +1 -2
  96. package/types/evaluator/matchers/part_of.d.ts +1 -2
  97. package/types/evaluator/matchers/segment.d.ts +1 -2
  98. package/types/evaluator/matchers/sember_inlist.d.ts +3 -0
  99. package/types/evaluator/matchers/semver_between.d.ts +1 -2
  100. package/types/evaluator/matchers/semver_eq.d.ts +1 -2
  101. package/types/evaluator/matchers/semver_gte.d.ts +1 -2
  102. package/types/evaluator/matchers/semver_inlist.d.ts +1 -2
  103. package/types/evaluator/matchers/semver_lte.d.ts +1 -2
  104. package/types/evaluator/matchers/string.d.ts +1 -2
  105. package/types/evaluator/matchers/sw.d.ts +1 -2
  106. package/types/evaluator/matchers/whitelist.d.ts +1 -2
  107. package/types/evaluator/matchersTransform/set.d.ts +2 -2
  108. package/types/evaluator/matchersTransform/string.d.ts +7 -0
  109. package/types/logger/constants.d.ts +1 -16
  110. package/types/sdkClient/identity.d.ts +6 -0
  111. package/types/storages/AbstractSplitsCache.d.ts +46 -0
  112. package/types/sync/streaming/mySegmentsV2utils.d.ts +27 -0
  113. package/types/trackers/impressionObserver/utils.d.ts +1 -1
  114. package/types/utils/inputValidation/sdkKey.d.ts +7 -0
  115. package/types/utils/settingsValidation/logger/globalLogLevel.d.ts +8 -0
  116. /package/types/utils/{Semver.d.ts → semVer.d.ts} +0 -0
@@ -11,7 +11,7 @@ import { ISplitCondition, MaybeThenable } from '../../dtos/types';
11
11
  import { IStorageAsync, IStorageSync } from '../../storages/types';
12
12
  import { SplitIO } from '../../types';
13
13
  import { ILogger } from '../../logger/types';
14
- import { ENGINE_MATCHER_ERROR } from '../../logger/constants';
14
+ import { ENGINE_MATCHER_ERROR, ENGINE_MATCHER_RESULT } from '../../logger/constants';
15
15
 
16
16
  export function parser(log: ILogger, conditions: ISplitCondition[], storage: IStorageSync | IStorageAsync): IEvaluator {
17
17
  let predicates = [];
@@ -49,10 +49,14 @@ export function parser(log: ILogger, conditions: ISplitCondition[], storage: ISt
49
49
  }
50
50
  }
51
51
 
52
- if (thenable(result)) { // @ts-ignore
53
- return result.then(res => Boolean(res ^ matcherDto.negate));
54
- } // @ts-ignore
55
- return Boolean(result ^ matcherDto.negate);
52
+ function handleResult(result: boolean) {
53
+ log.debug(ENGINE_MATCHER_RESULT, [matcherDto.name, result, matcherDto.value, value]); // @ts-ignore
54
+ return Boolean(result ^ matcherDto.negate);
55
+ }
56
+
57
+ return thenable(result) ?
58
+ result.then(handleResult) :
59
+ handleResult(result);
56
60
  };
57
61
  });
58
62
 
@@ -9,24 +9,8 @@ export const ENGINE_COMBINER_AND = 0;
9
9
  export const ENGINE_COMBINER_IFELSEIF = 1;
10
10
  export const ENGINE_COMBINER_IFELSEIF_NO_TREATMENT = 2;
11
11
  export const ENGINE_BUCKET = 3;
12
- export const ENGINE_MATCHER_ALL = 4;
13
- export const ENGINE_MATCHER_BETWEEN = 5;
14
- export const ENGINE_MATCHER_BOOLEAN = 6;
15
- export const ENGINE_MATCHER_CONTAINS_ALL = 7;
16
- export const ENGINE_MATCHER_CONTAINS_ANY = 8;
17
- export const ENGINE_MATCHER_CONTAINS_STRING = 9;
18
12
  export const ENGINE_MATCHER_DEPENDENCY = 10;
19
13
  export const ENGINE_MATCHER_DEPENDENCY_PRE = 11;
20
- export const ENGINE_MATCHER_EQUAL = 12;
21
- export const ENGINE_MATCHER_EQUAL_TO_SET = 13;
22
- export const ENGINE_MATCHER_ENDS_WITH = 14;
23
- export const ENGINE_MATCHER_GREATER = 15;
24
- export const ENGINE_MATCHER_LESS = 16;
25
- export const ENGINE_MATCHER_PART_OF = 17;
26
- export const ENGINE_MATCHER_SEGMENT = 18;
27
- export const ENGINE_MATCHER_STRING = 19;
28
- export const ENGINE_MATCHER_STARTS_WITH = 21;
29
- export const ENGINE_MATCHER_WHITELIST = 22;
30
14
  export const ENGINE_VALUE = 23;
31
15
  export const ENGINE_SANITIZE = 24;
32
16
  export const CLEANUP_REGISTERING = 25;
@@ -44,6 +28,7 @@ export const SYNC_TASK_START = 36;
44
28
  export const SYNC_TASK_EXECUTE = 37;
45
29
  export const SYNC_TASK_STOP = 38;
46
30
  export const SETTINGS_SPLITS_FILTER = 39;
31
+ export const ENGINE_MATCHER_RESULT = 40;
47
32
 
48
33
  export const CLIENT_READY_FROM_CACHE = 100;
49
34
  export const CLIENT_READY = 101;
@@ -7,26 +7,11 @@ export const codesDebug: [number, string][] = codesInfo.concat([
7
7
  [c.ENGINE_COMBINER_IFELSEIF, c.LOG_PREFIX_ENGINE_COMBINER + 'Treatment found: %s'],
8
8
  [c.ENGINE_COMBINER_IFELSEIF_NO_TREATMENT, c.LOG_PREFIX_ENGINE_COMBINER + 'All predicates evaluated, no treatment found.'],
9
9
  [c.ENGINE_BUCKET, c.LOG_PREFIX_ENGINE + ': using algo "murmur" bucket %s for key %s using seed %s - treatment %s'],
10
- [c.ENGINE_MATCHER_ALL, c.LOG_PREFIX_ENGINE_MATCHER + '[allMatcher] is always true'],
11
- [c.ENGINE_MATCHER_BETWEEN, c.LOG_PREFIX_ENGINE_MATCHER + '[betweenMatcher] is %s between %s and %s? %s'],
12
- [c.ENGINE_MATCHER_BOOLEAN, c.LOG_PREFIX_ENGINE_MATCHER + '[booleanMatcher] %s === %s'],
13
- [c.ENGINE_MATCHER_CONTAINS_ALL, c.LOG_PREFIX_ENGINE_MATCHER + '[containsAllMatcher] %s contains all elements of %s? %s'],
14
- [c.ENGINE_MATCHER_CONTAINS_ANY, c.LOG_PREFIX_ENGINE_MATCHER + '[containsAnyMatcher] %s contains at least an element of %s? %s'],
15
- [c.ENGINE_MATCHER_CONTAINS_STRING, c.LOG_PREFIX_ENGINE_MATCHER + '[containsStringMatcher] %s contains %s? %s'],
16
- [c.ENGINE_MATCHER_DEPENDENCY, c.LOG_PREFIX_ENGINE_MATCHER + '[dependencyMatcher] parent feature flag "%s" evaluated to "%s" with label "%s". %s evaluated treatment is part of [%s] ? %s.'],
17
- [c.ENGINE_MATCHER_DEPENDENCY_PRE, c.LOG_PREFIX_ENGINE_MATCHER + '[dependencyMatcher] will evaluate parent feature flag: "%s" with key: %s %s'],
18
- [c.ENGINE_MATCHER_EQUAL, c.LOG_PREFIX_ENGINE_MATCHER + '[equalToMatcher] is %s equal to %s? %s'],
19
- [c.ENGINE_MATCHER_EQUAL_TO_SET, c.LOG_PREFIX_ENGINE_MATCHER + '[equalToSetMatcher] is %s equal to set %s? %s'],
20
- [c.ENGINE_MATCHER_ENDS_WITH, c.LOG_PREFIX_ENGINE_MATCHER + '[endsWithMatcher] %s ends with %s? %s'],
21
- [c.ENGINE_MATCHER_GREATER, c.LOG_PREFIX_ENGINE_MATCHER + '[greaterThanEqualMatcher] is %s greater than %s? %s'],
22
- [c.ENGINE_MATCHER_LESS, c.LOG_PREFIX_ENGINE_MATCHER + '[lessThanEqualMatcher] is %s less than %s? %s'],
23
- [c.ENGINE_MATCHER_PART_OF, c.LOG_PREFIX_ENGINE_MATCHER + '[partOfMatcher] %s is part of %s? %s'],
24
- [c.ENGINE_MATCHER_SEGMENT, c.LOG_PREFIX_ENGINE_MATCHER + '[segmentMatcher] evaluated %s / %s => %s'],
25
- [c.ENGINE_MATCHER_STRING, c.LOG_PREFIX_ENGINE_MATCHER + '[stringMatcher] does %s matches with %s? %s'],
26
- [c.ENGINE_MATCHER_STARTS_WITH, c.LOG_PREFIX_ENGINE_MATCHER + '[startsWithMatcher] %s starts with %s? %s'],
27
- [c.ENGINE_MATCHER_WHITELIST, c.LOG_PREFIX_ENGINE_MATCHER + '[whitelistMatcher] evaluated %s in [%s] => %s'],
28
- [c.ENGINE_VALUE, c.LOG_PREFIX_ENGINE_VALUE + 'Extracted attribute [%s], [%s] will be used for matching.'],
29
- [c.ENGINE_SANITIZE, c.LOG_PREFIX_ENGINE + ':sanitize: Attempted to sanitize [%s] which should be of type [%s]. Sanitized and processed value => [%s]'],
10
+ [c.ENGINE_MATCHER_DEPENDENCY, c.LOG_PREFIX_ENGINE_MATCHER + '[IN_SPLIT_TREATMENT] parent feature flag "%s" evaluated to "%s" with label "%s". %s evaluated treatment is part of %s ? %s.'],
11
+ [c.ENGINE_MATCHER_DEPENDENCY_PRE, c.LOG_PREFIX_ENGINE_MATCHER + '[IN_SPLIT_TREATMENT] will evaluate parent feature flag: "%s" with key: %s %s'],
12
+ [c.ENGINE_VALUE, c.LOG_PREFIX_ENGINE_VALUE + 'Extracted attribute `%s`. %s will be used for matching.'],
13
+ [c.ENGINE_SANITIZE, c.LOG_PREFIX_ENGINE + ':sanitize: Attempted to sanitize %s which should be of type %s. Sanitized and processed value => %s'],
14
+ [c.ENGINE_MATCHER_RESULT, c.LOG_PREFIX_ENGINE_MATCHER + '[%s] Result: %s. Rule value: %s. Evaluation value: %s'],
30
15
  // SDK
31
16
  [c.CLEANUP_REGISTERING, c.LOG_PREFIX_CLEANUP + 'Registering cleanup handler %s'],
32
17
  [c.CLEANUP_DEREGISTERING, c.LOG_PREFIX_CLEANUP + 'Deregistering cleanup handler %s'],
@@ -4,7 +4,7 @@ import { codesError } from './error';
4
4
  export const codesWarn: [number, string][] = codesError.concat([
5
5
  // evaluator
6
6
  [c.ENGINE_VALUE_INVALID, c.LOG_PREFIX_ENGINE_VALUE + 'Value %s doesn\'t match with expected type.'],
7
- [c.ENGINE_VALUE_NO_ATTRIBUTES, c.LOG_PREFIX_ENGINE_VALUE + 'Defined attribute [%s], no attributes received.'],
7
+ [c.ENGINE_VALUE_NO_ATTRIBUTES, c.LOG_PREFIX_ENGINE_VALUE + 'Defined attribute `%s`. No attributes received.'],
8
8
  // synchronizer
9
9
  [c.SYNC_MYSEGMENTS_FETCH_RETRY, c.LOG_PREFIX_SYNC_MYSEGMENTS + 'Retrying download of segments #%s. Reason: %s'],
10
10
  [c.SYNC_SPLITS_FETCH_FAILS, c.LOG_PREFIX_SYNC_SPLITS + 'Error while doing fetch of feature flags. %s'],
@@ -1,2 +1 @@
1
- import { ILogger } from '../../logger/types';
2
- export declare function allMatcherContext(log: ILogger): (runtimeAttr: string) => boolean;
1
+ export declare function allMatcherContext(): (runtimeAttr: string) => boolean;
@@ -1,3 +1,2 @@
1
1
  import { IBetweenMatcherData } from '../../dtos/types';
2
- import { ILogger } from '../../logger/types';
3
- export declare function betweenMatcherContext(log: ILogger, ruleVO: IBetweenMatcherData): (runtimeAttr: number) => boolean;
2
+ export declare function betweenMatcherContext(ruleVO: IBetweenMatcherData): (runtimeAttr: number) => boolean;
@@ -1,2 +1 @@
1
- import { ILogger } from '../../logger/types';
2
- export declare function booleanMatcherContext(log: ILogger, ruleAttr: boolean): (runtimeAttr: boolean) => boolean;
1
+ export declare function booleanMatcherContext(ruleAttr: boolean): (runtimeAttr: boolean) => boolean;
@@ -1,2 +1 @@
1
- import { ILogger } from '../../logger/types';
2
- export declare function containsAllSetMatcherContext(log: ILogger, ruleAttr: string[]): (runtimeAttr: string[]) => boolean;
1
+ export declare function containsAllSetMatcherContext(ruleAttr: string[]): (runtimeAttr: string[]) => boolean;
@@ -1,2 +1 @@
1
- import { ILogger } from '../../logger/types';
2
- export declare function containsAnySetMatcherContext(log: ILogger, ruleAttr: string[]): (runtimeAttr: string[]) => boolean;
1
+ export declare function containsAnySetMatcherContext(ruleAttr: string[]): (runtimeAttr: string[]) => boolean;
@@ -1,2 +1 @@
1
- import { ILogger } from '../../logger/types';
2
- export declare function containsStringMatcherContext(log: ILogger, ruleAttr: string[]): (runtimeAttr: string) => boolean;
1
+ export declare function containsStringMatcherContext(ruleAttr: string[]): (runtimeAttr: string) => boolean;
@@ -2,4 +2,4 @@ import { IDependencyMatcherData, MaybeThenable } from '../../dtos/types';
2
2
  import { IStorageAsync, IStorageSync } from '../../storages/types';
3
3
  import { ILogger } from '../../logger/types';
4
4
  import { IDependencyMatcherValue, ISplitEvaluator } from '../types';
5
- export declare function dependencyMatcherContext(log: ILogger, { split, treatments }: IDependencyMatcherData, storage: IStorageSync | IStorageAsync): ({ key, attributes }: IDependencyMatcherValue, splitEvaluator: ISplitEvaluator) => MaybeThenable<boolean>;
5
+ export declare function dependencyMatcherContext({ split, treatments }: IDependencyMatcherData, storage: IStorageSync | IStorageAsync, log: ILogger): ({ key, attributes }: IDependencyMatcherValue, splitEvaluator: ISplitEvaluator) => MaybeThenable<boolean>;
@@ -1,2 +1 @@
1
- import { ILogger } from '../../logger/types';
2
- export declare function equalToMatcherContext(log: ILogger, ruleAttr: number): (runtimeAttr: number) => boolean;
1
+ export declare function equalToMatcherContext(ruleAttr: number): (runtimeAttr: number) => boolean;
@@ -1,2 +1 @@
1
- import { ILogger } from '../../logger/types';
2
- export declare function equalToSetMatcherContext(log: ILogger, ruleAttr: string[]): (runtimeAttr: string[]) => boolean;
1
+ export declare function equalToSetMatcherContext(ruleAttr: string[]): (runtimeAttr: string[]) => boolean;
@@ -1,2 +1 @@
1
- import { ILogger } from '../../logger/types';
2
- export declare function endsWithMatcherContext(log: ILogger, ruleAttr: string[]): (runtimeAttr: string) => boolean;
1
+ export declare function endsWithMatcherContext(ruleAttr: string[]): (runtimeAttr: string) => boolean;
@@ -1,2 +1 @@
1
- import { ILogger } from '../../logger/types';
2
- export declare function greaterThanEqualMatcherContext(log: ILogger, ruleAttr: number): (runtimeAttr: number) => boolean;
1
+ export declare function greaterThanEqualMatcherContext(ruleAttr: number): (runtimeAttr: number) => boolean;
@@ -1,2 +1 @@
1
- import { ILogger } from '../../logger/types';
2
- export declare function lessThanEqualMatcherContext(log: ILogger, ruleAttr: number): (runtimeAttr: number) => boolean;
1
+ export declare function lessThanEqualMatcherContext(ruleAttr: number): (runtimeAttr: number) => boolean;
@@ -1,2 +1 @@
1
- import { ILogger } from '../../logger/types';
2
- export declare function partOfSetMatcherContext(log: ILogger, ruleAttr: string[]): (runtimeAttr: string[]) => boolean;
1
+ export declare function partOfSetMatcherContext(ruleAttr: string[]): (runtimeAttr: string[]) => boolean;
@@ -1,6 +1,5 @@
1
1
  import { MaybeThenable } from '../../dtos/types';
2
2
  import { ISegmentsCacheBase } from '../../storages/types';
3
- import { ILogger } from '../../logger/types';
4
- export declare function segmentMatcherContext(log: ILogger, segmentName: string, storage: {
3
+ export declare function segmentMatcherContext(segmentName: string, storage: {
5
4
  segments: ISegmentsCacheBase;
6
5
  }): (key: string) => MaybeThenable<boolean>;
@@ -0,0 +1,3 @@
1
+ import { ISet } from '../../utils/lang/sets';
2
+ import { ILogger } from '../../logger/types';
3
+ export declare function inListSemverMatcherContext(log: ILogger, ruleAttr: ISet<string>): (runtimeAttr: string) => boolean;
@@ -1,3 +1,2 @@
1
1
  import { IBetweenStringMatcherData } from '../../dtos/types';
2
- import { ILogger } from '../../logger/types';
3
- export declare function betweenSemverMatcherContext(log: ILogger, ruleAttr: IBetweenStringMatcherData): (runtimeAttr: string) => boolean;
2
+ export declare function betweenSemverMatcherContext(ruleAttr: IBetweenStringMatcherData): (runtimeAttr: string) => boolean;
@@ -1,2 +1 @@
1
- import { ILogger } from '../../logger/types';
2
- export declare function equalToSemverMatcherContext(log: ILogger, ruleAttr: string): (runtimeAttr: string) => boolean;
1
+ export declare function equalToSemverMatcherContext(ruleAttr: string): (runtimeAttr: string) => boolean;
@@ -1,2 +1 @@
1
- import { ILogger } from '../../logger/types';
2
- export declare function greaterThanEqualToSemverMatcherContext(log: ILogger, ruleAttr: string): (runtimeAttr: string) => boolean;
1
+ export declare function greaterThanEqualToSemverMatcherContext(ruleAttr: string): (runtimeAttr: string) => boolean;
@@ -1,2 +1 @@
1
- import { ILogger } from '../../logger/types';
2
- export declare function inListSemverMatcherContext(log: ILogger, ruleAttr: string[]): (runtimeAttr: string) => boolean;
1
+ export declare function inListSemverMatcherContext(ruleAttr: string[]): (runtimeAttr: string) => boolean;
@@ -1,2 +1 @@
1
- import { ILogger } from '../../logger/types';
2
- export declare function lessThanEqualToSemverMatcherContext(log: ILogger, ruleAttr: string): (runtimeAttr: string) => boolean;
1
+ export declare function lessThanEqualToSemverMatcherContext(ruleAttr: string): (runtimeAttr: string) => boolean;
@@ -1,2 +1 @@
1
- import { ILogger } from '../../logger/types';
2
- export declare function stringMatcherContext(log: ILogger, ruleAttr: string): (runtimeAttr: string) => boolean;
1
+ export declare function stringMatcherContext(ruleAttr: string): (runtimeAttr: string) => boolean;
@@ -1,2 +1 @@
1
- import { ILogger } from '../../logger/types';
2
- export declare function startsWithMatcherContext(log: ILogger, ruleAttr: string[]): (runtimeAttr: string) => boolean;
1
+ export declare function startsWithMatcherContext(ruleAttr: string[]): (runtimeAttr: string) => boolean;
@@ -1,2 +1 @@
1
- import { ILogger } from '../../logger/types';
2
- export declare function whitelistMatcherContext(log: ILogger, ruleAttr: string[]): (runtimeAttr: string) => boolean;
1
+ export declare function whitelistMatcherContext(ruleAttr: string[]): (runtimeAttr: string) => boolean;
@@ -1,5 +1,5 @@
1
- import { IWhitelistMatcherData } from '../../dtos/types';
1
+ import { ISplitMatcher } from '../../dtos/types';
2
2
  /**
3
3
  * Extract whitelist array. Used by set and string matchers
4
4
  */
5
- export declare function setTransform(whitelistObject: IWhitelistMatcherData): string[];
5
+ export declare function setTransform(whitelistObject: ISplitMatcher['whitelistMatcherData']): string[] | null | undefined;
@@ -0,0 +1,7 @@
1
+ import { ISplitMatcher } from '../../dtos/types';
2
+ /**
3
+ * Extract value from string matcher data.
4
+ */
5
+ export declare function stringTransform({ stringMatcherData }: ISplitMatcher): {
6
+ value: string | null | undefined;
7
+ };
@@ -9,24 +9,8 @@ export declare const ENGINE_COMBINER_AND = 0;
9
9
  export declare const ENGINE_COMBINER_IFELSEIF = 1;
10
10
  export declare const ENGINE_COMBINER_IFELSEIF_NO_TREATMENT = 2;
11
11
  export declare const ENGINE_BUCKET = 3;
12
- export declare const ENGINE_MATCHER_ALL = 4;
13
- export declare const ENGINE_MATCHER_BETWEEN = 5;
14
- export declare const ENGINE_MATCHER_BOOLEAN = 6;
15
- export declare const ENGINE_MATCHER_CONTAINS_ALL = 7;
16
- export declare const ENGINE_MATCHER_CONTAINS_ANY = 8;
17
- export declare const ENGINE_MATCHER_CONTAINS_STRING = 9;
18
12
  export declare const ENGINE_MATCHER_DEPENDENCY = 10;
19
13
  export declare const ENGINE_MATCHER_DEPENDENCY_PRE = 11;
20
- export declare const ENGINE_MATCHER_EQUAL = 12;
21
- export declare const ENGINE_MATCHER_EQUAL_TO_SET = 13;
22
- export declare const ENGINE_MATCHER_ENDS_WITH = 14;
23
- export declare const ENGINE_MATCHER_GREATER = 15;
24
- export declare const ENGINE_MATCHER_LESS = 16;
25
- export declare const ENGINE_MATCHER_PART_OF = 17;
26
- export declare const ENGINE_MATCHER_SEGMENT = 18;
27
- export declare const ENGINE_MATCHER_STRING = 19;
28
- export declare const ENGINE_MATCHER_STARTS_WITH = 21;
29
- export declare const ENGINE_MATCHER_WHITELIST = 22;
30
14
  export declare const ENGINE_VALUE = 23;
31
15
  export declare const ENGINE_SANITIZE = 24;
32
16
  export declare const CLEANUP_REGISTERING = 25;
@@ -44,6 +28,7 @@ export declare const SYNC_TASK_START = 36;
44
28
  export declare const SYNC_TASK_EXECUTE = 37;
45
29
  export declare const SYNC_TASK_STOP = 38;
46
30
  export declare const SETTINGS_SPLITS_FILTER = 39;
31
+ export declare const ENGINE_MATCHER_RESULT = 40;
47
32
  export declare const CLIENT_READY_FROM_CACHE = 100;
48
33
  export declare const CLIENT_READY = 101;
49
34
  export declare const IMPRESSION = 102;
@@ -0,0 +1,6 @@
1
+ import { SplitIO } from '../types';
2
+ export declare function buildInstanceId(key: SplitIO.SplitKey, trafficType?: string): string;
3
+ export declare function parseInstanceId(instanceId: string): {
4
+ key: SplitIO.SplitKey;
5
+ trafficType?: string;
6
+ };
@@ -0,0 +1,46 @@
1
+ import { ISplit, MaybeThenable } from '../dtos/types';
2
+ /**
3
+ * This class provides a skeletal implementation of the ISplitsCacheAsync interface
4
+ * to minimize the effort required to implement this interface.
5
+ */
6
+ export declare abstract class AbstractSplitsCache {
7
+ /**
8
+ * Check if the splits information is already stored in cache. This data can be preloaded.
9
+ * It is used as condition to emit SDK_SPLITS_CACHE_LOADED, and then SDK_READY_FROM_CACHE.
10
+ */
11
+ checkCache(): boolean;
12
+ protected abstract addSplit(name: string, split: ISplit): MaybeThenable<boolean>;
13
+ /**
14
+ * Add a list of splits.
15
+ * The returned promise is resolved when the operation success or rejected if it fails (e.g., wrapper operation fails).
16
+ */
17
+ protected addSplits(entries: [string, ISplit][]): Promise<boolean[]>;
18
+ protected abstract removeSplit(name: string): MaybeThenable<boolean>;
19
+ /**
20
+ * Remove a list of splits.
21
+ * The returned promise is resolved when the operation success, with a boolean array indicating if the splits existed or not.
22
+ * or rejected if it fails (e.g., wrapper operation fails).
23
+ */
24
+ protected removeSplits(names: string[]): Promise<boolean[]>;
25
+ protected abstract setChangeNumber(changeNumber: number): MaybeThenable<boolean | void>;
26
+ /**
27
+ * Updates the cache with the provided changeNumber, feature flags to add and feature flags to remove.
28
+ *
29
+ * @returns {Promise<boolean>} a promise that resolved once the operation is performed successfully. The fulfillment value is `true` if at least one feature flag was added, modified or removed; or `false` if there was no change.
30
+ * The promise will reject if some storage operation rejects.
31
+ */
32
+ update(changeNumber: number, toAdd: [string, ISplit][], toRemove?: string[]): Promise<boolean>;
33
+ abstract getSplit(name: string): MaybeThenable<ISplit | null>;
34
+ /**
35
+ * Kill `name` split and set `defaultTreatment` and `changeNumber`.
36
+ * Used for SPLIT_KILL push notifications.
37
+ *
38
+ * @param {string} name
39
+ * @param {string} defaultTreatment
40
+ * @param {number} changeNumber
41
+ * @returns {Promise} a promise that is resolved once the split kill operation is performed. The fulfillment value is a boolean: `true` if the operation successed updating the split or `false` if no split is updated,
42
+ * for instance, if the `changeNumber` is old, or if the split is not found (e.g., `/splitchanges` hasn't been fetched yet), or if the storage fails to apply the update.
43
+ * The promise will never be rejected.
44
+ */
45
+ killLocally(name: string, defaultTreatment: string, changeNumber: number): Promise<boolean>;
46
+ }
@@ -0,0 +1,27 @@
1
+ import { Compression, KeyList } from './SSEHandler/types';
2
+ /**
3
+ * Decode, decompress and parse the provided 'data' into a KeyList object
4
+ *
5
+ * @param {string} data
6
+ * @param {number} compression
7
+ * @returns {{a?: string[], r?: string[] }}
8
+ * @throws if data string cannot be decoded, decompressed or parsed
9
+ */
10
+ export declare function parseKeyList(data: string, compression: Compression): KeyList;
11
+ /**
12
+ * Decode, decompress and parse the provided 'data' into a Bitmap object
13
+ *
14
+ * @param {string} data
15
+ * @param {number} compression
16
+ * @returns {Uint8Array}
17
+ * @throws if data string cannot be decoded or decompressed
18
+ */
19
+ export declare function parseBitmap(data: string, compression: Compression): Uint8Array;
20
+ /**
21
+ * Check if the 'bitmap' bit at 'hash64hex' position is 1
22
+ *
23
+ * @param {Uint8Array} bitmap
24
+ * @param {string} hash64hex 16-chars string, representing a number in hexa
25
+ * @returns {boolean}
26
+ */
27
+ export declare function isInBitmap(bitmap: Uint8Array, hash64hex: string): boolean;
@@ -2,4 +2,4 @@ import { ISettings } from '../../types';
2
2
  /**
3
3
  * Storage is async if mode is consumer or partial consumer
4
4
  */
5
- export declare function isStorageSync(settings: ISettings): boolean;
5
+ export declare function isStorageSync(settings: Pick<ISettings, 'mode'>): boolean;
@@ -0,0 +1,7 @@
1
+ import { ILogger } from '../../logger/types';
2
+ /** validates the given SDK key */
3
+ export declare function validateApiKey(log: ILogger, maybeSdkKey: any): string | false;
4
+ export declare const usedKeysMap: Record<string, number>;
5
+ /** validates the given SDK key and also warns if it is in use */
6
+ export declare function validateAndTrackApiKey(log: ILogger, maybeSdkKey: any): string | false;
7
+ export declare function releaseApiKey(sdkKey: string): void;
@@ -0,0 +1,8 @@
1
+ import { LogLevel } from '../../../types';
2
+ /**
3
+ * The debug level can be set globally via the `localStorage.splitio_debug` item in browser, or the `SPLITIO_DEBUG` env var in NodeJS.
4
+ * Acceptable values are: 'DEBUG', 'INFO', 'WARN', 'ERROR', 'NONE'.
5
+ * Other acceptable values are 'on', 'enable' and 'enabled', which are equivalent to 'DEBUG'.
6
+ * Any other value, like undefined, null or an invalid string, returns `undefined` and means that the global log level is not set.
7
+ */
8
+ export declare function getGlobalLogLevel(): LogLevel | undefined;
File without changes