@trpc/client 11.0.0-next-beta.242 → 11.0.0-next-beta.285
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.
- package/dist/bundle-analysis.json +65 -50
- package/dist/createTRPCClient.d.ts +4 -4
- package/dist/createTRPCClient.d.ts.map +1 -1
- package/dist/internals/TRPCUntypedClient.d.ts +3 -20
- package/dist/internals/TRPCUntypedClient.d.ts.map +1 -1
- package/dist/internals/TRPCUntypedClient.js +1 -29
- package/dist/internals/TRPCUntypedClient.mjs +1 -29
- package/dist/links/HTTPBatchLinkOptions.d.ts +3 -2
- package/dist/links/HTTPBatchLinkOptions.d.ts.map +1 -1
- package/dist/links/httpBatchLink.d.ts +1 -1
- package/dist/links/httpBatchLink.d.ts.map +1 -1
- package/dist/links/httpBatchStreamLink.d.ts +4 -3
- package/dist/links/httpBatchStreamLink.d.ts.map +1 -1
- package/dist/links/httpFormDataLink.d.ts +1 -1
- package/dist/links/httpFormDataLink.d.ts.map +1 -1
- package/dist/links/httpLink.d.ts +5 -5
- package/dist/links/httpLink.d.ts.map +1 -1
- package/dist/links/httpLink.js +2 -3
- package/dist/links/httpLink.mjs +2 -3
- package/dist/links/internals/createHTTPBatchLink.d.ts +3 -3
- package/dist/links/internals/createHTTPBatchLink.d.ts.map +1 -1
- package/dist/links/internals/createHTTPBatchLink.js +1 -2
- package/dist/links/internals/createHTTPBatchLink.mjs +1 -2
- package/dist/links/internals/httpUtils.d.ts +8 -6
- package/dist/links/internals/httpUtils.d.ts.map +1 -1
- package/dist/links/internals/httpUtils.js +4 -2
- package/dist/links/internals/httpUtils.mjs +4 -2
- package/dist/links/types.d.ts +7 -9
- package/dist/links/types.d.ts.map +1 -1
- package/dist/links/wsLink.d.ts +5 -4
- package/dist/links/wsLink.d.ts.map +1 -1
- package/dist/links/wsLink.js +5 -3
- package/dist/links/wsLink.mjs +5 -3
- package/dist/unstable-internals.d.ts +33 -0
- package/dist/unstable-internals.d.ts.map +1 -0
- package/dist/unstable-internals.js +28 -0
- package/dist/unstable-internals.mjs +26 -0
- package/package.json +10 -4
- package/src/createTRPCClient.ts +11 -9
- package/src/internals/TRPCUntypedClient.ts +6 -61
- package/src/links/HTTPBatchLinkOptions.ts +14 -12
- package/src/links/httpBatchLink.ts +4 -1
- package/src/links/httpBatchStreamLink.ts +11 -9
- package/src/links/httpLink.ts +17 -14
- package/src/links/internals/createHTTPBatchLink.ts +7 -6
- package/src/links/internals/httpUtils.ts +15 -11
- package/src/links/types.ts +13 -15
- package/src/links/wsLink.ts +10 -6
- package/src/unstable-internals.ts +67 -0
- package/unstable-internals/index.d.ts +1 -0
- package/unstable-internals/index.js +1 -0
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction":
|
|
2
|
+
"bundleSize": 46558,
|
|
3
|
+
"bundleOrigSize": 65175,
|
|
4
|
+
"bundleReduction": 28.56,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/links/wsLink.ts",
|
|
8
|
-
"size":
|
|
9
|
-
"origSize":
|
|
8
|
+
"size": 12058,
|
|
9
|
+
"origSize": 13648,
|
|
10
10
|
"renderedExports": [
|
|
11
11
|
"createWSClient",
|
|
12
12
|
"wsLink"
|
|
13
13
|
],
|
|
14
14
|
"removedExports": [],
|
|
15
15
|
"dependents": [],
|
|
16
|
-
"percent": 25.
|
|
17
|
-
"reduction":
|
|
16
|
+
"percent": 25.9,
|
|
17
|
+
"reduction": 11.65
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
"id": "/src/links/loggerLink.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
],
|
|
26
26
|
"removedExports": [],
|
|
27
27
|
"dependents": [],
|
|
28
|
-
"percent": 11.
|
|
28
|
+
"percent": 11.91,
|
|
29
29
|
"reduction": 14.64
|
|
30
30
|
},
|
|
31
31
|
{
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dependents": [
|
|
40
40
|
"/src/links/internals/createHTTPBatchLink.ts"
|
|
41
41
|
],
|
|
42
|
-
"percent": 9.
|
|
42
|
+
"percent": 9.47,
|
|
43
43
|
"reduction": 7.49
|
|
44
44
|
},
|
|
45
45
|
{
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
"dependents": [
|
|
55
55
|
"/src/links/httpBatchStreamLink.ts"
|
|
56
56
|
],
|
|
57
|
-
"percent": 8.
|
|
57
|
+
"percent": 8.61,
|
|
58
58
|
"reduction": 19.75
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
"id": "/src/links/internals/httpUtils.ts",
|
|
62
|
-
"size":
|
|
63
|
-
"origSize":
|
|
62
|
+
"size": 3340,
|
|
63
|
+
"origSize": 5631,
|
|
64
64
|
"renderedExports": [
|
|
65
65
|
"resolveHTTPLinkOptions",
|
|
66
66
|
"getUrl",
|
|
@@ -77,43 +77,43 @@
|
|
|
77
77
|
"/src/links/internals/createHTTPBatchLink.ts",
|
|
78
78
|
"/src/links/internals/parseJSONStream.ts"
|
|
79
79
|
],
|
|
80
|
-
"percent":
|
|
81
|
-
"reduction":
|
|
80
|
+
"percent": 7.17,
|
|
81
|
+
"reduction": 40.69
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
|
-
"id": "/src/internals/
|
|
85
|
-
"size":
|
|
86
|
-
"origSize":
|
|
84
|
+
"id": "/src/links/internals/createHTTPBatchLink.ts",
|
|
85
|
+
"size": 2944,
|
|
86
|
+
"origSize": 3707,
|
|
87
87
|
"renderedExports": [
|
|
88
|
-
"
|
|
88
|
+
"createHTTPBatchLink"
|
|
89
89
|
],
|
|
90
90
|
"removedExports": [],
|
|
91
91
|
"dependents": [
|
|
92
|
-
"/src/
|
|
93
|
-
"/src/
|
|
92
|
+
"/src/links/httpBatchLink.ts",
|
|
93
|
+
"/src/links/httpBatchStreamLink.ts"
|
|
94
94
|
],
|
|
95
|
-
"percent": 6.
|
|
96
|
-
"reduction":
|
|
95
|
+
"percent": 6.32,
|
|
96
|
+
"reduction": 20.58
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
|
-
"id": "/src/
|
|
100
|
-
"size":
|
|
101
|
-
"origSize":
|
|
99
|
+
"id": "/src/internals/TRPCUntypedClient.ts",
|
|
100
|
+
"size": 2299,
|
|
101
|
+
"origSize": 4193,
|
|
102
102
|
"renderedExports": [
|
|
103
|
-
"
|
|
103
|
+
"TRPCUntypedClient"
|
|
104
104
|
],
|
|
105
105
|
"removedExports": [],
|
|
106
106
|
"dependents": [
|
|
107
|
-
"/src/
|
|
108
|
-
"/src/
|
|
107
|
+
"/src/createTRPCUntypedClient.ts",
|
|
108
|
+
"/src/createTRPCClient.ts"
|
|
109
109
|
],
|
|
110
|
-
"percent":
|
|
111
|
-
"reduction":
|
|
110
|
+
"percent": 4.94,
|
|
111
|
+
"reduction": 45.17
|
|
112
112
|
},
|
|
113
113
|
{
|
|
114
114
|
"id": "/src/links/httpLink.ts",
|
|
115
|
-
"size":
|
|
116
|
-
"origSize":
|
|
115
|
+
"size": 2169,
|
|
116
|
+
"origSize": 2753,
|
|
117
117
|
"renderedExports": [
|
|
118
118
|
"httpLinkFactory",
|
|
119
119
|
"httpLink"
|
|
@@ -122,8 +122,8 @@
|
|
|
122
122
|
"dependents": [
|
|
123
123
|
"/src/links/httpFormDataLink.ts"
|
|
124
124
|
],
|
|
125
|
-
"percent": 4.
|
|
126
|
-
"reduction":
|
|
125
|
+
"percent": 4.66,
|
|
126
|
+
"reduction": 21.21
|
|
127
127
|
},
|
|
128
128
|
{
|
|
129
129
|
"id": "/src/TRPCClientError.ts",
|
|
@@ -141,25 +141,25 @@
|
|
|
141
141
|
"/src/links/internals/createHTTPBatchLink.ts",
|
|
142
142
|
"/src/links/internals/httpUtils.ts"
|
|
143
143
|
],
|
|
144
|
-
"percent":
|
|
144
|
+
"percent": 4.01,
|
|
145
145
|
"reduction": 43.37
|
|
146
146
|
},
|
|
147
147
|
{
|
|
148
148
|
"id": "/src/links/httpBatchStreamLink.ts",
|
|
149
149
|
"size": 1340,
|
|
150
|
-
"origSize":
|
|
150
|
+
"origSize": 2176,
|
|
151
151
|
"renderedExports": [
|
|
152
152
|
"unstable_httpBatchStreamLink"
|
|
153
153
|
],
|
|
154
154
|
"removedExports": [],
|
|
155
155
|
"dependents": [],
|
|
156
|
-
"percent": 2.
|
|
157
|
-
"reduction":
|
|
156
|
+
"percent": 2.88,
|
|
157
|
+
"reduction": 38.42
|
|
158
158
|
},
|
|
159
159
|
{
|
|
160
160
|
"id": "/src/createTRPCClient.ts",
|
|
161
161
|
"size": 1206,
|
|
162
|
-
"origSize":
|
|
162
|
+
"origSize": 4350,
|
|
163
163
|
"renderedExports": [
|
|
164
164
|
"clientCallTypeToProcedureType",
|
|
165
165
|
"createTRPCClientProxy",
|
|
@@ -170,20 +170,20 @@
|
|
|
170
170
|
"dependents": [
|
|
171
171
|
"/src/index.ts"
|
|
172
172
|
],
|
|
173
|
-
"percent": 2.
|
|
174
|
-
"reduction": 72.
|
|
173
|
+
"percent": 2.59,
|
|
174
|
+
"reduction": 72.28
|
|
175
175
|
},
|
|
176
176
|
{
|
|
177
177
|
"id": "/src/links/httpBatchLink.ts",
|
|
178
178
|
"size": 1205,
|
|
179
|
-
"origSize":
|
|
179
|
+
"origSize": 1527,
|
|
180
180
|
"renderedExports": [
|
|
181
181
|
"httpBatchLink"
|
|
182
182
|
],
|
|
183
183
|
"removedExports": [],
|
|
184
184
|
"dependents": [],
|
|
185
|
-
"percent": 2.
|
|
186
|
-
"reduction":
|
|
185
|
+
"percent": 2.59,
|
|
186
|
+
"reduction": 21.09
|
|
187
187
|
},
|
|
188
188
|
{
|
|
189
189
|
"id": "/src/links/httpFormDataLink.ts",
|
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
],
|
|
195
195
|
"removedExports": [],
|
|
196
196
|
"dependents": [],
|
|
197
|
-
"percent": 1.
|
|
197
|
+
"percent": 1.51,
|
|
198
198
|
"reduction": 8.94
|
|
199
199
|
},
|
|
200
200
|
{
|
|
@@ -209,7 +209,7 @@
|
|
|
209
209
|
"/src/links/splitLink.ts",
|
|
210
210
|
"/src/internals/TRPCUntypedClient.ts"
|
|
211
211
|
],
|
|
212
|
-
"percent": 1.
|
|
212
|
+
"percent": 1.48,
|
|
213
213
|
"reduction": 32.75
|
|
214
214
|
},
|
|
215
215
|
{
|
|
@@ -221,7 +221,7 @@
|
|
|
221
221
|
],
|
|
222
222
|
"removedExports": [],
|
|
223
223
|
"dependents": [],
|
|
224
|
-
"percent": 1.
|
|
224
|
+
"percent": 1.31,
|
|
225
225
|
"reduction": 44.95
|
|
226
226
|
},
|
|
227
227
|
{
|
|
@@ -235,9 +235,24 @@
|
|
|
235
235
|
"dependents": [
|
|
236
236
|
"/src/links/httpBatchStreamLink.ts"
|
|
237
237
|
],
|
|
238
|
-
"percent": 1.
|
|
238
|
+
"percent": 1.19,
|
|
239
239
|
"reduction": 12.78
|
|
240
240
|
},
|
|
241
|
+
{
|
|
242
|
+
"id": "/src/unstable-internals.ts",
|
|
243
|
+
"size": 544,
|
|
244
|
+
"origSize": 1632,
|
|
245
|
+
"renderedExports": [
|
|
246
|
+
"getTransformer"
|
|
247
|
+
],
|
|
248
|
+
"removedExports": [],
|
|
249
|
+
"dependents": [
|
|
250
|
+
"/src/links/wsLink.ts",
|
|
251
|
+
"/src/links/internals/httpUtils.ts"
|
|
252
|
+
],
|
|
253
|
+
"percent": 1.17,
|
|
254
|
+
"reduction": 66.67
|
|
255
|
+
},
|
|
241
256
|
{
|
|
242
257
|
"id": "/src/internals/getAbortController.ts",
|
|
243
258
|
"size": 542,
|
|
@@ -264,7 +279,7 @@
|
|
|
264
279
|
"/src/index.ts",
|
|
265
280
|
"/src/links/internals/httpUtils.ts"
|
|
266
281
|
],
|
|
267
|
-
"percent": 0.
|
|
282
|
+
"percent": 0.92,
|
|
268
283
|
"reduction": 33.54
|
|
269
284
|
},
|
|
270
285
|
{
|
|
@@ -292,5 +307,5 @@
|
|
|
292
307
|
"reduction": 100
|
|
293
308
|
}
|
|
294
309
|
],
|
|
295
|
-
"moduleCount":
|
|
310
|
+
"moduleCount": 21
|
|
296
311
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Unsubscribable } from '@trpc/server/observable';
|
|
2
|
-
import type { AnyMutationProcedure, AnyProcedure, AnyQueryProcedure, AnyRootTypes, AnyRouter, AnySubscriptionProcedure, inferProcedureInput, inferTransformedProcedureOutput, inferTransformedSubscriptionOutput, IntersectionError, ProcedureOptions,
|
|
2
|
+
import type { AnyMutationProcedure, AnyProcedure, AnyQueryProcedure, AnyRootTypes, AnyRouter, AnySubscriptionProcedure, inferProcedureInput, inferTransformedProcedureOutput, inferTransformedSubscriptionOutput, IntersectionError, ProcedureOptions, ProcedureType, RouterRecord } from '@trpc/server/unstable-core-do-not-import';
|
|
3
3
|
import type { CreateTRPCClientOptions } from './createTRPCUntypedClient';
|
|
4
4
|
import type { TRPCSubscriptionObserver, UntypedClientProperties } from './internals/TRPCUntypedClient';
|
|
5
5
|
import { TRPCUntypedClient } from './internals/TRPCUntypedClient';
|
|
@@ -21,15 +21,15 @@ type DecorateProcedure<TRoot extends AnyRootTypes, TProcedure extends AnyProcedu
|
|
|
21
21
|
/**
|
|
22
22
|
* @internal
|
|
23
23
|
*/
|
|
24
|
-
type DecoratedProcedureRecord<TRouter extends AnyRouter,
|
|
25
|
-
[TKey in keyof
|
|
24
|
+
type DecoratedProcedureRecord<TRouter extends AnyRouter, TRecord extends RouterRecord> = {
|
|
25
|
+
[TKey in keyof TRecord]: TRecord[TKey] extends infer $Value ? $Value extends RouterRecord ? DecoratedProcedureRecord<TRouter, $Value> : $Value extends AnyProcedure ? DecorateProcedure<TRouter['_def']['_config']['$types'], $Value> : never : never;
|
|
26
26
|
};
|
|
27
27
|
/** @internal */
|
|
28
28
|
export declare const clientCallTypeToProcedureType: (clientCallType: string) => ProcedureType;
|
|
29
29
|
/**
|
|
30
30
|
* Creates a proxy client and shows type errors if you have query names that collide with built-in properties
|
|
31
31
|
*/
|
|
32
|
-
export type CreateTRPCClient<TRouter extends AnyRouter> = inferRouterClient<TRouter> extends infer $
|
|
32
|
+
export type CreateTRPCClient<TRouter extends AnyRouter> = inferRouterClient<TRouter> extends infer $Value ? UntypedClientProperties & keyof $Value extends never ? inferRouterClient<TRouter> : IntersectionError<UntypedClientProperties & keyof $Value> : never;
|
|
33
33
|
/**
|
|
34
34
|
* @internal
|
|
35
35
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTRPCClient.d.ts","sourceRoot":"","sources":["../src/createTRPCClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EACV,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,wBAAwB,EACxB,mBAAmB,EACnB,+BAA+B,EAC/B,kCAAkC,EAClC,iBAAiB,EACjB,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"createTRPCClient.d.ts","sourceRoot":"","sources":["../src/createTRPCClient.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
import type { Unsubscribable } from '@trpc/server/observable';
|
|
2
|
-
import type { AnyRouter,
|
|
2
|
+
import type { AnyRouter, TRPCInferrable, TypeError } from '@trpc/server/unstable-core-do-not-import';
|
|
3
3
|
import type { OperationContext, TRPCClientRuntime, TRPCLink } from '../links/types';
|
|
4
4
|
import { TRPCClientError } from '../TRPCClientError';
|
|
5
|
-
type CreateTRPCClientBaseOptions<TRouter extends AnyRouter> = inferRootTypes<TRouter>['transformer'] extends false ? {
|
|
6
|
-
/**
|
|
7
|
-
* Data transformer
|
|
8
|
-
*
|
|
9
|
-
* You must use the same transformer on the backend and frontend
|
|
10
|
-
* @link https://trpc.io/docs/v11/data-transformers
|
|
11
|
-
**/
|
|
12
|
-
transformer?: TypeError<'You must define a transformer on your your `initTRPC`-object first'>;
|
|
13
|
-
} : {
|
|
14
|
-
/**
|
|
15
|
-
* Data transformer
|
|
16
|
-
*
|
|
17
|
-
* You must use the same transformer on the backend and frontend
|
|
18
|
-
* @link https://trpc.io/docs/v11/data-transformers
|
|
19
|
-
**/
|
|
20
|
-
transformer: DataTransformerOptions;
|
|
21
|
-
};
|
|
22
5
|
export interface TRPCRequestOptions {
|
|
23
6
|
/**
|
|
24
7
|
* Pass additional context to links
|
|
@@ -34,8 +17,9 @@ export interface TRPCSubscriptionObserver<TValue, TError> {
|
|
|
34
17
|
onComplete: () => void;
|
|
35
18
|
}
|
|
36
19
|
/** @internal */
|
|
37
|
-
export type CreateTRPCClientOptions<TRouter extends
|
|
20
|
+
export type CreateTRPCClientOptions<TRouter extends TRPCInferrable> = {
|
|
38
21
|
links: TRPCLink<TRouter>[];
|
|
22
|
+
transformer?: TypeError<'The transformer property has moved to httpLink/httpBatchLink/wsLink'>;
|
|
39
23
|
};
|
|
40
24
|
/** @internal */
|
|
41
25
|
export type UntypedClientProperties = '$request' | 'links' | 'mutation' | 'query' | 'requestAsPromise' | 'requestId' | 'runtime' | 'subscription';
|
|
@@ -50,5 +34,4 @@ export declare class TRPCUntypedClient<TRouter extends AnyRouter> {
|
|
|
50
34
|
mutation(path: string, input?: unknown, opts?: TRPCRequestOptions): Promise<unknown>;
|
|
51
35
|
subscription(path: string, input: unknown, opts: Partial<TRPCSubscriptionObserver<unknown, TRPCClientError<AnyRouter>>> & TRPCRequestOptions): Unsubscribable;
|
|
52
36
|
}
|
|
53
|
-
export {};
|
|
54
37
|
//# sourceMappingURL=TRPCUntypedClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TRPCUntypedClient.d.ts","sourceRoot":"","sources":["../../src/internals/TRPCUntypedClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,cAAc,EACf,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EACV,SAAS,
|
|
1
|
+
{"version":3,"file":"TRPCUntypedClient.d.ts","sourceRoot":"","sources":["../../src/internals/TRPCUntypedClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,cAAc,EACf,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,SAAS,EACV,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EACV,gBAAgB,EAEhB,iBAAiB,EACjB,QAAQ,EACT,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,wBAAwB,CAAC,MAAM,EAAE,MAAM;IACtD,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,gBAAgB;AAChB,MAAM,MAAM,uBAAuB,CAAC,OAAO,SAAS,cAAc,IAAI;IACpE,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,SAAS,CAAC,qEAAqE,CAAC,CAAC;CAChG,CAAC;AAEF,gBAAgB;AAChB,MAAM,MAAM,uBAAuB,GAC/B,UAAU,GACV,OAAO,GACP,UAAU,GACV,OAAO,GACP,kBAAkB,GAClB,WAAW,GACX,SAAS,GACT,cAAc,CAAC;AAEnB,qBAAa,iBAAiB,CAAC,OAAO,SAAS,SAAS;IACtD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA6B;IACnD,SAAgB,OAAO,EAAE,iBAAiB,CAAC;IAC3C,OAAO,CAAC,SAAS,CAAS;gBAEd,IAAI,EAAE,uBAAuB,CAAC,OAAO,CAAC;IASlD,OAAO,CAAC,QAAQ;IAuBhB,OAAO,CAAC,gBAAgB;IAyBjB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,kBAAkB;IAS9D,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,kBAAkB;IASjE,YAAY,CACjB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,OAAO,CACX,wBAAwB,CAAC,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC,CAC9D,GACC,kBAAkB,GACnB,cAAc;CAyBlB"}
|
|
@@ -76,35 +76,7 @@ class TRPCUntypedClient {
|
|
|
76
76
|
}
|
|
77
77
|
constructor(opts){
|
|
78
78
|
this.requestId = 0;
|
|
79
|
-
|
|
80
|
-
const transformer = opts.transformer;
|
|
81
|
-
if (!transformer) {
|
|
82
|
-
return {
|
|
83
|
-
input: {
|
|
84
|
-
serialize: (data)=>data,
|
|
85
|
-
deserialize: (data)=>data
|
|
86
|
-
},
|
|
87
|
-
output: {
|
|
88
|
-
serialize: (data)=>data,
|
|
89
|
-
deserialize: (data)=>data
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
if ('input' in transformer) {
|
|
94
|
-
return opts.transformer;
|
|
95
|
-
}
|
|
96
|
-
return {
|
|
97
|
-
input: transformer,
|
|
98
|
-
output: transformer
|
|
99
|
-
};
|
|
100
|
-
})();
|
|
101
|
-
this.runtime = {
|
|
102
|
-
transformer: {
|
|
103
|
-
serialize: (data)=>combinedTransformer.input.serialize(data),
|
|
104
|
-
deserialize: (data)=>combinedTransformer.output.deserialize(data)
|
|
105
|
-
},
|
|
106
|
-
combinedTransformer
|
|
107
|
-
};
|
|
79
|
+
this.runtime = {};
|
|
108
80
|
// Initialize the links
|
|
109
81
|
this.links = opts.links.map((link)=>link(this.runtime));
|
|
110
82
|
}
|
|
@@ -74,35 +74,7 @@ class TRPCUntypedClient {
|
|
|
74
74
|
}
|
|
75
75
|
constructor(opts){
|
|
76
76
|
this.requestId = 0;
|
|
77
|
-
|
|
78
|
-
const transformer = opts.transformer;
|
|
79
|
-
if (!transformer) {
|
|
80
|
-
return {
|
|
81
|
-
input: {
|
|
82
|
-
serialize: (data)=>data,
|
|
83
|
-
deserialize: (data)=>data
|
|
84
|
-
},
|
|
85
|
-
output: {
|
|
86
|
-
serialize: (data)=>data,
|
|
87
|
-
deserialize: (data)=>data
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
if ('input' in transformer) {
|
|
92
|
-
return opts.transformer;
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
input: transformer,
|
|
96
|
-
output: transformer
|
|
97
|
-
};
|
|
98
|
-
})();
|
|
99
|
-
this.runtime = {
|
|
100
|
-
transformer: {
|
|
101
|
-
serialize: (data)=>combinedTransformer.input.serialize(data),
|
|
102
|
-
deserialize: (data)=>combinedTransformer.output.deserialize(data)
|
|
103
|
-
},
|
|
104
|
-
combinedTransformer
|
|
105
|
-
};
|
|
77
|
+
this.runtime = {};
|
|
106
78
|
// Initialize the links
|
|
107
79
|
this.links = opts.links.map((link)=>link(this.runtime));
|
|
108
80
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { AnyRootTypes } from '@trpc/server/unstable-core-do-not-import';
|
|
1
2
|
import type { NonEmptyArray } from '../internals/types';
|
|
2
3
|
import type { HTTPLinkBaseOptions } from './internals/httpUtils';
|
|
3
4
|
import type { HTTPHeaders, Operation } from './types';
|
|
4
|
-
export
|
|
5
|
+
export type HTTPBatchLinkOptions<TRoot extends AnyRootTypes> = HTTPLinkBaseOptions<TRoot> & {
|
|
5
6
|
maxURLLength?: number;
|
|
6
7
|
/**
|
|
7
8
|
* Headers to be set on outgoing requests or a callback that of said headers
|
|
@@ -10,5 +11,5 @@ export interface HTTPBatchLinkOptions extends HTTPLinkBaseOptions {
|
|
|
10
11
|
headers?: HTTPHeaders | ((opts: {
|
|
11
12
|
opList: NonEmptyArray<Operation>;
|
|
12
13
|
}) => HTTPHeaders | Promise<HTTPHeaders>);
|
|
13
|
-
}
|
|
14
|
+
};
|
|
14
15
|
//# sourceMappingURL=HTTPBatchLinkOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HTTPBatchLinkOptions.d.ts","sourceRoot":"","sources":["../../src/links/HTTPBatchLinkOptions.ts"],"names":[],"mappings":"AAAA,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,
|
|
1
|
+
{"version":3,"file":"HTTPBatchLinkOptions.d.ts","sourceRoot":"","sources":["../../src/links/HTTPBatchLinkOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAC7E,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,YAAY,IACzD,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;CAC/C,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { HTTPBatchLinkOptions } from './HTTPBatchLinkOptions';
|
|
2
|
-
export declare const httpBatchLink: <TRouter extends import("@trpc/server/unstable-core-do-not-import").AnyRouter>(opts: HTTPBatchLinkOptions) => import("./types").TRPCLink<TRouter>;
|
|
2
|
+
export declare const httpBatchLink: <TRouter extends import("@trpc/server/unstable-core-do-not-import").AnyRouter>(opts: HTTPBatchLinkOptions<import("@trpc/server/unstable-core-do-not-import").inferRootTypes<TRouter>>) => import("./types").TRPCLink<TRouter>;
|
|
3
3
|
//# sourceMappingURL=httpBatchLink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpBatchLink.d.ts","sourceRoot":"","sources":["../../src/links/httpBatchLink.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"httpBatchLink.d.ts","sourceRoot":"","sources":["../../src/links/httpBatchLink.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAgDnE,eAAO,MAAM,aAAa,+NAAsC,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import type { AnyRootTypes } from '@trpc/server/unstable-core-do-not-import';
|
|
1
2
|
import type { HTTPBatchLinkOptions } from './HTTPBatchLinkOptions';
|
|
2
3
|
import type { TextDecoderEsque } from './internals/streamingUtils';
|
|
3
|
-
export
|
|
4
|
+
export type HTTPBatchStreamLinkOptions<TRoot extends AnyRootTypes> = HTTPBatchLinkOptions<TRoot> & {
|
|
4
5
|
/**
|
|
5
6
|
* Will default to the webAPI `TextDecoder`,
|
|
6
7
|
* but you can use this option if your client
|
|
7
8
|
* runtime doesn't provide it.
|
|
8
9
|
*/
|
|
9
10
|
textDecoder?: TextDecoderEsque;
|
|
10
|
-
}
|
|
11
|
-
export declare const unstable_httpBatchStreamLink: <TRouter extends import("@trpc/server/unstable-core-do-not-import").AnyRouter>(opts:
|
|
11
|
+
};
|
|
12
|
+
export declare const unstable_httpBatchStreamLink: <TRouter extends import("@trpc/server/unstable-core-do-not-import").AnyRouter>(opts: HTTPBatchLinkOptions<import("@trpc/server/unstable-core-do-not-import").inferRootTypes<TRouter>>) => import("./types").TRPCLink<TRouter>;
|
|
12
13
|
//# sourceMappingURL=httpBatchStreamLink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpBatchStreamLink.d.ts","sourceRoot":"","sources":["../../src/links/httpBatchStreamLink.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"httpBatchStreamLink.d.ts","sourceRoot":"","sources":["../../src/links/httpBatchStreamLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAE7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAKnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGnE,MAAM,MAAM,0BAA0B,CAAC,KAAK,SAAS,YAAY,IAC/D,oBAAoB,CAAC,KAAK,CAAC,GAAG;IAC5B;;;;OAIG;IACH,WAAW,CAAC,EAAE,gBAAgB,CAAC;CAChC,CAAC;AA6CJ,eAAO,MAAM,4BAA4B,+NACH,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const experimental_formDataLink: <TRouter extends import("@trpc/server/unstable-core-do-not-import").AnyRouter>(opts: import("./httpLink").HTTPLinkOptions) => import("./types").TRPCLink<TRouter>;
|
|
1
|
+
export declare const experimental_formDataLink: <TRouter extends import("@trpc/server/unstable-core-do-not-import").AnyRouter>(opts: import("./httpLink").HTTPLinkOptions<TRouter["_def"]["_config"]["$types"]>) => import("./types").TRPCLink<TRouter>;
|
|
2
2
|
//# sourceMappingURL=httpFormDataLink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpFormDataLink.d.ts","sourceRoot":"","sources":["../../src/links/httpFormDataLink.ts"],"names":[],"mappings":"AA0BA,eAAO,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"httpFormDataLink.d.ts","sourceRoot":"","sources":["../../src/links/httpFormDataLink.ts"],"names":[],"mappings":"AA0BA,eAAO,MAAM,yBAAyB,yMAEpC,CAAC"}
|
package/dist/links/httpLink.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';
|
|
1
|
+
import type { AnyRootTypes, AnyRouter } from '@trpc/server/unstable-core-do-not-import';
|
|
2
2
|
import type { HTTPLinkBaseOptions, Requester } from './internals/httpUtils';
|
|
3
3
|
import type { HTTPHeaders, Operation, TRPCLink } from './types';
|
|
4
|
-
export
|
|
4
|
+
export type HTTPLinkOptions<TRoot extends AnyRootTypes> = HTTPLinkBaseOptions<TRoot> & {
|
|
5
5
|
/**
|
|
6
6
|
* Headers to be set on outgoing requests or a callback that of said headers
|
|
7
7
|
* @link http://trpc.io/docs/client/headers
|
|
@@ -9,12 +9,12 @@ export interface HTTPLinkOptions extends HTTPLinkBaseOptions {
|
|
|
9
9
|
headers?: HTTPHeaders | ((opts: {
|
|
10
10
|
op: Operation;
|
|
11
11
|
}) => HTTPHeaders | Promise<HTTPHeaders>);
|
|
12
|
-
}
|
|
12
|
+
};
|
|
13
13
|
export declare function httpLinkFactory(factoryOpts: {
|
|
14
14
|
requester: Requester;
|
|
15
|
-
}): <TRouter extends AnyRouter>(opts: HTTPLinkOptions) => TRPCLink<TRouter>;
|
|
15
|
+
}): <TRouter extends AnyRouter>(opts: HTTPLinkOptions<TRouter["_def"]["_config"]["$types"]>) => TRPCLink<TRouter>;
|
|
16
16
|
/**
|
|
17
17
|
* @link https://trpc.io/docs/v11/client/links/httpLink
|
|
18
18
|
*/
|
|
19
|
-
export declare const httpLink: <TRouter extends AnyRouter>(opts: HTTPLinkOptions) => TRPCLink<TRouter>;
|
|
19
|
+
export declare const httpLink: <TRouter extends AnyRouter>(opts: HTTPLinkOptions<TRouter["_def"]["_config"]["$types"]>) => TRPCLink<TRouter>;
|
|
20
20
|
//# sourceMappingURL=httpLink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpLink.d.ts","sourceRoot":"","sources":["../../src/links/httpLink.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"httpLink.d.ts","sourceRoot":"","sources":["../../src/links/httpLink.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACV,MAAM,0CAA0C,CAAC;AAGlD,OAAO,KAAK,EACV,mBAAmB,EAEnB,SAAS,EACV,MAAM,uBAAuB,CAAC;AAK/B,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEhE,MAAM,MAAM,eAAe,CAAC,KAAK,SAAS,YAAY,IACpD,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;AAEJ,wBAAgB,eAAe,CAAC,WAAW,EAAE;IAAE,SAAS,EAAE,SAAS,CAAA;CAAE,iHA2DpE;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,+GAAoD,CAAC"}
|
package/dist/links/httpLink.js
CHANGED
|
@@ -8,11 +8,10 @@ var httpUtils = require('./internals/httpUtils.js');
|
|
|
8
8
|
function httpLinkFactory(factoryOpts) {
|
|
9
9
|
return (opts)=>{
|
|
10
10
|
const resolvedOpts = httpUtils.resolveHTTPLinkOptions(opts);
|
|
11
|
-
return (
|
|
11
|
+
return ()=>({ op })=>observable.observable((observer)=>{
|
|
12
12
|
const { path , input , type } = op;
|
|
13
13
|
const { promise , cancel } = factoryOpts.requester({
|
|
14
14
|
...resolvedOpts,
|
|
15
|
-
runtime,
|
|
16
15
|
type,
|
|
17
16
|
path,
|
|
18
17
|
input,
|
|
@@ -31,7 +30,7 @@ function httpLinkFactory(factoryOpts) {
|
|
|
31
30
|
let meta = undefined;
|
|
32
31
|
promise.then((res)=>{
|
|
33
32
|
meta = res.meta;
|
|
34
|
-
const transformed = unstableCoreDoNotImport.transformResult(res.json,
|
|
33
|
+
const transformed = unstableCoreDoNotImport.transformResult(res.json, resolvedOpts.transformer.output);
|
|
35
34
|
if (!transformed.ok) {
|
|
36
35
|
observer.error(TRPCClientError.TRPCClientError.from(transformed.error, {
|
|
37
36
|
meta
|
package/dist/links/httpLink.mjs
CHANGED
|
@@ -6,11 +6,10 @@ import { resolveHTTPLinkOptions, jsonHttpRequester } from './internals/httpUtils
|
|
|
6
6
|
function httpLinkFactory(factoryOpts) {
|
|
7
7
|
return (opts)=>{
|
|
8
8
|
const resolvedOpts = resolveHTTPLinkOptions(opts);
|
|
9
|
-
return (
|
|
9
|
+
return ()=>({ op })=>observable((observer)=>{
|
|
10
10
|
const { path , input , type } = op;
|
|
11
11
|
const { promise , cancel } = factoryOpts.requester({
|
|
12
12
|
...resolvedOpts,
|
|
13
|
-
runtime,
|
|
14
13
|
type,
|
|
15
14
|
path,
|
|
16
15
|
input,
|
|
@@ -29,7 +28,7 @@ function httpLinkFactory(factoryOpts) {
|
|
|
29
28
|
let meta = undefined;
|
|
30
29
|
promise.then((res)=>{
|
|
31
30
|
meta = res.meta;
|
|
32
|
-
const transformed = transformResult(res.json,
|
|
31
|
+
const transformed = transformResult(res.json, resolvedOpts.transformer.output);
|
|
33
32
|
if (!transformed.ok) {
|
|
34
33
|
observer.error(TRPCClientError.from(transformed.error, {
|
|
35
34
|
meta
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { AnyRouter, ProcedureType } from '@trpc/server/unstable-core-do-not-import';
|
|
1
|
+
import type { AnyRootTypes, AnyRouter, inferRootTypes, ProcedureType } from '@trpc/server/unstable-core-do-not-import';
|
|
2
2
|
import type { HTTPBatchLinkOptions } from '../HTTPBatchLinkOptions';
|
|
3
3
|
import type { CancelFn, Operation, TRPCClientRuntime, TRPCLink } from '../types';
|
|
4
4
|
import type { HTTPResult, ResolvedHTTPLinkOptions } from './httpUtils';
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
|
-
export type RequesterFn<TOptions extends HTTPBatchLinkOptions
|
|
8
|
+
export type RequesterFn<TOptions extends HTTPBatchLinkOptions<AnyRootTypes>> = (requesterOpts: ResolvedHTTPLinkOptions & {
|
|
9
9
|
runtime: TRPCClientRuntime;
|
|
10
10
|
type: ProcedureType;
|
|
11
11
|
opts: TOptions;
|
|
@@ -16,5 +16,5 @@ export type RequesterFn<TOptions extends HTTPBatchLinkOptions> = (requesterOpts:
|
|
|
16
16
|
/**
|
|
17
17
|
* @internal
|
|
18
18
|
*/
|
|
19
|
-
export declare function createHTTPBatchLink
|
|
19
|
+
export declare function createHTTPBatchLink(requester: RequesterFn<HTTPBatchLinkOptions<AnyRootTypes>>): <TRouter extends AnyRouter>(opts: HTTPBatchLinkOptions<inferRootTypes<TRouter>>) => TRPCLink<TRouter>;
|
|
20
20
|
//# sourceMappingURL=createHTTPBatchLink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHTTPBatchLink.d.ts","sourceRoot":"","sources":["../../../src/links/internals/createHTTPBatchLink.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACd,MAAM,0CAA0C,CAAC;AAIlD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACT,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAGvE;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,QAAQ,SAAS,oBAAoB,IAAI,
|
|
1
|
+
{"version":3,"file":"createHTTPBatchLink.d.ts","sourceRoot":"","sources":["../../../src/links/internals/createHTTPBatchLink.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,cAAc,EACd,aAAa,EACd,MAAM,0CAA0C,CAAC;AAIlD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACT,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAGvE;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,QAAQ,SAAS,oBAAoB,CAAC,YAAY,CAAC,IAAI,CAC7E,aAAa,EAAE,uBAAuB,GAAG;IACvC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,QAAQ,CAAC;CAChB,KACE,CACH,QAAQ,EAAE,SAAS,EAAE,EACrB,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,KAAK,IAAI,KAClE;IACH,OAAO,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IAC/B,MAAM,EAAE,QAAQ,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,WAAW,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC,yGA2F3D"}
|
|
@@ -24,7 +24,6 @@ var httpUtils = require('./httpUtils.js');
|
|
|
24
24
|
const inputs = batchOps.map((op)=>op.input);
|
|
25
25
|
const url = httpUtils.getUrl({
|
|
26
26
|
...resolvedOpts,
|
|
27
|
-
runtime,
|
|
28
27
|
type,
|
|
29
28
|
path,
|
|
30
29
|
inputs
|
|
@@ -57,7 +56,7 @@ var httpUtils = require('./httpUtils.js');
|
|
|
57
56
|
let _res = undefined;
|
|
58
57
|
promise.then((res)=>{
|
|
59
58
|
_res = res;
|
|
60
|
-
const transformed = unstableCoreDoNotImport.transformResult(res.json,
|
|
59
|
+
const transformed = unstableCoreDoNotImport.transformResult(res.json, resolvedOpts.transformer.output);
|
|
61
60
|
if (!transformed.ok) {
|
|
62
61
|
observer.error(TRPCClientError.TRPCClientError.from(transformed.error, {
|
|
63
62
|
meta: res.meta
|