@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
@@ -203,7 +203,7 @@ export var CustomJwtErrorCode;
203
203
  CustomJwtErrorCode["AccessDenied"] = "AccessDenied";
204
204
  /** General JWT customizer error,
205
205
  * this is the fallback custom jwt error code
206
- * for any internal error thrown by the JWT customizer (localVM, azure function, or CF worker).
206
+ * for any internal error thrown by the JWT customizer on any runtime.
207
207
  */
208
208
  CustomJwtErrorCode["General"] = "General";
209
209
  })(CustomJwtErrorCode || (CustomJwtErrorCode = {}));
@@ -28,8 +28,8 @@ export declare const accessTokenPayloadGuard: z.ZodObject<{
28
28
  aud: string | string[];
29
29
  sid?: string | undefined;
30
30
  scope?: string | undefined;
31
- sessionUid?: string | undefined;
32
31
  clientId?: string | undefined;
32
+ sessionUid?: string | undefined;
33
33
  expiresWithSession?: boolean | undefined;
34
34
  }, {
35
35
  grantId: string;
@@ -40,8 +40,8 @@ export declare const accessTokenPayloadGuard: z.ZodObject<{
40
40
  aud: string | string[];
41
41
  sid?: string | undefined;
42
42
  scope?: string | undefined;
43
- sessionUid?: string | undefined;
44
43
  clientId?: string | undefined;
44
+ sessionUid?: string | undefined;
45
45
  expiresWithSession?: boolean | undefined;
46
46
  }>;
47
47
  export type AccessTokenPayload = z.infer<typeof accessTokenPayloadGuard>;
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { NameIdFormat } from '../foundations/index.js';
2
+ import { NameIdFormat, type SamlAuthnRequestConfig } from '../foundations/index.js';
3
3
  export declare const samlApplicationCreateGuard: z.ZodObject<{
4
4
  name: z.ZodType<string, z.ZodTypeDef, string>;
5
5
  customData: z.ZodOptional<z.ZodOptional<z.ZodType<import("@withtyped/server/lib/types.js").JsonObject, z.ZodTypeDef, import("@withtyped/server/lib/types.js").JsonObject>>>;
@@ -16,6 +16,15 @@ export declare const samlApplicationCreateGuard: z.ZodObject<{
16
16
  encryptThenSign?: boolean | undefined;
17
17
  certificate?: string | undefined;
18
18
  } | null>>;
19
+ authnRequestConfig: z.ZodOptional<z.ZodType<{
20
+ forceAuthn?: boolean | undefined;
21
+ requireSignedAuthnRequests?: boolean | undefined;
22
+ signingCertificate?: string | undefined;
23
+ } | null, z.ZodTypeDef, {
24
+ forceAuthn?: boolean | undefined;
25
+ requireSignedAuthnRequests?: boolean | undefined;
26
+ signingCertificate?: string | undefined;
27
+ } | null>>;
19
28
  } & {
20
29
  nameIdFormat: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof NameIdFormat>>>;
21
30
  }, "strip", z.ZodTypeAny, {
@@ -31,6 +40,11 @@ export declare const samlApplicationCreateGuard: z.ZodObject<{
31
40
  encryptThenSign?: boolean | undefined;
32
41
  certificate?: string | undefined;
33
42
  } | null | undefined;
43
+ authnRequestConfig?: {
44
+ forceAuthn?: boolean | undefined;
45
+ requireSignedAuthnRequests?: boolean | undefined;
46
+ signingCertificate?: string | undefined;
47
+ } | null | undefined;
34
48
  }, {
35
49
  name: string;
36
50
  customData?: import("@withtyped/server/lib/types.js").JsonObject;
@@ -43,6 +57,11 @@ export declare const samlApplicationCreateGuard: z.ZodObject<{
43
57
  encryptThenSign?: boolean | undefined;
44
58
  certificate?: string | undefined;
45
59
  } | null | undefined;
60
+ authnRequestConfig?: {
61
+ forceAuthn?: boolean | undefined;
62
+ requireSignedAuthnRequests?: boolean | undefined;
63
+ signingCertificate?: string | undefined;
64
+ } | null | undefined;
46
65
  nameIdFormat?: NameIdFormat | undefined;
47
66
  }>;
48
67
  export type CreateSamlApplication = z.input<typeof samlApplicationCreateGuard>;
@@ -63,6 +82,15 @@ export declare const samlApplicationPatchGuard: z.ZodObject<{
63
82
  encryptThenSign?: boolean | undefined;
64
83
  certificate?: string | undefined;
65
84
  } | null>>;
85
+ authnRequestConfig: z.ZodOptional<z.ZodType<{
86
+ forceAuthn?: boolean | undefined;
87
+ requireSignedAuthnRequests?: boolean | undefined;
88
+ signingCertificate?: string | undefined;
89
+ } | null, z.ZodTypeDef, {
90
+ forceAuthn?: boolean | undefined;
91
+ requireSignedAuthnRequests?: boolean | undefined;
92
+ signingCertificate?: string | undefined;
93
+ } | null>>;
66
94
  } & {
67
95
  nameIdFormat: z.ZodOptional<z.ZodNativeEnum<typeof NameIdFormat>>;
68
96
  }, "strip", z.ZodTypeAny, {
@@ -78,6 +106,11 @@ export declare const samlApplicationPatchGuard: z.ZodObject<{
78
106
  encryptThenSign?: boolean | undefined;
79
107
  certificate?: string | undefined;
80
108
  } | null | undefined;
109
+ authnRequestConfig?: {
110
+ forceAuthn?: boolean | undefined;
111
+ requireSignedAuthnRequests?: boolean | undefined;
112
+ signingCertificate?: string | undefined;
113
+ } | null | undefined;
81
114
  nameIdFormat?: NameIdFormat | undefined;
82
115
  }, {
83
116
  name?: string | undefined;
@@ -92,6 +125,11 @@ export declare const samlApplicationPatchGuard: z.ZodObject<{
92
125
  encryptThenSign?: boolean | undefined;
93
126
  certificate?: string | undefined;
94
127
  } | null | undefined;
128
+ authnRequestConfig?: {
129
+ forceAuthn?: boolean | undefined;
130
+ requireSignedAuthnRequests?: boolean | undefined;
131
+ signingCertificate?: string | undefined;
132
+ } | null | undefined;
95
133
  nameIdFormat?: NameIdFormat | undefined;
96
134
  }>;
97
135
  export type PatchSamlApplication = z.infer<typeof samlApplicationPatchGuard>;
@@ -117,6 +155,15 @@ export declare const samlApplicationResponseGuard: z.ZodObject<{
117
155
  encryptThenSign?: boolean | undefined;
118
156
  certificate?: string | undefined;
119
157
  } | null>;
158
+ authnRequestConfig: z.ZodType<{
159
+ forceAuthn?: boolean | undefined;
160
+ requireSignedAuthnRequests?: boolean | undefined;
161
+ signingCertificate?: string | undefined;
162
+ } | null, z.ZodTypeDef, {
163
+ forceAuthn?: boolean | undefined;
164
+ requireSignedAuthnRequests?: boolean | undefined;
165
+ signingCertificate?: string | undefined;
166
+ } | null>;
120
167
  } & {
121
168
  nameIdFormat: z.ZodNativeEnum<typeof NameIdFormat>;
122
169
  }, "strip", z.ZodTypeAny, {
@@ -133,6 +180,7 @@ export declare const samlApplicationResponseGuard: z.ZodObject<{
133
180
  entityId: string | null;
134
181
  acsUrl: import("../foundations/index.js").SamlAcsUrl | null;
135
182
  encryption: import("../foundations/index.js").SamlEncryption | null;
183
+ authnRequestConfig: SamlAuthnRequestConfig | null;
136
184
  nameIdFormat: NameIdFormat;
137
185
  }, {
138
186
  type: import("../index.js").ApplicationType;
@@ -148,6 +196,7 @@ export declare const samlApplicationResponseGuard: z.ZodObject<{
148
196
  entityId: string | null;
149
197
  acsUrl: import("../foundations/index.js").SamlAcsUrl | null;
150
198
  encryption: import("../foundations/index.js").SamlEncryption | null;
199
+ authnRequestConfig: SamlAuthnRequestConfig | null;
151
200
  nameIdFormat: NameIdFormat;
152
201
  }>;
153
202
  export type SamlApplicationResponse = z.infer<typeof samlApplicationResponseGuard>;
@@ -238,4 +287,9 @@ export declare const samlApplicationSecretResponseGuard: z.ZodObject<Omit<{
238
287
  };
239
288
  }>;
240
289
  export type SamlApplicationSecretResponse = z.infer<typeof samlApplicationSecretResponseGuard>;
290
+ /**
291
+ * Whether a SAML application forces fresh authentication. Forcing is the default; only an explicit
292
+ * `forceAuthn: false` lets the application reuse an existing session.
293
+ */
294
+ export declare const isSamlForceAuthnEnabled: (config?: SamlAuthnRequestConfig | null) => boolean;
241
295
  export {};
@@ -2,13 +2,14 @@ import { z } from 'zod';
2
2
  import { Applications } from '../db-entries/application.js';
3
3
  import { SamlApplicationConfigs } from '../db-entries/saml-application-config.js';
4
4
  import { SamlApplicationSecrets } from '../db-entries/saml-application-secret.js';
5
- import { nameIdFormatGuard, NameIdFormat } from '../foundations/index.js';
5
+ import { nameIdFormatGuard, NameIdFormat, } from '../foundations/index.js';
6
6
  import { applicationCreateGuard, applicationPatchGuard } from './application.js';
7
7
  const samlAppConfigGuard = SamlApplicationConfigs.guard.pick({
8
8
  attributeMapping: true,
9
9
  entityId: true,
10
10
  acsUrl: true,
11
11
  encryption: true,
12
+ authnRequestConfig: true,
12
13
  nameIdFormat: true,
13
14
  });
14
15
  export const samlApplicationCreateGuard = applicationCreateGuard
@@ -61,3 +62,8 @@ export const samlApplicationSecretResponseGuard = SamlApplicationSecrets.guard
61
62
  .extend({
62
63
  fingerprints: certificateFingerprintsGuard,
63
64
  });
65
+ /**
66
+ * Whether a SAML application forces fresh authentication. Forcing is the default; only an explicit
67
+ * `forceAuthn: false` lets the application reuse an existing session.
68
+ */
69
+ export const isSamlForceAuthnEnabled = (config) => config?.forceAuthn !== false;
@@ -1,5 +1,18 @@
1
+ /**
2
+ * Types of `service_logs` rows. The rows are written by the Logto Cloud service; some members
3
+ * are cloud-only concepts kept here so every type shares this single definition.
4
+ */
1
5
  export declare enum ServiceLogType {
2
6
  SendEmail = "sendEmail",
3
7
  SendSms = "sendSms",
4
- FetchCustomJwt = "fetchCustomJwt"
8
+ /** Cloud-only: custom JWT worker invocations. */
9
+ FetchCustomJwt = "fetchCustomJwt",
10
+ /**
11
+ * Cloud-only: a hosted-email send that failed at the provider; the payload carries the
12
+ * normalized provider error. Deliberately distinct from {@link ServiceLogType.SendEmail}:
13
+ * usage counting matches on that exact type, so failed sends never count toward email usage.
14
+ */
15
+ SendEmailFailed = "sendEmailFailed",
16
+ /** Cloud-only: an Actions script run on the script runner. Mirrors the `runAction` entry. */
17
+ RunAction = "runAction"
5
18
  }
@@ -1,6 +1,19 @@
1
+ /**
2
+ * Types of `service_logs` rows. The rows are written by the Logto Cloud service; some members
3
+ * are cloud-only concepts kept here so every type shares this single definition.
4
+ */
1
5
  export var ServiceLogType;
2
6
  (function (ServiceLogType) {
3
7
  ServiceLogType["SendEmail"] = "sendEmail";
4
8
  ServiceLogType["SendSms"] = "sendSms";
9
+ /** Cloud-only: custom JWT worker invocations. */
5
10
  ServiceLogType["FetchCustomJwt"] = "fetchCustomJwt";
11
+ /**
12
+ * Cloud-only: a hosted-email send that failed at the provider; the payload carries the
13
+ * normalized provider error. Deliberately distinct from {@link ServiceLogType.SendEmail}:
14
+ * usage counting matches on that exact type, so failed sends never count toward email usage.
15
+ */
16
+ ServiceLogType["SendEmailFailed"] = "sendEmailFailed";
17
+ /** Cloud-only: an Actions script run on the script runner. Mirrors the `runAction` entry. */
18
+ ServiceLogType["RunAction"] = "runAction";
6
19
  })(ServiceLogType || (ServiceLogType = {}));
@@ -32,6 +32,8 @@ export type FullSignInExperience = Omit<SignInExperience, 'emailBlocklistPolicy'
32
32
  captchaConfig?: {
33
33
  type: CaptchaType;
34
34
  siteKey: string;
35
+ /** The Cap Standalone instance URL, only available for {@link CaptchaType.Cap}. */
36
+ endpoint?: string;
35
37
  domain?: string;
36
38
  mode?: RecaptchaEnterpriseMode;
37
39
  };
@@ -71,10 +73,10 @@ export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
71
73
  hideLogtoBranding: z.ZodType<boolean, z.ZodTypeDef, boolean>;
72
74
  languageInfo: z.ZodType<{
73
75
  autoDetect: boolean;
74
- fallbackLanguage: "af-ZA" | "am-ET" | "ar" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "cs" | "cs-CZ" | "cx-PH" | "cy-GB" | "da-DK" | "de" | "de-DE" | "el-GR" | "en" | "en-GB" | "en-US" | "eo-EO" | "es" | "es-ES" | "es-419" | "et-EE" | "eu-ES" | "fa-IR" | "ff-NG" | "fi" | "fi-FI" | "fo-FO" | "fr" | "fr-CA" | "fr-FR" | "fy-NL" | "ga-IE" | "gl-ES" | "gn-PY" | "gu-IN" | "ha-NG" | "he-IL" | "hi-IN" | "hr-HR" | "ht-HT" | "hu-HU" | "hy-AM" | "id-ID" | "ik-US" | "is-IS" | "it" | "it-IT" | "iu-CA" | "ja" | "ja-JP" | "ja-KS" | "jv-ID" | "ka-GE" | "kk-KZ" | "km-KH" | "kn-IN" | "ko" | "ko-KR" | "ku-TR" | "ky-KG" | "lo-LA" | "lt-LT" | "lv-LV" | "mg-MG" | "mk-MK" | "ml-IN" | "mn-MN" | "mr-IN" | "ms-MY" | "mt-MT" | "my-MM" | "nb-NO" | "ne-NP" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "or-IN" | "pa-IN" | "pl-PL" | "ps-AF" | "pt" | "pt-BR" | "pt-PT" | "ro-RO" | "ru" | "ru-RU" | "rw-RW" | "sc-IT" | "si-LK" | "sk-SK" | "sl-SI" | "sn-ZW" | "sq-AL" | "sr-RS" | "sv" | "sv-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "th" | "th-TH" | "tl-PH" | "tr" | "tr-TR" | "tt-RU" | "tz-MA" | "uk-UA" | "ur-PK" | "uz-UZ" | "vi-VN" | "zh" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-TW" | "zz-TR";
76
+ fallbackLanguage: "af-ZA" | "am-ET" | "ar" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "cs" | "cs-CZ" | "cx-PH" | "cy-GB" | "da-DK" | "de" | "de-DE" | "el-GR" | "en" | "en-GB" | "en-US" | "eo-EO" | "es" | "es-ES" | "es-419" | "es-MX" | "et-EE" | "eu-ES" | "fa-IR" | "ff-NG" | "fi" | "fi-FI" | "fo-FO" | "fr" | "fr-CA" | "fr-FR" | "fy-NL" | "ga-IE" | "gl-ES" | "gn-PY" | "gu-IN" | "ha-NG" | "he-IL" | "hi-IN" | "hr-HR" | "ht-HT" | "hu-HU" | "hy-AM" | "id-ID" | "ik-US" | "is-IS" | "it" | "it-IT" | "iu-CA" | "ja" | "ja-JP" | "ja-KS" | "jv-ID" | "ka-GE" | "kk-KZ" | "km-KH" | "kn-IN" | "ko" | "ko-KR" | "ku-TR" | "ky-KG" | "lo-LA" | "lt-LT" | "lv-LV" | "mg-MG" | "mk-MK" | "ml-IN" | "mn-MN" | "mr-IN" | "ms-MY" | "mt-MT" | "my-MM" | "nb-NO" | "ne-NP" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "or-IN" | "pa-IN" | "pl-PL" | "ps-AF" | "pt" | "pt-BR" | "pt-PT" | "ro-RO" | "ru" | "ru-RU" | "rw-RW" | "sc-IT" | "si-LK" | "sk-SK" | "sl-SI" | "sn-ZW" | "sq-AL" | "sr-RS" | "sv" | "sv-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "th" | "th-TH" | "tl-PH" | "tr" | "tr-TR" | "tt-RU" | "tz-MA" | "uk-UA" | "ur-PK" | "uz-UZ" | "vi-VN" | "zh" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-TW" | "zz-TR";
75
77
  }, z.ZodTypeDef, {
76
78
  autoDetect: boolean;
77
- fallbackLanguage: "af-ZA" | "am-ET" | "ar" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "cs" | "cs-CZ" | "cx-PH" | "cy-GB" | "da-DK" | "de" | "de-DE" | "el-GR" | "en" | "en-GB" | "en-US" | "eo-EO" | "es" | "es-ES" | "es-419" | "et-EE" | "eu-ES" | "fa-IR" | "ff-NG" | "fi" | "fi-FI" | "fo-FO" | "fr" | "fr-CA" | "fr-FR" | "fy-NL" | "ga-IE" | "gl-ES" | "gn-PY" | "gu-IN" | "ha-NG" | "he-IL" | "hi-IN" | "hr-HR" | "ht-HT" | "hu-HU" | "hy-AM" | "id-ID" | "ik-US" | "is-IS" | "it" | "it-IT" | "iu-CA" | "ja" | "ja-JP" | "ja-KS" | "jv-ID" | "ka-GE" | "kk-KZ" | "km-KH" | "kn-IN" | "ko" | "ko-KR" | "ku-TR" | "ky-KG" | "lo-LA" | "lt-LT" | "lv-LV" | "mg-MG" | "mk-MK" | "ml-IN" | "mn-MN" | "mr-IN" | "ms-MY" | "mt-MT" | "my-MM" | "nb-NO" | "ne-NP" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "or-IN" | "pa-IN" | "pl-PL" | "ps-AF" | "pt" | "pt-BR" | "pt-PT" | "ro-RO" | "ru" | "ru-RU" | "rw-RW" | "sc-IT" | "si-LK" | "sk-SK" | "sl-SI" | "sn-ZW" | "sq-AL" | "sr-RS" | "sv" | "sv-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "th" | "th-TH" | "tl-PH" | "tr" | "tr-TR" | "tt-RU" | "tz-MA" | "uk-UA" | "ur-PK" | "uz-UZ" | "vi-VN" | "zh" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-TW" | "zz-TR";
79
+ fallbackLanguage: "af-ZA" | "am-ET" | "ar" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "cs" | "cs-CZ" | "cx-PH" | "cy-GB" | "da-DK" | "de" | "de-DE" | "el-GR" | "en" | "en-GB" | "en-US" | "eo-EO" | "es" | "es-ES" | "es-419" | "es-MX" | "et-EE" | "eu-ES" | "fa-IR" | "ff-NG" | "fi" | "fi-FI" | "fo-FO" | "fr" | "fr-CA" | "fr-FR" | "fy-NL" | "ga-IE" | "gl-ES" | "gn-PY" | "gu-IN" | "ha-NG" | "he-IL" | "hi-IN" | "hr-HR" | "ht-HT" | "hu-HU" | "hy-AM" | "id-ID" | "ik-US" | "is-IS" | "it" | "it-IT" | "iu-CA" | "ja" | "ja-JP" | "ja-KS" | "jv-ID" | "ka-GE" | "kk-KZ" | "km-KH" | "kn-IN" | "ko" | "ko-KR" | "ku-TR" | "ky-KG" | "lo-LA" | "lt-LT" | "lv-LV" | "mg-MG" | "mk-MK" | "ml-IN" | "mn-MN" | "mr-IN" | "ms-MY" | "mt-MT" | "my-MM" | "nb-NO" | "ne-NP" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "or-IN" | "pa-IN" | "pl-PL" | "ps-AF" | "pt" | "pt-BR" | "pt-PT" | "ro-RO" | "ru" | "ru-RU" | "rw-RW" | "sc-IT" | "si-LK" | "sk-SK" | "sl-SI" | "sn-ZW" | "sq-AL" | "sr-RS" | "sv" | "sv-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "th" | "th-TH" | "tl-PH" | "tr" | "tr-TR" | "tt-RU" | "tz-MA" | "uk-UA" | "ur-PK" | "uz-UZ" | "vi-VN" | "zh" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-TW" | "zz-TR";
78
80
  }>;
79
81
  termsOfUseUrl: z.ZodType<string | null, z.ZodTypeDef, string | null>;
80
82
  privacyPolicyUrl: z.ZodType<string | null, z.ZodTypeDef, string | null>;
@@ -139,6 +141,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
139
141
  }>;
140
142
  mfa: z.ZodType<import("../foundations/jsonb-types/sign-in-experience.js").Mfa, z.ZodTypeDef, import("../foundations/jsonb-types/sign-in-experience.js").Mfa>;
141
143
  adaptiveMfa: z.ZodType<import("../foundations/jsonb-types/sign-in-experience.js").AdaptiveMfa, z.ZodTypeDef, import("../foundations/jsonb-types/sign-in-experience.js").AdaptiveMfa>;
144
+ trustedDevice: z.ZodType<import("../foundations/jsonb-types/sign-in-experience.js").TrustedDevicePolicy, z.ZodTypeDef, import("../foundations/jsonb-types/sign-in-experience.js").TrustedDevicePolicy>;
142
145
  singleSignOnEnabled: z.ZodType<boolean, z.ZodTypeDef, boolean>;
143
146
  supportEmail: z.ZodType<string | null, z.ZodTypeDef, string | null>;
144
147
  supportWebsiteUrl: z.ZodType<string | null, z.ZodTypeDef, string | null>;
@@ -393,6 +396,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
393
396
  es?: string | undefined;
394
397
  "es-ES"?: string | undefined;
395
398
  "es-419"?: string | undefined;
399
+ "es-MX"?: string | undefined;
396
400
  "et-EE"?: string | undefined;
397
401
  "eu-ES"?: string | undefined;
398
402
  "fa-IR"?: string | undefined;
@@ -534,6 +538,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
534
538
  es?: string | undefined;
535
539
  "es-ES"?: string | undefined;
536
540
  "es-419"?: string | undefined;
541
+ "es-MX"?: string | undefined;
537
542
  "et-EE"?: string | undefined;
538
543
  "eu-ES"?: string | undefined;
539
544
  "fa-IR"?: string | undefined;
@@ -680,15 +685,15 @@ export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
680
685
  clientId: z.ZodString;
681
686
  connectorId: z.ZodString;
682
687
  }, "strip", z.ZodTypeAny, {
683
- connectorId: string;
684
688
  clientId: string;
689
+ connectorId: string;
685
690
  isEnabled?: boolean | undefined;
686
691
  autoSelect?: boolean | undefined;
687
692
  closeOnTapOutside?: boolean | undefined;
688
693
  itpSupport?: boolean | undefined;
689
694
  }, {
690
- connectorId: string;
691
695
  clientId: string;
696
+ connectorId: string;
692
697
  isEnabled?: boolean | undefined;
693
698
  autoSelect?: boolean | undefined;
694
699
  closeOnTapOutside?: boolean | undefined;
@@ -697,6 +702,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
697
702
  captchaConfig: z.ZodOptional<z.ZodObject<{
698
703
  type: z.ZodNativeEnum<typeof CaptchaType>;
699
704
  siteKey: z.ZodString;
705
+ endpoint: z.ZodOptional<z.ZodString>;
700
706
  domain: z.ZodOptional<z.ZodString>;
701
707
  mode: z.ZodOptional<z.ZodNativeEnum<typeof RecaptchaEnterpriseMode>>;
702
708
  }, "strip", z.ZodTypeAny, {
@@ -704,11 +710,13 @@ export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
704
710
  siteKey: string;
705
711
  domain?: string | undefined;
706
712
  mode?: RecaptchaEnterpriseMode | undefined;
713
+ endpoint?: string | undefined;
707
714
  }, {
708
715
  type: CaptchaType;
709
716
  siteKey: string;
710
717
  domain?: string | undefined;
711
718
  mode?: RecaptchaEnterpriseMode | undefined;
719
+ endpoint?: string | undefined;
712
720
  }>>;
713
721
  customProfileFields: z.ZodArray<import("../index.js").Guard<CustomProfileField>, "many">;
714
722
  customProfileFieldCatalog: z.ZodOptional<z.ZodArray<import("../index.js").Guard<CustomProfileField>, "many">>;
@@ -716,6 +724,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
716
724
  id: string;
717
725
  tenantId: string;
718
726
  mfa: import("../foundations/jsonb-types/sign-in-experience.js").Mfa;
727
+ trustedDevice: import("../foundations/jsonb-types/sign-in-experience.js").TrustedDevicePolicy;
719
728
  customCss: string | null;
720
729
  color: import("../foundations/jsonb-types/sign-in-experience.js").Color;
721
730
  branding: import("../foundations/jsonb-types/sign-in-experience.js").Branding;
@@ -777,6 +786,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
777
786
  es?: string | undefined;
778
787
  "es-ES"?: string | undefined;
779
788
  "es-419"?: string | undefined;
789
+ "es-MX"?: string | undefined;
780
790
  "et-EE"?: string | undefined;
781
791
  "eu-ES"?: string | undefined;
782
792
  "fa-IR"?: string | undefined;
@@ -900,8 +910,8 @@ export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
900
910
  isDevelopmentTenant: boolean;
901
911
  customProfileFields: CustomProfileField[];
902
912
  googleOneTap?: {
903
- connectorId: string;
904
913
  clientId: string;
914
+ connectorId: string;
905
915
  isEnabled?: boolean | undefined;
906
916
  autoSelect?: boolean | undefined;
907
917
  closeOnTapOutside?: boolean | undefined;
@@ -912,12 +922,14 @@ export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
912
922
  siteKey: string;
913
923
  domain?: string | undefined;
914
924
  mode?: RecaptchaEnterpriseMode | undefined;
925
+ endpoint?: string | undefined;
915
926
  } | undefined;
916
927
  customProfileFieldCatalog?: CustomProfileField[] | undefined;
917
928
  }, {
918
929
  id: string;
919
930
  tenantId: string;
920
931
  mfa: import("../foundations/jsonb-types/sign-in-experience.js").Mfa;
932
+ trustedDevice: import("../foundations/jsonb-types/sign-in-experience.js").TrustedDevicePolicy;
921
933
  customCss: string | null;
922
934
  color: import("../foundations/jsonb-types/sign-in-experience.js").Color;
923
935
  branding: import("../foundations/jsonb-types/sign-in-experience.js").Branding;
@@ -979,6 +991,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
979
991
  es?: string | undefined;
980
992
  "es-ES"?: string | undefined;
981
993
  "es-419"?: string | undefined;
994
+ "es-MX"?: string | undefined;
982
995
  "et-EE"?: string | undefined;
983
996
  "eu-ES"?: string | undefined;
984
997
  "fa-IR"?: string | undefined;
@@ -1102,8 +1115,8 @@ export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
1102
1115
  isDevelopmentTenant: boolean;
1103
1116
  customProfileFields: CustomProfileField[];
1104
1117
  googleOneTap?: {
1105
- connectorId: string;
1106
1118
  clientId: string;
1119
+ connectorId: string;
1107
1120
  isEnabled?: boolean | undefined;
1108
1121
  autoSelect?: boolean | undefined;
1109
1122
  closeOnTapOutside?: boolean | undefined;
@@ -1114,6 +1127,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
1114
1127
  siteKey: string;
1115
1128
  domain?: string | undefined;
1116
1129
  mode?: RecaptchaEnterpriseMode | undefined;
1130
+ endpoint?: string | undefined;
1117
1131
  } | undefined;
1118
1132
  customProfileFieldCatalog?: CustomProfileField[] | undefined;
1119
1133
  }>;
@@ -25,6 +25,7 @@ export const fullSignInExperienceGuard = SignInExperiences.guard
25
25
  .object({
26
26
  type: z.nativeEnum(CaptchaType),
27
27
  siteKey: z.string(),
28
+ endpoint: z.string().optional(),
28
29
  domain: z.string().optional(),
29
30
  mode: z.nativeEnum(RecaptchaEnterpriseMode).optional(),
30
31
  })
@@ -1,6 +1,7 @@
1
1
  import { type LocalePhrase } from '@logto/phrases-experience';
2
2
  import { type SignInExperience } from '../db-entries/index.js';
3
3
  import { type FullSignInExperience } from './sign-in-experience.js';
4
+ import { type Theme } from './theme.js';
4
5
  /**
5
6
  * The server-side rendering data type for **experience**.
6
7
  */
@@ -9,6 +10,7 @@ export type SsrData = {
9
10
  appId?: string;
10
11
  organizationId?: string;
11
12
  uiLocales?: string;
13
+ theme?: Theme;
12
14
  data: FullSignInExperience;
13
15
  };
14
16
  phrases: {
@@ -48,8 +48,8 @@ export declare const storageProviderDataGuard: z.ZodDiscriminatedUnion<"provider
48
48
  accessKeyId: string;
49
49
  accessSecretKey: string;
50
50
  region?: string | undefined;
51
- publicUrl?: string | undefined;
52
51
  endpoint?: string | undefined;
52
+ publicUrl?: string | undefined;
53
53
  forcePathStyle?: boolean | undefined;
54
54
  }, {
55
55
  provider: StorageProvider.S3Storage;
@@ -57,8 +57,8 @@ export declare const storageProviderDataGuard: z.ZodDiscriminatedUnion<"provider
57
57
  accessKeyId: string;
58
58
  accessSecretKey: string;
59
59
  region?: string | undefined;
60
- publicUrl?: string | undefined;
61
60
  endpoint?: string | undefined;
61
+ publicUrl?: string | undefined;
62
62
  forcePathStyle?: boolean | undefined;
63
63
  }>, z.ZodObject<{
64
64
  publicUrl: z.ZodOptional<z.ZodString>;
@@ -198,14 +198,14 @@ export declare const demoSocialDataGuard: z.ZodArray<z.ZodObject<{
198
198
  }, "strip", z.ZodTypeAny, {
199
199
  name: string;
200
200
  logo: string;
201
- logoDark: string;
202
201
  clientId: string;
202
+ logoDark: string;
203
203
  provider: DemoSocialProvider;
204
204
  }, {
205
205
  name: string;
206
206
  logo: string;
207
- logoDark: string;
208
207
  clientId: string;
208
+ logoDark: string;
209
209
  provider: DemoSocialProvider;
210
210
  }>, "many">;
211
211
  export type DemoSocialData = z.infer<typeof demoSocialDataGuard>;
@@ -292,8 +292,60 @@ export type CloudflareType = {
292
292
  export declare const cloudflareGuard: Readonly<{
293
293
  [key in CloudflareKey]: ZodType<CloudflareType[key]>;
294
294
  }>;
295
- export type SystemKey = AlterationStateKey | StorageProviderKey | DemoSocialKey | CloudflareKey | EmailServiceProviderKey;
296
- export type SystemType = AlterationStateType | StorageProviderType | DemoSocialType | CloudflareType | EmailServiceProviderType;
297
- export type SystemGuard = typeof alterationStateGuard & typeof storageProviderGuard & typeof demoSocialGuard & typeof cloudflareGuard & typeof emailServiceProviderGuard;
295
+ /**
296
+ * The license key installed on a self-hosted instance, stored verbatim so it can be re-verified on
297
+ * every read and re-signed on refresh. The `systems` table is global, so one deployment installs
298
+ * one license no matter how many instances share the database.
299
+ */
300
+ export declare const installedLicenseGuard: z.ZodObject<{
301
+ /** The raw Ed25519-signed license key JWT, exactly as it was installed. */
302
+ jwt: z.ZodString;
303
+ /** When the key was installed, as an ISO 8601 timestamp. */
304
+ installedAt: z.ZodString;
305
+ }, "strip", z.ZodTypeAny, {
306
+ jwt: string;
307
+ installedAt: string;
308
+ }, {
309
+ jwt: string;
310
+ installedAt: string;
311
+ }>;
312
+ export type InstalledLicense = z.infer<typeof installedLicenseGuard>;
313
+ export declare enum LicenseKey {
314
+ License = "license",
315
+ LicenseRefreshState = "licenseRefreshState",
316
+ LicenseDeploymentId = "licenseDeploymentId"
317
+ }
318
+ export type LicenseType = {
319
+ [LicenseKey.License]: InstalledLicense;
320
+ [LicenseKey.LicenseRefreshState]: LicenseRefreshState;
321
+ [LicenseKey.LicenseDeploymentId]: LicenseDeploymentId;
322
+ };
323
+ /** The state shared by all instances while they lazily refresh the installed license. */
324
+ export declare const licenseRefreshStateGuard: z.ZodObject<{
325
+ /** The last successful refresh, or the `iat` of the installed key. */
326
+ lastRefreshedAt: z.ZodString;
327
+ /** The last refresh attempt. Absent before the first read after installation. */
328
+ lastAttemptAt: z.ZodOptional<z.ZodString>;
329
+ /** The refusal reason returned by the license service, if the last attempt was refused. */
330
+ refusalReason: z.ZodOptional<z.ZodString>;
331
+ }, "strip", z.ZodTypeAny, {
332
+ lastRefreshedAt: string;
333
+ lastAttemptAt?: string | undefined;
334
+ refusalReason?: string | undefined;
335
+ }, {
336
+ lastRefreshedAt: string;
337
+ lastAttemptAt?: string | undefined;
338
+ refusalReason?: string | undefined;
339
+ }>;
340
+ export type LicenseRefreshState = z.infer<typeof licenseRefreshStateGuard>;
341
+ /** The stable identifier shared by every Core instance using this `systems` table. */
342
+ export declare const licenseDeploymentIdGuard: z.ZodString;
343
+ export type LicenseDeploymentId = z.infer<typeof licenseDeploymentIdGuard>;
344
+ export declare const licenseGuard: Readonly<{
345
+ [key in LicenseKey]: ZodType<LicenseType[key]>;
346
+ }>;
347
+ export type SystemKey = AlterationStateKey | StorageProviderKey | DemoSocialKey | CloudflareKey | EmailServiceProviderKey | LicenseKey;
348
+ export type SystemType = AlterationStateType | StorageProviderType | DemoSocialType | CloudflareType | EmailServiceProviderType | LicenseType;
349
+ export type SystemGuard = typeof alterationStateGuard & typeof storageProviderGuard & typeof demoSocialGuard & typeof cloudflareGuard & typeof emailServiceProviderGuard & typeof licenseGuard;
298
350
  export declare const systemKeys: readonly SystemKey[];
299
351
  export declare const systemGuards: SystemGuard;
@@ -155,12 +155,47 @@ export const cloudflareGuard = Object.freeze({
155
155
  [CloudflareKey.ProtectedAppHostnameProvider]: hostnameProviderDataGuard,
156
156
  [CloudflareKey.CustomJwtWorkerConfig]: customJwtWorkerConfigGuard,
157
157
  });
158
+ // Self-hosted license
159
+ /**
160
+ * The license key installed on a self-hosted instance, stored verbatim so it can be re-verified on
161
+ * every read and re-signed on refresh. The `systems` table is global, so one deployment installs
162
+ * one license no matter how many instances share the database.
163
+ */
164
+ export const installedLicenseGuard = z.object({
165
+ /** The raw Ed25519-signed license key JWT, exactly as it was installed. */
166
+ jwt: z.string(),
167
+ /** When the key was installed, as an ISO 8601 timestamp. */
168
+ installedAt: z.string(),
169
+ });
170
+ export var LicenseKey;
171
+ (function (LicenseKey) {
172
+ LicenseKey["License"] = "license";
173
+ LicenseKey["LicenseRefreshState"] = "licenseRefreshState";
174
+ LicenseKey["LicenseDeploymentId"] = "licenseDeploymentId";
175
+ })(LicenseKey || (LicenseKey = {}));
176
+ /** The state shared by all instances while they lazily refresh the installed license. */
177
+ export const licenseRefreshStateGuard = z.object({
178
+ /** The last successful refresh, or the `iat` of the installed key. */
179
+ lastRefreshedAt: z.string(),
180
+ /** The last refresh attempt. Absent before the first read after installation. */
181
+ lastAttemptAt: z.string().optional(),
182
+ /** The refusal reason returned by the license service, if the last attempt was refused. */
183
+ refusalReason: z.string().optional(),
184
+ });
185
+ /** The stable identifier shared by every Core instance using this `systems` table. */
186
+ export const licenseDeploymentIdGuard = z.string().min(1);
187
+ export const licenseGuard = Object.freeze({
188
+ [LicenseKey.License]: installedLicenseGuard,
189
+ [LicenseKey.LicenseRefreshState]: licenseRefreshStateGuard,
190
+ [LicenseKey.LicenseDeploymentId]: licenseDeploymentIdGuard,
191
+ });
158
192
  export const systemKeys = Object.freeze([
159
193
  ...Object.values(AlterationStateKey),
160
194
  ...Object.values(StorageProviderKey),
161
195
  ...Object.values(DemoSocialKey),
162
196
  ...Object.values(CloudflareKey),
163
197
  ...Object.values(EmailServiceProviderKey),
198
+ ...Object.values(LicenseKey),
164
199
  ]);
165
200
  export const systemGuards = Object.freeze({
166
201
  ...alterationStateGuard,
@@ -168,4 +203,5 @@ export const systemGuards = Object.freeze({
168
203
  ...demoSocialGuard,
169
204
  ...cloudflareGuard,
170
205
  ...emailServiceProviderGuard,
206
+ ...licenseGuard,
171
207
  });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { LicenseKey, systemGuards, systemKeys } from './system.js';
3
+ describe('license system entries', () => {
4
+ it('registers the license key, so the CLI accepts it', () => {
5
+ expect(systemKeys).toContain(LicenseKey.License);
6
+ expect(systemKeys).toContain(LicenseKey.LicenseRefreshState);
7
+ expect(systemKeys).toContain(LicenseKey.LicenseDeploymentId);
8
+ });
9
+ it('parses an installed license row', () => {
10
+ const value = { jwt: 'header.payload.signature', installedAt: '2026-01-01T00:00:00.000Z' };
11
+ expect(systemGuards[LicenseKey.License].parse(value)).toEqual(value);
12
+ });
13
+ it('rejects an installed license row without a key', () => {
14
+ expect(systemGuards[LicenseKey.License].safeParse({ installedAt: '2026-01-01T00:00:00.000Z' })
15
+ .success).toBe(false);
16
+ });
17
+ it('parses refresh state and a deployment ID', () => {
18
+ const state = {
19
+ lastRefreshedAt: '2026-01-01T00:00:00.000Z',
20
+ lastAttemptAt: '2026-01-02T00:00:00.000Z',
21
+ refusalReason: 'canceled',
22
+ };
23
+ expect(systemGuards[LicenseKey.LicenseRefreshState].parse(state)).toEqual(state);
24
+ expect(systemGuards[LicenseKey.LicenseDeploymentId].parse('deployment_123')).toBe('deployment_123');
25
+ });
26
+ });