@logto/schemas 1.42.0 → 1.44.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 (189) hide show
  1. package/alterations/1.43.0-1785393731-add-oidc-model-instances-account-id-partial-index.ts +33 -0
  2. package/alterations/1.43.0-1785481546-add-tenant-aware-scope-indexes.ts +33 -0
  3. package/alterations/1.43.0-1785488115-add-cimd-permission-ceiling-tables.ts +77 -0
  4. package/alterations/1.43.0-1785722831-add-oidc-session-extensions-account-id-index.ts +27 -0
  5. package/alterations/1.43.0-1785835991-add-cimd-client-identifier-columns.ts +31 -0
  6. package/alterations/1.43.0-1786325989-add-cimd-grant-organizations-table.ts +54 -0
  7. package/alterations/1.43.0-1786333495-add-trusted-devices.ts +57 -0
  8. package/alterations/1.43.0-1786373004-tighten-cimd-grant-organizations-pkey.ts +28 -0
  9. package/alterations/1.43.0-1786414712-add-service-logs-email-indexes.ts +34 -0
  10. package/alterations/1.43.0-1786431364-add-cimd-grant-client-snapshots-table.ts +43 -0
  11. package/alterations/1.44.0-1788946735-add-saml-authn-request-config.ts +18 -0
  12. package/alterations/1.44.0-1789000000-extend-user-id-length.ts +61 -0
  13. package/alterations-js/1.43.0-1785393731-add-oidc-model-instances-account-id-partial-index.js +28 -0
  14. package/alterations-js/1.43.0-1785481546-add-tenant-aware-scope-indexes.js +28 -0
  15. package/alterations-js/1.43.0-1785488115-add-cimd-permission-ceiling-tables.js +69 -0
  16. package/alterations-js/1.43.0-1785722831-add-oidc-session-extensions-account-id-index.js +23 -0
  17. package/alterations-js/1.43.0-1785835991-add-cimd-client-identifier-columns.js +27 -0
  18. package/alterations-js/1.43.0-1786325989-add-cimd-grant-organizations-table.js +49 -0
  19. package/alterations-js/1.43.0-1786333495-add-trusted-devices.js +50 -0
  20. package/alterations-js/1.43.0-1786373004-tighten-cimd-grant-organizations-pkey.js +24 -0
  21. package/alterations-js/1.43.0-1786414712-add-service-logs-email-indexes.js +30 -0
  22. package/alterations-js/1.43.0-1786431364-add-cimd-grant-client-snapshots-table.js +38 -0
  23. package/alterations-js/1.44.0-1788946735-add-saml-authn-request-config.js +14 -0
  24. package/alterations-js/1.44.0-1789000000-extend-user-id-length.js +47 -0
  25. package/lib/consts/experience.d.ts +3 -0
  26. package/lib/consts/experience.js +3 -0
  27. package/lib/consts/index.d.ts +2 -0
  28. package/lib/consts/index.js +2 -0
  29. package/lib/consts/license.d.ts +222 -0
  30. package/lib/consts/license.js +81 -0
  31. package/lib/consts/license.test.d.ts +1 -0
  32. package/lib/consts/license.test.js +96 -0
  33. package/lib/consts/oidc.d.ts +15 -1
  34. package/lib/consts/oidc.js +11 -0
  35. package/lib/consts/oidc.test.d.ts +1 -0
  36. package/lib/consts/oidc.test.js +15 -0
  37. package/lib/consts/product-event.d.ts +5 -1
  38. package/lib/consts/product-event.js +4 -0
  39. package/lib/consts/social-state.d.ts +12 -0
  40. package/lib/consts/social-state.js +12 -0
  41. package/lib/consts/subscriptions.d.ts +13 -1
  42. package/lib/consts/subscriptions.js +12 -0
  43. package/lib/db-entries/aggregated-daily-active-user.js +2 -2
  44. package/lib/db-entries/application-access-control-user-relation.js +2 -2
  45. package/lib/db-entries/application-user-consent-organization.js +2 -2
  46. package/lib/db-entries/cimd-grant-client-snapshot.d.ts +32 -0
  47. package/lib/db-entries/cimd-grant-client-snapshot.js +45 -0
  48. package/lib/db-entries/cimd-grant-organization.d.ts +30 -0
  49. package/lib/db-entries/cimd-grant-organization.js +37 -0
  50. package/lib/db-entries/cimd-organization-resource-scope.d.ts +20 -0
  51. package/lib/db-entries/cimd-organization-resource-scope.js +25 -0
  52. package/lib/db-entries/cimd-organization-scope.d.ts +20 -0
  53. package/lib/db-entries/cimd-organization-scope.js +25 -0
  54. package/lib/db-entries/cimd-resource-scope.d.ts +20 -0
  55. package/lib/db-entries/cimd-resource-scope.js +25 -0
  56. package/lib/db-entries/cimd-user-scope.d.ts +20 -0
  57. package/lib/db-entries/cimd-user-scope.js +25 -0
  58. package/lib/db-entries/daily-active-user.js +2 -2
  59. package/lib/db-entries/index.d.ts +7 -0
  60. package/lib/db-entries/index.js +7 -0
  61. package/lib/db-entries/oidc-session-extension.d.ts +3 -1
  62. package/lib/db-entries/oidc-session-extension.js +6 -2
  63. package/lib/db-entries/organization-invitation.js +4 -4
  64. package/lib/db-entries/organization-role-user-relation.js +2 -2
  65. package/lib/db-entries/organization-user-relation.js +2 -2
  66. package/lib/db-entries/organization.d.ts +5 -1
  67. package/lib/db-entries/organization.js +4 -0
  68. package/lib/db-entries/personal-access-token.js +2 -2
  69. package/lib/db-entries/saml-application-config.d.ts +4 -2
  70. package/lib/db-entries/saml-application-config.js +5 -1
  71. package/lib/db-entries/secret.js +2 -2
  72. package/lib/db-entries/sign-in-experience.d.ts +4 -2
  73. package/lib/db-entries/sign-in-experience.js +5 -1
  74. package/lib/db-entries/subject-token.js +2 -2
  75. package/lib/db-entries/trusted-device.d.ts +36 -0
  76. package/lib/db-entries/trusted-device.js +62 -0
  77. package/lib/db-entries/user-geo-location.js +2 -2
  78. package/lib/db-entries/user-sign-in-country.js +2 -2
  79. package/lib/db-entries/user-sso-identity.js +2 -2
  80. package/lib/db-entries/user.d.ts +3 -1
  81. package/lib/db-entries/user.js +6 -2
  82. package/lib/db-entries/users-role.js +2 -2
  83. package/lib/db-entries/verification-record.js +2 -2
  84. package/lib/db-entries/verification-status.js +2 -2
  85. package/lib/foundations/jsonb-types/account-centers.d.ts +3 -0
  86. package/lib/foundations/jsonb-types/account-centers.js +1 -0
  87. package/lib/foundations/jsonb-types/account-centers.test.d.ts +1 -0
  88. package/lib/foundations/jsonb-types/account-centers.test.js +13 -0
  89. package/lib/foundations/jsonb-types/captcha.d.ts +47 -1
  90. package/lib/foundations/jsonb-types/captcha.js +20 -0
  91. package/lib/foundations/jsonb-types/hooks.d.ts +5 -4
  92. package/lib/foundations/jsonb-types/hooks.js +3 -0
  93. package/lib/foundations/jsonb-types/logs.d.ts +18 -0
  94. package/lib/foundations/jsonb-types/logs.js +6 -0
  95. package/lib/foundations/jsonb-types/saml-application-configs.d.ts +23 -0
  96. package/lib/foundations/jsonb-types/saml-application-configs.js +16 -0
  97. package/lib/foundations/jsonb-types/saml-application-configs.test.js +24 -1
  98. package/lib/foundations/jsonb-types/sign-in-experience.d.ts +23 -3
  99. package/lib/foundations/jsonb-types/sign-in-experience.js +9 -0
  100. package/lib/foundations/jsonb-types/sign-in-experience.test.js +17 -1
  101. package/lib/types/authentication-context.d.ts +224 -0
  102. package/lib/types/authentication-context.js +238 -0
  103. package/lib/types/authentication-context.test.d.ts +1 -0
  104. package/lib/types/authentication-context.test.js +186 -0
  105. package/lib/types/connector.d.ts +8 -0
  106. package/lib/types/consent.d.ts +16 -190
  107. package/lib/types/consent.js +10 -1
  108. package/lib/types/cookie.d.ts +4 -0
  109. package/lib/types/cookie.js +6 -1
  110. package/lib/types/custom-profile-fields.d.ts +1 -0
  111. package/lib/types/hook.d.ts +31 -6
  112. package/lib/types/index.d.ts +2 -0
  113. package/lib/types/index.js +2 -0
  114. package/lib/types/interactions.d.ts +161 -0
  115. package/lib/types/interactions.js +23 -0
  116. package/lib/types/log/index.d.ts +5 -2
  117. package/lib/types/log/index.js +1 -0
  118. package/lib/types/log/interaction.d.ts +15 -2
  119. package/lib/types/log/interaction.js +5 -0
  120. package/lib/types/log/trusted-device.d.ts +7 -0
  121. package/lib/types/log/trusted-device.js +6 -0
  122. package/lib/types/logto-config/action.d.ts +1 -1
  123. package/lib/types/logto-config/action.js +1 -1
  124. package/lib/types/logto-config/index.d.ts +83 -7
  125. package/lib/types/logto-config/index.js +14 -0
  126. package/lib/types/logto-config/index.test.js +23 -0
  127. package/lib/types/logto-config/jwt-customizer.d.ts +123 -10
  128. package/lib/types/logto-config/jwt-customizer.js +1 -1
  129. package/lib/types/logto-config/oidc-provider.d.ts +2 -2
  130. package/lib/types/saml-application.d.ts +55 -1
  131. package/lib/types/saml-application.js +7 -1
  132. package/lib/types/service-log.d.ts +14 -1
  133. package/lib/types/service-log.js +13 -0
  134. package/lib/types/sign-in-experience.d.ts +20 -6
  135. package/lib/types/sign-in-experience.js +1 -0
  136. package/lib/types/ssr.d.ts +2 -0
  137. package/lib/types/system.d.ts +59 -7
  138. package/lib/types/system.js +36 -0
  139. package/lib/types/system.test.d.ts +1 -0
  140. package/lib/types/system.test.js +26 -0
  141. package/lib/types/trusted-device.d.ts +67 -0
  142. package/lib/types/trusted-device.js +16 -0
  143. package/lib/types/user-sessions.d.ts +195 -209
  144. package/lib/types/user-sessions.js +9 -4
  145. package/lib/types/user.d.ts +10 -3
  146. package/lib/types/user.js +1 -0
  147. package/lib/types/verification-records/code-verification.d.ts +17 -0
  148. package/lib/types/verification-records/code-verification.js +1 -0
  149. package/lib/utils/cimd.d.ts +14 -0
  150. package/lib/utils/cimd.js +14 -0
  151. package/lib/utils/cimd.test.d.ts +1 -0
  152. package/lib/utils/cimd.test.js +9 -0
  153. package/lib/utils/index.d.ts +1 -0
  154. package/lib/utils/index.js +1 -0
  155. package/lib/utils/oidc-private-key.test.js +44 -0
  156. package/package.json +9 -9
  157. package/tables/aggregated_daily_active_users.sql +1 -1
  158. package/tables/application_access_control_user_relations.sql +1 -1
  159. package/tables/application_user_consent_organizations.sql +1 -1
  160. package/tables/cimd_grant_client_snapshots.sql +27 -0
  161. package/tables/cimd_grant_organizations.sql +38 -0
  162. package/tables/cimd_organization_resource_scopes.sql +16 -0
  163. package/tables/cimd_organization_scopes.sql +15 -0
  164. package/tables/cimd_resource_scopes.sql +15 -0
  165. package/tables/cimd_user_scopes.sql +13 -0
  166. package/tables/daily_active_users.sql +1 -1
  167. package/tables/oidc_model_instances.sql +5 -0
  168. package/tables/oidc_session_extensions.sql +6 -1
  169. package/tables/organization_invitations.sql +2 -2
  170. package/tables/organization_role_user_relations.sql +1 -1
  171. package/tables/organization_scopes.sql +4 -0
  172. package/tables/organization_user_relations.sql +1 -1
  173. package/tables/organizations.sql +2 -0
  174. package/tables/personal_access_tokens.sql +1 -1
  175. package/tables/saml_application_configs.sql +1 -0
  176. package/tables/scopes.sql +4 -0
  177. package/tables/secrets.sql +1 -1
  178. package/tables/service_logs.sql +14 -0
  179. package/tables/sign_in_experiences.sql +1 -0
  180. package/tables/subject_tokens.sql +1 -1
  181. package/tables/trusted_devices.sql +25 -0
  182. package/tables/user_geo_locations.sql +1 -1
  183. package/tables/user_sign_in_countries.sql +1 -1
  184. package/tables/user_sso_identities.sql +1 -1
  185. package/tables/users.sql +2 -1
  186. package/tables/users_roles.sql +1 -1
  187. package/tables/verification_records.sql +1 -1
  188. package/tables/verification_statuses.sql +1 -1
  189. package/LICENSE +0 -373
@@ -0,0 +1,96 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { LicenseEnv, licensePayloadGuard, ossDefaultQuota, resolveLicenseQuota, } from './license.js';
3
+ import { ReservedPlanId } from './subscriptions.js';
4
+ const validPayload = Object.freeze({
5
+ plan: ReservedPlanId.SelfHostedPro,
6
+ env: LicenseEnv.Production,
7
+ customerId: 'cus_1234567890',
8
+ licenseId: 'lic_1234567890',
9
+ iat: 1_760_000_000,
10
+ exp: 1_791_536_000,
11
+ quota: {
12
+ hideLogtoBranding: true,
13
+ bringYourUi: true,
14
+ idpInitiatedSso: true,
15
+ consoleCollaboration: true,
16
+ mandatoryMfa: true,
17
+ hostedEmail: false,
18
+ samlApplicationsLimit: null,
19
+ },
20
+ });
21
+ describe('licensePayloadGuard', () => {
22
+ it('parses a production Pro license payload', () => {
23
+ expect(licensePayloadGuard.parse(validPayload)).toEqual(validPayload);
24
+ });
25
+ it('parses a non-production Enterprise license payload', () => {
26
+ const payload = {
27
+ ...validPayload,
28
+ plan: ReservedPlanId.SelfHostedEnterprise,
29
+ env: LicenseEnv.NonProduction,
30
+ };
31
+ expect(licensePayloadGuard.parse(payload)).toEqual(payload);
32
+ });
33
+ it('parses a payload carrying only the entitlements it changes', () => {
34
+ const payload = { ...validPayload, quota: { hideLogtoBranding: true } };
35
+ expect(licensePayloadGuard.parse(payload)).toEqual(payload);
36
+ });
37
+ it.each([ReservedPlanId.Free, ReservedPlanId.Pro202509, ReservedPlanId.Development])('rejects the Cloud-only plan %s', (plan) => {
38
+ expect(licensePayloadGuard.safeParse({ ...validPayload, plan }).success).toBe(false);
39
+ });
40
+ it('rejects an unknown environment', () => {
41
+ expect(licensePayloadGuard.safeParse({ ...validPayload, env: 'staging' }).success).toBe(false);
42
+ });
43
+ it.each([-1, 1.5, '3'])('rejects the SAML application limit %j', (samlApplicationsLimit) => {
44
+ expect(licensePayloadGuard.safeParse({
45
+ ...validPayload,
46
+ quota: { ...validPayload.quota, samlApplicationsLimit },
47
+ }).success).toBe(false);
48
+ });
49
+ it('strips unknown claims instead of rejecting them', () => {
50
+ expect(licensePayloadGuard.parse({ ...validPayload, iss: 'https://logto.io' })).toEqual(validPayload);
51
+ });
52
+ });
53
+ describe('ossDefaultQuota', () => {
54
+ it('locks every feature and caps SAML applications at 3', () => {
55
+ expect(ossDefaultQuota).toStrictEqual({
56
+ hideLogtoBranding: false,
57
+ bringYourUi: false,
58
+ idpInitiatedSso: false,
59
+ consoleCollaboration: false,
60
+ mandatoryMfa: false,
61
+ hostedEmail: false,
62
+ samlApplicationsLimit: 3,
63
+ });
64
+ });
65
+ });
66
+ describe('resolveLicenseQuota', () => {
67
+ it('falls back to the OSS defaults without a license', () => {
68
+ expect(resolveLicenseQuota()).toStrictEqual(ossDefaultQuota);
69
+ });
70
+ it('applies every entitlement a license grants', () => {
71
+ expect(resolveLicenseQuota(validPayload.quota)).toStrictEqual({
72
+ hideLogtoBranding: true,
73
+ bringYourUi: true,
74
+ idpInitiatedSso: true,
75
+ consoleCollaboration: true,
76
+ mandatoryMfa: true,
77
+ hostedEmail: false,
78
+ samlApplicationsLimit: null,
79
+ });
80
+ });
81
+ it('keeps the OSS default for an entitlement the license does not carry', () => {
82
+ expect(resolveLicenseQuota({ hideLogtoBranding: true })).toStrictEqual({
83
+ ...ossDefaultQuota,
84
+ hideLogtoBranding: true,
85
+ });
86
+ });
87
+ it('keeps an unlimited SAML application quota instead of falling back to the cap', () => {
88
+ expect(resolveLicenseQuota({ samlApplicationsLimit: null }).samlApplicationsLimit).toBeNull();
89
+ });
90
+ it('applies a SAML application quota of 0', () => {
91
+ expect(resolveLicenseQuota({ samlApplicationsLimit: 0 }).samlApplicationsLimit).toBe(0);
92
+ });
93
+ it('applies an explicitly disabled entitlement', () => {
94
+ expect(resolveLicenseQuota({ hostedEmail: false }).hostedEmail).toBe(false);
95
+ });
96
+ });
@@ -67,7 +67,17 @@ export declare enum ExtraParamsKey {
67
67
  /**
68
68
  * The Google One Tap credential JWT token for external website integration.
69
69
  */
70
- GoogleOneTapCredential = "google_one_tap_credential"
70
+ GoogleOneTapCredential = "google_one_tap_credential",
71
+ /**
72
+ * Overrides the theme that the sign-in experience would otherwise resolve from the end-user's
73
+ * OS settings, so an application with its own light / dark toggle can keep Logto in sync.
74
+ *
75
+ * The parameter is ignored when dark mode is disabled in the sign-in experience configuration,
76
+ * and an unrecognized value is ignored without affecting the other parameters.
77
+ *
78
+ * The available values are `light` and `dark`.
79
+ */
80
+ Theme = "theme"
71
81
  }
72
82
  /** @deprecated Use {@link FirstScreen} instead. */
73
83
  export declare enum InteractionMode {
@@ -94,6 +104,7 @@ export declare const extraParamsObjectGuard: z.ZodObject<{
94
104
  identifier: z.ZodOptional<z.ZodString>;
95
105
  one_time_token: z.ZodOptional<z.ZodString>;
96
106
  google_one_tap_credential: z.ZodOptional<z.ZodString>;
107
+ theme: z.ZodOptional<z.ZodString>;
97
108
  }, "strip", z.ZodTypeAny, {
98
109
  interaction_mode?: InteractionMode | undefined;
99
110
  first_screen?: FirstScreen | undefined;
@@ -104,6 +115,7 @@ export declare const extraParamsObjectGuard: z.ZodObject<{
104
115
  identifier?: string | undefined;
105
116
  one_time_token?: string | undefined;
106
117
  google_one_tap_credential?: string | undefined;
118
+ theme?: string | undefined;
107
119
  }, {
108
120
  interaction_mode?: InteractionMode | undefined;
109
121
  first_screen?: FirstScreen | undefined;
@@ -114,6 +126,7 @@ export declare const extraParamsObjectGuard: z.ZodObject<{
114
126
  identifier?: string | undefined;
115
127
  one_time_token?: string | undefined;
116
128
  google_one_tap_credential?: string | undefined;
129
+ theme?: string | undefined;
117
130
  }>;
118
131
  export type ExtraParamsObject = Partial<{
119
132
  [ExtraParamsKey.InteractionMode]: InteractionMode;
@@ -125,4 +138,5 @@ export type ExtraParamsObject = Partial<{
125
138
  [ExtraParamsKey.Identifier]: string;
126
139
  [ExtraParamsKey.OneTimeToken]: string;
127
140
  [ExtraParamsKey.GoogleOneTapCredential]: string;
141
+ [ExtraParamsKey.Theme]: string;
128
142
  }>;
@@ -70,6 +70,16 @@ export var ExtraParamsKey;
70
70
  * The Google One Tap credential JWT token for external website integration.
71
71
  */
72
72
  ExtraParamsKey["GoogleOneTapCredential"] = "google_one_tap_credential";
73
+ /**
74
+ * Overrides the theme that the sign-in experience would otherwise resolve from the end-user's
75
+ * OS settings, so an application with its own light / dark toggle can keep Logto in sync.
76
+ *
77
+ * The parameter is ignored when dark mode is disabled in the sign-in experience configuration,
78
+ * and an unrecognized value is ignored without affecting the other parameters.
79
+ *
80
+ * The available values are `light` and `dark`.
81
+ */
82
+ ExtraParamsKey["Theme"] = "theme";
73
83
  })(ExtraParamsKey || (ExtraParamsKey = {}));
74
84
  /** @deprecated Use {@link FirstScreen} instead. */
75
85
  export var InteractionMode;
@@ -99,5 +109,6 @@ export const extraParamsObjectGuard = z
99
109
  [ExtraParamsKey.Identifier]: z.string(),
100
110
  [ExtraParamsKey.OneTimeToken]: z.string(),
101
111
  [ExtraParamsKey.GoogleOneTapCredential]: z.string(),
112
+ [ExtraParamsKey.Theme]: z.string(),
102
113
  })
103
114
  .partial();
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { ExtraParamsKey, FirstScreen, extraParamsObjectGuard } from './oidc.js';
3
+ describe('extraParamsObjectGuard', () => {
4
+ it('should keep the other parameters when the theme is not a supported value', () => {
5
+ // Core parses every extra param in one call and falls back to an empty object when the
6
+ // parse throws, so a loose value here must never discard the parameters next to it.
7
+ const params = extraParamsObjectGuard.parse({
8
+ [ExtraParamsKey.Theme]: 'sepia',
9
+ [ExtraParamsKey.FirstScreen]: FirstScreen.Register,
10
+ [ExtraParamsKey.LoginHint]: 'foo@logto.io',
11
+ });
12
+ expect(params[ExtraParamsKey.FirstScreen]).toBe(FirstScreen.Register);
13
+ expect(params[ExtraParamsKey.LoginHint]).toBe('foo@logto.io');
14
+ });
15
+ });
@@ -67,7 +67,11 @@ export declare enum ProductEvent {
67
67
  MfaEnabled = "mfa enabled",
68
68
  MfaDisabled = "mfa disabled",
69
69
  CustomDomainCreated = "custom domain created",
70
- CustomDomainDeleted = "custom domain deleted"
70
+ CustomDomainDeleted = "custom domain deleted",
71
+ /** The tenant has turned on dynamic app (CIMD) client access. */
72
+ DynamicAppEnabled = "dynamic app enabled",
73
+ /** The tenant has turned off dynamic app (CIMD) client access. */
74
+ DynamicAppDisabled = "dynamic app disabled"
71
75
  }
72
76
  /** The PostHog groups for product events. */
73
77
  export declare enum EventGroup {
@@ -69,6 +69,10 @@ export var ProductEvent;
69
69
  ProductEvent["MfaDisabled"] = "mfa disabled";
70
70
  ProductEvent["CustomDomainCreated"] = "custom domain created";
71
71
  ProductEvent["CustomDomainDeleted"] = "custom domain deleted";
72
+ /** The tenant has turned on dynamic app (CIMD) client access. */
73
+ ProductEvent["DynamicAppEnabled"] = "dynamic app enabled";
74
+ /** The tenant has turned off dynamic app (CIMD) client access. */
75
+ ProductEvent["DynamicAppDisabled"] = "dynamic app disabled";
72
76
  })(ProductEvent || (ProductEvent = {}));
73
77
  /** The PostHog groups for product events. */
74
78
  export var EventGroup;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Prefixes of the OAuth `state` parameter used by the first-party clients that share the
3
+ * `/callback/:connectorId` social callback URI.
4
+ *
5
+ * Logto Core routes an incoming callback by looking at the `state` prefix, so the prefixes must
6
+ * never be a prefix of each other. Keep them defined together to preserve that invariant.
7
+ *
8
+ * A `state` carrying no known prefix falls back to the Sign-in Experience, which keeps in-flight
9
+ * requests and custom sign-in UIs that build their own `state` working.
10
+ */
11
+ export declare const accountCenterSocialStatePrefix = "ac_";
12
+ export declare const experienceSocialStatePrefix = "se_";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Prefixes of the OAuth `state` parameter used by the first-party clients that share the
3
+ * `/callback/:connectorId` social callback URI.
4
+ *
5
+ * Logto Core routes an incoming callback by looking at the `state` prefix, so the prefixes must
6
+ * never be a prefix of each other. Keep them defined together to preserve that invariant.
7
+ *
8
+ * A `state` carrying no known prefix falls back to the Sign-in Experience, which keeps in-flight
9
+ * requests and custom sign-in UIs that build their own `state` working.
10
+ */
11
+ export const accountCenterSocialStatePrefix = 'ac_';
12
+ export const experienceSocialStatePrefix = 'se_';
@@ -27,7 +27,19 @@ export declare enum ReservedPlanId {
27
27
  /**
28
28
  * Latest Pro plan ID applied from 2025-09.
29
29
  */
30
- Pro202509 = "pro-202509"
30
+ Pro202509 = "pro-202509",
31
+ /**
32
+ * Self-hosted Pro plan, unlocked by installing a license key on a self-hosted instance.
33
+ *
34
+ * Unlike the plans above, this one is never returned by the Cloud subscription API: it is carried
35
+ * in the signed license payload and resolved locally. See `licensePayloadGuard`.
36
+ */
37
+ SelfHostedPro = "self-hosted-pro",
38
+ /**
39
+ * Self-hosted Enterprise plan, unlocked by installing a license key on a self-hosted instance.
40
+ * See {@link SelfHostedPro}.
41
+ */
42
+ SelfHostedEnterprise = "self-hosted-enterprise"
31
43
  }
32
44
  /**
33
45
  * Tenant subscription related Redis cache keys.
@@ -29,6 +29,18 @@ export var ReservedPlanId;
29
29
  * Latest Pro plan ID applied from 2025-09.
30
30
  */
31
31
  ReservedPlanId["Pro202509"] = "pro-202509";
32
+ /**
33
+ * Self-hosted Pro plan, unlocked by installing a license key on a self-hosted instance.
34
+ *
35
+ * Unlike the plans above, this one is never returned by the Cloud subscription API: it is carried
36
+ * in the signed license payload and resolved locally. See `licensePayloadGuard`.
37
+ */
38
+ ReservedPlanId["SelfHostedPro"] = "self-hosted-pro";
39
+ /**
40
+ * Self-hosted Enterprise plan, unlocked by installing a license key on a self-hosted instance.
41
+ * See {@link SelfHostedPro}.
42
+ */
43
+ ReservedPlanId["SelfHostedEnterprise"] = "self-hosted-enterprise";
32
44
  })(ReservedPlanId || (ReservedPlanId = {}));
33
45
  /**
34
46
  * Tenant subscription related Redis cache keys.
@@ -3,13 +3,13 @@ import { z } from 'zod';
3
3
  const createGuard = z.object({
4
4
  tenantId: z.string().max(21).optional(),
5
5
  activityDate: z.number(),
6
- userId: z.string().min(1).max(21),
6
+ userId: z.string().min(1).max(128),
7
7
  activityCount: z.number(),
8
8
  });
9
9
  const guard = z.object({
10
10
  tenantId: z.string().max(21),
11
11
  activityDate: z.number(),
12
- userId: z.string().min(1).max(21),
12
+ userId: z.string().min(1).max(128),
13
13
  activityCount: z.number(),
14
14
  });
15
15
  export const AggregatedDailyActiveUsers = Object.freeze({
@@ -3,12 +3,12 @@ import { z } from 'zod';
3
3
  const createGuard = z.object({
4
4
  tenantId: z.string().max(21).optional(),
5
5
  applicationId: z.string().min(1).max(21),
6
- userId: z.string().min(1).max(21),
6
+ userId: z.string().min(1).max(128),
7
7
  });
8
8
  const guard = z.object({
9
9
  tenantId: z.string().max(21),
10
10
  applicationId: z.string().min(1).max(21),
11
- userId: z.string().min(1).max(21),
11
+ userId: z.string().min(1).max(128),
12
12
  });
13
13
  export const ApplicationAccessControlUserRelations = Object.freeze({
14
14
  table: 'application_access_control_user_relations',
@@ -4,13 +4,13 @@ const createGuard = z.object({
4
4
  tenantId: z.string().max(21).optional(),
5
5
  applicationId: z.string().min(1).max(21),
6
6
  organizationId: z.string().min(1).max(21),
7
- userId: z.string().min(1).max(21),
7
+ userId: z.string().min(1).max(128),
8
8
  });
9
9
  const guard = z.object({
10
10
  tenantId: z.string().max(21),
11
11
  applicationId: z.string().min(1).max(21),
12
12
  organizationId: z.string().min(1).max(21),
13
- userId: z.string().min(1).max(21),
13
+ userId: z.string().min(1).max(128),
14
14
  });
15
15
  export const ApplicationUserConsentOrganizations = Object.freeze({
16
16
  table: 'application_user_consent_organizations',
@@ -0,0 +1,32 @@
1
+ import { GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ * The client identity a user approved at consent time for a client ID metadata document (CIMD) client, captured per Grant. CIMD clients are unregistered URL identities without an `applications` row, and an unvetted client can rewrite its hosted document at any time — so the grant list renders this snapshot instead of refetching the document.
4
+ *
5
+ * @remarks This is a type for database creation.
6
+ * @see {@link CimdGrantClientSnapshot} for the original type.
7
+ */
8
+ export type CreateCimdGrantClientSnapshot = {
9
+ tenantId?: string;
10
+ /** The ID of the Grant row in `oidc_model_instances`. */
11
+ grantId: string;
12
+ /** Fixed discriminator so the composite foreign key can target Grant rows in the polymorphic `oidc_model_instances` table. */
13
+ grantModelName?: string;
14
+ clientId: string;
15
+ name?: string | null;
16
+ logoUri?: string | null;
17
+ createdAt?: number;
18
+ };
19
+ /** The client identity a user approved at consent time for a client ID metadata document (CIMD) client, captured per Grant. CIMD clients are unregistered URL identities without an `applications` row, and an unvetted client can rewrite its hosted document at any time — so the grant list renders this snapshot instead of refetching the document. */
20
+ export type CimdGrantClientSnapshot = {
21
+ tenantId: string;
22
+ /** The ID of the Grant row in `oidc_model_instances`. */
23
+ grantId: string;
24
+ /** Fixed discriminator so the composite foreign key can target Grant rows in the polymorphic `oidc_model_instances` table. */
25
+ grantModelName: string;
26
+ clientId: string;
27
+ name: string | null;
28
+ logoUri: string | null;
29
+ createdAt: number;
30
+ };
31
+ export type CimdGrantClientSnapshotKeys = 'tenantId' | 'grantId' | 'grantModelName' | 'clientId' | 'name' | 'logoUri' | 'createdAt';
32
+ export declare const CimdGrantClientSnapshots: GeneratedSchema<CimdGrantClientSnapshotKeys, CreateCimdGrantClientSnapshot, CimdGrantClientSnapshot, 'cimd_grant_client_snapshots', 'cimd_grant_client_snapshot'>;
@@ -0,0 +1,45 @@
1
+ // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ import { z } from 'zod';
3
+ const createGuard = z.object({
4
+ tenantId: z.string().max(21).optional(),
5
+ grantId: z.string().min(1).max(128),
6
+ grantModelName: z.string().min(1).max(64).optional(),
7
+ clientId: z.string().min(1).max(2048),
8
+ name: z.string().max(256).nullable().optional(),
9
+ logoUri: z.string().max(2048).nullable().optional(),
10
+ createdAt: z.number().optional(),
11
+ });
12
+ const guard = z.object({
13
+ tenantId: z.string().max(21),
14
+ grantId: z.string().min(1).max(128),
15
+ grantModelName: z.string().max(64),
16
+ clientId: z.string().min(1).max(2048),
17
+ name: z.string().max(256).nullable(),
18
+ logoUri: z.string().max(2048).nullable(),
19
+ createdAt: z.number(),
20
+ });
21
+ export const CimdGrantClientSnapshots = Object.freeze({
22
+ table: 'cimd_grant_client_snapshots',
23
+ tableSingular: 'cimd_grant_client_snapshot',
24
+ fields: {
25
+ tenantId: 'tenant_id',
26
+ grantId: 'grant_id',
27
+ grantModelName: 'grant_model_name',
28
+ clientId: 'client_id',
29
+ name: 'name',
30
+ logoUri: 'logo_uri',
31
+ createdAt: 'created_at',
32
+ },
33
+ fieldKeys: [
34
+ 'tenantId',
35
+ 'grantId',
36
+ 'grantModelName',
37
+ 'clientId',
38
+ 'name',
39
+ 'logoUri',
40
+ 'createdAt',
41
+ ],
42
+ createGuard,
43
+ guard,
44
+ updateGuard: guard.partial(),
45
+ });
@@ -0,0 +1,30 @@
1
+ import { GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ * The organization authorized on a single OIDC Grant for a client ID metadata document (CIMD) client. CIMD clients are unregistered URL identities with no deletion lifecycle and transferable ownership, so organization access follows the single authorization instead of a long-lived cross-grant relation: rows cascade away with the Grant row and with the user's organization membership.
4
+ *
5
+ * @remarks This is a type for database creation.
6
+ * @see {@link CimdGrantOrganization} for the original type.
7
+ */
8
+ export type CreateCimdGrantOrganization = {
9
+ tenantId?: string;
10
+ /** The ID of the Grant row in `oidc_model_instances`. */
11
+ grantId: string;
12
+ /** Fixed discriminator so the composite foreign key can target Grant rows in the polymorphic `oidc_model_instances` table. */
13
+ grantModelName?: string;
14
+ organizationId: string;
15
+ /** The user the grant was issued to and the membership FK's target. Must match the Grant payload's `accountId` (unreachable by FK) — the consent write enforces the pairing. */
16
+ userId: string;
17
+ };
18
+ /** The organization authorized on a single OIDC Grant for a client ID metadata document (CIMD) client. CIMD clients are unregistered URL identities with no deletion lifecycle and transferable ownership, so organization access follows the single authorization instead of a long-lived cross-grant relation: rows cascade away with the Grant row and with the user's organization membership. */
19
+ export type CimdGrantOrganization = {
20
+ tenantId: string;
21
+ /** The ID of the Grant row in `oidc_model_instances`. */
22
+ grantId: string;
23
+ /** Fixed discriminator so the composite foreign key can target Grant rows in the polymorphic `oidc_model_instances` table. */
24
+ grantModelName: string;
25
+ organizationId: string;
26
+ /** The user the grant was issued to and the membership FK's target. Must match the Grant payload's `accountId` (unreachable by FK) — the consent write enforces the pairing. */
27
+ userId: string;
28
+ };
29
+ export type CimdGrantOrganizationKeys = 'tenantId' | 'grantId' | 'grantModelName' | 'organizationId' | 'userId';
30
+ export declare const CimdGrantOrganizations: GeneratedSchema<CimdGrantOrganizationKeys, CreateCimdGrantOrganization, CimdGrantOrganization, 'cimd_grant_organizations', 'cimd_grant_organization'>;
@@ -0,0 +1,37 @@
1
+ // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ import { z } from 'zod';
3
+ const createGuard = z.object({
4
+ tenantId: z.string().max(21).optional(),
5
+ grantId: z.string().min(1).max(128),
6
+ grantModelName: z.string().min(1).max(64).optional(),
7
+ organizationId: z.string().min(1).max(21),
8
+ userId: z.string().min(1).max(128),
9
+ });
10
+ const guard = z.object({
11
+ tenantId: z.string().max(21),
12
+ grantId: z.string().min(1).max(128),
13
+ grantModelName: z.string().max(64),
14
+ organizationId: z.string().min(1).max(21),
15
+ userId: z.string().min(1).max(128),
16
+ });
17
+ export const CimdGrantOrganizations = Object.freeze({
18
+ table: 'cimd_grant_organizations',
19
+ tableSingular: 'cimd_grant_organization',
20
+ fields: {
21
+ tenantId: 'tenant_id',
22
+ grantId: 'grant_id',
23
+ grantModelName: 'grant_model_name',
24
+ organizationId: 'organization_id',
25
+ userId: 'user_id',
26
+ },
27
+ fieldKeys: [
28
+ 'tenantId',
29
+ 'grantId',
30
+ 'grantModelName',
31
+ 'organizationId',
32
+ 'userId',
33
+ ],
34
+ createGuard,
35
+ guard,
36
+ updateGuard: guard.partial(),
37
+ });
@@ -0,0 +1,20 @@
1
+ import { GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ * The organization API resource scopes (permissions) that client ID metadata document (CIMD) clients of the tenant can request. The scopes are granted to users through organization roles. Rows are an allowlist: an empty table allows nothing (deny-all), and an unrestricted state is not expressible.
4
+ *
5
+ * @remarks This is a type for database creation.
6
+ * @see {@link CimdOrganizationResourceScope} for the original type.
7
+ */
8
+ export type CreateCimdOrganizationResourceScope = {
9
+ tenantId?: string;
10
+ /** The globally unique identifier of the API resource scope. */
11
+ scopeId: string;
12
+ };
13
+ /** The organization API resource scopes (permissions) that client ID metadata document (CIMD) clients of the tenant can request. The scopes are granted to users through organization roles. Rows are an allowlist: an empty table allows nothing (deny-all), and an unrestricted state is not expressible. */
14
+ export type CimdOrganizationResourceScope = {
15
+ tenantId: string;
16
+ /** The globally unique identifier of the API resource scope. */
17
+ scopeId: string;
18
+ };
19
+ export type CimdOrganizationResourceScopeKeys = 'tenantId' | 'scopeId';
20
+ export declare const CimdOrganizationResourceScopes: GeneratedSchema<CimdOrganizationResourceScopeKeys, CreateCimdOrganizationResourceScope, CimdOrganizationResourceScope, 'cimd_organization_resource_scopes', 'cimd_organization_resource_scope'>;
@@ -0,0 +1,25 @@
1
+ // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ import { z } from 'zod';
3
+ const createGuard = z.object({
4
+ tenantId: z.string().max(21).optional(),
5
+ scopeId: z.string().min(1).max(21),
6
+ });
7
+ const guard = z.object({
8
+ tenantId: z.string().max(21),
9
+ scopeId: z.string().min(1).max(21),
10
+ });
11
+ export const CimdOrganizationResourceScopes = Object.freeze({
12
+ table: 'cimd_organization_resource_scopes',
13
+ tableSingular: 'cimd_organization_resource_scope',
14
+ fields: {
15
+ tenantId: 'tenant_id',
16
+ scopeId: 'scope_id',
17
+ },
18
+ fieldKeys: [
19
+ 'tenantId',
20
+ 'scopeId',
21
+ ],
22
+ createGuard,
23
+ guard,
24
+ updateGuard: guard.partial(),
25
+ });
@@ -0,0 +1,20 @@
1
+ import { GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ * The organization scopes (permissions) that client ID metadata document (CIMD) clients of the tenant can request. Rows are an allowlist: an empty table allows nothing (deny-all), and an unrestricted state is not expressible.
4
+ *
5
+ * @remarks This is a type for database creation.
6
+ * @see {@link CimdOrganizationScope} for the original type.
7
+ */
8
+ export type CreateCimdOrganizationScope = {
9
+ tenantId?: string;
10
+ /** The globally unique identifier of the organization scope. */
11
+ organizationScopeId: string;
12
+ };
13
+ /** The organization scopes (permissions) that client ID metadata document (CIMD) clients of the tenant can request. Rows are an allowlist: an empty table allows nothing (deny-all), and an unrestricted state is not expressible. */
14
+ export type CimdOrganizationScope = {
15
+ tenantId: string;
16
+ /** The globally unique identifier of the organization scope. */
17
+ organizationScopeId: string;
18
+ };
19
+ export type CimdOrganizationScopeKeys = 'tenantId' | 'organizationScopeId';
20
+ export declare const CimdOrganizationScopes: GeneratedSchema<CimdOrganizationScopeKeys, CreateCimdOrganizationScope, CimdOrganizationScope, 'cimd_organization_scopes', 'cimd_organization_scope'>;
@@ -0,0 +1,25 @@
1
+ // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ import { z } from 'zod';
3
+ const createGuard = z.object({
4
+ tenantId: z.string().max(21).optional(),
5
+ organizationScopeId: z.string().min(1).max(21),
6
+ });
7
+ const guard = z.object({
8
+ tenantId: z.string().max(21),
9
+ organizationScopeId: z.string().min(1).max(21),
10
+ });
11
+ export const CimdOrganizationScopes = Object.freeze({
12
+ table: 'cimd_organization_scopes',
13
+ tableSingular: 'cimd_organization_scope',
14
+ fields: {
15
+ tenantId: 'tenant_id',
16
+ organizationScopeId: 'organization_scope_id',
17
+ },
18
+ fieldKeys: [
19
+ 'tenantId',
20
+ 'organizationScopeId',
21
+ ],
22
+ createGuard,
23
+ guard,
24
+ updateGuard: guard.partial(),
25
+ });
@@ -0,0 +1,20 @@
1
+ import { GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ * The API resource scopes (permissions) that client ID metadata document (CIMD) clients of the tenant can request. Rows are an allowlist: an empty table allows nothing (deny-all), and an unrestricted state is not expressible.
4
+ *
5
+ * @remarks This is a type for database creation.
6
+ * @see {@link CimdResourceScope} for the original type.
7
+ */
8
+ export type CreateCimdResourceScope = {
9
+ tenantId?: string;
10
+ /** The globally unique identifier of the API resource scope. */
11
+ scopeId: string;
12
+ };
13
+ /** The API resource scopes (permissions) that client ID metadata document (CIMD) clients of the tenant can request. Rows are an allowlist: an empty table allows nothing (deny-all), and an unrestricted state is not expressible. */
14
+ export type CimdResourceScope = {
15
+ tenantId: string;
16
+ /** The globally unique identifier of the API resource scope. */
17
+ scopeId: string;
18
+ };
19
+ export type CimdResourceScopeKeys = 'tenantId' | 'scopeId';
20
+ export declare const CimdResourceScopes: GeneratedSchema<CimdResourceScopeKeys, CreateCimdResourceScope, CimdResourceScope, 'cimd_resource_scopes', 'cimd_resource_scope'>;
@@ -0,0 +1,25 @@
1
+ // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ import { z } from 'zod';
3
+ const createGuard = z.object({
4
+ tenantId: z.string().max(21).optional(),
5
+ scopeId: z.string().min(1).max(21),
6
+ });
7
+ const guard = z.object({
8
+ tenantId: z.string().max(21),
9
+ scopeId: z.string().min(1).max(21),
10
+ });
11
+ export const CimdResourceScopes = Object.freeze({
12
+ table: 'cimd_resource_scopes',
13
+ tableSingular: 'cimd_resource_scope',
14
+ fields: {
15
+ tenantId: 'tenant_id',
16
+ scopeId: 'scope_id',
17
+ },
18
+ fieldKeys: [
19
+ 'tenantId',
20
+ 'scopeId',
21
+ ],
22
+ createGuard,
23
+ guard,
24
+ updateGuard: guard.partial(),
25
+ });
@@ -0,0 +1,20 @@
1
+ import { GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ * The user scopes (permissions) that client ID metadata document (CIMD) clients of the tenant can request. Rows are an allowlist: an empty table allows nothing (deny-all), and an unrestricted state is not expressible.
4
+ *
5
+ * @remarks This is a type for database creation.
6
+ * @see {@link CimdUserScope} for the original type.
7
+ */
8
+ export type CreateCimdUserScope = {
9
+ tenantId?: string;
10
+ /** The unique UserScope enum value @see (@logto/core-kit/open-id.js) for more details */
11
+ userScope: string;
12
+ };
13
+ /** The user scopes (permissions) that client ID metadata document (CIMD) clients of the tenant can request. Rows are an allowlist: an empty table allows nothing (deny-all), and an unrestricted state is not expressible. */
14
+ export type CimdUserScope = {
15
+ tenantId: string;
16
+ /** The unique UserScope enum value @see (@logto/core-kit/open-id.js) for more details */
17
+ userScope: string;
18
+ };
19
+ export type CimdUserScopeKeys = 'tenantId' | 'userScope';
20
+ export declare const CimdUserScopes: GeneratedSchema<CimdUserScopeKeys, CreateCimdUserScope, CimdUserScope, 'cimd_user_scopes', 'cimd_user_scope'>;