emdash 0.34.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/activation-K0kGBWuJ.mjs +382 -0
- package/dist/activation-K0kGBWuJ.mjs.map +1 -0
- package/dist/{adapters-34EN2eXO.d.mts → adapters-CzL3H752.d.mts} +10 -3
- package/dist/adapters-CzL3H752.d.mts.map +1 -0
- package/dist/{allowed-origins-DW7sYyqg.mjs → allowed-origins-maylGaHv.mjs} +2 -2
- package/dist/{allowed-origins-DW7sYyqg.mjs.map → allowed-origins-maylGaHv.mjs.map} +1 -1
- package/dist/api/route-utils.d.mts +3 -3
- package/dist/api/route-utils.mjs +22 -20
- package/dist/api/route-utils.mjs.map +1 -1
- package/dist/api/schemas/index.d.mts +2 -2
- package/dist/api/schemas/index.mjs +5 -5
- package/dist/api-B0w3uBiG.mjs +2269 -0
- package/dist/api-B0w3uBiG.mjs.map +1 -0
- package/dist/{api-tokens-CFXu8F_2.mjs → api-tokens-9YrrCoE6.mjs} +2 -2
- package/dist/{api-tokens-CFXu8F_2.mjs.map → api-tokens-9YrrCoE6.mjs.map} +1 -1
- package/dist/{apply-D5zfeD09.mjs → apply-B_VMpJ2P.mjs} +34 -35
- package/dist/{apply-D5zfeD09.mjs.map → apply-B_VMpJ2P.mjs.map} +1 -1
- package/dist/astro/index.d.mts +12 -12
- package/dist/astro/index.d.mts.map +1 -1
- package/dist/astro/index.mjs +92 -25
- package/dist/astro/index.mjs.map +1 -1
- package/dist/astro/middleware/auth.d.mts +10 -10
- package/dist/astro/middleware/auth.d.mts.map +1 -1
- package/dist/astro/middleware/auth.mjs +10 -7
- package/dist/astro/middleware/auth.mjs.map +1 -1
- package/dist/astro/middleware/media-usage-write-fence.mjs +2 -2
- package/dist/astro/middleware/redirect.mjs +4 -4
- package/dist/astro/middleware/request-context.mjs +3 -3
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware.d.mts +11 -12
- package/dist/astro/middleware.d.mts.map +1 -1
- package/dist/astro/middleware.mjs +255 -1323
- package/dist/astro/middleware.mjs.map +1 -1
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +6 -6
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +6 -6
- package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +3 -3
- package/dist/astro/routes/api/admin/api-tokens/index.mjs +4 -4
- package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +4 -4
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +9 -9
- package/dist/astro/routes/api/admin/byline-fields/index.mjs +9 -9
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +9 -9
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +15 -15
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +15 -15
- package/dist/astro/routes/api/admin/bylines/index.mjs +15 -15
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +12 -12
- package/dist/astro/routes/api/admin/comments/_id_.mjs +4 -4
- package/dist/astro/routes/api/admin/comments/bulk.mjs +9 -9
- package/dist/astro/routes/api/admin/comments/counts.mjs +4 -4
- package/dist/astro/routes/api/admin/comments/index.mjs +9 -9
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +4 -4
- package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +3 -3
- package/dist/astro/routes/api/admin/media-usage/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 +46 -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.mjs +14 -13
- package/dist/astro/routes/api/admin/media-usage/collection-deletions/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/media-usage/collection-deletions/retry.mjs +14 -13
- package/dist/astro/routes/api/admin/media-usage/collection-deletions/retry.mjs.map +1 -1
- 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 +44 -0
- package/dist/astro/routes/api/admin/media-usage/progress.mjs.map +1 -0
- package/dist/astro/routes/api/admin/media-usage/repair.mjs +16 -11
- package/dist/astro/routes/api/admin/media-usage/repair.mjs.map +1 -1
- package/dist/astro/routes/api/admin/media-usage/work/index.mjs +14 -13
- package/dist/astro/routes/api/admin/media-usage/work/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/media-usage/work/retry.mjs +14 -13
- package/dist/astro/routes/api/admin/media-usage/work/retry.mjs.map +1 -1
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +3 -3
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs +3 -3
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +54 -48
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +54 -48
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +52 -46
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/mcp.mjs +4 -4
- package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs +52 -46
- package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +53 -47
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +53 -47
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/index.mjs +52 -46
- package/dist/astro/routes/api/admin/plugins/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +2 -2
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +52 -46
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +53 -47
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +52 -46
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +53 -47
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +54 -48
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/artifact.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +172 -133
- package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/install.mjs +54 -48
- package/dist/astro/routes/api/admin/plugins/registry/install.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/updates.mjs +52 -46
- package/dist/astro/routes/api/admin/plugins/updates.mjs.map +1 -1
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +52 -46
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +2 -2
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +52 -46
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/users/_id_/disable.mjs +2 -2
- package/dist/astro/routes/api/admin/users/_id_/enable.mjs +1 -1
- package/dist/astro/routes/api/admin/users/_id_/index.mjs +7 -7
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +3 -3
- package/dist/astro/routes/api/admin/users/index.mjs +6 -6
- package/dist/astro/routes/api/auth/dev-bypass.d.mts.map +1 -1
- package/dist/astro/routes/api/auth/dev-bypass.mjs +3 -7
- package/dist/astro/routes/api/auth/dev-bypass.mjs.map +1 -1
- package/dist/astro/routes/api/auth/invite/accept.mjs +1 -1
- package/dist/astro/routes/api/auth/invite/complete.mjs +11 -11
- package/dist/astro/routes/api/auth/invite/index.mjs +8 -8
- package/dist/astro/routes/api/auth/invite/register-options.mjs +10 -10
- package/dist/astro/routes/api/auth/logout.mjs +2 -2
- package/dist/astro/routes/api/auth/magic-link/send.mjs +10 -10
- package/dist/astro/routes/api/auth/magic-link/verify.mjs +2 -2
- package/dist/astro/routes/api/auth/me.d.mts.map +1 -1
- package/dist/astro/routes/api/auth/me.mjs +19 -9
- package/dist/astro/routes/api/auth/me.mjs.map +1 -1
- package/dist/astro/routes/api/auth/mode.mjs +2 -2
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +4 -4
- package/dist/astro/routes/api/auth/oauth/_provider_.mjs +2 -2
- package/dist/astro/routes/api/auth/passkey/_id_.mjs +6 -6
- package/dist/astro/routes/api/auth/passkey/index.mjs +1 -1
- package/dist/astro/routes/api/auth/passkey/options.mjs +12 -12
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +10 -10
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +11 -11
- package/dist/astro/routes/api/auth/passkey/verify.mjs +11 -11
- package/dist/astro/routes/api/auth/signup/complete.mjs +11 -11
- package/dist/astro/routes/api/auth/signup/request.mjs +10 -10
- package/dist/astro/routes/api/auth/signup/verify.mjs +1 -1
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +13 -13
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +12 -12
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +11 -11
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +8 -8
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs +16 -14
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.mjs +16 -14
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +8 -8
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +13 -13
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_.mjs +8 -8
- package/dist/astro/routes/api/content/_collection_/authors.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/index.mjs +8 -8
- package/dist/astro/routes/api/content/_collection_/trash.mjs +7 -7
- package/dist/astro/routes/api/dashboard.mjs +7 -7
- package/dist/astro/routes/api/dev/emails.mjs +2 -2
- package/dist/astro/routes/api/import/probe.d.mts +3 -3
- package/dist/astro/routes/api/import/probe.mjs +16 -16
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +2 -2
- package/dist/astro/routes/api/import/wordpress/execute.d.mts +11 -11
- package/dist/astro/routes/api/import/wordpress/execute.mjs +12 -12
- package/dist/astro/routes/api/import/wordpress/media.d.mts +10 -10
- package/dist/astro/routes/api/import/wordpress/media.mjs +11 -11
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +9 -9
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +11 -11
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +12 -10
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +16 -16
- package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +11 -11
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +26 -26
- package/dist/astro/routes/api/manifest.mjs +4 -4
- package/dist/astro/routes/api/mcp.mjs +42 -42
- package/dist/astro/routes/api/media/_id_/confirm.mjs +11 -11
- package/dist/astro/routes/api/media/_id_/upload.mjs +6 -6
- package/dist/astro/routes/api/media/_id_/usage.mjs +18 -13
- package/dist/astro/routes/api/media/_id_/usage.mjs.map +1 -1
- package/dist/astro/routes/api/media/_id_.d.mts.map +1 -1
- package/dist/astro/routes/api/media/_id_.mjs +21 -13
- package/dist/astro/routes/api/media/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/media/file/_...key_.mjs +1 -1
- 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 +52 -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 +41 -0
- package/dist/astro/routes/api/media/folders/index.mjs.map +1 -0
- package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +2 -2
- package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +2 -2
- package/dist/astro/routes/api/media/providers/index.mjs +2 -2
- package/dist/astro/routes/api/media/upload-url.mjs +9 -9
- package/dist/astro/routes/api/media.d.mts.map +1 -1
- package/dist/astro/routes/api/media.mjs +28 -19
- package/dist/astro/routes/api/media.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +8 -8
- package/dist/astro/routes/api/menus/_name_/items.mjs +8 -8
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +8 -8
- package/dist/astro/routes/api/menus/_name_/translations.mjs +8 -8
- package/dist/astro/routes/api/menus/_name_.mjs +8 -8
- package/dist/astro/routes/api/menus/index.mjs +8 -8
- package/dist/astro/routes/api/oauth/authorize.mjs +6 -6
- package/dist/astro/routes/api/oauth/device/authorize.mjs +5 -5
- package/dist/astro/routes/api/oauth/device/code.mjs +8 -8
- package/dist/astro/routes/api/oauth/device/token.mjs +7 -7
- package/dist/astro/routes/api/oauth/register.mjs +2 -2
- package/dist/astro/routes/api/oauth/token/refresh.mjs +5 -5
- package/dist/astro/routes/api/oauth/token/revoke.mjs +5 -5
- package/dist/astro/routes/api/oauth/token.mjs +5 -5
- package/dist/astro/routes/api/openapi.json.mjs +153 -6
- package/dist/astro/routes/api/openapi.json.mjs.map +1 -1
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +4 -4
- package/dist/astro/routes/api/redirects/404s/index.mjs +10 -10
- package/dist/astro/routes/api/redirects/404s/summary.mjs +10 -10
- package/dist/astro/routes/api/redirects/_id_.mjs +11 -11
- package/dist/astro/routes/api/redirects/index.mjs +11 -11
- package/dist/astro/routes/api/relations/_id_/index.mjs +16 -14
- package/dist/astro/routes/api/relations/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/relations/_id_/translations.mjs +11 -9
- package/dist/astro/routes/api/relations/_id_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/relations/index.mjs +16 -14
- package/dist/astro/routes/api/relations/index.mjs.map +1 -1
- package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +2 -2
- package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +3 -3
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +52 -46
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +52 -46
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +52 -46
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +52 -46
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/index.mjs +52 -46
- package/dist/astro/routes/api/schema/collections/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/reorder.mjs +52 -46
- package/dist/astro/routes/api/schema/collections/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/schema/index.mjs +10 -8
- package/dist/astro/routes/api/schema/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +52 -46
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs.map +1 -1
- package/dist/astro/routes/api/schema/orphans/index.mjs +52 -46
- package/dist/astro/routes/api/schema/orphans/index.mjs.map +1 -1
- package/dist/astro/routes/api/search/enable.mjs +10 -10
- package/dist/astro/routes/api/search/index.mjs +9 -9
- package/dist/astro/routes/api/search/rebuild.mjs +10 -10
- package/dist/astro/routes/api/search/stats.mjs +5 -5
- package/dist/astro/routes/api/search/suggest.mjs +9 -9
- package/dist/astro/routes/api/sections/_slug_.mjs +9 -9
- package/dist/astro/routes/api/sections/index.mjs +9 -9
- package/dist/astro/routes/api/settings/backups/archives/_name_.mjs +6 -6
- package/dist/astro/routes/api/settings/backups/archives/index.mjs +5 -5
- package/dist/astro/routes/api/settings/backups/export.mjs +6 -6
- package/dist/astro/routes/api/settings/backups/index.mjs +7 -7
- package/dist/astro/routes/api/settings/email.mjs +4 -4
- package/dist/astro/routes/api/settings.mjs +13 -13
- package/dist/astro/routes/api/setup/admin-verify.mjs +12 -12
- package/dist/astro/routes/api/setup/admin.mjs +11 -11
- package/dist/astro/routes/api/setup/dev-bypass.d.mts.map +1 -1
- package/dist/astro/routes/api/setup/dev-bypass.mjs +35 -31
- package/dist/astro/routes/api/setup/dev-bypass.mjs.map +1 -1
- package/dist/astro/routes/api/setup/dev-reset.mjs +2 -2
- package/dist/astro/routes/api/setup/index.d.mts.map +1 -1
- package/dist/astro/routes/api/setup/index.mjs +31 -35
- package/dist/astro/routes/api/setup/index.mjs.map +1 -1
- package/dist/astro/routes/api/setup/status.mjs +3 -3
- package/dist/astro/routes/api/snapshot.mjs +7 -7
- package/dist/astro/routes/api/taxonomies/_name_/reorder.mjs +13 -13
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +13 -13
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +13 -13
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +13 -13
- package/dist/astro/routes/api/taxonomies/_name_/translations.mjs +13 -13
- package/dist/astro/routes/api/taxonomies/_name_.mjs +13 -13
- package/dist/astro/routes/api/taxonomies/index.mjs +13 -13
- package/dist/astro/routes/api/themes/preview.mjs +5 -5
- package/dist/astro/routes/api/typegen.mjs +4 -4
- package/dist/astro/routes/api/well-known/auth.mjs +2 -2
- package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +2 -2
- package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +2 -2
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +7 -7
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +10 -10
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +10 -10
- package/dist/astro/routes/api/widget-areas/_name_.mjs +5 -5
- package/dist/astro/routes/api/widget-areas/index.mjs +10 -10
- package/dist/astro/routes/api/widget-components.mjs +2 -2
- package/dist/astro/routes/robots.txt.mjs +6 -6
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +9 -9
- package/dist/astro/routes/sitemap.xml.mjs +7 -7
- package/dist/astro/types.d.mts +19 -14
- package/dist/astro/types.d.mts.map +1 -1
- package/dist/auth/providers/github.d.mts +1 -1
- package/dist/auth/providers/google.d.mts +1 -1
- package/dist/{authorize-1iFJzPaZ.mjs → authorize-ByYs-Uxs.mjs} +2 -2
- package/dist/{authorize-1iFJzPaZ.mjs.map → authorize-ByYs-Uxs.mjs.map} +1 -1
- package/dist/{backup-LHjIAVNP.mjs → backup-ChyHfIoX.mjs} +5 -5
- package/dist/{backup-LHjIAVNP.mjs.map → backup-ChyHfIoX.mjs.map} +1 -1
- package/dist/{bundle-CBEXrBnb.mjs → bundle-DZFhFurR.mjs} +7 -7
- package/dist/{bundle-CBEXrBnb.mjs.map → bundle-DZFhFurR.mjs.map} +1 -1
- package/dist/{byline-pEcoDps8.mjs → byline-Cpnwrje1.mjs} +6 -6
- package/dist/{byline-pEcoDps8.mjs.map → byline-Cpnwrje1.mjs.map} +1 -1
- package/dist/{byline-fields-C5S8wygO.mjs → byline-fields-CAyA_Umd.mjs} +2 -2
- package/dist/{byline-fields-C5S8wygO.mjs.map → byline-fields-CAyA_Umd.mjs.map} +1 -1
- package/dist/{byline-registry-DDun8sxh.mjs → byline-registry-Bpu9-MVs.mjs} +2 -2
- package/dist/{byline-registry-DDun8sxh.mjs.map → byline-registry-Bpu9-MVs.mjs.map} +1 -1
- package/dist/{bylines-BWemdX2k.mjs → bylines-BSo9B9RX.mjs} +7 -7
- package/dist/{bylines-BWemdX2k.mjs.map → bylines-BSo9B9RX.mjs.map} +1 -1
- package/dist/{bylines-DJfSfXCL.mjs → bylines-CHjvehVX.mjs} +3 -3
- package/dist/{bylines-DJfSfXCL.mjs.map → bylines-CHjvehVX.mjs.map} +1 -1
- package/dist/{cache-CBJaDy_E.mjs → cache-5VirJ2Cn.mjs} +4 -4
- package/dist/{cache-CBJaDy_E.mjs.map → cache-5VirJ2Cn.mjs.map} +1 -1
- package/dist/capture-triggers-CNW1q3HK.mjs +362 -0
- package/dist/capture-triggers-CNW1q3HK.mjs.map +1 -0
- package/dist/{challenge-store-CZyFVaad.mjs → challenge-store-D5pSY2S1.mjs} +1 -1
- package/dist/{challenge-store-CZyFVaad.mjs.map → challenge-store-D5pSY2S1.mjs.map} +1 -1
- package/dist/{chunks-DfPax1I0.mjs → chunks-bNiX6_DR.mjs} +2 -2
- package/dist/{chunks-DfPax1I0.mjs.map → chunks-bNiX6_DR.mjs.map} +1 -1
- package/dist/cli/index.mjs +568 -84
- package/dist/cli/index.mjs.map +1 -1
- package/dist/client/cf-access.d.mts +1 -1
- package/dist/client/index.d.mts +74 -4
- package/dist/client/index.d.mts.map +1 -1
- package/dist/client/index.mjs +54 -2
- package/dist/client/index.mjs.map +1 -1
- package/dist/{collection-deletion-C8BugSGz.mjs → collection-deletion-m_oi2c0N.mjs} +13 -356
- package/dist/collection-deletion-m_oi2c0N.mjs.map +1 -0
- package/dist/{comment-Dxlep6cE.mjs → comment-DhvLEdhQ.mjs} +1 -1
- package/dist/{comment-Dxlep6cE.mjs.map → comment-DhvLEdhQ.mjs.map} +1 -1
- package/dist/{comment-reaction-D6qfHKBc.mjs → comment-reaction-CRuItEjt.mjs} +2 -2
- package/dist/{comment-reaction-D6qfHKBc.mjs.map → comment-reaction-CRuItEjt.mjs.map} +1 -1
- package/dist/{comments-CTOuhTSX.mjs → comments-CLj4bi8I.mjs} +2 -2
- package/dist/{comments-CTOuhTSX.mjs.map → comments-CLj4bi8I.mjs.map} +1 -1
- package/dist/{components-CQy3lh9x.mjs → components-v4U4DT2y.mjs} +1 -1
- package/dist/{components-CQy3lh9x.mjs.map → components-v4U4DT2y.mjs.map} +1 -1
- package/dist/config-DrfghTPe.d.mts +34 -0
- package/dist/config-DrfghTPe.d.mts.map +1 -0
- package/dist/{content-BNfwh7xX.mjs → content-CP-SeXNa.mjs} +5 -4
- package/dist/content-CP-SeXNa.mjs.map +1 -0
- package/dist/{content-list-query-DhQ84eVV.d.mts → content-list-query-BhejKVqb.d.mts} +1 -1
- package/dist/{content-list-query-DhQ84eVV.d.mts.map → content-list-query-BhejKVqb.d.mts.map} +1 -1
- package/dist/{content-refresh-DNERP4-f.mjs → content-refresh-DLOfIhYc.mjs} +1094 -93
- package/dist/content-refresh-DLOfIhYc.mjs.map +1 -0
- package/dist/{media-usage-De3qvwjc.mjs → content-repair-BCxzy0r4.mjs} +5 -196
- package/dist/content-repair-BCxzy0r4.mjs.map +1 -0
- package/dist/{context-DRgOvSnW.mjs → context-BR5hRWiK.mjs} +13 -13
- package/dist/{context-DRgOvSnW.mjs.map → context-BR5hRWiK.mjs.map} +1 -1
- package/dist/{cron-Y9aLtgrA.mjs → cron-CWfWrWKG.mjs} +1 -1
- package/dist/{cron-Y9aLtgrA.mjs.map → cron-CWfWrWKG.mjs.map} +1 -1
- package/dist/{dashboard-CB8J89rJ.mjs → dashboard-CkIV2rnQ.mjs} +5 -5
- package/dist/{dashboard-CB8J89rJ.mjs.map → dashboard-CkIV2rnQ.mjs.map} +1 -1
- package/dist/db/index.d.mts +4 -4
- package/dist/db/index.mjs +32 -9
- 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 +57 -0
- package/dist/db/libsql-migrations.mjs.map +1 -0
- package/dist/db/libsql.d.mts +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 +47 -0
- package/dist/db/postgres-migrations.mjs.map +1 -0
- package/dist/db/postgres.d.mts +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 +28 -0
- package/dist/db/sqlite-migrations.mjs.map +1 -0
- package/dist/db/sqlite.d.mts +1 -1
- package/dist/db/sqlite.mjs +3 -3
- package/dist/db/sqlite.mjs.map +1 -1
- package/dist/{default-DdDl3fxv.mjs → default-YMEfcQUx.mjs} +1 -1
- package/dist/{default-DdDl3fxv.mjs.map → default-YMEfcQUx.mjs.map} +1 -1
- package/dist/{deferred-tasks-BMsa9F64.d.mts → deferred-tasks-DfqxH5Xf.d.mts} +1 -1
- package/dist/{deferred-tasks-BMsa9F64.d.mts.map → deferred-tasks-DfqxH5Xf.d.mts.map} +1 -1
- package/dist/{device-flow-CaioYGK3.mjs → device-flow-CojjSBwb.mjs} +5 -5
- package/dist/{device-flow-CaioYGK3.mjs.map → device-flow-CojjSBwb.mjs.map} +1 -1
- package/dist/direct-executor-BWeWiRYB.mjs +85 -0
- package/dist/direct-executor-BWeWiRYB.mjs.map +1 -0
- package/dist/{dist-D_6CKR8z.mjs → dist-89xCrGqi.mjs} +1 -1
- package/dist/{dist-D_6CKR8z.mjs.map → dist-89xCrGqi.mjs.map} +1 -1
- package/dist/{email-console-BHNjIwiB.mjs → email-console-CEJgR_LB.mjs} +1 -1
- package/dist/{email-console-BHNjIwiB.mjs.map → email-console-CEJgR_LB.mjs.map} +1 -1
- package/dist/{enrich-_ySMEvEE.mjs → enrich-BX0IDp4z.mjs} +3 -3
- package/dist/{enrich-_ySMEvEE.mjs.map → enrich-BX0IDp4z.mjs.map} +1 -1
- package/dist/{error-DupyJZE2.mjs → error-D9w94fjV.mjs} +2 -2
- package/dist/{error-DupyJZE2.mjs.map → error-D9w94fjV.mjs.map} +1 -1
- package/dist/{errors-CLUPm7aD.mjs → errors-n2j49uNf.mjs} +22 -2
- package/dist/errors-n2j49uNf.mjs.map +1 -0
- package/dist/{escape-C_aLKP3H.mjs → escape-DN4Qmjsl.mjs} +1 -1
- package/dist/{escape-C_aLKP3H.mjs.map → escape-DN4Qmjsl.mjs.map} +1 -1
- package/dist/{field-defs-cache-hg6QkjV9.mjs → field-defs-cache-Bh4q6oar.mjs} +5 -5
- package/dist/{field-defs-cache-hg6QkjV9.mjs.map → field-defs-cache-Bh4q6oar.mjs.map} +1 -1
- package/dist/focal-point-BeWFo6Xx.mjs +23 -0
- package/dist/focal-point-BeWFo6Xx.mjs.map +1 -0
- package/dist/{fts-manager-CZ-5dVwJ.mjs → fts-manager-BhOdW0bi.mjs} +3 -3
- package/dist/{fts-manager-CZ-5dVwJ.mjs.map → fts-manager-BhOdW0bi.mjs.map} +1 -1
- package/dist/{hash-Cg0TXJPV.mjs → hash-CTcngWvj.mjs} +1 -1
- package/dist/{hash-Cg0TXJPV.mjs.map → hash-CTcngWvj.mjs.map} +1 -1
- package/dist/{hreflang-D3Uehfv2.d.mts → hreflang-7pTHsLZJ.d.mts} +2 -2
- package/dist/{hreflang-D3Uehfv2.d.mts.map → hreflang-7pTHsLZJ.d.mts.map} +1 -1
- package/dist/{hreflang-DNswoYsi.mjs → hreflang-Huc6O5wa.mjs} +7 -7
- package/dist/{hreflang-DNswoYsi.mjs.map → hreflang-Huc6O5wa.mjs.map} +1 -1
- package/dist/identity-DXmb4aVp.mjs +35 -0
- package/dist/identity-DXmb4aVp.mjs.map +1 -0
- package/dist/{import-B41u8Rot.mjs → import-C4_O3KXU.mjs} +5 -5
- package/dist/{import-B41u8Rot.mjs.map → import-C4_O3KXU.mjs.map} +1 -1
- package/dist/{index-Cof4-Fab.d.mts → index-6bRee8zb.d.mts} +3 -3
- package/dist/{index-Cof4-Fab.d.mts.map → index-6bRee8zb.d.mts.map} +1 -1
- package/dist/{index-C3Y-rsyN.d.mts → index-DWbJrsAg.d.mts} +138 -83
- package/dist/index-DWbJrsAg.d.mts.map +1 -0
- package/dist/index.d.mts +21 -20
- package/dist/index.mjs +78 -72
- package/dist/{init-lock-6b309ZrF.mjs → init-lock-DJkX6Hto.mjs} +1 -1
- package/dist/{init-lock-6b309ZrF.mjs.map → init-lock-DJkX6Hto.mjs.map} +1 -1
- package/dist/{load-DmvJrtxS.mjs → load-Bo7fZAbg.mjs} +2 -2
- package/dist/{load-DmvJrtxS.mjs.map → load-Bo7fZAbg.mjs.map} +1 -1
- package/dist/{loader-DLBqRiGP.mjs → loader-ZsjE4paL.mjs} +2 -2
- package/dist/{loader-DLBqRiGP.mjs.map → loader-ZsjE4paL.mjs.map} +1 -1
- package/dist/manifest-builder-QXuqvVMP.mjs +189 -0
- package/dist/manifest-builder-QXuqvVMP.mjs.map +1 -0
- package/dist/{manifest-schema-BXbUAHod.mjs → manifest-schema-CUYPfCEH.mjs} +1 -1
- package/dist/{manifest-schema-BXbUAHod.mjs.map → manifest-schema-CUYPfCEH.mjs.map} +1 -1
- package/dist/media/image-endpoint.mjs +1 -1
- package/dist/media/index.d.mts +1 -1
- package/dist/media/index.mjs +13 -3
- package/dist/media/index.mjs.map +1 -1
- package/dist/media/local-runtime.d.mts +14 -12
- package/dist/media/local-runtime.d.mts.map +1 -1
- package/dist/media/local-runtime.mjs +11 -5
- package/dist/media/local-runtime.mjs.map +1 -1
- package/dist/{media-BWWWb8kg.mjs → media-BjwNuLEu.mjs} +100 -6
- package/dist/media-BjwNuLEu.mjs.map +1 -0
- package/dist/{media-CzhAn2--.mjs → media-D6SeAfBl.mjs} +41 -12
- package/dist/media-D6SeAfBl.mjs.map +1 -0
- package/dist/{media-allowlist-BD6HhgXA.mjs → media-allowlist-D35v7bmL.mjs} +3 -2
- package/dist/media-allowlist-D35v7bmL.mjs.map +1 -0
- package/dist/media-folders-D-0CmRZj.mjs +210 -0
- package/dist/media-folders-D-0CmRZj.mjs.map +1 -0
- package/dist/{media-upload-9yas9zGH.mjs → media-upload-C7bLXGcI.mjs} +9 -9
- package/dist/{media-upload-9yas9zGH.mjs.map → media-upload-C7bLXGcI.mjs.map} +1 -1
- package/dist/{media-url-BvoX88FA.mjs → media-url-DH7giMx_.mjs} +1 -1
- package/dist/{media-url-BvoX88FA.mjs.map → media-url-DH7giMx_.mjs.map} +1 -1
- package/dist/media-usage-BTRJvS6V.mjs +1833 -0
- package/dist/media-usage-BTRJvS6V.mjs.map +1 -0
- package/dist/media-usage-activation-Dx0kPV6b.mjs +78 -0
- package/dist/media-usage-activation-Dx0kPV6b.mjs.map +1 -0
- package/dist/{media-usage-work-DrCbqBcl.mjs → media-usage-work-C-fhM30c.mjs} +221 -59
- package/dist/media-usage-work-C-fhM30c.mjs.map +1 -0
- package/dist/{media-usage-work-B9Bksh_b.mjs → media-usage-work-DWb2XPMI.mjs} +4 -4
- package/dist/{media-usage-work-B9Bksh_b.mjs.map → media-usage-work-DWb2XPMI.mjs.map} +1 -1
- package/dist/{media-usage-write-fence-aHEgN1zB.mjs → media-usage-write-fence-BwoJVRDC.mjs} +2 -2
- package/dist/{media-usage-write-fence-aHEgN1zB.mjs.map → media-usage-write-fence-BwoJVRDC.mjs.map} +1 -1
- package/dist/{menus-fxvEDYE6.mjs → menus-CD7EFLwz.mjs} +3 -3
- package/dist/{menus-fxvEDYE6.mjs.map → menus-CD7EFLwz.mjs.map} +1 -1
- package/dist/{menus-CC-yn1F9.mjs → menus-CNg0QlDt.mjs} +42 -26
- package/dist/menus-CNg0QlDt.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 +7 -0
- package/dist/{mime-DfIVjNkr.mjs → mime-CUIG6x84.mjs} +1 -1
- package/dist/mime-CUIG6x84.mjs.map +1 -0
- package/dist/{mode-Bpe-tNNy.mjs → mode-DaUM_MB2.mjs} +1 -1
- package/dist/{mode-Bpe-tNNy.mjs.map → mode-DaUM_MB2.mjs.map} +1 -1
- package/dist/node-sqlite-compat-Udb4Y-rs.mjs +46 -0
- package/dist/node-sqlite-compat-Udb4Y-rs.mjs.map +1 -0
- package/dist/{normalize-Bc-s_r-a.mjs → normalize-CSxdKBVa.mjs} +22 -1
- package/dist/normalize-CSxdKBVa.mjs.map +1 -0
- package/dist/{oauth-authorization-BXO1MKej.mjs → oauth-authorization-Dpsb-fMJ.mjs} +5 -5
- package/dist/{oauth-authorization-BXO1MKej.mjs.map → oauth-authorization-Dpsb-fMJ.mjs.map} +1 -1
- package/dist/{oauth-clients-C_DNqtRu.mjs → oauth-clients-Bxnoe_67.mjs} +1 -1
- package/dist/{oauth-clients-C_DNqtRu.mjs.map → oauth-clients-Bxnoe_67.mjs.map} +1 -1
- package/dist/{oauth-state-store-DwAxMtk4.mjs → oauth-state-store-0C4s0K6w.mjs} +1 -1
- package/dist/{oauth-state-store-DwAxMtk4.mjs.map → oauth-state-store-0C4s0K6w.mjs.map} +1 -1
- package/dist/{oauth-user-lookup-BxfZizdk.mjs → oauth-user-lookup-wlGYSeqX.mjs} +1 -1
- package/dist/{oauth-user-lookup-BxfZizdk.mjs.map → oauth-user-lookup-wlGYSeqX.mjs.map} +1 -1
- package/dist/object-cache/memory.d.mts +1 -1
- package/dist/{options-CBXIHUoT.mjs → options-BHPeIbBd.mjs} +1 -1
- package/dist/{options-CBXIHUoT.mjs.map → options-BHPeIbBd.mjs.map} +1 -1
- package/dist/{options-DRe1pIBL.d.mts → options-BhZIeFY1.d.mts} +3 -3
- package/dist/{options-DRe1pIBL.d.mts.map → options-BhZIeFY1.d.mts.map} +1 -1
- package/dist/page/index.d.mts +2 -2
- package/dist/{parse-DFbuc-Fh.mjs → parse-BRJg1kz8.mjs} +2 -2
- package/dist/{parse-DFbuc-Fh.mjs.map → parse-BRJg1kz8.mjs.map} +1 -1
- package/dist/{passkey-config-_2GOwwK8.mjs → passkey-config-B3P0nHRR.mjs} +1 -1
- package/dist/{passkey-config-_2GOwwK8.mjs.map → passkey-config-B3P0nHRR.mjs.map} +1 -1
- package/dist/{patterns-CiyXeDgr.mjs → patterns-D9iDO3j8.mjs} +1 -1
- package/dist/{patterns-CiyXeDgr.mjs.map → patterns-D9iDO3j8.mjs.map} +1 -1
- package/dist/{placeholder-CzW7Lshs.d.mts → placeholder-BR4ZhVJl.d.mts} +7 -1
- package/dist/placeholder-BR4ZhVJl.d.mts.map +1 -0
- package/dist/plugin-types.d.mts +1 -1
- package/dist/plugin-utils.d.mts +10 -10
- package/dist/plugins/adapt-sandbox-entry.d.mts +10 -10
- package/dist/plugins/adapt-sandbox-entry.mjs +2 -2
- package/dist/policy-BVRganJQ.mjs +45 -0
- package/dist/policy-BVRganJQ.mjs.map +1 -0
- package/dist/{portable-text-DhKbDAGr.mjs → portable-text-C8Tvp4_g.mjs} +1 -1
- package/dist/{portable-text-DhKbDAGr.mjs.map → portable-text-C8Tvp4_g.mjs.map} +1 -1
- package/dist/{preview-PW-nOnq4.mjs → preview-dn2dUyM0.mjs} +2 -2
- package/dist/{preview-PW-nOnq4.mjs.map → preview-dn2dUyM0.mjs.map} +1 -1
- package/dist/protocol-CuBEsqgE.d.mts +52 -0
- package/dist/protocol-CuBEsqgE.d.mts.map +1 -0
- package/dist/{public-url-CWoFhQT8.mjs → public-url-DRz_AinV.mjs} +1 -1
- package/dist/{public-url-CWoFhQT8.mjs.map → public-url-DRz_AinV.mjs.map} +1 -1
- package/dist/{query-BgjfiLUQ.mjs → query-D18vTdha.mjs} +14 -14
- package/dist/{query-BgjfiLUQ.mjs.map → query-D18vTdha.mjs.map} +1 -1
- package/dist/{query-vgZNwIhh.mjs → query-tZDEdtCN.mjs} +4 -4
- package/dist/{query-vgZNwIhh.mjs.map → query-tZDEdtCN.mjs.map} +1 -1
- package/dist/{rate-limit-L5anykgo.mjs → rate-limit-on7KPo-v.mjs} +2 -2
- package/dist/{rate-limit-L5anykgo.mjs.map → rate-limit-on7KPo-v.mjs.map} +1 -1
- package/dist/{redirect-COsS6SWJ.mjs → redirect-CZkbozu9.mjs} +2 -2
- package/dist/{redirect-COsS6SWJ.mjs.map → redirect-CZkbozu9.mjs.map} +1 -1
- package/dist/{redirect-KBNE3UEs.mjs → redirect-DrbEmU9a.mjs} +1 -1
- package/dist/{redirect-KBNE3UEs.mjs.map → redirect-DrbEmU9a.mjs.map} +1 -1
- package/dist/{redirects-CufRQt0Q.mjs → redirects-BahWiu8Z.mjs} +5 -5
- package/dist/{redirects-CufRQt0Q.mjs.map → redirects-BahWiu8Z.mjs.map} +1 -1
- package/dist/{redirects-cV9g7V-0.mjs → redirects-CRIM55KH.mjs} +6 -6
- package/dist/{redirects-cV9g7V-0.mjs.map → redirects-CRIM55KH.mjs.map} +1 -1
- package/dist/{api-DdAsirBe.mjs → registry-BiO5WwPq.mjs} +483 -2462
- package/dist/registry-BiO5WwPq.mjs.map +1 -0
- package/dist/{registry-C581V4TP.mjs → registry-Cx-jEJOS.mjs} +9 -123
- package/dist/registry-Cx-jEJOS.mjs.map +1 -0
- package/dist/{relation-DtmAQH7s.mjs → relation-A6wLF_DS.mjs} +2 -2
- package/dist/{relation-DtmAQH7s.mjs.map → relation-A6wLF_DS.mjs.map} +1 -1
- package/dist/{relations-BBApI4e2.mjs → relations-BTPM2saV.mjs} +2 -2
- package/dist/{relations-BBApI4e2.mjs.map → relations-BTPM2saV.mjs.map} +1 -1
- package/dist/{relations-DItI3MN9.d.mts → relations-C7B46bcU.d.mts} +189 -30
- package/dist/relations-C7B46bcU.d.mts.map +1 -0
- package/dist/{relations-DICSyfsh.mjs → relations-Cj5hZ6Zg.mjs} +4 -4
- package/dist/{relations-DICSyfsh.mjs.map → relations-Cj5hZ6Zg.mjs.map} +1 -1
- package/dist/{request-cache-BSUptuJR.mjs → request-cache-DH9zdCOD.mjs} +1 -1
- package/dist/{request-cache-BSUptuJR.mjs.map → request-cache-DH9zdCOD.mjs.map} +1 -1
- package/dist/request-context.d.mts +1 -1
- package/dist/{request-meta-DgZJh3zG.mjs → request-meta-DRp5ENd_.mjs} +2 -2
- package/dist/{request-meta-DgZJh3zG.mjs.map → request-meta-DRp5ENd_.mjs.map} +1 -1
- package/dist/{resolve-DOhVEvty.mjs → resolve-DxUpTMmE.mjs} +1 -1
- package/dist/{resolve-DOhVEvty.mjs.map → resolve-DxUpTMmE.mjs.map} +1 -1
- package/dist/{runner-BiDvq5dv.mjs → runner-77GOZCnH.mjs} +443 -289
- package/dist/runner-77GOZCnH.mjs.map +1 -0
- package/dist/{runner-CgQbELYC.d.mts → runner-zgqA_CqP.d.mts} +16 -3
- package/dist/runner-zgqA_CqP.d.mts.map +1 -0
- package/dist/runtime.d.mts +11 -11
- package/dist/runtime.mjs +1 -1
- package/dist/{schema-BFyTg38T.mjs → schema-BY-oVntF.mjs} +3 -3
- package/dist/{schema-BFyTg38T.mjs.map → schema-BY-oVntF.mjs.map} +1 -1
- package/dist/{schema-CeQSNwB3.mjs → schema-Cw9kVK0I.mjs} +35 -5
- package/dist/{schema-CeQSNwB3.mjs.map → schema-Cw9kVK0I.mjs.map} +1 -1
- package/dist/{scopes-BVeuhGBE.mjs → scopes-vMR1uIbt.mjs} +3 -3
- package/dist/{scopes-BVeuhGBE.mjs.map → scopes-vMR1uIbt.mjs.map} +1 -1
- package/dist/{search-BpuPKZb0.mjs → search-CfT3KxO5.mjs} +4 -4
- package/dist/{search-BpuPKZb0.mjs.map → search-CfT3KxO5.mjs.map} +1 -1
- package/dist/{secrets-dtYs2hDo.mjs → secrets-BH2Qow1-.mjs} +3 -3
- package/dist/{secrets-dtYs2hDo.mjs.map → secrets-BH2Qow1-.mjs.map} +1 -1
- package/dist/{sections-COctk6hf.mjs → sections-DTfjyf1z.mjs} +2 -2
- package/dist/{sections-COctk6hf.mjs.map → sections-DTfjyf1z.mjs.map} +1 -1
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +24 -22
- package/dist/seo/index.d.mts +3 -3
- package/dist/seo/index.mjs +16 -14
- package/dist/seo/index.mjs.map +1 -1
- package/dist/{seo-AFpVvTqr.mjs → seo-BSiTIXzd.mjs} +1 -1
- package/dist/{seo-AFpVvTqr.mjs.map → seo-BSiTIXzd.mjs.map} +1 -1
- package/dist/{seo-CvDxfvFb.mjs → seo-Cm-dtvgk.mjs} +2 -2
- package/dist/{seo-CvDxfvFb.mjs.map → seo-Cm-dtvgk.mjs.map} +1 -1
- package/dist/{service-xMiMSTsR.mjs → service-DYsDHEKe.mjs} +3 -3
- package/dist/{service-xMiMSTsR.mjs.map → service-DYsDHEKe.mjs.map} +1 -1
- package/dist/{session-user-BzVemLkw.mjs → session-user-CNAfvsdw.mjs} +1 -1
- package/dist/{session-user-BzVemLkw.mjs.map → session-user-CNAfvsdw.mjs.map} +1 -1
- package/dist/{settings-B372MV0p.mjs → settings-BgN-0DT-.mjs} +6 -6
- package/dist/{settings-B372MV0p.mjs.map → settings-BgN-0DT-.mjs.map} +1 -1
- package/dist/{settings-BE9aqn_9.mjs → settings-DjtkUo__.mjs} +3 -3
- package/dist/{settings-BE9aqn_9.mjs.map → settings-DjtkUo__.mjs.map} +1 -1
- package/dist/{setup-complete-DF7TAfD5.mjs → setup-complete-CcpXaPU7.mjs} +2 -2
- package/dist/{setup-complete-DF7TAfD5.mjs.map → setup-complete-CcpXaPU7.mjs.map} +1 -1
- package/dist/{setup-nonce-Do-U_cg9.mjs → setup-nonce-Reyw30jg.mjs} +1 -1
- package/dist/{setup-nonce-Do-U_cg9.mjs.map → setup-nonce-Reyw30jg.mjs.map} +1 -1
- package/dist/{single-flight-cache-B0eLKS6K.mjs → single-flight-cache-BPuGPdcN.mjs} +2 -2
- package/dist/{single-flight-cache-B0eLKS6K.mjs.map → single-flight-cache-BPuGPdcN.mjs.map} +1 -1
- package/dist/{site-url-Bowsi9T-.mjs → site-url-Cs_V9n3V.mjs} +3 -3
- package/dist/{site-url-Bowsi9T-.mjs.map → site-url-Cs_V9n3V.mjs.map} +1 -1
- package/dist/{snapshot-B5h6aPMh.mjs → snapshot-DSB8P7Lm.mjs} +1 -1
- package/dist/{snapshot-B5h6aPMh.mjs.map → snapshot-DSB8P7Lm.mjs.map} +1 -1
- package/dist/{ssrf-Cpvg_n3A.mjs → ssrf-DqebVE34.mjs} +21 -5
- package/dist/{ssrf-Cpvg_n3A.mjs.map → ssrf-DqebVE34.mjs.map} +1 -1
- package/dist/{state-DYwPue40.mjs → state-BJfU9Uzw.mjs} +12 -4
- package/dist/state-BJfU9Uzw.mjs.map +1 -0
- package/dist/{status-CWVYpbD8.mjs → status-DDu8HIQl.mjs} +1 -1
- package/dist/{status-CWVYpbD8.mjs.map → status-DDu8HIQl.mjs.map} +1 -1
- package/dist/storage/local.d.mts +1 -1
- package/dist/storage/local.mjs +3 -3
- package/dist/storage/s3.d.mts +1 -1
- package/dist/storage/s3.mjs +1 -1
- package/dist/target-D0o26Azo.mjs +27 -0
- package/dist/target-D0o26Azo.mjs.map +1 -0
- package/dist/{taxonomies-Dk3MAklL.mjs → taxonomies-CPGxo-bn.mjs} +5 -5
- package/dist/{taxonomies-Dk3MAklL.mjs.map → taxonomies-CPGxo-bn.mjs.map} +1 -1
- package/dist/{taxonomies-B0o9ExNV.mjs → taxonomies-kmyudNGP.mjs} +7 -7
- package/dist/{taxonomies-B0o9ExNV.mjs.map → taxonomies-kmyudNGP.mjs.map} +1 -1
- package/dist/{taxonomy-CPeM8d2o.mjs → taxonomy-8X09dLN5.mjs} +4 -4
- package/dist/{taxonomy-CPeM8d2o.mjs.map → taxonomy-8X09dLN5.mjs.map} +1 -1
- package/dist/{tokens-C39klX8R.mjs → tokens-gTS-IVUp.mjs} +1 -1
- package/dist/{tokens-C39klX8R.mjs.map → tokens-gTS-IVUp.mjs.map} +1 -1
- package/dist/{transaction-NQj4VJ7Z.mjs → transaction-0KOpOyMu.mjs} +2 -1
- package/dist/{transaction-NQj4VJ7Z.mjs.map → transaction-0KOpOyMu.mjs.map} +1 -1
- package/dist/{transport-B_rfeU-a.d.mts → transport-_6R1ub7t.d.mts} +1 -1
- package/dist/{transport-B_rfeU-a.d.mts.map → transport-_6R1ub7t.d.mts.map} +1 -1
- package/dist/{transport--CfOflrp.mjs → transport-fX59xaJz.mjs} +4 -3
- package/dist/{transport--CfOflrp.mjs.map → transport-fX59xaJz.mjs.map} +1 -1
- package/dist/{trusted-proxy-CEVekpby.mjs → trusted-proxy-fe6nEgR4.mjs} +1 -1
- package/dist/{trusted-proxy-CEVekpby.mjs.map → trusted-proxy-fe6nEgR4.mjs.map} +1 -1
- package/dist/types-75KIqzL9.mjs.map +1 -1
- package/dist/{types-BW1syrlw.mjs → types-BXUmsINL.mjs} +1 -1
- package/dist/{types-BW1syrlw.mjs.map → types-BXUmsINL.mjs.map} +1 -1
- package/dist/{types-CPx2lIGo.d.mts → types-Blb-MRC3.d.mts} +1 -1
- package/dist/{types-CPx2lIGo.d.mts.map → types-Blb-MRC3.d.mts.map} +1 -1
- package/dist/{types-C3_AbkDP.d.mts → types-Br-ERaxh.d.mts} +2 -1
- package/dist/types-Br-ERaxh.d.mts.map +1 -0
- package/dist/{types-BPuloofb.d.mts → types-BzBd3PeX.d.mts} +1 -1
- package/dist/{types-BPuloofb.d.mts.map → types-BzBd3PeX.d.mts.map} +1 -1
- package/dist/{types-DefV3OiO.d.mts → types-CLqvnd05.d.mts} +1 -1
- package/dist/{types-DefV3OiO.d.mts.map → types-CLqvnd05.d.mts.map} +1 -1
- package/dist/{types-X0MThr7x.d.mts → types-D5VVLr7J.d.mts} +1 -1
- package/dist/{types-X0MThr7x.d.mts.map → types-D5VVLr7J.d.mts.map} +1 -1
- package/dist/{types-CAGdePf3.d.mts → types-DHxzBjbD.d.mts} +10 -1
- package/dist/types-DHxzBjbD.d.mts.map +1 -0
- package/dist/{types-D4_1Ga4L.d.mts → types-DJQxln7q.d.mts} +3 -3
- package/dist/{types-D4_1Ga4L.d.mts.map → types-DJQxln7q.d.mts.map} +1 -1
- package/dist/{types-CtzytVXn.mjs → types-DM3vioBY.mjs} +1 -1
- package/dist/{types-CtzytVXn.mjs.map → types-DM3vioBY.mjs.map} +1 -1
- package/dist/{types-CFUfyt1s.d.mts → types-D_DWe7k9.d.mts} +1 -1
- package/dist/{types-CFUfyt1s.d.mts.map → types-D_DWe7k9.d.mts.map} +1 -1
- package/dist/{types-Cs-TFLNf.d.mts → types-Vg6f5i3s.d.mts} +3 -3
- package/dist/{types-Cs-TFLNf.d.mts.map → types-Vg6f5i3s.d.mts.map} +1 -1
- package/dist/{upload-attempts-hlne3iA1.mjs → upload-attempts-CNyGSepg.mjs} +1 -1
- package/dist/{upload-attempts-hlne3iA1.mjs.map → upload-attempts-CNyGSepg.mjs.map} +1 -1
- package/dist/{url-pattern-BHS0V5Ng.mjs → url-pattern-K-KdXcSe.mjs} +1 -1
- package/dist/{url-pattern-BHS0V5Ng.mjs.map → url-pattern-K-KdXcSe.mjs.map} +1 -1
- package/dist/{user-sHgJ62SP.mjs → user-CtYY0tp2.mjs} +2 -2
- package/dist/{user-sHgJ62SP.mjs.map → user-CtYY0tp2.mjs.map} +1 -1
- package/dist/{utils-D4vD_Y98.mjs → utils-HztC73hq.mjs} +1 -1
- package/dist/{utils-D4vD_Y98.mjs.map → utils-HztC73hq.mjs.map} +1 -1
- package/dist/{validate-BkqIG_Uj.mjs → validate-Dd-IUjnZ.mjs} +2 -2
- package/dist/{validate-BkqIG_Uj.mjs.map → validate-Dd-IUjnZ.mjs.map} +1 -1
- package/dist/{validate-DeGtBN84.d.mts → validate-DlqdOZXB.d.mts} +5 -5
- package/dist/{validate-DeGtBN84.d.mts.map → validate-DlqdOZXB.d.mts.map} +1 -1
- package/dist/{validation-CiJb_X5o.mjs → validation-D83n7Npi.mjs} +10 -8
- package/dist/{validation-CiJb_X5o.mjs.map → validation-D83n7Npi.mjs.map} +1 -1
- package/dist/version-ri-sCyAp.mjs +7 -0
- package/dist/{version-x0NjTScG.mjs.map → version-ri-sCyAp.mjs.map} +1 -1
- package/dist/{widgets-Cwzvww0W.mjs → widgets-CpmZd9Q-.mjs} +4 -4
- package/dist/{widgets-Cwzvww0W.mjs.map → widgets-CpmZd9Q-.mjs.map} +1 -1
- package/dist/{wxr-taxonomies-CmC0ZsDr.d.mts → wxr-taxonomies-BFd0y72_.d.mts} +1 -1
- package/dist/{wxr-taxonomies-CmC0ZsDr.d.mts.map → wxr-taxonomies-BFd0y72_.d.mts.map} +1 -1
- package/dist/{wxr-taxonomies-QZjWxjyk.mjs → wxr-taxonomies-Df4vxWcU.mjs} +4 -4
- package/dist/{wxr-taxonomies-QZjWxjyk.mjs.map → wxr-taxonomies-Df4vxWcU.mjs.map} +1 -1
- package/dist/{zod-generator-D11MhxG4.mjs → zod-generator-DylzusHh.mjs} +24 -18
- package/dist/zod-generator-DylzusHh.mjs.map +1 -0
- package/package.json +32 -8
- package/src/api/errors.ts +20 -0
- package/src/api/handlers/index.ts +17 -0
- package/src/api/handlers/media-allowlist.ts +1 -0
- package/src/api/handlers/media-folders.ts +130 -0
- package/src/api/handlers/media-usage-activation.ts +102 -0
- package/src/api/handlers/media-usage.ts +108 -0
- package/src/api/handlers/media.ts +62 -2
- package/src/api/handlers/registry.ts +134 -316
- package/src/api/openapi/document.ts +192 -2
- package/src/api/schemas/media-usage.ts +77 -0
- package/src/api/schemas/media.ts +69 -0
- package/src/astro/integration/index.ts +46 -14
- package/src/astro/integration/routes.ts +18 -0
- package/src/astro/integration/runtime.ts +3 -0
- package/src/astro/integration/vite-config.ts +2 -7
- package/src/astro/middleware/auth.ts +4 -0
- package/src/astro/middleware/scoped-db.ts +21 -0
- package/src/astro/middleware.ts +67 -17
- package/src/astro/routes/api/admin/media-usage/activation.ts +42 -0
- package/src/astro/routes/api/admin/media-usage/progress.ts +37 -0
- package/src/astro/routes/api/admin/plugins/registry/artifact.ts +246 -96
- package/src/astro/routes/api/auth/dev-bypass.ts +0 -4
- package/src/astro/routes/api/auth/me.ts +14 -2
- package/src/astro/routes/api/media/[id].ts +3 -0
- 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.ts +12 -2
- package/src/astro/routes/api/setup/dev-bypass.ts +14 -7
- package/src/astro/routes/api/setup/index.ts +5 -13
- package/src/astro/types.ts +11 -1
- package/src/cli/commands/migrate.ts +593 -0
- package/src/cli/index.ts +2 -23
- package/src/client/index.ts +140 -2
- package/src/client/transport.ts +6 -2
- package/src/components/EmDashImage.astro +154 -50
- package/src/components/Gallery.astro +7 -0
- package/src/components/InlinePortableTextEditor.tsx +130 -1
- package/src/components/LiveSearch.astro +23 -0
- package/src/components/inline-code-block.tsx +180 -49
- package/src/content/converters/gallery.ts +2 -0
- package/src/content/converters/types.ts +2 -0
- package/src/database/connection.ts +2 -31
- package/src/database/index.ts +9 -3
- package/src/database/json-recordset.ts +16 -0
- package/src/database/migrations/019_i18n.ts +1 -1
- 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/policy.ts +70 -0
- package/src/database/migrations/runner.ts +57 -5
- package/src/database/repositories/content.ts +5 -4
- package/src/database/repositories/media-folders.ts +115 -0
- package/src/database/repositories/media-usage-work.ts +395 -111
- package/src/database/repositories/media-usage.ts +1038 -10
- package/src/database/repositories/media.ts +97 -29
- package/src/database/transaction.ts +1 -0
- package/src/database/types.ts +13 -0
- package/src/db/adapters.ts +52 -4
- package/src/db/index.ts +3 -1
- package/src/db/libsql-migrations.ts +72 -0
- package/src/db/node-sqlite-compat.ts +78 -0
- package/src/db/postgres-migrations.ts +59 -0
- package/src/db/sqlite-migrations.ts +37 -0
- package/src/db/sqlite.ts +3 -3
- package/src/emdash-runtime.ts +154 -120
- package/src/fields/image.ts +7 -1
- package/src/fields/types.ts +6 -2
- package/src/i18n/normalize.ts +31 -0
- package/src/index.ts +12 -1
- package/src/media/focal-point.ts +37 -0
- package/src/media/local-runtime.ts +8 -0
- package/src/media/mime.ts +1 -0
- package/src/media/normalize.ts +10 -0
- package/src/media/types.ts +10 -0
- package/src/media/usage/activation.ts +162 -35
- package/src/media/usage/capture-triggers.ts +19 -3
- package/src/media/usage/collection-deletion-processor.ts +7 -3
- package/src/media/usage/collection-deletion.ts +10 -0
- package/src/media/usage/content-refresh.ts +258 -39
- package/src/media/usage/content-snapshots.ts +128 -31
- package/src/media/usage/extractor.ts +32 -13
- package/src/media/usage/maintenance-engine.ts +166 -0
- package/src/media/usage/reconciliation-processor.ts +106 -29
- package/src/media/usage/reconciliation.ts +90 -7
- package/src/media/usage/work-processor.ts +342 -101
- package/src/migrations/config-loader.ts +205 -0
- package/src/migrations/direct-executor.ts +141 -0
- package/src/migrations/identity.ts +46 -0
- package/src/migrations/index.ts +19 -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 +59 -0
- package/src/migrations/target.ts +35 -0
- package/src/plugins/index.ts +1 -0
- package/src/plugins/save-rejection.ts +20 -0
- package/src/plugins/scheduler/node.ts +1 -13
- package/src/plugins/scheduler/types.ts +0 -2
- package/src/plugins/state.ts +13 -3
- package/src/registry/artifact-fetch.ts +530 -0
- package/src/registry/config.ts +24 -6
- package/src/registry/types.ts +12 -15
- package/src/schema/types.ts +1 -0
- package/src/schema/zod-generator.ts +12 -4
- package/src/security/ssrf.ts +21 -2
- package/src/seed/apply.ts +4 -4
- package/src/ui.ts +2 -0
- package/src/virtual-modules.d.ts +8 -0
- package/dist/adapters-34EN2eXO.d.mts.map +0 -1
- package/dist/api-DdAsirBe.mjs.map +0 -1
- package/dist/collection-deletion-C8BugSGz.mjs.map +0 -1
- package/dist/content-BNfwh7xX.mjs.map +0 -1
- package/dist/content-refresh-DNERP4-f.mjs.map +0 -1
- package/dist/errors-CLUPm7aD.mjs.map +0 -1
- package/dist/index-C3Y-rsyN.d.mts.map +0 -1
- package/dist/media-BWWWb8kg.mjs.map +0 -1
- package/dist/media-CzhAn2--.mjs.map +0 -1
- package/dist/media-allowlist-BD6HhgXA.mjs.map +0 -1
- package/dist/media-usage-De3qvwjc.mjs.map +0 -1
- package/dist/media-usage-work-DrCbqBcl.mjs.map +0 -1
- package/dist/menus-CC-yn1F9.mjs.map +0 -1
- package/dist/mime-DfIVjNkr.mjs.map +0 -1
- package/dist/normalize-Bc-s_r-a.mjs.map +0 -1
- package/dist/placeholder-CzW7Lshs.d.mts.map +0 -1
- package/dist/registry-C581V4TP.mjs.map +0 -1
- package/dist/relations-DItI3MN9.d.mts.map +0 -1
- package/dist/runner-BiDvq5dv.mjs.map +0 -1
- package/dist/runner-CgQbELYC.d.mts.map +0 -1
- package/dist/state-DYwPue40.mjs.map +0 -1
- package/dist/types-C3_AbkDP.d.mts.map +0 -1
- package/dist/types-CAGdePf3.d.mts.map +0 -1
- package/dist/version-x0NjTScG.mjs +0 -7
- package/dist/zod-generator-D11MhxG4.mjs.map +0 -1
- /package/dist/{api-tokens-CyTsLszZ.mjs → api-tokens-B5NHLNUN.mjs} +0 -0
- /package/dist/{ssrf-DpXgKsna.mjs → ssrf-BPKzkm6O.mjs} +0 -0
- /package/dist/{types-CP1CflWf.mjs → types-D6OcIp2P.mjs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-builder-QXuqvVMP.mjs","names":[],"sources":["../src/i18n/normalize.ts","../src/migrations/manifest.ts","../src/migrations/integration-metadata.ts","../src/migrations/manifest-builder.ts"],"sourcesContent":["import type { I18nConfig } from \"./config.js\";\n\nexport interface AstroLocaleObject {\n\tpath: string;\n\tcodes: readonly string[];\n}\n\nexport interface AstroI18nInput {\n\tdefaultLocale: string;\n\tlocales: readonly (string | AstroLocaleObject)[];\n\tfallback?: Readonly<Record<string, string | undefined>>;\n\trouting?: string | { prefixDefaultLocale?: boolean };\n}\n\nexport function normalizeAstroI18n(config: AstroI18nInput | null | undefined): I18nConfig | null {\n\tif (!config) return null;\n\n\treturn {\n\t\tdefaultLocale: config.defaultLocale,\n\t\tlocales: config.locales.map((locale) => (typeof locale === \"string\" ? locale : locale.path)),\n\t\tfallback: config.fallback\n\t\t\t? Object.fromEntries(\n\t\t\t\t\tObject.entries(config.fallback).filter(\n\t\t\t\t\t\t(entry): entry is [string, string] => entry[1] !== undefined,\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t: undefined,\n\t\tprefixDefaultLocale:\n\t\t\ttypeof config.routing === \"object\" ? (config.routing.prefixDefaultLocale ?? false) : false,\n\t};\n}\n","import { z } from \"zod\";\n\nimport type { CoreMigrationIdentity } from \"./identity.js\";\nimport { fingerprintMigrationSet } from \"./identity.js\";\n\nconst FINGERPRINT_PATTERN = /^[0-9a-f]{64}$/;\nconst MIGRATION_NAME_PATTERN = /^\\d{3}_[a-z0-9_]+$/;\nconst EXECUTOR_ENTRYPOINT_PATTERN =\n\t/^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*(?:\\/[A-Za-z0-9][A-Za-z0-9._-]*)*$/;\nconst ENVIRONMENT_VARIABLE_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;\nconst ENVIRONMENT_REFERENCE_KEY_PATTERN = /(?:env|envName|envVar)$/i;\nconst URL_SCHEME_PATTERN = /^[A-Za-z][A-Za-z0-9+.-]*:/;\nconst SECRET_QUERY_KEY_PATTERN = /(?:auth|credential|key|password|secret|signature|token)/i;\nconst SECRET_CONFIG_KEY_PATTERN =\n\t/(?:accessToken|apiKey|authToken|certificate|connectionString|password|privateKey|secret)/i;\nconst SECRET_CONFIG_EXACT_KEY_PATTERN = /^(?:ca|cert|key)$/i;\nconst CONNECTION_URL_PROTOCOLS = new Set([\"mysql:\", \"postgres:\", \"postgresql:\"]);\n\ntype JsonPrimitive = boolean | number | string | null;\ntype JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };\n\nconst i18nConfigSchema = z\n\t.object({\n\t\tdefaultLocale: z.string().min(1),\n\t\tlocales: z.array(z.string().min(1)).min(1),\n\t\tfallback: z.record(z.string(), z.string()).optional(),\n\t\tprefixDefaultLocale: z.boolean().optional(),\n\t})\n\t.strict();\n\nexport const migrationManifestV1Schema = z\n\t.object({\n\t\tschemaVersion: z.literal(1),\n\t\temdashVersion: z.string().min(1),\n\t\tmigrationSet: z\n\t\t\t.object({\n\t\t\t\tnames: z\n\t\t\t\t\t.array(z.string().regex(MIGRATION_NAME_PATTERN))\n\t\t\t\t\t.min(1)\n\t\t\t\t\t.refine((names) => new Set(names).size === names.length),\n\t\t\t\tfingerprint: z.string().regex(FINGERPRINT_PATTERN),\n\t\t\t})\n\t\t\t.strict(),\n\t\ti18n: i18nConfigSchema.nullable(),\n\t\tdatabase: z\n\t\t\t.object({\n\t\t\t\ttype: z.enum([\"sqlite\", \"postgres\"]),\n\t\t\t\texecutorEntrypoint: z.string().regex(EXECUTOR_ENTRYPOINT_PATTERN),\n\t\t\t\texecutorConfig: z.unknown(),\n\t\t\t})\n\t\t\t.strict(),\n\t})\n\t.strict();\n\nexport type MigrationManifestV1 = z.infer<typeof migrationManifestV1Schema>;\n\nexport class MigrationManifestValidationError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(`Invalid migration manifest: ${message}`);\n\t\tthis.name = \"MigrationManifestValidationError\";\n\t}\n}\n\nfunction isEnvironmentReferenceKey(key: string): boolean {\n\treturn ENVIRONMENT_REFERENCE_KEY_PATTERN.test(key);\n}\n\nfunction assertSafeUrl(value: string, path: string): void {\n\tif (!URL_SCHEME_PATTERN.test(value)) return;\n\n\tlet url: URL;\n\ttry {\n\t\turl = new URL(value);\n\t} catch {\n\t\tthrow new MigrationManifestValidationError(`${path} contains an invalid URL`);\n\t}\n\n\tif (CONNECTION_URL_PROTOCOLS.has(url.protocol)) {\n\t\tthrow new MigrationManifestValidationError(`${path} contains a database connection URL`);\n\t}\n\tif (url.username || url.password) {\n\t\tthrow new MigrationManifestValidationError(`${path} contains URL credentials`);\n\t}\n\tfor (const key of url.searchParams.keys()) {\n\t\tif (SECRET_QUERY_KEY_PATTERN.test(key)) {\n\t\t\tthrow new MigrationManifestValidationError(`${path} contains a credential query parameter`);\n\t\t}\n\t}\n}\n\nfunction cloneSecretFreeJson(value: unknown, path: string, ancestors: Set<object>): JsonValue {\n\tif (value === null || typeof value === \"boolean\") return value;\n\tif (typeof value === \"string\") {\n\t\tassertSafeUrl(value, path);\n\t\treturn value;\n\t}\n\tif (typeof value === \"number\") {\n\t\tif (Number.isFinite(value)) return value;\n\t\tthrow new MigrationManifestValidationError(`${path} contains a non-finite number`);\n\t}\n\tif (typeof value !== \"object\") {\n\t\tthrow new MigrationManifestValidationError(`${path} is not JSON-serializable`);\n\t}\n\tif (ancestors.has(value)) {\n\t\tthrow new MigrationManifestValidationError(`${path} contains a cycle`);\n\t}\n\n\tancestors.add(value);\n\ttry {\n\t\tif (Array.isArray(value)) {\n\t\t\treturn value.map((item, index) => cloneSecretFreeJson(item, `${path}[${index}]`, ancestors));\n\t\t}\n\n\t\tconst prototype = Object.getPrototypeOf(value);\n\t\tif (prototype !== Object.prototype && prototype !== null) {\n\t\t\tthrow new MigrationManifestValidationError(`${path} contains a non-plain object`);\n\t\t}\n\n\t\tconst cloned: Record<string, JsonValue> = {};\n\t\tfor (const [key, item] of Object.entries(value)) {\n\t\t\tconst itemPath = `${path}.${key}`;\n\t\t\tconst environmentReference = isEnvironmentReferenceKey(key);\n\t\t\tif (\n\t\t\t\t!environmentReference &&\n\t\t\t\t(SECRET_CONFIG_KEY_PATTERN.test(key) || SECRET_CONFIG_EXACT_KEY_PATTERN.test(key))\n\t\t\t) {\n\t\t\t\tthrow new MigrationManifestValidationError(`${itemPath} is a credential-bearing field`);\n\t\t\t}\n\t\t\tif (environmentReference) {\n\t\t\t\tif (typeof item !== \"string\" || !ENVIRONMENT_VARIABLE_PATTERN.test(item)) {\n\t\t\t\t\tthrow new MigrationManifestValidationError(\n\t\t\t\t\t\t`${itemPath} must contain an environment-variable name`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcloned[key] = cloneSecretFreeJson(item, itemPath, ancestors);\n\t\t}\n\t\treturn cloned;\n\t} finally {\n\t\tancestors.delete(value);\n\t}\n}\n\nexport function validateSecretFreeExecutorConfig(\n\tvalue: unknown,\n\tpath = \"database.executorConfig\",\n): unknown {\n\treturn cloneSecretFreeJson(value, path, new Set());\n}\n\nfunction identitiesMatch(\n\tmanifest: MigrationManifestV1,\n\texpectedIdentity: CoreMigrationIdentity,\n): boolean {\n\treturn (\n\t\tmanifest.emdashVersion === expectedIdentity.emdashVersion &&\n\t\tmanifest.migrationSet.fingerprint === expectedIdentity.fingerprint &&\n\t\tmanifest.migrationSet.names.length === expectedIdentity.names.length &&\n\t\tmanifest.migrationSet.names.every((name, index) => name === expectedIdentity.names[index])\n\t);\n}\n\nexport async function validateMigrationManifest(\n\tvalue: unknown,\n\texpectedIdentity?: CoreMigrationIdentity,\n): Promise<MigrationManifestV1> {\n\tconst parsed = migrationManifestV1Schema.safeParse(value);\n\tif (!parsed.success) {\n\t\tthrow new MigrationManifestValidationError(\"schema validation failed\");\n\t}\n\n\tconst executorConfig = validateSecretFreeExecutorConfig(parsed.data.database.executorConfig);\n\tconst manifest: MigrationManifestV1 = {\n\t\t...parsed.data,\n\t\tdatabase: { ...parsed.data.database, executorConfig },\n\t};\n\tconst fingerprint = await fingerprintMigrationSet(\n\t\tmanifest.emdashVersion,\n\t\tmanifest.migrationSet.names,\n\t);\n\tif (fingerprint !== manifest.migrationSet.fingerprint) {\n\t\tthrow new MigrationManifestValidationError(\n\t\t\t\"migrationSet fingerprint does not match its version and ordered names\",\n\t\t);\n\t}\n\tif (expectedIdentity && !identitiesMatch(manifest, expectedIdentity)) {\n\t\tthrow new MigrationManifestValidationError(\n\t\t\t\"manifest does not match the loaded EmDash migration identity\",\n\t\t);\n\t}\n\n\treturn manifest;\n}\n\nexport function serializeMigrationManifest(manifest: MigrationManifestV1): string {\n\treturn `${JSON.stringify(manifest, null, \"\\t\")}\\n`;\n}\n","import type { DatabaseDescriptor } from \"../db/adapters.js\";\nimport { validateSecretFreeExecutorConfig } from \"./manifest.js\";\n\nexport const MIGRATION_CONFIG_SYMBOL = Symbol.for(\"emdash:migration-config\");\n\nexport interface MigrationIntegrationMetadata {\n\tdatabase?: Pick<DatabaseDescriptor, \"type\" | \"migrations\">;\n}\n\nfunction isRecord(value: unknown): value is Record<PropertyKey, unknown> {\n\treturn typeof value === \"object\" && value !== null;\n}\n\nfunction isMigrationIntegrationMetadata(value: unknown): value is MigrationIntegrationMetadata {\n\tif (!isRecord(value)) return false;\n\tconst database = value.database;\n\tif (database === undefined) return true;\n\tif (!isRecord(database) || (database.type !== \"sqlite\" && database.type !== \"postgres\")) {\n\t\treturn false;\n\t}\n\n\tconst migrations = database.migrations;\n\treturn (\n\t\tmigrations === undefined ||\n\t\t(isRecord(migrations) &&\n\t\t\ttypeof migrations.entrypoint === \"string\" &&\n\t\t\tObject.hasOwn(migrations, \"manifestConfig\"))\n\t);\n}\n\nexport function createMigrationIntegrationMetadata(\n\tdatabase?: DatabaseDescriptor,\n): MigrationIntegrationMetadata {\n\tif (!database) return {};\n\n\treturn {\n\t\tdatabase: {\n\t\t\ttype: database.type,\n\t\t\tmigrations: database.migrations\n\t\t\t\t? {\n\t\t\t\t\t\tentrypoint: database.migrations.entrypoint,\n\t\t\t\t\t\tmanifestConfig: validateSecretFreeExecutorConfig(\n\t\t\t\t\t\t\tdatabase.migrations.manifestConfig,\n\t\t\t\t\t\t\t\"database.migrations.manifestConfig\",\n\t\t\t\t\t\t),\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t\t},\n\t};\n}\n\nexport function getMigrationIntegrationMetadata(\n\tintegration: unknown,\n): MigrationIntegrationMetadata | undefined {\n\tif (\n\t\t(typeof integration !== \"object\" || integration === null) &&\n\t\ttypeof integration !== \"function\"\n\t) {\n\t\treturn undefined;\n\t}\n\tif (!Object.hasOwn(integration, MIGRATION_CONFIG_SYMBOL)) {\n\t\treturn undefined;\n\t}\n\n\tconst metadata: unknown = Reflect.get(integration, MIGRATION_CONFIG_SYMBOL);\n\treturn isMigrationIntegrationMetadata(metadata) ? metadata : undefined;\n}\n","import type { DatabaseDescriptor } from \"../db/adapters.js\";\nimport type { I18nConfig } from \"../i18n/config.js\";\nimport type { CoreMigrationIdentity } from \"./identity.js\";\nimport { fingerprintMigrationSet } from \"./identity.js\";\nimport type { MigrationManifestV1 } from \"./manifest.js\";\nimport { MigrationManifestValidationError, validateMigrationManifest } from \"./manifest.js\";\n\nexport type ManifestDatabaseDescriptor = Pick<DatabaseDescriptor, \"type\" | \"migrations\">;\n\nexport interface BuildMigrationManifestOptions {\n\tidentity: CoreMigrationIdentity;\n\ti18n: I18nConfig | null;\n\tdatabase: ManifestDatabaseDescriptor;\n}\n\nexport class UnsupportedMigrationAdapterError extends Error {\n\tconstructor() {\n\t\tsuper(\"The configured database adapter does not provide a deployment migration executor\");\n\t\tthis.name = \"UnsupportedMigrationAdapterError\";\n\t}\n}\n\nexport async function buildMigrationManifest({\n\tidentity,\n\ti18n,\n\tdatabase,\n}: BuildMigrationManifestOptions): Promise<MigrationManifestV1> {\n\tconst identityFingerprint = await fingerprintMigrationSet(identity.emdashVersion, identity.names);\n\tif (identityFingerprint !== identity.fingerprint) {\n\t\tthrow new MigrationManifestValidationError(\n\t\t\t\"loaded identity fingerprint does not match its version and ordered names\",\n\t\t);\n\t}\n\tif (!database.migrations) {\n\t\tthrow new UnsupportedMigrationAdapterError();\n\t}\n\n\treturn validateMigrationManifest(\n\t\t{\n\t\t\tschemaVersion: 1,\n\t\t\temdashVersion: identity.emdashVersion,\n\t\t\tmigrationSet: {\n\t\t\t\tnames: [...identity.names],\n\t\t\t\tfingerprint: identity.fingerprint,\n\t\t\t},\n\t\t\ti18n,\n\t\t\tdatabase: {\n\t\t\t\ttype: database.type,\n\t\t\t\texecutorEntrypoint: database.migrations.entrypoint,\n\t\t\t\texecutorConfig: database.migrations.manifestConfig,\n\t\t\t},\n\t\t},\n\t\tidentity,\n\t);\n}\n"],"mappings":";;;;AAcA,SAAgB,mBAAmB,QAA8D;AAChG,KAAI,CAAC,OAAQ,QAAO;AAEpB,QAAO;EACN,eAAe,OAAO;EACtB,SAAS,OAAO,QAAQ,KAAK,WAAY,OAAO,WAAW,WAAW,SAAS,OAAO,KAAM;EAC5F,UAAU,OAAO,WACd,OAAO,YACP,OAAO,QAAQ,OAAO,SAAS,CAAC,QAC9B,UAAqC,MAAM,OAAO,OACnD,CACD,GACA;EACH,qBACC,OAAO,OAAO,YAAY,WAAY,OAAO,QAAQ,uBAAuB,QAAS;EACtF;;;;;ACxBF,MAAM,sBAAsB;AAC5B,MAAM,yBAAyB;AAC/B,MAAM,8BACL;AACD,MAAM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AS;EACxB,cAAc;GACb,OAAO,CAAC,GAAG,SAAS,MAAM;GAC1B,aAAa,SAAS;GACtB;EACD;EACA,UAAU;GACT,MAAM,SAAS;GACf,oBAAoB,SAAS,WAAW;GACxC,gBAAgB,SAAS,WAAW;GACpC;EACD,EACD,SACA"}
|
|
@@ -298,4 +298,4 @@ function normalizeManifestRoute(entry) {
|
|
|
298
298
|
|
|
299
299
|
//#endregion
|
|
300
300
|
export { reconcileManifestAccess as a, pluginManifestSchema as i, PLUGIN_CAPABILITIES as n, normalizeManifestRoute as r, HOOK_NAMES as t };
|
|
301
|
-
//# sourceMappingURL=manifest-schema-
|
|
301
|
+
//# sourceMappingURL=manifest-schema-CUYPfCEH.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest-schema-BXbUAHod.mjs","names":[],"sources":["../src/plugins/manifest-schema.ts"],"sourcesContent":["/**\n * Zod schema for PluginManifest validation\n *\n * Used to validate manifest.json from plugin bundles at every parse site:\n * - Client-side download (marketplace.ts extractBundle)\n * - R2 load (api/handlers/marketplace.ts loadBundleFromR2)\n * - CLI publish preview (cli/commands/publish.ts readManifestFromTarball)\n * - Marketplace ingest extends this with publishing-specific fields\n */\n\nimport { Permissions } from \"@emdash-cms/auth\";\nimport {\n\tcapabilitiesToDeclaredAccess,\n\tdeclaredAccessToCapabilities,\n} from \"@emdash-cms/plugin-types\";\nimport { z } from \"zod\";\n\nimport type { PluginManifest } from \"./types.js\";\n\n// ── Enum values (must stay in sync with types.ts) ───────────────\n\n/**\n * Current capability names — the ones authors should use going forward.\n * See `PluginCapability` in `types.ts` for documentation of each.\n */\nexport const CURRENT_PLUGIN_CAPABILITIES = [\n\t\"network:request\",\n\t\"network:request:unrestricted\",\n\t\"content:read\",\n\t\"content:write\",\n\t\"taxonomies:read\",\n\t\"media:read\",\n\t\"media:write\",\n\t\"users:read\",\n\t\"email:send\",\n\t\"hooks.email-transport:register\",\n\t\"hooks.email-events:register\",\n\t\"hooks.page-fragments:register\",\n] as const;\n\n/**\n * Legacy capability names accepted during the deprecation window.\n * Normalized to current names via `normalizeCapability()` in types.ts\n * before reaching the runtime. Plugin authors are warned at bundle/validate\n * and hard-failed at publish.\n */\nexport const DEPRECATED_PLUGIN_CAPABILITIES = [\n\t\"network:fetch\",\n\t\"network:fetch:any\",\n\t\"read:content\",\n\t\"write:content\",\n\t\"read:media\",\n\t\"write:media\",\n\t\"read:users\",\n\t\"email:provide\",\n\t\"email:intercept\",\n\t\"page:inject\",\n] as const;\n\n/**\n * Full set of accepted capability strings — current + deprecated.\n *\n * The manifest schema accepts both during the transition. The runtime only\n * ever sees current names because `normalizeCapability()` rewrites legacy\n * names at every external boundary (definePlugin, adaptSandboxEntry).\n */\nexport const PLUGIN_CAPABILITIES = [\n\t...CURRENT_PLUGIN_CAPABILITIES,\n\t...DEPRECATED_PLUGIN_CAPABILITIES,\n] as const;\n\n/** Must stay in sync with FieldType in schema/types.ts */\nconst FIELD_TYPES = [\n\t\"string\",\n\t\"text\",\n\t\"number\",\n\t\"integer\",\n\t\"boolean\",\n\t\"datetime\",\n\t\"select\",\n\t\"multiSelect\",\n\t\"portableText\",\n\t\"image\",\n\t\"file\",\n\t\"reference\",\n\t\"json\",\n\t\"slug\",\n\t\"repeater\",\n] as const;\n\nexport const HOOK_NAMES = [\n\t\"plugin:install\",\n\t\"plugin:activate\",\n\t\"plugin:deactivate\",\n\t\"plugin:uninstall\",\n\t\"content:beforeSave\",\n\t\"content:afterSave\",\n\t\"content:beforeDelete\",\n\t\"content:afterDelete\",\n\t\"content:afterPublish\",\n\t\"content:afterUnpublish\",\n\t\"content:afterRestore\",\n\t\"content:afterSchedule\",\n\t\"content:afterUnschedule\",\n\t\"media:beforeUpload\",\n\t\"media:afterUpload\",\n\t\"cron\",\n\t\"email:beforeSend\",\n\t\"email:deliver\",\n\t\"email:afterSend\",\n\t\"comment:beforeCreate\",\n\t\"comment:moderate\",\n\t\"comment:afterCreate\",\n\t\"comment:afterModerate\",\n\t\"page:metadata\",\n\t\"page:fragments\",\n] as const;\n\n/**\n * Structured hook entry for manifest — name plus optional metadata.\n * During a transition period, both plain strings and objects are accepted.\n */\nconst manifestHookEntrySchema = z.object({\n\tname: z.enum(HOOK_NAMES),\n\texclusive: z.boolean().optional(),\n\tpriority: z.number().int().optional(),\n\ttimeout: z.number().int().positive().optional(),\n});\n\n/**\n * Structured route entry for manifest — name plus optional metadata.\n * Both plain strings and objects are accepted; strings are normalized\n * to `{ name }` objects via `normalizeManifestRoute()`.\n */\n/** Route names must be safe path segments — alphanumeric, hyphens, underscores, forward slashes */\nconst routeNamePattern = /^[a-zA-Z0-9][a-zA-Z0-9_\\-/]*$/;\n\nconst manifestRouteEntrySchema = z.object({\n\tname: z.string().min(1).regex(routeNamePattern, \"Route name must be a safe path segment\"),\n\tpublic: z.boolean().optional(),\n\tpermission: z\n\t\t.string()\n\t\t.refine((permission) => permission in Permissions)\n\t\t.optional(),\n\tcacheControl: z.string().min(1).optional(),\n});\n\nconst pluginJsonSchema = z.record(z.string(), z.unknown());\nconst mcpToolNamePattern = /^[a-zA-Z0-9_-]+$/;\nconst pluginMcpConfigSchema = z.object({\n\ttools: z.array(\n\t\tz.object({\n\t\t\tname: z.string().min(1).max(64).regex(mcpToolNamePattern, \"Invalid MCP tool name\"),\n\t\t\tdescription: z.string().min(1),\n\t\t\troute: z.string().min(1).regex(routeNamePattern, \"Route name must be a safe path segment\"),\n\t\t\tpermission: z.string().refine((permission) => permission in Permissions),\n\t\t\tdestructive: z.boolean(),\n\t\t\tinputSchema: pluginJsonSchema,\n\t\t\toutputSchema: pluginJsonSchema.optional(),\n\t\t}),\n\t),\n});\n\n// ── Sub-schemas ─────────────────────────────────────────────────\n\n/** Index field names must be valid identifiers to prevent SQL injection via JSON path expressions */\nconst indexFieldName = z.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/);\n\nconst storageCollectionSchema = z.object({\n\tindexes: z.array(z.union([indexFieldName, z.array(indexFieldName)])),\n\tuniqueIndexes: z.array(z.union([indexFieldName, z.array(indexFieldName)])).optional(),\n});\n\nconst baseSettingFields = {\n\tlabel: z.string(),\n\tdescription: z.string().optional(),\n};\n\nconst settingFieldSchema = z.discriminatedUnion(\"type\", [\n\tz.object({\n\t\t...baseSettingFields,\n\t\ttype: z.literal(\"string\"),\n\t\tdefault: z.string().optional(),\n\t\tmultiline: z.boolean().optional(),\n\t}),\n\tz.object({\n\t\t...baseSettingFields,\n\t\ttype: z.literal(\"number\"),\n\t\tdefault: z.number().optional(),\n\t\tmin: z.number().optional(),\n\t\tmax: z.number().optional(),\n\t}),\n\tz.object({ ...baseSettingFields, type: z.literal(\"boolean\"), default: z.boolean().optional() }),\n\tz.object({\n\t\t...baseSettingFields,\n\t\ttype: z.literal(\"select\"),\n\t\toptions: z.array(z.object({ value: z.string(), label: z.string() })),\n\t\tdefault: z.string().optional(),\n\t}),\n\tz.object({ ...baseSettingFields, type: z.literal(\"secret\") }),\n\tz.object({\n\t\t...baseSettingFields,\n\t\ttype: z.literal(\"url\"),\n\t\tdefault: z.string().optional(),\n\t\tplaceholder: z.string().optional(),\n\t}),\n\tz.object({\n\t\t...baseSettingFields,\n\t\ttype: z.literal(\"email\"),\n\t\tdefault: z.string().optional(),\n\t\tplaceholder: z.string().optional(),\n\t}),\n]);\n\nconst adminPageSchema = z.object({\n\tpath: z.string(),\n\tlabel: z.string(),\n\ticon: z.string().optional(),\n});\n\nconst dashboardWidgetSchema = z.object({\n\tid: z.string(),\n\tsize: z.enum([\"full\", \"half\", \"third\"]).optional(),\n\ttitle: z.string().optional(),\n});\n\nconst pluginAdminConfigSchema = z.object({\n\tentry: z.string().optional(),\n\tsettingsSchema: z.record(z.string(), settingFieldSchema).optional(),\n\tpages: z.array(adminPageSchema).optional(),\n\twidgets: z.array(dashboardWidgetSchema).optional(),\n\tfieldWidgets: z\n\t\t.array(\n\t\t\tz.object({\n\t\t\t\tname: z.string().min(1),\n\t\t\t\tlabel: z.string().min(1),\n\t\t\t\tfieldTypes: z.array(z.enum(FIELD_TYPES)),\n\t\t\t\telements: z\n\t\t\t\t\t.array(\n\t\t\t\t\t\tz\n\t\t\t\t\t\t\t.object({\n\t\t\t\t\t\t\t\ttype: z.string(),\n\t\t\t\t\t\t\t\taction_id: z.string(),\n\t\t\t\t\t\t\t\tlabel: z.string().optional(),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.passthrough(),\n\t\t\t\t\t)\n\t\t\t\t\t.optional(),\n\t\t\t}),\n\t\t)\n\t\t.optional(),\n});\n\n// ── declaredAccess ──────────────────────────────────────────────\n\n/**\n * An operation's constraint object. Open vocabulary: keys the runtime\n * recognises are enforced, others are advisory. The bundler emits `{}` for a\n * granted operation; presence (not value) signals the grant.\n */\nconst accessConstraints = z.record(z.string(), z.unknown());\n\n/**\n * Structured trust contract embedded in the bundle manifest. Mirrors\n * `DeclaredAccess` in `@emdash-cms/plugin-types`. Categories are host\n * subsystems; operations are modes of participation.\n */\nconst declaredAccessSchema = z.object({\n\tcontent: z\n\t\t.object({ read: accessConstraints.optional(), write: accessConstraints.optional() })\n\t\t.optional(),\n\ttaxonomies: z.object({ read: accessConstraints.optional() }).optional(),\n\tmedia: z\n\t\t.object({ read: accessConstraints.optional(), write: accessConstraints.optional() })\n\t\t.optional(),\n\tnetwork: z\n\t\t.object({\n\t\t\t// allowedHosts: absent = unrestricted; present = host-restricted. Reject\n\t\t\t// an empty array (which the decoder would otherwise have to treat as\n\t\t\t// deny-all) to match the record lexicon's `minLength: 1` and keep the\n\t\t\t// \"absent vs empty\" distinction from ever reaching enforcement ambiguous.\n\t\t\trequest: z.object({ allowedHosts: z.array(z.string()).min(1).optional() }).optional(),\n\t\t})\n\t\t.optional(),\n\temail: z\n\t\t.object({\n\t\t\tsend: accessConstraints.optional(),\n\t\t\tevents: accessConstraints.optional(),\n\t\t\ttransport: accessConstraints.optional(),\n\t\t})\n\t\t.optional(),\n\tpage: z.object({ fragments: accessConstraints.optional() }).optional(),\n\tusers: z.object({ read: accessConstraints.optional() }).optional(),\n});\n\n// ── Main schema ─────────────────────────────────────────────────\n\n/**\n * Zod schema matching the PluginManifest interface from types.ts.\n *\n * Every JSON.parse of a manifest.json should validate through this.\n *\n * `declaredAccess` is the trust contract; `capabilities`/`allowedHosts` are the\n * runtime's enforcement currency. Apply `reconcileManifestAccess` after parsing\n * to make them consistent (declaredAccess authoritative when present). Kept a\n * plain object (no `.transform`) because callers `.pick()`/`.extend()` it.\n */\nexport const pluginManifestSchema = z.object({\n\tid: z.string().min(1),\n\tversion: z.string().min(1),\n\tdeclaredAccess: declaredAccessSchema.optional(),\n\tcapabilities: z.array(z.enum(PLUGIN_CAPABILITIES)),\n\tallowedHosts: z.array(z.string()),\n\tstorage: z.record(z.string(), storageCollectionSchema),\n\t/**\n\t * Hook declarations — accepts both plain name strings (legacy) and\n\t * structured objects with exclusive/priority/timeout metadata.\n\t * Plain strings are normalized to `{ name }` objects after parsing.\n\t */\n\thooks: z.array(z.union([z.enum(HOOK_NAMES), manifestHookEntrySchema])),\n\t/**\n\t * Route declarations — accepts both plain name strings and\n\t * structured objects with public metadata.\n\t * Plain strings are normalized to `{ name }` objects after parsing.\n\t */\n\troutes: z.array(\n\t\tz.union([\n\t\t\tz.string().min(1).regex(routeNamePattern, \"Route name must be a safe path segment\"),\n\t\t\tmanifestRouteEntrySchema,\n\t\t]),\n\t),\n\tmcp: pluginMcpConfigSchema.optional(),\n\tadmin: pluginAdminConfigSchema,\n});\n\nexport type ValidatedPluginManifest = z.infer<typeof pluginManifestSchema>;\n\n/**\n * Reconcile a parsed manifest's trust contract with its enforcement currency.\n * `declaredAccess` is authoritative: when present, `capabilities`/`allowedHosts`\n * are re-derived from it so what the runtime enforces always matches what was\n * recorded and consented to. A pre-migration bundle without `declaredAccess`\n * has it derived from the legacy capability list instead. The result always\n * carries both, mutually consistent. Apply this at every bundle-parse site.\n */\nexport function reconcileManifestAccess(manifest: ValidatedPluginManifest): PluginManifest {\n\tconst reconciled: ValidatedPluginManifest = manifest.declaredAccess\n\t\t? { ...manifest, ...declaredAccessToCapabilities(manifest.declaredAccess) }\n\t\t: {\n\t\t\t\t...manifest,\n\t\t\t\tdeclaredAccess: capabilitiesToDeclaredAccess(manifest.capabilities, manifest.allowedHosts),\n\t\t\t};\n\t// Block Kit admin elements are typed as `unknown` by the Zod schema (their\n\t// Element shape is validated at render time), so the validated manifest\n\t// needs a structural cast up to the runtime PluginManifest.\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- admin elements are unknown[] in Zod; Element type checked at render time\n\treturn reconciled as unknown as PluginManifest;\n}\n\n/**\n * Normalize a manifest hook entry — plain strings become `{ name }` objects.\n */\nexport function normalizeManifestHook(\n\tentry: string | { name: string; exclusive?: boolean; priority?: number; timeout?: number },\n): { name: string; exclusive?: boolean; priority?: number; timeout?: number } {\n\tif (typeof entry === \"string\") {\n\t\treturn { name: entry };\n\t}\n\treturn entry;\n}\n\n/**\n * Normalize a manifest route entry — plain strings become `{ name }` objects.\n */\nexport function normalizeManifestRoute(\n\tentry: string | { name: string; public?: boolean; permission?: string; cacheControl?: string },\n): {\n\tname: string;\n\tpublic?: boolean;\n\tpermission?: string;\n\tcacheControl?: string;\n} {\n\tif (typeof entry === \"string\") {\n\t\treturn { name: entry };\n\t}\n\treturn entry;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyBA,MAAa,8BAA8B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;;;;AAQD,MAAa,iCAAiC;CAC7C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;;;;;AASD,MAAa,sBAAsB,CAClC,GAAG,6BACH,GAAG,+BACH;;AAGD,MAAM,cAAc;CACnB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAED,MAAa,aAAa;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;C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AS,iBAClD;EAAE,GAAG;EAAU,GAAG,6BAA6B,SAAS,eAAe;EAAE,GACzE;EACA,GAAG;EACH,gBAAgB,6BAA6B,SAAS,cAAc,SAAS,aAAa;EAC1F;;;;;AAuBJ,SAAgB,uBACf,OAMC;AACD,KAAI,OAAO,UAAU,SACpB,QAAO,EAAE,MAAM,OAAO;AAEvB,QAAO"}
|
|
1
|
+
{"version":3,"file":"manifest-schema-CUYPfCEH.mjs","names":[],"sources":["../src/plugins/manifest-schema.ts"],"sourcesContent":["/**\n * Zod schema for PluginManifest validation\n *\n * Used to validate manifest.json from plugin bundles at every parse site:\n * - Client-side download (marketplace.ts extractBundle)\n * - R2 load (api/handlers/marketplace.ts loadBundleFromR2)\n * - CLI publish preview (cli/commands/publish.ts readManifestFromTarball)\n * - Marketplace ingest extends this with publishing-specific fields\n */\n\nimport { Permissions } from \"@emdash-cms/auth\";\nimport {\n\tcapabilitiesToDeclaredAccess,\n\tdeclaredAccessToCapabilities,\n} from \"@emdash-cms/plugin-types\";\nimport { z } from \"zod\";\n\nimport type { PluginManifest } from \"./types.js\";\n\n// ── Enum values (must stay in sync with types.ts) ───────────────\n\n/**\n * Current capability names — the ones authors should use going forward.\n * See `PluginCapability` in `types.ts` for documentation of each.\n */\nexport const CURRENT_PLUGIN_CAPABILITIES = [\n\t\"network:request\",\n\t\"network:request:unrestricted\",\n\t\"content:read\",\n\t\"content:write\",\n\t\"taxonomies:read\",\n\t\"media:read\",\n\t\"media:write\",\n\t\"users:read\",\n\t\"email:send\",\n\t\"hooks.email-transport:register\",\n\t\"hooks.email-events:register\",\n\t\"hooks.page-fragments:register\",\n] as const;\n\n/**\n * Legacy capability names accepted during the deprecation window.\n * Normalized to current names via `normalizeCapability()` in types.ts\n * before reaching the runtime. Plugin authors are warned at bundle/validate\n * and hard-failed at publish.\n */\nexport const DEPRECATED_PLUGIN_CAPABILITIES = [\n\t\"network:fetch\",\n\t\"network:fetch:any\",\n\t\"read:content\",\n\t\"write:content\",\n\t\"read:media\",\n\t\"write:media\",\n\t\"read:users\",\n\t\"email:provide\",\n\t\"email:intercept\",\n\t\"page:inject\",\n] as const;\n\n/**\n * Full set of accepted capability strings — current + deprecated.\n *\n * The manifest schema accepts both during the transition. The runtime only\n * ever sees current names because `normalizeCapability()` rewrites legacy\n * names at every external boundary (definePlugin, adaptSandboxEntry).\n */\nexport const PLUGIN_CAPABILITIES = [\n\t...CURRENT_PLUGIN_CAPABILITIES,\n\t...DEPRECATED_PLUGIN_CAPABILITIES,\n] as const;\n\n/** Must stay in sync with FieldType in schema/types.ts */\nconst FIELD_TYPES = [\n\t\"string\",\n\t\"text\",\n\t\"number\",\n\t\"integer\",\n\t\"boolean\",\n\t\"datetime\",\n\t\"select\",\n\t\"multiSelect\",\n\t\"portableText\",\n\t\"image\",\n\t\"file\",\n\t\"reference\",\n\t\"json\",\n\t\"slug\",\n\t\"repeater\",\n] as const;\n\nexport const HOOK_NAMES = [\n\t\"plugin:install\",\n\t\"plugin:activate\",\n\t\"plugin:deactivate\",\n\t\"plugin:uninstall\",\n\t\"content:beforeSave\",\n\t\"content:afterSave\",\n\t\"content:beforeDelete\",\n\t\"content:afterDelete\",\n\t\"content:afterPublish\",\n\t\"content:afterUnpublish\",\n\t\"content:afterRestore\",\n\t\"content:afterSchedule\",\n\t\"content:afterUnschedule\",\n\t\"media:beforeUpload\",\n\t\"media:afterUpload\",\n\t\"cron\",\n\t\"email:beforeSend\",\n\t\"email:deliver\",\n\t\"email:afterSend\",\n\t\"comment:beforeCreate\",\n\t\"comment:moderate\",\n\t\"comment:afterCreate\",\n\t\"comment:afterModerate\",\n\t\"page:metadata\",\n\t\"page:fragments\",\n] as const;\n\n/**\n * Structured hook entry for manifest — name plus optional metadata.\n * During a transition period, both plain strings and objects are accepted.\n */\nconst manifestHookEntrySchema = z.object({\n\tname: z.enum(HOOK_NAMES),\n\texclusive: z.boolean().optional(),\n\tpriority: z.number().int().optional(),\n\ttimeout: z.number().int().positive().optional(),\n});\n\n/**\n * Structured route entry for manifest — name plus optional metadata.\n * Both plain strings and objects are accepted; strings are normalized\n * to `{ name }` objects via `normalizeManifestRoute()`.\n */\n/** Route names must be safe path segments — alphanumeric, hyphens, underscores, forward slashes */\nconst routeNamePattern = /^[a-zA-Z0-9][a-zA-Z0-9_\\-/]*$/;\n\nconst manifestRouteEntrySchema = z.object({\n\tname: z.string().min(1).regex(routeNamePattern, \"Route name must be a safe path segment\"),\n\tpublic: z.boolean().optional(),\n\tpermission: z\n\t\t.string()\n\t\t.refine((permission) => permission in Permissions)\n\t\t.optional(),\n\tcacheControl: z.string().min(1).optional(),\n});\n\nconst pluginJsonSchema = z.record(z.string(), z.unknown());\nconst mcpToolNamePattern = /^[a-zA-Z0-9_-]+$/;\nconst pluginMcpConfigSchema = z.object({\n\ttools: z.array(\n\t\tz.object({\n\t\t\tname: z.string().min(1).max(64).regex(mcpToolNamePattern, \"Invalid MCP tool name\"),\n\t\t\tdescription: z.string().min(1),\n\t\t\troute: z.string().min(1).regex(routeNamePattern, \"Route name must be a safe path segment\"),\n\t\t\tpermission: z.string().refine((permission) => permission in Permissions),\n\t\t\tdestructive: z.boolean(),\n\t\t\tinputSchema: pluginJsonSchema,\n\t\t\toutputSchema: pluginJsonSchema.optional(),\n\t\t}),\n\t),\n});\n\n// ── Sub-schemas ─────────────────────────────────────────────────\n\n/** Index field names must be valid identifiers to prevent SQL injection via JSON path expressions */\nconst indexFieldName = z.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/);\n\nconst storageCollectionSchema = z.object({\n\tindexes: z.array(z.union([indexFieldName, z.array(indexFieldName)])),\n\tuniqueIndexes: z.array(z.union([indexFieldName, z.array(indexFieldName)])).optional(),\n});\n\nconst baseSettingFields = {\n\tlabel: z.string(),\n\tdescription: z.string().optional(),\n};\n\nconst settingFieldSchema = z.discriminatedUnion(\"type\", [\n\tz.object({\n\t\t...baseSettingFields,\n\t\ttype: z.literal(\"string\"),\n\t\tdefault: z.string().optional(),\n\t\tmultiline: z.boolean().optional(),\n\t}),\n\tz.object({\n\t\t...baseSettingFields,\n\t\ttype: z.literal(\"number\"),\n\t\tdefault: z.number().optional(),\n\t\tmin: z.number().optional(),\n\t\tmax: z.number().optional(),\n\t}),\n\tz.object({ ...baseSettingFields, type: z.literal(\"boolean\"), default: z.boolean().optional() }),\n\tz.object({\n\t\t...baseSettingFields,\n\t\ttype: z.literal(\"select\"),\n\t\toptions: z.array(z.object({ value: z.string(), label: z.string() })),\n\t\tdefault: z.string().optional(),\n\t}),\n\tz.object({ ...baseSettingFields, type: z.literal(\"secret\") }),\n\tz.object({\n\t\t...baseSettingFields,\n\t\ttype: z.literal(\"url\"),\n\t\tdefault: z.string().optional(),\n\t\tplaceholder: z.string().optional(),\n\t}),\n\tz.object({\n\t\t...baseSettingFields,\n\t\ttype: z.literal(\"email\"),\n\t\tdefault: z.string().optional(),\n\t\tplaceholder: z.string().optional(),\n\t}),\n]);\n\nconst adminPageSchema = z.object({\n\tpath: z.string(),\n\tlabel: z.string(),\n\ticon: z.string().optional(),\n});\n\nconst dashboardWidgetSchema = z.object({\n\tid: z.string(),\n\tsize: z.enum([\"full\", \"half\", \"third\"]).optional(),\n\ttitle: z.string().optional(),\n});\n\nconst pluginAdminConfigSchema = z.object({\n\tentry: z.string().optional(),\n\tsettingsSchema: z.record(z.string(), settingFieldSchema).optional(),\n\tpages: z.array(adminPageSchema).optional(),\n\twidgets: z.array(dashboardWidgetSchema).optional(),\n\tfieldWidgets: z\n\t\t.array(\n\t\t\tz.object({\n\t\t\t\tname: z.string().min(1),\n\t\t\t\tlabel: z.string().min(1),\n\t\t\t\tfieldTypes: z.array(z.enum(FIELD_TYPES)),\n\t\t\t\telements: z\n\t\t\t\t\t.array(\n\t\t\t\t\t\tz\n\t\t\t\t\t\t\t.object({\n\t\t\t\t\t\t\t\ttype: z.string(),\n\t\t\t\t\t\t\t\taction_id: z.string(),\n\t\t\t\t\t\t\t\tlabel: z.string().optional(),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.passthrough(),\n\t\t\t\t\t)\n\t\t\t\t\t.optional(),\n\t\t\t}),\n\t\t)\n\t\t.optional(),\n});\n\n// ── declaredAccess ──────────────────────────────────────────────\n\n/**\n * An operation's constraint object. Open vocabulary: keys the runtime\n * recognises are enforced, others are advisory. The bundler emits `{}` for a\n * granted operation; presence (not value) signals the grant.\n */\nconst accessConstraints = z.record(z.string(), z.unknown());\n\n/**\n * Structured trust contract embedded in the bundle manifest. Mirrors\n * `DeclaredAccess` in `@emdash-cms/plugin-types`. Categories are host\n * subsystems; operations are modes of participation.\n */\nconst declaredAccessSchema = z.object({\n\tcontent: z\n\t\t.object({ read: accessConstraints.optional(), write: accessConstraints.optional() })\n\t\t.optional(),\n\ttaxonomies: z.object({ read: accessConstraints.optional() }).optional(),\n\tmedia: z\n\t\t.object({ read: accessConstraints.optional(), write: accessConstraints.optional() })\n\t\t.optional(),\n\tnetwork: z\n\t\t.object({\n\t\t\t// allowedHosts: absent = unrestricted; present = host-restricted. Reject\n\t\t\t// an empty array (which the decoder would otherwise have to treat as\n\t\t\t// deny-all) to match the record lexicon's `minLength: 1` and keep the\n\t\t\t// \"absent vs empty\" distinction from ever reaching enforcement ambiguous.\n\t\t\trequest: z.object({ allowedHosts: z.array(z.string()).min(1).optional() }).optional(),\n\t\t})\n\t\t.optional(),\n\temail: z\n\t\t.object({\n\t\t\tsend: accessConstraints.optional(),\n\t\t\tevents: accessConstraints.optional(),\n\t\t\ttransport: accessConstraints.optional(),\n\t\t})\n\t\t.optional(),\n\tpage: z.object({ fragments: accessConstraints.optional() }).optional(),\n\tusers: z.object({ read: accessConstraints.optional() }).optional(),\n});\n\n// ── Main schema ─────────────────────────────────────────────────\n\n/**\n * Zod schema matching the PluginManifest interface from types.ts.\n *\n * Every JSON.parse of a manifest.json should validate through this.\n *\n * `declaredAccess` is the trust contract; `capabilities`/`allowedHosts` are the\n * runtime's enforcement currency. Apply `reconcileManifestAccess` after parsing\n * to make them consistent (declaredAccess authoritative when present). Kept a\n * plain object (no `.transform`) because callers `.pick()`/`.extend()` it.\n */\nexport const pluginManifestSchema = z.object({\n\tid: z.string().min(1),\n\tversion: z.string().min(1),\n\tdeclaredAccess: declaredAccessSchema.optional(),\n\tcapabilities: z.array(z.enum(PLUGIN_CAPABILITIES)),\n\tallowedHosts: z.array(z.string()),\n\tstorage: z.record(z.string(), storageCollectionSchema),\n\t/**\n\t * Hook declarations — accepts both plain name strings (legacy) and\n\t * structured objects with exclusive/priority/timeout metadata.\n\t * Plain strings are normalized to `{ name }` objects after parsing.\n\t */\n\thooks: z.array(z.union([z.enum(HOOK_NAMES), manifestHookEntrySchema])),\n\t/**\n\t * Route declarations — accepts both plain name strings and\n\t * structured objects with public metadata.\n\t * Plain strings are normalized to `{ name }` objects after parsing.\n\t */\n\troutes: z.array(\n\t\tz.union([\n\t\t\tz.string().min(1).regex(routeNamePattern, \"Route name must be a safe path segment\"),\n\t\t\tmanifestRouteEntrySchema,\n\t\t]),\n\t),\n\tmcp: pluginMcpConfigSchema.optional(),\n\tadmin: pluginAdminConfigSchema,\n});\n\nexport type ValidatedPluginManifest = z.infer<typeof pluginManifestSchema>;\n\n/**\n * Reconcile a parsed manifest's trust contract with its enforcement currency.\n * `declaredAccess` is authoritative: when present, `capabilities`/`allowedHosts`\n * are re-derived from it so what the runtime enforces always matches what was\n * recorded and consented to. A pre-migration bundle without `declaredAccess`\n * has it derived from the legacy capability list instead. The result always\n * carries both, mutually consistent. Apply this at every bundle-parse site.\n */\nexport function reconcileManifestAccess(manifest: ValidatedPluginManifest): PluginManifest {\n\tconst reconciled: ValidatedPluginManifest = manifest.declaredAccess\n\t\t? { ...manifest, ...declaredAccessToCapabilities(manifest.declaredAccess) }\n\t\t: {\n\t\t\t\t...manifest,\n\t\t\t\tdeclaredAccess: capabilitiesToDeclaredAccess(manifest.capabilities, manifest.allowedHosts),\n\t\t\t};\n\t// Block Kit admin elements are typed as `unknown` by the Zod schema (their\n\t// Element shape is validated at render time), so the validated manifest\n\t// needs a structural cast up to the runtime PluginManifest.\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- admin elements are unknown[] in Zod; Element type checked at render time\n\treturn reconciled as unknown as PluginManifest;\n}\n\n/**\n * Normalize a manifest hook entry — plain strings become `{ name }` objects.\n */\nexport function normalizeManifestHook(\n\tentry: string | { name: string; exclusive?: boolean; priority?: number; timeout?: number },\n): { name: string; exclusive?: boolean; priority?: number; timeout?: number } {\n\tif (typeof entry === \"string\") {\n\t\treturn { name: entry };\n\t}\n\treturn entry;\n}\n\n/**\n * Normalize a manifest route entry — plain strings become `{ name }` objects.\n */\nexport function normalizeManifestRoute(\n\tentry: string | { name: string; public?: boolean; permission?: string; cacheControl?: string },\n): {\n\tname: string;\n\tpublic?: boolean;\n\tpermission?: string;\n\tcacheControl?: string;\n} {\n\tif (typeof entry === \"string\") {\n\t\treturn { name: entry };\n\t}\n\treturn entry;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyBA,MAAa,8BAA8B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;;;;AAQD,MAAa,iCAAiC;CAC7C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;;;;;AASD,MAAa,sBAAsB,CAClC,GAAG,6BACH,GAAG,+BACH;;AAGD,MAAM,cAAc;CACnB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAED,MAAa,aAAa;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;;AAMD,MAAM,0BAA0B,EAAE,OAAO;CACxC,MAAM,EAAE,KAAK,WAAW;CACxB,WAAW,EAAE,SAAS,CAAC,UAAU;CACjC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU;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
package/dist/media/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as MediaValue, a as ComponentEmbed, b as mediaItemToValue, c as EmbedResult, d as MediaListResult, f as MediaProvider, g as MediaUploadInput, h as MediaProviderItem, i as AudioEmbed, l as ImageEmbed, m as MediaProviderDescriptor, n as generatePlaceholder, o as CreateMediaProviderFn, p as MediaProviderCapabilities, r as normalizeMediaValue, s as EmbedOptions, t as PlaceholderData, u as MediaListOptions, v as ThumbnailOptions, y as VideoEmbed } from "../placeholder-
|
|
1
|
+
import { _ as MediaValue, a as ComponentEmbed, b as mediaItemToValue, c as EmbedResult, d as MediaListResult, f as MediaProvider, g as MediaUploadInput, h as MediaProviderItem, i as AudioEmbed, l as ImageEmbed, m as MediaProviderDescriptor, n as generatePlaceholder, o as CreateMediaProviderFn, p as MediaProviderCapabilities, r as normalizeMediaValue, s as EmbedOptions, t as PlaceholderData, u as MediaListOptions, v as ThumbnailOptions, y as VideoEmbed } from "../placeholder-BR4ZhVJl.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/media/enrich.d.ts
|
|
4
4
|
/**
|
package/dist/media/index.mjs
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import "../
|
|
3
|
-
import
|
|
1
|
+
import { n as normalizeFocalPoint } from "../focal-point-BeWFo6Xx.mjs";
|
|
2
|
+
import { n as normalizeMediaValue } from "../normalize-CSxdKBVa.mjs";
|
|
3
|
+
import "../dist-89xCrGqi.mjs";
|
|
4
|
+
import { n as generatePlaceholder, t as enrichImageMetadata } from "../enrich-BX0IDp4z.mjs";
|
|
4
5
|
|
|
5
6
|
//#region src/media/types.ts
|
|
6
7
|
/**
|
|
8
|
+
* Media Provider Types
|
|
9
|
+
*
|
|
10
|
+
* Media providers are pluggable sources for browsing, uploading, and embedding media.
|
|
11
|
+
* They enable integration with external services (Unsplash, Cloudinary, Mux, etc.)
|
|
12
|
+
* alongside the built-in local media library.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
7
15
|
* Convert a MediaProviderItem to a MediaValue for storage
|
|
8
16
|
*/
|
|
9
17
|
function mediaItemToValue(providerId, item) {
|
|
18
|
+
const focalPoint = normalizeFocalPoint(item.focalX, item.focalY);
|
|
10
19
|
return {
|
|
11
20
|
provider: providerId,
|
|
12
21
|
id: item.id,
|
|
@@ -14,6 +23,7 @@ function mediaItemToValue(providerId, item) {
|
|
|
14
23
|
mimeType: item.mimeType,
|
|
15
24
|
width: item.width,
|
|
16
25
|
height: item.height,
|
|
26
|
+
...focalPoint,
|
|
17
27
|
blurhash: item.blurhash,
|
|
18
28
|
dominantColor: item.dominantColor,
|
|
19
29
|
alt: item.alt,
|
package/dist/media/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/media/types.ts","../../src/media/local.ts"],"sourcesContent":["/**\n * Media Provider Types\n *\n * Media providers are pluggable sources for browsing, uploading, and embedding media.\n * They enable integration with external services (Unsplash, Cloudinary, Mux, etc.)\n * alongside the built-in local media library.\n */\n\n/**\n * Serializable media provider configuration descriptor\n * Returned by provider config functions (e.g., unsplash(), mux())\n */\nexport interface MediaProviderDescriptor<TConfig = Record<string, unknown>> {\n\t/** Unique identifier, used in MediaValue.provider */\n\tid: string;\n\n\t/** Display name for admin UI */\n\tname: string;\n\n\t/** Icon for tab UI (emoji or URL) */\n\ticon?: string;\n\n\t/** Module path exporting createMediaProvider function */\n\tentrypoint: string;\n\n\t/** Optional React component module for custom admin UI */\n\tadminModule?: string;\n\n\t/** Capability flags determine UI behavior */\n\tcapabilities: MediaProviderCapabilities;\n\n\t/** Serializable config passed to createMediaProvider at runtime */\n\tconfig: TConfig;\n}\n\n/**\n * Provider capabilities determine what UI elements to show\n */\nexport interface MediaProviderCapabilities {\n\t/** Can list/browse media */\n\tbrowse: boolean;\n\t/** Supports text search */\n\tsearch: boolean;\n\t/** Can upload new media */\n\tupload: boolean;\n\t/** Can delete media */\n\tdelete: boolean;\n}\n\n/**\n * Options for listing media\n */\nexport interface MediaListOptions {\n\t/** Pagination cursor */\n\tcursor?: string;\n\t/** Max items to return (default 20) */\n\tlimit?: number;\n\t/** Search query (if capabilities.search is true) */\n\tquery?: string;\n\t/** Filter by MIME type prefix, e.g., \"image/\", \"video/\" */\n\tmimeType?: string;\n}\n\n/**\n * Result from listing media\n */\nexport interface MediaListResult {\n\titems: MediaProviderItem[];\n\tnextCursor?: string;\n}\n\n/**\n * A media item as returned by a provider\n * This is the provider's view of the item, before it's selected\n */\nexport interface MediaProviderItem {\n\t/** Provider-specific ID */\n\tid: string;\n\t/** Original filename */\n\tfilename: string;\n\t/** MIME type */\n\tmimeType: string;\n\t/** File size in bytes (if known) */\n\tsize?: number;\n\t/** Dimensions (for images/video) */\n\twidth?: number;\n\theight?: number;\n\t/** LQIP blurhash placeholder (images only) */\n\tblurhash?: string;\n\t/** LQIP dominant-color placeholder, as a CSS color (images only) */\n\tdominantColor?: string;\n\t/** Accessibility text */\n\talt?: string;\n\t/** Preview URL for admin UI thumbnail */\n\tpreviewUrl?: string;\n\t/** Provider-specific metadata */\n\tmeta?: Record<string, unknown>;\n}\n\n/**\n * Input for uploading media\n */\nexport interface MediaUploadInput {\n\tfile: File;\n\tfilename: string;\n\talt?: string;\n}\n\n/**\n * Options for generating embed\n */\nexport interface EmbedOptions {\n\t/** Desired width (provider may use for optimization) */\n\twidth?: number;\n\t/** Desired height */\n\theight?: number;\n\t/** Image format preference */\n\tformat?: \"webp\" | \"avif\" | \"jpeg\" | \"png\" | \"auto\";\n}\n\n/**\n * Embed result types\n */\nexport type EmbedResult = ImageEmbed | VideoEmbed | AudioEmbed | ComponentEmbed;\n\nexport interface ImageEmbed {\n\ttype: \"image\";\n\tsrc: string;\n\tsrcset?: string;\n\tsizes?: string;\n\twidth?: number;\n\theight?: number;\n\t/** LQIP blurhash placeholder for rendering before the image loads */\n\tblurhash?: string;\n\t/** LQIP dominant-color placeholder, as a CSS color */\n\tdominantColor?: string;\n\talt?: string;\n\t/** Base URL without transforms, for responsive image generation */\n\tcdnBaseUrl?: string;\n\t/** For providers with URL-based transforms (Cloudinary, imgix) */\n\tgetSrc?: (opts: { width?: number; height?: number; format?: string }) => string;\n}\n\nexport interface VideoEmbed {\n\ttype: \"video\";\n\t/** Single source URL */\n\tsrc?: string;\n\t/** Multiple sources for format fallback */\n\tsources?: Array<{ src: string; type: string }>;\n\t/** Poster/thumbnail image */\n\tposter?: string;\n\twidth?: number;\n\theight?: number;\n\t/** Player controls */\n\tcontrols?: boolean;\n\tautoplay?: boolean;\n\tmuted?: boolean;\n\tloop?: boolean;\n\tplaysinline?: boolean;\n\tpreload?: \"none\" | \"metadata\" | \"auto\";\n\tcrossorigin?: \"anonymous\" | \"use-credentials\";\n}\n\nexport interface AudioEmbed {\n\ttype: \"audio\";\n\tsrc?: string;\n\tsources?: Array<{ src: string; type: string }>;\n\tcontrols?: boolean;\n\tautoplay?: boolean;\n\tmuted?: boolean;\n\tloop?: boolean;\n\tpreload?: \"none\" | \"metadata\" | \"auto\";\n}\n\nexport interface ComponentEmbed {\n\ttype: \"component\";\n\t/** Package to import from, e.g., \"@mux/player-react\" */\n\tpackage: string;\n\t/** Named export (default export if not specified) */\n\texport?: string;\n\t/** Props to pass to the component */\n\tprops: Record<string, unknown>;\n}\n\n/**\n * Options for thumbnail generation\n */\nexport interface ThumbnailOptions {\n\t/** Desired width */\n\twidth?: number;\n\t/** Desired height */\n\theight?: number;\n}\n\n/**\n * Runtime media provider interface\n * Implemented by provider entrypoints\n */\nexport interface MediaProvider {\n\t/**\n\t * List/search media items\n\t */\n\tlist(options: MediaListOptions): Promise<MediaListResult>;\n\n\t/**\n\t * Get a single item by ID (optional, for refresh/validation)\n\t */\n\tget?(id: string): Promise<MediaProviderItem | null>;\n\n\t/**\n\t * Upload new media (if capabilities.upload is true)\n\t */\n\tupload?(input: MediaUploadInput): Promise<MediaProviderItem>;\n\n\t/**\n\t * Delete media (if capabilities.delete is true)\n\t */\n\tdelete?(id: string): Promise<void>;\n\n\t/**\n\t * Get embed information for rendering this media item\n\t * Called at runtime when rendering content\n\t */\n\tgetEmbed(value: MediaValue, options?: EmbedOptions): Promise<EmbedResult> | EmbedResult;\n\n\t/**\n\t * Get a thumbnail URL for admin display\n\t * For images: returns a resized image URL\n\t * For videos: returns a poster/thumbnail URL\n\t */\n\tgetThumbnailUrl?(id: string, mimeType?: string, options?: ThumbnailOptions): string;\n}\n\n/**\n * Function signature for provider entrypoint modules\n */\nexport type CreateMediaProviderFn<TConfig = Record<string, unknown>> = (\n\tconfig: TConfig,\n) => MediaProvider;\n\n/**\n * Media value stored in content fields\n * This is what gets persisted when media is selected\n *\n * For backwards compatibility:\n * - `provider` defaults to \"local\" if not specified\n * - `src` is supported for legacy data or external URLs\n */\nexport interface MediaValue {\n\t/** Provider ID, e.g., \"local\", \"unsplash\", \"mux\" (defaults to \"local\") */\n\tprovider?: string;\n\n\t/** Provider-specific item ID */\n\tid: string;\n\n\t/** Direct URL (for local media or legacy data) */\n\tsrc?: string;\n\n\t/** Preview URL for admin display (external providers) */\n\tpreviewUrl?: string;\n\n\t/** Cached metadata for display without runtime lookup */\n\tfilename?: string;\n\tmimeType?: string;\n\twidth?: number;\n\theight?: number;\n\t/** Cached LQIP blurhash placeholder (images only) */\n\tblurhash?: string;\n\t/** Cached LQIP dominant-color placeholder, as a CSS color (images only) */\n\tdominantColor?: string;\n\talt?: string;\n\n\t/** Provider-specific data needed for embedding */\n\tmeta?: Record<string, unknown>;\n}\n\n/**\n * Convert a MediaProviderItem to a MediaValue for storage\n */\nexport function mediaItemToValue(providerId: string, item: MediaProviderItem): MediaValue {\n\treturn {\n\t\tprovider: providerId,\n\t\tid: item.id,\n\t\tfilename: item.filename,\n\t\tmimeType: item.mimeType,\n\t\twidth: item.width,\n\t\theight: item.height,\n\t\tblurhash: item.blurhash,\n\t\tdominantColor: item.dominantColor,\n\t\talt: item.alt,\n\t\tmeta: item.meta,\n\t};\n}\n","/**\n * Local Media Provider\n *\n * The built-in media provider that wraps the current storage adapter and media database.\n * This is the default provider and is available unless explicitly disabled.\n */\n\nimport type { MediaProviderDescriptor } from \"./types.js\";\n\nexport interface LocalMediaConfig {\n\t/** Whether the local provider is enabled (default true) */\n\tenabled?: boolean;\n}\n\n/**\n * Local media provider configuration\n *\n * @example\n * ```ts\n * import { localMedia } from \"emdash/media\";\n *\n * emdash({\n * mediaProviders: [\n * localMedia(), // Uses defaults\n * // or: localMedia({ enabled: false }) to disable\n * ],\n * })\n * ```\n */\nexport function localMedia(config: LocalMediaConfig = {}): MediaProviderDescriptor {\n\treturn {\n\t\tid: \"local\",\n\t\tname: \"Library\",\n\t\ticon: \"📁\",\n\t\tentrypoint: \"emdash/media/local-runtime\",\n\t\tcapabilities: {\n\t\t\tbrowse: true,\n\t\t\tsearch: false, // TODO: Add search support\n\t\t\tupload: true,\n\t\t\tdelete: true,\n\t\t},\n\t\tconfig: {\n\t\t\tenabled: config.enabled ?? true,\n\t\t},\n\t};\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/media/types.ts","../../src/media/local.ts"],"sourcesContent":["/**\n * Media Provider Types\n *\n * Media providers are pluggable sources for browsing, uploading, and embedding media.\n * They enable integration with external services (Unsplash, Cloudinary, Mux, etc.)\n * alongside the built-in local media library.\n */\n\nimport { normalizeFocalPoint } from \"./focal-point.js\";\n\n/**\n * Serializable media provider configuration descriptor\n * Returned by provider config functions (e.g., unsplash(), mux())\n */\nexport interface MediaProviderDescriptor<TConfig = Record<string, unknown>> {\n\t/** Unique identifier, used in MediaValue.provider */\n\tid: string;\n\n\t/** Display name for admin UI */\n\tname: string;\n\n\t/** Icon for tab UI (emoji or URL) */\n\ticon?: string;\n\n\t/** Module path exporting createMediaProvider function */\n\tentrypoint: string;\n\n\t/** Optional React component module for custom admin UI */\n\tadminModule?: string;\n\n\t/** Capability flags determine UI behavior */\n\tcapabilities: MediaProviderCapabilities;\n\n\t/** Serializable config passed to createMediaProvider at runtime */\n\tconfig: TConfig;\n}\n\n/**\n * Provider capabilities determine what UI elements to show\n */\nexport interface MediaProviderCapabilities {\n\t/** Can list/browse media */\n\tbrowse: boolean;\n\t/** Supports text search */\n\tsearch: boolean;\n\t/** Can upload new media */\n\tupload: boolean;\n\t/** Can delete media */\n\tdelete: boolean;\n}\n\n/**\n * Options for listing media\n */\nexport interface MediaListOptions {\n\t/** Pagination cursor */\n\tcursor?: string;\n\t/** Max items to return (default 20) */\n\tlimit?: number;\n\t/** Search query (if capabilities.search is true) */\n\tquery?: string;\n\t/** Filter by MIME type prefix, e.g., \"image/\", \"video/\" */\n\tmimeType?: string;\n}\n\n/**\n * Result from listing media\n */\nexport interface MediaListResult {\n\titems: MediaProviderItem[];\n\tnextCursor?: string;\n}\n\n/**\n * A media item as returned by a provider\n * This is the provider's view of the item, before it's selected\n */\nexport interface MediaProviderItem {\n\t/** Provider-specific ID */\n\tid: string;\n\t/** Original filename */\n\tfilename: string;\n\t/** MIME type */\n\tmimeType: string;\n\t/** File size in bytes (if known) */\n\tsize?: number;\n\t/** Dimensions (for images/video) */\n\twidth?: number;\n\theight?: number;\n\t/** Default focal point for cover-cropped displays */\n\tfocalX?: number;\n\tfocalY?: number;\n\t/** LQIP blurhash placeholder (images only) */\n\tblurhash?: string;\n\t/** LQIP dominant-color placeholder, as a CSS color (images only) */\n\tdominantColor?: string;\n\t/** Accessibility text */\n\talt?: string;\n\t/** Preview URL for admin UI thumbnail */\n\tpreviewUrl?: string;\n\t/** Provider-specific metadata */\n\tmeta?: Record<string, unknown>;\n}\n\n/**\n * Input for uploading media\n */\nexport interface MediaUploadInput {\n\tfile: File;\n\tfilename: string;\n\talt?: string;\n}\n\n/**\n * Options for generating embed\n */\nexport interface EmbedOptions {\n\t/** Desired width (provider may use for optimization) */\n\twidth?: number;\n\t/** Desired height */\n\theight?: number;\n\t/** Image format preference */\n\tformat?: \"webp\" | \"avif\" | \"jpeg\" | \"png\" | \"auto\";\n}\n\n/**\n * Embed result types\n */\nexport type EmbedResult = ImageEmbed | VideoEmbed | AudioEmbed | ComponentEmbed;\n\nexport interface ImageEmbed {\n\ttype: \"image\";\n\tsrc: string;\n\tsrcset?: string;\n\tsizes?: string;\n\twidth?: number;\n\theight?: number;\n\t/** LQIP blurhash placeholder for rendering before the image loads */\n\tblurhash?: string;\n\t/** LQIP dominant-color placeholder, as a CSS color */\n\tdominantColor?: string;\n\talt?: string;\n\t/** Base URL without transforms, for responsive image generation */\n\tcdnBaseUrl?: string;\n\t/** For providers with URL-based transforms (Cloudinary, imgix) */\n\tgetSrc?: (opts: { width?: number; height?: number; format?: string }) => string;\n}\n\nexport interface VideoEmbed {\n\ttype: \"video\";\n\t/** Single source URL */\n\tsrc?: string;\n\t/** Multiple sources for format fallback */\n\tsources?: Array<{ src: string; type: string }>;\n\t/** Poster/thumbnail image */\n\tposter?: string;\n\twidth?: number;\n\theight?: number;\n\t/** Player controls */\n\tcontrols?: boolean;\n\tautoplay?: boolean;\n\tmuted?: boolean;\n\tloop?: boolean;\n\tplaysinline?: boolean;\n\tpreload?: \"none\" | \"metadata\" | \"auto\";\n\tcrossorigin?: \"anonymous\" | \"use-credentials\";\n}\n\nexport interface AudioEmbed {\n\ttype: \"audio\";\n\tsrc?: string;\n\tsources?: Array<{ src: string; type: string }>;\n\tcontrols?: boolean;\n\tautoplay?: boolean;\n\tmuted?: boolean;\n\tloop?: boolean;\n\tpreload?: \"none\" | \"metadata\" | \"auto\";\n}\n\nexport interface ComponentEmbed {\n\ttype: \"component\";\n\t/** Package to import from, e.g., \"@mux/player-react\" */\n\tpackage: string;\n\t/** Named export (default export if not specified) */\n\texport?: string;\n\t/** Props to pass to the component */\n\tprops: Record<string, unknown>;\n}\n\n/**\n * Options for thumbnail generation\n */\nexport interface ThumbnailOptions {\n\t/** Desired width */\n\twidth?: number;\n\t/** Desired height */\n\theight?: number;\n}\n\n/**\n * Runtime media provider interface\n * Implemented by provider entrypoints\n */\nexport interface MediaProvider {\n\t/**\n\t * List/search media items\n\t */\n\tlist(options: MediaListOptions): Promise<MediaListResult>;\n\n\t/**\n\t * Get a single item by ID (optional, for refresh/validation)\n\t */\n\tget?(id: string): Promise<MediaProviderItem | null>;\n\n\t/**\n\t * Upload new media (if capabilities.upload is true)\n\t */\n\tupload?(input: MediaUploadInput): Promise<MediaProviderItem>;\n\n\t/**\n\t * Delete media (if capabilities.delete is true)\n\t */\n\tdelete?(id: string): Promise<void>;\n\n\t/**\n\t * Get embed information for rendering this media item\n\t * Called at runtime when rendering content\n\t */\n\tgetEmbed(value: MediaValue, options?: EmbedOptions): Promise<EmbedResult> | EmbedResult;\n\n\t/**\n\t * Get a thumbnail URL for admin display\n\t * For images: returns a resized image URL\n\t * For videos: returns a poster/thumbnail URL\n\t */\n\tgetThumbnailUrl?(id: string, mimeType?: string, options?: ThumbnailOptions): string;\n}\n\n/**\n * Function signature for provider entrypoint modules\n */\nexport type CreateMediaProviderFn<TConfig = Record<string, unknown>> = (\n\tconfig: TConfig,\n) => MediaProvider;\n\n/**\n * Media value stored in content fields\n * This is what gets persisted when media is selected\n *\n * For backwards compatibility:\n * - `provider` defaults to \"local\" if not specified\n * - `src` is supported for legacy data or external URLs\n */\nexport interface MediaValue {\n\t/** Provider ID, e.g., \"local\", \"unsplash\", \"mux\" (defaults to \"local\") */\n\tprovider?: string;\n\n\t/** Provider-specific item ID */\n\tid: string;\n\n\t/** Direct URL (for local media or legacy data) */\n\tsrc?: string;\n\n\t/** Preview URL for admin display (external providers) */\n\tpreviewUrl?: string;\n\n\t/** Cached metadata for display without runtime lookup */\n\tfilename?: string;\n\tmimeType?: string;\n\twidth?: number;\n\theight?: number;\n\t/** Default focal point copied when the media item is selected */\n\tfocalX?: number;\n\tfocalY?: number;\n\t/** Cached LQIP blurhash placeholder (images only) */\n\tblurhash?: string;\n\t/** Cached LQIP dominant-color placeholder, as a CSS color (images only) */\n\tdominantColor?: string;\n\talt?: string;\n\n\t/** Provider-specific data needed for embedding */\n\tmeta?: Record<string, unknown>;\n}\n\n/**\n * Convert a MediaProviderItem to a MediaValue for storage\n */\nexport function mediaItemToValue(providerId: string, item: MediaProviderItem): MediaValue {\n\tconst focalPoint = normalizeFocalPoint(item.focalX, item.focalY);\n\treturn {\n\t\tprovider: providerId,\n\t\tid: item.id,\n\t\tfilename: item.filename,\n\t\tmimeType: item.mimeType,\n\t\twidth: item.width,\n\t\theight: item.height,\n\t\t...focalPoint,\n\t\tblurhash: item.blurhash,\n\t\tdominantColor: item.dominantColor,\n\t\talt: item.alt,\n\t\tmeta: item.meta,\n\t};\n}\n","/**\n * Local Media Provider\n *\n * The built-in media provider that wraps the current storage adapter and media database.\n * This is the default provider and is available unless explicitly disabled.\n */\n\nimport type { MediaProviderDescriptor } from \"./types.js\";\n\nexport interface LocalMediaConfig {\n\t/** Whether the local provider is enabled (default true) */\n\tenabled?: boolean;\n}\n\n/**\n * Local media provider configuration\n *\n * @example\n * ```ts\n * import { localMedia } from \"emdash/media\";\n *\n * emdash({\n * mediaProviders: [\n * localMedia(), // Uses defaults\n * // or: localMedia({ enabled: false }) to disable\n * ],\n * })\n * ```\n */\nexport function localMedia(config: LocalMediaConfig = {}): MediaProviderDescriptor {\n\treturn {\n\t\tid: \"local\",\n\t\tname: \"Library\",\n\t\ticon: \"📁\",\n\t\tentrypoint: \"emdash/media/local-runtime\",\n\t\tcapabilities: {\n\t\t\tbrowse: true,\n\t\t\tsearch: false, // TODO: Add search support\n\t\t\tupload: true,\n\t\t\tdelete: true,\n\t\t},\n\t\tconfig: {\n\t\t\tenabled: config.enabled ?? true,\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA+RA,SAAgB,iBAAiB,YAAoB,MAAqC;CACzF,MAAM,aAAa,oBAAoB,KAAK,QAAQ,KAAK,OAAO;AAChE,QAAO;EACN,UAAU;EACV,IAAI,KAAK;EACT,UAAU,KAAK;EACf,UAAU,KAAK;EACf,OAAO,KAAK;EACZ,QAAQ,KAAK;EACb,GAAG;EACH,UAAU,KAAK;EACf,eAAe,KAAK;EACpB,KAAK,KAAK;EACV,MAAM,KAAK;EACX;;;;;;;;;;;;;;;;;;;;AChRF,SAAgB,WAAW,SAA2B,EAAE,EAA2B;AAClF,QAAO;EACN,IAAI;EACJ,MAAM;EACN,MAAM;EACN,YAAY;EACZ,cAAc;GACb,QAAQ;GACR,QAAQ;GACR,QAAQ;GACR,QAAQ;GACR;EACD,QAAQ,EACP,SAAS,OAAO,WAAW,MAC3B;EACD"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import "../options-
|
|
2
|
-
import { t as Database } from "../types-
|
|
3
|
-
import "../types-
|
|
4
|
-
import "../relations-
|
|
5
|
-
import { h as MediaProviderItem, o as CreateMediaProviderFn } from "../placeholder-
|
|
6
|
-
import "../index-
|
|
7
|
-
import "../runner-
|
|
8
|
-
import "../index-
|
|
9
|
-
import { d as Storage } from "../types-
|
|
10
|
-
import "../types-
|
|
11
|
-
import "../hreflang-
|
|
12
|
-
import "../validate-
|
|
1
|
+
import "../options-BhZIeFY1.mjs";
|
|
2
|
+
import { t as Database } from "../types-DHxzBjbD.mjs";
|
|
3
|
+
import "../types-Vg6f5i3s.mjs";
|
|
4
|
+
import "../relations-C7B46bcU.mjs";
|
|
5
|
+
import { h as MediaProviderItem, o as CreateMediaProviderFn } from "../placeholder-BR4ZhVJl.mjs";
|
|
6
|
+
import "../index-DWbJrsAg.mjs";
|
|
7
|
+
import "../runner-zgqA_CqP.mjs";
|
|
8
|
+
import "../index-6bRee8zb.mjs";
|
|
9
|
+
import { d as Storage } from "../types-D_DWe7k9.mjs";
|
|
10
|
+
import "../types-CLqvnd05.mjs";
|
|
11
|
+
import "../hreflang-7pTHsLZJ.mjs";
|
|
12
|
+
import "../validate-DlqdOZXB.mjs";
|
|
13
13
|
import "../index.mjs";
|
|
14
14
|
import { Kysely } from "kysely";
|
|
15
15
|
|
|
@@ -41,6 +41,8 @@ declare function repoItemToProviderItem(item: {
|
|
|
41
41
|
size: number | null;
|
|
42
42
|
width: number | null;
|
|
43
43
|
height: number | null;
|
|
44
|
+
focalX?: number | null;
|
|
45
|
+
focalY?: number | null;
|
|
44
46
|
alt: string | null;
|
|
45
47
|
caption: string | null;
|
|
46
48
|
storageKey: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-runtime.d.mts","names":[],"sources":["../../src/media/local-runtime.ts"],"mappings":";;;;;;;;;;;;;;;;UA2BiB,uBAAA;EAChB,OAAA;EAEA,EAAA,GAAK,MAAA,CAAO,QAAA;EAH2B;;;;;;;EAWvC,KAAA,SAAc,MAAA,CAAO,QAAA;EACrB,OAAA,GAAU,OAAA;AAAA;;;;cAME,mBAAA,EAAqB,qBAAA,CAAsB,uBAAA;;;;
|
|
1
|
+
{"version":3,"file":"local-runtime.d.mts","names":[],"sources":["../../src/media/local-runtime.ts"],"mappings":";;;;;;;;;;;;;;;;UA2BiB,uBAAA;EAChB,OAAA;EAEA,EAAA,GAAK,MAAA,CAAO,QAAA;EAH2B;;;;;;;EAWvC,KAAA,SAAc,MAAA,CAAO,QAAA;EACrB,OAAA,GAAU,OAAA;AAAA;;;;cAME,mBAAA,EAAqB,qBAAA,CAAsB,uBAAA;;;;iBAmLxC,sBAAA,CAAuB,IAAA;EACtC,EAAA;EACA,QAAA;EACA,QAAA;EACA,IAAA;EACA,KAAA;EACA,MAAA;EACA,MAAA;EACA,MAAA;EACA,GAAA;EACA,OAAA;EACA,UAAA;EACA,QAAA;EACA,aAAA;AAAA,IACG,iBAAA"}
|
|
@@ -4,11 +4,11 @@ import "../after-CBU2vkoO.mjs";
|
|
|
4
4
|
import "../object-cache-71tPfV4A.mjs";
|
|
5
5
|
import "../base64-CvLhUKQv.mjs";
|
|
6
6
|
import "../types-CQPWhPxE.mjs";
|
|
7
|
-
import { t as MediaRepository } from "../media-
|
|
8
|
-
import "../options-
|
|
9
|
-
import "../request-cache-
|
|
10
|
-
import "../loader-
|
|
11
|
-
import { o as invalidateSiteSettingsCache } from "../settings-
|
|
7
|
+
import { t as MediaRepository } from "../media-D6SeAfBl.mjs";
|
|
8
|
+
import "../options-BHPeIbBd.mjs";
|
|
9
|
+
import "../request-cache-DH9zdCOD.mjs";
|
|
10
|
+
import "../loader-ZsjE4paL.mjs";
|
|
11
|
+
import { o as invalidateSiteSettingsCache } from "../settings-BgN-0DT-.mjs";
|
|
12
12
|
|
|
13
13
|
//#region src/media/local-runtime.ts
|
|
14
14
|
/**
|
|
@@ -34,6 +34,8 @@ const createMediaProvider = (config) => {
|
|
|
34
34
|
size: item.size ?? void 0,
|
|
35
35
|
width: item.width ?? void 0,
|
|
36
36
|
height: item.height ?? void 0,
|
|
37
|
+
focalX: item.focalX ?? void 0,
|
|
38
|
+
focalY: item.focalY ?? void 0,
|
|
37
39
|
blurhash: item.blurhash ?? void 0,
|
|
38
40
|
dominantColor: item.dominantColor ?? void 0,
|
|
39
41
|
alt: item.alt ?? void 0,
|
|
@@ -58,6 +60,8 @@ const createMediaProvider = (config) => {
|
|
|
58
60
|
size: item.size ?? void 0,
|
|
59
61
|
width: item.width ?? void 0,
|
|
60
62
|
height: item.height ?? void 0,
|
|
63
|
+
focalX: item.focalX ?? void 0,
|
|
64
|
+
focalY: item.focalY ?? void 0,
|
|
61
65
|
blurhash: item.blurhash ?? void 0,
|
|
62
66
|
dominantColor: item.dominantColor ?? void 0,
|
|
63
67
|
alt: item.alt ?? void 0,
|
|
@@ -138,6 +142,8 @@ function repoItemToProviderItem(item) {
|
|
|
138
142
|
size: item.size ?? void 0,
|
|
139
143
|
width: item.width ?? void 0,
|
|
140
144
|
height: item.height ?? void 0,
|
|
145
|
+
focalX: item.focalX ?? void 0,
|
|
146
|
+
focalY: item.focalY ?? void 0,
|
|
141
147
|
blurhash: item.blurhash ?? void 0,
|
|
142
148
|
dominantColor: item.dominantColor ?? void 0,
|
|
143
149
|
alt: item.alt ?? void 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-runtime.mjs","names":[],"sources":["../../src/media/local-runtime.ts"],"sourcesContent":["/**\n * Local Media Provider Runtime\n *\n * This is the runtime implementation loaded by the entrypoint.\n * It wraps the existing MediaRepository and storage adapter.\n *\n * Note: This provider is special because it needs access to the database\n * and storage adapter. The createMediaProvider function receives these\n * via the config object, injected by the runtime.\n */\n\nimport type { Kysely } from \"kysely\";\n\nimport { MediaRepository } from \"../database/repositories/media.js\";\nimport type { Database } from \"../database/types.js\";\nimport type { Storage } from \"../index.js\";\nimport { invalidateSiteSettingsCache } from \"../settings/index.js\";\nimport type {\n\tCreateMediaProviderFn,\n\tMediaProvider,\n\tMediaListOptions,\n\tMediaProviderItem,\n\tMediaValue,\n\tEmbedResult,\n\tEmbedOptions,\n} from \"./types.js\";\n\nexport interface LocalMediaRuntimeConfig {\n\tenabled?: boolean;\n\t// These are injected by the runtime, not from user config\n\tdb?: Kysely<Database>;\n\t/**\n\t * Resolver for the live connection, preferred over `db`. The runtime\n\t * injects it so a connection-backed adapter (Postgres over Hyperdrive)\n\t * serves provider queries from the current request-scoped connection in ALS\n\t * rather than a snapshot of the per-isolate singleton. Omitted for stateless\n\t * adapters (D1, Node SQLite), where `db` is used directly.\n\t */\n\tgetDb?: () => Kysely<Database>;\n\tstorage?: Storage;\n}\n\n/**\n * Create the local media provider\n */\nexport const createMediaProvider: CreateMediaProviderFn<LocalMediaRuntimeConfig> = (config) => {\n\tconst { db, storage } = config;\n\n\tif (!db) {\n\t\tthrow new Error(\"Local media provider requires database connection\");\n\t}\n\n\t// Resolve the connection per operation (not captured once) so a\n\t// connection-backed adapter uses the current event-scoped connection; falls\n\t// back to the injected `db` for stateless adapters.\n\tconst resolveDb = config.getDb ?? (() => db);\n\tconst repo = () => new MediaRepository(resolveDb());\n\n\tconst provider: MediaProvider = {\n\t\tasync list(options: MediaListOptions) {\n\t\t\tconst result = await repo().findMany({\n\t\t\t\tcursor: options.cursor,\n\t\t\t\tlimit: options.limit,\n\t\t\t\tmimeType: options.mimeType,\n\t\t\t\t// TODO: Add search support when capabilities.search is true\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\titems: result.items.map((item) => ({\n\t\t\t\t\tid: item.id,\n\t\t\t\t\tfilename: item.filename,\n\t\t\t\t\tmimeType: item.mimeType,\n\t\t\t\t\tsize: item.size ?? undefined,\n\t\t\t\t\twidth: item.width ?? undefined,\n\t\t\t\t\theight: item.height ?? undefined,\n\t\t\t\t\tblurhash: item.blurhash ?? undefined,\n\t\t\t\t\tdominantColor: item.dominantColor ?? undefined,\n\t\t\t\t\talt: item.alt ?? undefined,\n\t\t\t\t\tpreviewUrl: `/_emdash/api/media/file/${item.storageKey}`,\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\tstorageKey: item.storageKey,\n\t\t\t\t\t\tcaption: item.caption,\n\t\t\t\t\t\tblurhash: item.blurhash,\n\t\t\t\t\t\tdominantColor: item.dominantColor,\n\t\t\t\t\t},\n\t\t\t\t})),\n\t\t\t\tnextCursor: result.nextCursor,\n\t\t\t};\n\t\t},\n\n\t\tasync get(id: string) {\n\t\t\tconst item = await repo().findById(id);\n\t\t\tif (!item) return null;\n\n\t\t\treturn {\n\t\t\t\tid: item.id,\n\t\t\t\tfilename: item.filename,\n\t\t\t\tmimeType: item.mimeType,\n\t\t\t\tsize: item.size ?? undefined,\n\t\t\t\twidth: item.width ?? undefined,\n\t\t\t\theight: item.height ?? undefined,\n\t\t\t\tblurhash: item.blurhash ?? undefined,\n\t\t\t\tdominantColor: item.dominantColor ?? undefined,\n\t\t\t\talt: item.alt ?? undefined,\n\t\t\t\tpreviewUrl: `/_emdash/api/media/file/${item.storageKey}`,\n\t\t\t\tmeta: {\n\t\t\t\t\tstorageKey: item.storageKey,\n\t\t\t\t\tcaption: item.caption,\n\t\t\t\t\tblurhash: item.blurhash,\n\t\t\t\t\tdominantColor: item.dominantColor,\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\n\t\tasync upload(_input) {\n\t\t\tif (!storage) {\n\t\t\t\tthrow new Error(\"Storage not configured for local media provider\");\n\t\t\t}\n\n\t\t\t// This is handled by the existing media upload endpoint\n\t\t\t// The provider interface is used by external providers\n\t\t\t// For local, we delegate to the existing system\n\t\t\tthrow new Error(\"Local upload should use /_emdash/api/media endpoint\");\n\t\t},\n\n\t\tasync delete(id: string) {\n\t\t\tconst repoInstance = repo();\n\t\t\tconst item = await repoInstance.findById(id);\n\t\t\tif (!item) return;\n\n\t\t\t// Delete from storage if available\n\t\t\tif (storage) {\n\t\t\t\ttry {\n\t\t\t\t\tawait storage.delete(item.storageKey);\n\t\t\t\t} catch {\n\t\t\t\t\t// Ignore storage deletion errors\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tawait repoInstance.delete(id);\n\n\t\t\t// If this row was referenced by `logo`, `favicon`, or\n\t\t\t// `seo.defaultOgImage`, the worker-scoped settings cache now\n\t\t\t// holds a stale URL. The provider routes (and any future caller)\n\t\t\t// bypass `handleMediaDelete`, so we invalidate here too.\n\t\t\tinvalidateSiteSettingsCache();\n\t\t},\n\n\t\tgetEmbed(value: MediaValue, _options?: EmbedOptions): EmbedResult {\n\t\t\tconst storageKey =\n\t\t\t\ttypeof value.meta?.storageKey === \"string\" ? value.meta.storageKey : value.id;\n\t\t\tconst src = `/_emdash/api/media/file/${storageKey}`;\n\t\t\tconst mimeType = value.mimeType || \"\";\n\n\t\t\t// Prefer the first-class fields; fall back to `meta` for legacy snapshots\n\t\t\t// stored before LQIP was promoted off the provider-specific `meta` bag.\n\t\t\tconst blurhash =\n\t\t\t\tvalue.blurhash ??\n\t\t\t\t(typeof value.meta?.blurhash === \"string\" ? value.meta.blurhash : undefined);\n\t\t\tconst dominantColor =\n\t\t\t\tvalue.dominantColor ??\n\t\t\t\t(typeof value.meta?.dominantColor === \"string\" ? value.meta.dominantColor : undefined);\n\n\t\t\t// Determine embed type based on MIME type\n\t\t\tif (mimeType.startsWith(\"image/\")) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"image\",\n\t\t\t\t\tsrc,\n\t\t\t\t\twidth: value.width,\n\t\t\t\t\theight: value.height,\n\t\t\t\t\tblurhash,\n\t\t\t\t\tdominantColor,\n\t\t\t\t\talt: value.alt,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (mimeType.startsWith(\"video/\")) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"video\",\n\t\t\t\t\tsrc,\n\t\t\t\t\twidth: value.width,\n\t\t\t\t\theight: value.height,\n\t\t\t\t\tcontrols: true,\n\t\t\t\t\tpreload: \"metadata\",\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (mimeType.startsWith(\"audio/\")) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"audio\",\n\t\t\t\t\tsrc,\n\t\t\t\t\tcontrols: true,\n\t\t\t\t\tpreload: \"metadata\",\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Fallback: treat as image (for unknown types)\n\t\t\treturn {\n\t\t\t\ttype: \"image\",\n\t\t\t\tsrc,\n\t\t\t\twidth: value.width,\n\t\t\t\theight: value.height,\n\t\t\t\tblurhash,\n\t\t\t\tdominantColor,\n\t\t\t\talt: value.alt,\n\t\t\t};\n\t\t},\n\n\t\tgetThumbnailUrl(id: string, _mimeType?: string) {\n\t\t\t// For local media, return the file URL\n\t\t\treturn `/_emdash/api/media/file/${id}`;\n\t\t},\n\t};\n\n\treturn provider;\n};\n\n/**\n * Helper to convert a MediaRepository item to MediaProviderItem\n */\nexport function repoItemToProviderItem(item: {\n\tid: string;\n\tfilename: string;\n\tmimeType: string;\n\tsize: number | null;\n\twidth: number | null;\n\theight: number | null;\n\talt: string | null;\n\tcaption: string | null;\n\tstorageKey: string;\n\tblurhash: string | null;\n\tdominantColor: string | null;\n}): MediaProviderItem {\n\treturn {\n\t\tid: item.id,\n\t\tfilename: item.filename,\n\t\tmimeType: item.mimeType,\n\t\tsize: item.size ?? undefined,\n\t\twidth: item.width ?? undefined,\n\t\theight: item.height ?? undefined,\n\t\tblurhash: item.blurhash ?? undefined,\n\t\tdominantColor: item.dominantColor ?? undefined,\n\t\talt: item.alt ?? undefined,\n\t\tpreviewUrl: `/_emdash/api/media/file/${item.storageKey}`,\n\t\tmeta: {\n\t\t\tstorageKey: item.storageKey,\n\t\t\tcaption: item.caption,\n\t\t\tblurhash: item.blurhash,\n\t\t\tdominantColor: item.dominantColor,\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA6CA,MAAa,uBAAuE,WAAW;CAC9F,MAAM,EAAE,IAAI,YAAY;AAExB,KAAI,CAAC,GACJ,OAAM,IAAI,MAAM,oDAAoD;CAMrE,MAAM,YAAY,OAAO,gBAAgB;CACzC,MAAM,aAAa,IAAI,gBAAgB,WAAW,CAAC;AA8JnD,QA5JgC;EAC/B,MAAM,KAAK,SAA2B;GACrC,MAAM,SAAS,MAAM,MAAM,CAAC,SAAS;IACpC,QAAQ,QAAQ;IAChB,OAAO,QAAQ;IACf,UAAU,QAAQ;IAElB,CAAC;AAEF,UAAO;IACN,OAAO,OAAO,MAAM,KAAK,UAAU;KAClC,IAAI,KAAK;KACT,UAAU,KAAK;KACf,UAAU,KAAK;KACf,MAAM,KAAK,QAAQ;KACnB,OAAO,KAAK,SAAS;KACrB,QAAQ,KAAK,UAAU;KACvB,UAAU,KAAK,YAAY;KAC3B,eAAe,KAAK,iBAAiB;KACrC,KAAK,KAAK,OAAO;KACjB,YAAY,2BAA2B,KAAK;KAC5C,MAAM;MACL,YAAY,KAAK;MACjB,SAAS,KAAK;MACd,UAAU,KAAK;MACf,eAAe,KAAK;MACpB;KACD,EAAE;IACH,YAAY,OAAO;IACnB;;EAGF,MAAM,IAAI,IAAY;GACrB,MAAM,OAAO,MAAM,MAAM,CAAC,SAAS,GAAG;AACtC,OAAI,CAAC,KAAM,QAAO;AAElB,UAAO;IACN,IAAI,KAAK;IACT,UAAU,KAAK;IACf,UAAU,KAAK;IACf,MAAM,KAAK,QAAQ;IACnB,OAAO,KAAK,SAAS;IACrB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,QAAQ,MAAM;IACd;IACA;IACA,KAAK,MAAM;IACX;;EAGF,gBAAgB,IAAY,WAAoB;AAE/C,UAAO,2BAA2B;;EAEnC;;;;;AAQF,SAAgB,uBAAuB,MAYjB;AACrB,QAAO;EACN,IAAI,KAAK;EACT,UAAU,KAAK;EACf,UAAU,KAAK;EACf,MAAM,KAAK,QAAQ;EACnB,OAAO,KAAK,SAAS;EACrB,QAAQ,KAAK,UAAU;EACvB,UAAU,KAAK,YAAY;EAC3B,eAAe,KAAK,iBAAiB;EACrC,KAAK,KAAK,OAAO;EACjB,YAAY,2BAA2B,KAAK;EAC5C,MAAM;GACL,YAAY,KAAK;GACjB,SAAS,KAAK;GACd,UAAU,KAAK;GACf,eAAe,KAAK;GACpB;EACD"}
|
|
1
|
+
{"version":3,"file":"local-runtime.mjs","names":[],"sources":["../../src/media/local-runtime.ts"],"sourcesContent":["/**\n * Local Media Provider Runtime\n *\n * This is the runtime implementation loaded by the entrypoint.\n * It wraps the existing MediaRepository and storage adapter.\n *\n * Note: This provider is special because it needs access to the database\n * and storage adapter. The createMediaProvider function receives these\n * via the config object, injected by the runtime.\n */\n\nimport type { Kysely } from \"kysely\";\n\nimport { MediaRepository } from \"../database/repositories/media.js\";\nimport type { Database } from \"../database/types.js\";\nimport type { Storage } from \"../index.js\";\nimport { invalidateSiteSettingsCache } from \"../settings/index.js\";\nimport type {\n\tCreateMediaProviderFn,\n\tMediaProvider,\n\tMediaListOptions,\n\tMediaProviderItem,\n\tMediaValue,\n\tEmbedResult,\n\tEmbedOptions,\n} from \"./types.js\";\n\nexport interface LocalMediaRuntimeConfig {\n\tenabled?: boolean;\n\t// These are injected by the runtime, not from user config\n\tdb?: Kysely<Database>;\n\t/**\n\t * Resolver for the live connection, preferred over `db`. The runtime\n\t * injects it so a connection-backed adapter (Postgres over Hyperdrive)\n\t * serves provider queries from the current request-scoped connection in ALS\n\t * rather than a snapshot of the per-isolate singleton. Omitted for stateless\n\t * adapters (D1, Node SQLite), where `db` is used directly.\n\t */\n\tgetDb?: () => Kysely<Database>;\n\tstorage?: Storage;\n}\n\n/**\n * Create the local media provider\n */\nexport const createMediaProvider: CreateMediaProviderFn<LocalMediaRuntimeConfig> = (config) => {\n\tconst { db, storage } = config;\n\n\tif (!db) {\n\t\tthrow new Error(\"Local media provider requires database connection\");\n\t}\n\n\t// Resolve the connection per operation (not captured once) so a\n\t// connection-backed adapter uses the current event-scoped connection; falls\n\t// back to the injected `db` for stateless adapters.\n\tconst resolveDb = config.getDb ?? (() => db);\n\tconst repo = () => new MediaRepository(resolveDb());\n\n\tconst provider: MediaProvider = {\n\t\tasync list(options: MediaListOptions) {\n\t\t\tconst result = await repo().findMany({\n\t\t\t\tcursor: options.cursor,\n\t\t\t\tlimit: options.limit,\n\t\t\t\tmimeType: options.mimeType,\n\t\t\t\t// TODO: Add search support when capabilities.search is true\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\titems: result.items.map((item) => ({\n\t\t\t\t\tid: item.id,\n\t\t\t\t\tfilename: item.filename,\n\t\t\t\t\tmimeType: item.mimeType,\n\t\t\t\t\tsize: item.size ?? undefined,\n\t\t\t\t\twidth: item.width ?? undefined,\n\t\t\t\t\theight: item.height ?? undefined,\n\t\t\t\t\tfocalX: item.focalX ?? undefined,\n\t\t\t\t\tfocalY: item.focalY ?? undefined,\n\t\t\t\t\tblurhash: item.blurhash ?? undefined,\n\t\t\t\t\tdominantColor: item.dominantColor ?? undefined,\n\t\t\t\t\talt: item.alt ?? undefined,\n\t\t\t\t\tpreviewUrl: `/_emdash/api/media/file/${item.storageKey}`,\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\tstorageKey: item.storageKey,\n\t\t\t\t\t\tcaption: item.caption,\n\t\t\t\t\t\tblurhash: item.blurhash,\n\t\t\t\t\t\tdominantColor: item.dominantColor,\n\t\t\t\t\t},\n\t\t\t\t})),\n\t\t\t\tnextCursor: result.nextCursor,\n\t\t\t};\n\t\t},\n\n\t\tasync get(id: string) {\n\t\t\tconst item = await repo().findById(id);\n\t\t\tif (!item) return null;\n\n\t\t\treturn {\n\t\t\t\tid: item.id,\n\t\t\t\tfilename: item.filename,\n\t\t\t\tmimeType: item.mimeType,\n\t\t\t\tsize: item.size ?? undefined,\n\t\t\t\twidth: item.width ?? undefined,\n\t\t\t\theight: item.height ?? undefined,\n\t\t\t\tfocalX: item.focalX ?? undefined,\n\t\t\t\tfocalY: item.focalY ?? undefined,\n\t\t\t\tblurhash: item.blurhash ?? undefined,\n\t\t\t\tdominantColor: item.dominantColor ?? undefined,\n\t\t\t\talt: item.alt ?? undefined,\n\t\t\t\tpreviewUrl: `/_emdash/api/media/file/${item.storageKey}`,\n\t\t\t\tmeta: {\n\t\t\t\t\tstorageKey: item.storageKey,\n\t\t\t\t\tcaption: item.caption,\n\t\t\t\t\tblurhash: item.blurhash,\n\t\t\t\t\tdominantColor: item.dominantColor,\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\n\t\tasync upload(_input) {\n\t\t\tif (!storage) {\n\t\t\t\tthrow new Error(\"Storage not configured for local media provider\");\n\t\t\t}\n\n\t\t\t// This is handled by the existing media upload endpoint\n\t\t\t// The provider interface is used by external providers\n\t\t\t// For local, we delegate to the existing system\n\t\t\tthrow new Error(\"Local upload should use /_emdash/api/media endpoint\");\n\t\t},\n\n\t\tasync delete(id: string) {\n\t\t\tconst repoInstance = repo();\n\t\t\tconst item = await repoInstance.findById(id);\n\t\t\tif (!item) return;\n\n\t\t\t// Delete from storage if available\n\t\t\tif (storage) {\n\t\t\t\ttry {\n\t\t\t\t\tawait storage.delete(item.storageKey);\n\t\t\t\t} catch {\n\t\t\t\t\t// Ignore storage deletion errors\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tawait repoInstance.delete(id);\n\n\t\t\t// If this row was referenced by `logo`, `favicon`, or\n\t\t\t// `seo.defaultOgImage`, the worker-scoped settings cache now\n\t\t\t// holds a stale URL. The provider routes (and any future caller)\n\t\t\t// bypass `handleMediaDelete`, so we invalidate here too.\n\t\t\tinvalidateSiteSettingsCache();\n\t\t},\n\n\t\tgetEmbed(value: MediaValue, _options?: EmbedOptions): EmbedResult {\n\t\t\tconst storageKey =\n\t\t\t\ttypeof value.meta?.storageKey === \"string\" ? value.meta.storageKey : value.id;\n\t\t\tconst src = `/_emdash/api/media/file/${storageKey}`;\n\t\t\tconst mimeType = value.mimeType || \"\";\n\n\t\t\t// Prefer the first-class fields; fall back to `meta` for legacy snapshots\n\t\t\t// stored before LQIP was promoted off the provider-specific `meta` bag.\n\t\t\tconst blurhash =\n\t\t\t\tvalue.blurhash ??\n\t\t\t\t(typeof value.meta?.blurhash === \"string\" ? value.meta.blurhash : undefined);\n\t\t\tconst dominantColor =\n\t\t\t\tvalue.dominantColor ??\n\t\t\t\t(typeof value.meta?.dominantColor === \"string\" ? value.meta.dominantColor : undefined);\n\n\t\t\t// Determine embed type based on MIME type\n\t\t\tif (mimeType.startsWith(\"image/\")) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"image\",\n\t\t\t\t\tsrc,\n\t\t\t\t\twidth: value.width,\n\t\t\t\t\theight: value.height,\n\t\t\t\t\tblurhash,\n\t\t\t\t\tdominantColor,\n\t\t\t\t\talt: value.alt,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (mimeType.startsWith(\"video/\")) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"video\",\n\t\t\t\t\tsrc,\n\t\t\t\t\twidth: value.width,\n\t\t\t\t\theight: value.height,\n\t\t\t\t\tcontrols: true,\n\t\t\t\t\tpreload: \"metadata\",\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (mimeType.startsWith(\"audio/\")) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"audio\",\n\t\t\t\t\tsrc,\n\t\t\t\t\tcontrols: true,\n\t\t\t\t\tpreload: \"metadata\",\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Fallback: treat as image (for unknown types)\n\t\t\treturn {\n\t\t\t\ttype: \"image\",\n\t\t\t\tsrc,\n\t\t\t\twidth: value.width,\n\t\t\t\theight: value.height,\n\t\t\t\tblurhash,\n\t\t\t\tdominantColor,\n\t\t\t\talt: value.alt,\n\t\t\t};\n\t\t},\n\n\t\tgetThumbnailUrl(id: string, _mimeType?: string) {\n\t\t\t// For local media, return the file URL\n\t\t\treturn `/_emdash/api/media/file/${id}`;\n\t\t},\n\t};\n\n\treturn provider;\n};\n\n/**\n * Helper to convert a MediaRepository item to MediaProviderItem\n */\nexport function repoItemToProviderItem(item: {\n\tid: string;\n\tfilename: string;\n\tmimeType: string;\n\tsize: number | null;\n\twidth: number | null;\n\theight: number | null;\n\tfocalX?: number | null;\n\tfocalY?: number | null;\n\talt: string | null;\n\tcaption: string | null;\n\tstorageKey: string;\n\tblurhash: string | null;\n\tdominantColor: string | null;\n}): MediaProviderItem {\n\treturn {\n\t\tid: item.id,\n\t\tfilename: item.filename,\n\t\tmimeType: item.mimeType,\n\t\tsize: item.size ?? undefined,\n\t\twidth: item.width ?? undefined,\n\t\theight: item.height ?? undefined,\n\t\tfocalX: item.focalX ?? undefined,\n\t\tfocalY: item.focalY ?? undefined,\n\t\tblurhash: item.blurhash ?? undefined,\n\t\tdominantColor: item.dominantColor ?? undefined,\n\t\talt: item.alt ?? undefined,\n\t\tpreviewUrl: `/_emdash/api/media/file/${item.storageKey}`,\n\t\tmeta: {\n\t\t\tstorageKey: item.storageKey,\n\t\t\tcaption: item.caption,\n\t\t\tblurhash: item.blurhash,\n\t\t\tdominantColor: item.dominantColor,\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA6CA,MAAa,uBAAuE,WAAW;CAC9F,MAAM,EAAE,IAAI,YAAY;AAExB,KAAI,CAAC,GACJ,OAAM,IAAI,MAAM,oDAAoD;CAMrE,MAAM,YAAY,OAAO,gBAAgB;CACzC,MAAM,aAAa,IAAI,gBAAgB,WAAW,CAAC;AAkKnD,QAhKgC;EAC/B,MAAM,KAAK,SAA2B;GACrC,MAAM,SAAS,M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AK;EAC5C,MAAM;GACL,YAAY,KAAK;GACjB,SAAS,KAAK;GACd,UAAU,KAAK;GACf,eAAe,KAAK;GACpB;EACD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { t as LOCALE_CODE_PATTERN } from "./config-C3EBstHi.mjs";
|
|
2
|
+
import { t as isValidFocalPointUpdate } from "./focal-point-BeWFo6Xx.mjs";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
|
|
4
5
|
//#region src/api/schemas/common.ts
|
|
@@ -74,6 +75,15 @@ const mediaUsageCoverageSchema = z.object({
|
|
|
74
75
|
scope: z.literal("all_content_collections"),
|
|
75
76
|
status: mediaUsageCoverageStatusSchema
|
|
76
77
|
}).meta({ id: "MediaUsageCoverage" });
|
|
78
|
+
const mediaUsageProgressSchema = z.object({
|
|
79
|
+
status: z.enum([
|
|
80
|
+
"indexing",
|
|
81
|
+
"ready",
|
|
82
|
+
"needs_attention"
|
|
83
|
+
]),
|
|
84
|
+
readyCollections: z.number().int().min(0),
|
|
85
|
+
totalCollections: z.number().int().min(0)
|
|
86
|
+
}).meta({ id: "MediaUsageProgress" });
|
|
77
87
|
const mediaUsageSummarySchema = z.object({
|
|
78
88
|
count: z.number().int().min(0).nullable(),
|
|
79
89
|
coverage: mediaUsageCoverageSchema
|
|
@@ -192,6 +202,55 @@ const mediaUsageWorkRetryConflictSchema = z.object({
|
|
|
192
202
|
message: z.string()
|
|
193
203
|
})])
|
|
194
204
|
});
|
|
205
|
+
const mediaUsageActivationStateSchema = z.enum([
|
|
206
|
+
"expanded",
|
|
207
|
+
"activating",
|
|
208
|
+
"active"
|
|
209
|
+
]).meta({ id: "MediaUsageActivationState" });
|
|
210
|
+
const mediaUsageActivationStatusSchema = z.object({
|
|
211
|
+
state: mediaUsageActivationStateSchema,
|
|
212
|
+
collectionCursor: z.string().nullable(),
|
|
213
|
+
attemptCount: z.number().int().min(0),
|
|
214
|
+
drainConfirmedAt: z.string().nullable(),
|
|
215
|
+
lastAttemptedAt: z.string().nullable(),
|
|
216
|
+
lastErrorCode: z.literal("MEDIA_USAGE_ACTIVATION_FAILED").nullable(),
|
|
217
|
+
leaseExpiresAt: z.string().nullable(),
|
|
218
|
+
activatedAt: z.string().nullable(),
|
|
219
|
+
updatedAt: z.string()
|
|
220
|
+
}).meta({ id: "MediaUsageActivationStatus" });
|
|
221
|
+
const mediaUsageActivationAdvanceBody = z.object({ writersDrained: z.literal(true) }).strict().meta({ id: "MediaUsageActivationAdvanceBody" });
|
|
222
|
+
const mediaUsageActivationAdvanceResponseSchema = z.object({
|
|
223
|
+
outcome: z.enum(["activating", "active"]),
|
|
224
|
+
processedCollections: z.number().int().min(0).max(1),
|
|
225
|
+
activation: mediaUsageActivationStatusSchema
|
|
226
|
+
}).meta({ id: "MediaUsageActivationAdvanceResponse" });
|
|
227
|
+
const mediaUsageProgressAdvanceResponseSchema = z.object({
|
|
228
|
+
activation: mediaUsageActivationStatusSchema,
|
|
229
|
+
progress: mediaUsageProgressSchema.nullable(),
|
|
230
|
+
nextRequestInMs: z.union([
|
|
231
|
+
z.literal(0),
|
|
232
|
+
z.literal(3e4),
|
|
233
|
+
z.null()
|
|
234
|
+
])
|
|
235
|
+
}).meta({ id: "MediaUsageProgressAdvanceResponse" });
|
|
236
|
+
const mediaUsageActivationConflictSchema = z.object({
|
|
237
|
+
success: z.literal(false),
|
|
238
|
+
error: z.discriminatedUnion("code", [
|
|
239
|
+
z.object({
|
|
240
|
+
code: z.literal("MEDIA_USAGE_ACTIVATION_BUSY"),
|
|
241
|
+
message: z.string(),
|
|
242
|
+
details: z.object({ leaseExpiresAt: z.string() })
|
|
243
|
+
}),
|
|
244
|
+
z.object({
|
|
245
|
+
code: z.literal("MEDIA_USAGE_ACTIVATION_CONFLICT"),
|
|
246
|
+
message: z.string()
|
|
247
|
+
}),
|
|
248
|
+
z.object({
|
|
249
|
+
code: z.literal("MEDIA_USAGE_ACTIVATION_VERSION_MISMATCH"),
|
|
250
|
+
message: z.string()
|
|
251
|
+
})
|
|
252
|
+
])
|
|
253
|
+
});
|
|
195
254
|
const mediaUsageCollectionDeletionStateSchema = z.enum([
|
|
196
255
|
"pending",
|
|
197
256
|
"retry",
|
|
@@ -243,17 +302,38 @@ const mimeTypeFilter = z.union([z.string(), z.array(z.string())]).transform((v)
|
|
|
243
302
|
return (Array.isArray(v) ? v : v.split(",")).map((s) => s.trim()).filter((s) => s.length > 0);
|
|
244
303
|
}).optional();
|
|
245
304
|
const mediaListQuery = cursorPaginationQuery.extend({
|
|
305
|
+
page: z.coerce.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional(),
|
|
246
306
|
mimeType: mimeTypeFilter,
|
|
307
|
+
folderId: z.union([z.literal("unfiled"), z.string().min(1).max(64)]).optional().meta({ description: "Filter by a media folder ID. Use `unfiled` for the Main library; omit for all media." }),
|
|
247
308
|
q: z.string().trim().min(1).max(200).optional(),
|
|
248
309
|
includeUsage: z.literal("1").optional().meta({ description: "Include a coverage-aware usage summary on each media item" })
|
|
310
|
+
}).refine(({ cursor, page }) => cursor === void 0 || page === void 0, {
|
|
311
|
+
message: "cursor and page cannot be used together",
|
|
312
|
+
path: ["page"]
|
|
249
313
|
}).meta({ id: "MediaListQuery" });
|
|
250
314
|
const mediaGetQuery = z.object({ includeUsage: z.literal("1").optional().meta({ description: "Include a coverage-aware usage summary on the media item" }) }).meta({ id: "MediaGetQuery" });
|
|
251
315
|
const mediaUpdateBody = z.object({
|
|
252
316
|
alt: z.string().optional(),
|
|
253
317
|
caption: z.string().optional(),
|
|
254
318
|
width: z.number().int().positive().optional(),
|
|
255
|
-
height: z.number().int().positive().optional()
|
|
319
|
+
height: z.number().int().positive().optional(),
|
|
320
|
+
folderId: z.union([z.literal("unfiled"), z.string().min(1).max(64)]).nullable().optional().transform((value) => value === "unfiled" ? null : value).meta({ description: "Assign a media folder ID, or use null or `unfiled` to return the item to the Main library." }),
|
|
321
|
+
focalX: z.number().min(0).max(1).nullable().optional(),
|
|
322
|
+
focalY: z.number().min(0).max(1).nullable().optional()
|
|
323
|
+
}).superRefine((value, context) => {
|
|
324
|
+
if (!isValidFocalPointUpdate(value)) context.addIssue({
|
|
325
|
+
code: "custom",
|
|
326
|
+
message: "focalX and focalY must both be numbers or both be null",
|
|
327
|
+
path: ["focalX"]
|
|
328
|
+
});
|
|
256
329
|
}).meta({ id: "MediaUpdateBody" });
|
|
330
|
+
const mediaFolderIdSchema = z.string().min(1).max(64);
|
|
331
|
+
const mediaFolderListQuery = cursorPaginationQuery.extend({ q: z.string().trim().min(1).max(200).optional() }).meta({ id: "MediaFolderListQuery" });
|
|
332
|
+
const mediaFolderNameSchema = z.string().refine((value) => {
|
|
333
|
+
const length = value.trim().length;
|
|
334
|
+
return length >= 1 && length <= 200;
|
|
335
|
+
}, { message: "Folder name must be between 1 and 200 characters" });
|
|
336
|
+
const mediaFolderBody = z.object({ name: mediaFolderNameSchema }).meta({ id: "MediaFolderBody" });
|
|
257
337
|
/** Default maximum allowed file upload size (50 MB). */
|
|
258
338
|
const DEFAULT_MAX_UPLOAD_SIZE = 50 * 1024 * 1024;
|
|
259
339
|
function formatFileSize(bytes) {
|
|
@@ -293,6 +373,8 @@ const mediaItemSchema = z.object({
|
|
|
293
373
|
size: z.number().nullable(),
|
|
294
374
|
width: z.number().nullable(),
|
|
295
375
|
height: z.number().nullable(),
|
|
376
|
+
focalX: z.number().nullable(),
|
|
377
|
+
focalY: z.number().nullable(),
|
|
296
378
|
alt: z.string().nullable(),
|
|
297
379
|
caption: z.string().nullable(),
|
|
298
380
|
storageKey: z.string(),
|
|
@@ -301,19 +383,31 @@ const mediaItemSchema = z.object({
|
|
|
301
383
|
blurhash: z.string().nullable(),
|
|
302
384
|
dominantColor: z.string().nullable(),
|
|
303
385
|
createdAt: z.string(),
|
|
304
|
-
authorId: z.string().nullable()
|
|
386
|
+
authorId: z.string().nullable(),
|
|
387
|
+
folderId: z.string().nullable()
|
|
305
388
|
}).meta({ id: "MediaItem" });
|
|
389
|
+
const mediaFolderSchema = z.object({
|
|
390
|
+
id: z.string(),
|
|
391
|
+
name: z.string()
|
|
392
|
+
}).meta({ id: "MediaFolder" });
|
|
393
|
+
const mediaFolderResponseSchema = z.object({ item: mediaFolderSchema }).meta({ id: "MediaFolderResponse" });
|
|
394
|
+
const mediaFolderListResponseSchema = z.object({
|
|
395
|
+
items: z.array(mediaFolderSchema),
|
|
396
|
+
nextCursor: z.string().optional()
|
|
397
|
+
}).meta({ id: "MediaFolderListResponse" });
|
|
306
398
|
const mediaResponseSchema = z.object({ item: mediaItemSchema }).meta({ id: "MediaResponse" });
|
|
307
399
|
const mediaReadItemSchema = mediaItemSchema.extend({ usage: mediaUsageSummarySchema.optional() }).meta({ id: "MediaReadItem" });
|
|
308
400
|
const mediaReadResponseSchema = z.object({ item: mediaReadItemSchema }).meta({ id: "MediaReadResponse" });
|
|
309
401
|
const mediaListReadItemSchema = mediaReadItemSchema.extend({ url: z.string() }).meta({ id: "MediaListReadItem" });
|
|
310
402
|
const mediaListReadResponseSchema = z.object({
|
|
311
403
|
items: z.array(mediaListReadItemSchema),
|
|
312
|
-
nextCursor: z.string().optional()
|
|
404
|
+
nextCursor: z.string().optional(),
|
|
405
|
+
totalCount: z.number().int().nonnegative().optional()
|
|
313
406
|
}).meta({ id: "MediaListReadResponse" });
|
|
314
407
|
const mediaListResponseSchema = z.object({
|
|
315
408
|
items: z.array(mediaItemSchema),
|
|
316
|
-
nextCursor: z.string().optional()
|
|
409
|
+
nextCursor: z.string().optional(),
|
|
410
|
+
totalCount: z.number().int().nonnegative().optional()
|
|
317
411
|
}).meta({ id: "MediaListResponse" });
|
|
318
412
|
const mediaUploadUrlResponseSchema = z.object({
|
|
319
413
|
uploadUrl: z.string(),
|
|
@@ -336,5 +430,5 @@ const mediaStreamUploadResponseSchema = z.object({
|
|
|
336
430
|
}).meta({ id: "MediaStreamUploadResponse" });
|
|
337
431
|
|
|
338
432
|
//#endregion
|
|
339
|
-
export {
|
|
340
|
-
//# sourceMappingURL=media-
|
|
433
|
+
export { mediaUsageWorkItemSchema as $, mediaUsageActivationStateSchema as A, mediaUsageCoverageStatusSchema as B, mediaStreamUploadResponseSchema as C, mediaUsageActivationAdvanceBody as D, mediaUploadUrlResponseSchema as E, mediaUsageCollectionDeletionPhaseSchema as F, mediaUsageProgressAdvanceResponseSchema as G, mediaUsageDetailsResponseSchema as H, mediaUsageCollectionDeletionRetryBody as I, mediaUsageRepairCollectionSummarySchema as J, mediaUsageProgressSchema as K, mediaUsageCollectionDeletionRetryResponseSchema as L, mediaUsageCollectionDeletionItemSchema as M, mediaUsageCollectionDeletionListQuery as N, mediaUsageActivationAdvanceResponseSchema as O, mediaUsageCollectionDeletionListResponseSchema as P, mediaUsageSummarySchema as Q, mediaUsageCollectionDeletionStateSchema as R, mediaResponseSchema as S, mediaUploadUrlBody as T, mediaUsageEntryDetailSchema as U, mediaUsageDetailsQuery as V, mediaUsageOccurrenceDetailSchema as W, mediaUsageRepairStatusSchema as X, mediaUsageRepairResponseSchema as Y, mediaUsageSourceDetailSchema as Z, mediaListReadResponseSchema as _, successEnvelope as _t, mediaConfirmResponseSchema as a, mediaUsageWorkStateSchema as at, mediaReadItemSchema as b, mediaFolderIdSchema as c, countResponseSchema as ct, mediaFolderResponseSchema as d, httpUrl as dt, mediaUsageWorkListQuery as et, mediaFolderSchema as f, localeCode as ft, mediaListReadItemSchema as g, slugPattern as gt, mediaListQuery as h, roleLevel as ht, mediaConfirmBody as i, mediaUsageWorkRetryResponseSchema as it, mediaUsageActivationStatusSchema as j, mediaUsageActivationConflictSchema as k, mediaFolderListQuery as l, cursorPaginationQuery as lt, mediaItemSchema as m, offsetPaginationQuery as mt, DEFAULT_MAX_UPLOAD_SIZE as n, mediaUsageWorkRetryBody as nt, mediaExistingResponseSchema as o, VALID_ROLE_LEVELS as ot, mediaGetQuery as p, localeFilterQuery as pt, mediaUsageRepairBody as q, formatFileSize as r, mediaUsageWorkRetryConflictSchema as rt, mediaFolderBody as s, apiErrorSchema as st, CONTENT_TYPE_RE as t, mediaUsageWorkListResponseSchema as tt, mediaFolderListResponseSchema as u, deleteResponseSchema as ut, mediaListResponseSchema as v, mediaUpdateBody as w, mediaReadResponseSchema as x, mediaProviderListQuery as y, mediaUsageCoverageSchema as z };
|
|
434
|
+
//# sourceMappingURL=media-BjwNuLEu.mjs.map
|