emdash 0.15.0 → 0.16.1
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/api/route-utils.mjs +10 -10
- package/dist/api/schemas/index.d.mts +1 -1
- package/dist/{api-CLwG_3dh.mjs → api-BNKqxyFX.mjs} +54 -14
- package/dist/{api-CLwG_3dh.mjs.map → api-BNKqxyFX.mjs.map} +1 -1
- package/dist/{apply-wJhM_bwU.mjs → apply-BOPaD-s9.mjs} +16 -16
- package/dist/{apply-wJhM_bwU.mjs.map → apply-BOPaD-s9.mjs.map} +1 -1
- package/dist/astro/index.d.mts +3 -3
- package/dist/astro/index.d.mts.map +1 -1
- package/dist/astro/index.mjs +33 -1
- package/dist/astro/index.mjs.map +1 -1
- package/dist/astro/middleware/auth.d.mts +3 -3
- package/dist/astro/middleware/auth.mjs +2 -2
- package/dist/astro/middleware/redirect.mjs +4 -4
- package/dist/astro/middleware/request-context.mjs +1 -1
- package/dist/astro/middleware.d.mts.map +1 -1
- package/dist/astro/middleware.mjs +66 -46
- package/dist/astro/middleware.mjs.map +1 -1
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +3 -3
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +3 -3
- package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +2 -2
- package/dist/astro/routes/api/admin/api-tokens/index.mjs +3 -3
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +8 -8
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +9 -9
- package/dist/astro/routes/api/admin/bylines/index.mjs +9 -9
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +7 -7
- package/dist/astro/routes/api/admin/comments/_id_.mjs +5 -5
- package/dist/astro/routes/api/admin/comments/bulk.mjs +6 -6
- package/dist/astro/routes/api/admin/comments/counts.mjs +5 -5
- package/dist/astro/routes/api/admin/comments/index.mjs +6 -6
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +4 -4
- package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +3 -3
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +3 -3
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs +3 -3
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +27 -27
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +27 -27
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +27 -27
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +27 -27
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +27 -27
- package/dist/astro/routes/api/admin/plugins/index.mjs +27 -27
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +3 -3
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +27 -27
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +27 -27
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +27 -27
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +27 -27
- 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 +41 -28
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/artifact.d.mts +8 -0
- package/dist/astro/routes/api/admin/plugins/registry/artifact.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +301 -0
- package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/registry/install.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/install.mjs +46 -28
- package/dist/astro/routes/api/admin/plugins/registry/install.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/updates.mjs +27 -27
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +27 -27
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +3 -3
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +27 -27
- package/dist/astro/routes/api/admin/users/_id_/disable.mjs +2 -2
- package/dist/astro/routes/api/admin/users/_id_/enable.mjs +2 -2
- package/dist/astro/routes/api/admin/users/_id_/index.mjs +3 -3
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +2 -2
- package/dist/astro/routes/api/admin/users/index.mjs +3 -3
- package/dist/astro/routes/api/auth/dev-bypass.mjs +3 -3
- package/dist/astro/routes/api/auth/invite/accept.mjs +2 -2
- package/dist/astro/routes/api/auth/invite/complete.mjs +3 -3
- package/dist/astro/routes/api/auth/invite/index.mjs +3 -3
- package/dist/astro/routes/api/auth/invite/register-options.mjs +3 -3
- package/dist/astro/routes/api/auth/logout.mjs +2 -2
- package/dist/astro/routes/api/auth/magic-link/send.mjs +4 -4
- package/dist/astro/routes/api/auth/magic-link/verify.mjs +2 -2
- package/dist/astro/routes/api/auth/me.mjs +3 -3
- package/dist/astro/routes/api/auth/passkey/_id_.mjs +3 -3
- package/dist/astro/routes/api/auth/passkey/index.mjs +2 -2
- package/dist/astro/routes/api/auth/passkey/options.mjs +4 -4
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +3 -3
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +3 -3
- package/dist/astro/routes/api/auth/passkey/verify.mjs +3 -3
- package/dist/astro/routes/api/auth/signup/complete.mjs +3 -3
- package/dist/astro/routes/api/auth/signup/request.mjs +4 -4
- package/dist/astro/routes/api/auth/signup/verify.mjs +2 -2
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +6 -6
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +4 -4
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +4 -4
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +4 -4
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +8 -8
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_.mjs +4 -4
- package/dist/astro/routes/api/content/_collection_/index.mjs +4 -4
- package/dist/astro/routes/api/content/_collection_/trash.mjs +4 -4
- package/dist/astro/routes/api/dashboard.mjs +7 -7
- package/dist/astro/routes/api/dev/emails.mjs +2 -2
- package/dist/astro/routes/api/import/probe.mjs +4 -4
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +3 -3
- package/dist/astro/routes/api/import/wordpress/execute.d.mts +3 -3
- package/dist/astro/routes/api/import/wordpress/execute.mjs +8 -8
- package/dist/astro/routes/api/import/wordpress/media.mjs +4 -4
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +6 -6
- package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.d.mts +11 -1
- package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.d.mts.map +1 -1
- package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.mjs +17 -1
- package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts.map +1 -1
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +7 -7
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +4 -4
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +5 -5
- package/dist/astro/routes/api/manifest.mjs +3 -3
- package/dist/astro/routes/api/mcp.mjs +26 -26
- package/dist/astro/routes/api/media/_id_/confirm.mjs +4 -4
- package/dist/astro/routes/api/media/_id_.mjs +4 -4
- package/dist/astro/routes/api/media/file/_...key_.mjs +2 -2
- package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +3 -3
- package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +3 -3
- package/dist/astro/routes/api/media/providers/index.mjs +3 -3
- package/dist/astro/routes/api/media/upload-url.mjs +4 -4
- package/dist/astro/routes/api/media.mjs +5 -5
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +5 -5
- package/dist/astro/routes/api/menus/_name_/items.mjs +5 -5
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +5 -5
- package/dist/astro/routes/api/menus/_name_/translations.mjs +5 -5
- package/dist/astro/routes/api/menus/_name_.mjs +5 -5
- package/dist/astro/routes/api/menus/index.mjs +5 -5
- package/dist/astro/routes/api/oauth/device/authorize.mjs +3 -3
- package/dist/astro/routes/api/oauth/device/code.mjs +4 -4
- package/dist/astro/routes/api/oauth/device/token.mjs +4 -4
- package/dist/astro/routes/api/oauth/register.mjs +2 -2
- package/dist/astro/routes/api/oauth/token/refresh.mjs +3 -3
- package/dist/astro/routes/api/oauth/token/revoke.mjs +3 -3
- package/dist/astro/routes/api/oauth/token.mjs +2 -2
- package/dist/astro/routes/api/openapi.json.mjs +2 -2
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +3 -3
- package/dist/astro/routes/api/redirects/404s/index.mjs +6 -6
- package/dist/astro/routes/api/redirects/404s/summary.mjs +6 -6
- package/dist/astro/routes/api/redirects/_id_.mjs +7 -7
- package/dist/astro/routes/api/redirects/index.mjs +7 -7
- package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +3 -3
- package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +3 -3
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +27 -27
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +27 -27
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +27 -27
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +27 -27
- package/dist/astro/routes/api/schema/collections/index.mjs +27 -27
- package/dist/astro/routes/api/schema/index.mjs +6 -6
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +27 -27
- package/dist/astro/routes/api/schema/orphans/index.mjs +27 -27
- package/dist/astro/routes/api/search/enable.mjs +7 -7
- package/dist/astro/routes/api/search/index.mjs +6 -6
- package/dist/astro/routes/api/search/rebuild.mjs +7 -7
- package/dist/astro/routes/api/search/stats.mjs +6 -6
- package/dist/astro/routes/api/search/suggest.mjs +6 -6
- package/dist/astro/routes/api/sections/_slug_.mjs +6 -6
- package/dist/astro/routes/api/sections/index.mjs +6 -6
- package/dist/astro/routes/api/settings/email.mjs +4 -4
- package/dist/astro/routes/api/settings.mjs +8 -8
- package/dist/astro/routes/api/setup/admin-verify.mjs +3 -3
- package/dist/astro/routes/api/setup/admin.mjs +3 -3
- package/dist/astro/routes/api/setup/dev-bypass.mjs +15 -15
- package/dist/astro/routes/api/setup/dev-reset.mjs +2 -2
- package/dist/astro/routes/api/setup/index.mjs +16 -16
- package/dist/astro/routes/api/setup/status.mjs +3 -3
- package/dist/astro/routes/api/snapshot.mjs +4 -4
- package/dist/astro/routes/api/snapshot.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +9 -9
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +9 -9
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +9 -9
- package/dist/astro/routes/api/taxonomies/index.mjs +9 -9
- package/dist/astro/routes/api/themes/preview.mjs +3 -3
- package/dist/astro/routes/api/typegen.mjs +5 -5
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +4 -4
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +6 -6
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +6 -6
- package/dist/astro/routes/api/widget-areas/_name_.mjs +5 -5
- package/dist/astro/routes/api/widget-areas/index.mjs +6 -6
- package/dist/astro/routes/api/widget-components.mjs +2 -2
- package/dist/astro/routes/robots.txt.mjs +4 -4
- package/dist/astro/routes/sitemap-_collection_.xml.d.mts.map +1 -1
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +58 -13
- package/dist/astro/routes/sitemap-_collection_.xml.mjs.map +1 -1
- package/dist/astro/routes/sitemap.xml.mjs +5 -5
- package/dist/astro/types.d.mts +10 -3
- package/dist/astro/types.d.mts.map +1 -1
- package/dist/{authorize-Bkwe8kuL.mjs → authorize-Bn4S4DUT.mjs} +2 -2
- package/dist/{authorize-Bkwe8kuL.mjs.map → authorize-Bn4S4DUT.mjs.map} +1 -1
- package/dist/{byline-CTaWkMh5.mjs → byline-BDylH_m4.mjs} +3 -3
- package/dist/{byline-CTaWkMh5.mjs.map → byline-BDylH_m4.mjs.map} +1 -1
- package/dist/{bylines-H0Xh5TMy.mjs → bylines-B7TFEvFf.mjs} +2 -2
- package/dist/{bylines-H0Xh5TMy.mjs.map → bylines-B7TFEvFf.mjs.map} +1 -1
- package/dist/{bylines-DtDRNF1n.d.mts → bylines-DWLnr6-k.d.mts} +17 -17
- package/dist/{bylines-DtDRNF1n.d.mts.map → bylines-DWLnr6-k.d.mts.map} +1 -1
- package/dist/{bylines-BYHWU3T7.mjs → bylines-n6nykUyI.mjs} +6 -6
- package/dist/{bylines-BYHWU3T7.mjs.map → bylines-n6nykUyI.mjs.map} +1 -1
- package/dist/{cache-CNk1jIxp.mjs → cache-BcI1yUjR.mjs} +2 -2
- package/dist/{cache-CNk1jIxp.mjs.map → cache-BcI1yUjR.mjs.map} +1 -1
- package/dist/{chunks-BkfVdD-3.mjs → chunks-cYG4SnIP.mjs} +2 -2
- package/dist/{chunks-BkfVdD-3.mjs.map → chunks-cYG4SnIP.mjs.map} +1 -1
- package/dist/cli/index.mjs +61 -15
- package/dist/cli/index.mjs.map +1 -1
- package/dist/client/cf-access.d.mts +1 -1
- package/dist/client/index.d.mts +1 -1
- package/dist/{comment-_yzlBYPx.mjs → comment-C76G-9tz.mjs} +2 -2
- package/dist/{comment-_yzlBYPx.mjs.map → comment-C76G-9tz.mjs.map} +1 -1
- package/dist/{comments-DxID-rsd.mjs → comments-CCxFFGY1.mjs} +3 -3
- package/dist/{comments-DxID-rsd.mjs.map → comments-CCxFFGY1.mjs.map} +1 -1
- package/dist/{content-C0ooIs-f.mjs → content-8voQNTXX.mjs} +3 -3
- package/dist/{content-C0ooIs-f.mjs.map → content-8voQNTXX.mjs.map} +1 -1
- package/dist/{context-sAnCaUIR.mjs → context-B7qiYrz2.mjs} +7 -7
- package/dist/{context-sAnCaUIR.mjs.map → context-B7qiYrz2.mjs.map} +1 -1
- package/dist/{dashboard-Cqw3ay2X.mjs → dashboard-BeaFSPpx.mjs} +4 -4
- package/dist/{dashboard-Cqw3ay2X.mjs.map → dashboard-BeaFSPpx.mjs.map} +1 -1
- package/dist/db/index.d.mts +1 -1
- package/dist/db/index.mjs +1 -1
- package/dist/db/sqlite.mjs +1 -1
- package/dist/{db-errors-CGN9kJfo.mjs → db-errors-BiYqoX-n.mjs} +14 -2
- package/dist/db-errors-BiYqoX-n.mjs.map +1 -0
- package/dist/{error-CPh_8eLq.mjs → error-ChfADBuu.mjs} +5 -3
- package/dist/error-ChfADBuu.mjs.map +1 -0
- package/dist/errors-9P_FDrJ_.mjs +17 -0
- package/dist/errors-9P_FDrJ_.mjs.map +1 -0
- package/dist/{fts-manager-Mnrtn-r2.mjs → fts-manager-C_b-4x8u.mjs} +2 -2
- package/dist/{fts-manager-Mnrtn-r2.mjs.map → fts-manager-C_b-4x8u.mjs.map} +1 -1
- package/dist/{index-Bv1Wf1zB.d.mts → index-D_p_jIP1.d.mts} +153 -109
- package/dist/index-D_p_jIP1.d.mts.map +1 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +38 -38
- package/dist/{load-DmXNVhst.mjs → load-CLFRjk9r.mjs} +2 -2
- package/dist/{load-DmXNVhst.mjs.map → load-CLFRjk9r.mjs.map} +1 -1
- package/dist/{loader-Chm5h7Gr.mjs → loader-D-vIJjfY.mjs} +86 -46
- package/dist/loader-D-vIJjfY.mjs.map +1 -0
- package/dist/media/local-runtime.d.mts +3 -3
- package/dist/media/local-runtime.mjs +4 -4
- package/dist/{media-oqRcNiQf.mjs → media-CKQd8AYU.mjs} +2 -2
- package/dist/{media-oqRcNiQf.mjs.map → media-CKQd8AYU.mjs.map} +1 -1
- package/dist/{menus-C75SSmRy.mjs → menus-C-nWT5Tu.mjs} +17 -11
- package/dist/menus-C-nWT5Tu.mjs.map +1 -0
- package/dist/{menus-Bjf5R1Qq.mjs → menus-arUNspyU.mjs} +2 -2
- package/dist/{menus-Bjf5R1Qq.mjs.map → menus-arUNspyU.mjs.map} +1 -1
- package/dist/{parse-3-caTKgt.mjs → parse-DHbXfvxO.mjs} +2 -2
- package/dist/{parse-3-caTKgt.mjs.map → parse-DHbXfvxO.mjs.map} +1 -1
- package/dist/plugin-utils.d.mts +25 -10
- package/dist/plugin-utils.d.mts.map +1 -1
- package/dist/plugin-utils.mjs +11 -10
- package/dist/plugin-utils.mjs.map +1 -1
- package/dist/plugins/adapt-sandbox-entry.d.mts +3 -3
- package/dist/{query-BJn8TOPk.mjs → query-7m6-l0f_.mjs} +21 -14
- package/dist/query-7m6-l0f_.mjs.map +1 -0
- package/dist/{rate-limit-D_-gAeJ0.mjs → rate-limit-D8RAXN8b.mjs} +2 -2
- package/dist/{rate-limit-D_-gAeJ0.mjs.map → rate-limit-D8RAXN8b.mjs.map} +1 -1
- package/dist/{redirect-CNv4mHX2.mjs → redirect-CjfDGrTd.mjs} +2 -2
- package/dist/{redirect-CNv4mHX2.mjs.map → redirect-CjfDGrTd.mjs.map} +1 -1
- package/dist/{redirects-B-CUZ1Xh.mjs → redirects-CowoEHdE.mjs} +3 -3
- package/dist/{redirects-B-CUZ1Xh.mjs.map → redirects-CowoEHdE.mjs.map} +1 -1
- package/dist/{registry-DqrAQDXH.mjs → registry-Cyp-dx6J.mjs} +4 -4
- package/dist/{registry-DqrAQDXH.mjs.map → registry-Cyp-dx6J.mjs.map} +1 -1
- package/dist/resolve-D6sM-SgF.mjs +143 -0
- package/dist/resolve-D6sM-SgF.mjs.map +1 -0
- package/dist/{runner-CNHRo1mT.d.mts → runner-DSQBurMS.d.mts} +7 -4
- package/dist/runner-DSQBurMS.d.mts.map +1 -0
- package/dist/{runner-CGlojznK.mjs → runner-Drnvs96u.mjs} +20 -24
- package/dist/{runner-CGlojznK.mjs.map → runner-Drnvs96u.mjs.map} +1 -1
- package/dist/runtime.d.mts +3 -3
- package/dist/runtime.mjs +2 -2
- package/dist/{schema-Djdlfi5G.mjs → schema-CI9mYPX3.mjs} +4 -4
- package/dist/{schema-Djdlfi5G.mjs.map → schema-CI9mYPX3.mjs.map} +1 -1
- package/dist/{search-By-NN3da.mjs → search-DKz_mGBP.mjs} +4 -4
- package/dist/{search-By-NN3da.mjs.map → search-DKz_mGBP.mjs.map} +1 -1
- package/dist/{sections-DcBIlOq1.mjs → sections-DBbCDIAT.mjs} +3 -3
- package/dist/{sections-DcBIlOq1.mjs.map → sections-DBbCDIAT.mjs.map} +1 -1
- package/dist/seed/index.mjs +13 -13
- package/dist/{seo-bjDoq9Eg.mjs → seo-BGCyDlkb.mjs} +2 -2
- package/dist/{seo-bjDoq9Eg.mjs.map → seo-BGCyDlkb.mjs.map} +1 -1
- package/dist/{seo-BoR4wCUh.mjs → seo-Dq707mNQ.mjs} +5 -3
- package/dist/seo-Dq707mNQ.mjs.map +1 -0
- package/dist/{service-BuuTdGAT.mjs → service-B0H7U1Y9.mjs} +2 -2
- package/dist/{service-BuuTdGAT.mjs.map → service-B0H7U1Y9.mjs.map} +1 -1
- package/dist/{settings-hcubRfkr.mjs → settings-BSXRtTzk.mjs} +3 -3
- package/dist/{settings-hcubRfkr.mjs.map → settings-BSXRtTzk.mjs.map} +1 -1
- package/dist/{settings-CJnKiWuR.mjs → settings-DfwNyQkf.mjs} +3 -3
- package/dist/{settings-CJnKiWuR.mjs.map → settings-DfwNyQkf.mjs.map} +1 -1
- package/dist/{taxonomies-CLs9HPE2.mjs → taxonomies-4vx0nmMr.mjs} +4 -4
- package/dist/{taxonomies-CLs9HPE2.mjs.map → taxonomies-4vx0nmMr.mjs.map} +1 -1
- package/dist/{taxonomies-WamPVA2x.mjs → taxonomies-CcvrMLbR.mjs} +7 -7
- package/dist/{taxonomies-WamPVA2x.mjs.map → taxonomies-CcvrMLbR.mjs.map} +1 -1
- package/dist/{taxonomy-D4Uc2LsZ.mjs → taxonomy-zqGQUqgu.mjs} +3 -3
- package/dist/{taxonomy-D4Uc2LsZ.mjs.map → taxonomy-zqGQUqgu.mjs.map} +1 -1
- package/dist/{transport-DOxLfUir.d.mts → transport-C2MGqtL6.d.mts} +1 -1
- package/dist/{transport-DOxLfUir.d.mts.map → transport-C2MGqtL6.d.mts.map} +1 -1
- package/dist/{types-ByV5sgsv.mjs → types-B0bmgwMG.mjs} +2 -2
- package/dist/{types-ByV5sgsv.mjs.map → types-B0bmgwMG.mjs.map} +1 -1
- package/dist/{user-D3BD5zdT.mjs → user-hUSOaIJy.mjs} +2 -2
- package/dist/{user-D3BD5zdT.mjs.map → user-hUSOaIJy.mjs.map} +1 -1
- package/dist/{validate-mz87i8_1.mjs → validate-IGltez8n.mjs} +2 -2
- package/dist/{validate-mz87i8_1.mjs.map → validate-IGltez8n.mjs.map} +1 -1
- package/dist/{validation-DKHhXjPr.mjs → validation-Bmymau7y.mjs} +6 -6
- package/dist/{validation-DKHhXjPr.mjs.map → validation-Bmymau7y.mjs.map} +1 -1
- package/dist/version-ITD3PlQd.mjs +7 -0
- package/dist/{version-Ct7C6RSo.mjs.map → version-ITD3PlQd.mjs.map} +1 -1
- package/dist/{widgets-lShIQXU5.mjs → widgets-yHQa4c6c.mjs} +2 -2
- package/dist/{widgets-lShIQXU5.mjs.map → widgets-yHQa4c6c.mjs.map} +1 -1
- package/dist/{zod-generator-dvxgmd1M.mjs → zod-generator-B80aap1J.mjs} +2 -2
- package/dist/{zod-generator-dvxgmd1M.mjs.map → zod-generator-B80aap1J.mjs.map} +1 -1
- package/package.json +7 -7
- package/src/api/errors.ts +2 -0
- package/src/api/handlers/index.ts +2 -0
- package/src/api/handlers/registry.ts +69 -1
- package/src/api/handlers/seo.ts +16 -1
- package/src/api/handlers/snapshot.ts +1 -1
- package/src/astro/integration/index.ts +26 -0
- package/src/astro/integration/routes.ts +5 -0
- package/src/astro/integration/runtime.ts +8 -0
- package/src/astro/middleware.ts +4 -0
- package/src/astro/public-plugin-api-routes.ts +41 -0
- package/src/astro/routes/api/admin/plugins/registry/[id]/update.ts +4 -0
- package/src/astro/routes/api/admin/plugins/registry/artifact.ts +388 -0
- package/src/astro/routes/api/admin/plugins/registry/install.ts +7 -1
- package/src/astro/routes/api/import/wordpress/rewrite-url-helpers.ts +22 -0
- package/src/astro/routes/api/import/wordpress/rewrite-urls.ts +5 -2
- package/src/astro/routes/sitemap-[collection].xml.ts +114 -14
- package/src/astro/types.ts +14 -0
- package/src/content/converters/portable-text-to-prosemirror.ts +35 -11
- package/src/database/connection.ts +3 -10
- package/src/database/errors.ts +14 -0
- package/src/database/index.ts +3 -1
- package/src/database/migrations/runner.ts +29 -21
- package/src/emdash-runtime.ts +1 -0
- package/src/i18n/resolve.ts +152 -0
- package/src/index.ts +2 -0
- package/src/loader.ts +133 -59
- package/src/plugin-utils.ts +23 -0
- package/src/query.ts +24 -5
- package/src/utils/db-errors.ts +24 -0
- package/dist/connection-2igzM-AT.mjs +0 -57
- package/dist/connection-2igzM-AT.mjs.map +0 -1
- package/dist/db-errors-CGN9kJfo.mjs.map +0 -1
- package/dist/error-CPh_8eLq.mjs.map +0 -1
- package/dist/index-Bv1Wf1zB.d.mts.map +0 -1
- package/dist/loader-Chm5h7Gr.mjs.map +0 -1
- package/dist/menus-C75SSmRy.mjs.map +0 -1
- package/dist/query-BJn8TOPk.mjs.map +0 -1
- package/dist/resolve-Cj98DuqN.mjs +0 -39
- package/dist/resolve-Cj98DuqN.mjs.map +0 -1
- package/dist/runner-CNHRo1mT.d.mts.map +0 -1
- package/dist/seo-BoR4wCUh.mjs.map +0 -1
- package/dist/version-Ct7C6RSo.mjs +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "emdash",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"description": "Astro-native CMS with WordPress migration support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -218,10 +218,10 @@
|
|
|
218
218
|
"upng-js": "^2.1.0",
|
|
219
219
|
"zod": "^4.4.1",
|
|
220
220
|
"@atcute/client": "^4.2.1",
|
|
221
|
-
"@emdash-cms/admin": "0.
|
|
222
|
-
"@emdash-cms/auth": "0.
|
|
223
|
-
"@emdash-cms/gutenberg-to-portable-text": "0.
|
|
224
|
-
"@emdash-cms/registry-client": "0.
|
|
221
|
+
"@emdash-cms/admin": "0.16.1",
|
|
222
|
+
"@emdash-cms/auth": "0.16.1",
|
|
223
|
+
"@emdash-cms/gutenberg-to-portable-text": "0.16.1",
|
|
224
|
+
"@emdash-cms/registry-client": "0.3.0",
|
|
225
225
|
"@emdash-cms/plugin-types": "0.0.1"
|
|
226
226
|
},
|
|
227
227
|
"optionalDependencies": {
|
|
@@ -248,14 +248,14 @@
|
|
|
248
248
|
"@types/react": "19.2.14",
|
|
249
249
|
"@types/sanitize-html": "^2.16.0",
|
|
250
250
|
"@types/sax": "^1.2.7",
|
|
251
|
-
"@vitest/ui": "^4.1.
|
|
251
|
+
"@vitest/ui": "^4.1.7",
|
|
252
252
|
"publint": "0.3.17",
|
|
253
253
|
"tsdown": "0.20.3",
|
|
254
254
|
"typescript": "^6.0.3",
|
|
255
255
|
"vite": "^6.0.0",
|
|
256
256
|
"vitest": "^4.1.5",
|
|
257
257
|
"zod-openapi": "^5.4.6",
|
|
258
|
-
"@emdash-cms/blocks": "0.
|
|
258
|
+
"@emdash-cms/blocks": "0.16.1"
|
|
259
259
|
},
|
|
260
260
|
"repository": {
|
|
261
261
|
"type": "git",
|
package/src/api/errors.ts
CHANGED
|
@@ -201,6 +201,7 @@ export const ErrorCode = {
|
|
|
201
201
|
AGGREGATOR_NOT_FOUND: "AGGREGATOR_NOT_FOUND",
|
|
202
202
|
CAPABILITY_ESCALATION: "CAPABILITY_ESCALATION",
|
|
203
203
|
ROUTE_VISIBILITY_ESCALATION: "ROUTE_VISIBILITY_ESCALATION",
|
|
204
|
+
ENV_INCOMPATIBLE: "ENV_INCOMPATIBLE",
|
|
204
205
|
INSTALL_FAILED: "INSTALL_FAILED",
|
|
205
206
|
UNINSTALL_FAILED: "UNINSTALL_FAILED",
|
|
206
207
|
SEARCH_FAILED: "SEARCH_FAILED",
|
|
@@ -414,6 +415,7 @@ export function mapErrorStatus(code: string | undefined): number {
|
|
|
414
415
|
case ErrorCode.ALREADY_INSTALLED:
|
|
415
416
|
case ErrorCode.ALREADY_CONFIGURED:
|
|
416
417
|
case ErrorCode.ALREADY_UP_TO_DATE:
|
|
418
|
+
case ErrorCode.ENV_INCOMPATIBLE:
|
|
417
419
|
return 409;
|
|
418
420
|
|
|
419
421
|
// 410 Gone
|
|
@@ -40,6 +40,8 @@
|
|
|
40
40
|
|
|
41
41
|
import { ClientResponseError, ClientValidationError } from "@atcute/client";
|
|
42
42
|
import type { Did } from "@atcute/lexicons";
|
|
43
|
+
import { checkEnvCompatibility, findSkippedEnvConstraints } from "@emdash-cms/registry-client/env";
|
|
44
|
+
import type { HostEnv } from "@emdash-cms/registry-client/env";
|
|
43
45
|
import type { Kysely } from "kysely";
|
|
44
46
|
|
|
45
47
|
import type { Database } from "../../database/types.js";
|
|
@@ -520,6 +522,52 @@ async function fetchArtifact(mirrors: string[], declaredUrl: string): Promise<Ui
|
|
|
520
522
|
);
|
|
521
523
|
}
|
|
522
524
|
|
|
525
|
+
/**
|
|
526
|
+
* The shape of a single env-compatibility failure returned to the admin in
|
|
527
|
+
* the `ENV_INCOMPATIBLE` error's `details`.
|
|
528
|
+
*/
|
|
529
|
+
interface EnvIncompatibleError {
|
|
530
|
+
code: "ENV_INCOMPATIBLE";
|
|
531
|
+
message: string;
|
|
532
|
+
details: { requires: Record<string, string>; host: HostEnv };
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Gate a release's `requires` constraints against the running host
|
|
537
|
+
* environment. `requires` is the lexicon-`unknown` value off the signed
|
|
538
|
+
* release record — never trust its shape; `checkEnvCompatibility` guards it.
|
|
539
|
+
*
|
|
540
|
+
* Returns `null` when every advertised constraint is satisfied (or there are
|
|
541
|
+
* none), or a structured `ENV_INCOMPATIBLE` error naming the unsatisfied
|
|
542
|
+
* constraints and the host versions. The error carries the guarded `requires`
|
|
543
|
+
* and `host` maps so the admin can render the same mismatch the UI gate shows.
|
|
544
|
+
*/
|
|
545
|
+
export function assertEnvCompatible(
|
|
546
|
+
requires: unknown,
|
|
547
|
+
hostEnv: HostEnv,
|
|
548
|
+
): EnvIncompatibleError | null {
|
|
549
|
+
// A constraint the host can't evaluate (unknown or unparseable host
|
|
550
|
+
// version) downgrades the gate to a no-op for that env. Log it so a
|
|
551
|
+
// silent bypass is observable rather than invisible.
|
|
552
|
+
for (const skipped of findSkippedEnvConstraints(requires, hostEnv)) {
|
|
553
|
+
console.warn(
|
|
554
|
+
`[registry] env compatibility constraint skipped: ${skipped.key} requires ${skipped.required} but host version is ${skipped.reason}`,
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
const mismatches = checkEnvCompatibility(requires, hostEnv);
|
|
558
|
+
if (mismatches.length === 0) return null;
|
|
559
|
+
const guarded: Record<string, string> = {};
|
|
560
|
+
for (const m of mismatches) guarded[m.key] = m.required;
|
|
561
|
+
const summary = mismatches
|
|
562
|
+
.map((m) => `${m.key} requires ${m.required} but host is ${m.host}`)
|
|
563
|
+
.join("; ");
|
|
564
|
+
return {
|
|
565
|
+
code: "ENV_INCOMPATIBLE",
|
|
566
|
+
message: `This release is not compatible with the current environment: ${summary}.`,
|
|
567
|
+
details: { requires: guarded, host: hostEnv },
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
|
|
523
571
|
// ── Install ────────────────────────────────────────────────────────
|
|
524
572
|
|
|
525
573
|
export async function handleRegistryInstall(
|
|
@@ -528,7 +576,7 @@ export async function handleRegistryInstall(
|
|
|
528
576
|
sandboxRunner: SandboxRunner | null,
|
|
529
577
|
registryConfigInput: RegistryConfigInput | undefined,
|
|
530
578
|
input: RegistryInstallInput,
|
|
531
|
-
opts?: { configuredPluginIds?: Set<string
|
|
579
|
+
opts?: { configuredPluginIds?: Set<string>; hostEnv?: HostEnv },
|
|
532
580
|
): Promise<ApiResult<RegistryInstallResult>> {
|
|
533
581
|
// Accept either the bare-string shorthand or the full
|
|
534
582
|
// `RegistryConfig` object (see `RegistryConfigInput`).
|
|
@@ -737,6 +785,17 @@ export async function handleRegistryInstall(
|
|
|
737
785
|
};
|
|
738
786
|
}
|
|
739
787
|
|
|
788
|
+
// Step 3b: environment compatibility. The signed release record may
|
|
789
|
+
// carry a `requires` block (`env:emdash`, `env:astro`, ...). Refuse
|
|
790
|
+
// the install if the running host doesn't satisfy a constraint, so a
|
|
791
|
+
// stale browser tab or non-UI caller can't bypass the admin's
|
|
792
|
+
// disabled Install button. `requires` is lexicon-`unknown`; the
|
|
793
|
+
// helper guards its shape.
|
|
794
|
+
if (opts?.hostEnv) {
|
|
795
|
+
const envError = assertEnvCompatible(releaseView.release?.requires, opts.hostEnv);
|
|
796
|
+
if (envError) return { success: false, error: envError };
|
|
797
|
+
}
|
|
798
|
+
|
|
740
799
|
// Step 3a: enforce the configured minimum release age. The browser
|
|
741
800
|
// applies the same check up front for UX, but the gate lives here
|
|
742
801
|
// -- a stale browser tab, a deep link, or a non-admin-UI caller
|
|
@@ -1212,6 +1271,7 @@ export async function handleRegistryUpdate(
|
|
|
1212
1271
|
version?: string;
|
|
1213
1272
|
confirmCapabilityChanges?: boolean;
|
|
1214
1273
|
confirmRouteVisibilityChanges?: boolean;
|
|
1274
|
+
hostEnv?: HostEnv;
|
|
1215
1275
|
},
|
|
1216
1276
|
): Promise<ApiResult<RegistryUpdateResult>> {
|
|
1217
1277
|
const registryConfig = coerceRegistryConfig(registryConfigInput);
|
|
@@ -1363,6 +1423,14 @@ export async function handleRegistryUpdate(
|
|
|
1363
1423
|
};
|
|
1364
1424
|
}
|
|
1365
1425
|
|
|
1426
|
+
// Environment compatibility gate. An ungated update could otherwise
|
|
1427
|
+
// land a version whose `requires` the host doesn't satisfy. Same
|
|
1428
|
+
// guard as install; `requires` is lexicon-`unknown`.
|
|
1429
|
+
if (opts?.hostEnv) {
|
|
1430
|
+
const envError = assertEnvCompatible(signedRelease.requires, opts.hostEnv);
|
|
1431
|
+
if (envError) return { success: false, error: envError };
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1366
1434
|
const declaredUrl = signedRelease.artifacts?.package?.url;
|
|
1367
1435
|
const declaredChecksum = signedRelease.artifacts?.package?.checksum;
|
|
1368
1436
|
if (!declaredUrl || !declaredChecksum) {
|
package/src/api/handlers/seo.ts
CHANGED
|
@@ -18,6 +18,17 @@ export interface SitemapContentEntry {
|
|
|
18
18
|
slug: string | null;
|
|
19
19
|
/** ISO date of last modification */
|
|
20
20
|
updatedAt: string;
|
|
21
|
+
/**
|
|
22
|
+
* Locale of this row (e.g. `"en"`, `"fr"`). Always present — rows in
|
|
23
|
+
* pre-i18n databases are backfilled to the configured `defaultLocale`.
|
|
24
|
+
*/
|
|
25
|
+
locale: string;
|
|
26
|
+
/**
|
|
27
|
+
* `translation_group` ULID shared across all locale variants of the
|
|
28
|
+
* same content. Used by the sitemap route to emit `hreflang`
|
|
29
|
+
* alternates between siblings.
|
|
30
|
+
*/
|
|
31
|
+
translationGroup: string | null;
|
|
21
32
|
}
|
|
22
33
|
|
|
23
34
|
/** Per-collection sitemap data with entries and URL pattern */
|
|
@@ -93,8 +104,10 @@ export async function handleSitemapData(
|
|
|
93
104
|
slug: string | null;
|
|
94
105
|
id: string;
|
|
95
106
|
updated_at: string;
|
|
107
|
+
locale: string;
|
|
108
|
+
translation_group: string | null;
|
|
96
109
|
}>`
|
|
97
|
-
SELECT c.slug, c.id, c.updated_at
|
|
110
|
+
SELECT c.slug, c.id, c.updated_at, c.locale, c.translation_group
|
|
98
111
|
FROM ${sql.ref(tableName)} c
|
|
99
112
|
LEFT JOIN _emdash_seo s
|
|
100
113
|
ON s.collection = ${col.slug}
|
|
@@ -114,6 +127,8 @@ export async function handleSitemapData(
|
|
|
114
127
|
id: row.id,
|
|
115
128
|
slug: row.slug,
|
|
116
129
|
updatedAt: row.updated_at,
|
|
130
|
+
locale: row.locale,
|
|
131
|
+
translationGroup: row.translation_group,
|
|
117
132
|
});
|
|
118
133
|
}
|
|
119
134
|
|
|
@@ -294,7 +294,7 @@ export async function generateSnapshot(
|
|
|
294
294
|
await sql<Record<string, unknown>>`
|
|
295
295
|
SELECT * FROM ${sql.raw(`"${tableName}"`)}
|
|
296
296
|
WHERE deleted_at IS NULL
|
|
297
|
-
AND (status = 'published' OR (status = 'scheduled' AND scheduled_at <=
|
|
297
|
+
AND (status = 'published' OR (status = 'scheduled' AND scheduled_at <= strftime('%Y-%m-%dT%H:%M:%fZ', 'now')))
|
|
298
298
|
`.execute(db)
|
|
299
299
|
).rows;
|
|
300
300
|
}
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* to avoid bundling Node.js-only code into the production build.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
import { createRequire } from "node:module";
|
|
14
|
+
|
|
13
15
|
import type { AstroIntegration, AstroIntegrationLogger } from "astro";
|
|
14
16
|
|
|
15
17
|
import { validateAllowedOrigins, validateOriginShape } from "../../auth/allowed-origins.js";
|
|
@@ -34,6 +36,23 @@ export type {
|
|
|
34
36
|
} from "./runtime.js";
|
|
35
37
|
export { getStoredConfig } from "./runtime.js";
|
|
36
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Resolve the version of Astro the host project is building with, by reading
|
|
41
|
+
* `astro/package.json` from the project's own dependency tree. Surfaced to the
|
|
42
|
+
* admin and the registry install gate so a plugin's `env:astro` constraint can
|
|
43
|
+
* be evaluated against the real host version. Returns `undefined` if Astro
|
|
44
|
+
* can't be resolved (shouldn't happen in a real build, but never throw here).
|
|
45
|
+
*/
|
|
46
|
+
function resolveAstroVersion(): string | undefined {
|
|
47
|
+
try {
|
|
48
|
+
const require = createRequire(import.meta.url);
|
|
49
|
+
const pkg = require("astro/package.json") as { version?: unknown };
|
|
50
|
+
return typeof pkg.version === "string" ? pkg.version : undefined;
|
|
51
|
+
} catch {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
37
56
|
/** Default storage: Local filesystem in .emdash directory */
|
|
38
57
|
const DEFAULT_STORAGE = local({
|
|
39
58
|
directory: "./.emdash/uploads",
|
|
@@ -204,6 +223,13 @@ export function emdash(config: EmDashConfig = {}): AstroIntegration {
|
|
|
204
223
|
command,
|
|
205
224
|
}) => {
|
|
206
225
|
printBanner(logger);
|
|
226
|
+
// Capture the host's Astro version so the runtime can expose it
|
|
227
|
+
// to the admin and the registry install gate for `env:astro`
|
|
228
|
+
// constraint checks.
|
|
229
|
+
const astroVersion = resolveAstroVersion();
|
|
230
|
+
if (astroVersion !== undefined) {
|
|
231
|
+
serializableConfig.astroVersion = astroVersion;
|
|
232
|
+
}
|
|
207
233
|
// Extract i18n config from Astro config
|
|
208
234
|
// Astro locales can be strings OR { path, codes } objects — normalize to paths
|
|
209
235
|
if (astroConfig.i18n) {
|
|
@@ -382,6 +382,11 @@ export function injectCoreRoutes(injectRoute: InjectRoute): void {
|
|
|
382
382
|
entrypoint: resolveRoute("api/admin/plugins/registry/install.ts"),
|
|
383
383
|
});
|
|
384
384
|
|
|
385
|
+
injectRoute({
|
|
386
|
+
pattern: "/_emdash/api/admin/plugins/registry/artifact",
|
|
387
|
+
entrypoint: resolveRoute("api/admin/plugins/registry/artifact.ts"),
|
|
388
|
+
});
|
|
389
|
+
|
|
385
390
|
injectRoute({
|
|
386
391
|
pattern: "/_emdash/api/admin/plugins/[id]/update",
|
|
387
392
|
entrypoint: resolveRoute("api/admin/plugins/[id]/update.ts"),
|
|
@@ -527,6 +527,14 @@ export interface EmDashConfig {
|
|
|
527
527
|
/** URL or path to a custom favicon for the admin panel. */
|
|
528
528
|
favicon?: string;
|
|
529
529
|
};
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Version of Astro the host project is building with. Populated by the
|
|
533
|
+
* integration's `astro:config:setup` hook (not authored by the user) and
|
|
534
|
+
* surfaced to the admin and the registry install gate so a plugin's
|
|
535
|
+
* `env:astro` requirement can be evaluated against the real host version.
|
|
536
|
+
*/
|
|
537
|
+
astroVersion?: string;
|
|
530
538
|
}
|
|
531
539
|
|
|
532
540
|
const STORED_CONFIG_KEY = Symbol.for("emdash:stored-config");
|
package/src/astro/middleware.ts
CHANGED
|
@@ -51,6 +51,7 @@ import {
|
|
|
51
51
|
runWithContext,
|
|
52
52
|
} from "../request-context.js";
|
|
53
53
|
import type { EmDashConfig } from "./integration/runtime.js";
|
|
54
|
+
import { createPublicPluginApiRouteHandler } from "./public-plugin-api-routes.js";
|
|
54
55
|
import type { EmDashHandlers } from "./types.js";
|
|
55
56
|
|
|
56
57
|
// Cached runtime instance (persists across requests within worker)
|
|
@@ -368,8 +369,10 @@ export const onRequest = defineMiddleware(async (context, next) => {
|
|
|
368
369
|
try {
|
|
369
370
|
const runtime = await getRuntime(config, initSubTimings);
|
|
370
371
|
setupVerified = true;
|
|
372
|
+
const handlePublicPluginApiRoute = createPublicPluginApiRouteHandler(runtime);
|
|
371
373
|
// eslint-disable-next-line typescript/no-unsafe-type-assertion -- partial object; getPageRuntime() only checks for the page-contribution methods
|
|
372
374
|
locals.emdash = {
|
|
375
|
+
handlePublicPluginApiRoute,
|
|
373
376
|
collectPageMetadata: runtime.collectPageMetadata.bind(runtime),
|
|
374
377
|
collectPageFragments: runtime.collectPageFragments.bind(runtime),
|
|
375
378
|
getPublicMediaUrl: createPublicMediaUrlResolver(runtime.storage),
|
|
@@ -496,6 +499,7 @@ export const onRequest = defineMiddleware(async (context, next) => {
|
|
|
496
499
|
|
|
497
500
|
// Plugin routes
|
|
498
501
|
handlePluginApiRoute: runtime.handlePluginApiRoute.bind(runtime),
|
|
502
|
+
handlePublicPluginApiRoute: createPublicPluginApiRouteHandler(runtime),
|
|
499
503
|
getPluginRouteMeta: runtime.getPluginRouteMeta.bind(runtime),
|
|
500
504
|
|
|
501
505
|
// Media provider methods
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { HandlerResponse } from "./types.js";
|
|
2
|
+
|
|
3
|
+
export type PublicPluginApiRouteHandler = (
|
|
4
|
+
pluginId: string,
|
|
5
|
+
method: string,
|
|
6
|
+
path: string,
|
|
7
|
+
request: Request,
|
|
8
|
+
) => Promise<HandlerResponse>;
|
|
9
|
+
|
|
10
|
+
interface PublicPluginApiRouteRuntime {
|
|
11
|
+
getPluginRouteMeta(pluginId: string, path: string): { public: boolean } | null;
|
|
12
|
+
handlePluginApiRoute(
|
|
13
|
+
pluginId: string,
|
|
14
|
+
method: string,
|
|
15
|
+
path: string,
|
|
16
|
+
request: Request,
|
|
17
|
+
): Promise<HandlerResponse>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function pluginRouteNotFound(): HandlerResponse {
|
|
21
|
+
return {
|
|
22
|
+
success: false,
|
|
23
|
+
error: {
|
|
24
|
+
code: "NOT_FOUND",
|
|
25
|
+
message: "Plugin route not found",
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function createPublicPluginApiRouteHandler(
|
|
31
|
+
runtime: PublicPluginApiRouteRuntime,
|
|
32
|
+
): PublicPluginApiRouteHandler {
|
|
33
|
+
return async (pluginId, method, path, request) => {
|
|
34
|
+
const meta = runtime.getPluginRouteMeta(pluginId, path);
|
|
35
|
+
if (meta?.public !== true) {
|
|
36
|
+
return pluginRouteNotFound();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return runtime.handlePluginApiRoute(pluginId, method, path, request);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* routes and `confirmRouteVisibilityChanges` is absent.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
import { hostEnvFromVersions } from "@emdash-cms/registry-client/env";
|
|
12
13
|
import type { APIRoute } from "astro";
|
|
13
14
|
import { z } from "zod";
|
|
14
15
|
|
|
@@ -17,6 +18,8 @@ import { apiError, handleError, unwrapResult } from "#api/error.js";
|
|
|
17
18
|
import { handleRegistryUpdate } from "#api/index.js";
|
|
18
19
|
import { isParseError, parseOptionalBody } from "#api/parse.js";
|
|
19
20
|
|
|
21
|
+
import { VERSION } from "../../../../../../../version.js";
|
|
22
|
+
|
|
20
23
|
export const prerender = false;
|
|
21
24
|
|
|
22
25
|
const updateBodySchema = z.object({
|
|
@@ -64,6 +67,7 @@ export const POST: APIRoute = async ({ params, request, locals }) => {
|
|
|
64
67
|
version: body.version,
|
|
65
68
|
confirmCapabilityChanges: body.confirmCapabilityChanges,
|
|
66
69
|
confirmRouteVisibilityChanges: body.confirmRouteVisibilityChanges,
|
|
70
|
+
hostEnv: hostEnvFromVersions(VERSION, emdash.config.astroVersion),
|
|
67
71
|
},
|
|
68
72
|
);
|
|
69
73
|
|