@trpc/client 11.0.0-next.92 → 11.0.0-rc.329
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/README.md +4 -4
- package/dist/TRPCClientError.d.ts +8 -7
- package/dist/TRPCClientError.d.ts.map +1 -1
- package/dist/{TRPCClientError-e224e397.js → TRPCClientError.js} +3 -3
- package/dist/{TRPCClientError-0de4d231.mjs → TRPCClientError.mjs} +4 -4
- package/dist/bundle-analysis.json +126 -155
- package/dist/createTRPCClient.d.ts +27 -19
- package/dist/createTRPCClient.d.ts.map +1 -1
- package/dist/createTRPCClient.js +50 -0
- package/dist/createTRPCClient.mjs +45 -0
- package/dist/createTRPCUntypedClient.d.ts +3 -2
- package/dist/createTRPCUntypedClient.d.ts.map +1 -1
- package/dist/createTRPCUntypedClient.js +10 -0
- package/dist/createTRPCUntypedClient.mjs +7 -0
- package/dist/getFetch.d.ts +1 -1
- package/dist/getFetch.d.ts.map +1 -1
- package/dist/getFetch.js +17 -0
- package/dist/getFetch.mjs +15 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -370
- package/dist/index.mjs +9 -354
- package/dist/internals/TRPCUntypedClient.d.ts +5 -30
- package/dist/internals/TRPCUntypedClient.d.ts.map +1 -1
- package/dist/internals/TRPCUntypedClient.js +85 -0
- package/dist/internals/TRPCUntypedClient.mjs +83 -0
- package/dist/internals/dataLoader.d.ts +1 -1
- package/dist/internals/dataLoader.d.ts.map +1 -1
- package/dist/{httpBatchLink-204206a5.mjs → internals/dataLoader.js} +2 -117
- package/dist/internals/dataLoader.mjs +131 -0
- package/dist/internals/getAbortController.d.ts +2 -2
- package/dist/internals/getAbortController.d.ts.map +1 -1
- package/dist/internals/getAbortController.js +18 -0
- package/dist/internals/getAbortController.mjs +16 -0
- package/dist/internals/transformer.d.ts +42 -0
- package/dist/internals/transformer.d.ts.map +1 -0
- package/dist/internals/transformer.js +30 -0
- package/dist/internals/transformer.mjs +28 -0
- package/dist/internals/types.d.ts +4 -2
- package/dist/internals/types.d.ts.map +1 -1
- package/dist/links/HTTPBatchLinkOptions.d.ts +6 -5
- package/dist/links/HTTPBatchLinkOptions.d.ts.map +1 -1
- package/dist/links/httpBatchLink.d.ts +2 -2
- package/dist/links/httpBatchLink.d.ts.map +1 -1
- package/dist/links/httpBatchLink.js +37 -9
- package/dist/links/httpBatchLink.mjs +39 -5
- package/dist/links/httpBatchStreamLink.d.ts +6 -5
- package/dist/links/httpBatchStreamLink.d.ts.map +1 -1
- package/dist/links/httpBatchStreamLink.js +43 -0
- package/dist/links/httpBatchStreamLink.mjs +41 -0
- package/dist/links/httpFormDataLink.d.ts +1 -1
- package/dist/links/httpFormDataLink.d.ts.map +1 -1
- package/dist/links/httpFormDataLink.js +31 -0
- package/dist/links/httpFormDataLink.mjs +29 -0
- package/dist/links/httpLink.d.ts +8 -8
- package/dist/links/httpLink.d.ts.map +1 -1
- package/dist/links/httpLink.js +6 -9
- package/dist/links/httpLink.mjs +6 -7
- package/dist/links/internals/createChain.d.ts +2 -2
- package/dist/links/internals/createChain.d.ts.map +1 -1
- package/dist/{splitLink-f29e84be.js → links/internals/createChain.js} +0 -22
- package/dist/{splitLink-4c75f7be.mjs → links/internals/createChain.mjs} +1 -22
- package/dist/links/internals/createHTTPBatchLink.d.ts +6 -6
- package/dist/links/internals/createHTTPBatchLink.d.ts.map +1 -1
- package/dist/links/internals/createHTTPBatchLink.js +85 -0
- package/dist/links/internals/createHTTPBatchLink.mjs +83 -0
- package/dist/links/internals/dedupeLink.d.ts +2 -2
- package/dist/links/internals/dedupeLink.d.ts.map +1 -1
- package/dist/links/internals/getTextDecoder.d.ts +1 -1
- package/dist/links/internals/getTextDecoder.d.ts.map +1 -1
- package/dist/links/internals/getTextDecoder.js +18 -0
- package/dist/links/internals/getTextDecoder.mjs +16 -0
- package/dist/links/internals/httpUtils.d.ts +19 -11
- package/dist/links/internals/httpUtils.d.ts.map +1 -1
- package/dist/{httpUtils-c0e7bf5a.js → links/internals/httpUtils.js} +20 -39
- package/dist/{httpUtils-f58ceda1.mjs → links/internals/httpUtils.mjs} +20 -38
- package/dist/links/internals/parseJSONStream.d.ts +5 -6
- package/dist/links/internals/parseJSONStream.d.ts.map +1 -1
- package/dist/links/internals/parseJSONStream.js +118 -0
- package/dist/links/internals/parseJSONStream.mjs +115 -0
- package/dist/links/internals/retryLink.d.ts +2 -2
- package/dist/links/internals/retryLink.d.ts.map +1 -1
- package/dist/links/loggerLink.d.ts +4 -4
- package/dist/links/loggerLink.d.ts.map +1 -1
- package/dist/links/loggerLink.js +6 -4
- package/dist/links/loggerLink.mjs +6 -2
- package/dist/links/splitLink.d.ts +2 -2
- package/dist/links/splitLink.d.ts.map +1 -1
- package/dist/links/splitLink.js +23 -6
- package/dist/links/splitLink.mjs +25 -2
- package/dist/links/types.d.ts +15 -14
- package/dist/links/types.d.ts.map +1 -1
- package/dist/links/wsLink.d.ts +44 -13
- package/dist/links/wsLink.d.ts.map +1 -1
- package/dist/links/wsLink.js +64 -24
- package/dist/links/wsLink.mjs +64 -22
- package/dist/links.d.ts +10 -0
- package/dist/links.d.ts.map +1 -0
- package/dist/unstable-internals.d.ts +2 -0
- package/dist/unstable-internals.d.ts.map +1 -0
- package/dist/unstable-internals.js +7 -0
- package/dist/unstable-internals.mjs +1 -0
- package/package.json +26 -28
- package/src/TRPCClientError.ts +24 -13
- package/src/createTRPCClient.ts +58 -51
- package/src/createTRPCUntypedClient.ts +3 -5
- package/src/getFetch.ts +1 -1
- package/src/index.ts +2 -0
- package/src/internals/TRPCUntypedClient.ts +14 -84
- package/src/internals/dataLoader.ts +1 -1
- package/src/internals/getAbortController.ts +2 -2
- package/src/internals/transformer.ts +76 -0
- package/src/internals/types.ts +8 -1
- package/src/links/HTTPBatchLinkOptions.ts +17 -15
- package/src/links/httpBatchLink.ts +9 -8
- package/src/links/httpBatchStreamLink.ts +17 -17
- package/src/links/httpFormDataLink.ts +11 -12
- package/src/links/httpLink.ts +27 -19
- package/src/links/internals/createChain.ts +6 -2
- package/src/links/internals/createHTTPBatchLink.ts +24 -16
- package/src/links/internals/dedupeLink.ts +4 -3
- package/src/links/internals/getTextDecoder.ts +1 -1
- package/src/links/internals/httpUtils.ts +42 -21
- package/src/links/internals/parseJSONStream.ts +12 -14
- package/src/links/internals/retryLink.ts +4 -3
- package/src/links/loggerLink.ts +5 -5
- package/src/links/splitLink.ts +2 -2
- package/src/links/types.ts +27 -22
- package/src/links/wsLink.ts +124 -36
- package/src/links.ts +14 -0
- package/src/unstable-internals.ts +1 -0
- package/unstable-internals/index.d.ts +1 -0
- package/unstable-internals/index.js +1 -0
- package/dist/TRPCClientError-23c8aa93.js +0 -61
- package/dist/httpBatchLink-64fceaac.js +0 -251
- package/dist/httpBatchLink-92dab48e.js +0 -247
- package/dist/httpUtils-35e50476.js +0 -145
- package/dist/internals/isObject.d.ts +0 -2
- package/dist/internals/isObject.d.ts.map +0 -1
- package/dist/internals/retryDelay.d.ts +0 -2
- package/dist/internals/retryDelay.d.ts.map +0 -1
- package/dist/links/index.d.ts +0 -10
- package/dist/links/index.d.ts.map +0 -1
- package/dist/shared/index.d.ts +0 -2
- package/dist/shared/index.d.ts.map +0 -1
- package/dist/shared/index.js +0 -9
- package/dist/shared/index.mjs +0 -1
- package/dist/shared/transformResult.d.ts +0 -34
- package/dist/shared/transformResult.d.ts.map +0 -1
- package/dist/splitLink-0df96fdc.js +0 -41
- package/dist/transformResult-ace864b8.mjs +0 -58
- package/dist/transformResult-c1422cb5.js +0 -60
- package/dist/transformResult-dfce8f15.js +0 -61
- package/shared/index.d.ts +0 -1
- package/shared/index.js +0 -1
- package/src/internals/isObject.ts +0 -4
- package/src/internals/retryDelay.ts +0 -3
- package/src/links/index.ts +0 -14
- package/src/shared/index.ts +0 -1
- package/src/shared/transformResult.ts +0 -79
package/README.md
CHANGED
|
@@ -24,16 +24,16 @@ Full documentation for `@trpc/client` can be found [here](https://trpc.io/docs/v
|
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
26
|
# npm
|
|
27
|
-
npm install @trpc/client
|
|
27
|
+
npm install @trpc/client@next
|
|
28
28
|
|
|
29
29
|
# Yarn
|
|
30
|
-
yarn add @trpc/client
|
|
30
|
+
yarn add @trpc/client@next
|
|
31
31
|
|
|
32
32
|
# pnpm
|
|
33
|
-
pnpm add @trpc/client
|
|
33
|
+
pnpm add @trpc/client@next
|
|
34
34
|
|
|
35
35
|
# Bun
|
|
36
|
-
bun add @trpc/client
|
|
36
|
+
bun add @trpc/client@next
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
## Basic Example
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import type { inferClientTypes, InferrableClientTypes, Maybe, TRPCErrorResponse } from '@trpc/server/unstable-core-do-not-import';
|
|
2
|
+
import { type DefaultErrorShape } from '@trpc/server/unstable-core-do-not-import';
|
|
3
|
+
type inferErrorShape<TInferrable extends InferrableClientTypes> = inferClientTypes<TInferrable>['errorShape'];
|
|
4
4
|
export interface TRPCClientErrorBase<TShape extends DefaultErrorShape> {
|
|
5
5
|
readonly message: string;
|
|
6
6
|
readonly shape: Maybe<TShape>;
|
|
7
7
|
readonly data: Maybe<TShape['data']>;
|
|
8
8
|
}
|
|
9
|
-
export type TRPCClientErrorLike<TInferrable extends
|
|
10
|
-
export declare class TRPCClientError<TRouterOrProcedure extends
|
|
9
|
+
export type TRPCClientErrorLike<TInferrable extends InferrableClientTypes> = TRPCClientErrorBase<inferErrorShape<TInferrable>>;
|
|
10
|
+
export declare class TRPCClientError<TRouterOrProcedure extends InferrableClientTypes> extends Error implements TRPCClientErrorBase<inferErrorShape<TRouterOrProcedure>> {
|
|
11
11
|
readonly cause: Error | undefined;
|
|
12
12
|
readonly shape: Maybe<inferErrorShape<TRouterOrProcedure>>;
|
|
13
13
|
readonly data: Maybe<inferErrorShape<TRouterOrProcedure>['data']>;
|
|
@@ -17,12 +17,13 @@ export declare class TRPCClientError<TRouterOrProcedure extends TRPCInferrable>
|
|
|
17
17
|
*/
|
|
18
18
|
meta: Record<string, unknown> | undefined;
|
|
19
19
|
constructor(message: string, opts?: {
|
|
20
|
-
result?: Maybe<inferErrorShape<TRouterOrProcedure
|
|
20
|
+
result?: Maybe<TRPCErrorResponse<inferErrorShape<TRouterOrProcedure>>>;
|
|
21
21
|
cause?: Error;
|
|
22
22
|
meta?: Record<string, unknown>;
|
|
23
23
|
});
|
|
24
|
-
static from<TRouterOrProcedure extends
|
|
24
|
+
static from<TRouterOrProcedure extends InferrableClientTypes>(_cause: Error | TRPCErrorResponse<any>, opts?: {
|
|
25
25
|
meta?: Record<string, unknown>;
|
|
26
26
|
}): TRPCClientError<TRouterOrProcedure>;
|
|
27
27
|
}
|
|
28
|
+
export {};
|
|
28
29
|
//# sourceMappingURL=TRPCClientError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TRPCClientError.d.ts","sourceRoot":"","sources":["../src/TRPCClientError.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var unstableCoreDoNotImport = require('@trpc/server/unstable-core-do-not-import');
|
|
4
4
|
|
|
5
5
|
function isTRPCClientError(cause) {
|
|
6
6
|
return cause instanceof TRPCClientError || /**
|
|
@@ -9,7 +9,7 @@ function isTRPCClientError(cause) {
|
|
|
9
9
|
*/ cause instanceof Error && cause.name === 'TRPCClientError';
|
|
10
10
|
}
|
|
11
11
|
function isTRPCErrorResponse(obj) {
|
|
12
|
-
return
|
|
12
|
+
return unstableCoreDoNotImport.isObject(obj) && unstableCoreDoNotImport.isObject(obj['error']) && typeof obj['error']['code'] === 'number' && typeof obj['error']['message'] === 'string';
|
|
13
13
|
}
|
|
14
14
|
class TRPCClientError extends Error {
|
|
15
15
|
static from(_cause, opts = {}) {
|
|
@@ -38,7 +38,7 @@ class TRPCClientError extends Error {
|
|
|
38
38
|
}
|
|
39
39
|
return new TRPCClientError(cause.message, {
|
|
40
40
|
...opts,
|
|
41
|
-
cause
|
|
41
|
+
cause: unstableCoreDoNotImport.getCauseFromUnknown(cause)
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
constructor(message, opts){
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getCauseFromUnknown, isObject } from '@trpc/server/unstable-core-do-not-import';
|
|
2
2
|
|
|
3
3
|
function isTRPCClientError(cause) {
|
|
4
4
|
return cause instanceof TRPCClientError || /**
|
|
@@ -7,7 +7,7 @@ function isTRPCClientError(cause) {
|
|
|
7
7
|
*/ cause instanceof Error && cause.name === 'TRPCClientError';
|
|
8
8
|
}
|
|
9
9
|
function isTRPCErrorResponse(obj) {
|
|
10
|
-
return isObject(obj) && isObject(obj
|
|
10
|
+
return isObject(obj) && isObject(obj['error']) && typeof obj['error']['code'] === 'number' && typeof obj['error']['message'] === 'string';
|
|
11
11
|
}
|
|
12
12
|
class TRPCClientError extends Error {
|
|
13
13
|
static from(_cause, opts = {}) {
|
|
@@ -36,7 +36,7 @@ class TRPCClientError extends Error {
|
|
|
36
36
|
}
|
|
37
37
|
return new TRPCClientError(cause.message, {
|
|
38
38
|
...opts,
|
|
39
|
-
cause
|
|
39
|
+
cause: getCauseFromUnknown(cause)
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
constructor(message, opts){
|
|
@@ -55,4 +55,4 @@ class TRPCClientError extends Error {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
export { TRPCClientError
|
|
58
|
+
export { TRPCClientError };
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction":
|
|
2
|
+
"bundleSize": 46703,
|
|
3
|
+
"bundleOrigSize": 65934,
|
|
4
|
+
"bundleReduction": 29.17,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/links/wsLink.ts",
|
|
8
|
-
"size":
|
|
9
|
-
"origSize":
|
|
8
|
+
"size": 12058,
|
|
9
|
+
"origSize": 13652,
|
|
10
10
|
"renderedExports": [
|
|
11
11
|
"createWSClient",
|
|
12
12
|
"wsLink"
|
|
13
13
|
],
|
|
14
14
|
"removedExports": [],
|
|
15
15
|
"dependents": [],
|
|
16
|
-
"percent":
|
|
17
|
-
"reduction":
|
|
16
|
+
"percent": 25.82,
|
|
17
|
+
"reduction": 11.68
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
"id": "/src/links/loggerLink.ts",
|
|
21
|
-
"size":
|
|
22
|
-
"origSize":
|
|
21
|
+
"size": 5545,
|
|
22
|
+
"origSize": 6496,
|
|
23
23
|
"renderedExports": [
|
|
24
24
|
"loggerLink"
|
|
25
25
|
],
|
|
26
26
|
"removedExports": [],
|
|
27
27
|
"dependents": [],
|
|
28
|
-
"percent": 11.
|
|
29
|
-
"reduction":
|
|
28
|
+
"percent": 11.87,
|
|
29
|
+
"reduction": 14.64
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
"id": "/src/internals/dataLoader.ts",
|
|
33
33
|
"size": 4409,
|
|
34
|
-
"origSize":
|
|
34
|
+
"origSize": 4766,
|
|
35
35
|
"renderedExports": [
|
|
36
36
|
"dataLoader"
|
|
37
37
|
],
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"dependents": [
|
|
40
40
|
"/src/links/internals/createHTTPBatchLink.ts"
|
|
41
41
|
],
|
|
42
|
-
"percent": 9.
|
|
43
|
-
"reduction": 7.
|
|
42
|
+
"percent": 9.44,
|
|
43
|
+
"reduction": 7.49
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
"id": "/src/links/internals/parseJSONStream.ts",
|
|
47
47
|
"size": 4007,
|
|
48
|
-
"origSize":
|
|
48
|
+
"origSize": 5037,
|
|
49
49
|
"renderedExports": [
|
|
50
50
|
"parseJSONStream",
|
|
51
51
|
"streamingJsonHttpRequester"
|
|
@@ -54,28 +54,13 @@
|
|
|
54
54
|
"dependents": [
|
|
55
55
|
"/src/links/httpBatchStreamLink.ts"
|
|
56
56
|
],
|
|
57
|
-
"percent": 8.
|
|
58
|
-
"reduction":
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"id": "/src/internals/TRPCUntypedClient.ts",
|
|
62
|
-
"size": 3250,
|
|
63
|
-
"origSize": 6234,
|
|
64
|
-
"renderedExports": [
|
|
65
|
-
"TRPCUntypedClient"
|
|
66
|
-
],
|
|
67
|
-
"removedExports": [],
|
|
68
|
-
"dependents": [
|
|
69
|
-
"/src/createTRPCUntypedClient.ts",
|
|
70
|
-
"/src/createTRPCClient.ts"
|
|
71
|
-
],
|
|
72
|
-
"percent": 7,
|
|
73
|
-
"reduction": 47.87
|
|
57
|
+
"percent": 8.58,
|
|
58
|
+
"reduction": 20.45
|
|
74
59
|
},
|
|
75
60
|
{
|
|
76
61
|
"id": "/src/links/internals/httpUtils.ts",
|
|
77
|
-
"size":
|
|
78
|
-
"origSize":
|
|
62
|
+
"size": 3464,
|
|
63
|
+
"origSize": 6007,
|
|
79
64
|
"renderedExports": [
|
|
80
65
|
"resolveHTTPLinkOptions",
|
|
81
66
|
"getUrl",
|
|
@@ -86,34 +71,49 @@
|
|
|
86
71
|
],
|
|
87
72
|
"removedExports": [],
|
|
88
73
|
"dependents": [
|
|
89
|
-
"/src/links/
|
|
90
|
-
"/src/links/httpFormDataLink.ts",
|
|
74
|
+
"/src/links/httpBatchLink.ts",
|
|
91
75
|
"/src/links/httpLink.ts",
|
|
76
|
+
"/src/links/httpFormDataLink.ts",
|
|
92
77
|
"/src/links/internals/createHTTPBatchLink.ts",
|
|
93
|
-
"/src/links/
|
|
78
|
+
"/src/links/internals/parseJSONStream.ts"
|
|
94
79
|
],
|
|
95
|
-
"percent":
|
|
96
|
-
"reduction":
|
|
80
|
+
"percent": 7.42,
|
|
81
|
+
"reduction": 42.33
|
|
97
82
|
},
|
|
98
83
|
{
|
|
99
84
|
"id": "/src/links/internals/createHTTPBatchLink.ts",
|
|
100
|
-
"size":
|
|
101
|
-
"origSize":
|
|
85
|
+
"size": 2944,
|
|
86
|
+
"origSize": 3711,
|
|
102
87
|
"renderedExports": [
|
|
103
88
|
"createHTTPBatchLink"
|
|
104
89
|
],
|
|
105
90
|
"removedExports": [],
|
|
106
91
|
"dependents": [
|
|
107
|
-
"/src/links/
|
|
108
|
-
"/src/links/
|
|
92
|
+
"/src/links/httpBatchLink.ts",
|
|
93
|
+
"/src/links/httpBatchStreamLink.ts"
|
|
109
94
|
],
|
|
110
|
-
"percent": 6.
|
|
111
|
-
"reduction":
|
|
95
|
+
"percent": 6.3,
|
|
96
|
+
"reduction": 20.67
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"id": "/src/internals/TRPCUntypedClient.ts",
|
|
100
|
+
"size": 2299,
|
|
101
|
+
"origSize": 4207,
|
|
102
|
+
"renderedExports": [
|
|
103
|
+
"TRPCUntypedClient"
|
|
104
|
+
],
|
|
105
|
+
"removedExports": [],
|
|
106
|
+
"dependents": [
|
|
107
|
+
"/src/createTRPCUntypedClient.ts",
|
|
108
|
+
"/src/createTRPCClient.ts"
|
|
109
|
+
],
|
|
110
|
+
"percent": 4.92,
|
|
111
|
+
"reduction": 45.35
|
|
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,129 +122,126 @@
|
|
|
122
122
|
"dependents": [
|
|
123
123
|
"/src/links/httpFormDataLink.ts"
|
|
124
124
|
],
|
|
125
|
-
"percent": 4.
|
|
126
|
-
"reduction":
|
|
125
|
+
"percent": 4.64,
|
|
126
|
+
"reduction": 21.21
|
|
127
127
|
},
|
|
128
128
|
{
|
|
129
129
|
"id": "/src/TRPCClientError.ts",
|
|
130
|
-
"size":
|
|
131
|
-
"origSize":
|
|
130
|
+
"size": 1866,
|
|
131
|
+
"origSize": 3437,
|
|
132
132
|
"renderedExports": [
|
|
133
133
|
"TRPCClientError"
|
|
134
134
|
],
|
|
135
135
|
"removedExports": [],
|
|
136
136
|
"dependents": [
|
|
137
|
-
"/src/internals/TRPCUntypedClient.ts",
|
|
138
137
|
"/src/index.ts",
|
|
139
138
|
"/src/links/httpLink.ts",
|
|
140
139
|
"/src/links/wsLink.ts",
|
|
141
|
-
"/src/
|
|
142
|
-
"/src/links/internals/createHTTPBatchLink.ts"
|
|
140
|
+
"/src/internals/TRPCUntypedClient.ts",
|
|
141
|
+
"/src/links/internals/createHTTPBatchLink.ts",
|
|
142
|
+
"/src/links/internals/httpUtils.ts"
|
|
143
143
|
],
|
|
144
|
-
"percent":
|
|
145
|
-
"reduction":
|
|
144
|
+
"percent": 4,
|
|
145
|
+
"reduction": 45.71
|
|
146
146
|
},
|
|
147
147
|
{
|
|
148
|
-
"id": "/src/
|
|
149
|
-
"size":
|
|
150
|
-
"origSize":
|
|
148
|
+
"id": "/src/links/httpBatchStreamLink.ts",
|
|
149
|
+
"size": 1340,
|
|
150
|
+
"origSize": 2176,
|
|
151
151
|
"renderedExports": [
|
|
152
|
-
"
|
|
152
|
+
"unstable_httpBatchStreamLink"
|
|
153
153
|
],
|
|
154
154
|
"removedExports": [],
|
|
155
|
-
"dependents": [
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
"/src/shared/index.ts",
|
|
159
|
-
"/src/links/internals/createHTTPBatchLink.ts"
|
|
160
|
-
],
|
|
161
|
-
"percent": 3.33,
|
|
162
|
-
"reduction": 31.15
|
|
155
|
+
"dependents": [],
|
|
156
|
+
"percent": 2.87,
|
|
157
|
+
"reduction": 38.42
|
|
163
158
|
},
|
|
164
159
|
{
|
|
165
|
-
"id": "/src/
|
|
166
|
-
"size":
|
|
167
|
-
"origSize":
|
|
160
|
+
"id": "/src/createTRPCClient.ts",
|
|
161
|
+
"size": 1206,
|
|
162
|
+
"origSize": 4369,
|
|
168
163
|
"renderedExports": [
|
|
169
|
-
"
|
|
164
|
+
"clientCallTypeToProcedureType",
|
|
165
|
+
"createTRPCClientProxy",
|
|
166
|
+
"createTRPCClient",
|
|
167
|
+
"getUntypedClient"
|
|
170
168
|
],
|
|
171
169
|
"removedExports": [],
|
|
172
|
-
"dependents": [
|
|
173
|
-
|
|
174
|
-
|
|
170
|
+
"dependents": [
|
|
171
|
+
"/src/index.ts"
|
|
172
|
+
],
|
|
173
|
+
"percent": 2.58,
|
|
174
|
+
"reduction": 72.4
|
|
175
175
|
},
|
|
176
176
|
{
|
|
177
177
|
"id": "/src/links/httpBatchLink.ts",
|
|
178
|
-
"size":
|
|
179
|
-
"origSize":
|
|
178
|
+
"size": 1205,
|
|
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.58,
|
|
186
|
+
"reduction": 21.09
|
|
187
187
|
},
|
|
188
188
|
{
|
|
189
|
-
"id": "/src/
|
|
190
|
-
"size":
|
|
191
|
-
"origSize":
|
|
189
|
+
"id": "/src/links/httpFormDataLink.ts",
|
|
190
|
+
"size": 703,
|
|
191
|
+
"origSize": 772,
|
|
192
192
|
"renderedExports": [
|
|
193
|
-
"
|
|
194
|
-
"createTRPCClientProxy",
|
|
195
|
-
"createTRPCClient",
|
|
196
|
-
"getUntypedClient"
|
|
193
|
+
"experimental_formDataLink"
|
|
197
194
|
],
|
|
198
195
|
"removedExports": [],
|
|
199
|
-
"dependents": [
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
"percent": 2.48,
|
|
203
|
-
"reduction": 73.24
|
|
196
|
+
"dependents": [],
|
|
197
|
+
"percent": 1.51,
|
|
198
|
+
"reduction": 8.94
|
|
204
199
|
},
|
|
205
200
|
{
|
|
206
201
|
"id": "/src/links/internals/createChain.ts",
|
|
207
202
|
"size": 690,
|
|
208
|
-
"origSize":
|
|
203
|
+
"origSize": 1026,
|
|
209
204
|
"renderedExports": [
|
|
210
205
|
"createChain"
|
|
211
206
|
],
|
|
212
207
|
"removedExports": [],
|
|
213
208
|
"dependents": [
|
|
214
|
-
"/src/
|
|
215
|
-
"/src/
|
|
209
|
+
"/src/links/splitLink.ts",
|
|
210
|
+
"/src/internals/TRPCUntypedClient.ts"
|
|
216
211
|
],
|
|
217
|
-
"percent": 1.
|
|
218
|
-
"reduction":
|
|
212
|
+
"percent": 1.48,
|
|
213
|
+
"reduction": 32.75
|
|
219
214
|
},
|
|
220
215
|
{
|
|
221
|
-
"id": "/src/links/
|
|
222
|
-
"size":
|
|
223
|
-
"origSize":
|
|
216
|
+
"id": "/src/links/splitLink.ts",
|
|
217
|
+
"size": 610,
|
|
218
|
+
"origSize": 1108,
|
|
224
219
|
"renderedExports": [
|
|
225
|
-
"
|
|
220
|
+
"splitLink"
|
|
226
221
|
],
|
|
227
222
|
"removedExports": [],
|
|
228
223
|
"dependents": [],
|
|
229
|
-
"percent": 1.
|
|
230
|
-
"reduction":
|
|
224
|
+
"percent": 1.31,
|
|
225
|
+
"reduction": 44.95
|
|
231
226
|
},
|
|
232
227
|
{
|
|
233
|
-
"id": "/src/
|
|
234
|
-
"size":
|
|
235
|
-
"origSize":
|
|
228
|
+
"id": "/src/internals/transformer.ts",
|
|
229
|
+
"size": 565,
|
|
230
|
+
"origSize": 1699,
|
|
236
231
|
"renderedExports": [
|
|
237
|
-
"
|
|
232
|
+
"getTransformer"
|
|
238
233
|
],
|
|
239
234
|
"removedExports": [],
|
|
240
|
-
"dependents": [
|
|
241
|
-
|
|
242
|
-
|
|
235
|
+
"dependents": [
|
|
236
|
+
"/src/unstable-internals.ts"
|
|
237
|
+
],
|
|
238
|
+
"percent": 1.21,
|
|
239
|
+
"reduction": 66.75
|
|
243
240
|
},
|
|
244
241
|
{
|
|
245
242
|
"id": "/src/links/internals/getTextDecoder.ts",
|
|
246
243
|
"size": 553,
|
|
247
|
-
"origSize":
|
|
244
|
+
"origSize": 634,
|
|
248
245
|
"renderedExports": [
|
|
249
246
|
"getTextDecoder"
|
|
250
247
|
],
|
|
@@ -252,13 +249,13 @@
|
|
|
252
249
|
"dependents": [
|
|
253
250
|
"/src/links/httpBatchStreamLink.ts"
|
|
254
251
|
],
|
|
255
|
-
"percent": 1.
|
|
256
|
-
"reduction": 12.
|
|
252
|
+
"percent": 1.18,
|
|
253
|
+
"reduction": 12.78
|
|
257
254
|
},
|
|
258
255
|
{
|
|
259
256
|
"id": "/src/internals/getAbortController.ts",
|
|
260
257
|
"size": 542,
|
|
261
|
-
"origSize":
|
|
258
|
+
"origSize": 710,
|
|
262
259
|
"renderedExports": [
|
|
263
260
|
"getAbortController"
|
|
264
261
|
],
|
|
@@ -266,13 +263,13 @@
|
|
|
266
263
|
"dependents": [
|
|
267
264
|
"/src/links/internals/httpUtils.ts"
|
|
268
265
|
],
|
|
269
|
-
"percent": 1.
|
|
270
|
-
"reduction":
|
|
266
|
+
"percent": 1.16,
|
|
267
|
+
"reduction": 23.66
|
|
271
268
|
},
|
|
272
269
|
{
|
|
273
270
|
"id": "/src/getFetch.ts",
|
|
274
271
|
"size": 428,
|
|
275
|
-
"origSize":
|
|
272
|
+
"origSize": 644,
|
|
276
273
|
"renderedExports": [
|
|
277
274
|
"getFetch"
|
|
278
275
|
],
|
|
@@ -282,41 +279,12 @@
|
|
|
282
279
|
"/src/links/internals/httpUtils.ts"
|
|
283
280
|
],
|
|
284
281
|
"percent": 0.92,
|
|
285
|
-
"reduction": 33.
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
"id": "/src/internals/retryDelay.ts",
|
|
289
|
-
"size": 142,
|
|
290
|
-
"origSize": 162,
|
|
291
|
-
"renderedExports": [
|
|
292
|
-
"retryDelay"
|
|
293
|
-
],
|
|
294
|
-
"removedExports": [],
|
|
295
|
-
"dependents": [
|
|
296
|
-
"/src/links/wsLink.ts"
|
|
297
|
-
],
|
|
298
|
-
"percent": 0.31,
|
|
299
|
-
"reduction": 12.35
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
"id": "/src/internals/isObject.ts",
|
|
303
|
-
"size": 136,
|
|
304
|
-
"origSize": 183,
|
|
305
|
-
"renderedExports": [
|
|
306
|
-
"isObject"
|
|
307
|
-
],
|
|
308
|
-
"removedExports": [],
|
|
309
|
-
"dependents": [
|
|
310
|
-
"/src/TRPCClientError.ts",
|
|
311
|
-
"/src/shared/transformResult.ts"
|
|
312
|
-
],
|
|
313
|
-
"percent": 0.29,
|
|
314
|
-
"reduction": 25.68
|
|
282
|
+
"reduction": 33.54
|
|
315
283
|
},
|
|
316
284
|
{
|
|
317
285
|
"id": "/src/createTRPCUntypedClient.ts",
|
|
318
|
-
"size":
|
|
319
|
-
"origSize":
|
|
286
|
+
"size": 100,
|
|
287
|
+
"origSize": 574,
|
|
320
288
|
"renderedExports": [
|
|
321
289
|
"createTRPCUntypedClient"
|
|
322
290
|
],
|
|
@@ -324,13 +292,13 @@
|
|
|
324
292
|
"dependents": [
|
|
325
293
|
"/src/index.ts"
|
|
326
294
|
],
|
|
327
|
-
"percent": 0.
|
|
328
|
-
"reduction":
|
|
295
|
+
"percent": 0.21,
|
|
296
|
+
"reduction": 82.58
|
|
329
297
|
},
|
|
330
298
|
{
|
|
331
299
|
"id": "/src/index.ts",
|
|
332
300
|
"size": 0,
|
|
333
|
-
"origSize":
|
|
301
|
+
"origSize": 588,
|
|
334
302
|
"renderedExports": [],
|
|
335
303
|
"removedExports": [],
|
|
336
304
|
"dependents": [],
|
|
@@ -338,15 +306,18 @@
|
|
|
338
306
|
"reduction": 100
|
|
339
307
|
},
|
|
340
308
|
{
|
|
341
|
-
"id": "/src/
|
|
309
|
+
"id": "/src/unstable-internals.ts",
|
|
342
310
|
"size": 0,
|
|
343
|
-
"origSize":
|
|
311
|
+
"origSize": 41,
|
|
344
312
|
"renderedExports": [],
|
|
345
313
|
"removedExports": [],
|
|
346
|
-
"dependents": [
|
|
314
|
+
"dependents": [
|
|
315
|
+
"/src/links/wsLink.ts",
|
|
316
|
+
"/src/links/internals/httpUtils.ts"
|
|
317
|
+
],
|
|
347
318
|
"percent": 0,
|
|
348
319
|
"reduction": 100
|
|
349
320
|
}
|
|
350
321
|
],
|
|
351
|
-
"moduleCount":
|
|
322
|
+
"moduleCount": 22
|
|
352
323
|
}
|
|
@@ -1,38 +1,46 @@
|
|
|
1
|
-
import type { AnyMutationProcedure, AnyProcedure, AnyQueryProcedure, AnyRootConfig, AnyRouter, AnySubscriptionProcedure, IntersectionError, ProcedureArgs, ProcedureRouterRecord, ProcedureType } from '@trpc/server';
|
|
2
1
|
import type { Unsubscribable } from '@trpc/server/observable';
|
|
3
|
-
import { inferTransformedProcedureOutput,
|
|
4
|
-
import { CreateTRPCClientOptions } from './createTRPCUntypedClient';
|
|
5
|
-
import { TRPCSubscriptionObserver,
|
|
6
|
-
import {
|
|
2
|
+
import type { AnyProcedure, AnyRouter, inferClientTypes, inferProcedureInput, inferTransformedProcedureOutput, IntersectionError, ProcedureOptions, ProcedureType, RouterRecord } from '@trpc/server/unstable-core-do-not-import';
|
|
3
|
+
import type { CreateTRPCClientOptions } from './createTRPCUntypedClient';
|
|
4
|
+
import type { TRPCSubscriptionObserver, UntypedClientProperties } from './internals/TRPCUntypedClient';
|
|
5
|
+
import { TRPCUntypedClient } from './internals/TRPCUntypedClient';
|
|
6
|
+
import type { TRPCClientError } from './TRPCClientError';
|
|
7
7
|
/**
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
mutate: Resolver<TConfig, TProcedure>;
|
|
21
|
-
} : TProcedure extends AnySubscriptionProcedure ? {
|
|
22
|
-
subscribe: SubscriptionResolver<TConfig, TProcedure>;
|
|
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>;
|
|
23
26
|
} : never;
|
|
24
27
|
/**
|
|
25
28
|
* @internal
|
|
26
29
|
*/
|
|
27
|
-
type DecoratedProcedureRecord<TRouter extends AnyRouter,
|
|
28
|
-
[TKey in keyof
|
|
30
|
+
type DecoratedProcedureRecord<TRouter extends AnyRouter, TRecord extends RouterRecord> = {
|
|
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;
|
|
29
37
|
};
|
|
30
38
|
/** @internal */
|
|
31
39
|
export declare const clientCallTypeToProcedureType: (clientCallType: string) => ProcedureType;
|
|
32
40
|
/**
|
|
33
41
|
* Creates a proxy client and shows type errors if you have query names that collide with built-in properties
|
|
34
42
|
*/
|
|
35
|
-
export type CreateTRPCClient<TRouter extends AnyRouter> = inferRouterClient<TRouter> extends infer $
|
|
43
|
+
export type CreateTRPCClient<TRouter extends AnyRouter> = inferRouterClient<TRouter> extends infer $Value ? UntypedClientProperties & keyof $Value extends never ? inferRouterClient<TRouter> : IntersectionError<UntypedClientProperties & keyof $Value> : never;
|
|
36
44
|
/**
|
|
37
45
|
* @internal
|
|
38
46
|
*/
|