@logto/schemas 1.10.0 → 1.11.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 (153) hide show
  1. package/alterations/1.10.1-1695647183-update-private-key-type.ts +108 -0
  2. package/alterations/1.10.1-1696657546-organization-tables.ts +150 -0
  3. package/alterations/1.10.1-1697683802-add-sso-connectors-table.ts +66 -0
  4. package/alterations/1.10.1-1698646271-add-organization-created-flag.ts +75 -0
  5. package/alterations/1.10.1-1698820410-add-user-sso-identities-table.ts +61 -0
  6. package/alterations/1.10.1-1698910485-user-logto-data.ts +20 -0
  7. package/alterations/1.11.0-1699422979-add-sso-connector-id-col-to-user-sso-identities-table.ts +18 -0
  8. package/alterations/1.11.0-1699598903-remove-sso-only-column-in-sso-connectors-table.ts +18 -0
  9. package/alterations-js/1.10.1-1695647183-update-private-key-type.d.ts +3 -0
  10. package/alterations-js/1.10.1-1695647183-update-private-key-type.js +50 -0
  11. package/alterations-js/1.10.1-1696657546-organization-tables.d.ts +3 -0
  12. package/alterations-js/1.10.1-1696657546-organization-tables.js +136 -0
  13. package/alterations-js/1.10.1-1697683802-add-sso-connectors-table.d.ts +3 -0
  14. package/alterations-js/1.10.1-1697683802-add-sso-connectors-table.js +58 -0
  15. package/alterations-js/1.10.1-1698646271-add-organization-created-flag.d.ts +3 -0
  16. package/alterations-js/1.10.1-1698646271-add-organization-created-flag.js +26 -0
  17. package/alterations-js/1.10.1-1698820410-add-user-sso-identities-table.d.ts +4 -0
  18. package/alterations-js/1.10.1-1698820410-add-user-sso-identities-table.js +53 -0
  19. package/alterations-js/1.10.1-1698910485-user-logto-data.d.ts +3 -0
  20. package/alterations-js/1.10.1-1698910485-user-logto-data.js +16 -0
  21. package/alterations-js/1.11.0-1699422979-add-sso-connector-id-col-to-user-sso-identities-table.d.ts +3 -0
  22. package/alterations-js/1.11.0-1699422979-add-sso-connector-id-col-to-user-sso-identities-table.js +14 -0
  23. package/alterations-js/1.11.0-1699598903-remove-sso-only-column-in-sso-connectors-table.d.ts +3 -0
  24. package/alterations-js/1.11.0-1699598903-remove-sso-only-column-in-sso-connectors-table.js +14 -0
  25. package/lib/db-entries/application.d.ts +7 -1
  26. package/lib/db-entries/application.js +1 -0
  27. package/lib/db-entries/applications-role.d.ts +7 -1
  28. package/lib/db-entries/applications-role.js +1 -0
  29. package/lib/db-entries/connector.d.ts +7 -1
  30. package/lib/db-entries/connector.js +1 -0
  31. package/lib/db-entries/custom-phrase.d.ts +7 -1
  32. package/lib/db-entries/custom-phrase.js +1 -0
  33. package/lib/db-entries/daily-active-user.d.ts +7 -1
  34. package/lib/db-entries/daily-active-user.js +1 -0
  35. package/lib/db-entries/domain.d.ts +7 -1
  36. package/lib/db-entries/domain.js +1 -0
  37. package/lib/db-entries/hook.d.ts +7 -1
  38. package/lib/db-entries/hook.js +1 -0
  39. package/lib/db-entries/index.d.ts +8 -0
  40. package/lib/db-entries/index.js +8 -0
  41. package/lib/db-entries/log.d.ts +7 -1
  42. package/lib/db-entries/log.js +1 -0
  43. package/lib/db-entries/logto-config.d.ts +10 -4
  44. package/lib/db-entries/logto-config.js +4 -3
  45. package/lib/db-entries/oidc-model-instance.d.ts +7 -1
  46. package/lib/db-entries/oidc-model-instance.js +1 -0
  47. package/lib/db-entries/organization-role-scope-relation.d.ts +20 -0
  48. package/lib/db-entries/organization-role-scope-relation.js +29 -0
  49. package/lib/db-entries/organization-role-user-relation.d.ts +22 -0
  50. package/lib/db-entries/organization-role-user-relation.js +33 -0
  51. package/lib/db-entries/organization-role.d.ts +28 -0
  52. package/lib/db-entries/organization-role.js +33 -0
  53. package/lib/db-entries/organization-scope.d.ts +28 -0
  54. package/lib/db-entries/organization-scope.js +33 -0
  55. package/lib/db-entries/organization-user-relation.d.ts +20 -0
  56. package/lib/db-entries/organization-user-relation.js +29 -0
  57. package/lib/db-entries/organization.d.ts +32 -0
  58. package/lib/db-entries/organization.js +37 -0
  59. package/lib/db-entries/passcode.d.ts +7 -1
  60. package/lib/db-entries/passcode.js +1 -0
  61. package/lib/db-entries/resource.d.ts +7 -1
  62. package/lib/db-entries/resource.js +1 -0
  63. package/lib/db-entries/role.d.ts +7 -1
  64. package/lib/db-entries/role.js +1 -0
  65. package/lib/db-entries/roles-scope.d.ts +7 -1
  66. package/lib/db-entries/roles-scope.js +1 -0
  67. package/lib/db-entries/scope.d.ts +7 -1
  68. package/lib/db-entries/scope.js +1 -0
  69. package/lib/db-entries/sentinel-activity.d.ts +7 -1
  70. package/lib/db-entries/sentinel-activity.js +1 -0
  71. package/lib/db-entries/service-log.d.ts +7 -1
  72. package/lib/db-entries/service-log.js +1 -0
  73. package/lib/db-entries/sign-in-experience.d.ts +7 -1
  74. package/lib/db-entries/sign-in-experience.js +1 -0
  75. package/lib/db-entries/sso-connector.d.ts +46 -0
  76. package/lib/db-entries/sso-connector.js +54 -0
  77. package/lib/db-entries/system.d.ts +7 -1
  78. package/lib/db-entries/system.js +1 -0
  79. package/lib/db-entries/user-sso-identity.d.ts +32 -0
  80. package/lib/db-entries/user-sso-identity.js +50 -0
  81. package/lib/db-entries/user.d.ts +9 -1
  82. package/lib/db-entries/user.js +5 -0
  83. package/lib/db-entries/users-role.d.ts +7 -1
  84. package/lib/db-entries/users-role.js +1 -0
  85. package/lib/db-entries/verification-status.d.ts +7 -1
  86. package/lib/db-entries/verification-status.js +1 -0
  87. package/lib/foundations/index.d.ts +1 -1
  88. package/lib/foundations/index.js +1 -1
  89. package/lib/foundations/jsonb-types/custom-domain.d.ts +134 -0
  90. package/lib/foundations/jsonb-types/custom-domain.js +36 -0
  91. package/lib/foundations/jsonb-types/hooks.d.ts +32 -0
  92. package/lib/foundations/jsonb-types/hooks.js +24 -0
  93. package/lib/foundations/jsonb-types/index.d.ts +15 -0
  94. package/lib/foundations/jsonb-types/index.js +16 -0
  95. package/lib/foundations/jsonb-types/logs.d.ts +106 -0
  96. package/lib/foundations/jsonb-types/logs.js +20 -0
  97. package/lib/foundations/jsonb-types/oidc-module.d.ts +80 -0
  98. package/lib/foundations/jsonb-types/oidc-module.js +54 -0
  99. package/lib/foundations/jsonb-types/phrases.d.ts +5 -0
  100. package/lib/foundations/jsonb-types/phrases.js +2 -0
  101. package/lib/foundations/jsonb-types/sentinel.d.ts +27 -0
  102. package/lib/foundations/jsonb-types/sentinel.js +28 -0
  103. package/lib/foundations/jsonb-types/sign-in-experience.d.ts +118 -0
  104. package/lib/foundations/jsonb-types/sign-in-experience.js +56 -0
  105. package/lib/foundations/jsonb-types/sso-connector.d.ts +14 -0
  106. package/lib/foundations/jsonb-types/sso-connector.js +6 -0
  107. package/lib/foundations/jsonb-types/users.d.ts +285 -0
  108. package/lib/foundations/jsonb-types/users.js +47 -0
  109. package/lib/foundations/schemas.d.ts +11 -13
  110. package/lib/models/tenants.d.ts +8 -16
  111. package/lib/models/tenants.js +1 -6
  112. package/lib/seeds/logto-config.js +1 -0
  113. package/lib/types/application.d.ts +51 -1
  114. package/lib/types/application.js +7 -1
  115. package/lib/types/connector.d.ts +516 -2360
  116. package/lib/types/domain.d.ts +65 -27
  117. package/lib/types/hook.d.ts +15 -16
  118. package/lib/types/index.d.ts +4 -0
  119. package/lib/types/index.js +4 -0
  120. package/lib/types/interactions.d.ts +502 -10
  121. package/lib/types/interactions.js +83 -5
  122. package/lib/types/log/interaction.d.ts +4 -3
  123. package/lib/types/log/interaction.js +1 -0
  124. package/lib/types/logto-config.d.ts +74 -2
  125. package/lib/types/logto-config.js +38 -3
  126. package/lib/types/mfa.d.ts +211 -0
  127. package/lib/types/mfa.js +62 -0
  128. package/lib/types/organization.d.ts +48 -0
  129. package/lib/types/organization.js +21 -0
  130. package/lib/types/role.d.ts +5 -3
  131. package/lib/types/scope.d.ts +12 -27
  132. package/lib/types/sso-connector.d.ts +137 -0
  133. package/lib/types/sso-connector.js +24 -0
  134. package/lib/types/system.d.ts +26 -7
  135. package/lib/types/system.js +8 -0
  136. package/lib/types/tenant.d.ts +5 -0
  137. package/lib/types/tenant.js +6 -0
  138. package/lib/types/user-assets.d.ts +2 -2
  139. package/lib/types/user.d.ts +209 -66
  140. package/lib/types/user.js +8 -2
  141. package/package.json +7 -7
  142. package/tables/logto_configs.sql +1 -1
  143. package/tables/organization_role_scope_relations.sql +12 -0
  144. package/tables/organization_role_user_relations.sql +14 -0
  145. package/tables/organization_roles.sql +19 -0
  146. package/tables/organization_scopes.sql +19 -0
  147. package/tables/organization_user_relations.sql +12 -0
  148. package/tables/organizations.sql +19 -0
  149. package/tables/sso_connectors.sql +28 -0
  150. package/tables/user_sso_identities.sql +20 -0
  151. package/tables/users.sql +1 -0
  152. package/lib/foundations/jsonb-types.d.ts +0 -673
  153. package/lib/foundations/jsonb-types.js +0 -260
@@ -0,0 +1,136 @@
1
+ import { sql } from 'slonik';
2
+ const getDatabaseName = async (pool) => {
3
+ const { currentDatabase } = await pool.one(sql `
4
+ select current_database();
5
+ `);
6
+ return currentDatabase.replaceAll('-', '_');
7
+ };
8
+ const enableRls = async (pool, database, table) => {
9
+ const baseRoleId = sql.identifier([`logto_tenant_${database}`]);
10
+ await pool.query(sql `
11
+ create trigger set_tenant_id before insert on ${sql.identifier([table])}
12
+ for each row execute procedure set_tenant_id();
13
+
14
+ alter table ${sql.identifier([table])} enable row level security;
15
+
16
+ create policy ${sql.identifier([`${table}_tenant_id`])} on ${sql.identifier([table])}
17
+ as restrictive
18
+ using (tenant_id = (select id from tenants where db_user = current_user));
19
+
20
+ create policy ${sql.identifier([`${table}_modification`])} on ${sql.identifier([table])}
21
+ using (true);
22
+
23
+ grant select, insert, update, delete on ${sql.identifier([table])} to ${baseRoleId};
24
+ `);
25
+ };
26
+ const alteration = {
27
+ up: async (pool) => {
28
+ const database = await getDatabaseName(pool);
29
+ await pool.query(sql `
30
+ create table organizations (
31
+ tenant_id varchar(21) not null
32
+ references tenants (id) on update cascade on delete cascade,
33
+ /** The globally unique identifier of the organization. */
34
+ id varchar(21) not null,
35
+ /** The organization's name for display. */
36
+ name varchar(128) not null,
37
+ /** A brief description of the organization. */
38
+ description varchar(256),
39
+ /** When the organization was created. */
40
+ created_at timestamptz not null default(now()),
41
+ primary key (id)
42
+ );
43
+
44
+ create index organizations__id
45
+ on organizations (tenant_id, id);
46
+ `);
47
+ await enableRls(pool, database, 'organizations');
48
+ await pool.query(sql `
49
+ create table organization_roles (
50
+ tenant_id varchar(21) not null
51
+ references tenants (id) on update cascade on delete cascade,
52
+ /** The globally unique identifier of the organization role. */
53
+ id varchar(21) not null,
54
+ /** The organization role's name, unique within the organization template. */
55
+ name varchar(128) not null,
56
+ /** A brief description of the organization role. */
57
+ description varchar(256),
58
+ primary key (id),
59
+ constraint organization_roles__name
60
+ unique (tenant_id, name)
61
+ );
62
+
63
+ create index organization_roles__id
64
+ on organization_roles (tenant_id, id);
65
+ `);
66
+ await enableRls(pool, database, 'organization_roles');
67
+ await pool.query(sql `
68
+ create table organization_scopes (
69
+ tenant_id varchar(21) not null
70
+ references tenants (id) on update cascade on delete cascade,
71
+ /** The globally unique identifier of the organization scope. */
72
+ id varchar(21) not null,
73
+ /** The organization scope's name, unique within the organization template. */
74
+ name varchar(128) not null,
75
+ /** A brief description of the organization scope. */
76
+ description varchar(256),
77
+ primary key (id),
78
+ constraint organization_scopes__name
79
+ unique (tenant_id, name)
80
+ );
81
+
82
+ create index organization_scopes__id
83
+ on organization_scopes (tenant_id, id);
84
+ `);
85
+ await enableRls(pool, database, 'organization_scopes');
86
+ await pool.query(sql `
87
+ create table organization_role_user_relations (
88
+ tenant_id varchar(21) not null
89
+ references tenants (id) on update cascade on delete cascade,
90
+ organization_id varchar(21) not null
91
+ references organizations (id) on update cascade on delete cascade,
92
+ organization_role_id varchar(21) not null
93
+ references organization_roles (id) on update cascade on delete cascade,
94
+ user_id varchar(21) not null
95
+ references users (id) on update cascade on delete cascade,
96
+ primary key (tenant_id, organization_id, organization_role_id, user_id)
97
+ );
98
+ `);
99
+ await enableRls(pool, database, 'organization_role_user_relations');
100
+ await pool.query(sql `
101
+ create table organization_role_scope_relations (
102
+ tenant_id varchar(21) not null
103
+ references tenants (id) on update cascade on delete cascade,
104
+ organization_role_id varchar(21) not null
105
+ references organization_roles (id) on update cascade on delete cascade,
106
+ organization_scope_id varchar(21) not null
107
+ references organization_scopes (id) on update cascade on delete cascade,
108
+ primary key (tenant_id, organization_role_id, organization_scope_id)
109
+ );
110
+ `);
111
+ await enableRls(pool, database, 'organization_role_scope_relations');
112
+ await pool.query(sql `
113
+ create table organization_user_relations (
114
+ tenant_id varchar(21) not null
115
+ references tenants (id) on update cascade on delete cascade,
116
+ organization_id varchar(21) not null
117
+ references organizations (id) on update cascade on delete cascade,
118
+ user_id varchar(21) not null
119
+ references users (id) on update cascade on delete cascade,
120
+ primary key (tenant_id, organization_id, user_id)
121
+ );
122
+ `);
123
+ await enableRls(pool, database, 'organization_user_relations');
124
+ },
125
+ down: async (pool) => {
126
+ await pool.query(sql `
127
+ drop table organization_role_scope_relations;
128
+ drop table organization_role_user_relations;
129
+ drop table organization_scopes;
130
+ drop table organization_roles;
131
+ drop table organization_user_relations;
132
+ drop table organizations;
133
+ `);
134
+ },
135
+ };
136
+ export default alteration;
@@ -0,0 +1,3 @@
1
+ import type { AlterationScript } from '../lib/types/alteration.js';
2
+ declare const alteration: AlterationScript;
3
+ export default alteration;
@@ -0,0 +1,58 @@
1
+ import { sql } from 'slonik';
2
+ const getId = (value) => sql.identifier([value]);
3
+ const getDatabaseName = async (pool) => {
4
+ const { currentDatabase } = await pool.one(sql `
5
+ select current_database();
6
+ `);
7
+ return currentDatabase.replaceAll('-', '_');
8
+ };
9
+ const alteration = {
10
+ up: async (pool) => {
11
+ const database = await getDatabaseName(pool);
12
+ const baseRoleId = getId(`logto_tenant_${database}`);
13
+ await pool.query(sql `
14
+ create table sso_connectors (
15
+ tenant_id varchar(21) not null
16
+ references tenants (id) on update cascade on delete cascade,
17
+ id varchar(128) not null,
18
+ provider_name varchar(128) not null,
19
+ connector_name varchar(128) not null,
20
+ config jsonb not null default '{}'::jsonb,
21
+ domains jsonb not null default '[]'::jsonb,
22
+ branding jsonb not null default '{}'::jsonb,
23
+ sync_profile boolean not null default FALSE,
24
+ sso_only boolean not null default FALSE,
25
+ created_at timestamptz not null default(now()),
26
+ primary key (id)
27
+ );
28
+
29
+ create index sso_connectors__id
30
+ on sso_connectors (tenant_id, id);
31
+
32
+ create index sso_connectors__id__provider_name
33
+ on sso_connectors (tenant_id, id, provider_name);
34
+
35
+ create trigger set_tenant_id before insert on sso_connectors
36
+ for each row execute procedure set_tenant_id();
37
+
38
+ alter table sso_connectors enable row level security;
39
+
40
+ create policy sso_connectors_tenant_id on sso_connectors
41
+ as restrictive
42
+ using (tenant_id = (select id from tenants where db_user = current_user));
43
+
44
+ create policy sso_connectors_modification on sso_connectors
45
+ using (true);
46
+
47
+ grant select, insert, update, delete on sso_connectors to ${baseRoleId};
48
+ `);
49
+ },
50
+ down: async (pool) => {
51
+ await pool.query(sql `
52
+ drop policy sso_connectors_modification on sso_connectors;
53
+ drop policy sso_connectors_tenant_id on sso_connectors;
54
+ drop table sso_connectors;
55
+ `);
56
+ },
57
+ };
58
+ export default alteration;
@@ -0,0 +1,3 @@
1
+ import type { AlterationScript } from '../lib/types/alteration.js';
2
+ declare const alteration: AlterationScript;
3
+ export default alteration;
@@ -0,0 +1,26 @@
1
+ import { sql } from 'slonik';
2
+ const adminConsoleConfigKey = 'adminConsole';
3
+ const alterAdminConsoleData = async (logtoConfig, pool) => {
4
+ const { tenantId, value: oldAdminConsoleConfig } = logtoConfig;
5
+ const newAdminConsoleData = {
6
+ ...oldAdminConsoleConfig,
7
+ organizationCreated: false,
8
+ };
9
+ await pool.query(sql `update logto_configs set value = ${JSON.stringify(newAdminConsoleData)} where tenant_id = ${tenantId} and key = ${adminConsoleConfigKey}`);
10
+ };
11
+ const rollbackAdminConsoleData = async (logtoConfig, pool) => {
12
+ const { tenantId, value: newAdminConsoleConfig } = logtoConfig;
13
+ const { organizationCreated, ...oldAdminConsoleData } = newAdminConsoleConfig;
14
+ await pool.query(sql `update logto_configs set value = ${JSON.stringify(oldAdminConsoleData)} where tenant_id = ${tenantId} and key = ${adminConsoleConfigKey}`);
15
+ };
16
+ const alteration = {
17
+ up: async (pool) => {
18
+ const rows = await pool.many(sql `select * from logto_configs where key = ${adminConsoleConfigKey}`);
19
+ await Promise.all(rows.map(async (row) => alterAdminConsoleData(row, pool)));
20
+ },
21
+ down: async (pool) => {
22
+ const rows = await pool.many(sql `select * from logto_configs where key = ${adminConsoleConfigKey}`);
23
+ await Promise.all(rows.map(async (row) => rollbackAdminConsoleData(row, pool)));
24
+ },
25
+ };
26
+ export default alteration;
@@ -0,0 +1,4 @@
1
+ import type { AlterationScript } from '../lib/types/alteration.js';
2
+ /** The alteration script for adding `sso_identities` column to the users table. */
3
+ declare const alteration: AlterationScript;
4
+ export default alteration;
@@ -0,0 +1,53 @@
1
+ import { sql } from 'slonik';
2
+ const getId = (value) => sql.identifier([value]);
3
+ const getDatabaseName = async (pool) => {
4
+ const { currentDatabase } = await pool.one(sql `
5
+ select current_database();
6
+ `);
7
+ return currentDatabase.replaceAll('-', '_');
8
+ };
9
+ /** The alteration script for adding `sso_identities` column to the users table. */
10
+ const alteration = {
11
+ up: async (pool) => {
12
+ const database = await getDatabaseName(pool);
13
+ const baseRoleId = getId(`logto_tenant_${database}`);
14
+ await pool.query(sql `
15
+ create table user_sso_identities (
16
+ tenant_id varchar(21) not null
17
+ references tenants (id) on update cascade on delete cascade,
18
+ id varchar(21) not null,
19
+ user_id varchar(12) not null
20
+ references users (id) on update cascade on delete cascade,
21
+ issuer varchar(256) not null,
22
+ identity_id varchar(128) not null,
23
+ detail jsonb not null default '{}'::jsonb,
24
+ created_at timestamp not null default(now()),
25
+ primary key (id),
26
+ constraint user_sso_identities__issuer__identity_id
27
+ unique (tenant_id, issuer, identity_id)
28
+ );
29
+
30
+ create trigger set_tenant_id before insert on user_sso_identities
31
+ for each row execute procedure set_tenant_id();
32
+
33
+ alter table user_sso_identities enable row level security;
34
+
35
+ create policy user_sso_identities_tenant_id on user_sso_identities
36
+ as restrictive
37
+ using (tenant_id = (select id from tenants where db_user = current_user));
38
+
39
+ create policy user_sso_identities_modification on user_sso_identities
40
+ using (true);
41
+
42
+ grant select, insert, update, delete on user_sso_identities to ${baseRoleId};
43
+ `);
44
+ },
45
+ down: async (pool) => {
46
+ await pool.query(sql `
47
+ drop policy user_sso_identities_modification on user_sso_identities;
48
+ drop policy user_sso_identities_tenant_id on user_sso_identities;
49
+ drop table user_sso_identities;
50
+ `);
51
+ },
52
+ };
53
+ export default alteration;
@@ -0,0 +1,3 @@
1
+ import type { AlterationScript } from '../lib/types/alteration.js';
2
+ declare const alteration: AlterationScript;
3
+ export default alteration;
@@ -0,0 +1,16 @@
1
+ import { sql } from 'slonik';
2
+ const alteration = {
3
+ up: async (pool) => {
4
+ await pool.query(sql `
5
+ alter table users
6
+ add column if not exists logto_config jsonb not null default '{}'::jsonb;
7
+ `);
8
+ },
9
+ down: async (pool) => {
10
+ await pool.query(sql `
11
+ alter table users
12
+ drop column logto_config;
13
+ `);
14
+ },
15
+ };
16
+ export default alteration;
@@ -0,0 +1,3 @@
1
+ import type { AlterationScript } from '../lib/types/alteration.js';
2
+ declare const alteration: AlterationScript;
3
+ export default alteration;
@@ -0,0 +1,14 @@
1
+ import { sql } from 'slonik';
2
+ const alteration = {
3
+ up: async (pool) => {
4
+ await pool.query(sql `
5
+ alter table user_sso_identities add column sso_connector_id varchar(128) not null references sso_connectors (id) on update cascade on delete cascade;
6
+ `);
7
+ },
8
+ down: async (pool) => {
9
+ await pool.query(sql `
10
+ alter table user_sso_identities drop column sso_connector_id;
11
+ `);
12
+ },
13
+ };
14
+ export default alteration;
@@ -0,0 +1,3 @@
1
+ import type { AlterationScript } from '../lib/types/alteration.js';
2
+ declare const alteration: AlterationScript;
3
+ export default alteration;
@@ -0,0 +1,14 @@
1
+ import { sql } from 'slonik';
2
+ const alteration = {
3
+ up: async (pool) => {
4
+ await pool.query(sql `
5
+ alter table sso_connectors drop column sso_only;
6
+ `);
7
+ },
8
+ down: async (pool) => {
9
+ await pool.query(sql `
10
+ alter table sso_connectors add column sso_only boolean not null default FALSE;
11
+ `);
12
+ },
13
+ };
14
+ export default alteration;
@@ -1,5 +1,10 @@
1
1
  import { OidcClientMetadata, CustomClientMetadata, GeneratedSchema } from './../foundations/index.js';
2
2
  import { ApplicationType } from './custom-types.js';
3
+ /**
4
+ *
5
+ * @remarks This is a type for database creation.
6
+ * @see {@link Application} for the original type.
7
+ */
3
8
  export type CreateApplication = {
4
9
  tenantId?: string;
5
10
  id: string;
@@ -22,4 +27,5 @@ export type Application = {
22
27
  customClientMetadata: CustomClientMetadata;
23
28
  createdAt: number;
24
29
  };
25
- export declare const Applications: GeneratedSchema<CreateApplication, Application>;
30
+ export type ApplicationKeys = 'tenantId' | 'id' | 'name' | 'secret' | 'description' | 'type' | 'oidcClientMetadata' | 'customClientMetadata' | 'createdAt';
31
+ export declare const Applications: GeneratedSchema<ApplicationKeys, CreateApplication, Application, 'applications', 'application'>;
@@ -51,4 +51,5 @@ export const Applications = Object.freeze({
51
51
  ],
52
52
  createGuard,
53
53
  guard,
54
+ updateGuard: guard.partial(),
54
55
  });
@@ -1,4 +1,9 @@
1
1
  import { GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ *
4
+ * @remarks This is a type for database creation.
5
+ * @see {@link ApplicationsRole} for the original type.
6
+ */
2
7
  export type CreateApplicationsRole = {
3
8
  tenantId?: string;
4
9
  id: string;
@@ -11,4 +16,5 @@ export type ApplicationsRole = {
11
16
  applicationId: string;
12
17
  roleId: string;
13
18
  };
14
- export declare const ApplicationsRoles: GeneratedSchema<CreateApplicationsRole, ApplicationsRole>;
19
+ export type ApplicationsRoleKeys = 'tenantId' | 'id' | 'applicationId' | 'roleId';
20
+ export declare const ApplicationsRoles: GeneratedSchema<ApplicationsRoleKeys, CreateApplicationsRole, ApplicationsRole, 'applications_roles', 'applications_role'>;
@@ -29,4 +29,5 @@ export const ApplicationsRoles = Object.freeze({
29
29
  ],
30
30
  createGuard,
31
31
  guard,
32
+ updateGuard: guard.partial(),
32
33
  });
@@ -1,4 +1,9 @@
1
1
  import { JsonObject, ConfigurableConnectorMetadata, GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ *
4
+ * @remarks This is a type for database creation.
5
+ * @see {@link Connector} for the original type.
6
+ */
2
7
  export type CreateConnector = {
3
8
  tenantId?: string;
4
9
  id: string;
@@ -17,4 +22,5 @@ export type Connector = {
17
22
  metadata: ConfigurableConnectorMetadata;
18
23
  createdAt: number;
19
24
  };
20
- export declare const Connectors: GeneratedSchema<CreateConnector, Connector>;
25
+ export type ConnectorKeys = 'tenantId' | 'id' | 'syncProfile' | 'connectorId' | 'config' | 'metadata' | 'createdAt';
26
+ export declare const Connectors: GeneratedSchema<ConnectorKeys, CreateConnector, Connector, 'connectors', 'connector'>;
@@ -42,4 +42,5 @@ export const Connectors = Object.freeze({
42
42
  ],
43
43
  createGuard,
44
44
  guard,
45
+ updateGuard: guard.partial(),
45
46
  });
@@ -1,4 +1,9 @@
1
1
  import { Translation, GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ *
4
+ * @remarks This is a type for database creation.
5
+ * @see {@link CustomPhrase} for the original type.
6
+ */
2
7
  export type CreateCustomPhrase = {
3
8
  tenantId?: string;
4
9
  id: string;
@@ -11,4 +16,5 @@ export type CustomPhrase = {
11
16
  languageTag: string;
12
17
  translation: Translation;
13
18
  };
14
- export declare const CustomPhrases: GeneratedSchema<CreateCustomPhrase, CustomPhrase>;
19
+ export type CustomPhraseKeys = 'tenantId' | 'id' | 'languageTag' | 'translation';
20
+ export declare const CustomPhrases: GeneratedSchema<CustomPhraseKeys, CreateCustomPhrase, CustomPhrase, 'custom_phrases', 'custom_phrase'>;
@@ -30,4 +30,5 @@ export const CustomPhrases = Object.freeze({
30
30
  ],
31
31
  createGuard,
32
32
  guard,
33
+ updateGuard: guard.partial(),
33
34
  });
@@ -1,4 +1,9 @@
1
1
  import { GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ *
4
+ * @remarks This is a type for database creation.
5
+ * @see {@link DailyActiveUser} for the original type.
6
+ */
2
7
  export type CreateDailyActiveUser = {
3
8
  id: string;
4
9
  tenantId?: string;
@@ -11,4 +16,5 @@ export type DailyActiveUser = {
11
16
  userId: string;
12
17
  date: number;
13
18
  };
14
- export declare const DailyActiveUsers: GeneratedSchema<CreateDailyActiveUser, DailyActiveUser>;
19
+ export type DailyActiveUserKeys = 'id' | 'tenantId' | 'userId' | 'date';
20
+ export declare const DailyActiveUsers: GeneratedSchema<DailyActiveUserKeys, CreateDailyActiveUser, DailyActiveUser, 'daily_active_users', 'daily_active_user'>;
@@ -29,4 +29,5 @@ export const DailyActiveUsers = Object.freeze({
29
29
  ],
30
30
  createGuard,
31
31
  guard,
32
+ updateGuard: guard.partial(),
32
33
  });
@@ -1,4 +1,9 @@
1
1
  import { DomainStatus, DomainDnsRecords, CloudflareData, GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ *
4
+ * @remarks This is a type for database creation.
5
+ * @see {@link Domain} for the original type.
6
+ */
2
7
  export type CreateDomain = {
3
8
  tenantId?: string;
4
9
  id: string;
@@ -21,4 +26,5 @@ export type Domain = {
21
26
  updatedAt: number;
22
27
  createdAt: number;
23
28
  };
24
- export declare const Domains: GeneratedSchema<CreateDomain, Domain>;
29
+ export type DomainKeys = 'tenantId' | 'id' | 'domain' | 'status' | 'errorMessage' | 'dnsRecords' | 'cloudflareData' | 'updatedAt' | 'createdAt';
30
+ export declare const Domains: GeneratedSchema<DomainKeys, CreateDomain, Domain, 'domains', 'domain'>;
@@ -50,4 +50,5 @@ export const Domains = Object.freeze({
50
50
  ],
51
51
  createGuard,
52
52
  guard,
53
+ updateGuard: guard.partial(),
53
54
  });
@@ -1,4 +1,9 @@
1
1
  import { HookEvent, HookEvents, HookConfig, GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ *
4
+ * @remarks This is a type for database creation.
5
+ * @see {@link Hook} for the original type.
6
+ */
2
7
  export type CreateHook = {
3
8
  tenantId?: string;
4
9
  id: string;
@@ -21,4 +26,5 @@ export type Hook = {
21
26
  enabled: boolean;
22
27
  createdAt: number;
23
28
  };
24
- export declare const Hooks: GeneratedSchema<CreateHook, Hook>;
29
+ export type HookKeys = 'tenantId' | 'id' | 'name' | 'event' | 'events' | 'config' | 'signingKey' | 'enabled' | 'createdAt';
30
+ export declare const Hooks: GeneratedSchema<HookKeys, CreateHook, Hook, 'hooks', 'hook'>;
@@ -50,4 +50,5 @@ export const Hooks = Object.freeze({
50
50
  ],
51
51
  createGuard,
52
52
  guard,
53
+ updateGuard: guard.partial(),
53
54
  });
@@ -13,6 +13,12 @@ export * from './hook.js';
13
13
  export * from './log.js';
14
14
  export * from './logto-config.js';
15
15
  export * from './oidc-model-instance.js';
16
+ export * from './organization-role-scope-relation.js';
17
+ export * from './organization-role-user-relation.js';
18
+ export * from './organization-role.js';
19
+ export * from './organization-scope.js';
20
+ export * from './organization-user-relation.js';
21
+ export * from './organization.js';
16
22
  export * from './passcode.js';
17
23
  export * from './resource.js';
18
24
  export * from './role.js';
@@ -21,7 +27,9 @@ export * from './scope.js';
21
27
  export * from './sentinel-activity.js';
22
28
  export * from './service-log.js';
23
29
  export * from './sign-in-experience.js';
30
+ export * from './sso-connector.js';
24
31
  export * from './system.js';
32
+ export * from './user-sso-identity.js';
25
33
  export * from './user.js';
26
34
  export * from './users-role.js';
27
35
  export * from './verification-status.js';
@@ -14,6 +14,12 @@ export * from './hook.js';
14
14
  export * from './log.js';
15
15
  export * from './logto-config.js';
16
16
  export * from './oidc-model-instance.js';
17
+ export * from './organization-role-scope-relation.js';
18
+ export * from './organization-role-user-relation.js';
19
+ export * from './organization-role.js';
20
+ export * from './organization-scope.js';
21
+ export * from './organization-user-relation.js';
22
+ export * from './organization.js';
17
23
  export * from './passcode.js';
18
24
  export * from './resource.js';
19
25
  export * from './role.js';
@@ -22,7 +28,9 @@ export * from './scope.js';
22
28
  export * from './sentinel-activity.js';
23
29
  export * from './service-log.js';
24
30
  export * from './sign-in-experience.js';
31
+ export * from './sso-connector.js';
25
32
  export * from './system.js';
33
+ export * from './user-sso-identity.js';
26
34
  export * from './user.js';
27
35
  export * from './users-role.js';
28
36
  export * from './verification-status.js';
@@ -1,4 +1,9 @@
1
1
  import { LogContextPayload, GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ *
4
+ * @remarks This is a type for database creation.
5
+ * @see {@link Log} for the original type.
6
+ */
2
7
  export type CreateLog = {
3
8
  tenantId?: string;
4
9
  id: string;
@@ -13,4 +18,5 @@ export type Log = {
13
18
  payload: LogContextPayload;
14
19
  createdAt: number;
15
20
  };
16
- export declare const Logs: GeneratedSchema<CreateLog, Log>;
21
+ export type LogKeys = 'tenantId' | 'id' | 'key' | 'payload' | 'createdAt';
22
+ export declare const Logs: GeneratedSchema<LogKeys, CreateLog, Log, 'logs', 'log'>;
@@ -34,4 +34,5 @@ export const Logs = Object.freeze({
34
34
  ],
35
35
  createGuard,
36
36
  guard,
37
+ updateGuard: guard.partial(),
37
38
  });
@@ -1,12 +1,18 @@
1
- import { JsonObject, GeneratedSchema } from './../foundations/index.js';
1
+ import { Json, GeneratedSchema } from './../foundations/index.js';
2
+ /**
3
+ *
4
+ * @remarks This is a type for database creation.
5
+ * @see {@link LogtoConfig} for the original type.
6
+ */
2
7
  export type CreateLogtoConfig = {
3
8
  tenantId?: string;
4
9
  key: string;
5
- value?: JsonObject;
10
+ value?: Json;
6
11
  };
7
12
  export type LogtoConfig = {
8
13
  tenantId: string;
9
14
  key: string;
10
- value: JsonObject;
15
+ value: Json;
11
16
  };
12
- export declare const LogtoConfigs: GeneratedSchema<CreateLogtoConfig, LogtoConfig>;
17
+ export type LogtoConfigKeys = 'tenantId' | 'key' | 'value';
18
+ export declare const LogtoConfigs: GeneratedSchema<LogtoConfigKeys, CreateLogtoConfig, LogtoConfig, 'logto_configs', 'logto_config'>;
@@ -1,15 +1,15 @@
1
1
  // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
2
  import { z } from 'zod';
3
- import { jsonObjectGuard } from './../foundations/index.js';
3
+ import { jsonGuard } from './../foundations/index.js';
4
4
  const createGuard = z.object({
5
5
  tenantId: z.string().max(21).optional(),
6
6
  key: z.string().min(1).max(256),
7
- value: jsonObjectGuard.optional(),
7
+ value: jsonGuard.optional(),
8
8
  });
9
9
  const guard = z.object({
10
10
  tenantId: z.string().max(21),
11
11
  key: z.string().min(1).max(256),
12
- value: jsonObjectGuard,
12
+ value: jsonGuard,
13
13
  });
14
14
  export const LogtoConfigs = Object.freeze({
15
15
  table: 'logto_configs',
@@ -26,4 +26,5 @@ export const LogtoConfigs = Object.freeze({
26
26
  ],
27
27
  createGuard,
28
28
  guard,
29
+ updateGuard: guard.partial(),
29
30
  });