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
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/utils/stable-hash.ts
|
|
2
|
+
async function buildStableHash(value) {
|
|
3
|
+
return sha256Hex(stableStringify(value));
|
|
4
|
+
}
|
|
5
|
+
function stableStringify(value) {
|
|
6
|
+
if (Array.isArray(value)) return `[${value.map((item) => stableStringify(item)).join(",")}]`;
|
|
7
|
+
if (isRecord(value)) return `{${Object.entries(value).filter(([, entryValue]) => entryValue !== void 0).toSorted(([left], [right]) => left.localeCompare(right)).map(([key, entryValue]) => `${JSON.stringify(key)}:${stableStringify(entryValue)}`).join(",")}}`;
|
|
8
|
+
return JSON.stringify(value ?? null);
|
|
9
|
+
}
|
|
10
|
+
function isRecord(value) {
|
|
11
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
12
|
+
}
|
|
13
|
+
async function sha256Hex(value) {
|
|
14
|
+
const buffer = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(value));
|
|
15
|
+
return Array.from(new Uint8Array(buffer), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { stableStringify as n, buildStableHash as t };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/redirects/status.ts
|
|
2
|
+
/**
|
|
3
|
+
* Redirect rule status codes.
|
|
4
|
+
*
|
|
5
|
+
* Redirect statuses issue a Location header. Terminal statuses serve the
|
|
6
|
+
* status directly with no destination.
|
|
7
|
+
*/
|
|
8
|
+
const REDIRECT_STATUSES = [
|
|
9
|
+
301,
|
|
10
|
+
302,
|
|
11
|
+
307,
|
|
12
|
+
308
|
|
13
|
+
];
|
|
14
|
+
const TERMINAL_STATUSES = [410, 451];
|
|
15
|
+
const REDIRECT_RULE_STATUSES = [...REDIRECT_STATUSES, ...TERMINAL_STATUSES];
|
|
16
|
+
function isTerminalStatus(type) {
|
|
17
|
+
return TERMINAL_STATUSES.includes(type);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { isTerminalStatus as n, REDIRECT_RULE_STATUSES as t };
|
package/dist/storage/local.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ListOptions, d as Storage, l as SignedUploadOptions, o as ListResult, p as UploadResult, r as DownloadResult, s as LocalStorageConfig, u as SignedUploadUrl } from "../types-
|
|
1
|
+
import { a as ListOptions, d as Storage, l as SignedUploadOptions, o as ListResult, p as UploadResult, r as DownloadResult, s as LocalStorageConfig, u as SignedUploadUrl } from "../types-wFu80FrO.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/storage/local.d.ts
|
|
4
4
|
/**
|
package/dist/storage/local.mjs
CHANGED
package/dist/storage/s3.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ListOptions, c as S3StorageConfig, d as Storage, l as SignedUploadOptions, o as ListResult, p as UploadResult, r as DownloadResult, u as SignedUploadUrl } from "../types-
|
|
1
|
+
import { a as ListOptions, c as S3StorageConfig, d as Storage, l as SignedUploadOptions, o as ListResult, p as UploadResult, r as DownloadResult, u as SignedUploadUrl } from "../types-wFu80FrO.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/storage/s3.d.ts
|
|
4
4
|
/**
|
package/dist/storage/s3.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as DinewayStorageError } from "../types-
|
|
1
|
+
import { t as DinewayStorageError } from "../types-mVVgRPaU.mjs";
|
|
2
2
|
import { DeleteObjectCommand, GetObjectCommand, HeadObjectCommand, ListObjectsV2Command, PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
|
|
3
3
|
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
|
|
4
4
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as __exportAll } from "./runner-
|
|
2
|
-
import { t as TaxonomyRepository } from "./taxonomy-
|
|
3
|
-
import { c as invalidateTermCache } from "./taxonomies-
|
|
1
|
+
import { a as __exportAll } from "./runner-BgmttQmD.mjs";
|
|
2
|
+
import { t as TaxonomyRepository } from "./taxonomy-0k_vRVsD.mjs";
|
|
3
|
+
import { c as invalidateTaxonomyDefsCache, l as invalidateTermCache } from "./taxonomies-DSnY5nOa.mjs";
|
|
4
4
|
import { ulid } from "ulidx";
|
|
5
5
|
|
|
6
6
|
//#region src/api/handlers/taxonomies.ts
|
|
@@ -19,11 +19,14 @@ const NAME_PATTERN = /^[a-z][a-z0-9_]*$/;
|
|
|
19
19
|
* Build tree structure from flat terms
|
|
20
20
|
*/
|
|
21
21
|
function buildTree(flatTerms) {
|
|
22
|
-
const
|
|
22
|
+
const byLocaleGroup = /* @__PURE__ */ new Map();
|
|
23
23
|
const roots = [];
|
|
24
|
-
for (const term of flatTerms)
|
|
25
|
-
for (const term of flatTerms)
|
|
26
|
-
|
|
24
|
+
for (const term of flatTerms) byLocaleGroup.set(`${term.locale}::${term.translationGroup ?? term.id}`, term);
|
|
25
|
+
for (const term of flatTerms) {
|
|
26
|
+
const parent = term.parentId ? byLocaleGroup.get(`${term.locale}::${term.parentId}`) : void 0;
|
|
27
|
+
if (parent) parent.children.push(term);
|
|
28
|
+
else roots.push(term);
|
|
29
|
+
}
|
|
27
30
|
return roots;
|
|
28
31
|
}
|
|
29
32
|
/**
|
|
@@ -144,6 +147,7 @@ async function handleTaxonomyCreate(db, input) {
|
|
|
144
147
|
...input.locale !== void 0 ? { locale: input.locale } : {},
|
|
145
148
|
translation_group: translationGroup ?? id
|
|
146
149
|
}).execute();
|
|
150
|
+
invalidateTaxonomyDefsCache();
|
|
147
151
|
return {
|
|
148
152
|
success: true,
|
|
149
153
|
data: { taxonomy: rowToDef(await db.selectFrom("_dineway_taxonomy_defs").selectAll().where("id", "=", id).executeTakeFirstOrThrow()) }
|
|
@@ -212,15 +216,12 @@ async function handleTermList(db, taxonomyName, options = {}) {
|
|
|
212
216
|
* - `parentId === null` -> caller intends to detach; no-op here.
|
|
213
217
|
* - parent must exist (FK exists -> term row not soft-deleted).
|
|
214
218
|
* - parent must live in the same taxonomy.
|
|
215
|
-
* -
|
|
216
|
-
*
|
|
219
|
+
* - reject a parent in the term's own translation_group.
|
|
220
|
+
* - if `termId` is provided (update path), walk up the parent chain to
|
|
221
|
+
* detect cycles.
|
|
217
222
|
*/
|
|
218
|
-
async function validateParentTerm(repo, taxonomyName, termId, parentId) {
|
|
223
|
+
async function validateParentTerm(repo, taxonomyName, termId, parentId, selfGroup) {
|
|
219
224
|
if (parentId === void 0 || parentId === null) return null;
|
|
220
|
-
if (termId !== void 0 && parentId === termId) return {
|
|
221
|
-
code: "VALIDATION_ERROR",
|
|
222
|
-
message: "A term cannot be its own parent"
|
|
223
|
-
};
|
|
224
225
|
const parent = await repo.findById(parentId);
|
|
225
226
|
if (!parent) return {
|
|
226
227
|
code: "VALIDATION_ERROR",
|
|
@@ -230,11 +231,21 @@ async function validateParentTerm(repo, taxonomyName, termId, parentId) {
|
|
|
230
231
|
code: "VALIDATION_ERROR",
|
|
231
232
|
message: `Parent term '${parentId}' belongs to taxonomy '${parent.name}', not '${taxonomyName}'`
|
|
232
233
|
};
|
|
234
|
+
const parentGroup = parent.translationGroup ?? parent.id;
|
|
235
|
+
let termGroup = selfGroup ?? null;
|
|
236
|
+
if (termId !== void 0) {
|
|
237
|
+
const term = await repo.findById(termId);
|
|
238
|
+
termGroup = term ? term.translationGroup ?? term.id : termId;
|
|
239
|
+
}
|
|
240
|
+
if (termGroup !== null && parentGroup === termGroup) return {
|
|
241
|
+
code: "VALIDATION_ERROR",
|
|
242
|
+
message: "A term cannot be its own parent"
|
|
243
|
+
};
|
|
233
244
|
const MAX_DEPTH = 100;
|
|
234
245
|
let cursor = parent.parentId;
|
|
235
246
|
let steps = 0;
|
|
236
247
|
while (cursor !== null && steps < MAX_DEPTH) {
|
|
237
|
-
if (
|
|
248
|
+
if (termGroup !== null && cursor === termGroup) return {
|
|
238
249
|
code: "VALIDATION_ERROR",
|
|
239
250
|
message: "Cycle detected: cannot make a descendant the parent"
|
|
240
251
|
};
|
|
@@ -257,7 +268,7 @@ async function handleTermCreate(db, taxonomyName, input) {
|
|
|
257
268
|
const lookup = await requireTaxonomyDef(db, taxonomyName);
|
|
258
269
|
if (!lookup.success) return lookup;
|
|
259
270
|
const repo = new TaxonomyRepository(db);
|
|
260
|
-
|
|
271
|
+
const parentId = input.parentId === "" || input.parentId === void 0 ? void 0 : input.parentId;
|
|
261
272
|
if (await repo.findBySlug(taxonomyName, input.slug, input.locale)) return {
|
|
262
273
|
success: false,
|
|
263
274
|
error: {
|
|
@@ -265,16 +276,12 @@ async function handleTermCreate(db, taxonomyName, input) {
|
|
|
265
276
|
message: input.locale ? `Term '${input.slug}' already exists in '${taxonomyName}' (${input.locale})` : `Term with slug '${input.slug}' already exists in taxonomy '${taxonomyName}'`
|
|
266
277
|
}
|
|
267
278
|
};
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
const translatedParent = await db.selectFrom("taxonomies").select("id").where("translation_group", "=", sourceParent.translationGroup).where("locale", "=", input.locale).executeTakeFirst();
|
|
273
|
-
if (translatedParent) parentId = translatedParent.id;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
279
|
+
let selfGroup = null;
|
|
280
|
+
if (input.translationOf) {
|
|
281
|
+
const source = await repo.findById(input.translationOf);
|
|
282
|
+
selfGroup = source ? source.translationGroup ?? source.id : null;
|
|
276
283
|
}
|
|
277
|
-
const parentError = await validateParentTerm(repo, taxonomyName, void 0, parentId);
|
|
284
|
+
const parentError = await validateParentTerm(repo, taxonomyName, void 0, parentId, selfGroup);
|
|
278
285
|
if (parentError) return {
|
|
279
286
|
success: false,
|
|
280
287
|
error: parentError
|
|
@@ -288,7 +295,7 @@ async function handleTermCreate(db, taxonomyName, input) {
|
|
|
288
295
|
locale: input.locale,
|
|
289
296
|
translationOf: input.translationOf
|
|
290
297
|
});
|
|
291
|
-
|
|
298
|
+
invalidateTermCache();
|
|
292
299
|
return {
|
|
293
300
|
success: true,
|
|
294
301
|
data: { term: {
|
|
@@ -327,7 +334,7 @@ async function handleTermGet(db, taxonomyName, termSlug, options = {}) {
|
|
|
327
334
|
}
|
|
328
335
|
};
|
|
329
336
|
const count = await repo.countEntriesWithTerm(term.id);
|
|
330
|
-
const children = await repo.findChildren(term.id);
|
|
337
|
+
const children = await repo.findChildren(term.id, term.locale);
|
|
331
338
|
return {
|
|
332
339
|
success: true,
|
|
333
340
|
data: { term: {
|
|
@@ -428,7 +435,7 @@ async function handleTermUpdate(db, taxonomyName, termSlug, input, options = {})
|
|
|
428
435
|
parentId: newParentId,
|
|
429
436
|
data: input.description !== void 0 ? { description: input.description } : void 0
|
|
430
437
|
});
|
|
431
|
-
|
|
438
|
+
invalidateTermCache();
|
|
432
439
|
if (!updated) return {
|
|
433
440
|
success: false,
|
|
434
441
|
error: {
|
|
@@ -487,7 +494,7 @@ async function handleTermDelete(db, taxonomyName, termSlug, options = {}) {
|
|
|
487
494
|
message: "Failed to delete term"
|
|
488
495
|
}
|
|
489
496
|
};
|
|
490
|
-
|
|
497
|
+
invalidateTermCache();
|
|
491
498
|
return {
|
|
492
499
|
success: true,
|
|
493
500
|
data: { deleted: true }
|
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
import { a as __exportAll } from "./runner-BgmttQmD.mjs";
|
|
2
|
+
import { getRequestContext } from "./request-context.mjs";
|
|
3
|
+
import { a as resetTaxonomyNamesCache, o as isMissingTableError, r as getDb } from "./loader-aWkkc1_o.mjs";
|
|
4
|
+
import { d as invalidateTaxonomyObjectCache, f as isObjectCacheActive, n as cachedQuery, t as CacheNamespace } from "./object-cache-D51qOseS.mjs";
|
|
5
|
+
import { n as chunks, t as SQL_BATCH_SIZE } from "./chunks-ChGNDY8r.mjs";
|
|
6
|
+
import { i as setRequestCacheEntry, n as peekRequestCache, r as requestCached } from "./request-cache-CBFjCwSt.mjs";
|
|
7
|
+
import { i as resolveLocaleChain, r as resolveLocale } from "./resolve-DE71WcL9.mjs";
|
|
8
|
+
|
|
9
|
+
//#region src/taxonomies/index.ts
|
|
10
|
+
/**
|
|
11
|
+
* Runtime API for taxonomies.
|
|
12
|
+
*
|
|
13
|
+
* Public helpers are locale-aware. Because `content_taxonomies.taxonomy_id`
|
|
14
|
+
* stores a term translation_group, joins use `taxonomies.translation_group`
|
|
15
|
+
* and optionally filter the requested locale.
|
|
16
|
+
*/
|
|
17
|
+
var taxonomies_exports = /* @__PURE__ */ __exportAll({
|
|
18
|
+
getAllTermsForEntries: () => getAllTermsForEntries,
|
|
19
|
+
getEntriesByTerm: () => getEntriesByTerm,
|
|
20
|
+
getEntryTerms: () => getEntryTerms,
|
|
21
|
+
getTaxonomyDef: () => getTaxonomyDef,
|
|
22
|
+
getTaxonomyDefs: () => getTaxonomyDefs,
|
|
23
|
+
getTaxonomyTerms: () => getTaxonomyTerms,
|
|
24
|
+
getTerm: () => getTerm,
|
|
25
|
+
getTermsForEntries: () => getTermsForEntries,
|
|
26
|
+
invalidateTaxonomyDefsCache: () => invalidateTaxonomyDefsCache,
|
|
27
|
+
invalidateTermCache: () => invalidateTermCache,
|
|
28
|
+
primeFoldedEntryTerms: () => primeFoldedEntryTerms
|
|
29
|
+
});
|
|
30
|
+
function invalidateTermCache() {
|
|
31
|
+
invalidateTaxonomyObjectCache();
|
|
32
|
+
}
|
|
33
|
+
const TAXONOMY_DEFS_CACHE_KEY = Symbol.for("dineway:taxonomy-defs");
|
|
34
|
+
function getTaxonomyDefsHolder() {
|
|
35
|
+
const existing = Reflect.get(globalThis, TAXONOMY_DEFS_CACHE_KEY);
|
|
36
|
+
if (isTaxonomyDefsHolder(existing)) return existing;
|
|
37
|
+
const holder = {
|
|
38
|
+
version: 0,
|
|
39
|
+
cache: /* @__PURE__ */ new Map()
|
|
40
|
+
};
|
|
41
|
+
Reflect.set(globalThis, TAXONOMY_DEFS_CACHE_KEY, holder);
|
|
42
|
+
return holder;
|
|
43
|
+
}
|
|
44
|
+
function isTaxonomyDefsHolder(value) {
|
|
45
|
+
if (value && typeof value === "object" && "version" in value && "cache" in value) return typeof value.version === "number" && value.cache instanceof Map;
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
const taxonomyDefsHolder = getTaxonomyDefsHolder();
|
|
49
|
+
function invalidateTaxonomyDefsCache() {
|
|
50
|
+
taxonomyDefsHolder.version++;
|
|
51
|
+
taxonomyDefsHolder.cache.clear();
|
|
52
|
+
resetTaxonomyNamesCache();
|
|
53
|
+
invalidateTaxonomyObjectCache();
|
|
54
|
+
}
|
|
55
|
+
async function fetchTaxonomyDefs(locale) {
|
|
56
|
+
let query = (await getDb()).selectFrom("_dineway_taxonomy_defs").selectAll();
|
|
57
|
+
if (locale !== void 0) query = query.where("locale", "=", locale);
|
|
58
|
+
return (await query.execute()).map(rowToTaxonomyDef);
|
|
59
|
+
}
|
|
60
|
+
function loadTaxonomyDefs(localeKey, locale) {
|
|
61
|
+
if (getRequestContext()?.dbIsIsolated === true) return fetchTaxonomyDefs(locale);
|
|
62
|
+
const cached = taxonomyDefsHolder.cache.get(localeKey);
|
|
63
|
+
if (cached && cached.version === taxonomyDefsHolder.version) return cached.promise;
|
|
64
|
+
const version = taxonomyDefsHolder.version;
|
|
65
|
+
const promise = fetchTaxonomyDefs(locale).catch((error) => {
|
|
66
|
+
if (taxonomyDefsHolder.cache.get(localeKey)?.promise === promise) taxonomyDefsHolder.cache.delete(localeKey);
|
|
67
|
+
throw error;
|
|
68
|
+
});
|
|
69
|
+
taxonomyDefsHolder.cache.set(localeKey, {
|
|
70
|
+
version,
|
|
71
|
+
promise
|
|
72
|
+
});
|
|
73
|
+
return promise;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get every taxonomy definition for the active locale.
|
|
77
|
+
*/
|
|
78
|
+
async function getTaxonomyDefs(options = {}) {
|
|
79
|
+
const locale = resolveLocale(options.locale);
|
|
80
|
+
const localeKey = locale ?? "*";
|
|
81
|
+
return requestCached(`taxonomy-defs:${localeKey}`, async () => {
|
|
82
|
+
if (await isObjectCacheActive()) return cachedQuery({
|
|
83
|
+
namespace: CacheNamespace.TAXONOMIES,
|
|
84
|
+
key: `defs:${localeKey}`,
|
|
85
|
+
load: () => fetchTaxonomyDefs(locale)
|
|
86
|
+
});
|
|
87
|
+
return loadTaxonomyDefs(localeKey, locale);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Get a single taxonomy definition by name, following the locale fallback chain.
|
|
92
|
+
*/
|
|
93
|
+
async function getTaxonomyDef(name, options = {}) {
|
|
94
|
+
const chain = resolveLocaleChain(options.locale);
|
|
95
|
+
const allDefs = peekRequestCache(`taxonomy-defs:${resolveLocale(options.locale) ?? "*"}`);
|
|
96
|
+
if (allDefs) {
|
|
97
|
+
const defs = await allDefs;
|
|
98
|
+
if (chain.length === 0) return defs.find((def) => def.name === name) ?? null;
|
|
99
|
+
for (const locale of chain) {
|
|
100
|
+
const found = defs.find((def) => def.name === name && def.locale === locale);
|
|
101
|
+
if (found) return found;
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
return requestCached(`taxonomy-def:${name}:${chain.join(",")}`, async () => {
|
|
106
|
+
const db = await getDb();
|
|
107
|
+
if (chain.length === 0) {
|
|
108
|
+
const row = await db.selectFrom("_dineway_taxonomy_defs").selectAll().where("name", "=", name).orderBy("locale", "asc").executeTakeFirst();
|
|
109
|
+
return row ? rowToTaxonomyDef(row) : null;
|
|
110
|
+
}
|
|
111
|
+
for (const locale of chain) {
|
|
112
|
+
const row = await db.selectFrom("_dineway_taxonomy_defs").selectAll().where("name", "=", name).where("locale", "=", locale).executeTakeFirst();
|
|
113
|
+
if (row) return rowToTaxonomyDef(row);
|
|
114
|
+
}
|
|
115
|
+
return null;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Get all terms for a taxonomy in the active locale.
|
|
120
|
+
*/
|
|
121
|
+
async function getTaxonomyTerms(taxonomyName, options = {}) {
|
|
122
|
+
const locale = resolveLocale(options.locale);
|
|
123
|
+
const localeKey = locale ?? "*";
|
|
124
|
+
return requestCached(`taxonomy-terms:${taxonomyName}:${localeKey}`, () => cachedQuery({
|
|
125
|
+
namespace: CacheNamespace.TAXONOMIES,
|
|
126
|
+
key: `terms:${taxonomyName}:${localeKey}`,
|
|
127
|
+
load: async () => {
|
|
128
|
+
const db = await getDb();
|
|
129
|
+
const def = await getTaxonomyDef(taxonomyName, options);
|
|
130
|
+
if (!def) return [];
|
|
131
|
+
let termsQuery = db.selectFrom("taxonomies").selectAll().where("name", "=", taxonomyName).orderBy("label", "asc");
|
|
132
|
+
if (locale !== void 0) termsQuery = termsQuery.where("locale", "=", locale);
|
|
133
|
+
const rows = await termsQuery.execute();
|
|
134
|
+
const counts = await getTaxonomyTermCounts();
|
|
135
|
+
const flatTerms = rows.map((row) => ({
|
|
136
|
+
id: row.id,
|
|
137
|
+
name: row.name,
|
|
138
|
+
slug: row.slug,
|
|
139
|
+
label: row.label,
|
|
140
|
+
parent_id: row.parent_id,
|
|
141
|
+
data: row.data,
|
|
142
|
+
locale: row.locale,
|
|
143
|
+
translation_group: row.translation_group
|
|
144
|
+
}));
|
|
145
|
+
if (def.hierarchical) return buildTree(flatTerms, counts);
|
|
146
|
+
return flatTerms.map((term) => ({
|
|
147
|
+
id: term.id,
|
|
148
|
+
name: term.name,
|
|
149
|
+
slug: term.slug,
|
|
150
|
+
label: term.label,
|
|
151
|
+
description: term.data ? JSON.parse(term.data).description : void 0,
|
|
152
|
+
children: [],
|
|
153
|
+
count: counts.get(term.translation_group ?? term.id) ?? 0,
|
|
154
|
+
locale: term.locale,
|
|
155
|
+
translationGroup: term.translation_group
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
}));
|
|
159
|
+
}
|
|
160
|
+
function getTaxonomyTermCounts() {
|
|
161
|
+
return requestCached("taxonomy-term-counts", async () => {
|
|
162
|
+
const countsResult = await (await getDb()).selectFrom("content_taxonomies").select(["taxonomy_id"]).select((eb) => eb.fn.count("entry_id").as("count")).groupBy("taxonomy_id").execute();
|
|
163
|
+
const counts = /* @__PURE__ */ new Map();
|
|
164
|
+
for (const row of countsResult) counts.set(row.taxonomy_id, row.count);
|
|
165
|
+
return counts;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Get a single term by taxonomy and slug, following the locale fallback chain.
|
|
170
|
+
*/
|
|
171
|
+
async function getTerm(taxonomyName, slug, options = {}) {
|
|
172
|
+
const chain = resolveLocaleChain(options.locale);
|
|
173
|
+
return cachedQuery({
|
|
174
|
+
namespace: CacheNamespace.TAXONOMIES,
|
|
175
|
+
key: `term:${taxonomyName}:${slug}:${chain.join(",")}`,
|
|
176
|
+
load: async () => {
|
|
177
|
+
const db = await getDb();
|
|
178
|
+
const selectTerm = () => db.selectFrom("taxonomies").selectAll().where("name", "=", taxonomyName).where("slug", "=", slug);
|
|
179
|
+
let row;
|
|
180
|
+
if (chain.length === 0) row = await selectTerm().orderBy("locale", "asc").executeTakeFirst();
|
|
181
|
+
else {
|
|
182
|
+
row = void 0;
|
|
183
|
+
for (const locale of chain) {
|
|
184
|
+
row = await selectTerm().where("locale", "=", locale).executeTakeFirst();
|
|
185
|
+
if (row) break;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (!row) return null;
|
|
189
|
+
let childrenQuery = db.selectFrom("taxonomies").selectAll().where("parent_id", "=", row.translation_group ?? row.id).orderBy("label", "asc");
|
|
190
|
+
if (row.locale) childrenQuery = childrenQuery.where("locale", "=", row.locale);
|
|
191
|
+
const [countResult, childRows] = await Promise.all([db.selectFrom("content_taxonomies").select((eb) => eb.fn.count("entry_id").as("count")).where("taxonomy_id", "=", row.translation_group ?? row.id).executeTakeFirst(), childrenQuery.execute()]);
|
|
192
|
+
const count = countResult?.count ?? 0;
|
|
193
|
+
const children = childRows.map((child) => ({
|
|
194
|
+
id: child.id,
|
|
195
|
+
name: child.name,
|
|
196
|
+
slug: child.slug,
|
|
197
|
+
label: child.label,
|
|
198
|
+
parentId: child.parent_id ?? void 0,
|
|
199
|
+
children: [],
|
|
200
|
+
locale: child.locale,
|
|
201
|
+
translationGroup: child.translation_group
|
|
202
|
+
}));
|
|
203
|
+
return {
|
|
204
|
+
id: row.id,
|
|
205
|
+
name: row.name,
|
|
206
|
+
slug: row.slug,
|
|
207
|
+
label: row.label,
|
|
208
|
+
parentId: row.parent_id ?? void 0,
|
|
209
|
+
description: row.data ? JSON.parse(row.data).description : void 0,
|
|
210
|
+
children,
|
|
211
|
+
count,
|
|
212
|
+
locale: row.locale,
|
|
213
|
+
translationGroup: row.translation_group
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Get terms assigned to an entry, resolved into the active locale.
|
|
220
|
+
*/
|
|
221
|
+
function getEntryTerms(collection, entryId, taxonomyName, options = {}) {
|
|
222
|
+
const locale = resolveLocale(options.locale);
|
|
223
|
+
return requestCached(`terms:${collection}:${entryId}:${taxonomyName ?? "*"}:${locale ?? "*"}`, () => cachedQuery({
|
|
224
|
+
namespace: CacheNamespace.TAXONOMIES,
|
|
225
|
+
key: `entry-terms:${collection}:${entryId}:${taxonomyName ?? "*"}:${locale ?? "*"}`,
|
|
226
|
+
load: async () => {
|
|
227
|
+
let query = (await getDb()).selectFrom("content_taxonomies").innerJoin("taxonomies", "taxonomies.translation_group", "content_taxonomies.taxonomy_id").selectAll("taxonomies").where("content_taxonomies.collection", "=", collection).where("content_taxonomies.entry_id", "=", entryId);
|
|
228
|
+
if (taxonomyName) query = query.where("taxonomies.name", "=", taxonomyName);
|
|
229
|
+
if (locale !== void 0) query = query.where("taxonomies.locale", "=", locale);
|
|
230
|
+
return (await query.execute()).map((row) => ({
|
|
231
|
+
id: row.id,
|
|
232
|
+
name: row.name,
|
|
233
|
+
slug: row.slug,
|
|
234
|
+
label: row.label,
|
|
235
|
+
parentId: row.parent_id ?? void 0,
|
|
236
|
+
children: [],
|
|
237
|
+
locale: row.locale,
|
|
238
|
+
translationGroup: row.translation_group
|
|
239
|
+
}));
|
|
240
|
+
}
|
|
241
|
+
}));
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Get terms for multiple entries in one taxonomy.
|
|
245
|
+
*/
|
|
246
|
+
async function getTermsForEntries(collection, entryIds, taxonomyName, options = {}) {
|
|
247
|
+
const result = /* @__PURE__ */ new Map();
|
|
248
|
+
const uniqueIds = [...new Set(entryIds)];
|
|
249
|
+
for (const id of uniqueIds) result.set(id, []);
|
|
250
|
+
if (uniqueIds.length === 0) return result;
|
|
251
|
+
const locale = resolveLocale(options.locale);
|
|
252
|
+
const localeKey = locale ?? "*";
|
|
253
|
+
const missedIds = [];
|
|
254
|
+
const cacheReads = [];
|
|
255
|
+
for (const id of uniqueIds) {
|
|
256
|
+
const cached = peekRequestCache(`terms:${collection}:${id}:${taxonomyName}:${localeKey}`);
|
|
257
|
+
if (cached) cacheReads.push(cached.then((terms) => ({
|
|
258
|
+
id,
|
|
259
|
+
terms
|
|
260
|
+
}), () => ({
|
|
261
|
+
id,
|
|
262
|
+
miss: true
|
|
263
|
+
})));
|
|
264
|
+
else missedIds.push(id);
|
|
265
|
+
}
|
|
266
|
+
for (const read of await Promise.all(cacheReads)) {
|
|
267
|
+
if ("miss" in read) {
|
|
268
|
+
missedIds.push(read.id);
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
result.set(read.id, read.terms.map((term) => ({
|
|
272
|
+
...term,
|
|
273
|
+
children: [...term.children]
|
|
274
|
+
})));
|
|
275
|
+
}
|
|
276
|
+
if (missedIds.length === 0) return result;
|
|
277
|
+
const db = await getDb();
|
|
278
|
+
for (const chunk of chunks(missedIds, SQL_BATCH_SIZE)) {
|
|
279
|
+
let rows;
|
|
280
|
+
try {
|
|
281
|
+
let query = db.selectFrom("content_taxonomies").innerJoin("taxonomies", "taxonomies.translation_group", "content_taxonomies.taxonomy_id").select([
|
|
282
|
+
"content_taxonomies.entry_id",
|
|
283
|
+
"taxonomies.id",
|
|
284
|
+
"taxonomies.name",
|
|
285
|
+
"taxonomies.slug",
|
|
286
|
+
"taxonomies.label",
|
|
287
|
+
"taxonomies.parent_id",
|
|
288
|
+
"taxonomies.locale",
|
|
289
|
+
"taxonomies.translation_group"
|
|
290
|
+
]).where("content_taxonomies.collection", "=", collection).where("content_taxonomies.entry_id", "in", chunk).where("taxonomies.name", "=", taxonomyName).orderBy("taxonomies.label", "asc");
|
|
291
|
+
if (locale !== void 0) query = query.where("taxonomies.locale", "=", locale);
|
|
292
|
+
rows = await query.execute();
|
|
293
|
+
} catch (error) {
|
|
294
|
+
if (isMissingTableError(error)) return result;
|
|
295
|
+
throw error;
|
|
296
|
+
}
|
|
297
|
+
for (const row of rows) {
|
|
298
|
+
const term = {
|
|
299
|
+
id: row.id,
|
|
300
|
+
name: row.name,
|
|
301
|
+
slug: row.slug,
|
|
302
|
+
label: row.label,
|
|
303
|
+
parentId: row.parent_id ?? void 0,
|
|
304
|
+
children: [],
|
|
305
|
+
locale: row.locale,
|
|
306
|
+
translationGroup: row.translation_group
|
|
307
|
+
};
|
|
308
|
+
const terms = result.get(row.entry_id);
|
|
309
|
+
if (terms) terms.push(term);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return result;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Batch-fetch terms for multiple entries across all taxonomies.
|
|
316
|
+
*/
|
|
317
|
+
async function getAllTermsForEntries(collection, entryIds, options = {}) {
|
|
318
|
+
const result = /* @__PURE__ */ new Map();
|
|
319
|
+
const uniqueIds = [...new Set(entryIds)];
|
|
320
|
+
for (const id of uniqueIds) result.set(id, {});
|
|
321
|
+
if (uniqueIds.length === 0) return result;
|
|
322
|
+
const db = await getDb();
|
|
323
|
+
const locale = resolveLocale(options.locale);
|
|
324
|
+
const applicableTaxonomyNames = await getCollectionTaxonomyNames(collection, { locale });
|
|
325
|
+
for (const chunk of chunks(uniqueIds, SQL_BATCH_SIZE)) {
|
|
326
|
+
let rows;
|
|
327
|
+
try {
|
|
328
|
+
let query = db.selectFrom("content_taxonomies").innerJoin("taxonomies", "taxonomies.translation_group", "content_taxonomies.taxonomy_id").select([
|
|
329
|
+
"content_taxonomies.entry_id",
|
|
330
|
+
"taxonomies.id",
|
|
331
|
+
"taxonomies.name",
|
|
332
|
+
"taxonomies.slug",
|
|
333
|
+
"taxonomies.label",
|
|
334
|
+
"taxonomies.parent_id",
|
|
335
|
+
"taxonomies.locale",
|
|
336
|
+
"taxonomies.translation_group"
|
|
337
|
+
]).where("content_taxonomies.collection", "=", collection).where("content_taxonomies.entry_id", "in", chunk).orderBy("taxonomies.label", "asc");
|
|
338
|
+
if (locale !== void 0) query = query.where("taxonomies.locale", "=", locale);
|
|
339
|
+
rows = await query.execute();
|
|
340
|
+
} catch (error) {
|
|
341
|
+
if (isMissingTableError(error)) {
|
|
342
|
+
for (const id of uniqueIds) primeEntryTermsCache(collection, id, {}, applicableTaxonomyNames, locale);
|
|
343
|
+
return result;
|
|
344
|
+
}
|
|
345
|
+
throw error;
|
|
346
|
+
}
|
|
347
|
+
for (const row of rows) {
|
|
348
|
+
const term = {
|
|
349
|
+
id: row.id,
|
|
350
|
+
name: row.name,
|
|
351
|
+
slug: row.slug,
|
|
352
|
+
label: row.label,
|
|
353
|
+
parentId: row.parent_id ?? void 0,
|
|
354
|
+
children: [],
|
|
355
|
+
locale: row.locale,
|
|
356
|
+
translationGroup: row.translation_group
|
|
357
|
+
};
|
|
358
|
+
const byTaxonomy = result.get(row.entry_id);
|
|
359
|
+
if (!byTaxonomy) continue;
|
|
360
|
+
const existing = byTaxonomy[row.name];
|
|
361
|
+
if (existing) existing.push(term);
|
|
362
|
+
else byTaxonomy[row.name] = [term];
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
for (const [entryId, byTaxonomy] of result) primeEntryTermsCache(collection, entryId, byTaxonomy, applicableTaxonomyNames, locale);
|
|
366
|
+
return result;
|
|
367
|
+
}
|
|
368
|
+
async function getCollectionTaxonomyNames(collection, options) {
|
|
369
|
+
try {
|
|
370
|
+
return (await getTaxonomyDefs(options)).filter((def) => def.collections.includes(collection)).map((def) => def.name);
|
|
371
|
+
} catch (error) {
|
|
372
|
+
if (isMissingTableError(error)) return [];
|
|
373
|
+
throw error;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
function primeEntryTermsCache(collection, entryId, byTaxonomy, applicableTaxonomyNames, locale) {
|
|
377
|
+
const localeKey = locale ?? "*";
|
|
378
|
+
for (const name of applicableTaxonomyNames) setRequestCacheEntry(`terms:${collection}:${entryId}:${name}:${localeKey}`, byTaxonomy[name] ?? []);
|
|
379
|
+
for (const [name, terms] of Object.entries(byTaxonomy)) setRequestCacheEntry(`terms:${collection}:${entryId}:${name}:${localeKey}`, terms);
|
|
380
|
+
setRequestCacheEntry(`terms:${collection}:${entryId}:*:${localeKey}`, Object.values(byTaxonomy).flat());
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Prime the per-entry request cache from terms folded into the content query.
|
|
384
|
+
* Seeds the wildcard key and one key per taxonomy present on the entry without
|
|
385
|
+
* adding a taxonomy-definition lookup to the fast path.
|
|
386
|
+
*/
|
|
387
|
+
function primeFoldedEntryTerms(collection, perEntry, options = {}) {
|
|
388
|
+
if (perEntry.length === 0) return;
|
|
389
|
+
const locale = resolveLocale(options.locale);
|
|
390
|
+
for (const { entryId, byTaxonomy } of perEntry) primeEntryTermsCache(collection, entryId, byTaxonomy, [], locale);
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Get entries by term.
|
|
394
|
+
*/
|
|
395
|
+
async function getEntriesByTerm(collection, taxonomyName, termSlug, options = {}) {
|
|
396
|
+
const { getDinewayCollection } = await import("./query-DEv5x6yB.mjs").then((n) => n.o);
|
|
397
|
+
const queryOptions = { where: { [taxonomyName]: termSlug } };
|
|
398
|
+
if (options.locale !== void 0) queryOptions.locale = options.locale;
|
|
399
|
+
const { entries } = await getDinewayCollection(collection, queryOptions);
|
|
400
|
+
return entries;
|
|
401
|
+
}
|
|
402
|
+
function rowToTaxonomyDef(row) {
|
|
403
|
+
return {
|
|
404
|
+
id: row.id,
|
|
405
|
+
name: row.name,
|
|
406
|
+
label: row.label,
|
|
407
|
+
labelSingular: row.label_singular ?? void 0,
|
|
408
|
+
hierarchical: row.hierarchical === 1,
|
|
409
|
+
collections: row.collections ? JSON.parse(row.collections) : [],
|
|
410
|
+
locale: row.locale,
|
|
411
|
+
translationGroup: row.translation_group
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
function buildTree(flatTerms, counts) {
|
|
415
|
+
const byLocaleGroup = /* @__PURE__ */ new Map();
|
|
416
|
+
const nodes = [];
|
|
417
|
+
const roots = [];
|
|
418
|
+
for (const term of flatTerms) {
|
|
419
|
+
const node = {
|
|
420
|
+
id: term.id,
|
|
421
|
+
name: term.name,
|
|
422
|
+
slug: term.slug,
|
|
423
|
+
label: term.label,
|
|
424
|
+
parentId: term.parent_id ?? void 0,
|
|
425
|
+
description: term.data ? JSON.parse(term.data).description : void 0,
|
|
426
|
+
children: [],
|
|
427
|
+
count: counts.get(term.translation_group ?? term.id) ?? 0,
|
|
428
|
+
locale: term.locale,
|
|
429
|
+
translationGroup: term.translation_group
|
|
430
|
+
};
|
|
431
|
+
byLocaleGroup.set(`${term.locale}::${term.translation_group ?? term.id}`, node);
|
|
432
|
+
nodes.push(node);
|
|
433
|
+
}
|
|
434
|
+
for (const node of nodes) {
|
|
435
|
+
const parent = node.parentId ? byLocaleGroup.get(`${node.locale}::${node.parentId}`) : void 0;
|
|
436
|
+
if (parent) parent.children.push(node);
|
|
437
|
+
else roots.push(node);
|
|
438
|
+
}
|
|
439
|
+
return roots;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
//#endregion
|
|
443
|
+
export { getTaxonomyTerms as a, invalidateTaxonomyDefsCache as c, getTaxonomyDefs as i, invalidateTermCache as l, getEntryTerms as n, getTerm as o, getTaxonomyDef as r, getTermsForEntries as s, getEntriesByTerm as t, taxonomies_exports as u };
|