@logto/schemas 1.11.0 → 1.13.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.12.0-1700031616-update-org-role-foreign-keys.ts +35 -0
- package/alterations/1.12.0-1701054133-add-unique-constraint-to-the-sso-connector-name.ts +21 -0
- package/alterations/1.12.0-1701245520-add-single-sign-on-enabled-flag-to-sie.ts +20 -0
- package/alterations/1.13.0-1702274830-add-new-third-party-column-to-applications-table.ts +20 -0
- package/alterations/1.13.0-1702372401-add-application-permissions-tables.ts +93 -0
- package/alterations/1.13.0-1702544178-sync-tenant-orgs.ts +296 -0
- package/alterations/1.13.0-1702871078-protected-application-type.ts +24 -0
- package/alterations/1.13.0-1702877515-protected-app-configs.ts +18 -0
- package/alterations/1.13.0-1702978120-application-sign-in-experience-table.ts +61 -0
- package/alterations/1.13.0-1703229996-daily-token-usage.ts +62 -0
- package/alterations/1.13.0-1703230000-update-tenant-roles.ts +94 -0
- package/alterations/1.13.0-1704692973-remove-legacy-resources.ts +147 -0
- package/alterations/1.13.0-1704934999-add-magic-links-table.ts +37 -0
- package/alterations/1.13.0-1704935001-add-organization-invitation-tables.ts +78 -0
- package/alterations/1.13.0-1705288654-add-application-user-consent-organizations-table.ts +62 -0
- package/alterations/1.13.0-1705991158-update-invitation-indices.ts +32 -0
- package/alterations/1.13.0-1706449174-update-organization-invitation-column.ts +24 -0
- package/alterations/1.13.0-1706510290-protected-app-host-index.ts +21 -0
- package/alterations/1.13.0-1706512952-restore-get-started-page.ts +17 -0
- package/alterations/1.13.0-1706528755-remove-magic-links.ts +46 -0
- package/alterations/1.13.0-1706585206-protected-app-custom-domain-unique.ts +21 -0
- package/alterations/utils/1704934999-tables.ts +49 -0
- package/alterations/utils/README.md +9 -0
- package/alterations-js/1.12.0-1700031616-update-org-role-foreign-keys.d.ts +3 -0
- package/alterations-js/1.12.0-1700031616-update-org-role-foreign-keys.js +31 -0
- package/alterations-js/1.12.0-1701054133-add-unique-constraint-to-the-sso-connector-name.d.ts +3 -0
- package/alterations-js/1.12.0-1701054133-add-unique-constraint-to-the-sso-connector-name.js +17 -0
- package/alterations-js/1.12.0-1701245520-add-single-sign-on-enabled-flag-to-sie.d.ts +3 -0
- package/alterations-js/1.12.0-1701245520-add-single-sign-on-enabled-flag-to-sie.js +16 -0
- package/alterations-js/1.13.0-1702274830-add-new-third-party-column-to-applications-table.d.ts +3 -0
- package/alterations-js/1.13.0-1702274830-add-new-third-party-column-to-applications-table.js +16 -0
- package/alterations-js/1.13.0-1702372401-add-application-permissions-tables.d.ts +3 -0
- package/alterations-js/1.13.0-1702372401-add-application-permissions-tables.js +79 -0
- package/alterations-js/1.13.0-1702544178-sync-tenant-orgs.d.ts +18 -0
- package/alterations-js/1.13.0-1702544178-sync-tenant-orgs.js +225 -0
- package/alterations-js/1.13.0-1702871078-protected-application-type.d.ts +3 -0
- package/alterations-js/1.13.0-1702871078-protected-application-type.js +20 -0
- package/alterations-js/1.13.0-1702877515-protected-app-configs.d.ts +3 -0
- package/alterations-js/1.13.0-1702877515-protected-app-configs.js +14 -0
- package/alterations-js/1.13.0-1702978120-application-sign-in-experience-table.d.ts +3 -0
- package/alterations-js/1.13.0-1702978120-application-sign-in-experience-table.js +51 -0
- package/alterations-js/1.13.0-1703229996-daily-token-usage.d.ts +3 -0
- package/alterations-js/1.13.0-1703229996-daily-token-usage.js +51 -0
- package/alterations-js/1.13.0-1703230000-update-tenant-roles.d.ts +11 -0
- package/alterations-js/1.13.0-1703230000-update-tenant-roles.js +87 -0
- package/alterations-js/1.13.0-1704692973-remove-legacy-resources.d.ts +3 -0
- package/alterations-js/1.13.0-1704692973-remove-legacy-resources.js +124 -0
- package/alterations-js/1.13.0-1704934999-add-magic-links-table.d.ts +3 -0
- package/alterations-js/1.13.0-1704934999-add-magic-links-table.js +32 -0
- package/alterations-js/1.13.0-1704935001-add-organization-invitation-tables.d.ts +3 -0
- package/alterations-js/1.13.0-1704935001-add-organization-invitation-tables.js +72 -0
- package/alterations-js/1.13.0-1705288654-add-application-user-consent-organizations-table.d.ts +3 -0
- package/alterations-js/1.13.0-1705288654-add-application-user-consent-organizations-table.js +52 -0
- package/alterations-js/1.13.0-1705991158-update-invitation-indices.d.ts +7 -0
- package/alterations-js/1.13.0-1705991158-update-invitation-indices.js +27 -0
- package/alterations-js/1.13.0-1706449174-update-organization-invitation-column.d.ts +3 -0
- package/alterations-js/1.13.0-1706449174-update-organization-invitation-column.js +20 -0
- package/alterations-js/1.13.0-1706510290-protected-app-host-index.d.ts +3 -0
- package/alterations-js/1.13.0-1706510290-protected-app-host-index.js +17 -0
- package/alterations-js/1.13.0-1706512952-restore-get-started-page.d.ts +3 -0
- package/alterations-js/1.13.0-1706512952-restore-get-started-page.js +13 -0
- package/alterations-js/1.13.0-1706528755-remove-magic-links.d.ts +3 -0
- package/alterations-js/1.13.0-1706528755-remove-magic-links.js +41 -0
- package/alterations-js/1.13.0-1706585206-protected-app-custom-domain-unique.d.ts +3 -0
- package/alterations-js/1.13.0-1706585206-protected-app-custom-domain-unique.js +17 -0
- package/alterations-js/utils/1704934999-tables.d.ts +11 -0
- package/alterations-js/utils/1704934999-tables.js +43 -0
- package/lib/consts/index.d.ts +1 -0
- package/lib/consts/index.js +1 -0
- package/lib/consts/subscriptions.d.ts +6 -0
- package/lib/consts/subscriptions.js +7 -0
- package/lib/db-entries/application-sign-in-experience.d.ts +26 -0
- package/lib/db-entries/application-sign-in-experience.js +42 -0
- package/lib/db-entries/application-user-consent-organization-scope.d.ts +24 -0
- package/lib/db-entries/application-user-consent-organization-scope.js +29 -0
- package/lib/db-entries/application-user-consent-organization.d.ts +22 -0
- package/lib/db-entries/application-user-consent-organization.js +33 -0
- package/lib/db-entries/application-user-consent-resource-scope.d.ts +24 -0
- package/lib/db-entries/application-user-consent-resource-scope.js +29 -0
- package/lib/db-entries/application-user-consent-user-scope.d.ts +24 -0
- package/lib/db-entries/application-user-consent-user-scope.js +29 -0
- package/lib/db-entries/application.d.ts +6 -2
- package/lib/db-entries/application.js +9 -1
- package/lib/db-entries/custom-types.d.ts +8 -1
- package/lib/db-entries/custom-types.js +8 -0
- package/lib/db-entries/daily-token-usage.d.ts +20 -0
- package/lib/db-entries/daily-token-usage.js +33 -0
- package/lib/db-entries/index.d.ts +8 -0
- package/lib/db-entries/index.js +8 -0
- package/lib/db-entries/organization-invitation-role-relation.d.ts +24 -0
- package/lib/db-entries/organization-invitation-role-relation.js +29 -0
- package/lib/db-entries/organization-invitation.d.ts +53 -0
- package/lib/db-entries/organization-invitation.js +58 -0
- package/lib/db-entries/sign-in-experience.d.ts +3 -1
- package/lib/db-entries/sign-in-experience.js +4 -0
- package/lib/db-entries/sso-connector.d.ts +2 -2
- package/lib/foundations/jsonb-types/applications.d.ts +380 -0
- package/lib/foundations/jsonb-types/applications.js +29 -0
- package/lib/foundations/jsonb-types/custom-domain.d.ts +37 -89
- package/lib/foundations/jsonb-types/custom-domain.js +4 -9
- package/lib/foundations/jsonb-types/index.d.ts +1 -0
- package/lib/foundations/jsonb-types/index.js +1 -0
- package/lib/foundations/jsonb-types/sso-connector.d.ts +3 -0
- package/lib/foundations/jsonb-types/sso-connector.js +1 -0
- package/lib/models/tenants.d.ts +1 -1
- package/lib/seeds/application.d.ts +1 -1
- package/lib/seeds/application.js +3 -1
- package/lib/seeds/cloud-api.d.ts +0 -2
- package/lib/seeds/cloud-api.js +0 -3
- package/lib/seeds/management-api.d.ts +77 -6
- package/lib/seeds/management-api.js +14 -10
- package/lib/types/application.d.ts +576 -1
- package/lib/types/application.js +42 -1
- package/lib/types/connector.js +1 -1
- package/lib/types/consent.d.ts +568 -0
- package/lib/types/consent.js +47 -0
- package/lib/types/domain.d.ts +21 -65
- package/lib/types/hook.d.ts +1 -0
- package/lib/types/index.d.ts +3 -0
- package/lib/types/index.js +3 -0
- package/lib/types/interactions.d.ts +6 -6
- package/lib/types/logto-config.d.ts +32 -6
- package/lib/types/logto-config.js +12 -2
- package/lib/types/mapi-proxy.d.ts +30 -0
- package/lib/types/mapi-proxy.js +49 -0
- package/lib/types/organization.d.ts +10 -1
- package/lib/types/organization.js +4 -1
- package/lib/types/sso-connector.d.ts +63 -66
- package/lib/types/sso-connector.js +41 -7
- package/lib/types/system.d.ts +28 -1
- package/lib/types/system.js +17 -0
- package/lib/types/tenant-organization.d.ts +107 -0
- package/lib/types/tenant-organization.js +145 -0
- package/lib/types/tenant.d.ts +0 -1
- package/lib/types/tenant.js +2 -1
- package/lib/types/user-assets.d.ts +5 -5
- package/lib/types/user-assets.js +1 -0
- package/lib/types/user.d.ts +17 -15
- package/lib/types/user.js +2 -2
- package/lib/utils/domain.d.ts +10 -0
- package/lib/utils/domain.js +28 -0
- package/lib/utils/domain.test.d.ts +1 -0
- package/lib/utils/domain.test.js +34 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +1 -0
- package/package.json +15 -15
- package/tables/application_sign_in_experiences.sql +15 -0
- package/tables/application_user_consent_organization_scopes.sql +14 -0
- package/tables/application_user_consent_organizations.sql +16 -0
- package/tables/application_user_consent_resource_scopes.sql +14 -0
- package/tables/application_user_consent_user_scopes.sql +13 -0
- package/tables/applications.sql +16 -1
- package/tables/daily_token_usage.sql +11 -0
- package/tables/organization_invitation_role_relations.sql +14 -0
- package/tables/organization_invitations.sql +36 -0
- package/tables/organization_role_user_relations.sql +8 -6
- package/tables/sign_in_experiences.sql +1 -0
- package/tables/sso_connectors.sql +4 -2
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* init_order = 3 */
|
|
2
|
+
|
|
3
|
+
/** The relations between applications, users and organizations. A relation means that a user has consented to an application to access data in an organization. */
|
|
4
|
+
create table application_user_consent_organizations (
|
|
5
|
+
tenant_id varchar(21) not null
|
|
6
|
+
references tenants (id) on update cascade on delete cascade,
|
|
7
|
+
application_id varchar(21) not null
|
|
8
|
+
references applications (id) on update cascade on delete cascade,
|
|
9
|
+
organization_id varchar(21) not null,
|
|
10
|
+
user_id varchar(21) not null,
|
|
11
|
+
primary key (tenant_id, application_id, organization_id, user_id),
|
|
12
|
+
/** User's consent to an application should be synchronized with the user's membership in the organization. */
|
|
13
|
+
foreign key (tenant_id, organization_id, user_id)
|
|
14
|
+
references organization_user_relations (tenant_id, organization_id, user_id)
|
|
15
|
+
on update cascade on delete cascade
|
|
16
|
+
)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* init_order = 3 */
|
|
2
|
+
|
|
3
|
+
/** The resource scopes (permissions) assigned to an application's consent request. */
|
|
4
|
+
create table application_user_consent_resource_scopes (
|
|
5
|
+
tenant_id varchar(21) not null
|
|
6
|
+
references tenants (id) on update cascade on delete cascade,
|
|
7
|
+
/** The globally unique identifier of the application. */
|
|
8
|
+
application_id varchar(21) not null
|
|
9
|
+
references applications (id) on update cascade on delete cascade,
|
|
10
|
+
/** The globally unique identifier of the resource scope. */
|
|
11
|
+
scope_id varchar(21) not null
|
|
12
|
+
references scopes (id) on update cascade on delete cascade,
|
|
13
|
+
primary key (application_id, scope_id)
|
|
14
|
+
);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* init_order = 2 */
|
|
2
|
+
|
|
3
|
+
/** The user scopes (permissions) assigned to an application */
|
|
4
|
+
create table application_user_consent_user_scopes (
|
|
5
|
+
tenant_id varchar(21) not null
|
|
6
|
+
references tenants (id) on update cascade on delete cascade,
|
|
7
|
+
/** The globally unique identifier of the application. */
|
|
8
|
+
application_id varchar(21) not null
|
|
9
|
+
references applications (id) on update cascade on delete cascade,
|
|
10
|
+
/** The unique UserScope enum value @see (@logto/core-kit/open-id.js) for more details */
|
|
11
|
+
user_scope varchar(64) not null,
|
|
12
|
+
primary key (application_id, user_scope)
|
|
13
|
+
);
|
package/tables/applications.sql
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* init_order = 1 */
|
|
2
2
|
|
|
3
|
-
create type application_type as enum ('Native', 'SPA', 'Traditional', 'MachineToMachine');
|
|
3
|
+
create type application_type as enum ('Native', 'SPA', 'Traditional', 'MachineToMachine', 'Protected');
|
|
4
4
|
|
|
5
5
|
create table applications (
|
|
6
6
|
tenant_id varchar(21) not null
|
|
@@ -12,9 +12,24 @@ create table applications (
|
|
|
12
12
|
type application_type not null,
|
|
13
13
|
oidc_client_metadata jsonb /* @use OidcClientMetadata */ not null,
|
|
14
14
|
custom_client_metadata jsonb /* @use CustomClientMetadata */ not null default '{}'::jsonb,
|
|
15
|
+
protected_app_metadata jsonb /* @use ProtectedAppMetadata */,
|
|
16
|
+
is_third_party boolean not null default false,
|
|
15
17
|
created_at timestamptz not null default(now()),
|
|
16
18
|
primary key (id)
|
|
17
19
|
);
|
|
18
20
|
|
|
19
21
|
create index applications__id
|
|
20
22
|
on applications (tenant_id, id);
|
|
23
|
+
|
|
24
|
+
create index applications__is_third_party
|
|
25
|
+
on applications (tenant_id, is_third_party);
|
|
26
|
+
|
|
27
|
+
create unique index applications__protected_app_metadata_host
|
|
28
|
+
on applications (
|
|
29
|
+
(protected_app_metadata->>'host')
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
create unique index applications__protected_app_metadata_custom_domain
|
|
33
|
+
on applications (
|
|
34
|
+
(protected_app_metadata->'customDomains'->0->>'domain')
|
|
35
|
+
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
create table daily_token_usage (
|
|
2
|
+
id varchar(21) not null,
|
|
3
|
+
tenant_id varchar(21) not null
|
|
4
|
+
references tenants (id) on update cascade on delete cascade,
|
|
5
|
+
usage bigint not null default(0),
|
|
6
|
+
date timestamptz not null,
|
|
7
|
+
primary key (id)
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
create unique index daily_token_usage__date
|
|
11
|
+
on daily_token_usage (tenant_id, date);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* init_order = 4 */
|
|
2
|
+
|
|
3
|
+
/** The organization roles that will be assigned to a user when they accept an invitation. */
|
|
4
|
+
create table organization_invitation_role_relations (
|
|
5
|
+
tenant_id varchar(21) not null
|
|
6
|
+
references tenants (id) on update cascade on delete cascade,
|
|
7
|
+
/** The ID of the invitation. */
|
|
8
|
+
organization_invitation_id varchar(21) not null
|
|
9
|
+
references organization_invitations (id) on update cascade on delete cascade,
|
|
10
|
+
/** The ID of the organization role. */
|
|
11
|
+
organization_role_id varchar(21) not null
|
|
12
|
+
references organization_roles (id) on update cascade on delete cascade,
|
|
13
|
+
primary key (tenant_id, organization_invitation_id, organization_role_id)
|
|
14
|
+
);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* init_order = 3 */
|
|
2
|
+
|
|
3
|
+
create type organization_invitation_status as enum ('Pending', 'Accepted', 'Expired', 'Revoked');
|
|
4
|
+
|
|
5
|
+
/** The invitation entry defined in RFC 0003. It stores the invitation information for a user to join an organization. */
|
|
6
|
+
create table organization_invitations (
|
|
7
|
+
tenant_id varchar(21) not null
|
|
8
|
+
references tenants (id) on update cascade on delete cascade,
|
|
9
|
+
/** The unique identifier of the invitation. */
|
|
10
|
+
id varchar(21) not null,
|
|
11
|
+
/** The user ID who sent the invitation. */
|
|
12
|
+
inviter_id varchar(21)
|
|
13
|
+
references users (id) on update cascade on delete cascade,
|
|
14
|
+
/** The email address or other identifier of the invitee. */
|
|
15
|
+
invitee varchar(256) not null,
|
|
16
|
+
/** The user ID of who accepted the invitation. */
|
|
17
|
+
accepted_user_id varchar(21)
|
|
18
|
+
references users (id) on update cascade on delete cascade,
|
|
19
|
+
/** The ID of the organization to which the invitee is invited. */
|
|
20
|
+
organization_id varchar(21) not null
|
|
21
|
+
references organizations (id) on update cascade on delete cascade,
|
|
22
|
+
/** The status of the invitation. */
|
|
23
|
+
status organization_invitation_status not null,
|
|
24
|
+
/** The time when the invitation was created. */
|
|
25
|
+
created_at timestamptz not null default (now()),
|
|
26
|
+
/** The time when the invitation status was last updated. */
|
|
27
|
+
updated_at timestamptz not null default (now()),
|
|
28
|
+
/** The time when the invitation expires. */
|
|
29
|
+
expires_at timestamptz not null,
|
|
30
|
+
primary key (id)
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
-- Ensure there is only one pending invitation for a given invitee and organization.
|
|
34
|
+
create unique index organization_invitations__invitee_organization_id
|
|
35
|
+
on organization_invitations (tenant_id, invitee, organization_id)
|
|
36
|
+
where status = 'Pending';
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
/* init_order =
|
|
1
|
+
/* init_order = 3 */
|
|
2
2
|
|
|
3
3
|
/** The relations between organizations, organization roles, and users. A relation means that a user has a role in an organization. */
|
|
4
4
|
create table organization_role_user_relations (
|
|
5
5
|
tenant_id varchar(21) not null
|
|
6
6
|
references tenants (id) on update cascade on delete cascade,
|
|
7
|
-
organization_id varchar(21) not null
|
|
8
|
-
references organizations (id) on update cascade on delete cascade,
|
|
7
|
+
organization_id varchar(21) not null,
|
|
9
8
|
organization_role_id varchar(21) not null
|
|
10
9
|
references organization_roles (id) on update cascade on delete cascade,
|
|
11
|
-
user_id varchar(21) not null
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
user_id varchar(21) not null,
|
|
11
|
+
primary key (tenant_id, organization_id, organization_role_id, user_id),
|
|
12
|
+
/** User's roles in an organization should be synchronized with the user's membership in the organization. */
|
|
13
|
+
foreign key (tenant_id, organization_id, user_id)
|
|
14
|
+
references organization_user_relations (tenant_id, organization_id, user_id)
|
|
15
|
+
on update cascade on delete cascade
|
|
14
16
|
);
|
|
@@ -17,5 +17,6 @@ create table sign_in_experiences (
|
|
|
17
17
|
custom_content jsonb /* @use CustomContent */ not null default '{}'::jsonb,
|
|
18
18
|
password_policy jsonb /* @use PartialPasswordPolicy */ not null default '{}'::jsonb,
|
|
19
19
|
mfa jsonb /* @use Mfa */ not null default '{}'::jsonb,
|
|
20
|
+
single_sign_on_enabled boolean not null default false,
|
|
20
21
|
primary key (tenant_id, id)
|
|
21
22
|
);
|
|
@@ -4,7 +4,7 @@ create table sso_connectors (
|
|
|
4
4
|
references tenants (id) on update cascade on delete cascade,
|
|
5
5
|
/** The globally unique identifier of the SSO connector. */
|
|
6
6
|
id varchar(128) not null,
|
|
7
|
-
/** The
|
|
7
|
+
/** The identifier of connector's SSO provider */
|
|
8
8
|
provider_name varchar(128) not null,
|
|
9
9
|
/** The name of the SSO provider for display. */
|
|
10
10
|
connector_name varchar(128) not null,
|
|
@@ -18,7 +18,9 @@ create table sso_connectors (
|
|
|
18
18
|
sync_profile boolean not null default FALSE,
|
|
19
19
|
/** When the SSO connector was created. */
|
|
20
20
|
created_at timestamptz not null default(now()),
|
|
21
|
-
primary key (id)
|
|
21
|
+
primary key (id),
|
|
22
|
+
constraint sso_connectors__connector_name__unique
|
|
23
|
+
unique (tenant_id, connector_name)
|
|
22
24
|
);
|
|
23
25
|
|
|
24
26
|
create index sso_connectors__id
|