@pax2pay/model-banking 0.1.54 → 0.1.55

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/Realm/index.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { isly } from "isly"
2
+ import { Supplier as modelSupplier } from "../Supplier"
2
3
 
3
- export const Realms = ["test", "testUK", "uk", "eu"] as const
4
- export type Realm = typeof Realms[number]
4
+ export type Realm = typeof Realm.realms[number]
5
5
 
6
6
  export namespace Realm {
7
- export const realms: Realm[] = [...Realms]
7
+ export const realms = ["test", "testUK", "uk", "eu"] as const
8
8
  export const type: isly.Type<Realm> = isly.union(
9
9
  isly.string("test"),
10
10
  isly.string("testUK"),
@@ -15,4 +15,22 @@ export namespace Realm {
15
15
  export function toString(): string {
16
16
  return realms.toString().replaceAll(",", ", ") + "."
17
17
  }
18
+ export const suppliers: Record<Realm, modelSupplier[]> = {
19
+ test: ["paxgiro"],
20
+ testUK: ["clearbank"],
21
+ uk: ["clearbank"],
22
+ eu: [],
23
+ }
24
+ export interface Suppliers extends Record<Realm, modelSupplier[]> {
25
+ test: ["paxgiro"]
26
+ testUK: ["clearbank"]
27
+ uk: ["clearbank"]
28
+ eu: []
29
+ }
30
+ export type Supplier<P extends keyof Suppliers> = Pick<Suppliers, P>[P][number]
31
+ export namespace Supplier {
32
+ export function is(realm: Realm, supplier: modelSupplier | any): supplier is Supplier<Realm> {
33
+ return suppliers[realm].includes(supplier)
34
+ }
35
+ }
18
36
  }
@@ -1,9 +1,20 @@
1
1
  import { isly } from "isly";
2
- export declare const Realms: readonly ["test", "testUK", "uk", "eu"];
3
- export type Realm = typeof Realms[number];
2
+ import { Supplier as modelSupplier } from "../Supplier";
3
+ export type Realm = typeof Realm.realms[number];
4
4
  export declare namespace Realm {
5
- const realms: Realm[];
5
+ const realms: readonly ["test", "testUK", "uk", "eu"];
6
6
  const type: isly.Type<Realm>;
7
7
  const is: isly.Type.IsFunction<"eu" | "uk" | "test" | "testUK">;
8
8
  function toString(): string;
9
+ const suppliers: Record<Realm, modelSupplier[]>;
10
+ interface Suppliers extends Record<Realm, modelSupplier[]> {
11
+ test: ["paxgiro"];
12
+ testUK: ["clearbank"];
13
+ uk: ["clearbank"];
14
+ eu: [];
15
+ }
16
+ type Supplier<P extends keyof Suppliers> = Pick<Suppliers, P>[P][number];
17
+ namespace Supplier {
18
+ function is(realm: Realm, supplier: modelSupplier | any): supplier is Supplier<Realm>;
19
+ }
9
20
  }
@@ -1,13 +1,25 @@
1
1
  import { isly } from "isly";
2
- export const Realms = ["test", "testUK", "uk", "eu"];
3
2
  export var Realm;
4
3
  (function (Realm) {
5
- Realm.realms = [...Realms];
4
+ Realm.realms = ["test", "testUK", "uk", "eu"];
6
5
  Realm.type = isly.union(isly.string("test"), isly.string("testUK"), isly.string("uk"), isly.string("eu"));
7
6
  Realm.is = Realm.type.is;
8
7
  function toString() {
9
8
  return Realm.realms.toString().replaceAll(",", ", ") + ".";
10
9
  }
11
10
  Realm.toString = toString;
11
+ Realm.suppliers = {
12
+ test: ["paxgiro"],
13
+ testUK: ["clearbank"],
14
+ uk: ["clearbank"],
15
+ eu: [],
16
+ };
17
+ let Supplier;
18
+ (function (Supplier) {
19
+ function is(realm, supplier) {
20
+ return Realm.suppliers[realm].includes(supplier);
21
+ }
22
+ Supplier.is = is;
23
+ })(Supplier = Realm.Supplier || (Realm.Supplier = {}));
12
24
  })(Realm || (Realm = {}));
13
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../","sources":["Realm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAU,CAAA;AAG7D,MAAM,KAAW,KAAK,CAYrB;AAZD,WAAiB,KAAK;IACR,YAAM,GAAY,CAAC,GAAG,M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,EAAE,CAAC,WAAW,CAAC;QACrB,EAAE,EAAE,CAAC,WAAW,CAAC;QACjB,EAAE,EAAE,EAAE;KACN,CAAA;IAQD,IAAiB,QAAQ,CAIxB;IAJD,WAAiB,QAAQ;QACxB,SAAgB,EAAE,CAAC,KAAY,EAAE,QAA6B;YAC7D,OAAO,MAAA,SAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;QAC3C,CAAC;QAFe,WAAE,KAEjB,CAAA;IACF,CAAC,EAJgB,QAAQ,GAAR,cAAQ,KAAR,cAAQ,QAIxB;AACF,CAAC,EA9BgB,KAAK,KAAL,KAAK,QA8BrB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pax2pay/model-banking",
3
- "version": "0.1.54",
3
+ "version": "0.1.55",
4
4
  "description": "Library containing data model types and functions for the Pax2Pay Banking API.",
5
5
  "author": "Pax2Pay Ltd",
6
6
  "license": "MIT",