@trpc/client 11.3.1 → 11.3.2-canary.2

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 (238) hide show
  1. package/dist/TRPCClientError-CGgRtttT.cjs +67 -0
  2. package/dist/TRPCClientError-COkhCKf3.mjs +56 -0
  3. package/dist/TRPCClientError-COkhCKf3.mjs.map +1 -0
  4. package/dist/chunk-DWy1uDak.cjs +39 -0
  5. package/dist/httpBatchLink-CIC9PZ_Z.cjs +267 -0
  6. package/dist/httpBatchLink-DIfnmmcu.mjs +238 -0
  7. package/dist/httpBatchLink-DIfnmmcu.mjs.map +1 -0
  8. package/dist/httpBatchLink.d-BN2Iw_cK.d.mts +33 -0
  9. package/dist/httpBatchLink.d-BN2Iw_cK.d.mts.map +1 -0
  10. package/dist/httpBatchLink.d-CLAuJKNV.d.cts +33 -0
  11. package/dist/httpBatchLink.d-CLAuJKNV.d.cts.map +1 -0
  12. package/dist/httpLink-9bpwQ15c.mjs +90 -0
  13. package/dist/httpLink-9bpwQ15c.mjs.map +1 -0
  14. package/dist/httpLink-BbVj_TgM.cjs +113 -0
  15. package/dist/httpLink.d-CTSOARfE.d.mts +23 -0
  16. package/dist/httpLink.d-CTSOARfE.d.mts.map +1 -0
  17. package/dist/httpLink.d-yMKfOlTU.d.cts +23 -0
  18. package/dist/httpLink.d-yMKfOlTU.d.cts.map +1 -0
  19. package/dist/httpUtils-3pbQzhUL.mjs +123 -0
  20. package/dist/httpUtils-3pbQzhUL.mjs.map +1 -0
  21. package/dist/httpUtils-Buf6jCgh.cjs +163 -0
  22. package/dist/httpUtils.d-C8wPxU79.d.mts +25 -0
  23. package/dist/httpUtils.d-C8wPxU79.d.mts.map +1 -0
  24. package/dist/httpUtils.d-DNRVGNHs.d.cts +25 -0
  25. package/dist/httpUtils.d-DNRVGNHs.d.cts.map +1 -0
  26. package/dist/index.cjs +731 -0
  27. package/dist/index.d.cts +197 -0
  28. package/dist/index.d.cts.map +1 -0
  29. package/dist/index.d.mts +197 -0
  30. package/dist/index.d.mts.map +1 -0
  31. package/dist/index.mjs +733 -16
  32. package/dist/index.mjs.map +1 -0
  33. package/dist/links/httpBatchLink.cjs +6 -0
  34. package/dist/links/httpBatchLink.d.cts +6 -0
  35. package/dist/links/httpBatchLink.d.mts +6 -0
  36. package/dist/links/httpBatchLink.mjs +5 -107
  37. package/dist/links/httpLink.cjs +6 -0
  38. package/dist/links/httpLink.d.cts +6 -0
  39. package/dist/links/httpLink.d.mts +6 -0
  40. package/dist/links/httpLink.mjs +5 -92
  41. package/dist/links/loggerLink.cjs +3 -0
  42. package/dist/links/loggerLink.d.cts +4 -0
  43. package/dist/links/loggerLink.d.mts +4 -0
  44. package/dist/links/loggerLink.mjs +2 -175
  45. package/dist/links/splitLink.cjs +3 -0
  46. package/dist/links/splitLink.d.cts +4 -0
  47. package/dist/links/splitLink.d.mts +4 -0
  48. package/dist/links/splitLink.mjs +2 -24
  49. package/dist/links/wsLink/wsLink.cjs +6 -0
  50. package/dist/links/wsLink/wsLink.d.cts +5 -0
  51. package/dist/links/wsLink/wsLink.d.mts +5 -0
  52. package/dist/links/wsLink/wsLink.mjs +4 -31
  53. package/dist/loggerLink-CsDfg5Bb.cjs +130 -0
  54. package/dist/loggerLink-PGBSQFcR.mjs +125 -0
  55. package/dist/loggerLink-PGBSQFcR.mjs.map +1 -0
  56. package/dist/loggerLink.d-CZjK1CXm.d.mts +54 -0
  57. package/dist/loggerLink.d-CZjK1CXm.d.mts.map +1 -0
  58. package/dist/loggerLink.d-DU855urG.d.cts +54 -0
  59. package/dist/loggerLink.d-DU855urG.d.cts.map +1 -0
  60. package/dist/splitLink-BMgxggng.cjs +58 -0
  61. package/dist/splitLink-BVblHq4n.mjs +47 -0
  62. package/dist/splitLink-BVblHq4n.mjs.map +1 -0
  63. package/dist/splitLink.d-BAqgq0NG.d.mts +20 -0
  64. package/dist/splitLink.d-BAqgq0NG.d.mts.map +1 -0
  65. package/dist/splitLink.d-GdevSkGW.d.cts +20 -0
  66. package/dist/splitLink.d-GdevSkGW.d.cts.map +1 -0
  67. package/dist/subscriptions.d-Ciljg_dH.d.cts +19 -0
  68. package/dist/subscriptions.d-Ciljg_dH.d.cts.map +1 -0
  69. package/dist/subscriptions.d-U92STdZl.d.mts +19 -0
  70. package/dist/subscriptions.d-U92STdZl.d.mts.map +1 -0
  71. package/dist/types.d-DXbqQLCC.d.mts +182 -0
  72. package/dist/types.d-DXbqQLCC.d.mts.map +1 -0
  73. package/dist/types.d-DqGYG6S_.d.cts +182 -0
  74. package/dist/types.d-DqGYG6S_.d.cts.map +1 -0
  75. package/dist/unstable-internals-CYBH4jbF.cjs +34 -0
  76. package/dist/unstable-internals-DU4WecoG.mjs +29 -0
  77. package/dist/unstable-internals-DU4WecoG.mjs.map +1 -0
  78. package/dist/unstable-internals.cjs +3 -0
  79. package/dist/unstable-internals.d-DyLd-B0J.d.mts +46 -0
  80. package/dist/unstable-internals.d-DyLd-B0J.d.mts.map +1 -0
  81. package/dist/unstable-internals.d-kWsZTlQq.d.cts +46 -0
  82. package/dist/unstable-internals.d-kWsZTlQq.d.cts.map +1 -0
  83. package/dist/unstable-internals.d.cts +3 -0
  84. package/dist/unstable-internals.d.mts +3 -0
  85. package/dist/unstable-internals.mjs +3 -1
  86. package/dist/wsLink-DbSHOzlB.mjs +698 -0
  87. package/dist/wsLink-DbSHOzlB.mjs.map +1 -0
  88. package/dist/wsLink-DhJ50EC5.cjs +715 -0
  89. package/dist/wsLink.d-BqO7ltN_.d.mts +194 -0
  90. package/dist/wsLink.d-BqO7ltN_.d.mts.map +1 -0
  91. package/dist/wsLink.d-DtZjg09g.d.cts +194 -0
  92. package/dist/wsLink.d-DtZjg09g.d.cts.map +1 -0
  93. package/links/httpBatchLink/package.json +1 -0
  94. package/links/httpLink/package.json +1 -0
  95. package/links/loggerLink/package.json +1 -0
  96. package/links/splitLink/package.json +1 -0
  97. package/links/wsLink/wsLink/package.json +1 -0
  98. package/package.json +67 -33
  99. package/unstable-internals/package.json +1 -0
  100. package/dist/TRPCClientError.d.ts +0 -30
  101. package/dist/TRPCClientError.d.ts.map +0 -1
  102. package/dist/TRPCClientError.js +0 -79
  103. package/dist/TRPCClientError.mjs +0 -76
  104. package/dist/createTRPCClient.d.ts +0 -69
  105. package/dist/createTRPCClient.d.ts.map +0 -1
  106. package/dist/createTRPCClient.js +0 -48
  107. package/dist/createTRPCClient.mjs +0 -43
  108. package/dist/createTRPCUntypedClient.d.ts +0 -7
  109. package/dist/createTRPCUntypedClient.d.ts.map +0 -1
  110. package/dist/createTRPCUntypedClient.js +0 -10
  111. package/dist/createTRPCUntypedClient.mjs +0 -7
  112. package/dist/getFetch.d.ts +0 -3
  113. package/dist/getFetch.d.ts.map +0 -1
  114. package/dist/getFetch.js +0 -17
  115. package/dist/getFetch.mjs +0 -15
  116. package/dist/index.d.ts +0 -16
  117. package/dist/index.d.ts.map +0 -1
  118. package/dist/index.js +0 -46
  119. package/dist/internals/TRPCUntypedClient.d.ts +0 -39
  120. package/dist/internals/TRPCUntypedClient.d.ts.map +0 -1
  121. package/dist/internals/TRPCUntypedClient.js +0 -115
  122. package/dist/internals/TRPCUntypedClient.mjs +0 -113
  123. package/dist/internals/dataLoader.d.ts +0 -13
  124. package/dist/internals/dataLoader.d.ts.map +0 -1
  125. package/dist/internals/dataLoader.js +0 -117
  126. package/dist/internals/dataLoader.mjs +0 -115
  127. package/dist/internals/inputWithTrackedEventId.d.ts +0 -2
  128. package/dist/internals/inputWithTrackedEventId.d.ts.map +0 -1
  129. package/dist/internals/inputWithTrackedEventId.js +0 -16
  130. package/dist/internals/inputWithTrackedEventId.mjs +0 -14
  131. package/dist/internals/signals.d.ts +0 -16
  132. package/dist/internals/signals.d.ts.map +0 -1
  133. package/dist/internals/signals.js +0 -61
  134. package/dist/internals/signals.mjs +0 -57
  135. package/dist/internals/transformer.d.ts +0 -42
  136. package/dist/internals/transformer.d.ts.map +0 -1
  137. package/dist/internals/transformer.js +0 -30
  138. package/dist/internals/transformer.mjs +0 -28
  139. package/dist/internals/types.d.ts +0 -82
  140. package/dist/internals/types.d.ts.map +0 -1
  141. package/dist/links/HTTPBatchLinkOptions.d.ts +0 -20
  142. package/dist/links/HTTPBatchLinkOptions.d.ts.map +0 -1
  143. package/dist/links/httpBatchLink.d.ts +0 -8
  144. package/dist/links/httpBatchLink.d.ts.map +0 -1
  145. package/dist/links/httpBatchLink.js +0 -110
  146. package/dist/links/httpBatchStreamLink.d.ts +0 -12
  147. package/dist/links/httpBatchStreamLink.d.ts.map +0 -1
  148. package/dist/links/httpBatchStreamLink.js +0 -150
  149. package/dist/links/httpBatchStreamLink.mjs +0 -147
  150. package/dist/links/httpLink.d.ts +0 -17
  151. package/dist/links/httpLink.d.ts.map +0 -1
  152. package/dist/links/httpLink.js +0 -95
  153. package/dist/links/httpSubscriptionLink.d.ts +0 -26
  154. package/dist/links/httpSubscriptionLink.d.ts.map +0 -1
  155. package/dist/links/httpSubscriptionLink.js +0 -177
  156. package/dist/links/httpSubscriptionLink.mjs +0 -174
  157. package/dist/links/internals/contentTypes.d.ts +0 -4
  158. package/dist/links/internals/contentTypes.d.ts.map +0 -1
  159. package/dist/links/internals/contentTypes.js +0 -16
  160. package/dist/links/internals/contentTypes.mjs +0 -12
  161. package/dist/links/internals/createChain.d.ts +0 -8
  162. package/dist/links/internals/createChain.d.ts.map +0 -1
  163. package/dist/links/internals/createChain.js +0 -26
  164. package/dist/links/internals/createChain.mjs +0 -24
  165. package/dist/links/internals/dedupeLink.d.ts +0 -7
  166. package/dist/links/internals/dedupeLink.d.ts.map +0 -1
  167. package/dist/links/internals/httpUtils.d.ts +0 -68
  168. package/dist/links/internals/httpUtils.d.ts.map +0 -1
  169. package/dist/links/internals/httpUtils.js +0 -141
  170. package/dist/links/internals/httpUtils.mjs +0 -133
  171. package/dist/links/internals/subscriptions.d.ts +0 -17
  172. package/dist/links/internals/subscriptions.d.ts.map +0 -1
  173. package/dist/links/internals/urlWithConnectionParams.d.ts +0 -23
  174. package/dist/links/internals/urlWithConnectionParams.d.ts.map +0 -1
  175. package/dist/links/internals/urlWithConnectionParams.js +0 -10
  176. package/dist/links/internals/urlWithConnectionParams.mjs +0 -8
  177. package/dist/links/localLink.d.ts +0 -15
  178. package/dist/links/localLink.d.ts.map +0 -1
  179. package/dist/links/localLink.js +0 -333
  180. package/dist/links/localLink.mjs +0 -331
  181. package/dist/links/loggerLink.d.ts +0 -52
  182. package/dist/links/loggerLink.d.ts.map +0 -1
  183. package/dist/links/loggerLink.js +0 -178
  184. package/dist/links/retryLink.d.ts +0 -33
  185. package/dist/links/retryLink.d.ts.map +0 -1
  186. package/dist/links/retryLink.js +0 -72
  187. package/dist/links/retryLink.mjs +0 -70
  188. package/dist/links/splitLink.d.ts +0 -14
  189. package/dist/links/splitLink.d.ts.map +0 -1
  190. package/dist/links/splitLink.js +0 -27
  191. package/dist/links/types.d.ts +0 -63
  192. package/dist/links/types.d.ts.map +0 -1
  193. package/dist/links/wsLink/createWsClient.d.ts +0 -6
  194. package/dist/links/wsLink/createWsClient.d.ts.map +0 -1
  195. package/dist/links/wsLink/createWsClient.js +0 -9
  196. package/dist/links/wsLink/createWsClient.mjs +0 -7
  197. package/dist/links/wsLink/wsClient/options.d.ts +0 -79
  198. package/dist/links/wsLink/wsClient/options.d.ts.map +0 -1
  199. package/dist/links/wsLink/wsClient/options.js +0 -22
  200. package/dist/links/wsLink/wsClient/options.mjs +0 -18
  201. package/dist/links/wsLink/wsClient/requestManager.d.ts +0 -106
  202. package/dist/links/wsLink/wsClient/requestManager.d.ts.map +0 -1
  203. package/dist/links/wsLink/wsClient/requestManager.js +0 -143
  204. package/dist/links/wsLink/wsClient/requestManager.mjs +0 -141
  205. package/dist/links/wsLink/wsClient/utils.d.ts +0 -38
  206. package/dist/links/wsLink/wsClient/utils.d.ts.map +0 -1
  207. package/dist/links/wsLink/wsClient/utils.js +0 -94
  208. package/dist/links/wsLink/wsClient/utils.mjs +0 -88
  209. package/dist/links/wsLink/wsClient/wsClient.d.ts +0 -84
  210. package/dist/links/wsLink/wsClient/wsClient.d.ts.map +0 -1
  211. package/dist/links/wsLink/wsClient/wsClient.js +0 -325
  212. package/dist/links/wsLink/wsClient/wsClient.mjs +0 -323
  213. package/dist/links/wsLink/wsClient/wsConnection.d.ts +0 -79
  214. package/dist/links/wsLink/wsClient/wsConnection.d.ts.map +0 -1
  215. package/dist/links/wsLink/wsClient/wsConnection.js +0 -188
  216. package/dist/links/wsLink/wsClient/wsConnection.mjs +0 -185
  217. package/dist/links/wsLink/wsLink.d.ts +0 -11
  218. package/dist/links/wsLink/wsLink.d.ts.map +0 -1
  219. package/dist/links/wsLink/wsLink.js +0 -35
  220. package/dist/links.d.ts +0 -12
  221. package/dist/links.d.ts.map +0 -1
  222. package/dist/unstable-internals.d.ts +0 -3
  223. package/dist/unstable-internals.d.ts.map +0 -1
  224. package/dist/unstable-internals.js +0 -7
  225. package/links/httpBatchLink/index.d.ts +0 -1
  226. package/links/httpBatchLink/index.js +0 -1
  227. package/links/httpLink/index.d.ts +0 -1
  228. package/links/httpLink/index.js +0 -1
  229. package/links/loggerLink/index.d.ts +0 -1
  230. package/links/loggerLink/index.js +0 -1
  231. package/links/splitLink/index.d.ts +0 -1
  232. package/links/splitLink/index.js +0 -1
  233. package/links/wsLink/index.d.ts +0 -1
  234. package/links/wsLink/index.js +0 -1
  235. package/links/wsLink/wsLink/index.d.ts +0 -1
  236. package/links/wsLink/wsLink/index.js +0 -1
  237. package/unstable-internals/index.d.ts +0 -1
  238. package/unstable-internals/index.js +0 -1
@@ -1,82 +0,0 @@
1
- /**
2
- * A subset of the standard fetch function type needed by tRPC internally.
3
- * @see fetch from lib.dom.d.ts
4
- * @remarks
5
- * If you need a property that you know exists but doesn't exist on this
6
- * interface, go ahead and add it.
7
- */
8
- export type FetchEsque = (input: RequestInfo | URL | string, init?: RequestInit | RequestInitEsque) => Promise<ResponseEsque>;
9
- /**
10
- * A simpler version of the native fetch function's type for packages with
11
- * their own fetch types, such as undici and node-fetch.
12
- */
13
- export type NativeFetchEsque = (url: URL | string, init?: NodeFetchRequestInitEsque) => Promise<ResponseEsque>;
14
- export interface NodeFetchRequestInitEsque {
15
- body?: string;
16
- }
17
- /**
18
- * A subset of the standard RequestInit properties needed by tRPC internally.
19
- * @see RequestInit from lib.dom.d.ts
20
- * @remarks
21
- * If you need a property that you know exists but doesn't exist on this
22
- * interface, go ahead and add it.
23
- */
24
- export interface RequestInitEsque {
25
- /**
26
- * Sets the request's body.
27
- */
28
- body?: FormData | string | null | Uint8Array | Blob | File;
29
- /**
30
- * Sets the request's associated headers.
31
- */
32
- headers?: [string, string][] | Record<string, string>;
33
- /**
34
- * The request's HTTP-style method.
35
- */
36
- method?: string;
37
- /**
38
- * Sets the request's signal.
39
- */
40
- signal?: AbortSignal | undefined;
41
- }
42
- /**
43
- * A subset of the standard ReadableStream properties needed by tRPC internally.
44
- * @see ReadableStream from lib.dom.d.ts
45
- */
46
- export type WebReadableStreamEsque = {
47
- getReader: () => ReadableStreamDefaultReader<Uint8Array>;
48
- };
49
- export type NodeJSReadableStreamEsque = {
50
- on(eventName: string | symbol, listener: (...args: any[]) => void): NodeJSReadableStreamEsque;
51
- };
52
- /**
53
- * A subset of the standard Response properties needed by tRPC internally.
54
- * @see Response from lib.dom.d.ts
55
- */
56
- export interface ResponseEsque {
57
- readonly body?: NodeJSReadableStreamEsque | WebReadableStreamEsque | null;
58
- /**
59
- * @remarks
60
- * The built-in Response::json() method returns Promise<any>, but
61
- * that's not as type-safe as unknown. We use unknown because we're
62
- * more type-safe. You do want more type safety, right? 😉
63
- */
64
- json(): Promise<unknown>;
65
- }
66
- /**
67
- * @internal
68
- */
69
- export type NonEmptyArray<TItem> = [TItem, ...TItem[]];
70
- type ClientContext = Record<string, unknown>;
71
- /**
72
- * @public
73
- */
74
- export interface TRPCProcedureOptions {
75
- /**
76
- * Client-side context
77
- */
78
- context?: ClientContext;
79
- signal?: AbortSignal;
80
- }
81
- export {};
82
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/internals/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,CACvB,KAAK,EAAE,WAAW,GAAG,GAAG,GAAG,MAAM,EACjC,IAAI,CAAC,EAAE,WAAW,GAAG,gBAAgB,KAClC,OAAO,CAAC,aAAa,CAAC,CAAC;AAE5B;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC7B,GAAG,EAAE,GAAG,GAAG,MAAM,EACjB,IAAI,CAAC,EAAE,yBAAyB,KAC7B,OAAO,CAAC,aAAa,CAAC,CAAC;AAE5B,MAAM,WAAW,yBAAyB;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,GAAG,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;IAE3D;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEtD;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,MAAM,2BAA2B,CAAC,UAAU,CAAC,CAAC;CAC1D,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,EAAE,CACA,SAAS,EAAE,MAAM,GAAG,MAAM,EAC1B,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GACjC,yBAAyB,CAAC;CAC9B,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,yBAAyB,GAAG,sBAAsB,GAAG,IAAI,CAAC;IAC1E;;;;;OAKG;IACH,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,KAAK,IAAI,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;AAEvD,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB"}
@@ -1,20 +0,0 @@
1
- import type { AnyClientTypes } from '@trpc/server/unstable-core-do-not-import';
2
- import type { NonEmptyArray } from '../internals/types';
3
- import type { HTTPLinkBaseOptions } from './internals/httpUtils';
4
- import type { HTTPHeaders, Operation } from './types';
5
- export type HTTPBatchLinkOptions<TRoot extends AnyClientTypes> = HTTPLinkBaseOptions<TRoot> & {
6
- maxURLLength?: number;
7
- /**
8
- * Headers to be set on outgoing requests or a callback that of said headers
9
- * @see http://trpc.io/docs/client/headers
10
- */
11
- headers?: HTTPHeaders | ((opts: {
12
- opList: NonEmptyArray<Operation>;
13
- }) => HTTPHeaders | Promise<HTTPHeaders>);
14
- /**
15
- * Maximum number of calls in a single batch request
16
- * @default Infinity
17
- */
18
- maxItems?: number;
19
- };
20
- //# sourceMappingURL=HTTPBatchLinkOptions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HTTPBatchLinkOptions.d.ts","sourceRoot":"","sources":["../../src/links/HTTPBatchLinkOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEtD,MAAM,MAAM,oBAAoB,CAAC,KAAK,SAAS,cAAc,IAC3D,mBAAmB,CAAC,KAAK,CAAC,GAAG;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,EACJ,WAAW,GACX,CAAC,CAAC,IAAI,EAAE;QACN,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;KAClC,KAAK,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;IAE9C;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC"}
@@ -1,8 +0,0 @@
1
- import type { AnyRouter } from '@trpc/server';
2
- import type { HTTPBatchLinkOptions } from './HTTPBatchLinkOptions';
3
- import type { TRPCLink } from './types';
4
- /**
5
- * @see https://trpc.io/docs/client/links/httpBatchLink
6
- */
7
- export declare function httpBatchLink<TRouter extends AnyRouter>(opts: HTTPBatchLinkOptions<TRouter['_def']['_config']['$types']>): TRPCLink<TRouter>;
8
- //# sourceMappingURL=httpBatchLink.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"httpBatchLink.d.ts","sourceRoot":"","sources":["../../src/links/httpBatchLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAiB,MAAM,cAAc,CAAC;AAQ7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAOnE,OAAO,KAAK,EAAa,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnD;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,SAAS,SAAS,EACrD,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,GAC/D,QAAQ,CAAC,OAAO,CAAC,CAsHnB"}
@@ -1,110 +0,0 @@
1
- 'use strict';
2
-
3
- var observable = require('@trpc/server/observable');
4
- var unstableCoreDoNotImport = require('@trpc/server/unstable-core-do-not-import');
5
- var dataLoader = require('../internals/dataLoader.js');
6
- var signals = require('../internals/signals.js');
7
- var TRPCClientError = require('../TRPCClientError.js');
8
- var httpUtils = require('./internals/httpUtils.js');
9
-
10
- /**
11
- * @see https://trpc.io/docs/client/links/httpBatchLink
12
- */ function httpBatchLink(opts) {
13
- const resolvedOpts = httpUtils.resolveHTTPLinkOptions(opts);
14
- const maxURLLength = opts.maxURLLength ?? Infinity;
15
- const maxItems = opts.maxItems ?? Infinity;
16
- return ()=>{
17
- const batchLoader = (type)=>{
18
- return {
19
- validate (batchOps) {
20
- if (maxURLLength === Infinity && maxItems === Infinity) {
21
- // escape hatch for quick calcs
22
- return true;
23
- }
24
- if (batchOps.length > maxItems) {
25
- return false;
26
- }
27
- const path = batchOps.map((op)=>op.path).join(',');
28
- const inputs = batchOps.map((op)=>op.input);
29
- const url = httpUtils.getUrl({
30
- ...resolvedOpts,
31
- type,
32
- path,
33
- inputs,
34
- signal: null
35
- });
36
- return url.length <= maxURLLength;
37
- },
38
- async fetch (batchOps) {
39
- const path = batchOps.map((op)=>op.path).join(',');
40
- const inputs = batchOps.map((op)=>op.input);
41
- const signal = signals.allAbortSignals(...batchOps.map((op)=>op.signal));
42
- const res = await httpUtils.jsonHttpRequester({
43
- ...resolvedOpts,
44
- path,
45
- inputs,
46
- type,
47
- headers () {
48
- if (!opts.headers) {
49
- return {};
50
- }
51
- if (typeof opts.headers === 'function') {
52
- return opts.headers({
53
- opList: batchOps
54
- });
55
- }
56
- return opts.headers;
57
- },
58
- signal
59
- });
60
- const resJSON = Array.isArray(res.json) ? res.json : batchOps.map(()=>res.json);
61
- const result = resJSON.map((item)=>({
62
- meta: res.meta,
63
- json: item
64
- }));
65
- return result;
66
- }
67
- };
68
- };
69
- const query = dataLoader.dataLoader(batchLoader('query'));
70
- const mutation = dataLoader.dataLoader(batchLoader('mutation'));
71
- const loaders = {
72
- query,
73
- mutation
74
- };
75
- return ({ op })=>{
76
- return observable.observable((observer)=>{
77
- /* istanbul ignore if -- @preserve */ if (op.type === 'subscription') {
78
- throw new Error('Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`');
79
- }
80
- const loader = loaders[op.type];
81
- const promise = loader.load(op);
82
- let _res = undefined;
83
- promise.then((res)=>{
84
- _res = res;
85
- const transformed = unstableCoreDoNotImport.transformResult(res.json, resolvedOpts.transformer.output);
86
- if (!transformed.ok) {
87
- observer.error(TRPCClientError.TRPCClientError.from(transformed.error, {
88
- meta: res.meta
89
- }));
90
- return;
91
- }
92
- observer.next({
93
- context: res.meta,
94
- result: transformed.result
95
- });
96
- observer.complete();
97
- }).catch((err)=>{
98
- observer.error(TRPCClientError.TRPCClientError.from(err, {
99
- meta: _res?.meta
100
- }));
101
- });
102
- return ()=>{
103
- // noop
104
- };
105
- });
106
- };
107
- };
108
- }
109
-
110
- exports.httpBatchLink = httpBatchLink;
@@ -1,12 +0,0 @@
1
- import type { AnyRouter } from '@trpc/server';
2
- import type { HTTPBatchLinkOptions } from './HTTPBatchLinkOptions';
3
- import type { TRPCLink } from './types';
4
- /**
5
- * @see https://trpc.io/docs/client/links/httpBatchStreamLink
6
- */
7
- export declare function httpBatchStreamLink<TRouter extends AnyRouter>(opts: HTTPBatchLinkOptions<TRouter['_def']['_config']['$types']>): TRPCLink<TRouter>;
8
- /**
9
- * @deprecated use {@link httpBatchStreamLink} instead
10
- */
11
- export declare const unstable_httpBatchStreamLink: typeof httpBatchStreamLink;
12
- //# sourceMappingURL=httpBatchStreamLink.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"httpBatchStreamLink.d.ts","sourceRoot":"","sources":["../../src/links/httpBatchStreamLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAiB,MAAM,cAAc,CAAC;AAS7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAQnE,OAAO,KAAK,EAAa,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,SAAS,SAAS,EAC3D,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,GAC/D,QAAQ,CAAC,OAAO,CAAC,CAgKnB;AAED;;GAEG;AACH,eAAO,MAAM,4BAA4B,4BAAsB,CAAC"}
@@ -1,150 +0,0 @@
1
- 'use strict';
2
-
3
- var observable = require('@trpc/server/observable');
4
- var unstableCoreDoNotImport = require('@trpc/server/unstable-core-do-not-import');
5
- var dataLoader = require('../internals/dataLoader.js');
6
- var signals = require('../internals/signals.js');
7
- var TRPCClientError = require('../TRPCClientError.js');
8
- var httpUtils = require('./internals/httpUtils.js');
9
-
10
- /**
11
- * @see https://trpc.io/docs/client/links/httpBatchStreamLink
12
- */ function httpBatchStreamLink(opts) {
13
- const resolvedOpts = httpUtils.resolveHTTPLinkOptions(opts);
14
- const maxURLLength = opts.maxURLLength ?? Infinity;
15
- const maxItems = opts.maxItems ?? Infinity;
16
- return ()=>{
17
- const batchLoader = (type)=>{
18
- return {
19
- validate (batchOps) {
20
- if (maxURLLength === Infinity && maxItems === Infinity) {
21
- // escape hatch for quick calcs
22
- return true;
23
- }
24
- if (batchOps.length > maxItems) {
25
- return false;
26
- }
27
- const path = batchOps.map((op)=>op.path).join(',');
28
- const inputs = batchOps.map((op)=>op.input);
29
- const url = httpUtils.getUrl({
30
- ...resolvedOpts,
31
- type,
32
- path,
33
- inputs,
34
- signal: null
35
- });
36
- return url.length <= maxURLLength;
37
- },
38
- async fetch (batchOps) {
39
- const path = batchOps.map((op)=>op.path).join(',');
40
- const inputs = batchOps.map((op)=>op.input);
41
- const batchSignals = signals.allAbortSignals(...batchOps.map((op)=>op.signal));
42
- const abortController = new AbortController();
43
- const responsePromise = httpUtils.fetchHTTPResponse({
44
- ...resolvedOpts,
45
- signal: signals.raceAbortSignals(batchSignals, abortController.signal),
46
- type,
47
- contentTypeHeader: 'application/json',
48
- trpcAcceptHeader: 'application/jsonl',
49
- getUrl: httpUtils.getUrl,
50
- getBody: httpUtils.getBody,
51
- inputs,
52
- path,
53
- headers () {
54
- if (!opts.headers) {
55
- return {};
56
- }
57
- if (typeof opts.headers === 'function') {
58
- return opts.headers({
59
- opList: batchOps
60
- });
61
- }
62
- return opts.headers;
63
- }
64
- });
65
- const res = await responsePromise;
66
- const [head] = await unstableCoreDoNotImport.jsonlStreamConsumer({
67
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
68
- from: res.body,
69
- deserialize: resolvedOpts.transformer.output.deserialize,
70
- // onError: console.error,
71
- formatError (opts) {
72
- const error = opts.error;
73
- return TRPCClientError.TRPCClientError.from({
74
- error
75
- });
76
- },
77
- abortController
78
- });
79
- const promises = Object.keys(batchOps).map(async (key)=>{
80
- let json = await Promise.resolve(head[key]);
81
- if ('result' in json) {
82
- /**
83
- * Not very pretty, but we need to unwrap nested data as promises
84
- * Our stream producer will only resolve top-level async values or async values that are directly nested in another async value
85
- */ const result = await Promise.resolve(json.result);
86
- json = {
87
- result: {
88
- data: await Promise.resolve(result.data)
89
- }
90
- };
91
- }
92
- return {
93
- json,
94
- meta: {
95
- response: res
96
- }
97
- };
98
- });
99
- return promises;
100
- }
101
- };
102
- };
103
- const query = dataLoader.dataLoader(batchLoader('query'));
104
- const mutation = dataLoader.dataLoader(batchLoader('mutation'));
105
- const loaders = {
106
- query,
107
- mutation
108
- };
109
- return ({ op })=>{
110
- return observable.observable((observer)=>{
111
- /* istanbul ignore if -- @preserve */ if (op.type === 'subscription') {
112
- throw new Error('Subscriptions are unsupported by `httpBatchStreamLink` - use `httpSubscriptionLink` or `wsLink`');
113
- }
114
- const loader = loaders[op.type];
115
- const promise = loader.load(op);
116
- let _res = undefined;
117
- promise.then((res)=>{
118
- _res = res;
119
- if ('error' in res.json) {
120
- observer.error(TRPCClientError.TRPCClientError.from(res.json, {
121
- meta: res.meta
122
- }));
123
- return;
124
- } else if ('result' in res.json) {
125
- observer.next({
126
- context: res.meta,
127
- result: res.json.result
128
- });
129
- observer.complete();
130
- return;
131
- }
132
- observer.complete();
133
- }).catch((err)=>{
134
- observer.error(TRPCClientError.TRPCClientError.from(err, {
135
- meta: _res?.meta
136
- }));
137
- });
138
- return ()=>{
139
- // noop
140
- };
141
- });
142
- };
143
- };
144
- }
145
- /**
146
- * @deprecated use {@link httpBatchStreamLink} instead
147
- */ const unstable_httpBatchStreamLink = httpBatchStreamLink;
148
-
149
- exports.httpBatchStreamLink = httpBatchStreamLink;
150
- exports.unstable_httpBatchStreamLink = unstable_httpBatchStreamLink;
@@ -1,147 +0,0 @@
1
- import { observable } from '@trpc/server/observable';
2
- import { jsonlStreamConsumer } from '@trpc/server/unstable-core-do-not-import';
3
- import { dataLoader } from '../internals/dataLoader.mjs';
4
- import { allAbortSignals, raceAbortSignals } from '../internals/signals.mjs';
5
- import { TRPCClientError } from '../TRPCClientError.mjs';
6
- import { resolveHTTPLinkOptions, fetchHTTPResponse, getBody, getUrl } from './internals/httpUtils.mjs';
7
-
8
- /**
9
- * @see https://trpc.io/docs/client/links/httpBatchStreamLink
10
- */ function httpBatchStreamLink(opts) {
11
- const resolvedOpts = resolveHTTPLinkOptions(opts);
12
- const maxURLLength = opts.maxURLLength ?? Infinity;
13
- const maxItems = opts.maxItems ?? Infinity;
14
- return ()=>{
15
- const batchLoader = (type)=>{
16
- return {
17
- validate (batchOps) {
18
- if (maxURLLength === Infinity && maxItems === Infinity) {
19
- // escape hatch for quick calcs
20
- return true;
21
- }
22
- if (batchOps.length > maxItems) {
23
- return false;
24
- }
25
- const path = batchOps.map((op)=>op.path).join(',');
26
- const inputs = batchOps.map((op)=>op.input);
27
- const url = getUrl({
28
- ...resolvedOpts,
29
- type,
30
- path,
31
- inputs,
32
- signal: null
33
- });
34
- return url.length <= maxURLLength;
35
- },
36
- async fetch (batchOps) {
37
- const path = batchOps.map((op)=>op.path).join(',');
38
- const inputs = batchOps.map((op)=>op.input);
39
- const batchSignals = allAbortSignals(...batchOps.map((op)=>op.signal));
40
- const abortController = new AbortController();
41
- const responsePromise = fetchHTTPResponse({
42
- ...resolvedOpts,
43
- signal: raceAbortSignals(batchSignals, abortController.signal),
44
- type,
45
- contentTypeHeader: 'application/json',
46
- trpcAcceptHeader: 'application/jsonl',
47
- getUrl,
48
- getBody,
49
- inputs,
50
- path,
51
- headers () {
52
- if (!opts.headers) {
53
- return {};
54
- }
55
- if (typeof opts.headers === 'function') {
56
- return opts.headers({
57
- opList: batchOps
58
- });
59
- }
60
- return opts.headers;
61
- }
62
- });
63
- const res = await responsePromise;
64
- const [head] = await jsonlStreamConsumer({
65
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
66
- from: res.body,
67
- deserialize: resolvedOpts.transformer.output.deserialize,
68
- // onError: console.error,
69
- formatError (opts) {
70
- const error = opts.error;
71
- return TRPCClientError.from({
72
- error
73
- });
74
- },
75
- abortController
76
- });
77
- const promises = Object.keys(batchOps).map(async (key)=>{
78
- let json = await Promise.resolve(head[key]);
79
- if ('result' in json) {
80
- /**
81
- * Not very pretty, but we need to unwrap nested data as promises
82
- * Our stream producer will only resolve top-level async values or async values that are directly nested in another async value
83
- */ const result = await Promise.resolve(json.result);
84
- json = {
85
- result: {
86
- data: await Promise.resolve(result.data)
87
- }
88
- };
89
- }
90
- return {
91
- json,
92
- meta: {
93
- response: res
94
- }
95
- };
96
- });
97
- return promises;
98
- }
99
- };
100
- };
101
- const query = dataLoader(batchLoader('query'));
102
- const mutation = dataLoader(batchLoader('mutation'));
103
- const loaders = {
104
- query,
105
- mutation
106
- };
107
- return ({ op })=>{
108
- return observable((observer)=>{
109
- /* istanbul ignore if -- @preserve */ if (op.type === 'subscription') {
110
- throw new Error('Subscriptions are unsupported by `httpBatchStreamLink` - use `httpSubscriptionLink` or `wsLink`');
111
- }
112
- const loader = loaders[op.type];
113
- const promise = loader.load(op);
114
- let _res = undefined;
115
- promise.then((res)=>{
116
- _res = res;
117
- if ('error' in res.json) {
118
- observer.error(TRPCClientError.from(res.json, {
119
- meta: res.meta
120
- }));
121
- return;
122
- } else if ('result' in res.json) {
123
- observer.next({
124
- context: res.meta,
125
- result: res.json.result
126
- });
127
- observer.complete();
128
- return;
129
- }
130
- observer.complete();
131
- }).catch((err)=>{
132
- observer.error(TRPCClientError.from(err, {
133
- meta: _res?.meta
134
- }));
135
- });
136
- return ()=>{
137
- // noop
138
- };
139
- });
140
- };
141
- };
142
- }
143
- /**
144
- * @deprecated use {@link httpBatchStreamLink} instead
145
- */ const unstable_httpBatchStreamLink = httpBatchStreamLink;
146
-
147
- export { httpBatchStreamLink, unstable_httpBatchStreamLink };
@@ -1,17 +0,0 @@
1
- import type { AnyClientTypes, AnyRouter } from '@trpc/server/unstable-core-do-not-import';
2
- import type { HTTPLinkBaseOptions } from './internals/httpUtils';
3
- import { type HTTPHeaders, type Operation, type TRPCLink } from './types';
4
- export type HTTPLinkOptions<TRoot extends AnyClientTypes> = HTTPLinkBaseOptions<TRoot> & {
5
- /**
6
- * Headers to be set on outgoing requests or a callback that of said headers
7
- * @see http://trpc.io/docs/client/headers
8
- */
9
- headers?: HTTPHeaders | ((opts: {
10
- op: Operation;
11
- }) => HTTPHeaders | Promise<HTTPHeaders>);
12
- };
13
- /**
14
- * @see https://trpc.io/docs/client/links/httpLink
15
- */
16
- export declare function httpLink<TRouter extends AnyRouter = AnyRouter>(opts: HTTPLinkOptions<TRouter['_def']['_config']['$types']>): TRPCLink<TRouter>;
17
- //# sourceMappingURL=httpLink.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"httpLink.d.ts","sourceRoot":"","sources":["../../src/links/httpLink.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACV,MAAM,0CAA0C,CAAC;AAGlD,OAAO,KAAK,EACV,mBAAmB,EAGpB,MAAM,uBAAuB,CAAC;AAO/B,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,QAAQ,EACd,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,eAAe,CAAC,KAAK,SAAS,cAAc,IACtD,mBAAmB,CAAC,KAAK,CAAC,GAAG;IAC3B;;;OAGG;IACH,OAAO,CAAC,EACJ,WAAW,GACX,CAAC,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,SAAS,CAAA;KAAE,KAAK,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;CACvE,CAAC;AAoCJ;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,SAAS,SAAS,GAAG,SAAS,EAC5D,IAAI,EAAE,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,GAC1D,QAAQ,CAAC,OAAO,CAAC,CAgEnB"}
@@ -1,95 +0,0 @@
1
- 'use strict';
2
-
3
- var observable = require('@trpc/server/observable');
4
- var unstableCoreDoNotImport = require('@trpc/server/unstable-core-do-not-import');
5
- var TRPCClientError = require('../TRPCClientError.js');
6
- var httpUtils = require('./internals/httpUtils.js');
7
- var contentTypes = require('./internals/contentTypes.js');
8
-
9
- const universalRequester = (opts)=>{
10
- if ('input' in opts) {
11
- const { input } = opts;
12
- if (contentTypes.isFormData(input)) {
13
- if (opts.type !== 'mutation' && opts.methodOverride !== 'POST') {
14
- throw new Error('FormData is only supported for mutations');
15
- }
16
- return httpUtils.httpRequest({
17
- ...opts,
18
- // The browser will set this automatically and include the boundary= in it
19
- contentTypeHeader: undefined,
20
- getUrl: httpUtils.getUrl,
21
- getBody: ()=>input
22
- });
23
- }
24
- if (contentTypes.isOctetType(input)) {
25
- if (opts.type !== 'mutation' && opts.methodOverride !== 'POST') {
26
- throw new Error('Octet type input is only supported for mutations');
27
- }
28
- return httpUtils.httpRequest({
29
- ...opts,
30
- contentTypeHeader: 'application/octet-stream',
31
- getUrl: httpUtils.getUrl,
32
- getBody: ()=>input
33
- });
34
- }
35
- }
36
- return httpUtils.jsonHttpRequester(opts);
37
- };
38
- /**
39
- * @see https://trpc.io/docs/client/links/httpLink
40
- */ function httpLink(opts) {
41
- const resolvedOpts = httpUtils.resolveHTTPLinkOptions(opts);
42
- return ()=>{
43
- return ({ op })=>{
44
- return observable.observable((observer)=>{
45
- const { path, input, type } = op;
46
- /* istanbul ignore if -- @preserve */ if (type === 'subscription') {
47
- throw new Error('Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`');
48
- }
49
- const request = universalRequester({
50
- ...resolvedOpts,
51
- type,
52
- path,
53
- input,
54
- signal: op.signal,
55
- headers () {
56
- if (!opts.headers) {
57
- return {};
58
- }
59
- if (typeof opts.headers === 'function') {
60
- return opts.headers({
61
- op
62
- });
63
- }
64
- return opts.headers;
65
- }
66
- });
67
- let meta = undefined;
68
- request.then((res)=>{
69
- meta = res.meta;
70
- const transformed = unstableCoreDoNotImport.transformResult(res.json, resolvedOpts.transformer.output);
71
- if (!transformed.ok) {
72
- observer.error(TRPCClientError.TRPCClientError.from(transformed.error, {
73
- meta
74
- }));
75
- return;
76
- }
77
- observer.next({
78
- context: res.meta,
79
- result: transformed.result
80
- });
81
- observer.complete();
82
- }).catch((cause)=>{
83
- observer.error(TRPCClientError.TRPCClientError.from(cause, {
84
- meta
85
- }));
86
- });
87
- return ()=>{
88
- // noop
89
- };
90
- });
91
- };
92
- };
93
- }
94
-
95
- exports.httpLink = httpLink;