@logto/schemas 1.27.0 → 1.29.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 (105) hide show
  1. package/alterations/1.28.0-1745735646-add-email-blocklist-policy-column-to-sie-table.ts +20 -0
  2. package/alterations/1.29.0-1748832174-add-webauthn-related-origins.ts +20 -0
  3. package/alterations/1.29.0-1749005587-user-sso-identities-table-add-updated-at-column.ts +31 -0
  4. package/alterations/1.29.0-1749026308-add-oidc-session-extension-table.ts +41 -0
  5. package/alterations/1.29.0-1749523818-add-custom-profile-fields.ts +58 -0
  6. package/alterations/1.29.0-1749724664-drop-sie-order-constraint-from-custom-profile-fields.ts +20 -0
  7. package/alterations/1.29.0-1750663091-change-user-password-encrypted-length.ts +18 -0
  8. package/alterations/1.29.0-1750744518-add-secrets-table.ts +50 -0
  9. package/alterations/1.29.0-1750744539-add-secret-connector-relations-table.ts +109 -0
  10. package/alterations-js/1.28.0-1745735646-add-email-blocklist-policy-column-to-sie-table.js +16 -0
  11. package/alterations-js/1.29.0-1748832174-add-webauthn-related-origins.js +16 -0
  12. package/alterations-js/1.29.0-1749005587-user-sso-identities-table-add-updated-at-column.js +25 -0
  13. package/alterations-js/1.29.0-1749026308-add-oidc-session-extension-table.js +33 -0
  14. package/alterations-js/1.29.0-1749523818-add-custom-profile-fields.js +52 -0
  15. package/alterations-js/1.29.0-1749724664-drop-sie-order-constraint-from-custom-profile-fields.js +16 -0
  16. package/alterations-js/1.29.0-1750663091-change-user-password-encrypted-length.js +14 -0
  17. package/alterations-js/1.29.0-1750744518-add-secrets-table.js +42 -0
  18. package/alterations-js/1.29.0-1750744539-add-secret-connector-relations-table.js +99 -0
  19. package/lib/db-entries/account-center.d.ts +4 -2
  20. package/lib/db-entries/account-center.js +5 -1
  21. package/lib/db-entries/custom-profile-field.d.ts +32 -0
  22. package/lib/db-entries/custom-profile-field.js +58 -0
  23. package/lib/db-entries/index.d.ts +4 -0
  24. package/lib/db-entries/index.js +4 -0
  25. package/lib/db-entries/oidc-session-extension.d.ts +24 -0
  26. package/lib/db-entries/oidc-session-extension.js +42 -0
  27. package/lib/db-entries/secret-connector-relation.d.ts +40 -0
  28. package/lib/db-entries/secret-connector-relation.js +49 -0
  29. package/lib/db-entries/secret.d.ts +44 -0
  30. package/lib/db-entries/secret.js +62 -0
  31. package/lib/db-entries/sign-in-experience.d.ts +4 -2
  32. package/lib/db-entries/sign-in-experience.js +5 -1
  33. package/lib/db-entries/user-sso-identity.d.ts +5 -1
  34. package/lib/db-entries/user-sso-identity.js +4 -0
  35. package/lib/db-entries/user.js +2 -2
  36. package/lib/foundations/jsonb-types/account-centers.d.ts +5 -0
  37. package/lib/foundations/jsonb-types/account-centers.js +2 -0
  38. package/lib/foundations/jsonb-types/custom-profile-fields.d.ts +116 -0
  39. package/lib/foundations/jsonb-types/custom-profile-fields.js +36 -0
  40. package/lib/foundations/jsonb-types/index.d.ts +2 -1
  41. package/lib/foundations/jsonb-types/index.js +2 -1
  42. package/lib/foundations/jsonb-types/secrets.d.ts +9 -0
  43. package/lib/foundations/jsonb-types/secrets.js +10 -0
  44. package/lib/foundations/jsonb-types/sign-in-experience.d.ts +33 -0
  45. package/lib/foundations/jsonb-types/sign-in-experience.js +5 -0
  46. package/lib/foundations/jsonb-types/users.d.ts +32 -0
  47. package/lib/foundations/jsonb-types/users.js +11 -10
  48. package/lib/types/application.d.ts +7 -91
  49. package/lib/types/connector.d.ts +9 -13
  50. package/lib/types/consent.d.ts +25 -21
  51. package/lib/types/custom-profile-fields.d.ts +1310 -0
  52. package/lib/types/custom-profile-fields.js +123 -0
  53. package/lib/types/hook.d.ts +3 -3
  54. package/lib/types/index.d.ts +2 -0
  55. package/lib/types/index.js +2 -0
  56. package/lib/types/interactions.d.ts +12 -6
  57. package/lib/types/interactions.js +1 -0
  58. package/lib/types/log/interaction.d.ts +2 -1
  59. package/lib/types/logto-config/index.d.ts +1119 -34
  60. package/lib/types/logto-config/jwt-customizer.d.ts +2431 -60
  61. package/lib/types/logto-config/jwt-customizer.js +50 -1
  62. package/lib/types/logto-config/oidc-provider.d.ts +6 -6
  63. package/lib/types/mfa.d.ts +10 -10
  64. package/lib/types/saml-application.d.ts +19 -342
  65. package/lib/types/scope.d.ts +3 -3
  66. package/lib/types/sign-in-experience.d.ts +14 -11
  67. package/lib/types/sso-connector.d.ts +27 -5
  68. package/lib/types/sso-connector.js +3 -0
  69. package/lib/types/tenant.d.ts +1 -0
  70. package/lib/types/tenant.js +1 -0
  71. package/lib/types/user.d.ts +14 -3
  72. package/lib/types/user.js +3 -0
  73. package/lib/types/verification-records/backup-code-verification.d.ts +29 -0
  74. package/lib/types/verification-records/backup-code-verification.js +9 -0
  75. package/lib/types/verification-records/code-verification.d.ts +89 -0
  76. package/lib/types/verification-records/code-verification.js +22 -0
  77. package/lib/types/verification-records/enterprise-sso-verification.d.ts +68 -0
  78. package/lib/types/verification-records/enterprise-sso-verification.js +10 -0
  79. package/lib/types/verification-records/index.d.ts +16 -0
  80. package/lib/types/verification-records/index.js +16 -0
  81. package/lib/types/verification-records/new-password-identity-verification.d.ts +54 -0
  82. package/lib/types/verification-records/new-password-identity-verification.js +16 -0
  83. package/lib/types/verification-records/one-time-token-verification.d.ts +55 -0
  84. package/lib/types/verification-records/one-time-token-verification.js +13 -0
  85. package/lib/types/verification-records/password-verification.d.ts +40 -0
  86. package/lib/types/verification-records/password-verification.js +9 -0
  87. package/lib/types/verification-records/social-verification.d.ts +106 -0
  88. package/lib/types/verification-records/social-verification.js +10 -0
  89. package/lib/types/verification-records/totp-verification.d.ts +29 -0
  90. package/lib/types/verification-records/totp-verification.js +9 -0
  91. package/lib/types/verification-records/web-authn-verification.d.ts +80 -0
  92. package/lib/types/verification-records/web-authn-verification.js +12 -0
  93. package/package.json +3 -3
  94. package/tables/account_centers.sql +1 -0
  95. package/tables/connectors.sql +2 -0
  96. package/tables/custom_profile_fields.sql +31 -0
  97. package/tables/oidc_model_instances.sql +2 -0
  98. package/tables/oidc_session_extensions.sql +18 -0
  99. package/tables/secret_connector_relations.sql +78 -0
  100. package/tables/secrets.sql +26 -0
  101. package/tables/sign_in_experiences.sql +1 -0
  102. package/tables/user_sso_identities.sql +8 -0
  103. package/tables/users.sql +1 -1
  104. /package/lib/{foundations/jsonb-types/verification-records.d.ts → types/verification-records/verification-type.d.ts} +0 -0
  105. /package/lib/{foundations/jsonb-types/verification-records.js → types/verification-records/verification-type.js} +0 -0
@@ -0,0 +1,99 @@
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 secret_connector_relations (
7
+ tenant_id varchar(21) not null
8
+ references tenants (id) on update cascade on delete cascade,
9
+ secret_id varchar(21) not null
10
+ references secrets (id) on update cascade on delete cascade,
11
+ /** Social connector ID foreign reference. Only present for secrets that store social connector tokens. Note: avoid directly cascading deletes here, need to delete the secrets first.*/
12
+ connector_id varchar(128)
13
+ references connectors (id) on update cascade,
14
+ /** SSO connector ID foreign reference. Only present for secrets that store SSO connector tokens. Note: avoid directly cascading deletes here, need to delete the secrets first.*/
15
+ sso_connector_id varchar(128)
16
+ references sso_connectors (id) on update cascade,
17
+ /** The target of the social connector. e.g. 'github', 'google', etc. */
18
+ social_connector_target varchar(256),
19
+ /** User social identity ID foreign reference. Only present for secrets that store social identity tokens. */
20
+ social_identity_id varchar(128),
21
+ /** User sso connector issuer. Only present for secrets that store SSO connector tokens. */
22
+ sso_connector_issuer varchar(256),
23
+ /** User SSO identity ID. Only present for secrets that store SSO identity tokens. */
24
+ sso_identity_id varchar(128),
25
+ primary key (tenant_id, secret_id),
26
+ /** Ensures that each social identity is associated with only one secret. */
27
+ constraint secret_connector_relations__target__social_identity_id
28
+ unique (tenant_id, social_connector_target, social_identity_id),
29
+ /** Ensures that each SSO identity is associated with only one secret. */
30
+ foreign key (tenant_id, sso_connector_issuer, sso_identity_id)
31
+ references user_sso_identities (tenant_id, issuer, identity_id) on update cascade,
32
+ /** Ensure that each secret is associated with a social connector or SSO connector, but not both at the same time. */
33
+ constraint secret_connector_relations__connector_id__sso_connector_id
34
+ check (
35
+ (
36
+ connector_id is not null and social_connector_target is not null and social_identity_id is not null and
37
+ sso_connector_id is null and sso_identity_id is null
38
+ ) or (
39
+ connector_id is null and social_connector_target is null and social_identity_id is null and
40
+ sso_connector_id is not null and sso_identity_id is not null
41
+ )
42
+ )
43
+ );
44
+ `);
45
+ /** Trigger function to delete secrets when the social connector is deleted. */
46
+ await pool.query(sql `
47
+ create function delete_secrets_on_social_connector_delete()
48
+ returns trigger as $$
49
+ begin
50
+ delete from secrets
51
+ where id in (
52
+ select secret_id from secret_connector_relations
53
+ where tenant_id = old.tenant_id and connector_id = old.id
54
+ );
55
+ return old;
56
+ end;
57
+ $$ language plpgsql;
58
+
59
+ create trigger delete_secrets_before_social_connector_delete
60
+ before delete on connectors
61
+ for each row
62
+ execute procedure delete_secrets_on_social_connector_delete();
63
+ `);
64
+ /** Trigger function to delete secrets when the SSO connector is deleted. */
65
+ await pool.query(sql `
66
+ create function delete_secrets_on_sso_connector_delete()
67
+ returns trigger as $$
68
+ begin
69
+ delete from secrets
70
+ where id in (
71
+ select secret_id from secret_connector_relations
72
+ where tenant_id = old.tenant_id and sso_connector_id = old.id
73
+ );
74
+ return old;
75
+ end;
76
+ $$ language plpgsql;
77
+
78
+ create trigger delete_secrets_before_sso_connector_delete
79
+ before delete on sso_connectors
80
+ for each row
81
+ execute procedure delete_secrets_on_sso_connector_delete();
82
+ `);
83
+ await applyTableRls(pool, 'secret_connector_relations');
84
+ },
85
+ down: async (pool) => {
86
+ await pool.query(sql `
87
+ drop trigger if exists delete_secrets_before_social_connector_delete on connectors;
88
+ drop function if exists delete_secrets_on_social_connector_delete;
89
+
90
+ drop trigger if exists delete_secrets_before_sso_connector_delete on sso_connectors;
91
+ drop function if exists delete_secrets_on_sso_connector_delete;
92
+ `);
93
+ await dropTableRls(pool, 'secret_connector_relations');
94
+ await pool.query(sql `
95
+ drop table secret_connector_relations;
96
+ `);
97
+ },
98
+ };
99
+ export default alteration;
@@ -1,4 +1,4 @@
1
- import { AccountCenterFieldControl, GeneratedSchema } from './../foundations/index.js';
1
+ import { AccountCenterFieldControl, WebauthnRelatedOrigins, GeneratedSchema } from './../foundations/index.js';
2
2
  /**
3
3
  *
4
4
  * @remarks This is a type for database creation.
@@ -11,6 +11,7 @@ export type CreateAccountCenter = {
11
11
  enabled?: boolean;
12
12
  /** Control each fields */
13
13
  fields?: AccountCenterFieldControl;
14
+ webauthnRelatedOrigins?: WebauthnRelatedOrigins;
14
15
  };
15
16
  export type AccountCenter = {
16
17
  tenantId: string;
@@ -19,6 +20,7 @@ export type AccountCenter = {
19
20
  enabled: boolean;
20
21
  /** Control each fields */
21
22
  fields: AccountCenterFieldControl;
23
+ webauthnRelatedOrigins: WebauthnRelatedOrigins;
22
24
  };
23
- export type AccountCenterKeys = 'tenantId' | 'id' | 'enabled' | 'fields';
25
+ export type AccountCenterKeys = 'tenantId' | 'id' | 'enabled' | 'fields' | 'webauthnRelatedOrigins';
24
26
  export declare const AccountCenters: GeneratedSchema<AccountCenterKeys, CreateAccountCenter, AccountCenter, 'account_centers', 'account_center'>;
@@ -1,17 +1,19 @@
1
1
  // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
2
  import { z } from 'zod';
3
- import { accountCenterFieldControlGuard } from './../foundations/index.js';
3
+ import { accountCenterFieldControlGuard, webauthnRelatedOriginsGuard } from './../foundations/index.js';
4
4
  const createGuard = z.object({
5
5
  tenantId: z.string().max(21).optional(),
6
6
  id: z.string().min(1).max(21),
7
7
  enabled: z.boolean().optional(),
8
8
  fields: accountCenterFieldControlGuard.optional(),
9
+ webauthnRelatedOrigins: webauthnRelatedOriginsGuard.optional(),
9
10
  });
10
11
  const guard = z.object({
11
12
  tenantId: z.string().max(21),
12
13
  id: z.string().min(1).max(21),
13
14
  enabled: z.boolean(),
14
15
  fields: accountCenterFieldControlGuard,
16
+ webauthnRelatedOrigins: webauthnRelatedOriginsGuard,
15
17
  });
16
18
  export const AccountCenters = Object.freeze({
17
19
  table: 'account_centers',
@@ -21,12 +23,14 @@ export const AccountCenters = Object.freeze({
21
23
  id: 'id',
22
24
  enabled: 'enabled',
23
25
  fields: 'fields',
26
+ webauthnRelatedOrigins: 'webauthn_related_origins',
24
27
  },
25
28
  fieldKeys: [
26
29
  'tenantId',
27
30
  'id',
28
31
  'enabled',
29
32
  'fields',
33
+ 'webauthnRelatedOrigins',
30
34
  ],
31
35
  createGuard,
32
36
  guard,
@@ -0,0 +1,32 @@
1
+ import { CustomProfileFieldType, CustomProfileFieldConfig, GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ *
4
+ * @remarks This is a type for database creation.
5
+ * @see {@link CustomProfileField} for the original type.
6
+ */
7
+ export type CreateCustomProfileField = {
8
+ tenantId?: string;
9
+ id: string;
10
+ name: string;
11
+ type: CustomProfileFieldType;
12
+ label?: string;
13
+ description?: string | null;
14
+ required?: boolean;
15
+ config?: CustomProfileFieldConfig;
16
+ createdAt?: number;
17
+ sieOrder?: number;
18
+ };
19
+ export type CustomProfileField = {
20
+ tenantId: string;
21
+ id: string;
22
+ name: string;
23
+ type: CustomProfileFieldType;
24
+ label: string;
25
+ description: string | null;
26
+ required: boolean;
27
+ config: CustomProfileFieldConfig;
28
+ createdAt: number;
29
+ sieOrder: number;
30
+ };
31
+ export type CustomProfileFieldKeys = 'tenantId' | 'id' | 'name' | 'type' | 'label' | 'description' | 'required' | 'config' | 'createdAt' | 'sieOrder';
32
+ export declare const CustomProfileFields: GeneratedSchema<CustomProfileFieldKeys, CreateCustomProfileField, CustomProfileField, 'custom_profile_fields', 'custom_profile_field'>;
@@ -0,0 +1,58 @@
1
+ // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ import { z } from 'zod';
3
+ import { customProfileFieldTypeGuard, customProfileFieldConfigGuard } from './../foundations/index.js';
4
+ const createGuard = z.object({
5
+ tenantId: z.string().max(21).optional(),
6
+ id: z.string().min(1).max(21),
7
+ name: z.string().min(1).max(128),
8
+ type: customProfileFieldTypeGuard,
9
+ label: z.string().min(1).max(128).optional(),
10
+ description: z.string().max(256).nullable().optional(),
11
+ required: z.boolean().optional(),
12
+ config: customProfileFieldConfigGuard.optional(),
13
+ createdAt: z.number().optional(),
14
+ sieOrder: z.number().optional(),
15
+ });
16
+ const guard = z.object({
17
+ tenantId: z.string().max(21),
18
+ id: z.string().min(1).max(21),
19
+ name: z.string().min(1).max(128),
20
+ type: customProfileFieldTypeGuard,
21
+ label: z.string().max(128),
22
+ description: z.string().max(256).nullable(),
23
+ required: z.boolean(),
24
+ config: customProfileFieldConfigGuard,
25
+ createdAt: z.number(),
26
+ sieOrder: z.number(),
27
+ });
28
+ export const CustomProfileFields = Object.freeze({
29
+ table: 'custom_profile_fields',
30
+ tableSingular: 'custom_profile_field',
31
+ fields: {
32
+ tenantId: 'tenant_id',
33
+ id: 'id',
34
+ name: 'name',
35
+ type: 'type',
36
+ label: 'label',
37
+ description: 'description',
38
+ required: 'required',
39
+ config: 'config',
40
+ createdAt: 'created_at',
41
+ sieOrder: 'sie_order',
42
+ },
43
+ fieldKeys: [
44
+ 'tenantId',
45
+ 'id',
46
+ 'name',
47
+ 'type',
48
+ 'label',
49
+ 'description',
50
+ 'required',
51
+ 'config',
52
+ 'createdAt',
53
+ 'sieOrder',
54
+ ],
55
+ createGuard,
56
+ guard,
57
+ updateGuard: guard.partial(),
58
+ });
@@ -16,6 +16,7 @@ export * from './applications-role.js';
16
16
  export * from './captcha-provider.js';
17
17
  export * from './connector.js';
18
18
  export * from './custom-phrase.js';
19
+ export * from './custom-profile-field.js';
19
20
  export * from './daily-active-user.js';
20
21
  export * from './daily-token-usage.js';
21
22
  export * from './domain.js';
@@ -25,6 +26,7 @@ export * from './idp-initiated-saml-sso-session.js';
25
26
  export * from './log.js';
26
27
  export * from './logto-config.js';
27
28
  export * from './oidc-model-instance.js';
29
+ export * from './oidc-session-extension.js';
28
30
  export * from './one-time-token.js';
29
31
  export * from './organization-application-relation.js';
30
32
  export * from './organization-invitation-role-relation.js';
@@ -49,6 +51,8 @@ export * from './saml-application-config.js';
49
51
  export * from './saml-application-secret.js';
50
52
  export * from './saml-application-session.js';
51
53
  export * from './scope.js';
54
+ export * from './secret-connector-relation.js';
55
+ export * from './secret.js';
52
56
  export * from './sentinel-activity.js';
53
57
  export * from './service-log.js';
54
58
  export * from './sign-in-experience.js';
@@ -17,6 +17,7 @@ export * from './applications-role.js';
17
17
  export * from './captcha-provider.js';
18
18
  export * from './connector.js';
19
19
  export * from './custom-phrase.js';
20
+ export * from './custom-profile-field.js';
20
21
  export * from './daily-active-user.js';
21
22
  export * from './daily-token-usage.js';
22
23
  export * from './domain.js';
@@ -26,6 +27,7 @@ export * from './idp-initiated-saml-sso-session.js';
26
27
  export * from './log.js';
27
28
  export * from './logto-config.js';
28
29
  export * from './oidc-model-instance.js';
30
+ export * from './oidc-session-extension.js';
29
31
  export * from './one-time-token.js';
30
32
  export * from './organization-application-relation.js';
31
33
  export * from './organization-invitation-role-relation.js';
@@ -50,6 +52,8 @@ export * from './saml-application-config.js';
50
52
  export * from './saml-application-secret.js';
51
53
  export * from './saml-application-session.js';
52
54
  export * from './scope.js';
55
+ export * from './secret-connector-relation.js';
56
+ export * from './secret.js';
53
57
  export * from './sentinel-activity.js';
54
58
  export * from './service-log.js';
55
59
  export * from './sign-in-experience.js';
@@ -0,0 +1,24 @@
1
+ import { JsonObject, GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ *
4
+ * @remarks This is a type for database creation.
5
+ * @see {@link OidcSessionExtension} for the original type.
6
+ */
7
+ export type CreateOidcSessionExtension = {
8
+ tenantId?: string;
9
+ sessionUid: string;
10
+ accountId: string;
11
+ lastSubmission?: JsonObject;
12
+ createdAt?: number;
13
+ updatedAt?: number;
14
+ };
15
+ export type OidcSessionExtension = {
16
+ tenantId: string;
17
+ sessionUid: string;
18
+ accountId: string;
19
+ lastSubmission: JsonObject;
20
+ createdAt: number;
21
+ updatedAt: number;
22
+ };
23
+ export type OidcSessionExtensionKeys = 'tenantId' | 'sessionUid' | 'accountId' | 'lastSubmission' | 'createdAt' | 'updatedAt';
24
+ export declare const OidcSessionExtensions: GeneratedSchema<OidcSessionExtensionKeys, CreateOidcSessionExtension, OidcSessionExtension, 'oidc_session_extensions', 'oidc_session_extension'>;
@@ -0,0 +1,42 @@
1
+ // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ import { z } from 'zod';
3
+ import { jsonObjectGuard } from './../foundations/index.js';
4
+ const createGuard = z.object({
5
+ tenantId: z.string().max(21).optional(),
6
+ sessionUid: z.string().min(1).max(128),
7
+ accountId: z.string().min(1).max(12),
8
+ lastSubmission: jsonObjectGuard.optional(),
9
+ createdAt: z.number().optional(),
10
+ updatedAt: z.number().optional(),
11
+ });
12
+ const guard = z.object({
13
+ tenantId: z.string().max(21),
14
+ sessionUid: z.string().min(1).max(128),
15
+ accountId: z.string().min(1).max(12),
16
+ lastSubmission: jsonObjectGuard,
17
+ createdAt: z.number(),
18
+ updatedAt: z.number(),
19
+ });
20
+ export const OidcSessionExtensions = Object.freeze({
21
+ table: 'oidc_session_extensions',
22
+ tableSingular: 'oidc_session_extension',
23
+ fields: {
24
+ tenantId: 'tenant_id',
25
+ sessionUid: 'session_uid',
26
+ accountId: 'account_id',
27
+ lastSubmission: 'last_submission',
28
+ createdAt: 'created_at',
29
+ updatedAt: 'updated_at',
30
+ },
31
+ fieldKeys: [
32
+ 'tenantId',
33
+ 'sessionUid',
34
+ 'accountId',
35
+ 'lastSubmission',
36
+ 'createdAt',
37
+ 'updatedAt',
38
+ ],
39
+ createGuard,
40
+ guard,
41
+ updateGuard: guard.partial(),
42
+ });
@@ -0,0 +1,40 @@
1
+ import { GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ *
4
+ * @remarks This is a type for database creation.
5
+ * @see {@link SecretConnectorRelation} for the original type.
6
+ */
7
+ export type CreateSecretConnectorRelation = {
8
+ tenantId?: string;
9
+ secretId: string;
10
+ /** Social connector ID foreign reference. Only present for secrets that store social connector tokens. Note: avoid directly cascading deletes here, need to delete the secrets first. */
11
+ connectorId?: string | null;
12
+ /** SSO connector ID foreign reference. Only present for secrets that store SSO connector tokens. Note: avoid directly cascading deletes here, need to delete the secrets first. */
13
+ ssoConnectorId?: string | null;
14
+ /** The target of the social connector. e.g. 'github', 'google', etc. */
15
+ socialConnectorTarget?: string | null;
16
+ /** User social identity ID foreign reference. Only present for secrets that store social identity tokens. */
17
+ socialIdentityId?: string | null;
18
+ /** User sso connector issuer. Only present for secrets that store SSO connector tokens. */
19
+ ssoConnectorIssuer?: string | null;
20
+ /** User SSO identity ID. Only present for secrets that store SSO identity tokens. */
21
+ ssoIdentityId?: string | null;
22
+ };
23
+ export type SecretConnectorRelation = {
24
+ tenantId: string;
25
+ secretId: string;
26
+ /** Social connector ID foreign reference. Only present for secrets that store social connector tokens. Note: avoid directly cascading deletes here, need to delete the secrets first. */
27
+ connectorId: string | null;
28
+ /** SSO connector ID foreign reference. Only present for secrets that store SSO connector tokens. Note: avoid directly cascading deletes here, need to delete the secrets first. */
29
+ ssoConnectorId: string | null;
30
+ /** The target of the social connector. e.g. 'github', 'google', etc. */
31
+ socialConnectorTarget: string | null;
32
+ /** User social identity ID foreign reference. Only present for secrets that store social identity tokens. */
33
+ socialIdentityId: string | null;
34
+ /** User sso connector issuer. Only present for secrets that store SSO connector tokens. */
35
+ ssoConnectorIssuer: string | null;
36
+ /** User SSO identity ID. Only present for secrets that store SSO identity tokens. */
37
+ ssoIdentityId: string | null;
38
+ };
39
+ export type SecretConnectorRelationKeys = 'tenantId' | 'secretId' | 'connectorId' | 'ssoConnectorId' | 'socialConnectorTarget' | 'socialIdentityId' | 'ssoConnectorIssuer' | 'ssoIdentityId';
40
+ export declare const SecretConnectorRelations: GeneratedSchema<SecretConnectorRelationKeys, CreateSecretConnectorRelation, SecretConnectorRelation, 'secret_connector_relations', 'secret_connector_relation'>;
@@ -0,0 +1,49 @@
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
+ secretId: z.string().min(1).max(21),
6
+ connectorId: z.string().max(128).nullable().optional(),
7
+ ssoConnectorId: z.string().max(128).nullable().optional(),
8
+ socialConnectorTarget: z.string().max(256).nullable().optional(),
9
+ socialIdentityId: z.string().max(128).nullable().optional(),
10
+ ssoConnectorIssuer: z.string().max(256).nullable().optional(),
11
+ ssoIdentityId: z.string().max(128).nullable().optional(),
12
+ });
13
+ const guard = z.object({
14
+ tenantId: z.string().max(21),
15
+ secretId: z.string().min(1).max(21),
16
+ connectorId: z.string().max(128).nullable(),
17
+ ssoConnectorId: z.string().max(128).nullable(),
18
+ socialConnectorTarget: z.string().max(256).nullable(),
19
+ socialIdentityId: z.string().max(128).nullable(),
20
+ ssoConnectorIssuer: z.string().max(256).nullable(),
21
+ ssoIdentityId: z.string().max(128).nullable(),
22
+ });
23
+ export const SecretConnectorRelations = Object.freeze({
24
+ table: 'secret_connector_relations',
25
+ tableSingular: 'secret_connector_relation',
26
+ fields: {
27
+ tenantId: 'tenant_id',
28
+ secretId: 'secret_id',
29
+ connectorId: 'connector_id',
30
+ ssoConnectorId: 'sso_connector_id',
31
+ socialConnectorTarget: 'social_connector_target',
32
+ socialIdentityId: 'social_identity_id',
33
+ ssoConnectorIssuer: 'sso_connector_issuer',
34
+ ssoIdentityId: 'sso_identity_id',
35
+ },
36
+ fieldKeys: [
37
+ 'tenantId',
38
+ 'secretId',
39
+ 'connectorId',
40
+ 'ssoConnectorId',
41
+ 'socialConnectorTarget',
42
+ 'socialIdentityId',
43
+ 'ssoConnectorIssuer',
44
+ 'ssoIdentityId',
45
+ ],
46
+ createGuard,
47
+ guard,
48
+ updateGuard: guard.partial(),
49
+ });
@@ -0,0 +1,44 @@
1
+ import { SecretType, JsonObject, GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ *
4
+ * @remarks This is a type for database creation.
5
+ * @see {@link Secret} for the original type.
6
+ */
7
+ export type CreateSecret = {
8
+ tenantId?: string;
9
+ id: string;
10
+ userId: string;
11
+ type: SecretType;
12
+ /** Encrypted data encryption key (DEK) for the secret. */
13
+ encryptedDek: string;
14
+ /** Initialization vector for the secret encryption. */
15
+ iv: string;
16
+ /** Authentication tag for the secret encryption. */
17
+ authTag: string;
18
+ /** The encrypted secret data. e.g. { access_token, refresh_token } */
19
+ ciphertext: string;
20
+ /** The metadata associated with the secret. */
21
+ metadata?: JsonObject;
22
+ createdAt?: number;
23
+ updatedAt?: number;
24
+ };
25
+ export type Secret = {
26
+ tenantId: string;
27
+ id: string;
28
+ userId: string;
29
+ type: SecretType;
30
+ /** Encrypted data encryption key (DEK) for the secret. */
31
+ encryptedDek: string;
32
+ /** Initialization vector for the secret encryption. */
33
+ iv: string;
34
+ /** Authentication tag for the secret encryption. */
35
+ authTag: string;
36
+ /** The encrypted secret data. e.g. { access_token, refresh_token } */
37
+ ciphertext: string;
38
+ /** The metadata associated with the secret. */
39
+ metadata: JsonObject;
40
+ createdAt: number;
41
+ updatedAt: number;
42
+ };
43
+ export type SecretKeys = 'tenantId' | 'id' | 'userId' | 'type' | 'encryptedDek' | 'iv' | 'authTag' | 'ciphertext' | 'metadata' | 'createdAt' | 'updatedAt';
44
+ export declare const Secrets: GeneratedSchema<SecretKeys, CreateSecret, Secret, 'secrets', 'secret'>;
@@ -0,0 +1,62 @@
1
+ // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ import { z } from 'zod';
3
+ import { secretTypeGuard, jsonObjectGuard } from './../foundations/index.js';
4
+ const createGuard = z.object({
5
+ tenantId: z.string().max(21).optional(),
6
+ id: z.string().min(1).max(21),
7
+ userId: z.string().min(1).max(21),
8
+ type: secretTypeGuard,
9
+ encryptedDek: z.string().min(1),
10
+ iv: z.string().min(1),
11
+ authTag: z.string().min(1),
12
+ ciphertext: z.string().min(1),
13
+ metadata: jsonObjectGuard.optional(),
14
+ createdAt: z.number().optional(),
15
+ updatedAt: z.number().optional(),
16
+ });
17
+ const guard = z.object({
18
+ tenantId: z.string().max(21),
19
+ id: z.string().min(1).max(21),
20
+ userId: z.string().min(1).max(21),
21
+ type: secretTypeGuard,
22
+ encryptedDek: z.string().min(1),
23
+ iv: z.string().min(1),
24
+ authTag: z.string().min(1),
25
+ ciphertext: z.string().min(1),
26
+ metadata: jsonObjectGuard,
27
+ createdAt: z.number(),
28
+ updatedAt: z.number(),
29
+ });
30
+ export const Secrets = Object.freeze({
31
+ table: 'secrets',
32
+ tableSingular: 'secret',
33
+ fields: {
34
+ tenantId: 'tenant_id',
35
+ id: 'id',
36
+ userId: 'user_id',
37
+ type: 'type',
38
+ encryptedDek: 'encrypted_dek',
39
+ iv: 'iv',
40
+ authTag: 'auth_tag',
41
+ ciphertext: 'ciphertext',
42
+ metadata: 'metadata',
43
+ createdAt: 'created_at',
44
+ updatedAt: 'updated_at',
45
+ },
46
+ fieldKeys: [
47
+ 'tenantId',
48
+ 'id',
49
+ 'userId',
50
+ 'type',
51
+ 'encryptedDek',
52
+ 'iv',
53
+ 'authTag',
54
+ 'ciphertext',
55
+ 'metadata',
56
+ 'createdAt',
57
+ 'updatedAt',
58
+ ],
59
+ createGuard,
60
+ guard,
61
+ updateGuard: guard.partial(),
62
+ });
@@ -1,4 +1,4 @@
1
- import { Color, Branding, LanguageInfo, SignIn, SignUp, SocialSignIn, ConnectorTargets, CustomContent, CustomUiAssets, PartialPasswordPolicy, Mfa, CaptchaPolicy, SentinelPolicy, GeneratedSchema } from './../foundations/index.js';
1
+ import { Color, Branding, LanguageInfo, SignIn, SignUp, SocialSignIn, ConnectorTargets, CustomContent, CustomUiAssets, PartialPasswordPolicy, Mfa, CaptchaPolicy, SentinelPolicy, EmailBlocklistPolicy, GeneratedSchema } from './../foundations/index.js';
2
2
  import { AgreeToTermsPolicy, SignInMode } from './custom-types.js';
3
3
  /**
4
4
  *
@@ -31,6 +31,7 @@ export type CreateSignInExperience = {
31
31
  unknownSessionRedirectUrl?: string | null;
32
32
  captchaPolicy?: CaptchaPolicy;
33
33
  sentinelPolicy?: SentinelPolicy;
34
+ emailBlocklistPolicy?: EmailBlocklistPolicy;
34
35
  };
35
36
  export type SignInExperience = {
36
37
  tenantId: string;
@@ -58,6 +59,7 @@ export type SignInExperience = {
58
59
  unknownSessionRedirectUrl: string | null;
59
60
  captchaPolicy: CaptchaPolicy;
60
61
  sentinelPolicy: SentinelPolicy;
62
+ emailBlocklistPolicy: EmailBlocklistPolicy;
61
63
  };
62
- export type SignInExperienceKeys = 'tenantId' | 'id' | 'color' | 'branding' | 'languageInfo' | 'termsOfUseUrl' | 'privacyPolicyUrl' | 'agreeToTermsPolicy' | 'signIn' | 'signUp' | 'socialSignIn' | 'socialSignInConnectorTargets' | 'signInMode' | 'customCss' | 'customContent' | 'customUiAssets' | 'passwordPolicy' | 'mfa' | 'singleSignOnEnabled' | 'supportEmail' | 'supportWebsiteUrl' | 'unknownSessionRedirectUrl' | 'captchaPolicy' | 'sentinelPolicy';
64
+ export type SignInExperienceKeys = 'tenantId' | 'id' | 'color' | 'branding' | 'languageInfo' | 'termsOfUseUrl' | 'privacyPolicyUrl' | 'agreeToTermsPolicy' | 'signIn' | 'signUp' | 'socialSignIn' | 'socialSignInConnectorTargets' | 'signInMode' | 'customCss' | 'customContent' | 'customUiAssets' | 'passwordPolicy' | 'mfa' | 'singleSignOnEnabled' | 'supportEmail' | 'supportWebsiteUrl' | 'unknownSessionRedirectUrl' | 'captchaPolicy' | 'sentinelPolicy' | 'emailBlocklistPolicy';
63
65
  export declare const SignInExperiences: GeneratedSchema<SignInExperienceKeys, CreateSignInExperience, SignInExperience, 'sign_in_experiences', 'sign_in_experience'>;
@@ -1,6 +1,6 @@
1
1
  // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
2
  import { z } from 'zod';
3
- import { colorGuard, brandingGuard, languageInfoGuard, signInGuard, signUpGuard, socialSignInGuard, connectorTargetsGuard, customContentGuard, customUiAssetsGuard, partialPasswordPolicyGuard, mfaGuard, captchaPolicyGuard, sentinelPolicyGuard } from './../foundations/index.js';
3
+ import { colorGuard, brandingGuard, languageInfoGuard, signInGuard, signUpGuard, socialSignInGuard, connectorTargetsGuard, customContentGuard, customUiAssetsGuard, partialPasswordPolicyGuard, mfaGuard, captchaPolicyGuard, sentinelPolicyGuard, emailBlocklistPolicyGuard } from './../foundations/index.js';
4
4
  import { AgreeToTermsPolicy, SignInMode } from './custom-types.js';
5
5
  const createGuard = z.object({
6
6
  tenantId: z.string().max(21).optional(),
@@ -27,6 +27,7 @@ const createGuard = z.object({
27
27
  unknownSessionRedirectUrl: z.string().nullable().optional(),
28
28
  captchaPolicy: captchaPolicyGuard.optional(),
29
29
  sentinelPolicy: sentinelPolicyGuard.optional(),
30
+ emailBlocklistPolicy: emailBlocklistPolicyGuard.optional(),
30
31
  });
31
32
  const guard = z.object({
32
33
  tenantId: z.string().max(21),
@@ -53,6 +54,7 @@ const guard = z.object({
53
54
  unknownSessionRedirectUrl: z.string().nullable(),
54
55
  captchaPolicy: captchaPolicyGuard,
55
56
  sentinelPolicy: sentinelPolicyGuard,
57
+ emailBlocklistPolicy: emailBlocklistPolicyGuard,
56
58
  });
57
59
  export const SignInExperiences = Object.freeze({
58
60
  table: 'sign_in_experiences',
@@ -82,6 +84,7 @@ export const SignInExperiences = Object.freeze({
82
84
  unknownSessionRedirectUrl: 'unknown_session_redirect_url',
83
85
  captchaPolicy: 'captcha_policy',
84
86
  sentinelPolicy: 'sentinel_policy',
87
+ emailBlocklistPolicy: 'email_blocklist_policy',
85
88
  },
86
89
  fieldKeys: [
87
90
  'tenantId',
@@ -108,6 +111,7 @@ export const SignInExperiences = Object.freeze({
108
111
  'unknownSessionRedirectUrl',
109
112
  'captchaPolicy',
110
113
  'sentinelPolicy',
114
+ 'emailBlocklistPolicy',
111
115
  ],
112
116
  createGuard,
113
117
  guard,
@@ -13,7 +13,9 @@ export type CreateUserSsoIdentity = {
13
13
  /** Provider user identity id */
14
14
  identityId: string;
15
15
  detail?: JsonObject;
16
+ /** Known issue: created_at uses timestamp instead of timestamptz */
16
17
  createdAt?: number;
18
+ updatedAt?: number;
17
19
  ssoConnectorId: string;
18
20
  };
19
21
  export type UserSsoIdentity = {
@@ -25,8 +27,10 @@ export type UserSsoIdentity = {
25
27
  /** Provider user identity id */
26
28
  identityId: string;
27
29
  detail: JsonObject;
30
+ /** Known issue: created_at uses timestamp instead of timestamptz */
28
31
  createdAt: number;
32
+ updatedAt: number;
29
33
  ssoConnectorId: string;
30
34
  };
31
- export type UserSsoIdentityKeys = 'tenantId' | 'id' | 'userId' | 'issuer' | 'identityId' | 'detail' | 'createdAt' | 'ssoConnectorId';
35
+ export type UserSsoIdentityKeys = 'tenantId' | 'id' | 'userId' | 'issuer' | 'identityId' | 'detail' | 'createdAt' | 'updatedAt' | 'ssoConnectorId';
32
36
  export declare const UserSsoIdentities: GeneratedSchema<UserSsoIdentityKeys, CreateUserSsoIdentity, UserSsoIdentity, 'user_sso_identities', 'user_sso_identity'>;