@pax2pay/model-banking 0.1.537 → 0.1.539

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/Account/Charge.ts CHANGED
@@ -1,29 +1,39 @@
1
+ import { cryptly } from "cryptly"
1
2
  import { isoly } from "isoly"
2
3
  import { isly } from "isly"
3
4
  import { Card } from "../Card"
4
5
  import { Transaction } from "../Transaction"
5
6
 
6
- export type Charge = {
7
+ export interface Charge extends Charge.Creatable {
7
8
  id: string
8
- destination: { account: string }
9
- rate: number // rate: 0.01 for 1%
10
- applies: {
11
- to: {
12
- merchants: Card.Restriction.Merchant[]
13
- }
14
- }
15
9
  }
16
10
  export namespace Charge {
17
- export const type = isly.object<Charge>({
18
- id: isly.string(),
19
- destination: isly.object({ account: isly.string() }),
20
- rate: isly.number(),
21
- applies: isly.object({
22
- to: isly.object<Charge["applies"]["to"]>({
23
- merchants: Card.Restriction.Merchant.type.array(),
11
+ export interface Creatable {
12
+ destination: { account: string }
13
+ rate: number // rate: 0.01 for 1%
14
+ applies: {
15
+ to: {
16
+ merchants: Card.Restriction.Merchant[]
17
+ }
18
+ }
19
+ }
20
+ export namespace Creatable {
21
+ export const type = isly.object<Creatable>({
22
+ destination: isly.object({ account: isly.string() }),
23
+ rate: isly.number(),
24
+ applies: isly.object({
25
+ to: isly.object<Creatable["applies"]["to"]>({
26
+ merchants: Card.Restriction.Merchant.type.array(),
27
+ }),
24
28
  }),
25
- }),
29
+ })
30
+ }
31
+ export const type = Creatable.type.extend<Charge>({
32
+ id: isly.string(),
26
33
  })
34
+ export function fromCreatable(creatable: Creatable): Charge {
35
+ return { ...creatable, id: cryptly.Identifier.generate(16) }
36
+ }
27
37
  export function evaluate(
28
38
  charges: Charge[] = [],
29
39
  transaction: Transaction.Creatable.Resolved | Transaction
package/Audit.ts CHANGED
@@ -47,6 +47,7 @@ export namespace Audit {
47
47
  | "create"
48
48
  | "remove"
49
49
  | "update"
50
+ | "inactivate"
50
51
  route: "create"
51
52
  clearbank: "assessmentFailed" | "validationFailed"
52
53
  }
package/Backup/Base.ts CHANGED
@@ -16,7 +16,7 @@ export type Base<T> = {
16
16
  export namespace Base {
17
17
  export type Action = typeof Action.values[number]
18
18
  export namespace Action {
19
- export const values = ["created", "updated", "cancelled", "removed"] as const
19
+ export const values = ["created", "updated", "cancelled", "removed", "inactivated"] as const
20
20
  }
21
21
  export type Data = { realm?: Realm; organization?: string; account?: string; isError?: true; meta?: any }
22
22
  export type Create<T, B extends Base<T>, D extends Data = Record<string, never>> = (...args: [T, Action, D?]) => B
@@ -1,20 +1,26 @@
1
1
  import { isoly } from "isoly";
2
2
  import { Card } from "../Card";
3
3
  import { Transaction } from "../Transaction";
4
- export type Charge = {
4
+ export interface Charge extends Charge.Creatable {
5
5
  id: string;
6
- destination: {
7
- account: string;
8
- };
9
- rate: number;
10
- applies: {
11
- to: {
12
- merchants: Card.Restriction.Merchant[];
13
- };
14
- };
15
- };
6
+ }
16
7
  export declare namespace Charge {
17
- const type: import("isly/dist/cjs/object").IslyObject<Charge, object>;
8
+ interface Creatable {
9
+ destination: {
10
+ account: string;
11
+ };
12
+ rate: number;
13
+ applies: {
14
+ to: {
15
+ merchants: Card.Restriction.Merchant[];
16
+ };
17
+ };
18
+ }
19
+ namespace Creatable {
20
+ const type: import("isly/dist/cjs/object").IslyObject<Creatable, object>;
21
+ }
22
+ const type: import("isly/dist/cjs/object").IslyObject<Charge, Creatable>;
23
+ function fromCreatable(creatable: Creatable): Charge;
18
24
  function evaluate(charges: Charge[] | undefined, transaction: Transaction.Creatable.Resolved | Transaction): Transaction.Amount.Charge[];
19
25
  function sum(charges: Transaction.Amount.Charge[], currency: isoly.Currency): number;
20
26
  }
@@ -1,21 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Charge = void 0;
4
+ const cryptly_1 = require("cryptly");
4
5
  const isoly_1 = require("isoly");
5
6
  const isly_1 = require("isly");
6
7
  const Card_1 = require("../Card");
7
8
  var Charge;
8
9
  (function (Charge) {
9
- Charge.type = isly_1.isly.object({
10
- id: isly_1.isly.string(),
11
- destination: isly_1.isly.object({ account: isly_1.isly.string() }),
12
- rate: isly_1.isly.number(),
13
- applies: isly_1.isly.object({
14
- to: isly_1.isly.object({
15
- merchants: Card_1.Card.Restriction.Merchant.type.array(),
10
+ let Creatable;
11
+ (function (Creatable) {
12
+ Creatable.type = isly_1.isly.object({
13
+ destination: isly_1.isly.object({ account: isly_1.isly.string() }),
14
+ rate: isly_1.isly.number(),
15
+ applies: isly_1.isly.object({
16
+ to: isly_1.isly.object({
17
+ merchants: Card_1.Card.Restriction.Merchant.type.array(),
18
+ }),
16
19
  }),
17
- }),
20
+ });
21
+ })(Creatable = Charge.Creatable || (Charge.Creatable = {}));
22
+ Charge.type = Creatable.type.extend({
23
+ id: isly_1.isly.string(),
18
24
  });
25
+ function fromCreatable(creatable) {
26
+ return { ...creatable, id: cryptly_1.cryptly.Identifier.generate(16) };
27
+ }
28
+ Charge.fromCreatable = fromCreatable;
19
29
  function evaluate(charges = [], transaction) {
20
30
  const result = [];
21
31
  for (const charge of charges)
@@ -1 +1 @@
1
- {"version":3,"file":"Charge.js","sourceRoot":"","sources":["../../../Account/Charge.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAC7B,+BAA2B;AAC3B,kCAA8B;AAa9B,IAAiB,MAAM,CAkCtB;AAlCD,WAAiB,MAAM;IACT,WAAI,GAAG,WAAI,CAAC,MAAM,CAAS;QACvC,EAAE,EAAE,WAAI,CAAC,MAAM,EAAE;QACjB,WAAW,EAAE,WAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,WAAI,CAAC,MAAM,EAAE,EAAE,CAAC;QACpD,IAAI,EAAE,WAAI,CAAC,MAAM,EAAE;QACnB,OAAO,EAAE,WAAI,CAAC,MAAM,CAAC;YACpB,EAAE,EAAE,WAAI,CAAC,MAAM,CAA0B;gBACxC,SAAS,EAAE,WAAI,C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WAAW,CAAC,WAAW,CAAC;wBACrE,MAAM,CAAC,IAAI,CAAC;4BACX,WAAW,EAAE,MAAM,CAAC,WAAW;4BAC/B,IAAI,EAAE,UAAU;4BAChB,MAAM,EAAE,aAAK,CAAC,QAAQ,CAAC,QAAQ,CAC9B,WAAW,CAAC,QAAQ,EACpB,OAAO,WAAW,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,EACxF,MAAM,CAAC,IAAI,CACX;yBACD,CAAC,CAAA;QACN,OAAO,MAAM,CAAA;IACd,CAAC;IAnBe,eAAQ,WAmBvB,CAAA;IACD,SAAgB,GAAG,CAAC,OAAoC,EAAE,QAAwB;QACjF,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,aAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAA;IAC5F,CAAC;IAFe,UAAG,MAElB,CAAA;AACF,CAAC,EAlDgB,MAAM,sBAAN,MAAM,QAkDtB"}
@@ -10,7 +10,7 @@ export declare namespace Audit {
10
10
  account: "buffer" | "counterpart-remove" | "counterpart-replace" | "listener-create" | "listener-remove" | "rail-create" | "rail-remove" | "rail-replace" | "rule-create" | "rule-remove" | "rule-replace" | "create" | "status" | "operation" | "remove" | "update";
11
11
  label: "create" | "remove" | "replace";
12
12
  transaction: "operation" | "cancel" | "system" | "update" | "note";
13
- organization: "group-replace" | "listener-create" | "listener-remove" | "rule-create" | "rule-remove" | "rule-replace" | "create" | "remove" | "update";
13
+ organization: "group-replace" | "listener-create" | "listener-remove" | "rule-create" | "rule-remove" | "rule-replace" | "create" | "remove" | "update" | "inactivate";
14
14
  route: "create";
15
15
  clearbank: "assessmentFailed" | "validationFailed";
16
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Audit.js","sourceRoot":"","sources":["../../Audit.ts"],"names":[],"mappings":";;;AACA,+BAA2B;AAG3B,IAAiB,KAAK,CAqDrB;AArDD,WAAiB,KAAK;IAiDrB,IAAiB,QAAQ,CAGxB;IAHD,WAAiB,QAAQ;QACX,eAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,CAAU,CAAA;QAC5D,aAAI,GAAG,WAAI,CAAC,MAAM,CAAC,SAAA,MAAM,CAAC,CAAA;IACxC,CAAC,EAHgB,QAAQ,GAAR,cAAQ,KAAR,cAAQ,QAGxB;AACF,CAAC,EArDgB,KAAK,qBAAL,KAAK,QAqDrB"}
1
+ {"version":3,"file":"Audit.js","sourceRoot":"","sources":["../../Audit.ts"],"names":[],"mappings":";;;AACA,+BAA2B;AAG3B,IAAiB,KAAK,CAsDrB;AAtDD,WAAiB,KAAK;IAkDrB,IAAiB,QAAQ,CAGxB;IAHD,WAAiB,QAAQ;QACX,eAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,CAAU,CAAA;QAC5D,aAAI,GAAG,WAAI,CAAC,MAAM,CAAC,SAAA,MAAM,CAAC,CAAA;IACxC,CAAC,EAHgB,QAAQ,GAAR,cAAQ,KAAR,cAAQ,QAGxB;AACF,CAAC,EAtDgB,KAAK,qBAAL,KAAK,QAsDrB"}
@@ -11,5 +11,5 @@ export interface Account extends Base<modelAccount> {
11
11
  }
12
12
  export declare namespace Account {
13
13
  const create: Base.Create<modelAccount, Account>;
14
- const addSender: (sender: (backup: Account) => any | Promise<any>) => (args_0: modelAccount, args_1: "created" | "cancelled" | "updated" | "removed", args_2?: Record<string, never> | undefined) => ReturnType<(backup: Account) => any | Promise<any>>;
14
+ const addSender: (sender: (backup: Account) => any | Promise<any>) => (args_0: modelAccount, args_1: "created" | "cancelled" | "updated" | "removed" | "inactivated", args_2?: Record<string, never> | undefined) => ReturnType<(backup: Account) => any | Promise<any>>;
15
15
  }
@@ -15,7 +15,7 @@ export type Base<T> = {
15
15
  export declare namespace Base {
16
16
  type Action = typeof Action.values[number];
17
17
  namespace Action {
18
- const values: readonly ["created", "updated", "cancelled", "removed"];
18
+ const values: readonly ["created", "updated", "cancelled", "removed", "inactivated"];
19
19
  }
20
20
  type Data = {
21
21
  realm?: Realm;
@@ -5,7 +5,7 @@ var Base;
5
5
  (function (Base) {
6
6
  let Action;
7
7
  (function (Action) {
8
- Action.values = ["created", "updated", "cancelled", "removed"];
8
+ Action.values = ["created", "updated", "cancelled", "removed", "inactivated"];
9
9
  })(Action = Base.Action || (Base.Action = {}));
10
10
  function pipeToSender(mapper) {
11
11
  return sender => (...args) => {
@@ -1 +1 @@
1
- {"version":3,"file":"Base.js","sourceRoot":"","sources":["../../../Backup/Base.ts"],"names":[],"mappings":";;;AAeA,IAAiB,IAAI,CAgBpB;AAhBD,WAAiB,IAAI;IAEpB,IAAiB,MAAM,CAEtB;IAFD,WAAiB,MAAM;QACT,aAAM,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,CAAU,CAAA;IAC9E,CAAC,EAFgB,MAAM,GAAN,WAAM,KAAN,WAAM,QAEtB;IAGD,SAAgB,YAAY,CAC3B,MAA4B;QAE5B,OAAO,MAAM,CAAC,EAAE,CACf,CAAC,GAAG,IAAI,EAAE,EAAE;YACX,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,CAAA;YAC9B,OAAO,MAAM,CAAC,MAAM,CAAC,CAAA;QACtB,CAAC,CAAA;IACH,CAAC;IARe,iBAAY,eAQ3B,CAAA;AACF,CAAC,EAhBgB,IAAI,oBAAJ,IAAI,QAgBpB"}
1
+ {"version":3,"file":"Base.js","sourceRoot":"","sources":["../../../Backup/Base.ts"],"names":[],"mappings":";;;AAeA,IAAiB,IAAI,CAgBpB;AAhBD,WAAiB,IAAI;IAEpB,IAAiB,MAAM,CAEtB;IAFD,WAAiB,MAAM;QACT,aAAM,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,CAAU,CAAA;IAC7F,CAAC,EAFgB,MAAM,GAAN,WAAM,KAAN,WAAM,QAEtB;IAGD,SAAgB,YAAY,CAC3B,MAA4B;QAE5B,OAAO,MAAM,CAAC,EAAE,CACf,CAAC,GAAG,IAAI,EAAE,EAAE;YACX,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,CAAA;YAC9B,OAAO,MAAM,CAAC,MAAM,CAAC,CAAA;QACtB,CAAC,CAAA;IACH,CAAC;IARe,iBAAY,eAQ3B,CAAA;AACF,CAAC,EAhBgB,IAAI,oBAAJ,IAAI,QAgBpB"}
@@ -10,5 +10,5 @@ export interface Card extends Base<modelCard> {
10
10
  }
11
11
  export declare namespace Card {
12
12
  const create: Base.Create<modelCard, Card>;
13
- const addSender: (sender: (backup: Card) => any | Promise<any>) => (args_0: modelCard, args_1: "created" | "cancelled" | "updated" | "removed", args_2?: Record<string, never> | undefined) => ReturnType<(backup: Card) => any | Promise<any>>;
13
+ const addSender: (sender: (backup: Card) => any | Promise<any>) => (args_0: modelCard, args_1: "created" | "cancelled" | "updated" | "removed" | "inactivated", args_2?: Record<string, never> | undefined) => ReturnType<(backup: Card) => any | Promise<any>>;
14
14
  }
@@ -9,7 +9,7 @@ export declare namespace Operation {
9
9
  const create: Base.Create<modelOperation, Operation, {
10
10
  organization: string;
11
11
  }>;
12
- const addSender: (sender: (backup: Operation) => any | Promise<any>) => (args_0: modelOperation, args_1: "created" | "cancelled" | "updated" | "removed", args_2?: {
12
+ const addSender: (sender: (backup: Operation) => any | Promise<any>) => (args_0: modelOperation, args_1: "created" | "cancelled" | "updated" | "removed" | "inactivated", args_2?: {
13
13
  organization: string;
14
14
  } | undefined) => ReturnType<(backup: Operation) => any | Promise<any>>;
15
15
  }
@@ -9,5 +9,5 @@ export interface Organization extends Base<modelOrganization> {
9
9
  }
10
10
  export declare namespace Organization {
11
11
  const create: Base.Create<modelOrganization, Organization>;
12
- const addSender: (sender: (backup: Organization) => any | Promise<any>) => (args_0: modelOrganization, args_1: "created" | "cancelled" | "updated" | "removed", args_2?: Record<string, never> | undefined) => ReturnType<(backup: Organization) => any | Promise<any>>;
12
+ const addSender: (sender: (backup: Organization) => any | Promise<any>) => (args_0: modelOrganization, args_1: "created" | "cancelled" | "updated" | "removed" | "inactivated", args_2?: Record<string, never> | undefined) => ReturnType<(backup: Organization) => any | Promise<any>>;
13
13
  }
@@ -10,7 +10,7 @@ export declare namespace Rule {
10
10
  organization?: string;
11
11
  account?: string;
12
12
  }>;
13
- const addSender: (sender: (backup: Rule) => any | Promise<any>) => (args_0: modelRule, args_1: "created" | "cancelled" | "updated" | "removed", args_2?: {
13
+ const addSender: (sender: (backup: Rule) => any | Promise<any>) => (args_0: modelRule, args_1: "created" | "cancelled" | "updated" | "removed" | "inactivated", args_2?: {
14
14
  organization?: string;
15
15
  account?: string;
16
16
  } | undefined) => ReturnType<(backup: Rule) => any | Promise<any>>;
@@ -18,7 +18,7 @@ export declare namespace Transaction {
18
18
  }>;
19
19
  const addSender: (sender: (backup: Transaction) => any | Promise<any>) => (args_0: modelTransaction & {
20
20
  state?: any;
21
- }, args_1: "created" | "cancelled" | "updated" | "removed", args_2?: {
21
+ }, args_1: "created" | "cancelled" | "updated" | "removed" | "inactivated", args_2?: {
22
22
  isError?: true;
23
23
  meta?: any;
24
24
  } | undefined) => ReturnType<(backup: Transaction) => any | Promise<any>>;
@@ -9,7 +9,7 @@ export declare namespace User {
9
9
  const create: Base.Create<userwidgets.User, User, {
10
10
  realm: Realm;
11
11
  }>;
12
- const addSender: (sender: (backup: User) => any | Promise<any>) => (args_0: userwidgets.User, args_1: "created" | "cancelled" | "updated" | "removed", args_2?: {
12
+ const addSender: (sender: (backup: User) => any | Promise<any>) => (args_0: userwidgets.User, args_1: "created" | "cancelled" | "updated" | "removed" | "inactivated", args_2?: {
13
13
  realm: Realm;
14
14
  } | undefined) => ReturnType<(backup: User) => any | Promise<any>>;
15
15
  }
@@ -1,20 +1,26 @@
1
1
  import { isoly } from "isoly";
2
2
  import { Card } from "../Card";
3
3
  import { Transaction } from "../Transaction";
4
- export type Charge = {
4
+ export interface Charge extends Charge.Creatable {
5
5
  id: string;
6
- destination: {
7
- account: string;
8
- };
9
- rate: number;
10
- applies: {
11
- to: {
12
- merchants: Card.Restriction.Merchant[];
13
- };
14
- };
15
- };
6
+ }
16
7
  export declare namespace Charge {
17
- const type: import("isly/dist/cjs/object").IslyObject<Charge, object>;
8
+ interface Creatable {
9
+ destination: {
10
+ account: string;
11
+ };
12
+ rate: number;
13
+ applies: {
14
+ to: {
15
+ merchants: Card.Restriction.Merchant[];
16
+ };
17
+ };
18
+ }
19
+ namespace Creatable {
20
+ const type: import("isly/dist/cjs/object").IslyObject<Creatable, object>;
21
+ }
22
+ const type: import("isly/dist/cjs/object").IslyObject<Charge, Creatable>;
23
+ function fromCreatable(creatable: Creatable): Charge;
18
24
  function evaluate(charges: Charge[] | undefined, transaction: Transaction.Creatable.Resolved | Transaction): Transaction.Amount.Charge[];
19
25
  function sum(charges: Transaction.Amount.Charge[], currency: isoly.Currency): number;
20
26
  }
@@ -1,18 +1,28 @@
1
+ import { cryptly } from "cryptly";
1
2
  import { isoly } from "isoly";
2
3
  import { isly } from "isly";
3
4
  import { Card } from "../Card";
4
5
  export var Charge;
5
6
  (function (Charge) {
6
- Charge.type = isly.object({
7
- id: isly.string(),
8
- destination: isly.object({ account: isly.string() }),
9
- rate: isly.number(),
10
- applies: isly.object({
11
- to: isly.object({
12
- merchants: Card.Restriction.Merchant.type.array(),
7
+ let Creatable;
8
+ (function (Creatable) {
9
+ Creatable.type = isly.object({
10
+ destination: isly.object({ account: isly.string() }),
11
+ rate: isly.number(),
12
+ applies: isly.object({
13
+ to: isly.object({
14
+ merchants: Card.Restriction.Merchant.type.array(),
15
+ }),
13
16
  }),
14
- }),
17
+ });
18
+ })(Creatable = Charge.Creatable || (Charge.Creatable = {}));
19
+ Charge.type = Creatable.type.extend({
20
+ id: isly.string(),
15
21
  });
22
+ function fromCreatable(creatable) {
23
+ return { ...creatable, id: cryptly.Identifier.generate(16) };
24
+ }
25
+ Charge.fromCreatable = fromCreatable;
16
26
  function evaluate(charges = [], transaction) {
17
27
  const result = [];
18
28
  for (const charge of charges)
@@ -1 +1 @@
1
- {"version":3,"file":"Charge.js","sourceRoot":"","sources":["../../../Account/Charge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAa9B,MAAM,KAAW,MAAM,CAkCtB;AAlCD,WAAiB,MAAM;IACT,WAAI,GAAG,IAAI,CAAC,MAAM,CAAS;QACvC,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE;QACjB,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;QACpD,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;QACnB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC;YACpB,EAAE,EAAE,IAAI,CAAC,MAAM,CAA0B;gBACxC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE;aACjD,CAAC;SACF,CAAC;KACF,CAAC,CAAA;IACF,SAAgB,QAAQ,CACvB,UAAoB,EAAE,EACtB,WAAyD;QAEzD,MAAM,MAAM,GAAgC,EAAE,CAAA;QAC9C,KAAK,MAAM,MAAM,IAAI,OAAO;YAC3B,IAAI,UAAU,IAAI,WAAW,CAAC,WAAW;gBACxC,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS;oBACjD,IAAI,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,W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CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,EACxF,MAAM,CAAC,IAAI,CACX;yBACD,CAAC,CAAA;QACN,OAAO,MAAM,CAAA;IACd,CAAC;IAnBe,eAAQ,WAmBvB,CAAA;IACD,SAAgB,GAAG,CAAC,OAAoC,EAAE,QAAwB;QACjF,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAA;IAC5F,CAAC;IAFe,UAAG,MAElB,CAAA;AACF,CAAC,EAlDgB,MAAM,KAAN,MAAM,QAkDtB"}
@@ -10,7 +10,7 @@ export declare namespace Audit {
10
10
  account: "buffer" | "counterpart-remove" | "counterpart-replace" | "listener-create" | "listener-remove" | "rail-create" | "rail-remove" | "rail-replace" | "rule-create" | "rule-remove" | "rule-replace" | "create" | "status" | "operation" | "remove" | "update";
11
11
  label: "create" | "remove" | "replace";
12
12
  transaction: "operation" | "cancel" | "system" | "update" | "note";
13
- organization: "group-replace" | "listener-create" | "listener-remove" | "rule-create" | "rule-remove" | "rule-replace" | "create" | "remove" | "update";
13
+ organization: "group-replace" | "listener-create" | "listener-remove" | "rule-create" | "rule-remove" | "rule-replace" | "create" | "remove" | "update" | "inactivate";
14
14
  route: "create";
15
15
  clearbank: "assessmentFailed" | "validationFailed";
16
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Audit.js","sourceRoot":"","sources":["../../Audit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAG3B,MAAM,KAAW,KAAK,CAqDrB;AArDD,WAAiB,KAAK;IAiDrB,IAAiB,QAAQ,CAGxB;IAHD,WAAiB,QAAQ;QACX,eAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,CAAU,CAAA;QAC5D,aAAI,GAAG,IAAI,CAAC,MAAM,CAAC,SAAA,MAAM,CAAC,CAAA;IACxC,CAAC,EAHgB,QAAQ,GAAR,cAAQ,KAAR,cAAQ,QAGxB;AACF,CAAC,EArDgB,KAAK,KAAL,KAAK,QAqDrB"}
1
+ {"version":3,"file":"Audit.js","sourceRoot":"","sources":["../../Audit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAG3B,MAAM,KAAW,KAAK,CAsDrB;AAtDD,WAAiB,KAAK;IAkDrB,IAAiB,QAAQ,CAGxB;IAHD,WAAiB,QAAQ;QACX,eAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,CAAU,CAAA;QAC5D,aAAI,GAAG,IAAI,CAAC,MAAM,CAAC,SAAA,MAAM,CAAC,CAAA;IACxC,CAAC,EAHgB,QAAQ,GAAR,cAAQ,KAAR,cAAQ,QAGxB;AACF,CAAC,EAtDgB,KAAK,KAAL,KAAK,QAsDrB"}
@@ -11,5 +11,5 @@ export interface Account extends Base<modelAccount> {
11
11
  }
12
12
  export declare namespace Account {
13
13
  const create: Base.Create<modelAccount, Account>;
14
- const addSender: (sender: (backup: Account) => any | Promise<any>) => (args_0: modelAccount, args_1: "created" | "cancelled" | "updated" | "removed", args_2?: Record<string, never> | undefined) => ReturnType<(backup: Account) => any | Promise<any>>;
14
+ const addSender: (sender: (backup: Account) => any | Promise<any>) => (args_0: modelAccount, args_1: "created" | "cancelled" | "updated" | "removed" | "inactivated", args_2?: Record<string, never> | undefined) => ReturnType<(backup: Account) => any | Promise<any>>;
15
15
  }
@@ -15,7 +15,7 @@ export type Base<T> = {
15
15
  export declare namespace Base {
16
16
  type Action = typeof Action.values[number];
17
17
  namespace Action {
18
- const values: readonly ["created", "updated", "cancelled", "removed"];
18
+ const values: readonly ["created", "updated", "cancelled", "removed", "inactivated"];
19
19
  }
20
20
  type Data = {
21
21
  realm?: Realm;
@@ -2,7 +2,7 @@ export var Base;
2
2
  (function (Base) {
3
3
  let Action;
4
4
  (function (Action) {
5
- Action.values = ["created", "updated", "cancelled", "removed"];
5
+ Action.values = ["created", "updated", "cancelled", "removed", "inactivated"];
6
6
  })(Action = Base.Action || (Base.Action = {}));
7
7
  function pipeToSender(mapper) {
8
8
  return sender => (...args) => {
@@ -1 +1 @@
1
- {"version":3,"file":"Base.js","sourceRoot":"","sources":["../../../Backup/Base.ts"],"names":[],"mappings":"AAeA,MAAM,KAAW,IAAI,CAgBpB;AAhBD,WAAiB,IAAI;IAEpB,IAAiB,MAAM,CAEtB;IAFD,WAAiB,MAAM;QACT,aAAM,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,CAAU,CAAA;IAC9E,CAAC,EAFgB,MAAM,GAAN,WAAM,KAAN,WAAM,QAEtB;IAGD,SAAgB,YAAY,CAC3B,MAA4B;QAE5B,OAAO,MAAM,CAAC,EAAE,CACf,CAAC,GAAG,IAAI,EAAE,EAAE;YACX,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,CAAA;YAC9B,OAAO,MAAM,CAAC,MAAM,CAAC,CAAA;QACtB,CAAC,CAAA;IACH,CAAC;IARe,iBAAY,eAQ3B,CAAA;AACF,CAAC,EAhBgB,IAAI,KAAJ,IAAI,QAgBpB"}
1
+ {"version":3,"file":"Base.js","sourceRoot":"","sources":["../../../Backup/Base.ts"],"names":[],"mappings":"AAeA,MAAM,KAAW,IAAI,CAgBpB;AAhBD,WAAiB,IAAI;IAEpB,IAAiB,MAAM,CAEtB;IAFD,WAAiB,MAAM;QACT,aAAM,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,CAAU,CAAA;IAC7F,CAAC,EAFgB,MAAM,GAAN,WAAM,KAAN,WAAM,QAEtB;IAGD,SAAgB,YAAY,CAC3B,MAA4B;QAE5B,OAAO,MAAM,CAAC,EAAE,CACf,CAAC,GAAG,IAAI,EAAE,EAAE;YACX,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,CAAA;YAC9B,OAAO,MAAM,CAAC,MAAM,CAAC,CAAA;QACtB,CAAC,CAAA;IACH,CAAC;IARe,iBAAY,eAQ3B,CAAA;AACF,CAAC,EAhBgB,IAAI,KAAJ,IAAI,QAgBpB"}
@@ -10,5 +10,5 @@ export interface Card extends Base<modelCard> {
10
10
  }
11
11
  export declare namespace Card {
12
12
  const create: Base.Create<modelCard, Card>;
13
- const addSender: (sender: (backup: Card) => any | Promise<any>) => (args_0: modelCard, args_1: "created" | "cancelled" | "updated" | "removed", args_2?: Record<string, never> | undefined) => ReturnType<(backup: Card) => any | Promise<any>>;
13
+ const addSender: (sender: (backup: Card) => any | Promise<any>) => (args_0: modelCard, args_1: "created" | "cancelled" | "updated" | "removed" | "inactivated", args_2?: Record<string, never> | undefined) => ReturnType<(backup: Card) => any | Promise<any>>;
14
14
  }
@@ -9,7 +9,7 @@ export declare namespace Operation {
9
9
  const create: Base.Create<modelOperation, Operation, {
10
10
  organization: string;
11
11
  }>;
12
- const addSender: (sender: (backup: Operation) => any | Promise<any>) => (args_0: modelOperation, args_1: "created" | "cancelled" | "updated" | "removed", args_2?: {
12
+ const addSender: (sender: (backup: Operation) => any | Promise<any>) => (args_0: modelOperation, args_1: "created" | "cancelled" | "updated" | "removed" | "inactivated", args_2?: {
13
13
  organization: string;
14
14
  } | undefined) => ReturnType<(backup: Operation) => any | Promise<any>>;
15
15
  }
@@ -9,5 +9,5 @@ export interface Organization extends Base<modelOrganization> {
9
9
  }
10
10
  export declare namespace Organization {
11
11
  const create: Base.Create<modelOrganization, Organization>;
12
- const addSender: (sender: (backup: Organization) => any | Promise<any>) => (args_0: modelOrganization, args_1: "created" | "cancelled" | "updated" | "removed", args_2?: Record<string, never> | undefined) => ReturnType<(backup: Organization) => any | Promise<any>>;
12
+ const addSender: (sender: (backup: Organization) => any | Promise<any>) => (args_0: modelOrganization, args_1: "created" | "cancelled" | "updated" | "removed" | "inactivated", args_2?: Record<string, never> | undefined) => ReturnType<(backup: Organization) => any | Promise<any>>;
13
13
  }
@@ -10,7 +10,7 @@ export declare namespace Rule {
10
10
  organization?: string;
11
11
  account?: string;
12
12
  }>;
13
- const addSender: (sender: (backup: Rule) => any | Promise<any>) => (args_0: modelRule, args_1: "created" | "cancelled" | "updated" | "removed", args_2?: {
13
+ const addSender: (sender: (backup: Rule) => any | Promise<any>) => (args_0: modelRule, args_1: "created" | "cancelled" | "updated" | "removed" | "inactivated", args_2?: {
14
14
  organization?: string;
15
15
  account?: string;
16
16
  } | undefined) => ReturnType<(backup: Rule) => any | Promise<any>>;
@@ -18,7 +18,7 @@ export declare namespace Transaction {
18
18
  }>;
19
19
  const addSender: (sender: (backup: Transaction) => any | Promise<any>) => (args_0: modelTransaction & {
20
20
  state?: any;
21
- }, args_1: "created" | "cancelled" | "updated" | "removed", args_2?: {
21
+ }, args_1: "created" | "cancelled" | "updated" | "removed" | "inactivated", args_2?: {
22
22
  isError?: true;
23
23
  meta?: any;
24
24
  } | undefined) => ReturnType<(backup: Transaction) => any | Promise<any>>;
@@ -9,7 +9,7 @@ export declare namespace User {
9
9
  const create: Base.Create<userwidgets.User, User, {
10
10
  realm: Realm;
11
11
  }>;
12
- const addSender: (sender: (backup: User) => any | Promise<any>) => (args_0: userwidgets.User, args_1: "created" | "cancelled" | "updated" | "removed", args_2?: {
12
+ const addSender: (sender: (backup: User) => any | Promise<any>) => (args_0: userwidgets.User, args_1: "created" | "cancelled" | "updated" | "removed" | "inactivated", args_2?: {
13
13
  realm: Realm;
14
14
  } | undefined) => ReturnType<(backup: User) => any | Promise<any>>;
15
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pax2pay/model-banking",
3
- "version": "0.1.537",
3
+ "version": "0.1.539",
4
4
  "description": "Library containing data model types and functions for the Pax2Pay Banking API.",
5
5
  "author": "Pax2Pay Ltd",
6
6
  "license": "MIT",