@pax2pay/model-banking 0.1.93 → 0.1.95
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/Rule/State/Account.ts +3 -0
- package/Rule/State/Authorization.ts +3 -0
- package/Rule/State/Card.ts +3 -0
- package/Rule/State/Transaction.ts +3 -0
- package/Rule/State/index.ts +11 -0
- package/Rule/definitions.ts +2 -3
- package/Rule/index.ts +4 -2
- package/dist/Rule/State/Account.d.ts +2 -0
- package/dist/Rule/State/Account.js +2 -0
- package/dist/Rule/State/Account.js.map +1 -0
- package/dist/Rule/State/Authorization.d.ts +2 -0
- package/dist/Rule/State/Authorization.js +2 -0
- package/dist/Rule/State/Authorization.js.map +1 -0
- package/dist/Rule/State/Card.d.ts +2 -0
- package/dist/Rule/State/Card.js +2 -0
- package/dist/Rule/State/Card.js.map +1 -0
- package/dist/Rule/State/Transaction.d.ts +2 -0
- package/dist/Rule/State/Transaction.js +2 -0
- package/dist/Rule/State/Transaction.js.map +1 -0
- package/dist/Rule/State/index.d.ts +10 -0
- package/dist/Rule/State/index.js +2 -0
- package/dist/Rule/State/index.js.map +1 -0
- package/dist/Rule/definitions.js +2 -3
- package/dist/Rule/definitions.js.map +1 -1
- package/dist/Rule/index.d.ts +3 -1
- package/dist/Rule/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Account } from "./Account"
|
|
2
|
+
import { Authorization } from "./Authorization"
|
|
3
|
+
import { Card } from "./Card"
|
|
4
|
+
import { Transaction } from "./Transaction"
|
|
5
|
+
|
|
6
|
+
export interface State {
|
|
7
|
+
transaction: Transaction
|
|
8
|
+
account: Account
|
|
9
|
+
authorization?: Authorization
|
|
10
|
+
card?: Card
|
|
11
|
+
}
|
package/Rule/definitions.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { selectively } from "selectively"
|
|
2
2
|
|
|
3
3
|
export const definitions: Record<string, selectively.Definition> = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
alwaysTrue: { arguments: [], definition: "amount>0|amount<0" },
|
|
4
|
+
isInternal: { arguments: [], definition: "transaction.counterpart.type:internal" },
|
|
5
|
+
alwaysTrue: { arguments: [], definition: "a:0|!a:0" },
|
|
7
6
|
}
|
package/Rule/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { selectively } from "selectively"
|
|
2
2
|
import { isly } from "isly"
|
|
3
3
|
import { definitions } from "./definitions"
|
|
4
|
+
import { State as RuleState } from "./State"
|
|
4
5
|
|
|
5
6
|
export interface Rule {
|
|
6
7
|
name: string
|
|
@@ -16,6 +17,7 @@ export namespace Rule {
|
|
|
16
17
|
export type Action = typeof actions[number]
|
|
17
18
|
export const kinds = ["authorization", "outbound", "inbound"] as const
|
|
18
19
|
export type Kind = typeof kinds[number]
|
|
20
|
+
export type State = RuleState
|
|
19
21
|
export const type = isly.object<Rule>({
|
|
20
22
|
name: isly.string(),
|
|
21
23
|
description: isly.string(),
|
|
@@ -29,9 +31,9 @@ export namespace Rule {
|
|
|
29
31
|
export function stringify(rule: Rule): string {
|
|
30
32
|
return `{ label: ${rule.name}, action: ${rule.action}, type: ${rule.type}, condition: ${rule.condition}, description: ${rule.description}. }`
|
|
31
33
|
}
|
|
32
|
-
export function evaluate
|
|
34
|
+
export function evaluate(
|
|
33
35
|
rules: Rule[],
|
|
34
|
-
state:
|
|
36
|
+
state: State,
|
|
35
37
|
macros?: Record<string, selectively.Definition>
|
|
36
38
|
): Record<Action, Rule[]> {
|
|
37
39
|
const result: Record<Action, Rule[]> = { review: [], reject: [], flag: [] }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Account.js","sourceRoot":"../","sources":["Rule/State/Account.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Authorization.js","sourceRoot":"../","sources":["Rule/State/Authorization.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.js","sourceRoot":"../","sources":["Rule/State/Card.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Transaction.js","sourceRoot":"../","sources":["Rule/State/Transaction.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Account } from "./Account";
|
|
2
|
+
import { Authorization } from "./Authorization";
|
|
3
|
+
import { Card } from "./Card";
|
|
4
|
+
import { Transaction } from "./Transaction";
|
|
5
|
+
export interface State {
|
|
6
|
+
transaction: Transaction;
|
|
7
|
+
account: Account;
|
|
8
|
+
authorization?: Authorization;
|
|
9
|
+
card?: Card;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Rule/State/index.ts"],"names":[],"mappings":""}
|
package/dist/Rule/definitions.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export const definitions = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
alwaysTrue: { arguments: [], definition: "amount>0|amount<0" },
|
|
2
|
+
isInternal: { arguments: [], definition: "transaction.counterpart.type:internal" },
|
|
3
|
+
alwaysTrue: { arguments: [], definition: "a:0|!a:0" },
|
|
5
4
|
};
|
|
6
5
|
//# sourceMappingURL=definitions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"../","sources":["Rule/definitions.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAA2C;IAClE,
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"../","sources":["Rule/definitions.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAA2C;IAClE,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,uCAAuC,EAAE;IAClF,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE;CACrD,CAAA"}
|
package/dist/Rule/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { selectively } from "selectively";
|
|
2
2
|
import { isly } from "isly";
|
|
3
|
+
import { State as RuleState } from "./State";
|
|
3
4
|
export interface Rule {
|
|
4
5
|
name: string;
|
|
5
6
|
description: string;
|
|
@@ -13,9 +14,10 @@ export declare namespace Rule {
|
|
|
13
14
|
type Action = typeof actions[number];
|
|
14
15
|
const kinds: readonly ["authorization", "outbound", "inbound"];
|
|
15
16
|
type Kind = typeof kinds[number];
|
|
17
|
+
type State = RuleState;
|
|
16
18
|
const type: isly.object.ExtendableType<Rule>;
|
|
17
19
|
const is: isly.Type.IsFunction<Rule>;
|
|
18
20
|
const flaw: isly.Type.FlawFunction;
|
|
19
21
|
function stringify(rule: Rule): string;
|
|
20
|
-
function evaluate
|
|
22
|
+
function evaluate(rules: Rule[], state: State, macros?: Record<string, selectively.Definition>): Record<Action, Rule[]>;
|
|
21
23
|
}
|
package/dist/Rule/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Rule/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Rule/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAY3C,MAAM,KAAW,IAAI,CAgCpB;AAhCD,WAAiB,IAAI;IACP,YAAO,GAAG,CAAC,QAAQ,EAAE,QAAQ,E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