@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
package/CHANGES.txt
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.15.0 (May 15, 2024)
|
|
2
|
+
- Added an optional settings validation parameter to let overwrite the default flag spec version, used by the JS Synchronizer.
|
|
3
|
+
|
|
4
|
+
1.14.0 (May 6, 2024)
|
|
2
5
|
- Added support for targeting rules based on semantic versions (https://semver.org/).
|
|
3
6
|
- 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
7
|
- 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'],
|
package/cjs/services/splitApi.js
CHANGED
|
@@ -20,6 +20,7 @@ function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
20
20
|
var urls = settings.urls;
|
|
21
21
|
var filterQueryString = settings.sync.__splitFiltersValidation && settings.sync.__splitFiltersValidation.queryString;
|
|
22
22
|
var SplitSDKImpressionsMode = settings.sync.impressionsMode;
|
|
23
|
+
var flagSpecVersion = settings.sync.flagSpecVersion;
|
|
23
24
|
var splitHttpClient = (0, splitHttpClient_1.splitHttpClientFactory)(settings, platform.getFetch);
|
|
24
25
|
return {
|
|
25
26
|
// @TODO throw errors if health check requests fail, to log them in the Synchronizer
|
|
@@ -32,7 +33,7 @@ function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
32
33
|
return splitHttpClient(url).then(function () { return true; }).catch(function () { return false; });
|
|
33
34
|
},
|
|
34
35
|
fetchAuth: function (userMatchingKeys) {
|
|
35
|
-
var url = urls.auth + "/v2/auth?s=" +
|
|
36
|
+
var url = urls.auth + "/v2/auth?s=" + flagSpecVersion;
|
|
36
37
|
if (userMatchingKeys) { // `userMatchingKeys` is undefined in server-side
|
|
37
38
|
var queryParams = userMatchingKeys.map(userKeyToQueryParam).join('&');
|
|
38
39
|
if (queryParams)
|
|
@@ -41,7 +42,7 @@ function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
41
42
|
return splitHttpClient(url, undefined, telemetryTracker.trackHttp(constants_1.TOKEN));
|
|
42
43
|
},
|
|
43
44
|
fetchSplitChanges: function (since, noCache, till) {
|
|
44
|
-
var url = urls.sdk + "/splitChanges?s=" +
|
|
45
|
+
var url = urls.sdk + "/splitChanges?s=" + flagSpecVersion + "&since=" + since + (filterQueryString || '') + (till ? '&till=' + till : '');
|
|
45
46
|
return splitHttpClient(url, noCache ? noCacheHeaderOptions : undefined, telemetryTracker.trackHttp(constants_1.SPLITS))
|
|
46
47
|
.catch(function (err) {
|
|
47
48
|
if (err.statusCode === 414)
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getStorageHash = exports.KeyBuilder = exports.validatePrefix = void 0;
|
|
4
|
-
var constants_1 = require("../utils/constants");
|
|
5
4
|
var lang_1 = require("../utils/lang");
|
|
6
5
|
var murmur3_1 = require("../utils/murmur3/murmur3");
|
|
7
6
|
var everythingAtTheEnd = /[^.]+$/;
|
|
@@ -71,6 +70,6 @@ exports.KeyBuilder = KeyBuilder;
|
|
|
71
70
|
* The hash is in hexadecimal format (8 characters max, 32 bits).
|
|
72
71
|
*/
|
|
73
72
|
function getStorageHash(settings) {
|
|
74
|
-
return (0, murmur3_1.hash)(settings.core.authorizationKey + "::" + settings.sync.__splitFiltersValidation.queryString + "::" +
|
|
73
|
+
return (0, murmur3_1.hash)(settings.core.authorizationKey + "::" + settings.sync.__splitFiltersValidation.queryString + "::" + settings.sync.flagSpecVersion).toString(16);
|
|
75
74
|
}
|
|
76
75
|
exports.getStorageHash = getStorageHash;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SSEClient = void 0;
|
|
4
4
|
var lang_1 = require("../../../utils/lang");
|
|
5
|
-
var
|
|
5
|
+
var ABLY_API_VERSION = '1.1';
|
|
6
6
|
var CONTROL_CHANNEL_REGEX = /^control_/;
|
|
7
7
|
/**
|
|
8
8
|
* Build metadata headers for SSE connection.
|
|
@@ -60,7 +60,7 @@ var SSEClient = /** @class */ (function () {
|
|
|
60
60
|
var params = CONTROL_CHANNEL_REGEX.test(channel) ? '[?occupancy=metrics.publishers]' : '';
|
|
61
61
|
return encodeURIComponent(params + channel);
|
|
62
62
|
}).join(',');
|
|
63
|
-
var url = this.streamingUrl + "?channels=" + channelsQueryParam + "&accessToken=" + authToken.token + "&v=" +
|
|
63
|
+
var url = this.streamingUrl + "?channels=" + channelsQueryParam + "&accessToken=" + authToken.token + "&v=" + ABLY_API_VERSION + "&heartbeats=true"; // same results using `&heartbeats=false`
|
|
64
64
|
this.connection = new this.eventSource(
|
|
65
65
|
// For client-side SDKs, SplitSDKClientKey and SplitSDKClientKey metadata is passed as query params,
|
|
66
66
|
// because native EventSource implementations for browser doesn't support headers.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MY_SEGMENT = exports.SEGMENT = exports.TOKEN = exports.TELEMETRY = exports.EVENTS = exports.IMPRESSIONS_COUNT = exports.IMPRESSIONS = exports.SPLITS = exports.NONE_ENUM = exports.DEBUG_ENUM = exports.OPTIMIZED_ENUM = exports.CONSUMER_PARTIAL_ENUM = exports.CONSUMER_ENUM = exports.STANDALONE_ENUM = exports.DEDUPED = exports.DROPPED = exports.QUEUED = exports.NAMES_FN_LABEL = exports.SPLITS_FN_LABEL = exports.SPLIT_FN_LABEL = exports.TRACK_FN_LABEL = exports.GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SETS = exports.GET_TREATMENTS_WITH_CONFIG_BY_FLAG_SET = exports.GET_TREATMENTS_BY_FLAG_SETS = exports.GET_TREATMENTS_BY_FLAG_SET = exports.GET_TREATMENTS_WITH_CONFIG = exports.GET_TREATMENT_WITH_CONFIG = exports.GET_TREATMENTS = exports.GET_TREATMENT = exports.CONSENT_UNKNOWN = exports.CONSENT_DECLINED = exports.CONSENT_GRANTED = exports.STORAGE_PLUGGABLE = exports.STORAGE_REDIS = exports.STORAGE_LOCALSTORAGE = exports.STORAGE_MEMORY = exports.CONSUMER_PARTIAL_MODE = exports.CONSUMER_MODE = exports.PRODUCER_MODE = exports.STANDALONE_MODE = exports.LOCALHOST_MODE = exports.NONE = exports.OPTIMIZED = exports.DEBUG = exports.SPLIT_EVENT = exports.SPLIT_IMPRESSION = exports.NA = exports.UNKNOWN = exports.CONTROL_WITH_CONFIG = exports.CONTROL = void 0;
|
|
4
|
-
exports.
|
|
4
|
+
exports.FLAG_SPEC_VERSION = exports.PAUSED = exports.ENABLED = exports.DISABLED = exports.NON_REQUESTED = exports.REQUESTED = exports.POLLING = exports.STREAMING = exports.AUTH_REJECTION = exports.SYNC_MODE_UPDATE = exports.ABLY_ERROR = exports.TOKEN_REFRESH = exports.SSE_CONNECTION_ERROR = exports.STREAMING_STATUS = exports.OCCUPANCY_SEC = exports.OCCUPANCY_PRI = exports.CONNECTION_ESTABLISHED = exports.TRACK = exports.TREATMENTS_WITH_CONFIG_BY_FLAGSETS = exports.TREATMENTS_WITH_CONFIG_BY_FLAGSET = exports.TREATMENTS_BY_FLAGSETS = exports.TREATMENTS_BY_FLAGSET = exports.TREATMENTS_WITH_CONFIG = exports.TREATMENT_WITH_CONFIG = exports.TREATMENTS = exports.TREATMENT = void 0;
|
|
5
5
|
// Special treatments
|
|
6
6
|
exports.CONTROL = 'control';
|
|
7
7
|
exports.CONTROL_WITH_CONFIG = {
|
|
@@ -90,4 +90,4 @@ exports.NON_REQUESTED = 1;
|
|
|
90
90
|
exports.DISABLED = 0;
|
|
91
91
|
exports.ENABLED = 1;
|
|
92
92
|
exports.PAUSED = 2;
|
|
93
|
-
exports.
|
|
93
|
+
exports.FLAG_SPEC_VERSION = '1.1';
|
|
@@ -74,7 +74,8 @@ exports.base = {
|
|
|
74
74
|
// impressions collection mode
|
|
75
75
|
impressionsMode: constants_1.OPTIMIZED,
|
|
76
76
|
localhostMode: undefined,
|
|
77
|
-
enabled: true
|
|
77
|
+
enabled: true,
|
|
78
|
+
flagSpecVersion: constants_1.FLAG_SPEC_VERSION
|
|
78
79
|
},
|
|
79
80
|
// Logger
|
|
80
81
|
log: undefined
|
|
@@ -90,7 +91,7 @@ function fromSecondsToMillis(n) {
|
|
|
90
91
|
* @param validationParams defaults and fields validators used to validate and creates a settings object from a given config
|
|
91
92
|
*/
|
|
92
93
|
function settingsValidation(config, validationParams) {
|
|
93
|
-
var defaults = validationParams.defaults, runtime = validationParams.runtime, storage = validationParams.storage, integrations = validationParams.integrations, logger = validationParams.logger, localhost = validationParams.localhost, consent = validationParams.consent;
|
|
94
|
+
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;
|
|
94
95
|
// creates a settings object merging base, defaults and config objects.
|
|
95
96
|
var withDefaults = (0, lang_1.merge)({}, exports.base, defaults, config);
|
|
96
97
|
// ensure a valid logger.
|
|
@@ -98,7 +99,8 @@ function settingsValidation(config, validationParams) {
|
|
|
98
99
|
var log = logger(withDefaults); // @ts-ignore, modify readonly prop
|
|
99
100
|
withDefaults.log = log;
|
|
100
101
|
// ensure a valid impressionsMode
|
|
101
|
-
|
|
102
|
+
var sync = withDefaults.sync;
|
|
103
|
+
sync.impressionsMode = (0, impressionsMode_1.validImpressionsMode)(log, sync.impressionsMode);
|
|
102
104
|
function validateMinValue(paramName, actualValue, minValue) {
|
|
103
105
|
if (actualValue >= minValue)
|
|
104
106
|
return actualValue;
|
|
@@ -114,7 +116,7 @@ function settingsValidation(config, validationParams) {
|
|
|
114
116
|
scheduler.eventsPushRate = fromSecondsToMillis(scheduler.eventsPushRate);
|
|
115
117
|
scheduler.telemetryRefreshRate = fromSecondsToMillis(validateMinValue('telemetryRefreshRate', scheduler.telemetryRefreshRate, 60));
|
|
116
118
|
// Default impressionsRefreshRate for DEBUG mode is 60 secs
|
|
117
|
-
if ((0, lang_1.get)(config, 'scheduler.impressionsRefreshRate') === undefined &&
|
|
119
|
+
if ((0, lang_1.get)(config, 'scheduler.impressionsRefreshRate') === undefined && sync.impressionsMode === constants_1.DEBUG)
|
|
118
120
|
scheduler.impressionsRefreshRate = 60;
|
|
119
121
|
scheduler.impressionsRefreshRate = fromSecondsToMillis(scheduler.impressionsRefreshRate);
|
|
120
122
|
// Log deprecation for old telemetry param
|
|
@@ -166,22 +168,23 @@ function settingsValidation(config, validationParams) {
|
|
|
166
168
|
if (integrations)
|
|
167
169
|
withDefaults.integrations = integrations(withDefaults);
|
|
168
170
|
if (localhost)
|
|
169
|
-
|
|
171
|
+
sync.localhostMode = localhost(withDefaults);
|
|
170
172
|
// validate push options
|
|
171
173
|
if (withDefaults.streamingEnabled !== false) { // @ts-ignore, modify readonly prop
|
|
172
174
|
withDefaults.streamingEnabled = true;
|
|
173
175
|
// Backoff bases.
|
|
174
|
-
// We are not checking if bases are positive numbers. Thus, we might be
|
|
176
|
+
// We are not checking if bases are positive numbers. Thus, we might be re-authenticating immediately (`setTimeout` with NaN or negative number)
|
|
175
177
|
scheduler.pushRetryBackoffBase = fromSecondsToMillis(scheduler.pushRetryBackoffBase);
|
|
176
178
|
}
|
|
177
179
|
// validate sync enabled
|
|
178
|
-
if (
|
|
179
|
-
|
|
180
|
+
if (sync.enabled !== false) {
|
|
181
|
+
sync.enabled = true;
|
|
180
182
|
}
|
|
181
183
|
// validate the `splitFilters` settings and parse splits query
|
|
182
|
-
var splitFiltersValidation = (0, splitFilters_1.validateSplitFilters)(log,
|
|
183
|
-
|
|
184
|
-
|
|
184
|
+
var splitFiltersValidation = (0, splitFilters_1.validateSplitFilters)(log, sync.splitFilters, withDefaults.mode);
|
|
185
|
+
sync.splitFilters = splitFiltersValidation.validFilters;
|
|
186
|
+
sync.__splitFiltersValidation = splitFiltersValidation;
|
|
187
|
+
sync.flagSpecVersion = flagSpec ? flagSpec(withDefaults) : constants_1.FLAG_SPEC_VERSION;
|
|
185
188
|
// ensure a valid user consent value
|
|
186
189
|
// @ts-ignore, modify readonly prop
|
|
187
190
|
withDefaults.userConsent = consent(withDefaults);
|