@selvajs/selva 4.21.0-beta.11 → 4.21.0-beta.13
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/build/adapter-node.js +2 -2
- package/build/client/_app/immutable/assets/0.DOeHn583.css +2 -0
- package/build/client/_app/immutable/assets/0.DOeHn583.css.br +0 -0
- package/build/client/_app/immutable/assets/0.DOeHn583.css.gz +0 -0
- package/build/client/_app/immutable/assets/rhino3dm.CWOyICcB.wasm +0 -0
- package/build/client/_app/immutable/assets/rhino3dm.CWOyICcB.wasm.br +0 -0
- package/build/client/_app/immutable/assets/rhino3dm.CWOyICcB.wasm.gz +0 -0
- package/build/client/_app/immutable/chunks/2rFska3d.js +1 -0
- package/build/client/_app/immutable/chunks/2rFska3d.js.br +1 -0
- package/build/client/_app/immutable/chunks/2rFska3d.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{B3BHv1lE.js → 5M5n6ftO.js} +59 -58
- package/build/client/_app/immutable/chunks/5M5n6ftO.js.br +0 -0
- package/build/client/_app/immutable/chunks/5M5n6ftO.js.gz +0 -0
- package/build/client/_app/immutable/chunks/71J-lVIC.js +7 -0
- package/build/client/_app/immutable/chunks/71J-lVIC.js.br +0 -0
- package/build/client/_app/immutable/chunks/71J-lVIC.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{Dqy8nTaG.js → BCbumNc2.js} +1 -1
- package/build/client/_app/immutable/chunks/BCbumNc2.js.br +0 -0
- package/build/client/_app/immutable/chunks/BCbumNc2.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BEzPIk5e.js +1 -0
- package/build/client/_app/immutable/chunks/BEzPIk5e.js.br +0 -0
- package/build/client/_app/immutable/chunks/BEzPIk5e.js.gz +0 -0
- package/build/client/_app/immutable/chunks/B_4x1b7P.js +1 -0
- package/build/client/_app/immutable/chunks/B_4x1b7P.js.br +0 -0
- package/build/client/_app/immutable/chunks/B_4x1b7P.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{BAhtiTKe.js → Bs2bQTgl.js} +1 -1
- package/build/client/_app/immutable/chunks/Bs2bQTgl.js.br +0 -0
- package/build/client/_app/immutable/chunks/Bs2bQTgl.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{cUJB_11K.js → CzHxHvr2.js} +1 -1
- package/build/client/_app/immutable/chunks/CzHxHvr2.js.br +0 -0
- package/build/client/_app/immutable/chunks/CzHxHvr2.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Db9exncB.js +1 -0
- package/build/client/_app/immutable/chunks/Db9exncB.js.br +0 -0
- package/build/client/_app/immutable/chunks/Db9exncB.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{BEPlNI5E.js → FIoX_cjM.js} +1 -1
- package/build/client/_app/immutable/chunks/FIoX_cjM.js.br +0 -0
- package/build/client/_app/immutable/chunks/FIoX_cjM.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{CmlXAF26.js → aBYenH6-.js} +1 -1
- package/build/client/_app/immutable/chunks/aBYenH6-.js.br +0 -0
- package/build/client/_app/immutable/chunks/aBYenH6-.js.gz +0 -0
- package/build/client/_app/immutable/entry/{app.B3im90t6.js → app.BP5swwM7.js} +2 -2
- package/build/client/_app/immutable/entry/app.BP5swwM7.js.br +0 -0
- package/build/client/_app/immutable/entry/app.BP5swwM7.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{1.DWd6YbcT.js → 1.DmBjtFLw.js} +1 -1
- package/build/client/_app/immutable/nodes/1.DmBjtFLw.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.DmBjtFLw.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{2.bCPP2ncY.js → 2.CWOFnTAV.js} +1 -1
- package/build/client/_app/immutable/nodes/2.CWOFnTAV.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.CWOFnTAV.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{20.DI5Eri_M.js → 20.4vwwwrQ_.js} +1 -1
- package/build/client/_app/immutable/nodes/20.4vwwwrQ_.js.br +0 -0
- package/build/client/_app/immutable/nodes/20.4vwwwrQ_.js.gz +0 -0
- package/build/client/_app/immutable/nodes/21.C1xtue6U.js +1 -0
- package/build/client/_app/immutable/nodes/21.C1xtue6U.js.br +0 -0
- package/build/client/_app/immutable/nodes/21.C1xtue6U.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{25.BRm8FzmQ.js → 25.DR2ojPn5.js} +22 -22
- package/build/client/_app/immutable/nodes/25.DR2ojPn5.js.br +0 -0
- package/build/client/_app/immutable/nodes/25.DR2ojPn5.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{3.Ctd9OGCk.js → 3.GtVSkcEP.js} +1 -1
- package/build/client/_app/immutable/nodes/{3.Ctd9OGCk.js.br → 3.GtVSkcEP.js.br} +0 -0
- package/build/client/_app/immutable/nodes/3.GtVSkcEP.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{30.B6pd-F-z.js → 30.Cd56Qv6o.js} +5 -6
- package/build/client/_app/immutable/nodes/30.Cd56Qv6o.js.br +0 -0
- package/build/client/_app/immutable/nodes/30.Cd56Qv6o.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{5.BUX4zZQj.js → 5.wbpOzblK.js} +1 -1
- package/build/client/_app/immutable/nodes/5.wbpOzblK.js.br +0 -0
- package/build/client/_app/immutable/nodes/5.wbpOzblK.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{6.BpjtFwPi.js → 6.B2HdJrZB.js} +1 -1
- package/build/client/_app/immutable/nodes/6.B2HdJrZB.js.br +0 -0
- package/build/client/_app/immutable/nodes/6.B2HdJrZB.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{7.hBM6C-wN.js → 7.BuWU0YDv.js} +1 -1
- package/build/client/_app/immutable/nodes/7.BuWU0YDv.js.br +0 -0
- package/build/client/_app/immutable/nodes/7.BuWU0YDv.js.gz +0 -0
- package/build/client/_app/version.json +1 -1
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/runtime-meta.json +1 -1
- package/build/server/.vite/manifest.json +145 -137
- package/build/server/_app/immutable/assets/_layout.DOeHn583.css +2 -0
- package/build/server/_app/immutable/assets/rhino3dm.CWOyICcB.wasm +0 -0
- package/build/server/chunks/access.js +63 -48
- package/build/server/chunks/access.js.map +1 -1
- package/build/server/chunks/access2.server.js +1 -1
- package/build/server/chunks/api-errors.js +3 -3
- package/build/server/chunks/api.js +1 -1
- package/build/server/chunks/boot.server.js +1 -1
- package/build/server/chunks/bootHealth.server.js +1 -1
- package/build/server/chunks/create-project.js +1 -1
- package/build/server/chunks/delete-with-blobs.js +1 -1
- package/build/server/chunks/{schema-extraction.js → errors.js} +31 -24
- package/build/server/chunks/errors.js.map +1 -0
- package/build/server/chunks/grasshopper.js +17 -10
- package/build/server/chunks/grasshopper.js.map +1 -1
- package/build/server/chunks/handlers.js +82 -75
- package/build/server/chunks/handlers.js.map +1 -1
- package/build/server/chunks/http.js +1 -1
- package/build/server/chunks/http2.js +1 -1
- package/build/server/chunks/instance.js +3 -3
- package/build/server/chunks/instanceAdmins.server.js +2 -2
- package/build/server/chunks/internal.js +1 -1
- package/build/server/chunks/{keepalive-vtcjhAV3.js → keepalive-DbmLH4v1.js} +5 -4
- package/build/server/chunks/keepalive-DbmLH4v1.js.map +1 -0
- package/build/server/chunks/limits.js +1 -1
- package/build/server/chunks/liveSolve.server.js +1 -1
- package/build/server/chunks/localeContext.svelte.js +74 -0
- package/build/server/chunks/localeContext.svelte.js.map +1 -1
- package/build/server/chunks/{visibility.js → logging.js} +262 -3
- package/build/server/chunks/logging.js.map +1 -0
- package/build/server/chunks/openapi.js +1 -1
- package/build/server/chunks/ops.js +64 -1
- package/build/server/chunks/ops.js.map +1 -1
- package/build/server/chunks/package.js +1 -1
- package/build/server/chunks/package.js.map +1 -1
- package/build/server/chunks/presets.server.js +1 -1
- package/build/server/chunks/providers.server.js +448 -317
- package/build/server/chunks/providers.server.js.map +1 -1
- package/build/server/chunks/remote-definition.js +1 -1
- package/build/server/chunks/resolve-server.js +1 -1
- package/build/server/chunks/rhino3dm.js +5 -0
- package/build/server/chunks/rhino3dm.js.map +1 -0
- package/build/server/chunks/safe-url.js +2 -2
- package/build/server/chunks/schema.js +1 -1
- package/build/server/chunks/schema.js.map +1 -1
- package/build/server/chunks/selfUpdate.server.js +1 -1
- package/build/server/chunks/server-config-write.js +1 -1
- package/build/server/chunks/server2.js +5 -1
- package/build/server/chunks/server2.js.map +1 -1
- package/build/server/chunks/solve.server.js +5 -4
- package/build/server/chunks/solve.server.js.map +1 -1
- package/build/server/chunks/sveltekit.js +2 -2
- package/build/server/chunks/tokens.js +2 -2
- package/build/server/entries/endpoints/api/admin/compute/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/compute/actions/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/compute/status/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/orgs/_id_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/orgs/_server.ts.js +2 -2
- package/build/server/entries/endpoints/api/admin/projects/_id_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/projects/_id_/grants/_grantId_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/projects/_id_/grants/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/projects/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/system/health/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/system/throughput/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/system/update/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/users/_id_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/users/_id_/disable/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/users/_server.ts.js +2 -2
- package/build/server/entries/endpoints/api/diag/throughput/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/files/_...path_/_server.ts.js +2 -3
- package/build/server/entries/endpoints/api/files/_...path_/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/api/v1/compute/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/compute/schema/_server.ts.js +3 -3
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/image/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/publish/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/schema/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/share-links/_linkId_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/share-links/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/solve/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_versionId_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_versionId_/changes/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_versionId_/inventory/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_versionId_/schema/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_versionId_/scripts/_scriptId_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/check/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/me/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/me/starred/_guid_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/me/token/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/orgs/_orgId_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/orgs/_orgId_/assets/_kind_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/orgs/_orgId_/compute/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/orgs/_orgId_/invites/_id_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/orgs/_orgId_/invites/_id_/resend/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/orgs/_orgId_/invites/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/orgs/_orgId_/members/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/orgs/_orgId_/members/_userId_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/orgs/_orgId_/tokens/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/orgs/_orgId_/tokens/_tokenId_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/projects/_id_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/projects/_id_/members/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/projects/_id_/members/_userId_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/projects/_id_/reclaim/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/projects/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/solve/_solveId_/cancel/_server.ts.js +2 -2
- package/build/server/entries/endpoints/api/v1/solve-events/_server.ts.js +2 -2
- package/build/server/entries/endpoints/api/v1/solve-events/_solveId_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/auth/email/callback/_server.ts.js +1 -1
- package/build/server/entries/endpoints/auth/supabase/callback/_server.ts.js +1 -1
- package/build/server/entries/endpoints/auth/supabase/start/_server.ts.js +1 -1
- package/build/server/entries/endpoints/mcp/_server.ts.js +14 -8
- package/build/server/entries/endpoints/mcp/_server.ts.js.map +1 -1
- package/build/server/entries/hooks.server.js +37 -3
- package/build/server/entries/hooks.server.js.map +1 -1
- package/build/server/entries/pages/accept-invite/_page.server.ts.js +1 -1
- package/build/server/entries/pages/admin/_page.server.ts.js +1 -1
- package/build/server/entries/pages/admin/organizations/_page.server.ts.js +4 -9
- package/build/server/entries/pages/admin/organizations/_page.server.ts.js.map +1 -1
- package/build/server/entries/pages/docs/api/_page.server.ts.js +1 -1
- package/build/server/entries/pages/library/_guid_/_page.server.ts.js +8 -7
- package/build/server/entries/pages/library/_guid_/_page.server.ts.js.map +1 -1
- package/build/server/entries/pages/library/_guid_/_page.svelte.js +9874 -3725
- package/build/server/entries/pages/library/_guid_/_page.svelte.js.map +1 -1
- package/build/server/entries/pages/library/_page.server.ts.js +1 -2
- package/build/server/entries/pages/library/_page.server.ts.js.map +1 -1
- package/build/server/entries/pages/oauth/authorize/_page.server.ts.js +2 -2
- package/build/server/entries/pages/projects/_page.server.ts.js +2 -2
- package/build/server/entries/pages/projects/_page.svelte.js +10 -4
- package/build/server/entries/pages/projects/_page.svelte.js.map +1 -1
- package/build/server/entries/pages/setup/_page.server.ts.js +1 -1
- package/build/server/entries/pages/team/_page.server.ts.js +1 -1
- package/build/server/entries/pages/team/_page.server.ts.js.map +1 -1
- package/build/server/entries/pages/team/members/_page.server.ts.js +4 -2
- package/build/server/entries/pages/team/members/_page.server.ts.js.map +1 -1
- package/build/server/entries/pages/team/members/_page.svelte.js +6 -5
- package/build/server/entries/pages/team/members/_page.svelte.js.map +1 -1
- package/build/server/entries/pages/team/projects/_page.server.ts.js +5 -12
- package/build/server/entries/pages/team/projects/_page.server.ts.js.map +1 -1
- package/build/server/entries/pages/team/reclaim/_page.server.ts.js +6 -13
- package/build/server/entries/pages/team/reclaim/_page.server.ts.js.map +1 -1
- package/build/server/manifest-full.js +1 -1
- package/build/server/manifest.js +1 -1
- package/build/server/nodes/0.js +2 -2
- package/build/server/nodes/1.js +1 -1
- package/build/server/nodes/2.js +1 -1
- package/build/server/nodes/20.js +1 -1
- package/build/server/nodes/21.js +1 -1
- package/build/server/nodes/25.js +1 -1
- package/build/server/nodes/3.js +1 -1
- package/build/server/nodes/30.js +1 -1
- package/build/server/nodes/5.js +1 -1
- package/build/server/nodes/6.js +1 -1
- package/build/server/nodes/7.js +1 -1
- package/build/server/server.js +1 -1
- package/package.json +13 -13
- package/templates/.env.example +18 -1
- package/build/client/_app/immutable/assets/0.DJ150bSr.css +0 -2
- package/build/client/_app/immutable/assets/0.DJ150bSr.css.br +0 -0
- package/build/client/_app/immutable/assets/0.DJ150bSr.css.gz +0 -0
- package/build/client/_app/immutable/chunks/B3BHv1lE.js.br +0 -0
- package/build/client/_app/immutable/chunks/B3BHv1lE.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BAhtiTKe.js.br +0 -0
- package/build/client/_app/immutable/chunks/BAhtiTKe.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BEPlNI5E.js.br +0 -0
- package/build/client/_app/immutable/chunks/BEPlNI5E.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CmlXAF26.js.br +0 -0
- package/build/client/_app/immutable/chunks/CmlXAF26.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DQbsDiDJ.js +0 -1
- package/build/client/_app/immutable/chunks/DQbsDiDJ.js.br +0 -1
- package/build/client/_app/immutable/chunks/DQbsDiDJ.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DW5EJMC7.js +0 -1
- package/build/client/_app/immutable/chunks/DW5EJMC7.js.br +0 -0
- package/build/client/_app/immutable/chunks/DW5EJMC7.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Dqy8nTaG.js.br +0 -0
- package/build/client/_app/immutable/chunks/Dqy8nTaG.js.gz +0 -0
- package/build/client/_app/immutable/chunks/cUJB_11K.js.br +0 -0
- package/build/client/_app/immutable/chunks/cUJB_11K.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.B3im90t6.js.br +0 -0
- package/build/client/_app/immutable/entry/app.B3im90t6.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.DWd6YbcT.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.DWd6YbcT.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.bCPP2ncY.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.bCPP2ncY.js.gz +0 -0
- package/build/client/_app/immutable/nodes/20.DI5Eri_M.js.br +0 -0
- package/build/client/_app/immutable/nodes/20.DI5Eri_M.js.gz +0 -0
- package/build/client/_app/immutable/nodes/21.BI8SjY_r.js +0 -1
- package/build/client/_app/immutable/nodes/21.BI8SjY_r.js.br +0 -1
- package/build/client/_app/immutable/nodes/21.BI8SjY_r.js.gz +0 -0
- package/build/client/_app/immutable/nodes/25.BRm8FzmQ.js.br +0 -0
- package/build/client/_app/immutable/nodes/25.BRm8FzmQ.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.Ctd9OGCk.js.gz +0 -0
- package/build/client/_app/immutable/nodes/30.B6pd-F-z.js.br +0 -0
- package/build/client/_app/immutable/nodes/30.B6pd-F-z.js.gz +0 -0
- package/build/client/_app/immutable/nodes/5.BUX4zZQj.js.br +0 -0
- package/build/client/_app/immutable/nodes/5.BUX4zZQj.js.gz +0 -0
- package/build/client/_app/immutable/nodes/6.BpjtFwPi.js.br +0 -0
- package/build/client/_app/immutable/nodes/6.BpjtFwPi.js.gz +0 -0
- package/build/client/_app/immutable/nodes/7.hBM6C-wN.js.br +0 -0
- package/build/client/_app/immutable/nodes/7.hBM6C-wN.js.gz +0 -0
- package/build/server/_app/immutable/assets/_layout.DJ150bSr.css +0 -2
- package/build/server/chunks/definitions.js +0 -263
- package/build/server/chunks/definitions.js.map +0 -1
- package/build/server/chunks/keepalive-vtcjhAV3.js.map +0 -1
- package/build/server/chunks/schema-extraction.js.map +0 -1
- package/build/server/chunks/visibility.js.map +0 -1
- /package/build/client/_app/immutable/nodes/{0.Bu9WQ0W_.js → 0.CXQcjMDK.js} +0 -0
- /package/build/client/_app/immutable/nodes/{0.Bu9WQ0W_.js.br → 0.CXQcjMDK.js.br} +0 -0
- /package/build/client/_app/immutable/nodes/{0.Bu9WQ0W_.js.gz → 0.CXQcjMDK.js.gz} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { d as resolveServerForOrg$1 } from "./inventory.js";
|
|
2
|
-
import {
|
|
2
|
+
import { t as ComputeServerUnconfiguredError } from "./errors.js";
|
|
3
3
|
// ../server/src/compute/resolve-server.ts
|
|
4
4
|
/**
|
|
5
5
|
* Pick the right Rhino.Compute server for an (org, definition) pair.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rhino3dm.js","names":[],"sources":["../../../../../node_modules/.pnpm/rhino3dm@8.35.0/node_modules/rhino3dm/rhino3dm.wasm?url"],"sourcesContent":["export default import.meta.ROLLDOWN_FILE_URL_VRAku6fjghkApIISiBWPzg"],"ignoreList":[0],"mappings":";AAAA,IAAA,mBAAe"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { lookup } from "node:dns/promises";
|
|
1
|
+
import { V as NoopLogger } from "./access.js";
|
|
3
2
|
import { isIP } from "node:net";
|
|
3
|
+
import { lookup } from "node:dns/promises";
|
|
4
4
|
// ../server/src/compute/safe-url.ts
|
|
5
5
|
/**
|
|
6
6
|
* SSRF guard for the remote-definition fetch. Without it an authenticated user
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// ../schemas/src/generated/schema.ts
|
|
2
2
|
/** Current UISchema format version (from ui-schema.json's schemaVersion default). */
|
|
3
|
-
var UI_SCHEMA_VERSION = "2.
|
|
3
|
+
var UI_SCHEMA_VERSION = "2.22.0";
|
|
4
4
|
function isNumberWidget(item) {
|
|
5
5
|
return item.type === "input" && item.widgetType === "number";
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","names":[],"sources":["../../../../schemas/src/generated/schema.ts"],"sourcesContent":["/* eslint-disable */\n/**\n * This file was automatically generated from packages/schemas/ui-schema.json.\n * DO NOT MODIFY IT BY HAND. Instead, modify the source JSON Schema file\n * and run `pnpm generate` at the repo root to regenerate it.\n */\n\nexport type ParamType =\n\t| 'number'\n\t| 'integer'\n\t| 'boolean'\n\t| 'text'\n\t| 'valueList'\n\t| 'dynamicValueList'\n\t| 'file'\n\t| 'color'\n\t| 'generic'\n\t| 'geometry'\n\t| 'point'\n\t| 'line'\n\t| 'plane';\nexport type InputNumberLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'number';\n\tconfig?: NumberWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputTextLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'text';\n\tconfig?: TextWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputDropdownLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'dropdown';\n\tconfig: DropdownWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputDynamicValueListLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'dynamicValueList';\n\tconfig?: DynamicValueListWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputCheckboxLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'checkbox';\n\tconfig?: CheckboxWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputFileLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'file';\n\tconfig?: FileInputWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputColorLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'color';\n\tconfig?: ColorWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type OutputTextLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'text';\n\t[k: string]: unknown | undefined;\n};\nexport type OutputNumberLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'number';\n\t[k: string]: unknown | undefined;\n};\nexport type OutputFileLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'file';\n\tconfig?: FileWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type OutputChartLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'chart';\n\tconfig?: ChartWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type OutputImageLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'image';\n\tconfig?: ImageWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type OutputDynamicValueListLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'dynamicValueList';\n\tconfig: DynamicValueListOutputConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type LayoutItem =\n\t| InputNumberLayoutItem\n\t| InputTextLayoutItem\n\t| InputDropdownLayoutItem\n\t| InputDynamicValueListLayoutItem\n\t| InputCheckboxLayoutItem\n\t| InputFileLayoutItem\n\t| InputColorLayoutItem\n\t| OutputTextLayoutItem\n\t| OutputNumberLayoutItem\n\t| OutputFileLayoutItem\n\t| OutputChartLayoutItem\n\t| OutputImageLayoutItem\n\t| OutputDynamicValueListLayoutItem\n\t| LineBreakLayoutItem;\nexport type LayoutConfig = TabbedLayoutConfig | FlatLayoutConfig;\nexport type InputStructure = 'item' | 'list' | 'tree';\n\n/**\n * Schema definitions for Selva UI configuration\n */\nexport interface SelvaUISchema {\n\t[k: string]: unknown | undefined;\n}\nexport interface VisibilityRule {\n\t/**\n\t * Parameter ID to watch for changes\n\t */\n\tparamId: string;\n\t/**\n\t * Comparison operator. 'contains', 'containsAny', 'isEmpty', 'isNotEmpty' apply to array-valued params (e.g., checklist value lists).\n\t */\n\toperator:\n\t\t| 'equals'\n\t\t| 'notEquals'\n\t\t| 'greaterThan'\n\t\t| 'lessThan'\n\t\t| 'greaterThanOrEqual'\n\t\t| 'lessThanOrEqual'\n\t\t| 'in'\n\t\t| 'notIn'\n\t\t| 'between'\n\t\t| 'matches'\n\t\t| 'contains'\n\t\t| 'containsAny'\n\t\t| 'isEmpty'\n\t\t| 'isNotEmpty';\n\t/**\n\t * Value to compare against (used for equals, notEquals, greaterThan, lessThan, greaterThanOrEqual, lessThanOrEqual)\n\t */\n\tvalue?: {\n\t\t[k: string]: unknown | undefined;\n\t};\n\t/**\n\t * Array of values (used for 'in', 'notIn' operators, or [min, max] for 'between')\n\t */\n\tvalues?: unknown[];\n}\nexport interface VisibilityCondition {\n\t/**\n\t * Evaluation mode: 'all' = AND (all rules must pass), 'any' = OR (at least one rule must pass)\n\t */\n\tmode?: 'all' | 'any';\n\t/**\n\t * List of rules to evaluate\n\t *\n\t * @minItems 1\n\t */\n\trules: [VisibilityRule, ...VisibilityRule[]];\n\t/**\n\t * Action to apply when condition is met: 'show' makes visible and enabled, 'hide' removes from view, 'disable' makes visible but greyed out and non-interactive\n\t */\n\taction?: 'show' | 'hide' | 'disable';\n\t/**\n\t * Default value to set for the parameter when condition is met. The value should be compatible with the parameter type (number, string, boolean, etc.)\n\t */\n\tdefaultValue?: {\n\t\t[k: string]: unknown | undefined;\n\t};\n}\nexport interface GroupVisibilityCondition {\n\t/**\n\t * Evaluation mode: 'all' = AND (all rules must pass), 'any' = OR (at least one rule must pass)\n\t */\n\tmode?: 'all' | 'any';\n\t/**\n\t * List of rules to evaluate\n\t *\n\t * @minItems 1\n\t */\n\trules: [VisibilityRule, ...VisibilityRule[]];\n\t/**\n\t * Action to apply when condition is met: 'show' makes group visible, 'hide' removes group from view\n\t */\n\taction?: 'show' | 'hide';\n}\nexport interface NumberWidgetConfig {\n\tminimum?: number;\n\tmaximum?: number;\n\tstepSize?: number;\n\tplaceholder?: string;\n\trenderAsSlider?: boolean;\n\t/**\n\t * Never show the min/max hint. Without it, a number box shows the hint beside its label while focused; sliders never show it.\n\t */\n\thideRange?: boolean;\n}\nexport interface TextWidgetConfig {\n\tplaceholder?: string;\n\trequired?: boolean;\n\t/**\n\t * Maximum character length for text input\n\t */\n\tmaxLength?: number;\n\t/**\n\t * Regex pattern for validation (e.g., email, phone)\n\t */\n\tpattern?: string;\n\t/**\n\t * Custom error message shown when pattern validation fails\n\t */\n\tcustomErrorMessage?: string;\n}\nexport interface OptionMedia {\n\t/**\n\t * Asset holding the option's icon (an OptionAsset with d).\n\t */\n\ticon?: string;\n\t/**\n\t * Asset holding the option's thumbnail (an OptionAsset with img).\n\t */\n\timage?: string;\n\t/**\n\t * Iconify name the icon was picked as (e.g. 'lucide:house'), so the builder can reopen the picker on it. Never rendered.\n\t */\n\ticonName?: string;\n}\nexport interface OptionAsset {\n\t/**\n\t * SVG path data on a 24x24 grid, drawn as a stroke (width 2, round caps and joins, no fill). Rendered as a path's d attribute, never as markup.\n\t */\n\td?: string;\n\t/**\n\t * Thumbnail as a base64 data URI. Only WebP, JPEG and PNG are accepted.\n\t */\n\timg?: string;\n\t/**\n\t * Thumbnail width in pixels\n\t */\n\tw?: number;\n\t/**\n\t * Thumbnail height in pixels\n\t */\n\th?: number;\n}\nexport interface DropdownWidgetConfig {\n\t/**\n\t * Key-value pairs for dropdown options\n\t */\n\toptions: {\n\t\t[k: string]: string | undefined;\n\t};\n\trequired?: boolean;\n\t/**\n\t * How to render the value list. 'dropdown' = single-select dropdown (value: string). 'checklist' = multi-select checkboxes (value: string[]); requires list access on the connected parameter. 'segmented' = single-select button row, shown as a dropdown when there are too many options to fit. 'tiles' = single-select grid of thumbnails.\n\t */\n\tdisplayAs?: 'dropdown' | 'checklist' | 'segmented' | 'tiles';\n\t/**\n\t * Icon and thumbnail per option, keyed by option name. Grasshopper owns options; this map is the author's and survives a re-sync.\n\t */\n\toptionMedia?: {\n\t\t[k: string]: OptionMedia | undefined;\n\t};\n}\nexport interface DynamicValueListWidgetConfig {\n\t/**\n\t * Author-provided seed list (name -> value). Shown until computed options replace it. Empty/absent means the input is empty until the first solve produces options.\n\t */\n\tdefaultOptions?: {\n\t\t[k: string]: string | undefined;\n\t};\n\t/**\n\t * What to render when there are no options yet (no defaultOptions and no computed options): 'hide' removes the field from view, 'show-empty' shows a disabled 'no options yet' control.\n\t */\n\temptyBehavior?: 'hide' | 'show-empty';\n\t/**\n\t * How to render the value list. 'dropdown' = single-select (value: string). 'checklist' = multi-select (value: string[]). 'segmented' = single-select button row, shown as a dropdown when there are too many options to fit. 'tiles' = single-select grid of thumbnails.\n\t */\n\tdisplayAs?: 'dropdown' | 'checklist' | 'segmented' | 'tiles';\n\t/**\n\t * Icon and thumbnail per option, keyed by option name. Names without an entry show text only.\n\t */\n\toptionMedia?: {\n\t\t[k: string]: OptionMedia | undefined;\n\t};\n}\nexport interface DynamicValueListOutputConfig {\n\t/**\n\t * The backend parameter's GUID (paramId) of the DynamicValueList input that this output's computed options populate.\n\t */\n\ttargetInputId: string;\n}\nexport interface CheckboxWidgetConfig {\n\t/**\n\t * 'checkbox' = a toggle whose value is sent with every solve. 'button' = a trigger: a press solves once with true, then the input goes back to false. A button holds no value in the form, so presets and value updates skip it.\n\t */\n\tdisplayAs?: 'checkbox' | 'button';\n}\nexport interface FileWidgetConfig {\n\tbuttonLabel?: string;\n\t/**\n\t * File format hint (e.g., '3dm') for setting download extension\n\t */\n\tfileFormat?: string;\n}\nexport interface FileInputWidgetConfig {\n\t/**\n\t * List of accepted file extensions (e.g., ['.3dm', '.step'])\n\t */\n\tacceptedFormats?: string[];\n\t/**\n\t * Which mode is active by default when both are allowed\n\t */\n\tdefaultInputMode?: 'upload' | 'url';\n\t/**\n\t * Which input modes the end user can choose from. If omitted, both are allowed.\n\t */\n\tallowedInputModes?: ('upload' | 'url')[];\n}\nexport interface ColorWidgetConfig {}\nexport interface LayoutItemBase {\n\t/**\n\t * Unique identifier for this layout item in the UI tree (not the parameter ID)\n\t */\n\tid: string;\n\t/**\n\t * References the backend parameter's GUID (Data Source)\n\t */\n\tparamId: string;\n\tdisplayName?: string;\n\tdescription?: string;\n\torder?: number;\n\tspan?: number;\n\t/**\n\t * Base visibility (static). If false, item is always hidden regardless of conditions.\n\t */\n\tvisible?: boolean;\n\tvisibilityCondition?: VisibilityCondition;\n\tsource?: InputSource;\n\t[k: string]: unknown | undefined;\n}\nexport interface InputSource {\n\t/**\n\t * Which data provider supplies the value. 'user' = the person types it into the form. 'client' = a browser app (e.g. a measurement/producer tool) fills it in before the form runs, not the person. 'server' = reserved for a server-side lookup that no host performs yet: the input solves with its default, a solve that posts a value for it is refused, and it is never shown in the form.\n\t */\n\tkind: 'user' | 'client' | 'server';\n\t/**\n\t * The address the host resolves to fill this input — opaque to Selva, interpreted by the host per 'kind'. For 'client' it names WHICH producer app supplies the value (e.g. 'line-app', 'file-upload') so the host pre-routes to it; for 'server' it names WHAT a resolver would fetch (e.g. 'capture.geometry'). Keys need not be unique: the same producer/fetch may fill several inputs. Ignored for kind='user'.\n\t */\n\tkey?: string;\n\t/**\n\t * How a client-sourced input appears in the form (only meaningful when kind='client'). Omitted = 'hidden': the value is prefilled silently and the input does not appear. 'slot' = Selva reserves the input's grid cell and lets the host render its own element there; Selva draws nothing itself and never interprets that element.\n\t */\n\tclient?: {\n\t\t/**\n\t\t * 'hidden' = no UI; the producer app prefills the value and the input does not appear. 'slot' = the host renders a custom element (e.g. an 'Edit JSON' button) in this input's place, referencing the producer named by 'key'.\n\t\t */\n\t\tpresentation?: 'hidden' | 'slot';\n\t};\n}\nexport interface ChartWidgetConfig {}\nexport interface ImageWidgetConfig {\n\t/**\n\t * Show a download button on the image viewer\n\t */\n\tallowDownload?: boolean;\n\t/**\n\t * Show a fullscreen toggle button on the image viewer\n\t */\n\tallowFullscreen?: boolean;\n\t/**\n\t * Optional background color shown behind the image (hex string, e.g. '#ffffff')\n\t */\n\tbackgroundColor?: string;\n}\nexport interface LineBreakLayoutItem {\n\t/**\n\t * Unique identifier for this layout item in the UI tree\n\t */\n\tid: string;\n\ttype: 'linebreak';\n}\nexport interface GroupConfig {\n\tid: string;\n\tlabel: string;\n\tdescription?: string;\n\torder?: number;\n\tcollapsed?: boolean;\n\tcolumns?: number;\n\titems: LayoutItem[];\n\tvisibilityCondition?: GroupVisibilityCondition;\n}\nexport interface TabConfig {\n\tid: string;\n\tlabel: string;\n\ticon?: string;\n\torder?: number;\n\tgroups: GroupConfig[];\n\t/**\n\t * Horizontal region where this tab should be positioned in multi-column layouts\n\t */\n\tposition?: 'left' | 'center' | 'right';\n\t/**\n\t * Base visibility (static). If false, the tab is always hidden. A tab whose groups are all hidden is hidden too.\n\t */\n\tvisible?: boolean;\n}\nexport interface TabbedLayoutConfig {\n\ttype: 'tabbed';\n\tgap?: number;\n\ttabs: TabConfig[];\n}\nexport interface FlatLayoutConfig {\n\ttype: 'flat';\n\tgap?: number;\n\tgroups: GroupConfig[];\n}\nexport interface SchemaInput {\n\t/**\n\t * Backend-specific parameter identifier (e.g. a Grasshopper InstanceGuid)\n\t */\n\tid: string;\n\tnickname: string;\n\tparamType: ParamType;\n\tdescription?: string;\n\tdefault?: unknown;\n\t/**\n\t * Data access mode: 'item' = single value, 'list' = flat list, 'tree' = branching data tree. Defaults to 'item'.\n\t */\n\tinputStructure?: 'item' | 'list' | 'tree';\n}\nexport interface SchemaOutput {\n\t/**\n\t * Backend-specific parameter identifier (e.g. a Grasshopper InstanceGuid)\n\t */\n\tid: string;\n\tnickname: string;\n\tdescription?: string;\n\t/**\n\t * Output display type\n\t */\n\ttype: 'text' | 'number' | 'file' | 'chart' | 'dynamicValueList';\n\t/**\n\t * For 'dynamicValueList' outputs: the instance GUID (paramId) of the DynamicValueList input that this output's computed options populate.\n\t */\n\ttargetInputId?: string;\n}\nexport interface ViewerOptions {\n\t/**\n\t * If true, the plugin streams display meshes to its local web preview, which then shows the 3D viewer. Selva ignores it.\n\t */\n\tenableLocal?: boolean;\n\t/**\n\t * If true, Selva draws the display meshes in the Rhino.Compute response and shows the 3D viewer. The plugin's local preview ignores it.\n\t */\n\tenableRemote?: boolean;\n\t/**\n\t * Background color for the 3D viewer as hex string (e.g., '#ffffff')\n\t */\n\tbackgroundColor?: string;\n\t/**\n\t * The viewer look a definition opens in. A viewer can still switch look from its display menu.\n\t */\n\tlook?:\n\t\t'technical' | 'studio' | 'showcase' | 'arctic' | 'xray' | 'lineart' | 'wireframe' | 'night';\n}\nexport interface LocalOptions {\n\t/**\n\t * If true, geometry picked in the Rhino viewport follows the Rhino objects it came from: editing or moving one re-solves with its new shape, deleting one drops it. If false, a pick is a snapshot.\n\t */\n\ttrackPickedObjects?: boolean;\n}\nexport interface UISchema {\n\tid: string;\n\tname: string;\n\tdescription?: string;\n\t/**\n\t * Grasshopper document file name (e.g., 'myfile.gh')\n\t */\n\tprojectFileName?: string;\n\t/**\n\t * Grasshopper document unique identifier (GUID)\n\t */\n\tdocumentId?: string;\n\t/**\n\t * Version of Selva plugin that created/last modified this schema\n\t */\n\tpluginVersion?: string;\n\t/**\n\t * Tags for the Selva library (e.g., ['architecture', 'facade']). Selva copies them into the definition when it is uploaded; after that the definition's own tags win. At most MAX_TAGS, none containing a comma.\n\t */\n\ttags?: string[];\n\t/**\n\t * Category for the Selva library (e.g., 'architecture', 'structural'). Selva copies it into the definition when it is uploaded; after that the definition's own category wins. At most MAX_CATEGORY_LENGTH characters.\n\t */\n\tcategory?: string;\n\t/**\n\t * User or organization who created the schema\n\t */\n\tauthor?: string;\n\t/**\n\t * Organization/company name\n\t */\n\torganization?: string;\n\t/**\n\t * Semantic version of the schema format (MAJOR.MINOR.PATCH)\n\t */\n\tschemaVersion: string;\n\t/**\n\t * Minimum plugin version required to load this schema\n\t */\n\tminPluginVersion?: string;\n\tcreated?: string;\n\t/**\n\t * Last modification timestamp\n\t */\n\tlastModified?: string;\n\tviewerOptions?: ViewerOptions1;\n\tlocalOptions?: LocalOptions;\n\t/**\n\t * If true, changes trigger immediate solving. If false, user must press Calculate button.\n\t */\n\tinstanceSolve?: boolean;\n\t/**\n\t * If true, edits solve as previews: file components that only feed a Download output are skipped, and a click on Download runs one full solve. If false or absent, every solve makes every file.\n\t */\n\tpreviewSolves?: boolean;\n\tinputs: SchemaInput[];\n\t/**\n\t * All output components (print, bake, file download)\n\t */\n\toutputs: SchemaOutput[];\n\tlayout: LayoutConfig;\n\t/**\n\t * Icons and thumbnails referenced by optionMedia, keyed by a hash of their content so a shared one is stored once.\n\t */\n\tassets?: {\n\t\t[k: string]: OptionAsset | undefined;\n\t};\n}\n/**\n * Configuration for the 3D viewer\n */\nexport interface ViewerOptions1 {\n\t/**\n\t * If true, the plugin streams display meshes to its local web preview, which then shows the 3D viewer. Selva ignores it.\n\t */\n\tenableLocal?: boolean;\n\t/**\n\t * If true, Selva draws the display meshes in the Rhino.Compute response and shows the 3D viewer. The plugin's local preview ignores it.\n\t */\n\tenableRemote?: boolean;\n\t/**\n\t * Background color for the 3D viewer as hex string (e.g., '#ffffff')\n\t */\n\tbackgroundColor?: string;\n\t/**\n\t * The viewer look a definition opens in. A viewer can still switch look from its display menu.\n\t */\n\tlook?:\n\t\t'technical' | 'studio' | 'showcase' | 'arctic' | 'xray' | 'lineart' | 'wireframe' | 'night';\n}\n\n// ============================================================================\n// CONSTANTS (from schema)\n// ============================================================================\n\nexport const ACCEPTED_FILE_FORMATS = [\n\t'.3dm',\n\t'.stp',\n\t'.step',\n\t'.fbx',\n\t'.obj',\n\t'.dxf',\n\t'.stl'\n] as const;\nexport const MAX_TAGS = 5 as const;\nexport const MAX_CATEGORY_LENGTH = 40 as const;\n\n/** Current UISchema format version (from ui-schema.json's schemaVersion default). */\nexport const UI_SCHEMA_VERSION = '2.20.0';\n\n// ============================================================================\n// TYPE ALIASES AND GUARDS (derived from the LayoutItem union)\n// ============================================================================\n\nexport type InputLayoutItem =\n\t| InputNumberLayoutItem\n\t| InputTextLayoutItem\n\t| InputDropdownLayoutItem\n\t| InputDynamicValueListLayoutItem\n\t| InputCheckboxLayoutItem\n\t| InputFileLayoutItem\n\t| InputColorLayoutItem;\nexport type OutputLayoutItem =\n\t| OutputTextLayoutItem\n\t| OutputNumberLayoutItem\n\t| OutputFileLayoutItem\n\t| OutputChartLayoutItem\n\t| OutputImageLayoutItem\n\t| OutputDynamicValueListLayoutItem;\nexport type SupportedTypes = string | number | boolean | string[];\n\nexport function isInputLayoutItem(item: LayoutItem): item is InputLayoutItem {\n\treturn item.type === 'input';\n}\n\nexport function isOutputLayoutItem(item: LayoutItem): item is OutputLayoutItem {\n\treturn item.type === 'output';\n}\n\nexport function isLineBreakLayoutItem(item: LayoutItem): item is LineBreakLayoutItem {\n\treturn item.type === 'linebreak';\n}\n\nexport function isNumberWidget(item: LayoutItem): item is InputNumberLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'number';\n}\n\nexport function isTextWidget(item: LayoutItem): item is InputTextLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'text';\n}\n\nexport function isDropdownWidget(item: LayoutItem): item is InputDropdownLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'dropdown';\n}\n\nexport function isDynamicValueListWidget(\n\titem: LayoutItem\n): item is InputDynamicValueListLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'dynamicValueList';\n}\n\nexport function isCheckboxWidget(item: LayoutItem): item is InputCheckboxLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'checkbox';\n}\n\nexport function isFileWidget(item: LayoutItem): item is InputFileLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'file';\n}\n\nexport function isColorWidget(item: LayoutItem): item is InputColorLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'color';\n}\n\nexport function isTextOutputWidget(item: LayoutItem): item is OutputTextLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'text';\n}\n\nexport function isNumberOutputWidget(item: LayoutItem): item is OutputNumberLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'number';\n}\n\nexport function isFileOutputWidget(item: LayoutItem): item is OutputFileLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'file';\n}\n\nexport function isChartOutputWidget(item: LayoutItem): item is OutputChartLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'chart';\n}\n\nexport function isImageOutputWidget(item: LayoutItem): item is OutputImageLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'image';\n}\n\nexport function isDynamicValueListOutputWidget(\n\titem: LayoutItem\n): item is OutputDynamicValueListLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'dynamicValueList';\n}\n"],"mappings":";;AA2kBA,IAAa,oBAAoB;AAmCjC,SAAgB,eAAe,MAAiD;CAC/E,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,aAAa,MAA+C;CAC3E,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,iBAAiB,MAAmD;CACnF,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,yBACf,MAC0C;CAC1C,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,iBAAiB,MAAmD;CACnF,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,aAAa,MAA+C;CAC3E,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,cAAc,MAAgD;CAC7E,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD"}
|
|
1
|
+
{"version":3,"file":"schema.js","names":[],"sources":["../../../../schemas/src/generated/schema.ts"],"sourcesContent":["/* eslint-disable */\n/**\n * This file was automatically generated from packages/schemas/ui-schema.json.\n * DO NOT MODIFY IT BY HAND. Instead, modify the source JSON Schema file\n * and run `pnpm generate` at the repo root to regenerate it.\n */\n\nexport type ParamType =\n\t| 'number'\n\t| 'integer'\n\t| 'boolean'\n\t| 'text'\n\t| 'valueList'\n\t| 'dynamicValueList'\n\t| 'file'\n\t| 'color'\n\t| 'generic'\n\t| 'geometry'\n\t| 'point'\n\t| 'line'\n\t| 'plane';\nexport type GeometryKind =\n\t| 'point'\n\t| 'pointCloud'\n\t| 'curve'\n\t| 'surface'\n\t| 'polysurface'\n\t| 'extrusion'\n\t| 'mesh'\n\t| 'subd'\n\t| 'block';\nexport type InputNumberLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'number';\n\tconfig?: NumberWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputTextLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'text';\n\tconfig?: TextWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputDropdownLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'dropdown';\n\tconfig: DropdownWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputDynamicValueListLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'dynamicValueList';\n\tconfig?: DynamicValueListWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputCheckboxLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'checkbox';\n\tconfig?: CheckboxWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputFileLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'file';\n\tconfig?: FileInputWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputColorLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'color';\n\tconfig?: ColorWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type OutputTextLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'text';\n\t[k: string]: unknown | undefined;\n};\nexport type OutputNumberLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'number';\n\t[k: string]: unknown | undefined;\n};\nexport type OutputFileLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'file';\n\tconfig?: FileWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type OutputChartLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'chart';\n\tconfig?: ChartWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type OutputImageLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'image';\n\tconfig?: ImageWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type OutputDynamicValueListLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'dynamicValueList';\n\tconfig: DynamicValueListOutputConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type LayoutItem =\n\t| InputNumberLayoutItem\n\t| InputTextLayoutItem\n\t| InputDropdownLayoutItem\n\t| InputDynamicValueListLayoutItem\n\t| InputCheckboxLayoutItem\n\t| InputFileLayoutItem\n\t| InputColorLayoutItem\n\t| OutputTextLayoutItem\n\t| OutputNumberLayoutItem\n\t| OutputFileLayoutItem\n\t| OutputChartLayoutItem\n\t| OutputImageLayoutItem\n\t| OutputDynamicValueListLayoutItem\n\t| LineBreakLayoutItem;\nexport type LayoutConfig = TabbedLayoutConfig | FlatLayoutConfig;\nexport type InputStructure = 'item' | 'list' | 'tree';\n\n/**\n * Schema definitions for Selva UI configuration\n */\nexport interface SelvaUISchema {\n\t[k: string]: unknown | undefined;\n}\nexport interface VisibilityRule {\n\t/**\n\t * Parameter ID to watch for changes\n\t */\n\tparamId: string;\n\t/**\n\t * Comparison operator. 'contains', 'containsAny', 'isEmpty', 'isNotEmpty' apply to array-valued params (e.g., checklist value lists).\n\t */\n\toperator:\n\t\t| 'equals'\n\t\t| 'notEquals'\n\t\t| 'greaterThan'\n\t\t| 'lessThan'\n\t\t| 'greaterThanOrEqual'\n\t\t| 'lessThanOrEqual'\n\t\t| 'in'\n\t\t| 'notIn'\n\t\t| 'between'\n\t\t| 'matches'\n\t\t| 'contains'\n\t\t| 'containsAny'\n\t\t| 'isEmpty'\n\t\t| 'isNotEmpty';\n\t/**\n\t * Value to compare against (used for equals, notEquals, greaterThan, lessThan, greaterThanOrEqual, lessThanOrEqual)\n\t */\n\tvalue?: {\n\t\t[k: string]: unknown | undefined;\n\t};\n\t/**\n\t * Array of values (used for 'in', 'notIn' operators, or [min, max] for 'between')\n\t */\n\tvalues?: unknown[];\n}\nexport interface VisibilityCondition {\n\t/**\n\t * Evaluation mode: 'all' = AND (all rules must pass), 'any' = OR (at least one rule must pass)\n\t */\n\tmode?: 'all' | 'any';\n\t/**\n\t * List of rules to evaluate\n\t *\n\t * @minItems 1\n\t */\n\trules: [VisibilityRule, ...VisibilityRule[]];\n\t/**\n\t * Action to apply when condition is met: 'show' makes visible and enabled, 'hide' removes from view, 'disable' makes visible but greyed out and non-interactive\n\t */\n\taction?: 'show' | 'hide' | 'disable';\n\t/**\n\t * Default value to set for the parameter when condition is met. The value should be compatible with the parameter type (number, string, boolean, etc.)\n\t */\n\tdefaultValue?: {\n\t\t[k: string]: unknown | undefined;\n\t};\n}\nexport interface GroupVisibilityCondition {\n\t/**\n\t * Evaluation mode: 'all' = AND (all rules must pass), 'any' = OR (at least one rule must pass)\n\t */\n\tmode?: 'all' | 'any';\n\t/**\n\t * List of rules to evaluate\n\t *\n\t * @minItems 1\n\t */\n\trules: [VisibilityRule, ...VisibilityRule[]];\n\t/**\n\t * Action to apply when condition is met: 'show' makes group visible, 'hide' removes group from view\n\t */\n\taction?: 'show' | 'hide';\n}\nexport interface NumberWidgetConfig {\n\tminimum?: number;\n\tmaximum?: number;\n\tstepSize?: number;\n\tplaceholder?: string;\n\trenderAsSlider?: boolean;\n\t/**\n\t * Unit shown after the value, e.g. \"mm\". Display only: the solve gets the bare number.\n\t */\n\tunit?: string;\n\t/**\n\t * Never show the min/max hint. Without it, a number box shows the hint beside its label while focused; sliders never show it.\n\t */\n\thideRange?: boolean;\n}\nexport interface TextWidgetConfig {\n\tplaceholder?: string;\n\trequired?: boolean;\n\t/**\n\t * Maximum character length for text input\n\t */\n\tmaxLength?: number;\n\t/**\n\t * Regex pattern for validation (e.g., email, phone)\n\t */\n\tpattern?: string;\n\t/**\n\t * Custom error message shown when pattern validation fails\n\t */\n\tcustomErrorMessage?: string;\n}\nexport interface OptionMedia {\n\t/**\n\t * Asset holding the option's icon (an OptionAsset with d).\n\t */\n\ticon?: string;\n\t/**\n\t * Asset holding the option's thumbnail (an OptionAsset with img).\n\t */\n\timage?: string;\n\t/**\n\t * Iconify name the icon was picked as (e.g. 'lucide:house'), so the builder can reopen the picker on it. Never rendered.\n\t */\n\ticonName?: string;\n}\nexport interface OptionAsset {\n\t/**\n\t * SVG path data on a 24x24 grid, drawn as a stroke (width 2, round caps and joins, no fill). Rendered as a path's d attribute, never as markup.\n\t */\n\td?: string;\n\t/**\n\t * Thumbnail as a base64 data URI. Only WebP, JPEG and PNG are accepted.\n\t */\n\timg?: string;\n\t/**\n\t * Thumbnail width in pixels\n\t */\n\tw?: number;\n\t/**\n\t * Thumbnail height in pixels\n\t */\n\th?: number;\n}\nexport interface DropdownWidgetConfig {\n\t/**\n\t * Key-value pairs for dropdown options\n\t */\n\toptions: {\n\t\t[k: string]: string | undefined;\n\t};\n\trequired?: boolean;\n\t/**\n\t * How to render the value list. 'dropdown' = single-select dropdown (value: string). 'checklist' = multi-select checkboxes (value: string[]); requires list access on the connected parameter. 'segmented' = single-select button row, shown as a dropdown when there are too many options to fit. 'tiles' = single-select grid of thumbnails.\n\t */\n\tdisplayAs?: 'dropdown' | 'checklist' | 'segmented' | 'tiles';\n\t/**\n\t * Icon and thumbnail per option, keyed by option name. Grasshopper owns options; this map is the author's and survives a re-sync.\n\t */\n\toptionMedia?: {\n\t\t[k: string]: OptionMedia | undefined;\n\t};\n}\nexport interface DynamicValueListWidgetConfig {\n\t/**\n\t * Author-provided seed list (name -> value). Shown until computed options replace it. Empty/absent means the input is empty until the first solve produces options.\n\t */\n\tdefaultOptions?: {\n\t\t[k: string]: string | undefined;\n\t};\n\t/**\n\t * What to render when there are no options yet (no defaultOptions and no computed options): 'hide' removes the field from view, 'show-empty' shows a disabled 'no options yet' control.\n\t */\n\temptyBehavior?: 'hide' | 'show-empty';\n\t/**\n\t * How to render the value list. 'dropdown' = single-select (value: string). 'checklist' = multi-select (value: string[]). 'segmented' = single-select button row, shown as a dropdown when there are too many options to fit. 'tiles' = single-select grid of thumbnails.\n\t */\n\tdisplayAs?: 'dropdown' | 'checklist' | 'segmented' | 'tiles';\n\t/**\n\t * Icon and thumbnail per option, keyed by option name. Names without an entry show text only.\n\t */\n\toptionMedia?: {\n\t\t[k: string]: OptionMedia | undefined;\n\t};\n}\nexport interface DynamicValueListOutputConfig {\n\t/**\n\t * The backend parameter's GUID (paramId) of the DynamicValueList input that this output's computed options populate.\n\t */\n\ttargetInputId: string;\n}\nexport interface CheckboxWidgetConfig {\n\t/**\n\t * 'checkbox' = a toggle whose value is sent with every solve. 'button' = a trigger: a press solves once with true, then the input goes back to false. A button holds no value in the form, so presets and value updates skip it.\n\t */\n\tdisplayAs?: 'checkbox' | 'button';\n}\nexport interface FileWidgetConfig {\n\tbuttonLabel?: string;\n\t/**\n\t * File format hint (e.g., '3dm') for setting download extension\n\t */\n\tfileFormat?: string;\n}\nexport interface FileInputWidgetConfig {\n\t/**\n\t * List of accepted file extensions (e.g., ['.3dm', '.step'])\n\t */\n\tacceptedFormats?: string[];\n\t/**\n\t * Which mode is active by default when both are allowed\n\t */\n\tdefaultInputMode?: 'upload' | 'url';\n\t/**\n\t * Which input modes the end user can choose from. If omitted, both are allowed.\n\t */\n\tallowedInputModes?: ('upload' | 'url')[];\n}\nexport interface ColorWidgetConfig {}\nexport interface LayoutItemBase {\n\t/**\n\t * Unique identifier for this layout item in the UI tree (not the parameter ID)\n\t */\n\tid: string;\n\t/**\n\t * References the backend parameter's GUID (Data Source)\n\t */\n\tparamId: string;\n\tdisplayName?: string;\n\tdescription?: string;\n\torder?: number;\n\tspan?: number;\n\t/**\n\t * Base visibility (static). If false, item is always hidden regardless of conditions.\n\t */\n\tvisible?: boolean;\n\tvisibilityCondition?: VisibilityCondition;\n\tsource?: InputSource;\n\t[k: string]: unknown | undefined;\n}\nexport interface InputSource {\n\t/**\n\t * Which data provider supplies the value. 'user' = the person types it into the form. 'client' = a browser app (e.g. a measurement/producer tool) fills it in before the form runs, not the person. 'server' = reserved for a server-side lookup that no host performs yet: the input solves with its default, a solve that posts a value for it is refused, and it is never shown in the form.\n\t */\n\tkind: 'user' | 'client' | 'server';\n\t/**\n\t * The address the host resolves to fill this input — opaque to Selva, interpreted by the host per 'kind'. For 'client' it names WHICH producer app supplies the value (e.g. 'line-app', 'file-upload') so the host pre-routes to it; for 'server' it names WHAT a resolver would fetch (e.g. 'capture.geometry'). Keys need not be unique: the same producer/fetch may fill several inputs. Ignored for kind='user'.\n\t */\n\tkey?: string;\n\t/**\n\t * How a client-sourced input appears in the form (only meaningful when kind='client'). Omitted = 'hidden': the value is prefilled silently and the input does not appear. 'slot' = Selva reserves the input's grid cell and lets the host render its own element there; Selva draws nothing itself and never interprets that element.\n\t */\n\tclient?: {\n\t\t/**\n\t\t * 'hidden' = no UI; the producer app prefills the value and the input does not appear. 'slot' = the host renders a custom element (e.g. an 'Edit JSON' button) in this input's place, referencing the producer named by 'key'.\n\t\t */\n\t\tpresentation?: 'hidden' | 'slot';\n\t};\n}\nexport interface ChartWidgetConfig {}\nexport interface ImageWidgetConfig {\n\t/**\n\t * Show a download button on the image viewer\n\t */\n\tallowDownload?: boolean;\n\t/**\n\t * Show a fullscreen toggle button on the image viewer\n\t */\n\tallowFullscreen?: boolean;\n\t/**\n\t * Optional background color shown behind the image (hex string, e.g. '#ffffff')\n\t */\n\tbackgroundColor?: string;\n}\nexport interface LineBreakLayoutItem {\n\t/**\n\t * Unique identifier for this layout item in the UI tree\n\t */\n\tid: string;\n\ttype: 'linebreak';\n}\nexport interface GroupConfig {\n\tid: string;\n\tlabel: string;\n\tdescription?: string;\n\torder?: number;\n\tcollapsed?: boolean;\n\tcolumns?: number;\n\titems: LayoutItem[];\n\tvisibilityCondition?: GroupVisibilityCondition;\n}\nexport interface TabConfig {\n\tid: string;\n\tlabel: string;\n\ticon?: string;\n\torder?: number;\n\tgroups: GroupConfig[];\n\t/**\n\t * Horizontal region where this tab should be positioned in multi-column layouts\n\t */\n\tposition?: 'left' | 'center' | 'right';\n\t/**\n\t * Base visibility (static). If false, the tab is always hidden. A tab whose groups are all hidden is hidden too.\n\t */\n\tvisible?: boolean;\n}\nexport interface TabbedLayoutConfig {\n\ttype: 'tabbed';\n\tgap?: number;\n\ttabs: TabConfig[];\n}\nexport interface FlatLayoutConfig {\n\ttype: 'flat';\n\tgap?: number;\n\tgroups: GroupConfig[];\n}\nexport interface SchemaInput {\n\t/**\n\t * Backend-specific parameter identifier (e.g. a Grasshopper InstanceGuid)\n\t */\n\tid: string;\n\tnickname: string;\n\tparamType: ParamType;\n\tdescription?: string;\n\tdefault?: unknown;\n\t/**\n\t * Data access mode: 'item' = single value, 'list' = flat list, 'tree' = branching data tree. Defaults to 'item'.\n\t */\n\tinputStructure?: 'item' | 'list' | 'tree';\n\t/**\n\t * For a 'geometry' input: what the Get Geometry's type filter allows, re-read from the param whenever the plugin validates the schema against the document. Empty or absent means the filter allows everything, or is unknown: a schema saved before 2.22.0 never has it, and other inputs carry none. A host without the document (Selva) reads it to decide whether the input takes curves.\n\t */\n\tgeometryTypes?: GeometryKind[];\n\t/**\n\t * For a geometry, point, line or plane input: the most objects the param takes, re-read from it like geometryTypes; 2147483647 is no limit. Absent on other inputs and on a schema saved before 2.22.0.\n\t */\n\tatMost?: number;\n}\nexport interface SchemaOutput {\n\t/**\n\t * Backend-specific parameter identifier (e.g. a Grasshopper InstanceGuid)\n\t */\n\tid: string;\n\tnickname: string;\n\tdescription?: string;\n\t/**\n\t * Output display type\n\t */\n\ttype: 'text' | 'number' | 'file' | 'chart' | 'dynamicValueList';\n\t/**\n\t * For 'dynamicValueList' outputs: the instance GUID (paramId) of the DynamicValueList input that this output's computed options populate.\n\t */\n\ttargetInputId?: string;\n}\nexport interface ViewerOptions {\n\t/**\n\t * If true, the plugin streams display meshes to its local web preview, which then shows the 3D viewer. Selva ignores it.\n\t */\n\tenableLocal?: boolean;\n\t/**\n\t * If true, Selva draws the display meshes in the Rhino.Compute response and shows the 3D viewer. The plugin's local preview ignores it.\n\t */\n\tenableRemote?: boolean;\n\t/**\n\t * Background color for the 3D viewer as hex string (e.g., '#ffffff')\n\t */\n\tbackgroundColor?: string;\n\t/**\n\t * The viewer look a definition opens in. A viewer can still switch look from its display menu.\n\t */\n\tlook?:\n\t\t'technical' | 'studio' | 'showcase' | 'arctic' | 'xray' | 'lineart' | 'wireframe' | 'night';\n}\nexport interface LocalOptions {\n\t/**\n\t * If true, geometry picked in the Rhino viewport follows the Rhino objects it came from: editing or moving one re-solves with its new shape, deleting one drops it. If false, a pick is a snapshot.\n\t */\n\ttrackPickedObjects?: boolean;\n}\nexport interface UISchema {\n\tid: string;\n\tname: string;\n\tdescription?: string;\n\t/**\n\t * Grasshopper document file name (e.g., 'myfile.gh')\n\t */\n\tprojectFileName?: string;\n\t/**\n\t * Grasshopper document unique identifier (GUID)\n\t */\n\tdocumentId?: string;\n\t/**\n\t * Version of Selva plugin that created/last modified this schema\n\t */\n\tpluginVersion?: string;\n\t/**\n\t * Tags for the Selva library (e.g., ['architecture', 'facade']). Selva copies them into the definition when it is uploaded; after that the definition's own tags win. At most MAX_TAGS, none containing a comma.\n\t */\n\ttags?: string[];\n\t/**\n\t * Category for the Selva library (e.g., 'architecture', 'structural'). Selva copies it into the definition when it is uploaded; after that the definition's own category wins. At most MAX_CATEGORY_LENGTH characters.\n\t */\n\tcategory?: string;\n\t/**\n\t * User or organization who created the schema\n\t */\n\tauthor?: string;\n\t/**\n\t * Organization/company name\n\t */\n\torganization?: string;\n\t/**\n\t * Semantic version of the schema format (MAJOR.MINOR.PATCH)\n\t */\n\tschemaVersion: string;\n\t/**\n\t * Minimum plugin version required to load this schema\n\t */\n\tminPluginVersion?: string;\n\tcreated?: string;\n\t/**\n\t * Last modification timestamp\n\t */\n\tlastModified?: string;\n\tviewerOptions?: ViewerOptions1;\n\tlocalOptions?: LocalOptions;\n\t/**\n\t * If true, changes trigger immediate solving. If false, user must press Calculate button.\n\t */\n\tinstanceSolve?: boolean;\n\t/**\n\t * If true, edits solve as previews: file components that only feed a Download output are skipped, and a click on Download runs one full solve. If false or absent, every solve makes every file.\n\t */\n\tpreviewSolves?: boolean;\n\tinputs: SchemaInput[];\n\t/**\n\t * All output components (print, bake, file download)\n\t */\n\toutputs: SchemaOutput[];\n\tlayout: LayoutConfig;\n\t/**\n\t * Icons and thumbnails referenced by optionMedia, keyed by a hash of their content so a shared one is stored once.\n\t */\n\tassets?: {\n\t\t[k: string]: OptionAsset | undefined;\n\t};\n}\n/**\n * Configuration for the 3D viewer\n */\nexport interface ViewerOptions1 {\n\t/**\n\t * If true, the plugin streams display meshes to its local web preview, which then shows the 3D viewer. Selva ignores it.\n\t */\n\tenableLocal?: boolean;\n\t/**\n\t * If true, Selva draws the display meshes in the Rhino.Compute response and shows the 3D viewer. The plugin's local preview ignores it.\n\t */\n\tenableRemote?: boolean;\n\t/**\n\t * Background color for the 3D viewer as hex string (e.g., '#ffffff')\n\t */\n\tbackgroundColor?: string;\n\t/**\n\t * The viewer look a definition opens in. A viewer can still switch look from its display menu.\n\t */\n\tlook?:\n\t\t'technical' | 'studio' | 'showcase' | 'arctic' | 'xray' | 'lineart' | 'wireframe' | 'night';\n}\n\n// ============================================================================\n// CONSTANTS (from schema)\n// ============================================================================\n\nexport const ACCEPTED_FILE_FORMATS = [\n\t'.3dm',\n\t'.stp',\n\t'.step',\n\t'.fbx',\n\t'.obj',\n\t'.dxf',\n\t'.stl'\n] as const;\nexport const MAX_TAGS = 5 as const;\nexport const MAX_CATEGORY_LENGTH = 40 as const;\n\n/** Current UISchema format version (from ui-schema.json's schemaVersion default). */\nexport const UI_SCHEMA_VERSION = '2.22.0';\n\n// ============================================================================\n// TYPE ALIASES AND GUARDS (derived from the LayoutItem union)\n// ============================================================================\n\nexport type InputLayoutItem =\n\t| InputNumberLayoutItem\n\t| InputTextLayoutItem\n\t| InputDropdownLayoutItem\n\t| InputDynamicValueListLayoutItem\n\t| InputCheckboxLayoutItem\n\t| InputFileLayoutItem\n\t| InputColorLayoutItem;\nexport type OutputLayoutItem =\n\t| OutputTextLayoutItem\n\t| OutputNumberLayoutItem\n\t| OutputFileLayoutItem\n\t| OutputChartLayoutItem\n\t| OutputImageLayoutItem\n\t| OutputDynamicValueListLayoutItem;\nexport type SupportedTypes = string | number | boolean | string[];\n\nexport function isInputLayoutItem(item: LayoutItem): item is InputLayoutItem {\n\treturn item.type === 'input';\n}\n\nexport function isOutputLayoutItem(item: LayoutItem): item is OutputLayoutItem {\n\treturn item.type === 'output';\n}\n\nexport function isLineBreakLayoutItem(item: LayoutItem): item is LineBreakLayoutItem {\n\treturn item.type === 'linebreak';\n}\n\nexport function isNumberWidget(item: LayoutItem): item is InputNumberLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'number';\n}\n\nexport function isTextWidget(item: LayoutItem): item is InputTextLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'text';\n}\n\nexport function isDropdownWidget(item: LayoutItem): item is InputDropdownLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'dropdown';\n}\n\nexport function isDynamicValueListWidget(\n\titem: LayoutItem\n): item is InputDynamicValueListLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'dynamicValueList';\n}\n\nexport function isCheckboxWidget(item: LayoutItem): item is InputCheckboxLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'checkbox';\n}\n\nexport function isFileWidget(item: LayoutItem): item is InputFileLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'file';\n}\n\nexport function isColorWidget(item: LayoutItem): item is InputColorLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'color';\n}\n\nexport function isTextOutputWidget(item: LayoutItem): item is OutputTextLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'text';\n}\n\nexport function isNumberOutputWidget(item: LayoutItem): item is OutputNumberLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'number';\n}\n\nexport function isFileOutputWidget(item: LayoutItem): item is OutputFileLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'file';\n}\n\nexport function isChartOutputWidget(item: LayoutItem): item is OutputChartLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'chart';\n}\n\nexport function isImageOutputWidget(item: LayoutItem): item is OutputImageLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'image';\n}\n\nexport function isDynamicValueListOutputWidget(\n\titem: LayoutItem\n): item is OutputDynamicValueListLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'dynamicValueList';\n}\n"],"mappings":";;AAimBA,IAAa,oBAAoB;AAmCjC,SAAgB,eAAe,MAAiD;CAC/E,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,aAAa,MAA+C;CAC3E,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,iBAAiB,MAAmD;CACnF,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,yBACf,MAC0C;CAC1C,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,iBAAiB,MAAmD;CACnF,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,aAAa,MAA+C;CAC3E,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,cAAc,MAAgD;CAC7E,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { f as getLogger } from "./providers.server.js";
|
|
2
|
-
import { n as renderThrown } from "./
|
|
2
|
+
import { n as renderThrown } from "./logging.js";
|
|
3
3
|
import { t as deriveOutcome } from "./update-outcome.js";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { existsSync, readFileSync, rmSync } from "node:fs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { V as isEncryptedSecret } from "./providers.server.js";
|
|
2
|
-
import {
|
|
2
|
+
import { O as ApiErrorCode, at as trimTrailing, k as apiError } from "./access.js";
|
|
3
3
|
import { r as GuidSchema } from "./schemas.js";
|
|
4
4
|
import { n as isLinkLocalUrl } from "./safe-url.js";
|
|
5
5
|
// ../server/src/compute/evict-changed-servers.ts
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { f as getLogger } from "./providers.server.js";
|
|
1
2
|
import { t as hmacKeys } from "./keys.server.js";
|
|
2
3
|
import { t as createComputeRateLimiter } from "./rate-limit.js";
|
|
3
4
|
import { t as assertSafeRemoteDefinitionUrl } from "./safe-url.js";
|
|
@@ -22,7 +23,10 @@ var unredeemed = /* @__PURE__ */ new Map();
|
|
|
22
23
|
function expectRedemption(tokenId, revoke) {
|
|
23
24
|
const timer = setTimeout(() => {
|
|
24
25
|
unredeemed.delete(tokenId);
|
|
25
|
-
revoke().catch(() => {
|
|
26
|
+
revoke().catch((err) => getLogger().warn("OAuth: revoking an unredeemed consent key failed", {
|
|
27
|
+
tokenId,
|
|
28
|
+
message: err instanceof Error ? err.message : String(err)
|
|
29
|
+
}));
|
|
26
30
|
}, ABANDON_AFTER_MS);
|
|
27
31
|
timer.unref?.();
|
|
28
32
|
unredeemed.set(tokenId, timer);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server2.js","names":[],"sources":["../../../src/lib/server/oauth/server.ts"],"sourcesContent":["/**\n * This instance's OAuth authorization server for MCP clients. The protocol lives\n * in `@selvajs/server/oauth`; this file supplies the secret, the SSRF-guarded\n * metadata fetch and the per-IP limit the endpoints share.\n */\n\nimport { json, type RequestEvent } from '@sveltejs/kit';\nimport { hmacKeys } from '#lib/server/keys.server.js';\nimport {\n\tassertSafeRemoteDefinitionUrl,\n\tcreateComputeRateLimiter,\n\treadBodyWithCap\n} from '@selvajs/server/compute';\nimport { CODE_TTL_MS, createOAuthServer, type OAuthServer } from '@selvajs/server/oauth';\nimport { MIN_TOKEN_SECRET_LENGTH } from '@selvajs/server/tokens';\n\nconst METADATA_TIMEOUT_MS = 5_000;\nconst METADATA_MAX_BYTES = 64 * 1024;\n\n// One slot, as for `/mcp`: the origin comes from the request, so a map would grow\n// with whatever hosts a caller sends. Re-keyed on the secret, like the token codecs.\nlet cached: { origin: string; secret: string; server: OAuthServer } | null = null;\n// Outlives `cached`, so rebuilding the server for another origin can't forget a redeemed code.\nconst redeemedCodes = new Map<string, number>();\n\n// The key is minted at consent, before its code is redeemed. A client that never\n// exchanges the code would leave a live key nobody holds, so it is revoked once\n// the code can no longer be redeemed. Lost on restart: best effort.\nconst ABANDON_AFTER_MS = CODE_TTL_MS + 60_000;\nconst unredeemed = new Map<string, ReturnType<typeof setTimeout>>();\n\n/** Revoke `tokenId` with `revoke` unless its code is redeemed in time. */\nexport function expectRedemption(tokenId: string, revoke: () => Promise<void>): void {\n\tconst timer = setTimeout(() => {\n\t\tunredeemed.delete(tokenId);\n\t\trevoke().catch(()
|
|
1
|
+
{"version":3,"file":"server2.js","names":[],"sources":["../../../src/lib/server/oauth/server.ts"],"sourcesContent":["/**\n * This instance's OAuth authorization server for MCP clients. The protocol lives\n * in `@selvajs/server/oauth`; this file supplies the secret, the SSRF-guarded\n * metadata fetch and the per-IP limit the endpoints share.\n */\n\nimport { json, type RequestEvent } from '@sveltejs/kit';\nimport { hmacKeys } from '#lib/server/keys.server.js';\nimport { getLogger } from '#lib/server/providers.server.js';\nimport {\n\tassertSafeRemoteDefinitionUrl,\n\tcreateComputeRateLimiter,\n\treadBodyWithCap\n} from '@selvajs/server/compute';\nimport { CODE_TTL_MS, createOAuthServer, type OAuthServer } from '@selvajs/server/oauth';\nimport { MIN_TOKEN_SECRET_LENGTH } from '@selvajs/server/tokens';\n\nconst METADATA_TIMEOUT_MS = 5_000;\nconst METADATA_MAX_BYTES = 64 * 1024;\n\n// One slot, as for `/mcp`: the origin comes from the request, so a map would grow\n// with whatever hosts a caller sends. Re-keyed on the secret, like the token codecs.\nlet cached: { origin: string; secret: string; server: OAuthServer } | null = null;\n// Outlives `cached`, so rebuilding the server for another origin can't forget a redeemed code.\nconst redeemedCodes = new Map<string, number>();\n\n// The key is minted at consent, before its code is redeemed. A client that never\n// exchanges the code would leave a live key nobody holds, so it is revoked once\n// the code can no longer be redeemed. Lost on restart: best effort.\nconst ABANDON_AFTER_MS = CODE_TTL_MS + 60_000;\nconst unredeemed = new Map<string, ReturnType<typeof setTimeout>>();\n\n/** Revoke `tokenId` with `revoke` unless its code is redeemed in time. */\nexport function expectRedemption(tokenId: string, revoke: () => Promise<void>): void {\n\tconst timer = setTimeout(() => {\n\t\tunredeemed.delete(tokenId);\n\t\trevoke().catch((err) =>\n\t\t\tgetLogger().warn('OAuth: revoking an unredeemed consent key failed', {\n\t\t\t\ttokenId,\n\t\t\t\tmessage: err instanceof Error ? err.message : String(err)\n\t\t\t})\n\t\t);\n\t}, ABANDON_AFTER_MS);\n\ttimer.unref?.();\n\tunredeemed.set(tokenId, timer);\n}\n\nfunction onRedeemed(tokenId: string): void {\n\tclearTimeout(unredeemed.get(tokenId));\n\tunredeemed.delete(tokenId);\n}\n\n/** Whether `oauthServer` would build one, without building it. */\nfunction oauthConfigured(): boolean {\n\tconst secret = hmacKeys().current;\n\treturn Boolean(secret && secret.length >= MIN_TOKEN_SECRET_LENGTH);\n}\n\n/** Undefined without a usable SELVA_HMAC_KEY: the endpoints then answer 503. */\nexport function oauthServer(origin: string): OAuthServer | undefined {\n\tif (!oauthConfigured()) return undefined;\n\tconst { current, previous } = hmacKeys();\n\tconst secret = current!;\n\tconst cacheKey = `${secret}\\n${previous ?? ''}`;\n\tif (cached?.origin !== origin || cached.secret !== cacheKey) {\n\t\tcached = {\n\t\t\torigin,\n\t\t\tsecret: cacheKey,\n\t\t\tserver: createOAuthServer({\n\t\t\t\torigin,\n\t\t\t\tsecret,\n\t\t\t\t...(previous ? { previousSecret: previous } : {}),\n\t\t\t\tfetchClientMetadata,\n\t\t\t\tredeemedCodes,\n\t\t\t\tonRedeemed\n\t\t\t})\n\t\t};\n\t}\n\treturn cached.server;\n}\n\n/** The URL is an unknown client's, so it goes through the same guard as remote definitions. */\nasync function fetchClientMetadata(url: string): Promise<unknown> {\n\tawait assertSafeRemoteDefinitionUrl(url);\n\tconst controller = new AbortController();\n\tconst timer = setTimeout(() => controller.abort(), METADATA_TIMEOUT_MS);\n\ttry {\n\t\tconst res = await fetch(url, {\n\t\t\theaders: { Accept: 'application/json' },\n\t\t\tredirect: 'error',\n\t\t\tsignal: controller.signal\n\t\t});\n\t\tif (!res.ok) throw new Error(`HTTP ${res.status}`);\n\t\t// Counted while streaming: a body with no or a lying Content-Length must not buffer whole.\n\t\tconst bytes = await readBodyWithCap(res, METADATA_MAX_BYTES, controller);\n\t\treturn JSON.parse(new TextDecoder().decode(bytes));\n\t} finally {\n\t\tclearTimeout(timer);\n\t}\n}\n\n// Registration and token exchange take no credential, so the IP is the only key.\nconst limiter = createComputeRateLimiter({ windowMs: 60_000, maxPerWindow: 30 });\n\n/** A 429 response when the caller's IP is over the limit, else undefined. */\nexport function oauthRateLimited(event: RequestEvent): Response | undefined {\n\tconst verdict = limiter.check(`oauth:${event.getClientAddress()}`);\n\tif (verdict.allowed) return undefined;\n\treturn json(\n\t\t{ error: 'slow_down', error_description: 'Too many requests. Try again shortly.' },\n\t\t{ status: 429, headers: { 'Retry-After': String(verdict.retryAfter ?? 60) } }\n\t);\n}\n\nexport function oauthUnavailable(): Response {\n\treturn json(\n\t\t{ error: 'temporarily_unavailable', error_description: 'OAuth is not configured here.' },\n\t\t{ status: 503 }\n\t);\n}\n\n/** Discovery documents are read by browser-based clients too. */\nexport const DISCOVERY_HEADERS = {\n\t'Access-Control-Allow-Origin': '*',\n\t'Cache-Control': 'public, max-age=3600'\n};\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,IAAM,sBAAsB;AAC5B,IAAM,qBAAqB;AAI3B,IAAI,SAAyE;AAE7E,IAAM,gCAAgB,IAAI,IAAoB;AAK9C,IAAM,mBAAmB,cAAc;AACvC,IAAM,6BAAa,IAAI,IAA2C;;AAGlE,SAAgB,iBAAiB,SAAiB,QAAmC;CACpF,MAAM,QAAQ,iBAAiB;EAC9B,WAAW,OAAO,OAAO;EACzB,OAAO,CAAC,CAAC,OAAO,QACf,UAAU,CAAC,CAAC,KAAK,oDAAoD;GACpE;GACA,SAAS,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;E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G/E,SAAgB,iBAAiB,OAA2C;CAC3E,MAAM,UAAU,QAAQ,MAAM,SAAS,MAAM,iBAAiB,GAAG;CACjE,IAAI,QAAQ,SAAS,OAAO,KAAA;CAC5B,OAAO,KACN;EAAE,OAAO;EAAa,mBAAmB;CAAwC,GACjF;EAAE,QAAQ;EAAK,SAAS,EAAE,eAAe,OAAO,QAAQ,cAAc,EAAE,EAAE;CAAE,CAC7E;AACD;AAEA,SAAgB,mBAA6B;CAC5C,OAAO,KACN;EAAE,OAAO;EAA2B,mBAAmB;CAAgC,GACvF,EAAE,QAAQ,IAAI,CACf;AACD;;AAGA,IAAa,oBAAoB;CAChC,+BAA+B;CAC/B,iBAAiB;AAClB"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { I as postedServerSourcedIds, N as MAX_SOLVE_DEADLINE_MS, R as solveInputsFromSchema, T as providers, b as getSolveMetricSink, w as lazyLogger, x as getStorageProvider } from "./providers.server.js";
|
|
2
|
-
import {
|
|
2
|
+
import { D as ApiError, E as scoped, M as toErrorBody, O as ApiErrorCode, d as requireCanEditDefinition, h as requireCanSolve, j as isApiError } from "./access.js";
|
|
3
3
|
import { t as hmacKeys } from "./keys.server.js";
|
|
4
4
|
import { A as rateLimitedResponse, D as chargeApiRateLimit, M as withRateLimitHeaders, N as assertScope } from "./api.js";
|
|
5
|
+
import { n as renderThrown } from "./logging.js";
|
|
6
|
+
import { d as ErrorCodes, u as ComputeError } from "./grasshopper.js";
|
|
7
|
+
import { s as fetchSchemaFromCompute, t as ComputeServerUnconfiguredError } from "./errors.js";
|
|
5
8
|
import { t as createRemoteDefinitionFetcher } from "./remote-definition.js";
|
|
6
|
-
import { f as ComputeServerUnconfiguredError, o as fetchSchemaFromCompute } from "./schema-extraction.js";
|
|
7
9
|
import "./compute.js";
|
|
8
|
-
import { n as renderThrown } from "./definitions.js";
|
|
9
|
-
import { d as ErrorCodes, u as ComputeError } from "./grasshopper.js";
|
|
10
10
|
import { t as apiError } from "./api-errors.js";
|
|
11
11
|
import "./access2.server.js";
|
|
12
12
|
import { S as REMOTE_DEFINITION_MAX_BYTES, b as REMOTE_DEFINITION_CACHE_TTL_MS, n as COMPUTE_DEBUG_VERBOSE, s as engine, t as COMPUTE_DEBUG, x as REMOTE_DEFINITION_FETCH_TIMEOUT_MS } from "./engine.server.js";
|
|
@@ -291,6 +291,7 @@ async function runSolve(params) {
|
|
|
291
291
|
if (outcome.kind === "timeout") recordMetric("timeout", { durationMs: outcome.durationMs });
|
|
292
292
|
else if (outcome.kind === "client_abort") recordMetric("client_abort", { durationMs: outcome.durationMs });
|
|
293
293
|
else if (outcome.kind === "too_large") recordMetric("too_large");
|
|
294
|
+
else if (outcome.kind === "request_too_large") recordMetric("request_too_large", { durationMs: outcome.durationMs });
|
|
294
295
|
else if (outcome.kind === "shed") recordMetric("shed", { durationMs: outcome.durationMs });
|
|
295
296
|
else if (outcome.kind === "compute_error") recordMetric("compute_error", { durationMs: outcome.durationMs });
|
|
296
297
|
else if (outcome.kind === "ok") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solve.server.js","names":[],"sources":["../../../src/lib/server/compute/sessionId.server.ts","../../../src/lib/server/compute/errorLogFields.ts","../../../src/lib/server/compute/remoteDefinition.server.ts","../../../src/lib/server/compute/solve.server.ts"],"sourcesContent":["import { createHmac } from 'node:crypto';\nimport { hmacKeys } from '#lib/server/keys.server.js';\nimport type { SolveAccess } from '#lib/server/compute/solve.server.js';\n\n/**\n * Share links have no caller identity, and a remote URL (no `guid`) is caller-chosen, so varying\n * its query string would mint ids: neither gets one, and both route as if compute had no sessions.\n */\nexport function solveSessionId(access: SolveAccess, guid: string | null): string | undefined {\n\tif (access.kind !== 'user' || !access.ctx.userId || !guid) return undefined;\n\treturn computeSessionId(access.ctx.userId, guid);\n}\n\n/**\n * The `X-Session-Id` for one user's solves of one definition: the compute fork routes them back\n * to the child holding that user's warm document. Derived rather than stored, so every Selva\n * instance computes the same id with no shared state, and the browser can't mint ids to fill\n * compute's claim cap. Keyed, so a compute operator can't recover the user id from it.\n *\n * Undefined without `SELVA_HMAC_KEY`: a routing hint never fails a solve. Rotating the key moves\n * every session to a new id, so each solves cold once.\n */\nexport function computeSessionId(userId: string, definitionKey: string): string | undefined {\n\tconst key = hmacKeys().current;\n\tif (!key) return undefined;\n\treturn createHmac('sha256', key)\n\t\t.update(`compute-session\\0${userId}\\0${definitionKey}`)\n\t\t.digest('hex')\n\t\t.slice(0, 32);\n}\n","import { ComputeError } from '@selvajs/compute/core';\n\n/**\n * Log fields for a failed solve. Compute's raw error body can quote what was solved, and erasure\n * can't reach a log line, so it goes out only when an operator asked for raw bodies. The request id\n * ties the line to the server's own logs.\n */\nexport function computeErrorLogFields(\n\terr: unknown,\n\tincludeBody: boolean\n): Record<string, string | number> {\n\tif (!(err instanceof ComputeError)) return {};\n\tconst { requestId, responseBody } = err.context ?? {};\n\treturn {\n\t\t...(typeof requestId === 'string' && { computeRequestId: requestId }),\n\t\t...(typeof responseBody === 'string' && {\n\t\t\tcomputeBodyChars: responseBody.length,\n\t\t\t...(includeBody && { computeResponseBody: responseBody })\n\t\t})\n\t};\n}\n","/**\n * App-wide instance of the remote-definition fetcher (SSRF guard, size cap,\n * deadline, TTL cache all live in `@selvajs/server`'s `createRemoteDefinitionFetcher`).\n */\n\nimport { createRemoteDefinitionFetcher } from '@selvajs/server/compute';\nimport {\n\tREMOTE_DEFINITION_MAX_BYTES,\n\tREMOTE_DEFINITION_FETCH_TIMEOUT_MS,\n\tREMOTE_DEFINITION_CACHE_TTL_MS\n} from '#lib/server/computeLimits.js';\n// Module-scope init runs before the root logger is fully swapped in, so this\n// needs the forwarding logger, not a snapshot that would pin the boot placeholder.\nimport { lazyLogger } from '#lib/server/providers.server.js';\n\nconst fetcher = createRemoteDefinitionFetcher({\n\tmaxBytes: REMOTE_DEFINITION_MAX_BYTES,\n\tfetchTimeoutMs: REMOTE_DEFINITION_FETCH_TIMEOUT_MS,\n\tcacheTtlMs: REMOTE_DEFINITION_CACHE_TTL_MS,\n\tnow: () => Date.now(),\n\tlogger: lazyLogger\n});\n\n/** Fetch (or return cached) remote `.gh` bytes. Throws on unsafe host / oversized / timeout. */\nexport function loadRemoteDefinition(url: string): Promise<Uint8Array> {\n\treturn fetcher.load(url);\n}\n","/**\n * The body-independent core of a solve request, shared by `POST /api/v1/compute`\n * (share-token and remote-URL capable) and `POST /api/v1/definitions/{guid}/solve`\n * (tenant-scoped, cookie or PAT).\n *\n * **Share-token resolution stays outside this module, in the route.** The caller\n * hands in an already-decided `SolveAccess`; the definition-addressed route only\n * ever constructs the `user` variant, so it cannot inherit the anonymous branch\n * by accident. Adding a token lookup here would silently give it one.\n *\n * What lives here: rate limiting, definition/version resolution, access checks,\n * compute-server routing, schema backfill, the engine call, metric recording, the\n * debug breakdown. What stays in a route: parsing its own body shape and deciding\n * who the caller is.\n */\n\nimport { apiError, ApiErrorCode } from '#lib/server/api-errors.js';\nimport {\n\tApiError,\n\tassertScope,\n\tchargeApiRateLimit,\n\tisApiError,\n\trateLimitedResponse,\n\ttoErrorBody,\n\twithRateLimitHeaders\n} from '@selvajs/server/api';\nimport { isHttpError } from '@sveltejs/kit';\nimport { ComputeError, ErrorCodes } from '@selvajs/compute/core';\nimport type { SolveMode } from '@selvajs/compute/grasshopper';\nimport type { ComputeServerConfig, RequestContext, SolveFailureKind } from '@selvajs/platform';\nimport { ComputeServerUnconfiguredError } from '@selvajs/server/compute';\nimport { serverResolver } from './serverResolver.server';\nimport { engine, COMPUTE_DEBUG, COMPUTE_DEBUG_VERBOSE } from '#lib/server/compute/engine.server.js';\nimport { solveSessionId } from '#lib/server/compute/sessionId.server.js';\nimport { computeErrorLogFields } from '#lib/server/compute/errorLogFields.js';\nimport { loadRemoteDefinition } from '#lib/server/compute/remoteDefinition.server.js';\nimport {\n\tpostedServerSourcedIds,\n\tsolveInputsFromSchema,\n\ttype ByteCacheRef,\n\ttype SolveDefinition,\n\ttype SolveEnvelope,\n\ttype SolveInput\n} from '@selvajs/solve/server';\nimport type { UISchema } from '@selvajs/schemas';\nimport { apiRateLimiter, checkComputeRateLimit } from '#lib/server/computeRateLimit.server.js';\nimport { getStorageProvider, getSolveMetricSink, providers } from '#lib/server/providers.server.js';\nimport { requireCanSolve, requireCanEditDefinition, scoped } from '#lib/server/access.server.js';\nimport { fetchSchemaFromCompute } from '@selvajs/server/definitions';\nimport { renderThrown } from '@selvajs/server/logging';\nimport type { ShareLink } from '@selvajs/platform';\nimport { MAX_SOLVE_DEADLINE_MS } from '@selvajs/solve/server';\nimport {\n\tbindLiveSolve,\n\tliveOwnerKey,\n\tsolveEndedKind\n} from '#lib/server/solveEvents/liveSolve.server.js';\n\nexport type SolveChannel = 'live' | 'draft';\n\n/**\n * Who is solving, and under whose authority.\n *\n * `user` — a logged-in caller; the per-definition access rules run.\n * `share` — a share-link token; the token already encodes the grant, so the\n * rules are skipped and the link's solve cap is charged instead.\n */\nexport type SolveAccess =\n\t| { kind: 'user'; ctx: RequestContext; rateLimitKey: string }\n\t| { kind: 'share'; ctx: RequestContext; link: ShareLink; rateLimitKey: string };\n\nexport interface SolveParams {\n\taccess: SolveAccess;\n\tdefinitionUrl: string;\n\t/**\n\t * The request body's inputs, read for a remote URL only. A stored definition's come from its\n\t * version's schema: a caller, a share-link visitor included, must not choose its ids, types or\n\t * bounds.\n\t */\n\tinputs?: unknown;\n\tvalues: Record<string, unknown>;\n\tchannel: SolveChannel;\n\t/** Explicit version pick; editor-only, never share-token accessible. */\n\tversionId: string | null;\n\trequest: Request;\n\t/** Typed loosely: two route trees with different generated `$types` both call this. */\n\tlocals: App.Locals;\n\t/** `performance.now()` at the very start of the request, before body parse. */\n\tloadStart: number;\n\t/** Prep sub-phase timings recorded before this call (body parse, token). */\n\tprepMarks: [string, number][];\n\t/**\n\t * The caller's live-event stream (`GET /api/v1/solve-events?streamId=`). When it is open\n\t * and theirs, this solve is bound to it: the server emits start/end, and the compute\n\t * request carries a callback so the definition can emit mid-solve. Ignored otherwise.\n\t */\n\tstreamId?: string | null;\n\t/** See `SolveBodySchema.mode`. */\n\tsolveMode?: SolveMode;\n\t/**\n\t * Report an access refusal as 404 instead of 403.\n\t *\n\t * The definition-addressed route needs this: a guid is guessable, so\n\t * 403-vs-404 there tells a caller whether a definition they cannot reach\n\t * exists. `/api/v1/compute` leaves it off — its callers navigated to the\n\t * definition, and a 403 is the more useful answer.\n\t */\n\tconcealAccessFailure?: boolean;\n\t/**\n\t * The route already charged the key's request bucket, ahead of any idempotent\n\t * replay that would skip this function, so it must not be charged twice.\n\t */\n\ttokenCharged?: boolean;\n}\n\nfunction readRemoteInputs(inputs: unknown): SolveInput[] {\n\tconst valid =\n\t\tArray.isArray(inputs) &&\n\t\tinputs.every(\n\t\t\t(input) =>\n\t\t\t\ttypeof input === 'object' &&\n\t\t\t\tinput !== null &&\n\t\t\t\ttypeof (input as SolveInput).id === 'string' &&\n\t\t\t\ttypeof (input as SolveInput).nickname === 'string'\n\t\t);\n\tif (!valid) {\n\t\tapiError(\n\t\t\t400,\n\t\t\tApiErrorCode.VALIDATION_FAILED,\n\t\t\t'A remote definitionUrl needs inputs: a list of { id, nickname, paramType }.'\n\t\t);\n\t}\n\treturn inputs as SolveInput[];\n}\n\nfunction admittedSolveInputs(\n\tschema: UISchema | undefined,\n\tinputs: unknown,\n\tvalues: Record<string, unknown>\n): SolveInput[] {\n\tconst solveInputs = schema ? solveInputsFromSchema(schema) : readRemoteInputs(inputs);\n\tconst serverOnly = postedServerSourcedIds(solveInputs, values);\n\tif (serverOnly.length > 0) {\n\t\tapiError(\n\t\t\t400,\n\t\t\tApiErrorCode.VALIDATION_FAILED,\n\t\t\t`These inputs are filled on the server and may not be posted in values: ${serverOnly.join(', ')}.`\n\t\t);\n\t}\n\treturn solveInputs;\n}\n\n/**\n * Run a solve and return the HTTP response.\n *\n * Throws `HttpError` (via `apiError`) for every refusal, and lets engine/network\n * failures propagate for the caller's outer catch to map — the two routes share\n * that mapping through `mapSolveError`.\n */\nexport async function runSolve(params: SolveParams): Promise<Response> {\n\tconst {\n\t\taccess,\n\t\tdefinitionUrl,\n\t\tinputs,\n\t\tvalues,\n\t\tchannel,\n\t\tversionId: explicitVersionId,\n\t\trequest,\n\t\tlocals,\n\t\tloadStart,\n\t\tprepMarks,\n\t\tconcealAccessFailure = false,\n\t\tstreamId = null,\n\t\tsolveMode = 'full',\n\t\ttokenCharged = false\n\t} = params;\n\tconst storage = getStorageProvider();\n\tconst sharedAccess = access.kind === 'share' ? access : null;\n\tconst solveCtx = access.ctx;\n\n\tlet prevMark = performance.now();\n\tconst mark = (label: string) => {\n\t\tprepMarks.push([label, performance.now() - prevMark]);\n\t\tprevMark = performance.now();\n\t};\n\n\t// Local definitions solve by reference: a byte-cache `DefinitionRef` whose\n\t// bytes the scheduler loads ONLY when an upload is unavoidable (pointer-known\n\t// re-solves move zero bytes). Remote-URL definitions carry raw fetched bytes.\n\tlet definitionSource: SolveDefinition;\n\t// `.load()` materializes bytes for schema backfill; `.outcome` drives the\n\t// `def_bytes` Server-Timing verdict. Null for remote-URL solves.\n\tlet localDefinitionRef: ByteCacheRef | null = null;\n\tlet localVersionForBackfill: { id: string; hasSchema: boolean } | null = null;\n\tlet storedSchema: UISchema | undefined;\n\t// BYO compute routing per org; null for remote definitions.\n\tlet solveOrgId: string | null = null;\n\tlet definitionPin: string | null = null;\n\t// Started once the project is known; null for remote definitions.\n\tlet pendingServer: Promise<ComputeServerConfig> | null = null;\n\t// Solve-metric attribution; null for remote-URL solves.\n\tlet metricDefinitionId: string | null = null;\n\tlet metricVersionId: string | null = null;\n\n\tconst isLocal = definitionUrl.startsWith('local:');\n\tconst guid = isLocal ? definitionUrl.substring(6) : null;\n\n\t// One row per solve attempt, including attempts rejected before the solve\n\t// runs — reads the attribution `let`s at call time, so definition/version\n\t// are null when a record fires pre-resolution. Fire-and-forget: the sink\n\t// never throws (ISolveMetricSink contract).\n\tconst recordMetric = (\n\t\tfailureKind: SolveFailureKind,\n\t\textra: { durationMs?: number; errorCount?: number; warningCount?: number } = {}\n\t) => {\n\t\tgetSolveMetricSink()\n\t\t\t.record(solveCtx, {\n\t\t\t\tdefinitionUrl,\n\t\t\t\tdefinitionId: metricDefinitionId,\n\t\t\t\tversionId: metricVersionId,\n\t\t\t\tchannel,\n\t\t\t\torgId: solveOrgId,\n\t\t\t\tdurationMs: extra.durationMs ?? 0,\n\t\t\t\tok: failureKind === 'ok',\n\t\t\t\tfailureKind,\n\t\t\t\terrorCount: extra.errorCount ?? 0,\n\t\t\t\twarningCount: extra.warningCount ?? 0\n\t\t\t})\n\t\t\t// Sinks are contracted not to throw, but nothing enforces it — a bad sink\n\t\t\t// must surface as a log line, not an unhandled rejection.\n\t\t\t.catch((err) =>\n\t\t\t\tlocals.log.error('Solve-metric record failed', {\n\t\t\t\t\tcomponent: 'API/Compute',\n\t\t\t\t\terr: renderThrown(err)\n\t\t\t\t})\n\t\t\t);\n\t};\n\n\t// Both limits run before DB reads so throttled callers don't burn quota. A\n\t// token pays its own request bucket and its owner's compute bucket, so ten\n\t// keys of one user never buy ten times the compute.\n\tconst tokenVerdict = tokenCharged\n\t\t? undefined\n\t\t: await chargeApiRateLimit(access.ctx, apiRateLimiter);\n\tif (tokenVerdict && !tokenVerdict.allowed) {\n\t\trecordMetric('rate_limited');\n\t\treturn rateLimitedResponse(tokenVerdict);\n\t}\n\tconst rateLimit = checkComputeRateLimit(access.rateLimitKey);\n\tif (!rateLimit.allowed) {\n\t\trecordMetric('rate_limited');\n\t\tconst retryAfter = String(rateLimit.retryAfter ?? 1);\n\t\tconst err = new ApiError(\n\t\t\t429,\n\t\t\tApiErrorCode.RATE_LIMITED,\n\t\t\t`Too many compute requests. Retry in ${retryAfter}s.`,\n\t\t\tundefined,\n\t\t\t{ retryAfter }\n\t\t);\n\t\treturn withRateLimitHeaders(\n\t\t\tnew Response(JSON.stringify(toErrorBody(err)), {\n\t\t\t\tstatus: 429,\n\t\t\t\theaders: { 'Content-Type': 'application/json', 'Retry-After': retryAfter }\n\t\t\t}),\n\t\t\ttokenVerdict\n\t\t);\n\t}\n\n\tif (isLocal && guid) {\n\t\tlet record;\n\t\ttry {\n\t\t\trecord = await providers.data.definitions.get(solveCtx, guid);\n\t\t} catch (err) {\n\t\t\tlocals.log.error('Failed to load local definition', {\n\t\t\t\tcomponent: 'API/Compute',\n\t\t\t\tguid,\n\t\t\t\terr: renderThrown(err)\n\t\t\t});\n\t\t\tapiError(404, ApiErrorCode.NOT_FOUND, `Definition '${guid}' not found`);\n\t\t}\n\t\tif (!record) apiError(404, ApiErrorCode.NOT_FOUND, `Definition '${guid}' not found`);\n\t\tmark('defRecord');\n\n\t\t// The version and the server need only the record and its project, so they are read\n\t\t// while access is checked, and awaited after it in their old order: a caller refused\n\t\t// access learns nothing from a missing version or server.\n\t\tconst versionId =\n\t\t\texplicitVersionId ?? (channel === 'live' ? record.liveVersionId : record.draftVersionId);\n\t\tconst pendingVersion = versionId\n\t\t\t? providers.data.definitions.getVersion(solveCtx, versionId)\n\t\t\t: null;\n\t\tpendingVersion?.catch(() => {});\n\t\tconst project = await providers.data.projects.getProject(solveCtx, record.projectId);\n\t\tsolveOrgId = project?.orgId ?? null;\n\t\tdefinitionPin = record.computeServerId ?? null;\n\t\tpendingServer = serverResolver.resolve(\n\t\t\tsolveCtx,\n\t\t\tsolveOrgId,\n\t\t\tlocals.providers.data.computeServer,\n\t\t\t{ definitionPin }\n\t\t);\n\t\tpendingServer.catch(() => {});\n\t\tmark('project');\n\n\t\tif (!sharedAccess) {\n\t\t\ttry {\n\t\t\t\tassertScope(access.ctx, 'solve', { projectId: record.projectId, definitionId: guid });\n\t\t\t\tif (channel === 'draft' || explicitVersionId) {\n\t\t\t\t\tawait requireCanEditDefinition(scoped(locals), record.projectId, guid, {\n\t\t\t\t\t\tproject,\n\t\t\t\t\t\tdefinition: record\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tawait requireCanSolve(scoped(locals), record.projectId, project ?? undefined);\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// The guards raise `ApiError`, but `requireCanEditDefinition` may still\n\t\t\t\t// surface an `HttpError` — matching only one shape would let the\n\t\t\t\t// other's 403 leak through, confirming a guid the caller can't reach.\n\t\t\t\tconst status = isApiError(err) ? err.status : isHttpError(err) ? err.status : undefined;\n\t\t\t\tif (concealAccessFailure && status === 403) {\n\t\t\t\t\tapiError(404, ApiErrorCode.NOT_FOUND, `Definition '${guid}' not found`);\n\t\t\t\t}\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t}\n\t\tmark('access');\n\n\t\tif (!versionId || !pendingVersion) {\n\t\t\tapiError(404, ApiErrorCode.NOT_FOUND, `Definition '${guid}' has no ${channel} version yet`);\n\t\t}\n\t\tconst version = await pendingVersion;\n\t\tif (!version || version.definitionId !== guid) {\n\t\t\tapiError(404, ApiErrorCode.NOT_FOUND, `Definition '${guid}' version is missing`);\n\t\t}\n\t\tlocalVersionForBackfill = { id: version.id, hasSchema: version.schema !== undefined };\n\t\tstoredSchema = version.schema;\n\t\tmetricDefinitionId = guid;\n\t\tmetricVersionId = version.id;\n\t\tmark('version');\n\n\t\t// Keyed on the immutable version id, NEVER the fileKey — a\n\t\t// delete-latest-then-reupload can reuse a fileKey for different content.\n\t\t// A missing blob surfaces at solve time (compute_error → 500) rather than\n\t\t// an upfront 404, since it's no longer read eagerly here.\n\t\tlocalDefinitionRef = engine.definitionRef(version.id, async () => {\n\t\t\tconst bytes = await storage.get(version.fileKey);\n\t\t\tif (!bytes) throw new Error(`Version blob missing: ${version.fileKey}`);\n\t\t\treturn bytes;\n\t\t});\n\t\tdefinitionSource = localDefinitionRef;\n\t\tmark('blob');\n\t} else {\n\t\t// A remote URL names no project, so only an org-wide key may solve it.\n\t\tassertScope(access.ctx, 'solve');\n\t\treadRemoteInputs(inputs);\n\t\ttry {\n\t\t\tdefinitionSource = await loadRemoteDefinition(definitionUrl);\n\t\t} catch (err) {\n\t\t\tlocals.log.error('Failed to fetch remote definition', {\n\t\t\t\tcomponent: 'API/Compute',\n\t\t\t\tdefinitionUrl,\n\t\t\t\terr: renderThrown(err)\n\t\t\t});\n\t\t\tapiError(\n\t\t\t\t400,\n\t\t\t\tApiErrorCode.VALIDATION_FAILED,\n\t\t\t\t`Failed to load definition: ${err instanceof Error ? err.message : String(err)}`\n\t\t\t);\n\t\t}\n\t\tmark('remoteDef');\n\t}\n\n\t// Everything above (auth, DB, blob/remote fetch) is the \"load\" phase; tree\n\t// build and solve are measured inside the pipeline.\n\tconst defLoadMs = performance.now() - loadStart;\n\n\t// Checked before the share cap, so a request refused for its values spends no\n\t// solve. A version without a stored schema is checked after the backfill below.\n\tlet solveInputs =\n\t\tstoredSchema || !isLocal ? admittedSolveInputs(storedSchema, inputs, values) : null;\n\n\t// Atomic check-and-increment; runs before solve to avoid wasting compute.\n\tif (sharedAccess) {\n\t\tconst next = await providers.data.shareLinks.tryIncrementSolveCount(\n\t\t\tsolveCtx,\n\t\t\tsharedAccess.link.id\n\t\t);\n\t\tif (next === null) {\n\t\t\trecordMetric('share_cap');\n\t\t\tapiError(429, ApiErrorCode.RATE_LIMITED, 'Share link solve cap reached.');\n\t\t}\n\t\tmark('shareCap');\n\t}\n\n\tconst serverConfig = await (pendingServer ??\n\t\tserverResolver.resolve(solveCtx, solveOrgId, locals.providers.data.computeServer, {\n\t\t\tdefinitionPin\n\t\t}));\n\tmark('resolveServer');\n\n\t// BRIDGE: remove ~2026-09 — lazy backfill for versions uploaded before schema\n\t// caching existed. Best-effort. Removing it: delete this block, tighten\n\t// `DefinitionVersion.schema` to required in platform types + Zod, and drop the\n\t// live-fetch fallback in loadForRender.server.ts.\n\tif (localVersionForBackfill && !localVersionForBackfill.hasSchema && localDefinitionRef) {\n\t\tconst versionId = localVersionForBackfill.id;\n\t\ttry {\n\t\t\t// Warms the byte-cache entry the upcoming solve's `load()` would hit anyway.\n\t\t\tconst bytes = await localDefinitionRef.load();\n\t\t\tstoredSchema = await fetchSchemaFromCompute(bytes, serverConfig);\n\t\t\tawait providers.data.definitions.setVersionSchema(solveCtx, versionId, storedSchema);\n\t\t} catch (err) {\n\t\t\tlocals.log.warn('Schema backfill failed', {\n\t\t\t\tcomponent: 'API/Compute',\n\t\t\t\tversionId,\n\t\t\t\terr: renderThrown(err)\n\t\t\t});\n\t\t}\n\t\t// Backfill calls the compute server — seconds when it fires. If this shows\n\t\t// up repeatedly for the same definition, setVersionSchema isn't sticking.\n\t\tmark('schemaBackfill');\n\t}\n\n\tif (isLocal && !storedSchema) {\n\t\tapiError(\n\t\t\t503,\n\t\t\tApiErrorCode.COMPUTE_UNAVAILABLE,\n\t\t\t\"This version's inputs could not be read. Retry shortly.\"\n\t\t);\n\t}\n\tsolveInputs ??= admittedSolveInputs(storedSchema, inputs, values);\n\n\t// `SolveEngine.solve` owns warm-client lookup, input-tree build, single-flight\n\t// coalescing (a coalesced solve aborts only when its last caller leaves), and\n\t// per-caller encoding. Remote-URL solves have no version id, so the URL stands\n\t// in as coalesce-key identity (`definitionKey`); local solves already carry\n\t// that identity on `localDefinitionRef.key`.\n\tconst live = bindLiveSolve({\n\t\townerKey: liveOwnerKey(access.kind === 'user' ? access.ctx.userId : null),\n\t\tstreamId,\n\t\trequest,\n\t\t// Outlives any server's deadline by a margin, so a callback racing the response is not\n\t\t// refused. Minted before the warm client that knows this server's deadline.\n\t\ttokenTtlMs: MAX_SOLVE_DEADLINE_MS + 60_000\n\t});\n\n\tlet outcome: Awaited<ReturnType<typeof engine.solve>> | undefined;\n\ttry {\n\t\toutcome = await engine.solve({\n\t\t\tserver: serverConfig,\n\t\t\tdefinitionSource,\n\t\t\tdefinitionKey: isLocal ? undefined : definitionUrl,\n\t\t\tinputs: solveInputs,\n\t\t\tvalues,\n\t\t\tsignal: request.signal,\n\t\t\tacceptEncoding: request.headers.get('accept-encoding') ?? '',\n\t\t\tdefinitionGuid: guid ?? undefined,\n\t\t\tloadStartMs: loadStart,\n\t\t\tdefLoadMs,\n\t\t\tprepMarks,\n\t\t\tselvaEvents: live.selvaEvents,\n\t\t\tsessionId: solveSessionId(access, guid),\n\t\t\tsolveMode\n\t\t});\n\t} finally {\n\t\tlive.end(outcome ? solveEndedKind(outcome) : 'error');\n\t}\n\tmark('solve');\n\n\t// Metric recording is app policy — the engine only maps outcome to HTTP.\n\t// These branches don't return; `engine.toWebResponse` below does.\n\tif (outcome.kind === 'timeout') {\n\t\trecordMetric('timeout', { durationMs: outcome.durationMs });\n\t} else if (outcome.kind === 'client_abort') {\n\t\trecordMetric('client_abort', { durationMs: outcome.durationMs });\n\t} else if (outcome.kind === 'too_large') {\n\t\trecordMetric('too_large');\n\t} else if (outcome.kind === 'shed') {\n\t\trecordMetric('shed', { durationMs: outcome.durationMs });\n\t} else if (outcome.kind === 'compute_error') {\n\t\trecordMetric('compute_error', { durationMs: outcome.durationMs });\n\t} else if (outcome.kind === 'ok') {\n\t\trecordMetric('ok', {\n\t\t\tdurationMs: outcome.solveMs,\n\t\t\terrorCount: outcome.errorCount,\n\t\t\twarningCount: outcome.warningCount\n\t\t});\n\t\t// Best-effort: the solve already succeeded, so a failed counter write\n\t\t// must not turn into a request error. Local definitions only — remote\n\t\t// URLs have no record to bump.\n\t\tif (metricDefinitionId) {\n\t\t\tproviders.data.definitions.incrementSolveCount(solveCtx, metricDefinitionId).catch((err) =>\n\t\t\t\tlocals.log.warn('solveCount increment failed', {\n\t\t\t\t\tcomponent: 'API/Compute',\n\t\t\t\t\tdefinitionId: metricDefinitionId,\n\t\t\t\t\terr: renderThrown(err)\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\n\t\tif (COMPUTE_DEBUG) logDebugBreakdown(locals, request, outcome, defLoadMs, prepMarks);\n\t}\n\n\t// Builds the Response itself (incl. `Retry-After` on a rejected `shed`,\n\t// which `apiError` cannot set) and still throws `compute_error` through to\n\t// the caller's outer catch.\n\treturn withRateLimitHeaders(engine.toWebResponse(outcome), tokenVerdict);\n}\n\n/**\n * Both solve routes share this so they cannot drift on which failures read as\n * \"compute is down\" (503) versus a server bug (500).\n */\nexport function mapSolveError(err: unknown, locals: App.Locals): never {\n\tif (isHttpError(err)) throw err;\n\t// A guard's own refusal, not a failed solve — converted rather than\n\t// re-thrown. These routes return their Response directly instead of going\n\t// through `mount`, so an `ApiError` escaping here would reach SvelteKit,\n\t// which gives anything that isn't an `HttpError` a 500, turning a working\n\t// permission check into an operator error page.\n\tif (isApiError(err)) {\n\t\tapiError(err.status, err.code, err.message, err.fields, err.details);\n\t}\n\n\tif (err instanceof ComputeServerUnconfiguredError) {\n\t\tapiError(503, ApiErrorCode.COMPUTE_UNAVAILABLE, err.message);\n\t}\n\n\tconst message = err instanceof Error ? err.message : 'Unknown error';\n\tlocals.log.error('Solve request failed', {\n\t\tcomponent: 'API/Compute',\n\t\terr: renderThrown(err),\n\t\t...computeErrorLogFields(err, COMPUTE_DEBUG_VERBOSE)\n\t});\n\n\t// The compute transport classifies its failures — map the classes the caller\n\t// can act on. Unreachable/credentials/saturation are operator problems (503),\n\t// a deadline is 504; only a genuine solve failure stays 500.\n\tif (err instanceof ComputeError) {\n\t\tif (err.code === ErrorCodes.NETWORK_ERROR || err.code === ErrorCodes.CORS_ERROR) {\n\t\t\tapiError(503, ApiErrorCode.COMPUTE_UNAVAILABLE, 'Compute server is unreachable');\n\t\t}\n\t\tif (err.code === ErrorCodes.AUTH_ERROR) {\n\t\t\tapiError(\n\t\t\t\t503,\n\t\t\t\tApiErrorCode.COMPUTE_UNAVAILABLE,\n\t\t\t\t\"Compute server rejected this deployment's credentials — check the compute API key configuration.\"\n\t\t\t);\n\t\t}\n\t\tif (err.code === ErrorCodes.RATE_LIMIT) {\n\t\t\tapiError(\n\t\t\t\t503,\n\t\t\t\tApiErrorCode.COMPUTE_UNAVAILABLE,\n\t\t\t\t'Compute server is rate-limiting requests. Retry shortly.'\n\t\t\t);\n\t\t}\n\t\tif (err.code === ErrorCodes.TIMEOUT_ERROR) {\n\t\t\tapiError(\n\t\t\t\t504,\n\t\t\t\tApiErrorCode.COMPUTE_UNAVAILABLE,\n\t\t\t\t'Compute server timed out running the solve.'\n\t\t\t);\n\t\t}\n\t}\n\n\t// A transport-layer fetch failure means the compute server is unreachable,\n\t// not an internal error. (Raw TypeError only from fetches outside the compute\n\t// transport — the transport wraps its own into ComputeError NETWORK_ERROR.)\n\tif (err instanceof TypeError && message === 'fetch failed') {\n\t\tapiError(503, ApiErrorCode.COMPUTE_UNAVAILABLE, 'Compute server is unreachable');\n\t}\n\n\tapiError(500, ApiErrorCode.INTERNAL, message);\n}\n\n/**\n * DEBUG (SELVA_FLAG_COMPUTE_DEBUG): the server-side overhead the solve metric's\n * `durationMs` doesn't capture. `load` = auth + DB + definition fetch; `tree` =\n * input tree build; `serialize` = JSON.stringify of the result.\n */\nfunction logDebugBreakdown(\n\tlocals: App.Locals,\n\trequest: Request,\n\toutcome: { envelope: SolveEnvelope },\n\tdefLoadMs: number,\n\tprepMarks: [string, number][]\n): void {\n\tconst { metrics } = outcome.envelope;\n\tlocals.log.debug('Solve server-side phase breakdown', {\n\t\tcomponent: 'Compute/server',\n\t\tloadMs: Math.round(defLoadMs),\n\t\ttreeBuildMs: Math.round(metrics.treeBuildMs),\n\t\tsolveMs: Math.round(metrics.solveMs),\n\t\tserializeMs: Math.round(metrics.serializeMs),\n\t\tgzipMs: Math.round(metrics.gzipMs),\n\t\tserverTotalMs: Math.round(metrics.serverTotalMs),\n\t\tserializedBytes: metrics.serializedBytes\n\t});\n\tif (metrics.compressedBytes !== null) {\n\t\tlocals.log.debug('Response gzipped', {\n\t\t\tcomponent: 'Compute/server',\n\t\t\tserializedBytes: metrics.serializedBytes,\n\t\t\tcompressedBytes: metrics.compressedBytes,\n\t\t\tratio: Number((metrics.serializedBytes / metrics.compressedBytes).toFixed(1))\n\t\t});\n\t} else {\n\t\t// If this fires for browser requests, a proxy in front is stripping\n\t\t// Accept-Encoding, making compression impossible end-to-end.\n\t\tconst acceptEncoding = request.headers.get('accept-encoding') ?? '';\n\t\tlocals.log.debug('Compression skipped', {\n\t\t\tcomponent: 'Compute/server',\n\t\t\tacceptEncoding,\n\t\t\thasAcceptEncoding: acceptEncoding !== ''\n\t\t});\n\t}\n\t// Names the step a `load` (or pre-solve) spike hides in.\n\tlocals.log.debug('Prep breakdown', {\n\t\tcomponent: 'Compute/server',\n\t\t...Object.fromEntries(prepMarks.map(([label, ms]) => [`p_${label}Ms`, Math.round(ms)]))\n\t});\n\t// The only place evictions surface — per-request Server-Timing only carries\n\t// hit/miss verdicts.\n\tconst db = engine.stats().definitionBytes;\n\tlocals.log.debug('Definition byte-cache counters', {\n\t\tcomponent: 'Compute/def-bytes',\n\t\thits: db.hits,\n\t\tmisses: db.misses,\n\t\tevictions: db.evictions,\n\t\tentries: db.entries,\n\t\tretainedBytes: db.bytes\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAQA,SAAgB,eAAe,QAAqB,MAAyC;CAC5F,IAAI,OAAO,SAAS,UAAU,CAAC,OAAO,IAAI,UAAU,CAAC,MAAM,OAAO,KAAA;CAClE,OAAO,iBAAiB,OAAO,IAAI,QAAQ,IAAI;AAChD;;;;;;;;;;AAWA,SAAgB,iBAAiB,QAAgB,eAA2C;CAC3F,MAAM,MAAM,SAAS,CAAC,CAAC;CACvB,IAAI,CAAC,KAAK,OAAO,KAAA;CACjB,OAAO,WAAW,UAAU,GAAG,CAAC,CAC9B,OAAO,oBAAoB,OAAO,IAAI,eAAe,CAAC,CACtD,OAAO,KAAK,CAAC,CACb,MAAM,GAAG,EAAE;AACd;;;;;;;ACtBA,SAAgB,sBACf,KACA,aACkC;CAClC,IAAI,EAAE,eAAe,eAAe,OAAO,CAAC;CAC5C,MAAM,EAAE,WAAW,iBAAiB,IAAI,WAAW,CAAC;CACpD,OAAO;EACN,GAAI,OAAO,cAAc,YAAY,EAAE,kBAAkB,UAAU;EACnE,GAAI,OAAO,iBAAiB,YAAY;GACvC,kBAAkB,aAAa;GAC/B,GAAI,eAAe,EAAE,qBAAqB,aAAa;EACxD;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,QAAQ;CAC5B,OAAO,IAAI,MAAM,qCAAqC;EACrD,WAAW;EACX,QAAQ,KAAK,MAAM,SAAS;EAC5B,aAAa,KAAK,MAAM,QAAQ,WAAW;EAC3C,SAAS,KAAK,MAAM,QAAQ,OAAO;EACnC,aAAa,KAAK,MAAM,QAAQ,WAAW;EAC3C,QAAQ,KAAK,MAAM,QAAQ,MAAM;EACjC,eAAe,KAAK,MAAM,QAAQ,aAAa;EAC/C,iBAAiB,QAAQ;CAC1B,CAAC;CACD,IAAI,QAAQ,oBAAoB,MAC/B,OAAO,IAAI,MAAM,oBAAoB;EACpC,WAAW;EACX,iBAAiB,QAAQ;EACzB,iBAAiB,QAAQ;EACzB,OAAO,QAAQ,QAAQ,kBAAkB,QAAQ,gBAAA,CAAiB,QAAQ,CAAC,CAAC;CAC7E,CAAC;MACK;EAGN,MAAM,iBAAiB,QAAQ,QAAQ,IAAI,iBAAiB,KAAK;EACjE,OAAO,IAAI,MAAM,uBAAuB;GACvC,WAAW;GACX;GACA,mBAAmB,mBAAmB;EACvC,CAAC;CACF;CAEA,OAAO,IAAI,MAAM,kBAAkB;EAClC,WAAW;EACX,GAAG,OAAO,YAAY,UAAU,KAAK,CAAC,OAAO,QAAQ,CAAC,KAAK,MAAM,KAAK,KAAK,MAAM,EAAE,CAAC,CAAC,CAAC;CACvF,CAAC;CAGD,MAAM,KAAK,OAAO,MAAM,CAAC,CAAC;CAC1B,OAAO,IAAI,MAAM,kCAAkC;EAClD,WAAW;EACX,MAAM,GAAG;EACT,QAAQ,GAAG;EACX,WAAW,GAAG;EACd,SAAS,GAAG;EACZ,eAAe,GAAG;CACnB,CAAC;AACF"}
|
|
1
|
+
{"version":3,"file":"solve.server.js","names":[],"sources":["../../../src/lib/server/compute/sessionId.server.ts","../../../src/lib/server/compute/errorLogFields.ts","../../../src/lib/server/compute/remoteDefinition.server.ts","../../../src/lib/server/compute/solve.server.ts"],"sourcesContent":["import { createHmac } from 'node:crypto';\nimport { hmacKeys } from '#lib/server/keys.server.js';\nimport type { SolveAccess } from '#lib/server/compute/solve.server.js';\n\n/**\n * Share links have no caller identity, and a remote URL (no `guid`) is caller-chosen, so varying\n * its query string would mint ids: neither gets one, and both route as if compute had no sessions.\n */\nexport function solveSessionId(access: SolveAccess, guid: string | null): string | undefined {\n\tif (access.kind !== 'user' || !access.ctx.userId || !guid) return undefined;\n\treturn computeSessionId(access.ctx.userId, guid);\n}\n\n/**\n * The `X-Session-Id` for one user's solves of one definition: the compute fork routes them back\n * to the child holding that user's warm document. Derived rather than stored, so every Selva\n * instance computes the same id with no shared state, and the browser can't mint ids to fill\n * compute's claim cap. Keyed, so a compute operator can't recover the user id from it.\n *\n * Undefined without `SELVA_HMAC_KEY`: a routing hint never fails a solve. Rotating the key moves\n * every session to a new id, so each solves cold once.\n */\nexport function computeSessionId(userId: string, definitionKey: string): string | undefined {\n\tconst key = hmacKeys().current;\n\tif (!key) return undefined;\n\treturn createHmac('sha256', key)\n\t\t.update(`compute-session\\0${userId}\\0${definitionKey}`)\n\t\t.digest('hex')\n\t\t.slice(0, 32);\n}\n","import { ComputeError } from '@selvajs/compute/core';\n\n/**\n * Log fields for a failed solve. Compute's raw error body can quote what was solved, and erasure\n * can't reach a log line, so it goes out only when an operator asked for raw bodies. The request id\n * ties the line to the server's own logs.\n */\nexport function computeErrorLogFields(\n\terr: unknown,\n\tincludeBody: boolean\n): Record<string, string | number> {\n\tif (!(err instanceof ComputeError)) return {};\n\tconst { requestId, responseBody } = err.context ?? {};\n\treturn {\n\t\t...(typeof requestId === 'string' && { computeRequestId: requestId }),\n\t\t...(typeof responseBody === 'string' && {\n\t\t\tcomputeBodyChars: responseBody.length,\n\t\t\t...(includeBody && { computeResponseBody: responseBody })\n\t\t})\n\t};\n}\n","/**\n * App-wide instance of the remote-definition fetcher (SSRF guard, size cap,\n * deadline, TTL cache all live in `@selvajs/server`'s `createRemoteDefinitionFetcher`).\n */\n\nimport { createRemoteDefinitionFetcher } from '@selvajs/server/compute';\nimport {\n\tREMOTE_DEFINITION_MAX_BYTES,\n\tREMOTE_DEFINITION_FETCH_TIMEOUT_MS,\n\tREMOTE_DEFINITION_CACHE_TTL_MS\n} from '#lib/server/computeLimits.js';\n// Module-scope init runs before the root logger is fully swapped in, so this\n// needs the forwarding logger, not a snapshot that would pin the boot placeholder.\nimport { lazyLogger } from '#lib/server/providers.server.js';\n\nconst fetcher = createRemoteDefinitionFetcher({\n\tmaxBytes: REMOTE_DEFINITION_MAX_BYTES,\n\tfetchTimeoutMs: REMOTE_DEFINITION_FETCH_TIMEOUT_MS,\n\tcacheTtlMs: REMOTE_DEFINITION_CACHE_TTL_MS,\n\tnow: () => Date.now(),\n\tlogger: lazyLogger\n});\n\n/** Fetch (or return cached) remote `.gh` bytes. Throws on unsafe host / oversized / timeout. */\nexport function loadRemoteDefinition(url: string): Promise<Uint8Array> {\n\treturn fetcher.load(url);\n}\n","/**\n * The body-independent core of a solve request, shared by `POST /api/v1/compute`\n * (share-token and remote-URL capable) and `POST /api/v1/definitions/{guid}/solve`\n * (tenant-scoped, cookie or PAT).\n *\n * **Share-token resolution stays outside this module, in the route.** The caller\n * hands in an already-decided `SolveAccess`; the definition-addressed route only\n * ever constructs the `user` variant, so it cannot inherit the anonymous branch\n * by accident. Adding a token lookup here would silently give it one.\n *\n * What lives here: rate limiting, definition/version resolution, access checks,\n * compute-server routing, schema backfill, the engine call, metric recording, the\n * debug breakdown. What stays in a route: parsing its own body shape and deciding\n * who the caller is.\n */\n\nimport { apiError, ApiErrorCode } from '#lib/server/api-errors.js';\nimport {\n\tApiError,\n\tassertScope,\n\tchargeApiRateLimit,\n\tisApiError,\n\trateLimitedResponse,\n\ttoErrorBody,\n\twithRateLimitHeaders\n} from '@selvajs/server/api';\nimport { isHttpError } from '@sveltejs/kit';\nimport { ComputeError, ErrorCodes } from '@selvajs/compute/core';\nimport type { SolveMode } from '@selvajs/compute/grasshopper';\nimport type { ComputeServerConfig, RequestContext, SolveFailureKind } from '@selvajs/platform';\nimport { ComputeServerUnconfiguredError } from '@selvajs/server/compute';\nimport { serverResolver } from './serverResolver.server';\nimport { engine, COMPUTE_DEBUG, COMPUTE_DEBUG_VERBOSE } from '#lib/server/compute/engine.server.js';\nimport { solveSessionId } from '#lib/server/compute/sessionId.server.js';\nimport { computeErrorLogFields } from '#lib/server/compute/errorLogFields.js';\nimport { loadRemoteDefinition } from '#lib/server/compute/remoteDefinition.server.js';\nimport {\n\tpostedServerSourcedIds,\n\tsolveInputsFromSchema,\n\ttype ByteCacheRef,\n\ttype SolveDefinition,\n\ttype SolveEnvelope,\n\ttype SolveInput\n} from '@selvajs/solve/server';\nimport type { UISchema } from '@selvajs/schemas';\nimport { apiRateLimiter, checkComputeRateLimit } from '#lib/server/computeRateLimit.server.js';\nimport { getStorageProvider, getSolveMetricSink, providers } from '#lib/server/providers.server.js';\nimport { requireCanSolve, requireCanEditDefinition, scoped } from '#lib/server/access.server.js';\nimport { fetchSchemaFromCompute } from '@selvajs/server/definitions';\nimport { renderThrown } from '@selvajs/server/logging';\nimport type { ShareLink } from '@selvajs/platform';\nimport { MAX_SOLVE_DEADLINE_MS } from '@selvajs/solve/server';\nimport {\n\tbindLiveSolve,\n\tliveOwnerKey,\n\tsolveEndedKind\n} from '#lib/server/solveEvents/liveSolve.server.js';\n\nexport type SolveChannel = 'live' | 'draft';\n\n/**\n * Who is solving, and under whose authority.\n *\n * `user` — a logged-in caller; the per-definition access rules run.\n * `share` — a share-link token; the token already encodes the grant, so the\n * rules are skipped and the link's solve cap is charged instead.\n */\nexport type SolveAccess =\n\t| { kind: 'user'; ctx: RequestContext; rateLimitKey: string }\n\t| { kind: 'share'; ctx: RequestContext; link: ShareLink; rateLimitKey: string };\n\nexport interface SolveParams {\n\taccess: SolveAccess;\n\tdefinitionUrl: string;\n\t/**\n\t * The request body's inputs, read for a remote URL only. A stored definition's come from its\n\t * version's schema: a caller, a share-link visitor included, must not choose its ids, types or\n\t * bounds.\n\t */\n\tinputs?: unknown;\n\tvalues: Record<string, unknown>;\n\tchannel: SolveChannel;\n\t/** Explicit version pick; editor-only, never share-token accessible. */\n\tversionId: string | null;\n\trequest: Request;\n\t/** Typed loosely: two route trees with different generated `$types` both call this. */\n\tlocals: App.Locals;\n\t/** `performance.now()` at the very start of the request, before body parse. */\n\tloadStart: number;\n\t/** Prep sub-phase timings recorded before this call (body parse, token). */\n\tprepMarks: [string, number][];\n\t/**\n\t * The caller's live-event stream (`GET /api/v1/solve-events?streamId=`). When it is open\n\t * and theirs, this solve is bound to it: the server emits start/end, and the compute\n\t * request carries a callback so the definition can emit mid-solve. Ignored otherwise.\n\t */\n\tstreamId?: string | null;\n\t/** See `SolveBodySchema.mode`. */\n\tsolveMode?: SolveMode;\n\t/**\n\t * Report an access refusal as 404 instead of 403.\n\t *\n\t * The definition-addressed route needs this: a guid is guessable, so\n\t * 403-vs-404 there tells a caller whether a definition they cannot reach\n\t * exists. `/api/v1/compute` leaves it off — its callers navigated to the\n\t * definition, and a 403 is the more useful answer.\n\t */\n\tconcealAccessFailure?: boolean;\n\t/**\n\t * The route already charged the key's request bucket, ahead of any idempotent\n\t * replay that would skip this function, so it must not be charged twice.\n\t */\n\ttokenCharged?: boolean;\n}\n\nfunction readRemoteInputs(inputs: unknown): SolveInput[] {\n\tconst valid =\n\t\tArray.isArray(inputs) &&\n\t\tinputs.every(\n\t\t\t(input) =>\n\t\t\t\ttypeof input === 'object' &&\n\t\t\t\tinput !== null &&\n\t\t\t\ttypeof (input as SolveInput).id === 'string' &&\n\t\t\t\ttypeof (input as SolveInput).nickname === 'string'\n\t\t);\n\tif (!valid) {\n\t\tapiError(\n\t\t\t400,\n\t\t\tApiErrorCode.VALIDATION_FAILED,\n\t\t\t'A remote definitionUrl needs inputs: a list of { id, nickname, paramType }.'\n\t\t);\n\t}\n\treturn inputs as SolveInput[];\n}\n\nfunction admittedSolveInputs(\n\tschema: UISchema | undefined,\n\tinputs: unknown,\n\tvalues: Record<string, unknown>\n): SolveInput[] {\n\tconst solveInputs = schema ? solveInputsFromSchema(schema) : readRemoteInputs(inputs);\n\tconst serverOnly = postedServerSourcedIds(solveInputs, values);\n\tif (serverOnly.length > 0) {\n\t\tapiError(\n\t\t\t400,\n\t\t\tApiErrorCode.VALIDATION_FAILED,\n\t\t\t`These inputs are filled on the server and may not be posted in values: ${serverOnly.join(', ')}.`\n\t\t);\n\t}\n\treturn solveInputs;\n}\n\n/**\n * Run a solve and return the HTTP response.\n *\n * Throws `HttpError` (via `apiError`) for every refusal, and lets engine/network\n * failures propagate for the caller's outer catch to map — the two routes share\n * that mapping through `mapSolveError`.\n */\nexport async function runSolve(params: SolveParams): Promise<Response> {\n\tconst {\n\t\taccess,\n\t\tdefinitionUrl,\n\t\tinputs,\n\t\tvalues,\n\t\tchannel,\n\t\tversionId: explicitVersionId,\n\t\trequest,\n\t\tlocals,\n\t\tloadStart,\n\t\tprepMarks,\n\t\tconcealAccessFailure = false,\n\t\tstreamId = null,\n\t\tsolveMode = 'full',\n\t\ttokenCharged = false\n\t} = params;\n\tconst storage = getStorageProvider();\n\tconst sharedAccess = access.kind === 'share' ? access : null;\n\tconst solveCtx = access.ctx;\n\n\tlet prevMark = performance.now();\n\tconst mark = (label: string) => {\n\t\tprepMarks.push([label, performance.now() - prevMark]);\n\t\tprevMark = performance.now();\n\t};\n\n\t// Local definitions solve by reference: a byte-cache `DefinitionRef` whose\n\t// bytes the scheduler loads ONLY when an upload is unavoidable (pointer-known\n\t// re-solves move zero bytes). Remote-URL definitions carry raw fetched bytes.\n\tlet definitionSource: SolveDefinition;\n\t// `.load()` materializes bytes for schema backfill; `.outcome` drives the\n\t// `def_bytes` Server-Timing verdict. Null for remote-URL solves.\n\tlet localDefinitionRef: ByteCacheRef | null = null;\n\tlet localVersionForBackfill: { id: string; hasSchema: boolean } | null = null;\n\tlet storedSchema: UISchema | undefined;\n\t// BYO compute routing per org; null for remote definitions.\n\tlet solveOrgId: string | null = null;\n\tlet definitionPin: string | null = null;\n\t// Started once the project is known; null for remote definitions.\n\tlet pendingServer: Promise<ComputeServerConfig> | null = null;\n\t// Solve-metric attribution; null for remote-URL solves.\n\tlet metricDefinitionId: string | null = null;\n\tlet metricVersionId: string | null = null;\n\n\tconst isLocal = definitionUrl.startsWith('local:');\n\tconst guid = isLocal ? definitionUrl.substring(6) : null;\n\n\t// One row per solve attempt, including attempts rejected before the solve\n\t// runs — reads the attribution `let`s at call time, so definition/version\n\t// are null when a record fires pre-resolution. Fire-and-forget: the sink\n\t// never throws (ISolveMetricSink contract).\n\tconst recordMetric = (\n\t\tfailureKind: SolveFailureKind,\n\t\textra: { durationMs?: number; errorCount?: number; warningCount?: number } = {}\n\t) => {\n\t\tgetSolveMetricSink()\n\t\t\t.record(solveCtx, {\n\t\t\t\tdefinitionUrl,\n\t\t\t\tdefinitionId: metricDefinitionId,\n\t\t\t\tversionId: metricVersionId,\n\t\t\t\tchannel,\n\t\t\t\torgId: solveOrgId,\n\t\t\t\tdurationMs: extra.durationMs ?? 0,\n\t\t\t\tok: failureKind === 'ok',\n\t\t\t\tfailureKind,\n\t\t\t\terrorCount: extra.errorCount ?? 0,\n\t\t\t\twarningCount: extra.warningCount ?? 0\n\t\t\t})\n\t\t\t// Sinks are contracted not to throw, but nothing enforces it — a bad sink\n\t\t\t// must surface as a log line, not an unhandled rejection.\n\t\t\t.catch((err) =>\n\t\t\t\tlocals.log.error('Solve-metric record failed', {\n\t\t\t\t\tcomponent: 'API/Compute',\n\t\t\t\t\terr: renderThrown(err)\n\t\t\t\t})\n\t\t\t);\n\t};\n\n\t// Both limits run before DB reads so throttled callers don't burn quota. A\n\t// token pays its own request bucket and its owner's compute bucket, so ten\n\t// keys of one user never buy ten times the compute.\n\tconst tokenVerdict = tokenCharged\n\t\t? undefined\n\t\t: await chargeApiRateLimit(access.ctx, apiRateLimiter);\n\tif (tokenVerdict && !tokenVerdict.allowed) {\n\t\trecordMetric('rate_limited');\n\t\treturn rateLimitedResponse(tokenVerdict);\n\t}\n\tconst rateLimit = checkComputeRateLimit(access.rateLimitKey);\n\tif (!rateLimit.allowed) {\n\t\trecordMetric('rate_limited');\n\t\tconst retryAfter = String(rateLimit.retryAfter ?? 1);\n\t\tconst err = new ApiError(\n\t\t\t429,\n\t\t\tApiErrorCode.RATE_LIMITED,\n\t\t\t`Too many compute requests. Retry in ${retryAfter}s.`,\n\t\t\tundefined,\n\t\t\t{ retryAfter }\n\t\t);\n\t\treturn withRateLimitHeaders(\n\t\t\tnew Response(JSON.stringify(toErrorBody(err)), {\n\t\t\t\tstatus: 429,\n\t\t\t\theaders: { 'Content-Type': 'application/json', 'Retry-After': retryAfter }\n\t\t\t}),\n\t\t\ttokenVerdict\n\t\t);\n\t}\n\n\tif (isLocal && guid) {\n\t\tlet record;\n\t\ttry {\n\t\t\trecord = await providers.data.definitions.get(solveCtx, guid);\n\t\t} catch (err) {\n\t\t\tlocals.log.error('Failed to load local definition', {\n\t\t\t\tcomponent: 'API/Compute',\n\t\t\t\tguid,\n\t\t\t\terr: renderThrown(err)\n\t\t\t});\n\t\t\tapiError(404, ApiErrorCode.NOT_FOUND, `Definition '${guid}' not found`);\n\t\t}\n\t\tif (!record) apiError(404, ApiErrorCode.NOT_FOUND, `Definition '${guid}' not found`);\n\t\tmark('defRecord');\n\n\t\t// The version and the server need only the record and its project, so they are read\n\t\t// while access is checked, and awaited after it in their old order: a caller refused\n\t\t// access learns nothing from a missing version or server.\n\t\tconst versionId =\n\t\t\texplicitVersionId ?? (channel === 'live' ? record.liveVersionId : record.draftVersionId);\n\t\tconst pendingVersion = versionId\n\t\t\t? providers.data.definitions.getVersion(solveCtx, versionId)\n\t\t\t: null;\n\t\tpendingVersion?.catch(() => {});\n\t\tconst project = await providers.data.projects.getProject(solveCtx, record.projectId);\n\t\tsolveOrgId = project?.orgId ?? null;\n\t\tdefinitionPin = record.computeServerId ?? null;\n\t\tpendingServer = serverResolver.resolve(\n\t\t\tsolveCtx,\n\t\t\tsolveOrgId,\n\t\t\tlocals.providers.data.computeServer,\n\t\t\t{ definitionPin }\n\t\t);\n\t\tpendingServer.catch(() => {});\n\t\tmark('project');\n\n\t\tif (!sharedAccess) {\n\t\t\ttry {\n\t\t\t\tassertScope(access.ctx, 'solve', { projectId: record.projectId, definitionId: guid });\n\t\t\t\tif (channel === 'draft' || explicitVersionId) {\n\t\t\t\t\tawait requireCanEditDefinition(scoped(locals), record.projectId, guid, {\n\t\t\t\t\t\tproject,\n\t\t\t\t\t\tdefinition: record\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tawait requireCanSolve(scoped(locals), record.projectId, project ?? undefined);\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// The guards raise `ApiError`, but `requireCanEditDefinition` may still\n\t\t\t\t// surface an `HttpError` — matching only one shape would let the\n\t\t\t\t// other's 403 leak through, confirming a guid the caller can't reach.\n\t\t\t\tconst status = isApiError(err) ? err.status : isHttpError(err) ? err.status : undefined;\n\t\t\t\tif (concealAccessFailure && status === 403) {\n\t\t\t\t\tapiError(404, ApiErrorCode.NOT_FOUND, `Definition '${guid}' not found`);\n\t\t\t\t}\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t}\n\t\tmark('access');\n\n\t\tif (!versionId || !pendingVersion) {\n\t\t\tapiError(404, ApiErrorCode.NOT_FOUND, `Definition '${guid}' has no ${channel} version yet`);\n\t\t}\n\t\tconst version = await pendingVersion;\n\t\tif (!version || version.definitionId !== guid) {\n\t\t\tapiError(404, ApiErrorCode.NOT_FOUND, `Definition '${guid}' version is missing`);\n\t\t}\n\t\tlocalVersionForBackfill = { id: version.id, hasSchema: version.schema !== undefined };\n\t\tstoredSchema = version.schema;\n\t\tmetricDefinitionId = guid;\n\t\tmetricVersionId = version.id;\n\t\tmark('version');\n\n\t\t// Keyed on the immutable version id, NEVER the fileKey — a\n\t\t// delete-latest-then-reupload can reuse a fileKey for different content.\n\t\t// A missing blob surfaces at solve time (compute_error → 500) rather than\n\t\t// an upfront 404, since it's no longer read eagerly here.\n\t\tlocalDefinitionRef = engine.definitionRef(version.id, async () => {\n\t\t\tconst bytes = await storage.get(version.fileKey);\n\t\t\tif (!bytes) throw new Error(`Version blob missing: ${version.fileKey}`);\n\t\t\treturn bytes;\n\t\t});\n\t\tdefinitionSource = localDefinitionRef;\n\t\tmark('blob');\n\t} else {\n\t\t// A remote URL names no project, so only an org-wide key may solve it.\n\t\tassertScope(access.ctx, 'solve');\n\t\treadRemoteInputs(inputs);\n\t\ttry {\n\t\t\tdefinitionSource = await loadRemoteDefinition(definitionUrl);\n\t\t} catch (err) {\n\t\t\tlocals.log.error('Failed to fetch remote definition', {\n\t\t\t\tcomponent: 'API/Compute',\n\t\t\t\tdefinitionUrl,\n\t\t\t\terr: renderThrown(err)\n\t\t\t});\n\t\t\tapiError(\n\t\t\t\t400,\n\t\t\t\tApiErrorCode.VALIDATION_FAILED,\n\t\t\t\t`Failed to load definition: ${err instanceof Error ? err.message : String(err)}`\n\t\t\t);\n\t\t}\n\t\tmark('remoteDef');\n\t}\n\n\t// Everything above (auth, DB, blob/remote fetch) is the \"load\" phase; tree\n\t// build and solve are measured inside the pipeline.\n\tconst defLoadMs = performance.now() - loadStart;\n\n\t// Checked before the share cap, so a request refused for its values spends no\n\t// solve. A version without a stored schema is checked after the backfill below.\n\tlet solveInputs =\n\t\tstoredSchema || !isLocal ? admittedSolveInputs(storedSchema, inputs, values) : null;\n\n\t// Atomic check-and-increment; runs before solve to avoid wasting compute.\n\tif (sharedAccess) {\n\t\tconst next = await providers.data.shareLinks.tryIncrementSolveCount(\n\t\t\tsolveCtx,\n\t\t\tsharedAccess.link.id\n\t\t);\n\t\tif (next === null) {\n\t\t\trecordMetric('share_cap');\n\t\t\tapiError(429, ApiErrorCode.RATE_LIMITED, 'Share link solve cap reached.');\n\t\t}\n\t\tmark('shareCap');\n\t}\n\n\tconst serverConfig = await (pendingServer ??\n\t\tserverResolver.resolve(solveCtx, solveOrgId, locals.providers.data.computeServer, {\n\t\t\tdefinitionPin\n\t\t}));\n\tmark('resolveServer');\n\n\t// BRIDGE: remove ~2026-09 — lazy backfill for versions uploaded before schema\n\t// caching existed. Best-effort. Removing it: delete this block, tighten\n\t// `DefinitionVersion.schema` to required in platform types + Zod, and drop the\n\t// live-fetch fallback in loadForRender.server.ts.\n\tif (localVersionForBackfill && !localVersionForBackfill.hasSchema && localDefinitionRef) {\n\t\tconst versionId = localVersionForBackfill.id;\n\t\ttry {\n\t\t\t// Warms the byte-cache entry the upcoming solve's `load()` would hit anyway.\n\t\t\tconst bytes = await localDefinitionRef.load();\n\t\t\tstoredSchema = await fetchSchemaFromCompute(bytes, serverConfig);\n\t\t\tawait providers.data.definitions.setVersionSchema(solveCtx, versionId, storedSchema);\n\t\t} catch (err) {\n\t\t\tlocals.log.warn('Schema backfill failed', {\n\t\t\t\tcomponent: 'API/Compute',\n\t\t\t\tversionId,\n\t\t\t\terr: renderThrown(err)\n\t\t\t});\n\t\t}\n\t\t// Backfill calls the compute server — seconds when it fires. If this shows\n\t\t// up repeatedly for the same definition, setVersionSchema isn't sticking.\n\t\tmark('schemaBackfill');\n\t}\n\n\tif (isLocal && !storedSchema) {\n\t\tapiError(\n\t\t\t503,\n\t\t\tApiErrorCode.COMPUTE_UNAVAILABLE,\n\t\t\t\"This version's inputs could not be read. Retry shortly.\"\n\t\t);\n\t}\n\tsolveInputs ??= admittedSolveInputs(storedSchema, inputs, values);\n\n\t// `SolveEngine.solve` owns warm-client lookup, input-tree build, single-flight\n\t// coalescing (a coalesced solve aborts only when its last caller leaves), and\n\t// per-caller encoding. Remote-URL solves have no version id, so the URL stands\n\t// in as coalesce-key identity (`definitionKey`); local solves already carry\n\t// that identity on `localDefinitionRef.key`.\n\tconst live = bindLiveSolve({\n\t\townerKey: liveOwnerKey(access.kind === 'user' ? access.ctx.userId : null),\n\t\tstreamId,\n\t\trequest,\n\t\t// Outlives any server's deadline by a margin, so a callback racing the response is not\n\t\t// refused. Minted before the warm client that knows this server's deadline.\n\t\ttokenTtlMs: MAX_SOLVE_DEADLINE_MS + 60_000\n\t});\n\n\tlet outcome: Awaited<ReturnType<typeof engine.solve>> | undefined;\n\ttry {\n\t\toutcome = await engine.solve({\n\t\t\tserver: serverConfig,\n\t\t\tdefinitionSource,\n\t\t\tdefinitionKey: isLocal ? undefined : definitionUrl,\n\t\t\tinputs: solveInputs,\n\t\t\tvalues,\n\t\t\tsignal: request.signal,\n\t\t\tacceptEncoding: request.headers.get('accept-encoding') ?? '',\n\t\t\tdefinitionGuid: guid ?? undefined,\n\t\t\tloadStartMs: loadStart,\n\t\t\tdefLoadMs,\n\t\t\tprepMarks,\n\t\t\tselvaEvents: live.selvaEvents,\n\t\t\tsessionId: solveSessionId(access, guid),\n\t\t\tsolveMode\n\t\t});\n\t} finally {\n\t\tlive.end(outcome ? solveEndedKind(outcome) : 'error');\n\t}\n\tmark('solve');\n\n\t// Metric recording is app policy — the engine only maps outcome to HTTP.\n\t// These branches don't return; `engine.toWebResponse` below does.\n\tif (outcome.kind === 'timeout') {\n\t\trecordMetric('timeout', { durationMs: outcome.durationMs });\n\t} else if (outcome.kind === 'client_abort') {\n\t\trecordMetric('client_abort', { durationMs: outcome.durationMs });\n\t} else if (outcome.kind === 'too_large') {\n\t\trecordMetric('too_large');\n\t} else if (outcome.kind === 'request_too_large') {\n\t\trecordMetric('request_too_large', { durationMs: outcome.durationMs });\n\t} else if (outcome.kind === 'shed') {\n\t\trecordMetric('shed', { durationMs: outcome.durationMs });\n\t} else if (outcome.kind === 'compute_error') {\n\t\trecordMetric('compute_error', { durationMs: outcome.durationMs });\n\t} else if (outcome.kind === 'ok') {\n\t\trecordMetric('ok', {\n\t\t\tdurationMs: outcome.solveMs,\n\t\t\terrorCount: outcome.errorCount,\n\t\t\twarningCount: outcome.warningCount\n\t\t});\n\t\t// Best-effort: the solve already succeeded, so a failed counter write\n\t\t// must not turn into a request error. Local definitions only — remote\n\t\t// URLs have no record to bump.\n\t\tif (metricDefinitionId) {\n\t\t\tproviders.data.definitions.incrementSolveCount(solveCtx, metricDefinitionId).catch((err) =>\n\t\t\t\tlocals.log.warn('solveCount increment failed', {\n\t\t\t\t\tcomponent: 'API/Compute',\n\t\t\t\t\tdefinitionId: metricDefinitionId,\n\t\t\t\t\terr: renderThrown(err)\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\n\t\tif (COMPUTE_DEBUG) logDebugBreakdown(locals, request, outcome, defLoadMs, prepMarks);\n\t}\n\n\t// Builds the Response itself (incl. `Retry-After` on a rejected `shed`,\n\t// which `apiError` cannot set) and still throws `compute_error` through to\n\t// the caller's outer catch.\n\treturn withRateLimitHeaders(engine.toWebResponse(outcome), tokenVerdict);\n}\n\n/**\n * Both solve routes share this so they cannot drift on which failures read as\n * \"compute is down\" (503) versus a server bug (500).\n */\nexport function mapSolveError(err: unknown, locals: App.Locals): never {\n\tif (isHttpError(err)) throw err;\n\t// A guard's own refusal, not a failed solve — converted rather than\n\t// re-thrown. These routes return their Response directly instead of going\n\t// through `mount`, so an `ApiError` escaping here would reach SvelteKit,\n\t// which gives anything that isn't an `HttpError` a 500, turning a working\n\t// permission check into an operator error page.\n\tif (isApiError(err)) {\n\t\tapiError(err.status, err.code, err.message, err.fields, err.details);\n\t}\n\n\tif (err instanceof ComputeServerUnconfiguredError) {\n\t\tapiError(503, ApiErrorCode.COMPUTE_UNAVAILABLE, err.message);\n\t}\n\n\tconst message = err instanceof Error ? err.message : 'Unknown error';\n\tlocals.log.error('Solve request failed', {\n\t\tcomponent: 'API/Compute',\n\t\terr: renderThrown(err),\n\t\t...computeErrorLogFields(err, COMPUTE_DEBUG_VERBOSE)\n\t});\n\n\t// The compute transport classifies its failures — map the classes the caller\n\t// can act on. Unreachable/credentials/saturation are operator problems (503),\n\t// a deadline is 504; only a genuine solve failure stays 500.\n\tif (err instanceof ComputeError) {\n\t\tif (err.code === ErrorCodes.NETWORK_ERROR || err.code === ErrorCodes.CORS_ERROR) {\n\t\t\tapiError(503, ApiErrorCode.COMPUTE_UNAVAILABLE, 'Compute server is unreachable');\n\t\t}\n\t\tif (err.code === ErrorCodes.AUTH_ERROR) {\n\t\t\tapiError(\n\t\t\t\t503,\n\t\t\t\tApiErrorCode.COMPUTE_UNAVAILABLE,\n\t\t\t\t\"Compute server rejected this deployment's credentials — check the compute API key configuration.\"\n\t\t\t);\n\t\t}\n\t\tif (err.code === ErrorCodes.RATE_LIMIT) {\n\t\t\tapiError(\n\t\t\t\t503,\n\t\t\t\tApiErrorCode.COMPUTE_UNAVAILABLE,\n\t\t\t\t'Compute server is rate-limiting requests. Retry shortly.'\n\t\t\t);\n\t\t}\n\t\tif (err.code === ErrorCodes.TIMEOUT_ERROR) {\n\t\t\tapiError(\n\t\t\t\t504,\n\t\t\t\tApiErrorCode.COMPUTE_UNAVAILABLE,\n\t\t\t\t'Compute server timed out running the solve.'\n\t\t\t);\n\t\t}\n\t}\n\n\t// A transport-layer fetch failure means the compute server is unreachable,\n\t// not an internal error. (Raw TypeError only from fetches outside the compute\n\t// transport — the transport wraps its own into ComputeError NETWORK_ERROR.)\n\tif (err instanceof TypeError && message === 'fetch failed') {\n\t\tapiError(503, ApiErrorCode.COMPUTE_UNAVAILABLE, 'Compute server is unreachable');\n\t}\n\n\tapiError(500, ApiErrorCode.INTERNAL, message);\n}\n\n/**\n * DEBUG (SELVA_FLAG_COMPUTE_DEBUG): the server-side overhead the solve metric's\n * `durationMs` doesn't capture. `load` = auth + DB + definition fetch; `tree` =\n * input tree build; `serialize` = JSON.stringify of the result.\n */\nfunction logDebugBreakdown(\n\tlocals: App.Locals,\n\trequest: Request,\n\toutcome: { envelope: SolveEnvelope },\n\tdefLoadMs: number,\n\tprepMarks: [string, number][]\n): void {\n\tconst { metrics } = outcome.envelope;\n\tlocals.log.debug('Solve server-side phase breakdown', {\n\t\tcomponent: 'Compute/server',\n\t\tloadMs: Math.round(defLoadMs),\n\t\ttreeBuildMs: Math.round(metrics.treeBuildMs),\n\t\tsolveMs: Math.round(metrics.solveMs),\n\t\tserializeMs: Math.round(metrics.serializeMs),\n\t\tgzipMs: Math.round(metrics.gzipMs),\n\t\tserverTotalMs: Math.round(metrics.serverTotalMs),\n\t\tserializedBytes: metrics.serializedBytes\n\t});\n\tif (metrics.compressedBytes !== null) {\n\t\tlocals.log.debug('Response gzipped', {\n\t\t\tcomponent: 'Compute/server',\n\t\t\tserializedBytes: metrics.serializedBytes,\n\t\t\tcompressedBytes: metrics.compressedBytes,\n\t\t\tratio: Number((metrics.serializedBytes / metrics.compressedBytes).toFixed(1))\n\t\t});\n\t} else {\n\t\t// If this fires for browser requests, a proxy in front is stripping\n\t\t// Accept-Encoding, making compression impossible end-to-end.\n\t\tconst acceptEncoding = request.headers.get('accept-encoding') ?? '';\n\t\tlocals.log.debug('Compression skipped', {\n\t\t\tcomponent: 'Compute/server',\n\t\t\tacceptEncoding,\n\t\t\thasAcceptEncoding: acceptEncoding !== ''\n\t\t});\n\t}\n\t// Names the step a `load` (or pre-solve) spike hides in.\n\tlocals.log.debug('Prep breakdown', {\n\t\tcomponent: 'Compute/server',\n\t\t...Object.fromEntries(prepMarks.map(([label, ms]) => [`p_${label}Ms`, Math.round(ms)]))\n\t});\n\t// The only place evictions surface — per-request Server-Timing only carries\n\t// hit/miss verdicts.\n\tconst db = engine.stats().definitionBytes;\n\tlocals.log.debug('Definition byte-cache counters', {\n\t\tcomponent: 'Compute/def-bytes',\n\t\thits: db.hits,\n\t\tmisses: db.misses,\n\t\tevictions: db.evictions,\n\t\tentries: db.entries,\n\t\tretainedBytes: db.bytes\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAQA,SAAgB,eAAe,QAAqB,MAAyC;CAC5F,IAAI,OAAO,SAAS,UAAU,CAAC,OAAO,IAAI,UAAU,CAAC,MAAM,OAAO,KAAA;CAClE,OAAO,iBAAiB,OAAO,IAAI,QAAQ,IAAI;AAChD;;;;;;;;;;AAWA,SAAgB,iBAAiB,QAAgB,eAA2C;CAC3F,MAAM,MAAM,SAAS,CAAC,CAAC;CACvB,IAAI,CAAC,KAA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,GAAG,OAAO,YAAY,UAAU,KAAK,CAAC,OAAO,QAAQ,CAAC,KAAK,MAAM,KAAK,KAAK,MAAM,EAAE,CAAC,CAAC,CAAC;CACvF,CAAC;CAGD,MAAM,KAAK,OAAO,MAAM,CAAC,CAAC;CAC1B,OAAO,IAAI,MAAM,kCAAkC;EAClD,WAAW;EACX,MAAM,GAAG;EACT,QAAQ,GAAG;EACX,WAAW,GAAG;EACd,SAAS,GAAG;EACZ,eAAe,GAAG;CACnB,CAAC;AACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { G as NoopEventSink, c as getDefinitionService, i as getBranding, m as getOrgAssetService, p as getNotificationProvider } from "./providers.server.js";
|
|
2
|
-
import {
|
|
2
|
+
import { A as codeForStatus, B as isFlagEnabled, D as ApiError, O as ApiErrorCode } from "./access.js";
|
|
3
3
|
import { i as ProviderError } from "./context.js";
|
|
4
4
|
import { A as rateLimitedResponse, D as chargeApiRateLimit, M as withRateLimitHeaders, x as runHandler } from "./api.js";
|
|
5
|
-
import {
|
|
5
|
+
import { n as SchemaExtractionError, t as ComputeServerUnconfiguredError } from "./errors.js";
|
|
6
6
|
import { t as publicUrl } from "./origin.js";
|
|
7
7
|
import { _ as MAX_IMAGE_FILE_SIZE, c as evictComputeClient, g as MAX_DEFINITION_FILE_SIZE } from "./engine.server.js";
|
|
8
8
|
import { t as serverResolver } from "./serverResolver.server.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { J as canCreateProject } from "./access.js";
|
|
2
2
|
import { o as parseApiScope } from "./types.js";
|
|
3
3
|
import { r as hasPermission, t as SYSTEM_CONTEXT } from "./context.js";
|
|
4
|
-
import {
|
|
4
|
+
import { o as canCreateDefinitionInOrg } from "./logging.js";
|
|
5
5
|
import { createHash, createHmac, randomBytes, timingSafeEqual } from "node:crypto";
|
|
6
6
|
function createTokenCodec(config) {
|
|
7
7
|
const { prefix, secret, previousSecret } = config;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as getComputeServerConfigStore } from "../../../../../chunks/providers.server.js";
|
|
2
|
-
import {
|
|
2
|
+
import { O as ApiErrorCode, y as requireManageCompute } from "../../../../../chunks/access.js";
|
|
3
3
|
import { u as platformServers } from "../../../../../chunks/inventory.js";
|
|
4
4
|
import { n as validateIncomingServers, r as evictChangedServers$1, t as mergeApiKeys } from "../../../../../chunks/server-config-write.js";
|
|
5
5
|
import "../../../../../chunks/compute.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as getComputeServerConfigStore } from "../../../../../../chunks/providers.server.js";
|
|
2
|
-
import {
|
|
2
|
+
import { O as ApiErrorCode, y as requireManageCompute } from "../../../../../../chunks/access.js";
|
|
3
3
|
import { c as findServerById } from "../../../../../../chunks/inventory.js";
|
|
4
4
|
import { t as apiError } from "../../../../../../chunks/api-errors.js";
|
|
5
5
|
import "../../../../../../chunks/access2.server.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as getComputeServerConfigStore } from "../../../../../../chunks/providers.server.js";
|
|
2
|
-
import {
|
|
2
|
+
import { O as ApiErrorCode, y as requireManageCompute } from "../../../../../../chunks/access.js";
|
|
3
3
|
import { c as findServerById } from "../../../../../../chunks/inventory.js";
|
|
4
4
|
import { f as classifyProbeFailure } from "../../../../../../chunks/grasshopper.js";
|
|
5
5
|
import { t as apiError } from "../../../../../../chunks/api-errors.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h as getOrganizationProvider, s as getDefinitionMeta, v as getProjectProvider, x as getStorageProvider } from "../../../../../../chunks/providers.server.js";
|
|
2
|
-
import {
|
|
2
|
+
import { O as ApiErrorCode, v as requireInstanceAdmin } from "../../../../../../chunks/access.js";
|
|
3
3
|
import { i as ProviderError } from "../../../../../../chunks/context.js";
|
|
4
4
|
import { u as UpdateOrgSchema } from "../../../../../../chunks/schemas2.js";
|
|
5
5
|
import { U as requireParams, z as parseBody } from "../../../../../../chunks/api.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { h as getOrganizationProvider } from "../../../../../chunks/providers.server.js";
|
|
2
|
-
import {
|
|
2
|
+
import { O as ApiErrorCode, v as requireInstanceAdmin } from "../../../../../chunks/access.js";
|
|
3
3
|
import { i as ProviderError } from "../../../../../chunks/context.js";
|
|
4
4
|
import { r as CreateOrgSchema } from "../../../../../chunks/schemas2.js";
|
|
5
5
|
import { z as parseBody } from "../../../../../chunks/api.js";
|
|
6
|
-
import {
|
|
6
|
+
import { m as clampPageLimit } from "../../../../../chunks/logging.js";
|
|
7
7
|
import { t as apiError } from "../../../../../chunks/api-errors.js";
|
|
8
8
|
import "../../../../../chunks/access2.server.js";
|
|
9
9
|
import { n as created, t as apiRoute } from "../../../../../chunks/http2.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s as getDefinitionMeta, t as flag, v as getProjectProvider, x as getStorageProvider } from "../../../../../../chunks/providers.server.js";
|
|
2
|
-
import {
|
|
2
|
+
import { O as ApiErrorCode, v as requireInstanceAdmin } from "../../../../../../chunks/access.js";
|
|
3
3
|
import { t as SYSTEM_CONTEXT } from "../../../../../../chunks/context.js";
|
|
4
4
|
import { f as slugify } from "../../../../../../chunks/schemas2.js";
|
|
5
5
|
import { U as requireParams, z as parseBody } from "../../../../../../chunks/api.js";
|
package/build/server/entries/endpoints/api/admin/projects/_id_/grants/_grantId_/_server.ts.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as getPlatformProjectGrantStore, t as flag } from "../../../../../../../../chunks/providers.server.js";
|
|
2
|
-
import {
|
|
2
|
+
import { O as ApiErrorCode, v as requireInstanceAdmin } from "../../../../../../../../chunks/access.js";
|
|
3
3
|
import { t as SYSTEM_CONTEXT } from "../../../../../../../../chunks/context.js";
|
|
4
4
|
import { U as requireParams } from "../../../../../../../../chunks/api.js";
|
|
5
5
|
import { t as apiError } from "../../../../../../../../chunks/api-errors.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { C as getUserProfileStore, _ as getPlatformProjectGrantStore, h as getOrganizationProvider, t as flag, v as getProjectProvider } from "../../../../../../../chunks/providers.server.js";
|
|
2
|
-
import {
|
|
2
|
+
import { O as ApiErrorCode, v as requireInstanceAdmin } from "../../../../../../../chunks/access.js";
|
|
3
3
|
import { t as SYSTEM_CONTEXT } from "../../../../../../../chunks/context.js";
|
|
4
4
|
import { U as requireParams, z as parseBody } from "../../../../../../../chunks/api.js";
|
|
5
5
|
import { t as apiError } from "../../../../../../../chunks/api-errors.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h as getOrganizationProvider, t as flag, v as getProjectProvider } from "../../../../../chunks/providers.server.js";
|
|
2
|
-
import {
|
|
2
|
+
import { O as ApiErrorCode, v as requireInstanceAdmin } from "../../../../../chunks/access.js";
|
|
3
3
|
import { t as SYSTEM_CONTEXT } from "../../../../../chunks/context.js";
|
|
4
4
|
import { z as parseBody } from "../../../../../chunks/api.js";
|
|
5
5
|
import { t as apiError } from "../../../../../chunks/api-errors.js";
|
|
@@ -4,7 +4,7 @@ import { C as requirePermission } from "../../../../../../chunks/access.js";
|
|
|
4
4
|
import { c as findServerById } from "../../../../../../chunks/inventory.js";
|
|
5
5
|
import "../../../../../../chunks/access2.server.js";
|
|
6
6
|
import { t as openServerStats } from "../../../../../../chunks/serverStats.server.js";
|
|
7
|
-
import {
|
|
7
|
+
import { r as checkDeploymentConfig } from "../../../../../../chunks/ops.js";
|
|
8
8
|
import { json } from "@sveltejs/kit";
|
|
9
9
|
import { randomUUID } from "node:crypto";
|
|
10
10
|
import { join, resolve } from "node:path";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as requirePermission,
|
|
1
|
+
import { C as requirePermission, O as ApiErrorCode } from "../../../../../../chunks/access.js";
|
|
2
2
|
import { t as apiError } from "../../../../../../chunks/api-errors.js";
|
|
3
3
|
import "../../../../../../chunks/access2.server.js";
|
|
4
4
|
import { json } from "@sveltejs/kit";
|