@pax2pay/model-banking 0.1.654 → 0.1.655

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 (74) hide show
  1. package/Backup/Rule.ts +13 -9
  2. package/Organization/Creatable.ts +1 -1
  3. package/Organization/index.ts +1 -1
  4. package/Rule/State/Transaction.ts +2 -2
  5. package/Rule/State/index.ts +2 -2
  6. package/Rule/index.ts +7 -36
  7. package/Rule/type.ts +5 -2
  8. package/Transaction/Note.ts +10 -2
  9. package/dist/cjs/Audit.d.ts +1 -1
  10. package/dist/cjs/Backup/Rule.d.ts +1 -1
  11. package/dist/cjs/Backup/Rule.js +12 -9
  12. package/dist/cjs/Backup/Rule.js.map +1 -1
  13. package/dist/cjs/Organization/Creatable.d.ts +1 -1
  14. package/dist/cjs/Organization/index.d.ts +1 -1
  15. package/dist/cjs/Rule/State/Transaction.d.ts +2 -2
  16. package/dist/cjs/Rule/State/Transaction.js.map +1 -1
  17. package/dist/cjs/Rule/State/index.d.ts +3 -3
  18. package/dist/cjs/Rule/State/index.js.map +1 -1
  19. package/dist/cjs/Rule/index.d.ts +8 -14
  20. package/dist/cjs/Rule/index.js +6 -33
  21. package/dist/cjs/Rule/index.js.map +1 -1
  22. package/dist/cjs/Rule/type.d.ts +2 -2
  23. package/dist/cjs/Rule/type.js +2 -2
  24. package/dist/cjs/Rule/type.js.map +1 -1
  25. package/dist/cjs/Transaction/Note.d.ts +10 -2
  26. package/dist/cjs/Transaction/Note.js.map +1 -1
  27. package/dist/cjs/User/Access/Permission.d.ts +4 -4
  28. package/dist/cjs/User/Access/index.d.ts +3 -3
  29. package/dist/cjs/User/JWT/Payload.d.ts +12 -12
  30. package/dist/cjs/User/index.d.ts +6 -6
  31. package/dist/mjs/Audit.d.ts +1 -1
  32. package/dist/mjs/Backup/Rule.d.ts +1 -1
  33. package/dist/mjs/Backup/Rule.js +12 -9
  34. package/dist/mjs/Backup/Rule.js.map +1 -1
  35. package/dist/mjs/Organization/Creatable.d.ts +1 -1
  36. package/dist/mjs/Organization/index.d.ts +1 -1
  37. package/dist/mjs/Rule/State/Transaction.d.ts +2 -2
  38. package/dist/mjs/Rule/State/Transaction.js.map +1 -1
  39. package/dist/mjs/Rule/State/index.d.ts +3 -3
  40. package/dist/mjs/Rule/State/index.js.map +1 -1
  41. package/dist/mjs/Rule/index.d.ts +8 -14
  42. package/dist/mjs/Rule/index.js +6 -33
  43. package/dist/mjs/Rule/index.js.map +1 -1
  44. package/dist/mjs/Rule/type.d.ts +2 -2
  45. package/dist/mjs/Rule/type.js +2 -2
  46. package/dist/mjs/Rule/type.js.map +1 -1
  47. package/dist/mjs/Transaction/Note.d.ts +10 -2
  48. package/dist/mjs/Transaction/Note.js.map +1 -1
  49. package/dist/mjs/User/Access/Permission.d.ts +4 -4
  50. package/dist/mjs/User/Access/index.d.ts +3 -3
  51. package/dist/mjs/User/JWT/Payload.d.ts +12 -12
  52. package/dist/mjs/User/index.d.ts +6 -6
  53. package/package.json +1 -1
  54. package/Rule/Base.ts +0 -43
  55. package/Rule/Other.ts +0 -47
  56. package/Rule/control.ts +0 -7
  57. package/dist/cjs/Rule/Base.d.ts +0 -27
  58. package/dist/cjs/Rule/Base.js +0 -36
  59. package/dist/cjs/Rule/Base.js.map +0 -1
  60. package/dist/cjs/Rule/Other.d.ts +0 -20
  61. package/dist/cjs/Rule/Other.js +0 -42
  62. package/dist/cjs/Rule/Other.js.map +0 -1
  63. package/dist/cjs/Rule/control.d.ts +0 -4
  64. package/dist/cjs/Rule/control.js +0 -8
  65. package/dist/cjs/Rule/control.js.map +0 -1
  66. package/dist/mjs/Rule/Base.d.ts +0 -27
  67. package/dist/mjs/Rule/Base.js +0 -33
  68. package/dist/mjs/Rule/Base.js.map +0 -1
  69. package/dist/mjs/Rule/Other.d.ts +0 -20
  70. package/dist/mjs/Rule/Other.js +0 -39
  71. package/dist/mjs/Rule/Other.js.map +0 -1
  72. package/dist/mjs/Rule/control.d.ts +0 -4
  73. package/dist/mjs/Rule/control.js +0 -5
  74. package/dist/mjs/Rule/control.js.map +0 -1
@@ -6,17 +6,17 @@ export declare namespace Payload {
6
6
  namespace Creatable {
7
7
  const type: import("isly/dist/cjs/object").IslyObject<{
8
8
  sub: string;
9
- permission: Partial<Record<"rule" | "card" | "transaction" | "settlement" | "organization" | "user" | "log" | "operation" | "*" | "treasury", "developer" | "read" | "write" | "admin">>;
9
+ permission: Partial<Record<"card" | "transaction" | "settlement" | "organization" | "rule" | "user" | "log" | "operation" | "*" | "treasury", "developer" | "read" | "write" | "admin">>;
10
10
  realm: "test" | "uk" | "eea";
11
11
  }, object>;
12
12
  const typeZod: zod.ZodObject<{
13
13
  sub: zod.ZodString;
14
14
  permission: zod.ZodRecord<zod.ZodEnum<{
15
- rule: "rule";
16
15
  card: "card";
17
16
  transaction: "transaction";
18
17
  settlement: "settlement";
19
18
  organization: "organization";
19
+ rule: "rule";
20
20
  user: "user";
21
21
  log: "log";
22
22
  operation: "operation";
@@ -42,7 +42,7 @@ export declare namespace Payload {
42
42
  iat: number;
43
43
  iss: string;
44
44
  sub: string;
45
- permission: Partial<Record<"rule" | "card" | "transaction" | "settlement" | "organization" | "user" | "log" | "operation" | "*" | "treasury", "developer" | "read" | "write" | "admin">>;
45
+ permission: Partial<Record<"card" | "transaction" | "settlement" | "organization" | "rule" | "user" | "log" | "operation" | "*" | "treasury", "developer" | "read" | "write" | "admin">>;
46
46
  realm: "test" | "uk" | "eea";
47
47
  token?: string | undefined;
48
48
  }, object>;
@@ -52,11 +52,11 @@ export declare namespace Payload {
52
52
  iss: zod.ZodString;
53
53
  sub: zod.ZodString;
54
54
  permission: zod.ZodRecord<zod.ZodEnum<{
55
- rule: "rule";
56
55
  card: "card";
57
56
  transaction: "transaction";
58
57
  settlement: "settlement";
59
58
  organization: "organization";
59
+ rule: "rule";
60
60
  user: "user";
61
61
  log: "log";
62
62
  operation: "operation";
@@ -83,7 +83,7 @@ export declare namespace Payload {
83
83
  iat: number;
84
84
  iss: string;
85
85
  sub: string;
86
- permission: Partial<Record<"rule" | "card" | "transaction" | "settlement" | "organization" | "user" | "log" | "operation" | "*" | "treasury", "developer" | "read" | "write" | "admin">>;
86
+ permission: Partial<Record<"card" | "transaction" | "settlement" | "organization" | "rule" | "user" | "log" | "operation" | "*" | "treasury", "developer" | "read" | "write" | "admin">>;
87
87
  realm: "test" | "uk" | "eea";
88
88
  id: string;
89
89
  token?: string | undefined;
@@ -92,7 +92,7 @@ export declare namespace Payload {
92
92
  iat: number;
93
93
  iss: string;
94
94
  sub: string;
95
- permission: Partial<Record<"rule" | "card" | "transaction" | "settlement" | "organization" | "user" | "log" | "operation" | "*" | "treasury", "developer" | "read" | "write" | "admin">>;
95
+ permission: Partial<Record<"card" | "transaction" | "settlement" | "organization" | "rule" | "user" | "log" | "operation" | "*" | "treasury", "developer" | "read" | "write" | "admin">>;
96
96
  realm: "test" | "uk" | "eea";
97
97
  token?: string | undefined;
98
98
  }>;
@@ -102,11 +102,11 @@ export declare namespace Payload {
102
102
  iss: zod.ZodString;
103
103
  sub: zod.ZodString;
104
104
  permission: zod.ZodRecord<zod.ZodEnum<{
105
- rule: "rule";
106
105
  card: "card";
107
106
  transaction: "transaction";
108
107
  settlement: "settlement";
109
108
  organization: "organization";
109
+ rule: "rule";
110
110
  user: "user";
111
111
  log: "log";
112
112
  operation: "operation";
@@ -134,7 +134,7 @@ export declare namespace Payload {
134
134
  iat: number;
135
135
  iss: string;
136
136
  sub: string;
137
- permission: Partial<Record<"rule" | "card" | "transaction" | "settlement" | "organization" | "user" | "log" | "operation" | "*" | "treasury", "developer" | "read" | "write" | "admin">>;
137
+ permission: Partial<Record<"card" | "transaction" | "settlement" | "organization" | "rule" | "user" | "log" | "operation" | "*" | "treasury", "developer" | "read" | "write" | "admin">>;
138
138
  realm: "test" | "uk" | "eea";
139
139
  exp: number;
140
140
  token?: string | undefined;
@@ -143,7 +143,7 @@ export declare namespace Payload {
143
143
  iat: number;
144
144
  iss: string;
145
145
  sub: string;
146
- permission: Partial<Record<"rule" | "card" | "transaction" | "settlement" | "organization" | "user" | "log" | "operation" | "*" | "treasury", "developer" | "read" | "write" | "admin">>;
146
+ permission: Partial<Record<"card" | "transaction" | "settlement" | "organization" | "rule" | "user" | "log" | "operation" | "*" | "treasury", "developer" | "read" | "write" | "admin">>;
147
147
  realm: "test" | "uk" | "eea";
148
148
  token?: string | undefined;
149
149
  }>;
@@ -153,11 +153,11 @@ export declare namespace Payload {
153
153
  iss: zod.ZodString;
154
154
  sub: zod.ZodString;
155
155
  permission: zod.ZodRecord<zod.ZodEnum<{
156
- rule: "rule";
157
156
  card: "card";
158
157
  transaction: "transaction";
159
158
  settlement: "settlement";
160
159
  organization: "organization";
160
+ rule: "rule";
161
161
  user: "user";
162
162
  log: "log";
163
163
  operation: "operation";
@@ -189,11 +189,11 @@ export declare namespace Payload {
189
189
  iss: zod.ZodString;
190
190
  sub: zod.ZodString;
191
191
  permission: zod.ZodRecord<zod.ZodEnum<{
192
- rule: "rule";
193
192
  card: "card";
194
193
  transaction: "transaction";
195
194
  settlement: "settlement";
196
195
  organization: "organization";
196
+ rule: "rule";
197
197
  user: "user";
198
198
  log: "log";
199
199
  operation: "operation";
@@ -218,11 +218,11 @@ export declare namespace Payload {
218
218
  iss: zod.ZodString;
219
219
  sub: zod.ZodString;
220
220
  permission: zod.ZodRecord<zod.ZodEnum<{
221
- rule: "rule";
222
221
  card: "card";
223
222
  transaction: "transaction";
224
223
  settlement: "settlement";
225
224
  organization: "organization";
225
+ rule: "rule";
226
226
  user: "user";
227
227
  log: "log";
228
228
  operation: "operation";
@@ -70,11 +70,11 @@ export declare namespace User {
70
70
  email: zod.ZodString;
71
71
  access: zod.ZodObject<{
72
72
  uk: zod.ZodOptional<zod.ZodRecord<zod.ZodEnum<{
73
- rule: "rule";
74
73
  card: "card";
75
74
  transaction: "transaction";
76
75
  settlement: "settlement";
77
76
  organization: "organization";
77
+ rule: "rule";
78
78
  user: "user";
79
79
  log: "log";
80
80
  operation: "operation";
@@ -87,11 +87,11 @@ export declare namespace User {
87
87
  admin: "admin";
88
88
  }>>>;
89
89
  eea: zod.ZodOptional<zod.ZodRecord<zod.ZodEnum<{
90
- rule: "rule";
91
90
  card: "card";
92
91
  transaction: "transaction";
93
92
  settlement: "settlement";
94
93
  organization: "organization";
94
+ rule: "rule";
95
95
  user: "user";
96
96
  log: "log";
97
97
  operation: "operation";
@@ -104,11 +104,11 @@ export declare namespace User {
104
104
  admin: "admin";
105
105
  }>>>;
106
106
  test: zod.ZodOptional<zod.ZodRecord<zod.ZodEnum<{
107
- rule: "rule";
108
107
  card: "card";
109
108
  transaction: "transaction";
110
109
  settlement: "settlement";
111
110
  organization: "organization";
111
+ rule: "rule";
112
112
  user: "user";
113
113
  log: "log";
114
114
  operation: "operation";
@@ -133,9 +133,9 @@ export declare namespace User {
133
133
  const type: import("isly/dist/cjs/object").IslyObject<{
134
134
  email: string;
135
135
  access: {
136
- uk?: Partial<Record<"rule" | "card" | "transaction" | "settlement" | "organization" | "user" | "log" | "operation" | "*" | "treasury", "developer" | "read" | "write" | "admin">> | undefined;
137
- eea?: Partial<Record<"rule" | "card" | "transaction" | "settlement" | "organization" | "user" | "log" | "operation" | "*" | "treasury", "developer" | "read" | "write" | "admin">> | undefined;
138
- test?: Partial<Record<"rule" | "card" | "transaction" | "settlement" | "organization" | "user" | "log" | "operation" | "*" | "treasury", "developer" | "read" | "write" | "admin">> | undefined;
136
+ uk?: Partial<Record<"card" | "transaction" | "settlement" | "organization" | "rule" | "user" | "log" | "operation" | "*" | "treasury", "developer" | "read" | "write" | "admin">> | undefined;
137
+ eea?: Partial<Record<"card" | "transaction" | "settlement" | "organization" | "rule" | "user" | "log" | "operation" | "*" | "treasury", "developer" | "read" | "write" | "admin">> | undefined;
138
+ test?: Partial<Record<"card" | "transaction" | "settlement" | "organization" | "rule" | "user" | "log" | "operation" | "*" | "treasury", "developer" | "read" | "write" | "admin">> | undefined;
139
139
  "*"?: {
140
140
  user?: "developer" | "read" | "write" | "admin" | undefined;
141
141
  } | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pax2pay/model-banking",
3
- "version": "0.1.654",
3
+ "version": "0.1.655",
4
4
  "description": "Library containing data model types and functions for the Pax2Pay Banking API.",
5
5
  "author": "Pax2Pay Ltd",
6
6
  "license": "MIT",
package/Rule/Base.ts DELETED
@@ -1,43 +0,0 @@
1
- import { isly } from "isly"
2
- import { Preset } from "../Card/Preset"
3
-
4
- export interface Base {
5
- code: string
6
- name: string
7
- description: string
8
- type: Base.Kind
9
- category: Base.Category
10
- condition: string
11
- flags: string[]
12
- groups?: string[]
13
- presets?: Preset[]
14
- }
15
- export namespace Base {
16
- export type Kind = (typeof Kind.values)[number]
17
- export namespace Kind {
18
- export const values = ["authorization", "outbound", "inbound", "capture", "refund"] as const
19
- export const type = isly.string<Kind>(values)
20
- export function is(kind: Kind, rule: Base, groups: string[] | undefined, preset: Preset | undefined): boolean {
21
- const applyRuleForGroup =
22
- !rule.groups || rule.groups.some(ruleGroup => groups?.some(organizationGroup => organizationGroup == ruleGroup))
23
- const applyRuleForPreset = !rule.presets || rule.presets.some(rulePreset => preset == rulePreset)
24
- return kind == rule.type && applyRuleForGroup && applyRuleForPreset
25
- }
26
- }
27
- export type Category = (typeof Category.values)[number]
28
- export namespace Category {
29
- export const values = ["fincrime", "product", "customer"] as const
30
- export const type = isly.string<Category>(values)
31
- }
32
- export const type = isly.object<Base>({
33
- code: isly.string(/^[a-z0-9\-_]+$/),
34
- name: isly.string(),
35
- description: isly.string(),
36
- type: Kind.type,
37
- category: Category.type,
38
- condition: isly.string(),
39
- flags: isly.string().array(),
40
- groups: isly.string().array().optional(),
41
- presets: Preset.type.array().optional(),
42
- })
43
- }
package/Rule/Other.ts DELETED
@@ -1,47 +0,0 @@
1
- import { isoly } from "isoly"
2
- import { isly } from "isly"
3
- import type { Note } from "../Transaction/Note"
4
- import { Base } from "./Base"
5
- import { control } from "./control"
6
- import type { State } from "./State"
7
-
8
- export interface Other extends Base {
9
- action: Other.Action
10
- }
11
- export namespace Other {
12
- export type Action = (typeof Action.values)[number]
13
- export namespace Action {
14
- export const values = ["review", "reject", "flag"] as const
15
- export const type = isly.string<Action>(values)
16
- }
17
- export const type = Base.type.extend<Other>({ action: Action.type })
18
- export function evaluate(
19
- rules: Other[],
20
- state: State
21
- ): { outcomes: Record<Other.Action, Other[]>; notes: Note[]; flags: Set<string> } {
22
- const now = isoly.DateTime.now()
23
- const result: ReturnType<typeof evaluate> = {
24
- outcomes: {
25
- review: [],
26
- reject: [],
27
- flag: [],
28
- },
29
- notes: [],
30
- flags: new Set<string>(),
31
- }
32
- if (
33
- state.transaction.stage == "initiate" &&
34
- ["card", "external", "internal"].some(type => type == state.transaction.type)
35
- ) {
36
- for (const rule of rules) {
37
- if (control(rule, state)) {
38
- result.outcomes[rule.action].push(rule)
39
- result.notes.push({ author: "automatic", created: now, text: rule.name, rule })
40
- rule.flags.forEach(f => result.flags.add(f))
41
- rule.action == "review" && result.flags.add("review")
42
- }
43
- }
44
- }
45
- return result
46
- }
47
- }
package/Rule/control.ts DELETED
@@ -1,7 +0,0 @@
1
- import { selectively } from "selectively"
2
- import type { Rule } from "."
3
- import type { State } from "./State"
4
-
5
- export function control(rule: Rule, state: State, macros?: Record<string, selectively.Definition>): boolean {
6
- return selectively.parse(rule.condition).is(state)
7
- }
@@ -1,27 +0,0 @@
1
- import { isly } from "isly";
2
- import { Preset } from "../Card/Preset";
3
- export interface Base {
4
- code: string;
5
- name: string;
6
- description: string;
7
- type: Base.Kind;
8
- category: Base.Category;
9
- condition: string;
10
- flags: string[];
11
- groups?: string[];
12
- presets?: Preset[];
13
- }
14
- export declare namespace Base {
15
- type Kind = (typeof Kind.values)[number];
16
- namespace Kind {
17
- const values: readonly ["authorization", "outbound", "inbound", "capture", "refund"];
18
- const type: isly.Type<"authorization" | "outbound" | "inbound" | "capture" | "refund">;
19
- function is(kind: Kind, rule: Base, groups: string[] | undefined, preset: Preset | undefined): boolean;
20
- }
21
- type Category = (typeof Category.values)[number];
22
- namespace Category {
23
- const values: readonly ["fincrime", "product", "customer"];
24
- const type: isly.Type<"fincrime" | "product" | "customer">;
25
- }
26
- const type: import("isly/dist/cjs/object").IslyObject<Base, object>;
27
- }
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Base = void 0;
4
- const isly_1 = require("isly");
5
- const Preset_1 = require("../Card/Preset");
6
- var Base;
7
- (function (Base) {
8
- let Kind;
9
- (function (Kind) {
10
- Kind.values = ["authorization", "outbound", "inbound", "capture", "refund"];
11
- Kind.type = isly_1.isly.string(Kind.values);
12
- function is(kind, rule, groups, preset) {
13
- const applyRuleForGroup = !rule.groups || rule.groups.some(ruleGroup => groups?.some(organizationGroup => organizationGroup == ruleGroup));
14
- const applyRuleForPreset = !rule.presets || rule.presets.some(rulePreset => preset == rulePreset);
15
- return kind == rule.type && applyRuleForGroup && applyRuleForPreset;
16
- }
17
- Kind.is = is;
18
- })(Kind = Base.Kind || (Base.Kind = {}));
19
- let Category;
20
- (function (Category) {
21
- Category.values = ["fincrime", "product", "customer"];
22
- Category.type = isly_1.isly.string(Category.values);
23
- })(Category = Base.Category || (Base.Category = {}));
24
- Base.type = isly_1.isly.object({
25
- code: isly_1.isly.string(/^[a-z0-9\-_]+$/),
26
- name: isly_1.isly.string(),
27
- description: isly_1.isly.string(),
28
- type: Kind.type,
29
- category: Category.type,
30
- condition: isly_1.isly.string(),
31
- flags: isly_1.isly.string().array(),
32
- groups: isly_1.isly.string().array().optional(),
33
- presets: Preset_1.Preset.type.array().optional(),
34
- });
35
- })(Base || (exports.Base = Base = {}));
36
- //# sourceMappingURL=Base.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Base.js","sourceRoot":"","sources":["../../../Rule/Base.ts"],"names":[],"mappings":";;;AAAA,+BAA2B;AAC3B,2CAAuC;AAavC,IAAiB,IAAI,CA4Bp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AAE;QAC1B,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,QAAQ,EAAE,QAAQ,CAAC,IAAI;QACvB,SAAS,EAAE,WAAI,CAAC,MAAM,EAAE;QACxB,KAAK,EAAE,WAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;QAC5B,MAAM,EAAE,WAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;QACxC,OAAO,EAAE,eAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;KACvC,CAAC,CAAA;AACH,CAAC,EA5BgB,IAAI,oBAAJ,IAAI,QA4BpB"}
@@ -1,20 +0,0 @@
1
- import { isly } from "isly";
2
- import type { Note } from "../Transaction/Note";
3
- import { Base } from "./Base";
4
- import type { State } from "./State";
5
- export interface Other extends Base {
6
- action: Other.Action;
7
- }
8
- export declare namespace Other {
9
- type Action = (typeof Action.values)[number];
10
- namespace Action {
11
- const values: readonly ["review", "reject", "flag"];
12
- const type: isly.Type<"reject" | "review" | "flag">;
13
- }
14
- const type: import("isly/dist/cjs/object").IslyObject<Other, Base>;
15
- function evaluate(rules: Other[], state: State): {
16
- outcomes: Record<Other.Action, Other[]>;
17
- notes: Note[];
18
- flags: Set<string>;
19
- };
20
- }
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Other = void 0;
4
- const isoly_1 = require("isoly");
5
- const isly_1 = require("isly");
6
- const Base_1 = require("./Base");
7
- const control_1 = require("./control");
8
- var Other;
9
- (function (Other) {
10
- let Action;
11
- (function (Action) {
12
- Action.values = ["review", "reject", "flag"];
13
- Action.type = isly_1.isly.string(Action.values);
14
- })(Action = Other.Action || (Other.Action = {}));
15
- Other.type = Base_1.Base.type.extend({ action: Action.type });
16
- function evaluate(rules, state) {
17
- const now = isoly_1.isoly.DateTime.now();
18
- const result = {
19
- outcomes: {
20
- review: [],
21
- reject: [],
22
- flag: [],
23
- },
24
- notes: [],
25
- flags: new Set(),
26
- };
27
- if (state.transaction.stage == "initiate" &&
28
- ["card", "external", "internal"].some(type => type == state.transaction.type)) {
29
- for (const rule of rules) {
30
- if ((0, control_1.control)(rule, state)) {
31
- result.outcomes[rule.action].push(rule);
32
- result.notes.push({ author: "automatic", created: now, text: rule.name, rule });
33
- rule.flags.forEach(f => result.flags.add(f));
34
- rule.action == "review" && result.flags.add("review");
35
- }
36
- }
37
- }
38
- return result;
39
- }
40
- Other.evaluate = evaluate;
41
- })(Other || (exports.Other = Other = {}));
42
- //# sourceMappingURL=Other.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Other.js","sourceRoot":"","sources":["../../../Rule/Other.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAC7B,+BAA2B;AAE3B,iCAA6B;AAC7B,uCAAmC;AAMnC,IAAiB,KAAK,CAoCrB;AApCD,WAAiB,KAAK;IAErB,IAAiB,MAAM,CAGtB;IAHD,WAAiB,MAAM;QACT,aAAM,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAA;QAC9C,WAAI,GAAG,WAAI,CAAC,MAAM,CAAS,OAAA,MAAM,CAAC,CAAA;IAChD,CAAC,EAHgB,MAAM,GAAN,YAAM,KAAN,YAAM,QAGtB;IACY,UAAI,GAAG,WAAI,CAAC,IAAI,CAAC,MAAM,CAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;IACpE,SAAgB,QAAQ,CACvB,KAAc,EACd,KAAY;QAEZ,MAAM,GAAG,GAAG,aAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAA;QAChC,MAAM,MAAM,GAAgC;YAC3C,QAAQ,EAAE;gBACT,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE,EAAE;gBACV,IAAI,EAAE,EAAE;aACR;YACD,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,IAAI,GAAG,EAAU;SACxB,CAAA;QACD,IACC,KAAK,CAAC,WAAW,CAAC,KAAK,IAAI,UAAU;YACrC,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,EAC5E,CAAC;YACF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBAC1B,IAAI,IAAA,iBAAO,EAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;oBAC1B,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;oBACvC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;oBAC/E,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;oBAC5C,IAAI,CAAC,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;gBACtD,CAAC;YACF,CAAC;QACF,CAAC;QACD,OAAO,MAAM,CAAA;IACd,CAAC;IA5Be,cAAQ,WA4BvB,CAAA;AACF,CAAC,EApCgB,KAAK,qBAAL,KAAK,QAoCrB"}
@@ -1,4 +0,0 @@
1
- import { selectively } from "selectively";
2
- import type { Rule } from ".";
3
- import type { State } from "./State";
4
- export declare function control(rule: Rule, state: State, macros?: Record<string, selectively.Definition>): boolean;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.control = control;
4
- const selectively_1 = require("selectively");
5
- function control(rule, state, macros) {
6
- return selectively_1.selectively.parse(rule.condition).is(state);
7
- }
8
- //# sourceMappingURL=control.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"control.js","sourceRoot":"","sources":["../../../Rule/control.ts"],"names":[],"mappings":";;AAIA,0BAEC;AAND,6CAAyC;AAIzC,SAAgB,OAAO,CAAC,IAAU,EAAE,KAAY,EAAE,MAA+C;IAChG,OAAO,yBAAW,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;AACnD,CAAC"}
@@ -1,27 +0,0 @@
1
- import { isly } from "isly";
2
- import { Preset } from "../Card/Preset";
3
- export interface Base {
4
- code: string;
5
- name: string;
6
- description: string;
7
- type: Base.Kind;
8
- category: Base.Category;
9
- condition: string;
10
- flags: string[];
11
- groups?: string[];
12
- presets?: Preset[];
13
- }
14
- export declare namespace Base {
15
- type Kind = (typeof Kind.values)[number];
16
- namespace Kind {
17
- const values: readonly ["authorization", "outbound", "inbound", "capture", "refund"];
18
- const type: isly.Type<"authorization" | "outbound" | "inbound" | "capture" | "refund">;
19
- function is(kind: Kind, rule: Base, groups: string[] | undefined, preset: Preset | undefined): boolean;
20
- }
21
- type Category = (typeof Category.values)[number];
22
- namespace Category {
23
- const values: readonly ["fincrime", "product", "customer"];
24
- const type: isly.Type<"fincrime" | "product" | "customer">;
25
- }
26
- const type: import("isly/dist/cjs/object").IslyObject<Base, object>;
27
- }
@@ -1,33 +0,0 @@
1
- import { isly } from "isly";
2
- import { Preset } from "../Card/Preset";
3
- export var Base;
4
- (function (Base) {
5
- let Kind;
6
- (function (Kind) {
7
- Kind.values = ["authorization", "outbound", "inbound", "capture", "refund"];
8
- Kind.type = isly.string(Kind.values);
9
- function is(kind, rule, groups, preset) {
10
- const applyRuleForGroup = !rule.groups || rule.groups.some(ruleGroup => groups?.some(organizationGroup => organizationGroup == ruleGroup));
11
- const applyRuleForPreset = !rule.presets || rule.presets.some(rulePreset => preset == rulePreset);
12
- return kind == rule.type && applyRuleForGroup && applyRuleForPreset;
13
- }
14
- Kind.is = is;
15
- })(Kind = Base.Kind || (Base.Kind = {}));
16
- let Category;
17
- (function (Category) {
18
- Category.values = ["fincrime", "product", "customer"];
19
- Category.type = isly.string(Category.values);
20
- })(Category = Base.Category || (Base.Category = {}));
21
- Base.type = isly.object({
22
- code: isly.string(/^[a-z0-9\-_]+$/),
23
- name: isly.string(),
24
- description: isly.string(),
25
- type: Kind.type,
26
- category: Category.type,
27
- condition: isly.string(),
28
- flags: isly.string().array(),
29
- groups: isly.string().array().optional(),
30
- presets: Preset.type.array().optional(),
31
- });
32
- })(Base || (Base = {}));
33
- //# sourceMappingURL=Base.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Base.js","sourceRoot":"","sources":["../../../Rule/Base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAavC,MAAM,KAAW,IAAI,CA4BpB;AA5BD,WAAiB,IAAI;IAEpB,IAAiB,IAAI,CASpB;IATD,WAAiB,IAAI;QACP,WAAM,GAAG,CAAC,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAU,CAAA;QAC/E,SAAI,GAAG,IAAI,CAAC,MAAM,CAAO,KAAA,MAAM,CAAC,CAAA;QAC7C,SAAgB,EAAE,CAAC,IAAU,EAAE,IAAU,EAAE,MAA4B,EAAE,MAA0B;YAClG,MAAM,iBAAiB,GACtB,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC,iBAAiB,IAAI,SAAS,CAAC,CAAC,CAAA;YACjH,MAAM,kBAAkB,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,MAAM,IAAI,UAAU,CAAC,CAAA;YACjG,OAAO,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,iBAAiB,IAAI,kBAAkB,CAAA;QACpE,CAAC;QALe,OAAE,KAKjB,CAAA;IACF,CAAC,EATgB,IAAI,GAAJ,SAAI,KAAJ,SAAI,QASpB;IAED,IAAiB,QAAQ,CAGxB;IAHD,WAAiB,QAAQ;QACX,eAAM,GAAG,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,CAAU,CAAA;QACrD,aAAI,GAAG,IAAI,CAAC,MAAM,CAAW,SAAA,MAAM,CAAC,CAAA;IAClD,CAAC,EAHgB,QAAQ,GAAR,aAAQ,KAAR,aAAQ,QAGxB;IACY,SAAI,GAAG,IAAI,CAAC,MAAM,CAAO;QACrC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC;QACnC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;QACnB,WAAW,EAAE,IAAI,CAAC,MAAM,EAAE;QAC1B,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,QAAQ,EAAE,QAAQ,CAAC,IAAI;QACvB,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE;QACxB,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;QAC5B,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;QACxC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;KACvC,CAAC,CAAA;AACH,CAAC,EA5BgB,IAAI,KAAJ,IAAI,QA4BpB"}
@@ -1,20 +0,0 @@
1
- import { isly } from "isly";
2
- import type { Note } from "../Transaction/Note";
3
- import { Base } from "./Base";
4
- import type { State } from "./State";
5
- export interface Other extends Base {
6
- action: Other.Action;
7
- }
8
- export declare namespace Other {
9
- type Action = (typeof Action.values)[number];
10
- namespace Action {
11
- const values: readonly ["review", "reject", "flag"];
12
- const type: isly.Type<"reject" | "review" | "flag">;
13
- }
14
- const type: import("isly/dist/cjs/object").IslyObject<Other, Base>;
15
- function evaluate(rules: Other[], state: State): {
16
- outcomes: Record<Other.Action, Other[]>;
17
- notes: Note[];
18
- flags: Set<string>;
19
- };
20
- }
@@ -1,39 +0,0 @@
1
- import { isoly } from "isoly";
2
- import { isly } from "isly";
3
- import { Base } from "./Base";
4
- import { control } from "./control";
5
- export var Other;
6
- (function (Other) {
7
- let Action;
8
- (function (Action) {
9
- Action.values = ["review", "reject", "flag"];
10
- Action.type = isly.string(Action.values);
11
- })(Action = Other.Action || (Other.Action = {}));
12
- Other.type = Base.type.extend({ action: Action.type });
13
- function evaluate(rules, state) {
14
- const now = isoly.DateTime.now();
15
- const result = {
16
- outcomes: {
17
- review: [],
18
- reject: [],
19
- flag: [],
20
- },
21
- notes: [],
22
- flags: new Set(),
23
- };
24
- if (state.transaction.stage == "initiate" &&
25
- ["card", "external", "internal"].some(type => type == state.transaction.type)) {
26
- for (const rule of rules) {
27
- if (control(rule, state)) {
28
- result.outcomes[rule.action].push(rule);
29
- result.notes.push({ author: "automatic", created: now, text: rule.name, rule });
30
- rule.flags.forEach(f => result.flags.add(f));
31
- rule.action == "review" && result.flags.add("review");
32
- }
33
- }
34
- }
35
- return result;
36
- }
37
- Other.evaluate = evaluate;
38
- })(Other || (Other = {}));
39
- //# sourceMappingURL=Other.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Other.js","sourceRoot":"","sources":["../../../Rule/Other.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAMnC,MAAM,KAAW,KAAK,CAoCrB;AApCD,WAAiB,KAAK;IAErB,IAAiB,MAAM,CAGtB;IAHD,WAAiB,MAAM;QACT,aAAM,GAAG,CAAC,Q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AAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;oBAC5C,IAAI,CAAC,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;gBACtD,CAAC;YACF,CAAC;QACF,CAAC;QACD,OAAO,MAAM,CAAA;IACd,CAAC;IA5Be,cAAQ,WA4BvB,CAAA;AACF,CAAC,EApCgB,KAAK,KAAL,KAAK,QAoCrB"}
@@ -1,4 +0,0 @@
1
- import { selectively } from "selectively";
2
- import type { Rule } from ".";
3
- import type { State } from "./State";
4
- export declare function control(rule: Rule, state: State, macros?: Record<string, selectively.Definition>): boolean;
@@ -1,5 +0,0 @@
1
- import { selectively } from "selectively";
2
- export function control(rule, state, macros) {
3
- return selectively.parse(rule.condition).is(state);
4
- }
5
- //# sourceMappingURL=control.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"control.js","sourceRoot":"","sources":["../../../Rule/control.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAIzC,MAAM,UAAU,OAAO,CAAC,IAAU,EAAE,KAAY,EAAE,MAA+C;IAChG,OAAO,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;AACnD,CAAC"}