emdash 0.29.0 → 0.30.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/dist/{adapters-DPAkL6QF.d.mts → adapters-C0ONzkUP.d.mts} +10 -1
- package/dist/adapters-C0ONzkUP.d.mts.map +1 -0
- package/dist/{allowed-origins-FXB-FplB.mjs → allowed-origins-CCEi9bPI.mjs} +2 -2
- package/dist/{allowed-origins-FXB-FplB.mjs.map → allowed-origins-CCEi9bPI.mjs.map} +1 -1
- package/dist/api/route-utils.d.mts +3 -3
- package/dist/api/route-utils.d.mts.map +1 -1
- package/dist/api/route-utils.mjs +19 -19
- package/dist/api/schemas/index.d.mts +2 -2
- package/dist/api/schemas/index.mjs +5 -4
- package/dist/{api-DVbHNApo.mjs → api-b8WIiGU4.mjs} +253 -153
- package/dist/api-b8WIiGU4.mjs.map +1 -0
- package/dist/api-tokens-Cvmixds7.mjs +3 -0
- package/dist/{api-tokens-UYBkl17d.mjs → api-tokens-uPt8UDpx.mjs} +2 -2
- package/dist/{api-tokens-UYBkl17d.mjs.map → api-tokens-uPt8UDpx.mjs.map} +1 -1
- package/dist/{apply-D23iUV4q.mjs → apply-CmIJK9j8.mjs} +34 -37
- package/dist/apply-CmIJK9j8.mjs.map +1 -0
- package/dist/astro/index.d.mts +12 -13
- package/dist/astro/index.d.mts.map +1 -1
- package/dist/astro/index.mjs +90 -11
- package/dist/astro/index.mjs.map +1 -1
- package/dist/astro/middleware/auth.d.mts +10 -11
- package/dist/astro/middleware/auth.d.mts.map +1 -1
- package/dist/astro/middleware/auth.mjs +56 -107
- package/dist/astro/middleware/auth.mjs.map +1 -1
- package/dist/astro/middleware/redirect.mjs +7 -7
- package/dist/astro/middleware/request-context.mjs +4 -4
- package/dist/astro/middleware/request-context.mjs.map +1 -1
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware.d.mts +47 -3
- package/dist/astro/middleware.d.mts.map +1 -1
- package/dist/astro/middleware.mjs +326 -110
- package/dist/astro/middleware.mjs.map +1 -1
- package/dist/astro/routes/PluginRegistry.d.mts +5 -1
- package/dist/astro/routes/PluginRegistry.d.mts.map +1 -1
- package/dist/astro/routes/PluginRegistry.mjs +2 -1
- package/dist/astro/routes/PluginRegistry.mjs.map +1 -1
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +9 -8
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs.map +1 -1
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +9 -8
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +5 -5
- package/dist/astro/routes/api/admin/api-tokens/index.mjs +7 -7
- package/dist/astro/routes/api/admin/api-tokens/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +5 -5
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +10 -9
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs.map +1 -1
- package/dist/astro/routes/api/admin/byline-fields/index.mjs +10 -9
- package/dist/astro/routes/api/admin/byline-fields/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +10 -9
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +15 -14
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +16 -21
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/admin/bylines/index.mjs +15 -14
- package/dist/astro/routes/api/admin/bylines/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +13 -12
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs.map +1 -1
- package/dist/astro/routes/api/admin/comments/_id_.mjs +6 -6
- package/dist/astro/routes/api/admin/comments/bulk.mjs +11 -10
- package/dist/astro/routes/api/admin/comments/bulk.mjs.map +1 -1
- package/dist/astro/routes/api/admin/comments/counts.mjs +6 -6
- package/dist/astro/routes/api/admin/comments/index.mjs +11 -10
- package/dist/astro/routes/api/admin/comments/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +5 -5
- package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +4 -4
- package/dist/astro/routes/api/admin/media-usage/repair.mjs +12 -10
- package/dist/astro/routes/api/admin/media-usage/repair.mjs.map +1 -1
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +5 -5
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs +5 -5
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +40 -39
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +40 -39
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +45 -39
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/mcp.d.mts +8 -0
- package/dist/astro/routes/api/admin/plugins/_id_/mcp.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/_id_/mcp.mjs +39 -0
- package/dist/astro/routes/api/admin/plugins/_id_/mcp.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/_id_/settings.d.mts +9 -0
- package/dist/astro/routes/api/admin/plugins/_id_/settings.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs +78 -0
- package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +39 -38
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/update.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +42 -39
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/index.mjs +45 -39
- package/dist/astro/routes/api/admin/plugins/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +4 -4
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +39 -38
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +45 -40
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +39 -38
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +39 -38
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +43 -40
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +39 -38
- package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/install.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/install.mjs +44 -41
- package/dist/astro/routes/api/admin/plugins/registry/install.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/updates.mjs +40 -39
- package/dist/astro/routes/api/admin/plugins/updates.mjs.map +1 -1
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +39 -38
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +4 -4
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +39 -38
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/users/_id_/disable.mjs +4 -4
- package/dist/astro/routes/api/admin/users/_id_/enable.mjs +4 -4
- package/dist/astro/routes/api/admin/users/_id_/index.mjs +9 -8
- package/dist/astro/routes/api/admin/users/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +5 -5
- package/dist/astro/routes/api/admin/users/index.mjs +9 -8
- package/dist/astro/routes/api/admin/users/index.mjs.map +1 -1
- package/dist/astro/routes/api/auth/dev-bypass.mjs +7 -7
- package/dist/astro/routes/api/auth/invite/accept.mjs +4 -4
- package/dist/astro/routes/api/auth/invite/complete.mjs +13 -12
- package/dist/astro/routes/api/auth/invite/complete.mjs.map +1 -1
- package/dist/astro/routes/api/auth/invite/index.mjs +10 -9
- package/dist/astro/routes/api/auth/invite/index.mjs.map +1 -1
- package/dist/astro/routes/api/auth/invite/register-options.mjs +12 -11
- package/dist/astro/routes/api/auth/invite/register-options.mjs.map +1 -1
- package/dist/astro/routes/api/auth/logout.mjs +4 -4
- package/dist/astro/routes/api/auth/magic-link/send.mjs +12 -11
- package/dist/astro/routes/api/auth/magic-link/send.mjs.map +1 -1
- package/dist/astro/routes/api/auth/magic-link/verify.mjs +5 -5
- package/dist/astro/routes/api/auth/me.mjs +9 -8
- package/dist/astro/routes/api/auth/me.mjs.map +1 -1
- package/dist/astro/routes/api/auth/mode.d.mts.map +1 -1
- package/dist/astro/routes/api/auth/mode.mjs +6 -3
- package/dist/astro/routes/api/auth/mode.mjs.map +1 -1
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +15 -5
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs.map +1 -1
- package/dist/astro/routes/api/auth/oauth/_provider_.d.mts.map +1 -1
- package/dist/astro/routes/api/auth/oauth/_provider_.mjs +11 -5
- package/dist/astro/routes/api/auth/oauth/_provider_.mjs.map +1 -1
- package/dist/astro/routes/api/auth/passkey/_id_.mjs +8 -7
- package/dist/astro/routes/api/auth/passkey/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/auth/passkey/index.mjs +3 -3
- package/dist/astro/routes/api/auth/passkey/options.mjs +13 -12
- package/dist/astro/routes/api/auth/passkey/options.mjs.map +1 -1
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +11 -10
- package/dist/astro/routes/api/auth/passkey/register/options.mjs.map +1 -1
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +12 -11
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs.map +1 -1
- package/dist/astro/routes/api/auth/passkey/verify.mjs +12 -11
- package/dist/astro/routes/api/auth/passkey/verify.mjs.map +1 -1
- package/dist/astro/routes/api/auth/signup/complete.mjs +13 -12
- package/dist/astro/routes/api/auth/signup/complete.mjs.map +1 -1
- package/dist/astro/routes/api/auth/signup/request.mjs +12 -11
- package/dist/astro/routes/api/auth/signup/request.mjs.map +1 -1
- package/dist/astro/routes/api/auth/signup/verify.mjs +4 -4
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +14 -13
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs.map +1 -1
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +13 -12
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +5 -4
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +6 -5
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +13 -12
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +10 -8
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.d.mts.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs +20 -19
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.mjs +18 -17
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +5 -4
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +10 -8
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.d.mts.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +18 -17
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +5 -4
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_.d.mts.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_.mjs +11 -9
- package/dist/astro/routes/api/content/_collection_/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/authors.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/authors.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/index.d.mts.map +1 -1
- package/dist/astro/routes/api/content/_collection_/index.mjs +12 -10
- package/dist/astro/routes/api/content/_collection_/index.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/trash.mjs +10 -9
- package/dist/astro/routes/api/content/_collection_/trash.mjs.map +1 -1
- package/dist/astro/routes/api/dashboard.mjs +8 -8
- package/dist/astro/routes/api/dev/emails.mjs +4 -4
- package/dist/astro/routes/api/import/probe.d.mts +3 -3
- package/dist/astro/routes/api/import/probe.mjs +17 -16
- package/dist/astro/routes/api/import/probe.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +4 -4
- package/dist/astro/routes/api/import/wordpress/execute.d.mts +11 -12
- package/dist/astro/routes/api/import/wordpress/execute.d.mts.map +1 -1
- package/dist/astro/routes/api/import/wordpress/execute.mjs +12 -12
- package/dist/astro/routes/api/import/wordpress/media.d.mts +10 -11
- package/dist/astro/routes/api/import/wordpress/media.d.mts.map +1 -1
- package/dist/astro/routes/api/import/wordpress/media.mjs +11 -10
- package/dist/astro/routes/api/import/wordpress/media.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +11 -10
- package/dist/astro/routes/api/import/wordpress/prepare.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +11 -12
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts.map +1 -1
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +11 -10
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +17 -16
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/callback.mjs +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +11 -12
- package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts.map +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +23 -22
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs.map +1 -1
- package/dist/astro/routes/api/manifest.mjs +7 -8
- package/dist/astro/routes/api/manifest.mjs.map +1 -1
- package/dist/astro/routes/api/mcp.d.mts.map +1 -1
- package/dist/astro/routes/api/mcp.mjs +149 -45
- package/dist/astro/routes/api/mcp.mjs.map +1 -1
- package/dist/astro/routes/api/media/_id_/confirm.mjs +9 -8
- package/dist/astro/routes/api/media/_id_/confirm.mjs.map +1 -1
- package/dist/astro/routes/api/media/_id_/usage.d.mts +8 -0
- package/dist/astro/routes/api/media/_id_/usage.d.mts.map +1 -0
- package/dist/astro/routes/api/media/_id_/usage.mjs +37 -0
- package/dist/astro/routes/api/media/_id_/usage.mjs.map +1 -0
- package/dist/astro/routes/api/media/_id_.d.mts.map +1 -1
- package/dist/astro/routes/api/media/_id_.mjs +26 -10
- package/dist/astro/routes/api/media/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/media/file/_...key_.mjs +4 -3
- package/dist/astro/routes/api/media/file/_...key_.mjs.map +1 -1
- package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +4 -4
- package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +4 -4
- package/dist/astro/routes/api/media/providers/index.mjs +4 -4
- package/dist/astro/routes/api/media/upload-url.mjs +10 -9
- package/dist/astro/routes/api/media/upload-url.mjs.map +1 -1
- package/dist/astro/routes/api/media.d.mts.map +1 -1
- package/dist/astro/routes/api/media.mjs +31 -11
- package/dist/astro/routes/api/media.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +10 -9
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/items.mjs +10 -9
- package/dist/astro/routes/api/menus/_name_/items.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +10 -9
- package/dist/astro/routes/api/menus/_name_/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/translations.mjs +10 -9
- package/dist/astro/routes/api/menus/_name_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_.mjs +10 -9
- package/dist/astro/routes/api/menus/_name_.mjs.map +1 -1
- package/dist/astro/routes/api/menus/index.mjs +10 -9
- package/dist/astro/routes/api/menus/index.mjs.map +1 -1
- package/dist/astro/routes/api/oauth/authorize.d.mts.map +1 -1
- package/dist/astro/routes/api/oauth/authorize.mjs +7 -8
- package/dist/astro/routes/api/oauth/authorize.mjs.map +1 -1
- package/dist/astro/routes/api/oauth/device/authorize.mjs +7 -7
- package/dist/astro/routes/api/oauth/device/code.mjs +10 -10
- package/dist/astro/routes/api/oauth/device/token.mjs +9 -9
- package/dist/astro/routes/api/oauth/register.mjs +4 -4
- package/dist/astro/routes/api/oauth/token/refresh.mjs +7 -7
- package/dist/astro/routes/api/oauth/token/revoke.mjs +7 -7
- package/dist/astro/routes/api/oauth/token.mjs +7 -7
- package/dist/astro/routes/api/openapi.json.mjs +52 -24
- package/dist/astro/routes/api/openapi.json.mjs.map +1 -1
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.d.mts.map +1 -1
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +20 -32
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs.map +1 -1
- package/dist/astro/routes/api/redirects/404s/index.mjs +12 -11
- package/dist/astro/routes/api/redirects/404s/index.mjs.map +1 -1
- package/dist/astro/routes/api/redirects/404s/summary.mjs +12 -11
- package/dist/astro/routes/api/redirects/404s/summary.mjs.map +1 -1
- package/dist/astro/routes/api/redirects/_id_.mjs +13 -12
- package/dist/astro/routes/api/redirects/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/redirects/index.mjs +13 -12
- package/dist/astro/routes/api/redirects/index.mjs.map +1 -1
- package/dist/astro/routes/api/relations/_id_/index.mjs +16 -15
- package/dist/astro/routes/api/relations/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/relations/_id_/translations.mjs +11 -11
- package/dist/astro/routes/api/relations/index.mjs +16 -15
- package/dist/astro/routes/api/relations/index.mjs.map +1 -1
- package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +4 -4
- package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +5 -4
- package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +39 -38
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +39 -38
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +39 -38
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +39 -38
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/index.mjs +39 -38
- package/dist/astro/routes/api/schema/collections/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/index.mjs +9 -9
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +39 -38
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs.map +1 -1
- package/dist/astro/routes/api/schema/orphans/index.mjs +39 -38
- package/dist/astro/routes/api/schema/orphans/index.mjs.map +1 -1
- package/dist/astro/routes/api/search/enable.mjs +13 -12
- package/dist/astro/routes/api/search/enable.mjs.map +1 -1
- package/dist/astro/routes/api/search/index.mjs +12 -11
- package/dist/astro/routes/api/search/index.mjs.map +1 -1
- package/dist/astro/routes/api/search/rebuild.mjs +13 -12
- package/dist/astro/routes/api/search/rebuild.mjs.map +1 -1
- package/dist/astro/routes/api/search/stats.mjs +8 -8
- package/dist/astro/routes/api/search/suggest.mjs +12 -11
- package/dist/astro/routes/api/search/suggest.mjs.map +1 -1
- package/dist/astro/routes/api/sections/_slug_.mjs +12 -11
- package/dist/astro/routes/api/sections/_slug_.mjs.map +1 -1
- package/dist/astro/routes/api/sections/index.mjs +12 -11
- package/dist/astro/routes/api/sections/index.mjs.map +1 -1
- package/dist/astro/routes/api/settings/backups/archives/_name_.d.mts +9 -0
- package/dist/astro/routes/api/settings/backups/archives/_name_.d.mts.map +1 -0
- package/dist/astro/routes/api/settings/backups/archives/_name_.mjs +48 -0
- package/dist/astro/routes/api/settings/backups/archives/_name_.mjs.map +1 -0
- package/dist/astro/routes/api/settings/backups/archives/index.d.mts +8 -0
- package/dist/astro/routes/api/settings/backups/archives/index.d.mts.map +1 -0
- package/dist/astro/routes/api/settings/backups/archives/index.mjs +23 -0
- package/dist/astro/routes/api/settings/backups/archives/index.mjs.map +1 -0
- package/dist/astro/routes/api/settings/backups/export.d.mts +8 -0
- package/dist/astro/routes/api/settings/backups/export.d.mts.map +1 -0
- package/dist/astro/routes/api/settings/backups/export.mjs +35 -0
- package/dist/astro/routes/api/settings/backups/export.mjs.map +1 -0
- package/dist/astro/routes/api/settings/backups/index.d.mts +9 -0
- package/dist/astro/routes/api/settings/backups/index.d.mts.map +1 -0
- package/dist/astro/routes/api/settings/backups/index.mjs +52 -0
- package/dist/astro/routes/api/settings/backups/index.mjs.map +1 -0
- package/dist/astro/routes/api/settings/email.mjs +5 -5
- package/dist/astro/routes/api/settings.mjs +14 -13
- package/dist/astro/routes/api/settings.mjs.map +1 -1
- package/dist/astro/routes/api/setup/admin-verify.mjs +19 -15
- package/dist/astro/routes/api/setup/admin-verify.mjs.map +1 -1
- package/dist/astro/routes/api/setup/admin.mjs +18 -14
- package/dist/astro/routes/api/setup/admin.mjs.map +1 -1
- package/dist/astro/routes/api/setup/dev-bypass.mjs +26 -26
- package/dist/astro/routes/api/setup/dev-reset.mjs +3 -3
- package/dist/astro/routes/api/setup/index.mjs +28 -27
- package/dist/astro/routes/api/setup/index.mjs.map +1 -1
- package/dist/astro/routes/api/setup/status.mjs +5 -5
- package/dist/astro/routes/api/snapshot.mjs +8 -215
- package/dist/astro/routes/api/snapshot.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +14 -13
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +14 -13
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +14 -13
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/index.mjs +14 -13
- package/dist/astro/routes/api/taxonomies/index.mjs.map +1 -1
- package/dist/astro/routes/api/themes/preview.mjs +6 -6
- package/dist/astro/routes/api/typegen.mjs +6 -6
- package/dist/astro/routes/api/well-known/auth.mjs +1 -1
- package/dist/astro/routes/api/well-known/oauth-authorization-server.d.mts.map +1 -1
- package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +4 -3
- package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs.map +1 -1
- package/dist/astro/routes/api/well-known/oauth-protected-resource.d.mts.map +1 -1
- package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +4 -3
- package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs.map +1 -1
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +9 -8
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +12 -11
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +12 -11
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs.map +1 -1
- package/dist/astro/routes/api/widget-areas/_name_.mjs +7 -7
- package/dist/astro/routes/api/widget-areas/index.mjs +12 -11
- package/dist/astro/routes/api/widget-areas/index.mjs.map +1 -1
- package/dist/astro/routes/api/widget-components.mjs +4 -4
- package/dist/astro/routes/robots.txt.mjs +7 -7
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +9 -9
- package/dist/astro/routes/sitemap.xml.mjs +8 -8
- package/dist/astro/types.d.mts +38 -17
- package/dist/astro/types.d.mts.map +1 -1
- package/dist/auth/providers/github.d.mts +1 -1
- package/dist/auth/providers/google.d.mts +1 -1
- package/dist/{authorize-BmCwQCib.mjs → authorize-WxsiePzy.mjs} +7 -4
- package/dist/authorize-WxsiePzy.mjs.map +1 -0
- package/dist/backup-S8kFWtwD.mjs +241 -0
- package/dist/backup-S8kFWtwD.mjs.map +1 -0
- package/dist/{base64-C74Msx8h.mjs → base64-B-PsqheR.mjs} +8 -4
- package/dist/base64-B-PsqheR.mjs.map +1 -0
- package/dist/{byline-BWb5H-65.mjs → byline-XEjchwzZ.mjs} +6 -6
- package/dist/{byline-BWb5H-65.mjs.map → byline-XEjchwzZ.mjs.map} +1 -1
- package/dist/{byline-fields-DO6bAYK8.mjs → byline-fields-CdU_LTF1.mjs} +1 -1
- package/dist/{byline-fields-DO6bAYK8.mjs.map → byline-fields-CdU_LTF1.mjs.map} +1 -1
- package/dist/{bylines-BGuKFaBy.mjs → bylines-BJbT4gKS.mjs} +4 -4
- package/dist/{bylines-BGuKFaBy.mjs.map → bylines-BJbT4gKS.mjs.map} +1 -1
- package/dist/{bylines-CHojDMpj.mjs → bylines-czseViYo.mjs} +6 -6
- package/dist/{bylines-CHojDMpj.mjs.map → bylines-czseViYo.mjs.map} +1 -1
- package/dist/{cache-BeR7RfN8.mjs → cache-CGCd6AVM.mjs} +2 -2
- package/dist/{cache-BeR7RfN8.mjs.map → cache-CGCd6AVM.mjs.map} +1 -1
- package/dist/{challenge-store-B426wQ6O.mjs → challenge-store-BFzgFRog.mjs} +1 -1
- package/dist/{challenge-store-B426wQ6O.mjs.map → challenge-store-BFzgFRog.mjs.map} +1 -1
- package/dist/{chunks-BU5_nrAC.mjs → chunks-BxXyunY-.mjs} +2 -2
- package/dist/{chunks-BU5_nrAC.mjs.map → chunks-BxXyunY-.mjs.map} +1 -1
- package/dist/cli/index.mjs +138 -31
- package/dist/cli/index.mjs.map +1 -1
- package/dist/client/cf-access.d.mts +1 -1
- package/dist/client/index.d.mts +54 -3
- package/dist/client/index.d.mts.map +1 -1
- package/dist/client/index.mjs +16 -4
- package/dist/client/index.mjs.map +1 -1
- package/dist/{comment-SWh31kS0.mjs → comment-DPT0WKyd.mjs} +2 -2
- package/dist/{comment-SWh31kS0.mjs.map → comment-DPT0WKyd.mjs.map} +1 -1
- package/dist/{comment-reaction-DgcpziXI.mjs → comment-reaction-C65MldIB.mjs} +2 -2
- package/dist/{comment-reaction-DgcpziXI.mjs.map → comment-reaction-C65MldIB.mjs.map} +1 -1
- package/dist/{comments-kZYGppMS.mjs → comments-Bz6sCbgD.mjs} +3 -3
- package/dist/{comments-kZYGppMS.mjs.map → comments-Bz6sCbgD.mjs.map} +1 -1
- package/dist/{components-CliOkZAs.mjs → components-DZkL4Fx0.mjs} +1 -1
- package/dist/{components-CliOkZAs.mjs.map → components-DZkL4Fx0.mjs.map} +1 -1
- package/dist/{content-BO61Sx4j.mjs → content-Ci04z2z-.mjs} +53 -19
- package/dist/content-Ci04z2z-.mjs.map +1 -0
- package/dist/{content-refresh-BkkApzeS.mjs → content-refresh-D4khvC0R.mjs} +95 -3
- package/dist/content-refresh-D4khvC0R.mjs.map +1 -0
- package/dist/{context-DtSFYFuS.mjs → context-B6hc7zJL.mjs} +97 -74
- package/dist/context-B6hc7zJL.mjs.map +1 -0
- package/dist/{cron-YFJ7uNVA.mjs → cron-BlKIMD_e.mjs} +1 -1
- package/dist/{cron-YFJ7uNVA.mjs.map → cron-BlKIMD_e.mjs.map} +1 -1
- package/dist/{dashboard-xo_gPs_D.mjs → dashboard-C5NkXFbi.mjs} +4 -4
- package/dist/{dashboard-xo_gPs_D.mjs.map → dashboard-C5NkXFbi.mjs.map} +1 -1
- package/dist/db/index.d.mts +3 -3
- package/dist/db/index.mjs +2 -2
- package/dist/db/index.mjs.map +1 -1
- package/dist/db/libsql.d.mts +1 -1
- package/dist/db/postgres.d.mts +1 -1
- package/dist/db/sqlite.d.mts +1 -1
- package/dist/{db-errors-BKuXh_fi.mjs → db-errors-CcWLaRiR.mjs} +4 -2
- package/dist/db-errors-CcWLaRiR.mjs.map +1 -0
- package/dist/{default-DY5ovGUG.mjs → default-C4v9KP56.mjs} +1 -1
- package/dist/{default-DY5ovGUG.mjs.map → default-C4v9KP56.mjs.map} +1 -1
- package/dist/{device-flow-CPXQ_QfW.mjs → device-flow-BeA6lUS1.mjs} +5 -6
- package/dist/device-flow-BeA6lUS1.mjs.map +1 -0
- package/dist/{dialect-helpers-Cue7QQOR.mjs → dialect-helpers-HxEQGl_1.mjs} +57 -11
- package/dist/{dialect-helpers-Cue7QQOR.mjs.map → dialect-helpers-HxEQGl_1.mjs.map} +1 -1
- package/dist/{email-console-CjkQc7oY.mjs → email-console-C-9Ng8DM.mjs} +1 -1
- package/dist/{email-console-CjkQc7oY.mjs.map → email-console-C-9Ng8DM.mjs.map} +1 -1
- package/dist/error-CEGF6UZb.mjs +90 -0
- package/dist/error-CEGF6UZb.mjs.map +1 -0
- package/dist/{error-CfJMLSkd.mjs → errors-DtEXIQQV.mjs} +15 -84
- package/dist/errors-DtEXIQQV.mjs.map +1 -0
- package/dist/{escape-r8_GbEU2.mjs → escape-CFedIB1C.mjs} +1 -1
- package/dist/{escape-r8_GbEU2.mjs.map → escape-CFedIB1C.mjs.map} +1 -1
- package/dist/{field-defs-cache-BVrNCgSj.mjs → field-defs-cache-DvmlgP-D.mjs} +2 -2
- package/dist/{field-defs-cache-BVrNCgSj.mjs.map → field-defs-cache-DvmlgP-D.mjs.map} +1 -1
- package/dist/{fts-manager-BD9s77qh.mjs → fts-manager-DzqIBrrW.mjs} +3 -3
- package/dist/{fts-manager-BD9s77qh.mjs.map → fts-manager-DzqIBrrW.mjs.map} +1 -1
- package/dist/{hreflang-CgIxhH4k.d.mts → hreflang-CIxH_LKz.d.mts} +2 -2
- package/dist/{hreflang-CgIxhH4k.d.mts.map → hreflang-CIxH_LKz.d.mts.map} +1 -1
- package/dist/{hreflang-pAWUiPd_.mjs → hreflang-db2Tpb2o.mjs} +5 -5
- package/dist/{hreflang-pAWUiPd_.mjs.map → hreflang-db2Tpb2o.mjs.map} +1 -1
- package/dist/{import-2jHtLzsO.mjs → import-Dmkm8S1W.mjs} +4 -4
- package/dist/{import-2jHtLzsO.mjs.map → import-Dmkm8S1W.mjs.map} +1 -1
- package/dist/{index-DxjWLKGT.d.mts → index-BEui-cRd.d.mts} +3 -3
- package/dist/{index-DxjWLKGT.d.mts.map → index-BEui-cRd.d.mts.map} +1 -1
- package/dist/{index-BXOCyLj0.d.mts → index-wYnC6u4o.d.mts} +780 -15
- package/dist/index-wYnC6u4o.d.mts.map +1 -0
- package/dist/index.d.mts +18 -19
- package/dist/index.mjs +59 -58
- package/dist/{load-DgoWMdRX.mjs → load-Cx27ki1l.mjs} +2 -2
- package/dist/{load-DgoWMdRX.mjs.map → load-Cx27ki1l.mjs.map} +1 -1
- package/dist/{loader-Rb8QlGZp.mjs → loader-Be3ouI5L.mjs} +170 -6
- package/dist/loader-Be3ouI5L.mjs.map +1 -0
- package/dist/{manifest-schema-DeGNma2O.mjs → manifest-schema-bCq54i7F.mjs} +16 -2
- package/dist/manifest-schema-bCq54i7F.mjs.map +1 -0
- package/dist/media/image-endpoint.d.mts +30 -2
- package/dist/media/image-endpoint.d.mts.map +1 -1
- package/dist/media/image-endpoint.mjs +29 -3
- package/dist/media/image-endpoint.mjs.map +1 -1
- package/dist/media/index.d.mts +1 -1
- package/dist/media/local-runtime.d.mts +12 -13
- package/dist/media/local-runtime.d.mts.map +1 -1
- package/dist/media/local-runtime.mjs +6 -6
- package/dist/{media-D2ZFowpn.mjs → media-BjhhENaJ.mjs} +2 -2
- package/dist/{media-D2ZFowpn.mjs.map → media-BjhhENaJ.mjs.map} +1 -1
- package/dist/{media-allowlist-Dc05vKtt.mjs → media-allowlist-jUppPWFy.mjs} +1 -1
- package/dist/{media-allowlist-Dc05vKtt.mjs.map → media-allowlist-jUppPWFy.mjs.map} +1 -1
- package/dist/media-kIV1IxFf.mjs +243 -0
- package/dist/media-kIV1IxFf.mjs.map +1 -0
- package/dist/media-upload-D2wk3EIt.mjs +145 -0
- package/dist/media-upload-D2wk3EIt.mjs.map +1 -0
- package/dist/{media-url-DgIEYZr4.mjs → media-url-BCm5vBn6.mjs} +1 -1
- package/dist/{media-url-DgIEYZr4.mjs.map → media-url-BCm5vBn6.mjs.map} +1 -1
- package/dist/{media-usage-B__v9NMm.mjs → media-usage-CljdO1mc.mjs} +138 -5
- package/dist/{media-usage-B__v9NMm.mjs.map → media-usage-CljdO1mc.mjs.map} +1 -1
- package/dist/{menus-BtvH7Z7t.mjs → menus-BcyElFtI.mjs} +155 -12
- package/dist/menus-BcyElFtI.mjs.map +1 -0
- package/dist/{menus-BpfevlJD.mjs → menus-CZyG6rvx.mjs} +2 -2
- package/dist/{menus-BpfevlJD.mjs.map → menus-CZyG6rvx.mjs.map} +1 -1
- package/dist/{mode-BVnhGZ2o.mjs → mode-fiXRMfeA.mjs} +1 -1
- package/dist/{mode-BVnhGZ2o.mjs.map → mode-fiXRMfeA.mjs.map} +1 -1
- package/dist/{oauth-authorization-BWqWTHBK.mjs → oauth-authorization-oqfbBuMH.mjs} +5 -6
- package/dist/oauth-authorization-oqfbBuMH.mjs.map +1 -0
- package/dist/{oauth-clients-43_XADoa.mjs → oauth-clients-BlrUHAsf.mjs} +1 -1
- package/dist/{oauth-clients-43_XADoa.mjs.map → oauth-clients-BlrUHAsf.mjs.map} +1 -1
- package/dist/{oauth-state-store-BRSUEkmx.mjs → oauth-state-store-DnvjRMy6.mjs} +2 -1
- package/dist/{oauth-state-store-BRSUEkmx.mjs.map → oauth-state-store-DnvjRMy6.mjs.map} +1 -1
- package/dist/{oauth-user-lookup-Ctgemb0k.mjs → oauth-user-lookup-oUllxvAv.mjs} +1 -1
- package/dist/{oauth-user-lookup-Ctgemb0k.mjs.map → oauth-user-lookup-oUllxvAv.mjs.map} +1 -1
- package/dist/object-cache/memory.d.mts +1 -1
- package/dist/{options-COXGTtqd.d.mts → options-BqMkWfYa.d.mts} +6 -6
- package/dist/{options-COXGTtqd.d.mts.map → options-BqMkWfYa.d.mts.map} +1 -1
- package/dist/page/index.d.mts +2 -2
- package/dist/page/index.d.mts.map +1 -1
- package/dist/page/index.mjs.map +1 -1
- package/dist/{parse-GLksnn-B.mjs → parse-C_-6klII.mjs} +4 -12
- package/dist/{parse-GLksnn-B.mjs.map → parse-C_-6klII.mjs.map} +1 -1
- package/dist/{passkey-config-CjA1UbDj.mjs → passkey-config-C-SKpc0-.mjs} +1 -1
- package/dist/{passkey-config-CjA1UbDj.mjs.map → passkey-config-C-SKpc0-.mjs.map} +1 -1
- package/dist/{placeholder-DR-eeZr-.d.mts → placeholder-Dop47JMM.d.mts} +1 -1
- package/dist/{placeholder-DR-eeZr-.d.mts.map → placeholder-Dop47JMM.d.mts.map} +1 -1
- package/dist/plugin-types.d.mts +21 -2
- package/dist/plugin-types.d.mts.map +1 -1
- package/dist/plugin-utils.d.mts +18 -17
- package/dist/plugin-utils.d.mts.map +1 -1
- package/dist/plugin-utils.mjs +8 -6
- package/dist/plugin-utils.mjs.map +1 -1
- package/dist/plugins/adapt-sandbox-entry.d.mts +10 -11
- package/dist/plugins/adapt-sandbox-entry.d.mts.map +1 -1
- package/dist/plugins/adapt-sandbox-entry.mjs +15 -3
- package/dist/plugins/adapt-sandbox-entry.mjs.map +1 -1
- package/dist/{portable-text-BAkgEKcv.mjs → portable-text-sDj92Kxv.mjs} +1 -1
- package/dist/{portable-text-BAkgEKcv.mjs.map → portable-text-sDj92Kxv.mjs.map} +1 -1
- package/dist/{preview-Rloa09Wp.mjs → preview-D4Jnbfx7.mjs} +2 -2
- package/dist/{preview-Rloa09Wp.mjs.map → preview-D4Jnbfx7.mjs.map} +1 -1
- package/dist/{public-url-C0cEvrRu.mjs → public-url-DSGTnJFw.mjs} +5 -3
- package/dist/public-url-DSGTnJFw.mjs.map +1 -0
- package/dist/{query-ZzvXyxWq.mjs → query-DR73ZNfm.mjs} +14 -14
- package/dist/{query-ZzvXyxWq.mjs.map → query-DR73ZNfm.mjs.map} +1 -1
- package/dist/{query-BxT95opY.mjs → query-Di7DOmPV.mjs} +3 -3
- package/dist/{query-BxT95opY.mjs.map → query-Di7DOmPV.mjs.map} +1 -1
- package/dist/{rate-limit-Cg4Rvc_-.mjs → rate-limit-CMj83JNW.mjs} +2 -2
- package/dist/{rate-limit-Cg4Rvc_-.mjs.map → rate-limit-CMj83JNW.mjs.map} +1 -1
- package/dist/{redirect-Ce_6Yb6z.mjs → redirect-Botom7X6.mjs} +1 -1
- package/dist/{redirect-Ce_6Yb6z.mjs.map → redirect-Botom7X6.mjs.map} +1 -1
- package/dist/{redirect-Ch3E98qZ.mjs → redirect-CgLPYflR.mjs} +10 -4
- package/dist/redirect-CgLPYflR.mjs.map +1 -0
- package/dist/{redirects-CXmVGRNZ.mjs → redirects-B7t9bKsL.mjs} +4 -4
- package/dist/{redirects-CXmVGRNZ.mjs.map → redirects-B7t9bKsL.mjs.map} +1 -1
- package/dist/{redirects-CeD7K7EX.mjs → redirects-BBq3n2Rj.mjs} +4 -175
- package/dist/redirects-BBq3n2Rj.mjs.map +1 -0
- package/dist/{registry-CyIXPi4E.mjs → registry-FV15nLge.mjs} +97 -8
- package/dist/registry-FV15nLge.mjs.map +1 -0
- package/dist/{relation-Ba68Tm4Z.mjs → relation-9M9j_UWo.mjs} +3 -3
- package/dist/{relation-Ba68Tm4Z.mjs.map → relation-9M9j_UWo.mjs.map} +1 -1
- package/dist/{relations-BmBmX4Eb.mjs → relations-5_avdrN_.mjs} +2 -2
- package/dist/{relations-BmBmX4Eb.mjs.map → relations-5_avdrN_.mjs.map} +1 -1
- package/dist/{relations-C8hVyEy0.mjs → relations-BKvO39-9.mjs} +5 -5
- package/dist/{relations-C8hVyEy0.mjs.map → relations-BKvO39-9.mjs.map} +1 -1
- package/dist/{relations-CbBpoOys.d.mts → relations-Bh8jlFsU.d.mts} +306 -4
- package/dist/relations-Bh8jlFsU.d.mts.map +1 -0
- package/dist/{request-meta-DCwktC5P.mjs → request-meta-DzXYYI-n.mjs} +2 -2
- package/dist/{request-meta-DCwktC5P.mjs.map → request-meta-DzXYYI-n.mjs.map} +1 -1
- package/dist/{runner-CiNdIk3y.d.mts → runner-Dd8m8k9F.d.mts} +2 -2
- package/dist/{runner-CiNdIk3y.d.mts.map → runner-Dd8m8k9F.d.mts.map} +1 -1
- package/dist/{runner-jt65bF7F.mjs → runner-DfnZ5eUr.mjs} +333 -199
- package/dist/runner-DfnZ5eUr.mjs.map +1 -0
- package/dist/runtime.d.mts +11 -12
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +4 -4
- package/dist/{schema-DwjufZ1S.mjs → schema-BXxlHeAf.mjs} +3 -3
- package/dist/{schema-DwjufZ1S.mjs.map → schema-BXxlHeAf.mjs.map} +1 -1
- package/dist/scopes-Bl4IwHA-.mjs +27 -0
- package/dist/scopes-Bl4IwHA-.mjs.map +1 -0
- package/dist/{search-Cl875CVE.mjs → search-Bff-7jFt.mjs} +5 -5
- package/dist/{search-Cl875CVE.mjs.map → search-Bff-7jFt.mjs.map} +1 -1
- package/dist/{secrets-CO_bEmII.mjs → secrets-CSwQIl4q.mjs} +3 -3
- package/dist/{secrets-CO_bEmII.mjs.map → secrets-CSwQIl4q.mjs.map} +1 -1
- package/dist/{sections-DTKzgoiS.mjs → sections-CwW4s1al.mjs} +3 -3
- package/dist/{sections-DTKzgoiS.mjs.map → sections-CwW4s1al.mjs.map} +1 -1
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +20 -20
- package/dist/seo/index.d.mts +14 -3
- package/dist/seo/index.d.mts.map +1 -1
- package/dist/seo/index.mjs +16 -16
- package/dist/seo/index.mjs.map +1 -1
- package/dist/{seo-BLm6SXzS.mjs → seo-2cmFHZns.mjs} +2 -2
- package/dist/{seo-BLm6SXzS.mjs.map → seo-2cmFHZns.mjs.map} +1 -1
- package/dist/{seo-BjrbXAd_.mjs → seo-C3GDfT0V.mjs} +1 -1
- package/dist/{seo-BjrbXAd_.mjs.map → seo-C3GDfT0V.mjs.map} +1 -1
- package/dist/{service-D6zDmKXy.mjs → service-DkGTWGIi.mjs} +3 -3
- package/dist/{service-D6zDmKXy.mjs.map → service-DkGTWGIi.mjs.map} +1 -1
- package/dist/{session-user-DoSs6YM8.mjs → session-user-DbHqKDKe.mjs} +1 -1
- package/dist/{session-user-DoSs6YM8.mjs.map → session-user-DbHqKDKe.mjs.map} +1 -1
- package/dist/{settings-CmS3TwXf.mjs → settings-C4s8hFQm.mjs} +3 -3
- package/dist/{settings-CmS3TwXf.mjs.map → settings-C4s8hFQm.mjs.map} +1 -1
- package/dist/{settings-BuQYvLfy.mjs → settings-CpA4lQFt.mjs} +4 -4
- package/dist/{settings-BuQYvLfy.mjs.map → settings-CpA4lQFt.mjs.map} +1 -1
- package/dist/{setup-complete-BPNgLHlU.mjs → setup-complete-CdIlqloh.mjs} +1 -1
- package/dist/{setup-complete-BPNgLHlU.mjs.map → setup-complete-CdIlqloh.mjs.map} +1 -1
- package/dist/{setup-nonce-DEPZX96T.mjs → setup-nonce-DqiIPr-J.mjs} +1 -1
- package/dist/{setup-nonce-DEPZX96T.mjs.map → setup-nonce-DqiIPr-J.mjs.map} +1 -1
- package/dist/{single-flight-cache-DEtW-OEG.mjs → single-flight-cache-C2exrGAi.mjs} +1 -1
- package/dist/{single-flight-cache-DEtW-OEG.mjs.map → single-flight-cache-C2exrGAi.mjs.map} +1 -1
- package/dist/{site-url-CcLy5D5s.mjs → site-url-NGJT6NTU.mjs} +1 -1
- package/dist/{site-url-CcLy5D5s.mjs.map → site-url-NGJT6NTU.mjs.map} +1 -1
- package/dist/snapshot-BdpUJKD-.mjs +216 -0
- package/dist/snapshot-BdpUJKD-.mjs.map +1 -0
- package/dist/{ssrf-TrKYJAy0.mjs → ssrf-CviKqWmq.mjs} +1 -1
- package/dist/{ssrf-TrKYJAy0.mjs.map → ssrf-CviKqWmq.mjs.map} +1 -1
- package/dist/state-xxv6ZTMv.mjs +128 -0
- package/dist/state-xxv6ZTMv.mjs.map +1 -0
- package/dist/{status-D3Gy1Zc6.mjs → status-COfycGIU.mjs} +1 -1
- package/dist/{status-D3Gy1Zc6.mjs.map → status-COfycGIU.mjs.map} +1 -1
- package/dist/storage/local.d.mts +1 -1
- package/dist/storage/local.mjs +1 -1
- package/dist/storage/s3.d.mts +1 -1
- package/dist/storage/s3.mjs +1 -1
- package/dist/{taxonomies-ClS4RKaZ.mjs → taxonomies-Ce49uIzY.mjs} +4 -4
- package/dist/{taxonomies-ClS4RKaZ.mjs.map → taxonomies-Ce49uIzY.mjs.map} +1 -1
- package/dist/{taxonomies-pUkuD6nj.mjs → taxonomies-DjSKBZpq.mjs} +7 -7
- package/dist/{taxonomies-pUkuD6nj.mjs.map → taxonomies-DjSKBZpq.mjs.map} +1 -1
- package/dist/{taxonomy-BkxbUMSw.mjs → taxonomy-DfVooU4W.mjs} +51 -13
- package/dist/taxonomy-DfVooU4W.mjs.map +1 -0
- package/dist/{tokens-BV6fgl5A.mjs → tokens-DVltpO2D.mjs} +2 -2
- package/dist/{tokens-BV6fgl5A.mjs.map → tokens-DVltpO2D.mjs.map} +1 -1
- package/dist/{transport-DTFhhPOg.mjs → transport-CKrlqSpD.mjs} +1 -1
- package/dist/{transport-DTFhhPOg.mjs.map → transport-CKrlqSpD.mjs.map} +1 -1
- package/dist/{transport-DmlmzD2U.d.mts → transport-Vd7VdqHv.d.mts} +1 -1
- package/dist/{transport-DmlmzD2U.d.mts.map → transport-Vd7VdqHv.d.mts.map} +1 -1
- package/dist/{trusted-proxy-CSgZVESw.mjs → trusted-proxy-CwjQj0YG.mjs} +1 -1
- package/dist/{trusted-proxy-CSgZVESw.mjs.map → trusted-proxy-CwjQj0YG.mjs.map} +1 -1
- package/dist/{types-B6-N9cBB.d.mts → types-B4vm81VH.d.mts} +1 -1
- package/dist/{types-B6-N9cBB.d.mts.map → types-B4vm81VH.d.mts.map} +1 -1
- package/dist/{types-Cm4Cz-8M.d.mts → types-B97jg3aW.d.mts} +6 -1
- package/dist/{types-Cm4Cz-8M.d.mts.map → types-B97jg3aW.d.mts.map} +1 -1
- package/dist/{types-BNZsPL9z.mjs → types-BD40g7zz.mjs} +1 -1
- package/dist/{types-BNZsPL9z.mjs.map → types-BD40g7zz.mjs.map} +1 -1
- package/dist/{types-QnlQIyPE.d.mts → types-BNfPHfay.d.mts} +1 -1
- package/dist/{types-QnlQIyPE.d.mts.map → types-BNfPHfay.d.mts.map} +1 -1
- package/dist/{types-DLIrNtv5.d.mts → types-BfYUPJdP.d.mts} +2 -2
- package/dist/{types-DLIrNtv5.d.mts.map → types-BfYUPJdP.d.mts.map} +1 -1
- package/dist/{types-CtDVagM4.d.mts → types-BvB7gDOD.d.mts} +38 -4
- package/dist/types-BvB7gDOD.d.mts.map +1 -0
- package/dist/{types-B_pmP7Yq.d.mts → types-C7U0HlEr.d.mts} +1 -1
- package/dist/{types-B_pmP7Yq.d.mts.map → types-C7U0HlEr.d.mts.map} +1 -1
- package/dist/{types-Ch8pFMEm.mjs → types-D1iJ3DpO.mjs} +3 -3
- package/dist/{types-Ch8pFMEm.mjs.map → types-D1iJ3DpO.mjs.map} +1 -1
- package/dist/{types-momGysZk.d.mts → types-DPKhI5ib.d.mts} +9 -1
- package/dist/types-DPKhI5ib.d.mts.map +1 -0
- package/dist/{types-BCVuUPrL.d.mts → types-Kmaxdarz.d.mts} +1 -1
- package/dist/{types-BCVuUPrL.d.mts.map → types-Kmaxdarz.d.mts.map} +1 -1
- package/dist/{types-qljd1hsL.d.mts → types-iVeZ5g6N.d.mts} +1 -1
- package/dist/{types-qljd1hsL.d.mts.map → types-iVeZ5g6N.d.mts.map} +1 -1
- package/dist/{user-DTxX_Fha.mjs → user-Bh-L1qo6.mjs} +3 -3
- package/dist/{user-DTxX_Fha.mjs.map → user-Bh-L1qo6.mjs.map} +1 -1
- package/dist/{utils-Cz8PVrl4.mjs → utils-BbUgmeZG.mjs} +1 -1
- package/dist/{utils-Cz8PVrl4.mjs.map → utils-BbUgmeZG.mjs.map} +1 -1
- package/dist/{validate-9jLuE301.d.mts → validate-DULfgpJP.d.mts} +5 -5
- package/dist/{validate-9jLuE301.d.mts.map → validate-DULfgpJP.d.mts.map} +1 -1
- package/dist/{validate-C3CpWlNt.mjs → validate-V9nCwq_-.mjs} +2 -2
- package/dist/{validate-C3CpWlNt.mjs.map → validate-V9nCwq_-.mjs.map} +1 -1
- package/dist/{validation-DM2K_NJC.mjs → validation-BsVUJfsP.mjs} +10 -10
- package/dist/{validation-DM2K_NJC.mjs.map → validation-BsVUJfsP.mjs.map} +1 -1
- package/dist/version-907opKac.mjs +7 -0
- package/dist/{version-BlIJvNAZ.mjs.map → version-907opKac.mjs.map} +1 -1
- package/dist/{widgets-B_X6_UXJ.mjs → widgets-DGv1Z04V.mjs} +3 -3
- package/dist/{widgets-B_X6_UXJ.mjs.map → widgets-DGv1Z04V.mjs.map} +1 -1
- package/dist/{wxr-taxonomies-tADW4KTa.d.mts → wxr-taxonomies-B4tMuN5T.d.mts} +1 -1
- package/dist/{wxr-taxonomies-tADW4KTa.d.mts.map → wxr-taxonomies-B4tMuN5T.d.mts.map} +1 -1
- package/dist/{wxr-taxonomies-oNJB2S81.mjs → wxr-taxonomies-Cs1N6O8z.mjs} +3 -3
- package/dist/{wxr-taxonomies-oNJB2S81.mjs.map → wxr-taxonomies-Cs1N6O8z.mjs.map} +1 -1
- package/dist/{zod-generator-CrfV79De.mjs → zod-generator-B5prQ5M4.mjs} +2 -2
- package/dist/{zod-generator-CrfV79De.mjs.map → zod-generator-B5prQ5M4.mjs.map} +1 -1
- package/package.json +8 -8
- package/src/api/authorize.ts +10 -1
- package/src/api/error.ts +5 -5
- package/src/api/errors.ts +14 -0
- package/src/api/handlers/backup.ts +312 -0
- package/src/api/handlers/content.ts +36 -2
- package/src/api/handlers/device-flow.ts +2 -3
- package/src/api/handlers/index.ts +16 -0
- package/src/api/handlers/marketplace.ts +38 -0
- package/src/api/handlers/media-upload.ts +210 -0
- package/src/api/handlers/media-usage.ts +211 -2
- package/src/api/handlers/oauth-authorization.ts +2 -6
- package/src/api/handlers/plugin-settings.ts +218 -0
- package/src/api/handlers/plugins.ts +41 -0
- package/src/api/handlers/registry.ts +39 -0
- package/src/api/handlers/snapshot.ts +21 -3
- package/src/api/openapi/document.ts +48 -6
- package/src/api/parse.ts +1 -15
- package/src/api/public-url.ts +4 -2
- package/src/api/schemas/common.ts +6 -2
- package/src/api/schemas/media-usage.ts +72 -0
- package/src/api/schemas/media.ts +32 -1
- package/src/astro/integration/index.ts +38 -0
- package/src/astro/integration/routes.ts +35 -0
- package/src/astro/integration/runtime.ts +6 -0
- package/src/astro/integration/virtual-modules.ts +41 -7
- package/src/astro/integration/vite-config.ts +17 -1
- package/src/astro/middleware/auth.ts +70 -78
- package/src/astro/middleware/csp.ts +5 -2
- package/src/astro/middleware.ts +86 -31
- package/src/astro/public-plugin-api-routes.ts +2 -1
- package/src/astro/routes/PluginRegistry.tsx +5 -2
- package/src/astro/routes/admin.astro +56 -16
- package/src/astro/routes/api/admin/api-tokens/index.ts +2 -2
- package/src/astro/routes/api/admin/bylines/[id]/translations.ts +2 -5
- package/src/astro/routes/api/admin/plugins/[id]/index.ts +6 -0
- package/src/astro/routes/api/admin/plugins/[id]/mcp.ts +42 -0
- package/src/astro/routes/api/admin/plugins/[id]/settings.ts +80 -0
- package/src/astro/routes/api/admin/plugins/[id]/update.ts +2 -0
- package/src/astro/routes/api/admin/plugins/index.ts +9 -0
- package/src/astro/routes/api/admin/plugins/marketplace/[id]/install.ts +2 -0
- package/src/astro/routes/api/admin/plugins/registry/[id]/update.ts +2 -0
- package/src/astro/routes/api/admin/plugins/registry/install.ts +2 -0
- package/src/astro/routes/api/admin/plugins/updates.ts +2 -4
- package/src/astro/routes/api/auth/mode.ts +6 -14
- package/src/astro/routes/api/auth/oauth/[provider]/callback.ts +21 -4
- package/src/astro/routes/api/auth/oauth/[provider].ts +24 -6
- package/src/astro/routes/api/content/[collection]/[id]/compare.ts +3 -4
- package/src/astro/routes/api/content/[collection]/[id]/duplicate.ts +2 -3
- package/src/astro/routes/api/content/[collection]/[id]/permanent.ts +2 -3
- package/src/astro/routes/api/content/[collection]/[id]/preview-url.ts +3 -4
- package/src/astro/routes/api/content/[collection]/[id]/references/[relation]/children.ts +4 -6
- package/src/astro/routes/api/content/[collection]/[id]/references/[relation]/parents.ts +2 -3
- package/src/astro/routes/api/content/[collection]/[id]/revisions.ts +3 -4
- package/src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts +4 -6
- package/src/astro/routes/api/content/[collection]/[id]/translations.ts +3 -4
- package/src/astro/routes/api/content/[collection]/[id].ts +3 -4
- package/src/astro/routes/api/content/[collection]/authors.ts +2 -3
- package/src/astro/routes/api/content/[collection]/index.ts +6 -8
- package/src/astro/routes/api/content/[collection]/trash.ts +2 -3
- package/src/astro/routes/api/manifest.ts +2 -9
- package/src/astro/routes/api/mcp.ts +2 -1
- package/src/astro/routes/api/media/[id]/usage.ts +30 -0
- package/src/astro/routes/api/media/[id].ts +17 -6
- package/src/astro/routes/api/media/file/[...key].ts +8 -0
- package/src/astro/routes/api/media.ts +21 -2
- package/src/astro/routes/api/oauth/authorize.ts +2 -6
- package/src/astro/routes/api/plugins/[pluginId]/[...path].ts +17 -3
- package/src/astro/routes/api/settings/backups/archives/[name].ts +78 -0
- package/src/astro/routes/api/settings/backups/archives/index.ts +33 -0
- package/src/astro/routes/api/settings/backups/export.ts +43 -0
- package/src/astro/routes/api/settings/backups/index.ts +76 -0
- package/src/astro/routes/api/setup/admin-verify.ts +8 -4
- package/src/astro/routes/api/setup/admin.ts +11 -4
- package/src/astro/routes/api/well-known/oauth-authorization-server.ts +4 -1
- package/src/astro/routes/api/well-known/oauth-protected-resource.ts +5 -1
- package/src/astro/types.ts +48 -2
- package/src/auth/api-tokens.ts +1 -0
- package/src/auth/oauth-state-store.ts +3 -0
- package/src/auth/providers/github-admin.tsx +5 -6
- package/src/auth/providers/google-admin.tsx +5 -6
- package/src/auth/scopes.ts +3 -9
- package/src/cli/client-factory.ts +0 -1
- package/src/cli/commands/bundle-utils.ts +50 -1
- package/src/cli/commands/bundle.ts +9 -2
- package/src/cli/commands/media.ts +127 -0
- package/src/client/index.ts +84 -2
- package/src/client/transport.ts +1 -1
- package/src/components/EmDashHead.astro +4 -8
- package/src/components/InlinePortableTextEditor.tsx +56 -35
- package/src/components/marks/Link.astro +5 -1
- package/src/database/dialect-helpers.ts +77 -3
- package/src/database/migrations/051_content_taxonomies_denorm.ts +120 -0
- package/src/database/migrations/052_media_usage_read_index.ts +26 -0
- package/src/database/migrations/053_plugin_mcp_tools.ts +21 -0
- package/src/database/migrations/runner.ts +6 -0
- package/src/database/repositories/audit.ts +2 -1
- package/src/database/repositories/content.ts +98 -16
- package/src/database/repositories/media-usage.ts +250 -1
- package/src/database/repositories/plugin-storage.ts +29 -32
- package/src/database/repositories/redirect.ts +14 -2
- package/src/database/repositories/taxonomy.ts +57 -8
- package/src/database/types.ts +23 -0
- package/src/db/adapters.ts +9 -0
- package/src/emdash-runtime.ts +310 -66
- package/src/loader.ts +292 -1
- package/src/mcp/server.ts +222 -5
- package/src/media/image-endpoint.ts +38 -2
- package/src/page/metadata.ts +27 -0
- package/src/plugin-types.ts +19 -0
- package/src/plugin-utils.ts +8 -6
- package/src/plugins/adapt-sandbox-entry.ts +30 -1
- package/src/plugins/context.ts +7 -0
- package/src/plugins/define-plugin.ts +16 -0
- package/src/plugins/manifest-schema.ts +28 -1
- package/src/plugins/routes.ts +27 -1
- package/src/plugins/sandbox/runner-options.ts +16 -0
- package/src/plugins/sandbox/types.ts +6 -1
- package/src/plugins/state.ts +17 -1
- package/src/plugins/storage-query.ts +67 -33
- package/src/plugins/types.ts +41 -0
- package/src/schema/registry.ts +141 -5
- package/src/seed/apply.ts +28 -29
- package/src/seo/index.ts +19 -4
- package/src/storage/types.ts +6 -0
- package/src/utils/base64.ts +7 -2
- package/src/utils/db-errors.ts +3 -1
- package/src/virtual-modules.d.ts +13 -0
- package/src/visual-editing/toolbar.ts +1 -1
- package/dist/adapters-DPAkL6QF.d.mts.map +0 -1
- package/dist/api-DVbHNApo.mjs.map +0 -1
- package/dist/api-tokens-Dk2GrJMY.mjs +0 -3
- package/dist/apply-D23iUV4q.mjs.map +0 -1
- package/dist/authorize-BmCwQCib.mjs.map +0 -1
- package/dist/base64-C74Msx8h.mjs.map +0 -1
- package/dist/content-BO61Sx4j.mjs.map +0 -1
- package/dist/content-refresh-BkkApzeS.mjs.map +0 -1
- package/dist/context-DtSFYFuS.mjs.map +0 -1
- package/dist/db-errors-BKuXh_fi.mjs.map +0 -1
- package/dist/device-flow-CPXQ_QfW.mjs.map +0 -1
- package/dist/error-CfJMLSkd.mjs.map +0 -1
- package/dist/index-BXOCyLj0.d.mts.map +0 -1
- package/dist/loader-Rb8QlGZp.mjs.map +0 -1
- package/dist/manifest-schema-DeGNma2O.mjs.map +0 -1
- package/dist/menus-BtvH7Z7t.mjs.map +0 -1
- package/dist/oauth-authorization-BWqWTHBK.mjs.map +0 -1
- package/dist/public-url-C0cEvrRu.mjs.map +0 -1
- package/dist/redirect-Ch3E98qZ.mjs.map +0 -1
- package/dist/redirects-CeD7K7EX.mjs.map +0 -1
- package/dist/registry-CyIXPi4E.mjs.map +0 -1
- package/dist/relations-CbBpoOys.d.mts.map +0 -1
- package/dist/runner-jt65bF7F.mjs.map +0 -1
- package/dist/scheduled-publish-DlJHGcuL.d.mts +0 -11
- package/dist/scheduled-publish-DlJHGcuL.d.mts.map +0 -1
- package/dist/taxonomy-BkxbUMSw.mjs.map +0 -1
- package/dist/types-CtDVagM4.d.mts.map +0 -1
- package/dist/types-momGysZk.d.mts.map +0 -1
- package/dist/version-BlIJvNAZ.mjs +0 -7
- /package/dist/{ssrf-B5DOv5E5.mjs → ssrf-BB__xfNM.mjs} +0 -0
- /package/dist/{types-DeCZBZxn.mjs → types-CK0LxPUQ.mjs} +0 -0
|
@@ -13,8 +13,10 @@ import type { MediaProviderDescriptor } from "../../media/types.js";
|
|
|
13
13
|
import type { ObjectCacheDescriptor } from "../../object-cache/types.js";
|
|
14
14
|
import type {
|
|
15
15
|
FieldWidgetConfig,
|
|
16
|
+
PluginMcpManifestConfig,
|
|
16
17
|
PortableTextBlockConfig,
|
|
17
18
|
ResolvedPlugin,
|
|
19
|
+
SettingField,
|
|
18
20
|
} from "../../plugins/types.js";
|
|
19
21
|
import type { ExperimentalConfig } from "../../registry/types.js";
|
|
20
22
|
import type { StorageDescriptor } from "../storage/types.js";
|
|
@@ -103,6 +105,8 @@ export interface PluginDescriptor<TOptions = Record<string, unknown>> {
|
|
|
103
105
|
adminPages?: PluginAdminPage[];
|
|
104
106
|
/** Dashboard widgets */
|
|
105
107
|
adminWidgets?: PluginDashboardWidget[];
|
|
108
|
+
/** Settings schema for the auto-generated admin settings form */
|
|
109
|
+
settingsSchema?: Record<string, SettingField>;
|
|
106
110
|
/**
|
|
107
111
|
* Portable Text block types this plugin contributes to the editor.
|
|
108
112
|
* Declarative (Block Kit) — surfaced in the admin slash menu and consumed
|
|
@@ -131,6 +135,8 @@ export interface PluginDescriptor<TOptions = Record<string, unknown>> {
|
|
|
131
135
|
* Sandboxed plugins can only access declared collections.
|
|
132
136
|
*/
|
|
133
137
|
storage?: Record<string, StorageCollectionDeclaration>;
|
|
138
|
+
/** Serialized MCP declarations emitted by the plugin build. */
|
|
139
|
+
mcp?: PluginMcpManifestConfig;
|
|
134
140
|
}
|
|
135
141
|
|
|
136
142
|
/**
|
|
@@ -69,6 +69,9 @@ export const RESOLVED_VIRTUAL_WAIT_UNTIL_ID = "\0" + VIRTUAL_WAIT_UNTIL_ID;
|
|
|
69
69
|
export const VIRTUAL_SCHEDULER_ID = "virtual:emdash/scheduler";
|
|
70
70
|
export const RESOLVED_VIRTUAL_SCHEDULER_ID = "\0" + VIRTUAL_SCHEDULER_ID;
|
|
71
71
|
|
|
72
|
+
export const VIRTUAL_ENV_ID = "virtual:emdash/env";
|
|
73
|
+
export const RESOLVED_VIRTUAL_ENV_ID = "\0" + VIRTUAL_ENV_ID;
|
|
74
|
+
|
|
72
75
|
/**
|
|
73
76
|
* Generates the config virtual module.
|
|
74
77
|
*/
|
|
@@ -84,13 +87,18 @@ export function generateConfigModule(serializableConfig: Record<string, unknown>
|
|
|
84
87
|
* the generator re-exports it so middleware can ask for a per-request Kysely
|
|
85
88
|
* (used for D1 Sessions API, bookmark cookies, read-replica routing). Other
|
|
86
89
|
* adapters get a stub that returns null.
|
|
90
|
+
*
|
|
91
|
+
* Adapters independently opt into the cold-start coalescing dialect. Keeping
|
|
92
|
+
* this capability explicit prevents bundlers from probing exports that do not
|
|
93
|
+
* exist on SQLite, libSQL, PostgreSQL, or other adapters.
|
|
87
94
|
*/
|
|
88
95
|
export function generateDialectModule(opts: {
|
|
89
96
|
entrypoint?: string;
|
|
90
97
|
type?: string;
|
|
91
98
|
supportsRequestScope: boolean;
|
|
99
|
+
supportsCoalescing: boolean;
|
|
92
100
|
}): string {
|
|
93
|
-
const { entrypoint, supportsRequestScope } = opts;
|
|
101
|
+
const { entrypoint, supportsRequestScope, supportsCoalescing } = opts;
|
|
94
102
|
if (!entrypoint) {
|
|
95
103
|
return [
|
|
96
104
|
`export const createDialect = undefined;`,
|
|
@@ -101,16 +109,16 @@ export function generateDialectModule(opts: {
|
|
|
101
109
|
}
|
|
102
110
|
const type = opts.type ?? "sqlite";
|
|
103
111
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
export const createCoalescingDialect =
|
|
112
|
+
const coalescingExport = supportsCoalescing
|
|
113
|
+
? `import { createCoalescingDialect as _createCoalescingDialect } from "${entrypoint}";
|
|
114
|
+
export const createCoalescingDialect = _createCoalescingDialect;`
|
|
115
|
+
: `export const createCoalescingDialect = undefined;`;
|
|
108
116
|
|
|
109
117
|
if (supportsRequestScope) {
|
|
110
118
|
return `
|
|
111
119
|
import { createDialect as _createDialect } from "${entrypoint}";
|
|
112
120
|
export { createRequestScopedDb } from "${entrypoint}";
|
|
113
|
-
${
|
|
121
|
+
${coalescingExport}
|
|
114
122
|
export const createDialect = _createDialect;
|
|
115
123
|
export const dialectType = ${JSON.stringify(type)};
|
|
116
124
|
`;
|
|
@@ -118,7 +126,7 @@ export const dialectType = ${JSON.stringify(type)};
|
|
|
118
126
|
|
|
119
127
|
return `
|
|
120
128
|
import { createDialect as _createDialect } from "${entrypoint}";
|
|
121
|
-
${
|
|
129
|
+
${coalescingExport}
|
|
122
130
|
export const createDialect = _createDialect;
|
|
123
131
|
export const dialectType = ${JSON.stringify(type)};
|
|
124
132
|
export const createRequestScopedDb = (_opts) => null;
|
|
@@ -271,6 +279,7 @@ export function generatePluginsModule(descriptors: PluginDescriptor[]): string {
|
|
|
271
279
|
storage: descriptor.storage,
|
|
272
280
|
adminPages: descriptor.adminPages,
|
|
273
281
|
adminWidgets: descriptor.adminWidgets,
|
|
282
|
+
settingsSchema: descriptor.settingsSchema,
|
|
274
283
|
portableTextBlocks: descriptor.portableTextBlocks,
|
|
275
284
|
fieldWidgets: descriptor.fieldWidgets,
|
|
276
285
|
})})`,
|
|
@@ -469,6 +478,25 @@ export function generateWaitUntilModule(adapterName: string | undefined): string
|
|
|
469
478
|
return `export const waitUntil = undefined;`;
|
|
470
479
|
}
|
|
471
480
|
|
|
481
|
+
/**
|
|
482
|
+
* Generates the env virtual module.
|
|
483
|
+
*
|
|
484
|
+
* Under @astrojs/cloudflare, re-exports `env` from `cloudflare:workers` so
|
|
485
|
+
* routes can read Worker bindings/secrets without touching
|
|
486
|
+
* `Astro.locals.runtime.env`, which Astro 6+ removed (accessing it throws
|
|
487
|
+
* rather than returning undefined, so `locals.runtime?.env` optional-chaining
|
|
488
|
+
* doesn't help -- see #1736). For any other adapter, exports `undefined` so
|
|
489
|
+
* callers fall back to `import.meta.env`. Mirrors generateWaitUntilModule:
|
|
490
|
+
* core stays adapter-agnostic, with no direct `cloudflare:workers` import
|
|
491
|
+
* that would fail to resolve under a Node build.
|
|
492
|
+
*/
|
|
493
|
+
export function generateEnvModule(adapterName: string | undefined): string {
|
|
494
|
+
if (adapterName === "@astrojs/cloudflare") {
|
|
495
|
+
return `export { env } from "cloudflare:workers";`;
|
|
496
|
+
}
|
|
497
|
+
return `export const env = undefined;`;
|
|
498
|
+
}
|
|
499
|
+
|
|
472
500
|
/**
|
|
473
501
|
* Generates the scheduler virtual module.
|
|
474
502
|
*
|
|
@@ -598,12 +626,14 @@ function resolveModulePathFromProject(specifier: string, projectRoot: string): s
|
|
|
598
626
|
/**
|
|
599
627
|
* Generates the sandboxed plugins module.
|
|
600
628
|
* Resolves plugin entrypoints to files, reads them, and embeds the code.
|
|
629
|
+
* Notifies the caller about each resolved entry so build tools can watch it.
|
|
601
630
|
*
|
|
602
631
|
* At runtime, middleware uses SandboxRunner to load these into isolates.
|
|
603
632
|
*/
|
|
604
633
|
export function generateSandboxedPluginsModule(
|
|
605
634
|
sandboxed: PluginDescriptor[],
|
|
606
635
|
projectRoot: string,
|
|
636
|
+
onEntryResolved?: (filePath: string) => void,
|
|
607
637
|
): string {
|
|
608
638
|
if (sandboxed.length === 0) {
|
|
609
639
|
return `
|
|
@@ -630,6 +660,8 @@ export const sandboxedPlugins = [];
|
|
|
630
660
|
);
|
|
631
661
|
}
|
|
632
662
|
|
|
663
|
+
onEntryResolved?.(filePath);
|
|
664
|
+
|
|
633
665
|
const code = readFileSync(filePath, "utf-8");
|
|
634
666
|
|
|
635
667
|
// Create the plugin entry with embedded code and sandbox config
|
|
@@ -640,8 +672,10 @@ export const sandboxedPlugins = [];
|
|
|
640
672
|
capabilities: ${JSON.stringify(descriptor.capabilities ?? [])},
|
|
641
673
|
allowedHosts: ${JSON.stringify(descriptor.allowedHosts ?? [])},
|
|
642
674
|
storage: ${JSON.stringify(descriptor.storage ?? {})},
|
|
675
|
+
mcp: ${JSON.stringify(descriptor.mcp)},
|
|
643
676
|
adminPages: ${JSON.stringify(descriptor.adminPages ?? [])},
|
|
644
677
|
adminWidgets: ${JSON.stringify(descriptor.adminWidgets ?? [])},
|
|
678
|
+
settingsSchema: ${JSON.stringify(descriptor.settingsSchema)},
|
|
645
679
|
portableTextBlocks: ${JSON.stringify(descriptor.portableTextBlocks ?? [])},
|
|
646
680
|
fieldWidgets: ${JSON.stringify(descriptor.fieldWidgets ?? [])},
|
|
647
681
|
adminEntry: ${JSON.stringify(descriptor.adminEntry)},
|
|
@@ -46,9 +46,12 @@ import {
|
|
|
46
46
|
RESOLVED_VIRTUAL_WAIT_UNTIL_ID,
|
|
47
47
|
VIRTUAL_SCHEDULER_ID,
|
|
48
48
|
RESOLVED_VIRTUAL_SCHEDULER_ID,
|
|
49
|
+
VIRTUAL_ENV_ID,
|
|
50
|
+
RESOLVED_VIRTUAL_ENV_ID,
|
|
49
51
|
generateSeedModule,
|
|
50
52
|
generateWaitUntilModule,
|
|
51
53
|
generateSchedulerModule,
|
|
54
|
+
generateEnvModule,
|
|
52
55
|
generateConfigModule,
|
|
53
56
|
generateDialectModule,
|
|
54
57
|
generateStorageModule,
|
|
@@ -227,6 +230,9 @@ export function createVirtualModulesPlugin(
|
|
|
227
230
|
if (id === VIRTUAL_SCHEDULER_ID) {
|
|
228
231
|
return RESOLVED_VIRTUAL_SCHEDULER_ID;
|
|
229
232
|
}
|
|
233
|
+
if (id === VIRTUAL_ENV_ID) {
|
|
234
|
+
return RESOLVED_VIRTUAL_ENV_ID;
|
|
235
|
+
}
|
|
230
236
|
},
|
|
231
237
|
load(id: string) {
|
|
232
238
|
if (id === RESOLVED_VIRTUAL_CONFIG_ID) {
|
|
@@ -239,6 +245,7 @@ export function createVirtualModulesPlugin(
|
|
|
239
245
|
entrypoint: resolvedConfig.database?.entrypoint,
|
|
240
246
|
type: resolvedConfig.database?.type,
|
|
241
247
|
supportsRequestScope: resolvedConfig.database?.supportsRequestScope ?? false,
|
|
248
|
+
supportsCoalescing: resolvedConfig.database?.supportsCoalescing ?? false,
|
|
242
249
|
});
|
|
243
250
|
}
|
|
244
251
|
// Generate a module that statically imports the configured storage
|
|
@@ -271,7 +278,11 @@ export function createVirtualModulesPlugin(
|
|
|
271
278
|
if (id === RESOLVED_VIRTUAL_SANDBOXED_PLUGINS_ID) {
|
|
272
279
|
// Pass project root for proper module resolution
|
|
273
280
|
const projectRoot = fileURLToPath(astroConfig.root);
|
|
274
|
-
return generateSandboxedPluginsModule(
|
|
281
|
+
return generateSandboxedPluginsModule(
|
|
282
|
+
resolvedConfig.sandboxed ?? [],
|
|
283
|
+
projectRoot,
|
|
284
|
+
(filePath) => this.addWatchFile(filePath),
|
|
285
|
+
);
|
|
275
286
|
}
|
|
276
287
|
// Generate auth module that statically imports the configured auth provider
|
|
277
288
|
if (id === RESOLVED_VIRTUAL_AUTH_ID) {
|
|
@@ -317,6 +328,11 @@ export function createVirtualModulesPlugin(
|
|
|
317
328
|
const schedulerCommand = astroCommand === "dev" ? "serve" : "build";
|
|
318
329
|
return generateSchedulerModule(astroConfig.adapter?.name, schedulerCommand);
|
|
319
330
|
}
|
|
331
|
+
// Generate env module — re-exports cloudflare:workers' env under
|
|
332
|
+
// the Cloudflare adapter, undefined otherwise (#1736).
|
|
333
|
+
if (id === RESOLVED_VIRTUAL_ENV_ID) {
|
|
334
|
+
return generateEnvModule(astroConfig.adapter?.name);
|
|
335
|
+
}
|
|
320
336
|
},
|
|
321
337
|
};
|
|
322
338
|
}
|
|
@@ -60,13 +60,7 @@ function isUnsafeMethod(method: string): boolean {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
function csrfRejectedResponse(): Response {
|
|
63
|
-
return
|
|
64
|
-
JSON.stringify({ error: { code: "CSRF_REJECTED", message: "Missing required header" } }),
|
|
65
|
-
{
|
|
66
|
-
status: 403,
|
|
67
|
-
headers: { "Content-Type": "application/json", ...MW_CACHE_HEADERS },
|
|
68
|
-
},
|
|
69
|
-
);
|
|
63
|
+
return apiError("CSRF_REJECTED", "Missing required header", 403);
|
|
70
64
|
}
|
|
71
65
|
|
|
72
66
|
function mcpUnauthorizedResponse(
|
|
@@ -74,16 +68,13 @@ function mcpUnauthorizedResponse(
|
|
|
74
68
|
config?: Parameters<typeof getPublicOrigin>[1],
|
|
75
69
|
): Response {
|
|
76
70
|
const origin = getPublicOrigin(url, config);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
"WWW-Authenticate": `Bearer resource_metadata="${origin}/.well-known/oauth-protected-resource"`,
|
|
83
|
-
...MW_CACHE_HEADERS,
|
|
84
|
-
},
|
|
85
|
-
},
|
|
71
|
+
const response = apiError("NOT_AUTHENTICATED", "Not authenticated", 401);
|
|
72
|
+
// Preserve the OAuth discovery header so MCP clients can find the auth server.
|
|
73
|
+
response.headers.set(
|
|
74
|
+
"WWW-Authenticate",
|
|
75
|
+
`Bearer resource_metadata="${origin}/.well-known/oauth-protected-resource"`,
|
|
86
76
|
);
|
|
77
|
+
return response;
|
|
87
78
|
}
|
|
88
79
|
|
|
89
80
|
/**
|
|
@@ -224,15 +215,7 @@ export const onRequest = defineMiddleware(async (context, next) => {
|
|
|
224
215
|
if (method !== "GET" && method !== "HEAD" && method !== "OPTIONS") {
|
|
225
216
|
const csrfHeader = context.request.headers.get("X-EmDash-Request");
|
|
226
217
|
if (csrfHeader !== "1") {
|
|
227
|
-
return
|
|
228
|
-
JSON.stringify({
|
|
229
|
-
error: { code: "CSRF_REJECTED", message: "Missing required header" },
|
|
230
|
-
}),
|
|
231
|
-
{
|
|
232
|
-
status: 403,
|
|
233
|
-
headers: { "Content-Type": "application/json", ...MW_CACHE_HEADERS },
|
|
234
|
-
},
|
|
235
|
-
);
|
|
218
|
+
return apiError("CSRF_REJECTED", "Missing required header", 403);
|
|
236
219
|
}
|
|
237
220
|
}
|
|
238
221
|
return next();
|
|
@@ -250,20 +233,16 @@ export const onRequest = defineMiddleware(async (context, next) => {
|
|
|
250
233
|
const bearerResult = await handleBearerAuth(context);
|
|
251
234
|
|
|
252
235
|
if (bearerResult === "invalid") {
|
|
253
|
-
const
|
|
254
|
-
"Content-Type": "application/json",
|
|
255
|
-
...MW_CACHE_HEADERS,
|
|
256
|
-
};
|
|
236
|
+
const response = apiError("INVALID_TOKEN", "Invalid or expired token", 401);
|
|
257
237
|
// Add WWW-Authenticate header on MCP endpoint 401s to trigger OAuth discovery
|
|
258
238
|
if (url.pathname === "/_emdash/api/mcp") {
|
|
259
239
|
const origin = getPublicOrigin(url, context.locals.emdash?.config);
|
|
260
|
-
headers
|
|
261
|
-
|
|
240
|
+
response.headers.set(
|
|
241
|
+
"WWW-Authenticate",
|
|
242
|
+
`Bearer resource_metadata="${origin}/.well-known/oauth-protected-resource"`,
|
|
243
|
+
);
|
|
262
244
|
}
|
|
263
|
-
return
|
|
264
|
-
JSON.stringify({ error: { code: "INVALID_TOKEN", message: "Invalid or expired token" } }),
|
|
265
|
-
{ status: 401, headers },
|
|
266
|
-
);
|
|
245
|
+
return response;
|
|
267
246
|
}
|
|
268
247
|
|
|
269
248
|
const isTokenAuth = bearerResult === "authenticated";
|
|
@@ -308,7 +287,10 @@ export const onRequest = defineMiddleware(async (context, next) => {
|
|
|
308
287
|
"Content-Security-Policy",
|
|
309
288
|
buildEmDashCsp(
|
|
310
289
|
context.locals.emdash?.config.experimental?.registry,
|
|
311
|
-
getConfiguredStorageEndpoint(
|
|
290
|
+
getConfiguredStorageEndpoint(
|
|
291
|
+
context.locals.emdash?.config.storage,
|
|
292
|
+
context.locals.emdash?.storage,
|
|
293
|
+
),
|
|
312
294
|
),
|
|
313
295
|
);
|
|
314
296
|
}
|
|
@@ -323,7 +305,10 @@ export const onRequest = defineMiddleware(async (context, next) => {
|
|
|
323
305
|
"Content-Security-Policy",
|
|
324
306
|
buildEmDashCsp(
|
|
325
307
|
context.locals.emdash?.config.experimental?.registry,
|
|
326
|
-
getConfiguredStorageEndpoint(
|
|
308
|
+
getConfiguredStorageEndpoint(
|
|
309
|
+
context.locals.emdash?.config.storage,
|
|
310
|
+
context.locals.emdash?.storage,
|
|
311
|
+
),
|
|
327
312
|
),
|
|
328
313
|
);
|
|
329
314
|
}
|
|
@@ -378,15 +363,28 @@ async function handleEmDashAuth(
|
|
|
378
363
|
}
|
|
379
364
|
|
|
380
365
|
/**
|
|
381
|
-
*
|
|
382
|
-
*
|
|
383
|
-
*
|
|
366
|
+
* Plugin-route auth. Resolves the user in three steps, stopping at the first that
|
|
367
|
+
* applies:
|
|
368
|
+
*
|
|
369
|
+
* 1. Bearer token (all modes). A valid token authenticates; an invalid/expired one
|
|
370
|
+
* returns 401 (we never silently downgrade a bad token to anonymous).
|
|
371
|
+
* 2. External provider — only for a *private* route in production external-auth
|
|
372
|
+
* mode. Here `handleExternalAuth` is the sole authority: the provider (e.g.
|
|
373
|
+
* Cloudflare Access) is re-verified on every request, so it hard-blocks with
|
|
374
|
+
* 401 on failure. It does persist an EmDash session (so public pages can
|
|
375
|
+
* identify the user), but on these routes that session is deliberately NOT
|
|
376
|
+
* consulted as a fallback — the provider check is authoritative every time.
|
|
377
|
+
* 3. Session — everything else (non-external mode, DEV, and all public routes).
|
|
378
|
+
* This is soft: it sets `locals.user` if a session exists but never blocks.
|
|
379
|
+
*
|
|
380
|
+
* Public routes are always allowed through. The catch-all handler still enforces
|
|
381
|
+
* the `plugins:manage` permission and CSRF for private invocations.
|
|
384
382
|
*/
|
|
385
383
|
async function handlePluginRouteAuth(
|
|
386
384
|
context: Parameters<Parameters<typeof defineMiddleware>[0]>[0],
|
|
387
385
|
next: Parameters<Parameters<typeof defineMiddleware>[0]>[1],
|
|
388
386
|
): Promise<Response> {
|
|
389
|
-
const { locals } = context;
|
|
387
|
+
const { locals, url } = context;
|
|
390
388
|
const { emdash } = locals;
|
|
391
389
|
|
|
392
390
|
try {
|
|
@@ -399,19 +397,22 @@ async function handlePluginRouteAuth(
|
|
|
399
397
|
if (bearerResult === "invalid") {
|
|
400
398
|
// A token was presented but is invalid/expired — return 401 so the
|
|
401
399
|
// caller knows their token is bad (don't silently downgrade to no-auth).
|
|
402
|
-
return
|
|
403
|
-
JSON.stringify({ error: { code: "INVALID_TOKEN", message: "Invalid or expired token" } }),
|
|
404
|
-
{
|
|
405
|
-
status: 401,
|
|
406
|
-
headers: { "Content-Type": "application/json", ...MW_CACHE_HEADERS },
|
|
407
|
-
},
|
|
408
|
-
);
|
|
400
|
+
return apiError("INVALID_TOKEN", "Invalid or expired token", 401);
|
|
409
401
|
}
|
|
410
|
-
// "none" — no token presented, try session auth below.
|
|
402
|
+
// "none" — no token presented, try external/session auth below.
|
|
411
403
|
} catch (error) {
|
|
412
404
|
console.error("Plugin route bearer auth error:", error);
|
|
413
405
|
}
|
|
414
406
|
|
|
407
|
+
const authMode = getAuthMode(emdash?.config);
|
|
408
|
+
if (
|
|
409
|
+
authMode.type === "external" &&
|
|
410
|
+
!import.meta.env.DEV &&
|
|
411
|
+
!isPublicPluginApiRoute(url.pathname, emdash)
|
|
412
|
+
) {
|
|
413
|
+
return handleExternalAuth(context, next, authMode, true);
|
|
414
|
+
}
|
|
415
|
+
|
|
415
416
|
try {
|
|
416
417
|
// Try session auth (sets locals.user if session exists)
|
|
417
418
|
const { session } = context;
|
|
@@ -431,6 +432,17 @@ async function handlePluginRouteAuth(
|
|
|
431
432
|
return next();
|
|
432
433
|
}
|
|
433
434
|
|
|
435
|
+
function isPublicPluginApiRoute(pathname: string, emdash: EmDashHandlers | undefined): boolean {
|
|
436
|
+
const prefix = "/_emdash/api/plugins/";
|
|
437
|
+
const route = pathname.slice(prefix.length);
|
|
438
|
+
const slashIndex = route.indexOf("/");
|
|
439
|
+
if (slashIndex <= 0 || !emdash?.getPluginRouteMeta) return false;
|
|
440
|
+
|
|
441
|
+
return (
|
|
442
|
+
emdash.getPluginRouteMeta(route.slice(0, slashIndex), route.slice(slashIndex))?.public === true
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
|
|
434
446
|
/**
|
|
435
447
|
* Soft auth check for public routes with edit mode cookie.
|
|
436
448
|
* Checks the session and sets locals.user if valid, but never blocks the request.
|
|
@@ -662,10 +674,7 @@ async function handlePasskeyAuth(
|
|
|
662
674
|
|
|
663
675
|
if (!sessionUser?.id) {
|
|
664
676
|
if (isApiRoute) {
|
|
665
|
-
return
|
|
666
|
-
{ error: { code: "NOT_AUTHENTICATED", message: "Not authenticated" } },
|
|
667
|
-
{ status: 401, headers: MW_CACHE_HEADERS },
|
|
668
|
-
);
|
|
677
|
+
return apiError("NOT_AUTHENTICATED", "Not authenticated", 401);
|
|
669
678
|
}
|
|
670
679
|
const loginUrl = new URL("/_emdash/admin/login", getPublicOrigin(url, emdash?.config));
|
|
671
680
|
loginUrl.searchParams.set("redirect", url.pathname);
|
|
@@ -680,10 +689,7 @@ async function handlePasskeyAuth(
|
|
|
680
689
|
// User no longer exists - clear session
|
|
681
690
|
session?.destroy();
|
|
682
691
|
if (isApiRoute) {
|
|
683
|
-
return
|
|
684
|
-
{ error: { code: "NOT_FOUND", message: "User not found" } },
|
|
685
|
-
{ status: 401, headers: MW_CACHE_HEADERS },
|
|
686
|
-
);
|
|
692
|
+
return apiError("NOT_FOUND", "User not found", 401);
|
|
687
693
|
}
|
|
688
694
|
const loginUrl = new URL("/_emdash/admin/login", getPublicOrigin(url, emdash?.config));
|
|
689
695
|
return context.redirect(loginUrl.toString());
|
|
@@ -764,9 +770,6 @@ const SCOPE_RULES: Array<[prefix: string, method: string, scope: string]> = [
|
|
|
764
770
|
// settings:manage are not rejected at the middleware level.
|
|
765
771
|
["/_emdash/api/settings", "GET", "settings:read"],
|
|
766
772
|
["/_emdash/api/settings", "WRITE", "settings:manage"],
|
|
767
|
-
|
|
768
|
-
// MCP endpoint — scopes enforced per-tool inside mcp/server.ts
|
|
769
|
-
["/_emdash/api/mcp", "*", "content:read"],
|
|
770
773
|
];
|
|
771
774
|
|
|
772
775
|
const WRITE_METHODS = new Set(["POST", "PUT", "PATCH", "DELETE"]);
|
|
@@ -785,6 +788,11 @@ function enforceTokenScope(
|
|
|
785
788
|
// Session auth — implicit full access, no scope restrictions
|
|
786
789
|
if (!tokenScopes) return null;
|
|
787
790
|
|
|
791
|
+
// MCP is authenticated here, but each tool enforces its own scope. A
|
|
792
|
+
// blanket content:read/admin requirement would prevent plugin-scoped tokens
|
|
793
|
+
// from reaching `mcp/server.ts`, where the actual tool policy lives.
|
|
794
|
+
if (pathname === MCP_ENDPOINT_PATH) return null;
|
|
795
|
+
|
|
788
796
|
const isWrite = WRITE_METHODS.has(method);
|
|
789
797
|
|
|
790
798
|
for (const [prefix, ruleMethod, scope] of SCOPE_RULES) {
|
|
@@ -795,28 +803,12 @@ function enforceTokenScope(
|
|
|
795
803
|
if (ruleMethod === "*" || (ruleMethod === "WRITE" && isWrite) || ruleMethod === method) {
|
|
796
804
|
if (hasScope(tokenScopes, scope)) return null;
|
|
797
805
|
|
|
798
|
-
return
|
|
799
|
-
JSON.stringify({
|
|
800
|
-
error: {
|
|
801
|
-
code: "INSUFFICIENT_SCOPE",
|
|
802
|
-
message: `Token lacks required scope: ${scope}`,
|
|
803
|
-
},
|
|
804
|
-
}),
|
|
805
|
-
{ status: 403, headers: { "Content-Type": "application/json", ...MW_CACHE_HEADERS } },
|
|
806
|
-
);
|
|
806
|
+
return apiError("INSUFFICIENT_SCOPE", `Token lacks required scope: ${scope}`, 403);
|
|
807
807
|
}
|
|
808
808
|
}
|
|
809
809
|
|
|
810
810
|
// No rule matched — default to admin scope (fail-closed)
|
|
811
811
|
if (hasScope(tokenScopes, "admin")) return null;
|
|
812
812
|
|
|
813
|
-
return
|
|
814
|
-
JSON.stringify({
|
|
815
|
-
error: {
|
|
816
|
-
code: "INSUFFICIENT_SCOPE",
|
|
817
|
-
message: "Token lacks required scope: admin",
|
|
818
|
-
},
|
|
819
|
-
}),
|
|
820
|
-
{ status: 403, headers: { "Content-Type": "application/json", ...MW_CACHE_HEADERS } },
|
|
821
|
-
);
|
|
813
|
+
return apiError("INSUFFICIENT_SCOPE", "Token lacks required scope: admin", 403);
|
|
822
814
|
}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* are configured, in which case those origins are allowed too.
|
|
14
14
|
*/
|
|
15
15
|
import type { RegistryConfigInput } from "../../registry/types.js";
|
|
16
|
+
import type { Storage } from "../../storage/types.js";
|
|
16
17
|
import type { StorageDescriptor } from "../storage/types.js";
|
|
17
18
|
|
|
18
19
|
/** Entrypoint constant used by the `s3()` adapter (see `astro/storage/adapters.ts`). */
|
|
@@ -28,10 +29,12 @@ const S3_ADAPTER_ENTRYPOINT = "emdash/storage/s3";
|
|
|
28
29
|
* `endpoint` -- from the matching `S3_*` env var at runtime (see
|
|
29
30
|
* `storage/s3.ts`'s `resolveS3Config`). A site configured as `s3({ ... })`
|
|
30
31
|
* with only `S3_ENDPOINT` set has no `endpoint` in the descriptor's config,
|
|
31
|
-
* so fall back to that env var for S3-adapter storage
|
|
32
|
+
* so fall back to that env var for S3-adapter storage. Custom adapters can
|
|
33
|
+
* expose their runtime upload origin through `getClientUploadOrigin()`.
|
|
32
34
|
*/
|
|
33
35
|
export function getConfiguredStorageEndpoint(
|
|
34
36
|
storage: StorageDescriptor | undefined,
|
|
37
|
+
runtimeStorage?: Pick<Storage, "getClientUploadOrigin"> | null,
|
|
35
38
|
): string | undefined {
|
|
36
39
|
const config = storage?.config;
|
|
37
40
|
if (typeof config === "object" && config !== null && "endpoint" in config) {
|
|
@@ -45,7 +48,7 @@ export function getConfiguredStorageEndpoint(
|
|
|
45
48
|
if (envEndpoint) return envEndpoint;
|
|
46
49
|
}
|
|
47
50
|
|
|
48
|
-
return
|
|
51
|
+
return runtimeStorage?.getClientUploadOrigin?.();
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
function getRegistryAggregatorOrigin(
|
package/src/astro/middleware.ts
CHANGED
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
import { setI18nConfig } from "../i18n/config.js";
|
|
48
48
|
import type { Database, Storage } from "../index.js";
|
|
49
49
|
import { createPublicMediaUrlResolver } from "../media/url.js";
|
|
50
|
-
import type {
|
|
50
|
+
import type { SandboxRunnerFactory } from "../plugins/sandbox/types.js";
|
|
51
51
|
import type { ResolvedPlugin } from "../plugins/types.js";
|
|
52
52
|
import { invalidateUrlPatternCache } from "../query.js";
|
|
53
53
|
import {
|
|
@@ -67,6 +67,9 @@ import { createPublicPluginApiRouteHandler } from "./public-plugin-api-routes.js
|
|
|
67
67
|
import { resolveSessionUser } from "./session-user.js";
|
|
68
68
|
import type { EmDashHandlers } from "./types.js";
|
|
69
69
|
|
|
70
|
+
// Public type for withEmDashRuntime() consumers (queue/scheduled handlers).
|
|
71
|
+
export type { EmDashRuntime } from "../emdash-runtime.js";
|
|
72
|
+
|
|
70
73
|
/**
|
|
71
74
|
* Runtime init lock reclaim deadline. Must be strictly larger than the db
|
|
72
75
|
* init deadline: this lock wraps EmDashRuntime.create() → getDatabase() →
|
|
@@ -200,19 +203,7 @@ function buildDependencies(config: EmDashConfig): RuntimeDependencies {
|
|
|
200
203
|
sandboxEnabled: sandboxModule.sandboxEnabled as boolean,
|
|
201
204
|
sandboxBypassed: (sandboxModule.sandboxBypassed as boolean) ?? false,
|
|
202
205
|
sandboxedPluginEntries: (virtualSandboxedPlugins as SandboxedPluginEntry[]) || [],
|
|
203
|
-
createSandboxRunner: sandboxModule.createSandboxRunner as
|
|
204
|
-
| ((opts: {
|
|
205
|
-
db: Kysely<Database>;
|
|
206
|
-
mediaStorage?: {
|
|
207
|
-
upload(options: {
|
|
208
|
-
key: string;
|
|
209
|
-
body: Uint8Array;
|
|
210
|
-
contentType: string;
|
|
211
|
-
}): Promise<unknown>;
|
|
212
|
-
delete(key: string): Promise<unknown>;
|
|
213
|
-
};
|
|
214
|
-
}) => SandboxRunner)
|
|
215
|
-
| null,
|
|
206
|
+
createSandboxRunner: sandboxModule.createSandboxRunner as SandboxRunnerFactory | null,
|
|
216
207
|
mediaProviderEntries: (virtualMediaProviders as MediaProviderEntry[]) || [],
|
|
217
208
|
};
|
|
218
209
|
/* eslint-enable typescript-eslint/no-unsafe-type-assertion */
|
|
@@ -285,22 +276,81 @@ export async function runScheduledTasks(
|
|
|
285
276
|
): Promise<{ published: PublishedRef[] }> {
|
|
286
277
|
const config = getConfig();
|
|
287
278
|
if (!config) return { published: [] };
|
|
279
|
+
return runOutsideRequest(config, (runtime) => runtime.runScheduledTasks(options));
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Run a callback against the EmDash runtime outside any HTTP request — from a
|
|
284
|
+
* Cloudflare Queue consumer, a `scheduled()` handler, or any other
|
|
285
|
+
* platform-event handler that has no request and therefore no `locals.emdash`.
|
|
286
|
+
*
|
|
287
|
+
* Resolves the same cached runtime singleton request handlers use, so hooks,
|
|
288
|
+
* plugin state, and storage all behave exactly as they do during a request.
|
|
289
|
+
* A typical queue consumer finishes a job by calling back into a plugin route:
|
|
290
|
+
*
|
|
291
|
+
* ```ts
|
|
292
|
+
* import { withEmDashRuntime } from "emdash/middleware";
|
|
293
|
+
*
|
|
294
|
+
* async function queue(batch: MessageBatch) {
|
|
295
|
+
* await withEmDashRuntime(async (runtime) => {
|
|
296
|
+
* for (const message of batch.messages) {
|
|
297
|
+
* await runtime.handlePluginApiRoute(
|
|
298
|
+
* "my-plugin",
|
|
299
|
+
* "POST",
|
|
300
|
+
* "/finishJob",
|
|
301
|
+
* new Request("https://internal/", {
|
|
302
|
+
* method: "POST",
|
|
303
|
+
* body: JSON.stringify(message.body),
|
|
304
|
+
* }),
|
|
305
|
+
* );
|
|
306
|
+
* }
|
|
307
|
+
* });
|
|
308
|
+
* }
|
|
309
|
+
* ```
|
|
310
|
+
*
|
|
311
|
+
* Server-only and fully trusted: the callback gets the raw runtime with no
|
|
312
|
+
* auth or CSRF checks, same trust level as plugin cron. Never expose it to
|
|
313
|
+
* user input without validating that input yourself.
|
|
314
|
+
*
|
|
315
|
+
* Throws when EmDash is not configured (no `emdash()` Astro integration).
|
|
316
|
+
*/
|
|
317
|
+
export async function withEmDashRuntime<T>(
|
|
318
|
+
run: (runtime: EmDashRuntime) => T | Promise<T>,
|
|
319
|
+
): Promise<T> {
|
|
320
|
+
const config = getConfig();
|
|
321
|
+
if (!config) {
|
|
322
|
+
throw new Error(
|
|
323
|
+
"EmDash is not configured — withEmDashRuntime() requires the emdash() Astro integration.",
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
return runOutsideRequest(config, async (runtime) => run(runtime));
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Shared plumbing for request-free entry points (`runScheduledTasks`,
|
|
331
|
+
* `withEmDashRuntime`): resolve the runtime singleton, then run the callback
|
|
332
|
+
* under an event-scoped db connection when the adapter needs one.
|
|
333
|
+
*
|
|
334
|
+
* Connection-backed adapters (e.g. Postgres over Hyperdrive) cannot reuse
|
|
335
|
+
* the per-isolate singleton from a platform event: its socket belongs to the
|
|
336
|
+
* request that opened it, and workerd rejects cross-event I/O. Open an
|
|
337
|
+
* event-scoped connection and run the callback under it in ALS — the
|
|
338
|
+
* runtime's db getter, the cron executor, and plugin contexts all resolve
|
|
339
|
+
* the connection from ALS — then close it. Gated on the adapter being
|
|
340
|
+
* connection-backed (it exposes `close()`); stateless adapters (D1, Node
|
|
341
|
+
* SQLite) return null or a close-less scope and keep using the singleton.
|
|
342
|
+
*/
|
|
343
|
+
async function runOutsideRequest<T>(
|
|
344
|
+
config: EmDashConfig,
|
|
345
|
+
fn: (runtime: EmDashRuntime) => Promise<T>,
|
|
346
|
+
): Promise<T> {
|
|
288
347
|
const runtime = await getRuntime(config);
|
|
289
348
|
|
|
290
|
-
// Connection-backed adapters (e.g. Postgres over Hyperdrive) cannot reuse
|
|
291
|
-
// the per-isolate singleton from a Cron Trigger: its socket belongs to the
|
|
292
|
-
// request that opened it, and workerd rejects cross-event I/O. Open an
|
|
293
|
-
// event-scoped connection for the sweep and run the batch under it in ALS —
|
|
294
|
-
// the runtime's db getter, the cron executor, and plugin cron contexts all
|
|
295
|
-
// resolve the connection from ALS — then close it. Gated on the adapter
|
|
296
|
-
// being connection-backed (it exposes `close()`); stateless adapters (D1,
|
|
297
|
-
// Node SQLite) return null or a close-less scope and keep using the
|
|
298
|
-
// singleton, so their cron path is unchanged.
|
|
299
349
|
const scoped = createRequestScopedDb({
|
|
300
350
|
config: config.database?.config,
|
|
301
351
|
isAuthenticated: false,
|
|
302
|
-
//
|
|
303
|
-
// connection-backed adapter routes
|
|
352
|
+
// Event handlers publish, clean up, or run jobs — a write workload —
|
|
353
|
+
// so a connection-backed adapter routes them to the primary.
|
|
304
354
|
isWrite: true,
|
|
305
355
|
cookies: NOOP_COOKIE_JAR,
|
|
306
356
|
url: CRON_EVENT_URL,
|
|
@@ -308,7 +358,7 @@ export async function runScheduledTasks(
|
|
|
308
358
|
if (!scoped?.close) {
|
|
309
359
|
// Stateless adapter (or no per-request scoping): the singleton is safe
|
|
310
360
|
// outside a request. Any close-less scope created above is discarded.
|
|
311
|
-
return runtime
|
|
361
|
+
return fn(runtime);
|
|
312
362
|
}
|
|
313
363
|
|
|
314
364
|
const parent = getRequestContext();
|
|
@@ -316,19 +366,19 @@ export async function runScheduledTasks(
|
|
|
316
366
|
? { ...parent, db: scoped.db }
|
|
317
367
|
: { editMode: false, db: scoped.db, metrics: createRequestMetrics(performance.now()) };
|
|
318
368
|
try {
|
|
319
|
-
return await runWithContext(ctx, () => runtime
|
|
369
|
+
return await runWithContext(ctx, () => fn(runtime));
|
|
320
370
|
} finally {
|
|
321
|
-
// Guard both so a throw in teardown can't mask the
|
|
322
|
-
// close() and leak the connection. Mirrors closeSafely() in scoped-db.ts.
|
|
371
|
+
// Guard both so a throw in teardown can't mask the callback result or
|
|
372
|
+
// skip close() and leak the connection. Mirrors closeSafely() in scoped-db.ts.
|
|
323
373
|
try {
|
|
324
374
|
scoped.commit();
|
|
325
375
|
} catch (error) {
|
|
326
|
-
console.error("[
|
|
376
|
+
console.error("[emdash] event-scoped db commit failed:", error);
|
|
327
377
|
}
|
|
328
378
|
try {
|
|
329
379
|
scoped.close();
|
|
330
380
|
} catch (error) {
|
|
331
|
-
console.error("[
|
|
381
|
+
console.error("[emdash] event-scoped db close failed:", error);
|
|
332
382
|
}
|
|
333
383
|
}
|
|
334
384
|
}
|
|
@@ -734,6 +784,11 @@ export const onRequest = defineMiddleware(async (context, next) => {
|
|
|
734
784
|
handlePluginApiRoute: runtime.handlePluginApiRoute.bind(runtime),
|
|
735
785
|
handlePublicPluginApiRoute: createPublicPluginApiRouteHandler(runtime),
|
|
736
786
|
getPluginRouteMeta: runtime.getPluginRouteMeta.bind(runtime),
|
|
787
|
+
getPluginMcpTools: runtime.getPluginMcpTools.bind(runtime),
|
|
788
|
+
getEnabledPluginMcpTools: runtime.getEnabledPluginMcpTools.bind(runtime),
|
|
789
|
+
serializePluginMcpConsent: runtime.serializePluginMcpConsent.bind(runtime),
|
|
790
|
+
handlePluginMcpTool: runtime.handlePluginMcpTool.bind(runtime),
|
|
791
|
+
handlePluginMcpDenied: runtime.handlePluginMcpDenied.bind(runtime),
|
|
737
792
|
|
|
738
793
|
// Media provider methods
|
|
739
794
|
getMediaProvider: runtime.getMediaProvider.bind(runtime),
|