@logto/schemas 1.31.0 → 1.33.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 (49) hide show
  1. package/alterations/1.32.0-1756370721-align-app-and-org-sign-in-exp-configs.ts +28 -0
  2. package/alterations/1.32.0-1756954492-add-default-to-forgot-password-methods.ts +35 -0
  3. package/alterations/1.32.0-1759041888-add-tenant-date-index-to-daily-active-users-table.ts +18 -0
  4. package/alterations/1.33.0-1760427166-add-applications-type-index.ts +19 -0
  5. package/alterations/1.33.0-1760427167-add-roles-type-index.ts +19 -0
  6. package/alterations/1.33.0-1761283464-add-hide-logto-branding-column.ts +20 -0
  7. package/alterations-js/1.32.0-1756370721-align-app-and-org-sign-in-exp-configs.js +24 -0
  8. package/alterations-js/1.32.0-1756954492-add-default-to-forgot-password-methods.js +29 -0
  9. package/alterations-js/1.32.0-1759041888-add-tenant-date-index-to-daily-active-users-table.js +15 -0
  10. package/alterations-js/1.33.0-1760427166-add-applications-type-index.js +15 -0
  11. package/alterations-js/1.33.0-1760427167-add-roles-type-index.js +15 -0
  12. package/alterations-js/1.33.0-1761283464-add-hide-logto-branding-column.js +16 -0
  13. package/lib/consts/index.d.ts +1 -0
  14. package/lib/consts/index.js +1 -0
  15. package/lib/consts/oidc.d.ts +11 -0
  16. package/lib/consts/oidc.js +8 -0
  17. package/lib/consts/product-event.d.ts +99 -0
  18. package/lib/consts/product-event.js +102 -0
  19. package/lib/db-entries/application-sign-in-experience.d.ts +3 -1
  20. package/lib/db-entries/application-sign-in-experience.js +4 -0
  21. package/lib/db-entries/organization.d.ts +10 -2
  22. package/lib/db-entries/organization.js +9 -1
  23. package/lib/db-entries/sign-in-experience.d.ts +3 -1
  24. package/lib/db-entries/sign-in-experience.js +4 -0
  25. package/lib/foundations/jsonb-types/users.d.ts +9 -0
  26. package/lib/foundations/jsonb-types/users.js +1 -0
  27. package/lib/seeds/sign-in-experience.js +1 -0
  28. package/lib/types/application.d.ts +3 -0
  29. package/lib/types/consent.d.ts +25 -0
  30. package/lib/types/cookie.d.ts +4 -0
  31. package/lib/types/cookie.js +1 -1
  32. package/lib/types/custom-profile-fields.d.ts +2 -0
  33. package/lib/types/interactions.d.ts +6 -0
  34. package/lib/types/interactions.js +1 -0
  35. package/lib/types/logto-config/index.d.ts +64 -40
  36. package/lib/types/logto-config/jwt-customizer.d.ts +134 -70
  37. package/lib/types/mfa.d.ts +2 -2
  38. package/lib/types/sign-in-experience.d.ts +5 -2
  39. package/lib/types/ssr.d.ts +1 -0
  40. package/lib/types/user.d.ts +6 -0
  41. package/lib/types/verification-records/web-authn-verification.d.ts +16 -2
  42. package/lib/types/verification-records/web-authn-verification.js +2 -0
  43. package/package.json +5 -5
  44. package/tables/application_sign_in_experiences.sql +1 -0
  45. package/tables/applications.sql +3 -0
  46. package/tables/daily_active_users.sql +3 -0
  47. package/tables/organizations.sql +4 -0
  48. package/tables/roles.sql +3 -0
  49. package/tables/sign_in_experiences.sql +2 -1
@@ -79,6 +79,7 @@ export declare const userInfoGuard: z.ZodObject<Pick<{
79
79
  agent: string;
80
80
  name?: string | undefined;
81
81
  lastUsedAt?: string | undefined;
82
+ rpId?: string | undefined;
82
83
  transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
83
84
  } | {
84
85
  type: MfaFactor.BackupCode;
@@ -105,6 +106,7 @@ export declare const userInfoGuard: z.ZodObject<Pick<{
105
106
  agent: string;
106
107
  name?: string | undefined;
107
108
  lastUsedAt?: string | undefined;
109
+ rpId?: string | undefined;
108
110
  transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
109
111
  } | {
110
112
  type: MfaFactor.BackupCode;
@@ -229,6 +231,7 @@ export declare const userProfileResponseGuard: z.ZodObject<Pick<{
229
231
  agent: string;
230
232
  name?: string | undefined;
231
233
  lastUsedAt?: string | undefined;
234
+ rpId?: string | undefined;
232
235
  transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
233
236
  } | {
234
237
  type: MfaFactor.BackupCode;
@@ -255,6 +258,7 @@ export declare const userProfileResponseGuard: z.ZodObject<Pick<{
255
258
  agent: string;
256
259
  name?: string | undefined;
257
260
  lastUsedAt?: string | undefined;
261
+ rpId?: string | undefined;
258
262
  transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
259
263
  } | {
260
264
  type: MfaFactor.BackupCode;
@@ -437,6 +441,7 @@ export declare const featuredUserGuard: z.ZodObject<Pick<{
437
441
  agent: string;
438
442
  name?: string | undefined;
439
443
  lastUsedAt?: string | undefined;
444
+ rpId?: string | undefined;
440
445
  transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
441
446
  } | {
442
447
  type: MfaFactor.BackupCode;
@@ -463,6 +468,7 @@ export declare const featuredUserGuard: z.ZodObject<Pick<{
463
468
  agent: string;
464
469
  name?: string | undefined;
465
470
  lastUsedAt?: string | undefined;
471
+ rpId?: string | undefined;
466
472
  transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
467
473
  } | {
468
474
  type: MfaFactor.BackupCode;
@@ -9,6 +9,8 @@ export type WebAuthnVerificationRecordData = {
9
9
  verified: boolean;
10
10
  /** The challenge generated for the WebAuthn registration */
11
11
  registrationChallenge?: string;
12
+ /** The rpId used when generating the registration options */
13
+ registrationRpId?: string;
12
14
  /** The challenge generated for the WebAuthn authentication */
13
15
  authenticationChallenge?: string;
14
16
  registrationInfo?: BindWebAuthn;
@@ -19,9 +21,11 @@ export declare const webAuthnVerificationRecordDataGuard: z.ZodObject<{
19
21
  userId: z.ZodString;
20
22
  verified: z.ZodBoolean;
21
23
  registrationChallenge: z.ZodOptional<z.ZodString>;
24
+ registrationRpId: z.ZodOptional<z.ZodString>;
22
25
  authenticationChallenge: z.ZodOptional<z.ZodString>;
23
26
  registrationInfo: z.ZodOptional<z.ZodObject<{
24
27
  type: z.ZodLiteral<import("../../index.js").MfaFactor.WebAuthn>;
28
+ rpId: z.ZodString;
25
29
  credentialId: z.ZodString;
26
30
  publicKey: z.ZodString;
27
31
  transports: z.ZodArray<z.ZodEnum<["usb", "nfc", "ble", "internal", "cable", "hybrid", "smart-card"]>, "many">;
@@ -30,6 +34,7 @@ export declare const webAuthnVerificationRecordDataGuard: z.ZodObject<{
30
34
  name: z.ZodOptional<z.ZodString>;
31
35
  }, "strip", z.ZodTypeAny, {
32
36
  type: import("../../index.js").MfaFactor.WebAuthn;
37
+ rpId: string;
33
38
  credentialId: string;
34
39
  publicKey: string;
35
40
  transports: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[];
@@ -38,6 +43,7 @@ export declare const webAuthnVerificationRecordDataGuard: z.ZodObject<{
38
43
  name?: string | undefined;
39
44
  }, {
40
45
  type: import("../../index.js").MfaFactor.WebAuthn;
46
+ rpId: string;
41
47
  credentialId: string;
42
48
  publicKey: string;
43
49
  transports: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[];
@@ -51,9 +57,11 @@ export declare const webAuthnVerificationRecordDataGuard: z.ZodObject<{
51
57
  userId: string;
52
58
  verified: boolean;
53
59
  registrationChallenge?: string | undefined;
60
+ registrationRpId?: string | undefined;
54
61
  authenticationChallenge?: string | undefined;
55
62
  registrationInfo?: {
56
63
  type: import("../../index.js").MfaFactor.WebAuthn;
64
+ rpId: string;
57
65
  credentialId: string;
58
66
  publicKey: string;
59
67
  transports: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[];
@@ -67,9 +75,11 @@ export declare const webAuthnVerificationRecordDataGuard: z.ZodObject<{
67
75
  userId: string;
68
76
  verified: boolean;
69
77
  registrationChallenge?: string | undefined;
78
+ registrationRpId?: string | undefined;
70
79
  authenticationChallenge?: string | undefined;
71
80
  registrationInfo?: {
72
81
  type: import("../../index.js").MfaFactor.WebAuthn;
82
+ rpId: string;
73
83
  credentialId: string;
74
84
  publicKey: string;
75
85
  transports: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[];
@@ -78,16 +88,18 @@ export declare const webAuthnVerificationRecordDataGuard: z.ZodObject<{
78
88
  name?: string | undefined;
79
89
  } | undefined;
80
90
  }>;
81
- export type SanitizedWebAuthnVerificationRecordData = Omit<WebAuthnVerificationRecordData, 'registrationInfo' | 'registrationChallenge' | 'authenticationChallenge'>;
91
+ export type SanitizedWebAuthnVerificationRecordData = Omit<WebAuthnVerificationRecordData, 'registrationInfo' | 'registrationChallenge' | 'registrationRpId' | 'authenticationChallenge'>;
82
92
  export declare const sanitizedWebAuthnVerificationRecordDataGuard: z.ZodObject<Omit<{
83
93
  id: z.ZodString;
84
94
  type: z.ZodLiteral<VerificationType.WebAuthn>;
85
95
  userId: z.ZodString;
86
96
  verified: z.ZodBoolean;
87
97
  registrationChallenge: z.ZodOptional<z.ZodString>;
98
+ registrationRpId: z.ZodOptional<z.ZodString>;
88
99
  authenticationChallenge: z.ZodOptional<z.ZodString>;
89
100
  registrationInfo: z.ZodOptional<z.ZodObject<{
90
101
  type: z.ZodLiteral<import("../../index.js").MfaFactor.WebAuthn>;
102
+ rpId: z.ZodString;
91
103
  credentialId: z.ZodString;
92
104
  publicKey: z.ZodString;
93
105
  transports: z.ZodArray<z.ZodEnum<["usb", "nfc", "ble", "internal", "cable", "hybrid", "smart-card"]>, "many">;
@@ -96,6 +108,7 @@ export declare const sanitizedWebAuthnVerificationRecordDataGuard: z.ZodObject<O
96
108
  name: z.ZodOptional<z.ZodString>;
97
109
  }, "strip", z.ZodTypeAny, {
98
110
  type: import("../../index.js").MfaFactor.WebAuthn;
111
+ rpId: string;
99
112
  credentialId: string;
100
113
  publicKey: string;
101
114
  transports: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[];
@@ -104,6 +117,7 @@ export declare const sanitizedWebAuthnVerificationRecordDataGuard: z.ZodObject<O
104
117
  name?: string | undefined;
105
118
  }, {
106
119
  type: import("../../index.js").MfaFactor.WebAuthn;
120
+ rpId: string;
107
121
  credentialId: string;
108
122
  publicKey: string;
109
123
  transports: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[];
@@ -111,7 +125,7 @@ export declare const sanitizedWebAuthnVerificationRecordDataGuard: z.ZodObject<O
111
125
  agent: string;
112
126
  name?: string | undefined;
113
127
  }>>;
114
- }, "registrationChallenge" | "authenticationChallenge" | "registrationInfo">, "strip", z.ZodTypeAny, {
128
+ }, "registrationChallenge" | "registrationRpId" | "authenticationChallenge" | "registrationInfo">, "strip", z.ZodTypeAny, {
115
129
  type: VerificationType.WebAuthn;
116
130
  id: string;
117
131
  userId: string;
@@ -7,11 +7,13 @@ export const webAuthnVerificationRecordDataGuard = z.object({
7
7
  userId: z.string(),
8
8
  verified: z.boolean(),
9
9
  registrationChallenge: z.string().optional(),
10
+ registrationRpId: z.string().optional(),
10
11
  authenticationChallenge: z.string().optional(),
11
12
  registrationInfo: bindWebAuthnGuard.optional(),
12
13
  });
13
14
  export const sanitizedWebAuthnVerificationRecordDataGuard = webAuthnVerificationRecordDataGuard.omit({
14
15
  registrationInfo: true,
15
16
  registrationChallenge: true,
17
+ registrationRpId: true,
16
18
  authenticationChallenge: true,
17
19
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logto/schemas",
3
- "version": "1.31.0",
3
+ "version": "1.33.0",
4
4
  "author": "Silverhand Inc. <contact@silverhand.io>",
5
5
  "license": "MPL-2.0",
6
6
  "type": "module",
@@ -65,11 +65,11 @@
65
65
  "dependencies": {
66
66
  "@withtyped/server": "^0.14.0",
67
67
  "nanoid": "^5.0.9",
68
- "@logto/connector-kit": "^4.5.0",
69
- "@logto/core-kit": "^2.6.1",
70
68
  "@logto/language-kit": "^1.2.0",
71
- "@logto/phrases": "^1.20.0",
72
- "@logto/phrases-experience": "^1.11.0",
69
+ "@logto/core-kit": "^2.6.1",
70
+ "@logto/connector-kit": "^4.6.0",
71
+ "@logto/phrases": "^1.22.0",
72
+ "@logto/phrases-experience": "^1.12.0",
73
73
  "@logto/shared": "^3.3.0"
74
74
  },
75
75
  "peerDependencies": {
@@ -8,6 +8,7 @@ create table application_sign_in_experiences (
8
8
  references applications (id) on update cascade on delete cascade,
9
9
  color jsonb /* @use PartialColor */ not null default '{}'::jsonb,
10
10
  branding jsonb /* @use Branding */ not null default '{}'::jsonb,
11
+ custom_css text,
11
12
  terms_of_use_url varchar(2048),
12
13
  privacy_policy_url varchar(2048),
13
14
  display_name varchar(256),
@@ -26,6 +26,9 @@ create index applications__id
26
26
  create index applications__is_third_party
27
27
  on applications (tenant_id, is_third_party);
28
28
 
29
+ create index applications__type
30
+ on applications (tenant_id, type);
31
+
29
32
  create unique index applications__protected_app_metadata_host
30
33
  on applications (
31
34
  (protected_app_metadata->>'host')
@@ -11,3 +11,6 @@ create table daily_active_users (
11
11
 
12
12
  create index daily_active_users__id
13
13
  on daily_active_users (tenant_id, id);
14
+
15
+ create index daily_active_users__date
16
+ on daily_active_users (tenant_id, date);
@@ -14,8 +14,12 @@ create table organizations (
14
14
  custom_data jsonb /* @use JsonObject */ not null default '{}'::jsonb,
15
15
  /** Whether multi-factor authentication configuration is required for the members of the organization. */
16
16
  is_mfa_required boolean not null default false,
17
+ /** The organization's branding color configuration. */
18
+ color jsonb /* @use PartialColor */ not null default '{}'::jsonb,
17
19
  /** The organization's branding configuration. */
18
20
  branding jsonb /* @use Branding */ not null default '{}'::jsonb,
21
+ /** The custom CSS of the organization. */
22
+ custom_css text,
19
23
  /** When the organization was created. */
20
24
  created_at timestamptz not null default(now()),
21
25
  primary key (id)
package/tables/roles.sql CHANGED
@@ -19,6 +19,9 @@ create table roles (
19
19
  create index roles__id
20
20
  on roles (tenant_id, id);
21
21
 
22
+ create index roles__type
23
+ on roles (tenant_id, type);
24
+
22
25
  create function public.check_role_type(role_id varchar(21), target_type role_type) returns boolean as
23
26
  $$ begin
24
27
  return (select type from public.roles where id = role_id) = target_type;
@@ -7,6 +7,7 @@ create table sign_in_experiences (
7
7
  id varchar(21) not null,
8
8
  color jsonb /* @use Color */ not null,
9
9
  branding jsonb /* @use Branding */ not null,
10
+ hide_logto_branding boolean not null default false,
10
11
  language_info jsonb /* @use LanguageInfo */ not null,
11
12
  terms_of_use_url varchar(2048),
12
13
  privacy_policy_url varchar(2048),
@@ -29,6 +30,6 @@ create table sign_in_experiences (
29
30
  captcha_policy jsonb /* @use CaptchaPolicy */ not null default '{}'::jsonb,
30
31
  sentinel_policy jsonb /* @use SentinelPolicy */ not null default '{}'::jsonb,
31
32
  email_blocklist_policy jsonb /* @use EmailBlocklistPolicy */ not null default '{}'::jsonb,
32
- forgot_password_methods jsonb /* @use ForgotPasswordMethods */,
33
+ forgot_password_methods jsonb /* @use ForgotPasswordMethods */ default '[]'::jsonb,
33
34
  primary key (tenant_id, id)
34
35
  );