@trpc/client 10.3.0 → 10.4.1
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyRouter, ClientDataTransformerOptions, inferProcedureInput, inferSubscriptionOutput } from '@trpc/server';
|
|
1
|
+
import { AnyRouter, ClientDataTransformerOptions, inferProcedureInput, inferProcedureOutput, inferSubscriptionOutput } from '@trpc/server';
|
|
2
2
|
import { Unsubscribable } from '@trpc/server/observable';
|
|
3
3
|
import { inferTransformedProcedureOutput } from '@trpc/server/shared';
|
|
4
4
|
import { TRPCClientError } from '../TRPCClientError';
|
|
@@ -35,7 +35,7 @@ export declare class TRPCClient<TRouter extends AnyRouter> {
|
|
|
35
35
|
constructor(opts: CreateTRPCClientOptions<TRouter>);
|
|
36
36
|
private $request;
|
|
37
37
|
private requestAsPromise;
|
|
38
|
-
query<TQueries extends TRouter['_def']['queries'], TPath extends string & keyof TQueries, TInput extends inferProcedureInput<TQueries[TPath]>>(path: TPath, input?: TInput, opts?: TRPCRequestOptions): Promise<
|
|
38
|
+
query<TQueries extends TRouter['_def']['queries'], TPath extends string & keyof TQueries, TInput extends inferProcedureInput<TQueries[TPath]>>(path: TPath, input?: TInput, opts?: TRPCRequestOptions): Promise<inferProcedureOutput<TQueries[TPath]>>;
|
|
39
39
|
mutation<TMutations extends TRouter['_def']['mutations'], TPath extends string & keyof TMutations, TInput extends inferProcedureInput<TMutations[TPath]>>(path: TPath, input?: TInput, opts?: TRPCRequestOptions): Promise<inferTransformedProcedureOutput<TMutations[TPath]>>;
|
|
40
40
|
subscription<TSubscriptions extends TRouter['_def']['subscriptions'], TPath extends string & keyof TSubscriptions, TOutput extends inferSubscriptionOutput<TRouter, TPath>, TInput extends inferProcedureInput<TSubscriptions[TPath]>>(path: TPath, input: TInput, opts: TRPCRequestOptions & Partial<TRPCSubscriptionObserver<TOutput, TRPCClientError<TRouter>>>): Unsubscribable;
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C,KAAK,SAAS,MAAM,GAAG,MAAM,QAAQ,EACrC,MAAM,SAAS,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EACnD,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,kBAAkB;IAUjD,QAAQ,CACb,UAAU,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,EAC/C,KAAK,SAAS,MAAM,GAAG,MAAM,UAAU,EACvC,MAAM,SAAS,mBAAmB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EACrD,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,kBAAkB;IAUjD,YAAY,CACjB,cAAc,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,EACvD,KAAK,SAAS,MAAM,GAAG,MAAM,cAAc,EAE3C,OAAO,SAAS,uBAAuB,CAAC,OAAO,EAAE,KAAK,CAAC,EACvD,MAAM,SAAS,mBAAmB,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,EAEzD,IAAI,EAAE,KAAK,EACX,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,kBAAkB,GACtB,OAAO,CAAC,wBAAwB,CAAC,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,GACrE,cAAc;CAyBlB"}
|
package/dist/links/wsLink.js
CHANGED
|
@@ -8,7 +8,7 @@ var transformResult = require('../transformResult-000baed1.js');
|
|
|
8
8
|
/* istanbul ignore next */ const retryDelay = (attemptIndex)=>attemptIndex === 0 ? 0 : Math.min(1000 * 2 ** attemptIndex, 30000);
|
|
9
9
|
|
|
10
10
|
function createWSClient(opts) {
|
|
11
|
-
const { url , WebSocket: WebSocketImpl = WebSocket , retryDelayMs: retryDelayFn = retryDelay , onOpen , onClose
|
|
11
|
+
const { url , WebSocket: WebSocketImpl = WebSocket , retryDelayMs: retryDelayFn = retryDelay , onOpen , onClose } = opts;
|
|
12
12
|
/* istanbul ignore next */ if (!WebSocketImpl) {
|
|
13
13
|
throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");
|
|
14
14
|
}
|
package/dist/links/wsLink.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { T as TRPCClientError, t as transformResult } from '../transformResult-b
|
|
|
4
4
|
/* istanbul ignore next */ const retryDelay = (attemptIndex)=>attemptIndex === 0 ? 0 : Math.min(1000 * 2 ** attemptIndex, 30000);
|
|
5
5
|
|
|
6
6
|
function createWSClient(opts) {
|
|
7
|
-
const { url , WebSocket: WebSocketImpl = WebSocket , retryDelayMs: retryDelayFn = retryDelay , onOpen , onClose
|
|
7
|
+
const { url , WebSocket: WebSocketImpl = WebSocket , retryDelayMs: retryDelayFn = retryDelay , onOpen , onClose } = opts;
|
|
8
8
|
/* istanbul ignore next */ if (!WebSocketImpl) {
|
|
9
9
|
throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");
|
|
10
10
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/client",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.4.1",
|
|
4
4
|
"description": "tRPC Client lib",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -66,11 +66,11 @@
|
|
|
66
66
|
"links"
|
|
67
67
|
],
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@trpc/server": "10.
|
|
69
|
+
"@trpc/server": "10.4.1"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@testing-library/dom": "^8.18.1",
|
|
73
|
-
"@trpc/server": "10.
|
|
73
|
+
"@trpc/server": "10.4.1",
|
|
74
74
|
"@types/node": "^18.7.20",
|
|
75
75
|
"rollup": "^2.79.1",
|
|
76
76
|
"tsx": "^3.9.0"
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"publishConfig": {
|
|
79
79
|
"access": "public"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "f7f05a2bb803d85465282e9d17e16bae357ab6a8"
|
|
82
82
|
}
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
ClientDataTransformerOptions,
|
|
4
4
|
DataTransformer,
|
|
5
5
|
inferProcedureInput,
|
|
6
|
+
inferProcedureOutput,
|
|
6
7
|
inferSubscriptionOutput,
|
|
7
8
|
} from '@trpc/server';
|
|
8
9
|
import {
|
|
@@ -134,7 +135,7 @@ export class TRPCClient<TRouter extends AnyRouter> {
|
|
|
134
135
|
TPath extends string & keyof TQueries,
|
|
135
136
|
TInput extends inferProcedureInput<TQueries[TPath]>,
|
|
136
137
|
>(path: TPath, input?: TInput, opts?: TRPCRequestOptions) {
|
|
137
|
-
type TOutput =
|
|
138
|
+
type TOutput = inferProcedureOutput<TQueries[TPath]>;
|
|
138
139
|
return this.requestAsPromise<TInput, TOutput>({
|
|
139
140
|
type: 'query',
|
|
140
141
|
path,
|