@highstate/designer 0.20.0 → 0.21.1

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.
Files changed (224) hide show
  1. package/.output/nitro.json +4 -4
  2. package/.output/public/_nuxt/{f3TOpYbw.js → -OnKOwAh.js} +1 -1
  3. package/.output/public/_nuxt/32ctXXKs.js +1 -0
  4. package/.output/public/_nuxt/{DCR009rv.js → 5gjbd9sK.js} +1 -1
  5. package/.output/public/_nuxt/{DQHHT9y-.js → 9OHRRPkh.js} +1 -1
  6. package/.output/public/_nuxt/{Dbwml2gB.js → B-dJABhs.js} +1 -1
  7. package/.output/public/_nuxt/{rcFevLEP.js → B2SoM2pd.js} +1 -1
  8. package/.output/public/_nuxt/{G13IRnB2.js → B4FDp1sn.js} +1 -1
  9. package/.output/public/_nuxt/{BxaP9l2T.js → B7RpoNQl.js} +1 -1
  10. package/.output/public/_nuxt/BA47KaF1.js +1 -0
  11. package/.output/public/_nuxt/{Cm-2nZ05.js → BArXRmKu.js} +1 -1
  12. package/.output/public/_nuxt/{ziXKbM2N.js → BCJKqJxW.js} +1 -1
  13. package/.output/public/_nuxt/{BDs6uo3D.js → BD_Kvn-W.js} +1 -1
  14. package/.output/public/_nuxt/{CV5MeYf9.js → BIPWeF69.js} +1 -1
  15. package/.output/public/_nuxt/{DxERyYWQ.js → BKIVPvZX.js} +1 -1
  16. package/.output/public/_nuxt/BN7gUcg9.js +1 -0
  17. package/.output/public/_nuxt/{CcOKGYBt.js → BTd2ZN65.js} +1 -1
  18. package/.output/public/_nuxt/{D6fh7rEe.js → BXphdu9w.js} +1 -1
  19. package/.output/public/_nuxt/{BuJgCY_C.js → BYmSxWA_.js} +1 -1
  20. package/.output/public/_nuxt/{BkNNRtnm.js → BdRuKvw2.js} +1 -1
  21. package/.output/public/_nuxt/{BA0jw7CM.js → Bdd5S2WL.js} +1 -1
  22. package/.output/public/_nuxt/BeH2EWoN.js +1 -0
  23. package/.output/public/_nuxt/{CPZSvMBB.js → BhozkjGO.js} +1 -1
  24. package/.output/public/_nuxt/{xp27HhqZ.js → Bl_Sz9PU.js} +1 -1
  25. package/.output/public/_nuxt/{ChaZkl1J.js → Bs8TB6Bu.js} +1 -1
  26. package/.output/public/_nuxt/{DsS90Fp6.js → BtrNScOx.js} +1 -1
  27. package/.output/public/_nuxt/{DyMmfYiE.js → Bu1xs0Fv.js} +1 -1
  28. package/.output/public/_nuxt/{o_m1mZtJ.js → BupMEc6X.js} +1 -1
  29. package/.output/public/_nuxt/{GDxZ_Nvm.js → Bv_vOb-Y.js} +1 -1
  30. package/.output/public/_nuxt/{rgN_MdZl.js → BwKAHWnp.js} +1 -1
  31. package/.output/public/_nuxt/{CaJ-zn_Z.js → ByE1aAlg.js} +1 -1
  32. package/.output/public/_nuxt/{BDAHnC4j.js → BzhaMbyl.js} +1 -1
  33. package/.output/public/_nuxt/{Aopv2gwH.js → C2zyO9uX.js} +1 -1
  34. package/.output/public/_nuxt/{DOMRsNpU.js → C4XpvUuq.js} +1 -1
  35. package/.output/public/_nuxt/C5BYcBs_.js +1 -0
  36. package/.output/public/_nuxt/{tsyQDnRt.js → C973_vs5.js} +1 -1
  37. package/.output/public/_nuxt/{BlfjmxyP.js → CBIEPWAA.js} +1 -1
  38. package/.output/public/_nuxt/{BUNf2Yb8.js → CBVcjGJL.js} +1 -1
  39. package/.output/public/_nuxt/CENFIVCM.js +1 -0
  40. package/.output/public/_nuxt/{DCinzvm1.js → CJN4g-3R.js} +1 -1
  41. package/.output/public/_nuxt/{DCBCRx0O.js → CPsHsqGU.js} +1 -1
  42. package/.output/public/_nuxt/{DWQRqdcR.js → CTRkBkra.js} +1 -1
  43. package/.output/public/_nuxt/{BLF3u89x.js → CYL3VlR9.js} +1 -1
  44. package/.output/public/_nuxt/CYpkKp66.js +1 -0
  45. package/.output/public/_nuxt/{D27ZAKIj.js → CaehGOgh.js} +1 -1
  46. package/.output/public/_nuxt/{CxEW7TG8.js → CemiMtCX.js} +1 -1
  47. package/.output/public/_nuxt/{CGscLIrv.js → CgK0fS9t.js} +1 -1
  48. package/.output/public/_nuxt/{n0RAZLbO.js → CmJE87KM.js} +1 -1
  49. package/.output/public/_nuxt/Cn-bp-IR.js +1 -0
  50. package/.output/public/_nuxt/{xdsXwj_J.js → CnhVSb6R.js} +1 -1
  51. package/.output/public/_nuxt/{9I37tBe7.js → CpGRan2R.js} +1 -1
  52. package/.output/public/_nuxt/{C1FLL1Qz.js → CqQg8Ldy.js} +1 -1
  53. package/.output/public/_nuxt/{BJK6uMxG.js → Cs-GjQ8R.js} +1 -1
  54. package/.output/public/_nuxt/{BPcwi1q2.js → CtbC3i8L.js} +1 -1
  55. package/.output/public/_nuxt/{xA6NntuA.js → CvSiusML.js} +1 -1
  56. package/.output/public/_nuxt/CxoCegAs.js +13 -0
  57. package/.output/public/_nuxt/{BpkvlDNi.js → Cz-197mS.js} +1 -1
  58. package/.output/public/_nuxt/Cz2AlsmD.js +1 -0
  59. package/.output/public/_nuxt/{CJWmG4YP.js → D-7HtdRe.js} +1 -1
  60. package/.output/public/_nuxt/{Dg5xB15N.js → D82vCrfD.js} +1 -1
  61. package/.output/public/_nuxt/D8l8udqQ.js +1 -0
  62. package/.output/public/_nuxt/{mUFnM-_q.js → DCK6hB22.js} +1 -1
  63. package/.output/public/_nuxt/{RNghxpo_.js → DDvzSYfr.js} +1 -1
  64. package/.output/public/_nuxt/{BEEt8Am7.js → DEtIJe2u.js} +1 -1
  65. package/.output/public/_nuxt/{BDa1f6PF.js → DHJ62FKo.js} +1 -1
  66. package/.output/public/_nuxt/{DiTMzCP2.js → DKWXhhCy.js} +1 -1
  67. package/.output/public/_nuxt/DPOp833l.js +1 -0
  68. package/.output/public/_nuxt/DRJZaHtK.js +1 -0
  69. package/.output/public/_nuxt/{RCBWmVHz.js → DSDbyhpJ.js} +1 -1
  70. package/.output/public/_nuxt/{TsXTqZ29.js → DSeZwD4N.js} +1 -1
  71. package/.output/public/_nuxt/{DNqd6Nek.js → DSpiceQe.js} +1 -1
  72. package/.output/public/_nuxt/{CzSiA7V6.js → DTPYfUid.js} +1 -1
  73. package/.output/public/_nuxt/{BCVaR2pQ.js → DUHba1vY.js} +1 -1
  74. package/.output/public/_nuxt/{D2obegTF.js → DXyfavJr.js} +1 -1
  75. package/.output/public/_nuxt/DYE7WIF3.js +1 -0
  76. package/.output/public/_nuxt/{ZbicA1ry.js → D_wY_uke.js} +1 -1
  77. package/.output/public/_nuxt/{DKhcu7kD.js → Dahes9VH.js} +1 -1
  78. package/.output/public/_nuxt/{D-wGZMZP.js → DdvHdmGh.js} +1 -1
  79. package/.output/public/_nuxt/DgsIRcX7.js +1 -0
  80. package/.output/public/_nuxt/{BtvRca6l.js → DjAJT7YJ.js} +1 -1
  81. package/.output/public/_nuxt/{DzWdbJvx.js → Djg8J2AC.js} +1 -1
  82. package/.output/public/_nuxt/{CudFwYib.js → DkkrdwgN.js} +1 -1
  83. package/.output/public/_nuxt/{pxXmJ8QX.js → DnpKvmH_.js} +1 -1
  84. package/.output/public/_nuxt/{B8nw2aST.js → DrWe3t51.js} +1 -1
  85. package/.output/public/_nuxt/{D2aToa54.js → DsG1SoRB.js} +1 -1
  86. package/.output/public/_nuxt/{8MSfy8uY.js → DtBrxin9.js} +1 -1
  87. package/.output/public/_nuxt/{B13uiJCv.js → EnN6XTXK.js} +1 -1
  88. package/.output/public/_nuxt/{DJN0y8jO.js → Fcs-0n6A.js} +1 -1
  89. package/.output/public/_nuxt/{DQwYQDb2.js → FtFNcQmh.js} +1 -1
  90. package/.output/public/_nuxt/{C8lm7lgC.js → GXzlut8R.js} +1 -1
  91. package/.output/public/_nuxt/{xrNU8mHG.js → Lks7C8cK.js} +1 -1
  92. package/.output/public/_nuxt/M0WOzN-S.js +269 -0
  93. package/.output/public/_nuxt/{d-NZQb9b.js → OuCcJFrZ.js} +1 -1
  94. package/.output/public/_nuxt/{GgtqCdye.js → UD_auLNX.js} +1 -1
  95. package/.output/public/_nuxt/Ve4PFQV2.js +1 -0
  96. package/.output/public/_nuxt/{57B6Rca8.js → ZpmLW6rw.js} +1 -1
  97. package/.output/public/_nuxt/_H4v1dQx.js +1 -0
  98. package/.output/public/_nuxt/builds/latest.json +1 -1
  99. package/.output/public/_nuxt/builds/meta/d356de5d-6230-4e66-aba2-c48f455ae207.json +1 -0
  100. package/.output/public/_nuxt/builds/meta/ed797280-2bf0-44e6-a601-2ff2462bfbbc.json +1 -0
  101. package/.output/public/_nuxt/{CPpO8vcZ.js → c6k-jVO-.js} +1 -1
  102. package/.output/public/_nuxt/eo99z4R2.js +1 -0
  103. package/.output/public/_nuxt/error-404.iOXvqd5J.css +1 -0
  104. package/.output/public/_nuxt/error-500.D0BgXBui.css +1 -0
  105. package/.output/public/_nuxt/graph-resolver-E9RSC1Ga.js +180 -0
  106. package/.output/public/_nuxt/{DWa2aw6r.js → hAFXcJ2_.js} +1 -1
  107. package/.output/public/_nuxt/monaco-editor.DOXZIHvr.css +1 -0
  108. package/.output/public/_nuxt/oH_c3LbQ.js +1 -0
  109. package/.output/public/_nuxt/rZm6bMo-.js +1 -0
  110. package/.output/public/_nuxt/{ByBNG4eo.js → rscZxuQ2.js} +1 -1
  111. package/.output/public/_nuxt/sB5TSp0H.js +18 -0
  112. package/.output/public/_nuxt/{DOPqH6_T.js → wCosSBIO.js} +1 -1
  113. package/.output/public/_nuxt/{DRfxs3PN.js → xnReCuE4.js} +1 -1
  114. package/.output/public/_nuxt/{D5z-4QVk.js → y0GN4iGv.js} +1 -1
  115. package/.output/public/_nuxt/{yaml.worker-C1Cl1y5J.js → yaml.worker-CYOhFCVP.js} +248 -252
  116. package/.output/server/index.mjs +3959 -9221
  117. package/.output/server/index.mjs.map +1 -1
  118. package/.output/server/node_modules/@babel/parser/lib/index.js +1 -1
  119. package/.output/server/node_modules/@babel/parser/package.json +1 -1
  120. package/.output/server/node_modules/@trpc/server/dist/adapters/fetch/index.cjs +57 -0
  121. package/.output/server/node_modules/@trpc/server/dist/adapters/fetch/index.mjs +2 -2
  122. package/.output/server/node_modules/@trpc/server/dist/codes-BfZsPdy-.cjs +222 -0
  123. package/.output/server/node_modules/@trpc/server/dist/{contentTypeParsers-SN4WL9ze.mjs → contentTypeParsers-iAFF_pJG.cjs} +7 -2
  124. package/.output/server/node_modules/@trpc/server/dist/getErrorShape-MR4DZeb7.cjs +341 -0
  125. package/.output/server/node_modules/@trpc/server/dist/http.cjs +14 -0
  126. package/.output/server/node_modules/@trpc/server/dist/index.cjs +22 -0
  127. package/.output/server/node_modules/@trpc/server/dist/index.mjs +2 -2
  128. package/.output/server/node_modules/@trpc/server/dist/{initTRPC-RoZMIBeA.mjs → initTRPC-B1ggxyJl.mjs} +2 -2
  129. package/.output/server/node_modules/@trpc/server/dist/initTRPC-BXPPV9Tx.cjs +416 -0
  130. package/.output/server/node_modules/@trpc/server/dist/observable/index.cjs +13 -0
  131. package/.output/server/node_modules/@trpc/server/dist/observable-B1Nk6r1H.cjs +181 -0
  132. package/.output/server/node_modules/@trpc/server/dist/{observable-CUiPknO-.mjs → observable-BVzLuBs6.cjs} +42 -8
  133. package/.output/server/node_modules/@trpc/server/dist/{parseTRPCMessage-CTow-umk.mjs → parseTRPCMessage-7Ltmq-Fb.cjs} +14 -4
  134. package/.output/server/node_modules/@trpc/server/dist/resolveResponse-B0CCg8nq.cjs +2365 -0
  135. package/.output/server/node_modules/@trpc/server/dist/{resolveResponse-BVDlNZwN.mjs → resolveResponse-C5I6V_wc.mjs} +67 -18
  136. package/.output/server/node_modules/@trpc/server/dist/rpc.cjs +6 -0
  137. package/.output/server/node_modules/@trpc/server/dist/{tracked-Bjtgv3wJ.mjs → tracked-DiE3uR1B.mjs} +12 -3
  138. package/.output/server/node_modules/@trpc/server/dist/tracked-Dj_dpOJE.cjs +486 -0
  139. package/.output/server/node_modules/@trpc/server/package.json +15 -5
  140. package/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +2 -2
  141. package/.output/server/node_modules/@vue/compiler-core/package.json +3 -3
  142. package/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +1 -1
  143. package/.output/server/node_modules/@vue/compiler-dom/package.json +3 -3
  144. package/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1 -1
  145. package/.output/server/node_modules/@vue/compiler-ssr/package.json +3 -3
  146. package/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +31 -13
  147. package/.output/server/node_modules/@vue/reactivity/package.json +2 -2
  148. package/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +144 -81
  149. package/.output/server/node_modules/@vue/runtime-core/package.json +3 -3
  150. package/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +70 -9
  151. package/.output/server/node_modules/@vue/runtime-dom/package.json +4 -4
  152. package/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +6 -2
  153. package/.output/server/node_modules/@vue/server-renderer/package.json +4 -4
  154. package/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +1 -1
  155. package/.output/server/node_modules/@vue/shared/package.json +1 -1
  156. package/.output/server/node_modules/devalue/package.json +5 -2
  157. package/.output/server/node_modules/devalue/src/base64.js +46 -96
  158. package/.output/server/node_modules/devalue/src/parse.js +32 -10
  159. package/.output/server/node_modules/devalue/src/stringify.js +13 -28
  160. package/.output/server/node_modules/devalue/src/uneval.js +117 -55
  161. package/.output/server/node_modules/devalue/src/utils.js +3 -7
  162. package/.output/server/node_modules/hookable/dist/index.mjs +5 -14
  163. package/.output/server/node_modules/hookable/package.json +24 -23
  164. package/.output/server/node_modules/trpc-bun-adapter/dist/index.js +406 -0
  165. package/.output/server/node_modules/trpc-bun-adapter/package.json +44 -0
  166. package/.output/server/node_modules/unhead/dist/plugins.mjs +3 -3
  167. package/.output/server/node_modules/unhead/dist/server.mjs +2 -2
  168. package/.output/server/node_modules/unhead/dist/shared/{unhead.eK9_7LaY.mjs → unhead.B5FWS6X0.mjs} +22 -13
  169. package/.output/server/node_modules/unhead/dist/shared/{unhead.BFfcxOoW.mjs → unhead.Ct24BOby.mjs} +4 -2
  170. package/.output/server/node_modules/unhead/dist/shared/unhead.D4vSFytZ.mjs +236 -0
  171. package/.output/server/node_modules/unhead/dist/shared/{unhead.ckV6dpEQ.mjs → unhead.TxTMM7cM.mjs} +1 -1
  172. package/.output/server/node_modules/unhead/dist/utils.mjs +1 -1
  173. package/.output/server/node_modules/unhead/package.json +1 -1
  174. package/.output/server/node_modules/vue/dist/vue.cjs.js +1 -1
  175. package/.output/server/node_modules/vue/dist/vue.cjs.prod.js +1 -1
  176. package/.output/server/node_modules/vue/package.json +7 -7
  177. package/.output/server/package.json +16 -16
  178. package/package.json +20 -14
  179. package/.output/public/_nuxt/83L43bj1.js +0 -1
  180. package/.output/public/_nuxt/B93PlW-d.js +0 -1
  181. package/.output/public/_nuxt/BE_Meo09.js +0 -269
  182. package/.output/public/_nuxt/Ba13S78F.js +0 -1
  183. package/.output/public/_nuxt/BhRPY-oY.js +0 -1
  184. package/.output/public/_nuxt/Bhrxn6JZ.js +0 -1
  185. package/.output/public/_nuxt/Bo8jzlL1.js +0 -18
  186. package/.output/public/_nuxt/BrzmwbiE.js +0 -1
  187. package/.output/public/_nuxt/C-sUppwS.js +0 -1
  188. package/.output/public/_nuxt/C47S-Tmv.js +0 -1
  189. package/.output/public/_nuxt/CMjwMIkn.js +0 -1
  190. package/.output/public/_nuxt/CQ8jqdy-.js +0 -1
  191. package/.output/public/_nuxt/CjoLj4QM.js +0 -1
  192. package/.output/public/_nuxt/D91rOou-.js +0 -13
  193. package/.output/public/_nuxt/DMwsHuHA.js +0 -1
  194. package/.output/public/_nuxt/DYoxhk2S.js +0 -1
  195. package/.output/public/_nuxt/Dv7Oe6Be.js +0 -1
  196. package/.output/public/_nuxt/VCDPK7BO.js +0 -1
  197. package/.output/public/_nuxt/builds/meta/a1fec520-0c95-4ae0-af5e-964780fad341.json +0 -1
  198. package/.output/public/_nuxt/error-404.X7H_YhdC.css +0 -1
  199. package/.output/public/_nuxt/error-500.BOQe1fsk.css +0 -1
  200. package/.output/public/_nuxt/graph-resolver-DKNtntr2.js +0 -180
  201. package/.output/public/_nuxt/monaco-editor.D_J4ItrK.css +0 -1
  202. package/.output/server/node_modules/@trpc/server/dist/adapters/ws.mjs +0 -15
  203. package/.output/server/node_modules/@trpc/server/dist/node-http-DtA2iLK9.mjs +0 -224
  204. package/.output/server/node_modules/@trpc/server/dist/unstable-core-do-not-import-9NNw8uQM.mjs +0 -31
  205. package/.output/server/node_modules/@trpc/server/dist/ws-CJgZE7Hg.mjs +0 -460
  206. package/.output/server/node_modules/unhead/dist/shared/unhead.CApf5sj3.mjs +0 -148
  207. package/.output/server/node_modules/ws/lib/buffer-util.js +0 -131
  208. package/.output/server/node_modules/ws/lib/constants.js +0 -19
  209. package/.output/server/node_modules/ws/lib/event-target.js +0 -292
  210. package/.output/server/node_modules/ws/lib/extension.js +0 -203
  211. package/.output/server/node_modules/ws/lib/limiter.js +0 -55
  212. package/.output/server/node_modules/ws/lib/permessage-deflate.js +0 -528
  213. package/.output/server/node_modules/ws/lib/receiver.js +0 -706
  214. package/.output/server/node_modules/ws/lib/sender.js +0 -602
  215. package/.output/server/node_modules/ws/lib/stream.js +0 -161
  216. package/.output/server/node_modules/ws/lib/subprotocol.js +0 -62
  217. package/.output/server/node_modules/ws/lib/validation.js +0 -152
  218. package/.output/server/node_modules/ws/lib/websocket-server.js +0 -554
  219. package/.output/server/node_modules/ws/lib/websocket.js +0 -1393
  220. package/.output/server/node_modules/ws/package.json +0 -69
  221. package/.output/server/node_modules/ws/wrapper.mjs +0 -8
  222. package/LICENSE +0 -21
  223. /package/.output/public/_nuxt/{XEA9GSJd.js → B69Z0Xk1.js} +0 -0
  224. /package/.output/server/node_modules/@trpc/server/dist/{http-CWyjOa1l.mjs → http-DXy3XyhL.cjs} +0 -0
@@ -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
@@ -1,148 +0,0 @@
1
- import { u as unpackMeta } from './unhead.DQc16pHI.mjs';
2
-
3
- function defineHeadPlugin(plugin) {
4
- return plugin;
5
- }
6
-
7
- const FlatMetaPlugin = /* @__PURE__ */ defineHeadPlugin({
8
- key: "flatMeta",
9
- hooks: {
10
- "entries:normalize": (ctx) => {
11
- const tagsToAdd = [];
12
- ctx.tags = ctx.tags.map((t) => {
13
- if (t.tag !== "_flatMeta") {
14
- return t;
15
- }
16
- tagsToAdd.push(unpackMeta(t.props).map((p) => ({
17
- ...t,
18
- tag: "meta",
19
- props: p
20
- })));
21
- return false;
22
- }).filter(Boolean).concat(...tagsToAdd);
23
- }
24
- }
25
- });
26
-
27
- const WhitelistAttributes = {
28
- htmlAttrs: /* @__PURE__ */ new Set(["class", "style", "lang", "dir"]),
29
- bodyAttrs: /* @__PURE__ */ new Set(["class", "style"]),
30
- meta: /* @__PURE__ */ new Set(["name", "property", "charset", "content", "media"]),
31
- noscript: /* @__PURE__ */ new Set(["textContent"]),
32
- style: /* @__PURE__ */ new Set(["media", "textContent", "nonce", "title", "blocking"]),
33
- script: /* @__PURE__ */ new Set(["type", "textContent", "nonce", "blocking"]),
34
- link: /* @__PURE__ */ new Set(["color", "crossorigin", "fetchpriority", "href", "hreflang", "imagesrcset", "imagesizes", "integrity", "media", "referrerpolicy", "rel", "sizes", "type"])
35
- };
36
- function acceptDataAttrs(value) {
37
- return Object.fromEntries(
38
- Object.entries(value || {}).filter(([key]) => key === "id" || key.startsWith("data-"))
39
- );
40
- }
41
- function makeTagSafe(tag) {
42
- let next = {};
43
- const { tag: type, props: prev } = tag;
44
- switch (type) {
45
- // always safe
46
- case "title":
47
- case "titleTemplate":
48
- case "templateParams":
49
- next = prev;
50
- break;
51
- case "htmlAttrs":
52
- case "bodyAttrs":
53
- WhitelistAttributes[type].forEach((attr) => {
54
- if (prev[attr]) {
55
- next[attr] = prev[attr];
56
- }
57
- });
58
- break;
59
- case "style":
60
- next = acceptDataAttrs(prev);
61
- WhitelistAttributes.style.forEach((key) => {
62
- if (prev[key]) {
63
- next[key] = prev[key];
64
- }
65
- });
66
- break;
67
- // meta is safe, except for http-equiv
68
- case "meta":
69
- WhitelistAttributes.meta.forEach((key) => {
70
- if (prev[key]) {
71
- next[key] = prev[key];
72
- }
73
- });
74
- break;
75
- // link tags we don't allow stylesheets, scripts, preloading, prerendering, prefetching, etc
76
- case "link":
77
- WhitelistAttributes.link.forEach((key) => {
78
- const val = prev[key];
79
- if (!val) {
80
- return;
81
- }
82
- if (key === "rel" && (val === "canonical" || val === "modulepreload" || val === "prerender" || val === "preload" || val === "prefetch")) {
83
- return;
84
- }
85
- if (key === "href") {
86
- if (val.includes("javascript:") || val.includes("data:")) {
87
- return;
88
- }
89
- next[key] = val;
90
- } else if (val) {
91
- next[key] = val;
92
- }
93
- });
94
- if (!next.href && !next.imagesrcset || !next.rel) {
95
- return false;
96
- }
97
- break;
98
- case "noscript":
99
- WhitelistAttributes.noscript.forEach((key) => {
100
- if (prev[key]) {
101
- next[key] = prev[key];
102
- }
103
- });
104
- break;
105
- // we only allow JSON in scripts
106
- case "script":
107
- if (!tag.textContent || !prev.type?.endsWith("json")) {
108
- return false;
109
- }
110
- WhitelistAttributes.script.forEach((s) => {
111
- if (prev[s] === "textContent") {
112
- try {
113
- const jsonVal = typeof prev[s] === "string" ? JSON.parse(prev[s]) : prev[s];
114
- next[s] = JSON.stringify(jsonVal, null, 0);
115
- } catch {
116
- }
117
- } else if (prev[s]) {
118
- next[s] = prev[s];
119
- }
120
- });
121
- break;
122
- }
123
- if (!Object.keys(next).length && !tag.tag.endsWith("Attrs")) {
124
- return false;
125
- }
126
- tag.props = { ...acceptDataAttrs(prev), ...next };
127
- return tag;
128
- }
129
- const SafeInputPlugin = (
130
- /* @PURE */
131
- defineHeadPlugin({
132
- key: "safe",
133
- hooks: {
134
- "entries:normalize": (ctx) => {
135
- if (ctx.entry.options?._safe) {
136
- ctx.tags = ctx.tags.reduce((acc, tag) => {
137
- const safeTag = makeTagSafe(tag);
138
- if (safeTag)
139
- acc.push(safeTag);
140
- return acc;
141
- }, []);
142
- }
143
- }
144
- }
145
- })
146
- );
147
-
148
- export { FlatMetaPlugin as F, SafeInputPlugin as S, defineHeadPlugin as d };