@logto/schemas 1.42.0 → 1.43.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 (113) 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-js/1.43.0-1785393731-add-oidc-model-instances-account-id-partial-index.js +28 -0
  12. package/alterations-js/1.43.0-1785481546-add-tenant-aware-scope-indexes.js +28 -0
  13. package/alterations-js/1.43.0-1785488115-add-cimd-permission-ceiling-tables.js +69 -0
  14. package/alterations-js/1.43.0-1785722831-add-oidc-session-extensions-account-id-index.js +23 -0
  15. package/alterations-js/1.43.0-1785835991-add-cimd-client-identifier-columns.js +27 -0
  16. package/alterations-js/1.43.0-1786325989-add-cimd-grant-organizations-table.js +49 -0
  17. package/alterations-js/1.43.0-1786333495-add-trusted-devices.js +50 -0
  18. package/alterations-js/1.43.0-1786373004-tighten-cimd-grant-organizations-pkey.js +24 -0
  19. package/alterations-js/1.43.0-1786414712-add-service-logs-email-indexes.js +30 -0
  20. package/alterations-js/1.43.0-1786431364-add-cimd-grant-client-snapshots-table.js +38 -0
  21. package/lib/consts/index.d.ts +1 -0
  22. package/lib/consts/index.js +1 -0
  23. package/lib/consts/product-event.d.ts +5 -1
  24. package/lib/consts/product-event.js +4 -0
  25. package/lib/consts/social-state.d.ts +12 -0
  26. package/lib/consts/social-state.js +12 -0
  27. package/lib/db-entries/cimd-grant-client-snapshot.d.ts +32 -0
  28. package/lib/db-entries/cimd-grant-client-snapshot.js +45 -0
  29. package/lib/db-entries/cimd-grant-organization.d.ts +30 -0
  30. package/lib/db-entries/cimd-grant-organization.js +37 -0
  31. package/lib/db-entries/cimd-organization-resource-scope.d.ts +20 -0
  32. package/lib/db-entries/cimd-organization-resource-scope.js +25 -0
  33. package/lib/db-entries/cimd-organization-scope.d.ts +20 -0
  34. package/lib/db-entries/cimd-organization-scope.js +25 -0
  35. package/lib/db-entries/cimd-resource-scope.d.ts +20 -0
  36. package/lib/db-entries/cimd-resource-scope.js +25 -0
  37. package/lib/db-entries/cimd-user-scope.d.ts +20 -0
  38. package/lib/db-entries/cimd-user-scope.js +25 -0
  39. package/lib/db-entries/index.d.ts +7 -0
  40. package/lib/db-entries/index.js +7 -0
  41. package/lib/db-entries/oidc-session-extension.d.ts +3 -1
  42. package/lib/db-entries/oidc-session-extension.js +4 -0
  43. package/lib/db-entries/organization.d.ts +5 -1
  44. package/lib/db-entries/organization.js +4 -0
  45. package/lib/db-entries/sign-in-experience.d.ts +4 -2
  46. package/lib/db-entries/sign-in-experience.js +5 -1
  47. package/lib/db-entries/trusted-device.d.ts +36 -0
  48. package/lib/db-entries/trusted-device.js +62 -0
  49. package/lib/db-entries/user.d.ts +3 -1
  50. package/lib/db-entries/user.js +4 -0
  51. package/lib/foundations/jsonb-types/account-centers.d.ts +3 -0
  52. package/lib/foundations/jsonb-types/account-centers.js +1 -0
  53. package/lib/foundations/jsonb-types/account-centers.test.d.ts +1 -0
  54. package/lib/foundations/jsonb-types/account-centers.test.js +13 -0
  55. package/lib/foundations/jsonb-types/hooks.d.ts +8 -4
  56. package/lib/foundations/jsonb-types/hooks.js +7 -0
  57. package/lib/foundations/jsonb-types/logs.d.ts +18 -0
  58. package/lib/foundations/jsonb-types/logs.js +6 -0
  59. package/lib/foundations/jsonb-types/sign-in-experience.d.ts +23 -3
  60. package/lib/foundations/jsonb-types/sign-in-experience.js +9 -0
  61. package/lib/foundations/jsonb-types/sign-in-experience.test.js +17 -1
  62. package/lib/types/connector.d.ts +8 -0
  63. package/lib/types/consent.d.ts +16 -190
  64. package/lib/types/consent.js +10 -1
  65. package/lib/types/custom-profile-fields.d.ts +1 -0
  66. package/lib/types/hook.d.ts +31 -6
  67. package/lib/types/index.d.ts +1 -0
  68. package/lib/types/index.js +1 -0
  69. package/lib/types/log/index.d.ts +5 -2
  70. package/lib/types/log/index.js +1 -0
  71. package/lib/types/log/trusted-device.d.ts +7 -0
  72. package/lib/types/log/trusted-device.js +6 -0
  73. package/lib/types/logto-config/action.d.ts +1 -1
  74. package/lib/types/logto-config/action.js +1 -1
  75. package/lib/types/logto-config/index.d.ts +36 -7
  76. package/lib/types/logto-config/index.js +13 -0
  77. package/lib/types/logto-config/index.test.js +23 -0
  78. package/lib/types/logto-config/jwt-customizer.d.ts +31 -10
  79. package/lib/types/logto-config/jwt-customizer.js +1 -1
  80. package/lib/types/logto-config/oidc-provider.d.ts +2 -2
  81. package/lib/types/service-log.d.ts +14 -1
  82. package/lib/types/service-log.js +13 -0
  83. package/lib/types/sign-in-experience.d.ts +18 -8
  84. package/lib/types/sign-in-experience.js +2 -1
  85. package/lib/types/system.d.ts +2 -2
  86. package/lib/types/trusted-device.d.ts +67 -0
  87. package/lib/types/trusted-device.js +16 -0
  88. package/lib/types/user-sessions.d.ts +39 -209
  89. package/lib/types/user-sessions.js +9 -4
  90. package/lib/types/user.d.ts +10 -3
  91. package/lib/types/user.js +1 -0
  92. package/lib/utils/cimd.d.ts +14 -0
  93. package/lib/utils/cimd.js +14 -0
  94. package/lib/utils/cimd.test.d.ts +1 -0
  95. package/lib/utils/cimd.test.js +9 -0
  96. package/lib/utils/index.d.ts +1 -0
  97. package/lib/utils/index.js +1 -0
  98. package/package.json +7 -7
  99. package/tables/cimd_grant_client_snapshots.sql +27 -0
  100. package/tables/cimd_grant_organizations.sql +38 -0
  101. package/tables/cimd_organization_resource_scopes.sql +16 -0
  102. package/tables/cimd_organization_scopes.sql +15 -0
  103. package/tables/cimd_resource_scopes.sql +15 -0
  104. package/tables/cimd_user_scopes.sql +13 -0
  105. package/tables/oidc_model_instances.sql +5 -0
  106. package/tables/oidc_session_extensions.sql +5 -0
  107. package/tables/organization_scopes.sql +4 -0
  108. package/tables/organizations.sql +2 -0
  109. package/tables/scopes.sql +4 -0
  110. package/tables/service_logs.sql +14 -0
  111. package/tables/sign_in_experiences.sql +1 -0
  112. package/tables/trusted_devices.sql +25 -0
  113. package/tables/users.sql +1 -0
@@ -0,0 +1,50 @@
1
+ import { sql } from '@silverhand/slonik';
2
+ import { applyTableRls, dropTableRls } from './utils/1704934999-tables.js';
3
+ const alteration = {
4
+ up: async (pool) => {
5
+ await pool.query(sql `
6
+ create table trusted_devices (
7
+ tenant_id varchar(21) not null
8
+ references tenants (id) on update cascade on delete cascade,
9
+ id varchar(21) not null,
10
+ user_id varchar(12) not null
11
+ references users (id) on update cascade on delete cascade,
12
+ secret_hash bytea not null,
13
+ user_agent text,
14
+ ip text,
15
+ country varchar(16),
16
+ city text,
17
+ created_at timestamptz not null default(now()),
18
+ last_used_at timestamptz not null default(now()),
19
+ expires_at timestamptz not null,
20
+ primary key (id)
21
+ );
22
+
23
+ create index trusted_devices__tenant_user_expires_at
24
+ on trusted_devices (tenant_id, user_id, expires_at);
25
+
26
+ create index trusted_devices__tenant_expires_at
27
+ on trusted_devices (tenant_id, expires_at);
28
+
29
+ alter table sign_in_experiences
30
+ add column trusted_device jsonb not null default '{}'::jsonb;
31
+
32
+ alter table organizations
33
+ add column is_trusted_device_allowed boolean not null default true;
34
+ `);
35
+ await applyTableRls(pool, 'trusted_devices');
36
+ },
37
+ down: async (pool) => {
38
+ await dropTableRls(pool, 'trusted_devices');
39
+ await pool.query(sql `
40
+ drop table trusted_devices;
41
+
42
+ alter table sign_in_experiences
43
+ drop column trusted_device;
44
+
45
+ alter table organizations
46
+ drop column is_trusted_device_allowed;
47
+ `);
48
+ },
49
+ };
50
+ export default alteration;
@@ -0,0 +1,24 @@
1
+ import { sql } from '@silverhand/slonik';
2
+ /**
3
+ * Tighten the `cimd_grant_organizations` primary key to `(tenant_id, grant_id)` so the schema
4
+ * itself enforces the at-most-one-organization-per-grant invariant that token issuance relies on,
5
+ * instead of leaving it to the consent flow's composition. The table is dev-feature-gated and
6
+ * empty in every environment, so swapping the constraint needs no data migration.
7
+ */
8
+ const alteration = {
9
+ up: async (pool) => {
10
+ await pool.query(sql `
11
+ alter table cimd_grant_organizations
12
+ drop constraint cimd_grant_organizations_pkey,
13
+ add primary key (tenant_id, grant_id);
14
+ `);
15
+ },
16
+ down: async (pool) => {
17
+ await pool.query(sql `
18
+ alter table cimd_grant_organizations
19
+ drop constraint cimd_grant_organizations_pkey,
20
+ add primary key (tenant_id, grant_id, organization_id);
21
+ `);
22
+ },
23
+ };
24
+ export default alteration;
@@ -0,0 +1,30 @@
1
+ import { sql } from '@silverhand/slonik';
2
+ const alteration = {
3
+ beforeUp: async (pool) => {
4
+ await pool.query(sql `
5
+ create index concurrently service_logs__email__tenant_id__created_at__id
6
+ on service_logs (tenant_id, created_at desc, id desc)
7
+ where type in ('sendEmail', 'sendEmailFailed');
8
+ `);
9
+ await pool.query(sql `
10
+ create index concurrently service_logs__email__tenant_id__recipient__created_at__id
11
+ on service_logs (tenant_id, lower(payload->'data'->>'to'), created_at desc, id desc)
12
+ where type in ('sendEmail', 'sendEmailFailed');
13
+ `);
14
+ },
15
+ up: async () => {
16
+ /** 'concurrently' cannot be used inside a transaction, so this up is intentionally left empty. */
17
+ },
18
+ beforeDown: async (pool) => {
19
+ await pool.query(sql `
20
+ drop index concurrently service_logs__email__tenant_id__recipient__created_at__id;
21
+ `);
22
+ await pool.query(sql `
23
+ drop index concurrently service_logs__email__tenant_id__created_at__id;
24
+ `);
25
+ },
26
+ down: async () => {
27
+ /** 'concurrently' cannot be used inside a transaction, so this down is intentionally left empty. */
28
+ },
29
+ };
30
+ export default alteration;
@@ -0,0 +1,38 @@
1
+ import { sql } from '@silverhand/slonik';
2
+ import { applyTableRls, dropTableRls } from './utils/1704934999-tables.js';
3
+ /**
4
+ * Add the per-grant client display snapshot table for client ID metadata document (CIMD) clients.
5
+ * CIMD clients are unregistered URL identities without an `applications` row, and an unvetted
6
+ * client can rewrite its hosted document at any time — so the grant list renders the snapshot
7
+ * captured at consent instead of refetching the document. Rows cascade away with the Grant row.
8
+ */
9
+ const alteration = {
10
+ up: async (pool) => {
11
+ await pool.query(sql `
12
+ create table cimd_grant_client_snapshots (
13
+ tenant_id varchar(21) not null
14
+ references tenants (id) on update cascade on delete cascade,
15
+ grant_id varchar(128) not null,
16
+ grant_model_name varchar(64) not null default 'Grant',
17
+ client_id varchar(2048) not null,
18
+ name varchar(256),
19
+ logo_uri varchar(2048),
20
+ created_at timestamptz not null default(now()),
21
+ primary key (tenant_id, grant_id),
22
+ constraint cimd_grant_client_snapshots__grant_model_name
23
+ check (grant_model_name = 'Grant'),
24
+ foreign key (tenant_id, grant_model_name, grant_id)
25
+ references oidc_model_instances (tenant_id, model_name, id)
26
+ on update cascade on delete cascade
27
+ );
28
+ `);
29
+ await applyTableRls(pool, 'cimd_grant_client_snapshots');
30
+ },
31
+ down: async (pool) => {
32
+ await dropTableRls(pool, 'cimd_grant_client_snapshots');
33
+ await pool.query(sql `
34
+ drop table cimd_grant_client_snapshots;
35
+ `);
36
+ },
37
+ };
38
+ export default alteration;
@@ -10,3 +10,4 @@ export * from './message-rate-limit.js';
10
10
  export * from './verification-code.js';
11
11
  export * from './product-event.js';
12
12
  export * from './application.js';
13
+ export * from './social-state.js';
@@ -10,3 +10,4 @@ export * from './message-rate-limit.js';
10
10
  export * from './verification-code.js';
11
11
  export * from './product-event.js';
12
12
  export * from './application.js';
13
+ export * from './social-state.js';
@@ -67,7 +67,11 @@ export declare enum ProductEvent {
67
67
  MfaEnabled = "mfa enabled",
68
68
  MfaDisabled = "mfa disabled",
69
69
  CustomDomainCreated = "custom domain created",
70
- CustomDomainDeleted = "custom domain deleted"
70
+ CustomDomainDeleted = "custom domain deleted",
71
+ /** The tenant has turned on dynamic app (CIMD) client access. */
72
+ DynamicAppEnabled = "dynamic app enabled",
73
+ /** The tenant has turned off dynamic app (CIMD) client access. */
74
+ DynamicAppDisabled = "dynamic app disabled"
71
75
  }
72
76
  /** The PostHog groups for product events. */
73
77
  export declare enum EventGroup {
@@ -69,6 +69,10 @@ export var ProductEvent;
69
69
  ProductEvent["MfaDisabled"] = "mfa disabled";
70
70
  ProductEvent["CustomDomainCreated"] = "custom domain created";
71
71
  ProductEvent["CustomDomainDeleted"] = "custom domain deleted";
72
+ /** The tenant has turned on dynamic app (CIMD) client access. */
73
+ ProductEvent["DynamicAppEnabled"] = "dynamic app enabled";
74
+ /** The tenant has turned off dynamic app (CIMD) client access. */
75
+ ProductEvent["DynamicAppDisabled"] = "dynamic app disabled";
72
76
  })(ProductEvent || (ProductEvent = {}));
73
77
  /** The PostHog groups for product events. */
74
78
  export var EventGroup;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Prefixes of the OAuth `state` parameter used by the first-party clients that share the
3
+ * `/callback/:connectorId` social callback URI.
4
+ *
5
+ * Logto Core routes an incoming callback by looking at the `state` prefix, so the prefixes must
6
+ * never be a prefix of each other. Keep them defined together to preserve that invariant.
7
+ *
8
+ * A `state` carrying no known prefix falls back to the Sign-in Experience, which keeps in-flight
9
+ * requests and custom sign-in UIs that build their own `state` working.
10
+ */
11
+ export declare const accountCenterSocialStatePrefix = "ac_";
12
+ export declare const experienceSocialStatePrefix = "se_";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Prefixes of the OAuth `state` parameter used by the first-party clients that share the
3
+ * `/callback/:connectorId` social callback URI.
4
+ *
5
+ * Logto Core routes an incoming callback by looking at the `state` prefix, so the prefixes must
6
+ * never be a prefix of each other. Keep them defined together to preserve that invariant.
7
+ *
8
+ * A `state` carrying no known prefix falls back to the Sign-in Experience, which keeps in-flight
9
+ * requests and custom sign-in UIs that build their own `state` working.
10
+ */
11
+ export const accountCenterSocialStatePrefix = 'ac_';
12
+ export const experienceSocialStatePrefix = 'se_';
@@ -0,0 +1,32 @@
1
+ import { GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ * The client identity a user approved at consent time for a client ID metadata document (CIMD) client, captured per Grant. CIMD clients are unregistered URL identities without an `applications` row, and an unvetted client can rewrite its hosted document at any time — so the grant list renders this snapshot instead of refetching the document.
4
+ *
5
+ * @remarks This is a type for database creation.
6
+ * @see {@link CimdGrantClientSnapshot} for the original type.
7
+ */
8
+ export type CreateCimdGrantClientSnapshot = {
9
+ tenantId?: string;
10
+ /** The ID of the Grant row in `oidc_model_instances`. */
11
+ grantId: string;
12
+ /** Fixed discriminator so the composite foreign key can target Grant rows in the polymorphic `oidc_model_instances` table. */
13
+ grantModelName?: string;
14
+ clientId: string;
15
+ name?: string | null;
16
+ logoUri?: string | null;
17
+ createdAt?: number;
18
+ };
19
+ /** The client identity a user approved at consent time for a client ID metadata document (CIMD) client, captured per Grant. CIMD clients are unregistered URL identities without an `applications` row, and an unvetted client can rewrite its hosted document at any time — so the grant list renders this snapshot instead of refetching the document. */
20
+ export type CimdGrantClientSnapshot = {
21
+ tenantId: string;
22
+ /** The ID of the Grant row in `oidc_model_instances`. */
23
+ grantId: string;
24
+ /** Fixed discriminator so the composite foreign key can target Grant rows in the polymorphic `oidc_model_instances` table. */
25
+ grantModelName: string;
26
+ clientId: string;
27
+ name: string | null;
28
+ logoUri: string | null;
29
+ createdAt: number;
30
+ };
31
+ export type CimdGrantClientSnapshotKeys = 'tenantId' | 'grantId' | 'grantModelName' | 'clientId' | 'name' | 'logoUri' | 'createdAt';
32
+ export declare const CimdGrantClientSnapshots: GeneratedSchema<CimdGrantClientSnapshotKeys, CreateCimdGrantClientSnapshot, CimdGrantClientSnapshot, 'cimd_grant_client_snapshots', 'cimd_grant_client_snapshot'>;
@@ -0,0 +1,45 @@
1
+ // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ import { z } from 'zod';
3
+ const createGuard = z.object({
4
+ tenantId: z.string().max(21).optional(),
5
+ grantId: z.string().min(1).max(128),
6
+ grantModelName: z.string().min(1).max(64).optional(),
7
+ clientId: z.string().min(1).max(2048),
8
+ name: z.string().max(256).nullable().optional(),
9
+ logoUri: z.string().max(2048).nullable().optional(),
10
+ createdAt: z.number().optional(),
11
+ });
12
+ const guard = z.object({
13
+ tenantId: z.string().max(21),
14
+ grantId: z.string().min(1).max(128),
15
+ grantModelName: z.string().max(64),
16
+ clientId: z.string().min(1).max(2048),
17
+ name: z.string().max(256).nullable(),
18
+ logoUri: z.string().max(2048).nullable(),
19
+ createdAt: z.number(),
20
+ });
21
+ export const CimdGrantClientSnapshots = Object.freeze({
22
+ table: 'cimd_grant_client_snapshots',
23
+ tableSingular: 'cimd_grant_client_snapshot',
24
+ fields: {
25
+ tenantId: 'tenant_id',
26
+ grantId: 'grant_id',
27
+ grantModelName: 'grant_model_name',
28
+ clientId: 'client_id',
29
+ name: 'name',
30
+ logoUri: 'logo_uri',
31
+ createdAt: 'created_at',
32
+ },
33
+ fieldKeys: [
34
+ 'tenantId',
35
+ 'grantId',
36
+ 'grantModelName',
37
+ 'clientId',
38
+ 'name',
39
+ 'logoUri',
40
+ 'createdAt',
41
+ ],
42
+ createGuard,
43
+ guard,
44
+ updateGuard: guard.partial(),
45
+ });
@@ -0,0 +1,30 @@
1
+ import { GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ * The organization authorized on a single OIDC Grant for a client ID metadata document (CIMD) client. CIMD clients are unregistered URL identities with no deletion lifecycle and transferable ownership, so organization access follows the single authorization instead of a long-lived cross-grant relation: rows cascade away with the Grant row and with the user's organization membership.
4
+ *
5
+ * @remarks This is a type for database creation.
6
+ * @see {@link CimdGrantOrganization} for the original type.
7
+ */
8
+ export type CreateCimdGrantOrganization = {
9
+ tenantId?: string;
10
+ /** The ID of the Grant row in `oidc_model_instances`. */
11
+ grantId: string;
12
+ /** Fixed discriminator so the composite foreign key can target Grant rows in the polymorphic `oidc_model_instances` table. */
13
+ grantModelName?: string;
14
+ organizationId: string;
15
+ /** The user the grant was issued to and the membership FK's target. Must match the Grant payload's `accountId` (unreachable by FK) — the consent write enforces the pairing. */
16
+ userId: string;
17
+ };
18
+ /** The organization authorized on a single OIDC Grant for a client ID metadata document (CIMD) client. CIMD clients are unregistered URL identities with no deletion lifecycle and transferable ownership, so organization access follows the single authorization instead of a long-lived cross-grant relation: rows cascade away with the Grant row and with the user's organization membership. */
19
+ export type CimdGrantOrganization = {
20
+ tenantId: string;
21
+ /** The ID of the Grant row in `oidc_model_instances`. */
22
+ grantId: string;
23
+ /** Fixed discriminator so the composite foreign key can target Grant rows in the polymorphic `oidc_model_instances` table. */
24
+ grantModelName: string;
25
+ organizationId: string;
26
+ /** The user the grant was issued to and the membership FK's target. Must match the Grant payload's `accountId` (unreachable by FK) — the consent write enforces the pairing. */
27
+ userId: string;
28
+ };
29
+ export type CimdGrantOrganizationKeys = 'tenantId' | 'grantId' | 'grantModelName' | 'organizationId' | 'userId';
30
+ export declare const CimdGrantOrganizations: GeneratedSchema<CimdGrantOrganizationKeys, CreateCimdGrantOrganization, CimdGrantOrganization, 'cimd_grant_organizations', 'cimd_grant_organization'>;
@@ -0,0 +1,37 @@
1
+ // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ import { z } from 'zod';
3
+ const createGuard = z.object({
4
+ tenantId: z.string().max(21).optional(),
5
+ grantId: z.string().min(1).max(128),
6
+ grantModelName: z.string().min(1).max(64).optional(),
7
+ organizationId: z.string().min(1).max(21),
8
+ userId: z.string().min(1).max(21),
9
+ });
10
+ const guard = z.object({
11
+ tenantId: z.string().max(21),
12
+ grantId: z.string().min(1).max(128),
13
+ grantModelName: z.string().max(64),
14
+ organizationId: z.string().min(1).max(21),
15
+ userId: z.string().min(1).max(21),
16
+ });
17
+ export const CimdGrantOrganizations = Object.freeze({
18
+ table: 'cimd_grant_organizations',
19
+ tableSingular: 'cimd_grant_organization',
20
+ fields: {
21
+ tenantId: 'tenant_id',
22
+ grantId: 'grant_id',
23
+ grantModelName: 'grant_model_name',
24
+ organizationId: 'organization_id',
25
+ userId: 'user_id',
26
+ },
27
+ fieldKeys: [
28
+ 'tenantId',
29
+ 'grantId',
30
+ 'grantModelName',
31
+ 'organizationId',
32
+ 'userId',
33
+ ],
34
+ createGuard,
35
+ guard,
36
+ updateGuard: guard.partial(),
37
+ });
@@ -0,0 +1,20 @@
1
+ import { GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ * The organization API resource scopes (permissions) that client ID metadata document (CIMD) clients of the tenant can request. The scopes are granted to users through organization roles. Rows are an allowlist: an empty table allows nothing (deny-all), and an unrestricted state is not expressible.
4
+ *
5
+ * @remarks This is a type for database creation.
6
+ * @see {@link CimdOrganizationResourceScope} for the original type.
7
+ */
8
+ export type CreateCimdOrganizationResourceScope = {
9
+ tenantId?: string;
10
+ /** The globally unique identifier of the API resource scope. */
11
+ scopeId: string;
12
+ };
13
+ /** The organization API resource scopes (permissions) that client ID metadata document (CIMD) clients of the tenant can request. The scopes are granted to users through organization roles. Rows are an allowlist: an empty table allows nothing (deny-all), and an unrestricted state is not expressible. */
14
+ export type CimdOrganizationResourceScope = {
15
+ tenantId: string;
16
+ /** The globally unique identifier of the API resource scope. */
17
+ scopeId: string;
18
+ };
19
+ export type CimdOrganizationResourceScopeKeys = 'tenantId' | 'scopeId';
20
+ export declare const CimdOrganizationResourceScopes: GeneratedSchema<CimdOrganizationResourceScopeKeys, CreateCimdOrganizationResourceScope, CimdOrganizationResourceScope, 'cimd_organization_resource_scopes', 'cimd_organization_resource_scope'>;
@@ -0,0 +1,25 @@
1
+ // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ import { z } from 'zod';
3
+ const createGuard = z.object({
4
+ tenantId: z.string().max(21).optional(),
5
+ scopeId: z.string().min(1).max(21),
6
+ });
7
+ const guard = z.object({
8
+ tenantId: z.string().max(21),
9
+ scopeId: z.string().min(1).max(21),
10
+ });
11
+ export const CimdOrganizationResourceScopes = Object.freeze({
12
+ table: 'cimd_organization_resource_scopes',
13
+ tableSingular: 'cimd_organization_resource_scope',
14
+ fields: {
15
+ tenantId: 'tenant_id',
16
+ scopeId: 'scope_id',
17
+ },
18
+ fieldKeys: [
19
+ 'tenantId',
20
+ 'scopeId',
21
+ ],
22
+ createGuard,
23
+ guard,
24
+ updateGuard: guard.partial(),
25
+ });
@@ -0,0 +1,20 @@
1
+ import { GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ * The organization scopes (permissions) that client ID metadata document (CIMD) clients of the tenant can request. Rows are an allowlist: an empty table allows nothing (deny-all), and an unrestricted state is not expressible.
4
+ *
5
+ * @remarks This is a type for database creation.
6
+ * @see {@link CimdOrganizationScope} for the original type.
7
+ */
8
+ export type CreateCimdOrganizationScope = {
9
+ tenantId?: string;
10
+ /** The globally unique identifier of the organization scope. */
11
+ organizationScopeId: string;
12
+ };
13
+ /** The organization scopes (permissions) that client ID metadata document (CIMD) clients of the tenant can request. Rows are an allowlist: an empty table allows nothing (deny-all), and an unrestricted state is not expressible. */
14
+ export type CimdOrganizationScope = {
15
+ tenantId: string;
16
+ /** The globally unique identifier of the organization scope. */
17
+ organizationScopeId: string;
18
+ };
19
+ export type CimdOrganizationScopeKeys = 'tenantId' | 'organizationScopeId';
20
+ export declare const CimdOrganizationScopes: GeneratedSchema<CimdOrganizationScopeKeys, CreateCimdOrganizationScope, CimdOrganizationScope, 'cimd_organization_scopes', 'cimd_organization_scope'>;
@@ -0,0 +1,25 @@
1
+ // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ import { z } from 'zod';
3
+ const createGuard = z.object({
4
+ tenantId: z.string().max(21).optional(),
5
+ organizationScopeId: z.string().min(1).max(21),
6
+ });
7
+ const guard = z.object({
8
+ tenantId: z.string().max(21),
9
+ organizationScopeId: z.string().min(1).max(21),
10
+ });
11
+ export const CimdOrganizationScopes = Object.freeze({
12
+ table: 'cimd_organization_scopes',
13
+ tableSingular: 'cimd_organization_scope',
14
+ fields: {
15
+ tenantId: 'tenant_id',
16
+ organizationScopeId: 'organization_scope_id',
17
+ },
18
+ fieldKeys: [
19
+ 'tenantId',
20
+ 'organizationScopeId',
21
+ ],
22
+ createGuard,
23
+ guard,
24
+ updateGuard: guard.partial(),
25
+ });
@@ -0,0 +1,20 @@
1
+ import { GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ * The API resource scopes (permissions) that client ID metadata document (CIMD) clients of the tenant can request. Rows are an allowlist: an empty table allows nothing (deny-all), and an unrestricted state is not expressible.
4
+ *
5
+ * @remarks This is a type for database creation.
6
+ * @see {@link CimdResourceScope} for the original type.
7
+ */
8
+ export type CreateCimdResourceScope = {
9
+ tenantId?: string;
10
+ /** The globally unique identifier of the API resource scope. */
11
+ scopeId: string;
12
+ };
13
+ /** The API resource scopes (permissions) that client ID metadata document (CIMD) clients of the tenant can request. Rows are an allowlist: an empty table allows nothing (deny-all), and an unrestricted state is not expressible. */
14
+ export type CimdResourceScope = {
15
+ tenantId: string;
16
+ /** The globally unique identifier of the API resource scope. */
17
+ scopeId: string;
18
+ };
19
+ export type CimdResourceScopeKeys = 'tenantId' | 'scopeId';
20
+ export declare const CimdResourceScopes: GeneratedSchema<CimdResourceScopeKeys, CreateCimdResourceScope, CimdResourceScope, 'cimd_resource_scopes', 'cimd_resource_scope'>;
@@ -0,0 +1,25 @@
1
+ // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ import { z } from 'zod';
3
+ const createGuard = z.object({
4
+ tenantId: z.string().max(21).optional(),
5
+ scopeId: z.string().min(1).max(21),
6
+ });
7
+ const guard = z.object({
8
+ tenantId: z.string().max(21),
9
+ scopeId: z.string().min(1).max(21),
10
+ });
11
+ export const CimdResourceScopes = Object.freeze({
12
+ table: 'cimd_resource_scopes',
13
+ tableSingular: 'cimd_resource_scope',
14
+ fields: {
15
+ tenantId: 'tenant_id',
16
+ scopeId: 'scope_id',
17
+ },
18
+ fieldKeys: [
19
+ 'tenantId',
20
+ 'scopeId',
21
+ ],
22
+ createGuard,
23
+ guard,
24
+ updateGuard: guard.partial(),
25
+ });
@@ -0,0 +1,20 @@
1
+ import { GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ * The user scopes (permissions) that client ID metadata document (CIMD) clients of the tenant can request. Rows are an allowlist: an empty table allows nothing (deny-all), and an unrestricted state is not expressible.
4
+ *
5
+ * @remarks This is a type for database creation.
6
+ * @see {@link CimdUserScope} for the original type.
7
+ */
8
+ export type CreateCimdUserScope = {
9
+ tenantId?: string;
10
+ /** The unique UserScope enum value @see (@logto/core-kit/open-id.js) for more details */
11
+ userScope: string;
12
+ };
13
+ /** The user scopes (permissions) that client ID metadata document (CIMD) clients of the tenant can request. Rows are an allowlist: an empty table allows nothing (deny-all), and an unrestricted state is not expressible. */
14
+ export type CimdUserScope = {
15
+ tenantId: string;
16
+ /** The unique UserScope enum value @see (@logto/core-kit/open-id.js) for more details */
17
+ userScope: string;
18
+ };
19
+ export type CimdUserScopeKeys = 'tenantId' | 'userScope';
20
+ export declare const CimdUserScopes: GeneratedSchema<CimdUserScopeKeys, CreateCimdUserScope, CimdUserScope, 'cimd_user_scopes', 'cimd_user_scope'>;
@@ -0,0 +1,25 @@
1
+ // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ import { z } from 'zod';
3
+ const createGuard = z.object({
4
+ tenantId: z.string().max(21).optional(),
5
+ userScope: z.string().min(1).max(64),
6
+ });
7
+ const guard = z.object({
8
+ tenantId: z.string().max(21),
9
+ userScope: z.string().min(1).max(64),
10
+ });
11
+ export const CimdUserScopes = Object.freeze({
12
+ table: 'cimd_user_scopes',
13
+ tableSingular: 'cimd_user_scope',
14
+ fields: {
15
+ tenantId: 'tenant_id',
16
+ userScope: 'user_scope',
17
+ },
18
+ fieldKeys: [
19
+ 'tenantId',
20
+ 'userScope',
21
+ ],
22
+ createGuard,
23
+ guard,
24
+ updateGuard: guard.partial(),
25
+ });
@@ -19,6 +19,12 @@ export * from './application-user-consent-user-scope.js';
19
19
  export * from './application.js';
20
20
  export * from './applications-role.js';
21
21
  export * from './captcha-provider.js';
22
+ export * from './cimd-grant-client-snapshot.js';
23
+ export * from './cimd-grant-organization.js';
24
+ export * from './cimd-organization-resource-scope.js';
25
+ export * from './cimd-organization-scope.js';
26
+ export * from './cimd-resource-scope.js';
27
+ export * from './cimd-user-scope.js';
22
28
  export * from './connector.js';
23
29
  export * from './custom-phrase.js';
24
30
  export * from './custom-profile-field.js';
@@ -67,6 +73,7 @@ export * from './sso-connector-idp-initiated-auth-config.js';
67
73
  export * from './sso-connector.js';
68
74
  export * from './subject-token.js';
69
75
  export * from './system.js';
76
+ export * from './trusted-device.js';
70
77
  export * from './user-geo-location.js';
71
78
  export * from './user-sign-in-country.js';
72
79
  export * from './user-sso-identity.js';
@@ -20,6 +20,12 @@ export * from './application-user-consent-user-scope.js';
20
20
  export * from './application.js';
21
21
  export * from './applications-role.js';
22
22
  export * from './captcha-provider.js';
23
+ export * from './cimd-grant-client-snapshot.js';
24
+ export * from './cimd-grant-organization.js';
25
+ export * from './cimd-organization-resource-scope.js';
26
+ export * from './cimd-organization-scope.js';
27
+ export * from './cimd-resource-scope.js';
28
+ export * from './cimd-user-scope.js';
23
29
  export * from './connector.js';
24
30
  export * from './custom-phrase.js';
25
31
  export * from './custom-profile-field.js';
@@ -68,6 +74,7 @@ export * from './sso-connector-idp-initiated-auth-config.js';
68
74
  export * from './sso-connector.js';
69
75
  export * from './subject-token.js';
70
76
  export * from './system.js';
77
+ export * from './trusted-device.js';
71
78
  export * from './user-geo-location.js';
72
79
  export * from './user-sign-in-country.js';
73
80
  export * from './user-sso-identity.js';
@@ -10,6 +10,7 @@ export type CreateOidcSessionExtension = {
10
10
  accountId: string;
11
11
  lastSubmission?: JsonObject;
12
12
  clientId?: string | null;
13
+ cimdClientId?: string | null;
13
14
  createdAt?: number;
14
15
  updatedAt?: number;
15
16
  };
@@ -19,8 +20,9 @@ export type OidcSessionExtension = {
19
20
  accountId: string;
20
21
  lastSubmission: JsonObject;
21
22
  clientId: string | null;
23
+ cimdClientId: string | null;
22
24
  createdAt: number;
23
25
  updatedAt: number;
24
26
  };
25
- export type OidcSessionExtensionKeys = 'tenantId' | 'sessionUid' | 'accountId' | 'lastSubmission' | 'clientId' | 'createdAt' | 'updatedAt';
27
+ export type OidcSessionExtensionKeys = 'tenantId' | 'sessionUid' | 'accountId' | 'lastSubmission' | 'clientId' | 'cimdClientId' | 'createdAt' | 'updatedAt';
26
28
  export declare const OidcSessionExtensions: GeneratedSchema<OidcSessionExtensionKeys, CreateOidcSessionExtension, OidcSessionExtension, 'oidc_session_extensions', 'oidc_session_extension'>;
@@ -7,6 +7,7 @@ const createGuard = z.object({
7
7
  accountId: z.string().min(1).max(12),
8
8
  lastSubmission: jsonObjectGuard.optional(),
9
9
  clientId: z.string().max(21).nullable().optional(),
10
+ cimdClientId: z.string().max(2048).nullable().optional(),
10
11
  createdAt: z.number().optional(),
11
12
  updatedAt: z.number().optional(),
12
13
  });
@@ -16,6 +17,7 @@ const guard = z.object({
16
17
  accountId: z.string().min(1).max(12),
17
18
  lastSubmission: jsonObjectGuard,
18
19
  clientId: z.string().max(21).nullable(),
20
+ cimdClientId: z.string().max(2048).nullable(),
19
21
  createdAt: z.number(),
20
22
  updatedAt: z.number(),
21
23
  });
@@ -28,6 +30,7 @@ export const OidcSessionExtensions = Object.freeze({
28
30
  accountId: 'account_id',
29
31
  lastSubmission: 'last_submission',
30
32
  clientId: 'client_id',
33
+ cimdClientId: 'cimd_client_id',
31
34
  createdAt: 'created_at',
32
35
  updatedAt: 'updated_at',
33
36
  },
@@ -37,6 +40,7 @@ export const OidcSessionExtensions = Object.freeze({
37
40
  'accountId',
38
41
  'lastSubmission',
39
42
  'clientId',
43
+ 'cimdClientId',
40
44
  'createdAt',
41
45
  'updatedAt',
42
46
  ],