@trpc/client 9.27.0 → 9.27.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.
- package/dist/declarations/src/core/transformRPCResponse.d.ts +1 -9
- package/dist/declarations/src/core/transformRPCResponse.d.ts.map +1 -1
- package/dist/declarations/src/internals/dataLoader.d.ts.map +1 -1
- package/dist/declarations/src/internals/executeChain.d.ts +1 -2
- package/dist/declarations/src/internals/executeChain.d.ts.map +1 -1
- package/dist/declarations/src/links/wsLink.d.ts +1 -4
- package/dist/declarations/src/links/wsLink.d.ts.map +1 -1
- package/links/httpBatchLink/dist/trpc-client-links-httpBatchLink.cjs.dev.js +8 -6
- package/links/httpBatchLink/dist/trpc-client-links-httpBatchLink.cjs.prod.js +8 -6
- package/links/httpBatchLink/dist/trpc-client-links-httpBatchLink.esm.js +8 -6
- package/package.json +4 -4
- package/src/internals/dataLoader.ts +8 -5
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
import { TRPCResponse } from '@trpc/server/rpc';
|
|
2
|
-
import { TRPCClientError } from '../TRPCClientError';
|
|
3
2
|
import { LinkRuntimeOptions } from '../links/core';
|
|
4
3
|
export declare function transformRPCResponse({ envelope, runtime, }: {
|
|
5
4
|
envelope: TRPCResponse;
|
|
6
5
|
runtime: LinkRuntimeOptions;
|
|
7
|
-
}):
|
|
8
|
-
type: "started";
|
|
9
|
-
} | {
|
|
10
|
-
type: "stopped";
|
|
11
|
-
} | TRPCClientError<import("@trpc/server").AnyRouter<any>> | {
|
|
12
|
-
data: any;
|
|
13
|
-
type: "data";
|
|
14
|
-
};
|
|
6
|
+
}): any;
|
|
15
7
|
//# sourceMappingURL=transformRPCResponse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformRPCResponse.d.ts","sourceRoot":"../../../../src/core","sources":["transformRPCResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"transformRPCResponse.d.ts","sourceRoot":"../../../../src/core","sources":["transformRPCResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,kBAAkB,CAAC;CAC7B,OAcA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataLoader.d.ts","sourceRoot":"../../../../src/internals","sources":["dataLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAY3D,aAAK,WAAW,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK;IACjD,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3B,MAAM,EAAE,QAAQ,CAAC;CAClB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EACrC,SAAS,EAAE,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,EACpC,IAAI,CAAC,EAAE;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE;gBA8Bb,IAAI,KAAG,iBAAiB,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"dataLoader.d.ts","sourceRoot":"../../../../src/internals","sources":["dataLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAY3D,aAAK,WAAW,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK;IACjD,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3B,MAAM,EAAE,QAAQ,CAAC;CAClB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EACrC,SAAS,EAAE,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,EACpC,IAAI,CAAC,EAAE;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE;gBA8Bb,IAAI,KAAG,iBAAiB,MAAM,CAAC;EAoDnD"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { AnyRouter } from '@trpc/server';
|
|
2
|
-
import { TRPCResult } from '@trpc/server/rpc';
|
|
3
2
|
import { TRPCClientError } from '../TRPCClientError';
|
|
4
3
|
import { Operation, OperationLink } from '../links/core';
|
|
5
4
|
export declare function executeChain<TRouter extends AnyRouter, TInput = unknown, TOutput = unknown>(opts: {
|
|
6
5
|
links: OperationLink<TRouter, TInput, TOutput>[];
|
|
7
6
|
op: Operation<TInput>;
|
|
8
|
-
}): import("./observable").ObservableSubject<
|
|
7
|
+
}): import("./observable").ObservableSubject<any, TRPCClientError<TRouter>>;
|
|
9
8
|
//# sourceMappingURL=executeChain.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeChain.d.ts","sourceRoot":"../../../../src/internals","sources":["executeChain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"executeChain.d.ts","sourceRoot":"../../../../src/internals","sources":["executeChain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,SAAS,EACT,aAAa,EAGd,MAAM,eAAe,CAAC;AAGvB,wBAAgB,YAAY,CAC1B,OAAO,SAAS,SAAS,EACzB,MAAM,GAAG,OAAO,EAChB,OAAO,GAAG,OAAO,EACjB,IAAI,EAAE;IACN,KAAK,EAAE,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACjD,EAAE,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;CACvB,2EAgDA"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { AnyRouter, ProcedureType } from '@trpc/server';
|
|
2
|
-
import { TRPCResult } from '@trpc/server/rpc';
|
|
3
|
-
import { TRPCErrorResponse } from '@trpc/server/rpc';
|
|
4
|
-
import { TRPCClientError } from '../TRPCClientError';
|
|
5
2
|
import { ObservableCallbacks, UnsubscribeFn } from '../internals/observable';
|
|
6
3
|
import { retryDelay } from '../internals/retryDelay';
|
|
7
4
|
import { TRPCLink } from './core';
|
|
@@ -18,7 +15,7 @@ export interface WebSocketClientOptions {
|
|
|
18
15
|
}
|
|
19
16
|
export declare function createWSClient(opts: WebSocketClientOptions): {
|
|
20
17
|
close: () => void;
|
|
21
|
-
request: (op: Operation, callbacks: ObservableCallbacks<
|
|
18
|
+
request: (op: Operation, callbacks: ObservableCallbacks<any, any>) => UnsubscribeFn;
|
|
22
19
|
getConnection(): WebSocket;
|
|
23
20
|
};
|
|
24
21
|
export declare type TRPCWebSocketClient = ReturnType<typeof createWSClient>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wsLink.d.ts","sourceRoot":"../../../../src/links","sources":["wsLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"wsLink.d.ts","sourceRoot":"../../../../src/links","sources":["wsLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAUxD,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,aAAK,SAAS,GAAG;IACf,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AACF,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,OAAO,SAAS,CAAC;IAC7B,YAAY,CAAC,EAAE,OAAO,UAAU,CAAC;CAClC;AACD,wBAAgB,cAAc,CAAC,IAAI,EAAE,sBAAsB;;kBAiMpC,SAAS,+CAA0B,aAAa;;EAkDtE;AACD,oBAAY,mBAAmB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAEpE,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAiBD,wBAAgB,MAAM,CAAC,OAAO,SAAS,SAAS,EAC9C,IAAI,EAAE,oBAAoB,GACzB,QAAQ,CAAC,OAAO,CAAC,CA6DnB"}
|
|
@@ -78,6 +78,7 @@ function dataLoader(fetchMany, opts) {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
var thisBatch = batch;
|
|
81
|
+
var dispatchImmediately = false;
|
|
81
82
|
var promise = new Promise(function (resolve, reject) {
|
|
82
83
|
var item = batchItem;
|
|
83
84
|
item.reject = reject;
|
|
@@ -85,15 +86,10 @@ function dataLoader(fetchMany, opts) {
|
|
|
85
86
|
thisBatch.items.push(item);
|
|
86
87
|
|
|
87
88
|
if (typeof (opts === null || opts === void 0 ? void 0 : opts.maxBatchSize) !== 'undefined' && thisBatch.items.length >= opts.maxBatchSize) {
|
|
88
|
-
|
|
89
|
-
return;
|
|
89
|
+
dispatchImmediately = true;
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
|
|
93
|
-
if (!dispatchTimer) {
|
|
94
|
-
dispatchTimer = setTimeout(dispatch);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
93
|
var cancel = function cancel() {
|
|
98
94
|
batchItem.cancelled = true;
|
|
99
95
|
|
|
@@ -107,6 +103,12 @@ function dataLoader(fetchMany, opts) {
|
|
|
107
103
|
thisBatch.cancel();
|
|
108
104
|
};
|
|
109
105
|
|
|
106
|
+
if (dispatchImmediately) {
|
|
107
|
+
dispatch();
|
|
108
|
+
} else if (!dispatchTimer) {
|
|
109
|
+
dispatchTimer = setTimeout(dispatch);
|
|
110
|
+
}
|
|
111
|
+
|
|
110
112
|
return {
|
|
111
113
|
promise: promise,
|
|
112
114
|
cancel: cancel
|
|
@@ -78,6 +78,7 @@ function dataLoader(fetchMany, opts) {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
var thisBatch = batch;
|
|
81
|
+
var dispatchImmediately = false;
|
|
81
82
|
var promise = new Promise(function (resolve, reject) {
|
|
82
83
|
var item = batchItem;
|
|
83
84
|
item.reject = reject;
|
|
@@ -85,15 +86,10 @@ function dataLoader(fetchMany, opts) {
|
|
|
85
86
|
thisBatch.items.push(item);
|
|
86
87
|
|
|
87
88
|
if (typeof (opts === null || opts === void 0 ? void 0 : opts.maxBatchSize) !== 'undefined' && thisBatch.items.length >= opts.maxBatchSize) {
|
|
88
|
-
|
|
89
|
-
return;
|
|
89
|
+
dispatchImmediately = true;
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
|
|
93
|
-
if (!dispatchTimer) {
|
|
94
|
-
dispatchTimer = setTimeout(dispatch);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
93
|
var cancel = function cancel() {
|
|
98
94
|
batchItem.cancelled = true;
|
|
99
95
|
|
|
@@ -107,6 +103,12 @@ function dataLoader(fetchMany, opts) {
|
|
|
107
103
|
thisBatch.cancel();
|
|
108
104
|
};
|
|
109
105
|
|
|
106
|
+
if (dispatchImmediately) {
|
|
107
|
+
dispatch();
|
|
108
|
+
} else if (!dispatchTimer) {
|
|
109
|
+
dispatchTimer = setTimeout(dispatch);
|
|
110
|
+
}
|
|
111
|
+
|
|
110
112
|
return {
|
|
111
113
|
promise: promise,
|
|
112
114
|
cancel: cancel
|
|
@@ -74,6 +74,7 @@ function dataLoader(fetchMany, opts) {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
var thisBatch = batch;
|
|
77
|
+
var dispatchImmediately = false;
|
|
77
78
|
var promise = new Promise(function (resolve, reject) {
|
|
78
79
|
var item = batchItem;
|
|
79
80
|
item.reject = reject;
|
|
@@ -81,15 +82,10 @@ function dataLoader(fetchMany, opts) {
|
|
|
81
82
|
thisBatch.items.push(item);
|
|
82
83
|
|
|
83
84
|
if (typeof (opts === null || opts === void 0 ? void 0 : opts.maxBatchSize) !== 'undefined' && thisBatch.items.length >= opts.maxBatchSize) {
|
|
84
|
-
|
|
85
|
-
return;
|
|
85
|
+
dispatchImmediately = true;
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
-
if (!dispatchTimer) {
|
|
90
|
-
dispatchTimer = setTimeout(dispatch);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
89
|
var cancel = function cancel() {
|
|
94
90
|
batchItem.cancelled = true;
|
|
95
91
|
|
|
@@ -103,6 +99,12 @@ function dataLoader(fetchMany, opts) {
|
|
|
103
99
|
thisBatch.cancel();
|
|
104
100
|
};
|
|
105
101
|
|
|
102
|
+
if (dispatchImmediately) {
|
|
103
|
+
dispatch();
|
|
104
|
+
} else if (!dispatchTimer) {
|
|
105
|
+
dispatchTimer = setTimeout(dispatch);
|
|
106
|
+
}
|
|
107
|
+
|
|
106
108
|
return {
|
|
107
109
|
promise: promise,
|
|
108
110
|
cancel: cancel
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/client",
|
|
3
|
-
"version": "9.27.
|
|
3
|
+
"version": "9.27.1",
|
|
4
4
|
"description": "tRPC Client lib",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"@babel/runtime": "^7.9.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@trpc/server": "9.27.
|
|
37
|
+
"@trpc/server": "9.27.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@trpc/server": "9.27.
|
|
40
|
+
"@trpc/server": "9.27.1"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "82ee39e711fa6d8e10569fdb8d765b410e700984"
|
|
46
46
|
}
|
|
@@ -67,6 +67,7 @@ export function dataLoader<TKey, TValue>(
|
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
const thisBatch = batch;
|
|
70
|
+
let dispatchImmediately = false;
|
|
70
71
|
const promise = new Promise<TValue>((resolve, reject) => {
|
|
71
72
|
const item = batchItem as any as BatchItem<TKey, TValue>;
|
|
72
73
|
item.reject = reject;
|
|
@@ -77,14 +78,10 @@ export function dataLoader<TKey, TValue>(
|
|
|
77
78
|
typeof opts?.maxBatchSize !== 'undefined' &&
|
|
78
79
|
thisBatch.items.length >= opts.maxBatchSize
|
|
79
80
|
) {
|
|
80
|
-
|
|
81
|
-
return;
|
|
81
|
+
dispatchImmediately = true;
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
-
if (!dispatchTimer) {
|
|
86
|
-
dispatchTimer = setTimeout(dispatch);
|
|
87
|
-
}
|
|
88
85
|
const cancel = () => {
|
|
89
86
|
batchItem.cancelled = true;
|
|
90
87
|
|
|
@@ -95,6 +92,12 @@ export function dataLoader<TKey, TValue>(
|
|
|
95
92
|
thisBatch.cancel();
|
|
96
93
|
};
|
|
97
94
|
|
|
95
|
+
if (dispatchImmediately) {
|
|
96
|
+
dispatch();
|
|
97
|
+
} else if (!dispatchTimer) {
|
|
98
|
+
dispatchTimer = setTimeout(dispatch);
|
|
99
|
+
}
|
|
100
|
+
|
|
98
101
|
return { promise, cancel };
|
|
99
102
|
}
|
|
100
103
|
|