@logto/schemas 1.9.2 → 1.10.1

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 (146) hide show
  1. package/alterations/1.10.1-1695647183-update-private-key-type.ts +108 -0
  2. package/alterations/1.10.1-1696657546-organization-tables.ts +150 -0
  3. package/alterations/1.10.1-1697683802-add-sso-connectors-table.ts +66 -0
  4. package/alterations/1.10.1-1698646271-add-organization-created-flag.ts +75 -0
  5. package/alterations/1.10.1-1698820410-add-user-sso-identities-table.ts +61 -0
  6. package/alterations/1.10.1-1698910485-user-logto-data.ts +20 -0
  7. package/alterations/1.9.2-1695198741-remove-m2m-app-admin-access-switch.ts +52 -24
  8. package/alterations-js/1.10.1-1695647183-update-private-key-type.d.ts +3 -0
  9. package/alterations-js/1.10.1-1695647183-update-private-key-type.js +50 -0
  10. package/alterations-js/1.10.1-1696657546-organization-tables.d.ts +3 -0
  11. package/alterations-js/1.10.1-1696657546-organization-tables.js +136 -0
  12. package/alterations-js/1.10.1-1697683802-add-sso-connectors-table.d.ts +3 -0
  13. package/alterations-js/1.10.1-1697683802-add-sso-connectors-table.js +58 -0
  14. package/alterations-js/1.10.1-1698646271-add-organization-created-flag.d.ts +3 -0
  15. package/alterations-js/1.10.1-1698646271-add-organization-created-flag.js +26 -0
  16. package/alterations-js/1.10.1-1698820410-add-user-sso-identities-table.d.ts +4 -0
  17. package/alterations-js/1.10.1-1698820410-add-user-sso-identities-table.js +53 -0
  18. package/alterations-js/1.10.1-1698910485-user-logto-data.d.ts +3 -0
  19. package/alterations-js/1.10.1-1698910485-user-logto-data.js +16 -0
  20. package/alterations-js/1.9.2-1695198741-remove-m2m-app-admin-access-switch.js +47 -5
  21. package/lib/db-entries/application.d.ts +7 -1
  22. package/lib/db-entries/application.js +1 -0
  23. package/lib/db-entries/applications-role.d.ts +7 -1
  24. package/lib/db-entries/applications-role.js +1 -0
  25. package/lib/db-entries/connector.d.ts +7 -1
  26. package/lib/db-entries/connector.js +1 -0
  27. package/lib/db-entries/custom-phrase.d.ts +7 -1
  28. package/lib/db-entries/custom-phrase.js +1 -0
  29. package/lib/db-entries/daily-active-user.d.ts +7 -1
  30. package/lib/db-entries/daily-active-user.js +1 -0
  31. package/lib/db-entries/domain.d.ts +7 -1
  32. package/lib/db-entries/domain.js +1 -0
  33. package/lib/db-entries/hook.d.ts +7 -1
  34. package/lib/db-entries/hook.js +1 -0
  35. package/lib/db-entries/index.d.ts +8 -0
  36. package/lib/db-entries/index.js +8 -0
  37. package/lib/db-entries/log.d.ts +7 -1
  38. package/lib/db-entries/log.js +1 -0
  39. package/lib/db-entries/logto-config.d.ts +10 -4
  40. package/lib/db-entries/logto-config.js +4 -3
  41. package/lib/db-entries/oidc-model-instance.d.ts +7 -1
  42. package/lib/db-entries/oidc-model-instance.js +1 -0
  43. package/lib/db-entries/organization-role-scope-relation.d.ts +20 -0
  44. package/lib/db-entries/organization-role-scope-relation.js +29 -0
  45. package/lib/db-entries/organization-role-user-relation.d.ts +22 -0
  46. package/lib/db-entries/organization-role-user-relation.js +33 -0
  47. package/lib/db-entries/organization-role.d.ts +28 -0
  48. package/lib/db-entries/organization-role.js +33 -0
  49. package/lib/db-entries/organization-scope.d.ts +28 -0
  50. package/lib/db-entries/organization-scope.js +33 -0
  51. package/lib/db-entries/organization-user-relation.d.ts +20 -0
  52. package/lib/db-entries/organization-user-relation.js +29 -0
  53. package/lib/db-entries/organization.d.ts +32 -0
  54. package/lib/db-entries/organization.js +37 -0
  55. package/lib/db-entries/passcode.d.ts +7 -1
  56. package/lib/db-entries/passcode.js +1 -0
  57. package/lib/db-entries/resource.d.ts +7 -1
  58. package/lib/db-entries/resource.js +1 -0
  59. package/lib/db-entries/role.d.ts +7 -1
  60. package/lib/db-entries/role.js +1 -0
  61. package/lib/db-entries/roles-scope.d.ts +7 -1
  62. package/lib/db-entries/roles-scope.js +1 -0
  63. package/lib/db-entries/scope.d.ts +7 -1
  64. package/lib/db-entries/scope.js +1 -0
  65. package/lib/db-entries/sentinel-activity.d.ts +7 -1
  66. package/lib/db-entries/sentinel-activity.js +1 -0
  67. package/lib/db-entries/service-log.d.ts +7 -1
  68. package/lib/db-entries/service-log.js +1 -0
  69. package/lib/db-entries/sign-in-experience.d.ts +7 -1
  70. package/lib/db-entries/sign-in-experience.js +1 -0
  71. package/lib/db-entries/sso-connector.d.ts +50 -0
  72. package/lib/db-entries/sso-connector.js +58 -0
  73. package/lib/db-entries/system.d.ts +7 -1
  74. package/lib/db-entries/system.js +1 -0
  75. package/lib/db-entries/user-sso-identity.d.ts +30 -0
  76. package/lib/db-entries/user-sso-identity.js +46 -0
  77. package/lib/db-entries/user.d.ts +9 -1
  78. package/lib/db-entries/user.js +5 -0
  79. package/lib/db-entries/users-role.d.ts +7 -1
  80. package/lib/db-entries/users-role.js +1 -0
  81. package/lib/db-entries/verification-status.d.ts +7 -1
  82. package/lib/db-entries/verification-status.js +1 -0
  83. package/lib/foundations/index.d.ts +1 -1
  84. package/lib/foundations/index.js +1 -1
  85. package/lib/foundations/jsonb-types/custom-domain.d.ts +134 -0
  86. package/lib/foundations/jsonb-types/custom-domain.js +36 -0
  87. package/lib/foundations/jsonb-types/hooks.d.ts +32 -0
  88. package/lib/foundations/jsonb-types/hooks.js +24 -0
  89. package/lib/foundations/jsonb-types/index.d.ts +15 -0
  90. package/lib/foundations/jsonb-types/index.js +16 -0
  91. package/lib/foundations/jsonb-types/logs.d.ts +106 -0
  92. package/lib/foundations/jsonb-types/logs.js +20 -0
  93. package/lib/foundations/jsonb-types/oidc-module.d.ts +80 -0
  94. package/lib/foundations/jsonb-types/oidc-module.js +54 -0
  95. package/lib/foundations/jsonb-types/phrases.d.ts +5 -0
  96. package/lib/foundations/jsonb-types/phrases.js +2 -0
  97. package/lib/foundations/jsonb-types/sentinel.d.ts +27 -0
  98. package/lib/foundations/jsonb-types/sentinel.js +28 -0
  99. package/lib/foundations/jsonb-types/sign-in-experience.d.ts +118 -0
  100. package/lib/foundations/jsonb-types/sign-in-experience.js +56 -0
  101. package/lib/foundations/jsonb-types/sso-connector.d.ts +14 -0
  102. package/lib/foundations/jsonb-types/sso-connector.js +6 -0
  103. package/lib/foundations/jsonb-types/users.d.ts +285 -0
  104. package/lib/foundations/jsonb-types/users.js +47 -0
  105. package/lib/foundations/schemas.d.ts +11 -13
  106. package/lib/models/tenants.d.ts +7 -11
  107. package/lib/seeds/logto-config.js +1 -0
  108. package/lib/types/application.d.ts +51 -1
  109. package/lib/types/application.js +7 -1
  110. package/lib/types/connector.d.ts +516 -2360
  111. package/lib/types/domain.d.ts +65 -27
  112. package/lib/types/hook.d.ts +15 -16
  113. package/lib/types/index.d.ts +3 -0
  114. package/lib/types/index.js +3 -0
  115. package/lib/types/interactions.d.ts +502 -10
  116. package/lib/types/interactions.js +83 -5
  117. package/lib/types/log/interaction.d.ts +4 -3
  118. package/lib/types/log/interaction.js +1 -0
  119. package/lib/types/logto-config.d.ts +50 -2
  120. package/lib/types/logto-config.js +30 -3
  121. package/lib/types/mfa.d.ts +211 -0
  122. package/lib/types/mfa.js +62 -0
  123. package/lib/types/organization.d.ts +44 -0
  124. package/lib/types/organization.js +20 -0
  125. package/lib/types/role.d.ts +5 -3
  126. package/lib/types/scope.d.ts +12 -27
  127. package/lib/types/sso-connector.d.ts +21 -0
  128. package/lib/types/sso-connector.js +10 -0
  129. package/lib/types/system.d.ts +26 -7
  130. package/lib/types/system.js +8 -0
  131. package/lib/types/user-assets.d.ts +2 -2
  132. package/lib/types/user.d.ts +209 -66
  133. package/lib/types/user.js +8 -2
  134. package/package.json +7 -7
  135. package/tables/logto_configs.sql +1 -1
  136. package/tables/organization_role_scope_relations.sql +12 -0
  137. package/tables/organization_role_user_relations.sql +14 -0
  138. package/tables/organization_roles.sql +19 -0
  139. package/tables/organization_scopes.sql +19 -0
  140. package/tables/organization_user_relations.sql +12 -0
  141. package/tables/organizations.sql +19 -0
  142. package/tables/sso_connectors.sql +29 -0
  143. package/tables/user_sso_identities.sql +17 -0
  144. package/tables/users.sql +1 -0
  145. package/lib/foundations/jsonb-types.d.ts +0 -673
  146. package/lib/foundations/jsonb-types.js +0 -260
@@ -0,0 +1,285 @@
1
+ import { z } from 'zod';
2
+ import { MfaFactor } from './sign-in-experience.js';
3
+ export declare const roleNamesGuard: z.ZodArray<z.ZodString, "many">;
4
+ declare const identityGuard: z.ZodObject<{
5
+ userId: z.ZodString;
6
+ details: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ userId: string;
9
+ details?: {} | undefined;
10
+ }, {
11
+ userId: string;
12
+ details?: {} | undefined;
13
+ }>;
14
+ export declare const identitiesGuard: z.ZodRecord<z.ZodString, z.ZodObject<{
15
+ userId: z.ZodString;
16
+ details: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
17
+ }, "strip", z.ZodTypeAny, {
18
+ userId: string;
19
+ details?: {} | undefined;
20
+ }, {
21
+ userId: string;
22
+ details?: {} | undefined;
23
+ }>>;
24
+ export type Identity = z.infer<typeof identityGuard>;
25
+ export type Identities = z.infer<typeof identitiesGuard>;
26
+ export declare const baseMfaVerification: {
27
+ id: z.ZodString;
28
+ createdAt: z.ZodString;
29
+ lastUsedAt: z.ZodOptional<z.ZodString>;
30
+ };
31
+ export declare const mfaVerificationTotp: z.ZodObject<{
32
+ key: z.ZodString;
33
+ id: z.ZodString;
34
+ createdAt: z.ZodString;
35
+ lastUsedAt: z.ZodOptional<z.ZodString>;
36
+ type: z.ZodLiteral<MfaFactor.TOTP>;
37
+ }, "strip", z.ZodTypeAny, {
38
+ type: MfaFactor.TOTP;
39
+ id: string;
40
+ key: string;
41
+ createdAt: string;
42
+ lastUsedAt?: string | undefined;
43
+ }, {
44
+ type: MfaFactor.TOTP;
45
+ id: string;
46
+ key: string;
47
+ createdAt: string;
48
+ lastUsedAt?: string | undefined;
49
+ }>;
50
+ export type MfaVerificationTotp = z.infer<typeof mfaVerificationTotp>;
51
+ export declare const webAuthnTransportGuard: z.ZodEnum<["usb", "nfc", "ble", "internal", "cable", "hybrid", "smart-card"]>;
52
+ export declare const mfaVerificationWebAuthn: z.ZodObject<{
53
+ credentialId: z.ZodString;
54
+ publicKey: z.ZodString;
55
+ transports: z.ZodOptional<z.ZodArray<z.ZodEnum<["usb", "nfc", "ble", "internal", "cable", "hybrid", "smart-card"]>, "many">>;
56
+ counter: z.ZodNumber;
57
+ agent: z.ZodString;
58
+ id: z.ZodString;
59
+ createdAt: z.ZodString;
60
+ lastUsedAt: z.ZodOptional<z.ZodString>;
61
+ type: z.ZodLiteral<MfaFactor.WebAuthn>;
62
+ }, "strip", z.ZodTypeAny, {
63
+ type: MfaFactor.WebAuthn;
64
+ id: string;
65
+ createdAt: string;
66
+ credentialId: string;
67
+ publicKey: string;
68
+ counter: number;
69
+ agent: string;
70
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
71
+ lastUsedAt?: string | undefined;
72
+ }, {
73
+ type: MfaFactor.WebAuthn;
74
+ id: string;
75
+ createdAt: string;
76
+ credentialId: string;
77
+ publicKey: string;
78
+ counter: number;
79
+ agent: string;
80
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
81
+ lastUsedAt?: string | undefined;
82
+ }>;
83
+ export type MfaVerificationWebAuthn = z.infer<typeof mfaVerificationWebAuthn>;
84
+ export declare const mfaVerificationBackupCode: z.ZodObject<{
85
+ codes: z.ZodArray<z.ZodObject<{
86
+ code: z.ZodString;
87
+ usedAt: z.ZodOptional<z.ZodString>;
88
+ }, "strip", z.ZodTypeAny, {
89
+ code: string;
90
+ usedAt?: string | undefined;
91
+ }, {
92
+ code: string;
93
+ usedAt?: string | undefined;
94
+ }>, "many">;
95
+ id: z.ZodString;
96
+ createdAt: z.ZodString;
97
+ lastUsedAt: z.ZodOptional<z.ZodString>;
98
+ type: z.ZodLiteral<MfaFactor.BackupCode>;
99
+ }, "strip", z.ZodTypeAny, {
100
+ type: MfaFactor.BackupCode;
101
+ id: string;
102
+ createdAt: string;
103
+ codes: {
104
+ code: string;
105
+ usedAt?: string | undefined;
106
+ }[];
107
+ lastUsedAt?: string | undefined;
108
+ }, {
109
+ type: MfaFactor.BackupCode;
110
+ id: string;
111
+ createdAt: string;
112
+ codes: {
113
+ code: string;
114
+ usedAt?: string | undefined;
115
+ }[];
116
+ lastUsedAt?: string | undefined;
117
+ }>;
118
+ export type MfaVerificationBackupCode = z.infer<typeof mfaVerificationBackupCode>;
119
+ export declare const mfaVerificationGuard: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
120
+ key: z.ZodString;
121
+ id: z.ZodString;
122
+ createdAt: z.ZodString;
123
+ lastUsedAt: z.ZodOptional<z.ZodString>;
124
+ type: z.ZodLiteral<MfaFactor.TOTP>;
125
+ }, "strip", z.ZodTypeAny, {
126
+ type: MfaFactor.TOTP;
127
+ id: string;
128
+ key: string;
129
+ createdAt: string;
130
+ lastUsedAt?: string | undefined;
131
+ }, {
132
+ type: MfaFactor.TOTP;
133
+ id: string;
134
+ key: string;
135
+ createdAt: string;
136
+ lastUsedAt?: string | undefined;
137
+ }>, z.ZodObject<{
138
+ credentialId: z.ZodString;
139
+ publicKey: z.ZodString;
140
+ transports: z.ZodOptional<z.ZodArray<z.ZodEnum<["usb", "nfc", "ble", "internal", "cable", "hybrid", "smart-card"]>, "many">>;
141
+ counter: z.ZodNumber;
142
+ agent: z.ZodString;
143
+ id: z.ZodString;
144
+ createdAt: z.ZodString;
145
+ lastUsedAt: z.ZodOptional<z.ZodString>;
146
+ type: z.ZodLiteral<MfaFactor.WebAuthn>;
147
+ }, "strip", z.ZodTypeAny, {
148
+ type: MfaFactor.WebAuthn;
149
+ id: string;
150
+ createdAt: string;
151
+ credentialId: string;
152
+ publicKey: string;
153
+ counter: number;
154
+ agent: string;
155
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
156
+ lastUsedAt?: string | undefined;
157
+ }, {
158
+ type: MfaFactor.WebAuthn;
159
+ id: string;
160
+ createdAt: string;
161
+ credentialId: string;
162
+ publicKey: string;
163
+ counter: number;
164
+ agent: string;
165
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
166
+ lastUsedAt?: string | undefined;
167
+ }>, z.ZodObject<{
168
+ codes: z.ZodArray<z.ZodObject<{
169
+ code: z.ZodString;
170
+ usedAt: z.ZodOptional<z.ZodString>;
171
+ }, "strip", z.ZodTypeAny, {
172
+ code: string;
173
+ usedAt?: string | undefined;
174
+ }, {
175
+ code: string;
176
+ usedAt?: string | undefined;
177
+ }>, "many">;
178
+ id: z.ZodString;
179
+ createdAt: z.ZodString;
180
+ lastUsedAt: z.ZodOptional<z.ZodString>;
181
+ type: z.ZodLiteral<MfaFactor.BackupCode>;
182
+ }, "strip", z.ZodTypeAny, {
183
+ type: MfaFactor.BackupCode;
184
+ id: string;
185
+ createdAt: string;
186
+ codes: {
187
+ code: string;
188
+ usedAt?: string | undefined;
189
+ }[];
190
+ lastUsedAt?: string | undefined;
191
+ }, {
192
+ type: MfaFactor.BackupCode;
193
+ id: string;
194
+ createdAt: string;
195
+ codes: {
196
+ code: string;
197
+ usedAt?: string | undefined;
198
+ }[];
199
+ lastUsedAt?: string | undefined;
200
+ }>]>;
201
+ export type MfaVerification = z.infer<typeof mfaVerificationGuard>;
202
+ export declare const mfaVerificationsGuard: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
203
+ key: z.ZodString;
204
+ id: z.ZodString;
205
+ createdAt: z.ZodString;
206
+ lastUsedAt: z.ZodOptional<z.ZodString>;
207
+ type: z.ZodLiteral<MfaFactor.TOTP>;
208
+ }, "strip", z.ZodTypeAny, {
209
+ type: MfaFactor.TOTP;
210
+ id: string;
211
+ key: string;
212
+ createdAt: string;
213
+ lastUsedAt?: string | undefined;
214
+ }, {
215
+ type: MfaFactor.TOTP;
216
+ id: string;
217
+ key: string;
218
+ createdAt: string;
219
+ lastUsedAt?: string | undefined;
220
+ }>, z.ZodObject<{
221
+ credentialId: z.ZodString;
222
+ publicKey: z.ZodString;
223
+ transports: z.ZodOptional<z.ZodArray<z.ZodEnum<["usb", "nfc", "ble", "internal", "cable", "hybrid", "smart-card"]>, "many">>;
224
+ counter: z.ZodNumber;
225
+ agent: z.ZodString;
226
+ id: z.ZodString;
227
+ createdAt: z.ZodString;
228
+ lastUsedAt: z.ZodOptional<z.ZodString>;
229
+ type: z.ZodLiteral<MfaFactor.WebAuthn>;
230
+ }, "strip", z.ZodTypeAny, {
231
+ type: MfaFactor.WebAuthn;
232
+ id: string;
233
+ createdAt: string;
234
+ credentialId: string;
235
+ publicKey: string;
236
+ counter: number;
237
+ agent: string;
238
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
239
+ lastUsedAt?: string | undefined;
240
+ }, {
241
+ type: MfaFactor.WebAuthn;
242
+ id: string;
243
+ createdAt: string;
244
+ credentialId: string;
245
+ publicKey: string;
246
+ counter: number;
247
+ agent: string;
248
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
249
+ lastUsedAt?: string | undefined;
250
+ }>, z.ZodObject<{
251
+ codes: z.ZodArray<z.ZodObject<{
252
+ code: z.ZodString;
253
+ usedAt: z.ZodOptional<z.ZodString>;
254
+ }, "strip", z.ZodTypeAny, {
255
+ code: string;
256
+ usedAt?: string | undefined;
257
+ }, {
258
+ code: string;
259
+ usedAt?: string | undefined;
260
+ }>, "many">;
261
+ id: z.ZodString;
262
+ createdAt: z.ZodString;
263
+ lastUsedAt: z.ZodOptional<z.ZodString>;
264
+ type: z.ZodLiteral<MfaFactor.BackupCode>;
265
+ }, "strip", z.ZodTypeAny, {
266
+ type: MfaFactor.BackupCode;
267
+ id: string;
268
+ createdAt: string;
269
+ codes: {
270
+ code: string;
271
+ usedAt?: string | undefined;
272
+ }[];
273
+ lastUsedAt?: string | undefined;
274
+ }, {
275
+ type: MfaFactor.BackupCode;
276
+ id: string;
277
+ createdAt: string;
278
+ codes: {
279
+ code: string;
280
+ usedAt?: string | undefined;
281
+ }[];
282
+ lastUsedAt?: string | undefined;
283
+ }>]>, "many">;
284
+ export type MfaVerifications = z.infer<typeof mfaVerificationsGuard>;
285
+ export {};
@@ -0,0 +1,47 @@
1
+ import { z } from 'zod';
2
+ import { MfaFactor } from './sign-in-experience.js';
3
+ export const roleNamesGuard = z.string().array();
4
+ const identityGuard = z.object({
5
+ userId: z.string(),
6
+ details: z.object({}).optional(), // Connector's userinfo details, schemaless
7
+ });
8
+ export const identitiesGuard = z.record(identityGuard);
9
+ export const baseMfaVerification = {
10
+ id: z.string(),
11
+ createdAt: z.string(),
12
+ lastUsedAt: z.string().optional(),
13
+ };
14
+ export const mfaVerificationTotp = z.object({
15
+ type: z.literal(MfaFactor.TOTP),
16
+ ...baseMfaVerification,
17
+ key: z.string(),
18
+ });
19
+ export const webAuthnTransportGuard = z.enum([
20
+ 'usb',
21
+ 'nfc',
22
+ 'ble',
23
+ 'internal',
24
+ 'cable',
25
+ 'hybrid',
26
+ 'smart-card',
27
+ ]);
28
+ export const mfaVerificationWebAuthn = z.object({
29
+ type: z.literal(MfaFactor.WebAuthn),
30
+ ...baseMfaVerification,
31
+ credentialId: z.string(),
32
+ publicKey: z.string(),
33
+ transports: webAuthnTransportGuard.array().optional(),
34
+ counter: z.number(),
35
+ agent: z.string(),
36
+ });
37
+ export const mfaVerificationBackupCode = z.object({
38
+ type: z.literal(MfaFactor.BackupCode),
39
+ ...baseMfaVerification,
40
+ codes: z.object({ code: z.string(), usedAt: z.string().optional() }).array(),
41
+ });
42
+ export const mfaVerificationGuard = z.discriminatedUnion('type', [
43
+ mfaVerificationTotp,
44
+ mfaVerificationWebAuthn,
45
+ mfaVerificationBackupCode,
46
+ ]);
47
+ export const mfaVerificationsGuard = mfaVerificationGuard.array();
@@ -1,20 +1,18 @@
1
1
  import { type SchemaLike } from '@logto/shared/universal';
2
- import type { ZodObject, ZodType, ZodOptional } from 'zod';
2
+ import type { ZodObject, ZodType, ZodOptional, ZodTypeAny } from 'zod';
3
3
  export type { SchemaLike, SchemaValue, SchemaValuePrimitive } from '@logto/shared/universal';
4
4
  type ParseOptional<K> = undefined extends K ? ZodOptional<ZodType<Exclude<K, undefined>>> : ZodType<K>;
5
- export type CreateGuard<T extends Record<string, unknown>> = ZodObject<{
5
+ export type Guard<T extends SchemaLike<string>> = ZodObject<{
6
6
  [key in keyof T]-?: ParseOptional<T[key]>;
7
- }>;
8
- export type Guard<T extends Record<string, unknown>> = ZodObject<{
9
- [key in keyof T]: ZodType<T[key]>;
10
- }>;
11
- export type GeneratedSchema<CreateSchema extends SchemaLike, Schema extends CreateSchema> = keyof Schema extends string ? Readonly<{
12
- table: string;
13
- tableSingular: string;
7
+ }, 'strip', ZodTypeAny, T, T>;
8
+ export type GeneratedSchema<Key extends string, CreateSchema extends Partial<SchemaLike<Key>>, Schema extends SchemaLike<Key>, Table extends string = string, TableSingular extends string = string> = Readonly<{
9
+ table: Table;
10
+ tableSingular: TableSingular;
14
11
  fields: {
15
- [key in keyof Required<Schema>]: string;
12
+ [key in Key]: string;
16
13
  };
17
- fieldKeys: ReadonlyArray<keyof Schema>;
18
- createGuard: CreateGuard<CreateSchema>;
14
+ fieldKeys: readonly Key[];
15
+ createGuard: Guard<CreateSchema>;
19
16
  guard: Guard<Schema>;
20
- }> : never;
17
+ updateGuard: Guard<Partial<Schema>>;
18
+ }>;
@@ -13,27 +13,23 @@ export declare const Tenants: import("@withtyped/server/model").default<"tenants
13
13
  tag: TenantTag;
14
14
  createdAt: Date;
15
15
  isSuspended: boolean;
16
- }, "createdAt" | "name" | "isSuspended" | "tag", "createdAt">;
16
+ }, "name" | "createdAt" | "isSuspended" | "tag", "createdAt">;
17
17
  export type TenantModel = InferModelType<typeof Tenants>;
18
- export declare const tenantInfoGuard: z.ZodObject<z.extendShape<Pick<{
19
- id: z.ZodType<string, z.ZodTypeDef, string>;
20
- dbUser: z.ZodType<string | null, z.ZodTypeDef, string | null>;
21
- dbUserPassword: z.ZodType<string | null, z.ZodTypeDef, string | null>;
18
+ export declare const tenantInfoGuard: z.ZodObject<{
22
19
  name: z.ZodType<string, z.ZodTypeDef, string>;
23
- tag: z.ZodType<TenantTag, z.ZodTypeDef, TenantTag>;
24
- createdAt: z.ZodType<Date, z.ZodTypeDef, Date>;
20
+ id: z.ZodType<string, z.ZodTypeDef, string>;
25
21
  isSuspended: z.ZodType<boolean, z.ZodTypeDef, boolean>;
26
- }, "id" | "name" | "isSuspended" | "tag">, {
22
+ tag: z.ZodType<TenantTag, z.ZodTypeDef, TenantTag>;
27
23
  indicator: z.ZodString;
28
- }>, "strip", z.ZodTypeAny, {
29
- id: string;
24
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
30
25
  name: string;
26
+ id: string;
31
27
  indicator: string;
32
28
  isSuspended: boolean;
33
29
  tag: TenantTag;
34
30
  }, {
35
- id: string;
36
31
  name: string;
32
+ id: string;
37
33
  indicator: string;
38
34
  isSuspended: boolean;
39
35
  tag: TenantTag;
@@ -5,6 +5,7 @@ export const createDefaultAdminConsoleConfig = (forTenantId) => Object.freeze({
5
5
  key: LogtoTenantConfigKey.AdminConsole,
6
6
  value: {
7
7
  signInExperienceCustomized: false,
8
+ organizationCreated: false,
8
9
  },
9
10
  });
10
11
  export const createCloudConnectionConfig = (forTenantId, appId, appSecret) => Object.freeze({
@@ -1,4 +1,54 @@
1
- import type { Application } from '../db-entries/index.js';
1
+ import { type z } from 'zod';
2
+ import { type Application } from '../db-entries/index.js';
2
3
  export type ApplicationResponse = Application & {
3
4
  isAdmin: boolean;
4
5
  };
6
+ /**
7
+ * An application that is featured for display. Usually used in a list of resources that are
8
+ * related to a group of applications.
9
+ */
10
+ export type FeaturedApplication = Pick<Application, 'id' | 'name' | 'type'>;
11
+ /** The guard for {@link FeaturedApplication}. */
12
+ export declare const featuredApplicationGuard: z.ZodObject<Pick<{
13
+ tenantId: z.ZodType<string, z.ZodTypeDef, string>;
14
+ id: z.ZodType<string, z.ZodTypeDef, string>;
15
+ name: z.ZodType<string, z.ZodTypeDef, string>;
16
+ secret: z.ZodType<string, z.ZodTypeDef, string>;
17
+ description: z.ZodType<string | null, z.ZodTypeDef, string | null>;
18
+ type: z.ZodType<import("../db-entries/custom-types.js").ApplicationType, z.ZodTypeDef, import("../db-entries/custom-types.js").ApplicationType>;
19
+ oidcClientMetadata: z.ZodType<{
20
+ redirectUris: string[];
21
+ postLogoutRedirectUris: string[];
22
+ logoUri?: string | undefined;
23
+ }, z.ZodTypeDef, {
24
+ redirectUris: string[];
25
+ postLogoutRedirectUris: string[];
26
+ logoUri?: string | undefined;
27
+ }>;
28
+ customClientMetadata: z.ZodType<{
29
+ corsAllowedOrigins?: string[] | undefined;
30
+ idTokenTtl?: number | undefined;
31
+ refreshTokenTtl?: number | undefined;
32
+ refreshTokenTtlInDays?: number | undefined;
33
+ tenantId?: string | undefined;
34
+ alwaysIssueRefreshToken?: boolean | undefined;
35
+ rotateRefreshToken?: boolean | undefined;
36
+ }, z.ZodTypeDef, {
37
+ corsAllowedOrigins?: string[] | undefined;
38
+ idTokenTtl?: number | undefined;
39
+ refreshTokenTtl?: number | undefined;
40
+ refreshTokenTtlInDays?: number | undefined;
41
+ tenantId?: string | undefined;
42
+ alwaysIssueRefreshToken?: boolean | undefined;
43
+ rotateRefreshToken?: boolean | undefined;
44
+ }>;
45
+ createdAt: z.ZodType<number, z.ZodTypeDef, number>;
46
+ }, "type" | "name" | "id">, "strip", z.ZodTypeAny, {
47
+ type: import("../db-entries/custom-types.js").ApplicationType;
48
+ name: string;
49
+ id: string;
50
+ }, {
51
+ type: import("../db-entries/custom-types.js").ApplicationType;
52
+ name: string;
53
+ id: string;
54
+ }>;
@@ -1 +1,7 @@
1
- export {};
1
+ import { Applications } from '../db-entries/index.js';
2
+ /** The guard for {@link FeaturedApplication}. */
3
+ export const featuredApplicationGuard = Applications.guard.pick({
4
+ id: true,
5
+ name: true,
6
+ type: true,
7
+ });