dineway 0.1.49 → 0.2.1
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/activity-DUaz_w7p.mjs +79 -0
- package/dist/{activity-events-CwM7yxPW.mjs → activity-events-CJDvE2uc.mjs} +5 -113
- package/dist/actor-0QJ1Gbtf.mjs +37 -0
- package/dist/after-BfniwgIf.mjs +9 -0
- package/dist/{allowed-origins-CyGnbgBd.mjs → allowed-origins--OwHHiY8.mjs} +1 -1
- package/dist/api/route-utils.d.mts +9 -10
- package/dist/api/route-utils.mjs +16 -13
- package/dist/api/schemas/index.d.mts +2 -2
- package/dist/api/schemas/index.mjs +5 -4
- package/dist/{api-BMIxRIEN.mjs → api-B4PHIF4V.mjs} +93 -41
- package/dist/{api-tokens-DtvdtIkm.mjs → api-tokens-tbK_sORH.mjs} +6 -2
- package/dist/{apply-D_RlTYtC.mjs → apply-DjTqq6Ae.mjs} +117 -77
- package/dist/astro/image-endpoint.d.mts +7 -0
- package/dist/astro/image-endpoint.mjs +54 -0
- package/dist/astro/index.d.mts +34 -11
- package/dist/astro/index.mjs +163 -24
- package/dist/astro/integration/shims/use-sync-external-store-with-selector.js +71 -0
- package/dist/astro/integration/shims/use-sync-external-store.js +1 -0
- package/dist/astro/middleware/auth.d.mts +8 -18
- package/dist/astro/middleware/auth.mjs +42 -24
- package/dist/astro/middleware/redirect.mjs +13 -4
- package/dist/astro/middleware/request-context.mjs +8 -5
- package/dist/astro/middleware/seed.d.mts +1 -1
- package/dist/astro/middleware/seed.mjs +2 -2
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware.mjs +389 -206
- package/dist/astro/routes/admin.astro +6 -1
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +7 -6
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +7 -6
- package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +4 -4
- package/dist/astro/routes/api/admin/api-tokens/index.mjs +6 -6
- package/dist/astro/routes/api/admin/briefing.mjs +21 -17
- package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +4 -4
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +9 -8
- package/dist/astro/routes/api/admin/byline-fields/index.mjs +9 -8
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +9 -8
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +17 -14
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +17 -14
- package/dist/astro/routes/api/admin/bylines/index.mjs +17 -14
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +14 -12
- package/dist/astro/routes/api/admin/comments/_id_.mjs +6 -5
- package/dist/astro/routes/api/admin/comments/bulk.mjs +11 -9
- package/dist/astro/routes/api/admin/comments/counts.mjs +6 -5
- package/dist/astro/routes/api/admin/comments/index.mjs +11 -9
- package/dist/astro/routes/api/admin/context/_id_/history.mjs +27 -24
- package/dist/astro/routes/api/admin/context/_id_/index.mjs +27 -24
- package/dist/astro/routes/api/admin/context/_id_/review.mjs +32 -28
- package/dist/astro/routes/api/admin/context/_id_/supersede.mjs +32 -28
- package/dist/astro/routes/api/admin/context/diff.mjs +31 -27
- package/dist/astro/routes/api/admin/context/index.mjs +32 -28
- package/dist/astro/routes/api/admin/context/stale.mjs +31 -27
- package/dist/astro/routes/api/admin/hitl-requests/_id_/index.mjs +27 -24
- package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.mjs +31 -27
- package/dist/astro/routes/api/admin/hitl-requests/index.mjs +31 -27
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +28 -25
- package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +3 -3
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +6 -6
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs +6 -6
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +56 -51
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +56 -51
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +47 -43
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +54 -49
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +53 -48
- package/dist/astro/routes/api/admin/plugins/index.mjs +47 -43
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +2 -2
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +46 -42
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +53 -48
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +46 -42
- package/dist/astro/routes/api/admin/plugins/updates.mjs +46 -42
- package/dist/astro/routes/api/admin/review-requests/_id_/index.mjs +5 -5
- package/dist/astro/routes/api/admin/review-requests/_id_/resolve.mjs +32 -63
- package/dist/astro/routes/api/admin/review-requests/index.d.mts +2 -1
- package/dist/astro/routes/api/admin/review-requests/index.mjs +58 -10
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +46 -42
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +2 -2
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +46 -42
- package/dist/astro/routes/api/admin/users/_id_/disable.mjs +3 -3
- package/dist/astro/routes/api/admin/users/_id_/enable.mjs +2 -2
- package/dist/astro/routes/api/admin/users/_id_/index.mjs +8 -7
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +4 -4
- package/dist/astro/routes/api/admin/users/index.mjs +7 -6
- package/dist/astro/routes/api/auth/dev-bypass.mjs +4 -4
- package/dist/astro/routes/api/auth/invite/accept.mjs +2 -2
- package/dist/astro/routes/api/auth/invite/complete.mjs +12 -11
- package/dist/astro/routes/api/auth/invite/index.mjs +9 -8
- package/dist/astro/routes/api/auth/invite/register-options.mjs +11 -10
- package/dist/astro/routes/api/auth/logout.mjs +2 -2
- package/dist/astro/routes/api/auth/magic-link/send.mjs +11 -10
- package/dist/astro/routes/api/auth/magic-link/verify.mjs +3 -3
- package/dist/astro/routes/api/auth/me.mjs +9 -8
- package/dist/astro/routes/api/auth/mode.mjs +1 -1
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +3 -3
- package/dist/astro/routes/api/auth/oauth/_provider_.mjs +2 -2
- package/dist/astro/routes/api/auth/passkey/_id_.mjs +6 -5
- package/dist/astro/routes/api/auth/passkey/index.mjs +1 -1
- package/dist/astro/routes/api/auth/passkey/options.mjs +12 -11
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +10 -9
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +11 -10
- package/dist/astro/routes/api/auth/passkey/verify.mjs +11 -10
- package/dist/astro/routes/api/auth/setup-token/index.mjs +5 -5
- package/dist/astro/routes/api/auth/setup-token/verify.mjs +2 -2
- package/dist/astro/routes/api/auth/signup/complete.mjs +12 -11
- package/dist/astro/routes/api/auth/signup/request.mjs +11 -10
- package/dist/astro/routes/api/auth/signup/verify.mjs +2 -2
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +15 -13
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.d.mts +8 -0
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +160 -0
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +6 -5
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +6 -5
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +6 -5
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +11 -10
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +49 -20
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +6 -5
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +67 -32
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +16 -14
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +6 -5
- package/dist/astro/routes/api/content/_collection_/_id_.mjs +11 -9
- package/dist/astro/routes/api/content/_collection_/authors.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/index.mjs +11 -9
- package/dist/astro/routes/api/content/_collection_/trash.mjs +7 -6
- package/dist/astro/routes/api/dashboard.mjs +9 -8
- package/dist/astro/routes/api/dev/emails.mjs +2 -2
- package/dist/astro/routes/api/health.mjs +1 -1
- package/dist/astro/routes/api/import/probe.d.mts +3 -3
- package/dist/astro/routes/api/import/probe.mjs +22 -10
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +9 -6
- package/dist/astro/routes/api/import/wordpress/execute.d.mts +18 -1
- package/dist/astro/routes/api/import/wordpress/execute.mjs +85 -37
- package/dist/astro/routes/api/import/wordpress/media.d.mts +12 -1
- package/dist/astro/routes/api/import/wordpress/media.mjs +20 -14
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +36 -32
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +17 -1
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +121 -100
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +24 -12
- package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +55 -2
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +284 -55
- package/dist/astro/routes/api/manifest.mjs +14 -5
- package/dist/astro/routes/api/mcp.mjs +753 -170
- package/dist/astro/routes/api/media/_id_/confirm.mjs +38 -10
- package/dist/astro/routes/api/media/_id_.mjs +11 -7
- package/dist/astro/routes/api/media/file/_...key_.mjs +1 -1
- 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 +11 -10
- package/dist/astro/routes/api/media.mjs +28 -35
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +32 -28
- package/dist/astro/routes/api/menus/_name_/items.mjs +32 -28
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +32 -28
- package/dist/astro/routes/api/menus/_name_/translations.mjs +32 -28
- package/dist/astro/routes/api/menus/_name_.mjs +32 -28
- package/dist/astro/routes/api/menus/index.mjs +32 -28
- package/dist/astro/routes/api/oauth/authorize.mjs +7 -7
- package/dist/astro/routes/api/oauth/device/authorize.mjs +6 -6
- package/dist/astro/routes/api/oauth/device/code.mjs +9 -9
- package/dist/astro/routes/api/oauth/device/token.mjs +8 -8
- package/dist/astro/routes/api/oauth/register.mjs +4 -4
- package/dist/astro/routes/api/oauth/token/refresh.mjs +6 -6
- package/dist/astro/routes/api/oauth/token/revoke.mjs +6 -6
- package/dist/astro/routes/api/oauth/token.mjs +6 -6
- package/dist/astro/routes/api/openapi.json.mjs +4 -3
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +46 -31
- package/dist/astro/routes/api/redirects/404s/index.mjs +11 -10
- package/dist/astro/routes/api/redirects/404s/summary.mjs +11 -10
- package/dist/astro/routes/api/redirects/_id_.mjs +33 -29
- package/dist/astro/routes/api/redirects/index.mjs +33 -29
- package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +2 -2
- package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +2 -2
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +48 -43
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +48 -43
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +48 -43
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +48 -43
- package/dist/astro/routes/api/schema/collections/index.mjs +48 -43
- package/dist/astro/routes/api/schema/index.mjs +14 -15
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +46 -42
- package/dist/astro/routes/api/schema/orphans/index.mjs +46 -42
- package/dist/astro/routes/api/search/enable.mjs +11 -10
- package/dist/astro/routes/api/search/index.mjs +10 -9
- package/dist/astro/routes/api/search/rebuild.mjs +11 -10
- package/dist/astro/routes/api/search/stats.mjs +6 -6
- package/dist/astro/routes/api/search/suggest.mjs +10 -9
- package/dist/astro/routes/api/sections/_slug_.mjs +32 -28
- package/dist/astro/routes/api/sections/index.mjs +32 -28
- package/dist/astro/routes/api/settings/email.mjs +4 -4
- package/dist/astro/routes/api/settings.mjs +32 -28
- package/dist/astro/routes/api/setup/admin-verify.mjs +14 -13
- package/dist/astro/routes/api/setup/admin.mjs +12 -11
- package/dist/astro/routes/api/setup/dev-bypass.mjs +31 -25
- package/dist/astro/routes/api/setup/dev-reset.mjs +2 -2
- package/dist/astro/routes/api/setup/index.mjs +29 -25
- package/dist/astro/routes/api/setup/status.mjs +3 -3
- package/dist/astro/routes/api/snapshot.mjs +8 -7
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +35 -31
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +35 -31
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +35 -31
- package/dist/astro/routes/api/taxonomies/index.mjs +35 -31
- 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 +3 -3
- package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +3 -3
- package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +3 -3
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +31 -27
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +32 -28
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +32 -28
- package/dist/astro/routes/api/widget-areas/_name_.mjs +29 -26
- package/dist/astro/routes/api/widget-areas/index.mjs +32 -28
- package/dist/astro/routes/api/widget-components.mjs +2 -2
- package/dist/astro/routes/robots.txt.mjs +8 -7
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +23 -14
- package/dist/astro/routes/sitemap.xml.mjs +9 -8
- package/dist/astro/session-driver.d.mts +1 -1
- package/dist/astro/session-driver.mjs +2 -2
- package/dist/astro/types.d.mts +22 -13
- package/dist/{audit-BeNsSyfU.mjs → audit-B2pRxZ20.mjs} +1 -1
- package/dist/auth/providers/github.d.mts +1 -1
- package/dist/auth/providers/google.d.mts +1 -1
- package/dist/{auth-control-guard-Dr14I98m.mjs → auth-control-guard-D71jourk.mjs} +1 -1
- package/dist/{authorize-BLO0m7fW.mjs → authorize-ZXPGPwKn.mjs} +1 -1
- package/dist/{briefing-CkTee1ex.mjs → briefing-0rf-su3-.mjs} +90 -28
- package/dist/{briefing-DJX6irto.mjs → briefing-kRhegBoF.mjs} +2 -1
- package/dist/bundle-CEcdUa1s.mjs +602 -0
- package/dist/{byline-BVC1lV6G.mjs → byline-7xR185Ly.mjs} +30 -62
- package/dist/{byline-fields-Cj39WhXC.mjs → byline-fields-BKzA0fJU.mjs} +1 -1
- package/dist/{byline-fields-uJlygdzM.d.mts → byline-fields-Ckeqd1OY.d.mts} +88 -35
- package/dist/{byline-fields-cNrLJVRs.mjs → byline-fields-WN7RQT4q.mjs} +10 -4
- package/dist/{byline-registry-4v6tXMNX.mjs → byline-registry-Ba54M74c.mjs} +2 -2
- package/dist/{bylines-LN9XISRo.mjs → bylines-C-EL6dh3.mjs} +9 -3
- package/dist/{bylines-DwokOFj6.mjs → bylines-CmZFCMr0.mjs} +5 -5
- package/dist/{cache-Bac05gBd.mjs → cache-DkVCKGio.mjs} +2 -2
- package/dist/{chunks-CuUt7K50.mjs → chunks-ChGNDY8r.mjs} +1 -1
- package/dist/cli/index.d.mts +29 -1
- package/dist/cli/index.mjs +1466 -1763
- package/dist/cli/plugin-kit.d.mts +75 -0
- package/dist/cli/plugin-kit.mjs +4 -0
- package/dist/client/external-auth-headers.d.mts +1 -1
- package/dist/client/index.d.mts +27 -52
- package/dist/client/index.mjs +34 -6
- package/dist/client-factory-BDD9azPJ.mjs +233 -0
- package/dist/{comment-Beue8-15.mjs → comment-DFALgsJD.mjs} +13 -3
- package/dist/comment-reaction-C37bf99u.mjs +58 -0
- package/dist/{comments-DcjFIfqX.mjs → comments-B3NwDBxl.mjs} +1 -1
- package/dist/{content-CBxYGWfL.mjs → content-DJcAYFhz.mjs} +51 -34
- package/dist/content-refresh-B4ZCmxgd.mjs +1576 -0
- package/dist/{context-Df1xVYyr.mjs → context-DnpXcp6Y.mjs} +2 -2
- package/dist/{context-CQVNZaR8.mjs → context-fSCYLL3c.mjs} +125 -53
- package/dist/{context-route-helpers-B9wj8Rmh.mjs → context-route-helpers-CI8XzcsK.mjs} +2 -1
- package/dist/{cron-DxCAU_Sn.mjs → cron-B1SL_lsb.mjs} +7 -3
- package/dist/{dashboard-B7ZUNuyF.mjs → dashboard-D0nj5oWg.mjs} +4 -4
- package/dist/db/index.d.mts +3 -3
- package/dist/db/index.mjs +1 -1
- package/dist/db/libsql.d.mts +1 -1
- package/dist/db/postgres.d.mts +1 -1
- package/dist/db/sqlite.d.mts +1 -1
- package/dist/{device-flow-BZVGftqi.mjs → device-flow-BJe6VEhP.mjs} +5 -5
- package/dist/{placeholder-d54Qr_7n.mjs → enrich-Ck9tfMqe.mjs} +36 -9
- package/dist/{error-DCSuUAZW.mjs → error-CSVaQNZy.mjs} +5 -0
- package/dist/{experimental-workflows-CSMffP6q.mjs → experimental-workflows-GVhUgzEs.mjs} +1 -1
- package/dist/field-defs-cache-DL-T2XVS.mjs +49 -0
- package/dist/forgeway-seo-client-G5ddhVHd.mjs +456 -0
- package/dist/{fts-manager-B5l_qwrA.mjs → fts-manager-ewTGohf4.mjs} +1 -1
- package/dist/{hitl-requests-7NlzVeUA.mjs → hitl-requests-DEFj8e6u.mjs} +2 -2
- package/dist/{hitl-route-helpers-k---_H3-.mjs → hitl-route-helpers-C23JHaWz.mjs} +5 -4
- package/dist/import-CXXL5pip.mjs +1354 -0
- package/dist/index-DcnOCD1e.d.mts +375 -0
- package/dist/index.d.mts +15 -16
- package/dist/index.mjs +85 -70
- package/dist/{jsonld-DZ67souc.d.mts → jsonld-DzKbhRZ4.d.mts} +8 -4
- package/dist/{load-D9OiGr2m.mjs → load-CFtJRT3c.mjs} +1 -1
- package/dist/{loader--GOYux8M.mjs → loader-aWkkc1_o.mjs} +117 -31
- package/dist/{manifest-schema-qh2P7RDX.mjs → manifest-schema-uA6pRFXi.mjs} +38 -1
- package/dist/mcp-reviewed-executor-Dn52L_yY.mjs +558 -0
- package/dist/media/image-endpoint.d.mts +32 -0
- package/dist/media/image-endpoint.mjs +111 -0
- package/dist/media/index.d.mts +27 -2
- package/dist/media/index.mjs +5 -3
- package/dist/media/local-runtime.d.mts +15 -11
- package/dist/media/local-runtime.mjs +9 -7
- package/dist/{media-CbKyYukG.mjs → media-CVMOoywq.mjs} +3 -1
- package/dist/{media-allowlist-BYxJIcTO.mjs → media-allowlist-zDNJmXCo.mjs} +1 -1
- package/dist/media-url-BdoLPvg8.mjs +20 -0
- package/dist/{menus-C7F0sCrC.mjs → menus-CCG2z5um.mjs} +80 -15
- package/dist/{menus-BZbXf-ej.mjs → menus-CmyIkRG5.mjs} +19 -5
- package/dist/{normalize-ByemhhfW.mjs → normalize-Cyt7JdF7.mjs} +8 -1
- package/dist/{oauth-authorization-DF-LCsIA.mjs → oauth-authorization-B9H7X85L.mjs} +5 -5
- package/dist/{oauth-clients-Du-V0fEm.mjs → oauth-clients-Dwl32-Uj.mjs} +2 -2
- package/dist/object-cache/memory.d.mts +14 -0
- package/dist/object-cache/memory.mjs +55 -0
- package/dist/object-cache-D51qOseS.mjs +419 -0
- package/dist/output-DhBe5_Pi.mjs +68 -0
- package/dist/page/index.d.mts +10 -3
- package/dist/page/index.mjs +2 -2
- package/dist/{parse-CneSgl7-.mjs → parse-i15EFSAE.mjs} +1 -1
- package/dist/{parser-DxfsARXL.mjs → parser-06LLLL4E.mjs} +151 -9
- package/dist/{placeholder-CXfoCtCd.d.mts → placeholder-DkWkXfDI.d.mts} +12 -4
- package/dist/plugin-utils.d.mts +8 -9
- package/dist/plugins/adapt-sandbox-entry.d.mts +8 -9
- package/dist/plugins/adapt-sandbox-entry.mjs +13 -2
- package/dist/{plugins-DzfqRREq.mjs → plugins-CPA2PtfY.mjs} +919 -66
- package/dist/{transport-LSdZVXHF.mjs → portable-text-BASHceim.mjs} +1 -134
- package/dist/portable-text-E79LyjGo.d.mts +45 -0
- package/dist/{preview-C-3YTX2U.mjs → preview-BjedZm8G.mjs} +4 -3
- package/dist/process-cache-CCDgti7j.mjs +106 -0
- package/dist/project-env-DKibmuP8.mjs +95 -0
- package/dist/{provider-loader-9it4vd6L.d.mts → provider-loader-DC2JdWeO.d.mts} +1 -1
- package/dist/{public-url-B4xV4rGa.d.mts → public-url-DQJCnYi9.d.mts} +1 -1
- package/dist/publication-authorization-RKiHXKtq.mjs +985 -0
- package/dist/{query-CZ3TH_Uu.mjs → query-C2U5u5_p.mjs} +11 -6
- package/dist/{query-Ds0EnMFX.mjs → query-DEv5x6yB.mjs} +281 -76
- package/dist/{rate-limit-i0G3IAOX.mjs → rate-limit-DglsAJSw.mjs} +2 -2
- package/dist/{redirect-CEACczxo.mjs → redirect-ubhEqQCQ.mjs} +2 -2
- package/dist/{redirects-ocRJmQHP.mjs → redirects-Bhpm8bRe.mjs} +35 -19
- package/dist/{redirects-DYj1yPxs.mjs → redirects-xs2yahLq.mjs} +47 -24
- package/dist/{registry-D7HACema.mjs → registry-BYYyb2tF.mjs} +148 -81
- package/dist/request-context.d.mts +2 -0
- package/dist/{request-meta-DAb6xaP9.mjs → request-meta-CFe1tW2M.mjs} +1 -1
- package/dist/review-payload-BysRWpxS.mjs +111 -0
- package/dist/{review-requests-BW2NxY-l.mjs → review-requests-CTWGnWUt.mjs} +1 -1
- package/dist/review-requests-D42VEP1l.mjs +142 -0
- package/dist/review-route-helpers-C31vO6SI.mjs +41 -0
- package/dist/runner-BgmttQmD.mjs +7444 -0
- package/dist/{runner-09sTqtv0.d.mts → runner-D6hzs8L9.d.mts} +1 -1
- package/dist/runtime.d.mts +9 -10
- package/dist/runtime.mjs +3 -3
- package/dist/schema-DUtnZxjZ.mjs +8 -0
- package/dist/{search-Gdrqj582.mjs → search-DUKgZUlm.mjs} +5 -3
- package/dist/{secrets-CeGpBFV2.mjs → secrets-ZV5rd8yV.mjs} +14 -11
- package/dist/{sections-BOjU13Y-.mjs → sections-DvFgsnda.mjs} +2 -2
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +21 -18
- package/dist/seo/index.d.mts +1 -1
- package/dist/seo/index.mjs +3 -12
- package/dist/{seo-5lJOtB5J.mjs → seo-BLszyJxd.mjs} +22 -4
- package/dist/{seo-CLj8lS7Q.mjs → seo-BU8MLCS9.mjs} +5 -2
- package/dist/{seo-contributions-CqVvReEj.mjs → seo-contributions-GnCuL1ML.mjs} +11 -3
- package/dist/{service-jGlhrICs.mjs → service-FL3fB0Rx.mjs} +2 -2
- package/dist/session-user-Ct6GBLvn.mjs +22 -0
- package/dist/{settings-CUXOxzsT.mjs → settings-BECcAIRH.mjs} +28 -55
- package/dist/{settings-DlBsT2VS.mjs → settings-EzADu-dd.mjs} +2 -2
- package/dist/{setup-complete-BRrdPYjZ.mjs → setup-complete-Da0axZEE.mjs} +1 -1
- package/dist/{site-activity-DONFrMBJ.mjs → site-activity-h8smOlYI.mjs} +1 -1
- package/dist/{site-context-C8Az_P_I.mjs → site-context-B8T1kpUP.mjs} +337 -530
- package/dist/{site-url-DIMD68go.mjs → site-url-DJEid0ml.mjs} +1 -1
- package/dist/stable-hash-DshcXvRE.mjs +19 -0
- package/dist/status-NqWOSFAD.mjs +21 -0
- package/dist/storage/local.d.mts +1 -1
- package/dist/storage/local.mjs +1 -1
- package/dist/storage/s3.d.mts +1 -1
- package/dist/storage/s3.mjs +1 -1
- package/dist/{taxonomies-D9Sw4wWM.mjs → taxonomies-BiM9NtgW.mjs} +36 -29
- package/dist/taxonomies-DSnY5nOa.mjs +443 -0
- package/dist/{taxonomy-B169Nm6B.mjs → taxonomy-0k_vRVsD.mjs} +44 -9
- package/dist/transport-C46KHLMP.mjs +134 -0
- package/dist/types-A8fPOJnl.mjs +69 -0
- package/dist/types-BLQCz46p.d.mts +118 -0
- package/dist/{types-CwawBUTa.d.mts → types-B_FlxIIl.d.mts} +4 -1
- package/dist/{types-CSgR9nQB.mjs → types-ChxYDRvx.mjs} +1 -1
- package/dist/{types-GaCtZ1k9.d.mts → types-Cw0PeCT_.d.mts} +18 -0
- package/dist/types-DuQn1G7-.d.mts +2973 -0
- package/dist/{runtime-C4-2lSFg.d.mts → types-DwoUifGE.d.mts} +5668 -3000
- package/dist/{types-DRIKLmJI.d.mts → types-opjX_kz6.d.mts} +17 -2
- package/dist/ui/server-runtime.d.mts +13 -15
- package/dist/ui/server-runtime.mjs +24 -20
- package/dist/url-guoXQQcV.mjs +33 -0
- package/dist/{user-DTLoZs16.mjs → user-BH-n01y3.mjs} +2 -2
- package/dist/{utils-B8hBJ9Oz.mjs → utils-D1SrKGtP.mjs} +129 -7
- package/dist/{validate-DzjCdy6v.d.mts → validate-CbVFoJgc.d.mts} +65 -8
- package/dist/{validate-DWmPO6oj.mjs → validate-D1HL-oLR.mjs} +11 -6
- package/dist/version-C3iVRuaF.mjs +6 -0
- package/dist/{widgets-BpJ8EpPd.mjs → widgets-BZrLrNgS.mjs} +46 -43
- package/dist/{wordpress-slugs-DHNR9LpG.mjs → wordpress-slugs-C3PWcowq.mjs} +1 -1
- package/dist/{zod-generator-K91-g665.mjs → zod-generator-C7AsLpSB.mjs} +42 -14
- package/package.json +38 -8
- package/src/components/Block.astro +50 -0
- package/src/components/Comments.astro +143 -1
- package/src/components/DinewayHead.astro +19 -2
- package/src/components/DinewayImage.astro +66 -33
- package/src/components/DinewayMedia.astro +1 -2
- package/src/components/Image.astro +85 -40
- package/src/components/InlinePortableTextEditor.tsx +12 -2
- package/src/components/JsonLdScript.astro +9 -0
- package/src/components/LiveSearch.astro +40 -4
- package/src/components/index.ts +4 -0
- package/src/components/live-search-routing.ts +30 -0
- package/src/components/portable-text-text-align.ts +15 -0
- package/src/ui.ts +2 -0
- package/dist/entity-aliases-4y93Yjuc.mjs +0 -51
- package/dist/import-4YBXbDkI.mjs +0 -684
- package/dist/index-CZiWCQDp.d.mts +0 -227
- package/dist/review-requests-Qum4713s.mjs +0 -79
- package/dist/runner-DzIpHGND.mjs +0 -2836
- package/dist/schema-Bsi-VpYv.mjs +0 -8
- package/dist/taxonomies-CZ-_DitR.mjs +0 -327
- package/dist/types-CuJOqHfM.d.mts +0 -758
- package/dist/types-DSPGWjxO.d.mts +0 -1247
- package/dist/types-nP9vGUFq.d.mts +0 -56
- package/dist/version-C4gfn0PJ.mjs +0 -6
- /package/dist/{adapters-OQCImOL7.d.mts → adapters-BiRymx02.d.mts} +0 -0
- /package/dist/{api-tokens-CYUoFGo7.mjs → api-tokens-Ypaly90d.mjs} +0 -0
- /package/dist/{challenge-store-DFxX0_15.mjs → challenge-store-D5pSY2S1.mjs} +0 -0
- /package/dist/{components--pg6zBvu.mjs → components-DImzlLhb.mjs} +0 -0
- /package/dist/{context-types-r8oFvyOq.mjs → context-types-eBuMDAg-.mjs} +0 -0
- /package/dist/{default-B6iaLvP7.mjs → default-D4Vygcy_.mjs} +0 -0
- /package/dist/{email-console-BOVqIYpB.mjs → email-console-Bp0r68iF.mjs} +0 -0
- /package/dist/{escape-BDgouFFY.mjs → escape-DN4Qmjsl.mjs} +0 -0
- /package/dist/{hash-BPmX6P8I.mjs → hash-mxxx2oPW.mjs} +0 -0
- /package/dist/{mime-CbKsKDCB.mjs → mime-C0vOHFm7.mjs} +0 -0
- /package/dist/{mode-CZqCF9dZ.mjs → mode-C8yZnIlR.mjs} +0 -0
- /package/dist/{oauth-state-store-qncPB_IU.mjs → oauth-state-store-CndT35iw.mjs} +0 -0
- /package/dist/{oauth-user-lookup-BFjWF8wK.mjs → oauth-user-lookup-CMehAaKs.mjs} +0 -0
- /package/dist/{options-LsPjZlqD.mjs → options-DQPTH5n0.mjs} +0 -0
- /package/dist/{passkey-config-DzHQK90v.mjs → passkey-config-NYukYGed.mjs} +0 -0
- /package/dist/{patterns-DKAX6oqN.mjs → patterns-CoqlXUvk.mjs} +0 -0
- /package/dist/{provider-loader-DzUxejk7.mjs → provider-loader-BtfrrzfD.mjs} +0 -0
- /package/dist/{public-url-B_m9IwdV.mjs → public-url-Cp6hyjVR.mjs} +0 -0
- /package/dist/{redirect-BjIBtDWY.mjs → redirect-DrbEmU9a.mjs} +0 -0
- /package/dist/{request-cache-ho99schz.mjs → request-cache-CBFjCwSt.mjs} +0 -0
- /package/dist/{resolve-DTuDyYKs.mjs → resolve-DE71WcL9.mjs} +0 -0
- /package/dist/{setup-nonce-pyGfc9hV.mjs → setup-nonce-BtkKnvxQ.mjs} +0 -0
- /package/dist/{sidecar-client-mJxwayYN.mjs → sidecar-client-Ctzfyyp-.mjs} +0 -0
- /package/dist/{slugify-BqebcqBg.mjs → slugify-KSsVD_D3.mjs} +0 -0
- /package/dist/{ssrf-DiKqWd3N.mjs → ssrf-FJqwQzj4.mjs} +0 -0
- /package/dist/{tokens-SLmgowfd.mjs → tokens-BDQU29Vd.mjs} +0 -0
- /package/dist/{transaction-CFLhEOuH.mjs → transaction-0LEAAy8R.mjs} +0 -0
- /package/dist/{transport-BnsNxh2l.d.mts → transport-D9pKAzFP.d.mts} +0 -0
- /package/dist/{trusted-proxy-BgIIcbsN.mjs → trusted-proxy-Dm7Mxvt6.mjs} +0 -0
- /package/dist/{types-CJ8DkL0q.mjs → types-B7TDDFMG.mjs} +0 -0
- /package/dist/{types-Dryvv7LH.d.mts → types-g0zMtraY.d.mts} +0 -0
- /package/dist/{types-Cg276-3z.mjs → types-mVVgRPaU.mjs} +0 -0
- /package/dist/{types-DZpT-PnG.d.mts → types-wFu80FrO.d.mts} +0 -0
- /package/dist/{url-w7Mp5qAD.mjs → url-EMAguGVk.mjs} +0 -0
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import { r as validatePluginIdentifier, t as validateIdentifier } from "./validate-VPnKoIzW.mjs";
|
|
2
2
|
import { r as isI18nEnabled } from "./config-CVssduLe.mjs";
|
|
3
3
|
import { r as encodeBase64, t as decodeBase64 } from "./base64-F8-DUraK.mjs";
|
|
4
|
-
import { n as ScheduledNotDueError, t as DinewayValidationError } from "./types-
|
|
5
|
-
import {
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
9
|
-
import { t as
|
|
10
|
-
import { t as
|
|
11
|
-
import { t as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { t as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { n as hashString } from "./hash-
|
|
20
|
-
import { n as
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
4
|
+
import { n as ScheduledNotDueError, t as DinewayValidationError } from "./types-ChxYDRvx.mjs";
|
|
5
|
+
import { o as invalidateCollectionCache } from "./object-cache-D51qOseS.mjs";
|
|
6
|
+
import { r as RevisionRepository, t as ContentRepository } from "./content-DJcAYFhz.mjs";
|
|
7
|
+
import { t as MediaRepository } from "./media-CVMOoywq.mjs";
|
|
8
|
+
import { n as chunks, t as SQL_BATCH_SIZE } from "./chunks-ChGNDY8r.mjs";
|
|
9
|
+
import { t as UserRepository } from "./user-BH-n01y3.mjs";
|
|
10
|
+
import { t as CommentRepository } from "./comment-DFALgsJD.mjs";
|
|
11
|
+
import { t as withTransaction } from "./transaction-0LEAAy8R.mjs";
|
|
12
|
+
import { t as RedirectRepository } from "./redirect-ubhEqQCQ.mjs";
|
|
13
|
+
import { r as requestCached } from "./request-cache-CBFjCwSt.mjs";
|
|
14
|
+
import { t as BylineRepository } from "./byline-7xR185Ly.mjs";
|
|
15
|
+
import { r as parseAllowedMimeTypes, t as matchesMimeAllowlist } from "./mime-C0vOHFm7.mjs";
|
|
16
|
+
import { t as SeoRepository } from "./seo-BU8MLCS9.mjs";
|
|
17
|
+
import { i as invalidateRedirectCache } from "./cache-DkVCKGio.mjs";
|
|
18
|
+
import { u as PluginStateRepository } from "./briefing-0rf-su3-.mjs";
|
|
19
|
+
import { n as hashString } from "./hash-mxxx2oPW.mjs";
|
|
20
|
+
import { n as SchemaRegistry, t as SchemaError } from "./registry-BYYyb2tF.mjs";
|
|
21
|
+
import { n as VERSION, t as COMMIT } from "./version-C3iVRuaF.mjs";
|
|
22
|
+
import { a as reconcileManifestAccess, i as pluginManifestSchema, r as normalizeManifestRoute } from "./manifest-schema-uA6pRFXi.mjs";
|
|
23
|
+
import { t as DinewayStorageError } from "./types-mVVgRPaU.mjs";
|
|
23
24
|
import { sql } from "kysely";
|
|
24
25
|
import { createGzipDecoder, unpackTar } from "modern-tar";
|
|
25
26
|
|
|
@@ -170,6 +171,16 @@ var ContentUpdateApiError = class extends Error {
|
|
|
170
171
|
async function collectionHasSeo(db, collection) {
|
|
171
172
|
return (await db.selectFrom("_dineway_collections").select("has_seo").where("slug", "=", collection).executeTakeFirst())?.has_seo === 1;
|
|
172
173
|
}
|
|
174
|
+
async function collectionSupportsRevisions(db, collection) {
|
|
175
|
+
const row = await db.selectFrom("_dineway_collections").select("supports").where("slug", "=", collection).executeTakeFirst();
|
|
176
|
+
if (!row?.supports) return false;
|
|
177
|
+
try {
|
|
178
|
+
const supports = JSON.parse(row.supports);
|
|
179
|
+
return Array.isArray(supports) && supports.includes("revisions");
|
|
180
|
+
} catch {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
173
184
|
async function getCollectionFieldSlugs(db, collection) {
|
|
174
185
|
const collectionRow = await db.selectFrom("_dineway_collections").select("id").where("slug", "=", collection).executeTakeFirst();
|
|
175
186
|
if (!collectionRow) return null;
|
|
@@ -189,6 +200,11 @@ async function validateContentDataFields(db, collection, data) {
|
|
|
189
200
|
}
|
|
190
201
|
};
|
|
191
202
|
}
|
|
203
|
+
async function createSlugChangeRedirect(db, collection, oldSlug, newSlug, contentId) {
|
|
204
|
+
const collectionRow = await db.selectFrom("_dineway_collections").select("url_pattern").where("slug", "=", collection).executeTakeFirst();
|
|
205
|
+
await new RedirectRepository(db).createAutoRedirect(collection, oldSlug, newSlug, contentId, collectionRow?.url_pattern ?? null);
|
|
206
|
+
invalidateRedirectCache();
|
|
207
|
+
}
|
|
192
208
|
/**
|
|
193
209
|
* Hydrate SEO data on a single content item if the collection has SEO enabled.
|
|
194
210
|
*/
|
|
@@ -496,6 +512,7 @@ async function handleContentGetIncludingTrashed(db, collection, id, locale) {
|
|
|
496
512
|
async function handleContentCreate(db, collection, body) {
|
|
497
513
|
try {
|
|
498
514
|
const hasSeo = await collectionHasSeo(db, collection);
|
|
515
|
+
const usesDraftRevisions = await collectionSupportsRevisions(db, collection);
|
|
499
516
|
if (body.seo && !hasSeo) return {
|
|
500
517
|
success: false,
|
|
501
518
|
error: {
|
|
@@ -515,7 +532,7 @@ async function handleContentCreate(db, collection, body) {
|
|
|
515
532
|
const slugSource = getSlugSource(body.data);
|
|
516
533
|
if (slugSource) slug = await repo.generateUniqueSlug(collection, slugSource, body.locale);
|
|
517
534
|
}
|
|
518
|
-
|
|
535
|
+
let created = await repo.create({
|
|
519
536
|
type: collection,
|
|
520
537
|
slug,
|
|
521
538
|
data: body.data,
|
|
@@ -526,10 +543,27 @@ async function handleContentCreate(db, collection, body) {
|
|
|
526
543
|
createdAt: body.createdAt,
|
|
527
544
|
publishedAt: body.publishedAt
|
|
528
545
|
});
|
|
529
|
-
if (
|
|
546
|
+
if (usesDraftRevisions && created.status === "draft") {
|
|
547
|
+
const revision = await new RevisionRepository(trx).create({
|
|
548
|
+
collection,
|
|
549
|
+
entryId: created.id,
|
|
550
|
+
data: created.data,
|
|
551
|
+
authorId: body.authorId
|
|
552
|
+
});
|
|
553
|
+
await repo.setDraftRevision(collection, created.id, revision.id);
|
|
554
|
+
const revisioned = await repo.findById(collection, created.id);
|
|
555
|
+
if (!revisioned) throw new Error("Failed to reload content Draft Revision");
|
|
556
|
+
created = revisioned;
|
|
557
|
+
}
|
|
558
|
+
if (body.bylines !== void 0) {
|
|
559
|
+
const credits = await bylineRepo.setContentBylines(collection, created.id, body.bylines);
|
|
560
|
+
created.primaryBylineId = credits[0]?.byline.translationGroup ?? null;
|
|
561
|
+
}
|
|
530
562
|
await hydrateBylines(trx, collection, created);
|
|
531
|
-
if (body.seo && hasSeo)
|
|
532
|
-
|
|
563
|
+
if (body.seo && hasSeo) {
|
|
564
|
+
const seoRepo = new SeoRepository(trx);
|
|
565
|
+
created.seo = await seoRepo.upsert(collection, created.id, body.seo);
|
|
566
|
+
} else if (hasSeo) created.seo = { ...SEO_DEFAULTS };
|
|
533
567
|
return created;
|
|
534
568
|
});
|
|
535
569
|
return {
|
|
@@ -593,11 +627,7 @@ async function handleContentUpdate(db, collection, id, body) {
|
|
|
593
627
|
publishedAt: body.publishedAt
|
|
594
628
|
});
|
|
595
629
|
if (body.bylines !== void 0) updated.primaryBylineId = (await bylineRepo.setContentBylines(collection, resolvedId, body.bylines))[0]?.byline.translationGroup ?? null;
|
|
596
|
-
if (oldSlug && body.slug)
|
|
597
|
-
const collectionRow = await trx.selectFrom("_dineway_collections").select("url_pattern").where("slug", "=", collection).executeTakeFirst();
|
|
598
|
-
await new RedirectRepository(trx).createAutoRedirect(collection, oldSlug, body.slug, resolvedId, collectionRow?.url_pattern ?? null);
|
|
599
|
-
invalidateRedirectCache();
|
|
600
|
-
}
|
|
630
|
+
if (oldSlug && body.slug) await createSlugChangeRedirect(trx, collection, oldSlug, body.slug, resolvedId);
|
|
601
631
|
if (isI18nEnabled() && body.data && updated.translationGroup) await syncNonTranslatableFields(trx, collection, updated.id, updated.translationGroup, body.data);
|
|
602
632
|
if (body.seo && hasSeo) updated.seo = await new SeoRepository(trx).upsert(collection, resolvedId, body.seo);
|
|
603
633
|
else if (hasSeo) updated.seo = await new SeoRepository(trx).get(collection, resolvedId);
|
|
@@ -678,11 +708,15 @@ async function handleContentDuplicate(db, collection, id, authorId) {
|
|
|
678
708
|
*/
|
|
679
709
|
async function handleContentDelete(db, collection, id) {
|
|
680
710
|
try {
|
|
681
|
-
|
|
711
|
+
const result = await withTransaction(db, async (trx) => {
|
|
682
712
|
const repo = new ContentRepository(trx);
|
|
683
713
|
const resolvedId = await resolveId(repo, collection, id) ?? id;
|
|
684
|
-
return
|
|
685
|
-
|
|
714
|
+
return {
|
|
715
|
+
id: resolvedId,
|
|
716
|
+
deleted: await repo.delete(collection, resolvedId)
|
|
717
|
+
};
|
|
718
|
+
});
|
|
719
|
+
if (!result.deleted) return {
|
|
686
720
|
success: false,
|
|
687
721
|
error: {
|
|
688
722
|
code: "NOT_FOUND",
|
|
@@ -691,7 +725,10 @@ async function handleContentDelete(db, collection, id) {
|
|
|
691
725
|
};
|
|
692
726
|
return {
|
|
693
727
|
success: true,
|
|
694
|
-
data: {
|
|
728
|
+
data: {
|
|
729
|
+
deleted: true,
|
|
730
|
+
id: result.id
|
|
731
|
+
}
|
|
695
732
|
};
|
|
696
733
|
} catch (error) {
|
|
697
734
|
console.error("Content delete error:", error);
|
|
@@ -709,11 +746,12 @@ async function handleContentDelete(db, collection, id) {
|
|
|
709
746
|
*/
|
|
710
747
|
async function handleContentRestore(db, collection, id) {
|
|
711
748
|
try {
|
|
712
|
-
|
|
749
|
+
const item = await withTransaction(db, async (trx) => {
|
|
713
750
|
const repo = new ContentRepository(trx);
|
|
714
751
|
const resolvedId = await resolveIdIncludingTrashed(repo, collection, id) ?? id;
|
|
715
752
|
return repo.restore(collection, resolvedId);
|
|
716
|
-
})
|
|
753
|
+
});
|
|
754
|
+
if (!item) return {
|
|
717
755
|
success: false,
|
|
718
756
|
error: {
|
|
719
757
|
code: "NOT_FOUND",
|
|
@@ -722,7 +760,10 @@ async function handleContentRestore(db, collection, id) {
|
|
|
722
760
|
};
|
|
723
761
|
return {
|
|
724
762
|
success: true,
|
|
725
|
-
data: {
|
|
763
|
+
data: {
|
|
764
|
+
restored: true,
|
|
765
|
+
item
|
|
766
|
+
}
|
|
726
767
|
};
|
|
727
768
|
} catch (error) {
|
|
728
769
|
console.error("Content restore error:", error);
|
|
@@ -759,7 +800,10 @@ async function handleContentPermanentDelete(db, collection, id) {
|
|
|
759
800
|
};
|
|
760
801
|
return {
|
|
761
802
|
success: true,
|
|
762
|
-
data: {
|
|
803
|
+
data: {
|
|
804
|
+
deleted: true,
|
|
805
|
+
id: resolvedId
|
|
806
|
+
}
|
|
763
807
|
};
|
|
764
808
|
} catch (error) {
|
|
765
809
|
console.error("Content permanent delete error:", error);
|
|
@@ -908,7 +952,10 @@ async function handleContentPublish(db, collection, id, options = {}) {
|
|
|
908
952
|
const item = await withTransaction(db, async (trx) => {
|
|
909
953
|
const repo = new ContentRepository(trx);
|
|
910
954
|
const resolvedId = await resolveId(repo, collection, id) ?? id;
|
|
911
|
-
|
|
955
|
+
const existing = await repo.findById(collection, resolvedId);
|
|
956
|
+
const published = await repo.publish(collection, resolvedId, options.publishedAt, options.requireScheduledDue);
|
|
957
|
+
if (existing?.status === "published" && existing.slug && published.slug && existing.slug !== published.slug) await createSlugChangeRedirect(trx, collection, existing.slug, published.slug, resolvedId);
|
|
958
|
+
return published;
|
|
912
959
|
});
|
|
913
960
|
await hydrateSeo(db, collection, item, await collectionHasSeo(db, collection));
|
|
914
961
|
return {
|
|
@@ -1706,9 +1753,11 @@ async function handleSchemaFieldGet(db, collectionSlug, fieldSlug) {
|
|
|
1706
1753
|
*/
|
|
1707
1754
|
async function handleSchemaFieldCreate(db, collectionSlug, input) {
|
|
1708
1755
|
try {
|
|
1756
|
+
const item = await new SchemaRegistry(db).createField(collectionSlug, input);
|
|
1757
|
+
invalidateCollectionCache(collectionSlug);
|
|
1709
1758
|
return {
|
|
1710
1759
|
success: true,
|
|
1711
|
-
data: { item
|
|
1760
|
+
data: { item }
|
|
1712
1761
|
};
|
|
1713
1762
|
} catch (error) {
|
|
1714
1763
|
if (error instanceof SchemaError) return {
|
|
@@ -1733,9 +1782,11 @@ async function handleSchemaFieldCreate(db, collectionSlug, input) {
|
|
|
1733
1782
|
*/
|
|
1734
1783
|
async function handleSchemaFieldUpdate(db, collectionSlug, fieldSlug, input) {
|
|
1735
1784
|
try {
|
|
1785
|
+
const item = await new SchemaRegistry(db).updateField(collectionSlug, fieldSlug, input);
|
|
1786
|
+
invalidateCollectionCache(collectionSlug);
|
|
1736
1787
|
return {
|
|
1737
1788
|
success: true,
|
|
1738
|
-
data: { item
|
|
1789
|
+
data: { item }
|
|
1739
1790
|
};
|
|
1740
1791
|
} catch (error) {
|
|
1741
1792
|
if (error instanceof SchemaError) return {
|
|
@@ -1761,6 +1812,7 @@ async function handleSchemaFieldUpdate(db, collectionSlug, fieldSlug, input) {
|
|
|
1761
1812
|
async function handleSchemaFieldDelete(db, collectionSlug, fieldSlug) {
|
|
1762
1813
|
try {
|
|
1763
1814
|
await new SchemaRegistry(db).deleteField(collectionSlug, fieldSlug);
|
|
1815
|
+
invalidateCollectionCache(collectionSlug);
|
|
1764
1816
|
return {
|
|
1765
1817
|
success: true,
|
|
1766
1818
|
data: { success: true }
|
|
@@ -1921,7 +1973,7 @@ var StoragePluginBundleStore = class {
|
|
|
1921
1973
|
adminCode = await streamToText((await this.storage.download(`${prefix}/${ADMIN_FILENAME}`)).body);
|
|
1922
1974
|
} catch {}
|
|
1923
1975
|
return {
|
|
1924
|
-
manifest: result.data,
|
|
1976
|
+
manifest: reconcileManifestAccess(result.data),
|
|
1925
1977
|
backendCode,
|
|
1926
1978
|
adminCode
|
|
1927
1979
|
};
|
|
@@ -2111,7 +2163,7 @@ async function extractBundle(tarballBytes) {
|
|
|
2111
2163
|
const parsed = JSON.parse(manifestJson);
|
|
2112
2164
|
const result = pluginManifestSchema.safeParse(parsed);
|
|
2113
2165
|
if (!result.success) throw new MarketplaceError("Invalid bundle: manifest.json failed validation", void 0, "INVALID_BUNDLE");
|
|
2114
|
-
manifest = result.data;
|
|
2166
|
+
manifest = reconcileManifestAccess(result.data);
|
|
2115
2167
|
} catch (err) {
|
|
2116
2168
|
if (err instanceof MarketplaceError) throw err;
|
|
2117
2169
|
throw new MarketplaceError("Invalid bundle: malformed manifest.json", void 0, "INVALID_BUNDLE");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as hashApiToken, r as generatePrefixedToken } from "./api-tokens-
|
|
1
|
+
import { a as hashApiToken, r as generatePrefixedToken } from "./api-tokens-Ypaly90d.mjs";
|
|
2
2
|
import { ulid } from "ulidx";
|
|
3
3
|
|
|
4
4
|
//#region src/api/handlers/api-tokens.ts
|
|
@@ -107,6 +107,10 @@ async function handleApiTokenRevoke(db, tokenId, userId) {
|
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
+
async function deleteApiTokensByName(db, userId, name) {
|
|
111
|
+
const result = await db.deleteFrom("_dineway_api_tokens").where("user_id", "=", userId).where("name", "=", name).executeTakeFirst();
|
|
112
|
+
return Number(result.numDeletedRows ?? 0n);
|
|
113
|
+
}
|
|
110
114
|
/**
|
|
111
115
|
* Resolve a raw API token (ec_pat_...) to a user ID and scopes.
|
|
112
116
|
* Updates last_used_at on successful lookup.
|
|
@@ -150,4 +154,4 @@ async function resolveOAuthToken(db, rawToken) {
|
|
|
150
154
|
}
|
|
151
155
|
|
|
152
156
|
//#endregion
|
|
153
|
-
export {
|
|
157
|
+
export { resolveApiToken as a, handleApiTokenRevoke as i, handleApiTokenCreate as n, resolveOAuthToken as o, handleApiTokenList as r, deleteApiTokensByName as t };
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { a as __exportAll } from "./runner-
|
|
1
|
+
import { a as __exportAll } from "./runner-BgmttQmD.mjs";
|
|
2
2
|
import { n as getI18nConfig } from "./config-CVssduLe.mjs";
|
|
3
|
-
import { r as RevisionRepository, t as ContentRepository } from "./content-
|
|
4
|
-
import { t as MediaRepository } from "./media-
|
|
5
|
-
import { t as TaxonomyRepository } from "./taxonomy-
|
|
6
|
-
import { t as withTransaction } from "./transaction-
|
|
7
|
-
import { t as RedirectRepository } from "./redirect-
|
|
8
|
-
import { t as BylineRepository } from "./byline-
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
3
|
+
import { r as RevisionRepository, t as ContentRepository } from "./content-DJcAYFhz.mjs";
|
|
4
|
+
import { t as MediaRepository } from "./media-CVMOoywq.mjs";
|
|
5
|
+
import { t as TaxonomyRepository } from "./taxonomy-0k_vRVsD.mjs";
|
|
6
|
+
import { t as withTransaction } from "./transaction-0LEAAy8R.mjs";
|
|
7
|
+
import { t as RedirectRepository } from "./redirect-ubhEqQCQ.mjs";
|
|
8
|
+
import { t as BylineRepository } from "./byline-7xR185Ly.mjs";
|
|
9
|
+
import { a as markContentMediaUsageCollectionStaleSafely } from "./content-refresh-B4ZCmxgd.mjs";
|
|
10
|
+
import { t as FTSManager } from "./fts-manager-ewTGohf4.mjs";
|
|
11
|
+
import { n as SchemaRegistry } from "./registry-BYYyb2tF.mjs";
|
|
12
|
+
import { s as setSiteSettings } from "./settings-BECcAIRH.mjs";
|
|
13
|
+
import { a as validateExternalUrl, r as ssrfSafeFetch } from "./ssrf-FJqwQzj4.mjs";
|
|
14
|
+
import { t as validateSeed } from "./validate-D1HL-oLR.mjs";
|
|
14
15
|
import { ulid } from "ulidx";
|
|
15
16
|
import { imageSize } from "image-size";
|
|
16
17
|
import mime from "mime/lite";
|
|
@@ -128,7 +129,22 @@ async function applySeed(db, seed, options = {}) {
|
|
|
128
129
|
};
|
|
129
130
|
const seedIdMap = /* @__PURE__ */ new Map();
|
|
130
131
|
const seedBylineIdMap = /* @__PURE__ */ new Map();
|
|
132
|
+
const staleMarkedContentCollections = /* @__PURE__ */ new Set();
|
|
133
|
+
const failedStaleContentCollections = /* @__PURE__ */ new Set();
|
|
131
134
|
const defaultLocale = getI18nConfig()?.defaultLocale ?? seed.defaultLocale ?? "en";
|
|
135
|
+
const markSeedContentCollectionStale = async (collectionSlug) => {
|
|
136
|
+
if (staleMarkedContentCollections.has(collectionSlug)) return;
|
|
137
|
+
if (await markContentMediaUsageCollectionStaleSafely(db, collectionSlug, "CONTENT_USAGE_STALE")) {
|
|
138
|
+
staleMarkedContentCollections.add(collectionSlug);
|
|
139
|
+
failedStaleContentCollections.delete(collectionSlug);
|
|
140
|
+
} else failedStaleContentCollections.add(collectionSlug);
|
|
141
|
+
};
|
|
142
|
+
const retryFailedSeedContentStaleMarks = async () => {
|
|
143
|
+
for (const collectionSlug of failedStaleContentCollections) if (await markContentMediaUsageCollectionStaleSafely(db, collectionSlug, "CONTENT_USAGE_STALE")) {
|
|
144
|
+
staleMarkedContentCollections.add(collectionSlug);
|
|
145
|
+
failedStaleContentCollections.delete(collectionSlug);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
132
148
|
if (seed.settings) {
|
|
133
149
|
await setSiteSettings(seed.settings, db);
|
|
134
150
|
result.settings.applied = Object.keys(seed.settings).length;
|
|
@@ -154,6 +170,7 @@ async function applySeed(db, seed, options = {}) {
|
|
|
154
170
|
if (repairSchema) await registry.ensureFieldColumn(collection.slug, field.slug);
|
|
155
171
|
await registry.updateField(collection.slug, field.slug, {
|
|
156
172
|
label: field.label,
|
|
173
|
+
type: field.type,
|
|
157
174
|
required: field.required || false,
|
|
158
175
|
unique: field.unique || false,
|
|
159
176
|
searchable: field.searchable || false,
|
|
@@ -234,7 +251,7 @@ async function applySeed(db, seed, options = {}) {
|
|
|
234
251
|
id: defId,
|
|
235
252
|
translationGroup: defTranslationGroup
|
|
236
253
|
});
|
|
237
|
-
if (taxonomy.terms && taxonomy.terms.length > 0) {
|
|
254
|
+
if (includeContent && taxonomy.terms && taxonomy.terms.length > 0) {
|
|
238
255
|
const termRepo = new TaxonomyRepository(db);
|
|
239
256
|
if (taxonomy.hierarchical) await applyHierarchicalTerms(termRepo, taxonomy.name, defLocale, taxonomy.terms, termSeedIdMap, result, onConflict);
|
|
240
257
|
else for (const term of taxonomy.terms) {
|
|
@@ -266,8 +283,10 @@ async function applySeed(db, seed, options = {}) {
|
|
|
266
283
|
}
|
|
267
284
|
}
|
|
268
285
|
}
|
|
286
|
+
const { invalidateTaxonomyDefsCache } = await import("./taxonomies-DSnY5nOa.mjs").then((n) => n.u);
|
|
287
|
+
invalidateTaxonomyDefsCache();
|
|
269
288
|
}
|
|
270
|
-
if (seed.bylines) {
|
|
289
|
+
if (includeContent && seed.bylines) {
|
|
271
290
|
const bylineRepo = new BylineRepository(db);
|
|
272
291
|
for (const byline of seed.bylines) {
|
|
273
292
|
const existing = await bylineRepo.findBySlug(byline.slug);
|
|
@@ -318,69 +337,90 @@ async function applySeed(db, seed, options = {}) {
|
|
|
318
337
|
}
|
|
319
338
|
if (includeContent && seed.content) {
|
|
320
339
|
const contentRepo = new ContentRepository(db);
|
|
321
|
-
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
if (
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
340
|
+
try {
|
|
341
|
+
for (const [collectionSlug, entries] of Object.entries(seed.content)) for (const entry of entries) {
|
|
342
|
+
const entryLocale = entry.locale ?? defaultLocale;
|
|
343
|
+
const existing = await contentRepo.findBySlug(collectionSlug, entry.slug, entryLocale);
|
|
344
|
+
if (existing) {
|
|
345
|
+
if (onConflict === "error") throw new Error(`Conflict: content "${entry.slug}" in "${collectionSlug}" already exists`);
|
|
346
|
+
if (onConflict === "update") {
|
|
347
|
+
const resolvedData = await resolveReferences(entry.data, seedIdMap, mediaContext, result);
|
|
348
|
+
const status = entry.status || "published";
|
|
349
|
+
let contentMutated = false;
|
|
350
|
+
try {
|
|
351
|
+
await withTransaction(db, async (trx) => {
|
|
352
|
+
const trxContentRepo = new ContentRepository(trx);
|
|
353
|
+
const trxBylineRepo = new BylineRepository(trx);
|
|
354
|
+
const trxRevisionRepo = new RevisionRepository(trx);
|
|
355
|
+
await trxContentRepo.update(collectionSlug, existing.id, {
|
|
356
|
+
status,
|
|
357
|
+
data: resolvedData
|
|
358
|
+
});
|
|
359
|
+
contentMutated = true;
|
|
360
|
+
await applyContentBylines(trxBylineRepo, collectionSlug, existing.id, entry, seedBylineIdMap, true);
|
|
361
|
+
await applyContentTaxonomies(trx, collectionSlug, existing.id, entry, true);
|
|
362
|
+
if (status === "published") {
|
|
363
|
+
const draft = await trxRevisionRepo.create({
|
|
364
|
+
collection: collectionSlug,
|
|
365
|
+
entryId: existing.id,
|
|
366
|
+
data: resolvedData
|
|
367
|
+
});
|
|
368
|
+
await trxContentRepo.setDraftRevision(collectionSlug, existing.id, draft.id);
|
|
369
|
+
await trxContentRepo.publish(collectionSlug, existing.id);
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
} catch (error) {
|
|
373
|
+
if (contentMutated) await markSeedContentCollectionStale(collectionSlug);
|
|
374
|
+
throw error;
|
|
375
|
+
}
|
|
376
|
+
seedIdMap.set(entry.id, existing.id);
|
|
377
|
+
result.content.updated++;
|
|
378
|
+
await markSeedContentCollectionStale(collectionSlug);
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
381
|
+
result.content.skipped++;
|
|
382
|
+
seedIdMap.set(entry.id, existing.id);
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
const resolvedData = await resolveReferences(entry.data, seedIdMap, mediaContext, result);
|
|
386
|
+
let translationOf;
|
|
387
|
+
if (entry.translationOf) {
|
|
388
|
+
const sourceId = seedIdMap.get(entry.translationOf);
|
|
389
|
+
if (!sourceId) console.warn(`content.${collectionSlug}: translationOf "${entry.translationOf}" not found (not yet created or missing). Skipping translation link.`);
|
|
390
|
+
else translationOf = sourceId;
|
|
391
|
+
}
|
|
392
|
+
const status = entry.status || "published";
|
|
393
|
+
let contentMutated = false;
|
|
394
|
+
let created;
|
|
395
|
+
try {
|
|
396
|
+
created = await withTransaction(db, async (trx) => {
|
|
330
397
|
const trxContentRepo = new ContentRepository(trx);
|
|
331
398
|
const trxBylineRepo = new BylineRepository(trx);
|
|
332
|
-
const
|
|
333
|
-
|
|
399
|
+
const item = await trxContentRepo.create({
|
|
400
|
+
type: collectionSlug,
|
|
401
|
+
slug: entry.slug,
|
|
334
402
|
status,
|
|
335
|
-
data: resolvedData
|
|
403
|
+
data: resolvedData,
|
|
404
|
+
locale: entryLocale,
|
|
405
|
+
translationOf,
|
|
406
|
+
publishedAt: status === "published" ? (/* @__PURE__ */ new Date()).toISOString() : null
|
|
336
407
|
});
|
|
337
|
-
|
|
338
|
-
await
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
entryId: existing.id,
|
|
343
|
-
data: resolvedData
|
|
344
|
-
});
|
|
345
|
-
await trxContentRepo.setDraftRevision(collectionSlug, existing.id, draft.id);
|
|
346
|
-
await trxContentRepo.publish(collectionSlug, existing.id);
|
|
347
|
-
}
|
|
408
|
+
contentMutated = true;
|
|
409
|
+
await applyContentBylines(trxBylineRepo, collectionSlug, item.id, entry, seedBylineIdMap);
|
|
410
|
+
await applyContentTaxonomies(trx, collectionSlug, item.id, entry, false);
|
|
411
|
+
if (status === "published") await trxContentRepo.publish(collectionSlug, item.id);
|
|
412
|
+
return item;
|
|
348
413
|
});
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
414
|
+
} catch (error) {
|
|
415
|
+
if (contentMutated) await markSeedContentCollectionStale(collectionSlug);
|
|
416
|
+
throw error;
|
|
352
417
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
}
|
|
357
|
-
const resolvedData = await resolveReferences(entry.data, seedIdMap, mediaContext, result);
|
|
358
|
-
let translationOf;
|
|
359
|
-
if (entry.translationOf) {
|
|
360
|
-
const sourceId = seedIdMap.get(entry.translationOf);
|
|
361
|
-
if (!sourceId) console.warn(`content.${collectionSlug}: translationOf "${entry.translationOf}" not found (not yet created or missing). Skipping translation link.`);
|
|
362
|
-
else translationOf = sourceId;
|
|
418
|
+
seedIdMap.set(entry.id, created.id);
|
|
419
|
+
result.content.created++;
|
|
420
|
+
await markSeedContentCollectionStale(collectionSlug);
|
|
363
421
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
const trxContentRepo = new ContentRepository(trx);
|
|
367
|
-
const trxBylineRepo = new BylineRepository(trx);
|
|
368
|
-
const item = await trxContentRepo.create({
|
|
369
|
-
type: collectionSlug,
|
|
370
|
-
slug: entry.slug,
|
|
371
|
-
status,
|
|
372
|
-
data: resolvedData,
|
|
373
|
-
locale: entryLocale,
|
|
374
|
-
translationOf,
|
|
375
|
-
publishedAt: status === "published" ? (/* @__PURE__ */ new Date()).toISOString() : null
|
|
376
|
-
});
|
|
377
|
-
await applyContentBylines(trxBylineRepo, collectionSlug, item.id, entry, seedBylineIdMap);
|
|
378
|
-
await applyContentTaxonomies(trx, collectionSlug, item.id, entry, false);
|
|
379
|
-
if (status === "published") await trxContentRepo.publish(collectionSlug, item.id);
|
|
380
|
-
return item;
|
|
381
|
-
});
|
|
382
|
-
seedIdMap.set(entry.id, created.id);
|
|
383
|
-
result.content.created++;
|
|
422
|
+
} finally {
|
|
423
|
+
await retryFailedSeedContentStaleMarks();
|
|
384
424
|
}
|
|
385
425
|
}
|
|
386
426
|
if (seed.menus) {
|
|
@@ -430,7 +470,7 @@ async function applySeed(db, seed, options = {}) {
|
|
|
430
470
|
if (onConflict === "error") throw new Error(`Conflict: redirect "${redirect.source}" already exists`);
|
|
431
471
|
if (onConflict === "update") {
|
|
432
472
|
await redirectRepo.update(existing.id, {
|
|
433
|
-
destination: redirect.destination,
|
|
473
|
+
destination: redirect.type === 410 || redirect.type === 451 ? "" : redirect.destination,
|
|
434
474
|
type: redirect.type,
|
|
435
475
|
enabled: redirect.enabled,
|
|
436
476
|
groupName: redirect.groupName
|
|
@@ -443,7 +483,7 @@ async function applySeed(db, seed, options = {}) {
|
|
|
443
483
|
}
|
|
444
484
|
await redirectRepo.create({
|
|
445
485
|
source: redirect.source,
|
|
446
|
-
destination: redirect.destination,
|
|
486
|
+
destination: redirect.type === 410 || redirect.type === 451 ? "" : redirect.destination,
|
|
447
487
|
type: redirect.type,
|
|
448
488
|
enabled: redirect.enabled,
|
|
449
489
|
groupName: redirect.groupName
|
|
@@ -519,9 +559,9 @@ async function applySeed(db, seed, options = {}) {
|
|
|
519
559
|
}
|
|
520
560
|
}
|
|
521
561
|
}
|
|
522
|
-
const { invalidateBylineCache } = await import("./bylines-
|
|
523
|
-
const { invalidateUrlPatternCache } = await import("./query-
|
|
524
|
-
const { invalidateRedirectCache } = await import("./cache-
|
|
562
|
+
const { invalidateBylineCache } = await import("./bylines-CmZFCMr0.mjs").then((n) => n.t);
|
|
563
|
+
const { invalidateUrlPatternCache } = await import("./query-DEv5x6yB.mjs").then((n) => n.o);
|
|
564
|
+
const { invalidateRedirectCache } = await import("./cache-DkVCKGio.mjs").then((n) => n.t);
|
|
525
565
|
invalidateBylineCache();
|
|
526
566
|
invalidateUrlPatternCache();
|
|
527
567
|
invalidateRedirectCache();
|
|
@@ -605,7 +645,7 @@ async function applyContentTaxonomies(db, collectionSlug, contentId, entry, isUp
|
|
|
605
645
|
if (isUpdate) await db.deleteFrom("content_taxonomies").where("collection", "=", collectionSlug).where("entry_id", "=", contentId).execute();
|
|
606
646
|
if (!entry.taxonomies) {
|
|
607
647
|
if (isUpdate) {
|
|
608
|
-
const { invalidateTermCache } = await import("./taxonomies-
|
|
648
|
+
const { invalidateTermCache } = await import("./taxonomies-DSnY5nOa.mjs").then((n) => n.u);
|
|
609
649
|
invalidateTermCache();
|
|
610
650
|
}
|
|
611
651
|
return;
|
|
@@ -617,7 +657,7 @@ async function applyContentTaxonomies(db, collectionSlug, contentId, entry, isUp
|
|
|
617
657
|
if (term) await termRepo.attachToEntry(collectionSlug, contentId, term.id);
|
|
618
658
|
}
|
|
619
659
|
}
|
|
620
|
-
const { invalidateTermCache } = await import("./taxonomies-
|
|
660
|
+
const { invalidateTermCache } = await import("./taxonomies-DSnY5nOa.mjs").then((n) => n.u);
|
|
621
661
|
invalidateTermCache();
|
|
622
662
|
}
|
|
623
663
|
/**
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { IMMUTABLE_IMAGE_CACHE, matchInternalMediaKey, originalMediaHeaders } from "../media/image-endpoint.mjs";
|
|
2
|
+
import { GET as GET$1 } from "astro/assets/endpoint/generic";
|
|
3
|
+
import { getConfiguredImageService, imageConfig } from "astro:assets";
|
|
4
|
+
|
|
5
|
+
//#region src/astro/image-endpoint.ts
|
|
6
|
+
const prerender = false;
|
|
7
|
+
const FORMAT_MIME = {
|
|
8
|
+
webp: "image/webp",
|
|
9
|
+
avif: "image/avif",
|
|
10
|
+
png: "image/png",
|
|
11
|
+
jpeg: "image/jpeg",
|
|
12
|
+
jpg: "image/jpeg",
|
|
13
|
+
gif: "image/gif"
|
|
14
|
+
};
|
|
15
|
+
function isNotFound(error) {
|
|
16
|
+
return error instanceof Error && (error.message.includes("not found") || error.message.includes("NOT_FOUND"));
|
|
17
|
+
}
|
|
18
|
+
function streamOriginal(body, contentType) {
|
|
19
|
+
return new Response(body, {
|
|
20
|
+
status: 200,
|
|
21
|
+
headers: originalMediaHeaders(contentType)
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
const GET = async (ctx) => {
|
|
25
|
+
const url = new URL(ctx.request.url);
|
|
26
|
+
const key = matchInternalMediaKey(url.searchParams.get("href"));
|
|
27
|
+
const storage = ctx.locals.dineway?.storage;
|
|
28
|
+
if (!key || !storage) return GET$1(ctx);
|
|
29
|
+
const service = await getConfiguredImageService();
|
|
30
|
+
if (!("transform" in service)) return GET$1(ctx);
|
|
31
|
+
try {
|
|
32
|
+
const source = await storage.download(key);
|
|
33
|
+
if (!source.contentType.startsWith("image/")) return streamOriginal(source.body, source.contentType);
|
|
34
|
+
const transform = await service.parseURL(url, imageConfig);
|
|
35
|
+
if (!transform) return streamOriginal(source.body, source.contentType);
|
|
36
|
+
const inputBuffer = new Uint8Array(await new Response(source.body).arrayBuffer());
|
|
37
|
+
const { data, format } = await service.transform(inputBuffer, transform, imageConfig);
|
|
38
|
+
return new Response(data, {
|
|
39
|
+
status: 200,
|
|
40
|
+
headers: {
|
|
41
|
+
"Content-Type": FORMAT_MIME[format] ?? source.contentType,
|
|
42
|
+
"Cache-Control": IMMUTABLE_IMAGE_CACHE,
|
|
43
|
+
"X-Content-Type-Options": "nosniff"
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
} catch (error) {
|
|
47
|
+
if (isNotFound(error)) return new Response("Not Found", { status: 404 });
|
|
48
|
+
console.error("[dineway] image transform failed:", error);
|
|
49
|
+
return new Response("Internal Server Error", { status: 500 });
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { GET, prerender };
|