@pax2pay/model-banking 0.1.581 → 0.1.583

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.
Files changed (110) hide show
  1. package/Identifier.ts +2 -2
  2. package/Log/Entry.ts +7 -7
  3. package/Log/Locations.ts +7 -7
  4. package/Log/Message/Configuration.ts +7 -7
  5. package/Log/Message/Entry.ts +6 -6
  6. package/Log/index.ts +9 -9
  7. package/Realm.ts +3 -3
  8. package/Supplier/index.ts +1 -1
  9. package/User/Access/Permission.ts +7 -3
  10. package/User/Access/index.ts +9 -7
  11. package/User/JWT/Payload.ts +26 -27
  12. package/User/JWT/index.ts +2 -2
  13. package/User/Password.ts +3 -5
  14. package/User/index.ts +9 -29
  15. package/dist/cjs/Identifier.d.ts +2 -2
  16. package/dist/cjs/Identifier.js +2 -35
  17. package/dist/cjs/Identifier.js.map +1 -1
  18. package/dist/cjs/Log/Entry.d.ts +12 -12
  19. package/dist/cjs/Log/Entry.js +5 -38
  20. package/dist/cjs/Log/Entry.js.map +1 -1
  21. package/dist/cjs/Log/Locations.d.ts +8 -8
  22. package/dist/cjs/Log/Locations.js +6 -39
  23. package/dist/cjs/Log/Locations.js.map +1 -1
  24. package/dist/cjs/Log/Message/Configuration.d.ts +8 -8
  25. package/dist/cjs/Log/Message/Configuration.js +6 -39
  26. package/dist/cjs/Log/Message/Configuration.js.map +1 -1
  27. package/dist/cjs/Log/Message/Entry.d.ts +7 -7
  28. package/dist/cjs/Log/Message/Entry.js +5 -38
  29. package/dist/cjs/Log/Message/Entry.js.map +1 -1
  30. package/dist/cjs/Log/index.d.ts +14 -14
  31. package/dist/cjs/Log/index.js +8 -41
  32. package/dist/cjs/Log/index.js.map +1 -1
  33. package/dist/cjs/Realm.d.ts +3 -3
  34. package/dist/cjs/Realm.js +2 -35
  35. package/dist/cjs/Realm.js.map +1 -1
  36. package/dist/cjs/Supplier/index.d.ts +1 -5
  37. package/dist/cjs/Supplier/index.js.map +1 -1
  38. package/dist/cjs/User/Access/Permission.d.ts +42 -6
  39. package/dist/cjs/User/Access/Permission.js +4 -0
  40. package/dist/cjs/User/Access/Permission.js.map +1 -1
  41. package/dist/cjs/User/Access/index.d.ts +80 -7
  42. package/dist/cjs/User/Access/index.js +8 -0
  43. package/dist/cjs/User/Access/index.js.map +1 -1
  44. package/dist/cjs/User/JWT/Payload.d.ts +234 -26
  45. package/dist/cjs/User/JWT/Payload.js +20 -4
  46. package/dist/cjs/User/JWT/Payload.js.map +1 -1
  47. package/dist/cjs/User/JWT/index.js +2 -2
  48. package/dist/cjs/User/JWT/index.js.map +1 -1
  49. package/dist/cjs/User/Password.d.ts +12 -6
  50. package/dist/cjs/User/Password.js +2 -0
  51. package/dist/cjs/User/Password.js.map +1 -1
  52. package/dist/cjs/User/index.d.ts +112 -10
  53. package/dist/cjs/User/index.js +6 -18
  54. package/dist/cjs/User/index.js.map +1 -1
  55. package/dist/cjs/pax2pay.d.ts +1 -0
  56. package/dist/cjs/pax2pay.js +3 -1
  57. package/dist/cjs/pax2pay.js.map +1 -1
  58. package/dist/cjs/zod.d.ts +12 -0
  59. package/dist/cjs/zod.js +52 -0
  60. package/dist/cjs/zod.js.map +1 -0
  61. package/dist/mjs/Identifier.d.ts +2 -2
  62. package/dist/mjs/Identifier.js +2 -2
  63. package/dist/mjs/Identifier.js.map +1 -1
  64. package/dist/mjs/Log/Entry.d.ts +12 -12
  65. package/dist/mjs/Log/Entry.js +5 -5
  66. package/dist/mjs/Log/Entry.js.map +1 -1
  67. package/dist/mjs/Log/Locations.d.ts +8 -8
  68. package/dist/mjs/Log/Locations.js +6 -6
  69. package/dist/mjs/Log/Locations.js.map +1 -1
  70. package/dist/mjs/Log/Message/Configuration.d.ts +8 -8
  71. package/dist/mjs/Log/Message/Configuration.js +6 -6
  72. package/dist/mjs/Log/Message/Configuration.js.map +1 -1
  73. package/dist/mjs/Log/Message/Entry.d.ts +7 -7
  74. package/dist/mjs/Log/Message/Entry.js +5 -5
  75. package/dist/mjs/Log/Message/Entry.js.map +1 -1
  76. package/dist/mjs/Log/index.d.ts +14 -14
  77. package/dist/mjs/Log/index.js +8 -8
  78. package/dist/mjs/Log/index.js.map +1 -1
  79. package/dist/mjs/Realm.d.ts +3 -3
  80. package/dist/mjs/Realm.js +2 -2
  81. package/dist/mjs/Realm.js.map +1 -1
  82. package/dist/mjs/Supplier/index.d.ts +1 -5
  83. package/dist/mjs/Supplier/index.js.map +1 -1
  84. package/dist/mjs/User/Access/Permission.d.ts +42 -6
  85. package/dist/mjs/User/Access/Permission.js +4 -0
  86. package/dist/mjs/User/Access/Permission.js.map +1 -1
  87. package/dist/mjs/User/Access/index.d.ts +80 -7
  88. package/dist/mjs/User/Access/index.js +8 -0
  89. package/dist/mjs/User/Access/index.js.map +1 -1
  90. package/dist/mjs/User/JWT/Payload.d.ts +234 -26
  91. package/dist/mjs/User/JWT/Payload.js +20 -4
  92. package/dist/mjs/User/JWT/Payload.js.map +1 -1
  93. package/dist/mjs/User/JWT/index.js +2 -2
  94. package/dist/mjs/User/JWT/index.js.map +1 -1
  95. package/dist/mjs/User/Password.d.ts +12 -6
  96. package/dist/mjs/User/Password.js +2 -0
  97. package/dist/mjs/User/Password.js.map +1 -1
  98. package/dist/mjs/User/index.d.ts +112 -10
  99. package/dist/mjs/User/index.js +6 -18
  100. package/dist/mjs/User/index.js.map +1 -1
  101. package/dist/mjs/pax2pay.d.ts +1 -0
  102. package/dist/mjs/pax2pay.js +1 -0
  103. package/dist/mjs/pax2pay.js.map +1 -1
  104. package/dist/mjs/zod.d.ts +12 -0
  105. package/dist/mjs/zod.js +16 -0
  106. package/dist/mjs/zod.js.map +1 -0
  107. package/package.json +2 -2
  108. package/pax2pay.ts +1 -0
  109. package/tsconfig.json +1 -2
  110. package/zod.ts +20 -0
package/Identifier.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { cryptly } from "cryptly"
2
2
  import { isoly } from "isoly"
3
3
  import { isly } from "isly"
4
- import * as z from "zod"
4
+ import { zod } from "./zod"
5
5
 
6
6
  export type Identifier = cryptly.Identifier
7
7
  export namespace Identifier {
@@ -20,5 +20,5 @@ export namespace Identifier {
20
20
  return isoly.DateTime.create(Number(new BigUint64Array(decoded.slice(decoded.length - 8).buffer)), "milliseconds")
21
21
  }
22
22
  export const type = isly.fromIs("Identifier", cryptly.Identifier.is)
23
- export const zodType = z.string().refine(cryptly.Identifier.is)
23
+ export const typeZod = zod.string().refine(cryptly.Identifier.is)
24
24
  }
package/Log/Entry.ts CHANGED
@@ -1,12 +1,12 @@
1
- import * as z from "zod"
1
+ import { zod } from "../zod"
2
2
 
3
3
  export namespace Entry {
4
- export const type = z.object({
5
- message: z.string(),
6
- data: z.any().optional(),
4
+ export const type = zod.object({
5
+ message: zod.string(),
6
+ data: zod.any().optional(),
7
7
  })
8
8
  export namespace Message {
9
- export const type = z.object({ ...Entry.type.shape, resource: z.string().optional() })
9
+ export const type = zod.object({ ...Entry.type.shape, resource: zod.string().optional() })
10
10
  export function to(message: string, data: any | undefined, resource: string | undefined): Entry.Message {
11
11
  const result: Entry.Message = { message }
12
12
  resource && (result.resource = resource)
@@ -14,6 +14,6 @@ export namespace Entry {
14
14
  return result
15
15
  }
16
16
  }
17
- export type Message = z.infer<typeof Message.type>
17
+ export type Message = zod.infer<typeof Message.type>
18
18
  }
19
- export type Entry = z.infer<typeof Entry.type>
19
+ export type Entry = zod.infer<typeof Entry.type>
package/Log/Locations.ts CHANGED
@@ -1,11 +1,11 @@
1
- import * as z from "zod"
1
+ import { zod } from "../zod"
2
2
 
3
3
  export namespace Locations {
4
- export const type = z.object({
5
- cfConnectionIp: z.string().optional(),
6
- cfIpCountry: z.string().optional(),
7
- datacenter: z.string().optional(),
8
- country: z.string().optional(),
4
+ export const type = zod.object({
5
+ cfConnectionIp: zod.string().optional(),
6
+ cfIpCountry: zod.string().optional(),
7
+ datacenter: zod.string().optional(),
8
+ country: zod.string().optional(),
9
9
  })
10
10
  export function getLocations(request: any): Locations | undefined {
11
11
  const locations = {
@@ -17,4 +17,4 @@ export namespace Locations {
17
17
  return type.safeParse(locations).success ? locations : undefined
18
18
  }
19
19
  }
20
- export type Locations = z.infer<typeof Locations.type>
20
+ export type Locations = zod.infer<typeof Locations.type>
@@ -1,13 +1,13 @@
1
1
  import { TraceLog } from "@cloudflare/workers-types"
2
- import * as z from "zod"
3
2
  import { Realm } from "../../Realm"
3
+ import { zod } from "../../zod"
4
4
 
5
5
  export namespace Configuration {
6
- export const type = z.object({
7
- realm: Realm.zodType,
8
- collection: z.string(),
9
- resource: z.string().optional(),
10
- requireEntries: z.boolean().optional(),
6
+ export const type = zod.object({
7
+ realm: Realm.typeZod,
8
+ collection: zod.string(),
9
+ resource: zod.string().optional(),
10
+ requireEntries: zod.boolean().optional(),
11
11
  })
12
12
  export function fromTraceLog(trace: TraceLog | undefined): Configuration | undefined {
13
13
  return trace && Configuration.type.safeParse(trace.message[0]).success
@@ -20,4 +20,4 @@ export namespace Configuration {
20
20
  : undefined
21
21
  }
22
22
  }
23
- export type Configuration = z.infer<typeof Configuration.type>
23
+ export type Configuration = zod.infer<typeof Configuration.type>
@@ -1,12 +1,12 @@
1
1
  import { TraceLog } from "@cloudflare/workers-types"
2
- import * as z from "zod"
2
+ import { zod } from "../../zod"
3
3
  import type { Log } from "../index"
4
4
 
5
5
  export namespace Entry {
6
- export const type = z.object({
7
- message: z.string(),
8
- resource: z.string().optional(),
9
- data: z.any().optional(),
6
+ export const type = zod.object({
7
+ message: zod.string(),
8
+ resource: zod.string().optional(),
9
+ data: zod.any().optional(),
10
10
  })
11
11
  export function fromEventLogs(trace: TraceLog): { entry: Log.Entry; resource: Log["resource"] } | undefined {
12
12
  return Entry.type.safeParse(trace.message[0]).success
@@ -20,4 +20,4 @@ export namespace Entry {
20
20
  : undefined
21
21
  }
22
22
  }
23
- export type Entry = z.infer<typeof Entry.type>
23
+ export type Entry = zod.infer<typeof Entry.type>
package/Log/index.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { isoly } from "isoly"
2
2
  import { TraceItem } from "@cloudflare/workers-types"
3
- import * as z from "zod"
4
3
  import { Identifier } from "../Identifier"
5
4
  import { Realm } from "../Realm"
5
+ import { zod } from "../zod"
6
6
  import { Entry as LogEntry } from "./Entry"
7
7
  import { Locations as LogLocations } from "./Locations"
8
8
  import { Message as LogMessage } from "./Message"
@@ -11,14 +11,14 @@ export namespace Log {
11
11
  export import Message = LogMessage
12
12
  export import Entry = LogEntry
13
13
  export import Locations = LogLocations
14
- export const type = z.object({
15
- id: Identifier.zodType,
16
- realm: Realm.zodType,
17
- script: z.string().optional(),
18
- collection: z.string(),
19
- resource: z.string().optional(),
14
+ export const type = zod.object({
15
+ id: Identifier.typeZod,
16
+ realm: Realm.typeZod,
17
+ script: zod.string().optional(),
18
+ collection: zod.string(),
19
+ resource: zod.string().optional(),
20
20
  entries: Log.Entry.type.array(),
21
- created: z.iso.datetime({ offset: true }),
21
+ created: zod.iso.datetime({ offset: true }),
22
22
  })
23
23
  export function fromEvents(events: TraceItem[]): Log[] {
24
24
  const result: Log[] = []
@@ -65,4 +65,4 @@ export namespace Log {
65
65
  console.error(Log.Entry.Message.to(message, data, resource))
66
66
  }
67
67
  }
68
- export type Log = z.infer<typeof Log.type>
68
+ export type Log = zod.infer<typeof Log.type>
package/Realm.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
3
  import { isly as isly2 } from "isly2"
4
- import * as z from "zod"
5
4
  import { Supplier as modelSupplier } from "./Supplier"
5
+ import { zod } from "./zod"
6
6
 
7
- export type Realm = typeof Realm.realms[number]
7
+ export type Realm = zod.infer<typeof Realm.typeZod>
8
8
 
9
9
  export namespace Realm {
10
10
  export const realms = ["test", "uk", "uguk", "eea"] as const
11
11
  export const type = isly.string<Realm>(realms)
12
- export const zodType = z.enum(realms)
12
+ export const typeZod = zod.enum(realms)
13
13
  export const type2 = isly2
14
14
  .string<Realm>("value", ...realms)
15
15
  .rename("Realm")
package/Supplier/index.ts CHANGED
@@ -6,7 +6,7 @@ export type Supplier = typeof Supplier.names[number]
6
6
  export namespace Supplier {
7
7
  export const names = ["paxgiro", "clearbank", "bankingcircle", "paxgiroCredit"] as const
8
8
  export const type = isly.string<Supplier>(names)
9
- export const currencies: { [R in Realm]: { [S in typeof realm[R][number]]: isoly.Currency[] } } = {
9
+ export const currencies: Record<Realm, Partial<Record<Supplier, isoly.Currency[]>>> = {
10
10
  eea: {},
11
11
  uk: {
12
12
  clearbank: ["GBP"],
@@ -1,7 +1,8 @@
1
1
  import { isly } from "isly"
2
2
  import { typedly } from "typedly"
3
+ import { zod } from "../../zod"
3
4
 
4
- export type Permission = Partial<Record<Permission.Collection, Permission.Level>>
5
+ export type Permission = zod.infer<typeof Permission.typeZod>
5
6
  export namespace Permission {
6
7
  export type Realm = Record<Permission.Collection.Realm, Permission.Level>
7
8
  export type Global = Record<Permission.Collection.Global, Permission.Level>
@@ -12,9 +13,10 @@ export namespace Permission {
12
13
  (collection != "user" && Permission.Level.get(privilege["*"]) >= Permission.Level.get(level))
13
14
  )
14
15
  }
15
- export type Level = typeof Level.values[number]
16
+ export type Level = zod.infer<typeof Level.typeZod>
16
17
  export namespace Level {
17
18
  export const values = ["read", "write", "developer", "admin"] as const
19
+ export const typeZod = zod.enum(values)
18
20
  export const type = isly.string(values)
19
21
  export function get(level: Level | undefined): number {
20
22
  return level ? value[level] : 0
@@ -26,7 +28,7 @@ export namespace Permission {
26
28
  admin: 4,
27
29
  } as const
28
30
  }
29
- export type Collection = typeof Collection.values[number]
31
+ export type Collection = zod.infer<typeof Collection.typeZod>
30
32
  export namespace Collection {
31
33
  export type Realm = typeof Realm.values[number]
32
34
  export namespace Realm {
@@ -47,7 +49,9 @@ export namespace Permission {
47
49
  export const values = ["user"] as const
48
50
  }
49
51
  export const values = [...Realm.values, ...Global.values] as const
52
+ export const typeZod = zod.enum(values)
50
53
  export const type = isly.string(values)
51
54
  }
52
55
  export const type = isly.record<Permission>(Collection.type, Level.type)
56
+ export const typeZod = zod.partialRecord(Collection.typeZod, Level.typeZod)
53
57
  }
@@ -1,14 +1,9 @@
1
1
  import { isly } from "isly"
2
+ import { zod } from "../../zod"
2
3
  import { Permission as AccessPermission } from "./Permission"
3
4
 
4
5
  /** read < write < developer < admin */
5
- export interface Access {
6
- uk?: Access.Permission.Realm
7
- uguk?: Access.Permission.Realm
8
- eea?: Access.Permission.Realm
9
- test?: Access.Permission.Realm
10
- "*"?: Access.Permission.Global
11
- }
6
+ export type Access = zod.infer<typeof Access.typeZod>
12
7
  export namespace Access {
13
8
  export import Permission = AccessPermission
14
9
  export const type = isly.object({
@@ -18,4 +13,11 @@ export namespace Access {
18
13
  test: Access.Permission.type.optional(),
19
14
  "*": isly.object({ user: Access.Permission.Level.type.optional() }).optional(),
20
15
  })
16
+ export const typeZod = zod.object({
17
+ uk: Access.Permission.typeZod.optional(),
18
+ uguk: Access.Permission.typeZod.optional(),
19
+ eea: Access.Permission.typeZod.optional(),
20
+ test: Access.Permission.typeZod.optional(),
21
+ "*": zod.object({ user: Access.Permission.Level.typeZod.optional() }).optional(),
22
+ })
21
23
  }
@@ -1,56 +1,55 @@
1
- import { authly } from "authly"
2
1
  import { isly } from "isly"
3
2
  import { Realm } from "../../Realm"
3
+ import { zod } from "../../zod"
4
4
  import { Access } from "../Access"
5
5
 
6
- export type Payload = Payload.LongTerm | Payload.ShortTerm
6
+ export type Payload = Payload.LongTerm | Payload.ShortTerm //zod.infer<typeof Payload.typeZod>
7
7
  export namespace Payload {
8
- export interface Creatable {
9
- sub: string
10
- permission: Access.Permission
11
- realm: Realm
12
- }
8
+ export type Creatable = zod.infer<typeof Creatable.typeZod>
13
9
  export namespace Creatable {
14
10
  export const type = isly.object<Creatable>({
15
11
  sub: isly.string(),
16
12
  permission: Access.Permission.type,
17
13
  realm: Realm.type,
18
14
  })
15
+ export const typeZod = zod.object({
16
+ sub: zod.string(),
17
+ permission: Access.Permission.typeZod,
18
+ realm: Realm.typeZod,
19
+ })
19
20
  }
20
- export interface Base extends authly.Payload {
21
- aud: string
22
- iat: number
23
- iss: string
24
- sub: string
25
- permission: Access.Permission
26
- realm: Realm
27
- }
21
+ export type Base = zod.infer<typeof Base.typeZod>
28
22
  export namespace Base {
29
- export const type = isly.object<Payload>({
23
+ export const type = isly.object<Base>({
30
24
  aud: isly.string(),
31
25
  iat: isly.number(),
32
26
  iss: isly.string(),
33
27
  sub: isly.string(),
34
28
  permission: Access.Permission.type,
35
29
  realm: Realm.type,
30
+ token: isly.string().optional(),
31
+ })
32
+ export const typeZod = zod.object({
33
+ aud: zod.string(),
34
+ iat: zod.number(),
35
+ iss: zod.string(),
36
+ sub: zod.string(),
37
+ permission: Access.Permission.typeZod,
38
+ realm: Realm.typeZod,
39
+ token: zod.string().optional(),
36
40
  })
37
41
  }
38
- export interface LongTerm extends Base {
39
- id: string
40
- }
42
+ export type LongTerm = zod.infer<typeof LongTerm.typeZod>
41
43
  export namespace LongTerm {
42
44
  export const type = Base.type.extend<LongTerm>({ id: isly.string() })
45
+ export const typeZod = Base.typeZod.extend({ id: zod.string() })
43
46
  }
44
- export interface ShortTerm extends Base {
45
- exp: number
46
- }
47
+ export type ShortTerm = zod.infer<typeof ShortTerm.typeZod>
47
48
  export namespace ShortTerm {
48
49
  export const type = Base.type.extend<ShortTerm>({ exp: isly.number() })
50
+ export const typeZod = Base.typeZod.extend({ exp: zod.number() })
49
51
  }
50
-
51
- export const configuration = {
52
- aud: "https://banking.pax2pay.app",
53
- iss: "pax2pay",
54
- }
52
+ export const configuration = { aud: "https://banking.pax2pay.app", iss: "pax2pay" }
55
53
  export const type = isly.union<Payload>(LongTerm.type, ShortTerm.type)
54
+ export const typeZod = zod.union([LongTerm.typeZod, ShortTerm.typeZod])
56
55
  }
package/User/JWT/index.ts CHANGED
@@ -28,8 +28,8 @@ export class JWT {
28
28
  const verified = await this.verifier?.verify(token, JWT.Payload.configuration.aud)
29
29
  delete verified?.token
30
30
  return JWT.Payload.type.is(verified) &&
31
- verified?.iss == JWT.Payload.configuration.iss &&
32
- (verified.exp || (verified.id && (await this.store?.get(verified.id as string).then(s => s?.value))))
31
+ verified.iss == JWT.Payload.configuration.iss &&
32
+ ("exp" in verified || (await this.store?.get(verified.id).then(s => s?.value)))
33
33
  ? verified
34
34
  : undefined
35
35
  }
package/User/Password.ts CHANGED
@@ -2,18 +2,16 @@ import { cryptly } from "cryptly"
2
2
  import { gracely } from "gracely"
3
3
  import { isoly } from "isoly"
4
4
  import { isly } from "isly"
5
+ import { zod } from "../zod"
5
6
 
6
7
  export interface Password {
7
8
  hash: cryptly.Password.Hash
8
9
  changed: isoly.DateTime
9
10
  }
10
11
  export namespace Password {
11
- export interface Creatable {
12
- current?: string
13
- new: string
14
- repeat: string
15
- }
12
+ export type Creatable = zod.infer<typeof Creatable.typeZod>
16
13
  export namespace Creatable {
14
+ export const typeZod = zod.object({ current: zod.string().optional(), new: zod.string(), repeat: zod.string() })
17
15
  export const type = isly.object<Creatable>({
18
16
  current: isly.string().optional(),
19
17
  new: isly.string(),
package/User/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
3
  import { Realm } from "../Realm"
4
+ import { zod } from "../zod"
4
5
  import { Access as UserAccess } from "./Access"
5
6
  import { Identity as UserIdentity } from "./Identity"
6
7
  import { JWT as UserJWT } from "./JWT"
@@ -11,9 +12,7 @@ export interface User {
11
12
  access: User.Access
12
13
  changed: isoly.DateTime
13
14
  created: isoly.DateTime
14
- password: {
15
- changed: isoly.DateTime
16
- }
15
+ password: { changed: isoly.DateTime }
17
16
  }
18
17
  export namespace User {
19
18
  export import Access = UserAccess
@@ -22,32 +21,15 @@ export namespace User {
22
21
  export import Password = UserPassword
23
22
  export function fromInvite(invite: Invite): User {
24
23
  const now = isoly.DateTime.now()
25
- return {
26
- email: invite.email,
27
- access: invite.access,
28
- changed: now,
29
- created: now,
30
- password: {
31
- changed: now,
32
- },
33
- }
24
+ return { email: invite.email, access: invite.access, changed: now, created: now, password: { changed: now } }
34
25
  }
35
26
  export function toJWTPayloadCreatable(user: User, realm: Realm): User.JWT.Payload.Creatable {
36
- return {
37
- sub: user.email,
38
- permission: { ...(user.access[realm] ?? {}), ...(user.access["*"] ?? {}) },
39
- realm,
40
- }
41
- }
42
- export interface Creatable {
43
- invite: string
44
- password: Password.Creatable
27
+ return { sub: user.email, permission: { ...(user.access[realm] ?? {}), ...(user.access["*"] ?? {}) }, realm }
45
28
  }
29
+ export type Creatable = zod.infer<typeof Creatable.typeZod>
46
30
  export namespace Creatable {
47
- export const type = isly.object<Creatable>({
48
- invite: isly.string(),
49
- password: Password.Creatable.type,
50
- })
31
+ export const type = isly.object<Creatable>({ invite: isly.string(), password: Password.Creatable.type })
32
+ export const typeZod = zod.object({ invite: zod.string(), password: Password.Creatable.typeZod })
51
33
  }
52
34
  export interface Invite {
53
35
  id: string
@@ -55,11 +37,9 @@ export namespace User {
55
37
  access: Access
56
38
  }
57
39
  export namespace Invite {
58
- export interface Creatable {
59
- email: string
60
- access: Access
61
- }
40
+ export type Creatable = zod.infer<typeof Creatable.typeZod>
62
41
  export namespace Creatable {
42
+ export const typeZod = zod.object({ email: zod.string(), access: Access.typeZod })
63
43
  export const type = isly.object<Creatable>({ email: isly.string(), access: Access.type })
64
44
  }
65
45
  }
@@ -1,11 +1,11 @@
1
1
  import { cryptly } from "cryptly";
2
2
  import { isoly } from "isoly";
3
3
  import { isly } from "isly";
4
- import * as z from "zod";
4
+ import { zod } from "./zod";
5
5
  export type Identifier = cryptly.Identifier;
6
6
  export declare namespace Identifier {
7
7
  function generate(date?: isoly.DateTime, length?: cryptly.Identifier.Length, ordering?: "ordered" | "reversed"): string;
8
8
  function timeOf(identifier: cryptly.Identifier, ordering?: "ordered" | "reversed"): isoly.DateTime;
9
9
  const type: isly.Type<string>;
10
- const zodType: z.ZodString;
10
+ const typeZod: zod.ZodString;
11
11
  }
@@ -1,43 +1,10 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.Identifier = void 0;
37
4
  const cryptly_1 = require("cryptly");
38
5
  const isoly_1 = require("isoly");
39
6
  const isly_1 = require("isly");
40
- const z = __importStar(require("zod"));
7
+ const zod_1 = require("./zod");
41
8
  var Identifier;
42
9
  (function (Identifier) {
43
10
  function generate(date = isoly_1.isoly.DateTime.now(), length = 16, ordering = "reversed") {
@@ -50,6 +17,6 @@ var Identifier;
50
17
  }
51
18
  Identifier.timeOf = timeOf;
52
19
  Identifier.type = isly_1.isly.fromIs("Identifier", cryptly_1.cryptly.Identifier.is);
53
- Identifier.zodType = z.string().refine(cryptly_1.cryptly.Identifier.is);
20
+ Identifier.typeZod = zod_1.zod.string().refine(cryptly_1.cryptly.Identifier.is);
54
21
  })(Identifier || (exports.Identifier = Identifier = {}));
55
22
  //# sourceMappingURL=Identifier.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Identifier.js","sourceRoot":"","sources":["../../Identifier.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAiC;AACjC,iCAA6B;AAC7B,+BAA2B;AAC3B,uCAAwB;AAGxB,IAAiB,UAAU,CAiB1B;AAjBD,WAAiB,UAAU;IAC1B,SAAgB,QAAQ,CACvB,OAAuB,aAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,EAC3C,SAAoC,EAAE,EACtC,WAAmC,UAAU;QAE7C,OAAO,iBAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,aAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAA;IACjG,CAAC;IANe,mBAAQ,WAMvB,CAAA;IACD,SAAgB,MAAM,CACrB,UAA8B,EAC9B,WAAmC,UAAU;QAE7C,MAAM,OAAO,GAAG,iBAAO,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;QAC3D,OAAO,aAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,cAAc,CAAC,CAAA;IACnH,CAAC;IANe,iBAAM,SAMrB,CAAA;IACY,eAAI,GAAG,WAAI,CAAC,MAAM,CAAC,YAAY,EAAE,iBAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;IACvD,kBAAO,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,iBAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;AAChE,CAAC,EAjBgB,UAAU,0BAAV,UAAU,QAiB1B"}
1
+ {"version":3,"file":"Identifier.js","sourceRoot":"","sources":["../../Identifier.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AACjC,iCAA6B;AAC7B,+BAA2B;AAC3B,+BAA2B;AAG3B,IAAiB,UAAU,CAiB1B;AAjBD,WAAiB,UAAU;IAC1B,SAAgB,QAAQ,CACvB,OAAuB,aAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,EAC3C,SAAoC,EAAE,EACtC,WAAmC,UAAU;QAE7C,OAAO,iBAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,aAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAA;IACjG,CAAC;IANe,mBAAQ,WAMvB,CAAA;IACD,SAAgB,MAAM,CACrB,UAA8B,EAC9B,WAAmC,UAAU;QAE7C,MAAM,OAAO,GAAG,iBAAO,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;QAC3D,OAAO,aAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,cAAc,CAAC,CAAA;IACnH,CAAC;IANe,iBAAM,SAMrB,CAAA;IACY,eAAI,GAAG,WAAI,CAAC,MAAM,CAAC,YAAY,EAAE,iBAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;IACvD,kBAAO,GAAG,SAAG,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,iBAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;AAClE,CAAC,EAjBgB,UAAU,0BAAV,UAAU,QAiB1B"}
@@ -1,17 +1,17 @@
1
- import * as z from "zod";
1
+ import { zod } from "../zod";
2
2
  export declare namespace Entry {
3
- const type: z.ZodObject<{
4
- message: z.ZodString;
5
- data: z.ZodOptional<z.ZodAny>;
6
- }, z.core.$strip>;
3
+ const type: zod.ZodObject<{
4
+ message: zod.ZodString;
5
+ data: zod.ZodOptional<zod.ZodAny>;
6
+ }, zod.z.core.$strip>;
7
7
  namespace Message {
8
- const type: z.ZodObject<{
9
- resource: z.ZodOptional<z.ZodString>;
10
- message: z.ZodString;
11
- data: z.ZodOptional<z.ZodAny>;
12
- }, z.core.$strip>;
8
+ const type: zod.ZodObject<{
9
+ resource: zod.ZodOptional<zod.ZodString>;
10
+ message: zod.ZodString;
11
+ data: zod.ZodOptional<zod.ZodAny>;
12
+ }, zod.z.core.$strip>;
13
13
  function to(message: string, data: any | undefined, resource: string | undefined): Entry.Message;
14
14
  }
15
- type Message = z.infer<typeof Message.type>;
15
+ type Message = zod.infer<typeof Message.type>;
16
16
  }
17
- export type Entry = z.infer<typeof Entry.type>;
17
+ export type Entry = zod.infer<typeof Entry.type>;
@@ -1,49 +1,16 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.Entry = void 0;
37
- const z = __importStar(require("zod"));
4
+ const zod_1 = require("../zod");
38
5
  var Entry;
39
6
  (function (Entry) {
40
- Entry.type = z.object({
41
- message: z.string(),
42
- data: z.any().optional(),
7
+ Entry.type = zod_1.zod.object({
8
+ message: zod_1.zod.string(),
9
+ data: zod_1.zod.any().optional(),
43
10
  });
44
11
  let Message;
45
12
  (function (Message) {
46
- Message.type = z.object({ ...Entry.type.shape, resource: z.string().optional() });
13
+ Message.type = zod_1.zod.object({ ...Entry.type.shape, resource: zod_1.zod.string().optional() });
47
14
  function to(message, data, resource) {
48
15
  const result = { message };
49
16
  resource && (result.resource = resource);
@@ -1 +1 @@
1
- {"version":3,"file":"Entry.js","sourceRoot":"","sources":["../../../Log/Entry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AAExB,IAAiB,KAAK,CAerB;AAfD,WAAiB,KAAK;IACR,UAAI,GAAG,CAAC,CAAC,MAAM,CAAC;QAC5B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;KACxB,CAAC,CAAA;IACF,IAAiB,OAAO,CAQvB;IARD,WAAiB,OAAO;QACV,YAAI,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;QACtF,SAAgB,EAAE,CAAC,OAAe,EAAE,IAAqB,EAAE,QAA4B;YACtF,MAAM,MAAM,GAAkB,EAAE,OAAO,EAAE,CAAA;YACzC,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAA;YACxC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,CAAA;YAC5B,OAAO,MAAM,CAAA;QACd,CAAC;QALe,UAAE,KAKjB,CAAA;IACF,CAAC,EARgB,OAAO,GAAP,aAAO,KAAP,aAAO,QAQvB;AAEF,CAAC,EAfgB,KAAK,qBAAL,KAAK,QAerB"}
1
+ {"version":3,"file":"Entry.js","sourceRoot":"","sources":["../../../Log/Entry.ts"],"names":[],"mappings":";;;AAAA,gCAA4B;AAE5B,IAAiB,KAAK,CAerB;AAfD,WAAiB,KAAK;IACR,UAAI,GAAG,SAAG,CAAC,MAAM,CAAC;QAC9B,OAAO,EAAE,SAAG,CAAC,MAAM,EAAE;QACrB,IAAI,EAAE,SAAG,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;KAC1B,CAAC,CAAA;IACF,IAAiB,OAAO,CAQvB;IARD,WAAiB,OAAO;QACV,YAAI,GAAG,SAAG,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;QAC1F,SAAgB,EAAE,CAAC,OAAe,EAAE,IAAqB,EAAE,QAA4B;YACtF,MAAM,MAAM,GAAkB,EAAE,OAAO,EAAE,CAAA;YACzC,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAA;YACxC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,CAAA;YAC5B,OAAO,MAAM,CAAA;QACd,CAAC;QALe,UAAE,KAKjB,CAAA;IACF,CAAC,EARgB,OAAO,GAAP,aAAO,KAAP,aAAO,QAQvB;AAEF,CAAC,EAfgB,KAAK,qBAAL,KAAK,QAerB"}
@@ -1,11 +1,11 @@
1
- import * as z from "zod";
1
+ import { zod } from "../zod";
2
2
  export declare namespace Locations {
3
- const type: z.ZodObject<{
4
- cfConnectionIp: z.ZodOptional<z.ZodString>;
5
- cfIpCountry: z.ZodOptional<z.ZodString>;
6
- datacenter: z.ZodOptional<z.ZodString>;
7
- country: z.ZodOptional<z.ZodString>;
8
- }, z.core.$strip>;
3
+ const type: zod.ZodObject<{
4
+ cfConnectionIp: zod.ZodOptional<zod.ZodString>;
5
+ cfIpCountry: zod.ZodOptional<zod.ZodString>;
6
+ datacenter: zod.ZodOptional<zod.ZodString>;
7
+ country: zod.ZodOptional<zod.ZodString>;
8
+ }, zod.z.core.$strip>;
9
9
  function getLocations(request: any): Locations | undefined;
10
10
  }
11
- export type Locations = z.infer<typeof Locations.type>;
11
+ export type Locations = zod.infer<typeof Locations.type>;