@pax2pay/model-banking 0.1.74 → 0.1.75
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/Organization/Rule.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { selectively } from "selectively"
|
|
2
2
|
|
|
3
|
+
const action = ["review", "reject", "flag"] as const
|
|
4
|
+
const type = ["authorization", "outbound", "inbound"] as const
|
|
3
5
|
export interface Rule {
|
|
4
|
-
|
|
5
|
-
action: "approve" | "review" | "approveReview" | "reject"
|
|
6
|
-
type: "transaction" | "authorization"
|
|
7
|
-
condition: string
|
|
6
|
+
name: string
|
|
8
7
|
description: string
|
|
8
|
+
action: typeof action[number]
|
|
9
|
+
type: typeof type[number]
|
|
10
|
+
condition: string
|
|
11
|
+
flags: string[]
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
interface RuleResult {
|
|
@@ -27,19 +30,14 @@ export namespace Rule {
|
|
|
27
30
|
return (
|
|
28
31
|
value &&
|
|
29
32
|
typeof value == "object" &&
|
|
30
|
-
typeof value.
|
|
31
|
-
|
|
32
|
-
(value.
|
|
33
|
-
value.action == "reject" ||
|
|
34
|
-
value.action == "review" ||
|
|
35
|
-
value.action == "approveReview") &&
|
|
36
|
-
typeof value.type == "string" &&
|
|
37
|
-
(value.type == "transaction" || value.type == "authorization") &&
|
|
33
|
+
typeof value.name == "string" &&
|
|
34
|
+
action.includes(value.action) &&
|
|
35
|
+
type.includes(value.type) &&
|
|
38
36
|
typeof value.condition == "string" &&
|
|
39
37
|
typeof value.description == "string"
|
|
40
38
|
)
|
|
41
39
|
}
|
|
42
40
|
export function stringify(rule: Rule): string {
|
|
43
|
-
return `{ label: ${rule.
|
|
41
|
+
return `{ label: ${rule.name}, action: ${rule.action}, type: ${rule.type}, condition: ${rule.condition}, description: ${rule.description}. }`
|
|
44
42
|
}
|
|
45
43
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { selectively } from "selectively";
|
|
2
|
+
declare const action: readonly ["review", "reject", "flag"];
|
|
3
|
+
declare const type: readonly ["authorization", "outbound", "inbound"];
|
|
2
4
|
export interface Rule {
|
|
3
|
-
|
|
4
|
-
action: "approve" | "review" | "approveReview" | "reject";
|
|
5
|
-
type: "transaction" | "authorization";
|
|
6
|
-
condition: string;
|
|
5
|
+
name: string;
|
|
7
6
|
description: string;
|
|
7
|
+
action: typeof action[number];
|
|
8
|
+
type: typeof type[number];
|
|
9
|
+
condition: string;
|
|
10
|
+
flags: string[];
|
|
8
11
|
}
|
|
9
12
|
interface RuleResult {
|
|
10
13
|
rule: Rule;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const action = ["review", "reject", "flag"];
|
|
2
|
+
const type = ["authorization", "outbound", "inbound"];
|
|
1
3
|
var RuleResult;
|
|
2
4
|
(function (RuleResult) {
|
|
3
5
|
function stringify(data) {
|
|
@@ -11,20 +13,15 @@ export var Rule;
|
|
|
11
13
|
function is(value) {
|
|
12
14
|
return (value &&
|
|
13
15
|
typeof value == "object" &&
|
|
14
|
-
typeof value.
|
|
15
|
-
|
|
16
|
-
(value.
|
|
17
|
-
value.action == "reject" ||
|
|
18
|
-
value.action == "review" ||
|
|
19
|
-
value.action == "approveReview") &&
|
|
20
|
-
typeof value.type == "string" &&
|
|
21
|
-
(value.type == "transaction" || value.type == "authorization") &&
|
|
16
|
+
typeof value.name == "string" &&
|
|
17
|
+
action.includes(value.action) &&
|
|
18
|
+
type.includes(value.type) &&
|
|
22
19
|
typeof value.condition == "string" &&
|
|
23
20
|
typeof value.description == "string");
|
|
24
21
|
}
|
|
25
22
|
Rule.is = is;
|
|
26
23
|
function stringify(rule) {
|
|
27
|
-
return `{ label: ${rule.
|
|
24
|
+
return `{ label: ${rule.name}, action: ${rule.action}, type: ${rule.type}, condition: ${rule.condition}, description: ${rule.description}. }`;
|
|
28
25
|
}
|
|
29
26
|
Rule.stringify = stringify;
|
|
30
27
|
})(Rule || (Rule = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rule.js","sourceRoot":"../","sources":["Organization/Rule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Rule.js","sourceRoot":"../","sources":["Organization/Rule.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAA;AACpD,MAAM,IAAI,GAAG,CAAC,eAAe,EAAE,UAAU,EAAE,SAAS,CAAU,CAAA;AAe9D,IAAU,UAAU,CAMnB;AAND,WAAU,UAAU;IACnB,SAAgB,SAAS,CAAC,IAAgB;QACzC,OAAO,SAAS,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,kCACxC,IAAI,CAAC,UAAU,CAAC,UACjB,gBAAgB,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,QAAQ,EAAE,mBAAmB,IAAI,CAAC,OAAO,EAAE,CAAA;IACtF,CAAC;IAJe,oBAAS,YAIxB,CAAA;AACF,CAAC,EANS,UAAU,KAAV,UAAU,QAMnB;AACD,MAAM,KAAW,IAAI,CAiBpB;AAjBD,WAAiB,IAAI;IAEP,WAAM,GAAG,UAAU,CAAA;IAChC,SAAgB,EAAE,CAAC,KAAW;QAC7B,OAAO,CACN,KAAK;YACL,OAAO,KAAK,IAAI,QAAQ;YACxB,OAAO,KAAK,CAAC,IAAI,IAAI,QAAQ;YAC7B,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;YAC7B,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;YACzB,OAAO,KAAK,CAAC,SAAS,IAAI,QAAQ;YAClC,OAAO,KAAK,CAAC,WAAW,IAAI,QAAQ,CACpC,CAAA;IACF,CAAC;IAVe,OAAE,KAUjB,CAAA;IACD,SAAgB,SAAS,CAAC,IAAU;QACnC,OAAO,YAAY,IAAI,CAAC,IAAI,aAAa,IAAI,CAAC,MAAM,WAAW,IAAI,CAAC,IAAI,gBAAgB,IAAI,CAAC,SAAS,kBAAkB,IAAI,CAAC,WAAW,KAAK,CAAA;IAC9I,CAAC;IAFe,cAAS,YAExB,CAAA;AACF,CAAC,EAjBgB,IAAI,KAAJ,IAAI,QAiBpB"}
|