@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,141 +0,0 @@
1
- 'use strict';
2
-
3
- var getFetch = require('../../getFetch.js');
4
- var transformer = require('../../internals/transformer.js');
5
-
6
- function resolveHTTPLinkOptions(opts) {
7
- return {
8
- url: opts.url.toString(),
9
- fetch: opts.fetch,
10
- transformer: transformer.getTransformer(opts.transformer),
11
- methodOverride: opts.methodOverride
12
- };
13
- }
14
- // https://github.com/trpc/trpc/pull/669
15
- function arrayToDict(array) {
16
- const dict = {};
17
- for(let index = 0; index < array.length; index++){
18
- const element = array[index];
19
- dict[index] = element;
20
- }
21
- return dict;
22
- }
23
- const METHOD = {
24
- query: 'GET',
25
- mutation: 'POST',
26
- subscription: 'PATCH'
27
- };
28
- function getInput(opts) {
29
- return 'input' in opts ? opts.transformer.input.serialize(opts.input) : arrayToDict(opts.inputs.map((_input)=>opts.transformer.input.serialize(_input)));
30
- }
31
- const getUrl = (opts)=>{
32
- const parts = opts.url.split('?');
33
- const base = parts[0].replace(/\/$/, ''); // Remove any trailing slashes
34
- let url = base + '/' + opts.path;
35
- const queryParts = [];
36
- if (parts[1]) {
37
- queryParts.push(parts[1]);
38
- }
39
- if ('inputs' in opts) {
40
- queryParts.push('batch=1');
41
- }
42
- if (opts.type === 'query' || opts.type === 'subscription') {
43
- const input = getInput(opts);
44
- if (input !== undefined && opts.methodOverride !== 'POST') {
45
- queryParts.push(`input=${encodeURIComponent(JSON.stringify(input))}`);
46
- }
47
- }
48
- if (queryParts.length) {
49
- url += '?' + queryParts.join('&');
50
- }
51
- return url;
52
- };
53
- const getBody = (opts)=>{
54
- if (opts.type === 'query' && opts.methodOverride !== 'POST') {
55
- return undefined;
56
- }
57
- const input = getInput(opts);
58
- return input !== undefined ? JSON.stringify(input) : undefined;
59
- };
60
- const jsonHttpRequester = (opts)=>{
61
- return httpRequest({
62
- ...opts,
63
- contentTypeHeader: 'application/json',
64
- getUrl,
65
- getBody
66
- });
67
- };
68
- /**
69
- * Polyfill for DOMException with AbortError name
70
- */ class AbortError extends Error {
71
- constructor(){
72
- const name = 'AbortError';
73
- super(name);
74
- this.name = name;
75
- this.message = name;
76
- }
77
- }
78
- /**
79
- * Polyfill for `signal.throwIfAborted()`
80
- *
81
- * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/throwIfAborted
82
- */ const throwIfAborted = (signal)=>{
83
- if (!signal?.aborted) {
84
- return;
85
- }
86
- // If available, use the native implementation
87
- signal.throwIfAborted?.();
88
- // If we have `DOMException`, use it
89
- if (typeof DOMException !== 'undefined') {
90
- throw new DOMException('AbortError', 'AbortError');
91
- }
92
- // Otherwise, use our own implementation
93
- throw new AbortError();
94
- };
95
- async function fetchHTTPResponse(opts) {
96
- throwIfAborted(opts.signal);
97
- const url = opts.getUrl(opts);
98
- const body = opts.getBody(opts);
99
- const { type } = opts;
100
- const resolvedHeaders = await (async ()=>{
101
- const heads = await opts.headers();
102
- if (Symbol.iterator in heads) {
103
- return Object.fromEntries(heads);
104
- }
105
- return heads;
106
- })();
107
- const headers = {
108
- ...opts.contentTypeHeader ? {
109
- 'content-type': opts.contentTypeHeader
110
- } : {},
111
- ...opts.trpcAcceptHeader ? {
112
- 'trpc-accept': opts.trpcAcceptHeader
113
- } : undefined,
114
- ...resolvedHeaders
115
- };
116
- return getFetch.getFetch(opts.fetch)(url, {
117
- method: opts.methodOverride ?? METHOD[type],
118
- signal: opts.signal,
119
- body,
120
- headers
121
- });
122
- }
123
- async function httpRequest(opts) {
124
- const meta = {};
125
- const res = await fetchHTTPResponse(opts);
126
- meta.response = res;
127
- const json = await res.json();
128
- meta.responseJSON = json;
129
- return {
130
- json: json,
131
- meta
132
- };
133
- }
134
-
135
- exports.fetchHTTPResponse = fetchHTTPResponse;
136
- exports.getBody = getBody;
137
- exports.getInput = getInput;
138
- exports.getUrl = getUrl;
139
- exports.httpRequest = httpRequest;
140
- exports.jsonHttpRequester = jsonHttpRequester;
141
- exports.resolveHTTPLinkOptions = resolveHTTPLinkOptions;
@@ -1,133 +0,0 @@
1
- import { getFetch } from '../../getFetch.mjs';
2
- import { getTransformer } from '../../internals/transformer.mjs';
3
-
4
- function resolveHTTPLinkOptions(opts) {
5
- return {
6
- url: opts.url.toString(),
7
- fetch: opts.fetch,
8
- transformer: getTransformer(opts.transformer),
9
- methodOverride: opts.methodOverride
10
- };
11
- }
12
- // https://github.com/trpc/trpc/pull/669
13
- function arrayToDict(array) {
14
- const dict = {};
15
- for(let index = 0; index < array.length; index++){
16
- const element = array[index];
17
- dict[index] = element;
18
- }
19
- return dict;
20
- }
21
- const METHOD = {
22
- query: 'GET',
23
- mutation: 'POST',
24
- subscription: 'PATCH'
25
- };
26
- function getInput(opts) {
27
- return 'input' in opts ? opts.transformer.input.serialize(opts.input) : arrayToDict(opts.inputs.map((_input)=>opts.transformer.input.serialize(_input)));
28
- }
29
- const getUrl = (opts)=>{
30
- const parts = opts.url.split('?');
31
- const base = parts[0].replace(/\/$/, ''); // Remove any trailing slashes
32
- let url = base + '/' + opts.path;
33
- const queryParts = [];
34
- if (parts[1]) {
35
- queryParts.push(parts[1]);
36
- }
37
- if ('inputs' in opts) {
38
- queryParts.push('batch=1');
39
- }
40
- if (opts.type === 'query' || opts.type === 'subscription') {
41
- const input = getInput(opts);
42
- if (input !== undefined && opts.methodOverride !== 'POST') {
43
- queryParts.push(`input=${encodeURIComponent(JSON.stringify(input))}`);
44
- }
45
- }
46
- if (queryParts.length) {
47
- url += '?' + queryParts.join('&');
48
- }
49
- return url;
50
- };
51
- const getBody = (opts)=>{
52
- if (opts.type === 'query' && opts.methodOverride !== 'POST') {
53
- return undefined;
54
- }
55
- const input = getInput(opts);
56
- return input !== undefined ? JSON.stringify(input) : undefined;
57
- };
58
- const jsonHttpRequester = (opts)=>{
59
- return httpRequest({
60
- ...opts,
61
- contentTypeHeader: 'application/json',
62
- getUrl,
63
- getBody
64
- });
65
- };
66
- /**
67
- * Polyfill for DOMException with AbortError name
68
- */ class AbortError extends Error {
69
- constructor(){
70
- const name = 'AbortError';
71
- super(name);
72
- this.name = name;
73
- this.message = name;
74
- }
75
- }
76
- /**
77
- * Polyfill for `signal.throwIfAborted()`
78
- *
79
- * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/throwIfAborted
80
- */ const throwIfAborted = (signal)=>{
81
- if (!signal?.aborted) {
82
- return;
83
- }
84
- // If available, use the native implementation
85
- signal.throwIfAborted?.();
86
- // If we have `DOMException`, use it
87
- if (typeof DOMException !== 'undefined') {
88
- throw new DOMException('AbortError', 'AbortError');
89
- }
90
- // Otherwise, use our own implementation
91
- throw new AbortError();
92
- };
93
- async function fetchHTTPResponse(opts) {
94
- throwIfAborted(opts.signal);
95
- const url = opts.getUrl(opts);
96
- const body = opts.getBody(opts);
97
- const { type } = opts;
98
- const resolvedHeaders = await (async ()=>{
99
- const heads = await opts.headers();
100
- if (Symbol.iterator in heads) {
101
- return Object.fromEntries(heads);
102
- }
103
- return heads;
104
- })();
105
- const headers = {
106
- ...opts.contentTypeHeader ? {
107
- 'content-type': opts.contentTypeHeader
108
- } : {},
109
- ...opts.trpcAcceptHeader ? {
110
- 'trpc-accept': opts.trpcAcceptHeader
111
- } : undefined,
112
- ...resolvedHeaders
113
- };
114
- return getFetch(opts.fetch)(url, {
115
- method: opts.methodOverride ?? METHOD[type],
116
- signal: opts.signal,
117
- body,
118
- headers
119
- });
120
- }
121
- async function httpRequest(opts) {
122
- const meta = {};
123
- const res = await fetchHTTPResponse(opts);
124
- meta.response = res;
125
- const json = await res.json();
126
- meta.responseJSON = json;
127
- return {
128
- json: json,
129
- meta
130
- };
131
- }
132
-
133
- export { fetchHTTPResponse, getBody, getInput, getUrl, httpRequest, jsonHttpRequester, resolveHTTPLinkOptions };
@@ -1,17 +0,0 @@
1
- interface ConnectionStateBase<TError> {
2
- type: 'state';
3
- data?: never;
4
- error: TError | null;
5
- }
6
- interface ConnectionIdleState extends ConnectionStateBase<null> {
7
- state: 'idle';
8
- }
9
- interface ConnectionConnectingState<TError> extends ConnectionStateBase<TError | null> {
10
- state: 'connecting';
11
- }
12
- interface ConnectionPendingState extends ConnectionStateBase<null> {
13
- state: 'pending';
14
- }
15
- export type TRPCConnectionState<TError> = ConnectionIdleState | ConnectionConnectingState<TError> | ConnectionPendingState;
16
- export {};
17
- //# sourceMappingURL=subscriptions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../../src/links/internals/subscriptions.ts"],"names":[],"mappings":"AAAA,UAAU,mBAAmB,CAAC,MAAM;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,UAAU,mBAAoB,SAAQ,mBAAmB,CAAC,IAAI,CAAC;IAC7D,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,yBAAyB,CAAC,MAAM,CACxC,SAAQ,mBAAmB,CAAC,MAAM,GAAG,IAAI,CAAC;IAC1C,KAAK,EAAE,YAAY,CAAC;CACrB;AAED,UAAU,sBAAuB,SAAQ,mBAAmB,CAAC,IAAI,CAAC;IAChE,KAAK,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,MAAM,mBAAmB,CAAC,MAAM,IAClC,mBAAmB,GACnB,yBAAyB,CAAC,MAAM,CAAC,GACjC,sBAAsB,CAAC"}
@@ -1,23 +0,0 @@
1
- import { type TRPCRequestInfo } from '@trpc/server/http';
2
- /**
3
- * Get the result of a value or function that returns a value
4
- * It also optionally accepts typesafe arguments for the function
5
- */
6
- export declare const resultOf: <T, TArgs extends any[]>(value: T | ((...args: TArgs) => T), ...args: TArgs) => T;
7
- /**
8
- * A value that can be wrapped in callback
9
- */
10
- export type CallbackOrValue<T> = T | (() => T | Promise<T>);
11
- export interface UrlOptionsWithConnectionParams {
12
- /**
13
- * The URL to connect to (can be a function that returns a URL)
14
- */
15
- url: CallbackOrValue<string>;
16
- /**
17
- * Connection params that are available in `createContext()`
18
- * - For `wsLink`/`wsClient`, these are sent as the first message
19
- * - For `httpSubscriptionLink`, these are serialized as part of the URL under the `connectionParams` query
20
- */
21
- connectionParams?: CallbackOrValue<TRPCRequestInfo['connectionParams']>;
22
- }
23
- //# sourceMappingURL=urlWithConnectionParams.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"urlWithConnectionParams.d.ts","sourceRoot":"","sources":["../../../src/links/internals/urlWithConnectionParams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,KAAK,SAAS,GAAG,EAAE,EAC7C,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,CAAC,CAAC,EAClC,GAAG,MAAM,KAAK,KACb,CAIF,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAE5D,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,GAAG,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAE7B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,eAAe,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC,CAAC;CACzE"}
@@ -1,10 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * Get the result of a value or function that returns a value
5
- * It also optionally accepts typesafe arguments for the function
6
- */ const resultOf = (value, ...args)=>{
7
- return typeof value === 'function' ? value(...args) : value;
8
- };
9
-
10
- exports.resultOf = resultOf;
@@ -1,8 +0,0 @@
1
- /**
2
- * Get the result of a value or function that returns a value
3
- * It also optionally accepts typesafe arguments for the function
4
- */ const resultOf = (value, ...args)=>{
5
- return typeof value === 'function' ? value(...args) : value;
6
- };
7
-
8
- export { resultOf };
@@ -1,15 +0,0 @@
1
- import { type AnyRouter, type ErrorHandlerOptions, type inferClientTypes, type inferRouterContext } from '@trpc/server/unstable-core-do-not-import';
2
- import type { TransformerOptions } from '../internals/transformer';
3
- import type { TRPCLink } from './types';
4
- export type LocalLinkOptions<TRouter extends AnyRouter> = {
5
- router: TRouter;
6
- createContext: () => Promise<inferRouterContext<TRouter>>;
7
- onError?: (opts: ErrorHandlerOptions<inferRouterContext<TRouter>>) => void;
8
- } & TransformerOptions<inferClientTypes<TRouter>>;
9
- /**
10
- * localLink is a terminating link that allows you to make tRPC procedure calls directly in your application without going through HTTP.
11
- *
12
- * @see https://trpc.io/docs/links/localLink
13
- */
14
- export declare function experimental_localLink<TRouter extends AnyRouter>(opts: LocalLinkOptions<TRouter>): TRPCLink<TRouter>;
15
- //# sourceMappingURL=localLink.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"localLink.d.ts","sourceRoot":"","sources":["../../src/links/localLink.ts"],"names":[],"mappings":"AAOA,OAAO,EAQL,KAAK,SAAS,EACd,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,0CAA0C,CAAC;AAIlD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAGnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,MAAM,gBAAgB,CAAC,OAAO,SAAS,SAAS,IAAI;IACxD,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC;CAC5E,GAAG,kBAAkB,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;AAElD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,SAAS,SAAS,EAC9D,IAAI,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAC9B,QAAQ,CAAC,OAAO,CAAC,CA2OnB"}