dineway 0.1.9 → 0.1.12
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/README.md +63 -17
- package/dist/activity-events-B4wp7CrU.mjs +540 -0
- package/dist/allowed-origins-C1AKK9AT.mjs +68 -0
- package/dist/api/route-utils.d.mts +42 -0
- package/dist/api/route-utils.mjs +26 -0
- package/dist/api/schemas/index.d.mts +3 -0
- package/dist/api/schemas/index.mjs +6 -0
- package/dist/api/schemas/setup.d.mts +42 -0
- package/dist/api/schemas/setup.mjs +39 -0
- package/dist/api-BR7Y0GBo.mjs +2704 -0
- package/dist/api-tokens-CPjC3zf8.mjs +3 -0
- package/dist/api-tokens-D7UjLbdt.mjs +153 -0
- package/dist/{apply-iVSqz2qs.mjs → apply-Bm5QgdrE.mjs} +15 -689
- package/dist/astro/index.d.mts +11 -6
- package/dist/astro/index.mjs +86 -11
- package/dist/astro/middleware/auth.d.mts +11 -7
- package/dist/astro/middleware/auth.mjs +19 -104
- package/dist/astro/middleware/redirect.mjs +24 -14
- package/dist/astro/middleware/request-context.mjs +9 -6
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware.mjs +88 -145
- package/dist/astro/routes/PluginRegistry.d.mts +14 -0
- package/dist/astro/routes/PluginRegistry.mjs +24 -0
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.d.mts +14 -0
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +65 -0
- package/dist/astro/routes/api/admin/allowed-domains/index.d.mts +14 -0
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +65 -0
- package/dist/astro/routes/api/admin/api-tokens/_id_.d.mts +10 -0
- package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +33 -0
- package/dist/astro/routes/api/admin/api-tokens/index.d.mts +16 -0
- package/dist/astro/routes/api/admin/api-tokens/index.mjs +59 -0
- package/dist/astro/routes/api/admin/briefing.d.mts +7 -0
- package/dist/astro/routes/api/admin/briefing.mjs +71 -0
- package/dist/astro/routes/api/admin/bylines/_id_/index.d.mts +9 -0
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +74 -0
- package/dist/astro/routes/api/admin/bylines/index.d.mts +8 -0
- package/dist/astro/routes/api/admin/bylines/index.mjs +61 -0
- package/dist/astro/routes/api/admin/comments/_id_/status.d.mts +7 -0
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +80 -0
- package/dist/astro/routes/api/admin/comments/_id_.d.mts +14 -0
- package/dist/astro/routes/api/admin/comments/_id_.mjs +46 -0
- package/dist/astro/routes/api/admin/comments/bulk.d.mts +7 -0
- package/dist/astro/routes/api/admin/comments/bulk.mjs +36 -0
- package/dist/astro/routes/api/admin/comments/counts.d.mts +7 -0
- package/dist/astro/routes/api/admin/comments/counts.mjs +24 -0
- package/dist/astro/routes/api/admin/comments/index.d.mts +10 -0
- package/dist/astro/routes/api/admin/comments/index.mjs +40 -0
- package/dist/astro/routes/api/admin/context/_id_/history.d.mts +7 -0
- package/dist/astro/routes/api/admin/context/_id_/history.mjs +46 -0
- package/dist/astro/routes/api/admin/context/_id_/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/context/_id_/index.mjs +46 -0
- package/dist/astro/routes/api/admin/context/_id_/review.d.mts +7 -0
- package/dist/astro/routes/api/admin/context/_id_/review.mjs +61 -0
- package/dist/astro/routes/api/admin/context/_id_/supersede.d.mts +7 -0
- package/dist/astro/routes/api/admin/context/_id_/supersede.mjs +64 -0
- package/dist/astro/routes/api/admin/context/diff.d.mts +7 -0
- package/dist/astro/routes/api/admin/context/diff.mjs +50 -0
- package/dist/astro/routes/api/admin/context/index.d.mts +8 -0
- package/dist/astro/routes/api/admin/context/index.mjs +72 -0
- package/dist/astro/routes/api/admin/context/stale.d.mts +7 -0
- package/dist/astro/routes/api/admin/context/stale.mjs +50 -0
- package/dist/astro/routes/api/admin/hitl-requests/_id_/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/hitl-requests/_id_/index.mjs +52 -0
- package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.d.mts +7 -0
- package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.mjs +68 -0
- package/dist/astro/routes/api/admin/hitl-requests/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/hitl-requests/index.mjs +56 -0
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.d.mts +7 -0
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +99 -0
- package/dist/astro/routes/api/admin/hooks/exclusive/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +33 -0
- package/dist/astro/routes/api/admin/oauth-clients/_id_.d.mts +18 -0
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +79 -0
- package/dist/astro/routes/api/admin/oauth-clients/index.d.mts +14 -0
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs +58 -0
- package/dist/astro/routes/api/admin/plugins/_id_/disable.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +90 -0
- package/dist/astro/routes/api/admin/plugins/_id_/enable.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +90 -0
- package/dist/astro/routes/api/admin/plugins/_id_/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +55 -0
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +99 -0
- package/dist/astro/routes/api/admin/plugins/_id_/update.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +132 -0
- package/dist/astro/routes/api/admin/plugins/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/index.mjs +53 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +36 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +55 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +129 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +62 -0
- package/dist/astro/routes/api/admin/plugins/updates.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/updates.mjs +53 -0
- package/dist/astro/routes/api/admin/review-requests/_id_/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/review-requests/_id_/index.mjs +26 -0
- package/dist/astro/routes/api/admin/review-requests/_id_/resolve.d.mts +7 -0
- package/dist/astro/routes/api/admin/review-requests/_id_/resolve.mjs +98 -0
- package/dist/astro/routes/api/admin/review-requests/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/review-requests/index.mjs +31 -0
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +55 -0
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.d.mts +7 -0
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +36 -0
- package/dist/astro/routes/api/admin/themes/marketplace/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +71 -0
- package/dist/astro/routes/api/admin/users/_id_/disable.d.mts +7 -0
- package/dist/astro/routes/api/admin/users/_id_/disable.mjs +38 -0
- package/dist/astro/routes/api/admin/users/_id_/enable.d.mts +7 -0
- package/dist/astro/routes/api/admin/users/_id_/enable.mjs +29 -0
- package/dist/astro/routes/api/admin/users/_id_/index.d.mts +8 -0
- package/dist/astro/routes/api/admin/users/_id_/index.mjs +104 -0
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.d.mts +7 -0
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +43 -0
- package/dist/astro/routes/api/admin/users/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/users/index.mjs +54 -0
- package/dist/astro/routes/api/auth/dev-bypass.d.mts +8 -0
- package/dist/astro/routes/api/auth/dev-bypass.mjs +81 -0
- package/dist/astro/routes/api/auth/invite/accept.d.mts +7 -0
- package/dist/astro/routes/api/auth/invite/accept.mjs +31 -0
- package/dist/astro/routes/api/auth/invite/complete.d.mts +7 -0
- package/dist/astro/routes/api/auth/invite/complete.mjs +54 -0
- package/dist/astro/routes/api/auth/invite/index.d.mts +7 -0
- package/dist/astro/routes/api/auth/invite/index.mjs +51 -0
- package/dist/astro/routes/api/auth/invite/register-options.d.mts +7 -0
- package/dist/astro/routes/api/auth/invite/register-options.mjs +44 -0
- package/dist/astro/routes/api/auth/logout.d.mts +7 -0
- package/dist/astro/routes/api/auth/logout.mjs +24 -0
- package/dist/astro/routes/api/auth/magic-link/send.d.mts +7 -0
- package/dist/astro/routes/api/auth/magic-link/send.mjs +48 -0
- package/dist/astro/routes/api/auth/magic-link/verify.d.mts +7 -0
- package/dist/astro/routes/api/auth/magic-link/verify.mjs +32 -0
- package/dist/astro/routes/api/auth/me.d.mts +13 -0
- package/dist/astro/routes/api/auth/me.mjs +41 -0
- package/dist/astro/routes/api/auth/mode.d.mts +7 -0
- package/dist/astro/routes/api/auth/mode.mjs +28 -0
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.d.mts +7 -0
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +114 -0
- package/dist/astro/routes/api/auth/oauth/_provider_.d.mts +7 -0
- package/dist/astro/routes/api/auth/oauth/_provider_.mjs +58 -0
- package/dist/astro/routes/api/auth/passkey/_id_.d.mts +14 -0
- package/dist/astro/routes/api/auth/passkey/_id_.mjs +62 -0
- package/dist/astro/routes/api/auth/passkey/index.d.mts +7 -0
- package/dist/astro/routes/api/auth/passkey/index.mjs +25 -0
- package/dist/astro/routes/api/auth/passkey/options.d.mts +7 -0
- package/dist/astro/routes/api/auth/passkey/options.mjs +46 -0
- package/dist/astro/routes/api/auth/passkey/register/options.d.mts +7 -0
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +44 -0
- package/dist/astro/routes/api/auth/passkey/register/verify.d.mts +7 -0
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +59 -0
- package/dist/astro/routes/api/auth/passkey/verify.d.mts +7 -0
- package/dist/astro/routes/api/auth/passkey/verify.mjs +47 -0
- package/dist/astro/routes/api/auth/signup/complete.d.mts +7 -0
- package/dist/astro/routes/api/auth/signup/complete.mjs +55 -0
- package/dist/astro/routes/api/auth/signup/request.d.mts +7 -0
- package/dist/astro/routes/api/auth/signup/request.mjs +44 -0
- package/dist/astro/routes/api/auth/signup/verify.d.mts +7 -0
- package/dist/astro/routes/api/auth/signup/verify.mjs +32 -0
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.d.mts +14 -0
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +193 -0
- package/dist/astro/routes/api/content/_collection_/_id_/compare.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +17 -0
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +36 -0
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +39 -0
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +31 -0
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +78 -0
- package/dist/astro/routes/api/content/_collection_/_id_/publish.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +93 -0
- package/dist/astro/routes/api/content/_collection_/_id_/restore.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +36 -0
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +19 -0
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.d.mts +8 -0
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +75 -0
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.d.mts +14 -0
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +85 -0
- package/dist/astro/routes/api/content/_collection_/_id_/translations.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +40 -0
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +36 -0
- package/dist/astro/routes/api/content/_collection_/_id_.d.mts +9 -0
- package/dist/astro/routes/api/content/_collection_/_id_.mjs +114 -0
- package/dist/astro/routes/api/content/_collection_/index.d.mts +8 -0
- package/dist/astro/routes/api/content/_collection_/index.mjs +74 -0
- package/dist/astro/routes/api/content/_collection_/trash.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/trash.mjs +23 -0
- package/dist/astro/routes/api/dashboard.d.mts +7 -0
- package/dist/astro/routes/api/dashboard.mjs +26 -0
- package/dist/astro/routes/api/dev/emails.d.mts +8 -0
- package/dist/astro/routes/api/dev/emails.mjs +17 -0
- package/dist/astro/routes/api/health.d.mts +7 -0
- package/dist/astro/routes/api/health.mjs +34 -0
- package/dist/astro/routes/api/import/probe.d.mts +17 -0
- package/dist/astro/routes/api/import/probe.mjs +33 -0
- package/dist/astro/routes/api/import/wordpress/analyze.d.mts +87 -0
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +305 -0
- package/dist/astro/routes/api/import/wordpress/execute.d.mts +37 -0
- package/dist/astro/routes/api/import/wordpress/execute.mjs +198 -0
- package/dist/astro/routes/api/import/wordpress/media.d.mts +35 -0
- package/dist/astro/routes/api/import/wordpress/media.mjs +222 -0
- package/dist/astro/routes/api/import/wordpress/prepare.d.mts +19 -0
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +156 -0
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +21 -0
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +290 -0
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +15 -0
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +69 -0
- package/dist/astro/routes/api/import/wordpress-plugin/callback.d.mts +7 -0
- package/dist/astro/routes/api/import/wordpress-plugin/callback.mjs +28 -0
- package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +19 -0
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +269 -0
- package/dist/astro/routes/api/manifest.d.mts +7 -0
- package/dist/astro/routes/api/manifest.mjs +50 -0
- package/dist/astro/routes/api/mcp.d.mts +15 -0
- package/dist/astro/routes/api/mcp.mjs +2701 -0
- package/dist/astro/routes/api/media/_id_/confirm.d.mts +10 -0
- package/dist/astro/routes/api/media/_id_/confirm.mjs +59 -0
- package/dist/astro/routes/api/media/_id_.d.mts +22 -0
- package/dist/astro/routes/api/media/_id_.mjs +81 -0
- package/dist/astro/routes/api/media/file/_...key_.d.mts +7 -0
- package/dist/astro/routes/api/media/file/_...key_.mjs +49 -0
- package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.d.mts +14 -0
- package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +49 -0
- package/dist/astro/routes/api/media/providers/_providerId_/index.d.mts +14 -0
- package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +72 -0
- package/dist/astro/routes/api/media/providers/index.d.mts +10 -0
- package/dist/astro/routes/api/media/providers/index.mjs +18 -0
- package/dist/astro/routes/api/media/upload-url.d.mts +10 -0
- package/dist/astro/routes/api/media/upload-url.mjs +82 -0
- package/dist/astro/routes/api/media.d.mts +16 -0
- package/dist/astro/routes/api/media.mjs +137 -0
- package/dist/astro/routes/api/menus/_name_/items.d.mts +9 -0
- package/dist/astro/routes/api/menus/_name_/items.mjs +165 -0
- package/dist/astro/routes/api/menus/_name_/reorder.d.mts +7 -0
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +78 -0
- package/dist/astro/routes/api/menus/_name_.d.mts +9 -0
- package/dist/astro/routes/api/menus/_name_.mjs +124 -0
- package/dist/astro/routes/api/menus/index.d.mts +8 -0
- package/dist/astro/routes/api/menus/index.mjs +85 -0
- package/dist/astro/routes/api/oauth/authorize.d.mts +8 -0
- package/dist/astro/routes/api/oauth/authorize.mjs +265 -0
- package/dist/astro/routes/api/oauth/device/authorize.d.mts +7 -0
- package/dist/astro/routes/api/oauth/device/authorize.mjs +30 -0
- package/dist/astro/routes/api/oauth/device/code.d.mts +7 -0
- package/dist/astro/routes/api/oauth/device/code.mjs +34 -0
- package/dist/astro/routes/api/oauth/device/token.d.mts +7 -0
- package/dist/astro/routes/api/oauth/device/token.mjs +45 -0
- package/dist/astro/routes/api/oauth/register.d.mts +8 -0
- package/dist/astro/routes/api/oauth/register.mjs +115 -0
- package/dist/astro/routes/api/oauth/token/refresh.d.mts +7 -0
- package/dist/astro/routes/api/oauth/token/refresh.mjs +28 -0
- package/dist/astro/routes/api/oauth/token/revoke.d.mts +7 -0
- package/dist/astro/routes/api/oauth/token/revoke.mjs +25 -0
- package/dist/astro/routes/api/oauth/token.d.mts +8 -0
- package/dist/astro/routes/api/oauth/token.mjs +138 -0
- package/dist/astro/routes/api/openapi.json.d.mts +7 -0
- package/dist/astro/routes/api/openapi.json.mjs +2638 -0
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.d.mts +11 -0
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +77 -0
- package/dist/astro/routes/api/redirects/404s/index.d.mts +9 -0
- package/dist/astro/routes/api/redirects/404s/index.mjs +62 -0
- package/dist/astro/routes/api/redirects/404s/summary.d.mts +7 -0
- package/dist/astro/routes/api/redirects/404s/summary.mjs +34 -0
- package/dist/astro/routes/api/redirects/_id_.d.mts +9 -0
- package/dist/astro/routes/api/redirects/_id_.mjs +153 -0
- package/dist/astro/routes/api/redirects/index.d.mts +8 -0
- package/dist/astro/routes/api/redirects/index.mjs +98 -0
- package/dist/astro/routes/api/revisions/_revisionId_/index.d.mts +7 -0
- package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +16 -0
- package/dist/astro/routes/api/revisions/_revisionId_/restore.d.mts +7 -0
- package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +23 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.d.mts +9 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +99 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.d.mts +8 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +81 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.d.mts +7 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +68 -0
- package/dist/astro/routes/api/schema/collections/_slug_/index.d.mts +9 -0
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +98 -0
- package/dist/astro/routes/api/schema/collections/index.d.mts +8 -0
- package/dist/astro/routes/api/schema/collections/index.mjs +78 -0
- package/dist/astro/routes/api/schema/index.d.mts +7 -0
- package/dist/astro/routes/api/schema/index.mjs +79 -0
- package/dist/astro/routes/api/schema/orphans/_slug_.d.mts +7 -0
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +59 -0
- package/dist/astro/routes/api/schema/orphans/index.d.mts +7 -0
- package/dist/astro/routes/api/schema/orphans/index.mjs +54 -0
- package/dist/astro/routes/api/search/enable.d.mts +15 -0
- package/dist/astro/routes/api/search/enable.mjs +55 -0
- package/dist/astro/routes/api/search/index.d.mts +16 -0
- package/dist/astro/routes/api/search/index.mjs +52 -0
- package/dist/astro/routes/api/search/rebuild.d.mts +13 -0
- package/dist/astro/routes/api/search/rebuild.mjs +48 -0
- package/dist/astro/routes/api/search/stats.d.mts +10 -0
- package/dist/astro/routes/api/search/stats.mjs +28 -0
- package/dist/astro/routes/api/search/suggest.d.mts +15 -0
- package/dist/astro/routes/api/search/suggest.mjs +43 -0
- package/dist/astro/routes/api/sections/_slug_.d.mts +9 -0
- package/dist/astro/routes/api/sections/_slug_.mjs +157 -0
- package/dist/astro/routes/api/sections/index.d.mts +8 -0
- package/dist/astro/routes/api/sections/index.mjs +100 -0
- package/dist/astro/routes/api/settings/email.d.mts +17 -0
- package/dist/astro/routes/api/settings/email.mjs +102 -0
- package/dist/astro/routes/api/settings.d.mts +20 -0
- package/dist/astro/routes/api/settings.mjs +102 -0
- package/dist/astro/routes/api/setup/admin-verify.d.mts +7 -0
- package/dist/astro/routes/api/setup/admin-verify.mjs +67 -0
- package/dist/astro/routes/api/setup/admin.d.mts +7 -0
- package/dist/astro/routes/api/setup/admin.mjs +68 -0
- package/dist/astro/routes/api/setup/dev-bypass.d.mts +8 -0
- package/dist/astro/routes/api/setup/dev-bypass.mjs +137 -0
- package/dist/astro/routes/api/setup/dev-reset.d.mts +7 -0
- package/dist/astro/routes/api/setup/dev-reset.mjs +22 -0
- package/dist/astro/routes/api/setup/index.d.mts +7 -0
- package/dist/astro/routes/api/setup/index.mjs +93 -0
- package/dist/astro/routes/api/setup/status.d.mts +7 -0
- package/dist/astro/routes/api/setup/status.mjs +57 -0
- package/dist/astro/routes/api/snapshot.d.mts +7 -0
- package/dist/astro/routes/api/snapshot.mjs +227 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.d.mts +18 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +190 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.d.mts +14 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +114 -0
- package/dist/astro/routes/api/taxonomies/index.d.mts +14 -0
- package/dist/astro/routes/api/taxonomies/index.mjs +104 -0
- package/dist/astro/routes/api/themes/preview.d.mts +7 -0
- package/dist/astro/routes/api/themes/preview.mjs +47 -0
- package/dist/astro/routes/api/typegen.d.mts +17 -0
- package/dist/astro/routes/api/typegen.mjs +75 -0
- package/dist/astro/routes/api/well-known/auth.d.mts +7 -0
- package/dist/astro/routes/api/well-known/auth.mjs +42 -0
- package/dist/astro/routes/api/well-known/oauth-authorization-server.d.mts +7 -0
- package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +33 -0
- package/dist/astro/routes/api/well-known/oauth-protected-resource.d.mts +7 -0
- package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +21 -0
- package/dist/astro/routes/api/widget-areas/_name_/reorder.d.mts +7 -0
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +89 -0
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.d.mts +8 -0
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +159 -0
- package/dist/astro/routes/api/widget-areas/_name_/widgets.d.mts +7 -0
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +105 -0
- package/dist/astro/routes/api/widget-areas/_name_.d.mts +8 -0
- package/dist/astro/routes/api/widget-areas/_name_.mjs +100 -0
- package/dist/astro/routes/api/widget-areas/index.d.mts +8 -0
- package/dist/astro/routes/api/widget-areas/index.mjs +109 -0
- package/dist/astro/routes/api/widget-components.d.mts +7 -0
- package/dist/astro/routes/api/widget-components.mjs +15 -0
- package/dist/astro/routes/robots.txt.d.mts +7 -0
- package/dist/astro/routes/robots.txt.mjs +60 -0
- package/dist/astro/routes/sitemap-_collection_.xml.d.mts +7 -0
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +70 -0
- package/dist/astro/routes/sitemap.xml.d.mts +7 -0
- package/dist/astro/routes/sitemap.xml.mjs +63 -0
- package/dist/astro/types.d.mts +42 -9
- package/dist/auth/providers/github-admin.d.mts +9 -0
- package/dist/auth/providers/github-admin.mjs +27 -0
- package/dist/auth/providers/github.d.mts +12 -0
- package/dist/auth/providers/github.mjs +17 -0
- package/dist/auth/providers/google-admin.d.mts +9 -0
- package/dist/auth/providers/google-admin.mjs +43 -0
- package/dist/auth/providers/google.d.mts +12 -0
- package/dist/auth/providers/google.mjs +17 -0
- package/dist/auth-control-guard-DOZ3UCsP.mjs +13 -0
- package/dist/authorize-BAdbMCwC.mjs +36 -0
- package/dist/briefing-MVYe_Uyf.mjs +1294 -0
- package/dist/briefing-rty4O-wa.mjs +29 -0
- package/dist/{byline-OhH2dlRu.mjs → byline-naZxOPSa.mjs} +3 -3
- package/dist/{bylines-BGpD9_hy.mjs → bylines-C4LIBOOO.mjs} +20 -53
- package/dist/bylines-eVVCuOe4.d.mts +2023 -0
- package/dist/{cache-BdSY-gQN.mjs → cache-DEbQ13c9.mjs} +21 -11
- package/dist/challenge-store-DDTbisbf.mjs +48 -0
- package/dist/cli/index.mjs +142 -22
- package/dist/client/external-auth-headers.d.mts +1 -1
- package/dist/client/index.d.mts +1 -1
- package/dist/client/index.mjs +3 -3
- package/dist/comment-DFO-gWDH.mjs +246 -0
- package/dist/comments--BsZ9pqA.mjs +186 -0
- package/dist/components-BPknylYg.mjs +107 -0
- package/dist/{content-DWi4d0rT.mjs → content-CyLkb-qH.mjs} +33 -44
- package/dist/context-CNIkMzot.mjs +849 -0
- package/dist/context-DNfcm853.mjs +184 -0
- package/dist/context-route-helpers-MurhoxWF.mjs +45 -0
- package/dist/context-types-C-LwdAxx.mjs +23 -0
- package/dist/cron-CKxvBrRT.mjs +263 -0
- package/dist/dashboard-DqnYU8EU.mjs +120 -0
- package/dist/db/index.d.mts +3 -3
- package/dist/db/libsql.d.mts +1 -1
- package/dist/db/libsql.mjs +3 -3
- package/dist/db/postgres.d.mts +1 -1
- package/dist/db/sqlite.d.mts +1 -1
- package/dist/db/sqlite.mjs +1 -2
- package/dist/device-flow-BGEH5jfn.mjs +487 -0
- package/dist/email-console-CuefUXfX.mjs +36 -0
- package/dist/entity-aliases-C0v-yNET.mjs +51 -0
- package/dist/error-BMUPwxgx.mjs +435 -0
- package/dist/escape-BRVaw1Ai.mjs +8 -0
- package/dist/experimental-workflows-C9X7yblQ.mjs +38 -0
- package/dist/fts-manager-B1pTNEG_.mjs +297 -0
- package/dist/hash-CDX7M0ze.mjs +32 -0
- package/dist/hitl-requests-ChT32Ilo.mjs +118 -0
- package/dist/hitl-route-helpers-CSit54Ru.mjs +96 -0
- package/dist/import-BHRLhXAn.mjs +1323 -0
- package/dist/import-CNcKWTbp.mjs +243 -0
- package/dist/index-CYfhYgXd.d.mts +227 -0
- package/dist/index-EUAWaIxW.d.mts +835 -0
- package/dist/index.d.mts +17 -11
- package/dist/index.mjs +63 -22
- package/dist/jsonld-D2gUY4kA.d.mts +141 -0
- package/dist/{loader-sMG4TZ-u.mjs → loader-PZnPxFLc.mjs} +42 -5
- package/dist/{manifest-schema-D1MSVnoI.mjs → manifest-schema-CgFJAp0H.mjs} +22 -10
- package/dist/media/index.d.mts +2 -1
- package/dist/media/index.mjs +2 -1
- package/dist/media/local-runtime.d.mts +12 -7
- package/dist/media/local-runtime.mjs +3 -3
- package/dist/{media-DMTr80Gv.mjs → media-_7Fxdu45.mjs} +1 -1
- package/dist/menus-DS3_5nWY.mjs +312 -0
- package/dist/menus-DYW_UHjv.mjs +256 -0
- package/dist/normalize-C49G_o1k.mjs +126 -0
- package/dist/oauth-authorization-DxGjiWKL.mjs +283 -0
- package/dist/oauth-clients-DxO_NO7k.mjs +298 -0
- package/dist/oauth-state-store-C5UFhzwD.mjs +48 -0
- package/dist/oauth-user-lookup-Bi0ek9eM.mjs +25 -0
- package/dist/options-z8VVg1Ll.mjs +114 -0
- package/dist/page/index.d.mts +2 -139
- package/dist/page/index.mjs +1 -427
- package/dist/parse-C9106ehs.mjs +88 -0
- package/dist/passkey-config-BRSZx4pW.mjs +42 -0
- package/dist/{patterns-CrCYkMBb.mjs → patterns-K0DLqWir.mjs} +53 -1
- package/dist/placeholder-Bh1dfUOd.d.mts +40 -0
- package/dist/{placeholder-Cp8g5Emj.mjs → placeholder-C2P5fKa4.mjs} +1 -126
- package/dist/plugins/adapt-sandbox-entry.d.mts +10 -5
- package/dist/plugins/adapt-sandbox-entry.mjs +4 -4
- package/dist/plugins-D7-ILNib.mjs +3249 -0
- package/dist/preview-DvYRU-Oy.mjs +788 -0
- package/dist/provider-loader-BiQ6lNmf.d.mts +20 -0
- package/dist/provider-loader-C21b9OpH.mjs +36 -0
- package/dist/public-url-Cun8N3NU.mjs +71 -0
- package/dist/{query-kDmwCsHh.mjs → query-B9BO5goQ.mjs} +93 -19
- package/dist/query-CsbOywSY.mjs +35 -0
- package/dist/rate-limit-DmVTHI5v.mjs +112 -0
- package/dist/{redirect-DnEWAkVg.mjs → redirect-CGl64yOX.mjs} +9 -5
- package/dist/redirect-COZy-3iY.mjs +16 -0
- package/dist/redirects-Cgi_cZfN.mjs +499 -0
- package/dist/redirects-lrlmYXVE.mjs +1023 -0
- package/dist/{registry-C0zjeB9P.mjs → registry-C-_hxLqa.mjs} +26 -294
- package/dist/request-meta-DixlNKKa.mjs +130 -0
- package/dist/review-requests-C2DIHwlJ.mjs +148 -0
- package/dist/review-requests-DIyjw-K_.mjs +79 -0
- package/dist/{runner-CFI6B6J2.d.mts → runner-BU6Lo1ZS.d.mts} +1 -1
- package/dist/{index-yvc6E_17.d.mts → runtime-Db4LbNVZ.d.mts} +1188 -2484
- package/dist/runtime.d.mts +11 -24
- package/dist/runtime.mjs +4 -38
- package/dist/schema-BECjUhP8.mjs +8 -0
- package/dist/search-DqTHQqtV.mjs +337 -0
- package/dist/secrets-CkoJ9zN0.mjs +160 -0
- package/dist/sections-B61OxnfB.mjs +338 -0
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +18 -13
- package/dist/seo/index.d.mts +1 -1
- package/dist/seo-C007Luwn.mjs +85 -0
- package/dist/seo-CUQctrog.mjs +129 -0
- package/dist/seo-contributions-B1fWCnqY.mjs +429 -0
- package/dist/service-CyOsm0R6.mjs +194 -0
- package/dist/settings-DGtLLSaz.mjs +237 -0
- package/dist/settings-Dzgswvg4.mjs +50 -0
- package/dist/setup-complete-ChilE-da.mjs +21 -0
- package/dist/setup-nonce-BpmLXAuu.mjs +17 -0
- package/dist/sidecar-client-B1C6Cf80.mjs +66 -0
- package/dist/site-activity-B8FjLIVh.mjs +104 -0
- package/dist/site-context-WBxoD99D.mjs +4122 -0
- package/dist/site-url-BP7k7OCe.mjs +12 -0
- package/dist/slugify-PDTDtMXp.mjs +30 -0
- package/dist/ssrf-DDwRxF6B.mjs +248 -0
- package/dist/storage/local.d.mts +1 -1
- package/dist/storage/local.mjs +1 -1
- package/dist/storage/s3.d.mts +1 -1
- package/dist/storage/s3.mjs +2 -2
- package/dist/{taxonomies-1s5PaS_8.mjs → taxonomies-D2aZGuns.mjs} +11 -7
- package/dist/taxonomies-z6Lz91BC.mjs +355 -0
- package/dist/taxonomy-D5cbhc8u.mjs +165 -0
- package/dist/{tokens-CJz9ubV6.mjs → tokens-BOJw-D9F.mjs} +1 -1
- package/dist/{transport-DB5eDN4x.mjs → transport-D3i4yWRE.mjs} +5 -4
- package/dist/trusted-proxy-BbaZfkT9.mjs +30 -0
- package/dist/types-0Vr68fc2.d.mts +344 -0
- package/dist/types-BFmjniC2.d.mts +165 -0
- package/dist/{types-BawVha09.mjs → types-Bs6lTBBW.mjs} +1 -1
- package/dist/{types-BuMDPy5C.d.mts → types-C0mmVRJN.d.mts} +6 -0
- package/dist/{placeholder--wOi4TbO.d.mts → types-OPs5Q_sX.d.mts} +1 -38
- package/dist/{types-Cj0KMIZV.d.mts → types-Q616b2Hn.d.mts} +54 -16
- package/dist/ui/client-runtime.d.mts +12 -0
- package/dist/ui/client-runtime.mjs +32 -0
- package/dist/ui/server-runtime.d.mts +33 -0
- package/dist/ui/server-runtime.mjs +80 -0
- package/dist/url-DNjT2abR.mjs +49 -0
- package/dist/user-CcXq-zoL.mjs +154 -0
- package/dist/utils-C0ONdBul.mjs +285 -0
- package/dist/{validate-IPf8n4Fj.d.mts → validate-BwmQEbu8.d.mts} +3 -3
- package/dist/{validate-BZ5wnLLp.mjs → validate-C7TzfamJ.mjs} +1 -1
- package/dist/version-D3vDb22n.mjs +6 -0
- package/dist/widgets-B7DRpZvy.mjs +104 -0
- package/dist/wordpress-slugs-CnporCYH.mjs +14 -0
- package/dist/zod-generator-DBVP8D0P.mjs +132 -0
- package/locals.d.ts +1 -6
- package/package.json +81 -11
- package/src/components/Button.astro +1 -1
- package/src/components/CommentForm.astro +1 -1
- package/src/components/Comments.astro +1 -3
- package/src/components/DinewayBodyEnd.astro +5 -3
- package/src/components/DinewayBodyStart.astro +5 -3
- package/src/components/DinewayHead.astro +15 -9
- package/src/components/DinewayImage.astro +12 -8
- package/src/components/DinewayMedia.astro +15 -6
- package/src/components/Embed.astro +1 -2
- package/src/components/File.astro +1 -1
- package/src/components/Gallery.astro +5 -3
- package/src/components/HtmlBlock.astro +1 -1
- package/src/components/Image.astro +9 -3
- package/src/components/InlinePortableTextEditor.tsx +69 -20
- package/src/components/PortableText.astro +1 -1
- package/src/components/WidgetArea.astro +1 -1
- package/src/components/WidgetRenderer.astro +1 -3
- package/src/components/marks/Link.astro +1 -1
- package/src/components/widgets/Archives.astro +1 -1
- package/src/components/widgets/Categories.astro +1 -1
- package/src/components/widgets/RecentPosts.astro +1 -1
- package/src/components/widgets/Tags.astro +1 -1
- package/dist/error-BmL6QipT.mjs +0 -30
- package/dist/search-DxopAWxs.mjs +0 -11200
- package/dist/version-BPz1imu2.mjs +0 -6
- package/src/astro/routes/PluginRegistry.tsx +0 -21
- package/src/astro/routes/api/admin/allowed-domains/[domain].ts +0 -112
- package/src/astro/routes/api/admin/allowed-domains/index.ts +0 -108
- package/src/astro/routes/api/admin/api-tokens/[id].ts +0 -44
- package/src/astro/routes/api/admin/api-tokens/index.ts +0 -90
- package/src/astro/routes/api/admin/briefing.ts +0 -76
- package/src/astro/routes/api/admin/bylines/[id]/index.ts +0 -90
- package/src/astro/routes/api/admin/bylines/index.ts +0 -74
- package/src/astro/routes/api/admin/comments/[id]/status.ts +0 -120
- package/src/astro/routes/api/admin/comments/[id].ts +0 -64
- package/src/astro/routes/api/admin/comments/bulk.ts +0 -42
- package/src/astro/routes/api/admin/comments/counts.ts +0 -30
- package/src/astro/routes/api/admin/comments/index.ts +0 -46
- package/src/astro/routes/api/admin/context/[id]/history.ts +0 -35
- package/src/astro/routes/api/admin/context/[id]/index.ts +0 -35
- package/src/astro/routes/api/admin/context/[id]/review.ts +0 -57
- package/src/astro/routes/api/admin/context/[id]/supersede.ts +0 -58
- package/src/astro/routes/api/admin/context/diff.ts +0 -35
- package/src/astro/routes/api/admin/context/index.ts +0 -69
- package/src/astro/routes/api/admin/context/stale.ts +0 -35
- package/src/astro/routes/api/admin/hitl-requests/[id]/index.ts +0 -38
- package/src/astro/routes/api/admin/hitl-requests/[id]/resolve.ts +0 -54
- package/src/astro/routes/api/admin/hitl-requests/index.ts +0 -38
- package/src/astro/routes/api/admin/hooks/exclusive/[hookName].ts +0 -132
- package/src/astro/routes/api/admin/hooks/exclusive/index.ts +0 -51
- package/src/astro/routes/api/admin/oauth-clients/[id].ts +0 -137
- package/src/astro/routes/api/admin/oauth-clients/index.ts +0 -95
- package/src/astro/routes/api/admin/plugins/[id]/disable.ts +0 -91
- package/src/astro/routes/api/admin/plugins/[id]/enable.ts +0 -91
- package/src/astro/routes/api/admin/plugins/[id]/index.ts +0 -38
- package/src/astro/routes/api/admin/plugins/[id]/uninstall.ts +0 -98
- package/src/astro/routes/api/admin/plugins/[id]/update.ts +0 -154
- package/src/astro/routes/api/admin/plugins/index.ts +0 -32
- package/src/astro/routes/api/admin/plugins/marketplace/[id]/icon.ts +0 -62
- package/src/astro/routes/api/admin/plugins/marketplace/[id]/index.ts +0 -33
- package/src/astro/routes/api/admin/plugins/marketplace/[id]/install.ts +0 -135
- package/src/astro/routes/api/admin/plugins/marketplace/index.ts +0 -38
- package/src/astro/routes/api/admin/plugins/updates.ts +0 -28
- package/src/astro/routes/api/admin/review-requests/[id]/index.ts +0 -35
- package/src/astro/routes/api/admin/review-requests/[id]/resolve.ts +0 -52
- package/src/astro/routes/api/admin/review-requests/index.ts +0 -35
- package/src/astro/routes/api/admin/themes/marketplace/[id]/index.ts +0 -33
- package/src/astro/routes/api/admin/themes/marketplace/[id]/thumbnail.ts +0 -62
- package/src/astro/routes/api/admin/themes/marketplace/index.ts +0 -45
- package/src/astro/routes/api/admin/users/[id]/disable.ts +0 -72
- package/src/astro/routes/api/admin/users/[id]/enable.ts +0 -48
- package/src/astro/routes/api/admin/users/[id]/index.ts +0 -166
- package/src/astro/routes/api/admin/users/[id]/send-recovery.ts +0 -72
- package/src/astro/routes/api/admin/users/index.ts +0 -66
- package/src/astro/routes/api/auth/dev-bypass.ts +0 -139
- package/src/astro/routes/api/auth/invite/accept.ts +0 -52
- package/src/astro/routes/api/auth/invite/complete.ts +0 -86
- package/src/astro/routes/api/auth/invite/index.ts +0 -99
- package/src/astro/routes/api/auth/invite/register-options.ts +0 -73
- package/src/astro/routes/api/auth/logout.ts +0 -40
- package/src/astro/routes/api/auth/magic-link/send.ts +0 -90
- package/src/astro/routes/api/auth/magic-link/verify.ts +0 -71
- package/src/astro/routes/api/auth/me.ts +0 -60
- package/src/astro/routes/api/auth/oauth/[provider]/callback.ts +0 -221
- package/src/astro/routes/api/auth/oauth/[provider].ts +0 -120
- package/src/astro/routes/api/auth/passkey/[id].ts +0 -124
- package/src/astro/routes/api/auth/passkey/index.ts +0 -54
- package/src/astro/routes/api/auth/passkey/options.ts +0 -85
- package/src/astro/routes/api/auth/passkey/register/options.ts +0 -88
- package/src/astro/routes/api/auth/passkey/register/verify.ts +0 -119
- package/src/astro/routes/api/auth/passkey/verify.ts +0 -72
- package/src/astro/routes/api/auth/signup/complete.ts +0 -87
- package/src/astro/routes/api/auth/signup/request.ts +0 -89
- package/src/astro/routes/api/auth/signup/verify.ts +0 -53
- package/src/astro/routes/api/comments/[collection]/[contentId]/index.ts +0 -310
- package/src/astro/routes/api/content/[collection]/[id]/compare.ts +0 -28
- package/src/astro/routes/api/content/[collection]/[id]/discard-draft.ts +0 -68
- package/src/astro/routes/api/content/[collection]/[id]/duplicate.ts +0 -77
- package/src/astro/routes/api/content/[collection]/[id]/permanent.ts +0 -42
- package/src/astro/routes/api/content/[collection]/[id]/preview-url.ts +0 -107
- package/src/astro/routes/api/content/[collection]/[id]/publish.ts +0 -100
- package/src/astro/routes/api/content/[collection]/[id]/restore.ts +0 -64
- package/src/astro/routes/api/content/[collection]/[id]/revisions.ts +0 -31
- package/src/astro/routes/api/content/[collection]/[id]/schedule.ts +0 -129
- package/src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts +0 -143
- package/src/astro/routes/api/content/[collection]/[id]/translations.ts +0 -50
- package/src/astro/routes/api/content/[collection]/[id]/unpublish.ts +0 -69
- package/src/astro/routes/api/content/[collection]/[id].ts +0 -173
- package/src/astro/routes/api/content/[collection]/index.ts +0 -103
- package/src/astro/routes/api/content/[collection]/trash.ts +0 -33
- package/src/astro/routes/api/dashboard.ts +0 -32
- package/src/astro/routes/api/dev/emails.ts +0 -36
- package/src/astro/routes/api/health.ts +0 -54
- package/src/astro/routes/api/import/probe.ts +0 -47
- package/src/astro/routes/api/import/wordpress/analyze.ts +0 -523
- package/src/astro/routes/api/import/wordpress/execute.ts +0 -330
- package/src/astro/routes/api/import/wordpress/media.ts +0 -338
- package/src/astro/routes/api/import/wordpress/prepare.ts +0 -212
- package/src/astro/routes/api/import/wordpress/rewrite-urls.ts +0 -425
- package/src/astro/routes/api/import/wordpress-plugin/analyze.ts +0 -111
- package/src/astro/routes/api/import/wordpress-plugin/callback.ts +0 -58
- package/src/astro/routes/api/import/wordpress-plugin/execute.ts +0 -399
- package/src/astro/routes/api/manifest.ts +0 -75
- package/src/astro/routes/api/mcp.ts +0 -125
- package/src/astro/routes/api/media/[id]/confirm.ts +0 -93
- package/src/astro/routes/api/media/[id].ts +0 -145
- package/src/astro/routes/api/media/file/[...key].ts +0 -79
- package/src/astro/routes/api/media/providers/[providerId]/[itemId].ts +0 -91
- package/src/astro/routes/api/media/providers/[providerId]/index.ts +0 -111
- package/src/astro/routes/api/media/providers/index.ts +0 -30
- package/src/astro/routes/api/media/upload-url.ts +0 -146
- package/src/astro/routes/api/media.ts +0 -204
- package/src/astro/routes/api/menus/[name]/items.ts +0 -206
- package/src/astro/routes/api/menus/[name]/reorder.ts +0 -79
- package/src/astro/routes/api/menus/[name].ts +0 -145
- package/src/astro/routes/api/menus/index.ts +0 -91
- package/src/astro/routes/api/oauth/authorize.ts +0 -430
- package/src/astro/routes/api/oauth/device/authorize.ts +0 -45
- package/src/astro/routes/api/oauth/device/code.ts +0 -56
- package/src/astro/routes/api/oauth/device/token.ts +0 -70
- package/src/astro/routes/api/oauth/register.ts +0 -182
- package/src/astro/routes/api/oauth/token/refresh.ts +0 -38
- package/src/astro/routes/api/oauth/token/revoke.ts +0 -38
- package/src/astro/routes/api/oauth/token.ts +0 -195
- package/src/astro/routes/api/openapi.json.ts +0 -33
- package/src/astro/routes/api/plugins/[pluginId]/[...path].ts +0 -109
- package/src/astro/routes/api/redirects/404s/index.ts +0 -72
- package/src/astro/routes/api/redirects/404s/summary.ts +0 -33
- package/src/astro/routes/api/redirects/[id].ts +0 -183
- package/src/astro/routes/api/redirects/index.ts +0 -100
- package/src/astro/routes/api/revisions/[revisionId]/index.ts +0 -29
- package/src/astro/routes/api/revisions/[revisionId]/restore.ts +0 -62
- package/src/astro/routes/api/schema/collections/[slug]/fields/[fieldSlug].ts +0 -104
- package/src/astro/routes/api/schema/collections/[slug]/fields/index.ts +0 -67
- package/src/astro/routes/api/schema/collections/[slug]/fields/reorder.ts +0 -45
- package/src/astro/routes/api/schema/collections/[slug]/index.ts +0 -107
- package/src/astro/routes/api/schema/collections/index.ts +0 -61
- package/src/astro/routes/api/schema/index.ts +0 -109
- package/src/astro/routes/api/schema/orphans/[slug].ts +0 -36
- package/src/astro/routes/api/schema/orphans/index.ts +0 -26
- package/src/astro/routes/api/search/enable.ts +0 -64
- package/src/astro/routes/api/search/index.ts +0 -52
- package/src/astro/routes/api/search/rebuild.ts +0 -72
- package/src/astro/routes/api/search/stats.ts +0 -35
- package/src/astro/routes/api/search/suggest.ts +0 -50
- package/src/astro/routes/api/sections/[slug].ts +0 -203
- package/src/astro/routes/api/sections/index.ts +0 -107
- package/src/astro/routes/api/settings/email.ts +0 -150
- package/src/astro/routes/api/settings.ts +0 -116
- package/src/astro/routes/api/setup/admin-verify.ts +0 -122
- package/src/astro/routes/api/setup/admin.ts +0 -104
- package/src/astro/routes/api/setup/dev-bypass.ts +0 -200
- package/src/astro/routes/api/setup/dev-reset.ts +0 -40
- package/src/astro/routes/api/setup/index.ts +0 -128
- package/src/astro/routes/api/setup/status.ts +0 -122
- package/src/astro/routes/api/snapshot.ts +0 -76
- package/src/astro/routes/api/taxonomies/[name]/terms/[slug].ts +0 -232
- package/src/astro/routes/api/taxonomies/[name]/terms/index.ts +0 -131
- package/src/astro/routes/api/taxonomies/index.ts +0 -114
- package/src/astro/routes/api/themes/preview.ts +0 -78
- package/src/astro/routes/api/typegen.ts +0 -114
- package/src/astro/routes/api/well-known/auth.ts +0 -71
- package/src/astro/routes/api/well-known/oauth-authorization-server.ts +0 -48
- package/src/astro/routes/api/well-known/oauth-protected-resource.ts +0 -39
- package/src/astro/routes/api/widget-areas/[name]/reorder.ts +0 -114
- package/src/astro/routes/api/widget-areas/[name]/widgets/[id].ts +0 -213
- package/src/astro/routes/api/widget-areas/[name]/widgets.ts +0 -126
- package/src/astro/routes/api/widget-areas/[name].ts +0 -135
- package/src/astro/routes/api/widget-areas/index.ts +0 -149
- package/src/astro/routes/api/widget-components.ts +0 -22
- package/src/astro/routes/robots.txt.ts +0 -81
- package/src/astro/routes/sitemap-[collection].xml.ts +0 -104
- package/src/astro/routes/sitemap.xml.ts +0 -92
- /package/dist/{adapters-C2ypTrZZ.d.mts → adapters-DuLQZhRY.d.mts} +0 -0
- /package/{src → dist}/astro/routes/admin.astro +0 -0
- /package/dist/{base64-F8-DUraK.mjs → base64-Cz-aU0X1.mjs} +0 -0
- /package/dist/{chunks--4F8ddV4.mjs → chunks-D_jVet6z.mjs} +0 -0
- /package/dist/{config-BXwuX8Bx.mjs → config-CAMFxGaV.mjs} +0 -0
- /package/dist/{db-errors-CEqD7qH9.mjs → db-errors-DyZkswzF.mjs} +0 -0
- /package/dist/{default-VjJyuuG9.mjs → default-D4ngTpW8.mjs} +0 -0
- /package/dist/{load-Coc9HpHH.mjs → load-B2XtDw__.mjs} +0 -0
- /package/dist/{mode-47goXBBK.mjs → mode-DUhxwUhv.mjs} +0 -0
- /package/dist/{request-cache-Dk5qPSOx.mjs → request-cache-DHMRr2Lf.mjs} +0 -0
- /package/dist/{transaction-Cn2rjY78.mjs → transaction-x2tJQ-A1.mjs} +0 -0
- /package/dist/{transport-Wge_IzKl.d.mts → transport-BXe1AM79.d.mts} +0 -0
- /package/dist/{types-CWbdtiux.d.mts → types-B7kpsMJ3.d.mts} +0 -0
- /package/dist/{types-BzcUjoqg.d.mts → types-DJlpx5Ay.d.mts} +0 -0
- /package/dist/{types-COeOq9nK.mjs → types-DL7Y8D_t.mjs} +0 -0
- /package/dist/{types-DOrVigru.d.mts → types-DZPw8Rru.d.mts} +0 -0
- /package/dist/{types-griIBQOQ.mjs → types-fAInWQDO.mjs} +0 -0
|
@@ -0,0 +1,1323 @@
|
|
|
1
|
+
import { n as slugify } from "./slugify-PDTDtMXp.mjs";
|
|
2
|
+
import { a as validateExternalUrl, n as resolveAndValidateExternalUrl, r as ssrfSafeFetch } from "./ssrf-DDwRxF6B.mjs";
|
|
3
|
+
import { a as getFilenameFromUrl, c as isInternalMetaKey, d as mapPostTypeToCollection, f as mapWpStatus, i as checkSchemaCompatibility, l as isInternalPostType, n as FEATURED_IMAGE_FIELD, o as guessMimeType, p as normalizeUrl$1, r as buildAttachmentMap, s as inferMetaType, t as BASE_REQUIRED_FIELDS, u as mapMetaKeyToField } from "./utils-C0ONdBul.mjs";
|
|
4
|
+
import { ulid } from "ulidx";
|
|
5
|
+
import sax from "sax";
|
|
6
|
+
import { gutenbergToPortableText } from "@dineway-ai/gutenberg-to-portable-text";
|
|
7
|
+
|
|
8
|
+
//#region src/cli/wxr/parser.ts
|
|
9
|
+
const PHP_SERIALIZED_STRING_PATTERN = /s:\d+:"([^"]+)"/g;
|
|
10
|
+
const PHP_SERIALIZED_STRING_MATCH_PATTERN = /s:\d+:"([^"]+)"/;
|
|
11
|
+
/** Extract string value from a SAX attribute (handles both Tag and QualifiedTag) */
|
|
12
|
+
function attrStr(attr) {
|
|
13
|
+
if (typeof attr === "string") return attr;
|
|
14
|
+
if (attr && typeof attr === "object" && "value" in attr) return attr.value;
|
|
15
|
+
return "";
|
|
16
|
+
}
|
|
17
|
+
/** Type guard for complete WxrTerm (all required fields present) */
|
|
18
|
+
function isCompleteWxrTerm(term) {
|
|
19
|
+
return term.id !== void 0 && term.taxonomy !== void 0 && term.slug !== void 0 && term.name !== void 0;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Parse a WordPress WXR export file
|
|
23
|
+
*/
|
|
24
|
+
function parseWxr(stream) {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
const parser = sax.createStream(true, { trim: true });
|
|
27
|
+
const data = {
|
|
28
|
+
site: {},
|
|
29
|
+
posts: [],
|
|
30
|
+
attachments: [],
|
|
31
|
+
categories: [],
|
|
32
|
+
tags: [],
|
|
33
|
+
authors: [],
|
|
34
|
+
terms: [],
|
|
35
|
+
navMenus: []
|
|
36
|
+
};
|
|
37
|
+
let currentPath = [];
|
|
38
|
+
let currentText = "";
|
|
39
|
+
let currentItem = null;
|
|
40
|
+
let currentAttachment = null;
|
|
41
|
+
let currentCategory = null;
|
|
42
|
+
let currentTag = null;
|
|
43
|
+
let currentAuthor = null;
|
|
44
|
+
let currentTerm = null;
|
|
45
|
+
let currentMetaKey = "";
|
|
46
|
+
const navMenuItemPosts = [];
|
|
47
|
+
const menuTermsBySlug = /* @__PURE__ */ new Map();
|
|
48
|
+
parser.on("opentag", (node) => {
|
|
49
|
+
const tagName = node.name.toLowerCase();
|
|
50
|
+
currentPath.push(tagName);
|
|
51
|
+
currentText = "";
|
|
52
|
+
if (tagName === "item") currentItem = {
|
|
53
|
+
categories: [],
|
|
54
|
+
tags: [],
|
|
55
|
+
customTaxonomies: /* @__PURE__ */ new Map(),
|
|
56
|
+
meta: /* @__PURE__ */ new Map()
|
|
57
|
+
};
|
|
58
|
+
else if (tagName === "wp:category") currentCategory = {};
|
|
59
|
+
else if (tagName === "wp:tag") currentTag = {};
|
|
60
|
+
else if (tagName === "wp:author") currentAuthor = {};
|
|
61
|
+
else if (tagName === "wp:term") currentTerm = {};
|
|
62
|
+
if (tagName === "category" && currentItem && node.attributes) {
|
|
63
|
+
const domain = attrStr(node.attributes.domain);
|
|
64
|
+
const nicename = attrStr(node.attributes.nicename);
|
|
65
|
+
if (domain === "category" && nicename) currentItem.categories.push(nicename);
|
|
66
|
+
else if (domain === "post_tag" && nicename) currentItem.tags.push(nicename);
|
|
67
|
+
else if (domain && nicename && domain !== "category" && domain !== "post_tag") {
|
|
68
|
+
if (!currentItem.customTaxonomies) currentItem.customTaxonomies = /* @__PURE__ */ new Map();
|
|
69
|
+
const existing = currentItem.customTaxonomies.get(domain) || [];
|
|
70
|
+
existing.push(nicename);
|
|
71
|
+
currentItem.customTaxonomies.set(domain, existing);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
parser.on("text", (text) => {
|
|
76
|
+
currentText += text;
|
|
77
|
+
});
|
|
78
|
+
parser.on("cdata", (cdata) => {
|
|
79
|
+
currentText += cdata;
|
|
80
|
+
});
|
|
81
|
+
parser.on("closetag", (tagName) => {
|
|
82
|
+
const tag = tagName.toLowerCase();
|
|
83
|
+
const text = currentText.trim();
|
|
84
|
+
if (currentPath.includes("channel") && !currentItem) switch (tag) {
|
|
85
|
+
case "title":
|
|
86
|
+
if (!data.site.title) data.site.title = text;
|
|
87
|
+
break;
|
|
88
|
+
case "link":
|
|
89
|
+
if (!data.site.link) data.site.link = text;
|
|
90
|
+
break;
|
|
91
|
+
case "description":
|
|
92
|
+
if (!data.site.description) data.site.description = text;
|
|
93
|
+
break;
|
|
94
|
+
case "language":
|
|
95
|
+
data.site.language = text;
|
|
96
|
+
break;
|
|
97
|
+
case "wp:base_site_url":
|
|
98
|
+
data.site.baseSiteUrl = text;
|
|
99
|
+
break;
|
|
100
|
+
case "wp:base_blog_url":
|
|
101
|
+
data.site.baseBlogUrl = text;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
if (currentItem) switch (tag) {
|
|
105
|
+
case "title":
|
|
106
|
+
currentItem.title = text;
|
|
107
|
+
break;
|
|
108
|
+
case "link":
|
|
109
|
+
currentItem.link = text;
|
|
110
|
+
break;
|
|
111
|
+
case "pubdate":
|
|
112
|
+
currentItem.pubDate = text;
|
|
113
|
+
break;
|
|
114
|
+
case "dc:creator":
|
|
115
|
+
currentItem.creator = text;
|
|
116
|
+
break;
|
|
117
|
+
case "guid":
|
|
118
|
+
currentItem.guid = text;
|
|
119
|
+
break;
|
|
120
|
+
case "description":
|
|
121
|
+
currentItem.description = text;
|
|
122
|
+
break;
|
|
123
|
+
case "content:encoded":
|
|
124
|
+
currentItem.content = text;
|
|
125
|
+
break;
|
|
126
|
+
case "excerpt:encoded":
|
|
127
|
+
currentItem.excerpt = text;
|
|
128
|
+
break;
|
|
129
|
+
case "wp:post_id":
|
|
130
|
+
currentItem.id = parseInt(text, 10);
|
|
131
|
+
break;
|
|
132
|
+
case "wp:post_date":
|
|
133
|
+
currentItem.postDate = text;
|
|
134
|
+
break;
|
|
135
|
+
case "wp:post_date_gmt":
|
|
136
|
+
currentItem.postDateGmt = text;
|
|
137
|
+
break;
|
|
138
|
+
case "wp:post_modified":
|
|
139
|
+
currentItem.postModified = text;
|
|
140
|
+
break;
|
|
141
|
+
case "wp:post_modified_gmt":
|
|
142
|
+
currentItem.postModifiedGmt = text;
|
|
143
|
+
break;
|
|
144
|
+
case "wp:comment_status":
|
|
145
|
+
currentItem.commentStatus = text;
|
|
146
|
+
break;
|
|
147
|
+
case "wp:ping_status":
|
|
148
|
+
currentItem.pingStatus = text;
|
|
149
|
+
break;
|
|
150
|
+
case "wp:status":
|
|
151
|
+
currentItem.status = text;
|
|
152
|
+
break;
|
|
153
|
+
case "wp:post_type":
|
|
154
|
+
currentItem.postType = text;
|
|
155
|
+
break;
|
|
156
|
+
case "wp:post_name":
|
|
157
|
+
currentItem.postName = text;
|
|
158
|
+
break;
|
|
159
|
+
case "wp:post_parent":
|
|
160
|
+
currentItem.postParent = parseInt(text, 10);
|
|
161
|
+
break;
|
|
162
|
+
case "wp:menu_order":
|
|
163
|
+
currentItem.menuOrder = parseInt(text, 10);
|
|
164
|
+
break;
|
|
165
|
+
case "wp:post_password":
|
|
166
|
+
currentItem.postPassword = text || void 0;
|
|
167
|
+
break;
|
|
168
|
+
case "wp:is_sticky":
|
|
169
|
+
currentItem.isSticky = text === "1";
|
|
170
|
+
break;
|
|
171
|
+
case "wp:meta_key":
|
|
172
|
+
currentMetaKey = text;
|
|
173
|
+
break;
|
|
174
|
+
case "wp:meta_value":
|
|
175
|
+
if (currentMetaKey) {
|
|
176
|
+
currentItem.meta.set(currentMetaKey, text);
|
|
177
|
+
currentMetaKey = "";
|
|
178
|
+
}
|
|
179
|
+
break;
|
|
180
|
+
case "wp:attachment_url":
|
|
181
|
+
if (currentItem.postType === "attachment") currentAttachment = {
|
|
182
|
+
id: currentItem.id,
|
|
183
|
+
title: currentItem.title,
|
|
184
|
+
url: text,
|
|
185
|
+
postDate: currentItem.postDate,
|
|
186
|
+
meta: currentItem.meta
|
|
187
|
+
};
|
|
188
|
+
break;
|
|
189
|
+
case "item":
|
|
190
|
+
if (currentAttachment) {
|
|
191
|
+
data.attachments.push(currentAttachment);
|
|
192
|
+
currentAttachment = null;
|
|
193
|
+
} else if (currentItem.postType === "nav_menu_item") {
|
|
194
|
+
navMenuItemPosts.push(currentItem);
|
|
195
|
+
data.posts.push(currentItem);
|
|
196
|
+
} else if (currentItem.postType !== "attachment") data.posts.push(currentItem);
|
|
197
|
+
currentItem = null;
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
if (currentCategory) switch (tag) {
|
|
201
|
+
case "wp:term_id":
|
|
202
|
+
currentCategory.id = parseInt(text, 10);
|
|
203
|
+
break;
|
|
204
|
+
case "wp:category_nicename":
|
|
205
|
+
currentCategory.nicename = text;
|
|
206
|
+
break;
|
|
207
|
+
case "wp:cat_name":
|
|
208
|
+
currentCategory.name = text;
|
|
209
|
+
break;
|
|
210
|
+
case "wp:category_parent":
|
|
211
|
+
currentCategory.parent = text || void 0;
|
|
212
|
+
break;
|
|
213
|
+
case "wp:category_description":
|
|
214
|
+
currentCategory.description = text || void 0;
|
|
215
|
+
break;
|
|
216
|
+
case "wp:category":
|
|
217
|
+
if (currentCategory.name) data.categories.push(currentCategory);
|
|
218
|
+
currentCategory = null;
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
if (currentTag) switch (tag) {
|
|
222
|
+
case "wp:term_id":
|
|
223
|
+
currentTag.id = parseInt(text, 10);
|
|
224
|
+
break;
|
|
225
|
+
case "wp:tag_slug":
|
|
226
|
+
currentTag.slug = text;
|
|
227
|
+
break;
|
|
228
|
+
case "wp:tag_name":
|
|
229
|
+
currentTag.name = text;
|
|
230
|
+
break;
|
|
231
|
+
case "wp:tag_description":
|
|
232
|
+
currentTag.description = text || void 0;
|
|
233
|
+
break;
|
|
234
|
+
case "wp:tag":
|
|
235
|
+
if (currentTag.name) data.tags.push(currentTag);
|
|
236
|
+
currentTag = null;
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
if (currentAuthor) switch (tag) {
|
|
240
|
+
case "wp:author_id":
|
|
241
|
+
currentAuthor.id = parseInt(text, 10);
|
|
242
|
+
break;
|
|
243
|
+
case "wp:author_login":
|
|
244
|
+
currentAuthor.login = text;
|
|
245
|
+
break;
|
|
246
|
+
case "wp:author_email":
|
|
247
|
+
currentAuthor.email = text;
|
|
248
|
+
break;
|
|
249
|
+
case "wp:author_display_name":
|
|
250
|
+
currentAuthor.displayName = text;
|
|
251
|
+
break;
|
|
252
|
+
case "wp:author_first_name":
|
|
253
|
+
currentAuthor.firstName = text;
|
|
254
|
+
break;
|
|
255
|
+
case "wp:author_last_name":
|
|
256
|
+
currentAuthor.lastName = text;
|
|
257
|
+
break;
|
|
258
|
+
case "wp:author":
|
|
259
|
+
if (currentAuthor.login) data.authors.push(currentAuthor);
|
|
260
|
+
currentAuthor = null;
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
if (currentTerm) switch (tag) {
|
|
264
|
+
case "wp:term_id":
|
|
265
|
+
currentTerm.id = parseInt(text, 10);
|
|
266
|
+
break;
|
|
267
|
+
case "wp:term_taxonomy":
|
|
268
|
+
currentTerm.taxonomy = text;
|
|
269
|
+
break;
|
|
270
|
+
case "wp:term_slug":
|
|
271
|
+
currentTerm.slug = text;
|
|
272
|
+
break;
|
|
273
|
+
case "wp:term_name":
|
|
274
|
+
currentTerm.name = text;
|
|
275
|
+
break;
|
|
276
|
+
case "wp:term_parent":
|
|
277
|
+
currentTerm.parent = text || void 0;
|
|
278
|
+
break;
|
|
279
|
+
case "wp:term_description":
|
|
280
|
+
currentTerm.description = text || void 0;
|
|
281
|
+
break;
|
|
282
|
+
case "wp:term":
|
|
283
|
+
if (isCompleteWxrTerm(currentTerm)) {
|
|
284
|
+
data.terms.push(currentTerm);
|
|
285
|
+
if (currentTerm.taxonomy === "nav_menu") menuTermsBySlug.set(currentTerm.slug, currentTerm.id);
|
|
286
|
+
}
|
|
287
|
+
currentTerm = null;
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
currentPath.pop();
|
|
291
|
+
currentText = "";
|
|
292
|
+
});
|
|
293
|
+
parser.on("error", (err) => {
|
|
294
|
+
reject(/* @__PURE__ */ new Error(`XML parsing error: ${err.message}`));
|
|
295
|
+
});
|
|
296
|
+
parser.on("end", () => {
|
|
297
|
+
data.navMenus = buildNavMenus(navMenuItemPosts, menuTermsBySlug);
|
|
298
|
+
resolve(data);
|
|
299
|
+
});
|
|
300
|
+
stream.pipe(parser);
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Parse a WordPress WXR export from a string
|
|
305
|
+
*
|
|
306
|
+
* Uses the non-streaming SAX parser API for compatibility with
|
|
307
|
+
* environments that don't expose Node.js streams.
|
|
308
|
+
*/
|
|
309
|
+
function parseWxrString(xml) {
|
|
310
|
+
return new Promise((resolve, reject) => {
|
|
311
|
+
const parser = sax.parser(true, {
|
|
312
|
+
trim: false,
|
|
313
|
+
normalize: false
|
|
314
|
+
});
|
|
315
|
+
const data = {
|
|
316
|
+
site: {},
|
|
317
|
+
posts: [],
|
|
318
|
+
attachments: [],
|
|
319
|
+
categories: [],
|
|
320
|
+
tags: [],
|
|
321
|
+
authors: [],
|
|
322
|
+
terms: [],
|
|
323
|
+
navMenus: []
|
|
324
|
+
};
|
|
325
|
+
let currentPath = [];
|
|
326
|
+
let currentText = "";
|
|
327
|
+
let currentItem = null;
|
|
328
|
+
let currentAttachment = null;
|
|
329
|
+
let currentCategory = null;
|
|
330
|
+
let currentTag = null;
|
|
331
|
+
let currentAuthor = null;
|
|
332
|
+
let currentTerm = null;
|
|
333
|
+
let currentMetaKey = "";
|
|
334
|
+
const navMenuItemPosts = [];
|
|
335
|
+
const menuTermsBySlug = /* @__PURE__ */ new Map();
|
|
336
|
+
parser.onopentag = (node) => {
|
|
337
|
+
const tag = node.name.toLowerCase();
|
|
338
|
+
currentPath.push(tag);
|
|
339
|
+
currentText = "";
|
|
340
|
+
if (tag === "item") currentItem = {
|
|
341
|
+
categories: [],
|
|
342
|
+
tags: [],
|
|
343
|
+
customTaxonomies: /* @__PURE__ */ new Map(),
|
|
344
|
+
meta: /* @__PURE__ */ new Map()
|
|
345
|
+
};
|
|
346
|
+
else if (tag === "wp:category") currentCategory = {};
|
|
347
|
+
else if (tag === "wp:tag") currentTag = {};
|
|
348
|
+
else if (tag === "wp:author") currentAuthor = {};
|
|
349
|
+
else if (tag === "wp:term") currentTerm = {};
|
|
350
|
+
if (tag === "category" && currentItem && node.attributes) {
|
|
351
|
+
const domain = attrStr(node.attributes.domain);
|
|
352
|
+
const nicename = attrStr(node.attributes.nicename);
|
|
353
|
+
if (domain === "category" && nicename) currentItem.categories.push(nicename);
|
|
354
|
+
else if (domain === "post_tag" && nicename) currentItem.tags.push(nicename);
|
|
355
|
+
else if (domain && nicename && domain !== "category" && domain !== "post_tag") {
|
|
356
|
+
if (!currentItem.customTaxonomies) currentItem.customTaxonomies = /* @__PURE__ */ new Map();
|
|
357
|
+
const existing = currentItem.customTaxonomies.get(domain) || [];
|
|
358
|
+
existing.push(nicename);
|
|
359
|
+
currentItem.customTaxonomies.set(domain, existing);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
parser.ontext = (text) => {
|
|
364
|
+
currentText += text;
|
|
365
|
+
};
|
|
366
|
+
parser.oncdata = (cdata) => {
|
|
367
|
+
currentText += cdata;
|
|
368
|
+
};
|
|
369
|
+
parser.onclosetag = (tagName) => {
|
|
370
|
+
const tag = tagName.toLowerCase();
|
|
371
|
+
const text = currentText.trim();
|
|
372
|
+
if (currentPath.length === 2 && currentPath[0] === "rss") switch (tag) {
|
|
373
|
+
case "title":
|
|
374
|
+
data.site.title = text;
|
|
375
|
+
break;
|
|
376
|
+
case "link":
|
|
377
|
+
data.site.link = text;
|
|
378
|
+
break;
|
|
379
|
+
case "description":
|
|
380
|
+
data.site.description = text;
|
|
381
|
+
break;
|
|
382
|
+
case "language":
|
|
383
|
+
data.site.language = text;
|
|
384
|
+
break;
|
|
385
|
+
case "wp:base_site_url":
|
|
386
|
+
data.site.baseSiteUrl = text;
|
|
387
|
+
break;
|
|
388
|
+
case "wp:base_blog_url":
|
|
389
|
+
data.site.baseBlogUrl = text;
|
|
390
|
+
break;
|
|
391
|
+
}
|
|
392
|
+
if (currentItem) switch (tag) {
|
|
393
|
+
case "title":
|
|
394
|
+
currentItem.title = text;
|
|
395
|
+
break;
|
|
396
|
+
case "link":
|
|
397
|
+
currentItem.link = text;
|
|
398
|
+
break;
|
|
399
|
+
case "pubdate":
|
|
400
|
+
currentItem.pubDate = text;
|
|
401
|
+
break;
|
|
402
|
+
case "dc:creator":
|
|
403
|
+
currentItem.creator = text;
|
|
404
|
+
break;
|
|
405
|
+
case "guid":
|
|
406
|
+
currentItem.guid = text;
|
|
407
|
+
break;
|
|
408
|
+
case "description":
|
|
409
|
+
currentItem.description = text;
|
|
410
|
+
break;
|
|
411
|
+
case "content:encoded":
|
|
412
|
+
currentItem.content = text;
|
|
413
|
+
break;
|
|
414
|
+
case "excerpt:encoded":
|
|
415
|
+
currentItem.excerpt = text;
|
|
416
|
+
break;
|
|
417
|
+
case "wp:post_id":
|
|
418
|
+
currentItem.id = parseInt(text, 10);
|
|
419
|
+
break;
|
|
420
|
+
case "wp:post_date":
|
|
421
|
+
currentItem.postDate = text;
|
|
422
|
+
break;
|
|
423
|
+
case "wp:post_date_gmt":
|
|
424
|
+
currentItem.postDateGmt = text;
|
|
425
|
+
break;
|
|
426
|
+
case "wp:post_modified":
|
|
427
|
+
currentItem.postModified = text;
|
|
428
|
+
break;
|
|
429
|
+
case "wp:post_modified_gmt":
|
|
430
|
+
currentItem.postModifiedGmt = text;
|
|
431
|
+
break;
|
|
432
|
+
case "wp:comment_status":
|
|
433
|
+
currentItem.commentStatus = text;
|
|
434
|
+
break;
|
|
435
|
+
case "wp:ping_status":
|
|
436
|
+
currentItem.pingStatus = text;
|
|
437
|
+
break;
|
|
438
|
+
case "wp:post_name":
|
|
439
|
+
currentItem.postName = text;
|
|
440
|
+
break;
|
|
441
|
+
case "wp:status":
|
|
442
|
+
currentItem.status = text;
|
|
443
|
+
break;
|
|
444
|
+
case "wp:post_parent":
|
|
445
|
+
currentItem.postParent = parseInt(text, 10);
|
|
446
|
+
break;
|
|
447
|
+
case "wp:menu_order":
|
|
448
|
+
currentItem.menuOrder = parseInt(text, 10);
|
|
449
|
+
break;
|
|
450
|
+
case "wp:post_type":
|
|
451
|
+
currentItem.postType = text;
|
|
452
|
+
if (text === "attachment") currentAttachment = {
|
|
453
|
+
id: currentItem.id,
|
|
454
|
+
title: currentItem.title,
|
|
455
|
+
url: currentItem.link,
|
|
456
|
+
postDate: currentItem.postDate,
|
|
457
|
+
meta: /* @__PURE__ */ new Map()
|
|
458
|
+
};
|
|
459
|
+
break;
|
|
460
|
+
case "wp:post_password":
|
|
461
|
+
currentItem.postPassword = text || void 0;
|
|
462
|
+
break;
|
|
463
|
+
case "wp:is_sticky":
|
|
464
|
+
currentItem.isSticky = text === "1";
|
|
465
|
+
break;
|
|
466
|
+
case "wp:attachment_url":
|
|
467
|
+
if (currentAttachment) currentAttachment.url = text;
|
|
468
|
+
break;
|
|
469
|
+
case "wp:meta_key":
|
|
470
|
+
currentMetaKey = text;
|
|
471
|
+
break;
|
|
472
|
+
case "wp:meta_value":
|
|
473
|
+
if (currentMetaKey && currentItem.meta) currentItem.meta.set(currentMetaKey, text);
|
|
474
|
+
break;
|
|
475
|
+
case "item":
|
|
476
|
+
if (currentAttachment) {
|
|
477
|
+
data.attachments.push(currentAttachment);
|
|
478
|
+
currentAttachment = null;
|
|
479
|
+
} else if (currentItem.postType === "nav_menu_item") {
|
|
480
|
+
navMenuItemPosts.push(currentItem);
|
|
481
|
+
data.posts.push(currentItem);
|
|
482
|
+
} else if (currentItem.postType !== "attachment") data.posts.push(currentItem);
|
|
483
|
+
currentItem = null;
|
|
484
|
+
break;
|
|
485
|
+
}
|
|
486
|
+
if (currentCategory) switch (tag) {
|
|
487
|
+
case "wp:term_id":
|
|
488
|
+
currentCategory.id = parseInt(text, 10);
|
|
489
|
+
break;
|
|
490
|
+
case "wp:category_nicename":
|
|
491
|
+
currentCategory.nicename = text;
|
|
492
|
+
break;
|
|
493
|
+
case "wp:cat_name":
|
|
494
|
+
currentCategory.name = text;
|
|
495
|
+
break;
|
|
496
|
+
case "wp:category_parent":
|
|
497
|
+
currentCategory.parent = text || void 0;
|
|
498
|
+
break;
|
|
499
|
+
case "wp:category_description":
|
|
500
|
+
currentCategory.description = text || void 0;
|
|
501
|
+
break;
|
|
502
|
+
case "wp:category":
|
|
503
|
+
if (currentCategory.name) data.categories.push(currentCategory);
|
|
504
|
+
currentCategory = null;
|
|
505
|
+
break;
|
|
506
|
+
}
|
|
507
|
+
if (currentTag) switch (tag) {
|
|
508
|
+
case "wp:term_id":
|
|
509
|
+
currentTag.id = parseInt(text, 10);
|
|
510
|
+
break;
|
|
511
|
+
case "wp:tag_slug":
|
|
512
|
+
currentTag.slug = text;
|
|
513
|
+
break;
|
|
514
|
+
case "wp:tag_name":
|
|
515
|
+
currentTag.name = text;
|
|
516
|
+
break;
|
|
517
|
+
case "wp:tag_description":
|
|
518
|
+
currentTag.description = text || void 0;
|
|
519
|
+
break;
|
|
520
|
+
case "wp:tag":
|
|
521
|
+
if (currentTag.name) data.tags.push(currentTag);
|
|
522
|
+
currentTag = null;
|
|
523
|
+
break;
|
|
524
|
+
}
|
|
525
|
+
if (currentAuthor) switch (tag) {
|
|
526
|
+
case "wp:author_id":
|
|
527
|
+
currentAuthor.id = parseInt(text, 10);
|
|
528
|
+
break;
|
|
529
|
+
case "wp:author_login":
|
|
530
|
+
currentAuthor.login = text;
|
|
531
|
+
break;
|
|
532
|
+
case "wp:author_email":
|
|
533
|
+
currentAuthor.email = text;
|
|
534
|
+
break;
|
|
535
|
+
case "wp:author_display_name":
|
|
536
|
+
currentAuthor.displayName = text;
|
|
537
|
+
break;
|
|
538
|
+
case "wp:author_first_name":
|
|
539
|
+
currentAuthor.firstName = text;
|
|
540
|
+
break;
|
|
541
|
+
case "wp:author_last_name":
|
|
542
|
+
currentAuthor.lastName = text;
|
|
543
|
+
break;
|
|
544
|
+
case "wp:author":
|
|
545
|
+
if (currentAuthor.login) data.authors.push(currentAuthor);
|
|
546
|
+
currentAuthor = null;
|
|
547
|
+
break;
|
|
548
|
+
}
|
|
549
|
+
if (currentTerm) switch (tag) {
|
|
550
|
+
case "wp:term_id":
|
|
551
|
+
currentTerm.id = parseInt(text, 10);
|
|
552
|
+
break;
|
|
553
|
+
case "wp:term_taxonomy":
|
|
554
|
+
currentTerm.taxonomy = text;
|
|
555
|
+
break;
|
|
556
|
+
case "wp:term_slug":
|
|
557
|
+
currentTerm.slug = text;
|
|
558
|
+
break;
|
|
559
|
+
case "wp:term_name":
|
|
560
|
+
currentTerm.name = text;
|
|
561
|
+
break;
|
|
562
|
+
case "wp:term_parent":
|
|
563
|
+
currentTerm.parent = text || void 0;
|
|
564
|
+
break;
|
|
565
|
+
case "wp:term_description":
|
|
566
|
+
currentTerm.description = text || void 0;
|
|
567
|
+
break;
|
|
568
|
+
case "wp:term":
|
|
569
|
+
if (isCompleteWxrTerm(currentTerm)) {
|
|
570
|
+
data.terms.push(currentTerm);
|
|
571
|
+
if (currentTerm.taxonomy === "nav_menu") menuTermsBySlug.set(currentTerm.slug, currentTerm.id);
|
|
572
|
+
}
|
|
573
|
+
currentTerm = null;
|
|
574
|
+
break;
|
|
575
|
+
}
|
|
576
|
+
currentPath.pop();
|
|
577
|
+
currentText = "";
|
|
578
|
+
};
|
|
579
|
+
parser.onerror = (err) => {
|
|
580
|
+
reject(/* @__PURE__ */ new Error(`XML parsing error: ${err.message}`));
|
|
581
|
+
};
|
|
582
|
+
parser.onend = () => {
|
|
583
|
+
data.navMenus = buildNavMenus(navMenuItemPosts, menuTermsBySlug);
|
|
584
|
+
resolve(data);
|
|
585
|
+
};
|
|
586
|
+
parser.write(xml).close();
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Build structured navigation menus from nav_menu_item posts
|
|
591
|
+
*/
|
|
592
|
+
function buildNavMenus(navMenuItemPosts, menuTermsBySlug) {
|
|
593
|
+
const menuItemsByMenu = /* @__PURE__ */ new Map();
|
|
594
|
+
for (const post of navMenuItemPosts) {
|
|
595
|
+
const navMenuSlugs = post.customTaxonomies?.get("nav_menu");
|
|
596
|
+
if (!navMenuSlugs || navMenuSlugs.length === 0) continue;
|
|
597
|
+
const menuSlug = navMenuSlugs[0];
|
|
598
|
+
if (!menuSlug) continue;
|
|
599
|
+
const items = menuItemsByMenu.get(menuSlug) || [];
|
|
600
|
+
items.push(post);
|
|
601
|
+
menuItemsByMenu.set(menuSlug, items);
|
|
602
|
+
}
|
|
603
|
+
const menus = [];
|
|
604
|
+
for (const [menuSlug, posts] of menuItemsByMenu) {
|
|
605
|
+
const menuId = menuTermsBySlug.get(menuSlug) || 0;
|
|
606
|
+
const items = posts.map((post) => {
|
|
607
|
+
const meta = post.meta;
|
|
608
|
+
const menuItemTypeRaw = meta.get("_menu_item_type") || "custom";
|
|
609
|
+
const menuItemType = menuItemTypeRaw === "post_type" || menuItemTypeRaw === "taxonomy" ? menuItemTypeRaw : "custom";
|
|
610
|
+
const objectType = meta.get("_menu_item_object");
|
|
611
|
+
const objectIdStr = meta.get("_menu_item_object_id");
|
|
612
|
+
const url = meta.get("_menu_item_url");
|
|
613
|
+
const parentIdStr = meta.get("_menu_item_menu_item_parent");
|
|
614
|
+
const target = meta.get("_menu_item_target");
|
|
615
|
+
const classesStr = meta.get("_menu_item_classes");
|
|
616
|
+
let classes;
|
|
617
|
+
if (classesStr) {
|
|
618
|
+
const matches = classesStr.match(PHP_SERIALIZED_STRING_PATTERN);
|
|
619
|
+
if (matches) classes = matches.map((m) => m.match(PHP_SERIALIZED_STRING_MATCH_PATTERN)?.[1]).filter(Boolean).join(" ");
|
|
620
|
+
}
|
|
621
|
+
return {
|
|
622
|
+
id: post.id || 0,
|
|
623
|
+
menuId,
|
|
624
|
+
parentId: parentIdStr ? parseInt(parentIdStr, 10) || void 0 : void 0,
|
|
625
|
+
sortOrder: post.menuOrder || 0,
|
|
626
|
+
type: menuItemType,
|
|
627
|
+
objectType: objectType || void 0,
|
|
628
|
+
objectId: objectIdStr ? parseInt(objectIdStr, 10) : void 0,
|
|
629
|
+
url: url || void 0,
|
|
630
|
+
title: post.title || "",
|
|
631
|
+
target: target || void 0,
|
|
632
|
+
classes: classes || void 0
|
|
633
|
+
};
|
|
634
|
+
});
|
|
635
|
+
items.sort((a, b) => a.sortOrder - b.sortOrder);
|
|
636
|
+
menus.push({
|
|
637
|
+
id: menuId,
|
|
638
|
+
name: menuSlug,
|
|
639
|
+
label: menuSlug,
|
|
640
|
+
items
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
return menus;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
//#endregion
|
|
647
|
+
//#region src/import/sections.ts
|
|
648
|
+
/**
|
|
649
|
+
* Import reusable blocks (wp_block post type) from WXR as sections
|
|
650
|
+
*
|
|
651
|
+
* @param posts - All posts from WXR (will filter to wp_block)
|
|
652
|
+
* @param db - Database connection
|
|
653
|
+
* @returns Import result with counts
|
|
654
|
+
*/
|
|
655
|
+
async function importReusableBlocksAsSections(posts, db) {
|
|
656
|
+
const result = {
|
|
657
|
+
sectionsCreated: 0,
|
|
658
|
+
sectionsSkipped: 0,
|
|
659
|
+
errors: []
|
|
660
|
+
};
|
|
661
|
+
const reusableBlocks = posts.filter((post) => post.postType === "wp_block");
|
|
662
|
+
if (reusableBlocks.length === 0) return result;
|
|
663
|
+
for (const block of reusableBlocks) try {
|
|
664
|
+
const slug = block.postName || slugify(block.title || `block-${block.id || Date.now()}`);
|
|
665
|
+
if (await db.selectFrom("_dineway_sections").select("id").where("slug", "=", slug).executeTakeFirst()) {
|
|
666
|
+
result.sectionsSkipped++;
|
|
667
|
+
continue;
|
|
668
|
+
}
|
|
669
|
+
const content = block.content ? gutenbergToPortableText(block.content) : [];
|
|
670
|
+
const id = ulid();
|
|
671
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
672
|
+
await db.insertInto("_dineway_sections").values({
|
|
673
|
+
id,
|
|
674
|
+
slug,
|
|
675
|
+
title: block.title || "Untitled Block",
|
|
676
|
+
description: null,
|
|
677
|
+
keywords: null,
|
|
678
|
+
content: JSON.stringify(content),
|
|
679
|
+
preview_media_id: null,
|
|
680
|
+
source: "import",
|
|
681
|
+
theme_id: null,
|
|
682
|
+
created_at: now,
|
|
683
|
+
updated_at: now
|
|
684
|
+
}).execute();
|
|
685
|
+
result.sectionsCreated++;
|
|
686
|
+
} catch (error) {
|
|
687
|
+
result.errors.push({
|
|
688
|
+
title: block.title || "Untitled Block",
|
|
689
|
+
error: error instanceof Error ? error.message : String(error)
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
return result;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
//#endregion
|
|
696
|
+
//#region src/import/registry.ts
|
|
697
|
+
/**
|
|
698
|
+
* Import source registry
|
|
699
|
+
*
|
|
700
|
+
* Manages available import sources and provides URL probing.
|
|
701
|
+
*/
|
|
702
|
+
const TRAILING_SLASHES_PATTERN = /\/+$/;
|
|
703
|
+
/** Registered import sources */
|
|
704
|
+
const sources = /* @__PURE__ */ new Map();
|
|
705
|
+
/**
|
|
706
|
+
* Register an import source
|
|
707
|
+
*/
|
|
708
|
+
function registerSource(source) {
|
|
709
|
+
sources.set(source.id, source);
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* Get a source by ID
|
|
713
|
+
*/
|
|
714
|
+
function getSource(id) {
|
|
715
|
+
return sources.get(id);
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* Get all registered sources
|
|
719
|
+
*/
|
|
720
|
+
function getAllSources() {
|
|
721
|
+
return [...sources.values()];
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Get sources that can handle file uploads
|
|
725
|
+
*/
|
|
726
|
+
function getFileSources() {
|
|
727
|
+
return getAllSources().filter((s) => s.requiresFile);
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Get sources that can probe URLs
|
|
731
|
+
*/
|
|
732
|
+
function getUrlSources() {
|
|
733
|
+
return getAllSources().filter((s) => s.canProbe);
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Probe a URL against all registered sources
|
|
737
|
+
*
|
|
738
|
+
* Returns probe results sorted by confidence (definite > likely > possible)
|
|
739
|
+
*/
|
|
740
|
+
async function probeUrl(url) {
|
|
741
|
+
let normalizedUrl = url.trim();
|
|
742
|
+
if (!normalizedUrl.startsWith("http")) normalizedUrl = `https://${normalizedUrl}`;
|
|
743
|
+
normalizedUrl = normalizedUrl.replace(TRAILING_SLASHES_PATTERN, "");
|
|
744
|
+
await resolveAndValidateExternalUrl(normalizedUrl);
|
|
745
|
+
const results = [];
|
|
746
|
+
const probePromises = getUrlSources().map(async (source) => {
|
|
747
|
+
try {
|
|
748
|
+
const result = await source.probe?.(normalizedUrl);
|
|
749
|
+
if (result) return result;
|
|
750
|
+
} catch (error) {
|
|
751
|
+
console.debug(`Probe failed for ${source.id}:`, error);
|
|
752
|
+
}
|
|
753
|
+
return null;
|
|
754
|
+
});
|
|
755
|
+
const probeResults = await Promise.allSettled(probePromises);
|
|
756
|
+
for (const result of probeResults) if (result.status === "fulfilled" && result.value) results.push(result.value);
|
|
757
|
+
const confidenceOrder = {
|
|
758
|
+
definite: 0,
|
|
759
|
+
likely: 1,
|
|
760
|
+
possible: 2
|
|
761
|
+
};
|
|
762
|
+
results.sort((a, b) => confidenceOrder[a.confidence] - confidenceOrder[b.confidence]);
|
|
763
|
+
return {
|
|
764
|
+
url: normalizedUrl,
|
|
765
|
+
isWordPress: results.length > 0,
|
|
766
|
+
bestMatch: results[0] ?? null,
|
|
767
|
+
allMatches: results
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Clear all registered sources (useful for testing)
|
|
772
|
+
*/
|
|
773
|
+
function clearSources() {
|
|
774
|
+
sources.clear();
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
//#endregion
|
|
778
|
+
//#region src/import/sources/wxr.ts
|
|
779
|
+
/**
|
|
780
|
+
* WXR (WordPress eXtended RSS) import source
|
|
781
|
+
*
|
|
782
|
+
* Handles WordPress export file uploads (.xml).
|
|
783
|
+
* This wraps the existing WXR parsing and analysis logic.
|
|
784
|
+
*/
|
|
785
|
+
const wxrSource = {
|
|
786
|
+
id: "wxr",
|
|
787
|
+
name: "WordPress Export File",
|
|
788
|
+
description: "Upload a WordPress export file (.xml)",
|
|
789
|
+
icon: "upload",
|
|
790
|
+
requiresFile: true,
|
|
791
|
+
canProbe: false,
|
|
792
|
+
async analyze(input, context) {
|
|
793
|
+
if (input.type !== "file") throw new Error("WXR source requires a file input");
|
|
794
|
+
return analyzeWxrData(await parseWxrString(await input.file.text()), context.getExistingCollections ? await context.getExistingCollections() : /* @__PURE__ */ new Map());
|
|
795
|
+
},
|
|
796
|
+
async *fetchContent(input, options) {
|
|
797
|
+
if (input.type !== "file") throw new Error("WXR source requires a file input");
|
|
798
|
+
const wxr = await parseWxrString(await input.file.text());
|
|
799
|
+
const attachmentMap = buildAttachmentMap(wxr.attachments);
|
|
800
|
+
let count = 0;
|
|
801
|
+
for (const post of wxr.posts) {
|
|
802
|
+
const postType = post.postType || "post";
|
|
803
|
+
if (!options.postTypes.includes(postType)) continue;
|
|
804
|
+
if (isInternalPostType(postType)) continue;
|
|
805
|
+
if (!options.includeDrafts && post.status !== "publish") continue;
|
|
806
|
+
yield wxrPostToNormalizedItem(post, attachmentMap);
|
|
807
|
+
count++;
|
|
808
|
+
if (options.limit && count >= options.limit) break;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
};
|
|
812
|
+
/**
|
|
813
|
+
* Analyze WXR data and return normalized ImportAnalysis
|
|
814
|
+
*/
|
|
815
|
+
function analyzeWxrData(wxr, existingCollections) {
|
|
816
|
+
const postTypeCounts = /* @__PURE__ */ new Map();
|
|
817
|
+
const postTypesWithThumbnails = /* @__PURE__ */ new Set();
|
|
818
|
+
const metaKeys = /* @__PURE__ */ new Map();
|
|
819
|
+
const authorPostCounts = /* @__PURE__ */ new Map();
|
|
820
|
+
for (const post of wxr.posts) {
|
|
821
|
+
const type = post.postType || "post";
|
|
822
|
+
postTypeCounts.set(type, (postTypeCounts.get(type) || 0) + 1);
|
|
823
|
+
if (post.creator) authorPostCounts.set(post.creator, (authorPostCounts.get(post.creator) || 0) + 1);
|
|
824
|
+
if (post.meta.has("_thumbnail_id")) postTypesWithThumbnails.add(type);
|
|
825
|
+
for (const [key, value] of post.meta) {
|
|
826
|
+
const existing = metaKeys.get(key);
|
|
827
|
+
if (existing) {
|
|
828
|
+
existing.count++;
|
|
829
|
+
if (existing.samples.length < 3 && value) existing.samples.push(value.slice(0, 100));
|
|
830
|
+
} else metaKeys.set(key, {
|
|
831
|
+
count: 1,
|
|
832
|
+
samples: value ? [value.slice(0, 100)] : [],
|
|
833
|
+
isInternal: isInternalMetaKey(key)
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
const customFields = [...metaKeys.entries()].filter(([_, info]) => !info.isInternal).map(([key, info]) => ({
|
|
838
|
+
key,
|
|
839
|
+
count: info.count,
|
|
840
|
+
samples: info.samples,
|
|
841
|
+
suggestedField: mapMetaKeyToField(key),
|
|
842
|
+
suggestedType: inferMetaType(key, info.samples[0]),
|
|
843
|
+
isInternal: info.isInternal
|
|
844
|
+
})).toSorted((a, b) => b.count - a.count);
|
|
845
|
+
const postTypes = [...postTypeCounts.entries()].filter(([type]) => !isInternalPostType(type)).map(([name, count]) => {
|
|
846
|
+
const suggestedCollection = mapPostTypeToCollection(name);
|
|
847
|
+
const existingCollection = existingCollections.get(suggestedCollection);
|
|
848
|
+
const requiredFields = [...BASE_REQUIRED_FIELDS];
|
|
849
|
+
if (postTypesWithThumbnails.has(name)) requiredFields.push(FEATURED_IMAGE_FIELD);
|
|
850
|
+
return {
|
|
851
|
+
name,
|
|
852
|
+
count,
|
|
853
|
+
suggestedCollection,
|
|
854
|
+
requiredFields,
|
|
855
|
+
schemaStatus: checkSchemaCompatibility(requiredFields, existingCollection)
|
|
856
|
+
};
|
|
857
|
+
}).toSorted((a, b) => b.count - a.count);
|
|
858
|
+
const attachmentItems = wxr.attachments.map((att) => {
|
|
859
|
+
const filename = att.url ? getFilenameFromUrl(att.url) : void 0;
|
|
860
|
+
const mimeType = filename ? guessMimeType(filename) : void 0;
|
|
861
|
+
return {
|
|
862
|
+
id: att.id,
|
|
863
|
+
title: att.title,
|
|
864
|
+
url: att.url,
|
|
865
|
+
filename,
|
|
866
|
+
mimeType
|
|
867
|
+
};
|
|
868
|
+
});
|
|
869
|
+
const navMenus = wxr.navMenus.map((menu) => ({
|
|
870
|
+
name: menu.name,
|
|
871
|
+
label: menu.label,
|
|
872
|
+
itemCount: menu.items.length
|
|
873
|
+
}));
|
|
874
|
+
const taxonomyMap = /* @__PURE__ */ new Map();
|
|
875
|
+
for (const term of wxr.terms) {
|
|
876
|
+
if (term.taxonomy === "category" || term.taxonomy === "post_tag" || term.taxonomy === "nav_menu") continue;
|
|
877
|
+
const existing = taxonomyMap.get(term.taxonomy);
|
|
878
|
+
if (existing) {
|
|
879
|
+
existing.count++;
|
|
880
|
+
if (existing.samples.length < 3) existing.samples.push(term.name);
|
|
881
|
+
} else taxonomyMap.set(term.taxonomy, {
|
|
882
|
+
count: 1,
|
|
883
|
+
samples: [term.name]
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
const customTaxonomies = Array.from(taxonomyMap.entries(), ([slug, info]) => ({
|
|
887
|
+
slug,
|
|
888
|
+
termCount: info.count,
|
|
889
|
+
sampleTerms: info.samples
|
|
890
|
+
})).toSorted((a, b) => b.termCount - a.termCount);
|
|
891
|
+
const reusableBlocks = wxr.posts.filter((post) => post.postType === "wp_block").map((post) => ({
|
|
892
|
+
id: post.id || 0,
|
|
893
|
+
title: post.title || "Untitled Block",
|
|
894
|
+
slug: post.postName || slugify(post.title || `block-${post.id || Date.now()}`)
|
|
895
|
+
}));
|
|
896
|
+
return {
|
|
897
|
+
sourceId: "wxr",
|
|
898
|
+
site: {
|
|
899
|
+
title: wxr.site.title || "WordPress Site",
|
|
900
|
+
url: wxr.site.link || ""
|
|
901
|
+
},
|
|
902
|
+
postTypes,
|
|
903
|
+
attachments: {
|
|
904
|
+
count: wxr.attachments.length,
|
|
905
|
+
items: attachmentItems
|
|
906
|
+
},
|
|
907
|
+
categories: wxr.categories.length,
|
|
908
|
+
tags: wxr.tags.length,
|
|
909
|
+
authors: wxr.authors.map((a) => ({
|
|
910
|
+
id: a.id,
|
|
911
|
+
login: a.login,
|
|
912
|
+
email: a.email,
|
|
913
|
+
displayName: a.displayName || a.login || "Unknown",
|
|
914
|
+
postCount: a.login ? authorPostCounts.get(a.login) || 0 : 0
|
|
915
|
+
})),
|
|
916
|
+
navMenus: navMenus.length > 0 ? navMenus : void 0,
|
|
917
|
+
customTaxonomies: customTaxonomies.length > 0 ? customTaxonomies : void 0,
|
|
918
|
+
reusableBlocks: reusableBlocks.length > 0 ? reusableBlocks : void 0,
|
|
919
|
+
customFields
|
|
920
|
+
};
|
|
921
|
+
}
|
|
922
|
+
/**
|
|
923
|
+
* Convert a WXR post to a normalized item
|
|
924
|
+
*/
|
|
925
|
+
function wxrPostToNormalizedItem(post, attachmentMap) {
|
|
926
|
+
const content = post.content ? gutenbergToPortableText(post.content) : [];
|
|
927
|
+
const thumbnailId = post.meta.get("_thumbnail_id");
|
|
928
|
+
const featuredImage = thumbnailId ? attachmentMap.get(String(thumbnailId)) : void 0;
|
|
929
|
+
let customTaxonomies;
|
|
930
|
+
if (post.customTaxonomies && post.customTaxonomies.size > 0) customTaxonomies = Object.fromEntries(post.customTaxonomies);
|
|
931
|
+
return {
|
|
932
|
+
sourceId: post.id || 0,
|
|
933
|
+
postType: post.postType || "post",
|
|
934
|
+
status: mapWpStatus(post.status),
|
|
935
|
+
slug: post.postName || slugify(post.title || `post-${post.id || Date.now()}`),
|
|
936
|
+
title: post.title || "Untitled",
|
|
937
|
+
content,
|
|
938
|
+
excerpt: post.excerpt,
|
|
939
|
+
date: parseWxrDate(post.postDateGmt, post.pubDate, post.postDate) ?? /* @__PURE__ */ new Date(),
|
|
940
|
+
modified: parseWxrDate(post.postModifiedGmt, void 0, post.postModified),
|
|
941
|
+
author: post.creator,
|
|
942
|
+
categories: post.categories,
|
|
943
|
+
tags: post.tags,
|
|
944
|
+
meta: Object.fromEntries(post.meta),
|
|
945
|
+
featuredImage,
|
|
946
|
+
parentId: post.postParent && post.postParent !== 0 ? post.postParent : void 0,
|
|
947
|
+
menuOrder: post.menuOrder,
|
|
948
|
+
customTaxonomies
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* WordPress uses "0000-00-00 00:00:00" as a sentinel for missing GMT dates
|
|
953
|
+
* (e.g. unpublished drafts). This must be treated as absent.
|
|
954
|
+
*/
|
|
955
|
+
const WXR_ZERO_DATE = "0000-00-00 00:00:00";
|
|
956
|
+
/**
|
|
957
|
+
* Parse a WXR date with the correct fallback chain:
|
|
958
|
+
* 1. GMT date (always UTC, most reliable)
|
|
959
|
+
* 2. pubDate (RFC 2822, includes timezone offset)
|
|
960
|
+
* 3. Site-local date (MySQL datetime without timezone, imprecise but best available)
|
|
961
|
+
*
|
|
962
|
+
* Returns undefined when none of the inputs yield a valid date.
|
|
963
|
+
* Callers that need a guaranteed Date should use `?? new Date()`.
|
|
964
|
+
*/
|
|
965
|
+
function parseWxrDate(gmtDate, pubDate, localDate) {
|
|
966
|
+
if (gmtDate && gmtDate !== WXR_ZERO_DATE) return /* @__PURE__ */ new Date(gmtDate.replace(" ", "T") + "Z");
|
|
967
|
+
if (pubDate) {
|
|
968
|
+
const d = new Date(pubDate);
|
|
969
|
+
if (!isNaN(d.getTime())) return d;
|
|
970
|
+
}
|
|
971
|
+
if (localDate) {
|
|
972
|
+
const d = new Date(localDate.replace(" ", "T"));
|
|
973
|
+
if (!isNaN(d.getTime())) return d;
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
//#endregion
|
|
978
|
+
//#region src/import/sources/wordpress-rest.ts
|
|
979
|
+
/**
|
|
980
|
+
* WordPress REST API probe
|
|
981
|
+
*
|
|
982
|
+
* Probes self-hosted WordPress sites to detect capabilities.
|
|
983
|
+
* This source is probe-only - it tells users what's available
|
|
984
|
+
* and suggests next steps (usually: upload WXR file).
|
|
985
|
+
*/
|
|
986
|
+
const TRAILING_SLASHES = /\/+$/;
|
|
987
|
+
const WP_JSON_SUFFIX = /\/wp-json\/?$/;
|
|
988
|
+
const wordpressRestSource = {
|
|
989
|
+
id: "wordpress-rest",
|
|
990
|
+
name: "WordPress Site",
|
|
991
|
+
description: "Connect to a self-hosted WordPress site",
|
|
992
|
+
icon: "globe",
|
|
993
|
+
requiresFile: false,
|
|
994
|
+
canProbe: true,
|
|
995
|
+
async probe(url) {
|
|
996
|
+
try {
|
|
997
|
+
const siteUrl = normalizeUrl(url);
|
|
998
|
+
validateExternalUrl(siteUrl);
|
|
999
|
+
const response = await ssrfSafeFetch(`${siteUrl}/wp-json/`, {
|
|
1000
|
+
headers: { Accept: "application/json" },
|
|
1001
|
+
signal: AbortSignal.timeout(1e4)
|
|
1002
|
+
});
|
|
1003
|
+
if (!response.ok) {
|
|
1004
|
+
if (!(await ssrfSafeFetch(`${siteUrl}/?rest_route=/`, {
|
|
1005
|
+
headers: { Accept: "application/json" },
|
|
1006
|
+
signal: AbortSignal.timeout(1e4)
|
|
1007
|
+
})).ok) return null;
|
|
1008
|
+
}
|
|
1009
|
+
const data = await response.json();
|
|
1010
|
+
if (!data.namespaces?.includes("wp/v2")) return null;
|
|
1011
|
+
const preview = await getPublicContentCounts(siteUrl);
|
|
1012
|
+
const hasAppPasswords = !!data.authentication?.["application-passwords"];
|
|
1013
|
+
return {
|
|
1014
|
+
sourceId: "wordpress-rest",
|
|
1015
|
+
confidence: "definite",
|
|
1016
|
+
detected: {
|
|
1017
|
+
platform: "wordpress",
|
|
1018
|
+
siteTitle: data.name,
|
|
1019
|
+
siteUrl: data.url || data.home || siteUrl
|
|
1020
|
+
},
|
|
1021
|
+
capabilities: {
|
|
1022
|
+
publicContent: true,
|
|
1023
|
+
privateContent: false,
|
|
1024
|
+
customPostTypes: false,
|
|
1025
|
+
allMeta: false,
|
|
1026
|
+
mediaStream: true
|
|
1027
|
+
},
|
|
1028
|
+
auth: hasAppPasswords ? {
|
|
1029
|
+
type: "password",
|
|
1030
|
+
instructions: "To import drafts and private content, create an Application Password in WordPress → Users → Your Profile → Application Passwords"
|
|
1031
|
+
} : void 0,
|
|
1032
|
+
preview,
|
|
1033
|
+
suggestedAction: {
|
|
1034
|
+
type: "upload",
|
|
1035
|
+
instructions: "For a complete import including drafts, custom post types, and all metadata, export your content from WordPress (Tools → Export) and upload the file here."
|
|
1036
|
+
}
|
|
1037
|
+
};
|
|
1038
|
+
} catch {
|
|
1039
|
+
return null;
|
|
1040
|
+
}
|
|
1041
|
+
},
|
|
1042
|
+
async analyze(_input, _context) {
|
|
1043
|
+
throw new Error("Direct REST API import not implemented. Please upload a WXR export file.");
|
|
1044
|
+
},
|
|
1045
|
+
async *fetchContent(_input, _options) {
|
|
1046
|
+
throw new Error("Direct REST API import not implemented. Please upload a WXR export file.");
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
1049
|
+
/**
|
|
1050
|
+
* Normalize a URL for API requests
|
|
1051
|
+
*/
|
|
1052
|
+
function normalizeUrl(url) {
|
|
1053
|
+
let normalized = url.trim();
|
|
1054
|
+
if (!normalized.startsWith("http")) normalized = `https://${normalized}`;
|
|
1055
|
+
normalized = normalized.replace(TRAILING_SLASHES, "");
|
|
1056
|
+
normalized = normalized.replace(WP_JSON_SUFFIX, "");
|
|
1057
|
+
return normalized;
|
|
1058
|
+
}
|
|
1059
|
+
/**
|
|
1060
|
+
* Get public content counts from REST API
|
|
1061
|
+
*/
|
|
1062
|
+
async function getPublicContentCounts(siteUrl) {
|
|
1063
|
+
const result = {};
|
|
1064
|
+
try {
|
|
1065
|
+
const [postsRes, pagesRes, mediaRes] = await Promise.allSettled([
|
|
1066
|
+
ssrfSafeFetch(`${siteUrl}/wp-json/wp/v2/posts?per_page=1`, { signal: AbortSignal.timeout(5e3) }),
|
|
1067
|
+
ssrfSafeFetch(`${siteUrl}/wp-json/wp/v2/pages?per_page=1`, { signal: AbortSignal.timeout(5e3) }),
|
|
1068
|
+
ssrfSafeFetch(`${siteUrl}/wp-json/wp/v2/media?per_page=1`, { signal: AbortSignal.timeout(5e3) })
|
|
1069
|
+
]);
|
|
1070
|
+
if (postsRes.status === "fulfilled" && postsRes.value.ok) {
|
|
1071
|
+
const total = postsRes.value.headers.get("X-WP-Total");
|
|
1072
|
+
if (total) result.posts = parseInt(total, 10);
|
|
1073
|
+
}
|
|
1074
|
+
if (pagesRes.status === "fulfilled" && pagesRes.value.ok) {
|
|
1075
|
+
const total = pagesRes.value.headers.get("X-WP-Total");
|
|
1076
|
+
if (total) result.pages = parseInt(total, 10);
|
|
1077
|
+
}
|
|
1078
|
+
if (mediaRes.status === "fulfilled" && mediaRes.value.ok) {
|
|
1079
|
+
const total = mediaRes.value.headers.get("X-WP-Total");
|
|
1080
|
+
if (total) result.media = parseInt(total, 10);
|
|
1081
|
+
}
|
|
1082
|
+
} catch {}
|
|
1083
|
+
return result;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
//#endregion
|
|
1087
|
+
//#region src/import/sources/wordpress-plugin.ts
|
|
1088
|
+
/**
|
|
1089
|
+
* WordPress Plugin (Dineway Exporter) import source
|
|
1090
|
+
*
|
|
1091
|
+
* Connects to self-hosted WordPress sites running the Dineway Exporter plugin.
|
|
1092
|
+
* Provides full access to all content including drafts, custom post types, and ACF fields.
|
|
1093
|
+
*/
|
|
1094
|
+
const wordpressPluginSource = {
|
|
1095
|
+
id: "wordpress-plugin",
|
|
1096
|
+
name: "WordPress (Dineway Exporter)",
|
|
1097
|
+
description: "Import from WordPress sites with the Dineway Exporter plugin installed",
|
|
1098
|
+
icon: "plug",
|
|
1099
|
+
requiresFile: false,
|
|
1100
|
+
canProbe: true,
|
|
1101
|
+
async probe(url) {
|
|
1102
|
+
try {
|
|
1103
|
+
const siteUrl = normalizeUrl$1(url);
|
|
1104
|
+
validateExternalUrl(siteUrl);
|
|
1105
|
+
const response = await ssrfSafeFetch(`${siteUrl}/wp-json/dineway/v1/probe`, {
|
|
1106
|
+
headers: { Accept: "application/json" },
|
|
1107
|
+
signal: AbortSignal.timeout(1e4)
|
|
1108
|
+
});
|
|
1109
|
+
if (!response.ok) return null;
|
|
1110
|
+
const data = await response.json();
|
|
1111
|
+
if (!data.dineway_exporter) return null;
|
|
1112
|
+
return {
|
|
1113
|
+
sourceId: "wordpress-plugin",
|
|
1114
|
+
confidence: "definite",
|
|
1115
|
+
detected: {
|
|
1116
|
+
platform: "wordpress",
|
|
1117
|
+
version: data.wordpress_version,
|
|
1118
|
+
siteTitle: data.site.title,
|
|
1119
|
+
siteUrl: data.site.url
|
|
1120
|
+
},
|
|
1121
|
+
capabilities: {
|
|
1122
|
+
publicContent: true,
|
|
1123
|
+
privateContent: true,
|
|
1124
|
+
customPostTypes: true,
|
|
1125
|
+
allMeta: true,
|
|
1126
|
+
mediaStream: true
|
|
1127
|
+
},
|
|
1128
|
+
auth: data.capabilities.application_passwords ? {
|
|
1129
|
+
type: "password",
|
|
1130
|
+
instructions: data.auth_instructions.instructions
|
|
1131
|
+
} : void 0,
|
|
1132
|
+
preview: {
|
|
1133
|
+
posts: data.post_types.find((p) => p.name === "post")?.count,
|
|
1134
|
+
pages: data.post_types.find((p) => p.name === "page")?.count,
|
|
1135
|
+
media: data.media_count
|
|
1136
|
+
},
|
|
1137
|
+
suggestedAction: { type: "proceed" },
|
|
1138
|
+
i18n: pluginI18nToDetection(data.i18n)
|
|
1139
|
+
};
|
|
1140
|
+
} catch {
|
|
1141
|
+
return null;
|
|
1142
|
+
}
|
|
1143
|
+
},
|
|
1144
|
+
async analyze(input, context) {
|
|
1145
|
+
const { siteUrl, headers } = getRequestConfig(input);
|
|
1146
|
+
const response = await ssrfSafeFetch(`${siteUrl}/wp-json/dineway/v1/analyze`, {
|
|
1147
|
+
headers,
|
|
1148
|
+
signal: AbortSignal.timeout(3e4)
|
|
1149
|
+
});
|
|
1150
|
+
if (!response.ok) {
|
|
1151
|
+
const error = await response.json().catch(() => ({}));
|
|
1152
|
+
throw new Error(error.message || `Failed to analyze site: ${response.statusText}`);
|
|
1153
|
+
}
|
|
1154
|
+
const data = await response.json();
|
|
1155
|
+
const existingCollections = context.getExistingCollections ? await context.getExistingCollections() : /* @__PURE__ */ new Map();
|
|
1156
|
+
const postTypes = data.post_types.filter((pt) => pt.total > 0).map((pt) => {
|
|
1157
|
+
const suggestedCollection = mapPostTypeToCollection(pt.name);
|
|
1158
|
+
const existingCollection = existingCollections.get(suggestedCollection);
|
|
1159
|
+
const requiredFields = pt.supports && "thumbnail" in pt.supports ? [...BASE_REQUIRED_FIELDS, FEATURED_IMAGE_FIELD] : [...BASE_REQUIRED_FIELDS];
|
|
1160
|
+
return {
|
|
1161
|
+
name: pt.name,
|
|
1162
|
+
count: pt.total,
|
|
1163
|
+
suggestedCollection,
|
|
1164
|
+
requiredFields,
|
|
1165
|
+
schemaStatus: checkSchemaCompatibility(requiredFields, existingCollection)
|
|
1166
|
+
};
|
|
1167
|
+
});
|
|
1168
|
+
const attachments = [];
|
|
1169
|
+
if (data.attachments.count > 0) try {
|
|
1170
|
+
const mediaResponse = await ssrfSafeFetch(`${siteUrl}/wp-json/dineway/v1/media?per_page=500`, {
|
|
1171
|
+
headers,
|
|
1172
|
+
signal: AbortSignal.timeout(3e4)
|
|
1173
|
+
});
|
|
1174
|
+
if (mediaResponse.ok) {
|
|
1175
|
+
const mediaData = await mediaResponse.json();
|
|
1176
|
+
for (const item of mediaData.items) attachments.push({
|
|
1177
|
+
id: item.id,
|
|
1178
|
+
url: item.url,
|
|
1179
|
+
filename: item.filename,
|
|
1180
|
+
mimeType: item.mime_type,
|
|
1181
|
+
title: item.title,
|
|
1182
|
+
alt: item.alt,
|
|
1183
|
+
caption: item.caption,
|
|
1184
|
+
width: item.width,
|
|
1185
|
+
height: item.height
|
|
1186
|
+
});
|
|
1187
|
+
}
|
|
1188
|
+
} catch (e) {
|
|
1189
|
+
console.warn("Failed to fetch media list:", e);
|
|
1190
|
+
}
|
|
1191
|
+
const categoryTaxonomy = data.taxonomies.find((t) => t.name === "category");
|
|
1192
|
+
const tagTaxonomy = data.taxonomies.find((t) => t.name === "post_tag");
|
|
1193
|
+
return {
|
|
1194
|
+
sourceId: "wordpress-plugin",
|
|
1195
|
+
site: {
|
|
1196
|
+
title: data.site.title,
|
|
1197
|
+
url: data.site.url
|
|
1198
|
+
},
|
|
1199
|
+
postTypes,
|
|
1200
|
+
attachments: {
|
|
1201
|
+
count: data.attachments.count,
|
|
1202
|
+
items: attachments
|
|
1203
|
+
},
|
|
1204
|
+
categories: categoryTaxonomy?.term_count ?? 0,
|
|
1205
|
+
tags: tagTaxonomy?.term_count ?? 0,
|
|
1206
|
+
authors: data.authors.map((a) => ({
|
|
1207
|
+
id: a.id,
|
|
1208
|
+
login: a.login,
|
|
1209
|
+
email: a.email,
|
|
1210
|
+
displayName: a.display_name,
|
|
1211
|
+
postCount: a.post_count
|
|
1212
|
+
})),
|
|
1213
|
+
i18n: pluginI18nToDetection(data.i18n)
|
|
1214
|
+
};
|
|
1215
|
+
},
|
|
1216
|
+
async *fetchContent(input, options) {
|
|
1217
|
+
const { siteUrl, headers } = getRequestConfig(input);
|
|
1218
|
+
for (const postType of options.postTypes) {
|
|
1219
|
+
let page = 1;
|
|
1220
|
+
let totalPages = 1;
|
|
1221
|
+
let yielded = 0;
|
|
1222
|
+
while (page <= totalPages) {
|
|
1223
|
+
const response = await ssrfSafeFetch(`${siteUrl}/wp-json/dineway/v1/content?post_type=${postType}&status=${options.includeDrafts ? "any" : "publish"}&per_page=100&page=${page}`, {
|
|
1224
|
+
headers,
|
|
1225
|
+
signal: AbortSignal.timeout(6e4)
|
|
1226
|
+
});
|
|
1227
|
+
if (!response.ok) throw new Error(`Failed to fetch ${postType}: ${response.statusText}`);
|
|
1228
|
+
const data = await response.json();
|
|
1229
|
+
totalPages = data.pages;
|
|
1230
|
+
for (const post of data.items) {
|
|
1231
|
+
yield pluginPostToNormalizedItem(post);
|
|
1232
|
+
yielded++;
|
|
1233
|
+
if (options.limit && yielded >= options.limit) return;
|
|
1234
|
+
}
|
|
1235
|
+
page++;
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
},
|
|
1239
|
+
async fetchMedia(url, _input) {
|
|
1240
|
+
validateExternalUrl(url);
|
|
1241
|
+
const response = await ssrfSafeFetch(url);
|
|
1242
|
+
if (!response.ok) throw new Error(`Failed to fetch media: ${response.statusText}`);
|
|
1243
|
+
return response.blob();
|
|
1244
|
+
}
|
|
1245
|
+
};
|
|
1246
|
+
/**
|
|
1247
|
+
* Convert plugin i18n info to the shared I18nDetection type.
|
|
1248
|
+
* Returns undefined when no multilingual plugin is detected.
|
|
1249
|
+
*/
|
|
1250
|
+
function pluginI18nToDetection(i18n) {
|
|
1251
|
+
if (!i18n) return void 0;
|
|
1252
|
+
return {
|
|
1253
|
+
plugin: i18n.plugin,
|
|
1254
|
+
defaultLocale: i18n.default_locale,
|
|
1255
|
+
locales: i18n.locales
|
|
1256
|
+
};
|
|
1257
|
+
}
|
|
1258
|
+
/**
|
|
1259
|
+
* Get request configuration from input
|
|
1260
|
+
*/
|
|
1261
|
+
function getRequestConfig(input) {
|
|
1262
|
+
if (input.type === "url") {
|
|
1263
|
+
const siteUrl = normalizeUrl$1(input.url);
|
|
1264
|
+
validateExternalUrl(siteUrl);
|
|
1265
|
+
const headers = { Accept: "application/json" };
|
|
1266
|
+
if (input.token) headers["Authorization"] = `Basic ${input.token}`;
|
|
1267
|
+
return {
|
|
1268
|
+
siteUrl,
|
|
1269
|
+
headers
|
|
1270
|
+
};
|
|
1271
|
+
}
|
|
1272
|
+
if (input.type === "oauth") {
|
|
1273
|
+
const oauthSiteUrl = normalizeUrl$1(input.url);
|
|
1274
|
+
validateExternalUrl(oauthSiteUrl);
|
|
1275
|
+
return {
|
|
1276
|
+
siteUrl: oauthSiteUrl,
|
|
1277
|
+
headers: {
|
|
1278
|
+
Accept: "application/json",
|
|
1279
|
+
Authorization: `Bearer ${input.accessToken}`
|
|
1280
|
+
}
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1283
|
+
throw new Error("WordPress plugin source requires URL or OAuth input");
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* Convert plugin post to normalized item
|
|
1287
|
+
*/
|
|
1288
|
+
function pluginPostToNormalizedItem(post) {
|
|
1289
|
+
const content = post.content ? gutenbergToPortableText(post.content) : [];
|
|
1290
|
+
const categories = post.taxonomies?.category?.map((c) => c.slug) ?? post.taxonomies?.categories?.map((c) => c.slug) ?? [];
|
|
1291
|
+
const tags = post.taxonomies?.post_tag?.map((t) => t.slug) ?? post.taxonomies?.tags?.map((t) => t.slug) ?? [];
|
|
1292
|
+
const meta = { ...post.meta };
|
|
1293
|
+
if (post.acf) meta._acf = post.acf;
|
|
1294
|
+
if (post.yoast) meta._yoast = post.yoast;
|
|
1295
|
+
if (post.rankmath) meta._rankmath = post.rankmath;
|
|
1296
|
+
return {
|
|
1297
|
+
sourceId: post.id,
|
|
1298
|
+
postType: post.post_type,
|
|
1299
|
+
status: mapWpStatus(post.status),
|
|
1300
|
+
slug: post.slug,
|
|
1301
|
+
title: post.title,
|
|
1302
|
+
content,
|
|
1303
|
+
excerpt: post.excerpt || void 0,
|
|
1304
|
+
date: new Date(post.date_gmt || post.date),
|
|
1305
|
+
modified: post.modified_gmt ? new Date(post.modified_gmt) : new Date(post.modified),
|
|
1306
|
+
author: post.author?.login,
|
|
1307
|
+
categories,
|
|
1308
|
+
tags,
|
|
1309
|
+
meta,
|
|
1310
|
+
featuredImage: post.featured_image?.url,
|
|
1311
|
+
locale: post.locale,
|
|
1312
|
+
translationGroup: post.translation_group
|
|
1313
|
+
};
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
//#endregion
|
|
1317
|
+
//#region src/import/index.ts
|
|
1318
|
+
registerSource(wordpressPluginSource);
|
|
1319
|
+
registerSource(wordpressRestSource);
|
|
1320
|
+
registerSource(wxrSource);
|
|
1321
|
+
|
|
1322
|
+
//#endregion
|
|
1323
|
+
export { getAllSources as a, getUrlSources as c, importReusableBlocksAsSections as d, parseWxr as f, clearSources as i, probeUrl as l, parseWxrDate as n, getFileSources as o, parseWxrString as p, wxrSource as r, getSource as s, wordpressRestSource as t, registerSource as u };
|