@trpc/server 11.3.1 → 11.3.2-canary.4

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 (465) hide show
  1. package/adapters/aws-lambda/package.json +1 -0
  2. package/adapters/express/package.json +1 -0
  3. package/adapters/fastify/package.json +1 -0
  4. package/adapters/fetch/package.json +1 -0
  5. package/adapters/next/package.json +1 -0
  6. package/adapters/next-app-dir/package.json +1 -0
  7. package/adapters/node-http/package.json +1 -0
  8. package/adapters/standalone/package.json +1 -0
  9. package/adapters/ws/package.json +1 -0
  10. package/dist/adapters/aws-lambda/index.cjs +255 -0
  11. package/dist/adapters/aws-lambda/index.d.cts +31 -0
  12. package/dist/adapters/aws-lambda/index.d.cts.map +1 -0
  13. package/dist/adapters/aws-lambda/index.d.mts +31 -0
  14. package/dist/adapters/aws-lambda/index.d.mts.map +1 -0
  15. package/dist/adapters/aws-lambda/index.mjs +248 -57
  16. package/dist/adapters/aws-lambda/index.mjs.map +1 -0
  17. package/dist/adapters/express.cjs +34 -0
  18. package/dist/adapters/express.d.cts +15 -0
  19. package/dist/adapters/express.d.cts.map +1 -0
  20. package/dist/adapters/express.d.mts +15 -0
  21. package/dist/adapters/express.d.mts.map +1 -0
  22. package/dist/adapters/express.mjs +30 -32
  23. package/dist/adapters/express.mjs.map +1 -0
  24. package/dist/adapters/fastify/index.cjs +75 -0
  25. package/dist/adapters/fastify/index.d.cts +29 -0
  26. package/dist/adapters/fastify/index.d.cts.map +1 -0
  27. package/dist/adapters/fastify/index.d.mts +29 -0
  28. package/dist/adapters/fastify/index.d.mts.map +1 -0
  29. package/dist/adapters/fastify/index.mjs +75 -2
  30. package/dist/adapters/fastify/index.mjs.map +1 -0
  31. package/dist/adapters/fetch/index.cjs +58 -0
  32. package/dist/adapters/fetch/index.d.cts +30 -0
  33. package/dist/adapters/fetch/index.d.cts.map +1 -0
  34. package/dist/adapters/fetch/index.d.mts +30 -0
  35. package/dist/adapters/fetch/index.d.mts.map +1 -0
  36. package/dist/adapters/fetch/index.mjs +59 -1
  37. package/dist/adapters/fetch/index.mjs.map +1 -0
  38. package/dist/adapters/next-app-dir.cjs +3050 -0
  39. package/dist/adapters/next-app-dir.d.cts +58 -0
  40. package/dist/adapters/next-app-dir.d.cts.map +1 -0
  41. package/dist/adapters/next-app-dir.d.mts +58 -0
  42. package/dist/adapters/next-app-dir.d.mts.map +1 -0
  43. package/dist/adapters/next-app-dir.mjs +3048 -4
  44. package/dist/adapters/next-app-dir.mjs.map +1 -0
  45. package/dist/adapters/next.cjs +41 -0
  46. package/dist/adapters/next.d.cts +19 -0
  47. package/dist/adapters/next.d.cts.map +1 -0
  48. package/dist/adapters/next.d.mts +19 -0
  49. package/dist/adapters/next.d.mts.map +1 -0
  50. package/dist/adapters/next.mjs +37 -44
  51. package/dist/adapters/next.mjs.map +1 -0
  52. package/dist/adapters/node-http/index.cjs +15 -0
  53. package/dist/adapters/node-http/index.d.cts +5 -0
  54. package/dist/adapters/node-http/index.d.mts +5 -0
  55. package/dist/adapters/node-http/index.mjs +12 -2
  56. package/dist/adapters/standalone.cjs +52 -0
  57. package/dist/adapters/standalone.d.cts +33 -0
  58. package/dist/adapters/standalone.d.cts.map +1 -0
  59. package/dist/adapters/standalone.d.mts +33 -0
  60. package/dist/adapters/standalone.d.mts.map +1 -0
  61. package/dist/adapters/standalone.mjs +40 -34
  62. package/dist/adapters/standalone.mjs.map +1 -0
  63. package/dist/adapters/ws.cjs +17 -0
  64. package/dist/adapters/ws.d.cts +61 -0
  65. package/dist/adapters/ws.d.cts.map +1 -0
  66. package/dist/adapters/ws.d.mts +61 -0
  67. package/dist/adapters/ws.d.mts.map +1 -0
  68. package/dist/adapters/ws.mjs +14 -539
  69. package/dist/contentTypeParsers-SN4WL9ze.mjs +13 -0
  70. package/dist/contentTypeParsers-SN4WL9ze.mjs.map +1 -0
  71. package/dist/contentTypeParsers-iAFF_pJG.cjs +18 -0
  72. package/dist/getErrorShape-CsikfkAc.cjs +201 -0
  73. package/dist/getErrorShape-DyYil4aT.mjs +149 -0
  74. package/dist/getErrorShape-DyYil4aT.mjs.map +1 -0
  75. package/dist/http-CWyjOa1l.mjs +0 -0
  76. package/dist/http-DXy3XyhL.cjs +0 -0
  77. package/dist/http.cjs +14 -0
  78. package/dist/http.d.cts +3 -0
  79. package/dist/http.d.mts +3 -0
  80. package/dist/http.mjs +9 -8
  81. package/dist/index.cjs +22 -0
  82. package/dist/index.d-BiUz7kM_.d.cts +65 -0
  83. package/dist/index.d-BiUz7kM_.d.cts.map +1 -0
  84. package/dist/index.d-ChWYhXbd.d.cts +99 -0
  85. package/dist/index.d-ChWYhXbd.d.cts.map +1 -0
  86. package/dist/index.d-CvZXeEyR.d.cts +11 -0
  87. package/dist/index.d-CvZXeEyR.d.cts.map +1 -0
  88. package/dist/index.d-D4qZxQJh.d.mts +65 -0
  89. package/dist/index.d-D4qZxQJh.d.mts.map +1 -0
  90. package/dist/index.d-Ocy_AnXj.d.mts +99 -0
  91. package/dist/index.d-Ocy_AnXj.d.mts.map +1 -0
  92. package/dist/index.d-vq_QHko2.d.mts +11 -0
  93. package/dist/index.d-vq_QHko2.d.mts.map +1 -0
  94. package/dist/index.d.cts +4 -0
  95. package/dist/index.d.mts +4 -0
  96. package/dist/index.mjs +6 -13
  97. package/dist/initTRPC-COaJMShh.mjs +339 -0
  98. package/dist/initTRPC-COaJMShh.mjs.map +1 -0
  99. package/dist/initTRPC-DjEpHmY2.cjs +397 -0
  100. package/dist/node-http-BPR68yI4.cjs +243 -0
  101. package/dist/node-http-BUQnHuGI.mjs +221 -0
  102. package/dist/node-http-BUQnHuGI.mjs.map +1 -0
  103. package/dist/observable/index.cjs +13 -0
  104. package/dist/observable/index.d.cts +2 -0
  105. package/dist/observable/index.d.mts +2 -0
  106. package/dist/observable/index.mjs +4 -3
  107. package/dist/observable-B1orLHHI.mjs +155 -0
  108. package/dist/observable-B1orLHHI.mjs.map +1 -0
  109. package/dist/observable-BwdrSFZU.cjs +178 -0
  110. package/dist/observable-C6qq2Ydk.cjs +180 -0
  111. package/dist/observable-CFXA_tyK.mjs +146 -0
  112. package/dist/observable-CFXA_tyK.mjs.map +1 -0
  113. package/dist/parseTRPCMessage-ByQWigsq.cjs +73 -0
  114. package/dist/parseTRPCMessage-CNyYMSRB.mjs +63 -0
  115. package/dist/parseTRPCMessage-CNyYMSRB.mjs.map +1 -0
  116. package/dist/resolveResponse-B2CuaT_1.cjs +2042 -0
  117. package/dist/resolveResponse-DPbYgJDD.mjs +1912 -0
  118. package/dist/resolveResponse-DPbYgJDD.mjs.map +1 -0
  119. package/dist/rpc.cjs +6 -0
  120. package/dist/rpc.d.cts +3 -0
  121. package/dist/rpc.d.mts +3 -0
  122. package/dist/rpc.mjs +4 -5
  123. package/dist/shared.cjs +5 -0
  124. package/dist/shared.d.cts +4 -0
  125. package/dist/shared.d.mts +4 -0
  126. package/dist/shared.mjs +4 -6
  127. package/dist/tracked-Dl9sBZxY.cjs +483 -0
  128. package/dist/tracked-GEWPoL0C.mjs +383 -0
  129. package/dist/tracked-GEWPoL0C.mjs.map +1 -0
  130. package/dist/unstable-core-do-not-import-D89CaGtL.mjs +29 -0
  131. package/dist/unstable-core-do-not-import-D89CaGtL.mjs.map +1 -0
  132. package/dist/unstable-core-do-not-import-DFQys1IC.cjs +34 -0
  133. package/dist/unstable-core-do-not-import.cjs +83 -0
  134. package/dist/unstable-core-do-not-import.d-CSxj_rbP.d.cts +1974 -0
  135. package/dist/unstable-core-do-not-import.d-CSxj_rbP.d.cts.map +1 -0
  136. package/dist/unstable-core-do-not-import.d-ptrxwuSa.d.mts +1974 -0
  137. package/dist/unstable-core-do-not-import.d-ptrxwuSa.d.mts.map +1 -0
  138. package/dist/unstable-core-do-not-import.d.cts +3 -0
  139. package/dist/unstable-core-do-not-import.d.mts +3 -0
  140. package/dist/unstable-core-do-not-import.mjs +11 -30
  141. package/dist/utils-BHZJcBRv.mjs +137 -0
  142. package/dist/utils-BHZJcBRv.mjs.map +1 -0
  143. package/dist/utils-DVO6HZiR.cjs +220 -0
  144. package/dist/ws-C2nEUNk_.cjs +425 -0
  145. package/dist/ws-eIVIMTrw.mjs +409 -0
  146. package/dist/ws-eIVIMTrw.mjs.map +1 -0
  147. package/http/package.json +1 -0
  148. package/observable/package.json +1 -0
  149. package/package.json +131 -55
  150. package/rpc/package.json +1 -0
  151. package/shared/package.json +1 -0
  152. package/src/@trpc/server/index.ts +24 -0
  153. package/src/unstable-core-do-not-import/http/contentType.ts +5 -4
  154. package/src/unstable-core-do-not-import/initTRPC.ts +79 -4
  155. package/src/unstable-core-do-not-import/router.ts +36 -12
  156. package/src/unstable-core-do-not-import/utils.ts +3 -2
  157. package/unstable-core-do-not-import/package.json +1 -0
  158. package/adapters/aws-lambda/index.d.ts +0 -1
  159. package/adapters/aws-lambda/index.js +0 -1
  160. package/adapters/express/index.d.ts +0 -1
  161. package/adapters/express/index.js +0 -1
  162. package/adapters/fastify/index.d.ts +0 -1
  163. package/adapters/fastify/index.js +0 -1
  164. package/adapters/fetch/index.d.ts +0 -1
  165. package/adapters/fetch/index.js +0 -1
  166. package/adapters/next/index.d.ts +0 -1
  167. package/adapters/next/index.js +0 -1
  168. package/adapters/next-app-dir/index.d.ts +0 -1
  169. package/adapters/next-app-dir/index.js +0 -1
  170. package/adapters/node-http/content-type/form-data/index.d.ts +0 -1
  171. package/adapters/node-http/content-type/form-data/index.js +0 -1
  172. package/adapters/node-http/content-type/json/index.d.ts +0 -1
  173. package/adapters/node-http/content-type/json/index.js +0 -1
  174. package/adapters/node-http/index.d.ts +0 -1
  175. package/adapters/node-http/index.js +0 -1
  176. package/adapters/standalone/index.d.ts +0 -1
  177. package/adapters/standalone/index.js +0 -1
  178. package/adapters/ws/index.d.ts +0 -1
  179. package/adapters/ws/index.js +0 -1
  180. package/dist/@trpc/server/http.d.ts +0 -8
  181. package/dist/@trpc/server/http.d.ts.map +0 -1
  182. package/dist/@trpc/server/index.d.ts +0 -65
  183. package/dist/@trpc/server/index.d.ts.map +0 -1
  184. package/dist/@trpc/server/rpc.d.ts +0 -3
  185. package/dist/@trpc/server/rpc.d.ts.map +0 -1
  186. package/dist/adapters/aws-lambda/getPlanner.d.ts +0 -15
  187. package/dist/adapters/aws-lambda/getPlanner.d.ts.map +0 -1
  188. package/dist/adapters/aws-lambda/getPlanner.js +0 -179
  189. package/dist/adapters/aws-lambda/getPlanner.mjs +0 -177
  190. package/dist/adapters/aws-lambda/index.d.ts +0 -23
  191. package/dist/adapters/aws-lambda/index.d.ts.map +0 -1
  192. package/dist/adapters/aws-lambda/index.js +0 -67
  193. package/dist/adapters/express.d.ts +0 -15
  194. package/dist/adapters/express.d.ts.map +0 -1
  195. package/dist/adapters/express.js +0 -39
  196. package/dist/adapters/fastify/fastifyRequestHandler.d.ts +0 -22
  197. package/dist/adapters/fastify/fastifyRequestHandler.d.ts.map +0 -1
  198. package/dist/adapters/fastify/fastifyRequestHandler.js +0 -49
  199. package/dist/adapters/fastify/fastifyRequestHandler.mjs +0 -47
  200. package/dist/adapters/fastify/fastifyTRPCPlugin.d.ts +0 -21
  201. package/dist/adapters/fastify/fastifyTRPCPlugin.d.ts.map +0 -1
  202. package/dist/adapters/fastify/fastifyTRPCPlugin.js +0 -56
  203. package/dist/adapters/fastify/fastifyTRPCPlugin.mjs +0 -54
  204. package/dist/adapters/fastify/index.d.ts +0 -3
  205. package/dist/adapters/fastify/index.d.ts.map +0 -1
  206. package/dist/adapters/fastify/index.js +0 -9
  207. package/dist/adapters/fetch/fetchRequestHandler.d.ts +0 -13
  208. package/dist/adapters/fetch/fetchRequestHandler.d.ts.map +0 -1
  209. package/dist/adapters/fetch/fetchRequestHandler.js +0 -77
  210. package/dist/adapters/fetch/fetchRequestHandler.mjs +0 -75
  211. package/dist/adapters/fetch/index.d.ts +0 -3
  212. package/dist/adapters/fetch/index.d.ts.map +0 -1
  213. package/dist/adapters/fetch/index.js +0 -7
  214. package/dist/adapters/fetch/types.d.ts +0 -27
  215. package/dist/adapters/fetch/types.d.ts.map +0 -1
  216. package/dist/adapters/next-app-dir/nextAppDirCaller.d.ts +0 -25
  217. package/dist/adapters/next-app-dir/nextAppDirCaller.d.ts.map +0 -1
  218. package/dist/adapters/next-app-dir/nextAppDirCaller.js +0 -94
  219. package/dist/adapters/next-app-dir/nextAppDirCaller.mjs +0 -92
  220. package/dist/adapters/next-app-dir/notFound.d.ts +0 -7
  221. package/dist/adapters/next-app-dir/notFound.d.ts.map +0 -1
  222. package/dist/adapters/next-app-dir/notFound.js +0 -18
  223. package/dist/adapters/next-app-dir/notFound.mjs +0 -16
  224. package/dist/adapters/next-app-dir/redirect.d.ts +0 -18
  225. package/dist/adapters/next-app-dir/redirect.d.ts.map +0 -1
  226. package/dist/adapters/next-app-dir/redirect.js +0 -49
  227. package/dist/adapters/next-app-dir/redirect.mjs +0 -46
  228. package/dist/adapters/next-app-dir/rethrowNextErrors.d.ts +0 -6
  229. package/dist/adapters/next-app-dir/rethrowNextErrors.d.ts.map +0 -1
  230. package/dist/adapters/next-app-dir/rethrowNextErrors.js +0 -70
  231. package/dist/adapters/next-app-dir/rethrowNextErrors.mjs +0 -49
  232. package/dist/adapters/next-app-dir.d.ts +0 -7
  233. package/dist/adapters/next-app-dir.d.ts.map +0 -1
  234. package/dist/adapters/next-app-dir.js +0 -13
  235. package/dist/adapters/next.d.ts +0 -19
  236. package/dist/adapters/next.d.ts.map +0 -1
  237. package/dist/adapters/next.js +0 -51
  238. package/dist/adapters/node-http/incomingMessageToRequest.d.ts +0 -12
  239. package/dist/adapters/node-http/incomingMessageToRequest.d.ts.map +0 -1
  240. package/dist/adapters/node-http/incomingMessageToRequest.js +0 -123
  241. package/dist/adapters/node-http/incomingMessageToRequest.mjs +0 -120
  242. package/dist/adapters/node-http/index.d.ts +0 -4
  243. package/dist/adapters/node-http/index.d.ts.map +0 -1
  244. package/dist/adapters/node-http/index.js +0 -11
  245. package/dist/adapters/node-http/nodeHTTPRequestHandler.d.ts +0 -20
  246. package/dist/adapters/node-http/nodeHTTPRequestHandler.d.ts.map +0 -1
  247. package/dist/adapters/node-http/nodeHTTPRequestHandler.js +0 -96
  248. package/dist/adapters/node-http/nodeHTTPRequestHandler.mjs +0 -93
  249. package/dist/adapters/node-http/types.d.ts +0 -81
  250. package/dist/adapters/node-http/types.d.ts.map +0 -1
  251. package/dist/adapters/node-http/writeResponse.d.ts +0 -18
  252. package/dist/adapters/node-http/writeResponse.d.ts.map +0 -1
  253. package/dist/adapters/node-http/writeResponse.js +0 -83
  254. package/dist/adapters/node-http/writeResponse.mjs +0 -80
  255. package/dist/adapters/standalone.d.ts +0 -36
  256. package/dist/adapters/standalone.d.ts.map +0 -1
  257. package/dist/adapters/standalone.js +0 -49
  258. package/dist/adapters/ws.d.ts +0 -54
  259. package/dist/adapters/ws.d.ts.map +0 -1
  260. package/dist/adapters/ws.js +0 -544
  261. package/dist/http.d.ts +0 -2
  262. package/dist/http.d.ts.map +0 -1
  263. package/dist/http.js +0 -19
  264. package/dist/index.d.ts +0 -2
  265. package/dist/index.d.ts.map +0 -1
  266. package/dist/index.js +0 -35
  267. package/dist/node_modules/.pnpm/@rollup_plugin-typescript@12.1.2_rollup@4.34.8_tslib@2.8.1_typescript@5.8.2/node_modules/tslib/tslib.es6.js +0 -73
  268. package/dist/observable/behaviorSubject.d.ts +0 -15
  269. package/dist/observable/behaviorSubject.d.ts.map +0 -1
  270. package/dist/observable/behaviorSubject.js +0 -40
  271. package/dist/observable/behaviorSubject.mjs +0 -38
  272. package/dist/observable/index.d.ts +0 -5
  273. package/dist/observable/index.d.ts.map +0 -1
  274. package/dist/observable/index.js +0 -18
  275. package/dist/observable/observable.d.ts +0 -12
  276. package/dist/observable/observable.d.ts.map +0 -1
  277. package/dist/observable/observable.js +0 -180
  278. package/dist/observable/observable.mjs +0 -175
  279. package/dist/observable/operators.d.ts +0 -10
  280. package/dist/observable/operators.d.ts.map +0 -1
  281. package/dist/observable/operators.js +0 -134
  282. package/dist/observable/operators.mjs +0 -128
  283. package/dist/observable/types.d.ts +0 -26
  284. package/dist/observable/types.d.ts.map +0 -1
  285. package/dist/rpc.d.ts +0 -2
  286. package/dist/rpc.d.ts.map +0 -1
  287. package/dist/rpc.js +0 -13
  288. package/dist/shared.d.ts +0 -26
  289. package/dist/shared.d.ts.map +0 -1
  290. package/dist/shared.js +0 -13
  291. package/dist/unstable-core-do-not-import/clientish/inference.d.ts +0 -17
  292. package/dist/unstable-core-do-not-import/clientish/inference.d.ts.map +0 -1
  293. package/dist/unstable-core-do-not-import/clientish/inferrable.d.ts +0 -36
  294. package/dist/unstable-core-do-not-import/clientish/inferrable.d.ts.map +0 -1
  295. package/dist/unstable-core-do-not-import/clientish/serialize.d.ts +0 -69
  296. package/dist/unstable-core-do-not-import/clientish/serialize.d.ts.map +0 -1
  297. package/dist/unstable-core-do-not-import/createProxy.d.ts +0 -19
  298. package/dist/unstable-core-do-not-import/createProxy.d.ts.map +0 -1
  299. package/dist/unstable-core-do-not-import/createProxy.js +0 -76
  300. package/dist/unstable-core-do-not-import/createProxy.mjs +0 -73
  301. package/dist/unstable-core-do-not-import/error/TRPCError.d.ts +0 -13
  302. package/dist/unstable-core-do-not-import/error/TRPCError.d.ts.map +0 -1
  303. package/dist/unstable-core-do-not-import/error/TRPCError.js +0 -76
  304. package/dist/unstable-core-do-not-import/error/TRPCError.mjs +0 -72
  305. package/dist/unstable-core-do-not-import/error/formatter.d.ts +0 -38
  306. package/dist/unstable-core-do-not-import/error/formatter.d.ts.map +0 -1
  307. package/dist/unstable-core-do-not-import/error/formatter.js +0 -7
  308. package/dist/unstable-core-do-not-import/error/formatter.mjs +0 -5
  309. package/dist/unstable-core-do-not-import/error/getErrorShape.d.ts +0 -15
  310. package/dist/unstable-core-do-not-import/error/getErrorShape.d.ts.map +0 -1
  311. package/dist/unstable-core-do-not-import/error/getErrorShape.js +0 -31
  312. package/dist/unstable-core-do-not-import/error/getErrorShape.mjs +0 -29
  313. package/dist/unstable-core-do-not-import/http/abortError.d.ts +0 -5
  314. package/dist/unstable-core-do-not-import/http/abortError.d.ts.map +0 -1
  315. package/dist/unstable-core-do-not-import/http/abortError.js +0 -13
  316. package/dist/unstable-core-do-not-import/http/abortError.mjs +0 -10
  317. package/dist/unstable-core-do-not-import/http/contentType.d.ts +0 -13
  318. package/dist/unstable-core-do-not-import/http/contentType.d.ts.map +0 -1
  319. package/dist/unstable-core-do-not-import/http/contentType.js +0 -229
  320. package/dist/unstable-core-do-not-import/http/contentType.mjs +0 -227
  321. package/dist/unstable-core-do-not-import/http/contentTypeParsers.d.ts +0 -14
  322. package/dist/unstable-core-do-not-import/http/contentTypeParsers.d.ts.map +0 -1
  323. package/dist/unstable-core-do-not-import/http/contentTypeParsers.js +0 -14
  324. package/dist/unstable-core-do-not-import/http/contentTypeParsers.mjs +0 -12
  325. package/dist/unstable-core-do-not-import/http/formDataToObject.d.ts +0 -2
  326. package/dist/unstable-core-do-not-import/http/formDataToObject.d.ts.map +0 -1
  327. package/dist/unstable-core-do-not-import/http/formDataToObject.js +0 -40
  328. package/dist/unstable-core-do-not-import/http/formDataToObject.mjs +0 -38
  329. package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.d.ts +0 -10
  330. package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.d.ts.map +0 -1
  331. package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.js +0 -85
  332. package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.mjs +0 -78
  333. package/dist/unstable-core-do-not-import/http/parseConnectionParams.d.ts +0 -4
  334. package/dist/unstable-core-do-not-import/http/parseConnectionParams.d.ts.map +0 -1
  335. package/dist/unstable-core-do-not-import/http/parseConnectionParams.js +0 -42
  336. package/dist/unstable-core-do-not-import/http/parseConnectionParams.mjs +0 -39
  337. package/dist/unstable-core-do-not-import/http/resolveResponse.d.ts +0 -15
  338. package/dist/unstable-core-do-not-import/http/resolveResponse.d.ts.map +0 -1
  339. package/dist/unstable-core-do-not-import/http/resolveResponse.js +0 -572
  340. package/dist/unstable-core-do-not-import/http/resolveResponse.mjs +0 -570
  341. package/dist/unstable-core-do-not-import/http/types.d.ts +0 -138
  342. package/dist/unstable-core-do-not-import/http/types.d.ts.map +0 -1
  343. package/dist/unstable-core-do-not-import/initTRPC.d.ts +0 -94
  344. package/dist/unstable-core-do-not-import/initTRPC.d.ts.map +0 -1
  345. package/dist/unstable-core-do-not-import/initTRPC.js +0 -82
  346. package/dist/unstable-core-do-not-import/initTRPC.mjs +0 -80
  347. package/dist/unstable-core-do-not-import/middleware.d.ts +0 -107
  348. package/dist/unstable-core-do-not-import/middleware.d.ts.map +0 -1
  349. package/dist/unstable-core-do-not-import/middleware.js +0 -96
  350. package/dist/unstable-core-do-not-import/middleware.mjs +0 -90
  351. package/dist/unstable-core-do-not-import/parser.d.ts +0 -44
  352. package/dist/unstable-core-do-not-import/parser.d.ts.map +0 -1
  353. package/dist/unstable-core-do-not-import/parser.js +0 -54
  354. package/dist/unstable-core-do-not-import/parser.mjs +0 -52
  355. package/dist/unstable-core-do-not-import/procedure.d.ts +0 -77
  356. package/dist/unstable-core-do-not-import/procedure.d.ts.map +0 -1
  357. package/dist/unstable-core-do-not-import/procedure.js +0 -9
  358. package/dist/unstable-core-do-not-import/procedure.mjs +0 -7
  359. package/dist/unstable-core-do-not-import/procedureBuilder.d.ts +0 -161
  360. package/dist/unstable-core-do-not-import/procedureBuilder.d.ts.map +0 -1
  361. package/dist/unstable-core-do-not-import/procedureBuilder.js +0 -201
  362. package/dist/unstable-core-do-not-import/procedureBuilder.mjs +0 -199
  363. package/dist/unstable-core-do-not-import/rootConfig.d.ts +0 -98
  364. package/dist/unstable-core-do-not-import/rootConfig.d.ts.map +0 -1
  365. package/dist/unstable-core-do-not-import/rootConfig.js +0 -8
  366. package/dist/unstable-core-do-not-import/rootConfig.mjs +0 -6
  367. package/dist/unstable-core-do-not-import/router.d.ts +0 -98
  368. package/dist/unstable-core-do-not-import/router.d.ts.map +0 -1
  369. package/dist/unstable-core-do-not-import/router.js +0 -285
  370. package/dist/unstable-core-do-not-import/router.mjs +0 -278
  371. package/dist/unstable-core-do-not-import/rpc/codes.d.ts +0 -45
  372. package/dist/unstable-core-do-not-import/rpc/codes.d.ts.map +0 -1
  373. package/dist/unstable-core-do-not-import/rpc/codes.js +0 -69
  374. package/dist/unstable-core-do-not-import/rpc/codes.mjs +0 -65
  375. package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts +0 -109
  376. package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts.map +0 -1
  377. package/dist/unstable-core-do-not-import/rpc/index.d.ts +0 -5
  378. package/dist/unstable-core-do-not-import/rpc/index.d.ts.map +0 -1
  379. package/dist/unstable-core-do-not-import/rpc/parseTRPCMessage.d.ts +0 -5
  380. package/dist/unstable-core-do-not-import/rpc/parseTRPCMessage.d.ts.map +0 -1
  381. package/dist/unstable-core-do-not-import/rpc/parseTRPCMessage.js +0 -63
  382. package/dist/unstable-core-do-not-import/rpc/parseTRPCMessage.mjs +0 -61
  383. package/dist/unstable-core-do-not-import/stream/jsonl.d.ts +0 -119
  384. package/dist/unstable-core-do-not-import/stream/jsonl.d.ts.map +0 -1
  385. package/dist/unstable-core-do-not-import/stream/jsonl.js +0 -607
  386. package/dist/unstable-core-do-not-import/stream/jsonl.mjs +0 -603
  387. package/dist/unstable-core-do-not-import/stream/sse.d.ts +0 -108
  388. package/dist/unstable-core-do-not-import/stream/sse.d.ts.map +0 -1
  389. package/dist/unstable-core-do-not-import/stream/sse.js +0 -373
  390. package/dist/unstable-core-do-not-import/stream/sse.mjs +0 -369
  391. package/dist/unstable-core-do-not-import/stream/sse.types.d.ts +0 -31
  392. package/dist/unstable-core-do-not-import/stream/sse.types.d.ts.map +0 -1
  393. package/dist/unstable-core-do-not-import/stream/tracked.d.ts +0 -31
  394. package/dist/unstable-core-do-not-import/stream/tracked.d.ts.map +0 -1
  395. package/dist/unstable-core-do-not-import/stream/tracked.js +0 -29
  396. package/dist/unstable-core-do-not-import/stream/tracked.mjs +0 -25
  397. package/dist/unstable-core-do-not-import/stream/utils/asyncIterable.d.ts +0 -17
  398. package/dist/unstable-core-do-not-import/stream/utils/asyncIterable.d.ts.map +0 -1
  399. package/dist/unstable-core-do-not-import/stream/utils/asyncIterable.js +0 -174
  400. package/dist/unstable-core-do-not-import/stream/utils/asyncIterable.mjs +0 -170
  401. package/dist/unstable-core-do-not-import/stream/utils/createDeferred.d.ts +0 -7
  402. package/dist/unstable-core-do-not-import/stream/utils/createDeferred.d.ts.map +0 -1
  403. package/dist/unstable-core-do-not-import/stream/utils/createDeferred.js +0 -17
  404. package/dist/unstable-core-do-not-import/stream/utils/createDeferred.mjs +0 -15
  405. package/dist/unstable-core-do-not-import/stream/utils/disposable.d.ts +0 -17
  406. package/dist/unstable-core-do-not-import/stream/utils/disposable.d.ts.map +0 -1
  407. package/dist/unstable-core-do-not-import/stream/utils/disposable.js +0 -46
  408. package/dist/unstable-core-do-not-import/stream/utils/disposable.mjs +0 -43
  409. package/dist/unstable-core-do-not-import/stream/utils/mergeAsyncIterables.d.ts +0 -17
  410. package/dist/unstable-core-do-not-import/stream/utils/mergeAsyncIterables.d.ts.map +0 -1
  411. package/dist/unstable-core-do-not-import/stream/utils/mergeAsyncIterables.js +0 -241
  412. package/dist/unstable-core-do-not-import/stream/utils/mergeAsyncIterables.mjs +0 -239
  413. package/dist/unstable-core-do-not-import/stream/utils/readableStreamFrom.d.ts +0 -8
  414. package/dist/unstable-core-do-not-import/stream/utils/readableStreamFrom.d.ts.map +0 -1
  415. package/dist/unstable-core-do-not-import/stream/utils/readableStreamFrom.js +0 -25
  416. package/dist/unstable-core-do-not-import/stream/utils/readableStreamFrom.mjs +0 -23
  417. package/dist/unstable-core-do-not-import/stream/utils/timerResource.d.ts +0 -5
  418. package/dist/unstable-core-do-not-import/stream/utils/timerResource.d.ts.map +0 -1
  419. package/dist/unstable-core-do-not-import/stream/utils/timerResource.js +0 -26
  420. package/dist/unstable-core-do-not-import/stream/utils/timerResource.mjs +0 -23
  421. package/dist/unstable-core-do-not-import/stream/utils/withPing.d.ts +0 -7
  422. package/dist/unstable-core-do-not-import/stream/utils/withPing.d.ts.map +0 -1
  423. package/dist/unstable-core-do-not-import/stream/utils/withPing.js +0 -130
  424. package/dist/unstable-core-do-not-import/stream/utils/withPing.mjs +0 -127
  425. package/dist/unstable-core-do-not-import/transformer.d.ts +0 -99
  426. package/dist/unstable-core-do-not-import/transformer.d.ts.map +0 -1
  427. package/dist/unstable-core-do-not-import/transformer.js +0 -106
  428. package/dist/unstable-core-do-not-import/transformer.mjs +0 -101
  429. package/dist/unstable-core-do-not-import/types.d.ts +0 -127
  430. package/dist/unstable-core-do-not-import/types.d.ts.map +0 -1
  431. package/dist/unstable-core-do-not-import/utils.d.ts +0 -42
  432. package/dist/unstable-core-do-not-import/utils.d.ts.map +0 -1
  433. package/dist/unstable-core-do-not-import/utils.js +0 -96
  434. package/dist/unstable-core-do-not-import/utils.mjs +0 -83
  435. package/dist/unstable-core-do-not-import.d.ts +0 -47
  436. package/dist/unstable-core-do-not-import.d.ts.map +0 -1
  437. package/dist/unstable-core-do-not-import.js +0 -109
  438. package/dist/vendor/cookie-es/set-cookie/split.d.ts +0 -18
  439. package/dist/vendor/cookie-es/set-cookie/split.d.ts.map +0 -1
  440. package/dist/vendor/cookie-es/set-cookie/split.js +0 -79
  441. package/dist/vendor/cookie-es/set-cookie/split.mjs +0 -77
  442. package/dist/vendor/standard-schema-v1/error.d.ts +0 -13
  443. package/dist/vendor/standard-schema-v1/error.d.ts.map +0 -1
  444. package/dist/vendor/standard-schema-v1/error.js +0 -28
  445. package/dist/vendor/standard-schema-v1/error.mjs +0 -26
  446. package/dist/vendor/standard-schema-v1/spec.d.ts +0 -60
  447. package/dist/vendor/standard-schema-v1/spec.d.ts.map +0 -1
  448. package/dist/vendor/unpromise/index.d.ts +0 -3
  449. package/dist/vendor/unpromise/index.d.ts.map +0 -1
  450. package/dist/vendor/unpromise/types.d.ts +0 -28
  451. package/dist/vendor/unpromise/types.d.ts.map +0 -1
  452. package/dist/vendor/unpromise/unpromise.d.ts +0 -121
  453. package/dist/vendor/unpromise/unpromise.d.ts.map +0 -1
  454. package/dist/vendor/unpromise/unpromise.js +0 -292
  455. package/dist/vendor/unpromise/unpromise.mjs +0 -289
  456. package/http/index.d.ts +0 -1
  457. package/http/index.js +0 -1
  458. package/observable/index.d.ts +0 -1
  459. package/observable/index.js +0 -1
  460. package/rpc/index.d.ts +0 -1
  461. package/rpc/index.js +0 -1
  462. package/shared/index.d.ts +0 -1
  463. package/shared/index.js +0 -1
  464. package/unstable-core-do-not-import/index.d.ts +0 -1
  465. package/unstable-core-do-not-import/index.js +0 -1
@@ -1,60 +0,0 @@
1
- /**
2
- *
3
- * @see https://github.com/standard-schema/standard-schema/blob/main/packages/spec/src/index.ts
4
- */
5
- /** The Standard Schema interface. */
6
- export interface StandardSchemaV1<Input = unknown, Output = Input> {
7
- /** The Standard Schema properties. */
8
- readonly '~standard': StandardSchemaV1.Props<Input, Output>;
9
- }
10
- export declare namespace StandardSchemaV1 {
11
- /** The Standard Schema properties interface. */
12
- interface Props<Input = unknown, Output = Input> {
13
- /** The version number of the standard. */
14
- readonly version: 1;
15
- /** The vendor name of the schema library. */
16
- readonly vendor: string;
17
- /** Validates unknown input values. */
18
- readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
19
- /** Inferred types associated with the schema. */
20
- readonly types?: Types<Input, Output> | undefined;
21
- }
22
- /** The result interface of the validate function. */
23
- type Result<Output> = SuccessResult<Output> | FailureResult;
24
- /** The result interface if validation succeeds. */
25
- interface SuccessResult<Output> {
26
- /** The typed output value. */
27
- readonly value: Output;
28
- /** The non-existent issues. */
29
- readonly issues?: undefined;
30
- }
31
- /** The result interface if validation fails. */
32
- interface FailureResult {
33
- /** The issues of failed validation. */
34
- readonly issues: ReadonlyArray<Issue>;
35
- }
36
- /** The issue interface of the failure output. */
37
- interface Issue {
38
- /** The error message of the issue. */
39
- readonly message: string;
40
- /** The path of the issue, if any. */
41
- readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
42
- }
43
- /** The path segment interface of the issue. */
44
- interface PathSegment {
45
- /** The key representing a path segment. */
46
- readonly key: PropertyKey;
47
- }
48
- /** The Standard Schema types interface. */
49
- interface Types<Input = unknown, Output = Input> {
50
- /** The input type of the schema. */
51
- readonly input: Input;
52
- /** The output type of the schema. */
53
- readonly output: Output;
54
- }
55
- /** Infers the input type of a Standard Schema. */
56
- type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];
57
- /** Infers the output type of a Standard Schema. */
58
- type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
59
- }
60
- //# sourceMappingURL=spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../../src/vendor/standard-schema-v1/spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,qCAAqC;AACrC,MAAM,WAAW,gBAAgB,CAAC,KAAK,GAAG,OAAO,EAAE,MAAM,GAAG,KAAK;IAC/D,sCAAsC;IACtC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CAC7D;AAED,MAAM,CAAC,OAAO,WAAW,gBAAgB,CAAC;IACxC,gDAAgD;IAChD,UAAiB,KAAK,CAAC,KAAK,GAAG,OAAO,EAAE,MAAM,GAAG,KAAK;QACpD,0CAA0C;QAC1C,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;QACpB,6CAA6C;QAC7C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,sCAAsC;QACtC,QAAQ,CAAC,QAAQ,EAAE,CACjB,KAAK,EAAE,OAAO,KACX,MAAM,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QAC9C,iDAAiD;QACjD,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;KACnD;IAED,qDAAqD;IACrD,KAAY,MAAM,CAAC,MAAM,IAAI,aAAa,CAAC,MAAM,CAAC,GAAG,aAAa,CAAC;IAEnE,mDAAmD;IACnD,UAAiB,aAAa,CAAC,MAAM;QACnC,8BAA8B;QAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,+BAA+B;QAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;KAC7B;IAED,gDAAgD;IAChD,UAAiB,aAAa;QAC5B,uCAAuC;QACvC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;KACvC;IAED,iDAAiD;IACjD,UAAiB,KAAK;QACpB,sCAAsC;QACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,qCAAqC;QACrC,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC,WAAW,GAAG,WAAW,CAAC,GAAG,SAAS,CAAC;KACtE;IAED,+CAA+C;IAC/C,UAAiB,WAAW;QAC1B,2CAA2C;QAC3C,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;KAC3B;IAED,2CAA2C;IAC3C,UAAiB,KAAK,CAAC,KAAK,GAAG,OAAO,EAAE,MAAM,GAAG,KAAK;QACpD,oCAAoC;QACpC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;QACtB,qCAAqC;QACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KACzB;IAED,kDAAkD;IAClD,KAAY,UAAU,CAAC,MAAM,SAAS,gBAAgB,IAAI,WAAW,CACnE,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAC7B,CAAC,OAAO,CAAC,CAAC;IAEX,mDAAmD;IACnD,KAAY,WAAW,CAAC,MAAM,SAAS,gBAAgB,IAAI,WAAW,CACpE,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAC7B,CAAC,QAAQ,CAAC,CAAC;CACb"}
@@ -1,3 +0,0 @@
1
- export { Unpromise } from "./unpromise";
2
- export type { ProxyPromise, SubscribedPromise, PromiseExecutor, PromiseWithResolvers, } from "./types";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vendor/unpromise/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,oBAAoB,GACrB,MAAM,SAAS,CAAC"}
@@ -1,28 +0,0 @@
1
- /** TYPES */
2
- /** A promise that exploits a single, memory-safe upstream subscription
3
- * to a single re-used Unpromise that persists for the VM lifetime of a
4
- * Promise.
5
- *
6
- * Calling unsubscribe() removes the subscription, eliminating
7
- * all references to the SubscribedPromise. */
8
- export interface SubscribedPromise<T> extends Promise<T> {
9
- unsubscribe: () => void;
10
- }
11
- /** Duplicate of Promise interface, except each call returns SubscribedPromise */
12
- export interface ProxyPromise<T> extends Promise<T> {
13
- subscribe: () => SubscribedPromise<T>;
14
- then: <TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null) => SubscribedPromise<TResult1 | TResult2>;
15
- catch: <TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null) => SubscribedPromise<T | TResult>;
16
- finally: (onfinally?: (() => void) | null) => SubscribedPromise<T>;
17
- }
18
- export type PromiseExecutor<T> = (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void;
19
- /** A standard pattern for a resolvable, rejectable Promise, based
20
- * on the emerging ES2023 standard. Type ported from
21
- * https://github.com/microsoft/TypeScript/pull/56593 */
22
- export interface PromiseWithResolvers<T> {
23
- promise: Promise<T>;
24
- resolve: (value: T | PromiseLike<T>) => void;
25
- reject: (reason?: any) => void;
26
- }
27
- /** Given an array, this is the union of its members' types. */
28
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/vendor/unpromise/types.ts"],"names":[],"mappings":"AAAA,YAAY;AAEZ;;;;;8CAK8C;AAC9C,MAAM,WAAW,iBAAiB,CAAC,CAAC,CAAE,SAAQ,OAAO,CAAC,CAAC,CAAC;IACtD,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,iFAAiF;AACjF,MAAM,WAAW,YAAY,CAAC,CAAC,CAAE,SAAQ,OAAO,CAAC,CAAC,CAAC;IACjD,SAAS,EAAE,MAAM,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAEtC,IAAI,EAAE,CAAC,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,KAAK,EACnC,WAAW,CAAC,EACR,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAChD,IAAI,EAER,UAAU,CAAC,EACP,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GACnD,IAAI,KAEL,iBAAiB,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC;IAE5C,KAAK,EAAE,CAAC,OAAO,GAAG,KAAK,EACrB,UAAU,CAAC,EACP,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,GACjD,IAAI,KAEL,iBAAiB,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC;IAEpC,OAAO,EAAE,CACP,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,KAC5B,iBAAiB,CAAC,CAAC,CAAC,CAAC;CAC3B;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,CAC/B,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,EAC5C,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,KAC3B,IAAI,CAAC;AAEV;;wDAEwD;AACxD,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAC7C,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;CAChC;AAED,+DAA+D"}
@@ -1,121 +0,0 @@
1
- import type { PromiseExecutor, PromiseWithResolvers, ProxyPromise, SubscribedPromise } from "./types";
2
- /**
3
- * Every `Promise<T>` can be shadowed by a single `ProxyPromise<T>`. It is
4
- * created once, cached and reused throughout the lifetime of the Promise. Get a
5
- * Promise's ProxyPromise using `Unpromise.proxy(promise)`.
6
- *
7
- * The `ProxyPromise<T>` attaches handlers to the original `Promise<T>`
8
- * `.then()` and `.catch()` just once. Promises derived from it use a
9
- * subscription- (and unsubscription-) based mechanism that monitors these
10
- * handlers.
11
- *
12
- * Every time you call `.subscribe()`, `.then()` `.catch()` or `.finally()` on a
13
- * `ProxyPromise<T>` it returns a `SubscribedPromise<T>` having an additional
14
- * `unsubscribe()` method. Calling `unsubscribe()` detaches reference chains
15
- * from the original, potentially long-lived Promise, eliminating memory leaks.
16
- *
17
- * This approach can eliminate the memory leaks that otherwise come about from
18
- * repeated `race()` or `any()` calls invoking `.then()` and `.catch()` multiple
19
- * times on the same long-lived native Promise (subscriptions which can never be
20
- * cleaned up).
21
- *
22
- * `Unpromise.race(promises)` is a reference implementation of `Promise.race`
23
- * avoiding memory leaks when using long-lived unsettled Promises.
24
- *
25
- * `Unpromise.any(promises)` is a reference implementation of `Promise.any`
26
- * avoiding memory leaks when using long-lived unsettled Promises.
27
- *
28
- * `Unpromise.resolve(promise)` returns an ephemeral `SubscribedPromise<T>` for
29
- * any given `Promise<T>` facilitating arbitrary async/await patterns. Behind
30
- * the scenes, `resolve` is implemented simply as
31
- * `Unpromise.proxy(promise).subscribe()`. Don't forget to call `.unsubscribe()`
32
- * to tidy up!
33
- *
34
- */
35
- export declare class Unpromise<T> implements ProxyPromise<T> {
36
- /** INSTANCE IMPLEMENTATION */
37
- /** The promise shadowed by this Unpromise<T> */
38
- protected readonly promise: Promise<T> | PromiseLike<T>;
39
- /** Promises expecting eventual settlement (unless unsubscribed first). This list is deleted
40
- * after the original promise settles - no further notifications will be issued. */
41
- protected subscribers: ReadonlyArray<PromiseWithResolvers<T>> | null;
42
- /** The Promise's settlement (recorded when it fulfils or rejects). This is consulted when
43
- * calling .subscribe() .then() .catch() .finally() to see if an immediately-resolving Promise
44
- * can be returned, and therefore subscription can be bypassed. */
45
- protected settlement: PromiseSettledResult<T> | null;
46
- /** Constructor accepts a normal Promise executor function like `new
47
- * Unpromise((resolve, reject) => {...})` or accepts a pre-existing Promise
48
- * like `new Unpromise(existingPromise)`. Adds `.then()` and `.catch()`
49
- * handlers to the Promise. These handlers pass fulfilment and rejection
50
- * notifications to downstream subscribers and maintains records of value
51
- * or error if the Promise ever settles. */
52
- protected constructor(promise: Promise<T>);
53
- protected constructor(promise: PromiseLike<T>);
54
- protected constructor(executor: PromiseExecutor<T>);
55
- /** Create a promise that mitigates uncontrolled subscription to a long-lived
56
- * Promise via .then() and .catch() - otherwise a source of memory leaks.
57
- *
58
- * The returned promise has an `unsubscribe()` method which can be called when
59
- * the Promise is no longer being tracked by application logic, and which
60
- * ensures that there is no reference chain from the original promise to the
61
- * new one, and therefore no memory leak.
62
- *
63
- * If original promise has not yet settled, this adds a new unique promise
64
- * that listens to then/catch events, along with an `unsubscribe()` method to
65
- * detach it.
66
- *
67
- * If original promise has settled, then creates a new Promise.resolve() or
68
- * Promise.reject() and provided unsubscribe is a noop.
69
- *
70
- * If you call `unsubscribe()` before the returned Promise has settled, it
71
- * will never settle.
72
- */
73
- subscribe(): SubscribedPromise<T>;
74
- /** STANDARD PROMISE METHODS (but returning a SubscribedPromise) */
75
- then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): SubscribedPromise<TResult1 | TResult2>;
76
- catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): SubscribedPromise<T | TResult>;
77
- finally(onfinally?: (() => void) | null): SubscribedPromise<T>;
78
- /** TOSTRING SUPPORT */
79
- readonly [Symbol.toStringTag] = "Unpromise";
80
- /** Unpromise STATIC METHODS */
81
- /** Create or Retrieve the proxy Unpromise (a re-used Unpromise for the VM lifetime
82
- * of the provided Promise reference) */
83
- static proxy<T>(promise: PromiseLike<T>): ProxyPromise<T>;
84
- /** Create and store an Unpromise keyed by an original Promise. */
85
- protected static createSubscribablePromise<T>(promise: PromiseLike<T>): Unpromise<T>;
86
- /** Retrieve a previously-created Unpromise keyed by an original Promise. */
87
- protected static getSubscribablePromise<T>(promise: PromiseLike<T>): ProxyPromise<T> | undefined;
88
- /** Promise STATIC METHODS */
89
- /** Lookup the Unpromise for this promise, and derive a SubscribedPromise from
90
- * it (that can be later unsubscribed to eliminate Memory leaks) */
91
- static resolve<T>(value: T | PromiseLike<T>): SubscribedPromise<Awaited<T>>;
92
- /** Perform Promise.any() via SubscribedPromises, then unsubscribe them.
93
- * Equivalent to Promise.any but eliminates memory leaks from long-lived
94
- * promises accumulating .then() and .catch() subscribers. */
95
- static any<T extends readonly unknown[] | []>(values: T): Promise<Awaited<T[number]>>;
96
- /** Perform Promise.race via SubscribedPromises, then unsubscribe them.
97
- * Equivalent to Promise.race but eliminates memory leaks from long-lived
98
- * promises accumulating .then() and .catch() subscribers. */
99
- static race<T extends readonly unknown[] | []>(values: T): Promise<Awaited<T[number]>>;
100
- /** Create a race of SubscribedPromises that will fulfil to a single winning
101
- * Promise (in a 1-Tuple). Eliminates memory leaks from long-lived promises
102
- * accumulating .then() and .catch() subscribers. Allows simple logic to
103
- * consume the result, like...
104
- * ```ts
105
- * const [ winner ] = await Unpromise.race([ promiseA, promiseB ]);
106
- * if(winner === promiseB){
107
- * const result = await promiseB;
108
- * // do the thing
109
- * }
110
- * ```
111
- * */
112
- static raceReferences<TPromise extends Promise<unknown>>(promises: readonly TPromise[]): Promise<readonly [TPromise]>;
113
- }
114
- /** Promises a 1-tuple containing the original promise when it resolves. Allows
115
- * awaiting the eventual Promise ***reference*** (easy to destructure and
116
- * exactly compare with ===). Avoids resolving to the Promise ***value*** (which
117
- * may be ambiguous and therefore hard to identify as the winner of a race).
118
- * You can call unsubscribe on the Promise to mitigate memory leaks.
119
- * */
120
- export declare function resolveSelfTuple<TPromise extends Promise<unknown>>(promise: TPromise): SubscribedPromise<readonly [TPromise]>;
121
- //# sourceMappingURL=unpromise.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unpromise.d.ts","sourceRoot":"","sources":["../../../src/vendor/unpromise/unpromise.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAiBjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qBAAa,SAAS,CAAC,CAAC,CAAE,YAAW,YAAY,CAAC,CAAC,CAAC;IAClD,8BAA8B;IAE9B,iDAAiD;IACjD,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IAExD;uFACmF;IACnF,SAAS,CAAC,WAAW,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAM;IAE1E;;sEAEkE;IAClE,SAAS,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAQ;IAE5D;;;;;+CAK2C;IAC3C,SAAS,aAAa,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACzC,SAAS,aAAa,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;IAC7C,SAAS,aAAa,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;IA4ClD;;;;;;;;;;;;;;;;;OAiBG;IACH,SAAS,IAAI,iBAAiB,CAAC,CAAC,CAAC;IAmCjC,mEAAmE;IAEnE,IAAI,CAAC,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,KAAK,EACjC,WAAW,CAAC,EACR,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAChD,IAAI,EAER,UAAU,CAAC,EACP,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GACnD,IAAI,GAEP,iBAAiB,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAQzC,KAAK,CAAC,OAAO,GAAG,KAAK,EACnB,UAAU,CAAC,EACP,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,GACjD,IAAI,GAEP,iBAAiB,CAAC,CAAC,GAAG,OAAO,CAAC;IAQjC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,GAAK,iBAAiB,CAAC,CAAC,CAAC;IAQhE,uBAAuB;IAEvB,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe;IAE5C,+BAA+B;IAE/B;4CACwC;IACxC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC;IAOzD,kEAAkE;IAClE,SAAS,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;IAOrE,4EAA4E;IAC5E,SAAS,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,GACvB,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS;IAGtE,6BAA6B;IAE7B;uEACmE;IACnE,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAQM,iBAAiB,CAC9D,OAAO,CAAC,CAAC,CAAC,CACX;IAGH;;iEAE6D;WAChD,GAAG,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,GAAG,EAAE,EAChD,MAAM,EAAE,CAAC,GACR,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAe9B;;iEAE6D;WAChD,IAAI,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,GAAG,EAAE,EACjD,MAAM,EAAE,CAAC,GACR,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAe9B;;;;;;;;;;;SAWK;WACQ,cAAc,CAAC,QAAQ,SAAS,OAAO,CAAC,OAAO,CAAC,EAC3D,QAAQ,EAAE,SAAS,QAAQ,EAAE;CAehC;AAED;;;;;KAKK;AACL,wBAAgB,gBAAgB,CAAC,QAAQ,SAAS,OAAO,CAAC,OAAO,CAAC,EAChE,OAAO,EAAE,QAAQ,GAChB,iBAAiB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAExC"}
@@ -1,292 +0,0 @@
1
- 'use strict';
2
-
3
- /* eslint-disable @typescript-eslint/unbound-method */ function _define_property(obj, key, value) {
4
- if (key in obj) {
5
- Object.defineProperty(obj, key, {
6
- value: value,
7
- enumerable: true,
8
- configurable: true,
9
- writable: true
10
- });
11
- } else {
12
- obj[key] = value;
13
- }
14
- return obj;
15
- }
16
- var _computedKey;
17
- /** Memory safe (weakmapped) cache of the ProxyPromise for each Promise,
18
- * which is retained for the lifetime of the original Promise.
19
- */ const subscribableCache = new WeakMap();
20
- /** A NOOP function allowing a consistent interface for settled
21
- * SubscribedPromises (settled promises are not subscribed - they resolve
22
- * immediately). */ const NOOP = ()=>{
23
- // noop
24
- };
25
- _computedKey = Symbol.toStringTag;
26
- let _computedKey1 = _computedKey;
27
- /**
28
- * Every `Promise<T>` can be shadowed by a single `ProxyPromise<T>`. It is
29
- * created once, cached and reused throughout the lifetime of the Promise. Get a
30
- * Promise's ProxyPromise using `Unpromise.proxy(promise)`.
31
- *
32
- * The `ProxyPromise<T>` attaches handlers to the original `Promise<T>`
33
- * `.then()` and `.catch()` just once. Promises derived from it use a
34
- * subscription- (and unsubscription-) based mechanism that monitors these
35
- * handlers.
36
- *
37
- * Every time you call `.subscribe()`, `.then()` `.catch()` or `.finally()` on a
38
- * `ProxyPromise<T>` it returns a `SubscribedPromise<T>` having an additional
39
- * `unsubscribe()` method. Calling `unsubscribe()` detaches reference chains
40
- * from the original, potentially long-lived Promise, eliminating memory leaks.
41
- *
42
- * This approach can eliminate the memory leaks that otherwise come about from
43
- * repeated `race()` or `any()` calls invoking `.then()` and `.catch()` multiple
44
- * times on the same long-lived native Promise (subscriptions which can never be
45
- * cleaned up).
46
- *
47
- * `Unpromise.race(promises)` is a reference implementation of `Promise.race`
48
- * avoiding memory leaks when using long-lived unsettled Promises.
49
- *
50
- * `Unpromise.any(promises)` is a reference implementation of `Promise.any`
51
- * avoiding memory leaks when using long-lived unsettled Promises.
52
- *
53
- * `Unpromise.resolve(promise)` returns an ephemeral `SubscribedPromise<T>` for
54
- * any given `Promise<T>` facilitating arbitrary async/await patterns. Behind
55
- * the scenes, `resolve` is implemented simply as
56
- * `Unpromise.proxy(promise).subscribe()`. Don't forget to call `.unsubscribe()`
57
- * to tidy up!
58
- *
59
- */ class Unpromise {
60
- /** Create a promise that mitigates uncontrolled subscription to a long-lived
61
- * Promise via .then() and .catch() - otherwise a source of memory leaks.
62
- *
63
- * The returned promise has an `unsubscribe()` method which can be called when
64
- * the Promise is no longer being tracked by application logic, and which
65
- * ensures that there is no reference chain from the original promise to the
66
- * new one, and therefore no memory leak.
67
- *
68
- * If original promise has not yet settled, this adds a new unique promise
69
- * that listens to then/catch events, along with an `unsubscribe()` method to
70
- * detach it.
71
- *
72
- * If original promise has settled, then creates a new Promise.resolve() or
73
- * Promise.reject() and provided unsubscribe is a noop.
74
- *
75
- * If you call `unsubscribe()` before the returned Promise has settled, it
76
- * will never settle.
77
- */ subscribe() {
78
- // in all cases we will combine some promise with its unsubscribe function
79
- let promise;
80
- let unsubscribe;
81
- const { settlement } = this;
82
- if (settlement === null) {
83
- // not yet settled - subscribe new promise. Expect eventual settlement
84
- if (this.subscribers === null) {
85
- // invariant - it is not settled, so it must have subscribers
86
- throw new Error("Unpromise settled but still has subscribers");
87
- }
88
- const subscriber = withResolvers();
89
- this.subscribers = listWithMember(this.subscribers, subscriber);
90
- promise = subscriber.promise;
91
- unsubscribe = ()=>{
92
- if (this.subscribers !== null) {
93
- this.subscribers = listWithoutMember(this.subscribers, subscriber);
94
- }
95
- };
96
- } else {
97
- // settled - don't create subscribed promise. Just resolve or reject
98
- const { status } = settlement;
99
- if (status === "fulfilled") {
100
- promise = Promise.resolve(settlement.value);
101
- } else {
102
- promise = Promise.reject(settlement.reason);
103
- }
104
- unsubscribe = NOOP;
105
- }
106
- // extend promise signature with the extra method
107
- return Object.assign(promise, {
108
- unsubscribe
109
- });
110
- }
111
- /** STANDARD PROMISE METHODS (but returning a SubscribedPromise) */ then(onfulfilled, onrejected) {
112
- const subscribed = this.subscribe();
113
- const { unsubscribe } = subscribed;
114
- return Object.assign(subscribed.then(onfulfilled, onrejected), {
115
- unsubscribe
116
- });
117
- }
118
- catch(onrejected) {
119
- const subscribed = this.subscribe();
120
- const { unsubscribe } = subscribed;
121
- return Object.assign(subscribed.catch(onrejected), {
122
- unsubscribe
123
- });
124
- }
125
- finally(onfinally) {
126
- const subscribed = this.subscribe();
127
- const { unsubscribe } = subscribed;
128
- return Object.assign(subscribed.finally(onfinally), {
129
- unsubscribe
130
- });
131
- }
132
- /** Unpromise STATIC METHODS */ /** Create or Retrieve the proxy Unpromise (a re-used Unpromise for the VM lifetime
133
- * of the provided Promise reference) */ static proxy(promise) {
134
- const cached = Unpromise.getSubscribablePromise(promise);
135
- return typeof cached !== "undefined" ? cached : Unpromise.createSubscribablePromise(promise);
136
- }
137
- /** Create and store an Unpromise keyed by an original Promise. */ static createSubscribablePromise(promise) {
138
- const created = new Unpromise(promise);
139
- subscribableCache.set(promise, created); // resolve promise to unpromise
140
- subscribableCache.set(created, created); // resolve the unpromise to itself
141
- return created;
142
- }
143
- /** Retrieve a previously-created Unpromise keyed by an original Promise. */ static getSubscribablePromise(promise) {
144
- return subscribableCache.get(promise);
145
- }
146
- /** Promise STATIC METHODS */ /** Lookup the Unpromise for this promise, and derive a SubscribedPromise from
147
- * it (that can be later unsubscribed to eliminate Memory leaks) */ static resolve(value) {
148
- const promise = typeof value === "object" && value !== null && "then" in value && typeof value.then === "function" ? value : Promise.resolve(value);
149
- return Unpromise.proxy(promise).subscribe();
150
- }
151
- static async any(values) {
152
- const valuesArray = Array.isArray(values) ? values : [
153
- ...values
154
- ];
155
- const subscribedPromises = valuesArray.map(Unpromise.resolve);
156
- try {
157
- return await Promise.any(subscribedPromises);
158
- } finally{
159
- subscribedPromises.forEach(({ unsubscribe })=>{
160
- unsubscribe();
161
- });
162
- }
163
- }
164
- static async race(values) {
165
- const valuesArray = Array.isArray(values) ? values : [
166
- ...values
167
- ];
168
- const subscribedPromises = valuesArray.map(Unpromise.resolve);
169
- try {
170
- return await Promise.race(subscribedPromises);
171
- } finally{
172
- subscribedPromises.forEach(({ unsubscribe })=>{
173
- unsubscribe();
174
- });
175
- }
176
- }
177
- /** Create a race of SubscribedPromises that will fulfil to a single winning
178
- * Promise (in a 1-Tuple). Eliminates memory leaks from long-lived promises
179
- * accumulating .then() and .catch() subscribers. Allows simple logic to
180
- * consume the result, like...
181
- * ```ts
182
- * const [ winner ] = await Unpromise.race([ promiseA, promiseB ]);
183
- * if(winner === promiseB){
184
- * const result = await promiseB;
185
- * // do the thing
186
- * }
187
- * ```
188
- * */ static async raceReferences(promises) {
189
- // map each promise to an eventual 1-tuple containing itself
190
- const selfPromises = promises.map(resolveSelfTuple);
191
- // now race them. They will fulfil to a readonly [P] or reject.
192
- try {
193
- return await Promise.race(selfPromises);
194
- } finally{
195
- for (const promise of selfPromises){
196
- // unsubscribe proxy promises when the race is over to mitigate memory leaks
197
- promise.unsubscribe();
198
- }
199
- }
200
- }
201
- constructor(arg){
202
- /** INSTANCE IMPLEMENTATION */ /** The promise shadowed by this Unpromise<T> */ _define_property(this, "promise", void 0);
203
- /** Promises expecting eventual settlement (unless unsubscribed first). This list is deleted
204
- * after the original promise settles - no further notifications will be issued. */ _define_property(this, "subscribers", []);
205
- /** The Promise's settlement (recorded when it fulfils or rejects). This is consulted when
206
- * calling .subscribe() .then() .catch() .finally() to see if an immediately-resolving Promise
207
- * can be returned, and therefore subscription can be bypassed. */ _define_property(this, "settlement", null);
208
- /** TOSTRING SUPPORT */ _define_property(this, _computedKey1, "Unpromise");
209
- // handle either a Promise or a Promise executor function
210
- if (typeof arg === "function") {
211
- this.promise = new Promise(arg);
212
- } else {
213
- this.promise = arg;
214
- }
215
- // subscribe for eventual fulfilment and rejection
216
- // handle PromiseLike objects (that at least have .then)
217
- const thenReturn = this.promise.then((value)=>{
218
- // atomically record fulfilment and detach subscriber list
219
- const { subscribers } = this;
220
- this.subscribers = null;
221
- this.settlement = {
222
- status: "fulfilled",
223
- value
224
- };
225
- // notify fulfilment to subscriber list
226
- subscribers?.forEach(({ resolve })=>{
227
- resolve(value);
228
- });
229
- });
230
- // handle Promise (that also have a .catch behaviour)
231
- if ("catch" in thenReturn) {
232
- thenReturn.catch((reason)=>{
233
- // atomically record rejection and detach subscriber list
234
- const { subscribers } = this;
235
- this.subscribers = null;
236
- this.settlement = {
237
- status: "rejected",
238
- reason
239
- };
240
- // notify rejection to subscriber list
241
- subscribers?.forEach(({ reject })=>{
242
- reject(reason);
243
- });
244
- });
245
- }
246
- }
247
- }
248
- /** Promises a 1-tuple containing the original promise when it resolves. Allows
249
- * awaiting the eventual Promise ***reference*** (easy to destructure and
250
- * exactly compare with ===). Avoids resolving to the Promise ***value*** (which
251
- * may be ambiguous and therefore hard to identify as the winner of a race).
252
- * You can call unsubscribe on the Promise to mitigate memory leaks.
253
- * */ function resolveSelfTuple(promise) {
254
- return Unpromise.proxy(promise).then(()=>[
255
- promise
256
- ]);
257
- }
258
- /** VENDORED (Future) PROMISE UTILITIES */ /** Reference implementation of https://github.com/tc39/proposal-promise-with-resolvers */ function withResolvers() {
259
- let resolve;
260
- let reject;
261
- const promise = new Promise((_resolve, _reject)=>{
262
- resolve = _resolve;
263
- reject = _reject;
264
- });
265
- return {
266
- promise,
267
- resolve,
268
- reject
269
- };
270
- }
271
- /** IMMUTABLE LIST OPERATIONS */ function listWithMember(arr, member) {
272
- return [
273
- ...arr,
274
- member
275
- ];
276
- }
277
- function listWithoutIndex(arr, index) {
278
- return [
279
- ...arr.slice(0, index),
280
- ...arr.slice(index + 1)
281
- ];
282
- }
283
- function listWithoutMember(arr, member) {
284
- const index = arr.indexOf(member);
285
- if (index !== -1) {
286
- return listWithoutIndex(arr, index);
287
- }
288
- return arr;
289
- }
290
-
291
- exports.Unpromise = Unpromise;
292
- exports.resolveSelfTuple = resolveSelfTuple;