@pax2pay/model-banking 0.1.128 → 0.1.130

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/Report/Cell.ts ADDED
@@ -0,0 +1,5 @@
1
+ export namespace Cell {
2
+ export function toCsv(value: number | string | undefined | null): string {
3
+ return `"${value ?? ""}"`
4
+ }
5
+ }
@@ -0,0 +1 @@
1
+ export type Delimiter = "|" | ","
package/Report/Row.ts ADDED
@@ -0,0 +1,11 @@
1
+ import { Cell } from "./Cell"
2
+ import { Delimiter } from "./Delimiter"
3
+ export namespace Row {
4
+ export function toCsv(
5
+ values: (number | string | undefined | null)[],
6
+ delimiter: Delimiter,
7
+ prefix?: number | string | null
8
+ ): string {
9
+ return [...(prefix ? [prefix] : []), ...values].map(v => Cell.toCsv(v)).join(delimiter)
10
+ }
11
+ }
@@ -0,0 +1,22 @@
1
+ import { Cell as ReportCell } from "./Cell"
2
+ import { Delimiter } from "./Delimiter"
3
+ import { Row as ReportRow } from "./Row"
4
+
5
+ export namespace Report {
6
+ export function toCsv(
7
+ header: string[],
8
+ rows: (number | string | undefined | null)[],
9
+ delimiter: Delimiter,
10
+ prefix?: number | string | null
11
+ ): string {
12
+ return [Row.toCsv(header, delimiter), ...(prefix ? rows.map(r => Cell.toCsv(prefix) + delimiter + r) : rows)].join(
13
+ "\n"
14
+ )
15
+ }
16
+ export namespace Cell {
17
+ export const toCsv = ReportCell.toCsv
18
+ }
19
+ export namespace Row {
20
+ export const toCsv = ReportRow.toCsv
21
+ }
22
+ }
package/Treasury/index.ts CHANGED
@@ -1,10 +1,19 @@
1
+ import { isoly } from "isoly"
1
2
  import { Account as TreasuryAccount } from "./Account"
2
3
  import { Balance as TreasuryBalance } from "./Balance"
3
4
  import { Fiat as TreasuryFiat } from "./Fiat"
4
5
  import { Transaction as TreasuryTransaction } from "./Transaction"
5
- export { Treasury } from "./Treasury"
6
6
 
7
+ export { Treasury } from "./Treasury"
7
8
  export namespace Treasury {
9
+ export function key(hour?: isoly.DateTime): isoly.DateTime {
10
+ const now = isoly.DateTime.now()
11
+ const latest = isoly.DateTime.getMinute(now) > 15 ? now : isoly.DateTime.previousHour(now)
12
+ return isoly.DateTime.truncate(
13
+ isoly.DateTime.invert(hour && isoly.DateTime.epoch(latest) > isoly.DateTime.epoch(hour) ? hour : latest),
14
+ "hours"
15
+ )
16
+ }
8
17
  export type Account = TreasuryAccount
9
18
  export type Transaction = TreasuryTransaction
10
19
  export type Balance = TreasuryBalance
@@ -0,0 +1,3 @@
1
+ export declare namespace Cell {
2
+ function toCsv(value: number | string | undefined | null): string;
3
+ }
@@ -0,0 +1,8 @@
1
+ export var Cell;
2
+ (function (Cell) {
3
+ function toCsv(value) {
4
+ return `"${value ?? ""}"`;
5
+ }
6
+ Cell.toCsv = toCsv;
7
+ })(Cell || (Cell = {}));
8
+ //# sourceMappingURL=Cell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cell.js","sourceRoot":"../","sources":["Report/Cell.ts"],"names":[],"mappings":"AAAA,MAAM,KAAW,IAAI,CAIpB;AAJD,WAAiB,IAAI;IACpB,SAAgB,KAAK,CAAC,KAAyC;QAC9D,OAAO,IAAI,KAAK,IAAI,EAAE,GAAG,CAAA;IAC1B,CAAC;IAFe,UAAK,QAEpB,CAAA;AACF,CAAC,EAJgB,IAAI,KAAJ,IAAI,QAIpB"}
@@ -0,0 +1 @@
1
+ export type Delimiter = "|" | ",";
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Delimiter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Delimiter.js","sourceRoot":"../","sources":["Report/Delimiter.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { Delimiter } from "./Delimiter";
2
+ export declare namespace Row {
3
+ function toCsv(values: (number | string | undefined | null)[], delimiter: Delimiter, prefix?: number | string | null): string;
4
+ }
@@ -0,0 +1,9 @@
1
+ import { Cell } from "./Cell";
2
+ export var Row;
3
+ (function (Row) {
4
+ function toCsv(values, delimiter, prefix) {
5
+ return [...(prefix ? [prefix] : []), ...values].map(v => Cell.toCsv(v)).join(delimiter);
6
+ }
7
+ Row.toCsv = toCsv;
8
+ })(Row || (Row = {}));
9
+ //# sourceMappingURL=Row.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Row.js","sourceRoot":"../","sources":["Report/Row.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,MAAM,KAAW,GAAG,CAQnB;AARD,WAAiB,GAAG;IACnB,SAAgB,KAAK,CACpB,MAA8C,EAC9C,SAAoB,EACpB,MAA+B;QAE/B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACxF,CAAC;IANe,SAAK,QAMpB,CAAA;AACF,CAAC,EARgB,GAAG,KAAH,GAAG,QAQnB"}
@@ -0,0 +1,12 @@
1
+ import { Cell as ReportCell } from "./Cell";
2
+ import { Delimiter } from "./Delimiter";
3
+ import { Row as ReportRow } from "./Row";
4
+ export declare namespace Report {
5
+ function toCsv(header: string[], rows: (number | string | undefined | null)[], delimiter: Delimiter, prefix?: number | string | null): string;
6
+ namespace Cell {
7
+ const toCsv: typeof ReportCell.toCsv;
8
+ }
9
+ namespace Row {
10
+ const toCsv: typeof ReportRow.toCsv;
11
+ }
12
+ }
@@ -0,0 +1,18 @@
1
+ import { Cell as ReportCell } from "./Cell";
2
+ import { Row as ReportRow } from "./Row";
3
+ export var Report;
4
+ (function (Report) {
5
+ function toCsv(header, rows, delimiter, prefix) {
6
+ return [Row.toCsv(header, delimiter), ...(prefix ? rows.map(r => Cell.toCsv(prefix) + delimiter + r) : rows)].join("\n");
7
+ }
8
+ Report.toCsv = toCsv;
9
+ let Cell;
10
+ (function (Cell) {
11
+ Cell.toCsv = ReportCell.toCsv;
12
+ })(Cell = Report.Cell || (Report.Cell = {}));
13
+ let Row;
14
+ (function (Row) {
15
+ Row.toCsv = ReportRow.toCsv;
16
+ })(Row = Report.Row || (Report.Row = {}));
17
+ })(Report || (Report = {}));
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../","sources":["Report/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,QAAQ,CAAA;AAE3C,OAAO,EAAE,GAAG,IAAI,SAAS,EAAE,MAAM,OAAO,CAAA;AAExC,MAAM,KAAW,MAAM,CAiBtB;AAjBD,WAAiB,MAAM;IACtB,SAAgB,KAAK,CACpB,MAAgB,EAChB,IAA4C,EAC5C,SAAoB,EACpB,MAA+B;QAE/B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CACjH,IAAI,CACJ,CAAA;IACF,CAAC;IATe,YAAK,QASpB,CAAA;IACD,IAAiB,IAAI,CAEpB;IAFD,WAAiB,IAAI;QACP,UAAK,GAAG,UAAU,CAAC,KAAK,CAAA;IACtC,CAAC,EAFgB,IAAI,GAAJ,WAAI,KAAJ,WAAI,QAEpB;IACD,IAAiB,GAAG,CAEnB;IAFD,WAAiB,GAAG;QACN,SAAK,GAAG,SAAS,CAAC,KAAK,CAAA;IACrC,CAAC,EAFgB,GAAG,GAAH,UAAG,KAAH,UAAG,QAEnB;AACF,CAAC,EAjBgB,MAAM,KAAN,MAAM,QAiBtB"}
@@ -1,9 +1,11 @@
1
+ import { isoly } from "isoly";
1
2
  import { Account as TreasuryAccount } from "./Account";
2
3
  import { Balance as TreasuryBalance } from "./Balance";
3
4
  import { Fiat as TreasuryFiat } from "./Fiat";
4
5
  import { Transaction as TreasuryTransaction } from "./Transaction";
5
6
  export { Treasury } from "./Treasury";
6
7
  export declare namespace Treasury {
8
+ function key(hour?: isoly.DateTime): isoly.DateTime;
7
9
  type Account = TreasuryAccount;
8
10
  type Transaction = TreasuryTransaction;
9
11
  type Balance = TreasuryBalance;
@@ -1,7 +1,14 @@
1
+ import { isoly } from "isoly";
1
2
  import { Account as TreasuryAccount } from "./Account";
2
3
  import { Balance as TreasuryBalance } from "./Balance";
3
4
  export var Treasury;
4
5
  (function (Treasury) {
6
+ function key(hour) {
7
+ const now = isoly.DateTime.now();
8
+ const latest = isoly.DateTime.getMinute(now) > 15 ? now : isoly.DateTime.previousHour(now);
9
+ return isoly.DateTime.truncate(isoly.DateTime.invert(hour && isoly.DateTime.epoch(latest) > isoly.DateTime.epoch(hour) ? hour : latest), "hours");
10
+ }
11
+ Treasury.key = key;
5
12
  Treasury.Balance = TreasuryBalance;
6
13
  let Account;
7
14
  (function (Account) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../","sources":["Treasury/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,WAAW,CAAA;AAKtD,MAAM,KAAW,QAAQ,CAexB;AAfD,WAAiB,QAAQ;IAKX,gBAAO,GAAG,eAAe,CAAA;IACtC,IAAiB,OAAO,CAQvB;IARD,WAAiB,OAAO;QAEV,iBAAS,GAAG,eAAe,CAAC,SAAS,CAAA;QAErC,gBAAQ,GAAG,eAAe,CAAC,QAAQ,CAAA;QAEnC,iBAAS,GAAG,eAAe,CAAC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,GAAG,eAAe,CAAC,SAAS,CAAA;QACrC,UAAE,GAAG,eAAe,CAAC,EAAE,CAAA;IACrC,CAAC,EARgB,OAAO,GAAP,gBAAO,KAAP,gBAAO,QAQvB;AACF,CAAC,EAvBgB,QAAQ,KAAR,QAAQ,QAuBxB"}
package/dist/pax2pay.d.ts CHANGED
@@ -18,3 +18,4 @@ export { Authorization } from "./Authorization";
18
18
  export { Identifier } from "./Identifier";
19
19
  export { Amount } from "./Amount";
20
20
  export { Amounts } from "./Amounts";
21
+ export { Report } from "./Report";
package/dist/pax2pay.js CHANGED
@@ -18,4 +18,5 @@ export { Authorization } from "./Authorization";
18
18
  export { Identifier } from "./Identifier";
19
19
  export { Amount } from "./Amount";
20
20
  export { Amounts } from "./Amounts";
21
+ export { Report } from "./Report";
21
22
  //# 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,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,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;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAA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EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,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.1.128",
3
+ "version": "0.1.130",
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 CHANGED
@@ -18,3 +18,4 @@ export { Authorization } from "./Authorization"
18
18
  export { Identifier } from "./Identifier"
19
19
  export { Amount } from "./Amount"
20
20
  export { Amounts } from "./Amounts"
21
+ export { Report } from "./Report"