@logto/schemas 1.14.0 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (336) hide show
  1. package/alterations/1.0.0-1677208902-update-admin-console-config.ts +2 -2
  2. package/alterations/1.0.0-1677765137-seed-for-admin-tenant.ts +2 -2
  3. package/alterations/1.0.0-1677907982-allow-admin-create-multiple-tenants.ts +1 -1
  4. package/alterations/1.0.0-1678157950-privacy-policy-url.ts +1 -1
  5. package/alterations/1.0.0-1678199795-add-verification-status-table.ts +2 -2
  6. package/alterations/1.0.0-1678259693-remove-branding-style-config.ts +2 -2
  7. package/alterations/1.0.0-1678269972-use-restrictive-policies.ts +2 -2
  8. package/alterations/1.0.0-1678284778-restrict-internal-roles.ts +1 -1
  9. package/alterations/1.0.0-1678425761-m2m-app-for-tenants.ts +1 -1
  10. package/alterations/1.0.0-1678450233-support-custom-content.ts +1 -1
  11. package/alterations/1.0.0-1678716747-service-logs.ts +2 -2
  12. package/alterations/1.0.0-1678928481-remove-deprecated-logto-config-item.ts +2 -2
  13. package/alterations/1.0.0-1678953179-update-get-started-task-config.ts +2 -2
  14. package/alterations/1.0.0-1679209413-drop-connector-database-storage.ts +1 -1
  15. package/alterations/1.0.0_beta.10-1-logto-config.ts +1 -1
  16. package/alterations/1.0.0_beta.10-1663923211-machine-to-machine-app.ts +1 -1
  17. package/alterations/1.0.0_beta.10-1664265197-custom-phrases.ts +1 -1
  18. package/alterations/1.0.0_beta.11-1664347703-rename-language-key-to-tag.ts +1 -1
  19. package/alterations/1.0.0_beta.11-1664356000-add-created-at-column-to-users.ts +1 -1
  20. package/alterations/1.0.0_beta.11-1664462389-correct-user-created-at-column-by-user-logs.ts +1 -1
  21. package/alterations/1.0.0_beta.14-1665300135-sign-in-sign-up.ts +1 -1
  22. package/alterations/1.0.0_beta.14-1667283640-remove-forgot-password.ts +1 -1
  23. package/alterations/1.0.0_beta.14-1667292082-remove-sign-in-method.ts +1 -1
  24. package/alterations/1.0.0_beta.14-1667374974-user-suspend.ts +1 -1
  25. package/alterations/1.0.0_beta.14-1667900481-add-passcode-type-continue.ts +1 -1
  26. package/alterations/1.0.0_beta.18-1668666590-support-multiple-connector-instances.ts +1 -1
  27. package/alterations/1.0.0_beta.18-1668666600-remove-connector-enabled.ts +1 -1
  28. package/alterations/1.0.0_beta.18-1669091623-roles-and-scopes.ts +1 -1
  29. package/alterations/1.0.0_beta.18-1669702299-sign-up.ts +2 -2
  30. package/alterations/1.0.0_beta.18-1671039448-add-user-name-index.ts +1 -1
  31. package/alterations/1.0.0_beta.18-1671080370-terms-of-use.ts +2 -2
  32. package/alterations/1.0.0_beta.18-1671336831-refactor-log-types.ts +1 -1
  33. package/alterations/1.0.0_beta.18-1671509870-hooks.ts +1 -1
  34. package/alterations/1.0.0_beta.18-1672119200-align-passcode-type-with-message-type.ts +1 -1
  35. package/alterations/1.0.0_rc.0-1672815959-user-roles.ts +1 -1
  36. package/alterations/1.0.0_rc.0-1672820345-scope-resource-id.ts +1 -1
  37. package/alterations/1.0.0_rc.0-1672901841-roles-and-scopes-not-null.ts +1 -1
  38. package/alterations/1.0.0_rc.0-1673001922-support-generic-passcode.ts +1 -1
  39. package/alterations/1.0.0_rc.0-1673165463-scope-name-index.ts +1 -1
  40. package/alterations/1.0.0_rc.0-1673349501-sms-sign-in-identifier-to-phone.ts +1 -1
  41. package/alterations/1.0.0_rc.0-1673465463-ac-scope-name.ts +1 -1
  42. package/alterations/1.0.0_rc.0-1673853579-ac-default-scope.ts +1 -1
  43. package/alterations/1.0.0_rc.0-1673863835-ac-scope-role.ts +1 -1
  44. package/alterations/1.0.0_rc.0-1673882867-fix-alteration-issues.ts +1 -1
  45. package/alterations/1.0.0_rc.0-1673940577-scope-description-not-null.ts +1 -1
  46. package/alterations/1.0.0_rc.0-1673941897-application-roles.ts +1 -1
  47. package/alterations/1.0.0_rc.0-1674032095.1-dedup-resources-constraint.ts +1 -1
  48. package/alterations/1.0.0_rc.0-1674032095.2-oidc-model-pkey.ts +1 -1
  49. package/alterations/1.0.0_rc.0-1674032095.3-tenant-table.ts +1 -1
  50. package/alterations/1.0.0_rc.0-1674032095.4-add-id-column.ts +1 -1
  51. package/alterations/1.0.0_rc.0-1674032095.5-multi-tenancy.ts +6 -7
  52. package/alterations/1.0.0_rc.0-1674032095.6-add-tenant-id-trigger.ts +1 -1
  53. package/alterations/1.0.0_rc.0-1674987042-drop-settings-and-create-systems.ts +1 -1
  54. package/alterations/1.0.0_rc.0-1675316731-update-seed-data.ts +1 -1
  55. package/alterations/1.0.0_rc.1-1675788753-multi-tenancy-rls.ts +3 -4
  56. package/alterations/1.0.0_rc.1-1676115897-add-admin-tenant.ts +3 -4
  57. package/alterations/1.0.0_rc.1-1676185899-fix-logs-index.ts +1 -1
  58. package/alterations/1.0.0_rc.1-1676190092-migrate-admin-data.ts +2 -2
  59. package/alterations/1.0.0_rc.1-1676823841-update-sie-primary-key.ts +1 -1
  60. package/alterations/1.0.0_rc.1-1676874936-support-custom-css.ts +1 -1
  61. package/alterations/1.0.0_rc.1-1676886855-connector-database-read-write.ts +1 -1
  62. package/alterations/1.0.0_rc.1-1676906977-remove-demo-app.ts +1 -1
  63. package/alterations/1.0.0_rc.1-1676956206-move-console-sie-to-database.ts +1 -1
  64. package/alterations/1.0.0_rc.1-1677059985-move-console-application-to-database.ts +1 -1
  65. package/alterations/1.10.1-1695647183-update-private-key-type.ts +2 -2
  66. package/alterations/1.10.1-1696657546-organization-tables.ts +1 -1
  67. package/alterations/1.10.1-1697683802-add-sso-connectors-table.ts +1 -1
  68. package/alterations/1.10.1-1698646271-add-organization-created-flag.ts +2 -2
  69. package/alterations/1.10.1-1698820410-add-user-sso-identities-table.ts +1 -1
  70. package/alterations/1.10.1-1698910485-user-logto-data.ts +1 -1
  71. package/alterations/1.11.0-1699422979-add-sso-connector-id-col-to-user-sso-identities-table.ts +1 -1
  72. package/alterations/1.11.0-1699598903-remove-sso-only-column-in-sso-connectors-table.ts +1 -1
  73. package/alterations/1.12.0-1700031616-update-org-role-foreign-keys.ts +1 -1
  74. package/alterations/1.12.0-1701054133-add-unique-constraint-to-the-sso-connector-name.ts +1 -1
  75. package/alterations/1.12.0-1701245520-add-single-sign-on-enabled-flag-to-sie.ts +1 -1
  76. package/alterations/1.13.0-1702274830-add-new-third-party-column-to-applications-table.ts +1 -1
  77. package/alterations/1.13.0-1702372401-add-application-permissions-tables.ts +1 -1
  78. package/alterations/1.13.0-1702544178-sync-tenant-orgs.ts +1 -1
  79. package/alterations/1.13.0-1702871078-protected-application-type.ts +1 -1
  80. package/alterations/1.13.0-1702877515-protected-app-configs.ts +1 -1
  81. package/alterations/1.13.0-1702978120-application-sign-in-experience-table.ts +1 -1
  82. package/alterations/1.13.0-1703229996-daily-token-usage.ts +1 -1
  83. package/alterations/1.13.0-1703230000-update-tenant-roles.ts +1 -1
  84. package/alterations/1.13.0-1704692973-remove-legacy-resources.ts +1 -1
  85. package/alterations/1.13.0-1704934999-add-magic-links-table.ts +1 -1
  86. package/alterations/1.13.0-1704935001-add-organization-invitation-tables.ts +1 -1
  87. package/alterations/1.13.0-1705288654-add-application-user-consent-organizations-table.ts +1 -1
  88. package/alterations/1.13.0-1705991158-update-invitation-indices.ts +1 -1
  89. package/alterations/1.13.0-1706449174-update-organization-invitation-column.ts +1 -1
  90. package/alterations/1.13.0-1706510290-protected-app-host-index.ts +1 -1
  91. package/alterations/1.13.0-1706512952-restore-get-started-page.ts +1 -1
  92. package/alterations/1.13.0-1706528755-remove-magic-links.ts +1 -1
  93. package/alterations/1.13.0-1706585206-protected-app-custom-domain-unique.ts +1 -1
  94. package/alterations/1.13.1-1707360939-grant-is-suspended-read-permission.ts +1 -1
  95. package/alterations/1.14.0-1708916601-remove-management-api-scopes-assigned-to-user-role.ts +1 -1
  96. package/alterations/1.14.0-1709190131-enhance-dau-data-accuracy.ts +1 -1
  97. package/alterations/1.15.0-1709521416-user-password-encrypt-method.ts +36 -0
  98. package/alterations/1.15.0-1709528944-regenerate-dau-data.ts +49 -0
  99. package/alterations/1.15.0-1710223946-add-fetch-custom-jwt-cloud-scope.ts +92 -0
  100. package/alterations/1.15.0-1710408335-make-resource-scopes-description-nullable.ts +22 -0
  101. package/alterations/1.15.0-1710859622-add-oidc-standard-claim-properties.ts +38 -0
  102. package/alterations/1.15.0-1711607772-remove-invite-member-scope-from-tenant-member-role.ts +20 -0
  103. package/alterations/1.15.0-1711624564-add-read-member-scope-to-tenant-roles.ts +25 -0
  104. package/alterations/1.15.0-1711955211-organization-resource-scope.ts +39 -0
  105. package/alterations/1.15.0-1712041436-rename-organization-member-role-to-collaborator.ts +28 -0
  106. package/alterations/1.15.0-1712545011-fix-organization-resource-scope.ts +43 -0
  107. package/alterations/1.15.0-1712559358-fix-down-organization-resource-scope.ts +46 -0
  108. package/alterations/1.2.0-1681267285-fix-get-started-passwordless-status.ts +1 -1
  109. package/alterations/1.3.0-1683292832-update-hooks.ts +1 -1
  110. package/alterations/1.5.0-1684382842-add-name-tag-created-at-for-tenants-table.ts +1 -1
  111. package/alterations/1.5.0-1684739802-create-hook-id-index-for-logs.ts +1 -1
  112. package/alterations/1.5.0-1684822341-init-domains.ts +2 -2
  113. package/alterations/1.5.0-1684837981-add-manage-tenant-self-scope-to-user-role.ts +1 -1
  114. package/alterations/1.5.0-1685285719-support-default-resource.ts +1 -1
  115. package/alterations/1.6.0-1685691718-domain-unique.ts +1 -1
  116. package/alterations/1.7.0-1688375200-sync-cloud-m2m-to-logto-config.ts +1 -1
  117. package/alterations/1.7.0-1688613459-remove-m2m-credentials-from-existing-logto-email-connector-config.ts +1 -1
  118. package/alterations/1.7.0-1688627407-daily-active-users.ts +1 -1
  119. package/alterations/1.8.0-1692088012-add-is-suspend-column-to-tenants-table.ts +1 -1
  120. package/alterations/1.8.0-1692194751-add-affiliate-scopes.ts +1 -1
  121. package/alterations/1.9.0-1693554904-add-possword-policy.ts +1 -1
  122. package/alterations/1.9.0-1694399696-add-type-col-to-roles-table.ts +1 -1
  123. package/alterations/1.9.0-1694418765-specify-check-role-type-function-to-be-public-schema.ts +1 -1
  124. package/alterations/1.9.0-1694484927-remove-deprecated-challenge-flag.ts +2 -2
  125. package/alterations/1.9.0-1694487524-sie-mfa.ts +1 -1
  126. package/alterations/1.9.0-1694509714-keep-existing-password-policy.ts +1 -1
  127. package/alterations/1.9.0-1694746763-user-verifications.ts +1 -1
  128. package/alterations/1.9.2-1694854226-init-sentinel.ts +1 -1
  129. package/alterations/1.9.2-1695198741-remove-m2m-app-admin-access-switch.ts +1 -1
  130. package/alterations/utils/1704934999-tables.ts +1 -1
  131. package/alterations-js/1.0.0-1677208902-update-admin-console-config.js +1 -1
  132. package/alterations-js/1.0.0-1677765137-seed-for-admin-tenant.js +1 -1
  133. package/alterations-js/1.0.0-1677907982-allow-admin-create-multiple-tenants.js +1 -1
  134. package/alterations-js/1.0.0-1678157950-privacy-policy-url.js +1 -1
  135. package/alterations-js/1.0.0-1678199795-add-verification-status-table.js +1 -1
  136. package/alterations-js/1.0.0-1678259693-remove-branding-style-config.js +1 -1
  137. package/alterations-js/1.0.0-1678269972-use-restrictive-policies.js +1 -1
  138. package/alterations-js/1.0.0-1678284778-restrict-internal-roles.js +1 -1
  139. package/alterations-js/1.0.0-1678425761-m2m-app-for-tenants.js +1 -1
  140. package/alterations-js/1.0.0-1678450233-support-custom-content.js +1 -1
  141. package/alterations-js/1.0.0-1678716747-service-logs.js +1 -1
  142. package/alterations-js/1.0.0-1678928481-remove-deprecated-logto-config-item.js +1 -1
  143. package/alterations-js/1.0.0-1678953179-update-get-started-task-config.js +1 -1
  144. package/alterations-js/1.0.0-1679209413-drop-connector-database-storage.js +1 -1
  145. package/alterations-js/1.0.0_beta.10-1-logto-config.js +1 -1
  146. package/alterations-js/1.0.0_beta.10-1663923211-machine-to-machine-app.js +1 -1
  147. package/alterations-js/1.0.0_beta.10-1664265197-custom-phrases.js +1 -1
  148. package/alterations-js/1.0.0_beta.11-1664347703-rename-language-key-to-tag.js +1 -1
  149. package/alterations-js/1.0.0_beta.11-1664356000-add-created-at-column-to-users.js +1 -1
  150. package/alterations-js/1.0.0_beta.11-1664462389-correct-user-created-at-column-by-user-logs.js +1 -1
  151. package/alterations-js/1.0.0_beta.14-1665300135-sign-in-sign-up.js +1 -1
  152. package/alterations-js/1.0.0_beta.14-1667283640-remove-forgot-password.js +1 -1
  153. package/alterations-js/1.0.0_beta.14-1667292082-remove-sign-in-method.js +1 -1
  154. package/alterations-js/1.0.0_beta.14-1667374974-user-suspend.js +1 -1
  155. package/alterations-js/1.0.0_beta.14-1667900481-add-passcode-type-continue.js +1 -1
  156. package/alterations-js/1.0.0_beta.18-1668666590-support-multiple-connector-instances.js +1 -1
  157. package/alterations-js/1.0.0_beta.18-1668666600-remove-connector-enabled.js +1 -1
  158. package/alterations-js/1.0.0_beta.18-1669091623-roles-and-scopes.js +1 -1
  159. package/alterations-js/1.0.0_beta.18-1669702299-sign-up.js +1 -1
  160. package/alterations-js/1.0.0_beta.18-1671039448-add-user-name-index.js +1 -1
  161. package/alterations-js/1.0.0_beta.18-1671080370-terms-of-use.js +1 -1
  162. package/alterations-js/1.0.0_beta.18-1671336831-refactor-log-types.js +1 -1
  163. package/alterations-js/1.0.0_beta.18-1671509870-hooks.js +1 -1
  164. package/alterations-js/1.0.0_beta.18-1672119200-align-passcode-type-with-message-type.js +1 -1
  165. package/alterations-js/1.0.0_rc.0-1672815959-user-roles.js +1 -1
  166. package/alterations-js/1.0.0_rc.0-1672820345-scope-resource-id.js +1 -1
  167. package/alterations-js/1.0.0_rc.0-1672901841-roles-and-scopes-not-null.js +1 -1
  168. package/alterations-js/1.0.0_rc.0-1673001922-support-generic-passcode.js +1 -1
  169. package/alterations-js/1.0.0_rc.0-1673165463-scope-name-index.js +1 -1
  170. package/alterations-js/1.0.0_rc.0-1673349501-sms-sign-in-identifier-to-phone.js +1 -1
  171. package/alterations-js/1.0.0_rc.0-1673465463-ac-scope-name.js +1 -1
  172. package/alterations-js/1.0.0_rc.0-1673853579-ac-default-scope.js +1 -1
  173. package/alterations-js/1.0.0_rc.0-1673863835-ac-scope-role.js +1 -1
  174. package/alterations-js/1.0.0_rc.0-1673882867-fix-alteration-issues.js +1 -1
  175. package/alterations-js/1.0.0_rc.0-1673940577-scope-description-not-null.js +1 -1
  176. package/alterations-js/1.0.0_rc.0-1673941897-application-roles.js +1 -1
  177. package/alterations-js/1.0.0_rc.0-1674032095.1-dedup-resources-constraint.js +1 -1
  178. package/alterations-js/1.0.0_rc.0-1674032095.2-oidc-model-pkey.js +1 -1
  179. package/alterations-js/1.0.0_rc.0-1674032095.3-tenant-table.js +1 -1
  180. package/alterations-js/1.0.0_rc.0-1674032095.4-add-id-column.js +1 -1
  181. package/alterations-js/1.0.0_rc.0-1674032095.5-multi-tenancy.js +6 -7
  182. package/alterations-js/1.0.0_rc.0-1674032095.6-add-tenant-id-trigger.js +1 -1
  183. package/alterations-js/1.0.0_rc.0-1674987042-drop-settings-and-create-systems.js +1 -1
  184. package/alterations-js/1.0.0_rc.0-1675316731-update-seed-data.js +1 -1
  185. package/alterations-js/1.0.0_rc.1-1675788753-multi-tenancy-rls.js +2 -3
  186. package/alterations-js/1.0.0_rc.1-1676115897-add-admin-tenant.js +2 -3
  187. package/alterations-js/1.0.0_rc.1-1676185899-fix-logs-index.js +1 -1
  188. package/alterations-js/1.0.0_rc.1-1676190092-migrate-admin-data.js +1 -1
  189. package/alterations-js/1.0.0_rc.1-1676823841-update-sie-primary-key.js +1 -1
  190. package/alterations-js/1.0.0_rc.1-1676874936-support-custom-css.js +1 -1
  191. package/alterations-js/1.0.0_rc.1-1676886855-connector-database-read-write.js +1 -1
  192. package/alterations-js/1.0.0_rc.1-1676906977-remove-demo-app.js +1 -1
  193. package/alterations-js/1.0.0_rc.1-1676956206-move-console-sie-to-database.js +1 -1
  194. package/alterations-js/1.0.0_rc.1-1677059985-move-console-application-to-database.js +1 -1
  195. package/alterations-js/1.10.1-1695647183-update-private-key-type.js +1 -1
  196. package/alterations-js/1.10.1-1696657546-organization-tables.js +1 -1
  197. package/alterations-js/1.10.1-1697683802-add-sso-connectors-table.js +1 -1
  198. package/alterations-js/1.10.1-1698646271-add-organization-created-flag.js +1 -1
  199. package/alterations-js/1.10.1-1698820410-add-user-sso-identities-table.js +1 -1
  200. package/alterations-js/1.10.1-1698910485-user-logto-data.js +1 -1
  201. package/alterations-js/1.11.0-1699422979-add-sso-connector-id-col-to-user-sso-identities-table.js +1 -1
  202. package/alterations-js/1.11.0-1699598903-remove-sso-only-column-in-sso-connectors-table.js +1 -1
  203. package/alterations-js/1.12.0-1700031616-update-org-role-foreign-keys.js +1 -1
  204. package/alterations-js/1.12.0-1701054133-add-unique-constraint-to-the-sso-connector-name.js +1 -1
  205. package/alterations-js/1.12.0-1701245520-add-single-sign-on-enabled-flag-to-sie.js +1 -1
  206. package/alterations-js/1.13.0-1702274830-add-new-third-party-column-to-applications-table.js +1 -1
  207. package/alterations-js/1.13.0-1702372401-add-application-permissions-tables.js +1 -1
  208. package/alterations-js/1.13.0-1702544178-sync-tenant-orgs.js +1 -1
  209. package/alterations-js/1.13.0-1702871078-protected-application-type.js +1 -1
  210. package/alterations-js/1.13.0-1702877515-protected-app-configs.js +1 -1
  211. package/alterations-js/1.13.0-1702978120-application-sign-in-experience-table.js +1 -1
  212. package/alterations-js/1.13.0-1703229996-daily-token-usage.js +1 -1
  213. package/alterations-js/1.13.0-1703230000-update-tenant-roles.js +1 -1
  214. package/alterations-js/1.13.0-1704692973-remove-legacy-resources.js +1 -1
  215. package/alterations-js/1.13.0-1704934999-add-magic-links-table.js +1 -1
  216. package/alterations-js/1.13.0-1704935001-add-organization-invitation-tables.js +1 -1
  217. package/alterations-js/1.13.0-1705288654-add-application-user-consent-organizations-table.js +1 -1
  218. package/alterations-js/1.13.0-1705991158-update-invitation-indices.js +1 -1
  219. package/alterations-js/1.13.0-1706449174-update-organization-invitation-column.js +1 -1
  220. package/alterations-js/1.13.0-1706510290-protected-app-host-index.js +1 -1
  221. package/alterations-js/1.13.0-1706512952-restore-get-started-page.js +1 -1
  222. package/alterations-js/1.13.0-1706528755-remove-magic-links.js +1 -1
  223. package/alterations-js/1.13.0-1706585206-protected-app-custom-domain-unique.js +1 -1
  224. package/alterations-js/1.13.1-1707360939-grant-is-suspended-read-permission.js +1 -1
  225. package/alterations-js/1.14.0-1708916601-remove-management-api-scopes-assigned-to-user-role.js +1 -1
  226. package/alterations-js/1.14.0-1709190131-enhance-dau-data-accuracy.js +1 -1
  227. package/alterations-js/1.15.0-1709521416-user-password-encrypt-method.d.ts +3 -0
  228. package/alterations-js/1.15.0-1709521416-user-password-encrypt-method.js +31 -0
  229. package/alterations-js/1.15.0-1709528944-regenerate-dau-data.d.ts +3 -0
  230. package/alterations-js/1.15.0-1709528944-regenerate-dau-data.js +34 -0
  231. package/alterations-js/1.15.0-1710223946-add-fetch-custom-jwt-cloud-scope.d.ts +3 -0
  232. package/alterations-js/1.15.0-1710223946-add-fetch-custom-jwt-cloud-scope.js +52 -0
  233. package/alterations-js/1.15.0-1710408335-make-resource-scopes-description-nullable.d.ts +3 -0
  234. package/alterations-js/1.15.0-1710408335-make-resource-scopes-description-nullable.js +18 -0
  235. package/alterations-js/1.15.0-1710859622-add-oidc-standard-claim-properties.d.ts +3 -0
  236. package/alterations-js/1.15.0-1710859622-add-oidc-standard-claim-properties.js +34 -0
  237. package/alterations-js/1.15.0-1711607772-remove-invite-member-scope-from-tenant-member-role.d.ts +3 -0
  238. package/alterations-js/1.15.0-1711607772-remove-invite-member-scope-from-tenant-member-role.js +16 -0
  239. package/alterations-js/1.15.0-1711624564-add-read-member-scope-to-tenant-roles.d.ts +3 -0
  240. package/alterations-js/1.15.0-1711624564-add-read-member-scope-to-tenant-roles.js +21 -0
  241. package/alterations-js/1.15.0-1711955211-organization-resource-scope.d.ts +3 -0
  242. package/alterations-js/1.15.0-1711955211-organization-resource-scope.js +32 -0
  243. package/alterations-js/1.15.0-1712041436-rename-organization-member-role-to-collaborator.d.ts +3 -0
  244. package/alterations-js/1.15.0-1712041436-rename-organization-member-role-to-collaborator.js +24 -0
  245. package/alterations-js/1.15.0-1712545011-fix-organization-resource-scope.d.ts +8 -0
  246. package/alterations-js/1.15.0-1712545011-fix-organization-resource-scope.js +35 -0
  247. package/alterations-js/1.15.0-1712559358-fix-down-organization-resource-scope.d.ts +8 -0
  248. package/alterations-js/1.15.0-1712559358-fix-down-organization-resource-scope.js +38 -0
  249. package/alterations-js/1.2.0-1681267285-fix-get-started-passwordless-status.js +1 -1
  250. package/alterations-js/1.3.0-1683292832-update-hooks.js +1 -1
  251. package/alterations-js/1.5.0-1684382842-add-name-tag-created-at-for-tenants-table.js +1 -1
  252. package/alterations-js/1.5.0-1684739802-create-hook-id-index-for-logs.js +1 -1
  253. package/alterations-js/1.5.0-1684822341-init-domains.js +1 -1
  254. package/alterations-js/1.5.0-1684837981-add-manage-tenant-self-scope-to-user-role.js +1 -1
  255. package/alterations-js/1.5.0-1685285719-support-default-resource.js +1 -1
  256. package/alterations-js/1.6.0-1685691718-domain-unique.js +1 -1
  257. package/alterations-js/1.7.0-1688375200-sync-cloud-m2m-to-logto-config.js +1 -1
  258. package/alterations-js/1.7.0-1688613459-remove-m2m-credentials-from-existing-logto-email-connector-config.js +1 -1
  259. package/alterations-js/1.7.0-1688627407-daily-active-users.js +1 -1
  260. package/alterations-js/1.8.0-1692088012-add-is-suspend-column-to-tenants-table.js +1 -1
  261. package/alterations-js/1.8.0-1692194751-add-affiliate-scopes.js +1 -1
  262. package/alterations-js/1.9.0-1693554904-add-possword-policy.js +1 -1
  263. package/alterations-js/1.9.0-1694399696-add-type-col-to-roles-table.js +1 -1
  264. package/alterations-js/1.9.0-1694418765-specify-check-role-type-function-to-be-public-schema.js +1 -1
  265. package/alterations-js/1.9.0-1694484927-remove-deprecated-challenge-flag.js +1 -1
  266. package/alterations-js/1.9.0-1694487524-sie-mfa.js +1 -1
  267. package/alterations-js/1.9.0-1694509714-keep-existing-password-policy.js +1 -1
  268. package/alterations-js/1.9.0-1694746763-user-verifications.js +1 -1
  269. package/alterations-js/1.9.2-1694854226-init-sentinel.js +1 -1
  270. package/alterations-js/1.9.2-1695198741-remove-m2m-app-admin-access-switch.js +1 -1
  271. package/alterations-js/utils/1704934999-tables.d.ts +1 -1
  272. package/alterations-js/utils/1704934999-tables.js +1 -1
  273. package/lib/consts/experience.d.ts +8 -0
  274. package/lib/consts/experience.js +9 -0
  275. package/lib/consts/index.d.ts +1 -0
  276. package/lib/consts/index.js +1 -0
  277. package/lib/consts/oidc.d.ts +48 -0
  278. package/lib/consts/oidc.js +44 -0
  279. package/lib/consts/subscriptions.d.ts +23 -0
  280. package/lib/consts/subscriptions.js +23 -0
  281. package/lib/db-entries/custom-types.d.ts +5 -1
  282. package/lib/db-entries/custom-types.js +4 -0
  283. package/lib/db-entries/index.d.ts +1 -0
  284. package/lib/db-entries/index.js +1 -0
  285. package/lib/db-entries/organization-role-resource-scope-relation.d.ts +20 -0
  286. package/lib/db-entries/organization-role-resource-scope-relation.js +29 -0
  287. package/lib/db-entries/scope.d.ts +2 -2
  288. package/lib/db-entries/scope.js +2 -2
  289. package/lib/db-entries/user.d.ts +10 -2
  290. package/lib/db-entries/user.js +9 -1
  291. package/lib/foundations/jsonb-types/index.d.ts +1 -5
  292. package/lib/foundations/jsonb-types/index.js +1 -7
  293. package/lib/foundations/jsonb-types/users.d.ts +103 -6
  294. package/lib/foundations/jsonb-types/users.js +26 -1
  295. package/lib/seeds/cloud-api.d.ts +6 -3
  296. package/lib/seeds/cloud-api.js +6 -2
  297. package/lib/types/alteration.d.ts +1 -1
  298. package/lib/types/application.d.ts +7 -7
  299. package/lib/types/consent.d.ts +100 -16
  300. package/lib/types/index.d.ts +2 -1
  301. package/lib/types/index.js +2 -1
  302. package/lib/types/log/index.d.ts +4 -1
  303. package/lib/types/log/index.js +1 -0
  304. package/lib/types/log/jwt-customizer.d.ts +8 -0
  305. package/lib/types/log/jwt-customizer.js +7 -0
  306. package/lib/types/logto-config/index.d.ts +1097 -0
  307. package/lib/types/{logto-config.js → logto-config/index.js} +25 -0
  308. package/lib/types/logto-config/jwt-customizer.d.ts +1719 -0
  309. package/lib/types/logto-config/jwt-customizer.js +97 -0
  310. package/lib/types/logto-config/jwt-customizer.test.d.ts +1 -0
  311. package/lib/types/logto-config/jwt-customizer.test.js +70 -0
  312. package/lib/types/logto-config/oidc-provider.d.ts +67 -0
  313. package/lib/types/logto-config/oidc-provider.js +33 -0
  314. package/lib/types/onboarding.d.ts +144 -0
  315. package/lib/types/onboarding.js +75 -0
  316. package/lib/types/organization.d.ts +18 -5
  317. package/lib/types/organization.js +19 -0
  318. package/lib/types/scope.d.ts +3 -3
  319. package/lib/types/service-log.d.ts +2 -1
  320. package/lib/types/service-log.js +1 -0
  321. package/lib/types/sso-connector.d.ts +16 -2
  322. package/lib/types/sso-connector.js +17 -4
  323. package/lib/types/system.d.ts +2 -2
  324. package/lib/types/tenant-organization.d.ts +10 -6
  325. package/lib/types/tenant-organization.js +19 -9
  326. package/lib/types/user.d.ts +226 -187
  327. package/lib/types/user.js +5 -1
  328. package/lib/utils/domain.test.js +1 -0
  329. package/lib/utils/zod.d.ts +4 -0
  330. package/lib/utils/zod.js +1 -0
  331. package/package.json +13 -15
  332. package/tables/_functions.sql +8 -0
  333. package/tables/organization_role_resource_scope_relations.sql +12 -0
  334. package/tables/scopes.sql +1 -1
  335. package/tables/users.sql +10 -1
  336. package/lib/types/logto-config.d.ts +0 -154
@@ -1,6 +1,5 @@
1
1
  import { generateStandardId } from '@logto/shared/universal';
2
- import { sql } from 'slonik';
3
- import { raw } from 'slonik-sql-tag-raw';
2
+ import { sql } from '@silverhand/slonik';
4
3
  const adminTenantId = 'admin';
5
4
  const getId = (value) => sql.identifier([value]);
6
5
  const getDatabaseName = async (pool) => {
@@ -137,7 +136,7 @@ const alteration = {
137
136
  `);
138
137
  await pool.query(sql `
139
138
  create role ${getId(role)} with inherit login
140
- password '${raw(password)}'
139
+ password '${sql.raw(password)}'
141
140
  in role ${getId(baseRole)};
142
141
  `);
143
142
  await addManagementApiData(pool);
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const alteration = {
3
3
  up: async (pool) => {
4
4
  await pool.query(sql `
@@ -2,7 +2,7 @@ import { generateKeyPair } from 'node:crypto';
2
2
  import { promisify } from 'node:util';
3
3
  import { generateStandardId } from '@logto/shared/universal';
4
4
  import inquirer from 'inquirer';
5
- import { sql } from 'slonik';
5
+ import { sql } from '@silverhand/slonik';
6
6
  // Copied from CLI with default execution path
7
7
  const generateOidcPrivateKey = async () => {
8
8
  const { privateKey } = await promisify(generateKeyPair)('ec', {
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const alteration = {
3
3
  up: async (pool) => {
4
4
  await pool.query(sql `
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const alteration = {
3
3
  up: async (pool) => {
4
4
  await pool.query(sql `
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const alteration = {
3
3
  up: async (pool) => {
4
4
  await pool.query(sql `
@@ -1,7 +1,7 @@
1
1
  import { generateStandardId } from '@logto/shared/universal';
2
2
  import chalk from 'chalk';
3
3
  import inquirer from 'inquirer';
4
- import { sql } from 'slonik';
4
+ import { sql } from '@silverhand/slonik';
5
5
  const alteration = {
6
6
  up: async (pool) => {
7
7
  const isCi = process.env.CI;
@@ -1,5 +1,5 @@
1
1
  import { generateDarkColor } from '@logto/core-kit';
2
- import { sql } from 'slonik';
2
+ import { sql } from '@silverhand/slonik';
3
3
  const defaultPrimaryColor = '#6139F6';
4
4
  const data = {
5
5
  tenantId: 'admin',
@@ -1,5 +1,5 @@
1
1
  import { generateStandardId } from '@logto/shared/universal';
2
- import { sql } from 'slonik';
2
+ import { sql } from '@silverhand/slonik';
3
3
  const alteration = {
4
4
  up: async (pool) => {
5
5
  await pool.query(sql `
@@ -1,5 +1,5 @@
1
1
  import { generateStandardId } from '@logto/shared';
2
- import { sql } from 'slonik';
2
+ import { sql } from '@silverhand/slonik';
3
3
  const targetConfigKeys = ['oidc.cookieKeys', 'oidc.privateKeys'];
4
4
  /**
5
5
  * Alternate string array private signing keys to JSON array
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const getDatabaseName = async (pool) => {
3
3
  const { currentDatabase } = await pool.one(sql `
4
4
  select current_database();
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const getId = (value) => sql.identifier([value]);
3
3
  const getDatabaseName = async (pool) => {
4
4
  const { currentDatabase } = await pool.one(sql `
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const adminConsoleConfigKey = 'adminConsole';
3
3
  const alterAdminConsoleData = async (logtoConfig, pool) => {
4
4
  const { tenantId, value: oldAdminConsoleConfig } = logtoConfig;
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const getId = (value) => sql.identifier([value]);
3
3
  const getDatabaseName = async (pool) => {
4
4
  const { currentDatabase } = await pool.one(sql `
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const alteration = {
3
3
  up: async (pool) => {
4
4
  await pool.query(sql `
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const alteration = {
3
3
  up: async (pool) => {
4
4
  await pool.query(sql `
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const alteration = {
3
3
  up: async (pool) => {
4
4
  await pool.query(sql `
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const alteration = {
3
3
  up: async (pool) => {
4
4
  await pool.query(sql `
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const alteration = {
3
3
  up: async (pool) => {
4
4
  await pool.query(sql `
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const alteration = {
3
3
  up: async (pool) => {
4
4
  await pool.query(sql `
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const alteration = {
3
3
  up: async (pool) => {
4
4
  await pool.query(sql `
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const getDatabaseName = async (pool) => {
3
3
  const { currentDatabase } = await pool.one(sql `
4
4
  select current_database();
@@ -14,7 +14,7 @@
14
14
  * new tenants before running this script and deploying the changes.
15
15
  */
16
16
  import { ConsoleLog, generateStandardId } from '@logto/shared';
17
- import { sql } from 'slonik';
17
+ import { sql } from '@silverhand/slonik';
18
18
  const adminTenantId = 'admin';
19
19
  const consoleLog = new ConsoleLog();
20
20
  const alteration = {
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const alteration = {
3
3
  up: async (pool) => {
4
4
  await pool.query(sql `
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const alteration = {
3
3
  up: async (pool) => {
4
4
  await pool.query(sql `
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const getDatabaseName = async (pool) => {
3
3
  const { currentDatabase } = await pool.one(sql `
4
4
  select current_database();
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const getId = (value) => sql.identifier([value]);
3
3
  const getDatabaseName = async (pool) => {
4
4
  const { currentDatabase } = await pool.one(sql `
@@ -1,5 +1,5 @@
1
1
  import { ConsoleLog } from '@logto/shared';
2
- import { sql } from 'slonik';
2
+ import { sql } from '@silverhand/slonik';
3
3
  const consoleLog = new ConsoleLog();
4
4
  /**
5
5
  * This script update the following in the admin tenant:
@@ -1,5 +1,5 @@
1
1
  import { generateStandardId } from '@logto/shared/universal';
2
- import { sql } from 'slonik';
2
+ import { sql } from '@silverhand/slonik';
3
3
  const alteration = {
4
4
  up: async (pool) => {
5
5
  // Delete all legacy roles in the admin tenant
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  import { applyTableRls, dropTableRls } from './utils/1704934999-tables.js';
3
3
  const alteration = {
4
4
  up: async (pool) => {
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  import { applyTableRls, dropTableRls } from './utils/1704934999-tables.js';
3
3
  const alteration = {
4
4
  up: async (pool) => {
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const getDatabaseName = async (pool) => {
3
3
  const { currentDatabase } = await pool.one(sql `
4
4
  select current_database();
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  /**
3
3
  * @fileoverview Separates the index (tenant_id, inviter_id, organization_id) to two indices. Also
4
4
  * makes the inviter_id nullable.
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const alteration = {
3
3
  up: async (pool) => {
4
4
  await pool.query(sql `
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const alteration = {
3
3
  up: async (pool) => {
4
4
  await pool.query(sql `
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const alteration = {
3
3
  up: async (pool) => {
4
4
  await pool.query(sql `
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  import { applyTableRls, dropTableRls } from './utils/1704934999-tables.js';
3
3
  const alteration = {
4
4
  up: async (pool) => {
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const alteration = {
3
3
  up: async (pool) => {
4
4
  await pool.query(sql `
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const getDatabaseName = async (pool) => {
3
3
  const { currentDatabase } = await pool.one(sql `
4
4
  select current_database();
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  var RoleType;
3
3
  (function (RoleType) {
4
4
  RoleType["User"] = "User";
@@ -1,4 +1,4 @@
1
- import { sql } from 'slonik';
1
+ import { sql } from '@silverhand/slonik';
2
2
  const alteration = {
3
3
  up: async (pool) => {
4
4
  await pool.query(sql `
@@ -0,0 +1,3 @@
1
+ import type { AlterationScript } from '../lib/types/alteration.js';
2
+ declare const alteration: AlterationScript;
3
+ export default alteration;
@@ -0,0 +1,31 @@
1
+ import { sql } from '@silverhand/slonik';
2
+ const alteration = {
3
+ up: async (pool) => {
4
+ await pool.query(sql `
5
+ alter type users_password_encryption_method add value 'SHA1';
6
+ alter type users_password_encryption_method add value 'SHA256';
7
+ alter type users_password_encryption_method add value 'MD5';
8
+ alter type users_password_encryption_method add value 'Bcrypt';
9
+ `);
10
+ },
11
+ down: async (pool) => {
12
+ const { rows } = await pool.query(sql `
13
+ select id from users
14
+ where password_encryption_method <> ${'Argon2i'}
15
+ `);
16
+ if (rows.length > 0) {
17
+ throw new Error('There are users with password encryption methods other than Argon2i.');
18
+ }
19
+ await pool.query(sql `
20
+ create type users_password_encryption_method_revised as enum ('Argon2i');
21
+
22
+ alter table users
23
+ alter column password_encryption_method type users_password_encryption_method_revised
24
+ using password_encryption_method::text::users_password_encryption_method_revised;
25
+
26
+ drop type users_password_encryption_method;
27
+ alter type users_password_encryption_method_revised rename to users_password_encryption_method;
28
+ `);
29
+ },
30
+ };
31
+ export default alteration;
@@ -0,0 +1,3 @@
1
+ import type { AlterationScript } from '../lib/types/alteration.js';
2
+ declare const alteration: AlterationScript;
3
+ export default alteration;
@@ -0,0 +1,34 @@
1
+ import { generateStandardId } from '@logto/shared/universal';
2
+ import { sql } from '@silverhand/slonik';
3
+ const alteration = {
4
+ up: async (pool) => {
5
+ // Delete all record from `daily_active_users` table
6
+ await pool.query(sql `delete from daily_active_users;`);
7
+ // Retrieve all active user logs from `logs` table
8
+ const { rows: interactionLogs } = await pool.query(sql `
9
+ select tenant_id, payload->>'userId' as user_id, created_at
10
+ from logs
11
+ where payload->>'userId' is not null and key like 'ExchangeTokenBy.%' and payload->>'result' = 'Success'
12
+ `);
13
+ if (interactionLogs.length === 0) {
14
+ console.log('No active user interaction logs found, skip alteration');
15
+ return;
16
+ }
17
+ // Generate DAU data from active user logs
18
+ for (const { tenantId, userId, createdAt } of interactionLogs) {
19
+ /**
20
+ * Note: we ignore the conflict here because conflict data may be inserted when staging.
21
+ */
22
+ // eslint-disable-next-line no-await-in-loop
23
+ await pool.query(sql `
24
+ insert into daily_active_users (id, tenant_id, user_id, date)
25
+ values (${generateStandardId()},${tenantId}, ${userId}, ${new Date(createdAt).toISOString()})
26
+ on conflict do nothing;
27
+ `);
28
+ }
29
+ },
30
+ down: async (pool) => {
31
+ // Cannot be reverted
32
+ },
33
+ };
34
+ export default alteration;
@@ -0,0 +1,3 @@
1
+ import type { AlterationScript } from '../lib/types/alteration.js';
2
+ declare const alteration: AlterationScript;
3
+ export default alteration;
@@ -0,0 +1,52 @@
1
+ import { generateStandardId } from '@logto/shared/universal';
2
+ import { sql } from '@silverhand/slonik';
3
+ const cloudApiIndicator = 'https://cloud.logto.io/api';
4
+ const cloudConnectionAppRoleName = 'tenantApplication';
5
+ const adminTenantId = 'admin';
6
+ const fetchCustomJwtCloudScopeName = 'fetch:custom:jwt';
7
+ const fetchCustomJwtCloudScopeDescription = 'Allow accessing external resource to execute JWT payload customizer script and fetch the parsed token payload.';
8
+ const alteration = {
9
+ up: async (pool) => {
10
+ // Get the Cloud API resource
11
+ const cloudApiResource = await pool.one(sql `
12
+ select * from resources
13
+ where tenant_id = ${adminTenantId}
14
+ and indicator = ${cloudApiIndicator}
15
+ `);
16
+ // Get cloud connection application role
17
+ const tenantApplicationRole = await pool.one(sql `
18
+ select * from roles
19
+ where tenant_id = ${adminTenantId}
20
+ and name = ${cloudConnectionAppRoleName} and type = 'MachineToMachine'
21
+ `);
22
+ // Create the `custom:jwt` scope
23
+ const customJwtCloudScope = await pool.one(sql `
24
+ insert into scopes (id, tenant_id, resource_id, name, description)
25
+ values (${generateStandardId()}, ${adminTenantId}, ${cloudApiResource.id}, ${fetchCustomJwtCloudScopeName}, ${fetchCustomJwtCloudScopeDescription})
26
+ returning *;
27
+ `);
28
+ // Assign the `custom:jwt` scope to cloud connection application role
29
+ await pool.query(sql `
30
+ insert into roles_scopes (id, tenant_id, role_id, scope_id)
31
+ values (${generateStandardId()}, ${adminTenantId}, ${tenantApplicationRole.id}, ${customJwtCloudScope.id});
32
+ `);
33
+ },
34
+ down: async (pool) => {
35
+ // Get the Cloud API resource
36
+ const cloudApiResource = await pool.one(sql `
37
+ select * from resources
38
+ where tenant_id = ${adminTenantId}
39
+ and indicator = ${cloudApiIndicator}
40
+ `);
41
+ // Remove the `custom:jwt` scope
42
+ await pool.query(sql `
43
+ delete from scopes
44
+ where
45
+ tenant_id = ${adminTenantId} and
46
+ name = ${fetchCustomJwtCloudScopeName} and
47
+ description = ${fetchCustomJwtCloudScopeDescription} and
48
+ resource_id = ${cloudApiResource.id}
49
+ `);
50
+ },
51
+ };
52
+ export default alteration;
@@ -0,0 +1,3 @@
1
+ import type { AlterationScript } from '../lib/types/alteration.js';
2
+ declare const alteration: AlterationScript;
3
+ export default alteration;
@@ -0,0 +1,18 @@
1
+ import { sql } from '@silverhand/slonik';
2
+ const alteration = {
3
+ up: async (pool) => {
4
+ // Make the resource scopes description nullable
5
+ await pool.query(sql `
6
+ alter table scopes
7
+ alter column description drop not null;
8
+ `);
9
+ },
10
+ down: async (pool) => {
11
+ // Revert the resource scopes description nullable
12
+ await pool.query(sql `
13
+ alter table scopes
14
+ alter column description set not null;
15
+ `);
16
+ },
17
+ };
18
+ export default alteration;
@@ -0,0 +1,3 @@
1
+ import type { AlterationScript } from '../lib/types/alteration.js';
2
+ declare const alteration: AlterationScript;
3
+ export default alteration;
@@ -0,0 +1,34 @@
1
+ import { sql } from '@silverhand/slonik';
2
+ const alteration = {
3
+ up: async (pool) => {
4
+ await pool.query(sql `
5
+ alter table users
6
+ add column profile jsonb not null default '{}'::jsonb,
7
+ add column updated_at timestamptz not null default (now());
8
+ `);
9
+ await pool.query(sql `
10
+ create function set_updated_at() returns trigger as
11
+ $$ begin
12
+ new.updated_at = now();
13
+ return new;
14
+ end; $$ language plpgsql;
15
+
16
+ create trigger set_updated_at
17
+ before update on users
18
+ for each row
19
+ execute procedure set_updated_at();
20
+ `);
21
+ },
22
+ down: async (pool) => {
23
+ await pool.query(sql `
24
+ alter table users
25
+ drop column profile,
26
+ drop column updated_at;
27
+ `);
28
+ await pool.query(sql `
29
+ drop trigger set_updated_at on users;
30
+ drop function set_updated_at();
31
+ `);
32
+ },
33
+ };
34
+ export default alteration;
@@ -0,0 +1,3 @@
1
+ import type { AlterationScript } from '../lib/types/alteration.js';
2
+ declare const alteration: AlterationScript;
3
+ export default alteration;
@@ -0,0 +1,16 @@
1
+ import { sql } from '@silverhand/slonik';
2
+ const alteration = {
3
+ up: async (pool) => {
4
+ await pool.query(sql `
5
+ delete from organization_role_scope_relations
6
+ where tenant_id = 'admin' and organization_role_id = 'member' and organization_scope_id = 'invite-member';
7
+ `);
8
+ },
9
+ down: async (pool) => {
10
+ await pool.query(sql `
11
+ insert into organization_role_scope_relations (tenant_id, organization_role_id, organization_scope_id)
12
+ values ('admin', 'member', 'invite-member');
13
+ `);
14
+ },
15
+ };
16
+ export default alteration;
@@ -0,0 +1,3 @@
1
+ import type { AlterationScript } from '../lib/types/alteration.js';
2
+ declare const alteration: AlterationScript;
3
+ export default alteration;
@@ -0,0 +1,21 @@
1
+ import { sql } from '@silverhand/slonik';
2
+ const alteration = {
3
+ up: async (pool) => {
4
+ await pool.query(sql `
5
+ insert into organization_scopes (tenant_id, id, name, description)
6
+ values ('admin', 'read-member', 'read:member', 'Read members of the tenant.');
7
+ insert into organization_role_scope_relations (tenant_id, organization_role_id, organization_scope_id)
8
+ values ('admin', 'admin', 'read-member'),
9
+ ('admin', 'member', 'read-member');
10
+ `);
11
+ },
12
+ down: async (pool) => {
13
+ await pool.query(sql `
14
+ delete from organization_role_scope_relations
15
+ where tenant_id = 'admin' and organization_scope_id = 'read-member';
16
+ delete from organization_scopes
17
+ where tenant_id = 'admin' and id = 'read-member';
18
+ `);
19
+ },
20
+ };
21
+ export default alteration;
@@ -0,0 +1,3 @@
1
+ import type { AlterationScript } from '../lib/types/alteration.js';
2
+ declare const alteration: AlterationScript;
3
+ export default alteration;
@@ -0,0 +1,32 @@
1
+ import { sql } from '@silverhand/slonik';
2
+ import { applyTableRls, dropTableRls } from './utils/1704934999-tables.js';
3
+ const alteration = {
4
+ up: async (pool) => {
5
+ await pool.query(sql `
6
+ create table organization_role_resource_scope_relations (
7
+ tenant_id varchar(21) not null
8
+ references tenants (id) on update cascade on delete cascade,
9
+ organization_role_id varchar(21) not null
10
+ references organization_roles (id) on update cascade on delete cascade,
11
+ scope_id varchar(21) not null
12
+ references scopes (id) on update cascade on delete cascade,
13
+ primary key (tenant_id, organization_role_id, scope_id)
14
+ );
15
+ `);
16
+ await applyTableRls(pool, 'organization_role_resource_scope_relations');
17
+ },
18
+ down: async (pool) => {
19
+ const result = await pool.maybeOne(sql `
20
+ select * from information_schema.tables
21
+ where table_name = 'organization_role_resource_scope_relations'
22
+ `);
23
+ if (!result) {
24
+ return;
25
+ }
26
+ await dropTableRls(pool, 'organization_role_resource_scope_relations');
27
+ await pool.query(sql `
28
+ drop table organization_role_resource_scope_relations
29
+ `);
30
+ },
31
+ };
32
+ export default alteration;
@@ -0,0 +1,3 @@
1
+ import type { AlterationScript } from '../lib/types/alteration.js';
2
+ declare const alteration: AlterationScript;
3
+ export default alteration;