@logto/schemas 1.14.0 → 1.16.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.0.0-1677208902-update-admin-console-config.ts +2 -2
- package/alterations/1.0.0-1677765137-seed-for-admin-tenant.ts +2 -2
- package/alterations/1.0.0-1677907982-allow-admin-create-multiple-tenants.ts +1 -1
- package/alterations/1.0.0-1678157950-privacy-policy-url.ts +1 -1
- package/alterations/1.0.0-1678199795-add-verification-status-table.ts +2 -2
- package/alterations/1.0.0-1678259693-remove-branding-style-config.ts +2 -2
- package/alterations/1.0.0-1678269972-use-restrictive-policies.ts +2 -2
- package/alterations/1.0.0-1678284778-restrict-internal-roles.ts +1 -1
- package/alterations/1.0.0-1678425761-m2m-app-for-tenants.ts +1 -1
- package/alterations/1.0.0-1678450233-support-custom-content.ts +1 -1
- package/alterations/1.0.0-1678716747-service-logs.ts +2 -2
- package/alterations/1.0.0-1678928481-remove-deprecated-logto-config-item.ts +2 -2
- package/alterations/1.0.0-1678953179-update-get-started-task-config.ts +2 -2
- package/alterations/1.0.0-1679209413-drop-connector-database-storage.ts +1 -1
- package/alterations/1.0.0_beta.10-1-logto-config.ts +1 -1
- package/alterations/1.0.0_beta.10-1663923211-machine-to-machine-app.ts +1 -1
- package/alterations/1.0.0_beta.10-1664265197-custom-phrases.ts +1 -1
- package/alterations/1.0.0_beta.11-1664347703-rename-language-key-to-tag.ts +1 -1
- package/alterations/1.0.0_beta.11-1664356000-add-created-at-column-to-users.ts +1 -1
- package/alterations/1.0.0_beta.11-1664462389-correct-user-created-at-column-by-user-logs.ts +1 -1
- package/alterations/1.0.0_beta.14-1665300135-sign-in-sign-up.ts +1 -1
- package/alterations/1.0.0_beta.14-1667283640-remove-forgot-password.ts +1 -1
- package/alterations/1.0.0_beta.14-1667292082-remove-sign-in-method.ts +1 -1
- package/alterations/1.0.0_beta.14-1667374974-user-suspend.ts +1 -1
- package/alterations/1.0.0_beta.14-1667900481-add-passcode-type-continue.ts +1 -1
- package/alterations/1.0.0_beta.18-1668666590-support-multiple-connector-instances.ts +1 -1
- package/alterations/1.0.0_beta.18-1668666600-remove-connector-enabled.ts +1 -1
- package/alterations/1.0.0_beta.18-1669091623-roles-and-scopes.ts +1 -1
- package/alterations/1.0.0_beta.18-1669702299-sign-up.ts +2 -2
- package/alterations/1.0.0_beta.18-1671039448-add-user-name-index.ts +1 -1
- package/alterations/1.0.0_beta.18-1671080370-terms-of-use.ts +2 -2
- package/alterations/1.0.0_beta.18-1671336831-refactor-log-types.ts +1 -1
- package/alterations/1.0.0_beta.18-1671509870-hooks.ts +1 -1
- package/alterations/1.0.0_beta.18-1672119200-align-passcode-type-with-message-type.ts +1 -1
- package/alterations/1.0.0_rc.0-1672815959-user-roles.ts +1 -1
- package/alterations/1.0.0_rc.0-1672820345-scope-resource-id.ts +1 -1
- package/alterations/1.0.0_rc.0-1672901841-roles-and-scopes-not-null.ts +1 -1
- package/alterations/1.0.0_rc.0-1673001922-support-generic-passcode.ts +1 -1
- package/alterations/1.0.0_rc.0-1673165463-scope-name-index.ts +1 -1
- package/alterations/1.0.0_rc.0-1673349501-sms-sign-in-identifier-to-phone.ts +1 -1
- package/alterations/1.0.0_rc.0-1673465463-ac-scope-name.ts +1 -1
- package/alterations/1.0.0_rc.0-1673853579-ac-default-scope.ts +1 -1
- package/alterations/1.0.0_rc.0-1673863835-ac-scope-role.ts +1 -1
- package/alterations/1.0.0_rc.0-1673882867-fix-alteration-issues.ts +1 -1
- package/alterations/1.0.0_rc.0-1673940577-scope-description-not-null.ts +1 -1
- package/alterations/1.0.0_rc.0-1673941897-application-roles.ts +1 -1
- package/alterations/1.0.0_rc.0-1674032095.1-dedup-resources-constraint.ts +1 -1
- package/alterations/1.0.0_rc.0-1674032095.2-oidc-model-pkey.ts +1 -1
- package/alterations/1.0.0_rc.0-1674032095.3-tenant-table.ts +1 -1
- package/alterations/1.0.0_rc.0-1674032095.4-add-id-column.ts +1 -1
- package/alterations/1.0.0_rc.0-1674032095.5-multi-tenancy.ts +6 -7
- package/alterations/1.0.0_rc.0-1674032095.6-add-tenant-id-trigger.ts +1 -1
- package/alterations/1.0.0_rc.0-1674987042-drop-settings-and-create-systems.ts +1 -1
- package/alterations/1.0.0_rc.0-1675316731-update-seed-data.ts +1 -1
- package/alterations/1.0.0_rc.1-1675788753-multi-tenancy-rls.ts +3 -4
- package/alterations/1.0.0_rc.1-1676115897-add-admin-tenant.ts +3 -4
- package/alterations/1.0.0_rc.1-1676185899-fix-logs-index.ts +1 -1
- package/alterations/1.0.0_rc.1-1676190092-migrate-admin-data.ts +2 -2
- package/alterations/1.0.0_rc.1-1676823841-update-sie-primary-key.ts +1 -1
- package/alterations/1.0.0_rc.1-1676874936-support-custom-css.ts +1 -1
- package/alterations/1.0.0_rc.1-1676886855-connector-database-read-write.ts +1 -1
- package/alterations/1.0.0_rc.1-1676906977-remove-demo-app.ts +1 -1
- package/alterations/1.0.0_rc.1-1676956206-move-console-sie-to-database.ts +1 -1
- package/alterations/1.0.0_rc.1-1677059985-move-console-application-to-database.ts +1 -1
- package/alterations/1.10.1-1695647183-update-private-key-type.ts +2 -2
- package/alterations/1.10.1-1696657546-organization-tables.ts +1 -1
- package/alterations/1.10.1-1697683802-add-sso-connectors-table.ts +1 -1
- package/alterations/1.10.1-1698646271-add-organization-created-flag.ts +2 -2
- package/alterations/1.10.1-1698820410-add-user-sso-identities-table.ts +1 -1
- package/alterations/1.10.1-1698910485-user-logto-data.ts +1 -1
- package/alterations/1.11.0-1699422979-add-sso-connector-id-col-to-user-sso-identities-table.ts +1 -1
- package/alterations/1.11.0-1699598903-remove-sso-only-column-in-sso-connectors-table.ts +1 -1
- package/alterations/1.12.0-1700031616-update-org-role-foreign-keys.ts +1 -1
- package/alterations/1.12.0-1701054133-add-unique-constraint-to-the-sso-connector-name.ts +1 -1
- package/alterations/1.12.0-1701245520-add-single-sign-on-enabled-flag-to-sie.ts +1 -1
- package/alterations/1.13.0-1702274830-add-new-third-party-column-to-applications-table.ts +1 -1
- package/alterations/1.13.0-1702372401-add-application-permissions-tables.ts +1 -1
- package/alterations/1.13.0-1702544178-sync-tenant-orgs.ts +1 -1
- package/alterations/1.13.0-1702871078-protected-application-type.ts +1 -1
- package/alterations/1.13.0-1702877515-protected-app-configs.ts +1 -1
- package/alterations/1.13.0-1702978120-application-sign-in-experience-table.ts +1 -1
- package/alterations/1.13.0-1703229996-daily-token-usage.ts +1 -1
- package/alterations/1.13.0-1703230000-update-tenant-roles.ts +1 -1
- package/alterations/1.13.0-1704692973-remove-legacy-resources.ts +1 -1
- package/alterations/1.13.0-1704934999-add-magic-links-table.ts +1 -1
- package/alterations/1.13.0-1704935001-add-organization-invitation-tables.ts +1 -1
- package/alterations/1.13.0-1705288654-add-application-user-consent-organizations-table.ts +1 -1
- package/alterations/1.13.0-1705991158-update-invitation-indices.ts +1 -1
- package/alterations/1.13.0-1706449174-update-organization-invitation-column.ts +1 -1
- package/alterations/1.13.0-1706510290-protected-app-host-index.ts +1 -1
- package/alterations/1.13.0-1706512952-restore-get-started-page.ts +1 -1
- package/alterations/1.13.0-1706528755-remove-magic-links.ts +1 -1
- package/alterations/1.13.0-1706585206-protected-app-custom-domain-unique.ts +1 -1
- package/alterations/1.13.1-1707360939-grant-is-suspended-read-permission.ts +1 -1
- package/alterations/1.14.0-1708916601-remove-management-api-scopes-assigned-to-user-role.ts +1 -1
- package/alterations/1.14.0-1709190131-enhance-dau-data-accuracy.ts +1 -1
- package/alterations/1.15.0-1709521416-user-password-encrypt-method.ts +36 -0
- package/alterations/1.15.0-1709528944-regenerate-dau-data.ts +49 -0
- package/alterations/1.15.0-1710223946-add-fetch-custom-jwt-cloud-scope.ts +92 -0
- package/alterations/1.15.0-1710408335-make-resource-scopes-description-nullable.ts +22 -0
- package/alterations/1.15.0-1710859622-add-oidc-standard-claim-properties.ts +38 -0
- package/alterations/1.15.0-1711607772-remove-invite-member-scope-from-tenant-member-role.ts +20 -0
- package/alterations/1.15.0-1711624564-add-read-member-scope-to-tenant-roles.ts +25 -0
- package/alterations/1.15.0-1711955211-organization-resource-scope.ts +39 -0
- package/alterations/1.15.0-1712041436-rename-organization-member-role-to-collaborator.ts +28 -0
- package/alterations/1.15.0-1712545011-fix-organization-resource-scope.ts +43 -0
- package/alterations/1.15.0-1712559358-fix-down-organization-resource-scope.ts +46 -0
- package/alterations/1.16.0-1712912361-delete-jwt-customier-with-empty-script.ts +23 -0
- package/alterations/1.16.0-1713942039-add-organization-custom-data.ts +25 -0
- package/alterations/1.16.0-1714270244-application-org-resource-scope.ts +32 -0
- package/alterations/1.2.0-1681267285-fix-get-started-passwordless-status.ts +1 -1
- package/alterations/1.3.0-1683292832-update-hooks.ts +1 -1
- package/alterations/1.5.0-1684382842-add-name-tag-created-at-for-tenants-table.ts +1 -1
- package/alterations/1.5.0-1684739802-create-hook-id-index-for-logs.ts +1 -1
- package/alterations/1.5.0-1684822341-init-domains.ts +2 -2
- package/alterations/1.5.0-1684837981-add-manage-tenant-self-scope-to-user-role.ts +1 -1
- package/alterations/1.5.0-1685285719-support-default-resource.ts +1 -1
- package/alterations/1.6.0-1685691718-domain-unique.ts +1 -1
- package/alterations/1.7.0-1688375200-sync-cloud-m2m-to-logto-config.ts +1 -1
- package/alterations/1.7.0-1688613459-remove-m2m-credentials-from-existing-logto-email-connector-config.ts +1 -1
- package/alterations/1.7.0-1688627407-daily-active-users.ts +1 -1
- package/alterations/1.8.0-1692088012-add-is-suspend-column-to-tenants-table.ts +1 -1
- package/alterations/1.8.0-1692194751-add-affiliate-scopes.ts +1 -1
- package/alterations/1.9.0-1693554904-add-possword-policy.ts +1 -1
- package/alterations/1.9.0-1694399696-add-type-col-to-roles-table.ts +1 -1
- package/alterations/1.9.0-1694418765-specify-check-role-type-function-to-be-public-schema.ts +1 -1
- package/alterations/1.9.0-1694484927-remove-deprecated-challenge-flag.ts +2 -2
- package/alterations/1.9.0-1694487524-sie-mfa.ts +1 -1
- package/alterations/1.9.0-1694509714-keep-existing-password-policy.ts +1 -1
- package/alterations/1.9.0-1694746763-user-verifications.ts +1 -1
- package/alterations/1.9.2-1694854226-init-sentinel.ts +1 -1
- package/alterations/1.9.2-1695198741-remove-m2m-app-admin-access-switch.ts +1 -1
- package/alterations/utils/1704934999-tables.ts +1 -1
- package/alterations-js/1.0.0-1677208902-update-admin-console-config.js +1 -1
- package/alterations-js/1.0.0-1677765137-seed-for-admin-tenant.js +1 -1
- package/alterations-js/1.0.0-1677907982-allow-admin-create-multiple-tenants.js +1 -1
- package/alterations-js/1.0.0-1678157950-privacy-policy-url.js +1 -1
- package/alterations-js/1.0.0-1678199795-add-verification-status-table.js +1 -1
- package/alterations-js/1.0.0-1678259693-remove-branding-style-config.js +1 -1
- package/alterations-js/1.0.0-1678269972-use-restrictive-policies.js +1 -1
- package/alterations-js/1.0.0-1678284778-restrict-internal-roles.js +1 -1
- package/alterations-js/1.0.0-1678425761-m2m-app-for-tenants.js +1 -1
- package/alterations-js/1.0.0-1678450233-support-custom-content.js +1 -1
- package/alterations-js/1.0.0-1678716747-service-logs.js +1 -1
- package/alterations-js/1.0.0-1678928481-remove-deprecated-logto-config-item.js +1 -1
- package/alterations-js/1.0.0-1678953179-update-get-started-task-config.js +1 -1
- package/alterations-js/1.0.0-1679209413-drop-connector-database-storage.js +1 -1
- package/alterations-js/1.0.0_beta.10-1-logto-config.js +1 -1
- package/alterations-js/1.0.0_beta.10-1663923211-machine-to-machine-app.js +1 -1
- package/alterations-js/1.0.0_beta.10-1664265197-custom-phrases.js +1 -1
- package/alterations-js/1.0.0_beta.11-1664347703-rename-language-key-to-tag.js +1 -1
- package/alterations-js/1.0.0_beta.11-1664356000-add-created-at-column-to-users.js +1 -1
- package/alterations-js/1.0.0_beta.11-1664462389-correct-user-created-at-column-by-user-logs.js +1 -1
- package/alterations-js/1.0.0_beta.14-1665300135-sign-in-sign-up.js +1 -1
- package/alterations-js/1.0.0_beta.14-1667283640-remove-forgot-password.js +1 -1
- package/alterations-js/1.0.0_beta.14-1667292082-remove-sign-in-method.js +1 -1
- package/alterations-js/1.0.0_beta.14-1667374974-user-suspend.js +1 -1
- package/alterations-js/1.0.0_beta.14-1667900481-add-passcode-type-continue.js +1 -1
- package/alterations-js/1.0.0_beta.18-1668666590-support-multiple-connector-instances.js +1 -1
- package/alterations-js/1.0.0_beta.18-1668666600-remove-connector-enabled.js +1 -1
- package/alterations-js/1.0.0_beta.18-1669091623-roles-and-scopes.js +1 -1
- package/alterations-js/1.0.0_beta.18-1669702299-sign-up.js +1 -1
- package/alterations-js/1.0.0_beta.18-1671039448-add-user-name-index.js +1 -1
- package/alterations-js/1.0.0_beta.18-1671080370-terms-of-use.js +1 -1
- package/alterations-js/1.0.0_beta.18-1671336831-refactor-log-types.js +1 -1
- package/alterations-js/1.0.0_beta.18-1671509870-hooks.js +1 -1
- package/alterations-js/1.0.0_beta.18-1672119200-align-passcode-type-with-message-type.js +1 -1
- package/alterations-js/1.0.0_rc.0-1672815959-user-roles.js +1 -1
- package/alterations-js/1.0.0_rc.0-1672820345-scope-resource-id.js +1 -1
- package/alterations-js/1.0.0_rc.0-1672901841-roles-and-scopes-not-null.js +1 -1
- package/alterations-js/1.0.0_rc.0-1673001922-support-generic-passcode.js +1 -1
- package/alterations-js/1.0.0_rc.0-1673165463-scope-name-index.js +1 -1
- package/alterations-js/1.0.0_rc.0-1673349501-sms-sign-in-identifier-to-phone.js +1 -1
- package/alterations-js/1.0.0_rc.0-1673465463-ac-scope-name.js +1 -1
- package/alterations-js/1.0.0_rc.0-1673853579-ac-default-scope.js +1 -1
- package/alterations-js/1.0.0_rc.0-1673863835-ac-scope-role.js +1 -1
- package/alterations-js/1.0.0_rc.0-1673882867-fix-alteration-issues.js +1 -1
- package/alterations-js/1.0.0_rc.0-1673940577-scope-description-not-null.js +1 -1
- package/alterations-js/1.0.0_rc.0-1673941897-application-roles.js +1 -1
- package/alterations-js/1.0.0_rc.0-1674032095.1-dedup-resources-constraint.js +1 -1
- package/alterations-js/1.0.0_rc.0-1674032095.2-oidc-model-pkey.js +1 -1
- package/alterations-js/1.0.0_rc.0-1674032095.3-tenant-table.js +1 -1
- package/alterations-js/1.0.0_rc.0-1674032095.4-add-id-column.js +1 -1
- package/alterations-js/1.0.0_rc.0-1674032095.5-multi-tenancy.js +6 -7
- package/alterations-js/1.0.0_rc.0-1674032095.6-add-tenant-id-trigger.js +1 -1
- package/alterations-js/1.0.0_rc.0-1674987042-drop-settings-and-create-systems.js +1 -1
- package/alterations-js/1.0.0_rc.0-1675316731-update-seed-data.js +1 -1
- package/alterations-js/1.0.0_rc.1-1675788753-multi-tenancy-rls.js +2 -3
- package/alterations-js/1.0.0_rc.1-1676115897-add-admin-tenant.js +2 -3
- package/alterations-js/1.0.0_rc.1-1676185899-fix-logs-index.js +1 -1
- package/alterations-js/1.0.0_rc.1-1676190092-migrate-admin-data.js +1 -1
- package/alterations-js/1.0.0_rc.1-1676823841-update-sie-primary-key.js +1 -1
- package/alterations-js/1.0.0_rc.1-1676874936-support-custom-css.js +1 -1
- package/alterations-js/1.0.0_rc.1-1676886855-connector-database-read-write.js +1 -1
- package/alterations-js/1.0.0_rc.1-1676906977-remove-demo-app.js +1 -1
- package/alterations-js/1.0.0_rc.1-1676956206-move-console-sie-to-database.js +1 -1
- package/alterations-js/1.0.0_rc.1-1677059985-move-console-application-to-database.js +1 -1
- package/alterations-js/1.10.1-1695647183-update-private-key-type.js +1 -1
- package/alterations-js/1.10.1-1696657546-organization-tables.js +1 -1
- package/alterations-js/1.10.1-1697683802-add-sso-connectors-table.js +1 -1
- package/alterations-js/1.10.1-1698646271-add-organization-created-flag.js +1 -1
- package/alterations-js/1.10.1-1698820410-add-user-sso-identities-table.js +1 -1
- package/alterations-js/1.10.1-1698910485-user-logto-data.js +1 -1
- package/alterations-js/1.11.0-1699422979-add-sso-connector-id-col-to-user-sso-identities-table.js +1 -1
- package/alterations-js/1.11.0-1699598903-remove-sso-only-column-in-sso-connectors-table.js +1 -1
- package/alterations-js/1.12.0-1700031616-update-org-role-foreign-keys.js +1 -1
- package/alterations-js/1.12.0-1701054133-add-unique-constraint-to-the-sso-connector-name.js +1 -1
- package/alterations-js/1.12.0-1701245520-add-single-sign-on-enabled-flag-to-sie.js +1 -1
- package/alterations-js/1.13.0-1702274830-add-new-third-party-column-to-applications-table.js +1 -1
- package/alterations-js/1.13.0-1702372401-add-application-permissions-tables.js +1 -1
- package/alterations-js/1.13.0-1702544178-sync-tenant-orgs.js +1 -1
- package/alterations-js/1.13.0-1702871078-protected-application-type.js +1 -1
- package/alterations-js/1.13.0-1702877515-protected-app-configs.js +1 -1
- package/alterations-js/1.13.0-1702978120-application-sign-in-experience-table.js +1 -1
- package/alterations-js/1.13.0-1703229996-daily-token-usage.js +1 -1
- package/alterations-js/1.13.0-1703230000-update-tenant-roles.js +1 -1
- package/alterations-js/1.13.0-1704692973-remove-legacy-resources.js +1 -1
- package/alterations-js/1.13.0-1704934999-add-magic-links-table.js +1 -1
- package/alterations-js/1.13.0-1704935001-add-organization-invitation-tables.js +1 -1
- package/alterations-js/1.13.0-1705288654-add-application-user-consent-organizations-table.js +1 -1
- package/alterations-js/1.13.0-1705991158-update-invitation-indices.js +1 -1
- package/alterations-js/1.13.0-1706449174-update-organization-invitation-column.js +1 -1
- package/alterations-js/1.13.0-1706510290-protected-app-host-index.js +1 -1
- package/alterations-js/1.13.0-1706512952-restore-get-started-page.js +1 -1
- package/alterations-js/1.13.0-1706528755-remove-magic-links.js +1 -1
- package/alterations-js/1.13.0-1706585206-protected-app-custom-domain-unique.js +1 -1
- package/alterations-js/1.13.1-1707360939-grant-is-suspended-read-permission.js +1 -1
- package/alterations-js/1.14.0-1708916601-remove-management-api-scopes-assigned-to-user-role.js +1 -1
- package/alterations-js/1.14.0-1709190131-enhance-dau-data-accuracy.js +1 -1
- package/alterations-js/1.15.0-1709521416-user-password-encrypt-method.d.ts +3 -0
- package/alterations-js/1.15.0-1709521416-user-password-encrypt-method.js +31 -0
- package/alterations-js/1.15.0-1709528944-regenerate-dau-data.d.ts +3 -0
- package/alterations-js/1.15.0-1709528944-regenerate-dau-data.js +34 -0
- package/alterations-js/1.15.0-1710223946-add-fetch-custom-jwt-cloud-scope.d.ts +3 -0
- package/alterations-js/1.15.0-1710223946-add-fetch-custom-jwt-cloud-scope.js +52 -0
- package/alterations-js/1.15.0-1710408335-make-resource-scopes-description-nullable.d.ts +3 -0
- package/alterations-js/1.15.0-1710408335-make-resource-scopes-description-nullable.js +18 -0
- package/alterations-js/1.15.0-1710859622-add-oidc-standard-claim-properties.d.ts +3 -0
- package/alterations-js/1.15.0-1710859622-add-oidc-standard-claim-properties.js +34 -0
- package/alterations-js/1.15.0-1711607772-remove-invite-member-scope-from-tenant-member-role.d.ts +3 -0
- package/alterations-js/1.15.0-1711607772-remove-invite-member-scope-from-tenant-member-role.js +16 -0
- package/alterations-js/1.15.0-1711624564-add-read-member-scope-to-tenant-roles.d.ts +3 -0
- package/alterations-js/1.15.0-1711624564-add-read-member-scope-to-tenant-roles.js +21 -0
- package/alterations-js/1.15.0-1711955211-organization-resource-scope.d.ts +3 -0
- package/alterations-js/1.15.0-1711955211-organization-resource-scope.js +32 -0
- package/alterations-js/1.15.0-1712041436-rename-organization-member-role-to-collaborator.d.ts +3 -0
- package/alterations-js/1.15.0-1712041436-rename-organization-member-role-to-collaborator.js +24 -0
- package/alterations-js/1.15.0-1712545011-fix-organization-resource-scope.d.ts +8 -0
- package/alterations-js/1.15.0-1712545011-fix-organization-resource-scope.js +35 -0
- package/alterations-js/1.15.0-1712559358-fix-down-organization-resource-scope.d.ts +8 -0
- package/alterations-js/1.15.0-1712559358-fix-down-organization-resource-scope.js +38 -0
- package/alterations-js/1.16.0-1712912361-delete-jwt-customier-with-empty-script.d.ts +3 -0
- package/alterations-js/1.16.0-1712912361-delete-jwt-customier-with-empty-script.js +17 -0
- package/alterations-js/1.16.0-1713942039-add-organization-custom-data.d.ts +4 -0
- package/alterations-js/1.16.0-1713942039-add-organization-custom-data.js +17 -0
- package/alterations-js/1.16.0-1714270244-application-org-resource-scope.d.ts +3 -0
- package/alterations-js/1.16.0-1714270244-application-org-resource-scope.js +27 -0
- package/alterations-js/1.2.0-1681267285-fix-get-started-passwordless-status.js +1 -1
- package/alterations-js/1.3.0-1683292832-update-hooks.js +1 -1
- package/alterations-js/1.5.0-1684382842-add-name-tag-created-at-for-tenants-table.js +1 -1
- package/alterations-js/1.5.0-1684739802-create-hook-id-index-for-logs.js +1 -1
- package/alterations-js/1.5.0-1684822341-init-domains.js +1 -1
- package/alterations-js/1.5.0-1684837981-add-manage-tenant-self-scope-to-user-role.js +1 -1
- package/alterations-js/1.5.0-1685285719-support-default-resource.js +1 -1
- package/alterations-js/1.6.0-1685691718-domain-unique.js +1 -1
- package/alterations-js/1.7.0-1688375200-sync-cloud-m2m-to-logto-config.js +1 -1
- package/alterations-js/1.7.0-1688613459-remove-m2m-credentials-from-existing-logto-email-connector-config.js +1 -1
- package/alterations-js/1.7.0-1688627407-daily-active-users.js +1 -1
- package/alterations-js/1.8.0-1692088012-add-is-suspend-column-to-tenants-table.js +1 -1
- package/alterations-js/1.8.0-1692194751-add-affiliate-scopes.js +1 -1
- package/alterations-js/1.9.0-1693554904-add-possword-policy.js +1 -1
- package/alterations-js/1.9.0-1694399696-add-type-col-to-roles-table.js +1 -1
- package/alterations-js/1.9.0-1694418765-specify-check-role-type-function-to-be-public-schema.js +1 -1
- package/alterations-js/1.9.0-1694484927-remove-deprecated-challenge-flag.js +1 -1
- package/alterations-js/1.9.0-1694487524-sie-mfa.js +1 -1
- package/alterations-js/1.9.0-1694509714-keep-existing-password-policy.js +1 -1
- package/alterations-js/1.9.0-1694746763-user-verifications.js +1 -1
- package/alterations-js/1.9.2-1694854226-init-sentinel.js +1 -1
- package/alterations-js/1.9.2-1695198741-remove-m2m-app-admin-access-switch.js +1 -1
- package/alterations-js/utils/1704934999-tables.d.ts +1 -1
- package/alterations-js/utils/1704934999-tables.js +1 -1
- package/lib/consts/experience.d.ts +8 -0
- package/lib/consts/experience.js +9 -0
- package/lib/consts/index.d.ts +1 -0
- package/lib/consts/index.js +1 -0
- package/lib/consts/oidc.d.ts +48 -0
- package/lib/consts/oidc.js +44 -0
- package/lib/consts/subscriptions.d.ts +23 -0
- package/lib/consts/subscriptions.js +23 -0
- package/lib/db-entries/application-user-consent-organization-resource-scope.d.ts +24 -0
- package/lib/db-entries/application-user-consent-organization-resource-scope.js +29 -0
- package/lib/db-entries/custom-types.d.ts +5 -1
- package/lib/db-entries/custom-types.js +4 -0
- package/lib/db-entries/index.d.ts +2 -0
- package/lib/db-entries/index.js +2 -0
- package/lib/db-entries/organization-role-resource-scope-relation.d.ts +20 -0
- package/lib/db-entries/organization-role-resource-scope-relation.js +29 -0
- package/lib/db-entries/organization.d.ts +6 -2
- package/lib/db-entries/organization.js +5 -0
- package/lib/db-entries/scope.d.ts +2 -2
- package/lib/db-entries/scope.js +2 -2
- package/lib/db-entries/user.d.ts +10 -2
- package/lib/db-entries/user.js +9 -1
- package/lib/foundations/jsonb-types/hooks.d.ts +71 -3
- package/lib/foundations/jsonb-types/hooks.js +98 -7
- package/lib/foundations/jsonb-types/index.d.ts +1 -5
- package/lib/foundations/jsonb-types/index.js +1 -7
- package/lib/foundations/jsonb-types/users.d.ts +103 -6
- package/lib/foundations/jsonb-types/users.js +26 -1
- package/lib/seeds/cloud-api.d.ts +6 -3
- package/lib/seeds/cloud-api.js +6 -2
- package/lib/types/alteration.d.ts +1 -1
- package/lib/types/application.d.ts +88 -7
- package/lib/types/application.js +7 -4
- package/lib/types/consent.d.ts +307 -38
- package/lib/types/consent.js +11 -7
- package/lib/types/hook.d.ts +6 -20
- package/lib/types/index.d.ts +2 -1
- package/lib/types/index.js +2 -1
- package/lib/types/log/index.d.ts +4 -1
- package/lib/types/log/index.js +1 -0
- package/lib/types/log/jwt-customizer.d.ts +8 -0
- package/lib/types/log/jwt-customizer.js +7 -0
- package/lib/types/logto-config/index.d.ts +1098 -0
- package/lib/types/{logto-config.js → logto-config/index.js} +25 -0
- package/lib/types/logto-config/jwt-customizer.d.ts +1726 -0
- package/lib/types/logto-config/jwt-customizer.js +92 -0
- package/lib/types/logto-config/jwt-customizer.test.d.ts +1 -0
- package/lib/types/logto-config/jwt-customizer.test.js +78 -0
- package/lib/types/logto-config/oidc-provider.d.ts +67 -0
- package/lib/types/logto-config/oidc-provider.js +33 -0
- package/lib/types/onboarding.d.ts +144 -0
- package/lib/types/onboarding.js +75 -0
- package/lib/types/organization.d.ts +17 -5
- package/lib/types/organization.js +10 -0
- package/lib/types/scope.d.ts +3 -3
- package/lib/types/service-log.d.ts +2 -1
- package/lib/types/service-log.js +1 -0
- package/lib/types/sso-connector.d.ts +16 -2
- package/lib/types/sso-connector.js +17 -4
- package/lib/types/system.d.ts +30 -3
- package/lib/types/system.js +16 -0
- package/lib/types/tenant-organization.d.ts +10 -6
- package/lib/types/tenant-organization.js +19 -9
- package/lib/types/user.d.ts +231 -192
- package/lib/types/user.js +5 -1
- package/lib/utils/domain.test.js +1 -0
- package/lib/utils/zod.d.ts +4 -0
- package/lib/utils/zod.js +1 -0
- package/package.json +17 -19
- package/tables/_functions.sql +8 -0
- package/tables/application_user_consent_organization_resource_scopes.sql +18 -0
- package/tables/organization_role_resource_scope_relations.sql +12 -0
- package/tables/organizations.sql +2 -0
- package/tables/scopes.sql +1 -1
- package/tables/users.sql +10 -1
- package/lib/types/logto-config.d.ts +0 -154
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { sql } from '@silverhand/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 type users_password_encryption_method add value 'SHA1';
|
|
9
|
+
alter type users_password_encryption_method add value 'SHA256';
|
|
10
|
+
alter type users_password_encryption_method add value 'MD5';
|
|
11
|
+
alter type users_password_encryption_method add value 'Bcrypt';
|
|
12
|
+
`);
|
|
13
|
+
},
|
|
14
|
+
down: async (pool) => {
|
|
15
|
+
const { rows } = await pool.query(sql`
|
|
16
|
+
select id from users
|
|
17
|
+
where password_encryption_method <> ${'Argon2i'}
|
|
18
|
+
`);
|
|
19
|
+
if (rows.length > 0) {
|
|
20
|
+
throw new Error('There are users with password encryption methods other than Argon2i.');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
await pool.query(sql`
|
|
24
|
+
create type users_password_encryption_method_revised as enum ('Argon2i');
|
|
25
|
+
|
|
26
|
+
alter table users
|
|
27
|
+
alter column password_encryption_method type users_password_encryption_method_revised
|
|
28
|
+
using password_encryption_method::text::users_password_encryption_method_revised;
|
|
29
|
+
|
|
30
|
+
drop type users_password_encryption_method;
|
|
31
|
+
alter type users_password_encryption_method_revised rename to users_password_encryption_method;
|
|
32
|
+
`);
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default alteration;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { generateStandardId } from '@logto/shared/universal';
|
|
2
|
+
import { sql } from '@silverhand/slonik';
|
|
3
|
+
|
|
4
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
5
|
+
|
|
6
|
+
type ActiveUserInteractionLog = {
|
|
7
|
+
tenantId: string;
|
|
8
|
+
userId: string;
|
|
9
|
+
createdAt: number;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const alteration: AlterationScript = {
|
|
13
|
+
up: async (pool) => {
|
|
14
|
+
// Delete all record from `daily_active_users` table
|
|
15
|
+
await pool.query(sql`delete from daily_active_users;`);
|
|
16
|
+
|
|
17
|
+
// Retrieve all active user logs from `logs` table
|
|
18
|
+
const { rows: interactionLogs } = await pool.query<ActiveUserInteractionLog>(sql`
|
|
19
|
+
select tenant_id, payload->>'userId' as user_id, created_at
|
|
20
|
+
from logs
|
|
21
|
+
where payload->>'userId' is not null and key like 'ExchangeTokenBy.%' and payload->>'result' = 'Success'
|
|
22
|
+
`);
|
|
23
|
+
|
|
24
|
+
if (interactionLogs.length === 0) {
|
|
25
|
+
console.log('No active user interaction logs found, skip alteration');
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Generate DAU data from active user logs
|
|
30
|
+
for (const { tenantId, userId, createdAt } of interactionLogs) {
|
|
31
|
+
/**
|
|
32
|
+
* Note: we ignore the conflict here because conflict data may be inserted when staging.
|
|
33
|
+
*/
|
|
34
|
+
// eslint-disable-next-line no-await-in-loop
|
|
35
|
+
await pool.query(sql`
|
|
36
|
+
insert into daily_active_users (id, tenant_id, user_id, date)
|
|
37
|
+
values (${generateStandardId()},${tenantId}, ${userId}, ${new Date(
|
|
38
|
+
createdAt
|
|
39
|
+
).toISOString()})
|
|
40
|
+
on conflict do nothing;
|
|
41
|
+
`);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
down: async (pool) => {
|
|
45
|
+
// Cannot be reverted
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default alteration;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { generateStandardId } from '@logto/shared/universal';
|
|
2
|
+
import { sql } from '@silverhand/slonik';
|
|
3
|
+
|
|
4
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
5
|
+
|
|
6
|
+
type Resource = {
|
|
7
|
+
tenantId: string;
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
indicator: string;
|
|
11
|
+
isDefault: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type Scope = {
|
|
15
|
+
tenantId: string;
|
|
16
|
+
id: string;
|
|
17
|
+
resourceId: string;
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type Role = {
|
|
23
|
+
tenantId: string;
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const cloudApiIndicator = 'https://cloud.logto.io/api';
|
|
30
|
+
|
|
31
|
+
const cloudConnectionAppRoleName = 'tenantApplication';
|
|
32
|
+
|
|
33
|
+
const adminTenantId = 'admin';
|
|
34
|
+
|
|
35
|
+
const fetchCustomJwtCloudScopeName = 'fetch:custom:jwt';
|
|
36
|
+
const fetchCustomJwtCloudScopeDescription =
|
|
37
|
+
'Allow accessing external resource to execute JWT payload customizer script and fetch the parsed token payload.';
|
|
38
|
+
|
|
39
|
+
const alteration: AlterationScript = {
|
|
40
|
+
up: async (pool) => {
|
|
41
|
+
// Get the Cloud API resource
|
|
42
|
+
const cloudApiResource = await pool.one<Resource>(sql`
|
|
43
|
+
select * from resources
|
|
44
|
+
where tenant_id = ${adminTenantId}
|
|
45
|
+
and indicator = ${cloudApiIndicator}
|
|
46
|
+
`);
|
|
47
|
+
|
|
48
|
+
// Get cloud connection application role
|
|
49
|
+
const tenantApplicationRole = await pool.one<Role>(sql`
|
|
50
|
+
select * from roles
|
|
51
|
+
where tenant_id = ${adminTenantId}
|
|
52
|
+
and name = ${cloudConnectionAppRoleName} and type = 'MachineToMachine'
|
|
53
|
+
`);
|
|
54
|
+
|
|
55
|
+
// Create the `custom:jwt` scope
|
|
56
|
+
const customJwtCloudScope = await pool.one<Scope>(sql`
|
|
57
|
+
insert into scopes (id, tenant_id, resource_id, name, description)
|
|
58
|
+
values (${generateStandardId()}, ${adminTenantId}, ${
|
|
59
|
+
cloudApiResource.id
|
|
60
|
+
}, ${fetchCustomJwtCloudScopeName}, ${fetchCustomJwtCloudScopeDescription})
|
|
61
|
+
returning *;
|
|
62
|
+
`);
|
|
63
|
+
|
|
64
|
+
// Assign the `custom:jwt` scope to cloud connection application role
|
|
65
|
+
await pool.query(sql`
|
|
66
|
+
insert into roles_scopes (id, tenant_id, role_id, scope_id)
|
|
67
|
+
values (${generateStandardId()}, ${adminTenantId}, ${tenantApplicationRole.id}, ${
|
|
68
|
+
customJwtCloudScope.id
|
|
69
|
+
});
|
|
70
|
+
`);
|
|
71
|
+
},
|
|
72
|
+
down: async (pool) => {
|
|
73
|
+
// Get the Cloud API resource
|
|
74
|
+
const cloudApiResource = await pool.one<Resource>(sql`
|
|
75
|
+
select * from resources
|
|
76
|
+
where tenant_id = ${adminTenantId}
|
|
77
|
+
and indicator = ${cloudApiIndicator}
|
|
78
|
+
`);
|
|
79
|
+
|
|
80
|
+
// Remove the `custom:jwt` scope
|
|
81
|
+
await pool.query(sql`
|
|
82
|
+
delete from scopes
|
|
83
|
+
where
|
|
84
|
+
tenant_id = ${adminTenantId} and
|
|
85
|
+
name = ${fetchCustomJwtCloudScopeName} and
|
|
86
|
+
description = ${fetchCustomJwtCloudScopeDescription} and
|
|
87
|
+
resource_id = ${cloudApiResource.id}
|
|
88
|
+
`);
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export default alteration;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { sql } from '@silverhand/slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
4
|
+
|
|
5
|
+
const alteration: AlterationScript = {
|
|
6
|
+
up: async (pool) => {
|
|
7
|
+
// Make the resource scopes description nullable
|
|
8
|
+
await pool.query(sql`
|
|
9
|
+
alter table scopes
|
|
10
|
+
alter column description drop not null;
|
|
11
|
+
`);
|
|
12
|
+
},
|
|
13
|
+
down: async (pool) => {
|
|
14
|
+
// Revert the resource scopes description nullable
|
|
15
|
+
await pool.query(sql`
|
|
16
|
+
alter table scopes
|
|
17
|
+
alter column description set not null;
|
|
18
|
+
`);
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default alteration;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { sql } from '@silverhand/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 users
|
|
9
|
+
add column profile jsonb not null default '{}'::jsonb,
|
|
10
|
+
add column updated_at timestamptz not null default (now());
|
|
11
|
+
`);
|
|
12
|
+
await pool.query(sql`
|
|
13
|
+
create function set_updated_at() returns trigger as
|
|
14
|
+
$$ begin
|
|
15
|
+
new.updated_at = now();
|
|
16
|
+
return new;
|
|
17
|
+
end; $$ language plpgsql;
|
|
18
|
+
|
|
19
|
+
create trigger set_updated_at
|
|
20
|
+
before update on users
|
|
21
|
+
for each row
|
|
22
|
+
execute procedure set_updated_at();
|
|
23
|
+
`);
|
|
24
|
+
},
|
|
25
|
+
down: async (pool) => {
|
|
26
|
+
await pool.query(sql`
|
|
27
|
+
alter table users
|
|
28
|
+
drop column profile,
|
|
29
|
+
drop column updated_at;
|
|
30
|
+
`);
|
|
31
|
+
await pool.query(sql`
|
|
32
|
+
drop trigger set_updated_at on users;
|
|
33
|
+
drop function set_updated_at();
|
|
34
|
+
`);
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default alteration;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { sql } from '@silverhand/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
|
+
delete from organization_role_scope_relations
|
|
9
|
+
where tenant_id = 'admin' and organization_role_id = 'member' and organization_scope_id = 'invite-member';
|
|
10
|
+
`);
|
|
11
|
+
},
|
|
12
|
+
down: async (pool) => {
|
|
13
|
+
await pool.query(sql`
|
|
14
|
+
insert into organization_role_scope_relations (tenant_id, organization_role_id, organization_scope_id)
|
|
15
|
+
values ('admin', 'member', 'invite-member');
|
|
16
|
+
`);
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default alteration;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { sql } from '@silverhand/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
|
+
insert into organization_scopes (tenant_id, id, name, description)
|
|
9
|
+
values ('admin', 'read-member', 'read:member', 'Read members of the tenant.');
|
|
10
|
+
insert into organization_role_scope_relations (tenant_id, organization_role_id, organization_scope_id)
|
|
11
|
+
values ('admin', 'admin', 'read-member'),
|
|
12
|
+
('admin', 'member', 'read-member');
|
|
13
|
+
`);
|
|
14
|
+
},
|
|
15
|
+
down: async (pool) => {
|
|
16
|
+
await pool.query(sql`
|
|
17
|
+
delete from organization_role_scope_relations
|
|
18
|
+
where tenant_id = 'admin' and organization_scope_id = 'read-member';
|
|
19
|
+
delete from organization_scopes
|
|
20
|
+
where tenant_id = 'admin' and id = 'read-member';
|
|
21
|
+
`);
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default alteration;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { sql } from '@silverhand/slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
4
|
+
|
|
5
|
+
import { applyTableRls, dropTableRls } from './utils/1704934999-tables.js';
|
|
6
|
+
|
|
7
|
+
const alteration: AlterationScript = {
|
|
8
|
+
up: async (pool) => {
|
|
9
|
+
await pool.query(sql`
|
|
10
|
+
create table organization_role_resource_scope_relations (
|
|
11
|
+
tenant_id varchar(21) not null
|
|
12
|
+
references tenants (id) on update cascade on delete cascade,
|
|
13
|
+
organization_role_id varchar(21) not null
|
|
14
|
+
references organization_roles (id) on update cascade on delete cascade,
|
|
15
|
+
scope_id varchar(21) not null
|
|
16
|
+
references scopes (id) on update cascade on delete cascade,
|
|
17
|
+
primary key (tenant_id, organization_role_id, scope_id)
|
|
18
|
+
);
|
|
19
|
+
`);
|
|
20
|
+
await applyTableRls(pool, 'organization_role_resource_scope_relations');
|
|
21
|
+
},
|
|
22
|
+
down: async (pool) => {
|
|
23
|
+
const result = await pool.maybeOne(sql`
|
|
24
|
+
select * from information_schema.tables
|
|
25
|
+
where table_name = 'organization_role_resource_scope_relations'
|
|
26
|
+
`);
|
|
27
|
+
|
|
28
|
+
if (!result) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
await dropTableRls(pool, 'organization_role_resource_scope_relations');
|
|
33
|
+
await pool.query(sql`
|
|
34
|
+
drop table organization_role_resource_scope_relations
|
|
35
|
+
`);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default alteration;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { sql } from '@silverhand/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
|
+
update organization_roles
|
|
9
|
+
set id = 'collaborator', name = 'collaborator', description = 'Collaborator of the tenant, who has permissions to operate the tenant data, but not the tenant settings.'
|
|
10
|
+
where tenant_id = 'admin' and id = 'member';
|
|
11
|
+
update organization_role_scope_relations
|
|
12
|
+
set organization_role_id = 'collaborator'
|
|
13
|
+
where tenant_id = 'admin' and organization_role_id = 'member';
|
|
14
|
+
`);
|
|
15
|
+
},
|
|
16
|
+
down: async (pool) => {
|
|
17
|
+
await pool.query(sql`
|
|
18
|
+
update organization_roles
|
|
19
|
+
set id = 'member', name = 'member', description = 'Member of the tenant, who has permissions to operate the tenant data, but not the tenant settings.'
|
|
20
|
+
where tenant_id = 'admin' and id = 'collaborator';
|
|
21
|
+
update organization_role_scope_relations
|
|
22
|
+
set organization_role_id = 'member'
|
|
23
|
+
where tenant_id = 'admin' and organization_role_id = 'collaborator';
|
|
24
|
+
`);
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default alteration;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { sql } from '@silverhand/slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
4
|
+
|
|
5
|
+
import { applyTableRls } from './utils/1704934999-tables.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The script `next-1711955211-organization-resource-scope` was merged after `next-1712041436-rename-organization-member-role-to-collaborator`,
|
|
9
|
+
* so the table `organization_role_resource_scope_relations` may not be created in the database.
|
|
10
|
+
* This script is to fix the issue, try to create the table if it is not exists.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const alteration: AlterationScript = {
|
|
14
|
+
up: async (pool) => {
|
|
15
|
+
const result = await pool.maybeOne(sql`
|
|
16
|
+
select * from information_schema.tables
|
|
17
|
+
where table_name = 'organization_role_resource_scope_relations'
|
|
18
|
+
`);
|
|
19
|
+
|
|
20
|
+
if (result) {
|
|
21
|
+
// The table already exists, do nothing
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
await pool.query(sql`
|
|
26
|
+
create table organization_role_resource_scope_relations (
|
|
27
|
+
tenant_id varchar(21) not null
|
|
28
|
+
references tenants (id) on update cascade on delete cascade,
|
|
29
|
+
organization_role_id varchar(21) not null
|
|
30
|
+
references organization_roles (id) on update cascade on delete cascade,
|
|
31
|
+
scope_id varchar(21) not null
|
|
32
|
+
references scopes (id) on update cascade on delete cascade,
|
|
33
|
+
primary key (tenant_id, organization_role_id, scope_id)
|
|
34
|
+
);
|
|
35
|
+
`);
|
|
36
|
+
await applyTableRls(pool, 'organization_role_resource_scope_relations');
|
|
37
|
+
},
|
|
38
|
+
down: async () => {
|
|
39
|
+
// Do nothing
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default alteration;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { sql } from '@silverhand/slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
4
|
+
|
|
5
|
+
import { applyTableRls, dropTableRls } from './utils/1704934999-tables.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The script `next-1711955211-organization-resource-scope` was merged after `next-1712041436-rename-organization-member-role-to-collaborator`,
|
|
9
|
+
* so the table `organization_role_resource_scope_relations` may not be created in the database.
|
|
10
|
+
* This script is to fix the issue, try to create the table if it is not exists.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const alteration: AlterationScript = {
|
|
14
|
+
up: async (pool) => {
|
|
15
|
+
const result = await pool.maybeOne(sql`
|
|
16
|
+
select * from information_schema.tables
|
|
17
|
+
where table_name = 'organization_role_resource_scope_relations'
|
|
18
|
+
`);
|
|
19
|
+
|
|
20
|
+
if (result) {
|
|
21
|
+
// The table already exists, do nothing
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
await pool.query(sql`
|
|
26
|
+
create table organization_role_resource_scope_relations (
|
|
27
|
+
tenant_id varchar(21) not null
|
|
28
|
+
references tenants (id) on update cascade on delete cascade,
|
|
29
|
+
organization_role_id varchar(21) not null
|
|
30
|
+
references organization_roles (id) on update cascade on delete cascade,
|
|
31
|
+
scope_id varchar(21) not null
|
|
32
|
+
references scopes (id) on update cascade on delete cascade,
|
|
33
|
+
primary key (tenant_id, organization_role_id, scope_id)
|
|
34
|
+
);
|
|
35
|
+
`);
|
|
36
|
+
await applyTableRls(pool, 'organization_role_resource_scope_relations');
|
|
37
|
+
},
|
|
38
|
+
down: async (pool) => {
|
|
39
|
+
await dropTableRls(pool, 'organization_role_resource_scope_relations');
|
|
40
|
+
await pool.query(sql`
|
|
41
|
+
drop table organization_role_resource_scope_relations
|
|
42
|
+
`);
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default alteration;
|