@raytio/core 10.1.0 → 11.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 +10 -0
- package/README.md +198 -59
- package/dist/{util/hash.d.ts → __tests__/docs.test.d.ts} +1 -1
- package/dist/__tests__/docs.test.js +24 -0
- 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 -17
- 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 -16
- 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 -21
- package/dist/general/conditional.d.ts +17 -17
- package/dist/general/conditional.js +32 -32
- package/dist/general/date.d.ts +2 -2
- package/dist/general/date.js +18 -18
- package/dist/general/index.d.ts +4 -4
- package/dist/general/index.js +20 -20
- package/dist/general/password.d.ts +10 -10
- package/dist/general/password.js +31 -31
- 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 -22
- package/dist/rules/calculateScore.d.ts +28 -23
- package/dist/rules/calculateScore.js +82 -76
- package/dist/rules/convertInstanceToRuleInput.d.ts +3 -3
- package/dist/rules/convertInstanceToRuleInput.js +138 -139
- package/dist/rules/evaluateScoreCondition.d.ts +2 -2
- package/dist/rules/evaluateScoreCondition.js +44 -45
- package/dist/{verifications/checkVerifications.d.ts → rules/helpers/__tests__/addInfiniteThresholdBoundaries.test.d.ts} +1 -1
- package/dist/rules/helpers/__tests__/addInfiniteThresholdBoundaries.test.js +27 -0
- package/dist/{verifications/checkVerificationsNew.d.ts → rules/helpers/__tests__/checkTypeofValue.test.d.ts} +1 -1
- package/dist/rules/helpers/__tests__/checkTypeofValue.test.js +49 -0
- package/dist/{verifications/verifyCheck/util/canonicalJsonify.d.ts → rules/helpers/__tests__/getValuesFromPath.test.d.ts} +1 -1
- package/dist/rules/helpers/__tests__/getValuesFromPath.test.js +67 -0
- package/dist/rules/helpers/__tests__/thresholds.test.d.ts +1 -0
- package/dist/rules/helpers/__tests__/thresholds.test.js +32 -0
- 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 -9
- package/dist/rules/helpers/checkTypeofValue.js +60 -55
- 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 -21
- 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 +46 -47
- package/dist/rules/index.d.ts +7 -7
- package/dist/rules/index.js +25 -25
- package/dist/rules/operators/__tests__/bool.test.d.ts +1 -0
- package/dist/rules/operators/__tests__/bool.test.js +21 -0
- package/dist/rules/operators/__tests__/date.test.d.ts +1 -0
- package/dist/rules/operators/__tests__/date.test.js +81 -0
- package/dist/rules/operators/__tests__/hfield.test.d.ts +1 -0
- package/dist/rules/operators/__tests__/hfield.test.js +38 -0
- package/dist/rules/operators/__tests__/hschema.test.d.ts +1 -0
- package/dist/rules/operators/__tests__/hschema.test.js +24 -0
- package/dist/rules/operators/__tests__/number.test.d.ts +1 -0
- package/dist/rules/operators/__tests__/number.test.js +53 -0
- package/dist/rules/operators/__tests__/string.test.d.ts +1 -0
- package/dist/rules/operators/__tests__/string.test.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 +95 -91
- 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 -19
- package/dist/rules/types/internal.d.ts +20 -20
- package/dist/rules/types/internal.js +2 -2
- package/dist/rules/validate.d.ts +6 -6
- package/dist/rules/validate.js +14 -14
- package/dist/rules/version.d.ts +1 -1
- package/dist/rules/version.js +5 -5
- package/dist/schema/expandSchema/__tests__/addLoadingTimes.test.d.ts +1 -0
- package/dist/schema/expandSchema/__tests__/addLoadingTimes.test.js +24 -0
- package/dist/schema/expandSchema/__tests__/expandSchema.test.d.ts +1 -0
- package/dist/schema/expandSchema/__tests__/expandSchema.test.js +95 -0
- package/dist/schema/expandSchema/__tests__/i18n.test.d.ts +1 -0
- package/dist/schema/expandSchema/__tests__/i18n.test.js +32 -0
- package/dist/schema/expandSchema/__tests__/maybeUseI18n.test.d.ts +1 -0
- package/dist/schema/expandSchema/__tests__/maybeUseI18n.test.js +98 -0
- package/dist/schema/expandSchema/__tests__/processSchema.test.d.ts +1 -0
- package/dist/schema/expandSchema/__tests__/processSchema.test.js +326 -0
- package/dist/schema/expandSchema/__tests__/sortSchemaProperties.test.d.ts +1 -0
- package/dist/schema/expandSchema/__tests__/sortSchemaProperties.test.js +182 -0
- package/dist/schema/expandSchema/__tests__/util.test.d.ts +1 -0
- package/dist/schema/expandSchema/__tests__/util.test.js +19 -0
- package/dist/schema/expandSchema/addLoadingTimes.d.ts +2 -0
- package/dist/schema/expandSchema/addLoadingTimes.js +12 -0
- package/dist/schema/expandSchema/constants.d.ts +2 -0
- package/dist/schema/expandSchema/constants.js +11 -0
- package/dist/schema/expandSchema/expandSchema.d.ts +7 -0
- package/dist/schema/expandSchema/expandSchema.js +19 -0
- package/dist/schema/expandSchema/i18n.d.ts +5 -0
- package/dist/schema/expandSchema/i18n.js +20 -0
- package/dist/schema/expandSchema/index.d.ts +3 -0
- package/dist/schema/expandSchema/index.js +21 -0
- package/dist/schema/expandSchema/maybeUseI18n.d.ts +2 -0
- package/dist/schema/expandSchema/maybeUseI18n.js +40 -0
- package/dist/schema/expandSchema/processSchema.d.ts +4 -0
- package/dist/schema/expandSchema/processSchema.js +94 -0
- package/dist/schema/expandSchema/removePrivateFields.d.ts +119 -0
- package/dist/schema/expandSchema/removePrivateFields.js +15 -0
- package/dist/schema/expandSchema/sortSchemaProperties.d.ts +21 -0
- package/dist/schema/expandSchema/sortSchemaProperties.js +40 -0
- package/dist/schema/expandSchema/unwrapSchema.d.ts +6 -0
- package/dist/schema/expandSchema/unwrapSchema.js +7 -0
- package/dist/schema/expandSchema/util.d.ts +6 -0
- package/dist/schema/expandSchema/util.js +15 -0
- package/dist/schema/index.d.ts +2 -1
- package/dist/schema/index.js +18 -17
- 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/handleResponse.d.ts +1 -1
- package/dist/util/handleResponse.js +21 -21
- package/dist/util/index.d.ts +2 -2
- package/dist/util/index.js +18 -18
- package/dist/verifications/cleanInstance.d.ts +9 -9
- package/dist/verifications/cleanInstance.js +15 -15
- package/dist/verifications/getPOVerification.d.ts +19 -16
- package/dist/verifications/getPOVerification.js +105 -94
- 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 -21
- 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 +67 -74
- package/dist/verifications/verifyCheck/__tests__/getOwnRealVerifications.test.d.ts +1 -0
- package/dist/verifications/verifyCheck/__tests__/getOwnRealVerifications.test.js +152 -0
- package/dist/verifications/verifyCheck/__tests__/getSomeoneElsesRealVerifications.test.d.ts +1 -0
- package/dist/verifications/verifyCheck/__tests__/getSomeoneElsesRealVerifications.test.js +205 -0
- package/dist/verifications/verifyCheck/getOwnRealVerifications.d.ts +13 -13
- package/dist/verifications/verifyCheck/getOwnRealVerifications.js +66 -64
- package/dist/verifications/verifyCheck/getSomeoneElsesRealVerifications.d.ts +19 -19
- package/dist/verifications/verifyCheck/getSomeoneElsesRealVerifications.js +72 -72
- package/dist/verifications/verifyCheck/index.d.ts +3 -3
- package/dist/verifications/verifyCheck/index.js +21 -21
- package/dist/verifications/verifyCheck/operations/__tests__/checkOwnVerification.test.d.ts +1 -0
- package/dist/verifications/verifyCheck/operations/__tests__/checkOwnVerification.test.js +91 -0
- package/dist/verifications/verifyCheck/operations/__tests__/checkSomeoneElsesVerifications.test.d.ts +1 -0
- package/dist/verifications/verifyCheck/operations/__tests__/checkSomeoneElsesVerifications.test.js +49 -0
- package/dist/verifications/verifyCheck/operations/__tests__/sampleBundle.json +43 -0
- 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 -18
- package/package.json +13 -10
- package/dist/rules/helpers/getLhsTypeofValue.d.ts +0 -0
- package/dist/rules/helpers/getLhsTypeofValue.js +0 -1
- package/dist/rules/helpers/getValueFromPath.d.ts +0 -2
- package/dist/rules/helpers/getValueFromPath.js +0 -35
- package/dist/rules/helpers/rebuildInfiniteValues.d.ts +0 -3
- package/dist/rules/helpers/rebuildInfiniteValues.js +0 -6
- package/dist/rules/isScoreResultValid.d.ts +0 -2
- package/dist/rules/isScoreResultValid.js +0 -9
- package/dist/rules/operators/array.d.ts +0 -2
- package/dist/rules/operators/array.js +0 -74
- package/dist/rules/types/operators.d.ts +0 -19
- package/dist/rules/types/operators.js +0 -2
- package/dist/rules/types/score.d.ts +0 -50
- package/dist/rules/types/score.js +0 -2
- package/dist/util/conditional.d.ts +0 -7
- package/dist/util/conditional.js +0 -15
- package/dist/util/hash.js +0 -11
- package/dist/verifications/checkSingleVerification.d.ts +0 -9
- package/dist/verifications/checkSingleVerification.js +0 -29
- package/dist/verifications/checkVerifications.js +0 -16
- package/dist/verifications/checkVerificationsNew.js +0 -16
- package/dist/verifications/getOwnRealVerifications.d.ts +0 -14
- package/dist/verifications/getOwnRealVerifications.js +0 -64
- package/dist/verifications/getRealVerifications.d.ts +0 -22
- package/dist/verifications/getRealVerifications.js +0 -71
- package/dist/verifications/verifyCheck/util/canonicalJsonify.js +0 -48
- package/dist/verifications/verifyCheck/util/getValuesForAField.d.ts +0 -2
- package/dist/verifications/verifyCheck/util/getValuesForAField.js +0 -9
- package/dist/verifications/verifyCheck/util/index.d.ts +0 -2
- package/dist/verifications/verifyCheck/util/index.js +0 -14
package/dist/rules/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from "./calculateScore";
|
|
2
|
-
export * from "./convertInstanceToRuleInput";
|
|
3
|
-
export * from "./validate";
|
|
4
|
-
export * from "./types/config";
|
|
5
|
-
export * from "./helpers/thresholds";
|
|
6
|
-
export * from "./helpers/addInfiniteThresholdBoundaries";
|
|
7
|
-
export { operators as scoreOperators } from "./operators";
|
|
1
|
+
export * from "./calculateScore";
|
|
2
|
+
export * from "./convertInstanceToRuleInput";
|
|
3
|
+
export * from "./validate";
|
|
4
|
+
export * from "./types/config";
|
|
5
|
+
export * from "./helpers/thresholds";
|
|
6
|
+
export * from "./helpers/addInfiniteThresholdBoundaries";
|
|
7
|
+
export { operators as scoreOperators } from "./operators";
|
package/dist/rules/index.js
CHANGED
|
@@ -1,25 +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
|
-
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; } });
|
|
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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const bool_1 = require("../bool");
|
|
4
|
+
describe("boolOperators", () => {
|
|
5
|
+
it.each `
|
|
6
|
+
a | b | result
|
|
7
|
+
${true} | ${true} | ${true}
|
|
8
|
+
${false} | ${true} | ${false}
|
|
9
|
+
${false} | ${false} | ${true}
|
|
10
|
+
`("bool_eq $a, $b", ({ a, b, result }) => {
|
|
11
|
+
expect(bool_1.boolOperators.bool_eq.implementation(a, b)).toBe(result);
|
|
12
|
+
});
|
|
13
|
+
it.each `
|
|
14
|
+
a | b | result
|
|
15
|
+
${true} | ${true} | ${false}
|
|
16
|
+
${false} | ${true} | ${true}
|
|
17
|
+
${false} | ${false} | ${false}
|
|
18
|
+
`("bool_neq $a, $b", ({ a, b, result }) => {
|
|
19
|
+
expect(bool_1.boolOperators.bool_neq.implementation(a, b)).toBe(result);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const date_1 = require("../date");
|
|
4
|
+
describe("dateOperators", () => {
|
|
5
|
+
it.each `
|
|
6
|
+
a | b | result
|
|
7
|
+
${new Date("2001-06-06T01:00:00Z")} | ${new Date("2001-06-06T23:59:59Z")} | ${true}
|
|
8
|
+
${new Date("2001-02-02")} | ${new Date("2001-02-03")} | ${false}
|
|
9
|
+
`("date_eq $a, $b", ({ a, b, result }) => {
|
|
10
|
+
expect(date_1.dateOperators.date_eq.implementation(a, b)).toBe(result);
|
|
11
|
+
});
|
|
12
|
+
it.each `
|
|
13
|
+
a | b | result
|
|
14
|
+
${new Date("2001-06-06T01:00:00Z")} | ${new Date("2001-06-06T23:59:59Z")} | ${false}
|
|
15
|
+
${new Date("2001-02-02")} | ${new Date("2001-02-03")} | ${true}
|
|
16
|
+
`("date_neq $a, $b", ({ a, b, result }) => {
|
|
17
|
+
expect(date_1.dateOperators.date_neq.implementation(a, b)).toBe(result);
|
|
18
|
+
});
|
|
19
|
+
it.each `
|
|
20
|
+
a | result
|
|
21
|
+
${new Date("2001-01-01")} | ${true}
|
|
22
|
+
${new Date("bobs ur uncle")} | ${false}
|
|
23
|
+
`("date_valid $a", ({ a, result }) => {
|
|
24
|
+
expect(date_1.dateOperators.date_valid.implementation(a)).toBe(result);
|
|
25
|
+
});
|
|
26
|
+
it.each `
|
|
27
|
+
a | result
|
|
28
|
+
${new Date("2001-01-01")} | ${false}
|
|
29
|
+
${new Date("bobs ur uncle")} | ${true}
|
|
30
|
+
`("date_invalid $a", ({ a, result }) => {
|
|
31
|
+
expect(date_1.dateOperators.date_invalid.implementation(a)).toBe(result);
|
|
32
|
+
});
|
|
33
|
+
it.each `
|
|
34
|
+
a | b | result
|
|
35
|
+
${new Date("2001-02-02")} | ${new Date("2001-02-03")} | ${true}
|
|
36
|
+
${new Date("2001-01-01")} | ${new Date("1999-01-01")} | ${false}
|
|
37
|
+
`("date_before $a, $b", ({ a, b, result }) => {
|
|
38
|
+
expect(date_1.dateOperators.date_before.implementation(a, b)).toBe(result);
|
|
39
|
+
});
|
|
40
|
+
it.each `
|
|
41
|
+
a | b | result
|
|
42
|
+
${new Date("2001-02-02")} | ${new Date("2001-02-03")} | ${false}
|
|
43
|
+
${new Date("2001-01-01")} | ${new Date("1999-01-01")} | ${true}
|
|
44
|
+
`("date_after $a, $b", ({ a, b, result }) => {
|
|
45
|
+
expect(date_1.dateOperators.date_after.implementation(a, b)).toBe(result);
|
|
46
|
+
});
|
|
47
|
+
it.each `
|
|
48
|
+
a | b | c | result
|
|
49
|
+
${new Date("2001")} | ${new Date("2000")} | ${new Date("2002")} | ${true}
|
|
50
|
+
${new Date("2001")} | ${new Date("2005")} | ${new Date("2000")} | ${false}
|
|
51
|
+
${new Date("1900")} | ${new Date("1900")} | ${new Date("1900")} | ${true}
|
|
52
|
+
`("date_between $a, $b, $c", ({ a, b, c, result }) => {
|
|
53
|
+
expect(date_1.dateOperators.date_between.implementation(a, b, c)).toBe(result);
|
|
54
|
+
});
|
|
55
|
+
it.each `
|
|
56
|
+
date | num | units | result
|
|
57
|
+
${new Date("2010")} | ${10} | ${"Y"} | ${true}
|
|
58
|
+
${new Date("2010")} | ${20} | ${"Y"} | ${false}
|
|
59
|
+
${new Date("2030")} | ${1} | ${"Y"} | ${false}
|
|
60
|
+
${new Date()} | ${1} | ${"ms"} | ${true /* reminaing tests are just for 100% coverage */}
|
|
61
|
+
${new Date()} | ${1} | ${"s"} | ${false}
|
|
62
|
+
${new Date()} | ${1} | ${"m"} | ${false}
|
|
63
|
+
${new Date()} | ${1} | ${"h"} | ${false}
|
|
64
|
+
${new Date()} | ${1} | ${"D"} | ${false}
|
|
65
|
+
${new Date()} | ${1} | ${"W"} | ${false}
|
|
66
|
+
${new Date()} | ${1} | ${"M"} | ${false}
|
|
67
|
+
`("date_older_than $date, $num, $units", ({ date, num, units, result }) => {
|
|
68
|
+
expect(date_1.dateOperators.date_older_than.implementation(date, num, units)).toBe(result);
|
|
69
|
+
});
|
|
70
|
+
it("date_older_than (throws an error for an invalid DateUnit)", () => {
|
|
71
|
+
expect(() => date_1.dateOperators.date_older_than.implementation(new Date(), 6, "Quaters")).toThrow(new Error("Invalid date unit: Quaters"));
|
|
72
|
+
});
|
|
73
|
+
it.each `
|
|
74
|
+
date | num | units | result
|
|
75
|
+
${new Date("2030")} | ${1} | ${"Y"} | ${true}
|
|
76
|
+
${new Date("2030")} | ${10} | ${"Y"} | ${false}
|
|
77
|
+
${new Date()} | ${1} | ${"h"} | ${false}
|
|
78
|
+
`("date_newer_than $date, $num, $units", ({ date, num, units, result }) => {
|
|
79
|
+
expect(date_1.dateOperators.date_newer_than.implementation(date, num, units)).toBe(result);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const types_1 = require("@raytio/types");
|
|
4
|
+
const hfield_1 = require("../hfield");
|
|
5
|
+
describe("fieldOperators", () => {
|
|
6
|
+
it("field_shared", () => {
|
|
7
|
+
expect(hfield_1.fieldOperators.field_shared.implementation()).toBe(true);
|
|
8
|
+
});
|
|
9
|
+
it.each `
|
|
10
|
+
field | verifier | result
|
|
11
|
+
${{ verifiedBy: ["MoH"] }} | ${"MoH"} | ${true}
|
|
12
|
+
${{ verifiedBy: ["MinEdu"] }} | ${"Ministry of Health"} | ${false}
|
|
13
|
+
${{ verifiedBy: [] }} | ${"Ministry of Health"} | ${false}
|
|
14
|
+
`("field_verifiedBy {...}, $verifier", ({ field, verifier, result }) => {
|
|
15
|
+
expect(hfield_1.fieldOperators.field_verifiedBy.implementation(field, verifier)).toBe(result);
|
|
16
|
+
});
|
|
17
|
+
it.each `
|
|
18
|
+
field | value | result
|
|
19
|
+
${{ verification: types_1.FieldVerification.Verified }} | ${types_1.FieldVerification.Verified} | ${true}
|
|
20
|
+
${{ verification: types_1.FieldVerification.NotVerified }} | ${types_1.FieldVerification.Verified} | ${false}
|
|
21
|
+
`("field_hasVerStatus {...}, $value", ({ field, value, result }) => {
|
|
22
|
+
expect(hfield_1.fieldOperators.field_hasVerStatus.implementation(field, value)).toBe(result);
|
|
23
|
+
});
|
|
24
|
+
it.each `
|
|
25
|
+
field | value | result
|
|
26
|
+
${{ cameFromSchema: "ss_A" }} | ${"ss_A"} | ${true}
|
|
27
|
+
${{ cameFromSchema: "ss_A" }} | ${"ss_B"} | ${false}
|
|
28
|
+
`("field_cameFromSchema {...}, $value", ({ field, value, result }) => {
|
|
29
|
+
expect(hfield_1.fieldOperators.field_cameFromSchema.implementation(field, value)).toBe(result);
|
|
30
|
+
});
|
|
31
|
+
it.each `
|
|
32
|
+
field | value | result
|
|
33
|
+
${{ cameFromSchema: "ss_A" }} | ${"ss_A"} | ${false}
|
|
34
|
+
${{ cameFromSchema: "ss_A" }} | ${"ss_B"} | ${true}
|
|
35
|
+
`("field_ncameFromSchema {...}, $value", ({ field, value, result }) => {
|
|
36
|
+
expect(hfield_1.fieldOperators.field_ncameFromSchema.implementation(field, value)).toBe(result);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const types_1 = require("@raytio/types");
|
|
4
|
+
const hschema_1 = require("../hschema");
|
|
5
|
+
describe("schemaOperators", () => {
|
|
6
|
+
it("schema_shared", () => {
|
|
7
|
+
expect(hschema_1.schemaOperators.schema_shared.implementation()).toBe(true);
|
|
8
|
+
});
|
|
9
|
+
it.each `
|
|
10
|
+
field | verifier | result
|
|
11
|
+
${{ verifiedBy: ["MoH"] }} | ${"MoH"} | ${true}
|
|
12
|
+
${{ verifiedBy: ["MinEdu"] }} | ${"Ministry of Health"} | ${false}
|
|
13
|
+
${{ verifiedBy: [] }} | ${"Ministry of Health"} | ${false}
|
|
14
|
+
`("schema_verifiedBy {...}, $verifier", ({ field, verifier, result }) => {
|
|
15
|
+
expect(hschema_1.schemaOperators.schema_verifiedBy.implementation(field, verifier)).toBe(result);
|
|
16
|
+
});
|
|
17
|
+
it.each `
|
|
18
|
+
field | value | result
|
|
19
|
+
${{ verification: types_1.POVerification.FullyVerified }} | ${types_1.POVerification.FullyVerified} | ${true}
|
|
20
|
+
${{ verification: types_1.POVerification.NotVerified }} | ${types_1.POVerification.FullyVerified} | ${false}
|
|
21
|
+
`("schema_hasVerStatus {...}, $value", ({ field, value, result }) => {
|
|
22
|
+
expect(hschema_1.schemaOperators.schema_hasVerStatus.implementation(field, value)).toBe(result);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const number_1 = require("../number");
|
|
4
|
+
describe("numberOperators", () => {
|
|
5
|
+
it.each `
|
|
6
|
+
a | b | result
|
|
7
|
+
${1} | ${1} | ${true}
|
|
8
|
+
${1} | ${2} | ${false}
|
|
9
|
+
${3.3333} | ${3.3333} | ${true}
|
|
10
|
+
`("num_eq $a, $b", ({ a, b, result }) => {
|
|
11
|
+
expect(number_1.numberOperators.num_eq.implementation(a, b)).toBe(result);
|
|
12
|
+
});
|
|
13
|
+
it.each `
|
|
14
|
+
a | b | result
|
|
15
|
+
${1} | ${1} | ${false}
|
|
16
|
+
${1} | ${2} | ${true}
|
|
17
|
+
${3.3333} | ${3.3333} | ${false}
|
|
18
|
+
`("num_neq $a, $b", ({ a, b, result }) => {
|
|
19
|
+
expect(number_1.numberOperators.num_neq.implementation(a, b)).toBe(result);
|
|
20
|
+
});
|
|
21
|
+
it.each `
|
|
22
|
+
a | b | result
|
|
23
|
+
${0} | ${1} | ${false}
|
|
24
|
+
${1} | ${1} | ${true}
|
|
25
|
+
${2} | ${1} | ${true}
|
|
26
|
+
`("num_gt_eq $a, $b", ({ a, b, result }) => {
|
|
27
|
+
expect(number_1.numberOperators.num_gt_eq.implementation(a, b)).toBe(result);
|
|
28
|
+
});
|
|
29
|
+
it.each `
|
|
30
|
+
a | b | result
|
|
31
|
+
${0} | ${1} | ${false}
|
|
32
|
+
${1} | ${1} | ${false}
|
|
33
|
+
${2} | ${1} | ${true}
|
|
34
|
+
`("num_gt $a, $b", ({ a, b, result }) => {
|
|
35
|
+
expect(number_1.numberOperators.num_gt.implementation(a, b)).toBe(result);
|
|
36
|
+
});
|
|
37
|
+
it.each `
|
|
38
|
+
a | b | result
|
|
39
|
+
${0} | ${1} | ${true}
|
|
40
|
+
${1} | ${1} | ${true}
|
|
41
|
+
${2} | ${1} | ${false}
|
|
42
|
+
`("num_lt_eq $a, $b", ({ a, b, result }) => {
|
|
43
|
+
expect(number_1.numberOperators.num_lt_eq.implementation(a, b)).toBe(result);
|
|
44
|
+
});
|
|
45
|
+
it.each `
|
|
46
|
+
a | b | result
|
|
47
|
+
${0} | ${1} | ${true}
|
|
48
|
+
${1} | ${1} | ${false}
|
|
49
|
+
${2} | ${1} | ${false}
|
|
50
|
+
`("num_lt $a, $b", ({ a, b, result }) => {
|
|
51
|
+
expect(number_1.numberOperators.num_lt.implementation(a, b)).toBe(result);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const string_1 = require("../string");
|
|
4
|
+
describe("stringOperators", () => {
|
|
5
|
+
it.each `
|
|
6
|
+
a | b | result
|
|
7
|
+
${"AA"} | ${"aa"} | ${true}
|
|
8
|
+
${"Aa"} | ${"Bb"} | ${false}
|
|
9
|
+
`("string_eq $a, $b", ({ a, b, result }) => {
|
|
10
|
+
expect(string_1.stringOperators.string_eq.implementation(a, b)).toBe(result);
|
|
11
|
+
});
|
|
12
|
+
it.each `
|
|
13
|
+
a | b | result
|
|
14
|
+
${"AA"} | ${"aa"} | ${false}
|
|
15
|
+
${"Aa"} | ${"Bb"} | ${true}
|
|
16
|
+
`("string_neq $a, $b", ({ a, b, result }) => {
|
|
17
|
+
expect(string_1.stringOperators.string_neq.implementation(a, b)).toBe(result);
|
|
18
|
+
});
|
|
19
|
+
it.each `
|
|
20
|
+
str | substr | result
|
|
21
|
+
${"alOOf"} | ${"oo"} | ${true}
|
|
22
|
+
${"Hello"} | ${""} | ${true}
|
|
23
|
+
${"Hello"} | ${"X"} | ${false}
|
|
24
|
+
`("string_contains $str, $substr", ({ str, substr, result }) => {
|
|
25
|
+
expect(string_1.stringOperators.string_contains.implementation(str, substr)).toBe(result);
|
|
26
|
+
});
|
|
27
|
+
it.each `
|
|
28
|
+
str | substr | result
|
|
29
|
+
${"alOOf"} | ${"oo"} | ${false}
|
|
30
|
+
${"Hello"} | ${""} | ${false}
|
|
31
|
+
${"Hello"} | ${"X"} | ${true}
|
|
32
|
+
`("string_ncontains $str, $substr", ({ str, substr, result }) => {
|
|
33
|
+
expect(string_1.stringOperators.string_ncontains.implementation(str, substr)).toBe(result);
|
|
34
|
+
});
|
|
35
|
+
it.each `
|
|
36
|
+
str | substr | result
|
|
37
|
+
${"alOOf"} | ${"alo"} | ${true}
|
|
38
|
+
${"Hello"} | ${""} | ${true}
|
|
39
|
+
${"Hello"} | ${"X"} | ${false}
|
|
40
|
+
`("string_startsWith $str, $substr", ({ str, substr, result }) => {
|
|
41
|
+
expect(string_1.stringOperators.string_startsWith.implementation(str, substr)).toBe(result);
|
|
42
|
+
});
|
|
43
|
+
it.each `
|
|
44
|
+
str | substr | result
|
|
45
|
+
${"alOOf"} | ${"alo"} | ${false}
|
|
46
|
+
${"Hello"} | ${""} | ${false}
|
|
47
|
+
${"Hello"} | ${"X"} | ${true}
|
|
48
|
+
`("string_nstartsWith $str, $substr", ({ str, substr, result }) => {
|
|
49
|
+
expect(string_1.stringOperators.string_nstartsWith.implementation(str, substr)).toBe(result);
|
|
50
|
+
});
|
|
51
|
+
it.each `
|
|
52
|
+
str | substr | result
|
|
53
|
+
${"alOOf"} | ${"oof"} | ${true}
|
|
54
|
+
${"Hello"} | ${""} | ${true}
|
|
55
|
+
${"Hello"} | ${"X"} | ${false}
|
|
56
|
+
`("string_endsWith $str, $substr", ({ str, substr, result }) => {
|
|
57
|
+
expect(string_1.stringOperators.string_endsWith.implementation(str, substr)).toBe(result);
|
|
58
|
+
});
|
|
59
|
+
it.each `
|
|
60
|
+
str | substr | result
|
|
61
|
+
${"alOOf"} | ${"oof"} | ${false}
|
|
62
|
+
${"Hello"} | ${""} | ${false}
|
|
63
|
+
${"Hello"} | ${"X"} | ${true}
|
|
64
|
+
`("string_nendsWith $str, $substr", ({ str, substr, result }) => {
|
|
65
|
+
expect(string_1.stringOperators.string_nendsWith.implementation(str, substr)).toBe(result);
|
|
66
|
+
});
|
|
67
|
+
it.each `
|
|
68
|
+
str | regex | result
|
|
69
|
+
${"Hello"} | ${/[^A-za-z]/} | ${false}
|
|
70
|
+
${"Hēllō"} | ${/[^A-za-z]/} | ${true}
|
|
71
|
+
`("string_regex $str, $regex", ({ str, regex, result }) => {
|
|
72
|
+
expect(string_1.stringOperators.string_regex.implementation(str, regex)).toBe(result);
|
|
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>>;
|