@highstate/designer 0.20.0 → 0.26.0
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/.output/nitro.json +4 -4
- package/.output/public/_nuxt/{BkNNRtnm.js → -aI73seg.js} +1 -1
- package/.output/public/_nuxt/32ctXXKs.js +1 -0
- package/.output/public/_nuxt/39D0VL7r.js +1 -0
- package/.output/public/_nuxt/{ByBNG4eo.js → 3T5CmBSF.js} +1 -1
- package/.output/public/_nuxt/4R6BJ3GI.js +1 -0
- package/.output/public/_nuxt/77UvFSdd.js +18 -0
- package/.output/public/_nuxt/{G13IRnB2.js → B0E2rEnI.js} +1 -1
- package/.output/public/_nuxt/B1x03f8R.js +1 -0
- package/.output/public/_nuxt/B2CVdECd.js +1 -0
- package/.output/public/_nuxt/{DWQRqdcR.js → B2_u9ZKl.js} +1 -1
- package/.output/public/_nuxt/{DCR009rv.js → B8uKU-iG.js} +1 -1
- package/.output/public/_nuxt/{CxEW7TG8.js → B9BJCsIg.js} +1 -1
- package/.output/public/_nuxt/BA47KaF1.js +1 -0
- package/.output/public/_nuxt/{DRfxs3PN.js → BBmoak6l.js} +1 -1
- package/.output/public/_nuxt/BEOSfHJT.js +1 -0
- package/.output/public/_nuxt/{D2aToa54.js → BJV0IIsR.js} +1 -1
- package/.output/public/_nuxt/{DCBCRx0O.js → BKaSp7fy.js} +1 -1
- package/.output/public/_nuxt/BN7gUcg9.js +1 -0
- package/.output/public/_nuxt/{DiTMzCP2.js → BOujskTX.js} +1 -1
- package/.output/public/_nuxt/{DJN0y8jO.js → BPboW4rx.js} +1 -1
- package/.output/public/_nuxt/{DzWdbJvx.js → BR4jrf3-.js} +1 -1
- package/.output/public/_nuxt/{9I37tBe7.js → BSRetNRl.js} +1 -1
- package/.output/public/_nuxt/{C1FLL1Qz.js → Ba9NwIJp.js} +1 -1
- package/.output/public/_nuxt/{DCinzvm1.js → BbWhHw7B.js} +1 -1
- package/.output/public/_nuxt/Bcyj9glE.js +6 -0
- package/.output/public/_nuxt/{xA6NntuA.js → Be4ezMZK.js} +1 -1
- package/.output/public/_nuxt/BeH2EWoN.js +1 -0
- package/.output/public/_nuxt/{CudFwYib.js → BgvYz3Nr.js} +1 -1
- package/.output/public/_nuxt/BlGDdimO.js +1 -0
- package/.output/public/_nuxt/{ZbicA1ry.js → Bn5R9WlL.js} +1 -1
- package/.output/public/_nuxt/{ChaZkl1J.js → BqJDg8iS.js} +1 -1
- package/.output/public/_nuxt/BxD6MFcJ.js +1 -0
- package/.output/public/_nuxt/{D27ZAKIj.js → BxvmPvww.js} +1 -1
- package/.output/public/_nuxt/{BEEt8Am7.js → By1Fxx6d.js} +1 -1
- package/.output/public/_nuxt/{xdsXwj_J.js → ByBXn3Vz.js} +1 -1
- package/.output/public/_nuxt/C1bzPMRu.js +14 -0
- package/.output/public/_nuxt/{CV5MeYf9.js → C29gnYT3.js} +1 -1
- package/.output/public/_nuxt/C5BYcBs_.js +1 -0
- package/.output/public/_nuxt/{ziXKbM2N.js → C5DRPdxC.js} +1 -1
- package/.output/public/_nuxt/{BJK6uMxG.js → C794qwo0.js} +1 -1
- package/.output/public/_nuxt/{RCBWmVHz.js → C9OJ0gQB.js} +1 -1
- package/.output/public/_nuxt/{B13uiJCv.js → C9n5vGW7.js} +1 -1
- package/.output/public/_nuxt/{rcFevLEP.js → CCBTuGSI.js} +2 -2
- package/.output/public/_nuxt/CENFIVCM.js +1 -0
- package/.output/public/_nuxt/{CzSiA7V6.js → CGLWlIpJ.js} +1 -1
- package/.output/public/_nuxt/CI40hKzv.js +2 -0
- package/.output/public/_nuxt/{CcOKGYBt.js → CLsyMJ1X.js} +1 -1
- package/.output/public/_nuxt/{CaJ-zn_Z.js → CNWyx-82.js} +1 -1
- package/.output/public/_nuxt/CRZrAKrA.js +2 -0
- package/.output/public/_nuxt/{BxaP9l2T.js → CRb2z3Pg.js} +1 -1
- package/.output/public/_nuxt/{BDAHnC4j.js → CWA5Cfde.js} +1 -1
- package/.output/public/_nuxt/CYpkKp66.js +1 -0
- package/.output/public/_nuxt/{n0RAZLbO.js → C_yayEmb.js} +1 -1
- package/.output/public/_nuxt/{rgN_MdZl.js → CaZj7sno.js} +1 -1
- package/.output/public/_nuxt/{CGscLIrv.js → CgK0fS9t.js} +1 -1
- package/.output/public/_nuxt/CiaugisX.js +1 -0
- package/.output/public/_nuxt/Cjs5trkS.js +1 -0
- package/.output/public/_nuxt/Cn-bp-IR.js +1 -0
- package/.output/public/_nuxt/CoqwalnO.js +2 -0
- package/.output/public/_nuxt/{d-NZQb9b.js → CscXh7Vy.js} +1 -1
- package/.output/public/_nuxt/{DQHHT9y-.js → CwWsKBf5.js} +1 -1
- package/.output/public/_nuxt/Cwefpg1x.js +1 -0
- package/.output/public/_nuxt/CxoCegAs.js +13 -0
- package/.output/public/_nuxt/{8MSfy8uY.js → CyFj-Mv9.js} +1 -1
- package/.output/public/_nuxt/Cz2AlsmD.js +1 -0
- package/.output/public/_nuxt/{tsyQDnRt.js → D1BdWMiq.js} +1 -1
- package/.output/public/_nuxt/D1yXAE_w.js +1 -0
- package/.output/public/_nuxt/{xp27HhqZ.js → D2lHwbtX.js} +1 -1
- package/.output/public/_nuxt/{DKhcu7kD.js → D46u9gXN.js} +1 -1
- package/.output/public/_nuxt/{CJWmG4YP.js → D4H6aUyZ.js} +7 -7
- package/.output/public/_nuxt/{Dg5xB15N.js → D82vCrfD.js} +1 -1
- package/.output/public/_nuxt/D8l8udqQ.js +1 -0
- package/.output/public/_nuxt/D9ITfHnZ.js +269 -0
- package/.output/public/_nuxt/{RNghxpo_.js → DDvzSYfr.js} +1 -1
- package/.output/public/_nuxt/{Aopv2gwH.js → DFwfZeyL.js} +1 -1
- package/.output/public/_nuxt/{GgtqCdye.js → DMM9kDc1.js} +1 -1
- package/.output/public/_nuxt/{DOPqH6_T.js → DNVXBFXP.js} +1 -1
- package/.output/public/_nuxt/DPOp833l.js +1 -0
- package/.output/public/_nuxt/{D2obegTF.js → DPQHj1GW.js} +1 -1
- package/.output/public/_nuxt/DRJZaHtK.js +1 -0
- package/.output/public/_nuxt/{BlfjmxyP.js → DRTFVhVr.js} +1 -1
- package/.output/public/_nuxt/{TsXTqZ29.js → DSeZwD4N.js} +1 -1
- package/.output/public/_nuxt/{C8lm7lgC.js → DTYY2tCY.js} +1 -1
- package/.output/public/_nuxt/{DWa2aw6r.js → DVKmRHSk.js} +1 -1
- package/.output/public/_nuxt/DYE7WIF3.js +1 -0
- package/.output/public/_nuxt/{D-wGZMZP.js → DYYyOkJe.js} +1 -1
- package/.output/public/_nuxt/{BCVaR2pQ.js → DcV32yum.js} +1 -1
- package/.output/public/_nuxt/DdhYQ3Tv.js +1 -0
- package/.output/public/_nuxt/DgsIRcX7.js +1 -0
- package/.output/public/_nuxt/{BtvRca6l.js → DjAJT7YJ.js} +1 -1
- package/.output/public/_nuxt/DmMgvbsF.js +1 -0
- package/.output/public/_nuxt/{pxXmJ8QX.js → DrQCNsTo.js} +1 -1
- package/.output/public/_nuxt/{DNqd6Nek.js → DvCXikgN.js} +1 -1
- package/.output/public/_nuxt/DzQULtcW.js +1 -0
- package/.output/public/_nuxt/{Cm-2nZ05.js → DzowYWbi.js} +1 -1
- package/.output/public/_nuxt/{DQwYQDb2.js → FtFNcQmh.js} +1 -1
- package/.output/public/_nuxt/{BPcwi1q2.js → I4u-TRO-.js} +1 -1
- package/.output/public/_nuxt/{D5z-4QVk.js → O3nsZ-Uz.js} +1 -1
- package/.output/public/_nuxt/Qj4UhtaN.js +1 -0
- package/.output/public/_nuxt/{BA0jw7CM.js → VF7GAmoY.js} +1 -1
- package/.output/public/_nuxt/Ve4PFQV2.js +1 -0
- package/.output/public/_nuxt/{xrNU8mHG.js → YpnHruhZ.js} +1 -1
- package/.output/public/_nuxt/_H4v1dQx.js +1 -0
- package/.output/public/_nuxt/_pageId_.C5KTkEfy.css +1 -0
- package/.output/public/_nuxt/_panelId_.CKSHyLNC.css +1 -0
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/53add2c3-4d7c-4a4f-a116-e73c3787cf98.json +1 -0
- package/.output/public/_nuxt/components.a-P9dVi2.css +1 -0
- package/.output/public/_nuxt/{entry.Bc0aTA0K.css → entry.DsBbjDm-.css} +1 -1
- package/.output/public/_nuxt/eo99z4R2.js +1 -0
- package/.output/public/_nuxt/error-404.DnBTUElh.css +1 -0
- package/.output/public/_nuxt/error-500.BNyYF0qG.css +1 -0
- package/.output/public/_nuxt/{BUNf2Yb8.js → fbfpKHgl.js} +1 -1
- package/.output/public/_nuxt/{BDs6uo3D.js → fxmP1KZw.js} +1 -1
- package/.output/public/_nuxt/graph-resolver-DhjyrFRu.js +180 -0
- package/.output/public/_nuxt/{mUFnM-_q.js → hunqYsQf.js} +1 -1
- package/.output/public/_nuxt/iJghVVcV.js +1 -0
- package/.output/public/_nuxt/{DyMmfYiE.js → m4Sxwg8n.js} +1 -1
- package/.output/public/_nuxt/monaco-editor.DOXZIHvr.css +1 -0
- package/.output/public/_nuxt/oH_c3LbQ.js +1 -0
- package/.output/public/_nuxt/rZm6bMo-.js +1 -0
- package/.output/public/_nuxt/{DOMRsNpU.js → rpHuDh4d.js} +1 -1
- package/.output/public/_nuxt/{vuetify.BzdWZaIq.css → vuetify.DtnS3-VQ.css} +1 -1
- package/.output/public/_nuxt/{yaml.worker-C1Cl1y5J.js → yaml.worker-CYOhFCVP.js} +248 -252
- package/.output/server/index.mjs +3272 -7573
- package/.output/server/index.mjs.map +1 -1
- package/.output/server/node_modules/@babel/parser/lib/index.js +1 -1
- package/.output/server/node_modules/@babel/parser/package.json +1 -1
- package/.output/server/node_modules/@trpc/server/dist/adapters/fetch/index.cjs +57 -0
- package/.output/server/node_modules/@trpc/server/dist/adapters/fetch/index.mjs +2 -2
- package/.output/server/node_modules/@trpc/server/dist/codes-BfZsPdy-.cjs +222 -0
- package/.output/server/node_modules/@trpc/server/dist/{contentTypeParsers-SN4WL9ze.mjs → contentTypeParsers-iAFF_pJG.cjs} +7 -2
- package/.output/server/node_modules/@trpc/server/dist/getErrorShape-MR4DZeb7.cjs +341 -0
- package/.output/server/node_modules/@trpc/server/dist/http.cjs +14 -0
- package/.output/server/node_modules/@trpc/server/dist/index.cjs +22 -0
- package/.output/server/node_modules/@trpc/server/dist/index.mjs +2 -2
- package/.output/server/node_modules/@trpc/server/dist/{initTRPC-RoZMIBeA.mjs → initTRPC-B1ggxyJl.mjs} +2 -2
- package/.output/server/node_modules/@trpc/server/dist/initTRPC-BXPPV9Tx.cjs +416 -0
- package/.output/server/node_modules/@trpc/server/dist/observable/index.cjs +13 -0
- package/.output/server/node_modules/@trpc/server/dist/observable-B1Nk6r1H.cjs +181 -0
- package/.output/server/node_modules/@trpc/server/dist/{observable-CUiPknO-.mjs → observable-BVzLuBs6.cjs} +42 -8
- package/.output/server/node_modules/@trpc/server/dist/{parseTRPCMessage-CTow-umk.mjs → parseTRPCMessage-7Ltmq-Fb.cjs} +14 -4
- package/.output/server/node_modules/@trpc/server/dist/resolveResponse-B0CCg8nq.cjs +2365 -0
- package/.output/server/node_modules/@trpc/server/dist/{resolveResponse-BVDlNZwN.mjs → resolveResponse-C5I6V_wc.mjs} +67 -18
- package/.output/server/node_modules/@trpc/server/dist/rpc.cjs +6 -0
- package/.output/server/node_modules/@trpc/server/dist/{tracked-Bjtgv3wJ.mjs → tracked-DiE3uR1B.mjs} +12 -3
- package/.output/server/node_modules/@trpc/server/dist/tracked-Dj_dpOJE.cjs +486 -0
- package/.output/server/node_modules/@trpc/server/package.json +15 -5
- package/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +2 -2
- package/.output/server/node_modules/@vue/compiler-core/package.json +3 -3
- package/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +1 -1
- package/.output/server/node_modules/@vue/compiler-dom/package.json +3 -3
- package/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1 -1
- package/.output/server/node_modules/@vue/compiler-ssr/package.json +3 -3
- package/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +31 -13
- package/.output/server/node_modules/@vue/reactivity/package.json +2 -2
- package/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +144 -81
- package/.output/server/node_modules/@vue/runtime-core/package.json +3 -3
- package/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +70 -9
- package/.output/server/node_modules/@vue/runtime-dom/package.json +4 -4
- package/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +6 -2
- package/.output/server/node_modules/@vue/server-renderer/package.json +4 -4
- package/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +1 -1
- package/.output/server/node_modules/@vue/shared/package.json +1 -1
- package/.output/server/node_modules/devalue/package.json +5 -2
- package/.output/server/node_modules/devalue/src/base64.js +46 -96
- package/.output/server/node_modules/devalue/src/parse.js +32 -10
- package/.output/server/node_modules/devalue/src/stringify.js +13 -28
- package/.output/server/node_modules/devalue/src/uneval.js +117 -55
- package/.output/server/node_modules/devalue/src/utils.js +3 -7
- package/.output/server/node_modules/hookable/dist/index.mjs +5 -14
- package/.output/server/node_modules/hookable/package.json +24 -23
- package/.output/server/node_modules/trpc-bun-adapter/dist/index.js +406 -0
- package/.output/server/node_modules/trpc-bun-adapter/package.json +44 -0
- package/.output/server/node_modules/unhead/dist/plugins.mjs +3 -3
- package/.output/server/node_modules/unhead/dist/server.mjs +2 -2
- package/.output/server/node_modules/unhead/dist/shared/{unhead.eK9_7LaY.mjs → unhead.B5FWS6X0.mjs} +22 -13
- package/.output/server/node_modules/unhead/dist/shared/{unhead.BFfcxOoW.mjs → unhead.Ct24BOby.mjs} +4 -2
- package/.output/server/node_modules/unhead/dist/shared/unhead.D4vSFytZ.mjs +236 -0
- package/.output/server/node_modules/unhead/dist/shared/{unhead.ckV6dpEQ.mjs → unhead.TxTMM7cM.mjs} +1 -1
- package/.output/server/node_modules/unhead/dist/utils.mjs +1 -1
- package/.output/server/node_modules/unhead/package.json +1 -1
- package/.output/server/node_modules/vue/dist/vue.cjs.js +1 -1
- package/.output/server/node_modules/vue/dist/vue.cjs.prod.js +1 -1
- package/.output/server/node_modules/vue/package.json +7 -7
- package/.output/server/node_modules/ws/lib/permessage-deflate.js +6 -6
- package/.output/server/node_modules/ws/lib/websocket-server.js +5 -5
- package/.output/server/node_modules/ws/lib/websocket.js +6 -6
- package/.output/server/node_modules/ws/package.json +4 -3
- package/.output/server/node_modules/ws/wrapper.mjs +14 -1
- package/.output/server/package.json +17 -16
- package/package.json +20 -14
- package/.output/public/_nuxt/57B6Rca8.js +0 -1
- package/.output/public/_nuxt/83L43bj1.js +0 -1
- package/.output/public/_nuxt/B8nw2aST.js +0 -2
- package/.output/public/_nuxt/B93PlW-d.js +0 -1
- package/.output/public/_nuxt/BDa1f6PF.js +0 -2
- package/.output/public/_nuxt/BE_Meo09.js +0 -269
- package/.output/public/_nuxt/BLF3u89x.js +0 -1
- package/.output/public/_nuxt/Ba13S78F.js +0 -1
- package/.output/public/_nuxt/BhRPY-oY.js +0 -1
- package/.output/public/_nuxt/Bhrxn6JZ.js +0 -1
- package/.output/public/_nuxt/Bo8jzlL1.js +0 -18
- package/.output/public/_nuxt/BpkvlDNi.js +0 -1
- package/.output/public/_nuxt/BrzmwbiE.js +0 -1
- package/.output/public/_nuxt/BuJgCY_C.js +0 -1
- package/.output/public/_nuxt/C-sUppwS.js +0 -1
- package/.output/public/_nuxt/C47S-Tmv.js +0 -1
- package/.output/public/_nuxt/CMjwMIkn.js +0 -1
- package/.output/public/_nuxt/CPZSvMBB.js +0 -1
- package/.output/public/_nuxt/CPpO8vcZ.js +0 -1
- package/.output/public/_nuxt/CQ8jqdy-.js +0 -1
- package/.output/public/_nuxt/CjoLj4QM.js +0 -1
- package/.output/public/_nuxt/D6fh7rEe.js +0 -2
- package/.output/public/_nuxt/D91rOou-.js +0 -13
- package/.output/public/_nuxt/DMwsHuHA.js +0 -1
- package/.output/public/_nuxt/DYoxhk2S.js +0 -1
- package/.output/public/_nuxt/Dbwml2gB.js +0 -1
- package/.output/public/_nuxt/DsS90Fp6.js +0 -1
- package/.output/public/_nuxt/Dv7Oe6Be.js +0 -1
- package/.output/public/_nuxt/DxERyYWQ.js +0 -1
- package/.output/public/_nuxt/GDxZ_Nvm.js +0 -14
- package/.output/public/_nuxt/VCDPK7BO.js +0 -1
- package/.output/public/_nuxt/builds/meta/a1fec520-0c95-4ae0-af5e-964780fad341.json +0 -1
- package/.output/public/_nuxt/components.CIe9upZ4.css +0 -1
- package/.output/public/_nuxt/error-404.X7H_YhdC.css +0 -1
- package/.output/public/_nuxt/error-500.BOQe1fsk.css +0 -1
- package/.output/public/_nuxt/f3TOpYbw.js +0 -1
- package/.output/public/_nuxt/graph-resolver-DKNtntr2.js +0 -180
- package/.output/public/_nuxt/monaco-editor.D_J4ItrK.css +0 -1
- package/.output/public/_nuxt/o_m1mZtJ.js +0 -6
- package/.output/server/node_modules/@trpc/server/dist/adapters/ws.mjs +0 -15
- package/.output/server/node_modules/@trpc/server/dist/node-http-DtA2iLK9.mjs +0 -224
- package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import-9NNw8uQM.mjs +0 -31
- package/.output/server/node_modules/@trpc/server/dist/ws-CJgZE7Hg.mjs +0 -460
- package/.output/server/node_modules/unhead/dist/shared/unhead.CApf5sj3.mjs +0 -148
- package/LICENSE +0 -21
- /package/.output/public/_nuxt/{XEA9GSJd.js → B69Z0Xk1.js} +0 -0
- /package/.output/server/node_modules/@trpc/server/dist/{http-CWyjOa1l.mjs → http-DXy3XyhL.cjs} +0 -0
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
import { __toESM, getErrorShape, require_objectSpread2 } from "./getErrorShape-vC8mUXJD.mjs";
|
|
2
|
-
import { run } from "./codes-DagpWZLc.mjs";
|
|
3
|
-
import { TRPCError, getTRPCErrorFromUnknown, transformTRPCResponse } from "./tracked-Bjtgv3wJ.mjs";
|
|
4
|
-
import { isAbortError, resolveResponse } from "./resolveResponse-BVDlNZwN.mjs";
|
|
5
|
-
import { IncomingMessage } from "node:http";
|
|
6
|
-
|
|
7
|
-
//#region src/adapters/node-http/incomingMessageToRequest.ts
|
|
8
|
-
function createBody(req, opts) {
|
|
9
|
-
if ("body" in req) {
|
|
10
|
-
if (req.body === void 0) return void 0;
|
|
11
|
-
if (typeof req.body === "string") return req.body;
|
|
12
|
-
if (req.body instanceof IncomingMessage) return req.body;
|
|
13
|
-
return JSON.stringify(req.body);
|
|
14
|
-
}
|
|
15
|
-
let size = 0;
|
|
16
|
-
let hasClosed = false;
|
|
17
|
-
return new ReadableStream({
|
|
18
|
-
start(controller) {
|
|
19
|
-
const onData = (chunk) => {
|
|
20
|
-
size += chunk.length;
|
|
21
|
-
if (!opts.maxBodySize || size <= opts.maxBodySize) {
|
|
22
|
-
controller.enqueue(new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength));
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
controller.error(new TRPCError({ code: "PAYLOAD_TOO_LARGE" }));
|
|
26
|
-
hasClosed = true;
|
|
27
|
-
req.off("data", onData);
|
|
28
|
-
req.off("end", onEnd);
|
|
29
|
-
};
|
|
30
|
-
const onEnd = () => {
|
|
31
|
-
if (hasClosed) return;
|
|
32
|
-
hasClosed = true;
|
|
33
|
-
req.off("data", onData);
|
|
34
|
-
req.off("end", onEnd);
|
|
35
|
-
controller.close();
|
|
36
|
-
};
|
|
37
|
-
req.on("data", onData);
|
|
38
|
-
req.on("end", onEnd);
|
|
39
|
-
},
|
|
40
|
-
cancel() {
|
|
41
|
-
req.destroy();
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
function createURL(req) {
|
|
46
|
-
try {
|
|
47
|
-
var _ref, _req$headers$host;
|
|
48
|
-
const protocol = req.headers[":scheme"] && req.headers[":scheme"] === "https" || req.socket && "encrypted" in req.socket && req.socket.encrypted ? "https:" : "http:";
|
|
49
|
-
const host = (_ref = (_req$headers$host = req.headers.host) !== null && _req$headers$host !== void 0 ? _req$headers$host : req.headers[":authority"]) !== null && _ref !== void 0 ? _ref : "localhost";
|
|
50
|
-
return new URL(req.url, `${protocol}//${host}`);
|
|
51
|
-
} catch (cause) {
|
|
52
|
-
throw new TRPCError({
|
|
53
|
-
code: "BAD_REQUEST",
|
|
54
|
-
message: "Invalid URL",
|
|
55
|
-
cause
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function createHeaders(incoming) {
|
|
60
|
-
const headers = new Headers();
|
|
61
|
-
for (const key in incoming) {
|
|
62
|
-
const value = incoming[key];
|
|
63
|
-
if (typeof key === "string" && key.startsWith(":")) continue;
|
|
64
|
-
if (Array.isArray(value)) for (const item of value) headers.append(key, item);
|
|
65
|
-
else if (value != null) headers.append(key, value);
|
|
66
|
-
}
|
|
67
|
-
return headers;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Convert an [`IncomingMessage`](https://nodejs.org/api/http.html#class-httpincomingmessage) to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
|
71
|
-
*/
|
|
72
|
-
function incomingMessageToRequest(req, res, opts) {
|
|
73
|
-
const ac = new AbortController();
|
|
74
|
-
const onAbort = () => {
|
|
75
|
-
res.off("close", onAbort);
|
|
76
|
-
req.off("aborted", onAbort);
|
|
77
|
-
ac.abort();
|
|
78
|
-
};
|
|
79
|
-
res.once("close", onAbort);
|
|
80
|
-
req.once("aborted", onAbort);
|
|
81
|
-
const url = createURL(req);
|
|
82
|
-
const init = {
|
|
83
|
-
headers: createHeaders(req.headers),
|
|
84
|
-
method: req.method,
|
|
85
|
-
signal: ac.signal
|
|
86
|
-
};
|
|
87
|
-
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
88
|
-
init.body = createBody(req, opts);
|
|
89
|
-
init.duplex = "half";
|
|
90
|
-
}
|
|
91
|
-
const request = new Request(url, init);
|
|
92
|
-
return request;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
//#endregion
|
|
96
|
-
//#region src/adapters/node-http/writeResponse.ts
|
|
97
|
-
async function writeResponseBodyChunk(res, chunk) {
|
|
98
|
-
if (res.write(chunk) === false) await new Promise((resolve, reject) => {
|
|
99
|
-
const onError = (err) => {
|
|
100
|
-
reject(err);
|
|
101
|
-
cleanup();
|
|
102
|
-
};
|
|
103
|
-
const onDrain = () => {
|
|
104
|
-
resolve();
|
|
105
|
-
cleanup();
|
|
106
|
-
};
|
|
107
|
-
const cleanup = () => {
|
|
108
|
-
res.off("error", onError);
|
|
109
|
-
res.off("drain", onDrain);
|
|
110
|
-
};
|
|
111
|
-
res.once("error", onError);
|
|
112
|
-
res.once("drain", onDrain);
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* @internal
|
|
117
|
-
*/
|
|
118
|
-
async function writeResponseBody(opts) {
|
|
119
|
-
const { res } = opts;
|
|
120
|
-
try {
|
|
121
|
-
const writableStream = new WritableStream({ async write(chunk) {
|
|
122
|
-
var _res$flush;
|
|
123
|
-
await writeResponseBodyChunk(res, chunk);
|
|
124
|
-
(_res$flush = res.flush) === null || _res$flush === void 0 || _res$flush.call(res);
|
|
125
|
-
} });
|
|
126
|
-
await opts.body.pipeTo(writableStream, { signal: opts.signal });
|
|
127
|
-
} catch (err) {
|
|
128
|
-
if (isAbortError(err)) return;
|
|
129
|
-
throw err;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* @internal
|
|
134
|
-
*/
|
|
135
|
-
async function writeResponse(opts) {
|
|
136
|
-
const { response, rawResponse } = opts;
|
|
137
|
-
if (rawResponse.statusCode === 200) rawResponse.statusCode = response.status;
|
|
138
|
-
for (const [key, value] of response.headers) rawResponse.setHeader(key, value);
|
|
139
|
-
try {
|
|
140
|
-
if (response.body) await writeResponseBody({
|
|
141
|
-
res: rawResponse,
|
|
142
|
-
signal: opts.request.signal,
|
|
143
|
-
body: response.body
|
|
144
|
-
});
|
|
145
|
-
} catch (err) {
|
|
146
|
-
if (!rawResponse.headersSent) rawResponse.statusCode = 500;
|
|
147
|
-
throw err;
|
|
148
|
-
} finally {
|
|
149
|
-
rawResponse.end();
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
//#endregion
|
|
154
|
-
//#region src/adapters/node-http/nodeHTTPRequestHandler.ts
|
|
155
|
-
var import_objectSpread2 = __toESM(require_objectSpread2(), 1);
|
|
156
|
-
/**
|
|
157
|
-
* @internal
|
|
158
|
-
*/
|
|
159
|
-
function internal_exceptionHandler(opts) {
|
|
160
|
-
return (cause) => {
|
|
161
|
-
var _opts$onError;
|
|
162
|
-
const { res, req } = opts;
|
|
163
|
-
const error = getTRPCErrorFromUnknown(cause);
|
|
164
|
-
const shape = getErrorShape({
|
|
165
|
-
config: opts.router._def._config,
|
|
166
|
-
error,
|
|
167
|
-
type: "unknown",
|
|
168
|
-
path: void 0,
|
|
169
|
-
input: void 0,
|
|
170
|
-
ctx: void 0
|
|
171
|
-
});
|
|
172
|
-
(_opts$onError = opts.onError) === null || _opts$onError === void 0 || _opts$onError.call(opts, {
|
|
173
|
-
req,
|
|
174
|
-
error,
|
|
175
|
-
type: "unknown",
|
|
176
|
-
path: void 0,
|
|
177
|
-
input: void 0,
|
|
178
|
-
ctx: void 0
|
|
179
|
-
});
|
|
180
|
-
const transformed = transformTRPCResponse(opts.router._def._config, { error: shape });
|
|
181
|
-
res.statusCode = shape.data.httpStatus;
|
|
182
|
-
res.end(JSON.stringify(transformed));
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* @remark the promise never rejects
|
|
187
|
-
*/
|
|
188
|
-
async function nodeHTTPRequestHandler(opts) {
|
|
189
|
-
return new Promise((resolve) => {
|
|
190
|
-
var _opts$middleware;
|
|
191
|
-
const handleViaMiddleware = (_opts$middleware = opts.middleware) !== null && _opts$middleware !== void 0 ? _opts$middleware : (_req, _res, next) => next();
|
|
192
|
-
opts.res.once("finish", () => {
|
|
193
|
-
resolve();
|
|
194
|
-
});
|
|
195
|
-
return handleViaMiddleware(opts.req, opts.res, (err) => {
|
|
196
|
-
run(async () => {
|
|
197
|
-
var _opts$maxBodySize;
|
|
198
|
-
const request = incomingMessageToRequest(opts.req, opts.res, { maxBodySize: (_opts$maxBodySize = opts.maxBodySize) !== null && _opts$maxBodySize !== void 0 ? _opts$maxBodySize : null });
|
|
199
|
-
const createContext = async (innerOpts) => {
|
|
200
|
-
var _opts$createContext;
|
|
201
|
-
return await ((_opts$createContext = opts.createContext) === null || _opts$createContext === void 0 ? void 0 : _opts$createContext.call(opts, (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts), innerOpts)));
|
|
202
|
-
};
|
|
203
|
-
const response = await resolveResponse((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts), {}, {
|
|
204
|
-
req: request,
|
|
205
|
-
error: err ? getTRPCErrorFromUnknown(err) : null,
|
|
206
|
-
createContext,
|
|
207
|
-
onError(o) {
|
|
208
|
-
var _opts$onError2;
|
|
209
|
-
opts === null || opts === void 0 || (_opts$onError2 = opts.onError) === null || _opts$onError2 === void 0 || _opts$onError2.call(opts, (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, o), {}, { req: opts.req }));
|
|
210
|
-
}
|
|
211
|
-
}));
|
|
212
|
-
await writeResponse({
|
|
213
|
-
request,
|
|
214
|
-
response,
|
|
215
|
-
rawResponse: opts.res
|
|
216
|
-
});
|
|
217
|
-
}).catch(internal_exceptionHandler(opts));
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
//#endregion
|
|
223
|
-
export { createURL, incomingMessageToRequest, internal_exceptionHandler, nodeHTTPRequestHandler };
|
|
224
|
-
//# sourceMappingURL=node-http-DtA2iLK9.mjs.map
|
package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import-9NNw8uQM.mjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { emptyObject } from "./codes-DagpWZLc.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/unstable-core-do-not-import/http/formDataToObject.ts
|
|
4
|
-
const isNumberString = (str) => /^\d+$/.test(str);
|
|
5
|
-
function set(obj, path, value) {
|
|
6
|
-
if (path.length > 1) {
|
|
7
|
-
const newPath = [...path];
|
|
8
|
-
const key = newPath.shift();
|
|
9
|
-
const nextKey = newPath[0];
|
|
10
|
-
if (!Object.hasOwn(obj, key)) obj[key] = isNumberString(nextKey) ? [] : emptyObject();
|
|
11
|
-
else if (Array.isArray(obj[key]) && !isNumberString(nextKey)) obj[key] = Object.fromEntries(Object.entries(obj[key]));
|
|
12
|
-
set(obj[key], newPath, value);
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
const p = path[0];
|
|
16
|
-
if (obj[p] === void 0) obj[p] = value;
|
|
17
|
-
else if (Array.isArray(obj[p])) obj[p].push(value);
|
|
18
|
-
else obj[p] = [obj[p], value];
|
|
19
|
-
}
|
|
20
|
-
function formDataToObject(formData) {
|
|
21
|
-
const obj = emptyObject();
|
|
22
|
-
for (const [key, value] of formData.entries()) {
|
|
23
|
-
const parts = key.split(/[\.\[\]]/).filter(Boolean);
|
|
24
|
-
set(obj, parts, value);
|
|
25
|
-
}
|
|
26
|
-
return obj;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
//#endregion
|
|
30
|
-
export { formDataToObject };
|
|
31
|
-
//# sourceMappingURL=unstable-core-do-not-import-9NNw8uQM.mjs.map
|
|
@@ -1,460 +0,0 @@
|
|
|
1
|
-
import { __toESM, getErrorShape, require_objectSpread2 } from "./getErrorShape-vC8mUXJD.mjs";
|
|
2
|
-
import { isAsyncIterable, isObject, run } from "./codes-DagpWZLc.mjs";
|
|
3
|
-
import { TRPCError, callProcedure, getTRPCErrorFromUnknown, isTrackedEnvelope, transformTRPCResponse } from "./tracked-Bjtgv3wJ.mjs";
|
|
4
|
-
import { parseTRPCMessage } from "./parseTRPCMessage-CTow-umk.mjs";
|
|
5
|
-
import { Unpromise, iteratorResource, parseConnectionParamsFromUnknown, require_usingCtx } from "./resolveResponse-BVDlNZwN.mjs";
|
|
6
|
-
import { isObservable, observableToAsyncIterable } from "./observable-UMO3vUa_.mjs";
|
|
7
|
-
import { createURL } from "./node-http-DtA2iLK9.mjs";
|
|
8
|
-
|
|
9
|
-
//#region src/adapters/wsEncoder.ts
|
|
10
|
-
/**
|
|
11
|
-
* Default JSON encoder - used when no encoder is specified.
|
|
12
|
-
* This maintains backwards compatibility with existing behavior.
|
|
13
|
-
*/
|
|
14
|
-
const jsonEncoder = {
|
|
15
|
-
encode: (data) => JSON.stringify(data),
|
|
16
|
-
decode: (data) => {
|
|
17
|
-
if (typeof data !== "string") throw new Error("jsonEncoder received binary data. JSON uses text frames. Use a binary encoder for binary data.");
|
|
18
|
-
return JSON.parse(data);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region src/adapters/ws.ts
|
|
24
|
-
var import_objectSpread2 = __toESM(require_objectSpread2(), 1);
|
|
25
|
-
var import_usingCtx = __toESM(require_usingCtx(), 1);
|
|
26
|
-
/**
|
|
27
|
-
* Importing ws causes a build error
|
|
28
|
-
* @see https://github.com/trpc/trpc/pull/5279
|
|
29
|
-
*/
|
|
30
|
-
const WEBSOCKET_OPEN = 1;
|
|
31
|
-
function getWSConnectionHandler(opts) {
|
|
32
|
-
var _opts$experimental_en;
|
|
33
|
-
const { createContext, router } = opts;
|
|
34
|
-
const { transformer } = router._def._config;
|
|
35
|
-
const encoder = (_opts$experimental_en = opts.experimental_encoder) !== null && _opts$experimental_en !== void 0 ? _opts$experimental_en : jsonEncoder;
|
|
36
|
-
return (client, req) => {
|
|
37
|
-
var _opts$keepAlive;
|
|
38
|
-
const clientSubscriptions = /* @__PURE__ */ new Map();
|
|
39
|
-
const abortController = new AbortController();
|
|
40
|
-
if ((_opts$keepAlive = opts.keepAlive) === null || _opts$keepAlive === void 0 ? void 0 : _opts$keepAlive.enabled) {
|
|
41
|
-
const { pingMs, pongWaitMs } = opts.keepAlive;
|
|
42
|
-
handleKeepAlive(client, pingMs, pongWaitMs);
|
|
43
|
-
}
|
|
44
|
-
function respond(untransformedJSON) {
|
|
45
|
-
client.send(encoder.encode(transformTRPCResponse(router._def._config, untransformedJSON)));
|
|
46
|
-
}
|
|
47
|
-
async function createCtxPromise(getConnectionParams) {
|
|
48
|
-
try {
|
|
49
|
-
return await run(async () => {
|
|
50
|
-
ctx = await (createContext === null || createContext === void 0 ? void 0 : createContext({
|
|
51
|
-
req,
|
|
52
|
-
res: client,
|
|
53
|
-
info: {
|
|
54
|
-
connectionParams: getConnectionParams(),
|
|
55
|
-
calls: [],
|
|
56
|
-
isBatchCall: false,
|
|
57
|
-
accept: null,
|
|
58
|
-
type: "unknown",
|
|
59
|
-
signal: abortController.signal,
|
|
60
|
-
url: null
|
|
61
|
-
}
|
|
62
|
-
}));
|
|
63
|
-
return {
|
|
64
|
-
ok: true,
|
|
65
|
-
value: ctx
|
|
66
|
-
};
|
|
67
|
-
});
|
|
68
|
-
} catch (cause) {
|
|
69
|
-
var _opts$onError, _globalThis$setImmedi;
|
|
70
|
-
const error = getTRPCErrorFromUnknown(cause);
|
|
71
|
-
(_opts$onError = opts.onError) === null || _opts$onError === void 0 || _opts$onError.call(opts, {
|
|
72
|
-
error,
|
|
73
|
-
path: void 0,
|
|
74
|
-
type: "unknown",
|
|
75
|
-
ctx,
|
|
76
|
-
req,
|
|
77
|
-
input: void 0
|
|
78
|
-
});
|
|
79
|
-
respond({
|
|
80
|
-
id: null,
|
|
81
|
-
error: getErrorShape({
|
|
82
|
-
config: router._def._config,
|
|
83
|
-
error,
|
|
84
|
-
type: "unknown",
|
|
85
|
-
path: void 0,
|
|
86
|
-
input: void 0,
|
|
87
|
-
ctx
|
|
88
|
-
})
|
|
89
|
-
});
|
|
90
|
-
((_globalThis$setImmedi = globalThis.setImmediate) !== null && _globalThis$setImmedi !== void 0 ? _globalThis$setImmedi : globalThis.setTimeout)(() => {
|
|
91
|
-
client.close();
|
|
92
|
-
});
|
|
93
|
-
return {
|
|
94
|
-
ok: false,
|
|
95
|
-
error
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
let ctx = void 0;
|
|
100
|
-
/**
|
|
101
|
-
* promise for initializing the context
|
|
102
|
-
*
|
|
103
|
-
* - the context promise will be created immediately on connection if no connectionParams are expected
|
|
104
|
-
* - if connection params are expected, they will be created once received
|
|
105
|
-
*/
|
|
106
|
-
let ctxPromise = createURL(req).searchParams.get("connectionParams") === "1" ? null : createCtxPromise(() => null);
|
|
107
|
-
function handleRequest(msg, batchIndex) {
|
|
108
|
-
const { id, jsonrpc } = msg;
|
|
109
|
-
if (id === null) {
|
|
110
|
-
var _opts$onError2;
|
|
111
|
-
const error = getTRPCErrorFromUnknown(new TRPCError({
|
|
112
|
-
code: "PARSE_ERROR",
|
|
113
|
-
message: "`id` is required"
|
|
114
|
-
}));
|
|
115
|
-
(_opts$onError2 = opts.onError) === null || _opts$onError2 === void 0 || _opts$onError2.call(opts, {
|
|
116
|
-
error,
|
|
117
|
-
path: void 0,
|
|
118
|
-
type: "unknown",
|
|
119
|
-
ctx,
|
|
120
|
-
req,
|
|
121
|
-
input: void 0
|
|
122
|
-
});
|
|
123
|
-
respond({
|
|
124
|
-
id,
|
|
125
|
-
jsonrpc,
|
|
126
|
-
error: getErrorShape({
|
|
127
|
-
config: router._def._config,
|
|
128
|
-
error,
|
|
129
|
-
type: "unknown",
|
|
130
|
-
path: void 0,
|
|
131
|
-
input: void 0,
|
|
132
|
-
ctx
|
|
133
|
-
})
|
|
134
|
-
});
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
if (msg.method === "subscription.stop") {
|
|
138
|
-
var _clientSubscriptions$;
|
|
139
|
-
(_clientSubscriptions$ = clientSubscriptions.get(id)) === null || _clientSubscriptions$ === void 0 || _clientSubscriptions$.abort();
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
const { path, lastEventId } = msg.params;
|
|
143
|
-
let { input } = msg.params;
|
|
144
|
-
const type = msg.method;
|
|
145
|
-
if (lastEventId !== void 0) if (isObject(input)) input = (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, input), {}, { lastEventId });
|
|
146
|
-
else {
|
|
147
|
-
var _input;
|
|
148
|
-
(_input = input) !== null && _input !== void 0 || (input = { lastEventId });
|
|
149
|
-
}
|
|
150
|
-
run(async () => {
|
|
151
|
-
const res = await ctxPromise;
|
|
152
|
-
if (!res.ok) throw res.error;
|
|
153
|
-
const abortController$1 = new AbortController();
|
|
154
|
-
const result = await callProcedure({
|
|
155
|
-
router,
|
|
156
|
-
path,
|
|
157
|
-
getRawInput: async () => input,
|
|
158
|
-
ctx,
|
|
159
|
-
type,
|
|
160
|
-
signal: abortController$1.signal,
|
|
161
|
-
batchIndex
|
|
162
|
-
});
|
|
163
|
-
const isIterableResult = isAsyncIterable(result) || isObservable(result);
|
|
164
|
-
if (type !== "subscription") {
|
|
165
|
-
if (isIterableResult) throw new TRPCError({
|
|
166
|
-
code: "UNSUPPORTED_MEDIA_TYPE",
|
|
167
|
-
message: `Cannot return an async iterable or observable from a ${type} procedure with WebSockets`
|
|
168
|
-
});
|
|
169
|
-
respond({
|
|
170
|
-
id,
|
|
171
|
-
jsonrpc,
|
|
172
|
-
result: {
|
|
173
|
-
type: "data",
|
|
174
|
-
data: result
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
if (!isIterableResult) throw new TRPCError({
|
|
180
|
-
message: `Subscription ${path} did not return an observable or a AsyncGenerator`,
|
|
181
|
-
code: "INTERNAL_SERVER_ERROR"
|
|
182
|
-
});
|
|
183
|
-
/* istanbul ignore next -- @preserve */
|
|
184
|
-
if (client.readyState !== WEBSOCKET_OPEN) return;
|
|
185
|
-
/* istanbul ignore next -- @preserve */
|
|
186
|
-
if (clientSubscriptions.has(id)) throw new TRPCError({
|
|
187
|
-
message: `Duplicate id ${id}`,
|
|
188
|
-
code: "BAD_REQUEST"
|
|
189
|
-
});
|
|
190
|
-
const iterable = isObservable(result) ? observableToAsyncIterable(result, abortController$1.signal) : result;
|
|
191
|
-
run(async () => {
|
|
192
|
-
try {
|
|
193
|
-
var _usingCtx = (0, import_usingCtx.default)();
|
|
194
|
-
const iterator = _usingCtx.a(iteratorResource(iterable));
|
|
195
|
-
const abortPromise = new Promise((resolve) => {
|
|
196
|
-
abortController$1.signal.onabort = () => resolve("abort");
|
|
197
|
-
});
|
|
198
|
-
let next;
|
|
199
|
-
let result$1;
|
|
200
|
-
while (true) {
|
|
201
|
-
next = await Unpromise.race([iterator.next().catch(getTRPCErrorFromUnknown), abortPromise]);
|
|
202
|
-
if (next === "abort") {
|
|
203
|
-
var _iterator$return;
|
|
204
|
-
await ((_iterator$return = iterator.return) === null || _iterator$return === void 0 ? void 0 : _iterator$return.call(iterator));
|
|
205
|
-
break;
|
|
206
|
-
}
|
|
207
|
-
if (next instanceof Error) {
|
|
208
|
-
var _opts$onError3;
|
|
209
|
-
const error = getTRPCErrorFromUnknown(next);
|
|
210
|
-
(_opts$onError3 = opts.onError) === null || _opts$onError3 === void 0 || _opts$onError3.call(opts, {
|
|
211
|
-
error,
|
|
212
|
-
path,
|
|
213
|
-
type,
|
|
214
|
-
ctx,
|
|
215
|
-
req,
|
|
216
|
-
input
|
|
217
|
-
});
|
|
218
|
-
respond({
|
|
219
|
-
id,
|
|
220
|
-
jsonrpc,
|
|
221
|
-
error: getErrorShape({
|
|
222
|
-
config: router._def._config,
|
|
223
|
-
error,
|
|
224
|
-
type,
|
|
225
|
-
path,
|
|
226
|
-
input,
|
|
227
|
-
ctx
|
|
228
|
-
})
|
|
229
|
-
});
|
|
230
|
-
break;
|
|
231
|
-
}
|
|
232
|
-
if (next.done) break;
|
|
233
|
-
result$1 = {
|
|
234
|
-
type: "data",
|
|
235
|
-
data: next.value
|
|
236
|
-
};
|
|
237
|
-
if (isTrackedEnvelope(next.value)) {
|
|
238
|
-
const [id$1, data] = next.value;
|
|
239
|
-
result$1.id = id$1;
|
|
240
|
-
result$1.data = {
|
|
241
|
-
id: id$1,
|
|
242
|
-
data
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
respond({
|
|
246
|
-
id,
|
|
247
|
-
jsonrpc,
|
|
248
|
-
result: result$1
|
|
249
|
-
});
|
|
250
|
-
next = null;
|
|
251
|
-
result$1 = null;
|
|
252
|
-
}
|
|
253
|
-
respond({
|
|
254
|
-
id,
|
|
255
|
-
jsonrpc,
|
|
256
|
-
result: { type: "stopped" }
|
|
257
|
-
});
|
|
258
|
-
clientSubscriptions.delete(id);
|
|
259
|
-
} catch (_) {
|
|
260
|
-
_usingCtx.e = _;
|
|
261
|
-
} finally {
|
|
262
|
-
await _usingCtx.d();
|
|
263
|
-
}
|
|
264
|
-
}).catch((cause) => {
|
|
265
|
-
var _opts$onError4;
|
|
266
|
-
const error = getTRPCErrorFromUnknown(cause);
|
|
267
|
-
(_opts$onError4 = opts.onError) === null || _opts$onError4 === void 0 || _opts$onError4.call(opts, {
|
|
268
|
-
error,
|
|
269
|
-
path,
|
|
270
|
-
type,
|
|
271
|
-
ctx,
|
|
272
|
-
req,
|
|
273
|
-
input
|
|
274
|
-
});
|
|
275
|
-
respond({
|
|
276
|
-
id,
|
|
277
|
-
jsonrpc,
|
|
278
|
-
error: getErrorShape({
|
|
279
|
-
config: router._def._config,
|
|
280
|
-
error,
|
|
281
|
-
type,
|
|
282
|
-
path,
|
|
283
|
-
input,
|
|
284
|
-
ctx
|
|
285
|
-
})
|
|
286
|
-
});
|
|
287
|
-
abortController$1.abort();
|
|
288
|
-
});
|
|
289
|
-
clientSubscriptions.set(id, abortController$1);
|
|
290
|
-
respond({
|
|
291
|
-
id,
|
|
292
|
-
jsonrpc,
|
|
293
|
-
result: { type: "started" }
|
|
294
|
-
});
|
|
295
|
-
}).catch((cause) => {
|
|
296
|
-
var _opts$onError5;
|
|
297
|
-
const error = getTRPCErrorFromUnknown(cause);
|
|
298
|
-
(_opts$onError5 = opts.onError) === null || _opts$onError5 === void 0 || _opts$onError5.call(opts, {
|
|
299
|
-
error,
|
|
300
|
-
path,
|
|
301
|
-
type,
|
|
302
|
-
ctx,
|
|
303
|
-
req,
|
|
304
|
-
input
|
|
305
|
-
});
|
|
306
|
-
respond({
|
|
307
|
-
id,
|
|
308
|
-
jsonrpc,
|
|
309
|
-
error: getErrorShape({
|
|
310
|
-
config: router._def._config,
|
|
311
|
-
error,
|
|
312
|
-
type,
|
|
313
|
-
path,
|
|
314
|
-
input,
|
|
315
|
-
ctx
|
|
316
|
-
})
|
|
317
|
-
});
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
client.on("message", (rawData, isBinary) => {
|
|
321
|
-
if (!isBinary) {
|
|
322
|
-
const msgStr = rawData.toString();
|
|
323
|
-
if (msgStr === "PONG") return;
|
|
324
|
-
if (msgStr === "PING") {
|
|
325
|
-
if (!opts.dangerouslyDisablePong) client.send("PONG");
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
if (!Buffer.isBuffer(rawData)) {
|
|
330
|
-
const error = new TRPCError({
|
|
331
|
-
code: "UNPROCESSABLE_CONTENT",
|
|
332
|
-
message: "Unexpected WebSocket message format"
|
|
333
|
-
});
|
|
334
|
-
respond({
|
|
335
|
-
id: null,
|
|
336
|
-
error: getErrorShape({
|
|
337
|
-
config: router._def._config,
|
|
338
|
-
error,
|
|
339
|
-
type: "unknown",
|
|
340
|
-
path: void 0,
|
|
341
|
-
input: void 0,
|
|
342
|
-
ctx
|
|
343
|
-
})
|
|
344
|
-
});
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
const data = isBinary ? rawData : rawData.toString("utf8");
|
|
348
|
-
if (!ctxPromise) {
|
|
349
|
-
ctxPromise = createCtxPromise(() => {
|
|
350
|
-
let msg;
|
|
351
|
-
try {
|
|
352
|
-
msg = encoder.decode(data);
|
|
353
|
-
if (!isObject(msg)) throw new Error("Message was not an object");
|
|
354
|
-
} catch (cause) {
|
|
355
|
-
throw new TRPCError({
|
|
356
|
-
code: "PARSE_ERROR",
|
|
357
|
-
message: `Malformed TRPCConnectionParamsMessage`,
|
|
358
|
-
cause
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
const connectionParams = parseConnectionParamsFromUnknown(msg.data);
|
|
362
|
-
return connectionParams;
|
|
363
|
-
});
|
|
364
|
-
return;
|
|
365
|
-
}
|
|
366
|
-
const parsedMsgs = run(() => {
|
|
367
|
-
try {
|
|
368
|
-
const msgJSON = encoder.decode(data);
|
|
369
|
-
const msgs = Array.isArray(msgJSON) ? msgJSON : [msgJSON];
|
|
370
|
-
return msgs.map((raw) => parseTRPCMessage(raw, transformer));
|
|
371
|
-
} catch (cause) {
|
|
372
|
-
const error = new TRPCError({
|
|
373
|
-
code: "PARSE_ERROR",
|
|
374
|
-
cause
|
|
375
|
-
});
|
|
376
|
-
respond({
|
|
377
|
-
id: null,
|
|
378
|
-
error: getErrorShape({
|
|
379
|
-
config: router._def._config,
|
|
380
|
-
error,
|
|
381
|
-
type: "unknown",
|
|
382
|
-
path: void 0,
|
|
383
|
-
input: void 0,
|
|
384
|
-
ctx
|
|
385
|
-
})
|
|
386
|
-
});
|
|
387
|
-
return [];
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
|
-
parsedMsgs.map((msg, index) => handleRequest(msg, index));
|
|
391
|
-
});
|
|
392
|
-
client.on("error", (cause) => {
|
|
393
|
-
var _opts$onError6;
|
|
394
|
-
(_opts$onError6 = opts.onError) === null || _opts$onError6 === void 0 || _opts$onError6.call(opts, {
|
|
395
|
-
ctx,
|
|
396
|
-
error: getTRPCErrorFromUnknown(cause),
|
|
397
|
-
input: void 0,
|
|
398
|
-
path: void 0,
|
|
399
|
-
type: "unknown",
|
|
400
|
-
req
|
|
401
|
-
});
|
|
402
|
-
});
|
|
403
|
-
client.once("close", () => {
|
|
404
|
-
for (const sub of clientSubscriptions.values()) sub.abort();
|
|
405
|
-
clientSubscriptions.clear();
|
|
406
|
-
abortController.abort();
|
|
407
|
-
});
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* Handle WebSocket keep-alive messages
|
|
412
|
-
*/
|
|
413
|
-
function handleKeepAlive(client, pingMs = 3e4, pongWaitMs = 5e3) {
|
|
414
|
-
let timeout = void 0;
|
|
415
|
-
let ping = void 0;
|
|
416
|
-
const schedulePing = () => {
|
|
417
|
-
const scheduleTimeout = () => {
|
|
418
|
-
timeout = setTimeout(() => {
|
|
419
|
-
client.terminate();
|
|
420
|
-
}, pongWaitMs);
|
|
421
|
-
};
|
|
422
|
-
ping = setTimeout(() => {
|
|
423
|
-
client.send("PING");
|
|
424
|
-
scheduleTimeout();
|
|
425
|
-
}, pingMs);
|
|
426
|
-
};
|
|
427
|
-
const onMessage = () => {
|
|
428
|
-
clearTimeout(ping);
|
|
429
|
-
clearTimeout(timeout);
|
|
430
|
-
schedulePing();
|
|
431
|
-
};
|
|
432
|
-
client.on("message", onMessage);
|
|
433
|
-
client.on("close", () => {
|
|
434
|
-
clearTimeout(ping);
|
|
435
|
-
clearTimeout(timeout);
|
|
436
|
-
});
|
|
437
|
-
schedulePing();
|
|
438
|
-
}
|
|
439
|
-
function applyWSSHandler(opts) {
|
|
440
|
-
var _opts$experimental_en2;
|
|
441
|
-
const encoder = (_opts$experimental_en2 = opts.experimental_encoder) !== null && _opts$experimental_en2 !== void 0 ? _opts$experimental_en2 : jsonEncoder;
|
|
442
|
-
const onConnection = getWSConnectionHandler(opts);
|
|
443
|
-
opts.wss.on("connection", (client, req) => {
|
|
444
|
-
var _req$url;
|
|
445
|
-
if (opts.prefix && !((_req$url = req.url) === null || _req$url === void 0 ? void 0 : _req$url.startsWith(opts.prefix))) return;
|
|
446
|
-
onConnection(client, req);
|
|
447
|
-
});
|
|
448
|
-
return { broadcastReconnectNotification: () => {
|
|
449
|
-
const response = {
|
|
450
|
-
id: null,
|
|
451
|
-
method: "reconnect"
|
|
452
|
-
};
|
|
453
|
-
const data = encoder.encode(response);
|
|
454
|
-
for (const client of opts.wss.clients) if (client.readyState === WEBSOCKET_OPEN) client.send(data);
|
|
455
|
-
} };
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
//#endregion
|
|
459
|
-
export { applyWSSHandler, getWSConnectionHandler, handleKeepAlive, jsonEncoder };
|
|
460
|
-
//# sourceMappingURL=ws-CJgZE7Hg.mjs.map
|