@pax2pay/model-banking 0.0.11 → 0.0.12

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.
@@ -7,14 +7,10 @@ export class Transactions extends rest.Collection<gracely.Error> {
7
7
  constructor(client: http.Client) {
8
8
  super(client)
9
9
  }
10
- async create(
11
- organization: string,
12
- account: string,
13
- transaction: Transaction.Creatable
14
- ): Promise<Transaction | gracely.Error> {
15
- return this.client.post<Transaction>(`/account/${account}/transaction`, transaction, { organization: organization })
10
+ async create(account: string, transaction: Transaction.Creatable): Promise<Transaction | gracely.Error> {
11
+ return this.client.post<Transaction>(`/account/${account}/transaction`, transaction)
16
12
  }
17
- async list(organization: string, account: string): Promise<Transaction[] | gracely.Error> {
18
- return this.client.get<Transaction[]>(`/account/${account}/transaction`, { organization: organization })
13
+ async list(account: string): Promise<Transaction[] | gracely.Error> {
14
+ return this.client.get<Transaction[]>(`/account/${account}/transaction`)
19
15
  }
20
16
  }
package/Client/index.ts CHANGED
@@ -2,25 +2,27 @@ import * as gracely from "gracely"
2
2
  import * as http from "cloudly-http"
3
3
  import * as rest from "cloudly-rest"
4
4
  import { Accounts } from "./Accounts"
5
- import { Decisions } from "./Decisions"
6
5
  import { Operations } from "./Operations"
7
6
  import { Organizations } from "./Organizations"
8
- import { Queue } from "./Queue"
9
7
  import { Transactions } from "./Transactions"
10
8
  import { Version } from "./Version"
11
9
 
12
10
  export class Client extends rest.Client<gracely.Error> {
13
- readonly account = new Accounts(this.client)
14
- readonly decision = new Decisions(this.client)
15
- readonly operation = new Operations(this.client)
16
- readonly organization = new Organizations(this.client)
17
- readonly queue = new Queue(this.client)
18
- readonly transaction = new Transactions(this.client)
11
+ realm?: string
12
+ organization?: string
13
+ readonly accounts = new Accounts(this.client)
14
+ readonly operations = new Operations(this.client)
15
+ readonly organizations = new Organizations(this.client)
16
+ readonly transactions = new Transactions(this.client)
19
17
  readonly version = new Version(this.client)
20
18
 
21
19
  static create<T = Record<string, any>>(server: string, key: string, load?: (client: http.Client) => T): Client & T {
22
20
  let httpClient: http.Client<gracely.Error>
23
- const result = new Client((httpClient = new http.Client<gracely.Error>(server, key)))
21
+ const result: Client = new Client(
22
+ (httpClient = new http.Client<gracely.Error>(server, key, {
23
+ appendHeader: () => ({ realm: result.realm, organization: result.organization }),
24
+ }))
25
+ )
24
26
  if (load)
25
27
  Object.assign(result, load(httpClient))
26
28
  return result as Client & T
@@ -4,6 +4,6 @@ import * as rest from "cloudly-rest";
4
4
  import { Transaction } from "../Transaction";
5
5
  export declare class Transactions extends rest.Collection<gracely.Error> {
6
6
  constructor(client: http.Client);
7
- create(organization: string, account: string, transaction: Transaction.Creatable): Promise<Transaction | gracely.Error>;
8
- list(organization: string, account: string): Promise<Transaction[] | gracely.Error>;
7
+ create(account: string, transaction: Transaction.Creatable): Promise<Transaction | gracely.Error>;
8
+ list(account: string): Promise<Transaction[] | gracely.Error>;
9
9
  }
@@ -3,11 +3,11 @@ export class Transactions extends rest.Collection {
3
3
  constructor(client) {
4
4
  super(client);
5
5
  }
6
- async create(organization, account, transaction) {
7
- return this.client.post(`/account/${account}/transaction`, transaction, { organization: organization });
6
+ async create(account, transaction) {
7
+ return this.client.post(`/account/${account}/transaction`, transaction);
8
8
  }
9
- async list(organization, account) {
10
- return this.client.get(`/account/${account}/transaction`, { organization: organization });
9
+ async list(account) {
10
+ return this.client.get(`/account/${account}/transaction`);
11
11
  }
12
12
  }
13
13
  //# sourceMappingURL=Transactions.js.map
@@ -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,CACX,YAAoB,EACpB,OAAe,EACf,WAAkC;QAElC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAc,YAAY,OAAO,cAAc,EAAE,WAAW,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CAAA;IACrH,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,YAAoB,EAAE,OAAe;QAC/C,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAgB,YAAY,OAAO,cAAc,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CAAA;IACzG,CAAC;CACD"}
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"}
@@ -2,19 +2,17 @@ import * as gracely from "gracely";
2
2
  import * as http from "cloudly-http";
3
3
  import * as rest from "cloudly-rest";
4
4
  import { Accounts } from "./Accounts";
5
- import { Decisions } from "./Decisions";
6
5
  import { Operations } from "./Operations";
7
6
  import { Organizations } from "./Organizations";
8
- import { Queue } from "./Queue";
9
7
  import { Transactions } from "./Transactions";
10
8
  import { Version } from "./Version";
11
9
  export declare class Client extends rest.Client<gracely.Error> {
12
- readonly account: Accounts;
13
- readonly decision: Decisions;
14
- readonly operation: Operations;
15
- readonly organization: Organizations;
16
- readonly queue: Queue;
17
- readonly transaction: Transactions;
10
+ realm?: string;
11
+ organization?: string;
12
+ readonly accounts: Accounts;
13
+ readonly operations: Operations;
14
+ readonly organizations: Organizations;
15
+ readonly transactions: Transactions;
18
16
  readonly version: Version;
19
17
  static create<T = Record<string, any>>(server: string, key: string, load?: (client: http.Client) => T): Client & T;
20
18
  }
@@ -1,26 +1,24 @@
1
1
  import * as http from "cloudly-http";
2
2
  import * as rest from "cloudly-rest";
3
3
  import { Accounts } from "./Accounts";
4
- import { Decisions } from "./Decisions";
5
4
  import { Operations } from "./Operations";
6
5
  import { Organizations } from "./Organizations";
7
- import { Queue } from "./Queue";
8
6
  import { Transactions } from "./Transactions";
9
7
  import { Version } from "./Version";
10
8
  export class Client extends rest.Client {
11
9
  constructor() {
12
10
  super(...arguments);
13
- this.account = new Accounts(this.client);
14
- this.decision = new Decisions(this.client);
15
- this.operation = new Operations(this.client);
16
- this.organization = new Organizations(this.client);
17
- this.queue = new Queue(this.client);
18
- this.transaction = new Transactions(this.client);
11
+ this.accounts = new Accounts(this.client);
12
+ this.operations = new Operations(this.client);
13
+ this.organizations = new Organizations(this.client);
14
+ this.transactions = new Transactions(this.client);
19
15
  this.version = new Version(this.client);
20
16
  }
21
17
  static create(server, key, load) {
22
18
  let httpClient;
23
- const result = new Client((httpClient = new http.Client(server, key)));
19
+ const result = new Client((httpClient = new http.Client(server, key, {
20
+ appendHeader: () => ({ realm: result.realm, organization: result.organization }),
21
+ })));
24
22
  if (load)
25
23
  Object.assign(result, load(httpClient));
26
24
  return result;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../","sources":["Client/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AACpC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC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transaction";
8
8
  export { Decision, Reviewable } from "./monitoring";
9
9
  export { Client } from "./Client";
10
- //# sourceMappingURL=index.js.map
10
+ //# sourceMappingURL=pax2pay.js.map
@@ -0,0 +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"}
package/index.ts CHANGED
@@ -1,9 +1,2 @@
1
- export { Account } from "./Account"
2
- export { Balances } from "./Balances"
3
- export { Event } from "./Event"
4
- export { Operation } from "./Operation"
5
- export { Organization } from "./Organization"
6
- export { Rail } from "./Rail"
7
- export { Transaction } from "./Transaction"
8
- export { Decision, Reviewable } from "./monitoring"
9
- export { Client } from "./Client"
1
+ import * as pax2pay from "./pax2pay"
2
+ export { pax2pay }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pax2pay/model-banking",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "Library containing data model types and functions for the Pax2Pay Banking API.",
5
5
  "author": "Pax2Pay Ltd",
6
6
  "license": "MIT",
package/pax2pay.ts ADDED
@@ -0,0 +1,9 @@
1
+ export { Account } from "./Account"
2
+ export { Balances } from "./Balances"
3
+ export { Event } from "./Event"
4
+ export { Operation } from "./Operation"
5
+ export { Organization } from "./Organization"
6
+ export { Rail } from "./Rail"
7
+ export { Transaction } from "./Transaction"
8
+ export { Decision, Reviewable } from "./monitoring"
9
+ export { Client } from "./Client"
package/tsconfig.json CHANGED
@@ -6,10 +6,10 @@
6
6
  "sourceRoot": "../",
7
7
  "outDir": "dist",
8
8
  "baseUrl": ".",
9
- "allowSyntheticDefaultImports":true,
9
+ "allowSyntheticDefaultImports": true,
10
10
  "types": []
11
11
  },
12
12
  "files": [
13
- "index.ts",
13
+ "pax2pay.ts",
14
14
  ]
15
15
  }
@@ -1,9 +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
- export declare class Decisions extends rest.Collection<gracely.Error> {
6
- constructor(client: http.Client);
7
- create(realm: string, transaction: string, decision: Decision.Creatable): Promise<Decision | gracely.Error>;
8
- list(realm: string): Promise<Decision[] | gracely.Error>;
9
- }
@@ -1,13 +0,0 @@
1
- import * as rest from "cloudly-rest";
2
- export class Decisions extends rest.Collection {
3
- constructor(client) {
4
- super(client);
5
- }
6
- async create(realm, transaction, decision) {
7
- return this.client.post(`/monitor/decision/${transaction}`, decision, { realm: realm });
8
- }
9
- async list(realm) {
10
- return this.client.get(`/monitor/decision`, { realm: realm });
11
- }
12
- }
13
- //# sourceMappingURL=Decisions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Decisions.js","sourceRoot":"../","sources":["Client/Decisions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AAGpC,MAAM,OAAO,SAAU,SAAQ,IAAI,CAAC,UAAyB;IAC5D,YAAY,MAAmB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAA;IACd,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,KAAa,EAAE,WAAmB,EAAE,QAA4B;QAC5E,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAW,qBAAqB,WAAW,EAAE,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;IAClG,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,KAAa;QACvB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAa,mBAAmB,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;IAC1E,CAAC;CACD"}
@@ -1,9 +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
- export declare class Queue extends rest.Collection<gracely.Error> {
6
- constructor(client: http.Client);
7
- change(realm: string, transaction: string, comment: string): Promise<Reviewable | gracely.Error>;
8
- list(realm: string): Promise<Reviewable[] | gracely.Error>;
9
- }
@@ -1,13 +0,0 @@
1
- import * as rest from "cloudly-rest";
2
- export class Queue extends rest.Collection {
3
- constructor(client) {
4
- super(client);
5
- }
6
- async change(realm, transaction, comment) {
7
- return this.client.patch(`/monitor/queue/${transaction}`, comment, { realm: realm });
8
- }
9
- async list(realm) {
10
- return this.client.get(`/monitor/queue`, { realm: realm });
11
- }
12
- }
13
- //# sourceMappingURL=Queue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Queue.js","sourceRoot":"../","sources":["Client/Queue.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AAGpC,MAAM,OAAO,KAAM,SAAQ,IAAI,CAAC,UAAyB;IACxD,YAAY,MAAmB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAA;IACd,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,KAAa,EAAE,WAAmB,EAAE,OAAe;QAC/D,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAa,kBAAkB,WAAW,EAAE,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;IACjG,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,KAAa;QACvB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAe,gBAAgB,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;IACzE,CAAC;CACD"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../","sources":["index.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"}
File without changes