dineway 0.2.33 → 0.2.34
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-CfryM8jO.mjs → activity-CZnq5YlZ.mjs} +2 -2
- package/dist/{activity-events-BVo9rMUz.mjs → activity-events-D-yGV7cW.mjs} +1 -1
- package/dist/{actor-DrJJsvy6.mjs → actor-DxUAJgQX.mjs} +20 -6
- package/dist/{adapters-DHt3f2lu.d.mts → adapters-BQ8CQbBm.d.mts} +5 -7
- package/dist/after-BVaUn7bK.mjs +24 -0
- package/dist/{allowed-origins-DGSyhRCz.mjs → allowed-origins-DV3LWuWW.mjs} +1 -1
- package/dist/api/route-utils.d.mts +10 -10
- package/dist/api/route-utils.mjs +23 -19
- package/dist/api/schemas/index.d.mts +1 -1
- package/dist/api/schemas/index.mjs +5 -5
- package/dist/{api-CTf1SLmg.mjs → api-CL4pG2zf.mjs} +55 -1215
- package/dist/api-tokens-D5K_Csub.mjs +3 -0
- package/dist/{api-tokens-CSomx-l3.mjs → api-tokens-_6tMD1W4.mjs} +1 -1
- package/dist/{apply-Bs2jXsms.mjs → apply-CYLUMiZg.mjs} +109 -93
- package/dist/astro/index.d.mts +16 -12
- package/dist/astro/index.mjs +50 -9
- package/dist/astro/middleware/auth.d.mts +9 -9
- package/dist/astro/middleware/auth.mjs +29 -8
- package/dist/astro/middleware/redirect.mjs +8 -7
- package/dist/astro/middleware/request-context.mjs +17 -10
- package/dist/astro/middleware/seed.d.mts +1 -1
- package/dist/astro/middleware/seed.mjs +93 -71
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware/workers.d.mts +6 -0
- package/dist/astro/middleware/workers.mjs +8 -0
- package/dist/astro/middleware.mjs +288 -159
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +7 -7
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +7 -7
- package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +4 -4
- package/dist/astro/routes/api/admin/api-tokens/index.mjs +7 -7
- package/dist/astro/routes/api/admin/briefing.mjs +25 -23
- package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +5 -4
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +11 -10
- package/dist/astro/routes/api/admin/byline-fields/index.mjs +11 -10
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +11 -10
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +22 -20
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +22 -20
- package/dist/astro/routes/api/admin/bylines/index.mjs +22 -20
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +17 -16
- package/dist/astro/routes/api/admin/comments/_id_.mjs +8 -7
- package/dist/astro/routes/api/admin/comments/bulk.mjs +14 -13
- package/dist/astro/routes/api/admin/comments/counts.mjs +8 -7
- package/dist/astro/routes/api/admin/comments/index.mjs +14 -13
- package/dist/astro/routes/api/admin/context/_id_/history.mjs +43 -31
- package/dist/astro/routes/api/admin/context/_id_/index.mjs +43 -31
- package/dist/astro/routes/api/admin/context/_id_/review.mjs +48 -36
- package/dist/astro/routes/api/admin/context/_id_/supersede.mjs +48 -36
- package/dist/astro/routes/api/admin/context/diff.mjs +47 -35
- package/dist/astro/routes/api/admin/context/index.mjs +48 -36
- package/dist/astro/routes/api/admin/context/stale.mjs +47 -35
- package/dist/astro/routes/api/admin/hitl-requests/_id_/index.mjs +43 -31
- package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.mjs +47 -35
- package/dist/astro/routes/api/admin/hitl-requests/index.mjs +47 -35
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +44 -32
- package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +3 -3
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +7 -7
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs +7 -7
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +72 -66
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +72 -66
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +64 -58
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +71 -65
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +71 -65
- package/dist/astro/routes/api/admin/plugins/index.mjs +64 -58
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +2 -2
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +64 -58
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +71 -65
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +64 -58
- package/dist/astro/routes/api/admin/plugins/updates.mjs +64 -58
- package/dist/astro/routes/api/admin/review-requests/_id_/image.mjs +26 -23
- package/dist/astro/routes/api/admin/review-requests/_id_/index.mjs +33 -25
- package/dist/astro/routes/api/admin/review-requests/_id_/resolve.mjs +56 -43
- package/dist/astro/routes/api/admin/review-requests/_id_/revoke.mjs +10 -9
- package/dist/astro/routes/api/admin/review-requests/index.mjs +54 -41
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +64 -58
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +2 -2
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +64 -58
- package/dist/astro/routes/api/admin/users/_id_/disable.mjs +20 -12
- package/dist/astro/routes/api/admin/users/_id_/enable.mjs +1 -1
- package/dist/astro/routes/api/admin/users/_id_/index.mjs +40 -32
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +3 -3
- package/dist/astro/routes/api/admin/users/index.mjs +7 -7
- package/dist/astro/routes/api/auth/dev-bypass.mjs +6 -5
- package/dist/astro/routes/api/auth/invite/accept.mjs +1 -1
- package/dist/astro/routes/api/auth/invite/complete.mjs +12 -12
- package/dist/astro/routes/api/auth/invite/index.mjs +9 -9
- package/dist/astro/routes/api/auth/invite/register-options.mjs +11 -11
- package/dist/astro/routes/api/auth/logout.mjs +2 -2
- package/dist/astro/routes/api/auth/magic-link/send.mjs +12 -11
- package/dist/astro/routes/api/auth/magic-link/verify.mjs +2 -2
- package/dist/astro/routes/api/auth/me.mjs +11 -11
- package/dist/astro/routes/api/auth/mode.mjs +1 -1
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +5 -4
- package/dist/astro/routes/api/auth/oauth/_provider_.mjs +5 -4
- package/dist/astro/routes/api/auth/passkey/_id_.mjs +7 -7
- package/dist/astro/routes/api/auth/passkey/index.mjs +1 -1
- package/dist/astro/routes/api/auth/passkey/options.mjs +14 -13
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +11 -11
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +12 -12
- package/dist/astro/routes/api/auth/passkey/verify.mjs +12 -12
- package/dist/astro/routes/api/auth/setup-token/index.mjs +32 -23
- package/dist/astro/routes/api/auth/setup-token/verify.mjs +32 -26
- package/dist/astro/routes/api/auth/signup/complete.mjs +12 -12
- package/dist/astro/routes/api/auth/signup/request.mjs +12 -11
- package/dist/astro/routes/api/auth/signup/verify.mjs +1 -1
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +21 -18
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +19 -16
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +8 -7
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +8 -7
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +8 -7
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +24 -21
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +35 -22
- package/dist/astro/routes/api/content/_collection_/_id_/release-readiness.mjs +9 -9
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +8 -7
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +35 -22
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +23 -19
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +8 -7
- package/dist/astro/routes/api/content/_collection_/_id_.mjs +14 -13
- package/dist/astro/routes/api/content/_collection_/authors.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/index.mjs +14 -13
- package/dist/astro/routes/api/content/_collection_/trash.mjs +8 -8
- package/dist/astro/routes/api/dashboard.mjs +16 -11
- 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 +25 -24
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +12 -11
- package/dist/astro/routes/api/import/wordpress/execute.d.mts +9 -9
- package/dist/astro/routes/api/import/wordpress/execute.mjs +51 -42
- package/dist/astro/routes/api/import/wordpress/media.d.mts +9 -9
- package/dist/astro/routes/api/import/wordpress/media.mjs +14 -14
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +52 -40
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +10 -10
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +50 -38
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +29 -27
- package/dist/astro/routes/api/import/wordpress-plugin/callback.mjs +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +9 -9
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +56 -47
- package/dist/astro/routes/api/integration/artifact.mjs +11 -8
- package/dist/astro/routes/api/integration/dispatch.mjs +17 -14
- package/dist/astro/routes/api/integrations/_provider_.mjs +11 -8
- package/dist/astro/routes/api/integrations/index.mjs +10 -7
- package/dist/astro/routes/api/manifest.mjs +5 -5
- package/dist/astro/routes/api/mcp.mjs +98 -88
- package/dist/astro/routes/api/media/_id_/confirm.mjs +12 -12
- package/dist/astro/routes/api/media/_id_.mjs +9 -9
- 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 +13 -13
- package/dist/astro/routes/api/media.mjs +16 -16
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +48 -36
- package/dist/astro/routes/api/menus/_name_/items.mjs +48 -36
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +48 -36
- package/dist/astro/routes/api/menus/_name_/translations.mjs +48 -36
- package/dist/astro/routes/api/menus/_name_.mjs +48 -36
- package/dist/astro/routes/api/menus/index.mjs +48 -36
- package/dist/astro/routes/api/oauth/authorize.mjs +9 -7
- package/dist/astro/routes/api/oauth/device/authorize.mjs +7 -6
- package/dist/astro/routes/api/oauth/device/code.mjs +11 -9
- package/dist/astro/routes/api/oauth/device/token.mjs +10 -8
- package/dist/astro/routes/api/oauth/register.mjs +4 -4
- package/dist/astro/routes/api/oauth/token/refresh.mjs +7 -6
- package/dist/astro/routes/api/oauth/token/revoke.mjs +7 -6
- package/dist/astro/routes/api/oauth/token.mjs +8 -6
- package/dist/astro/routes/api/openapi.json.mjs +5 -5
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +4 -4
- package/dist/astro/routes/api/redirects/404s/index.mjs +15 -14
- package/dist/astro/routes/api/redirects/404s/summary.mjs +15 -14
- package/dist/astro/routes/api/redirects/_id_.mjs +48 -37
- package/dist/astro/routes/api/redirects/index.mjs +48 -37
- 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 +66 -60
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +66 -60
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +66 -60
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +66 -60
- package/dist/astro/routes/api/schema/collections/index.mjs +66 -60
- package/dist/astro/routes/api/schema/index.mjs +12 -11
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +64 -58
- package/dist/astro/routes/api/schema/orphans/index.mjs +64 -58
- package/dist/astro/routes/api/search/enable.mjs +15 -14
- package/dist/astro/routes/api/search/index.mjs +14 -13
- package/dist/astro/routes/api/search/rebuild.mjs +15 -14
- package/dist/astro/routes/api/search/stats.mjs +9 -8
- package/dist/astro/routes/api/search/suggest.mjs +14 -13
- package/dist/astro/routes/api/sections/_slug_.mjs +48 -36
- package/dist/astro/routes/api/sections/index.mjs +48 -36
- package/dist/astro/routes/api/settings/email.mjs +5 -5
- package/dist/astro/routes/api/settings/reviews.mjs +11 -10
- package/dist/astro/routes/api/settings.mjs +48 -36
- package/dist/astro/routes/api/setup/admin-verify.mjs +14 -14
- package/dist/astro/routes/api/setup/admin.mjs +12 -12
- package/dist/astro/routes/api/setup/dev-bypass.mjs +35 -31
- package/dist/astro/routes/api/setup/dev-reset.mjs +2 -2
- package/dist/astro/routes/api/setup/index.mjs +37 -33
- package/dist/astro/routes/api/setup/status.mjs +3 -3
- package/dist/astro/routes/api/snapshot.mjs +11 -9
- package/dist/astro/routes/api/system/heartbeat.mjs +2 -2
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +51 -39
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +51 -39
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +51 -39
- package/dist/astro/routes/api/taxonomies/index.mjs +51 -39
- package/dist/astro/routes/api/themes/preview.mjs +8 -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 +47 -35
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +48 -36
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +48 -36
- package/dist/astro/routes/api/widget-areas/_name_.mjs +45 -33
- package/dist/astro/routes/api/widget-areas/index.mjs +48 -36
- package/dist/astro/routes/api/widget-components.mjs +2 -2
- package/dist/astro/routes/robots.txt.mjs +11 -10
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +20 -18
- package/dist/astro/routes/sitemap.xml.mjs +19 -17
- package/dist/astro/session-driver.d.mts +1 -1
- package/dist/astro/session-driver.mjs +4 -4
- package/dist/astro/types.d.mts +13 -13
- package/dist/atomic-authority-CnBQJ14T.mjs +33 -0
- package/dist/{audit-CYjfxG9i.mjs → audit-F5iWkbcJ.mjs} +11 -4
- package/dist/auth/providers/github.d.mts +1 -1
- package/dist/auth/providers/google.d.mts +1 -1
- package/dist/{auth-control-guard-CITT8ZA_.mjs → auth-control-guard-D4WW-wFF.mjs} +1 -1
- package/dist/{authorize-KcI0pAfN.mjs → authorize-EnP57AQl.mjs} +1 -1
- package/dist/{briefing-r3hXCDQC.mjs → briefing-BXsVwd4P.mjs} +1 -1
- package/dist/{briefing-BgQTljQt.mjs → briefing-CkCi6S-W.mjs} +445 -447
- package/dist/{bundle-S6zx-V4D.mjs → bundle-Cgak1zGE.mjs} +3 -3
- package/dist/{byline-Ctil4rij.mjs → byline-DEZKlzD9.mjs} +107 -113
- package/dist/{byline-fields-QpmruT5r.mjs → byline-fields-BGEIA9dZ.mjs} +3 -3
- package/dist/{byline-fields-51ja6JDa.d.mts → byline-fields-BmkhEDFF.d.mts} +10 -10
- package/dist/{byline-fields-DiCyW6eQ.mjs → byline-fields-Qg8TesxL.mjs} +1 -1
- package/dist/{byline-registry-rkr73qSE.mjs → byline-registry-CkuVVeJJ.mjs} +46 -76
- package/dist/{bylines-BcuBpzVi.mjs → bylines-7BQxRGyG.mjs} +4 -4
- package/dist/{bylines-v_ZUQnR-.mjs → bylines-LqNRjma2.mjs} +6 -6
- package/dist/{cache-V2BCplaY.mjs → cache-CSTy-R-K.mjs} +2 -2
- package/dist/{chunks-CnuL55JE.mjs → chunks-BnG3LPMN.mjs} +1 -1
- package/dist/cli/index.mjs +452 -263
- package/dist/cli/plugin-kit.d.mts +9 -9
- package/dist/cli/plugin-kit.mjs +2 -2
- package/dist/client/external-auth-headers.d.mts +1 -1
- package/dist/client/index.d.mts +11 -11
- package/dist/client/index.mjs +2 -2
- package/dist/{client-factory-C-y9VZDX.mjs → client-factory-BLSkgsTg.mjs} +1 -1
- package/dist/{comment-_nvJSS-A.mjs → comment-Bi7cJ9SS.mjs} +2 -2
- package/dist/{comment-reaction-DhVgJ17S.mjs → comment-reaction-BLqIj5mx.mjs} +1 -1
- package/dist/{comments-D4mIDjvA.mjs → comments-Dg_gWBEB.mjs} +1 -1
- package/dist/content-De_XeXy_.mjs +1230 -0
- package/dist/{content-CVCrcuvD.mjs → content-NobcQti0.mjs} +240 -161
- package/dist/{content-refresh-QvBIyb_g.mjs → content-refresh-l4mPoGeX.mjs} +170 -193
- package/dist/{context-MftkHbWx.mjs → context-6uqzU-M9.mjs} +95 -77
- package/dist/{context-JjKucxBm.mjs → context-B0SG9Xkc.mjs} +2 -2
- package/dist/{context-route-helpers-e1APrqSm.mjs → context-route-helpers-C8s26uDT.mjs} +2 -2
- package/dist/{cron-mGVPQ5e6.mjs → cron-D7zB6m8i.mjs} +36 -32
- package/dist/d1-binding-D6HZa3ks.mjs +8 -0
- package/dist/d1-dialect-B1b8cmxX.mjs +48 -0
- package/dist/{dashboard-ZJ7sMcBI.mjs → dashboard-B-OybCMw.mjs} +5 -5
- package/dist/database/batch.d.mts +20 -0
- package/dist/database/batch.mjs +69 -0
- package/dist/database/d1/index.d.mts +18 -0
- package/dist/database/d1/index.mjs +8 -0
- package/dist/db/d1.d.mts +7 -0
- package/dist/db/d1.mjs +13 -0
- package/dist/db/index.d.mts +4 -4
- package/dist/db/index.mjs +10 -7
- package/dist/db/libsql.d.mts +1 -1
- package/dist/db/libsql.mjs +46 -3
- package/dist/db/postgres.d.mts +1 -1
- package/dist/db/sqlite.d.mts +1 -1
- package/dist/{device-flow-eOcL5m0Q.mjs → device-flow-DhpCzMo0.mjs} +130 -94
- package/dist/{dialect-helpers-fk43GbDb.mjs → dialect-helpers-C6xtO-Ui.mjs} +1 -1
- package/dist/{discovery-CJkuHGhZ.mjs → discovery-CqXbN0WZ.mjs} +5 -5
- package/dist/{enrich-KErvJOuI.mjs → enrich-BjF-J4sF.mjs} +1 -1
- package/dist/{evidence-6IUv9ML3.mjs → evidence-xJf8hQgH.mjs} +7 -7
- package/dist/{field-defs-cache-CwrIyZFT.mjs → field-defs-cache-BKKFFf_V.mjs} +5 -5
- package/dist/{forgeway-account-lYJ8iX3G.mjs → forgeway-account-BeKJlKh1.mjs} +1 -1
- package/dist/{fts-manager-DX7ZkrCa.mjs → fts-manager-BeWtB7ZD.mjs} +72 -57
- package/dist/{hitl-requests-CmYVunm-.mjs → hitl-requests-evSsel48.mjs} +2 -2
- package/dist/{hitl-route-helpers-CRm537zS.mjs → hitl-route-helpers-D2kJSOFX.mjs} +5 -5
- package/dist/{import-DqRAgsKr.mjs → import-Jpta-CYE.mjs} +9 -9
- package/dist/{index-Co7xtjkd.d.mts → index-CSUSBfdD.d.mts} +7 -4
- package/dist/index.d.mts +16 -16
- package/dist/index.mjs +104 -96
- package/dist/{integration-credentials-qudN6yRr.mjs → integration-credentials-BrQr0fb_.mjs} +2 -2
- package/dist/{jsonld-BpvnSp2m.d.mts → jsonld-CqIVIeZK.d.mts} +2 -2
- package/dist/{load-fCOciq0Q.mjs → load-Dc5ttyg4.mjs} +1 -1
- package/dist/{loader-BDje8ME2.mjs → loader-Cgsx23wU.mjs} +4 -4
- package/dist/{manifest-schema-CfKD0thC.mjs → manifest-schema-DG29meRy.mjs} +1 -1
- package/dist/{mcp-reviewed-executor-DmhM3Cy6.mjs → mcp-reviewed-executor-DAZL3Ckt.mjs} +7 -7
- package/dist/media/image-endpoint.mjs +1 -1
- package/dist/media/index.d.mts +1 -1
- package/dist/media/index.mjs +2 -2
- package/dist/media/local-runtime.d.mts +11 -11
- package/dist/media/local-runtime.mjs +3 -3
- package/dist/{media-dvRjj4po.mjs → media-3fK0u-bo.mjs} +1 -1
- package/dist/{media-allowlist-DaG6lNoy.mjs → media-allowlist-rN4qIF6W.mjs} +1 -1
- package/dist/{menus-CpuR4Qkm.mjs → menus-5liJusbp.mjs} +138 -90
- package/dist/{menus-CZbz5L_V.mjs → menus-CbR_J8cJ.mjs} +8 -8
- package/dist/migrations-CMdxWKx-.mjs +76 -0
- package/dist/oauth-authority-CCqo4eBm.mjs +43 -0
- package/dist/{oauth-authorization-Jf5e3azH.mjs → oauth-authorization--0UtTZpv.mjs} +89 -98
- package/dist/{oauth-clients-tovQ4D4h.mjs → oauth-clients-D4WBYaYW.mjs} +2 -2
- package/dist/object-cache/memory.d.mts +1 -1
- package/dist/{object-cache-D51qOseS.mjs → object-cache-BGjIlY9s.mjs} +1 -1
- package/dist/page/index.d.mts +10 -10
- package/dist/page/index.mjs +1 -1
- package/dist/{parse-IsGn-5lt.mjs → parse--7nG62_h.mjs} +1 -1
- package/dist/plugin-utils.d.mts +9 -9
- package/dist/plugins/adapt-sandbox-entry.d.mts +9 -9
- package/dist/plugins/adapt-sandbox-entry.mjs +1 -1
- package/dist/{plugins-DXyLI3Hb.mjs → plugins-DK1wLuao.mjs} +35 -84
- package/dist/{policy-DKdNMv8y.mjs → policy-Dej7NJFD.mjs} +2 -2
- package/dist/{preview-BXmS1SXL.mjs → preview-q0pkibNO.mjs} +2 -2
- package/dist/{provider-loader-DDq7R_RN.d.mts → provider-loader-C0GaLwKB.d.mts} +1 -1
- package/dist/{public-url-Ci7UbC0W.d.mts → public-url-B9zEdO8p.d.mts} +1 -1
- package/dist/{public-url-BQ9vf0AS.d.mts → public-url-BV-YQ_LF.d.mts} +2 -2
- package/dist/{publication-authorization-C-vYPGD8.mjs → publication-authorization-BrEZ2TsE.mjs} +459 -33
- package/dist/{query-CrW2yI6G.mjs → query-CEn9HXnf.mjs} +15 -15
- package/dist/{query-DcB9uGTW.mjs → query-DAS6VbMS.mjs} +4 -4
- package/dist/{rate-limit-DEkoxTsP.mjs → rate-limit-Dd1TnzZP.mjs} +2 -2
- package/dist/{redirect-DG-o0CKV.mjs → redirect-HLI3wT5Y.mjs} +26 -14
- package/dist/{redirects-Bjp4iKJU.mjs → redirects-DmOdfRjI.mjs} +5 -5
- package/dist/{redirects-N8gmWhVM.mjs → redirects-UCXyL0lP.mjs} +3 -3
- package/dist/{registry-D-IV_h50.mjs → registry-RD9qTnYL.mjs} +183 -186
- package/dist/release-BR08Slqf.mjs +5148 -0
- package/dist/request-context.d.mts +8 -0
- package/dist/{request-meta-BW0the1R.mjs → request-meta-BOcuHAXD.mjs} +1 -1
- package/dist/{resolve-pZ4NQM-X.mjs → resolve-C80Pm2DW.mjs} +1 -1
- package/dist/{review-payload-f1L4lzQg.mjs → review-payload-DEylbssM.mjs} +52 -4
- package/dist/{review-requests-DICrYH2-.mjs → review-requests-BF2eEKr8.mjs} +93 -37
- package/dist/{review-requests-BTKfeWlS.mjs → review-requests-CyfWbJ6W.mjs} +2 -2
- package/dist/{review-route-helpers-DaZBBps8.mjs → review-route-helpers-lKA-CXms.mjs} +2 -2
- package/dist/{revision-De7OmYVD.mjs → revision-090sZyGc.mjs} +28 -22
- package/dist/revocation-B7GL5fMl.mjs +53 -0
- package/dist/{runner-DJiRFyLI.mjs → runner-CVeq0266.mjs} +594 -491
- package/dist/{runner-Dye73myO.d.mts → runner-JnJSGXEB.d.mts} +1 -1
- package/dist/{runs-DEujUDOj.mjs → runs-B5BExdKO.mjs} +5 -5
- package/dist/runtime-env-CQVAWHzH.mjs +19 -0
- package/dist/runtime.d.mts +10 -10
- package/dist/runtime.mjs +5 -5
- package/dist/schema-DLMkODQc.mjs +8 -0
- package/dist/{search-DxUKN9Zz.mjs → search-CRzWNfxX.mjs} +4 -4
- package/dist/{secrets-AdCrGg1c.mjs → secrets-Cg0D2gQW.mjs} +10 -11
- package/dist/{sections-BPFOEMK6.mjs → sections-BwUjOGqn.mjs} +2 -2
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +29 -25
- package/dist/seo/index.d.mts +3 -3
- package/dist/seo/index.mjs +11 -10
- package/dist/{seo-DWHdo5aW.mjs → seo-BOTuCeh-.mjs} +25 -15
- package/dist/{seo-GfovzqpU.mjs → seo-B_tBFyud.mjs} +1 -1
- package/dist/{service-DbgjHWyW.mjs → service--bQht6oN.mjs} +2 -2
- package/dist/{service-BrNKVCjC.mjs → service-DilVsWGD.mjs} +3 -3
- package/dist/{session-user-D8WwGEPH.mjs → session-user-DeqTcAmR.mjs} +1 -1
- package/dist/{settings-CAsQLi0N.mjs → settings-DFzevIrU.mjs} +8 -8
- package/dist/{settings-BKEHw6Bu.mjs → settings-Deqx3Upy.mjs} +2 -2
- package/dist/{setup-complete-CHCYS5KV.mjs → setup-complete-BFqudwbW.mjs} +1 -1
- package/dist/{site-activity-7oezuHXK.mjs → site-activity-BrN2NviL.mjs} +11 -4
- package/dist/{site-context-CA7rbxux.mjs → site-context-vCiDRr4H.mjs} +50 -37
- package/dist/{site-url-DoZf_jVj.mjs → site-url-wXFqbm9c.mjs} +1 -1
- package/dist/state-jyNZ6-7L.mjs +30 -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 +3 -3
- package/dist/{store-c4qx3gVh.mjs → store-C1yDxxfv.mjs} +37 -12
- package/dist/submission-BsHNfHc7.mjs +155 -0
- package/dist/{taxonomies-ALDiRQ84.mjs → taxonomies-4cnTcbD6.mjs} +3 -3
- package/dist/{taxonomies-93DV-1QT.mjs → taxonomies-CllxqaH0.mjs} +7 -7
- package/dist/{taxonomy-BOBTJ_aE.mjs → taxonomy-DWxxLpp5.mjs} +3 -3
- package/dist/{tokens-c-qxNqzC.mjs → tokens-Bjuf1HID.mjs} +1 -1
- package/dist/{trusted-proxy-CdEl6g6B.mjs → trusted-proxy-CAW9o4Dw.mjs} +4 -12
- package/dist/{types-BRCUO8NR.d.mts → types-7Th6Mwz3.d.mts} +1 -0
- package/dist/{types-BpSTdH1H.mjs → types-BqxIv8Il.mjs} +2 -2
- package/dist/{types-6KmeXInJ.d.mts → types-CFgTpfPk.d.mts} +1 -1
- package/dist/{types-CfpX1og5.d.mts → types-QjOcidFc.d.mts} +301 -173
- package/dist/ui/server-runtime.d.mts +13 -13
- package/dist/ui/server-runtime.mjs +28 -26
- package/dist/{user-D0NJ7gYf.mjs → user-1-YV30lf.mjs} +2 -2
- package/dist/{utils-BK2efsHv.mjs → utils-Cglcqpm2.mjs} +2 -2
- package/dist/{validate-CDWVODvc.d.mts → validate-A27peRc4.d.mts} +3 -3
- package/dist/{validate-C9g9iX3q.mjs → validate-Wl4MSf3V.mjs} +3 -3
- package/dist/version-BWxyC5s4.mjs +6 -0
- package/dist/{widgets-Cm5Qx2Np.mjs → widgets-Di-6yDH7.mjs} +3 -3
- package/dist/{wordpress-slugs-WdPZaVXf.mjs → wordpress-slugs-vOx7R1dM.mjs} +1 -1
- package/dist/{worker-Bhuu7eqS.mjs → worker-RpaMP71d.mjs} +76 -47
- package/dist/workers-build-BaQCrSmf.mjs +36 -0
- package/dist/{zod-generator-DS5oZNaL.mjs → zod-generator-Cylvl_SM.mjs} +2 -2
- package/package.json +35 -9
- package/dist/after-BfniwgIf.mjs +0 -9
- package/dist/api-tokens-CmT83Bgj.mjs +0 -3
- package/dist/db/libsql-http.d.mts +0 -27
- package/dist/db/libsql-http.mjs +0 -29
- package/dist/libsql-dialect-CANq6UNI.mjs +0 -47
- package/dist/oauth-user-lookup-B451pZmd.mjs +0 -25
- package/dist/revocation-CkTOhdlw.mjs +0 -42
- package/dist/schema-IjuRxkqq.mjs +0 -8
- package/dist/submission-C47cHBIg.mjs +0 -67
- package/dist/transaction-BGQgnwUi.mjs +0 -28
- package/dist/version-CJqc1mwj.mjs +0 -6
- /package/dist/{base64-F8-DUraK.mjs → base64-Cz-aU0X1.mjs} +0 -0
- /package/dist/{challenge-store-CDKfye2r.mjs → challenge-store-D-_-VavY.mjs} +0 -0
- /package/dist/{components-DAq_4iPX.mjs → components-BWQUCJEr.mjs} +0 -0
- /package/dist/{config-CVssduLe.mjs → config-XW5tMrH8.mjs} +0 -0
- /package/dist/{content-index-names-Bbu1FY1r.mjs → content-index-names-CDc2IQIx.mjs} +0 -0
- /package/dist/{context-types-CPWAJRs5.mjs → context-types-DqTo6C79.mjs} +0 -0
- /package/dist/{default-BeIzUa1e.mjs → default-D9zxuUU7.mjs} +0 -0
- /package/dist/{email-console-Bfi_exVg.mjs → email-console-BONByQiC.mjs} +0 -0
- /package/dist/{error-DLg1H2LT.mjs → error-Dd8LtpG5.mjs} +0 -0
- /package/dist/{escape-C6lkys0j.mjs → escape-BWC4s5bV.mjs} +0 -0
- /package/dist/{experimental-workflows-B9x8delL.mjs → experimental-workflows-M5D3RTFo.mjs} +0 -0
- /package/dist/{hash-jhbF98tT.mjs → hash-lNx3KJis.mjs} +0 -0
- /package/dist/{media-url-CL3NzgLh.mjs → media-url-B4YtTY6c.mjs} +0 -0
- /package/dist/{mime-CDTtL7jE.mjs → mime-D_ae-u_U.mjs} +0 -0
- /package/dist/{mode-DJeacFCZ.mjs → mode-CPf_KZ37.mjs} +0 -0
- /package/dist/{normalize-Ev3FiBMx.mjs → normalize-5rct_U0I.mjs} +0 -0
- /package/dist/{oauth-state-store-Do1a_o3H.mjs → oauth-state-store-CMgcimzA.mjs} +0 -0
- /package/dist/{options-1dBRkoCl.mjs → options-BcqHWpc-.mjs} +0 -0
- /package/dist/{output-8j9oltTf.mjs → output-BYpiVUBf.mjs} +0 -0
- /package/dist/{parser-C9rzPuSZ.mjs → parser-BV0wzQHo.mjs} +0 -0
- /package/dist/{passkey-config-CRN44T04.mjs → passkey-config-BG4GO4OO.mjs} +0 -0
- /package/dist/{patterns-3XE9bU4r.mjs → patterns-CZ7D4y_R.mjs} +0 -0
- /package/dist/{placeholder-D03pGvqM.d.mts → placeholder-BHTaoCYx.d.mts} +0 -0
- /package/dist/{portable-text-tIk9_uz_.mjs → portable-text-B9YuySom.mjs} +0 -0
- /package/dist/{portable-text-BdRm4uZq.d.mts → portable-text-FKf3IrPz.d.mts} +0 -0
- /package/dist/{process-cache-B-L-A9zg.mjs → process-cache-MHM4Sqzs.mjs} +0 -0
- /package/dist/{provider-loader-C4i82ll1.mjs → provider-loader-3MY1SjzA.mjs} +0 -0
- /package/dist/{public-discovery-CyDzK1-S.mjs → public-discovery-BAbOvKiR.mjs} +0 -0
- /package/dist/{public-url-oudwI7K0.mjs → public-url-C7pbmS_7.mjs} +0 -0
- /package/dist/{public-url-BVIjzMo3.mjs → public-url-D5Wjq0sy.mjs} +0 -0
- /package/dist/{redirect-Dp5u-8dH.mjs → redirect-Bx96u2nS.mjs} +0 -0
- /package/dist/{request-cache-BruBnFAR.mjs → request-cache-DPmV5nk4.mjs} +0 -0
- /package/dist/{seo-contributions-BAtRDXEQ.mjs → seo-contributions-Dt57p6Sq.mjs} +0 -0
- /package/dist/{service-DeX1PRNt.mjs → service-wYQ_ePZ4.mjs} +0 -0
- /package/dist/{setup-nonce-D-CEYlw7.mjs → setup-nonce-CAqDUxxU.mjs} +0 -0
- /package/dist/{sidecar-client-Bw2C0XTf.mjs → sidecar-client-CnpGTvYq.mjs} +0 -0
- /package/dist/{slugify-KSsVD_D3.mjs → slugify-Di8Q_MFq.mjs} +0 -0
- /package/dist/{ssrf-C7tTSD1r.mjs → ssrf-LN16WMip.mjs} +0 -0
- /package/dist/{stable-hash-DF7R5eN8.mjs → stable-hash-DEtJgcp7.mjs} +0 -0
- /package/dist/{status-Bba6RbkS.mjs → status-Bwkeuz8g.mjs} +0 -0
- /package/dist/{transport-BddGhTAI.mjs → transport-472KVGBe.mjs} +0 -0
- /package/dist/{transport-ktLL9r2O.d.mts → transport-C0jj-Nc8.d.mts} +0 -0
- /package/dist/{types-BQZFeZjd.mjs → types-BDq9t5lG.mjs} +0 -0
- /package/dist/{types-CKIt_jmM.d.mts → types-Bs-7Geuh.d.mts} +0 -0
- /package/dist/{types-CLMOusxP.d.mts → types-CwkJp6zr.d.mts} +0 -0
- /package/dist/{types-C0DPvhR5.mjs → types-CyBH89BS.mjs} +0 -0
- /package/dist/{types-BbkkkAb6.mjs → types-D17dJRht.mjs} +0 -0
- /package/dist/{types--3oJQ0hs.d.mts → types-DTjrkhKU.d.mts} +0 -0
- /package/dist/{types-CPaVj_GC.d.mts → types-DkXuBo8k.d.mts} +0 -0
- /package/dist/{types-CU3Wn2HC.d.mts → types-b2sq7ZDk.d.mts} +0 -0
- /package/dist/{url-C_pLSrGZ.mjs → url-D375-6LM.mjs} +0 -0
- /package/dist/{url-Dumsft7G.mjs → url-bv5i4JN0.mjs} +0 -0
- /package/dist/{validate-VPnKoIzW.mjs → validate-Co3j6T_K.mjs} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as capabilitiesToDeclaredAccess } from "./types-
|
|
1
|
+
import { c as __exportAll } from "./runner-CVeq0266.mjs";
|
|
2
|
+
import { t as capabilitiesToDeclaredAccess } from "./types-D17dJRht.mjs";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
import { imageSize } from "image-size";
|
|
5
5
|
import { createWriteStream } from "node:fs";
|
|
6
6
|
import { basename, extname, join, resolve } from "node:path";
|
|
7
7
|
import { pathToFileURL } from "node:url";
|
|
8
|
+
import { access, copyFile, mkdir, readFile, readdir, rm, stat, symlink, writeFile } from "node:fs/promises";
|
|
8
9
|
import { defineCommand } from "citty";
|
|
9
10
|
import consola from "consola";
|
|
10
|
-
import { access, copyFile, mkdir, readFile, readdir, rm, stat, symlink, writeFile } from "node:fs/promises";
|
|
11
11
|
import { pipeline } from "node:stream/promises";
|
|
12
12
|
import { packTar } from "modern-tar/fs";
|
|
13
13
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
8
|
-
import { i as setRequestCacheEntry, n as peekRequestCache, t as clearRequestCacheEntry } from "./request-cache-
|
|
9
|
-
import { n as getBylineFieldDefs } from "./field-defs-cache-
|
|
1
|
+
import { c as __exportAll } from "./runner-CVeq0266.mjs";
|
|
2
|
+
import { atomicBatch, rowUnchanged } from "./database/batch.mjs";
|
|
3
|
+
import { t as validateIdentifier } from "./validate-Co3j6T_K.mjs";
|
|
4
|
+
import { l as listTablesLike } from "./dialect-helpers-C6xtO-Ui.mjs";
|
|
5
|
+
import { i as encodeCursor, r as decodeCursor, t as DinewayValidationError } from "./types-BqxIv8Il.mjs";
|
|
6
|
+
import { a as invalidateBylineObjectCache, o as invalidateCollectionCache } from "./object-cache-BGjIlY9s.mjs";
|
|
7
|
+
import { n as chunks, t as SQL_BATCH_SIZE } from "./chunks-BnG3LPMN.mjs";
|
|
8
|
+
import { i as setRequestCacheEntry, n as peekRequestCache, t as clearRequestCacheEntry } from "./request-cache-DPmV5nk4.mjs";
|
|
9
|
+
import { n as getBylineFieldDefs } from "./field-defs-cache-BKKFFf_V.mjs";
|
|
10
10
|
import { sql } from "kysely";
|
|
11
11
|
import { ulid } from "ulidx";
|
|
12
12
|
|
|
@@ -214,45 +214,29 @@ var BylineRepository = class {
|
|
|
214
214
|
}
|
|
215
215
|
return writes;
|
|
216
216
|
}
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
prepareCustomFields(bylineId, translationGroup, writes, now) {
|
|
218
|
+
const checks = [];
|
|
219
|
+
const statements = [];
|
|
219
220
|
for (const { field, value } of writes) {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
value: encoded,
|
|
235
|
-
updated_at: now
|
|
236
|
-
})).execute();
|
|
237
|
-
continue;
|
|
238
|
-
}
|
|
239
|
-
if (value === null) {
|
|
240
|
-
await trx.deleteFrom("_dineway_byline_field_group_values").where("translation_group", "=", translationGroup).where("field_id", "=", field.id).execute();
|
|
241
|
-
continue;
|
|
242
|
-
}
|
|
243
|
-
const encoded = JSON.stringify(value);
|
|
244
|
-
await trx.insertInto("_dineway_byline_field_group_values").values({
|
|
245
|
-
translation_group: translationGroup,
|
|
246
|
-
field_id: field.id,
|
|
247
|
-
value: encoded,
|
|
248
|
-
created_at: now,
|
|
249
|
-
updated_at: now
|
|
250
|
-
}).onConflict((oc) => oc.columns(["translation_group", "field_id"]).doUpdateSet({
|
|
251
|
-
value: encoded,
|
|
252
|
-
updated_at: now
|
|
253
|
-
})).execute();
|
|
221
|
+
checks.push(rowUnchanged("_dineway_byline_fields", {
|
|
222
|
+
id: field.id,
|
|
223
|
+
type: field.type,
|
|
224
|
+
required: field.required ? 1 : 0,
|
|
225
|
+
translatable: field.translatable ? 1 : 0,
|
|
226
|
+
validation: field.validation ? JSON.stringify(field.validation) : null
|
|
227
|
+
}));
|
|
228
|
+
const table = field.translatable ? "_dineway_byline_field_values" : "_dineway_byline_field_group_values";
|
|
229
|
+
const owner = field.translatable ? "byline_id" : "translation_group";
|
|
230
|
+
const ownerId = field.translatable ? bylineId : translationGroup;
|
|
231
|
+
if (value === null) statements.push(sql`DELETE FROM ${sql.table(table)} WHERE ${sql.ref(owner)} = ${ownerId} AND field_id = ${field.id}`.compile(this.db));
|
|
232
|
+
else statements.push(sql`INSERT INTO ${sql.table(table)} (${sql.ref(owner)}, field_id, value, created_at, updated_at)
|
|
233
|
+
VALUES (${ownerId}, ${field.id}, ${JSON.stringify(value)}, ${now}, ${now})
|
|
234
|
+
ON CONFLICT (${sql.ref(owner)}, field_id) DO UPDATE SET value = excluded.value, updated_at = excluded.updated_at`.compile(this.db));
|
|
254
235
|
}
|
|
255
|
-
return
|
|
236
|
+
return {
|
|
237
|
+
checks,
|
|
238
|
+
statements
|
|
239
|
+
};
|
|
256
240
|
}
|
|
257
241
|
async findById(id) {
|
|
258
242
|
const row = await this.db.selectFrom("_dineway_bylines").selectAll().where("id", "=", id).executeTakeFirst();
|
|
@@ -310,15 +294,13 @@ var BylineRepository = class {
|
|
|
310
294
|
const id = ulid();
|
|
311
295
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
312
296
|
const customFieldWrites = await this.resolveCustomFieldWrites(input.customFields);
|
|
313
|
-
|
|
314
|
-
if (input.translationOf)
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
await withTransaction(this.db, async (trx) => {
|
|
321
|
-
await trx.insertInto("_dineway_bylines").values({
|
|
297
|
+
const source = input.translationOf ? await this.db.selectFrom("_dineway_bylines").selectAll().where("id", "=", input.translationOf).executeTakeFirst() : null;
|
|
298
|
+
if (input.translationOf && !source) throw new Error("Source byline for translation not found");
|
|
299
|
+
const translationGroup = source?.translation_group ?? source?.id ?? id;
|
|
300
|
+
const fields = this.prepareCustomFields(id, translationGroup, customFieldWrites, now);
|
|
301
|
+
await atomicBatch(this.db, {
|
|
302
|
+
checks: [...source ? [rowUnchanged("_dineway_bylines", source)] : [], ...fields.checks ?? []],
|
|
303
|
+
statements: [this.db.insertInto("_dineway_bylines").values({
|
|
322
304
|
id,
|
|
323
305
|
slug: input.slug,
|
|
324
306
|
display_name: input.displayName,
|
|
@@ -331,17 +313,16 @@ var BylineRepository = class {
|
|
|
331
313
|
updated_at: now,
|
|
332
314
|
...input.locale !== void 0 ? { locale: input.locale } : {},
|
|
333
315
|
translation_group: translationGroup
|
|
334
|
-
}).
|
|
335
|
-
touchedGroupShared = await this.writeCustomFields(trx, id, translationGroup, customFieldWrites, now);
|
|
316
|
+
}).compile(), ...fields.statements]
|
|
336
317
|
});
|
|
337
|
-
if (
|
|
318
|
+
if (customFieldWrites.some(({ field }) => !field.translatable)) clearRequestCacheEntry(`byline-field-group-values:${translationGroup}`);
|
|
338
319
|
invalidateBylineObjectCache();
|
|
339
320
|
const byline = await this.findById(id);
|
|
340
321
|
if (!byline) throw new Error("Failed to create byline");
|
|
341
322
|
return byline;
|
|
342
323
|
}
|
|
343
324
|
async update(id, input) {
|
|
344
|
-
const existing = await this.
|
|
325
|
+
const existing = await this.db.selectFrom("_dineway_bylines").selectAll().where("id", "=", id).executeTakeFirst();
|
|
345
326
|
if (!existing) return null;
|
|
346
327
|
const customFieldWrites = await this.resolveCustomFieldWrites(input.customFields);
|
|
347
328
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -353,39 +334,39 @@ var BylineRepository = class {
|
|
|
353
334
|
if (input.websiteUrl !== void 0) updates.website_url = input.websiteUrl;
|
|
354
335
|
if (input.userId !== void 0) updates.user_id = input.userId;
|
|
355
336
|
if (input.isGuest !== void 0) updates.is_guest = input.isGuest ? 1 : 0;
|
|
356
|
-
const group = existing.
|
|
357
|
-
|
|
358
|
-
await
|
|
359
|
-
|
|
360
|
-
|
|
337
|
+
const group = existing.translation_group ?? existing.id;
|
|
338
|
+
const fields = this.prepareCustomFields(id, group, customFieldWrites, now);
|
|
339
|
+
await atomicBatch(this.db, {
|
|
340
|
+
checks: [rowUnchanged("_dineway_bylines", existing), ...fields.checks ?? []],
|
|
341
|
+
statements: [this.db.updateTable("_dineway_bylines").set(updates).where("id", "=", id).compile(), ...fields.statements]
|
|
361
342
|
});
|
|
362
|
-
if (
|
|
343
|
+
if (customFieldWrites.some(({ field }) => !field.translatable)) clearRequestCacheEntry(`byline-field-group-values:${group}`);
|
|
363
344
|
invalidateBylineObjectCache();
|
|
364
345
|
return await this.findById(id);
|
|
365
346
|
}
|
|
366
347
|
async delete(id) {
|
|
367
|
-
const existing = await this.
|
|
348
|
+
const existing = await this.db.selectFrom("_dineway_bylines").selectAll().where("id", "=", id).executeTakeFirst();
|
|
368
349
|
if (!existing) return false;
|
|
369
|
-
const group = existing.
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
}
|
|
350
|
+
const group = existing.translation_group ?? existing.id;
|
|
351
|
+
const noTranslation = sql`NOT EXISTS (SELECT 1 FROM _dineway_bylines WHERE translation_group = ${group})`;
|
|
352
|
+
const statements = [
|
|
353
|
+
this.db.deleteFrom("_dineway_byline_field_values").where("byline_id", "=", id).compile(),
|
|
354
|
+
this.db.deleteFrom("_dineway_bylines").where("id", "=", id).compile(),
|
|
355
|
+
this.db.deleteFrom("_dineway_content_bylines").where("byline_id", "=", group).where(noTranslation).compile(),
|
|
356
|
+
this.db.deleteFrom("_dineway_byline_field_group_values").where("translation_group", "=", group).where(noTranslation).compile()
|
|
357
|
+
];
|
|
358
|
+
const tableNames = await listTablesLike(this.db, "ec_%");
|
|
359
|
+
for (const tableName of tableNames) {
|
|
360
|
+
validateIdentifier(tableName, "content table");
|
|
361
|
+
statements.push(sql`UPDATE ${sql.table(tableName)} SET primary_byline_id = NULL WHERE primary_byline_id = ${group} AND ${noTranslation}`.compile(this.db));
|
|
362
|
+
}
|
|
363
|
+
await atomicBatch(this.db, {
|
|
364
|
+
checks: [rowUnchanged("_dineway_bylines", existing)],
|
|
365
|
+
statements
|
|
386
366
|
});
|
|
387
367
|
clearRequestCacheEntry(`byline-field-group-values:${group}`);
|
|
388
368
|
invalidateBylineObjectCache();
|
|
369
|
+
for (const tableName of tableNames) invalidateCollectionCache(tableName.slice(3));
|
|
389
370
|
return true;
|
|
390
371
|
}
|
|
391
372
|
async getContentBylines(collectionSlug, contentId, options) {
|
|
@@ -517,44 +498,50 @@ var BylineRepository = class {
|
|
|
517
498
|
}
|
|
518
499
|
return result;
|
|
519
500
|
}
|
|
520
|
-
async
|
|
501
|
+
async prepareCopyContentBylines(collectionSlug, sourceContentId, targetContentId) {
|
|
521
502
|
validateIdentifier(collectionSlug, "collection slug");
|
|
522
|
-
const
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
"
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
if (sourceRows.length === 0) return;
|
|
531
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
532
|
-
await this.db.insertInto("_dineway_content_bylines").values(sourceRows.map((row) => ({
|
|
503
|
+
const source = await this.db.selectFrom("_dineway_content_bylines").selectAll().where("collection_slug", "=", collectionSlug).where("content_id", "=", sourceContentId).orderBy("sort_order", "asc").execute();
|
|
504
|
+
const checks = [
|
|
505
|
+
sql`NOT EXISTS (SELECT 1 FROM _dineway_content_bylines WHERE collection_slug = ${collectionSlug} AND content_id = ${targetContentId})`,
|
|
506
|
+
sql`(SELECT COUNT(*) FROM _dineway_content_bylines WHERE collection_slug = ${collectionSlug} AND content_id = ${sourceContentId}) = ${source.length}`,
|
|
507
|
+
...source.map((row) => rowUnchanged("_dineway_content_bylines", row))
|
|
508
|
+
];
|
|
509
|
+
const statements = source.map((row) => this.db.insertInto("_dineway_content_bylines").values({
|
|
510
|
+
...row,
|
|
533
511
|
id: ulid(),
|
|
534
|
-
collection_slug: collectionSlug,
|
|
535
512
|
content_id: targetContentId,
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
513
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
514
|
+
}).compile());
|
|
515
|
+
if (source.length) statements.push(sql`UPDATE ${sql.table(`ec_${collectionSlug}`)} SET primary_byline_id = ${source[0].byline_id} WHERE id = ${targetContentId}`.compile(this.db));
|
|
516
|
+
return {
|
|
517
|
+
checks,
|
|
518
|
+
statements
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
async copyContentBylines(collectionSlug, sourceContentId, targetContentId) {
|
|
522
|
+
if (await this.db.selectFrom("_dineway_content_bylines").select("id").where("collection_slug", "=", collectionSlug).where("content_id", "=", targetContentId).executeTakeFirst()) return;
|
|
523
|
+
const prepared = await this.prepareCopyContentBylines(collectionSlug, sourceContentId, targetContentId);
|
|
524
|
+
await atomicBatch(this.db, {
|
|
525
|
+
...prepared,
|
|
526
|
+
checks: [...prepared.checks ?? [], sql`EXISTS (SELECT 1 FROM ${sql.table(`ec_${collectionSlug}`)} WHERE id = ${targetContentId} AND deleted_at IS NULL)`]
|
|
527
|
+
});
|
|
546
528
|
invalidateCollectionCache(collectionSlug);
|
|
547
529
|
}
|
|
548
|
-
async
|
|
530
|
+
async prepareContentBylines(collectionSlug, contentId, inputBylines) {
|
|
549
531
|
validateIdentifier(collectionSlug, "collection slug");
|
|
550
532
|
const tableName = `ec_${collectionSlug}`;
|
|
551
533
|
validateIdentifier(tableName, "content table");
|
|
534
|
+
const checks = [];
|
|
535
|
+
const statements = [];
|
|
552
536
|
const idToGroup = /* @__PURE__ */ new Map();
|
|
553
537
|
if (inputBylines.length > 0) {
|
|
554
538
|
const ids = [...new Set(inputBylines.map((item) => item.bylineId))];
|
|
555
539
|
const rows = await this.db.selectFrom("_dineway_bylines").select(["id", "translation_group"]).where("id", "in", ids).execute();
|
|
556
540
|
if (rows.length !== ids.length) throw new Error("One or more byline IDs do not exist");
|
|
557
|
-
for (const row of rows)
|
|
541
|
+
for (const row of rows) {
|
|
542
|
+
idToGroup.set(row.id, row.translation_group ?? row.id);
|
|
543
|
+
checks.push(rowUnchanged("_dineway_bylines", row));
|
|
544
|
+
}
|
|
558
545
|
}
|
|
559
546
|
const seenGroups = /* @__PURE__ */ new Set();
|
|
560
547
|
const bylines = [];
|
|
@@ -568,11 +555,11 @@ var BylineRepository = class {
|
|
|
568
555
|
group
|
|
569
556
|
});
|
|
570
557
|
}
|
|
571
|
-
|
|
558
|
+
statements.push(this.db.deleteFrom("_dineway_content_bylines").where("collection_slug", "=", collectionSlug).where("content_id", "=", contentId).compile());
|
|
572
559
|
for (let i = 0; i < bylines.length; i++) {
|
|
573
560
|
const item = bylines[i];
|
|
574
561
|
if (!item) continue;
|
|
575
|
-
|
|
562
|
+
statements.push(this.db.insertInto("_dineway_content_bylines").values({
|
|
576
563
|
id: ulid(),
|
|
577
564
|
collection_slug: collectionSlug,
|
|
578
565
|
content_id: contentId,
|
|
@@ -580,13 +567,20 @@ var BylineRepository = class {
|
|
|
580
567
|
sort_order: i,
|
|
581
568
|
role_label: item.roleLabel ?? null,
|
|
582
569
|
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
583
|
-
}).
|
|
570
|
+
}).compile());
|
|
584
571
|
}
|
|
585
|
-
|
|
572
|
+
statements.push(sql`
|
|
586
573
|
UPDATE ${sql.ref(tableName)}
|
|
587
574
|
SET primary_byline_id = ${bylines[0]?.group ?? null}
|
|
588
575
|
WHERE id = ${contentId}
|
|
589
|
-
`.
|
|
576
|
+
`.compile(this.db));
|
|
577
|
+
return {
|
|
578
|
+
checks,
|
|
579
|
+
statements
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
async setContentBylines(collectionSlug, contentId, inputBylines) {
|
|
583
|
+
await atomicBatch(this.db, await this.prepareContentBylines(collectionSlug, contentId, inputBylines));
|
|
590
584
|
invalidateCollectionCache(collectionSlug);
|
|
591
585
|
return await this.getContentBylines(collectionSlug, contentId);
|
|
592
586
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as RESERVED_BYLINE_FIELD_SLUGS } from "./types-
|
|
2
|
-
import { n as isSiteContextType, t as SITE_CONTEXT_TYPES } from "./context-types-
|
|
3
|
-
import { Ln as roleLevel, Nn as httpUrl } from "./redirects-
|
|
1
|
+
import { i as RESERVED_BYLINE_FIELD_SLUGS } from "./types-CyBH89BS.mjs";
|
|
2
|
+
import { n as isSiteContextType, t as SITE_CONTEXT_TYPES } from "./context-types-DqTo6C79.mjs";
|
|
3
|
+
import { Ln as roleLevel, Nn as httpUrl } from "./redirects-UCXyL0lP.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
|
|
6
6
|
//#region src/api/schemas/context.ts
|
|
@@ -807,8 +807,8 @@ declare const createCollectionBody: z.ZodObject<{
|
|
|
807
807
|
icon: z.ZodOptional<z.ZodString>;
|
|
808
808
|
supports: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
809
809
|
search: "search";
|
|
810
|
-
drafts: "drafts";
|
|
811
810
|
revisions: "revisions";
|
|
811
|
+
drafts: "drafts";
|
|
812
812
|
preview: "preview";
|
|
813
813
|
scheduling: "scheduling";
|
|
814
814
|
}>>>;
|
|
@@ -828,8 +828,8 @@ declare const updateCollectionBody: z.ZodObject<{
|
|
|
828
828
|
icon: z.ZodOptional<z.ZodString>;
|
|
829
829
|
supports: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
830
830
|
search: "search";
|
|
831
|
-
drafts: "drafts";
|
|
832
831
|
revisions: "revisions";
|
|
832
|
+
drafts: "drafts";
|
|
833
833
|
preview: "preview";
|
|
834
834
|
scheduling: "scheduling";
|
|
835
835
|
}>>>;
|
|
@@ -856,9 +856,9 @@ declare const createFieldBody: z.ZodObject<{
|
|
|
856
856
|
string: "string";
|
|
857
857
|
number: "number";
|
|
858
858
|
boolean: "boolean";
|
|
859
|
+
file: "file";
|
|
859
860
|
json: "json";
|
|
860
861
|
url: "url";
|
|
861
|
-
file: "file";
|
|
862
862
|
slug: "slug";
|
|
863
863
|
image: "image";
|
|
864
864
|
datetime: "datetime";
|
|
@@ -914,9 +914,9 @@ declare const updateFieldBody: z.ZodObject<{
|
|
|
914
914
|
string: "string";
|
|
915
915
|
number: "number";
|
|
916
916
|
boolean: "boolean";
|
|
917
|
+
file: "file";
|
|
917
918
|
json: "json";
|
|
918
919
|
url: "url";
|
|
919
|
-
file: "file";
|
|
920
920
|
slug: "slug";
|
|
921
921
|
image: "image";
|
|
922
922
|
datetime: "datetime";
|
|
@@ -1008,9 +1008,9 @@ declare const fieldSchema: z.ZodObject<{
|
|
|
1008
1008
|
string: "string";
|
|
1009
1009
|
number: "number";
|
|
1010
1010
|
boolean: "boolean";
|
|
1011
|
+
file: "file";
|
|
1011
1012
|
json: "json";
|
|
1012
1013
|
url: "url";
|
|
1013
|
-
file: "file";
|
|
1014
1014
|
slug: "slug";
|
|
1015
1015
|
image: "image";
|
|
1016
1016
|
datetime: "datetime";
|
|
@@ -1083,9 +1083,9 @@ declare const collectionWithFieldsResponseSchema: z.ZodObject<{
|
|
|
1083
1083
|
string: "string";
|
|
1084
1084
|
number: "number";
|
|
1085
1085
|
boolean: "boolean";
|
|
1086
|
+
file: "file";
|
|
1086
1087
|
json: "json";
|
|
1087
1088
|
url: "url";
|
|
1088
|
-
file: "file";
|
|
1089
1089
|
slug: "slug";
|
|
1090
1090
|
image: "image";
|
|
1091
1091
|
datetime: "datetime";
|
|
@@ -1142,9 +1142,9 @@ declare const fieldResponseSchema: z.ZodObject<{
|
|
|
1142
1142
|
string: "string";
|
|
1143
1143
|
number: "number";
|
|
1144
1144
|
boolean: "boolean";
|
|
1145
|
+
file: "file";
|
|
1145
1146
|
json: "json";
|
|
1146
1147
|
url: "url";
|
|
1147
|
-
file: "file";
|
|
1148
1148
|
slug: "slug";
|
|
1149
1149
|
image: "image";
|
|
1150
1150
|
datetime: "datetime";
|
|
@@ -1179,9 +1179,9 @@ declare const fieldListResponseSchema: z.ZodObject<{
|
|
|
1179
1179
|
string: "string";
|
|
1180
1180
|
number: "number";
|
|
1181
1181
|
boolean: "boolean";
|
|
1182
|
+
file: "file";
|
|
1182
1183
|
json: "json";
|
|
1183
1184
|
url: "url";
|
|
1184
|
-
file: "file";
|
|
1185
1185
|
slug: "slug";
|
|
1186
1186
|
image: "image";
|
|
1187
1187
|
datetime: "datetime";
|
|
@@ -1637,9 +1637,9 @@ declare const authMeActionBody: z.ZodObject<{
|
|
|
1637
1637
|
* from `referenceCollection` + `referenceId` (a translation_group id).
|
|
1638
1638
|
*/
|
|
1639
1639
|
declare const menuItemTypeEnum: z.ZodEnum<{
|
|
1640
|
+
custom: "custom";
|
|
1640
1641
|
collection: "collection";
|
|
1641
1642
|
taxonomy: "taxonomy";
|
|
1642
|
-
custom: "custom";
|
|
1643
1643
|
page: "page";
|
|
1644
1644
|
post: "post";
|
|
1645
1645
|
}>;
|
|
@@ -1654,9 +1654,9 @@ declare const updateMenuBody: z.ZodObject<{
|
|
|
1654
1654
|
}, z.core.$strict>;
|
|
1655
1655
|
declare const createMenuItemBody: z.ZodObject<{
|
|
1656
1656
|
type: z.ZodEnum<{
|
|
1657
|
+
custom: "custom";
|
|
1657
1658
|
collection: "collection";
|
|
1658
1659
|
taxonomy: "taxonomy";
|
|
1659
|
-
custom: "custom";
|
|
1660
1660
|
page: "page";
|
|
1661
1661
|
post: "post";
|
|
1662
1662
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as BylineSchemaRegistry, r as mapBylineSchemaError, t as BylineSchemaError } from "./byline-registry-
|
|
1
|
+
import { n as BylineSchemaRegistry, r as mapBylineSchemaError, t as BylineSchemaError } from "./byline-registry-CkuVVeJJ.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/api/handlers/byline-fields.ts
|
|
4
4
|
function bylineSchemaErrorResult(error) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import { i as RESERVED_BYLINE_FIELD_SLUGS, t as BYLINE_FIELD_TYPES } from "./types-
|
|
1
|
+
import { atomicBatch, rowUnchanged } from "./database/batch.mjs";
|
|
2
|
+
import { t as validateIdentifier } from "./validate-Co3j6T_K.mjs";
|
|
3
|
+
import { i as RESERVED_BYLINE_FIELD_SLUGS, t as BYLINE_FIELD_TYPES } from "./types-CyBH89BS.mjs";
|
|
4
4
|
import { sql } from "kysely";
|
|
5
5
|
import { ulid } from "ulidx";
|
|
6
6
|
|
|
@@ -63,36 +63,27 @@ var BylineSchemaRegistry = class {
|
|
|
63
63
|
this.validateLabel(input.label);
|
|
64
64
|
this.validateType(input.type);
|
|
65
65
|
const validation = this.normaliseValidation(input.type, input.validation ?? null);
|
|
66
|
-
if (await this.getField(input.slug)) {
|
|
67
|
-
await this.markVersionClean();
|
|
68
|
-
throw new BylineSchemaError(`Byline field "${input.slug}" already exists`, "FIELD_EXISTS", { slug: input.slug });
|
|
69
|
-
}
|
|
66
|
+
if (await this.getField(input.slug)) throw new BylineSchemaError(`Byline field "${input.slug}" already exists`, "FIELD_EXISTS", { slug: input.slug });
|
|
70
67
|
const id = ulid();
|
|
71
|
-
const sortOrder = input.sortOrder ??
|
|
72
|
-
await this.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
sort_order: sortOrder
|
|
83
|
-
}).execute();
|
|
84
|
-
});
|
|
85
|
-
await this.markVersionClean();
|
|
68
|
+
const sortOrder = input.sortOrder ?? sql`(SELECT COALESCE(MAX(sort_order), -1) + 1 FROM _dineway_byline_fields)`;
|
|
69
|
+
await atomicBatch(this.db, { statements: [this.db.insertInto("_dineway_byline_fields").values({
|
|
70
|
+
id,
|
|
71
|
+
slug: input.slug,
|
|
72
|
+
label: input.label,
|
|
73
|
+
type: input.type,
|
|
74
|
+
required: input.required ? 1 : 0,
|
|
75
|
+
translatable: input.translatable === false ? 0 : 1,
|
|
76
|
+
validation: validation ? JSON.stringify(validation) : null,
|
|
77
|
+
sort_order: sortOrder
|
|
78
|
+
}).compile(), this.prepareVersionClean()] });
|
|
86
79
|
const created = await this.getFieldById(id);
|
|
87
80
|
if (!created) throw new BylineSchemaError("Failed to load created byline field", "FIELD_NOT_FOUND", { id });
|
|
88
81
|
return created;
|
|
89
82
|
}
|
|
90
83
|
async updateField(slug, input) {
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
throw new BylineSchemaError(`Byline field "${slug}" not found`, "FIELD_NOT_FOUND", { slug });
|
|
95
|
-
}
|
|
84
|
+
const row = await this.db.selectFrom("_dineway_byline_fields").selectAll().where("slug", "=", slug).executeTakeFirst();
|
|
85
|
+
const field = row ? mapFieldRow(row) : null;
|
|
86
|
+
if (!row || !field) throw new BylineSchemaError(`Byline field "${slug}" not found`, "FIELD_NOT_FOUND", { slug });
|
|
96
87
|
const updates = {};
|
|
97
88
|
if (input.label !== void 0) {
|
|
98
89
|
this.validateLabel(input.label);
|
|
@@ -112,55 +103,49 @@ var BylineSchemaRegistry = class {
|
|
|
112
103
|
updates.translatable = input.translatable ? 1 : 0;
|
|
113
104
|
}
|
|
114
105
|
if (input.sortOrder !== void 0) updates.sort_order = input.sortOrder;
|
|
115
|
-
if (Object.keys(updates).length === 0)
|
|
116
|
-
await this.markVersionClean();
|
|
117
|
-
return field;
|
|
118
|
-
}
|
|
106
|
+
if (Object.keys(updates).length === 0) return field;
|
|
119
107
|
updates.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
108
|
+
const checks = [rowUnchanged("_dineway_byline_fields", row)];
|
|
109
|
+
if (updates.translatable !== void 0) checks.push(sql`NOT EXISTS (SELECT 1 FROM _dineway_byline_field_values WHERE field_id = ${field.id}) AND NOT EXISTS (SELECT 1 FROM _dineway_byline_field_group_values WHERE field_id = ${field.id})`);
|
|
110
|
+
await atomicBatch(this.db, {
|
|
111
|
+
checks,
|
|
112
|
+
statements: [this.db.updateTable("_dineway_byline_fields").set(updates).where("id", "=", field.id).compile(), this.prepareVersionClean()]
|
|
123
113
|
});
|
|
124
|
-
await this.markVersionClean();
|
|
125
114
|
const updated = await this.getFieldById(field.id);
|
|
126
115
|
if (!updated) throw new BylineSchemaError("Failed to load updated byline field", "FIELD_NOT_FOUND", { slug });
|
|
127
116
|
return updated;
|
|
128
117
|
}
|
|
129
118
|
async deleteField(slug) {
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
119
|
+
const row = await this.db.selectFrom("_dineway_byline_fields").selectAll().where("slug", "=", slug).executeTakeFirst();
|
|
120
|
+
const field = row ? mapFieldRow(row) : null;
|
|
121
|
+
if (!row || !field) throw new BylineSchemaError(`Byline field "${slug}" not found`, "FIELD_NOT_FOUND", { slug });
|
|
122
|
+
await atomicBatch(this.db, {
|
|
123
|
+
checks: [rowUnchanged("_dineway_byline_fields", row)],
|
|
124
|
+
statements: [
|
|
125
|
+
this.db.deleteFrom("_dineway_byline_field_values").where("field_id", "=", field.id).compile(),
|
|
126
|
+
this.db.deleteFrom("_dineway_byline_field_group_values").where("field_id", "=", field.id).compile(),
|
|
127
|
+
this.db.deleteFrom("_dineway_byline_fields").where("id", "=", field.id).compile(),
|
|
128
|
+
this.prepareVersionClean()
|
|
129
|
+
]
|
|
140
130
|
});
|
|
141
|
-
await this.markVersionClean();
|
|
142
131
|
}
|
|
143
132
|
async reorderFields(slugs) {
|
|
144
133
|
if (new Set(slugs).size !== slugs.length) throw new BylineSchemaError("Reorder input contains duplicate slugs", "REORDER_MISMATCH", { slugs });
|
|
145
|
-
const
|
|
134
|
+
const rows = await this.db.selectFrom("_dineway_byline_fields").selectAll().execute();
|
|
135
|
+
const registeredSlugs = rows.map(mapFieldRow).map((field) => field.slug).toSorted();
|
|
146
136
|
const inputSlugs = slugs.toSorted();
|
|
147
137
|
if (registeredSlugs.length !== inputSlugs.length || registeredSlugs.some((slug, index) => slug !== inputSlugs[index])) throw new BylineSchemaError("Reorder input does not match the registered byline field set", "REORDER_MISMATCH", {
|
|
148
138
|
registered: registeredSlugs,
|
|
149
139
|
input: inputSlugs
|
|
150
140
|
});
|
|
151
141
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
152
|
-
await this.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
sort_order: index,
|
|
159
|
-
updated_at: now
|
|
160
|
-
}).where("slug", "=", slug).execute();
|
|
161
|
-
}
|
|
142
|
+
await atomicBatch(this.db, {
|
|
143
|
+
checks: [sql`(SELECT COUNT(*) FROM _dineway_byline_fields) = ${rows.length}`, ...rows.map((row) => rowUnchanged("_dineway_byline_fields", row))],
|
|
144
|
+
statements: [...slugs.map((slug, index) => this.db.updateTable("_dineway_byline_fields").set({
|
|
145
|
+
sort_order: index,
|
|
146
|
+
updated_at: now
|
|
147
|
+
}).where("slug", "=", slug).compile()), this.prepareVersionClean()]
|
|
162
148
|
});
|
|
163
|
-
await this.markVersionClean();
|
|
164
149
|
}
|
|
165
150
|
async getFieldUsage(slug) {
|
|
166
151
|
const field = await this.getField(slug);
|
|
@@ -181,19 +166,8 @@ var BylineSchemaRegistry = class {
|
|
|
181
166
|
const parsed = Number.parseInt(row.value, 10);
|
|
182
167
|
return Number.isFinite(parsed) ? parsed : 0;
|
|
183
168
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
INSERT INTO options (name, value)
|
|
187
|
-
VALUES (${VERSION_KEY}, '1')
|
|
188
|
-
ON CONFLICT(name) DO UPDATE SET value = CASE
|
|
189
|
-
WHEN CAST(options.value AS INTEGER) % 2 = 0
|
|
190
|
-
THEN CAST(CAST(options.value AS INTEGER) + 1 AS TEXT)
|
|
191
|
-
ELSE options.value
|
|
192
|
-
END
|
|
193
|
-
`.execute(this.db);
|
|
194
|
-
}
|
|
195
|
-
async markVersionClean() {
|
|
196
|
-
await sql`
|
|
169
|
+
prepareVersionClean() {
|
|
170
|
+
return sql`
|
|
197
171
|
INSERT INTO options (name, value)
|
|
198
172
|
VALUES (${VERSION_KEY}, '2')
|
|
199
173
|
ON CONFLICT(name) DO UPDATE SET value = CASE
|
|
@@ -201,11 +175,7 @@ var BylineSchemaRegistry = class {
|
|
|
201
175
|
THEN CAST(CAST(options.value AS INTEGER) + 2 AS TEXT)
|
|
202
176
|
ELSE CAST(CAST(options.value AS INTEGER) + 1 AS TEXT)
|
|
203
177
|
END
|
|
204
|
-
`.
|
|
205
|
-
}
|
|
206
|
-
async nextSortOrder() {
|
|
207
|
-
const row = await this.db.selectFrom("_dineway_byline_fields").select(({ fn }) => [fn.max("sort_order").as("max")]).executeTakeFirst();
|
|
208
|
-
return row?.max == null ? 0 : row.max + 1;
|
|
178
|
+
`.compile(this.db);
|
|
209
179
|
}
|
|
210
180
|
async countFieldValues(fieldId) {
|
|
211
181
|
const translatable = await this.db.selectFrom("_dineway_byline_field_values").select(({ fn }) => [fn.count("field_id").as("count")]).where("field_id", "=", fieldId).executeTakeFirst();
|