sanoma 0.11.21 → 0.11.23
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 +55 -14
- package/app/README.md +12 -8
- package/app/dist/api.d.ts +191 -5
- package/app/dist/api.js +125 -4
- package/app/dist/api.js.map +1 -1
- package/app/dist/build.d.ts +28 -3
- package/app/dist/build.js +154 -15
- package/app/dist/build.js.map +1 -1
- package/app/dist/bundle-build.d.ts +32 -0
- package/app/dist/bundle-build.js +127 -67
- package/app/dist/bundle-build.js.map +1 -1
- package/app/dist/client/assets/ArrowDown.es-BVRf--PS.js +1 -0
- package/app/dist/client/assets/CaretDown.es-D12mWb2j.js +1 -0
- package/app/dist/client/assets/CatchBoundary-Cb__yx-s.js +1 -0
- package/app/dist/client/assets/Check.es-b7BdqO2s.js +1 -0
- package/app/dist/client/assets/CheckCircle.es-DKXiWmAT.js +1 -0
- package/app/dist/client/assets/Copy.es-CvUujKw7.js +1 -0
- package/app/dist/client/assets/DialogTitle-5oboyLiq.js +1 -0
- package/app/dist/client/assets/FloppyDisk.es-CDyDob8p.js +1 -0
- package/app/dist/client/assets/Globe.es-C1pgZCGM.js +1 -0
- package/app/dist/client/assets/MagnifyingGlass.es-CZ3i6pz0.js +1 -0
- package/app/dist/client/assets/Play.es-DGJ1CGhp.js +1 -0
- package/app/dist/client/assets/Plug.es-BPhGL8MK.js +1 -0
- package/app/dist/client/assets/Plus.es-i3Vaa2WW.js +1 -0
- package/app/dist/client/assets/Separator-Cu9cQDBN.js +1 -0
- package/app/dist/client/assets/X.es-B7rq0E_-.js +1 -0
- package/app/dist/client/assets/_id-0_Y-lz6G.js +1 -0
- package/app/dist/client/assets/_id-3tGIwJ5T.js +1 -0
- package/app/dist/client/assets/_id-CgPVeQe8.js +1 -0
- package/app/dist/client/assets/_id-DFlFuBDE.js +1 -0
- package/app/dist/client/assets/_id-QNnNLGx_.js +1 -0
- package/app/dist/client/assets/_name-6k1yqjX8.js +1 -0
- package/app/dist/client/assets/_name-B4Qba2-o.js +4 -0
- package/app/dist/client/assets/_name-BfPXcP49.js +1 -0
- package/app/dist/client/assets/_name-CqBzHz7c.js +1 -0
- package/app/dist/client/assets/_vendor-CfHRJBG8.js +1 -0
- package/app/dist/client/assets/_vendor-Dj7KCZ74.js +1 -0
- package/app/dist/client/assets/app-chrome-CFH47gLL.js +5 -0
- package/app/dist/client/assets/app-scope-Z_2GE9oz.js +1 -0
- package/app/dist/client/assets/approval-CgksyU5L.js +1 -0
- package/app/dist/client/assets/apps-BDsPVmMY.js +1 -0
- package/app/dist/client/assets/button-D5kdANef.js +1 -0
- package/app/dist/client/assets/change-glance-D6N6Xaqu.js +1 -0
- package/app/dist/client/assets/changes-B6xxBiC0.js +1 -0
- package/app/dist/client/assets/changes-BS7eJI5T.js +1 -0
- package/app/dist/client/assets/chat-Bw3WhRE9.js +14 -0
- package/app/dist/client/assets/chat-button-DNusaP5n.js +1 -0
- package/app/dist/client/assets/chat-prompt-z0XJPDtH.js +1 -0
- package/app/dist/client/assets/{code-BVYaiQEr.js → code-CT4-YDKq.js} +2 -2
- package/app/dist/client/assets/common-DZLdx_jS.js +3 -0
- package/app/dist/client/assets/composite-CoGyvQjv.js +1 -0
- package/app/dist/client/assets/connect-BMk-KP-f.js +1 -0
- package/app/dist/client/assets/connections-TbS_jeiy.js +5 -0
- package/app/dist/client/assets/connectors-CgRpyRdd.js +1 -0
- package/app/dist/client/assets/credentials-Dxpl8sUw.js +1 -0
- package/app/dist/client/assets/css-BGIxQoYs.js +1 -0
- package/app/dist/client/assets/css-DgaLhXQH.js +1 -0
- package/app/dist/client/assets/data-lKkklNeo.js +1 -0
- package/app/dist/client/assets/decidable-w2VGgZwN.js +1 -0
- package/app/dist/client/assets/declaration-form-CAwox7F1.js +1 -0
- package/app/dist/client/assets/dialog-DDAfDsGh.js +1 -0
- package/app/dist/client/assets/diff-woXpYk--.js +1 -0
- package/app/dist/client/assets/engine-CBuzy-Ik.js +1 -0
- package/app/dist/client/assets/existing-2kDivy4p.js +1 -0
- package/app/dist/client/assets/fence-BdtS5gi0.js +157 -0
- package/app/dist/client/assets/github-dark-C-LZuMrd.js +1 -0
- package/app/dist/client/assets/github-light-EUqPIrTm.js +1 -0
- package/app/dist/client/assets/graph-BqVQ68hK.js +7 -0
- package/app/dist/client/assets/grid-diff-Jj1nTy52.js +1 -0
- package/app/dist/client/assets/held-card-DjBO8PTe.js +1 -0
- package/app/dist/client/assets/highlighted-body-JLMTFACH-Co7ss_Ht.js +1 -0
- package/app/dist/client/assets/hosting-DC7Pftfb.js +1 -0
- package/app/dist/client/assets/html-BHZv6uqE.js +1 -0
- package/app/dist/client/assets/import-DhVQArmJ.js +1 -0
- package/app/dist/client/assets/inbox-5h39e_tI.js +1 -0
- package/app/dist/client/assets/inbox-CUNaP4uz.js +1 -0
- package/app/dist/client/assets/index-CA_5CFb4.js +10 -0
- package/app/dist/client/assets/item-vV00RYfb.js +1 -0
- package/app/dist/client/assets/javascript-BzbQS41l.js +1 -0
- package/app/dist/client/assets/javascript-CpIGwZ_Y.js +1 -0
- package/app/dist/client/assets/json-qhed-kSA.js +1 -0
- package/app/dist/client/assets/jsx-Bz0zcwM4.js +1 -0
- package/app/dist/client/assets/kit-BZcdh1Xm.js +1 -0
- package/app/dist/client/assets/lazyRouteComponent-C2a8bGcK.js +1 -0
- package/app/dist/client/assets/markdown-BYOwaDjH.js +1 -0
- package/app/dist/client/assets/markdown-bsqylRZb.js +164 -0
- package/app/dist/client/assets/mermaid-WFAXDIZX-CYMnek4e.js +1 -0
- package/app/dist/client/assets/motion-D6e1hqz4.js +1 -0
- package/app/dist/client/assets/people-Bn8GAJ3z.js +1 -0
- package/app/dist/client/assets/permissions-Csf87P7b.js +2 -0
- package/app/dist/client/assets/permissions-grid-CzK64E29.js +1 -0
- package/app/dist/client/assets/preload-helper-BLdHbfdN.js +1 -0
- package/app/dist/client/assets/python-gzcpVVnB.js +1 -0
- package/app/dist/client/assets/queries-XJ-fmuYb.js +57 -0
- package/app/dist/client/assets/react-dom-D6fTz1bt.js +1 -0
- package/app/dist/client/assets/review-BjpH-tT4.js +1 -0
- package/app/dist/client/assets/route-CD2oErox.js +1 -0
- package/app/dist/client/assets/route-CRwDZE-c.js +1 -0
- package/app/dist/client/assets/routes-gbZbqIhO.js +1 -0
- package/app/dist/client/assets/runs-table-nkQLXJxG.js +1 -0
- package/app/dist/client/assets/scenario-CZ7tmap7.js +1 -0
- package/app/dist/client/assets/scenario-graph-W2XcWuur.js +1 -0
- package/app/dist/client/assets/separator-Bdtc7rou.js +1 -0
- package/app/dist/client/assets/{sheet-BYL9XU5s.js → sheet-P-hJsTeq.js} +1 -1
- package/app/dist/client/assets/shellscript-CLZ0U2zV.js +1 -0
- package/app/dist/client/assets/site-icon-1Mcc1UIb.js +1 -0
- package/app/dist/client/assets/sites.index-CXcRF_R0.js +1 -0
- package/app/dist/client/assets/spinner-XaRXIj9W.js +1 -0
- package/app/dist/client/assets/sql-CEbI0hMM.js +1 -0
- package/app/dist/client/assets/start-form-6whPfUoW.js +1 -0
- package/app/dist/client/assets/store-BT988jIX.js +1 -0
- package/app/dist/client/assets/style-DaqPHcI1.css +2 -0
- package/app/dist/client/assets/table-B81tv0LG.js +1 -0
- package/app/dist/client/assets/textarea-CRpYU-qx.js +1 -0
- package/app/dist/client/assets/tsx-udAQXfEw.js +1 -0
- package/app/dist/client/assets/typescript-bsJCZSQ-.js +1 -0
- package/app/dist/client/assets/useLoaderData-BIegJC9y.js +1 -0
- package/app/dist/client/assets/useOpenInteractionType-UhakpAXY.js +1 -0
- package/app/dist/client/assets/useRegisterFieldControl-CT8iqvDE.js +1 -0
- package/app/dist/client/assets/useValueChanged-DBqn456b.js +1 -0
- package/app/dist/client/assets/utils-BRvE9-Fo.js +1 -0
- package/app/dist/client/assets/who-are-you-_7OehU_o.js +1 -0
- package/app/dist/client/assets/workflow-DSNK0oFo.js +1 -0
- package/app/dist/client/assets/workflow-view-VFD3onJL.js +1 -0
- package/app/dist/client/assets/workflows-CT9wqMl2.js +1 -0
- package/app/dist/client/assets/yaml-rwi0_p6S.js +1 -0
- package/app/dist/components/grid/plan.d.ts +46 -262
- package/app/dist/components/grid/plan.js +134 -138
- package/app/dist/components/grid/plan.js.map +1 -1
- package/app/dist/demo-build.d.ts +58 -0
- package/app/dist/demo-build.js +440 -0
- package/app/dist/demo-build.js.map +1 -0
- package/app/dist/handler.d.ts +9 -7
- package/app/dist/handler.js +10 -10
- package/app/dist/handler.js.map +1 -1
- package/app/dist/index.d.ts +4 -4
- package/app/dist/index.js +52 -35
- package/app/dist/index.js.map +1 -1
- package/app/dist/lib/chat.d.ts +67 -20
- package/app/dist/lib/chat.js +54 -18
- package/app/dist/lib/chat.js.map +1 -1
- package/app/dist/lib/names.d.ts +7 -0
- package/app/dist/lib/names.js +6 -2
- package/app/dist/lib/names.js.map +1 -1
- package/app/dist/login/page.d.ts +1 -10
- package/app/dist/login/page.js +0 -14
- package/app/dist/login/page.js.map +1 -1
- package/app/dist/login/staff.js +3 -3
- package/app/dist/login/staff.js.map +1 -1
- package/app/dist/server/assets/{_id-wuJIq2ZZ.js → _id-B6iAc90c.js} +2 -2
- package/app/dist/server/assets/{_id-Dt9tTylX.js → _id-BlceO2iK.js} +3 -3
- package/app/dist/server/assets/{_id-wB8khGTz.js → _id-Cc0uBuJb.js} +12 -7
- package/app/dist/server/assets/{_id-ce1EGp7Y.js → _id-DYfvgveB.js} +2 -2
- package/app/dist/server/assets/{_id-BViXAagq.js → _id-Dvn0wB-1.js} +15 -330
- package/app/dist/server/assets/{_name-BGagGBjX.js → _name-3AGcE6tj.js} +7 -7
- package/app/dist/server/assets/{_name-DntbHE-b.js → _name-BIcmcEwj.js} +11 -11
- package/app/dist/server/assets/{_name-BqFwnyf7.js → _name-CfoydEzk.js} +2 -2
- package/app/dist/server/assets/{_name-D_-MhjNf.js → _name-VpcPszKf.js} +210 -63
- package/app/dist/server/assets/{_tanstack-start-manifest_v-BljuBM-G.js → _tanstack-start-manifest_v-DUL7FcJk.js} +119 -91
- package/app/dist/server/assets/{_vendor-CcEviOki.js → _vendor-Bwis2sPx.js} +2 -2
- package/app/dist/server/assets/{_vendor-CNB03LWX.js → _vendor-DUtH-Z9W.js} +8 -8
- package/app/dist/server/assets/{actor-D6iA0pDg.js → actor-DAOPjcdj.js} +1 -1
- package/app/dist/server/assets/app-chrome-B8oA4uXZ.js +2298 -0
- package/app/dist/server/assets/{app-scope-CXIgOFmi.js → app-scope-BxuIu0xV.js} +2 -2
- package/app/dist/server/assets/{apply-plan-ybBda6vQ.js → apply-plan-CHJ_Hr71.js} +8 -7
- package/app/dist/server/assets/{approval-Su315ikC.js → approval-DR_9mBcx.js} +17 -14
- package/app/dist/server/assets/{apps-xwQAehch.js → apps-CtPev5RI.js} +7 -7
- package/app/dist/server/assets/button-Xwx3rpQ0.js +43 -0
- package/app/dist/server/assets/change-glance-DGqh7Pxb.js +54 -0
- package/app/dist/server/assets/{change-glance-CpArIbGS.js → changes-C3qjEBZP.js} +2 -54
- package/app/dist/server/assets/{changes-Bc_OiDBD.js → changes-DfOnO87K.js} +8 -7
- package/app/dist/server/assets/{chat-DMN_hoKm.js → chat-B19X0_8f.js} +133 -34
- package/app/dist/server/assets/{chat-button-LtA80MoR.js → chat-button-SluTWK8R.js} +2 -2
- package/app/dist/server/assets/{code-COyt8L-n.js → code-hVpCkmAZ.js} +1 -1
- package/app/dist/server/assets/{common-CWHLj7KV.js → common-JUUJLp4v.js} +30 -82
- package/app/dist/server/assets/{connect-BpPiu5s6.js → connect-DKu1UgY-.js} +11 -10
- package/app/dist/server/assets/{connections-DBgb1bvX.js → connections-Dyedl4qi.js} +12 -11
- package/app/dist/server/assets/{connectors-5a5_SlHO.js → connectors-yojQH7WS.js} +8 -8
- package/app/dist/server/assets/{credentials-ud_Y68hx.js → credentials-2Z6EHitQ.js} +10 -9
- package/app/dist/server/assets/{data-aEdhwcqy.js → data-1padc_i_.js} +7 -7
- package/app/dist/server/assets/{declaration-form-Dfg1yNuY.js → declaration-form-MAnn_M8g.js} +7 -6
- package/app/dist/server/assets/{dialog-BGjiw3Dx.js → dialog-T0bzlKzs.js} +2 -2
- package/app/dist/server/assets/{dropdown-menu-DAC3LWas.js → dropdown-menu-RGvPORm4.js} +1 -1
- package/app/dist/server/assets/{existing-B4d4NrC8.js → existing-BZjX_7Aa.js} +8 -7
- package/app/dist/server/assets/fence-BvNu3YNO.js +130 -0
- package/app/dist/server/assets/{field-C0Xx_90s.js → field-DFpkT1id.js} +1 -1
- package/app/dist/server/assets/{functions-BvFYzabD.js → functions-wlvFaDkF.js} +246 -44
- package/app/dist/server/assets/{graph-qYOdoz2s.js → graph-DjANDk1P.js} +5 -5
- package/app/dist/server/assets/{grid-diff-jTvp-8wS.js → grid-diff-D5bQDKl2.js} +1 -1
- package/app/dist/server/assets/held-card-CCEypEau.js +75 -0
- package/app/dist/server/assets/{hosting-bbn9UvDc.js → hosting-Csr6AVC7.js} +321 -42
- package/app/dist/server/assets/{import-DIwvzHb6.js → import-CtPlwdIl.js} +12 -10
- package/app/dist/server/assets/{inbox-Dj-5FleF.js → inbox-9-WMgjdU.js} +2 -2
- package/app/dist/server/assets/{inbox-D6R6sWBB.js → inbox-BYKHV9Yh.js} +8 -8
- package/app/dist/server/assets/{input-D63gF3G2.js → input-CF-vX8Xp.js} +1 -1
- package/app/dist/server/assets/{item-BDSXoEr_.js → item-LBDNja5f.js} +1 -1
- package/app/dist/server/assets/{kit-D6EulwBe.js → kit-D5moAfcg.js} +57 -4
- package/app/dist/server/assets/markdown-B9odAiMy.js +116 -0
- package/app/dist/server/assets/{middleware-B8JRLyxx.js → middleware-C4Wn6uHO.js} +325 -285
- package/app/dist/server/assets/{native-select-DLa-He0n.js → native-select-etaMvR-i.js} +2 -9
- package/app/dist/server/assets/{people-CkU_AxrV.js → people-LpcYXtEq.js} +13 -12
- package/app/dist/server/assets/{permissions-BfMcQqQb.js → permissions-M0kzvVVm.js} +9 -8
- package/app/dist/server/assets/{permissions-grid-DWP9FAAS.js → permissions-grid-CwWWdcQA.js} +4 -4
- package/app/dist/server/assets/{button-f9Lc8qLl.js → queries-BDuQsTdU.js} +141 -59
- package/app/dist/server/assets/review-BFZCPdVZ.js +355 -0
- package/app/dist/server/assets/{route-CF_8jQYY.js → route-BJLQf4ik.js} +2 -2
- package/app/dist/server/assets/{route-BTT7nMJq.js → route-C3uFABee.js} +2 -2
- package/app/dist/server/assets/{router-BvYtxrVN.js → router-Dx7Gu0CN.js} +175 -147
- package/app/dist/server/assets/routes-iVrnGFaR.js +227 -0
- package/app/dist/server/assets/{runs-table-BBudn12Y.js → runs-table-g3QYggO3.js} +6 -6
- package/app/dist/server/assets/{scenario-BXGTSTiP.js → scenario-B5dGlEGF.js} +5 -5
- package/app/dist/server/assets/{separator-8MZ7vR3f.js → separator-Cf98V8ie.js} +1 -1
- package/app/dist/server/assets/{sheet-5Cyp-4UW.js → sheet-DTOG7OHQ.js} +2 -2
- package/app/dist/server/assets/sites.index-BNeYUQnQ.js +165 -0
- package/app/dist/server/assets/{spinner-C1ZW08lp.js → spinner-016IPVi-.js} +1 -1
- package/app/dist/server/assets/{start-CSU4irVK.js → start-CIKqNkKp.js} +2 -2
- package/app/dist/server/assets/{start-form-DI60UOrc.js → start-form-BXAi2lVm.js} +10 -9
- package/app/dist/server/assets/{table-DtPk_h_5.js → table-y-dGlLx6.js} +1 -1
- package/app/dist/server/assets/{textarea-f0Ip5ed1.js → textarea-B02joDnr.js} +1 -1
- package/app/dist/server/assets/utils-CHesvfjo.js +138 -0
- package/app/dist/server/assets/{who-are-you-ZGyMnpVi.js → who-are-you-CavnVMGe.js} +16 -10
- package/app/dist/server/assets/{workflow-Z99QWO42.js → workflow-BXhqp6S1.js} +5 -5
- package/app/dist/server/assets/{workflow-view-C8X8U11S.js → workflow-view-go1rbTSF.js} +14 -13
- package/app/dist/server/assets/{workflows-C0kJoGf1.js → workflows-BCcXZtN-.js} +14 -14
- package/app/dist/server/chat.d.ts +6 -1
- package/app/dist/server/chat.js +39 -20
- package/app/dist/server/chat.js.map +1 -1
- package/app/dist/server/core.d.ts +24 -9
- package/app/dist/server/core.js +58 -119
- package/app/dist/server/core.js.map +1 -1
- package/app/dist/server/go-live.d.ts +11 -2
- package/app/dist/server/go-live.js +27 -27
- package/app/dist/server/go-live.js.map +1 -1
- package/app/dist/server/server.js +68 -48
- package/app/dist/server/setup.js +1 -1
- package/app/dist/server/setup.js.map +1 -1
- package/app/dist/server/token-redeem.d.ts +8 -0
- package/app/dist/server/token-redeem.js +45 -0
- package/app/dist/server/token-redeem.js.map +1 -0
- package/app/dist/site-path.d.ts +15 -0
- package/app/dist/site-path.js +26 -0
- package/app/dist/site-path.js.map +1 -1
- package/app/dist/snapshot-build.js +1 -0
- package/app/dist/snapshot-build.js.map +1 -1
- package/app/dist/steps/agent/acp.d.ts +3 -97
- package/app/dist/steps/agent/acp.js +19 -49
- package/app/dist/steps/agent/acp.js.map +1 -1
- package/app/dist/steps/agent/checkout.d.ts +18 -1
- package/app/dist/steps/agent/checkout.js +17 -0
- package/app/dist/steps/agent/checkout.js.map +1 -1
- package/app/dist/steps/agent/harness.d.ts +2 -4
- package/app/dist/steps/agent/harness.js +45 -61
- package/app/dist/steps/agent/harness.js.map +1 -1
- package/app/dist/steps/agent/prompt.d.ts +1 -1
- package/app/dist/steps/agent/prompt.js +37 -16
- package/app/dist/steps/agent/prompt.js.map +1 -1
- package/app/dist/steps/agent/transcript.d.ts +10 -1
- package/app/dist/steps/agent/transcript.js +75 -2
- package/app/dist/steps/agent/transcript.js.map +1 -1
- package/app/dist/steps/agent/turn.d.ts +4 -6
- package/app/dist/steps/agent/turn.js +14 -16
- package/app/dist/steps/agent/turn.js.map +1 -1
- package/app/dist/steps/index.js +2 -2
- package/app/dist/steps/index.js.map +1 -1
- package/app/dist/steps/writes.d.ts +21 -7
- package/app/dist/steps/writes.js +100 -23
- package/app/dist/steps/writes.js.map +1 -1
- package/app/dist/stylesheet.json +1 -1
- package/app/src/api.ts +188 -4
- package/app/src/build.ts +177 -14
- package/app/src/bundle-build.ts +132 -63
- package/app/src/components/app-chrome.tsx +28 -13
- package/app/src/components/approval.tsx +1 -1
- package/app/src/components/common.tsx +18 -88
- package/app/src/components/data-grid.tsx +2 -1
- package/app/src/components/go-live-cloud.tsx +44 -0
- package/app/src/components/go-live.tsx +51 -13
- package/app/src/components/grid/columns.tsx +175 -53
- package/app/src/components/grid/grid.tsx +4 -2
- package/app/src/components/grid/plan.ts +153 -164
- package/app/src/components/grid/review.tsx +108 -118
- package/app/src/components/home.tsx +199 -0
- package/app/src/components/import/match.tsx +2 -1
- package/app/src/components/import/sheet.ts +2 -1
- package/app/src/components/kit.tsx +55 -1
- package/app/src/components/logo.tsx +25 -0
- package/app/src/components/record-form.tsx +12 -5
- package/app/src/components/shell/bar.tsx +35 -26
- package/app/src/components/shell/chat-parts.tsx +185 -126
- package/app/src/components/shell/chat-prompt.ts +6 -2
- package/app/src/components/shell/chat.tsx +154 -220
- package/app/src/components/shell/composer.tsx +140 -0
- package/app/src/components/shell/connect-agent.tsx +157 -0
- package/app/src/components/shell/draft-card.tsx +192 -45
- package/app/src/components/shell/engine-mark.tsx +9 -0
- package/app/src/components/shell/fence.tsx +25 -0
- package/app/src/components/shell/held-card.tsx +58 -0
- package/app/src/components/shell/markdown.tsx +152 -0
- package/app/src/components/shell/nav-user.tsx +11 -1
- package/app/src/components/shell/prefs.ts +12 -1
- package/app/src/components/shell/thread.tsx +174 -0
- package/app/src/components/store-move.tsx +2 -1
- package/app/src/components/ui/bubble.tsx +117 -0
- package/app/src/components/ui/code-block.tsx +235 -0
- package/app/src/components/ui/input-group.tsx +136 -0
- package/app/src/components/ui/marker.tsx +67 -0
- package/app/src/components/ui/message-scroller.tsx +117 -0
- package/app/src/components/ui/message.tsx +74 -0
- package/app/src/components/ui/radio-group.tsx +26 -0
- package/app/src/components/ui/trace.tsx +133 -0
- package/app/src/components/who-are-you.tsx +8 -3
- package/app/src/demo/api.ts +42 -0
- package/app/src/demo/client-rpc.ts +16 -0
- package/app/src/demo/demo.css +31 -0
- package/app/src/demo/mount.tsx +97 -0
- package/app/src/demo/root.tsx +31 -0
- package/app/src/demo/tailwind.css +4 -0
- package/app/src/demo-build.ts +525 -0
- package/app/src/env.d.ts +12 -0
- package/app/src/functions.ts +50 -7
- package/app/src/handler.ts +20 -14
- package/app/src/hooks/use-highlighted-code.ts +72 -0
- package/app/src/index.ts +55 -36
- package/app/src/lib/chat.ts +113 -23
- package/app/src/lib/cn-tables.ts +23 -23
- package/app/src/lib/company-state.ts +73 -0
- package/app/src/lib/highlighter.tsx +114 -0
- package/app/src/lib/names.ts +13 -2
- package/app/src/login/page.ts +1 -21
- package/app/src/login/staff.ts +3 -3
- package/app/src/queries.ts +121 -18
- package/app/src/routes/__root.tsx +24 -7
- package/app/src/routes/changes/$id.tsx +4 -3
- package/app/src/routes/connectors/index.tsx +1 -1
- package/app/src/routes/data/$name/import.tsx +2 -1
- package/app/src/routes/data/$name/index.tsx +1 -2
- package/app/src/routes/hosting/index.tsx +277 -60
- package/app/src/routes/index.tsx +15 -4
- package/app/src/routes/sites.index.tsx +41 -3
- package/app/src/routes/workflows/$name/runs/$id.tsx +3 -1
- package/app/src/server/chat.ts +41 -19
- package/app/src/server/columns.ts +44 -18
- package/app/src/server/company-state.ts +76 -0
- package/app/src/server/core.ts +72 -116
- package/app/src/server/go-live.ts +35 -27
- package/app/src/server/setup-progress.ts +28 -0
- package/app/src/server/setup.ts +1 -1
- package/app/src/server/token-redeem.ts +49 -0
- package/app/src/site-api.ts +10 -0
- package/app/src/site-path.ts +29 -0
- package/app/src/site.ts +1 -1
- package/app/src/snapshot-build.ts +1 -0
- package/app/src/steps/agent/acp.ts +10 -80
- package/app/src/steps/agent/checkout.ts +30 -0
- package/app/src/steps/agent/harness.ts +53 -78
- package/app/src/steps/agent/prompt.ts +45 -17
- package/app/src/steps/agent/transcript.ts +90 -3
- package/app/src/steps/agent/turn.ts +18 -16
- package/app/src/steps/index.ts +2 -2
- package/app/src/steps/writes.ts +121 -31
- package/app/src/worker/app.ts +17 -14
- package/dist/check.js +2 -2
- package/dist/check.js.map +1 -1
- package/dist/cli.js +81 -22
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +8 -1
- package/dist/config.js +49 -8
- package/dist/config.js.map +1 -1
- package/dist/events.d.ts +15 -1
- package/dist/events.js +7 -0
- package/dist/events.js.map +1 -1
- package/dist/init.d.ts +27 -14
- package/dist/init.js +87 -39
- package/dist/init.js.map +1 -1
- package/dist/serve.d.ts +6 -2
- package/dist/serve.js +71 -9
- package/dist/serve.js.map +1 -1
- package/dist/source.d.ts +5 -0
- package/dist/source.js +113 -23
- package/dist/source.js.map +1 -1
- package/dist/worker-port.d.ts +16 -2
- package/dist/worker-port.js +44 -5
- package/dist/worker-port.js.map +1 -1
- package/invoices/README.md +66 -0
- package/invoices/dist/calculate.d.ts +37 -0
- package/invoices/dist/calculate.js +97 -0
- package/invoices/dist/calculate.js.map +1 -0
- package/invoices/dist/index.d.ts +4 -0
- package/invoices/dist/index.js +5 -0
- package/invoices/dist/index.js.map +1 -0
- package/invoices/dist/logo.d.ts +2 -0
- package/invoices/dist/logo.js +89 -0
- package/invoices/dist/logo.js.map +1 -0
- package/invoices/dist/pdf.d.ts +33 -0
- package/invoices/dist/pdf.js +215 -0
- package/invoices/dist/pdf.js.map +1 -0
- package/invoices/dist/schema.d.ts +156 -0
- package/invoices/dist/schema.js +88 -0
- package/invoices/dist/schema.js.map +1 -0
- package/oxlint.json +18 -0
- package/package.json +42 -7
- package/template/.env.example +15 -4
- package/template/AGENTS.md +10 -6
- package/template/package.json +6 -1
- package/template/policies/policy.cedar +5 -5
- package/template/resources/people.ts +5 -13
- package/template/resources/sanoma/infra.ts +8 -0
- package/template/sanoma.config.ts +18 -11
- package/template/scenarios/record-lead/record.feature +14 -0
- package/template/secrets.ts +13 -0
- package/template/tsconfig.json +1 -0
- package/template/workflows/record-lead.ts +30 -0
- package/testing/README.md +4 -4
- package/testing/dist/build.d.ts +3 -3
- package/testing/dist/build.js +4 -4
- package/testing/dist/build.js.map +1 -1
- package/testing/dist/host.d.ts +38 -21
- package/testing/dist/host.js +159 -77
- package/testing/dist/host.js.map +1 -1
- package/testing/dist/scenarios.d.ts +2 -1
- package/testing/dist/scenarios.js +14 -4
- package/testing/dist/scenarios.js.map +1 -1
- package/workflows/CLOUD-IDENTITY.md +15 -20
- package/workflows/README.md +54 -19
- package/workflows/dist/app-steps.js +8 -0
- package/workflows/dist/app-steps.js.map +1 -1
- package/workflows/dist/app-workflows.d.ts +172 -6
- package/workflows/dist/app-workflows.js +57 -9
- package/workflows/dist/app-workflows.js.map +1 -1
- package/workflows/dist/approvals.d.ts +3 -1
- package/workflows/dist/approvals.js +3 -1
- package/workflows/dist/approvals.js.map +1 -1
- package/workflows/dist/call.d.ts +8 -40
- package/workflows/dist/call.js +24 -135
- package/workflows/dist/call.js.map +1 -1
- package/workflows/dist/change-steps.d.ts +7 -0
- package/workflows/dist/change-steps.js +37 -13
- package/workflows/dist/change-steps.js.map +1 -1
- package/workflows/dist/change-workflow.d.ts +22 -10
- package/workflows/dist/change-workflow.js +30 -12
- package/workflows/dist/change-workflow.js.map +1 -1
- package/workflows/dist/change.d.ts +233 -7
- package/workflows/dist/change.js +27 -9
- package/workflows/dist/change.js.map +1 -1
- package/workflows/dist/client.d.ts +32 -5
- package/workflows/dist/client.js +94 -35
- package/workflows/dist/client.js.map +1 -1
- package/workflows/dist/cloud-identity.d.ts +5 -2
- package/workflows/dist/cloud-identity.js +7 -4
- package/workflows/dist/cloud-identity.js.map +1 -1
- package/workflows/dist/collection-driver.d.ts +20 -0
- package/workflows/dist/collection-driver.js +201 -0
- package/workflows/dist/collection-driver.js.map +1 -0
- package/workflows/dist/collection.d.ts +126 -14
- package/workflows/dist/collection.js +45 -168
- package/workflows/dist/collection.js.map +1 -1
- package/workflows/dist/company-file.d.ts +22 -0
- package/workflows/dist/company-file.js +82 -0
- package/workflows/dist/company-file.js.map +1 -0
- package/workflows/dist/config.d.ts +34 -6
- package/workflows/dist/config.js +58 -45
- package/workflows/dist/config.js.map +1 -1
- package/workflows/dist/ctx.d.ts +101 -0
- package/workflows/dist/ctx.js +171 -0
- package/workflows/dist/ctx.js.map +1 -0
- package/workflows/dist/db/company.d.ts +115 -1
- package/workflows/dist/db/company.js +14 -1
- package/workflows/dist/db/company.js.map +1 -1
- package/workflows/dist/db/dbos.d.ts +17 -0
- package/workflows/dist/db/dbos.js +2 -0
- package/workflows/dist/db/dbos.js.map +1 -1
- package/workflows/dist/db/identity.d.ts +2 -2
- package/workflows/dist/db/identity.js +2 -2
- package/workflows/dist/db/identity.js.map +1 -1
- package/workflows/dist/db.d.ts +1 -1
- package/workflows/dist/db.js +10 -6
- package/workflows/dist/db.js.map +1 -1
- package/workflows/dist/deadlines.d.ts +14 -8
- package/workflows/dist/deadlines.js +22 -11
- package/workflows/dist/deadlines.js.map +1 -1
- package/workflows/dist/define.d.ts +0 -8
- package/workflows/dist/define.js +1 -24
- package/workflows/dist/define.js.map +1 -1
- package/workflows/dist/describe.d.ts +1 -1
- package/workflows/dist/describe.js +18 -5
- package/workflows/dist/describe.js.map +1 -1
- package/workflows/dist/description.d.ts +408 -2
- package/workflows/dist/description.js +130 -5
- package/workflows/dist/description.js.map +1 -1
- package/workflows/dist/drift.d.ts +5 -2
- package/workflows/dist/drift.js +5 -3
- package/workflows/dist/drift.js.map +1 -1
- package/workflows/dist/errors.d.ts +11 -11
- package/workflows/dist/errors.js +17 -36
- package/workflows/dist/errors.js.map +1 -1
- package/workflows/dist/fake.d.ts +0 -26
- package/workflows/dist/fake.js +0 -123
- package/workflows/dist/fake.js.map +1 -1
- package/workflows/dist/fakes.d.ts +2 -0
- package/workflows/dist/fakes.js +5 -0
- package/workflows/dist/fakes.js.map +1 -0
- package/workflows/dist/givens.d.ts +51 -0
- package/workflows/dist/givens.js +89 -0
- package/workflows/dist/givens.js.map +1 -0
- package/workflows/dist/host.d.ts +8 -7
- package/workflows/dist/host.js +1 -1
- package/workflows/dist/host.js.map +1 -1
- package/workflows/dist/identity-provisioning.d.ts +2 -5
- package/workflows/dist/identity-provisioning.js +16 -20
- package/workflows/dist/identity-provisioning.js.map +1 -1
- package/workflows/dist/import.d.ts +2 -0
- package/workflows/dist/import.js +7 -6
- package/workflows/dist/import.js.map +1 -1
- package/workflows/dist/index.d.ts +8 -7
- package/workflows/dist/index.js +4 -3
- package/workflows/dist/index.js.map +1 -1
- package/workflows/dist/ledger.js +8 -17
- package/workflows/dist/ledger.js.map +1 -1
- package/workflows/dist/lint.d.ts +2 -2
- package/workflows/dist/lint.js +8 -4
- package/workflows/dist/lint.js.map +1 -1
- package/workflows/dist/load.js +1 -1
- package/workflows/dist/load.js.map +1 -1
- package/workflows/dist/log.d.ts +0 -2
- package/workflows/dist/log.js +0 -11
- package/workflows/dist/log.js.map +1 -1
- package/workflows/dist/op.d.ts +103 -3
- package/workflows/dist/op.js +56 -6
- package/workflows/dist/op.js.map +1 -1
- package/workflows/dist/page-run.d.ts +40 -0
- package/workflows/dist/page-run.js +317 -0
- package/workflows/dist/page-run.js.map +1 -0
- package/workflows/dist/paths.d.ts +0 -13
- package/workflows/dist/paths.js +2 -46
- package/workflows/dist/paths.js.map +1 -1
- package/workflows/dist/renewal.d.ts +1 -1
- package/workflows/dist/renewal.js +1 -1
- package/workflows/dist/run.d.ts +4 -1
- package/workflows/dist/run.js.map +1 -1
- package/workflows/dist/runtime-ops.d.ts +19 -4
- package/workflows/dist/runtime-ops.js +34 -5
- package/workflows/dist/runtime-ops.js.map +1 -1
- package/workflows/dist/sandbox-runner.cjs +4 -4
- package/workflows/dist/sandbox.d.ts +0 -20
- package/workflows/dist/sandbox.js +23 -85
- package/workflows/dist/sandbox.js.map +1 -1
- package/workflows/dist/scenario.d.ts +19 -1
- package/workflows/dist/scenario.js +82 -21
- package/workflows/dist/scenario.js.map +1 -1
- package/workflows/dist/schedules.d.ts +1 -1
- package/workflows/dist/schedules.js +1 -1
- package/workflows/dist/secret.d.ts +4 -5
- package/workflows/dist/secret.js +7 -6
- package/workflows/dist/secret.js.map +1 -1
- package/workflows/dist/shared.d.ts +84 -7
- package/workflows/dist/shared.js +255 -8
- package/workflows/dist/shared.js.map +1 -1
- package/workflows/dist/sites.d.ts +5 -0
- package/workflows/dist/sites.js +7 -0
- package/workflows/dist/sites.js.map +1 -1
- package/workflows/dist/source.d.ts +40 -1
- package/workflows/dist/source.js +3 -3
- package/workflows/dist/source.js.map +1 -1
- package/workflows/dist/supervisor.d.ts +21 -18
- package/workflows/dist/supervisor.js +20 -22
- package/workflows/dist/supervisor.js.map +1 -1
- package/workflows/dist/tokens.d.ts +34 -0
- package/workflows/dist/tokens.js +70 -9
- package/workflows/dist/tokens.js.map +1 -1
- package/workflows/dist/vendor-info.d.ts +12 -3
- package/workflows/dist/vendor-info.js +21 -5
- package/workflows/dist/vendor-info.js.map +1 -1
- package/workflows/dist/version.js +1 -1
- package/workflows/dist/version.js.map +1 -1
- package/workflows/dist/wakeup-driver.js +1 -1
- package/workflows/dist/wakeup-driver.js.map +1 -1
- package/workflows/dist/wakeup-fake.d.ts +27 -0
- package/workflows/dist/wakeup-fake.js +125 -0
- package/workflows/dist/wakeup-fake.js.map +1 -0
- package/workflows/dist/wakeup-service.js +8 -24
- package/workflows/dist/wakeup-service.js.map +1 -1
- package/workflows/dist/wakeup-type.js +1 -1
- package/workflows/dist/wakeup-type.js.map +1 -1
- package/workflows/dist/worker.d.ts +19 -1
- package/workflows/dist/worker.js +67 -49
- package/workflows/dist/worker.js.map +1 -1
- package/workflows/drizzle/company/0007_token_handoffs.sql +8 -0
- package/workflows/drizzle/company/meta/0007_snapshot.json +1281 -0
- package/workflows/drizzle/company/meta/_journal.json +7 -0
- package/workflows/src/app-steps.ts +11 -0
- package/workflows/src/app-workflows.ts +100 -10
- package/workflows/src/approvals.ts +4 -2
- package/workflows/src/call.ts +37 -186
- package/workflows/src/change-steps.ts +43 -14
- package/workflows/src/change-workflow.ts +45 -16
- package/workflows/src/change.ts +39 -10
- package/workflows/src/client.ts +137 -62
- package/workflows/src/cloud-identity.ts +7 -4
- package/workflows/src/collection-driver.ts +230 -0
- package/workflows/src/collection.ts +62 -186
- package/workflows/src/company-file.ts +82 -0
- package/workflows/src/config.ts +97 -56
- package/workflows/src/ctx.ts +266 -0
- package/workflows/src/db/company.ts +15 -1
- package/workflows/src/db/dbos.ts +2 -0
- package/workflows/src/db/identity.ts +2 -2
- package/workflows/src/db.ts +10 -6
- package/workflows/src/deadlines.ts +31 -17
- package/workflows/src/define.ts +1 -24
- package/workflows/src/describe.ts +27 -5
- package/workflows/src/description.ts +152 -5
- package/workflows/src/drift.ts +8 -4
- package/workflows/src/errors.ts +19 -45
- package/workflows/src/fake.ts +4 -139
- package/workflows/src/fakes.ts +4 -0
- package/workflows/src/givens.ts +141 -0
- package/workflows/src/host.ts +8 -7
- package/workflows/src/identity-provisioning.ts +19 -30
- package/workflows/src/import.ts +8 -6
- package/workflows/src/index.ts +13 -2
- package/workflows/src/ledger.ts +8 -16
- package/workflows/src/lint.ts +12 -6
- package/workflows/src/load.ts +1 -1
- package/workflows/src/log.ts +0 -11
- package/workflows/src/op.ts +147 -12
- package/workflows/src/page-run.ts +437 -0
- package/workflows/src/paths.ts +2 -46
- package/workflows/src/renewal.ts +1 -1
- package/workflows/src/run.ts +4 -1
- package/workflows/src/runtime-ops.ts +36 -6
- package/workflows/src/sandbox.ts +31 -109
- package/workflows/src/scenario.ts +102 -19
- package/workflows/src/schedules.ts +1 -1
- package/workflows/src/secret.ts +8 -7
- package/workflows/src/shared.ts +304 -10
- package/workflows/src/sites.ts +8 -0
- package/workflows/src/source.ts +31 -5
- package/workflows/src/supervisor.ts +40 -38
- package/workflows/src/tokens.ts +100 -9
- package/workflows/src/vendor-info.ts +21 -6
- package/workflows/src/version.ts +1 -1
- package/workflows/src/wakeup-driver.ts +1 -1
- package/workflows/src/wakeup-fake.ts +138 -0
- package/workflows/src/wakeup-service.ts +8 -24
- package/workflows/src/wakeup-type.ts +1 -1
- package/workflows/src/worker.ts +121 -58
- package/app/dist/client/assets/ArrowUp.es-DOgvoS0P.js +0 -1
- package/app/dist/client/assets/Copy.es-B0D5SwiQ.js +0 -1
- package/app/dist/client/assets/DialogTitle-BgjYK22C.js +0 -1
- package/app/dist/client/assets/FloppyDisk.es-DnuNe_a8.js +0 -1
- package/app/dist/client/assets/Globe.es-B6x2e4-a.js +0 -1
- package/app/dist/client/assets/MagnifyingGlass.es-DoNoHEhT.js +0 -1
- package/app/dist/client/assets/Play.es-BwXalGBh.js +0 -1
- package/app/dist/client/assets/Plug.es-CaZsN5P-.js +0 -1
- package/app/dist/client/assets/Plus.es-w9VPpTJB.js +0 -1
- package/app/dist/client/assets/Separator-BAhKFgSd.js +0 -1
- package/app/dist/client/assets/X.es-DKMYClf-.js +0 -1
- package/app/dist/client/assets/_id-BSRAaWtO.js +0 -1
- package/app/dist/client/assets/_id-BjDP-cPH.js +0 -1
- package/app/dist/client/assets/_id-BudM76zX.js +0 -1
- package/app/dist/client/assets/_id-C37U5bBa.js +0 -1
- package/app/dist/client/assets/_id-lmg24JVh.js +0 -2
- package/app/dist/client/assets/_name-CylqFo_t.js +0 -1
- package/app/dist/client/assets/_name-D8Gl8iwy.js +0 -4
- package/app/dist/client/assets/_name-DdPCU8pt.js +0 -1
- package/app/dist/client/assets/_name-TteWQXe0.js +0 -1
- package/app/dist/client/assets/_vendor-BLxW83yk.js +0 -1
- package/app/dist/client/assets/_vendor-Bq3uZU4-.js +0 -1
- package/app/dist/client/assets/app-chrome-H8uZ4dHI.js +0 -16
- package/app/dist/client/assets/app-scope-BeUW_8Qh.js +0 -1
- package/app/dist/client/assets/approval-DpgmTc63.js +0 -1
- package/app/dist/client/assets/apps-CoWzNm8M.js +0 -1
- package/app/dist/client/assets/change-glance-DbYcBT7H.js +0 -1
- package/app/dist/client/assets/changes-DIJvP7wQ.js +0 -1
- package/app/dist/client/assets/chat-button-BgpOfYh1.js +0 -1
- package/app/dist/client/assets/chat-prompt-hiawXcK0.js +0 -1
- package/app/dist/client/assets/common-Dw2i6XKZ.js +0 -3
- package/app/dist/client/assets/composite-D9GNDzFj.js +0 -1
- package/app/dist/client/assets/connect-CIq2KJTz.js +0 -1
- package/app/dist/client/assets/connections-iqd2XbWQ.js +0 -5
- package/app/dist/client/assets/connectors-rI8_D1n1.js +0 -1
- package/app/dist/client/assets/credentials-26vu6Fv5.js +0 -1
- package/app/dist/client/assets/data-sDMlKaLV.js +0 -1
- package/app/dist/client/assets/decidable-zcYI7bY8.js +0 -1
- package/app/dist/client/assets/declaration-form-BtSVvxhq.js +0 -1
- package/app/dist/client/assets/dialog-DskpUgkl.js +0 -1
- package/app/dist/client/assets/existing-BD3VgJ_8.js +0 -1
- package/app/dist/client/assets/graph-Prxl3c55.js +0 -7
- package/app/dist/client/assets/grid-diff-SMsvea6t.js +0 -1
- package/app/dist/client/assets/hosting-BBHUppH-.js +0 -1
- package/app/dist/client/assets/import-B92fd4Tl.js +0 -1
- package/app/dist/client/assets/inbox-57oGZtxE.js +0 -1
- package/app/dist/client/assets/inbox-B2AMNtk5.js +0 -1
- package/app/dist/client/assets/index-Bn3XeKy8.js +0 -10
- package/app/dist/client/assets/kit-BsK6VZTQ.js +0 -1
- package/app/dist/client/assets/lazyRouteComponent-Uri98HNq.js +0 -1
- package/app/dist/client/assets/motion-C8lNeYvK.js +0 -1
- package/app/dist/client/assets/people-ISOMYCTu.js +0 -1
- package/app/dist/client/assets/permissions-Cenat84K.js +0 -2
- package/app/dist/client/assets/permissions-grid-B2GtGwzv.js +0 -1
- package/app/dist/client/assets/route-BP1XwaTB.js +0 -1
- package/app/dist/client/assets/route-KVU6QgwJ.js +0 -1
- package/app/dist/client/assets/runs-table-35lNzKLn.js +0 -1
- package/app/dist/client/assets/scenario-DSwsavxS.js +0 -1
- package/app/dist/client/assets/scenario-graph-CAzWOtqV.js +0 -1
- package/app/dist/client/assets/separator-BlwkzEY0.js +0 -1
- package/app/dist/client/assets/site-icon-DZvOfBvU.js +0 -1
- package/app/dist/client/assets/sites.index-CcNo6N8u.js +0 -1
- package/app/dist/client/assets/spinner-BGy6LWIW.js +0 -1
- package/app/dist/client/assets/start-form-Bgo9I63s.js +0 -1
- package/app/dist/client/assets/store-BGu0d2Ld.js +0 -57
- package/app/dist/client/assets/style-CCDLLPgG.css +0 -2
- package/app/dist/client/assets/table-DjbI5VTn.js +0 -1
- package/app/dist/client/assets/textarea-DXO0eUdp.js +0 -1
- package/app/dist/client/assets/useLoaderData-BQd5yMlA.js +0 -1
- package/app/dist/client/assets/useOpenInteractionType-Bin8RjM5.js +0 -1
- package/app/dist/client/assets/useRegisterFieldControl-CQPTOU7Z.js +0 -1
- package/app/dist/client/assets/useValueChanged-DMkuvFZG.js +0 -1
- package/app/dist/client/assets/utils-CMsCvwYQ.js +0 -1
- package/app/dist/client/assets/who-are-you-Bt1WI3Cz.js +0 -1
- package/app/dist/client/assets/workflow-BJpO61A-.js +0 -1
- package/app/dist/client/assets/workflow-view-DP-UlRiH.js +0 -1
- package/app/dist/client/assets/workflows-BLCBgxbx.js +0 -1
- package/app/dist/server/assets/app-chrome-BYS81Vnx.js +0 -1410
- package/app/dist/server/assets/sites.index-1l0BtgVf.js +0 -138
- package/app/dist/server/assets/utils-wksS9pYh.js +0 -138
- package/template/scenarios/publish-post/publish.feature +0 -28
- package/template/workflows/publish-post.ts +0 -20
|
@@ -1,136 +1,46 @@
|
|
|
1
1
|
import { n as createMiddleware } from "../server.js";
|
|
2
2
|
import { isNotFound, isRedirect, notFound } from "@tanstack/react-router";
|
|
3
3
|
import "cookie-es";
|
|
4
|
-
import { ConfigDescriptionSchema } from "sanoma/workflows/description";
|
|
5
|
-
import { CALL_WORKFLOW,
|
|
4
|
+
import { ColumnTypeSchema, ConfigDescriptionSchema, ConvertDecisionSchema, FieldNameSchema } from "sanoma/workflows/description";
|
|
5
|
+
import { APPLY_WORKFLOW, CALL_WORKFLOW, COMMIT_ID, DRAFT_ID, EFFECTS, LOGIN_CODE_WORKFLOW, RUN_STATUSES, apiNameOf, errorCode, errorMessage, flatten, isRecord, isVisitor, notLoaded, reshaped, undoDraftOf, vendorCodeOf } from "sanoma/workflows/shared";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { setTimeout } from "node:timers/promises";
|
|
8
|
-
import { PolicyDeniedError, Principal, SanomaError, deploymentKey,
|
|
8
|
+
import { PolicyDeniedError, Principal, SanomaError, deploymentKey, errorMessage as errorMessage$1, invalidInput, isEnded as isEnded$1, loadPolicies, nextFire, remoteFor } from "sanoma/workflows";
|
|
9
9
|
import { permissionsGrid } from "sanoma/workflows/describe";
|
|
10
10
|
// src/components/grid/plan.ts
|
|
11
|
-
/** A new field's name, as `collection()` takes it. */
|
|
12
|
-
var NAME = z.string().regex(FIELD_NAME, "Letters, digits and _, not a digit first");
|
|
13
|
-
/** A column's type: the runtime's field types, a choice, a link to another collection, or free-form JSON. */
|
|
14
|
-
var FieldTypeSchema = z.union([
|
|
15
|
-
z.enum([...FIELD_TYPES, "json"]),
|
|
16
|
-
z.strictObject({ enum: z.array(z.string().trim().min(1)).min(1, "Give it a choice").refine((values) => new Set(values).size === values.length, "Each choice once") }),
|
|
17
|
-
z.strictObject({ link: z.string().min(1) })
|
|
18
|
-
]);
|
|
19
|
-
var COUNT = z.number().int();
|
|
20
|
-
/** The rows a change cannot convert: how many, and at most `SAMPLE` of them by key. */
|
|
21
|
-
var WontConvertSchema = z.object({
|
|
22
|
-
count: COUNT,
|
|
23
|
-
sample: z.array(z.object({
|
|
24
|
-
key: z.string(),
|
|
25
|
-
value: z.unknown()
|
|
26
|
-
}))
|
|
27
|
-
});
|
|
28
|
-
/** What becomes of the rows a retype cannot convert: kept as text, cleared, or the change called off. */
|
|
29
|
-
var RetypeDecisionSchema = z.enum([
|
|
30
|
-
"keep-text",
|
|
31
|
-
"clear-unconvertible",
|
|
32
|
-
"cancel"
|
|
33
|
-
]);
|
|
34
|
-
/** One change to a table, with the rows it touches counted (`empty`, `filled`, `unmatched`, `wontConvert.count`). */
|
|
35
|
-
var TableChangeSchema = z.discriminatedUnion("kind", [
|
|
36
|
-
z.object({
|
|
37
|
-
kind: z.literal("add"),
|
|
38
|
-
field: z.string(),
|
|
39
|
-
type: FieldTypeSchema,
|
|
40
|
-
required: z.boolean(),
|
|
41
|
-
empty: COUNT
|
|
42
|
-
}),
|
|
43
|
-
z.object({
|
|
44
|
-
kind: z.literal("rename"),
|
|
45
|
-
from: z.string(),
|
|
46
|
-
to: z.string()
|
|
47
|
-
}),
|
|
48
|
-
z.object({
|
|
49
|
-
kind: z.literal("retype"),
|
|
50
|
-
field: z.string(),
|
|
51
|
-
from: FieldTypeSchema,
|
|
52
|
-
to: FieldTypeSchema,
|
|
53
|
-
wontConvert: WontConvertSchema,
|
|
54
|
-
decision: RetypeDecisionSchema.optional()
|
|
55
|
-
}),
|
|
56
|
-
z.object({
|
|
57
|
-
kind: z.literal("require"),
|
|
58
|
-
field: z.string(),
|
|
59
|
-
empty: COUNT
|
|
60
|
-
}),
|
|
61
|
-
z.object({
|
|
62
|
-
kind: z.literal("delete"),
|
|
63
|
-
field: z.string(),
|
|
64
|
-
filled: COUNT
|
|
65
|
-
}),
|
|
66
|
-
z.object({
|
|
67
|
-
kind: z.literal("link"),
|
|
68
|
-
field: z.string(),
|
|
69
|
-
to: z.string(),
|
|
70
|
-
unmatched: COUNT
|
|
71
|
-
}),
|
|
72
|
-
z.object({
|
|
73
|
-
kind: z.literal("convert"),
|
|
74
|
-
field: z.string(),
|
|
75
|
-
key: z.string(),
|
|
76
|
-
type: FieldTypeSchema,
|
|
77
|
-
wontConvert: WontConvertSchema
|
|
78
|
-
})
|
|
79
|
-
]);
|
|
80
|
-
/**
|
|
81
|
-
* A table change as the person reviews it: what the declarations before and after differ in, the
|
|
82
|
-
* records in the table now (`rows`), "Show SQL" (`sql`, the statements in order, informational,
|
|
83
|
-
* empty until the runtime plans the change), and `blocked` while a change has rows that won't
|
|
84
|
-
* convert and no decision. A change's page reads the plan it carries through this, as anything
|
|
85
|
-
* else starting a `patch` could have written it.
|
|
86
|
-
*/
|
|
87
|
-
var TableChangePlan = z.object({
|
|
88
|
-
collection: z.string(),
|
|
89
|
-
changes: z.array(TableChangeSchema).min(1),
|
|
90
|
-
rows: COUNT,
|
|
91
|
-
sql: z.array(z.string()),
|
|
92
|
-
blocked: z.boolean()
|
|
93
|
-
});
|
|
94
11
|
/** How many of the rows that won't convert a plan names. */
|
|
95
12
|
var SAMPLE = 20;
|
|
96
|
-
/** Why a link or a free-form column cannot be proposed
|
|
97
|
-
var
|
|
98
|
-
/** What the review says in place of the SQL until the runtime plans a table change. */
|
|
99
|
-
var NO_SQL = "SQL is shown once the table change lands";
|
|
13
|
+
/** Why a link or a free-form column cannot be proposed. */
|
|
14
|
+
var UNAVAILABLE = "Links and free-form columns aren't available yet";
|
|
100
15
|
/**
|
|
101
|
-
*
|
|
102
|
-
*
|
|
16
|
+
* A change to a collection's columns, as the grid proposes it: a `TableChange` before its rows are
|
|
17
|
+
* counted, a retype's or a conversion's `decision` for the values that won't convert the person's
|
|
18
|
+
* choice in the column panel.
|
|
103
19
|
*/
|
|
104
|
-
var FILE_ONLY = "Until real tables land, this changes resources/data.ts only: each record keeps what it holds, and one the new declaration no longer fits shows as needs fixing.";
|
|
105
|
-
/**
|
|
106
|
-
* Whether `FILE_ONLY` goes beside a plan: a draft (no SQL) whose change touches what the records
|
|
107
|
-
* hold, anything but an optional new column.
|
|
108
|
-
*/
|
|
109
|
-
var fileOnly = (plan) => plan.sql.length === 0 && plan.rows > 0 && plan.changes.some((change) => change.kind !== "add" || change.required);
|
|
110
|
-
/** A change to a collection's columns, as the grid proposes it: a `TableChange` before its rows are counted. */
|
|
111
20
|
var ColumnChange = z.discriminatedUnion("kind", [
|
|
112
21
|
z.strictObject({
|
|
113
22
|
kind: z.literal("add"),
|
|
114
|
-
field:
|
|
115
|
-
type:
|
|
23
|
+
field: FieldNameSchema,
|
|
24
|
+
type: ColumnTypeSchema,
|
|
116
25
|
required: z.boolean()
|
|
117
26
|
}),
|
|
118
27
|
z.strictObject({
|
|
119
28
|
kind: z.literal("rename"),
|
|
120
29
|
from: z.string().min(1),
|
|
121
|
-
to:
|
|
30
|
+
to: FieldNameSchema
|
|
122
31
|
}),
|
|
123
32
|
z.strictObject({
|
|
124
33
|
kind: z.literal("retype"),
|
|
125
34
|
field: z.string().min(1),
|
|
126
|
-
to:
|
|
35
|
+
to: ColumnTypeSchema,
|
|
36
|
+
decision: ConvertDecisionSchema.optional()
|
|
127
37
|
}),
|
|
128
38
|
z.strictObject({
|
|
129
39
|
kind: z.literal("require"),
|
|
130
40
|
field: z.string().min(1)
|
|
131
41
|
}),
|
|
132
42
|
z.strictObject({
|
|
133
|
-
kind: z.literal("
|
|
43
|
+
kind: z.literal("hide"),
|
|
134
44
|
field: z.string().min(1)
|
|
135
45
|
}),
|
|
136
46
|
z.strictObject({
|
|
@@ -141,14 +51,19 @@ var ColumnChange = z.discriminatedUnion("kind", [
|
|
|
141
51
|
z.strictObject({
|
|
142
52
|
kind: z.literal("convert"),
|
|
143
53
|
field: z.string().min(1),
|
|
144
|
-
key:
|
|
145
|
-
type:
|
|
54
|
+
key: FieldNameSchema,
|
|
55
|
+
type: ColumnTypeSchema,
|
|
56
|
+
decision: ConvertDecisionSchema.optional()
|
|
146
57
|
})
|
|
147
58
|
]);
|
|
148
59
|
/** A declared field's type. */
|
|
149
60
|
var typeOf = (field) => typeof field === "string" ? field : "enum" in field ? { enum: [...field.enum] } : field.type;
|
|
150
61
|
/** Whether a declared field is required: not marked `optional`. */
|
|
151
62
|
var requiredOf = (field) => typeof field === "string" || field.optional !== true;
|
|
63
|
+
/** Whether a declared field is hidden: removed from the columns for everyone, its values kept. */
|
|
64
|
+
var isHidden = (field) => typeof field === "object" && field.hidden === true;
|
|
65
|
+
/** The fields the grid and the forms show, in their declared order: every one but the hidden. */
|
|
66
|
+
var shownFields = (fields) => Object.keys(fields).filter((name) => !isHidden(fields[name]));
|
|
152
67
|
/** A field's declaration of `type`, required or `optional: true`, as the data file writes it. */
|
|
153
68
|
function fieldOf(type, required) {
|
|
154
69
|
if (typeof type === "string") return required ? type : {
|
|
@@ -160,38 +75,32 @@ function fieldOf(type, required) {
|
|
|
160
75
|
optional: true
|
|
161
76
|
};
|
|
162
77
|
}
|
|
163
|
-
/** Whether
|
|
78
|
+
/** Whether a column of `type` can be proposed: not a link or free-form, which `collection()` takes neither of yet. */
|
|
164
79
|
var takenToday = (type) => type !== "json" && !(typeof type === "object" && "link" in type);
|
|
165
80
|
var filled = (value) => value !== void 0 && value !== null && value !== "";
|
|
166
|
-
|
|
167
|
-
var
|
|
168
|
-
/**
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
].includes(String(value).toLowerCase());
|
|
179
|
-
case "date": return typeof value === "string" && DATE.test(value) && !Number.isNaN(Date.parse(value));
|
|
180
|
-
case "text":
|
|
181
|
-
case "person": return typeof value !== "object";
|
|
182
|
-
case "json": return true;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
/** The filled values among `values` that do not read as `type`. */
|
|
186
|
-
function wontConvert(values, type) {
|
|
187
|
-
const wont = values.filter(({ value }) => filled(value) && !converts(value, type));
|
|
81
|
+
/** The value under `key` of a free-form field's object; none for anything else. */
|
|
82
|
+
var valueAt$1 = (value, key) => isRecord(value) ? value[key] : void 0;
|
|
83
|
+
/**
|
|
84
|
+
* The records of `rows` whose value a retype or a conversion cannot convert (`reshaped` keeps or
|
|
85
|
+
* clears it), counted and sampled by key, with the person's `decision` for them when there are some.
|
|
86
|
+
*/
|
|
87
|
+
function unconverted(rows, change) {
|
|
88
|
+
const wont = rows.filter(({ record }) => {
|
|
89
|
+
const { did } = reshaped(record, change);
|
|
90
|
+
return did === "kept" || did === "cleared";
|
|
91
|
+
});
|
|
92
|
+
const valueOf = (record) => change.kind === "retype" ? record[change.field] : valueAt$1(record[change.field], change.key);
|
|
188
93
|
return {
|
|
189
|
-
|
|
190
|
-
|
|
94
|
+
wontConvert: {
|
|
95
|
+
count: wont.length,
|
|
96
|
+
sample: wont.slice(0, SAMPLE).map(({ key, record }) => ({
|
|
97
|
+
key,
|
|
98
|
+
value: valueOf(record)
|
|
99
|
+
}))
|
|
100
|
+
},
|
|
101
|
+
...wont.length > 0 && change.decision && { decision: change.decision }
|
|
191
102
|
};
|
|
192
103
|
}
|
|
193
|
-
/** The value under `key` of a free-form field's object; none for anything else. */
|
|
194
|
-
var valueAt$1 = (value, key) => isRecord(value) ? value[key] : void 0;
|
|
195
104
|
/** Each key of the objects in a free-form field, with how many of the rows have it, the most first. */
|
|
196
105
|
function keysIn(rows, field) {
|
|
197
106
|
const counts = /* @__PURE__ */ new Map();
|
|
@@ -218,13 +127,13 @@ function problemOf({ key, fields }, change) {
|
|
|
218
127
|
if (change.kind === "convert" && Object.hasOwn(fields, change.key)) return `${change.key} is a field already`;
|
|
219
128
|
if (change.kind !== "add" && change.kind !== "convert" && named === key) return `${key} is the key, which names each record: it stays as it is`;
|
|
220
129
|
const type = "type" in change ? change.type : change.kind === "retype" ? change.to : void 0;
|
|
221
|
-
if (change.kind === "link" || type !== void 0 && !takenToday(type)) return
|
|
130
|
+
if (change.kind === "link" || type !== void 0 && !takenToday(type)) return UNAVAILABLE;
|
|
222
131
|
if (change.kind === "convert" && typeOf(fields[change.field]) !== "json") return `${change.field} is not free-form`;
|
|
223
132
|
}
|
|
224
133
|
/**
|
|
225
|
-
* The
|
|
226
|
-
*
|
|
227
|
-
*
|
|
134
|
+
* The plan of `change` to `collection`, over `rows`, the records read for it: each row's value
|
|
135
|
+
* counted, a retype's or a conversion's values that will not convert (`reshaped`) sampled, with
|
|
136
|
+
* the person's decision for them when there are some.
|
|
228
137
|
*/
|
|
229
138
|
function planOf(collection, rows, change) {
|
|
230
139
|
const values = (field) => rows.map(({ key, record }) => ({
|
|
@@ -244,11 +153,11 @@ function planOf(collection, rows, change) {
|
|
|
244
153
|
planned = change;
|
|
245
154
|
break;
|
|
246
155
|
case "retype": {
|
|
247
|
-
const
|
|
156
|
+
const { decision: _, ...rest } = change;
|
|
248
157
|
planned = {
|
|
249
|
-
...
|
|
250
|
-
from,
|
|
251
|
-
|
|
158
|
+
...rest,
|
|
159
|
+
from: typeOf(collection.fields[change.field]),
|
|
160
|
+
...unconverted(rows, change)
|
|
252
161
|
};
|
|
253
162
|
break;
|
|
254
163
|
}
|
|
@@ -258,7 +167,7 @@ function planOf(collection, rows, change) {
|
|
|
258
167
|
empty: rows.length - count(change.field)
|
|
259
168
|
};
|
|
260
169
|
break;
|
|
261
|
-
case "
|
|
170
|
+
case "hide":
|
|
262
171
|
planned = {
|
|
263
172
|
...change,
|
|
264
173
|
filled: count(change.field)
|
|
@@ -271,24 +180,18 @@ function planOf(collection, rows, change) {
|
|
|
271
180
|
};
|
|
272
181
|
break;
|
|
273
182
|
case "convert": {
|
|
274
|
-
const
|
|
275
|
-
key,
|
|
276
|
-
value: valueAt$1(record[change.field], change.key)
|
|
277
|
-
}));
|
|
183
|
+
const { decision: _, ...rest } = change;
|
|
278
184
|
planned = {
|
|
279
|
-
...
|
|
280
|
-
|
|
185
|
+
...rest,
|
|
186
|
+
...unconverted(rows, change)
|
|
281
187
|
};
|
|
282
188
|
break;
|
|
283
189
|
}
|
|
284
190
|
}
|
|
285
|
-
const blocked = "wontConvert" in planned && planned.wontConvert.count > 0;
|
|
286
191
|
return {
|
|
287
192
|
collection: collection.name,
|
|
288
193
|
changes: [planned],
|
|
289
|
-
rows: rows.length
|
|
290
|
-
sql: [],
|
|
291
|
-
blocked
|
|
194
|
+
rows: rows.length
|
|
292
195
|
};
|
|
293
196
|
}
|
|
294
197
|
var set = (field, type, required) => ({
|
|
@@ -299,6 +202,14 @@ var rename = (field, to) => ({
|
|
|
299
202
|
fields: {},
|
|
300
203
|
rename: { [`fields.${field}`]: to }
|
|
301
204
|
});
|
|
205
|
+
/** A field kept with its values, `hidden: true` (and so optional): what removing a column is. */
|
|
206
|
+
var hidden = (field, declared) => ({
|
|
207
|
+
fields: { [`fields.${field}`]: {
|
|
208
|
+
...fieldOf(typeOf(declared), false),
|
|
209
|
+
hidden: true
|
|
210
|
+
} },
|
|
211
|
+
rename: {}
|
|
212
|
+
});
|
|
302
213
|
/**
|
|
303
214
|
* What a change sets in the collection's declaration, by path as `setFields` takes them
|
|
304
215
|
* (`fields`), and renames or removes (`rename`, as `renameFields` takes them), from its fields
|
|
@@ -311,7 +222,7 @@ function declarationEdit(fields, change) {
|
|
|
311
222
|
case "rename": return rename(change.from, change.to);
|
|
312
223
|
case "retype": return set(change.field, change.to, requiredOf(declared));
|
|
313
224
|
case "require": return set(change.field, typeOf(declared), true);
|
|
314
|
-
case "
|
|
225
|
+
case "hide": return hidden(change.field, declared);
|
|
315
226
|
case "link": return set(change.field, { link: change.to }, requiredOf(declared));
|
|
316
227
|
case "convert": return set(change.key, change.type, false);
|
|
317
228
|
}
|
|
@@ -332,36 +243,82 @@ var TYPE_WORDS = {
|
|
|
332
243
|
var OR = new Intl.ListFormat("en", { type: "disjunction" });
|
|
333
244
|
/** A plan's records as a sentence's subject: "No records", "The record", "All 12 records". */
|
|
334
245
|
var allRecords = ({ rows }) => rows === 0 ? "No records" : rows === 1 ? "The record" : `All ${rows} records`;
|
|
246
|
+
/** A rename's records, said: each value moves to the new name when the change lands. */
|
|
247
|
+
var renamed = (plan) => `${allRecords(plan)} keep their values under the new name.`;
|
|
335
248
|
/**
|
|
336
|
-
*
|
|
337
|
-
* value under the old name, so the new one shows empty.
|
|
338
|
-
*/
|
|
339
|
-
var renamed = (plan, { from, to }) => plan.sql.length || plan.rows === 0 ? `${allRecords(plan)} keep their values.` : `${allRecords(plan)} keep their values under ${from} until the table change lands, so ${to} shows empty in them.`;
|
|
340
|
-
/**
|
|
341
|
-
* How many records, in words: `lib/utils.ts`'s `plural`, which this file cannot import, since
|
|
249
|
+
* How many of `what`, in words: `lib/utils.ts`'s `plural`, which this file cannot import, since
|
|
342
250
|
* `api.ts` brings it into the package's build, where `#/` does not resolve.
|
|
343
251
|
*/
|
|
344
|
-
var
|
|
252
|
+
var count = (n, what) => `${n} ${what}${n === 1 ? "" : "s"}`;
|
|
253
|
+
var records = (n) => count(n, "record");
|
|
254
|
+
/** The two choices for the `n` values a retype or a conversion cannot convert, as the column panel offers them. */
|
|
255
|
+
var DECIDED = {
|
|
256
|
+
clear: (n) => `Leave ${n === 1 ? "it" : `these ${n}`} empty`,
|
|
257
|
+
keep: (n) => `Keep ${n === 1 ? "it" : "them"} as ${n === 1 ? "it is" : "they are"}`
|
|
258
|
+
};
|
|
259
|
+
/** What each choice does to those values, in a sentence. */
|
|
260
|
+
var DOES = {
|
|
261
|
+
clear: "This removes what they hold now.",
|
|
262
|
+
keep: "They show as needs fixing in the grid until someone edits them."
|
|
263
|
+
};
|
|
345
264
|
/** What a plan's change will do, in a sentence: the New column panel's "What will happen". */
|
|
346
265
|
function happens(plan) {
|
|
347
266
|
const [change] = plan.changes;
|
|
348
267
|
const all = allRecords(plan);
|
|
349
268
|
switch (change?.kind) {
|
|
350
269
|
case "add": return change.required && plan.rows > 0 ? `${plan.collection} gains a required ${change.field} column. ${all} show it empty, and each needs a value before it saves again.` : `${plan.collection} gains a ${change.field} column. ${all} show it empty, and nothing else changes.`;
|
|
351
|
-
case "rename": return `${change.from} is called ${change.to} from now on. ${renamed(plan
|
|
270
|
+
case "rename": return `${change.from} is called ${change.to} from now on. ${renamed(plan)}`;
|
|
352
271
|
case "retype":
|
|
353
272
|
case "convert": {
|
|
354
273
|
const to = change.kind === "retype" ? change.to : change.type;
|
|
355
274
|
const what = change.kind === "retype" ? change.field : `${change.field}'s ${change.key}`;
|
|
356
275
|
const wont = change.wontConvert.count;
|
|
357
|
-
|
|
276
|
+
const becomes = `${what} becomes ${typeWords(to)}.`;
|
|
277
|
+
if (wont === 0) return `${becomes} Every value converts.`;
|
|
278
|
+
const cant = `${records(wont)} can't convert`;
|
|
279
|
+
if (change.decision === "clear") return `${becomes} ${cant}: they're left empty, and lose what they hold now.`;
|
|
280
|
+
if (change.decision === "keep") return `${becomes} ${cant}: they keep what they hold and show as needs fixing.`;
|
|
281
|
+
return `${becomes} ${cant}. Choose below what happens to them.`;
|
|
358
282
|
}
|
|
359
283
|
case "require": return change.empty === 0 ? `${change.field} is required from now on. Every record has it.` : `${change.field} is required from now on. ${records(change.empty)} have it empty, and need one before they save again.`;
|
|
360
|
-
case "
|
|
284
|
+
case "hide": return change.filled === 0 ? `${change.field} leaves the grid and the forms for everyone. No record has a value in it.` : `${change.field} leaves the grid and the forms for everyone. Its values in ${records(change.filled)} are kept.`;
|
|
361
285
|
case "link": return `${change.field} links to ${change.to}.`;
|
|
362
286
|
case void 0: return "Nothing changes.";
|
|
363
287
|
}
|
|
364
288
|
}
|
|
289
|
+
/**
|
|
290
|
+
* What became of the records once `plan` landed (`counts`, `sanoma.records.reshape`'s answer), in
|
|
291
|
+
* sentences: a rename's records under the new name, then the values converted, left empty or kept
|
|
292
|
+
* to fix. Counted by the plan's one change that brings the records along; a plan of several says
|
|
293
|
+
* the counts together.
|
|
294
|
+
*/
|
|
295
|
+
function landed(plan, counts) {
|
|
296
|
+
const along = plan.changes.filter((change) => change.kind === "rename" || "wontConvert" in change);
|
|
297
|
+
const one = along.length === 1;
|
|
298
|
+
const said = [];
|
|
299
|
+
for (const change of along) {
|
|
300
|
+
if (change.kind !== "rename") continue;
|
|
301
|
+
if (!one) said.push(`The values of ${change.from} are under ${change.to} now.`);
|
|
302
|
+
else if (counts.changed === 0) said.push(`No record had a value in ${change.from}.`);
|
|
303
|
+
else said.push(`${records(counts.changed)} now ${counts.changed === 1 ? "holds" : "hold"} ${change.to}.`);
|
|
304
|
+
}
|
|
305
|
+
const typed = along.filter((change) => change.kind !== "rename");
|
|
306
|
+
if (typed.length) {
|
|
307
|
+
const [first] = typed;
|
|
308
|
+
const value = one && first ? `${first.kind === "retype" ? first.field : first.key} value` : "value";
|
|
309
|
+
const { converted, cleared, kept } = counts;
|
|
310
|
+
if (converted + cleared + kept === 0) said.push(`No ${value} needed converting.`);
|
|
311
|
+
else {
|
|
312
|
+
const parts = [
|
|
313
|
+
`${count(converted, value)} converted`,
|
|
314
|
+
...cleared ? [`${cleared} left empty`] : [],
|
|
315
|
+
...kept ? [`${kept} kept as ${kept === 1 ? "it was" : "they were"}, to fix in the grid`] : []
|
|
316
|
+
];
|
|
317
|
+
said.push(`${parts.join(", ")}.`);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return said.join(" ");
|
|
321
|
+
}
|
|
365
322
|
/** A declaration's value as the data file writes it, on one line. */
|
|
366
323
|
function literal(value) {
|
|
367
324
|
if (Array.isArray(value)) return `[${value.map(literal).join(", ")}]`;
|
|
@@ -385,7 +342,7 @@ function diffLines(fields, changes) {
|
|
|
385
342
|
line("-", name, declared);
|
|
386
343
|
if (declared === void 0) {
|
|
387
344
|
if (change.kind === "rename") line("+", change.to, void 0);
|
|
388
|
-
else if (change.kind !== "
|
|
345
|
+
else if (change.kind !== "hide") line("+", name, void 0);
|
|
389
346
|
continue;
|
|
390
347
|
}
|
|
391
348
|
}
|
|
@@ -459,6 +416,15 @@ var ChangesQuery = z.object({
|
|
|
459
416
|
open: z.boolean().optional(),
|
|
460
417
|
limit: z.coerce.number().int().min(1).max(RUNS_LIMIT.max).optional()
|
|
461
418
|
});
|
|
419
|
+
/**
|
|
420
|
+
* What saving a chat's draft takes (`saveDraftFn`): the chat's id, and the draft's commit its card
|
|
421
|
+
* showed (`head`), or, to undo what it saved, that commit on `main` (`undo`).
|
|
422
|
+
*/
|
|
423
|
+
var SaveDraftRequest = z.object({
|
|
424
|
+
id: z.string().regex(DRAFT_ID),
|
|
425
|
+
head: z.string().regex(COMMIT_ID).optional(),
|
|
426
|
+
undo: z.string().regex(COMMIT_ID).optional()
|
|
427
|
+
});
|
|
462
428
|
var ConnectionReference = z.object({
|
|
463
429
|
vendor: z.string().min(1),
|
|
464
430
|
$connection: z.string().min(1)
|
|
@@ -586,11 +552,26 @@ var INFRA = "resources/sanoma/infra.ts";
|
|
|
586
552
|
*/
|
|
587
553
|
var DECLARE_BOX = `Coding agents work in a box of their own on a live instance, and this company declares none: declare one in ${INFRA} (\`export const box = agent37.instance({})\`, with the agent37 connector in sanoma.config.ts) and set AGENT37_API_KEY`;
|
|
588
554
|
/**
|
|
589
|
-
* Why a host of type `hostType` that stops when
|
|
555
|
+
* Why a host of type `hostType` that stops when idle has no Wakeup, `wakes` being the connected
|
|
590
556
|
* wakeups and the host types each wakes, when known: going live's refusal to declare one, and
|
|
591
557
|
* Hosting's notice on a host declared without one.
|
|
592
558
|
*/
|
|
593
559
|
var noWakeup = (hostType, wakes) => `No connected wakeup wakes a ${hostType}${wakes ? ` (${wakes})` : ""}: going live declares none, and the host stays up`;
|
|
560
|
+
/** What going live makes, in its order: the progress list's lines. */
|
|
561
|
+
var GO_LIVE_LINES = [
|
|
562
|
+
"repository",
|
|
563
|
+
"database",
|
|
564
|
+
"host",
|
|
565
|
+
"signIn"
|
|
566
|
+
];
|
|
567
|
+
/** Home's setup card, in its order: each step ticked from facts (`setupProgress`). */
|
|
568
|
+
var SETUP_STEPS = [
|
|
569
|
+
"start",
|
|
570
|
+
"agent",
|
|
571
|
+
"try",
|
|
572
|
+
"teammate",
|
|
573
|
+
"online"
|
|
574
|
+
];
|
|
594
575
|
/** Said at the top of `infra.ts` when it declares an existing database, and on the page. */
|
|
595
576
|
var PASSWORD_NOTE = ["The database password is declared as a generated secret, since Supabase never reads it back.", "Binding the project changes nothing; the next apply that changes it sets a new password."];
|
|
596
577
|
/** What `clearCredentialFn` takes: a declared variable, whose stored value it deletes. */
|
|
@@ -611,11 +592,16 @@ var HistoryRequest = z.object({
|
|
|
611
592
|
name: z.string().min(1),
|
|
612
593
|
key: z.string().min(1)
|
|
613
594
|
});
|
|
614
|
-
/** What `
|
|
615
|
-
var
|
|
595
|
+
/** What `getColumnPlan` takes: a change to the columns of the collection `collection`, to plan over its records. */
|
|
596
|
+
var ColumnPlanRequest = z.object({
|
|
616
597
|
collection: z.string().min(1),
|
|
617
598
|
change: ColumnChange
|
|
618
599
|
});
|
|
600
|
+
/**
|
|
601
|
+
* What `proposeColumnChangeFn` takes: the change, and with a `clear` decision `clears`, how many
|
|
602
|
+
* values the person was shown it leaves empty (`getColumnPlan`'s count of those that won't convert).
|
|
603
|
+
*/
|
|
604
|
+
var ProposeColumnChange = ColumnPlanRequest.extend({ clears: z.number().int().min(0).optional() });
|
|
619
605
|
/** What `previewFn` asks (`PreviewRequest` without its principal): at most 200 actions, each on a target when known. */
|
|
620
606
|
var PreviewQuery = z.array(z.object({
|
|
621
607
|
action: z.object({
|
|
@@ -641,6 +627,98 @@ var ApiError = class extends Error {
|
|
|
641
627
|
};
|
|
642
628
|
/** The error body an error carries, when it is an `ApiError`. */
|
|
643
629
|
var errorBodyOf = (err) => err instanceof ApiError ? err.body : void 0;
|
|
630
|
+
var STATUS = {
|
|
631
|
+
invalid_input: 400,
|
|
632
|
+
not_approver: 403,
|
|
633
|
+
not_admitted: 403,
|
|
634
|
+
policy_denied: 403,
|
|
635
|
+
run_not_found: 404,
|
|
636
|
+
no_pending_approval: 404,
|
|
637
|
+
already_decided: 409,
|
|
638
|
+
approval_withdrawn: 409,
|
|
639
|
+
run_ended: 409,
|
|
640
|
+
run_running: 409,
|
|
641
|
+
approval_pending: 409
|
|
642
|
+
};
|
|
643
|
+
/**
|
|
644
|
+
* An ApiError for any error: the runtime's codes get their status, and anything else is a 500.
|
|
645
|
+
* A 500 answers only that something went wrong: its message may name internal details (a
|
|
646
|
+
* database host, say), so the detail goes to the log (`toApiError`), not the caller.
|
|
647
|
+
*/
|
|
648
|
+
function asApiError(err) {
|
|
649
|
+
if (err instanceof ApiError) return err;
|
|
650
|
+
const failure = err;
|
|
651
|
+
if (failure?.name === "AuthenticationError") return new ApiError(400, { error: `Authentication: ${([
|
|
652
|
+
"missing",
|
|
653
|
+
"expired",
|
|
654
|
+
"revoked",
|
|
655
|
+
"rejected",
|
|
656
|
+
"wrong_account",
|
|
657
|
+
"scope_changed",
|
|
658
|
+
"uncertain",
|
|
659
|
+
"unavailable",
|
|
660
|
+
"unsupported"
|
|
661
|
+
].includes(failure.problem ?? "") ? failure.problem : "unavailable").replaceAll("_", " ")}` });
|
|
662
|
+
if (failure?.name === "SecretStoreError") {
|
|
663
|
+
const reason = [
|
|
664
|
+
"invalid_configuration",
|
|
665
|
+
"unavailable",
|
|
666
|
+
"denied",
|
|
667
|
+
"conflict",
|
|
668
|
+
"read_only",
|
|
669
|
+
"unsupported",
|
|
670
|
+
"too_large",
|
|
671
|
+
"invalid_value"
|
|
672
|
+
].includes(failure.code ?? "") ? failure.code : "unavailable";
|
|
673
|
+
return new ApiError(reason === "conflict" ? 409 : 400, { error: `Secret store: ${reason.replaceAll("_", " ")}` });
|
|
674
|
+
}
|
|
675
|
+
const vendorCode = vendorCodeOf(err);
|
|
676
|
+
if (vendorCode === "record_changed" || vendorCode === "record_exists") {
|
|
677
|
+
const { current, conflicts } = err;
|
|
678
|
+
return new ApiError(409, {
|
|
679
|
+
error: errorMessage(err),
|
|
680
|
+
code: vendorCode,
|
|
681
|
+
...current !== void 0 && { current },
|
|
682
|
+
...Array.isArray(conflicts) && { conflicts }
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
const code = errorCode(err);
|
|
686
|
+
const status = code && STATUS[code] || 500;
|
|
687
|
+
if (status === 500) return new ApiError(500, {
|
|
688
|
+
error: "Something went wrong",
|
|
689
|
+
...code ? { code } : {}
|
|
690
|
+
});
|
|
691
|
+
const body = {
|
|
692
|
+
error: errorMessage(err),
|
|
693
|
+
code
|
|
694
|
+
};
|
|
695
|
+
const data = err.data ?? {};
|
|
696
|
+
if (Array.isArray(data.issues)) body.issues = data.issues;
|
|
697
|
+
if (code === "policy_denied" && Array.isArray(data.denied)) body.denied = data.denied.map(String);
|
|
698
|
+
if (typeof data.field === "string") body.field = data.field;
|
|
699
|
+
if (code === "not_approver") {
|
|
700
|
+
body.approver = data.approver;
|
|
701
|
+
if (typeof data.reason === "string") body.reason = data.reason;
|
|
702
|
+
}
|
|
703
|
+
if ((code === "approval_pending" || code === "run_running") && typeof data.runId === "string") body.runId = data.runId;
|
|
704
|
+
return new ApiError(status, body);
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* What `.result` answers for a run that failed or was cancelled: the runtime's answer when its
|
|
708
|
+
* error has a code with a status of its own (`policy_denied`, 403), else a 422 with the run's
|
|
709
|
+
* failure as the run recorded it and its code (`driver_failed`), if any. The failure is the
|
|
710
|
+
* run's answer, so the caller sees it (a 500 would hide it, and a client would try again).
|
|
711
|
+
*/
|
|
712
|
+
function runFailure(run, err) {
|
|
713
|
+
const answered = asApiError(err);
|
|
714
|
+
if (answered.status < 500) return answered;
|
|
715
|
+
const code = errorCode(err);
|
|
716
|
+
return new ApiError(422, {
|
|
717
|
+
error: run.error ?? `Run ${run.runId} ${run.status === "cancelled" ? "was cancelled" : "failed"}`,
|
|
718
|
+
...code && { code },
|
|
719
|
+
runId: run.runId
|
|
720
|
+
});
|
|
721
|
+
}
|
|
644
722
|
/** A run's short name, for a title: "Run" and its id's first 8 characters (a UUID's first group). */
|
|
645
723
|
var runName = (runId) => `Run ${runId.slice(runId.lastIndexOf(":") + 1).slice(0, 8)}`;
|
|
646
724
|
/** Who started a run, as text. */
|
|
@@ -769,7 +847,21 @@ function sealedShown(record) {
|
|
|
769
847
|
}
|
|
770
848
|
} : record;
|
|
771
849
|
}
|
|
772
|
-
/**
|
|
850
|
+
/**
|
|
851
|
+
* The apply that `run`, a queued apply, waits for (`SanomaClient.applyAhead`), as the page names
|
|
852
|
+
* it; undefined for any other run, and once it is the one running.
|
|
853
|
+
*/
|
|
854
|
+
async function applyAheadOf(client, run) {
|
|
855
|
+
if (run.workflow !== APPLY_WORKFLOW || run.status !== "queued") return void 0;
|
|
856
|
+
const ahead = await client.applyAhead(run.runId);
|
|
857
|
+
return ahead && {
|
|
858
|
+
runId: ahead.runId,
|
|
859
|
+
status: ahead.status,
|
|
860
|
+
startedBy: ahead.startedBy,
|
|
861
|
+
createdAt: ahead.createdAt
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
/** The run with its ledger and approvals, a sandbox run's checks as the worker last ran them, and the apply a queued one waits for; or a 404. */
|
|
773
865
|
async function runDetail(app, runId) {
|
|
774
866
|
const { client, snapshot } = app;
|
|
775
867
|
const run = await client.run(runId);
|
|
@@ -777,41 +869,45 @@ async function runDetail(app, runId) {
|
|
|
777
869
|
error: `No run ${runId}`,
|
|
778
870
|
code: "run_not_found"
|
|
779
871
|
});
|
|
780
|
-
const
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
872
|
+
const [read, told, ahead] = await Promise.all([
|
|
873
|
+
client.ledger(runId).then((records) => ({ records }), (err) => ({ err })),
|
|
874
|
+
client.runChecks(runId).catch((err) => {
|
|
875
|
+
const error = errorMessage$1(err);
|
|
876
|
+
logReadOnce(runId, error, "the checks", err);
|
|
877
|
+
return { error };
|
|
878
|
+
}),
|
|
879
|
+
applyAheadOf(client, run)
|
|
880
|
+
]);
|
|
881
|
+
const base = {
|
|
882
|
+
run,
|
|
883
|
+
approvals: run.approvals,
|
|
884
|
+
...ahead && { ahead }
|
|
885
|
+
};
|
|
786
886
|
if ("err" in read) {
|
|
787
887
|
const ledgerError = errorMessage$1(read.err);
|
|
788
888
|
logReadOnce(runId, ledgerError, "the ledger", read.err);
|
|
789
889
|
return {
|
|
790
|
-
|
|
890
|
+
...base,
|
|
791
891
|
ledger: [],
|
|
792
|
-
ledgerError
|
|
793
|
-
approvals
|
|
892
|
+
ledgerError
|
|
794
893
|
};
|
|
795
894
|
}
|
|
796
895
|
const ledger = run.workflow === LOGIN_CODE_WORKFLOW ? read.records.map(sealedShown) : read.records;
|
|
797
896
|
if (ledger.length === 0 && run.status !== "queued") return {
|
|
798
|
-
|
|
897
|
+
...base,
|
|
799
898
|
ledger,
|
|
800
|
-
ledgerError: NO_RECORDS
|
|
801
|
-
approvals
|
|
899
|
+
ledgerError: NO_RECORDS
|
|
802
900
|
};
|
|
803
901
|
const seeded = ledger.find((r) => r.type === "scenario.seeded");
|
|
804
902
|
if (!seeded) return {
|
|
805
|
-
|
|
806
|
-
ledger
|
|
807
|
-
approvals
|
|
903
|
+
...base,
|
|
904
|
+
ledger
|
|
808
905
|
};
|
|
809
906
|
if (!told) {
|
|
810
907
|
const pending = snapshot.scenarios.scenarios.find((s) => s.name === seeded.scenario)?.steps.filter((step) => step.kind === "then");
|
|
811
908
|
return {
|
|
812
|
-
|
|
909
|
+
...base,
|
|
813
910
|
ledger,
|
|
814
|
-
approvals,
|
|
815
911
|
...pending && { checks: pending.map(({ text }) => ({
|
|
816
912
|
step: text,
|
|
817
913
|
ok: false,
|
|
@@ -820,16 +916,14 @@ async function runDetail(app, runId) {
|
|
|
820
916
|
};
|
|
821
917
|
}
|
|
822
918
|
if ("error" in told) return {
|
|
823
|
-
|
|
919
|
+
...base,
|
|
824
920
|
ledger,
|
|
825
|
-
approvals,
|
|
826
921
|
checksError: told.error
|
|
827
922
|
};
|
|
828
923
|
const ended = isEnded$1(run.status);
|
|
829
924
|
return {
|
|
830
|
-
|
|
925
|
+
...base,
|
|
831
926
|
ledger,
|
|
832
|
-
approvals,
|
|
833
927
|
checks: told.checks.map((c) => ({
|
|
834
928
|
...c,
|
|
835
929
|
settled: ended || c.settled
|
|
@@ -917,13 +1011,13 @@ var changes = ({ client }, query) => client.changes(query);
|
|
|
917
1011
|
async function change({ client, snapshot }, id) {
|
|
918
1012
|
const view = await client.change(id);
|
|
919
1013
|
if (!view) return null;
|
|
920
|
-
const touched = new Set(view.state.facts?.touches);
|
|
921
|
-
const files = Object.entries(snapshot.repository?.workflows ?? {});
|
|
922
1014
|
return {
|
|
923
1015
|
...view,
|
|
924
|
-
edits:
|
|
1016
|
+
edits: workflowsIn(snapshot, view.state.facts?.touches ?? [])
|
|
925
1017
|
};
|
|
926
1018
|
}
|
|
1019
|
+
/** The config's workflows, by name, whose files (relative to the repository's root) are among `files`. */
|
|
1020
|
+
var workflowsIn = (snapshot, files) => Object.entries(snapshot.repository?.workflows ?? {}).flatMap(([name, file]) => files.includes(file) ? [name] : []);
|
|
927
1021
|
/** The connector whose remote half is for the repository's remote (`remoteFor`); none without a remote, or without such a connector. */
|
|
928
1022
|
var remoteOf = ({ resolved, snapshot }) => {
|
|
929
1023
|
const url = snapshot.repository?.remote;
|
|
@@ -947,6 +1041,44 @@ async function openChange({ client }, actor, id, origin) {
|
|
|
947
1041
|
}, { startedBy: actor }) };
|
|
948
1042
|
}
|
|
949
1043
|
/**
|
|
1044
|
+
* The saves of the draft `id` (`SanomaClient.saves`), newest first, each with the config's
|
|
1045
|
+
* workflows whose files it saved (`edits`), as the files say now.
|
|
1046
|
+
*/
|
|
1047
|
+
async function saves({ client, snapshot }, id) {
|
|
1048
|
+
return (await client.saves(id)).map((save) => ({
|
|
1049
|
+
...save,
|
|
1050
|
+
edits: workflowsIn(snapshot, save.output && "files" in save.output ? save.output.files : [])
|
|
1051
|
+
}));
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* Saves the draft of `actor`'s chat `id` (`SanomaClient.saveDraft`) at `head`, the commit its card
|
|
1055
|
+
* showed, titled as the chat, its change's page this app's `/changes/<id>` at `origin`. With
|
|
1056
|
+
* `undo`, a commit the chat's draft was saved as (`SanomaClient.savedAs`: by a save, or its
|
|
1057
|
+
* change's merge), that commit is undone instead, from a draft of its own (`undoDraftOf`), titled
|
|
1058
|
+
* "Undo" and the chat's title. The save's run id; a 404 for a chat that is not the actor's, a 409
|
|
1059
|
+
* for a commit the chat did not save.
|
|
1060
|
+
*/
|
|
1061
|
+
async function saveDraft({ client }, actor, { id, head, undo }, origin) {
|
|
1062
|
+
const chat = await client.chats.get(id);
|
|
1063
|
+
if (chat?.person !== actor.id) throw new ApiError(404, { error: `No chat ${id}` });
|
|
1064
|
+
if (undo !== void 0 && !await client.savedAs(id, undo)) throw new ApiError(409, { error: `${undo.slice(0, 7)} is not a commit this chat saved` });
|
|
1065
|
+
const draft = undo === void 0 ? id : undoDraftOf(undo);
|
|
1066
|
+
const input = undo === void 0 ? {
|
|
1067
|
+
id,
|
|
1068
|
+
title: chat.title,
|
|
1069
|
+
...head !== void 0 && { head }
|
|
1070
|
+
} : {
|
|
1071
|
+
id: draft,
|
|
1072
|
+
title: `Undo ${chat.title}`,
|
|
1073
|
+
undo,
|
|
1074
|
+
chat: id
|
|
1075
|
+
};
|
|
1076
|
+
return { runId: await client.saveDraft({
|
|
1077
|
+
...input,
|
|
1078
|
+
page: changePage(draft, origin)
|
|
1079
|
+
}, { startedBy: actor }) };
|
|
1080
|
+
}
|
|
1081
|
+
/**
|
|
950
1082
|
* What the repository's host enforces on `main` (`SourceHost.enforcement`), with the host's name:
|
|
951
1083
|
* the Permissions page's line. Null without a remote, or when no connector's remote half is for
|
|
952
1084
|
* its host. A host that cannot be asked
|
|
@@ -1278,22 +1410,6 @@ async function postCall(request, context) {
|
|
|
1278
1410
|
return Response.json(body, { status });
|
|
1279
1411
|
}
|
|
1280
1412
|
}
|
|
1281
|
-
/**
|
|
1282
|
-
* What `.result` answers for a run that failed or was cancelled: the runtime's answer when its
|
|
1283
|
-
* error has a code with a status of its own (`policy_denied`, 403), else a 422 with the run's
|
|
1284
|
-
* failure as the run recorded it and its code (`driver_failed`), if any. The failure is the
|
|
1285
|
-
* run's answer, so the caller sees it (a 500 would hide it, and a client would try again).
|
|
1286
|
-
*/
|
|
1287
|
-
function runFailure(run, err) {
|
|
1288
|
-
const answered = asApiError(err);
|
|
1289
|
-
if (answered.status < 500) return answered;
|
|
1290
|
-
const code = errorCode(err);
|
|
1291
|
-
return new ApiError(422, {
|
|
1292
|
-
error: run.error ?? `Run ${run.runId} ${run.status === "cancelled" ? "was cancelled" : "failed"}`,
|
|
1293
|
-
...code && { code },
|
|
1294
|
-
runId: run.runId
|
|
1295
|
-
});
|
|
1296
|
-
}
|
|
1297
1413
|
/** The 400 for a name `callApi` does not know. */
|
|
1298
1414
|
var notCallable = (name) => new ApiError(400, {
|
|
1299
1415
|
error: `api.${name} is neither an operation nor a workflow: call an operation by its id, a workflow by its camelCase name, or its .start, .result, .latest, .runs, .approvals or .ledger`,
|
|
@@ -1308,82 +1424,6 @@ async function runOf({ client }, workflow, runId, startedBy) {
|
|
|
1308
1424
|
});
|
|
1309
1425
|
return run;
|
|
1310
1426
|
}
|
|
1311
|
-
var STATUS = {
|
|
1312
|
-
invalid_input: 400,
|
|
1313
|
-
not_approver: 403,
|
|
1314
|
-
not_admitted: 403,
|
|
1315
|
-
policy_denied: 403,
|
|
1316
|
-
run_not_found: 404,
|
|
1317
|
-
no_pending_approval: 404,
|
|
1318
|
-
already_decided: 409,
|
|
1319
|
-
approval_withdrawn: 409,
|
|
1320
|
-
run_ended: 409,
|
|
1321
|
-
run_running: 409,
|
|
1322
|
-
approval_pending: 409
|
|
1323
|
-
};
|
|
1324
|
-
/**
|
|
1325
|
-
* An ApiError for any error: the runtime's codes get their status, and anything else is a 500.
|
|
1326
|
-
* A 500 answers only that something went wrong: its message may name internal details (a
|
|
1327
|
-
* database host, say), so the detail goes to the log (`toApiError`), not the caller.
|
|
1328
|
-
*/
|
|
1329
|
-
function asApiError(err) {
|
|
1330
|
-
if (err instanceof ApiError) return err;
|
|
1331
|
-
const failure = err;
|
|
1332
|
-
if (failure?.name === "AuthenticationError") return new ApiError(400, { error: `Authentication: ${([
|
|
1333
|
-
"missing",
|
|
1334
|
-
"expired",
|
|
1335
|
-
"revoked",
|
|
1336
|
-
"rejected",
|
|
1337
|
-
"wrong_account",
|
|
1338
|
-
"scope_changed",
|
|
1339
|
-
"uncertain",
|
|
1340
|
-
"unavailable",
|
|
1341
|
-
"unsupported"
|
|
1342
|
-
].includes(failure.problem ?? "") ? failure.problem : "unavailable").replaceAll("_", " ")}` });
|
|
1343
|
-
if (failure?.name === "SecretStoreError") {
|
|
1344
|
-
const reason = [
|
|
1345
|
-
"invalid_configuration",
|
|
1346
|
-
"unavailable",
|
|
1347
|
-
"denied",
|
|
1348
|
-
"conflict",
|
|
1349
|
-
"read_only",
|
|
1350
|
-
"unsupported",
|
|
1351
|
-
"too_large",
|
|
1352
|
-
"invalid_value"
|
|
1353
|
-
].includes(failure.code ?? "") ? failure.code : "unavailable";
|
|
1354
|
-
return new ApiError(reason === "conflict" ? 409 : 400, { error: `Secret store: ${reason.replaceAll("_", " ")}` });
|
|
1355
|
-
}
|
|
1356
|
-
const vendorCode = vendorCodeOf(err);
|
|
1357
|
-
if (vendorCode === "record_changed" || vendorCode === "record_exists") {
|
|
1358
|
-
const { current, conflicts } = err;
|
|
1359
|
-
return new ApiError(409, {
|
|
1360
|
-
error: errorMessage$1(err),
|
|
1361
|
-
code: vendorCode,
|
|
1362
|
-
...current !== void 0 && { current },
|
|
1363
|
-
...Array.isArray(conflicts) && { conflicts }
|
|
1364
|
-
});
|
|
1365
|
-
}
|
|
1366
|
-
const code = errorCode(err);
|
|
1367
|
-
const status = code && STATUS[code] || 500;
|
|
1368
|
-
if (status === 500) return new ApiError(500, {
|
|
1369
|
-
error: "Something went wrong",
|
|
1370
|
-
...code ? { code } : {}
|
|
1371
|
-
});
|
|
1372
|
-
const body = {
|
|
1373
|
-
error: errorMessage$1(err),
|
|
1374
|
-
code
|
|
1375
|
-
};
|
|
1376
|
-
const data = err.data ?? {};
|
|
1377
|
-
if (Array.isArray(data.issues)) body.issues = data.issues;
|
|
1378
|
-
if (code === "policy_denied" && Array.isArray(data.denied)) body.denied = data.denied.map(String);
|
|
1379
|
-
if (typeof data.field === "string") body.field = data.field;
|
|
1380
|
-
if (code === "not_approver") {
|
|
1381
|
-
body.approver = data.approver;
|
|
1382
|
-
if (typeof data.reason === "string") body.reason = data.reason;
|
|
1383
|
-
}
|
|
1384
|
-
if ((code === "approval_pending" || code === "run_running") && typeof data.runId === "string") body.runId = data.runId;
|
|
1385
|
-
return new ApiError(status, body);
|
|
1386
|
-
}
|
|
1387
1427
|
/** `asApiError`, logging what it turns into a 500: only those are unexpected. */
|
|
1388
1428
|
function toApiError(err, where) {
|
|
1389
1429
|
const api = asApiError(err);
|
|
@@ -1417,4 +1457,4 @@ var publicOnly = createMiddleware({ type: "function" }).server(({ next, context,
|
|
|
1417
1457
|
if (context.app.site !== void 0 && !PUBLIC_FNS.has(serverFnMeta.name)) throw new ApiError(404, { error: "Not found" });
|
|
1418
1458
|
return next();
|
|
1419
1459
|
});
|
|
1420
|
-
export {
|
|
1460
|
+
export { ChangesQuery as $, recordHistory as A, UNAVAILABLE as At, startRun as B, renamed as Bt, openChange as C, noWakeup as Ct, preview as D, ColumnChange as Dt, postCall as E, starterName as Et, saves as F, isHidden as Ft, secretValues as G, typeWords as Gt, toApiError as H, shownFields as Ht, saysWho as I, keysIn as It, ACTOR_KEY as J, ACTOR_COOKIE as K, serverFnFailure as L, landed as Lt, requireActor as M, declarationEdit as Mt, runDetail as N, diffLines as Nt, previewConnection as O, DECIDED as Ot, saveDraft as P, happens as Pt, CallRequest as Q, setCredential as R, planOf as Rt, nextFires as S, errorBodyOf as St, permissions as T, runName as Tt, validate as U, takenToday as Ut, testConnection as V, requiredOf as Vt, bearerOf as W, typeOf as Wt, AuthorizeConnectionRequest as X, ApiError as Y, CALLBACK_ERRORS as Z, fileSource as _, SETUP_STEPS as _t, appConfig as a, DecideCall as at, lastRuns as b, SetCredentialRequest as bt, change as c, HistoryRequest as ct, connectConnection as d, PASSWORD_NOTE as dt, ClearCredentialRequest as et, connections as f, PreviewConnectionRequest as ft, driftReport as g, RunsQuery as gt, disconnectConnection as h, RUNS_LIMIT as ht, appBehind as i, DECLARE_BOX as it, remoteOf as j, allRecords as jt, readStartRun as k, DOES as kt, changes as l, INFRA as lt, decide as m, ProposeColumnChange as mt, withPrincipal as n, ConnectConnectionRequest as nt, applyAheadOf as o, DisconnectConnectionRequest as ot, credentials as p, PreviewQuery as pt, ACTOR_HEADER as q, actorOf as r, ConnectionAttemptRequest as rt, callApi as s, GO_LIVE_LINES as st, publicOnly as t, ColumnPlanRequest as tt, clearCredential as u, InviteRequest as ut, hostEnforcement as v, SETUP_VENDORS as vt, parse$1 as w, pendingApprovals as wt, listRuns as x, TestConnectionRequest as xt, invalid as y, SaveDraftRequest as yt, signOutUrl as z, problemOf as zt };
|