emdash 0.24.1 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/route-utils.d.mts +3 -3
- package/dist/api/route-utils.mjs +12 -11
- 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-BMfveMoB.mjs} +24 -20
- package/dist/api-BMfveMoB.mjs.map +1 -0
- package/dist/{apply-BE9UaWX0.mjs → apply--IVNSdXn.mjs} +19 -16
- package/dist/apply--IVNSdXn.mjs.map +1 -0
- package/dist/astro/index.d.mts +9 -9
- package/dist/astro/index.mjs +3 -2
- package/dist/astro/index.mjs.map +1 -1
- package/dist/astro/middleware/auth.d.mts +8 -8
- package/dist/astro/middleware/auth.mjs +2 -2
- package/dist/astro/middleware/redirect.mjs +4 -4
- package/dist/astro/middleware.d.mts +1 -1
- package/dist/astro/middleware.d.mts.map +1 -1
- package/dist/astro/middleware.mjs +99 -70
- package/dist/astro/middleware.mjs.map +1 -1
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +5 -5
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +5 -5
- 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/byline-fields/_slug_/usage.mjs +3 -3
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +6 -6
- package/dist/astro/routes/api/admin/byline-fields/index.mjs +6 -6
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +6 -6
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +12 -12
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +12 -12
- package/dist/astro/routes/api/admin/bylines/index.mjs +12 -12
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +10 -10
- package/dist/astro/routes/api/admin/comments/_id_.mjs +6 -6
- package/dist/astro/routes/api/admin/comments/bulk.mjs +9 -9
- package/dist/astro/routes/api/admin/comments/counts.mjs +6 -6
- package/dist/astro/routes/api/admin/comments/index.mjs +9 -9
- 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 +31 -31
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +31 -31
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +31 -31
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +31 -31
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +31 -31
- package/dist/astro/routes/api/admin/plugins/index.mjs +31 -31
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +3 -3
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +31 -31
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +31 -31
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +31 -31
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +31 -31
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +32 -32
- package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +31 -31
- package/dist/astro/routes/api/admin/plugins/registry/install.mjs +32 -32
- package/dist/astro/routes/api/admin/plugins/updates.mjs +31 -31
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +31 -31
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +3 -3
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +31 -31
- 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 +5 -5
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +2 -2
- package/dist/astro/routes/api/admin/users/index.mjs +5 -5
- 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 +5 -5
- package/dist/astro/routes/api/auth/invite/index.mjs +5 -5
- package/dist/astro/routes/api/auth/invite/register-options.mjs +5 -5
- package/dist/astro/routes/api/auth/logout.mjs +2 -2
- package/dist/astro/routes/api/auth/magic-link/send.mjs +6 -6
- package/dist/astro/routes/api/auth/magic-link/verify.mjs +2 -2
- package/dist/astro/routes/api/auth/me.mjs +6 -6
- package/dist/astro/routes/api/auth/passkey/_id_.mjs +5 -5
- package/dist/astro/routes/api/auth/passkey/index.mjs +2 -2
- package/dist/astro/routes/api/auth/passkey/options.mjs +6 -6
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +5 -5
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +5 -5
- package/dist/astro/routes/api/auth/passkey/verify.mjs +5 -5
- package/dist/astro/routes/api/auth/signup/complete.mjs +5 -5
- package/dist/astro/routes/api/auth/signup/request.mjs +6 -6
- package/dist/astro/routes/api/auth/signup/verify.mjs +2 -2
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +9 -9
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +9 -9
- 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 +6 -6
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +6 -6
- 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 +6 -6
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +11 -11
- 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 +6 -6
- package/dist/astro/routes/api/content/_collection_/authors.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/index.mjs +6 -6
- package/dist/astro/routes/api/content/_collection_/trash.mjs +6 -6
- package/dist/astro/routes/api/dashboard.mjs +8 -8
- package/dist/astro/routes/api/dev/emails.mjs +2 -2
- package/dist/astro/routes/api/import/probe.d.mts +2 -2
- package/dist/astro/routes/api/import/probe.mjs +6 -6
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +3 -3
- package/dist/astro/routes/api/import/wordpress/execute.d.mts +8 -8
- package/dist/astro/routes/api/import/wordpress/execute.mjs +9 -9
- 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 +13 -9
- package/dist/astro/routes/api/import/wordpress/media.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +8 -8
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +8 -8
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +6 -6
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +9 -9
- package/dist/astro/routes/api/manifest.mjs +3 -3
- package/dist/astro/routes/api/mcp.mjs +36 -36
- package/dist/astro/routes/api/media/_id_/confirm.d.mts.map +1 -1
- package/dist/astro/routes/api/media/_id_/confirm.mjs +44 -8
- package/dist/astro/routes/api/media/_id_/confirm.mjs.map +1 -1
- package/dist/astro/routes/api/media/_id_.mjs +6 -6
- 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 +8 -8
- package/dist/astro/routes/api/media.mjs +22 -21
- package/dist/astro/routes/api/media.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +8 -8
- package/dist/astro/routes/api/menus/_name_/items.mjs +8 -8
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +8 -8
- package/dist/astro/routes/api/menus/_name_/translations.mjs +8 -8
- package/dist/astro/routes/api/menus/_name_.mjs +8 -8
- package/dist/astro/routes/api/menus/index.mjs +8 -8
- 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 +3 -3
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +3 -3
- package/dist/astro/routes/api/redirects/404s/index.mjs +8 -8
- package/dist/astro/routes/api/redirects/404s/summary.mjs +8 -8
- package/dist/astro/routes/api/redirects/_id_.mjs +9 -9
- package/dist/astro/routes/api/redirects/index.mjs +9 -9
- 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 +31 -31
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +31 -31
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +31 -31
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +31 -31
- package/dist/astro/routes/api/schema/collections/index.mjs +31 -31
- package/dist/astro/routes/api/schema/index.mjs +6 -6
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +31 -31
- package/dist/astro/routes/api/schema/orphans/index.mjs +31 -31
- package/dist/astro/routes/api/search/enable.mjs +9 -9
- package/dist/astro/routes/api/search/index.mjs +8 -8
- package/dist/astro/routes/api/search/rebuild.mjs +9 -9
- package/dist/astro/routes/api/search/stats.mjs +6 -6
- package/dist/astro/routes/api/search/suggest.mjs +8 -8
- package/dist/astro/routes/api/sections/_slug_.mjs +8 -8
- package/dist/astro/routes/api/sections/index.mjs +8 -8
- package/dist/astro/routes/api/settings/email.mjs +4 -4
- package/dist/astro/routes/api/settings.mjs +11 -11
- package/dist/astro/routes/api/setup/admin-verify.mjs +5 -5
- package/dist/astro/routes/api/setup/admin.mjs +5 -5
- package/dist/astro/routes/api/setup/dev-bypass.mjs +17 -17
- package/dist/astro/routes/api/setup/dev-reset.mjs +2 -2
- package/dist/astro/routes/api/setup/index.mjs +20 -20
- package/dist/astro/routes/api/setup/status.mjs +3 -3
- package/dist/astro/routes/api/snapshot.mjs +3 -3
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +11 -11
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +11 -11
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +11 -11
- package/dist/astro/routes/api/taxonomies/index.mjs +11 -11
- 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 +6 -6
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +8 -8
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +8 -8
- package/dist/astro/routes/api/widget-areas/_name_.mjs +5 -5
- package/dist/astro/routes/api/widget-areas/index.mjs +8 -8
- package/dist/astro/routes/api/widget-components.mjs +2 -2
- package/dist/astro/routes/robots.txt.mjs +5 -5
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +11 -10
- package/dist/astro/routes/sitemap-_collection_.xml.mjs.map +1 -1
- package/dist/astro/routes/sitemap.xml.mjs +6 -6
- package/dist/astro/types.d.mts +10 -10
- package/dist/{authorize-B__u-iZJ.mjs → authorize-BZnOGJFo.mjs} +2 -2
- package/dist/{authorize-B__u-iZJ.mjs.map → authorize-BZnOGJFo.mjs.map} +1 -1
- package/dist/{byline-C-YajfV7.mjs → byline-LL8lyqdb.mjs} +6 -6
- package/dist/{byline-C-YajfV7.mjs.map → byline-LL8lyqdb.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-D4KADDAi.mjs → bylines-BmJ7Vg7J.mjs} +4 -4
- package/dist/{bylines-D4KADDAi.mjs.map → bylines-BmJ7Vg7J.mjs.map} +1 -1
- package/dist/{bylines-BMtJnPnG.mjs → bylines-DE47vP8d.mjs} +6 -6
- package/dist/{bylines-BMtJnPnG.mjs.map → bylines-DE47vP8d.mjs.map} +1 -1
- package/dist/{cache-BUJe2w6Z.mjs → cache-D9jF5bYw.mjs} +2 -2
- package/dist/{cache-BUJe2w6Z.mjs.map → cache-D9jF5bYw.mjs.map} +1 -1
- package/dist/{chunks-BHgcHh2C.mjs → chunks-OCG163rN.mjs} +2 -2
- package/dist/{chunks-BHgcHh2C.mjs.map → chunks-OCG163rN.mjs.map} +1 -1
- package/dist/cli/index.mjs +17 -17
- package/dist/{comment-BDx50EX5.mjs → comment-D9BLDpZI.mjs} +3 -3
- package/dist/{comment-BDx50EX5.mjs.map → comment-D9BLDpZI.mjs.map} +1 -1
- package/dist/{comment-reaction-Gv_pgfI3.mjs → comment-reaction-Drl9SkNu.mjs} +2 -2
- package/dist/{comment-reaction-Gv_pgfI3.mjs.map → comment-reaction-Drl9SkNu.mjs.map} +1 -1
- package/dist/{comments-CXHuQ6jI.mjs → comments-BjJ9SKGU.mjs} +3 -3
- package/dist/{comments-CXHuQ6jI.mjs.map → comments-BjJ9SKGU.mjs.map} +1 -1
- package/dist/{content-PoVGKjp0.mjs → content-ncUWWjna.mjs} +10 -8
- package/dist/content-ncUWWjna.mjs.map +1 -0
- package/dist/{context-Dvws41_A.mjs → context-C_g-iJVA.mjs} +14 -8
- package/dist/context-C_g-iJVA.mjs.map +1 -0
- package/dist/{dashboard-DsYU8JKS.mjs → dashboard-CotyqQrW.mjs} +4 -4
- package/dist/{dashboard-DsYU8JKS.mjs.map → dashboard-CotyqQrW.mjs.map} +1 -1
- package/dist/db/index.d.mts +2 -2
- package/dist/db/index.mjs +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-rVGiqWDt.mjs} +3 -2
- package/dist/error-rVGiqWDt.mjs.map +1 -0
- package/dist/{field-defs-cache-CYYx8xlG.mjs → field-defs-cache-ljXzJCfc.mjs} +2 -2
- package/dist/{field-defs-cache-CYYx8xlG.mjs.map → field-defs-cache-ljXzJCfc.mjs.map} +1 -1
- package/dist/{fts-manager-DW_NR-Fs.mjs → fts-manager-BbCCbEKA.mjs} +2 -2
- package/dist/{fts-manager-DW_NR-Fs.mjs.map → fts-manager-BbCCbEKA.mjs.map} +1 -1
- package/dist/{index-BroXT-vD.d.mts → index-BRNabKrx.d.mts} +53 -15
- package/dist/index-BRNabKrx.d.mts.map +1 -0
- package/dist/{index-qbL02uhs.d.mts → index-Dt0OKJB4.d.mts} +2 -2
- package/dist/{index-qbL02uhs.d.mts.map → index-Dt0OKJB4.d.mts.map} +1 -1
- package/dist/index.d.mts +12 -12
- package/dist/index.mjs +43 -43
- package/dist/{load-DMFi4n1p.mjs → load-DMjXghbZ.mjs} +2 -2
- package/dist/{load-DMFi4n1p.mjs.map → load-DMjXghbZ.mjs.map} +1 -1
- package/dist/{loader-BR2SgfEc.mjs → loader-BA_zhkS_.mjs} +82 -19
- package/dist/loader-BA_zhkS_.mjs.map +1 -0
- package/dist/{manifest-schema-BWKnQYQF.mjs → manifest-schema-kPGX7VS-.mjs} +4 -1
- package/dist/manifest-schema-kPGX7VS-.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 +9 -9
- package/dist/media/local-runtime.d.mts.map +1 -1
- package/dist/media/local-runtime.mjs +17 -5
- package/dist/media/local-runtime.mjs.map +1 -1
- package/dist/{media-CTjJoJTh.mjs → media-C5t_eCnk.mjs} +4 -2
- package/dist/media-C5t_eCnk.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-8O6xNcYW.mjs → menus-CBb6UrMU.mjs} +3 -3
- package/dist/{menus-8O6xNcYW.mjs.map → menus-CBb6UrMU.mjs.map} +1 -1
- package/dist/{menus-GvRSpgIA.mjs → menus-CYH09a41.mjs} +65 -41
- package/dist/menus-CYH09a41.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/{object-cache-SEb2IM4Z.mjs → object-cache-CHbHv83-.mjs} +8 -4
- package/dist/object-cache-CHbHv83-.mjs.map +1 -0
- package/dist/{options-CqECG0gM.d.mts → options-41nCWqi9.d.mts} +3 -3
- package/dist/{options-CqECG0gM.d.mts.map → options-41nCWqi9.d.mts.map} +1 -1
- package/dist/page/index.d.mts +5 -2
- package/dist/page/index.d.mts.map +1 -1
- package/dist/page/index.mjs +3 -2
- package/dist/page/index.mjs.map +1 -1
- package/dist/{parse-DHI873qU.mjs → parse-BwAdS7FZ.mjs} +2 -2
- package/dist/{parse-DHI873qU.mjs.map → parse-BwAdS7FZ.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 +5 -2
- package/dist/plugin-types.d.mts.map +1 -1
- package/dist/plugin-utils.d.mts +8 -8
- package/dist/plugins/adapt-sandbox-entry.d.mts +8 -8
- package/dist/plugins/adapt-sandbox-entry.mjs +1 -1
- package/dist/{query-DZdlS6Cu.mjs → query-BpQb-blG.mjs} +15 -15
- package/dist/{query-DZdlS6Cu.mjs.map → query-BpQb-blG.mjs.map} +1 -1
- package/dist/{rate-limit-D1Y6VFVP.mjs → rate-limit-Dap6HMNM.mjs} +2 -2
- package/dist/{rate-limit-D1Y6VFVP.mjs.map → rate-limit-Dap6HMNM.mjs.map} +1 -1
- package/dist/{redirect-C1KVGYWe.mjs → redirect-_M0trWoo.mjs} +2 -2
- package/dist/{redirect-C1KVGYWe.mjs.map → redirect-_M0trWoo.mjs.map} +1 -1
- package/dist/{redirects-x9eFPeyi.mjs → redirects-Dcbuisoj.mjs} +2 -1
- package/dist/redirects-Dcbuisoj.mjs.map +1 -0
- package/dist/{redirects-DgnypVir.mjs → redirects-w0V9vj_j.mjs} +3 -3
- package/dist/{redirects-DgnypVir.mjs.map → redirects-w0V9vj_j.mjs.map} +1 -1
- package/dist/{registry-CJkCubOJ.mjs → registry-g8yYt4cC.mjs} +14 -4
- package/dist/registry-g8yYt4cC.mjs.map +1 -0
- package/dist/{runner-CEtq-6Sm.d.mts → runner-BbR3DfrL.d.mts} +2 -2
- package/dist/{runner-CEtq-6Sm.d.mts.map → runner-BbR3DfrL.d.mts.map} +1 -1
- package/dist/{runner-BsquExlK.mjs → runner-DPdt_Wpa.mjs} +250 -178
- package/dist/runner-DPdt_Wpa.mjs.map +1 -0
- package/dist/runtime.d.mts +9 -9
- package/dist/runtime.mjs +2 -2
- package/dist/{schema-DMjXuvNU.mjs → schema-DoLd3j2e.mjs} +5 -5
- package/dist/{schema-DMjXuvNU.mjs.map → schema-DoLd3j2e.mjs.map} +1 -1
- package/dist/{search-D1wKk3lc.mjs → search-BR0ZeZmh.mjs} +4 -4
- package/dist/{search-D1wKk3lc.mjs.map → search-BR0ZeZmh.mjs.map} +1 -1
- package/dist/{sections-CCMic8dB.mjs → sections-5J2YJPqJ.mjs} +3 -3
- package/dist/{sections-CCMic8dB.mjs.map → sections-5J2YJPqJ.mjs.map} +1 -1
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +15 -15
- package/dist/seo/index.d.mts +1 -1
- package/dist/{seo-DCEF-AVr.mjs → seo-BkhuuaaE.mjs} +25 -3
- package/dist/seo-BkhuuaaE.mjs.map +1 -0
- package/dist/{seo-3QrZ1EPT.mjs → seo-DKeXHkzE.mjs} +3 -3
- package/dist/{seo-3QrZ1EPT.mjs.map → seo-DKeXHkzE.mjs.map} +1 -1
- package/dist/{service-CQHK_10l.mjs → service-BbO2s8gT.mjs} +2 -2
- package/dist/{service-CQHK_10l.mjs.map → service-BbO2s8gT.mjs.map} +1 -1
- package/dist/{settings-C3Yi5Co3.mjs → settings-BMNr9Dmi.mjs} +3 -3
- package/dist/{settings-C3Yi5Co3.mjs.map → settings-BMNr9Dmi.mjs.map} +1 -1
- package/dist/{settings-D9rvaLuY.mjs → settings-DJeki-97.mjs} +4 -4
- package/dist/{settings-D9rvaLuY.mjs.map → settings-DJeki-97.mjs.map} +1 -1
- package/dist/{taxonomies-DhLaNJji.mjs → taxonomies-CM_fUqLU.mjs} +5 -4
- package/dist/taxonomies-CM_fUqLU.mjs.map +1 -0
- package/dist/{taxonomies-CurpLtNC.mjs → taxonomies-D13i2ctt.mjs} +76 -21
- package/dist/taxonomies-D13i2ctt.mjs.map +1 -0
- package/dist/{taxonomy-BBUlGug5.mjs → taxonomy-BU0LjdVb.mjs} +4 -4
- package/dist/{taxonomy-BBUlGug5.mjs.map → taxonomy-BU0LjdVb.mjs.map} +1 -1
- package/dist/{types-TTx8uP7V.d.mts → types-BYnDBVwe.d.mts} +27 -5
- package/dist/{types-TTx8uP7V.d.mts.map → types-BYnDBVwe.d.mts.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-CmI1OyQg.mjs → types-CZgK3EMW.mjs} +2 -2
- package/dist/{types-CmI1OyQg.mjs.map → types-CZgK3EMW.mjs.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-tM44hEcf.mjs.map +1 -1
- package/dist/{types-B-gIxFCE.d.mts → types-xIfVRNLp.d.mts} +38 -1
- package/dist/types-xIfVRNLp.d.mts.map +1 -0
- package/dist/{user-JAuc8VUf.mjs → user-DkG2jKCp.mjs} +3 -3
- package/dist/{user-JAuc8VUf.mjs.map → user-DkG2jKCp.mjs.map} +1 -1
- package/dist/{validate-DOFrIb-c.d.mts → validate-CG0V0wNR.d.mts} +3 -3
- package/dist/{validate-DOFrIb-c.d.mts.map → validate-CG0V0wNR.d.mts.map} +1 -1
- package/dist/{validate-BzXHWnkV.mjs → validate-CuJ1Ps9j.mjs} +2 -2
- package/dist/{validate-BzXHWnkV.mjs.map → validate-CuJ1Ps9j.mjs.map} +1 -1
- package/dist/{validation-CY1gk4Ar.mjs → validation-CwUfTdGF.mjs} +6 -6
- package/dist/{validation-CY1gk4Ar.mjs.map → validation-CwUfTdGF.mjs.map} +1 -1
- package/dist/version-BoNBItP_.mjs +7 -0
- package/dist/{version-C0JPFUG8.mjs.map → version-BoNBItP_.mjs.map} +1 -1
- package/dist/{widgets-Dri0spI4.mjs → widgets-BfOZ-ajY.mjs} +2 -2
- package/dist/{widgets-Dri0spI4.mjs.map → widgets-BfOZ-ajY.mjs.map} +1 -1
- package/dist/{zod-generator-xEHODMJf.mjs → zod-generator-gFsRuNNy.mjs} +6 -3
- package/dist/zod-generator-gFsRuNNy.mjs.map +1 -0
- 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/handlers/taxonomies.ts +5 -1
- package/src/api/schemas/schema.ts +1 -0
- package/src/astro/integration/virtual-modules.ts +15 -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/astro/routes/sitemap-[collection].xml.ts +5 -4
- package/src/components/EmDashHead.astro +23 -3
- package/src/components/EmDashImage.astro +4 -7
- package/src/components/Image.astro +14 -4
- package/src/components/InlinePortableTextEditor.tsx +48 -1
- package/src/components/JsonLdScript.astro +9 -0
- package/src/database/migrations/036_i18n_menus_and_taxonomies.ts +16 -0
- package/src/database/migrations/046_media_usage_index.ts +115 -0
- package/src/database/migrations/047_restore_taxonomy_parent_index.ts +29 -0
- package/src/database/migrations/runner.ts +4 -0
- package/src/database/repositories/content.ts +8 -5
- package/src/database/repositories/media-usage.ts +444 -0
- package/src/database/repositories/media.ts +9 -1
- package/src/database/types.ts +39 -0
- package/src/emdash-runtime.ts +72 -25
- package/src/index.ts +3 -0
- package/src/loader.ts +110 -31
- 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/media/usage/extractor.ts +302 -0
- package/src/media/usage/types.ts +46 -0
- package/src/object-cache/index.ts +8 -2
- package/src/page/metadata.ts +23 -3
- package/src/plugin-types.ts +12 -0
- package/src/plugins/context.ts +8 -0
- package/src/plugins/define-plugin.ts +14 -5
- package/src/plugins/hooks.ts +66 -33
- package/src/plugins/index.ts +6 -0
- package/src/plugins/manager.ts +33 -0
- package/src/plugins/manifest-schema.ts +3 -0
- package/src/plugins/types.ts +41 -2
- package/src/schema/registry.ts +25 -0
- package/src/schema/types.ts +10 -0
- package/src/schema/zod-generator.ts +9 -1
- package/src/seed/apply.ts +7 -0
- package/src/taxonomies/index.ts +121 -18
- 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/loader-BR2SgfEc.mjs.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/object-cache-SEb2IM4Z.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/runner-BsquExlK.mjs.map +0 -1
- package/dist/seo-DCEF-AVr.mjs.map +0 -1
- package/dist/taxonomies-CurpLtNC.mjs.map +0 -1
- package/dist/taxonomies-DhLaNJji.mjs.map +0 -1
- package/dist/types-B-gIxFCE.d.mts.map +0 -1
- package/dist/version-C0JPFUG8.mjs +0 -7
- package/dist/zod-generator-xEHODMJf.mjs.map +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { n as getI18nConfig } from "../../../../../../config-CVssduLe.mjs";
|
|
2
2
|
import "../../../../../../after-B1IIdH3Y.mjs";
|
|
3
3
|
import "../../../../../../base64-CmWvODNW.mjs";
|
|
4
|
-
import "../../../../../../types-
|
|
4
|
+
import "../../../../../../types-CZgK3EMW.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-rVGiqWDt.mjs";
|
|
7
|
+
import { r as parseOptionalBody, t as isParseError } from "../../../../../../parse-BwAdS7FZ.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-BZnOGJFo.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
|
-
import "../../../../../../types-
|
|
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-
|
|
2
|
+
import "../../../../../../types-CZgK3EMW.mjs";
|
|
3
|
+
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-rVGiqWDt.mjs";
|
|
4
|
+
import { r as parseOptionalBody, t as isParseError } from "../../../../../../parse-BwAdS7FZ.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-BZnOGJFo.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
|
-
import "../../../../../../types-
|
|
3
|
-
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-
|
|
4
|
-
import { t as requireOwnerPerm } from "../../../../../../authorize-
|
|
2
|
+
import "../../../../../../types-CZgK3EMW.mjs";
|
|
3
|
+
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-rVGiqWDt.mjs";
|
|
4
|
+
import { t as requireOwnerPerm } from "../../../../../../authorize-BZnOGJFo.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
|
-
import "../../../../../../types-
|
|
3
|
-
import { a as unwrapResult, t as apiError } from "../../../../../../error-
|
|
4
|
-
import { n as requirePerm } from "../../../../../../authorize-
|
|
2
|
+
import "../../../../../../types-CZgK3EMW.mjs";
|
|
3
|
+
import { a as unwrapResult, t as apiError } from "../../../../../../error-rVGiqWDt.mjs";
|
|
4
|
+
import { n as requirePerm } from "../../../../../../authorize-BZnOGJFo.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
|
-
import "../../../../../../types-
|
|
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-
|
|
2
|
+
import "../../../../../../types-CZgK3EMW.mjs";
|
|
3
|
+
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-rVGiqWDt.mjs";
|
|
4
|
+
import { n as parseBody, t as isParseError } from "../../../../../../parse-BwAdS7FZ.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-BZnOGJFo.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
|
-
import "../../../../../../../object-cache-
|
|
4
|
-
import { t as ContentRepository } from "../../../../../../../content-
|
|
3
|
+
import "../../../../../../../object-cache-CHbHv83-.mjs";
|
|
4
|
+
import { t as ContentRepository } from "../../../../../../../content-ncUWWjna.mjs";
|
|
5
5
|
import "../../../../../../../base64-CmWvODNW.mjs";
|
|
6
|
-
import "../../../../../../../types-
|
|
7
|
-
import { t as TaxonomyRepository } from "../../../../../../../taxonomy-
|
|
6
|
+
import "../../../../../../../types-CZgK3EMW.mjs";
|
|
7
|
+
import { t as TaxonomyRepository } from "../../../../../../../taxonomy-BU0LjdVb.mjs";
|
|
8
8
|
import "../../../../../../../request-cache-KCNHp_RJ.mjs";
|
|
9
|
-
import "../../../../../../../loader-
|
|
9
|
+
import "../../../../../../../loader-BA_zhkS_.mjs";
|
|
10
10
|
import "../../../../../../../resolve-C7I0qiR0.mjs";
|
|
11
|
-
import {
|
|
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 { u as invalidateTermCache } from "../../../../../../../taxonomies-D13i2ctt.mjs";
|
|
12
|
+
import { i as requireDb, n as apiSuccess, r as handleError, t as apiError } from "../../../../../../../error-rVGiqWDt.mjs";
|
|
13
|
+
import { n as parseBody, t as isParseError } from "../../../../../../../parse-BwAdS7FZ.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-BZnOGJFo.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
|
-
import "../../../../../../types-
|
|
3
|
-
import { a as unwrapResult, t as apiError } from "../../../../../../error-
|
|
4
|
-
import { n as requirePerm } from "../../../../../../authorize-
|
|
2
|
+
import "../../../../../../types-CZgK3EMW.mjs";
|
|
3
|
+
import { a as unwrapResult, t as apiError } from "../../../../../../error-rVGiqWDt.mjs";
|
|
4
|
+
import { n as requirePerm } from "../../../../../../authorize-BZnOGJFo.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
|
-
import "../../../../../../types-
|
|
3
|
-
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-
|
|
4
|
-
import { t as requireOwnerPerm } from "../../../../../../authorize-
|
|
2
|
+
import "../../../../../../types-CZgK3EMW.mjs";
|
|
3
|
+
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../../error-rVGiqWDt.mjs";
|
|
4
|
+
import { t as requireOwnerPerm } from "../../../../../../authorize-BZnOGJFo.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
|
-
import "../../../../../types-
|
|
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-
|
|
2
|
+
import "../../../../../types-CZgK3EMW.mjs";
|
|
3
|
+
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../error-rVGiqWDt.mjs";
|
|
4
|
+
import { n as parseBody, t as isParseError } from "../../../../../parse-BwAdS7FZ.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-BZnOGJFo.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
|
-
import "../../../../../types-
|
|
3
|
-
import { a as unwrapResult, t as apiError } from "../../../../../error-
|
|
4
|
-
import { n as requirePerm } from "../../../../../authorize-
|
|
2
|
+
import "../../../../../types-CZgK3EMW.mjs";
|
|
3
|
+
import { a as unwrapResult, t as apiError } from "../../../../../error-rVGiqWDt.mjs";
|
|
4
|
+
import { n as requirePerm } from "../../../../../authorize-BZnOGJFo.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
|
-
import "../../../../../types-
|
|
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-
|
|
2
|
+
import "../../../../../types-CZgK3EMW.mjs";
|
|
3
|
+
import { a as unwrapResult, o as mapErrorStatus, t as apiError } from "../../../../../error-rVGiqWDt.mjs";
|
|
4
|
+
import { i as parseQuery, n as parseBody, t as isParseError } from "../../../../../parse-BwAdS7FZ.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-BZnOGJFo.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
|
-
import "../../../../../types-
|
|
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-
|
|
2
|
+
import "../../../../../types-CZgK3EMW.mjs";
|
|
3
|
+
import { a as unwrapResult, t as apiError } from "../../../../../error-rVGiqWDt.mjs";
|
|
4
|
+
import { i as parseQuery, t as isParseError } from "../../../../../parse-BwAdS7FZ.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-BZnOGJFo.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
|
-
import "../../../object-cache-
|
|
3
|
-
import "../../../content-
|
|
2
|
+
import "../../../object-cache-CHbHv83-.mjs";
|
|
3
|
+
import "../../../content-ncUWWjna.mjs";
|
|
4
4
|
import "../../../base64-CmWvODNW.mjs";
|
|
5
|
-
import "../../../types-
|
|
6
|
-
import "../../../media-
|
|
7
|
-
import "../../../user-
|
|
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-
|
|
5
|
+
import "../../../types-CZgK3EMW.mjs";
|
|
6
|
+
import "../../../media-C5t_eCnk.mjs";
|
|
7
|
+
import "../../../user-DkG2jKCp.mjs";
|
|
8
|
+
import { t as handleDashboardStats } from "../../../dashboard-CotyqQrW.mjs";
|
|
9
|
+
import { a as unwrapResult, r as handleError, t as apiError } from "../../../error-rVGiqWDt.mjs";
|
|
10
|
+
import { n as requirePerm } from "../../../authorize-BZnOGJFo.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
|
-
import "../../../../types-
|
|
3
|
-
import { n as apiSuccess, t as apiError } from "../../../../error-
|
|
2
|
+
import "../../../../types-CZgK3EMW.mjs";
|
|
3
|
+
import { n as apiSuccess, t as apiError } from "../../../../error-rVGiqWDt.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,5 +1,5 @@
|
|
|
1
|
-
import "../../../../types-
|
|
2
|
-
import "../../../../index-
|
|
1
|
+
import "../../../../types-xIfVRNLp.mjs";
|
|
2
|
+
import "../../../../index-Dt0OKJB4.mjs";
|
|
3
3
|
import { g as ProbeResult } from "../../../../types-CUsXGRVj.mjs";
|
|
4
4
|
import { APIRoute } from "astro";
|
|
5
5
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import "../../../../base64-CmWvODNW.mjs";
|
|
2
|
-
import "../../../../types-
|
|
2
|
+
import "../../../../types-CZgK3EMW.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-rVGiqWDt.mjs";
|
|
5
|
+
import { n as parseBody, t as isParseError } from "../../../../parse-BwAdS7FZ.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-BZnOGJFo.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
|
-
import "../../../../../types-
|
|
2
|
+
import "../../../../../types-CZgK3EMW.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-rVGiqWDt.mjs";
|
|
5
|
+
import { n as requirePerm } from "../../../../../authorize-BZnOGJFo.mjs";
|
|
6
6
|
import mime from "mime/lite";
|
|
7
7
|
import { SchemaRegistry, parseWxrString } from "emdash";
|
|
8
8
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import "../../../../../options-
|
|
2
|
-
import "../../../../../types-
|
|
3
|
-
import "../../../../../types-
|
|
4
|
-
import "../../../../../byline-fields-
|
|
5
|
-
import "../../../../../index-
|
|
6
|
-
import "../../../../../runner-
|
|
7
|
-
import "../../../../../index-
|
|
1
|
+
import "../../../../../options-41nCWqi9.mjs";
|
|
2
|
+
import "../../../../../types-xIfVRNLp.mjs";
|
|
3
|
+
import "../../../../../types-BYnDBVwe.mjs";
|
|
4
|
+
import "../../../../../byline-fields-KD3JFRuH.mjs";
|
|
5
|
+
import "../../../../../index-BRNabKrx.mjs";
|
|
6
|
+
import "../../../../../runner-BbR3DfrL.mjs";
|
|
7
|
+
import "../../../../../index-Dt0OKJB4.mjs";
|
|
8
8
|
import "../../../../../types-CUsXGRVj.mjs";
|
|
9
|
-
import "../../../../../validate-
|
|
9
|
+
import "../../../../../validate-CG0V0wNR.mjs";
|
|
10
10
|
import { EmDashHandlers, EmDashManifest } from "../../../../types.mjs";
|
|
11
11
|
import { Kysely } from "kysely";
|
|
12
12
|
import { WxrPost } from "emdash";
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import "../../../../../dialect-helpers-DRI5pyY3.mjs";
|
|
2
2
|
import "../../../../../after-B1IIdH3Y.mjs";
|
|
3
|
-
import "../../../../../object-cache-
|
|
3
|
+
import "../../../../../object-cache-CHbHv83-.mjs";
|
|
4
4
|
import { n as slugify } from "../../../../../slugify-Cce3dTdg.mjs";
|
|
5
5
|
import "../../../../../base64-CmWvODNW.mjs";
|
|
6
|
-
import "../../../../../types-
|
|
7
|
-
import { t as TaxonomyRepository } from "../../../../../taxonomy-
|
|
6
|
+
import "../../../../../types-CZgK3EMW.mjs";
|
|
7
|
+
import { t as TaxonomyRepository } from "../../../../../taxonomy-BU0LjdVb.mjs";
|
|
8
8
|
import "../../../../../request-cache-KCNHp_RJ.mjs";
|
|
9
9
|
import "../../../../../byline-registry-BOjqDOim.mjs";
|
|
10
|
-
import "../../../../../field-defs-cache-
|
|
11
|
-
import { t as BylineRepository } from "../../../../../byline-
|
|
12
|
-
import "../../../../../loader-
|
|
10
|
+
import "../../../../../field-defs-cache-ljXzJCfc.mjs";
|
|
11
|
+
import { t as BylineRepository } from "../../../../../byline-LL8lyqdb.mjs";
|
|
12
|
+
import "../../../../../loader-BA_zhkS_.mjs";
|
|
13
13
|
import { i as resolveLocaleChain } from "../../../../../resolve-C7I0qiR0.mjs";
|
|
14
|
-
import {
|
|
15
|
-
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-
|
|
14
|
+
import { u as invalidateTermCache } from "../../../../../taxonomies-D13i2ctt.mjs";
|
|
15
|
+
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-rVGiqWDt.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-BZnOGJFo.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-41nCWqi9.mjs";
|
|
2
|
+
import "../../../../../types-xIfVRNLp.mjs";
|
|
3
|
+
import "../../../../../types-BYnDBVwe.mjs";
|
|
4
|
+
import "../../../../../byline-fields-KD3JFRuH.mjs";
|
|
5
|
+
import "../../../../../index-BRNabKrx.mjs";
|
|
6
|
+
import "../../../../../runner-BbR3DfrL.mjs";
|
|
7
|
+
import "../../../../../index-Dt0OKJB4.mjs";
|
|
8
|
+
import "../../../../../types-CUsXGRVj.mjs";
|
|
9
|
+
import "../../../../../validate-CG0V0wNR.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
|
-
import "../../../../../types-
|
|
2
|
+
import "../../../../../types-CZgK3EMW.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-rVGiqWDt.mjs";
|
|
6
|
+
import { n as parseBody, t as isParseError } from "../../../../../parse-BwAdS7FZ.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-BZnOGJFo.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,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AO,SAAS,KAAK;IACpB,MAAM,WAAW;IACjB,aAAa,WAAW;IACxB;IACA,SAAS,UAAU;IACnB,CAAC;AAGF,UAAO,OAAO,WAAW,OAAO;AAGhC,cAAW;IACV,MAAM;IACN;IACA;IACA;IACA,QAAQ;IACR,CAAC;WACM,OAAO;AACf,WAAQ,MAAM,2BAA2B,SAAS,KAAK,MAAM;GAC7D,MAAM,WAAW;AACjB,UAAO,OAAO,KAAK;IAClB,MAAM,WAAW;IACjB,aAAa,WAAW;IACxB,OAAO;IACP,CAAC;AACF,cAAW;IACV,MAAM;IACN;IACA;IACA;IACA,QAAQ;IACR,OAAO;IACP,CAAC;;;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;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ODNW.mjs";
|
|
2
|
-
import "../../../../../types-
|
|
2
|
+
import "../../../../../types-CZgK3EMW.mjs";
|
|
3
3
|
import { n as FIELD_TYPES } from "../../../../../types-tM44hEcf.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 { g as wpPrepareBody } from "../../../../../byline-fields-
|
|
4
|
+
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-rVGiqWDt.mjs";
|
|
5
|
+
import { n as parseBody, t as isParseError } from "../../../../../parse-BwAdS7FZ.mjs";
|
|
6
|
+
import "../../../../../redirects-Dcbuisoj.mjs";
|
|
7
|
+
import { g as wpPrepareBody } from "../../../../../byline-fields-eyJMblSr.mjs";
|
|
8
8
|
import "../../../../../status-vUK0SA17.mjs";
|
|
9
9
|
import "../../../../../api/schemas/index.mjs";
|
|
10
|
-
import { n as requirePerm } from "../../../../../authorize-
|
|
10
|
+
import { n as requirePerm } from "../../../../../authorize-BZnOGJFo.mjs";
|
|
11
11
|
import { capitalize, sanitizeSlug, singularize } from "./analyze.mjs";
|
|
12
12
|
|
|
13
13
|
//#region src/astro/routes/api/import/wordpress/prepare.ts
|
|
@@ -32,7 +32,7 @@ const POST = async ({ request, locals }) => {
|
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
async function prepareImport(db, request) {
|
|
35
|
-
const { SchemaRegistry } = await import("../../../../../registry-
|
|
35
|
+
const { SchemaRegistry } = await import("../../../../../registry-g8yYt4cC.mjs").then((n) => n.r);
|
|
36
36
|
const registry = new SchemaRegistry(db);
|
|
37
37
|
const result = {
|
|
38
38
|
success: true,
|
|
@@ -98,7 +98,7 @@ async function prepareImport(db, request) {
|
|
|
98
98
|
"post",
|
|
99
99
|
"page"
|
|
100
100
|
].includes(collectionSlug)) {
|
|
101
|
-
const { FTSManager } = await import("../../../../../fts-manager-
|
|
101
|
+
const { FTSManager } = await import("../../../../../fts-manager-BbCCbEKA.mjs").then((n) => n.n);
|
|
102
102
|
const ftsManager = new FTSManager(db);
|
|
103
103
|
if ((await ftsManager.getSearchableFields(collectionSlug)).length > 0) try {
|
|
104
104
|
await ftsManager.enableSearch(collectionSlug);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { t as validateIdentifier } from "../../../../../validate-VPnKoIzW.mjs";
|
|
2
2
|
import "../../../../../base64-CmWvODNW.mjs";
|
|
3
|
-
import "../../../../../types-
|
|
4
|
-
import { n as normalizeMediaValue } from "../../../../../normalize-
|
|
5
|
-
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-
|
|
6
|
-
import { n as parseBody, t as isParseError } from "../../../../../parse-
|
|
7
|
-
import "../../../../../redirects-
|
|
8
|
-
import { _ as wpRewriteUrlsBody } from "../../../../../byline-fields-
|
|
3
|
+
import "../../../../../types-CZgK3EMW.mjs";
|
|
4
|
+
import { n as normalizeMediaValue } from "../../../../../normalize-CeglrBT9.mjs";
|
|
5
|
+
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-rVGiqWDt.mjs";
|
|
6
|
+
import { n as parseBody, t as isParseError } from "../../../../../parse-BwAdS7FZ.mjs";
|
|
7
|
+
import "../../../../../redirects-Dcbuisoj.mjs";
|
|
8
|
+
import { _ as wpRewriteUrlsBody } from "../../../../../byline-fields-eyJMblSr.mjs";
|
|
9
9
|
import "../../../../../status-vUK0SA17.mjs";
|
|
10
10
|
import "../../../../../api/schemas/index.mjs";
|
|
11
|
-
import { n as requirePerm } from "../../../../../authorize-
|
|
11
|
+
import { n as requirePerm } from "../../../../../authorize-BZnOGJFo.mjs";
|
|
12
12
|
import { buildBaseUrlMap, extractMediaUrl, findMatchingUrl, rewritePortableTextUrls, rewriteStringUrls } from "./rewrite-url-helpers.mjs";
|
|
13
13
|
import { sql } from "kysely";
|
|
14
14
|
|
|
@@ -35,7 +35,7 @@ const POST = async ({ request, locals }) => {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
async function rewriteUrls(db, urlMap, getProvider, collections) {
|
|
38
|
-
const { SchemaRegistry } = await import("../../../../../registry-
|
|
38
|
+
const { SchemaRegistry } = await import("../../../../../registry-g8yYt4cC.mjs").then((n) => n.r);
|
|
39
39
|
const registry = new SchemaRegistry(db);
|
|
40
40
|
const result = {
|
|
41
41
|
updated: 0,
|