dineway 0.2.0 → 0.2.2
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/README.md +17 -17
- package/dist/activity-BDMlkpYY.mjs +79 -0
- package/dist/{activity-events-y6eT8UW6.mjs → activity-events-DEYmJhWd.mjs} +1 -77
- package/dist/{actor-CrObAPV0.mjs → actor-DA7yL9Yp.mjs} +1 -1
- package/dist/{allowed-origins-_oeyP6x-.mjs → allowed-origins-VLgv2PL1.mjs} +1 -1
- package/dist/api/route-utils.d.mts +9 -10
- package/dist/api/route-utils.mjs +14 -14
- package/dist/api/schemas/index.d.mts +2 -2
- package/dist/api/schemas/index.mjs +5 -5
- package/dist/{api-ByrU2q-Z.mjs → api-DsO87Qak.mjs} +51 -23
- package/dist/{api-tokens-CjVMQT-X.mjs → api-tokens-C4K9eocv.mjs} +1 -1
- package/dist/{apply-bZswmZPm.mjs → apply-DHT0l398.mjs} +19 -19
- package/dist/astro/index.d.mts +10 -11
- package/dist/astro/index.mjs +18 -5
- package/dist/astro/middleware/auth.d.mts +9 -19
- package/dist/astro/middleware/auth.mjs +6 -6
- package/dist/astro/middleware/redirect.mjs +5 -5
- package/dist/astro/middleware/request-context.mjs +2 -2
- package/dist/astro/middleware/seed.d.mts +1 -1
- package/dist/astro/middleware/seed.mjs +1 -1
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware.mjs +142 -98
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +6 -6
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +6 -6
- package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +4 -4
- package/dist/astro/routes/api/admin/api-tokens/index.mjs +6 -6
- package/dist/astro/routes/api/admin/briefing.mjs +18 -18
- package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +4 -4
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +9 -9
- package/dist/astro/routes/api/admin/byline-fields/index.mjs +9 -9
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +9 -9
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +16 -16
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +16 -16
- package/dist/astro/routes/api/admin/bylines/index.mjs +16 -16
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +12 -12
- package/dist/astro/routes/api/admin/comments/_id_.mjs +5 -5
- package/dist/astro/routes/api/admin/comments/bulk.mjs +10 -10
- package/dist/astro/routes/api/admin/comments/counts.mjs +5 -5
- package/dist/astro/routes/api/admin/comments/index.mjs +10 -10
- package/dist/astro/routes/api/admin/context/_id_/history.mjs +25 -24
- package/dist/astro/routes/api/admin/context/_id_/index.mjs +25 -24
- package/dist/astro/routes/api/admin/context/_id_/review.mjs +30 -29
- package/dist/astro/routes/api/admin/context/_id_/supersede.mjs +30 -29
- package/dist/astro/routes/api/admin/context/diff.mjs +29 -28
- package/dist/astro/routes/api/admin/context/index.mjs +30 -29
- package/dist/astro/routes/api/admin/context/stale.mjs +29 -28
- package/dist/astro/routes/api/admin/hitl-requests/_id_/index.mjs +25 -24
- package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.mjs +29 -28
- package/dist/astro/routes/api/admin/hitl-requests/index.mjs +29 -28
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +26 -25
- package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +2 -2
- 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 +55 -51
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +55 -51
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +47 -44
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +54 -50
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +54 -50
- package/dist/astro/routes/api/admin/plugins/index.mjs +47 -44
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +2 -2
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +47 -44
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +54 -50
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +47 -44
- package/dist/astro/routes/api/admin/plugins/updates.mjs +47 -44
- package/dist/astro/routes/api/admin/review-requests/_id_/index.mjs +5 -5
- package/dist/astro/routes/api/admin/review-requests/_id_/resolve.mjs +30 -65
- package/dist/astro/routes/api/admin/review-requests/index.d.mts +2 -1
- package/dist/astro/routes/api/admin/review-requests/index.mjs +58 -11
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +47 -44
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +2 -2
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +47 -44
- package/dist/astro/routes/api/admin/users/_id_/disable.mjs +2 -2
- package/dist/astro/routes/api/admin/users/_id_/enable.mjs +1 -1
- package/dist/astro/routes/api/admin/users/_id_/index.mjs +7 -7
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +2 -2
- package/dist/astro/routes/api/admin/users/index.mjs +6 -6
- package/dist/astro/routes/api/auth/dev-bypass.mjs +4 -4
- 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 +8 -8
- 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 +6 -6
- 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/setup-token/index.mjs +5 -5
- package/dist/astro/routes/api/auth/setup-token/verify.mjs +2 -2
- package/dist/astro/routes/api/auth/signup/complete.mjs +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 +13 -13
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +12 -12
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +6 -5
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +6 -5
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +6 -5
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +10 -10
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +49 -21
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +6 -5
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +67 -33
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +14 -14
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +6 -5
- package/dist/astro/routes/api/content/_collection_/_id_.mjs +11 -10
- package/dist/astro/routes/api/content/_collection_/authors.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/index.mjs +11 -10
- package/dist/astro/routes/api/content/_collection_/trash.mjs +7 -7
- package/dist/astro/routes/api/dashboard.mjs +8 -8
- package/dist/astro/routes/api/dev/emails.mjs +2 -2
- package/dist/astro/routes/api/health.mjs +1 -1
- package/dist/astro/routes/api/import/probe.d.mts +3 -3
- package/dist/astro/routes/api/import/probe.mjs +19 -19
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +8 -8
- package/dist/astro/routes/api/import/wordpress/execute.d.mts +8 -9
- package/dist/astro/routes/api/import/wordpress/execute.mjs +35 -34
- package/dist/astro/routes/api/import/wordpress/media.d.mts +8 -9
- package/dist/astro/routes/api/import/wordpress/media.mjs +12 -12
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +34 -33
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +9 -10
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +31 -30
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +22 -22
- package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +8 -9
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +40 -39
- package/dist/astro/routes/api/integrations/_provider_.d.mts +8 -0
- package/dist/astro/routes/api/integrations/_provider_.mjs +51 -0
- package/dist/astro/routes/api/integrations/index.d.mts +7 -0
- package/dist/astro/routes/api/integrations/index.mjs +24 -0
- package/dist/astro/routes/api/manifest.mjs +4 -4
- package/dist/astro/routes/api/mcp.mjs +474 -167
- package/dist/astro/routes/api/media/_id_/confirm.mjs +10 -10
- package/dist/astro/routes/api/media/_id_.mjs +8 -8
- 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 -11
- package/dist/astro/routes/api/media.mjs +14 -14
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +30 -29
- package/dist/astro/routes/api/menus/_name_/items.mjs +30 -29
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +30 -29
- package/dist/astro/routes/api/menus/_name_/translations.mjs +30 -29
- package/dist/astro/routes/api/menus/_name_.mjs +30 -29
- package/dist/astro/routes/api/menus/index.mjs +30 -29
- package/dist/astro/routes/api/oauth/authorize.mjs +7 -7
- package/dist/astro/routes/api/oauth/device/authorize.mjs +6 -6
- package/dist/astro/routes/api/oauth/device/code.mjs +9 -9
- package/dist/astro/routes/api/oauth/device/token.mjs +8 -8
- package/dist/astro/routes/api/oauth/register.mjs +4 -4
- package/dist/astro/routes/api/oauth/token/refresh.mjs +6 -6
- package/dist/astro/routes/api/oauth/token/revoke.mjs +6 -6
- package/dist/astro/routes/api/oauth/token.mjs +6 -6
- package/dist/astro/routes/api/openapi.json.mjs +4 -4
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +20 -5
- package/dist/astro/routes/api/redirects/404s/index.mjs +10 -10
- package/dist/astro/routes/api/redirects/404s/summary.mjs +10 -10
- package/dist/astro/routes/api/redirects/_id_.mjs +31 -30
- package/dist/astro/routes/api/redirects/index.mjs +31 -30
- 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 +49 -45
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +49 -45
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +49 -45
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +49 -45
- package/dist/astro/routes/api/schema/collections/index.mjs +49 -45
- package/dist/astro/routes/api/schema/index.mjs +8 -8
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +47 -44
- package/dist/astro/routes/api/schema/orphans/index.mjs +47 -44
- package/dist/astro/routes/api/search/enable.mjs +11 -11
- package/dist/astro/routes/api/search/index.mjs +10 -10
- package/dist/astro/routes/api/search/rebuild.mjs +11 -11
- package/dist/astro/routes/api/search/stats.mjs +6 -6
- package/dist/astro/routes/api/search/suggest.mjs +10 -10
- package/dist/astro/routes/api/sections/_slug_.mjs +30 -29
- package/dist/astro/routes/api/sections/index.mjs +30 -29
- package/dist/astro/routes/api/settings/email.mjs +3 -3
- package/dist/astro/routes/api/settings.mjs +30 -29
- 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 +1 -1
- package/dist/astro/routes/api/setup/index.mjs +27 -27
- package/dist/astro/routes/api/setup/status.mjs +3 -3
- package/dist/astro/routes/api/snapshot.mjs +6 -6
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +33 -32
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +33 -32
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +33 -32
- package/dist/astro/routes/api/taxonomies/index.mjs +33 -32
- package/dist/astro/routes/api/themes/preview.mjs +4 -4
- package/dist/astro/routes/api/typegen.mjs +4 -4
- package/dist/astro/routes/api/well-known/auth.mjs +2 -2
- package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +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 -28
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +30 -29
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +30 -29
- package/dist/astro/routes/api/widget-areas/_name_.mjs +27 -26
- package/dist/astro/routes/api/widget-areas/index.mjs +30 -29
- package/dist/astro/routes/api/widget-components.mjs +2 -2
- package/dist/astro/routes/robots.txt.mjs +6 -6
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +9 -9
- package/dist/astro/routes/sitemap.xml.mjs +7 -7
- package/dist/astro/session-driver.d.mts +1 -1
- package/dist/astro/session-driver.mjs +2 -2
- package/dist/astro/types.d.mts +13 -12
- package/dist/{audit-ByVKIwWF.mjs → audit-BzhwRVym.mjs} +1 -1
- package/dist/auth/providers/github.d.mts +1 -1
- package/dist/auth/providers/google.d.mts +1 -1
- package/dist/{auth-control-guard-CqeUmQsv.mjs → auth-control-guard-B_Dx-epW.mjs} +1 -1
- package/dist/{authorize-CcBxcHtz.mjs → authorize-D6MkRtPw.mjs} +1 -1
- package/dist/{briefing-BJaJI8dm.mjs → briefing-Cl70iEH5.mjs} +1 -1
- package/dist/{briefing-CawZ59CY.mjs → briefing-GFhLTLJo.mjs} +7 -7
- package/dist/{bundle-7C_DpkEq.mjs → bundle-CIrUlrkQ.mjs} +2 -2
- package/dist/{byline-e51-fWRs.mjs → byline-BJa1MyKB.mjs} +6 -6
- package/dist/{byline-fields-D-N5qVIG.mjs → byline-fields-BKzA0fJU.mjs} +1 -1
- package/dist/{byline-fields-CUvbslGc.d.mts → byline-fields-DxMpdtsZ.d.mts} +57 -47
- package/dist/{byline-fields-DOJO16Gm.mjs → byline-fields-yT4herdN.mjs} +10 -4
- package/dist/{byline-registry-87nNnYl4.mjs → byline-registry-Ba54M74c.mjs} +2 -2
- package/dist/{bylines-CMQNCNFh.mjs → bylines-B53Saxdb.mjs} +3 -3
- package/dist/{bylines-y4LO-dTj.mjs → bylines-kixFoaRV.mjs} +5 -5
- package/dist/{cache-C-FNTFYK.mjs → cache-fpisdt5Q.mjs} +2 -2
- package/dist/{chunks-CxBt-GxR.mjs → chunks-DX_b8_4Z.mjs} +1 -1
- package/dist/cli/index.d.mts +29 -1
- package/dist/cli/index.mjs +1527 -1222
- package/dist/cli/plugin-kit.d.mts +75 -0
- package/dist/cli/plugin-kit.mjs +4 -0
- package/dist/client/external-auth-headers.d.mts +1 -1
- package/dist/client/index.d.mts +27 -52
- package/dist/client/index.mjs +34 -7
- package/dist/client-factory-DEtHApCc.mjs +323 -0
- package/dist/{comment-DlA4iChg.mjs → comment-B88XcvU1.mjs} +1 -1
- package/dist/{comment-reaction-DfFao1ST.mjs → comment-reaction-Ckn6vCmB.mjs} +1 -1
- package/dist/{comments-DApFGMsP.mjs → comments-BDXsbL7z.mjs} +1 -1
- package/dist/{content-Bh4BDjv8.mjs → content-Cbl8HbIR.mjs} +2 -2
- package/dist/{content-refresh-CgutSUfO.mjs → content-refresh-BmkilU5M.mjs} +5 -5
- package/dist/{context-CK4ym2Sf.mjs → context-AJNd0tcG.mjs} +2 -2
- package/dist/{context-C5W3G18y.mjs → context-DT0tIsfw.mjs} +24 -13
- package/dist/{context-route-helpers-MASyGgWf.mjs → context-route-helpers-DhP--tTq.mjs} +2 -2
- package/dist/{dashboard-DQkVT7Ei.mjs → dashboard-YvDEYbS3.mjs} +4 -4
- package/dist/db/index.d.mts +3 -3
- package/dist/db/index.mjs +1 -1
- package/dist/db/libsql.d.mts +1 -1
- package/dist/db/postgres.d.mts +1 -1
- package/dist/db/sqlite.d.mts +1 -1
- package/dist/{device-flow-BnqRH-T9.mjs → device-flow-BKKeobcV.mjs} +5 -5
- package/dist/{enrich-DIFIFA8O.mjs → enrich-Ck9tfMqe.mjs} +1 -1
- package/dist/{error-CytFlgcd.mjs → error-BW9f_ynq.mjs} +16 -2
- package/dist/{experimental-workflows-BMsUnIAw.mjs → experimental-workflows-CgO73K4e.mjs} +1 -1
- package/dist/{field-defs-cache-DRNdhBJv.mjs → field-defs-cache-CiXP3eO3.mjs} +4 -4
- package/dist/{fts-manager-Crzypjqu.mjs → fts-manager-Zo9uhGel.mjs} +1 -1
- package/dist/{hitl-requests-B4Vbcmaq.mjs → hitl-requests-Bee8Cjj8.mjs} +2 -2
- package/dist/{hitl-route-helpers-hEVzvP8l.mjs → hitl-route-helpers-DtHaKGgm.mjs} +5 -5
- package/dist/{import-Bh9biJfx.mjs → import-C-zxnT89.mjs} +7 -7
- package/dist/{index-D4y6NGiy.d.mts → index-DybFmYtZ.d.mts} +79 -3
- package/dist/index.d.mts +15 -17
- package/dist/index.mjs +83 -78
- package/dist/integration-credentials-D3ZneN0L.mjs +49 -0
- package/dist/{jsonld-Dq0gsnOH.d.mts → jsonld-CoTa8I1a.d.mts} +2 -2
- package/dist/{load-DmYeniXl.mjs → load-Cuiyh8LT.mjs} +1 -1
- package/dist/{loader-CjWqjweO.mjs → loader-WHf22FwU.mjs} +2 -2
- package/dist/{manifest-schema-BxVPYMJR.mjs → manifest-schema-DKa3ZaJL.mjs} +6 -2
- package/dist/{mcp-reviewed-executor-TwVbMzG6.mjs → mcp-reviewed-executor-DnlF7mIL.mjs} +6 -3
- 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 +10 -11
- package/dist/media/local-runtime.mjs +2 -2
- package/dist/{media-DMj0grzC.mjs → media-B4m-cnmj.mjs} +1 -1
- package/dist/{media-allowlist-BlVCSzHx.mjs → media-allowlist-BQyIBPzd.mjs} +1 -1
- package/dist/{menus-TaW1gKnk.mjs → menus-LYALU2Mf.mjs} +2 -2
- package/dist/{menus-xvsnVZXw.mjs → menus-oYfViqfE.mjs} +6 -6
- package/dist/{oauth-authorization-DiaGvRVz.mjs → oauth-authorization-CX7aa8Ph.mjs} +5 -5
- package/dist/{oauth-clients-Dl9E8dEM.mjs → oauth-clients-D9Gg0WjF.mjs} +2 -2
- package/dist/object-cache/memory.d.mts +1 -1
- package/dist/output-13u4dvu-.mjs +68 -0
- package/dist/page/index.d.mts +9 -3
- package/dist/page/index.mjs +1 -1
- package/dist/{parse-CbymENaR.mjs → parse-B-Y84oJl.mjs} +1 -1
- package/dist/plugin-utils.d.mts +8 -9
- package/dist/plugins/adapt-sandbox-entry.d.mts +8 -9
- package/dist/plugins/adapt-sandbox-entry.mjs +3 -1
- package/dist/{plugins-BolVa-tl.mjs → plugins-B7-4Okii.mjs} +95 -10
- package/dist/portable-text-Ehqj3I_y.d.mts +45 -0
- package/dist/{preview-vSVg6fwG.mjs → preview-BMIReQGc.mjs} +2 -2
- package/dist/{provider-loader-MD8zAbnH.d.mts → provider-loader-BIbIiz0P.d.mts} +1 -1
- package/dist/{public-url-gsp3oUbu.d.mts → public-url-DYISdY_R.d.mts} +1 -1
- package/dist/publication-authorization-BVQ5rCAF.mjs +985 -0
- package/dist/{query-CfRCdaL3.mjs → query-C_m8sn-S.mjs} +13 -13
- package/dist/{query-jaAmw8E1.mjs → query-DNczixZr.mjs} +3 -3
- package/dist/{rate-limit-ZLdyWoZF.mjs → rate-limit-oUGexQO1.mjs} +2 -2
- package/dist/{redirect-BAjt4Z6b.mjs → redirect-DoDgOWIA.mjs} +2 -2
- package/dist/{redirects-BTdwpQtE.mjs → redirects-CrP6U4hZ.mjs} +4 -4
- package/dist/{redirects-CA-xylPG.mjs → redirects-E_B6hvuz.mjs} +18 -10
- package/dist/{registry-CtyVedcN.mjs → registry-SEJqFliS.mjs} +24 -10
- package/dist/{request-meta-CUypToDJ.mjs → request-meta-DHFIzWcf.mjs} +1 -1
- package/dist/review-payload-BysRWpxS.mjs +111 -0
- package/dist/{review-requests-DUyEmtmG.mjs → review-requests-CObSuTYU.mjs} +1 -1
- package/dist/review-requests-Cu9051_B.mjs +142 -0
- package/dist/review-route-helpers-Dp_7PH8r.mjs +41 -0
- package/dist/{runner-1tC2tIRV.d.mts → runner-Bcy5w0vj.d.mts} +1 -1
- package/dist/{runner-DB7CRfOF.mjs → runner-BfWbi9YY.mjs} +1166 -447
- package/dist/runtime.d.mts +9 -10
- package/dist/runtime.mjs +3 -3
- package/dist/schema-Dk_N31V4.mjs +8 -0
- package/dist/{search-DSaLgEFI.mjs → search-BXEQepxL.mjs} +3 -3
- package/dist/{secrets-CDZo2k8L.mjs → secrets-CpGpyGcO.mjs} +1 -1
- package/dist/{sections-PVVXHGfp.mjs → sections-DxvEF6Bj.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/index.mjs +1 -1
- package/dist/{seo-CQG3GCHQ.mjs → seo-D1RiaooQ.mjs} +1 -1
- package/dist/service-CY0aH6eI.mjs +347 -0
- package/dist/{service-DiN4ZuPp.mjs → service-QdG0YHws.mjs} +2 -2
- package/dist/{settings-i4VPP8bT.mjs → settings-Dje-PHXo.mjs} +2 -2
- package/dist/{settings-BbqgHWpU.mjs → settings-SVDAB7_W.mjs} +5 -5
- package/dist/{site-activity-Dy3FROs0.mjs → site-activity-BVK40wCy.mjs} +1 -1
- package/dist/{site-context-DQiL8Fl5.mjs → site-context-CzaEGizi.mjs} +565 -129
- package/dist/stable-hash-DshcXvRE.mjs +19 -0
- package/dist/storage/local.d.mts +1 -1
- package/dist/storage/local.mjs +1 -1
- package/dist/storage/s3.d.mts +1 -1
- package/dist/storage/s3.mjs +1 -1
- package/dist/store-CCfMD6nw.mjs +262 -0
- package/dist/{taxonomies-9s-v03H-.mjs → taxonomies-DuhGjBa8.mjs} +3 -3
- package/dist/{taxonomies-DRiixp_E.mjs → taxonomies-WVnFki0o.mjs} +6 -6
- package/dist/{taxonomy-Dvsw6BOs.mjs → taxonomy-CCo2plmV.mjs} +2 -2
- package/dist/{types-DU0bU2Wu.d.mts → types-BFeoAIHl.d.mts} +596 -2
- package/dist/{types-Dq1qT19x.mjs → types-Bshd_6wQ.mjs} +1 -1
- package/dist/{runtime-BOeiQsCv.d.mts → types-CJezJeNE.d.mts} +3561 -1355
- package/dist/{types-4garmdWa.mjs → types-CK0r-Xq4.mjs} +5 -2
- package/dist/{types-C_ly5eTp.d.mts → types-GtwhHAg8.d.mts} +1 -1
- package/dist/{types-DW_-sFyz.d.mts → types-ywmuDETA.d.mts} +2 -0
- package/dist/ui/server-runtime.d.mts +12 -14
- package/dist/ui/server-runtime.mjs +21 -21
- package/dist/{user-BIZPzCb9.mjs → user-Bcvr5ihC.mjs} +2 -2
- package/dist/{utils-CMDhr5Xd.mjs → utils-B7gemXz5.mjs} +1 -1
- package/dist/{validate-CZvb-BKB.d.mts → validate-YiX3rly5.d.mts} +59 -5
- package/dist/{validate-DNs0pTSc.mjs → validate-qKzI3BCv.mjs} +2 -2
- package/dist/version-DEAV9k58.mjs +6 -0
- package/dist/{widgets-f0ibZUIq.mjs → widgets-DyGcotPM.mjs} +3 -3
- package/dist/{wordpress-slugs-BhHJX8XE.mjs → wordpress-slugs-D_LfQCan.mjs} +1 -1
- package/dist/{zod-generator-B7TMjyFJ.mjs → zod-generator-Cr3SiHsc.mjs} +2 -2
- package/package.json +16 -6
- package/dist/hitl-Hw1RmWOq.mjs +0 -677
- package/dist/review-requests-C9Ff11Vq.mjs +0 -79
- package/dist/schema-DXdYj4R3.mjs +0 -8
- package/dist/types-C46EvNdc.d.mts +0 -56
- package/dist/types-C8XW6L19.d.mts +0 -1468
- package/dist/version-BTvfRGc6.mjs +0 -6
- /package/dist/{adapters-NVSs4UH7.d.mts → adapters-DnMDRQ4e.d.mts} +0 -0
- /package/dist/{api-tokens-2r7OWi_I.mjs → api-tokens-D4tcY8R6.mjs} +0 -0
- /package/dist/{challenge-store-Bjlepa2E.mjs → challenge-store-BMkL2kmt.mjs} +0 -0
- /package/dist/{components-Bclf98Be.mjs → components-D0w9MzQe.mjs} +0 -0
- /package/dist/{context-types-DqTo6C79.mjs → context-types-eBuMDAg-.mjs} +0 -0
- /package/dist/{cron-cKcNTix_.mjs → cron-D_c3WUPN.mjs} +0 -0
- /package/dist/{default--K40jqm0.mjs → default-BxoI3SoK.mjs} +0 -0
- /package/dist/{email-console-ChgKFO8-.mjs → email-console-BEMwuxhV.mjs} +0 -0
- /package/dist/{escape-Bd4P_xKg.mjs → escape-smSUOb7u.mjs} +0 -0
- /package/dist/{hash-BPmX6P8I.mjs → hash-mxxx2oPW.mjs} +0 -0
- /package/dist/{media-url-lEKSrpr9.mjs → media-url-B6d-yVI6.mjs} +0 -0
- /package/dist/{mime-CA7Lgovc.mjs → mime-C0vOHFm7.mjs} +0 -0
- /package/dist/{mode-C4CIyjtR.mjs → mode-DPC7segX.mjs} +0 -0
- /package/dist/{normalize-5ek_z7de.mjs → normalize-Cyt7JdF7.mjs} +0 -0
- /package/dist/{oauth-state-store-CNoXafF7.mjs → oauth-state-store-DPVzeoyY.mjs} +0 -0
- /package/dist/{oauth-user-lookup-Ygw4bNyt.mjs → oauth-user-lookup-3E5jlXrr.mjs} +0 -0
- /package/dist/{parser-C1nYd-81.mjs → parser-DX_c5iG3.mjs} +0 -0
- /package/dist/{passkey-config-BUwu8BA3.mjs → passkey-config-DE_0EGEP.mjs} +0 -0
- /package/dist/{patterns-BhAvqO0S.mjs → patterns-CoqlXUvk.mjs} +0 -0
- /package/dist/{placeholder-uvNRZBX9.d.mts → placeholder-C6ZjZcmJ.d.mts} +0 -0
- /package/dist/{portable-text-dA_UlJwW.mjs → portable-text-BASHceim.mjs} +0 -0
- /package/dist/{process-cache-7xgAO9JY.mjs → process-cache-CCDgti7j.mjs} +0 -0
- /package/dist/{provider-loader-D0w9dqjm.mjs → provider-loader-BeQcnPN1.mjs} +0 -0
- /package/dist/{public-url-BEz_sM9n.mjs → public-url-BA-7LKvQ.mjs} +0 -0
- /package/dist/{redirect-wphRBv4y.mjs → redirect-CZFAqHLr.mjs} +0 -0
- /package/dist/{request-cache-D9GQBxMP.mjs → request-cache-CBFjCwSt.mjs} +0 -0
- /package/dist/{resolve-Cb6Dbz-C.mjs → resolve-B6BpqwAR.mjs} +0 -0
- /package/dist/{seo-qa7Dn0jK.mjs → seo-BLszyJxd.mjs} +0 -0
- /package/dist/{seo-contributions-C1EnikHB.mjs → seo-contributions-Ci8_12_r.mjs} +0 -0
- /package/dist/{session-user-CAKImna3.mjs → session-user-BwliEFp0.mjs} +0 -0
- /package/dist/{setup-complete-B8fl-mjV.mjs → setup-complete-PvF8I7Oh.mjs} +0 -0
- /package/dist/{setup-nonce-CoyjILvW.mjs → setup-nonce-DkpYROqg.mjs} +0 -0
- /package/dist/{sidecar-client-C3mqXg4C.mjs → sidecar-client-dt5fv23q.mjs} +0 -0
- /package/dist/{site-url-BML3GQYm.mjs → site-url-DfYDZyWl.mjs} +0 -0
- /package/dist/{ssrf-DWe8jwAp.mjs → ssrf-BZHvtFEv.mjs} +0 -0
- /package/dist/{status-DANd8ERo.mjs → status-BN40hMpr.mjs} +0 -0
- /package/dist/{tokens-1RK1n6ED.mjs → tokens-DIzhPT80.mjs} +0 -0
- /package/dist/{transaction-C2EOMTJA.mjs → transaction-0LEAAy8R.mjs} +0 -0
- /package/dist/{transport-CcJu3Co8.d.mts → transport-BZ3aqdu7.d.mts} +0 -0
- /package/dist/{transport-BNmCqLu7.mjs → transport-C46KHLMP.mjs} +0 -0
- /package/dist/{trusted-proxy-DTXQ2IMv.mjs → trusted-proxy-czZuby6G.mjs} +0 -0
- /package/dist/{types-B3t5cxhU.mjs → types-B7TDDFMG.mjs} +0 -0
- /package/dist/{types-CDpH6MA4.d.mts → types-BsTXSvKG.d.mts} +0 -0
- /package/dist/{types-DF7ZuGGk.d.mts → types-CDcuRd4z.d.mts} +0 -0
- /package/dist/{types-Rc3gQqqw.d.mts → types-S9VIopdY.d.mts} +0 -0
- /package/dist/{types-POH8PQZh.d.mts → types-YxFz4lDr.d.mts} +0 -0
- /package/dist/{types-C5CVgwsV.mjs → types-gvNBqijt.mjs} +0 -0
- /package/dist/{url-CpyFDFpO.mjs → url-D282S1Zw.mjs} +0 -0
- /package/dist/{url-Cac7a9QZ.mjs → url-guoXQQcV.mjs} +0 -0
|
@@ -1,20 +1,554 @@
|
|
|
1
1
|
import { t as validateIdentifier } from "./validate-VPnKoIzW.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { t as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
2
|
+
import { i as encodeCursor, r as decodeCursor } from "./types-Bshd_6wQ.mjs";
|
|
3
|
+
import { t as ContentRepository } from "./content-Cbl8HbIR.mjs";
|
|
4
|
+
import { t as SiteActivityRepository } from "./site-activity-BVK40wCy.mjs";
|
|
5
|
+
import { t as ReviewRequestRepository } from "./review-requests-CObSuTYU.mjs";
|
|
6
|
+
import { o as HitlRequestRepository } from "./publication-authorization-BVQ5rCAF.mjs";
|
|
7
|
+
import { r as isPattern } from "./patterns-CoqlXUvk.mjs";
|
|
8
|
+
import { a as ContextRepository, i as parseSiteBriefingScope, l as handlePluginList } from "./briefing-GFhLTLJo.mjs";
|
|
9
|
+
import { t as FTSManager } from "./fts-manager-Zo9uhGel.mjs";
|
|
10
|
+
import { n as SchemaRegistry } from "./registry-SEJqFliS.mjs";
|
|
11
|
+
import { a as getSiteSettingsWithDb } from "./settings-SVDAB7_W.mjs";
|
|
12
|
+
import { n as buildStableActionHash, t as ReviewPayloadBuilder } from "./review-payload-BysRWpxS.mjs";
|
|
13
|
+
import { n as assertExperimentalSiteContextWorkflowsEnabled } from "./experimental-workflows-CgO73K4e.mjs";
|
|
14
|
+
import { m as normalizeUrl } from "./utils-B7gemXz5.mjs";
|
|
15
|
+
import { t as sanitizeWordPressImportSlug } from "./wordpress-slugs-D_LfQCan.mjs";
|
|
16
|
+
import { s as searchCollection } from "./search-BXEQepxL.mjs";
|
|
15
17
|
import { sql } from "kysely";
|
|
18
|
+
import { ulid } from "ulidx";
|
|
16
19
|
import { Role } from "@dineway-ai/auth";
|
|
17
20
|
|
|
21
|
+
//#region src/database/repositories/assignments.ts
|
|
22
|
+
const ASSIGNMENT_ACTOR_TYPES = [
|
|
23
|
+
"user",
|
|
24
|
+
"api_token",
|
|
25
|
+
"system"
|
|
26
|
+
];
|
|
27
|
+
const ASSIGNMENT_STATUSES = [
|
|
28
|
+
"pending",
|
|
29
|
+
"accepted",
|
|
30
|
+
"in_progress",
|
|
31
|
+
"blocked",
|
|
32
|
+
"completed",
|
|
33
|
+
"declined",
|
|
34
|
+
"cancelled",
|
|
35
|
+
"overdue"
|
|
36
|
+
];
|
|
37
|
+
const ASSIGNMENT_PRIORITIES = [
|
|
38
|
+
"low",
|
|
39
|
+
"normal",
|
|
40
|
+
"high",
|
|
41
|
+
"urgent"
|
|
42
|
+
];
|
|
43
|
+
var AssignmentRepository = class {
|
|
44
|
+
constructor(db) {
|
|
45
|
+
this.db = db;
|
|
46
|
+
}
|
|
47
|
+
async create(input) {
|
|
48
|
+
const id = ulid();
|
|
49
|
+
const now = input.createdAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
50
|
+
await this.db.insertInto("_dineway_assignments").values(toInsertableAssignment(id, input, now)).execute();
|
|
51
|
+
const assignment = await this.findById(id);
|
|
52
|
+
if (!assignment) throw new Error("Failed to create assignment");
|
|
53
|
+
return assignment;
|
|
54
|
+
}
|
|
55
|
+
async findById(id) {
|
|
56
|
+
const row = await this.db.selectFrom("_dineway_assignments").selectAll().where("id", "=", id).executeTakeFirst();
|
|
57
|
+
return row ? rowToAssignment(row) : null;
|
|
58
|
+
}
|
|
59
|
+
async list(query = {}) {
|
|
60
|
+
const limit = clampLimit$2(query.limit);
|
|
61
|
+
const rows = await this.queryRows(query).execute();
|
|
62
|
+
const items = rows.slice(0, limit).map(rowToAssignment);
|
|
63
|
+
const result = { items };
|
|
64
|
+
if (rows.length > limit && items.length > 0) {
|
|
65
|
+
const last = items.at(-1);
|
|
66
|
+
result.nextCursor = encodeCursor(last.createdAt, last.id);
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
async accept(id, input = {}) {
|
|
71
|
+
const value = input.acceptedAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
72
|
+
return this.transition(id, ["pending"], {
|
|
73
|
+
status: "accepted",
|
|
74
|
+
assigned_to_actor_type: input.assignedToActorType ?? null,
|
|
75
|
+
assigned_to_actor_id: input.assignedToActorId ?? null,
|
|
76
|
+
accepted_at: value,
|
|
77
|
+
updated_at: value,
|
|
78
|
+
metadata: jsonString(input.metadata)
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
async start(id, input = {}) {
|
|
82
|
+
const value = input.at ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
83
|
+
return this.transition(id, ["accepted", "blocked"], {
|
|
84
|
+
status: "in_progress",
|
|
85
|
+
started_at: value,
|
|
86
|
+
updated_at: value,
|
|
87
|
+
metadata: jsonString(input.metadata)
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
async block(id, input = {}) {
|
|
91
|
+
const value = input.at ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
92
|
+
return this.transition(id, ["accepted", "in_progress"], {
|
|
93
|
+
status: "blocked",
|
|
94
|
+
blocked_at: value,
|
|
95
|
+
updated_at: value,
|
|
96
|
+
metadata: jsonString(input.metadata)
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
async complete(id, input = {}) {
|
|
100
|
+
const value = input.at ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
101
|
+
return this.transition(id, [
|
|
102
|
+
"pending",
|
|
103
|
+
"accepted",
|
|
104
|
+
"in_progress"
|
|
105
|
+
], {
|
|
106
|
+
status: "completed",
|
|
107
|
+
completed_at: value,
|
|
108
|
+
updated_at: value,
|
|
109
|
+
metadata: jsonString(input.metadata)
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
async decline(id, input = {}) {
|
|
113
|
+
const value = input.at ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
114
|
+
return this.transition(id, ["pending", "accepted"], {
|
|
115
|
+
status: "declined",
|
|
116
|
+
declined_at: value,
|
|
117
|
+
updated_at: value,
|
|
118
|
+
metadata: jsonString(input.metadata)
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
async cancel(id, input = {}) {
|
|
122
|
+
const value = input.at ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
123
|
+
return this.transition(id, [
|
|
124
|
+
"pending",
|
|
125
|
+
"accepted",
|
|
126
|
+
"in_progress",
|
|
127
|
+
"blocked"
|
|
128
|
+
], {
|
|
129
|
+
status: "cancelled",
|
|
130
|
+
cancelled_at: value,
|
|
131
|
+
updated_at: value,
|
|
132
|
+
metadata: jsonString(input.metadata)
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
async markOverdueBefore(input) {
|
|
136
|
+
const limit = clampLimit$2(input.limit);
|
|
137
|
+
let query = this.db.selectFrom("_dineway_assignments").select("id").where("status", "in", [
|
|
138
|
+
"pending",
|
|
139
|
+
"accepted",
|
|
140
|
+
"in_progress",
|
|
141
|
+
"blocked"
|
|
142
|
+
]).where("due_at", "is not", null).where("due_at", "<=", input.before).orderBy("due_at", "asc").orderBy("id", "asc").limit(limit);
|
|
143
|
+
if (input.assignmentType) query = query.where("assignment_type", "=", input.assignmentType);
|
|
144
|
+
const candidates = await query.execute();
|
|
145
|
+
const at = input.at ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
146
|
+
const overdue = [];
|
|
147
|
+
for (const candidate of candidates) {
|
|
148
|
+
const updated = await this.transition(candidate.id, [
|
|
149
|
+
"pending",
|
|
150
|
+
"accepted",
|
|
151
|
+
"in_progress",
|
|
152
|
+
"blocked"
|
|
153
|
+
], {
|
|
154
|
+
status: "overdue",
|
|
155
|
+
overdue_at: at,
|
|
156
|
+
updated_at: at
|
|
157
|
+
});
|
|
158
|
+
if (updated) overdue.push(updated);
|
|
159
|
+
}
|
|
160
|
+
return overdue;
|
|
161
|
+
}
|
|
162
|
+
async linkHitlRequest(id, relatedHitlRequestId, at = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
163
|
+
const result = await this.db.updateTable("_dineway_assignments").set({
|
|
164
|
+
related_hitl_request_id: relatedHitlRequestId,
|
|
165
|
+
updated_at: at
|
|
166
|
+
}).where("id", "=", id).executeTakeFirst();
|
|
167
|
+
if (Number(result.numUpdatedRows ?? 0) === 0) return null;
|
|
168
|
+
return this.findById(id);
|
|
169
|
+
}
|
|
170
|
+
async linkHandoffSnapshot(id, relatedHandoffSnapshotId, at = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
171
|
+
const result = await this.db.updateTable("_dineway_assignments").set({
|
|
172
|
+
related_handoff_snapshot_id: relatedHandoffSnapshotId,
|
|
173
|
+
updated_at: at
|
|
174
|
+
}).where("id", "=", id).executeTakeFirst();
|
|
175
|
+
if (Number(result.numUpdatedRows ?? 0) === 0) return null;
|
|
176
|
+
return this.findById(id);
|
|
177
|
+
}
|
|
178
|
+
queryRows(query) {
|
|
179
|
+
const limit = clampLimit$2(query.limit);
|
|
180
|
+
let q = this.db.selectFrom("_dineway_assignments").selectAll().orderBy("created_at", "desc").orderBy("id", "desc").limit(limit + 1);
|
|
181
|
+
if (query.scope) q = q.where("scope", "=", query.scope);
|
|
182
|
+
if (query.scopes && query.scopes.length > 0) q = q.where("scope", "in", query.scopes);
|
|
183
|
+
if (query.statuses && query.statuses.length > 0) q = q.where("status", "in", query.statuses);
|
|
184
|
+
if (query.priority) q = q.where("priority", "=", query.priority);
|
|
185
|
+
if (query.assignmentType) q = q.where("assignment_type", "=", query.assignmentType);
|
|
186
|
+
if (query.assignedToActorType && query.assignedToActorId) q = q.where("assigned_to_actor_type", "=", query.assignedToActorType).where("assigned_to_actor_id", "=", query.assignedToActorId);
|
|
187
|
+
if (query.assignedByActorType && query.assignedByActorId) q = q.where("assigned_by_actor_type", "=", query.assignedByActorType).where("assigned_by_actor_id", "=", query.assignedByActorId);
|
|
188
|
+
if (query.participantActor) q = q.where((eb) => eb.or([eb.and([eb("assigned_by_actor_type", "=", query.participantActor.actorType), eb("assigned_by_actor_id", "=", query.participantActor.actorId)]), eb.and([eb("assigned_to_actor_type", "=", query.participantActor.actorType), eb("assigned_to_actor_id", "=", query.participantActor.actorId)])]));
|
|
189
|
+
if (query.since) q = q.where("updated_at", ">=", query.since);
|
|
190
|
+
if (query.cursor) {
|
|
191
|
+
const decoded = decodeCursor(query.cursor);
|
|
192
|
+
if (decoded) q = q.where((eb) => eb.or([eb("created_at", "<", decoded.orderValue), eb.and([eb("created_at", "=", decoded.orderValue), eb("id", "<", decoded.id)])]));
|
|
193
|
+
}
|
|
194
|
+
return q;
|
|
195
|
+
}
|
|
196
|
+
async transition(id, validFrom, update) {
|
|
197
|
+
const result = await this.db.updateTable("_dineway_assignments").set(update).where("id", "=", id).where("status", "in", validFrom).executeTakeFirst();
|
|
198
|
+
if (Number(result.numUpdatedRows ?? 0) === 0) return null;
|
|
199
|
+
return this.findById(id);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
function toInsertableAssignment(id, input, now) {
|
|
203
|
+
return {
|
|
204
|
+
id,
|
|
205
|
+
scope: input.scope,
|
|
206
|
+
assignment_type: input.assignmentType,
|
|
207
|
+
status: "pending",
|
|
208
|
+
priority: input.priority ?? "normal",
|
|
209
|
+
title: input.title,
|
|
210
|
+
summary: input.summary ?? null,
|
|
211
|
+
details: input.details ?? null,
|
|
212
|
+
assigned_by_actor_type: input.assignedByActorType,
|
|
213
|
+
assigned_by_actor_id: input.assignedByActorId,
|
|
214
|
+
assigned_to_actor_type: input.assignedToActorType ?? null,
|
|
215
|
+
assigned_to_actor_id: input.assignedToActorId ?? null,
|
|
216
|
+
metadata: jsonString(input.metadata),
|
|
217
|
+
related_handoff_snapshot_id: input.relatedHandoffSnapshotId ?? null,
|
|
218
|
+
related_hitl_request_id: input.relatedHitlRequestId ?? null,
|
|
219
|
+
due_at: input.dueAt ?? null,
|
|
220
|
+
created_at: now,
|
|
221
|
+
updated_at: now,
|
|
222
|
+
accepted_at: null,
|
|
223
|
+
started_at: null,
|
|
224
|
+
blocked_at: null,
|
|
225
|
+
completed_at: null,
|
|
226
|
+
declined_at: null,
|
|
227
|
+
cancelled_at: null,
|
|
228
|
+
overdue_at: null
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
function rowToAssignment(row) {
|
|
232
|
+
return {
|
|
233
|
+
id: row.id,
|
|
234
|
+
scope: row.scope,
|
|
235
|
+
assignmentType: row.assignment_type,
|
|
236
|
+
status: row.status,
|
|
237
|
+
priority: row.priority,
|
|
238
|
+
title: row.title,
|
|
239
|
+
summary: row.summary,
|
|
240
|
+
details: row.details,
|
|
241
|
+
assignedByActorType: row.assigned_by_actor_type,
|
|
242
|
+
assignedByActorId: row.assigned_by_actor_id,
|
|
243
|
+
assignedToActorType: row.assigned_to_actor_type,
|
|
244
|
+
assignedToActorId: row.assigned_to_actor_id,
|
|
245
|
+
metadata: parseRecord$1(row.metadata),
|
|
246
|
+
relatedHandoffSnapshotId: row.related_handoff_snapshot_id,
|
|
247
|
+
relatedHitlRequestId: row.related_hitl_request_id,
|
|
248
|
+
dueAt: row.due_at,
|
|
249
|
+
createdAt: row.created_at,
|
|
250
|
+
updatedAt: row.updated_at,
|
|
251
|
+
acceptedAt: row.accepted_at,
|
|
252
|
+
startedAt: row.started_at,
|
|
253
|
+
blockedAt: row.blocked_at,
|
|
254
|
+
completedAt: row.completed_at,
|
|
255
|
+
declinedAt: row.declined_at,
|
|
256
|
+
cancelledAt: row.cancelled_at,
|
|
257
|
+
overdueAt: row.overdue_at
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
function jsonString(value) {
|
|
261
|
+
return JSON.stringify(value ?? {});
|
|
262
|
+
}
|
|
263
|
+
function parseRecord$1(value) {
|
|
264
|
+
if (!value) return {};
|
|
265
|
+
try {
|
|
266
|
+
const parsed = JSON.parse(value);
|
|
267
|
+
return isRecord$2(parsed) ? parsed : {};
|
|
268
|
+
} catch {
|
|
269
|
+
return {};
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function isRecord$2(value) {
|
|
273
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
274
|
+
}
|
|
275
|
+
function clampLimit$2(limit) {
|
|
276
|
+
if (!limit || limit < 1) return 50;
|
|
277
|
+
return Math.min(limit, 100);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region src/database/repositories/entity-aliases.ts
|
|
282
|
+
const WHITESPACE_PATTERN = /\s+/g;
|
|
283
|
+
function isResolvableEntityType(value) {
|
|
284
|
+
return value === "content" || value === "collection" || value === "plugin" || value === "taxonomy" || value === "menu";
|
|
285
|
+
}
|
|
286
|
+
function mapEntityAlias(row) {
|
|
287
|
+
if (!isResolvableEntityType(row.entity_type)) throw new Error(`Invalid entity alias type: ${row.entity_type}`);
|
|
288
|
+
return {
|
|
289
|
+
id: row.id,
|
|
290
|
+
entityType: row.entity_type,
|
|
291
|
+
collectionSlug: row.collection_slug,
|
|
292
|
+
entityId: row.entity_id,
|
|
293
|
+
alias: row.alias,
|
|
294
|
+
normalizedAlias: row.normalized_alias,
|
|
295
|
+
createdAt: row.created_at
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
function normalizeEntityAlias(value) {
|
|
299
|
+
return value.trim().toLowerCase().replace(WHITESPACE_PATTERN, " ");
|
|
300
|
+
}
|
|
301
|
+
var EntityAliasRepository = class {
|
|
302
|
+
constructor(db) {
|
|
303
|
+
this.db = db;
|
|
304
|
+
}
|
|
305
|
+
async create(input) {
|
|
306
|
+
const id = ulid();
|
|
307
|
+
const normalizedAlias = normalizeEntityAlias(input.alias);
|
|
308
|
+
await this.db.insertInto("_dineway_entity_aliases").values({
|
|
309
|
+
id,
|
|
310
|
+
entity_type: input.entityType,
|
|
311
|
+
collection_slug: input.collectionSlug ?? null,
|
|
312
|
+
entity_id: input.entityId,
|
|
313
|
+
alias: input.alias,
|
|
314
|
+
normalized_alias: normalizedAlias
|
|
315
|
+
}).execute();
|
|
316
|
+
return mapEntityAlias(await this.db.selectFrom("_dineway_entity_aliases").selectAll().where("id", "=", id).executeTakeFirstOrThrow());
|
|
317
|
+
}
|
|
318
|
+
async findByNormalizedAlias(input) {
|
|
319
|
+
const limit = Math.min(Math.max(input.limit ?? 10, 1), 50);
|
|
320
|
+
const collectionSlug = input.collectionSlug;
|
|
321
|
+
let query = this.db.selectFrom("_dineway_entity_aliases").selectAll().where("normalized_alias", "=", input.normalizedAlias);
|
|
322
|
+
if (input.entityTypes && input.entityTypes.length > 0) query = query.where("entity_type", "in", input.entityTypes);
|
|
323
|
+
if (collectionSlug) query = query.where((eb) => eb.or([eb("collection_slug", "is", null), eb("collection_slug", "=", collectionSlug)]));
|
|
324
|
+
return (await query.orderBy("created_at", "desc").limit(limit).execute()).map(mapEntityAlias);
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
//#endregion
|
|
329
|
+
//#region src/database/repositories/handoff-snapshots.ts
|
|
330
|
+
var HandoffSnapshotRepository = class {
|
|
331
|
+
constructor(db) {
|
|
332
|
+
this.db = db;
|
|
333
|
+
}
|
|
334
|
+
async create(input) {
|
|
335
|
+
const id = ulid();
|
|
336
|
+
await this.db.insertInto("_dineway_handoff_snapshots").values(toInsertableHandoffSnapshot(id, input)).execute();
|
|
337
|
+
return this.findById(id).then((snapshot) => {
|
|
338
|
+
if (!snapshot) throw new Error("Failed to create handoff snapshot");
|
|
339
|
+
return snapshot;
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
async findById(id) {
|
|
343
|
+
const row = await this.db.selectFrom("_dineway_handoff_snapshots").selectAll().where("id", "=", id).executeTakeFirst();
|
|
344
|
+
return row ? rowToHandoffSnapshot(row) : null;
|
|
345
|
+
}
|
|
346
|
+
async markResumed(id, resumedAt) {
|
|
347
|
+
const value = resumedAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
348
|
+
await this.db.updateTable("_dineway_handoff_snapshots").set({ resumed_at: value }).where("id", "=", id).execute();
|
|
349
|
+
return this.findById(id);
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
function toInsertableHandoffSnapshot(id, input) {
|
|
353
|
+
return {
|
|
354
|
+
id,
|
|
355
|
+
scope: input.scope,
|
|
356
|
+
actor_type: input.actorType,
|
|
357
|
+
actor_id: input.actorId,
|
|
358
|
+
auth_metadata: jsonOrNull(input.authMetadata),
|
|
359
|
+
objective: input.objective,
|
|
360
|
+
reasoning: input.reasoning,
|
|
361
|
+
key_findings: JSON.stringify(input.keyFindings ?? []),
|
|
362
|
+
touched_objects: JSON.stringify(input.touchedObjects ?? []),
|
|
363
|
+
pending_actions: JSON.stringify(input.pendingActions ?? []),
|
|
364
|
+
tool_evidence: JSON.stringify(input.toolEvidence ?? []),
|
|
365
|
+
confidence: input.confidence ?? null,
|
|
366
|
+
handoff_kind: input.handoffKind ?? "pause",
|
|
367
|
+
reference_type: input.referenceType ?? null,
|
|
368
|
+
reference_id: input.referenceId ?? null,
|
|
369
|
+
created_at: input.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
370
|
+
resumed_at: null
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
function rowToHandoffSnapshot(row) {
|
|
374
|
+
return {
|
|
375
|
+
id: row.id,
|
|
376
|
+
scope: row.scope,
|
|
377
|
+
actorType: row.actor_type,
|
|
378
|
+
actorId: row.actor_id,
|
|
379
|
+
authMetadata: parseRecord(row.auth_metadata),
|
|
380
|
+
objective: row.objective,
|
|
381
|
+
reasoning: row.reasoning,
|
|
382
|
+
keyFindings: parseArray(row.key_findings),
|
|
383
|
+
touchedObjects: parseArray(row.touched_objects),
|
|
384
|
+
pendingActions: parseArray(row.pending_actions),
|
|
385
|
+
toolEvidence: parseArray(row.tool_evidence),
|
|
386
|
+
confidence: row.confidence,
|
|
387
|
+
handoffKind: row.handoff_kind,
|
|
388
|
+
referenceType: row.reference_type,
|
|
389
|
+
referenceId: row.reference_id,
|
|
390
|
+
createdAt: row.created_at,
|
|
391
|
+
resumedAt: row.resumed_at
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function jsonOrNull(value) {
|
|
395
|
+
return value ? JSON.stringify(value) : null;
|
|
396
|
+
}
|
|
397
|
+
function parseRecord(value) {
|
|
398
|
+
if (!value) return null;
|
|
399
|
+
try {
|
|
400
|
+
const parsed = JSON.parse(value);
|
|
401
|
+
return isRecord$1(parsed) ? parsed : null;
|
|
402
|
+
} catch {
|
|
403
|
+
return null;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
function parseArray(value) {
|
|
407
|
+
if (!value) return [];
|
|
408
|
+
try {
|
|
409
|
+
const parsed = JSON.parse(value);
|
|
410
|
+
return Array.isArray(parsed) ? parsed.filter((_item) => true) : [];
|
|
411
|
+
} catch {
|
|
412
|
+
return [];
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
function isRecord$1(value) {
|
|
416
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
//#endregion
|
|
420
|
+
//#region src/site-context/hitl.ts
|
|
421
|
+
const HITL_REQUEST_VALID_FROM = { resolve: ["pending"] };
|
|
422
|
+
var HitlRequestService = class {
|
|
423
|
+
repository;
|
|
424
|
+
assignments;
|
|
425
|
+
constructor(db) {
|
|
426
|
+
this.db = db;
|
|
427
|
+
this.repository = new HitlRequestRepository(db);
|
|
428
|
+
this.assignments = new AssignmentRepository(db);
|
|
429
|
+
}
|
|
430
|
+
async create(actor, input) {
|
|
431
|
+
parseSiteBriefingScope(input.scope);
|
|
432
|
+
const assignment = input.relatedAssignmentId ? await this.assignments.findById(input.relatedAssignmentId) : null;
|
|
433
|
+
if (input.relatedAssignmentId && !assignment) throw new Error(`Assignment not found: ${input.relatedAssignmentId}`);
|
|
434
|
+
if (assignment) {
|
|
435
|
+
this.assertRelatedAssignmentReadable(assignment, actor);
|
|
436
|
+
if (assignment.scope !== input.scope) throw new Error("Related assignment scope must match the HITL request scope.");
|
|
437
|
+
if (assignment.relatedHitlRequestId) throw new Error(`Assignment ${assignment.id} is already linked to HITL request ${assignment.relatedHitlRequestId}.`);
|
|
438
|
+
}
|
|
439
|
+
if (input.relatedHandoffSnapshotId) {
|
|
440
|
+
const snapshot = await new HandoffSnapshotRepository(this.db).findById(input.relatedHandoffSnapshotId);
|
|
441
|
+
if (!snapshot) throw new Error(`Handoff snapshot not found: ${input.relatedHandoffSnapshotId}`);
|
|
442
|
+
this.assertRelatedHandoffSnapshotReadable(snapshot, actor);
|
|
443
|
+
if (snapshot.scope !== input.scope) throw new Error("Related handoff snapshot scope must match the HITL request scope.");
|
|
444
|
+
}
|
|
445
|
+
const request = await this.repository.create({
|
|
446
|
+
scope: input.scope,
|
|
447
|
+
actionType: input.actionType,
|
|
448
|
+
title: input.title,
|
|
449
|
+
summary: input.summary,
|
|
450
|
+
riskReason: input.riskReason,
|
|
451
|
+
reviewPayload: input.reviewPayload,
|
|
452
|
+
targetRefType: input.targetRefType,
|
|
453
|
+
targetRefId: input.targetRefId,
|
|
454
|
+
requestedByActorType: actor.actorType,
|
|
455
|
+
requestedByActorId: actor.actorId,
|
|
456
|
+
requestedAuthMetadata: actor.authMetadata,
|
|
457
|
+
priority: input.priority,
|
|
458
|
+
metadata: input.metadata,
|
|
459
|
+
relatedAssignmentId: input.relatedAssignmentId,
|
|
460
|
+
relatedHandoffSnapshotId: input.relatedHandoffSnapshotId,
|
|
461
|
+
slaDueAt: input.slaDueAt,
|
|
462
|
+
createdAt: input.createdAt
|
|
463
|
+
});
|
|
464
|
+
if (assignment) {
|
|
465
|
+
if (!await this.assignments.linkHitlRequest(assignment.id, request.id, request.createdAt)) throw new Error(`Failed to link assignment ${assignment.id} to HITL request ${request.id}.`);
|
|
466
|
+
}
|
|
467
|
+
return request;
|
|
468
|
+
}
|
|
469
|
+
async get(id, actor) {
|
|
470
|
+
const request = await this.repository.findById(id);
|
|
471
|
+
if (!request) return null;
|
|
472
|
+
this.assertReadable(request, actor);
|
|
473
|
+
return request;
|
|
474
|
+
}
|
|
475
|
+
async list(actor, input = {}) {
|
|
476
|
+
return this.repository.list(this.buildListQuery(actor, input));
|
|
477
|
+
}
|
|
478
|
+
async resolve(input) {
|
|
479
|
+
const request = await this.loadExisting(input.id);
|
|
480
|
+
this.assertResolver(input.actor);
|
|
481
|
+
this.assertReadable(request, input.actor);
|
|
482
|
+
this.assertValidAction("resolve", request.status);
|
|
483
|
+
const resolved = await this.repository.resolve(request.id, {
|
|
484
|
+
decision: input.decision,
|
|
485
|
+
resolvedByActorType: input.actor.actorType,
|
|
486
|
+
resolvedByActorId: input.actor.actorId,
|
|
487
|
+
resolvedAuthMetadata: input.actor.authMetadata,
|
|
488
|
+
reviewNote: input.reviewNote,
|
|
489
|
+
resolvedAt: input.at
|
|
490
|
+
});
|
|
491
|
+
if (!resolved) throw new Error(`Failed to resolve HITL request ${request.id}.`);
|
|
492
|
+
return resolved;
|
|
493
|
+
}
|
|
494
|
+
buildListQuery(actor, input) {
|
|
495
|
+
const query = {
|
|
496
|
+
scope: input.scope,
|
|
497
|
+
scopes: input.scopes,
|
|
498
|
+
statuses: input.statuses,
|
|
499
|
+
priority: input.priority,
|
|
500
|
+
actionType: input.actionType,
|
|
501
|
+
targetRefType: input.targetRefType,
|
|
502
|
+
targetRefId: input.targetRefId,
|
|
503
|
+
relatedAssignmentId: input.relatedAssignmentId,
|
|
504
|
+
since: input.since,
|
|
505
|
+
limit: input.limit,
|
|
506
|
+
cursor: input.cursor
|
|
507
|
+
};
|
|
508
|
+
if (isHitlSupervisor(actor.userRole)) return query;
|
|
509
|
+
return {
|
|
510
|
+
...query,
|
|
511
|
+
requestedByActorType: actor.actorType,
|
|
512
|
+
requestedByActorId: actor.actorId
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
async loadExisting(id) {
|
|
516
|
+
const request = await this.repository.findById(id);
|
|
517
|
+
if (!request) throw new Error(`HITL request not found: ${id}`);
|
|
518
|
+
return request;
|
|
519
|
+
}
|
|
520
|
+
assertReadable(request, actor) {
|
|
521
|
+
if (isHitlSupervisor(actor.userRole)) return;
|
|
522
|
+
if (request.requestedByActorType === actor.actorType && request.requestedByActorId === actor.actorId) return;
|
|
523
|
+
throw new Error("Insufficient permissions to read this HITL request.");
|
|
524
|
+
}
|
|
525
|
+
assertResolver(actor) {
|
|
526
|
+
if (isHitlSupervisor(actor.userRole)) return;
|
|
527
|
+
throw new Error("HITL requests may only be resolved by an editor or admin.");
|
|
528
|
+
}
|
|
529
|
+
assertRelatedAssignmentReadable(assignment, actor) {
|
|
530
|
+
if (isHitlSupervisor(actor.userRole)) return;
|
|
531
|
+
if (matchesActor$1(assignment.assignedByActorType, assignment.assignedByActorId, actor) || matchesActor$1(assignment.assignedToActorType, assignment.assignedToActorId, actor)) return;
|
|
532
|
+
throw new Error("Insufficient permissions to link this assignment to a HITL request.");
|
|
533
|
+
}
|
|
534
|
+
assertRelatedHandoffSnapshotReadable(snapshot, actor) {
|
|
535
|
+
if (isHitlSupervisor(actor.userRole)) return;
|
|
536
|
+
if (matchesActor$1(snapshot.actorType, snapshot.actorId, actor)) return;
|
|
537
|
+
throw new Error("Insufficient permissions to link this handoff snapshot to a HITL request.");
|
|
538
|
+
}
|
|
539
|
+
assertValidAction(action, status) {
|
|
540
|
+
const validFrom = HITL_REQUEST_VALID_FROM[action];
|
|
541
|
+
if (!validFrom.includes(status)) throw new Error(`Cannot ${action} a HITL request in status "${status}". Valid statuses: ${validFrom.join(", ")}.`);
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
function isHitlSupervisor(role) {
|
|
545
|
+
return role >= Role.EDITOR;
|
|
546
|
+
}
|
|
547
|
+
function matchesActor$1(actorType, actorId, actor) {
|
|
548
|
+
return actorType === actor.actorType && actorId === actor.actorId;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
//#endregion
|
|
18
552
|
//#region src/site-context/context-entry-public.ts
|
|
19
553
|
function toPublicContextEntry(entry) {
|
|
20
554
|
return {
|
|
@@ -59,108 +593,6 @@ function toPublicContextDiff(diff) {
|
|
|
59
593
|
};
|
|
60
594
|
}
|
|
61
595
|
|
|
62
|
-
//#endregion
|
|
63
|
-
//#region src/site-context/review-payload.ts
|
|
64
|
-
var ReviewPayloadBuilder = class {
|
|
65
|
-
constructor(handlers) {
|
|
66
|
-
this.handlers = handlers;
|
|
67
|
-
}
|
|
68
|
-
async buildContentReviewPayload(input) {
|
|
69
|
-
const actionType = input.actionType ?? "content.publish";
|
|
70
|
-
const content = await this.loadContent(input.collection, input.id);
|
|
71
|
-
const compare = await this.loadCompare(input.collection, content.entryId);
|
|
72
|
-
const live = asRecord(compare.live);
|
|
73
|
-
const draft = asRecord(compare.draft) ?? content.data;
|
|
74
|
-
const hasChanges = typeof compare.hasChanges === "boolean" ? compare.hasChanges : stableStringify(live) !== stableStringify(draft);
|
|
75
|
-
const actionHash = await buildStableActionHash({
|
|
76
|
-
actionType,
|
|
77
|
-
collection: input.collection,
|
|
78
|
-
entryId: content.entryId,
|
|
79
|
-
liveRevisionId: content.liveRevisionId,
|
|
80
|
-
draftRevisionId: content.draftRevisionId,
|
|
81
|
-
reviewedRev: content.reviewedRev,
|
|
82
|
-
live,
|
|
83
|
-
draft
|
|
84
|
-
});
|
|
85
|
-
const scope = `content:${input.collection}:${content.entryId}`;
|
|
86
|
-
const summary = input.summary ?? `Review ${actionType} for ${input.collection}/${content.displayTitle ?? content.entryId}`;
|
|
87
|
-
return {
|
|
88
|
-
collection: input.collection,
|
|
89
|
-
entryId: content.entryId,
|
|
90
|
-
scope,
|
|
91
|
-
liveRevisionId: content.liveRevisionId,
|
|
92
|
-
draftRevisionId: content.draftRevisionId,
|
|
93
|
-
reviewedRev: content.reviewedRev,
|
|
94
|
-
actionType,
|
|
95
|
-
actionHash,
|
|
96
|
-
reviewPayload: {
|
|
97
|
-
kind: "content_review",
|
|
98
|
-
actionType,
|
|
99
|
-
summary,
|
|
100
|
-
target: {
|
|
101
|
-
collection: input.collection,
|
|
102
|
-
entryId: content.entryId,
|
|
103
|
-
scope,
|
|
104
|
-
liveRevisionId: content.liveRevisionId,
|
|
105
|
-
draftRevisionId: content.draftRevisionId,
|
|
106
|
-
reviewedRev: content.reviewedRev,
|
|
107
|
-
actionHash
|
|
108
|
-
},
|
|
109
|
-
content: {
|
|
110
|
-
id: content.entryId,
|
|
111
|
-
slug: content.slug,
|
|
112
|
-
status: content.status,
|
|
113
|
-
title: content.displayTitle,
|
|
114
|
-
updatedAt: content.updatedAt
|
|
115
|
-
},
|
|
116
|
-
diff: {
|
|
117
|
-
hasChanges,
|
|
118
|
-
live,
|
|
119
|
-
draft
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
async loadContent(collection, id) {
|
|
125
|
-
const result = await this.handlers.handleContentGet(collection, id);
|
|
126
|
-
if (!result.success) throw new Error(result.error?.message ?? `Content item not found: ${collection}/${id}`);
|
|
127
|
-
const payload = asRecord(result.data);
|
|
128
|
-
const item = asRecord(payload?.item);
|
|
129
|
-
if (!payload || !item) throw new Error("Content get response did not include an item");
|
|
130
|
-
const entryId = stringOrNull(item.id);
|
|
131
|
-
const reviewedRev = stringOrNull(payload._rev);
|
|
132
|
-
if (!entryId) throw new Error("Content item is missing id");
|
|
133
|
-
if (!reviewedRev) throw new Error("Content item is missing _rev for review binding");
|
|
134
|
-
const data = asRecord(item.data) ?? {};
|
|
135
|
-
const title = stringOrNull(data.title) ?? stringOrNull(item.title) ?? stringOrNull(item.slug);
|
|
136
|
-
return {
|
|
137
|
-
entryId,
|
|
138
|
-
reviewedRev,
|
|
139
|
-
liveRevisionId: stringOrNull(item.liveRevisionId),
|
|
140
|
-
draftRevisionId: stringOrNull(item.draftRevisionId),
|
|
141
|
-
slug: stringOrNull(item.slug),
|
|
142
|
-
status: stringOrNull(item.status),
|
|
143
|
-
updatedAt: stringOrNull(item.updatedAt),
|
|
144
|
-
displayTitle: title,
|
|
145
|
-
data
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
async loadCompare(collection, id) {
|
|
149
|
-
const result = await this.handlers.handleContentCompare(collection, id);
|
|
150
|
-
if (!result.success) throw new Error(result.error?.message ?? `Failed to compare content: ${collection}/${id}`);
|
|
151
|
-
return asRecord(result.data) ?? {};
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
function asRecord(value) {
|
|
155
|
-
return isRecord$1(value) ? value : null;
|
|
156
|
-
}
|
|
157
|
-
function isRecord$1(value) {
|
|
158
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
159
|
-
}
|
|
160
|
-
function stringOrNull(value) {
|
|
161
|
-
return typeof value === "string" && value.length > 0 ? value : null;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
596
|
//#endregion
|
|
165
597
|
//#region src/site-context/risk-policy.ts
|
|
166
598
|
var RiskPolicyEvaluator = class {
|
|
@@ -3145,16 +3577,25 @@ var HandoffSnapshotStore = class {
|
|
|
3145
3577
|
this.now = options.now ?? /* @__PURE__ */ new Date();
|
|
3146
3578
|
}
|
|
3147
3579
|
async capture(input) {
|
|
3148
|
-
assertExperimentalSiteContextWorkflowsEnabled();
|
|
3149
3580
|
parseSiteBriefingScope(input.scope);
|
|
3150
|
-
|
|
3581
|
+
if (Boolean(input.referenceType) !== Boolean(input.referenceId)) throw new Error("Handoff reference type and id must be provided together.");
|
|
3582
|
+
return this.withTransaction(async (transaction) => {
|
|
3583
|
+
if (input.referenceType === "assignment") {
|
|
3584
|
+
const assignment = await new AssignmentRepository(transaction).findById(input.referenceId);
|
|
3585
|
+
if (!assignment) throw new Error(`Assignment not found: ${input.referenceId}`);
|
|
3586
|
+
if (assignment.scope !== input.scope) throw new Error("Referenced Assignment scope must match the Handoff scope.");
|
|
3587
|
+
}
|
|
3588
|
+
const snapshot = await new HandoffSnapshotRepository(transaction).create(input);
|
|
3589
|
+
if (input.referenceType === "assignment") {
|
|
3590
|
+
if (!await new AssignmentRepository(transaction).linkHandoffSnapshot(input.referenceId, snapshot.id, snapshot.createdAt)) throw new Error(`Assignment not found: ${input.referenceId}`);
|
|
3591
|
+
}
|
|
3592
|
+
return snapshot;
|
|
3593
|
+
});
|
|
3151
3594
|
}
|
|
3152
3595
|
async get(id) {
|
|
3153
|
-
assertExperimentalSiteContextWorkflowsEnabled();
|
|
3154
3596
|
return new HandoffSnapshotRepository(this.db).findById(id);
|
|
3155
3597
|
}
|
|
3156
3598
|
async resume(input) {
|
|
3157
|
-
assertExperimentalSiteContextWorkflowsEnabled();
|
|
3158
3599
|
const repository = new HandoffSnapshotRepository(this.db);
|
|
3159
3600
|
const snapshot = await repository.findById(input.id);
|
|
3160
3601
|
if (!snapshot) return null;
|
|
@@ -3224,6 +3665,10 @@ var HandoffSnapshotStore = class {
|
|
|
3224
3665
|
}
|
|
3225
3666
|
};
|
|
3226
3667
|
}
|
|
3668
|
+
async withTransaction(operation) {
|
|
3669
|
+
if (this.db.isTransaction) return operation(this.db);
|
|
3670
|
+
return this.db.transaction().execute(operation);
|
|
3671
|
+
}
|
|
3227
3672
|
};
|
|
3228
3673
|
function summarizeScope(scope) {
|
|
3229
3674
|
return {
|
|
@@ -3279,7 +3724,6 @@ var AssignmentService = class {
|
|
|
3279
3724
|
this.repository = new AssignmentRepository(db);
|
|
3280
3725
|
}
|
|
3281
3726
|
async create(actor, input) {
|
|
3282
|
-
assertExperimentalSiteContextWorkflowsEnabled();
|
|
3283
3727
|
if (input.relatedHandoffSnapshotId) {
|
|
3284
3728
|
const snapshot = await new HandoffSnapshotRepository(this.db).findById(input.relatedHandoffSnapshotId);
|
|
3285
3729
|
if (!snapshot) throw new Error(`Handoff snapshot not found: ${input.relatedHandoffSnapshotId}`);
|
|
@@ -3303,18 +3747,15 @@ var AssignmentService = class {
|
|
|
3303
3747
|
});
|
|
3304
3748
|
}
|
|
3305
3749
|
async get(id, actor) {
|
|
3306
|
-
assertExperimentalSiteContextWorkflowsEnabled();
|
|
3307
3750
|
const assignment = await this.repository.findById(id);
|
|
3308
3751
|
if (!assignment) return null;
|
|
3309
3752
|
this.assertReadable(assignment, actor);
|
|
3310
3753
|
return assignment;
|
|
3311
3754
|
}
|
|
3312
3755
|
async list(actor, input = {}) {
|
|
3313
|
-
assertExperimentalSiteContextWorkflowsEnabled();
|
|
3314
3756
|
return this.repository.list(this.buildListQuery(actor, input));
|
|
3315
3757
|
}
|
|
3316
3758
|
async accept(input) {
|
|
3317
|
-
assertExperimentalSiteContextWorkflowsEnabled();
|
|
3318
3759
|
const assignment = await this.loadExisting(input.id);
|
|
3319
3760
|
this.assertAssigneeAction("accept", assignment, input.actor);
|
|
3320
3761
|
this.assertValidAction("accept", assignment.status);
|
|
@@ -3328,7 +3769,6 @@ var AssignmentService = class {
|
|
|
3328
3769
|
return accepted;
|
|
3329
3770
|
}
|
|
3330
3771
|
async start(input) {
|
|
3331
|
-
assertExperimentalSiteContextWorkflowsEnabled();
|
|
3332
3772
|
const assignment = await this.loadExisting(input.id);
|
|
3333
3773
|
this.assertAssigneeAction("start", assignment, input.actor);
|
|
3334
3774
|
this.assertValidAction("start", assignment.status);
|
|
@@ -3340,7 +3780,6 @@ var AssignmentService = class {
|
|
|
3340
3780
|
return started;
|
|
3341
3781
|
}
|
|
3342
3782
|
async block(input) {
|
|
3343
|
-
assertExperimentalSiteContextWorkflowsEnabled();
|
|
3344
3783
|
const assignment = await this.loadExisting(input.id);
|
|
3345
3784
|
this.assertAssigneeAction("block", assignment, input.actor);
|
|
3346
3785
|
this.assertValidAction("block", assignment.status);
|
|
@@ -3352,7 +3791,6 @@ var AssignmentService = class {
|
|
|
3352
3791
|
return blocked;
|
|
3353
3792
|
}
|
|
3354
3793
|
async complete(input) {
|
|
3355
|
-
assertExperimentalSiteContextWorkflowsEnabled();
|
|
3356
3794
|
const assignment = await this.loadExisting(input.id);
|
|
3357
3795
|
this.assertAssigneeAction("complete", assignment, input.actor);
|
|
3358
3796
|
this.assertValidAction("complete", assignment.status);
|
|
@@ -3364,7 +3802,6 @@ var AssignmentService = class {
|
|
|
3364
3802
|
return completed;
|
|
3365
3803
|
}
|
|
3366
3804
|
async decline(input) {
|
|
3367
|
-
assertExperimentalSiteContextWorkflowsEnabled();
|
|
3368
3805
|
const assignment = await this.loadExisting(input.id);
|
|
3369
3806
|
this.assertAssigneeAction("decline", assignment, input.actor);
|
|
3370
3807
|
this.assertValidAction("decline", assignment.status);
|
|
@@ -3376,7 +3813,6 @@ var AssignmentService = class {
|
|
|
3376
3813
|
return declined;
|
|
3377
3814
|
}
|
|
3378
3815
|
async cancel(input) {
|
|
3379
|
-
assertExperimentalSiteContextWorkflowsEnabled();
|
|
3380
3816
|
const assignment = await this.loadExisting(input.id);
|
|
3381
3817
|
this.assertCanceller(assignment, input.actor);
|
|
3382
3818
|
this.assertValidAction("cancel", assignment.status);
|
|
@@ -3514,4 +3950,4 @@ var WorkflowHitlCoordinator = class {
|
|
|
3514
3950
|
};
|
|
3515
3951
|
|
|
3516
3952
|
//#endregion
|
|
3517
|
-
export {
|
|
3953
|
+
export { ASSIGNMENT_STATUSES as C, ASSIGNMENT_PRIORITIES as S, toPublicContextDiff as _, EntityResolver as a, HitlRequestService as b, TaxonomyHitlPayloadBuilder as c, SettingsHitlPayloadBuilder as d, WordPressImportHitlPayloadBuilder as f, RiskPolicyEvaluator as g, SchemaHitlPayloadBuilder as h, ActorExpertiseService as i, MenuHitlPayloadBuilder as l, PluginHitlPayloadBuilder as m, AssignmentService as n, WidgetHitlPayloadBuilder as o, ExclusiveHookHitlPayloadBuilder as p, HandoffSnapshotStore as r, SectionHitlPayloadBuilder as s, WorkflowHitlCoordinator as t, RedirectHitlPayloadBuilder as u, toPublicContextEntry as v, AssignmentRepository as w, ASSIGNMENT_ACTOR_TYPES as x, toPublicContextEntryPage as y };
|