@logto/schemas 1.10.0 → 1.10.1
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.
- package/alterations/1.10.1-1695647183-update-private-key-type.ts +108 -0
- package/alterations/1.10.1-1696657546-organization-tables.ts +150 -0
- package/alterations/1.10.1-1697683802-add-sso-connectors-table.ts +66 -0
- package/alterations/1.10.1-1698646271-add-organization-created-flag.ts +75 -0
- package/alterations/1.10.1-1698820410-add-user-sso-identities-table.ts +61 -0
- package/alterations/1.10.1-1698910485-user-logto-data.ts +20 -0
- package/alterations-js/1.10.1-1695647183-update-private-key-type.d.ts +3 -0
- package/alterations-js/1.10.1-1695647183-update-private-key-type.js +50 -0
- package/alterations-js/1.10.1-1696657546-organization-tables.d.ts +3 -0
- package/alterations-js/1.10.1-1696657546-organization-tables.js +136 -0
- package/alterations-js/1.10.1-1697683802-add-sso-connectors-table.d.ts +3 -0
- package/alterations-js/1.10.1-1697683802-add-sso-connectors-table.js +58 -0
- package/alterations-js/1.10.1-1698646271-add-organization-created-flag.d.ts +3 -0
- package/alterations-js/1.10.1-1698646271-add-organization-created-flag.js +26 -0
- package/alterations-js/1.10.1-1698820410-add-user-sso-identities-table.d.ts +4 -0
- package/alterations-js/1.10.1-1698820410-add-user-sso-identities-table.js +53 -0
- package/alterations-js/1.10.1-1698910485-user-logto-data.d.ts +3 -0
- package/alterations-js/1.10.1-1698910485-user-logto-data.js +16 -0
- package/lib/db-entries/application.d.ts +7 -1
- package/lib/db-entries/application.js +1 -0
- package/lib/db-entries/applications-role.d.ts +7 -1
- package/lib/db-entries/applications-role.js +1 -0
- package/lib/db-entries/connector.d.ts +7 -1
- package/lib/db-entries/connector.js +1 -0
- package/lib/db-entries/custom-phrase.d.ts +7 -1
- package/lib/db-entries/custom-phrase.js +1 -0
- package/lib/db-entries/daily-active-user.d.ts +7 -1
- package/lib/db-entries/daily-active-user.js +1 -0
- package/lib/db-entries/domain.d.ts +7 -1
- package/lib/db-entries/domain.js +1 -0
- package/lib/db-entries/hook.d.ts +7 -1
- package/lib/db-entries/hook.js +1 -0
- package/lib/db-entries/index.d.ts +8 -0
- package/lib/db-entries/index.js +8 -0
- package/lib/db-entries/log.d.ts +7 -1
- package/lib/db-entries/log.js +1 -0
- package/lib/db-entries/logto-config.d.ts +10 -4
- package/lib/db-entries/logto-config.js +4 -3
- package/lib/db-entries/oidc-model-instance.d.ts +7 -1
- package/lib/db-entries/oidc-model-instance.js +1 -0
- package/lib/db-entries/organization-role-scope-relation.d.ts +20 -0
- package/lib/db-entries/organization-role-scope-relation.js +29 -0
- package/lib/db-entries/organization-role-user-relation.d.ts +22 -0
- package/lib/db-entries/organization-role-user-relation.js +33 -0
- package/lib/db-entries/organization-role.d.ts +28 -0
- package/lib/db-entries/organization-role.js +33 -0
- package/lib/db-entries/organization-scope.d.ts +28 -0
- package/lib/db-entries/organization-scope.js +33 -0
- package/lib/db-entries/organization-user-relation.d.ts +20 -0
- package/lib/db-entries/organization-user-relation.js +29 -0
- package/lib/db-entries/organization.d.ts +32 -0
- package/lib/db-entries/organization.js +37 -0
- package/lib/db-entries/passcode.d.ts +7 -1
- package/lib/db-entries/passcode.js +1 -0
- package/lib/db-entries/resource.d.ts +7 -1
- package/lib/db-entries/resource.js +1 -0
- package/lib/db-entries/role.d.ts +7 -1
- package/lib/db-entries/role.js +1 -0
- package/lib/db-entries/roles-scope.d.ts +7 -1
- package/lib/db-entries/roles-scope.js +1 -0
- package/lib/db-entries/scope.d.ts +7 -1
- package/lib/db-entries/scope.js +1 -0
- package/lib/db-entries/sentinel-activity.d.ts +7 -1
- package/lib/db-entries/sentinel-activity.js +1 -0
- package/lib/db-entries/service-log.d.ts +7 -1
- package/lib/db-entries/service-log.js +1 -0
- package/lib/db-entries/sign-in-experience.d.ts +7 -1
- package/lib/db-entries/sign-in-experience.js +1 -0
- package/lib/db-entries/sso-connector.d.ts +50 -0
- package/lib/db-entries/sso-connector.js +58 -0
- package/lib/db-entries/system.d.ts +7 -1
- package/lib/db-entries/system.js +1 -0
- package/lib/db-entries/user-sso-identity.d.ts +30 -0
- package/lib/db-entries/user-sso-identity.js +46 -0
- package/lib/db-entries/user.d.ts +9 -1
- package/lib/db-entries/user.js +5 -0
- package/lib/db-entries/users-role.d.ts +7 -1
- package/lib/db-entries/users-role.js +1 -0
- package/lib/db-entries/verification-status.d.ts +7 -1
- package/lib/db-entries/verification-status.js +1 -0
- package/lib/foundations/index.d.ts +1 -1
- package/lib/foundations/index.js +1 -1
- package/lib/foundations/jsonb-types/custom-domain.d.ts +134 -0
- package/lib/foundations/jsonb-types/custom-domain.js +36 -0
- package/lib/foundations/jsonb-types/hooks.d.ts +32 -0
- package/lib/foundations/jsonb-types/hooks.js +24 -0
- package/lib/foundations/jsonb-types/index.d.ts +15 -0
- package/lib/foundations/jsonb-types/index.js +16 -0
- package/lib/foundations/jsonb-types/logs.d.ts +106 -0
- package/lib/foundations/jsonb-types/logs.js +20 -0
- package/lib/foundations/jsonb-types/oidc-module.d.ts +80 -0
- package/lib/foundations/jsonb-types/oidc-module.js +54 -0
- package/lib/foundations/jsonb-types/phrases.d.ts +5 -0
- package/lib/foundations/jsonb-types/phrases.js +2 -0
- package/lib/foundations/jsonb-types/sentinel.d.ts +27 -0
- package/lib/foundations/jsonb-types/sentinel.js +28 -0
- package/lib/foundations/jsonb-types/sign-in-experience.d.ts +118 -0
- package/lib/foundations/jsonb-types/sign-in-experience.js +56 -0
- package/lib/foundations/jsonb-types/sso-connector.d.ts +14 -0
- package/lib/foundations/jsonb-types/sso-connector.js +6 -0
- package/lib/foundations/jsonb-types/users.d.ts +285 -0
- package/lib/foundations/jsonb-types/users.js +47 -0
- package/lib/foundations/schemas.d.ts +11 -13
- package/lib/models/tenants.d.ts +7 -11
- package/lib/seeds/logto-config.js +1 -0
- package/lib/types/application.d.ts +51 -1
- package/lib/types/application.js +7 -1
- package/lib/types/connector.d.ts +516 -2360
- package/lib/types/domain.d.ts +65 -27
- package/lib/types/hook.d.ts +15 -16
- package/lib/types/index.d.ts +3 -0
- package/lib/types/index.js +3 -0
- package/lib/types/interactions.d.ts +502 -10
- package/lib/types/interactions.js +83 -5
- package/lib/types/log/interaction.d.ts +4 -3
- package/lib/types/log/interaction.js +1 -0
- package/lib/types/logto-config.d.ts +50 -2
- package/lib/types/logto-config.js +30 -3
- package/lib/types/mfa.d.ts +211 -0
- package/lib/types/mfa.js +62 -0
- package/lib/types/organization.d.ts +44 -0
- package/lib/types/organization.js +20 -0
- package/lib/types/role.d.ts +5 -3
- package/lib/types/scope.d.ts +12 -27
- package/lib/types/sso-connector.d.ts +21 -0
- package/lib/types/sso-connector.js +10 -0
- package/lib/types/system.d.ts +26 -7
- package/lib/types/system.js +8 -0
- package/lib/types/user-assets.d.ts +2 -2
- package/lib/types/user.d.ts +209 -66
- package/lib/types/user.js +8 -2
- package/package.json +6 -6
- package/tables/logto_configs.sql +1 -1
- package/tables/organization_role_scope_relations.sql +12 -0
- package/tables/organization_role_user_relations.sql +14 -0
- package/tables/organization_roles.sql +19 -0
- package/tables/organization_scopes.sql +19 -0
- package/tables/organization_user_relations.sql +12 -0
- package/tables/organizations.sql +19 -0
- package/tables/sso_connectors.sql +29 -0
- package/tables/user_sso_identities.sql +17 -0
- package/tables/users.sql +1 -0
- package/lib/foundations/jsonb-types.d.ts +0 -673
- package/lib/foundations/jsonb-types.js +0 -260
|
@@ -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,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,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,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;
|
|
@@ -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
|
|
30
|
+
export type ApplicationKeys = 'tenantId' | 'id' | 'name' | 'secret' | 'description' | 'type' | 'oidcClientMetadata' | 'customClientMetadata' | 'createdAt';
|
|
31
|
+
export declare const Applications: GeneratedSchema<ApplicationKeys, CreateApplication, Application, 'applications', 'application'>;
|
|
@@ -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
|
|
19
|
+
export type ApplicationsRoleKeys = 'tenantId' | 'id' | 'applicationId' | 'roleId';
|
|
20
|
+
export declare const ApplicationsRoles: GeneratedSchema<ApplicationsRoleKeys, CreateApplicationsRole, ApplicationsRole, 'applications_roles', 'applications_role'>;
|
|
@@ -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
|
|
25
|
+
export type ConnectorKeys = 'tenantId' | 'id' | 'syncProfile' | 'connectorId' | 'config' | 'metadata' | 'createdAt';
|
|
26
|
+
export declare const Connectors: GeneratedSchema<ConnectorKeys, CreateConnector, Connector, 'connectors', 'connector'>;
|
|
@@ -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
|
|
19
|
+
export type CustomPhraseKeys = 'tenantId' | 'id' | 'languageTag' | 'translation';
|
|
20
|
+
export declare const CustomPhrases: GeneratedSchema<CustomPhraseKeys, CreateCustomPhrase, CustomPhrase, 'custom_phrases', 'custom_phrase'>;
|
|
@@ -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
|
|
19
|
+
export type DailyActiveUserKeys = 'id' | 'tenantId' | 'userId' | 'date';
|
|
20
|
+
export declare const DailyActiveUsers: GeneratedSchema<DailyActiveUserKeys, CreateDailyActiveUser, DailyActiveUser, 'daily_active_users', 'daily_active_user'>;
|
|
@@ -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
|
|
29
|
+
export type DomainKeys = 'tenantId' | 'id' | 'domain' | 'status' | 'errorMessage' | 'dnsRecords' | 'cloudflareData' | 'updatedAt' | 'createdAt';
|
|
30
|
+
export declare const Domains: GeneratedSchema<DomainKeys, CreateDomain, Domain, 'domains', 'domain'>;
|
package/lib/db-entries/domain.js
CHANGED
package/lib/db-entries/hook.d.ts
CHANGED
|
@@ -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
|
|
29
|
+
export type HookKeys = 'tenantId' | 'id' | 'name' | 'event' | 'events' | 'config' | 'signingKey' | 'enabled' | 'createdAt';
|
|
30
|
+
export declare const Hooks: GeneratedSchema<HookKeys, CreateHook, Hook, 'hooks', 'hook'>;
|
package/lib/db-entries/hook.js
CHANGED
|
@@ -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';
|
package/lib/db-entries/index.js
CHANGED
|
@@ -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';
|
package/lib/db-entries/log.d.ts
CHANGED
|
@@ -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
|
|
21
|
+
export type LogKeys = 'tenantId' | 'id' | 'key' | 'payload' | 'createdAt';
|
|
22
|
+
export declare const Logs: GeneratedSchema<LogKeys, CreateLog, Log, 'logs', 'log'>;
|
package/lib/db-entries/log.js
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import {
|
|
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?:
|
|
10
|
+
value?: Json;
|
|
6
11
|
};
|
|
7
12
|
export type LogtoConfig = {
|
|
8
13
|
tenantId: string;
|
|
9
14
|
key: string;
|
|
10
|
-
value:
|
|
15
|
+
value: Json;
|
|
11
16
|
};
|
|
12
|
-
export
|
|
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 {
|
|
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:
|
|
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:
|
|
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
|
});
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { OidcModelInstancePayload, GeneratedSchema } from './../foundations/index.js';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @remarks This is a type for database creation.
|
|
5
|
+
* @see {@link OidcModelInstance} for the original type.
|
|
6
|
+
*/
|
|
2
7
|
export type CreateOidcModelInstance = {
|
|
3
8
|
tenantId?: string;
|
|
4
9
|
modelName: string;
|
|
@@ -15,4 +20,5 @@ export type OidcModelInstance = {
|
|
|
15
20
|
expiresAt: number;
|
|
16
21
|
consumedAt: number | null;
|
|
17
22
|
};
|
|
18
|
-
export
|
|
23
|
+
export type OidcModelInstanceKeys = 'tenantId' | 'modelName' | 'id' | 'payload' | 'expiresAt' | 'consumedAt';
|
|
24
|
+
export declare const OidcModelInstances: GeneratedSchema<OidcModelInstanceKeys, CreateOidcModelInstance, OidcModelInstance, 'oidc_model_instances', 'oidc_model_instance'>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { GeneratedSchema } from './../foundations/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The relations between organization roles and organization scopes. It indicates which organization scopes are available to which organization roles.
|
|
4
|
+
*
|
|
5
|
+
* @remarks This is a type for database creation.
|
|
6
|
+
* @see {@link OrganizationRoleScopeRelation} for the original type.
|
|
7
|
+
*/
|
|
8
|
+
export type CreateOrganizationRoleScopeRelation = {
|
|
9
|
+
tenantId?: string;
|
|
10
|
+
organizationRoleId: string;
|
|
11
|
+
organizationScopeId: string;
|
|
12
|
+
};
|
|
13
|
+
/** The relations between organization roles and organization scopes. It indicates which organization scopes are available to which organization roles. */
|
|
14
|
+
export type OrganizationRoleScopeRelation = {
|
|
15
|
+
tenantId: string;
|
|
16
|
+
organizationRoleId: string;
|
|
17
|
+
organizationScopeId: string;
|
|
18
|
+
};
|
|
19
|
+
export type OrganizationRoleScopeRelationKeys = 'tenantId' | 'organizationRoleId' | 'organizationScopeId';
|
|
20
|
+
export declare const OrganizationRoleScopeRelations: GeneratedSchema<OrganizationRoleScopeRelationKeys, CreateOrganizationRoleScopeRelation, OrganizationRoleScopeRelation, 'organization_role_scope_relations', 'organization_role_scope_relation'>;
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
organizationRoleId: z.string().min(1).max(21),
|
|
6
|
+
organizationScopeId: z.string().min(1).max(21),
|
|
7
|
+
});
|
|
8
|
+
const guard = z.object({
|
|
9
|
+
tenantId: z.string().max(21),
|
|
10
|
+
organizationRoleId: z.string().min(1).max(21),
|
|
11
|
+
organizationScopeId: z.string().min(1).max(21),
|
|
12
|
+
});
|
|
13
|
+
export const OrganizationRoleScopeRelations = Object.freeze({
|
|
14
|
+
table: 'organization_role_scope_relations',
|
|
15
|
+
tableSingular: 'organization_role_scope_relation',
|
|
16
|
+
fields: {
|
|
17
|
+
tenantId: 'tenant_id',
|
|
18
|
+
organizationRoleId: 'organization_role_id',
|
|
19
|
+
organizationScopeId: 'organization_scope_id',
|
|
20
|
+
},
|
|
21
|
+
fieldKeys: [
|
|
22
|
+
'tenantId',
|
|
23
|
+
'organizationRoleId',
|
|
24
|
+
'organizationScopeId',
|
|
25
|
+
],
|
|
26
|
+
createGuard,
|
|
27
|
+
guard,
|
|
28
|
+
updateGuard: guard.partial(),
|
|
29
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { GeneratedSchema } from './../foundations/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The relations between organizations, organization roles, and users. A relation means that a user has a role in an organization.
|
|
4
|
+
*
|
|
5
|
+
* @remarks This is a type for database creation.
|
|
6
|
+
* @see {@link OrganizationRoleUserRelation} for the original type.
|
|
7
|
+
*/
|
|
8
|
+
export type CreateOrganizationRoleUserRelation = {
|
|
9
|
+
tenantId?: string;
|
|
10
|
+
organizationId: string;
|
|
11
|
+
organizationRoleId: string;
|
|
12
|
+
userId: string;
|
|
13
|
+
};
|
|
14
|
+
/** The relations between organizations, organization roles, and users. A relation means that a user has a role in an organization. */
|
|
15
|
+
export type OrganizationRoleUserRelation = {
|
|
16
|
+
tenantId: string;
|
|
17
|
+
organizationId: string;
|
|
18
|
+
organizationRoleId: string;
|
|
19
|
+
userId: string;
|
|
20
|
+
};
|
|
21
|
+
export type OrganizationRoleUserRelationKeys = 'tenantId' | 'organizationId' | 'organizationRoleId' | 'userId';
|
|
22
|
+
export declare const OrganizationRoleUserRelations: GeneratedSchema<OrganizationRoleUserRelationKeys, CreateOrganizationRoleUserRelation, OrganizationRoleUserRelation, 'organization_role_user_relations', 'organization_role_user_relation'>;
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
organizationId: z.string().min(1).max(21),
|
|
6
|
+
organizationRoleId: z.string().min(1).max(21),
|
|
7
|
+
userId: z.string().min(1).max(21),
|
|
8
|
+
});
|
|
9
|
+
const guard = z.object({
|
|
10
|
+
tenantId: z.string().max(21),
|
|
11
|
+
organizationId: z.string().min(1).max(21),
|
|
12
|
+
organizationRoleId: z.string().min(1).max(21),
|
|
13
|
+
userId: z.string().min(1).max(21),
|
|
14
|
+
});
|
|
15
|
+
export const OrganizationRoleUserRelations = Object.freeze({
|
|
16
|
+
table: 'organization_role_user_relations',
|
|
17
|
+
tableSingular: 'organization_role_user_relation',
|
|
18
|
+
fields: {
|
|
19
|
+
tenantId: 'tenant_id',
|
|
20
|
+
organizationId: 'organization_id',
|
|
21
|
+
organizationRoleId: 'organization_role_id',
|
|
22
|
+
userId: 'user_id',
|
|
23
|
+
},
|
|
24
|
+
fieldKeys: [
|
|
25
|
+
'tenantId',
|
|
26
|
+
'organizationId',
|
|
27
|
+
'organizationRoleId',
|
|
28
|
+
'userId',
|
|
29
|
+
],
|
|
30
|
+
createGuard,
|
|
31
|
+
guard,
|
|
32
|
+
updateGuard: guard.partial(),
|
|
33
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { GeneratedSchema } from './../foundations/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The roles defined by the organization template.
|
|
4
|
+
*
|
|
5
|
+
* @remarks This is a type for database creation.
|
|
6
|
+
* @see {@link OrganizationRole} for the original type.
|
|
7
|
+
*/
|
|
8
|
+
export type CreateOrganizationRole = {
|
|
9
|
+
tenantId?: string;
|
|
10
|
+
/** The globally unique identifier of the organization role. */
|
|
11
|
+
id: string;
|
|
12
|
+
/** The organization role's name, unique within the organization template. */
|
|
13
|
+
name: string;
|
|
14
|
+
/** A brief description of the organization role. */
|
|
15
|
+
description?: string | null;
|
|
16
|
+
};
|
|
17
|
+
/** The roles defined by the organization template. */
|
|
18
|
+
export type OrganizationRole = {
|
|
19
|
+
tenantId: string;
|
|
20
|
+
/** The globally unique identifier of the organization role. */
|
|
21
|
+
id: string;
|
|
22
|
+
/** The organization role's name, unique within the organization template. */
|
|
23
|
+
name: string;
|
|
24
|
+
/** A brief description of the organization role. */
|
|
25
|
+
description: string | null;
|
|
26
|
+
};
|
|
27
|
+
export type OrganizationRoleKeys = 'tenantId' | 'id' | 'name' | 'description';
|
|
28
|
+
export declare const OrganizationRoles: GeneratedSchema<OrganizationRoleKeys, CreateOrganizationRole, OrganizationRole, 'organization_roles', 'organization_role'>;
|