@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.
- package/CHANGES.txt +1 -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/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/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/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/utils/inputValidation/sdkKey.d.ts +7 -0
- package/types/utils/settingsValidation/logger/globalLogLevel.d.ts +8 -0
- /package/types/utils/{Semver.d.ts → semVer.d.ts} +0 -0
package/CHANGES.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
1.14.0 (
|
|
1
|
+
1.14.0 (May 6, 2024)
|
|
2
2
|
- Added support for targeting rules based on semantic versions (https://semver.org/).
|
|
3
3
|
- Added special impression label "targeting rule type unsupported by sdk" when the matcher type is not supported by the SDK, which returns 'control' treatment.
|
|
4
4
|
- Updated Split API client to include the flags spec version query parameter for the `splitChanges` and `auth` endpoints.
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.allMatcherContext = void 0;
|
|
4
|
-
|
|
5
|
-
function allMatcherContext(log) {
|
|
4
|
+
function allMatcherContext() {
|
|
6
5
|
return function allMatcher(runtimeAttr) {
|
|
7
|
-
log.debug(constants_1.ENGINE_MATCHER_ALL);
|
|
8
6
|
return runtimeAttr != null;
|
|
9
7
|
};
|
|
10
8
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.betweenMatcherContext = void 0;
|
|
4
|
-
|
|
5
|
-
function betweenMatcherContext(log, ruleVO) {
|
|
4
|
+
function betweenMatcherContext(ruleVO) {
|
|
6
5
|
return function betweenMatcher(runtimeAttr) {
|
|
7
6
|
var isBetween = runtimeAttr >= ruleVO.start && runtimeAttr <= ruleVO.end;
|
|
8
|
-
log.debug(constants_1.ENGINE_MATCHER_BETWEEN, [runtimeAttr, ruleVO.start, ruleVO.end, isBetween]);
|
|
9
7
|
return isBetween;
|
|
10
8
|
};
|
|
11
9
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.booleanMatcherContext = void 0;
|
|
4
|
-
|
|
5
|
-
function booleanMatcherContext(log, ruleAttr) {
|
|
4
|
+
function booleanMatcherContext(ruleAttr) {
|
|
6
5
|
return function booleanMatcher(runtimeAttr) {
|
|
7
6
|
var booleanMatches = ruleAttr === runtimeAttr;
|
|
8
|
-
log.debug(constants_1.ENGINE_MATCHER_BOOLEAN, [ruleAttr, runtimeAttr]);
|
|
9
7
|
return booleanMatches;
|
|
10
8
|
};
|
|
11
9
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.containsAllSetMatcherContext = void 0;
|
|
4
|
-
var constants_1 = require("../../logger/constants");
|
|
5
4
|
var lang_1 = require("../../utils/lang");
|
|
6
|
-
function containsAllSetMatcherContext(
|
|
5
|
+
function containsAllSetMatcherContext(ruleAttr) {
|
|
7
6
|
return function containsAllMatcher(runtimeAttr) {
|
|
8
7
|
var containsAll = true;
|
|
9
8
|
if (runtimeAttr.length < ruleAttr.length) {
|
|
@@ -18,7 +17,6 @@ function containsAllSetMatcherContext(log, ruleAttr) {
|
|
|
18
17
|
_loop_1(i);
|
|
19
18
|
}
|
|
20
19
|
}
|
|
21
|
-
log.debug(constants_1.ENGINE_MATCHER_CONTAINS_ALL, [runtimeAttr, ruleAttr, containsAll]);
|
|
22
20
|
return containsAll;
|
|
23
21
|
};
|
|
24
22
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.containsAnySetMatcherContext = void 0;
|
|
4
|
-
var constants_1 = require("../../logger/constants");
|
|
5
4
|
var lang_1 = require("../../utils/lang");
|
|
6
|
-
function containsAnySetMatcherContext(
|
|
5
|
+
function containsAnySetMatcherContext(ruleAttr) {
|
|
7
6
|
return function containsAnyMatcher(runtimeAttr) {
|
|
8
7
|
var containsAny = false;
|
|
9
8
|
var _loop_1 = function (i) {
|
|
@@ -13,7 +12,6 @@ function containsAnySetMatcherContext(log, ruleAttr) {
|
|
|
13
12
|
for (var i = 0; i < ruleAttr.length && !containsAny; i++) {
|
|
14
13
|
_loop_1(i);
|
|
15
14
|
}
|
|
16
|
-
log.debug(constants_1.ENGINE_MATCHER_CONTAINS_ANY, [runtimeAttr, ruleAttr, containsAny]);
|
|
17
15
|
return containsAny;
|
|
18
16
|
};
|
|
19
17
|
}
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.containsStringMatcherContext = void 0;
|
|
4
4
|
var lang_1 = require("../../utils/lang");
|
|
5
|
-
|
|
6
|
-
function containsStringMatcherContext(log, ruleAttr) {
|
|
5
|
+
function containsStringMatcherContext(ruleAttr) {
|
|
7
6
|
return function containsStringMatcher(runtimeAttr) {
|
|
8
7
|
var contains = ruleAttr.some(function (e) { return (0, lang_1.isString)(runtimeAttr) && runtimeAttr.indexOf(e) > -1; });
|
|
9
|
-
log.debug(constants_1.ENGINE_MATCHER_CONTAINS_STRING, [runtimeAttr, ruleAttr, contains]);
|
|
10
8
|
return contains;
|
|
11
9
|
};
|
|
12
10
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.dependencyMatcherContext = void 0;
|
|
4
4
|
var thenable_1 = require("../../utils/promise/thenable");
|
|
5
5
|
var constants_1 = require("../../logger/constants");
|
|
6
|
-
function dependencyMatcherContext(
|
|
6
|
+
function dependencyMatcherContext(_a, storage, log) {
|
|
7
7
|
var split = _a.split, treatments = _a.treatments;
|
|
8
8
|
function checkTreatment(evaluation, acceptableTreatments, parentName) {
|
|
9
9
|
var matches = false;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.equalToMatcherContext = void 0;
|
|
4
|
-
|
|
5
|
-
function equalToMatcherContext(log, ruleAttr) {
|
|
4
|
+
function equalToMatcherContext(ruleAttr) {
|
|
6
5
|
return function equalToMatcher(runtimeAttr) {
|
|
7
6
|
var isEqual = runtimeAttr === ruleAttr;
|
|
8
|
-
log.debug(constants_1.ENGINE_MATCHER_EQUAL, [runtimeAttr, ruleAttr, isEqual]);
|
|
9
7
|
return isEqual;
|
|
10
8
|
};
|
|
11
9
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.equalToSetMatcherContext = void 0;
|
|
4
|
-
var constants_1 = require("../../logger/constants");
|
|
5
4
|
var lang_1 = require("../../utils/lang");
|
|
6
|
-
function equalToSetMatcherContext(
|
|
5
|
+
function equalToSetMatcherContext(ruleAttr) {
|
|
7
6
|
return function equalToSetMatcher(runtimeAttr) {
|
|
8
7
|
// Length being the same is the first condition.
|
|
9
8
|
var isEqual = runtimeAttr.length === ruleAttr.length;
|
|
@@ -15,7 +14,6 @@ function equalToSetMatcherContext(log, ruleAttr) {
|
|
|
15
14
|
for (var i = 0; i < runtimeAttr.length && isEqual; i++) {
|
|
16
15
|
_loop_1(i);
|
|
17
16
|
}
|
|
18
|
-
log.debug(constants_1.ENGINE_MATCHER_EQUAL_TO_SET, [runtimeAttr, ruleAttr, isEqual]);
|
|
19
17
|
return isEqual;
|
|
20
18
|
};
|
|
21
19
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.endsWithMatcherContext = void 0;
|
|
4
|
-
var constants_1 = require("../../logger/constants");
|
|
5
4
|
var lang_1 = require("../../utils/lang");
|
|
6
|
-
function endsWithMatcherContext(
|
|
5
|
+
function endsWithMatcherContext(ruleAttr) {
|
|
7
6
|
return function endsWithMatcher(runtimeAttr) {
|
|
8
7
|
var strEndsWith = ruleAttr.some(function (e) { return (0, lang_1.endsWith)(runtimeAttr, e); });
|
|
9
|
-
log.debug(constants_1.ENGINE_MATCHER_ENDS_WITH, [runtimeAttr, ruleAttr, strEndsWith]);
|
|
10
8
|
return strEndsWith;
|
|
11
9
|
};
|
|
12
10
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.greaterThanEqualMatcherContext = void 0;
|
|
4
|
-
|
|
5
|
-
function greaterThanEqualMatcherContext(log, ruleAttr) {
|
|
4
|
+
function greaterThanEqualMatcherContext(ruleAttr) {
|
|
6
5
|
return function greaterThanEqualMatcher(runtimeAttr) {
|
|
7
6
|
var isGreaterThanEqual = runtimeAttr >= ruleAttr;
|
|
8
|
-
log.debug(constants_1.ENGINE_MATCHER_GREATER, [runtimeAttr, ruleAttr, isGreaterThanEqual]);
|
|
9
7
|
return isGreaterThanEqual;
|
|
10
8
|
};
|
|
11
9
|
}
|
|
@@ -56,7 +56,7 @@ function matcherFactory(log, matcherDto, storage) {
|
|
|
56
56
|
var matcherFn;
|
|
57
57
|
// @ts-ignore
|
|
58
58
|
if (matchers[type])
|
|
59
|
-
matcherFn = matchers[type](
|
|
59
|
+
matcherFn = matchers[type](value, storage, log); // There is no index-out-of-bound exception in JavaScript
|
|
60
60
|
return matcherFn;
|
|
61
61
|
}
|
|
62
62
|
exports.matcherFactory = matcherFactory;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.lessThanEqualMatcherContext = void 0;
|
|
4
|
-
|
|
5
|
-
function lessThanEqualMatcherContext(log, ruleAttr) {
|
|
4
|
+
function lessThanEqualMatcherContext(ruleAttr) {
|
|
6
5
|
return function lessThanEqualMatcher(runtimeAttr) {
|
|
7
6
|
var isLessThanEqual = runtimeAttr <= ruleAttr;
|
|
8
|
-
log.debug(constants_1.ENGINE_MATCHER_LESS, [runtimeAttr, ruleAttr, isLessThanEqual]);
|
|
9
7
|
return isLessThanEqual;
|
|
10
8
|
};
|
|
11
9
|
}
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.partOfSetMatcherContext = void 0;
|
|
4
4
|
var lang_1 = require("../../utils/lang");
|
|
5
|
-
|
|
6
|
-
function partOfSetMatcherContext(log, ruleAttr) {
|
|
5
|
+
function partOfSetMatcherContext(ruleAttr) {
|
|
7
6
|
return function partOfMatcher(runtimeAttr) {
|
|
8
7
|
// To be part of the length should be minor or equal.
|
|
9
8
|
var isPartOf = runtimeAttr.length <= ruleAttr.length;
|
|
@@ -15,7 +14,6 @@ function partOfSetMatcherContext(log, ruleAttr) {
|
|
|
15
14
|
for (var i = 0; i < runtimeAttr.length && isPartOf; i++) {
|
|
16
15
|
_loop_1(i);
|
|
17
16
|
}
|
|
18
|
-
log.debug(constants_1.ENGINE_MATCHER_PART_OF, [runtimeAttr, ruleAttr, isPartOf]);
|
|
19
17
|
return isPartOf;
|
|
20
18
|
};
|
|
21
19
|
}
|
|
@@ -2,19 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.segmentMatcherContext = void 0;
|
|
4
4
|
var thenable_1 = require("../../utils/promise/thenable");
|
|
5
|
-
|
|
6
|
-
function segmentMatcherContext(log, segmentName, storage) {
|
|
5
|
+
function segmentMatcherContext(segmentName, storage) {
|
|
7
6
|
return function segmentMatcher(key) {
|
|
8
7
|
var isInSegment = storage.segments.isInSegment(segmentName, key);
|
|
9
8
|
if ((0, thenable_1.thenable)(isInSegment)) {
|
|
10
9
|
isInSegment.then(function (result) {
|
|
11
|
-
log.debug(constants_1.ENGINE_MATCHER_SEGMENT, [segmentName, key, isInSegment]);
|
|
12
10
|
return result;
|
|
13
11
|
});
|
|
14
12
|
}
|
|
15
|
-
else {
|
|
16
|
-
log.debug(constants_1.ENGINE_MATCHER_SEGMENT, [segmentName, key, isInSegment]);
|
|
17
|
-
}
|
|
18
13
|
return isInSegment;
|
|
19
14
|
};
|
|
20
15
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.betweenSemverMatcherContext = void 0;
|
|
4
4
|
var Semver_1 = require("../../utils/Semver");
|
|
5
|
-
function betweenSemverMatcherContext(
|
|
5
|
+
function betweenSemverMatcherContext(ruleAttr) {
|
|
6
6
|
var startSemver = new Semver_1.Semver(ruleAttr.start);
|
|
7
7
|
var endSemver = new Semver_1.Semver(ruleAttr.end);
|
|
8
8
|
return function betweenSemverMatcher(runtimeAttr) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.equalToSemverMatcherContext = void 0;
|
|
4
4
|
var Semver_1 = require("../../utils/Semver");
|
|
5
|
-
function equalToSemverMatcherContext(
|
|
5
|
+
function equalToSemverMatcherContext(ruleAttr) {
|
|
6
6
|
var ruleSemver = new Semver_1.Semver(ruleAttr);
|
|
7
7
|
return function equalToSemverMatcher(runtimeAttr) {
|
|
8
8
|
var runtimeSemver = new Semver_1.Semver(runtimeAttr);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.greaterThanEqualToSemverMatcherContext = void 0;
|
|
4
4
|
var Semver_1 = require("../../utils/Semver");
|
|
5
|
-
function greaterThanEqualToSemverMatcherContext(
|
|
5
|
+
function greaterThanEqualToSemverMatcherContext(ruleAttr) {
|
|
6
6
|
var ruleSemver = new Semver_1.Semver(ruleAttr);
|
|
7
7
|
return function greaterThanEqualToSemverMatcher(runtimeAttr) {
|
|
8
8
|
var runtimeSemver = new Semver_1.Semver(runtimeAttr);
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.inListSemverMatcherContext = void 0;
|
|
4
4
|
var sets_1 = require("../../utils/lang/sets");
|
|
5
5
|
var Semver_1 = require("../../utils/Semver");
|
|
6
|
-
function inListSemverMatcherContext(
|
|
6
|
+
function inListSemverMatcherContext(ruleAttr) {
|
|
7
7
|
// @TODO ruleAttr validation should be done at the `parser` or `matchersTransform` level to reuse for all matchers
|
|
8
8
|
if (!ruleAttr || ruleAttr.length === 0)
|
|
9
9
|
throw new Error('whitelistMatcherData is required for IN_LIST_SEMVER matcher type');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.lessThanEqualToSemverMatcherContext = void 0;
|
|
4
4
|
var Semver_1 = require("../../utils/Semver");
|
|
5
|
-
function lessThanEqualToSemverMatcherContext(
|
|
5
|
+
function lessThanEqualToSemverMatcherContext(ruleAttr) {
|
|
6
6
|
var ruleSemver = new Semver_1.Semver(ruleAttr);
|
|
7
7
|
return function lessThanEqualToSemverMatcher(runtimeAttr) {
|
|
8
8
|
var runtimeSemver = new Semver_1.Semver(runtimeAttr);
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.stringMatcherContext = void 0;
|
|
4
|
-
|
|
5
|
-
function stringMatcherContext(log, ruleAttr) {
|
|
4
|
+
function stringMatcherContext(ruleAttr) {
|
|
6
5
|
var regex = new RegExp(ruleAttr);
|
|
7
6
|
return function stringMatcher(runtimeAttr) {
|
|
8
7
|
var regexMatches = regex.test(runtimeAttr);
|
|
9
|
-
log.debug(constants_1.ENGINE_MATCHER_STRING, [runtimeAttr, ruleAttr, regexMatches ? 'yes' : 'no']);
|
|
10
8
|
return regexMatches;
|
|
11
9
|
};
|
|
12
10
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.startsWithMatcherContext = void 0;
|
|
4
|
-
var constants_1 = require("../../logger/constants");
|
|
5
4
|
var lang_1 = require("../../utils/lang");
|
|
6
|
-
function startsWithMatcherContext(
|
|
5
|
+
function startsWithMatcherContext(ruleAttr) {
|
|
7
6
|
return function startsWithMatcher(runtimeAttr) {
|
|
8
7
|
var matches = ruleAttr.some(function (e) { return (0, lang_1.startsWith)(runtimeAttr, e); });
|
|
9
|
-
log.debug(constants_1.ENGINE_MATCHER_STARTS_WITH, [runtimeAttr, ruleAttr, matches]);
|
|
10
8
|
return matches;
|
|
11
9
|
};
|
|
12
10
|
}
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.whitelistMatcherContext = void 0;
|
|
4
4
|
var sets_1 = require("../../utils/lang/sets");
|
|
5
|
-
|
|
6
|
-
function whitelistMatcherContext(log, ruleAttr) {
|
|
5
|
+
function whitelistMatcherContext(ruleAttr) {
|
|
7
6
|
var whitelistSet = new sets_1._Set(ruleAttr);
|
|
8
7
|
return function whitelistMatcher(runtimeAttr) {
|
|
9
8
|
var isInWhitelist = whitelistSet.has(runtimeAttr);
|
|
10
|
-
log.debug(constants_1.ENGINE_MATCHER_WHITELIST, [runtimeAttr, ruleAttr.join(','), isInWhitelist]);
|
|
11
9
|
return isInWhitelist;
|
|
12
10
|
};
|
|
13
11
|
}
|
|
@@ -37,10 +37,13 @@ function parser(log, conditions, storage) {
|
|
|
37
37
|
log.error(constants_1.ENGINE_MATCHER_ERROR, [matcherDto.name, error]);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
function handleResult(result) {
|
|
41
|
+
log.debug(constants_1.ENGINE_MATCHER_RESULT, [matcherDto.name, result, matcherDto.value, value]); // @ts-ignore
|
|
42
|
+
return Boolean(result ^ matcherDto.negate);
|
|
43
|
+
}
|
|
44
|
+
return (0, thenable_1.thenable)(result) ?
|
|
45
|
+
result.then(handleResult) :
|
|
46
|
+
handleResult(result);
|
|
44
47
|
};
|
|
45
48
|
});
|
|
46
49
|
// if matcher's factory can't instantiate the matchers, the expressions array will be empty
|
package/cjs/logger/constants.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.LOG_PREFIX_CLEANUP = exports.LOG_PREFIX_UNIQUE_KEYS_TRACKER = exports.LOG_PREFIX_EVENTS_TRACKER = exports.LOG_PREFIX_IMPRESSIONS_TRACKER = exports.LOG_PREFIX_SYNC_SUBMITTERS = exports.LOG_PREFIX_SYNC_POLLING = exports.LOG_PREFIX_SYNC_MYSEGMENTS = exports.LOG_PREFIX_SYNC_SEGMENTS = exports.LOG_PREFIX_SYNC_SPLITS = exports.LOG_PREFIX_SYNC_STREAMING = exports.LOG_PREFIX_SYNC_OFFLINE = exports.LOG_PREFIX_SYNC_MANAGER = exports.LOG_PREFIX_SYNC = exports.LOG_PREFIX_ENGINE_VALUE = exports.LOG_PREFIX_ENGINE_MATCHER = exports.LOG_PREFIX_ENGINE_COMBINER = exports.LOG_PREFIX_ENGINE = exports.LOG_PREFIX_INSTANTIATION = exports.LOG_PREFIX_SETTINGS = exports.ENGINE_MATCHER_ERROR = exports.ERROR_SETS_FILTER_EXCLUSIVE = exports.ERROR_TOO_MANY_SETS = exports.ERROR_MIN_CONFIG_PARAM = exports.ERROR_NOT_BOOLEAN = exports.ERROR_STORAGE_INVALID = exports.ERROR_LOCALHOST_MODULE_REQUIRED = exports.ERROR_HTTP =
|
|
3
|
+
exports.ENGINE_VALUE_INVALID = exports.USER_CONSENT_INITIAL = exports.USER_CONSENT_NOT_UPDATED = exports.USER_CONSENT_UPDATED = exports.IMPRESSIONS_TRACKER_SUCCESS = exports.EVENTS_TRACKER_SUCCESS = exports.SYNC_STOP_POLLING = exports.SYNC_CONTINUE_POLLING = exports.SYNC_START_POLLING = exports.SUBMITTERS_PUSH = exports.SUBMITTERS_PUSH_FULL_QUEUE = exports.STREAMING_DISCONNECTING = exports.STREAMING_DISABLED = exports.STREAMING_CONNECTING = exports.STREAMING_RECONNECT = exports.STREAMING_REFRESH_TOKEN = exports.SYNC_SPLITS_FETCH_RETRY = exports.POLLING_STOP = exports.POLLING_START = exports.POLLING_SMART_PAUSING = exports.NEW_FACTORY = exports.NEW_SHARED_CLIENT = exports.IMPRESSION_QUEUEING = exports.IMPRESSION = exports.CLIENT_READY = exports.CLIENT_READY_FROM_CACHE = exports.ENGINE_MATCHER_RESULT = exports.SETTINGS_SPLITS_FILTER = exports.SYNC_TASK_STOP = exports.SYNC_TASK_EXECUTE = exports.SYNC_TASK_START = exports.STREAMING_NEW_MESSAGE = exports.SYNC_SPLITS_SEGMENTS = exports.SYNC_SPLITS_REMOVED = exports.SYNC_SPLITS_NEW = exports.SYNC_SPLITS_FETCH = exports.SYNC_OFFLINE_DATA = exports.RETRIEVE_MANAGER = exports.RETRIEVE_CLIENT_EXISTING = exports.RETRIEVE_CLIENT_DEFAULT = exports.CLEANUP_DEREGISTERING = exports.CLEANUP_REGISTERING = exports.ENGINE_SANITIZE = exports.ENGINE_VALUE = exports.ENGINE_MATCHER_DEPENDENCY_PRE = exports.ENGINE_MATCHER_DEPENDENCY = exports.ENGINE_BUCKET = exports.ENGINE_COMBINER_IFELSEIF_NO_TREATMENT = exports.ENGINE_COMBINER_IFELSEIF = exports.ENGINE_COMBINER_AND = void 0;
|
|
4
|
+
exports.ERROR_INVALID_CONFIG_PARAM = exports.ERROR_EMPTY_ARRAY = exports.ERROR_EMPTY = exports.ERROR_INVALID = exports.ERROR_INVALID_KEY_OBJECT = exports.ERROR_TOO_LONG = exports.ERROR_NULL = exports.ERROR_CLIENT_DESTROYED = exports.ERROR_NOT_FINITE = exports.ERROR_SIZE_EXCEEDED = exports.ERROR_NOT_PLAIN_OBJECT = exports.ERROR_EVENT_TYPE_FORMAT = exports.ERROR_EVENTS_TRACKER = exports.ERROR_IMPRESSIONS_LISTENER = exports.ERROR_IMPRESSIONS_TRACKER = exports.ERROR_STREAMING_AUTH = exports.ERROR_STREAMING_SSE = exports.ERROR_SYNC_OFFLINE_LOADING = exports.ERROR_CLIENT_CANNOT_GET_READY = exports.ERROR_CLIENT_LISTENER = exports.ERROR_LOGLEVEL_INVALID = exports.ERROR_ENGINE_COMBINER_IFELSEIF = exports.WARN_FLAGSET_WITHOUT_FLAGS = exports.WARN_FLAGSET_NOT_CONFIGURED = exports.WARN_LOWERCASE_FLAGSET = exports.WARN_INVALID_FLAGSET = exports.STREAMING_PARSING_SPLIT_UPDATE = exports.STREAMING_PARSING_MY_SEGMENTS_UPDATE_V2 = exports.WARN_SDK_KEY = exports.WARN_SPLITS_FILTER_EMPTY = exports.WARN_SPLITS_FILTER_INVALID = exports.WARN_SPLITS_FILTER_IGNORED = exports.WARN_INTEGRATION_INVALID = exports.WARN_NOT_EXISTENT_TT = exports.WARN_LOWERCASE_TRAFFIC_TYPE = exports.WARN_NOT_EXISTENT_SPLIT = exports.WARN_TRIMMING = exports.WARN_CONVERTING = exports.WARN_TRIMMING_PROPERTIES = exports.WARN_SETTING_NULL = exports.SUBMITTERS_PUSH_RETRY = exports.SUBMITTERS_PUSH_FAILS = exports.STREAMING_FALLBACK = exports.STREAMING_PARSING_MESSAGE_FAILS = exports.STREAMING_PARSING_ERROR_FAILS = exports.SYNC_SPLITS_FETCH_FAILS = exports.SYNC_MYSEGMENTS_FETCH_RETRY = exports.CLIENT_NOT_READY = exports.CLIENT_NO_LISTENER = exports.ENGINE_VALUE_NO_ATTRIBUTES = void 0;
|
|
5
|
+
exports.LOG_PREFIX_CLEANUP = exports.LOG_PREFIX_UNIQUE_KEYS_TRACKER = exports.LOG_PREFIX_EVENTS_TRACKER = exports.LOG_PREFIX_IMPRESSIONS_TRACKER = exports.LOG_PREFIX_SYNC_SUBMITTERS = exports.LOG_PREFIX_SYNC_POLLING = exports.LOG_PREFIX_SYNC_MYSEGMENTS = exports.LOG_PREFIX_SYNC_SEGMENTS = exports.LOG_PREFIX_SYNC_SPLITS = exports.LOG_PREFIX_SYNC_STREAMING = exports.LOG_PREFIX_SYNC_OFFLINE = exports.LOG_PREFIX_SYNC_MANAGER = exports.LOG_PREFIX_SYNC = exports.LOG_PREFIX_ENGINE_VALUE = exports.LOG_PREFIX_ENGINE_MATCHER = exports.LOG_PREFIX_ENGINE_COMBINER = exports.LOG_PREFIX_ENGINE = exports.LOG_PREFIX_INSTANTIATION = exports.LOG_PREFIX_SETTINGS = exports.ENGINE_MATCHER_ERROR = exports.ERROR_SETS_FILTER_EXCLUSIVE = exports.ERROR_TOO_MANY_SETS = exports.ERROR_MIN_CONFIG_PARAM = exports.ERROR_NOT_BOOLEAN = exports.ERROR_STORAGE_INVALID = exports.ERROR_LOCALHOST_MODULE_REQUIRED = exports.ERROR_HTTP = void 0;
|
|
6
6
|
/**
|
|
7
7
|
* Message codes used to trim string log messages from commons and client-side API modules,
|
|
8
8
|
* in order to reduce the minimal SDK size for Browser and eventually other client-side environments.
|
|
@@ -14,24 +14,8 @@ exports.ENGINE_COMBINER_AND = 0;
|
|
|
14
14
|
exports.ENGINE_COMBINER_IFELSEIF = 1;
|
|
15
15
|
exports.ENGINE_COMBINER_IFELSEIF_NO_TREATMENT = 2;
|
|
16
16
|
exports.ENGINE_BUCKET = 3;
|
|
17
|
-
exports.ENGINE_MATCHER_ALL = 4;
|
|
18
|
-
exports.ENGINE_MATCHER_BETWEEN = 5;
|
|
19
|
-
exports.ENGINE_MATCHER_BOOLEAN = 6;
|
|
20
|
-
exports.ENGINE_MATCHER_CONTAINS_ALL = 7;
|
|
21
|
-
exports.ENGINE_MATCHER_CONTAINS_ANY = 8;
|
|
22
|
-
exports.ENGINE_MATCHER_CONTAINS_STRING = 9;
|
|
23
17
|
exports.ENGINE_MATCHER_DEPENDENCY = 10;
|
|
24
18
|
exports.ENGINE_MATCHER_DEPENDENCY_PRE = 11;
|
|
25
|
-
exports.ENGINE_MATCHER_EQUAL = 12;
|
|
26
|
-
exports.ENGINE_MATCHER_EQUAL_TO_SET = 13;
|
|
27
|
-
exports.ENGINE_MATCHER_ENDS_WITH = 14;
|
|
28
|
-
exports.ENGINE_MATCHER_GREATER = 15;
|
|
29
|
-
exports.ENGINE_MATCHER_LESS = 16;
|
|
30
|
-
exports.ENGINE_MATCHER_PART_OF = 17;
|
|
31
|
-
exports.ENGINE_MATCHER_SEGMENT = 18;
|
|
32
|
-
exports.ENGINE_MATCHER_STRING = 19;
|
|
33
|
-
exports.ENGINE_MATCHER_STARTS_WITH = 21;
|
|
34
|
-
exports.ENGINE_MATCHER_WHITELIST = 22;
|
|
35
19
|
exports.ENGINE_VALUE = 23;
|
|
36
20
|
exports.ENGINE_SANITIZE = 24;
|
|
37
21
|
exports.CLEANUP_REGISTERING = 25;
|
|
@@ -49,6 +33,7 @@ exports.SYNC_TASK_START = 36;
|
|
|
49
33
|
exports.SYNC_TASK_EXECUTE = 37;
|
|
50
34
|
exports.SYNC_TASK_STOP = 38;
|
|
51
35
|
exports.SETTINGS_SPLITS_FILTER = 39;
|
|
36
|
+
exports.ENGINE_MATCHER_RESULT = 40;
|
|
52
37
|
exports.CLIENT_READY_FROM_CACHE = 100;
|
|
53
38
|
exports.CLIENT_READY = 101;
|
|
54
39
|
exports.IMPRESSION = 102;
|
|
@@ -10,26 +10,11 @@ exports.codesDebug = info_1.codesInfo.concat([
|
|
|
10
10
|
[c.ENGINE_COMBINER_IFELSEIF, c.LOG_PREFIX_ENGINE_COMBINER + 'Treatment found: %s'],
|
|
11
11
|
[c.ENGINE_COMBINER_IFELSEIF_NO_TREATMENT, c.LOG_PREFIX_ENGINE_COMBINER + 'All predicates evaluated, no treatment found.'],
|
|
12
12
|
[c.ENGINE_BUCKET, c.LOG_PREFIX_ENGINE + ': using algo "murmur" bucket %s for key %s using seed %s - treatment %s'],
|
|
13
|
-
[c.
|
|
14
|
-
[c.
|
|
15
|
-
[c.
|
|
16
|
-
[c.
|
|
17
|
-
[c.
|
|
18
|
-
[c.ENGINE_MATCHER_CONTAINS_STRING, c.LOG_PREFIX_ENGINE_MATCHER + '[containsStringMatcher] %s contains %s? %s'],
|
|
19
|
-
[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.'],
|
|
20
|
-
[c.ENGINE_MATCHER_DEPENDENCY_PRE, c.LOG_PREFIX_ENGINE_MATCHER + '[dependencyMatcher] will evaluate parent feature flag: "%s" with key: %s %s'],
|
|
21
|
-
[c.ENGINE_MATCHER_EQUAL, c.LOG_PREFIX_ENGINE_MATCHER + '[equalToMatcher] is %s equal to %s? %s'],
|
|
22
|
-
[c.ENGINE_MATCHER_EQUAL_TO_SET, c.LOG_PREFIX_ENGINE_MATCHER + '[equalToSetMatcher] is %s equal to set %s? %s'],
|
|
23
|
-
[c.ENGINE_MATCHER_ENDS_WITH, c.LOG_PREFIX_ENGINE_MATCHER + '[endsWithMatcher] %s ends with %s? %s'],
|
|
24
|
-
[c.ENGINE_MATCHER_GREATER, c.LOG_PREFIX_ENGINE_MATCHER + '[greaterThanEqualMatcher] is %s greater than %s? %s'],
|
|
25
|
-
[c.ENGINE_MATCHER_LESS, c.LOG_PREFIX_ENGINE_MATCHER + '[lessThanEqualMatcher] is %s less than %s? %s'],
|
|
26
|
-
[c.ENGINE_MATCHER_PART_OF, c.LOG_PREFIX_ENGINE_MATCHER + '[partOfMatcher] %s is part of %s? %s'],
|
|
27
|
-
[c.ENGINE_MATCHER_SEGMENT, c.LOG_PREFIX_ENGINE_MATCHER + '[segmentMatcher] evaluated %s / %s => %s'],
|
|
28
|
-
[c.ENGINE_MATCHER_STRING, c.LOG_PREFIX_ENGINE_MATCHER + '[stringMatcher] does %s matches with %s? %s'],
|
|
29
|
-
[c.ENGINE_MATCHER_STARTS_WITH, c.LOG_PREFIX_ENGINE_MATCHER + '[startsWithMatcher] %s starts with %s? %s'],
|
|
30
|
-
[c.ENGINE_MATCHER_WHITELIST, c.LOG_PREFIX_ENGINE_MATCHER + '[whitelistMatcher] evaluated %s in [%s] => %s'],
|
|
31
|
-
[c.ENGINE_VALUE, c.LOG_PREFIX_ENGINE_VALUE + 'Extracted attribute [%s], [%s] will be used for matching.'],
|
|
32
|
-
[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_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.'],
|
|
14
|
+
[c.ENGINE_MATCHER_DEPENDENCY_PRE, c.LOG_PREFIX_ENGINE_MATCHER + '[IN_SPLIT_TREATMENT] will evaluate parent feature flag: "%s" with key: %s %s'],
|
|
15
|
+
[c.ENGINE_VALUE, c.LOG_PREFIX_ENGINE_VALUE + 'Extracted attribute `%s`. %s will be used for matching.'],
|
|
16
|
+
[c.ENGINE_SANITIZE, c.LOG_PREFIX_ENGINE + ':sanitize: Attempted to sanitize %s which should be of type %s. Sanitized and processed value => %s'],
|
|
17
|
+
[c.ENGINE_MATCHER_RESULT, c.LOG_PREFIX_ENGINE_MATCHER + '[%s] Result: %s. Rule value: %s. Evaluation value: %s'],
|
|
33
18
|
// SDK
|
|
34
19
|
[c.CLEANUP_REGISTERING, c.LOG_PREFIX_CLEANUP + 'Registering cleanup handler %s'],
|
|
35
20
|
[c.CLEANUP_DEREGISTERING, c.LOG_PREFIX_CLEANUP + 'Deregistering cleanup handler %s'],
|
|
@@ -7,7 +7,7 @@ var error_1 = require("./error");
|
|
|
7
7
|
exports.codesWarn = error_1.codesError.concat([
|
|
8
8
|
// evaluator
|
|
9
9
|
[c.ENGINE_VALUE_INVALID, c.LOG_PREFIX_ENGINE_VALUE + 'Value %s doesn\'t match with expected type.'],
|
|
10
|
-
[c.ENGINE_VALUE_NO_ATTRIBUTES, c.LOG_PREFIX_ENGINE_VALUE + 'Defined attribute
|
|
10
|
+
[c.ENGINE_VALUE_NO_ATTRIBUTES, c.LOG_PREFIX_ENGINE_VALUE + 'Defined attribute `%s`. No attributes received.'],
|
|
11
11
|
// synchronizer
|
|
12
12
|
[c.SYNC_MYSEGMENTS_FETCH_RETRY, c.LOG_PREFIX_SYNC_MYSEGMENTS + 'Retrying download of segments #%s. Reason: %s'],
|
|
13
13
|
[c.SYNC_SPLITS_FETCH_FAILS, c.LOG_PREFIX_SYNC_SPLITS + 'Error while doing fetch of feature flags. %s'],
|
|
@@ -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
|
}
|