emdash 1.0.0 → 1.0.1-rc.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/README.md +4 -0
- package/dist/action-token-DBki7IT4.mjs +26 -0
- package/dist/action-token-DBki7IT4.mjs.map +1 -0
- package/dist/activation-DDuqAat2.mjs +387 -0
- package/dist/activation-DDuqAat2.mjs.map +1 -0
- package/dist/adapters-DcqT_GzQ.d.mts +171 -0
- package/dist/adapters-DcqT_GzQ.d.mts.map +1 -0
- package/dist/after-PcEvMY_6.mjs +96 -0
- package/dist/after-PcEvMY_6.mjs.map +1 -0
- package/dist/allowed-origins-CFtudhyw.mjs +116 -0
- package/dist/allowed-origins-CFtudhyw.mjs.map +1 -0
- package/dist/api/route-utils.d.mts +69 -0
- package/dist/api/route-utils.d.mts.map +1 -0
- package/dist/api/route-utils.mjs +85 -0
- package/dist/api/route-utils.mjs.map +1 -0
- package/dist/api/schemas/index.d.mts +2 -0
- package/dist/api/schemas/index.mjs +13 -0
- package/dist/api-BJFwdTiG.mjs +4974 -0
- package/dist/api-BJFwdTiG.mjs.map +1 -0
- package/dist/api-tokens-BLz2MtQs.mjs +3 -0
- package/dist/api-tokens-P3mAaQgr.mjs +166 -0
- package/dist/api-tokens-P3mAaQgr.mjs.map +1 -0
- package/dist/apply-BNvvsD51.mjs +1672 -0
- package/dist/apply-BNvvsD51.mjs.map +1 -0
- package/dist/approvals-quy61IC4.mjs +460 -0
- package/dist/approvals-quy61IC4.mjs.map +1 -0
- package/dist/artifact-fetch-CWxyELVI.mjs +659 -0
- package/dist/artifact-fetch-CWxyELVI.mjs.map +1 -0
- package/dist/astro/image-endpoint.d.mts +8 -0
- package/dist/astro/image-endpoint.d.mts.map +1 -0
- package/dist/astro/image-endpoint.mjs +55 -0
- package/dist/astro/image-endpoint.mjs.map +1 -0
- package/dist/astro/index.d.mts +39 -7
- package/dist/astro/index.d.mts.map +1 -1
- package/dist/astro/index.mjs +908 -514
- package/dist/astro/index.mjs.map +1 -1
- package/dist/astro/middleware/auth.d.mts +15 -7
- package/dist/astro/middleware/auth.d.mts.map +1 -1
- package/dist/astro/middleware/auth.mjs +146 -211
- package/dist/astro/middleware/auth.mjs.map +1 -1
- package/dist/astro/middleware/media-usage-write-fence.d.mts +15 -0
- package/dist/astro/middleware/media-usage-write-fence.d.mts.map +1 -0
- package/dist/astro/middleware/media-usage-write-fence.mjs +117 -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 +48 -15
- package/dist/astro/middleware/redirect.mjs.map +1 -1
- package/dist/astro/middleware/request-context.d.mts +5 -1
- package/dist/astro/middleware/request-context.d.mts.map +1 -1
- package/dist/astro/middleware/request-context.mjs +542 -76
- package/dist/astro/middleware/request-context.mjs.map +1 -1
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware.d.mts +66 -4
- package/dist/astro/middleware.d.mts.map +1 -1
- package/dist/astro/middleware.mjs +817 -1844
- package/dist/astro/middleware.mjs.map +1 -1
- package/dist/astro/routes/PluginRegistry.d.mts +19 -0
- package/dist/astro/routes/PluginRegistry.d.mts.map +1 -0
- package/dist/astro/routes/PluginRegistry.mjs +26 -0
- package/dist/astro/routes/PluginRegistry.mjs.map +1 -0
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.d.mts +15 -0
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +78 -0
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs.map +1 -0
- package/dist/astro/routes/api/admin/allowed-domains/index.d.mts +15 -0
- package/dist/astro/routes/api/admin/allowed-domains/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +78 -0
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/api-tokens/_id_.d.mts +11 -0
- package/dist/astro/routes/api/admin/api-tokens/_id_.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +35 -0
- package/dist/astro/routes/api/admin/api-tokens/_id_.mjs.map +1 -0
- package/dist/astro/routes/api/admin/api-tokens/index.d.mts +17 -0
- package/dist/astro/routes/api/admin/api-tokens/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/api-tokens/index.mjs +54 -0
- package/dist/astro/routes/api/admin/api-tokens/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.d.mts +8 -0
- package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +25 -0
- package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs.map +1 -0
- package/dist/astro/routes/api/admin/byline-fields/_slug_.d.mts +10 -0
- package/dist/astro/routes/api/admin/byline-fields/_slug_.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +66 -0
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs.map +1 -0
- package/dist/astro/routes/api/admin/byline-fields/index.d.mts +9 -0
- package/dist/astro/routes/api/admin/byline-fields/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/byline-fields/index.mjs +54 -0
- package/dist/astro/routes/api/admin/byline-fields/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/byline-fields/reorder.d.mts +8 -0
- package/dist/astro/routes/api/admin/byline-fields/reorder.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +38 -0
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs.map +1 -0
- package/dist/astro/routes/api/admin/bylines/_id_/index.d.mts +10 -0
- package/dist/astro/routes/api/admin/bylines/_id_/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +92 -0
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/bylines/_id_/translations.d.mts +9 -0
- package/dist/astro/routes/api/admin/bylines/_id_/translations.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +84 -0
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs.map +1 -0
- package/dist/astro/routes/api/admin/bylines/index.d.mts +9 -0
- package/dist/astro/routes/api/admin/bylines/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/bylines/index.mjs +91 -0
- package/dist/astro/routes/api/admin/bylines/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/comments/_id_/status.d.mts +8 -0
- package/dist/astro/routes/api/admin/comments/_id_/status.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +59 -0
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs.map +1 -0
- package/dist/astro/routes/api/admin/comments/_id_.d.mts +15 -0
- package/dist/astro/routes/api/admin/comments/_id_.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/comments/_id_.mjs +51 -0
- package/dist/astro/routes/api/admin/comments/_id_.mjs.map +1 -0
- package/dist/astro/routes/api/admin/comments/bulk.d.mts +8 -0
- package/dist/astro/routes/api/admin/comments/bulk.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/comments/bulk.mjs +49 -0
- package/dist/astro/routes/api/admin/comments/bulk.mjs.map +1 -0
- package/dist/astro/routes/api/admin/comments/counts.d.mts +8 -0
- package/dist/astro/routes/api/admin/comments/counts.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/comments/counts.mjs +29 -0
- package/dist/astro/routes/api/admin/comments/counts.mjs.map +1 -0
- package/dist/astro/routes/api/admin/comments/index.d.mts +11 -0
- package/dist/astro/routes/api/admin/comments/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/comments/index.mjs +53 -0
- package/dist/astro/routes/api/admin/comments/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/core-update.d.mts +8 -0
- package/dist/astro/routes/api/admin/core-update.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/core-update.mjs +28 -0
- package/dist/astro/routes/api/admin/core-update.mjs.map +1 -0
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.d.mts +8 -0
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +50 -0
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs.map +1 -0
- package/dist/astro/routes/api/admin/hooks/exclusive/index.d.mts +8 -0
- package/dist/astro/routes/api/admin/hooks/exclusive/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +35 -0
- package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/media-usage/activation.d.mts +9 -0
- package/dist/astro/routes/api/admin/media-usage/activation.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/media-usage/activation.mjs +54 -0
- package/dist/astro/routes/api/admin/media-usage/activation.mjs.map +1 -0
- 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 +45 -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 +45 -0
- package/dist/astro/routes/api/admin/media-usage/collection-deletions/retry.mjs.map +1 -0
- package/dist/astro/routes/api/admin/media-usage/progress.d.mts +9 -0
- package/dist/astro/routes/api/admin/media-usage/progress.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/media-usage/progress.mjs +56 -0
- package/dist/astro/routes/api/admin/media-usage/progress.mjs.map +1 -0
- package/dist/astro/routes/api/admin/media-usage/repair.d.mts +8 -0
- package/dist/astro/routes/api/admin/media-usage/repair.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/media-usage/repair.mjs +53 -0
- package/dist/astro/routes/api/admin/media-usage/repair.mjs.map +1 -0
- 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 +46 -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 +46 -0
- package/dist/astro/routes/api/admin/media-usage/work/retry.mjs.map +1 -0
- package/dist/astro/routes/api/admin/oauth-clients/_id_.d.mts +19 -0
- package/dist/astro/routes/api/admin/oauth-clients/_id_.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +71 -0
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs.map +1 -0
- package/dist/astro/routes/api/admin/oauth-clients/index.d.mts +15 -0
- package/dist/astro/routes/api/admin/oauth-clients/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs +52 -0
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/_id_/disable.d.mts +8 -0
- package/dist/astro/routes/api/admin/plugins/_id_/disable.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +28 -0
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/_id_/enable.d.mts +8 -0
- package/dist/astro/routes/api/admin/plugins/_id_/enable.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +28 -0
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/_id_/index.d.mts +8 -0
- package/dist/astro/routes/api/admin/plugins/_id_/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +105 -0
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/_id_/mcp.d.mts +8 -0
- package/dist/astro/routes/api/admin/plugins/_id_/mcp.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/_id_/mcp.mjs +41 -0
- package/dist/astro/routes/api/admin/plugins/_id_/mcp.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/_id_/settings.d.mts +9 -0
- package/dist/astro/routes/api/admin/plugins/_id_/settings.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs +116 -0
- package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.d.mts +8 -0
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +112 -0
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/_id_/update.d.mts +8 -0
- package/dist/astro/routes/api/admin/plugins/_id_/update.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +139 -0
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/index.d.mts +8 -0
- package/dist/astro/routes/api/admin/plugins/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/index.mjs +103 -0
- package/dist/astro/routes/api/admin/plugins/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.d.mts +8 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +44 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.d.mts +8 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +99 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.d.mts +8 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +142 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/index.d.mts +8 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +106 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.d.mts +8 -0
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +112 -0
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.d.mts +8 -0
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +160 -0
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/registry/artifact.d.mts +8 -0
- package/dist/astro/routes/api/admin/plugins/registry/artifact.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +362 -0
- package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/registry/install.d.mts +8 -0
- package/dist/astro/routes/api/admin/plugins/registry/install.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/registry/install.mjs +155 -0
- package/dist/astro/routes/api/admin/plugins/registry/install.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/registry/publisher-handle.d.mts +8 -0
- package/dist/astro/routes/api/admin/plugins/registry/publisher-handle.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/registry/publisher-handle.mjs +221 -0
- package/dist/astro/routes/api/admin/plugins/registry/publisher-handle.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/registry/verify.d.mts +8 -0
- package/dist/astro/routes/api/admin/plugins/registry/verify.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/registry/verify.mjs +117 -0
- package/dist/astro/routes/api/admin/plugins/registry/verify.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/updates.d.mts +8 -0
- package/dist/astro/routes/api/admin/plugins/updates.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/updates.mjs +109 -0
- package/dist/astro/routes/api/admin/plugins/updates.mjs.map +1 -0
- package/dist/astro/routes/api/admin/scheduled-policy-rejections/_collection_/_id_.d.mts +8 -0
- package/dist/astro/routes/api/admin/scheduled-policy-rejections/_collection_/_id_.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/scheduled-policy-rejections/_collection_/_id_.mjs +29 -0
- package/dist/astro/routes/api/admin/scheduled-policy-rejections/_collection_/_id_.mjs.map +1 -0
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.d.mts +8 -0
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +99 -0
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.d.mts +8 -0
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +44 -0
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs.map +1 -0
- package/dist/astro/routes/api/admin/themes/marketplace/index.d.mts +8 -0
- package/dist/astro/routes/api/admin/themes/marketplace/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +115 -0
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/_...path_.d.mts +12 -0
- package/dist/astro/routes/api/admin/transfer/_...path_.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/_...path_.mjs +144 -0
- package/dist/astro/routes/api/admin/transfer/_...path_.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/approvals/_id_/approve.d.mts +8 -0
- package/dist/astro/routes/api/admin/transfer/approvals/_id_/approve.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/approvals/_id_/approve.mjs +69 -0
- package/dist/astro/routes/api/admin/transfer/approvals/_id_/approve.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/approvals/_id_/deny.d.mts +8 -0
- package/dist/astro/routes/api/admin/transfer/approvals/_id_/deny.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/approvals/_id_/deny.mjs +69 -0
- package/dist/astro/routes/api/admin/transfer/approvals/_id_/deny.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/approvals/index.d.mts +8 -0
- package/dist/astro/routes/api/admin/transfer/approvals/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/approvals/index.mjs +68 -0
- package/dist/astro/routes/api/admin/transfer/approvals/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/capabilities.d.mts +8 -0
- package/dist/astro/routes/api/admin/transfer/capabilities.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/capabilities.mjs +71 -0
- package/dist/astro/routes/api/admin/transfer/capabilities.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/exports/_id_/advance.d.mts +8 -0
- package/dist/astro/routes/api/admin/transfer/exports/_id_/advance.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/exports/_id_/advance.mjs +68 -0
- package/dist/astro/routes/api/admin/transfer/exports/_id_/advance.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/exports/_id_/archive.d.mts +8 -0
- package/dist/astro/routes/api/admin/transfer/exports/_id_/archive.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/exports/_id_/archive.mjs +71 -0
- package/dist/astro/routes/api/admin/transfer/exports/_id_/archive.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/exports/_id_/files/_...path_.d.mts +8 -0
- package/dist/astro/routes/api/admin/transfer/exports/_id_/files/_...path_.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/exports/_id_/files/_...path_.mjs +70 -0
- package/dist/astro/routes/api/admin/transfer/exports/_id_/files/_...path_.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/exports/_id_/index.d.mts +8 -0
- package/dist/astro/routes/api/admin/transfer/exports/_id_/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/exports/_id_/index.mjs +67 -0
- package/dist/astro/routes/api/admin/transfer/exports/_id_/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/exports/_id_/manifest.d.mts +8 -0
- package/dist/astro/routes/api/admin/transfer/exports/_id_/manifest.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/exports/_id_/manifest.mjs +70 -0
- package/dist/astro/routes/api/admin/transfer/exports/_id_/manifest.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/exports/index.d.mts +9 -0
- package/dist/astro/routes/api/admin/transfer/exports/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/exports/index.mjs +92 -0
- package/dist/astro/routes/api/admin/transfer/exports/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/abandon.d.mts +8 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/abandon.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/abandon.mjs +67 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/abandon.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/advance.d.mts +8 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/advance.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/advance.mjs +71 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/advance.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/analyze.d.mts +8 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/analyze.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/analyze.mjs +79 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/analyze.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/cancel.d.mts +8 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/cancel.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/cancel.mjs +67 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/cancel.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/execute.d.mts +8 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/execute.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/execute.mjs +78 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/execute.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/files/_...path_.d.mts +8 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/files/_...path_.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/files/_...path_.mjs +78 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/files/_...path_.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/index.d.mts +8 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/index.mjs +67 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/missing.d.mts +8 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/missing.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/missing.mjs +71 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/missing.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/plan.d.mts +8 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/plan.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/plan.mjs +68 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/plan.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/receipt.d.mts +8 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/receipt.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/receipt.mjs +67 -0
- package/dist/astro/routes/api/admin/transfer/imports/_id_/receipt.mjs.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/index.d.mts +9 -0
- package/dist/astro/routes/api/admin/transfer/imports/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/transfer/imports/index.mjs +100 -0
- package/dist/astro/routes/api/admin/transfer/imports/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/users/_id_/disable.d.mts +8 -0
- package/dist/astro/routes/api/admin/users/_id_/disable.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/users/_id_/disable.mjs +45 -0
- package/dist/astro/routes/api/admin/users/_id_/disable.mjs.map +1 -0
- package/dist/astro/routes/api/admin/users/_id_/enable.d.mts +8 -0
- package/dist/astro/routes/api/admin/users/_id_/enable.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/users/_id_/enable.mjs +34 -0
- package/dist/astro/routes/api/admin/users/_id_/enable.mjs.map +1 -0
- package/dist/astro/routes/api/admin/users/_id_/index.d.mts +9 -0
- package/dist/astro/routes/api/admin/users/_id_/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/users/_id_/index.mjs +117 -0
- package/dist/astro/routes/api/admin/users/_id_/index.mjs.map +1 -0
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.d.mts +8 -0
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +56 -0
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs.map +1 -0
- package/dist/astro/routes/api/admin/users/index.d.mts +8 -0
- package/dist/astro/routes/api/admin/users/index.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/users/index.mjs +67 -0
- package/dist/astro/routes/api/admin/users/index.mjs.map +1 -0
- package/dist/astro/routes/api/auth/dev-bypass.d.mts +9 -0
- package/dist/astro/routes/api/auth/dev-bypass.d.mts.map +1 -0
- package/dist/astro/routes/api/auth/dev-bypass.mjs +83 -0
- package/dist/astro/routes/api/auth/dev-bypass.mjs.map +1 -0
- package/dist/astro/routes/api/auth/invite/accept.d.mts +8 -0
- package/dist/astro/routes/api/auth/invite/accept.d.mts.map +1 -0
- package/dist/astro/routes/api/auth/invite/accept.mjs +36 -0
- package/dist/astro/routes/api/auth/invite/accept.mjs.map +1 -0
- package/dist/astro/routes/api/auth/invite/complete.d.mts +8 -0
- package/dist/astro/routes/api/auth/invite/complete.d.mts.map +1 -0
- package/dist/astro/routes/api/auth/invite/complete.mjs +70 -0
- package/dist/astro/routes/api/auth/invite/complete.mjs.map +1 -0
- package/dist/astro/routes/api/auth/invite/index.d.mts +8 -0
- package/dist/astro/routes/api/auth/invite/index.d.mts.map +1 -0
- package/dist/astro/routes/api/auth/invite/index.mjs +70 -0
- package/dist/astro/routes/api/auth/invite/index.mjs.map +1 -0
- package/dist/astro/routes/api/auth/invite/register-options.d.mts +8 -0
- package/dist/astro/routes/api/auth/invite/register-options.d.mts.map +1 -0
- package/dist/astro/routes/api/auth/invite/register-options.mjs +57 -0
- package/dist/astro/routes/api/auth/invite/register-options.mjs.map +1 -0
- package/dist/astro/routes/api/auth/logout.d.mts +8 -0
- package/dist/astro/routes/api/auth/logout.d.mts.map +1 -0
- package/dist/astro/routes/api/auth/logout.mjs +29 -0
- package/dist/astro/routes/api/auth/logout.mjs.map +1 -0
- package/dist/astro/routes/api/auth/magic-link/send.d.mts +8 -0
- package/dist/astro/routes/api/auth/magic-link/send.d.mts.map +1 -0
- package/dist/astro/routes/api/auth/magic-link/send.mjs +69 -0
- package/dist/astro/routes/api/auth/magic-link/send.mjs.map +1 -0
- package/dist/astro/routes/api/auth/magic-link/verify.d.mts +9 -0
- package/dist/astro/routes/api/auth/magic-link/verify.d.mts.map +1 -0
- package/dist/astro/routes/api/auth/magic-link/verify.mjs +59 -0
- package/dist/astro/routes/api/auth/magic-link/verify.mjs.map +1 -0
- package/dist/astro/routes/api/auth/me.d.mts +14 -0
- package/dist/astro/routes/api/auth/me.d.mts.map +1 -0
- package/dist/astro/routes/api/auth/me.mjs +71 -0
- package/dist/astro/routes/api/auth/me.mjs.map +1 -0
- package/dist/astro/routes/api/auth/mode.d.mts +8 -0
- package/dist/astro/routes/api/auth/mode.d.mts.map +1 -0
- package/dist/astro/routes/api/auth/mode.mjs +34 -0
- package/dist/astro/routes/api/auth/mode.mjs.map +1 -0
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.d.mts +8 -0
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.d.mts.map +1 -0
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +149 -0
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs.map +1 -0
- package/dist/astro/routes/api/auth/oauth/_provider_.d.mts +8 -0
- package/dist/astro/routes/api/auth/oauth/_provider_.d.mts.map +1 -0
- package/dist/astro/routes/api/auth/oauth/_provider_.mjs +66 -0
- package/dist/astro/routes/api/auth/oauth/_provider_.mjs.map +1 -0
- package/dist/astro/routes/api/auth/passkey/_id_.d.mts +15 -0
- package/dist/astro/routes/api/auth/passkey/_id_.d.mts.map +1 -0
- package/dist/astro/routes/api/auth/passkey/_id_.mjs +75 -0
- package/dist/astro/routes/api/auth/passkey/_id_.mjs.map +1 -0
- package/dist/astro/routes/api/auth/passkey/index.d.mts +8 -0
- package/dist/astro/routes/api/auth/passkey/index.d.mts.map +1 -0
- package/dist/astro/routes/api/auth/passkey/index.mjs +30 -0
- package/dist/astro/routes/api/auth/passkey/index.mjs.map +1 -0
- package/dist/astro/routes/api/auth/passkey/options.d.mts +8 -0
- package/dist/astro/routes/api/auth/passkey/options.d.mts.map +1 -0
- package/dist/astro/routes/api/auth/passkey/options.mjs +50 -0
- package/dist/astro/routes/api/auth/passkey/options.mjs.map +1 -0
- package/dist/astro/routes/api/auth/passkey/register/options.d.mts +8 -0
- package/dist/astro/routes/api/auth/passkey/register/options.d.mts.map +1 -0
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +57 -0
- package/dist/astro/routes/api/auth/passkey/register/options.mjs.map +1 -0
- package/dist/astro/routes/api/auth/passkey/register/verify.d.mts +8 -0
- package/dist/astro/routes/api/auth/passkey/register/verify.d.mts.map +1 -0
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +72 -0
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs.map +1 -0
- package/dist/astro/routes/api/auth/passkey/verify.d.mts +8 -0
- package/dist/astro/routes/api/auth/passkey/verify.d.mts.map +1 -0
- package/dist/astro/routes/api/auth/passkey/verify.mjs +63 -0
- package/dist/astro/routes/api/auth/passkey/verify.mjs.map +1 -0
- package/dist/astro/routes/api/auth/signup/complete.d.mts +8 -0
- package/dist/astro/routes/api/auth/signup/complete.d.mts.map +1 -0
- package/dist/astro/routes/api/auth/signup/complete.mjs +71 -0
- package/dist/astro/routes/api/auth/signup/complete.mjs.map +1 -0
- package/dist/astro/routes/api/auth/signup/request.d.mts +8 -0
- package/dist/astro/routes/api/auth/signup/request.d.mts.map +1 -0
- package/dist/astro/routes/api/auth/signup/request.mjs +57 -0
- package/dist/astro/routes/api/auth/signup/request.mjs.map +1 -0
- package/dist/astro/routes/api/auth/signup/verify.d.mts +8 -0
- package/dist/astro/routes/api/auth/signup/verify.d.mts.map +1 -0
- package/dist/astro/routes/api/auth/signup/verify.mjs +37 -0
- package/dist/astro/routes/api/auth/signup/verify.mjs.map +1 -0
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.d.mts +15 -0
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.d.mts.map +1 -0
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +60 -0
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs.map +1 -0
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.d.mts +9 -0
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.d.mts.map +1 -0
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +189 -0
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/compare.d.mts +8 -0
- package/dist/astro/routes/api/content/_collection_/_id_/compare.d.mts.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +22 -0
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.d.mts +8 -0
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.d.mts.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +51 -0
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.d.mts +8 -0
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.d.mts.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +32 -0
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/lock.d.mts +10 -0
- package/dist/astro/routes/api/content/_collection_/_id_/lock.d.mts.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/lock.mjs +73 -0
- package/dist/astro/routes/api/content/_collection_/_id_/lock.mjs.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.d.mts +8 -0
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.d.mts.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +25 -0
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/plugin-extensions/_pluginId_/_kind_/_extensionId_.d.mts +8 -0
- package/dist/astro/routes/api/content/_collection_/_id_/plugin-extensions/_pluginId_/_kind_/_extensionId_.d.mts.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/plugin-extensions/_pluginId_/_kind_/_extensionId_.mjs +38 -0
- package/dist/astro/routes/api/content/_collection_/_id_/plugin-extensions/_pluginId_/_kind_/_extensionId_.mjs.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.d.mts +8 -0
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.d.mts.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +135 -0
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/publish.d.mts +15 -0
- package/dist/astro/routes/api/content/_collection_/_id_/publish.d.mts.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +74 -0
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.d.mts +8 -0
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.d.mts.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs +80 -0
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.d.mts +8 -0
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.d.mts.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.mjs +75 -0
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.mjs.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/restore.d.mts +8 -0
- package/dist/astro/routes/api/content/_collection_/_id_/restore.d.mts.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +30 -0
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.d.mts +8 -0
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.d.mts.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +24 -0
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.d.mts +9 -0
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.d.mts.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +85 -0
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.d.mts +15 -0
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.d.mts.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +133 -0
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/translations.d.mts +8 -0
- package/dist/astro/routes/api/content/_collection_/_id_/translations.d.mts.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +45 -0
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.d.mts +8 -0
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.d.mts.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +58 -0
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_.d.mts +10 -0
- package/dist/astro/routes/api/content/_collection_/_id_.d.mts.map +1 -0
- package/dist/astro/routes/api/content/_collection_/_id_.mjs +114 -0
- package/dist/astro/routes/api/content/_collection_/_id_.mjs.map +1 -0
- package/dist/astro/routes/api/content/_collection_/authors.d.mts +8 -0
- package/dist/astro/routes/api/content/_collection_/authors.d.mts.map +1 -0
- package/dist/astro/routes/api/content/_collection_/authors.mjs +21 -0
- package/dist/astro/routes/api/content/_collection_/authors.mjs.map +1 -0
- package/dist/astro/routes/api/content/_collection_/index.d.mts +9 -0
- package/dist/astro/routes/api/content/_collection_/index.d.mts.map +1 -0
- package/dist/astro/routes/api/content/_collection_/index.mjs +77 -0
- package/dist/astro/routes/api/content/_collection_/index.mjs.map +1 -0
- package/dist/astro/routes/api/content/_collection_/trash.d.mts +8 -0
- package/dist/astro/routes/api/content/_collection_/trash.d.mts.map +1 -0
- package/dist/astro/routes/api/content/_collection_/trash.mjs +36 -0
- package/dist/astro/routes/api/content/_collection_/trash.mjs.map +1 -0
- package/dist/astro/routes/api/dashboard.d.mts +8 -0
- package/dist/astro/routes/api/dashboard.d.mts.map +1 -0
- package/dist/astro/routes/api/dashboard.mjs +37 -0
- package/dist/astro/routes/api/dashboard.mjs.map +1 -0
- package/dist/astro/routes/api/dev/emails.d.mts +9 -0
- package/dist/astro/routes/api/dev/emails.d.mts.map +1 -0
- package/dist/astro/routes/api/dev/emails.mjs +22 -0
- package/dist/astro/routes/api/dev/emails.mjs.map +1 -0
- package/dist/astro/routes/api/health.d.mts +8 -0
- package/dist/astro/routes/api/health.d.mts.map +1 -0
- package/dist/astro/routes/api/health.mjs +23 -0
- package/dist/astro/routes/api/health.mjs.map +1 -0
- package/dist/astro/routes/api/import/probe.d.mts +18 -0
- package/dist/astro/routes/api/import/probe.d.mts.map +1 -0
- package/dist/astro/routes/api/import/probe.mjs +56 -0
- package/dist/astro/routes/api/import/probe.mjs.map +1 -0
- package/dist/astro/routes/api/import/wordpress/analyze.d.mts +88 -0
- package/dist/astro/routes/api/import/wordpress/analyze.d.mts.map +1 -0
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +315 -0
- package/dist/astro/routes/api/import/wordpress/analyze.mjs.map +1 -0
- package/dist/astro/routes/api/import/wordpress/execute.d.mts +66 -0
- package/dist/astro/routes/api/import/wordpress/execute.d.mts.map +1 -0
- package/dist/astro/routes/api/import/wordpress/execute.mjs +353 -0
- package/dist/astro/routes/api/import/wordpress/execute.mjs.map +1 -0
- package/dist/astro/routes/api/import/wordpress/media.d.mts +51 -0
- package/dist/astro/routes/api/import/wordpress/media.d.mts.map +1 -0
- package/dist/astro/routes/api/import/wordpress/media.mjs +241 -0
- package/dist/astro/routes/api/import/wordpress/media.mjs.map +1 -0
- package/dist/astro/routes/api/import/wordpress/prepare.d.mts +20 -0
- package/dist/astro/routes/api/import/wordpress/prepare.d.mts.map +1 -0
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +131 -0
- package/dist/astro/routes/api/import/wordpress/prepare.mjs.map +1 -0
- package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.d.mts +63 -0
- package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.d.mts.map +1 -0
- package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.mjs +149 -0
- package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.mjs.map +1 -0
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +37 -0
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts.map +1 -0
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +179 -0
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs.map +1 -0
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +16 -0
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts.map +1 -0
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +92 -0
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs.map +1 -0
- package/dist/astro/routes/api/import/wordpress-plugin/callback.d.mts +8 -0
- package/dist/astro/routes/api/import/wordpress-plugin/callback.d.mts.map +1 -0
- package/dist/astro/routes/api/import/wordpress-plugin/callback.mjs +29 -0
- package/dist/astro/routes/api/import/wordpress-plugin/callback.mjs.map +1 -0
- package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +60 -0
- package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts.map +1 -0
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +718 -0
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs.map +1 -0
- package/dist/astro/routes/api/manifest.d.mts +8 -0
- package/dist/astro/routes/api/manifest.d.mts.map +1 -0
- package/dist/astro/routes/api/manifest.mjs +65 -0
- package/dist/astro/routes/api/manifest.mjs.map +1 -0
- package/dist/astro/routes/api/mcp.d.mts +16 -0
- package/dist/astro/routes/api/mcp.d.mts.map +1 -0
- package/dist/astro/routes/api/mcp.mjs +2693 -0
- package/dist/astro/routes/api/mcp.mjs.map +1 -0
- package/dist/astro/routes/api/media/_id_/confirm.d.mts +11 -0
- package/dist/astro/routes/api/media/_id_/confirm.d.mts.map +1 -0
- package/dist/astro/routes/api/media/_id_/confirm.mjs +178 -0
- package/dist/astro/routes/api/media/_id_/confirm.mjs.map +1 -0
- package/dist/astro/routes/api/media/_id_/replace.d.mts +8 -0
- package/dist/astro/routes/api/media/_id_/replace.d.mts.map +1 -0
- package/dist/astro/routes/api/media/_id_/replace.mjs +99 -0
- package/dist/astro/routes/api/media/_id_/replace.mjs.map +1 -0
- package/dist/astro/routes/api/media/_id_/upload.d.mts +8 -0
- package/dist/astro/routes/api/media/_id_/upload.d.mts.map +1 -0
- package/dist/astro/routes/api/media/_id_/upload.mjs +170 -0
- package/dist/astro/routes/api/media/_id_/upload.mjs.map +1 -0
- package/dist/astro/routes/api/media/_id_/usage.d.mts +8 -0
- package/dist/astro/routes/api/media/_id_/usage.d.mts.map +1 -0
- package/dist/astro/routes/api/media/_id_/usage.mjs +60 -0
- package/dist/astro/routes/api/media/_id_/usage.mjs.map +1 -0
- package/dist/astro/routes/api/media/_id_.d.mts +23 -0
- package/dist/astro/routes/api/media/_id_.d.mts.map +1 -0
- package/dist/astro/routes/api/media/_id_.mjs +129 -0
- package/dist/astro/routes/api/media/_id_.mjs.map +1 -0
- package/dist/astro/routes/api/media/asset/_id_/_filename_.d.mts +8 -0
- package/dist/astro/routes/api/media/asset/_id_/_filename_.d.mts.map +1 -0
- package/dist/astro/routes/api/media/asset/_id_/_filename_.mjs +54 -0
- package/dist/astro/routes/api/media/asset/_id_/_filename_.mjs.map +1 -0
- package/dist/astro/routes/api/media/file/_...key_.d.mts +8 -0
- package/dist/astro/routes/api/media/file/_...key_.d.mts.map +1 -0
- package/dist/astro/routes/api/media/file/_...key_.mjs +83 -0
- package/dist/astro/routes/api/media/file/_...key_.mjs.map +1 -0
- package/dist/astro/routes/api/media/folders/_id_.d.mts +10 -0
- package/dist/astro/routes/api/media/folders/_id_.d.mts.map +1 -0
- package/dist/astro/routes/api/media/folders/_id_.mjs +60 -0
- package/dist/astro/routes/api/media/folders/_id_.mjs.map +1 -0
- package/dist/astro/routes/api/media/folders/index.d.mts +9 -0
- package/dist/astro/routes/api/media/folders/index.d.mts.map +1 -0
- package/dist/astro/routes/api/media/folders/index.mjs +49 -0
- package/dist/astro/routes/api/media/folders/index.mjs.map +1 -0
- package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.d.mts +15 -0
- package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.d.mts.map +1 -0
- package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +54 -0
- package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs.map +1 -0
- package/dist/astro/routes/api/media/providers/_providerId_/index.d.mts +15 -0
- package/dist/astro/routes/api/media/providers/_providerId_/index.d.mts.map +1 -0
- package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +77 -0
- package/dist/astro/routes/api/media/providers/_providerId_/index.mjs.map +1 -0
- package/dist/astro/routes/api/media/providers/index.d.mts +11 -0
- package/dist/astro/routes/api/media/providers/index.d.mts.map +1 -0
- package/dist/astro/routes/api/media/providers/index.mjs +23 -0
- package/dist/astro/routes/api/media/providers/index.mjs.map +1 -0
- package/dist/astro/routes/api/media/upload-url.d.mts +11 -0
- package/dist/astro/routes/api/media/upload-url.d.mts.map +1 -0
- package/dist/astro/routes/api/media/upload-url.mjs +106 -0
- package/dist/astro/routes/api/media/upload-url.mjs.map +1 -0
- package/dist/astro/routes/api/media.d.mts +17 -0
- package/dist/astro/routes/api/media.d.mts.map +1 -0
- package/dist/astro/routes/api/media.mjs +211 -0
- package/dist/astro/routes/api/media.mjs.map +1 -0
- package/dist/astro/routes/api/menus/_name_/items/_id_.d.mts +9 -0
- package/dist/astro/routes/api/menus/_name_/items/_id_.d.mts.map +1 -0
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +68 -0
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs.map +1 -0
- package/dist/astro/routes/api/menus/_name_/items.d.mts +8 -0
- package/dist/astro/routes/api/menus/_name_/items.d.mts.map +1 -0
- package/dist/astro/routes/api/menus/_name_/items.mjs +48 -0
- package/dist/astro/routes/api/menus/_name_/items.mjs.map +1 -0
- package/dist/astro/routes/api/menus/_name_/reorder.d.mts +8 -0
- package/dist/astro/routes/api/menus/_name_/reorder.d.mts.map +1 -0
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +48 -0
- package/dist/astro/routes/api/menus/_name_/reorder.mjs.map +1 -0
- package/dist/astro/routes/api/menus/_name_/translations.d.mts +9 -0
- package/dist/astro/routes/api/menus/_name_/translations.d.mts.map +1 -0
- package/dist/astro/routes/api/menus/_name_/translations.mjs +79 -0
- package/dist/astro/routes/api/menus/_name_/translations.mjs.map +1 -0
- package/dist/astro/routes/api/menus/_name_.d.mts +10 -0
- package/dist/astro/routes/api/menus/_name_.d.mts.map +1 -0
- package/dist/astro/routes/api/menus/_name_.mjs +80 -0
- package/dist/astro/routes/api/menus/_name_.mjs.map +1 -0
- package/dist/astro/routes/api/menus/index.d.mts +9 -0
- package/dist/astro/routes/api/menus/index.d.mts.map +1 -0
- package/dist/astro/routes/api/menus/index.mjs +57 -0
- package/dist/astro/routes/api/menus/index.mjs.map +1 -0
- package/dist/astro/routes/api/oauth/authorize.d.mts +9 -0
- package/dist/astro/routes/api/oauth/authorize.d.mts.map +1 -0
- package/dist/astro/routes/api/oauth/authorize.mjs +276 -0
- package/dist/astro/routes/api/oauth/authorize.mjs.map +1 -0
- package/dist/astro/routes/api/oauth/device/authorize.d.mts +9 -0
- package/dist/astro/routes/api/oauth/device/authorize.d.mts.map +1 -0
- package/dist/astro/routes/api/oauth/device/authorize.mjs +48 -0
- package/dist/astro/routes/api/oauth/device/authorize.mjs.map +1 -0
- package/dist/astro/routes/api/oauth/device/code.d.mts +8 -0
- package/dist/astro/routes/api/oauth/device/code.d.mts.map +1 -0
- package/dist/astro/routes/api/oauth/device/code.mjs +38 -0
- package/dist/astro/routes/api/oauth/device/code.mjs.map +1 -0
- package/dist/astro/routes/api/oauth/device/token.d.mts +8 -0
- package/dist/astro/routes/api/oauth/device/token.d.mts.map +1 -0
- package/dist/astro/routes/api/oauth/device/token.mjs +49 -0
- package/dist/astro/routes/api/oauth/device/token.mjs.map +1 -0
- package/dist/astro/routes/api/oauth/register.d.mts +9 -0
- package/dist/astro/routes/api/oauth/register.d.mts.map +1 -0
- package/dist/astro/routes/api/oauth/register.mjs +123 -0
- package/dist/astro/routes/api/oauth/register.mjs.map +1 -0
- package/dist/astro/routes/api/oauth/token/refresh.d.mts +8 -0
- package/dist/astro/routes/api/oauth/token/refresh.d.mts.map +1 -0
- package/dist/astro/routes/api/oauth/token/refresh.mjs +32 -0
- package/dist/astro/routes/api/oauth/token/refresh.mjs.map +1 -0
- package/dist/astro/routes/api/oauth/token/revoke.d.mts +8 -0
- package/dist/astro/routes/api/oauth/token/revoke.d.mts.map +1 -0
- package/dist/astro/routes/api/oauth/token/revoke.mjs +29 -0
- package/dist/astro/routes/api/oauth/token/revoke.mjs.map +1 -0
- package/dist/astro/routes/api/oauth/token.d.mts +9 -0
- package/dist/astro/routes/api/oauth/token.d.mts.map +1 -0
- package/dist/astro/routes/api/oauth/token.mjs +143 -0
- package/dist/astro/routes/api/oauth/token.mjs.map +1 -0
- package/dist/astro/routes/api/openapi.json.d.mts +8 -0
- package/dist/astro/routes/api/openapi.json.d.mts.map +1 -0
- package/dist/astro/routes/api/openapi.json.mjs +3676 -0
- package/dist/astro/routes/api/openapi.json.mjs.map +1 -0
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.d.mts +13 -0
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.d.mts.map +1 -0
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +44 -0
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs.map +1 -0
- package/dist/astro/routes/api/redirects/404s/index.d.mts +10 -0
- package/dist/astro/routes/api/redirects/404s/index.d.mts.map +1 -0
- package/dist/astro/routes/api/redirects/404s/index.mjs +76 -0
- package/dist/astro/routes/api/redirects/404s/index.mjs.map +1 -0
- package/dist/astro/routes/api/redirects/404s/summary.d.mts +8 -0
- package/dist/astro/routes/api/redirects/404s/summary.d.mts.map +1 -0
- package/dist/astro/routes/api/redirects/404s/summary.mjs +48 -0
- package/dist/astro/routes/api/redirects/404s/summary.mjs.map +1 -0
- package/dist/astro/routes/api/redirects/_id_.d.mts +10 -0
- package/dist/astro/routes/api/redirects/_id_.d.mts.map +1 -0
- package/dist/astro/routes/api/redirects/_id_.mjs +80 -0
- package/dist/astro/routes/api/redirects/_id_.mjs.map +1 -0
- package/dist/astro/routes/api/redirects/index.d.mts +9 -0
- package/dist/astro/routes/api/redirects/index.d.mts.map +1 -0
- package/dist/astro/routes/api/redirects/index.mjs +63 -0
- package/dist/astro/routes/api/redirects/index.mjs.map +1 -0
- package/dist/astro/routes/api/relations/_id_/index.d.mts +10 -0
- package/dist/astro/routes/api/relations/_id_/index.d.mts.map +1 -0
- package/dist/astro/routes/api/relations/_id_/index.mjs +94 -0
- package/dist/astro/routes/api/relations/_id_/index.mjs.map +1 -0
- package/dist/astro/routes/api/relations/index.d.mts +9 -0
- package/dist/astro/routes/api/relations/index.d.mts.map +1 -0
- package/dist/astro/routes/api/relations/index.mjs +78 -0
- package/dist/astro/routes/api/relations/index.mjs.map +1 -0
- package/dist/astro/routes/api/revisions/_revisionId_/index.d.mts +8 -0
- package/dist/astro/routes/api/revisions/_revisionId_/index.d.mts.map +1 -0
- package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +21 -0
- package/dist/astro/routes/api/revisions/_revisionId_/index.mjs.map +1 -0
- package/dist/astro/routes/api/revisions/_revisionId_/restore.d.mts +8 -0
- package/dist/astro/routes/api/revisions/_revisionId_/restore.d.mts.map +1 -0
- package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +48 -0
- package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs.map +1 -0
- package/dist/astro/routes/api/schema/block-types/_slug_/index.d.mts +9 -0
- package/dist/astro/routes/api/schema/block-types/_slug_/index.d.mts.map +1 -0
- package/dist/astro/routes/api/schema/block-types/_slug_/index.mjs +109 -0
- package/dist/astro/routes/api/schema/block-types/_slug_/index.mjs.map +1 -0
- package/dist/astro/routes/api/schema/block-types/_slug_/versions/_version_/activate.d.mts +8 -0
- package/dist/astro/routes/api/schema/block-types/_slug_/versions/_version_/activate.d.mts.map +1 -0
- package/dist/astro/routes/api/schema/block-types/_slug_/versions/_version_/activate.mjs +103 -0
- package/dist/astro/routes/api/schema/block-types/_slug_/versions/_version_/activate.mjs.map +1 -0
- package/dist/astro/routes/api/schema/block-types/index.d.mts +9 -0
- package/dist/astro/routes/api/schema/block-types/index.d.mts.map +1 -0
- package/dist/astro/routes/api/schema/block-types/index.mjs +109 -0
- package/dist/astro/routes/api/schema/block-types/index.mjs.map +1 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.d.mts +10 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.d.mts.map +1 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +123 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs.map +1 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.d.mts +9 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.d.mts.map +1 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +111 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs.map +1 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.d.mts +8 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.d.mts.map +1 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +102 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs.map +1 -0
- package/dist/astro/routes/api/schema/collections/_slug_/index.d.mts +10 -0
- package/dist/astro/routes/api/schema/collections/_slug_/index.d.mts.map +1 -0
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +127 -0
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs.map +1 -0
- package/dist/astro/routes/api/schema/collections/index.d.mts +9 -0
- package/dist/astro/routes/api/schema/collections/index.d.mts.map +1 -0
- package/dist/astro/routes/api/schema/collections/index.mjs +111 -0
- package/dist/astro/routes/api/schema/collections/index.mjs.map +1 -0
- package/dist/astro/routes/api/schema/collections/reorder.d.mts +8 -0
- package/dist/astro/routes/api/schema/collections/reorder.d.mts.map +1 -0
- package/dist/astro/routes/api/schema/collections/reorder.mjs +101 -0
- package/dist/astro/routes/api/schema/collections/reorder.mjs.map +1 -0
- package/dist/astro/routes/api/schema/index.d.mts +8 -0
- package/dist/astro/routes/api/schema/index.d.mts.map +1 -0
- package/dist/astro/routes/api/schema/index.mjs +92 -0
- package/dist/astro/routes/api/schema/index.mjs.map +1 -0
- package/dist/astro/routes/api/schema/orphans/_slug_.d.mts +8 -0
- package/dist/astro/routes/api/schema/orphans/_slug_.d.mts.map +1 -0
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +103 -0
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs.map +1 -0
- package/dist/astro/routes/api/schema/orphans/index.d.mts +8 -0
- package/dist/astro/routes/api/schema/orphans/index.d.mts.map +1 -0
- package/dist/astro/routes/api/schema/orphans/index.mjs +98 -0
- package/dist/astro/routes/api/schema/orphans/index.mjs.map +1 -0
- package/dist/astro/routes/api/search/enable.d.mts +17 -0
- package/dist/astro/routes/api/search/enable.d.mts.map +1 -0
- package/dist/astro/routes/api/search/enable.mjs +71 -0
- package/dist/astro/routes/api/search/enable.mjs.map +1 -0
- package/dist/astro/routes/api/search/index.d.mts +17 -0
- package/dist/astro/routes/api/search/index.d.mts.map +1 -0
- package/dist/astro/routes/api/search/index.mjs +66 -0
- package/dist/astro/routes/api/search/index.mjs.map +1 -0
- package/dist/astro/routes/api/search/rebuild.d.mts +14 -0
- package/dist/astro/routes/api/search/rebuild.d.mts.map +1 -0
- package/dist/astro/routes/api/search/rebuild.mjs +60 -0
- package/dist/astro/routes/api/search/rebuild.mjs.map +1 -0
- package/dist/astro/routes/api/search/stats.d.mts +11 -0
- package/dist/astro/routes/api/search/stats.d.mts.map +1 -0
- package/dist/astro/routes/api/search/stats.mjs +33 -0
- package/dist/astro/routes/api/search/stats.mjs.map +1 -0
- package/dist/astro/routes/api/search/suggest.d.mts +16 -0
- package/dist/astro/routes/api/search/suggest.d.mts.map +1 -0
- package/dist/astro/routes/api/search/suggest.mjs +55 -0
- package/dist/astro/routes/api/search/suggest.mjs.map +1 -0
- package/dist/astro/routes/api/sections/_slug_.d.mts +10 -0
- package/dist/astro/routes/api/sections/_slug_.d.mts.map +1 -0
- package/dist/astro/routes/api/sections/_slug_.mjs +77 -0
- package/dist/astro/routes/api/sections/_slug_.mjs.map +1 -0
- package/dist/astro/routes/api/sections/index.d.mts +9 -0
- package/dist/astro/routes/api/sections/index.d.mts.map +1 -0
- package/dist/astro/routes/api/sections/index.mjs +60 -0
- package/dist/astro/routes/api/sections/index.mjs.map +1 -0
- package/dist/astro/routes/api/settings/backups/archives/_name_.d.mts +9 -0
- package/dist/astro/routes/api/settings/backups/archives/_name_.d.mts.map +1 -0
- package/dist/astro/routes/api/settings/backups/archives/_name_.mjs +50 -0
- package/dist/astro/routes/api/settings/backups/archives/_name_.mjs.map +1 -0
- package/dist/astro/routes/api/settings/backups/archives/index.d.mts +8 -0
- package/dist/astro/routes/api/settings/backups/archives/index.d.mts.map +1 -0
- package/dist/astro/routes/api/settings/backups/archives/index.mjs +26 -0
- package/dist/astro/routes/api/settings/backups/archives/index.mjs.map +1 -0
- package/dist/astro/routes/api/settings/backups/export.d.mts +8 -0
- package/dist/astro/routes/api/settings/backups/export.d.mts.map +1 -0
- package/dist/astro/routes/api/settings/backups/export.mjs +37 -0
- package/dist/astro/routes/api/settings/backups/export.mjs.map +1 -0
- package/dist/astro/routes/api/settings/backups/index.d.mts +9 -0
- package/dist/astro/routes/api/settings/backups/index.d.mts.map +1 -0
- package/dist/astro/routes/api/settings/backups/index.mjs +54 -0
- package/dist/astro/routes/api/settings/backups/index.mjs.map +1 -0
- package/dist/astro/routes/api/settings/email.d.mts +18 -0
- package/dist/astro/routes/api/settings/email.d.mts.map +1 -0
- package/dist/astro/routes/api/settings/email.mjs +107 -0
- package/dist/astro/routes/api/settings/email.mjs.map +1 -0
- package/dist/astro/routes/api/settings.d.mts +21 -0
- package/dist/astro/routes/api/settings.d.mts.map +1 -0
- package/dist/astro/routes/api/settings.mjs +76 -0
- package/dist/astro/routes/api/settings.mjs.map +1 -0
- package/dist/astro/routes/api/setup/admin-verify.d.mts +8 -0
- package/dist/astro/routes/api/setup/admin-verify.d.mts.map +1 -0
- package/dist/astro/routes/api/setup/admin-verify.mjs +83 -0
- package/dist/astro/routes/api/setup/admin-verify.mjs.map +1 -0
- package/dist/astro/routes/api/setup/admin.d.mts +8 -0
- package/dist/astro/routes/api/setup/admin.d.mts.map +1 -0
- package/dist/astro/routes/api/setup/admin.mjs +83 -0
- package/dist/astro/routes/api/setup/admin.mjs.map +1 -0
- package/dist/astro/routes/api/setup/dev-bypass.d.mts +9 -0
- package/dist/astro/routes/api/setup/dev-bypass.d.mts.map +1 -0
- package/dist/astro/routes/api/setup/dev-bypass.mjs +172 -0
- package/dist/astro/routes/api/setup/dev-bypass.mjs.map +1 -0
- package/dist/astro/routes/api/setup/dev-reset.d.mts +8 -0
- package/dist/astro/routes/api/setup/dev-reset.d.mts.map +1 -0
- package/dist/astro/routes/api/setup/dev-reset.mjs +27 -0
- package/dist/astro/routes/api/setup/dev-reset.mjs.map +1 -0
- package/dist/astro/routes/api/setup/index.d.mts +8 -0
- package/dist/astro/routes/api/setup/index.d.mts.map +1 -0
- package/dist/astro/routes/api/setup/index.mjs +147 -0
- package/dist/astro/routes/api/setup/index.mjs.map +1 -0
- package/dist/astro/routes/api/setup/status.d.mts +8 -0
- package/dist/astro/routes/api/setup/status.d.mts.map +1 -0
- package/dist/astro/routes/api/setup/status.mjs +62 -0
- package/dist/astro/routes/api/setup/status.mjs.map +1 -0
- package/dist/astro/routes/api/snapshot.d.mts +8 -0
- package/dist/astro/routes/api/snapshot.d.mts.map +1 -0
- package/dist/astro/routes/api/snapshot.mjs +68 -0
- package/dist/astro/routes/api/snapshot.mjs.map +1 -0
- package/dist/astro/routes/api/taxonomies/_name_/reorder.d.mts +8 -0
- package/dist/astro/routes/api/taxonomies/_name_/reorder.d.mts.map +1 -0
- package/dist/astro/routes/api/taxonomies/_name_/reorder.mjs +57 -0
- package/dist/astro/routes/api/taxonomies/_name_/reorder.mjs.map +1 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.d.mts +9 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.d.mts.map +1 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +92 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs.map +1 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.d.mts +19 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.d.mts.map +1 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +103 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs.map +1 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.d.mts +15 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.d.mts.map +1 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +83 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs.map +1 -0
- 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 +55 -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 +104 -0
- package/dist/astro/routes/api/taxonomies/_name_.mjs.map +1 -0
- package/dist/astro/routes/api/taxonomies/bulk-tag.d.mts +8 -0
- package/dist/astro/routes/api/taxonomies/bulk-tag.d.mts.map +1 -0
- package/dist/astro/routes/api/taxonomies/bulk-tag.mjs +297 -0
- package/dist/astro/routes/api/taxonomies/bulk-tag.mjs.map +1 -0
- package/dist/astro/routes/api/taxonomies/index.d.mts +15 -0
- package/dist/astro/routes/api/taxonomies/index.d.mts.map +1 -0
- package/dist/astro/routes/api/taxonomies/index.mjs +75 -0
- package/dist/astro/routes/api/taxonomies/index.mjs.map +1 -0
- package/dist/astro/routes/api/themes/preview.d.mts +8 -0
- package/dist/astro/routes/api/themes/preview.d.mts.map +1 -0
- package/dist/astro/routes/api/themes/preview.mjs +52 -0
- package/dist/astro/routes/api/themes/preview.mjs.map +1 -0
- package/dist/astro/routes/api/typegen.d.mts +18 -0
- package/dist/astro/routes/api/typegen.d.mts.map +1 -0
- package/dist/astro/routes/api/typegen.mjs +50 -0
- package/dist/astro/routes/api/typegen.mjs.map +1 -0
- package/dist/astro/routes/api/visual-editing/action-token.d.mts +8 -0
- package/dist/astro/routes/api/visual-editing/action-token.d.mts.map +1 -0
- package/dist/astro/routes/api/visual-editing/action-token.mjs +27 -0
- package/dist/astro/routes/api/visual-editing/action-token.mjs.map +1 -0
- package/dist/astro/routes/api/visual-editing/content/_collection_/_id_/publish.d.mts +8 -0
- package/dist/astro/routes/api/visual-editing/content/_collection_/_id_/publish.d.mts.map +1 -0
- package/dist/astro/routes/api/visual-editing/content/_collection_/_id_/publish.mjs +44 -0
- package/dist/astro/routes/api/visual-editing/content/_collection_/_id_/publish.mjs.map +1 -0
- package/dist/astro/routes/api/visual-editing/toolbar-labels.d.mts +8 -0
- package/dist/astro/routes/api/visual-editing/toolbar-labels.d.mts.map +1 -0
- package/dist/astro/routes/api/visual-editing/toolbar-labels.mjs +22 -0
- package/dist/astro/routes/api/visual-editing/toolbar-labels.mjs.map +1 -0
- package/dist/astro/routes/api/well-known/auth.d.mts +8 -0
- package/dist/astro/routes/api/well-known/auth.d.mts.map +1 -0
- package/dist/astro/routes/api/well-known/auth.mjs +42 -0
- package/dist/astro/routes/api/well-known/auth.mjs.map +1 -0
- package/dist/astro/routes/api/well-known/oauth-authorization-server.d.mts +8 -0
- package/dist/astro/routes/api/well-known/oauth-authorization-server.d.mts.map +1 -0
- package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +33 -0
- package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs.map +1 -0
- package/dist/astro/routes/api/well-known/oauth-protected-resource.d.mts +8 -0
- package/dist/astro/routes/api/well-known/oauth-protected-resource.d.mts.map +1 -0
- package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +22 -0
- package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs.map +1 -0
- package/dist/astro/routes/api/widget-areas/_name_/reorder.d.mts +8 -0
- package/dist/astro/routes/api/widget-areas/_name_/reorder.d.mts.map +1 -0
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +49 -0
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs.map +1 -0
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.d.mts +9 -0
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.d.mts.map +1 -0
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +78 -0
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs.map +1 -0
- package/dist/astro/routes/api/widget-areas/_name_/widgets.d.mts +8 -0
- package/dist/astro/routes/api/widget-areas/_name_/widgets.d.mts.map +1 -0
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +64 -0
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs.map +1 -0
- package/dist/astro/routes/api/widget-areas/_name_.d.mts +9 -0
- package/dist/astro/routes/api/widget-areas/_name_.d.mts.map +1 -0
- package/dist/astro/routes/api/widget-areas/_name_.mjs +55 -0
- package/dist/astro/routes/api/widget-areas/_name_.mjs.map +1 -0
- package/dist/astro/routes/api/widget-areas/index.d.mts +9 -0
- package/dist/astro/routes/api/widget-areas/index.d.mts.map +1 -0
- package/dist/astro/routes/api/widget-areas/index.mjs +74 -0
- package/dist/astro/routes/api/widget-areas/index.mjs.map +1 -0
- package/dist/astro/routes/api/widget-components.d.mts +8 -0
- package/dist/astro/routes/api/widget-components.d.mts.map +1 -0
- package/dist/astro/routes/api/widget-components.mjs +20 -0
- package/dist/astro/routes/api/widget-components.mjs.map +1 -0
- package/dist/astro/routes/robots.txt.d.mts +8 -0
- package/dist/astro/routes/robots.txt.d.mts.map +1 -0
- package/dist/astro/routes/robots.txt.mjs +65 -0
- package/dist/astro/routes/robots.txt.mjs.map +1 -0
- package/dist/astro/routes/sitemap-_collection_.xml.d.mts +8 -0
- package/dist/astro/routes/sitemap-_collection_.xml.d.mts.map +1 -0
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +131 -0
- package/dist/astro/routes/sitemap-_collection_.xml.mjs.map +1 -0
- package/dist/astro/routes/sitemap.xml.d.mts +8 -0
- package/dist/astro/routes/sitemap.xml.d.mts.map +1 -0
- package/dist/astro/routes/sitemap.xml.mjs +68 -0
- package/dist/astro/routes/sitemap.xml.mjs.map +1 -0
- package/dist/astro/types.d.mts +246 -25
- package/dist/astro/types.d.mts.map +1 -1
- package/dist/audit-BszbE_BP.mjs +127 -0
- package/dist/audit-BszbE_BP.mjs.map +1 -0
- package/dist/auth/providers/github.d.mts +13 -0
- package/dist/auth/providers/github.d.mts.map +1 -0
- package/dist/auth/providers/github.mjs +18 -0
- package/dist/auth/providers/github.mjs.map +1 -0
- package/dist/auth/providers/google.d.mts +13 -0
- package/dist/auth/providers/google.d.mts.map +1 -0
- package/dist/auth/providers/google.mjs +18 -0
- package/dist/auth/providers/google.mjs.map +1 -0
- package/dist/authoritative-records-dSvXCfzb.mjs +5172 -0
- package/dist/authoritative-records-dSvXCfzb.mjs.map +1 -0
- package/dist/authorize-CJtizVbp.mjs +49 -0
- package/dist/authorize-CJtizVbp.mjs.map +1 -0
- package/dist/backup-Cpl8TqRz.mjs +246 -0
- package/dist/backup-Cpl8TqRz.mjs.map +1 -0
- package/dist/base64-DvnNgP7e.mjs +63 -0
- package/dist/base64-DvnNgP7e.mjs.map +1 -0
- package/dist/block-types-DIG_KZwi.mjs +132 -0
- package/dist/block-types-DIG_KZwi.mjs.map +1 -0
- package/dist/block-values-BrTrtA-v.mjs +175 -0
- package/dist/block-values-BrTrtA-v.mjs.map +1 -0
- package/dist/byline-02tu_Uc-.mjs +909 -0
- package/dist/byline-02tu_Uc-.mjs.map +1 -0
- package/dist/byline-fields-DHJs0Mja.mjs +280 -0
- package/dist/byline-fields-DHJs0Mja.mjs.map +1 -0
- package/dist/byline-fields-xdxE9kxZ.mjs +123 -0
- package/dist/byline-fields-xdxE9kxZ.mjs.map +1 -0
- package/dist/byline-registry-dvt4N3xV.mjs +406 -0
- package/dist/byline-registry-dvt4N3xV.mjs.map +1 -0
- package/dist/bylines-CTGTsEAs.mjs +150 -0
- package/dist/bylines-CTGTsEAs.mjs.map +1 -0
- package/dist/bylines-DATJ0B8u.mjs +214 -0
- package/dist/bylines-DATJ0B8u.mjs.map +1 -0
- package/dist/cache-CPanL9IO.mjs +114 -0
- package/dist/cache-CPanL9IO.mjs.map +1 -0
- package/dist/canonical-CAecl1UQ.mjs +174 -0
- package/dist/canonical-CAecl1UQ.mjs.map +1 -0
- package/dist/capture-triggers-CdZfvHtF.mjs +362 -0
- package/dist/capture-triggers-CdZfvHtF.mjs.map +1 -0
- package/dist/challenge-store-CxZxPqaw.mjs +51 -0
- package/dist/challenge-store-CxZxPqaw.mjs.map +1 -0
- package/dist/checksum-DtH6m5uk.mjs +162 -0
- package/dist/checksum-DtH6m5uk.mjs.map +1 -0
- package/dist/chrome-tags-CKELm-bo.mjs +24 -0
- package/dist/chrome-tags-CKELm-bo.mjs.map +1 -0
- package/dist/chunks-DBmkKmBH.mjs +25 -0
- package/dist/chunks-DBmkKmBH.mjs.map +1 -0
- package/dist/cli/index.mjs +3021 -1548
- package/dist/cli/index.mjs.map +1 -1
- package/dist/client/cf-access.d.mts +1 -1
- package/dist/client/index.d.mts +1296 -11
- package/dist/client/index.d.mts.map +1 -1
- package/dist/client/index.mjs +313 -27
- package/dist/client/index.mjs.map +1 -1
- package/dist/collection-deletion-JecE26cS.mjs +436 -0
- package/dist/collection-deletion-JecE26cS.mjs.map +1 -0
- package/dist/collection-deletion-processor-DgCfF3a1.mjs +217 -0
- package/dist/collection-deletion-processor-DgCfF3a1.mjs.map +1 -0
- package/dist/collection-slugs-cache-BNRAPNiu.mjs +85 -0
- package/dist/collection-slugs-cache-BNRAPNiu.mjs.map +1 -0
- package/dist/comment-Cq1UYN8_.mjs +313 -0
- package/dist/comment-Cq1UYN8_.mjs.map +1 -0
- package/dist/comment-reaction-DPeGAfjd.mjs +85 -0
- package/dist/comment-reaction-DPeGAfjd.mjs.map +1 -0
- package/dist/comments-BRtp992B.mjs +99 -0
- package/dist/comments-BRtp992B.mjs.map +1 -0
- package/dist/comments-Bi2j9IoX.mjs +195 -0
- package/dist/comments-Bi2j9IoX.mjs.map +1 -0
- package/dist/components-CQY-Sgm-.mjs +108 -0
- package/dist/components-CQY-Sgm-.mjs.map +1 -0
- package/dist/config-B-uePMLj.d.mts +39 -0
- package/dist/config-B-uePMLj.d.mts.map +1 -0
- package/dist/config-BVX7iYr4.d.mts +6679 -0
- package/dist/config-BVX7iYr4.d.mts.map +1 -0
- package/dist/config-CXPcy2iY.mjs +228 -0
- package/dist/config-CXPcy2iY.mjs.map +1 -0
- package/dist/config-CvmjJcVw.mjs +73 -0
- package/dist/config-CvmjJcVw.mjs.map +1 -0
- package/dist/connection-B9pIasFd.mjs +36 -0
- package/dist/connection-B9pIasFd.mjs.map +1 -0
- package/dist/content-RzEXY3QX.mjs +2020 -0
- package/dist/content-RzEXY3QX.mjs.map +1 -0
- package/dist/content-list-query-DiNwyKtd.d.mts +26 -0
- package/dist/content-list-query-DiNwyKtd.d.mts.map +1 -0
- package/dist/content-policy-Dm32n9C6.mjs +46 -0
- package/dist/content-policy-Dm32n9C6.mjs.map +1 -0
- package/dist/content-repair-B-k5JrVN.mjs +442 -0
- package/dist/content-repair-B-k5JrVN.mjs.map +1 -0
- package/dist/context-CTkYVMZV.mjs +2026 -0
- package/dist/context-CTkYVMZV.mjs.map +1 -0
- package/dist/credits-CAFPFhuk.mjs +110 -0
- package/dist/credits-CAFPFhuk.mjs.map +1 -0
- package/dist/cron-xe5XKqA-.mjs +306 -0
- package/dist/cron-xe5XKqA-.mjs.map +1 -0
- package/dist/dashboard-BoV4pwPP.mjs +151 -0
- package/dist/dashboard-BoV4pwPP.mjs.map +1 -0
- package/dist/database/instrumentation.d.mts +35 -5
- package/dist/database/instrumentation.d.mts.map +1 -1
- package/dist/database/instrumentation.mjs +40 -9
- package/dist/database/instrumentation.mjs.map +1 -1
- package/dist/database/migration-lock.d.mts +37 -0
- package/dist/database/migration-lock.d.mts.map +1 -0
- package/dist/database/migration-lock.mjs +76 -0
- package/dist/database/migration-lock.mjs.map +1 -0
- package/dist/database/pg-migration-lock.d.mts +21 -0
- package/dist/database/pg-migration-lock.d.mts.map +1 -0
- package/dist/database/pg-migration-lock.mjs +42 -0
- package/dist/database/pg-migration-lock.mjs.map +1 -0
- package/dist/datetime-normalization-PeiEdcRY.mjs +187 -0
- package/dist/datetime-normalization-PeiEdcRY.mjs.map +1 -0
- package/dist/db/index.d.mts +4 -4
- package/dist/db/index.mjs +35 -10
- package/dist/db/index.mjs.map +1 -1
- package/dist/db/libsql-migrations.d.mts +11 -0
- package/dist/db/libsql-migrations.d.mts.map +1 -0
- package/dist/db/libsql-migrations.mjs +58 -0
- package/dist/db/libsql-migrations.mjs.map +1 -0
- package/dist/db/libsql.d.mts +1 -1
- package/dist/db/libsql.d.mts.map +1 -1
- package/dist/db/libsql.mjs +7 -2
- package/dist/db/libsql.mjs.map +1 -1
- package/dist/db/postgres-migrations.d.mts +10 -0
- package/dist/db/postgres-migrations.d.mts.map +1 -0
- package/dist/db/postgres-migrations.mjs +48 -0
- package/dist/db/postgres-migrations.mjs.map +1 -0
- package/dist/db/postgres.d.mts +1 -1
- package/dist/db/postgres.d.mts.map +1 -1
- package/dist/db/postgres.mjs +20 -10
- package/dist/db/postgres.mjs.map +1 -1
- package/dist/db/sqlite-migrations.d.mts +10 -0
- package/dist/db/sqlite-migrations.d.mts.map +1 -0
- package/dist/db/sqlite-migrations.mjs +29 -0
- package/dist/db/sqlite-migrations.mjs.map +1 -0
- package/dist/db/sqlite.d.mts +1 -1
- package/dist/db/sqlite.d.mts.map +1 -1
- package/dist/db/sqlite.mjs +9 -4
- package/dist/db/sqlite.mjs.map +1 -1
- package/dist/db-errors-CBD5yMro.mjs +55 -0
- package/dist/db-errors-CBD5yMro.mjs.map +1 -0
- package/dist/default-DaoYyFRS.mjs +81 -0
- package/dist/default-DaoYyFRS.mjs.map +1 -0
- package/dist/deferred-tasks-BYcDx2o_.d.mts +9 -0
- package/dist/deferred-tasks-BYcDx2o_.d.mts.map +1 -0
- package/dist/destination-r2zIAZ2S.mjs +18 -0
- package/dist/destination-r2zIAZ2S.mjs.map +1 -0
- package/dist/dev-typegen-8JlYYFno.mjs +29 -0
- package/dist/dev-typegen-8JlYYFno.mjs.map +1 -0
- package/dist/device-flow-Ma5P5d2e.mjs +521 -0
- package/dist/device-flow-Ma5P5d2e.mjs.map +1 -0
- package/dist/dialect-helpers-7_IqPdh9.mjs +307 -0
- package/dist/dialect-helpers-7_IqPdh9.mjs.map +1 -0
- package/dist/digest-DiYAoZpf.mjs +194 -0
- package/dist/digest-DiYAoZpf.mjs.map +1 -0
- package/dist/direct-executor-FCIRepAU.mjs +104 -0
- package/dist/direct-executor-FCIRepAU.mjs.map +1 -0
- package/dist/dist-Cfu8mMBs.mjs +810 -0
- package/dist/dist-Cfu8mMBs.mjs.map +1 -0
- package/dist/email-console-DmqVF5J_.mjs +50 -0
- package/dist/email-console-DmqVF5J_.mjs.map +1 -0
- package/dist/email-locale-Cc5YSXfJ.mjs +25 -0
- package/dist/email-locale-Cc5YSXfJ.mjs.map +1 -0
- package/dist/emdash-runtime-YPrVnr6x.mjs +4226 -0
- package/dist/emdash-runtime-YPrVnr6x.mjs.map +1 -0
- package/dist/enrich-BDdVNeDK.mjs +194 -0
- package/dist/enrich-BDdVNeDK.mjs.map +1 -0
- package/dist/entry-lock-BtDo1zFm.d.mts +4544 -0
- package/dist/entry-lock-BtDo1zFm.d.mts.map +1 -0
- package/dist/entry-lock-PP1JCXBB.mjs +1180 -0
- package/dist/entry-lock-PP1JCXBB.mjs.map +1 -0
- package/dist/entry-lock-WyppUeRW.mjs +163 -0
- package/dist/entry-lock-WyppUeRW.mjs.map +1 -0
- package/dist/entry-locks-DJAqVweV.mjs +167 -0
- package/dist/entry-locks-DJAqVweV.mjs.map +1 -0
- package/dist/env-types-BaTCgn-y.mjs +38 -0
- package/dist/env-types-BaTCgn-y.mjs.map +1 -0
- package/dist/error-CEdm_AWU.mjs +90 -0
- package/dist/error-CEdm_AWU.mjs.map +1 -0
- package/dist/errors-9P_FDrJ_.mjs +17 -0
- package/dist/errors-9P_FDrJ_.mjs.map +1 -0
- package/dist/errors-CNvATh_7.mjs +469 -0
- package/dist/errors-CNvATh_7.mjs.map +1 -0
- package/dist/errors-CjXd1LgH.mjs +120 -0
- package/dist/errors-CjXd1LgH.mjs.map +1 -0
- package/dist/escape-nJW7dR0s.mjs +9 -0
- package/dist/escape-nJW7dR0s.mjs.map +1 -0
- package/dist/fence-BrnQffdY.mjs +162 -0
- package/dist/fence-BrnQffdY.mjs.map +1 -0
- package/dist/field-defs-cache-DEkFYCDE.mjs +77 -0
- package/dist/field-defs-cache-DEkFYCDE.mjs.map +1 -0
- package/dist/field-map-BfYMstlG.mjs +83 -0
- package/dist/field-map-BfYMstlG.mjs.map +1 -0
- package/dist/focal-point-JX8kcOTQ.mjs +23 -0
- package/dist/focal-point-JX8kcOTQ.mjs.map +1 -0
- package/dist/fts-manager-DU03MxWu.mjs +443 -0
- package/dist/fts-manager-DU03MxWu.mjs.map +1 -0
- package/dist/gc-BO9NqlAe.mjs +75 -0
- package/dist/gc-BO9NqlAe.mjs.map +1 -0
- package/dist/hash-CY4QdeMJ.mjs +37 -0
- package/dist/hash-CY4QdeMJ.mjs.map +1 -0
- package/dist/hook-result-DSRRxu_-.d.mts +31 -0
- package/dist/hook-result-DSRRxu_-.d.mts.map +1 -0
- package/dist/hreflang--av8HanY.d.mts +50 -0
- package/dist/hreflang--av8HanY.d.mts.map +1 -0
- package/dist/hreflang-CNbZjm4g.mjs +105 -0
- package/dist/hreflang-CNbZjm4g.mjs.map +1 -0
- package/dist/http-route-dispatch-16nzAM5m.mjs +339 -0
- package/dist/http-route-dispatch-16nzAM5m.mjs.map +1 -0
- package/dist/identity-DNaOsiip.mjs +35 -0
- package/dist/identity-DNaOsiip.mjs.map +1 -0
- package/dist/import-DUV3Gl6-.mjs +2020 -0
- package/dist/import-DUV3Gl6-.mjs.map +1 -0
- package/dist/index-m-lYQRqs.d.mts +623 -0
- package/dist/index-m-lYQRqs.d.mts.map +1 -0
- package/dist/index.d.mts +27 -11
- package/dist/index.mjs +120 -28
- package/dist/init-lock-4eRRB4Le.mjs +56 -0
- package/dist/init-lock-4eRRB4Le.mjs.map +1 -0
- package/dist/install-finalization-CPM7Gged.mjs +58 -0
- package/dist/install-finalization-CPM7Gged.mjs.map +1 -0
- package/dist/keys-B8g41vwJ.mjs +61 -0
- package/dist/keys-B8g41vwJ.mjs.map +1 -0
- package/dist/kinds-BKu9nb7q.mjs +974 -0
- package/dist/kinds-BKu9nb7q.mjs.map +1 -0
- package/dist/lifecycle-CpebZNAA.mjs +25 -0
- package/dist/lifecycle-CpebZNAA.mjs.map +1 -0
- package/dist/load-dHcR5yh9.mjs +28 -0
- package/dist/load-dHcR5yh9.mjs.map +1 -0
- package/dist/loader-CWb-ja1p.mjs +1197 -0
- package/dist/loader-CWb-ja1p.mjs.map +1 -0
- package/dist/loops-Dn1i16FP.mjs +205 -0
- package/dist/loops-Dn1i16FP.mjs.map +1 -0
- package/dist/manifest-builder-0ZHXBxOL.mjs +189 -0
- package/dist/manifest-builder-0ZHXBxOL.mjs.map +1 -0
- package/dist/manifest-schema-gy37bD_D.mjs +496 -0
- package/dist/manifest-schema-gy37bD_D.mjs.map +1 -0
- package/dist/marketplace-tHWSsCUo.mjs +257 -0
- package/dist/marketplace-tHWSsCUo.mjs.map +1 -0
- package/dist/media/image-endpoint.d.mts +104 -0
- package/dist/media/image-endpoint.d.mts.map +1 -0
- package/dist/media/image-endpoint.mjs +190 -0
- package/dist/media/image-endpoint.mjs.map +1 -0
- package/dist/media/index.d.mts +45 -2
- package/dist/media/index.d.mts.map +1 -1
- package/dist/media/index.mjs +17 -3
- package/dist/media/index.mjs.map +1 -1
- package/dist/media/local-runtime.d.mts +24 -7
- package/dist/media/local-runtime.d.mts.map +1 -1
- package/dist/media/local-runtime.mjs +41 -12
- package/dist/media/local-runtime.mjs.map +1 -1
- package/dist/media-3v7mqAVX.mjs +294 -0
- package/dist/media-3v7mqAVX.mjs.map +1 -0
- package/dist/media-CputjGE1.mjs +373 -0
- package/dist/media-CputjGE1.mjs.map +1 -0
- package/dist/media-D1z_jisb.mjs +408 -0
- package/dist/media-D1z_jisb.mjs.map +1 -0
- package/dist/media-allowlist-D5a4d-RA.mjs +44 -0
- package/dist/media-allowlist-D5a4d-RA.mjs.map +1 -0
- package/dist/media-folders-D2VdVBf6.mjs +210 -0
- package/dist/media-folders-D2VdVBf6.mjs.map +1 -0
- package/dist/media-url-DloW2xrP.mjs +43 -0
- package/dist/media-url-DloW2xrP.mjs.map +1 -0
- package/dist/media-usage-B8q0owWQ.mjs +1629 -0
- package/dist/media-usage-B8q0owWQ.mjs.map +1 -0
- package/dist/media-usage-activation-CQWOOTJi.mjs +78 -0
- package/dist/media-usage-activation-CQWOOTJi.mjs.map +1 -0
- package/dist/media-usage-work-BC0qpkMD.mjs +152 -0
- package/dist/media-usage-work-BC0qpkMD.mjs.map +1 -0
- package/dist/media-usage-work-BlMjwPg8.mjs +586 -0
- package/dist/media-usage-work-BlMjwPg8.mjs.map +1 -0
- package/dist/menus-BQKqf0Up.mjs +92 -0
- package/dist/menus-BQKqf0Up.mjs.map +1 -0
- package/dist/menus-XQdKk-87.mjs +3647 -0
- package/dist/menus-XQdKk-87.mjs.map +1 -0
- package/dist/menus-trvc6_fW.mjs +753 -0
- package/dist/menus-trvc6_fW.mjs.map +1 -0
- package/dist/migrations/index.d.mts +22 -0
- package/dist/migrations/index.d.mts.map +1 -0
- package/dist/migrations/index.mjs +8 -0
- package/dist/mime-IZf-LHIS.mjs +36 -0
- package/dist/mime-IZf-LHIS.mjs.map +1 -0
- package/dist/mode-nh0ppSX5.mjs +23 -0
- package/dist/mode-nh0ppSX5.mjs.map +1 -0
- package/dist/node-sqlite-compat-CDOEcc97.mjs +63 -0
- package/dist/node-sqlite-compat-CDOEcc97.mjs.map +1 -0
- package/dist/normalize-BuWa0lvd.mjs +191 -0
- package/dist/normalize-BuWa0lvd.mjs.map +1 -0
- package/dist/oauth-authorization-BtYQ80uU.mjs +274 -0
- package/dist/oauth-authorization-BtYQ80uU.mjs.map +1 -0
- package/dist/oauth-clients-C1S4NQHh.mjs +266 -0
- package/dist/oauth-clients-C1S4NQHh.mjs.map +1 -0
- package/dist/oauth-state-store-CpGi2FZH.mjs +50 -0
- package/dist/oauth-state-store-CpGi2FZH.mjs.map +1 -0
- package/dist/oauth-user-lookup-BNp1aFAr.mjs +26 -0
- package/dist/oauth-user-lookup-BNp1aFAr.mjs.map +1 -0
- package/dist/object-cache/memory.d.mts +15 -0
- package/dist/object-cache/memory.d.mts.map +1 -0
- package/dist/object-cache/memory.mjs +56 -0
- package/dist/object-cache/memory.mjs.map +1 -0
- package/dist/object-cache-Bo6DGaC9.mjs +586 -0
- package/dist/object-cache-Bo6DGaC9.mjs.map +1 -0
- package/dist/options-DhrI7eMv.mjs +208 -0
- package/dist/options-DhrI7eMv.mjs.map +1 -0
- package/dist/options-Dl_W57-_.d.mts +81 -0
- package/dist/options-Dl_W57-_.d.mts.map +1 -0
- package/dist/ownership-DoeAIuTg.mjs +12 -0
- package/dist/ownership-DoeAIuTg.mjs.map +1 -0
- package/dist/page/index.d.mts +19 -5
- package/dist/page/index.d.mts.map +1 -1
- package/dist/page/index.mjs +32 -7
- package/dist/page/index.mjs.map +1 -1
- package/dist/parse-Gt2l4Sld.mjs +81 -0
- package/dist/parse-Gt2l4Sld.mjs.map +1 -0
- package/dist/parse-QVS0t5oR.d.mts +172 -0
- package/dist/parse-QVS0t5oR.d.mts.map +1 -0
- package/dist/passkey-config-C-MxsV22.mjs +46 -0
- package/dist/passkey-config-C-MxsV22.mjs.map +1 -0
- package/dist/paths-CqFwkjY8.mjs +77 -0
- package/dist/paths-CqFwkjY8.mjs.map +1 -0
- package/dist/patterns-DyZJ67I7.mjs +140 -0
- package/dist/patterns-DyZJ67I7.mjs.map +1 -0
- package/dist/placeholder-Dn7MMdWr.d.mts +306 -0
- package/dist/placeholder-Dn7MMdWr.d.mts.map +1 -0
- package/dist/plan-D8s1n84S.mjs +135 -0
- package/dist/plan-D8s1n84S.mjs.map +1 -0
- package/dist/plugin-test-runtime.d.mts +120 -0
- package/dist/plugin-test-runtime.d.mts.map +1 -0
- package/dist/plugin-test-runtime.mjs +126 -0
- package/dist/plugin-types.d.mts +196 -0
- package/dist/plugin-types.d.mts.map +1 -0
- package/dist/plugin-types.mjs +18 -0
- package/dist/plugin-types.mjs.map +1 -0
- package/dist/plugin-utils.d.mts +36 -16
- package/dist/plugin-utils.d.mts.map +1 -1
- package/dist/plugin-utils.mjs +19 -16
- package/dist/plugin-utils.mjs.map +1 -1
- package/dist/plugins/adapt-sandbox-entry.d.mts +23 -12
- package/dist/plugins/adapt-sandbox-entry.d.mts.map +1 -1
- package/dist/plugins/adapt-sandbox-entry.mjs +124 -28
- package/dist/plugins/adapt-sandbox-entry.mjs.map +1 -1
- package/dist/plugins/host.d.mts +7 -0
- package/dist/plugins/host.mjs +59 -0
- package/dist/plugins/http-wire.d.mts +25 -0
- package/dist/plugins/http-wire.d.mts.map +1 -0
- package/dist/plugins/http-wire.mjs +148 -0
- package/dist/plugins/http-wire.mjs.map +1 -0
- package/dist/plugins/secret-redactor.d.mts +9 -0
- package/dist/plugins/secret-redactor.d.mts.map +1 -0
- package/dist/plugins/secret-redactor.mjs +51 -0
- package/dist/plugins/secret-redactor.mjs.map +1 -0
- package/dist/plugins-BpLkXA1S.mjs +277 -0
- package/dist/plugins-BpLkXA1S.mjs.map +1 -0
- package/dist/policy-C1qpNxrr.mjs +45 -0
- package/dist/policy-C1qpNxrr.mjs.map +1 -0
- package/dist/portable-text-BnRuiR1-.mjs +307 -0
- package/dist/portable-text-BnRuiR1-.mjs.map +1 -0
- package/dist/preview-DU5rwz_m.mjs +107 -0
- package/dist/preview-DU5rwz_m.mjs.map +1 -0
- package/dist/protocol-cEfbPvM6.d.mts +61 -0
- package/dist/protocol-cEfbPvM6.d.mts.map +1 -0
- package/dist/public-submission-x1eaT6Tx.mjs +250 -0
- package/dist/public-submission-x1eaT6Tx.mjs.map +1 -0
- package/dist/public-url-B5a0QAh6.mjs +101 -0
- package/dist/public-url-B5a0QAh6.mjs.map +1 -0
- package/dist/query-DSEkrw_m.mjs +41 -0
- package/dist/query-DSEkrw_m.mjs.map +1 -0
- package/dist/query-dHwqNf85.mjs +1161 -0
- package/dist/query-dHwqNf85.mjs.map +1 -0
- package/dist/rate-limit-BXx3Ecp9.mjs +120 -0
- package/dist/rate-limit-BXx3Ecp9.mjs.map +1 -0
- package/dist/receipt-RG5_pwsj.mjs +43 -0
- package/dist/receipt-RG5_pwsj.mjs.map +1 -0
- package/dist/redirect-BRoLiWQE.mjs +19 -0
- package/dist/redirect-BRoLiWQE.mjs.map +1 -0
- package/dist/redirect-BvFKh8Sz.mjs +416 -0
- package/dist/redirect-BvFKh8Sz.mjs.map +1 -0
- package/dist/redirects-CWQMKYOS.mjs +446 -0
- package/dist/redirects-CWQMKYOS.mjs.map +1 -0
- package/dist/redirects-D4EWeXAo.mjs +148 -0
- package/dist/redirects-D4EWeXAo.mjs.map +1 -0
- package/dist/registry/testing.d.mts +26 -0
- package/dist/registry/testing.d.mts.map +1 -0
- package/dist/registry/testing.mjs +265 -0
- package/dist/registry/testing.mjs.map +1 -0
- package/dist/registry-CtHRqVe-.mjs +6771 -0
- package/dist/registry-CtHRqVe-.mjs.map +1 -0
- package/dist/relations-CVI2nbrn.mjs +776 -0
- package/dist/relations-CVI2nbrn.mjs.map +1 -0
- package/dist/request-cache-C4CIo5ad.mjs +104 -0
- package/dist/request-cache-C4CIo5ad.mjs.map +1 -0
- package/dist/request-context.d.mts +45 -1
- package/dist/request-context.d.mts.map +1 -1
- package/dist/request-context.mjs +17 -3
- package/dist/request-context.mjs.map +1 -1
- package/dist/request-meta-B6blULFY.mjs +141 -0
- package/dist/request-meta-B6blULFY.mjs.map +1 -0
- package/dist/resolve-Cw4rWFJl.mjs +100 -0
- package/dist/resolve-Cw4rWFJl.mjs.map +1 -0
- package/dist/resolve-D-kqyKns.mjs +199 -0
- package/dist/resolve-D-kqyKns.mjs.map +1 -0
- package/dist/revision-CGkQA0e5.mjs +366 -0
- package/dist/revision-CGkQA0e5.mjs.map +1 -0
- package/dist/route-wire-DK600v4u.mjs +197 -0
- package/dist/route-wire-DK600v4u.mjs.map +1 -0
- package/dist/routes-D0u5zK2P.mjs +272 -0
- package/dist/routes-D0u5zK2P.mjs.map +1 -0
- package/dist/runner-CC8LZx97.d.mts +68 -0
- package/dist/runner-CC8LZx97.d.mts.map +1 -0
- package/dist/runner-CLpxmhl8.mjs +6197 -0
- package/dist/runner-CLpxmhl8.mjs.map +1 -0
- package/dist/runtime.d.mts +13 -6
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +6 -4
- package/dist/runtime.mjs.map +1 -1
- package/dist/schema/project-env-types.d.mts +12 -0
- package/dist/schema/project-env-types.d.mts.map +1 -0
- package/dist/schema/project-env-types.mjs +86 -0
- package/dist/schema/project-env-types.mjs.map +1 -0
- package/dist/schema-BZPj3kwZ.mjs +13 -0
- package/dist/schema-BZPj3kwZ.mjs.map +1 -0
- package/dist/schema-Berj5VQx.mjs +815 -0
- package/dist/schema-Berj5VQx.mjs.map +1 -0
- package/dist/scopes-CxvclshI.mjs +34 -0
- package/dist/scopes-CxvclshI.mjs.map +1 -0
- package/dist/search-CD5MiMdh.mjs +448 -0
- package/dist/search-CD5MiMdh.mjs.map +1 -0
- package/dist/secrets-CIi0nFiR.mjs +341 -0
- package/dist/secrets-CIi0nFiR.mjs.map +1 -0
- package/dist/sections-Do5KdTSQ.mjs +346 -0
- package/dist/sections-Do5KdTSQ.mjs.map +1 -0
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +47 -14
- package/dist/seo/index.d.mts +15 -2
- package/dist/seo/index.d.mts.map +1 -1
- package/dist/seo/index.mjs +39 -18
- package/dist/seo/index.mjs.map +1 -1
- package/dist/seo-C61bnPuV.mjs +114 -0
- package/dist/seo-C61bnPuV.mjs.map +1 -0
- package/dist/seo-DpYxmGaL.mjs +133 -0
- package/dist/seo-DpYxmGaL.mjs.map +1 -0
- package/dist/service-BFUImckH.mjs +150 -0
- package/dist/service-BFUImckH.mjs.map +1 -0
- package/dist/session-user-DVcHsFD5.mjs +61 -0
- package/dist/session-user-DVcHsFD5.mjs.map +1 -0
- package/dist/settings-B0zQj_Tj.mjs +61 -0
- package/dist/settings-B0zQj_Tj.mjs.map +1 -0
- package/dist/settings-Ckzmx-A1.mjs +51 -0
- package/dist/settings-Ckzmx-A1.mjs.map +1 -0
- package/dist/settings-CnWoEDb0.mjs +439 -0
- package/dist/settings-CnWoEDb0.mjs.map +1 -0
- package/dist/setup-complete-B2_dhZZz.mjs +65 -0
- package/dist/setup-complete-B2_dhZZz.mjs.map +1 -0
- package/dist/setup-nonce-CJV9ftSK.mjs +25 -0
- package/dist/setup-nonce-CJV9ftSK.mjs.map +1 -0
- package/dist/single-flight-cache-B5O2qhO1.mjs +104 -0
- package/dist/single-flight-cache-B5O2qhO1.mjs.map +1 -0
- package/dist/site-settings-AYFvhwQn.mjs +50 -0
- package/dist/site-settings-AYFvhwQn.mjs.map +1 -0
- package/dist/site-url-Ceq_AUK0.mjs +16 -0
- package/dist/site-url-Ceq_AUK0.mjs.map +1 -0
- package/dist/slugify-T5GHH42D.mjs +17 -0
- package/dist/slugify-T5GHH42D.mjs.map +1 -0
- package/dist/snapshot-Dzsn3NZa.mjs +414 -0
- package/dist/snapshot-Dzsn3NZa.mjs.map +1 -0
- package/dist/ssrf-DsmvZB80.mjs +406 -0
- package/dist/ssrf-DsmvZB80.mjs.map +1 -0
- package/dist/ssrf-tA45vIPX.mjs +1 -0
- package/dist/stage-BcuakqfP.mjs +662 -0
- package/dist/stage-BcuakqfP.mjs.map +1 -0
- package/dist/staged-Bw5eHbKS.mjs +686 -0
- package/dist/staged-Bw5eHbKS.mjs.map +1 -0
- package/dist/state-kGdOMQRY.mjs +153 -0
- package/dist/state-kGdOMQRY.mjs.map +1 -0
- package/dist/status-D39Fpy8R.mjs +30 -0
- package/dist/status-D39Fpy8R.mjs.map +1 -0
- package/dist/storage/local.d.mts +2 -1
- package/dist/storage/local.d.mts.map +1 -1
- package/dist/storage/local.mjs +2 -2
- package/dist/storage/local.mjs.map +1 -1
- package/dist/storage/s3.d.mts +2 -1
- package/dist/storage/s3.d.mts.map +1 -1
- package/dist/storage/s3.mjs +4 -3
- package/dist/storage/s3.mjs.map +1 -1
- package/dist/storage-query-CKNIJhjo.d.mts +1614 -0
- package/dist/storage-query-CKNIJhjo.d.mts.map +1 -0
- package/dist/tar-n2OXqKpZ.mjs +449 -0
- package/dist/tar-n2OXqKpZ.mjs.map +1 -0
- package/dist/target-DOFs5oUC.mjs +27 -0
- package/dist/target-DOFs5oUC.mjs.map +1 -0
- package/dist/taxonomies-CMCnItWf.mjs +939 -0
- package/dist/taxonomies-CMCnItWf.mjs.map +1 -0
- package/dist/taxonomies-CvBe3xhM.mjs +697 -0
- package/dist/taxonomies-CvBe3xhM.mjs.map +1 -0
- package/dist/taxonomy-BesdHIwi.mjs +525 -0
- package/dist/taxonomy-BesdHIwi.mjs.map +1 -0
- package/dist/tokens-BIGxi8sP.mjs +171 -0
- package/dist/tokens-BIGxi8sP.mjs.map +1 -0
- package/dist/transaction-BVYIo_yu.mjs +29 -0
- package/dist/transaction-BVYIo_yu.mjs.map +1 -0
- package/dist/transfer-5Ce0QuNS.mjs +8856 -0
- package/dist/transfer-5Ce0QuNS.mjs.map +1 -0
- package/dist/transfer-CzdXsFRx.mjs +166 -0
- package/dist/transfer-CzdXsFRx.mjs.map +1 -0
- package/dist/transfer-download-Dc-ltjZY.mjs +33 -0
- package/dist/transfer-download-Dc-ltjZY.mjs.map +1 -0
- package/dist/transformations-BLzqMnpY.mjs +196 -0
- package/dist/transformations-BLzqMnpY.mjs.map +1 -0
- package/dist/transport-k1fykDBh.d.mts +42 -0
- package/dist/transport-k1fykDBh.d.mts.map +1 -0
- package/dist/transport-umzEbgYO.mjs +136 -0
- package/dist/transport-umzEbgYO.mjs.map +1 -0
- package/dist/trusted-proxy-BqfQFs6a.mjs +51 -0
- package/dist/trusted-proxy-BqfQFs6a.mjs.map +1 -0
- package/dist/turnstile-CvvKLtqE.mjs +53 -0
- package/dist/turnstile-CvvKLtqE.mjs.map +1 -0
- package/dist/types-B8tO_KdV.d.mts +896 -0
- package/dist/types-B8tO_KdV.d.mts.map +1 -0
- package/dist/types-BGmQ0uXs.mjs +201 -0
- package/dist/types-BGmQ0uXs.mjs.map +1 -0
- package/dist/types-BYaPWs_F.d.mts +198 -0
- package/dist/types-BYaPWs_F.d.mts.map +1 -0
- package/dist/types-CLTQ9b_r.d.mts +374 -0
- package/dist/types-CLTQ9b_r.d.mts.map +1 -0
- package/dist/types-CPkQw2T2.d.mts +85 -0
- package/dist/types-CPkQw2T2.d.mts.map +1 -0
- package/dist/types-CQLvuXoZ.d.mts +198 -0
- package/dist/types-CQLvuXoZ.d.mts.map +1 -0
- package/dist/types-CV5xszpF.d.mts +363 -0
- package/dist/types-CV5xszpF.d.mts.map +1 -0
- package/dist/types-CVsmpTcU.mjs +18 -0
- package/dist/types-CVsmpTcU.mjs.map +1 -0
- package/dist/types-CdEMurNh.mjs +77 -0
- package/dist/types-CdEMurNh.mjs.map +1 -0
- package/dist/types-CxwtnuSS.mjs +37 -0
- package/dist/types-CxwtnuSS.mjs.map +1 -0
- package/dist/types-DGw8KMX_.mjs +16 -0
- package/dist/types-DGw8KMX_.mjs.map +1 -0
- package/dist/types-DOfVMPoo.d.mts +125 -0
- package/dist/types-DOfVMPoo.d.mts.map +1 -0
- package/dist/types-Dsco9Y38.d.mts +1720 -0
- package/dist/types-Dsco9Y38.d.mts.map +1 -0
- package/dist/types-LtS0SM4F.d.mts +287 -0
- package/dist/types-LtS0SM4F.d.mts.map +1 -0
- package/dist/types-j6MBDjlZ.mjs +103 -0
- package/dist/types-j6MBDjlZ.mjs.map +1 -0
- package/dist/update-check-B2JKz5cr.mjs +161 -0
- package/dist/update-check-B2JKz5cr.mjs.map +1 -0
- package/dist/upload-attempts-BodUoFBu.mjs +32 -0
- package/dist/upload-attempts-BodUoFBu.mjs.map +1 -0
- package/dist/url-Dn3IStq8.mjs +104 -0
- package/dist/url-Dn3IStq8.mjs.map +1 -0
- package/dist/url-pattern-DGAG6ZP2.mjs +41 -0
- package/dist/url-pattern-DGAG6ZP2.mjs.map +1 -0
- package/dist/user-BOvuF1sQ.mjs +171 -0
- package/dist/user-BOvuF1sQ.mjs.map +1 -0
- package/dist/utils-CoV-PYhg.mjs +439 -0
- package/dist/utils-CoV-PYhg.mjs.map +1 -0
- package/dist/validate-DANX1-Qi.mjs +120 -0
- package/dist/validate-DANX1-Qi.mjs.map +1 -0
- package/dist/validate-DpP1QUiV.d.mts +468 -0
- package/dist/validate-DpP1QUiV.d.mts.map +1 -0
- package/dist/validate-WkjGwBSO.mjs +516 -0
- package/dist/validate-WkjGwBSO.mjs.map +1 -0
- package/dist/validation-DG7Y9H4u.mjs +219 -0
- package/dist/validation-DG7Y9H4u.mjs.map +1 -0
- package/dist/version-BnlfLUa6.mjs +7 -0
- package/dist/version-BnlfLUa6.mjs.map +1 -0
- package/dist/version-BwEGkqkx.mjs +9 -0
- package/dist/version-BwEGkqkx.mjs.map +1 -0
- package/dist/virtual-modules-B6vJW15k.mjs +516 -0
- package/dist/virtual-modules-B6vJW15k.mjs.map +1 -0
- package/dist/widgets-D7I_9xff.mjs +126 -0
- package/dist/widgets-D7I_9xff.mjs.map +1 -0
- package/dist/wxr-taxonomies-Di1w9HDU.d.mts +34 -0
- package/dist/wxr-taxonomies-Di1w9HDU.d.mts.map +1 -0
- package/dist/wxr-taxonomies-m_141EtN.mjs +453 -0
- package/dist/wxr-taxonomies-m_141EtN.mjs.map +1 -0
- package/dist/zod-generator-DnfG5sGQ.mjs +424 -0
- package/dist/zod-generator-DnfG5sGQ.mjs.map +1 -0
- package/locals.d.ts +1 -6
- package/package.json +142 -31
- package/src/after.ts +6 -1
- package/src/api/authorize.ts +27 -1
- package/src/api/email-locale.ts +24 -0
- package/src/api/error.ts +22 -7
- package/src/api/errors.ts +131 -0
- package/src/api/handlers/api-tokens.ts +37 -3
- package/src/api/handlers/backup.ts +318 -0
- package/src/api/handlers/block-types.ts +129 -0
- package/src/api/handlers/bulk-tag.ts +309 -0
- package/src/api/handlers/byline-fields.ts +212 -0
- package/src/api/handlers/bylines.ts +283 -0
- package/src/api/handlers/comment-reactions.ts +165 -0
- package/src/api/handlers/comments.ts +6 -32
- package/src/api/handlers/content.ts +1552 -156
- package/src/api/handlers/dashboard.ts +73 -38
- package/src/api/handlers/device-flow.ts +80 -23
- package/src/api/handlers/entry-lock.ts +206 -0
- package/src/api/handlers/index.ts +90 -0
- package/src/api/handlers/manifest.ts +245 -12
- package/src/api/handlers/marketplace.ts +251 -53
- package/src/api/handlers/media-allowlist.ts +52 -0
- package/src/api/handlers/media-folders.ts +130 -0
- package/src/api/handlers/media-upload.ts +186 -0
- package/src/api/handlers/media-usage-activation.ts +102 -0
- package/src/api/handlers/media-usage-work.ts +188 -0
- package/src/api/handlers/media-usage.ts +418 -0
- package/src/api/handlers/media.ts +207 -16
- package/src/api/handlers/menus.ts +294 -392
- package/src/api/handlers/oauth-authorization.ts +74 -39
- package/src/api/handlers/oauth-clients.ts +1 -1
- package/src/api/handlers/plugin-settings.ts +250 -0
- package/src/api/handlers/plugins.ts +195 -41
- package/src/api/handlers/redirects.ts +225 -131
- package/src/api/handlers/registry.ts +1844 -0
- package/src/api/handlers/relations.ts +960 -0
- package/src/api/handlers/revision.ts +70 -20
- package/src/api/handlers/schema.ts +486 -8
- package/src/api/handlers/seo.ts +68 -5
- package/src/api/handlers/settings.ts +2 -2
- package/src/api/handlers/snapshot.ts +359 -68
- package/src/api/handlers/staged-references.ts +208 -0
- package/src/api/handlers/taxonomies.ts +887 -156
- package/src/api/handlers/transfer.ts +1347 -0
- package/src/api/handlers/update-check.ts +236 -0
- package/src/api/handlers/validate-media-fields.ts +237 -0
- package/src/api/handlers/validate-references.ts +146 -0
- package/src/api/handlers/validation.ts +120 -19
- package/src/api/media-usage-write-fence.ts +43 -0
- package/src/api/openapi/document.ts +1644 -262
- package/src/api/parse.ts +3 -17
- package/src/api/public-url.ts +66 -6
- package/src/api/redirect.ts +9 -1
- package/src/api/schemas/auth.ts +10 -4
- package/src/api/schemas/byline-fields.ts +188 -0
- package/src/api/schemas/bylines.ts +97 -1
- package/src/api/schemas/comments.ts +19 -3
- package/src/api/schemas/common.ts +29 -9
- package/src/api/schemas/content.ts +302 -8
- package/src/api/schemas/entry-lock.ts +57 -0
- package/src/api/schemas/import.ts +69 -14
- package/src/api/schemas/index.ts +4 -0
- package/src/api/schemas/media-usage.ts +341 -0
- package/src/api/schemas/media.ts +186 -5
- package/src/api/schemas/menus.ts +50 -22
- package/src/api/schemas/redirects.ts +17 -5
- package/src/api/schemas/relations.ts +121 -0
- package/src/api/schemas/schema.ts +267 -7
- package/src/api/schemas/search.ts +7 -0
- package/src/api/schemas/sections.ts +3 -3
- package/src/api/schemas/settings.ts +41 -9
- package/src/api/schemas/setup.ts +1 -1
- package/src/api/schemas/taxonomies.ts +134 -10
- package/src/api/schemas/transfer.ts +249 -0
- package/src/api/schemas/users.ts +2 -2
- package/src/api/setup-complete.ts +49 -1
- package/src/api/site-url.ts +16 -6
- package/src/api/transfer-download.ts +36 -0
- package/src/api/types.ts +45 -10
- package/src/astro/dev-typegen.ts +28 -0
- package/src/astro/image-endpoint.ts +84 -0
- package/src/astro/index.ts +6 -0
- package/src/astro/integration/dev-typegen.ts +120 -0
- package/src/astro/integration/index.ts +501 -122
- package/src/astro/integration/route-naming.ts +19 -0
- package/src/astro/integration/routes.ts +367 -16
- package/src/astro/integration/runtime.ts +250 -24
- package/src/astro/integration/shims/use-sync-external-store-with-selector.js +71 -0
- package/src/astro/integration/shims/use-sync-external-store.js +1 -0
- package/src/astro/integration/virtual-modules.ts +213 -7
- package/src/astro/integration/vite-config.ts +261 -31
- package/src/astro/middleware/auth.ts +157 -102
- package/src/astro/middleware/csp.ts +79 -3
- package/src/astro/middleware/media-usage-write-fence.ts +125 -0
- package/src/astro/middleware/redirect.ts +68 -24
- package/src/astro/middleware/request-context.ts +223 -27
- package/src/astro/middleware/scoped-db.ts +183 -0
- package/src/astro/middleware/stream-end-metrics.ts +102 -0
- package/src/astro/middleware.ts +699 -115
- package/src/astro/object-cache/adapters.ts +50 -0
- package/src/astro/prefetch.ts +82 -0
- package/src/astro/public-plugin-api-routes.ts +42 -0
- package/src/astro/routes/PluginRegistry.tsx +5 -2
- package/src/astro/routes/admin.astro +74 -19
- package/src/astro/routes/api/admin/api-tokens/index.ts +6 -3
- package/src/astro/routes/api/admin/byline-fields/[slug]/usage.ts +36 -0
- package/src/astro/routes/api/admin/byline-fields/[slug].ts +92 -0
- package/src/astro/routes/api/admin/byline-fields/index.ts +66 -0
- package/src/astro/routes/api/admin/byline-fields/reorder.ts +39 -0
- package/src/astro/routes/api/admin/bylines/[id]/index.ts +34 -31
- package/src/astro/routes/api/admin/bylines/[id]/translations.ts +102 -0
- package/src/astro/routes/api/admin/bylines/index.ts +25 -11
- package/src/astro/routes/api/admin/comments/[id]/status.ts +23 -60
- package/src/astro/routes/api/admin/comments/index.ts +1 -2
- package/src/astro/routes/api/admin/core-update.ts +34 -0
- package/src/astro/routes/api/admin/hooks/exclusive/index.ts +1 -5
- package/src/astro/routes/api/admin/media-usage/activation.ts +42 -0
- 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/progress.ts +37 -0
- package/src/astro/routes/api/admin/media-usage/repair.ts +24 -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/oauth-clients/[id].ts +1 -1
- package/src/astro/routes/api/admin/oauth-clients/index.ts +1 -1
- package/src/astro/routes/api/admin/plugins/[id]/disable.ts +7 -10
- package/src/astro/routes/api/admin/plugins/[id]/enable.ts +7 -10
- package/src/astro/routes/api/admin/plugins/[id]/index.ts +7 -0
- package/src/astro/routes/api/admin/plugins/[id]/mcp.ts +42 -0
- package/src/astro/routes/api/admin/plugins/[id]/settings.ts +80 -0
- package/src/astro/routes/api/admin/plugins/[id]/uninstall.ts +6 -0
- package/src/astro/routes/api/admin/plugins/[id]/update.ts +31 -4
- package/src/astro/routes/api/admin/plugins/index.ts +10 -0
- package/src/astro/routes/api/admin/plugins/marketplace/[id]/icon.ts +6 -2
- package/src/astro/routes/api/admin/plugins/marketplace/[id]/install.ts +25 -3
- package/src/astro/routes/api/admin/plugins/registry/[id]/uninstall.ts +57 -0
- package/src/astro/routes/api/admin/plugins/registry/[id]/update.ts +112 -0
- package/src/astro/routes/api/admin/plugins/registry/artifact.ts +538 -0
- package/src/astro/routes/api/admin/plugins/registry/install.ts +134 -0
- package/src/astro/routes/api/admin/plugins/registry/publisher-handle.ts +59 -0
- package/src/astro/routes/api/admin/plugins/registry/verify.ts +61 -0
- package/src/astro/routes/api/admin/plugins/updates.ts +45 -6
- package/src/astro/routes/api/admin/scheduled-policy-rejections/[collection]/[id].ts +34 -0
- package/src/astro/routes/api/admin/themes/marketplace/[id]/thumbnail.ts +6 -2
- package/src/astro/routes/api/admin/themes/marketplace/index.ts +1 -1
- package/src/astro/routes/api/admin/transfer/[...path].ts +143 -0
- package/src/astro/routes/api/admin/transfer/approvals/[id]/approve.ts +35 -0
- package/src/astro/routes/api/admin/transfer/approvals/[id]/deny.ts +35 -0
- package/src/astro/routes/api/admin/transfer/approvals/index.ts +33 -0
- package/src/astro/routes/api/admin/transfer/capabilities.ts +36 -0
- package/src/astro/routes/api/admin/transfer/exports/[id]/advance.ts +34 -0
- package/src/astro/routes/api/admin/transfer/exports/[id]/archive.ts +35 -0
- package/src/astro/routes/api/admin/transfer/exports/[id]/files/[...path].ts +40 -0
- package/src/astro/routes/api/admin/transfer/exports/[id]/index.ts +25 -0
- package/src/astro/routes/api/admin/transfer/exports/[id]/manifest.ts +38 -0
- package/src/astro/routes/api/admin/transfer/exports/index.ts +64 -0
- package/src/astro/routes/api/admin/transfer/imports/[id]/abandon.ts +28 -0
- package/src/astro/routes/api/admin/transfer/imports/[id]/advance.ts +37 -0
- package/src/astro/routes/api/admin/transfer/imports/[id]/analyze.ts +51 -0
- package/src/astro/routes/api/admin/transfer/imports/[id]/cancel.ts +27 -0
- package/src/astro/routes/api/admin/transfer/imports/[id]/execute.ts +48 -0
- package/src/astro/routes/api/admin/transfer/imports/[id]/files/[...path].ts +54 -0
- package/src/astro/routes/api/admin/transfer/imports/[id]/index.ts +25 -0
- package/src/astro/routes/api/admin/transfer/imports/[id]/missing.ts +34 -0
- package/src/astro/routes/api/admin/transfer/imports/[id]/plan.ts +29 -0
- package/src/astro/routes/api/admin/transfer/imports/[id]/receipt.ts +25 -0
- package/src/astro/routes/api/admin/transfer/imports/index.ts +85 -0
- package/src/astro/routes/api/admin/users/[id]/send-recovery.ts +11 -3
- package/src/astro/routes/api/auth/dev-bypass.ts +0 -4
- package/src/astro/routes/api/auth/invite/complete.ts +10 -5
- package/src/astro/routes/api/auth/invite/index.ts +17 -3
- package/src/astro/routes/api/auth/invite/register-options.ts +8 -1
- package/src/astro/routes/api/auth/magic-link/send.ts +11 -3
- package/src/astro/routes/api/auth/magic-link/verify.ts +40 -39
- package/src/astro/routes/api/auth/me.ts +34 -11
- package/src/astro/routes/api/auth/mode.ts +6 -14
- package/src/astro/routes/api/auth/oauth/[provider]/callback.ts +30 -9
- package/src/astro/routes/api/auth/oauth/[provider].ts +24 -7
- package/src/astro/routes/api/auth/passkey/options.ts +2 -21
- package/src/astro/routes/api/auth/passkey/register/verify.ts +6 -1
- package/src/astro/routes/api/auth/passkey/verify.ts +10 -5
- package/src/astro/routes/api/auth/signup/complete.ts +10 -5
- package/src/astro/routes/api/auth/signup/request.ts +2 -2
- package/src/astro/routes/api/comments/[collection]/[contentId]/index.ts +4 -246
- package/src/astro/routes/api/comments/[collection]/[contentId]/reactions.ts +97 -0
- package/src/astro/routes/api/content/[collection]/[id]/compare.ts +3 -4
- package/src/astro/routes/api/content/[collection]/[id]/discard-draft.ts +26 -6
- package/src/astro/routes/api/content/[collection]/[id]/duplicate.ts +5 -6
- package/src/astro/routes/api/content/[collection]/[id]/lock.ts +133 -0
- package/src/astro/routes/api/content/[collection]/[id]/permanent.ts +3 -4
- package/src/astro/routes/api/content/[collection]/[id]/plugin-extensions/[pluginId]/[kind]/[extensionId].ts +29 -0
- package/src/astro/routes/api/content/[collection]/[id]/preview-url.ts +87 -15
- package/src/astro/routes/api/content/[collection]/[id]/publish.ts +58 -8
- package/src/astro/routes/api/content/[collection]/[id]/references/[relation]/children.ts +52 -0
- package/src/astro/routes/api/content/[collection]/[id]/references/[relation]/parents.ts +47 -0
- package/src/astro/routes/api/content/[collection]/[id]/restore.ts +6 -4
- package/src/astro/routes/api/content/[collection]/[id]/revisions.ts +6 -6
- package/src/astro/routes/api/content/[collection]/[id]/schedule.ts +42 -9
- package/src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts +103 -38
- package/src/astro/routes/api/content/[collection]/[id]/translations.ts +4 -5
- package/src/astro/routes/api/content/[collection]/[id]/unpublish.ts +26 -6
- package/src/astro/routes/api/content/[collection]/[id].ts +62 -18
- package/src/astro/routes/api/content/[collection]/authors.ts +33 -0
- package/src/astro/routes/api/content/[collection]/index.ts +10 -9
- package/src/astro/routes/api/content/[collection]/trash.ts +2 -3
- package/src/astro/routes/api/health.ts +18 -0
- package/src/astro/routes/api/import/wordpress/execute.ts +428 -8
- package/src/astro/routes/api/import/wordpress/media.ts +9 -3
- package/src/astro/routes/api/import/wordpress/prepare.ts +10 -12
- package/src/astro/routes/api/import/wordpress/rewrite-url-helpers.ts +225 -0
- package/src/astro/routes/api/import/wordpress/rewrite-urls.ts +132 -273
- package/src/astro/routes/api/import/wordpress-plugin/execute.ts +798 -46
- package/src/astro/routes/api/manifest.ts +85 -46
- package/src/astro/routes/api/mcp.ts +6 -2
- package/src/astro/routes/api/media/[id]/confirm.ts +169 -11
- package/src/astro/routes/api/media/[id]/replace.ts +114 -0
- package/src/astro/routes/api/media/[id]/upload.ts +262 -0
- package/src/astro/routes/api/media/[id]/usage.ts +30 -0
- package/src/astro/routes/api/media/[id].ts +32 -18
- package/src/astro/routes/api/media/asset/[id]/[filename].ts +50 -0
- package/src/astro/routes/api/media/file/[...key].ts +37 -1
- package/src/astro/routes/api/media/folders/[id].ts +55 -0
- package/src/astro/routes/api/media/folders/index.ts +37 -0
- package/src/astro/routes/api/media/providers/[providerId]/index.ts +12 -3
- package/src/astro/routes/api/media/upload-url.ts +44 -37
- package/src/astro/routes/api/media.ts +115 -33
- package/src/astro/routes/api/menus/[name]/items/[id].ts +74 -0
- package/src/astro/routes/api/menus/[name]/items.ts +12 -60
- package/src/astro/routes/api/menus/[name]/reorder.ts +12 -4
- package/src/astro/routes/api/menus/[name]/translations.ts +85 -0
- package/src/astro/routes/api/menus/[name].ts +25 -11
- package/src/astro/routes/api/menus/index.ts +13 -7
- package/src/astro/routes/api/oauth/authorize.ts +47 -15
- package/src/astro/routes/api/oauth/device/authorize.ts +33 -4
- package/src/astro/routes/api/oauth/register.ts +22 -2
- package/src/astro/routes/api/openapi.json.ts +27 -10
- package/src/astro/routes/api/plugins/[pluginId]/[...path].ts +13 -59
- package/src/astro/routes/api/redirects/404s/index.ts +7 -1
- package/src/astro/routes/api/redirects/404s/summary.ts +3 -1
- package/src/astro/routes/api/redirects/[id].ts +7 -4
- package/src/astro/routes/api/redirects/index.ts +5 -3
- package/src/astro/routes/api/relations/[id]/index.ts +84 -0
- package/src/astro/routes/api/relations/index.ts +56 -0
- package/src/astro/routes/api/revisions/[revisionId]/index.ts +1 -1
- package/src/astro/routes/api/revisions/[revisionId]/restore.ts +17 -1
- package/src/astro/routes/api/schema/block-types/[slug]/index.ts +29 -0
- package/src/astro/routes/api/schema/block-types/[slug]/versions/[version]/activate.ts +31 -0
- package/src/astro/routes/api/schema/block-types/index.ts +29 -0
- package/src/astro/routes/api/schema/collections/[slug]/fields/[fieldSlug].ts +9 -13
- package/src/astro/routes/api/schema/collections/[slug]/fields/index.ts +2 -8
- package/src/astro/routes/api/schema/collections/[slug]/fields/reorder.ts +1 -2
- package/src/astro/routes/api/schema/collections/[slug]/index.ts +5 -11
- package/src/astro/routes/api/schema/collections/index.ts +4 -4
- package/src/astro/routes/api/schema/collections/reorder.ts +31 -0
- package/src/astro/routes/api/schema/index.ts +19 -19
- package/src/astro/routes/api/schema/orphans/[slug].ts +1 -1
- package/src/astro/routes/api/schema/orphans/index.ts +1 -1
- package/src/astro/routes/api/search/enable.ts +5 -1
- package/src/astro/routes/api/search/index.ts +13 -2
- package/src/astro/routes/api/search/rebuild.ts +6 -1
- package/src/astro/routes/api/sections/[slug].ts +7 -1
- package/src/astro/routes/api/sections/index.ts +5 -1
- package/src/astro/routes/api/settings/backups/archives/[name].ts +78 -0
- package/src/astro/routes/api/settings/backups/archives/index.ts +33 -0
- package/src/astro/routes/api/settings/backups/export.ts +43 -0
- package/src/astro/routes/api/settings/backups/index.ts +76 -0
- package/src/astro/routes/api/settings/email.ts +1 -1
- package/src/astro/routes/api/settings.ts +4 -1
- package/src/astro/routes/api/setup/admin-verify.ts +20 -10
- package/src/astro/routes/api/setup/admin.ts +11 -4
- package/src/astro/routes/api/setup/dev-bypass.ts +26 -10
- package/src/astro/routes/api/setup/index.ts +71 -36
- package/src/astro/routes/api/snapshot.ts +48 -19
- package/src/astro/routes/api/taxonomies/[name]/reorder.ts +44 -0
- package/src/astro/routes/api/taxonomies/[name]/terms/[slug]/translations.ts +92 -0
- package/src/astro/routes/api/taxonomies/[name]/terms/[slug].ts +28 -23
- package/src/astro/routes/api/taxonomies/[name]/terms/index.ts +19 -15
- package/src/astro/routes/api/taxonomies/[name]/translations.ts +48 -0
- package/src/astro/routes/api/taxonomies/[name].ts +107 -0
- package/src/astro/routes/api/taxonomies/bulk-tag.ts +29 -0
- package/src/astro/routes/api/taxonomies/index.ts +13 -8
- package/src/astro/routes/api/themes/preview.ts +11 -5
- package/src/astro/routes/api/typegen.ts +4 -42
- package/src/astro/routes/api/visual-editing/action-token.ts +36 -0
- package/src/astro/routes/api/visual-editing/content/[collection]/[id]/publish.ts +32 -0
- package/src/astro/routes/api/visual-editing/toolbar-labels.ts +16 -0
- package/src/astro/routes/api/well-known/oauth-authorization-server.ts +4 -1
- package/src/astro/routes/api/well-known/oauth-protected-resource.ts +5 -1
- package/src/astro/routes/api/widget-areas/[name]/reorder.ts +3 -1
- package/src/astro/routes/api/widget-areas/[name]/widgets/[id].ts +5 -2
- package/src/astro/routes/api/widget-areas/[name]/widgets.ts +3 -1
- package/src/astro/routes/api/widget-areas/[name].ts +3 -1
- package/src/astro/routes/api/widget-areas/index.ts +3 -1
- package/src/astro/routes/sitemap-[collection].xml.ts +133 -14
- package/src/astro/session-user.ts +71 -0
- package/src/astro/types.ts +304 -16
- package/src/auth/allowed-origins.ts +168 -0
- package/src/auth/api-tokens.ts +2 -0
- package/src/auth/challenge-store.ts +3 -1
- package/src/auth/oauth-state-store.ts +3 -0
- package/src/auth/passkey-config.ts +35 -13
- package/src/auth/providers/github-admin.tsx +5 -6
- package/src/auth/providers/google-admin.tsx +5 -6
- package/src/auth/rate-limit.ts +6 -5
- package/src/auth/scopes.ts +14 -9
- package/src/auth/trusted-proxy.ts +1 -1
- package/src/aws-sdk.d.ts +1 -0
- package/src/bylines/credits.ts +149 -0
- package/src/bylines/field-defs-cache.ts +188 -0
- package/src/bylines/index.ts +152 -152
- package/src/cache/chrome-tags.ts +24 -0
- package/src/cleanup.ts +72 -26
- package/src/cli/client-factory.ts +6 -2
- package/src/cli/commands/content.ts +48 -7
- package/src/cli/commands/doctor.ts +219 -7
- package/src/cli/commands/export-seed.ts +1021 -142
- package/src/cli/commands/init.ts +4 -8
- package/src/cli/commands/login.ts +8 -1
- package/src/cli/commands/media.ts +127 -0
- package/src/cli/commands/migrate.ts +641 -0
- package/src/cli/commands/secrets.ts +183 -0
- package/src/cli/commands/seed.ts +9 -3
- package/src/cli/commands/site.ts +556 -0
- package/src/cli/credentials.ts +2 -61
- package/src/cli/index.ts +6 -28
- package/src/cli/site/archive.ts +273 -0
- package/src/cli/site/export.ts +311 -0
- package/src/cli/site/import.ts +815 -0
- package/src/cli/site/shared.ts +241 -0
- package/src/cli/wxr/parser.ts +263 -0
- package/src/client/index.ts +849 -31
- package/src/client/portable-text.ts +41 -0
- package/src/client/transport.ts +23 -9
- package/src/comments/public-submission.ts +254 -0
- package/src/comments/query.ts +78 -7
- package/src/comments/ranking.ts +58 -0
- package/src/comments/service.ts +60 -13
- package/src/comments/turnstile.ts +64 -0
- package/src/components/Block.astro +83 -0
- package/src/components/BlockquoteGroup.astro +34 -0
- package/src/components/Blocks.astro +46 -0
- package/src/components/Break.astro +2 -2
- package/src/components/Columns.astro +3 -1
- package/src/components/CommentForm.astro +13 -6
- package/src/components/Comments.astro +137 -2
- package/src/components/Cover.astro +3 -1
- package/src/components/EmDashBodyEnd.astro +4 -1
- package/src/components/EmDashBodyStart.astro +4 -1
- package/src/components/EmDashHead.astro +113 -25
- package/src/components/EmDashImage.astro +210 -53
- package/src/components/EmDashMedia.astro +3 -3
- package/src/components/Embed.astro +1 -1
- package/src/components/Gallery.astro +166 -29
- package/src/components/Image.astro +158 -40
- package/src/components/InlineEditor.astro +3 -1
- package/src/components/InlinePortableTextEditor.tsx +854 -97
- package/src/components/JsonLdScript.astro +9 -0
- package/src/components/LiveSearch.astro +63 -4
- package/src/components/OrderedList.astro +14 -0
- package/src/components/PortableText.astro +34 -2
- package/src/components/Table.astro +147 -62
- package/src/components/WidgetArea.astro +3 -2
- package/src/components/blocks.ts +44 -0
- package/src/components/code-mark.ts +11 -0
- package/src/components/index.ts +25 -8
- package/src/components/inline-code-block.tsx +474 -0
- package/src/components/live-search-routing.ts +30 -0
- package/src/components/marks/Link.astro +5 -1
- package/src/components/ordered-list.ts +549 -0
- package/src/components/portable-text-blockquote-group.ts +68 -0
- package/src/components/portable-text-text-align.ts +38 -0
- package/src/components/widgets/Archives.astro +7 -41
- package/src/components/widgets/Categories.astro +1 -1
- package/src/components/widgets/Tags.astro +1 -1
- package/src/config/errors.ts +13 -0
- package/src/config/secrets.ts +562 -0
- package/src/content/converters/gallery.ts +101 -0
- package/src/content/converters/image-link.ts +27 -0
- package/src/content/converters/index.ts +3 -0
- package/src/content/converters/mark-safety.ts +121 -0
- package/src/content/converters/numbered-list.ts +148 -0
- package/src/content/converters/portable-text-identity.ts +139 -0
- package/src/content/converters/portable-text-to-prosemirror.ts +400 -90
- package/src/content/converters/prosemirror-to-portable-text.ts +234 -46
- package/src/content/converters/types.ts +80 -0
- package/src/content/known-fields.ts +44 -0
- package/src/content/portable-text-lists.ts +205 -0
- package/src/content-list-query.ts +29 -0
- package/src/database/connection.ts +9 -41
- package/src/database/content-datetime.ts +228 -0
- package/src/database/datetime-storage.ts +452 -0
- package/src/database/dialect-helpers.ts +352 -10
- package/src/database/errors.ts +14 -0
- package/src/database/index.ts +11 -3
- package/src/database/instrumentation.ts +56 -9
- package/src/database/json-recordset.ts +16 -0
- package/src/database/migration-lock.ts +140 -0
- package/src/database/migrations/006_taxonomy_defs.ts +1 -1
- package/src/database/migrations/014_draft_revisions.ts +6 -6
- package/src/database/migrations/016_api_tokens.ts +18 -3
- package/src/database/migrations/017_authorization_codes.ts +14 -4
- package/src/database/migrations/019_i18n.ts +3 -3
- package/src/database/migrations/034_published_at_index.ts +1 -1
- package/src/database/migrations/035_bounded_404_log.ts +37 -31
- package/src/database/migrations/036_i18n_menus_and_taxonomies.ts +655 -0
- package/src/database/migrations/037_credential_algorithm.ts +18 -0
- package/src/database/migrations/038_registry_plugin_state.ts +130 -0
- package/src/database/migrations/039_fix_fts5_triggers.ts +264 -0
- package/src/database/migrations/040_byline_i18n.ts +497 -0
- package/src/database/migrations/041_content_locale_list_index.ts +47 -0
- package/src/database/migrations/042_byline_fields.ts +157 -0
- package/src/database/migrations/043_content_references.ts +121 -0
- package/src/database/migrations/044_comment_reactions.ts +56 -0
- package/src/database/migrations/045_taxonomy_parent_group.ts +68 -0
- package/src/database/migrations/046_media_usage_index.ts +115 -0
- package/src/database/migrations/047_restore_taxonomy_parent_index.ts +29 -0
- package/src/database/migrations/048_restore_content_taxonomies_term_index.ts +32 -0
- package/src/database/migrations/049_taxonomies_name_locale_index.ts +42 -0
- package/src/database/migrations/050_media_usage_index_status.ts +142 -0
- package/src/database/migrations/051_content_taxonomies_denorm.ts +120 -0
- package/src/database/migrations/052_media_usage_read_index.ts +26 -0
- package/src/database/migrations/053_plugin_mcp_tools.ts +21 -0
- package/src/database/migrations/054_media_upload_attempts.ts +41 -0
- package/src/database/migrations/055_content_translation_group_locale_index.ts +67 -0
- package/src/database/migrations/056_taxonomy_term_sort_order.ts +189 -0
- package/src/database/migrations/057_collection_hidden.ts +24 -0
- package/src/database/migrations/058_collection_sort_order.ts +20 -0
- package/src/database/migrations/059_revision_prune_queue.ts +36 -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/071_restore_content_bylines_table.ts +43 -0
- package/src/database/migrations/072_media_folders.ts +72 -0
- package/src/database/migrations/073_media_focal_point.ts +57 -0
- package/src/database/migrations/074_content_deleted_scheduled_index.ts +55 -0
- package/src/database/migrations/075_entry_edit_locks.ts +44 -0
- package/src/database/migrations/076_collection_nav_group.ts +22 -0
- package/src/database/migrations/077_plugin_storage_revisions.ts +89 -0
- package/src/database/migrations/078_menu_item_translation_groups.ts +15 -0
- package/src/database/migrations/079_datetime_normalization.ts +13 -0
- package/src/database/migrations/080_content_translation_locale_unique.ts +88 -0
- package/src/database/migrations/081_redirect_write_guards.ts +260 -0
- package/src/database/migrations/082_taxonomy_translation_locale_unique.ts +49 -0
- package/src/database/migrations/083_block_types.ts +58 -0
- package/src/database/migrations/084_site_transfer.ts +264 -0
- package/src/database/migrations/085_taxonomy_def_groups.ts +155 -0
- package/src/database/migrations/086_relations_structural.ts +197 -0
- package/src/database/migrations/087_reference_field_relations.ts +407 -0
- package/src/database/migrations/088_cron_oneshot_utc.ts +39 -0
- package/src/database/migrations/089_auto_seed_completion.ts +13 -0
- package/src/database/migrations/policy.ts +70 -0
- package/src/database/migrations/runner.ts +416 -43
- package/src/database/pg-migration-lock.ts +69 -0
- package/src/database/reference-backfill.ts +141 -0
- package/src/database/repositories/audit.ts +13 -3
- package/src/database/repositories/byline.ts +1120 -87
- package/src/database/repositories/comment-reaction.ts +132 -0
- package/src/database/repositories/comment.ts +99 -3
- package/src/database/repositories/content.ts +2210 -267
- package/src/database/repositories/entry-locks.ts +257 -0
- package/src/database/repositories/index.ts +21 -0
- package/src/database/repositories/media-folders.ts +115 -0
- package/src/database/repositories/media-usage-work.ts +1132 -0
- package/src/database/repositories/media-usage.ts +4040 -0
- package/src/database/repositories/media.ts +465 -55
- package/src/database/repositories/menu.ts +657 -0
- package/src/database/repositories/options.ts +128 -10
- package/src/database/repositories/plugin-storage.ts +265 -44
- package/src/database/repositories/redirect.ts +296 -79
- package/src/database/repositories/relation.ts +1004 -0
- package/src/database/repositories/revision.ts +225 -31
- package/src/database/repositories/seo.ts +3 -0
- package/src/database/repositories/taxonomy-def.ts +126 -0
- package/src/database/repositories/taxonomy.ts +747 -97
- package/src/database/repositories/types.ts +209 -0
- package/src/database/repositories/user.ts +18 -0
- package/src/database/transaction.ts +12 -0
- package/src/database/types.ts +525 -7
- package/src/database/validate.ts +39 -0
- package/src/datetime-normalization.ts +311 -0
- package/src/db/adapters.ts +105 -5
- package/src/db/index.ts +6 -1
- package/src/db/libsql-migrations.ts +72 -0
- package/src/db/libsql.ts +1 -3
- package/src/db/node-sqlite-compat.ts +105 -0
- package/src/db/postgres-migrations.ts +59 -0
- package/src/db/postgres.ts +28 -2
- package/src/db/sqlite-migrations.ts +37 -0
- package/src/db/sqlite.ts +4 -7
- package/src/deferred-tasks.ts +71 -0
- package/src/emdash-runtime.ts +4558 -909
- package/src/fields/boolean.ts +1 -1
- package/src/fields/datetime.ts +1 -1
- package/src/fields/file.ts +15 -11
- package/src/fields/image.ts +29 -13
- package/src/fields/integer.ts +1 -1
- package/src/fields/json.ts +1 -1
- package/src/fields/multiselect.ts +1 -1
- package/src/fields/number.ts +1 -1
- package/src/fields/portable-text.ts +1 -1
- package/src/fields/richtext.ts +1 -1
- package/src/fields/select.ts +1 -1
- package/src/fields/slug.ts +1 -1
- package/src/fields/text.ts +1 -1
- package/src/fields/textarea.ts +1 -1
- package/src/fields/types.ts +29 -9
- package/src/i18n/config.ts +57 -10
- package/src/i18n/normalize.ts +31 -0
- package/src/i18n/repair-locale-casing.ts +37 -0
- package/src/i18n/resolve.ts +272 -0
- package/src/i18n/taxonomy-locale-diagnostic.ts +47 -0
- package/src/import/comments.ts +159 -0
- package/src/import/index.ts +8 -1
- package/src/import/settings.ts +65 -189
- package/src/import/sources/wordpress-plugin.ts +347 -44
- package/src/import/sources/wxr.ts +20 -3
- package/src/import/ssrf.ts +20 -500
- package/src/import/types.ts +12 -0
- package/src/import/utils.ts +214 -0
- package/src/import/wxr-taxonomies.ts +748 -0
- package/src/index.ts +274 -20
- package/src/loader.ts +1257 -152
- package/src/mcp/server.ts +2065 -272
- package/src/mcp/transfer.ts +569 -0
- package/src/media/enrich.ts +78 -0
- package/src/media/focal-point.ts +37 -0
- package/src/media/image-endpoint.ts +206 -0
- package/src/media/index.ts +1 -0
- package/src/media/local-runtime.ts +49 -15
- package/src/media/local.ts +1 -1
- package/src/media/mime.ts +76 -0
- package/src/media/normalize.ts +82 -9
- package/src/media/placeholder.ts +29 -9
- package/src/media/responsive.ts +148 -0
- package/src/media/types.ts +24 -0
- package/src/media/upload-attempts.ts +38 -0
- package/src/media/url.ts +15 -0
- package/src/media/usage/activation.ts +762 -0
- package/src/media/usage/capture-triggers.ts +559 -0
- package/src/media/usage/cleanup.ts +306 -0
- package/src/media/usage/collection-deletion-processor.ts +360 -0
- package/src/media/usage/collection-deletion.ts +846 -0
- package/src/media/usage/content-fields.ts +220 -0
- package/src/media/usage/content-refresh.ts +1000 -0
- package/src/media/usage/content-repair.ts +802 -0
- package/src/media/usage/content-snapshots.ts +516 -0
- package/src/media/usage/extractor.ts +427 -0
- package/src/media/usage/gc.ts +50 -0
- package/src/media/usage/maintenance-engine.ts +166 -0
- package/src/media/usage/projection-fingerprint.ts +143 -0
- package/src/media/usage/reconciliation-processor.ts +449 -0
- package/src/media/usage/reconciliation.ts +1200 -0
- package/src/media/usage/schema-invalidation.ts +72 -0
- package/src/media/usage/site-settings.ts +52 -0
- package/src/media/usage/source-key.ts +26 -0
- package/src/media/usage/types.ts +50 -0
- package/src/media/usage/work-processor.ts +489 -0
- package/src/menus/index.ts +408 -198
- package/src/menus/types.ts +15 -1
- package/src/migrations/config-loader.ts +210 -0
- package/src/migrations/direct-executor.ts +179 -0
- package/src/migrations/identity.ts +46 -0
- package/src/migrations/index.ts +20 -0
- package/src/migrations/integration-metadata.ts +67 -0
- package/src/migrations/manifest-builder.ts +55 -0
- package/src/migrations/manifest-writer.ts +63 -0
- package/src/migrations/manifest.ts +197 -0
- package/src/migrations/protocol.ts +69 -0
- package/src/migrations/target.ts +35 -0
- package/src/object-cache/codec.ts +73 -0
- package/src/object-cache/index.ts +852 -0
- package/src/object-cache/memory.ts +91 -0
- package/src/object-cache/types.ts +125 -0
- package/src/page/absolute-url.ts +146 -0
- package/src/page/jsonld.ts +10 -2
- package/src/page/metadata.ts +50 -3
- package/src/page/seo-contributions.ts +94 -6
- package/src/page/seo-panel.ts +47 -0
- package/src/page/site-identity.ts +58 -0
- package/src/plugin-test-runtime.ts +18 -0
- package/src/plugin-types.ts +410 -0
- package/src/plugin-utils.ts +31 -6
- package/src/plugins/adapt-sandbox-entry.ts +249 -56
- package/src/plugins/byline-access.ts +158 -0
- package/src/plugins/conditional-storage.ts +30 -0
- package/src/plugins/content-access.ts +170 -0
- package/src/plugins/content-policy.ts +74 -0
- package/src/plugins/context.ts +1160 -251
- package/src/plugins/cron.ts +69 -19
- package/src/plugins/define-plugin.ts +129 -86
- package/src/plugins/editor-draft.ts +257 -0
- package/src/plugins/email-console.ts +3 -1
- package/src/plugins/email.ts +16 -0
- package/src/plugins/hooks.ts +330 -57
- package/src/plugins/host.ts +30 -0
- package/src/plugins/http-route-dispatch.ts +389 -0
- package/src/plugins/http-wire.ts +180 -0
- package/src/plugins/index.ts +148 -12
- package/src/plugins/install-finalization.ts +77 -0
- package/src/plugins/lifecycle.ts +47 -0
- package/src/plugins/manager.ts +40 -2
- package/src/plugins/manifest-schema.ts +452 -49
- package/src/plugins/marketplace.ts +110 -42
- package/src/plugins/media.ts +166 -0
- package/src/plugins/request-meta.ts +12 -2
- package/src/plugins/route-error.ts +57 -0
- package/src/plugins/route-wire.ts +304 -0
- package/src/plugins/routes.ts +183 -62
- package/src/plugins/sandbox/hook-result.ts +52 -0
- package/src/plugins/sandbox/index.ts +25 -1
- package/src/plugins/sandbox/noop.ts +13 -5
- package/src/plugins/sandbox/proxy.ts +130 -0
- package/src/plugins/sandbox/runner-options.ts +16 -0
- package/src/plugins/sandbox/types.ts +218 -9
- package/src/plugins/save-rejection.ts +20 -0
- package/src/plugins/scheduler/node.ts +9 -2
- package/src/plugins/secret-redactor.ts +65 -0
- package/src/plugins/settings.ts +303 -0
- package/src/plugins/state.ts +137 -39
- package/src/plugins/storage-indexes.ts +50 -11
- package/src/plugins/storage-query.ts +111 -32
- package/src/plugins/storage-update.ts +96 -0
- package/src/plugins/types.ts +1014 -152
- package/src/preview/urls.ts +23 -3
- package/src/query.ts +1188 -85
- package/src/redirects/cache.ts +113 -23
- package/src/redirects/destination.ts +20 -0
- package/src/redirects/loops.ts +10 -6
- package/src/redirects/patterns.ts +12 -30
- package/src/redirects/status.ts +27 -0
- package/src/references/field-map.ts +115 -0
- package/src/references/resolve.ts +160 -0
- package/src/references/staged.ts +157 -0
- package/src/references/types.ts +16 -0
- package/src/registry/artifact-checksum.ts +15 -0
- package/src/registry/artifact-fetch.ts +317 -0
- package/src/registry/artifact-verification.ts +85 -0
- package/src/registry/authoritative-records.ts +206 -0
- package/src/registry/config.ts +461 -0
- package/src/registry/plugin-id.ts +116 -0
- package/src/registry/publisher-handle.ts +273 -0
- package/src/registry/record-labels.ts +28 -0
- package/src/registry/testing.ts +145 -0
- package/src/registry/types.ts +126 -0
- package/src/request-cache.ts +31 -4
- package/src/request-context.ts +62 -3
- package/src/scheduled-publish.ts +225 -0
- package/src/scheduler-health.ts +46 -0
- package/src/schema/block-type-contract.ts +478 -0
- package/src/schema/block-type-registry.ts +689 -0
- package/src/schema/block-types.ts +110 -0
- package/src/schema/block-values.ts +293 -0
- package/src/schema/byline-registry.ts +671 -0
- package/src/schema/collection-slugs-cache.ts +157 -0
- package/src/schema/env-types.ts +37 -0
- package/src/schema/index.ts +29 -0
- package/src/schema/project-env-types.ts +41 -0
- package/src/schema/query.ts +11 -4
- package/src/schema/registry.ts +1837 -264
- package/src/schema/types.ts +326 -5
- package/src/schema/url-pattern.ts +43 -0
- package/src/schema/zod-generator.ts +357 -34
- package/src/search/fts-manager.ts +256 -39
- package/src/search/index.ts +2 -0
- package/src/search/match.ts +50 -0
- package/src/search/query.ts +155 -18
- package/src/search/types.ts +18 -0
- package/src/security/ssrf.ts +549 -0
- package/src/seed/apply.ts +1547 -274
- package/src/seed/ownership.ts +15 -0
- package/src/seed/types.ts +145 -11
- package/src/seed/validate.ts +415 -26
- package/src/seo/hreflang.ts +196 -0
- package/src/seo/index.ts +28 -32
- package/src/seo/media-url.ts +58 -0
- package/src/settings/index.ts +206 -27
- package/src/settings/types.ts +42 -1
- package/src/storage/local.ts +2 -1
- package/src/storage/s3.ts +6 -4
- package/src/storage/types.ts +8 -0
- package/src/taxonomies/index.ts +686 -302
- package/src/taxonomies/term-counts.ts +175 -0
- package/src/taxonomies/types.ts +10 -0
- package/src/transfer/analyze/index.ts +45 -0
- package/src/transfer/analyze/issues.ts +55 -0
- package/src/transfer/analyze/plan.ts +327 -0
- package/src/transfer/analyze/read.ts +134 -0
- package/src/transfer/analyze/step.ts +551 -0
- package/src/transfer/analyze/target.ts +269 -0
- package/src/transfer/analyze/unique-keys.ts +219 -0
- package/src/transfer/analyze/validate.ts +1550 -0
- package/src/transfer/analyze/values.ts +341 -0
- package/src/transfer/analyze/write-rules.ts +204 -0
- package/src/transfer/audit.ts +38 -0
- package/src/transfer/auth.ts +25 -0
- package/src/transfer/container/tar.ts +242 -0
- package/src/transfer/domain.ts +248 -0
- package/src/transfer/errors.ts +134 -0
- package/src/transfer/export/exporter.ts +1067 -0
- package/src/transfer/export/fence.ts +84 -0
- package/src/transfer/export/media.ts +165 -0
- package/src/transfer/export/readers.ts +1168 -0
- package/src/transfer/export/verify.ts +677 -0
- package/src/transfer/fence.ts +193 -0
- package/src/transfer/format/canonical.ts +151 -0
- package/src/transfer/format/column-codec.ts +275 -0
- package/src/transfer/format/columns.ts +727 -0
- package/src/transfer/format/digest.ts +287 -0
- package/src/transfer/format/features.ts +91 -0
- package/src/transfer/format/issues.ts +39 -0
- package/src/transfer/format/kinds.ts +952 -0
- package/src/transfer/format/limits.ts +87 -0
- package/src/transfer/format/manifest.ts +297 -0
- package/src/transfer/format/media-refs.ts +716 -0
- package/src/transfer/format/paths.ts +73 -0
- package/src/transfer/format/plan.ts +162 -0
- package/src/transfer/format/receipt.ts +43 -0
- package/src/transfer/format/records.ts +127 -0
- package/src/transfer/format/settings.ts +94 -0
- package/src/transfer/format/transformations.ts +260 -0
- package/src/transfer/format/version.ts +9 -0
- package/src/transfer/gc.ts +103 -0
- package/src/transfer/import/advance.ts +522 -0
- package/src/transfer/import/context.ts +288 -0
- package/src/transfer/import/entries.ts +186 -0
- package/src/transfer/import/ids.ts +40 -0
- package/src/transfer/import/index.ts +15 -0
- package/src/transfer/import/media.ts +141 -0
- package/src/transfer/import/rebuild.ts +300 -0
- package/src/transfer/import/rows.ts +114 -0
- package/src/transfer/import/scaffold.ts +221 -0
- package/src/transfer/import/sql.ts +134 -0
- package/src/transfer/import/stages.ts +329 -0
- package/src/transfer/import/writers.ts +370 -0
- package/src/transfer/index.ts +472 -0
- package/src/transfer/ops/approvals.ts +359 -0
- package/src/transfer/ops/budget.ts +82 -0
- package/src/transfer/ops/collation.ts +21 -0
- package/src/transfer/ops/identity-map.ts +142 -0
- package/src/transfer/ops/media-blobs.ts +135 -0
- package/src/transfer/ops/operations.ts +842 -0
- package/src/transfer/ops/package-index.ts +159 -0
- package/src/transfer/ops/staged-files.ts +231 -0
- package/src/transfer/ops/states.ts +265 -0
- package/src/transfer/ops/time.ts +54 -0
- package/src/transfer/schema-importer.ts +34 -0
- package/src/transfer/site-id.ts +30 -0
- package/src/transfer/staging/assembler.ts +217 -0
- package/src/transfer/staging/keys.ts +94 -0
- package/src/transfer/staging/package.ts +229 -0
- package/src/transfer/staging/stage.ts +231 -0
- package/src/ui-comments.ts +19 -0
- package/src/ui.ts +26 -3
- package/src/utils/base64.ts +7 -2
- package/src/utils/db-errors.ts +26 -0
- package/src/utils/hash.ts +14 -3
- package/src/utils/init-lock.ts +143 -0
- package/src/utils/single-flight-cache.ts +194 -0
- package/src/utils/slugify.ts +1 -29
- package/src/utils/url.ts +58 -3
- package/src/virtual-modules.d.ts +84 -0
- package/src/visual-editing/action-token.ts +31 -0
- package/src/visual-editing/editable.ts +41 -35
- package/src/visual-editing/toolbar-bootstrap.ts +145 -0
- package/src/visual-editing/toolbar.ts +273 -48
- package/src/widgets/archives.ts +68 -0
- package/src/widgets/index.ts +83 -54
- package/dist/adapters-BKSf3T9R.d.mts +0 -121
- package/dist/adapters-BKSf3T9R.d.mts.map +0 -1
- package/dist/apply-x0eMK1lX.mjs +0 -1528
- package/dist/apply-x0eMK1lX.mjs.map +0 -1
- package/dist/base64-MBPo9ozB.mjs +0 -59
- package/dist/base64-MBPo9ozB.mjs.map +0 -1
- package/dist/byline-Chbr2GoP.mjs +0 -220
- package/dist/byline-Chbr2GoP.mjs.map +0 -1
- package/dist/bylines-CRNsVG88.mjs +0 -157
- package/dist/bylines-CRNsVG88.mjs.map +0 -1
- package/dist/cache-BkKBuIvS.mjs +0 -56
- package/dist/cache-BkKBuIvS.mjs.map +0 -1
- package/dist/chunk-ClPoSABd.mjs +0 -21
- package/dist/chunks-HGz06Soa.mjs +0 -19
- package/dist/chunks-HGz06Soa.mjs.map +0 -1
- package/dist/config-BXwuX8Bx.mjs +0 -47
- package/dist/config-BXwuX8Bx.mjs.map +0 -1
- package/dist/connection-2igzM-AT.mjs +0 -57
- package/dist/connection-2igzM-AT.mjs.map +0 -1
- package/dist/content-BcQPYxdV.mjs +0 -878
- package/dist/content-BcQPYxdV.mjs.map +0 -1
- package/dist/db-errors-l1Qh2RPR.mjs +0 -41
- package/dist/db-errors-l1Qh2RPR.mjs.map +0 -1
- package/dist/default-DCVqE5ib.mjs +0 -81
- package/dist/default-DCVqE5ib.mjs.map +0 -1
- package/dist/dialect-helpers-DhTzaUxP.mjs +0 -93
- package/dist/dialect-helpers-DhTzaUxP.mjs.map +0 -1
- package/dist/error-zG5T1UGA.mjs +0 -27
- package/dist/error-zG5T1UGA.mjs.map +0 -1
- package/dist/index-DIb-CzNx.d.mts +0 -4955
- package/dist/index-DIb-CzNx.d.mts.map +0 -1
- package/dist/load-CyEoextb.mjs +0 -28
- package/dist/load-CyEoextb.mjs.map +0 -1
- package/dist/loader-CndGj8kM.mjs +0 -457
- package/dist/loader-CndGj8kM.mjs.map +0 -1
- package/dist/manifest-schema-DH9xhc6t.mjs +0 -199
- package/dist/manifest-schema-DH9xhc6t.mjs.map +0 -1
- package/dist/media-D8FbNsl0.mjs +0 -197
- package/dist/media-D8FbNsl0.mjs.map +0 -1
- package/dist/mode-BnAOqItE.mjs +0 -23
- package/dist/mode-BnAOqItE.mjs.map +0 -1
- package/dist/patterns-CrCYkMBb.mjs +0 -93
- package/dist/patterns-CrCYkMBb.mjs.map +0 -1
- package/dist/placeholder-C-fk5hYI.mjs +0 -268
- package/dist/placeholder-C-fk5hYI.mjs.map +0 -1
- package/dist/placeholder-D29tWZ7o.d.mts +0 -284
- package/dist/placeholder-D29tWZ7o.d.mts.map +0 -1
- package/dist/query-fqEdLFms.mjs +0 -558
- package/dist/query-fqEdLFms.mjs.map +0 -1
- package/dist/redirect-D_pshWdf.mjs +0 -302
- package/dist/redirect-D_pshWdf.mjs.map +0 -1
- package/dist/registry-C3Mr0ODu.mjs +0 -902
- package/dist/registry-C3Mr0ODu.mjs.map +0 -1
- package/dist/request-cache-Ci7f5pBb.mjs +0 -79
- package/dist/request-cache-Ci7f5pBb.mjs.map +0 -1
- package/dist/runner-OURCaApa.d.mts +0 -34
- package/dist/runner-OURCaApa.d.mts.map +0 -1
- package/dist/runner-tQ7BJ4T7.mjs +0 -1619
- package/dist/runner-tQ7BJ4T7.mjs.map +0 -1
- package/dist/search-BoZYFuUk.mjs +0 -9637
- package/dist/search-BoZYFuUk.mjs.map +0 -1
- package/dist/taxonomies-B4IAshV8.mjs +0 -308
- package/dist/taxonomies-B4IAshV8.mjs.map +0 -1
- package/dist/tokens-D9vnZqYS.mjs +0 -171
- package/dist/tokens-D9vnZqYS.mjs.map +0 -1
- package/dist/transaction-Cn2rjY78.mjs +0 -28
- package/dist/transaction-Cn2rjY78.mjs.map +0 -1
- package/dist/transport-C9ugt2Nr.mjs +0 -418
- package/dist/transport-C9ugt2Nr.mjs.map +0 -1
- package/dist/transport-CUnEL3Vs.d.mts +0 -42
- package/dist/transport-CUnEL3Vs.d.mts.map +0 -1
- package/dist/types-BIgulNsW.mjs +0 -68
- package/dist/types-BIgulNsW.mjs.map +0 -1
- package/dist/types-Bm1dn-q3.mjs +0 -83
- package/dist/types-Bm1dn-q3.mjs.map +0 -1
- package/dist/types-BmPPSUEx.d.mts +0 -243
- package/dist/types-BmPPSUEx.d.mts.map +0 -1
- package/dist/types-BrA0xf5I.d.mts +0 -126
- package/dist/types-BrA0xf5I.d.mts.map +0 -1
- package/dist/types-CS8FIX7L.d.mts +0 -435
- package/dist/types-CS8FIX7L.d.mts.map +0 -1
- package/dist/types-CgqmmMJB.mjs +0 -16
- package/dist/types-CgqmmMJB.mjs.map +0 -1
- package/dist/types-DIMwPFub.d.mts +0 -192
- package/dist/types-DIMwPFub.d.mts.map +0 -1
- package/dist/types-i36XcA_X.d.mts +0 -1252
- package/dist/types-i36XcA_X.d.mts.map +0 -1
- package/dist/validate-CxVsLehf.mjs +0 -328
- package/dist/validate-CxVsLehf.mjs.map +0 -1
- package/dist/validate-DHxmpFJt.d.mts +0 -331
- package/dist/validate-DHxmpFJt.d.mts.map +0 -1
- package/dist/validate-VPnKoIzW.mjs +0 -97
- package/dist/validate-VPnKoIzW.mjs.map +0 -1
- package/dist/validation-C-ZpN2GI.mjs +0 -144
- package/dist/validation-C-ZpN2GI.mjs.map +0 -1
- package/dist/version-DJrV1K0M.mjs +0 -7
- package/dist/version-DJrV1K0M.mjs.map +0 -1
- package/dist/zod-generator-CpwccCIv.mjs +0 -132
- package/dist/zod-generator-CpwccCIv.mjs.map +0 -1
- package/src/cli/commands/auth.ts +0 -46
- package/src/cli/commands/bundle-utils.ts +0 -273
- package/src/cli/commands/bundle.ts +0 -626
- package/src/cli/commands/dev.ts +0 -191
- package/src/cli/commands/plugin-init.ts +0 -291
- package/src/cli/commands/plugin-validate.ts +0 -31
- package/src/cli/commands/plugin.ts +0 -33
- package/src/cli/commands/publish.ts +0 -697
- package/src/plugins/scheduler/piggyback.ts +0 -71
|
@@ -1,1829 +1,450 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import "../
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import "../
|
|
10
|
-
import "../
|
|
11
|
-
import { t as
|
|
12
|
-
import
|
|
13
|
-
import "../
|
|
14
|
-
import "../
|
|
15
|
-
import
|
|
16
|
-
import { i as
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import "../
|
|
21
|
-
import "../
|
|
22
|
-
import
|
|
23
|
-
import "../
|
|
24
|
-
import
|
|
25
|
-
import "../
|
|
26
|
-
import "../
|
|
27
|
-
import "../
|
|
28
|
-
import "../
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
1
|
+
import "../runner-CLpxmhl8.mjs";
|
|
2
|
+
import { n as isMissingTableError } from "../db-errors-CBD5yMro.mjs";
|
|
3
|
+
import "../dialect-helpers-7_IqPdh9.mjs";
|
|
4
|
+
import { c as setI18nConfig } from "../config-CvmjJcVw.mjs";
|
|
5
|
+
import "../datetime-normalization-PeiEdcRY.mjs";
|
|
6
|
+
import { j as EmDashConfigurationError, t as getMenu } from "../menus-XQdKk-87.mjs";
|
|
7
|
+
import { n as createDeferredTaskTracker, t as after } from "../after-PcEvMY_6.mjs";
|
|
8
|
+
import { createRequestMetrics, getRequestContext, runWithContext } from "../request-context.mjs";
|
|
9
|
+
import "../options-DhrI7eMv.mjs";
|
|
10
|
+
import "../base64-DvnNgP7e.mjs";
|
|
11
|
+
import { n as initWithLock, t as createInitLock } from "../init-lock-4eRRB4Le.mjs";
|
|
12
|
+
import "../secrets-CIi0nFiR.mjs";
|
|
13
|
+
import "../content-RzEXY3QX.mjs";
|
|
14
|
+
import { s as getLastContentWriteAt } from "../object-cache-Bo6DGaC9.mjs";
|
|
15
|
+
import "../slugify-T5GHH42D.mjs";
|
|
16
|
+
import { i as setRequestCacheEntry, r as requestCached } from "../request-cache-C4CIo5ad.mjs";
|
|
17
|
+
import "../url-Dn3IStq8.mjs";
|
|
18
|
+
import "../types-j6MBDjlZ.mjs";
|
|
19
|
+
import "../revision-CGkQA0e5.mjs";
|
|
20
|
+
import "../media-CputjGE1.mjs";
|
|
21
|
+
import "../user-BOvuF1sQ.mjs";
|
|
22
|
+
import "../taxonomy-BesdHIwi.mjs";
|
|
23
|
+
import "../comment-Cq1UYN8_.mjs";
|
|
24
|
+
import "../audit-BszbE_BP.mjs";
|
|
25
|
+
import "../context-CTkYVMZV.mjs";
|
|
26
|
+
import "../menus-trvc6_fW.mjs";
|
|
27
|
+
import "../resolve-D-kqyKns.mjs";
|
|
28
|
+
import "../redirect-BvFKh8Sz.mjs";
|
|
29
|
+
import "../byline-registry-dvt4N3xV.mjs";
|
|
30
|
+
import "../field-defs-cache-DEkFYCDE.mjs";
|
|
31
|
+
import "../byline-02tu_Uc-.mjs";
|
|
32
|
+
import "../staged-Bw5eHbKS.mjs";
|
|
33
|
+
import "../dist-Cfu8mMBs.mjs";
|
|
34
|
+
import "../enrich-BDdVNeDK.mjs";
|
|
35
|
+
import "../entry-locks-DJAqVweV.mjs";
|
|
36
|
+
import "../seo-DpYxmGaL.mjs";
|
|
37
|
+
import "../cache-CPanL9IO.mjs";
|
|
38
|
+
import "../fts-manager-DU03MxWu.mjs";
|
|
39
|
+
import { s as getDb } from "../loader-CWb-ja1p.mjs";
|
|
40
|
+
import { createRecorder, flushRecorder, isInstrumentationEnabled } from "../database/instrumentation.mjs";
|
|
41
|
+
import "../collection-slugs-cache-BNRAPNiu.mjs";
|
|
42
|
+
import { a as getTaxonomyDefs, o as getTaxonomyTerms } from "../taxonomies-CvBe3xhM.mjs";
|
|
43
|
+
import "../api-BJFwdTiG.mjs";
|
|
44
|
+
import "../capture-triggers-CdZfvHtF.mjs";
|
|
45
|
+
import "../activation-DDuqAat2.mjs";
|
|
46
|
+
import "../collection-deletion-JecE26cS.mjs";
|
|
47
|
+
import "../registry-CtHRqVe-.mjs";
|
|
48
|
+
import "../hash-CY4QdeMJ.mjs";
|
|
49
|
+
import "../zod-generator-DnfG5sGQ.mjs";
|
|
50
|
+
import "../errors-CjXd1LgH.mjs";
|
|
51
|
+
import "../canonical-CAecl1UQ.mjs";
|
|
52
|
+
import "../digest-DiYAoZpf.mjs";
|
|
53
|
+
import "../block-values-BrTrtA-v.mjs";
|
|
54
|
+
import "../query-DSEkrw_m.mjs";
|
|
55
|
+
import "../schema-BZPj3kwZ.mjs";
|
|
56
|
+
import "../relations-CVI2nbrn.mjs";
|
|
57
|
+
import "../dashboard-BoV4pwPP.mjs";
|
|
58
|
+
import "../config-CXPcy2iY.mjs";
|
|
59
|
+
import "../errors-CNvATh_7.mjs";
|
|
60
|
+
import "../update-check-B2JKz5cr.mjs";
|
|
61
|
+
import "../media-3v7mqAVX.mjs";
|
|
62
|
+
import "../media-folders-D2VdVBf6.mjs";
|
|
63
|
+
import "../media-usage-work-BlMjwPg8.mjs";
|
|
64
|
+
import "../content-repair-B-k5JrVN.mjs";
|
|
65
|
+
import "../collection-deletion-processor-DgCfF3a1.mjs";
|
|
66
|
+
import "../media-usage-B8q0owWQ.mjs";
|
|
67
|
+
import "../settings-B0zQj_Tj.mjs";
|
|
68
|
+
import "../site-settings-AYFvhwQn.mjs";
|
|
69
|
+
import "../media-usage-activation-CQWOOTJi.mjs";
|
|
70
|
+
import "../media-usage-work-BC0qpkMD.mjs";
|
|
71
|
+
import "../schema-Berj5VQx.mjs";
|
|
72
|
+
import "../block-types-DIG_KZwi.mjs";
|
|
73
|
+
import "../seo-C61bnPuV.mjs";
|
|
74
|
+
import { i as getSiteSettings } from "../settings-CnWoEDb0.mjs";
|
|
75
|
+
import "../sections-Do5KdTSQ.mjs";
|
|
76
|
+
import "../settings-Ckzmx-A1.mjs";
|
|
77
|
+
import "../taxonomies-CMCnItWf.mjs";
|
|
78
|
+
import "../manifest-schema-gy37bD_D.mjs";
|
|
79
|
+
import "../marketplace-tHWSsCUo.mjs";
|
|
80
|
+
import "../types-CxwtnuSS.mjs";
|
|
81
|
+
import { t as EmDashStorageError } from "../types-DGw8KMX_.mjs";
|
|
82
|
+
import "../artifact-fetch-CWxyELVI.mjs";
|
|
83
|
+
import "../ssrf-DsmvZB80.mjs";
|
|
84
|
+
import "../authoritative-records-dSvXCfzb.mjs";
|
|
85
|
+
import { t as apiError } from "../error-CEdm_AWU.mjs";
|
|
86
|
+
import "../parse-Gt2l4Sld.mjs";
|
|
87
|
+
import "../redirects-D4EWeXAo.mjs";
|
|
88
|
+
import "../entry-lock-PP1JCXBB.mjs";
|
|
89
|
+
import "../media-D1z_jisb.mjs";
|
|
90
|
+
import "../comments-BRtp992B.mjs";
|
|
91
|
+
import "../byline-fields-DHJs0Mja.mjs";
|
|
92
|
+
import "../menus-BQKqf0Up.mjs";
|
|
93
|
+
import "../status-D39Fpy8R.mjs";
|
|
94
|
+
import { o as createPublicMediaUrlResolver } from "../apply-BNvvsD51.mjs";
|
|
95
|
+
import { o as invalidateUrlPatternCache } from "../query-dHwqNf85.mjs";
|
|
96
|
+
import "../import-DUV3Gl6-.mjs";
|
|
97
|
+
import "../redirects-CWQMKYOS.mjs";
|
|
98
|
+
import "../ssrf-tA45vIPX.mjs";
|
|
99
|
+
import "../credits-CAFPFhuk.mjs";
|
|
100
|
+
import "../cron-xe5XKqA-.mjs";
|
|
101
|
+
import "../email-console-DmqVF5J_.mjs";
|
|
102
|
+
import "../fence-BrnQffdY.mjs";
|
|
103
|
+
import "../route-wire-DK600v4u.mjs";
|
|
104
|
+
import "../routes-D0u5zK2P.mjs";
|
|
105
|
+
import "../utils-CoV-PYhg.mjs";
|
|
106
|
+
import "../tokens-BIGxi8sP.mjs";
|
|
107
|
+
import "../preview-DU5rwz_m.mjs";
|
|
108
|
+
import "../hreflang-CNbZjm4g.mjs";
|
|
109
|
+
import "../comment-reaction-DPeGAfjd.mjs";
|
|
110
|
+
import "../bylines-CTGTsEAs.mjs";
|
|
111
|
+
import { r as getWidgetAreas } from "../widgets-D7I_9xff.mjs";
|
|
112
|
+
import "../validate-WkjGwBSO.mjs";
|
|
113
|
+
import "../load-dHcR5yh9.mjs";
|
|
114
|
+
import "../search-CD5MiMdh.mjs";
|
|
115
|
+
import { i as resolveRuntimeMigrationMode, t as PendingMigrationsError } from "../policy-C1qpNxrr.mjs";
|
|
116
|
+
import { n as EmDashRuntime, t as DB_INIT_DEADLINE_MS } from "../emdash-runtime-YPrVnr6x.mjs";
|
|
117
|
+
import "../site-url-Ceq_AUK0.mjs";
|
|
118
|
+
import "../public-submission-x1eaT6Tx.mjs";
|
|
119
|
+
import "../ownership-DoeAIuTg.mjs";
|
|
120
|
+
import "../snapshot-Dzsn3NZa.mjs";
|
|
121
|
+
import "../backup-Cpl8TqRz.mjs";
|
|
122
|
+
import "../comments-Bi2j9IoX.mjs";
|
|
123
|
+
import "../rate-limit-BXx3Ecp9.mjs";
|
|
124
|
+
import "../service-BFUImckH.mjs";
|
|
125
|
+
import "../lifecycle-CpebZNAA.mjs";
|
|
126
|
+
import { n as resolveSessionUser } from "../session-user-DVcHsFD5.mjs";
|
|
32
127
|
import { defineMiddleware } from "astro:middleware";
|
|
128
|
+
import { buildTime } from "virtual:emdash/build";
|
|
33
129
|
import virtualConfig from "virtual:emdash/config";
|
|
34
|
-
import { createDialect, createRequestScopedDb } from "virtual:emdash/dialect";
|
|
130
|
+
import { createCoalescingDialect, createDialect, createRequestScopedDb } from "virtual:emdash/dialect";
|
|
35
131
|
import { mediaProviders } from "virtual:emdash/media-providers";
|
|
36
132
|
import { plugins } from "virtual:emdash/plugins";
|
|
37
|
-
import
|
|
133
|
+
import * as virtualSandboxRunnerModule from "virtual:emdash/sandbox-runner";
|
|
38
134
|
import { sandboxedPlugins } from "virtual:emdash/sandboxed-plugins";
|
|
135
|
+
import { createScheduler } from "virtual:emdash/scheduler";
|
|
39
136
|
import { createStorage } from "virtual:emdash/storage";
|
|
40
|
-
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
|
41
137
|
|
|
42
|
-
//#region src/
|
|
138
|
+
//#region src/astro/middleware/scoped-db.ts
|
|
43
139
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
140
|
+
* Request-scoped database lifecycle helpers.
|
|
141
|
+
*
|
|
142
|
+
* Extracted from middleware.ts so they can be unit-tested without pulling in
|
|
143
|
+
* the virtual:emdash/* module graph. The middleware imports these to settle a
|
|
144
|
+
* request-scoped db adapter's lifecycle around the response.
|
|
145
|
+
*/
|
|
146
|
+
/**
|
|
147
|
+
* Astro attaches AstroCookies to outgoing responses via a well-known global
|
|
148
|
+
* symbol. Cloning a Response (`new Response(body, init)`) drops non-header
|
|
149
|
+
* metadata, so any helper that wraps the response must explicitly forward this
|
|
150
|
+
* symbol or `cookies.set()` calls will be silently dropped. `Symbol.for`
|
|
151
|
+
* returns the same registry symbol everywhere, so this matches the copy in
|
|
152
|
+
* middleware.ts.
|
|
153
|
+
*/
|
|
154
|
+
const ASTRO_COOKIES_SYMBOL = Symbol.for("astro.cookies");
|
|
155
|
+
/**
|
|
156
|
+
* Whether the request ended authenticated, for the db adapter's `commit()`.
|
|
157
|
+
* `isAuthenticated` is captured before the route runs, so it misses
|
|
158
|
+
* login/signup/invite requests that create the Astro session mid-request;
|
|
159
|
+
* `session.set()` writes the `astro-session` cookie into the jar synchronously,
|
|
160
|
+
* so scanning the outgoing cookies detects them. Only outgoing cookies count —
|
|
161
|
+
* a stale `astro-session` cookie arriving on an anonymous render must not
|
|
162
|
+
* qualify, or its replica-read bookmark would overwrite a fresher one from an
|
|
163
|
+
* earlier authenticated write.
|
|
46
164
|
*/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
return
|
|
165
|
+
function requestEndedAuthenticated(isAuthenticated, cookies) {
|
|
166
|
+
if (isAuthenticated) return true;
|
|
167
|
+
for (const header of cookies.headers()) if (header.startsWith("astro-session=")) return true;
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
/** Hold the real adapter close behind both response and deferred-task completion. */
|
|
171
|
+
function coordinateScopedDbLifecycle(scoped) {
|
|
172
|
+
if (!scoped.close) return { lifecycle: scoped };
|
|
173
|
+
const close = scoped.close;
|
|
174
|
+
const deferredTasks = createDeferredTaskTracker(() => {
|
|
175
|
+
try {
|
|
176
|
+
close();
|
|
177
|
+
} catch (error) {
|
|
178
|
+
console.error("[emdash] request-scoped db close failed:", error);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
return {
|
|
182
|
+
closed: deferredTasks.settled,
|
|
183
|
+
deferredTasks,
|
|
184
|
+
lifecycle: {
|
|
185
|
+
commit: scoped.commit,
|
|
186
|
+
close: deferredTasks.settle
|
|
187
|
+
}
|
|
188
|
+
};
|
|
51
189
|
}
|
|
52
|
-
|
|
53
|
-
//#endregion
|
|
54
|
-
//#region src/cleanup.ts
|
|
55
190
|
/**
|
|
56
|
-
*
|
|
191
|
+
* Run a request-scoped db's `close()` once the response body has finished
|
|
192
|
+
* streaming. Astro streams HTML and components issue DB queries during that
|
|
193
|
+
* stream, so a connection-backed adapter (e.g. Postgres over Hyperdrive) must
|
|
194
|
+
* not be torn down until the body is flushed. Bodyless responses (redirects,
|
|
195
|
+
* 304s, errors) close immediately. A guard makes close idempotent and a stream
|
|
196
|
+
* `cancel` (client disconnect) still triggers it so connections never leak.
|
|
57
197
|
*
|
|
58
|
-
*
|
|
59
|
-
* expired or stale data. Called from cron scheduler ticks and (for latency-
|
|
60
|
-
* sensitive subsystems) inline during relevant requests.
|
|
61
|
-
*
|
|
62
|
-
* Each subsystem cleanup is independent and non-fatal -- if one fails, the
|
|
63
|
-
* rest still run. Failures are logged but never surface to callers.
|
|
198
|
+
* No-op for adapters without a `close` (D1): the response passes through.
|
|
64
199
|
*/
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
200
|
+
function wrapResponseForScopedClose(response, close) {
|
|
201
|
+
let closed = false;
|
|
202
|
+
const runClose = () => {
|
|
203
|
+
if (closed) return;
|
|
204
|
+
closed = true;
|
|
205
|
+
try {
|
|
206
|
+
close();
|
|
207
|
+
} catch (error) {
|
|
208
|
+
console.error("[emdash] request-scoped db close failed:", error);
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
if (!response.body) {
|
|
212
|
+
runClose();
|
|
213
|
+
return response;
|
|
214
|
+
}
|
|
215
|
+
const transform = new TransformStream({
|
|
216
|
+
flush: runClose,
|
|
217
|
+
cancel: runClose
|
|
218
|
+
});
|
|
219
|
+
const wrapped = new Response(response.body.pipeThrough(transform), response);
|
|
220
|
+
const astroCookies = Reflect.get(response, ASTRO_COOKIES_SYMBOL);
|
|
221
|
+
if (astroCookies !== void 0) Reflect.set(wrapped, ASTRO_COOKIES_SYMBOL, astroCookies);
|
|
222
|
+
wrapped.headers.delete("Content-Length");
|
|
223
|
+
return wrapped;
|
|
224
|
+
}
|
|
69
225
|
/**
|
|
70
|
-
* Run
|
|
226
|
+
* Run the request body under a request-scoped db, then settle its lifecycle:
|
|
227
|
+
* `commit()` runs before the response is returned (so per-request state like a
|
|
228
|
+
* D1 bookmark cookie is persisted in the headers, even if render throws), while
|
|
229
|
+
* `close()` (if any) is deferred to lifecycle settlement so a
|
|
230
|
+
* connection-backed adapter isn't torn down mid-render or mid-task. On error
|
|
231
|
+
* the lifecycle is settled before rethrowing so it never leaks.
|
|
71
232
|
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
233
|
+
* On the error path both `commit()` and `close()` are defended: a throw from
|
|
234
|
+
* either is logged and swallowed so it can't replace the propagating render
|
|
235
|
+
* error (which is the one the caller needs to see). On the success path
|
|
236
|
+
* `commit()` is guarded too — if it throws, the connection is closed before the
|
|
237
|
+
* failure is surfaced, so it never leaks. For the current adapters `commit()`
|
|
238
|
+
* is a no-op (Hyperdrive) or a cookie write (D1, no `close`) and `close()` is
|
|
239
|
+
* fire-and-forget, so these guards only matter for a future connection-backed
|
|
240
|
+
* adapter with throwing teardown, but the helper is generic and must not leak
|
|
241
|
+
* or mask.
|
|
79
242
|
*/
|
|
80
|
-
async function
|
|
81
|
-
|
|
82
|
-
challenges: -1,
|
|
83
|
-
expiredTokens: -1,
|
|
84
|
-
pendingUploads: -1,
|
|
85
|
-
pendingUploadFiles: -1,
|
|
86
|
-
revisionsPruned: -1
|
|
87
|
-
};
|
|
88
|
-
try {
|
|
89
|
-
result.challenges = await cleanupExpiredChallenges(db);
|
|
90
|
-
} catch (error) {
|
|
91
|
-
console.error("[cleanup] Failed to clean expired challenges:", error);
|
|
92
|
-
}
|
|
243
|
+
async function finishScoped(scoped, run) {
|
|
244
|
+
let response;
|
|
93
245
|
try {
|
|
94
|
-
await
|
|
95
|
-
result.expiredTokens = 0;
|
|
246
|
+
response = await run();
|
|
96
247
|
} catch (error) {
|
|
97
|
-
|
|
248
|
+
commitSafely(scoped.commit);
|
|
249
|
+
closeSafely(scoped.close);
|
|
250
|
+
throw error;
|
|
98
251
|
}
|
|
99
252
|
try {
|
|
100
|
-
|
|
101
|
-
result.pendingUploads = orphanedKeys.length;
|
|
102
|
-
if (storage && orphanedKeys.length > 0) {
|
|
103
|
-
let filesDeleted = 0;
|
|
104
|
-
for (const key of orphanedKeys) try {
|
|
105
|
-
await storage.delete(key);
|
|
106
|
-
filesDeleted++;
|
|
107
|
-
} catch (error) {
|
|
108
|
-
console.error(`[cleanup] Failed to delete storage file ${key}:`, error);
|
|
109
|
-
}
|
|
110
|
-
result.pendingUploadFiles = filesDeleted;
|
|
111
|
-
} else result.pendingUploadFiles = 0;
|
|
253
|
+
scoped.commit();
|
|
112
254
|
} catch (error) {
|
|
113
|
-
|
|
255
|
+
closeSafely(scoped.close);
|
|
256
|
+
throw error;
|
|
114
257
|
}
|
|
258
|
+
return scoped.close ? wrapResponseForScopedClose(response, scoped.close) : response;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Run commit() swallowing any error. Used where an exception is already
|
|
262
|
+
* propagating (or about to be thrown) and a commit failure must neither mask it
|
|
263
|
+
* nor skip the subsequent close().
|
|
264
|
+
*/
|
|
265
|
+
function commitSafely(commit) {
|
|
115
266
|
try {
|
|
116
|
-
|
|
267
|
+
commit();
|
|
117
268
|
} catch (error) {
|
|
118
|
-
console.error("[
|
|
269
|
+
console.error("[emdash] request-scoped db commit failed during error handling:", error);
|
|
119
270
|
}
|
|
120
|
-
return result;
|
|
121
271
|
}
|
|
122
272
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
273
|
+
* Run close() swallowing any error. Used on the error/commit-failure paths
|
|
274
|
+
* where another exception is the one the caller must see; a throwing teardown
|
|
275
|
+
* must not replace it.
|
|
125
276
|
*/
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
GROUP BY collection, entry_id
|
|
131
|
-
HAVING COUNT(*) > ${REVISION_PRUNE_THRESHOLD}
|
|
132
|
-
`.execute(db);
|
|
133
|
-
if (entries.rows.length === 0) return 0;
|
|
134
|
-
const revisionRepo = new RevisionRepository(db);
|
|
135
|
-
let totalPruned = 0;
|
|
136
|
-
for (const row of entries.rows) try {
|
|
137
|
-
const pruned = await revisionRepo.pruneOldRevisions(row.collection, row.entry_id, REVISION_KEEP_COUNT);
|
|
138
|
-
totalPruned += pruned;
|
|
277
|
+
function closeSafely(close) {
|
|
278
|
+
if (!close) return;
|
|
279
|
+
try {
|
|
280
|
+
close();
|
|
139
281
|
} catch (error) {
|
|
140
|
-
console.error(
|
|
282
|
+
console.error("[emdash] request-scoped db close failed during error handling:", error);
|
|
141
283
|
}
|
|
142
|
-
return totalPruned;
|
|
143
284
|
}
|
|
144
285
|
|
|
145
286
|
//#endregion
|
|
146
|
-
//#region src/
|
|
147
|
-
/** Plugin ID for the built-in default comment moderator */
|
|
148
|
-
const DEFAULT_COMMENT_MODERATOR_PLUGIN_ID = "emdash-default-comment-moderator";
|
|
287
|
+
//#region src/astro/middleware/stream-end-metrics.ts
|
|
149
288
|
/**
|
|
150
|
-
*
|
|
289
|
+
* Stream-end metrics
|
|
290
|
+
*
|
|
291
|
+
* Server-Timing db.* counters are snapshotted when middleware's next()
|
|
292
|
+
* returns — but at that point only the response *headers* are final.
|
|
293
|
+
* Astro streams the body afterwards, and components rendered during
|
|
294
|
+
* streaming issue further DB queries that the headers can never report.
|
|
295
|
+
*
|
|
296
|
+
* This module wraps the response body in an identity TransformStream and
|
|
297
|
+
* snapshots the request metrics in flush(), i.e. when the body actually
|
|
298
|
+
* finishes streaming. The metrics object lives on the request context
|
|
299
|
+
* (AsyncLocalStorage) and is mutated in-place by the Kysely log hook, so
|
|
300
|
+
* a reference captured before wrapping observes every post-header query.
|
|
301
|
+
* The snapshot is emitted as prefixed NDJSON on stdout (same transport as
|
|
302
|
+
* [emdash-query-log] — console.log works in both Node and workerd).
|
|
303
|
+
*
|
|
304
|
+
* Gated on isInstrumentationEnabled() (EMDASH_QUERY_LOG=1): zero overhead
|
|
305
|
+
* in normal production traffic.
|
|
151
306
|
*/
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
307
|
+
const STREAM_END_PREFIX = "[emdash-stream-end]";
|
|
308
|
+
/**
|
|
309
|
+
* Wrap a response body so the FINAL request metrics are emitted when the
|
|
310
|
+
* body finishes streaming. Returns the response unchanged when
|
|
311
|
+
* instrumentation is disabled, the body is null, or no request metrics
|
|
312
|
+
* are attached (e.g. outside the middleware's ALS context).
|
|
313
|
+
*/
|
|
314
|
+
function wrapBodyForStreamMetrics(response) {
|
|
315
|
+
if (!isInstrumentationEnabled()) return response;
|
|
316
|
+
if (!response.body) return response;
|
|
317
|
+
const ctx = getRequestContext();
|
|
318
|
+
const metrics = ctx?.metrics;
|
|
319
|
+
if (!metrics) return response;
|
|
320
|
+
const recorder = ctx?.queryRecorder;
|
|
321
|
+
if (recorder) recorder.deferredFlush = true;
|
|
322
|
+
const transform = new TransformStream({ flush() {
|
|
323
|
+
const snapshot = {
|
|
324
|
+
route: recorder?.route,
|
|
325
|
+
method: recorder?.method,
|
|
326
|
+
phase: recorder?.phase,
|
|
327
|
+
totalMs: performance.now() - metrics.start,
|
|
328
|
+
dbCount: metrics.dbCount,
|
|
329
|
+
dbTotalMs: metrics.dbTotalMs,
|
|
330
|
+
dbFirstOffset: metrics.dbFirstOffset,
|
|
331
|
+
dbLastOffset: metrics.dbLastOffset,
|
|
332
|
+
cacheHits: metrics.cacheHits,
|
|
333
|
+
cacheMisses: metrics.cacheMisses
|
|
334
|
+
};
|
|
335
|
+
console.log(`${STREAM_END_PREFIX} ${JSON.stringify(snapshot)}`);
|
|
336
|
+
if (recorder) flushRecorder(recorder);
|
|
337
|
+
} });
|
|
338
|
+
const wrapped = new Response(response.body.pipeThrough(transform), response);
|
|
339
|
+
const astroCookies = Reflect.get(response, ASTRO_COOKIES_SYMBOL);
|
|
340
|
+
if (astroCookies !== void 0) Reflect.set(wrapped, ASTRO_COOKIES_SYMBOL, astroCookies);
|
|
341
|
+
wrapped.headers.delete("Content-Length");
|
|
342
|
+
return wrapped;
|
|
170
343
|
}
|
|
171
344
|
|
|
172
345
|
//#endregion
|
|
173
|
-
//#region src/
|
|
174
|
-
/** Minimum polling interval (ms) — prevents tight loops if next_run_at is in the past */
|
|
175
|
-
const MIN_INTERVAL_MS = 1e3;
|
|
176
|
-
/** Maximum polling interval (ms) — wake up periodically to check for stale locks */
|
|
177
|
-
const MAX_INTERVAL_MS = 300 * 1e3;
|
|
178
|
-
var NodeCronScheduler = class {
|
|
179
|
-
timer = null;
|
|
180
|
-
running = false;
|
|
181
|
-
systemCleanup = null;
|
|
182
|
-
constructor(executor) {
|
|
183
|
-
this.executor = executor;
|
|
184
|
-
}
|
|
185
|
-
setSystemCleanup(fn) {
|
|
186
|
-
this.systemCleanup = fn;
|
|
187
|
-
}
|
|
188
|
-
start() {
|
|
189
|
-
this.running = true;
|
|
190
|
-
this.arm();
|
|
191
|
-
}
|
|
192
|
-
stop() {
|
|
193
|
-
this.running = false;
|
|
194
|
-
if (this.timer) {
|
|
195
|
-
clearTimeout(this.timer);
|
|
196
|
-
this.timer = null;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
reschedule() {
|
|
200
|
-
if (!this.running) return;
|
|
201
|
-
if (this.timer) {
|
|
202
|
-
clearTimeout(this.timer);
|
|
203
|
-
this.timer = null;
|
|
204
|
-
}
|
|
205
|
-
this.arm();
|
|
206
|
-
}
|
|
207
|
-
arm() {
|
|
208
|
-
if (!this.running) return;
|
|
209
|
-
this.executor.getNextDueTime().then((nextDue) => {
|
|
210
|
-
if (!this.running) return void 0;
|
|
211
|
-
let delayMs;
|
|
212
|
-
if (nextDue) {
|
|
213
|
-
const dueAt = new Date(nextDue).getTime();
|
|
214
|
-
delayMs = Math.max(dueAt - Date.now(), MIN_INTERVAL_MS);
|
|
215
|
-
delayMs = Math.min(delayMs, MAX_INTERVAL_MS);
|
|
216
|
-
} else delayMs = MAX_INTERVAL_MS;
|
|
217
|
-
this.timer = setTimeout(() => {
|
|
218
|
-
if (!this.running) return;
|
|
219
|
-
this.executeTick();
|
|
220
|
-
}, delayMs);
|
|
221
|
-
if (this.timer && typeof this.timer === "object" && "unref" in this.timer) this.timer.unref();
|
|
222
|
-
}).catch((error) => {
|
|
223
|
-
console.error("[cron:node] Failed to get next due time:", error);
|
|
224
|
-
if (this.running) {
|
|
225
|
-
this.timer = setTimeout(() => this.arm(), MAX_INTERVAL_MS);
|
|
226
|
-
if (this.timer && typeof this.timer === "object" && "unref" in this.timer) this.timer.unref();
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
executeTick() {
|
|
231
|
-
if (!this.running) return;
|
|
232
|
-
const tasks = [this.executor.tick(), this.executor.recoverStaleLocks()];
|
|
233
|
-
if (this.systemCleanup) tasks.push(this.systemCleanup());
|
|
234
|
-
Promise.allSettled(tasks).then((results) => {
|
|
235
|
-
for (const r of results) if (r.status === "rejected") console.error("[cron:node] Tick task failed:", r.reason);
|
|
236
|
-
}).finally(() => {
|
|
237
|
-
if (this.running) this.arm();
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
//#endregion
|
|
243
|
-
//#region src/plugins/scheduler/piggyback.ts
|
|
244
|
-
/** Minimum interval between tick attempts (ms) */
|
|
245
|
-
const DEBOUNCE_MS = 60 * 1e3;
|
|
246
|
-
var PiggybackScheduler = class {
|
|
247
|
-
lastTickAt = 0;
|
|
248
|
-
running = false;
|
|
249
|
-
systemCleanup = null;
|
|
250
|
-
constructor(executor) {
|
|
251
|
-
this.executor = executor;
|
|
252
|
-
}
|
|
253
|
-
setSystemCleanup(fn) {
|
|
254
|
-
this.systemCleanup = fn;
|
|
255
|
-
}
|
|
256
|
-
start() {
|
|
257
|
-
this.running = true;
|
|
258
|
-
}
|
|
259
|
-
stop() {
|
|
260
|
-
this.running = false;
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* No-op for piggyback — tick happens on next request.
|
|
264
|
-
*/
|
|
265
|
-
reschedule() {}
|
|
266
|
-
/**
|
|
267
|
-
* Call this from middleware on each request.
|
|
268
|
-
* Debounced: only actually ticks if enough time has passed.
|
|
269
|
-
*/
|
|
270
|
-
onRequest() {
|
|
271
|
-
if (!this.running) return;
|
|
272
|
-
const now = Date.now();
|
|
273
|
-
if (now - this.lastTickAt < DEBOUNCE_MS) return;
|
|
274
|
-
this.lastTickAt = now;
|
|
275
|
-
const tasks = [this.executor.tick(), this.executor.recoverStaleLocks()];
|
|
276
|
-
if (this.systemCleanup) tasks.push(this.systemCleanup());
|
|
277
|
-
Promise.allSettled(tasks).then((results) => {
|
|
278
|
-
for (const r of results) if (r.status === "rejected") console.error("[cron:piggyback] Tick task failed:", r.reason);
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
//#endregion
|
|
284
|
-
//#region src/emdash-runtime.ts
|
|
285
|
-
const LEADING_SLASH_PATTERN = /^\//;
|
|
346
|
+
//#region src/astro/prefetch.ts
|
|
286
347
|
/**
|
|
287
|
-
*
|
|
348
|
+
* Eager, transparent prefetch of site-global "chrome" data.
|
|
349
|
+
*
|
|
350
|
+
* On a public page render, the shared layout pulls the same site-global data on
|
|
351
|
+
* every request -- menus, widget areas, taxonomy term lists, site settings --
|
|
352
|
+
* but each is awaited inside a separately-rendered Astro component, so they
|
|
353
|
+
* execute as serial DB round trips. This fires them all CONCURRENTLY at the
|
|
354
|
+
* very start of the request, before `next()`:
|
|
355
|
+
*
|
|
356
|
+
* - On remote backends (D1, Durable Objects) the round trips overlap instead
|
|
357
|
+
* of serializing, collapsing ~N sequential RTTs into ~1 wall-clock RTT. On
|
|
358
|
+
* a coalescing backend they additionally batch into a single round trip.
|
|
359
|
+
* - The results land in the per-request `requestCached` store under the exact
|
|
360
|
+
* keys the layout helpers use, so when the components render they hit a warm
|
|
361
|
+
* (in-flight or resolved) cache entry instead of issuing their own query.
|
|
288
362
|
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
363
|
+
* Nothing here changes what templates call -- it warms the real helpers, so the
|
|
364
|
+
* cache keys and value shapes are guaranteed identical. The caller gates this to
|
|
365
|
+
* the public-page path on a request-scoped (remote) backend; it is a no-op-ish
|
|
366
|
+
* waste on synchronous local SQLite, so don't call it there.
|
|
367
|
+
*
|
|
368
|
+
* Fire-and-forget: never awaited by middleware, never throws (a prefetch failure
|
|
369
|
+
* must not affect the request -- the helpers will simply run on demand).
|
|
292
370
|
*/
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
return parsed.filter((v) => typeof v === "string");
|
|
371
|
+
/** Warm widget areas: one bulk load, primed under each per-area cache key. */
|
|
372
|
+
async function prefetchWidgetAreas() {
|
|
373
|
+
const areas = await requestCached("widget-areas", getWidgetAreas);
|
|
374
|
+
for (const area of areas) setRequestCacheEntry(`widget-area:${area.name}`, area);
|
|
298
375
|
}
|
|
299
|
-
const VALID_METADATA_KINDS = new Set([
|
|
300
|
-
"meta",
|
|
301
|
-
"property",
|
|
302
|
-
"link",
|
|
303
|
-
"jsonld"
|
|
304
|
-
]);
|
|
305
|
-
/** Security-critical allowlist for link rel values from sandboxed plugins */
|
|
306
|
-
const VALID_LINK_REL = new Set([
|
|
307
|
-
"canonical",
|
|
308
|
-
"alternate",
|
|
309
|
-
"author",
|
|
310
|
-
"license",
|
|
311
|
-
"nlweb",
|
|
312
|
-
"site.standard.document"
|
|
313
|
-
]);
|
|
314
376
|
/**
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
377
|
+
* Warm every taxonomy's term list via the real helper (primes per-name keys).
|
|
378
|
+
* Counts are left out: they cost an aggregate over the whole assignment pivot
|
|
379
|
+
* per taxonomy, and only a consumer that renders one can say it's needed. A
|
|
380
|
+
* consumer that does asks for it and reuses the term list warmed here.
|
|
318
381
|
*/
|
|
319
|
-
function
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
if (typeof obj.kind !== "string" || !VALID_METADATA_KINDS.has(obj.kind)) return false;
|
|
323
|
-
switch (obj.kind) {
|
|
324
|
-
case "meta": return typeof obj.name === "string" && typeof obj.content === "string";
|
|
325
|
-
case "property": return typeof obj.property === "string" && typeof obj.content === "string";
|
|
326
|
-
case "link": return typeof obj.href === "string" && typeof obj.rel === "string" && VALID_LINK_REL.has(obj.rel);
|
|
327
|
-
case "jsonld": return obj.graph != null && typeof obj.graph === "object";
|
|
328
|
-
default: return false;
|
|
329
|
-
}
|
|
382
|
+
async function prefetchTaxonomyTerms() {
|
|
383
|
+
const defs = await getTaxonomyDefs();
|
|
384
|
+
await Promise.allSettled(defs.map((def) => getTaxonomyTerms(def.name, { includeCounts: false })));
|
|
330
385
|
}
|
|
331
|
-
/**
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
const
|
|
335
|
-
|
|
336
|
-
slug: "string",
|
|
337
|
-
url: "url",
|
|
338
|
-
text: "richText",
|
|
339
|
-
number: "number",
|
|
340
|
-
integer: "number",
|
|
341
|
-
boolean: "boolean",
|
|
342
|
-
datetime: "datetime",
|
|
343
|
-
select: "select",
|
|
344
|
-
multiSelect: "multiSelect",
|
|
345
|
-
portableText: "portableText",
|
|
346
|
-
image: "image",
|
|
347
|
-
file: "file",
|
|
348
|
-
reference: "reference",
|
|
349
|
-
json: "json",
|
|
350
|
-
repeater: "repeater"
|
|
351
|
-
};
|
|
352
|
-
/**
|
|
353
|
-
* Convert a ContentItem to Record<string, unknown> for hook consumption.
|
|
354
|
-
* Hooks receive the full item as a flat record.
|
|
355
|
-
*/
|
|
356
|
-
function contentItemToRecord(item) {
|
|
357
|
-
return { ...item };
|
|
386
|
+
/** Warm every menu via the real helper (primes `menu:${name}:${locale}`). */
|
|
387
|
+
async function prefetchMenus() {
|
|
388
|
+
const rows = await (await getDb()).selectFrom("_emdash_menus").select("name").distinct().execute();
|
|
389
|
+
const names = [...new Set(rows.map((r) => r.name))];
|
|
390
|
+
await Promise.allSettled(names.map((name) => getMenu(name)));
|
|
358
391
|
}
|
|
359
|
-
const dbCache = /* @__PURE__ */ new Map();
|
|
360
|
-
let dbInitPromise = null;
|
|
361
|
-
const storageCache = /* @__PURE__ */ new Map();
|
|
362
|
-
const sandboxedPluginCache = /* @__PURE__ */ new Map();
|
|
363
|
-
const marketplacePluginKeys = /* @__PURE__ */ new Set();
|
|
364
|
-
/** Manifest metadata for marketplace plugins: pluginId -> manifest admin config */
|
|
365
|
-
const marketplaceManifestCache = /* @__PURE__ */ new Map();
|
|
366
|
-
/** Route metadata for sandboxed plugins: pluginId -> routeName -> RouteMeta */
|
|
367
|
-
const sandboxedRouteMetaCache = /* @__PURE__ */ new Map();
|
|
368
|
-
let sandboxRunner = null;
|
|
369
392
|
/**
|
|
370
|
-
*
|
|
393
|
+
* Concurrently warm the site-global layout data for the current request.
|
|
394
|
+
* Safe to call only inside the request ALS frame that owns the (remote)
|
|
395
|
+
* request-scoped db. Never throws.
|
|
371
396
|
*/
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
sandboxedPluginEntries;
|
|
383
|
-
schemaRegistry;
|
|
384
|
-
_hooks;
|
|
385
|
-
config;
|
|
386
|
-
mediaProviders;
|
|
387
|
-
mediaProviderEntries;
|
|
388
|
-
cronExecutor;
|
|
389
|
-
email;
|
|
390
|
-
cronScheduler;
|
|
391
|
-
enabledPlugins;
|
|
392
|
-
pluginStates;
|
|
393
|
-
_cachedManifest = null;
|
|
394
|
-
_manifestPromise = null;
|
|
395
|
-
_manifestCacheKey;
|
|
396
|
-
/**
|
|
397
|
-
* Set to true after FTS indexes have been verified for this worker
|
|
398
|
-
* lifetime so we don't re-scan on every admin request. See
|
|
399
|
-
* ensureSearchHealthy().
|
|
400
|
-
*/
|
|
401
|
-
_searchHealthChecked = false;
|
|
402
|
-
_searchHealthPromise = null;
|
|
403
|
-
/** Current hook pipeline. Use the `hooks` getter for external access. */
|
|
404
|
-
get hooks() {
|
|
405
|
-
return this._hooks;
|
|
406
|
-
}
|
|
407
|
-
/** All plugins eligible for the hook pipeline (includes built-in plugins).
|
|
408
|
-
* Stored so we can rebuild the pipeline when plugins are enabled/disabled. */
|
|
409
|
-
allPipelinePlugins;
|
|
410
|
-
/** Factory options for the hook pipeline context factory */
|
|
411
|
-
pipelineFactoryOptions;
|
|
412
|
-
/** Dependencies needed for exclusive hook resolution */
|
|
413
|
-
runtimeDeps;
|
|
414
|
-
/** Mutable ref for the cron invokeCronHook closure to read the current pipeline */
|
|
415
|
-
pipelineRef;
|
|
416
|
-
/**
|
|
417
|
-
* Get the database instance for the current request.
|
|
418
|
-
*
|
|
419
|
-
* Checks the ALS-based request context first — middleware sets a
|
|
420
|
-
* per-request Kysely instance there for D1 read replica sessions
|
|
421
|
-
* or DO preview databases. Falls back to the singleton instance.
|
|
422
|
-
*/
|
|
423
|
-
get db() {
|
|
424
|
-
const ctx = getRequestContext();
|
|
425
|
-
if (ctx?.db) return ctx.db;
|
|
426
|
-
return this._db;
|
|
427
|
-
}
|
|
428
|
-
constructor(parts) {
|
|
429
|
-
this._db = parts.db;
|
|
430
|
-
this.storage = parts.storage;
|
|
431
|
-
this.configuredPlugins = parts.configuredPlugins;
|
|
432
|
-
this.sandboxedPlugins = parts.sandboxedPlugins;
|
|
433
|
-
this.sandboxedPluginEntries = parts.sandboxedPluginEntries;
|
|
434
|
-
this.schemaRegistry = new SchemaRegistry(parts.db);
|
|
435
|
-
this._hooks = parts.hooks;
|
|
436
|
-
this.enabledPlugins = parts.enabledPlugins;
|
|
437
|
-
this.pluginStates = parts.pluginStates;
|
|
438
|
-
this.config = parts.config;
|
|
439
|
-
this.mediaProviders = parts.mediaProviders;
|
|
440
|
-
this.mediaProviderEntries = parts.mediaProviderEntries;
|
|
441
|
-
this.cronExecutor = parts.cronExecutor;
|
|
442
|
-
this.cronScheduler = parts.cronScheduler;
|
|
443
|
-
this.email = parts.emailPipeline;
|
|
444
|
-
this.allPipelinePlugins = parts.allPipelinePlugins;
|
|
445
|
-
this.pipelineFactoryOptions = parts.pipelineFactoryOptions;
|
|
446
|
-
this.runtimeDeps = parts.runtimeDeps;
|
|
447
|
-
this.pipelineRef = parts.pipelineRef;
|
|
448
|
-
this._manifestCacheKey = parts.manifestCacheKey;
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
|
-
* Get the sandbox runner instance (for marketplace install/update)
|
|
452
|
-
*/
|
|
453
|
-
getSandboxRunner() {
|
|
454
|
-
return sandboxRunner;
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* Tick the cron system from request context (piggyback mode).
|
|
458
|
-
* Call this from middleware on each request to ensure cron tasks
|
|
459
|
-
* execute even when no dedicated scheduler is available.
|
|
460
|
-
*/
|
|
461
|
-
tickCron() {
|
|
462
|
-
if (this.cronScheduler instanceof PiggybackScheduler) this.cronScheduler.onRequest();
|
|
463
|
-
}
|
|
464
|
-
/**
|
|
465
|
-
* Stop the cron scheduler gracefully.
|
|
466
|
-
* Call during worker shutdown or hot-reload.
|
|
467
|
-
*/
|
|
468
|
-
async stopCron() {
|
|
469
|
-
if (this.cronScheduler) await this.cronScheduler.stop();
|
|
470
|
-
}
|
|
471
|
-
/**
|
|
472
|
-
* Update in-memory plugin status and rebuild the hook pipeline.
|
|
473
|
-
*
|
|
474
|
-
* Rebuilding the pipeline ensures disabled plugins' hooks stop firing
|
|
475
|
-
* and re-enabled plugins' hooks start firing again without a restart.
|
|
476
|
-
* Exclusive hook selections are re-resolved after each rebuild.
|
|
477
|
-
*/
|
|
478
|
-
async setPluginStatus(pluginId, status) {
|
|
479
|
-
this.pluginStates.set(pluginId, status);
|
|
480
|
-
if (status === "active") {
|
|
481
|
-
this.enabledPlugins.add(pluginId);
|
|
482
|
-
await this.rebuildHookPipeline();
|
|
483
|
-
await this._hooks.runPluginActivate(pluginId);
|
|
484
|
-
} else {
|
|
485
|
-
await this._hooks.runPluginDeactivate(pluginId);
|
|
486
|
-
this.enabledPlugins.delete(pluginId);
|
|
487
|
-
await this.rebuildHookPipeline();
|
|
488
|
-
}
|
|
489
|
-
this.invalidateManifest();
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* Rebuild the hook pipeline from the current set of enabled plugins.
|
|
493
|
-
*
|
|
494
|
-
* Filters `allPipelinePlugins` to only those in `enabledPlugins`,
|
|
495
|
-
* creates a fresh HookPipeline, re-resolves exclusive hook selections,
|
|
496
|
-
* and re-wires the context factory so existing references (cron
|
|
497
|
-
* callbacks, email pipeline) use the new pipeline.
|
|
498
|
-
*/
|
|
499
|
-
async rebuildHookPipeline() {
|
|
500
|
-
const newPipeline = createHookPipeline(this.allPipelinePlugins.filter((p) => this.enabledPlugins.has(p.id)), this.pipelineFactoryOptions);
|
|
501
|
-
await EmDashRuntime.resolveExclusiveHooks(newPipeline, this.db, this.runtimeDeps);
|
|
502
|
-
if (this.email) newPipeline.setContextFactory({
|
|
503
|
-
db: this.db,
|
|
504
|
-
emailPipeline: this.email
|
|
505
|
-
});
|
|
506
|
-
if (this.cronScheduler) {
|
|
507
|
-
const scheduler = this.cronScheduler;
|
|
508
|
-
newPipeline.setContextFactory({ cronReschedule: () => scheduler.reschedule() });
|
|
509
|
-
}
|
|
510
|
-
if (this.email) this.email.setPipeline(newPipeline);
|
|
511
|
-
this.pipelineRef.current = newPipeline;
|
|
512
|
-
this._hooks = newPipeline;
|
|
513
|
-
}
|
|
514
|
-
/**
|
|
515
|
-
* Synchronize marketplace plugin runtime state with DB + storage.
|
|
516
|
-
*
|
|
517
|
-
* Ensures install/update/uninstall changes take effect immediately in the
|
|
518
|
-
* current worker: loads newly active plugins and removes uninstalled ones.
|
|
519
|
-
*/
|
|
520
|
-
async syncMarketplacePlugins() {
|
|
521
|
-
if (!this.config.marketplace || !this.storage) return;
|
|
522
|
-
if (!sandboxRunner || !sandboxRunner.isAvailable()) return;
|
|
523
|
-
try {
|
|
524
|
-
const marketplaceStates = await new PluginStateRepository(this.db).getMarketplacePlugins();
|
|
525
|
-
const desired = /* @__PURE__ */ new Map();
|
|
526
|
-
for (const state of marketplaceStates) {
|
|
527
|
-
this.pluginStates.set(state.pluginId, state.status);
|
|
528
|
-
if (state.status === "active") this.enabledPlugins.add(state.pluginId);
|
|
529
|
-
else this.enabledPlugins.delete(state.pluginId);
|
|
530
|
-
if (state.status !== "active") continue;
|
|
531
|
-
desired.set(state.pluginId, state.marketplaceVersion ?? state.version);
|
|
532
|
-
}
|
|
533
|
-
const keysToRemove = [];
|
|
534
|
-
for (const key of marketplacePluginKeys) {
|
|
535
|
-
const [pluginId] = key.split(":");
|
|
536
|
-
if (!pluginId) continue;
|
|
537
|
-
const desiredVersion = desired.get(pluginId);
|
|
538
|
-
if (desiredVersion && key === `${pluginId}:${desiredVersion}`) continue;
|
|
539
|
-
keysToRemove.push(key);
|
|
540
|
-
}
|
|
541
|
-
for (const key of keysToRemove) {
|
|
542
|
-
const [pluginId] = key.split(":");
|
|
543
|
-
if (!pluginId) continue;
|
|
544
|
-
if (!desired.get(pluginId)) {
|
|
545
|
-
this.pluginStates.delete(pluginId);
|
|
546
|
-
this.enabledPlugins.delete(pluginId);
|
|
547
|
-
}
|
|
548
|
-
const existing = sandboxedPluginCache.get(key);
|
|
549
|
-
if (existing) try {
|
|
550
|
-
await existing.terminate();
|
|
551
|
-
} catch (error) {
|
|
552
|
-
console.warn(`EmDash: Failed to terminate sandboxed plugin ${key}:`, error);
|
|
553
|
-
}
|
|
554
|
-
sandboxedPluginCache.delete(key);
|
|
555
|
-
this.sandboxedPlugins.delete(key);
|
|
556
|
-
marketplacePluginKeys.delete(key);
|
|
557
|
-
if (pluginId) {
|
|
558
|
-
sandboxedRouteMetaCache.delete(pluginId);
|
|
559
|
-
marketplaceManifestCache.delete(pluginId);
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
for (const [pluginId, version] of desired) {
|
|
563
|
-
const key = `${pluginId}:${version}`;
|
|
564
|
-
if (sandboxedPluginCache.has(key)) {
|
|
565
|
-
marketplacePluginKeys.add(key);
|
|
566
|
-
continue;
|
|
567
|
-
}
|
|
568
|
-
const bundle = await loadBundleFromR2(this.storage, pluginId, version);
|
|
569
|
-
if (!bundle) {
|
|
570
|
-
console.warn(`EmDash: Marketplace plugin ${pluginId}@${version} not found in R2`);
|
|
571
|
-
continue;
|
|
572
|
-
}
|
|
573
|
-
const loaded = await sandboxRunner.load(bundle.manifest, bundle.backendCode);
|
|
574
|
-
sandboxedPluginCache.set(key, loaded);
|
|
575
|
-
this.sandboxedPlugins.set(key, loaded);
|
|
576
|
-
marketplacePluginKeys.add(key);
|
|
577
|
-
marketplaceManifestCache.set(pluginId, {
|
|
578
|
-
id: bundle.manifest.id,
|
|
579
|
-
version: bundle.manifest.version,
|
|
580
|
-
admin: bundle.manifest.admin
|
|
581
|
-
});
|
|
582
|
-
if (bundle.manifest.routes.length > 0) {
|
|
583
|
-
const routeMetaMap = /* @__PURE__ */ new Map();
|
|
584
|
-
for (const entry of bundle.manifest.routes) {
|
|
585
|
-
const normalized = normalizeManifestRoute(entry);
|
|
586
|
-
routeMetaMap.set(normalized.name, { public: normalized.public === true });
|
|
587
|
-
}
|
|
588
|
-
sandboxedRouteMetaCache.set(pluginId, routeMetaMap);
|
|
589
|
-
} else sandboxedRouteMetaCache.delete(pluginId);
|
|
590
|
-
}
|
|
591
|
-
} catch (error) {
|
|
592
|
-
console.error("EmDash: Failed to sync marketplace plugins:", error);
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
/**
|
|
596
|
-
* Create and initialize the runtime
|
|
597
|
-
*/
|
|
598
|
-
static async create(deps, timings) {
|
|
599
|
-
const phase = async (name, desc, fn) => {
|
|
600
|
-
if (!timings) return fn();
|
|
601
|
-
const t0 = performance.now();
|
|
602
|
-
try {
|
|
603
|
-
return await fn();
|
|
604
|
-
} finally {
|
|
605
|
-
timings.push({
|
|
606
|
-
name,
|
|
607
|
-
dur: performance.now() - t0,
|
|
608
|
-
desc
|
|
609
|
-
});
|
|
610
|
-
}
|
|
611
|
-
};
|
|
612
|
-
const db = await phase("rt.db", "DB init + migrations", () => EmDashRuntime.getDatabase(deps));
|
|
613
|
-
const storage = EmDashRuntime.getStorage(deps);
|
|
614
|
-
let pluginStates = /* @__PURE__ */ new Map();
|
|
615
|
-
await phase("rt.plugins", "Plugin states", async () => {
|
|
616
|
-
try {
|
|
617
|
-
const states = await db.selectFrom("_plugin_state").select(["plugin_id", "status"]).execute();
|
|
618
|
-
pluginStates = new Map(states.map((s) => [s.plugin_id, s.status]));
|
|
619
|
-
} catch {}
|
|
620
|
-
});
|
|
621
|
-
const enabledPlugins = /* @__PURE__ */ new Set();
|
|
622
|
-
for (const plugin of deps.plugins) {
|
|
623
|
-
const status = pluginStates.get(plugin.id);
|
|
624
|
-
if (status === void 0 || status === "active") enabledPlugins.add(plugin.id);
|
|
625
|
-
}
|
|
626
|
-
let siteInfo;
|
|
627
|
-
await phase("rt.site", "Site info options", async () => {
|
|
628
|
-
try {
|
|
629
|
-
const siteOpts = await new OptionsRepository(db).getMany([
|
|
630
|
-
"emdash:site_title",
|
|
631
|
-
"emdash:site_url",
|
|
632
|
-
"emdash:locale"
|
|
633
|
-
]);
|
|
634
|
-
siteInfo = {
|
|
635
|
-
siteName: siteOpts.get("emdash:site_title") ?? void 0,
|
|
636
|
-
siteUrl: siteOpts.get("emdash:site_url") ?? void 0,
|
|
637
|
-
locale: siteOpts.get("emdash:locale") ?? void 0
|
|
638
|
-
};
|
|
639
|
-
} catch {}
|
|
640
|
-
});
|
|
641
|
-
const allPipelinePlugins = [...deps.plugins];
|
|
642
|
-
if (import.meta.env.DEV) try {
|
|
643
|
-
const devConsolePlugin = definePlugin({
|
|
644
|
-
id: DEV_CONSOLE_EMAIL_PLUGIN_ID,
|
|
645
|
-
version: "0.0.0",
|
|
646
|
-
capabilities: ["email:provide"],
|
|
647
|
-
hooks: { "email:deliver": {
|
|
648
|
-
exclusive: true,
|
|
649
|
-
handler: devConsoleEmailDeliver
|
|
650
|
-
} }
|
|
651
|
-
});
|
|
652
|
-
allPipelinePlugins.push(devConsolePlugin);
|
|
653
|
-
enabledPlugins.add(devConsolePlugin.id);
|
|
654
|
-
} catch (error) {
|
|
655
|
-
console.warn("[email] Failed to register dev console email provider:", error);
|
|
656
|
-
}
|
|
657
|
-
try {
|
|
658
|
-
const defaultModeratorPlugin = definePlugin({
|
|
659
|
-
id: DEFAULT_COMMENT_MODERATOR_PLUGIN_ID,
|
|
660
|
-
version: "0.0.0",
|
|
661
|
-
capabilities: ["read:users"],
|
|
662
|
-
hooks: { "comment:moderate": {
|
|
663
|
-
exclusive: true,
|
|
664
|
-
handler: defaultCommentModerate
|
|
665
|
-
} }
|
|
666
|
-
});
|
|
667
|
-
allPipelinePlugins.push(defaultModeratorPlugin);
|
|
668
|
-
enabledPlugins.add(defaultModeratorPlugin.id);
|
|
669
|
-
} catch (error) {
|
|
670
|
-
console.warn("[comments] Failed to register default moderator:", error);
|
|
671
|
-
}
|
|
672
|
-
const enabledPluginList = allPipelinePlugins.filter((p) => enabledPlugins.has(p.id));
|
|
673
|
-
const pipelineFactoryOptions = {
|
|
674
|
-
db,
|
|
675
|
-
storage: storage ?? void 0,
|
|
676
|
-
siteInfo
|
|
677
|
-
};
|
|
678
|
-
const pipeline = createHookPipeline(enabledPluginList, pipelineFactoryOptions);
|
|
679
|
-
const sandboxedPlugins = await phase("rt.sandbox", "Sandboxed plugins", () => EmDashRuntime.loadSandboxedPlugins(deps, db));
|
|
680
|
-
if (deps.config.marketplace && storage) await phase("rt.market", "Marketplace plugins", () => EmDashRuntime.loadMarketplacePlugins(db, storage, deps, sandboxedPlugins));
|
|
681
|
-
const mediaProviders = /* @__PURE__ */ new Map();
|
|
682
|
-
const mediaProviderEntries = deps.mediaProviderEntries ?? [];
|
|
683
|
-
const providerContext = {
|
|
684
|
-
db,
|
|
685
|
-
storage
|
|
686
|
-
};
|
|
687
|
-
for (const entry of mediaProviderEntries) try {
|
|
688
|
-
const provider = entry.createProvider(providerContext);
|
|
689
|
-
mediaProviders.set(entry.id, provider);
|
|
690
|
-
} catch (error) {
|
|
691
|
-
console.warn(`Failed to initialize media provider "${entry.id}":`, error);
|
|
692
|
-
}
|
|
693
|
-
await phase("rt.hooks", "Exclusive hook resolution", () => EmDashRuntime.resolveExclusiveHooks(pipeline, db, deps));
|
|
694
|
-
const emailPipeline = new EmailPipeline(pipeline);
|
|
695
|
-
if (sandboxRunner) sandboxRunner.setEmailSend((message, pluginId) => emailPipeline.send(message, pluginId));
|
|
696
|
-
const pipelineRef = { current: pipeline };
|
|
697
|
-
const invokeCronHook = async (pluginId, event) => {
|
|
698
|
-
const result = await pipelineRef.current.invokeCronHook(pluginId, event);
|
|
699
|
-
if (!result.success && result.error) throw result.error;
|
|
700
|
-
};
|
|
701
|
-
pipeline.setContextFactory({
|
|
702
|
-
db,
|
|
703
|
-
emailPipeline
|
|
704
|
-
});
|
|
705
|
-
let cronExecutor = null;
|
|
706
|
-
let cronScheduler = null;
|
|
707
|
-
await phase("rt.cron", "Cron init (recovery deferred post-response)", async () => {
|
|
708
|
-
try {
|
|
709
|
-
cronExecutor = new CronExecutor(db, invokeCronHook);
|
|
710
|
-
const executorForRecovery = cronExecutor;
|
|
711
|
-
after(async () => {
|
|
712
|
-
try {
|
|
713
|
-
const recovered = await executorForRecovery.recoverStaleLocks();
|
|
714
|
-
if (recovered > 0) console.log(`[cron] Recovered ${recovered} stale task lock(s)`);
|
|
715
|
-
} catch (error) {
|
|
716
|
-
console.error("[cron] Failed to recover stale task locks:", error);
|
|
717
|
-
}
|
|
718
|
-
});
|
|
719
|
-
if (typeof globalThis.navigator !== "undefined" && globalThis.navigator.userAgent === "Cloudflare-Workers") cronScheduler = new PiggybackScheduler(cronExecutor);
|
|
720
|
-
else cronScheduler = new NodeCronScheduler(cronExecutor);
|
|
721
|
-
cronScheduler.setSystemCleanup(async () => {
|
|
722
|
-
try {
|
|
723
|
-
await runSystemCleanup(db, storage ?? void 0);
|
|
724
|
-
} catch (error) {
|
|
725
|
-
console.error("[cleanup] System cleanup failed:", error);
|
|
726
|
-
}
|
|
727
|
-
});
|
|
728
|
-
pipeline.setContextFactory({ cronReschedule: () => cronScheduler?.reschedule() });
|
|
729
|
-
await cronScheduler.start();
|
|
730
|
-
} catch (error) {
|
|
731
|
-
console.warn("[cron] Failed to initialize cron system:", error);
|
|
732
|
-
}
|
|
733
|
-
});
|
|
734
|
-
const manifestCacheKey = await hashString([
|
|
735
|
-
COMMIT,
|
|
736
|
-
...deps.plugins.map((p) => `${p.id}@${p.version ?? ""}`).toSorted(),
|
|
737
|
-
...deps.sandboxedPluginEntries.map((e) => `${e.id}@${e.version}`).toSorted(),
|
|
738
|
-
virtualConfig?.i18n?.defaultLocale ?? "",
|
|
739
|
-
(virtualConfig?.i18n?.locales ?? []).toSorted().join(",")
|
|
740
|
-
].join("|"));
|
|
741
|
-
return new EmDashRuntime({
|
|
742
|
-
db,
|
|
743
|
-
storage,
|
|
744
|
-
configuredPlugins: deps.plugins,
|
|
745
|
-
sandboxedPlugins,
|
|
746
|
-
sandboxedPluginEntries: deps.sandboxedPluginEntries,
|
|
747
|
-
hooks: pipeline,
|
|
748
|
-
enabledPlugins,
|
|
749
|
-
pluginStates,
|
|
750
|
-
config: deps.config,
|
|
751
|
-
mediaProviders,
|
|
752
|
-
mediaProviderEntries,
|
|
753
|
-
cronExecutor,
|
|
754
|
-
cronScheduler,
|
|
755
|
-
emailPipeline,
|
|
756
|
-
allPipelinePlugins,
|
|
757
|
-
pipelineFactoryOptions,
|
|
758
|
-
runtimeDeps: deps,
|
|
759
|
-
pipelineRef,
|
|
760
|
-
manifestCacheKey
|
|
761
|
-
});
|
|
762
|
-
}
|
|
763
|
-
/**
|
|
764
|
-
* Get a media provider by ID
|
|
765
|
-
*/
|
|
766
|
-
getMediaProvider(providerId) {
|
|
767
|
-
return this.mediaProviders.get(providerId);
|
|
768
|
-
}
|
|
769
|
-
/**
|
|
770
|
-
* Get all media provider entries (for admin UI)
|
|
771
|
-
*/
|
|
772
|
-
getMediaProviderList() {
|
|
773
|
-
return this.mediaProviderEntries.map((e) => ({
|
|
774
|
-
id: e.id,
|
|
775
|
-
name: e.name,
|
|
776
|
-
icon: e.icon,
|
|
777
|
-
capabilities: e.capabilities
|
|
778
|
-
}));
|
|
779
|
-
}
|
|
780
|
-
/**
|
|
781
|
-
* Get or create database instance
|
|
782
|
-
*/
|
|
783
|
-
static async getDatabase(deps) {
|
|
784
|
-
const ctx = getRequestContext();
|
|
785
|
-
if (ctx?.dbIsIsolated && ctx.db) return ctx.db;
|
|
786
|
-
const dbConfig = deps.config.database;
|
|
787
|
-
if (!dbConfig) try {
|
|
788
|
-
return await getDb();
|
|
789
|
-
} catch {
|
|
790
|
-
throw new Error("EmDash database not configured. Either configure database in astro.config.mjs or use emdashLoader in live.config.ts");
|
|
791
|
-
}
|
|
792
|
-
const cacheKey = dbConfig.entrypoint;
|
|
793
|
-
const cached = dbCache.get(cacheKey);
|
|
794
|
-
if (cached) return cached;
|
|
795
|
-
if (dbInitPromise) return dbInitPromise;
|
|
796
|
-
dbInitPromise = (async () => {
|
|
797
|
-
const db = new Kysely({
|
|
798
|
-
dialect: deps.createDialect(dbConfig.config),
|
|
799
|
-
log: kyselyLogOption()
|
|
800
|
-
});
|
|
801
|
-
const { applied } = await runMigrations(db);
|
|
802
|
-
if (applied.length > 0) try {
|
|
803
|
-
await new OptionsRepository(db).delete("emdash:manifest_cache");
|
|
804
|
-
} catch {}
|
|
805
|
-
try {
|
|
806
|
-
const [collectionCount, setupOption] = await Promise.all([db.selectFrom("_emdash_collections").select((eb) => eb.fn.countAll().as("count")).executeTakeFirstOrThrow(), db.selectFrom("options").select("value").where("name", "=", "emdash:setup_complete").executeTakeFirst()]);
|
|
807
|
-
const setupDone = (() => {
|
|
808
|
-
try {
|
|
809
|
-
return setupOption && JSON.parse(setupOption.value) === true;
|
|
810
|
-
} catch {
|
|
811
|
-
return false;
|
|
812
|
-
}
|
|
813
|
-
})();
|
|
814
|
-
if (collectionCount.count === 0 && !setupDone) {
|
|
815
|
-
const { applySeed } = await import("../apply-x0eMK1lX.mjs").then((n) => n.n);
|
|
816
|
-
const { loadSeed } = await import("../load-CyEoextb.mjs").then((n) => n.r);
|
|
817
|
-
const { validateSeed } = await import("../validate-CxVsLehf.mjs").then((n) => n.n);
|
|
818
|
-
const seed = await loadSeed();
|
|
819
|
-
if (validateSeed(seed).valid) {
|
|
820
|
-
await applySeed(db, seed, { onConflict: "skip" });
|
|
821
|
-
console.log("Auto-seeded default collections");
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
} catch {}
|
|
825
|
-
dbCache.set(cacheKey, db);
|
|
826
|
-
return db;
|
|
827
|
-
})();
|
|
828
|
-
try {
|
|
829
|
-
return await dbInitPromise;
|
|
830
|
-
} finally {
|
|
831
|
-
dbInitPromise = null;
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
/**
|
|
835
|
-
* Get or create storage instance
|
|
836
|
-
*/
|
|
837
|
-
static getStorage(deps) {
|
|
838
|
-
const storageConfig = deps.config.storage;
|
|
839
|
-
if (!storageConfig || !deps.createStorage) return null;
|
|
840
|
-
const cacheKey = storageConfig.entrypoint;
|
|
841
|
-
const cached = storageCache.get(cacheKey);
|
|
842
|
-
if (cached) return cached;
|
|
843
|
-
const storage = deps.createStorage(storageConfig.config);
|
|
844
|
-
storageCache.set(cacheKey, storage);
|
|
845
|
-
return storage;
|
|
846
|
-
}
|
|
847
|
-
/**
|
|
848
|
-
* Load sandboxed plugins using SandboxRunner
|
|
849
|
-
*/
|
|
850
|
-
static async loadSandboxedPlugins(deps, db) {
|
|
851
|
-
if (sandboxedPluginCache.size > 0) return sandboxedPluginCache;
|
|
852
|
-
if (!deps.sandboxEnabled || deps.sandboxedPluginEntries.length === 0) return sandboxedPluginCache;
|
|
853
|
-
if (!sandboxRunner && deps.createSandboxRunner) sandboxRunner = deps.createSandboxRunner({ db });
|
|
854
|
-
if (!sandboxRunner) return sandboxedPluginCache;
|
|
855
|
-
if (!sandboxRunner.isAvailable()) {
|
|
856
|
-
console.debug("EmDash: Sandbox runner not available (missing bindings), skipping sandbox");
|
|
857
|
-
return sandboxedPluginCache;
|
|
858
|
-
}
|
|
859
|
-
for (const entry of deps.sandboxedPluginEntries) {
|
|
860
|
-
const pluginKey = `${entry.id}:${entry.version}`;
|
|
861
|
-
if (sandboxedPluginCache.has(pluginKey)) continue;
|
|
862
|
-
try {
|
|
863
|
-
const manifest = {
|
|
864
|
-
id: entry.id,
|
|
865
|
-
version: entry.version,
|
|
866
|
-
capabilities: entry.capabilities ?? [],
|
|
867
|
-
allowedHosts: entry.allowedHosts ?? [],
|
|
868
|
-
storage: entry.storage ?? {},
|
|
869
|
-
hooks: [],
|
|
870
|
-
routes: [],
|
|
871
|
-
admin: {}
|
|
872
|
-
};
|
|
873
|
-
const plugin = await sandboxRunner.load(manifest, entry.code);
|
|
874
|
-
sandboxedPluginCache.set(pluginKey, plugin);
|
|
875
|
-
console.log(`EmDash: Loaded sandboxed plugin ${pluginKey} with capabilities: [${manifest.capabilities.join(", ")}]`);
|
|
876
|
-
} catch (error) {
|
|
877
|
-
console.error(`EmDash: Failed to load sandboxed plugin ${entry.id}:`, error);
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
return sandboxedPluginCache;
|
|
881
|
-
}
|
|
882
|
-
/**
|
|
883
|
-
* Cold-start: load marketplace-installed plugins from site-local R2 storage
|
|
884
|
-
*
|
|
885
|
-
* Queries _plugin_state for source='marketplace' rows, fetches each bundle
|
|
886
|
-
* from R2, and loads via SandboxRunner.
|
|
887
|
-
*/
|
|
888
|
-
static async loadMarketplacePlugins(db, storage, deps, cache) {
|
|
889
|
-
if (!sandboxRunner && deps.createSandboxRunner) sandboxRunner = deps.createSandboxRunner({ db });
|
|
890
|
-
if (!sandboxRunner || !sandboxRunner.isAvailable()) return;
|
|
891
|
-
try {
|
|
892
|
-
const marketplacePlugins = await new PluginStateRepository(db).getMarketplacePlugins();
|
|
893
|
-
for (const plugin of marketplacePlugins) {
|
|
894
|
-
if (plugin.status !== "active") continue;
|
|
895
|
-
const version = plugin.marketplaceVersion ?? plugin.version;
|
|
896
|
-
const pluginKey = `${plugin.pluginId}:${version}`;
|
|
897
|
-
if (cache.has(pluginKey)) continue;
|
|
898
|
-
try {
|
|
899
|
-
const bundle = await loadBundleFromR2(storage, plugin.pluginId, version);
|
|
900
|
-
if (!bundle) {
|
|
901
|
-
console.warn(`EmDash: Marketplace plugin ${plugin.pluginId}@${version} not found in R2`);
|
|
902
|
-
continue;
|
|
903
|
-
}
|
|
904
|
-
const loaded = await sandboxRunner.load(bundle.manifest, bundle.backendCode);
|
|
905
|
-
cache.set(pluginKey, loaded);
|
|
906
|
-
marketplacePluginKeys.add(pluginKey);
|
|
907
|
-
marketplaceManifestCache.set(plugin.pluginId, {
|
|
908
|
-
id: bundle.manifest.id,
|
|
909
|
-
version: bundle.manifest.version,
|
|
910
|
-
admin: bundle.manifest.admin
|
|
911
|
-
});
|
|
912
|
-
if (bundle.manifest.routes.length > 0) {
|
|
913
|
-
const routeMeta = /* @__PURE__ */ new Map();
|
|
914
|
-
for (const entry of bundle.manifest.routes) {
|
|
915
|
-
const normalized = normalizeManifestRoute(entry);
|
|
916
|
-
routeMeta.set(normalized.name, { public: normalized.public === true });
|
|
917
|
-
}
|
|
918
|
-
sandboxedRouteMetaCache.set(plugin.pluginId, routeMeta);
|
|
919
|
-
}
|
|
920
|
-
console.log(`EmDash: Loaded marketplace plugin ${pluginKey} with capabilities: [${bundle.manifest.capabilities.join(", ")}]`);
|
|
921
|
-
} catch (error) {
|
|
922
|
-
console.error(`EmDash: Failed to load marketplace plugin ${plugin.pluginId}:`, error);
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
} catch {}
|
|
926
|
-
}
|
|
927
|
-
/**
|
|
928
|
-
* Resolve exclusive hook selections on startup.
|
|
929
|
-
*
|
|
930
|
-
* Delegates to the shared resolveExclusiveHooks() in hooks.ts.
|
|
931
|
-
* The runtime version considers all pipeline providers as "active" since
|
|
932
|
-
* the pipeline was already built from only active/enabled plugins.
|
|
933
|
-
*/
|
|
934
|
-
static async resolveExclusiveHooks(pipeline, db, deps) {
|
|
935
|
-
if (pipeline.getRegisteredExclusiveHooks().length === 0) return;
|
|
936
|
-
let optionsRepo;
|
|
937
|
-
try {
|
|
938
|
-
optionsRepo = new OptionsRepository(db);
|
|
939
|
-
} catch {
|
|
940
|
-
return;
|
|
941
|
-
}
|
|
942
|
-
const preferredHints = /* @__PURE__ */ new Map();
|
|
943
|
-
for (const entry of deps.sandboxedPluginEntries) if (entry.preferred && entry.preferred.length > 0) preferredHints.set(entry.id, entry.preferred);
|
|
944
|
-
await resolveExclusiveHooks({
|
|
945
|
-
pipeline,
|
|
946
|
-
isActive: () => true,
|
|
947
|
-
getOption: (key) => optionsRepo.get(key),
|
|
948
|
-
setOption: (key, value) => optionsRepo.set(key, value),
|
|
949
|
-
deleteOption: async (key) => {
|
|
950
|
-
await optionsRepo.delete(key);
|
|
951
|
-
},
|
|
952
|
-
preferredHints
|
|
953
|
-
});
|
|
954
|
-
}
|
|
955
|
-
/**
|
|
956
|
-
* Get the manifest, using an in-memory cache with a DB-persisted
|
|
957
|
-
* fallback for cold starts. Avoids N+1 schema registry queries
|
|
958
|
-
* on every request.
|
|
959
|
-
*
|
|
960
|
-
* Cache is invalidated by invalidateManifest(), called from schema
|
|
961
|
-
* API routes, MCP server, plugin toggle, and taxonomy def changes.
|
|
962
|
-
*/
|
|
963
|
-
async getManifest() {
|
|
964
|
-
if (getRequestContext()?.dbIsIsolated) return this._buildManifest();
|
|
965
|
-
if (this._cachedManifest) return this._cachedManifest;
|
|
966
|
-
try {
|
|
967
|
-
const cached = await new OptionsRepository(this.db).get("emdash:manifest_cache");
|
|
968
|
-
if (cached && cached.key === this._manifestCacheKey && cached.manifest) {
|
|
969
|
-
this._cachedManifest = cached.manifest;
|
|
970
|
-
return cached.manifest;
|
|
971
|
-
}
|
|
972
|
-
} catch {}
|
|
973
|
-
if (!this._manifestPromise) {
|
|
974
|
-
let manifestPromise;
|
|
975
|
-
const isCurrentLoad = () => this._manifestPromise === manifestPromise;
|
|
976
|
-
manifestPromise = this._loadManifest(isCurrentLoad);
|
|
977
|
-
this._manifestPromise = manifestPromise;
|
|
978
|
-
}
|
|
979
|
-
return this._manifestPromise;
|
|
980
|
-
}
|
|
981
|
-
async _loadManifest(isCurrentLoad) {
|
|
982
|
-
try {
|
|
983
|
-
const manifest = await this._buildManifest();
|
|
984
|
-
if (isCurrentLoad()) {
|
|
985
|
-
this._cachedManifest = manifest;
|
|
986
|
-
try {
|
|
987
|
-
await new OptionsRepository(this.db).set("emdash:manifest_cache", {
|
|
988
|
-
key: this._manifestCacheKey,
|
|
989
|
-
manifest
|
|
990
|
-
});
|
|
991
|
-
} catch {}
|
|
992
|
-
}
|
|
993
|
-
return manifest;
|
|
994
|
-
} finally {
|
|
995
|
-
if (isCurrentLoad()) this._manifestPromise = null;
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
/**
|
|
999
|
-
* Build the manifest from database (N+1 collection queries).
|
|
1000
|
-
*/
|
|
1001
|
-
async _buildManifest() {
|
|
1002
|
-
const manifestCollections = {};
|
|
1003
|
-
try {
|
|
1004
|
-
const registry = new SchemaRegistry(this.db);
|
|
1005
|
-
const dbCollections = await registry.listCollections();
|
|
1006
|
-
for (const collection of dbCollections) {
|
|
1007
|
-
const collectionWithFields = await registry.getCollectionWithFields(collection.slug);
|
|
1008
|
-
const fields = {};
|
|
1009
|
-
if (collectionWithFields?.fields) for (const field of collectionWithFields.fields) {
|
|
1010
|
-
const entry = {
|
|
1011
|
-
kind: FIELD_TYPE_TO_KIND[field.type] ?? "string",
|
|
1012
|
-
label: field.label,
|
|
1013
|
-
required: field.required
|
|
1014
|
-
};
|
|
1015
|
-
if (field.widget) entry.widget = field.widget;
|
|
1016
|
-
if (field.options) entry.options = field.options;
|
|
1017
|
-
if (field.validation?.options) entry.options = field.validation.options.map((v) => ({
|
|
1018
|
-
value: v,
|
|
1019
|
-
label: v.charAt(0).toUpperCase() + v.slice(1)
|
|
1020
|
-
}));
|
|
1021
|
-
if (field.type === "repeater" && field.validation) entry.validation = field.validation;
|
|
1022
|
-
fields[field.slug] = entry;
|
|
1023
|
-
}
|
|
1024
|
-
manifestCollections[collection.slug] = {
|
|
1025
|
-
label: collection.label,
|
|
1026
|
-
labelSingular: collection.labelSingular || collection.label,
|
|
1027
|
-
supports: collection.supports || [],
|
|
1028
|
-
hasSeo: collection.hasSeo,
|
|
1029
|
-
urlPattern: collection.urlPattern,
|
|
1030
|
-
fields
|
|
1031
|
-
};
|
|
1032
|
-
}
|
|
1033
|
-
} catch (error) {
|
|
1034
|
-
console.debug("EmDash: Could not load database collections:", error);
|
|
1035
|
-
}
|
|
1036
|
-
const manifestPlugins = {};
|
|
1037
|
-
for (const plugin of this.configuredPlugins) {
|
|
1038
|
-
const status = this.pluginStates.get(plugin.id);
|
|
1039
|
-
const enabled = status === void 0 || status === "active";
|
|
1040
|
-
const hasAdminEntry = !!plugin.admin?.entry;
|
|
1041
|
-
const hasAdminPages = (plugin.admin?.pages?.length ?? 0) > 0;
|
|
1042
|
-
const hasWidgets = (plugin.admin?.widgets?.length ?? 0) > 0;
|
|
1043
|
-
let adminMode = "none";
|
|
1044
|
-
if (hasAdminEntry) adminMode = "react";
|
|
1045
|
-
else if (hasAdminPages || hasWidgets) adminMode = "blocks";
|
|
1046
|
-
manifestPlugins[plugin.id] = {
|
|
1047
|
-
version: plugin.version,
|
|
1048
|
-
enabled,
|
|
1049
|
-
adminMode,
|
|
1050
|
-
adminPages: plugin.admin?.pages ?? [],
|
|
1051
|
-
dashboardWidgets: plugin.admin?.widgets ?? [],
|
|
1052
|
-
portableTextBlocks: plugin.admin?.portableTextBlocks,
|
|
1053
|
-
fieldWidgets: plugin.admin?.fieldWidgets
|
|
1054
|
-
};
|
|
1055
|
-
}
|
|
1056
|
-
for (const entry of this.sandboxedPluginEntries) {
|
|
1057
|
-
const status = this.pluginStates.get(entry.id);
|
|
1058
|
-
const enabled = status === void 0 || status === "active";
|
|
1059
|
-
const hasAdminPages = (entry.adminPages?.length ?? 0) > 0;
|
|
1060
|
-
const hasWidgets = (entry.adminWidgets?.length ?? 0) > 0;
|
|
1061
|
-
manifestPlugins[entry.id] = {
|
|
1062
|
-
version: entry.version,
|
|
1063
|
-
enabled,
|
|
1064
|
-
sandboxed: true,
|
|
1065
|
-
adminMode: hasAdminPages || hasWidgets ? "blocks" : "none",
|
|
1066
|
-
adminPages: entry.adminPages ?? [],
|
|
1067
|
-
dashboardWidgets: entry.adminWidgets ?? []
|
|
1068
|
-
};
|
|
1069
|
-
}
|
|
1070
|
-
for (const [pluginId, meta] of marketplaceManifestCache) {
|
|
1071
|
-
if (manifestPlugins[pluginId]) continue;
|
|
1072
|
-
const enabled = this.pluginStates.get(pluginId) === "active";
|
|
1073
|
-
const pages = meta.admin?.pages;
|
|
1074
|
-
const widgets = meta.admin?.widgets;
|
|
1075
|
-
const hasAdminPages = (pages?.length ?? 0) > 0;
|
|
1076
|
-
const hasWidgets = (widgets?.length ?? 0) > 0;
|
|
1077
|
-
manifestPlugins[pluginId] = {
|
|
1078
|
-
version: meta.version,
|
|
1079
|
-
enabled,
|
|
1080
|
-
sandboxed: true,
|
|
1081
|
-
adminMode: hasAdminPages || hasWidgets ? "blocks" : "none",
|
|
1082
|
-
adminPages: pages ?? [],
|
|
1083
|
-
dashboardWidgets: widgets ?? []
|
|
1084
|
-
};
|
|
1085
|
-
}
|
|
1086
|
-
let manifestTaxonomies = [];
|
|
1087
|
-
try {
|
|
1088
|
-
manifestTaxonomies = (await this.db.selectFrom("_emdash_taxonomy_defs").selectAll().orderBy("name").execute()).map((row) => ({
|
|
1089
|
-
name: row.name,
|
|
1090
|
-
label: row.label,
|
|
1091
|
-
labelSingular: row.label_singular ?? void 0,
|
|
1092
|
-
hierarchical: row.hierarchical === 1,
|
|
1093
|
-
collections: parseStringArray(row.collections).toSorted()
|
|
1094
|
-
}));
|
|
1095
|
-
} catch (error) {
|
|
1096
|
-
console.debug("EmDash: Could not load taxonomy definitions:", error);
|
|
1097
|
-
}
|
|
1098
|
-
const manifestHash = await hashString(JSON.stringify(manifestCollections) + JSON.stringify(manifestPlugins) + JSON.stringify(manifestTaxonomies));
|
|
1099
|
-
const authMode = getAuthMode(this.config);
|
|
1100
|
-
const authModeValue = authMode.type === "external" ? authMode.providerType : "passkey";
|
|
1101
|
-
const i18nConfig = virtualConfig?.i18n;
|
|
1102
|
-
const i18n = i18nConfig && i18nConfig.locales && i18nConfig.locales.length > 1 ? {
|
|
1103
|
-
defaultLocale: i18nConfig.defaultLocale,
|
|
1104
|
-
locales: i18nConfig.locales
|
|
1105
|
-
} : void 0;
|
|
1106
|
-
return {
|
|
1107
|
-
version: VERSION,
|
|
1108
|
-
commit: COMMIT,
|
|
1109
|
-
hash: manifestHash,
|
|
1110
|
-
collections: manifestCollections,
|
|
1111
|
-
plugins: manifestPlugins,
|
|
1112
|
-
taxonomies: manifestTaxonomies,
|
|
1113
|
-
authMode: authModeValue,
|
|
1114
|
-
i18n,
|
|
1115
|
-
marketplace: !!this.config.marketplace
|
|
1116
|
-
};
|
|
1117
|
-
}
|
|
1118
|
-
/**
|
|
1119
|
-
* Invalidate cached data derived from the manifest/schema.
|
|
1120
|
-
* Called when collections, fields, plugins, or taxonomy defs change.
|
|
1121
|
-
*/
|
|
1122
|
-
invalidateManifest() {
|
|
1123
|
-
this._cachedManifest = null;
|
|
1124
|
-
this._manifestPromise = null;
|
|
1125
|
-
invalidateUrlPatternCache();
|
|
1126
|
-
try {
|
|
1127
|
-
new OptionsRepository(this.db).delete("emdash:manifest_cache").catch((error) => {
|
|
1128
|
-
console.error("Failed to delete persisted manifest cache", error);
|
|
1129
|
-
});
|
|
1130
|
-
} catch (error) {
|
|
1131
|
-
console.error("Failed to initialize manifest cache invalidation", error);
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
/**
|
|
1135
|
-
* Verify and repair FTS indexes on demand. Runs at most once per worker
|
|
1136
|
-
* lifetime.
|
|
1137
|
-
*
|
|
1138
|
-
* Originally called from `EmDashRuntime.create()`, but on a busy D1 link
|
|
1139
|
-
* (e.g. SIN replica ~80-150ms per query) it added ~1.5s to every cold
|
|
1140
|
-
* start for a modest-sized site — more than every other init phase
|
|
1141
|
-
* combined. Anonymous public reads never touch the search write path,
|
|
1142
|
-
* so the cost isn't paid back for the vast majority of requests.
|
|
1143
|
-
*
|
|
1144
|
-
* Instead, search endpoints call this lazily: the first request that
|
|
1145
|
-
* actually needs the index pays the verify cost (usually fast — no
|
|
1146
|
-
* rebuild needed), everyone else runs cold-free.
|
|
1147
|
-
*
|
|
1148
|
-
* Uses the runtime's singleton database (`this._db`) rather than the
|
|
1149
|
-
* request-scoped DB. Verify reads only, but `rebuildIndex` writes, and
|
|
1150
|
-
* a GET search request on D1 carries a `first-unconstrained` session
|
|
1151
|
-
* that's free to route at a read replica — unsafe for writes. The
|
|
1152
|
-
* singleton always goes through the default binding, which the D1
|
|
1153
|
-
* adapter will promote to `first-primary` for write statements.
|
|
1154
|
-
*
|
|
1155
|
-
* Safe to call concurrently: repeated callers share the same in-flight
|
|
1156
|
-
* promise. Errors are swallowed internally so callers don't need to
|
|
1157
|
-
* defend against FTS not existing yet (pre-setup).
|
|
1158
|
-
*/
|
|
1159
|
-
async ensureSearchHealthy() {
|
|
1160
|
-
if (this._searchHealthChecked) return;
|
|
1161
|
-
if (this._searchHealthPromise) return this._searchHealthPromise;
|
|
1162
|
-
if (!isSqlite(this._db)) {
|
|
1163
|
-
this._searchHealthChecked = true;
|
|
1164
|
-
return;
|
|
1165
|
-
}
|
|
1166
|
-
this._searchHealthPromise = (async () => {
|
|
1167
|
-
try {
|
|
1168
|
-
const repaired = await new FTSManager(this._db).verifyAndRepairAll();
|
|
1169
|
-
if (repaired > 0) console.log(`Repaired ${repaired} corrupted FTS index(es)`);
|
|
1170
|
-
} catch {} finally {
|
|
1171
|
-
this._searchHealthChecked = true;
|
|
1172
|
-
this._searchHealthPromise = null;
|
|
1173
|
-
}
|
|
1174
|
-
})();
|
|
1175
|
-
return this._searchHealthPromise;
|
|
1176
|
-
}
|
|
1177
|
-
async handleContentList(collection, params) {
|
|
1178
|
-
return handleContentList(this.db, collection, params);
|
|
1179
|
-
}
|
|
1180
|
-
async handleContentGet(collection, id, locale) {
|
|
1181
|
-
const result = await handleContentGet(this.db, collection, id, locale);
|
|
1182
|
-
return this.hydrateDraftData(result);
|
|
1183
|
-
}
|
|
1184
|
-
async handleContentGetIncludingTrashed(collection, id, locale) {
|
|
1185
|
-
const result = await handleContentGetIncludingTrashed(this.db, collection, id, locale);
|
|
1186
|
-
return this.hydrateDraftData(result);
|
|
1187
|
-
}
|
|
1188
|
-
/**
|
|
1189
|
-
* If the response item has a `draftRevisionId`, replace `item.data` with
|
|
1190
|
-
* the draft revision's data and expose the original published values as
|
|
1191
|
-
* `liveData`. This makes the content_get / content_update round-trip
|
|
1192
|
-
* intuitive — read returns the latest content the caller has saved
|
|
1193
|
-
* (their pending draft), with the previously-published values still
|
|
1194
|
-
* accessible for compare-style flows.
|
|
1195
|
-
*
|
|
1196
|
-
* No-op when no draft exists or the response is an error.
|
|
1197
|
-
*/
|
|
1198
|
-
async hydrateDraftData(result) {
|
|
1199
|
-
if (!result || typeof result !== "object") return result;
|
|
1200
|
-
const r = result;
|
|
1201
|
-
if (!r.success || !r.data?.item) return result;
|
|
1202
|
-
const item = r.data.item;
|
|
1203
|
-
const draftRevisionId = typeof item.draftRevisionId === "string" ? item.draftRevisionId : null;
|
|
1204
|
-
if (!draftRevisionId) return result;
|
|
1205
|
-
try {
|
|
1206
|
-
const revision = await new RevisionRepository(this.db).findById(draftRevisionId);
|
|
1207
|
-
if (!revision) return result;
|
|
1208
|
-
const liveData = item.data && typeof item.data === "object" ? item.data : {};
|
|
1209
|
-
const revisionData = {};
|
|
1210
|
-
for (const [key, value] of Object.entries(revision.data)) if (!key.startsWith("_")) revisionData[key] = value;
|
|
1211
|
-
const mergedData = {
|
|
1212
|
-
...liveData,
|
|
1213
|
-
...revisionData
|
|
1214
|
-
};
|
|
1215
|
-
return {
|
|
1216
|
-
...result,
|
|
1217
|
-
data: {
|
|
1218
|
-
...r.data,
|
|
1219
|
-
item: {
|
|
1220
|
-
...item,
|
|
1221
|
-
data: mergedData,
|
|
1222
|
-
liveData
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
};
|
|
1226
|
-
} catch (error) {
|
|
1227
|
-
console.error("[emdash] draft hydration failed:", error);
|
|
1228
|
-
return result;
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
async handleContentCreate(collection, body) {
|
|
1232
|
-
let processedData = body.data;
|
|
1233
|
-
if (this.hooks.hasHooks("content:beforeSave")) processedData = (await this.hooks.runContentBeforeSave(body.data, collection, true)).content;
|
|
1234
|
-
processedData = await this.runSandboxedBeforeSave(processedData, collection, true);
|
|
1235
|
-
processedData = await this.normalizeMediaFields(collection, processedData);
|
|
1236
|
-
const { validateContentData } = await import("../validation-C-ZpN2GI.mjs");
|
|
1237
|
-
const validation = await validateContentData(this.db, collection, processedData, { partial: false });
|
|
1238
|
-
if (!validation.ok) return {
|
|
1239
|
-
success: false,
|
|
1240
|
-
error: validation.error
|
|
1241
|
-
};
|
|
1242
|
-
const result = await handleContentCreate(this.db, collection, {
|
|
1243
|
-
...body,
|
|
1244
|
-
data: processedData,
|
|
1245
|
-
authorId: body.authorId,
|
|
1246
|
-
bylines: body.bylines
|
|
1247
|
-
});
|
|
1248
|
-
if (result.success && result.data) this.runAfterSaveHooks(contentItemToRecord(result.data.item), collection, true);
|
|
1249
|
-
return result;
|
|
1250
|
-
}
|
|
1251
|
-
async handleContentUpdate(collection, id, body) {
|
|
1252
|
-
const { ContentRepository } = await import("../content-BcQPYxdV.mjs").then((n) => n.n);
|
|
1253
|
-
const repo = new ContentRepository(this.db);
|
|
1254
|
-
const resolvedItem = await repo.findByIdOrSlug(collection, id);
|
|
1255
|
-
const resolvedId = resolvedItem?.id ?? id;
|
|
1256
|
-
if (body._rev) {
|
|
1257
|
-
if (!resolvedItem) return {
|
|
1258
|
-
success: false,
|
|
1259
|
-
error: {
|
|
1260
|
-
code: "NOT_FOUND",
|
|
1261
|
-
message: `Content item not found: ${id}`
|
|
1262
|
-
}
|
|
1263
|
-
};
|
|
1264
|
-
const revCheck = validateRev(body._rev, resolvedItem);
|
|
1265
|
-
if (!revCheck.valid) return {
|
|
1266
|
-
success: false,
|
|
1267
|
-
error: {
|
|
1268
|
-
code: "CONFLICT",
|
|
1269
|
-
message: revCheck.message
|
|
1270
|
-
}
|
|
1271
|
-
};
|
|
1272
|
-
}
|
|
1273
|
-
const { _rev: _discardedRev, ...bodyWithoutRev } = body;
|
|
1274
|
-
let processedData = bodyWithoutRev.data;
|
|
1275
|
-
if (bodyWithoutRev.data) {
|
|
1276
|
-
if (this.hooks.hasHooks("content:beforeSave")) processedData = (await this.hooks.runContentBeforeSave(bodyWithoutRev.data, collection, false)).content;
|
|
1277
|
-
processedData = await this.runSandboxedBeforeSave(processedData, collection, false);
|
|
1278
|
-
processedData = await this.normalizeMediaFields(collection, processedData);
|
|
1279
|
-
const { validateContentData } = await import("../validation-C-ZpN2GI.mjs");
|
|
1280
|
-
const validation = await validateContentData(this.db, collection, processedData, { partial: true });
|
|
1281
|
-
if (!validation.ok) return {
|
|
1282
|
-
success: false,
|
|
1283
|
-
error: validation.error
|
|
1284
|
-
};
|
|
1285
|
-
}
|
|
1286
|
-
let usesDraftRevisions = false;
|
|
1287
|
-
if (processedData) try {
|
|
1288
|
-
if ((await this.schemaRegistry.getCollectionWithFields(collection))?.supports?.includes("revisions")) {
|
|
1289
|
-
usesDraftRevisions = true;
|
|
1290
|
-
const revisionRepo = new RevisionRepository(this.db);
|
|
1291
|
-
const existing = await repo.findById(collection, resolvedId);
|
|
1292
|
-
if (existing) {
|
|
1293
|
-
let baseData;
|
|
1294
|
-
if (existing.draftRevisionId) baseData = (await revisionRepo.findById(existing.draftRevisionId))?.data ?? existing.data;
|
|
1295
|
-
else baseData = existing.data;
|
|
1296
|
-
const mergedData = {
|
|
1297
|
-
...baseData,
|
|
1298
|
-
...processedData
|
|
1299
|
-
};
|
|
1300
|
-
if (bodyWithoutRev.slug !== void 0) mergedData._slug = bodyWithoutRev.slug;
|
|
1301
|
-
if (bodyWithoutRev.skipRevision && existing.draftRevisionId) await revisionRepo.updateData(existing.draftRevisionId, mergedData);
|
|
1302
|
-
else {
|
|
1303
|
-
const revision = await revisionRepo.create({
|
|
1304
|
-
collection,
|
|
1305
|
-
entryId: resolvedId,
|
|
1306
|
-
data: mergedData,
|
|
1307
|
-
authorId: bodyWithoutRev.authorId ?? void 0
|
|
1308
|
-
});
|
|
1309
|
-
validateIdentifier(collection, "collection");
|
|
1310
|
-
const tableName = `ec_${collection}`;
|
|
1311
|
-
await sql`
|
|
1312
|
-
UPDATE ${sql.ref(tableName)}
|
|
1313
|
-
SET draft_revision_id = ${revision.id},
|
|
1314
|
-
updated_at = ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
1315
|
-
WHERE id = ${resolvedId}
|
|
1316
|
-
`.execute(this.db);
|
|
1317
|
-
revisionRepo.pruneOldRevisions(collection, resolvedId, 50).catch(() => {});
|
|
1318
|
-
}
|
|
1319
|
-
}
|
|
1320
|
-
}
|
|
1321
|
-
} catch {}
|
|
1322
|
-
const result = await handleContentUpdate(this.db, collection, resolvedId, {
|
|
1323
|
-
...bodyWithoutRev,
|
|
1324
|
-
data: usesDraftRevisions ? void 0 : processedData,
|
|
1325
|
-
slug: usesDraftRevisions ? void 0 : bodyWithoutRev.slug,
|
|
1326
|
-
authorId: bodyWithoutRev.authorId,
|
|
1327
|
-
bylines: bodyWithoutRev.bylines
|
|
1328
|
-
});
|
|
1329
|
-
const hydrated = await this.hydrateDraftData(result);
|
|
1330
|
-
if (hydrated.success && hydrated.data) this.runAfterSaveHooks(contentItemToRecord(hydrated.data.item), collection, false);
|
|
1331
|
-
return hydrated;
|
|
1332
|
-
}
|
|
1333
|
-
async handleContentDelete(collection, id) {
|
|
1334
|
-
if (this.hooks.hasHooks("content:beforeDelete")) {
|
|
1335
|
-
const { allowed } = await this.hooks.runContentBeforeDelete(id, collection);
|
|
1336
|
-
if (!allowed) return {
|
|
1337
|
-
success: false,
|
|
1338
|
-
error: {
|
|
1339
|
-
code: "DELETE_BLOCKED",
|
|
1340
|
-
message: "Delete blocked by plugin hook"
|
|
1341
|
-
}
|
|
1342
|
-
};
|
|
1343
|
-
}
|
|
1344
|
-
if (!await this.runSandboxedBeforeDelete(id, collection)) return {
|
|
1345
|
-
success: false,
|
|
1346
|
-
error: {
|
|
1347
|
-
code: "DELETE_BLOCKED",
|
|
1348
|
-
message: "Delete blocked by sandboxed plugin hook"
|
|
1349
|
-
}
|
|
1350
|
-
};
|
|
1351
|
-
const result = await handleContentDelete(this.db, collection, id);
|
|
1352
|
-
if (result.success) this.runAfterDeleteHooks(id, collection, false);
|
|
1353
|
-
return result;
|
|
1354
|
-
}
|
|
1355
|
-
async handleContentListTrashed(collection, params = {}) {
|
|
1356
|
-
return handleContentListTrashed(this.db, collection, params);
|
|
1357
|
-
}
|
|
1358
|
-
async handleContentRestore(collection, id) {
|
|
1359
|
-
return handleContentRestore(this.db, collection, id);
|
|
1360
|
-
}
|
|
1361
|
-
async handleContentPermanentDelete(collection, id) {
|
|
1362
|
-
const result = await handleContentPermanentDelete(this.db, collection, id);
|
|
1363
|
-
if (result.success) this.runAfterDeleteHooks(id, collection, true);
|
|
1364
|
-
return result;
|
|
1365
|
-
}
|
|
1366
|
-
async handleContentCountTrashed(collection) {
|
|
1367
|
-
return handleContentCountTrashed(this.db, collection);
|
|
1368
|
-
}
|
|
1369
|
-
async handleContentDuplicate(collection, id, authorId) {
|
|
1370
|
-
return handleContentDuplicate(this.db, collection, id, authorId);
|
|
1371
|
-
}
|
|
1372
|
-
async handleContentPublish(collection, id) {
|
|
1373
|
-
const result = await handleContentPublish(this.db, collection, id);
|
|
1374
|
-
if (result.success && result.data) this.runAfterPublishHooks(contentItemToRecord(result.data.item), collection);
|
|
1375
|
-
return result;
|
|
1376
|
-
}
|
|
1377
|
-
async handleContentUnpublish(collection, id) {
|
|
1378
|
-
const result = await handleContentUnpublish(this.db, collection, id);
|
|
1379
|
-
if (result.success && result.data) this.runAfterUnpublishHooks(contentItemToRecord(result.data.item), collection);
|
|
1380
|
-
return result;
|
|
1381
|
-
}
|
|
1382
|
-
async handleContentSchedule(collection, id, scheduledAt) {
|
|
1383
|
-
return handleContentSchedule(this.db, collection, id, scheduledAt);
|
|
1384
|
-
}
|
|
1385
|
-
async handleContentUnschedule(collection, id) {
|
|
1386
|
-
return handleContentUnschedule(this.db, collection, id);
|
|
1387
|
-
}
|
|
1388
|
-
async handleContentCountScheduled(collection) {
|
|
1389
|
-
return handleContentCountScheduled(this.db, collection);
|
|
1390
|
-
}
|
|
1391
|
-
async handleContentDiscardDraft(collection, id) {
|
|
1392
|
-
return handleContentDiscardDraft(this.db, collection, id);
|
|
1393
|
-
}
|
|
1394
|
-
async handleContentCompare(collection, id) {
|
|
1395
|
-
return handleContentCompare(this.db, collection, id);
|
|
1396
|
-
}
|
|
1397
|
-
async handleContentTranslations(collection, id) {
|
|
1398
|
-
return handleContentTranslations(this.db, collection, id);
|
|
1399
|
-
}
|
|
1400
|
-
async handleMediaList(params) {
|
|
1401
|
-
return handleMediaList(this.db, params);
|
|
1402
|
-
}
|
|
1403
|
-
async handleMediaGet(id) {
|
|
1404
|
-
return handleMediaGet(this.db, id);
|
|
1405
|
-
}
|
|
1406
|
-
async handleMediaCreate(input) {
|
|
1407
|
-
let processedInput = input;
|
|
1408
|
-
if (this.hooks.hasHooks("media:beforeUpload")) {
|
|
1409
|
-
const hookResult = await this.hooks.runMediaBeforeUpload({
|
|
1410
|
-
name: input.filename,
|
|
1411
|
-
type: input.mimeType,
|
|
1412
|
-
size: input.size || 0
|
|
1413
|
-
});
|
|
1414
|
-
processedInput = {
|
|
1415
|
-
...input,
|
|
1416
|
-
filename: hookResult.file.name,
|
|
1417
|
-
mimeType: hookResult.file.type,
|
|
1418
|
-
size: hookResult.file.size
|
|
1419
|
-
};
|
|
1420
|
-
}
|
|
1421
|
-
const result = await handleMediaCreate(this.db, processedInput);
|
|
1422
|
-
if (result.success && this.hooks.hasHooks("media:afterUpload")) {
|
|
1423
|
-
const item = result.data.item;
|
|
1424
|
-
const mediaItem = {
|
|
1425
|
-
id: item.id,
|
|
1426
|
-
filename: item.filename,
|
|
1427
|
-
mimeType: item.mimeType,
|
|
1428
|
-
size: item.size,
|
|
1429
|
-
url: `/media/${item.id}/${item.filename}`,
|
|
1430
|
-
createdAt: item.createdAt
|
|
1431
|
-
};
|
|
1432
|
-
this.hooks.runMediaAfterUpload(mediaItem).catch((err) => console.error("EmDash afterUpload hook error:", err));
|
|
1433
|
-
}
|
|
1434
|
-
return result;
|
|
1435
|
-
}
|
|
1436
|
-
async handleMediaUpdate(id, input) {
|
|
1437
|
-
return handleMediaUpdate(this.db, id, input);
|
|
1438
|
-
}
|
|
1439
|
-
async handleMediaDelete(id) {
|
|
1440
|
-
return handleMediaDelete(this.db, id);
|
|
1441
|
-
}
|
|
1442
|
-
async handleRevisionList(collection, entryId, params = {}) {
|
|
1443
|
-
return handleRevisionList(this.db, collection, entryId, params);
|
|
1444
|
-
}
|
|
1445
|
-
async handleRevisionGet(revisionId) {
|
|
1446
|
-
return handleRevisionGet(this.db, revisionId);
|
|
1447
|
-
}
|
|
1448
|
-
async handleRevisionRestore(revisionId, callerUserId) {
|
|
1449
|
-
const revisionRepo = new RevisionRepository(this.db);
|
|
1450
|
-
const revision = await revisionRepo.findById(revisionId);
|
|
1451
|
-
if (!revision) return {
|
|
1452
|
-
success: false,
|
|
1453
|
-
error: {
|
|
1454
|
-
code: "NOT_FOUND",
|
|
1455
|
-
message: `Revision not found: ${revisionId}`
|
|
1456
|
-
}
|
|
1457
|
-
};
|
|
1458
|
-
if (!((await this.schemaRegistry.getCollectionWithFields(revision.collection))?.supports?.includes("revisions") ?? false)) {
|
|
1459
|
-
const result = await handleRevisionRestore(this.db, revisionId, callerUserId);
|
|
1460
|
-
return this.hydrateDraftData(result);
|
|
1461
|
-
}
|
|
1462
|
-
try {
|
|
1463
|
-
const newDraft = await revisionRepo.create({
|
|
1464
|
-
collection: revision.collection,
|
|
1465
|
-
entryId: revision.entryId,
|
|
1466
|
-
data: revision.data,
|
|
1467
|
-
authorId: callerUserId
|
|
1468
|
-
});
|
|
1469
|
-
validateIdentifier(revision.collection, "collection");
|
|
1470
|
-
const tableName = `ec_${revision.collection}`;
|
|
1471
|
-
await sql`
|
|
1472
|
-
UPDATE ${sql.ref(tableName)}
|
|
1473
|
-
SET draft_revision_id = ${newDraft.id},
|
|
1474
|
-
updated_at = ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
1475
|
-
WHERE id = ${revision.entryId}
|
|
1476
|
-
`.execute(this.db);
|
|
1477
|
-
revisionRepo.pruneOldRevisions(revision.collection, revision.entryId, 50).catch(() => {});
|
|
1478
|
-
const refetched = await handleContentGet(this.db, revision.collection, revision.entryId);
|
|
1479
|
-
return this.hydrateDraftData(refetched);
|
|
1480
|
-
} catch (error) {
|
|
1481
|
-
console.error("[emdash] revision restore failed:", error);
|
|
1482
|
-
return {
|
|
1483
|
-
success: false,
|
|
1484
|
-
error: {
|
|
1485
|
-
code: "REVISION_RESTORE_ERROR",
|
|
1486
|
-
message: "Failed to restore revision"
|
|
1487
|
-
}
|
|
1488
|
-
};
|
|
1489
|
-
}
|
|
1490
|
-
}
|
|
1491
|
-
/**
|
|
1492
|
-
* Get route metadata for a plugin route without invoking the handler.
|
|
1493
|
-
* Used by the catch-all route to decide auth before dispatch.
|
|
1494
|
-
* Returns null if the plugin or route doesn't exist.
|
|
1495
|
-
*/
|
|
1496
|
-
getPluginRouteMeta(pluginId, path) {
|
|
1497
|
-
if (!this.isPluginEnabled(pluginId)) return null;
|
|
1498
|
-
const routeKey = path.replace(LEADING_SLASH_PATTERN, "");
|
|
1499
|
-
const trustedPlugin = this.configuredPlugins.find((p) => p.id === pluginId);
|
|
1500
|
-
if (trustedPlugin) {
|
|
1501
|
-
const route = trustedPlugin.routes[routeKey];
|
|
1502
|
-
if (!route) return null;
|
|
1503
|
-
return { public: route.public === true };
|
|
1504
|
-
}
|
|
1505
|
-
const meta = sandboxedRouteMetaCache.get(pluginId);
|
|
1506
|
-
if (meta) {
|
|
1507
|
-
const routeMeta = meta.get(routeKey);
|
|
1508
|
-
if (routeMeta) return routeMeta;
|
|
1509
|
-
}
|
|
1510
|
-
if (routeKey === "admin") {
|
|
1511
|
-
const manifestMeta = marketplaceManifestCache.get(pluginId);
|
|
1512
|
-
if (manifestMeta?.admin?.pages?.length || manifestMeta?.admin?.widgets?.length) return { public: false };
|
|
1513
|
-
const entry = this.sandboxedPluginEntries.find((e) => e.id === pluginId);
|
|
1514
|
-
if (entry?.adminPages?.length || entry?.adminWidgets?.length) return { public: false };
|
|
1515
|
-
}
|
|
1516
|
-
if (this.findSandboxedPlugin(pluginId)) return { public: false };
|
|
1517
|
-
return null;
|
|
1518
|
-
}
|
|
1519
|
-
async handlePluginApiRoute(pluginId, _method, path, request) {
|
|
1520
|
-
if (!this.isPluginEnabled(pluginId)) return {
|
|
1521
|
-
success: false,
|
|
1522
|
-
error: {
|
|
1523
|
-
code: "NOT_FOUND",
|
|
1524
|
-
message: `Plugin not enabled: ${pluginId}`
|
|
1525
|
-
}
|
|
1526
|
-
};
|
|
1527
|
-
const trustedPlugin = this.configuredPlugins.find((p) => p.id === pluginId);
|
|
1528
|
-
if (trustedPlugin && this.enabledPlugins.has(trustedPlugin.id)) {
|
|
1529
|
-
const routeRegistry = new PluginRouteRegistry({
|
|
1530
|
-
db: this.db,
|
|
1531
|
-
emailPipeline: this.email ?? void 0,
|
|
1532
|
-
trustedProxyHeaders: getTrustedProxyHeaders(this.config)
|
|
1533
|
-
});
|
|
1534
|
-
routeRegistry.register(trustedPlugin);
|
|
1535
|
-
const routeKey = path.replace(LEADING_SLASH_PATTERN, "");
|
|
1536
|
-
let body = void 0;
|
|
1537
|
-
try {
|
|
1538
|
-
body = await request.json();
|
|
1539
|
-
} catch {}
|
|
1540
|
-
return routeRegistry.invoke(pluginId, routeKey, {
|
|
1541
|
-
request,
|
|
1542
|
-
body
|
|
1543
|
-
});
|
|
1544
|
-
}
|
|
1545
|
-
const sandboxedPlugin = this.findSandboxedPlugin(pluginId);
|
|
1546
|
-
if (sandboxedPlugin) return this.handleSandboxedRoute(sandboxedPlugin, path, request);
|
|
1547
|
-
return {
|
|
1548
|
-
success: false,
|
|
1549
|
-
error: {
|
|
1550
|
-
code: "NOT_FOUND",
|
|
1551
|
-
message: `Plugin not found: ${pluginId}`
|
|
1552
|
-
}
|
|
1553
|
-
};
|
|
1554
|
-
}
|
|
1555
|
-
findSandboxedPlugin(pluginId) {
|
|
1556
|
-
for (const [key, plugin] of this.sandboxedPlugins) if (key.startsWith(pluginId + ":")) return plugin;
|
|
1557
|
-
}
|
|
1558
|
-
/**
|
|
1559
|
-
* Normalize image/file fields in content data.
|
|
1560
|
-
* Fills missing dimensions, storageKey, mimeType, and filename from providers.
|
|
1561
|
-
*/
|
|
1562
|
-
async normalizeMediaFields(collection, data) {
|
|
1563
|
-
let collectionInfo;
|
|
1564
|
-
try {
|
|
1565
|
-
collectionInfo = await this.schemaRegistry.getCollectionWithFields(collection);
|
|
1566
|
-
} catch {
|
|
1567
|
-
return data;
|
|
1568
|
-
}
|
|
1569
|
-
if (!collectionInfo?.fields) return data;
|
|
1570
|
-
const imageFields = collectionInfo.fields.filter((f) => f.type === "image" || f.type === "file");
|
|
1571
|
-
if (imageFields.length === 0) return data;
|
|
1572
|
-
const getProvider = (id) => this.getMediaProvider(id);
|
|
1573
|
-
const result = { ...data };
|
|
1574
|
-
for (const field of imageFields) {
|
|
1575
|
-
const value = result[field.slug];
|
|
1576
|
-
if (value == null) continue;
|
|
1577
|
-
try {
|
|
1578
|
-
const normalized = await normalizeMediaValue(value, getProvider);
|
|
1579
|
-
if (normalized) result[field.slug] = normalized;
|
|
1580
|
-
} catch {}
|
|
1581
|
-
}
|
|
1582
|
-
return result;
|
|
1583
|
-
}
|
|
1584
|
-
async runSandboxedBeforeSave(content, collection, isNew) {
|
|
1585
|
-
let result = content;
|
|
1586
|
-
for (const [pluginKey, plugin] of this.sandboxedPlugins) {
|
|
1587
|
-
const [id] = pluginKey.split(":");
|
|
1588
|
-
if (!id || !this.isPluginEnabled(id)) continue;
|
|
1589
|
-
try {
|
|
1590
|
-
const hookResult = await plugin.invokeHook("content:beforeSave", {
|
|
1591
|
-
content: result,
|
|
1592
|
-
collection,
|
|
1593
|
-
isNew
|
|
1594
|
-
});
|
|
1595
|
-
if (hookResult && typeof hookResult === "object" && !Array.isArray(hookResult)) {
|
|
1596
|
-
const record = {};
|
|
1597
|
-
for (const [k, v] of Object.entries(hookResult)) record[k] = v;
|
|
1598
|
-
result = record;
|
|
1599
|
-
}
|
|
1600
|
-
} catch (error) {
|
|
1601
|
-
console.error(`EmDash: Sandboxed plugin ${id} beforeSave hook error:`, error);
|
|
1602
|
-
}
|
|
1603
|
-
}
|
|
1604
|
-
return result;
|
|
1605
|
-
}
|
|
1606
|
-
async runSandboxedBeforeDelete(id, collection) {
|
|
1607
|
-
for (const [pluginKey, plugin] of this.sandboxedPlugins) {
|
|
1608
|
-
const [pluginId] = pluginKey.split(":");
|
|
1609
|
-
if (!pluginId || !this.isPluginEnabled(pluginId)) continue;
|
|
1610
|
-
try {
|
|
1611
|
-
if (await plugin.invokeHook("content:beforeDelete", {
|
|
1612
|
-
id,
|
|
1613
|
-
collection
|
|
1614
|
-
}) === false) return false;
|
|
1615
|
-
} catch (error) {
|
|
1616
|
-
console.error(`EmDash: Sandboxed plugin ${pluginId} beforeDelete hook error:`, error);
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
return true;
|
|
1620
|
-
}
|
|
1621
|
-
runAfterSaveHooks(content, collection, isNew) {
|
|
1622
|
-
after(async () => {
|
|
1623
|
-
if (this.hooks.hasHooks("content:afterSave")) try {
|
|
1624
|
-
await this.hooks.runContentAfterSave(content, collection, isNew);
|
|
1625
|
-
} catch (err) {
|
|
1626
|
-
console.error("EmDash afterSave hook error:", err);
|
|
1627
|
-
}
|
|
1628
|
-
const tasks = [];
|
|
1629
|
-
for (const [pluginKey, plugin] of this.sandboxedPlugins) {
|
|
1630
|
-
const [id] = pluginKey.split(":");
|
|
1631
|
-
if (!id || !this.isPluginEnabled(id)) continue;
|
|
1632
|
-
tasks.push((async () => {
|
|
1633
|
-
try {
|
|
1634
|
-
await plugin.invokeHook("content:afterSave", {
|
|
1635
|
-
content,
|
|
1636
|
-
collection,
|
|
1637
|
-
isNew
|
|
1638
|
-
});
|
|
1639
|
-
} catch (err) {
|
|
1640
|
-
console.error(`EmDash: Sandboxed plugin ${id} afterSave error:`, err);
|
|
1641
|
-
}
|
|
1642
|
-
})());
|
|
1643
|
-
}
|
|
1644
|
-
await Promise.allSettled(tasks);
|
|
1645
|
-
});
|
|
1646
|
-
}
|
|
1647
|
-
runAfterDeleteHooks(id, collection, permanent) {
|
|
1648
|
-
if (this.hooks.hasHooks("content:afterDelete")) this.hooks.runContentAfterDelete(id, collection, permanent).catch((err) => console.error("EmDash afterDelete hook error:", err));
|
|
1649
|
-
for (const [pluginKey, plugin] of this.sandboxedPlugins) {
|
|
1650
|
-
const [pluginId] = pluginKey.split(":");
|
|
1651
|
-
if (!pluginId || !this.isPluginEnabled(pluginId)) continue;
|
|
1652
|
-
plugin.invokeHook("content:afterDelete", {
|
|
1653
|
-
id,
|
|
1654
|
-
collection,
|
|
1655
|
-
permanent
|
|
1656
|
-
}).catch((err) => console.error(`EmDash: Sandboxed plugin ${pluginId} afterDelete error:`, err));
|
|
1657
|
-
}
|
|
1658
|
-
}
|
|
1659
|
-
runAfterPublishHooks(content, collection) {
|
|
1660
|
-
after(async () => {
|
|
1661
|
-
if (this.hooks.hasHooks("content:afterPublish")) try {
|
|
1662
|
-
await this.hooks.runContentAfterPublish(content, collection);
|
|
1663
|
-
} catch (err) {
|
|
1664
|
-
console.error("EmDash afterPublish hook error:", err);
|
|
1665
|
-
}
|
|
1666
|
-
const tasks = [];
|
|
1667
|
-
for (const [pluginKey, plugin] of this.sandboxedPlugins) {
|
|
1668
|
-
const [pluginId] = pluginKey.split(":");
|
|
1669
|
-
if (!pluginId || !this.isPluginEnabled(pluginId)) continue;
|
|
1670
|
-
tasks.push((async () => {
|
|
1671
|
-
try {
|
|
1672
|
-
await plugin.invokeHook("content:afterPublish", {
|
|
1673
|
-
content,
|
|
1674
|
-
collection
|
|
1675
|
-
});
|
|
1676
|
-
} catch (err) {
|
|
1677
|
-
console.error(`EmDash: Sandboxed plugin ${pluginId} afterPublish error:`, err);
|
|
1678
|
-
}
|
|
1679
|
-
})());
|
|
1680
|
-
}
|
|
1681
|
-
await Promise.allSettled(tasks);
|
|
1682
|
-
});
|
|
1683
|
-
}
|
|
1684
|
-
runAfterUnpublishHooks(content, collection) {
|
|
1685
|
-
if (this.hooks.hasHooks("content:afterUnpublish")) this.hooks.runContentAfterUnpublish(content, collection).catch((err) => console.error("EmDash afterUnpublish hook error:", err));
|
|
1686
|
-
for (const [pluginKey, plugin] of this.sandboxedPlugins) {
|
|
1687
|
-
const [pluginId] = pluginKey.split(":");
|
|
1688
|
-
if (!pluginId || !this.isPluginEnabled(pluginId)) continue;
|
|
1689
|
-
plugin.invokeHook("content:afterUnpublish", {
|
|
1690
|
-
content,
|
|
1691
|
-
collection
|
|
1692
|
-
}).catch((err) => console.error(`EmDash: Sandboxed plugin ${pluginId} afterUnpublish error:`, err));
|
|
1693
|
-
}
|
|
1694
|
-
}
|
|
1695
|
-
async handleSandboxedRoute(plugin, path, request) {
|
|
1696
|
-
const routeName = path.replace(LEADING_SLASH_PATTERN, "");
|
|
1697
|
-
let body = void 0;
|
|
1698
|
-
try {
|
|
1699
|
-
body = await request.json();
|
|
1700
|
-
} catch {}
|
|
1701
|
-
try {
|
|
1702
|
-
const headers = sanitizeHeadersForSandbox(request.headers);
|
|
1703
|
-
const meta = extractRequestMeta(request, this.config);
|
|
1704
|
-
return {
|
|
1705
|
-
success: true,
|
|
1706
|
-
data: await plugin.invokeRoute(routeName, body, {
|
|
1707
|
-
url: request.url,
|
|
1708
|
-
method: request.method,
|
|
1709
|
-
headers,
|
|
1710
|
-
meta
|
|
1711
|
-
})
|
|
1712
|
-
};
|
|
1713
|
-
} catch (error) {
|
|
1714
|
-
console.error(`EmDash: Sandboxed plugin route error:`, error);
|
|
1715
|
-
return {
|
|
1716
|
-
success: false,
|
|
1717
|
-
error: {
|
|
1718
|
-
code: "ROUTE_ERROR",
|
|
1719
|
-
message: error instanceof Error ? error.message : String(error)
|
|
1720
|
-
}
|
|
1721
|
-
};
|
|
1722
|
-
}
|
|
1723
|
-
}
|
|
1724
|
-
/**
|
|
1725
|
-
* Cache for page contributions. Uses a WeakMap keyed on the PublicPageContext
|
|
1726
|
-
* object so results are collected once per page context per request, even when
|
|
1727
|
-
* multiple render components (EmDashHead, EmDashBodyStart, EmDashBodyEnd)
|
|
1728
|
-
* request contributions from the same page.
|
|
1729
|
-
*/
|
|
1730
|
-
pageContributionCache = /* @__PURE__ */ new WeakMap();
|
|
1731
|
-
/**
|
|
1732
|
-
* Collect all page contributions (metadata + fragments) in a single pass.
|
|
1733
|
-
* Results are cached by page context object identity.
|
|
1734
|
-
*/
|
|
1735
|
-
async collectPageContributions(page) {
|
|
1736
|
-
const cached = this.pageContributionCache.get(page);
|
|
1737
|
-
if (cached) return cached;
|
|
1738
|
-
const promise = this.doCollectPageContributions(page);
|
|
1739
|
-
this.pageContributionCache.set(page, promise);
|
|
1740
|
-
return promise;
|
|
1741
|
-
}
|
|
1742
|
-
async doCollectPageContributions(page) {
|
|
1743
|
-
const metadata = [];
|
|
1744
|
-
const fragments = [];
|
|
1745
|
-
if (this.hooks.hasHooks("page:metadata")) {
|
|
1746
|
-
const results = await this.hooks.runPageMetadata({ page });
|
|
1747
|
-
for (const r of results) metadata.push(...r.contributions);
|
|
1748
|
-
}
|
|
1749
|
-
if (this.hooks.hasHooks("page:fragments")) {
|
|
1750
|
-
const results = await this.hooks.runPageFragments({ page });
|
|
1751
|
-
for (const r of results) fragments.push(...r.contributions);
|
|
1752
|
-
}
|
|
1753
|
-
for (const [pluginKey, plugin] of this.sandboxedPlugins) {
|
|
1754
|
-
const [id] = pluginKey.split(":");
|
|
1755
|
-
if (!id || !this.isPluginEnabled(id)) continue;
|
|
1756
|
-
try {
|
|
1757
|
-
const result = await plugin.invokeHook("page:metadata", { page });
|
|
1758
|
-
if (result != null) {
|
|
1759
|
-
const items = Array.isArray(result) ? result : [result];
|
|
1760
|
-
for (const item of items) if (isValidMetadataContribution(item)) metadata.push(item);
|
|
1761
|
-
}
|
|
1762
|
-
} catch (error) {
|
|
1763
|
-
console.error(`EmDash: Sandboxed plugin ${id} page:metadata error:`, error);
|
|
1764
|
-
}
|
|
1765
|
-
}
|
|
1766
|
-
return {
|
|
1767
|
-
metadata,
|
|
1768
|
-
fragments
|
|
1769
|
-
};
|
|
1770
|
-
}
|
|
1771
|
-
/**
|
|
1772
|
-
* Collect page metadata contributions from trusted and sandboxed plugins.
|
|
1773
|
-
* Delegates to the single-pass collector and returns the metadata portion.
|
|
1774
|
-
*/
|
|
1775
|
-
async collectPageMetadata(page) {
|
|
1776
|
-
const { metadata } = await this.collectPageContributions(page);
|
|
1777
|
-
return metadata;
|
|
1778
|
-
}
|
|
1779
|
-
/**
|
|
1780
|
-
* Collect page fragment contributions from trusted plugins only.
|
|
1781
|
-
* Delegates to the single-pass collector and returns the fragments portion.
|
|
1782
|
-
*/
|
|
1783
|
-
async collectPageFragments(page) {
|
|
1784
|
-
const { fragments } = await this.collectPageContributions(page);
|
|
1785
|
-
return fragments;
|
|
1786
|
-
}
|
|
1787
|
-
isPluginEnabled(pluginId) {
|
|
1788
|
-
const status = this.pluginStates.get(pluginId);
|
|
1789
|
-
return status === void 0 || status === "active";
|
|
397
|
+
async function prefetchLayoutData() {
|
|
398
|
+
try {
|
|
399
|
+
await Promise.allSettled([
|
|
400
|
+
getSiteSettings(),
|
|
401
|
+
prefetchMenus(),
|
|
402
|
+
prefetchWidgetAreas(),
|
|
403
|
+
prefetchTaxonomyTerms()
|
|
404
|
+
]);
|
|
405
|
+
} catch (error) {
|
|
406
|
+
console.error("[emdash] layout prefetch failed (non-fatal):", error);
|
|
1790
407
|
}
|
|
1791
|
-
}
|
|
408
|
+
}
|
|
1792
409
|
|
|
1793
410
|
//#endregion
|
|
1794
|
-
//#region src/
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
return `/_emdash/api/media/file/${storageKey}`;
|
|
411
|
+
//#region src/astro/public-plugin-api-routes.ts
|
|
412
|
+
function pluginRouteNotFound() {
|
|
413
|
+
return {
|
|
414
|
+
success: false,
|
|
415
|
+
error: {
|
|
416
|
+
code: "NOT_FOUND",
|
|
417
|
+
message: "Plugin route not found"
|
|
418
|
+
}
|
|
419
|
+
};
|
|
1804
420
|
}
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
*/
|
|
1811
|
-
function createPublicMediaUrlResolver(storage) {
|
|
1812
|
-
return (key) => resolvePublicMediaUrl(storage, key);
|
|
421
|
+
function createPublicPluginApiRouteHandler(runtime) {
|
|
422
|
+
return async (pluginId, method, path, request) => {
|
|
423
|
+
if (runtime.getPluginRouteMeta(pluginId, path)?.public !== true) return pluginRouteNotFound();
|
|
424
|
+
return runtime.handlePluginApiRoute(pluginId, method, path, request);
|
|
425
|
+
};
|
|
1813
426
|
}
|
|
1814
427
|
|
|
1815
428
|
//#endregion
|
|
1816
429
|
//#region src/astro/middleware.ts
|
|
1817
430
|
/**
|
|
1818
|
-
*
|
|
1819
|
-
*
|
|
1820
|
-
*
|
|
1821
|
-
*
|
|
431
|
+
* Runtime init lock reclaim deadline. Must be strictly larger than the db
|
|
432
|
+
* init deadline: this lock wraps EmDashRuntime.create() → getDatabase() →
|
|
433
|
+
* the db init lock, and equal deadlines would let this outer lock reclaim
|
|
434
|
+
* (spawning a second cron scheduler and sandbox runner) while the inner db
|
|
435
|
+
* init is legitimately still working through a contended migration.
|
|
1822
436
|
*/
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
437
|
+
const RUNTIME_INIT_DEADLINE_MS = DB_INIT_DEADLINE_MS + 15e3;
|
|
438
|
+
/**
|
|
439
|
+
* Throttle for the anonymous-path runtime-init failure log. While a site is
|
|
440
|
+
* stuck (e.g. a failing migration in its backoff window, #1744) every
|
|
441
|
+
* anonymous request lands in that catch; one line per interval per isolate
|
|
442
|
+
* keeps the failure visible without flooding logs on a busy site. Plain
|
|
443
|
+
* module state (not globalThis): a duplicated SSR chunk just means an extra
|
|
444
|
+
* log line, which is harmless.
|
|
445
|
+
*/
|
|
446
|
+
const RUNTIME_INIT_ERROR_LOG_INTERVAL_MS = 3e4;
|
|
447
|
+
let lastRuntimeInitErrorLogAt = 0;
|
|
1827
448
|
/**
|
|
1828
449
|
* Whether we've verified the database has been set up.
|
|
1829
450
|
* On a fresh deployment the first request may hit a public page, bypassing
|
|
@@ -1831,8 +452,43 @@ let i18nInitialized = false;
|
|
|
1831
452
|
* would query an empty database and crash. Once verified (or once the runtime
|
|
1832
453
|
* has initialized via an admin/API request), this stays true for the worker's
|
|
1833
454
|
* lifetime.
|
|
455
|
+
*
|
|
456
|
+
* Stored on globalThis behind a Symbol key so the flag is a true singleton
|
|
457
|
+
* even when the bundler duplicates this module across SSR chunks (same
|
|
458
|
+
* pattern as request-cache.ts). A plain module-scoped `let` becomes multiple
|
|
459
|
+
* independent variables, which would make the setup probe re-run far more
|
|
460
|
+
* often than intended — and every re-run is another chance for a transient
|
|
461
|
+
* DB error to be misread as "fresh install" and bounce visitors to setup.
|
|
1834
462
|
*/
|
|
1835
|
-
|
|
463
|
+
const SETUP_VERIFIED_KEY = Symbol.for("emdash:setup-verified");
|
|
464
|
+
const setupFlagStore = globalThis;
|
|
465
|
+
function isSetupVerified() {
|
|
466
|
+
return setupFlagStore[SETUP_VERIFIED_KEY] === true;
|
|
467
|
+
}
|
|
468
|
+
function markSetupVerified() {
|
|
469
|
+
setupFlagStore[SETUP_VERIFIED_KEY] = true;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* The runtime singleton and its init lock live on globalThis behind a
|
|
473
|
+
* Symbol — same reasoning as SETUP_VERIFIED_KEY above: the bundler can
|
|
474
|
+
* duplicate this module across SSR chunks, and a duplicated instance/lock
|
|
475
|
+
* would mean multiple runtimes (each with its own cron scheduler) per
|
|
476
|
+
* isolate, initializing and reclaiming independently.
|
|
477
|
+
*/
|
|
478
|
+
const RUNTIME_HOLDER_KEY = Symbol.for("emdash:runtime-holder");
|
|
479
|
+
function getRuntimeHolder() {
|
|
480
|
+
let holder = setupFlagStore[RUNTIME_HOLDER_KEY];
|
|
481
|
+
if (!holder) {
|
|
482
|
+
holder = {
|
|
483
|
+
instance: null,
|
|
484
|
+
lock: createInitLock()
|
|
485
|
+
};
|
|
486
|
+
setupFlagStore[RUNTIME_HOLDER_KEY] = holder;
|
|
487
|
+
}
|
|
488
|
+
return holder;
|
|
489
|
+
}
|
|
490
|
+
/** Whether i18n config has been initialized from the virtual module */
|
|
491
|
+
let i18nInitialized = false;
|
|
1836
492
|
/**
|
|
1837
493
|
* Get EmDash configuration from virtual module
|
|
1838
494
|
*/
|
|
@@ -1857,15 +513,20 @@ function getPlugins() {
|
|
|
1857
513
|
/**
|
|
1858
514
|
* Build runtime dependencies from virtual modules
|
|
1859
515
|
*/
|
|
1860
|
-
function buildDependencies(config) {
|
|
516
|
+
function buildDependencies(config, migrationMode) {
|
|
517
|
+
const sandboxModule = virtualSandboxRunnerModule;
|
|
1861
518
|
return {
|
|
1862
519
|
config,
|
|
520
|
+
migrationMode,
|
|
1863
521
|
plugins: getPlugins(),
|
|
1864
522
|
createDialect,
|
|
523
|
+
createCoalescingDialect,
|
|
1865
524
|
createStorage,
|
|
1866
|
-
|
|
525
|
+
createScheduler,
|
|
526
|
+
sandboxEnabled: sandboxModule.sandboxEnabled,
|
|
527
|
+
sandboxBypassed: sandboxModule.sandboxBypassed ?? false,
|
|
1867
528
|
sandboxedPluginEntries: sandboxedPlugins || [],
|
|
1868
|
-
createSandboxRunner,
|
|
529
|
+
createSandboxRunner: sandboxModule.createSandboxRunner,
|
|
1869
530
|
mediaProviderEntries: mediaProviders || []
|
|
1870
531
|
};
|
|
1871
532
|
}
|
|
@@ -1877,29 +538,202 @@ function buildDependencies(config) {
|
|
|
1877
538
|
* cached instance) push nothing — callers should treat an empty array
|
|
1878
539
|
* as "warm, nothing to report".
|
|
1879
540
|
*/
|
|
1880
|
-
async function getRuntime(config, initTimings) {
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
return getRuntime(config, initTimings);
|
|
1885
|
-
}
|
|
1886
|
-
runtimeInitializing = true;
|
|
1887
|
-
try {
|
|
1888
|
-
const deps = buildDependencies(config);
|
|
541
|
+
async function getRuntime(config, migrationMode, initTimings) {
|
|
542
|
+
const holder = getRuntimeHolder();
|
|
543
|
+
return initWithLock(holder.lock, () => holder.instance, async (isCurrentClaim) => {
|
|
544
|
+
const deps = buildDependencies(config, migrationMode);
|
|
1889
545
|
const runtime = await EmDashRuntime.create(deps, initTimings);
|
|
1890
|
-
|
|
546
|
+
if (isCurrentClaim()) holder.instance = runtime;
|
|
547
|
+
else runtime.stopCron().catch((error) => {
|
|
548
|
+
console.error("[emdash] failed to stop superseded runtime's cron:", error);
|
|
549
|
+
});
|
|
1891
550
|
return runtime;
|
|
551
|
+
}, {
|
|
552
|
+
deadlineMs: RUNTIME_INIT_DEADLINE_MS,
|
|
553
|
+
anchor: (promise) => after(() => promise)
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Run scheduled maintenance (cron tasks, scheduled publishing, system cleanup)
|
|
558
|
+
* outside any request. Resolves the runtime from the build-time virtual config
|
|
559
|
+
* and the cached singleton — the same instance request handlers use.
|
|
560
|
+
*
|
|
561
|
+
* Wired into a platform heartbeat that is not a request: the Cloudflare Worker's
|
|
562
|
+
* `scheduled()` handler (Cron Trigger) calls this. On Node the runtime's own
|
|
563
|
+
* timer-based scheduler already drives the same work, so this isn't needed there.
|
|
564
|
+
*
|
|
565
|
+
* Returns the content promoted by the publishing sweep so the caller can purge
|
|
566
|
+
* edge-cache tags for it. `onPublished` (optional) is awaited after each
|
|
567
|
+
* collection's batch so the caller can invalidate edge-cache tags incrementally
|
|
568
|
+
* rather than only after the whole sweep.
|
|
569
|
+
*/
|
|
570
|
+
async function runScheduledTasks(options = {}) {
|
|
571
|
+
const config = getConfig();
|
|
572
|
+
if (!config) return { published: [] };
|
|
573
|
+
return runOutsideRequest(config, (runtime) => runtime.runScheduledTasks(options));
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Run a callback against the EmDash runtime outside any HTTP request — from a
|
|
577
|
+
* Cloudflare Queue consumer, a `scheduled()` handler, or any other
|
|
578
|
+
* platform-event handler that has no request and therefore no `locals.emdash`.
|
|
579
|
+
*
|
|
580
|
+
* Resolves the same cached runtime singleton request handlers use, so hooks,
|
|
581
|
+
* plugin state, and storage all behave exactly as they do during a request.
|
|
582
|
+
* A typical queue consumer finishes a job by calling back into a plugin route:
|
|
583
|
+
*
|
|
584
|
+
* ```ts
|
|
585
|
+
* import { withEmDashRuntime } from "emdash/middleware";
|
|
586
|
+
*
|
|
587
|
+
* async function queue(batch: MessageBatch) {
|
|
588
|
+
* await withEmDashRuntime(async (runtime) => {
|
|
589
|
+
* for (const message of batch.messages) {
|
|
590
|
+
* await runtime.handlePluginApiRoute(
|
|
591
|
+
* "my-plugin",
|
|
592
|
+
* "POST",
|
|
593
|
+
* "/finishJob",
|
|
594
|
+
* new Request("https://internal/", {
|
|
595
|
+
* method: "POST",
|
|
596
|
+
* body: JSON.stringify(message.body),
|
|
597
|
+
* }),
|
|
598
|
+
* );
|
|
599
|
+
* }
|
|
600
|
+
* });
|
|
601
|
+
* }
|
|
602
|
+
* ```
|
|
603
|
+
*
|
|
604
|
+
* Server-only and fully trusted: the callback gets the raw runtime with no
|
|
605
|
+
* auth or CSRF checks, same trust level as plugin cron. Never expose it to
|
|
606
|
+
* user input without validating that input yourself.
|
|
607
|
+
*
|
|
608
|
+
* Throws when EmDash is not configured (no `emdash()` Astro integration).
|
|
609
|
+
*/
|
|
610
|
+
async function withEmDashRuntime(run) {
|
|
611
|
+
const config = getConfig();
|
|
612
|
+
if (!config) throw new Error("EmDash is not configured — withEmDashRuntime() requires the emdash() Astro integration.");
|
|
613
|
+
return runOutsideRequest(config, async (runtime) => run(runtime));
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Shared plumbing for request-free entry points (`runScheduledTasks`,
|
|
617
|
+
* `withEmDashRuntime`): resolve the runtime singleton, then run the callback
|
|
618
|
+
* under an event-scoped db when the adapter needs one.
|
|
619
|
+
*
|
|
620
|
+
* Connection-backed adapters (e.g. Postgres over Hyperdrive) cannot reuse
|
|
621
|
+
* the per-isolate singleton from a platform event: its socket belongs to the
|
|
622
|
+
* request that opened it, and workerd rejects cross-event I/O. Open an
|
|
623
|
+
* event-scoped connection and run the callback under it in ALS — the
|
|
624
|
+
* runtime's db getter, the cron executor, and plugin contexts all resolve
|
|
625
|
+
* the connection from ALS — then close it when required. Stateless adapters
|
|
626
|
+
* that need primary routing can return a close-less scope; adapters with no
|
|
627
|
+
* event scoping return null and keep using the singleton.
|
|
628
|
+
*/
|
|
629
|
+
async function runOutsideRequest(config, fn) {
|
|
630
|
+
const migrationMode = resolveConfiguredMigrationMode(config);
|
|
631
|
+
if (getRequestContext()) return runOutsideRequestWithRuntime(config, await getRuntime(config, migrationMode), fn);
|
|
632
|
+
const deferredTasks = createDeferredTaskTracker(() => {});
|
|
633
|
+
return runWithContext({
|
|
634
|
+
editMode: false,
|
|
635
|
+
metrics: createRequestMetrics(performance.now()),
|
|
636
|
+
deferredTasks
|
|
637
|
+
}, async () => {
|
|
638
|
+
return runOutsideRequestWithRuntime(config, await (async () => {
|
|
639
|
+
try {
|
|
640
|
+
return await getRuntime(config, migrationMode);
|
|
641
|
+
} finally {
|
|
642
|
+
deferredTasks.settle();
|
|
643
|
+
await deferredTasks.settled;
|
|
644
|
+
}
|
|
645
|
+
})(), fn);
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
async function runOutsideRequestWithRuntime(config, runtime, fn) {
|
|
649
|
+
const scoped = createRequestScopedDb$1({
|
|
650
|
+
config: config.database?.config,
|
|
651
|
+
isAuthenticated: false,
|
|
652
|
+
isWrite: true,
|
|
653
|
+
canUseCachedBinding: false,
|
|
654
|
+
cookies: NOOP_COOKIE_JAR,
|
|
655
|
+
url: CRON_EVENT_URL
|
|
656
|
+
});
|
|
657
|
+
if (!scoped) return fn(runtime);
|
|
658
|
+
const { closed, deferredTasks, lifecycle } = coordinateScopedDbLifecycle(scoped);
|
|
659
|
+
const parent = getRequestContext();
|
|
660
|
+
const ctx = parent ? {
|
|
661
|
+
...parent,
|
|
662
|
+
db: scoped.db,
|
|
663
|
+
deferredTasks
|
|
664
|
+
} : {
|
|
665
|
+
editMode: false,
|
|
666
|
+
db: scoped.db,
|
|
667
|
+
metrics: createRequestMetrics(performance.now()),
|
|
668
|
+
deferredTasks
|
|
669
|
+
};
|
|
670
|
+
try {
|
|
671
|
+
return await runWithContext(ctx, () => fn(runtime));
|
|
1892
672
|
} finally {
|
|
1893
|
-
|
|
673
|
+
try {
|
|
674
|
+
lifecycle.commit();
|
|
675
|
+
} catch (error) {
|
|
676
|
+
console.error("[emdash] event-scoped db commit failed:", error);
|
|
677
|
+
}
|
|
678
|
+
try {
|
|
679
|
+
lifecycle.close?.();
|
|
680
|
+
} catch (error) {
|
|
681
|
+
console.error("[emdash] event-scoped db close failed:", error);
|
|
682
|
+
}
|
|
683
|
+
await closed;
|
|
1894
684
|
}
|
|
1895
685
|
}
|
|
1896
686
|
/**
|
|
1897
|
-
*
|
|
1898
|
-
*
|
|
1899
|
-
*
|
|
1900
|
-
*
|
|
687
|
+
* A cookie jar that reads nothing and writes nothing, for request-scoped db
|
|
688
|
+
* adapters invoked outside an HTTP request (the Cron Trigger sweep). Connection
|
|
689
|
+
* adapters like Hyperdrive ignore cookies entirely; the D1 session adapter
|
|
690
|
+
* reads/writes a bookmark cookie, but cron never reaches that path (it has no
|
|
691
|
+
* `close()`), so the no-ops are never observed.
|
|
1901
692
|
*/
|
|
1902
|
-
const
|
|
693
|
+
const NOOP_COOKIE_JAR = {
|
|
694
|
+
get: () => void 0,
|
|
695
|
+
set: () => {}
|
|
696
|
+
};
|
|
697
|
+
/**
|
|
698
|
+
* Synthetic URL for the cron sweep's request-scoped db opts. Only the D1
|
|
699
|
+
* session adapter inspects `url` (for cookie `secure`), and cron doesn't take
|
|
700
|
+
* that path, so the value is never used — it exists to satisfy the contract.
|
|
701
|
+
*/
|
|
702
|
+
const CRON_EVENT_URL = new URL("https://cron.emdash.internal/");
|
|
703
|
+
function resolveConfiguredMigrationMode(config) {
|
|
704
|
+
const processOverride = typeof process !== "undefined" && process.env ? process.env.EMDASH_MIGRATIONS_MODE : void 0;
|
|
705
|
+
const importMetaOverride = import.meta.env.EMDASH_MIGRATIONS_MODE;
|
|
706
|
+
return resolveRuntimeMigrationMode(config.migrations, {
|
|
707
|
+
dev: import.meta.env.DEV,
|
|
708
|
+
override: processOverride ?? importMetaOverride
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
function pendingMigrationsResponse(error) {
|
|
712
|
+
console.error("[emdash] database migrations are pending:", error.pending.join(", "));
|
|
713
|
+
return migrationRequiredResponse();
|
|
714
|
+
}
|
|
715
|
+
function migrationRequiredResponse() {
|
|
716
|
+
return new Response("Database migrations are required. Apply the deployment migration manifest and retry.", {
|
|
717
|
+
status: 503,
|
|
718
|
+
headers: { "Retry-After": "60" }
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
function unmigratedDatabaseResponse() {
|
|
722
|
+
return new Response("<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"><meta name=\"robots\" content=\"noindex\"><title>Site unavailable</title></head><body><p>This site's database has not been migrated yet. <a href=\"/_emdash/admin/setup\">Set up EmDash</a></p></body></html>", {
|
|
723
|
+
status: 503,
|
|
724
|
+
headers: {
|
|
725
|
+
"Content-Type": "text/html; charset=utf-8",
|
|
726
|
+
"Cache-Control": "no-store",
|
|
727
|
+
"Retry-After": "60"
|
|
728
|
+
}
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
function runtimeConfigurationErrorResponse(error, pathname) {
|
|
732
|
+
if (!pathname.startsWith("/_emdash/api/")) return null;
|
|
733
|
+
if (error instanceof EmDashConfigurationError) return apiError(error.code, error.message, 500);
|
|
734
|
+
if (error instanceof EmDashStorageError && error.code === "BINDING_NOT_FOUND") return apiError(error.code, error.message, 500);
|
|
735
|
+
return null;
|
|
736
|
+
}
|
|
1903
737
|
/**
|
|
1904
738
|
* Baseline security headers applied to all responses.
|
|
1905
739
|
* Admin routes get additional headers (strict CSP) from auth middleware.
|
|
@@ -1908,9 +742,9 @@ function finalizeResponse(response, serverTimings) {
|
|
|
1908
742
|
const res = new Response(response.body, response);
|
|
1909
743
|
const astroCookies = Reflect.get(response, ASTRO_COOKIES_SYMBOL);
|
|
1910
744
|
if (astroCookies !== void 0) Reflect.set(res, ASTRO_COOKIES_SYMBOL, astroCookies);
|
|
1911
|
-
res.headers.set("X-Content-Type-Options", "nosniff");
|
|
1912
|
-
res.headers.set("Referrer-Policy", "strict-origin-when-cross-origin");
|
|
1913
|
-
res.headers.set("Permissions-Policy", "camera=(), microphone=(), geolocation=(), payment=()");
|
|
745
|
+
if (!res.headers.has("X-Content-Type-Options")) res.headers.set("X-Content-Type-Options", "nosniff");
|
|
746
|
+
if (!res.headers.has("Referrer-Policy")) res.headers.set("Referrer-Policy", "strict-origin-when-cross-origin");
|
|
747
|
+
if (!res.headers.has("Permissions-Policy")) res.headers.set("Permissions-Policy", "camera=(), microphone=(), geolocation=(), payment=()");
|
|
1914
748
|
if (!res.headers.has("Content-Security-Policy")) res.headers.set("X-Frame-Options", "SAMEORIGIN");
|
|
1915
749
|
if (serverTimings && serverTimings.length > 0) res.headers.set("Server-Timing", serverTimings.map((t) => {
|
|
1916
750
|
const dur = Math.round(t.dur);
|
|
@@ -1918,6 +752,54 @@ function finalizeResponse(response, serverTimings) {
|
|
|
1918
752
|
}).join(", "));
|
|
1919
753
|
return res;
|
|
1920
754
|
}
|
|
755
|
+
/**
|
|
756
|
+
* Append always-on counters (db.*, cache.*) to the Server-Timing list.
|
|
757
|
+
*
|
|
758
|
+
* dur values for `count`, `hit`, `miss` are integer counts — Server-Timing
|
|
759
|
+
* spec only models milliseconds, but browsers show whatever number is given,
|
|
760
|
+
* which is the convention most projects use for non-time samples.
|
|
761
|
+
*/
|
|
762
|
+
function pushMetricsTimings(timings, metrics) {
|
|
763
|
+
if (metrics.dbCount > 0) {
|
|
764
|
+
timings.push({
|
|
765
|
+
name: "db.total",
|
|
766
|
+
dur: metrics.dbTotalMs,
|
|
767
|
+
desc: "DB total"
|
|
768
|
+
});
|
|
769
|
+
timings.push({
|
|
770
|
+
name: "db.count",
|
|
771
|
+
dur: metrics.dbCount,
|
|
772
|
+
desc: "Query count"
|
|
773
|
+
});
|
|
774
|
+
if (metrics.dbFirstOffset !== null) timings.push({
|
|
775
|
+
name: "db.first",
|
|
776
|
+
dur: metrics.dbFirstOffset,
|
|
777
|
+
desc: "First query at"
|
|
778
|
+
});
|
|
779
|
+
if (metrics.dbLastOffset !== null) timings.push({
|
|
780
|
+
name: "db.last",
|
|
781
|
+
dur: metrics.dbLastOffset,
|
|
782
|
+
desc: "Last query at"
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
if (metrics.rpcCount > 0) timings.push({
|
|
786
|
+
name: "rpc.count",
|
|
787
|
+
dur: metrics.rpcCount,
|
|
788
|
+
desc: "DB round trips"
|
|
789
|
+
});
|
|
790
|
+
if (metrics.cacheHits + metrics.cacheMisses > 0) {
|
|
791
|
+
timings.push({
|
|
792
|
+
name: "cache.hit",
|
|
793
|
+
dur: metrics.cacheHits,
|
|
794
|
+
desc: "Cache hits"
|
|
795
|
+
});
|
|
796
|
+
timings.push({
|
|
797
|
+
name: "cache.miss",
|
|
798
|
+
dur: metrics.cacheMisses,
|
|
799
|
+
desc: "Cache misses"
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
}
|
|
1921
803
|
/** Public routes that require the runtime (sitemap, robots.txt, etc.) */
|
|
1922
804
|
const PUBLIC_RUNTIME_ROUTES = new Set(["/sitemap.xml", "/robots.txt"]);
|
|
1923
805
|
const SITEMAP_COLLECTION_RE = /^\/sitemap-[a-z][a-z0-9_]*\.xml$/;
|
|
@@ -1931,32 +813,74 @@ function createRequestScopedDb$1(opts) {
|
|
|
1931
813
|
if (typeof createRequestScopedDb !== "function") return null;
|
|
1932
814
|
return createRequestScopedDb(opts);
|
|
1933
815
|
}
|
|
816
|
+
const buildDate = buildTime ? new Date(buildTime) : null;
|
|
817
|
+
/**
|
|
818
|
+
* Fold the build timestamp into the route cache validator.
|
|
819
|
+
*
|
|
820
|
+
* `CacheHint.lastModified` describes the content, but the response also depends
|
|
821
|
+
* on the build: `/_astro/*` names are content-hashed, and a deployment only
|
|
822
|
+
* serves its own. Without the build dimension a code-only deploy answers a
|
|
823
|
+
* returning visitor's conditional request with 304, leaving them on HTML whose
|
|
824
|
+
* assets 404.
|
|
825
|
+
*
|
|
826
|
+
* Prerendered pages are served by the host's static layer, which manages its
|
|
827
|
+
* own validators — only on-demand responses need the build dimension.
|
|
828
|
+
*
|
|
829
|
+
* Only forward moves are covered. `Last-Modified` expresses newer, not
|
|
830
|
+
* different, so after a rollback the earlier build still answers a conditional
|
|
831
|
+
* request with 304 and the browser stays on the newer build's HTML.
|
|
832
|
+
*
|
|
833
|
+
* Must run before next(): Astro keeps the later of two dates, so a route's own
|
|
834
|
+
* hint still wins when content is newer, and a route that opts out with
|
|
835
|
+
* `Astro.cache.set(false)` stays opted out — calling set() afterwards would
|
|
836
|
+
* clear that opt-out.
|
|
837
|
+
*/
|
|
838
|
+
function applyBuildValidator(context) {
|
|
839
|
+
if (context.isPrerendered || !buildDate || !context.cache?.enabled) return;
|
|
840
|
+
context.cache.set({ lastModified: buildDate });
|
|
841
|
+
}
|
|
1934
842
|
const onRequest = defineMiddleware(async (context, next) => {
|
|
1935
843
|
const { request, locals, cookies } = context;
|
|
1936
844
|
const url = context.url;
|
|
1937
845
|
if (!url.pathname.startsWith("/_emdash") && virtualConfig?.authProviders) {
|
|
1938
846
|
if (virtualConfig.authProviders.some((p) => p.routes?.some((r) => r.pattern && url.pathname === r.pattern))) return finalizeResponse(await next());
|
|
1939
847
|
}
|
|
848
|
+
applyBuildValidator(context);
|
|
1940
849
|
const queryRecorder = isInstrumentationEnabled() ? createRecorder(url.pathname, request.method, request.headers.get("x-perf-phase") ?? "default") : void 0;
|
|
850
|
+
const metrics = createRequestMetrics(performance.now());
|
|
1941
851
|
const run = async () => {
|
|
852
|
+
const config = getConfig();
|
|
853
|
+
const migrationMode = config ? resolveConfiguredMigrationMode(config) : "auto";
|
|
1942
854
|
const isEmDashRoute = url.pathname.startsWith("/_emdash");
|
|
1943
855
|
const isPublicRuntimeRoute = PUBLIC_RUNTIME_ROUTES.has(url.pathname) || SITEMAP_COLLECTION_RE.test(url.pathname);
|
|
1944
856
|
const hasEditCookie = cookies.get("emdash-edit-mode")?.value === "true";
|
|
1945
857
|
const hasPreviewToken = url.searchParams.has("_preview");
|
|
1946
858
|
const playgroundDb = locals.__playgroundDb;
|
|
1947
|
-
const
|
|
859
|
+
const hasSessionCookie = cookies.get("astro-session") !== void 0;
|
|
860
|
+
const sessionUser = context.isPrerendered || !hasSessionCookie ? null : await resolveSessionUser(context.session);
|
|
861
|
+
const hasBearerAuth = (request.headers.get("authorization") ?? "").toLowerCase().startsWith("bearer ");
|
|
862
|
+
const isWrite = request.method !== "GET" && request.method !== "HEAD";
|
|
863
|
+
const isAuthenticated = !!sessionUser || hasBearerAuth;
|
|
864
|
+
const endedAuthenticated = () => requestEndedAuthenticated(isAuthenticated, cookies);
|
|
865
|
+
const canUseCachedBinding = !isAuthenticated && !isWrite && !playgroundDb && !isEmDashRoute && !hasEditCookie && !hasPreviewToken;
|
|
1948
866
|
if (!isEmDashRoute && !isPublicRuntimeRoute && !hasEditCookie && !hasPreviewToken) {
|
|
1949
867
|
if (!sessionUser && !playgroundDb) {
|
|
1950
868
|
const timings = [];
|
|
1951
869
|
const mwStart = performance.now();
|
|
1952
|
-
|
|
870
|
+
let unmigrated = false;
|
|
871
|
+
let probeFailed = false;
|
|
872
|
+
if (migrationMode === "auto" && !isSetupVerified() && !context.isPrerendered) {
|
|
1953
873
|
const t0 = performance.now();
|
|
1954
874
|
try {
|
|
1955
|
-
const { getDb } = await import("../loader-
|
|
875
|
+
const { getDb } = await import("../loader-CWb-ja1p.mjs").then((n) => n.l);
|
|
1956
876
|
await (await getDb()).selectFrom("_emdash_migrations").selectAll().limit(1).execute();
|
|
1957
|
-
|
|
1958
|
-
} catch {
|
|
1959
|
-
|
|
877
|
+
markSetupVerified();
|
|
878
|
+
} catch (error) {
|
|
879
|
+
if (isMissingTableError(error)) unmigrated = true;
|
|
880
|
+
else {
|
|
881
|
+
probeFailed = !getRuntimeHolder().instance;
|
|
882
|
+
console.error("Setup probe failed (non-fatal):", error);
|
|
883
|
+
}
|
|
1960
884
|
}
|
|
1961
885
|
timings.push({
|
|
1962
886
|
name: "setup",
|
|
@@ -1964,19 +888,30 @@ const onRequest = defineMiddleware(async (context, next) => {
|
|
|
1964
888
|
desc: "Setup probe"
|
|
1965
889
|
});
|
|
1966
890
|
}
|
|
1967
|
-
|
|
1968
|
-
if (config) {
|
|
891
|
+
if (config && !probeFailed) {
|
|
1969
892
|
const initSubTimings = [];
|
|
1970
893
|
const t0 = performance.now();
|
|
1971
894
|
try {
|
|
1972
|
-
const runtime = await getRuntime(config, initSubTimings);
|
|
1973
|
-
|
|
895
|
+
const runtime = await getRuntime(config, migrationMode, initSubTimings);
|
|
896
|
+
markSetupVerified();
|
|
1974
897
|
locals.emdash = {
|
|
898
|
+
handlePublicPluginApiRoute: createPublicPluginApiRouteHandler(runtime),
|
|
1975
899
|
collectPageMetadata: runtime.collectPageMetadata.bind(runtime),
|
|
1976
900
|
collectPageFragments: runtime.collectPageFragments.bind(runtime),
|
|
1977
|
-
getPublicMediaUrl: createPublicMediaUrlResolver(runtime.storage)
|
|
901
|
+
getPublicMediaUrl: createPublicMediaUrlResolver(runtime.storage),
|
|
902
|
+
storage: runtime.storage
|
|
1978
903
|
};
|
|
1979
|
-
} catch {
|
|
904
|
+
} catch (error) {
|
|
905
|
+
if (error instanceof PendingMigrationsError) return pendingMigrationsResponse(error);
|
|
906
|
+
if (migrationMode === "manual" && isMissingTableError(error)) {
|
|
907
|
+
console.error("[emdash] database schema is unavailable in manual migration mode:", error);
|
|
908
|
+
return migrationRequiredResponse();
|
|
909
|
+
}
|
|
910
|
+
if (Date.now() - lastRuntimeInitErrorLogAt >= RUNTIME_INIT_ERROR_LOG_INTERVAL_MS) {
|
|
911
|
+
lastRuntimeInitErrorLogAt = Date.now();
|
|
912
|
+
console.error("[emdash] runtime init failed (page renders without CMS data):", error);
|
|
913
|
+
}
|
|
914
|
+
}
|
|
1980
915
|
timings.push({
|
|
1981
916
|
name: "rt",
|
|
1982
917
|
dur: performance.now() - t0,
|
|
@@ -1984,12 +919,17 @@ const onRequest = defineMiddleware(async (context, next) => {
|
|
|
1984
919
|
});
|
|
1985
920
|
for (const sub of initSubTimings) timings.push(sub);
|
|
1986
921
|
}
|
|
922
|
+
if (unmigrated && !locals.emdash) return finalizeResponse(unmigratedDatabaseResponse(), timings);
|
|
923
|
+
const lastContentWriteAt = canUseCachedBinding && config?.database?.needsLastContentWriteAt ? await getLastContentWriteAt() : void 0;
|
|
1987
924
|
const anonScoped = createRequestScopedDb$1({
|
|
1988
925
|
config: config?.database?.config,
|
|
1989
|
-
isAuthenticated
|
|
1990
|
-
|
|
926
|
+
isAuthenticated,
|
|
927
|
+
endedAuthenticated,
|
|
928
|
+
isWrite,
|
|
929
|
+
canUseCachedBinding,
|
|
1991
930
|
cookies,
|
|
1992
|
-
url
|
|
931
|
+
url,
|
|
932
|
+
lastContentWriteAt
|
|
1993
933
|
});
|
|
1994
934
|
const runAnon = async () => {
|
|
1995
935
|
const t0 = performance.now();
|
|
@@ -2004,26 +944,31 @@ const onRequest = defineMiddleware(async (context, next) => {
|
|
|
2004
944
|
dur: performance.now() - mwStart,
|
|
2005
945
|
desc: "Total middleware"
|
|
2006
946
|
});
|
|
2007
|
-
|
|
947
|
+
pushMetricsTimings(timings, metrics);
|
|
948
|
+
return wrapBodyForStreamMetrics(finalizeResponse(response, timings));
|
|
2008
949
|
};
|
|
2009
950
|
if (anonScoped) {
|
|
951
|
+
const { deferredTasks, lifecycle } = coordinateScopedDbLifecycle(anonScoped);
|
|
2010
952
|
const parent = getRequestContext();
|
|
2011
|
-
|
|
953
|
+
const ctx = parent ? {
|
|
2012
954
|
...parent,
|
|
2013
|
-
db: anonScoped.db
|
|
955
|
+
db: anonScoped.db,
|
|
956
|
+
deferredTasks
|
|
2014
957
|
} : {
|
|
2015
958
|
editMode: false,
|
|
2016
|
-
db: anonScoped.db
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
959
|
+
db: anonScoped.db,
|
|
960
|
+
metrics,
|
|
961
|
+
deferredTasks
|
|
962
|
+
};
|
|
963
|
+
const acceptsHtml = (request.headers.get("accept") ?? "").split(",", 1)[0].trim().startsWith("text/html");
|
|
964
|
+
return runWithContext(ctx, async () => {
|
|
965
|
+
if (acceptsHtml) after(() => prefetchLayoutData());
|
|
966
|
+
return finishScoped(lifecycle, runAnon);
|
|
2021
967
|
});
|
|
2022
968
|
}
|
|
2023
969
|
return runAnon();
|
|
2024
970
|
}
|
|
2025
971
|
}
|
|
2026
|
-
const config = getConfig();
|
|
2027
972
|
if (!config) {
|
|
2028
973
|
console.error("EmDash: No configuration found");
|
|
2029
974
|
return finalizeResponse(await next());
|
|
@@ -2034,25 +979,18 @@ const onRequest = defineMiddleware(async (context, next) => {
|
|
|
2034
979
|
try {
|
|
2035
980
|
const initSubTimings = [];
|
|
2036
981
|
let t0 = performance.now();
|
|
2037
|
-
const runtime = await getRuntime(config, initSubTimings);
|
|
982
|
+
const runtime = await getRuntime(config, migrationMode, initSubTimings);
|
|
2038
983
|
timings.push({
|
|
2039
984
|
name: "rt",
|
|
2040
985
|
dur: performance.now() - t0,
|
|
2041
986
|
desc: "Runtime init"
|
|
2042
987
|
});
|
|
2043
988
|
for (const sub of initSubTimings) timings.push(sub);
|
|
2044
|
-
|
|
2045
|
-
t0 = performance.now();
|
|
2046
|
-
const manifest = await runtime.getManifest();
|
|
2047
|
-
timings.push({
|
|
2048
|
-
name: "manifest",
|
|
2049
|
-
dur: performance.now() - t0,
|
|
2050
|
-
desc: "Manifest"
|
|
2051
|
-
});
|
|
2052
|
-
locals.emdashManifest = manifest;
|
|
989
|
+
markSetupVerified();
|
|
2053
990
|
locals.emdash = {
|
|
2054
991
|
handleContentList: runtime.handleContentList.bind(runtime),
|
|
2055
992
|
handleContentGet: runtime.handleContentGet.bind(runtime),
|
|
993
|
+
handleContentAuthors: runtime.handleContentAuthors.bind(runtime),
|
|
2056
994
|
handleContentCreate: runtime.handleContentCreate.bind(runtime),
|
|
2057
995
|
handleContentUpdate: runtime.handleContentUpdate.bind(runtime),
|
|
2058
996
|
handleContentDelete: runtime.handleContentDelete.bind(runtime),
|
|
@@ -2072,40 +1010,73 @@ const onRequest = defineMiddleware(async (context, next) => {
|
|
|
2072
1010
|
handleContentTranslations: runtime.handleContentTranslations.bind(runtime),
|
|
2073
1011
|
handleMediaList: runtime.handleMediaList.bind(runtime),
|
|
2074
1012
|
handleMediaGet: runtime.handleMediaGet.bind(runtime),
|
|
1013
|
+
handleMediaUpload: runtime.handleMediaUpload.bind(runtime),
|
|
2075
1014
|
handleMediaCreate: runtime.handleMediaCreate.bind(runtime),
|
|
1015
|
+
handleMediaRegisterUpload: runtime.handleMediaRegisterUpload.bind(runtime),
|
|
2076
1016
|
handleMediaUpdate: runtime.handleMediaUpdate.bind(runtime),
|
|
1017
|
+
...runtime.handleMediaReplaceMetadata ? { handleMediaReplaceMetadata: runtime.handleMediaReplaceMetadata.bind(runtime) } : {},
|
|
2077
1018
|
handleMediaDelete: runtime.handleMediaDelete.bind(runtime),
|
|
1019
|
+
...runtime.handleCommentModerate ? { handleCommentModerate: runtime.handleCommentModerate.bind(runtime) } : {},
|
|
2078
1020
|
handleRevisionList: runtime.handleRevisionList.bind(runtime),
|
|
2079
1021
|
handleRevisionGet: runtime.handleRevisionGet.bind(runtime),
|
|
2080
1022
|
handleRevisionRestore: runtime.handleRevisionRestore.bind(runtime),
|
|
2081
1023
|
handlePluginApiRoute: runtime.handlePluginApiRoute.bind(runtime),
|
|
1024
|
+
getPluginEditorExtension: runtime.getPluginEditorExtension.bind(runtime),
|
|
1025
|
+
getPluginEditorDraftSchema: runtime.getPluginEditorDraftSchema.bind(runtime),
|
|
1026
|
+
handlePublicPluginApiRoute: createPublicPluginApiRouteHandler(runtime),
|
|
2082
1027
|
getPluginRouteMeta: runtime.getPluginRouteMeta.bind(runtime),
|
|
1028
|
+
getPluginMcpTools: runtime.getPluginMcpTools.bind(runtime),
|
|
1029
|
+
getEnabledPluginMcpTools: runtime.getEnabledPluginMcpTools.bind(runtime),
|
|
1030
|
+
serializePluginMcpConsent: runtime.serializePluginMcpConsent.bind(runtime),
|
|
1031
|
+
handlePluginMcpTool: runtime.handlePluginMcpTool.bind(runtime),
|
|
1032
|
+
handlePluginMcpDenied: runtime.handlePluginMcpDenied.bind(runtime),
|
|
2083
1033
|
getMediaProvider: runtime.getMediaProvider.bind(runtime),
|
|
2084
1034
|
getMediaProviderList: runtime.getMediaProviderList.bind(runtime),
|
|
2085
1035
|
collectPageMetadata: runtime.collectPageMetadata.bind(runtime),
|
|
2086
1036
|
collectPageFragments: runtime.collectPageFragments.bind(runtime),
|
|
2087
1037
|
ensureSearchHealthy: runtime.ensureSearchHealthy.bind(runtime),
|
|
2088
1038
|
storage: runtime.storage,
|
|
2089
|
-
db
|
|
1039
|
+
get db() {
|
|
1040
|
+
return runtime.db;
|
|
1041
|
+
},
|
|
2090
1042
|
getPublicMediaUrl: createPublicMediaUrlResolver(runtime.storage),
|
|
2091
1043
|
hooks: runtime.hooks,
|
|
2092
1044
|
email: runtime.email,
|
|
2093
1045
|
configuredPlugins: runtime.configuredPlugins,
|
|
1046
|
+
sandboxedPluginEntries: runtime.sandboxedPluginEntries,
|
|
2094
1047
|
config,
|
|
2095
|
-
|
|
1048
|
+
getManifest: runtime.getManifest.bind(runtime),
|
|
1049
|
+
invalidateUrlPatternCache,
|
|
2096
1050
|
getSandboxRunner: runtime.getSandboxRunner.bind(runtime),
|
|
1051
|
+
isSandboxBypassed: runtime.isSandboxBypassed.bind(runtime),
|
|
2097
1052
|
syncMarketplacePlugins: runtime.syncMarketplacePlugins.bind(runtime),
|
|
1053
|
+
syncRegistryPlugins: runtime.syncRegistryPlugins.bind(runtime),
|
|
1054
|
+
runPluginInstallLifecycle: runtime.runPluginInstallLifecycle.bind(runtime),
|
|
1055
|
+
runPluginActivateLifecycle: runtime.runPluginActivateLifecycle.bind(runtime),
|
|
1056
|
+
runPluginUninstallLifecycle: runtime.runPluginUninstallLifecycle.bind(runtime),
|
|
1057
|
+
getRuntimePluginSettingsSchema: runtime.getRuntimePluginSettingsSchema.bind(runtime),
|
|
2098
1058
|
setPluginStatus: runtime.setPluginStatus.bind(runtime)
|
|
2099
1059
|
};
|
|
2100
1060
|
} catch (error) {
|
|
1061
|
+
if (error instanceof PendingMigrationsError) return pendingMigrationsResponse(error);
|
|
1062
|
+
if (migrationMode === "manual" && isMissingTableError(error)) {
|
|
1063
|
+
console.error("[emdash] database schema is unavailable in manual migration mode:", error);
|
|
1064
|
+
return migrationRequiredResponse();
|
|
1065
|
+
}
|
|
2101
1066
|
console.error("EmDash middleware error:", error);
|
|
1067
|
+
const configurationError = runtimeConfigurationErrorResponse(error, url.pathname);
|
|
1068
|
+
if (configurationError) return configurationError;
|
|
2102
1069
|
}
|
|
1070
|
+
const lastContentWriteAt = canUseCachedBinding && config?.database?.needsLastContentWriteAt ? await getLastContentWriteAt() : void 0;
|
|
2103
1071
|
const scoped = createRequestScopedDb$1({
|
|
2104
1072
|
config: config?.database?.config,
|
|
2105
|
-
isAuthenticated
|
|
2106
|
-
|
|
1073
|
+
isAuthenticated,
|
|
1074
|
+
endedAuthenticated,
|
|
1075
|
+
isWrite,
|
|
1076
|
+
canUseCachedBinding,
|
|
2107
1077
|
cookies: context.cookies,
|
|
2108
|
-
url
|
|
1078
|
+
url,
|
|
1079
|
+
lastContentWriteAt
|
|
2109
1080
|
});
|
|
2110
1081
|
const renderAndFinalize = async () => {
|
|
2111
1082
|
const t0 = performance.now();
|
|
@@ -2120,21 +1091,22 @@ const onRequest = defineMiddleware(async (context, next) => {
|
|
|
2120
1091
|
dur: performance.now() - mwStart,
|
|
2121
1092
|
desc: "Total middleware"
|
|
2122
1093
|
});
|
|
2123
|
-
|
|
1094
|
+
pushMetricsTimings(timings, metrics);
|
|
1095
|
+
return wrapBodyForStreamMetrics(finalizeResponse(response, timings));
|
|
2124
1096
|
};
|
|
2125
1097
|
if (scoped) {
|
|
1098
|
+
const { deferredTasks, lifecycle } = coordinateScopedDbLifecycle(scoped);
|
|
2126
1099
|
const parent = getRequestContext();
|
|
2127
1100
|
return runWithContext(parent ? {
|
|
2128
1101
|
...parent,
|
|
2129
|
-
db: scoped.db
|
|
1102
|
+
db: scoped.db,
|
|
1103
|
+
deferredTasks
|
|
2130
1104
|
} : {
|
|
2131
1105
|
editMode: false,
|
|
2132
|
-
db: scoped.db
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
return response;
|
|
2137
|
-
});
|
|
1106
|
+
db: scoped.db,
|
|
1107
|
+
metrics,
|
|
1108
|
+
deferredTasks
|
|
1109
|
+
}, () => finishScoped(lifecycle, renderAndFinalize));
|
|
2138
1110
|
}
|
|
2139
1111
|
return renderAndFinalize();
|
|
2140
1112
|
};
|
|
@@ -2149,22 +1121,23 @@ const onRequest = defineMiddleware(async (context, next) => {
|
|
|
2149
1121
|
} : {
|
|
2150
1122
|
editMode,
|
|
2151
1123
|
db: playgroundDb,
|
|
2152
|
-
dbIsIsolated: true
|
|
1124
|
+
dbIsIsolated: true,
|
|
1125
|
+
metrics
|
|
2153
1126
|
}, doInit);
|
|
2154
1127
|
}
|
|
2155
1128
|
return doInit();
|
|
2156
1129
|
};
|
|
2157
|
-
|
|
1130
|
+
try {
|
|
2158
1131
|
return await runWithContext({
|
|
2159
1132
|
editMode: false,
|
|
2160
|
-
queryRecorder
|
|
1133
|
+
queryRecorder,
|
|
1134
|
+
metrics
|
|
2161
1135
|
}, run);
|
|
2162
1136
|
} finally {
|
|
2163
|
-
flushRecorder(queryRecorder);
|
|
1137
|
+
if (queryRecorder && !queryRecorder.deferredFlush) flushRecorder(queryRecorder);
|
|
2164
1138
|
}
|
|
2165
|
-
return run();
|
|
2166
1139
|
});
|
|
2167
1140
|
|
|
2168
1141
|
//#endregion
|
|
2169
|
-
export { onRequest as default, onRequest };
|
|
1142
|
+
export { onRequest as default, onRequest, runScheduledTasks, withEmDashRuntime };
|
|
2170
1143
|
//# sourceMappingURL=middleware.mjs.map
|