@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
@@ -1,7 +1,137 @@
1
1
  import { UserScope } from '@logto/core-kit';
2
2
  import { z } from 'zod';
3
3
  import { type Application } from '../db-entries/index.js';
4
- export type ApplicationResponse = Application & {
4
+ /**
5
+ * The application response returned by Management APIs.
6
+ *
7
+ * The legacy client secret is only present before it has been replaced by an internal secret.
8
+ */
9
+ export declare const applicationResponseGuard: z.ZodObject<{
10
+ tenantId: z.ZodType<string, z.ZodTypeDef, string>;
11
+ id: z.ZodType<string, z.ZodTypeDef, string>;
12
+ name: z.ZodType<string, z.ZodTypeDef, string>;
13
+ description: z.ZodType<string | null, z.ZodTypeDef, string | null>;
14
+ type: z.ZodType<import("../db-entries/custom-types.js").ApplicationType, z.ZodTypeDef, import("../db-entries/custom-types.js").ApplicationType>;
15
+ oidcClientMetadata: z.ZodType<import("../index.js").OidcClientMetadata, z.ZodTypeDef, import("../index.js").OidcClientMetadata>;
16
+ customClientMetadata: z.ZodType<{
17
+ corsAllowedOrigins?: string[] | undefined;
18
+ idTokenTtl?: number | undefined;
19
+ refreshTokenTtl?: number | undefined;
20
+ refreshTokenTtlInDays?: number | undefined;
21
+ tenantId?: string | undefined;
22
+ alwaysIssueRefreshToken?: boolean | undefined;
23
+ rotateRefreshToken?: boolean | undefined;
24
+ allowTokenExchange?: boolean | undefined;
25
+ isDeviceFlow?: boolean | undefined;
26
+ maxAllowedGrants?: number | undefined;
27
+ }, z.ZodTypeDef, {
28
+ corsAllowedOrigins?: string[] | undefined;
29
+ idTokenTtl?: number | undefined;
30
+ refreshTokenTtl?: number | undefined;
31
+ refreshTokenTtlInDays?: number | undefined;
32
+ tenantId?: string | undefined;
33
+ alwaysIssueRefreshToken?: boolean | undefined;
34
+ rotateRefreshToken?: boolean | undefined;
35
+ allowTokenExchange?: boolean | undefined;
36
+ isDeviceFlow?: boolean | undefined;
37
+ maxAllowedGrants?: number | undefined;
38
+ }>;
39
+ protectedAppMetadata: z.ZodType<{
40
+ host: string;
41
+ origin: string;
42
+ sessionDuration: number;
43
+ pageRules: {
44
+ path: string;
45
+ }[];
46
+ additionalScopes?: (UserScope.CustomData | UserScope.Identities | UserScope.Roles | UserScope.Organizations | UserScope.OrganizationRoles)[] | undefined;
47
+ customDomains?: {
48
+ status: import("../index.js").DomainStatus;
49
+ domain: string;
50
+ errorMessage: string | null;
51
+ dnsRecords: {
52
+ value: string;
53
+ type: string;
54
+ name: string;
55
+ }[];
56
+ cloudflareData: {
57
+ status: string;
58
+ id: string;
59
+ ssl: {
60
+ status: string;
61
+ validation_errors?: {
62
+ message: string;
63
+ }[] | undefined;
64
+ };
65
+ verification_errors?: string[] | undefined;
66
+ } | null;
67
+ }[] | undefined;
68
+ } | null, z.ZodTypeDef, {
69
+ host: string;
70
+ origin: string;
71
+ sessionDuration: number;
72
+ pageRules: {
73
+ path: string;
74
+ }[];
75
+ additionalScopes?: (UserScope.CustomData | UserScope.Identities | UserScope.Roles | UserScope.Organizations | UserScope.OrganizationRoles)[] | undefined;
76
+ customDomains?: {
77
+ status: import("../index.js").DomainStatus;
78
+ domain: string;
79
+ errorMessage: string | null;
80
+ dnsRecords: {
81
+ value: string;
82
+ type: string;
83
+ name: string;
84
+ }[];
85
+ cloudflareData: {
86
+ status: string;
87
+ id: string;
88
+ ssl: {
89
+ status: string;
90
+ validation_errors?: {
91
+ message: string;
92
+ }[] | undefined;
93
+ };
94
+ verification_errors?: string[] | undefined;
95
+ } | null;
96
+ }[] | undefined;
97
+ } | null>;
98
+ customData: z.ZodType<import("@withtyped/server").JsonObject, z.ZodTypeDef, import("@withtyped/server").JsonObject>;
99
+ isThirdParty: z.ZodType<boolean, z.ZodTypeDef, boolean>;
100
+ appLevelAccessControlEnabled: z.ZodType<boolean, z.ZodTypeDef, boolean>;
101
+ createdAt: z.ZodType<number, z.ZodTypeDef, number>;
102
+ } & {
103
+ secret: z.ZodOptional<z.ZodType<string, z.ZodTypeDef, string>>;
104
+ }, "strip", z.ZodTypeAny, {
105
+ type: import("../db-entries/custom-types.js").ApplicationType;
106
+ name: string;
107
+ id: string;
108
+ tenantId: string;
109
+ createdAt: number;
110
+ customData: import("@withtyped/server").JsonObject;
111
+ description: string | null;
112
+ oidcClientMetadata: import("../index.js").OidcClientMetadata;
113
+ customClientMetadata: import("../index.js").CustomClientMetadata;
114
+ protectedAppMetadata: import("../index.js").ProtectedAppMetadata | null;
115
+ isThirdParty: boolean;
116
+ appLevelAccessControlEnabled: boolean;
117
+ secret?: string | undefined;
118
+ }, {
119
+ type: import("../db-entries/custom-types.js").ApplicationType;
120
+ name: string;
121
+ id: string;
122
+ tenantId: string;
123
+ createdAt: number;
124
+ customData: import("@withtyped/server").JsonObject;
125
+ description: string | null;
126
+ oidcClientMetadata: import("../index.js").OidcClientMetadata;
127
+ customClientMetadata: import("../index.js").CustomClientMetadata;
128
+ protectedAppMetadata: import("../index.js").ProtectedAppMetadata | null;
129
+ isThirdParty: boolean;
130
+ appLevelAccessControlEnabled: boolean;
131
+ secret?: string | undefined;
132
+ }>;
133
+ export type ApplicationApiResponse = z.infer<typeof applicationResponseGuard>;
134
+ export type ApplicationResponse = ApplicationApiResponse & {
5
135
  isAdmin: boolean;
6
136
  };
7
137
  /**
@@ -1,6 +1,14 @@
1
1
  import { UserScope } from '@logto/core-kit';
2
2
  import { z } from 'zod';
3
3
  import { Applications, OrganizationScopes, Resources, Scopes, ApplicationSignInExperiences, } from '../db-entries/index.js';
4
+ /**
5
+ * The application response returned by Management APIs.
6
+ *
7
+ * The legacy client secret is only present before it has been replaced by an internal secret.
8
+ */
9
+ export const applicationResponseGuard = Applications.guard.extend({
10
+ secret: Applications.guard.shape.secret.optional(),
11
+ });
4
12
  /** The guard for {@link FeaturedApplication}. */
5
13
  export const featuredApplicationGuard = Applications.guard.pick({
6
14
  id: true,
@@ -68,6 +68,7 @@ export declare const publicUserInfoGuard: z.ZodObject<Pick<{
68
68
  id: string;
69
69
  key: string;
70
70
  createdAt: string;
71
+ lastUsedTimeStep?: number | undefined;
71
72
  lastUsedAt?: string | undefined;
72
73
  } | {
73
74
  type: import("../index.js").MfaFactor.WebAuthn;
@@ -95,6 +96,7 @@ export declare const publicUserInfoGuard: z.ZodObject<Pick<{
95
96
  id: string;
96
97
  key: string;
97
98
  createdAt: string;
99
+ lastUsedTimeStep?: number | undefined;
98
100
  lastUsedAt?: string | undefined;
99
101
  } | {
100
102
  type: import("../index.js").MfaFactor.WebAuthn;
@@ -119,7 +121,9 @@ export declare const publicUserInfoGuard: z.ZodObject<Pick<{
119
121
  lastUsedAt?: string | undefined;
120
122
  })[]>;
121
123
  isSuspended: z.ZodType<boolean, z.ZodTypeDef, boolean>;
124
+ isPasswordExpired: z.ZodType<boolean, z.ZodTypeDef, boolean>;
122
125
  lastSignInAt: z.ZodType<number | null, z.ZodTypeDef, number | null>;
126
+ passwordUpdatedAt: z.ZodType<number | null, z.ZodTypeDef, number | null>;
123
127
  createdAt: z.ZodType<number, z.ZodTypeDef, number>;
124
128
  updatedAt: z.ZodType<number, z.ZodTypeDef, number>;
125
129
  }, "name" | "id" | "username" | "avatar" | "primaryEmail" | "primaryPhone">, "strip", z.ZodTypeAny, {
@@ -667,6 +671,7 @@ export declare const consentInfoResponseGuard: z.ZodObject<{
667
671
  id: string;
668
672
  key: string;
669
673
  createdAt: string;
674
+ lastUsedTimeStep?: number | undefined;
670
675
  lastUsedAt?: string | undefined;
671
676
  } | {
672
677
  type: import("../index.js").MfaFactor.WebAuthn;
@@ -694,6 +699,7 @@ export declare const consentInfoResponseGuard: z.ZodObject<{
694
699
  id: string;
695
700
  key: string;
696
701
  createdAt: string;
702
+ lastUsedTimeStep?: number | undefined;
697
703
  lastUsedAt?: string | undefined;
698
704
  } | {
699
705
  type: import("../index.js").MfaFactor.WebAuthn;
@@ -718,7 +724,9 @@ export declare const consentInfoResponseGuard: z.ZodObject<{
718
724
  lastUsedAt?: string | undefined;
719
725
  })[]>;
720
726
  isSuspended: z.ZodType<boolean, z.ZodTypeDef, boolean>;
727
+ isPasswordExpired: z.ZodType<boolean, z.ZodTypeDef, boolean>;
721
728
  lastSignInAt: z.ZodType<number | null, z.ZodTypeDef, number | null>;
729
+ passwordUpdatedAt: z.ZodType<number | null, z.ZodTypeDef, number | null>;
722
730
  createdAt: z.ZodType<number, z.ZodTypeDef, number>;
723
731
  updatedAt: z.ZodType<number, z.ZodTypeDef, number>;
724
732
  }, "name" | "id" | "username" | "avatar" | "primaryEmail" | "primaryPhone">, "strip", z.ZodTypeAny, {
@@ -2471,6 +2471,7 @@ export declare const signInIdentifierKeyGuard: z.ZodObject<Pick<{
2471
2471
  id: string;
2472
2472
  key: string;
2473
2473
  createdAt: string;
2474
+ lastUsedTimeStep?: number | undefined;
2474
2475
  lastUsedAt?: string | undefined;
2475
2476
  } | {
2476
2477
  type: import("../foundations/index.js").MfaFactor.WebAuthn;
@@ -2498,6 +2499,7 @@ export declare const signInIdentifierKeyGuard: z.ZodObject<Pick<{
2498
2499
  id: string;
2499
2500
  key: string;
2500
2501
  createdAt: string;
2502
+ lastUsedTimeStep?: number | undefined;
2501
2503
  lastUsedAt?: string | undefined;
2502
2504
  } | {
2503
2505
  type: import("../foundations/index.js").MfaFactor.WebAuthn;
@@ -2522,7 +2524,9 @@ export declare const signInIdentifierKeyGuard: z.ZodObject<Pick<{
2522
2524
  lastUsedAt?: string | undefined;
2523
2525
  })[]>>;
2524
2526
  isSuspended: z.ZodOptional<z.ZodType<boolean, z.ZodTypeDef, boolean>>;
2527
+ isPasswordExpired: z.ZodOptional<z.ZodType<boolean, z.ZodTypeDef, boolean>>;
2525
2528
  lastSignInAt: z.ZodOptional<z.ZodType<number | null, z.ZodTypeDef, number | null>>;
2529
+ passwordUpdatedAt: z.ZodOptional<z.ZodType<number | null, z.ZodTypeDef, number | null>>;
2526
2530
  createdAt: z.ZodOptional<z.ZodType<number, z.ZodTypeDef, number>>;
2527
2531
  updatedAt: z.ZodOptional<z.ZodType<number, z.ZodTypeDef, number>>;
2528
2532
  }, "username" | "primaryEmail" | "primaryPhone"> & {
@@ -2541,7 +2545,7 @@ export declare const signInIdentifierKeyGuard: z.ZodObject<Pick<{
2541
2545
  primaryEmail?: string | null;
2542
2546
  primaryPhone?: string | null;
2543
2547
  }>;
2544
- export declare const reservedSignInIdentifierKeys: readonly ["username", "email", "phone", "primaryEmail", "primaryPhone"];
2548
+ export declare const reservedSignInIdentifierKeys: readonly ["username", "primaryEmail", "primaryPhone", "email", "phone"];
2545
2549
  /** Reserved user profile keys. Currently only `preferredUsername` is reserved for standard IdP usage. */
2546
2550
  export declare const reservedBuiltInProfileKeyGuard: z.ZodObject<Pick<{
2547
2551
  familyName: z.ZodOptional<z.ZodString>;
@@ -15,6 +15,15 @@ export declare const domainResponseGuard: z.ZodObject<Pick<{
15
15
  type: string;
16
16
  name: string;
17
17
  }[]>;
18
+ verificationFiles: z.ZodType<{
19
+ path: string;
20
+ content: string;
21
+ contentType: import("../index.js").DomainVerificationFileContentType;
22
+ }[], z.ZodTypeDef, {
23
+ path: string;
24
+ content: string;
25
+ contentType: import("../index.js").DomainVerificationFileContentType;
26
+ }[]>;
18
27
  cloudflareData: z.ZodType<{
19
28
  status: string;
20
29
  id: string;
@@ -18,8 +18,8 @@ export declare const hookResponseGuard: z.ZodObject<{
18
18
  tenantId: z.ZodType<string, z.ZodTypeDef, string>;
19
19
  id: z.ZodType<string, z.ZodTypeDef, string>;
20
20
  name: z.ZodType<string, z.ZodTypeDef, string>;
21
- event: z.ZodType<"User.Created" | "User.Deleted" | "Role.Created" | "Role.Deleted" | "Scope.Created" | "Scope.Deleted" | "Organization.Created" | "Organization.Deleted" | "OrganizationRole.Created" | "OrganizationRole.Deleted" | "OrganizationScope.Created" | "OrganizationScope.Deleted" | "User.Data.Updated" | "Role.Data.Updated" | "Scope.Data.Updated" | "Organization.Data.Updated" | "OrganizationRole.Data.Updated" | "OrganizationScope.Data.Updated" | "User.SuspensionStatus.Updated" | "Role.Scopes.Updated" | "Organization.Membership.Updated" | "OrganizationRole.Scopes.Updated" | InteractionHookEvent | "Identifier.Lockout" | null, z.ZodTypeDef, "User.Created" | "User.Deleted" | "Role.Created" | "Role.Deleted" | "Scope.Created" | "Scope.Deleted" | "Organization.Created" | "Organization.Deleted" | "OrganizationRole.Created" | "OrganizationRole.Deleted" | "OrganizationScope.Created" | "OrganizationScope.Deleted" | "User.Data.Updated" | "Role.Data.Updated" | "Scope.Data.Updated" | "Organization.Data.Updated" | "OrganizationRole.Data.Updated" | "OrganizationScope.Data.Updated" | "User.SuspensionStatus.Updated" | "Role.Scopes.Updated" | "Organization.Membership.Updated" | "OrganizationRole.Scopes.Updated" | InteractionHookEvent | "Identifier.Lockout" | null>;
22
- events: z.ZodType<("User.Created" | "User.Deleted" | "Role.Created" | "Role.Deleted" | "Scope.Created" | "Scope.Deleted" | "Organization.Created" | "Organization.Deleted" | "OrganizationRole.Created" | "OrganizationRole.Deleted" | "OrganizationScope.Created" | "OrganizationScope.Deleted" | "User.Data.Updated" | "Role.Data.Updated" | "Scope.Data.Updated" | "Organization.Data.Updated" | "OrganizationRole.Data.Updated" | "OrganizationScope.Data.Updated" | "User.SuspensionStatus.Updated" | "Role.Scopes.Updated" | "Organization.Membership.Updated" | "OrganizationRole.Scopes.Updated" | InteractionHookEvent | "Identifier.Lockout")[], z.ZodTypeDef, ("User.Created" | "User.Deleted" | "Role.Created" | "Role.Deleted" | "Scope.Created" | "Scope.Deleted" | "Organization.Created" | "Organization.Deleted" | "OrganizationRole.Created" | "OrganizationRole.Deleted" | "OrganizationScope.Created" | "OrganizationScope.Deleted" | "User.Data.Updated" | "Role.Data.Updated" | "Scope.Data.Updated" | "Organization.Data.Updated" | "OrganizationRole.Data.Updated" | "OrganizationScope.Data.Updated" | "User.SuspensionStatus.Updated" | "Role.Scopes.Updated" | "Organization.Membership.Updated" | "OrganizationRole.Scopes.Updated" | InteractionHookEvent | "Identifier.Lockout")[]>;
21
+ event: z.ZodType<"User.Created" | "User.Deleted" | "Role.Created" | "Role.Deleted" | "Scope.Created" | "Scope.Deleted" | "Organization.Created" | "Organization.Deleted" | "OrganizationRole.Created" | "OrganizationRole.Deleted" | "OrganizationScope.Created" | "OrganizationScope.Deleted" | "User.Data.Updated" | "Role.Data.Updated" | "Scope.Data.Updated" | "Organization.Data.Updated" | "OrganizationRole.Data.Updated" | "OrganizationScope.Data.Updated" | "User.SuspensionStatus.Updated" | "Role.Scopes.Updated" | "Organization.Membership.Updated" | "OrganizationRole.Scopes.Updated" | "Identifier.Lockout" | "Message.RateLimited" | "Grant.LimitExceeded" | InteractionHookEvent | null, z.ZodTypeDef, "User.Created" | "User.Deleted" | "Role.Created" | "Role.Deleted" | "Scope.Created" | "Scope.Deleted" | "Organization.Created" | "Organization.Deleted" | "OrganizationRole.Created" | "OrganizationRole.Deleted" | "OrganizationScope.Created" | "OrganizationScope.Deleted" | "User.Data.Updated" | "Role.Data.Updated" | "Scope.Data.Updated" | "Organization.Data.Updated" | "OrganizationRole.Data.Updated" | "OrganizationScope.Data.Updated" | "User.SuspensionStatus.Updated" | "Role.Scopes.Updated" | "Organization.Membership.Updated" | "OrganizationRole.Scopes.Updated" | "Identifier.Lockout" | "Message.RateLimited" | "Grant.LimitExceeded" | InteractionHookEvent | null>;
22
+ events: z.ZodType<("User.Created" | "User.Deleted" | "Role.Created" | "Role.Deleted" | "Scope.Created" | "Scope.Deleted" | "Organization.Created" | "Organization.Deleted" | "OrganizationRole.Created" | "OrganizationRole.Deleted" | "OrganizationScope.Created" | "OrganizationScope.Deleted" | "User.Data.Updated" | "Role.Data.Updated" | "Scope.Data.Updated" | "Organization.Data.Updated" | "OrganizationRole.Data.Updated" | "OrganizationScope.Data.Updated" | "User.SuspensionStatus.Updated" | "Role.Scopes.Updated" | "Organization.Membership.Updated" | "OrganizationRole.Scopes.Updated" | "Identifier.Lockout" | "Message.RateLimited" | "Grant.LimitExceeded" | InteractionHookEvent)[], z.ZodTypeDef, ("User.Created" | "User.Deleted" | "Role.Created" | "Role.Deleted" | "Scope.Created" | "Scope.Deleted" | "Organization.Created" | "Organization.Deleted" | "OrganizationRole.Created" | "OrganizationRole.Deleted" | "OrganizationScope.Created" | "OrganizationScope.Deleted" | "User.Data.Updated" | "Role.Data.Updated" | "Scope.Data.Updated" | "Organization.Data.Updated" | "OrganizationRole.Data.Updated" | "OrganizationScope.Data.Updated" | "User.SuspensionStatus.Updated" | "Role.Scopes.Updated" | "Organization.Membership.Updated" | "OrganizationRole.Scopes.Updated" | "Identifier.Lockout" | "Message.RateLimited" | "Grant.LimitExceeded" | InteractionHookEvent)[]>;
23
23
  config: z.ZodType<{
24
24
  url: string;
25
25
  headers?: Record<string, string> | undefined;
@@ -143,5 +143,12 @@ export type DataHookEventPayload = {
143
143
  export type ExceptionHookEventPayload = Omit<DataHookEventPayload, 'event'> & {
144
144
  event: ExceptionHookEvent;
145
145
  };
146
+ export type GrantLimitExceededEventData = {
147
+ userId: string;
148
+ applicationId: string;
149
+ revokedGrantIds: string[];
150
+ maxAllowedGrants: number;
151
+ preRevocationActiveGrantCount: number;
152
+ };
146
153
  export type HookEventPayload = InteractionHookEventPayload | DataHookEventPayload | ExceptionHookEventPayload;
147
154
  export {};
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * User interaction events defined in Logto RFC 0004.
4
+ * @see {@link https://github.com/logto-io/rfcs | Logto RFCs} for more information.
5
+ */
6
+ export declare enum InteractionEvent {
7
+ SignIn = "SignIn",
8
+ Register = "Register",
9
+ ForgotPassword = "ForgotPassword"
10
+ }
11
+ export declare const eventGuard: z.ZodNativeEnum<typeof InteractionEvent>;
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * User interaction events defined in Logto RFC 0004.
4
+ * @see {@link https://github.com/logto-io/rfcs | Logto RFCs} for more information.
5
+ */
6
+ export var InteractionEvent;
7
+ (function (InteractionEvent) {
8
+ InteractionEvent["SignIn"] = "SignIn";
9
+ InteractionEvent["Register"] = "Register";
10
+ InteractionEvent["ForgotPassword"] = "ForgotPassword";
11
+ })(InteractionEvent || (InteractionEvent = {}));
12
+ export const eventGuard = z.nativeEnum(InteractionEvent);
@@ -1,15 +1,8 @@
1
1
  import { z } from 'zod';
2
2
  import { AdditionalIdentifier, MfaFactor, SignInIdentifier } from '../foundations/index.js';
3
+ import { InteractionEvent } from './interaction-event.js';
3
4
  import type { EmailVerificationCodePayload, PhoneVerificationCodePayload } from './verification-code.js';
4
- /**
5
- * User interaction events defined in Logto RFC 0004.
6
- * @see {@link https://github.com/logto-io/rfcs | Logto RFCs} for more information.
7
- */
8
- export declare enum InteractionEvent {
9
- SignIn = "SignIn",
10
- Register = "Register",
11
- ForgotPassword = "ForgotPassword"
12
- }
5
+ export { eventGuard, InteractionEvent } from './interaction-event.js';
13
6
  export type VerificationIdentifier = {
14
7
  type: SignInIdentifier | AdditionalIdentifier;
15
8
  value: string;
@@ -377,7 +370,6 @@ export declare const socialPhonePayloadGuard: z.ZodObject<{
377
370
  connectorId: string;
378
371
  }>;
379
372
  export type SocialPhonePayload = z.infer<typeof socialPhonePayloadGuard>;
380
- export declare const eventGuard: z.ZodNativeEnum<typeof InteractionEvent>;
381
373
  export declare const identifierPayloadGuard: z.ZodUnion<[z.ZodObject<{
382
374
  username: z.ZodString;
383
375
  password: z.ZodString;
@@ -1181,4 +1173,3 @@ export declare const verifyMfaResultGuard: z.ZodObject<{
1181
1173
  id: string;
1182
1174
  }>;
1183
1175
  export type VerifyMfaResult = z.infer<typeof verifyMfaResultGuard>;
1184
- export {};
@@ -2,17 +2,9 @@
2
2
  import { emailRegEx, numberAndAlphabetRegEx, phoneRegEx, usernameRegEx } from '@logto/core-kit';
3
3
  import { z } from 'zod';
4
4
  import { AdditionalIdentifier, MfaFactor, SignInIdentifier, jsonObjectGuard, webAuthnTransportGuard, } from '../foundations/index.js';
5
+ import { InteractionEvent } from './interaction-event.js';
5
6
  import { emailVerificationCodePayloadGuard, phoneVerificationCodePayloadGuard, } from './verification-code.js';
6
- /**
7
- * User interaction events defined in Logto RFC 0004.
8
- * @see {@link https://github.com/logto-io/rfcs | Logto RFCs} for more information.
9
- */
10
- export var InteractionEvent;
11
- (function (InteractionEvent) {
12
- InteractionEvent["SignIn"] = "SignIn";
13
- InteractionEvent["Register"] = "Register";
14
- InteractionEvent["ForgotPassword"] = "ForgotPassword";
15
- })(InteractionEvent || (InteractionEvent = {}));
7
+ export { eventGuard, InteractionEvent } from './interaction-event.js';
16
8
  export const verificationIdentifierGuard = z.object({
17
9
  type: z.union([z.nativeEnum(SignInIdentifier), z.nativeEnum(AdditionalIdentifier)]),
18
10
  value: z.string(),
@@ -24,7 +16,9 @@ export const interactionIdentifierGuard = z.object({
24
16
  export const verificationCodeIdentifierGuard = z.discriminatedUnion('type', [
25
17
  z.object({
26
18
  type: z.literal(SignInIdentifier.Email),
27
- value: z.string().regex(emailRegEx),
19
+ // `.max(256)` caps the input length as defense-in-depth for downstream email processing
20
+ // (a valid address is at most 254 chars per RFC 5321).
21
+ value: z.string().max(256).regex(emailRegEx),
28
22
  }),
29
23
  z.object({
30
24
  type: z.literal(SignInIdentifier.Phone),
@@ -129,7 +123,6 @@ export const socialPhonePayloadGuard = z.object({
129
123
  connectorId: z.string(),
130
124
  phone: z.string(),
131
125
  });
132
- export const eventGuard = z.nativeEnum(InteractionEvent);
133
126
  export const identifierPayloadGuard = z.union([
134
127
  usernamePasswordPayloadGuard,
135
128
  emailPasswordPayloadGuard,
@@ -0,0 +1,7 @@
1
+ export type Prefix = 'Action';
2
+ export declare const prefix: Prefix;
3
+ export declare enum Type {
4
+ PostFirstFactorVerification = "PostFirstFactorVerification",
5
+ PostSignIn = "PostSignIn"
6
+ }
7
+ export type LogKey = `${Prefix}.${Type}`;
@@ -0,0 +1,6 @@
1
+ export const prefix = 'Action';
2
+ export var Type;
3
+ (function (Type) {
4
+ Type["PostFirstFactorVerification"] = "PostFirstFactorVerification";
5
+ Type["PostSignIn"] = "PostSignIn";
6
+ })(Type || (Type = {}));
@@ -1,3 +1,4 @@
1
+ import type * as action from './action.js';
1
2
  import type * as hook from './hook.js';
2
3
  import type * as interaction from './interaction.js';
3
4
  import type * as jwtCustomizer from './jwt-customizer.js';
@@ -6,6 +7,7 @@ import type * as token from './token.js';
6
7
  export * as interaction from './interaction.js';
7
8
  export * as token from './token.js';
8
9
  export * as hook from './hook.js';
10
+ export * as action from './action.js';
9
11
  export * as jwtCustomizer from './jwt-customizer.js';
10
12
  export * as saml from './saml.js';
11
13
  /** Fallback for empty or unrecognized log keys. */
@@ -13,6 +15,7 @@ export declare const LogKeyUnknown = "Unknown";
13
15
  export type InteractionLogKey = interaction.LogKey;
14
16
  export type TokenLogKey = token.LogKey;
15
17
  export type WebhookLogKey = hook.LogKey;
18
+ export type ActionLogKey = action.LogKey;
16
19
  export type JwtCustomizerLogKey = jwtCustomizer.LogKey;
17
20
  export type SamlLogKey = saml.LogKey;
18
21
  /**
@@ -21,11 +24,11 @@ export type SamlLogKey = saml.LogKey;
21
24
  * - All user-facing audit log keys should be included here.
22
25
  * - Webhook log keys are excluded.
23
26
  */
24
- export type AuditLogKey = typeof LogKeyUnknown | InteractionLogKey | TokenLogKey | SamlLogKey | JwtCustomizerLogKey;
27
+ export type AuditLogKey = typeof LogKeyUnknown | InteractionLogKey | TokenLogKey | SamlLogKey | ActionLogKey | JwtCustomizerLogKey;
25
28
  /**
26
29
  * The union type of all available log keys.
27
30
  * Note duplicate keys are allowed but should be avoided.
28
31
  **/
29
32
  export type LogKey = AuditLogKey | WebhookLogKey;
30
- export type AuditLogPrefix = interaction.Prefix | token.Type | saml.Prefix | jwtCustomizer.Prefix | typeof LogKeyUnknown;
33
+ export type AuditLogPrefix = interaction.Prefix | token.Type | saml.Prefix | action.Prefix | jwtCustomizer.Prefix | typeof LogKeyUnknown;
31
34
  export type WebhookLogPrefix = hook.Type;
@@ -1,6 +1,7 @@
1
1
  export * as interaction from './interaction.js';
2
2
  export * as token from './token.js';
3
3
  export * as hook from './hook.js';
4
+ export * as action from './action.js';
4
5
  export * as jwtCustomizer from './jwt-customizer.js';
5
6
  export * as saml from './saml.js';
6
7
  /** Fallback for empty or unrecognized log keys. */