@splitsoftware/splitio-commons 1.13.2-rc.9 → 1.14.1-rc.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.
- package/CHANGES.txt +4 -1
- package/cjs/evaluator/matchers/all.js +1 -3
- package/cjs/evaluator/matchers/between.js +1 -3
- package/cjs/evaluator/matchers/boolean.js +1 -3
- package/cjs/evaluator/matchers/cont_all.js +1 -3
- package/cjs/evaluator/matchers/cont_any.js +1 -3
- package/cjs/evaluator/matchers/cont_str.js +1 -3
- package/cjs/evaluator/matchers/dependency.js +1 -1
- package/cjs/evaluator/matchers/eq.js +1 -3
- package/cjs/evaluator/matchers/eq_set.js +1 -3
- package/cjs/evaluator/matchers/ew.js +1 -3
- package/cjs/evaluator/matchers/gte.js +1 -3
- package/cjs/evaluator/matchers/index.js +1 -1
- package/cjs/evaluator/matchers/lte.js +1 -3
- package/cjs/evaluator/matchers/part_of.js +1 -3
- package/cjs/evaluator/matchers/segment.js +1 -6
- 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 +1 -3
- package/cjs/evaluator/matchers/sw.js +1 -3
- package/cjs/evaluator/matchers/whitelist.js +1 -3
- package/cjs/evaluator/parser/index.js +7 -4
- package/cjs/logger/constants.js +4 -19
- package/cjs/logger/messages/debug.js +5 -20
- package/cjs/logger/messages/warn.js +1 -1
- package/cjs/services/splitApi.js +3 -2
- package/cjs/storages/KeyBuilder.js +1 -2
- package/cjs/sync/streaming/SSEClient/index.js +2 -2
- package/cjs/utils/constants/index.js +2 -2
- package/cjs/utils/settingsValidation/index.js +14 -11
- package/esm/evaluator/matchers/all.js +1 -3
- package/esm/evaluator/matchers/between.js +1 -3
- package/esm/evaluator/matchers/boolean.js +1 -3
- package/esm/evaluator/matchers/cont_all.js +1 -3
- package/esm/evaluator/matchers/cont_any.js +1 -3
- package/esm/evaluator/matchers/cont_str.js +1 -3
- package/esm/evaluator/matchers/dependency.js +1 -1
- package/esm/evaluator/matchers/eq.js +1 -3
- package/esm/evaluator/matchers/eq_set.js +1 -3
- package/esm/evaluator/matchers/ew.js +1 -3
- package/esm/evaluator/matchers/gte.js +1 -3
- package/esm/evaluator/matchers/index.js +1 -1
- package/esm/evaluator/matchers/lte.js +1 -3
- package/esm/evaluator/matchers/part_of.js +1 -3
- package/esm/evaluator/matchers/segment.js +1 -6
- 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 +1 -3
- package/esm/evaluator/matchers/sw.js +1 -3
- package/esm/evaluator/matchers/whitelist.js +1 -3
- package/esm/evaluator/parser/index.js +8 -5
- package/esm/logger/constants.js +1 -16
- package/esm/logger/messages/debug.js +5 -20
- package/esm/logger/messages/warn.js +1 -1
- package/esm/services/splitApi.js +4 -3
- package/esm/storages/KeyBuilder.js +1 -2
- package/esm/sync/streaming/SSEClient/index.js +2 -2
- package/esm/utils/constants/index.js +1 -1
- package/esm/utils/settingsValidation/index.js +15 -12
- package/package.json +1 -1
- package/src/evaluator/matchers/all.ts +1 -5
- package/src/evaluator/matchers/between.ts +3 -7
- package/src/evaluator/matchers/boolean.ts +2 -6
- package/src/evaluator/matchers/cont_all.ts +1 -5
- package/src/evaluator/matchers/cont_any.ts +1 -5
- package/src/evaluator/matchers/cont_str.ts +2 -6
- package/src/evaluator/matchers/dependency.ts +1 -1
- package/src/evaluator/matchers/eq.ts +2 -6
- package/src/evaluator/matchers/eq_set.ts +1 -5
- package/src/evaluator/matchers/ew.ts +2 -6
- package/src/evaluator/matchers/gte.ts +2 -6
- package/src/evaluator/matchers/index.ts +1 -1
- package/src/evaluator/matchers/lte.ts +2 -6
- package/src/evaluator/matchers/part_of.ts +1 -5
- package/src/evaluator/matchers/segment.ts +1 -8
- package/src/evaluator/matchers/semver_between.ts +1 -2
- package/src/evaluator/matchers/semver_eq.ts +1 -2
- package/src/evaluator/matchers/semver_gte.ts +1 -2
- package/src/evaluator/matchers/semver_inlist.ts +2 -2
- package/src/evaluator/matchers/semver_lte.ts +1 -2
- package/src/evaluator/matchers/string.ts +1 -6
- package/src/evaluator/matchers/sw.ts +2 -6
- package/src/evaluator/matchers/whitelist.ts +1 -5
- package/src/evaluator/parser/index.ts +9 -5
- package/src/logger/constants.ts +1 -16
- package/src/logger/messages/debug.ts +5 -20
- package/src/logger/messages/warn.ts +1 -1
- package/src/services/splitApi.ts +4 -3
- package/src/storages/KeyBuilder.ts +1 -2
- package/src/sync/streaming/SSEClient/index.ts +2 -2
- package/src/types.ts +2 -1
- package/src/utils/constants/index.ts +1 -1
- package/src/utils/settingsValidation/index.ts +15 -12
- package/src/utils/settingsValidation/types.ts +2 -0
- package/types/evaluator/matchers/all.d.ts +1 -2
- package/types/evaluator/matchers/between.d.ts +1 -2
- package/types/evaluator/matchers/boolean.d.ts +1 -2
- package/types/evaluator/matchers/cont_all.d.ts +1 -2
- package/types/evaluator/matchers/cont_any.d.ts +1 -2
- package/types/evaluator/matchers/cont_str.d.ts +1 -2
- package/types/evaluator/matchers/dependency.d.ts +1 -1
- package/types/evaluator/matchers/eq.d.ts +1 -2
- package/types/evaluator/matchers/eq_set.d.ts +1 -2
- package/types/evaluator/matchers/ew.d.ts +1 -2
- package/types/evaluator/matchers/gte.d.ts +1 -2
- package/types/evaluator/matchers/lte.d.ts +1 -2
- package/types/evaluator/matchers/part_of.d.ts +1 -2
- package/types/evaluator/matchers/segment.d.ts +1 -2
- package/types/evaluator/matchers/sember_inlist.d.ts +3 -0
- package/types/evaluator/matchers/semver_between.d.ts +1 -2
- package/types/evaluator/matchers/semver_eq.d.ts +1 -2
- package/types/evaluator/matchers/semver_gte.d.ts +1 -2
- package/types/evaluator/matchers/semver_inlist.d.ts +1 -2
- package/types/evaluator/matchers/semver_lte.d.ts +1 -2
- package/types/evaluator/matchers/string.d.ts +1 -2
- package/types/evaluator/matchers/sw.d.ts +1 -2
- package/types/evaluator/matchers/whitelist.d.ts +1 -2
- package/types/evaluator/matchersTransform/set.d.ts +2 -2
- package/types/evaluator/matchersTransform/string.d.ts +7 -0
- package/types/logger/constants.d.ts +1 -16
- package/types/sdkClient/identity.d.ts +6 -0
- package/types/storages/AbstractSplitsCache.d.ts +46 -0
- package/types/sync/streaming/mySegmentsV2utils.d.ts +27 -0
- package/types/trackers/impressionObserver/utils.d.ts +1 -1
- package/types/types.d.ts +1 -0
- package/types/utils/constants/index.d.ts +1 -1
- package/types/utils/inputValidation/sdkKey.d.ts +7 -0
- package/types/utils/settingsValidation/index.d.ts +1 -0
- package/types/utils/settingsValidation/logger/globalLogLevel.d.ts +8 -0
- package/types/utils/settingsValidation/types.d.ts +2 -0
- /package/types/utils/{Semver.d.ts → semVer.d.ts} +0 -0
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export function betweenMatcherContext(log, ruleVO) {
|
|
1
|
+
export function betweenMatcherContext(ruleVO) {
|
|
3
2
|
return function betweenMatcher(runtimeAttr) {
|
|
4
3
|
var isBetween = runtimeAttr >= ruleVO.start && runtimeAttr <= ruleVO.end;
|
|
5
|
-
log.debug(ENGINE_MATCHER_BETWEEN, [runtimeAttr, ruleVO.start, ruleVO.end, isBetween]);
|
|
6
4
|
return isBetween;
|
|
7
5
|
};
|
|
8
6
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export function booleanMatcherContext(log, ruleAttr) {
|
|
1
|
+
export function booleanMatcherContext(ruleAttr) {
|
|
3
2
|
return function booleanMatcher(runtimeAttr) {
|
|
4
3
|
var booleanMatches = ruleAttr === runtimeAttr;
|
|
5
|
-
log.debug(ENGINE_MATCHER_BOOLEAN, [ruleAttr, runtimeAttr]);
|
|
6
4
|
return booleanMatches;
|
|
7
5
|
};
|
|
8
6
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { ENGINE_MATCHER_CONTAINS_ALL } from '../../logger/constants';
|
|
2
1
|
import { findIndex } from '../../utils/lang';
|
|
3
|
-
export function containsAllSetMatcherContext(
|
|
2
|
+
export function containsAllSetMatcherContext(ruleAttr) {
|
|
4
3
|
return function containsAllMatcher(runtimeAttr) {
|
|
5
4
|
var containsAll = true;
|
|
6
5
|
if (runtimeAttr.length < ruleAttr.length) {
|
|
@@ -15,7 +14,6 @@ export function containsAllSetMatcherContext(log, ruleAttr) {
|
|
|
15
14
|
_loop_1(i);
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
|
-
log.debug(ENGINE_MATCHER_CONTAINS_ALL, [runtimeAttr, ruleAttr, containsAll]);
|
|
19
17
|
return containsAll;
|
|
20
18
|
};
|
|
21
19
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { ENGINE_MATCHER_CONTAINS_ANY } from '../../logger/constants';
|
|
2
1
|
import { findIndex } from '../../utils/lang';
|
|
3
|
-
export function containsAnySetMatcherContext(
|
|
2
|
+
export function containsAnySetMatcherContext(ruleAttr) {
|
|
4
3
|
return function containsAnyMatcher(runtimeAttr) {
|
|
5
4
|
var containsAny = false;
|
|
6
5
|
var _loop_1 = function (i) {
|
|
@@ -10,7 +9,6 @@ export function containsAnySetMatcherContext(log, ruleAttr) {
|
|
|
10
9
|
for (var i = 0; i < ruleAttr.length && !containsAny; i++) {
|
|
11
10
|
_loop_1(i);
|
|
12
11
|
}
|
|
13
|
-
log.debug(ENGINE_MATCHER_CONTAINS_ANY, [runtimeAttr, ruleAttr, containsAny]);
|
|
14
12
|
return containsAny;
|
|
15
13
|
};
|
|
16
14
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { isString } from '../../utils/lang';
|
|
2
|
-
|
|
3
|
-
export function containsStringMatcherContext(log, ruleAttr) {
|
|
2
|
+
export function containsStringMatcherContext(ruleAttr) {
|
|
4
3
|
return function containsStringMatcher(runtimeAttr) {
|
|
5
4
|
var contains = ruleAttr.some(function (e) { return isString(runtimeAttr) && runtimeAttr.indexOf(e) > -1; });
|
|
6
|
-
log.debug(ENGINE_MATCHER_CONTAINS_STRING, [runtimeAttr, ruleAttr, contains]);
|
|
7
5
|
return contains;
|
|
8
6
|
};
|
|
9
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { thenable } from '../../utils/promise/thenable';
|
|
2
2
|
import { ENGINE_MATCHER_DEPENDENCY, ENGINE_MATCHER_DEPENDENCY_PRE } from '../../logger/constants';
|
|
3
|
-
export function dependencyMatcherContext(
|
|
3
|
+
export function dependencyMatcherContext(_a, storage, log) {
|
|
4
4
|
var split = _a.split, treatments = _a.treatments;
|
|
5
5
|
function checkTreatment(evaluation, acceptableTreatments, parentName) {
|
|
6
6
|
var matches = false;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export function equalToMatcherContext(log, ruleAttr) {
|
|
1
|
+
export function equalToMatcherContext(ruleAttr) {
|
|
3
2
|
return function equalToMatcher(runtimeAttr) {
|
|
4
3
|
var isEqual = runtimeAttr === ruleAttr;
|
|
5
|
-
log.debug(ENGINE_MATCHER_EQUAL, [runtimeAttr, ruleAttr, isEqual]);
|
|
6
4
|
return isEqual;
|
|
7
5
|
};
|
|
8
6
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { ENGINE_MATCHER_EQUAL_TO_SET } from '../../logger/constants';
|
|
2
1
|
import { findIndex } from '../../utils/lang';
|
|
3
|
-
export function equalToSetMatcherContext(
|
|
2
|
+
export function equalToSetMatcherContext(ruleAttr) {
|
|
4
3
|
return function equalToSetMatcher(runtimeAttr) {
|
|
5
4
|
// Length being the same is the first condition.
|
|
6
5
|
var isEqual = runtimeAttr.length === ruleAttr.length;
|
|
@@ -12,7 +11,6 @@ export function equalToSetMatcherContext(log, ruleAttr) {
|
|
|
12
11
|
for (var i = 0; i < runtimeAttr.length && isEqual; i++) {
|
|
13
12
|
_loop_1(i);
|
|
14
13
|
}
|
|
15
|
-
log.debug(ENGINE_MATCHER_EQUAL_TO_SET, [runtimeAttr, ruleAttr, isEqual]);
|
|
16
14
|
return isEqual;
|
|
17
15
|
};
|
|
18
16
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { ENGINE_MATCHER_ENDS_WITH } from '../../logger/constants';
|
|
2
1
|
import { endsWith } from '../../utils/lang';
|
|
3
|
-
export function endsWithMatcherContext(
|
|
2
|
+
export function endsWithMatcherContext(ruleAttr) {
|
|
4
3
|
return function endsWithMatcher(runtimeAttr) {
|
|
5
4
|
var strEndsWith = ruleAttr.some(function (e) { return endsWith(runtimeAttr, e); });
|
|
6
|
-
log.debug(ENGINE_MATCHER_ENDS_WITH, [runtimeAttr, ruleAttr, strEndsWith]);
|
|
7
5
|
return strEndsWith;
|
|
8
6
|
};
|
|
9
7
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export function greaterThanEqualMatcherContext(log, ruleAttr) {
|
|
1
|
+
export function greaterThanEqualMatcherContext(ruleAttr) {
|
|
3
2
|
return function greaterThanEqualMatcher(runtimeAttr) {
|
|
4
3
|
var isGreaterThanEqual = runtimeAttr >= ruleAttr;
|
|
5
|
-
log.debug(ENGINE_MATCHER_GREATER, [runtimeAttr, ruleAttr, isGreaterThanEqual]);
|
|
6
4
|
return isGreaterThanEqual;
|
|
7
5
|
};
|
|
8
6
|
}
|
|
@@ -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](
|
|
56
|
+
matcherFn = matchers[type](value, storage, log); // There is no index-out-of-bound exception in JavaScript
|
|
57
57
|
return matcherFn;
|
|
58
58
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export function lessThanEqualMatcherContext(log, ruleAttr) {
|
|
1
|
+
export function lessThanEqualMatcherContext(ruleAttr) {
|
|
3
2
|
return function lessThanEqualMatcher(runtimeAttr) {
|
|
4
3
|
var isLessThanEqual = runtimeAttr <= ruleAttr;
|
|
5
|
-
log.debug(ENGINE_MATCHER_LESS, [runtimeAttr, ruleAttr, isLessThanEqual]);
|
|
6
4
|
return isLessThanEqual;
|
|
7
5
|
};
|
|
8
6
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { findIndex } from '../../utils/lang';
|
|
2
|
-
|
|
3
|
-
export function partOfSetMatcherContext(log, ruleAttr) {
|
|
2
|
+
export function partOfSetMatcherContext(ruleAttr) {
|
|
4
3
|
return function partOfMatcher(runtimeAttr) {
|
|
5
4
|
// To be part of the length should be minor or equal.
|
|
6
5
|
var isPartOf = runtimeAttr.length <= ruleAttr.length;
|
|
@@ -12,7 +11,6 @@ export function partOfSetMatcherContext(log, ruleAttr) {
|
|
|
12
11
|
for (var i = 0; i < runtimeAttr.length && isPartOf; i++) {
|
|
13
12
|
_loop_1(i);
|
|
14
13
|
}
|
|
15
|
-
log.debug(ENGINE_MATCHER_PART_OF, [runtimeAttr, ruleAttr, isPartOf]);
|
|
16
14
|
return isPartOf;
|
|
17
15
|
};
|
|
18
16
|
}
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import { thenable } from '../../utils/promise/thenable';
|
|
2
|
-
|
|
3
|
-
export function segmentMatcherContext(log, segmentName, storage) {
|
|
2
|
+
export function segmentMatcherContext(segmentName, storage) {
|
|
4
3
|
return function segmentMatcher(key) {
|
|
5
4
|
var isInSegment = storage.segments.isInSegment(segmentName, key);
|
|
6
5
|
if (thenable(isInSegment)) {
|
|
7
6
|
isInSegment.then(function (result) {
|
|
8
|
-
log.debug(ENGINE_MATCHER_SEGMENT, [segmentName, key, isInSegment]);
|
|
9
7
|
return result;
|
|
10
8
|
});
|
|
11
9
|
}
|
|
12
|
-
else {
|
|
13
|
-
log.debug(ENGINE_MATCHER_SEGMENT, [segmentName, key, isInSegment]);
|
|
14
|
-
}
|
|
15
10
|
return isInSegment;
|
|
16
11
|
};
|
|
17
12
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Semver } from '../../utils/Semver';
|
|
2
|
-
export function betweenSemverMatcherContext(
|
|
2
|
+
export function betweenSemverMatcherContext(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(
|
|
2
|
+
export function equalToSemverMatcherContext(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(
|
|
2
|
+
export function greaterThanEqualToSemverMatcherContext(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(
|
|
3
|
+
export function inListSemverMatcherContext(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(
|
|
2
|
+
export function lessThanEqualToSemverMatcherContext(ruleAttr) {
|
|
3
3
|
var ruleSemver = new Semver(ruleAttr);
|
|
4
4
|
return function lessThanEqualToSemverMatcher(runtimeAttr) {
|
|
5
5
|
var runtimeSemver = new Semver(runtimeAttr);
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export function stringMatcherContext(log, ruleAttr) {
|
|
1
|
+
export function stringMatcherContext(ruleAttr) {
|
|
3
2
|
var regex = new RegExp(ruleAttr);
|
|
4
3
|
return function stringMatcher(runtimeAttr) {
|
|
5
4
|
var regexMatches = regex.test(runtimeAttr);
|
|
6
|
-
log.debug(ENGINE_MATCHER_STRING, [runtimeAttr, ruleAttr, regexMatches ? 'yes' : 'no']);
|
|
7
5
|
return regexMatches;
|
|
8
6
|
};
|
|
9
7
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { ENGINE_MATCHER_STARTS_WITH } from '../../logger/constants';
|
|
2
1
|
import { startsWith } from '../../utils/lang';
|
|
3
|
-
export function startsWithMatcherContext(
|
|
2
|
+
export function startsWithMatcherContext(ruleAttr) {
|
|
4
3
|
return function startsWithMatcher(runtimeAttr) {
|
|
5
4
|
var matches = ruleAttr.some(function (e) { return startsWith(runtimeAttr, e); });
|
|
6
|
-
log.debug(ENGINE_MATCHER_STARTS_WITH, [runtimeAttr, ruleAttr, matches]);
|
|
7
5
|
return matches;
|
|
8
6
|
};
|
|
9
7
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { _Set } from '../../utils/lang/sets';
|
|
2
|
-
|
|
3
|
-
export function whitelistMatcherContext(log, ruleAttr) {
|
|
2
|
+
export function whitelistMatcherContext(ruleAttr) {
|
|
4
3
|
var whitelistSet = new _Set(ruleAttr);
|
|
5
4
|
return function whitelistMatcher(runtimeAttr) {
|
|
6
5
|
var isInWhitelist = whitelistSet.has(runtimeAttr);
|
|
7
|
-
log.debug(ENGINE_MATCHER_WHITELIST, [runtimeAttr, ruleAttr.join(','), isInWhitelist]);
|
|
8
6
|
return isInWhitelist;
|
|
9
7
|
};
|
|
10
8
|
}
|
|
@@ -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 } from '../../logger/constants';
|
|
9
|
+
import { ENGINE_MATCHER_ERROR, ENGINE_MATCHER_RESULT } 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,10 +34,13 @@ export function parser(log, conditions, storage) {
|
|
|
34
34
|
log.error(ENGINE_MATCHER_ERROR, [matcherDto.name, error]);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
function handleResult(result) {
|
|
38
|
+
log.debug(ENGINE_MATCHER_RESULT, [matcherDto.name, result, matcherDto.value, value]); // @ts-ignore
|
|
39
|
+
return Boolean(result ^ matcherDto.negate);
|
|
40
|
+
}
|
|
41
|
+
return thenable(result) ?
|
|
42
|
+
result.then(handleResult) :
|
|
43
|
+
handleResult(result);
|
|
41
44
|
};
|
|
42
45
|
});
|
|
43
46
|
// if matcher's factory can't instantiate the matchers, the expressions array will be empty
|
package/esm/logger/constants.js
CHANGED
|
@@ -9,24 +9,8 @@ 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;
|
|
18
12
|
export var ENGINE_MATCHER_DEPENDENCY = 10;
|
|
19
13
|
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;
|
|
30
14
|
export var ENGINE_VALUE = 23;
|
|
31
15
|
export var ENGINE_SANITIZE = 24;
|
|
32
16
|
export var CLEANUP_REGISTERING = 25;
|
|
@@ -44,6 +28,7 @@ export var SYNC_TASK_START = 36;
|
|
|
44
28
|
export var SYNC_TASK_EXECUTE = 37;
|
|
45
29
|
export var SYNC_TASK_STOP = 38;
|
|
46
30
|
export var SETTINGS_SPLITS_FILTER = 39;
|
|
31
|
+
export var ENGINE_MATCHER_RESULT = 40;
|
|
47
32
|
export var CLIENT_READY_FROM_CACHE = 100;
|
|
48
33
|
export var CLIENT_READY = 101;
|
|
49
34
|
export var IMPRESSION = 102;
|
|
@@ -6,26 +6,11 @@ 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.
|
|
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]'],
|
|
9
|
+
[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.'],
|
|
10
|
+
[c.ENGINE_MATCHER_DEPENDENCY_PRE, c.LOG_PREFIX_ENGINE_MATCHER + '[IN_SPLIT_TREATMENT] will evaluate parent feature flag: "%s" with key: %s %s'],
|
|
11
|
+
[c.ENGINE_VALUE, c.LOG_PREFIX_ENGINE_VALUE + 'Extracted attribute `%s`. %s will be used for matching.'],
|
|
12
|
+
[c.ENGINE_SANITIZE, c.LOG_PREFIX_ENGINE + ':sanitize: Attempted to sanitize %s which should be of type %s. Sanitized and processed value => %s'],
|
|
13
|
+
[c.ENGINE_MATCHER_RESULT, c.LOG_PREFIX_ENGINE_MATCHER + '[%s] Result: %s. Rule value: %s. Evaluation value: %s'],
|
|
29
14
|
// SDK
|
|
30
15
|
[c.CLEANUP_REGISTERING, c.LOG_PREFIX_CLEANUP + 'Registering cleanup handler %s'],
|
|
31
16
|
[c.CLEANUP_DEREGISTERING, c.LOG_PREFIX_CLEANUP + 'Deregistering cleanup handler %s'],
|
|
@@ -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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { splitHttpClientFactory } from './splitHttpClient';
|
|
2
2
|
import { objectAssign } from '../utils/lang/objectAssign';
|
|
3
|
-
import { SPLITS, IMPRESSIONS, IMPRESSIONS_COUNT, EVENTS, TELEMETRY, TOKEN, SEGMENT, MY_SEGMENT
|
|
3
|
+
import { SPLITS, IMPRESSIONS, IMPRESSIONS_COUNT, EVENTS, TELEMETRY, TOKEN, SEGMENT, MY_SEGMENT } from '../utils/constants';
|
|
4
4
|
import { ERROR_TOO_MANY_SETS } from '../logger/constants';
|
|
5
5
|
var noCacheHeaderOptions = { headers: { 'Cache-Control': 'no-cache' } };
|
|
6
6
|
function userKeyToQueryParam(userKey) {
|
|
@@ -17,6 +17,7 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
17
17
|
var urls = settings.urls;
|
|
18
18
|
var filterQueryString = settings.sync.__splitFiltersValidation && settings.sync.__splitFiltersValidation.queryString;
|
|
19
19
|
var SplitSDKImpressionsMode = settings.sync.impressionsMode;
|
|
20
|
+
var flagSpecVersion = settings.sync.flagSpecVersion;
|
|
20
21
|
var splitHttpClient = splitHttpClientFactory(settings, platform.getFetch);
|
|
21
22
|
return {
|
|
22
23
|
// @TODO throw errors if health check requests fail, to log them in the Synchronizer
|
|
@@ -29,7 +30,7 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
29
30
|
return splitHttpClient(url).then(function () { return true; }).catch(function () { return false; });
|
|
30
31
|
},
|
|
31
32
|
fetchAuth: function (userMatchingKeys) {
|
|
32
|
-
var url = urls.auth + "/v2/auth?s=" +
|
|
33
|
+
var url = urls.auth + "/v2/auth?s=" + flagSpecVersion;
|
|
33
34
|
if (userMatchingKeys) { // `userMatchingKeys` is undefined in server-side
|
|
34
35
|
var queryParams = userMatchingKeys.map(userKeyToQueryParam).join('&');
|
|
35
36
|
if (queryParams)
|
|
@@ -38,7 +39,7 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
38
39
|
return splitHttpClient(url, undefined, telemetryTracker.trackHttp(TOKEN));
|
|
39
40
|
},
|
|
40
41
|
fetchSplitChanges: function (since, noCache, till) {
|
|
41
|
-
var url = urls.sdk + "/splitChanges?s=" +
|
|
42
|
+
var url = urls.sdk + "/splitChanges?s=" + flagSpecVersion + "&since=" + since + (filterQueryString || '') + (till ? '&till=' + till : '');
|
|
42
43
|
return splitHttpClient(url, noCache ? noCacheHeaderOptions : undefined, telemetryTracker.trackHttp(SPLITS))
|
|
43
44
|
.catch(function (err) {
|
|
44
45
|
if (err.statusCode === 414)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { FLAGS_SPEC } from '../utils/constants';
|
|
2
1
|
import { startsWith } from '../utils/lang';
|
|
3
2
|
import { hash } from '../utils/murmur3/murmur3';
|
|
4
3
|
var everythingAtTheEnd = /[^.]+$/;
|
|
@@ -67,5 +66,5 @@ export { KeyBuilder };
|
|
|
67
66
|
* The hash is in hexadecimal format (8 characters max, 32 bits).
|
|
68
67
|
*/
|
|
69
68
|
export function getStorageHash(settings) {
|
|
70
|
-
return hash(settings.core.authorizationKey + "::" + settings.sync.__splitFiltersValidation.queryString + "::" +
|
|
69
|
+
return hash(settings.core.authorizationKey + "::" + settings.sync.__splitFiltersValidation.queryString + "::" + settings.sync.flagSpecVersion).toString(16);
|
|
71
70
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isString } from '../../../utils/lang';
|
|
2
|
-
var
|
|
2
|
+
var ABLY_API_VERSION = '1.1';
|
|
3
3
|
var CONTROL_CHANNEL_REGEX = /^control_/;
|
|
4
4
|
/**
|
|
5
5
|
* Build metadata headers for SSE connection.
|
|
@@ -57,7 +57,7 @@ var SSEClient = /** @class */ (function () {
|
|
|
57
57
|
var params = CONTROL_CHANNEL_REGEX.test(channel) ? '[?occupancy=metrics.publishers]' : '';
|
|
58
58
|
return encodeURIComponent(params + channel);
|
|
59
59
|
}).join(',');
|
|
60
|
-
var url = this.streamingUrl + "?channels=" + channelsQueryParam + "&accessToken=" + authToken.token + "&v=" +
|
|
60
|
+
var url = this.streamingUrl + "?channels=" + channelsQueryParam + "&accessToken=" + authToken.token + "&v=" + ABLY_API_VERSION + "&heartbeats=true"; // same results using `&heartbeats=false`
|
|
61
61
|
this.connection = new this.eventSource(
|
|
62
62
|
// For client-side SDKs, SplitSDKClientKey and SplitSDKClientKey metadata is passed as query params,
|
|
63
63
|
// because native EventSource implementations for browser doesn't support headers.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { merge, get } from '../lang';
|
|
2
2
|
import { validateMode } from './mode';
|
|
3
3
|
import { validateSplitFilters } from './splitFilters';
|
|
4
|
-
import { STANDALONE_MODE, OPTIMIZED, LOCALHOST_MODE, DEBUG } from '../constants';
|
|
4
|
+
import { STANDALONE_MODE, OPTIMIZED, LOCALHOST_MODE, DEBUG, FLAG_SPEC_VERSION } from '../constants';
|
|
5
5
|
import { validImpressionsMode } from './impressionsMode';
|
|
6
6
|
import { validateKey } from '../inputValidation/key';
|
|
7
7
|
import { validateTrafficType } from '../inputValidation/trafficType';
|
|
@@ -71,7 +71,8 @@ export var base = {
|
|
|
71
71
|
// impressions collection mode
|
|
72
72
|
impressionsMode: OPTIMIZED,
|
|
73
73
|
localhostMode: undefined,
|
|
74
|
-
enabled: true
|
|
74
|
+
enabled: true,
|
|
75
|
+
flagSpecVersion: FLAG_SPEC_VERSION
|
|
75
76
|
},
|
|
76
77
|
// Logger
|
|
77
78
|
log: undefined
|
|
@@ -87,7 +88,7 @@ function fromSecondsToMillis(n) {
|
|
|
87
88
|
* @param validationParams defaults and fields validators used to validate and creates a settings object from a given config
|
|
88
89
|
*/
|
|
89
90
|
export function settingsValidation(config, validationParams) {
|
|
90
|
-
var defaults = validationParams.defaults, runtime = validationParams.runtime, storage = validationParams.storage, integrations = validationParams.integrations, logger = validationParams.logger, localhost = validationParams.localhost, consent = validationParams.consent;
|
|
91
|
+
var defaults = validationParams.defaults, runtime = validationParams.runtime, storage = validationParams.storage, integrations = validationParams.integrations, logger = validationParams.logger, localhost = validationParams.localhost, consent = validationParams.consent, flagSpec = validationParams.flagSpec;
|
|
91
92
|
// creates a settings object merging base, defaults and config objects.
|
|
92
93
|
var withDefaults = merge({}, base, defaults, config);
|
|
93
94
|
// ensure a valid logger.
|
|
@@ -95,7 +96,8 @@ export function settingsValidation(config, validationParams) {
|
|
|
95
96
|
var log = logger(withDefaults); // @ts-ignore, modify readonly prop
|
|
96
97
|
withDefaults.log = log;
|
|
97
98
|
// ensure a valid impressionsMode
|
|
98
|
-
|
|
99
|
+
var sync = withDefaults.sync;
|
|
100
|
+
sync.impressionsMode = validImpressionsMode(log, sync.impressionsMode);
|
|
99
101
|
function validateMinValue(paramName, actualValue, minValue) {
|
|
100
102
|
if (actualValue >= minValue)
|
|
101
103
|
return actualValue;
|
|
@@ -111,7 +113,7 @@ export function settingsValidation(config, validationParams) {
|
|
|
111
113
|
scheduler.eventsPushRate = fromSecondsToMillis(scheduler.eventsPushRate);
|
|
112
114
|
scheduler.telemetryRefreshRate = fromSecondsToMillis(validateMinValue('telemetryRefreshRate', scheduler.telemetryRefreshRate, 60));
|
|
113
115
|
// Default impressionsRefreshRate for DEBUG mode is 60 secs
|
|
114
|
-
if (get(config, 'scheduler.impressionsRefreshRate') === undefined &&
|
|
116
|
+
if (get(config, 'scheduler.impressionsRefreshRate') === undefined && sync.impressionsMode === DEBUG)
|
|
115
117
|
scheduler.impressionsRefreshRate = 60;
|
|
116
118
|
scheduler.impressionsRefreshRate = fromSecondsToMillis(scheduler.impressionsRefreshRate);
|
|
117
119
|
// Log deprecation for old telemetry param
|
|
@@ -163,22 +165,23 @@ export function settingsValidation(config, validationParams) {
|
|
|
163
165
|
if (integrations)
|
|
164
166
|
withDefaults.integrations = integrations(withDefaults);
|
|
165
167
|
if (localhost)
|
|
166
|
-
|
|
168
|
+
sync.localhostMode = localhost(withDefaults);
|
|
167
169
|
// validate push options
|
|
168
170
|
if (withDefaults.streamingEnabled !== false) { // @ts-ignore, modify readonly prop
|
|
169
171
|
withDefaults.streamingEnabled = true;
|
|
170
172
|
// Backoff bases.
|
|
171
|
-
// We are not checking if bases are positive numbers. Thus, we might be
|
|
173
|
+
// We are not checking if bases are positive numbers. Thus, we might be re-authenticating immediately (`setTimeout` with NaN or negative number)
|
|
172
174
|
scheduler.pushRetryBackoffBase = fromSecondsToMillis(scheduler.pushRetryBackoffBase);
|
|
173
175
|
}
|
|
174
176
|
// validate sync enabled
|
|
175
|
-
if (
|
|
176
|
-
|
|
177
|
+
if (sync.enabled !== false) {
|
|
178
|
+
sync.enabled = true;
|
|
177
179
|
}
|
|
178
180
|
// validate the `splitFilters` settings and parse splits query
|
|
179
|
-
var splitFiltersValidation = validateSplitFilters(log,
|
|
180
|
-
|
|
181
|
-
|
|
181
|
+
var splitFiltersValidation = validateSplitFilters(log, sync.splitFilters, withDefaults.mode);
|
|
182
|
+
sync.splitFilters = splitFiltersValidation.validFilters;
|
|
183
|
+
sync.__splitFiltersValidation = splitFiltersValidation;
|
|
184
|
+
sync.flagSpecVersion = flagSpec ? flagSpec(withDefaults) : FLAG_SPEC_VERSION;
|
|
182
185
|
// ensure a valid user consent value
|
|
183
186
|
// @ts-ignore, modify readonly prop
|
|
184
187
|
withDefaults.userConsent = consent(withDefaults);
|
package/package.json
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import { ILogger } from '../../logger/types';
|
|
1
|
+
export function allMatcherContext() {
|
|
3
2
|
|
|
4
|
-
export function allMatcherContext(log: ILogger) {
|
|
5
3
|
return function allMatcher(runtimeAttr: string): boolean {
|
|
6
|
-
log.debug(ENGINE_MATCHER_ALL);
|
|
7
|
-
|
|
8
4
|
return runtimeAttr != null;
|
|
9
5
|
};
|
|
10
6
|
}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { IBetweenMatcherData } from '../../dtos/types';
|
|
2
|
-
import { ENGINE_MATCHER_BETWEEN } from '../../logger/constants';
|
|
3
|
-
import { ILogger } from '../../logger/types';
|
|
4
2
|
|
|
5
|
-
export function betweenMatcherContext(
|
|
6
|
-
return function betweenMatcher(runtimeAttr: number): boolean {
|
|
7
|
-
|
|
8
|
-
let isBetween = runtimeAttr >= ruleVO.start && runtimeAttr <= ruleVO.end;
|
|
3
|
+
export function betweenMatcherContext(ruleVO: IBetweenMatcherData) {
|
|
9
4
|
|
|
10
|
-
|
|
5
|
+
return function betweenMatcher(runtimeAttr: number): boolean {
|
|
6
|
+
const isBetween = runtimeAttr >= ruleVO.start && runtimeAttr <= ruleVO.end;
|
|
11
7
|
|
|
12
8
|
return isBetween;
|
|
13
9
|
};
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import { ILogger } from '../../logger/types';
|
|
1
|
+
export function booleanMatcherContext(ruleAttr: boolean) {
|
|
3
2
|
|
|
4
|
-
export function booleanMatcherContext(log: ILogger, ruleAttr: boolean) {
|
|
5
3
|
return function booleanMatcher(runtimeAttr: boolean): boolean {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
log.debug(ENGINE_MATCHER_BOOLEAN, [ruleAttr, runtimeAttr]);
|
|
4
|
+
const booleanMatches = ruleAttr === runtimeAttr;
|
|
9
5
|
|
|
10
6
|
return booleanMatches;
|
|
11
7
|
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { ENGINE_MATCHER_CONTAINS_ALL } from '../../logger/constants';
|
|
2
|
-
import { ILogger } from '../../logger/types';
|
|
3
1
|
import { findIndex } from '../../utils/lang';
|
|
4
2
|
|
|
5
|
-
export function containsAllSetMatcherContext(
|
|
3
|
+
export function containsAllSetMatcherContext(ruleAttr: string[]) {
|
|
6
4
|
return function containsAllMatcher(runtimeAttr: string[]): boolean {
|
|
7
5
|
let containsAll = true;
|
|
8
6
|
|
|
@@ -15,8 +13,6 @@ export function containsAllSetMatcherContext(log: ILogger, ruleAttr: string[]) {
|
|
|
15
13
|
}
|
|
16
14
|
}
|
|
17
15
|
|
|
18
|
-
log.debug(ENGINE_MATCHER_CONTAINS_ALL, [runtimeAttr, ruleAttr, containsAll]);
|
|
19
|
-
|
|
20
16
|
return containsAll;
|
|
21
17
|
};
|
|
22
18
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { ENGINE_MATCHER_CONTAINS_ANY } from '../../logger/constants';
|
|
2
|
-
import { ILogger } from '../../logger/types';
|
|
3
1
|
import { findIndex } from '../../utils/lang';
|
|
4
2
|
|
|
5
|
-
export function containsAnySetMatcherContext(
|
|
3
|
+
export function containsAnySetMatcherContext(ruleAttr: string[]) {
|
|
6
4
|
return function containsAnyMatcher(runtimeAttr: string[]): boolean {
|
|
7
5
|
let containsAny = false;
|
|
8
6
|
|
|
@@ -10,8 +8,6 @@ export function containsAnySetMatcherContext(log: ILogger, ruleAttr: string[]) {
|
|
|
10
8
|
if (findIndex(runtimeAttr, e => e === ruleAttr[i]) >= 0) containsAny = true;
|
|
11
9
|
}
|
|
12
10
|
|
|
13
|
-
log.debug(ENGINE_MATCHER_CONTAINS_ANY, [runtimeAttr, ruleAttr, containsAny]);
|
|
14
|
-
|
|
15
11
|
return containsAny;
|
|
16
12
|
};
|
|
17
13
|
}
|