emdash 0.33.0 → 0.34.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/{adapters-BMyNSSZi.d.mts → adapters-34EN2eXO.d.mts} +26 -2
- package/dist/adapters-34EN2eXO.d.mts.map +1 -0
- package/dist/{allowed-origins-CG1pACtS.mjs → allowed-origins-DW7sYyqg.mjs} +2 -2
- package/dist/{allowed-origins-CG1pACtS.mjs.map → allowed-origins-DW7sYyqg.mjs.map} +1 -1
- package/dist/api/route-utils.d.mts +3 -3
- package/dist/api/route-utils.mjs +22 -21
- package/dist/api/route-utils.mjs.map +1 -1
- package/dist/api/schemas/index.d.mts +2 -2
- package/dist/api/schemas/index.mjs +6 -5
- package/dist/{api-D2hunekQ.mjs → api-DdAsirBe.mjs} +98 -407
- package/dist/api-DdAsirBe.mjs.map +1 -0
- package/dist/{api-tokens-CSND0i1z.mjs → api-tokens-CFXu8F_2.mjs} +2 -2
- package/dist/{api-tokens-CSND0i1z.mjs.map → api-tokens-CFXu8F_2.mjs.map} +1 -1
- package/dist/{apply-kwNEJW2l.mjs → apply-D5zfeD09.mjs} +131 -107
- package/dist/apply-D5zfeD09.mjs.map +1 -0
- package/dist/astro/index.d.mts +12 -12
- package/dist/astro/index.d.mts.map +1 -1
- package/dist/astro/index.mjs +93 -35
- package/dist/astro/index.mjs.map +1 -1
- package/dist/astro/middleware/auth.d.mts +10 -10
- package/dist/astro/middleware/auth.mjs +8 -8
- package/dist/astro/middleware/media-usage-write-fence.d.mts +7 -0
- package/dist/astro/middleware/media-usage-write-fence.d.mts.map +1 -0
- package/dist/astro/middleware/media-usage-write-fence.mjs +35 -0
- package/dist/astro/middleware/media-usage-write-fence.mjs.map +1 -0
- package/dist/astro/middleware/redirect.d.mts.map +1 -1
- package/dist/astro/middleware/redirect.mjs +10 -7
- package/dist/astro/middleware/redirect.mjs.map +1 -1
- package/dist/astro/middleware/request-context.mjs +3 -3
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware.d.mts +12 -11
- package/dist/astro/middleware.d.mts.map +1 -1
- package/dist/astro/middleware.mjs +1677 -156
- package/dist/astro/middleware.mjs.map +1 -1
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +9 -8
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs.map +1 -1
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +9 -8
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +5 -5
- package/dist/astro/routes/api/admin/api-tokens/index.mjs +6 -6
- package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +6 -6
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +12 -11
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs.map +1 -1
- package/dist/astro/routes/api/admin/byline-fields/index.mjs +12 -11
- package/dist/astro/routes/api/admin/byline-fields/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +12 -11
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +17 -17
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +17 -17
- package/dist/astro/routes/api/admin/bylines/index.mjs +17 -17
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +14 -13
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs.map +1 -1
- package/dist/astro/routes/api/admin/comments/_id_.mjs +6 -6
- package/dist/astro/routes/api/admin/comments/bulk.mjs +12 -11
- package/dist/astro/routes/api/admin/comments/bulk.mjs.map +1 -1
- package/dist/astro/routes/api/admin/comments/counts.mjs +6 -6
- package/dist/astro/routes/api/admin/comments/index.mjs +12 -11
- package/dist/astro/routes/api/admin/comments/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +5 -5
- package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +4 -4
- package/dist/astro/routes/api/admin/media-usage/collection-deletions/index.d.mts +8 -0
- package/dist/astro/routes/api/admin/media-usage/collection-deletions/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/media-usage/collection-deletions/index.mjs +36 -0
- package/dist/astro/routes/api/admin/media-usage/collection-deletions/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/media-usage/collection-deletions/retry.d.mts +8 -0
- package/dist/astro/routes/api/admin/media-usage/collection-deletions/retry.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/media-usage/collection-deletions/retry.mjs +36 -0
- package/dist/astro/routes/api/admin/media-usage/collection-deletions/retry.mjs.map +1 -0
- package/dist/astro/routes/api/admin/media-usage/repair.mjs +15 -14
- package/dist/astro/routes/api/admin/media-usage/repair.mjs.map +1 -1
- package/dist/astro/routes/api/admin/media-usage/work/index.d.mts +8 -0
- package/dist/astro/routes/api/admin/media-usage/work/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/media-usage/work/index.mjs +37 -0
- package/dist/astro/routes/api/admin/media-usage/work/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/media-usage/work/retry.d.mts +8 -0
- package/dist/astro/routes/api/admin/media-usage/work/retry.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/media-usage/work/retry.mjs +37 -0
- package/dist/astro/routes/api/admin/media-usage/work/retry.mjs.map +1 -0
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +5 -5
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs +5 -5
- package/dist/astro/routes/api/admin/plugins/_id_/disable.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +51 -43
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/enable.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +51 -43
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +47 -42
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/mcp.mjs +6 -6
- package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs +47 -42
- package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +50 -42
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/update.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +50 -42
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/index.mjs +47 -42
- package/dist/astro/routes/api/admin/plugins/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +4 -4
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +47 -42
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +50 -42
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +47 -42
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +50 -42
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +51 -43
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +47 -42
- package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/install.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/install.mjs +51 -43
- package/dist/astro/routes/api/admin/plugins/registry/install.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/updates.mjs +47 -42
- package/dist/astro/routes/api/admin/plugins/updates.mjs.map +1 -1
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +47 -42
- 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 +4 -4
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +47 -42
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/users/_id_/disable.mjs +3 -3
- package/dist/astro/routes/api/admin/users/_id_/enable.mjs +3 -3
- package/dist/astro/routes/api/admin/users/_id_/index.mjs +9 -8
- package/dist/astro/routes/api/admin/users/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +4 -4
- package/dist/astro/routes/api/admin/users/index.mjs +9 -8
- package/dist/astro/routes/api/admin/users/index.mjs.map +1 -1
- package/dist/astro/routes/api/auth/dev-bypass.mjs +7 -7
- package/dist/astro/routes/api/auth/invite/accept.mjs +3 -3
- package/dist/astro/routes/api/auth/invite/complete.mjs +13 -12
- package/dist/astro/routes/api/auth/invite/complete.mjs.map +1 -1
- package/dist/astro/routes/api/auth/invite/index.mjs +10 -9
- package/dist/astro/routes/api/auth/invite/index.mjs.map +1 -1
- package/dist/astro/routes/api/auth/invite/register-options.mjs +12 -11
- package/dist/astro/routes/api/auth/invite/register-options.mjs.map +1 -1
- package/dist/astro/routes/api/auth/logout.mjs +4 -4
- package/dist/astro/routes/api/auth/magic-link/send.mjs +12 -11
- package/dist/astro/routes/api/auth/magic-link/send.mjs.map +1 -1
- package/dist/astro/routes/api/auth/magic-link/verify.mjs +4 -4
- package/dist/astro/routes/api/auth/me.mjs +10 -9
- package/dist/astro/routes/api/auth/me.mjs.map +1 -1
- package/dist/astro/routes/api/auth/mode.mjs +4 -4
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +3 -3
- package/dist/astro/routes/api/auth/oauth/_provider_.mjs +2 -2
- package/dist/astro/routes/api/auth/passkey/_id_.mjs +9 -8
- package/dist/astro/routes/api/auth/passkey/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/auth/passkey/index.mjs +3 -3
- package/dist/astro/routes/api/auth/passkey/options.mjs +14 -13
- package/dist/astro/routes/api/auth/passkey/options.mjs.map +1 -1
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +12 -11
- package/dist/astro/routes/api/auth/passkey/register/options.mjs.map +1 -1
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +13 -12
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs.map +1 -1
- package/dist/astro/routes/api/auth/passkey/verify.mjs +13 -12
- package/dist/astro/routes/api/auth/passkey/verify.mjs.map +1 -1
- package/dist/astro/routes/api/auth/signup/complete.mjs +13 -12
- package/dist/astro/routes/api/auth/signup/complete.mjs.map +1 -1
- package/dist/astro/routes/api/auth/signup/request.mjs +12 -11
- package/dist/astro/routes/api/auth/signup/request.mjs.map +1 -1
- package/dist/astro/routes/api/auth/signup/verify.mjs +3 -3
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +15 -14
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs.map +1 -1
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +14 -13
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +4 -4
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +4 -4
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +13 -13
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +11 -10
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs +18 -17
- 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 +18 -17
- 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 +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +4 -4
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +11 -10
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.d.mts.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +44 -31
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +4 -4
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_.mjs +11 -10
- package/dist/astro/routes/api/content/_collection_/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/authors.mjs +4 -4
- package/dist/astro/routes/api/content/_collection_/index.mjs +11 -10
- package/dist/astro/routes/api/content/_collection_/index.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/trash.mjs +10 -9
- package/dist/astro/routes/api/content/_collection_/trash.mjs.map +1 -1
- package/dist/astro/routes/api/dashboard.mjs +10 -8
- package/dist/astro/routes/api/dashboard.mjs.map +1 -1
- package/dist/astro/routes/api/dev/emails.mjs +4 -4
- package/dist/astro/routes/api/import/probe.d.mts +3 -3
- package/dist/astro/routes/api/import/probe.mjs +18 -16
- package/dist/astro/routes/api/import/probe.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +5 -5
- package/dist/astro/routes/api/import/wordpress/execute.d.mts +11 -11
- package/dist/astro/routes/api/import/wordpress/execute.mjs +15 -15
- 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 +14 -12
- package/dist/astro/routes/api/import/wordpress/media.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +13 -12
- package/dist/astro/routes/api/import/wordpress/prepare.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +11 -11
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +14 -14
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +18 -16
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/callback.mjs +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +11 -11
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +28 -27
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs.map +1 -1
- package/dist/astro/routes/api/manifest.mjs +5 -5
- package/dist/astro/routes/api/mcp.d.mts.map +1 -1
- package/dist/astro/routes/api/mcp.mjs +174 -72
- package/dist/astro/routes/api/mcp.mjs.map +1 -1
- package/dist/astro/routes/api/media/_id_/confirm.mjs +13 -11
- package/dist/astro/routes/api/media/_id_/confirm.mjs.map +1 -1
- package/dist/astro/routes/api/media/_id_/upload.mjs +6 -6
- package/dist/astro/routes/api/media/_id_/usage.mjs +17 -16
- package/dist/astro/routes/api/media/_id_/usage.mjs.map +1 -1
- package/dist/astro/routes/api/media/_id_.mjs +16 -15
- package/dist/astro/routes/api/media/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/media/file/_...key_.mjs +3 -3
- package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +4 -4
- package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +4 -4
- package/dist/astro/routes/api/media/providers/index.mjs +4 -4
- package/dist/astro/routes/api/media/upload-url.mjs +11 -10
- package/dist/astro/routes/api/media/upload-url.mjs.map +1 -1
- package/dist/astro/routes/api/media.mjs +18 -15
- package/dist/astro/routes/api/media.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +11 -11
- package/dist/astro/routes/api/menus/_name_/items.mjs +11 -11
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +11 -11
- package/dist/astro/routes/api/menus/_name_/translations.mjs +11 -11
- package/dist/astro/routes/api/menus/_name_.mjs +11 -11
- package/dist/astro/routes/api/menus/index.mjs +11 -11
- package/dist/astro/routes/api/oauth/authorize.mjs +6 -6
- package/dist/astro/routes/api/oauth/device/authorize.mjs +7 -7
- package/dist/astro/routes/api/oauth/device/code.mjs +10 -10
- package/dist/astro/routes/api/oauth/device/token.mjs +9 -9
- package/dist/astro/routes/api/oauth/register.mjs +4 -4
- package/dist/astro/routes/api/oauth/token/refresh.mjs +7 -7
- package/dist/astro/routes/api/oauth/token/revoke.mjs +7 -7
- package/dist/astro/routes/api/oauth/token.mjs +7 -7
- package/dist/astro/routes/api/openapi.json.mjs +152 -6
- package/dist/astro/routes/api/openapi.json.mjs.map +1 -1
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.d.mts.map +1 -1
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +8 -7
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs.map +1 -1
- package/dist/astro/routes/api/redirects/404s/index.mjs +12 -11
- package/dist/astro/routes/api/redirects/404s/index.mjs.map +1 -1
- package/dist/astro/routes/api/redirects/404s/summary.mjs +12 -11
- package/dist/astro/routes/api/redirects/404s/summary.mjs.map +1 -1
- package/dist/astro/routes/api/redirects/_id_.mjs +13 -12
- package/dist/astro/routes/api/redirects/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/redirects/index.mjs +13 -12
- package/dist/astro/routes/api/redirects/index.mjs.map +1 -1
- package/dist/astro/routes/api/relations/_id_/index.mjs +18 -17
- package/dist/astro/routes/api/relations/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/relations/_id_/translations.mjs +13 -12
- package/dist/astro/routes/api/relations/_id_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/relations/index.mjs +18 -17
- package/dist/astro/routes/api/relations/index.mjs.map +1 -1
- package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +4 -4
- package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +5 -5
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +47 -42
- 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 +47 -42
- 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 +47 -42
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/index.d.mts.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +47 -42
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/index.mjs +47 -42
- package/dist/astro/routes/api/schema/collections/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/reorder.mjs +47 -42
- package/dist/astro/routes/api/schema/collections/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/schema/index.mjs +10 -9
- package/dist/astro/routes/api/schema/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +47 -42
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs.map +1 -1
- package/dist/astro/routes/api/schema/orphans/index.mjs +47 -42
- package/dist/astro/routes/api/schema/orphans/index.mjs.map +1 -1
- package/dist/astro/routes/api/search/enable.mjs +13 -13
- package/dist/astro/routes/api/search/index.mjs +12 -12
- package/dist/astro/routes/api/search/rebuild.mjs +13 -13
- package/dist/astro/routes/api/search/stats.mjs +8 -8
- package/dist/astro/routes/api/search/suggest.mjs +12 -12
- package/dist/astro/routes/api/sections/_slug_.mjs +12 -11
- package/dist/astro/routes/api/sections/_slug_.mjs.map +1 -1
- package/dist/astro/routes/api/sections/index.mjs +12 -11
- package/dist/astro/routes/api/sections/index.mjs.map +1 -1
- package/dist/astro/routes/api/settings/backups/archives/_name_.mjs +7 -7
- package/dist/astro/routes/api/settings/backups/archives/index.mjs +6 -6
- package/dist/astro/routes/api/settings/backups/export.mjs +7 -7
- package/dist/astro/routes/api/settings/backups/index.mjs +8 -8
- package/dist/astro/routes/api/settings/email.mjs +5 -5
- package/dist/astro/routes/api/settings.mjs +14 -13
- package/dist/astro/routes/api/settings.mjs.map +1 -1
- package/dist/astro/routes/api/setup/admin-verify.mjs +14 -13
- package/dist/astro/routes/api/setup/admin-verify.mjs.map +1 -1
- package/dist/astro/routes/api/setup/admin.mjs +13 -12
- package/dist/astro/routes/api/setup/admin.mjs.map +1 -1
- package/dist/astro/routes/api/setup/dev-bypass.mjs +30 -28
- package/dist/astro/routes/api/setup/dev-bypass.mjs.map +1 -1
- package/dist/astro/routes/api/setup/dev-reset.mjs +3 -3
- package/dist/astro/routes/api/setup/index.mjs +32 -30
- package/dist/astro/routes/api/setup/index.mjs.map +1 -1
- package/dist/astro/routes/api/setup/status.mjs +5 -5
- package/dist/astro/routes/api/snapshot.mjs +8 -8
- package/dist/astro/routes/api/taxonomies/_name_/reorder.mjs +16 -15
- package/dist/astro/routes/api/taxonomies/_name_/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +16 -15
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +16 -15
- 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 +18 -16
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/translations.d.mts +8 -0
- package/dist/astro/routes/api/taxonomies/_name_/translations.d.mts.map +1 -0
- package/dist/astro/routes/api/taxonomies/_name_/translations.mjs +46 -0
- package/dist/astro/routes/api/taxonomies/_name_/translations.mjs.map +1 -0
- package/dist/astro/routes/api/taxonomies/_name_.d.mts +19 -0
- package/dist/astro/routes/api/taxonomies/_name_.d.mts.map +1 -0
- package/dist/astro/routes/api/taxonomies/_name_.mjs +88 -0
- package/dist/astro/routes/api/taxonomies/_name_.mjs.map +1 -0
- package/dist/astro/routes/api/taxonomies/index.mjs +16 -15
- package/dist/astro/routes/api/taxonomies/index.mjs.map +1 -1
- package/dist/astro/routes/api/themes/preview.mjs +6 -6
- package/dist/astro/routes/api/typegen.mjs +6 -6
- package/dist/astro/routes/api/well-known/auth.mjs +1 -1
- package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +2 -2
- package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +2 -2
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +10 -9
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +12 -11
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +12 -11
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs.map +1 -1
- package/dist/astro/routes/api/widget-areas/_name_.mjs +7 -6
- package/dist/astro/routes/api/widget-areas/_name_.mjs.map +1 -1
- package/dist/astro/routes/api/widget-areas/index.mjs +12 -11
- package/dist/astro/routes/api/widget-areas/index.mjs.map +1 -1
- package/dist/astro/routes/api/widget-components.mjs +4 -4
- package/dist/astro/routes/robots.txt.mjs +7 -6
- package/dist/astro/routes/robots.txt.mjs.map +1 -1
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +10 -10
- package/dist/astro/routes/sitemap.xml.mjs +8 -7
- package/dist/astro/routes/sitemap.xml.mjs.map +1 -1
- package/dist/astro/types.d.mts +35 -17
- 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-qRhWQnel.mjs → authorize-1iFJzPaZ.mjs} +2 -2
- package/dist/{authorize-qRhWQnel.mjs.map → authorize-1iFJzPaZ.mjs.map} +1 -1
- package/dist/{backup-CtA6LDNw.mjs → backup-LHjIAVNP.mjs} +4 -4
- package/dist/{backup-CtA6LDNw.mjs.map → backup-LHjIAVNP.mjs.map} +1 -1
- package/dist/{base64-B-PsqheR.mjs → base64-CvLhUKQv.mjs} +1 -1
- package/dist/{base64-B-PsqheR.mjs.map → base64-CvLhUKQv.mjs.map} +1 -1
- package/dist/bundle-CBEXrBnb.mjs +663 -0
- package/dist/bundle-CBEXrBnb.mjs.map +1 -0
- package/dist/{byline-fields-CNc0Yq5i.mjs → byline-fields-C5S8wygO.mjs} +2 -2
- package/dist/{byline-fields-CNc0Yq5i.mjs.map → byline-fields-C5S8wygO.mjs.map} +1 -1
- package/dist/{byline-Cp6csL84.mjs → byline-pEcoDps8.mjs} +5 -5
- package/dist/{byline-Cp6csL84.mjs.map → byline-pEcoDps8.mjs.map} +1 -1
- package/dist/{byline-registry-ZkPKqEwC.mjs → byline-registry-DDun8sxh.mjs} +2 -2
- package/dist/{byline-registry-ZkPKqEwC.mjs.map → byline-registry-DDun8sxh.mjs.map} +1 -1
- package/dist/{bylines-CEj5CdT4.mjs → bylines-BWemdX2k.mjs} +7 -7
- package/dist/{bylines-CEj5CdT4.mjs.map → bylines-BWemdX2k.mjs.map} +1 -1
- package/dist/{bylines-cf-C9lmF.mjs → bylines-DJfSfXCL.mjs} +5 -5
- package/dist/{bylines-cf-C9lmF.mjs.map → bylines-DJfSfXCL.mjs.map} +1 -1
- package/dist/{cache-C9FptTFR.mjs → cache-CBJaDy_E.mjs} +3 -3
- package/dist/{cache-C9FptTFR.mjs.map → cache-CBJaDy_E.mjs.map} +1 -1
- package/dist/{challenge-store-D9VNKELo.mjs → challenge-store-CZyFVaad.mjs} +1 -1
- package/dist/{challenge-store-D9VNKELo.mjs.map → challenge-store-CZyFVaad.mjs.map} +1 -1
- package/dist/{chunks-DbYzib_k.mjs → chunks-DfPax1I0.mjs} +2 -2
- package/dist/{chunks-DbYzib_k.mjs.map → chunks-DfPax1I0.mjs.map} +1 -1
- package/dist/cli/index.mjs +176 -698
- package/dist/cli/index.mjs.map +1 -1
- package/dist/client/cf-access.d.mts +1 -1
- package/dist/client/index.d.mts +74 -4
- package/dist/client/index.d.mts.map +1 -1
- package/dist/client/index.mjs +25 -2
- package/dist/client/index.mjs.map +1 -1
- package/dist/collection-deletion-C8BugSGz.mjs +779 -0
- package/dist/collection-deletion-C8BugSGz.mjs.map +1 -0
- package/dist/{comment-BIkJ6Fil.mjs → comment-Dxlep6cE.mjs} +2 -2
- package/dist/{comment-BIkJ6Fil.mjs.map → comment-Dxlep6cE.mjs.map} +1 -1
- package/dist/{comment-reaction-D-laEceb.mjs → comment-reaction-D6qfHKBc.mjs} +2 -2
- package/dist/{comment-reaction-D-laEceb.mjs.map → comment-reaction-D6qfHKBc.mjs.map} +1 -1
- package/dist/{comments-0_w6KChA.mjs → comments-CTOuhTSX.mjs} +3 -3
- package/dist/{comments-0_w6KChA.mjs.map → comments-CTOuhTSX.mjs.map} +1 -1
- package/dist/{components-BPxrRjpE.mjs → components-CQy3lh9x.mjs} +1 -1
- package/dist/{components-BPxrRjpE.mjs.map → components-CQy3lh9x.mjs.map} +1 -1
- package/dist/{config-DyF3OKg_.mjs → config-C3EBstHi.mjs} +18 -2
- package/dist/config-C3EBstHi.mjs.map +1 -0
- package/dist/{content-CJ94NEx5.mjs → content-BNfwh7xX.mjs} +509 -78
- package/dist/content-BNfwh7xX.mjs.map +1 -0
- package/dist/content-list-query-DhQ84eVV.d.mts +26 -0
- package/dist/content-list-query-DhQ84eVV.d.mts.map +1 -0
- package/dist/content-refresh-DNERP4-f.mjs +2560 -0
- package/dist/content-refresh-DNERP4-f.mjs.map +1 -0
- package/dist/{context-C_1nrqnW.mjs → context-DRgOvSnW.mjs} +25 -17
- package/dist/context-DRgOvSnW.mjs.map +1 -0
- package/dist/{cron-DRV-UC4K.mjs → cron-Y9aLtgrA.mjs} +1 -1
- package/dist/{cron-DRV-UC4K.mjs.map → cron-Y9aLtgrA.mjs.map} +1 -1
- package/dist/{dashboard-DINnNVVU.mjs → dashboard-CB8J89rJ.mjs} +44 -10
- package/dist/dashboard-CB8J89rJ.mjs.map +1 -0
- package/dist/db/index.d.mts +4 -4
- package/dist/db/index.mjs +2 -2
- package/dist/db/index.mjs.map +1 -1
- package/dist/db/libsql.d.mts +1 -1
- package/dist/db/postgres.d.mts +1 -1
- package/dist/db/sqlite.d.mts +1 -1
- package/dist/{db-errors-CcWLaRiR.mjs → db-errors-Cl-sKYTm.mjs} +1 -1
- package/dist/{db-errors-CcWLaRiR.mjs.map → db-errors-Cl-sKYTm.mjs.map} +1 -1
- package/dist/{default-BD2FG0xV.mjs → default-DdDl3fxv.mjs} +1 -1
- package/dist/{default-BD2FG0xV.mjs.map → default-DdDl3fxv.mjs.map} +1 -1
- package/dist/{deferred-tasks-C-WRCcKo.d.mts → deferred-tasks-BMsa9F64.d.mts} +1 -1
- package/dist/{deferred-tasks-C-WRCcKo.d.mts.map → deferred-tasks-BMsa9F64.d.mts.map} +1 -1
- package/dist/{device-flow-CTqd8mud.mjs → device-flow-CaioYGK3.mjs} +4 -4
- package/dist/{device-flow-CTqd8mud.mjs.map → device-flow-CaioYGK3.mjs.map} +1 -1
- package/dist/dist-D_6CKR8z.mjs +810 -0
- package/dist/dist-D_6CKR8z.mjs.map +1 -0
- package/dist/{email-console-C6WdcWbL.mjs → email-console-BHNjIwiB.mjs} +1 -1
- package/dist/{email-console-C6WdcWbL.mjs.map → email-console-BHNjIwiB.mjs.map} +1 -1
- package/dist/{enrich-CFJJgxs_.mjs → enrich-_ySMEvEE.mjs} +2 -2
- package/dist/{enrich-CFJJgxs_.mjs.map → enrich-_ySMEvEE.mjs.map} +1 -1
- package/dist/{error-oh_9i6bR.mjs → error-DupyJZE2.mjs} +3 -3
- package/dist/{error-oh_9i6bR.mjs.map → error-DupyJZE2.mjs.map} +1 -1
- package/dist/{errors-BucQ8VYz.mjs → errors-CLUPm7aD.mjs} +14 -2
- package/dist/errors-CLUPm7aD.mjs.map +1 -0
- package/dist/{escape-CXps5F_v.mjs → escape-C_aLKP3H.mjs} +1 -1
- package/dist/{escape-CXps5F_v.mjs.map → escape-C_aLKP3H.mjs.map} +1 -1
- package/dist/{field-defs-cache-WD82dMQq.mjs → field-defs-cache-hg6QkjV9.mjs} +4 -4
- package/dist/{field-defs-cache-WD82dMQq.mjs.map → field-defs-cache-hg6QkjV9.mjs.map} +1 -1
- package/dist/{fts-manager-BITakW_R.mjs → fts-manager-CZ-5dVwJ.mjs} +76 -50
- package/dist/fts-manager-CZ-5dVwJ.mjs.map +1 -0
- package/dist/{hreflang-BaLCNcDx.d.mts → hreflang-D3Uehfv2.d.mts} +2 -2
- package/dist/{hreflang-BaLCNcDx.d.mts.map → hreflang-D3Uehfv2.d.mts.map} +1 -1
- package/dist/{hreflang-BdZuVBhL.mjs → hreflang-DNswoYsi.mjs} +7 -7
- package/dist/{hreflang-BdZuVBhL.mjs.map → hreflang-DNswoYsi.mjs.map} +1 -1
- package/dist/{import-C-9uqyT3.mjs → import-B41u8Rot.mjs} +5 -5
- package/dist/{import-C-9uqyT3.mjs.map → import-B41u8Rot.mjs.map} +1 -1
- package/dist/{index-M37iz29I.d.mts → index-C3Y-rsyN.d.mts} +226 -73
- package/dist/index-C3Y-rsyN.d.mts.map +1 -0
- package/dist/{index-MGw47uWq.d.mts → index-Cof4-Fab.d.mts} +5 -10
- package/dist/index-Cof4-Fab.d.mts.map +1 -0
- package/dist/index.d.mts +20 -19
- package/dist/index.mjs +73 -67
- package/dist/{init-lock-DJkX6Hto.mjs → init-lock-6b309ZrF.mjs} +1 -1
- package/dist/{init-lock-DJkX6Hto.mjs.map → init-lock-6b309ZrF.mjs.map} +1 -1
- package/dist/{load-DV1DZuUJ.mjs → load-DmvJrtxS.mjs} +2 -2
- package/dist/{load-DV1DZuUJ.mjs.map → load-DmvJrtxS.mjs.map} +1 -1
- package/dist/{loader-CGugY7Zl.mjs → loader-DLBqRiGP.mjs} +95 -53
- package/dist/loader-DLBqRiGP.mjs.map +1 -0
- package/dist/{manifest-schema-Da7kj23y.mjs → manifest-schema-BXbUAHod.mjs} +1 -1
- package/dist/{manifest-schema-Da7kj23y.mjs.map → manifest-schema-BXbUAHod.mjs.map} +1 -1
- package/dist/media/image-endpoint.mjs +1 -1
- package/dist/media/index.d.mts +1 -1
- package/dist/media/index.mjs +3 -2
- package/dist/media/index.mjs.map +1 -1
- package/dist/media/local-runtime.d.mts +12 -12
- package/dist/media/local-runtime.mjs +6 -5
- package/dist/media/local-runtime.mjs.map +1 -1
- package/dist/{media-OhYL-7Io.mjs → media-BWWWb8kg.mjs} +92 -3
- package/dist/media-BWWWb8kg.mjs.map +1 -0
- package/dist/{media-BP7S-nHT.mjs → media-CzhAn2--.mjs} +2 -2
- package/dist/{media-BP7S-nHT.mjs.map → media-CzhAn2--.mjs.map} +1 -1
- package/dist/{media-allowlist-D-peH1H5.mjs → media-allowlist-BD6HhgXA.mjs} +14 -3
- package/dist/media-allowlist-BD6HhgXA.mjs.map +1 -0
- package/dist/{media-upload-DtrwU2B0.mjs → media-upload-9yas9zGH.mjs} +10 -8
- package/dist/{media-upload-DtrwU2B0.mjs.map → media-upload-9yas9zGH.mjs.map} +1 -1
- package/dist/{media-url-DYs_YLOx.mjs → media-url-BvoX88FA.mjs} +1 -1
- package/dist/{media-url-DYs_YLOx.mjs.map → media-url-BvoX88FA.mjs.map} +1 -1
- package/dist/{media-usage-BlxfTkN0.mjs → media-usage-De3qvwjc.mjs} +137 -60
- package/dist/media-usage-De3qvwjc.mjs.map +1 -0
- package/dist/media-usage-work-B9Bksh_b.mjs +152 -0
- package/dist/media-usage-work-B9Bksh_b.mjs.map +1 -0
- package/dist/media-usage-work-DrCbqBcl.mjs +424 -0
- package/dist/media-usage-work-DrCbqBcl.mjs.map +1 -0
- package/dist/media-usage-write-fence-aHEgN1zB.mjs +42 -0
- package/dist/media-usage-write-fence-aHEgN1zB.mjs.map +1 -0
- package/dist/{menus-Y54RDPIN.mjs → menus-CC-yn1F9.mjs} +351 -95
- package/dist/menus-CC-yn1F9.mjs.map +1 -0
- package/dist/{menus-BcQWxeXu.mjs → menus-fxvEDYE6.mjs} +3 -3
- package/dist/{menus-BcQWxeXu.mjs.map → menus-fxvEDYE6.mjs.map} +1 -1
- package/dist/{mode-BWyTBe3I.mjs → mode-Bpe-tNNy.mjs} +1 -1
- package/dist/{mode-BWyTBe3I.mjs.map → mode-Bpe-tNNy.mjs.map} +1 -1
- package/dist/{normalize-C-SHXmra.mjs → normalize-Bc-s_r-a.mjs} +1 -1
- package/dist/{normalize-C-SHXmra.mjs.map → normalize-Bc-s_r-a.mjs.map} +1 -1
- package/dist/{oauth-authorization-ClvktmrL.mjs → oauth-authorization-BXO1MKej.mjs} +4 -4
- package/dist/{oauth-authorization-ClvktmrL.mjs.map → oauth-authorization-BXO1MKej.mjs.map} +1 -1
- package/dist/{oauth-clients-8ao-U66l.mjs → oauth-clients-C_DNqtRu.mjs} +1 -1
- package/dist/{oauth-clients-8ao-U66l.mjs.map → oauth-clients-C_DNqtRu.mjs.map} +1 -1
- package/dist/{oauth-state-store-B1ofdTiQ.mjs → oauth-state-store-DwAxMtk4.mjs} +1 -1
- package/dist/{oauth-state-store-B1ofdTiQ.mjs.map → oauth-state-store-DwAxMtk4.mjs.map} +1 -1
- package/dist/{oauth-user-lookup-CscEuIiR.mjs → oauth-user-lookup-BxfZizdk.mjs} +1 -1
- package/dist/{oauth-user-lookup-CscEuIiR.mjs.map → oauth-user-lookup-BxfZizdk.mjs.map} +1 -1
- package/dist/object-cache/memory.d.mts +1 -1
- package/dist/{options-CA4eVX6P.d.mts → options-DRe1pIBL.d.mts} +4 -3
- package/dist/options-DRe1pIBL.d.mts.map +1 -0
- package/dist/page/index.d.mts +2 -2
- package/dist/{parse-CJKNuewM.mjs → parse-DFbuc-Fh.mjs} +2 -2
- package/dist/{parse-CJKNuewM.mjs.map → parse-DFbuc-Fh.mjs.map} +1 -1
- package/dist/{passkey-config-D-zrzMJI.mjs → passkey-config-_2GOwwK8.mjs} +1 -1
- package/dist/{passkey-config-D-zrzMJI.mjs.map → passkey-config-_2GOwwK8.mjs.map} +1 -1
- package/dist/{placeholder-DaeNS-VG.d.mts → placeholder-CzW7Lshs.d.mts} +1 -1
- package/dist/{placeholder-DaeNS-VG.d.mts.map → placeholder-CzW7Lshs.d.mts.map} +1 -1
- package/dist/plugin-types.d.mts +8 -1
- package/dist/plugin-types.d.mts.map +1 -1
- package/dist/plugin-utils.d.mts +10 -10
- package/dist/plugins/adapt-sandbox-entry.d.mts +10 -10
- package/dist/plugins/adapt-sandbox-entry.mjs +7 -4
- package/dist/plugins/adapt-sandbox-entry.mjs.map +1 -1
- package/dist/{portable-text-B_kqBmXB.mjs → portable-text-DhKbDAGr.mjs} +1 -1
- package/dist/{portable-text-B_kqBmXB.mjs.map → portable-text-DhKbDAGr.mjs.map} +1 -1
- package/dist/{preview-BU6PaLpM.mjs → preview-PW-nOnq4.mjs} +2 -2
- package/dist/{preview-BU6PaLpM.mjs.map → preview-PW-nOnq4.mjs.map} +1 -1
- package/dist/{public-url-Ox9oOlgp.mjs → public-url-CWoFhQT8.mjs} +1 -1
- package/dist/{public-url-Ox9oOlgp.mjs.map → public-url-CWoFhQT8.mjs.map} +1 -1
- package/dist/{query-C5w7PsRQ.mjs → query-BgjfiLUQ.mjs} +31 -49
- package/dist/query-BgjfiLUQ.mjs.map +1 -0
- package/dist/{query-rC9HKv1N.mjs → query-vgZNwIhh.mjs} +3 -3
- package/dist/{query-rC9HKv1N.mjs.map → query-vgZNwIhh.mjs.map} +1 -1
- package/dist/{rate-limit-kug6q99V.mjs → rate-limit-L5anykgo.mjs} +2 -2
- package/dist/{rate-limit-kug6q99V.mjs.map → rate-limit-L5anykgo.mjs.map} +1 -1
- package/dist/{redirect-DIJxXKOG.mjs → redirect-COsS6SWJ.mjs} +2 -2
- package/dist/{redirect-DIJxXKOG.mjs.map → redirect-COsS6SWJ.mjs.map} +1 -1
- package/dist/{redirect-Egf2R9yP.mjs → redirect-KBNE3UEs.mjs} +1 -1
- package/dist/{redirect-Egf2R9yP.mjs.map → redirect-KBNE3UEs.mjs.map} +1 -1
- package/dist/{redirects-Bzm812bY.mjs → redirects-CufRQt0Q.mjs} +4 -4
- package/dist/{redirects-Bzm812bY.mjs.map → redirects-CufRQt0Q.mjs.map} +1 -1
- package/dist/{redirects-G8wAhWAf.mjs → redirects-cV9g7V-0.mjs} +133 -14
- package/dist/redirects-cV9g7V-0.mjs.map +1 -0
- package/dist/registry-C581V4TP.mjs +1275 -0
- package/dist/registry-C581V4TP.mjs.map +1 -0
- package/dist/{relation-Cbe3Sd3m.mjs → relation-DtmAQH7s.mjs} +3 -3
- package/dist/{relation-Cbe3Sd3m.mjs.map → relation-DtmAQH7s.mjs.map} +1 -1
- package/dist/{relations-Bw_E1TXo.mjs → relations-BBApI4e2.mjs} +3 -3
- package/dist/{relations-Bw_E1TXo.mjs.map → relations-BBApI4e2.mjs.map} +1 -1
- package/dist/{relations-qHwpUe66.mjs → relations-DICSyfsh.mjs} +6 -6
- package/dist/{relations-qHwpUe66.mjs.map → relations-DICSyfsh.mjs.map} +1 -1
- package/dist/{relations-G2ta7GIl.d.mts → relations-DItI3MN9.d.mts} +369 -35
- package/dist/relations-DItI3MN9.d.mts.map +1 -0
- package/dist/request-context.d.mts +1 -1
- package/dist/{request-meta-Df-jFbAd.mjs → request-meta-DgZJh3zG.mjs} +2 -2
- package/dist/{request-meta-Df-jFbAd.mjs.map → request-meta-DgZJh3zG.mjs.map} +1 -1
- package/dist/{resolve-DZzG4HqM.mjs → resolve-DOhVEvty.mjs} +2 -2
- package/dist/{resolve-DZzG4HqM.mjs.map → resolve-DOhVEvty.mjs.map} +1 -1
- package/dist/{runner-BFTrkYhu.mjs → runner-BiDvq5dv.mjs} +1157 -254
- package/dist/runner-BiDvq5dv.mjs.map +1 -0
- package/dist/{runner-BaADli8l.d.mts → runner-CgQbELYC.d.mts} +2 -2
- package/dist/{runner-BaADli8l.d.mts.map → runner-CgQbELYC.d.mts.map} +1 -1
- package/dist/runtime.d.mts +11 -11
- package/dist/runtime.mjs +4 -3
- package/dist/runtime.mjs.map +1 -1
- package/dist/{schema-CiQXr6_F.mjs → schema-BFyTg38T.mjs} +3 -3
- package/dist/{schema-CiQXr6_F.mjs.map → schema-BFyTg38T.mjs.map} +1 -1
- package/dist/schema-CeQSNwB3.mjs +390 -0
- package/dist/schema-CeQSNwB3.mjs.map +1 -0
- package/dist/{scopes-CNJVT5i5.mjs → scopes-BVeuhGBE.mjs} +3 -3
- package/dist/{scopes-CNJVT5i5.mjs.map → scopes-BVeuhGBE.mjs.map} +1 -1
- package/dist/{search-FZhx5dDU.mjs → search-BpuPKZb0.mjs} +25 -15
- package/dist/search-BpuPKZb0.mjs.map +1 -0
- package/dist/{secrets-DLd8RXee.mjs → secrets-dtYs2hDo.mjs} +3 -3
- package/dist/{secrets-DLd8RXee.mjs.map → secrets-dtYs2hDo.mjs.map} +1 -1
- package/dist/{sections-BrIrMUCn.mjs → sections-COctk6hf.mjs} +3 -3
- package/dist/{sections-BrIrMUCn.mjs.map → sections-COctk6hf.mjs.map} +1 -1
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +24 -22
- package/dist/seo/index.d.mts +3 -3
- package/dist/seo/index.mjs +16 -15
- package/dist/seo/index.mjs.map +1 -1
- package/dist/{seo-CobNfOvb.mjs → seo-AFpVvTqr.mjs} +5 -3
- package/dist/seo-AFpVvTqr.mjs.map +1 -0
- package/dist/{seo-DTHRntNC.mjs → seo-CvDxfvFb.mjs} +2 -2
- package/dist/{seo-DTHRntNC.mjs.map → seo-CvDxfvFb.mjs.map} +1 -1
- package/dist/{service-B-pYGPgR.mjs → service-xMiMSTsR.mjs} +3 -3
- package/dist/{service-B-pYGPgR.mjs.map → service-xMiMSTsR.mjs.map} +1 -1
- package/dist/{session-user-BvM9-zNl.mjs → session-user-BzVemLkw.mjs} +1 -1
- package/dist/{session-user-BvM9-zNl.mjs.map → session-user-BzVemLkw.mjs.map} +1 -1
- package/dist/{settings-kJhGiQ4z.mjs → settings-B372MV0p.mjs} +4 -4
- package/dist/{settings-kJhGiQ4z.mjs.map → settings-B372MV0p.mjs.map} +1 -1
- package/dist/{settings-DPHau-WH.mjs → settings-BE9aqn_9.mjs} +3 -3
- package/dist/{settings-DPHau-WH.mjs.map → settings-BE9aqn_9.mjs.map} +1 -1
- package/dist/{setup-complete-u50Qm8rY.mjs → setup-complete-DF7TAfD5.mjs} +1 -1
- package/dist/{setup-complete-u50Qm8rY.mjs.map → setup-complete-DF7TAfD5.mjs.map} +1 -1
- package/dist/{setup-nonce-DCjiiOD2.mjs → setup-nonce-Do-U_cg9.mjs} +1 -1
- package/dist/{setup-nonce-DCjiiOD2.mjs.map → setup-nonce-Do-U_cg9.mjs.map} +1 -1
- package/dist/{single-flight-cache-DW3w11Pu.mjs → single-flight-cache-B0eLKS6K.mjs} +2 -2
- package/dist/{single-flight-cache-DW3w11Pu.mjs.map → single-flight-cache-B0eLKS6K.mjs.map} +1 -1
- package/dist/{site-url-I-lJ5kma.mjs → site-url-Bowsi9T-.mjs} +2 -2
- package/dist/{site-url-I-lJ5kma.mjs.map → site-url-Bowsi9T-.mjs.map} +1 -1
- package/dist/slugify-B994zkXC.mjs +17 -0
- package/dist/slugify-B994zkXC.mjs.map +1 -0
- package/dist/{snapshot-I_fjLDaD.mjs → snapshot-B5h6aPMh.mjs} +1 -1
- package/dist/{snapshot-I_fjLDaD.mjs.map → snapshot-B5h6aPMh.mjs.map} +1 -1
- package/dist/{ssrf-CTa6v21i.mjs → ssrf-Cpvg_n3A.mjs} +1 -1
- package/dist/{ssrf-CTa6v21i.mjs.map → ssrf-Cpvg_n3A.mjs.map} +1 -1
- package/dist/{state-CQvoefYP.mjs → state-DYwPue40.mjs} +1 -1
- package/dist/{state-CQvoefYP.mjs.map → state-DYwPue40.mjs.map} +1 -1
- package/dist/{status-CIsmlC1E.mjs → status-CWVYpbD8.mjs} +1 -1
- package/dist/{status-CIsmlC1E.mjs.map → status-CWVYpbD8.mjs.map} +1 -1
- package/dist/storage/local.d.mts +1 -1
- package/dist/storage/local.mjs +1 -1
- package/dist/storage/s3.d.mts +1 -1
- package/dist/storage/s3.mjs +1 -1
- package/dist/{taxonomies-CLN1N92E.mjs → taxonomies-B0o9ExNV.mjs} +75 -64
- package/dist/taxonomies-B0o9ExNV.mjs.map +1 -0
- package/dist/{taxonomies-CKuaZER5.mjs → taxonomies-Dk3MAklL.mjs} +280 -56
- package/dist/taxonomies-Dk3MAklL.mjs.map +1 -0
- package/dist/{taxonomy-pOrB2kZe.mjs → taxonomy-CPeM8d2o.mjs} +131 -78
- package/dist/taxonomy-CPeM8d2o.mjs.map +1 -0
- package/dist/{tokens-DagaJGK8.mjs → tokens-C39klX8R.mjs} +2 -2
- package/dist/{tokens-DagaJGK8.mjs.map → tokens-C39klX8R.mjs.map} +1 -1
- package/dist/{transport-DVsa5YYo.mjs → transport--CfOflrp.mjs} +1 -1
- package/dist/{transport-DVsa5YYo.mjs.map → transport--CfOflrp.mjs.map} +1 -1
- package/dist/{transport-CAwTaTp_.d.mts → transport-B_rfeU-a.d.mts} +1 -1
- package/dist/{transport-CAwTaTp_.d.mts.map → transport-B_rfeU-a.d.mts.map} +1 -1
- package/dist/{trusted-proxy-D20_7fyX.mjs → trusted-proxy-CEVekpby.mjs} +1 -1
- package/dist/{trusted-proxy-D20_7fyX.mjs.map → trusted-proxy-CEVekpby.mjs.map} +1 -1
- package/dist/{types-NBI3rF-_.mjs → types-75KIqzL9.mjs} +18 -2
- package/dist/types-75KIqzL9.mjs.map +1 -0
- package/dist/{types-CbUcuxxc.d.mts → types-BPuloofb.d.mts} +1 -1
- package/dist/{types-CbUcuxxc.d.mts.map → types-BPuloofb.d.mts.map} +1 -1
- package/dist/{types-BjxTKxrZ.mjs → types-BW1syrlw.mjs} +1 -1
- package/dist/{types-BjxTKxrZ.mjs.map → types-BW1syrlw.mjs.map} +1 -1
- package/dist/{types-BnFP1M3J.d.mts → types-C3_AbkDP.d.mts} +32 -10
- package/dist/types-C3_AbkDP.d.mts.map +1 -0
- package/dist/{types-Dc4ntQjQ.d.mts → types-CAGdePf3.d.mts} +124 -1
- package/dist/types-CAGdePf3.d.mts.map +1 -0
- package/dist/{types-DLG4IFEQ.d.mts → types-CFUfyt1s.d.mts} +1 -1
- package/dist/{types-DLG4IFEQ.d.mts.map → types-CFUfyt1s.d.mts.map} +1 -1
- package/dist/{types-LoagAGzH.d.mts → types-CPx2lIGo.d.mts} +1 -1
- package/dist/{types-LoagAGzH.d.mts.map → types-CPx2lIGo.d.mts.map} +1 -1
- package/dist/{types-Cd8iuS1J.mjs → types-CQPWhPxE.mjs} +9 -12
- package/dist/types-CQPWhPxE.mjs.map +1 -0
- package/dist/{types-Cz8hNch2.d.mts → types-Cs-TFLNf.d.mts} +25 -5
- package/dist/types-Cs-TFLNf.d.mts.map +1 -0
- package/dist/types-CtzytVXn.mjs.map +1 -1
- package/dist/{types-BGWPMiBO.d.mts → types-D4_1Ga4L.d.mts} +44 -5
- package/dist/types-D4_1Ga4L.d.mts.map +1 -0
- package/dist/{types-C8oz_ayJ.d.mts → types-DefV3OiO.d.mts} +1 -1
- package/dist/{types-C8oz_ayJ.d.mts.map → types-DefV3OiO.d.mts.map} +1 -1
- package/dist/{types-BK6U01Ro.d.mts → types-X0MThr7x.d.mts} +1 -1
- package/dist/{types-BK6U01Ro.d.mts.map → types-X0MThr7x.d.mts.map} +1 -1
- package/dist/{upload-attempts-D8QAFLUJ.mjs → upload-attempts-hlne3iA1.mjs} +1 -1
- package/dist/{upload-attempts-D8QAFLUJ.mjs.map → upload-attempts-hlne3iA1.mjs.map} +1 -1
- package/dist/url-pattern-BHS0V5Ng.mjs +33 -0
- package/dist/url-pattern-BHS0V5Ng.mjs.map +1 -0
- package/dist/{user-DBrq4UVq.mjs → user-sHgJ62SP.mjs} +3 -3
- package/dist/{user-DBrq4UVq.mjs.map → user-sHgJ62SP.mjs.map} +1 -1
- package/dist/{utils-hLzi_2Fn.mjs → utils-D4vD_Y98.mjs} +3 -3
- package/dist/{utils-hLzi_2Fn.mjs.map → utils-D4vD_Y98.mjs.map} +1 -1
- package/dist/{validate-mKo3RxBM.mjs → validate-BkqIG_Uj.mjs} +24 -5
- package/dist/validate-BkqIG_Uj.mjs.map +1 -0
- package/dist/{validate-C3oSmA7F.d.mts → validate-DeGtBN84.d.mts} +15 -7
- package/dist/validate-DeGtBN84.d.mts.map +1 -0
- package/dist/{validation-BgpucsvF.mjs → validation-CiJb_X5o.mjs} +11 -10
- package/dist/{validation-BgpucsvF.mjs.map → validation-CiJb_X5o.mjs.map} +1 -1
- package/dist/version-x0NjTScG.mjs +7 -0
- package/dist/{version-C4PnpmoV.mjs.map → version-x0NjTScG.mjs.map} +1 -1
- package/dist/{widgets-CJJtkiKh.mjs → widgets-Cwzvww0W.mjs} +3 -3
- package/dist/{widgets-CJJtkiKh.mjs.map → widgets-Cwzvww0W.mjs.map} +1 -1
- package/dist/{wxr-taxonomies-Bkpp_2tK.d.mts → wxr-taxonomies-CmC0ZsDr.d.mts} +1 -1
- package/dist/{wxr-taxonomies-Bkpp_2tK.d.mts.map → wxr-taxonomies-CmC0ZsDr.d.mts.map} +1 -1
- package/dist/{wxr-taxonomies-9PPSy8X6.mjs → wxr-taxonomies-QZjWxjyk.mjs} +13 -32
- package/dist/{wxr-taxonomies-9PPSy8X6.mjs.map → wxr-taxonomies-QZjWxjyk.mjs.map} +1 -1
- package/dist/{zod-generator-CG64Hnbh.mjs → zod-generator-D11MhxG4.mjs} +52 -5
- package/dist/zod-generator-D11MhxG4.mjs.map +1 -0
- package/package.json +16 -8
- package/src/api/errors.ts +12 -0
- package/src/api/handlers/content.ts +127 -29
- package/src/api/handlers/dashboard.ts +12 -2
- package/src/api/handlers/index.ts +16 -0
- package/src/api/handlers/manifest.ts +2 -0
- package/src/api/handlers/media-allowlist.ts +13 -2
- package/src/api/handlers/media-usage-work.ts +188 -0
- package/src/api/handlers/media-usage.ts +5 -3
- package/src/api/handlers/schema.ts +9 -3
- package/src/api/handlers/seo.ts +5 -2
- package/src/api/handlers/taxonomies.ts +345 -82
- package/src/api/media-usage-write-fence.ts +64 -0
- package/src/api/openapi/document.ts +199 -0
- package/src/api/schemas/common.ts +3 -1
- package/src/api/schemas/content.ts +122 -1
- package/src/api/schemas/media-usage.ts +133 -0
- package/src/api/schemas/schema.ts +78 -3
- package/src/api/schemas/taxonomies.ts +40 -8
- package/src/api/types.ts +1 -0
- package/src/astro/integration/index.ts +55 -42
- package/src/astro/integration/routes.ts +34 -4
- package/src/astro/integration/runtime.ts +15 -0
- package/src/astro/integration/virtual-modules.ts +25 -1
- package/src/astro/integration/vite-config.ts +16 -1
- package/src/astro/middleware/media-usage-write-fence.ts +30 -0
- package/src/astro/middleware/redirect.ts +12 -2
- package/src/astro/middleware.ts +75 -8
- package/src/astro/routes/api/admin/media-usage/collection-deletions/index.ts +22 -0
- package/src/astro/routes/api/admin/media-usage/collection-deletions/retry.ts +22 -0
- package/src/astro/routes/api/admin/media-usage/work/index.ts +26 -0
- package/src/astro/routes/api/admin/media-usage/work/retry.ts +26 -0
- package/src/astro/routes/api/admin/plugins/[id]/disable.ts +4 -0
- package/src/astro/routes/api/admin/plugins/[id]/enable.ts +4 -0
- package/src/astro/routes/api/admin/plugins/[id]/uninstall.ts +4 -0
- package/src/astro/routes/api/admin/plugins/[id]/update.ts +4 -0
- package/src/astro/routes/api/admin/plugins/marketplace/[id]/install.ts +4 -0
- package/src/astro/routes/api/admin/plugins/registry/[id]/uninstall.ts +4 -0
- package/src/astro/routes/api/admin/plugins/registry/[id]/update.ts +4 -0
- package/src/astro/routes/api/admin/plugins/registry/install.ts +4 -0
- package/src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts +67 -31
- package/src/astro/routes/api/import/wordpress/execute.ts +3 -10
- package/src/astro/routes/api/mcp.ts +1 -0
- package/src/astro/routes/api/plugins/[pluginId]/[...path].ts +7 -1
- package/src/astro/routes/api/schema/collections/[slug]/index.ts +1 -7
- package/src/astro/routes/api/taxonomies/[name]/terms/index.ts +1 -0
- package/src/astro/routes/api/taxonomies/[name]/translations.ts +48 -0
- package/src/astro/routes/api/taxonomies/[name].ts +102 -0
- package/src/astro/types.ts +25 -4
- package/src/cleanup.ts +6 -12
- package/src/cli/commands/doctor.ts +193 -6
- package/src/cli/commands/export-seed.ts +4 -1
- package/src/client/index.ts +119 -0
- package/src/components/Block.astro +12 -0
- package/src/components/InlinePortableTextEditor.tsx +89 -1
- package/src/content/converters/mark-safety.ts +120 -0
- package/src/content/converters/portable-text-to-prosemirror.ts +25 -16
- package/src/content/converters/prosemirror-to-portable-text.ts +12 -2
- package/src/content-list-query.ts +29 -0
- package/src/database/migrations/060_collection_admin_config.ts +16 -0
- package/src/database/migrations/061_media_usage_cleanup.ts +77 -0
- package/src/database/migrations/062_media_usage_cleanup_fence.ts +295 -0
- package/src/database/migrations/063_media_usage_incremental_work.ts +397 -0
- package/src/database/migrations/064_fts_plain_text.ts +253 -0
- package/src/database/migrations/065_media_usage_collection_deletion.ts +85 -0
- package/src/database/migrations/066_media_usage_reconciliation.ts +115 -0
- package/src/database/migrations/067_indexed_content_fields.ts +39 -0
- package/src/database/migrations/068_content_taxonomy_entry_groups.ts +61 -0
- package/src/database/migrations/069_collection_title_date_fields.ts +45 -0
- package/src/database/migrations/070_collection_routable.ts +18 -0
- package/src/database/migrations/runner.ts +22 -0
- package/src/database/repositories/content.ts +861 -96
- package/src/database/repositories/media-usage-work.ts +848 -0
- package/src/database/repositories/media-usage.ts +1502 -138
- package/src/database/repositories/revision.ts +17 -6
- package/src/database/repositories/taxonomy.ts +234 -103
- package/src/database/repositories/types.ts +51 -2
- package/src/database/types.ts +134 -16
- package/src/db/adapters.ts +28 -0
- package/src/db/index.ts +3 -0
- package/src/emdash-runtime.ts +227 -20
- package/src/fields/file.ts +7 -4
- package/src/fields/image.ts +8 -1
- package/src/fields/types.ts +18 -5
- package/src/i18n/config.ts +32 -0
- package/src/i18n/repair-locale-casing.ts +0 -14
- package/src/i18n/taxonomy-locale-diagnostic.ts +47 -0
- package/src/import/wxr-taxonomies.ts +7 -47
- package/src/index.ts +25 -2
- package/src/loader.ts +119 -65
- package/src/mcp/server.ts +242 -34
- package/src/media/usage/activation.ts +626 -0
- package/src/media/usage/capture-triggers.ts +543 -0
- package/src/media/usage/cleanup.ts +305 -0
- package/src/media/usage/collection-deletion-processor.ts +356 -0
- package/src/media/usage/collection-deletion.ts +836 -0
- package/src/media/usage/content-fields.ts +40 -3
- package/src/media/usage/content-refresh.ts +356 -47
- package/src/media/usage/content-repair.ts +180 -61
- package/src/media/usage/content-snapshots.ts +85 -105
- package/src/media/usage/projection-fingerprint.ts +129 -0
- package/src/media/usage/reconciliation-processor.ts +372 -0
- package/src/media/usage/reconciliation.ts +1117 -0
- package/src/media/usage/source-key.ts +4 -0
- package/src/media/usage/types.ts +2 -0
- package/src/media/usage/work-processor.ts +248 -0
- package/src/menus/index.ts +246 -141
- package/src/plugin-types.ts +8 -0
- package/src/plugins/adapt-sandbox-entry.ts +24 -5
- package/src/plugins/context.ts +24 -7
- package/src/plugins/index.ts +9 -0
- package/src/plugins/routes.ts +43 -1
- package/src/plugins/sandbox/index.ts +10 -1
- package/src/plugins/sandbox/types.ts +78 -1
- package/src/plugins/scheduler/node.ts +13 -1
- package/src/plugins/scheduler/types.ts +2 -0
- package/src/plugins/types.ts +39 -2
- package/src/query.ts +29 -37
- package/src/scheduler-health.ts +46 -0
- package/src/schema/registry.ts +777 -255
- package/src/schema/types.ts +50 -8
- package/src/schema/url-pattern.ts +33 -0
- package/src/schema/zod-generator.ts +77 -5
- package/src/search/fts-manager.ts +117 -76
- package/src/search/query.ts +32 -11
- package/src/search/types.ts +2 -0
- package/src/seed/apply.ts +68 -15
- package/src/seed/types.ts +11 -3
- package/src/seed/validate.ts +52 -2
- package/src/taxonomies/index.ts +77 -75
- package/src/taxonomies/term-counts.ts +21 -8
- package/src/utils/slugify.ts +1 -29
- package/src/virtual-modules.d.ts +16 -0
- package/dist/adapters-BMyNSSZi.d.mts.map +0 -1
- package/dist/api-D2hunekQ.mjs.map +0 -1
- package/dist/apply-kwNEJW2l.mjs.map +0 -1
- package/dist/config-DyF3OKg_.mjs.map +0 -1
- package/dist/content-CJ94NEx5.mjs.map +0 -1
- package/dist/content-refresh-Xw7aKmou.mjs +0 -1629
- package/dist/content-refresh-Xw7aKmou.mjs.map +0 -1
- package/dist/context-C_1nrqnW.mjs.map +0 -1
- package/dist/dashboard-DINnNVVU.mjs.map +0 -1
- package/dist/errors-BucQ8VYz.mjs.map +0 -1
- package/dist/fts-manager-BITakW_R.mjs.map +0 -1
- package/dist/index-M37iz29I.d.mts.map +0 -1
- package/dist/index-MGw47uWq.d.mts.map +0 -1
- package/dist/loader-CGugY7Zl.mjs.map +0 -1
- package/dist/media-OhYL-7Io.mjs.map +0 -1
- package/dist/media-allowlist-D-peH1H5.mjs.map +0 -1
- package/dist/media-usage-BlxfTkN0.mjs.map +0 -1
- package/dist/menus-Y54RDPIN.mjs.map +0 -1
- package/dist/options-CA4eVX6P.d.mts.map +0 -1
- package/dist/query-C5w7PsRQ.mjs.map +0 -1
- package/dist/redirects-G8wAhWAf.mjs.map +0 -1
- package/dist/registry-Dbodb4Uo.mjs +0 -840
- package/dist/registry-Dbodb4Uo.mjs.map +0 -1
- package/dist/relations-G2ta7GIl.d.mts.map +0 -1
- package/dist/runner-BFTrkYhu.mjs.map +0 -1
- package/dist/search-FZhx5dDU.mjs.map +0 -1
- package/dist/seo-CobNfOvb.mjs.map +0 -1
- package/dist/slugify-C_tqlU4G.mjs +0 -30
- package/dist/slugify-C_tqlU4G.mjs.map +0 -1
- package/dist/taxonomies-CKuaZER5.mjs.map +0 -1
- package/dist/taxonomies-CLN1N92E.mjs.map +0 -1
- package/dist/taxonomy-pOrB2kZe.mjs.map +0 -1
- package/dist/types-BGWPMiBO.d.mts.map +0 -1
- package/dist/types-BnFP1M3J.d.mts.map +0 -1
- package/dist/types-Cd8iuS1J.mjs.map +0 -1
- package/dist/types-Cz8hNch2.d.mts.map +0 -1
- package/dist/types-Dc4ntQjQ.d.mts.map +0 -1
- package/dist/types-NBI3rF-_.mjs.map +0 -1
- package/dist/validate-C3oSmA7F.d.mts.map +0 -1
- package/dist/validate-mKo3RxBM.mjs.map +0 -1
- package/dist/version-C4PnpmoV.mjs +0 -7
- package/dist/zod-generator-CG64Hnbh.mjs.map +0 -1
- /package/dist/{api-tokens-Dai9dND0.mjs → api-tokens-CyTsLszZ.mjs} +0 -0
- /package/dist/{ssrf-Cj568Dgs.mjs → ssrf-DpXgKsna.mjs} +0 -0
- /package/dist/{types-DKuWPYV5.mjs → types-CP1CflWf.mjs} +0 -0
|
@@ -1,840 +0,0 @@
|
|
|
1
|
-
import { o as __exportAll } from "./runner-BFTrkYhu.mjs";
|
|
2
|
-
import { t as validateIdentifier } from "./validate-BpwoDOgt.mjs";
|
|
3
|
-
import { a as currentTimestamp, p as tableExists, u as listTablesLike } from "./dialect-helpers-BSbfaO3F.mjs";
|
|
4
|
-
import { n as chunks, t as SQL_BATCH_SIZE } from "./chunks-DbYzib_k.mjs";
|
|
5
|
-
import { t as withTransaction } from "./transaction-NQj4VJ7Z.mjs";
|
|
6
|
-
import { a as RESERVED_COLLECTION_SLUGS, o as RESERVED_FIELD_SLUGS, r as FIELD_TYPE_TO_COLUMN } from "./types-NBI3rF-_.mjs";
|
|
7
|
-
import { t as FTSManager } from "./fts-manager-BITakW_R.mjs";
|
|
8
|
-
import { i as deleteContentMediaUsageCollection, s as markContentMediaUsageCollectionStaleSafely } from "./content-refresh-Xw7aKmou.mjs";
|
|
9
|
-
import { sql } from "kysely";
|
|
10
|
-
import { ulid } from "ulidx";
|
|
11
|
-
|
|
12
|
-
//#region src/schema/registry.ts
|
|
13
|
-
var registry_exports = /* @__PURE__ */ __exportAll({
|
|
14
|
-
SchemaError: () => SchemaError,
|
|
15
|
-
SchemaRegistry: () => SchemaRegistry
|
|
16
|
-
});
|
|
17
|
-
const SLUG_VALIDATION_PATTERN = /^[a-z][a-z0-9_]*$/;
|
|
18
|
-
const EC_PREFIX_PATTERN = /^ec_/;
|
|
19
|
-
const SINGLE_QUOTE_PATTERN = /'/g;
|
|
20
|
-
const UNDERSCORE_PATTERN = /_/g;
|
|
21
|
-
const WORD_BOUNDARY_PATTERN = /\b\w/g;
|
|
22
|
-
/** Valid column types for runtime validation */
|
|
23
|
-
const COLUMN_TYPES = new Set([
|
|
24
|
-
"TEXT",
|
|
25
|
-
"REAL",
|
|
26
|
-
"INTEGER",
|
|
27
|
-
"JSON"
|
|
28
|
-
]);
|
|
29
|
-
const COLUMN_TYPE_TO_DATA_TYPE = {
|
|
30
|
-
TEXT: "text",
|
|
31
|
-
REAL: "real",
|
|
32
|
-
INTEGER: "integer",
|
|
33
|
-
JSON: "json"
|
|
34
|
-
};
|
|
35
|
-
/** Valid collection source prefixes/values */
|
|
36
|
-
const VALID_SOURCES = new Set([
|
|
37
|
-
"manual",
|
|
38
|
-
"discovered",
|
|
39
|
-
"seed"
|
|
40
|
-
]);
|
|
41
|
-
function isCollectionSource(value) {
|
|
42
|
-
return VALID_SOURCES.has(value) || value.startsWith("template:") || value.startsWith("import:");
|
|
43
|
-
}
|
|
44
|
-
function isFieldType(value) {
|
|
45
|
-
return value in FIELD_TYPE_TO_COLUMN;
|
|
46
|
-
}
|
|
47
|
-
function isColumnType(value) {
|
|
48
|
-
return COLUMN_TYPES.has(value);
|
|
49
|
-
}
|
|
50
|
-
const VALID_COLLECTION_SUPPORTS = new Set([
|
|
51
|
-
"drafts",
|
|
52
|
-
"revisions",
|
|
53
|
-
"preview",
|
|
54
|
-
"scheduling",
|
|
55
|
-
"search",
|
|
56
|
-
"seo"
|
|
57
|
-
]);
|
|
58
|
-
const SEED_FIELD_INSERT_BATCH_SIZE = 6;
|
|
59
|
-
/**
|
|
60
|
-
* Collection ordering shared by every list read: explicit `sort_order`
|
|
61
|
-
* first (ascending), then alphabetically by slug.
|
|
62
|
-
*/
|
|
63
|
-
const collectionOrder = sql`coalesce(sort_order, ${sql.lit(2147483647)})`;
|
|
64
|
-
function isCollectionSupport(value) {
|
|
65
|
-
return typeof value === "string" && VALID_COLLECTION_SUPPORTS.has(value);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Parse a collection's `supports` column (stored as a JSON array of
|
|
69
|
-
* CollectionSupport keys). Unknown/invalid entries are filtered out so the
|
|
70
|
-
* runtime value matches the declared `CollectionSupport[]` type.
|
|
71
|
-
*
|
|
72
|
-
* Throws on malformed JSON so corruption surfaces loudly; returns an empty
|
|
73
|
-
* array only for explicitly null/empty values or non-array JSON.
|
|
74
|
-
*/
|
|
75
|
-
function parseSupports(raw) {
|
|
76
|
-
if (!raw) return [];
|
|
77
|
-
const parsed = JSON.parse(raw);
|
|
78
|
-
if (!Array.isArray(parsed)) return [];
|
|
79
|
-
return parsed.filter(isCollectionSupport);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Error thrown when a schema operation fails
|
|
83
|
-
*/
|
|
84
|
-
var SchemaError = class extends Error {
|
|
85
|
-
constructor(message, code, details) {
|
|
86
|
-
super(message);
|
|
87
|
-
this.code = code;
|
|
88
|
-
this.details = details;
|
|
89
|
-
this.name = "SchemaError";
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Schema Registry
|
|
94
|
-
*
|
|
95
|
-
* Manages collection and field definitions stored in D1.
|
|
96
|
-
* Handles runtime DDL operations (CREATE TABLE, ALTER TABLE).
|
|
97
|
-
*/
|
|
98
|
-
var SchemaRegistry = class {
|
|
99
|
-
constructor(db) {
|
|
100
|
-
this.db = db;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* List all collections
|
|
104
|
-
*/
|
|
105
|
-
async listCollections() {
|
|
106
|
-
return (await this.db.selectFrom("_emdash_collections").selectAll().orderBy(collectionOrder, "asc").orderBy("slug", "asc").execute()).map(this.mapCollectionRow);
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Get a collection by slug
|
|
110
|
-
*/
|
|
111
|
-
async getCollection(slug) {
|
|
112
|
-
const row = await this.db.selectFrom("_emdash_collections").where("slug", "=", slug).selectAll().executeTakeFirst();
|
|
113
|
-
return row ? this.mapCollectionRow(row) : null;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Get a collection with all its fields
|
|
117
|
-
*/
|
|
118
|
-
async getCollectionWithFields(slug) {
|
|
119
|
-
const collection = await this.getCollection(slug);
|
|
120
|
-
if (!collection) return null;
|
|
121
|
-
const fields = await this.listFields(collection.id);
|
|
122
|
-
return {
|
|
123
|
-
...collection,
|
|
124
|
-
fields
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* List every collection together with its fields in O(1) query shapes
|
|
129
|
-
* — one for collections, then one batched query for the fields of every
|
|
130
|
-
* returned collection — instead of the N+1 pattern of `listCollections`
|
|
131
|
-
* + per-collection `listFields`. The fields query is chunked at
|
|
132
|
-
* `SQL_BATCH_SIZE` to stay under D1's bound-parameter limit, so on
|
|
133
|
-
* sites with more than `SQL_BATCH_SIZE` collections the field fetch
|
|
134
|
-
* becomes `ceil(collectionCount / SQL_BATCH_SIZE)` queries — still
|
|
135
|
-
* a constant factor, not N+1. Typical sites have well under
|
|
136
|
-
* `SQL_BATCH_SIZE` collections, so this is two queries in practice.
|
|
137
|
-
*
|
|
138
|
-
* Used by the manifest build, which previously paid N+1 round-trips on
|
|
139
|
-
* every admin request. Each round-trip costs ~80–150ms against the D1
|
|
140
|
-
* primary on a busy link, so a 10-collection site spent ~1 s rebuilding
|
|
141
|
-
* a manifest that is now built fresh per admin request (no cache).
|
|
142
|
-
*/
|
|
143
|
-
async listCollectionsWithFields() {
|
|
144
|
-
const collectionRows = await this.db.selectFrom("_emdash_collections").selectAll().orderBy(collectionOrder, "asc").orderBy("slug", "asc").execute();
|
|
145
|
-
if (collectionRows.length === 0) return [];
|
|
146
|
-
const fieldsByCollection = /* @__PURE__ */ new Map();
|
|
147
|
-
for (const idChunk of chunks(collectionRows.map((c) => c.id), SQL_BATCH_SIZE)) {
|
|
148
|
-
const fieldRows = await this.db.selectFrom("_emdash_fields").where("collection_id", "in", idChunk).selectAll().orderBy("collection_id", "asc").orderBy("sort_order", "asc").orderBy("created_at", "asc").execute();
|
|
149
|
-
for (const row of fieldRows) {
|
|
150
|
-
const list = fieldsByCollection.get(row.collection_id) ?? [];
|
|
151
|
-
list.push(this.mapFieldRow(row));
|
|
152
|
-
fieldsByCollection.set(row.collection_id, list);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
return collectionRows.map((c) => ({
|
|
156
|
-
...this.mapCollectionRow(c),
|
|
157
|
-
fields: fieldsByCollection.get(c.id) ?? []
|
|
158
|
-
}));
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Create a new collection
|
|
162
|
-
*/
|
|
163
|
-
async createCollection(input) {
|
|
164
|
-
this.validateSlug(input.slug, "collection");
|
|
165
|
-
if (RESERVED_COLLECTION_SLUGS.includes(input.slug)) throw new SchemaError(`Collection slug "${input.slug}" is reserved`, "RESERVED_SLUG");
|
|
166
|
-
if (await this.getCollection(input.slug)) throw new SchemaError(`Collection "${input.slug}" already exists`, "COLLECTION_EXISTS");
|
|
167
|
-
const id = ulid();
|
|
168
|
-
const supports = input.supports ?? ["drafts", "revisions"];
|
|
169
|
-
const hasSeo = input.hasSeo ?? supports.includes("seo") ?? false;
|
|
170
|
-
await withTransaction(this.db, async (trx) => {
|
|
171
|
-
await trx.insertInto("_emdash_collections").values({
|
|
172
|
-
id,
|
|
173
|
-
slug: input.slug,
|
|
174
|
-
label: input.label,
|
|
175
|
-
label_singular: input.labelSingular ?? null,
|
|
176
|
-
description: input.description ?? null,
|
|
177
|
-
icon: input.icon ?? null,
|
|
178
|
-
supports: JSON.stringify(supports),
|
|
179
|
-
source: input.source ?? "manual",
|
|
180
|
-
has_seo: hasSeo ? 1 : 0,
|
|
181
|
-
hidden: input.hidden ? 1 : 0,
|
|
182
|
-
sort_order: input.sortOrder ?? null,
|
|
183
|
-
comments_enabled: input.commentsEnabled ? 1 : 0,
|
|
184
|
-
url_pattern: input.urlPattern ?? null
|
|
185
|
-
}).execute();
|
|
186
|
-
await this.createContentTable(input.slug, trx);
|
|
187
|
-
});
|
|
188
|
-
const collection = await this.getCollection(input.slug);
|
|
189
|
-
if (!collection) throw new SchemaError("Failed to create collection", "CREATE_FAILED");
|
|
190
|
-
return collection;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Create a seed-owned collection and all of its fields in bulk.
|
|
194
|
-
*
|
|
195
|
-
* Fresh seeds can define dozens of fields. Creating them through
|
|
196
|
-
* `createField` performs multiple reads, one ALTER TABLE, and one media
|
|
197
|
-
* usage invalidation per field, which can exhaust D1's per-request query
|
|
198
|
-
* budget. This path validates the full schema before mutating it, creates
|
|
199
|
-
* the complete content table in one statement, and inserts field metadata
|
|
200
|
-
* in parameter-safe batches.
|
|
201
|
-
*/
|
|
202
|
-
async createSeedCollection(input, fields) {
|
|
203
|
-
this.validateSlug(input.slug, "collection");
|
|
204
|
-
if (RESERVED_COLLECTION_SLUGS.includes(input.slug)) throw new SchemaError(`Collection slug "${input.slug}" is reserved`, "RESERVED_SLUG");
|
|
205
|
-
if (await this.getCollection(input.slug)) throw new SchemaError(`Collection "${input.slug}" already exists`, "COLLECTION_EXISTS");
|
|
206
|
-
const fieldSlugs = /* @__PURE__ */ new Set();
|
|
207
|
-
for (const field of fields) {
|
|
208
|
-
this.validateSlug(field.slug, "field");
|
|
209
|
-
if (RESERVED_FIELD_SLUGS.includes(field.slug)) throw new SchemaError(`Field slug "${field.slug}" is reserved`, "RESERVED_SLUG");
|
|
210
|
-
if (fieldSlugs.has(field.slug)) throw new SchemaError(`Field "${field.slug}" already exists in collection "${input.slug}"`, "FIELD_EXISTS");
|
|
211
|
-
fieldSlugs.add(field.slug);
|
|
212
|
-
}
|
|
213
|
-
const collectionId = ulid();
|
|
214
|
-
const supports = input.supports ?? ["drafts", "revisions"];
|
|
215
|
-
const hasSeo = input.hasSeo ?? supports.includes("seo") ?? false;
|
|
216
|
-
let maxSortOrder = -1;
|
|
217
|
-
const fieldRows = fields.map((field) => {
|
|
218
|
-
const sortOrder = field.sortOrder ?? maxSortOrder + 1;
|
|
219
|
-
maxSortOrder = Math.max(maxSortOrder, sortOrder);
|
|
220
|
-
return {
|
|
221
|
-
id: ulid(),
|
|
222
|
-
collection_id: collectionId,
|
|
223
|
-
slug: field.slug,
|
|
224
|
-
label: field.label,
|
|
225
|
-
type: field.type,
|
|
226
|
-
column_type: FIELD_TYPE_TO_COLUMN[field.type],
|
|
227
|
-
required: field.required ? 1 : 0,
|
|
228
|
-
unique: field.unique ? 1 : 0,
|
|
229
|
-
default_value: field.defaultValue !== void 0 ? JSON.stringify(field.defaultValue) : null,
|
|
230
|
-
validation: field.validation ? JSON.stringify(field.validation) : null,
|
|
231
|
-
widget: field.widget ?? null,
|
|
232
|
-
options: field.options ? JSON.stringify(field.options) : null,
|
|
233
|
-
sort_order: sortOrder,
|
|
234
|
-
searchable: field.searchable ? 1 : 0,
|
|
235
|
-
translatable: field.translatable === false ? 0 : 1
|
|
236
|
-
};
|
|
237
|
-
});
|
|
238
|
-
let schemaMutated = false;
|
|
239
|
-
try {
|
|
240
|
-
await withTransaction(this.db, async (trx) => {
|
|
241
|
-
await trx.insertInto("_emdash_collections").values({
|
|
242
|
-
id: collectionId,
|
|
243
|
-
slug: input.slug,
|
|
244
|
-
label: input.label,
|
|
245
|
-
label_singular: input.labelSingular ?? null,
|
|
246
|
-
description: input.description ?? null,
|
|
247
|
-
icon: input.icon ?? null,
|
|
248
|
-
supports: JSON.stringify(supports),
|
|
249
|
-
source: "seed",
|
|
250
|
-
has_seo: hasSeo ? 1 : 0,
|
|
251
|
-
hidden: input.hidden ? 1 : 0,
|
|
252
|
-
sort_order: input.sortOrder ?? null,
|
|
253
|
-
comments_enabled: input.commentsEnabled ? 1 : 0,
|
|
254
|
-
url_pattern: input.urlPattern ?? null
|
|
255
|
-
}).execute();
|
|
256
|
-
schemaMutated = true;
|
|
257
|
-
await this.createContentTable(input.slug, trx, fields);
|
|
258
|
-
for (const fieldBatch of chunks(fieldRows, SEED_FIELD_INSERT_BATCH_SIZE)) await trx.insertInto("_emdash_fields").values(fieldBatch).execute();
|
|
259
|
-
});
|
|
260
|
-
await markContentMediaUsageCollectionStaleSafely(this.db, input.slug, "CONTENT_USAGE_STALE");
|
|
261
|
-
} catch (error) {
|
|
262
|
-
if (schemaMutated) await markContentMediaUsageCollectionStaleSafely(this.db, input.slug, "CONTENT_USAGE_STALE");
|
|
263
|
-
throw error;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Update a collection
|
|
268
|
-
*/
|
|
269
|
-
async updateCollection(slug, input) {
|
|
270
|
-
const existing = await this.getCollection(slug);
|
|
271
|
-
if (!existing) throw new SchemaError(`Collection "${slug}" not found`, "COLLECTION_NOT_FOUND");
|
|
272
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
273
|
-
const supportsArray = input.supports ?? existing.supports;
|
|
274
|
-
const hasSeo = input.hasSeo !== void 0 ? input.hasSeo : input.supports !== void 0 ? supportsArray.includes("seo") : existing.hasSeo;
|
|
275
|
-
return withTransaction(this.db, async (trx) => {
|
|
276
|
-
await trx.updateTable("_emdash_collections").set({
|
|
277
|
-
label: input.label ?? existing.label,
|
|
278
|
-
label_singular: input.labelSingular ?? existing.labelSingular ?? null,
|
|
279
|
-
description: input.description ?? existing.description ?? null,
|
|
280
|
-
icon: input.icon ?? existing.icon ?? null,
|
|
281
|
-
supports: input.supports ? JSON.stringify(input.supports) : JSON.stringify(existing.supports),
|
|
282
|
-
url_pattern: input.urlPattern !== void 0 ? input.urlPattern ?? null : existing.urlPattern ?? null,
|
|
283
|
-
has_seo: hasSeo ? 1 : 0,
|
|
284
|
-
hidden: input.hidden !== void 0 ? input.hidden ? 1 : 0 : existing.hidden ? 1 : 0,
|
|
285
|
-
sort_order: input.sortOrder !== void 0 ? input.sortOrder : existing.sortOrder ?? null,
|
|
286
|
-
comments_enabled: input.commentsEnabled !== void 0 ? input.commentsEnabled ? 1 : 0 : existing.commentsEnabled ? 1 : 0,
|
|
287
|
-
comments_moderation: input.commentsModeration ?? existing.commentsModeration,
|
|
288
|
-
comments_closed_after_days: input.commentsClosedAfterDays !== void 0 ? input.commentsClosedAfterDays : existing.commentsClosedAfterDays,
|
|
289
|
-
comments_auto_approve_users: input.commentsAutoApproveUsers !== void 0 ? input.commentsAutoApproveUsers ? 1 : 0 : existing.commentsAutoApproveUsers ? 1 : 0,
|
|
290
|
-
updated_at: now
|
|
291
|
-
}).where("slug", "=", slug).execute();
|
|
292
|
-
const row = await trx.selectFrom("_emdash_collections").where("slug", "=", slug).selectAll().executeTakeFirst();
|
|
293
|
-
if (!row) throw new SchemaError("Failed to update collection", "UPDATE_FAILED");
|
|
294
|
-
if (input.supports !== void 0) {
|
|
295
|
-
if (existing.supports.includes("search") !== parseSupports(row.supports).includes("search")) await this.syncSearchState(slug, trx);
|
|
296
|
-
}
|
|
297
|
-
return this.mapCollectionRow(row);
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* Delete a collection
|
|
302
|
-
*/
|
|
303
|
-
async deleteCollection(slug, options) {
|
|
304
|
-
const existing = await this.getCollection(slug);
|
|
305
|
-
if (!existing) throw new SchemaError(`Collection "${slug}" not found`, "COLLECTION_NOT_FOUND");
|
|
306
|
-
if (!options?.force) {
|
|
307
|
-
if (await this.collectionHasContent(slug)) throw new SchemaError(`Collection "${slug}" has content. Use force: true to delete.`, "COLLECTION_HAS_CONTENT");
|
|
308
|
-
}
|
|
309
|
-
let contentTableDropped = false;
|
|
310
|
-
try {
|
|
311
|
-
await withTransaction(this.db, async (trx) => {
|
|
312
|
-
await new FTSManager(trx).dropFtsTable(slug);
|
|
313
|
-
const tableName = this.getTableName(slug);
|
|
314
|
-
await sql`DROP TABLE IF EXISTS ${sql.ref(tableName)}`.execute(trx);
|
|
315
|
-
contentTableDropped = true;
|
|
316
|
-
await trx.deleteFrom("_emdash_collections").where("id", "=", existing.id).execute();
|
|
317
|
-
});
|
|
318
|
-
await deleteContentMediaUsageCollection(this.db, slug);
|
|
319
|
-
} catch (error) {
|
|
320
|
-
if (contentTableDropped && !await tableExists(this.db, this.getTableName(slug))) await deleteContentMediaUsageCollection(this.db, slug);
|
|
321
|
-
throw error;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* List fields for a collection
|
|
326
|
-
*/
|
|
327
|
-
async listFields(collectionId) {
|
|
328
|
-
return (await this.db.selectFrom("_emdash_fields").where("collection_id", "=", collectionId).selectAll().orderBy("sort_order", "asc").orderBy("created_at", "asc").execute()).map(this.mapFieldRow);
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Get a field by slug within a collection
|
|
332
|
-
*/
|
|
333
|
-
async getField(collectionSlug, fieldSlug) {
|
|
334
|
-
const collection = await this.getCollection(collectionSlug);
|
|
335
|
-
if (!collection) return null;
|
|
336
|
-
const row = await this.db.selectFrom("_emdash_fields").where("collection_id", "=", collection.id).where("slug", "=", fieldSlug).selectAll().executeTakeFirst();
|
|
337
|
-
return row ? this.mapFieldRow(row) : null;
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* Create a new field
|
|
341
|
-
*/
|
|
342
|
-
async createField(collectionSlug, input) {
|
|
343
|
-
const collection = await this.getCollection(collectionSlug);
|
|
344
|
-
if (!collection) throw new SchemaError(`Collection "${collectionSlug}" not found`, "COLLECTION_NOT_FOUND");
|
|
345
|
-
this.validateSlug(input.slug, "field");
|
|
346
|
-
if (RESERVED_FIELD_SLUGS.includes(input.slug)) throw new SchemaError(`Field slug "${input.slug}" is reserved`, "RESERVED_SLUG");
|
|
347
|
-
if (await this.getField(collectionSlug, input.slug)) throw new SchemaError(`Field "${input.slug}" already exists in collection "${collectionSlug}"`, "FIELD_EXISTS");
|
|
348
|
-
const id = ulid();
|
|
349
|
-
const columnType = FIELD_TYPE_TO_COLUMN[input.type];
|
|
350
|
-
const maxSort = await this.db.selectFrom("_emdash_fields").where("collection_id", "=", collection.id).select((eb) => eb.fn.max("sort_order").as("max")).executeTakeFirst();
|
|
351
|
-
const sortOrder = input.sortOrder ?? (maxSort?.max ?? -1) + 1;
|
|
352
|
-
let schemaMutated = false;
|
|
353
|
-
try {
|
|
354
|
-
const created = await withTransaction(this.db, async (trx) => {
|
|
355
|
-
await trx.insertInto("_emdash_fields").values({
|
|
356
|
-
id,
|
|
357
|
-
collection_id: collection.id,
|
|
358
|
-
slug: input.slug,
|
|
359
|
-
label: input.label,
|
|
360
|
-
type: input.type,
|
|
361
|
-
column_type: columnType,
|
|
362
|
-
required: input.required ? 1 : 0,
|
|
363
|
-
unique: input.unique ? 1 : 0,
|
|
364
|
-
default_value: input.defaultValue !== void 0 ? JSON.stringify(input.defaultValue) : null,
|
|
365
|
-
validation: input.validation ? JSON.stringify(input.validation) : null,
|
|
366
|
-
widget: input.widget ?? null,
|
|
367
|
-
options: input.options ? JSON.stringify(input.options) : null,
|
|
368
|
-
sort_order: sortOrder,
|
|
369
|
-
searchable: input.searchable ? 1 : 0,
|
|
370
|
-
translatable: input.translatable === false ? 0 : 1
|
|
371
|
-
}).execute();
|
|
372
|
-
schemaMutated = true;
|
|
373
|
-
await this.addColumn(collectionSlug, input.slug, input.type, {
|
|
374
|
-
required: input.required,
|
|
375
|
-
defaultValue: input.defaultValue
|
|
376
|
-
}, trx);
|
|
377
|
-
const fieldRow = await trx.selectFrom("_emdash_fields").where("collection_id", "=", collection.id).where("slug", "=", input.slug).selectAll().executeTakeFirst();
|
|
378
|
-
if (!fieldRow) throw new SchemaError("Failed to create field", "CREATE_FAILED");
|
|
379
|
-
const field = this.mapFieldRow(fieldRow);
|
|
380
|
-
if (input.searchable) await this.syncSearchState(collectionSlug, trx);
|
|
381
|
-
return field;
|
|
382
|
-
});
|
|
383
|
-
await markContentMediaUsageCollectionStaleSafely(this.db, collectionSlug, "CONTENT_USAGE_STALE");
|
|
384
|
-
return created;
|
|
385
|
-
} catch (error) {
|
|
386
|
-
if (schemaMutated) await markContentMediaUsageCollectionStaleSafely(this.db, collectionSlug, "CONTENT_USAGE_STALE");
|
|
387
|
-
throw error;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Update a field
|
|
392
|
-
*/
|
|
393
|
-
async updateField(collectionSlug, fieldSlug, input) {
|
|
394
|
-
const field = await this.getField(collectionSlug, fieldSlug);
|
|
395
|
-
if (!field) throw new SchemaError(`Field "${fieldSlug}" not found in collection "${collectionSlug}"`, "FIELD_NOT_FOUND");
|
|
396
|
-
const nextValidation = input.validation === void 0 ? field.validation : input.validation;
|
|
397
|
-
let nextType = field.type;
|
|
398
|
-
let nextColumnType = field.columnType;
|
|
399
|
-
if (input.type !== void 0 && input.type !== field.type) {
|
|
400
|
-
const newColumnType = FIELD_TYPE_TO_COLUMN[input.type];
|
|
401
|
-
if (newColumnType !== field.columnType) throw new SchemaError(`Cannot change field "${fieldSlug}" in collection "${collectionSlug}" from type "${field.type}" to "${input.type}": the underlying column type would change from ${field.columnType} to ${newColumnType}, which requires a manual content migration. Drop and re-create the field, or migrate the column data, before changing its type.`, "FIELD_TYPE_COLUMN_CHANGE");
|
|
402
|
-
nextType = input.type;
|
|
403
|
-
nextColumnType = newColumnType;
|
|
404
|
-
}
|
|
405
|
-
let schemaMutated = false;
|
|
406
|
-
try {
|
|
407
|
-
const updatedField = await withTransaction(this.db, async (trx) => {
|
|
408
|
-
await trx.updateTable("_emdash_fields").set({
|
|
409
|
-
type: nextType,
|
|
410
|
-
column_type: nextColumnType,
|
|
411
|
-
label: input.label ?? field.label,
|
|
412
|
-
required: input.required !== void 0 ? input.required ? 1 : 0 : field.required ? 1 : 0,
|
|
413
|
-
unique: input.unique !== void 0 ? input.unique ? 1 : 0 : field.unique ? 1 : 0,
|
|
414
|
-
searchable: input.searchable !== void 0 ? input.searchable ? 1 : 0 : field.searchable ? 1 : 0,
|
|
415
|
-
translatable: input.translatable !== void 0 ? input.translatable ? 1 : 0 : field.translatable ? 1 : 0,
|
|
416
|
-
default_value: input.defaultValue !== void 0 ? JSON.stringify(input.defaultValue) : field.defaultValue !== void 0 ? JSON.stringify(field.defaultValue) : null,
|
|
417
|
-
validation: nextValidation ? JSON.stringify(nextValidation) : null,
|
|
418
|
-
widget: input.widget ?? field.widget ?? null,
|
|
419
|
-
options: input.options ? JSON.stringify(input.options) : field.options ? JSON.stringify(field.options) : null,
|
|
420
|
-
sort_order: input.sortOrder ?? field.sortOrder
|
|
421
|
-
}).where("id", "=", field.id).execute();
|
|
422
|
-
schemaMutated = true;
|
|
423
|
-
const updatedRow = await trx.selectFrom("_emdash_fields").where("collection_id", "=", field.collectionId).where("slug", "=", fieldSlug).selectAll().executeTakeFirst();
|
|
424
|
-
if (!updatedRow) throw new SchemaError("Failed to update field", "UPDATE_FAILED");
|
|
425
|
-
const updated = this.mapFieldRow(updatedRow);
|
|
426
|
-
if (input.searchable !== void 0 && input.searchable !== field.searchable) await this.syncSearchState(collectionSlug, trx);
|
|
427
|
-
return updated;
|
|
428
|
-
});
|
|
429
|
-
await markContentMediaUsageCollectionStaleSafely(this.db, collectionSlug, "CONTENT_USAGE_STALE");
|
|
430
|
-
return updatedField;
|
|
431
|
-
} catch (error) {
|
|
432
|
-
if (schemaMutated) await markContentMediaUsageCollectionStaleSafely(this.db, collectionSlug, "CONTENT_USAGE_STALE");
|
|
433
|
-
throw error;
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
/**
|
|
437
|
-
* Synchronize an existing FTS index with the collection's current state.
|
|
438
|
-
*
|
|
439
|
-
* Only rebuilds or disables — never first-time enables. First-time FTS
|
|
440
|
-
* enablement is handled by the seed's explicit enableSearch call (which
|
|
441
|
-
* is try-caught) or the admin UI toggle.
|
|
442
|
-
*
|
|
443
|
-
* - FTS active + still has search support and searchable fields → rebuild
|
|
444
|
-
* - FTS active + lost search support or no searchable fields → disable
|
|
445
|
-
* - FTS not active → no-op
|
|
446
|
-
*
|
|
447
|
-
* Pass `db` when calling from within a transaction so FTS operations
|
|
448
|
-
* participate in the same transaction and are rolled back on failure.
|
|
449
|
-
*/
|
|
450
|
-
async syncSearchState(collectionSlug, db) {
|
|
451
|
-
const conn = db ?? this.db;
|
|
452
|
-
const ftsManager = new FTSManager(conn);
|
|
453
|
-
const row = await conn.selectFrom("_emdash_collections").where("slug", "=", collectionSlug).select("supports").executeTakeFirst();
|
|
454
|
-
if (!row) return;
|
|
455
|
-
const wantsSearch = parseSupports(row.supports).includes("search");
|
|
456
|
-
const searchableFields = await ftsManager.getSearchableFields(collectionSlug);
|
|
457
|
-
const config = await ftsManager.getSearchConfig(collectionSlug);
|
|
458
|
-
const ftsActive = config?.enabled === true;
|
|
459
|
-
if (wantsSearch && searchableFields.length > 0 && ftsActive) await ftsManager.rebuildIndex(collectionSlug, searchableFields, config?.weights, config?.tokenize);
|
|
460
|
-
else if (ftsActive && (!wantsSearch || searchableFields.length === 0)) await ftsManager.disableSearch(collectionSlug);
|
|
461
|
-
}
|
|
462
|
-
/**
|
|
463
|
-
* Delete a field
|
|
464
|
-
*/
|
|
465
|
-
async deleteField(collectionSlug, fieldSlug) {
|
|
466
|
-
const field = await this.getField(collectionSlug, fieldSlug);
|
|
467
|
-
if (!field) throw new SchemaError(`Field "${fieldSlug}" not found in collection "${collectionSlug}"`, "FIELD_NOT_FOUND");
|
|
468
|
-
let schemaMutated = false;
|
|
469
|
-
try {
|
|
470
|
-
await withTransaction(this.db, async (trx) => {
|
|
471
|
-
await trx.deleteFrom("_emdash_fields").where("id", "=", field.id).execute();
|
|
472
|
-
schemaMutated = true;
|
|
473
|
-
if (field.searchable) await this.syncSearchState(collectionSlug, trx);
|
|
474
|
-
await this.dropColumn(collectionSlug, fieldSlug, trx);
|
|
475
|
-
});
|
|
476
|
-
await markContentMediaUsageCollectionStaleSafely(this.db, collectionSlug, "CONTENT_USAGE_STALE");
|
|
477
|
-
} catch (error) {
|
|
478
|
-
if (schemaMutated) await markContentMediaUsageCollectionStaleSafely(this.db, collectionSlug, "CONTENT_USAGE_STALE");
|
|
479
|
-
throw error;
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
/**
|
|
483
|
-
* Reorder collections in the admin sidebar.
|
|
484
|
-
*
|
|
485
|
-
* `slugs` is the full desired order: every listed collection gets its
|
|
486
|
-
* index as `sort_order`, and any collection left out has its explicit
|
|
487
|
-
* position cleared, dropping it back to the alphabetical tail. Unknown or
|
|
488
|
-
* duplicate slugs throw before anything is written.
|
|
489
|
-
*/
|
|
490
|
-
async reorderCollections(slugs) {
|
|
491
|
-
const known = new Set((await this.listCollections()).map((collection) => collection.slug));
|
|
492
|
-
const unknown = slugs.filter((slug) => !known.has(slug));
|
|
493
|
-
if (unknown.length > 0) throw new SchemaError(`Unknown collection${unknown.length > 1 ? "s" : ""}: ${unknown.join(", ")}`, "COLLECTION_NOT_FOUND", { slugs: unknown });
|
|
494
|
-
const duplicates = slugs.filter((slug, index) => slugs.indexOf(slug) !== index);
|
|
495
|
-
if (duplicates.length > 0) throw new SchemaError(`Duplicate collection${duplicates.length > 1 ? "s" : ""}: ${[...new Set(duplicates)].join(", ")}`, "DUPLICATE_SLUG", { slugs: [...new Set(duplicates)] });
|
|
496
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
497
|
-
const ordered = new Set(slugs);
|
|
498
|
-
await withTransaction(this.db, async (trx) => {
|
|
499
|
-
for (const [index, slug] of slugs.entries()) await trx.updateTable("_emdash_collections").set({
|
|
500
|
-
sort_order: index,
|
|
501
|
-
updated_at: now
|
|
502
|
-
}).where("slug", "=", slug).execute();
|
|
503
|
-
const cleared = [...known].filter((slug) => !ordered.has(slug));
|
|
504
|
-
for (const slugChunk of chunks(cleared, SQL_BATCH_SIZE)) await trx.updateTable("_emdash_collections").set({
|
|
505
|
-
sort_order: null,
|
|
506
|
-
updated_at: now
|
|
507
|
-
}).where("slug", "in", slugChunk).execute();
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
/**
|
|
511
|
-
* Reorder fields
|
|
512
|
-
*/
|
|
513
|
-
async reorderFields(collectionSlug, fieldSlugs) {
|
|
514
|
-
const collection = await this.getCollection(collectionSlug);
|
|
515
|
-
if (!collection) throw new SchemaError(`Collection "${collectionSlug}" not found`, "COLLECTION_NOT_FOUND");
|
|
516
|
-
for (let i = 0; i < fieldSlugs.length; i++) await this.db.updateTable("_emdash_fields").set({ sort_order: i }).where("collection_id", "=", collection.id).where("slug", "=", fieldSlugs[i]).execute();
|
|
517
|
-
}
|
|
518
|
-
/**
|
|
519
|
-
* Create a content table for a collection
|
|
520
|
-
*/
|
|
521
|
-
async createContentTable(slug, db, fields = []) {
|
|
522
|
-
const conn = db ?? this.db;
|
|
523
|
-
const tableName = this.getTableName(slug);
|
|
524
|
-
let table = conn.schema.createTable(tableName).addColumn("id", "text", (col) => col.primaryKey()).addColumn("slug", "text").addColumn("status", "text", (col) => col.defaultTo("draft")).addColumn("author_id", "text").addColumn("primary_byline_id", "text").addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp(conn))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp(conn))).addColumn("published_at", "text").addColumn("scheduled_at", "text").addColumn("deleted_at", "text").addColumn("version", "integer", (col) => col.defaultTo(1)).addColumn("live_revision_id", "text", (col) => col.references("revisions.id")).addColumn("draft_revision_id", "text", (col) => col.references("revisions.id")).addColumn("locale", "text", (col) => col.notNull().defaultTo("en")).addColumn("translation_group", "text");
|
|
525
|
-
for (const field of fields) {
|
|
526
|
-
const columnName = this.getColumnName(field.slug);
|
|
527
|
-
const columnType = COLUMN_TYPE_TO_DATA_TYPE[FIELD_TYPE_TO_COLUMN[field.type]];
|
|
528
|
-
table = table.addColumn(columnName, columnType, (column) => {
|
|
529
|
-
if (!field.required) return column;
|
|
530
|
-
const defaultValue = field.defaultValue !== void 0 ? this.formatDefaultValue(field.defaultValue, field.type) : this.getEmptyDefault(field.type);
|
|
531
|
-
return column.notNull().defaultTo(sql.raw(defaultValue));
|
|
532
|
-
});
|
|
533
|
-
}
|
|
534
|
-
await table.addUniqueConstraint(`${tableName}_slug_locale_unique`, ["slug", "locale"]).execute();
|
|
535
|
-
await sql`
|
|
536
|
-
CREATE INDEX ${sql.ref(`idx_${tableName}_slug`)}
|
|
537
|
-
ON ${sql.ref(tableName)} (slug)
|
|
538
|
-
`.execute(conn);
|
|
539
|
-
await sql`
|
|
540
|
-
CREATE INDEX ${sql.ref(`idx_${tableName}_scheduled`)}
|
|
541
|
-
ON ${sql.ref(tableName)} (scheduled_at)
|
|
542
|
-
WHERE scheduled_at IS NOT NULL
|
|
543
|
-
`.execute(conn);
|
|
544
|
-
await sql`
|
|
545
|
-
CREATE INDEX ${sql.ref(`idx_${tableName}_live_revision`)}
|
|
546
|
-
ON ${sql.ref(tableName)} (live_revision_id)
|
|
547
|
-
`.execute(conn);
|
|
548
|
-
await sql`
|
|
549
|
-
CREATE INDEX ${sql.ref(`idx_${tableName}_draft_revision`)}
|
|
550
|
-
ON ${sql.ref(tableName)} (draft_revision_id)
|
|
551
|
-
`.execute(conn);
|
|
552
|
-
await sql`
|
|
553
|
-
CREATE INDEX ${sql.ref(`idx_${tableName}_author`)}
|
|
554
|
-
ON ${sql.ref(tableName)} (author_id)
|
|
555
|
-
`.execute(conn);
|
|
556
|
-
await sql`
|
|
557
|
-
CREATE INDEX ${sql.ref(`idx_${tableName}_primary_byline`)}
|
|
558
|
-
ON ${sql.ref(tableName)} (primary_byline_id)
|
|
559
|
-
`.execute(conn);
|
|
560
|
-
await sql`
|
|
561
|
-
CREATE INDEX ${sql.ref(`idx_${tableName}_locale`)}
|
|
562
|
-
ON ${sql.ref(tableName)} (locale)
|
|
563
|
-
`.execute(conn);
|
|
564
|
-
await sql`
|
|
565
|
-
CREATE INDEX ${sql.ref(`idx_${tableName}_tg_locale`)}
|
|
566
|
-
ON ${sql.ref(tableName)} (translation_group, locale)
|
|
567
|
-
`.execute(conn);
|
|
568
|
-
await sql`
|
|
569
|
-
CREATE INDEX ${sql.ref(`idx_${tableName}_del_tg_locale`)}
|
|
570
|
-
ON ${sql.ref(tableName)} (deleted_at, translation_group, locale)
|
|
571
|
-
`.execute(conn);
|
|
572
|
-
await sql`
|
|
573
|
-
CREATE INDEX ${sql.ref(`idx_${tableName}_deleted_updated_id`)}
|
|
574
|
-
ON ${sql.ref(tableName)} (deleted_at, updated_at DESC, id DESC)
|
|
575
|
-
`.execute(conn);
|
|
576
|
-
await sql`
|
|
577
|
-
CREATE INDEX ${sql.ref(`idx_${tableName}_deleted_status`)}
|
|
578
|
-
ON ${sql.ref(tableName)} (deleted_at, status)
|
|
579
|
-
`.execute(conn);
|
|
580
|
-
await sql`
|
|
581
|
-
CREATE INDEX ${sql.ref(`idx_${tableName}_deleted_created_id`)}
|
|
582
|
-
ON ${sql.ref(tableName)} (deleted_at, created_at DESC, id DESC)
|
|
583
|
-
`.execute(conn);
|
|
584
|
-
await sql`
|
|
585
|
-
CREATE INDEX ${sql.ref(`idx_${tableName}_deleted_published_id`)}
|
|
586
|
-
ON ${sql.ref(tableName)} (deleted_at, published_at DESC, id DESC)
|
|
587
|
-
`.execute(conn);
|
|
588
|
-
await sql`
|
|
589
|
-
CREATE INDEX ${sql.ref(`idx_${tableName}_loc_upd`)}
|
|
590
|
-
ON ${sql.ref(tableName)} (deleted_at, locale, updated_at DESC, id DESC)
|
|
591
|
-
`.execute(conn);
|
|
592
|
-
await sql`
|
|
593
|
-
CREATE INDEX ${sql.ref(`idx_${tableName}_loc_crt`)}
|
|
594
|
-
ON ${sql.ref(tableName)} (deleted_at, locale, created_at DESC, id DESC)
|
|
595
|
-
`.execute(conn);
|
|
596
|
-
}
|
|
597
|
-
/**
|
|
598
|
-
* Add a column to a content table
|
|
599
|
-
*/
|
|
600
|
-
async addColumn(collectionSlug, fieldSlug, fieldType, options, db) {
|
|
601
|
-
const conn = db ?? this.db;
|
|
602
|
-
const tableName = this.getTableName(collectionSlug);
|
|
603
|
-
const columnType = FIELD_TYPE_TO_COLUMN[fieldType];
|
|
604
|
-
const columnName = this.getColumnName(fieldSlug);
|
|
605
|
-
if (options?.required && options?.defaultValue !== void 0) {
|
|
606
|
-
const defaultVal = this.formatDefaultValue(options.defaultValue, fieldType);
|
|
607
|
-
await sql`
|
|
608
|
-
ALTER TABLE ${sql.ref(tableName)}
|
|
609
|
-
ADD COLUMN ${sql.ref(columnName)} ${sql.raw(columnType)} NOT NULL DEFAULT ${sql.raw(defaultVal)}
|
|
610
|
-
`.execute(conn);
|
|
611
|
-
} else if (options?.required) {
|
|
612
|
-
const defaultVal = this.getEmptyDefault(fieldType);
|
|
613
|
-
await sql`
|
|
614
|
-
ALTER TABLE ${sql.ref(tableName)}
|
|
615
|
-
ADD COLUMN ${sql.ref(columnName)} ${sql.raw(columnType)} NOT NULL DEFAULT ${sql.raw(defaultVal)}
|
|
616
|
-
`.execute(conn);
|
|
617
|
-
} else await sql`
|
|
618
|
-
ALTER TABLE ${sql.ref(tableName)}
|
|
619
|
-
ADD COLUMN ${sql.ref(columnName)} ${sql.raw(columnType)}
|
|
620
|
-
`.execute(conn);
|
|
621
|
-
}
|
|
622
|
-
/**
|
|
623
|
-
* Drop a column from a content table
|
|
624
|
-
*/
|
|
625
|
-
async dropColumn(collectionSlug, fieldSlug, db) {
|
|
626
|
-
const tableName = this.getTableName(collectionSlug);
|
|
627
|
-
const columnName = this.getColumnName(fieldSlug);
|
|
628
|
-
await sql`
|
|
629
|
-
ALTER TABLE ${sql.ref(tableName)}
|
|
630
|
-
DROP COLUMN ${sql.ref(columnName)}
|
|
631
|
-
`.execute(db ?? this.db);
|
|
632
|
-
}
|
|
633
|
-
/**
|
|
634
|
-
* Check if a collection has any content
|
|
635
|
-
*/
|
|
636
|
-
async collectionHasContent(slug) {
|
|
637
|
-
const tableName = this.getTableName(slug);
|
|
638
|
-
try {
|
|
639
|
-
return ((await sql`
|
|
640
|
-
SELECT COUNT(*) as count FROM ${sql.ref(tableName)}
|
|
641
|
-
WHERE deleted_at IS NULL
|
|
642
|
-
`.execute(this.db)).rows[0]?.count ?? 0) > 0;
|
|
643
|
-
} catch {
|
|
644
|
-
return false;
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
/**
|
|
648
|
-
* Get table name for a collection
|
|
649
|
-
*/
|
|
650
|
-
getTableName(slug) {
|
|
651
|
-
validateIdentifier(slug, "collection slug");
|
|
652
|
-
return `ec_${slug}`;
|
|
653
|
-
}
|
|
654
|
-
/**
|
|
655
|
-
* Get column name for a field
|
|
656
|
-
*/
|
|
657
|
-
getColumnName(slug) {
|
|
658
|
-
validateIdentifier(slug, "field slug");
|
|
659
|
-
return slug;
|
|
660
|
-
}
|
|
661
|
-
/**
|
|
662
|
-
* Validate a slug
|
|
663
|
-
*/
|
|
664
|
-
validateSlug(slug, type) {
|
|
665
|
-
if (!slug || typeof slug !== "string") throw new SchemaError(`${type} slug is required`, "INVALID_SLUG");
|
|
666
|
-
if (!SLUG_VALIDATION_PATTERN.test(slug)) throw new SchemaError(`${type} slug must start with a letter and contain only lowercase letters, numbers, and underscores`, "INVALID_SLUG");
|
|
667
|
-
if (slug.length > 63) throw new SchemaError(`${type} slug must be 63 characters or less`, "INVALID_SLUG");
|
|
668
|
-
}
|
|
669
|
-
/**
|
|
670
|
-
* Format a default value for SQL.
|
|
671
|
-
*
|
|
672
|
-
* SQLite `ALTER TABLE ADD COLUMN ... DEFAULT` requires a literal constant
|
|
673
|
-
* expression — parameterized values cannot be used here. We manually escape
|
|
674
|
-
* single quotes and coerce types to ensure the output is safe.
|
|
675
|
-
*
|
|
676
|
-
* INTEGER/REAL values are coerced through `Number()` which can only produce
|
|
677
|
-
* digits, `.`, `-`, `e`, `Infinity`, or `NaN` — all safe in SQL.
|
|
678
|
-
* TEXT/JSON values have single quotes escaped via SQL standard doubling (`''`).
|
|
679
|
-
*/
|
|
680
|
-
formatDefaultValue(value, fieldType) {
|
|
681
|
-
if (value === null || value === void 0) return "NULL";
|
|
682
|
-
const columnType = FIELD_TYPE_TO_COLUMN[fieldType];
|
|
683
|
-
if (columnType === "JSON") return `'${JSON.stringify(value).replace(SINGLE_QUOTE_PATTERN, "''")}'`;
|
|
684
|
-
if (columnType === "INTEGER") {
|
|
685
|
-
if (typeof value === "boolean") return value ? "1" : "0";
|
|
686
|
-
const num = Number(value);
|
|
687
|
-
if (!Number.isFinite(num)) return "0";
|
|
688
|
-
return String(Math.trunc(num));
|
|
689
|
-
}
|
|
690
|
-
if (columnType === "REAL") {
|
|
691
|
-
const num = Number(value);
|
|
692
|
-
if (!Number.isFinite(num)) return "0";
|
|
693
|
-
return String(num);
|
|
694
|
-
}
|
|
695
|
-
let text;
|
|
696
|
-
if (typeof value === "string") text = value;
|
|
697
|
-
else if (typeof value === "number" || typeof value === "boolean") text = String(value);
|
|
698
|
-
else if (typeof value === "object" && value !== null) text = JSON.stringify(value);
|
|
699
|
-
else text = "";
|
|
700
|
-
return `'${text.replace(SINGLE_QUOTE_PATTERN, "''")}'`;
|
|
701
|
-
}
|
|
702
|
-
/**
|
|
703
|
-
* Get empty default for a field type
|
|
704
|
-
*/
|
|
705
|
-
getEmptyDefault(fieldType) {
|
|
706
|
-
switch (FIELD_TYPE_TO_COLUMN[fieldType]) {
|
|
707
|
-
case "INTEGER": return "0";
|
|
708
|
-
case "REAL": return "0.0";
|
|
709
|
-
case "JSON": return "'null'";
|
|
710
|
-
default: return "''";
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
/**
|
|
714
|
-
* Map a collection row to a Collection object
|
|
715
|
-
*/
|
|
716
|
-
mapCollectionRow = (row) => {
|
|
717
|
-
const moderation = row.comments_moderation;
|
|
718
|
-
return {
|
|
719
|
-
id: row.id,
|
|
720
|
-
slug: row.slug,
|
|
721
|
-
label: row.label,
|
|
722
|
-
labelSingular: row.label_singular ?? void 0,
|
|
723
|
-
description: row.description ?? void 0,
|
|
724
|
-
icon: row.icon ?? void 0,
|
|
725
|
-
supports: parseSupports(row.supports),
|
|
726
|
-
source: row.source && isCollectionSource(row.source) ? row.source : void 0,
|
|
727
|
-
hasSeo: row.has_seo === 1,
|
|
728
|
-
urlPattern: row.url_pattern ?? void 0,
|
|
729
|
-
hidden: row.hidden === 1,
|
|
730
|
-
sortOrder: row.sort_order ?? void 0,
|
|
731
|
-
commentsEnabled: row.comments_enabled === 1,
|
|
732
|
-
commentsModeration: moderation === "all" || moderation === "first_time" || moderation === "none" ? moderation : "first_time",
|
|
733
|
-
commentsClosedAfterDays: row.comments_closed_after_days ?? 90,
|
|
734
|
-
commentsAutoApproveUsers: row.comments_auto_approve_users === 1,
|
|
735
|
-
createdAt: row.created_at,
|
|
736
|
-
updatedAt: row.updated_at
|
|
737
|
-
};
|
|
738
|
-
};
|
|
739
|
-
/**
|
|
740
|
-
* Map a field row to a Field object
|
|
741
|
-
*/
|
|
742
|
-
mapFieldRow = (row) => {
|
|
743
|
-
return {
|
|
744
|
-
id: row.id,
|
|
745
|
-
collectionId: row.collection_id,
|
|
746
|
-
slug: row.slug,
|
|
747
|
-
label: row.label,
|
|
748
|
-
type: isFieldType(row.type) ? row.type : "string",
|
|
749
|
-
columnType: isColumnType(row.column_type) ? row.column_type : "TEXT",
|
|
750
|
-
required: row.required === 1,
|
|
751
|
-
unique: row.unique === 1,
|
|
752
|
-
defaultValue: row.default_value ? JSON.parse(row.default_value) : void 0,
|
|
753
|
-
validation: row.validation ? JSON.parse(row.validation) : void 0,
|
|
754
|
-
widget: row.widget ?? void 0,
|
|
755
|
-
options: row.options ? JSON.parse(row.options) : void 0,
|
|
756
|
-
sortOrder: row.sort_order,
|
|
757
|
-
searchable: row.searchable === 1,
|
|
758
|
-
translatable: row.translatable !== 0,
|
|
759
|
-
createdAt: row.created_at
|
|
760
|
-
};
|
|
761
|
-
};
|
|
762
|
-
/**
|
|
763
|
-
* Discover orphaned content tables
|
|
764
|
-
*
|
|
765
|
-
* Finds ec_* tables that exist in the database but don't have a
|
|
766
|
-
* corresponding entry in _emdash_collections.
|
|
767
|
-
*/
|
|
768
|
-
async discoverOrphanedTables() {
|
|
769
|
-
const allTables = await listTablesLike(this.db, "ec_%");
|
|
770
|
-
const registered = await this.listCollections();
|
|
771
|
-
const registeredSlugs = new Set(registered.map((c) => c.slug));
|
|
772
|
-
const orphans = [];
|
|
773
|
-
for (const tableName of allTables) {
|
|
774
|
-
const slug = tableName.replace(EC_PREFIX_PATTERN, "");
|
|
775
|
-
if (!registeredSlugs.has(slug)) try {
|
|
776
|
-
const countResult = await sql`
|
|
777
|
-
SELECT COUNT(*) as count FROM ${sql.ref(tableName)}
|
|
778
|
-
WHERE deleted_at IS NULL
|
|
779
|
-
`.execute(this.db);
|
|
780
|
-
orphans.push({
|
|
781
|
-
slug,
|
|
782
|
-
tableName,
|
|
783
|
-
rowCount: countResult.rows[0]?.count ?? 0
|
|
784
|
-
});
|
|
785
|
-
} catch {
|
|
786
|
-
orphans.push({
|
|
787
|
-
slug,
|
|
788
|
-
tableName,
|
|
789
|
-
rowCount: 0
|
|
790
|
-
});
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
return orphans;
|
|
794
|
-
}
|
|
795
|
-
/**
|
|
796
|
-
* Register an orphaned table as a collection
|
|
797
|
-
*
|
|
798
|
-
* Creates a _emdash_collections entry for an existing ec_* table.
|
|
799
|
-
*/
|
|
800
|
-
async registerOrphanedTable(slug, options) {
|
|
801
|
-
const tableName = this.getTableName(slug);
|
|
802
|
-
if (!await tableExists(this.db, tableName)) throw new SchemaError(`Table "${tableName}" does not exist`, "TABLE_NOT_FOUND");
|
|
803
|
-
if (await this.getCollection(slug)) throw new SchemaError(`Collection "${slug}" is already registered`, "COLLECTION_EXISTS");
|
|
804
|
-
const id = ulid();
|
|
805
|
-
const label = options?.label || this.slugToLabel(slug);
|
|
806
|
-
let collectionRegistered = false;
|
|
807
|
-
try {
|
|
808
|
-
await this.db.insertInto("_emdash_collections").values({
|
|
809
|
-
id,
|
|
810
|
-
slug,
|
|
811
|
-
label,
|
|
812
|
-
label_singular: options?.labelSingular ?? null,
|
|
813
|
-
description: options?.description ?? null,
|
|
814
|
-
icon: null,
|
|
815
|
-
supports: JSON.stringify([]),
|
|
816
|
-
source: "discovered",
|
|
817
|
-
has_seo: 0,
|
|
818
|
-
url_pattern: null
|
|
819
|
-
}).execute();
|
|
820
|
-
collectionRegistered = true;
|
|
821
|
-
const collection = await this.getCollection(slug);
|
|
822
|
-
if (!collection) throw new SchemaError("Failed to register orphaned table", "REGISTER_FAILED");
|
|
823
|
-
await markContentMediaUsageCollectionStaleSafely(this.db, slug, "CONTENT_USAGE_STALE");
|
|
824
|
-
return collection;
|
|
825
|
-
} catch (error) {
|
|
826
|
-
if (collectionRegistered) await markContentMediaUsageCollectionStaleSafely(this.db, slug, "CONTENT_USAGE_STALE");
|
|
827
|
-
throw error;
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
/**
|
|
831
|
-
* Convert slug to human-readable label
|
|
832
|
-
*/
|
|
833
|
-
slugToLabel(slug) {
|
|
834
|
-
return slug.replace(UNDERSCORE_PATTERN, " ").replace(WORD_BOUNDARY_PATTERN, (c) => c.toUpperCase());
|
|
835
|
-
}
|
|
836
|
-
};
|
|
837
|
-
|
|
838
|
-
//#endregion
|
|
839
|
-
export { SchemaRegistry as n, registry_exports as r, SchemaError as t };
|
|
840
|
-
//# sourceMappingURL=registry-Dbodb4Uo.mjs.map
|