@logto/schemas 1.11.0 → 1.13.0

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 (158) hide show
  1. package/alterations/1.12.0-1700031616-update-org-role-foreign-keys.ts +35 -0
  2. package/alterations/1.12.0-1701054133-add-unique-constraint-to-the-sso-connector-name.ts +21 -0
  3. package/alterations/1.12.0-1701245520-add-single-sign-on-enabled-flag-to-sie.ts +20 -0
  4. package/alterations/1.13.0-1702274830-add-new-third-party-column-to-applications-table.ts +20 -0
  5. package/alterations/1.13.0-1702372401-add-application-permissions-tables.ts +93 -0
  6. package/alterations/1.13.0-1702544178-sync-tenant-orgs.ts +296 -0
  7. package/alterations/1.13.0-1702871078-protected-application-type.ts +24 -0
  8. package/alterations/1.13.0-1702877515-protected-app-configs.ts +18 -0
  9. package/alterations/1.13.0-1702978120-application-sign-in-experience-table.ts +61 -0
  10. package/alterations/1.13.0-1703229996-daily-token-usage.ts +62 -0
  11. package/alterations/1.13.0-1703230000-update-tenant-roles.ts +94 -0
  12. package/alterations/1.13.0-1704692973-remove-legacy-resources.ts +147 -0
  13. package/alterations/1.13.0-1704934999-add-magic-links-table.ts +37 -0
  14. package/alterations/1.13.0-1704935001-add-organization-invitation-tables.ts +78 -0
  15. package/alterations/1.13.0-1705288654-add-application-user-consent-organizations-table.ts +62 -0
  16. package/alterations/1.13.0-1705991158-update-invitation-indices.ts +32 -0
  17. package/alterations/1.13.0-1706449174-update-organization-invitation-column.ts +24 -0
  18. package/alterations/1.13.0-1706510290-protected-app-host-index.ts +21 -0
  19. package/alterations/1.13.0-1706512952-restore-get-started-page.ts +17 -0
  20. package/alterations/1.13.0-1706528755-remove-magic-links.ts +46 -0
  21. package/alterations/1.13.0-1706585206-protected-app-custom-domain-unique.ts +21 -0
  22. package/alterations/utils/1704934999-tables.ts +49 -0
  23. package/alterations/utils/README.md +9 -0
  24. package/alterations-js/1.12.0-1700031616-update-org-role-foreign-keys.d.ts +3 -0
  25. package/alterations-js/1.12.0-1700031616-update-org-role-foreign-keys.js +31 -0
  26. package/alterations-js/1.12.0-1701054133-add-unique-constraint-to-the-sso-connector-name.d.ts +3 -0
  27. package/alterations-js/1.12.0-1701054133-add-unique-constraint-to-the-sso-connector-name.js +17 -0
  28. package/alterations-js/1.12.0-1701245520-add-single-sign-on-enabled-flag-to-sie.d.ts +3 -0
  29. package/alterations-js/1.12.0-1701245520-add-single-sign-on-enabled-flag-to-sie.js +16 -0
  30. package/alterations-js/1.13.0-1702274830-add-new-third-party-column-to-applications-table.d.ts +3 -0
  31. package/alterations-js/1.13.0-1702274830-add-new-third-party-column-to-applications-table.js +16 -0
  32. package/alterations-js/1.13.0-1702372401-add-application-permissions-tables.d.ts +3 -0
  33. package/alterations-js/1.13.0-1702372401-add-application-permissions-tables.js +79 -0
  34. package/alterations-js/1.13.0-1702544178-sync-tenant-orgs.d.ts +18 -0
  35. package/alterations-js/1.13.0-1702544178-sync-tenant-orgs.js +225 -0
  36. package/alterations-js/1.13.0-1702871078-protected-application-type.d.ts +3 -0
  37. package/alterations-js/1.13.0-1702871078-protected-application-type.js +20 -0
  38. package/alterations-js/1.13.0-1702877515-protected-app-configs.d.ts +3 -0
  39. package/alterations-js/1.13.0-1702877515-protected-app-configs.js +14 -0
  40. package/alterations-js/1.13.0-1702978120-application-sign-in-experience-table.d.ts +3 -0
  41. package/alterations-js/1.13.0-1702978120-application-sign-in-experience-table.js +51 -0
  42. package/alterations-js/1.13.0-1703229996-daily-token-usage.d.ts +3 -0
  43. package/alterations-js/1.13.0-1703229996-daily-token-usage.js +51 -0
  44. package/alterations-js/1.13.0-1703230000-update-tenant-roles.d.ts +11 -0
  45. package/alterations-js/1.13.0-1703230000-update-tenant-roles.js +87 -0
  46. package/alterations-js/1.13.0-1704692973-remove-legacy-resources.d.ts +3 -0
  47. package/alterations-js/1.13.0-1704692973-remove-legacy-resources.js +124 -0
  48. package/alterations-js/1.13.0-1704934999-add-magic-links-table.d.ts +3 -0
  49. package/alterations-js/1.13.0-1704934999-add-magic-links-table.js +32 -0
  50. package/alterations-js/1.13.0-1704935001-add-organization-invitation-tables.d.ts +3 -0
  51. package/alterations-js/1.13.0-1704935001-add-organization-invitation-tables.js +72 -0
  52. package/alterations-js/1.13.0-1705288654-add-application-user-consent-organizations-table.d.ts +3 -0
  53. package/alterations-js/1.13.0-1705288654-add-application-user-consent-organizations-table.js +52 -0
  54. package/alterations-js/1.13.0-1705991158-update-invitation-indices.d.ts +7 -0
  55. package/alterations-js/1.13.0-1705991158-update-invitation-indices.js +27 -0
  56. package/alterations-js/1.13.0-1706449174-update-organization-invitation-column.d.ts +3 -0
  57. package/alterations-js/1.13.0-1706449174-update-organization-invitation-column.js +20 -0
  58. package/alterations-js/1.13.0-1706510290-protected-app-host-index.d.ts +3 -0
  59. package/alterations-js/1.13.0-1706510290-protected-app-host-index.js +17 -0
  60. package/alterations-js/1.13.0-1706512952-restore-get-started-page.d.ts +3 -0
  61. package/alterations-js/1.13.0-1706512952-restore-get-started-page.js +13 -0
  62. package/alterations-js/1.13.0-1706528755-remove-magic-links.d.ts +3 -0
  63. package/alterations-js/1.13.0-1706528755-remove-magic-links.js +41 -0
  64. package/alterations-js/1.13.0-1706585206-protected-app-custom-domain-unique.d.ts +3 -0
  65. package/alterations-js/1.13.0-1706585206-protected-app-custom-domain-unique.js +17 -0
  66. package/alterations-js/utils/1704934999-tables.d.ts +11 -0
  67. package/alterations-js/utils/1704934999-tables.js +43 -0
  68. package/lib/consts/index.d.ts +1 -0
  69. package/lib/consts/index.js +1 -0
  70. package/lib/consts/subscriptions.d.ts +6 -0
  71. package/lib/consts/subscriptions.js +7 -0
  72. package/lib/db-entries/application-sign-in-experience.d.ts +26 -0
  73. package/lib/db-entries/application-sign-in-experience.js +42 -0
  74. package/lib/db-entries/application-user-consent-organization-scope.d.ts +24 -0
  75. package/lib/db-entries/application-user-consent-organization-scope.js +29 -0
  76. package/lib/db-entries/application-user-consent-organization.d.ts +22 -0
  77. package/lib/db-entries/application-user-consent-organization.js +33 -0
  78. package/lib/db-entries/application-user-consent-resource-scope.d.ts +24 -0
  79. package/lib/db-entries/application-user-consent-resource-scope.js +29 -0
  80. package/lib/db-entries/application-user-consent-user-scope.d.ts +24 -0
  81. package/lib/db-entries/application-user-consent-user-scope.js +29 -0
  82. package/lib/db-entries/application.d.ts +6 -2
  83. package/lib/db-entries/application.js +9 -1
  84. package/lib/db-entries/custom-types.d.ts +8 -1
  85. package/lib/db-entries/custom-types.js +8 -0
  86. package/lib/db-entries/daily-token-usage.d.ts +20 -0
  87. package/lib/db-entries/daily-token-usage.js +33 -0
  88. package/lib/db-entries/index.d.ts +8 -0
  89. package/lib/db-entries/index.js +8 -0
  90. package/lib/db-entries/organization-invitation-role-relation.d.ts +24 -0
  91. package/lib/db-entries/organization-invitation-role-relation.js +29 -0
  92. package/lib/db-entries/organization-invitation.d.ts +53 -0
  93. package/lib/db-entries/organization-invitation.js +58 -0
  94. package/lib/db-entries/sign-in-experience.d.ts +3 -1
  95. package/lib/db-entries/sign-in-experience.js +4 -0
  96. package/lib/db-entries/sso-connector.d.ts +2 -2
  97. package/lib/foundations/jsonb-types/applications.d.ts +380 -0
  98. package/lib/foundations/jsonb-types/applications.js +29 -0
  99. package/lib/foundations/jsonb-types/custom-domain.d.ts +37 -89
  100. package/lib/foundations/jsonb-types/custom-domain.js +4 -9
  101. package/lib/foundations/jsonb-types/index.d.ts +1 -0
  102. package/lib/foundations/jsonb-types/index.js +1 -0
  103. package/lib/foundations/jsonb-types/sso-connector.d.ts +3 -0
  104. package/lib/foundations/jsonb-types/sso-connector.js +1 -0
  105. package/lib/models/tenants.d.ts +1 -1
  106. package/lib/seeds/application.d.ts +1 -1
  107. package/lib/seeds/application.js +3 -1
  108. package/lib/seeds/cloud-api.d.ts +0 -2
  109. package/lib/seeds/cloud-api.js +0 -3
  110. package/lib/seeds/management-api.d.ts +77 -6
  111. package/lib/seeds/management-api.js +14 -10
  112. package/lib/types/application.d.ts +576 -1
  113. package/lib/types/application.js +42 -1
  114. package/lib/types/connector.js +1 -1
  115. package/lib/types/consent.d.ts +568 -0
  116. package/lib/types/consent.js +47 -0
  117. package/lib/types/domain.d.ts +21 -65
  118. package/lib/types/hook.d.ts +1 -0
  119. package/lib/types/index.d.ts +3 -0
  120. package/lib/types/index.js +3 -0
  121. package/lib/types/interactions.d.ts +6 -6
  122. package/lib/types/logto-config.d.ts +32 -6
  123. package/lib/types/logto-config.js +12 -2
  124. package/lib/types/mapi-proxy.d.ts +30 -0
  125. package/lib/types/mapi-proxy.js +49 -0
  126. package/lib/types/organization.d.ts +10 -1
  127. package/lib/types/organization.js +4 -1
  128. package/lib/types/sso-connector.d.ts +63 -66
  129. package/lib/types/sso-connector.js +41 -7
  130. package/lib/types/system.d.ts +28 -1
  131. package/lib/types/system.js +17 -0
  132. package/lib/types/tenant-organization.d.ts +107 -0
  133. package/lib/types/tenant-organization.js +145 -0
  134. package/lib/types/tenant.d.ts +0 -1
  135. package/lib/types/tenant.js +2 -1
  136. package/lib/types/user-assets.d.ts +5 -5
  137. package/lib/types/user-assets.js +1 -0
  138. package/lib/types/user.d.ts +17 -15
  139. package/lib/types/user.js +2 -2
  140. package/lib/utils/domain.d.ts +10 -0
  141. package/lib/utils/domain.js +28 -0
  142. package/lib/utils/domain.test.d.ts +1 -0
  143. package/lib/utils/domain.test.js +34 -0
  144. package/lib/utils/index.d.ts +1 -0
  145. package/lib/utils/index.js +1 -0
  146. package/package.json +15 -15
  147. package/tables/application_sign_in_experiences.sql +15 -0
  148. package/tables/application_user_consent_organization_scopes.sql +14 -0
  149. package/tables/application_user_consent_organizations.sql +16 -0
  150. package/tables/application_user_consent_resource_scopes.sql +14 -0
  151. package/tables/application_user_consent_user_scopes.sql +13 -0
  152. package/tables/applications.sql +16 -1
  153. package/tables/daily_token_usage.sql +11 -0
  154. package/tables/organization_invitation_role_relations.sql +14 -0
  155. package/tables/organization_invitations.sql +36 -0
  156. package/tables/organization_role_user_relations.sql +8 -6
  157. package/tables/sign_in_experiences.sql +1 -0
  158. package/tables/sso_connectors.sql +4 -2
@@ -0,0 +1,568 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Define the public user info that can be exposed to the public. e.g. on the user consent page.
4
+ */
5
+ export declare const publicUserInfoGuard: z.ZodObject<Pick<{
6
+ tenantId: z.ZodType<string, z.ZodTypeDef, string>;
7
+ id: z.ZodType<string, z.ZodTypeDef, string>;
8
+ username: z.ZodType<string | null, z.ZodTypeDef, string | null>;
9
+ primaryEmail: z.ZodType<string | null, z.ZodTypeDef, string | null>;
10
+ primaryPhone: z.ZodType<string | null, z.ZodTypeDef, string | null>;
11
+ passwordEncrypted: z.ZodType<string | null, z.ZodTypeDef, string | null>;
12
+ passwordEncryptionMethod: z.ZodType<import("../db-entries/custom-types.js").UsersPasswordEncryptionMethod | null, z.ZodTypeDef, import("../db-entries/custom-types.js").UsersPasswordEncryptionMethod | null>;
13
+ name: z.ZodType<string | null, z.ZodTypeDef, string | null>;
14
+ avatar: z.ZodType<string | null, z.ZodTypeDef, string | null>;
15
+ applicationId: z.ZodType<string | null, z.ZodTypeDef, string | null>;
16
+ identities: z.ZodType<Record<string, {
17
+ userId: string;
18
+ details?: Record<string, unknown> | undefined;
19
+ }>, z.ZodTypeDef, Record<string, {
20
+ userId: string;
21
+ details?: Record<string, unknown> | undefined;
22
+ }>>;
23
+ customData: z.ZodType<import("@withtyped/server").JsonObject, z.ZodTypeDef, import("@withtyped/server").JsonObject>;
24
+ logtoConfig: z.ZodType<import("@withtyped/server").JsonObject, z.ZodTypeDef, import("@withtyped/server").JsonObject>;
25
+ mfaVerifications: z.ZodType<({
26
+ type: import("../index.js").MfaFactor.TOTP;
27
+ id: string;
28
+ key: string;
29
+ createdAt: string;
30
+ lastUsedAt?: string | undefined;
31
+ } | {
32
+ type: import("../index.js").MfaFactor.WebAuthn;
33
+ id: string;
34
+ createdAt: string;
35
+ credentialId: string;
36
+ publicKey: string;
37
+ counter: number;
38
+ agent: string;
39
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
40
+ lastUsedAt?: string | undefined;
41
+ } | {
42
+ type: import("../index.js").MfaFactor.BackupCode;
43
+ id: string;
44
+ createdAt: string;
45
+ codes: {
46
+ code: string;
47
+ usedAt?: string | undefined;
48
+ }[];
49
+ lastUsedAt?: string | undefined;
50
+ })[], z.ZodTypeDef, ({
51
+ type: import("../index.js").MfaFactor.TOTP;
52
+ id: string;
53
+ key: string;
54
+ createdAt: string;
55
+ lastUsedAt?: string | undefined;
56
+ } | {
57
+ type: import("../index.js").MfaFactor.WebAuthn;
58
+ id: string;
59
+ createdAt: string;
60
+ credentialId: string;
61
+ publicKey: string;
62
+ counter: number;
63
+ agent: string;
64
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
65
+ lastUsedAt?: string | undefined;
66
+ } | {
67
+ type: import("../index.js").MfaFactor.BackupCode;
68
+ id: string;
69
+ createdAt: string;
70
+ codes: {
71
+ code: string;
72
+ usedAt?: string | undefined;
73
+ }[];
74
+ lastUsedAt?: string | undefined;
75
+ })[]>;
76
+ isSuspended: z.ZodType<boolean, z.ZodTypeDef, boolean>;
77
+ lastSignInAt: z.ZodType<number | null, z.ZodTypeDef, number | null>;
78
+ createdAt: z.ZodType<number, z.ZodTypeDef, number>;
79
+ }, "name" | "id" | "username" | "primaryEmail" | "primaryPhone" | "avatar">, "strip", z.ZodTypeAny, {
80
+ name: string | null;
81
+ id: string;
82
+ username: string | null;
83
+ primaryEmail: string | null;
84
+ primaryPhone: string | null;
85
+ avatar: string | null;
86
+ }, {
87
+ name: string | null;
88
+ id: string;
89
+ username: string | null;
90
+ primaryEmail: string | null;
91
+ primaryPhone: string | null;
92
+ avatar: string | null;
93
+ }>;
94
+ export type PublicUserInfo = z.infer<typeof publicUserInfoGuard>;
95
+ /**
96
+ * Define the public application info that can be exposed to the public. e.g. on the user consent page.
97
+ */
98
+ export declare const publicApplicationGuard: z.ZodObject<Pick<{
99
+ tenantId: z.ZodType<string, z.ZodTypeDef, string>;
100
+ id: z.ZodType<string, z.ZodTypeDef, string>;
101
+ name: z.ZodType<string, z.ZodTypeDef, string>;
102
+ secret: z.ZodType<string, z.ZodTypeDef, string>;
103
+ description: z.ZodType<string | null, z.ZodTypeDef, string | null>;
104
+ type: z.ZodType<import("../db-entries/custom-types.js").ApplicationType, z.ZodTypeDef, import("../db-entries/custom-types.js").ApplicationType>;
105
+ oidcClientMetadata: z.ZodType<{
106
+ redirectUris: string[];
107
+ postLogoutRedirectUris: string[];
108
+ logoUri?: string | undefined;
109
+ }, z.ZodTypeDef, {
110
+ redirectUris: string[];
111
+ postLogoutRedirectUris: string[];
112
+ logoUri?: string | undefined;
113
+ }>;
114
+ customClientMetadata: z.ZodType<{
115
+ corsAllowedOrigins?: string[] | undefined;
116
+ idTokenTtl?: number | undefined;
117
+ refreshTokenTtl?: number | undefined;
118
+ refreshTokenTtlInDays?: number | undefined;
119
+ tenantId?: string | undefined;
120
+ alwaysIssueRefreshToken?: boolean | undefined;
121
+ rotateRefreshToken?: boolean | undefined;
122
+ }, z.ZodTypeDef, {
123
+ corsAllowedOrigins?: string[] | undefined;
124
+ idTokenTtl?: number | undefined;
125
+ refreshTokenTtl?: number | undefined;
126
+ refreshTokenTtlInDays?: number | undefined;
127
+ tenantId?: string | undefined;
128
+ alwaysIssueRefreshToken?: boolean | undefined;
129
+ rotateRefreshToken?: boolean | undefined;
130
+ }>;
131
+ protectedAppMetadata: z.ZodType<{
132
+ host: string;
133
+ origin: string;
134
+ sessionDuration: number;
135
+ pageRules: {
136
+ path: string;
137
+ }[];
138
+ customDomains?: {
139
+ status: import("../index.js").DomainStatus;
140
+ domain: string;
141
+ errorMessage: string | null;
142
+ dnsRecords: {
143
+ type: string;
144
+ value: string;
145
+ name: string;
146
+ }[];
147
+ cloudflareData: {
148
+ status: string;
149
+ id: string;
150
+ ssl: {
151
+ status: string;
152
+ validation_errors?: {
153
+ message: string;
154
+ }[] | undefined;
155
+ };
156
+ verification_errors?: string[] | undefined;
157
+ } | null;
158
+ }[] | undefined;
159
+ } | null, z.ZodTypeDef, {
160
+ host: string;
161
+ origin: string;
162
+ sessionDuration: number;
163
+ pageRules: {
164
+ path: string;
165
+ }[];
166
+ customDomains?: {
167
+ status: import("../index.js").DomainStatus;
168
+ domain: string;
169
+ errorMessage: string | null;
170
+ dnsRecords: {
171
+ type: string;
172
+ value: string;
173
+ name: string;
174
+ }[];
175
+ cloudflareData: {
176
+ status: string;
177
+ id: string;
178
+ ssl: {
179
+ status: string;
180
+ validation_errors?: {
181
+ message: string;
182
+ }[] | undefined;
183
+ };
184
+ verification_errors?: string[] | undefined;
185
+ } | null;
186
+ }[] | undefined;
187
+ } | null>;
188
+ isThirdParty: z.ZodType<boolean, z.ZodTypeDef, boolean>;
189
+ createdAt: z.ZodType<number, z.ZodTypeDef, number>;
190
+ }, "name" | "id">, "strip", z.ZodTypeAny, {
191
+ name: string;
192
+ id: string;
193
+ }, {
194
+ name: string;
195
+ id: string;
196
+ }>;
197
+ export type PublicApplication = z.infer<typeof publicApplicationGuard>;
198
+ export declare const applicationSignInExperienceGuard: z.ZodObject<Pick<{
199
+ tenantId: z.ZodType<string, z.ZodTypeDef, string>;
200
+ applicationId: z.ZodType<string, z.ZodTypeDef, string>;
201
+ branding: z.ZodType<{
202
+ logoUrl?: string | undefined;
203
+ darkLogoUrl?: string | undefined;
204
+ favicon?: string | undefined;
205
+ }, z.ZodTypeDef, {
206
+ logoUrl?: string | undefined;
207
+ darkLogoUrl?: string | undefined;
208
+ favicon?: string | undefined;
209
+ }>;
210
+ termsOfUseUrl: z.ZodType<string | null, z.ZodTypeDef, string | null>;
211
+ privacyPolicyUrl: z.ZodType<string | null, z.ZodTypeDef, string | null>;
212
+ displayName: z.ZodType<string | null, z.ZodTypeDef, string | null>;
213
+ }, "displayName" | "branding" | "termsOfUseUrl" | "privacyPolicyUrl">, "strip", z.ZodTypeAny, {
214
+ displayName: string | null;
215
+ branding: {
216
+ logoUrl?: string | undefined;
217
+ darkLogoUrl?: string | undefined;
218
+ favicon?: string | undefined;
219
+ };
220
+ termsOfUseUrl: string | null;
221
+ privacyPolicyUrl: string | null;
222
+ }, {
223
+ displayName: string | null;
224
+ branding: {
225
+ logoUrl?: string | undefined;
226
+ darkLogoUrl?: string | undefined;
227
+ favicon?: string | undefined;
228
+ };
229
+ termsOfUseUrl: string | null;
230
+ privacyPolicyUrl: string | null;
231
+ }>;
232
+ /**
233
+ * Define the public organization info that can be exposed to the public. e.g. on the user consent page.
234
+ */
235
+ export declare const publicOrganizationGuard: z.ZodObject<Pick<{
236
+ tenantId: z.ZodType<string, z.ZodTypeDef, string>;
237
+ id: z.ZodType<string, z.ZodTypeDef, string>;
238
+ name: z.ZodType<string, z.ZodTypeDef, string>;
239
+ description: z.ZodType<string | null, z.ZodTypeDef, string | null>;
240
+ createdAt: z.ZodType<number, z.ZodTypeDef, number>;
241
+ }, "name" | "id">, "strip", z.ZodTypeAny, {
242
+ name: string;
243
+ id: string;
244
+ }, {
245
+ name: string;
246
+ id: string;
247
+ }>;
248
+ export declare const missingResourceScopesGuard: z.ZodObject<{
249
+ resource: z.ZodObject<{
250
+ name: z.ZodType<string, z.ZodTypeDef, string>;
251
+ id: z.ZodString;
252
+ }, "strip", z.ZodTypeAny, {
253
+ name: string;
254
+ id: string;
255
+ }, {
256
+ name: string;
257
+ id: string;
258
+ }>;
259
+ scopes: z.ZodArray<z.ZodObject<Pick<{
260
+ tenantId: z.ZodType<string, z.ZodTypeDef, string>;
261
+ id: z.ZodType<string, z.ZodTypeDef, string>;
262
+ resourceId: z.ZodType<string, z.ZodTypeDef, string>;
263
+ name: z.ZodType<string, z.ZodTypeDef, string>;
264
+ description: z.ZodType<string, z.ZodTypeDef, string>;
265
+ createdAt: z.ZodType<number, z.ZodTypeDef, number>;
266
+ }, "name" | "id" | "description">, "strip", z.ZodTypeAny, {
267
+ name: string;
268
+ id: string;
269
+ description: string;
270
+ }, {
271
+ name: string;
272
+ id: string;
273
+ description: string;
274
+ }>, "many">;
275
+ }, "strip", z.ZodTypeAny, {
276
+ resource: {
277
+ name: string;
278
+ id: string;
279
+ };
280
+ scopes: {
281
+ name: string;
282
+ id: string;
283
+ description: string;
284
+ }[];
285
+ }, {
286
+ resource: {
287
+ name: string;
288
+ id: string;
289
+ };
290
+ scopes: {
291
+ name: string;
292
+ id: string;
293
+ description: string;
294
+ }[];
295
+ }>;
296
+ /**
297
+ * Define the missing resource scopes for the consent page.
298
+ */
299
+ export type MissingResourceScopes = z.infer<typeof missingResourceScopesGuard>;
300
+ export declare const consentInfoResponseGuard: z.ZodObject<{
301
+ application: z.ZodObject<{
302
+ name: z.ZodType<string, z.ZodTypeDef, string>;
303
+ id: z.ZodType<string, z.ZodTypeDef, string>;
304
+ displayName: z.ZodOptional<z.ZodType<string | null, z.ZodTypeDef, string | null>>;
305
+ branding: z.ZodOptional<z.ZodType<{
306
+ logoUrl?: string | undefined;
307
+ darkLogoUrl?: string | undefined;
308
+ favicon?: string | undefined;
309
+ }, z.ZodTypeDef, {
310
+ logoUrl?: string | undefined;
311
+ darkLogoUrl?: string | undefined;
312
+ favicon?: string | undefined;
313
+ }>>;
314
+ termsOfUseUrl: z.ZodOptional<z.ZodType<string | null, z.ZodTypeDef, string | null>>;
315
+ privacyPolicyUrl: z.ZodOptional<z.ZodType<string | null, z.ZodTypeDef, string | null>>;
316
+ }, "strip", z.ZodTypeAny, {
317
+ name: string;
318
+ id: string;
319
+ displayName?: string | null | undefined;
320
+ branding?: {
321
+ logoUrl?: string | undefined;
322
+ darkLogoUrl?: string | undefined;
323
+ favicon?: string | undefined;
324
+ } | undefined;
325
+ termsOfUseUrl?: string | null | undefined;
326
+ privacyPolicyUrl?: string | null | undefined;
327
+ }, {
328
+ name: string;
329
+ id: string;
330
+ displayName?: string | null | undefined;
331
+ branding?: {
332
+ logoUrl?: string | undefined;
333
+ darkLogoUrl?: string | undefined;
334
+ favicon?: string | undefined;
335
+ } | undefined;
336
+ termsOfUseUrl?: string | null | undefined;
337
+ privacyPolicyUrl?: string | null | undefined;
338
+ }>;
339
+ user: z.ZodObject<Pick<{
340
+ tenantId: z.ZodType<string, z.ZodTypeDef, string>;
341
+ id: z.ZodType<string, z.ZodTypeDef, string>;
342
+ username: z.ZodType<string | null, z.ZodTypeDef, string | null>;
343
+ primaryEmail: z.ZodType<string | null, z.ZodTypeDef, string | null>;
344
+ primaryPhone: z.ZodType<string | null, z.ZodTypeDef, string | null>;
345
+ passwordEncrypted: z.ZodType<string | null, z.ZodTypeDef, string | null>;
346
+ passwordEncryptionMethod: z.ZodType<import("../db-entries/custom-types.js").UsersPasswordEncryptionMethod | null, z.ZodTypeDef, import("../db-entries/custom-types.js").UsersPasswordEncryptionMethod | null>;
347
+ name: z.ZodType<string | null, z.ZodTypeDef, string | null>;
348
+ avatar: z.ZodType<string | null, z.ZodTypeDef, string | null>;
349
+ applicationId: z.ZodType<string | null, z.ZodTypeDef, string | null>;
350
+ identities: z.ZodType<Record<string, {
351
+ userId: string;
352
+ details?: Record<string, unknown> | undefined;
353
+ }>, z.ZodTypeDef, Record<string, {
354
+ userId: string;
355
+ details?: Record<string, unknown> | undefined;
356
+ }>>;
357
+ customData: z.ZodType<import("@withtyped/server").JsonObject, z.ZodTypeDef, import("@withtyped/server").JsonObject>;
358
+ logtoConfig: z.ZodType<import("@withtyped/server").JsonObject, z.ZodTypeDef, import("@withtyped/server").JsonObject>;
359
+ mfaVerifications: z.ZodType<({
360
+ type: import("../index.js").MfaFactor.TOTP;
361
+ id: string;
362
+ key: string;
363
+ createdAt: string;
364
+ lastUsedAt?: string | undefined;
365
+ } | {
366
+ type: import("../index.js").MfaFactor.WebAuthn;
367
+ id: string;
368
+ createdAt: string;
369
+ credentialId: string;
370
+ publicKey: string;
371
+ counter: number;
372
+ agent: string;
373
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
374
+ lastUsedAt?: string | undefined;
375
+ } | {
376
+ type: import("../index.js").MfaFactor.BackupCode;
377
+ id: string;
378
+ createdAt: string;
379
+ codes: {
380
+ code: string;
381
+ usedAt?: string | undefined;
382
+ }[];
383
+ lastUsedAt?: string | undefined;
384
+ })[], z.ZodTypeDef, ({
385
+ type: import("../index.js").MfaFactor.TOTP;
386
+ id: string;
387
+ key: string;
388
+ createdAt: string;
389
+ lastUsedAt?: string | undefined;
390
+ } | {
391
+ type: import("../index.js").MfaFactor.WebAuthn;
392
+ id: string;
393
+ createdAt: string;
394
+ credentialId: string;
395
+ publicKey: string;
396
+ counter: number;
397
+ agent: string;
398
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
399
+ lastUsedAt?: string | undefined;
400
+ } | {
401
+ type: import("../index.js").MfaFactor.BackupCode;
402
+ id: string;
403
+ createdAt: string;
404
+ codes: {
405
+ code: string;
406
+ usedAt?: string | undefined;
407
+ }[];
408
+ lastUsedAt?: string | undefined;
409
+ })[]>;
410
+ isSuspended: z.ZodType<boolean, z.ZodTypeDef, boolean>;
411
+ lastSignInAt: z.ZodType<number | null, z.ZodTypeDef, number | null>;
412
+ createdAt: z.ZodType<number, z.ZodTypeDef, number>;
413
+ }, "name" | "id" | "username" | "primaryEmail" | "primaryPhone" | "avatar">, "strip", z.ZodTypeAny, {
414
+ name: string | null;
415
+ id: string;
416
+ username: string | null;
417
+ primaryEmail: string | null;
418
+ primaryPhone: string | null;
419
+ avatar: string | null;
420
+ }, {
421
+ name: string | null;
422
+ id: string;
423
+ username: string | null;
424
+ primaryEmail: string | null;
425
+ primaryPhone: string | null;
426
+ avatar: string | null;
427
+ }>;
428
+ organizations: z.ZodOptional<z.ZodArray<z.ZodObject<Pick<{
429
+ tenantId: z.ZodType<string, z.ZodTypeDef, string>;
430
+ id: z.ZodType<string, z.ZodTypeDef, string>;
431
+ name: z.ZodType<string, z.ZodTypeDef, string>;
432
+ description: z.ZodType<string | null, z.ZodTypeDef, string | null>;
433
+ createdAt: z.ZodType<number, z.ZodTypeDef, number>;
434
+ }, "name" | "id">, "strip", z.ZodTypeAny, {
435
+ name: string;
436
+ id: string;
437
+ }, {
438
+ name: string;
439
+ id: string;
440
+ }>, "many">>;
441
+ missingOIDCScope: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
442
+ missingResourceScopes: z.ZodOptional<z.ZodArray<z.ZodObject<{
443
+ resource: z.ZodObject<{
444
+ name: z.ZodType<string, z.ZodTypeDef, string>;
445
+ id: z.ZodString;
446
+ }, "strip", z.ZodTypeAny, {
447
+ name: string;
448
+ id: string;
449
+ }, {
450
+ name: string;
451
+ id: string;
452
+ }>;
453
+ scopes: z.ZodArray<z.ZodObject<Pick<{
454
+ tenantId: z.ZodType<string, z.ZodTypeDef, string>;
455
+ id: z.ZodType<string, z.ZodTypeDef, string>;
456
+ resourceId: z.ZodType<string, z.ZodTypeDef, string>;
457
+ name: z.ZodType<string, z.ZodTypeDef, string>;
458
+ description: z.ZodType<string, z.ZodTypeDef, string>;
459
+ createdAt: z.ZodType<number, z.ZodTypeDef, number>;
460
+ }, "name" | "id" | "description">, "strip", z.ZodTypeAny, {
461
+ name: string;
462
+ id: string;
463
+ description: string;
464
+ }, {
465
+ name: string;
466
+ id: string;
467
+ description: string;
468
+ }>, "many">;
469
+ }, "strip", z.ZodTypeAny, {
470
+ resource: {
471
+ name: string;
472
+ id: string;
473
+ };
474
+ scopes: {
475
+ name: string;
476
+ id: string;
477
+ description: string;
478
+ }[];
479
+ }, {
480
+ resource: {
481
+ name: string;
482
+ id: string;
483
+ };
484
+ scopes: {
485
+ name: string;
486
+ id: string;
487
+ description: string;
488
+ }[];
489
+ }>, "many">>;
490
+ redirectUri: z.ZodString;
491
+ }, "strip", z.ZodTypeAny, {
492
+ application: {
493
+ name: string;
494
+ id: string;
495
+ displayName?: string | null | undefined;
496
+ branding?: {
497
+ logoUrl?: string | undefined;
498
+ darkLogoUrl?: string | undefined;
499
+ favicon?: string | undefined;
500
+ } | undefined;
501
+ termsOfUseUrl?: string | null | undefined;
502
+ privacyPolicyUrl?: string | null | undefined;
503
+ };
504
+ user: {
505
+ name: string | null;
506
+ id: string;
507
+ username: string | null;
508
+ primaryEmail: string | null;
509
+ primaryPhone: string | null;
510
+ avatar: string | null;
511
+ };
512
+ redirectUri: string;
513
+ organizations?: {
514
+ name: string;
515
+ id: string;
516
+ }[] | undefined;
517
+ missingOIDCScope?: string[] | undefined;
518
+ missingResourceScopes?: {
519
+ resource: {
520
+ name: string;
521
+ id: string;
522
+ };
523
+ scopes: {
524
+ name: string;
525
+ id: string;
526
+ description: string;
527
+ }[];
528
+ }[] | undefined;
529
+ }, {
530
+ application: {
531
+ name: string;
532
+ id: string;
533
+ displayName?: string | null | undefined;
534
+ branding?: {
535
+ logoUrl?: string | undefined;
536
+ darkLogoUrl?: string | undefined;
537
+ favicon?: string | undefined;
538
+ } | undefined;
539
+ termsOfUseUrl?: string | null | undefined;
540
+ privacyPolicyUrl?: string | null | undefined;
541
+ };
542
+ user: {
543
+ name: string | null;
544
+ id: string;
545
+ username: string | null;
546
+ primaryEmail: string | null;
547
+ primaryPhone: string | null;
548
+ avatar: string | null;
549
+ };
550
+ redirectUri: string;
551
+ organizations?: {
552
+ name: string;
553
+ id: string;
554
+ }[] | undefined;
555
+ missingOIDCScope?: string[] | undefined;
556
+ missingResourceScopes?: {
557
+ resource: {
558
+ name: string;
559
+ id: string;
560
+ };
561
+ scopes: {
562
+ name: string;
563
+ id: string;
564
+ description: string;
565
+ }[];
566
+ }[] | undefined;
567
+ }>;
568
+ export type ConsentInfoResponse = z.infer<typeof consentInfoResponseGuard>;
@@ -0,0 +1,47 @@
1
+ import { z } from 'zod';
2
+ import { Applications, Users, Organizations, Resources, Scopes, ApplicationSignInExperiences, } from '../db-entries/index.js';
3
+ /**
4
+ * Define the public user info that can be exposed to the public. e.g. on the user consent page.
5
+ */
6
+ export const publicUserInfoGuard = Users.guard.pick({
7
+ id: true,
8
+ name: true,
9
+ avatar: true,
10
+ username: true,
11
+ primaryEmail: true,
12
+ primaryPhone: true,
13
+ });
14
+ /**
15
+ * Define the public application info that can be exposed to the public. e.g. on the user consent page.
16
+ */
17
+ export const publicApplicationGuard = Applications.guard.pick({
18
+ id: true,
19
+ name: true,
20
+ });
21
+ export const applicationSignInExperienceGuard = ApplicationSignInExperiences.guard.pick({
22
+ branding: true,
23
+ displayName: true,
24
+ privacyPolicyUrl: true,
25
+ termsOfUseUrl: true,
26
+ });
27
+ /**
28
+ * Define the public organization info that can be exposed to the public. e.g. on the user consent page.
29
+ */
30
+ export const publicOrganizationGuard = Organizations.guard.pick({
31
+ id: true,
32
+ name: true,
33
+ });
34
+ export const missingResourceScopesGuard = z.object({
35
+ // The original resource id has a maximum length of 21 restriction. We need to make it compatible with the logto reserved organization name.
36
+ // use string here, as we do not care about the resource id length here.
37
+ resource: Resources.guard.pick({ name: true }).extend({ id: z.string() }),
38
+ scopes: Scopes.guard.pick({ id: true, name: true, description: true }).array(),
39
+ });
40
+ export const consentInfoResponseGuard = z.object({
41
+ application: publicApplicationGuard.merge(applicationSignInExperienceGuard.partial()),
42
+ user: publicUserInfoGuard,
43
+ organizations: publicOrganizationGuard.array().optional(),
44
+ missingOIDCScope: z.string().array().optional(),
45
+ missingResourceScopes: missingResourceScopesGuard.array().optional(),
46
+ redirectUri: z.string(),
47
+ });