emdash 0.31.1 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/route-utils.d.mts +3 -3
- package/dist/api/route-utils.mjs +16 -14
- package/dist/api/route-utils.mjs.map +1 -1
- package/dist/api/schemas/index.d.mts +2 -2
- package/dist/api/schemas/index.mjs +4 -4
- package/dist/{api-BkqFzIu4.mjs → api-DgPbMlng.mjs} +24 -20
- package/dist/api-DgPbMlng.mjs.map +1 -0
- package/dist/{api-tokens-uPt8UDpx.mjs → api-tokens-p-iMzvXR.mjs} +2 -2
- package/dist/{api-tokens-uPt8UDpx.mjs.map → api-tokens-p-iMzvXR.mjs.map} +1 -1
- package/dist/{apply-DuXsqll7.mjs → apply-1_6ra7NP.mjs} +19 -19
- package/dist/{apply-DuXsqll7.mjs.map → apply-1_6ra7NP.mjs.map} +1 -1
- package/dist/astro/index.d.mts +12 -12
- package/dist/astro/index.mjs +5 -1
- package/dist/astro/index.mjs.map +1 -1
- package/dist/astro/middleware/auth.d.mts +10 -10
- package/dist/astro/middleware/auth.mjs +5 -5
- package/dist/astro/middleware/redirect.mjs +5 -5
- package/dist/astro/middleware/request-context.mjs +1 -1
- package/dist/astro/middleware.d.mts +10 -10
- package/dist/astro/middleware.mjs +87 -59
- package/dist/astro/middleware.mjs.map +1 -1
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +6 -6
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +6 -6
- package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +4 -4
- package/dist/astro/routes/api/admin/api-tokens/index.mjs +5 -5
- package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +4 -4
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +8 -8
- package/dist/astro/routes/api/admin/byline-fields/index.mjs +8 -8
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +8 -8
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +15 -14
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +15 -14
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/admin/bylines/index.mjs +15 -15
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +11 -11
- package/dist/astro/routes/api/admin/comments/_id_.mjs +5 -5
- package/dist/astro/routes/api/admin/comments/bulk.mjs +9 -9
- package/dist/astro/routes/api/admin/comments/counts.mjs +5 -5
- package/dist/astro/routes/api/admin/comments/index.mjs +9 -9
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +4 -4
- package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +3 -3
- package/dist/astro/routes/api/admin/media-usage/repair.mjs +12 -10
- package/dist/astro/routes/api/admin/media-usage/repair.mjs.map +1 -1
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +4 -4
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs +4 -4
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +36 -34
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +36 -34
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +36 -34
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/mcp.mjs +4 -4
- package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs +36 -34
- package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +36 -34
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +36 -34
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/index.mjs +36 -34
- package/dist/astro/routes/api/admin/plugins/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +3 -3
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +36 -34
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +36 -34
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +36 -34
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +36 -34
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +37 -35
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +36 -34
- package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/install.mjs +37 -35
- package/dist/astro/routes/api/admin/plugins/registry/install.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/updates.mjs +36 -34
- package/dist/astro/routes/api/admin/plugins/updates.mjs.map +1 -1
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +36 -34
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +3 -3
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +36 -34
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/users/_id_/disable.mjs +2 -2
- package/dist/astro/routes/api/admin/users/_id_/enable.mjs +2 -2
- package/dist/astro/routes/api/admin/users/_id_/index.mjs +6 -6
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +3 -3
- package/dist/astro/routes/api/admin/users/index.mjs +6 -6
- package/dist/astro/routes/api/auth/dev-bypass.mjs +7 -6
- package/dist/astro/routes/api/auth/dev-bypass.mjs.map +1 -1
- package/dist/astro/routes/api/auth/invite/accept.mjs +2 -2
- package/dist/astro/routes/api/auth/invite/complete.mjs +7 -7
- package/dist/astro/routes/api/auth/invite/index.mjs +7 -7
- package/dist/astro/routes/api/auth/invite/register-options.mjs +7 -7
- package/dist/astro/routes/api/auth/logout.mjs +3 -3
- package/dist/astro/routes/api/auth/magic-link/send.mjs +8 -8
- package/dist/astro/routes/api/auth/magic-link/verify.mjs +3 -3
- package/dist/astro/routes/api/auth/me.mjs +7 -7
- package/dist/astro/routes/api/auth/mode.mjs +2 -2
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +2 -2
- package/dist/astro/routes/api/auth/oauth/_provider_.mjs +1 -1
- package/dist/astro/routes/api/auth/passkey/_id_.mjs +6 -6
- package/dist/astro/routes/api/auth/passkey/index.mjs +2 -2
- package/dist/astro/routes/api/auth/passkey/options.mjs +8 -8
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +7 -7
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +7 -7
- package/dist/astro/routes/api/auth/passkey/verify.mjs +7 -7
- package/dist/astro/routes/api/auth/signup/complete.mjs +7 -7
- package/dist/astro/routes/api/auth/signup/request.mjs +8 -8
- package/dist/astro/routes/api/auth/signup/verify.mjs +2 -2
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +11 -11
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +10 -10
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +9 -9
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +7 -7
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs +16 -14
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.mjs +16 -14
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +7 -7
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +14 -13
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_.d.mts.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_.mjs +8 -8
- package/dist/astro/routes/api/content/_collection_/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/authors.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/index.mjs +7 -7
- package/dist/astro/routes/api/content/_collection_/trash.mjs +7 -7
- package/dist/astro/routes/api/dashboard.mjs +7 -7
- package/dist/astro/routes/api/dev/emails.mjs +2 -2
- package/dist/astro/routes/api/import/probe.d.mts +3 -3
- package/dist/astro/routes/api/import/probe.mjs +12 -12
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +3 -3
- package/dist/astro/routes/api/import/wordpress/execute.d.mts +11 -11
- package/dist/astro/routes/api/import/wordpress/execute.mjs +12 -11
- package/dist/astro/routes/api/import/wordpress/execute.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress/media.d.mts +10 -10
- package/dist/astro/routes/api/import/wordpress/media.mjs +7 -7
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +9 -9
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +11 -11
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +11 -9
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +12 -12
- package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +11 -11
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +20 -19
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs.map +1 -1
- package/dist/astro/routes/api/manifest.mjs +3 -3
- package/dist/astro/routes/api/mcp.mjs +41 -41
- package/dist/astro/routes/api/media/_id_/confirm.d.mts.map +1 -1
- package/dist/astro/routes/api/media/_id_/confirm.mjs +105 -36
- package/dist/astro/routes/api/media/_id_/confirm.mjs.map +1 -1
- package/dist/astro/routes/api/media/_id_/upload.d.mts +8 -0
- package/dist/astro/routes/api/media/_id_/upload.d.mts.map +1 -0
- package/dist/astro/routes/api/media/_id_/upload.mjs +168 -0
- package/dist/astro/routes/api/media/_id_/upload.mjs.map +1 -0
- package/dist/astro/routes/api/media/_id_/usage.mjs +14 -12
- package/dist/astro/routes/api/media/_id_/usage.mjs.map +1 -1
- package/dist/astro/routes/api/media/_id_.d.mts.map +1 -1
- package/dist/astro/routes/api/media/_id_.mjs +21 -14
- package/dist/astro/routes/api/media/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/media/file/_...key_.mjs +2 -2
- package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +3 -3
- package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +3 -3
- package/dist/astro/routes/api/media/providers/index.mjs +3 -3
- package/dist/astro/routes/api/media/upload-url.d.mts.map +1 -1
- package/dist/astro/routes/api/media/upload-url.mjs +34 -23
- package/dist/astro/routes/api/media/upload-url.mjs.map +1 -1
- package/dist/astro/routes/api/media.mjs +13 -12
- package/dist/astro/routes/api/media.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +9 -8
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/items.mjs +9 -8
- package/dist/astro/routes/api/menus/_name_/items.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +9 -8
- package/dist/astro/routes/api/menus/_name_/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/translations.mjs +9 -8
- package/dist/astro/routes/api/menus/_name_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_.mjs +9 -8
- package/dist/astro/routes/api/menus/_name_.mjs.map +1 -1
- package/dist/astro/routes/api/menus/index.mjs +9 -8
- package/dist/astro/routes/api/menus/index.mjs.map +1 -1
- package/dist/astro/routes/api/oauth/authorize.mjs +5 -5
- package/dist/astro/routes/api/oauth/device/authorize.mjs +6 -6
- package/dist/astro/routes/api/oauth/device/code.mjs +7 -7
- package/dist/astro/routes/api/oauth/device/token.mjs +7 -7
- package/dist/astro/routes/api/oauth/register.mjs +3 -3
- package/dist/astro/routes/api/oauth/token/refresh.mjs +6 -6
- package/dist/astro/routes/api/oauth/token/revoke.mjs +6 -6
- package/dist/astro/routes/api/oauth/token.mjs +6 -6
- package/dist/astro/routes/api/openapi.json.mjs +30 -8
- package/dist/astro/routes/api/openapi.json.mjs.map +1 -1
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +5 -5
- package/dist/astro/routes/api/redirects/404s/index.mjs +10 -10
- package/dist/astro/routes/api/redirects/404s/summary.mjs +10 -10
- package/dist/astro/routes/api/redirects/_id_.mjs +11 -11
- package/dist/astro/routes/api/redirects/index.mjs +11 -11
- package/dist/astro/routes/api/relations/_id_/index.mjs +16 -14
- package/dist/astro/routes/api/relations/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/relations/_id_/translations.mjs +12 -10
- package/dist/astro/routes/api/relations/_id_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/relations/index.mjs +16 -14
- package/dist/astro/routes/api/relations/index.mjs.map +1 -1
- package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +3 -3
- package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +3 -3
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +36 -34
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +36 -34
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +36 -34
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +36 -34
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/index.mjs +36 -34
- package/dist/astro/routes/api/schema/collections/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/index.mjs +10 -8
- package/dist/astro/routes/api/schema/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +36 -34
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs.map +1 -1
- package/dist/astro/routes/api/schema/orphans/index.mjs +36 -34
- package/dist/astro/routes/api/schema/orphans/index.mjs.map +1 -1
- package/dist/astro/routes/api/search/enable.mjs +12 -11
- package/dist/astro/routes/api/search/enable.mjs.map +1 -1
- package/dist/astro/routes/api/search/index.mjs +11 -10
- package/dist/astro/routes/api/search/index.mjs.map +1 -1
- package/dist/astro/routes/api/search/rebuild.mjs +12 -11
- package/dist/astro/routes/api/search/rebuild.mjs.map +1 -1
- package/dist/astro/routes/api/search/stats.mjs +8 -7
- package/dist/astro/routes/api/search/stats.mjs.map +1 -1
- package/dist/astro/routes/api/search/suggest.mjs +11 -10
- package/dist/astro/routes/api/search/suggest.mjs.map +1 -1
- package/dist/astro/routes/api/sections/_slug_.mjs +10 -10
- package/dist/astro/routes/api/sections/index.mjs +10 -10
- package/dist/astro/routes/api/settings/backups/archives/_name_.mjs +4 -4
- package/dist/astro/routes/api/settings/backups/archives/index.mjs +4 -4
- package/dist/astro/routes/api/settings/backups/export.mjs +4 -4
- package/dist/astro/routes/api/settings/backups/index.mjs +5 -5
- package/dist/astro/routes/api/settings/email.mjs +4 -4
- package/dist/astro/routes/api/settings.mjs +12 -12
- package/dist/astro/routes/api/setup/admin-verify.mjs +8 -8
- package/dist/astro/routes/api/setup/admin.mjs +8 -8
- package/dist/astro/routes/api/setup/dev-bypass.mjs +24 -22
- package/dist/astro/routes/api/setup/dev-bypass.mjs.map +1 -1
- package/dist/astro/routes/api/setup/dev-reset.mjs +2 -2
- package/dist/astro/routes/api/setup/index.mjs +24 -22
- package/dist/astro/routes/api/setup/index.mjs.map +1 -1
- package/dist/astro/routes/api/setup/status.mjs +3 -3
- package/dist/astro/routes/api/snapshot.mjs +5 -5
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +14 -13
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +14 -13
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.d.mts.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +19 -15
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/index.mjs +14 -13
- package/dist/astro/routes/api/taxonomies/index.mjs.map +1 -1
- package/dist/astro/routes/api/themes/preview.mjs +4 -4
- package/dist/astro/routes/api/typegen.mjs +5 -5
- package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +1 -1
- package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +1 -1
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +7 -7
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +10 -10
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +10 -10
- package/dist/astro/routes/api/widget-areas/_name_.mjs +6 -6
- package/dist/astro/routes/api/widget-areas/index.mjs +10 -10
- package/dist/astro/routes/api/widget-components.mjs +2 -2
- package/dist/astro/routes/robots.txt.mjs +5 -5
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +7 -7
- package/dist/astro/routes/sitemap.xml.mjs +5 -5
- package/dist/astro/types.d.mts +14 -13
- package/dist/astro/types.d.mts.map +1 -1
- package/dist/auth/providers/github.d.mts +1 -1
- package/dist/auth/providers/google.d.mts +1 -1
- package/dist/{authorize-6WPZa1xZ.mjs → authorize-R5iYYrpa.mjs} +2 -2
- package/dist/{authorize-6WPZa1xZ.mjs.map → authorize-R5iYYrpa.mjs.map} +1 -1
- package/dist/{backup-DoW-H0r4.mjs → backup-LpQ1V_sR.mjs} +2 -2
- package/dist/{backup-DoW-H0r4.mjs.map → backup-LpQ1V_sR.mjs.map} +1 -1
- package/dist/{byline-BTOxUlFF.mjs → byline-C5TAqs8N.mjs} +6 -6
- package/dist/{byline-BTOxUlFF.mjs.map → byline-C5TAqs8N.mjs.map} +1 -1
- package/dist/{byline-fields-CdU_LTF1.mjs → byline-fields-T9ZLZMxJ.mjs} +1 -1
- package/dist/{byline-fields-CdU_LTF1.mjs.map → byline-fields-T9ZLZMxJ.mjs.map} +1 -1
- package/dist/{bylines-Bc-3xtpz.mjs → bylines-B8-WGdja.mjs} +6 -6
- package/dist/{bylines-Bc-3xtpz.mjs.map → bylines-B8-WGdja.mjs.map} +1 -1
- package/dist/{bylines-oVN0iPwX.mjs → bylines-DGuqBLjV.mjs} +5 -5
- package/dist/{bylines-oVN0iPwX.mjs.map → bylines-DGuqBLjV.mjs.map} +1 -1
- package/dist/{cache-DDwy3JDW.mjs → cache-B26cufFd.mjs} +2 -2
- package/dist/{cache-DDwy3JDW.mjs.map → cache-B26cufFd.mjs.map} +1 -1
- package/dist/{chunks-Bq-5DPrD.mjs → chunks-D5dlPeRb.mjs} +2 -2
- package/dist/{chunks-Bq-5DPrD.mjs.map → chunks-D5dlPeRb.mjs.map} +1 -1
- package/dist/cli/index.mjs +20 -19
- package/dist/cli/index.mjs.map +1 -1
- package/dist/client/cf-access.d.mts +1 -1
- package/dist/client/index.d.mts +1 -1
- package/dist/client/index.mjs +2 -2
- package/dist/{comment-B9cUud8H.mjs → comment-DnTxxVHv.mjs} +2 -2
- package/dist/{comment-B9cUud8H.mjs.map → comment-DnTxxVHv.mjs.map} +1 -1
- package/dist/{comment-reaction-VUXO981F.mjs → comment-reaction-BUlUz2bh.mjs} +2 -2
- package/dist/{comment-reaction-VUXO981F.mjs.map → comment-reaction-BUlUz2bh.mjs.map} +1 -1
- package/dist/{comments-PXj1E9Si.mjs → comments-QPKgK3nk.mjs} +3 -3
- package/dist/{comments-PXj1E9Si.mjs.map → comments-QPKgK3nk.mjs.map} +1 -1
- package/dist/{config-B6b_BobR.mjs → config-DyF3OKg_.mjs} +15 -10
- package/dist/config-DyF3OKg_.mjs.map +1 -0
- package/dist/{content-BC43pICM.mjs → content-CpfKV9QE.mjs} +9 -9
- package/dist/content-CpfKV9QE.mjs.map +1 -0
- package/dist/{content-refresh-CPMSauD3.mjs → content-refresh-DgqUBeTv.mjs} +5 -5
- package/dist/{content-refresh-CPMSauD3.mjs.map → content-refresh-DgqUBeTv.mjs.map} +1 -1
- package/dist/{context-DOurRIrb.mjs → context-kO4YZB03.mjs} +10 -10
- package/dist/{context-DOurRIrb.mjs.map → context-kO4YZB03.mjs.map} +1 -1
- package/dist/{dashboard-CBm4zhc3.mjs → dashboard-DoBwPnON.mjs} +4 -4
- package/dist/{dashboard-CBm4zhc3.mjs.map → dashboard-DoBwPnON.mjs.map} +1 -1
- package/dist/db/index.d.mts +2 -2
- package/dist/db/index.mjs +3 -2
- package/dist/db/index.mjs.map +1 -1
- package/dist/{device-flow-BeA6lUS1.mjs → device-flow-DhUsyJU6.mjs} +4 -4
- package/dist/{device-flow-BeA6lUS1.mjs.map → device-flow-DhUsyJU6.mjs.map} +1 -1
- package/dist/{dialect-helpers-BtOwo2us.mjs → dialect-helpers-DFwyWjTM.mjs} +21 -2
- package/dist/dialect-helpers-DFwyWjTM.mjs.map +1 -0
- package/dist/{error-DJ98TRbQ.mjs → error-DmmN74gW.mjs} +2 -2
- package/dist/{error-DJ98TRbQ.mjs.map → error-DmmN74gW.mjs.map} +1 -1
- package/dist/{escape-CFedIB1C.mjs → escape-CdW31WsG.mjs} +1 -1
- package/dist/{escape-CFedIB1C.mjs.map → escape-CdW31WsG.mjs.map} +1 -1
- package/dist/{field-defs-cache-KfNJ_qLQ.mjs → field-defs-cache-QMVnzTH6.mjs} +2 -2
- package/dist/{field-defs-cache-KfNJ_qLQ.mjs.map → field-defs-cache-QMVnzTH6.mjs.map} +1 -1
- package/dist/{fts-manager-hyCU9OOp.mjs → fts-manager-vncsZIJm.mjs} +3 -3
- package/dist/{fts-manager-hyCU9OOp.mjs.map → fts-manager-vncsZIJm.mjs.map} +1 -1
- package/dist/{hash-DFFrkivP.mjs → hash-Cb7U1b5M.mjs} +8 -4
- package/dist/hash-Cb7U1b5M.mjs.map +1 -0
- package/dist/{hreflang-CbYeCzl9.mjs → hreflang-Bg-zMpkr.mjs} +7 -7
- package/dist/{hreflang-CbYeCzl9.mjs.map → hreflang-Bg-zMpkr.mjs.map} +1 -1
- package/dist/{hreflang-CIxH_LKz.d.mts → hreflang-CZbSx6Bg.d.mts} +2 -2
- package/dist/{hreflang-CIxH_LKz.d.mts.map → hreflang-CZbSx6Bg.d.mts.map} +1 -1
- package/dist/{import-oDYCgNYQ.mjs → import-PKhLeXvn.mjs} +2 -2
- package/dist/{import-oDYCgNYQ.mjs.map → import-PKhLeXvn.mjs.map} +1 -1
- package/dist/{index-BEui-cRd.d.mts → index-BeNto_Vs.d.mts} +3 -3
- package/dist/{index-BEui-cRd.d.mts.map → index-BeNto_Vs.d.mts.map} +1 -1
- package/dist/{index-BZJ_5FOX.d.mts → index-j9rTh3cp.d.mts} +52 -17
- package/dist/index-j9rTh3cp.d.mts.map +1 -0
- package/dist/index.d.mts +18 -18
- package/dist/index.mjs +49 -49
- package/dist/{load-Dg5gtWma.mjs → load-BwTdWE8B.mjs} +2 -2
- package/dist/{load-Dg5gtWma.mjs.map → load-BwTdWE8B.mjs.map} +1 -1
- package/dist/{loader-D4rigvjR.mjs → loader-C1XOLV5b.mjs} +4 -4
- package/dist/{loader-D4rigvjR.mjs.map → loader-C1XOLV5b.mjs.map} +1 -1
- package/dist/media/index.d.mts +1 -1
- package/dist/media/local-runtime.d.mts +12 -12
- package/dist/media/local-runtime.mjs +5 -5
- package/dist/{media-BJ6SRY3g.mjs → media-DWIzoVFL.mjs} +8 -4
- package/dist/{media-BJ6SRY3g.mjs.map → media-DWIzoVFL.mjs.map} +1 -1
- package/dist/{media-allowlist-jUppPWFy.mjs → media-allowlist-B7TPD6aq.mjs} +1 -1
- package/dist/{media-allowlist-jUppPWFy.mjs.map → media-allowlist-B7TPD6aq.mjs.map} +1 -1
- package/dist/{media-its1WLYv.mjs → media-tQDZEdu7.mjs} +60 -15
- package/dist/media-tQDZEdu7.mjs.map +1 -0
- package/dist/{media-upload-DNu3QySc.mjs → media-upload-Bc9Nc5Zf.mjs} +6 -6
- package/dist/{media-upload-DNu3QySc.mjs.map → media-upload-Bc9Nc5Zf.mjs.map} +1 -1
- package/dist/{media-usage-DPQ3K4xB.mjs → media-usage-DPJcNaAq.mjs} +6 -6
- package/dist/{media-usage-DPQ3K4xB.mjs.map → media-usage-DPJcNaAq.mjs.map} +1 -1
- package/dist/{menus-BMGzWyWH.mjs → menus-BxPLFfIc.mjs} +3 -3
- package/dist/{menus-BMGzWyWH.mjs.map → menus-BxPLFfIc.mjs.map} +1 -1
- package/dist/{menus-CPf_SW7u.mjs → menus-C6qhqP4X.mjs} +8 -8
- package/dist/{menus-CPf_SW7u.mjs.map → menus-C6qhqP4X.mjs.map} +1 -1
- package/dist/{oauth-authorization-oqfbBuMH.mjs → oauth-authorization-C9tFinly.mjs} +4 -4
- package/dist/{oauth-authorization-oqfbBuMH.mjs.map → oauth-authorization-C9tFinly.mjs.map} +1 -1
- package/dist/{oauth-clients-BlrUHAsf.mjs → oauth-clients-BwTxE1aE.mjs} +1 -1
- package/dist/{oauth-clients-BlrUHAsf.mjs.map → oauth-clients-BwTxE1aE.mjs.map} +1 -1
- package/dist/{oauth-state-store-DnvjRMy6.mjs → oauth-state-store-DaRUwPWO.mjs} +1 -1
- package/dist/{oauth-state-store-DnvjRMy6.mjs.map → oauth-state-store-DaRUwPWO.mjs.map} +1 -1
- package/dist/{oauth-user-lookup-oUllxvAv.mjs → oauth-user-lookup-CzuzOSlF.mjs} +1 -1
- package/dist/{oauth-user-lookup-oUllxvAv.mjs.map → oauth-user-lookup-CzuzOSlF.mjs.map} +1 -1
- package/dist/object-cache/memory.d.mts +1 -1
- package/dist/{options-BqMkWfYa.d.mts → options-aeIs8WFu.d.mts} +3 -3
- package/dist/{options-BqMkWfYa.d.mts.map → options-aeIs8WFu.d.mts.map} +1 -1
- package/dist/page/index.d.mts +2 -2
- package/dist/{parse-53zyxlpv.mjs → parse-BL49yb9D.mjs} +2 -2
- package/dist/{parse-53zyxlpv.mjs.map → parse-BL49yb9D.mjs.map} +1 -1
- package/dist/{passkey-config-C-SKpc0-.mjs → passkey-config-KMhgFjdQ.mjs} +1 -1
- package/dist/{passkey-config-C-SKpc0-.mjs.map → passkey-config-KMhgFjdQ.mjs.map} +1 -1
- package/dist/{placeholder-Dop47JMM.d.mts → placeholder-Dxo5Zt58.d.mts} +1 -1
- package/dist/{placeholder-Dop47JMM.d.mts.map → placeholder-Dxo5Zt58.d.mts.map} +1 -1
- package/dist/plugin-types.d.mts +1 -1
- package/dist/plugin-utils.d.mts +10 -10
- package/dist/plugins/adapt-sandbox-entry.d.mts +10 -10
- package/dist/{portable-text-sDj92Kxv.mjs → portable-text-CNahFfj6.mjs} +1 -1
- package/dist/{portable-text-sDj92Kxv.mjs.map → portable-text-CNahFfj6.mjs.map} +1 -1
- package/dist/{query-DdFGHzQF.mjs → query-1xOcEy18.mjs} +3 -3
- package/dist/{query-DdFGHzQF.mjs.map → query-1xOcEy18.mjs.map} +1 -1
- package/dist/{query-Bz9bWZfm.mjs → query-DCiXI7OZ.mjs} +36 -16
- package/dist/query-DCiXI7OZ.mjs.map +1 -0
- package/dist/{rate-limit-D3IEiUi2.mjs → rate-limit-Vkp9gQ1Y.mjs} +2 -2
- package/dist/{rate-limit-D3IEiUi2.mjs.map → rate-limit-Vkp9gQ1Y.mjs.map} +1 -1
- package/dist/{redirect-BoUac4NT.mjs → redirect-BJ6d1yHh.mjs} +3 -3
- package/dist/{redirect-BoUac4NT.mjs.map → redirect-BJ6d1yHh.mjs.map} +1 -1
- package/dist/{redirect-Botom7X6.mjs → redirect-CDgfv9vh.mjs} +1 -1
- package/dist/{redirect-Botom7X6.mjs.map → redirect-CDgfv9vh.mjs.map} +1 -1
- package/dist/{redirects-D457qwt0.mjs → redirects-BOn2DIUs.mjs} +8 -4
- package/dist/redirects-BOn2DIUs.mjs.map +1 -0
- package/dist/{redirects-ChbpqKiS.mjs → redirects-Cwkq2H-G.mjs} +3 -3
- package/dist/{redirects-ChbpqKiS.mjs.map → redirects-Cwkq2H-G.mjs.map} +1 -1
- package/dist/{registry-y21kjhfG.mjs → registry-BP1JK2xh.mjs} +6 -6
- package/dist/{registry-y21kjhfG.mjs.map → registry-BP1JK2xh.mjs.map} +1 -1
- package/dist/{relation-Du0r04E0.mjs → relation-DJ5DZh7B.mjs} +3 -3
- package/dist/{relation-Du0r04E0.mjs.map → relation-DJ5DZh7B.mjs.map} +1 -1
- package/dist/{relations-CZMpBqEd.mjs → relations-C4duJnwI.mjs} +2 -2
- package/dist/{relations-CZMpBqEd.mjs.map → relations-C4duJnwI.mjs.map} +1 -1
- package/dist/{relations-qKmSj9KM.d.mts → relations-DHFQGX0h.d.mts} +28 -17
- package/dist/relations-DHFQGX0h.d.mts.map +1 -0
- package/dist/{relations-DtX1UMBH.mjs → relations-DpTjftCl.mjs} +6 -6
- package/dist/{relations-DtX1UMBH.mjs.map → relations-DpTjftCl.mjs.map} +1 -1
- package/dist/{resolve-DFr4kq72.mjs → resolve-BUvFE0Lr.mjs} +2 -2
- package/dist/{resolve-DFr4kq72.mjs.map → resolve-BUvFE0Lr.mjs.map} +1 -1
- package/dist/{runner-BdeLEgad.mjs → runner-BsI18UgP.mjs} +230 -212
- package/dist/runner-BsI18UgP.mjs.map +1 -0
- package/dist/{runner-Dd8m8k9F.d.mts → runner-CHdkERbt.d.mts} +2 -2
- package/dist/{runner-Dd8m8k9F.d.mts.map → runner-CHdkERbt.d.mts.map} +1 -1
- package/dist/runtime.d.mts +11 -11
- package/dist/runtime.mjs +3 -3
- package/dist/{schema-BH8P8vaC.mjs → schema-eqZhkR0S.mjs} +3 -3
- package/dist/{schema-BH8P8vaC.mjs.map → schema-eqZhkR0S.mjs.map} +1 -1
- package/dist/{scopes-DTIkIaGA.mjs → scopes-Be2d8bSb.mjs} +3 -3
- package/dist/{scopes-DTIkIaGA.mjs.map → scopes-Be2d8bSb.mjs.map} +1 -1
- package/dist/{search-D-Yhpmvs.mjs → search-CeO678cp.mjs} +6 -6
- package/dist/{search-D-Yhpmvs.mjs.map → search-CeO678cp.mjs.map} +1 -1
- package/dist/{secrets-CQ-69kF9.mjs → secrets-870d-7yA.mjs} +1 -1
- package/dist/{secrets-CQ-69kF9.mjs.map → secrets-870d-7yA.mjs.map} +1 -1
- package/dist/{sections-CzVBAKjw.mjs → sections-DSuEfirn.mjs} +3 -3
- package/dist/{sections-CzVBAKjw.mjs.map → sections-DSuEfirn.mjs.map} +1 -1
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +18 -16
- package/dist/seo/index.d.mts +3 -3
- package/dist/seo/index.mjs +14 -12
- package/dist/seo/index.mjs.map +1 -1
- package/dist/{seo-kJzVAmmu.mjs → seo-BAPKiED8.mjs} +2 -2
- package/dist/{seo-kJzVAmmu.mjs.map → seo-BAPKiED8.mjs.map} +1 -1
- package/dist/{service-CQnc276a.mjs → service-DyFT-k-R.mjs} +3 -3
- package/dist/{service-CQnc276a.mjs.map → service-DyFT-k-R.mjs.map} +1 -1
- package/dist/{session-user-DbHqKDKe.mjs → session-user-BrK2zz7S.mjs} +1 -1
- package/dist/{session-user-DbHqKDKe.mjs.map → session-user-BrK2zz7S.mjs.map} +1 -1
- package/dist/{settings-Dtc0DU31.mjs → settings-CREKyj8I.mjs} +3 -3
- package/dist/{settings-Dtc0DU31.mjs.map → settings-CREKyj8I.mjs.map} +1 -1
- package/dist/{settings-C2PaBS49.mjs → settings-DgKouY2S.mjs} +3 -3
- package/dist/{settings-C2PaBS49.mjs.map → settings-DgKouY2S.mjs.map} +1 -1
- package/dist/{setup-complete-CdIlqloh.mjs → setup-complete-L7bMK2VI.mjs} +1 -1
- package/dist/{setup-complete-CdIlqloh.mjs.map → setup-complete-L7bMK2VI.mjs.map} +1 -1
- package/dist/{setup-nonce-DqiIPr-J.mjs → setup-nonce-Ct5tjWcq.mjs} +1 -1
- package/dist/{setup-nonce-DqiIPr-J.mjs.map → setup-nonce-Ct5tjWcq.mjs.map} +1 -1
- package/dist/{site-url-NGJT6NTU.mjs → site-url-8N3kSyVZ.mjs} +1 -1
- package/dist/{site-url-NGJT6NTU.mjs.map → site-url-8N3kSyVZ.mjs.map} +1 -1
- package/dist/storage/local.d.mts +1 -1
- package/dist/storage/s3.d.mts +1 -1
- package/dist/storage/s3.mjs +1 -1
- package/dist/storage/s3.mjs.map +1 -1
- package/dist/{taxonomies-r7pqLBCn.mjs → taxonomies-B61CRSha.mjs} +48 -22
- package/dist/taxonomies-B61CRSha.mjs.map +1 -0
- package/dist/{taxonomies-BN6M9Nrv.mjs → taxonomies-Dbdki3Un.mjs} +9 -8
- package/dist/taxonomies-Dbdki3Un.mjs.map +1 -0
- package/dist/{taxonomy-0mCI25HN.mjs → taxonomy-DvwWAPvA.mjs} +3 -3
- package/dist/{taxonomy-0mCI25HN.mjs.map → taxonomy-DvwWAPvA.mjs.map} +1 -1
- package/dist/{transport-CKrlqSpD.mjs → transport-BWQo0Foy.mjs} +1 -1
- package/dist/{transport-CKrlqSpD.mjs.map → transport-BWQo0Foy.mjs.map} +1 -1
- package/dist/{transport-Vd7VdqHv.d.mts → transport-DokJOScS.d.mts} +1 -1
- package/dist/{transport-Vd7VdqHv.d.mts.map → transport-DokJOScS.d.mts.map} +1 -1
- package/dist/{types-DPKhI5ib.d.mts → types-84Bque3-.d.mts} +9 -1
- package/dist/types-84Bque3-.d.mts.map +1 -0
- package/dist/{types-BvB7gDOD.d.mts → types-BQY7VYw6.d.mts} +2 -2
- package/dist/{types-BvB7gDOD.d.mts.map → types-BQY7VYw6.d.mts.map} +1 -1
- package/dist/{types-B4vm81VH.d.mts → types-C9P3ysxq.d.mts} +1 -1
- package/dist/{types-B4vm81VH.d.mts.map → types-C9P3ysxq.d.mts.map} +1 -1
- package/dist/{types-B97jg3aW.d.mts → types-CcSZCcF1.d.mts} +1 -1
- package/dist/{types-B97jg3aW.d.mts.map → types-CcSZCcF1.d.mts.map} +1 -1
- package/dist/{types-BNfPHfay.d.mts → types-DQLZ58GV.d.mts} +1 -1
- package/dist/{types-BNfPHfay.d.mts.map → types-DQLZ58GV.d.mts.map} +1 -1
- package/dist/{types-BfYUPJdP.d.mts → types-DqZVPILm.d.mts} +2 -2
- package/dist/{types-BfYUPJdP.d.mts.map → types-DqZVPILm.d.mts.map} +1 -1
- package/dist/{types-C7U0HlEr.d.mts → types-Dr2GLlwu.d.mts} +1 -1
- package/dist/{types-C7U0HlEr.d.mts.map → types-Dr2GLlwu.d.mts.map} +1 -1
- package/dist/{types-iVeZ5g6N.d.mts → types-DsAMyD_o.d.mts} +1 -1
- package/dist/{types-iVeZ5g6N.d.mts.map → types-DsAMyD_o.d.mts.map} +1 -1
- package/dist/{types-CrRUFdej.mjs → types-XrQQ-Aex.mjs} +2 -2
- package/dist/{types-CrRUFdej.mjs.map → types-XrQQ-Aex.mjs.map} +1 -1
- package/dist/{types-Kmaxdarz.d.mts → types-jISEalTX.d.mts} +1 -1
- package/dist/{types-Kmaxdarz.d.mts.map → types-jISEalTX.d.mts.map} +1 -1
- package/dist/upload-attempts-C5yd6Gae.mjs +27 -0
- package/dist/upload-attempts-C5yd6Gae.mjs.map +1 -0
- package/dist/{user-aTXqmXBz.mjs → user-BAumEmpA.mjs} +3 -3
- package/dist/{user-aTXqmXBz.mjs.map → user-BAumEmpA.mjs.map} +1 -1
- package/dist/{validate-CDT1jl6_.mjs → validate-Bs_wT2ul.mjs} +3 -3
- package/dist/{validate-CDT1jl6_.mjs.map → validate-Bs_wT2ul.mjs.map} +1 -1
- package/dist/{validate-DULfgpJP.d.mts → validate-CdYcY-Ln.d.mts} +5 -5
- package/dist/{validate-DULfgpJP.d.mts.map → validate-CdYcY-Ln.d.mts.map} +1 -1
- package/dist/{validation-DlD0E35W.mjs → validation-BngR0nit.mjs} +10 -8
- package/dist/{validation-DlD0E35W.mjs.map → validation-BngR0nit.mjs.map} +1 -1
- package/dist/version-Bdfb34kk.mjs +7 -0
- package/dist/{version-BRMngh9I.mjs.map → version-Bdfb34kk.mjs.map} +1 -1
- package/dist/{widgets-5fipNkMT.mjs → widgets-L-VndTKD.mjs} +2 -2
- package/dist/{widgets-5fipNkMT.mjs.map → widgets-L-VndTKD.mjs.map} +1 -1
- package/dist/{wxr-taxonomies-DrihupaC.mjs → wxr-taxonomies-BexjtNid.mjs} +4 -4
- package/dist/{wxr-taxonomies-DrihupaC.mjs.map → wxr-taxonomies-BexjtNid.mjs.map} +1 -1
- package/dist/{wxr-taxonomies-B4tMuN5T.d.mts → wxr-taxonomies-DueaLFd9.d.mts} +1 -1
- package/dist/{wxr-taxonomies-B4tMuN5T.d.mts.map → wxr-taxonomies-DueaLFd9.d.mts.map} +1 -1
- package/dist/{zod-generator-CwkHWz4f.mjs → zod-generator-DMzfga3g.mjs} +3 -3
- package/dist/{zod-generator-CwkHWz4f.mjs.map → zod-generator-DMzfga3g.mjs.map} +1 -1
- package/package.json +6 -5
- package/src/api/handlers/media.ts +4 -4
- package/src/api/handlers/taxonomies.ts +10 -9
- package/src/api/openapi/document.ts +36 -3
- package/src/api/schemas/media.ts +9 -2
- package/src/api/schemas/taxonomies.ts +16 -1
- package/src/astro/integration/routes.ts +5 -0
- package/src/astro/routes/api/content/[collection]/[id].ts +3 -1
- package/src/astro/routes/api/media/[id]/confirm.ts +148 -59
- package/src/astro/routes/api/media/[id]/upload.ts +262 -0
- package/src/astro/routes/api/media/[id].ts +19 -10
- package/src/astro/routes/api/media/upload-url.ts +28 -31
- package/src/astro/routes/api/taxonomies/[name]/terms/index.ts +6 -3
- package/src/astro/types.ts +1 -0
- package/src/cleanup.ts +24 -1
- package/src/components/InlinePortableTextEditor.tsx +4 -0
- package/src/components/code-mark.ts +11 -0
- package/src/database/dialect-helpers.ts +38 -0
- package/src/database/migrations/054_media_upload_attempts.ts +41 -0
- package/src/database/migrations/runner.ts +2 -0
- package/src/database/repositories/content.ts +2 -5
- package/src/database/repositories/media.ts +158 -28
- package/src/database/types.ts +10 -0
- package/src/emdash-runtime.ts +13 -0
- package/src/i18n/config.ts +17 -10
- package/src/index.ts +1 -0
- package/src/media/upload-attempts.ts +33 -0
- package/src/query.ts +29 -2
- package/src/storage/s3.ts +1 -1
- package/src/taxonomies/term-counts.ts +54 -24
- package/src/utils/hash.ts +14 -3
- package/dist/api-BkqFzIu4.mjs.map +0 -1
- package/dist/config-B6b_BobR.mjs.map +0 -1
- package/dist/content-BC43pICM.mjs.map +0 -1
- package/dist/dialect-helpers-BtOwo2us.mjs.map +0 -1
- package/dist/hash-DFFrkivP.mjs.map +0 -1
- package/dist/index-BZJ_5FOX.d.mts.map +0 -1
- package/dist/media-its1WLYv.mjs.map +0 -1
- package/dist/query-Bz9bWZfm.mjs.map +0 -1
- package/dist/redirects-D457qwt0.mjs.map +0 -1
- package/dist/relations-qKmSj9KM.d.mts.map +0 -1
- package/dist/runner-BdeLEgad.mjs.map +0 -1
- package/dist/taxonomies-BN6M9Nrv.mjs.map +0 -1
- package/dist/taxonomies-r7pqLBCn.mjs.map +0 -1
- package/dist/types-DPKhI5ib.d.mts.map +0 -1
- package/dist/version-BRMngh9I.mjs +0 -7
- /package/dist/{api-tokens-Cvmixds7.mjs → api-tokens-CEsW_jCg.mjs} +0 -0
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import "../../../../dialect-helpers-
|
|
1
|
+
import "../../../../dialect-helpers-DFwyWjTM.mjs";
|
|
2
|
+
import "../../../../config-DyF3OKg_.mjs";
|
|
2
3
|
import "../../../../base64-B-PsqheR.mjs";
|
|
3
|
-
import "../../../../types-
|
|
4
|
-
import { t as FTSManager } from "../../../../fts-manager-
|
|
5
|
-
import "../../../../loader-
|
|
6
|
-
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-
|
|
7
|
-
import { n as parseBody, t as isParseError } from "../../../../parse-
|
|
8
|
-
import "../../../../media-
|
|
9
|
-
import { O as searchEnableBody } from "../../../../redirects-
|
|
10
|
-
import "../../../../relations-
|
|
4
|
+
import "../../../../types-XrQQ-Aex.mjs";
|
|
5
|
+
import { t as FTSManager } from "../../../../fts-manager-vncsZIJm.mjs";
|
|
6
|
+
import "../../../../loader-C1XOLV5b.mjs";
|
|
7
|
+
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-DmmN74gW.mjs";
|
|
8
|
+
import { n as parseBody, t as isParseError } from "../../../../parse-BL49yb9D.mjs";
|
|
9
|
+
import "../../../../media-DWIzoVFL.mjs";
|
|
10
|
+
import { O as searchEnableBody } from "../../../../redirects-BOn2DIUs.mjs";
|
|
11
|
+
import "../../../../relations-C4duJnwI.mjs";
|
|
11
12
|
import "../../../../status-COfycGIU.mjs";
|
|
12
13
|
import "../../../../api/schemas/index.mjs";
|
|
13
|
-
import "../../../../search-
|
|
14
|
-
import { r as requirePerm } from "../../../../authorize-
|
|
14
|
+
import "../../../../search-CeO678cp.mjs";
|
|
15
|
+
import { r as requirePerm } from "../../../../authorize-R5iYYrpa.mjs";
|
|
15
16
|
|
|
16
17
|
//#region src/astro/routes/api/search/enable.ts
|
|
17
18
|
const prerender = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enable.mjs","names":[],"sources":["../../../../../src/astro/routes/api/search/enable.ts"],"sourcesContent":["/**\n * Search enable/disable endpoint\n *\n * POST /_emdash/api/search/enable\n */\n\nimport type { APIRoute } from \"astro\";\n\nimport { requirePerm } from \"#api/authorize.js\";\nimport { apiError, apiSuccess, handleError } from \"#api/error.js\";\nimport { isParseError, parseBody } from \"#api/parse.js\";\nimport { searchEnableBody } from \"#api/schemas.js\";\nimport { FTSManager } from \"#search/index.js\";\n\nexport const prerender = false;\n\n/**\n * Enable or disable search for a collection\n *\n * Body:\n * - collection: Collection slug (required)\n * - enabled: boolean (required)\n * - weights: Optional field weights for ranking\n */\nexport const POST: APIRoute = async ({ request, locals }) => {\n\tconst { emdash, user } = locals;\n\n\tif (!emdash?.db) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash not configured\", 500);\n\t}\n\n\tconst denied = requirePerm(user, \"search:manage\");\n\tif (denied) return denied;\n\n\tconst body = await parseBody(request, searchEnableBody);\n\tif (isParseError(body)) return body;\n\n\tconst ftsManager = new FTSManager(emdash.db);\n\n\ttry {\n\t\tif (body.enabled) {\n\t\t\t// Enable search - creates FTS table, triggers, and populates index\n\t\t\tawait ftsManager.enableSearch(body.collection, { weights: body.weights });\n\n\t\t\tconst stats = await ftsManager.getIndexStats(body.collection);\n\n\t\t\treturn apiSuccess({\n\t\t\t\tcollection: body.collection,\n\t\t\t\tenabled: true,\n\t\t\t\tindexed: stats?.indexed ?? 0,\n\t\t\t});\n\t\t} else {\n\t\t\t// Disable search - drops FTS table and triggers\n\t\t\tawait ftsManager.disableSearch(body.collection);\n\n\t\t\treturn apiSuccess({\n\t\t\t\tcollection: body.collection,\n\t\t\t\tenabled: false,\n\t\t\t});\n\t\t}\n\t} catch (error) {\n\t\treturn handleError(error, \"Failed to update search config\", \"SEARCH_ERROR\");\n\t}\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"enable.mjs","names":[],"sources":["../../../../../src/astro/routes/api/search/enable.ts"],"sourcesContent":["/**\n * Search enable/disable endpoint\n *\n * POST /_emdash/api/search/enable\n */\n\nimport type { APIRoute } from \"astro\";\n\nimport { requirePerm } from \"#api/authorize.js\";\nimport { apiError, apiSuccess, handleError } from \"#api/error.js\";\nimport { isParseError, parseBody } from \"#api/parse.js\";\nimport { searchEnableBody } from \"#api/schemas.js\";\nimport { FTSManager } from \"#search/index.js\";\n\nexport const prerender = false;\n\n/**\n * Enable or disable search for a collection\n *\n * Body:\n * - collection: Collection slug (required)\n * - enabled: boolean (required)\n * - weights: Optional field weights for ranking\n */\nexport const POST: APIRoute = async ({ request, locals }) => {\n\tconst { emdash, user } = locals;\n\n\tif (!emdash?.db) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash not configured\", 500);\n\t}\n\n\tconst denied = requirePerm(user, \"search:manage\");\n\tif (denied) return denied;\n\n\tconst body = await parseBody(request, searchEnableBody);\n\tif (isParseError(body)) return body;\n\n\tconst ftsManager = new FTSManager(emdash.db);\n\n\ttry {\n\t\tif (body.enabled) {\n\t\t\t// Enable search - creates FTS table, triggers, and populates index\n\t\t\tawait ftsManager.enableSearch(body.collection, { weights: body.weights });\n\n\t\t\tconst stats = await ftsManager.getIndexStats(body.collection);\n\n\t\t\treturn apiSuccess({\n\t\t\t\tcollection: body.collection,\n\t\t\t\tenabled: true,\n\t\t\t\tindexed: stats?.indexed ?? 0,\n\t\t\t});\n\t\t} else {\n\t\t\t// Disable search - drops FTS table and triggers\n\t\t\tawait ftsManager.disableSearch(body.collection);\n\n\t\t\treturn apiSuccess({\n\t\t\t\tcollection: body.collection,\n\t\t\t\tenabled: false,\n\t\t\t});\n\t\t}\n\t} catch (error) {\n\t\treturn handleError(error, \"Failed to update search config\", \"SEARCH_ERROR\");\n\t}\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAcA,MAAa,YAAY;;;;;;;;;AAUzB,MAAa,OAAiB,OAAO,EAAE,SAAS,aAAa;CAC5D,MAAM,EAAE,QAAQ,SAAS;AAEzB,KAAI,CAAC,QAAQ,GACZ,QAAO,SAAS,kBAAkB,yBAAyB,IAAI;CAGhE,MAAM,SAAS,YAAY,MAAM,gBAAgB;AACjD,KAAI,OAAQ,QAAO;CAEnB,MAAM,OAAO,MAAM,UAAU,SAAS,iBAAiB;AACvD,KAAI,aAAa,KAAK,CAAE,QAAO;CAE/B,MAAM,aAAa,IAAI,WAAW,OAAO,GAAG;AAE5C,KAAI;AACH,MAAI,KAAK,SAAS;AAEjB,SAAM,WAAW,aAAa,KAAK,YAAY,EAAE,SAAS,KAAK,SAAS,CAAC;GAEzE,MAAM,QAAQ,MAAM,WAAW,cAAc,KAAK,WAAW;AAE7D,UAAO,WAAW;IACjB,YAAY,KAAK;IACjB,SAAS;IACT,SAAS,OAAO,WAAW;IAC3B,CAAC;SACI;AAEN,SAAM,WAAW,cAAc,KAAK,WAAW;AAE/C,UAAO,WAAW;IACjB,YAAY,KAAK;IACjB,SAAS;IACT,CAAC;;UAEK,OAAO;AACf,SAAO,YAAY,OAAO,kCAAkC,eAAe"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import "../../../../dialect-helpers-
|
|
1
|
+
import "../../../../dialect-helpers-DFwyWjTM.mjs";
|
|
2
|
+
import "../../../../config-DyF3OKg_.mjs";
|
|
2
3
|
import "../../../../base64-B-PsqheR.mjs";
|
|
3
|
-
import "../../../../types-
|
|
4
|
-
import "../../../../fts-manager-
|
|
5
|
-
import "../../../../loader-
|
|
6
|
-
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-
|
|
7
|
-
import { i as parseQuery, t as isParseError } from "../../../../parse-
|
|
8
|
-
import "../../../../media-
|
|
9
|
-
import { k as searchQuery } from "../../../../redirects-
|
|
10
|
-
import "../../../../relations-
|
|
4
|
+
import "../../../../types-XrQQ-Aex.mjs";
|
|
5
|
+
import "../../../../fts-manager-vncsZIJm.mjs";
|
|
6
|
+
import "../../../../loader-C1XOLV5b.mjs";
|
|
7
|
+
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-DmmN74gW.mjs";
|
|
8
|
+
import { i as parseQuery, t as isParseError } from "../../../../parse-BL49yb9D.mjs";
|
|
9
|
+
import "../../../../media-DWIzoVFL.mjs";
|
|
10
|
+
import { k as searchQuery } from "../../../../redirects-BOn2DIUs.mjs";
|
|
11
|
+
import "../../../../relations-C4duJnwI.mjs";
|
|
11
12
|
import "../../../../status-COfycGIU.mjs";
|
|
12
13
|
import "../../../../api/schemas/index.mjs";
|
|
13
|
-
import { c as searchWithDb } from "../../../../search-
|
|
14
|
+
import { c as searchWithDb } from "../../../../search-CeO678cp.mjs";
|
|
14
15
|
import { hasPermission } from "@emdash-cms/auth";
|
|
15
16
|
|
|
16
17
|
//#region src/astro/routes/api/search/index.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../src/astro/routes/api/search/index.ts"],"sourcesContent":["/**\n * Search endpoint - Full-text search across collections\n *\n * GET /_emdash/api/search?q=query&collections=posts,pages&limit=20\n */\n\nimport { hasPermission } from \"@emdash-cms/auth\";\nimport type { APIRoute } from \"astro\";\n\nimport { apiError, apiSuccess, handleError } from \"#api/error.js\";\nimport { isParseError, parseQuery } from \"#api/parse.js\";\nimport { searchQuery } from \"#api/schemas.js\";\nimport { searchWithDb } from \"#search/index.js\";\n\nexport const prerender = false;\n\n/**\n * Search content\n *\n * Query parameters:\n * - q: Search query (required)\n * - collections: Comma-separated list of collection slugs (optional, defaults to all)\n * - status: Filter by status (optional, defaults to 'published')\n * - limit: Maximum results (optional, defaults to 20)\n */\nexport const GET: APIRoute = async ({ url, locals }) => {\n\tconst { emdash, user } = locals;\n\n\tif (!emdash?.db) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash not configured\", 500);\n\t}\n\n\tconst query = parseQuery(url, searchQuery);\n\tif (isParseError(query)) return query;\n\n\tconst collections = query.collections\n\t\t? query.collections.split(\",\").map((c: string) => c.trim())\n\t\t: undefined;\n\n\t// Only users with content:read_drafts may search non-published statuses.\n\t// Anonymous and subscriber requests are forced to \"published\".\n\tconst status =\n\t\tquery.status && query.status !== \"published\" && hasPermission(user, \"content:read_drafts\")\n\t\t\t? query.status\n\t\t\t: \"published\";\n\n\ttry {\n\t\t// Verify FTS indexes are healthy on first use. At most once per worker\n\t\t// lifetime; no-op after that. Moved off the cold-start hot path to\n\t\t// keep anonymous public reads fast.\n\t\tawait emdash.ensureSearchHealthy?.();\n\n\t\tconst result = await searchWithDb(emdash.db, query.q, {\n\t\t\tcollections,\n\t\t\tstatus,\n\t\t\tlocale: query.locale,\n\t\t\tlimit: query.limit,\n\t\t\tcursor: query.cursor,\n\t\t});\n\n\t\treturn apiSuccess(result);\n\t} catch (error) {\n\t\t// handleError maps a malformed pagination cursor to a 400 INVALID_CURSOR.\n\t\treturn handleError(error, \"Search failed\", \"SEARCH_ERROR\");\n\t}\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../src/astro/routes/api/search/index.ts"],"sourcesContent":["/**\n * Search endpoint - Full-text search across collections\n *\n * GET /_emdash/api/search?q=query&collections=posts,pages&limit=20\n */\n\nimport { hasPermission } from \"@emdash-cms/auth\";\nimport type { APIRoute } from \"astro\";\n\nimport { apiError, apiSuccess, handleError } from \"#api/error.js\";\nimport { isParseError, parseQuery } from \"#api/parse.js\";\nimport { searchQuery } from \"#api/schemas.js\";\nimport { searchWithDb } from \"#search/index.js\";\n\nexport const prerender = false;\n\n/**\n * Search content\n *\n * Query parameters:\n * - q: Search query (required)\n * - collections: Comma-separated list of collection slugs (optional, defaults to all)\n * - status: Filter by status (optional, defaults to 'published')\n * - limit: Maximum results (optional, defaults to 20)\n */\nexport const GET: APIRoute = async ({ url, locals }) => {\n\tconst { emdash, user } = locals;\n\n\tif (!emdash?.db) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash not configured\", 500);\n\t}\n\n\tconst query = parseQuery(url, searchQuery);\n\tif (isParseError(query)) return query;\n\n\tconst collections = query.collections\n\t\t? query.collections.split(\",\").map((c: string) => c.trim())\n\t\t: undefined;\n\n\t// Only users with content:read_drafts may search non-published statuses.\n\t// Anonymous and subscriber requests are forced to \"published\".\n\tconst status =\n\t\tquery.status && query.status !== \"published\" && hasPermission(user, \"content:read_drafts\")\n\t\t\t? query.status\n\t\t\t: \"published\";\n\n\ttry {\n\t\t// Verify FTS indexes are healthy on first use. At most once per worker\n\t\t// lifetime; no-op after that. Moved off the cold-start hot path to\n\t\t// keep anonymous public reads fast.\n\t\tawait emdash.ensureSearchHealthy?.();\n\n\t\tconst result = await searchWithDb(emdash.db, query.q, {\n\t\t\tcollections,\n\t\t\tstatus,\n\t\t\tlocale: query.locale,\n\t\t\tlimit: query.limit,\n\t\t\tcursor: query.cursor,\n\t\t});\n\n\t\treturn apiSuccess(result);\n\t} catch (error) {\n\t\t// handleError maps a malformed pagination cursor to a 400 INVALID_CURSOR.\n\t\treturn handleError(error, \"Search failed\", \"SEARCH_ERROR\");\n\t}\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAcA,MAAa,YAAY;;;;;;;;;;AAWzB,MAAa,MAAgB,OAAO,EAAE,KAAK,aAAa;CACvD,MAAM,EAAE,QAAQ,SAAS;AAEzB,KAAI,CAAC,QAAQ,GACZ,QAAO,SAAS,kBAAkB,yBAAyB,IAAI;CAGhE,MAAM,QAAQ,WAAW,KAAK,YAAY;AAC1C,KAAI,aAAa,MAAM,CAAE,QAAO;CAEhC,MAAM,cAAc,MAAM,cACvB,MAAM,YAAY,MAAM,IAAI,CAAC,KAAK,MAAc,EAAE,MAAM,CAAC,GACzD;CAIH,MAAM,SACL,MAAM,UAAU,MAAM,WAAW,eAAe,cAAc,MAAM,sBAAsB,GACvF,MAAM,SACN;AAEJ,KAAI;AAIH,QAAM,OAAO,uBAAuB;AAUpC,SAAO,WARQ,MAAM,aAAa,OAAO,IAAI,MAAM,GAAG;GACrD;GACA;GACA,QAAQ,MAAM;GACd,OAAO,MAAM;GACb,QAAQ,MAAM;GACd,CAAC,CAEuB;UACjB,OAAO;AAEf,SAAO,YAAY,OAAO,iBAAiB,eAAe"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import "../../../../dialect-helpers-
|
|
1
|
+
import "../../../../dialect-helpers-DFwyWjTM.mjs";
|
|
2
|
+
import "../../../../config-DyF3OKg_.mjs";
|
|
2
3
|
import "../../../../base64-B-PsqheR.mjs";
|
|
3
|
-
import "../../../../types-
|
|
4
|
-
import { t as FTSManager } from "../../../../fts-manager-
|
|
5
|
-
import "../../../../loader-
|
|
6
|
-
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-
|
|
7
|
-
import { n as parseBody, t as isParseError } from "../../../../parse-
|
|
8
|
-
import "../../../../media-
|
|
9
|
-
import { A as searchRebuildBody } from "../../../../redirects-
|
|
10
|
-
import "../../../../relations-
|
|
4
|
+
import "../../../../types-XrQQ-Aex.mjs";
|
|
5
|
+
import { t as FTSManager } from "../../../../fts-manager-vncsZIJm.mjs";
|
|
6
|
+
import "../../../../loader-C1XOLV5b.mjs";
|
|
7
|
+
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-DmmN74gW.mjs";
|
|
8
|
+
import { n as parseBody, t as isParseError } from "../../../../parse-BL49yb9D.mjs";
|
|
9
|
+
import "../../../../media-DWIzoVFL.mjs";
|
|
10
|
+
import { A as searchRebuildBody } from "../../../../redirects-BOn2DIUs.mjs";
|
|
11
|
+
import "../../../../relations-C4duJnwI.mjs";
|
|
11
12
|
import "../../../../status-COfycGIU.mjs";
|
|
12
13
|
import "../../../../api/schemas/index.mjs";
|
|
13
|
-
import "../../../../search-
|
|
14
|
-
import { r as requirePerm } from "../../../../authorize-
|
|
14
|
+
import "../../../../search-CeO678cp.mjs";
|
|
15
|
+
import { r as requirePerm } from "../../../../authorize-R5iYYrpa.mjs";
|
|
15
16
|
|
|
16
17
|
//#region src/astro/routes/api/search/rebuild.ts
|
|
17
18
|
const prerender = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rebuild.mjs","names":[],"sources":["../../../../../src/astro/routes/api/search/rebuild.ts"],"sourcesContent":["/**\n * Search rebuild endpoint - Rebuild FTS index\n *\n * POST /_emdash/api/search/rebuild\n */\n\nimport type { APIRoute } from \"astro\";\n\nimport { requirePerm } from \"#api/authorize.js\";\nimport { apiError, apiSuccess, handleError } from \"#api/error.js\";\nimport { isParseError, parseBody } from \"#api/parse.js\";\nimport { searchRebuildBody } from \"#api/schemas.js\";\nimport { FTSManager } from \"#search/index.js\";\n\nexport const prerender = false;\n\n/**\n * Rebuild the search index for a collection\n *\n * Body:\n * - collection: Collection slug to rebuild (required)\n */\nexport const POST: APIRoute = async ({ request, locals }) => {\n\tconst { emdash, user } = locals;\n\n\tif (!emdash?.db) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash not configured\", 500);\n\t}\n\n\tconst denied = requirePerm(user, \"search:manage\");\n\tif (denied) return denied;\n\n\tconst body = await parseBody(request, searchRebuildBody);\n\tif (isParseError(body)) return body;\n\n\tconst ftsManager = new FTSManager(emdash.db);\n\n\ttry {\n\t\t// Get search config for the collection\n\t\tconst config = await ftsManager.getSearchConfig(body.collection);\n\t\tif (!config?.enabled) {\n\t\t\treturn apiError(\n\t\t\t\t\"SEARCH_NOT_ENABLED\",\n\t\t\t\t`Search is not enabled for collection \"${body.collection}\"`,\n\t\t\t\t400,\n\t\t\t);\n\t\t}\n\n\t\t// Get searchable fields\n\t\tconst searchableFields = await ftsManager.getSearchableFields(body.collection);\n\t\tif (searchableFields.length === 0) {\n\t\t\treturn apiError(\n\t\t\t\t\"NO_SEARCHABLE_FIELDS\",\n\t\t\t\t`No searchable fields defined for collection \"${body.collection}\"`,\n\t\t\t\t400,\n\t\t\t);\n\t\t}\n\n\t\t// Rebuild the index\n\t\tawait ftsManager.rebuildIndex(body.collection, searchableFields, config.weights);\n\n\t\t// Get stats after rebuild\n\t\tconst stats = await ftsManager.getIndexStats(body.collection);\n\n\t\treturn apiSuccess({\n\t\t\tcollection: body.collection,\n\t\t\tindexed: stats?.indexed ?? 0,\n\t\t});\n\t} catch (error) {\n\t\treturn handleError(error, \"Failed to rebuild index\", \"REBUILD_ERROR\");\n\t}\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"rebuild.mjs","names":[],"sources":["../../../../../src/astro/routes/api/search/rebuild.ts"],"sourcesContent":["/**\n * Search rebuild endpoint - Rebuild FTS index\n *\n * POST /_emdash/api/search/rebuild\n */\n\nimport type { APIRoute } from \"astro\";\n\nimport { requirePerm } from \"#api/authorize.js\";\nimport { apiError, apiSuccess, handleError } from \"#api/error.js\";\nimport { isParseError, parseBody } from \"#api/parse.js\";\nimport { searchRebuildBody } from \"#api/schemas.js\";\nimport { FTSManager } from \"#search/index.js\";\n\nexport const prerender = false;\n\n/**\n * Rebuild the search index for a collection\n *\n * Body:\n * - collection: Collection slug to rebuild (required)\n */\nexport const POST: APIRoute = async ({ request, locals }) => {\n\tconst { emdash, user } = locals;\n\n\tif (!emdash?.db) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash not configured\", 500);\n\t}\n\n\tconst denied = requirePerm(user, \"search:manage\");\n\tif (denied) return denied;\n\n\tconst body = await parseBody(request, searchRebuildBody);\n\tif (isParseError(body)) return body;\n\n\tconst ftsManager = new FTSManager(emdash.db);\n\n\ttry {\n\t\t// Get search config for the collection\n\t\tconst config = await ftsManager.getSearchConfig(body.collection);\n\t\tif (!config?.enabled) {\n\t\t\treturn apiError(\n\t\t\t\t\"SEARCH_NOT_ENABLED\",\n\t\t\t\t`Search is not enabled for collection \"${body.collection}\"`,\n\t\t\t\t400,\n\t\t\t);\n\t\t}\n\n\t\t// Get searchable fields\n\t\tconst searchableFields = await ftsManager.getSearchableFields(body.collection);\n\t\tif (searchableFields.length === 0) {\n\t\t\treturn apiError(\n\t\t\t\t\"NO_SEARCHABLE_FIELDS\",\n\t\t\t\t`No searchable fields defined for collection \"${body.collection}\"`,\n\t\t\t\t400,\n\t\t\t);\n\t\t}\n\n\t\t// Rebuild the index\n\t\tawait ftsManager.rebuildIndex(body.collection, searchableFields, config.weights);\n\n\t\t// Get stats after rebuild\n\t\tconst stats = await ftsManager.getIndexStats(body.collection);\n\n\t\treturn apiSuccess({\n\t\t\tcollection: body.collection,\n\t\t\tindexed: stats?.indexed ?? 0,\n\t\t});\n\t} catch (error) {\n\t\treturn handleError(error, \"Failed to rebuild index\", \"REBUILD_ERROR\");\n\t}\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAcA,MAAa,YAAY;;;;;;;AAQzB,MAAa,OAAiB,OAAO,EAAE,SAAS,aAAa;CAC5D,MAAM,EAAE,QAAQ,SAAS;AAEzB,KAAI,CAAC,QAAQ,GACZ,QAAO,SAAS,kBAAkB,yBAAyB,IAAI;CAGhE,MAAM,SAAS,YAAY,MAAM,gBAAgB;AACjD,KAAI,OAAQ,QAAO;CAEnB,MAAM,OAAO,MAAM,UAAU,SAAS,kBAAkB;AACxD,KAAI,aAAa,KAAK,CAAE,QAAO;CAE/B,MAAM,aAAa,IAAI,WAAW,OAAO,GAAG;AAE5C,KAAI;EAEH,MAAM,SAAS,MAAM,WAAW,gBAAgB,KAAK,WAAW;AAChE,MAAI,CAAC,QAAQ,QACZ,QAAO,SACN,sBACA,yCAAyC,KAAK,WAAW,IACzD,IACA;EAIF,MAAM,mBAAmB,MAAM,WAAW,oBAAoB,KAAK,WAAW;AAC9E,MAAI,iBAAiB,WAAW,EAC/B,QAAO,SACN,wBACA,gDAAgD,KAAK,WAAW,IAChE,IACA;AAIF,QAAM,WAAW,aAAa,KAAK,YAAY,kBAAkB,OAAO,QAAQ;EAGhF,MAAM,QAAQ,MAAM,WAAW,cAAc,KAAK,WAAW;AAE7D,SAAO,WAAW;GACjB,YAAY,KAAK;GACjB,SAAS,OAAO,WAAW;GAC3B,CAAC;UACM,OAAO;AACf,SAAO,YAAY,OAAO,2BAA2B,gBAAgB"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import "../../../../dialect-helpers-
|
|
1
|
+
import "../../../../dialect-helpers-DFwyWjTM.mjs";
|
|
2
|
+
import "../../../../config-DyF3OKg_.mjs";
|
|
2
3
|
import "../../../../base64-B-PsqheR.mjs";
|
|
3
|
-
import "../../../../types-
|
|
4
|
-
import "../../../../fts-manager-
|
|
5
|
-
import "../../../../loader-
|
|
6
|
-
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-
|
|
7
|
-
import { i as getSearchStats } from "../../../../search-
|
|
8
|
-
import { r as requirePerm } from "../../../../authorize-
|
|
4
|
+
import "../../../../types-XrQQ-Aex.mjs";
|
|
5
|
+
import "../../../../fts-manager-vncsZIJm.mjs";
|
|
6
|
+
import "../../../../loader-C1XOLV5b.mjs";
|
|
7
|
+
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-DmmN74gW.mjs";
|
|
8
|
+
import { i as getSearchStats } from "../../../../search-CeO678cp.mjs";
|
|
9
|
+
import { r as requirePerm } from "../../../../authorize-R5iYYrpa.mjs";
|
|
9
10
|
|
|
10
11
|
//#region src/astro/routes/api/search/stats.ts
|
|
11
12
|
const prerender = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.mjs","names":[],"sources":["../../../../../src/astro/routes/api/search/stats.ts"],"sourcesContent":["/**\n * Search stats endpoint\n *\n * GET /_emdash/api/search/stats\n */\n\nimport type { APIRoute } from \"astro\";\n\nimport { requirePerm } from \"#api/authorize.js\";\nimport { apiError, apiSuccess, handleError } from \"#api/error.js\";\nimport { getSearchStats } from \"#search/index.js\";\n\nexport const prerender = false;\n\n/**\n * Get search index statistics\n */\nexport const GET: APIRoute = async ({ locals }) => {\n\tconst { emdash, user } = locals;\n\n\tconst denied = requirePerm(user, \"search:manage\");\n\tif (denied) return denied;\n\n\tif (!emdash?.db) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash not configured\", 500);\n\t}\n\n\ttry {\n\t\tconst stats = await getSearchStats(emdash.db);\n\n\t\treturn apiSuccess(stats);\n\t} catch (error) {\n\t\treturn handleError(error, \"Failed to get stats\", \"STATS_ERROR\");\n\t}\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"stats.mjs","names":[],"sources":["../../../../../src/astro/routes/api/search/stats.ts"],"sourcesContent":["/**\n * Search stats endpoint\n *\n * GET /_emdash/api/search/stats\n */\n\nimport type { APIRoute } from \"astro\";\n\nimport { requirePerm } from \"#api/authorize.js\";\nimport { apiError, apiSuccess, handleError } from \"#api/error.js\";\nimport { getSearchStats } from \"#search/index.js\";\n\nexport const prerender = false;\n\n/**\n * Get search index statistics\n */\nexport const GET: APIRoute = async ({ locals }) => {\n\tconst { emdash, user } = locals;\n\n\tconst denied = requirePerm(user, \"search:manage\");\n\tif (denied) return denied;\n\n\tif (!emdash?.db) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash not configured\", 500);\n\t}\n\n\ttry {\n\t\tconst stats = await getSearchStats(emdash.db);\n\n\t\treturn apiSuccess(stats);\n\t} catch (error) {\n\t\treturn handleError(error, \"Failed to get stats\", \"STATS_ERROR\");\n\t}\n};\n"],"mappings":";;;;;;;;;;;AAYA,MAAa,YAAY;;;;AAKzB,MAAa,MAAgB,OAAO,EAAE,aAAa;CAClD,MAAM,EAAE,QAAQ,SAAS;CAEzB,MAAM,SAAS,YAAY,MAAM,gBAAgB;AACjD,KAAI,OAAQ,QAAO;AAEnB,KAAI,CAAC,QAAQ,GACZ,QAAO,SAAS,kBAAkB,yBAAyB,IAAI;AAGhE,KAAI;AAGH,SAAO,WAFO,MAAM,eAAe,OAAO,GAAG,CAErB;UAChB,OAAO;AACf,SAAO,YAAY,OAAO,uBAAuB,cAAc"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import "../../../../dialect-helpers-
|
|
1
|
+
import "../../../../dialect-helpers-DFwyWjTM.mjs";
|
|
2
|
+
import "../../../../config-DyF3OKg_.mjs";
|
|
2
3
|
import "../../../../base64-B-PsqheR.mjs";
|
|
3
|
-
import "../../../../types-
|
|
4
|
-
import "../../../../fts-manager-
|
|
5
|
-
import "../../../../loader-
|
|
6
|
-
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-
|
|
7
|
-
import { i as parseQuery, t as isParseError } from "../../../../parse-
|
|
8
|
-
import "../../../../media-
|
|
9
|
-
import { N as searchSuggestQuery } from "../../../../redirects-
|
|
10
|
-
import "../../../../relations-
|
|
4
|
+
import "../../../../types-XrQQ-Aex.mjs";
|
|
5
|
+
import "../../../../fts-manager-vncsZIJm.mjs";
|
|
6
|
+
import "../../../../loader-C1XOLV5b.mjs";
|
|
7
|
+
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-DmmN74gW.mjs";
|
|
8
|
+
import { i as parseQuery, t as isParseError } from "../../../../parse-BL49yb9D.mjs";
|
|
9
|
+
import "../../../../media-DWIzoVFL.mjs";
|
|
10
|
+
import { N as searchSuggestQuery } from "../../../../redirects-BOn2DIUs.mjs";
|
|
11
|
+
import "../../../../relations-C4duJnwI.mjs";
|
|
11
12
|
import "../../../../status-COfycGIU.mjs";
|
|
12
13
|
import "../../../../api/schemas/index.mjs";
|
|
13
|
-
import { a as getSuggestions } from "../../../../search-
|
|
14
|
+
import { a as getSuggestions } from "../../../../search-CeO678cp.mjs";
|
|
14
15
|
|
|
15
16
|
//#region src/astro/routes/api/search/suggest.ts
|
|
16
17
|
const prerender = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggest.mjs","names":[],"sources":["../../../../../src/astro/routes/api/search/suggest.ts"],"sourcesContent":["/**\n * Search suggestions endpoint - Autocomplete\n *\n * GET /_emdash/api/search/suggest?q=hel&limit=5\n */\n\nimport type { APIRoute } from \"astro\";\n\nimport { apiError, apiSuccess, handleError } from \"#api/error.js\";\nimport { isParseError, parseQuery } from \"#api/parse.js\";\nimport { searchSuggestQuery } from \"#api/schemas.js\";\nimport { getSuggestions } from \"#search/index.js\";\n\nexport const prerender = false;\n\n/**\n * Get search suggestions for autocomplete\n *\n * Query parameters:\n * - q: Partial search query (required)\n * - collections: Comma-separated list of collection slugs (optional)\n * - limit: Maximum suggestions (optional, defaults to 5)\n */\nexport const GET: APIRoute = async ({ url, locals }) => {\n\tconst { emdash } = locals;\n\n\tif (!emdash?.db) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash not configured\", 500);\n\t}\n\n\tconst query = parseQuery(url, searchSuggestQuery);\n\tif (isParseError(query)) return query;\n\n\tconst collections = query.collections\n\t\t? query.collections.split(\",\").map((c: string) => c.trim())\n\t\t: undefined;\n\n\ttry {\n\t\t// Verify FTS indexes are healthy on first use. See search/index.ts.\n\t\tawait emdash.ensureSearchHealthy?.();\n\n\t\tconst suggestions = await getSuggestions(emdash.db, query.q, {\n\t\t\tcollections,\n\t\t\tlocale: query.locale,\n\t\t\tlimit: query.limit,\n\t\t});\n\n\t\treturn apiSuccess({ items: suggestions });\n\t} catch (error) {\n\t\treturn handleError(error, \"Failed to get suggestions\", \"SUGGESTION_ERROR\");\n\t}\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"suggest.mjs","names":[],"sources":["../../../../../src/astro/routes/api/search/suggest.ts"],"sourcesContent":["/**\n * Search suggestions endpoint - Autocomplete\n *\n * GET /_emdash/api/search/suggest?q=hel&limit=5\n */\n\nimport type { APIRoute } from \"astro\";\n\nimport { apiError, apiSuccess, handleError } from \"#api/error.js\";\nimport { isParseError, parseQuery } from \"#api/parse.js\";\nimport { searchSuggestQuery } from \"#api/schemas.js\";\nimport { getSuggestions } from \"#search/index.js\";\n\nexport const prerender = false;\n\n/**\n * Get search suggestions for autocomplete\n *\n * Query parameters:\n * - q: Partial search query (required)\n * - collections: Comma-separated list of collection slugs (optional)\n * - limit: Maximum suggestions (optional, defaults to 5)\n */\nexport const GET: APIRoute = async ({ url, locals }) => {\n\tconst { emdash } = locals;\n\n\tif (!emdash?.db) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash not configured\", 500);\n\t}\n\n\tconst query = parseQuery(url, searchSuggestQuery);\n\tif (isParseError(query)) return query;\n\n\tconst collections = query.collections\n\t\t? query.collections.split(\",\").map((c: string) => c.trim())\n\t\t: undefined;\n\n\ttry {\n\t\t// Verify FTS indexes are healthy on first use. See search/index.ts.\n\t\tawait emdash.ensureSearchHealthy?.();\n\n\t\tconst suggestions = await getSuggestions(emdash.db, query.q, {\n\t\t\tcollections,\n\t\t\tlocale: query.locale,\n\t\t\tlimit: query.limit,\n\t\t});\n\n\t\treturn apiSuccess({ items: suggestions });\n\t} catch (error) {\n\t\treturn handleError(error, \"Failed to get suggestions\", \"SUGGESTION_ERROR\");\n\t}\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAaA,MAAa,YAAY;;;;;;;;;AAUzB,MAAa,MAAgB,OAAO,EAAE,KAAK,aAAa;CACvD,MAAM,EAAE,WAAW;AAEnB,KAAI,CAAC,QAAQ,GACZ,QAAO,SAAS,kBAAkB,yBAAyB,IAAI;CAGhE,MAAM,QAAQ,WAAW,KAAK,mBAAmB;AACjD,KAAI,aAAa,MAAM,CAAE,QAAO;CAEhC,MAAM,cAAc,MAAM,cACvB,MAAM,YAAY,MAAM,IAAI,CAAC,KAAK,MAAc,EAAE,MAAM,CAAC,GACzD;AAEH,KAAI;AAEH,QAAM,OAAO,uBAAuB;AAQpC,SAAO,WAAW,EAAE,OANA,MAAM,eAAe,OAAO,IAAI,MAAM,GAAG;GAC5D;GACA,QAAQ,MAAM;GACd,OAAO,MAAM;GACb,CAAC,EAEsC,CAAC;UACjC,OAAO;AACf,SAAO,YAAY,OAAO,6BAA6B,mBAAmB"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import "../../../../dialect-helpers-
|
|
1
|
+
import "../../../../dialect-helpers-DFwyWjTM.mjs";
|
|
2
2
|
import "../../../../base64-B-PsqheR.mjs";
|
|
3
|
-
import "../../../../types-
|
|
4
|
-
import "../../../../loader-
|
|
5
|
-
import { a as handleSectionUpdate, n as handleSectionDelete, r as handleSectionGet } from "../../../../sections-
|
|
6
|
-
import { a as unwrapResult, i as requireDb, r as handleError, t as apiError } from "../../../../error-
|
|
7
|
-
import { n as parseBody, t as isParseError } from "../../../../parse-
|
|
8
|
-
import "../../../../media-
|
|
9
|
-
import { B as updateSectionBody } from "../../../../redirects-
|
|
10
|
-
import "../../../../relations-
|
|
3
|
+
import "../../../../types-XrQQ-Aex.mjs";
|
|
4
|
+
import "../../../../loader-C1XOLV5b.mjs";
|
|
5
|
+
import { a as handleSectionUpdate, n as handleSectionDelete, r as handleSectionGet } from "../../../../sections-DSuEfirn.mjs";
|
|
6
|
+
import { a as unwrapResult, i as requireDb, r as handleError, t as apiError } from "../../../../error-DmmN74gW.mjs";
|
|
7
|
+
import { n as parseBody, t as isParseError } from "../../../../parse-BL49yb9D.mjs";
|
|
8
|
+
import "../../../../media-DWIzoVFL.mjs";
|
|
9
|
+
import { B as updateSectionBody } from "../../../../redirects-BOn2DIUs.mjs";
|
|
10
|
+
import "../../../../relations-C4duJnwI.mjs";
|
|
11
11
|
import "../../../../status-COfycGIU.mjs";
|
|
12
12
|
import "../../../../api/schemas/index.mjs";
|
|
13
|
-
import { r as requirePerm } from "../../../../authorize-
|
|
13
|
+
import { r as requirePerm } from "../../../../authorize-R5iYYrpa.mjs";
|
|
14
14
|
|
|
15
15
|
//#region src/astro/routes/api/sections/[slug].ts
|
|
16
16
|
const prerender = false;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import "../../../../dialect-helpers-
|
|
1
|
+
import "../../../../dialect-helpers-DFwyWjTM.mjs";
|
|
2
2
|
import "../../../../base64-B-PsqheR.mjs";
|
|
3
|
-
import "../../../../types-
|
|
4
|
-
import "../../../../loader-
|
|
5
|
-
import { i as handleSectionList, t as handleSectionCreate } from "../../../../sections-
|
|
6
|
-
import { a as unwrapResult, i as requireDb, r as handleError } from "../../../../error-
|
|
7
|
-
import { i as parseQuery, n as parseBody, t as isParseError } from "../../../../parse-
|
|
8
|
-
import "../../../../media-
|
|
9
|
-
import { I as createSectionBody, z as sectionsListQuery } from "../../../../redirects-
|
|
10
|
-
import "../../../../relations-
|
|
3
|
+
import "../../../../types-XrQQ-Aex.mjs";
|
|
4
|
+
import "../../../../loader-C1XOLV5b.mjs";
|
|
5
|
+
import { i as handleSectionList, t as handleSectionCreate } from "../../../../sections-DSuEfirn.mjs";
|
|
6
|
+
import { a as unwrapResult, i as requireDb, r as handleError } from "../../../../error-DmmN74gW.mjs";
|
|
7
|
+
import { i as parseQuery, n as parseBody, t as isParseError } from "../../../../parse-BL49yb9D.mjs";
|
|
8
|
+
import "../../../../media-DWIzoVFL.mjs";
|
|
9
|
+
import { I as createSectionBody, z as sectionsListQuery } from "../../../../redirects-BOn2DIUs.mjs";
|
|
10
|
+
import "../../../../relations-C4duJnwI.mjs";
|
|
11
11
|
import "../../../../status-COfycGIU.mjs";
|
|
12
12
|
import "../../../../api/schemas/index.mjs";
|
|
13
|
-
import { r as requirePerm } from "../../../../authorize-
|
|
13
|
+
import { r as requirePerm } from "../../../../authorize-R5iYYrpa.mjs";
|
|
14
14
|
|
|
15
15
|
//#region src/astro/routes/api/sections/index.ts
|
|
16
16
|
const prerender = false;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "../../../../../../base64-B-PsqheR.mjs";
|
|
2
|
-
import "../../../../../../types-
|
|
2
|
+
import "../../../../../../types-XrQQ-Aex.mjs";
|
|
3
3
|
import "../../../../../../options-BlmBHTvX.mjs";
|
|
4
4
|
import { t as ErrorCode } from "../../../../../../errors-DtEXIQQV.mjs";
|
|
5
|
-
import { a as unwrapResult, r as handleError, t as apiError } from "../../../../../../error-
|
|
5
|
+
import { a as unwrapResult, r as handleError, t as apiError } from "../../../../../../error-DmmN74gW.mjs";
|
|
6
6
|
import "../../../../../../snapshot-BdpUJKD-.mjs";
|
|
7
|
-
import { a as deleteBackupArchive, c as isValidArchiveName, r as BACKUP_STORAGE_PREFIX } from "../../../../../../backup-
|
|
8
|
-
import { r as requirePerm } from "../../../../../../authorize-
|
|
7
|
+
import { a as deleteBackupArchive, c as isValidArchiveName, r as BACKUP_STORAGE_PREFIX } from "../../../../../../backup-LpQ1V_sR.mjs";
|
|
8
|
+
import { r as requirePerm } from "../../../../../../authorize-R5iYYrpa.mjs";
|
|
9
9
|
|
|
10
10
|
//#region src/astro/routes/api/settings/backups/archives/[name].ts
|
|
11
11
|
const prerender = false;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "../../../../../../base64-B-PsqheR.mjs";
|
|
2
|
-
import "../../../../../../types-
|
|
2
|
+
import "../../../../../../types-XrQQ-Aex.mjs";
|
|
3
3
|
import "../../../../../../options-BlmBHTvX.mjs";
|
|
4
|
-
import { a as unwrapResult, t as apiError } from "../../../../../../error-
|
|
4
|
+
import { a as unwrapResult, t as apiError } from "../../../../../../error-DmmN74gW.mjs";
|
|
5
5
|
import "../../../../../../snapshot-BdpUJKD-.mjs";
|
|
6
|
-
import { d as runBackupToStorage, s as getBackupSettings } from "../../../../../../backup-
|
|
7
|
-
import { r as requirePerm } from "../../../../../../authorize-
|
|
6
|
+
import { d as runBackupToStorage, s as getBackupSettings } from "../../../../../../backup-LpQ1V_sR.mjs";
|
|
7
|
+
import { r as requirePerm } from "../../../../../../authorize-R5iYYrpa.mjs";
|
|
8
8
|
|
|
9
9
|
//#region src/astro/routes/api/settings/backups/archives/index.ts
|
|
10
10
|
const prerender = false;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "../../../../../base64-B-PsqheR.mjs";
|
|
2
|
-
import "../../../../../types-
|
|
2
|
+
import "../../../../../types-XrQQ-Aex.mjs";
|
|
3
3
|
import "../../../../../options-BlmBHTvX.mjs";
|
|
4
4
|
import { t as ErrorCode } from "../../../../../errors-DtEXIQQV.mjs";
|
|
5
|
-
import { r as handleError, t as apiError } from "../../../../../error-
|
|
5
|
+
import { r as handleError, t as apiError } from "../../../../../error-DmmN74gW.mjs";
|
|
6
6
|
import "../../../../../snapshot-BdpUJKD-.mjs";
|
|
7
|
-
import { i as archiveNameForDate, o as generateBackupJson } from "../../../../../backup-
|
|
8
|
-
import { r as requirePerm } from "../../../../../authorize-
|
|
7
|
+
import { i as archiveNameForDate, o as generateBackupJson } from "../../../../../backup-LpQ1V_sR.mjs";
|
|
8
|
+
import { r as requirePerm } from "../../../../../authorize-R5iYYrpa.mjs";
|
|
9
9
|
|
|
10
10
|
//#region src/astro/routes/api/settings/backups/export.ts
|
|
11
11
|
const prerender = false;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "../../../../../base64-B-PsqheR.mjs";
|
|
2
|
-
import "../../../../../types-
|
|
2
|
+
import "../../../../../types-XrQQ-Aex.mjs";
|
|
3
3
|
import "../../../../../options-BlmBHTvX.mjs";
|
|
4
4
|
import { t as ErrorCode } from "../../../../../errors-DtEXIQQV.mjs";
|
|
5
|
-
import { a as unwrapResult, n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-
|
|
6
|
-
import { n as parseBody, t as isParseError } from "../../../../../parse-
|
|
5
|
+
import { a as unwrapResult, n as apiSuccess, r as handleError, t as apiError } from "../../../../../error-DmmN74gW.mjs";
|
|
6
|
+
import { n as parseBody, t as isParseError } from "../../../../../parse-BL49yb9D.mjs";
|
|
7
7
|
import "../../../../../snapshot-BdpUJKD-.mjs";
|
|
8
|
-
import { f as updateBackupSettings, l as listBackupArchives, n as BACKUP_RETENTION_MIN, s as getBackupSettings, t as BACKUP_RETENTION_MAX } from "../../../../../backup-
|
|
9
|
-
import { r as requirePerm } from "../../../../../authorize-
|
|
8
|
+
import { f as updateBackupSettings, l as listBackupArchives, n as BACKUP_RETENTION_MIN, s as getBackupSettings, t as BACKUP_RETENTION_MAX } from "../../../../../backup-LpQ1V_sR.mjs";
|
|
9
|
+
import { r as requirePerm } from "../../../../../authorize-R5iYYrpa.mjs";
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
|
|
12
12
|
//#region src/astro/routes/api/settings/backups/index.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "../../../../base64-B-PsqheR.mjs";
|
|
2
|
-
import "../../../../types-
|
|
2
|
+
import "../../../../types-XrQQ-Aex.mjs";
|
|
3
3
|
import { t as OptionsRepository } from "../../../../options-BlmBHTvX.mjs";
|
|
4
|
-
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-
|
|
5
|
-
import { n as parseBody, t as isParseError } from "../../../../parse-
|
|
6
|
-
import { r as requirePerm } from "../../../../authorize-
|
|
4
|
+
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-DmmN74gW.mjs";
|
|
5
|
+
import { n as parseBody, t as isParseError } from "../../../../parse-BL49yb9D.mjs";
|
|
6
|
+
import { r as requirePerm } from "../../../../authorize-R5iYYrpa.mjs";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { escapeHtml } from "@emdash-cms/auth";
|
|
9
9
|
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import "../../../dialect-helpers-
|
|
1
|
+
import "../../../dialect-helpers-DFwyWjTM.mjs";
|
|
2
2
|
import "../../../after-B1IIdH3Y.mjs";
|
|
3
3
|
import "../../../object-cache-Bok5j2ae.mjs";
|
|
4
4
|
import "../../../base64-B-PsqheR.mjs";
|
|
5
|
-
import "../../../types-
|
|
6
|
-
import "../../../media-
|
|
5
|
+
import "../../../types-XrQQ-Aex.mjs";
|
|
6
|
+
import "../../../media-tQDZEdu7.mjs";
|
|
7
7
|
import "../../../options-BlmBHTvX.mjs";
|
|
8
8
|
import "../../../request-cache-BSUptuJR.mjs";
|
|
9
|
-
import "../../../loader-
|
|
10
|
-
import "../../../settings-
|
|
11
|
-
import { n as handleSettingsUpdate, t as handleSettingsGet } from "../../../settings-
|
|
12
|
-
import { a as unwrapResult, r as handleError, t as apiError } from "../../../error-
|
|
13
|
-
import { n as parseBody, t as isParseError } from "../../../parse-
|
|
14
|
-
import "../../../media-
|
|
15
|
-
import { P as settingsUpdateBody } from "../../../redirects-
|
|
16
|
-
import "../../../relations-
|
|
9
|
+
import "../../../loader-C1XOLV5b.mjs";
|
|
10
|
+
import "../../../settings-DgKouY2S.mjs";
|
|
11
|
+
import { n as handleSettingsUpdate, t as handleSettingsGet } from "../../../settings-CREKyj8I.mjs";
|
|
12
|
+
import { a as unwrapResult, r as handleError, t as apiError } from "../../../error-DmmN74gW.mjs";
|
|
13
|
+
import { n as parseBody, t as isParseError } from "../../../parse-BL49yb9D.mjs";
|
|
14
|
+
import "../../../media-DWIzoVFL.mjs";
|
|
15
|
+
import { P as settingsUpdateBody } from "../../../redirects-BOn2DIUs.mjs";
|
|
16
|
+
import "../../../relations-C4duJnwI.mjs";
|
|
17
17
|
import "../../../status-COfycGIU.mjs";
|
|
18
18
|
import "../../../api/schemas/index.mjs";
|
|
19
|
-
import { r as requirePerm } from "../../../authorize-
|
|
19
|
+
import { r as requirePerm } from "../../../authorize-R5iYYrpa.mjs";
|
|
20
20
|
|
|
21
21
|
//#region src/astro/routes/api/settings.ts
|
|
22
22
|
const prerender = false;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import "../../../../base64-B-PsqheR.mjs";
|
|
2
|
-
import "../../../../types-
|
|
2
|
+
import "../../../../types-XrQQ-Aex.mjs";
|
|
3
3
|
import { t as OptionsRepository } from "../../../../options-BlmBHTvX.mjs";
|
|
4
|
-
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-
|
|
5
|
-
import { n as parseBody, t as isParseError } from "../../../../parse-
|
|
6
|
-
import "../../../../media-
|
|
7
|
-
import "../../../../redirects-
|
|
8
|
-
import { y as setupAdminVerifyBody } from "../../../../relations-
|
|
4
|
+
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-DmmN74gW.mjs";
|
|
5
|
+
import { n as parseBody, t as isParseError } from "../../../../parse-BL49yb9D.mjs";
|
|
6
|
+
import "../../../../media-DWIzoVFL.mjs";
|
|
7
|
+
import "../../../../redirects-BOn2DIUs.mjs";
|
|
8
|
+
import { y as setupAdminVerifyBody } from "../../../../relations-C4duJnwI.mjs";
|
|
9
9
|
import "../../../../status-COfycGIU.mjs";
|
|
10
10
|
import "../../../../api/schemas/index.mjs";
|
|
11
11
|
import { n as getPublicOrigin } from "../../../../public-url-DSGTnJFw.mjs";
|
|
12
12
|
import { n as validateAllowedOrigins, t as getConfiguredAllowedOrigins } from "../../../../allowed-origins-CCEi9bPI.mjs";
|
|
13
13
|
import { n as createChallengeStore } from "../../../../challenge-store-BFzgFRog.mjs";
|
|
14
|
-
import { t as getPasskeyConfig } from "../../../../passkey-config-
|
|
15
|
-
import { t as SETUP_NONCE_COOKIE } from "../../../../setup-nonce-
|
|
14
|
+
import { t as getPasskeyConfig } from "../../../../passkey-config-KMhgFjdQ.mjs";
|
|
15
|
+
import { t as SETUP_NONCE_COOKIE } from "../../../../setup-nonce-Ct5tjWcq.mjs";
|
|
16
16
|
import { Role, secureCompare } from "@emdash-cms/auth";
|
|
17
17
|
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
|
18
18
|
import { registerPasskey, verifyRegistrationResponse } from "@emdash-cms/auth/passkey";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import "../../../../base64-B-PsqheR.mjs";
|
|
2
|
-
import "../../../../types-
|
|
2
|
+
import "../../../../types-XrQQ-Aex.mjs";
|
|
3
3
|
import { t as OptionsRepository } from "../../../../options-BlmBHTvX.mjs";
|
|
4
|
-
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-
|
|
5
|
-
import { n as parseBody, t as isParseError } from "../../../../parse-
|
|
6
|
-
import "../../../../media-
|
|
7
|
-
import "../../../../redirects-
|
|
8
|
-
import { v as setupAdminBody } from "../../../../relations-
|
|
4
|
+
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-DmmN74gW.mjs";
|
|
5
|
+
import { n as parseBody, t as isParseError } from "../../../../parse-BL49yb9D.mjs";
|
|
6
|
+
import "../../../../media-DWIzoVFL.mjs";
|
|
7
|
+
import "../../../../redirects-BOn2DIUs.mjs";
|
|
8
|
+
import { v as setupAdminBody } from "../../../../relations-C4duJnwI.mjs";
|
|
9
9
|
import "../../../../status-COfycGIU.mjs";
|
|
10
10
|
import "../../../../api/schemas/index.mjs";
|
|
11
11
|
import { n as getPublicOrigin } from "../../../../public-url-DSGTnJFw.mjs";
|
|
12
12
|
import { n as createChallengeStore } from "../../../../challenge-store-BFzgFRog.mjs";
|
|
13
|
-
import { t as getPasskeyConfig } from "../../../../passkey-config-
|
|
14
|
-
import { n as SETUP_NONCE_MAX_AGE_SECONDS, t as SETUP_NONCE_COOKIE } from "../../../../setup-nonce-
|
|
13
|
+
import { t as getPasskeyConfig } from "../../../../passkey-config-KMhgFjdQ.mjs";
|
|
14
|
+
import { n as SETUP_NONCE_MAX_AGE_SECONDS, t as SETUP_NONCE_COOKIE } from "../../../../setup-nonce-Ct5tjWcq.mjs";
|
|
15
15
|
import { generateToken } from "@emdash-cms/auth";
|
|
16
16
|
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
|
17
17
|
import { generateRegistrationOptions } from "@emdash-cms/auth/passkey";
|
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
import { a as runMigrations } from "../../../../runner-
|
|
2
|
-
import "../../../../dialect-helpers-
|
|
1
|
+
import { a as runMigrations } from "../../../../runner-BsI18UgP.mjs";
|
|
2
|
+
import "../../../../dialect-helpers-DFwyWjTM.mjs";
|
|
3
|
+
import "../../../../config-DyF3OKg_.mjs";
|
|
3
4
|
import "../../../../after-B1IIdH3Y.mjs";
|
|
4
5
|
import "../../../../object-cache-Bok5j2ae.mjs";
|
|
5
|
-
import "../../../../content-
|
|
6
|
+
import "../../../../content-CpfKV9QE.mjs";
|
|
6
7
|
import "../../../../base64-B-PsqheR.mjs";
|
|
7
|
-
import "../../../../types-
|
|
8
|
-
import "../../../../media-
|
|
9
|
-
import "../../../../taxonomy-
|
|
8
|
+
import "../../../../types-XrQQ-Aex.mjs";
|
|
9
|
+
import "../../../../media-tQDZEdu7.mjs";
|
|
10
|
+
import "../../../../taxonomy-DvwWAPvA.mjs";
|
|
10
11
|
import { t as OptionsRepository } from "../../../../options-BlmBHTvX.mjs";
|
|
11
|
-
import "../../../../redirect-
|
|
12
|
+
import "../../../../redirect-BJ6d1yHh.mjs";
|
|
12
13
|
import "../../../../request-cache-BSUptuJR.mjs";
|
|
13
14
|
import "../../../../byline-registry-BCuOp4UF.mjs";
|
|
14
|
-
import "../../../../field-defs-cache-
|
|
15
|
-
import "../../../../byline-
|
|
16
|
-
import "../../../../fts-manager-
|
|
17
|
-
import "../../../../loader-
|
|
18
|
-
import "../../../../
|
|
19
|
-
import "../../../../
|
|
20
|
-
import "../../../../
|
|
15
|
+
import "../../../../field-defs-cache-QMVnzTH6.mjs";
|
|
16
|
+
import "../../../../byline-C5TAqs8N.mjs";
|
|
17
|
+
import "../../../../fts-manager-vncsZIJm.mjs";
|
|
18
|
+
import "../../../../loader-C1XOLV5b.mjs";
|
|
19
|
+
import "../../../../hash-Cb7U1b5M.mjs";
|
|
20
|
+
import "../../../../content-refresh-DgqUBeTv.mjs";
|
|
21
|
+
import "../../../../registry-BP1JK2xh.mjs";
|
|
22
|
+
import "../../../../settings-DgKouY2S.mjs";
|
|
21
23
|
import "../../../../ssrf-CviKqWmq.mjs";
|
|
22
|
-
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-
|
|
24
|
+
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-DmmN74gW.mjs";
|
|
23
25
|
import "../../../../ssrf-BB__xfNM.mjs";
|
|
24
|
-
import { t as validateSeed } from "../../../../validate-
|
|
25
|
-
import { t as applySeed } from "../../../../apply-
|
|
26
|
-
import { t as loadSeed } from "../../../../load-
|
|
26
|
+
import { t as validateSeed } from "../../../../validate-Bs_wT2ul.mjs";
|
|
27
|
+
import { t as applySeed } from "../../../../apply-1_6ra7NP.mjs";
|
|
28
|
+
import { t as loadSeed } from "../../../../load-BwTdWE8B.mjs";
|
|
27
29
|
import { n as getPublicOrigin } from "../../../../public-url-DSGTnJFw.mjs";
|
|
28
|
-
import "../../../../api-tokens-
|
|
29
|
-
import { n as handleApiTokenCreate, t as deleteApiTokensByName } from "../../../../api-tokens-
|
|
30
|
-
import { t as escapeHtml } from "../../../../escape-
|
|
31
|
-
import { t as isSafeRedirect } from "../../../../redirect-
|
|
30
|
+
import "../../../../api-tokens-CEsW_jCg.mjs";
|
|
31
|
+
import { n as handleApiTokenCreate, t as deleteApiTokensByName } from "../../../../api-tokens-p-iMzvXR.mjs";
|
|
32
|
+
import { t as escapeHtml } from "../../../../escape-CdW31WsG.mjs";
|
|
33
|
+
import { t as isSafeRedirect } from "../../../../redirect-CDgfv9vh.mjs";
|
|
32
34
|
import { ulid } from "ulidx";
|
|
33
35
|
|
|
34
36
|
//#region src/astro/routes/api/setup/dev-bypass.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-bypass.mjs","names":[],"sources":["../../../../../src/astro/routes/api/setup/dev-bypass.ts"],"sourcesContent":["/**\n * POST /_emdash/api/setup/dev-bypass\n * GET /_emdash/api/setup/dev-bypass\n *\n * Development-only endpoint to bypass the setup wizard.\n * Runs migrations, creates a dev admin user, and marks setup complete.\n *\n * ONLY available when import.meta.env.DEV is true.\n *\n * Usage:\n * - GET with redirect: /_emdash/api/setup/dev-bypass?redirect=/_emdash/admin\n * - POST for API: Returns JSON with setup info\n * - ?content=0 (or ?content=false): apply schema/structure only, skipping\n * sample content entries, bylines, and taxonomy terms\n *\n * For agent/browser testing, navigate to:\n * /_emdash/api/setup/dev-bypass?redirect=/_emdash/admin\n */\n\nimport type { APIRoute } from \"astro\";\n\nexport const prerender = false;\n\nimport { ulid } from \"ulidx\";\n\nimport { apiError, apiSuccess, handleError } from \"#api/error.js\";\nimport { escapeHtml } from \"#api/escape.js\";\nimport { deleteApiTokensByName, handleApiTokenCreate } from \"#api/handlers/api-tokens.js\";\nimport { getPublicOrigin } from \"#api/public-url.js\";\nimport { isSafeRedirect } from \"#api/redirect.js\";\nimport { runMigrations } from \"#db/migrations/runner.js\";\nimport { OptionsRepository } from \"#db/repositories/options.js\";\nimport { applySeed } from \"#seed/apply.js\";\nimport { loadSeed } from \"#seed/load.js\";\nimport { validateSeed } from \"#seed/validate.js\";\n\n// RBAC role levels (matching @emdash-cms/auth)\nconst ROLE_ADMIN = 50;\n\nconst DEV_USER_EMAIL = \"dev@emdash.local\";\nconst DEV_USER_NAME = \"Dev Admin\";\nconst DEV_SITE_TITLE = \"EmDash Dev Site\";\n\nasync function handleDevBypass(context: Parameters<APIRoute>[0]): Promise<Response> {\n\t// CRITICAL: Only allow in development mode\n\tif (!import.meta.env.DEV) {\n\t\treturn apiError(\"FORBIDDEN\", \"Dev bypass is only available in development mode\", 403);\n\t}\n\n\tconst { locals, url, session } = context;\n\tconst { emdash } = locals;\n\n\tif (!emdash?.db) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash is not initialized\", 500);\n\t}\n\n\ttry {\n\t\t// Run migrations\n\t\tconst migrations = await runMigrations(emdash.db);\n\t\tconsole.log(\"[setup-dev-bypass] Migrations applied:\", migrations.applied);\n\n\t\t// Apply seed (user seed or built-in default). `?content=0` (or `false`)\n\t\t// applies schema/structure only — no sample content, bylines, or terms.\n\t\tconst contentParam = url.searchParams.get(\"content\");\n\t\tconst includeContent = contentParam !== \"0\" && contentParam !== \"false\";\n\t\tconst seed = await loadSeed();\n\t\tconst validation = validateSeed(seed);\n\t\tif (validation.valid) {\n\t\t\tconst seedResult = await applySeed(emdash.db, seed, {\n\t\t\t\tincludeContent,\n\t\t\t\tonConflict: \"skip\",\n\t\t\t\tstorage: emdash.storage ?? undefined,\n\t\t\t});\n\t\t\tconsole.log(\n\t\t\t\t`[setup-dev-bypass] Seed applied: ${seedResult.collections.created} collections, ${seedResult.fields.created} fields`,\n\t\t\t);\n\t\t}\n\n\t\tconst options = new OptionsRepository(emdash.db);\n\n\t\t// Find or create dev user (direct DB access to avoid @emdash-cms/auth import issues in dev)\n\t\tconst existingUser = await emdash.db\n\t\t\t.selectFrom(\"users\")\n\t\t\t.selectAll()\n\t\t\t.where(\"email\", \"=\", DEV_USER_EMAIL)\n\t\t\t.executeTakeFirst();\n\n\t\tlet user: { id: string; email: string; name: string; role: number };\n\t\tlet userCreated = false;\n\n\t\tif (!existingUser) {\n\t\t\tconst now = new Date().toISOString();\n\t\t\tconst newUser = {\n\t\t\t\tid: ulid(),\n\t\t\t\temail: DEV_USER_EMAIL,\n\t\t\t\tname: DEV_USER_NAME,\n\t\t\t\trole: ROLE_ADMIN,\n\t\t\t\temail_verified: 1,\n\t\t\t\tcreated_at: now,\n\t\t\t\tupdated_at: now,\n\t\t\t};\n\n\t\t\tawait emdash.db.insertInto(\"users\").values(newUser).execute();\n\n\t\t\tuser = {\n\t\t\t\tid: newUser.id,\n\t\t\t\temail: newUser.email,\n\t\t\t\tname: newUser.name,\n\t\t\t\trole: newUser.role,\n\t\t\t};\n\t\t\tuserCreated = true;\n\t\t\tconsole.log(\"[setup-dev-bypass] Created dev admin user:\", user.email);\n\t\t} else {\n\t\t\tuser = {\n\t\t\t\tid: existingUser.id,\n\t\t\t\temail: existingUser.email,\n\t\t\t\tname: existingUser.name || DEV_USER_NAME,\n\t\t\t\trole: existingUser.role,\n\t\t\t};\n\t\t}\n\n\t\t// Set site title if not already set\n\t\tconst existingTitle = await options.get(\"emdash:site_title\");\n\t\tif (!existingTitle) {\n\t\t\tawait options.set(\"emdash:site_title\", DEV_SITE_TITLE);\n\t\t}\n\n\t\t// Store canonical site URL (used by magic-link/recovery emails)\n\t\tawait options.set(\"emdash:site_url\", getPublicOrigin(url, emdash?.config));\n\n\t\t// Mark setup complete\n\t\tawait options.set(\"emdash:setup_complete\", true);\n\n\t\t// Create session\n\t\tif (session) {\n\t\t\tsession.set(\"user\", { id: user.id });\n\t\t}\n\n\t\t// Optionally create a PAT token (?token=1) for headless/CLI testing.\n\t\tlet token: string | undefined;\n\t\tif (url.searchParams.has(\"token\")) {\n\t\t\t// Idempotent by name: a prior reset can leave a stale dev-bypass-token,\n\t\t\t// and the raw token is only available at creation, so drop any existing\n\t\t\t// one and mint a fresh, usable PAT rather than accumulating duplicates.\n\t\t\tawait deleteApiTokensByName(emdash.db, user.id, \"dev-bypass-token\");\n\t\t\tconst result = await handleApiTokenCreate(emdash.db, user.id, {\n\t\t\t\tname: \"dev-bypass-token\",\n\t\t\t\tscopes: [\n\t\t\t\t\t\"content:read\",\n\t\t\t\t\t\"content:write\",\n\t\t\t\t\t\"media:read\",\n\t\t\t\t\t\"media:write\",\n\t\t\t\t\t\"schema:read\",\n\t\t\t\t\t\"schema:write\",\n\t\t\t\t\t\"admin\",\n\t\t\t\t],\n\t\t\t});\n\t\t\tif (result.success) {\n\t\t\t\ttoken = result.data.token;\n\t\t\t}\n\t\t}\n\n\t\t// Check for redirect parameter\n\t\tconst redirect = url.searchParams.get(\"redirect\");\n\n\t\tif (redirect) {\n\t\t\t// Validate redirect is a safe local path (prevent open redirect via //evil.com or /\\evil.com)\n\t\t\tif (!isSafeRedirect(redirect)) {\n\t\t\t\treturn apiError(\"INVALID_REDIRECT\", \"Redirect must be a local path\", 400);\n\t\t\t}\n\n\t\t\t// Return an HTML page with meta-refresh redirect\n\t\t\t// This ensures the session is fully saved before redirect\n\t\t\tconst safeRedirect = escapeHtml(redirect);\n\t\t\tconst html = `<!DOCTYPE html>\n<html>\n<head>\n\t<meta http-equiv=\"refresh\" content=\"0;url=${safeRedirect}\">\n</head>\n<body>Redirecting...</body>\n</html>`;\n\t\t\treturn new Response(html, {\n\t\t\t\tstatus: 200,\n\t\t\t\theaders: { \"Content-Type\": \"text/html\" },\n\t\t\t});\n\t\t}\n\n\t\t// Return JSON response\n\t\treturn apiSuccess({\n\t\t\tsuccess: true,\n\t\t\tmessage: \"Dev setup complete\",\n\t\t\tmigrations: migrations.applied,\n\t\t\tuserCreated,\n\t\t\tuser: {\n\t\t\t\tid: user.id,\n\t\t\t\temail: user.email,\n\t\t\t\tname: user.name,\n\t\t\t\trole: user.role,\n\t\t\t},\n\t\t\t...(token ? { token } : {}),\n\t\t});\n\t} catch (error) {\n\t\treturn handleError(error, \"Dev bypass failed\", \"DEV_BYPASS_ERROR\");\n\t}\n}\n\n// Support both GET and POST\nexport const GET: APIRoute = handleDevBypass;\nexport const POST: APIRoute = handleDevBypass;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev-bypass.mjs","names":[],"sources":["../../../../../src/astro/routes/api/setup/dev-bypass.ts"],"sourcesContent":["/**\n * POST /_emdash/api/setup/dev-bypass\n * GET /_emdash/api/setup/dev-bypass\n *\n * Development-only endpoint to bypass the setup wizard.\n * Runs migrations, creates a dev admin user, and marks setup complete.\n *\n * ONLY available when import.meta.env.DEV is true.\n *\n * Usage:\n * - GET with redirect: /_emdash/api/setup/dev-bypass?redirect=/_emdash/admin\n * - POST for API: Returns JSON with setup info\n * - ?content=0 (or ?content=false): apply schema/structure only, skipping\n * sample content entries, bylines, and taxonomy terms\n *\n * For agent/browser testing, navigate to:\n * /_emdash/api/setup/dev-bypass?redirect=/_emdash/admin\n */\n\nimport type { APIRoute } from \"astro\";\n\nexport const prerender = false;\n\nimport { ulid } from \"ulidx\";\n\nimport { apiError, apiSuccess, handleError } from \"#api/error.js\";\nimport { escapeHtml } from \"#api/escape.js\";\nimport { deleteApiTokensByName, handleApiTokenCreate } from \"#api/handlers/api-tokens.js\";\nimport { getPublicOrigin } from \"#api/public-url.js\";\nimport { isSafeRedirect } from \"#api/redirect.js\";\nimport { runMigrations } from \"#db/migrations/runner.js\";\nimport { OptionsRepository } from \"#db/repositories/options.js\";\nimport { applySeed } from \"#seed/apply.js\";\nimport { loadSeed } from \"#seed/load.js\";\nimport { validateSeed } from \"#seed/validate.js\";\n\n// RBAC role levels (matching @emdash-cms/auth)\nconst ROLE_ADMIN = 50;\n\nconst DEV_USER_EMAIL = \"dev@emdash.local\";\nconst DEV_USER_NAME = \"Dev Admin\";\nconst DEV_SITE_TITLE = \"EmDash Dev Site\";\n\nasync function handleDevBypass(context: Parameters<APIRoute>[0]): Promise<Response> {\n\t// CRITICAL: Only allow in development mode\n\tif (!import.meta.env.DEV) {\n\t\treturn apiError(\"FORBIDDEN\", \"Dev bypass is only available in development mode\", 403);\n\t}\n\n\tconst { locals, url, session } = context;\n\tconst { emdash } = locals;\n\n\tif (!emdash?.db) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash is not initialized\", 500);\n\t}\n\n\ttry {\n\t\t// Run migrations\n\t\tconst migrations = await runMigrations(emdash.db);\n\t\tconsole.log(\"[setup-dev-bypass] Migrations applied:\", migrations.applied);\n\n\t\t// Apply seed (user seed or built-in default). `?content=0` (or `false`)\n\t\t// applies schema/structure only — no sample content, bylines, or terms.\n\t\tconst contentParam = url.searchParams.get(\"content\");\n\t\tconst includeContent = contentParam !== \"0\" && contentParam !== \"false\";\n\t\tconst seed = await loadSeed();\n\t\tconst validation = validateSeed(seed);\n\t\tif (validation.valid) {\n\t\t\tconst seedResult = await applySeed(emdash.db, seed, {\n\t\t\t\tincludeContent,\n\t\t\t\tonConflict: \"skip\",\n\t\t\t\tstorage: emdash.storage ?? undefined,\n\t\t\t});\n\t\t\tconsole.log(\n\t\t\t\t`[setup-dev-bypass] Seed applied: ${seedResult.collections.created} collections, ${seedResult.fields.created} fields`,\n\t\t\t);\n\t\t}\n\n\t\tconst options = new OptionsRepository(emdash.db);\n\n\t\t// Find or create dev user (direct DB access to avoid @emdash-cms/auth import issues in dev)\n\t\tconst existingUser = await emdash.db\n\t\t\t.selectFrom(\"users\")\n\t\t\t.selectAll()\n\t\t\t.where(\"email\", \"=\", DEV_USER_EMAIL)\n\t\t\t.executeTakeFirst();\n\n\t\tlet user: { id: string; email: string; name: string; role: number };\n\t\tlet userCreated = false;\n\n\t\tif (!existingUser) {\n\t\t\tconst now = new Date().toISOString();\n\t\t\tconst newUser = {\n\t\t\t\tid: ulid(),\n\t\t\t\temail: DEV_USER_EMAIL,\n\t\t\t\tname: DEV_USER_NAME,\n\t\t\t\trole: ROLE_ADMIN,\n\t\t\t\temail_verified: 1,\n\t\t\t\tcreated_at: now,\n\t\t\t\tupdated_at: now,\n\t\t\t};\n\n\t\t\tawait emdash.db.insertInto(\"users\").values(newUser).execute();\n\n\t\t\tuser = {\n\t\t\t\tid: newUser.id,\n\t\t\t\temail: newUser.email,\n\t\t\t\tname: newUser.name,\n\t\t\t\trole: newUser.role,\n\t\t\t};\n\t\t\tuserCreated = true;\n\t\t\tconsole.log(\"[setup-dev-bypass] Created dev admin user:\", user.email);\n\t\t} else {\n\t\t\tuser = {\n\t\t\t\tid: existingUser.id,\n\t\t\t\temail: existingUser.email,\n\t\t\t\tname: existingUser.name || DEV_USER_NAME,\n\t\t\t\trole: existingUser.role,\n\t\t\t};\n\t\t}\n\n\t\t// Set site title if not already set\n\t\tconst existingTitle = await options.get(\"emdash:site_title\");\n\t\tif (!existingTitle) {\n\t\t\tawait options.set(\"emdash:site_title\", DEV_SITE_TITLE);\n\t\t}\n\n\t\t// Store canonical site URL (used by magic-link/recovery emails)\n\t\tawait options.set(\"emdash:site_url\", getPublicOrigin(url, emdash?.config));\n\n\t\t// Mark setup complete\n\t\tawait options.set(\"emdash:setup_complete\", true);\n\n\t\t// Create session\n\t\tif (session) {\n\t\t\tsession.set(\"user\", { id: user.id });\n\t\t}\n\n\t\t// Optionally create a PAT token (?token=1) for headless/CLI testing.\n\t\tlet token: string | undefined;\n\t\tif (url.searchParams.has(\"token\")) {\n\t\t\t// Idempotent by name: a prior reset can leave a stale dev-bypass-token,\n\t\t\t// and the raw token is only available at creation, so drop any existing\n\t\t\t// one and mint a fresh, usable PAT rather than accumulating duplicates.\n\t\t\tawait deleteApiTokensByName(emdash.db, user.id, \"dev-bypass-token\");\n\t\t\tconst result = await handleApiTokenCreate(emdash.db, user.id, {\n\t\t\t\tname: \"dev-bypass-token\",\n\t\t\t\tscopes: [\n\t\t\t\t\t\"content:read\",\n\t\t\t\t\t\"content:write\",\n\t\t\t\t\t\"media:read\",\n\t\t\t\t\t\"media:write\",\n\t\t\t\t\t\"schema:read\",\n\t\t\t\t\t\"schema:write\",\n\t\t\t\t\t\"admin\",\n\t\t\t\t],\n\t\t\t});\n\t\t\tif (result.success) {\n\t\t\t\ttoken = result.data.token;\n\t\t\t}\n\t\t}\n\n\t\t// Check for redirect parameter\n\t\tconst redirect = url.searchParams.get(\"redirect\");\n\n\t\tif (redirect) {\n\t\t\t// Validate redirect is a safe local path (prevent open redirect via //evil.com or /\\evil.com)\n\t\t\tif (!isSafeRedirect(redirect)) {\n\t\t\t\treturn apiError(\"INVALID_REDIRECT\", \"Redirect must be a local path\", 400);\n\t\t\t}\n\n\t\t\t// Return an HTML page with meta-refresh redirect\n\t\t\t// This ensures the session is fully saved before redirect\n\t\t\tconst safeRedirect = escapeHtml(redirect);\n\t\t\tconst html = `<!DOCTYPE html>\n<html>\n<head>\n\t<meta http-equiv=\"refresh\" content=\"0;url=${safeRedirect}\">\n</head>\n<body>Redirecting...</body>\n</html>`;\n\t\t\treturn new Response(html, {\n\t\t\t\tstatus: 200,\n\t\t\t\theaders: { \"Content-Type\": \"text/html\" },\n\t\t\t});\n\t\t}\n\n\t\t// Return JSON response\n\t\treturn apiSuccess({\n\t\t\tsuccess: true,\n\t\t\tmessage: \"Dev setup complete\",\n\t\t\tmigrations: migrations.applied,\n\t\t\tuserCreated,\n\t\t\tuser: {\n\t\t\t\tid: user.id,\n\t\t\t\temail: user.email,\n\t\t\t\tname: user.name,\n\t\t\t\trole: user.role,\n\t\t\t},\n\t\t\t...(token ? { token } : {}),\n\t\t});\n\t} catch (error) {\n\t\treturn handleError(error, \"Dev bypass failed\", \"DEV_BYPASS_ERROR\");\n\t}\n}\n\n// Support both GET and POST\nexport const GET: APIRoute = handleDevBypass;\nexport const POST: APIRoute = handleDevBypass;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,YAAY;AAgBzB,MAAM,aAAa;AAEnB,MAAM,iBAAiB;AACvB,MAAM,gBAAgB;AACtB,MAAM,iBAAiB;AAEvB,eAAe,gBAAgB,SAAqD;AAEnF,KAAI,CAAC,OAAO,KAAK,IAAI,IACpB,QAAO,SAAS,aAAa,oDAAoD,IAAI;CAGtF,MAAM,EAAE,QAAQ,KAAK,YAAY;CACjC,MAAM,EAAE,WAAW;AAEnB,KAAI,CAAC,QAAQ,GACZ,QAAO,SAAS,kBAAkB,6BAA6B,IAAI;AAGpE,KAAI;EAEH,MAAM,aAAa,MAAM,cAAc,OAAO,GAAG;AACjD,UAAQ,IAAI,0CAA0C,WAAW,QAAQ;EAIzE,MAAM,eAAe,IAAI,aAAa,IAAI,UAAU;EACpD,MAAM,iBAAiB,iBAAiB,OAAO,iBAAiB;EAChE,MAAM,OAAO,MAAM,UAAU;AAE7B,MADmB,aAAa,KAAK,CACtB,OAAO;GACrB,MAAM,aAAa,MAAM,UAAU,OAAO,IAAI,MAAM;IACnD;IACA,YAAY;IACZ,SAAS,OAAO,WAAW;IAC3B,CAAC;AACF,WAAQ,IACP,oCAAoC,WAAW,YAAY,QAAQ,gBAAgB,WAAW,OAAO,QAAQ,SAC7G;;EAGF,MAAM,UAAU,IAAI,kBAAkB,OAAO,GAAG;EAGhD,MAAM,eAAe,MAAM,OAAO,GAChC,WAAW,QAAQ,CACnB,WAAW,CACX,MAAM,SAAS,KAAK,eAAe,CACnC,kBAAkB;EAEpB,IAAI;EACJ,IAAI,cAAc;AAElB,MAAI,CAAC,cAAc;GAClB,MAAM,uBAAM,IAAI,MAAM,EAAC,aAAa;GACpC,MAAM,UAAU;IACf,IAAI,MAAM;IACV,OAAO;IACP,MAAM;IACN,MAAM;IACN,gBAAgB;IAChB,YAAY;IACZ,YAAY;IACZ;AAED,SAAM,OAAO,GAAG,WAAW,QAAQ,CAAC,OAAO,QAAQ,CAAC,SAAS;AAE7D,UAAO;IACN,IAAI,QAAQ;IACZ,OAAO,QAAQ;IACf,MAAM,QAAQ;IACd,MAAM,QAAQ;IACd;AACD,iBAAc;AACd,WAAQ,IAAI,8CAA8C,KAAK,MAAM;QAErE,QAAO;GACN,IAAI,aAAa;GACjB,OAAO,aAAa;GACpB,MAAM,aAAa,QAAQ;GAC3B,MAAM,aAAa;GACnB;AAKF,MAAI,CADkB,MAAM,QAAQ,IAAI,oBAAoB,CAE3D,OAAM,QAAQ,IAAI,qBAAqB,eAAe;AAIvD,QAAM,QAAQ,IAAI,mBAAmB,gBAAgB,KAAK,QAAQ,OAAO,CAAC;AAG1E,QAAM,QAAQ,IAAI,yBAAyB,KAAK;AAGhD,MAAI,QACH,SAAQ,IAAI,QAAQ,EAAE,IAAI,KAAK,IAAI,CAAC;EAIrC,IAAI;AACJ,MAAI,IAAI,aAAa,IAAI,QAAQ,EAAE;AAIlC,SAAM,sBAAsB,OAAO,IAAI,KAAK,IAAI,mBAAmB;GACnE,MAAM,SAAS,MAAM,qBAAqB,OAAO,IAAI,KAAK,IAAI;IAC7D,MAAM;IACN,QAAQ;KACP;KACA;KACA;KACA;KACA;KACA;KACA;KACA;IACD,CAAC;AACF,OAAI,OAAO,QACV,SAAQ,OAAO,KAAK;;EAKtB,MAAM,WAAW,IAAI,aAAa,IAAI,WAAW;AAEjD,MAAI,UAAU;AAEb,OAAI,CAAC,eAAe,SAAS,CAC5B,QAAO,SAAS,oBAAoB,iCAAiC,IAAI;GAM1E,MAAM,OAAO;;;6CADQ,WAAW,SAAS,CAIc;;;;AAIvD,UAAO,IAAI,SAAS,MAAM;IACzB,QAAQ;IACR,SAAS,EAAE,gBAAgB,aAAa;IACxC,CAAC;;AAIH,SAAO,WAAW;GACjB,SAAS;GACT,SAAS;GACT,YAAY,WAAW;GACvB;GACA,MAAM;IACL,IAAI,KAAK;IACT,OAAO,KAAK;IACZ,MAAM,KAAK;IACX,MAAM,KAAK;IACX;GACD,GAAI,QAAQ,EAAE,OAAO,GAAG,EAAE;GAC1B,CAAC;UACM,OAAO;AACf,SAAO,YAAY,OAAO,qBAAqB,mBAAmB;;;AAKpE,MAAa,MAAgB;AAC7B,MAAa,OAAiB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../../../../base64-B-PsqheR.mjs";
|
|
2
|
-
import "../../../../types-
|
|
2
|
+
import "../../../../types-XrQQ-Aex.mjs";
|
|
3
3
|
import { t as OptionsRepository } from "../../../../options-BlmBHTvX.mjs";
|
|
4
|
-
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-
|
|
4
|
+
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-DmmN74gW.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/astro/routes/api/setup/dev-reset.ts
|
|
7
7
|
const prerender = false;
|