@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.
Files changed (145) hide show
  1. package/CHANGELOG.md +161 -0
  2. package/README.md +77 -4
  3. package/dist/accessApplication/createAA.d.ts +17 -17
  4. package/dist/accessApplication/createAA.js +71 -71
  5. package/dist/accessApplication/index.d.ts +1 -1
  6. package/dist/accessApplication/index.js +17 -13
  7. package/dist/crypto/cognitoAttributes.d.ts +15 -15
  8. package/dist/crypto/cognitoAttributes.js +33 -33
  9. package/dist/crypto/decryptKeys.d.ts +1 -1
  10. package/dist/crypto/decryptKeys.js +33 -33
  11. package/dist/crypto/decryptSharedData.d.ts +26 -26
  12. package/dist/crypto/decryptSharedData.js +38 -38
  13. package/dist/crypto/getAADecryptor.d.ts +16 -11
  14. package/dist/crypto/getAADecryptor.js +20 -20
  15. package/dist/crypto/helpers.d.ts +18 -18
  16. package/dist/crypto/helpers.js +26 -26
  17. package/dist/crypto/index.d.ts +4 -4
  18. package/dist/crypto/index.js +21 -17
  19. package/dist/general/conditional.d.ts +17 -7
  20. package/dist/general/conditional.js +32 -22
  21. package/dist/general/date.d.ts +2 -0
  22. package/dist/general/date.js +18 -0
  23. package/dist/general/index.d.ts +4 -3
  24. package/dist/general/index.js +20 -15
  25. package/dist/general/password.d.ts +10 -8
  26. package/dist/general/password.js +31 -29
  27. package/dist/general/types.d.ts +6 -6
  28. package/dist/general/types.js +13 -13
  29. package/dist/index.d.ts +6 -6
  30. package/dist/index.js +22 -18
  31. package/dist/rules/calculateScore.d.ts +23 -11
  32. package/dist/rules/calculateScore.js +76 -52
  33. package/dist/rules/convertInstanceToRuleInput.d.ts +3 -3
  34. package/dist/rules/convertInstanceToRuleInput.js +139 -139
  35. package/dist/rules/evaluateScoreCondition.d.ts +2 -2
  36. package/dist/rules/evaluateScoreCondition.js +45 -45
  37. package/dist/rules/helpers/addInfiniteThresholdBoundaries.d.ts +8 -8
  38. package/dist/rules/helpers/addInfiniteThresholdBoundaries.js +11 -11
  39. package/dist/rules/helpers/checkTypeofValue.d.ts +9 -3
  40. package/dist/rules/helpers/checkTypeofValue.js +55 -43
  41. package/dist/rules/helpers/getLhsTypeofValue.d.ts +0 -0
  42. package/dist/rules/helpers/getLhsTypeofValue.js +1 -0
  43. package/dist/rules/helpers/getValueFromPath.d.ts +2 -0
  44. package/dist/rules/helpers/getValueFromPath.js +35 -0
  45. package/dist/rules/helpers/getValuesFromPath.d.ts +3 -3
  46. package/dist/rules/helpers/getValuesFromPath.js +50 -50
  47. package/dist/rules/helpers/index.d.ts +5 -5
  48. package/dist/rules/helpers/index.js +21 -17
  49. package/dist/rules/helpers/rebuildInfiniteValues.d.ts +3 -0
  50. package/dist/rules/helpers/rebuildInfiniteValues.js +6 -0
  51. package/dist/rules/helpers/symbols.d.ts +2 -2
  52. package/dist/rules/helpers/symbols.js +5 -5
  53. package/dist/rules/helpers/thresholds.d.ts +5 -5
  54. package/dist/rules/helpers/thresholds.js +47 -47
  55. package/dist/rules/index.d.ts +7 -6
  56. package/dist/rules/index.js +25 -20
  57. package/dist/rules/isScoreResultValid.d.ts +2 -0
  58. package/dist/rules/isScoreResultValid.js +9 -0
  59. package/dist/rules/operators/array.d.ts +2 -0
  60. package/dist/rules/operators/array.js +74 -0
  61. package/dist/rules/operators/bool.d.ts +2 -2
  62. package/dist/rules/operators/bool.js +17 -17
  63. package/dist/rules/operators/date.d.ts +2 -2
  64. package/dist/rules/operators/date.js +91 -91
  65. package/dist/rules/operators/hfield.d.ts +2 -2
  66. package/dist/rules/operators/hfield.js +33 -33
  67. package/dist/rules/operators/hschema.d.ts +2 -2
  68. package/dist/rules/operators/hschema.js +21 -21
  69. package/dist/rules/operators/index.d.ts +3 -3
  70. package/dist/rules/operators/index.js +11 -11
  71. package/dist/rules/operators/number.d.ts +2 -2
  72. package/dist/rules/operators/number.js +41 -41
  73. package/dist/rules/operators/string.d.ts +2 -2
  74. package/dist/rules/operators/string.js +58 -58
  75. package/dist/rules/types/config.d.ts +91 -86
  76. package/dist/rules/types/config.js +2 -2
  77. package/dist/rules/types/dataValueTypes.d.ts +19 -19
  78. package/dist/rules/types/dataValueTypes.js +4 -4
  79. package/dist/rules/types/index.d.ts +3 -3
  80. package/dist/rules/types/index.js +19 -15
  81. package/dist/rules/types/internal.d.ts +20 -20
  82. package/dist/rules/types/internal.js +2 -2
  83. package/dist/rules/types/operators.d.ts +19 -0
  84. package/dist/rules/types/operators.js +2 -0
  85. package/dist/rules/types/score.d.ts +50 -0
  86. package/dist/rules/types/score.js +2 -0
  87. package/dist/rules/validate.d.ts +6 -0
  88. package/dist/rules/validate.js +14 -0
  89. package/dist/rules/version.d.ts +1 -0
  90. package/dist/rules/version.js +5 -0
  91. package/dist/schema/index.d.ts +1 -1
  92. package/dist/schema/index.js +17 -13
  93. package/dist/schema/labels.d.ts +2 -2
  94. package/dist/schema/labels.js +20 -20
  95. package/dist/util/canonicalJsonify.d.ts +1 -1
  96. package/dist/util/canonicalJsonify.js +50 -50
  97. package/dist/util/conditional.d.ts +7 -0
  98. package/dist/util/conditional.js +15 -0
  99. package/dist/util/handleResponse.d.ts +1 -1
  100. package/dist/util/handleResponse.js +21 -21
  101. package/dist/util/hash.d.ts +1 -0
  102. package/dist/util/hash.js +11 -0
  103. package/dist/util/index.d.ts +2 -2
  104. package/dist/util/index.js +18 -14
  105. package/dist/verifications/checkSingleVerification.d.ts +9 -0
  106. package/dist/verifications/checkSingleVerification.js +29 -0
  107. package/dist/verifications/checkVerifications.d.ts +1 -0
  108. package/dist/verifications/checkVerifications.js +16 -0
  109. package/dist/verifications/checkVerificationsNew.d.ts +1 -0
  110. package/dist/verifications/checkVerificationsNew.js +16 -0
  111. package/dist/verifications/cleanInstance.d.ts +9 -9
  112. package/dist/verifications/cleanInstance.js +15 -15
  113. package/dist/verifications/getOwnRealVerifications.d.ts +14 -0
  114. package/dist/verifications/getOwnRealVerifications.js +64 -0
  115. package/dist/verifications/getPOVerification.d.ts +16 -16
  116. package/dist/verifications/getPOVerification.js +94 -94
  117. package/dist/verifications/getRealVerifications.d.ts +22 -0
  118. package/dist/verifications/getRealVerifications.js +71 -0
  119. package/dist/verifications/getVerifiedBy.d.ts +1 -1
  120. package/dist/verifications/getVerifiedBy.js +19 -19
  121. package/dist/verifications/index.d.ts +5 -5
  122. package/dist/verifications/index.js +21 -17
  123. package/dist/verifications/maybeRereference.d.ts +1 -1
  124. package/dist/verifications/maybeRereference.js +10 -10
  125. package/dist/verifications/safeHarbour.d.ts +20 -20
  126. package/dist/verifications/safeHarbour.js +74 -74
  127. package/dist/verifications/verifyCheck/getOwnRealVerifications.d.ts +13 -13
  128. package/dist/verifications/verifyCheck/getOwnRealVerifications.js +64 -63
  129. package/dist/verifications/verifyCheck/getSomeoneElsesRealVerifications.d.ts +19 -19
  130. package/dist/verifications/verifyCheck/getSomeoneElsesRealVerifications.js +72 -71
  131. package/dist/verifications/verifyCheck/index.d.ts +3 -3
  132. package/dist/verifications/verifyCheck/index.js +21 -17
  133. package/dist/verifications/verifyCheck/operations/checkOwnVerification.d.ts +15 -15
  134. package/dist/verifications/verifyCheck/operations/checkOwnVerification.js +39 -39
  135. package/dist/verifications/verifyCheck/operations/checkSomeoneElsesVerifications.d.ts +1 -1
  136. package/dist/verifications/verifyCheck/operations/checkSomeoneElsesVerifications.js +16 -16
  137. package/dist/verifications/verifyCheck/operations/index.d.ts +2 -2
  138. package/dist/verifications/verifyCheck/operations/index.js +18 -14
  139. package/dist/verifications/verifyCheck/util/canonicalJsonify.d.ts +1 -0
  140. package/dist/verifications/verifyCheck/util/canonicalJsonify.js +48 -0
  141. package/dist/verifications/verifyCheck/util/getValuesForAField.d.ts +2 -0
  142. package/dist/verifications/verifyCheck/util/getValuesForAField.js +9 -0
  143. package/dist/verifications/verifyCheck/util/index.d.ts +2 -0
  144. package/dist/verifications/verifyCheck/util/index.js +14 -0
  145. package/package.json +6 -5
@@ -1,58 +1,58 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stringOperators = void 0;
4
- // also string operators are case-insensitive
5
- exports.stringOperators = {
6
- string_eq: {
7
- operands: ["String", "String"],
8
- implementation(s1, s2) {
9
- return s1.toLowerCase() === s2.toLowerCase();
10
- },
11
- },
12
- string_neq: {
13
- operands: ["String", "String"],
14
- implementation(s1, s2) {
15
- return s1.toLowerCase() !== s2.toLowerCase();
16
- },
17
- },
18
- string_contains: {
19
- operands: ["String", "String"],
20
- implementation(s1, s2) {
21
- return s1.toLowerCase().includes(s2.toLowerCase());
22
- },
23
- },
24
- string_ncontains: {
25
- operands: ["String", "String"],
26
- implementation(s1, s2) {
27
- return !s1.toLowerCase().includes(s2.toLowerCase());
28
- },
29
- },
30
- string_startsWith: {
31
- operands: ["String", "String"],
32
- implementation(s1, s2) {
33
- return s1.toLowerCase().startsWith(s2.toLowerCase());
34
- },
35
- },
36
- string_nstartsWith: {
37
- operands: ["String", "String"],
38
- implementation(s1, s2) {
39
- return !s1.toLowerCase().startsWith(s2.toLowerCase());
40
- },
41
- },
42
- string_endsWith: {
43
- operands: ["String", "String"],
44
- implementation(s1, s2) {
45
- return s1.toLowerCase().endsWith(s2.toLowerCase());
46
- },
47
- },
48
- string_nendsWith: {
49
- operands: ["String", "String"],
50
- implementation(s1, s2) {
51
- return !s1.toLowerCase().endsWith(s2.toLowerCase());
52
- },
53
- },
54
- string_regex: {
55
- operands: ["String", "RegEx"],
56
- implementation: (str, regEx) => !!str.match(regEx),
57
- },
58
- };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stringOperators = void 0;
4
+ // also string operators are case-insensitive
5
+ exports.stringOperators = {
6
+ string_eq: {
7
+ operands: ["String", "String"],
8
+ implementation(s1, s2) {
9
+ return s1.toLowerCase() === s2.toLowerCase();
10
+ },
11
+ },
12
+ string_neq: {
13
+ operands: ["String", "String"],
14
+ implementation(s1, s2) {
15
+ return s1.toLowerCase() !== s2.toLowerCase();
16
+ },
17
+ },
18
+ string_contains: {
19
+ operands: ["String", "String"],
20
+ implementation(s1, s2) {
21
+ return s1.toLowerCase().includes(s2.toLowerCase());
22
+ },
23
+ },
24
+ string_ncontains: {
25
+ operands: ["String", "String"],
26
+ implementation(s1, s2) {
27
+ return !s1.toLowerCase().includes(s2.toLowerCase());
28
+ },
29
+ },
30
+ string_startsWith: {
31
+ operands: ["String", "String"],
32
+ implementation(s1, s2) {
33
+ return s1.toLowerCase().startsWith(s2.toLowerCase());
34
+ },
35
+ },
36
+ string_nstartsWith: {
37
+ operands: ["String", "String"],
38
+ implementation(s1, s2) {
39
+ return !s1.toLowerCase().startsWith(s2.toLowerCase());
40
+ },
41
+ },
42
+ string_endsWith: {
43
+ operands: ["String", "String"],
44
+ implementation(s1, s2) {
45
+ return s1.toLowerCase().endsWith(s2.toLowerCase());
46
+ },
47
+ },
48
+ string_nendsWith: {
49
+ operands: ["String", "String"],
50
+ implementation(s1, s2) {
51
+ return !s1.toLowerCase().endsWith(s2.toLowerCase());
52
+ },
53
+ },
54
+ string_regex: {
55
+ operands: ["String", "RegEx"],
56
+ implementation: (str, regEx) => !!str.match(regEx),
57
+ },
58
+ };
@@ -1,86 +1,91 @@
1
- import { GetTSType } from "./dataValueTypes";
2
- /**
3
- * @ignore
4
- * these are just IDs, the string is never parsed by anything.
5
- *
6
- * However, since they're saved into the WizardConfig schema,
7
- * we can't just rename or remove any, since that would break
8
- * existing rules.
9
- */
10
- export declare type OperatorID = "bool_eq" | "bool_neq" | "num_eq" | "num_neq" | "num_lt_eq" | "num_gt_eq" | "num_lt" | "num_gt" | "date_valid" | "date_invalid" | "date_before" | "date_after" | "date_eq" | "date_neq" | "date_older_than" | "date_newer_than" | "date_between" | "string_eq" | "string_neq" | "string_contains" | "string_ncontains" | "string_startsWith" | "string_nstartsWith" | "string_endsWith" | "string_nendsWith" | "string_regex" | "field_verifiedBy" | "field_shared" | "field_hasVerStatus" | "field_cameFromSchema" | "field_ncameFromSchema" | "schema_verifiedBy" | "schema_shared" | "schema_hasVerStatus";
11
- /** @ignore */
12
- export declare type ValuePathFieldProp = "meta" | "value" | "valueLength" | `subField|${string}`;
13
- /** @ignore */
14
- export declare type ValuePath = [type: "schema", schemaName: string, prop: "meta"] | [
15
- type: "field",
16
- schemaName: string,
17
- fieldName: string,
18
- prop: ValuePathFieldProp
19
- ];
20
- /** @ignore */
21
- export declare type ValueRefConst<T> = {
22
- type: "constant";
23
- value: T;
24
- };
25
- /** @ignore */
26
- export declare type ValueRefVar = {
27
- type: "variable";
28
- path: ValuePath;
29
- };
30
- /** @ignore */
31
- export declare type ValueRef<T> = ValueRefConst<T> | ValueRefVar;
32
- /** @ignore these are the LHS & RHS operands which come from variables (or constants) */
33
- export declare type FieldValueTypes = "Bool" | "Number" | "String" | "Date" | "Array" | "HField" | "HSchema";
34
- /** @ignore these are the RHS-only operands which come from constants ONLY */
35
- export declare type ConstValueTypes = "DateUnit" | "RegEx" | "FieldVerification" | "POVerification";
36
- /** @ignore full list of operands which come from variables OR constants */
37
- export declare type ValueType = ConstValueTypes | FieldValueTypes;
38
- /** @ignore */
39
- export declare type ValueDef<T = ValueType> = {
40
- type: T;
41
- value: ValueRef<GetTSType<T>>;
42
- };
43
- /** @ignore */
44
- export declare type ASTScoreConditionNode = {
45
- type: "ScoreCondition";
46
- operator: OperatorID;
47
- values: ValueDef<ValueType>[];
48
- };
49
- /** @ignore */
50
- export declare type ASTLanguageOperatorNode = {
51
- type: "LanguageOperator";
52
- operator: "OR" | "AND";
53
- children: ASTNode[];
54
- };
55
- /** @ignore */
56
- export declare type ASTNode = ASTLanguageOperatorNode | ASTScoreConditionNode;
57
- /** @ignore */
58
- export declare type ScoreRule = {
59
- /** user defined */
60
- name: string;
61
- /** user defined */
62
- description?: string;
63
- /** must be an integer */
64
- trueWeight: number;
65
- /** must be an integer */
66
- falseWeight: number;
67
- /** must have a single root node */
68
- tree: [ASTNode];
69
- };
70
- /** @ignore e.g. 0-10 is "red". We only work with integers. Comparisons use >= and <= */
71
- export declare type ScoreThreshold = {
72
- from: number;
73
- to: number;
74
- name: string;
75
- };
76
- /** @ignore */
77
- export declare type Combinator = "+" | "*";
78
- /**
79
- * @ignore
80
- * the big object for configuring score rules
81
- */
82
- export declare type ScoreConfig = {
83
- combinator: Combinator;
84
- scoreThresholds: ScoreThreshold[];
85
- rules: ScoreRule[];
86
- };
1
+ import { GetTSType } from "./dataValueTypes";
2
+ /**
3
+ * @ignore
4
+ * these are just IDs, the string is never parsed by anything.
5
+ *
6
+ * However, since they're saved into the WizardConfig schema,
7
+ * we can't just rename or remove any, since that would break
8
+ * existing rules.
9
+ */
10
+ export declare type OperatorID = "bool_eq" | "bool_neq" | "num_eq" | "num_neq" | "num_lt_eq" | "num_gt_eq" | "num_lt" | "num_gt" | "date_valid" | "date_invalid" | "date_before" | "date_after" | "date_eq" | "date_neq" | "date_older_than" | "date_newer_than" | "date_between" | "string_eq" | "string_neq" | "string_contains" | "string_ncontains" | "string_startsWith" | "string_nstartsWith" | "string_endsWith" | "string_nendsWith" | "string_regex" | "field_verifiedBy" | "field_shared" | "field_hasVerStatus" | "field_cameFromSchema" | "field_ncameFromSchema" | "schema_verifiedBy" | "schema_shared" | "schema_hasVerStatus";
11
+ /** @ignore */
12
+ export declare type ValuePathFieldProp = "meta" | "value" | "valueLength" | `subField|${string}`;
13
+ /** @ignore */
14
+ export declare type ValuePath = [type: "schema", schemaName: string, prop: "meta"] | [
15
+ type: "field",
16
+ schemaName: string,
17
+ fieldName: string,
18
+ prop: ValuePathFieldProp
19
+ ];
20
+ /** @ignore */
21
+ export declare type ValueRefConst<T> = {
22
+ type: "constant";
23
+ value: T;
24
+ };
25
+ /** @ignore */
26
+ export declare type ValueRefVar = {
27
+ type: "variable";
28
+ path: ValuePath;
29
+ };
30
+ /** @ignore */
31
+ export declare type ValueRef<T> = ValueRefConst<T> | ValueRefVar;
32
+ /** @ignore these are the LHS & RHS operands which come from variables (or constants) */
33
+ export declare type FieldValueTypes = "Bool" | "Number" | "String" | "Date" | "Array" | "HField" | "HSchema";
34
+ /** @ignore these are the RHS-only operands which come from constants ONLY */
35
+ export declare type ConstValueTypes = "DateUnit" | "RegEx" | "Verifier" | "FieldVerification" | "POVerification";
36
+ /** @ignore full list of operands which come from variables OR constants */
37
+ export declare type ValueType = ConstValueTypes | FieldValueTypes;
38
+ /** @ignore */
39
+ export declare type ValueDef<T = ValueType> = {
40
+ type: T;
41
+ value: ValueRef<GetTSType<T>>;
42
+ };
43
+ /** @ignore */
44
+ export declare type ASTScoreConditionNode = {
45
+ type: "ScoreCondition";
46
+ operator: OperatorID;
47
+ values: ValueDef<ValueType>[];
48
+ };
49
+ /** @ignore */
50
+ export declare type ASTLanguageOperatorNode = {
51
+ type: "LanguageOperator";
52
+ operator: "OR" | "AND";
53
+ children: ASTNode[];
54
+ };
55
+ /** @ignore */
56
+ export declare type ASTNode = ASTLanguageOperatorNode | ASTScoreConditionNode;
57
+ /** @ignore */
58
+ export declare type ScoreRule = {
59
+ /** user defined */
60
+ name: string;
61
+ /** user defined */
62
+ description?: string;
63
+ /** must be an integer */
64
+ trueWeight: number;
65
+ /** must be an integer */
66
+ falseWeight: number;
67
+ /** must have a single root node */
68
+ tree: [ASTNode];
69
+ };
70
+ /** @ignore e.g. 0-10 is "red". We only work with integers. Comparisons use >= and <= */
71
+ export declare type ScoreThreshold = {
72
+ from: number;
73
+ to: number;
74
+ name: string;
75
+ /**
76
+ * A hex code, including the hash.
77
+ * For compatibility reasons we must assume it could be missing
78
+ */
79
+ colour: string | undefined;
80
+ };
81
+ /** @ignore */
82
+ export declare type Combinator = "+" | "*";
83
+ /**
84
+ * @ignore
85
+ * the big object for configuring score rules
86
+ */
87
+ export declare type ScoreConfig = {
88
+ combinator: Combinator;
89
+ scoreThresholds: ScoreThreshold[];
90
+ rules: ScoreRule[];
91
+ };
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,19 +1,19 @@
1
- import { FieldVerification, NId, POVerification } from "@raytio/types";
2
- import type { HFieldSymbol, HSchemaSymbol } from "../helpers";
3
- /** undefined if not shared */
4
- export declare type HField = {
5
- __typeof__: typeof HFieldSymbol;
6
- verification: FieldVerification;
7
- verifiedBy: readonly NId[];
8
- /** schemaName */
9
- cameFromSchema: string;
10
- };
11
- /** undefined if not shared */
12
- export declare type HSchema = {
13
- __typeof__: typeof HSchemaSymbol;
14
- verification?: POVerification;
15
- verifiedBy: readonly NId[];
16
- };
17
- export declare const DATE_UNITS: readonly ["ms", "s", "m", "h", "D", "M", "W", "Y"];
18
- export declare type DateUnit = typeof DATE_UNITS[number];
19
- export declare type GetTSType<T> = T extends "Bool" ? boolean : T extends "Number" ? number : T extends "String" ? string : T extends "Date" ? Date : T extends "Array" ? unknown[] : T extends "HField" ? HField : T extends "HSchema" ? HSchema : T extends "DateUnit" ? DateUnit : T extends "RegEx" ? RegExp : T extends "FieldVerification" ? FieldVerification : T extends "POVerification" ? POVerification : never;
1
+ import { FieldVerification, NId, POVerification } from "@raytio/types";
2
+ import type { HFieldSymbol, HSchemaSymbol } from "../helpers";
3
+ /** undefined if not shared */
4
+ export declare type HField = {
5
+ __typeof__: typeof HFieldSymbol;
6
+ verification: FieldVerification;
7
+ verifiedBy: readonly NId[];
8
+ /** schemaName */
9
+ cameFromSchema: string;
10
+ };
11
+ /** undefined if not shared */
12
+ export declare type HSchema = {
13
+ __typeof__: typeof HSchemaSymbol;
14
+ verification?: POVerification;
15
+ verifiedBy: readonly NId[];
16
+ };
17
+ export declare const DATE_UNITS: readonly ["ms", "s", "m", "h", "D", "M", "W", "Y"];
18
+ export declare type DateUnit = typeof DATE_UNITS[number];
19
+ export declare type GetTSType<T> = T extends "Bool" ? boolean : T extends "Number" ? number : T extends "String" ? string : T extends "Date" ? Date : T extends "Array" ? unknown[] : T extends "HField" ? HField : T extends "HSchema" ? HSchema : T extends "DateUnit" ? DateUnit : T extends "RegEx" ? RegExp : T extends "Verifier" ? NId : T extends "FieldVerification" ? FieldVerification : T extends "POVerification" ? POVerification : never;
@@ -1,4 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DATE_UNITS = void 0;
4
- exports.DATE_UNITS = ["ms", "s", "m", "h", "D", "M", "W", "Y"];
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DATE_UNITS = void 0;
4
+ exports.DATE_UNITS = ["ms", "s", "m", "h", "D", "M", "W", "Y"];
@@ -1,3 +1,3 @@
1
- export * from "./dataValueTypes";
2
- export * from "./config";
3
- export * from "./internal";
1
+ export * from "./dataValueTypes";
2
+ export * from "./config";
3
+ export * from "./internal";
@@ -1,15 +1,19 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./dataValueTypes"), exports);
14
- __exportStar(require("./config"), exports);
15
- __exportStar(require("./internal"), exports);
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
+ __exportStar(require("./dataValueTypes"), exports);
18
+ __exportStar(require("./config"), exports);
19
+ __exportStar(require("./internal"), exports);
@@ -1,20 +1,20 @@
1
- import { HField, HSchema, GetTSType } from "./dataValueTypes";
2
- import { FieldValueTypes, ValueType } from "./config";
3
- export declare type RuleDataProperty<T extends FieldValueTypes> = {
4
- type: T;
5
- value: GetTSType<T>;
6
- hField: HField;
7
- };
8
- export declare type RuleData = {
9
- [schemaName: string]: {
10
- hSchema: HSchema;
11
- properties: {
12
- [fieldName: string]: RuleDataProperty<FieldValueTypes>;
13
- };
14
- }[];
15
- };
16
- export declare type OperatorDef = {
17
- /** the first operand is the LHS, all others are RHS */
18
- operands: ValueType[];
19
- implementation: (...args: any[]) => boolean;
20
- };
1
+ import { HField, HSchema, GetTSType } from "./dataValueTypes";
2
+ import { FieldValueTypes, ValueType } from "./config";
3
+ export declare type RuleDataProperty<T extends FieldValueTypes> = {
4
+ type: T;
5
+ value: GetTSType<T>;
6
+ hField: HField;
7
+ };
8
+ export declare type RuleData = {
9
+ [schemaName: string]: {
10
+ hSchema: HSchema;
11
+ properties: {
12
+ [fieldName: string]: RuleDataProperty<FieldValueTypes>;
13
+ };
14
+ }[];
15
+ };
16
+ export declare type OperatorDef = {
17
+ /** the first operand is the LHS, all others are RHS */
18
+ operands: ValueType[];
19
+ implementation: (...args: any[]) => boolean;
20
+ };
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,19 @@
1
+ import { ValueType } from "./dataValueTypes";
2
+ /**
3
+ * these are just IDs, the string is never parsed by anything.
4
+ *
5
+ * However, since they're saved into the WizardConfig schema,
6
+ * we can't just rename or remove any, since that would break
7
+ * existing rules.
8
+ */
9
+ export declare type OperatorID = "Bool == Bool" | "Bool != Bool" | "Number == Number" | "Number != Number" | "Number <= Number" | "Number >= Number" | "Number < Number" | "Number > Number" | "Date isValid" | "Date isInvalid" | "Date isBefore Date" | "Date isAfter Date" | "Date == Date" | "Date != Date" | "Date isMoreThan Number DateUnits ago" | "Date isMoreThan Number DateUnits in the future" | "Date isBetween Date Date" | "String == String" | "String != String" | "String contains String" | "String doesNotContain String" | "String startsWith String" | "String doesNotStartWith String" | "String endsWith String" | "String doesNotEndWith String" | "String length== Number" | "String length!= Number" | "String length<= Number" | "String length>= Number" | "String length< Number" | "String length> Number" | "String mathches RegEx" | "Array<T> containsItem T" | "Array<T> doesNotContainItem T" | "Array length== Number" | "Array length!= Number" | "Array length<= Number" | "Array length>= Number" | "Array length< Number" | "Array length> Number" | "HField verifiedBy String" | "HField wasShared" | "HField wasNotShared" | "HField hasVerStatus FieldVerification" | "HField cameFromSchema String" | "HField didNotComeFromSchema String" | "HSchema verifiedBy String" | "HSchema wasShared" | "HSchema wasNotShared" | "HSchema hasVerStatus POVerification";
10
+ export declare type OperatorDef = {
11
+ /** string to format the display of the operator and RHS */
12
+ rhsFormat: string;
13
+ /** the first operand is the LHS, all others are RHS */
14
+ operands: {
15
+ type: ValueType;
16
+ name: string;
17
+ }[];
18
+ implementation: (...args: any[]) => boolean;
19
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,50 @@
1
+ import { FieldValueTypes, HField, HSchema, ValueDef, GetTSType } from "./dataValueTypes";
2
+ import { OperatorID } from "./operators";
3
+ export declare type ASTScoreConditionNode = {
4
+ type: "ScoreCondition";
5
+ operator: OperatorID;
6
+ values: ValueDef[];
7
+ };
8
+ export declare type ASTLanguageOperatorNode = {
9
+ type: "LanguageOperator";
10
+ operator: "OR" | "AND";
11
+ children: ASTNode[];
12
+ };
13
+ export declare type ASTNode = ASTLanguageOperatorNode | ASTScoreConditionNode;
14
+ export declare type ScoreRule = {
15
+ name: string;
16
+ description: string;
17
+ /** must be an integer */
18
+ trueWeight: number;
19
+ /** must be an integer */
20
+ falseWeight: number;
21
+ /** must have a single root node */
22
+ tree: [ASTNode];
23
+ };
24
+ /** e.g. 0-10 is "red". We only work with integers. Comparisons use >= and <= */
25
+ export declare type ScoreThreshold = {
26
+ from: number;
27
+ to: number;
28
+ name: string;
29
+ };
30
+ /**
31
+ * the big object for configuring score rules
32
+ */
33
+ export declare type ScoreConfig = {
34
+ combinator: "+" | "*";
35
+ scoreThresholds: ScoreThreshold[];
36
+ rules: ScoreRule[];
37
+ };
38
+ export declare type RuleDataProperty<T extends FieldValueTypes> = {
39
+ type: T;
40
+ value: GetTSType<T>;
41
+ hField: HField;
42
+ };
43
+ export declare type RuleData = {
44
+ [schemaName: string]: {
45
+ hSchema: HSchema;
46
+ properties: {
47
+ [fieldName: string]: RuleDataProperty<FieldValueTypes>;
48
+ };
49
+ };
50
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import { ScoreResult } from "./calculateScore";
2
+ import { ScoreConfig } from "./types";
3
+ /** determines whether a `ScoreResult` object is valid */
4
+ export declare const isScoreResultValid: (x: unknown) => x is ScoreResult;
5
+ /** determines whether a `ScoreConfig` object is valid */
6
+ export declare const isScoreConfigValid: (x: unknown) => x is ScoreConfig;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isScoreConfigValid = exports.isScoreResultValid = void 0;
4
+ const ramda_1 = require("ramda");
5
+ /** @internal - separate function so that TS understands whats going on */
6
+ const isObjectLike = (x) => typeof x === "object" && !!x && "score" in x && "category" in x;
7
+ /** determines whether a `ScoreResult` object is valid */
8
+ const isScoreResultValid = (x) => isObjectLike(x) &&
9
+ typeof x.category === "string" &&
10
+ typeof x.score === "number";
11
+ exports.isScoreResultValid = isScoreResultValid;
12
+ /** determines whether a `ScoreConfig` object is valid */
13
+ const isScoreConfigValid = (x) => typeof x === "object" && !!x && !(0, ramda_1.isEmpty)(x) && !Array.isArray(x);
14
+ exports.isScoreConfigValid = isScoreConfigValid;
@@ -0,0 +1 @@
1
+ export declare const SUBMISSION_RULES_VERSION = "sr1.3.0";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SUBMISSION_RULES_VERSION = void 0;
4
+ // this must be kept in sync with ./CHANGELOG.md. See that file for more info
5
+ exports.SUBMISSION_RULES_VERSION = "sr1.3.0";
@@ -1 +1 @@
1
- export * from "./labels";
1
+ export * from "./labels";
@@ -1,13 +1,17 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./labels"), exports);
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
+ __exportStar(require("./labels"), exports);
@@ -1,2 +1,2 @@
1
- /** Finds the label (on a profile object) which is the schema name */
2
- export declare const findSchemaLabel: (labels: string[] | undefined) => string | undefined;
1
+ /** Finds the label (on a profile object) which is the schema name */
2
+ export declare const findSchemaLabel: (labels: string[] | undefined) => string | undefined;