@trpc/client 11.0.0-next-beta.264 → 11.0.0-next-beta.272
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/TRPCClientError.d.ts +3 -1
- package/dist/TRPCClientError.d.ts.map +1 -1
- package/dist/bundle-analysis.json +12 -12
- package/dist/createTRPCClient.d.ts +21 -10
- package/dist/createTRPCClient.d.ts.map +1 -1
- package/dist/internals/transformer.d.ts +2 -2
- package/dist/internals/transformer.d.ts.map +1 -1
- package/dist/links/HTTPBatchLinkOptions.d.ts +2 -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 +1 -1
- package/dist/links/httpBatchStreamLink.d.ts.map +1 -1
- package/dist/links/internals/createHTTPBatchLink.d.ts +2 -2
- package/dist/links/internals/createHTTPBatchLink.d.ts.map +1 -1
- package/dist/links/wsLink.d.ts +2 -2
- package/dist/links/wsLink.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/TRPCClientError.ts +3 -1
- package/src/createTRPCClient.ts +34 -29
- package/src/internals/transformer.ts +2 -2
- package/src/links/HTTPBatchLinkOptions.ts +2 -2
- package/src/links/internals/createHTTPBatchLink.ts +2 -2
- package/src/links/wsLink.ts +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { inferClientTypes, InferrableClientTypes, Maybe, TRPCErrorResponse } from '@trpc/server/unstable-core-do-not-import';
|
|
2
2
|
import { type DefaultErrorShape } from '@trpc/server/unstable-core-do-not-import';
|
|
3
|
+
type inferErrorShape<TInferrable extends InferrableClientTypes> = inferClientTypes<TInferrable>['errorShape'];
|
|
3
4
|
export interface TRPCClientErrorBase<TShape extends DefaultErrorShape> {
|
|
4
5
|
readonly message: string;
|
|
5
6
|
readonly shape: Maybe<TShape>;
|
|
@@ -24,4 +25,5 @@ export declare class TRPCClientError<TRouterOrProcedure extends InferrableClient
|
|
|
24
25
|
meta?: Record<string, unknown>;
|
|
25
26
|
}): TRPCClientError<TRouterOrProcedure>;
|
|
26
27
|
}
|
|
28
|
+
export {};
|
|
27
29
|
//# sourceMappingURL=TRPCClientError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TRPCClientError.d.ts","sourceRoot":"","sources":["../src/TRPCClientError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"TRPCClientError.d.ts","sourceRoot":"","sources":["../src/TRPCClientError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,EACL,iBAAiB,EAClB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,0CAA0C,CAAC;AAElD,KAAK,eAAe,CAAC,WAAW,SAAS,qBAAqB,IAC5D,gBAAgB,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,CAAC;AAC9C,MAAM,WAAW,mBAAmB,CAAC,MAAM,SAAS,iBAAiB;IACnE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;CACtC;AACD,MAAM,MAAM,mBAAmB,CAAC,WAAW,SAAS,qBAAqB,IACvE,mBAAmB,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC;AAsBpD,qBAAa,eAAe,CAAC,kBAAkB,SAAS,qBAAqB,CAC3E,SAAQ,KACR,YAAW,mBAAmB,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;IAInE,SAAyB,KAAK,oBAAC;IAC/B,SAAgB,KAAK,EAAE,KAAK,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAClE,SAAgB,IAAI,EAAE,KAAK,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAEzE;;;OAGG;IACI,IAAI,sCAAC;gBAGV,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE;QACL,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;QACvE,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChC;WAkBW,IAAI,CAAC,kBAAkB,SAAS,qBAAqB,EACjE,MAAM,EAAE,KAAK,GAAG,iBAAiB,CAAC,GAAG,CAAC,EACtC,IAAI,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAO,GAC5C,eAAe,CAAC,kBAAkB,CAAC;CA+BvC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"bundleSize": 46573,
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 28.
|
|
3
|
+
"bundleOrigSize": 65514,
|
|
4
|
+
"bundleReduction": 28.91,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/links/wsLink.ts",
|
|
8
8
|
"size": 12058,
|
|
9
|
-
"origSize":
|
|
9
|
+
"origSize": 13652,
|
|
10
10
|
"renderedExports": [
|
|
11
11
|
"createWSClient",
|
|
12
12
|
"wsLink"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"removedExports": [],
|
|
15
15
|
"dependents": [],
|
|
16
16
|
"percent": 25.89,
|
|
17
|
-
"reduction": 11.
|
|
17
|
+
"reduction": 11.68
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
"id": "/src/links/loggerLink.ts",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
{
|
|
84
84
|
"id": "/src/links/internals/createHTTPBatchLink.ts",
|
|
85
85
|
"size": 2944,
|
|
86
|
-
"origSize":
|
|
86
|
+
"origSize": 3711,
|
|
87
87
|
"renderedExports": [
|
|
88
88
|
"createHTTPBatchLink"
|
|
89
89
|
],
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"/src/links/httpBatchStreamLink.ts"
|
|
94
94
|
],
|
|
95
95
|
"percent": 6.32,
|
|
96
|
-
"reduction": 20.
|
|
96
|
+
"reduction": 20.67
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
99
|
"id": "/src/internals/TRPCUntypedClient.ts",
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
{
|
|
129
129
|
"id": "/src/TRPCClientError.ts",
|
|
130
130
|
"size": 1866,
|
|
131
|
-
"origSize":
|
|
131
|
+
"origSize": 3437,
|
|
132
132
|
"renderedExports": [
|
|
133
133
|
"TRPCClientError"
|
|
134
134
|
],
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
"/src/links/internals/httpUtils.ts"
|
|
143
143
|
],
|
|
144
144
|
"percent": 4.01,
|
|
145
|
-
"reduction":
|
|
145
|
+
"reduction": 45.71
|
|
146
146
|
},
|
|
147
147
|
{
|
|
148
148
|
"id": "/src/links/httpBatchStreamLink.ts",
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
{
|
|
160
160
|
"id": "/src/createTRPCClient.ts",
|
|
161
161
|
"size": 1206,
|
|
162
|
-
"origSize":
|
|
162
|
+
"origSize": 4369,
|
|
163
163
|
"renderedExports": [
|
|
164
164
|
"clientCallTypeToProcedureType",
|
|
165
165
|
"createTRPCClientProxy",
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
"/src/index.ts"
|
|
172
172
|
],
|
|
173
173
|
"percent": 2.59,
|
|
174
|
-
"reduction": 72.
|
|
174
|
+
"reduction": 72.4
|
|
175
175
|
},
|
|
176
176
|
{
|
|
177
177
|
"id": "/src/links/httpBatchLink.ts",
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
{
|
|
228
228
|
"id": "/src/internals/transformer.ts",
|
|
229
229
|
"size": 565,
|
|
230
|
-
"origSize":
|
|
230
|
+
"origSize": 1699,
|
|
231
231
|
"renderedExports": [
|
|
232
232
|
"getTransformer"
|
|
233
233
|
],
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
"/src/unstable-internals.ts"
|
|
237
237
|
],
|
|
238
238
|
"percent": 1.21,
|
|
239
|
-
"reduction": 66.
|
|
239
|
+
"reduction": 66.75
|
|
240
240
|
},
|
|
241
241
|
{
|
|
242
242
|
"id": "/src/links/internals/getTextDecoder.ts",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Unsubscribable } from '@trpc/server/observable';
|
|
2
|
-
import type {
|
|
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
5
|
import { TRPCUntypedClient } from './internals/TRPCUntypedClient';
|
|
@@ -8,21 +8,32 @@ import type { TRPCClientError } from './TRPCClientError';
|
|
|
8
8
|
* @public
|
|
9
9
|
**/
|
|
10
10
|
export type inferRouterClient<TRouter extends AnyRouter> = DecoratedProcedureRecord<TRouter, TRouter['_def']['record']>;
|
|
11
|
+
type ResolverDef = {
|
|
12
|
+
input: any;
|
|
13
|
+
output: any;
|
|
14
|
+
transformer: boolean;
|
|
15
|
+
errorShape: any;
|
|
16
|
+
};
|
|
11
17
|
/** @internal */
|
|
12
|
-
export type Resolver<
|
|
13
|
-
type SubscriptionResolver<
|
|
14
|
-
type DecorateProcedure<
|
|
15
|
-
query: Resolver<
|
|
16
|
-
} :
|
|
17
|
-
mutate: Resolver<
|
|
18
|
-
} :
|
|
19
|
-
subscribe: SubscriptionResolver<
|
|
18
|
+
export type Resolver<TDef extends ResolverDef> = (input: TDef['input'], opts?: ProcedureOptions) => Promise<TDef['output']>;
|
|
19
|
+
type SubscriptionResolver<TDef extends ResolverDef> = (input: TDef['input'], opts?: Partial<TRPCSubscriptionObserver<TDef['output'], TRPCClientError<TDef>>> & ProcedureOptions) => Unsubscribable;
|
|
20
|
+
type DecorateProcedure<TType extends ProcedureType, TDef extends ResolverDef> = TType extends 'query' ? {
|
|
21
|
+
query: Resolver<TDef>;
|
|
22
|
+
} : TType extends 'mutation' ? {
|
|
23
|
+
mutate: Resolver<TDef>;
|
|
24
|
+
} : TType extends 'subscription' ? {
|
|
25
|
+
subscribe: SubscriptionResolver<TDef>;
|
|
20
26
|
} : never;
|
|
21
27
|
/**
|
|
22
28
|
* @internal
|
|
23
29
|
*/
|
|
24
30
|
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
|
|
31
|
+
[TKey in keyof TRecord]: TRecord[TKey] extends infer $Value ? $Value extends RouterRecord ? DecoratedProcedureRecord<TRouter, $Value> : $Value extends AnyProcedure ? DecorateProcedure<$Value['_def']['type'], {
|
|
32
|
+
input: inferProcedureInput<$Value>;
|
|
33
|
+
output: inferTransformedProcedureOutput<inferClientTypes<TRouter>, $Value>;
|
|
34
|
+
errorShape: inferClientTypes<TRouter>['errorShape'];
|
|
35
|
+
transformer: inferClientTypes<TRouter>['transformer'];
|
|
36
|
+
}> : never : never;
|
|
26
37
|
};
|
|
27
38
|
/** @internal */
|
|
28
39
|
export declare const clientCallTypeToProcedureType: (clientCallType: string) => ProcedureType;
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"createTRPCClient.d.ts","sourceRoot":"","sources":["../src/createTRPCClient.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AnyClientTypes, CombinedDataTransformer, DataTransformerOptions, TypeError } from '@trpc/server/unstable-core-do-not-import';
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
@@ -26,7 +26,7 @@ type TransformerOptionNo = {
|
|
|
26
26
|
/**
|
|
27
27
|
* @internal
|
|
28
28
|
*/
|
|
29
|
-
export type TransformerOptions<TRoot extends Pick<
|
|
29
|
+
export type TransformerOptions<TRoot extends Pick<AnyClientTypes, 'transformer'>> = TRoot['transformer'] extends true ? TransformerOptionYes : TransformerOptionNo;
|
|
30
30
|
/**
|
|
31
31
|
* @internal
|
|
32
32
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformer.d.ts","sourceRoot":"","sources":["../../src/internals/transformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"transformer.d.ts","sourceRoot":"","sources":["../../src/internals/transformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,uBAAuB,EACvB,sBAAsB,EACtB,SAAS,EACV,MAAM,0CAA0C,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC,WAAW,CAAC,EAAE,sBAAsB,CAAC;CACtC,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B;;;;;QAKI;IACJ,WAAW,EAAE,sBAAsB,CAAC;CACrC,CAAC;AACF,KAAK,mBAAmB,GAAG;IACzB;;;;;QAKI;IACJ,WAAW,CAAC,EAAE,SAAS,CAAC,oEAAoE,CAAC,CAAC;CAC/F,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAC5B,KAAK,SAAS,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,IAC/C,KAAK,CAAC,aAAa,CAAC,SAAS,IAAI,GACjC,oBAAoB,GACpB,mBAAmB,CAAC;AACxB;;GAEG;AAEH;;GAEG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EACP,kBAAkB,CAAC;IAAE,WAAW,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC,aAAa,CAAC,GACzD,kBAAkB,CAAC;IAAE,WAAW,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC,aAAa,CAAC,GACxD,SAAS,GACZ,uBAAuB,CAsBzB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AnyClientTypes } from '@trpc/server/unstable-core-do-not-import';
|
|
2
2
|
import type { NonEmptyArray } from '../internals/types';
|
|
3
3
|
import type { HTTPLinkBaseOptions } from './internals/httpUtils';
|
|
4
4
|
import type { HTTPHeaders, Operation } from './types';
|
|
5
|
-
export type HTTPBatchLinkOptions<TRoot extends
|
|
5
|
+
export type HTTPBatchLinkOptions<TRoot extends AnyClientTypes> = HTTPLinkBaseOptions<TRoot> & {
|
|
6
6
|
maxURLLength?: number;
|
|
7
7
|
/**
|
|
8
8
|
* Headers to be set on outgoing requests or a callback that of said headers
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HTTPBatchLinkOptions.d.ts","sourceRoot":"","sources":["../../src/links/HTTPBatchLinkOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
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;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("@trpc/server/unstable-core-do-not-import").
|
|
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").inferClientTypes<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":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAgDnE,eAAO,MAAM,aAAa
|
|
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,iOAAsC,CAAC"}
|
|
@@ -9,5 +9,5 @@ export type HTTPBatchStreamLinkOptions<TRoot extends AnyRootTypes> = HTTPBatchLi
|
|
|
9
9
|
*/
|
|
10
10
|
textDecoder?: TextDecoderEsque;
|
|
11
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").
|
|
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").inferClientTypes<TRouter>>) => import("./types").TRPCLink<TRouter>;
|
|
13
13
|
//# sourceMappingURL=httpBatchStreamLink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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,iOACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnyRootTypes, AnyRouter,
|
|
1
|
+
import type { AnyRootTypes, AnyRouter, inferClientTypes, 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';
|
|
@@ -16,5 +16,5 @@ export type RequesterFn<TOptions extends HTTPBatchLinkOptions<AnyRootTypes>> = (
|
|
|
16
16
|
/**
|
|
17
17
|
* @internal
|
|
18
18
|
*/
|
|
19
|
-
export declare function createHTTPBatchLink(requester: RequesterFn<HTTPBatchLinkOptions<AnyRootTypes>>): <TRouter extends AnyRouter>(opts: HTTPBatchLinkOptions<
|
|
19
|
+
export declare function createHTTPBatchLink(requester: RequesterFn<HTTPBatchLinkOptions<AnyRootTypes>>): <TRouter extends AnyRouter>(opts: HTTPBatchLinkOptions<inferClientTypes<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,YAAY,EACZ,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"createHTTPBatchLink.d.ts","sourceRoot":"","sources":["../../../src/links/internals/createHTTPBatchLink.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,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,2GA2F3D"}
|
package/dist/links/wsLink.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Observer, UnsubscribeFn } from '@trpc/server/observable';
|
|
2
|
-
import type { AnyRouter,
|
|
2
|
+
import type { AnyRouter, inferClientTypes, inferRouterError, MaybePromise, TRPCResponseMessage } from '@trpc/server/unstable-core-do-not-import';
|
|
3
3
|
import { TRPCClientError } from '../TRPCClientError';
|
|
4
4
|
import type { TransformerOptions } from '../unstable-internals';
|
|
5
5
|
import type { Operation, TRPCLink } from './types';
|
|
@@ -65,7 +65,7 @@ export declare function createWSClient(opts: WebSocketClientOptions): {
|
|
|
65
65
|
export type TRPCWebSocketClient = ReturnType<typeof createWSClient>;
|
|
66
66
|
export type WebSocketLinkOptions<TRouter extends AnyRouter> = {
|
|
67
67
|
client: TRPCWebSocketClient;
|
|
68
|
-
} & TransformerOptions<
|
|
68
|
+
} & TransformerOptions<inferClientTypes<TRouter>>;
|
|
69
69
|
/**
|
|
70
70
|
* @link https://trpc.io/docs/v11/client/links/wsLink
|
|
71
71
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wsLink.d.ts","sourceRoot":"","sources":["../../src/links/wsLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,KAAK,EACV,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"wsLink.d.ts","sourceRoot":"","sources":["../../src/links/wsLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EAMZ,mBAAmB,EACpB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAInD,KAAK,gBAAgB,CAAC,OAAO,SAAS,SAAS,EAAE,OAAO,IAAI,mBAAmB,CAC7E,OAAO,EACP,gBAAgB,CAAC,OAAO,CAAC,CAC1B,CAAC;AAEF,KAAK,kBAAkB,CAAC,OAAO,SAAS,SAAS,EAAE,OAAO,IAAI,QAAQ,CACpE,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,EAClC,eAAe,CAAC,OAAO,CAAC,CACzB,CAAC;AAEF,QAAA,MAAM,kBAAkB,iBAAkB,MAAM,WACoB,CAAC;AAErE,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,GAAG,EAAE,MAAM,GAAG,CAAC,MAAM,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3C;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,SAAS,CAAC;IAC7B;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,kBAAkB,CAAC;IACzC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC9C;;OAEG;IACH,IAAI,CAAC,EAAE;QACL;;;WAGG;QACH,OAAO,EAAE,OAAO,CAAC;QACjB;;;WAGG;QACH,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAOD,wBAAgB,cAAc,CAAC,IAAI,EAAE,sBAAsB;;kBAgSpC,SAAS,wDAA0B,aAAa;;YAhP/D,MAAM;;eAGC,MAAM;YACT,SAAS;;eAGN,QAAQ;YACX,SAAS;;eAGN,YAAY;;;EAqS1B;AACD,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAEpE,MAAM,MAAM,oBAAoB,CAAC,OAAO,SAAS,SAAS,IAAI;IAC5D,MAAM,EAAE,mBAAmB,CAAC;CAC7B,GAAG,kBAAkB,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;AASlD;;GAEG;AACH,wBAAgB,MAAM,CAAC,OAAO,SAAS,SAAS,EAC9C,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAClC,QAAQ,CAAC,OAAO,CAAC,CA8CnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/client",
|
|
3
|
-
"version": "11.0.0-next-beta.
|
|
3
|
+
"version": "11.0.0-next-beta.272+765a5e71a",
|
|
4
4
|
"description": "The tRPC client library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -76,11 +76,11 @@
|
|
|
76
76
|
"!**/*.test.*"
|
|
77
77
|
],
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"@trpc/server": "11.0.0-next-beta.
|
|
79
|
+
"@trpc/server": "11.0.0-next-beta.272+765a5e71a"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@testing-library/dom": "^9.0.0",
|
|
83
|
-
"@trpc/server": "11.0.0-next-beta.
|
|
83
|
+
"@trpc/server": "11.0.0-next-beta.272+765a5e71a",
|
|
84
84
|
"@types/isomorphic-fetch": "^0.0.39",
|
|
85
85
|
"@types/node": "^20.10.0",
|
|
86
86
|
"eslint": "^8.40.0",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"funding": [
|
|
98
98
|
"https://trpc.io/sponsor"
|
|
99
99
|
],
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "765a5e71a5b84d54d6275ec93e4314d43feb10cf"
|
|
101
101
|
}
|
package/src/TRPCClientError.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
2
|
+
inferClientTypes,
|
|
3
3
|
InferrableClientTypes,
|
|
4
4
|
Maybe,
|
|
5
5
|
TRPCErrorResponse,
|
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
type DefaultErrorShape,
|
|
11
11
|
} from '@trpc/server/unstable-core-do-not-import';
|
|
12
12
|
|
|
13
|
+
type inferErrorShape<TInferrable extends InferrableClientTypes> =
|
|
14
|
+
inferClientTypes<TInferrable>['errorShape'];
|
|
13
15
|
export interface TRPCClientErrorBase<TShape extends DefaultErrorShape> {
|
|
14
16
|
readonly message: string;
|
|
15
17
|
readonly shape: Maybe<TShape>;
|
package/src/createTRPCClient.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
2
|
import type { Unsubscribable } from '@trpc/server/observable';
|
|
3
3
|
import type {
|
|
4
|
-
AnyClientRootTypes,
|
|
5
|
-
AnyMutationProcedure,
|
|
6
4
|
AnyProcedure,
|
|
7
|
-
AnyQueryProcedure,
|
|
8
5
|
AnyRouter,
|
|
9
|
-
|
|
6
|
+
inferClientTypes,
|
|
10
7
|
inferProcedureInput,
|
|
11
8
|
inferTransformedProcedureOutput,
|
|
12
|
-
inferTransformedSubscriptionOutput,
|
|
13
9
|
IntersectionError,
|
|
14
10
|
ProcedureOptions,
|
|
15
11
|
ProcedureType,
|
|
@@ -33,43 +29,41 @@ import type { TRPCClientError } from './TRPCClientError';
|
|
|
33
29
|
export type inferRouterClient<TRouter extends AnyRouter> =
|
|
34
30
|
DecoratedProcedureRecord<TRouter, TRouter['_def']['record']>;
|
|
35
31
|
|
|
32
|
+
type ResolverDef = {
|
|
33
|
+
input: any;
|
|
34
|
+
output: any;
|
|
35
|
+
transformer: boolean;
|
|
36
|
+
errorShape: any;
|
|
37
|
+
};
|
|
38
|
+
|
|
36
39
|
/** @internal */
|
|
37
|
-
export type Resolver<
|
|
38
|
-
|
|
39
|
-
TProcedure extends AnyProcedure,
|
|
40
|
-
> = (
|
|
41
|
-
input: inferProcedureInput<TProcedure>,
|
|
40
|
+
export type Resolver<TDef extends ResolverDef> = (
|
|
41
|
+
input: TDef['input'],
|
|
42
42
|
opts?: ProcedureOptions,
|
|
43
|
-
) => Promise<
|
|
43
|
+
) => Promise<TDef['output']>;
|
|
44
44
|
|
|
45
|
-
type SubscriptionResolver<
|
|
46
|
-
|
|
47
|
-
TProcedure extends AnyProcedure,
|
|
48
|
-
> = (
|
|
49
|
-
input: inferProcedureInput<TProcedure>,
|
|
45
|
+
type SubscriptionResolver<TDef extends ResolverDef> = (
|
|
46
|
+
input: TDef['input'],
|
|
50
47
|
opts?: Partial<
|
|
51
|
-
TRPCSubscriptionObserver<
|
|
52
|
-
inferTransformedSubscriptionOutput<TRoot, TProcedure>,
|
|
53
|
-
TRPCClientError<TRoot>
|
|
54
|
-
>
|
|
48
|
+
TRPCSubscriptionObserver<TDef['output'], TRPCClientError<TDef>>
|
|
55
49
|
> &
|
|
56
50
|
ProcedureOptions,
|
|
57
51
|
) => Unsubscribable;
|
|
58
52
|
|
|
59
53
|
type DecorateProcedure<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
> =
|
|
54
|
+
TType extends ProcedureType,
|
|
55
|
+
TDef extends ResolverDef,
|
|
56
|
+
> = TType extends 'query'
|
|
63
57
|
? {
|
|
64
|
-
query: Resolver<
|
|
58
|
+
query: Resolver<TDef>;
|
|
65
59
|
}
|
|
66
|
-
:
|
|
60
|
+
: TType extends 'mutation'
|
|
67
61
|
? {
|
|
68
|
-
mutate: Resolver<
|
|
62
|
+
mutate: Resolver<TDef>;
|
|
69
63
|
}
|
|
70
|
-
:
|
|
64
|
+
: TType extends 'subscription'
|
|
71
65
|
? {
|
|
72
|
-
subscribe: SubscriptionResolver<
|
|
66
|
+
subscribe: SubscriptionResolver<TDef>;
|
|
73
67
|
}
|
|
74
68
|
: never;
|
|
75
69
|
|
|
@@ -84,7 +78,18 @@ type DecoratedProcedureRecord<
|
|
|
84
78
|
? $Value extends RouterRecord
|
|
85
79
|
? DecoratedProcedureRecord<TRouter, $Value>
|
|
86
80
|
: $Value extends AnyProcedure
|
|
87
|
-
? DecorateProcedure<
|
|
81
|
+
? DecorateProcedure<
|
|
82
|
+
$Value['_def']['type'],
|
|
83
|
+
{
|
|
84
|
+
input: inferProcedureInput<$Value>;
|
|
85
|
+
output: inferTransformedProcedureOutput<
|
|
86
|
+
inferClientTypes<TRouter>,
|
|
87
|
+
$Value
|
|
88
|
+
>;
|
|
89
|
+
errorShape: inferClientTypes<TRouter>['errorShape'];
|
|
90
|
+
transformer: inferClientTypes<TRouter>['transformer'];
|
|
91
|
+
}
|
|
92
|
+
>
|
|
88
93
|
: never
|
|
89
94
|
: never;
|
|
90
95
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
2
|
+
AnyClientTypes,
|
|
3
3
|
CombinedDataTransformer,
|
|
4
4
|
DataTransformerOptions,
|
|
5
5
|
TypeError,
|
|
@@ -35,7 +35,7 @@ type TransformerOptionNo = {
|
|
|
35
35
|
* @internal
|
|
36
36
|
*/
|
|
37
37
|
export type TransformerOptions<
|
|
38
|
-
TRoot extends Pick<
|
|
38
|
+
TRoot extends Pick<AnyClientTypes, 'transformer'>,
|
|
39
39
|
> = TRoot['transformer'] extends true
|
|
40
40
|
? TransformerOptionYes
|
|
41
41
|
: TransformerOptionNo;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AnyClientTypes } from '@trpc/server/unstable-core-do-not-import';
|
|
2
2
|
import type { NonEmptyArray } from '../internals/types';
|
|
3
3
|
import type { HTTPLinkBaseOptions } from './internals/httpUtils';
|
|
4
4
|
import type { HTTPHeaders, Operation } from './types';
|
|
5
5
|
|
|
6
|
-
export type HTTPBatchLinkOptions<TRoot extends
|
|
6
|
+
export type HTTPBatchLinkOptions<TRoot extends AnyClientTypes> =
|
|
7
7
|
HTTPLinkBaseOptions<TRoot> & {
|
|
8
8
|
maxURLLength?: number;
|
|
9
9
|
/**
|
|
@@ -2,7 +2,7 @@ import { observable } from '@trpc/server/observable';
|
|
|
2
2
|
import type {
|
|
3
3
|
AnyRootTypes,
|
|
4
4
|
AnyRouter,
|
|
5
|
-
|
|
5
|
+
inferClientTypes,
|
|
6
6
|
ProcedureType,
|
|
7
7
|
} from '@trpc/server/unstable-core-do-not-import';
|
|
8
8
|
import { transformResult } from '@trpc/server/unstable-core-do-not-import';
|
|
@@ -42,7 +42,7 @@ export function createHTTPBatchLink(
|
|
|
42
42
|
requester: RequesterFn<HTTPBatchLinkOptions<AnyRootTypes>>,
|
|
43
43
|
) {
|
|
44
44
|
return function httpBatchLink<TRouter extends AnyRouter>(
|
|
45
|
-
opts: HTTPBatchLinkOptions<
|
|
45
|
+
opts: HTTPBatchLinkOptions<inferClientTypes<TRouter>>,
|
|
46
46
|
): TRPCLink<TRouter> {
|
|
47
47
|
const resolvedOpts = resolveHTTPLinkOptions(opts);
|
|
48
48
|
const maxURLLength = opts.maxURLLength ?? Infinity;
|
package/src/links/wsLink.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Observer, UnsubscribeFn } from '@trpc/server/observable';
|
|
|
2
2
|
import { observable } from '@trpc/server/observable';
|
|
3
3
|
import type {
|
|
4
4
|
AnyRouter,
|
|
5
|
-
|
|
5
|
+
inferClientTypes,
|
|
6
6
|
inferRouterError,
|
|
7
7
|
MaybePromise,
|
|
8
8
|
ProcedureType,
|
|
@@ -434,7 +434,7 @@ export type TRPCWebSocketClient = ReturnType<typeof createWSClient>;
|
|
|
434
434
|
|
|
435
435
|
export type WebSocketLinkOptions<TRouter extends AnyRouter> = {
|
|
436
436
|
client: TRPCWebSocketClient;
|
|
437
|
-
} & TransformerOptions<
|
|
437
|
+
} & TransformerOptions<inferClientTypes<TRouter>>;
|
|
438
438
|
class TRPCWebSocketClosedError extends Error {
|
|
439
439
|
constructor(message: string) {
|
|
440
440
|
super(message);
|