@splitsoftware/splitio-commons 1.13.2-rc.7 → 1.13.2-rc.9
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.
- package/CHANGES.txt +2 -2
- package/cjs/evaluator/matchers/all.js +3 -1
- package/cjs/evaluator/matchers/between.js +3 -1
- package/cjs/evaluator/matchers/boolean.js +3 -1
- package/cjs/evaluator/matchers/cont_all.js +3 -1
- package/cjs/evaluator/matchers/cont_any.js +3 -1
- package/cjs/evaluator/matchers/cont_str.js +3 -1
- package/cjs/evaluator/matchers/dependency.js +1 -1
- package/cjs/evaluator/matchers/eq.js +3 -1
- package/cjs/evaluator/matchers/eq_set.js +3 -1
- package/cjs/evaluator/matchers/ew.js +3 -1
- package/cjs/evaluator/matchers/gte.js +3 -1
- package/cjs/evaluator/matchers/index.js +1 -1
- package/cjs/evaluator/matchers/lte.js +3 -1
- package/cjs/evaluator/matchers/part_of.js +3 -1
- package/cjs/evaluator/matchers/segment.js +6 -1
- package/cjs/evaluator/matchers/semver_between.js +1 -1
- package/cjs/evaluator/matchers/semver_eq.js +1 -1
- package/cjs/evaluator/matchers/semver_gte.js +1 -1
- package/cjs/evaluator/matchers/semver_inlist.js +1 -1
- package/cjs/evaluator/matchers/semver_lte.js +1 -1
- package/cjs/evaluator/matchers/string.js +3 -1
- package/cjs/evaluator/matchers/sw.js +3 -1
- package/cjs/evaluator/matchers/whitelist.js +3 -1
- package/cjs/evaluator/parser/index.js +4 -7
- package/cjs/logger/constants.js +19 -4
- package/cjs/logger/messages/debug.js +20 -5
- package/cjs/logger/messages/error.js +1 -1
- package/cjs/logger/messages/warn.js +1 -1
- package/cjs/services/splitApi.js +1 -1
- package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +1 -1
- package/cjs/storages/pluggable/index.js +1 -1
- package/cjs/utils/labels/index.js +1 -1
- package/esm/evaluator/matchers/all.js +3 -1
- package/esm/evaluator/matchers/between.js +3 -1
- package/esm/evaluator/matchers/boolean.js +3 -1
- package/esm/evaluator/matchers/cont_all.js +3 -1
- package/esm/evaluator/matchers/cont_any.js +3 -1
- package/esm/evaluator/matchers/cont_str.js +3 -1
- package/esm/evaluator/matchers/dependency.js +1 -1
- package/esm/evaluator/matchers/eq.js +3 -1
- package/esm/evaluator/matchers/eq_set.js +3 -1
- package/esm/evaluator/matchers/ew.js +3 -1
- package/esm/evaluator/matchers/gte.js +3 -1
- package/esm/evaluator/matchers/index.js +1 -1
- package/esm/evaluator/matchers/lte.js +3 -1
- package/esm/evaluator/matchers/part_of.js +3 -1
- package/esm/evaluator/matchers/segment.js +6 -1
- package/esm/evaluator/matchers/semver_between.js +1 -1
- package/esm/evaluator/matchers/semver_eq.js +1 -1
- package/esm/evaluator/matchers/semver_gte.js +1 -1
- package/esm/evaluator/matchers/semver_inlist.js +1 -1
- package/esm/evaluator/matchers/semver_lte.js +1 -1
- package/esm/evaluator/matchers/string.js +3 -1
- package/esm/evaluator/matchers/sw.js +3 -1
- package/esm/evaluator/matchers/whitelist.js +3 -1
- package/esm/evaluator/parser/index.js +5 -8
- package/esm/logger/constants.js +16 -1
- package/esm/logger/messages/debug.js +20 -5
- package/esm/logger/messages/error.js +1 -1
- package/esm/logger/messages/warn.js +1 -1
- package/esm/services/splitApi.js +1 -1
- package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +1 -1
- package/esm/storages/pluggable/index.js +1 -1
- package/esm/utils/labels/index.js +1 -1
- package/package.json +1 -1
- package/src/evaluator/matchers/all.ts +5 -1
- package/src/evaluator/matchers/between.ts +7 -3
- package/src/evaluator/matchers/boolean.ts +6 -2
- package/src/evaluator/matchers/cont_all.ts +5 -1
- package/src/evaluator/matchers/cont_any.ts +5 -1
- package/src/evaluator/matchers/cont_str.ts +6 -2
- package/src/evaluator/matchers/dependency.ts +1 -1
- package/src/evaluator/matchers/eq.ts +6 -2
- package/src/evaluator/matchers/eq_set.ts +5 -1
- package/src/evaluator/matchers/ew.ts +6 -2
- package/src/evaluator/matchers/gte.ts +6 -2
- package/src/evaluator/matchers/index.ts +1 -1
- package/src/evaluator/matchers/lte.ts +6 -2
- package/src/evaluator/matchers/part_of.ts +5 -1
- package/src/evaluator/matchers/segment.ts +8 -1
- package/src/evaluator/matchers/semver_between.ts +2 -1
- package/src/evaluator/matchers/semver_eq.ts +2 -1
- package/src/evaluator/matchers/semver_gte.ts +2 -1
- package/src/evaluator/matchers/semver_inlist.ts +2 -2
- package/src/evaluator/matchers/semver_lte.ts +2 -1
- package/src/evaluator/matchers/string.ts +6 -1
- package/src/evaluator/matchers/sw.ts +6 -2
- package/src/evaluator/matchers/whitelist.ts +5 -1
- package/src/evaluator/parser/index.ts +5 -9
- package/src/logger/constants.ts +16 -1
- package/src/logger/messages/debug.ts +20 -5
- package/src/logger/messages/error.ts +1 -1
- package/src/logger/messages/warn.ts +1 -1
- package/src/services/splitApi.ts +1 -1
- package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +1 -1
- package/src/storages/pluggable/index.ts +1 -1
- package/src/utils/labels/index.ts +1 -1
- package/types/evaluator/matchers/all.d.ts +2 -1
- package/types/evaluator/matchers/between.d.ts +2 -1
- package/types/evaluator/matchers/boolean.d.ts +2 -1
- package/types/evaluator/matchers/cont_all.d.ts +2 -1
- package/types/evaluator/matchers/cont_any.d.ts +2 -1
- package/types/evaluator/matchers/cont_str.d.ts +2 -1
- package/types/evaluator/matchers/dependency.d.ts +1 -1
- package/types/evaluator/matchers/eq.d.ts +2 -1
- package/types/evaluator/matchers/eq_set.d.ts +2 -1
- package/types/evaluator/matchers/ew.d.ts +2 -1
- package/types/evaluator/matchers/gte.d.ts +2 -1
- package/types/evaluator/matchers/lte.d.ts +2 -1
- package/types/evaluator/matchers/part_of.d.ts +2 -1
- package/types/evaluator/matchers/segment.d.ts +2 -1
- package/types/evaluator/matchers/semver_between.d.ts +2 -1
- package/types/evaluator/matchers/semver_eq.d.ts +2 -1
- package/types/evaluator/matchers/semver_gte.d.ts +2 -1
- package/types/evaluator/matchers/semver_inlist.d.ts +2 -1
- package/types/evaluator/matchers/semver_lte.d.ts +2 -1
- package/types/evaluator/matchers/string.d.ts +2 -1
- package/types/evaluator/matchers/sw.d.ts +2 -1
- package/types/evaluator/matchers/whitelist.d.ts +2 -1
- package/types/evaluator/matchersTransform/set.d.ts +2 -2
- package/types/logger/constants.d.ts +16 -1
- package/types/trackers/impressionObserver/utils.d.ts +1 -1
- package/types/utils/labels/index.d.ts +1 -1
- package/types/evaluator/matchers/sember_inlist.d.ts +0 -3
- package/types/evaluator/matchersTransform/string.d.ts +0 -7
- package/types/sdkClient/identity.d.ts +0 -6
- package/types/storages/AbstractSplitsCache.d.ts +0 -46
- package/types/sync/streaming/mySegmentsV2utils.d.ts +0 -27
- package/types/utils/inputValidation/sdkKey.d.ts +0 -7
- package/types/utils/settingsValidation/logger/globalLogLevel.d.ts +0 -8
- /package/types/utils/{semVer.d.ts → Semver.d.ts} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { ENGINE_MATCHER_EQUAL_TO_SET } from '../../logger/constants';
|
|
1
2
|
import { findIndex } from '../../utils/lang';
|
|
2
|
-
export function equalToSetMatcherContext(ruleAttr) {
|
|
3
|
+
export function equalToSetMatcherContext(log, ruleAttr) {
|
|
3
4
|
return function equalToSetMatcher(runtimeAttr) {
|
|
4
5
|
// Length being the same is the first condition.
|
|
5
6
|
var isEqual = runtimeAttr.length === ruleAttr.length;
|
|
@@ -11,6 +12,7 @@ export function equalToSetMatcherContext(ruleAttr) {
|
|
|
11
12
|
for (var i = 0; i < runtimeAttr.length && isEqual; i++) {
|
|
12
13
|
_loop_1(i);
|
|
13
14
|
}
|
|
15
|
+
log.debug(ENGINE_MATCHER_EQUAL_TO_SET, [runtimeAttr, ruleAttr, isEqual]);
|
|
14
16
|
return isEqual;
|
|
15
17
|
};
|
|
16
18
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { ENGINE_MATCHER_ENDS_WITH } from '../../logger/constants';
|
|
1
2
|
import { endsWith } from '../../utils/lang';
|
|
2
|
-
export function endsWithMatcherContext(ruleAttr) {
|
|
3
|
+
export function endsWithMatcherContext(log, ruleAttr) {
|
|
3
4
|
return function endsWithMatcher(runtimeAttr) {
|
|
4
5
|
var strEndsWith = ruleAttr.some(function (e) { return endsWith(runtimeAttr, e); });
|
|
6
|
+
log.debug(ENGINE_MATCHER_ENDS_WITH, [runtimeAttr, ruleAttr, strEndsWith]);
|
|
5
7
|
return strEndsWith;
|
|
6
8
|
};
|
|
7
9
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { ENGINE_MATCHER_GREATER } from '../../logger/constants';
|
|
2
|
+
export function greaterThanEqualMatcherContext(log, ruleAttr) {
|
|
2
3
|
return function greaterThanEqualMatcher(runtimeAttr) {
|
|
3
4
|
var isGreaterThanEqual = runtimeAttr >= ruleAttr;
|
|
5
|
+
log.debug(ENGINE_MATCHER_GREATER, [runtimeAttr, ruleAttr, isGreaterThanEqual]);
|
|
4
6
|
return isGreaterThanEqual;
|
|
5
7
|
};
|
|
6
8
|
}
|
|
@@ -53,6 +53,6 @@ export function matcherFactory(log, matcherDto, storage) {
|
|
|
53
53
|
var matcherFn;
|
|
54
54
|
// @ts-ignore
|
|
55
55
|
if (matchers[type])
|
|
56
|
-
matcherFn = matchers[type](value, storage
|
|
56
|
+
matcherFn = matchers[type](log, value, storage); // There is no index-out-of-bound exception in JavaScript
|
|
57
57
|
return matcherFn;
|
|
58
58
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { ENGINE_MATCHER_LESS } from '../../logger/constants';
|
|
2
|
+
export function lessThanEqualMatcherContext(log, ruleAttr) {
|
|
2
3
|
return function lessThanEqualMatcher(runtimeAttr) {
|
|
3
4
|
var isLessThanEqual = runtimeAttr <= ruleAttr;
|
|
5
|
+
log.debug(ENGINE_MATCHER_LESS, [runtimeAttr, ruleAttr, isLessThanEqual]);
|
|
4
6
|
return isLessThanEqual;
|
|
5
7
|
};
|
|
6
8
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { findIndex } from '../../utils/lang';
|
|
2
|
-
|
|
2
|
+
import { ENGINE_MATCHER_PART_OF } from '../../logger/constants';
|
|
3
|
+
export function partOfSetMatcherContext(log, ruleAttr) {
|
|
3
4
|
return function partOfMatcher(runtimeAttr) {
|
|
4
5
|
// To be part of the length should be minor or equal.
|
|
5
6
|
var isPartOf = runtimeAttr.length <= ruleAttr.length;
|
|
@@ -11,6 +12,7 @@ export function partOfSetMatcherContext(ruleAttr) {
|
|
|
11
12
|
for (var i = 0; i < runtimeAttr.length && isPartOf; i++) {
|
|
12
13
|
_loop_1(i);
|
|
13
14
|
}
|
|
15
|
+
log.debug(ENGINE_MATCHER_PART_OF, [runtimeAttr, ruleAttr, isPartOf]);
|
|
14
16
|
return isPartOf;
|
|
15
17
|
};
|
|
16
18
|
}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { thenable } from '../../utils/promise/thenable';
|
|
2
|
-
|
|
2
|
+
import { ENGINE_MATCHER_SEGMENT } from '../../logger/constants';
|
|
3
|
+
export function segmentMatcherContext(log, segmentName, storage) {
|
|
3
4
|
return function segmentMatcher(key) {
|
|
4
5
|
var isInSegment = storage.segments.isInSegment(segmentName, key);
|
|
5
6
|
if (thenable(isInSegment)) {
|
|
6
7
|
isInSegment.then(function (result) {
|
|
8
|
+
log.debug(ENGINE_MATCHER_SEGMENT, [segmentName, key, isInSegment]);
|
|
7
9
|
return result;
|
|
8
10
|
});
|
|
9
11
|
}
|
|
12
|
+
else {
|
|
13
|
+
log.debug(ENGINE_MATCHER_SEGMENT, [segmentName, key, isInSegment]);
|
|
14
|
+
}
|
|
10
15
|
return isInSegment;
|
|
11
16
|
};
|
|
12
17
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Semver } from '../../utils/Semver';
|
|
2
|
-
export function betweenSemverMatcherContext(ruleAttr) {
|
|
2
|
+
export function betweenSemverMatcherContext(log, ruleAttr) {
|
|
3
3
|
var startSemver = new Semver(ruleAttr.start);
|
|
4
4
|
var endSemver = new Semver(ruleAttr.end);
|
|
5
5
|
return function betweenSemverMatcher(runtimeAttr) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Semver } from '../../utils/Semver';
|
|
2
|
-
export function equalToSemverMatcherContext(ruleAttr) {
|
|
2
|
+
export function equalToSemverMatcherContext(log, ruleAttr) {
|
|
3
3
|
var ruleSemver = new Semver(ruleAttr);
|
|
4
4
|
return function equalToSemverMatcher(runtimeAttr) {
|
|
5
5
|
var runtimeSemver = new Semver(runtimeAttr);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Semver } from '../../utils/Semver';
|
|
2
|
-
export function greaterThanEqualToSemverMatcherContext(ruleAttr) {
|
|
2
|
+
export function greaterThanEqualToSemverMatcherContext(log, ruleAttr) {
|
|
3
3
|
var ruleSemver = new Semver(ruleAttr);
|
|
4
4
|
return function greaterThanEqualToSemverMatcher(runtimeAttr) {
|
|
5
5
|
var runtimeSemver = new Semver(runtimeAttr);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _Set } from '../../utils/lang/sets';
|
|
2
2
|
import { Semver } from '../../utils/Semver';
|
|
3
|
-
export function inListSemverMatcherContext(ruleAttr) {
|
|
3
|
+
export function inListSemverMatcherContext(log, ruleAttr) {
|
|
4
4
|
// @TODO ruleAttr validation should be done at the `parser` or `matchersTransform` level to reuse for all matchers
|
|
5
5
|
if (!ruleAttr || ruleAttr.length === 0)
|
|
6
6
|
throw new Error('whitelistMatcherData is required for IN_LIST_SEMVER matcher type');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Semver } from '../../utils/Semver';
|
|
2
|
-
export function lessThanEqualToSemverMatcherContext(ruleAttr) {
|
|
2
|
+
export function lessThanEqualToSemverMatcherContext(log, ruleAttr) {
|
|
3
3
|
var ruleSemver = new Semver(ruleAttr);
|
|
4
4
|
return function lessThanEqualToSemverMatcher(runtimeAttr) {
|
|
5
5
|
var runtimeSemver = new Semver(runtimeAttr);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { ENGINE_MATCHER_STRING } from '../../logger/constants';
|
|
2
|
+
export function stringMatcherContext(log, ruleAttr) {
|
|
2
3
|
var regex = new RegExp(ruleAttr);
|
|
3
4
|
return function stringMatcher(runtimeAttr) {
|
|
4
5
|
var regexMatches = regex.test(runtimeAttr);
|
|
6
|
+
log.debug(ENGINE_MATCHER_STRING, [runtimeAttr, ruleAttr, regexMatches ? 'yes' : 'no']);
|
|
5
7
|
return regexMatches;
|
|
6
8
|
};
|
|
7
9
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { ENGINE_MATCHER_STARTS_WITH } from '../../logger/constants';
|
|
1
2
|
import { startsWith } from '../../utils/lang';
|
|
2
|
-
export function startsWithMatcherContext(ruleAttr) {
|
|
3
|
+
export function startsWithMatcherContext(log, ruleAttr) {
|
|
3
4
|
return function startsWithMatcher(runtimeAttr) {
|
|
4
5
|
var matches = ruleAttr.some(function (e) { return startsWith(runtimeAttr, e); });
|
|
6
|
+
log.debug(ENGINE_MATCHER_STARTS_WITH, [runtimeAttr, ruleAttr, matches]);
|
|
5
7
|
return matches;
|
|
6
8
|
};
|
|
7
9
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { _Set } from '../../utils/lang/sets';
|
|
2
|
-
|
|
2
|
+
import { ENGINE_MATCHER_WHITELIST } from '../../logger/constants';
|
|
3
|
+
export function whitelistMatcherContext(log, ruleAttr) {
|
|
3
4
|
var whitelistSet = new _Set(ruleAttr);
|
|
4
5
|
return function whitelistMatcher(runtimeAttr) {
|
|
5
6
|
var isInWhitelist = whitelistSet.has(runtimeAttr);
|
|
7
|
+
log.debug(ENGINE_MATCHER_WHITELIST, [runtimeAttr, ruleAttr.join(','), isInWhitelist]);
|
|
6
8
|
return isInWhitelist;
|
|
7
9
|
};
|
|
8
10
|
}
|
|
@@ -6,7 +6,7 @@ import { conditionContext } from '../condition';
|
|
|
6
6
|
import { ifElseIfCombinerContext } from '../combiners/ifelseif';
|
|
7
7
|
import { andCombinerContext } from '../combiners/and';
|
|
8
8
|
import { thenable } from '../../utils/promise/thenable';
|
|
9
|
-
import { ENGINE_MATCHER_ERROR
|
|
9
|
+
import { ENGINE_MATCHER_ERROR } from '../../logger/constants';
|
|
10
10
|
export function parser(log, conditions, storage) {
|
|
11
11
|
var predicates = [];
|
|
12
12
|
for (var i = 0; i < conditions.length; i++) {
|
|
@@ -34,13 +34,10 @@ export function parser(log, conditions, storage) {
|
|
|
34
34
|
log.error(ENGINE_MATCHER_ERROR, [matcherDto.name, error]);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return thenable(result) ?
|
|
42
|
-
result.then(handleResult) :
|
|
43
|
-
handleResult(result);
|
|
37
|
+
if (thenable(result)) { // @ts-ignore
|
|
38
|
+
return result.then(function (res) { return Boolean(res ^ matcherDto.negate); });
|
|
39
|
+
} // @ts-ignore
|
|
40
|
+
return Boolean(result ^ matcherDto.negate);
|
|
44
41
|
};
|
|
45
42
|
});
|
|
46
43
|
// if matcher's factory can't instantiate the matchers, the expressions array will be empty
|
package/esm/logger/constants.js
CHANGED
|
@@ -9,8 +9,24 @@ export var ENGINE_COMBINER_AND = 0;
|
|
|
9
9
|
export var ENGINE_COMBINER_IFELSEIF = 1;
|
|
10
10
|
export var ENGINE_COMBINER_IFELSEIF_NO_TREATMENT = 2;
|
|
11
11
|
export var ENGINE_BUCKET = 3;
|
|
12
|
+
export var ENGINE_MATCHER_ALL = 4;
|
|
13
|
+
export var ENGINE_MATCHER_BETWEEN = 5;
|
|
14
|
+
export var ENGINE_MATCHER_BOOLEAN = 6;
|
|
15
|
+
export var ENGINE_MATCHER_CONTAINS_ALL = 7;
|
|
16
|
+
export var ENGINE_MATCHER_CONTAINS_ANY = 8;
|
|
17
|
+
export var ENGINE_MATCHER_CONTAINS_STRING = 9;
|
|
12
18
|
export var ENGINE_MATCHER_DEPENDENCY = 10;
|
|
13
19
|
export var ENGINE_MATCHER_DEPENDENCY_PRE = 11;
|
|
20
|
+
export var ENGINE_MATCHER_EQUAL = 12;
|
|
21
|
+
export var ENGINE_MATCHER_EQUAL_TO_SET = 13;
|
|
22
|
+
export var ENGINE_MATCHER_ENDS_WITH = 14;
|
|
23
|
+
export var ENGINE_MATCHER_GREATER = 15;
|
|
24
|
+
export var ENGINE_MATCHER_LESS = 16;
|
|
25
|
+
export var ENGINE_MATCHER_PART_OF = 17;
|
|
26
|
+
export var ENGINE_MATCHER_SEGMENT = 18;
|
|
27
|
+
export var ENGINE_MATCHER_STRING = 19;
|
|
28
|
+
export var ENGINE_MATCHER_STARTS_WITH = 21;
|
|
29
|
+
export var ENGINE_MATCHER_WHITELIST = 22;
|
|
14
30
|
export var ENGINE_VALUE = 23;
|
|
15
31
|
export var ENGINE_SANITIZE = 24;
|
|
16
32
|
export var CLEANUP_REGISTERING = 25;
|
|
@@ -28,7 +44,6 @@ export var SYNC_TASK_START = 36;
|
|
|
28
44
|
export var SYNC_TASK_EXECUTE = 37;
|
|
29
45
|
export var SYNC_TASK_STOP = 38;
|
|
30
46
|
export var SETTINGS_SPLITS_FILTER = 39;
|
|
31
|
-
export var ENGINE_MATCHER_RESULT = 40;
|
|
32
47
|
export var CLIENT_READY_FROM_CACHE = 100;
|
|
33
48
|
export var CLIENT_READY = 101;
|
|
34
49
|
export var IMPRESSION = 102;
|
|
@@ -6,11 +6,26 @@ export var codesDebug = codesInfo.concat([
|
|
|
6
6
|
[c.ENGINE_COMBINER_IFELSEIF, c.LOG_PREFIX_ENGINE_COMBINER + 'Treatment found: %s'],
|
|
7
7
|
[c.ENGINE_COMBINER_IFELSEIF_NO_TREATMENT, c.LOG_PREFIX_ENGINE_COMBINER + 'All predicates evaluated, no treatment found.'],
|
|
8
8
|
[c.ENGINE_BUCKET, c.LOG_PREFIX_ENGINE + ': using algo "murmur" bucket %s for key %s using seed %s - treatment %s'],
|
|
9
|
-
[c.
|
|
10
|
-
[c.
|
|
11
|
-
[c.
|
|
12
|
-
[c.
|
|
13
|
-
[c.
|
|
9
|
+
[c.ENGINE_MATCHER_ALL, c.LOG_PREFIX_ENGINE_MATCHER + '[allMatcher] is always true'],
|
|
10
|
+
[c.ENGINE_MATCHER_BETWEEN, c.LOG_PREFIX_ENGINE_MATCHER + '[betweenMatcher] is %s between %s and %s? %s'],
|
|
11
|
+
[c.ENGINE_MATCHER_BOOLEAN, c.LOG_PREFIX_ENGINE_MATCHER + '[booleanMatcher] %s === %s'],
|
|
12
|
+
[c.ENGINE_MATCHER_CONTAINS_ALL, c.LOG_PREFIX_ENGINE_MATCHER + '[containsAllMatcher] %s contains all elements of %s? %s'],
|
|
13
|
+
[c.ENGINE_MATCHER_CONTAINS_ANY, c.LOG_PREFIX_ENGINE_MATCHER + '[containsAnyMatcher] %s contains at least an element of %s? %s'],
|
|
14
|
+
[c.ENGINE_MATCHER_CONTAINS_STRING, c.LOG_PREFIX_ENGINE_MATCHER + '[containsStringMatcher] %s contains %s? %s'],
|
|
15
|
+
[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.'],
|
|
16
|
+
[c.ENGINE_MATCHER_DEPENDENCY_PRE, c.LOG_PREFIX_ENGINE_MATCHER + '[dependencyMatcher] will evaluate parent feature flag: "%s" with key: %s %s'],
|
|
17
|
+
[c.ENGINE_MATCHER_EQUAL, c.LOG_PREFIX_ENGINE_MATCHER + '[equalToMatcher] is %s equal to %s? %s'],
|
|
18
|
+
[c.ENGINE_MATCHER_EQUAL_TO_SET, c.LOG_PREFIX_ENGINE_MATCHER + '[equalToSetMatcher] is %s equal to set %s? %s'],
|
|
19
|
+
[c.ENGINE_MATCHER_ENDS_WITH, c.LOG_PREFIX_ENGINE_MATCHER + '[endsWithMatcher] %s ends with %s? %s'],
|
|
20
|
+
[c.ENGINE_MATCHER_GREATER, c.LOG_PREFIX_ENGINE_MATCHER + '[greaterThanEqualMatcher] is %s greater than %s? %s'],
|
|
21
|
+
[c.ENGINE_MATCHER_LESS, c.LOG_PREFIX_ENGINE_MATCHER + '[lessThanEqualMatcher] is %s less than %s? %s'],
|
|
22
|
+
[c.ENGINE_MATCHER_PART_OF, c.LOG_PREFIX_ENGINE_MATCHER + '[partOfMatcher] %s is part of %s? %s'],
|
|
23
|
+
[c.ENGINE_MATCHER_SEGMENT, c.LOG_PREFIX_ENGINE_MATCHER + '[segmentMatcher] evaluated %s / %s => %s'],
|
|
24
|
+
[c.ENGINE_MATCHER_STRING, c.LOG_PREFIX_ENGINE_MATCHER + '[stringMatcher] does %s matches with %s? %s'],
|
|
25
|
+
[c.ENGINE_MATCHER_STARTS_WITH, c.LOG_PREFIX_ENGINE_MATCHER + '[startsWithMatcher] %s starts with %s? %s'],
|
|
26
|
+
[c.ENGINE_MATCHER_WHITELIST, c.LOG_PREFIX_ENGINE_MATCHER + '[whitelistMatcher] evaluated %s in [%s] => %s'],
|
|
27
|
+
[c.ENGINE_VALUE, c.LOG_PREFIX_ENGINE_VALUE + 'Extracted attribute [%s], [%s] will be used for matching.'],
|
|
28
|
+
[c.ENGINE_SANITIZE, c.LOG_PREFIX_ENGINE + ':sanitize: Attempted to sanitize [%s] which should be of type [%s]. Sanitized and processed value => [%s]'],
|
|
14
29
|
// SDK
|
|
15
30
|
[c.CLEANUP_REGISTERING, c.LOG_PREFIX_CLEANUP + 'Registering cleanup handler %s'],
|
|
16
31
|
[c.CLEANUP_DEREGISTERING, c.LOG_PREFIX_CLEANUP + 'Deregistering cleanup handler %s'],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as c from '../constants';
|
|
2
2
|
export var codesError = [
|
|
3
3
|
// evaluator
|
|
4
|
-
[c.ERROR_ENGINE_COMBINER_IFELSEIF, c.LOG_PREFIX_ENGINE_COMBINER + 'Invalid feature flag, no valid rules or unsupported
|
|
4
|
+
[c.ERROR_ENGINE_COMBINER_IFELSEIF, c.LOG_PREFIX_ENGINE_COMBINER + 'Invalid feature flag, no valid rules or unsupported targeting rule type found'],
|
|
5
5
|
[c.ENGINE_MATCHER_ERROR, c.LOG_PREFIX_ENGINE_MATCHER + '[%s] %s'],
|
|
6
6
|
// SDK
|
|
7
7
|
[c.ERROR_LOGLEVEL_INVALID, 'logger: Invalid Log Level - No changes to the logs will be applied.'],
|
|
@@ -3,7 +3,7 @@ import { codesError } from './error';
|
|
|
3
3
|
export var codesWarn = codesError.concat([
|
|
4
4
|
// evaluator
|
|
5
5
|
[c.ENGINE_VALUE_INVALID, c.LOG_PREFIX_ENGINE_VALUE + 'Value %s doesn\'t match with expected type.'],
|
|
6
|
-
[c.ENGINE_VALUE_NO_ATTRIBUTES, c.LOG_PREFIX_ENGINE_VALUE + 'Defined attribute
|
|
6
|
+
[c.ENGINE_VALUE_NO_ATTRIBUTES, c.LOG_PREFIX_ENGINE_VALUE + 'Defined attribute [%s], no attributes received.'],
|
|
7
7
|
// synchronizer
|
|
8
8
|
[c.SYNC_MYSEGMENTS_FETCH_RETRY, c.LOG_PREFIX_SYNC_MYSEGMENTS + 'Retrying download of segments #%s. Reason: %s'],
|
|
9
9
|
[c.SYNC_SPLITS_FETCH_FAILS, c.LOG_PREFIX_SYNC_SPLITS + 'Error while doing fetch of feature flags. %s'],
|
package/esm/services/splitApi.js
CHANGED
|
@@ -38,7 +38,7 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
38
38
|
return splitHttpClient(url, undefined, telemetryTracker.trackHttp(TOKEN));
|
|
39
39
|
},
|
|
40
40
|
fetchSplitChanges: function (since, noCache, till) {
|
|
41
|
-
var url = urls.sdk + "/splitChanges?s=" + FLAGS_SPEC + "&since=" + since + (
|
|
41
|
+
var url = urls.sdk + "/splitChanges?s=" + FLAGS_SPEC + "&since=" + since + (filterQueryString || '') + (till ? '&till=' + till : '');
|
|
42
42
|
return splitHttpClient(url, noCache ? noCacheHeaderOptions : undefined, telemetryTracker.trackHttp(SPLITS))
|
|
43
43
|
.catch(function (err) {
|
|
44
44
|
if (err.statusCode === 414)
|
|
@@ -123,7 +123,7 @@ var SplitsCacheInLocal = /** @class */ (function (_super) {
|
|
|
123
123
|
SplitsCacheInLocal.prototype.setChangeNumber = function (changeNumber) {
|
|
124
124
|
// when using a new split query, we must update it at the store
|
|
125
125
|
if (this.updateNewFilter) {
|
|
126
|
-
this.log.info(LOG_PREFIX + 'SDK key or
|
|
126
|
+
this.log.info(LOG_PREFIX + 'SDK key, flags filter criteria or flags spec version was modified. Updating cache');
|
|
127
127
|
var storageHashKey = this.keys.buildHashKey();
|
|
128
128
|
try {
|
|
129
129
|
localStorage.setItem(storageHashKey, this.storageHash);
|
|
@@ -79,7 +79,7 @@ export function PluggableStorage(options) {
|
|
|
79
79
|
return wrapper.get(keys.buildHashKey()).then(function (hash) {
|
|
80
80
|
var currentHash = getStorageHash(settings);
|
|
81
81
|
if (hash !== currentHash) {
|
|
82
|
-
log.info(LOG_PREFIX + 'Storage HASH has changed (SDK key or
|
|
82
|
+
log.info(LOG_PREFIX + 'Storage HASH has changed (SDK key, flags filter criteria or flags spec version was modified). Clearing cache');
|
|
83
83
|
return wrapper.getKeysByPrefix(keys.prefix + ".").then(function (storageKeys) {
|
|
84
84
|
return Promise.all(storageKeys.map(function (storageKey) { return wrapper.del(storageKey); }));
|
|
85
85
|
}).then(function () { return wrapper.set(keys.buildHashKey(), currentHash); });
|
|
@@ -5,4 +5,4 @@ export var SDK_NOT_READY = 'not ready';
|
|
|
5
5
|
export var EXCEPTION = 'exception';
|
|
6
6
|
export var SPLIT_ARCHIVED = 'archived';
|
|
7
7
|
export var NOT_IN_SPLIT = 'not in split';
|
|
8
|
-
export var UNSUPPORTED_MATCHER_TYPE = 'unsupported
|
|
8
|
+
export var UNSUPPORTED_MATCHER_TYPE = 'targeting rule type unsupported by sdk';
|
package/package.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { ENGINE_MATCHER_ALL } from '../../logger/constants';
|
|
2
|
+
import { ILogger } from '../../logger/types';
|
|
2
3
|
|
|
4
|
+
export function allMatcherContext(log: ILogger) {
|
|
3
5
|
return function allMatcher(runtimeAttr: string): boolean {
|
|
6
|
+
log.debug(ENGINE_MATCHER_ALL);
|
|
7
|
+
|
|
4
8
|
return runtimeAttr != null;
|
|
5
9
|
};
|
|
6
10
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { IBetweenMatcherData } from '../../dtos/types';
|
|
2
|
+
import { ENGINE_MATCHER_BETWEEN } from '../../logger/constants';
|
|
3
|
+
import { ILogger } from '../../logger/types';
|
|
2
4
|
|
|
3
|
-
export function betweenMatcherContext(ruleVO: IBetweenMatcherData) {
|
|
4
|
-
|
|
5
|
+
export function betweenMatcherContext(log: ILogger, ruleVO: IBetweenMatcherData) {
|
|
5
6
|
return function betweenMatcher(runtimeAttr: number): boolean {
|
|
6
|
-
|
|
7
|
+
|
|
8
|
+
let isBetween = runtimeAttr >= ruleVO.start && runtimeAttr <= ruleVO.end;
|
|
9
|
+
|
|
10
|
+
log.debug(ENGINE_MATCHER_BETWEEN, [runtimeAttr, ruleVO.start, ruleVO.end, isBetween]);
|
|
7
11
|
|
|
8
12
|
return isBetween;
|
|
9
13
|
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { ENGINE_MATCHER_BOOLEAN } from '../../logger/constants';
|
|
2
|
+
import { ILogger } from '../../logger/types';
|
|
2
3
|
|
|
4
|
+
export function booleanMatcherContext(log: ILogger, ruleAttr: boolean) {
|
|
3
5
|
return function booleanMatcher(runtimeAttr: boolean): boolean {
|
|
4
|
-
|
|
6
|
+
let booleanMatches = ruleAttr === runtimeAttr;
|
|
7
|
+
|
|
8
|
+
log.debug(ENGINE_MATCHER_BOOLEAN, [ruleAttr, runtimeAttr]);
|
|
5
9
|
|
|
6
10
|
return booleanMatches;
|
|
7
11
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { ENGINE_MATCHER_CONTAINS_ALL } from '../../logger/constants';
|
|
2
|
+
import { ILogger } from '../../logger/types';
|
|
1
3
|
import { findIndex } from '../../utils/lang';
|
|
2
4
|
|
|
3
|
-
export function containsAllSetMatcherContext(ruleAttr: string[]) {
|
|
5
|
+
export function containsAllSetMatcherContext(log: ILogger, ruleAttr: string[]) {
|
|
4
6
|
return function containsAllMatcher(runtimeAttr: string[]): boolean {
|
|
5
7
|
let containsAll = true;
|
|
6
8
|
|
|
@@ -13,6 +15,8 @@ export function containsAllSetMatcherContext(ruleAttr: string[]) {
|
|
|
13
15
|
}
|
|
14
16
|
}
|
|
15
17
|
|
|
18
|
+
log.debug(ENGINE_MATCHER_CONTAINS_ALL, [runtimeAttr, ruleAttr, containsAll]);
|
|
19
|
+
|
|
16
20
|
return containsAll;
|
|
17
21
|
};
|
|
18
22
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { ENGINE_MATCHER_CONTAINS_ANY } from '../../logger/constants';
|
|
2
|
+
import { ILogger } from '../../logger/types';
|
|
1
3
|
import { findIndex } from '../../utils/lang';
|
|
2
4
|
|
|
3
|
-
export function containsAnySetMatcherContext(ruleAttr: string[]) {
|
|
5
|
+
export function containsAnySetMatcherContext(log: ILogger, ruleAttr: string[]) {
|
|
4
6
|
return function containsAnyMatcher(runtimeAttr: string[]): boolean {
|
|
5
7
|
let containsAny = false;
|
|
6
8
|
|
|
@@ -8,6 +10,8 @@ export function containsAnySetMatcherContext(ruleAttr: string[]) {
|
|
|
8
10
|
if (findIndex(runtimeAttr, e => e === ruleAttr[i]) >= 0) containsAny = true;
|
|
9
11
|
}
|
|
10
12
|
|
|
13
|
+
log.debug(ENGINE_MATCHER_CONTAINS_ANY, [runtimeAttr, ruleAttr, containsAny]);
|
|
14
|
+
|
|
11
15
|
return containsAny;
|
|
12
16
|
};
|
|
13
17
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { isString } from '../../utils/lang';
|
|
2
|
+
import { ILogger } from '../../logger/types';
|
|
3
|
+
import { ENGINE_MATCHER_CONTAINS_STRING } from '../../logger/constants';
|
|
2
4
|
|
|
3
|
-
export function containsStringMatcherContext(ruleAttr: string[]) {
|
|
5
|
+
export function containsStringMatcherContext(log: ILogger, ruleAttr: string[]) {
|
|
4
6
|
return function containsStringMatcher(runtimeAttr: string): boolean {
|
|
5
|
-
|
|
7
|
+
let contains = ruleAttr.some(e => isString(runtimeAttr) && runtimeAttr.indexOf(e) > -1);
|
|
8
|
+
|
|
9
|
+
log.debug(ENGINE_MATCHER_CONTAINS_STRING, [runtimeAttr, ruleAttr, contains]);
|
|
6
10
|
|
|
7
11
|
return contains;
|
|
8
12
|
};
|
|
@@ -5,7 +5,7 @@ import { thenable } from '../../utils/promise/thenable';
|
|
|
5
5
|
import { IDependencyMatcherValue, IEvaluation, ISplitEvaluator } from '../types';
|
|
6
6
|
import { ENGINE_MATCHER_DEPENDENCY, ENGINE_MATCHER_DEPENDENCY_PRE } from '../../logger/constants';
|
|
7
7
|
|
|
8
|
-
export function dependencyMatcherContext({ split, treatments }: IDependencyMatcherData, storage: IStorageSync | IStorageAsync
|
|
8
|
+
export function dependencyMatcherContext(log: ILogger, { split, treatments }: IDependencyMatcherData, storage: IStorageSync | IStorageAsync) {
|
|
9
9
|
|
|
10
10
|
function checkTreatment(evaluation: IEvaluation, acceptableTreatments: string[], parentName: string) {
|
|
11
11
|
let matches = false;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { ENGINE_MATCHER_EQUAL } from '../../logger/constants';
|
|
2
|
+
import { ILogger } from '../../logger/types';
|
|
2
3
|
|
|
4
|
+
export function equalToMatcherContext(log: ILogger, ruleAttr: number) {
|
|
3
5
|
return function equalToMatcher(runtimeAttr: number): boolean {
|
|
4
|
-
|
|
6
|
+
let isEqual = runtimeAttr === ruleAttr;
|
|
7
|
+
|
|
8
|
+
log.debug(ENGINE_MATCHER_EQUAL, [runtimeAttr, ruleAttr, isEqual]);
|
|
5
9
|
|
|
6
10
|
return isEqual;
|
|
7
11
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { ENGINE_MATCHER_EQUAL_TO_SET } from '../../logger/constants';
|
|
2
|
+
import { ILogger } from '../../logger/types';
|
|
1
3
|
import { findIndex } from '../../utils/lang';
|
|
2
4
|
|
|
3
|
-
export function equalToSetMatcherContext(ruleAttr: string[]) {
|
|
5
|
+
export function equalToSetMatcherContext(log: ILogger, ruleAttr: string[]) {
|
|
4
6
|
return function equalToSetMatcher(runtimeAttr: string[]): boolean {
|
|
5
7
|
// Length being the same is the first condition.
|
|
6
8
|
let isEqual = runtimeAttr.length === ruleAttr.length;
|
|
@@ -10,6 +12,8 @@ export function equalToSetMatcherContext(ruleAttr: string[]) {
|
|
|
10
12
|
if (findIndex(ruleAttr, e => e === runtimeAttr[i]) < 0) isEqual = false;
|
|
11
13
|
}
|
|
12
14
|
|
|
15
|
+
log.debug(ENGINE_MATCHER_EQUAL_TO_SET, [runtimeAttr, ruleAttr, isEqual]);
|
|
16
|
+
|
|
13
17
|
return isEqual;
|
|
14
18
|
};
|
|
15
19
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { ENGINE_MATCHER_ENDS_WITH } from '../../logger/constants';
|
|
2
|
+
import { ILogger } from '../../logger/types';
|
|
1
3
|
import { endsWith } from '../../utils/lang';
|
|
2
4
|
|
|
3
|
-
export function endsWithMatcherContext(ruleAttr: string[]) {
|
|
5
|
+
export function endsWithMatcherContext(log: ILogger, ruleAttr: string[]) {
|
|
4
6
|
return function endsWithMatcher(runtimeAttr: string): boolean {
|
|
5
|
-
|
|
7
|
+
let strEndsWith = ruleAttr.some(e => endsWith(runtimeAttr, e));
|
|
8
|
+
|
|
9
|
+
log.debug(ENGINE_MATCHER_ENDS_WITH, [runtimeAttr, ruleAttr, strEndsWith]);
|
|
6
10
|
|
|
7
11
|
return strEndsWith;
|
|
8
12
|
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { ENGINE_MATCHER_GREATER } from '../../logger/constants';
|
|
2
|
+
import { ILogger } from '../../logger/types';
|
|
2
3
|
|
|
4
|
+
export function greaterThanEqualMatcherContext(log: ILogger, ruleAttr: number) {
|
|
3
5
|
return function greaterThanEqualMatcher(runtimeAttr: number): boolean {
|
|
4
|
-
|
|
6
|
+
let isGreaterThanEqual = runtimeAttr >= ruleAttr;
|
|
7
|
+
|
|
8
|
+
log.debug(ENGINE_MATCHER_GREATER, [runtimeAttr, ruleAttr, isGreaterThanEqual]);
|
|
5
9
|
|
|
6
10
|
return isGreaterThanEqual;
|
|
7
11
|
};
|
|
@@ -61,6 +61,6 @@ export function matcherFactory(log: ILogger, matcherDto: IMatcherDto, storage?:
|
|
|
61
61
|
|
|
62
62
|
let matcherFn;
|
|
63
63
|
// @ts-ignore
|
|
64
|
-
if (matchers[type]) matcherFn = matchers[type](value, storage
|
|
64
|
+
if (matchers[type]) matcherFn = matchers[type](log, value, storage); // There is no index-out-of-bound exception in JavaScript
|
|
65
65
|
return matcherFn;
|
|
66
66
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { ENGINE_MATCHER_LESS } from '../../logger/constants';
|
|
2
|
+
import { ILogger } from '../../logger/types';
|
|
2
3
|
|
|
4
|
+
export function lessThanEqualMatcherContext(log: ILogger, ruleAttr: number) {
|
|
3
5
|
return function lessThanEqualMatcher(runtimeAttr: number): boolean {
|
|
4
|
-
|
|
6
|
+
let isLessThanEqual = runtimeAttr <= ruleAttr;
|
|
7
|
+
|
|
8
|
+
log.debug(ENGINE_MATCHER_LESS, [runtimeAttr, ruleAttr, isLessThanEqual]);
|
|
5
9
|
|
|
6
10
|
return isLessThanEqual;
|
|
7
11
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { findIndex } from '../../utils/lang';
|
|
2
|
+
import { ILogger } from '../../logger/types';
|
|
3
|
+
import { ENGINE_MATCHER_PART_OF } from '../../logger/constants';
|
|
2
4
|
|
|
3
|
-
export function partOfSetMatcherContext(ruleAttr: string[]) {
|
|
5
|
+
export function partOfSetMatcherContext(log: ILogger, ruleAttr: string[]) {
|
|
4
6
|
return function partOfMatcher(runtimeAttr: string[]): boolean {
|
|
5
7
|
// To be part of the length should be minor or equal.
|
|
6
8
|
let isPartOf = runtimeAttr.length <= ruleAttr.length;
|
|
@@ -10,6 +12,8 @@ export function partOfSetMatcherContext(ruleAttr: string[]) {
|
|
|
10
12
|
if (findIndex(ruleAttr, e => e === runtimeAttr[i]) < 0) isPartOf = false;
|
|
11
13
|
}
|
|
12
14
|
|
|
15
|
+
log.debug(ENGINE_MATCHER_PART_OF, [runtimeAttr, ruleAttr, isPartOf]);
|
|
16
|
+
|
|
13
17
|
return isPartOf;
|
|
14
18
|
};
|
|
15
19
|
}
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import { MaybeThenable } from '../../dtos/types';
|
|
2
2
|
import { ISegmentsCacheBase } from '../../storages/types';
|
|
3
|
+
import { ILogger } from '../../logger/types';
|
|
3
4
|
import { thenable } from '../../utils/promise/thenable';
|
|
5
|
+
import { ENGINE_MATCHER_SEGMENT } from '../../logger/constants';
|
|
4
6
|
|
|
5
|
-
export function segmentMatcherContext(segmentName: string, storage: { segments: ISegmentsCacheBase }) {
|
|
7
|
+
export function segmentMatcherContext(log: ILogger, segmentName: string, storage: { segments: ISegmentsCacheBase }) {
|
|
6
8
|
|
|
7
9
|
return function segmentMatcher(key: string): MaybeThenable<boolean> {
|
|
8
10
|
const isInSegment = storage.segments.isInSegment(segmentName, key);
|
|
9
11
|
|
|
10
12
|
if (thenable(isInSegment)) {
|
|
11
13
|
isInSegment.then(result => {
|
|
14
|
+
log.debug(ENGINE_MATCHER_SEGMENT, [segmentName, key, isInSegment]);
|
|
15
|
+
|
|
12
16
|
return result;
|
|
13
17
|
});
|
|
18
|
+
} else {
|
|
19
|
+
log.debug(ENGINE_MATCHER_SEGMENT, [segmentName, key, isInSegment]);
|
|
14
20
|
}
|
|
15
21
|
|
|
16
22
|
return isInSegment;
|
|
17
23
|
};
|
|
24
|
+
|
|
18
25
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { IBetweenStringMatcherData } from '../../dtos/types';
|
|
2
|
+
import { ILogger } from '../../logger/types';
|
|
2
3
|
import { Semver } from '../../utils/Semver';
|
|
3
4
|
|
|
4
|
-
export function betweenSemverMatcherContext(ruleAttr: IBetweenStringMatcherData) {
|
|
5
|
+
export function betweenSemverMatcherContext(log: ILogger, ruleAttr: IBetweenStringMatcherData) {
|
|
5
6
|
const startSemver = new Semver(ruleAttr.start);
|
|
6
7
|
const endSemver = new Semver(ruleAttr.end);
|
|
7
8
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { ILogger } from '../../logger/types';
|
|
1
2
|
import { Semver } from '../../utils/Semver';
|
|
2
3
|
|
|
3
|
-
export function equalToSemverMatcherContext(ruleAttr: string) {
|
|
4
|
+
export function equalToSemverMatcherContext(log: ILogger, ruleAttr: string) {
|
|
4
5
|
const ruleSemver = new Semver(ruleAttr);
|
|
5
6
|
|
|
6
7
|
return function equalToSemverMatcher(runtimeAttr: string): boolean {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { ILogger } from '../../logger/types';
|
|
1
2
|
import { Semver } from '../../utils/Semver';
|
|
2
3
|
|
|
3
|
-
export function greaterThanEqualToSemverMatcherContext(ruleAttr: string) {
|
|
4
|
+
export function greaterThanEqualToSemverMatcherContext(log: ILogger, ruleAttr: string) {
|
|
4
5
|
const ruleSemver = new Semver(ruleAttr);
|
|
5
6
|
|
|
6
7
|
return function greaterThanEqualToSemverMatcher(runtimeAttr: string): boolean {
|