@trpc/client 11.0.0-alpha-tmp-issues-6374.694 → 11.0.0-alpha-tmp-issues-6374.697
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 +35 -35
- package/dist/createTRPCClient.d.ts +10 -3
- package/dist/createTRPCClient.d.ts.map +1 -1
- package/dist/createTRPCClient.js +5 -1
- package/dist/createTRPCClient.mjs +5 -1
- package/dist/internals/TRPCUntypedClient.d.ts +3 -3
- package/dist/internals/TRPCUntypedClient.d.ts.map +1 -1
- package/dist/internals/TRPCUntypedClient.js +2 -1
- package/dist/internals/TRPCUntypedClient.mjs +2 -1
- package/dist/links/internals/createChain.d.ts +4 -4
- package/dist/links/internals/createChain.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/createTRPCClient.ts +19 -4
- package/src/internals/TRPCUntypedClient.ts +8 -7
- package/src/links/internals/createChain.ts +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction":
|
|
2
|
+
"bundleSize": 66394,
|
|
3
|
+
"bundleOrigSize": 84055,
|
|
4
|
+
"bundleReduction": 21.01,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/links/wsLink.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
],
|
|
14
14
|
"removedExports": [],
|
|
15
15
|
"dependents": [],
|
|
16
|
-
"percent": 27.
|
|
16
|
+
"percent": 27.13,
|
|
17
17
|
"reduction": 10.3
|
|
18
18
|
},
|
|
19
19
|
{
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
],
|
|
26
26
|
"removedExports": [],
|
|
27
27
|
"dependents": [],
|
|
28
|
-
"percent": 11.
|
|
28
|
+
"percent": 11.73,
|
|
29
29
|
"reduction": 0
|
|
30
30
|
},
|
|
31
31
|
{
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
],
|
|
38
38
|
"removedExports": [],
|
|
39
39
|
"dependents": [],
|
|
40
|
-
"percent": 9.
|
|
40
|
+
"percent": 9.05,
|
|
41
41
|
"reduction": 4.42
|
|
42
42
|
},
|
|
43
43
|
{
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
],
|
|
50
50
|
"removedExports": [],
|
|
51
51
|
"dependents": [],
|
|
52
|
-
"percent": 8.
|
|
52
|
+
"percent": 8.43,
|
|
53
53
|
"reduction": 19.44
|
|
54
54
|
},
|
|
55
55
|
{
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"/src/links/httpBatchLink.ts",
|
|
65
65
|
"/src/links/httpBatchStreamLink.ts"
|
|
66
66
|
],
|
|
67
|
-
"percent": 6.
|
|
67
|
+
"percent": 6.15,
|
|
68
68
|
"reduction": 5.64
|
|
69
69
|
},
|
|
70
70
|
{
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
],
|
|
77
77
|
"removedExports": [],
|
|
78
78
|
"dependents": [],
|
|
79
|
-
"percent": 5.
|
|
79
|
+
"percent": 5.93,
|
|
80
80
|
"reduction": 5.59
|
|
81
81
|
},
|
|
82
82
|
{
|
|
@@ -99,13 +99,13 @@
|
|
|
99
99
|
"/src/links/httpBatchStreamLink.ts",
|
|
100
100
|
"/src/links/httpSubscriptionLink.ts"
|
|
101
101
|
],
|
|
102
|
-
"percent": 5.
|
|
102
|
+
"percent": 5.56,
|
|
103
103
|
"reduction": 37.14
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
106
|
"id": "/src/internals/TRPCUntypedClient.ts",
|
|
107
|
-
"size":
|
|
108
|
-
"origSize":
|
|
107
|
+
"size": 3295,
|
|
108
|
+
"origSize": 4748,
|
|
109
109
|
"renderedExports": [
|
|
110
110
|
"TRPCUntypedClient",
|
|
111
111
|
"untypedClientSymbol"
|
|
@@ -115,8 +115,8 @@
|
|
|
115
115
|
"/src/createTRPCUntypedClient.ts",
|
|
116
116
|
"/src/createTRPCClient.ts"
|
|
117
117
|
],
|
|
118
|
-
"percent": 4.
|
|
119
|
-
"reduction": 30.
|
|
118
|
+
"percent": 4.96,
|
|
119
|
+
"reduction": 30.6
|
|
120
120
|
},
|
|
121
121
|
{
|
|
122
122
|
"id": "/src/links/httpLink.ts",
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
],
|
|
128
128
|
"removedExports": [],
|
|
129
129
|
"dependents": [],
|
|
130
|
-
"percent": 4.
|
|
130
|
+
"percent": 4.79,
|
|
131
131
|
"reduction": 14.24
|
|
132
132
|
},
|
|
133
133
|
{
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
"/src/links/httpSubscriptionLink.ts",
|
|
148
148
|
"/src/internals/TRPCUntypedClient.ts"
|
|
149
149
|
],
|
|
150
|
-
"percent": 4.
|
|
150
|
+
"percent": 4.2,
|
|
151
151
|
"reduction": 21.8
|
|
152
152
|
},
|
|
153
153
|
{
|
|
@@ -159,13 +159,13 @@
|
|
|
159
159
|
],
|
|
160
160
|
"removedExports": [],
|
|
161
161
|
"dependents": [],
|
|
162
|
-
"percent": 3.
|
|
162
|
+
"percent": 3.3,
|
|
163
163
|
"reduction": 18.8
|
|
164
164
|
},
|
|
165
165
|
{
|
|
166
166
|
"id": "/src/createTRPCClient.ts",
|
|
167
|
-
"size":
|
|
168
|
-
"origSize":
|
|
167
|
+
"size": 1415,
|
|
168
|
+
"origSize": 5404,
|
|
169
169
|
"renderedExports": [
|
|
170
170
|
"clientCallTypeToProcedureType",
|
|
171
171
|
"createTRPCClientProxy",
|
|
@@ -176,8 +176,8 @@
|
|
|
176
176
|
"dependents": [
|
|
177
177
|
"/src/index.ts"
|
|
178
178
|
],
|
|
179
|
-
"percent":
|
|
180
|
-
"reduction":
|
|
179
|
+
"percent": 2.13,
|
|
180
|
+
"reduction": 73.82
|
|
181
181
|
},
|
|
182
182
|
{
|
|
183
183
|
"id": "/src/internals/signals.ts",
|
|
@@ -193,13 +193,13 @@
|
|
|
193
193
|
"/src/links/httpBatchStreamLink.ts",
|
|
194
194
|
"/src/links/httpSubscriptionLink.ts"
|
|
195
195
|
],
|
|
196
|
-
"percent": 1.
|
|
196
|
+
"percent": 1.79,
|
|
197
197
|
"reduction": 3.88
|
|
198
198
|
},
|
|
199
199
|
{
|
|
200
200
|
"id": "/src/links/internals/createChain.ts",
|
|
201
201
|
"size": 690,
|
|
202
|
-
"origSize":
|
|
202
|
+
"origSize": 1062,
|
|
203
203
|
"renderedExports": [
|
|
204
204
|
"createChain"
|
|
205
205
|
],
|
|
@@ -209,7 +209,7 @@
|
|
|
209
209
|
"/src/internals/TRPCUntypedClient.ts"
|
|
210
210
|
],
|
|
211
211
|
"percent": 1.04,
|
|
212
|
-
"reduction":
|
|
212
|
+
"reduction": 35.03
|
|
213
213
|
},
|
|
214
214
|
{
|
|
215
215
|
"id": "/src/links/splitLink.ts",
|
|
@@ -249,7 +249,7 @@
|
|
|
249
249
|
"/src/index.ts",
|
|
250
250
|
"/src/links/internals/httpUtils.ts"
|
|
251
251
|
],
|
|
252
|
-
"percent": 0.
|
|
252
|
+
"percent": 0.64,
|
|
253
253
|
"reduction": 33.54
|
|
254
254
|
},
|
|
255
255
|
{
|
|
@@ -311,26 +311,26 @@
|
|
|
311
311
|
"reduction": 82.58
|
|
312
312
|
},
|
|
313
313
|
{
|
|
314
|
-
"id": "/src/
|
|
314
|
+
"id": "/src/index.ts",
|
|
315
315
|
"size": 0,
|
|
316
|
-
"origSize":
|
|
316
|
+
"origSize": 588,
|
|
317
317
|
"renderedExports": [],
|
|
318
318
|
"removedExports": [],
|
|
319
|
-
"dependents": [
|
|
320
|
-
"/src/links/wsLink.ts",
|
|
321
|
-
"/src/links/httpSubscriptionLink.ts",
|
|
322
|
-
"/src/links/internals/httpUtils.ts"
|
|
323
|
-
],
|
|
319
|
+
"dependents": [],
|
|
324
320
|
"percent": 0,
|
|
325
321
|
"reduction": 100
|
|
326
322
|
},
|
|
327
323
|
{
|
|
328
|
-
"id": "/src/
|
|
324
|
+
"id": "/src/unstable-internals.ts",
|
|
329
325
|
"size": 0,
|
|
330
|
-
"origSize":
|
|
326
|
+
"origSize": 90,
|
|
331
327
|
"renderedExports": [],
|
|
332
328
|
"removedExports": [],
|
|
333
|
-
"dependents": [
|
|
329
|
+
"dependents": [
|
|
330
|
+
"/src/links/wsLink.ts",
|
|
331
|
+
"/src/links/httpSubscriptionLink.ts",
|
|
332
|
+
"/src/links/internals/httpUtils.ts"
|
|
333
|
+
],
|
|
334
334
|
"percent": 0,
|
|
335
335
|
"reduction": 100
|
|
336
336
|
}
|
|
@@ -2,13 +2,17 @@ import type { Unsubscribable } from '@trpc/server/observable';
|
|
|
2
2
|
import type { AnyProcedure, AnyRouter, inferClientTypes, inferProcedureInput, inferTransformedProcedureOutput, 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
|
-
import { TRPCUntypedClient
|
|
5
|
+
import { TRPCUntypedClient } from './internals/TRPCUntypedClient';
|
|
6
6
|
import type { TRPCClientError } from './TRPCClientError';
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
declare const trpcClientSymbol: unique symbol;
|
|
7
11
|
/**
|
|
8
12
|
* @public
|
|
9
13
|
*/
|
|
10
14
|
export type TRPCClient<TRouter extends AnyRouter> = DecoratedProcedureRecord<TRouter, TRouter['_def']['record']> & {
|
|
11
|
-
[
|
|
15
|
+
[trpcClientSymbol]: true;
|
|
12
16
|
};
|
|
13
17
|
/**
|
|
14
18
|
* @public
|
|
@@ -58,6 +62,9 @@ export declare function createTRPCClient<TRouter extends AnyRouter>(opts: Create
|
|
|
58
62
|
* Get an untyped client from a proxy client
|
|
59
63
|
* @internal
|
|
60
64
|
*/
|
|
61
|
-
export declare function getUntypedClient<TRouter extends AnyRouter>(client: TRPCClient<TRouter>): TRPCUntypedClient<
|
|
65
|
+
export declare function getUntypedClient<TRouter extends AnyRouter>(client: TRPCClient<TRouter> | TRPCUntypedClient<TRouter>): TRPCUntypedClient<{
|
|
66
|
+
errorShape: TRouter['_def']['_config']['$types']['errorShape'];
|
|
67
|
+
transformer: TRouter['_def']['_config']['$types']['transformer'];
|
|
68
|
+
}>;
|
|
62
69
|
export {};
|
|
63
70
|
//# sourceMappingURL=createTRPCClient.d.ts.map
|
|
@@ -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,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACnB,+BAA+B,EAC/B,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACb,MAAM,0CAA0C,CAAC;AAKlD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,iBAAiB,
|
|
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,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACnB,+BAA+B,EAC/B,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACb,MAAM,0CAA0C,CAAC;AAKlD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACxB,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AAG,MAAM,MAAM,SAAS,KAAK,GAClD,UAAU,CAAC,OAAO,CAAC,GACnB,iBAAiB,CAAC,uBAAuB,GAAG,MAAM,MAAM,CAAC,GAC3D,KAAK,CAAC;AAEZ;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,SAAS,SAAS,EAC7D,MAAM,EAAE,iBAAiB,CAAC,OAAO,CAAC,GACjC,gBAAgB,CAAC,OAAO,CAAC,CAoB3B;AAED,wBAAgB,gBAAgB,CAAC,OAAO,SAAS,SAAS,EACxD,IAAI,EAAE,uBAAuB,CAAC,OAAO,CAAC,GACrC,gBAAgB,CAAC,OAAO,CAAC,CAI3B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,SAAS,SAAS,EACxD,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,iBAAiB,CAAC,OAAO,CAAC,GACvD,iBAAiB,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC;IAC/D,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC,CAAC;CAClE,CAAC,CASD"}
|
package/dist/createTRPCClient.js
CHANGED
|
@@ -41,7 +41,11 @@ function createTRPCClient(opts) {
|
|
|
41
41
|
* Get an untyped client from a proxy client
|
|
42
42
|
* @internal
|
|
43
43
|
*/ function getUntypedClient(client) {
|
|
44
|
-
|
|
44
|
+
// Note: don't use `instanceof TRPCUntypedClient` as it won't work if @trpc/client isn't hoisted
|
|
45
|
+
if (client[TRPCUntypedClient.untypedClientSymbol]) {
|
|
46
|
+
return client[TRPCUntypedClient.untypedClientSymbol];
|
|
47
|
+
}
|
|
48
|
+
return client;
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
exports.clientCallTypeToProcedureType = clientCallTypeToProcedureType;
|
|
@@ -39,7 +39,11 @@ function createTRPCClient(opts) {
|
|
|
39
39
|
* Get an untyped client from a proxy client
|
|
40
40
|
* @internal
|
|
41
41
|
*/ function getUntypedClient(client) {
|
|
42
|
-
|
|
42
|
+
// Note: don't use `instanceof TRPCUntypedClient` as it won't work if @trpc/client isn't hoisted
|
|
43
|
+
if (client[untypedClientSymbol]) {
|
|
44
|
+
return client[untypedClientSymbol];
|
|
45
|
+
}
|
|
46
|
+
return client;
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
export { clientCallTypeToProcedureType, createTRPCClient, createTRPCClientProxy, getUntypedClient };
|
|
@@ -27,16 +27,16 @@ export type CreateTRPCClientOptions<TRouter extends InferrableClientTypes> = {
|
|
|
27
27
|
};
|
|
28
28
|
/** @internal */
|
|
29
29
|
export type UntypedClientProperties = '$request' | 'links' | 'mutation' | 'query' | 'requestAsPromise' | 'requestId' | 'runtime' | 'subscription';
|
|
30
|
-
export declare class TRPCUntypedClient<
|
|
30
|
+
export declare class TRPCUntypedClient<TInferrable extends InferrableClientTypes> {
|
|
31
31
|
private readonly links;
|
|
32
32
|
readonly runtime: TRPCClientRuntime;
|
|
33
33
|
private requestId;
|
|
34
|
-
constructor(opts: CreateTRPCClientOptions<
|
|
34
|
+
constructor(opts: CreateTRPCClientOptions<TInferrable>);
|
|
35
35
|
private $request;
|
|
36
36
|
private requestAsPromise;
|
|
37
37
|
query(path: string, input?: unknown, opts?: TRPCRequestOptions): Promise<unknown>;
|
|
38
38
|
mutation(path: string, input?: unknown, opts?: TRPCRequestOptions): Promise<unknown>;
|
|
39
39
|
subscription(path: string, input: unknown, opts: Partial<TRPCSubscriptionObserver<unknown, TRPCClientError<AnyRouter>>> & TRPCRequestOptions): Unsubscribable;
|
|
40
40
|
}
|
|
41
|
-
export declare const untypedClientSymbol
|
|
41
|
+
export declare const untypedClientSymbol = "__internal_untypedClient";
|
|
42
42
|
//# sourceMappingURL=TRPCUntypedClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":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,IAAI;IAC3E,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,WAAW,SAAS,qBAAqB;IACtE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA+B;IACrD,SAAgB,OAAO,EAAE,iBAAiB,CAAC;IAC3C,OAAO,CAAC,SAAS,CAAS;gBAEd,IAAI,EAAE,uBAAuB,CAAC,WAAW,CAAC;IAStD,OAAO,CAAC,QAAQ;YAkBF,gBAAgB;IAmBvB,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;CAwClB;AAED,eAAO,MAAM,mBAAmB,6BAA6B,CAAC"}
|
|
@@ -33,6 +33,7 @@ class TRPCUntypedClient {
|
|
|
33
33
|
try {
|
|
34
34
|
const req$ = this.$request(opts);
|
|
35
35
|
const envelope = await observable.observableToPromise(req$);
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
36
37
|
const data = envelope.result.data;
|
|
37
38
|
return data;
|
|
38
39
|
} catch (err) {
|
|
@@ -111,7 +112,7 @@ class TRPCUntypedClient {
|
|
|
111
112
|
this.links = opts.links.map((link)=>link(this.runtime));
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
|
-
const untypedClientSymbol =
|
|
115
|
+
const untypedClientSymbol = '__internal_untypedClient';
|
|
115
116
|
|
|
116
117
|
exports.TRPCUntypedClient = TRPCUntypedClient;
|
|
117
118
|
exports.untypedClientSymbol = untypedClientSymbol;
|
|
@@ -31,6 +31,7 @@ class TRPCUntypedClient {
|
|
|
31
31
|
try {
|
|
32
32
|
const req$ = this.$request(opts);
|
|
33
33
|
const envelope = await observableToPromise(req$);
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
34
35
|
const data = envelope.result.data;
|
|
35
36
|
return data;
|
|
36
37
|
} catch (err) {
|
|
@@ -109,6 +110,6 @@ class TRPCUntypedClient {
|
|
|
109
110
|
this.links = opts.links.map((link)=>link(this.runtime));
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
|
-
const untypedClientSymbol =
|
|
113
|
+
const untypedClientSymbol = '__internal_untypedClient';
|
|
113
114
|
|
|
114
115
|
export { TRPCUntypedClient, untypedClientSymbol };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { InferrableClientTypes } from '@trpc/server/unstable-core-do-not-import';
|
|
2
2
|
import type { Operation, OperationLink, OperationResultObservable } from '../types';
|
|
3
3
|
/** @internal */
|
|
4
|
-
export declare function createChain<
|
|
5
|
-
links: OperationLink<
|
|
4
|
+
export declare function createChain<TInferrable extends InferrableClientTypes, TInput = unknown, TOutput = unknown>(opts: {
|
|
5
|
+
links: OperationLink<TInferrable, TInput, TOutput>[];
|
|
6
6
|
op: Operation<TInput>;
|
|
7
|
-
}): OperationResultObservable<
|
|
7
|
+
}): OperationResultObservable<TInferrable, TOutput>;
|
|
8
8
|
//# sourceMappingURL=createChain.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createChain.d.ts","sourceRoot":"","sources":["../../../src/links/internals/createChain.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"createChain.d.ts","sourceRoot":"","sources":["../../../src/links/internals/createChain.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACtF,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,yBAAyB,EAC1B,MAAM,UAAU,CAAC;AAElB,gBAAgB;AAChB,wBAAgB,WAAW,CACzB,WAAW,SAAS,qBAAqB,EACzC,MAAM,GAAG,OAAO,EAChB,OAAO,GAAG,OAAO,EACjB,IAAI,EAAE;IACN,KAAK,EAAE,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACrD,EAAE,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;CACvB,GAAG,yBAAyB,CAAC,WAAW,EAAE,OAAO,CAAC,CAuBlD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/client",
|
|
3
|
-
"version": "11.0.0-alpha-tmp-issues-6374.
|
|
3
|
+
"version": "11.0.0-alpha-tmp-issues-6374.697+41465ba29",
|
|
4
4
|
"description": "The tRPC client library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -77,11 +77,11 @@
|
|
|
77
77
|
"!**/__tests__"
|
|
78
78
|
],
|
|
79
79
|
"peerDependencies": {
|
|
80
|
-
"@trpc/server": "11.0.0-alpha-tmp-issues-6374.
|
|
80
|
+
"@trpc/server": "11.0.0-alpha-tmp-issues-6374.697+41465ba29",
|
|
81
81
|
"typescript": ">=5.7.2"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@trpc/server": "11.0.0-alpha-tmp-issues-6374.
|
|
84
|
+
"@trpc/server": "11.0.0-alpha-tmp-issues-6374.697+41465ba29",
|
|
85
85
|
"@types/isomorphic-fetch": "^0.0.39",
|
|
86
86
|
"@types/node": "^22.9.0",
|
|
87
87
|
"eslint": "^9.13.0",
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
"funding": [
|
|
100
100
|
"https://trpc.io/sponsor"
|
|
101
101
|
],
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "41465ba29ad50fa0a28146f8d8fb85cde796c562"
|
|
103
103
|
}
|
package/src/createTRPCClient.ts
CHANGED
|
@@ -26,6 +26,11 @@ import {
|
|
|
26
26
|
} from './internals/TRPCUntypedClient';
|
|
27
27
|
import type { TRPCClientError } from './TRPCClientError';
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
const trpcClientSymbol = Symbol();
|
|
33
|
+
|
|
29
34
|
/**
|
|
30
35
|
* @public
|
|
31
36
|
*/
|
|
@@ -33,7 +38,7 @@ export type TRPCClient<TRouter extends AnyRouter> = DecoratedProcedureRecord<
|
|
|
33
38
|
TRouter,
|
|
34
39
|
TRouter['_def']['record']
|
|
35
40
|
> & {
|
|
36
|
-
[
|
|
41
|
+
[trpcClientSymbol]: true;
|
|
37
42
|
};
|
|
38
43
|
|
|
39
44
|
/**
|
|
@@ -178,7 +183,17 @@ export function createTRPCClient<TRouter extends AnyRouter>(
|
|
|
178
183
|
* @internal
|
|
179
184
|
*/
|
|
180
185
|
export function getUntypedClient<TRouter extends AnyRouter>(
|
|
181
|
-
client: TRPCClient<TRouter>,
|
|
182
|
-
): TRPCUntypedClient<
|
|
183
|
-
|
|
186
|
+
client: TRPCClient<TRouter> | TRPCUntypedClient<TRouter>,
|
|
187
|
+
): TRPCUntypedClient<{
|
|
188
|
+
errorShape: TRouter['_def']['_config']['$types']['errorShape'];
|
|
189
|
+
transformer: TRouter['_def']['_config']['$types']['transformer'];
|
|
190
|
+
}> {
|
|
191
|
+
// Note: don't use `instanceof TRPCUntypedClient` as it won't work if @trpc/client isn't hoisted
|
|
192
|
+
if ((client as any)[untypedClientSymbol]) {
|
|
193
|
+
return (client as any)[untypedClientSymbol];
|
|
194
|
+
}
|
|
195
|
+
return client as TRPCUntypedClient<{
|
|
196
|
+
errorShape: TRouter['_def']['_config']['$types']['errorShape'];
|
|
197
|
+
transformer: TRouter['_def']['_config']['$types']['transformer'];
|
|
198
|
+
}>;
|
|
184
199
|
}
|
|
@@ -55,12 +55,12 @@ export type UntypedClientProperties =
|
|
|
55
55
|
| 'runtime'
|
|
56
56
|
| 'subscription';
|
|
57
57
|
|
|
58
|
-
export class TRPCUntypedClient<
|
|
59
|
-
private readonly links: OperationLink<
|
|
58
|
+
export class TRPCUntypedClient<TInferrable extends InferrableClientTypes> {
|
|
59
|
+
private readonly links: OperationLink<TInferrable>[];
|
|
60
60
|
public readonly runtime: TRPCClientRuntime;
|
|
61
61
|
private requestId: number;
|
|
62
62
|
|
|
63
|
-
constructor(opts: CreateTRPCClientOptions<
|
|
63
|
+
constructor(opts: CreateTRPCClientOptions<TInferrable>) {
|
|
64
64
|
this.requestId = 0;
|
|
65
65
|
|
|
66
66
|
this.runtime = {};
|
|
@@ -76,8 +76,8 @@ export class TRPCUntypedClient<TRouter extends AnyRouter> {
|
|
|
76
76
|
context?: OperationContext;
|
|
77
77
|
signal: Maybe<AbortSignal>;
|
|
78
78
|
}) {
|
|
79
|
-
const chain$ = createChain<
|
|
80
|
-
links: this.links as OperationLink<
|
|
79
|
+
const chain$ = createChain<TInferrable, TInput, TOutput>({
|
|
80
|
+
links: this.links as OperationLink<TInferrable, TInput, TOutput>[],
|
|
81
81
|
op: {
|
|
82
82
|
...opts,
|
|
83
83
|
context: opts.context ?? {},
|
|
@@ -99,7 +99,8 @@ export class TRPCUntypedClient<TRouter extends AnyRouter> {
|
|
|
99
99
|
type TValue = inferObservableValue<typeof req$>;
|
|
100
100
|
|
|
101
101
|
const envelope = await observableToPromise<TValue>(req$);
|
|
102
|
-
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
103
|
+
const data = envelope.result.data!;
|
|
103
104
|
return data;
|
|
104
105
|
} catch (err) {
|
|
105
106
|
throw TRPCClientError.from(err as Error);
|
|
@@ -172,4 +173,4 @@ export class TRPCUntypedClient<TRouter extends AnyRouter> {
|
|
|
172
173
|
}
|
|
173
174
|
}
|
|
174
175
|
|
|
175
|
-
export const untypedClientSymbol =
|
|
176
|
+
export const untypedClientSymbol = '__internal_untypedClient';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { observable } from '@trpc/server/observable';
|
|
2
|
-
import type {
|
|
2
|
+
import type { InferrableClientTypes } from '@trpc/server/unstable-core-do-not-import';
|
|
3
3
|
import type {
|
|
4
4
|
Operation,
|
|
5
5
|
OperationLink,
|
|
@@ -8,13 +8,13 @@ import type {
|
|
|
8
8
|
|
|
9
9
|
/** @internal */
|
|
10
10
|
export function createChain<
|
|
11
|
-
|
|
11
|
+
TInferrable extends InferrableClientTypes,
|
|
12
12
|
TInput = unknown,
|
|
13
13
|
TOutput = unknown,
|
|
14
14
|
>(opts: {
|
|
15
|
-
links: OperationLink<
|
|
15
|
+
links: OperationLink<TInferrable, TInput, TOutput>[];
|
|
16
16
|
op: Operation<TInput>;
|
|
17
|
-
}): OperationResultObservable<
|
|
17
|
+
}): OperationResultObservable<TInferrable, TOutput> {
|
|
18
18
|
return observable((observer) => {
|
|
19
19
|
function execute(index = 0, op = opts.op) {
|
|
20
20
|
const next = opts.links[index];
|