@pax2pay/model-banking 0.1.671 → 0.1.673
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/Creatable.ts +3 -1
- package/Account/Details.ts +11 -10
- package/Account/Type.ts +1 -1
- package/Account/index.ts +14 -12
- package/Amount.ts +1 -2
- package/Amounts.ts +3 -2
- package/Balance.ts +18 -12
- package/Balances.ts +3 -2
- package/Card/Creatable.ts +12 -10
- package/Card/Preset.ts +1 -1
- package/Card/Restriction/Merchant.ts +1 -1
- package/Card/Restriction/index.ts +3 -1
- package/Card/Scheme.ts +1 -1
- package/Card/index.ts +27 -25
- package/Client/Cards.ts +3 -0
- package/Operation/Change.ts +8 -6
- package/Operation/Changes.ts +1 -1
- package/Operation/Creatable.ts +9 -7
- package/Operation/Status.ts +1 -1
- package/Operation/index.ts +9 -7
- package/Organization/Changeable.ts +3 -4
- package/Organization/Contact/Address/Default.ts +10 -8
- package/Organization/Contact/Address/GB.ts +9 -7
- package/Organization/Contact/Address/SE.ts +3 -6
- package/Organization/Contact/Address/index.ts +3 -2
- package/Organization/Contact/Addresses.ts +8 -6
- package/Organization/Contact/Creatable.ts +9 -7
- package/Organization/Creatable.ts +9 -7
- package/Organization/Risk.ts +1 -2
- package/Organization/index.ts +14 -12
- package/Rail/Address/index.ts +11 -10
- package/Settlement/Amount.ts +3 -4
- package/Settlement/Creatable.ts +9 -7
- package/Settlement/Entry/Creatable.ts +3 -1
- package/Settlement/Entry/index.ts +1 -1
- package/Settlement/Status.ts +3 -5
- package/Settlement/Total.ts +8 -6
- package/Settlement/Totals.ts +3 -1
- package/Settlement/index.ts +10 -8
- package/Supplier/index.ts +1 -1
- package/Transaction/Creatable.ts +19 -15
- package/Transaction/Exchange.ts +8 -6
- package/Transaction/Note.ts +11 -10
- package/Transaction/Status.ts +3 -1
- package/Transaction/index.ts +32 -30
- package/Treasury/Snapshot/Check/Base.ts +1 -4
- package/Treasury/Snapshot/Check/Checks.ts +1 -1
- package/Treasury/Snapshot/Check/index.ts +11 -9
- package/Treasury/Snapshot/index.ts +18 -19
- package/dist/cjs/Account/Creatable.js +3 -1
- package/dist/cjs/Account/Creatable.js.map +1 -1
- package/dist/cjs/Account/Details.js +7 -6
- package/dist/cjs/Account/Details.js.map +1 -1
- package/dist/cjs/Account/Type.js +1 -1
- package/dist/cjs/Account/Type.js.map +1 -1
- package/dist/cjs/Account/index.d.ts +2 -193
- package/dist/cjs/Account/index.js +4 -2
- package/dist/cjs/Account/index.js.map +1 -1
- package/dist/cjs/Amount.js +1 -1
- package/dist/cjs/Amount.js.map +1 -1
- package/dist/cjs/Amounts.js +3 -1
- package/dist/cjs/Amounts.js.map +1 -1
- package/dist/cjs/Balance.d.ts +9 -14
- package/dist/cjs/Balance.js +25 -15
- package/dist/cjs/Balance.js.map +1 -1
- package/dist/cjs/Balances.d.ts +1 -192
- package/dist/cjs/Balances.js +3 -1
- package/dist/cjs/Balances.js.map +1 -1
- package/dist/cjs/Card/Creatable.js +4 -2
- package/dist/cjs/Card/Creatable.js.map +1 -1
- package/dist/cjs/Card/Expiry.d.ts +1 -1
- package/dist/cjs/Card/Preset.js +1 -1
- package/dist/cjs/Card/Preset.js.map +1 -1
- package/dist/cjs/Card/Restriction/Merchant.js +1 -1
- package/dist/cjs/Card/Restriction/Merchant.js.map +1 -1
- package/dist/cjs/Card/Restriction/index.d.ts +1 -193
- package/dist/cjs/Card/Restriction/index.js +3 -1
- package/dist/cjs/Card/Restriction/index.js.map +1 -1
- package/dist/cjs/Card/Scheme.js +1 -1
- package/dist/cjs/Card/Scheme.js.map +1 -1
- package/dist/cjs/Card/index.js +4 -2
- package/dist/cjs/Card/index.js.map +1 -1
- package/dist/cjs/Client/Cards.d.ts +3 -0
- package/dist/cjs/Client/Cards.js.map +1 -1
- package/dist/cjs/Operation/Change.js +4 -2
- package/dist/cjs/Operation/Change.js.map +1 -1
- package/dist/cjs/Operation/Changes.js +1 -1
- package/dist/cjs/Operation/Changes.js.map +1 -1
- package/dist/cjs/Operation/Creatable.js +4 -2
- package/dist/cjs/Operation/Creatable.js.map +1 -1
- package/dist/cjs/Operation/Status.js +1 -1
- package/dist/cjs/Operation/Status.js.map +1 -1
- package/dist/cjs/Operation/index.js +4 -2
- package/dist/cjs/Operation/index.js.map +1 -1
- package/dist/cjs/Organization/Changeable.js +3 -4
- package/dist/cjs/Organization/Changeable.js.map +1 -1
- package/dist/cjs/Organization/Contact/Address/Default.js +4 -2
- package/dist/cjs/Organization/Contact/Address/Default.js.map +1 -1
- package/dist/cjs/Organization/Contact/Address/GB.js +4 -2
- package/dist/cjs/Organization/Contact/Address/GB.js.map +1 -1
- package/dist/cjs/Organization/Contact/Address/SE.js +3 -6
- package/dist/cjs/Organization/Contact/Address/SE.js.map +1 -1
- package/dist/cjs/Organization/Contact/Address/index.js +3 -1
- package/dist/cjs/Organization/Contact/Address/index.js.map +1 -1
- package/dist/cjs/Organization/Contact/Addresses.js +4 -2
- package/dist/cjs/Organization/Contact/Addresses.js.map +1 -1
- package/dist/cjs/Organization/Contact/Creatable.js +5 -3
- package/dist/cjs/Organization/Contact/Creatable.js.map +1 -1
- package/dist/cjs/Organization/Creatable.js +4 -2
- package/dist/cjs/Organization/Creatable.js.map +1 -1
- package/dist/cjs/Organization/Risk.js +1 -1
- package/dist/cjs/Organization/Risk.js.map +1 -1
- package/dist/cjs/Organization/index.js +4 -2
- package/dist/cjs/Organization/index.js.map +1 -1
- package/dist/cjs/Rail/Address/Card.d.ts +1 -1
- package/dist/cjs/Rail/Address/index.d.ts +1 -1
- package/dist/cjs/Rail/Address/index.js +4 -2
- package/dist/cjs/Rail/Address/index.js.map +1 -1
- package/dist/cjs/Settlement/Amount.js +3 -4
- package/dist/cjs/Settlement/Amount.js.map +1 -1
- package/dist/cjs/Settlement/Creatable.js +4 -2
- package/dist/cjs/Settlement/Creatable.js.map +1 -1
- package/dist/cjs/Settlement/Entry/Creatable.d.ts +1 -6
- package/dist/cjs/Settlement/Entry/Creatable.js +3 -1
- package/dist/cjs/Settlement/Entry/Creatable.js.map +1 -1
- package/dist/cjs/Settlement/Entry/index.js +1 -1
- package/dist/cjs/Settlement/Entry/index.js.map +1 -1
- package/dist/cjs/Settlement/Status.js +3 -4
- package/dist/cjs/Settlement/Status.js.map +1 -1
- package/dist/cjs/Settlement/Total.js +4 -2
- package/dist/cjs/Settlement/Total.js.map +1 -1
- package/dist/cjs/Settlement/Totals.js +3 -1
- package/dist/cjs/Settlement/Totals.js.map +1 -1
- package/dist/cjs/Settlement/index.js +4 -2
- package/dist/cjs/Settlement/index.js.map +1 -1
- package/dist/cjs/Supplier/index.js +1 -1
- package/dist/cjs/Supplier/index.js.map +1 -1
- package/dist/cjs/Transaction/Amount/index.d.ts +1 -6
- package/dist/cjs/Transaction/Creatable.d.ts +3 -13
- package/dist/cjs/Transaction/Creatable.js +8 -4
- package/dist/cjs/Transaction/Creatable.js.map +1 -1
- package/dist/cjs/Transaction/Exchange.d.ts +1 -6
- package/dist/cjs/Transaction/Exchange.js +4 -2
- package/dist/cjs/Transaction/Exchange.js.map +1 -1
- package/dist/cjs/Transaction/Note.js +7 -6
- package/dist/cjs/Transaction/Note.js.map +1 -1
- package/dist/cjs/Transaction/PreTransaction/Authorization.d.ts +1 -6
- package/dist/cjs/Transaction/PreTransaction/Base.d.ts +2 -7
- package/dist/cjs/Transaction/PreTransaction/Incoming.d.ts +3 -8
- package/dist/cjs/Transaction/PreTransaction/Outgoing.d.ts +2 -7
- package/dist/cjs/Transaction/PreTransaction/index.d.ts +6 -21
- package/dist/cjs/Transaction/Status.js +3 -1
- package/dist/cjs/Transaction/Status.js.map +1 -1
- package/dist/cjs/Transaction/index.d.ts +10 -25
- package/dist/cjs/Transaction/index.js +8 -6
- package/dist/cjs/Transaction/index.js.map +1 -1
- package/dist/cjs/Treasury/Snapshot/Check/Base.js +1 -4
- package/dist/cjs/Treasury/Snapshot/Check/Base.js.map +1 -1
- package/dist/cjs/Treasury/Snapshot/Check/Checks.js +1 -1
- package/dist/cjs/Treasury/Snapshot/Check/Checks.js.map +1 -1
- package/dist/cjs/Treasury/Snapshot/Check/index.js +4 -2
- package/dist/cjs/Treasury/Snapshot/Check/index.js.map +1 -1
- package/dist/cjs/Treasury/Snapshot/index.js +5 -6
- package/dist/cjs/Treasury/Snapshot/index.js.map +1 -1
- package/dist/cjs/Treasury/Transaction/Creatable.d.ts +1 -1
- package/dist/cjs/policy/Mcc/Action.js +1 -1
- package/dist/cjs/policy/Mcc/Action.js.map +1 -1
- package/dist/cjs/policy/Mcc/Creatable.js +4 -2
- package/dist/cjs/policy/Mcc/Creatable.js.map +1 -1
- package/dist/cjs/policy/Mcc/Group.js +6 -8
- package/dist/cjs/policy/Mcc/Group.js.map +1 -1
- package/dist/cjs/policy/Mcc/Updatable.js +3 -1
- package/dist/cjs/policy/Mcc/Updatable.js.map +1 -1
- package/dist/cjs/policy/Mcc/index.js +4 -2
- package/dist/cjs/policy/Mcc/index.js.map +1 -1
- package/dist/mjs/Account/Creatable.js +3 -1
- package/dist/mjs/Account/Creatable.js.map +1 -1
- package/dist/mjs/Account/Details.js +7 -6
- package/dist/mjs/Account/Details.js.map +1 -1
- package/dist/mjs/Account/Type.js +1 -1
- package/dist/mjs/Account/Type.js.map +1 -1
- package/dist/mjs/Account/index.d.ts +2 -193
- package/dist/mjs/Account/index.js +4 -2
- package/dist/mjs/Account/index.js.map +1 -1
- package/dist/mjs/Amount.js +1 -1
- package/dist/mjs/Amount.js.map +1 -1
- package/dist/mjs/Amounts.js +3 -1
- package/dist/mjs/Amounts.js.map +1 -1
- package/dist/mjs/Balance.d.ts +9 -14
- package/dist/mjs/Balance.js +15 -8
- package/dist/mjs/Balance.js.map +1 -1
- package/dist/mjs/Balances.d.ts +1 -192
- package/dist/mjs/Balances.js +3 -1
- package/dist/mjs/Balances.js.map +1 -1
- package/dist/mjs/Card/Creatable.js +4 -2
- package/dist/mjs/Card/Creatable.js.map +1 -1
- package/dist/mjs/Card/Expiry.d.ts +1 -1
- package/dist/mjs/Card/Preset.js +1 -1
- package/dist/mjs/Card/Preset.js.map +1 -1
- package/dist/mjs/Card/Restriction/Merchant.js +1 -1
- package/dist/mjs/Card/Restriction/Merchant.js.map +1 -1
- package/dist/mjs/Card/Restriction/index.d.ts +1 -193
- package/dist/mjs/Card/Restriction/index.js +3 -1
- package/dist/mjs/Card/Restriction/index.js.map +1 -1
- package/dist/mjs/Card/Scheme.js +1 -1
- package/dist/mjs/Card/Scheme.js.map +1 -1
- package/dist/mjs/Card/index.js +4 -2
- package/dist/mjs/Card/index.js.map +1 -1
- package/dist/mjs/Client/Cards.d.ts +3 -0
- package/dist/mjs/Client/Cards.js.map +1 -1
- package/dist/mjs/Operation/Change.js +4 -2
- package/dist/mjs/Operation/Change.js.map +1 -1
- package/dist/mjs/Operation/Changes.js +1 -1
- package/dist/mjs/Operation/Changes.js.map +1 -1
- package/dist/mjs/Operation/Creatable.js +4 -2
- package/dist/mjs/Operation/Creatable.js.map +1 -1
- package/dist/mjs/Operation/Status.js +1 -1
- package/dist/mjs/Operation/Status.js.map +1 -1
- package/dist/mjs/Operation/index.js +4 -2
- package/dist/mjs/Operation/index.js.map +1 -1
- package/dist/mjs/Organization/Changeable.js +3 -4
- package/dist/mjs/Organization/Changeable.js.map +1 -1
- package/dist/mjs/Organization/Contact/Address/Default.js +4 -2
- package/dist/mjs/Organization/Contact/Address/Default.js.map +1 -1
- package/dist/mjs/Organization/Contact/Address/GB.js +4 -2
- package/dist/mjs/Organization/Contact/Address/GB.js.map +1 -1
- package/dist/mjs/Organization/Contact/Address/SE.js +3 -6
- package/dist/mjs/Organization/Contact/Address/SE.js.map +1 -1
- package/dist/mjs/Organization/Contact/Address/index.js +3 -1
- package/dist/mjs/Organization/Contact/Address/index.js.map +1 -1
- package/dist/mjs/Organization/Contact/Addresses.js +4 -2
- package/dist/mjs/Organization/Contact/Addresses.js.map +1 -1
- package/dist/mjs/Organization/Contact/Creatable.js +5 -3
- package/dist/mjs/Organization/Contact/Creatable.js.map +1 -1
- package/dist/mjs/Organization/Creatable.js +4 -2
- package/dist/mjs/Organization/Creatable.js.map +1 -1
- package/dist/mjs/Organization/Risk.js +1 -1
- package/dist/mjs/Organization/Risk.js.map +1 -1
- package/dist/mjs/Organization/index.js +4 -2
- package/dist/mjs/Organization/index.js.map +1 -1
- package/dist/mjs/Rail/Address/Card.d.ts +1 -1
- package/dist/mjs/Rail/Address/index.d.ts +1 -1
- package/dist/mjs/Rail/Address/index.js +4 -2
- package/dist/mjs/Rail/Address/index.js.map +1 -1
- package/dist/mjs/Settlement/Amount.js +3 -4
- package/dist/mjs/Settlement/Amount.js.map +1 -1
- package/dist/mjs/Settlement/Creatable.js +4 -2
- package/dist/mjs/Settlement/Creatable.js.map +1 -1
- package/dist/mjs/Settlement/Entry/Creatable.d.ts +1 -6
- package/dist/mjs/Settlement/Entry/Creatable.js +3 -1
- package/dist/mjs/Settlement/Entry/Creatable.js.map +1 -1
- package/dist/mjs/Settlement/Entry/index.js +1 -1
- package/dist/mjs/Settlement/Entry/index.js.map +1 -1
- package/dist/mjs/Settlement/Status.js +3 -4
- package/dist/mjs/Settlement/Status.js.map +1 -1
- package/dist/mjs/Settlement/Total.js +4 -2
- package/dist/mjs/Settlement/Total.js.map +1 -1
- package/dist/mjs/Settlement/Totals.js +3 -1
- package/dist/mjs/Settlement/Totals.js.map +1 -1
- package/dist/mjs/Settlement/index.js +4 -2
- package/dist/mjs/Settlement/index.js.map +1 -1
- package/dist/mjs/Supplier/index.js +1 -1
- package/dist/mjs/Supplier/index.js.map +1 -1
- package/dist/mjs/Transaction/Amount/index.d.ts +1 -6
- package/dist/mjs/Transaction/Creatable.d.ts +3 -13
- package/dist/mjs/Transaction/Creatable.js +8 -4
- package/dist/mjs/Transaction/Creatable.js.map +1 -1
- package/dist/mjs/Transaction/Exchange.d.ts +1 -6
- package/dist/mjs/Transaction/Exchange.js +4 -2
- package/dist/mjs/Transaction/Exchange.js.map +1 -1
- package/dist/mjs/Transaction/Note.js +7 -6
- package/dist/mjs/Transaction/Note.js.map +1 -1
- package/dist/mjs/Transaction/PreTransaction/Authorization.d.ts +1 -6
- package/dist/mjs/Transaction/PreTransaction/Base.d.ts +2 -7
- package/dist/mjs/Transaction/PreTransaction/Incoming.d.ts +3 -8
- package/dist/mjs/Transaction/PreTransaction/Outgoing.d.ts +2 -7
- package/dist/mjs/Transaction/PreTransaction/index.d.ts +6 -21
- package/dist/mjs/Transaction/Status.js +3 -1
- package/dist/mjs/Transaction/Status.js.map +1 -1
- package/dist/mjs/Transaction/index.d.ts +10 -25
- package/dist/mjs/Transaction/index.js +8 -6
- package/dist/mjs/Transaction/index.js.map +1 -1
- package/dist/mjs/Treasury/Snapshot/Check/Base.js +1 -4
- package/dist/mjs/Treasury/Snapshot/Check/Base.js.map +1 -1
- package/dist/mjs/Treasury/Snapshot/Check/Checks.js +1 -1
- package/dist/mjs/Treasury/Snapshot/Check/Checks.js.map +1 -1
- package/dist/mjs/Treasury/Snapshot/Check/index.js +4 -2
- package/dist/mjs/Treasury/Snapshot/Check/index.js.map +1 -1
- package/dist/mjs/Treasury/Snapshot/index.js +5 -6
- package/dist/mjs/Treasury/Snapshot/index.js.map +1 -1
- package/dist/mjs/Treasury/Transaction/Creatable.d.ts +1 -1
- package/dist/mjs/policy/Mcc/Action.js +1 -1
- package/dist/mjs/policy/Mcc/Action.js.map +1 -1
- package/dist/mjs/policy/Mcc/Creatable.js +4 -2
- package/dist/mjs/policy/Mcc/Creatable.js.map +1 -1
- package/dist/mjs/policy/Mcc/Group.js +6 -8
- package/dist/mjs/policy/Mcc/Group.js.map +1 -1
- package/dist/mjs/policy/Mcc/Updatable.js +3 -1
- package/dist/mjs/policy/Mcc/Updatable.js.map +1 -1
- package/dist/mjs/policy/Mcc/index.js +4 -2
- package/dist/mjs/policy/Mcc/index.js.map +1 -1
- package/package.json +1 -1
- package/policy/Mcc/Action.ts +1 -1
- package/policy/Mcc/Creatable.ts +10 -8
- package/policy/Mcc/Group.ts +6 -8
- package/policy/Mcc/Updatable.ts +3 -1
- package/policy/Mcc/index.ts +8 -6
package/Account/Creatable.ts
CHANGED
|
@@ -18,5 +18,7 @@ export namespace Creatable {
|
|
|
18
18
|
export const typeZod = zod.enum(values)
|
|
19
19
|
}
|
|
20
20
|
export const type = isly.object<Creatable>({ name: isly.string(), location: Location.type.optional() })
|
|
21
|
-
export const typeZod = zod
|
|
21
|
+
export const typeZod = zod
|
|
22
|
+
.object({ name: zod.string(), location: Location.typeZod.optional() })
|
|
23
|
+
.meta({ id: "Account.Creatable" })
|
|
22
24
|
}
|
package/Account/Details.ts
CHANGED
|
@@ -17,12 +17,14 @@ export namespace Details {
|
|
|
17
17
|
reference: isly.string().optional(),
|
|
18
18
|
addresses: Rail.Address.type.array(),
|
|
19
19
|
})
|
|
20
|
-
export const typeZod: zod.ZodType<Details> = zod
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
export const typeZod: zod.ZodType<Details> = zod
|
|
21
|
+
.object({
|
|
22
|
+
supplier: Supplier.typeZod,
|
|
23
|
+
currencies: zodHelper.currency.array(),
|
|
24
|
+
reference: zod.string().optional(),
|
|
25
|
+
addresses: Rail.Address.typeZod.array(),
|
|
26
|
+
})
|
|
27
|
+
.meta({ id: "Account.Details" })
|
|
26
28
|
export interface Creatable {
|
|
27
29
|
supplier: Supplier
|
|
28
30
|
currency: isoly.Currency
|
|
@@ -32,9 +34,8 @@ export namespace Details {
|
|
|
32
34
|
supplier: Supplier.type,
|
|
33
35
|
currency: isly.string(isoly.Currency.values),
|
|
34
36
|
})
|
|
35
|
-
export const typeZod: zod.ZodType<Creatable> = zod
|
|
36
|
-
supplier: Supplier.typeZod,
|
|
37
|
-
|
|
38
|
-
})
|
|
37
|
+
export const typeZod: zod.ZodType<Creatable> = zod
|
|
38
|
+
.object({ supplier: Supplier.typeZod, currency: zodHelper.currency })
|
|
39
|
+
.meta({ id: "Account.Details.Creatable" })
|
|
39
40
|
}
|
|
40
41
|
}
|
package/Account/Type.ts
CHANGED
|
@@ -5,5 +5,5 @@ export type Type = (typeof Type.values)[number]
|
|
|
5
5
|
export namespace Type {
|
|
6
6
|
export const values = ["own funds", "emoney"] as const
|
|
7
7
|
export const type = isly.string<Type>(values)
|
|
8
|
-
export const typeZod = zod.enum(values)
|
|
8
|
+
export const typeZod = zod.enum(values).meta({ id: "Account.Type" })
|
|
9
9
|
}
|
package/Account/index.ts
CHANGED
|
@@ -43,18 +43,20 @@ export namespace Account {
|
|
|
43
43
|
status: AccountStatus.type,
|
|
44
44
|
type: Type.type,
|
|
45
45
|
})
|
|
46
|
-
export const typeZod = Creatable.typeZod
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
export const typeZod = Creatable.typeZod
|
|
47
|
+
.extend({
|
|
48
|
+
id: zod.string(),
|
|
49
|
+
created: zod.string().refine(isoly.DateTime.is),
|
|
50
|
+
organization: zod.string(),
|
|
51
|
+
balances: Balances.typeZod,
|
|
52
|
+
rails: Rail.Address.typeZod.array(),
|
|
53
|
+
details: Details.typeZod.optional(),
|
|
54
|
+
charges: AccountCharge.typeZod.optional(),
|
|
55
|
+
rules: zod.any().array().optional(),
|
|
56
|
+
status: AccountStatus.typeZod,
|
|
57
|
+
type: Type.typeZod,
|
|
58
|
+
})
|
|
59
|
+
.meta({ id: "Account" })
|
|
58
60
|
export function isIdentifier(value: cryptly.Identifier | any): value is cryptly.Identifier {
|
|
59
61
|
return cryptly.Identifier.is(value, 8)
|
|
60
62
|
}
|
package/Amount.ts
CHANGED
|
@@ -4,11 +4,10 @@ import { Amounts } from "./Amounts"
|
|
|
4
4
|
import { zod, zodHelper } from "./zod"
|
|
5
5
|
|
|
6
6
|
export type Amount = [isoly.Currency, number]
|
|
7
|
-
|
|
8
7
|
export namespace Amount {
|
|
9
8
|
export function toAmounts(amount?: Amount): Amounts {
|
|
10
9
|
return !amount ? {} : Object.fromEntries<number>([amount])
|
|
11
10
|
}
|
|
12
11
|
export const type = isly.tuple<Amount>(isly.string(isoly.Currency.values), isly.number())
|
|
13
|
-
export const typeZod: zod.ZodType<Amount> = zod.tuple([zodHelper.currency, zod.number()])
|
|
12
|
+
export const typeZod: zod.ZodType<Amount> = zod.tuple([zodHelper.currency, zod.number()]).meta({ id: "Amount" })
|
|
14
13
|
}
|
package/Amounts.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { isly } from "isly"
|
|
|
3
3
|
import { zod, zodHelper } from "./zod"
|
|
4
4
|
|
|
5
5
|
export type Amounts = Partial<Record<isoly.Currency, number>>
|
|
6
|
-
|
|
7
6
|
export namespace Amounts {
|
|
8
7
|
export function add(addendee: Amounts, addend: Amounts): Amounts {
|
|
9
8
|
return (Object.entries(addend) as [isoly.Currency, number][]).reduce(
|
|
@@ -20,5 +19,7 @@ export namespace Amounts {
|
|
|
20
19
|
)
|
|
21
20
|
}
|
|
22
21
|
export const type = isly.record<Amounts>(isly.string(isoly.Currency.values), isly.number())
|
|
23
|
-
export const typeZod: zod.ZodType<Amounts> = zod
|
|
22
|
+
export const typeZod: zod.ZodType<Amounts> = zod
|
|
23
|
+
.partialRecord(zodHelper.currency, zod.number())
|
|
24
|
+
.meta({ id: "Amounts" })
|
|
24
25
|
}
|
package/Balance.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isoly } from "isoly"
|
|
2
2
|
import { isly } from "isly"
|
|
3
|
+
import zod from "zod"
|
|
3
4
|
import { Amount } from "./Amount"
|
|
4
|
-
import { zod } from "./zod"
|
|
5
5
|
|
|
6
6
|
export type Balance = { available?: number; reserved?: Balance.Reserved }
|
|
7
7
|
export namespace Balance {
|
|
@@ -12,14 +12,18 @@ export namespace Balance {
|
|
|
12
12
|
export const typeZod = zod.enum(values)
|
|
13
13
|
}
|
|
14
14
|
export type Reserved = Partial<Record<Balance.Reserve, number>>
|
|
15
|
+
export namespace Reserved {
|
|
16
|
+
export const typeZod: zod.ZodType<Reserved> = zod
|
|
17
|
+
.partialRecord(Reserve.typeZod, zod.number())
|
|
18
|
+
.meta({ id: "Balance.Reserved" })
|
|
19
|
+
}
|
|
15
20
|
export const type = isly.object<Balance>({
|
|
16
21
|
available: isly.number().optional(),
|
|
17
|
-
reserved: isly.record<Reserved>(
|
|
18
|
-
})
|
|
19
|
-
export const typeZod = zod.object({
|
|
20
|
-
available: zod.number().optional(),
|
|
21
|
-
reserved: zod.partialRecord(Balance.Reserve.typeZod, zod.number().optional()).optional(),
|
|
22
|
+
reserved: isly.record<Reserved>(Reserve.type, isly.number().optional()).optional(),
|
|
22
23
|
})
|
|
24
|
+
export const typeZod = zod
|
|
25
|
+
.object({ available: zod.number().optional(), reserved: Reserved.typeZod.optional() })
|
|
26
|
+
.meta({ id: "Balance" })
|
|
23
27
|
export type Legacy = Partial<Record<Legacy.Entry, number>>
|
|
24
28
|
export namespace Legacy {
|
|
25
29
|
export type Entry = (typeof Entry.values)[number]
|
|
@@ -38,12 +42,14 @@ export namespace Balance {
|
|
|
38
42
|
export type Extended = Balance & Legacy
|
|
39
43
|
export namespace Extended {
|
|
40
44
|
export const type = isly.intersection<Extended, Balance, Legacy>(Balance.type, Legacy.type)
|
|
41
|
-
export const typeZod = Balance.typeZod
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
export const typeZod = Balance.typeZod
|
|
46
|
+
.extend({
|
|
47
|
+
actual: zod.number().optional(),
|
|
48
|
+
incomingReserved: zod.number().optional(),
|
|
49
|
+
outgoingReserved: zod.number().optional(),
|
|
50
|
+
bufferReserved: zod.number().optional(),
|
|
51
|
+
})
|
|
52
|
+
.meta({ id: "Balance.Extended" })
|
|
47
53
|
}
|
|
48
54
|
export function update(currency: isoly.Currency, balance: MaybeLegacy): Extended {
|
|
49
55
|
const result: Extended = { ...balance }
|
package/Balances.ts
CHANGED
|
@@ -5,11 +5,12 @@ import { Balance as BalancesBalance } from "./Balance"
|
|
|
5
5
|
import { zod, zodHelper } from "./zod"
|
|
6
6
|
|
|
7
7
|
export type Balances = Partial<Record<isoly.Currency, Balances.Balance.Extended>>
|
|
8
|
-
|
|
9
8
|
export namespace Balances {
|
|
10
9
|
export import Balance = BalancesBalance
|
|
11
10
|
export const type = isly.record<Balances>(isly.fromIs("isoly.Currency", isoly.Currency.is), Balances.Balance.type)
|
|
12
|
-
export const typeZod = zod
|
|
11
|
+
export const typeZod: zod.ZodType<Balances> = zod
|
|
12
|
+
.partialRecord(zodHelper.currency, Balances.Balance.Extended.typeZod)
|
|
13
|
+
.meta({ id: "Balances" })
|
|
13
14
|
export function update(balances: Balances): Balances {
|
|
14
15
|
const result: Balances = {}
|
|
15
16
|
for (const [currency, balance] of Object.entries(balances)) {
|
package/Card/Creatable.ts
CHANGED
|
@@ -32,14 +32,16 @@ export namespace Creatable {
|
|
|
32
32
|
key: isly.string().optional(),
|
|
33
33
|
restricted: isly.object<Required<Creatable>["restricted"]>({ to: Restriction.type.optional() }).optional(),
|
|
34
34
|
})
|
|
35
|
-
export const typeZod: zod.ZodType<Creatable> = zod
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
export const typeZod: zod.ZodType<Creatable> = zod
|
|
36
|
+
.object({
|
|
37
|
+
account: zod.string(),
|
|
38
|
+
number: zod.string().optional(),
|
|
39
|
+
preset: Preset.typeZod,
|
|
40
|
+
details: zod.object({ expiry: Expiry.typeZod, holder: zod.string() }),
|
|
41
|
+
limit: Amount.typeZod,
|
|
42
|
+
meta: Meta.typeZod.optional(),
|
|
43
|
+
key: zod.string().optional(),
|
|
44
|
+
restricted: zod.object({ to: Restriction.typeZod.optional() }).optional(),
|
|
45
|
+
})
|
|
46
|
+
.meta({ id: "Card.Creatable" })
|
|
45
47
|
}
|
package/Card/Preset.ts
CHANGED
|
@@ -26,7 +26,7 @@ export namespace Preset {
|
|
|
26
26
|
"test-diners-175",
|
|
27
27
|
] as const
|
|
28
28
|
export const type = isly.string<Preset>(names)
|
|
29
|
-
export const typeZod = zod.enum(names)
|
|
29
|
+
export const typeZod = zod.enum(names).meta({ id: "Card.Preset" })
|
|
30
30
|
export const forRealm: Record<Realm, Preset[]> = {
|
|
31
31
|
test: ["test-pg-150", "test-pg-200", "test-ta-mc-200", "test-ta-pg-200", "test-ta-pg-bc-200", "test-diners-175"],
|
|
32
32
|
uk: [
|
|
@@ -9,7 +9,7 @@ export type Merchant = (typeof Merchant.values)[number]
|
|
|
9
9
|
export namespace Merchant {
|
|
10
10
|
export const values = typedly.Object.keys(merchants)
|
|
11
11
|
export const type = isly.string<Merchant>(values)
|
|
12
|
-
export const typeZod = zod.enum(values)
|
|
12
|
+
export const typeZod = zod.enum(values).meta({ id: "Card.Restriction.Merchant" })
|
|
13
13
|
export function check(merchant: Merchant, counterpart: Rail.Address.Card.Counterpart): boolean {
|
|
14
14
|
const attribute: Attribute = merchants[merchant]
|
|
15
15
|
let result: boolean
|
|
@@ -9,7 +9,9 @@ export interface Restriction {
|
|
|
9
9
|
export namespace Restriction {
|
|
10
10
|
export import Merchant = RestrictionsMerchant
|
|
11
11
|
export const type = isly.object<Restriction>({ merchants: Merchant.type.array().optional() })
|
|
12
|
-
export const typeZod
|
|
12
|
+
export const typeZod: zod.ZodType<Restriction> = zod
|
|
13
|
+
.object({ merchants: Merchant.typeZod.array().optional() })
|
|
14
|
+
.meta({ id: "Card.Restriction" })
|
|
13
15
|
export function check(
|
|
14
16
|
restrictions: Restriction,
|
|
15
17
|
transaction: Transaction.Creatable.CardTransaction | Transaction.PreTransaction.Authorization
|
package/Card/Scheme.ts
CHANGED
|
@@ -5,5 +5,5 @@ export type Scheme = (typeof Scheme.schemes)[number]
|
|
|
5
5
|
export namespace Scheme {
|
|
6
6
|
export const schemes = ["mastercard", "diners", "visa"] as const
|
|
7
7
|
export const type = isly.string<Scheme>(schemes)
|
|
8
|
-
export const typeZod = zod.enum(schemes)
|
|
8
|
+
export const typeZod = zod.enum(schemes).meta({ id: "Card.Scheme" })
|
|
9
9
|
}
|
package/Card/index.ts
CHANGED
|
@@ -76,31 +76,33 @@ export namespace Card {
|
|
|
76
76
|
meta: isly.fromIs("Card.Meta", CardMeta.is).optional(),
|
|
77
77
|
restricted: isly.object<Required<Card>["restricted"]>({ to: CardRestriction.type.optional() }).optional(),
|
|
78
78
|
})
|
|
79
|
-
export const typeZod: zod.ZodType<Card> = zod
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
79
|
+
export const typeZod: zod.ZodType<Card> = zod
|
|
80
|
+
.object({
|
|
81
|
+
id: zod.string(),
|
|
82
|
+
number: zod.string().optional(),
|
|
83
|
+
created: zod.string().refine(isoly.DateTime.is),
|
|
84
|
+
organization: zod.string(),
|
|
85
|
+
realm: Realm.typeZod,
|
|
86
|
+
account: zod.string(),
|
|
87
|
+
preset: CardPreset.typeZod,
|
|
88
|
+
scheme: CardScheme.typeZod,
|
|
89
|
+
reference: zod.string(),
|
|
90
|
+
details: zod.object({
|
|
91
|
+
iin: zod.string(),
|
|
92
|
+
last4: zod.string(),
|
|
93
|
+
expiry: CardExpiry.typeZod,
|
|
94
|
+
holder: zod.string(),
|
|
95
|
+
token: zod.string().optional(),
|
|
96
|
+
}),
|
|
97
|
+
limit: Amount.typeZod,
|
|
98
|
+
spent: Amount.typeZod,
|
|
99
|
+
status: zod.enum(["active", "cancelled"]),
|
|
100
|
+
history: CardOperation.typeZod.array(),
|
|
101
|
+
rules: zod.any().array(),
|
|
102
|
+
meta: CardMeta.typeZod.optional(),
|
|
103
|
+
restricted: zod.object({ to: CardRestriction.typeZod.optional() }).optional(),
|
|
104
|
+
})
|
|
105
|
+
.meta({ id: "Card" })
|
|
104
106
|
const csvMap: Record<string, (card: Card) => string | number | undefined> = {
|
|
105
107
|
id: card => card.id,
|
|
106
108
|
created: card => readableDate(card.created),
|
package/Client/Cards.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { gracely } from "gracely"
|
|
2
|
+
import { isoly } from "isoly"
|
|
2
3
|
import { http } from "cloudly-http"
|
|
3
4
|
import { Card } from "../Card"
|
|
4
5
|
|
|
@@ -15,6 +16,8 @@ export class Cards {
|
|
|
15
16
|
account?: string
|
|
16
17
|
organization?: string
|
|
17
18
|
scheme?: Card.Scheme
|
|
19
|
+
start?: isoly.Date
|
|
20
|
+
end?: isoly.Date
|
|
18
21
|
limit?: number
|
|
19
22
|
cursor?: string
|
|
20
23
|
}): Promise<(Card[] & { cursor?: string }) | gracely.Error> {
|
package/Operation/Change.ts
CHANGED
|
@@ -18,12 +18,14 @@ export namespace Change {
|
|
|
18
18
|
status: Status.type,
|
|
19
19
|
result: isly.number().optional(),
|
|
20
20
|
})
|
|
21
|
-
export const typeZod = zod
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
export const typeZod = zod
|
|
22
|
+
.object({
|
|
23
|
+
type: zod.enum(operand),
|
|
24
|
+
amount: zod.number(),
|
|
25
|
+
status: Status.typeZod,
|
|
26
|
+
result: zod.number().optional(),
|
|
27
|
+
})
|
|
28
|
+
.meta({ id: "Operation.Change" })
|
|
27
29
|
export namespace Add {
|
|
28
30
|
export const type = Change.type.extend<Change<"add">>({
|
|
29
31
|
type: isly.string("add"),
|
package/Operation/Changes.ts
CHANGED
|
@@ -48,7 +48,7 @@ export namespace Changes {
|
|
|
48
48
|
export type Sum = Partial<Record<Changes.Entry.Balance, number>>
|
|
49
49
|
export type MaybeLegacy = Changes | Legacy
|
|
50
50
|
export const type = isly.record<Changes>(isly.string(), Change.type)
|
|
51
|
-
export const typeZod = zod.record(zod.string(), Change.typeZod)
|
|
51
|
+
export const typeZod = zod.record(zod.string(), Change.typeZod).meta({ id: "Operation.Changes" })
|
|
52
52
|
export type Legacy = Partial<Record<AccountBalance.Legacy.Entry, Change>>
|
|
53
53
|
export namespace Legacy {
|
|
54
54
|
export const type = isly.record<Legacy>(isly.string(), Change.type)
|
package/Operation/Creatable.ts
CHANGED
|
@@ -38,13 +38,15 @@ export namespace Creatable {
|
|
|
38
38
|
type: isly.string(types),
|
|
39
39
|
counterbalance: isly.string().optional(),
|
|
40
40
|
})
|
|
41
|
-
export const typeZod = zod
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
export const typeZod = zod
|
|
42
|
+
.object({
|
|
43
|
+
account: zod.string(),
|
|
44
|
+
currency: zodHelper.currency,
|
|
45
|
+
changes: Changes.typeZod,
|
|
46
|
+
type: zod.enum(types),
|
|
47
|
+
counterbalance: zod.string().optional(),
|
|
48
|
+
})
|
|
49
|
+
.meta({ id: "Operation.Creatable" })
|
|
48
50
|
export function fromRefund(account: string, settlement: string, entry: Settlement.Entry.Creatable.Refund): Creatable {
|
|
49
51
|
// The Entry.Refund.Creatable has negative amount and fee
|
|
50
52
|
// The operation amounts should always be positive
|
package/Operation/Status.ts
CHANGED
|
@@ -6,5 +6,5 @@ export type Status = (typeof Status.values)[number]
|
|
|
6
6
|
export namespace Status {
|
|
7
7
|
export const values = ["pending", "success", "failed"] as const
|
|
8
8
|
export const type = isly.string(values)
|
|
9
|
-
export const typeZod = zod.enum(values)
|
|
9
|
+
export const typeZod = zod.enum(values).meta({ id: "Operation.Status" })
|
|
10
10
|
}
|
package/Operation/index.ts
CHANGED
|
@@ -35,13 +35,15 @@ export namespace Operation {
|
|
|
35
35
|
export import Creatable = OperationCreatable
|
|
36
36
|
export import Changes = OperationChanges
|
|
37
37
|
export import Change = OperationChange
|
|
38
|
-
export const typeZod = Creatable.typeZod
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
export const typeZod = Creatable.typeZod
|
|
39
|
+
.extend({
|
|
40
|
+
transaction: zod.string(),
|
|
41
|
+
counter: zod.number(),
|
|
42
|
+
created: zod.string().refine(isoly.DateTime.is),
|
|
43
|
+
signature: zod.string().optional(),
|
|
44
|
+
previous: zod.string().optional(),
|
|
45
|
+
})
|
|
46
|
+
.meta({ id: "Operation" })
|
|
45
47
|
export const type = OperationCreatable.type.extend<Operation>({
|
|
46
48
|
transaction: isly.string(),
|
|
47
49
|
counter: isly.number(),
|
|
@@ -11,8 +11,7 @@ export namespace Changeable {
|
|
|
11
11
|
name: isly.string().optional(),
|
|
12
12
|
contact: Contact.Creatable.type.optional(),
|
|
13
13
|
})
|
|
14
|
-
export const typeZod = zod
|
|
15
|
-
name: zod.string().optional(),
|
|
16
|
-
|
|
17
|
-
})
|
|
14
|
+
export const typeZod = zod
|
|
15
|
+
.object({ name: zod.string().optional(), contact: Contact.Creatable.typeZod.optional() })
|
|
16
|
+
.meta({ id: "Organization.Changeable" })
|
|
18
17
|
}
|
|
@@ -19,12 +19,14 @@ export namespace Default {
|
|
|
19
19
|
street: isly.string(),
|
|
20
20
|
zipCode: isly.string(),
|
|
21
21
|
})
|
|
22
|
-
export const typeZod: zod.ZodType<Default> = zod
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
export const typeZod: zod.ZodType<Default> = zod
|
|
23
|
+
.object({
|
|
24
|
+
countryCode: zod.string() as any,
|
|
25
|
+
state: zod.string().optional(),
|
|
26
|
+
county: zod.string().optional(),
|
|
27
|
+
city: zod.string(),
|
|
28
|
+
zipCode: zod.string(),
|
|
29
|
+
street: zod.string(),
|
|
30
|
+
})
|
|
31
|
+
.meta({ id: "Organization.Contact.Address.Default" })
|
|
30
32
|
}
|
|
@@ -18,11 +18,13 @@ export namespace GB {
|
|
|
18
18
|
building: isly.string(),
|
|
19
19
|
zipCode: isly.string(),
|
|
20
20
|
})
|
|
21
|
-
export const typeZod: zod.ZodType<GB> = zod
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
export const typeZod: zod.ZodType<GB> = zod
|
|
22
|
+
.object({
|
|
23
|
+
countryCode: zod.literal("GB"),
|
|
24
|
+
city: zod.string(),
|
|
25
|
+
street: zod.string(),
|
|
26
|
+
building: zod.string(),
|
|
27
|
+
zipCode: zod.string(),
|
|
28
|
+
})
|
|
29
|
+
.meta({ id: "Organization.Contact.Address.GB" })
|
|
28
30
|
}
|
|
@@ -14,10 +14,7 @@ export namespace SE {
|
|
|
14
14
|
city: isly.string(),
|
|
15
15
|
street: isly.string(),
|
|
16
16
|
})
|
|
17
|
-
export const typeZod: zod.ZodType<SE> = zod
|
|
18
|
-
countryCode: zod.literal("SE"),
|
|
19
|
-
|
|
20
|
-
city: zod.string(),
|
|
21
|
-
street: zod.string(),
|
|
22
|
-
})
|
|
17
|
+
export const typeZod: zod.ZodType<SE> = zod
|
|
18
|
+
.object({ countryCode: zod.literal("SE"), zipCode: zod.string(), city: zod.string(), street: zod.string() })
|
|
19
|
+
.meta({ id: "Organization.Contact.Address.SE" })
|
|
23
20
|
}
|
|
@@ -5,8 +5,9 @@ import { GB } from "./GB"
|
|
|
5
5
|
import { SE } from "./SE"
|
|
6
6
|
|
|
7
7
|
export type Address = GB | SE | Default
|
|
8
|
-
|
|
9
8
|
export namespace Address {
|
|
10
9
|
export const type = isly.union(GB.type, SE.type, Default.type)
|
|
11
|
-
export const typeZod: zod.ZodType<Address> = zod
|
|
10
|
+
export const typeZod: zod.ZodType<Address> = zod
|
|
11
|
+
.union([GB.typeZod, SE.typeZod, Default.typeZod])
|
|
12
|
+
.meta({ id: "Organization.Contact.Address" })
|
|
12
13
|
}
|
|
@@ -15,10 +15,12 @@ export namespace Addresses {
|
|
|
15
15
|
delivery: Address.type.optional(),
|
|
16
16
|
visit: Address.type.optional(),
|
|
17
17
|
})
|
|
18
|
-
export const typeZod: zod.ZodType<Addresses> = zod
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
export const typeZod: zod.ZodType<Addresses> = zod
|
|
19
|
+
.object({
|
|
20
|
+
primary: Address.typeZod,
|
|
21
|
+
billing: Address.typeZod.optional(),
|
|
22
|
+
delivery: Address.typeZod.optional(),
|
|
23
|
+
visit: Address.typeZod.optional(),
|
|
24
|
+
})
|
|
25
|
+
.meta({ id: "Organization.Contact.Addresses" })
|
|
24
26
|
}
|
|
@@ -19,11 +19,13 @@ export namespace Creatable {
|
|
|
19
19
|
phone: Phone.type,
|
|
20
20
|
owners: Name.type.array({ criteria: "minLength", value: 1 }),
|
|
21
21
|
})
|
|
22
|
-
export const typeZod = zod
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
export const typeZod = zod
|
|
23
|
+
.object({
|
|
24
|
+
address: Addresses.typeZod,
|
|
25
|
+
email: zod.string().regex(/^\S+@\S+\.\S+$/),
|
|
26
|
+
name: Name.typeZod,
|
|
27
|
+
phone: Phone.typeZod,
|
|
28
|
+
owners: Name.typeZod.array().min(1),
|
|
29
|
+
})
|
|
30
|
+
.meta({ id: "Organization.Contact.Creatable" })
|
|
29
31
|
}
|
|
@@ -19,11 +19,13 @@ export namespace Creatable {
|
|
|
19
19
|
contact: Contact.Creatable.type.optional(),
|
|
20
20
|
fx: Fx.type.optional(),
|
|
21
21
|
})
|
|
22
|
-
export const typeZod: zod.ZodType<Creatable> = zod
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
export const typeZod: zod.ZodType<Creatable> = zod
|
|
23
|
+
.object({
|
|
24
|
+
name: zod.string(),
|
|
25
|
+
code: zod.string().regex(/^[A-Za-z0-9\-_]+$/),
|
|
26
|
+
risk: Risk.typeZod,
|
|
27
|
+
contact: Contact.Creatable.typeZod.optional(),
|
|
28
|
+
fx: Fx.typeZod.optional(),
|
|
29
|
+
})
|
|
30
|
+
.meta({ id: "Organization.Creatable" })
|
|
29
31
|
}
|
package/Organization/Risk.ts
CHANGED
|
@@ -2,9 +2,8 @@ import { isly } from "isly"
|
|
|
2
2
|
import { zod } from "../zod"
|
|
3
3
|
|
|
4
4
|
export type Risk = (typeof Risk.values)[number]
|
|
5
|
-
|
|
6
5
|
export namespace Risk {
|
|
7
6
|
export const values = ["low", "medium", "high", "prohibited"] as const
|
|
8
7
|
export const type = isly.string(values)
|
|
9
|
-
export const typeZod = zod.enum(values)
|
|
8
|
+
export const typeZod = zod.enum(values).meta({ id: "Organization.Risk" })
|
|
10
9
|
}
|
package/Organization/index.ts
CHANGED
|
@@ -40,18 +40,20 @@ export namespace Organization {
|
|
|
40
40
|
fx: OrganizationFx.type.optional(),
|
|
41
41
|
type: Type.type,
|
|
42
42
|
})
|
|
43
|
-
export const typeZod: zod.ZodType<Organization> = zod
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
43
|
+
export const typeZod: zod.ZodType<Organization> = zod
|
|
44
|
+
.object({
|
|
45
|
+
name: zod.string(),
|
|
46
|
+
code: zod.string().regex(/^[A-Za-z0-9\-_]+$/),
|
|
47
|
+
realm: Realm.typeZod,
|
|
48
|
+
rules: zod.any().array(),
|
|
49
|
+
status: zod.enum(["active", "inactive"]),
|
|
50
|
+
risk: Organization.Risk.typeZod,
|
|
51
|
+
contact: Contact.typeZod.optional(),
|
|
52
|
+
groups: zod.string().array().optional(),
|
|
53
|
+
fx: OrganizationFx.typeZod.optional(),
|
|
54
|
+
type: Type.typeZod,
|
|
55
|
+
})
|
|
56
|
+
.meta({ id: "Organization" })
|
|
55
57
|
export function from(creatable: Creatable, realm: Realm): Organization {
|
|
56
58
|
return { ...creatable, realm, rules: [], status: "active", type: "emoney" }
|
|
57
59
|
}
|