dineway 0.1.14 → 0.1.16
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-events-B4wp7CrU.mjs → activity-events-DbqJBNaY.mjs} +1 -1
- package/dist/{allowed-origins-C1AKK9AT.mjs → allowed-origins-D85wzUp6.mjs} +1 -1
- package/dist/api/route-utils.d.mts +10 -10
- package/dist/api/route-utils.mjs +15 -15
- package/dist/api/schemas/index.d.mts +2 -2
- package/dist/api/schemas/index.mjs +4 -4
- package/dist/{api-BTbpzvBq.mjs → api-B5xMY72-.mjs} +96 -17
- package/dist/{api-tokens-D7UjLbdt.mjs → api-tokens-CMmUPFae.mjs} +1 -1
- package/dist/{apply-Bm5QgdrE.mjs → apply-CGVHi2r7.mjs} +165 -85
- package/dist/astro/index.d.mts +11 -11
- package/dist/astro/index.mjs +3 -3
- package/dist/astro/middleware/auth.d.mts +10 -10
- package/dist/astro/middleware/auth.mjs +5 -5
- package/dist/astro/middleware/redirect.mjs +6 -6
- package/dist/astro/middleware/request-context.mjs +4 -4
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware.mjs +119 -77
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +5 -5
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +5 -5
- 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 +19 -19
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +12 -12
- package/dist/astro/routes/api/admin/bylines/index.mjs +12 -12
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +13 -13
- package/dist/astro/routes/api/admin/comments/_id_.mjs +6 -6
- package/dist/astro/routes/api/admin/comments/bulk.mjs +10 -10
- package/dist/astro/routes/api/admin/comments/counts.mjs +6 -6
- package/dist/astro/routes/api/admin/comments/index.mjs +10 -10
- package/dist/astro/routes/api/admin/context/_id_/history.mjs +26 -26
- package/dist/astro/routes/api/admin/context/_id_/index.mjs +26 -26
- package/dist/astro/routes/api/admin/context/_id_/review.mjs +30 -30
- package/dist/astro/routes/api/admin/context/_id_/supersede.mjs +30 -30
- package/dist/astro/routes/api/admin/context/diff.mjs +29 -29
- package/dist/astro/routes/api/admin/context/index.mjs +30 -30
- package/dist/astro/routes/api/admin/context/stale.mjs +29 -29
- package/dist/astro/routes/api/admin/hitl-requests/_id_/index.mjs +26 -26
- package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.mjs +29 -29
- package/dist/astro/routes/api/admin/hitl-requests/index.mjs +29 -29
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +27 -27
- 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 +47 -47
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +47 -47
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +40 -40
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +46 -46
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +46 -46
- package/dist/astro/routes/api/admin/plugins/index.mjs +40 -40
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +2 -2
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +40 -40
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +46 -46
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +40 -40
- package/dist/astro/routes/api/admin/plugins/updates.mjs +40 -40
- package/dist/astro/routes/api/admin/review-requests/_id_/index.mjs +6 -6
- package/dist/astro/routes/api/admin/review-requests/_id_/resolve.mjs +29 -29
- package/dist/astro/routes/api/admin/review-requests/index.mjs +10 -10
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +40 -40
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +2 -2
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +40 -40
- package/dist/astro/routes/api/admin/users/_id_/disable.mjs +2 -2
- package/dist/astro/routes/api/admin/users/_id_/enable.mjs +1 -1
- package/dist/astro/routes/api/admin/users/_id_/index.mjs +6 -6
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +3 -3
- package/dist/astro/routes/api/admin/users/index.mjs +5 -5
- package/dist/astro/routes/api/auth/dev-bypass.mjs +5 -5
- package/dist/astro/routes/api/auth/invite/accept.mjs +1 -1
- package/dist/astro/routes/api/auth/invite/complete.mjs +10 -10
- package/dist/astro/routes/api/auth/invite/index.mjs +7 -7
- package/dist/astro/routes/api/auth/invite/register-options.mjs +9 -9
- package/dist/astro/routes/api/auth/logout.mjs +2 -2
- package/dist/astro/routes/api/auth/magic-link/send.mjs +9 -9
- package/dist/astro/routes/api/auth/magic-link/verify.mjs +2 -2
- package/dist/astro/routes/api/auth/me.mjs +5 -5
- package/dist/astro/routes/api/auth/mode.mjs +1 -1
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +2 -2
- package/dist/astro/routes/api/auth/oauth/_provider_.mjs +2 -2
- package/dist/astro/routes/api/auth/passkey/_id_.mjs +5 -5
- package/dist/astro/routes/api/auth/passkey/index.mjs +1 -1
- package/dist/astro/routes/api/auth/passkey/options.mjs +11 -11
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +9 -9
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +10 -10
- package/dist/astro/routes/api/auth/passkey/verify.mjs +10 -10
- package/dist/astro/routes/api/auth/signup/complete.mjs +10 -10
- package/dist/astro/routes/api/auth/signup/request.mjs +9 -9
- package/dist/astro/routes/api/auth/signup/verify.mjs +1 -1
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +14 -14
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +6 -6
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +6 -6
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +7 -7
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +12 -12
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +28 -28
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +6 -6
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +10 -10
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +13 -13
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +6 -6
- package/dist/astro/routes/api/content/_collection_/_id_.mjs +10 -10
- package/dist/astro/routes/api/content/_collection_/index.mjs +10 -10
- package/dist/astro/routes/api/content/_collection_/trash.mjs +6 -6
- package/dist/astro/routes/api/dashboard.mjs +9 -9
- 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 +10 -10
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +3 -3
- package/dist/astro/routes/api/import/wordpress/execute.mjs +29 -29
- package/dist/astro/routes/api/import/wordpress/media.mjs +7 -7
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +33 -33
- package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.d.mts +48 -0
- package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.mjs +124 -0
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +32 -145
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +10 -10
- package/dist/astro/routes/api/import/wordpress-plugin/callback.mjs +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +33 -33
- package/dist/astro/routes/api/manifest.mjs +4 -4
- package/dist/astro/routes/api/mcp.mjs +277 -91
- package/dist/astro/routes/api/media/_id_/confirm.mjs +6 -6
- package/dist/astro/routes/api/media/_id_.mjs +6 -6
- 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 -13
- package/dist/astro/routes/api/media.mjs +18 -18
- package/dist/astro/routes/api/menus/_name_/items.mjs +45 -36
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +34 -31
- package/dist/astro/routes/api/menus/_name_/translations.d.mts +8 -0
- package/dist/astro/routes/api/menus/_name_/translations.mjs +111 -0
- package/dist/astro/routes/api/menus/_name_.mjs +47 -36
- package/dist/astro/routes/api/menus/index.mjs +34 -32
- 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 +3 -3
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +3 -3
- package/dist/astro/routes/api/redirects/404s/index.mjs +12 -12
- package/dist/astro/routes/api/redirects/404s/summary.mjs +12 -12
- package/dist/astro/routes/api/redirects/_id_.mjs +31 -31
- package/dist/astro/routes/api/redirects/index.mjs +31 -31
- 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 +41 -41
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +41 -41
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +41 -41
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +41 -41
- package/dist/astro/routes/api/schema/collections/index.mjs +41 -41
- package/dist/astro/routes/api/schema/index.mjs +6 -6
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +40 -40
- package/dist/astro/routes/api/schema/orphans/index.mjs +40 -40
- package/dist/astro/routes/api/search/enable.mjs +12 -12
- package/dist/astro/routes/api/search/index.mjs +11 -11
- package/dist/astro/routes/api/search/rebuild.mjs +12 -12
- package/dist/astro/routes/api/search/stats.mjs +8 -8
- package/dist/astro/routes/api/search/suggest.mjs +11 -11
- package/dist/astro/routes/api/sections/_slug_.mjs +30 -30
- package/dist/astro/routes/api/sections/index.mjs +30 -30
- package/dist/astro/routes/api/settings/email.mjs +4 -4
- package/dist/astro/routes/api/settings.mjs +30 -30
- package/dist/astro/routes/api/setup/admin-verify.mjs +12 -12
- package/dist/astro/routes/api/setup/admin.mjs +10 -10
- package/dist/astro/routes/api/setup/dev-bypass.mjs +25 -25
- package/dist/astro/routes/api/setup/dev-reset.mjs +2 -2
- package/dist/astro/routes/api/setup/index.mjs +26 -26
- package/dist/astro/routes/api/setup/status.mjs +3 -3
- package/dist/astro/routes/api/snapshot.mjs +7 -7
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.d.mts +8 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +131 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +49 -41
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +36 -34
- package/dist/astro/routes/api/taxonomies/index.mjs +36 -34
- package/dist/astro/routes/api/themes/preview.mjs +6 -6
- 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 +29 -29
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +30 -30
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +30 -30
- package/dist/astro/routes/api/widget-areas/_name_.mjs +28 -28
- package/dist/astro/routes/api/widget-areas/index.mjs +30 -30
- package/dist/astro/routes/api/widget-components.mjs +2 -2
- package/dist/astro/routes/robots.txt.mjs +9 -9
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +9 -9
- package/dist/astro/routes/sitemap.xml.mjs +10 -10
- package/dist/astro/types.d.mts +16 -14
- package/dist/auth/providers/github.d.mts +1 -1
- package/dist/auth/providers/google.d.mts +1 -1
- package/dist/{auth-control-guard-DOZ3UCsP.mjs → auth-control-guard--r6LlNkX.mjs} +1 -1
- package/dist/{authorize-BAdbMCwC.mjs → authorize-wQDmXQJ1.mjs} +1 -1
- package/dist/{briefing-MVYe_Uyf.mjs → briefing-4k6R0KAr.mjs} +7 -7
- package/dist/{briefing-rty4O-wa.mjs → briefing-DM7e2yd3.mjs} +1 -1
- package/dist/{byline-naZxOPSa.mjs → byline-BxAf79s1.mjs} +4 -4
- package/dist/{bylines-DxXzWML_.d.mts → bylines-DE9bfDur.d.mts} +75 -13
- package/dist/{bylines-C4LIBOOO.mjs → bylines-DhCnhR70.mjs} +3 -3
- package/dist/{cache-DEbQ13c9.mjs → cache-inQvbrP5.mjs} +1 -1
- package/dist/{chunks-D_jVet6z.mjs → chunks-vkrCT4Ta.mjs} +7 -1
- package/dist/cli/index.mjs +357 -104
- package/dist/client/external-auth-headers.d.mts +1 -1
- package/dist/client/index.d.mts +1 -1
- package/dist/client/index.mjs +1 -1
- package/dist/{comment-DFO-gWDH.mjs → comment-BmJXz3lc.mjs} +1 -1
- package/dist/{comments--BsZ9pqA.mjs → comments-BW1qFiTa.mjs} +1 -1
- package/dist/{content-CyLkb-qH.mjs → content-DvpMad_N.mjs} +4 -3
- package/dist/{context-DNfcm853.mjs → context-CGbVhAmd.mjs} +2 -2
- package/dist/{context-CNIkMzot.mjs → context-CT44ux1O.mjs} +10 -10
- package/dist/{context-route-helpers-MurhoxWF.mjs → context-route-helpers-CcvSXJtQ.mjs} +1 -1
- package/dist/{dashboard-DqnYU8EU.mjs → dashboard-6gH7SlPM.mjs} +9 -18
- package/dist/database/instrumentation.d.mts +1 -1
- package/dist/database/instrumentation.mjs +14 -4
- package/dist/db/index.d.mts +3 -3
- package/dist/db/index.mjs +2 -2
- 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-BGEH5jfn.mjs → device-flow-DaTBhALC.mjs} +5 -5
- package/dist/{dialect-helpers-DhTzaUxP.mjs → dialect-helpers-TkdbkFad.mjs} +7 -1
- package/dist/{fts-manager-B1pTNEG_.mjs → fts-manager-D7KVeBmg.mjs} +1 -1
- package/dist/{hitl-requests-ChT32Ilo.mjs → hitl-requests-CUnch_4e.mjs} +2 -2
- package/dist/{hitl-route-helpers-CSit54Ru.mjs → hitl-route-helpers-DcUCm57p.mjs} +4 -4
- package/dist/{import-BHRLhXAn.mjs → import-BVqG28WP.mjs} +3 -3
- package/dist/{import-CNcKWTbp.mjs → import-DE2ziezs.mjs} +2 -2
- package/dist/{index-CYfhYgXd.d.mts → index-DpMWSamU.d.mts} +2 -2
- package/dist/{index-EUAWaIxW.d.mts → index-JzJUzE4o.d.mts} +47 -47
- package/dist/index.d.mts +16 -16
- package/dist/index.mjs +65 -65
- package/dist/{jsonld-D2gUY4kA.d.mts → jsonld-BjsoTL5m.d.mts} +2 -2
- package/dist/{loader-PZnPxFLc.mjs → loader-CQFxFOt1.mjs} +2 -2
- package/dist/media/index.d.mts +2 -2
- package/dist/media/index.mjs +2 -2
- package/dist/media/local-runtime.d.mts +12 -12
- package/dist/media/local-runtime.mjs +3 -3
- package/dist/{media-_7Fxdu45.mjs → media-Cg4zc9fq.mjs} +12 -9
- package/dist/media-allowlist-eS3AZ2L_.mjs +26 -0
- package/dist/{menus-DYW_UHjv.mjs → menus-BDW1yIdj.mjs} +80 -87
- package/dist/menus-CwI7DQJ5.mjs +569 -0
- package/dist/mime-DJOFDGux.mjs +35 -0
- package/dist/{oauth-authorization-DxGjiWKL.mjs → oauth-authorization-DcYRiDfi.mjs} +5 -5
- package/dist/{oauth-clients-DxO_NO7k.mjs → oauth-clients-CgKFA-VH.mjs} +2 -2
- package/dist/page/index.d.mts +2 -2
- package/dist/page/index.mjs +1 -1
- package/dist/{parse-C9106ehs.mjs → parse-BBfZRZYb.mjs} +1 -1
- package/dist/{placeholder-Bh1dfUOd.d.mts → placeholder-DKMMLt42.d.mts} +1 -1
- package/dist/plugins/adapt-sandbox-entry.d.mts +10 -10
- package/dist/plugins/adapt-sandbox-entry.mjs +1 -1
- package/dist/{plugins-D7-ILNib.mjs → plugins-DKceDtUM.mjs} +9 -7
- package/dist/{preview-DvYRU-Oy.mjs → preview-CIDYFBzd.mjs} +2 -2
- package/dist/{provider-loader-BiQ6lNmf.d.mts → provider-loader-D0F6E2qv.d.mts} +1 -1
- package/dist/{query-CsbOywSY.mjs → query-BtuwuZRd.mjs} +3 -3
- package/dist/{query-B9BO5goQ.mjs → query-CWPxZjGM.mjs} +11 -11
- package/dist/{rate-limit-DmVTHI5v.mjs → rate-limit-GN64_Jaw.mjs} +5 -5
- package/dist/{redirect-CGl64yOX.mjs → redirect-BHo9--Jz.mjs} +3 -3
- package/dist/{redirects-Cgi_cZfN.mjs → redirects-Bc40BgxA.mjs} +4 -4
- package/dist/{redirects-lrlmYXVE.mjs → redirects-xVDvj_yQ.mjs} +68 -15
- package/dist/{registry-C-_hxLqa.mjs → registry-DumDzFDn.mjs} +5 -5
- package/dist/{request-cache-DHMRr2Lf.mjs → request-cache-DmVyQUBh.mjs} +5 -1
- package/dist/request-context.d.mts +19 -1
- package/dist/request-context.mjs +15 -3
- package/dist/{request-meta-DixlNKKa.mjs → request-meta-BVx9KkL-.mjs} +1 -1
- package/dist/{review-requests-C2DIHwlJ.mjs → review-requests-BYuoyse0.mjs} +1 -1
- package/dist/{review-requests-DIyjw-K_.mjs → review-requests-vCw7_3DS.mjs} +1 -1
- package/dist/{runner-BU6Lo1ZS.d.mts → runner-CHR_W79l.d.mts} +1 -1
- package/dist/{runner-DWZm2KQm.mjs → runner-lqEiJbO-.mjs} +496 -181
- package/dist/{runtime-QuuFSlc6.d.mts → runtime-DY_XmE9Y.d.mts} +15 -14
- package/dist/runtime.d.mts +11 -11
- package/dist/runtime.mjs +5 -5
- package/dist/{schema-BECjUhP8.mjs → schema-D1z41cq_.mjs} +1 -1
- package/dist/{search-DqTHQqtV.mjs → search-CPcQGTHW.mjs} +2 -2
- package/dist/{secrets-CkoJ9zN0.mjs → secrets-AFKoqUXj.mjs} +2 -2
- package/dist/{sections-B61OxnfB.mjs → sections-B9RYyf3I.mjs} +2 -2
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +19 -19
- package/dist/seo/index.d.mts +1 -1
- package/dist/{seo-CUQctrog.mjs → seo-BPz1KkCq.mjs} +1 -1
- package/dist/{service-CyOsm0R6.mjs → service-DgiH1Yud.mjs} +2 -2
- package/dist/{settings-Dzgswvg4.mjs → settings-BGCo_c2y.mjs} +1 -1
- package/dist/{settings-DGtLLSaz.mjs → settings-qPzY2KIF.mjs} +4 -4
- package/dist/{setup-complete-BlcGZRYm.mjs → setup-complete-4EiBS1E5.mjs} +1 -1
- package/dist/{site-activity-B8FjLIVh.mjs → site-activity-lsCX_cqp.mjs} +1 -1
- package/dist/{site-context-WBxoD99D.mjs → site-context-DHRIU6x9.mjs} +58 -34
- package/dist/{site-url-BP7k7OCe.mjs → site-url-oyqzZtoL.mjs} +1 -1
- package/dist/storage/local.d.mts +1 -1
- package/dist/storage/local.mjs +1 -1
- package/dist/storage/s3.d.mts +1 -1
- package/dist/storage/s3.mjs +1 -1
- package/dist/taxonomies-BWmxbumf.mjs +350 -0
- package/dist/taxonomies-aQXvYVPm.mjs +507 -0
- package/dist/taxonomy-DI-0HgKe.mjs +217 -0
- package/dist/{tokens-BOJw-D9F.mjs → tokens-DB4dASZl.mjs} +1 -1
- package/dist/{types-DZPw8Rru.d.mts → types-CYBaBvtm.d.mts} +9 -0
- package/dist/{types-C0mmVRJN.d.mts → types-CsnHvu4J.d.mts} +1 -0
- package/dist/{types-Bs6lTBBW.mjs → types-D1DjBFA9.mjs} +8 -2
- package/dist/{types-Q616b2Hn.d.mts → types-DS5PYew4.d.mts} +1 -1
- package/dist/ui/server-runtime.d.mts +7 -7
- package/dist/ui/server-runtime.mjs +19 -19
- package/dist/{user-CcXq-zoL.mjs → user-2aI21yV1.mjs} +1 -1
- package/dist/{utils-C0ONdBul.mjs → utils-BJF19gfk.mjs} +1 -1
- package/dist/{validate-C7TzfamJ.mjs → validate-B8ZvLeOE.mjs} +12 -8
- package/dist/{validate-BwmQEbu8.d.mts → validate-BQ24E8rK.d.mts} +21 -4
- package/dist/version-HdNieFOD.mjs +6 -0
- package/dist/{widgets-B7DRpZvy.mjs → widgets-Cce2-2fM.mjs} +2 -2
- package/dist/{wordpress-slugs-CnporCYH.mjs → wordpress-slugs-C4EhE6fo.mjs} +1 -1
- package/dist/{zod-generator-DBVP8D0P.mjs → zod-generator-BKhtHT3e.mjs} +3 -3
- package/package.json +5 -5
- package/dist/menus-DS3_5nWY.mjs +0 -312
- package/dist/taxonomies-D2aZGuns.mjs +0 -270
- package/dist/taxonomies-z6Lz91BC.mjs +0 -355
- package/dist/taxonomy-D5cbhc8u.mjs +0 -165
- package/dist/version-B3z9Tv-J.mjs +0 -6
- /package/dist/{adapters-DuLQZhRY.d.mts → adapters-BPzUiHHm.d.mts} +0 -0
- /package/dist/{api-tokens-CPjC3zf8.mjs → api-tokens-B7fvbHM2.mjs} +0 -0
- /package/dist/{base64-Cz-aU0X1.mjs → base64-C1Q9yr0B.mjs} +0 -0
- /package/dist/{challenge-store-DDTbisbf.mjs → challenge-store-anhwVER0.mjs} +0 -0
- /package/dist/{components-BPknylYg.mjs → components-BQiBW_Ji.mjs} +0 -0
- /package/dist/{config-CAMFxGaV.mjs → config-XW5tMrH8.mjs} +0 -0
- /package/dist/{context-types-C-LwdAxx.mjs → context-types-DuiyY6xF.mjs} +0 -0
- /package/dist/{cron-CKxvBrRT.mjs → cron-fV9baRVc.mjs} +0 -0
- /package/dist/{db-errors-DyZkswzF.mjs → db-errors-BnUbfGsK.mjs} +0 -0
- /package/dist/{default-D4ngTpW8.mjs → default-2JDm1rj_.mjs} +0 -0
- /package/dist/{email-console-CuefUXfX.mjs → email-console-_pTim1bU.mjs} +0 -0
- /package/dist/{entity-aliases-C0v-yNET.mjs → entity-aliases-PJV8IxDq.mjs} +0 -0
- /package/dist/{error-BMUPwxgx.mjs → error-Dyf9fGZE.mjs} +0 -0
- /package/dist/{escape-BRVaw1Ai.mjs → escape-Bn168-uP.mjs} +0 -0
- /package/dist/{experimental-workflows-C9X7yblQ.mjs → experimental-workflows-CSRjuEwS.mjs} +0 -0
- /package/dist/{hash-CDX7M0ze.mjs → hash-V8oZo1W2.mjs} +0 -0
- /package/dist/{load-B2XtDw__.mjs → load-BvyvS_76.mjs} +0 -0
- /package/dist/{manifest-schema-CgFJAp0H.mjs → manifest-schema-CU0XL_ZK.mjs} +0 -0
- /package/dist/{mode-DUhxwUhv.mjs → mode-DWw2di1I.mjs} +0 -0
- /package/dist/{normalize-C49G_o1k.mjs → normalize-9GU-bv_T.mjs} +0 -0
- /package/dist/{oauth-state-store-C5UFhzwD.mjs → oauth-state-store-DhifLitQ.mjs} +0 -0
- /package/dist/{oauth-user-lookup-Bi0ek9eM.mjs → oauth-user-lookup-nyXQ2_6Q.mjs} +0 -0
- /package/dist/{options-z8VVg1Ll.mjs → options-BF11H_FD.mjs} +0 -0
- /package/dist/{passkey-config-BRSZx4pW.mjs → passkey-config-DZOjt0Hd.mjs} +0 -0
- /package/dist/{patterns-K0DLqWir.mjs → patterns-CW4n2PQs.mjs} +0 -0
- /package/dist/{placeholder-C2P5fKa4.mjs → placeholder-BJPmhjHP.mjs} +0 -0
- /package/dist/{provider-loader-C21b9OpH.mjs → provider-loader-Decn0Ktc.mjs} +0 -0
- /package/dist/{public-url-Cun8N3NU.mjs → public-url-5fFLJhjh.mjs} +0 -0
- /package/dist/{redirect-COZy-3iY.mjs → redirect-C077gVTf.mjs} +0 -0
- /package/dist/{seo-C007Luwn.mjs → seo-DJoop90w.mjs} +0 -0
- /package/dist/{seo-contributions-B1fWCnqY.mjs → seo-contributions-CQzUjJKY.mjs} +0 -0
- /package/dist/{setup-nonce-BpmLXAuu.mjs → setup-nonce-DN6BHIlP.mjs} +0 -0
- /package/dist/{sidecar-client-B1C6Cf80.mjs → sidecar-client-Dta0AELf.mjs} +0 -0
- /package/dist/{slugify-PDTDtMXp.mjs → slugify-BzGxlOFx.mjs} +0 -0
- /package/dist/{ssrf-DDwRxF6B.mjs → ssrf-BOSGjXxb.mjs} +0 -0
- /package/dist/{transaction-x2tJQ-A1.mjs → transaction-qfqpPVpu.mjs} +0 -0
- /package/dist/{transport-CSyZ02_i.mjs → transport-B3jxvfio.mjs} +0 -0
- /package/dist/{transport-BXe1AM79.d.mts → transport-CyOHECBA.d.mts} +0 -0
- /package/dist/{trusted-proxy-BbaZfkT9.mjs → trusted-proxy-8N8sX1D1.mjs} +0 -0
- /package/dist/{types-DJlpx5Ay.d.mts → types-6N-00csp.d.mts} +0 -0
- /package/dist/{types-BFmjniC2.d.mts → types-B45uSz1j.d.mts} +0 -0
- /package/dist/{types-B7kpsMJ3.d.mts → types-BDm7Ipoq.d.mts} +0 -0
- /package/dist/{types-0Vr68fc2.d.mts → types-BeYn-Yf0.d.mts} +0 -0
- /package/dist/{types-OPs5Q_sX.d.mts → types-D_wGrwiY.d.mts} +0 -0
- /package/dist/{types-DL7Y8D_t.mjs → types-Dz2EKzsX.mjs} +0 -0
- /package/dist/{types-fAInWQDO.mjs → types-iNqHe2-V.mjs} +0 -0
- /package/dist/{url-DNjT2abR.mjs → url-DOS4RGym.mjs} +0 -0
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
import { t as __exportAll } from "./chunk-ClPoSABd.mjs";
|
|
2
|
+
import { t as TaxonomyRepository } from "./taxonomy-DI-0HgKe.mjs";
|
|
3
|
+
import { c as invalidateTermCache } from "./taxonomies-BWmxbumf.mjs";
|
|
4
|
+
import { ulid } from "ulidx";
|
|
5
|
+
|
|
6
|
+
//#region src/api/handlers/taxonomies.ts
|
|
7
|
+
var taxonomies_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
+
handleTaxonomyCreate: () => handleTaxonomyCreate,
|
|
9
|
+
handleTaxonomyList: () => handleTaxonomyList,
|
|
10
|
+
handleTermCreate: () => handleTermCreate,
|
|
11
|
+
handleTermDelete: () => handleTermDelete,
|
|
12
|
+
handleTermGet: () => handleTermGet,
|
|
13
|
+
handleTermList: () => handleTermList,
|
|
14
|
+
handleTermTranslations: () => handleTermTranslations,
|
|
15
|
+
handleTermUpdate: () => handleTermUpdate
|
|
16
|
+
});
|
|
17
|
+
const NAME_PATTERN = /^[a-z][a-z0-9_]*$/;
|
|
18
|
+
/**
|
|
19
|
+
* Build tree structure from flat terms
|
|
20
|
+
*/
|
|
21
|
+
function buildTree(flatTerms) {
|
|
22
|
+
const map = /* @__PURE__ */ new Map();
|
|
23
|
+
const roots = [];
|
|
24
|
+
for (const term of flatTerms) map.set(term.id, term);
|
|
25
|
+
for (const term of flatTerms) if (term.parentId && map.has(term.parentId)) map.get(term.parentId).children.push(term);
|
|
26
|
+
else roots.push(term);
|
|
27
|
+
return roots;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Look up a taxonomy definition by name (optionally scoped to a locale).
|
|
31
|
+
* Returns the lowest-locale match when no locale is provided.
|
|
32
|
+
*/
|
|
33
|
+
async function requireTaxonomyDef(db, name, locale) {
|
|
34
|
+
let query = db.selectFrom("_dineway_taxonomy_defs").selectAll().where("name", "=", name);
|
|
35
|
+
if (locale !== void 0) query = query.where("locale", "=", locale);
|
|
36
|
+
const def = await query.orderBy("locale", "asc").executeTakeFirst();
|
|
37
|
+
if (!def) return {
|
|
38
|
+
success: false,
|
|
39
|
+
error: {
|
|
40
|
+
code: "NOT_FOUND",
|
|
41
|
+
message: `Taxonomy '${name}' not found`
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return {
|
|
45
|
+
success: true,
|
|
46
|
+
def
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function rowToDef(row) {
|
|
50
|
+
return {
|
|
51
|
+
id: row.id,
|
|
52
|
+
name: row.name,
|
|
53
|
+
label: row.label,
|
|
54
|
+
labelSingular: row.label_singular ?? void 0,
|
|
55
|
+
hierarchical: row.hierarchical === 1,
|
|
56
|
+
collections: row.collections ? JSON.parse(row.collections) : [],
|
|
57
|
+
locale: row.locale,
|
|
58
|
+
translationGroup: row.translation_group
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* List all taxonomy definitions
|
|
63
|
+
*/
|
|
64
|
+
async function handleTaxonomyList(db, options = {}) {
|
|
65
|
+
try {
|
|
66
|
+
let query = db.selectFrom("_dineway_taxonomy_defs").selectAll();
|
|
67
|
+
if (options.locale !== void 0) query = query.where("locale", "=", options.locale);
|
|
68
|
+
const [rows, collectionRows] = await Promise.all([query.execute(), db.selectFrom("_dineway_collections").select("slug").execute()]);
|
|
69
|
+
const realCollections = new Set(collectionRows.map((r) => r.slug));
|
|
70
|
+
return {
|
|
71
|
+
success: true,
|
|
72
|
+
data: { taxonomies: rows.map((row) => {
|
|
73
|
+
const def = rowToDef(row);
|
|
74
|
+
return {
|
|
75
|
+
...def,
|
|
76
|
+
collections: def.collections.filter((slug) => realCollections.has(slug))
|
|
77
|
+
};
|
|
78
|
+
}) }
|
|
79
|
+
};
|
|
80
|
+
} catch {
|
|
81
|
+
return {
|
|
82
|
+
success: false,
|
|
83
|
+
error: {
|
|
84
|
+
code: "TAXONOMY_LIST_ERROR",
|
|
85
|
+
message: "Failed to list taxonomies"
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Create a new taxonomy definition
|
|
92
|
+
*/
|
|
93
|
+
async function handleTaxonomyCreate(db, input) {
|
|
94
|
+
try {
|
|
95
|
+
if (!NAME_PATTERN.test(input.name)) return {
|
|
96
|
+
success: false,
|
|
97
|
+
error: {
|
|
98
|
+
code: "VALIDATION_ERROR",
|
|
99
|
+
message: "Taxonomy name must start with a letter and contain only lowercase letters, numbers, and underscores"
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
const collections = [...new Set(input.collections ?? [])];
|
|
103
|
+
if (collections.length > 0) {
|
|
104
|
+
const existingCollections = await db.selectFrom("_dineway_collections").select("slug").where("slug", "in", collections).execute();
|
|
105
|
+
const existingSlugs = new Set(existingCollections.map((c) => c.slug));
|
|
106
|
+
const invalid = collections.filter((c) => !existingSlugs.has(c));
|
|
107
|
+
if (invalid.length > 0) return {
|
|
108
|
+
success: false,
|
|
109
|
+
error: {
|
|
110
|
+
code: "VALIDATION_ERROR",
|
|
111
|
+
message: `Unknown collection(s): ${invalid.join(", ")}`
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
let translationGroup = null;
|
|
116
|
+
if (input.translationOf) {
|
|
117
|
+
const source = await db.selectFrom("_dineway_taxonomy_defs").selectAll().where("id", "=", input.translationOf).executeTakeFirst();
|
|
118
|
+
if (!source) return {
|
|
119
|
+
success: false,
|
|
120
|
+
error: {
|
|
121
|
+
code: "NOT_FOUND",
|
|
122
|
+
message: "Source taxonomy for translation not found"
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
translationGroup = source.translation_group ?? source.id;
|
|
126
|
+
}
|
|
127
|
+
if (input.locale !== void 0) {
|
|
128
|
+
if (await db.selectFrom("_dineway_taxonomy_defs").select("id").where("name", "=", input.name).where("locale", "=", input.locale).executeTakeFirst()) return {
|
|
129
|
+
success: false,
|
|
130
|
+
error: {
|
|
131
|
+
code: "CONFLICT",
|
|
132
|
+
message: `Taxonomy '${input.name}' already exists in locale '${input.locale}'`
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const id = ulid();
|
|
137
|
+
await db.insertInto("_dineway_taxonomy_defs").values({
|
|
138
|
+
id,
|
|
139
|
+
name: input.name,
|
|
140
|
+
label: input.label,
|
|
141
|
+
label_singular: input.labelSingular ?? null,
|
|
142
|
+
hierarchical: input.hierarchical ? 1 : 0,
|
|
143
|
+
collections: JSON.stringify(collections),
|
|
144
|
+
...input.locale !== void 0 ? { locale: input.locale } : {},
|
|
145
|
+
translation_group: translationGroup ?? id
|
|
146
|
+
}).execute();
|
|
147
|
+
return {
|
|
148
|
+
success: true,
|
|
149
|
+
data: { taxonomy: rowToDef(await db.selectFrom("_dineway_taxonomy_defs").selectAll().where("id", "=", id).executeTakeFirstOrThrow()) }
|
|
150
|
+
};
|
|
151
|
+
} catch (error) {
|
|
152
|
+
if (error instanceof Error && error.message.includes("UNIQUE constraint failed")) return {
|
|
153
|
+
success: false,
|
|
154
|
+
error: {
|
|
155
|
+
code: "CONFLICT",
|
|
156
|
+
message: `Taxonomy '${input.name}' already exists`
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
return {
|
|
160
|
+
success: false,
|
|
161
|
+
error: {
|
|
162
|
+
code: "TAXONOMY_CREATE_ERROR",
|
|
163
|
+
message: "Failed to create taxonomy"
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* List all terms for a taxonomy (returns tree for hierarchical taxonomies)
|
|
170
|
+
*/
|
|
171
|
+
async function handleTermList(db, taxonomyName, options = {}) {
|
|
172
|
+
try {
|
|
173
|
+
const lookup = await requireTaxonomyDef(db, taxonomyName);
|
|
174
|
+
if (!lookup.success) return lookup;
|
|
175
|
+
const repo = new TaxonomyRepository(db);
|
|
176
|
+
const terms = await repo.findByName(taxonomyName, { locale: options.locale });
|
|
177
|
+
const groups = terms.map((t) => t.translationGroup ?? t.id);
|
|
178
|
+
const countsByGroup = await repo.countEntriesForTerms(groups);
|
|
179
|
+
const termData = terms.map((term) => ({
|
|
180
|
+
id: term.id,
|
|
181
|
+
name: term.name,
|
|
182
|
+
slug: term.slug,
|
|
183
|
+
label: term.label,
|
|
184
|
+
parentId: term.parentId,
|
|
185
|
+
description: typeof term.data?.description === "string" ? term.data.description : void 0,
|
|
186
|
+
children: [],
|
|
187
|
+
count: countsByGroup.get(term.translationGroup ?? term.id) ?? 0,
|
|
188
|
+
locale: term.locale,
|
|
189
|
+
translationGroup: term.translationGroup
|
|
190
|
+
}));
|
|
191
|
+
return {
|
|
192
|
+
success: true,
|
|
193
|
+
data: { terms: lookup.def.hierarchical === 1 ? buildTree(termData) : termData }
|
|
194
|
+
};
|
|
195
|
+
} catch {
|
|
196
|
+
return {
|
|
197
|
+
success: false,
|
|
198
|
+
error: {
|
|
199
|
+
code: "TERM_LIST_ERROR",
|
|
200
|
+
message: "Failed to list terms"
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Validate a parent term reference for create/update.
|
|
207
|
+
*
|
|
208
|
+
* Returns `null` on success or a structured error message that callers
|
|
209
|
+
* wrap in their own ApiResult.
|
|
210
|
+
*
|
|
211
|
+
* - `parentId === undefined` -> no-op (no parent change requested).
|
|
212
|
+
* - `parentId === null` -> caller intends to detach; no-op here.
|
|
213
|
+
* - parent must exist (FK exists -> term row not soft-deleted).
|
|
214
|
+
* - parent must live in the same taxonomy.
|
|
215
|
+
* - if `termId` is provided (update path), reject `parentId === termId`
|
|
216
|
+
* (self-parent) and walk up the parent chain to detect cycles.
|
|
217
|
+
*/
|
|
218
|
+
async function validateParentTerm(repo, taxonomyName, termId, parentId) {
|
|
219
|
+
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
|
+
const parent = await repo.findById(parentId);
|
|
225
|
+
if (!parent) return {
|
|
226
|
+
code: "VALIDATION_ERROR",
|
|
227
|
+
message: `Parent term '${parentId}' not found`
|
|
228
|
+
};
|
|
229
|
+
if (parent.name !== taxonomyName) return {
|
|
230
|
+
code: "VALIDATION_ERROR",
|
|
231
|
+
message: `Parent term '${parentId}' belongs to taxonomy '${parent.name}', not '${taxonomyName}'`
|
|
232
|
+
};
|
|
233
|
+
const MAX_DEPTH = 100;
|
|
234
|
+
let cursor = parent.parentId;
|
|
235
|
+
let steps = 0;
|
|
236
|
+
while (cursor !== null && steps < MAX_DEPTH) {
|
|
237
|
+
if (termId !== void 0 && cursor === termId) return {
|
|
238
|
+
code: "VALIDATION_ERROR",
|
|
239
|
+
message: "Cycle detected: cannot make a descendant the parent"
|
|
240
|
+
};
|
|
241
|
+
const next = await repo.findById(cursor);
|
|
242
|
+
if (!next) break;
|
|
243
|
+
cursor = next.parentId;
|
|
244
|
+
steps++;
|
|
245
|
+
}
|
|
246
|
+
if (cursor !== null && steps >= MAX_DEPTH) return {
|
|
247
|
+
code: "VALIDATION_ERROR",
|
|
248
|
+
message: "Parent chain exceeds maximum depth"
|
|
249
|
+
};
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Create a new term in a taxonomy
|
|
254
|
+
*/
|
|
255
|
+
async function handleTermCreate(db, taxonomyName, input) {
|
|
256
|
+
try {
|
|
257
|
+
const lookup = await requireTaxonomyDef(db, taxonomyName);
|
|
258
|
+
if (!lookup.success) return lookup;
|
|
259
|
+
const repo = new TaxonomyRepository(db);
|
|
260
|
+
let parentId = input.parentId === "" || input.parentId === void 0 ? void 0 : input.parentId;
|
|
261
|
+
if (await repo.findBySlug(taxonomyName, input.slug, input.locale)) return {
|
|
262
|
+
success: false,
|
|
263
|
+
error: {
|
|
264
|
+
code: "CONFLICT",
|
|
265
|
+
message: input.locale ? `Term '${input.slug}' already exists in '${taxonomyName}' (${input.locale})` : `Term with slug '${input.slug}' already exists in taxonomy '${taxonomyName}'`
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
if (input.translationOf && parentId) {
|
|
269
|
+
if ((await repo.findById(input.translationOf))?.parentId === parentId && input.locale) {
|
|
270
|
+
const sourceParent = await repo.findById(parentId);
|
|
271
|
+
if (sourceParent?.translationGroup) {
|
|
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
|
+
}
|
|
276
|
+
}
|
|
277
|
+
const parentError = await validateParentTerm(repo, taxonomyName, void 0, parentId);
|
|
278
|
+
if (parentError) return {
|
|
279
|
+
success: false,
|
|
280
|
+
error: parentError
|
|
281
|
+
};
|
|
282
|
+
const term = await repo.create({
|
|
283
|
+
name: taxonomyName,
|
|
284
|
+
slug: input.slug,
|
|
285
|
+
label: input.label,
|
|
286
|
+
parentId: parentId ?? void 0,
|
|
287
|
+
data: input.description ? { description: input.description } : void 0,
|
|
288
|
+
locale: input.locale,
|
|
289
|
+
translationOf: input.translationOf
|
|
290
|
+
});
|
|
291
|
+
/* @__PURE__ */ invalidateTermCache();
|
|
292
|
+
return {
|
|
293
|
+
success: true,
|
|
294
|
+
data: { term: {
|
|
295
|
+
id: term.id,
|
|
296
|
+
name: term.name,
|
|
297
|
+
slug: term.slug,
|
|
298
|
+
label: term.label,
|
|
299
|
+
parentId: term.parentId,
|
|
300
|
+
description: typeof term.data?.description === "string" ? term.data.description : void 0,
|
|
301
|
+
locale: term.locale,
|
|
302
|
+
translationGroup: term.translationGroup
|
|
303
|
+
} }
|
|
304
|
+
};
|
|
305
|
+
} catch {
|
|
306
|
+
return {
|
|
307
|
+
success: false,
|
|
308
|
+
error: {
|
|
309
|
+
code: "TERM_CREATE_ERROR",
|
|
310
|
+
message: "Failed to create term"
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Get a single term by slug
|
|
317
|
+
*/
|
|
318
|
+
async function handleTermGet(db, taxonomyName, termSlug, options = {}) {
|
|
319
|
+
try {
|
|
320
|
+
const repo = new TaxonomyRepository(db);
|
|
321
|
+
const term = await repo.findBySlug(taxonomyName, termSlug, options.locale);
|
|
322
|
+
if (!term) return {
|
|
323
|
+
success: false,
|
|
324
|
+
error: {
|
|
325
|
+
code: "NOT_FOUND",
|
|
326
|
+
message: `Term '${termSlug}' not found in taxonomy '${taxonomyName}'`
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
const count = await repo.countEntriesWithTerm(term.id);
|
|
330
|
+
const children = await repo.findChildren(term.id);
|
|
331
|
+
return {
|
|
332
|
+
success: true,
|
|
333
|
+
data: { term: {
|
|
334
|
+
id: term.id,
|
|
335
|
+
name: term.name,
|
|
336
|
+
slug: term.slug,
|
|
337
|
+
label: term.label,
|
|
338
|
+
parentId: term.parentId,
|
|
339
|
+
description: typeof term.data?.description === "string" ? term.data.description : void 0,
|
|
340
|
+
count,
|
|
341
|
+
children: children.map((c) => ({
|
|
342
|
+
id: c.id,
|
|
343
|
+
slug: c.slug,
|
|
344
|
+
label: c.label
|
|
345
|
+
})),
|
|
346
|
+
locale: term.locale,
|
|
347
|
+
translationGroup: term.translationGroup
|
|
348
|
+
} }
|
|
349
|
+
};
|
|
350
|
+
} catch {
|
|
351
|
+
return {
|
|
352
|
+
success: false,
|
|
353
|
+
error: {
|
|
354
|
+
code: "TERM_GET_ERROR",
|
|
355
|
+
message: "Failed to get term"
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
/** List every translation of a term (by id or translation_group). */
|
|
361
|
+
async function handleTermTranslations(db, idOrGroup) {
|
|
362
|
+
try {
|
|
363
|
+
const anchor = await db.selectFrom("taxonomies").selectAll().where((eb) => eb.or([eb("id", "=", idOrGroup), eb("translation_group", "=", idOrGroup)])).executeTakeFirst();
|
|
364
|
+
if (!anchor) return {
|
|
365
|
+
success: false,
|
|
366
|
+
error: {
|
|
367
|
+
code: "NOT_FOUND",
|
|
368
|
+
message: "Term not found"
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
const group = anchor.translation_group ?? anchor.id;
|
|
372
|
+
return {
|
|
373
|
+
success: true,
|
|
374
|
+
data: {
|
|
375
|
+
translationGroup: group,
|
|
376
|
+
translations: (await db.selectFrom("taxonomies").selectAll().where("translation_group", "=", group).orderBy("locale", "asc").execute()).map((r) => ({
|
|
377
|
+
id: r.id,
|
|
378
|
+
slug: r.slug,
|
|
379
|
+
label: r.label,
|
|
380
|
+
locale: r.locale
|
|
381
|
+
}))
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
} catch {
|
|
385
|
+
return {
|
|
386
|
+
success: false,
|
|
387
|
+
error: {
|
|
388
|
+
code: "TERM_TRANSLATIONS_ERROR",
|
|
389
|
+
message: "Failed to list term translations"
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Update a term
|
|
396
|
+
*/
|
|
397
|
+
async function handleTermUpdate(db, taxonomyName, termSlug, input, options = {}) {
|
|
398
|
+
try {
|
|
399
|
+
const repo = new TaxonomyRepository(db);
|
|
400
|
+
const term = await repo.findBySlug(taxonomyName, termSlug, options.locale);
|
|
401
|
+
if (!term) return {
|
|
402
|
+
success: false,
|
|
403
|
+
error: {
|
|
404
|
+
code: "NOT_FOUND",
|
|
405
|
+
message: `Term '${termSlug}' not found in taxonomy '${taxonomyName}'`
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
const newSlug = input.slug === "" || input.slug === void 0 ? void 0 : input.slug;
|
|
409
|
+
const newParentId = input.parentId === "" || input.parentId === void 0 ? void 0 : input.parentId;
|
|
410
|
+
if (newSlug !== void 0 && newSlug !== termSlug) {
|
|
411
|
+
const existing = await repo.findBySlug(taxonomyName, newSlug, options.locale);
|
|
412
|
+
if (existing && existing.id !== term.id) return {
|
|
413
|
+
success: false,
|
|
414
|
+
error: {
|
|
415
|
+
code: "CONFLICT",
|
|
416
|
+
message: `Term with slug '${newSlug}' already exists in taxonomy '${taxonomyName}'`
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
const parentError = await validateParentTerm(repo, taxonomyName, term.id, newParentId);
|
|
421
|
+
if (parentError) return {
|
|
422
|
+
success: false,
|
|
423
|
+
error: parentError
|
|
424
|
+
};
|
|
425
|
+
const updated = await repo.update(term.id, {
|
|
426
|
+
slug: newSlug,
|
|
427
|
+
label: input.label,
|
|
428
|
+
parentId: newParentId,
|
|
429
|
+
data: input.description !== void 0 ? { description: input.description } : void 0
|
|
430
|
+
});
|
|
431
|
+
/* @__PURE__ */ invalidateTermCache();
|
|
432
|
+
if (!updated) return {
|
|
433
|
+
success: false,
|
|
434
|
+
error: {
|
|
435
|
+
code: "TERM_UPDATE_ERROR",
|
|
436
|
+
message: "Failed to update term"
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
return {
|
|
440
|
+
success: true,
|
|
441
|
+
data: { term: {
|
|
442
|
+
id: updated.id,
|
|
443
|
+
name: updated.name,
|
|
444
|
+
slug: updated.slug,
|
|
445
|
+
label: updated.label,
|
|
446
|
+
parentId: updated.parentId,
|
|
447
|
+
description: typeof updated.data?.description === "string" ? updated.data.description : void 0,
|
|
448
|
+
locale: updated.locale,
|
|
449
|
+
translationGroup: updated.translationGroup
|
|
450
|
+
} }
|
|
451
|
+
};
|
|
452
|
+
} catch {
|
|
453
|
+
return {
|
|
454
|
+
success: false,
|
|
455
|
+
error: {
|
|
456
|
+
code: "TERM_UPDATE_ERROR",
|
|
457
|
+
message: "Failed to update term"
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Delete a term
|
|
464
|
+
*/
|
|
465
|
+
async function handleTermDelete(db, taxonomyName, termSlug, options = {}) {
|
|
466
|
+
try {
|
|
467
|
+
const repo = new TaxonomyRepository(db);
|
|
468
|
+
const term = await repo.findBySlug(taxonomyName, termSlug, options.locale);
|
|
469
|
+
if (!term) return {
|
|
470
|
+
success: false,
|
|
471
|
+
error: {
|
|
472
|
+
code: "NOT_FOUND",
|
|
473
|
+
message: `Term '${termSlug}' not found in taxonomy '${taxonomyName}'`
|
|
474
|
+
}
|
|
475
|
+
};
|
|
476
|
+
if ((await repo.findChildren(term.id)).length > 0) return {
|
|
477
|
+
success: false,
|
|
478
|
+
error: {
|
|
479
|
+
code: "VALIDATION_ERROR",
|
|
480
|
+
message: "Cannot delete term with children. Delete children first."
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
if (!await repo.delete(term.id)) return {
|
|
484
|
+
success: false,
|
|
485
|
+
error: {
|
|
486
|
+
code: "TERM_DELETE_ERROR",
|
|
487
|
+
message: "Failed to delete term"
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
/* @__PURE__ */ invalidateTermCache();
|
|
491
|
+
return {
|
|
492
|
+
success: true,
|
|
493
|
+
data: { deleted: true }
|
|
494
|
+
};
|
|
495
|
+
} catch {
|
|
496
|
+
return {
|
|
497
|
+
success: false,
|
|
498
|
+
error: {
|
|
499
|
+
code: "TERM_DELETE_ERROR",
|
|
500
|
+
message: "Failed to delete term"
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
//#endregion
|
|
507
|
+
export { handleTermGet as a, handleTermUpdate as c, handleTermDelete as i, taxonomies_exports as l, handleTaxonomyList as n, handleTermList as o, handleTermCreate as r, handleTermTranslations as s, handleTaxonomyCreate as t };
|