@logto/schemas 1.33.0 → 1.34.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.
@@ -0,0 +1,19 @@
1
+ import { sql } from '@silverhand/slonik';
2
+
3
+ import type { AlterationScript } from '../lib/types/alteration.js';
4
+
5
+ const alteration: AlterationScript = {
6
+ up: async (pool) => {
7
+ await pool.query(sql`
8
+ create index organization_roles__type
9
+ on organization_roles (tenant_id, type);
10
+ `);
11
+ },
12
+ down: async (pool) => {
13
+ await pool.query(sql`
14
+ drop index organization_roles__type;
15
+ `);
16
+ },
17
+ };
18
+
19
+ export default alteration;
@@ -0,0 +1,38 @@
1
+ import { sql } from '@silverhand/slonik';
2
+
3
+ import type { AlterationScript } from '../lib/types/alteration.js';
4
+
5
+ const alteration: AlterationScript = {
6
+ up: async (pool) => {
7
+ await pool.query(sql`
8
+ create index applications__include_type_is_third_party
9
+ on applications (tenant_id) include (type, is_third_party);
10
+ `);
11
+
12
+ // Update table statistics to help query planner use the new index efficiently
13
+ await pool.query(sql`
14
+ analyze applications;
15
+ `);
16
+
17
+ await pool.query(sql`
18
+ create index roles__include_type_name
19
+ on roles (tenant_id) include (type, name);
20
+ `);
21
+
22
+ // Update table statistics to help query planner use the new index efficiently
23
+ await pool.query(sql`
24
+ analyze roles;
25
+ `);
26
+ },
27
+ down: async (pool) => {
28
+ await pool.query(sql`
29
+ drop index if exists applications__include_type_is_third_party;
30
+ `);
31
+
32
+ await pool.query(sql`
33
+ drop index if exists roles__include_type_name;
34
+ `);
35
+ },
36
+ };
37
+
38
+ export default alteration;
@@ -0,0 +1,38 @@
1
+ import { sql } from '@silverhand/slonik';
2
+
3
+ import type { AlterationScript } from '../lib/types/alteration.js';
4
+
5
+ const alteration: AlterationScript = {
6
+ up: async (pool) => {
7
+ await pool.query(sql`
8
+ drop index if exists applications__include_type_is_third_party;
9
+ `);
10
+
11
+ await pool.query(sql`
12
+ drop index if exists roles__include_type_name;
13
+ `);
14
+ },
15
+ down: async (pool) => {
16
+ await pool.query(sql`
17
+ create index applications__include_type_is_third_party
18
+ on applications (tenant_id) include (type, is_third_party);
19
+ `);
20
+
21
+ // Update table statistics to help query planner use the new index efficiently
22
+ await pool.query(sql`
23
+ analyze applications;
24
+ `);
25
+
26
+ await pool.query(sql`
27
+ create index roles__include_type_name
28
+ on roles (tenant_id) include (type, name);
29
+ `);
30
+
31
+ // Update table statistics to help query planner use the new index efficiently
32
+ await pool.query(sql`
33
+ analyze roles;
34
+ `);
35
+ },
36
+ };
37
+
38
+ export default alteration;
@@ -0,0 +1,15 @@
1
+ import { sql } from '@silverhand/slonik';
2
+ const alteration = {
3
+ up: async (pool) => {
4
+ await pool.query(sql `
5
+ create index organization_roles__type
6
+ on organization_roles (tenant_id, type);
7
+ `);
8
+ },
9
+ down: async (pool) => {
10
+ await pool.query(sql `
11
+ drop index organization_roles__type;
12
+ `);
13
+ },
14
+ };
15
+ export default alteration;
@@ -0,0 +1,30 @@
1
+ import { sql } from '@silverhand/slonik';
2
+ const alteration = {
3
+ up: async (pool) => {
4
+ await pool.query(sql `
5
+ create index applications__include_type_is_third_party
6
+ on applications (tenant_id) include (type, is_third_party);
7
+ `);
8
+ // Update table statistics to help query planner use the new index efficiently
9
+ await pool.query(sql `
10
+ analyze applications;
11
+ `);
12
+ await pool.query(sql `
13
+ create index roles__include_type_name
14
+ on roles (tenant_id) include (type, name);
15
+ `);
16
+ // Update table statistics to help query planner use the new index efficiently
17
+ await pool.query(sql `
18
+ analyze roles;
19
+ `);
20
+ },
21
+ down: async (pool) => {
22
+ await pool.query(sql `
23
+ drop index if exists applications__include_type_is_third_party;
24
+ `);
25
+ await pool.query(sql `
26
+ drop index if exists roles__include_type_name;
27
+ `);
28
+ },
29
+ };
30
+ export default alteration;
@@ -0,0 +1,30 @@
1
+ import { sql } from '@silverhand/slonik';
2
+ const alteration = {
3
+ up: async (pool) => {
4
+ await pool.query(sql `
5
+ drop index if exists applications__include_type_is_third_party;
6
+ `);
7
+ await pool.query(sql `
8
+ drop index if exists roles__include_type_name;
9
+ `);
10
+ },
11
+ down: async (pool) => {
12
+ await pool.query(sql `
13
+ create index applications__include_type_is_third_party
14
+ on applications (tenant_id) include (type, is_third_party);
15
+ `);
16
+ // Update table statistics to help query planner use the new index efficiently
17
+ await pool.query(sql `
18
+ analyze applications;
19
+ `);
20
+ await pool.query(sql `
21
+ create index roles__include_type_name
22
+ on roles (tenant_id) include (type, name);
23
+ `);
24
+ // Update table statistics to help query planner use the new index efficiently
25
+ await pool.query(sql `
26
+ analyze roles;
27
+ `);
28
+ },
29
+ };
30
+ export default alteration;
@@ -1,9 +1,10 @@
1
1
  import { z } from 'zod';
2
2
  /**
3
- * We categorize the hook events into two types:
3
+ * We categorize the hook events into three types:
4
4
  *
5
5
  * InteractionHookEvent: The hook events that are triggered by user interactions.
6
6
  * DataHookEvent: The hook events that are triggered by Logto data mutations.
7
+ * ExceptionHookEvent: The hook events that are triggered on exceptions.
7
8
  */
8
9
  export declare enum InteractionHookEvent {
9
10
  PostRegister = "PostRegister",
@@ -28,13 +29,14 @@ declare enum DataHookDetailMutationType {
28
29
  type BasicDataHookEvent = `${DataHookSchema}.${DataHookBasicMutationType}`;
29
30
  type CustomDataHookMutableSchema = `${DataHookSchema}.Data` | `${DataHookSchema.User}.SuspensionStatus` | `${DataHookSchema.Role}.Scopes` | `${DataHookSchema.Organization}.Membership` | `${DataHookSchema.OrganizationRole}.Scopes`;
30
31
  type DataHookPropertyUpdateEvent = `${CustomDataHookMutableSchema}.${DataHookDetailMutationType.Updated}`;
32
+ export type ExceptionHookEvent = 'Identifier.Lockout';
31
33
  export type DataHookEvent = BasicDataHookEvent | DataHookPropertyUpdateEvent;
32
34
  /** The hook event values that can be registered. */
33
- export declare const hookEvents: readonly [InteractionHookEvent.PostRegister, InteractionHookEvent.PostSignIn, InteractionHookEvent.PostResetPassword, "User.Created", "User.Deleted", "User.Data.Updated", "User.SuspensionStatus.Updated", "Role.Created", "Role.Deleted", "Role.Data.Updated", "Role.Scopes.Updated", "Scope.Created", "Scope.Deleted", "Scope.Data.Updated", "Organization.Created", "Organization.Deleted", "Organization.Data.Updated", "Organization.Membership.Updated", "OrganizationRole.Created", "OrganizationRole.Deleted", "OrganizationRole.Data.Updated", "OrganizationRole.Scopes.Updated", "OrganizationScope.Created", "OrganizationScope.Deleted", "OrganizationScope.Data.Updated"];
35
+ export declare const hookEvents: readonly [InteractionHookEvent.PostRegister, InteractionHookEvent.PostSignIn, InteractionHookEvent.PostResetPassword, "User.Created", "User.Deleted", "User.Data.Updated", "User.SuspensionStatus.Updated", "Role.Created", "Role.Deleted", "Role.Data.Updated", "Role.Scopes.Updated", "Scope.Created", "Scope.Deleted", "Scope.Data.Updated", "Organization.Created", "Organization.Deleted", "Organization.Data.Updated", "Organization.Membership.Updated", "OrganizationRole.Created", "OrganizationRole.Deleted", "OrganizationRole.Data.Updated", "OrganizationRole.Scopes.Updated", "OrganizationScope.Created", "OrganizationScope.Deleted", "OrganizationScope.Data.Updated", "Identifier.Lockout"];
34
36
  /** The type of hook event values that can be registered. */
35
37
  export type HookEvent = (typeof hookEvents)[number];
36
- export declare const hookEventGuard: z.ZodEnum<[InteractionHookEvent.PostRegister, InteractionHookEvent.PostSignIn, InteractionHookEvent.PostResetPassword, "User.Created", "User.Deleted", "User.Data.Updated", "User.SuspensionStatus.Updated", "Role.Created", "Role.Deleted", "Role.Data.Updated", "Role.Scopes.Updated", "Scope.Created", "Scope.Deleted", "Scope.Data.Updated", "Organization.Created", "Organization.Deleted", "Organization.Data.Updated", "Organization.Membership.Updated", "OrganizationRole.Created", "OrganizationRole.Deleted", "OrganizationRole.Data.Updated", "OrganizationRole.Scopes.Updated", "OrganizationScope.Created", "OrganizationScope.Deleted", "OrganizationScope.Data.Updated"]>;
37
- export declare const hookEventsGuard: z.ZodArray<z.ZodEnum<[InteractionHookEvent.PostRegister, InteractionHookEvent.PostSignIn, InteractionHookEvent.PostResetPassword, "User.Created", "User.Deleted", "User.Data.Updated", "User.SuspensionStatus.Updated", "Role.Created", "Role.Deleted", "Role.Data.Updated", "Role.Scopes.Updated", "Scope.Created", "Scope.Deleted", "Scope.Data.Updated", "Organization.Created", "Organization.Deleted", "Organization.Data.Updated", "Organization.Membership.Updated", "OrganizationRole.Created", "OrganizationRole.Deleted", "OrganizationRole.Data.Updated", "OrganizationRole.Scopes.Updated", "OrganizationScope.Created", "OrganizationScope.Deleted", "OrganizationScope.Data.Updated"]>, "many">;
38
+ export declare const hookEventGuard: z.ZodEnum<[InteractionHookEvent.PostRegister, InteractionHookEvent.PostSignIn, InteractionHookEvent.PostResetPassword, "User.Created", "User.Deleted", "User.Data.Updated", "User.SuspensionStatus.Updated", "Role.Created", "Role.Deleted", "Role.Data.Updated", "Role.Scopes.Updated", "Scope.Created", "Scope.Deleted", "Scope.Data.Updated", "Organization.Created", "Organization.Deleted", "Organization.Data.Updated", "Organization.Membership.Updated", "OrganizationRole.Created", "OrganizationRole.Deleted", "OrganizationRole.Data.Updated", "OrganizationRole.Scopes.Updated", "OrganizationScope.Created", "OrganizationScope.Deleted", "OrganizationScope.Data.Updated", "Identifier.Lockout"]>;
39
+ export declare const hookEventsGuard: z.ZodArray<z.ZodEnum<[InteractionHookEvent.PostRegister, InteractionHookEvent.PostSignIn, InteractionHookEvent.PostResetPassword, "User.Created", "User.Deleted", "User.Data.Updated", "User.SuspensionStatus.Updated", "Role.Created", "Role.Deleted", "Role.Data.Updated", "Role.Scopes.Updated", "Scope.Created", "Scope.Deleted", "Scope.Data.Updated", "Organization.Created", "Organization.Deleted", "Organization.Data.Updated", "Organization.Membership.Updated", "OrganizationRole.Created", "OrganizationRole.Deleted", "OrganizationRole.Data.Updated", "OrganizationRole.Scopes.Updated", "OrganizationScope.Created", "OrganizationScope.Deleted", "OrganizationScope.Data.Updated", "Identifier.Lockout"]>, "many">;
38
40
  export type HookEvents = z.infer<typeof hookEventsGuard>;
39
41
  export declare const interactionHookEventGuard: z.ZodNativeEnum<typeof InteractionHookEvent>;
40
42
  /**
@@ -1,9 +1,10 @@
1
1
  import { z } from 'zod';
2
2
  /**
3
- * We categorize the hook events into two types:
3
+ * We categorize the hook events into three types:
4
4
  *
5
5
  * InteractionHookEvent: The hook events that are triggered by user interactions.
6
6
  * DataHookEvent: The hook events that are triggered by Logto data mutations.
7
+ * ExceptionHookEvent: The hook events that are triggered on exceptions.
7
8
  */
8
9
  // InteractionHookEvent
9
10
  export var InteractionHookEvent;
@@ -58,6 +59,7 @@ export const hookEvents = Object.freeze([
58
59
  'OrganizationScope.Created',
59
60
  'OrganizationScope.Deleted',
60
61
  'OrganizationScope.Data.Updated',
62
+ 'Identifier.Lockout',
61
63
  ]);
62
64
  export const hookEventGuard = z.enum(hookEvents);
63
65
  export const hookEventsGuard = hookEventGuard.array();
@@ -49,7 +49,7 @@ export const customClientMetadataGuard = z.object({
49
49
  [CustomClientMetadataKey.CorsAllowedOrigins]: z.string().min(1).array().optional(),
50
50
  [CustomClientMetadataKey.IdTokenTtl]: z.number().optional(),
51
51
  [CustomClientMetadataKey.RefreshTokenTtl]: z.number().optional(),
52
- [CustomClientMetadataKey.RefreshTokenTtlInDays]: z.number().int().min(1).max(90).optional(),
52
+ [CustomClientMetadataKey.RefreshTokenTtlInDays]: z.number().int().min(1).max(180).optional(),
53
53
  [CustomClientMetadataKey.TenantId]: z.string().optional(),
54
54
  [CustomClientMetadataKey.AlwaysIssueRefreshToken]: z.boolean().optional(),
55
55
  [CustomClientMetadataKey.RotateRefreshToken]: z.boolean().optional(),
@@ -6,7 +6,13 @@ import type { Application, CreateApplication, CreateApplicationsRole } from '../
6
6
  */
7
7
  export declare const adminConsoleApplicationId = "admin-console";
8
8
  export declare const demoAppApplicationId = "demo-app";
9
+ export declare const accountCenterApplicationId = "account-center";
9
10
  export declare const buildDemoAppDataForTenant: (tenantId: string) => Application;
11
+ export declare const buildAccountCenterAppDataForTenant: (tenantId: string) => Application;
12
+ export type BuiltInApplicationId = typeof demoAppApplicationId | typeof accountCenterApplicationId;
13
+ export declare const isBuiltInApplicationId: (applicationId: string) => applicationId is BuiltInApplicationId;
14
+ export declare const isBuiltInClientId: (applicationId: string) => applicationId is BuiltInApplicationId;
15
+ export declare const buildBuiltInApplicationDataForTenant: (tenantId: string, applicationId: BuiltInApplicationId) => Application;
10
16
  export declare const createDefaultAdminConsoleApplication: () => Readonly<CreateApplication>;
11
17
  export declare const createTenantMachineToMachineApplication: (tenantId: string) => Readonly<CreateApplication>;
12
18
  /** Create an entry to assign a role to an application in the admin tenant. */
@@ -8,12 +8,13 @@ import { adminTenantId } from './tenant.js';
8
8
  */
9
9
  export const adminConsoleApplicationId = 'admin-console';
10
10
  export const demoAppApplicationId = 'demo-app';
11
- export const buildDemoAppDataForTenant = (tenantId) => ({
11
+ export const accountCenterApplicationId = 'account-center';
12
+ const buildSpaApplicationData = (tenantId, { id, name, description, }) => ({
12
13
  tenantId,
13
- id: demoAppApplicationId,
14
- name: 'Live Preview',
14
+ id,
15
+ name,
15
16
  secret: 'N/A',
16
- description: 'Preview for Sign-in Experience.',
17
+ description,
17
18
  type: ApplicationType.SPA,
18
19
  oidcClientMetadata: { redirectUris: [], postLogoutRedirectUris: [] },
19
20
  customClientMetadata: {},
@@ -22,6 +23,24 @@ export const buildDemoAppDataForTenant = (tenantId) => ({
22
23
  createdAt: 0,
23
24
  customData: {},
24
25
  });
26
+ export const buildDemoAppDataForTenant = (tenantId) => buildSpaApplicationData(tenantId, {
27
+ id: demoAppApplicationId,
28
+ name: 'Live Preview',
29
+ description: 'Preview for Sign-in Experience.',
30
+ });
31
+ export const buildAccountCenterAppDataForTenant = (tenantId) => buildSpaApplicationData(tenantId, {
32
+ id: accountCenterApplicationId,
33
+ name: 'Account Center',
34
+ description: 'Placeholder application for Account Center.',
35
+ });
36
+ export const isBuiltInApplicationId = (applicationId) => applicationId === demoAppApplicationId || applicationId === accountCenterApplicationId;
37
+ export const isBuiltInClientId = isBuiltInApplicationId;
38
+ export const buildBuiltInApplicationDataForTenant = (tenantId, applicationId) => {
39
+ if (applicationId === demoAppApplicationId) {
40
+ return buildDemoAppDataForTenant(tenantId);
41
+ }
42
+ return buildAccountCenterAppDataForTenant(tenantId);
43
+ };
25
44
  export const createDefaultAdminConsoleApplication = () => Object.freeze({
26
45
  tenantId: adminTenantId,
27
46
  id: adminConsoleApplicationId,
@@ -1,5 +1,5 @@
1
1
  import { type z } from 'zod';
2
- export declare const domainSelectFields: readonly ["id", "domain", "status", "errorMessage", "dnsRecords"];
2
+ export declare const domainSelectFields: readonly ["id", "domain", "status", "errorMessage", "dnsRecords", "createdAt"];
3
3
  export declare const domainResponseGuard: z.ZodObject<Pick<{
4
4
  tenantId: z.ZodType<string, z.ZodTypeDef, string>;
5
5
  id: z.ZodType<string, z.ZodTypeDef, string>;
@@ -38,15 +38,17 @@ export declare const domainResponseGuard: z.ZodObject<Pick<{
38
38
  } | null>;
39
39
  updatedAt: z.ZodType<number, z.ZodTypeDef, number>;
40
40
  createdAt: z.ZodType<number, z.ZodTypeDef, number>;
41
- }, "status" | "id" | "domain" | "errorMessage" | "dnsRecords">, "strip", z.ZodTypeAny, {
41
+ }, "status" | "id" | "createdAt" | "domain" | "errorMessage" | "dnsRecords">, "strip", z.ZodTypeAny, {
42
42
  status: import("../index.js").DomainStatus;
43
43
  id: string;
44
+ createdAt: number;
44
45
  domain: string;
45
46
  errorMessage: string | null;
46
47
  dnsRecords: import("../index.js").DomainDnsRecords;
47
48
  }, {
48
49
  status: import("../index.js").DomainStatus;
49
50
  id: string;
51
+ createdAt: number;
50
52
  domain: string;
51
53
  errorMessage: string | null;
52
54
  dnsRecords: import("../index.js").DomainDnsRecords;
@@ -5,6 +5,7 @@ export const domainSelectFields = Object.freeze([
5
5
  'status',
6
6
  'errorMessage',
7
7
  'dnsRecords',
8
+ 'createdAt',
8
9
  ]);
9
10
  export const domainResponseGuard = Domains.guard.pick({
10
11
  id: true,
@@ -12,4 +13,5 @@ export const domainResponseGuard = Domains.guard.pick({
12
13
  status: true,
13
14
  errorMessage: true,
14
15
  dnsRecords: true,
16
+ createdAt: true,
15
17
  });
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { type Application, type User } from '../db-entries/index.js';
3
- import { type DataHookEvent, type InteractionHookEvent } from '../foundations/index.js';
3
+ import { type ExceptionHookEvent, type DataHookEvent, type InteractionHookEvent } from '../foundations/index.js';
4
4
  import { type InteractionEvent } from './interactions.js';
5
5
  import { type userInfoSelectFields } from './user.js';
6
6
  declare const hookExecutionStatsGuard: z.ZodObject<{
@@ -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 | 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 | 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)[], 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)[]>;
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")[]>;
23
23
  config: z.ZodType<{
24
24
  url: string;
25
25
  headers?: Record<string, string> | undefined;
@@ -140,5 +140,8 @@ export type DataHookEventPayload = {
140
140
  userAgent?: string;
141
141
  data?: unknown;
142
142
  } & Partial<InteractionApiContextPayload> & Partial<ManagementApiContext> & Record<string, unknown>;
143
- export type HookEventPayload = InteractionHookEventPayload | DataHookEventPayload;
143
+ export type ExceptionHookEventPayload = Omit<DataHookEventPayload, 'event'> & {
144
+ event: ExceptionHookEvent;
145
+ };
146
+ export type HookEventPayload = InteractionHookEventPayload | DataHookEventPayload | ExceptionHookEventPayload;
144
147
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logto/schemas",
3
- "version": "1.33.0",
3
+ "version": "1.34.0",
4
4
  "author": "Silverhand Inc. <contact@silverhand.io>",
5
5
  "license": "MPL-2.0",
6
6
  "type": "module",
@@ -65,10 +65,10 @@
65
65
  "dependencies": {
66
66
  "@withtyped/server": "^0.14.0",
67
67
  "nanoid": "^5.0.9",
68
- "@logto/language-kit": "^1.2.0",
69
- "@logto/core-kit": "^2.6.1",
70
68
  "@logto/connector-kit": "^4.6.0",
71
- "@logto/phrases": "^1.22.0",
69
+ "@logto/core-kit": "^2.6.1",
70
+ "@logto/language-kit": "^1.2.0",
71
+ "@logto/phrases": "^1.23.0",
72
72
  "@logto/phrases-experience": "^1.12.0",
73
73
  "@logto/shared": "^3.3.0"
74
74
  },
@@ -20,6 +20,9 @@ create table organization_roles (
20
20
  create index organization_roles__id
21
21
  on organization_roles (tenant_id, id);
22
22
 
23
+ create index organization_roles__type
24
+ on organization_roles (tenant_id, type);
25
+
23
26
  create function check_organization_role_type(role_id varchar(21), target_type role_type) returns boolean as
24
27
  $$ begin
25
28
  return (select type from organization_roles where id = role_id) = target_type;