@pax2pay/model-banking 0.0.14 → 0.0.17

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 (65) hide show
  1. package/Client/Accounts.ts +2 -2
  2. package/Client/Comments.ts +13 -0
  3. package/Client/Transactions.ts +2 -0
  4. package/Organization/Creatable.ts +7 -5
  5. package/Organization/Rule.ts +31 -0
  6. package/Organization/index.ts +7 -18
  7. package/Rail/index.ts +1 -1
  8. package/Transaction/Comment.ts +11 -0
  9. package/Transaction/Creatable.ts +2 -3
  10. package/Transaction/Incoming.ts +7 -4
  11. package/Transaction/index.ts +7 -4
  12. package/dist/Client/Accounts.d.ts +1 -1
  13. package/dist/Client/Accounts.js +2 -2
  14. package/dist/Client/Accounts.js.map +1 -1
  15. package/dist/Client/Comments.d.ts +8 -0
  16. package/dist/Client/Comments.js +10 -0
  17. package/dist/Client/Comments.js.map +1 -0
  18. package/dist/Client/Transactions.d.ts +2 -0
  19. package/dist/Client/Transactions.js +2 -0
  20. package/dist/Client/Transactions.js.map +1 -1
  21. package/dist/Organization/Creatable.d.ts +2 -4
  22. package/dist/Organization/Creatable.js +5 -4
  23. package/dist/Organization/Creatable.js.map +1 -1
  24. package/dist/Organization/Rule.d.ts +17 -0
  25. package/dist/Organization/Rule.js +16 -0
  26. package/dist/Organization/Rule.js.map +1 -0
  27. package/dist/Organization/index.d.ts +6 -7
  28. package/dist/Organization/index.js +3 -14
  29. package/dist/Organization/index.js.map +1 -1
  30. package/dist/Rail/index.d.ts +6 -1
  31. package/dist/Transaction/Comment.d.ts +8 -0
  32. package/dist/Transaction/Comment.js +8 -0
  33. package/dist/Transaction/Comment.js.map +1 -0
  34. package/dist/Transaction/Creatable.d.ts +1 -1
  35. package/dist/Transaction/Creatable.js +1 -1
  36. package/dist/Transaction/Creatable.js.map +1 -1
  37. package/dist/Transaction/Incoming.d.ts +3 -1
  38. package/dist/Transaction/Incoming.js +5 -3
  39. package/dist/Transaction/Incoming.js.map +1 -1
  40. package/dist/Transaction/index.d.ts +5 -0
  41. package/dist/Transaction/index.js +4 -4
  42. package/dist/Transaction/index.js.map +1 -1
  43. package/dist/pax2pay.d.ts +0 -1
  44. package/dist/pax2pay.js +0 -1
  45. package/dist/pax2pay.js.map +1 -1
  46. package/package.json +7 -6
  47. package/pax2pay.ts +0 -1
  48. package/Client/Decisions.ts +0 -16
  49. package/Client/Queue.ts +0 -16
  50. package/Organization/Rules.ts +0 -59
  51. package/dist/Organization/Rules.d.ts +0 -9
  52. package/dist/Organization/Rules.js +0 -36
  53. package/dist/Organization/Rules.js.map +0 -1
  54. package/dist/monitoring/Decision.d.ts +0 -18
  55. package/dist/monitoring/Decision.js +0 -25
  56. package/dist/monitoring/Decision.js.map +0 -1
  57. package/dist/monitoring/Reviewable.d.ts +0 -20
  58. package/dist/monitoring/Reviewable.js +0 -26
  59. package/dist/monitoring/Reviewable.js.map +0 -1
  60. package/dist/monitoring/index.d.ts +0 -2
  61. package/dist/monitoring/index.js +0 -3
  62. package/dist/monitoring/index.js.map +0 -1
  63. package/monitoring/Decision.ts +0 -34
  64. package/monitoring/Reviewable.ts +0 -39
  65. package/monitoring/index.ts +0 -2
@@ -10,7 +10,7 @@ export class Accounts extends rest.Collection<gracely.Error> {
10
10
  async create(account: Account.Creatable): Promise<Account | gracely.Error> {
11
11
  return this.client.post<Account>("/account", account)
12
12
  }
13
- async list(organization: string): Promise<Account.Info[] | gracely.Error> {
14
- return this.client.get<Account.Info[]>("/account", { organization: organization })
13
+ async list(): Promise<Account.Info[] | gracely.Error> {
14
+ return this.client.get<Account.Info[]>("/account")
15
15
  }
16
16
  }
@@ -0,0 +1,13 @@
1
+ import * as gracely from "gracely"
2
+ import * as http from "cloudly-http"
3
+ import * as rest from "cloudly-rest"
4
+ import { Transaction } from "../Transaction"
5
+
6
+ export class Comments extends rest.Collection<gracely.Error> {
7
+ constructor(client: http.Client) {
8
+ super(client)
9
+ }
10
+ async create(transaction: string, comment: Transaction.Comment): Promise<Transaction | gracely.Error> {
11
+ return this.client.post<Transaction>(`/transaction/${transaction}/comment`, comment)
12
+ }
13
+ }
@@ -2,8 +2,10 @@ import * as gracely from "gracely"
2
2
  import * as http from "cloudly-http"
3
3
  import * as rest from "cloudly-rest"
4
4
  import { Transaction } from "../Transaction"
5
+ import { Comments } from "./Comments"
5
6
 
6
7
  export class Transactions extends rest.Collection<gracely.Error> {
8
+ readonly comments = new Comments(this.client)
7
9
  constructor(client: http.Client) {
8
10
  super(client)
9
11
  }
@@ -1,7 +1,9 @@
1
+ import { Rule } from "./Rule"
2
+
1
3
  export interface Creatable {
2
4
  name: string
3
5
  realm: "test" | "uk" | "eu"
4
- rule: { incoming: string; outgoing: string }
6
+ rules: Rule[]
5
7
  }
6
8
 
7
9
  export namespace Creatable {
@@ -11,10 +13,10 @@ export namespace Creatable {
11
13
  typeof value == "object" &&
12
14
  typeof value.name == "string" &&
13
15
  (value.realm == "test" || value.realm == "uk" || value.realm == "eu") &&
14
- value.rule &&
15
- typeof value.rule == "object" &&
16
- typeof value.rule.incoming == "string" &&
17
- typeof value.rule.outgoing == "string"
16
+ value.rules &&
17
+ typeof value.rules == "object" &&
18
+ Array.isArray(value.rules) &&
19
+ value.rules.every(Rule.is)
18
20
  )
19
21
  }
20
22
  }
@@ -0,0 +1,31 @@
1
+ import * as selectively from "selectively"
2
+
3
+ export interface Rule {
4
+ label: string
5
+ action: "approve" | "review" | "approveReview" | "reject"
6
+ type: "transaction" | "authorization"
7
+ condition: string
8
+ description: string
9
+ }
10
+
11
+ export interface RuleResult {
12
+ rule: Rule
13
+ definition: selectively.Definition
14
+ outcome: boolean
15
+ }
16
+ export namespace Rule {
17
+ export type Result = RuleResult
18
+ export function is(value: Rule): value is Rule {
19
+ return (
20
+ value &&
21
+ typeof value == "object" &&
22
+ typeof value.label == "string" &&
23
+ typeof value.action == "string" &&
24
+ (value.action == "approve" || value.action == "reject" || value.action == "review") &&
25
+ typeof value.type == "string" &&
26
+ (value.type == "transaction" || value.type == "authorization") &&
27
+ typeof value.condition == "string" &&
28
+ typeof value.description == "string"
29
+ )
30
+ }
31
+ }
@@ -1,12 +1,9 @@
1
1
  import * as cryptly from "cryptly"
2
- import * as selectively from "selectively"
3
2
  import { Creatable as OrganizationCreatable } from "./Creatable"
4
- import { Rules as OrganizationRules } from "./Rules"
3
+ import { Rule as OrganizationRule } from "./Rule"
5
4
 
6
5
  export interface Organization extends OrganizationCreatable {
7
6
  readonly id: cryptly.Identifier
8
- calls: string[]
9
- functions: Record<string, selectively.Definition>
10
7
  }
11
8
 
12
9
  export namespace Organization {
@@ -14,25 +11,17 @@ export namespace Organization {
14
11
  return value && OrganizationCreatable.is({ ...value }) && typeof value.id == "string"
15
12
  }
16
13
  export function fromCreatable(organization: Creatable): Organization {
17
- return { ...organization, id: cryptly.Identifier.generate(8), calls: [], functions: {} }
14
+ return { ...organization, id: cryptly.Identifier.generate(8) }
18
15
  }
19
16
  export function isIdentifier(value: cryptly.Identifier | any): value is cryptly.Identifier {
20
17
  return cryptly.Identifier.is(value, 8)
21
18
  }
22
19
 
23
- // dummy function, remove later
24
- export function activate(organization: Organization): boolean {
25
- const result: boolean[] = []
26
- for (const call in organization.calls) {
27
- const parsed = selectively.parse(call)
28
- const resolved = selectively.resolve(organization.functions, parsed)
29
- result.push(resolved.is(resolved, {}))
30
- }
31
- return !result.includes(false)
32
- }
33
-
34
20
  export type Creatable = OrganizationCreatable
35
21
  export const Creatable = OrganizationCreatable
36
- export type Rules = OrganizationRules
37
- export const Rules = OrganizationRules
22
+ export type Rule = OrganizationRule
23
+ export const Rule = OrganizationRule
24
+ export namespace Rule {
25
+ export type Result = OrganizationRule.Result
26
+ }
38
27
  }
package/Rail/index.ts CHANGED
@@ -3,7 +3,7 @@ import { Internal as RailInternal } from "./internal"
3
3
  import { PaxGiro as RailPaxGiro } from "./PaxGiro"
4
4
  import { Type as RailType } from "./Type"
5
5
 
6
- export type Rail = RailPaxGiro | RailInternal | RailIban
6
+ export type Rail = (RailPaxGiro | RailInternal | RailIban) & { reference?: { supplier: string; value: string } }
7
7
 
8
8
  export namespace Rail {
9
9
  export function parse(value: string): Rail | undefined {
@@ -0,0 +1,11 @@
1
+ export interface Comment {
2
+ body: string
3
+ author: string
4
+ approve?: boolean
5
+ }
6
+
7
+ export namespace Comment {
8
+ export function is(value: Comment | any): value is Comment {
9
+ return true
10
+ }
11
+ }
@@ -6,7 +6,7 @@ export interface Creatable {
6
6
  counterpart: Rail
7
7
  currency: isoly.Currency
8
8
  amount: number
9
- description?: string
9
+ description: string
10
10
  operations?: Operation.Creatable[]
11
11
  }
12
12
 
@@ -14,11 +14,10 @@ export namespace Creatable {
14
14
  export function is(value: any | Creatable): value is Creatable {
15
15
  return (
16
16
  typeof value == "object" &&
17
- //Rail.is(value.account) &&
18
17
  Rail.is(value.counterpart) &&
19
18
  isoly.Currency.is(value.currency) &&
20
19
  typeof value.amount == "number" &&
21
- (value.description == undefined || typeof value.description == "string") &&
20
+ typeof value.description == "string" &&
22
21
  (value.operations == undefined ||
23
22
  (Array.isArray(value.operations) && value.operations.every(Operation.Creatable.is)))
24
23
  )
@@ -7,20 +7,23 @@ export interface Incoming extends TransactionCreatable {
7
7
  counterpart: Rail
8
8
  currency: isoly.Currency
9
9
  amount: number
10
- // some sort of timestamp
11
- description?: string
10
+ reference?: string
11
+ posted: isoly.DateTime
12
+ description: string
12
13
  }
13
14
 
14
15
  export namespace Incoming {
15
16
  export function is(value: any | Incoming): value is Incoming {
16
17
  return (
18
+ value &&
17
19
  typeof value == "object" &&
18
20
  Rail.is(value.account) &&
19
21
  Rail.is(value.counterpart) &&
20
- !Rail.hasSameIdentifiers(value.account, value.counterpart) &&
21
22
  isoly.Currency.is(value.currency) &&
22
23
  typeof value.amount == "number" &&
23
- (value.description == undefined || typeof value.description == "string")
24
+ (value.reference == "undefined" || typeof value.reference == "string") &&
25
+ isoly.DateTime.is(value.posted) &&
26
+ typeof value.description == "string"
24
27
  )
25
28
  }
26
29
  }
@@ -2,17 +2,20 @@ import * as cryptly from "cryptly"
2
2
  import * as isoly from "isoly"
3
3
  import { Operation } from "../Operation"
4
4
  import { Rail } from "../Rail"
5
+ import { Comment as TransactionComment } from "./Comment"
5
6
  import { Creatable as TransactionCreatable } from "./Creatable"
6
7
  import { Incoming as TransactionIncoming } from "./Incoming"
7
8
 
8
9
  export interface Transaction extends TransactionCreatable {
9
10
  account: Rail
10
11
  readonly id: cryptly.Identifier
12
+ readonly reference?: string
11
13
  readonly posted: isoly.DateTime
12
14
  readonly transacted?: isoly.DateTime
13
15
  type: "actual" | "available"
14
16
  balance: number
15
17
  operations: Operation[]
18
+ comments?: TransactionComment[]
16
19
  }
17
20
 
18
21
  export namespace Transaction {
@@ -57,14 +60,12 @@ export namespace Transaction {
57
60
  result: number
58
61
  ): Transaction {
59
62
  const id = cryptly.Identifier.generate(8)
60
- const timestamp = isoly.DateTime.now()
61
63
  if ("id" in transaction)
62
64
  delete transaction.id
63
- if ("posted" in transaction)
64
- delete transaction.posted
65
+ if ("transacted" in transaction)
66
+ delete transaction.transacted
65
67
  return {
66
68
  id: id,
67
- posted: timestamp,
68
69
  type: type,
69
70
  balance: result,
70
71
  ...transaction,
@@ -79,4 +80,6 @@ export namespace Transaction {
79
80
  export const Creatable = TransactionCreatable
80
81
  export type Incoming = TransactionIncoming
81
82
  export const Incoming = TransactionIncoming
83
+ export type Comment = TransactionComment
84
+ export const Comment = TransactionComment
82
85
  }
@@ -5,5 +5,5 @@ import { Account } from "../Account";
5
5
  export declare class Accounts extends rest.Collection<gracely.Error> {
6
6
  constructor(client: http.Client);
7
7
  create(account: Account.Creatable): Promise<Account | gracely.Error>;
8
- list(organization: string): Promise<Account.Info[] | gracely.Error>;
8
+ list(): Promise<Account.Info[] | gracely.Error>;
9
9
  }
@@ -6,8 +6,8 @@ export class Accounts extends rest.Collection {
6
6
  async create(account) {
7
7
  return this.client.post("/account", account);
8
8
  }
9
- async list(organization) {
10
- return this.client.get("/account", { organization: organization });
9
+ async list() {
10
+ return this.client.get("/account");
11
11
  }
12
12
  }
13
13
  //# sourceMappingURL=Accounts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Accounts.js","sourceRoot":"../","sources":["Client/Accounts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AAGpC,MAAM,OAAO,QAAS,SAAQ,IAAI,CAAC,UAAyB;IAC3D,YAAY,MAAmB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAA;IACd,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,OAA0B;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAU,UAAU,EAAE,OAAO,CAAC,CAAA;IACtD,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,YAAoB;QAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAiB,UAAU,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CAAA;IACnF,CAAC;CACD"}
1
+ {"version":3,"file":"Accounts.js","sourceRoot":"../","sources":["Client/Accounts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AAGpC,MAAM,OAAO,QAAS,SAAQ,IAAI,CAAC,UAAyB;IAC3D,YAAY,MAAmB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAA;IACd,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,OAA0B;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAU,UAAU,EAAE,OAAO,CAAC,CAAA;IACtD,CAAC;IACD,KAAK,CAAC,IAAI;QACT,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAiB,UAAU,CAAC,CAAA;IACnD,CAAC;CACD"}
@@ -0,0 +1,8 @@
1
+ import * as gracely from "gracely";
2
+ import * as http from "cloudly-http";
3
+ import * as rest from "cloudly-rest";
4
+ import { Transaction } from "../Transaction";
5
+ export declare class Comments extends rest.Collection<gracely.Error> {
6
+ constructor(client: http.Client);
7
+ create(transaction: string, comment: Transaction.Comment): Promise<Transaction | gracely.Error>;
8
+ }
@@ -0,0 +1,10 @@
1
+ import * as rest from "cloudly-rest";
2
+ export class Comments extends rest.Collection {
3
+ constructor(client) {
4
+ super(client);
5
+ }
6
+ async create(transaction, comment) {
7
+ return this.client.post(`/transaction/${transaction}/comment`, comment);
8
+ }
9
+ }
10
+ //# sourceMappingURL=Comments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Comments.js","sourceRoot":"../","sources":["Client/Comments.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AAGpC,MAAM,OAAO,QAAS,SAAQ,IAAI,CAAC,UAAyB;IAC3D,YAAY,MAAmB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAA;IACd,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,WAAmB,EAAE,OAA4B;QAC7D,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAc,gBAAgB,WAAW,UAAU,EAAE,OAAO,CAAC,CAAA;IACrF,CAAC;CACD"}
@@ -2,7 +2,9 @@ import * as gracely from "gracely";
2
2
  import * as http from "cloudly-http";
3
3
  import * as rest from "cloudly-rest";
4
4
  import { Transaction } from "../Transaction";
5
+ import { Comments } from "./Comments";
5
6
  export declare class Transactions extends rest.Collection<gracely.Error> {
7
+ readonly comments: Comments;
6
8
  constructor(client: http.Client);
7
9
  create(account: string, transaction: Transaction.Creatable): Promise<Transaction | gracely.Error>;
8
10
  list(account: string): Promise<Transaction[] | gracely.Error>;
@@ -1,7 +1,9 @@
1
1
  import * as rest from "cloudly-rest";
2
+ import { Comments } from "./Comments";
2
3
  export class Transactions extends rest.Collection {
3
4
  constructor(client) {
4
5
  super(client);
6
+ this.comments = new Comments(this.client);
5
7
  }
6
8
  async create(account, transaction) {
7
9
  return this.client.post(`/account/${account}/transaction`, transaction);
@@ -1 +1 @@
1
- {"version":3,"file":"Transactions.js","sourceRoot":"../","sources":["Client/Transactions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AAGpC,MAAM,OAAO,YAAa,SAAQ,IAAI,CAAC,UAAyB;IAC/D,YAAY,MAAmB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAA;IACd,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,OAAe,EAAE,WAAkC;QAC/D,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAc,YAAY,OAAO,cAAc,EAAE,WAAW,CAAC,CAAA;IACrF,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,OAAe;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAgB,YAAY,OAAO,cAAc,CAAC,CAAA;IACzE,CAAC;CACD"}
1
+ {"version":3,"file":"Transactions.js","sourceRoot":"../","sources":["Client/Transactions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,MAAM,OAAO,YAAa,SAAQ,IAAI,CAAC,UAAyB;IAE/D,YAAY,MAAmB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAA;QAFL,aAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAG7C,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,OAAe,EAAE,WAAkC;QAC/D,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAc,YAAY,OAAO,cAAc,EAAE,WAAW,CAAC,CAAA;IACrF,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,OAAe;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAgB,YAAY,OAAO,cAAc,CAAC,CAAA;IACzE,CAAC;CACD"}
@@ -1,10 +1,8 @@
1
+ import { Rule } from "./Rule";
1
2
  export interface Creatable {
2
3
  name: string;
3
4
  realm: "test" | "uk" | "eu";
4
- rule: {
5
- incoming: string;
6
- outgoing: string;
7
- };
5
+ rules: Rule[];
8
6
  }
9
7
  export declare namespace Creatable {
10
8
  function is(value: any | Creatable): value is Creatable;
@@ -1,3 +1,4 @@
1
+ import { Rule } from "./Rule";
1
2
  export var Creatable;
2
3
  (function (Creatable) {
3
4
  function is(value) {
@@ -5,10 +6,10 @@ export var Creatable;
5
6
  typeof value == "object" &&
6
7
  typeof value.name == "string" &&
7
8
  (value.realm == "test" || value.realm == "uk" || value.realm == "eu") &&
8
- value.rule &&
9
- typeof value.rule == "object" &&
10
- typeof value.rule.incoming == "string" &&
11
- typeof value.rule.outgoing == "string");
9
+ value.rules &&
10
+ typeof value.rules == "object" &&
11
+ Array.isArray(value.rules) &&
12
+ value.rules.every(Rule.is));
12
13
  }
13
14
  Creatable.is = is;
14
15
  })(Creatable || (Creatable = {}));
@@ -1 +1 @@
1
- {"version":3,"file":"Creatable.js","sourceRoot":"../","sources":["Organization/Creatable.ts"],"names":[],"mappings":"AAMA,MAAM,KAAW,SAAS,CAazB;AAbD,WAAiB,SAAS;IACzB,SAAgB,EAAE,CAAC,KAAsB;QACxC,OAAO,CACN,KAAK;YACL,OAAO,KAAK,IAAI,QAAQ;YACxB,OAAO,KAAK,CAAC,IAAI,IAAI,QAAQ;YAC7B,CAAC,KAAK,CAAC,KAAK,IAAI,MAAM,IAAI,KAAK,CAAC,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC;YACrE,KAAK,CAAC,IAAI;YACV,OAAO,KAAK,CAAC,IAAI,IAAI,QAAQ;YAC7B,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,IAAI,QAAQ;YACtC,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,IAAI,QAAQ,CACtC,CAAA;IACF,CAAC;IAXe,YAAE,KAWjB,CAAA;AACF,CAAC,EAbgB,SAAS,KAAT,SAAS,QAazB"}
1
+ {"version":3,"file":"Creatable.js","sourceRoot":"../","sources":["Organization/Creatable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAQ7B,MAAM,KAAW,SAAS,CAazB;AAbD,WAAiB,SAAS;IACzB,SAAgB,EAAE,CAAC,KAAsB;QACxC,OAAO,CACN,KAAK;YACL,OAAO,KAAK,IAAI,QAAQ;YACxB,OAAO,KAAK,CAAC,IAAI,IAAI,QAAQ;YAC7B,CAAC,KAAK,CAAC,KAAK,IAAI,MAAM,IAAI,KAAK,CAAC,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC;YACrE,KAAK,CAAC,KAAK;YACX,OAAO,KAAK,CAAC,KAAK,IAAI,QAAQ;YAC9B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;YAC1B,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAC1B,CAAA;IACF,CAAC;IAXe,YAAE,KAWjB,CAAA;AACF,CAAC,EAbgB,SAAS,KAAT,SAAS,QAazB"}
@@ -0,0 +1,17 @@
1
+ import * as selectively from "selectively";
2
+ export interface Rule {
3
+ label: string;
4
+ action: "approve" | "review" | "approveReview" | "reject";
5
+ type: "transaction" | "authorization";
6
+ condition: string;
7
+ description: string;
8
+ }
9
+ export interface RuleResult {
10
+ rule: Rule;
11
+ definition: selectively.Definition;
12
+ outcome: boolean;
13
+ }
14
+ export declare namespace Rule {
15
+ type Result = RuleResult;
16
+ function is(value: Rule): value is Rule;
17
+ }
@@ -0,0 +1,16 @@
1
+ export var Rule;
2
+ (function (Rule) {
3
+ function is(value) {
4
+ return (value &&
5
+ typeof value == "object" &&
6
+ typeof value.label == "string" &&
7
+ typeof value.action == "string" &&
8
+ (value.action == "approve" || value.action == "reject" || value.action == "review") &&
9
+ typeof value.type == "string" &&
10
+ (value.type == "transaction" || value.type == "authorization") &&
11
+ typeof value.condition == "string" &&
12
+ typeof value.description == "string");
13
+ }
14
+ Rule.is = is;
15
+ })(Rule || (Rule = {}));
16
+ //# sourceMappingURL=Rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Rule.js","sourceRoot":"../","sources":["Organization/Rule.ts"],"names":[],"mappings":"AAeA,MAAM,KAAW,IAAI,CAepB;AAfD,WAAiB,IAAI;IAEpB,SAAgB,EAAE,CAAC,KAAW;QAC7B,OAAO,CACN,KAAK;YACL,OAAO,KAAK,IAAI,QAAQ;YACxB,OAAO,KAAK,CAAC,KAAK,IAAI,QAAQ;YAC9B,OAAO,KAAK,CAAC,MAAM,IAAI,QAAQ;YAC/B,CAAC,KAAK,CAAC,MAAM,IAAI,SAAS,IAAI,KAAK,CAAC,MAAM,IAAI,QAAQ,IAAI,KAAK,CAAC,MAAM,IAAI,QAAQ,CAAC;YACnF,OAAO,KAAK,CAAC,IAAI,IAAI,QAAQ;YAC7B,CAAC,KAAK,CAAC,IAAI,IAAI,aAAa,IAAI,KAAK,CAAC,IAAI,IAAI,eAAe,CAAC;YAC9D,OAAO,KAAK,CAAC,SAAS,IAAI,QAAQ;YAClC,OAAO,KAAK,CAAC,WAAW,IAAI,QAAQ,CACpC,CAAA;IACF,CAAC;IAZe,OAAE,KAYjB,CAAA;AACF,CAAC,EAfgB,IAAI,KAAJ,IAAI,QAepB"}
@@ -1,19 +1,18 @@
1
1
  import * as cryptly from "cryptly";
2
- import * as selectively from "selectively";
3
2
  import { Creatable as OrganizationCreatable } from "./Creatable";
4
- import { Rules as OrganizationRules } from "./Rules";
3
+ import { Rule as OrganizationRule } from "./Rule";
5
4
  export interface Organization extends OrganizationCreatable {
6
5
  readonly id: cryptly.Identifier;
7
- calls: string[];
8
- functions: Record<string, selectively.Definition>;
9
6
  }
10
7
  export declare namespace Organization {
11
8
  function is(value: Organization | any): value is Organization;
12
9
  function fromCreatable(organization: Creatable): Organization;
13
10
  function isIdentifier(value: cryptly.Identifier | any): value is cryptly.Identifier;
14
- function activate(organization: Organization): boolean;
15
11
  type Creatable = OrganizationCreatable;
16
12
  const Creatable: typeof OrganizationCreatable;
17
- type Rules = OrganizationRules;
18
- const Rules: typeof OrganizationRules;
13
+ type Rule = OrganizationRule;
14
+ const Rule: typeof OrganizationRule;
15
+ namespace Rule {
16
+ type Result = OrganizationRule.Result;
17
+ }
19
18
  }
@@ -1,7 +1,6 @@
1
1
  import * as cryptly from "cryptly";
2
- import * as selectively from "selectively";
3
2
  import { Creatable as OrganizationCreatable } from "./Creatable";
4
- import { Rules as OrganizationRules } from "./Rules";
3
+ import { Rule as OrganizationRule } from "./Rule";
5
4
  export var Organization;
6
5
  (function (Organization) {
7
6
  function is(value) {
@@ -9,24 +8,14 @@ export var Organization;
9
8
  }
10
9
  Organization.is = is;
11
10
  function fromCreatable(organization) {
12
- return { ...organization, id: cryptly.Identifier.generate(8), calls: [], functions: {} };
11
+ return { ...organization, id: cryptly.Identifier.generate(8) };
13
12
  }
14
13
  Organization.fromCreatable = fromCreatable;
15
14
  function isIdentifier(value) {
16
15
  return cryptly.Identifier.is(value, 8);
17
16
  }
18
17
  Organization.isIdentifier = isIdentifier;
19
- function activate(organization) {
20
- const result = [];
21
- for (const call in organization.calls) {
22
- const parsed = selectively.parse(call);
23
- const resolved = selectively.resolve(organization.functions, parsed);
24
- result.push(resolved.is(resolved, {}));
25
- }
26
- return !result.includes(false);
27
- }
28
- Organization.activate = activate;
29
18
  Organization.Creatable = OrganizationCreatable;
30
- Organization.Rules = OrganizationRules;
19
+ Organization.Rule = OrganizationRule;
31
20
  })(Organization || (Organization = {}));
32
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../","sources":["Organization/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAClC,OAAO,KAAK,WAAW,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,SAAS,IAAI,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,EAAE,KAAK,IAAI,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAQ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
+ {"version":3,"file":"index.js","sourceRoot":"../","sources":["Organization/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAClC,OAAO,EAAE,SAAS,IAAI,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,EAAE,IAAI,IAAI,gBAAgB,EAAE,MAAM,QAAQ,CAAA;AAMjD,MAAM,KAAW,YAAY,CAkB5B;AAlBD,WAAiB,YAAY;IAC5B,SAAgB,EAAE,CAAC,KAAyB;QAC3C,OAAO,KAAK,IAAI,qBAAqB,CAAC,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,IAAI,OAAO,KAAK,CAAC,EAAE,IAAI,QAAQ,CAAA;IACtF,CAAC;IAFe,eAAE,KAEjB,CAAA;IACD,SAAgB,aAAa,CAAC,YAAuB;QACpD,OAAO,EAAE,GAAG,YAAY,EAAE,EAAE,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAA;IAC/D,CAAC;IAFe,0BAAa,gBAE5B,CAAA;IACD,SAAgB,YAAY,CAAC,KAA+B;QAC3D,OAAO,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IACvC,CAAC;IAFe,yBAAY,eAE3B,CAAA;IAGY,sBAAS,GAAG,qBAAqB,CAAA;IAEjC,iBAAI,GAAG,gBAAgB,CAAA;AAIrC,CAAC,EAlBgB,YAAY,KAAZ,YAAY,QAkB5B"}
@@ -2,7 +2,12 @@ import { Iban as RailIban } from "./Iban";
2
2
  import { Internal as RailInternal } from "./internal";
3
3
  import { PaxGiro as RailPaxGiro } from "./PaxGiro";
4
4
  import { Type as RailType } from "./Type";
5
- export type Rail = RailPaxGiro | RailInternal | RailIban;
5
+ export type Rail = (RailPaxGiro | RailInternal | RailIban) & {
6
+ reference?: {
7
+ supplier: string;
8
+ value: string;
9
+ };
10
+ };
6
11
  export declare namespace Rail {
7
12
  function parse(value: string): Rail | undefined;
8
13
  function stringify(rail: Rail): string;
@@ -0,0 +1,8 @@
1
+ export interface Comment {
2
+ body: string;
3
+ author: string;
4
+ approve?: boolean;
5
+ }
6
+ export declare namespace Comment {
7
+ function is(value: Comment | any): value is Comment;
8
+ }
@@ -0,0 +1,8 @@
1
+ export var Comment;
2
+ (function (Comment) {
3
+ function is(value) {
4
+ return true;
5
+ }
6
+ Comment.is = is;
7
+ })(Comment || (Comment = {}));
8
+ //# sourceMappingURL=Comment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Comment.js","sourceRoot":"../","sources":["Transaction/Comment.ts"],"names":[],"mappings":"AAMA,MAAM,KAAW,OAAO,CAIvB;AAJD,WAAiB,OAAO;IACvB,SAAgB,EAAE,CAAC,KAAoB;QACtC,OAAO,IAAI,CAAA;IACZ,CAAC;IAFe,UAAE,KAEjB,CAAA;AACF,CAAC,EAJgB,OAAO,KAAP,OAAO,QAIvB"}
@@ -5,7 +5,7 @@ export interface Creatable {
5
5
  counterpart: Rail;
6
6
  currency: isoly.Currency;
7
7
  amount: number;
8
- description?: string;
8
+ description: string;
9
9
  operations?: Operation.Creatable[];
10
10
  }
11
11
  export declare namespace Creatable {
@@ -8,7 +8,7 @@ export var Creatable;
8
8
  Rail.is(value.counterpart) &&
9
9
  isoly.Currency.is(value.currency) &&
10
10
  typeof value.amount == "number" &&
11
- (value.description == undefined || typeof value.description == "string") &&
11
+ typeof value.description == "string" &&
12
12
  (value.operations == undefined ||
13
13
  (Array.isArray(value.operations) && value.operations.every(Operation.Creatable.is))));
14
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Creatable.js","sourceRoot":"../","sources":["Transaction/Creatable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAU9B,MAAM,KAAW,SAAS,CA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AAS;gBAC7B,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CACrF,CAAA;IACF,CAAC;IAVe,YAAE,KAUjB,CAAA;AACF,CAAC,EAZgB,SAAS,KAAT,SAAS,QAYzB"}
@@ -6,7 +6,9 @@ export interface Incoming extends TransactionCreatable {
6
6
  counterpart: Rail;
7
7
  currency: isoly.Currency;
8
8
  amount: number;
9
- description?: string;
9
+ reference?: string;
10
+ posted: isoly.DateTime;
11
+ description: string;
10
12
  }
11
13
  export declare namespace Incoming {
12
14
  function is(value: any | Incoming): value is Incoming;
@@ -3,13 +3,15 @@ import { Rail } from "../Rail";
3
3
  export var Incoming;
4
4
  (function (Incoming) {
5
5
  function is(value) {
6
- return (typeof value == "object" &&
6
+ return (value &&
7
+ typeof value == "object" &&
7
8
  Rail.is(value.account) &&
8
9
  Rail.is(value.counterpart) &&
9
- !Rail.hasSameIdentifiers(value.account, value.counterpart) &&
10
10
  isoly.Currency.is(value.currency) &&
11
11
  typeof value.amount == "number" &&
12
- (value.description == undefined || typeof value.description == "string"));
12
+ (value.reference == "undefined" || typeof value.reference == "string") &&
13
+ isoly.DateTime.is(value.posted) &&
14
+ typeof value.description == "string");
13
15
  }
14
16
  Incoming.is = is;
15
17
  })(Incoming || (Incoming = {}));
@@ -1 +1 @@
1
- {"version":3,"file":"Incoming.js","sourceRoot":"../","sources":["Transaction/Incoming.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAY9B,MAAM,KAAW,QAAQ,CAYxB;AAZD,WAAiB,QAAQ;IACxB,SAAgB,EAAE,CAAC,KAAqB;QACvC,OAAO,CACN,OAAO,KAAK,IAAI,QAAQ;YACxB,IAAI,CAAC,EAAE,CAAC,KA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YjB,CAAA;AACF,CAAC,EAdgB,QAAQ,KAAR,QAAQ,QAcxB"}
@@ -2,16 +2,19 @@ import * as cryptly from "cryptly";
2
2
  import * as isoly from "isoly";
3
3
  import { Operation } from "../Operation";
4
4
  import { Rail } from "../Rail";
5
+ import { Comment as TransactionComment } from "./Comment";
5
6
  import { Creatable as TransactionCreatable } from "./Creatable";
6
7
  import { Incoming as TransactionIncoming } from "./Incoming";
7
8
  export interface Transaction extends TransactionCreatable {
8
9
  account: Rail;
9
10
  readonly id: cryptly.Identifier;
11
+ readonly reference?: string;
10
12
  readonly posted: isoly.DateTime;
11
13
  readonly transacted?: isoly.DateTime;
12
14
  type: "actual" | "available";
13
15
  balance: number;
14
16
  operations: Operation[];
17
+ comments?: TransactionComment[];
15
18
  }
16
19
  export declare namespace Transaction {
17
20
  function is(value: any | Transaction): value is Transaction;
@@ -26,4 +29,6 @@ export declare namespace Transaction {
26
29
  const Creatable: typeof TransactionCreatable;
27
30
  type Incoming = TransactionIncoming;
28
31
  const Incoming: typeof TransactionIncoming;
32
+ type Comment = TransactionComment;
33
+ const Comment: typeof TransactionComment;
29
34
  }
@@ -1,6 +1,7 @@
1
1
  import * as cryptly from "cryptly";
2
2
  import * as isoly from "isoly";
3
3
  import { Operation } from "../Operation";
4
+ import { Comment as TransactionComment } from "./Comment";
4
5
  import { Creatable as TransactionCreatable } from "./Creatable";
5
6
  import { Incoming as TransactionIncoming } from "./Incoming";
6
7
  export var Transaction;
@@ -36,14 +37,12 @@ export var Transaction;
36
37
  Transaction.fromCreatable = fromCreatable;
37
38
  function fromIncoming(transaction, type, result) {
38
39
  const id = cryptly.Identifier.generate(8);
39
- const timestamp = isoly.DateTime.now();
40
40
  if ("id" in transaction)
41
41
  delete transaction.id;
42
- if ("posted" in transaction)
43
- delete transaction.posted;
42
+ if ("transacted" in transaction)
43
+ delete transaction.transacted;
44
44
  return {
45
45
  id: id,
46
- posted: timestamp,
47
46
  type: type,
48
47
  balance: result,
49
48
  ...transaction,
@@ -57,5 +56,6 @@ export var Transaction;
57
56
  Transaction.isIdentifier = isIdentifier;
58
57
  Transaction.Creatable = TransactionCreatable;
59
58
  Transaction.Incoming = TransactionIncoming;
59
+ Transaction.Comment = TransactionComment;
60
60
  })(Transaction || (Transaction = {}));
61
61
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../","sources":["Transaction/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,OAAO,EAAE,SAAS,IAAI,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAC/D,OAAO,EAAE,QAAQ,IAAI,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAY5D,MAAM,KAAW,WAAW,CAgE3B;AAhED,WAAiB,WAAW;IAC3B,SAAgB,EAAE,CAAC,KAAwB;QAC1C,OAAO,CACN,OAAO,KAAK,IAAI,QAAQ;YACxB,oBAAoB,CAAC,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC;YACrC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;YAClC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;YAC/B,CAAC,KAAK,CAAC,IAAI,IAAI,QAAQ,IAAI,KAAK,CAAC,IAAI,IAAI,WAAW,CAAC;YACrD,OAAO,KAAK,CAAC,OAAO,IAAI,QAAQ;YAChC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC;YAC/B,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CACpC,CAAA;IACF,CAAC;IAXe,cAAE,KAWjB,CAAA;IACD,SAAgB,aAAa,CAC5B,OAAa,EACb,WAA8D,EAC9D,IAA4B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,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;SAC3E,CAAA;IACF,CAAC;IAjBe,wBAAY,eAiB3B,CAAA;IACD,SAAgB,YAAY,CAAC,KAA+B;QAC3D,OAAO,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IACvC,CAAC;IAFe,wBAAY,eAE3B,CAAA;IAGY,qBAAS,GAAG,oBAAoB,CAAA;IAEhC,oBAAQ,GAAG,mBAAmB,CAAA;IAE9B,mBAAO,GAAG,kBAAkB,CAAA;AAC1C,CAAC,EAhEgB,WAAW,KAAX,WAAW,QAgE3B"}
package/dist/pax2pay.d.ts CHANGED
@@ -5,5 +5,4 @@ export { Operation } from "./Operation";
5
5
  export { Organization } from "./Organization";
6
6
  export { Rail } from "./Rail";
7
7
  export { Transaction } from "./Transaction";
8
- export { Decision, Reviewable } from "./monitoring";
9
8
  export { Client } from "./Client";
package/dist/pax2pay.js CHANGED
@@ -5,6 +5,5 @@ export { Operation } from "./Operation";
5
5
  export { Organization } from "./Organization";
6
6
  export { Rail } from "./Rail";
7
7
  export { Transaction } from "./Transaction";
8
- export { Decision, Reviewable } from "./monitoring";
9
8
  export { Client } from "./Client";
10
9
  //# sourceMappingURL=pax2pay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pax2pay.js","sourceRoot":"../","sources":["pax2pay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA"}
1
+ {"version":3,"file":"pax2pay.js","sourceRoot":"../","sources":["pax2pay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pax2pay/model-banking",
3
- "version": "0.0.14",
3
+ "version": "0.0.17",
4
4
  "description": "Library containing data model types and functions for the Pax2Pay Banking API.",
5
5
  "author": "Pax2Pay Ltd",
6
6
  "license": "MIT",
@@ -55,19 +55,20 @@
55
55
  },
56
56
  "devDependencies": {
57
57
  "@types/jest": "^29.4.0",
58
- "@typescript-eslint/eslint-plugin": "5.53.0",
59
- "@typescript-eslint/parser": "5.53.0",
58
+ "@typescript-eslint/eslint-plugin": "5.54.1",
59
+ "@typescript-eslint/parser": "5.54.1",
60
60
  "eslint": "^8.35.0",
61
61
  "eslint-plugin-prettierx": "github:utily/eslint-plugin-prettierx#utily-20221229",
62
62
  "eslint-plugin-simple-import-sort": "^10.0.0",
63
- "jest": "^29.4.3",
63
+ "jest": "^29.5.0",
64
64
  "prettierx": "github:utily/prettierx#utily-20221229",
65
- "rimraf": "^4.1.2",
65
+ "rimraf": "^4.4.0",
66
66
  "ts-jest": "^29.0.5",
67
67
  "typescript": "^4.9.5"
68
68
  },
69
69
  "dependencies": {
70
- "cloudly-http": "^0.1.2",
70
+ "@cloudflare/workers-types": "^4.20230307.0",
71
+ "cloudly-http": "^0.1.3",
71
72
  "cloudly-rest": "^0.1.1",
72
73
  "cryptly": "^3.0.2",
73
74
  "gracely": "^2.0.3",
package/pax2pay.ts CHANGED
@@ -5,5 +5,4 @@ export { Operation } from "./Operation"
5
5
  export { Organization } from "./Organization"
6
6
  export { Rail } from "./Rail"
7
7
  export { Transaction } from "./Transaction"
8
- export { Decision, Reviewable } from "./monitoring"
9
8
  export { Client } from "./Client"
@@ -1,16 +0,0 @@
1
- import * as gracely from "gracely"
2
- import * as http from "cloudly-http"
3
- import * as rest from "cloudly-rest"
4
- import { Decision } from "../monitoring/Decision"
5
-
6
- export class Decisions extends rest.Collection<gracely.Error> {
7
- constructor(client: http.Client) {
8
- super(client)
9
- }
10
- async create(realm: string, transaction: string, decision: Decision.Creatable): Promise<Decision | gracely.Error> {
11
- return this.client.post<Decision>(`/monitor/decision/${transaction}`, decision, { realm: realm })
12
- }
13
- async list(realm: string): Promise<Decision[] | gracely.Error> {
14
- return this.client.get<Decision[]>(`/monitor/decision`, { realm: realm })
15
- }
16
- }
package/Client/Queue.ts DELETED
@@ -1,16 +0,0 @@
1
- import * as gracely from "gracely"
2
- import * as http from "cloudly-http"
3
- import * as rest from "cloudly-rest"
4
- import { Reviewable } from "../monitoring/Reviewable"
5
-
6
- export class Queue extends rest.Collection<gracely.Error> {
7
- constructor(client: http.Client) {
8
- super(client)
9
- }
10
- async change(realm: string, transaction: string, comment: string): Promise<Reviewable | gracely.Error> {
11
- return this.client.patch<Reviewable>(`/monitor/queue/${transaction}`, comment, { realm: realm })
12
- }
13
- async list(realm: string): Promise<Reviewable[] | gracely.Error> {
14
- return this.client.get<Reviewable[]>(`/monitor/queue`, { realm: realm })
15
- }
16
- }
@@ -1,59 +0,0 @@
1
- import * as selectively from "selectively"
2
-
3
- export interface Rules {
4
- calls: string[]
5
- functions: Record<string, selectively.Definition>
6
- }
7
-
8
- export namespace Rules {
9
- export function is(value: Rules): value is Rules {
10
- //const functionCalls = value.calls
11
- // .map(c => selectively.parse(c))
12
- // .map(r => r.class == "FunctionCall")
13
- // .includes(false)
14
- //const functions = Object.entries(value.functions)
15
- // .map(
16
- // functions =>
17
- // typeof functions[0] == "string" &&
18
- // typeof functions[1] == "object" &&
19
- // Object.entries(functions[1])
20
- // .map(definitions => typeof definitions[0] == "string")
21
- // .includes(false)
22
- // )
23
- // .includes(false)
24
- return (
25
- value &&
26
- typeof value == "object" &&
27
- value.calls &&
28
- typeof value.calls == "object" &&
29
- Array.isArray(value.calls) &&
30
- !value.calls
31
- .map(c => selectively.parse(c))
32
- .map(r => r.class == "FunctionCall")
33
- .includes(false) &&
34
- value.functions &&
35
- typeof value.functions == "object" &&
36
- !Object.entries(value.functions)
37
- .map(
38
- functions =>
39
- typeof functions[0] == "string" &&
40
- typeof functions[1] == "object" &&
41
- Object.entries(functions[1])
42
- .map(definitions => typeof definitions[0] == "string")
43
- .includes(false)
44
- )
45
- .includes(false)
46
- )
47
- }
48
-
49
- // dummy function, remove later
50
- export function activate(rules: Rules): boolean {
51
- const result: boolean[] = []
52
- for (const call in rules.calls) {
53
- const parsed = selectively.parse(call)
54
- const resolved = selectively.resolve(rules.functions, parsed)
55
- result.push(resolved.is(resolved, {}))
56
- }
57
- return !result.includes(false)
58
- }
59
- }
@@ -1,9 +0,0 @@
1
- import * as selectively from "selectively";
2
- export interface Rules {
3
- calls: string[];
4
- functions: Record<string, selectively.Definition>;
5
- }
6
- export declare namespace Rules {
7
- function is(value: Rules): value is Rules;
8
- function activate(rules: Rules): boolean;
9
- }
@@ -1,36 +0,0 @@
1
- import * as selectively from "selectively";
2
- export var Rules;
3
- (function (Rules) {
4
- function is(value) {
5
- return (value &&
6
- typeof value == "object" &&
7
- value.calls &&
8
- typeof value.calls == "object" &&
9
- Array.isArray(value.calls) &&
10
- !value.calls
11
- .map(c => selectively.parse(c))
12
- .map(r => r.class == "FunctionCall")
13
- .includes(false) &&
14
- value.functions &&
15
- typeof value.functions == "object" &&
16
- !Object.entries(value.functions)
17
- .map(functions => typeof functions[0] == "string" &&
18
- typeof functions[1] == "object" &&
19
- Object.entries(functions[1])
20
- .map(definitions => typeof definitions[0] == "string")
21
- .includes(false))
22
- .includes(false));
23
- }
24
- Rules.is = is;
25
- function activate(rules) {
26
- const result = [];
27
- for (const call in rules.calls) {
28
- const parsed = selectively.parse(call);
29
- const resolved = selectively.resolve(rules.functions, parsed);
30
- result.push(resolved.is(resolved, {}));
31
- }
32
- return !result.includes(false);
33
- }
34
- Rules.activate = activate;
35
- })(Rules || (Rules = {}));
36
- //# sourceMappingURL=Rules.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Rules.js","sourceRoot":"../","sources":["Organization/Rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,aAAa,CAAA;AAO1C,MAAM,KAAW,KAAK,CAmDrB;AAnDD,WAAiB,KAAK;IACrB,SAAgB,EAAE,CAAC,KAAY;QAe9B,OAAO,CACN,KAAK;YACL,OAAO,KAAK,IAAI,QAAQ;YACxB,KAAK,CAAC,KAAK;YACX,OAAO,KAAK,CAAC,KAAK,IAAI,QAAQ;YAC9B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;YAC1B,CAAC,KAAK,CAAC,KAAK;iBACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;iBAC9B,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,cAAc,CAAC;iBACnC,QAAQ,CAAC,KAAK,CAAC;YACjB,KAAK,CAAC,SAAS;YACf,OAAO,KAAK,CAAC,SAAS,IAAI,QAAQ;YAClC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC;iBAC9B,GAAG,CACH,SAAS,CAAC,EAAE,CACX,OAAO,SAAS,CAAC,CAAC,CAAC,IAAI,QAAQ;gBAC/B,OAAO,SAAS,CAAC,CAAC,CAAC,IAAI,QAAQ;gBAC/B,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;qBAC1B,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC;qBACrD,QAAQ,CAAC,KAAK,CAAC,CAClB;iBACA,QAAQ,CAAC,KAAK,CAAC,CACjB,CAAA;IACF,CAAC;IAtCe,QAAE,KAsCjB,CAAA;IAGD,SAAgB,QAAQ,CAAC,KAAY;QACpC,MAAM,MAAM,GAAc,EAAE,CAAA;QAC5B,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE;YAC/B,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YACtC,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;YAC7D,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAA;SACtC;QACD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC/B,CAAC;IARe,cAAQ,WAQvB,CAAA;AACF,CAAC,EAnDgB,KAAK,KAAL,KAAK,QAmDrB"}
@@ -1,18 +0,0 @@
1
- import * as isoly from "isoly";
2
- import { Reviewable } from "./Reviewable";
3
- export interface Decision extends Decision.Creatable {
4
- reviewable: Reviewable;
5
- timestamp: isoly.DateTime;
6
- }
7
- export declare namespace Decision {
8
- function open(decision: Decision.Creatable, reviewable: Reviewable): Decision;
9
- function is(value: any | Decision): value is Decision;
10
- interface Creatable {
11
- author: string;
12
- status: "approved" | "rejected";
13
- comment: string;
14
- }
15
- namespace Creatable {
16
- function is(value: any | Creatable): value is Creatable;
17
- }
18
- }
@@ -1,25 +0,0 @@
1
- import * as isoly from "isoly";
2
- import { Transaction } from "../Transaction";
3
- export var Decision;
4
- (function (Decision) {
5
- function open(decision, reviewable) {
6
- return { reviewable: reviewable, timestamp: isoly.DateTime.now(), ...decision };
7
- }
8
- Decision.open = open;
9
- function is(value) {
10
- return Creatable.is({ ...value }) && Transaction.is(value.transaction) && isoly.DateTime.is(value.timestamp);
11
- }
12
- Decision.is = is;
13
- let Creatable;
14
- (function (Creatable) {
15
- function is(value) {
16
- return (value &&
17
- typeof value == "object" &&
18
- typeof value.author == "string" &&
19
- typeof value.comment == "string" &&
20
- (value.status == "rejected" || value.status == "approved"));
21
- }
22
- Creatable.is = is;
23
- })(Creatable = Decision.Creatable || (Decision.Creatable = {}));
24
- })(Decision || (Decision = {}));
25
- //# sourceMappingURL=Decision.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Decision.js","sourceRoot":"../","sources":["monitoring/Decision.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAQ5C,MAAM,KAAW,QAAQ,CAwBxB;AAxBD,WAAiB,QAAQ;IACxB,SAAgB,IAAI,CAAC,QAA4B,EAAE,UAAsB;QACxE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,GAAG,QAAQ,EAAE,CAAA;IAChF,CAAC;IAFe,aAAI,OAEnB,CAAA;IAED,SAAgB,EAAE,CAAC,KAAqB;QACvC,OAAO,SAAS,CAAC,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,IAAI,WAAW,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IAC7G,CAAC;IAFe,WAAE,KAEjB,CAAA;IAMD,IAAiB,SAAS,CAUzB;IAVD,WAAiB,SAAS;QACzB,SAAgB,EAAE,CAAC,KAAsB;YACxC,OAAO,CACN,KAAK;gBACL,OAAO,KAAK,IAAI,QAAQ;gBACxB,OAAO,KAAK,CAAC,MAAM,IAAI,QAAQ;gBAC/B,OAAO,KAAK,CAAC,OAAO,IAAI,QAAQ;gBAChC,CAAC,KAAK,CAAC,MAAM,IAAI,UAAU,IAAI,KAAK,CAAC,MAAM,IAAI,UAAU,CAAC,CAC1D,CAAA;QACF,CAAC;QARe,YAAE,KAQjB,CAAA;IACF,CAAC,EAVgB,SAAS,GAAT,kBAAS,KAAT,kBAAS,QAUzB;AACF,CAAC,EAxBgB,QAAQ,KAAR,QAAQ,QAwBxB"}
@@ -1,20 +0,0 @@
1
- import * as cryptly from "cryptly";
2
- import { Transaction } from "../Transaction";
3
- export interface Reviewable {
4
- transaction: Transaction;
5
- direction: "incoming" | "outgoing";
6
- organization: cryptly.Identifier;
7
- account: cryptly.Identifier;
8
- rule: string;
9
- comments?: string[];
10
- }
11
- export declare namespace Reviewable {
12
- function open(transaction: Transaction, direction: "incoming" | "outgoing", organization: cryptly.Identifier, account: cryptly.Identifier, rule: string): {
13
- transaction: Transaction;
14
- direction: "incoming" | "outgoing";
15
- organization: string;
16
- account: string;
17
- rule: string;
18
- };
19
- function is(value: Reviewable | any): value is Reviewable;
20
- }
@@ -1,26 +0,0 @@
1
- import * as cryptly from "cryptly";
2
- import { Transaction } from "../Transaction";
3
- export var Reviewable;
4
- (function (Reviewable) {
5
- function open(transaction, direction, organization, account, rule) {
6
- return {
7
- transaction: transaction,
8
- direction: direction,
9
- organization: organization,
10
- account: account,
11
- rule: rule,
12
- };
13
- }
14
- Reviewable.open = open;
15
- function is(value) {
16
- return (value &&
17
- typeof value == "object" &&
18
- Transaction.is(value.transaction) &&
19
- cryptly.Identifier.is(value.organization) &&
20
- cryptly.Identifier.is(value.account) &&
21
- typeof value.rule == "string" &&
22
- (value.direction == "incoming" || value.direction == "outgoing"));
23
- }
24
- Reviewable.is = is;
25
- })(Reviewable || (Reviewable = {}));
26
- //# sourceMappingURL=Reviewable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Reviewable.js","sourceRoot":"../","sources":["monitoring/Reviewable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAU5C,MAAM,KAAW,UAAU,CA2B1B;AA3BD,WAAiB,UAAU;IAC1B,SAAgB,IAAI,CACnB,WAAwB,EACxB,SAAkC,EAClC,YAAgC,EAChC,OAA2B,EAC3B,IAAY;QAEZ,OAAO;YACN,WAAW,EAAE,WAAW;YACxB,SAAS,EAAE,SAAS;YACpB,YAAY,EAAE,YAAY;YAC1B,OAAO,EAAE,OAAO;YAChB,IAAI,EAAE,IAAI;SACV,CAAA;IACF,CAAC;IAde,eAAI,OAcnB,CAAA;IACD,SAAgB,EAAE,CAAC,KAAuB;QACzC,OAAO,CACN,KAAK;YACL,OAAO,KAAK,IAAI,QAAQ;YACxB,WAAW,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC;YACjC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC;YACzC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;YACpC,OAAO,KAAK,CAAC,IAAI,IAAI,QAAQ;YAC7B,CAAC,KAAK,CAAC,SAAS,IAAI,UAAU,IAAI,KAAK,CAAC,SAAS,IAAI,UAAU,CAAC,CAChE,CAAA;IACF,CAAC;IAVe,aAAE,KAUjB,CAAA;AACF,CAAC,EA3BgB,UAAU,KAAV,UAAU,QA2B1B"}
@@ -1,2 +0,0 @@
1
- export { Decision } from "./Decision";
2
- export { Reviewable } from "./Reviewable";
@@ -1,3 +0,0 @@
1
- export { Decision } from "./Decision";
2
- export { Reviewable } from "./Reviewable";
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../","sources":["monitoring/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA"}
@@ -1,34 +0,0 @@
1
- import * as isoly from "isoly"
2
- import { Transaction } from "../Transaction"
3
- import { Reviewable } from "./Reviewable"
4
-
5
- export interface Decision extends Decision.Creatable {
6
- reviewable: Reviewable
7
- timestamp: isoly.DateTime
8
- }
9
-
10
- export namespace Decision {
11
- export function open(decision: Decision.Creatable, reviewable: Reviewable): Decision {
12
- return { reviewable: reviewable, timestamp: isoly.DateTime.now(), ...decision }
13
- }
14
-
15
- export function is(value: any | Decision): value is Decision {
16
- return Creatable.is({ ...value }) && Transaction.is(value.transaction) && isoly.DateTime.is(value.timestamp)
17
- }
18
- export interface Creatable {
19
- author: string
20
- status: "approved" | "rejected"
21
- comment: string
22
- }
23
- export namespace Creatable {
24
- export function is(value: any | Creatable): value is Creatable {
25
- return (
26
- value &&
27
- typeof value == "object" &&
28
- typeof value.author == "string" &&
29
- typeof value.comment == "string" &&
30
- (value.status == "rejected" || value.status == "approved")
31
- )
32
- }
33
- }
34
- }
@@ -1,39 +0,0 @@
1
- import * as cryptly from "cryptly"
2
- import { Transaction } from "../Transaction"
3
-
4
- export interface Reviewable {
5
- transaction: Transaction
6
- direction: "incoming" | "outgoing"
7
- organization: cryptly.Identifier
8
- account: cryptly.Identifier
9
- rule: string
10
- comments?: string[]
11
- }
12
- export namespace Reviewable {
13
- export function open(
14
- transaction: Transaction,
15
- direction: "incoming" | "outgoing",
16
- organization: cryptly.Identifier,
17
- account: cryptly.Identifier,
18
- rule: string
19
- ) {
20
- return {
21
- transaction: transaction,
22
- direction: direction,
23
- organization: organization,
24
- account: account,
25
- rule: rule,
26
- }
27
- }
28
- export function is(value: Reviewable | any): value is Reviewable {
29
- return (
30
- value &&
31
- typeof value == "object" &&
32
- Transaction.is(value.transaction) &&
33
- cryptly.Identifier.is(value.organization) &&
34
- cryptly.Identifier.is(value.account) &&
35
- typeof value.rule == "string" &&
36
- (value.direction == "incoming" || value.direction == "outgoing")
37
- )
38
- }
39
- }
@@ -1,2 +0,0 @@
1
- export { Decision } from "./Decision"
2
- export { Reviewable } from "./Reviewable"