@logto/schemas 1.40.1 → 1.42.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 (111) hide show
  1. package/alterations/1.41.0-1779864280-add-password-expiration-policy.ts +23 -0
  2. package/alterations/1.41.0-1779864281-add-is-password-expired-to-users.ts +18 -0
  3. package/alterations/1.41.0-1780358400-drop-oidc-model-instances-legacy-grant-id-index.ts +25 -0
  4. package/alterations/1.41.0-1780381219-add-username-policy.ts +41 -0
  5. package/alterations/1.41.0-1780643665-set-sign-up-profile-fields-default.ts +20 -0
  6. package/alterations/1.41.0-1780906060-add-verification-code-policy.ts +19 -0
  7. package/alterations/1.41.0-1781689400-add-sentinel-activities-created-at-index.ts +25 -0
  8. package/alterations/1.41.0-1782354362-set-admin-account-center-profile-fields.ts +28 -0
  9. package/alterations/1.41.0-1782375106-cover-service-logs-tenant-type-index-with-created-at.ts +36 -0
  10. package/alterations/1.42.0-1783916980-add-domain-verification-files.ts +20 -0
  11. package/alterations/1.42.0-1784619793-add-service-logs-created-at-index.ts +33 -0
  12. package/alterations/1.42.0-1784620000-add-saml-sso-connector-signing-keys-table.ts +38 -0
  13. package/alterations/utils/1704934999-tables.ts +22 -1
  14. package/alterations-js/1.41.0-1779864280-add-password-expiration-policy.js +19 -0
  15. package/alterations-js/1.41.0-1779864281-add-is-password-expired-to-users.js +14 -0
  16. package/alterations-js/1.41.0-1780358400-drop-oidc-model-instances-legacy-grant-id-index.js +21 -0
  17. package/alterations-js/1.41.0-1780381219-add-username-policy.js +37 -0
  18. package/alterations-js/1.41.0-1780643665-set-sign-up-profile-fields-default.js +16 -0
  19. package/alterations-js/1.41.0-1780906060-add-verification-code-policy.js +15 -0
  20. package/alterations-js/1.41.0-1781689400-add-sentinel-activities-created-at-index.js +21 -0
  21. package/alterations-js/1.41.0-1782354362-set-admin-account-center-profile-fields.js +23 -0
  22. package/alterations-js/1.41.0-1782375106-cover-service-logs-tenant-type-index-with-created-at.js +32 -0
  23. package/alterations-js/1.42.0-1783916980-add-domain-verification-files.js +16 -0
  24. package/alterations-js/1.42.0-1784619793-add-service-logs-created-at-index.js +29 -0
  25. package/alterations-js/1.42.0-1784620000-add-saml-sso-connector-signing-keys-table.js +33 -0
  26. package/alterations-js/utils/1704934999-tables.js +19 -1
  27. package/lib/consts/experience.d.ts +3 -0
  28. package/lib/consts/experience.js +3 -0
  29. package/lib/consts/index.d.ts +2 -0
  30. package/lib/consts/index.js +2 -0
  31. package/lib/consts/message-rate-limit.d.ts +65 -0
  32. package/lib/consts/message-rate-limit.js +29 -0
  33. package/lib/consts/message-rate-limit.test.d.ts +1 -0
  34. package/lib/consts/message-rate-limit.test.js +20 -0
  35. package/lib/consts/verification-code.d.ts +10 -0
  36. package/lib/consts/verification-code.js +10 -0
  37. package/lib/db-entries/domain.d.ts +4 -2
  38. package/lib/db-entries/domain.js +5 -1
  39. package/lib/db-entries/index.d.ts +1 -0
  40. package/lib/db-entries/index.js +1 -0
  41. package/lib/db-entries/saml-sso-connector-signing-key.d.ts +32 -0
  42. package/lib/db-entries/saml-sso-connector-signing-key.js +49 -0
  43. package/lib/db-entries/sign-in-experience.d.ts +10 -4
  44. package/lib/db-entries/sign-in-experience.js +13 -1
  45. package/lib/db-entries/user.d.ts +5 -1
  46. package/lib/db-entries/user.js +8 -0
  47. package/lib/foundations/jsonb-types/account-centers.d.ts +3 -0
  48. package/lib/foundations/jsonb-types/account-centers.js +1 -0
  49. package/lib/foundations/jsonb-types/custom-domain.d.ts +57 -0
  50. package/lib/foundations/jsonb-types/custom-domain.js +51 -0
  51. package/lib/foundations/jsonb-types/custom-domain.test.d.ts +1 -0
  52. package/lib/foundations/jsonb-types/custom-domain.test.js +38 -0
  53. package/lib/foundations/jsonb-types/hooks.d.ts +4 -4
  54. package/lib/foundations/jsonb-types/hooks.js +2 -0
  55. package/lib/foundations/jsonb-types/one-time-tokens.d.ts +5 -0
  56. package/lib/foundations/jsonb-types/one-time-tokens.js +2 -0
  57. package/lib/foundations/jsonb-types/sentinel.d.ts +16 -1
  58. package/lib/foundations/jsonb-types/sentinel.js +15 -0
  59. package/lib/foundations/jsonb-types/sign-in-experience.d.ts +90 -3
  60. package/lib/foundations/jsonb-types/sign-in-experience.js +20 -0
  61. package/lib/foundations/jsonb-types/sign-in-experience.test.js +49 -1
  62. package/lib/foundations/jsonb-types/users.d.ts +9 -0
  63. package/lib/foundations/jsonb-types/users.js +1 -0
  64. package/lib/seeds/account-center.js +1 -0
  65. package/lib/seeds/sign-in-experience.js +1 -0
  66. package/lib/seeds/sign-in-experience.test.js +5 -1
  67. package/lib/types/application.d.ts +131 -1
  68. package/lib/types/application.js +8 -0
  69. package/lib/types/consent.d.ts +8 -0
  70. package/lib/types/custom-profile-fields.d.ts +5 -1
  71. package/lib/types/domain.d.ts +9 -0
  72. package/lib/types/hook.d.ts +9 -2
  73. package/lib/types/interaction-event.d.ts +11 -0
  74. package/lib/types/interaction-event.js +12 -0
  75. package/lib/types/interactions.d.ts +2 -11
  76. package/lib/types/interactions.js +5 -12
  77. package/lib/types/log/action.d.ts +7 -0
  78. package/lib/types/log/action.js +6 -0
  79. package/lib/types/log/index.d.ts +5 -2
  80. package/lib/types/log/index.js +1 -0
  81. package/lib/types/logto-config/action.d.ts +963 -0
  82. package/lib/types/logto-config/action.js +77 -0
  83. package/lib/types/logto-config/index.d.ts +91 -13
  84. package/lib/types/logto-config/index.js +12 -0
  85. package/lib/types/logto-config/index.test.js +25 -1
  86. package/lib/types/logto-config/jwt-customizer.d.ts +162 -1
  87. package/lib/types/logto-config/jwt-customizer.js +14 -0
  88. package/lib/types/organization.d.ts +136 -1
  89. package/lib/types/organization.js +3 -2
  90. package/lib/types/saml-application.d.ts +3 -0
  91. package/lib/types/saml-application.js +3 -0
  92. package/lib/types/sign-in-experience.d.ts +11 -4
  93. package/lib/types/sign-in-experience.js +1 -1
  94. package/lib/types/sso-connector.d.ts +58 -0
  95. package/lib/types/sso-connector.js +12 -0
  96. package/lib/types/ssr.d.ts +11 -0
  97. package/lib/types/user-assets.d.ts +10 -0
  98. package/lib/types/user-assets.js +17 -0
  99. package/lib/types/user-sessions.d.ts +309 -34
  100. package/lib/types/user-sessions.js +5 -0
  101. package/lib/types/user.d.ts +15 -0
  102. package/lib/types/user.js +1 -0
  103. package/lib/types/verification-records/one-time-token-verification.d.ts +5 -0
  104. package/package.json +8 -8
  105. package/tables/domains.sql +1 -0
  106. package/tables/oidc_model_instances.sql +0 -8
  107. package/tables/saml_sso_connector_signing_keys.sql +21 -0
  108. package/tables/sentinel_activities.sql +4 -0
  109. package/tables/service_logs.sql +7 -2
  110. package/tables/sign_in_experiences.sql +15 -2
  111. package/tables/users.sql +7 -0
@@ -0,0 +1,77 @@
1
+ import { jsonGuard } from '@logto/connector-kit';
2
+ import { z } from 'zod';
3
+ import { InteractionEvent, interactionIdentifierGuard, } from '../interactions.js';
4
+ import { userInfoGuard } from '../user.js';
5
+ import { VerificationType } from '../verification-records/index.js';
6
+ /** Values map to config key names in `logto_configs`. */
7
+ export var LogtoActionKey;
8
+ (function (LogtoActionKey) {
9
+ LogtoActionKey["PostFirstFactorVerification"] = "action.postFirstFactorVerification";
10
+ LogtoActionKey["PostSignIn"] = "action.postSignIn";
11
+ })(LogtoActionKey || (LogtoActionKey = {}));
12
+ export const actionExecutionErrorPolicies = Object.freeze(['block', 'allow']);
13
+ export const logtoActionGuard = z
14
+ .object({
15
+ script: z.string(),
16
+ environmentVariables: z.record(z.string()).optional(),
17
+ contextSample: jsonGuard.optional(),
18
+ enabled: z.boolean().optional(),
19
+ onExecutionError: z.enum(actionExecutionErrorPolicies).optional(),
20
+ })
21
+ .strict();
22
+ /**
23
+ * Shared execution payload for production Actions and Management API dry runs.
24
+ * Cloud remote execution and the local VM runner both accept this shape.
25
+ */
26
+ export const actionExecutionRequestBodyGuard = z
27
+ .object({
28
+ script: z.string(),
29
+ actionType: z.nativeEnum(LogtoActionKey),
30
+ event: jsonGuard,
31
+ environmentVariables: z.record(z.string()).optional(),
32
+ })
33
+ .strict();
34
+ export const actionUserPatchGuard = userInfoGuard
35
+ .pick({
36
+ username: true,
37
+ primaryEmail: true,
38
+ primaryPhone: true,
39
+ name: true,
40
+ avatar: true,
41
+ customData: true,
42
+ profile: true,
43
+ })
44
+ .partial();
45
+ // Nested `user` uses passthrough so password fields survive structural parsing.
46
+ export const postFirstFactorVerificationResultGuard = z.discriminatedUnion('action', [
47
+ z.object({
48
+ action: z.literal('createUser'),
49
+ user: actionUserPatchGuard.passthrough(),
50
+ passwordVerified: z.literal(true),
51
+ }),
52
+ z.object({
53
+ action: z.literal('updateUser'),
54
+ user: actionUserPatchGuard.passthrough(),
55
+ passwordVerified: z.literal(true),
56
+ }),
57
+ ]);
58
+ // Nested `user` uses passthrough so password fields survive structural parsing.
59
+ export const postSignInResultGuard = z.discriminatedUnion('action', [
60
+ z.object({
61
+ action: z.literal('updateUser'),
62
+ user: actionUserPatchGuard.passthrough().optional(),
63
+ }),
64
+ ]);
65
+ export const actionUserPatchFields = Object.freeze(actionUserPatchGuard.keyof().options);
66
+ export const loggablePostFirstFactorVerificationEventGuard = z.object({
67
+ key: z.literal(LogtoActionKey.PostFirstFactorVerification),
68
+ interactionEvent: z.literal(InteractionEvent.SignIn),
69
+ verificationType: z.literal(VerificationType.Password),
70
+ identifier: interactionIdentifierGuard,
71
+ user: z.object({ id: z.string() }).nullable(),
72
+ });
73
+ export const loggablePostSignInEventGuard = z.object({
74
+ key: z.literal(LogtoActionKey.PostSignIn),
75
+ interactionEvent: z.literal(InteractionEvent.SignIn),
76
+ user: z.object({ id: z.string() }),
77
+ });
@@ -2,9 +2,12 @@ import { extendedIdTokenClaims } from '@logto/core-kit';
2
2
  import { type Nullable, type Optional } from '@silverhand/essentials';
3
3
  import type { ZodType } from 'zod';
4
4
  import { z } from 'zod';
5
+ import { type MessageRateLimitOverride } from '../../consts/message-rate-limit.js';
6
+ import { type LogtoAction, LogtoActionKey } from './action.js';
5
7
  import { type AccessTokenJwtCustomizer, type ClientCredentialsJwtCustomizer } from './jwt-customizer.js';
6
8
  export * from './oidc-provider.js';
7
9
  export * from './jwt-customizer.js';
10
+ export * from './action.js';
8
11
  /**
9
12
  * Logto OIDC signing key types, used mainly in REST API routes.
10
13
  */
@@ -91,6 +94,13 @@ export type JwtCustomizerType = {
91
94
  export declare const jwtCustomizerConfigGuard: Readonly<{
92
95
  [key in LogtoJwtTokenKey]: ZodType<JwtCustomizerType[key]>;
93
96
  }>;
97
+ export type ActionType = {
98
+ [LogtoActionKey.PostFirstFactorVerification]: LogtoAction;
99
+ [LogtoActionKey.PostSignIn]: LogtoAction;
100
+ };
101
+ export declare const actionConfigGuard: Readonly<{
102
+ [key in LogtoActionKey]: ZodType<ActionType[key]>;
103
+ }>;
94
104
  export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [z.ZodObject<{
95
105
  key: z.ZodLiteral<LogtoJwtTokenKey.AccessToken>;
96
106
  value: z.ZodObject<{
@@ -468,7 +478,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
468
478
  subjectTokenContext?: Record<string, import("@withtyped/server").Json> | undefined;
469
479
  }>>;
470
480
  interaction: z.ZodOptional<z.ZodObject<{
471
- interactionEvent: z.ZodOptional<z.ZodNativeEnum<typeof import("../interactions.js").InteractionEvent>>;
481
+ interactionEvent: z.ZodOptional<z.ZodNativeEnum<typeof import("../interaction-event.js").InteractionEvent>>;
472
482
  userId: z.ZodOptional<z.ZodString>;
473
483
  verificationRecords: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
474
484
  id: z.ZodString;
@@ -944,10 +954,13 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
944
954
  }>;
945
955
  oneTimeTokenContext: z.ZodOptional<z.ZodObject<{
946
956
  jitOrganizationIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
957
+ interactionEvent: z.ZodOptional<z.ZodNativeEnum<typeof import("../interaction-event.js").InteractionEvent>>;
947
958
  }, "strip", z.ZodTypeAny, {
948
959
  jitOrganizationIds?: string[] | undefined;
960
+ interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
949
961
  }, {
950
962
  jitOrganizationIds?: string[] | undefined;
963
+ interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
951
964
  }>>;
952
965
  }, "strip", z.ZodTypeAny, {
953
966
  type: import("../index.js").VerificationType.OneTimeToken;
@@ -959,6 +972,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
959
972
  verified: boolean;
960
973
  oneTimeTokenContext?: {
961
974
  jitOrganizationIds?: string[] | undefined;
975
+ interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
962
976
  } | undefined;
963
977
  }, {
964
978
  type: import("../index.js").VerificationType.OneTimeToken;
@@ -970,6 +984,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
970
984
  verified: boolean;
971
985
  oneTimeTokenContext?: {
972
986
  jitOrganizationIds?: string[] | undefined;
987
+ interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
973
988
  } | undefined;
974
989
  }>, z.ZodObject<Omit<{
975
990
  id: z.ZodString;
@@ -1004,7 +1019,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
1004
1019
  signInContext: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
1005
1020
  }, "strip", z.ZodTypeAny, {
1006
1021
  userId?: string | undefined;
1007
- interactionEvent?: import("../interactions.js").InteractionEvent | undefined;
1022
+ interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
1008
1023
  verificationRecords?: ({
1009
1024
  type: import("../index.js").VerificationType.BackupCode;
1010
1025
  id: string;
@@ -1063,6 +1078,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
1063
1078
  verified: boolean;
1064
1079
  oneTimeTokenContext?: {
1065
1080
  jitOrganizationIds?: string[] | undefined;
1081
+ interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
1066
1082
  } | undefined;
1067
1083
  } | {
1068
1084
  type: import("../index.js").VerificationType.Password;
@@ -1118,7 +1134,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
1118
1134
  signInContext?: Record<string, string> | undefined;
1119
1135
  }, {
1120
1136
  userId?: string | undefined;
1121
- interactionEvent?: import("../interactions.js").InteractionEvent | undefined;
1137
+ interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
1122
1138
  verificationRecords?: ({
1123
1139
  type: import("../index.js").VerificationType.BackupCode;
1124
1140
  id: string;
@@ -1177,6 +1193,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
1177
1193
  verified: boolean;
1178
1194
  oneTimeTokenContext?: {
1179
1195
  jitOrganizationIds?: string[] | undefined;
1196
+ interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
1180
1197
  } | undefined;
1181
1198
  } | {
1182
1199
  type: import("../index.js").VerificationType.Password;
@@ -1431,6 +1448,22 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
1431
1448
  isThirdParty?: boolean | undefined;
1432
1449
  appLevelAccessControlEnabled?: boolean | undefined;
1433
1450
  }>>;
1451
+ organization: z.ZodOptional<z.ZodObject<{
1452
+ name: z.ZodOptional<ZodType<string, z.ZodTypeDef, string>>;
1453
+ id: z.ZodOptional<ZodType<string, z.ZodTypeDef, string>>;
1454
+ customData: z.ZodOptional<ZodType<import("@withtyped/server").JsonObject, z.ZodTypeDef, import("@withtyped/server").JsonObject>>;
1455
+ description: z.ZodOptional<ZodType<string | null, z.ZodTypeDef, string | null>>;
1456
+ }, "strip", z.ZodTypeAny, {
1457
+ name?: string | undefined;
1458
+ id?: string | undefined;
1459
+ customData?: import("@withtyped/server").JsonObject | undefined;
1460
+ description?: string | null | undefined;
1461
+ }, {
1462
+ name?: string | undefined;
1463
+ id?: string | undefined;
1464
+ customData?: import("@withtyped/server").JsonObject | undefined;
1465
+ description?: string | null | undefined;
1466
+ }>>;
1434
1467
  }, "strip", z.ZodTypeAny, {
1435
1468
  user: {
1436
1469
  name?: string | null | undefined;
@@ -1554,13 +1587,19 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
1554
1587
  isThirdParty?: boolean | undefined;
1555
1588
  appLevelAccessControlEnabled?: boolean | undefined;
1556
1589
  } | undefined;
1590
+ organization?: {
1591
+ name?: string | undefined;
1592
+ id?: string | undefined;
1593
+ customData?: import("@withtyped/server").JsonObject | undefined;
1594
+ description?: string | null | undefined;
1595
+ } | undefined;
1557
1596
  grant?: {
1558
1597
  type?: import("../oidc-config.js").GrantType.TokenExchange | undefined;
1559
1598
  subjectTokenContext?: Record<string, import("@withtyped/server").Json> | undefined;
1560
1599
  } | undefined;
1561
1600
  interaction?: {
1562
1601
  userId?: string | undefined;
1563
- interactionEvent?: import("../interactions.js").InteractionEvent | undefined;
1602
+ interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
1564
1603
  verificationRecords?: ({
1565
1604
  type: import("../index.js").VerificationType.BackupCode;
1566
1605
  id: string;
@@ -1619,6 +1658,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
1619
1658
  verified: boolean;
1620
1659
  oneTimeTokenContext?: {
1621
1660
  jitOrganizationIds?: string[] | undefined;
1661
+ interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
1622
1662
  } | undefined;
1623
1663
  } | {
1624
1664
  type: import("../index.js").VerificationType.Password;
@@ -1796,13 +1836,19 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
1796
1836
  isThirdParty?: boolean | undefined;
1797
1837
  appLevelAccessControlEnabled?: boolean | undefined;
1798
1838
  } | undefined;
1839
+ organization?: {
1840
+ name?: string | undefined;
1841
+ id?: string | undefined;
1842
+ customData?: import("@withtyped/server").JsonObject | undefined;
1843
+ description?: string | null | undefined;
1844
+ } | undefined;
1799
1845
  grant?: {
1800
1846
  type?: import("../oidc-config.js").GrantType.TokenExchange | undefined;
1801
1847
  subjectTokenContext?: Record<string, import("@withtyped/server").Json> | undefined;
1802
1848
  } | undefined;
1803
1849
  interaction?: {
1804
1850
  userId?: string | undefined;
1805
- interactionEvent?: import("../interactions.js").InteractionEvent | undefined;
1851
+ interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
1806
1852
  verificationRecords?: ({
1807
1853
  type: import("../index.js").VerificationType.BackupCode;
1808
1854
  id: string;
@@ -1861,6 +1907,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
1861
1907
  verified: boolean;
1862
1908
  oneTimeTokenContext?: {
1863
1909
  jitOrganizationIds?: string[] | undefined;
1910
+ interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
1864
1911
  } | undefined;
1865
1912
  } | {
1866
1913
  type: import("../index.js").VerificationType.Password;
@@ -2042,13 +2089,19 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
2042
2089
  isThirdParty?: boolean | undefined;
2043
2090
  appLevelAccessControlEnabled?: boolean | undefined;
2044
2091
  } | undefined;
2092
+ organization?: {
2093
+ name?: string | undefined;
2094
+ id?: string | undefined;
2095
+ customData?: import("@withtyped/server").JsonObject | undefined;
2096
+ description?: string | null | undefined;
2097
+ } | undefined;
2045
2098
  grant?: {
2046
2099
  type?: import("../oidc-config.js").GrantType.TokenExchange | undefined;
2047
2100
  subjectTokenContext?: Record<string, import("@withtyped/server").Json> | undefined;
2048
2101
  } | undefined;
2049
2102
  interaction?: {
2050
2103
  userId?: string | undefined;
2051
- interactionEvent?: import("../interactions.js").InteractionEvent | undefined;
2104
+ interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
2052
2105
  verificationRecords?: ({
2053
2106
  type: import("../index.js").VerificationType.BackupCode;
2054
2107
  id: string;
@@ -2107,6 +2160,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
2107
2160
  verified: boolean;
2108
2161
  oneTimeTokenContext?: {
2109
2162
  jitOrganizationIds?: string[] | undefined;
2163
+ interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
2110
2164
  } | undefined;
2111
2165
  } | {
2112
2166
  type: import("../index.js").VerificationType.Password;
@@ -2302,13 +2356,19 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
2302
2356
  isThirdParty?: boolean | undefined;
2303
2357
  appLevelAccessControlEnabled?: boolean | undefined;
2304
2358
  } | undefined;
2359
+ organization?: {
2360
+ name?: string | undefined;
2361
+ id?: string | undefined;
2362
+ customData?: import("@withtyped/server").JsonObject | undefined;
2363
+ description?: string | null | undefined;
2364
+ } | undefined;
2305
2365
  grant?: {
2306
2366
  type?: import("../oidc-config.js").GrantType.TokenExchange | undefined;
2307
2367
  subjectTokenContext?: Record<string, import("@withtyped/server").Json> | undefined;
2308
2368
  } | undefined;
2309
2369
  interaction?: {
2310
2370
  userId?: string | undefined;
2311
- interactionEvent?: import("../interactions.js").InteractionEvent | undefined;
2371
+ interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
2312
2372
  verificationRecords?: ({
2313
2373
  type: import("../index.js").VerificationType.BackupCode;
2314
2374
  id: string;
@@ -2367,6 +2427,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
2367
2427
  verified: boolean;
2368
2428
  oneTimeTokenContext?: {
2369
2429
  jitOrganizationIds?: string[] | undefined;
2430
+ interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
2370
2431
  } | undefined;
2371
2432
  } | {
2372
2433
  type: import("../index.js").VerificationType.Password;
@@ -2564,13 +2625,19 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
2564
2625
  isThirdParty?: boolean | undefined;
2565
2626
  appLevelAccessControlEnabled?: boolean | undefined;
2566
2627
  } | undefined;
2628
+ organization?: {
2629
+ name?: string | undefined;
2630
+ id?: string | undefined;
2631
+ customData?: import("@withtyped/server").JsonObject | undefined;
2632
+ description?: string | null | undefined;
2633
+ } | undefined;
2567
2634
  grant?: {
2568
2635
  type?: import("../oidc-config.js").GrantType.TokenExchange | undefined;
2569
2636
  subjectTokenContext?: Record<string, import("@withtyped/server").Json> | undefined;
2570
2637
  } | undefined;
2571
2638
  interaction?: {
2572
2639
  userId?: string | undefined;
2573
- interactionEvent?: import("../interactions.js").InteractionEvent | undefined;
2640
+ interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
2574
2641
  verificationRecords?: ({
2575
2642
  type: import("../index.js").VerificationType.BackupCode;
2576
2643
  id: string;
@@ -2629,6 +2696,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
2629
2696
  verified: boolean;
2630
2697
  oneTimeTokenContext?: {
2631
2698
  jitOrganizationIds?: string[] | undefined;
2699
+ interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
2632
2700
  } | undefined;
2633
2701
  } | {
2634
2702
  type: import("../index.js").VerificationType.Password;
@@ -2827,13 +2895,19 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
2827
2895
  isThirdParty?: boolean | undefined;
2828
2896
  appLevelAccessControlEnabled?: boolean | undefined;
2829
2897
  } | undefined;
2898
+ organization?: {
2899
+ name?: string | undefined;
2900
+ id?: string | undefined;
2901
+ customData?: import("@withtyped/server").JsonObject | undefined;
2902
+ description?: string | null | undefined;
2903
+ } | undefined;
2830
2904
  grant?: {
2831
2905
  type?: import("../oidc-config.js").GrantType.TokenExchange | undefined;
2832
2906
  subjectTokenContext?: Record<string, import("@withtyped/server").Json> | undefined;
2833
2907
  } | undefined;
2834
2908
  interaction?: {
2835
2909
  userId?: string | undefined;
2836
- interactionEvent?: import("../interactions.js").InteractionEvent | undefined;
2910
+ interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
2837
2911
  verificationRecords?: ({
2838
2912
  type: import("../index.js").VerificationType.BackupCode;
2839
2913
  id: string;
@@ -2892,6 +2966,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
2892
2966
  verified: boolean;
2893
2967
  oneTimeTokenContext?: {
2894
2968
  jitOrganizationIds?: string[] | undefined;
2969
+ interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
2895
2970
  } | undefined;
2896
2971
  } | {
2897
2972
  type: import("../index.js").VerificationType.Password;
@@ -3687,7 +3762,9 @@ export declare enum LogtoTenantConfigKey {
3687
3762
  /** ID token configuration for extended claims. */
3688
3763
  IdToken = "idToken",
3689
3764
  /** Tenant-scoped rotation state for staged private signing key activation. */
3690
- SigningKeyRotationState = "signingKeyRotationState"
3765
+ SigningKeyRotationState = "signingKeyRotationState",
3766
+ /** Internal, ops-only override of the system message send-rate-limit policy. Not exposed by any API. */
3767
+ MessageRateLimitOverride = "messageRateLimitOverride"
3691
3768
  }
3692
3769
  export type LogtoTenantConfigType = {
3693
3770
  [LogtoTenantConfigKey.AdminConsole]: AdminConsoleData;
@@ -3697,13 +3774,14 @@ export type LogtoTenantConfigType = {
3697
3774
  };
3698
3775
  [LogtoTenantConfigKey.IdToken]: IdTokenConfig;
3699
3776
  [LogtoTenantConfigKey.SigningKeyRotationState]: SigningKeyRotationState;
3777
+ [LogtoTenantConfigKey.MessageRateLimitOverride]: MessageRateLimitOverride;
3700
3778
  };
3701
3779
  export declare const logtoTenantConfigGuard: Readonly<{
3702
3780
  [key in LogtoTenantConfigKey]: ZodType<LogtoTenantConfigType[key]>;
3703
3781
  }>;
3704
- export type LogtoConfigKey = LogtoOidcConfigKey | LogtoJwtTokenKey | LogtoTenantConfigKey;
3705
- export type LogtoConfigType = LogtoOidcConfigType | JwtCustomizerType | LogtoTenantConfigType;
3706
- export type LogtoConfigGuard = typeof logtoOidcConfigGuard & typeof jwtCustomizerConfigGuard & typeof logtoTenantConfigGuard;
3782
+ export type LogtoConfigKey = LogtoOidcConfigKey | LogtoJwtTokenKey | LogtoActionKey | LogtoTenantConfigKey;
3783
+ export type LogtoConfigType = LogtoOidcConfigType | JwtCustomizerType | ActionType | LogtoTenantConfigType;
3784
+ export type LogtoConfigGuard = typeof logtoOidcConfigGuard & typeof jwtCustomizerConfigGuard & typeof actionConfigGuard & typeof logtoTenantConfigGuard;
3707
3785
  export declare const logtoConfigKeys: readonly LogtoConfigKey[];
3708
3786
  export declare const logtoConfigGuards: LogtoConfigGuard;
3709
3787
  export declare const oidcConfigKeysResponseGuard: z.ZodObject<Omit<{
@@ -1,8 +1,11 @@
1
1
  import { extendedIdTokenClaims } from '@logto/core-kit';
2
2
  import { z } from 'zod';
3
+ import { messageRateLimitOverrideGuard, } from '../../consts/message-rate-limit.js';
4
+ import { LogtoActionKey, logtoActionGuard } from './action.js';
3
5
  import { accessTokenJwtCustomizerGuard, clientCredentialsJwtCustomizerGuard, } from './jwt-customizer.js';
4
6
  export * from './oidc-provider.js';
5
7
  export * from './jwt-customizer.js';
8
+ export * from './action.js';
6
9
  /**
7
10
  * Logto OIDC signing key types, used mainly in REST API routes.
8
11
  */
@@ -60,6 +63,10 @@ export const jwtCustomizerConfigGuard = Object.freeze({
60
63
  [LogtoJwtTokenKey.AccessToken]: accessTokenJwtCustomizerGuard,
61
64
  [LogtoJwtTokenKey.ClientCredentials]: clientCredentialsJwtCustomizerGuard,
62
65
  });
66
+ export const actionConfigGuard = Object.freeze({
67
+ [LogtoActionKey.PostFirstFactorVerification]: logtoActionGuard,
68
+ [LogtoActionKey.PostSignIn]: logtoActionGuard,
69
+ });
63
70
  export const jwtCustomizerConfigsGuard = z.discriminatedUnion('key', [
64
71
  z.object({
65
72
  key: z.literal(LogtoJwtTokenKey.AccessToken),
@@ -119,6 +126,8 @@ export var LogtoTenantConfigKey;
119
126
  LogtoTenantConfigKey["IdToken"] = "idToken";
120
127
  /** Tenant-scoped rotation state for staged private signing key activation. */
121
128
  LogtoTenantConfigKey["SigningKeyRotationState"] = "signingKeyRotationState";
129
+ /** Internal, ops-only override of the system message send-rate-limit policy. Not exposed by any API. */
130
+ LogtoTenantConfigKey["MessageRateLimitOverride"] = "messageRateLimitOverride";
122
131
  })(LogtoTenantConfigKey || (LogtoTenantConfigKey = {}));
123
132
  export const logtoTenantConfigGuard = Object.freeze({
124
133
  [LogtoTenantConfigKey.AdminConsole]: adminConsoleDataGuard,
@@ -126,15 +135,18 @@ export const logtoTenantConfigGuard = Object.freeze({
126
135
  [LogtoTenantConfigKey.SessionNotFoundRedirectUrl]: z.object({ url: z.string() }),
127
136
  [LogtoTenantConfigKey.IdToken]: idTokenConfigGuard,
128
137
  [LogtoTenantConfigKey.SigningKeyRotationState]: signingKeyRotationStateGuard,
138
+ [LogtoTenantConfigKey.MessageRateLimitOverride]: messageRateLimitOverrideGuard,
129
139
  });
130
140
  export const logtoConfigKeys = Object.freeze([
131
141
  ...Object.values(LogtoOidcConfigKey),
132
142
  ...Object.values(LogtoJwtTokenKey),
143
+ ...Object.values(LogtoActionKey),
133
144
  ...Object.values(LogtoTenantConfigKey),
134
145
  ]);
135
146
  export const logtoConfigGuards = Object.freeze({
136
147
  ...logtoOidcConfigGuard,
137
148
  ...jwtCustomizerConfigGuard,
149
+ ...actionConfigGuard,
138
150
  ...logtoTenantConfigGuard,
139
151
  });
140
152
  export const oidcConfigKeysResponseGuard = oidcConfigKeyGuard.omit({ value: true }).merge(z.object({
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, it } from 'vitest';
2
- import { LogtoOidcConfigKey, LogtoTenantConfigKey, OidcSigningKeyStatus, logtoOidcConfigGuard, logtoTenantConfigGuard, oidcConfigKeysResponseGuard, } from './index.js';
2
+ import { LogtoActionKey, LogtoOidcConfigKey, LogtoTenantConfigKey, OidcSigningKeyStatus, actionConfigGuard, logtoOidcConfigGuard, logtoConfigGuards, logtoConfigKeys, logtoTenantConfigGuard, oidcConfigKeysResponseGuard, } from './index.js';
3
3
  describe('logto config guards', () => {
4
4
  it('accepts legacy private keys without status', () => {
5
5
  const privateKeys = [
@@ -26,4 +26,28 @@ describe('logto config guards', () => {
26
26
  });
27
27
  expect(result.success).toBe(true);
28
28
  });
29
+ it('accepts action configs', () => {
30
+ const result = actionConfigGuard[LogtoActionKey.PostFirstFactorVerification].safeParse({
31
+ script: 'export default async () => ({ action: "createUser" });',
32
+ environmentVariables: {
33
+ endpoint: 'https://example.com',
34
+ },
35
+ contextSample: ['json', { value: true }],
36
+ enabled: true,
37
+ onExecutionError: 'block',
38
+ });
39
+ expect(result.success).toBe(true);
40
+ });
41
+ it('rejects invalid action execution error policy', () => {
42
+ const result = actionConfigGuard[LogtoActionKey.PostSignIn].safeParse({
43
+ script: 'export default async () => ({ action: "updateUser" });',
44
+ onExecutionError: 'ignore',
45
+ });
46
+ expect(result.success).toBe(false);
47
+ });
48
+ it('includes action keys in the logto config summary guards', () => {
49
+ expect(logtoConfigKeys).toContain(LogtoActionKey.PostFirstFactorVerification);
50
+ expect(logtoConfigKeys).toContain(LogtoActionKey.PostSignIn);
51
+ expect(logtoConfigGuards[LogtoActionKey.PostSignIn]).toBe(actionConfigGuard[LogtoActionKey.PostSignIn]);
52
+ });
29
53
  });