emdash 0.24.1 → 0.25.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.d.mts +2 -2
- package/dist/api/route-utils.mjs +9 -8
- package/dist/api/route-utils.mjs.map +1 -1
- package/dist/api/schemas/index.d.mts +1 -1
- package/dist/api/schemas/index.mjs +2 -2
- package/dist/{api-d_0wi9fW.mjs → api-D2_sbavn.mjs} +16 -12
- package/dist/api-D2_sbavn.mjs.map +1 -0
- package/dist/{apply-BE9UaWX0.mjs → apply-Bk2mAuLn.mjs} +11 -10
- package/dist/apply-Bk2mAuLn.mjs.map +1 -0
- package/dist/astro/index.d.mts +6 -6
- package/dist/astro/index.mjs +2 -2
- package/dist/astro/middleware/auth.d.mts +5 -5
- package/dist/astro/middleware/auth.mjs +1 -1
- package/dist/astro/middleware/redirect.mjs +2 -2
- package/dist/astro/middleware.d.mts.map +1 -1
- package/dist/astro/middleware.mjs +66 -37
- package/dist/astro/middleware.mjs.map +1 -1
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +4 -4
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +4 -4
- package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +1 -1
- package/dist/astro/routes/api/admin/api-tokens/index.mjs +2 -2
- package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +2 -2
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +5 -5
- package/dist/astro/routes/api/admin/byline-fields/index.mjs +5 -5
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +5 -5
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +7 -7
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +7 -7
- package/dist/astro/routes/api/admin/bylines/index.mjs +7 -7
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +5 -5
- package/dist/astro/routes/api/admin/comments/_id_.mjs +2 -2
- package/dist/astro/routes/api/admin/comments/bulk.mjs +5 -5
- package/dist/astro/routes/api/admin/comments/counts.mjs +2 -2
- package/dist/astro/routes/api/admin/comments/index.mjs +5 -5
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +3 -3
- package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +2 -2
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +2 -2
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs +2 -2
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +20 -20
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +20 -20
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +20 -20
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +20 -20
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +20 -20
- package/dist/astro/routes/api/admin/plugins/index.mjs +20 -20
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +2 -2
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +20 -20
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +20 -20
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +20 -20
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +20 -20
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +21 -21
- package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +20 -20
- package/dist/astro/routes/api/admin/plugins/registry/install.mjs +21 -21
- package/dist/astro/routes/api/admin/plugins/updates.mjs +20 -20
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +20 -20
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +2 -2
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +20 -20
- package/dist/astro/routes/api/admin/users/_id_/disable.mjs +1 -1
- package/dist/astro/routes/api/admin/users/_id_/enable.mjs +1 -1
- package/dist/astro/routes/api/admin/users/_id_/index.mjs +4 -4
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +1 -1
- package/dist/astro/routes/api/admin/users/index.mjs +4 -4
- package/dist/astro/routes/api/auth/dev-bypass.mjs +1 -1
- package/dist/astro/routes/api/auth/invite/accept.mjs +1 -1
- package/dist/astro/routes/api/auth/invite/complete.mjs +4 -4
- package/dist/astro/routes/api/auth/invite/index.mjs +4 -4
- package/dist/astro/routes/api/auth/invite/register-options.mjs +4 -4
- package/dist/astro/routes/api/auth/logout.mjs +1 -1
- package/dist/astro/routes/api/auth/magic-link/send.mjs +5 -5
- package/dist/astro/routes/api/auth/magic-link/verify.mjs +1 -1
- package/dist/astro/routes/api/auth/me.mjs +4 -4
- package/dist/astro/routes/api/auth/passkey/_id_.mjs +4 -4
- package/dist/astro/routes/api/auth/passkey/index.mjs +1 -1
- package/dist/astro/routes/api/auth/passkey/options.mjs +5 -5
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +4 -4
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +4 -4
- package/dist/astro/routes/api/auth/passkey/verify.mjs +4 -4
- package/dist/astro/routes/api/auth/signup/complete.mjs +4 -4
- package/dist/astro/routes/api/auth/signup/request.mjs +5 -5
- package/dist/astro/routes/api/auth/signup/verify.mjs +1 -1
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +4 -4
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +4 -4
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +8 -8
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/authors.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/index.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/trash.mjs +5 -5
- package/dist/astro/routes/api/dashboard.mjs +5 -5
- package/dist/astro/routes/api/dev/emails.mjs +1 -1
- package/dist/astro/routes/api/import/probe.mjs +5 -5
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +2 -2
- package/dist/astro/routes/api/import/wordpress/execute.d.mts +5 -5
- package/dist/astro/routes/api/import/wordpress/execute.mjs +4 -4
- package/dist/astro/routes/api/import/wordpress/media.d.mts +13 -1
- package/dist/astro/routes/api/import/wordpress/media.d.mts.map +1 -1
- package/dist/astro/routes/api/import/wordpress/media.mjs +12 -8
- package/dist/astro/routes/api/import/wordpress/media.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +6 -6
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +7 -7
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +5 -5
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +5 -5
- package/dist/astro/routes/api/manifest.mjs +2 -2
- package/dist/astro/routes/api/mcp.mjs +20 -20
- package/dist/astro/routes/api/media/_id_/confirm.d.mts.map +1 -1
- package/dist/astro/routes/api/media/_id_/confirm.mjs +43 -7
- package/dist/astro/routes/api/media/_id_/confirm.mjs.map +1 -1
- package/dist/astro/routes/api/media/_id_.mjs +5 -5
- package/dist/astro/routes/api/media/file/_...key_.mjs +1 -1
- package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +2 -2
- package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +2 -2
- package/dist/astro/routes/api/media/providers/index.mjs +2 -2
- package/dist/astro/routes/api/media/upload-url.mjs +7 -7
- package/dist/astro/routes/api/media.mjs +21 -20
- package/dist/astro/routes/api/media.mjs.map +1 -1
- 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 +2 -2
- package/dist/astro/routes/api/oauth/device/code.mjs +3 -3
- package/dist/astro/routes/api/oauth/device/token.mjs +3 -3
- package/dist/astro/routes/api/oauth/register.mjs +1 -1
- package/dist/astro/routes/api/oauth/token/refresh.mjs +2 -2
- package/dist/astro/routes/api/oauth/token/revoke.mjs +2 -2
- package/dist/astro/routes/api/oauth/token.mjs +1 -1
- package/dist/astro/routes/api/openapi.json.mjs +2 -2
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +2 -2
- package/dist/astro/routes/api/redirects/404s/index.mjs +5 -5
- package/dist/astro/routes/api/redirects/404s/summary.mjs +5 -5
- package/dist/astro/routes/api/redirects/_id_.mjs +6 -6
- package/dist/astro/routes/api/redirects/index.mjs +6 -6
- package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +2 -2
- package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +2 -2
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +20 -20
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +20 -20
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +20 -20
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +20 -20
- package/dist/astro/routes/api/schema/collections/index.mjs +20 -20
- package/dist/astro/routes/api/schema/index.mjs +3 -3
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +20 -20
- package/dist/astro/routes/api/schema/orphans/index.mjs +20 -20
- 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 +4 -4
- package/dist/astro/routes/api/search/suggest.mjs +6 -6
- package/dist/astro/routes/api/sections/_slug_.mjs +7 -7
- package/dist/astro/routes/api/sections/index.mjs +7 -7
- package/dist/astro/routes/api/settings/email.mjs +3 -3
- package/dist/astro/routes/api/settings.mjs +9 -9
- package/dist/astro/routes/api/setup/admin-verify.mjs +4 -4
- package/dist/astro/routes/api/setup/admin.mjs +4 -4
- package/dist/astro/routes/api/setup/dev-bypass.mjs +7 -7
- package/dist/astro/routes/api/setup/dev-reset.mjs +1 -1
- package/dist/astro/routes/api/setup/index.mjs +10 -10
- package/dist/astro/routes/api/setup/status.mjs +1 -1
- package/dist/astro/routes/api/snapshot.mjs +2 -2
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +8 -8
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +8 -8
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +8 -8
- package/dist/astro/routes/api/taxonomies/index.mjs +8 -8
- package/dist/astro/routes/api/themes/preview.mjs +2 -2
- package/dist/astro/routes/api/typegen.mjs +3 -3
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +5 -5
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +7 -7
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +7 -7
- package/dist/astro/routes/api/widget-areas/_name_.mjs +4 -4
- package/dist/astro/routes/api/widget-areas/index.mjs +7 -7
- package/dist/astro/routes/api/widget-components.mjs +1 -1
- package/dist/astro/routes/robots.txt.mjs +3 -3
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +4 -4
- package/dist/astro/routes/sitemap.xml.mjs +4 -4
- package/dist/astro/types.d.mts +7 -7
- package/dist/{authorize-B__u-iZJ.mjs → authorize-CuxZ0i2t.mjs} +2 -2
- package/dist/{authorize-B__u-iZJ.mjs.map → authorize-CuxZ0i2t.mjs.map} +1 -1
- package/dist/{byline-fields-Ca56gaT6.d.mts → byline-fields-KD3JFRuH.d.mts} +24 -6
- package/dist/byline-fields-KD3JFRuH.d.mts.map +1 -0
- package/dist/{byline-fields-B-KXkg5R.mjs → byline-fields-eyJMblSr.mjs} +2 -2
- package/dist/{byline-fields-B-KXkg5R.mjs.map → byline-fields-eyJMblSr.mjs.map} +1 -1
- package/dist/{bylines-BMtJnPnG.mjs → bylines-CPc_q2Vd.mjs} +4 -4
- package/dist/{bylines-BMtJnPnG.mjs.map → bylines-CPc_q2Vd.mjs.map} +1 -1
- package/dist/{cache-BUJe2w6Z.mjs → cache-C35VWD5D.mjs} +1 -1
- package/dist/{cache-BUJe2w6Z.mjs.map → cache-C35VWD5D.mjs.map} +1 -1
- package/dist/cli/index.mjs +8 -8
- package/dist/{content-PoVGKjp0.mjs → content-B43-YrIq.mjs} +7 -5
- package/dist/content-B43-YrIq.mjs.map +1 -0
- package/dist/{context-Dvws41_A.mjs → context-BW3N7wyt.mjs} +12 -6
- package/dist/context-BW3N7wyt.mjs.map +1 -0
- package/dist/{dashboard-DsYU8JKS.mjs → dashboard-FIe0S512.mjs} +3 -3
- package/dist/{dashboard-DsYU8JKS.mjs.map → dashboard-FIe0S512.mjs.map} +1 -1
- package/dist/{db-errors-UXB1CK42.mjs → db-errors-CK46D-ly.mjs} +1 -1
- package/dist/{db-errors-UXB1CK42.mjs.map → db-errors-CK46D-ly.mjs.map} +1 -1
- package/dist/{placeholder-B0s2mWu5.mjs → enrich-BQ0mxJRs.mjs} +61 -10
- package/dist/enrich-BQ0mxJRs.mjs.map +1 -0
- package/dist/{error-lq_fL-RS.mjs → error-DXnK2wF4.mjs} +2 -1
- package/dist/error-DXnK2wF4.mjs.map +1 -0
- package/dist/{index-BroXT-vD.d.mts → index-Cz6_JBL3.d.mts} +21 -8
- package/dist/index-Cz6_JBL3.d.mts.map +1 -0
- package/dist/index.d.mts +8 -8
- package/dist/index.mjs +28 -28
- package/dist/{loader-BR2SgfEc.mjs → loader-DrpofRon.mjs} +2 -2
- package/dist/{loader-BR2SgfEc.mjs.map → loader-DrpofRon.mjs.map} +1 -1
- package/dist/{manifest-schema-BWKnQYQF.mjs → manifest-schema-BOfPXse0.mjs} +2 -1
- package/dist/manifest-schema-BOfPXse0.mjs.map +1 -0
- package/dist/media/image-endpoint.mjs +1 -1
- package/dist/media/index.d.mts +45 -2
- package/dist/media/index.d.mts.map +1 -1
- package/dist/media/index.mjs +5 -3
- package/dist/media/index.mjs.map +1 -1
- package/dist/media/local-runtime.d.mts +6 -6
- package/dist/media/local-runtime.d.mts.map +1 -1
- package/dist/media/local-runtime.mjs +15 -3
- package/dist/media/local-runtime.mjs.map +1 -1
- package/dist/{media-CTjJoJTh.mjs → media-BjKxjzk8.mjs} +3 -1
- package/dist/media-BjKxjzk8.mjs.map +1 -0
- package/dist/{media-allowlist-B77I5_bw.mjs → media-allowlist-Du8t1u6a.mjs} +2 -2
- package/dist/{media-allowlist-B77I5_bw.mjs.map → media-allowlist-Du8t1u6a.mjs.map} +1 -1
- package/dist/{menus-GvRSpgIA.mjs → menus-CxqJ-z-N.mjs} +46 -4
- package/dist/menus-CxqJ-z-N.mjs.map +1 -0
- package/dist/{mime-BTzvzJ8M.mjs → mime-CCEzze7W.mjs} +1 -1
- package/dist/{mime-BTzvzJ8M.mjs.map → mime-CCEzze7W.mjs.map} +1 -1
- package/dist/{normalize-ClbNIenm.mjs → normalize-CeglrBT9.mjs} +11 -2
- package/dist/normalize-CeglrBT9.mjs.map +1 -0
- package/dist/{options-CqECG0gM.d.mts → options-BvClpP5Q.d.mts} +2 -2
- package/dist/{options-CqECG0gM.d.mts.map → options-BvClpP5Q.d.mts.map} +1 -1
- package/dist/page/index.d.mts +1 -1
- package/dist/{parse-DHI873qU.mjs → parse-DqMWHQ8x.mjs} +2 -2
- package/dist/{parse-DHI873qU.mjs.map → parse-DqMWHQ8x.mjs.map} +1 -1
- package/dist/{placeholder-QoI4gEzP.d.mts → placeholder-Cuce9U-m.d.mts} +20 -5
- package/dist/placeholder-Cuce9U-m.d.mts.map +1 -0
- package/dist/plugin-types.d.mts +2 -1
- package/dist/plugin-types.d.mts.map +1 -1
- package/dist/plugin-utils.d.mts +5 -5
- package/dist/plugins/adapt-sandbox-entry.d.mts +5 -5
- package/dist/plugins/adapt-sandbox-entry.mjs +1 -1
- package/dist/{query-DZdlS6Cu.mjs → query-34pfm02Q.mjs} +11 -11
- package/dist/{query-DZdlS6Cu.mjs.map → query-34pfm02Q.mjs.map} +1 -1
- package/dist/{rate-limit-D1Y6VFVP.mjs → rate-limit-CBQK4ygJ.mjs} +2 -2
- package/dist/{rate-limit-D1Y6VFVP.mjs.map → rate-limit-CBQK4ygJ.mjs.map} +1 -1
- package/dist/{redirects-x9eFPeyi.mjs → redirects-Dcbuisoj.mjs} +2 -1
- package/dist/redirects-Dcbuisoj.mjs.map +1 -0
- package/dist/{registry-CJkCubOJ.mjs → registry-3aOAS4My.mjs} +11 -1
- package/dist/registry-3aOAS4My.mjs.map +1 -0
- package/dist/runtime.d.mts +6 -6
- package/dist/runtime.mjs +1 -1
- package/dist/{schema-DMjXuvNU.mjs → schema-BGwx8AQY.mjs} +3 -3
- package/dist/{schema-DMjXuvNU.mjs.map → schema-BGwx8AQY.mjs.map} +1 -1
- package/dist/{search-D1wKk3lc.mjs → search-Gl747zMP.mjs} +2 -2
- package/dist/{search-D1wKk3lc.mjs.map → search-Gl747zMP.mjs.map} +1 -1
- package/dist/{sections-CCMic8dB.mjs → sections-C-umuuLj.mjs} +2 -2
- package/dist/{sections-CCMic8dB.mjs.map → sections-C-umuuLj.mjs.map} +1 -1
- package/dist/seed/index.d.mts +1 -1
- package/dist/seed/index.mjs +6 -6
- package/dist/seo/index.d.mts +1 -1
- package/dist/{seo-3QrZ1EPT.mjs → seo-BNzkiK_W.mjs} +1 -1
- package/dist/{seo-3QrZ1EPT.mjs.map → seo-BNzkiK_W.mjs.map} +1 -1
- package/dist/{seo-DCEF-AVr.mjs → seo-BkhuuaaE.mjs} +25 -3
- package/dist/seo-BkhuuaaE.mjs.map +1 -0
- package/dist/{settings-D9rvaLuY.mjs → settings-C4tXRYiG.mjs} +3 -3
- package/dist/{settings-D9rvaLuY.mjs.map → settings-C4tXRYiG.mjs.map} +1 -1
- package/dist/{settings-C3Yi5Co3.mjs → settings-fPSR6dJa.mjs} +2 -2
- package/dist/{settings-C3Yi5Co3.mjs.map → settings-fPSR6dJa.mjs.map} +1 -1
- package/dist/{taxonomies-DhLaNJji.mjs → taxonomies-DbAtL6m4.mjs} +2 -2
- package/dist/{taxonomies-DhLaNJji.mjs.map → taxonomies-DbAtL6m4.mjs.map} +1 -1
- package/dist/{taxonomies-CurpLtNC.mjs → taxonomies-n8w72lLQ.mjs} +4 -4
- package/dist/{taxonomies-CurpLtNC.mjs.map → taxonomies-n8w72lLQ.mjs.map} +1 -1
- package/dist/{types-CTLJYMhN.d.mts → types-CNlaBFzx.d.mts} +11 -1
- package/dist/{types-CTLJYMhN.d.mts.map → types-CNlaBFzx.d.mts.map} +1 -1
- package/dist/{types-BWh2MjmA.d.mts → types-ETmO_jQr.d.mts} +2 -2
- package/dist/{types-BWh2MjmA.d.mts.map → types-ETmO_jQr.d.mts.map} +1 -1
- package/dist/{types-TTx8uP7V.d.mts → types-h2Cwbzi2.d.mts} +6 -3
- package/dist/{types-TTx8uP7V.d.mts.map → types-h2Cwbzi2.d.mts.map} +1 -1
- package/dist/types-tM44hEcf.mjs.map +1 -1
- package/dist/{validate-DOFrIb-c.d.mts → validate-Va_An3qb.d.mts} +2 -2
- package/dist/{validate-DOFrIb-c.d.mts.map → validate-Va_An3qb.d.mts.map} +1 -1
- package/dist/{validation-CY1gk4Ar.mjs → validation-B6DKPTtU.mjs} +3 -3
- package/dist/{validation-CY1gk4Ar.mjs.map → validation-B6DKPTtU.mjs.map} +1 -1
- package/dist/version-DHdCA24u.mjs +7 -0
- package/dist/{version-C0JPFUG8.mjs.map → version-DHdCA24u.mjs.map} +1 -1
- package/dist/{widgets-Dri0spI4.mjs → widgets-C2RbFN0G.mjs} +2 -2
- package/dist/{widgets-Dri0spI4.mjs.map → widgets-C2RbFN0G.mjs.map} +1 -1
- package/package.json +6 -6
- package/src/api/errors.ts +1 -0
- package/src/api/handlers/content.ts +4 -4
- package/src/api/handlers/seo.ts +30 -2
- package/src/api/schemas/schema.ts +1 -0
- package/src/astro/middleware.ts +14 -1
- package/src/astro/routes/api/import/wordpress/media.ts +9 -3
- package/src/astro/routes/api/media/[id]/confirm.ts +62 -2
- package/src/astro/routes/api/media.ts +17 -19
- package/src/components/EmDashImage.astro +4 -7
- package/src/components/Image.astro +14 -4
- package/src/components/InlinePortableTextEditor.tsx +48 -1
- package/src/database/repositories/content.ts +8 -5
- package/src/database/repositories/media.ts +9 -1
- package/src/emdash-runtime.ts +39 -1
- package/src/media/enrich.ts +78 -0
- package/src/media/index.ts +1 -0
- package/src/media/local-runtime.ts +19 -0
- package/src/media/normalize.ts +20 -1
- package/src/media/placeholder.ts +29 -9
- package/src/media/types.ts +14 -0
- package/src/plugin-types.ts +2 -0
- package/src/plugins/context.ts +8 -0
- package/src/plugins/hooks.ts +45 -0
- package/src/plugins/index.ts +1 -0
- package/src/plugins/manager.ts +11 -0
- package/src/plugins/manifest-schema.ts +1 -0
- package/src/plugins/types.ts +7 -0
- package/src/schema/registry.ts +25 -0
- package/src/schema/types.ts +10 -0
- package/src/seed/apply.ts +1 -0
- package/dist/api-d_0wi9fW.mjs.map +0 -1
- package/dist/apply-BE9UaWX0.mjs.map +0 -1
- package/dist/byline-fields-Ca56gaT6.d.mts.map +0 -1
- package/dist/content-PoVGKjp0.mjs.map +0 -1
- package/dist/context-Dvws41_A.mjs.map +0 -1
- package/dist/error-lq_fL-RS.mjs.map +0 -1
- package/dist/index-BroXT-vD.d.mts.map +0 -1
- package/dist/manifest-schema-BWKnQYQF.mjs.map +0 -1
- package/dist/media-CTjJoJTh.mjs.map +0 -1
- package/dist/menus-GvRSpgIA.mjs.map +0 -1
- package/dist/normalize-ClbNIenm.mjs.map +0 -1
- package/dist/placeholder-B0s2mWu5.mjs.map +0 -1
- package/dist/placeholder-QoI4gEzP.d.mts.map +0 -1
- package/dist/redirects-x9eFPeyi.mjs.map +0 -1
- package/dist/registry-CJkCubOJ.mjs.map +0 -1
- package/dist/seo-DCEF-AVr.mjs.map +0 -1
- package/dist/version-C0JPFUG8.mjs +0 -7
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import "../../../../../base64-CmWvODNW.mjs";
|
|
2
2
|
import "../../../../../types-CmI1OyQg.mjs";
|
|
3
3
|
import { t as OptionsRepository } from "../../../../../options-DTTML-Tx.mjs";
|
|
4
|
-
import { n as apiSuccess, t as apiError } from "../../../../../error-
|
|
5
|
-
import { n as parseBody, t as isParseError } from "../../../../../parse-
|
|
6
|
-
import "../../../../../redirects-
|
|
7
|
-
import { k as signupRequestBody } from "../../../../../byline-fields-
|
|
4
|
+
import { n as apiSuccess, t as apiError } from "../../../../../error-DXnK2wF4.mjs";
|
|
5
|
+
import { n as parseBody, t as isParseError } from "../../../../../parse-DqMWHQ8x.mjs";
|
|
6
|
+
import "../../../../../redirects-Dcbuisoj.mjs";
|
|
7
|
+
import { k as signupRequestBody } from "../../../../../byline-fields-eyJMblSr.mjs";
|
|
8
8
|
import "../../../../../status-vUK0SA17.mjs";
|
|
9
9
|
import "../../../../../api/schemas/index.mjs";
|
|
10
10
|
import { t as getTrustedProxyHeaders } from "../../../../../trusted-proxy-DZY5WCn2.mjs";
|
|
11
11
|
import { t as getSiteBaseUrl } from "../../../../../site-url-BLebyON8.mjs";
|
|
12
|
-
import { n as getClientIp, t as checkRateLimit } from "../../../../../rate-limit-
|
|
12
|
+
import { n as getClientIp, t as checkRateLimit } from "../../../../../rate-limit-CBQK4ygJ.mjs";
|
|
13
13
|
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
|
14
14
|
import { requestSignup } from "@emdash-cms/auth";
|
|
15
15
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../../../../base64-CmWvODNW.mjs";
|
|
2
2
|
import "../../../../../types-CmI1OyQg.mjs";
|
|
3
|
-
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-
|
|
3
|
+
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-DXnK2wF4.mjs";
|
|
4
4
|
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
|
5
5
|
import { SignupError, roleFromLevel, validateSignupToken } from "@emdash-cms/auth";
|
|
6
6
|
|
|
@@ -5,10 +5,10 @@ import "../../../../../../base64-CmWvODNW.mjs";
|
|
|
5
5
|
import "../../../../../../types-CmI1OyQg.mjs";
|
|
6
6
|
import { t as CommentRepository } from "../../../../../../comment-BDx50EX5.mjs";
|
|
7
7
|
import "../../../../../../options-DTTML-Tx.mjs";
|
|
8
|
-
import { a as unwrapResult, i as requireDb, n as apiSuccess, r as handleError, t as apiError } from "../../../../../../error-
|
|
9
|
-
import { n as parseBody, t as isParseError } from "../../../../../../parse-
|
|
10
|
-
import { yt as createCommentBody } from "../../../../../../redirects-
|
|
11
|
-
import "../../../../../../byline-fields-
|
|
8
|
+
import { a as unwrapResult, i as requireDb, n as apiSuccess, r as handleError, t as apiError } from "../../../../../../error-DXnK2wF4.mjs";
|
|
9
|
+
import { n as parseBody, t as isParseError } from "../../../../../../parse-DqMWHQ8x.mjs";
|
|
10
|
+
import { yt as createCommentBody } from "../../../../../../redirects-Dcbuisoj.mjs";
|
|
11
|
+
import "../../../../../../byline-fields-eyJMblSr.mjs";
|
|
12
12
|
import "../../../../../../status-vUK0SA17.mjs";
|
|
13
13
|
import "../../../../../../api/schemas/index.mjs";
|
|
14
14
|
import { t as extractRequestMeta } from "../../../../../../request-meta-CmS1tDFf.mjs";
|
|
@@ -4,10 +4,10 @@ import "../../../../../../base64-CmWvODNW.mjs";
|
|
|
4
4
|
import "../../../../../../types-CmI1OyQg.mjs";
|
|
5
5
|
import "../../../../../../comment-BDx50EX5.mjs";
|
|
6
6
|
import "../../../../../../options-DTTML-Tx.mjs";
|
|
7
|
-
import { a as unwrapResult, i as requireDb, n as apiSuccess, r as handleError, t as apiError } from "../../../../../../error-
|
|
8
|
-
import { n as parseBody, t as isParseError } from "../../../../../../parse-
|
|
9
|
-
import { bt as createReactionBody } from "../../../../../../redirects-
|
|
10
|
-
import "../../../../../../byline-fields-
|
|
7
|
+
import { a as unwrapResult, i as requireDb, n as apiSuccess, r as handleError, t as apiError } from "../../../../../../error-DXnK2wF4.mjs";
|
|
8
|
+
import { n as parseBody, t as isParseError } from "../../../../../../parse-DqMWHQ8x.mjs";
|
|
9
|
+
import { bt as createReactionBody } from "../../../../../../redirects-Dcbuisoj.mjs";
|
|
10
|
+
import "../../../../../../byline-fields-eyJMblSr.mjs";
|
|
11
11
|
import "../../../../../../status-vUK0SA17.mjs";
|
|
12
12
|
import "../../../../../../api/schemas/index.mjs";
|
|
13
13
|
import { t as extractRequestMeta } from "../../../../../../request-meta-CmS1tDFf.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../../../../../../base64-CmWvODNW.mjs";
|
|
2
2
|
import "../../../../../../types-CmI1OyQg.mjs";
|
|
3
|
-
import { a as unwrapResult, t as apiError } from "../../../../../../error-
|
|
4
|
-
import { n as requirePerm } from "../../../../../../authorize-
|
|
3
|
+
import { a as unwrapResult, t as apiError } from "../../../../../../error-DXnK2wF4.mjs";
|
|
4
|
+
import { n as requirePerm } from "../../../../../../authorize-CuxZ0i2t.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/astro/routes/api/content/[collection]/[id]/compare.ts
|
|
7
7
|
const prerender = false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../../../../../../base64-CmWvODNW.mjs";
|
|
2
2
|
import "../../../../../../types-CmI1OyQg.mjs";
|
|
3
|
-
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-
|
|
4
|
-
import { t as requireOwnerPerm } from "../../../../../../authorize-
|
|
3
|
+
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-DXnK2wF4.mjs";
|
|
4
|
+
import { t as requireOwnerPerm } from "../../../../../../authorize-CuxZ0i2t.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/astro/routes/api/content/[collection]/[id]/discard-draft.ts
|
|
7
7
|
const prerender = false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../../../../../../base64-CmWvODNW.mjs";
|
|
2
2
|
import "../../../../../../types-CmI1OyQg.mjs";
|
|
3
|
-
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-
|
|
4
|
-
import { n as requirePerm, t as requireOwnerPerm } from "../../../../../../authorize-
|
|
3
|
+
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-DXnK2wF4.mjs";
|
|
4
|
+
import { n as requirePerm, t as requireOwnerPerm } from "../../../../../../authorize-CuxZ0i2t.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/astro/routes/api/content/[collection]/[id]/duplicate.ts
|
|
7
7
|
const prerender = false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../../../../../../base64-CmWvODNW.mjs";
|
|
2
2
|
import "../../../../../../types-CmI1OyQg.mjs";
|
|
3
|
-
import { a as unwrapResult, t as apiError } from "../../../../../../error-
|
|
4
|
-
import { n as requirePerm } from "../../../../../../authorize-
|
|
3
|
+
import { a as unwrapResult, t as apiError } from "../../../../../../error-DXnK2wF4.mjs";
|
|
4
|
+
import { n as requirePerm } from "../../../../../../authorize-CuxZ0i2t.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/astro/routes/api/content/[collection]/[id]/permanent.ts
|
|
7
7
|
const prerender = false;
|
|
@@ -3,16 +3,16 @@ import "../../../../../../after-B1IIdH3Y.mjs";
|
|
|
3
3
|
import "../../../../../../base64-CmWvODNW.mjs";
|
|
4
4
|
import "../../../../../../types-CmI1OyQg.mjs";
|
|
5
5
|
import "../../../../../../options-DTTML-Tx.mjs";
|
|
6
|
-
import { a as unwrapResult, n as apiSuccess, r as handleError, t as apiError } from "../../../../../../error-
|
|
7
|
-
import { r as parseOptionalBody, t as isParseError } from "../../../../../../parse-
|
|
8
|
-
import { on as contentPreviewUrlBody } from "../../../../../../redirects-
|
|
9
|
-
import "../../../../../../byline-fields-
|
|
6
|
+
import { a as unwrapResult, n as apiSuccess, r as handleError, t as apiError } from "../../../../../../error-DXnK2wF4.mjs";
|
|
7
|
+
import { r as parseOptionalBody, t as isParseError } from "../../../../../../parse-DqMWHQ8x.mjs";
|
|
8
|
+
import { on as contentPreviewUrlBody } from "../../../../../../redirects-Dcbuisoj.mjs";
|
|
9
|
+
import "../../../../../../byline-fields-eyJMblSr.mjs";
|
|
10
10
|
import "../../../../../../status-vUK0SA17.mjs";
|
|
11
11
|
import "../../../../../../api/schemas/index.mjs";
|
|
12
12
|
import "../../../../../../tokens-LeuXF9gG.mjs";
|
|
13
13
|
import { i as getPreviewUrl } from "../../../../../../preview-DKGCt2_p.mjs";
|
|
14
14
|
import { i as resolveSecretsCached } from "../../../../../../secrets-BSf9pRRY.mjs";
|
|
15
|
-
import { n as requirePerm } from "../../../../../../authorize-
|
|
15
|
+
import { n as requirePerm } from "../../../../../../authorize-CuxZ0i2t.mjs";
|
|
16
16
|
|
|
17
17
|
//#region src/astro/routes/api/content/[collection]/[id]/preview-url.ts
|
|
18
18
|
const prerender = false;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "../../../../../../base64-CmWvODNW.mjs";
|
|
2
2
|
import "../../../../../../types-CmI1OyQg.mjs";
|
|
3
|
-
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-
|
|
4
|
-
import { r as parseOptionalBody, t as isParseError } from "../../../../../../parse-
|
|
5
|
-
import { sn as contentPublishBody } from "../../../../../../redirects-
|
|
6
|
-
import "../../../../../../byline-fields-
|
|
3
|
+
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-DXnK2wF4.mjs";
|
|
4
|
+
import { r as parseOptionalBody, t as isParseError } from "../../../../../../parse-DqMWHQ8x.mjs";
|
|
5
|
+
import { sn as contentPublishBody } from "../../../../../../redirects-Dcbuisoj.mjs";
|
|
6
|
+
import "../../../../../../byline-fields-eyJMblSr.mjs";
|
|
7
7
|
import "../../../../../../status-vUK0SA17.mjs";
|
|
8
8
|
import "../../../../../../api/schemas/index.mjs";
|
|
9
|
-
import { t as requireOwnerPerm } from "../../../../../../authorize-
|
|
9
|
+
import { t as requireOwnerPerm } from "../../../../../../authorize-CuxZ0i2t.mjs";
|
|
10
10
|
import { hasPermission } from "@emdash-cms/auth";
|
|
11
11
|
|
|
12
12
|
//#region src/astro/routes/api/content/[collection]/[id]/publish.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../../../../../../base64-CmWvODNW.mjs";
|
|
2
2
|
import "../../../../../../types-CmI1OyQg.mjs";
|
|
3
|
-
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-
|
|
4
|
-
import { t as requireOwnerPerm } from "../../../../../../authorize-
|
|
3
|
+
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-DXnK2wF4.mjs";
|
|
4
|
+
import { t as requireOwnerPerm } from "../../../../../../authorize-CuxZ0i2t.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/astro/routes/api/content/[collection]/[id]/restore.ts
|
|
7
7
|
const prerender = false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../../../../../../base64-CmWvODNW.mjs";
|
|
2
2
|
import "../../../../../../types-CmI1OyQg.mjs";
|
|
3
|
-
import { a as unwrapResult, t as apiError } from "../../../../../../error-
|
|
4
|
-
import { n as requirePerm } from "../../../../../../authorize-
|
|
3
|
+
import { a as unwrapResult, t as apiError } from "../../../../../../error-DXnK2wF4.mjs";
|
|
4
|
+
import { n as requirePerm } from "../../../../../../authorize-CuxZ0i2t.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/astro/routes/api/content/[collection]/[id]/revisions.ts
|
|
7
7
|
const prerender = false;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "../../../../../../base64-CmWvODNW.mjs";
|
|
2
2
|
import "../../../../../../types-CmI1OyQg.mjs";
|
|
3
|
-
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-
|
|
4
|
-
import { n as parseBody, t as isParseError } from "../../../../../../parse-
|
|
5
|
-
import { ln as contentScheduleBody } from "../../../../../../redirects-
|
|
6
|
-
import "../../../../../../byline-fields-
|
|
3
|
+
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-DXnK2wF4.mjs";
|
|
4
|
+
import { n as parseBody, t as isParseError } from "../../../../../../parse-DqMWHQ8x.mjs";
|
|
5
|
+
import { ln as contentScheduleBody } from "../../../../../../redirects-Dcbuisoj.mjs";
|
|
6
|
+
import "../../../../../../byline-fields-eyJMblSr.mjs";
|
|
7
7
|
import "../../../../../../status-vUK0SA17.mjs";
|
|
8
8
|
import "../../../../../../api/schemas/index.mjs";
|
|
9
|
-
import { t as requireOwnerPerm } from "../../../../../../authorize-
|
|
9
|
+
import { t as requireOwnerPerm } from "../../../../../../authorize-CuxZ0i2t.mjs";
|
|
10
10
|
|
|
11
11
|
//#region src/astro/routes/api/content/[collection]/[id]/schedule.ts
|
|
12
12
|
const prerender = false;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import "../../../../../../../dialect-helpers-DRI5pyY3.mjs";
|
|
2
2
|
import "../../../../../../../after-B1IIdH3Y.mjs";
|
|
3
3
|
import "../../../../../../../object-cache-SEb2IM4Z.mjs";
|
|
4
|
-
import { t as ContentRepository } from "../../../../../../../content-
|
|
4
|
+
import { t as ContentRepository } from "../../../../../../../content-B43-YrIq.mjs";
|
|
5
5
|
import "../../../../../../../base64-CmWvODNW.mjs";
|
|
6
6
|
import "../../../../../../../types-CmI1OyQg.mjs";
|
|
7
7
|
import { t as TaxonomyRepository } from "../../../../../../../taxonomy-BBUlGug5.mjs";
|
|
8
8
|
import "../../../../../../../request-cache-KCNHp_RJ.mjs";
|
|
9
|
-
import "../../../../../../../loader-
|
|
9
|
+
import "../../../../../../../loader-DrpofRon.mjs";
|
|
10
10
|
import "../../../../../../../resolve-C7I0qiR0.mjs";
|
|
11
|
-
import { l as invalidateTermCache } from "../../../../../../../taxonomies-
|
|
12
|
-
import { i as requireDb, n as apiSuccess, r as handleError, t as apiError } from "../../../../../../../error-
|
|
13
|
-
import { n as parseBody, t as isParseError } from "../../../../../../../parse-
|
|
14
|
-
import { fn as contentTermsBody } from "../../../../../../../redirects-
|
|
15
|
-
import "../../../../../../../byline-fields-
|
|
11
|
+
import { l as invalidateTermCache } from "../../../../../../../taxonomies-n8w72lLQ.mjs";
|
|
12
|
+
import { i as requireDb, n as apiSuccess, r as handleError, t as apiError } from "../../../../../../../error-DXnK2wF4.mjs";
|
|
13
|
+
import { n as parseBody, t as isParseError } from "../../../../../../../parse-DqMWHQ8x.mjs";
|
|
14
|
+
import { fn as contentTermsBody } from "../../../../../../../redirects-Dcbuisoj.mjs";
|
|
15
|
+
import "../../../../../../../byline-fields-eyJMblSr.mjs";
|
|
16
16
|
import "../../../../../../../status-vUK0SA17.mjs";
|
|
17
17
|
import "../../../../../../../api/schemas/index.mjs";
|
|
18
|
-
import { n as requirePerm, t as requireOwnerPerm } from "../../../../../../../authorize-
|
|
18
|
+
import { n as requirePerm, t as requireOwnerPerm } from "../../../../../../../authorize-CuxZ0i2t.mjs";
|
|
19
19
|
|
|
20
20
|
//#region src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts
|
|
21
21
|
const prerender = false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../../../../../../base64-CmWvODNW.mjs";
|
|
2
2
|
import "../../../../../../types-CmI1OyQg.mjs";
|
|
3
|
-
import { a as unwrapResult, t as apiError } from "../../../../../../error-
|
|
4
|
-
import { n as requirePerm } from "../../../../../../authorize-
|
|
3
|
+
import { a as unwrapResult, t as apiError } from "../../../../../../error-DXnK2wF4.mjs";
|
|
4
|
+
import { n as requirePerm } from "../../../../../../authorize-CuxZ0i2t.mjs";
|
|
5
5
|
import { hasPermission } from "@emdash-cms/auth";
|
|
6
6
|
|
|
7
7
|
//#region src/astro/routes/api/content/[collection]/[id]/translations.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../../../../../../base64-CmWvODNW.mjs";
|
|
2
2
|
import "../../../../../../types-CmI1OyQg.mjs";
|
|
3
|
-
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-
|
|
4
|
-
import { t as requireOwnerPerm } from "../../../../../../authorize-
|
|
3
|
+
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-DXnK2wF4.mjs";
|
|
4
|
+
import { t as requireOwnerPerm } from "../../../../../../authorize-CuxZ0i2t.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/astro/routes/api/content/[collection]/[id]/unpublish.ts
|
|
7
7
|
const prerender = false;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "../../../../../base64-CmWvODNW.mjs";
|
|
2
2
|
import "../../../../../types-CmI1OyQg.mjs";
|
|
3
|
-
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../error-
|
|
4
|
-
import { n as parseBody, t as isParseError } from "../../../../../parse-
|
|
5
|
-
import { gn as contentUpdateBody } from "../../../../../redirects-
|
|
6
|
-
import "../../../../../byline-fields-
|
|
3
|
+
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../error-DXnK2wF4.mjs";
|
|
4
|
+
import { n as parseBody, t as isParseError } from "../../../../../parse-DqMWHQ8x.mjs";
|
|
5
|
+
import { gn as contentUpdateBody } from "../../../../../redirects-Dcbuisoj.mjs";
|
|
6
|
+
import "../../../../../byline-fields-eyJMblSr.mjs";
|
|
7
7
|
import "../../../../../status-vUK0SA17.mjs";
|
|
8
8
|
import "../../../../../api/schemas/index.mjs";
|
|
9
|
-
import { n as requirePerm, t as requireOwnerPerm } from "../../../../../authorize-
|
|
9
|
+
import { n as requirePerm, t as requireOwnerPerm } from "../../../../../authorize-CuxZ0i2t.mjs";
|
|
10
10
|
import { hasPermission } from "@emdash-cms/auth";
|
|
11
11
|
|
|
12
12
|
//#region src/astro/routes/api/content/[collection]/[id].ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../../../../../base64-CmWvODNW.mjs";
|
|
2
2
|
import "../../../../../types-CmI1OyQg.mjs";
|
|
3
|
-
import { a as unwrapResult, t as apiError } from "../../../../../error-
|
|
4
|
-
import { n as requirePerm } from "../../../../../authorize-
|
|
3
|
+
import { a as unwrapResult, t as apiError } from "../../../../../error-DXnK2wF4.mjs";
|
|
4
|
+
import { n as requirePerm } from "../../../../../authorize-CuxZ0i2t.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/astro/routes/api/content/[collection]/authors.ts
|
|
7
7
|
const prerender = false;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "../../../../../base64-CmWvODNW.mjs";
|
|
2
2
|
import "../../../../../types-CmI1OyQg.mjs";
|
|
3
|
-
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../error-
|
|
4
|
-
import { i as parseQuery, n as parseBody, t as isParseError } from "../../../../../parse-
|
|
5
|
-
import { in as contentListQuery, nn as contentCreateBody } from "../../../../../redirects-
|
|
6
|
-
import "../../../../../byline-fields-
|
|
3
|
+
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../error-DXnK2wF4.mjs";
|
|
4
|
+
import { i as parseQuery, n as parseBody, t as isParseError } from "../../../../../parse-DqMWHQ8x.mjs";
|
|
5
|
+
import { in as contentListQuery, nn as contentCreateBody } from "../../../../../redirects-Dcbuisoj.mjs";
|
|
6
|
+
import "../../../../../byline-fields-eyJMblSr.mjs";
|
|
7
7
|
import "../../../../../status-vUK0SA17.mjs";
|
|
8
8
|
import "../../../../../api/schemas/index.mjs";
|
|
9
|
-
import { n as requirePerm, t as requireOwnerPerm } from "../../../../../authorize-
|
|
9
|
+
import { n as requirePerm, t as requireOwnerPerm } from "../../../../../authorize-CuxZ0i2t.mjs";
|
|
10
10
|
import { hasPermission } from "@emdash-cms/auth";
|
|
11
11
|
|
|
12
12
|
//#region src/astro/routes/api/content/[collection]/index.ts
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "../../../../../base64-CmWvODNW.mjs";
|
|
2
2
|
import "../../../../../types-CmI1OyQg.mjs";
|
|
3
|
-
import { a as unwrapResult, t as apiError } from "../../../../../error-
|
|
4
|
-
import { i as parseQuery, t as isParseError } from "../../../../../parse-
|
|
5
|
-
import { hn as contentTrashQuery } from "../../../../../redirects-
|
|
6
|
-
import "../../../../../byline-fields-
|
|
3
|
+
import { a as unwrapResult, t as apiError } from "../../../../../error-DXnK2wF4.mjs";
|
|
4
|
+
import { i as parseQuery, t as isParseError } from "../../../../../parse-DqMWHQ8x.mjs";
|
|
5
|
+
import { hn as contentTrashQuery } from "../../../../../redirects-Dcbuisoj.mjs";
|
|
6
|
+
import "../../../../../byline-fields-eyJMblSr.mjs";
|
|
7
7
|
import "../../../../../status-vUK0SA17.mjs";
|
|
8
8
|
import "../../../../../api/schemas/index.mjs";
|
|
9
|
-
import { n as requirePerm } from "../../../../../authorize-
|
|
9
|
+
import { n as requirePerm } from "../../../../../authorize-CuxZ0i2t.mjs";
|
|
10
10
|
|
|
11
11
|
//#region src/astro/routes/api/content/[collection]/trash.ts
|
|
12
12
|
const prerender = false;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import "../../../after-B1IIdH3Y.mjs";
|
|
2
2
|
import "../../../object-cache-SEb2IM4Z.mjs";
|
|
3
|
-
import "../../../content-
|
|
3
|
+
import "../../../content-B43-YrIq.mjs";
|
|
4
4
|
import "../../../base64-CmWvODNW.mjs";
|
|
5
5
|
import "../../../types-CmI1OyQg.mjs";
|
|
6
|
-
import "../../../media-
|
|
6
|
+
import "../../../media-BjKxjzk8.mjs";
|
|
7
7
|
import "../../../user-JAuc8VUf.mjs";
|
|
8
|
-
import { t as handleDashboardStats } from "../../../dashboard-
|
|
9
|
-
import { a as unwrapResult, r as handleError, t as apiError } from "../../../error-
|
|
10
|
-
import { n as requirePerm } from "../../../authorize-
|
|
8
|
+
import { t as handleDashboardStats } from "../../../dashboard-FIe0S512.mjs";
|
|
9
|
+
import { a as unwrapResult, r as handleError, t as apiError } from "../../../error-DXnK2wF4.mjs";
|
|
10
|
+
import { n as requirePerm } from "../../../authorize-CuxZ0i2t.mjs";
|
|
11
11
|
|
|
12
12
|
//#region src/astro/routes/api/dashboard.ts
|
|
13
13
|
const prerender = false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../../../base64-CmWvODNW.mjs";
|
|
2
2
|
import "../../../../types-CmI1OyQg.mjs";
|
|
3
|
-
import { n as apiSuccess, t as apiError } from "../../../../error-
|
|
3
|
+
import { n as apiSuccess, t as apiError } from "../../../../error-DXnK2wF4.mjs";
|
|
4
4
|
import { i as getDevEmails, n as clearDevEmails } from "../../../../email-console-DJP32ucW.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/astro/routes/api/dev/emails.ts
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import "../../../../base64-CmWvODNW.mjs";
|
|
2
2
|
import "../../../../types-CmI1OyQg.mjs";
|
|
3
3
|
import { t as SsrfError } from "../../../../ssrf-BRKb343l.mjs";
|
|
4
|
-
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-
|
|
5
|
-
import { n as parseBody, t as isParseError } from "../../../../parse-
|
|
6
|
-
import "../../../../redirects-
|
|
7
|
-
import { f as importProbeBody } from "../../../../byline-fields-
|
|
4
|
+
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-DXnK2wF4.mjs";
|
|
5
|
+
import { n as parseBody, t as isParseError } from "../../../../parse-DqMWHQ8x.mjs";
|
|
6
|
+
import "../../../../redirects-Dcbuisoj.mjs";
|
|
7
|
+
import { f as importProbeBody } from "../../../../byline-fields-eyJMblSr.mjs";
|
|
8
8
|
import "../../../../status-vUK0SA17.mjs";
|
|
9
9
|
import "../../../../api/schemas/index.mjs";
|
|
10
10
|
import { l as probeUrl } from "../../../../import-Bb1T9WJS.mjs";
|
|
11
11
|
import "../../../../ssrf-CcX9zvMK.mjs";
|
|
12
12
|
import "../../../../utils-B7A57fm9.mjs";
|
|
13
|
-
import { n as requirePerm } from "../../../../authorize-
|
|
13
|
+
import { n as requirePerm } from "../../../../authorize-CuxZ0i2t.mjs";
|
|
14
14
|
|
|
15
15
|
//#region src/astro/routes/api/import/probe.ts
|
|
16
16
|
const prerender = false;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "../../../../../base64-CmWvODNW.mjs";
|
|
2
2
|
import "../../../../../types-CmI1OyQg.mjs";
|
|
3
3
|
import { a as RESERVED_COLLECTION_SLUGS } from "../../../../../types-tM44hEcf.mjs";
|
|
4
|
-
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-
|
|
5
|
-
import { n as requirePerm } from "../../../../../authorize-
|
|
4
|
+
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-DXnK2wF4.mjs";
|
|
5
|
+
import { n as requirePerm } from "../../../../../authorize-CuxZ0i2t.mjs";
|
|
6
6
|
import mime from "mime/lite";
|
|
7
7
|
import { SchemaRegistry, parseWxrString } from "emdash";
|
|
8
8
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import "../../../../../options-
|
|
1
|
+
import "../../../../../options-BvClpP5Q.mjs";
|
|
2
2
|
import "../../../../../types-B-gIxFCE.mjs";
|
|
3
|
-
import "../../../../../types-
|
|
4
|
-
import "../../../../../byline-fields-
|
|
5
|
-
import "../../../../../index-
|
|
3
|
+
import "../../../../../types-h2Cwbzi2.mjs";
|
|
4
|
+
import "../../../../../byline-fields-KD3JFRuH.mjs";
|
|
5
|
+
import "../../../../../index-Cz6_JBL3.mjs";
|
|
6
6
|
import "../../../../../runner-CEtq-6Sm.mjs";
|
|
7
7
|
import "../../../../../index-qbL02uhs.mjs";
|
|
8
8
|
import "../../../../../types-CUsXGRVj.mjs";
|
|
9
|
-
import "../../../../../validate-
|
|
9
|
+
import "../../../../../validate-Va_An3qb.mjs";
|
|
10
10
|
import { EmDashHandlers, EmDashManifest } from "../../../../types.mjs";
|
|
11
11
|
import { Kysely } from "kysely";
|
|
12
12
|
import { WxrPost } from "emdash";
|
|
@@ -9,12 +9,12 @@ import "../../../../../request-cache-KCNHp_RJ.mjs";
|
|
|
9
9
|
import "../../../../../byline-registry-BOjqDOim.mjs";
|
|
10
10
|
import "../../../../../field-defs-cache-CYYx8xlG.mjs";
|
|
11
11
|
import { t as BylineRepository } from "../../../../../byline-C-YajfV7.mjs";
|
|
12
|
-
import "../../../../../loader-
|
|
12
|
+
import "../../../../../loader-DrpofRon.mjs";
|
|
13
13
|
import { i as resolveLocaleChain } from "../../../../../resolve-C7I0qiR0.mjs";
|
|
14
|
-
import { l as invalidateTermCache } from "../../../../../taxonomies-
|
|
15
|
-
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-
|
|
14
|
+
import { l as invalidateTermCache } from "../../../../../taxonomies-n8w72lLQ.mjs";
|
|
15
|
+
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-DXnK2wF4.mjs";
|
|
16
16
|
import { m as resolveImportByline } from "../../../../../utils-B7A57fm9.mjs";
|
|
17
|
-
import { n as requirePerm } from "../../../../../authorize-
|
|
17
|
+
import { n as requirePerm } from "../../../../../authorize-CuxZ0i2t.mjs";
|
|
18
18
|
import { sanitizeSlug } from "./analyze.mjs";
|
|
19
19
|
import { gutenbergToPortableText } from "@emdash-cms/gutenberg-to-portable-text";
|
|
20
20
|
import { ContentRepository, importReusableBlocksAsSections, parseWxrDate, parseWxrString } from "emdash";
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
import "../../../../../options-BvClpP5Q.mjs";
|
|
2
|
+
import "../../../../../types-B-gIxFCE.mjs";
|
|
3
|
+
import "../../../../../types-h2Cwbzi2.mjs";
|
|
4
|
+
import "../../../../../byline-fields-KD3JFRuH.mjs";
|
|
5
|
+
import "../../../../../index-Cz6_JBL3.mjs";
|
|
6
|
+
import "../../../../../runner-CEtq-6Sm.mjs";
|
|
7
|
+
import "../../../../../index-qbL02uhs.mjs";
|
|
8
|
+
import "../../../../../types-CUsXGRVj.mjs";
|
|
9
|
+
import "../../../../../validate-Va_An3qb.mjs";
|
|
10
|
+
import { EmDashHandlers } from "../../../../types.mjs";
|
|
11
|
+
import { AttachmentInfo } from "./analyze.mjs";
|
|
1
12
|
import { APIRoute } from "astro";
|
|
2
13
|
|
|
3
14
|
//#region src/astro/routes/api/import/wordpress/media.d.ts
|
|
@@ -31,6 +42,7 @@ interface MediaImportResult {
|
|
|
31
42
|
urlMap: Record<string, string>;
|
|
32
43
|
}
|
|
33
44
|
declare const POST: APIRoute;
|
|
45
|
+
declare function importMediaWithProgress(attachments: AttachmentInfo[], db: NonNullable<EmDashHandlers["db"]>, storage: NonNullable<EmDashHandlers["storage"]>, onProgress: (progress: MediaImportProgress) => void): Promise<MediaImportResult>;
|
|
34
46
|
//#endregion
|
|
35
|
-
export { MediaImportProgress, MediaImportResult, POST, prerender };
|
|
47
|
+
export { MediaImportProgress, MediaImportResult, POST, importMediaWithProgress, prerender };
|
|
36
48
|
//# sourceMappingURL=media.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.d.mts","names":[],"sources":["../../../../../../src/astro/routes/api/import/wordpress/media.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"media.d.mts","names":[],"sources":["../../../../../../src/astro/routes/api/import/wordpress/media.ts"],"mappings":";;;;;;;;;;;;;;cA2Ba,SAAA;;UAGI,mBAAA;EAChB,IAAA;EACA,OAAA;EACA,KAAA;EACA,QAAA;EACA,MAAA;EACA,KAAA;AAAA;;UAIgB,iBAAA;EAChB,IAAA;EARA;EAUA,QAAA,EAAU,KAAA;IACT,IAAA;IACA,WAAA;IACA,MAAA;IACA,OAAA;EAAA;EAPgC;EAUjC,MAAA,EAAQ,KAAA;IACP,IAAA;IACA,WAAA;IACA,KAAA;EAAA;EAGa;EAAd,MAAA,EAAQ,MAAA;AAAA;AAAA,cAGI,IAAA,EAAM,QAAA;AAAA,iBAqEG,uBAAA,CACrB,WAAA,EAAa,cAAA,IACb,EAAA,EAAI,WAAA,CAAY,cAAA,SAChB,OAAA,EAAS,WAAA,CAAY,cAAA,cACrB,UAAA,GAAa,QAAA,EAAU,mBAAA,YACrB,OAAA,CAAQ,iBAAA"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import "../../../../../base64-CmWvODNW.mjs";
|
|
2
2
|
import "../../../../../types-CmI1OyQg.mjs";
|
|
3
|
+
import { t as enrichImageMetadata } from "../../../../../enrich-BQ0mxJRs.mjs";
|
|
3
4
|
import { a as validateExternalUrl, r as ssrfSafeFetch, t as SsrfError } from "../../../../../ssrf-BRKb343l.mjs";
|
|
4
|
-
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-
|
|
5
|
-
import { n as parseBody, t as isParseError } from "../../../../../parse-
|
|
6
|
-
import "../../../../../redirects-
|
|
7
|
-
import { p as wpMediaImportBody } from "../../../../../byline-fields-
|
|
5
|
+
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-DXnK2wF4.mjs";
|
|
6
|
+
import { n as parseBody, t as isParseError } from "../../../../../parse-DqMWHQ8x.mjs";
|
|
7
|
+
import "../../../../../redirects-Dcbuisoj.mjs";
|
|
8
|
+
import { p as wpMediaImportBody } from "../../../../../byline-fields-eyJMblSr.mjs";
|
|
8
9
|
import "../../../../../status-vUK0SA17.mjs";
|
|
9
10
|
import "../../../../../api/schemas/index.mjs";
|
|
10
11
|
import "../../../../../ssrf-CcX9zvMK.mjs";
|
|
11
|
-
import { n as requirePerm } from "../../../../../authorize-
|
|
12
|
+
import { n as requirePerm } from "../../../../../authorize-CuxZ0i2t.mjs";
|
|
12
13
|
import { ulid } from "ulidx";
|
|
13
14
|
import mime from "mime/lite";
|
|
14
15
|
import * as path from "node:path";
|
|
@@ -172,14 +173,17 @@ async function importMediaWithProgress(attachments, db, storage, onProgress) {
|
|
|
172
173
|
body: new Uint8Array(buffer),
|
|
173
174
|
contentType
|
|
174
175
|
});
|
|
176
|
+
const enriched = await enrichImageMetadata(new Uint8Array(buffer), contentType);
|
|
175
177
|
const mediaItem = await repo.create({
|
|
176
178
|
filename: attachment.filename || `media-${attachment.id}${ext}`,
|
|
177
179
|
mimeType: contentType,
|
|
178
180
|
size,
|
|
179
181
|
storageKey,
|
|
180
182
|
contentHash,
|
|
181
|
-
width:
|
|
182
|
-
height:
|
|
183
|
+
width: enriched.width,
|
|
184
|
+
height: enriched.height,
|
|
185
|
+
blurhash: enriched.blurhash,
|
|
186
|
+
dominantColor: enriched.dominantColor
|
|
183
187
|
});
|
|
184
188
|
const newUrl = `/_emdash/api/media/file/${storageKey}`;
|
|
185
189
|
result.imported.push({
|
|
@@ -222,5 +226,5 @@ function getExtensionFromMimeType(mimeType) {
|
|
|
222
226
|
}
|
|
223
227
|
|
|
224
228
|
//#endregion
|
|
225
|
-
export { POST, prerender };
|
|
229
|
+
export { POST, importMediaWithProgress, prerender };
|
|
226
230
|
//# sourceMappingURL=media.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.mjs","names":[],"sources":["../../../../../../src/astro/routes/api/import/wordpress/media.ts"],"sourcesContent":["/**\n * WordPress media import endpoint\n *\n * POST /_emdash/api/import/wordpress/media\n *\n * Downloads media attachments from WordPress URLs and uploads to EmDash storage.\n * Streams progress updates as newline-delimited JSON (NDJSON).\n * Each line is either a progress update or the final result.\n */\n\nimport * as path from \"node:path\";\n\nimport type { APIRoute } from \"astro\";\nimport { MediaRepository, computeContentHash } from \"emdash\";\nimport mime from \"mime/lite\";\nimport { ulid } from \"ulidx\";\n\nimport { requirePerm } from \"#api/authorize.js\";\nimport { apiError, apiSuccess, handleError } from \"#api/error.js\";\nimport { isParseError, parseBody } from \"#api/parse.js\";\nimport { wpMediaImportBody } from \"#api/schemas.js\";\nimport { validateExternalUrl, ssrfSafeFetch, SsrfError } from \"#import/ssrf.js\";\nimport type { EmDashHandlers } from \"#types\";\n\nimport type { AttachmentInfo } from \"./analyze.js\";\n\nexport const prerender = false;\n\n/** Progress update sent during streaming */\nexport interface MediaImportProgress {\n\ttype: \"progress\";\n\tcurrent: number;\n\ttotal: number;\n\tfilename?: string;\n\tstatus: \"downloading\" | \"uploading\" | \"done\" | \"skipped\" | \"failed\";\n\terror?: string;\n}\n\n/** Final result sent at end of stream */\nexport interface MediaImportResult {\n\ttype?: \"result\";\n\t/** Successfully imported items */\n\timported: Array<{\n\t\twpId?: number;\n\t\toriginalUrl: string;\n\t\tnewUrl: string;\n\t\tmediaId: string;\n\t}>;\n\t/** Failed items */\n\tfailed: Array<{\n\t\twpId?: number;\n\t\toriginalUrl: string;\n\t\terror: string;\n\t}>;\n\t/** Map of old URLs to new URLs (for content rewriting) */\n\turlMap: Record<string, string>;\n}\n\nexport const POST: APIRoute = async ({ request, locals }) => {\n\tconst { emdash, user } = locals;\n\n\tconst denied = requirePerm(user, \"import:execute\");\n\tif (denied) return denied;\n\n\tif (!emdash?.storage) {\n\t\treturn apiError(\"NO_STORAGE\", \"Storage not configured. Media import requires storage.\", 501);\n\t}\n\n\tif (!emdash?.db) {\n\t\treturn apiError(\"NO_DB\", \"Database not initialized\", 500);\n\t}\n\n\ttry {\n\t\tconst body = await parseBody(request, wpMediaImportBody);\n\t\tif (isParseError(body)) return body;\n\n\t\tconst attachments = body.attachments as AttachmentInfo[];\n\n\t\t// Check if streaming is requested (default: true)\n\t\tconst shouldStream = body.stream !== false;\n\n\t\tif (shouldStream) {\n\t\t\t// Stream progress updates as NDJSON\n\t\t\tconst stream = new ReadableStream({\n\t\t\t\tasync start(controller) {\n\t\t\t\t\tconst encoder = new TextEncoder();\n\t\t\t\t\tconst sendProgress = (progress: MediaImportProgress) => {\n\t\t\t\t\t\tcontroller.enqueue(encoder.encode(JSON.stringify(progress) + \"\\n\"));\n\t\t\t\t\t};\n\n\t\t\t\t\tconst result = await importMediaWithProgress(\n\t\t\t\t\t\tattachments,\n\t\t\t\t\t\temdash.db,\n\t\t\t\t\t\temdash.storage,\n\t\t\t\t\t\tsendProgress,\n\t\t\t\t\t);\n\n\t\t\t\t\t// Send final result\n\t\t\t\t\tcontroller.enqueue(encoder.encode(JSON.stringify({ ...result, type: \"result\" }) + \"\\n\"));\n\t\t\t\t\tcontroller.close();\n\t\t\t\t},\n\t\t\t});\n\n\t\t\treturn new Response(stream, {\n\t\t\t\tstatus: 200,\n\t\t\t\theaders: {\n\t\t\t\t\t\"Content-Type\": \"application/x-ndjson\",\n\t\t\t\t\t\"Cache-Control\": \"private, no-store\",\n\t\t\t\t\t\"Transfer-Encoding\": \"chunked\",\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// Non-streaming mode\n\t\tconst result = await importMediaWithProgress(\n\t\t\tattachments,\n\t\t\temdash.db,\n\t\t\temdash.storage,\n\t\t\t() => {}, // No-op progress callback\n\t\t);\n\n\t\treturn apiSuccess(result);\n\t} catch (error) {\n\t\treturn handleError(error, \"Failed to import media\", \"IMPORT_ERROR\");\n\t}\n};\n\nasync function importMediaWithProgress(\n\tattachments: AttachmentInfo[],\n\tdb: NonNullable<EmDashHandlers[\"db\"]>,\n\tstorage: NonNullable<EmDashHandlers[\"storage\"]>,\n\tonProgress: (progress: MediaImportProgress) => void,\n): Promise<MediaImportResult> {\n\tconst repo = new MediaRepository(db);\n\tconst total = attachments.length;\n\n\tconst result: MediaImportResult = {\n\t\timported: [],\n\t\tfailed: [],\n\t\turlMap: {},\n\t};\n\n\tfor (let i = 0; i < attachments.length; i++) {\n\t\tconst attachment = attachments[i];\n\t\tconst current = i + 1;\n\t\tconst filename = attachment.filename || `file-${attachment.id}`;\n\n\t\tif (!attachment.url) {\n\t\t\tresult.failed.push({\n\t\t\t\twpId: attachment.id,\n\t\t\t\toriginalUrl: \"\",\n\t\t\t\terror: \"No URL provided\",\n\t\t\t});\n\t\t\tonProgress({\n\t\t\t\ttype: \"progress\",\n\t\t\t\tcurrent,\n\t\t\t\ttotal,\n\t\t\t\tfilename,\n\t\t\t\tstatus: \"failed\",\n\t\t\t\terror: \"No URL provided\",\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\n\t\ttry {\n\t\t\t// SSRF: validate URL before fetching\n\t\t\ttry {\n\t\t\t\tvalidateExternalUrl(attachment.url);\n\t\t\t} catch (e) {\n\t\t\t\tconst msg = e instanceof SsrfError ? e.message : \"Invalid URL\";\n\t\t\t\tresult.failed.push({\n\t\t\t\t\twpId: attachment.id,\n\t\t\t\t\toriginalUrl: attachment.url,\n\t\t\t\t\terror: `Blocked: ${msg}`,\n\t\t\t\t});\n\t\t\t\tonProgress({\n\t\t\t\t\ttype: \"progress\",\n\t\t\t\t\tcurrent,\n\t\t\t\t\ttotal,\n\t\t\t\t\tfilename,\n\t\t\t\t\tstatus: \"failed\",\n\t\t\t\t\terror: `Blocked: ${msg}`,\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Report downloading\n\t\t\tonProgress({\n\t\t\t\ttype: \"progress\",\n\t\t\t\tcurrent,\n\t\t\t\ttotal,\n\t\t\t\tfilename,\n\t\t\t\tstatus: \"downloading\",\n\t\t\t});\n\n\t\t\t// Download from WordPress (ssrfSafeFetch re-validates redirect targets)\n\t\t\tconst response = await ssrfSafeFetch(attachment.url, {\n\t\t\t\theaders: {\n\t\t\t\t\t\"User-Agent\": \"EmDash-Importer/1.0\",\n\t\t\t\t},\n\t\t\t});\n\n\t\t\tif (!response.ok) {\n\t\t\t\tresult.failed.push({\n\t\t\t\t\twpId: attachment.id,\n\t\t\t\t\toriginalUrl: attachment.url,\n\t\t\t\t\terror: `HTTP ${response.status}: ${response.statusText}`,\n\t\t\t\t});\n\t\t\t\tonProgress({\n\t\t\t\t\ttype: \"progress\",\n\t\t\t\t\tcurrent,\n\t\t\t\t\ttotal,\n\t\t\t\t\tfilename,\n\t\t\t\t\tstatus: \"failed\",\n\t\t\t\t\terror: `HTTP ${response.status}`,\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Get content type from response or guess from filename\n\t\t\tconst contentType =\n\t\t\t\tresponse.headers.get(\"content-type\") || attachment.mimeType || \"application/octet-stream\";\n\n\t\t\t// Get the file data\n\t\t\tconst buffer = await response.arrayBuffer();\n\t\t\tconst size = buffer.byteLength;\n\n\t\t\t// Compute content hash for deduplication\n\t\t\tconst contentHash = await computeContentHash(buffer);\n\n\t\t\t// Check if we already have this exact content\n\t\t\tconst existing = await repo.findByContentHash(contentHash);\n\t\t\tif (existing) {\n\t\t\t\t// Same content already exists - reuse it\n\t\t\t\tconst existingUrl = `/_emdash/api/media/file/${existing.storageKey}`;\n\t\t\t\tresult.urlMap[attachment.url] = existingUrl;\n\t\t\t\tresult.imported.push({\n\t\t\t\t\twpId: attachment.id,\n\t\t\t\t\toriginalUrl: attachment.url,\n\t\t\t\t\tnewUrl: existingUrl,\n\t\t\t\t\tmediaId: existing.id,\n\t\t\t\t});\n\t\t\t\tonProgress({\n\t\t\t\t\ttype: \"progress\",\n\t\t\t\t\tcurrent,\n\t\t\t\t\ttotal,\n\t\t\t\t\tfilename,\n\t\t\t\t\tstatus: \"skipped\",\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Report uploading\n\t\t\tonProgress({\n\t\t\t\ttype: \"progress\",\n\t\t\t\tcurrent,\n\t\t\t\ttotal,\n\t\t\t\tfilename,\n\t\t\t\tstatus: \"uploading\",\n\t\t\t});\n\n\t\t\t// Generate storage key\n\t\t\tconst id = ulid();\n\t\t\tconst ext = attachment.filename\n\t\t\t\t? path.extname(attachment.filename)\n\t\t\t\t: getExtensionFromMimeType(contentType);\n\t\t\tconst storageKey = `${id}${ext}`;\n\n\t\t\t// Upload to storage\n\t\t\tawait storage.upload({\n\t\t\t\tkey: storageKey,\n\t\t\t\tbody: new Uint8Array(buffer),\n\t\t\t\tcontentType,\n\t\t\t});\n\n\t\t\t// Create media record with content hash\n\t\t\tconst mediaItem = await repo.create({\n\t\t\t\tfilename: attachment.filename || `media-${attachment.id}${ext}`,\n\t\t\t\tmimeType: contentType,\n\t\t\t\tsize,\n\t\t\t\tstorageKey,\n\t\t\t\tcontentHash,\n\t\t\t\twidth: undefined,\n\t\t\t\theight: undefined,\n\t\t\t});\n\n\t\t\t// Build the new URL\n\t\t\tconst newUrl = `/_emdash/api/media/file/${storageKey}`;\n\n\t\t\tresult.imported.push({\n\t\t\t\twpId: attachment.id,\n\t\t\t\toriginalUrl: attachment.url,\n\t\t\t\tnewUrl,\n\t\t\t\tmediaId: mediaItem.id,\n\t\t\t});\n\n\t\t\t// Add to URL map\n\t\t\tresult.urlMap[attachment.url] = newUrl;\n\n\t\t\t// Report done\n\t\t\tonProgress({\n\t\t\t\ttype: \"progress\",\n\t\t\t\tcurrent,\n\t\t\t\ttotal,\n\t\t\t\tfilename,\n\t\t\t\tstatus: \"done\",\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tconsole.error(`Media import error for \"${filename}\":`, error);\n\t\t\tconst errorMsg = \"Failed to import media\";\n\t\t\tresult.failed.push({\n\t\t\t\twpId: attachment.id,\n\t\t\t\toriginalUrl: attachment.url,\n\t\t\t\terror: errorMsg,\n\t\t\t});\n\t\t\tonProgress({\n\t\t\t\ttype: \"progress\",\n\t\t\t\tcurrent,\n\t\t\t\ttotal,\n\t\t\t\tfilename,\n\t\t\t\tstatus: \"failed\",\n\t\t\t\terror: errorMsg,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn result;\n}\n\nfunction getExtensionFromMimeType(mimeType: string): string {\n\tconst ext = mime.getExtension(mimeType);\n\treturn ext ? `.${ext}` : \"\";\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,YAAY;AAgCzB,MAAa,OAAiB,OAAO,EAAE,SAAS,aAAa;CAC5D,MAAM,EAAE,QAAQ,SAAS;CAEzB,MAAM,SAAS,YAAY,MAAM,iBAAiB;AAClD,KAAI,OAAQ,QAAO;AAEnB,KAAI,CAAC,QAAQ,QACZ,QAAO,SAAS,cAAc,0DAA0D,IAAI;AAG7F,KAAI,CAAC,QAAQ,GACZ,QAAO,SAAS,SAAS,4BAA4B,IAAI;AAG1D,KAAI;EACH,MAAM,OAAO,MAAM,UAAU,SAAS,kBAAkB;AACxD,MAAI,aAAa,KAAK,CAAE,QAAO;EAE/B,MAAM,cAAc,KAAK;AAKzB,MAFqB,KAAK,WAAW,OAEnB;GAEjB,MAAM,SAAS,IAAI,eAAe,EACjC,MAAM,MAAM,YAAY;IACvB,MAAM,UAAU,IAAI,aAAa;IACjC,MAAM,gBAAgB,aAAkC;AACvD,gBAAW,QAAQ,QAAQ,OAAO,KAAK,UAAU,SAAS,GAAG,KAAK,CAAC;;IAGpE,MAAM,SAAS,MAAM,wBACpB,aACA,OAAO,IACP,OAAO,SACP,aACA;AAGD,eAAW,QAAQ,QAAQ,OAAO,KAAK,UAAU;KAAE,GAAG;KAAQ,MAAM;KAAU,CAAC,GAAG,KAAK,CAAC;AACxF,eAAW,OAAO;MAEnB,CAAC;AAEF,UAAO,IAAI,SAAS,QAAQ;IAC3B,QAAQ;IACR,SAAS;KACR,gBAAgB;KAChB,iBAAiB;KACjB,qBAAqB;KACrB;IACD,CAAC;;AAWH,SAAO,WAPQ,MAAM,wBACpB,aACA,OAAO,IACP,OAAO,eACD,GACN,CAEwB;UACjB,OAAO;AACf,SAAO,YAAY,OAAO,0BAA0B,eAAe;;;AAIrE,eAAe,wBACd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;;;AAIJ,QAAO;;AAGR,SAAS,yBAAyB,UAA0B;CAC3D,MAAM,MAAM,KAAK,aAAa,SAAS;AACvC,QAAO,MAAM,IAAI,QAAQ"}
|
|
1
|
+
{"version":3,"file":"media.mjs","names":[],"sources":["../../../../../../src/astro/routes/api/import/wordpress/media.ts"],"sourcesContent":["/**\n * WordPress media import endpoint\n *\n * POST /_emdash/api/import/wordpress/media\n *\n * Downloads media attachments from WordPress URLs and uploads to EmDash storage.\n * Streams progress updates as newline-delimited JSON (NDJSON).\n * Each line is either a progress update or the final result.\n */\n\nimport * as path from \"node:path\";\n\nimport type { APIRoute } from \"astro\";\nimport { MediaRepository, computeContentHash } from \"emdash\";\nimport mime from \"mime/lite\";\nimport { ulid } from \"ulidx\";\n\nimport { requirePerm } from \"#api/authorize.js\";\nimport { apiError, apiSuccess, handleError } from \"#api/error.js\";\nimport { isParseError, parseBody } from \"#api/parse.js\";\nimport { wpMediaImportBody } from \"#api/schemas.js\";\nimport { validateExternalUrl, ssrfSafeFetch, SsrfError } from \"#import/ssrf.js\";\nimport { enrichImageMetadata } from \"#media/enrich.js\";\nimport type { EmDashHandlers } from \"#types\";\n\nimport type { AttachmentInfo } from \"./analyze.js\";\n\nexport const prerender = false;\n\n/** Progress update sent during streaming */\nexport interface MediaImportProgress {\n\ttype: \"progress\";\n\tcurrent: number;\n\ttotal: number;\n\tfilename?: string;\n\tstatus: \"downloading\" | \"uploading\" | \"done\" | \"skipped\" | \"failed\";\n\terror?: string;\n}\n\n/** Final result sent at end of stream */\nexport interface MediaImportResult {\n\ttype?: \"result\";\n\t/** Successfully imported items */\n\timported: Array<{\n\t\twpId?: number;\n\t\toriginalUrl: string;\n\t\tnewUrl: string;\n\t\tmediaId: string;\n\t}>;\n\t/** Failed items */\n\tfailed: Array<{\n\t\twpId?: number;\n\t\toriginalUrl: string;\n\t\terror: string;\n\t}>;\n\t/** Map of old URLs to new URLs (for content rewriting) */\n\turlMap: Record<string, string>;\n}\n\nexport const POST: APIRoute = async ({ request, locals }) => {\n\tconst { emdash, user } = locals;\n\n\tconst denied = requirePerm(user, \"import:execute\");\n\tif (denied) return denied;\n\n\tif (!emdash?.storage) {\n\t\treturn apiError(\"NO_STORAGE\", \"Storage not configured. Media import requires storage.\", 501);\n\t}\n\n\tif (!emdash?.db) {\n\t\treturn apiError(\"NO_DB\", \"Database not initialized\", 500);\n\t}\n\n\ttry {\n\t\tconst body = await parseBody(request, wpMediaImportBody);\n\t\tif (isParseError(body)) return body;\n\n\t\tconst attachments = body.attachments as AttachmentInfo[];\n\n\t\t// Check if streaming is requested (default: true)\n\t\tconst shouldStream = body.stream !== false;\n\n\t\tif (shouldStream) {\n\t\t\t// Stream progress updates as NDJSON\n\t\t\tconst stream = new ReadableStream({\n\t\t\t\tasync start(controller) {\n\t\t\t\t\tconst encoder = new TextEncoder();\n\t\t\t\t\tconst sendProgress = (progress: MediaImportProgress) => {\n\t\t\t\t\t\tcontroller.enqueue(encoder.encode(JSON.stringify(progress) + \"\\n\"));\n\t\t\t\t\t};\n\n\t\t\t\t\tconst result = await importMediaWithProgress(\n\t\t\t\t\t\tattachments,\n\t\t\t\t\t\temdash.db,\n\t\t\t\t\t\temdash.storage,\n\t\t\t\t\t\tsendProgress,\n\t\t\t\t\t);\n\n\t\t\t\t\t// Send final result\n\t\t\t\t\tcontroller.enqueue(encoder.encode(JSON.stringify({ ...result, type: \"result\" }) + \"\\n\"));\n\t\t\t\t\tcontroller.close();\n\t\t\t\t},\n\t\t\t});\n\n\t\t\treturn new Response(stream, {\n\t\t\t\tstatus: 200,\n\t\t\t\theaders: {\n\t\t\t\t\t\"Content-Type\": \"application/x-ndjson\",\n\t\t\t\t\t\"Cache-Control\": \"private, no-store\",\n\t\t\t\t\t\"Transfer-Encoding\": \"chunked\",\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// Non-streaming mode\n\t\tconst result = await importMediaWithProgress(\n\t\t\tattachments,\n\t\t\temdash.db,\n\t\t\temdash.storage,\n\t\t\t() => {}, // No-op progress callback\n\t\t);\n\n\t\treturn apiSuccess(result);\n\t} catch (error) {\n\t\treturn handleError(error, \"Failed to import media\", \"IMPORT_ERROR\");\n\t}\n};\n\nexport async function importMediaWithProgress(\n\tattachments: AttachmentInfo[],\n\tdb: NonNullable<EmDashHandlers[\"db\"]>,\n\tstorage: NonNullable<EmDashHandlers[\"storage\"]>,\n\tonProgress: (progress: MediaImportProgress) => void,\n): Promise<MediaImportResult> {\n\tconst repo = new MediaRepository(db);\n\tconst total = attachments.length;\n\n\tconst result: MediaImportResult = {\n\t\timported: [],\n\t\tfailed: [],\n\t\turlMap: {},\n\t};\n\n\tfor (let i = 0; i < attachments.length; i++) {\n\t\tconst attachment = attachments[i];\n\t\tconst current = i + 1;\n\t\tconst filename = attachment.filename || `file-${attachment.id}`;\n\n\t\tif (!attachment.url) {\n\t\t\tresult.failed.push({\n\t\t\t\twpId: attachment.id,\n\t\t\t\toriginalUrl: \"\",\n\t\t\t\terror: \"No URL provided\",\n\t\t\t});\n\t\t\tonProgress({\n\t\t\t\ttype: \"progress\",\n\t\t\t\tcurrent,\n\t\t\t\ttotal,\n\t\t\t\tfilename,\n\t\t\t\tstatus: \"failed\",\n\t\t\t\terror: \"No URL provided\",\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\n\t\ttry {\n\t\t\t// SSRF: validate URL before fetching\n\t\t\ttry {\n\t\t\t\tvalidateExternalUrl(attachment.url);\n\t\t\t} catch (e) {\n\t\t\t\tconst msg = e instanceof SsrfError ? e.message : \"Invalid URL\";\n\t\t\t\tresult.failed.push({\n\t\t\t\t\twpId: attachment.id,\n\t\t\t\t\toriginalUrl: attachment.url,\n\t\t\t\t\terror: `Blocked: ${msg}`,\n\t\t\t\t});\n\t\t\t\tonProgress({\n\t\t\t\t\ttype: \"progress\",\n\t\t\t\t\tcurrent,\n\t\t\t\t\ttotal,\n\t\t\t\t\tfilename,\n\t\t\t\t\tstatus: \"failed\",\n\t\t\t\t\terror: `Blocked: ${msg}`,\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Report downloading\n\t\t\tonProgress({\n\t\t\t\ttype: \"progress\",\n\t\t\t\tcurrent,\n\t\t\t\ttotal,\n\t\t\t\tfilename,\n\t\t\t\tstatus: \"downloading\",\n\t\t\t});\n\n\t\t\t// Download from WordPress (ssrfSafeFetch re-validates redirect targets)\n\t\t\tconst response = await ssrfSafeFetch(attachment.url, {\n\t\t\t\theaders: {\n\t\t\t\t\t\"User-Agent\": \"EmDash-Importer/1.0\",\n\t\t\t\t},\n\t\t\t});\n\n\t\t\tif (!response.ok) {\n\t\t\t\tresult.failed.push({\n\t\t\t\t\twpId: attachment.id,\n\t\t\t\t\toriginalUrl: attachment.url,\n\t\t\t\t\terror: `HTTP ${response.status}: ${response.statusText}`,\n\t\t\t\t});\n\t\t\t\tonProgress({\n\t\t\t\t\ttype: \"progress\",\n\t\t\t\t\tcurrent,\n\t\t\t\t\ttotal,\n\t\t\t\t\tfilename,\n\t\t\t\t\tstatus: \"failed\",\n\t\t\t\t\terror: `HTTP ${response.status}`,\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Get content type from response or guess from filename\n\t\t\tconst contentType =\n\t\t\t\tresponse.headers.get(\"content-type\") || attachment.mimeType || \"application/octet-stream\";\n\n\t\t\t// Get the file data\n\t\t\tconst buffer = await response.arrayBuffer();\n\t\t\tconst size = buffer.byteLength;\n\n\t\t\t// Compute content hash for deduplication\n\t\t\tconst contentHash = await computeContentHash(buffer);\n\n\t\t\t// Check if we already have this exact content\n\t\t\tconst existing = await repo.findByContentHash(contentHash);\n\t\t\tif (existing) {\n\t\t\t\t// Same content already exists - reuse it\n\t\t\t\tconst existingUrl = `/_emdash/api/media/file/${existing.storageKey}`;\n\t\t\t\tresult.urlMap[attachment.url] = existingUrl;\n\t\t\t\tresult.imported.push({\n\t\t\t\t\twpId: attachment.id,\n\t\t\t\t\toriginalUrl: attachment.url,\n\t\t\t\t\tnewUrl: existingUrl,\n\t\t\t\t\tmediaId: existing.id,\n\t\t\t\t});\n\t\t\t\tonProgress({\n\t\t\t\t\ttype: \"progress\",\n\t\t\t\t\tcurrent,\n\t\t\t\t\ttotal,\n\t\t\t\t\tfilename,\n\t\t\t\t\tstatus: \"skipped\",\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Report uploading\n\t\t\tonProgress({\n\t\t\t\ttype: \"progress\",\n\t\t\t\tcurrent,\n\t\t\t\ttotal,\n\t\t\t\tfilename,\n\t\t\t\tstatus: \"uploading\",\n\t\t\t});\n\n\t\t\t// Generate storage key\n\t\t\tconst id = ulid();\n\t\t\tconst ext = attachment.filename\n\t\t\t\t? path.extname(attachment.filename)\n\t\t\t\t: getExtensionFromMimeType(contentType);\n\t\t\tconst storageKey = `${id}${ext}`;\n\n\t\t\t// Upload to storage\n\t\t\tawait storage.upload({\n\t\t\t\tkey: storageKey,\n\t\t\t\tbody: new Uint8Array(buffer),\n\t\t\t\tcontentType,\n\t\t\t});\n\n\t\t\t// Derive dimensions + LQIP placeholders (no-op for non-images).\n\t\t\tconst enriched = await enrichImageMetadata(new Uint8Array(buffer), contentType);\n\n\t\t\t// Create media record with content hash\n\t\t\tconst mediaItem = await repo.create({\n\t\t\t\tfilename: attachment.filename || `media-${attachment.id}${ext}`,\n\t\t\t\tmimeType: contentType,\n\t\t\t\tsize,\n\t\t\t\tstorageKey,\n\t\t\t\tcontentHash,\n\t\t\t\twidth: enriched.width,\n\t\t\t\theight: enriched.height,\n\t\t\t\tblurhash: enriched.blurhash,\n\t\t\t\tdominantColor: enriched.dominantColor,\n\t\t\t});\n\n\t\t\t// Build the new URL\n\t\t\tconst newUrl = `/_emdash/api/media/file/${storageKey}`;\n\n\t\t\tresult.imported.push({\n\t\t\t\twpId: attachment.id,\n\t\t\t\toriginalUrl: attachment.url,\n\t\t\t\tnewUrl,\n\t\t\t\tmediaId: mediaItem.id,\n\t\t\t});\n\n\t\t\t// Add to URL map\n\t\t\tresult.urlMap[attachment.url] = newUrl;\n\n\t\t\t// Report done\n\t\t\tonProgress({\n\t\t\t\ttype: \"progress\",\n\t\t\t\tcurrent,\n\t\t\t\ttotal,\n\t\t\t\tfilename,\n\t\t\t\tstatus: \"done\",\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tconsole.error(`Media import error for \"${filename}\":`, error);\n\t\t\tconst errorMsg = \"Failed to import media\";\n\t\t\tresult.failed.push({\n\t\t\t\twpId: attachment.id,\n\t\t\t\toriginalUrl: attachment.url,\n\t\t\t\terror: errorMsg,\n\t\t\t});\n\t\t\tonProgress({\n\t\t\t\ttype: \"progress\",\n\t\t\t\tcurrent,\n\t\t\t\ttotal,\n\t\t\t\tfilename,\n\t\t\t\tstatus: \"failed\",\n\t\t\t\terror: errorMsg,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn result;\n}\n\nfunction getExtensionFromMimeType(mimeType: string): string {\n\tconst ext = mime.getExtension(mimeType);\n\treturn ext ? `.${ext}` : \"\";\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAa,YAAY;AAgCzB,MAAa,OAAiB,OAAO,EAAE,SAAS,aAAa;CAC5D,MAAM,EAAE,QAAQ,SAAS;CAEzB,MAAM,SAAS,YAAY,MAAM,iBAAiB;AAClD,KAAI,OAAQ,QAAO;AAEnB,KAAI,CAAC,QAAQ,QACZ,QAAO,SAAS,cAAc,0DAA0D,IAAI;AAG7F,KAAI,CAAC,QAAQ,GACZ,QAAO,SAAS,SAAS,4BAA4B,IAAI;AAG1D,KAAI;EACH,MAAM,OAAO,MAAM,UAAU,SAAS,kBAAkB;AACxD,MAAI,aAAa,KAAK,CAAE,QAAO;EAE/B,MAAM,cAAc,KAAK;AAKzB,MAFqB,KAAK,WAAW,OAEnB;GAEjB,MAAM,SAAS,IAAI,eAAe,EACjC,MAAM,MAAM,YAAY;IACvB,MAAM,UAAU,IAAI,aAAa;IACjC,MAAM,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