@raytio/core 9.0.3 → 10.1.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/CHANGELOG.md +161 -0
- package/README.md +77 -4
- package/dist/accessApplication/createAA.d.ts +17 -17
- package/dist/accessApplication/createAA.js +71 -71
- package/dist/accessApplication/index.d.ts +1 -1
- package/dist/accessApplication/index.js +17 -13
- package/dist/crypto/cognitoAttributes.d.ts +15 -15
- package/dist/crypto/cognitoAttributes.js +33 -33
- package/dist/crypto/decryptKeys.d.ts +1 -1
- package/dist/crypto/decryptKeys.js +33 -33
- package/dist/crypto/decryptSharedData.d.ts +26 -26
- package/dist/crypto/decryptSharedData.js +38 -38
- package/dist/crypto/getAADecryptor.d.ts +16 -11
- package/dist/crypto/getAADecryptor.js +20 -20
- package/dist/crypto/helpers.d.ts +18 -18
- package/dist/crypto/helpers.js +26 -26
- package/dist/crypto/index.d.ts +4 -4
- package/dist/crypto/index.js +21 -17
- package/dist/general/conditional.d.ts +17 -7
- package/dist/general/conditional.js +32 -22
- package/dist/general/date.d.ts +2 -0
- package/dist/general/date.js +18 -0
- package/dist/general/index.d.ts +4 -3
- package/dist/general/index.js +20 -15
- package/dist/general/password.d.ts +10 -8
- package/dist/general/password.js +31 -29
- package/dist/general/types.d.ts +6 -6
- package/dist/general/types.js +13 -13
- package/dist/index.d.ts +6 -6
- package/dist/index.js +22 -18
- package/dist/rules/calculateScore.d.ts +23 -11
- package/dist/rules/calculateScore.js +76 -52
- package/dist/rules/convertInstanceToRuleInput.d.ts +3 -3
- package/dist/rules/convertInstanceToRuleInput.js +139 -139
- package/dist/rules/evaluateScoreCondition.d.ts +2 -2
- package/dist/rules/evaluateScoreCondition.js +45 -45
- package/dist/rules/helpers/addInfiniteThresholdBoundaries.d.ts +8 -8
- package/dist/rules/helpers/addInfiniteThresholdBoundaries.js +11 -11
- package/dist/rules/helpers/checkTypeofValue.d.ts +9 -3
- package/dist/rules/helpers/checkTypeofValue.js +55 -43
- package/dist/rules/helpers/getLhsTypeofValue.d.ts +0 -0
- package/dist/rules/helpers/getLhsTypeofValue.js +1 -0
- package/dist/rules/helpers/getValueFromPath.d.ts +2 -0
- package/dist/rules/helpers/getValueFromPath.js +35 -0
- package/dist/rules/helpers/getValuesFromPath.d.ts +3 -3
- package/dist/rules/helpers/getValuesFromPath.js +50 -50
- package/dist/rules/helpers/index.d.ts +5 -5
- package/dist/rules/helpers/index.js +21 -17
- package/dist/rules/helpers/rebuildInfiniteValues.d.ts +3 -0
- package/dist/rules/helpers/rebuildInfiniteValues.js +6 -0
- package/dist/rules/helpers/symbols.d.ts +2 -2
- package/dist/rules/helpers/symbols.js +5 -5
- package/dist/rules/helpers/thresholds.d.ts +5 -5
- package/dist/rules/helpers/thresholds.js +47 -47
- package/dist/rules/index.d.ts +7 -6
- package/dist/rules/index.js +25 -20
- package/dist/rules/isScoreResultValid.d.ts +2 -0
- package/dist/rules/isScoreResultValid.js +9 -0
- package/dist/rules/operators/array.d.ts +2 -0
- package/dist/rules/operators/array.js +74 -0
- package/dist/rules/operators/bool.d.ts +2 -2
- package/dist/rules/operators/bool.js +17 -17
- package/dist/rules/operators/date.d.ts +2 -2
- package/dist/rules/operators/date.js +91 -91
- package/dist/rules/operators/hfield.d.ts +2 -2
- package/dist/rules/operators/hfield.js +33 -33
- package/dist/rules/operators/hschema.d.ts +2 -2
- package/dist/rules/operators/hschema.js +21 -21
- package/dist/rules/operators/index.d.ts +3 -3
- package/dist/rules/operators/index.js +11 -11
- package/dist/rules/operators/number.d.ts +2 -2
- package/dist/rules/operators/number.js +41 -41
- package/dist/rules/operators/string.d.ts +2 -2
- package/dist/rules/operators/string.js +58 -58
- package/dist/rules/types/config.d.ts +91 -86
- package/dist/rules/types/config.js +2 -2
- package/dist/rules/types/dataValueTypes.d.ts +19 -19
- package/dist/rules/types/dataValueTypes.js +4 -4
- package/dist/rules/types/index.d.ts +3 -3
- package/dist/rules/types/index.js +19 -15
- package/dist/rules/types/internal.d.ts +20 -20
- package/dist/rules/types/internal.js +2 -2
- package/dist/rules/types/operators.d.ts +19 -0
- package/dist/rules/types/operators.js +2 -0
- package/dist/rules/types/score.d.ts +50 -0
- package/dist/rules/types/score.js +2 -0
- package/dist/rules/validate.d.ts +6 -0
- package/dist/rules/validate.js +14 -0
- package/dist/rules/version.d.ts +1 -0
- package/dist/rules/version.js +5 -0
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.js +17 -13
- package/dist/schema/labels.d.ts +2 -2
- package/dist/schema/labels.js +20 -20
- package/dist/util/canonicalJsonify.d.ts +1 -1
- package/dist/util/canonicalJsonify.js +50 -50
- package/dist/util/conditional.d.ts +7 -0
- package/dist/util/conditional.js +15 -0
- package/dist/util/handleResponse.d.ts +1 -1
- package/dist/util/handleResponse.js +21 -21
- package/dist/util/hash.d.ts +1 -0
- package/dist/util/hash.js +11 -0
- package/dist/util/index.d.ts +2 -2
- package/dist/util/index.js +18 -14
- package/dist/verifications/checkSingleVerification.d.ts +9 -0
- package/dist/verifications/checkSingleVerification.js +29 -0
- package/dist/verifications/checkVerifications.d.ts +1 -0
- package/dist/verifications/checkVerifications.js +16 -0
- package/dist/verifications/checkVerificationsNew.d.ts +1 -0
- package/dist/verifications/checkVerificationsNew.js +16 -0
- package/dist/verifications/cleanInstance.d.ts +9 -9
- package/dist/verifications/cleanInstance.js +15 -15
- package/dist/verifications/getOwnRealVerifications.d.ts +14 -0
- package/dist/verifications/getOwnRealVerifications.js +64 -0
- package/dist/verifications/getPOVerification.d.ts +16 -16
- package/dist/verifications/getPOVerification.js +94 -94
- package/dist/verifications/getRealVerifications.d.ts +22 -0
- package/dist/verifications/getRealVerifications.js +71 -0
- package/dist/verifications/getVerifiedBy.d.ts +1 -1
- package/dist/verifications/getVerifiedBy.js +19 -19
- package/dist/verifications/index.d.ts +5 -5
- package/dist/verifications/index.js +21 -17
- package/dist/verifications/maybeRereference.d.ts +1 -1
- package/dist/verifications/maybeRereference.js +10 -10
- package/dist/verifications/safeHarbour.d.ts +20 -20
- package/dist/verifications/safeHarbour.js +74 -74
- package/dist/verifications/verifyCheck/getOwnRealVerifications.d.ts +13 -13
- package/dist/verifications/verifyCheck/getOwnRealVerifications.js +64 -63
- package/dist/verifications/verifyCheck/getSomeoneElsesRealVerifications.d.ts +19 -19
- package/dist/verifications/verifyCheck/getSomeoneElsesRealVerifications.js +72 -71
- package/dist/verifications/verifyCheck/index.d.ts +3 -3
- package/dist/verifications/verifyCheck/index.js +21 -17
- package/dist/verifications/verifyCheck/operations/checkOwnVerification.d.ts +15 -15
- package/dist/verifications/verifyCheck/operations/checkOwnVerification.js +39 -39
- package/dist/verifications/verifyCheck/operations/checkSomeoneElsesVerifications.d.ts +1 -1
- package/dist/verifications/verifyCheck/operations/checkSomeoneElsesVerifications.js +16 -16
- package/dist/verifications/verifyCheck/operations/index.d.ts +2 -2
- package/dist/verifications/verifyCheck/operations/index.js +18 -14
- package/dist/verifications/verifyCheck/util/canonicalJsonify.d.ts +1 -0
- package/dist/verifications/verifyCheck/util/canonicalJsonify.js +48 -0
- package/dist/verifications/verifyCheck/util/getValuesForAField.d.ts +2 -0
- package/dist/verifications/verifyCheck/util/getValuesForAField.js +9 -0
- package/dist/verifications/verifyCheck/util/index.d.ts +2 -0
- package/dist/verifications/verifyCheck/util/index.js +14 -0
- package/package.json +6 -5
package/dist/rules/index.js
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.scoreOperators = void 0;
|
|
18
|
+
__exportStar(require("./calculateScore"), exports);
|
|
19
|
+
__exportStar(require("./convertInstanceToRuleInput"), exports);
|
|
20
|
+
__exportStar(require("./validate"), exports);
|
|
21
|
+
__exportStar(require("./types/config"), exports);
|
|
22
|
+
__exportStar(require("./helpers/thresholds"), exports);
|
|
23
|
+
__exportStar(require("./helpers/addInfiniteThresholdBoundaries"), exports);
|
|
24
|
+
var operators_1 = require("./operators");
|
|
25
|
+
Object.defineProperty(exports, "scoreOperators", { enumerable: true, get: function () { return operators_1.operators; } });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isScoreResultValid = void 0;
|
|
4
|
+
/** @internal - separate function so that TS understands whats going on */
|
|
5
|
+
const isObjectLike = (x) => typeof x === "object" && !!x && "score" in x && "category" in x;
|
|
6
|
+
const isScoreResultValid = (x) => isObjectLike(x) &&
|
|
7
|
+
typeof x.category === "string" &&
|
|
8
|
+
typeof x.score === "number";
|
|
9
|
+
exports.isScoreResultValid = isScoreResultValid;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.arrayOperators = void 0;
|
|
4
|
+
exports.arrayOperators = {
|
|
5
|
+
// TODO: support these two
|
|
6
|
+
// "Array<T> containsItem T": {
|
|
7
|
+
// rhsFormat: " contains item {item}",
|
|
8
|
+
// operands: [
|
|
9
|
+
// { name: "array", type: "Array" },
|
|
10
|
+
// { name: "item", type: "*" },
|
|
11
|
+
// ],
|
|
12
|
+
// implementation<T>(array: T[], item: T) {
|
|
13
|
+
// return array.includes(item);
|
|
14
|
+
// },
|
|
15
|
+
// },
|
|
16
|
+
// "Array<T> doesNotContainItem T": {
|
|
17
|
+
// rhsFormat: " does not contain item {item}",
|
|
18
|
+
// operands: [
|
|
19
|
+
// { name: "array", type: "Array" },
|
|
20
|
+
// { name: "item", type: "*" },
|
|
21
|
+
// ],
|
|
22
|
+
// implementation<T>(array: T[], item: T) {
|
|
23
|
+
// return !array.includes(item);
|
|
24
|
+
// },
|
|
25
|
+
// },
|
|
26
|
+
"Array length== Number": {
|
|
27
|
+
rhsFormat: " length == {num}",
|
|
28
|
+
operands: [
|
|
29
|
+
{ name: "str", type: "Array" },
|
|
30
|
+
{ name: "num", type: "Number" },
|
|
31
|
+
],
|
|
32
|
+
implementation: (arr, num) => arr.length === num,
|
|
33
|
+
},
|
|
34
|
+
"Array length!= Number": {
|
|
35
|
+
rhsFormat: " length != {num}",
|
|
36
|
+
operands: [
|
|
37
|
+
{ name: "str", type: "Array" },
|
|
38
|
+
{ name: "num", type: "Number" },
|
|
39
|
+
],
|
|
40
|
+
implementation: (arr, num) => arr.length !== num,
|
|
41
|
+
},
|
|
42
|
+
"Array length>= Number": {
|
|
43
|
+
rhsFormat: " length >= {num}",
|
|
44
|
+
operands: [
|
|
45
|
+
{ name: "str", type: "Array" },
|
|
46
|
+
{ name: "num", type: "Number" },
|
|
47
|
+
],
|
|
48
|
+
implementation: (arr, num) => arr.length >= num,
|
|
49
|
+
},
|
|
50
|
+
"Array length<= Number": {
|
|
51
|
+
rhsFormat: " length <= {num}",
|
|
52
|
+
operands: [
|
|
53
|
+
{ name: "str", type: "Array" },
|
|
54
|
+
{ name: "num", type: "Number" },
|
|
55
|
+
],
|
|
56
|
+
implementation: (arr, num) => arr.length <= num,
|
|
57
|
+
},
|
|
58
|
+
"Array length< Number": {
|
|
59
|
+
rhsFormat: " length < {num}",
|
|
60
|
+
operands: [
|
|
61
|
+
{ name: "str", type: "Array" },
|
|
62
|
+
{ name: "num", type: "Number" },
|
|
63
|
+
],
|
|
64
|
+
implementation: (arr, num) => arr.length < num,
|
|
65
|
+
},
|
|
66
|
+
"Array length> Number": {
|
|
67
|
+
rhsFormat: " length > {num}",
|
|
68
|
+
operands: [
|
|
69
|
+
{ name: "str", type: "Array" },
|
|
70
|
+
{ name: "num", type: "Number" },
|
|
71
|
+
],
|
|
72
|
+
implementation: (arr, num) => arr.length > num,
|
|
73
|
+
},
|
|
74
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { OperatorID, OperatorDef } from "../types";
|
|
2
|
-
export declare const boolOperators: Partial<Record<OperatorID, OperatorDef>>;
|
|
1
|
+
import { OperatorID, OperatorDef } from "../types";
|
|
2
|
+
export declare const boolOperators: Partial<Record<OperatorID, OperatorDef>>;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.boolOperators = void 0;
|
|
4
|
-
exports.boolOperators = {
|
|
5
|
-
bool_eq: {
|
|
6
|
-
operands: ["Bool", "Bool"],
|
|
7
|
-
implementation(b1, b2) {
|
|
8
|
-
return b1 === b2;
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
bool_neq: {
|
|
12
|
-
operands: ["Bool", "Bool"],
|
|
13
|
-
implementation(b1, b2) {
|
|
14
|
-
return b1 !== b2;
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.boolOperators = void 0;
|
|
4
|
+
exports.boolOperators = {
|
|
5
|
+
bool_eq: {
|
|
6
|
+
operands: ["Bool", "Bool"],
|
|
7
|
+
implementation(b1, b2) {
|
|
8
|
+
return b1 === b2;
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
bool_neq: {
|
|
12
|
+
operands: ["Bool", "Bool"],
|
|
13
|
+
implementation(b1, b2) {
|
|
14
|
+
return b1 !== b2;
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { OperatorID, OperatorDef } from "../types";
|
|
2
|
-
export declare const dateOperators: Partial<Record<OperatorID, OperatorDef>>;
|
|
1
|
+
import { OperatorID, OperatorDef } from "../types";
|
|
2
|
+
export declare const dateOperators: Partial<Record<OperatorID, OperatorDef>>;
|
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dateOperators = void 0;
|
|
4
|
-
function getDateInXUnits(offset, unit) {
|
|
5
|
-
const d = new Date();
|
|
6
|
-
switch (unit) {
|
|
7
|
-
case "ms":
|
|
8
|
-
d.setMilliseconds(d.getMilliseconds() + offset);
|
|
9
|
-
break;
|
|
10
|
-
case "s":
|
|
11
|
-
d.setSeconds(d.getSeconds() + offset);
|
|
12
|
-
break;
|
|
13
|
-
case "m":
|
|
14
|
-
d.setMinutes(d.getMinutes() + offset);
|
|
15
|
-
break;
|
|
16
|
-
case "h":
|
|
17
|
-
d.setHours(d.getHours() + offset);
|
|
18
|
-
break;
|
|
19
|
-
case "D":
|
|
20
|
-
d.setDate(d.getDate() + offset);
|
|
21
|
-
break;
|
|
22
|
-
case "M":
|
|
23
|
-
d.setMonth(d.getMonth() + offset);
|
|
24
|
-
break;
|
|
25
|
-
case "W":
|
|
26
|
-
d.setDate(d.getDate() + 7 * offset);
|
|
27
|
-
break;
|
|
28
|
-
case "Y":
|
|
29
|
-
d.setFullYear(d.getFullYear() + offset);
|
|
30
|
-
break;
|
|
31
|
-
default:
|
|
32
|
-
throw new Error(`Invalid date unit: ${unit}`);
|
|
33
|
-
}
|
|
34
|
-
return d;
|
|
35
|
-
}
|
|
36
|
-
exports.dateOperators = {
|
|
37
|
-
date_eq: {
|
|
38
|
-
operands: ["Date", "Date"],
|
|
39
|
-
implementation(d1, d2) {
|
|
40
|
-
// only comaparing dates (not times), and in the UTC timezone.
|
|
41
|
-
const isoDate1 = d1.toISOString().split("T")[0];
|
|
42
|
-
const isoDate2 = d2.toISOString().split("T")[0];
|
|
43
|
-
return isoDate1 === isoDate2;
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
date_neq: {
|
|
47
|
-
operands: ["Date", "Date"],
|
|
48
|
-
implementation(d1, d2) {
|
|
49
|
-
// only comaparing dates (not times), and in the UTC timezone.
|
|
50
|
-
const isoDate1 = d1.toISOString().split("T")[0];
|
|
51
|
-
const isoDate2 = d2.toISOString().split("T")[0];
|
|
52
|
-
return isoDate1 !== isoDate2;
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
date_valid: {
|
|
56
|
-
operands: ["Date"],
|
|
57
|
-
implementation: (d) => !Number.isNaN(+d),
|
|
58
|
-
},
|
|
59
|
-
date_invalid: {
|
|
60
|
-
operands: ["Date"],
|
|
61
|
-
implementation: (d) => Number.isNaN(+d),
|
|
62
|
-
},
|
|
63
|
-
date_before: {
|
|
64
|
-
operands: ["Date", "Date"],
|
|
65
|
-
implementation: (d1, d2) => d1 < d2,
|
|
66
|
-
},
|
|
67
|
-
date_after: {
|
|
68
|
-
operands: ["Date", "Date"],
|
|
69
|
-
implementation: (d1, d2) => d1 > d2,
|
|
70
|
-
},
|
|
71
|
-
date_between: {
|
|
72
|
-
operands: ["Date", "Date", "Date"],
|
|
73
|
-
implementation(lhs, lower, upper) {
|
|
74
|
-
return lhs >= lower && lhs <= upper;
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
date_older_than: {
|
|
78
|
-
operands: ["Date", "Number", "DateUnit"],
|
|
79
|
-
implementation(date, num, unit) {
|
|
80
|
-
const XUnitsAgo = getDateInXUnits(-num, unit);
|
|
81
|
-
return date < XUnitsAgo;
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
date_newer_than: {
|
|
85
|
-
operands: ["Date", "Number", "DateUnit"],
|
|
86
|
-
implementation(date, num, unit) {
|
|
87
|
-
const inXUnits = getDateInXUnits(num, unit);
|
|
88
|
-
return date > inXUnits;
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dateOperators = void 0;
|
|
4
|
+
function getDateInXUnits(offset, unit) {
|
|
5
|
+
const d = new Date();
|
|
6
|
+
switch (unit) {
|
|
7
|
+
case "ms":
|
|
8
|
+
d.setMilliseconds(d.getMilliseconds() + offset);
|
|
9
|
+
break;
|
|
10
|
+
case "s":
|
|
11
|
+
d.setSeconds(d.getSeconds() + offset);
|
|
12
|
+
break;
|
|
13
|
+
case "m":
|
|
14
|
+
d.setMinutes(d.getMinutes() + offset);
|
|
15
|
+
break;
|
|
16
|
+
case "h":
|
|
17
|
+
d.setHours(d.getHours() + offset);
|
|
18
|
+
break;
|
|
19
|
+
case "D":
|
|
20
|
+
d.setDate(d.getDate() + offset);
|
|
21
|
+
break;
|
|
22
|
+
case "M":
|
|
23
|
+
d.setMonth(d.getMonth() + offset);
|
|
24
|
+
break;
|
|
25
|
+
case "W":
|
|
26
|
+
d.setDate(d.getDate() + 7 * offset);
|
|
27
|
+
break;
|
|
28
|
+
case "Y":
|
|
29
|
+
d.setFullYear(d.getFullYear() + offset);
|
|
30
|
+
break;
|
|
31
|
+
default:
|
|
32
|
+
throw new Error(`Invalid date unit: ${unit}`);
|
|
33
|
+
}
|
|
34
|
+
return d;
|
|
35
|
+
}
|
|
36
|
+
exports.dateOperators = {
|
|
37
|
+
date_eq: {
|
|
38
|
+
operands: ["Date", "Date"],
|
|
39
|
+
implementation(d1, d2) {
|
|
40
|
+
// only comaparing dates (not times), and in the UTC timezone.
|
|
41
|
+
const isoDate1 = d1.toISOString().split("T")[0];
|
|
42
|
+
const isoDate2 = d2.toISOString().split("T")[0];
|
|
43
|
+
return isoDate1 === isoDate2;
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
date_neq: {
|
|
47
|
+
operands: ["Date", "Date"],
|
|
48
|
+
implementation(d1, d2) {
|
|
49
|
+
// only comaparing dates (not times), and in the UTC timezone.
|
|
50
|
+
const isoDate1 = d1.toISOString().split("T")[0];
|
|
51
|
+
const isoDate2 = d2.toISOString().split("T")[0];
|
|
52
|
+
return isoDate1 !== isoDate2;
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
date_valid: {
|
|
56
|
+
operands: ["Date"],
|
|
57
|
+
implementation: (d) => !Number.isNaN(+d),
|
|
58
|
+
},
|
|
59
|
+
date_invalid: {
|
|
60
|
+
operands: ["Date"],
|
|
61
|
+
implementation: (d) => Number.isNaN(+d),
|
|
62
|
+
},
|
|
63
|
+
date_before: {
|
|
64
|
+
operands: ["Date", "Date"],
|
|
65
|
+
implementation: (d1, d2) => d1 < d2,
|
|
66
|
+
},
|
|
67
|
+
date_after: {
|
|
68
|
+
operands: ["Date", "Date"],
|
|
69
|
+
implementation: (d1, d2) => d1 > d2,
|
|
70
|
+
},
|
|
71
|
+
date_between: {
|
|
72
|
+
operands: ["Date", "Date", "Date"],
|
|
73
|
+
implementation(lhs, lower, upper) {
|
|
74
|
+
return lhs >= lower && lhs <= upper;
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
date_older_than: {
|
|
78
|
+
operands: ["Date", "Number", "DateUnit"],
|
|
79
|
+
implementation(date, num, unit) {
|
|
80
|
+
const XUnitsAgo = getDateInXUnits(-num, unit);
|
|
81
|
+
return date < XUnitsAgo;
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
date_newer_than: {
|
|
85
|
+
operands: ["Date", "Number", "DateUnit"],
|
|
86
|
+
implementation(date, num, unit) {
|
|
87
|
+
const inXUnits = getDateInXUnits(num, unit);
|
|
88
|
+
return date > inXUnits;
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { OperatorID, OperatorDef } from "../types";
|
|
2
|
-
export declare const fieldOperators: Partial<Record<OperatorID, OperatorDef>>;
|
|
1
|
+
import { OperatorID, OperatorDef } from "../types";
|
|
2
|
+
export declare const fieldOperators: Partial<Record<OperatorID, OperatorDef>>;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fieldOperators = void 0;
|
|
4
|
-
exports.fieldOperators = {
|
|
5
|
-
field_verifiedBy: {
|
|
6
|
-
operands: ["HField", "
|
|
7
|
-
implementation(field, verifiedBy) {
|
|
8
|
-
return field.verifiedBy.includes(verifiedBy);
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
field_shared: {
|
|
12
|
-
operands: ["HField"],
|
|
13
|
-
implementation: () => true, // we can return true, because if the field didn't exist, this would never be called
|
|
14
|
-
},
|
|
15
|
-
field_hasVerStatus: {
|
|
16
|
-
operands: ["HField", "FieldVerification"],
|
|
17
|
-
implementation(field, status) {
|
|
18
|
-
return field.verification === status;
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
field_cameFromSchema: {
|
|
22
|
-
operands: ["HField", "String"],
|
|
23
|
-
implementation(field, schemaName) {
|
|
24
|
-
return field.cameFromSchema === schemaName;
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
field_ncameFromSchema: {
|
|
28
|
-
operands: ["HField", "String"],
|
|
29
|
-
implementation(field, schemaName) {
|
|
30
|
-
return field.cameFromSchema !== schemaName;
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fieldOperators = void 0;
|
|
4
|
+
exports.fieldOperators = {
|
|
5
|
+
field_verifiedBy: {
|
|
6
|
+
operands: ["HField", "Verifier"],
|
|
7
|
+
implementation(field, verifiedBy) {
|
|
8
|
+
return field.verifiedBy.includes(verifiedBy);
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
field_shared: {
|
|
12
|
+
operands: ["HField"],
|
|
13
|
+
implementation: () => true, // we can return true, because if the field didn't exist, this would never be called
|
|
14
|
+
},
|
|
15
|
+
field_hasVerStatus: {
|
|
16
|
+
operands: ["HField", "FieldVerification"],
|
|
17
|
+
implementation(field, status) {
|
|
18
|
+
return field.verification === status;
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
field_cameFromSchema: {
|
|
22
|
+
operands: ["HField", "String"],
|
|
23
|
+
implementation(field, schemaName) {
|
|
24
|
+
return field.cameFromSchema === schemaName;
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
field_ncameFromSchema: {
|
|
28
|
+
operands: ["HField", "String"],
|
|
29
|
+
implementation(field, schemaName) {
|
|
30
|
+
return field.cameFromSchema !== schemaName;
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { OperatorID, OperatorDef } from "../types";
|
|
2
|
-
export declare const schemaOperators: Partial<Record<OperatorID, OperatorDef>>;
|
|
1
|
+
import { OperatorID, OperatorDef } from "../types";
|
|
2
|
+
export declare const schemaOperators: Partial<Record<OperatorID, OperatorDef>>;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.schemaOperators = void 0;
|
|
4
|
-
exports.schemaOperators = {
|
|
5
|
-
schema_verifiedBy: {
|
|
6
|
-
operands: ["HSchema", "
|
|
7
|
-
implementation(schema, verifiedBy) {
|
|
8
|
-
return schema === null || schema === void 0 ? void 0 : schema.verifiedBy.includes(verifiedBy);
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
schema_shared: {
|
|
12
|
-
operands: ["HSchema"],
|
|
13
|
-
implementation: () => true, // we can return true, because if the schema didn't exist, this would never be called
|
|
14
|
-
},
|
|
15
|
-
schema_hasVerStatus: {
|
|
16
|
-
operands: ["HSchema", "POVerification"],
|
|
17
|
-
implementation(schema, status) {
|
|
18
|
-
return (schema === null || schema === void 0 ? void 0 : schema.verification) === status;
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.schemaOperators = void 0;
|
|
4
|
+
exports.schemaOperators = {
|
|
5
|
+
schema_verifiedBy: {
|
|
6
|
+
operands: ["HSchema", "Verifier"],
|
|
7
|
+
implementation(schema, verifiedBy) {
|
|
8
|
+
return schema === null || schema === void 0 ? void 0 : schema.verifiedBy.includes(verifiedBy);
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
schema_shared: {
|
|
12
|
+
operands: ["HSchema"],
|
|
13
|
+
implementation: () => true, // we can return true, because if the schema didn't exist, this would never be called
|
|
14
|
+
},
|
|
15
|
+
schema_hasVerStatus: {
|
|
16
|
+
operands: ["HSchema", "POVerification"],
|
|
17
|
+
implementation(schema, status) {
|
|
18
|
+
return (schema === null || schema === void 0 ? void 0 : schema.verification) === status;
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { OperatorID, OperatorDef } from "../types";
|
|
2
|
-
/** @ignore */
|
|
3
|
-
export declare const operators: Record<OperatorID, OperatorDef>;
|
|
1
|
+
import { OperatorID, OperatorDef } from "../types";
|
|
2
|
+
/** @ignore */
|
|
3
|
+
export declare const operators: Record<OperatorID, OperatorDef>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.operators = void 0;
|
|
4
|
-
const bool_1 = require("./bool");
|
|
5
|
-
const date_1 = require("./date");
|
|
6
|
-
const hfield_1 = require("./hfield");
|
|
7
|
-
const hschema_1 = require("./hschema");
|
|
8
|
-
const number_1 = require("./number");
|
|
9
|
-
const string_1 = require("./string");
|
|
10
|
-
/** @ignore */
|
|
11
|
-
exports.operators = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, bool_1.boolOperators), date_1.dateOperators), hfield_1.fieldOperators), hschema_1.schemaOperators), number_1.numberOperators), string_1.stringOperators);
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.operators = void 0;
|
|
4
|
+
const bool_1 = require("./bool");
|
|
5
|
+
const date_1 = require("./date");
|
|
6
|
+
const hfield_1 = require("./hfield");
|
|
7
|
+
const hschema_1 = require("./hschema");
|
|
8
|
+
const number_1 = require("./number");
|
|
9
|
+
const string_1 = require("./string");
|
|
10
|
+
/** @ignore */
|
|
11
|
+
exports.operators = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, bool_1.boolOperators), date_1.dateOperators), hfield_1.fieldOperators), hschema_1.schemaOperators), number_1.numberOperators), string_1.stringOperators);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { OperatorID, OperatorDef } from "../types";
|
|
2
|
-
export declare const numberOperators: Partial<Record<OperatorID, OperatorDef>>;
|
|
1
|
+
import { OperatorID, OperatorDef } from "../types";
|
|
2
|
+
export declare const numberOperators: Partial<Record<OperatorID, OperatorDef>>;
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.numberOperators = void 0;
|
|
4
|
-
exports.numberOperators = {
|
|
5
|
-
num_eq: {
|
|
6
|
-
operands: ["Number", "Number"],
|
|
7
|
-
implementation(n1, n2) {
|
|
8
|
-
return n1 === n2;
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
num_neq: {
|
|
12
|
-
operands: ["Number", "Number"],
|
|
13
|
-
implementation(n1, n2) {
|
|
14
|
-
return n1 !== n2;
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
num_gt_eq: {
|
|
18
|
-
operands: ["Number", "Number"],
|
|
19
|
-
implementation(n1, n2) {
|
|
20
|
-
return n1 >= n2;
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
num_lt_eq: {
|
|
24
|
-
operands: ["Number", "Number"],
|
|
25
|
-
implementation(n1, n2) {
|
|
26
|
-
return n1 <= n2;
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
num_gt: {
|
|
30
|
-
operands: ["Number", "Number"],
|
|
31
|
-
implementation(n1, n2) {
|
|
32
|
-
return n1 > n2;
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
num_lt: {
|
|
36
|
-
operands: ["Number", "Number"],
|
|
37
|
-
implementation(n1, n2) {
|
|
38
|
-
return n1 < n2;
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.numberOperators = void 0;
|
|
4
|
+
exports.numberOperators = {
|
|
5
|
+
num_eq: {
|
|
6
|
+
operands: ["Number", "Number"],
|
|
7
|
+
implementation(n1, n2) {
|
|
8
|
+
return n1 === n2;
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
num_neq: {
|
|
12
|
+
operands: ["Number", "Number"],
|
|
13
|
+
implementation(n1, n2) {
|
|
14
|
+
return n1 !== n2;
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
num_gt_eq: {
|
|
18
|
+
operands: ["Number", "Number"],
|
|
19
|
+
implementation(n1, n2) {
|
|
20
|
+
return n1 >= n2;
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
num_lt_eq: {
|
|
24
|
+
operands: ["Number", "Number"],
|
|
25
|
+
implementation(n1, n2) {
|
|
26
|
+
return n1 <= n2;
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
num_gt: {
|
|
30
|
+
operands: ["Number", "Number"],
|
|
31
|
+
implementation(n1, n2) {
|
|
32
|
+
return n1 > n2;
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
num_lt: {
|
|
36
|
+
operands: ["Number", "Number"],
|
|
37
|
+
implementation(n1, n2) {
|
|
38
|
+
return n1 < n2;
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { OperatorID, OperatorDef } from "../types";
|
|
2
|
-
export declare const stringOperators: Partial<Record<OperatorID, OperatorDef>>;
|
|
1
|
+
import { OperatorID, OperatorDef } from "../types";
|
|
2
|
+
export declare const stringOperators: Partial<Record<OperatorID, OperatorDef>>;
|