@splitsoftware/splitio-commons 1.13.2-rc.7 → 1.13.2-rc.8
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 +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/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/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/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
package/CHANGES.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
1.14.0 (April XX, 2024)
|
|
2
2
|
- Added support for Semver matchers.
|
|
3
|
-
-
|
|
3
|
+
- Added special impression label of 'targeting rule type unsupported by sdk' when the matcher type is not supported by the SDK, which returns 'control'.
|
|
4
4
|
- Updated Split API client to include the flags spec version query parameter for the `splitChanges` and `auth` endpoints.
|
|
5
5
|
|
|
6
6
|
1.13.1 (January 10, 2024)
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.allMatcherContext = void 0;
|
|
4
|
-
|
|
4
|
+
var constants_1 = require("../../logger/constants");
|
|
5
|
+
function allMatcherContext(log) {
|
|
5
6
|
return function allMatcher(runtimeAttr) {
|
|
7
|
+
log.debug(constants_1.ENGINE_MATCHER_ALL);
|
|
6
8
|
return runtimeAttr != null;
|
|
7
9
|
};
|
|
8
10
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.betweenMatcherContext = void 0;
|
|
4
|
-
|
|
4
|
+
var constants_1 = require("../../logger/constants");
|
|
5
|
+
function betweenMatcherContext(log, ruleVO) {
|
|
5
6
|
return function betweenMatcher(runtimeAttr) {
|
|
6
7
|
var isBetween = runtimeAttr >= ruleVO.start && runtimeAttr <= ruleVO.end;
|
|
8
|
+
log.debug(constants_1.ENGINE_MATCHER_BETWEEN, [runtimeAttr, ruleVO.start, ruleVO.end, isBetween]);
|
|
7
9
|
return isBetween;
|
|
8
10
|
};
|
|
9
11
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.booleanMatcherContext = void 0;
|
|
4
|
-
|
|
4
|
+
var constants_1 = require("../../logger/constants");
|
|
5
|
+
function booleanMatcherContext(log, ruleAttr) {
|
|
5
6
|
return function booleanMatcher(runtimeAttr) {
|
|
6
7
|
var booleanMatches = ruleAttr === runtimeAttr;
|
|
8
|
+
log.debug(constants_1.ENGINE_MATCHER_BOOLEAN, [ruleAttr, runtimeAttr]);
|
|
7
9
|
return booleanMatches;
|
|
8
10
|
};
|
|
9
11
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
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");
|
|
4
5
|
var lang_1 = require("../../utils/lang");
|
|
5
|
-
function containsAllSetMatcherContext(ruleAttr) {
|
|
6
|
+
function containsAllSetMatcherContext(log, ruleAttr) {
|
|
6
7
|
return function containsAllMatcher(runtimeAttr) {
|
|
7
8
|
var containsAll = true;
|
|
8
9
|
if (runtimeAttr.length < ruleAttr.length) {
|
|
@@ -17,6 +18,7 @@ function containsAllSetMatcherContext(ruleAttr) {
|
|
|
17
18
|
_loop_1(i);
|
|
18
19
|
}
|
|
19
20
|
}
|
|
21
|
+
log.debug(constants_1.ENGINE_MATCHER_CONTAINS_ALL, [runtimeAttr, ruleAttr, containsAll]);
|
|
20
22
|
return containsAll;
|
|
21
23
|
};
|
|
22
24
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
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");
|
|
4
5
|
var lang_1 = require("../../utils/lang");
|
|
5
|
-
function containsAnySetMatcherContext(ruleAttr) {
|
|
6
|
+
function containsAnySetMatcherContext(log, ruleAttr) {
|
|
6
7
|
return function containsAnyMatcher(runtimeAttr) {
|
|
7
8
|
var containsAny = false;
|
|
8
9
|
var _loop_1 = function (i) {
|
|
@@ -12,6 +13,7 @@ function containsAnySetMatcherContext(ruleAttr) {
|
|
|
12
13
|
for (var i = 0; i < ruleAttr.length && !containsAny; i++) {
|
|
13
14
|
_loop_1(i);
|
|
14
15
|
}
|
|
16
|
+
log.debug(constants_1.ENGINE_MATCHER_CONTAINS_ANY, [runtimeAttr, ruleAttr, containsAny]);
|
|
15
17
|
return containsAny;
|
|
16
18
|
};
|
|
17
19
|
}
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.containsStringMatcherContext = void 0;
|
|
4
4
|
var lang_1 = require("../../utils/lang");
|
|
5
|
-
|
|
5
|
+
var constants_1 = require("../../logger/constants");
|
|
6
|
+
function containsStringMatcherContext(log, ruleAttr) {
|
|
6
7
|
return function containsStringMatcher(runtimeAttr) {
|
|
7
8
|
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]);
|
|
8
10
|
return contains;
|
|
9
11
|
};
|
|
10
12
|
}
|
|
@@ -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(_a, storage
|
|
6
|
+
function dependencyMatcherContext(log, _a, storage) {
|
|
7
7
|
var split = _a.split, treatments = _a.treatments;
|
|
8
8
|
function checkTreatment(evaluation, acceptableTreatments, parentName) {
|
|
9
9
|
var matches = false;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.equalToMatcherContext = void 0;
|
|
4
|
-
|
|
4
|
+
var constants_1 = require("../../logger/constants");
|
|
5
|
+
function equalToMatcherContext(log, ruleAttr) {
|
|
5
6
|
return function equalToMatcher(runtimeAttr) {
|
|
6
7
|
var isEqual = runtimeAttr === ruleAttr;
|
|
8
|
+
log.debug(constants_1.ENGINE_MATCHER_EQUAL, [runtimeAttr, ruleAttr, isEqual]);
|
|
7
9
|
return isEqual;
|
|
8
10
|
};
|
|
9
11
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
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");
|
|
4
5
|
var lang_1 = require("../../utils/lang");
|
|
5
|
-
function equalToSetMatcherContext(ruleAttr) {
|
|
6
|
+
function equalToSetMatcherContext(log, ruleAttr) {
|
|
6
7
|
return function equalToSetMatcher(runtimeAttr) {
|
|
7
8
|
// Length being the same is the first condition.
|
|
8
9
|
var isEqual = runtimeAttr.length === ruleAttr.length;
|
|
@@ -14,6 +15,7 @@ function equalToSetMatcherContext(ruleAttr) {
|
|
|
14
15
|
for (var i = 0; i < runtimeAttr.length && isEqual; i++) {
|
|
15
16
|
_loop_1(i);
|
|
16
17
|
}
|
|
18
|
+
log.debug(constants_1.ENGINE_MATCHER_EQUAL_TO_SET, [runtimeAttr, ruleAttr, isEqual]);
|
|
17
19
|
return isEqual;
|
|
18
20
|
};
|
|
19
21
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
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");
|
|
4
5
|
var lang_1 = require("../../utils/lang");
|
|
5
|
-
function endsWithMatcherContext(ruleAttr) {
|
|
6
|
+
function endsWithMatcherContext(log, ruleAttr) {
|
|
6
7
|
return function endsWithMatcher(runtimeAttr) {
|
|
7
8
|
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]);
|
|
8
10
|
return strEndsWith;
|
|
9
11
|
};
|
|
10
12
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.greaterThanEqualMatcherContext = void 0;
|
|
4
|
-
|
|
4
|
+
var constants_1 = require("../../logger/constants");
|
|
5
|
+
function greaterThanEqualMatcherContext(log, ruleAttr) {
|
|
5
6
|
return function greaterThanEqualMatcher(runtimeAttr) {
|
|
6
7
|
var isGreaterThanEqual = runtimeAttr >= ruleAttr;
|
|
8
|
+
log.debug(constants_1.ENGINE_MATCHER_GREATER, [runtimeAttr, ruleAttr, isGreaterThanEqual]);
|
|
7
9
|
return isGreaterThanEqual;
|
|
8
10
|
};
|
|
9
11
|
}
|
|
@@ -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](value, storage
|
|
59
|
+
matcherFn = matchers[type](log, value, storage); // There is no index-out-of-bound exception in JavaScript
|
|
60
60
|
return matcherFn;
|
|
61
61
|
}
|
|
62
62
|
exports.matcherFactory = matcherFactory;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.lessThanEqualMatcherContext = void 0;
|
|
4
|
-
|
|
4
|
+
var constants_1 = require("../../logger/constants");
|
|
5
|
+
function lessThanEqualMatcherContext(log, ruleAttr) {
|
|
5
6
|
return function lessThanEqualMatcher(runtimeAttr) {
|
|
6
7
|
var isLessThanEqual = runtimeAttr <= ruleAttr;
|
|
8
|
+
log.debug(constants_1.ENGINE_MATCHER_LESS, [runtimeAttr, ruleAttr, isLessThanEqual]);
|
|
7
9
|
return isLessThanEqual;
|
|
8
10
|
};
|
|
9
11
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.partOfSetMatcherContext = void 0;
|
|
4
4
|
var lang_1 = require("../../utils/lang");
|
|
5
|
-
|
|
5
|
+
var constants_1 = require("../../logger/constants");
|
|
6
|
+
function partOfSetMatcherContext(log, ruleAttr) {
|
|
6
7
|
return function partOfMatcher(runtimeAttr) {
|
|
7
8
|
// To be part of the length should be minor or equal.
|
|
8
9
|
var isPartOf = runtimeAttr.length <= ruleAttr.length;
|
|
@@ -14,6 +15,7 @@ function partOfSetMatcherContext(ruleAttr) {
|
|
|
14
15
|
for (var i = 0; i < runtimeAttr.length && isPartOf; i++) {
|
|
15
16
|
_loop_1(i);
|
|
16
17
|
}
|
|
18
|
+
log.debug(constants_1.ENGINE_MATCHER_PART_OF, [runtimeAttr, ruleAttr, isPartOf]);
|
|
17
19
|
return isPartOf;
|
|
18
20
|
};
|
|
19
21
|
}
|
|
@@ -2,14 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.segmentMatcherContext = void 0;
|
|
4
4
|
var thenable_1 = require("../../utils/promise/thenable");
|
|
5
|
-
|
|
5
|
+
var constants_1 = require("../../logger/constants");
|
|
6
|
+
function segmentMatcherContext(log, segmentName, storage) {
|
|
6
7
|
return function segmentMatcher(key) {
|
|
7
8
|
var isInSegment = storage.segments.isInSegment(segmentName, key);
|
|
8
9
|
if ((0, thenable_1.thenable)(isInSegment)) {
|
|
9
10
|
isInSegment.then(function (result) {
|
|
11
|
+
log.debug(constants_1.ENGINE_MATCHER_SEGMENT, [segmentName, key, isInSegment]);
|
|
10
12
|
return result;
|
|
11
13
|
});
|
|
12
14
|
}
|
|
15
|
+
else {
|
|
16
|
+
log.debug(constants_1.ENGINE_MATCHER_SEGMENT, [segmentName, key, isInSegment]);
|
|
17
|
+
}
|
|
13
18
|
return isInSegment;
|
|
14
19
|
};
|
|
15
20
|
}
|
|
@@ -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(ruleAttr) {
|
|
5
|
+
function betweenSemverMatcherContext(log, 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(ruleAttr) {
|
|
5
|
+
function equalToSemverMatcherContext(log, 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(ruleAttr) {
|
|
5
|
+
function greaterThanEqualToSemverMatcherContext(log, 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(ruleAttr) {
|
|
6
|
+
function inListSemverMatcherContext(log, 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(ruleAttr) {
|
|
5
|
+
function lessThanEqualToSemverMatcherContext(log, 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,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.stringMatcherContext = void 0;
|
|
4
|
-
|
|
4
|
+
var constants_1 = require("../../logger/constants");
|
|
5
|
+
function stringMatcherContext(log, ruleAttr) {
|
|
5
6
|
var regex = new RegExp(ruleAttr);
|
|
6
7
|
return function stringMatcher(runtimeAttr) {
|
|
7
8
|
var regexMatches = regex.test(runtimeAttr);
|
|
9
|
+
log.debug(constants_1.ENGINE_MATCHER_STRING, [runtimeAttr, ruleAttr, regexMatches ? 'yes' : 'no']);
|
|
8
10
|
return regexMatches;
|
|
9
11
|
};
|
|
10
12
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
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");
|
|
4
5
|
var lang_1 = require("../../utils/lang");
|
|
5
|
-
function startsWithMatcherContext(ruleAttr) {
|
|
6
|
+
function startsWithMatcherContext(log, ruleAttr) {
|
|
6
7
|
return function startsWithMatcher(runtimeAttr) {
|
|
7
8
|
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]);
|
|
8
10
|
return matches;
|
|
9
11
|
};
|
|
10
12
|
}
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.whitelistMatcherContext = void 0;
|
|
4
4
|
var sets_1 = require("../../utils/lang/sets");
|
|
5
|
-
|
|
5
|
+
var constants_1 = require("../../logger/constants");
|
|
6
|
+
function whitelistMatcherContext(log, ruleAttr) {
|
|
6
7
|
var whitelistSet = new sets_1._Set(ruleAttr);
|
|
7
8
|
return function whitelistMatcher(runtimeAttr) {
|
|
8
9
|
var isInWhitelist = whitelistSet.has(runtimeAttr);
|
|
10
|
+
log.debug(constants_1.ENGINE_MATCHER_WHITELIST, [runtimeAttr, ruleAttr.join(','), isInWhitelist]);
|
|
9
11
|
return isInWhitelist;
|
|
10
12
|
};
|
|
11
13
|
}
|
|
@@ -37,13 +37,10 @@ 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
|
-
|
|
44
|
-
return (0, thenable_1.thenable)(result) ?
|
|
45
|
-
result.then(handleResult) :
|
|
46
|
-
handleResult(result);
|
|
40
|
+
if ((0, thenable_1.thenable)(result)) { // @ts-ignore
|
|
41
|
+
return result.then(function (res) { return Boolean(res ^ matcherDto.negate); });
|
|
42
|
+
} // @ts-ignore
|
|
43
|
+
return Boolean(result ^ matcherDto.negate);
|
|
47
44
|
};
|
|
48
45
|
});
|
|
49
46
|
// 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 = void 0;
|
|
3
|
+
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.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_WHITELIST = exports.ENGINE_MATCHER_STARTS_WITH = exports.ENGINE_MATCHER_STRING = exports.ENGINE_MATCHER_SEGMENT = exports.ENGINE_MATCHER_PART_OF = exports.ENGINE_MATCHER_LESS = exports.ENGINE_MATCHER_GREATER = exports.ENGINE_MATCHER_ENDS_WITH = exports.ENGINE_MATCHER_EQUAL_TO_SET = exports.ENGINE_MATCHER_EQUAL = exports.ENGINE_MATCHER_DEPENDENCY_PRE = exports.ENGINE_MATCHER_DEPENDENCY = exports.ENGINE_MATCHER_CONTAINS_STRING = exports.ENGINE_MATCHER_CONTAINS_ANY = exports.ENGINE_MATCHER_CONTAINS_ALL = exports.ENGINE_MATCHER_BOOLEAN = exports.ENGINE_MATCHER_BETWEEN = exports.ENGINE_MATCHER_ALL = exports.ENGINE_BUCKET = exports.ENGINE_COMBINER_IFELSEIF_NO_TREATMENT = exports.ENGINE_COMBINER_IFELSEIF = exports.ENGINE_COMBINER_AND = void 0;
|
|
4
|
+
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 = 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 = 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 = 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 = 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,8 +14,24 @@ 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;
|
|
17
23
|
exports.ENGINE_MATCHER_DEPENDENCY = 10;
|
|
18
24
|
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;
|
|
19
35
|
exports.ENGINE_VALUE = 23;
|
|
20
36
|
exports.ENGINE_SANITIZE = 24;
|
|
21
37
|
exports.CLEANUP_REGISTERING = 25;
|
|
@@ -33,7 +49,6 @@ exports.SYNC_TASK_START = 36;
|
|
|
33
49
|
exports.SYNC_TASK_EXECUTE = 37;
|
|
34
50
|
exports.SYNC_TASK_STOP = 38;
|
|
35
51
|
exports.SETTINGS_SPLITS_FILTER = 39;
|
|
36
|
-
exports.ENGINE_MATCHER_RESULT = 40;
|
|
37
52
|
exports.CLIENT_READY_FROM_CACHE = 100;
|
|
38
53
|
exports.CLIENT_READY = 101;
|
|
39
54
|
exports.IMPRESSION = 102;
|
|
@@ -10,11 +10,26 @@ 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.
|
|
13
|
+
[c.ENGINE_MATCHER_ALL, c.LOG_PREFIX_ENGINE_MATCHER + '[allMatcher] is always true'],
|
|
14
|
+
[c.ENGINE_MATCHER_BETWEEN, c.LOG_PREFIX_ENGINE_MATCHER + '[betweenMatcher] is %s between %s and %s? %s'],
|
|
15
|
+
[c.ENGINE_MATCHER_BOOLEAN, c.LOG_PREFIX_ENGINE_MATCHER + '[booleanMatcher] %s === %s'],
|
|
16
|
+
[c.ENGINE_MATCHER_CONTAINS_ALL, c.LOG_PREFIX_ENGINE_MATCHER + '[containsAllMatcher] %s contains all elements of %s? %s'],
|
|
17
|
+
[c.ENGINE_MATCHER_CONTAINS_ANY, c.LOG_PREFIX_ENGINE_MATCHER + '[containsAnyMatcher] %s contains at least an element of %s? %s'],
|
|
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]'],
|
|
18
33
|
// SDK
|
|
19
34
|
[c.CLEANUP_REGISTERING, c.LOG_PREFIX_CLEANUP + 'Registering cleanup handler %s'],
|
|
20
35
|
[c.CLEANUP_DEREGISTERING, c.LOG_PREFIX_CLEANUP + 'Deregistering cleanup handler %s'],
|
|
@@ -5,7 +5,7 @@ var tslib_1 = require("tslib");
|
|
|
5
5
|
var c = (0, tslib_1.__importStar)(require("../constants"));
|
|
6
6
|
exports.codesError = [
|
|
7
7
|
// evaluator
|
|
8
|
-
[c.ERROR_ENGINE_COMBINER_IFELSEIF, c.LOG_PREFIX_ENGINE_COMBINER + 'Invalid feature flag, no valid rules or unsupported
|
|
8
|
+
[c.ERROR_ENGINE_COMBINER_IFELSEIF, c.LOG_PREFIX_ENGINE_COMBINER + 'Invalid feature flag, no valid rules or unsupported targeting rule type found'],
|
|
9
9
|
[c.ENGINE_MATCHER_ERROR, c.LOG_PREFIX_ENGINE_MATCHER + '[%s] %s'],
|
|
10
10
|
// SDK
|
|
11
11
|
[c.ERROR_LOGLEVEL_INVALID, 'logger: Invalid Log Level - No changes to the logs will be applied.'],
|
|
@@ -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'],
|
|
@@ -126,7 +126,7 @@ var SplitsCacheInLocal = /** @class */ (function (_super) {
|
|
|
126
126
|
SplitsCacheInLocal.prototype.setChangeNumber = function (changeNumber) {
|
|
127
127
|
// when using a new split query, we must update it at the store
|
|
128
128
|
if (this.updateNewFilter) {
|
|
129
|
-
this.log.info(constants_1.LOG_PREFIX + 'SDK key or
|
|
129
|
+
this.log.info(constants_1.LOG_PREFIX + 'SDK key, flags filter criteria or flags spec version was modified. Updating cache');
|
|
130
130
|
var storageHashKey = this.keys.buildHashKey();
|
|
131
131
|
try {
|
|
132
132
|
localStorage.setItem(storageHashKey, this.storageHash);
|
|
@@ -82,7 +82,7 @@ function PluggableStorage(options) {
|
|
|
82
82
|
return wrapper.get(keys.buildHashKey()).then(function (hash) {
|
|
83
83
|
var currentHash = (0, KeyBuilder_1.getStorageHash)(settings);
|
|
84
84
|
if (hash !== currentHash) {
|
|
85
|
-
log.info(constants_2.LOG_PREFIX + 'Storage HASH has changed (SDK key or
|
|
85
|
+
log.info(constants_2.LOG_PREFIX + 'Storage HASH has changed (SDK key, flags filter criteria or flags spec version was modified). Clearing cache');
|
|
86
86
|
return wrapper.getKeysByPrefix(keys.prefix + ".").then(function (storageKeys) {
|
|
87
87
|
return Promise.all(storageKeys.map(function (storageKey) { return wrapper.del(storageKey); }));
|
|
88
88
|
}).then(function () { return wrapper.set(keys.buildHashKey(), currentHash); });
|
|
@@ -8,4 +8,4 @@ exports.SDK_NOT_READY = 'not ready';
|
|
|
8
8
|
exports.EXCEPTION = 'exception';
|
|
9
9
|
exports.SPLIT_ARCHIVED = 'archived';
|
|
10
10
|
exports.NOT_IN_SPLIT = 'not in split';
|
|
11
|
-
exports.UNSUPPORTED_MATCHER_TYPE = 'unsupported
|
|
11
|
+
exports.UNSUPPORTED_MATCHER_TYPE = 'targeting rule type unsupported by sdk';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { ENGINE_MATCHER_BETWEEN } from '../../logger/constants';
|
|
2
|
+
export function betweenMatcherContext(log, ruleVO) {
|
|
2
3
|
return function betweenMatcher(runtimeAttr) {
|
|
3
4
|
var isBetween = runtimeAttr >= ruleVO.start && runtimeAttr <= ruleVO.end;
|
|
5
|
+
log.debug(ENGINE_MATCHER_BETWEEN, [runtimeAttr, ruleVO.start, ruleVO.end, isBetween]);
|
|
4
6
|
return isBetween;
|
|
5
7
|
};
|
|
6
8
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { ENGINE_MATCHER_BOOLEAN } from '../../logger/constants';
|
|
2
|
+
export function booleanMatcherContext(log, ruleAttr) {
|
|
2
3
|
return function booleanMatcher(runtimeAttr) {
|
|
3
4
|
var booleanMatches = ruleAttr === runtimeAttr;
|
|
5
|
+
log.debug(ENGINE_MATCHER_BOOLEAN, [ruleAttr, runtimeAttr]);
|
|
4
6
|
return booleanMatches;
|
|
5
7
|
};
|
|
6
8
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { ENGINE_MATCHER_CONTAINS_ALL } from '../../logger/constants';
|
|
1
2
|
import { findIndex } from '../../utils/lang';
|
|
2
|
-
export function containsAllSetMatcherContext(ruleAttr) {
|
|
3
|
+
export function containsAllSetMatcherContext(log, ruleAttr) {
|
|
3
4
|
return function containsAllMatcher(runtimeAttr) {
|
|
4
5
|
var containsAll = true;
|
|
5
6
|
if (runtimeAttr.length < ruleAttr.length) {
|
|
@@ -14,6 +15,7 @@ export function containsAllSetMatcherContext(ruleAttr) {
|
|
|
14
15
|
_loop_1(i);
|
|
15
16
|
}
|
|
16
17
|
}
|
|
18
|
+
log.debug(ENGINE_MATCHER_CONTAINS_ALL, [runtimeAttr, ruleAttr, containsAll]);
|
|
17
19
|
return containsAll;
|
|
18
20
|
};
|
|
19
21
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { ENGINE_MATCHER_CONTAINS_ANY } from '../../logger/constants';
|
|
1
2
|
import { findIndex } from '../../utils/lang';
|
|
2
|
-
export function containsAnySetMatcherContext(ruleAttr) {
|
|
3
|
+
export function containsAnySetMatcherContext(log, ruleAttr) {
|
|
3
4
|
return function containsAnyMatcher(runtimeAttr) {
|
|
4
5
|
var containsAny = false;
|
|
5
6
|
var _loop_1 = function (i) {
|
|
@@ -9,6 +10,7 @@ export function containsAnySetMatcherContext(ruleAttr) {
|
|
|
9
10
|
for (var i = 0; i < ruleAttr.length && !containsAny; i++) {
|
|
10
11
|
_loop_1(i);
|
|
11
12
|
}
|
|
13
|
+
log.debug(ENGINE_MATCHER_CONTAINS_ANY, [runtimeAttr, ruleAttr, containsAny]);
|
|
12
14
|
return containsAny;
|
|
13
15
|
};
|
|
14
16
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { isString } from '../../utils/lang';
|
|
2
|
-
|
|
2
|
+
import { ENGINE_MATCHER_CONTAINS_STRING } from '../../logger/constants';
|
|
3
|
+
export function containsStringMatcherContext(log, ruleAttr) {
|
|
3
4
|
return function containsStringMatcher(runtimeAttr) {
|
|
4
5
|
var contains = ruleAttr.some(function (e) { return isString(runtimeAttr) && runtimeAttr.indexOf(e) > -1; });
|
|
6
|
+
log.debug(ENGINE_MATCHER_CONTAINS_STRING, [runtimeAttr, ruleAttr, contains]);
|
|
5
7
|
return contains;
|
|
6
8
|
};
|
|
7
9
|
}
|
|
@@ -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(_a, storage
|
|
3
|
+
export function dependencyMatcherContext(log, _a, storage) {
|
|
4
4
|
var split = _a.split, treatments = _a.treatments;
|
|
5
5
|
function checkTreatment(evaluation, acceptableTreatments, parentName) {
|
|
6
6
|
var matches = false;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { ENGINE_MATCHER_EQUAL } from '../../logger/constants';
|
|
2
|
+
export function equalToMatcherContext(log, ruleAttr) {
|
|
2
3
|
return function equalToMatcher(runtimeAttr) {
|
|
3
4
|
var isEqual = runtimeAttr === ruleAttr;
|
|
5
|
+
log.debug(ENGINE_MATCHER_EQUAL, [runtimeAttr, ruleAttr, isEqual]);
|
|
4
6
|
return isEqual;
|
|
5
7
|
};
|
|
6
8
|
}
|