@logto/schemas 1.3.0 → 1.6.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.
- package/alterations/1.5.0-1684382842-add-name-tag-created-at-for-tenants-table.ts +22 -0
- package/alterations/1.5.0-1684739802-create-hook-id-index-for-logs.ts +18 -0
- package/alterations/1.5.0-1684822341-init-domains.ts +66 -0
- package/alterations/1.5.0-1684837981-add-manage-tenant-self-scope-to-user-role.ts +56 -0
- package/alterations/1.5.0-1685285719-support-default-resource.ts +23 -0
- package/alterations/1.6.0-1685691718-domain-unique.ts +20 -0
- package/alterations-js/1.5.0-1684382842-add-name-tag-created-at-for-tenants-table.d.ts +3 -0
- package/alterations-js/1.5.0-1684382842-add-name-tag-created-at-for-tenants-table.js +19 -0
- package/alterations-js/1.5.0-1684739802-create-hook-id-index-for-logs.d.ts +3 -0
- package/alterations-js/1.5.0-1684739802-create-hook-id-index-for-logs.js +14 -0
- package/alterations-js/1.5.0-1684822341-init-domains.d.ts +3 -0
- package/alterations-js/1.5.0-1684822341-init-domains.js +57 -0
- package/alterations-js/1.5.0-1684837981-add-manage-tenant-self-scope-to-user-role.d.ts +3 -0
- package/alterations-js/1.5.0-1684837981-add-manage-tenant-self-scope-to-user-role.js +50 -0
- package/alterations-js/1.5.0-1685285719-support-default-resource.d.ts +3 -0
- package/alterations-js/1.5.0-1685285719-support-default-resource.js +19 -0
- package/alterations-js/1.6.0-1685691718-domain-unique.d.ts +3 -0
- package/alterations-js/1.6.0-1685691718-domain-unique.js +16 -0
- package/lib/consts/date.d.ts +5 -0
- package/lib/consts/date.js +1 -0
- package/lib/consts/index.d.ts +1 -0
- package/lib/consts/index.js +1 -0
- package/lib/consts/oidc.d.ts +5 -0
- package/lib/consts/oidc.js +6 -0
- package/lib/db-entries/application.js +3 -3
- package/lib/db-entries/applications-role.js +3 -3
- package/lib/db-entries/connector.js +2 -2
- package/lib/db-entries/custom-phrase.js +2 -2
- package/lib/db-entries/domain.d.ts +24 -0
- package/lib/db-entries/domain.js +53 -0
- package/lib/db-entries/hook.js +3 -3
- package/lib/db-entries/index.d.ts +1 -0
- package/lib/db-entries/index.js +1 -0
- package/lib/db-entries/log.js +2 -2
- package/lib/db-entries/logto-config.js +1 -1
- package/lib/db-entries/oidc-model-instance.js +2 -2
- package/lib/db-entries/passcode.js +3 -3
- package/lib/db-entries/resource.d.ts +2 -0
- package/lib/db-entries/resource.js +7 -3
- package/lib/db-entries/role.js +3 -3
- package/lib/db-entries/roles-scope.js +3 -3
- package/lib/db-entries/scope.js +4 -4
- package/lib/db-entries/service-log.js +2 -2
- package/lib/db-entries/sign-in-experience.js +1 -1
- package/lib/db-entries/system.js +1 -1
- package/lib/db-entries/user.js +1 -1
- package/lib/db-entries/users-role.js +3 -3
- package/lib/db-entries/verification-status.js +2 -2
- package/lib/foundations/jsonb-types.d.ts +127 -5
- package/lib/foundations/jsonb-types.js +56 -2
- package/lib/models/tenants.d.ts +17 -2
- package/lib/models/tenants.js +17 -2
- package/lib/seeds/application.js +1 -1
- package/lib/seeds/cloud-api.d.ts +4 -0
- package/lib/seeds/cloud-api.js +8 -1
- package/lib/seeds/management-api.d.ts +3 -3
- package/lib/seeds/management-api.js +38 -30
- package/lib/seeds/tenant.d.ts +1 -3
- package/lib/types/connector.d.ts +7 -4
- package/lib/types/connector.js +1 -0
- package/lib/types/domain.d.ts +68 -0
- package/lib/types/domain.js +15 -0
- package/lib/types/hook.d.ts +82 -2
- package/lib/types/hook.js +9 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.js +1 -1
- package/lib/types/interactions.d.ts +6 -6
- package/lib/types/log/hook.d.ts +1 -1
- package/lib/types/log/hook.js +1 -1
- package/lib/types/scope.d.ts +6 -4
- package/lib/types/system.d.ts +114 -3
- package/lib/types/system.js +55 -0
- package/lib/types/user.d.ts +6 -6
- package/package.json +6 -4
- package/tables/domains.sql +17 -0
- package/tables/logs.sql +3 -0
- package/tables/resources.sql +5 -0
- package/lib/types/tenant.d.ts +0 -4
- package/lib/types/tenant.js +0 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { sql } from 'slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
4
|
+
|
|
5
|
+
const alteration: AlterationScript = {
|
|
6
|
+
up: async (pool) => {
|
|
7
|
+
// Add new tenant columns for name, tag, and created_at.
|
|
8
|
+
await pool.query(sql`
|
|
9
|
+
alter table tenants add column name varchar(128) not null default 'My Project';
|
|
10
|
+
alter table tenants add column tag varchar(64) not null default 'development';
|
|
11
|
+
alter table tenants add column created_at timestamptz not null default(now());
|
|
12
|
+
`);
|
|
13
|
+
},
|
|
14
|
+
down: async (pool) => {
|
|
15
|
+
await pool.query(sql`
|
|
16
|
+
alter table tenants drop column name;
|
|
17
|
+
alter table tenants drop column tag;
|
|
18
|
+
alter table tenants drop column created_at;
|
|
19
|
+
`);
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export default alteration;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { sql } from 'slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
4
|
+
|
|
5
|
+
const alteration: AlterationScript = {
|
|
6
|
+
up: async (pool) => {
|
|
7
|
+
await pool.query(sql`
|
|
8
|
+
create index logs__hook_id on logs (tenant_id, (payload->>'hookId'));
|
|
9
|
+
`);
|
|
10
|
+
},
|
|
11
|
+
down: async (pool) => {
|
|
12
|
+
await pool.query(sql`
|
|
13
|
+
drop index logs__hook_id;
|
|
14
|
+
`);
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default alteration;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { CommonQueryMethods } from 'slonik';
|
|
2
|
+
import { sql } from 'slonik';
|
|
3
|
+
|
|
4
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
5
|
+
|
|
6
|
+
const getId = (value: string) => sql.identifier([value]);
|
|
7
|
+
|
|
8
|
+
const getDatabaseName = async (pool: CommonQueryMethods) => {
|
|
9
|
+
const { currentDatabase } = await pool.one<{ currentDatabase: string }>(sql`
|
|
10
|
+
select current_database();
|
|
11
|
+
`);
|
|
12
|
+
|
|
13
|
+
return currentDatabase.replaceAll('-', '_');
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const alteration: AlterationScript = {
|
|
17
|
+
up: async (pool) => {
|
|
18
|
+
const database = await getDatabaseName(pool);
|
|
19
|
+
const baseRoleId = getId(`logto_tenant_${database}`);
|
|
20
|
+
|
|
21
|
+
await pool.query(sql`
|
|
22
|
+
create table domains (
|
|
23
|
+
tenant_id varchar(21) not null
|
|
24
|
+
references tenants (id) on update cascade on delete cascade,
|
|
25
|
+
id varchar(21) not null,
|
|
26
|
+
domain varchar(256) not null,
|
|
27
|
+
status varchar(32) not null default('PendingVerification'),
|
|
28
|
+
error_message varchar(1024),
|
|
29
|
+
dns_records jsonb /* @use DomainDnsRecords */ not null default '[]'::jsonb,
|
|
30
|
+
cloudflare_data jsonb /* @use CloudflareData */,
|
|
31
|
+
updated_at timestamptz not null default(now()),
|
|
32
|
+
created_at timestamptz not null default(now()),
|
|
33
|
+
primary key (id),
|
|
34
|
+
constraint domains__domain
|
|
35
|
+
unique (domain)
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
create index domains__id on domains (tenant_id, id);
|
|
39
|
+
|
|
40
|
+
create trigger set_tenant_id before insert on domains
|
|
41
|
+
for each row execute procedure set_tenant_id();
|
|
42
|
+
|
|
43
|
+
alter table domains enable row level security;
|
|
44
|
+
|
|
45
|
+
create policy domains_tenant_id on domains
|
|
46
|
+
as restrictive
|
|
47
|
+
using (tenant_id = (select id from tenants where db_user = current_user));
|
|
48
|
+
create policy domains_modification on domains
|
|
49
|
+
using (true);
|
|
50
|
+
|
|
51
|
+
grant select, insert, update, delete on domains to ${baseRoleId};
|
|
52
|
+
`);
|
|
53
|
+
},
|
|
54
|
+
down: async (pool) => {
|
|
55
|
+
await pool.query(sql`
|
|
56
|
+
drop policy domains_tenant_id on domains;
|
|
57
|
+
drop policy domains_modification on domains;
|
|
58
|
+
|
|
59
|
+
alter table domains disable row level security;
|
|
60
|
+
|
|
61
|
+
drop table domains;
|
|
62
|
+
`);
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default alteration;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { generateStandardId } from '@logto/shared/universal';
|
|
2
|
+
import { sql } from 'slonik';
|
|
3
|
+
|
|
4
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
5
|
+
|
|
6
|
+
const adminTenantId = 'admin';
|
|
7
|
+
|
|
8
|
+
const alteration: AlterationScript = {
|
|
9
|
+
up: async (pool) => {
|
|
10
|
+
// Get `resourceId` of the admin tenant's resource whose indicator is `https://cloud.logto.io/api`.
|
|
11
|
+
const { id: resourceId } = await pool.one<{ id: string }>(sql`
|
|
12
|
+
select id from resources
|
|
13
|
+
where tenant_id = ${adminTenantId}
|
|
14
|
+
and indicator = 'https://cloud.logto.io/api'
|
|
15
|
+
`);
|
|
16
|
+
|
|
17
|
+
// Get `roleId` of the admin tenant's role whose name is `user`.
|
|
18
|
+
const { id: roleId } = await pool.one<{ id: string }>(sql`
|
|
19
|
+
select id from roles
|
|
20
|
+
where tenant_id = ${adminTenantId}
|
|
21
|
+
and name = 'user';
|
|
22
|
+
`);
|
|
23
|
+
|
|
24
|
+
// Insert `manage:tenant:self` scope.
|
|
25
|
+
const scopeId = generateStandardId();
|
|
26
|
+
await pool.query(sql`
|
|
27
|
+
insert into scopes (tenant_id, id, name, description, resource_id)
|
|
28
|
+
values (
|
|
29
|
+
${adminTenantId},
|
|
30
|
+
${scopeId},
|
|
31
|
+
'manage:tenant:self',
|
|
32
|
+
'Allow managing tenant itself, including update and delete.',
|
|
33
|
+
${resourceId}
|
|
34
|
+
);
|
|
35
|
+
`);
|
|
36
|
+
// Assign `manage:tenant:self` scope to `user` role.
|
|
37
|
+
await pool.query(sql`
|
|
38
|
+
insert into roles_scopes (tenant_id, id, role_id, scope_id)
|
|
39
|
+
values (
|
|
40
|
+
${adminTenantId},
|
|
41
|
+
${generateStandardId()},
|
|
42
|
+
${roleId},
|
|
43
|
+
${scopeId}
|
|
44
|
+
);
|
|
45
|
+
`);
|
|
46
|
+
},
|
|
47
|
+
down: async (pool) => {
|
|
48
|
+
// Delete `manage:tenant:self` scope.
|
|
49
|
+
// No need to delete `roles_scopes` because it will be cascade deleted.
|
|
50
|
+
await pool.query(sql`
|
|
51
|
+
delete from scopes
|
|
52
|
+
where tenant_id = ${adminTenantId} and name = 'manage:tenant:self';
|
|
53
|
+
`);
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
export default alteration;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { sql } from 'slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
4
|
+
|
|
5
|
+
const alteration: AlterationScript = {
|
|
6
|
+
up: async (pool) => {
|
|
7
|
+
await pool.query(sql`
|
|
8
|
+
alter table resources
|
|
9
|
+
add column is_default boolean not null default (false);
|
|
10
|
+
create unique index resources__is_default_true
|
|
11
|
+
on resources (tenant_id)
|
|
12
|
+
where is_default = true;
|
|
13
|
+
`);
|
|
14
|
+
},
|
|
15
|
+
down: async (pool) => {
|
|
16
|
+
await pool.query(sql`
|
|
17
|
+
alter table resources
|
|
18
|
+
drop is_default;
|
|
19
|
+
`);
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default alteration;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { sql } from 'slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
4
|
+
|
|
5
|
+
const alteration: AlterationScript = {
|
|
6
|
+
up: async (pool) => {
|
|
7
|
+
await pool.query(sql`
|
|
8
|
+
alter table domains drop constraint domains__domain;
|
|
9
|
+
alter table domains add constraint domains__domain unique (tenant_id, domain);
|
|
10
|
+
`);
|
|
11
|
+
},
|
|
12
|
+
down: async (pool) => {
|
|
13
|
+
await pool.query(sql`
|
|
14
|
+
alter table domains drop constraint domains__domain;
|
|
15
|
+
alter table domains add constraint domains__domain unique (domain);
|
|
16
|
+
`);
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default alteration;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { sql } from 'slonik';
|
|
2
|
+
const alteration = {
|
|
3
|
+
up: async (pool) => {
|
|
4
|
+
// Add new tenant columns for name, tag, and created_at.
|
|
5
|
+
await pool.query(sql `
|
|
6
|
+
alter table tenants add column name varchar(128) not null default 'My Project';
|
|
7
|
+
alter table tenants add column tag varchar(64) not null default 'development';
|
|
8
|
+
alter table tenants add column created_at timestamptz not null default(now());
|
|
9
|
+
`);
|
|
10
|
+
},
|
|
11
|
+
down: async (pool) => {
|
|
12
|
+
await pool.query(sql `
|
|
13
|
+
alter table tenants drop column name;
|
|
14
|
+
alter table tenants drop column tag;
|
|
15
|
+
alter table tenants drop column created_at;
|
|
16
|
+
`);
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
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
|
+
create index logs__hook_id on logs (tenant_id, (payload->>'hookId'));
|
|
6
|
+
`);
|
|
7
|
+
},
|
|
8
|
+
down: async (pool) => {
|
|
9
|
+
await pool.query(sql `
|
|
10
|
+
drop index logs__hook_id;
|
|
11
|
+
`);
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
export default alteration;
|
|
@@ -0,0 +1,57 @@
|
|
|
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 domains (
|
|
15
|
+
tenant_id varchar(21) not null
|
|
16
|
+
references tenants (id) on update cascade on delete cascade,
|
|
17
|
+
id varchar(21) not null,
|
|
18
|
+
domain varchar(256) not null,
|
|
19
|
+
status varchar(32) not null default('PendingVerification'),
|
|
20
|
+
error_message varchar(1024),
|
|
21
|
+
dns_records jsonb /* @use DomainDnsRecords */ not null default '[]'::jsonb,
|
|
22
|
+
cloudflare_data jsonb /* @use CloudflareData */,
|
|
23
|
+
updated_at timestamptz not null default(now()),
|
|
24
|
+
created_at timestamptz not null default(now()),
|
|
25
|
+
primary key (id),
|
|
26
|
+
constraint domains__domain
|
|
27
|
+
unique (domain)
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
create index domains__id on domains (tenant_id, id);
|
|
31
|
+
|
|
32
|
+
create trigger set_tenant_id before insert on domains
|
|
33
|
+
for each row execute procedure set_tenant_id();
|
|
34
|
+
|
|
35
|
+
alter table domains enable row level security;
|
|
36
|
+
|
|
37
|
+
create policy domains_tenant_id on domains
|
|
38
|
+
as restrictive
|
|
39
|
+
using (tenant_id = (select id from tenants where db_user = current_user));
|
|
40
|
+
create policy domains_modification on domains
|
|
41
|
+
using (true);
|
|
42
|
+
|
|
43
|
+
grant select, insert, update, delete on domains to ${baseRoleId};
|
|
44
|
+
`);
|
|
45
|
+
},
|
|
46
|
+
down: async (pool) => {
|
|
47
|
+
await pool.query(sql `
|
|
48
|
+
drop policy domains_tenant_id on domains;
|
|
49
|
+
drop policy domains_modification on domains;
|
|
50
|
+
|
|
51
|
+
alter table domains disable row level security;
|
|
52
|
+
|
|
53
|
+
drop table domains;
|
|
54
|
+
`);
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
export default alteration;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { generateStandardId } from '@logto/shared/universal';
|
|
2
|
+
import { sql } from 'slonik';
|
|
3
|
+
const adminTenantId = 'admin';
|
|
4
|
+
const alteration = {
|
|
5
|
+
up: async (pool) => {
|
|
6
|
+
// Get `resourceId` of the admin tenant's resource whose indicator is `https://cloud.logto.io/api`.
|
|
7
|
+
const { id: resourceId } = await pool.one(sql `
|
|
8
|
+
select id from resources
|
|
9
|
+
where tenant_id = ${adminTenantId}
|
|
10
|
+
and indicator = 'https://cloud.logto.io/api'
|
|
11
|
+
`);
|
|
12
|
+
// Get `roleId` of the admin tenant's role whose name is `user`.
|
|
13
|
+
const { id: roleId } = await pool.one(sql `
|
|
14
|
+
select id from roles
|
|
15
|
+
where tenant_id = ${adminTenantId}
|
|
16
|
+
and name = 'user';
|
|
17
|
+
`);
|
|
18
|
+
// Insert `manage:tenant:self` scope.
|
|
19
|
+
const scopeId = generateStandardId();
|
|
20
|
+
await pool.query(sql `
|
|
21
|
+
insert into scopes (tenant_id, id, name, description, resource_id)
|
|
22
|
+
values (
|
|
23
|
+
${adminTenantId},
|
|
24
|
+
${scopeId},
|
|
25
|
+
'manage:tenant:self',
|
|
26
|
+
'Allow managing tenant itself, including update and delete.',
|
|
27
|
+
${resourceId}
|
|
28
|
+
);
|
|
29
|
+
`);
|
|
30
|
+
// Assign `manage:tenant:self` scope to `user` role.
|
|
31
|
+
await pool.query(sql `
|
|
32
|
+
insert into roles_scopes (tenant_id, id, role_id, scope_id)
|
|
33
|
+
values (
|
|
34
|
+
${adminTenantId},
|
|
35
|
+
${generateStandardId()},
|
|
36
|
+
${roleId},
|
|
37
|
+
${scopeId}
|
|
38
|
+
);
|
|
39
|
+
`);
|
|
40
|
+
},
|
|
41
|
+
down: async (pool) => {
|
|
42
|
+
// Delete `manage:tenant:self` scope.
|
|
43
|
+
// No need to delete `roles_scopes` because it will be cascade deleted.
|
|
44
|
+
await pool.query(sql `
|
|
45
|
+
delete from scopes
|
|
46
|
+
where tenant_id = ${adminTenantId} and name = 'manage:tenant:self';
|
|
47
|
+
`);
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
export default alteration;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { sql } from 'slonik';
|
|
2
|
+
const alteration = {
|
|
3
|
+
up: async (pool) => {
|
|
4
|
+
await pool.query(sql `
|
|
5
|
+
alter table resources
|
|
6
|
+
add column is_default boolean not null default (false);
|
|
7
|
+
create unique index resources__is_default_true
|
|
8
|
+
on resources (tenant_id)
|
|
9
|
+
where is_default = true;
|
|
10
|
+
`);
|
|
11
|
+
},
|
|
12
|
+
down: async (pool) => {
|
|
13
|
+
await pool.query(sql `
|
|
14
|
+
alter table resources
|
|
15
|
+
drop is_default;
|
|
16
|
+
`);
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
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 domains drop constraint domains__domain;
|
|
6
|
+
alter table domains add constraint domains__domain unique (tenant_id, domain);
|
|
7
|
+
`);
|
|
8
|
+
},
|
|
9
|
+
down: async (pool) => {
|
|
10
|
+
await pool.query(sql `
|
|
11
|
+
alter table domains drop constraint domains__domain;
|
|
12
|
+
alter table domains add constraint domains__domain unique (domain);
|
|
13
|
+
`);
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
export default alteration;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const inSeconds = Object.freeze({ oneMinute: 60, oneHour: 60 * 60, oneDay: 24 * 60 * 60 });
|
package/lib/consts/index.d.ts
CHANGED
package/lib/consts/index.js
CHANGED
package/lib/consts/oidc.d.ts
CHANGED
package/lib/consts/oidc.js
CHANGED
|
@@ -15,9 +15,9 @@ const createGuard = z.object({
|
|
|
15
15
|
});
|
|
16
16
|
const guard = z.object({
|
|
17
17
|
tenantId: z.string().max(21),
|
|
18
|
-
id: z.string().max(21),
|
|
19
|
-
name: z.string().max(256),
|
|
20
|
-
secret: z.string().max(64),
|
|
18
|
+
id: z.string().min(1).max(21),
|
|
19
|
+
name: z.string().min(1).max(256),
|
|
20
|
+
secret: z.string().min(1).max(64),
|
|
21
21
|
description: z.string().nullable(),
|
|
22
22
|
type: z.nativeEnum(ApplicationType),
|
|
23
23
|
oidcClientMetadata: oidcClientMetadataGuard,
|
|
@@ -8,9 +8,9 @@ const createGuard = z.object({
|
|
|
8
8
|
});
|
|
9
9
|
const guard = z.object({
|
|
10
10
|
tenantId: z.string().max(21),
|
|
11
|
-
id: z.string().max(21),
|
|
12
|
-
applicationId: z.string().max(21),
|
|
13
|
-
roleId: z.string().max(21),
|
|
11
|
+
id: z.string().min(1).max(21),
|
|
12
|
+
applicationId: z.string().min(1).max(21),
|
|
13
|
+
roleId: z.string().min(1).max(21),
|
|
14
14
|
});
|
|
15
15
|
export const ApplicationsRoles = Object.freeze({
|
|
16
16
|
table: 'applications_roles',
|
|
@@ -12,9 +12,9 @@ const createGuard = z.object({
|
|
|
12
12
|
});
|
|
13
13
|
const guard = z.object({
|
|
14
14
|
tenantId: z.string().max(21),
|
|
15
|
-
id: z.string().max(128),
|
|
15
|
+
id: z.string().min(1).max(128),
|
|
16
16
|
syncProfile: z.boolean(),
|
|
17
|
-
connectorId: z.string().max(128),
|
|
17
|
+
connectorId: z.string().min(1).max(128),
|
|
18
18
|
config: jsonObjectGuard,
|
|
19
19
|
metadata: configurableConnectorMetadataGuard,
|
|
20
20
|
createdAt: z.number(),
|
|
@@ -9,8 +9,8 @@ const createGuard = z.object({
|
|
|
9
9
|
});
|
|
10
10
|
const guard = z.object({
|
|
11
11
|
tenantId: z.string().max(21),
|
|
12
|
-
id: z.string().max(21),
|
|
13
|
-
languageTag: z.string().max(16),
|
|
12
|
+
id: z.string().min(1).max(21),
|
|
13
|
+
languageTag: z.string().min(1).max(16),
|
|
14
14
|
translation: translationGuard,
|
|
15
15
|
});
|
|
16
16
|
export const CustomPhrases = Object.freeze({
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DomainStatus, DomainDnsRecords, CloudflareData, GeneratedSchema } from './../foundations/index.js';
|
|
2
|
+
export type CreateDomain = {
|
|
3
|
+
tenantId?: string;
|
|
4
|
+
id: string;
|
|
5
|
+
domain: string;
|
|
6
|
+
status?: DomainStatus;
|
|
7
|
+
errorMessage?: string | null;
|
|
8
|
+
dnsRecords?: DomainDnsRecords;
|
|
9
|
+
cloudflareData?: CloudflareData | null;
|
|
10
|
+
updatedAt?: number;
|
|
11
|
+
createdAt?: number;
|
|
12
|
+
};
|
|
13
|
+
export type Domain = {
|
|
14
|
+
tenantId: string;
|
|
15
|
+
id: string;
|
|
16
|
+
domain: string;
|
|
17
|
+
status: DomainStatus;
|
|
18
|
+
errorMessage: string | null;
|
|
19
|
+
dnsRecords: DomainDnsRecords;
|
|
20
|
+
cloudflareData: CloudflareData | null;
|
|
21
|
+
updatedAt: number;
|
|
22
|
+
createdAt: number;
|
|
23
|
+
};
|
|
24
|
+
export declare const Domains: GeneratedSchema<CreateDomain, Domain>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { domainStatusGuard, domainDnsRecordsGuard, cloudflareDataGuard } 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
|
+
domain: z.string().min(1).max(256),
|
|
8
|
+
status: domainStatusGuard.optional(),
|
|
9
|
+
errorMessage: z.string().max(1024).nullable().optional(),
|
|
10
|
+
dnsRecords: domainDnsRecordsGuard.optional(),
|
|
11
|
+
cloudflareData: cloudflareDataGuard.nullable().optional(),
|
|
12
|
+
updatedAt: z.number().optional(),
|
|
13
|
+
createdAt: z.number().optional(),
|
|
14
|
+
});
|
|
15
|
+
const guard = z.object({
|
|
16
|
+
tenantId: z.string().max(21),
|
|
17
|
+
id: z.string().min(1).max(21),
|
|
18
|
+
domain: z.string().min(1).max(256),
|
|
19
|
+
status: domainStatusGuard,
|
|
20
|
+
errorMessage: z.string().max(1024).nullable(),
|
|
21
|
+
dnsRecords: domainDnsRecordsGuard,
|
|
22
|
+
cloudflareData: cloudflareDataGuard.nullable(),
|
|
23
|
+
updatedAt: z.number(),
|
|
24
|
+
createdAt: z.number(),
|
|
25
|
+
});
|
|
26
|
+
export const Domains = Object.freeze({
|
|
27
|
+
table: 'domains',
|
|
28
|
+
tableSingular: 'domain',
|
|
29
|
+
fields: {
|
|
30
|
+
tenantId: 'tenant_id',
|
|
31
|
+
id: 'id',
|
|
32
|
+
domain: 'domain',
|
|
33
|
+
status: 'status',
|
|
34
|
+
errorMessage: 'error_message',
|
|
35
|
+
dnsRecords: 'dns_records',
|
|
36
|
+
cloudflareData: 'cloudflare_data',
|
|
37
|
+
updatedAt: 'updated_at',
|
|
38
|
+
createdAt: 'created_at',
|
|
39
|
+
},
|
|
40
|
+
fieldKeys: [
|
|
41
|
+
'tenantId',
|
|
42
|
+
'id',
|
|
43
|
+
'domain',
|
|
44
|
+
'status',
|
|
45
|
+
'errorMessage',
|
|
46
|
+
'dnsRecords',
|
|
47
|
+
'cloudflareData',
|
|
48
|
+
'updatedAt',
|
|
49
|
+
'createdAt',
|
|
50
|
+
],
|
|
51
|
+
createGuard,
|
|
52
|
+
guard,
|
|
53
|
+
});
|
package/lib/db-entries/hook.js
CHANGED
|
@@ -4,17 +4,17 @@ import { hookEventGuard, hookEventsGuard, hookConfigGuard } from './../foundatio
|
|
|
4
4
|
const createGuard = z.object({
|
|
5
5
|
tenantId: z.string().max(21).optional(),
|
|
6
6
|
id: z.string().min(1).max(21),
|
|
7
|
-
name: z.string().max(256).optional(),
|
|
7
|
+
name: z.string().min(1).max(256).optional(),
|
|
8
8
|
event: hookEventGuard.nullable().optional(),
|
|
9
9
|
events: hookEventsGuard.optional(),
|
|
10
10
|
config: hookConfigGuard,
|
|
11
|
-
signingKey: z.string().max(64).optional(),
|
|
11
|
+
signingKey: z.string().min(1).max(64).optional(),
|
|
12
12
|
enabled: z.boolean().optional(),
|
|
13
13
|
createdAt: z.number().optional(),
|
|
14
14
|
});
|
|
15
15
|
const guard = z.object({
|
|
16
16
|
tenantId: z.string().max(21),
|
|
17
|
-
id: z.string().max(21),
|
|
17
|
+
id: z.string().min(1).max(21),
|
|
18
18
|
name: z.string().max(256),
|
|
19
19
|
event: hookEventGuard.nullable(),
|
|
20
20
|
events: hookEventsGuard,
|
|
@@ -7,6 +7,7 @@ export * from './application.js';
|
|
|
7
7
|
export * from './applications-role.js';
|
|
8
8
|
export * from './connector.js';
|
|
9
9
|
export * from './custom-phrase.js';
|
|
10
|
+
export * from './domain.js';
|
|
10
11
|
export * from './hook.js';
|
|
11
12
|
export * from './log.js';
|
|
12
13
|
export * from './logto-config.js';
|
package/lib/db-entries/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export * from './application.js';
|
|
|
8
8
|
export * from './applications-role.js';
|
|
9
9
|
export * from './connector.js';
|
|
10
10
|
export * from './custom-phrase.js';
|
|
11
|
+
export * from './domain.js';
|
|
11
12
|
export * from './hook.js';
|
|
12
13
|
export * from './log.js';
|
|
13
14
|
export * from './logto-config.js';
|
package/lib/db-entries/log.js
CHANGED
|
@@ -10,8 +10,8 @@ const createGuard = z.object({
|
|
|
10
10
|
});
|
|
11
11
|
const guard = z.object({
|
|
12
12
|
tenantId: z.string().max(21),
|
|
13
|
-
id: z.string().max(21),
|
|
14
|
-
key: z.string().max(128),
|
|
13
|
+
id: z.string().min(1).max(21),
|
|
14
|
+
key: z.string().min(1).max(128),
|
|
15
15
|
payload: logContextPayloadGuard,
|
|
16
16
|
createdAt: z.number(),
|
|
17
17
|
});
|