@trpc/server 11.0.0-alpha-tmp-export-from-main.213 → 11.0.0-alpha-tmp-export-from-main-nuke-core.236

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 (277) hide show
  1. package/dist/@trpc/server/http.d.ts +7 -0
  2. package/dist/@trpc/server/http.d.ts.map +1 -0
  3. package/dist/@trpc/server/index.d.ts +69 -0
  4. package/dist/@trpc/server/index.d.ts.map +1 -0
  5. package/dist/@trpc/server/rpc.d.ts +3 -0
  6. package/dist/@trpc/server/rpc.d.ts.map +1 -0
  7. package/dist/adapters/aws-lambda/index.d.ts +1 -2
  8. package/dist/adapters/aws-lambda/index.d.ts.map +1 -1
  9. package/dist/adapters/aws-lambda/index.js +20 -109
  10. package/dist/adapters/aws-lambda/index.mjs +5 -92
  11. package/dist/adapters/aws-lambda/utils.d.ts +2 -3
  12. package/dist/adapters/aws-lambda/utils.d.ts.map +1 -1
  13. package/dist/adapters/aws-lambda/utils.js +101 -0
  14. package/dist/adapters/aws-lambda/utils.mjs +94 -0
  15. package/dist/adapters/express.d.ts +1 -2
  16. package/dist/adapters/express.d.ts.map +1 -1
  17. package/dist/adapters/express.js +1 -6
  18. package/dist/adapters/express.mjs +1 -4
  19. package/dist/adapters/fastify/fastifyRequestHandler.d.ts +2 -2
  20. package/dist/adapters/fastify/fastifyRequestHandler.d.ts.map +1 -1
  21. package/dist/adapters/fastify/fastifyRequestHandler.js +84 -0
  22. package/dist/adapters/fastify/fastifyRequestHandler.mjs +82 -0
  23. package/dist/adapters/fastify/fastifyTRPCPlugin.d.ts +1 -2
  24. package/dist/adapters/fastify/fastifyTRPCPlugin.d.ts.map +1 -1
  25. package/dist/adapters/fastify/fastifyTRPCPlugin.js +50 -0
  26. package/dist/adapters/fastify/fastifyTRPCPlugin.mjs +48 -0
  27. package/dist/adapters/fastify/index.js +4 -125
  28. package/dist/adapters/fastify/index.mjs +2 -125
  29. package/dist/adapters/fetch/fetchRequestHandler.d.ts +1 -2
  30. package/dist/adapters/fetch/fetchRequestHandler.d.ts.map +1 -1
  31. package/dist/adapters/fetch/fetchRequestHandler.js +120 -0
  32. package/dist/adapters/fetch/fetchRequestHandler.mjs +118 -0
  33. package/dist/adapters/fetch/index.js +2 -115
  34. package/dist/adapters/fetch/index.mjs +1 -116
  35. package/dist/adapters/fetch/types.d.ts +2 -3
  36. package/dist/adapters/fetch/types.d.ts.map +1 -1
  37. package/dist/adapters/next.d.ts +1 -2
  38. package/dist/adapters/next.d.ts.map +1 -1
  39. package/dist/adapters/next.js +7 -9
  40. package/dist/adapters/next.mjs +5 -5
  41. package/dist/adapters/node-http/content-type/form-data/fileUploadHandler.js +161 -0
  42. package/dist/adapters/node-http/content-type/form-data/fileUploadHandler.mjs +157 -0
  43. package/dist/adapters/node-http/content-type/form-data/index.js +20 -646
  44. package/dist/adapters/node-http/content-type/form-data/index.mjs +9 -631
  45. package/dist/adapters/node-http/content-type/form-data/memoryUploadHandler.js +29 -0
  46. package/dist/adapters/node-http/content-type/form-data/memoryUploadHandler.mjs +27 -0
  47. package/dist/adapters/node-http/content-type/form-data/streamSlice.js +46 -0
  48. package/dist/adapters/node-http/content-type/form-data/streamSlice.mjs +44 -0
  49. package/dist/adapters/node-http/content-type/form-data/uploadHandler.js +30 -0
  50. package/dist/adapters/node-http/content-type/form-data/uploadHandler.mjs +26 -0
  51. package/dist/adapters/node-http/content-type/json/getPostBody.d.ts +1 -1
  52. package/dist/adapters/node-http/content-type/json/getPostBody.d.ts.map +1 -1
  53. package/dist/adapters/node-http/content-type/json/getPostBody.js +44 -0
  54. package/dist/adapters/node-http/content-type/json/getPostBody.mjs +42 -0
  55. package/dist/adapters/node-http/content-type/json/index.js +7 -43
  56. package/dist/adapters/node-http/content-type/json/index.mjs +5 -39
  57. package/dist/adapters/node-http/index.js +1 -6
  58. package/dist/adapters/node-http/index.mjs +1 -4
  59. package/dist/adapters/node-http/internals/contentType.d.ts +2 -2
  60. package/dist/adapters/node-http/internals/contentType.d.ts.map +1 -1
  61. package/dist/{contentType-72ed9df5.mjs → adapters/node-http/internals/contentType.mjs} +1 -1
  62. package/dist/adapters/node-http/nodeHTTPRequestHandler.d.ts +1 -2
  63. package/dist/adapters/node-http/nodeHTTPRequestHandler.d.ts.map +1 -1
  64. package/dist/{nodeHTTPRequestHandler-55f05150.js → adapters/node-http/nodeHTTPRequestHandler.js} +8 -6
  65. package/dist/{nodeHTTPRequestHandler-2d5c8791.mjs → adapters/node-http/nodeHTTPRequestHandler.mjs} +6 -4
  66. package/dist/adapters/node-http/types.d.ts +3 -4
  67. package/dist/adapters/node-http/types.d.ts.map +1 -1
  68. package/dist/adapters/standalone.d.ts +1 -2
  69. package/dist/adapters/standalone.d.ts.map +1 -1
  70. package/dist/adapters/standalone.js +3 -11
  71. package/dist/adapters/standalone.mjs +3 -5
  72. package/dist/adapters/ws.d.ts +3 -2
  73. package/dist/adapters/ws.d.ts.map +1 -1
  74. package/dist/adapters/ws.js +33 -28
  75. package/dist/adapters/ws.mjs +8 -1
  76. package/dist/bundle-analysis.json +757 -0
  77. package/dist/http.d.ts +1 -6
  78. package/dist/http.d.ts.map +1 -1
  79. package/dist/http.js +11 -23
  80. package/dist/http.mjs +6 -1
  81. package/dist/index.d.ts +1 -68
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +18 -43
  84. package/dist/index.mjs +8 -1
  85. package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/index.js +203 -0
  86. package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/index.mjs +201 -0
  87. package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/search.js +167 -0
  88. package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/search.mjs +163 -0
  89. package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/utils.js +35 -0
  90. package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/utils.mjs +30 -0
  91. package/dist/observable/index.d.ts +5 -0
  92. package/dist/observable/index.d.ts.map +1 -0
  93. package/dist/observable/index.js +13 -0
  94. package/dist/observable/index.mjs +2 -0
  95. package/dist/observable/observable.d.ts +13 -0
  96. package/dist/observable/observable.d.ts.map +1 -0
  97. package/dist/observable/observable.js +126 -0
  98. package/dist/observable/observable.mjs +122 -0
  99. package/dist/observable/operators.d.ts +8 -0
  100. package/dist/observable/operators.d.ts.map +1 -0
  101. package/dist/observable/operators.js +103 -0
  102. package/dist/observable/operators.mjs +99 -0
  103. package/dist/observable/types.d.ts +26 -0
  104. package/dist/observable/types.d.ts.map +1 -0
  105. package/dist/rpc.d.ts +1 -2
  106. package/dist/rpc.d.ts.map +1 -1
  107. package/dist/rpc.js +6 -15
  108. package/dist/rpc.mjs +3 -1
  109. package/dist/shared.d.ts +1 -1
  110. package/dist/shared.d.ts.map +1 -1
  111. package/dist/shared.js +6 -11
  112. package/dist/shared.mjs +4 -1
  113. package/dist/unstable-core-do-not-import/TRPCInferrable.d.ts +6 -0
  114. package/dist/unstable-core-do-not-import/TRPCInferrable.d.ts.map +1 -0
  115. package/dist/unstable-core-do-not-import/createProxy.d.ts +19 -0
  116. package/dist/unstable-core-do-not-import/createProxy.d.ts.map +1 -0
  117. package/dist/unstable-core-do-not-import/createProxy.js +52 -0
  118. package/dist/unstable-core-do-not-import/createProxy.mjs +49 -0
  119. package/dist/unstable-core-do-not-import/error/TRPCError.d.ts +13 -0
  120. package/dist/unstable-core-do-not-import/error/TRPCError.d.ts.map +1 -0
  121. package/dist/unstable-core-do-not-import/error/TRPCError.js +67 -0
  122. package/dist/unstable-core-do-not-import/error/TRPCError.mjs +63 -0
  123. package/dist/unstable-core-do-not-import/error/formatter.d.ts +33 -0
  124. package/dist/unstable-core-do-not-import/error/formatter.d.ts.map +1 -0
  125. package/dist/unstable-core-do-not-import/error/formatter.js +7 -0
  126. package/dist/unstable-core-do-not-import/error/formatter.mjs +5 -0
  127. package/dist/unstable-core-do-not-import/error/getErrorShape.d.ts +15 -0
  128. package/dist/unstable-core-do-not-import/error/getErrorShape.d.ts.map +1 -0
  129. package/dist/unstable-core-do-not-import/error/getErrorShape.js +31 -0
  130. package/dist/unstable-core-do-not-import/error/getErrorShape.mjs +29 -0
  131. package/dist/unstable-core-do-not-import/http/batchStreamFormatter.d.ts +24 -0
  132. package/dist/unstable-core-do-not-import/http/batchStreamFormatter.d.ts.map +1 -0
  133. package/dist/unstable-core-do-not-import/http/batchStreamFormatter.js +32 -0
  134. package/dist/unstable-core-do-not-import/http/batchStreamFormatter.mjs +30 -0
  135. package/dist/unstable-core-do-not-import/http/contentType.d.ts +29 -0
  136. package/dist/unstable-core-do-not-import/http/contentType.d.ts.map +1 -0
  137. package/dist/unstable-core-do-not-import/http/contentType.js +54 -0
  138. package/dist/unstable-core-do-not-import/http/contentType.mjs +52 -0
  139. package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.d.ts +5 -0
  140. package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.d.ts.map +1 -0
  141. package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.js +51 -0
  142. package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.mjs +48 -0
  143. package/dist/unstable-core-do-not-import/http/index.d.ts +7 -0
  144. package/dist/unstable-core-do-not-import/http/index.d.ts.map +1 -0
  145. package/dist/unstable-core-do-not-import/http/resolveHTTPResponse.d.ts +51 -0
  146. package/dist/unstable-core-do-not-import/http/resolveHTTPResponse.d.ts.map +1 -0
  147. package/dist/unstable-core-do-not-import/http/resolveHTTPResponse.js +295 -0
  148. package/dist/unstable-core-do-not-import/http/resolveHTTPResponse.mjs +293 -0
  149. package/dist/unstable-core-do-not-import/http/types.d.ts +96 -0
  150. package/dist/unstable-core-do-not-import/http/types.d.ts.map +1 -0
  151. package/dist/unstable-core-do-not-import/index.d.ts +37 -0
  152. package/dist/unstable-core-do-not-import/index.d.ts.map +1 -0
  153. package/dist/unstable-core-do-not-import/index.js +48 -0
  154. package/dist/unstable-core-do-not-import/index.mjs +16 -0
  155. package/dist/unstable-core-do-not-import/initTRPC.d.ts +96 -0
  156. package/dist/unstable-core-do-not-import/initTRPC.d.ts.map +1 -0
  157. package/dist/unstable-core-do-not-import/initTRPC.js +95 -0
  158. package/dist/unstable-core-do-not-import/initTRPC.mjs +93 -0
  159. package/dist/unstable-core-do-not-import/middleware.d.ts +105 -0
  160. package/dist/unstable-core-do-not-import/middleware.d.ts.map +1 -0
  161. package/dist/unstable-core-do-not-import/middleware.js +95 -0
  162. package/dist/unstable-core-do-not-import/middleware.mjs +89 -0
  163. package/dist/unstable-core-do-not-import/parser.d.ts +30 -0
  164. package/dist/unstable-core-do-not-import/parser.d.ts.map +1 -0
  165. package/dist/unstable-core-do-not-import/parser.js +37 -0
  166. package/dist/unstable-core-do-not-import/parser.mjs +35 -0
  167. package/dist/unstable-core-do-not-import/procedure.d.ts +72 -0
  168. package/dist/unstable-core-do-not-import/procedure.d.ts.map +1 -0
  169. package/dist/unstable-core-do-not-import/procedure.js +9 -0
  170. package/dist/unstable-core-do-not-import/procedure.mjs +7 -0
  171. package/dist/unstable-core-do-not-import/procedureBuilder.d.ts +101 -0
  172. package/dist/unstable-core-do-not-import/procedureBuilder.d.ts.map +1 -0
  173. package/dist/unstable-core-do-not-import/procedureBuilder.js +176 -0
  174. package/dist/unstable-core-do-not-import/procedureBuilder.mjs +173 -0
  175. package/dist/unstable-core-do-not-import/rootConfig.d.ts +75 -0
  176. package/dist/unstable-core-do-not-import/rootConfig.d.ts.map +1 -0
  177. package/dist/unstable-core-do-not-import/rootConfig.js +8 -0
  178. package/dist/unstable-core-do-not-import/rootConfig.mjs +6 -0
  179. package/dist/unstable-core-do-not-import/router.d.ts +85 -0
  180. package/dist/unstable-core-do-not-import/router.d.ts.map +1 -0
  181. package/dist/unstable-core-do-not-import/router.js +156 -0
  182. package/dist/unstable-core-do-not-import/router.mjs +151 -0
  183. package/dist/unstable-core-do-not-import/rpc/codes.d.ts +51 -0
  184. package/dist/unstable-core-do-not-import/rpc/codes.d.ts.map +1 -0
  185. package/dist/unstable-core-do-not-import/rpc/codes.js +38 -0
  186. package/dist/unstable-core-do-not-import/rpc/codes.mjs +35 -0
  187. package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts +97 -0
  188. package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts.map +1 -0
  189. package/dist/unstable-core-do-not-import/rpc/index.d.ts +5 -0
  190. package/dist/unstable-core-do-not-import/rpc/index.d.ts.map +1 -0
  191. package/dist/unstable-core-do-not-import/rpc/parseTRPCMessage.d.ts +5 -0
  192. package/dist/unstable-core-do-not-import/rpc/parseTRPCMessage.d.ts.map +1 -0
  193. package/dist/unstable-core-do-not-import/rpc/parseTRPCMessage.js +59 -0
  194. package/dist/unstable-core-do-not-import/rpc/parseTRPCMessage.mjs +57 -0
  195. package/dist/unstable-core-do-not-import/serialize.d.ts +62 -0
  196. package/dist/unstable-core-do-not-import/serialize.d.ts.map +1 -0
  197. package/dist/unstable-core-do-not-import/transformer.d.ts +107 -0
  198. package/dist/unstable-core-do-not-import/transformer.d.ts.map +1 -0
  199. package/dist/unstable-core-do-not-import/transformer.js +107 -0
  200. package/dist/unstable-core-do-not-import/transformer.mjs +102 -0
  201. package/dist/unstable-core-do-not-import/types.d.ts +98 -0
  202. package/dist/unstable-core-do-not-import/types.d.ts.map +1 -0
  203. package/dist/unstable-core-do-not-import/utils.d.ts +27 -0
  204. package/dist/unstable-core-do-not-import/utils.d.ts.map +1 -0
  205. package/dist/unstable-core-do-not-import/utils.js +44 -0
  206. package/dist/unstable-core-do-not-import/utils.mjs +39 -0
  207. package/package.json +54 -126
  208. package/src/@trpc/server/http.ts +26 -0
  209. package/src/@trpc/server/index.ts +105 -0
  210. package/src/@trpc/server/rpc.ts +26 -0
  211. package/src/adapters/aws-lambda/index.ts +4 -5
  212. package/src/adapters/aws-lambda/utils.ts +3 -4
  213. package/src/adapters/express.ts +1 -3
  214. package/src/adapters/fastify/fastifyRequestHandler.ts +6 -4
  215. package/src/adapters/fastify/fastifyTRPCPlugin.ts +1 -2
  216. package/src/adapters/fetch/fetchRequestHandler.ts +6 -4
  217. package/src/adapters/fetch/types.ts +2 -3
  218. package/src/adapters/next.ts +2 -3
  219. package/src/adapters/node-http/content-type/form-data/index.ts +1 -1
  220. package/src/adapters/node-http/content-type/json/getPostBody.ts +2 -2
  221. package/src/adapters/node-http/content-type/json/index.ts +1 -1
  222. package/src/adapters/node-http/internals/contentType.ts +2 -2
  223. package/src/adapters/node-http/nodeHTTPRequestHandler.ts +6 -4
  224. package/src/adapters/node-http/types.ts +4 -5
  225. package/src/adapters/standalone.ts +3 -3
  226. package/src/adapters/ws.ts +14 -13
  227. package/src/http.ts +1 -26
  228. package/src/index.ts +1 -105
  229. package/src/observable/index.ts +10 -0
  230. package/src/observable/observable.ts +158 -0
  231. package/src/observable/operators.ts +119 -0
  232. package/src/observable/types.ts +76 -0
  233. package/src/rpc.ts +1 -26
  234. package/src/shared.ts +1 -1
  235. package/src/unstable-core-do-not-import/TRPCInferrable.ts +9 -0
  236. package/src/unstable-core-do-not-import/createProxy.ts +59 -0
  237. package/src/unstable-core-do-not-import/error/TRPCError.ts +82 -0
  238. package/src/unstable-core-do-not-import/error/formatter.ts +51 -0
  239. package/src/unstable-core-do-not-import/error/getErrorShape.ts +36 -0
  240. package/src/unstable-core-do-not-import/http/batchStreamFormatter.ts +29 -0
  241. package/src/unstable-core-do-not-import/http/contentType.ts +99 -0
  242. package/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts +57 -0
  243. package/src/unstable-core-do-not-import/http/index.ts +23 -0
  244. package/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts +458 -0
  245. package/src/unstable-core-do-not-import/http/types.ts +111 -0
  246. package/src/unstable-core-do-not-import/index.ts +110 -0
  247. package/src/unstable-core-do-not-import/initTRPC.ts +206 -0
  248. package/src/unstable-core-do-not-import/middleware.ts +233 -0
  249. package/src/unstable-core-do-not-import/parser.ts +94 -0
  250. package/src/unstable-core-do-not-import/procedure.ts +108 -0
  251. package/src/unstable-core-do-not-import/procedureBuilder.ts +458 -0
  252. package/src/unstable-core-do-not-import/rootConfig.ts +90 -0
  253. package/src/unstable-core-do-not-import/router.ts +370 -0
  254. package/src/unstable-core-do-not-import/rpc/codes.ts +44 -0
  255. package/src/unstable-core-do-not-import/rpc/envelopes.ts +136 -0
  256. package/src/unstable-core-do-not-import/rpc/index.ts +21 -0
  257. package/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts +85 -0
  258. package/src/unstable-core-do-not-import/serialize.ts +122 -0
  259. package/src/unstable-core-do-not-import/transformer.ts +202 -0
  260. package/src/unstable-core-do-not-import/types.ts +151 -0
  261. package/src/unstable-core-do-not-import/utils.ts +59 -0
  262. package/unstable-core-do-not-import/index.d.ts +1 -0
  263. package/unstable-core-do-not-import/index.js +1 -0
  264. package/dist/@trpc-core-unstable-do-not-import-this-please.d.ts +0 -10
  265. package/dist/@trpc-core-unstable-do-not-import-this-please.d.ts.map +0 -1
  266. package/dist/@trpc-server/http.d.ts +0 -2
  267. package/dist/@trpc-server/http.d.ts.map +0 -1
  268. package/dist/contentType-24c44bba.js +0 -5
  269. package/dist/nodeHTTPRequestHandler-7691fc79.js +0 -105
  270. package/dist/observable.d.ts +0 -3
  271. package/dist/observable.d.ts.map +0 -1
  272. package/dist/observable.js +0 -32
  273. package/dist/observable.mjs +0 -1
  274. package/src/@trpc-core-unstable-do-not-import-this-please.ts +0 -146
  275. package/src/@trpc-server/http.ts +0 -2
  276. package/src/observable.ts +0 -16
  277. /package/dist/{contentType-d9d22104.js → adapters/node-http/internals/contentType.js} +0 -0
@@ -0,0 +1,7 @@
1
+ export { getHTTPStatusCode, getHTTPStatusCodeFromError, } from '../../unstable-core-do-not-import';
2
+ export { resolveHTTPResponse } from '../../unstable-core-do-not-import';
3
+ export type { BaseHandlerOptions, HTTPBaseHandlerOptions, HTTPHeaders, HTTPRequest, HTTPResponse, OnErrorFunction, ProcedureCall, ResolveHTTPRequestOptionsContextFn, ResponseChunk, ResponseMeta, ResponseMetaFn, TRPCRequestInfo, } from '../../unstable-core-do-not-import';
4
+ export { getBatchStreamFormatter } from '../../unstable-core-do-not-import';
5
+ export type { BaseContentTypeHandler, BodyResult, } from '../../unstable-core-do-not-import';
6
+ export { getJsonContentTypeInputs } from '../../unstable-core-do-not-import';
7
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/@trpc/server/http.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,eAAe,EACf,aAAa,EACb,kCAAkC,EAClC,aAAa,EACb,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,YAAY,EACV,sBAAsB,EACtB,UAAU,GACX,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC"}
@@ -0,0 +1,69 @@
1
+ export { TRPCError,
2
+ /**
3
+ * @deprecated use `experimental_trpcMiddleware` instead
4
+ */
5
+ experimental_standaloneMiddleware, experimental_standaloneMiddleware as experimental_trpcMiddleware, initTRPC, callProcedure as callTRPCProcedure, getTRPCErrorFromUnknown, transformTRPCResponse, createFlatProxy as createTRPCFlatProxy, type inferProcedureInput, type inferProcedureOutput, type inferRouterError, type inferRouterInputs, type inferRouterOutputs, type inferRouterContext, type inferTransformedProcedureOutput, type inferTransformedSubscriptionOutput, type AnyProcedure as AnyTRPCProcedure, type AnyRouter as AnyTRPCRouter, type AnyMiddlewareFunction as AnyTRPCMiddlewareFunction, type CombinedDataTransformer as TRPCCombinedDataTransformer, type ProcedureType as TRPCProcedureType, type AnyMutationProcedure as AnyTRPCMutationProcedure, type AnyQueryProcedure as AnyTRPCQueryProcedure, type ProcedureRouterRecord as TRPCProcedureRouterRecord, type ProcedureArgs as TRPCProcedureArgs, type AnySubscriptionProcedure as AnyTRPCSubscriptionProcedure, } from '../../unstable-core-do-not-import';
6
+ export type {
7
+ /**
8
+ * @deprecated use `AnyTRPCProcedure` instead
9
+ */
10
+ AnyProcedure,
11
+ /**
12
+ * @deprecated use `AnyTRPCRouter` instead
13
+ */
14
+ AnyRouter,
15
+ /**
16
+ * @deprecated use `AnyTRPCMiddlewareFunction` instead
17
+ */
18
+ AnyMiddlewareFunction,
19
+ /**
20
+ * @deprecated use `TRPCCombinedDataTransformer` instead
21
+ */
22
+ CombinedDataTransformer,
23
+ /**
24
+ * @deprecated This is a utility type will be removed in v12
25
+ */
26
+ Dict,
27
+ /**
28
+ * @deprecated This is a utility type will be removed in v12
29
+ */
30
+ DeepPartial,
31
+ /**
32
+ * @deprecated use `TRPCProcedureType` instead
33
+ */
34
+ ProcedureType,
35
+ /**
36
+ * @deprecated use `AnyTRPCMutationProcedure` instead
37
+ */
38
+ AnyMutationProcedure,
39
+ /**
40
+ * @deprecated use `AnyTRPCQueryProcedure` instead
41
+ */
42
+ AnyQueryProcedure,
43
+ /**
44
+ * @deprecated use `TRPCProcedureRouterRecord` instead
45
+ */
46
+ ProcedureRouterRecord,
47
+ /**
48
+ * @deprecated use `TRPCProcedureArgs` instead
49
+ */
50
+ ProcedureArgs,
51
+ /**
52
+ * @deprecated use `AnyTRPCSubscriptionProcedure` instead
53
+ */
54
+ AnySubscriptionProcedure, } from '../../unstable-core-do-not-import';
55
+ export {
56
+ /**
57
+ * @deprecated use `getTRPCErrorShape` instead
58
+ */
59
+ getErrorShape,
60
+ /**
61
+ * @deprecated use `callTRPCProcedure` instead
62
+ */
63
+ callProcedure, } from '../../unstable-core-do-not-import';
64
+ /**
65
+ * @deprecated
66
+ * Use `Awaited<ReturnType<typeof myFunction>>` instead
67
+ */
68
+ export type inferAsyncReturnType<TFunction extends (...args: any[]) => any> = Awaited<ReturnType<TFunction>>;
69
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/@trpc/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS;AACT;;GAEG;AACH,iCAAiC,EACjC,iCAAiC,IAAI,2BAA2B,EAChE,QAAQ,EAER,aAAa,IAAI,iBAAiB,EAClC,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,IAAI,mBAAmB,EACtC,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,+BAA+B,EACpC,KAAK,kCAAkC,EACvC,KAAK,YAAY,IAAI,gBAAgB,EACrC,KAAK,SAAS,IAAI,aAAa,EAC/B,KAAK,qBAAqB,IAAI,yBAAyB,EACvD,KAAK,uBAAuB,IAAI,2BAA2B,EAC3D,KAAK,aAAa,IAAI,iBAAiB,EACvC,KAAK,oBAAoB,IAAI,wBAAwB,EACrD,KAAK,iBAAiB,IAAI,qBAAqB,EAC/C,KAAK,qBAAqB,IAAI,yBAAyB,EACvD,KAAK,aAAa,IAAI,iBAAiB,EACvC,KAAK,wBAAwB,IAAI,4BAA4B,GAC9D,MAAM,mCAAmC,CAAC;AAE3C,YAAY;AACV;;GAEG;AACH,YAAY;AACZ;;GAEG;AACH,SAAS;AACT;;GAEG;AACH,qBAAqB;AACrB;;GAEG;AACH,uBAAuB;AAEvB;;GAEG;AACH,IAAI;AAEJ;;GAEG;AACH,WAAW;AACX;;GAEG;AACH,aAAa;AACb;;GAEG;AACH,oBAAoB;AAEpB;;GAEG;AACH,iBAAiB;AACjB;;GAEG;AACH,qBAAqB;AACrB;;GAEG;AACH,aAAa;AACb;;GAEG;AACH,wBAAwB,GACzB,MAAM,mCAAmC,CAAC;AAE3C,OAAO;AACL;;GAEG;AACH,aAAa;AAEb;;GAEG;AACH,aAAa,GACd,MAAM,mCAAmC,CAAC;AAE3C;;;GAGG;AACH,MAAM,MAAM,oBAAoB,CAAC,SAAS,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,IACxE,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export type { JSONRPC2, TRPCClientIncomingMessage, TRPCClientIncomingRequest, TRPCClientOutgoingMessage, TRPCClientOutgoingRequest, TRPCErrorResponse, TRPCErrorShape, TRPCReconnectNotification, TRPCRequest, TRPCRequestMessage, TRPCResponse, TRPCResponseMessage, TRPCResult, TRPCResultMessage, TRPCSubscriptionStopNotification, TRPCSuccessResponse, TRPC_ERROR_CODE_KEY, TRPC_ERROR_CODE_NUMBER, } from '../../unstable-core-do-not-import';
2
+ export { TRPC_ERROR_CODES_BY_KEY, TRPC_ERROR_CODES_BY_NUMBER, parseTRPCMessage, } from '../../unstable-core-do-not-import';
3
+ //# sourceMappingURL=rpc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../../../src/@trpc/server/rpc.ts"],"names":[],"mappings":"AACA,YAAY,EACV,QAAQ,EACR,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,EACzB,iBAAiB,EACjB,cAAc,EACd,yBAAyB,EACzB,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,iBAAiB,EACjB,gCAAgC,EAChC,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,mCAAmC,CAAC"}
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
3
3
  *
4
- * Do **not** import from `@trpc/core`
5
4
  * @example
6
5
  * ```ts
7
6
  * import type { AnyTRPCRouter } from '@trpc/server'
@@ -9,7 +8,7 @@
9
8
  * ```
10
9
  */
11
10
  import type { APIGatewayProxyEvent, APIGatewayProxyEventV2, APIGatewayProxyResult, APIGatewayProxyStructuredResultV2, Context as APIGWContext } from 'aws-lambda';
12
- import type { AnyRouter } from '../..';
11
+ import type { AnyRouter } from '../../@trpc/server';
13
12
  import type { APIGatewayEvent, AWSLambdaOptions } from './utils';
14
13
  export * from './utils';
15
14
  /** 1:1 mapping of v1 or v2 input events, deduces which is which.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/aws-lambda/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,iCAAiC,EACjC,OAAO,IAAI,YAAY,EACxB,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASvC,OAAO,KAAK,EACV,eAAe,EAEf,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAUjB,cAAc,SAAS,CAAC;AAqDxB;;IAEI;AACJ,KAAK,gBAAgB,CAAC,KAAK,IAAI,KAAK,SAAS,oBAAoB,GAC7D,qBAAqB,GACrB,KAAK,SAAS,sBAAsB,GACpC,iCAAiC,GACjC,KAAK,CAAC;AACV,wBAAgB,uBAAuB,CACrC,OAAO,SAAS,SAAS,EACzB,MAAM,SAAS,eAAe,EAC9B,OAAO,SAAS,gBAAgB,CAAC,MAAM,CAAC,EAExC,IAAI,EAAE,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,GACtC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,OAAO,CAAC,CA4B5D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/aws-lambda/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,iCAAiC,EACjC,OAAO,IAAI,YAAY,EACxB,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AASpD,OAAO,KAAK,EACV,eAAe,EAEf,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAUjB,cAAc,SAAS,CAAC;AAqDxB;;IAEI;AACJ,KAAK,gBAAgB,CAAC,KAAK,IAAI,KAAK,SAAS,oBAAoB,GAC7D,qBAAqB,GACrB,KAAK,SAAS,sBAAsB,GACpC,iCAAiC,GACjC,KAAK,CAAC;AACV,wBAAgB,uBAAuB,CACrC,OAAO,SAAS,SAAS,EACzB,MAAM,SAAS,eAAe,EAC9B,OAAO,SAAS,gBAAgB,CAAC,MAAM,CAAC,EAExC,IAAI,EAAE,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,GACtC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,OAAO,CAAC,CA4B5D"}
@@ -1,103 +1,14 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var core = require('@trpc/core');
6
-
7
- /**
8
- * If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
9
- *
10
- * Do **not** import from `@trpc/core`
11
- * @example
12
- * ```ts
13
- * import type { AnyTRPCRouter } from '@trpc/server'
14
- * import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
15
- * ```
16
- */ // @trpc/server
17
- function isPayloadV1(event) {
18
- return determinePayloadFormat(event) == '1.0';
19
- }
20
- function isPayloadV2(event) {
21
- return determinePayloadFormat(event) == '2.0';
22
- }
23
- function determinePayloadFormat(event) {
24
- // https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
25
- // According to AWS support, version is is extracted from the version property in the event.
26
- // If there is no version property, then the version is implied as 1.0
27
- const unknownEvent = event;
28
- if (typeof unknownEvent.version === 'undefined') {
29
- return '1.0';
30
- } else {
31
- if ([
32
- '1.0',
33
- '2.0'
34
- ].includes(unknownEvent.version)) {
35
- return unknownEvent.version;
36
- } else {
37
- return 'custom';
38
- }
39
- }
40
- }
41
- function getHTTPMethod(event) {
42
- if (isPayloadV1(event)) {
43
- return event.httpMethod;
44
- }
45
- if (isPayloadV2(event)) {
46
- return event.requestContext.http.method;
47
- }
48
- throw new core.TRPCError({
49
- code: 'INTERNAL_SERVER_ERROR',
50
- message: UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE
51
- });
52
- }
53
- function getPath(event) {
54
- if (isPayloadV1(event)) {
55
- if (!event.pathParameters) {
56
- // Then this event was not triggered by a resource denoted with {proxy+}
57
- return event.path.split('/').pop() ?? '';
58
- }
59
- const matches = event.resource.matchAll(/\{(.*?)\}/g);
60
- for (const match of matches){
61
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
62
- const group = match[1];
63
- if (group.includes('+') && event.pathParameters) {
64
- return event.pathParameters[group.replace('+', '')] ?? '';
65
- }
66
- }
67
- return event.path.slice(1);
68
- }
69
- if (isPayloadV2(event)) {
70
- const matches1 = event.routeKey.matchAll(/\{(.*?)\}/g);
71
- for (const match1 of matches1){
72
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
73
- const group1 = match1[1];
74
- if (group1.includes('+') && event.pathParameters) {
75
- return event.pathParameters[group1.replace('+', '')] ?? '';
76
- }
77
- }
78
- return event.rawPath.slice(1);
79
- }
80
- throw new core.TRPCError({
81
- code: 'INTERNAL_SERVER_ERROR',
82
- message: UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE
83
- });
84
- }
85
- function transformHeaders(headers) {
86
- const obj = {};
87
- for (const [key, value] of Object.entries(headers)){
88
- if (typeof value === 'undefined') {
89
- continue;
90
- }
91
- obj[key] = Array.isArray(value) ? value.join(',') : value;
92
- }
93
- return obj;
94
- }
95
- const UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE = 'Custom payload format version not handled by this adapter. Please use either 1.0 or 2.0. More information here' + 'https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html';
3
+ require('../../unstable-core-do-not-import/rpc/codes.js');
4
+ var TRPCError = require('../../unstable-core-do-not-import/error/TRPCError.js');
5
+ require('../../unstable-core-do-not-import/rootConfig.js');
6
+ var resolveHTTPResponse = require('../../unstable-core-do-not-import/http/resolveHTTPResponse.js');
7
+ var utils = require('./utils.js');
96
8
 
97
9
  /**
98
10
  * If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
99
11
  *
100
- * Do **not** import from `@trpc/core`
101
12
  * @example
102
13
  * ```ts
103
14
  * import type { AnyTRPCRouter } from '@trpc/server'
@@ -118,38 +29,38 @@ function lambdaEventToHTTPRequest(event) {
118
29
  body = event.body;
119
30
  }
120
31
  return {
121
- method: getHTTPMethod(event),
32
+ method: utils.getHTTPMethod(event),
122
33
  query: query,
123
34
  headers: event.headers,
124
35
  body: body
125
36
  };
126
37
  }
127
38
  function tRPCOutputToAPIGatewayOutput(event, response) {
128
- if (isPayloadV1(event)) {
39
+ if (utils.isPayloadV1(event)) {
129
40
  const resp = {
130
41
  statusCode: response.status,
131
42
  body: response.body ?? '',
132
- headers: transformHeaders(response.headers ?? {})
43
+ headers: utils.transformHeaders(response.headers ?? {})
133
44
  };
134
45
  return resp;
135
- } else if (isPayloadV2(event)) {
46
+ } else if (utils.isPayloadV2(event)) {
136
47
  const resp1 = {
137
48
  statusCode: response.status,
138
49
  body: response.body ?? undefined,
139
- headers: transformHeaders(response.headers ?? {})
50
+ headers: utils.transformHeaders(response.headers ?? {})
140
51
  };
141
52
  return resp1;
142
53
  } else {
143
- throw new core.TRPCError({
54
+ throw new TRPCError.TRPCError({
144
55
  code: 'INTERNAL_SERVER_ERROR',
145
- message: UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE
56
+ message: utils.UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE
146
57
  });
147
58
  }
148
59
  }
149
60
  function awsLambdaRequestHandler(opts) {
150
61
  return async (event, context)=>{
151
62
  const req = lambdaEventToHTTPRequest(event);
152
- const path = getPath(event);
63
+ const path = utils.getPath(event);
153
64
  const createContext = async (innerOpts)=>{
154
65
  return await opts.createContext?.({
155
66
  event,
@@ -157,7 +68,7 @@ function awsLambdaRequestHandler(opts) {
157
68
  ...innerOpts
158
69
  });
159
70
  };
160
- const response = await core.resolveHTTPResponse({
71
+ const response = await resolveHTTPResponse.resolveHTTPResponse({
161
72
  router: opts.router,
162
73
  batching: opts.batching,
163
74
  responseMeta: opts?.responseMeta,
@@ -176,10 +87,10 @@ function awsLambdaRequestHandler(opts) {
176
87
  };
177
88
  }
178
89
 
179
- exports.UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE = UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE;
90
+ exports.UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE = utils.UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE;
91
+ exports.getHTTPMethod = utils.getHTTPMethod;
92
+ exports.getPath = utils.getPath;
93
+ exports.isPayloadV1 = utils.isPayloadV1;
94
+ exports.isPayloadV2 = utils.isPayloadV2;
95
+ exports.transformHeaders = utils.transformHeaders;
180
96
  exports.awsLambdaRequestHandler = awsLambdaRequestHandler;
181
- exports.getHTTPMethod = getHTTPMethod;
182
- exports.getPath = getPath;
183
- exports.isPayloadV1 = isPayloadV1;
184
- exports.isPayloadV2 = isPayloadV2;
185
- exports.transformHeaders = transformHeaders;
@@ -1,99 +1,12 @@
1
- import { TRPCError, resolveHTTPResponse } from '@trpc/core';
1
+ import '../../unstable-core-do-not-import/rpc/codes.mjs';
2
+ import { TRPCError } from '../../unstable-core-do-not-import/error/TRPCError.mjs';
3
+ import '../../unstable-core-do-not-import/rootConfig.mjs';
4
+ import { resolveHTTPResponse } from '../../unstable-core-do-not-import/http/resolveHTTPResponse.mjs';
5
+ import { getPath, getHTTPMethod, isPayloadV1, transformHeaders, isPayloadV2, UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE } from './utils.mjs';
2
6
 
3
7
  /**
4
8
  * If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
5
9
  *
6
- * Do **not** import from `@trpc/core`
7
- * @example
8
- * ```ts
9
- * import type { AnyTRPCRouter } from '@trpc/server'
10
- * import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
11
- * ```
12
- */ // @trpc/server
13
- function isPayloadV1(event) {
14
- return determinePayloadFormat(event) == '1.0';
15
- }
16
- function isPayloadV2(event) {
17
- return determinePayloadFormat(event) == '2.0';
18
- }
19
- function determinePayloadFormat(event) {
20
- // https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
21
- // According to AWS support, version is is extracted from the version property in the event.
22
- // If there is no version property, then the version is implied as 1.0
23
- const unknownEvent = event;
24
- if (typeof unknownEvent.version === 'undefined') {
25
- return '1.0';
26
- } else {
27
- if ([
28
- '1.0',
29
- '2.0'
30
- ].includes(unknownEvent.version)) {
31
- return unknownEvent.version;
32
- } else {
33
- return 'custom';
34
- }
35
- }
36
- }
37
- function getHTTPMethod(event) {
38
- if (isPayloadV1(event)) {
39
- return event.httpMethod;
40
- }
41
- if (isPayloadV2(event)) {
42
- return event.requestContext.http.method;
43
- }
44
- throw new TRPCError({
45
- code: 'INTERNAL_SERVER_ERROR',
46
- message: UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE
47
- });
48
- }
49
- function getPath(event) {
50
- if (isPayloadV1(event)) {
51
- if (!event.pathParameters) {
52
- // Then this event was not triggered by a resource denoted with {proxy+}
53
- return event.path.split('/').pop() ?? '';
54
- }
55
- const matches = event.resource.matchAll(/\{(.*?)\}/g);
56
- for (const match of matches){
57
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
58
- const group = match[1];
59
- if (group.includes('+') && event.pathParameters) {
60
- return event.pathParameters[group.replace('+', '')] ?? '';
61
- }
62
- }
63
- return event.path.slice(1);
64
- }
65
- if (isPayloadV2(event)) {
66
- const matches1 = event.routeKey.matchAll(/\{(.*?)\}/g);
67
- for (const match1 of matches1){
68
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
69
- const group1 = match1[1];
70
- if (group1.includes('+') && event.pathParameters) {
71
- return event.pathParameters[group1.replace('+', '')] ?? '';
72
- }
73
- }
74
- return event.rawPath.slice(1);
75
- }
76
- throw new TRPCError({
77
- code: 'INTERNAL_SERVER_ERROR',
78
- message: UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE
79
- });
80
- }
81
- function transformHeaders(headers) {
82
- const obj = {};
83
- for (const [key, value] of Object.entries(headers)){
84
- if (typeof value === 'undefined') {
85
- continue;
86
- }
87
- obj[key] = Array.isArray(value) ? value.join(',') : value;
88
- }
89
- return obj;
90
- }
91
- const UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE = 'Custom payload format version not handled by this adapter. Please use either 1.0 or 2.0. More information here' + 'https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html';
92
-
93
- /**
94
- * If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
95
- *
96
- * Do **not** import from `@trpc/core`
97
10
  * @example
98
11
  * ```ts
99
12
  * import type { AnyTRPCRouter } from '@trpc/server'
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
3
3
  *
4
- * Do **not** import from `@trpc/core`
5
4
  * @example
6
5
  * ```ts
7
6
  * import type { AnyTRPCRouter } from '@trpc/server'
@@ -9,8 +8,8 @@
9
8
  * ```
10
9
  */
11
10
  import type { APIGatewayProxyEvent, APIGatewayProxyEventV2, APIGatewayProxyResult, APIGatewayProxyStructuredResultV2, Context as APIGWContext } from 'aws-lambda';
12
- import type { AnyRouter, inferRouterContext } from '../..';
13
- import type { HTTPHeaders, OnErrorFunction, ResponseMetaFn, TRPCRequestInfo } from '../../http';
11
+ import type { AnyRouter, inferRouterContext } from '../../@trpc/server';
12
+ import type { HTTPHeaders, OnErrorFunction, ResponseMetaFn, TRPCRequestInfo } from '../../@trpc/server/http';
14
13
  export type APIGatewayEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2;
15
14
  export type APIGatewayResult = APIGatewayProxyResult | APIGatewayProxyStructuredResultV2;
16
15
  export type CreateAWSLambdaContextOptions<TEvent extends APIGatewayEvent> = {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/adapters/aws-lambda/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,iCAAiC,EACjC,OAAO,IAAI,YAAY,EACxB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAI3D,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,cAAc,EACd,eAAe,EAChB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,eAAe,GAAG,oBAAoB,GAAG,sBAAsB,CAAC;AAC5E,MAAM,MAAM,gBAAgB,GACxB,qBAAqB,GACrB,iCAAiC,CAAC;AAEtC,MAAM,MAAM,6BAA6B,CAAC,MAAM,SAAS,eAAe,IAAI;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,YAAY,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AACF,MAAM,MAAM,wBAAwB,CAClC,OAAO,SAAS,SAAS,EACzB,MAAM,SAAS,eAAe,IAC5B,CAAC,EACH,KAAK,EACL,OAAO,EACP,IAAI,GACL,EAAE,6BAA6B,CAAC,MAAM,CAAC,KACpC,kBAAkB,CAAC,OAAO,CAAC,GAC3B,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;AAEzC,MAAM,MAAM,gBAAgB,CAC1B,OAAO,SAAS,SAAS,EACzB,MAAM,SAAS,eAAe,IAE5B;IACE,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE;QACT,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,OAAO,CAAC,EAAE,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC3C,YAAY,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;CACxC,GAAG,CACA;IACE;;QAEI;IACJ,aAAa,EAAE,wBAAwB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;CAC1D,GACD;IACE;;QAEI;IACJ,aAAa,CAAC,EAAE,wBAAwB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;CAC3D,CACJ,CAAC;AAEN,wBAAgB,WAAW,CACzB,KAAK,EAAE,eAAe,GACrB,KAAK,IAAI,oBAAoB,CAE/B;AACD,wBAAgB,WAAW,CACzB,KAAK,EAAE,eAAe,GACrB,KAAK,IAAI,sBAAsB,CAEjC;AAoBD,wBAAgB,aAAa,CAAC,KAAK,EAAE,eAAe,UAWnD;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,eAAe,UA+B7C;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,WAAW,GACnB,gBAAgB,CAAC,SAAS,CAAC,CAU7B;AAED,MAAM,MAAM,+BAA+B,GAAG,KAAK,GAAG,KAAK,CAAC;AAC5D,MAAM,MAAM,8BAA8B,GACtC,+BAA+B,GAC/B,QAAQ,CAAC;AAEb,eAAO,MAAM,4CAA4C,QAEiD,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/adapters/aws-lambda/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,iCAAiC,EACjC,OAAO,IAAI,YAAY,EACxB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAIxE,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,cAAc,EACd,eAAe,EAChB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,eAAe,GAAG,oBAAoB,GAAG,sBAAsB,CAAC;AAC5E,MAAM,MAAM,gBAAgB,GACxB,qBAAqB,GACrB,iCAAiC,CAAC;AAEtC,MAAM,MAAM,6BAA6B,CAAC,MAAM,SAAS,eAAe,IAAI;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,YAAY,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AACF,MAAM,MAAM,wBAAwB,CAClC,OAAO,SAAS,SAAS,EACzB,MAAM,SAAS,eAAe,IAC5B,CAAC,EACH,KAAK,EACL,OAAO,EACP,IAAI,GACL,EAAE,6BAA6B,CAAC,MAAM,CAAC,KACpC,kBAAkB,CAAC,OAAO,CAAC,GAC3B,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;AAEzC,MAAM,MAAM,gBAAgB,CAC1B,OAAO,SAAS,SAAS,EACzB,MAAM,SAAS,eAAe,IAE5B;IACE,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE;QACT,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,OAAO,CAAC,EAAE,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC3C,YAAY,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;CACxC,GAAG,CACA;IACE;;QAEI;IACJ,aAAa,EAAE,wBAAwB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;CAC1D,GACD;IACE;;QAEI;IACJ,aAAa,CAAC,EAAE,wBAAwB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;CAC3D,CACJ,CAAC;AAEN,wBAAgB,WAAW,CACzB,KAAK,EAAE,eAAe,GACrB,KAAK,IAAI,oBAAoB,CAE/B;AACD,wBAAgB,WAAW,CACzB,KAAK,EAAE,eAAe,GACrB,KAAK,IAAI,sBAAsB,CAEjC;AAoBD,wBAAgB,aAAa,CAAC,KAAK,EAAE,eAAe,UAWnD;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,eAAe,UA+B7C;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,WAAW,GACnB,gBAAgB,CAAC,SAAS,CAAC,CAU7B;AAED,MAAM,MAAM,+BAA+B,GAAG,KAAK,GAAG,KAAK,CAAC;AAC5D,MAAM,MAAM,8BAA8B,GACtC,+BAA+B,GAC/B,QAAQ,CAAC;AAEb,eAAO,MAAM,4CAA4C,QAEiD,CAAC"}
@@ -0,0 +1,101 @@
1
+ 'use strict';
2
+
3
+ require('../../unstable-core-do-not-import/rpc/codes.js');
4
+ var TRPCError = require('../../unstable-core-do-not-import/error/TRPCError.js');
5
+ require('../../unstable-core-do-not-import/rootConfig.js');
6
+
7
+ /**
8
+ * If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * import type { AnyTRPCRouter } from '@trpc/server'
13
+ * import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
14
+ * ```
15
+ */ // @trpc/server
16
+ function isPayloadV1(event) {
17
+ return determinePayloadFormat(event) == '1.0';
18
+ }
19
+ function isPayloadV2(event) {
20
+ return determinePayloadFormat(event) == '2.0';
21
+ }
22
+ function determinePayloadFormat(event) {
23
+ // https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
24
+ // According to AWS support, version is is extracted from the version property in the event.
25
+ // If there is no version property, then the version is implied as 1.0
26
+ const unknownEvent = event;
27
+ if (typeof unknownEvent.version === 'undefined') {
28
+ return '1.0';
29
+ } else {
30
+ if ([
31
+ '1.0',
32
+ '2.0'
33
+ ].includes(unknownEvent.version)) {
34
+ return unknownEvent.version;
35
+ } else {
36
+ return 'custom';
37
+ }
38
+ }
39
+ }
40
+ function getHTTPMethod(event) {
41
+ if (isPayloadV1(event)) {
42
+ return event.httpMethod;
43
+ }
44
+ if (isPayloadV2(event)) {
45
+ return event.requestContext.http.method;
46
+ }
47
+ throw new TRPCError.TRPCError({
48
+ code: 'INTERNAL_SERVER_ERROR',
49
+ message: UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE
50
+ });
51
+ }
52
+ function getPath(event) {
53
+ if (isPayloadV1(event)) {
54
+ if (!event.pathParameters) {
55
+ // Then this event was not triggered by a resource denoted with {proxy+}
56
+ return event.path.split('/').pop() ?? '';
57
+ }
58
+ const matches = event.resource.matchAll(/\{(.*?)\}/g);
59
+ for (const match of matches){
60
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
61
+ const group = match[1];
62
+ if (group.includes('+') && event.pathParameters) {
63
+ return event.pathParameters[group.replace('+', '')] ?? '';
64
+ }
65
+ }
66
+ return event.path.slice(1);
67
+ }
68
+ if (isPayloadV2(event)) {
69
+ const matches1 = event.routeKey.matchAll(/\{(.*?)\}/g);
70
+ for (const match1 of matches1){
71
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
72
+ const group1 = match1[1];
73
+ if (group1.includes('+') && event.pathParameters) {
74
+ return event.pathParameters[group1.replace('+', '')] ?? '';
75
+ }
76
+ }
77
+ return event.rawPath.slice(1);
78
+ }
79
+ throw new TRPCError.TRPCError({
80
+ code: 'INTERNAL_SERVER_ERROR',
81
+ message: UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE
82
+ });
83
+ }
84
+ function transformHeaders(headers) {
85
+ const obj = {};
86
+ for (const [key, value] of Object.entries(headers)){
87
+ if (typeof value === 'undefined') {
88
+ continue;
89
+ }
90
+ obj[key] = Array.isArray(value) ? value.join(',') : value;
91
+ }
92
+ return obj;
93
+ }
94
+ const UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE = 'Custom payload format version not handled by this adapter. Please use either 1.0 or 2.0. More information here' + 'https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html';
95
+
96
+ exports.UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE = UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE;
97
+ exports.getHTTPMethod = getHTTPMethod;
98
+ exports.getPath = getPath;
99
+ exports.isPayloadV1 = isPayloadV1;
100
+ exports.isPayloadV2 = isPayloadV2;
101
+ exports.transformHeaders = transformHeaders;
@@ -0,0 +1,94 @@
1
+ import '../../unstable-core-do-not-import/rpc/codes.mjs';
2
+ import { TRPCError } from '../../unstable-core-do-not-import/error/TRPCError.mjs';
3
+ import '../../unstable-core-do-not-import/rootConfig.mjs';
4
+
5
+ /**
6
+ * If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import type { AnyTRPCRouter } from '@trpc/server'
11
+ * import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
12
+ * ```
13
+ */ // @trpc/server
14
+ function isPayloadV1(event) {
15
+ return determinePayloadFormat(event) == '1.0';
16
+ }
17
+ function isPayloadV2(event) {
18
+ return determinePayloadFormat(event) == '2.0';
19
+ }
20
+ function determinePayloadFormat(event) {
21
+ // https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
22
+ // According to AWS support, version is is extracted from the version property in the event.
23
+ // If there is no version property, then the version is implied as 1.0
24
+ const unknownEvent = event;
25
+ if (typeof unknownEvent.version === 'undefined') {
26
+ return '1.0';
27
+ } else {
28
+ if ([
29
+ '1.0',
30
+ '2.0'
31
+ ].includes(unknownEvent.version)) {
32
+ return unknownEvent.version;
33
+ } else {
34
+ return 'custom';
35
+ }
36
+ }
37
+ }
38
+ function getHTTPMethod(event) {
39
+ if (isPayloadV1(event)) {
40
+ return event.httpMethod;
41
+ }
42
+ if (isPayloadV2(event)) {
43
+ return event.requestContext.http.method;
44
+ }
45
+ throw new TRPCError({
46
+ code: 'INTERNAL_SERVER_ERROR',
47
+ message: UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE
48
+ });
49
+ }
50
+ function getPath(event) {
51
+ if (isPayloadV1(event)) {
52
+ if (!event.pathParameters) {
53
+ // Then this event was not triggered by a resource denoted with {proxy+}
54
+ return event.path.split('/').pop() ?? '';
55
+ }
56
+ const matches = event.resource.matchAll(/\{(.*?)\}/g);
57
+ for (const match of matches){
58
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
59
+ const group = match[1];
60
+ if (group.includes('+') && event.pathParameters) {
61
+ return event.pathParameters[group.replace('+', '')] ?? '';
62
+ }
63
+ }
64
+ return event.path.slice(1);
65
+ }
66
+ if (isPayloadV2(event)) {
67
+ const matches1 = event.routeKey.matchAll(/\{(.*?)\}/g);
68
+ for (const match1 of matches1){
69
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
70
+ const group1 = match1[1];
71
+ if (group1.includes('+') && event.pathParameters) {
72
+ return event.pathParameters[group1.replace('+', '')] ?? '';
73
+ }
74
+ }
75
+ return event.rawPath.slice(1);
76
+ }
77
+ throw new TRPCError({
78
+ code: 'INTERNAL_SERVER_ERROR',
79
+ message: UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE
80
+ });
81
+ }
82
+ function transformHeaders(headers) {
83
+ const obj = {};
84
+ for (const [key, value] of Object.entries(headers)){
85
+ if (typeof value === 'undefined') {
86
+ continue;
87
+ }
88
+ obj[key] = Array.isArray(value) ? value.join(',') : value;
89
+ }
90
+ return obj;
91
+ }
92
+ const UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE = 'Custom payload format version not handled by this adapter. Please use either 1.0 or 2.0. More information here' + 'https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html';
93
+
94
+ export { UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE, getHTTPMethod, getPath, isPayloadV1, isPayloadV2, transformHeaders };
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`
3
3
  *
4
- * Do **not** import from `@trpc/core`
5
4
  * @example
6
5
  * ```ts
7
6
  * import type { AnyTRPCRouter } from '@trpc/server'
@@ -9,7 +8,7 @@
9
8
  * ```
10
9
  */
11
10
  import type * as express from 'express';
12
- import type { AnyRouter } from '..';
11
+ import type { AnyRouter } from '../@trpc/server';
13
12
  import type { NodeHTTPCreateContextFnOptions, NodeHTTPHandlerOptions } from './node-http';
14
13
  export type CreateExpressContextOptions = NodeHTTPCreateContextFnOptions<express.Request, express.Response>;
15
14
  export declare function createExpressMiddleware<TRouter extends AnyRouter>(opts: NodeHTTPHandlerOptions<TRouter, express.Request, express.Response>): express.Handler;
@@ -1 +1 @@
1
- {"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../src/adapters/express.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,KAAK,EACV,8BAA8B,EAC9B,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAGrB,MAAM,MAAM,2BAA2B,GAAG,8BAA8B,CACtE,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,QAAQ,CACjB,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,OAAO,SAAS,SAAS,EAC/D,IAAI,EAAE,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,GACvE,OAAO,CAAC,OAAO,CAgBjB"}
1
+ {"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../src/adapters/express.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EACV,8BAA8B,EAC9B,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAGrB,MAAM,MAAM,2BAA2B,GAAG,8BAA8B,CACtE,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,QAAQ,CACjB,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,OAAO,SAAS,SAAS,EAC/D,IAAI,EAAE,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,GACvE,OAAO,CAAC,OAAO,CAgBjB"}