@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.
@@ -0,0 +1,3 @@
1
+ import { Account as ModelAccount } from "../../Account"
2
+
3
+ export type Account = ModelAccount
@@ -0,0 +1,3 @@
1
+ import { Authorization as ModelAuthorization } from "../../Authorization"
2
+
3
+ export type Authorization = ModelAuthorization
@@ -0,0 +1,3 @@
1
+ import { Card as ModelCard } from "../../Card"
2
+
3
+ export type Card = ModelCard
@@ -0,0 +1,3 @@
1
+ import { Transaction as ModelTransaction } from "../../Transaction"
2
+
3
+ export type Transaction = ModelTransaction
@@ -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
+ }
@@ -1,7 +1,6 @@
1
1
  import { selectively } from "selectively"
2
2
 
3
3
  export const definitions: Record<string, selectively.Definition> = {
4
- exceedsAmount: { arguments: ["max"], definition: "amount>max" },
5
- isInternal: { arguments: [], definition: "counterpart.type:internal" },
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<S extends object>(
34
+ export function evaluate(
33
35
  rules: Rule[],
34
- state: S,
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,2 @@
1
+ import { Account as ModelAccount } from "../../Account";
2
+ export type Account = ModelAccount;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Account.js","sourceRoot":"../","sources":["Rule/State/Account.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import { Authorization as ModelAuthorization } from "../../Authorization";
2
+ export type Authorization = ModelAuthorization;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Authorization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Authorization.js","sourceRoot":"../","sources":["Rule/State/Authorization.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import { Card as ModelCard } from "../../Card";
2
+ export type Card = ModelCard;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.js","sourceRoot":"../","sources":["Rule/State/Card.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import { Transaction as ModelTransaction } from "../../Transaction";
2
+ export type Transaction = ModelTransaction;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Transaction.js.map
@@ -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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../","sources":["Rule/State/index.ts"],"names":[],"mappings":""}
@@ -1,6 +1,5 @@
1
1
  export const definitions = {
2
- exceedsAmount: { arguments: ["max"], definition: "amount>max" },
3
- isInternal: { arguments: [], definition: "counterpart.type:internal" },
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,aAAa,EAAE,EAAE,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,YAAY,EAAE;IAC/D,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,2BAA2B,EAAE;IACtE,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,mBAAmB,EAAE;CAC9D,CAAA"}
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"}
@@ -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<S extends object>(rules: Rule[], state: S, macros?: Record<string, selectively.Definition>): Record<Action, Rule[]>;
22
+ function evaluate(rules: Rule[], state: State, macros?: Record<string, selectively.Definition>): Record<Action, Rule[]>;
21
23
  }
@@ -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;AAW3C,MAAM,KAAW,IAAI,CA+BpB;AA/BD,WAAiB,IAAI;IACP,YAAO,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAA;IAE/C,UAAK,GAAG,CAAC,eAAe,EAAE,UAAU,EAAE,SAAS,CAAU,CAAA;IAEzD,SAAI,GAAG,IAAI,CAAC,MAAM,CAAO;QACrC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;QACnB,WAAW,EAAE,IAAI,CAAC,MAAM,EAAE;QAC1B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,KAAA,OAAO,CAAC;QAC5B,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,KAAA,KAAK,CAAC;QACxB,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE;QACxB,KAAK,EAAE,IAAI,CAAC,MAAM,EA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B,CAAA;QACD,OAAO,MAAM,CAAA;IACd,CAAC;IAZe,aAAQ,WAYvB,CAAA;AACF,CAAC,EAhCgB,IAAI,KAAJ,IAAI,QAgCpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pax2pay/model-banking",
3
- "version": "0.1.93",
3
+ "version": "0.1.95",
4
4
  "description": "Library containing data model types and functions for the Pax2Pay Banking API.",
5
5
  "author": "Pax2Pay Ltd",
6
6
  "license": "MIT",