@trpc/client 11.23.1-canary.45.61b27e687 → 11.24.0
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/{httpBatchLink-C5dtlKQN.d.cts → httpBatchLink-Dp4tIBfy.d.cts} +2 -2
- package/dist/{httpBatchLink-C5dtlKQN.d.cts.map → httpBatchLink-Dp4tIBfy.d.cts.map} +1 -1
- package/dist/{httpBatchLink-DTbymUfm.d.mts → httpBatchLink-Dxqsu9CE.d.mts} +2 -2
- package/dist/{httpBatchLink-DTbymUfm.d.mts.map → httpBatchLink-Dxqsu9CE.d.mts.map} +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/links/httpBatchLink.d.cts +1 -1
- package/dist/links/httpBatchLink.d.mts +1 -1
- package/package.json +4 -4
- package/skills/client-setup/SKILL.md +1 -1
- package/skills/links/SKILL.md +2 -2
- package/skills/links/references/client-links-httpBatchLink.md +1 -3
- package/skills/superjson/SKILL.md +1 -1
- package/src/links/HTTPBatchLinkOptions.ts +1 -1
|
@@ -26,7 +26,7 @@ type HTTPBatchLinkOptions<TRoot extends AnyClientTypes> = HTTPLinkBaseOptions<TR
|
|
|
26
26
|
}) => HTTPHeaders | Promise<HTTPHeaders>);
|
|
27
27
|
/**
|
|
28
28
|
* The most calls one batch can have. Set it to the server's
|
|
29
|
-
* `maxBatchSize`
|
|
29
|
+
* `maxBatchSize` or lower.
|
|
30
30
|
* @see https://trpc.io/docs/client/links/httpBatchLink#limiting-batch-size
|
|
31
31
|
* @default Infinity
|
|
32
32
|
*/
|
|
@@ -43,4 +43,4 @@ type HTTPBatchLinkOptions<TRoot extends AnyClientTypes> = HTTPLinkBaseOptions<TR
|
|
|
43
43
|
declare function httpBatchLink<TRouter extends AnyRouter$1>(opts: HTTPBatchLinkOptions<TRouter['_def']['_config']['$types']>): TRPCLink<TRouter>;
|
|
44
44
|
//#endregion
|
|
45
45
|
export { HTTPBatchLinkOptions as n, httpBatchLink as t };
|
|
46
|
-
//# sourceMappingURL=httpBatchLink-
|
|
46
|
+
//# sourceMappingURL=httpBatchLink-Dp4tIBfy.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpBatchLink-
|
|
1
|
+
{"version":3,"file":"httpBatchLink-Dp4tIBfy.d.cts","names":[],"sources":["../src/links/HTTPBatchLinkOptions.ts","../src/links/httpBatchLink.ts"],"mappings":";;;;;;;;;KASY,qBAAqB,cAAc,kBAC7C,oBAAoB;;;;;;;;EAQlB;;;;;;EAMA,UACI,gBACE;IACA,QAAQ,cAAc;QAClB,cAAc,QAAQ;;;;;;;EAQhC;;;;;;;;;;iBCVY,cAAc,gBAAgB,aAC5C,MAAM,qBAAqB,wCAC1B,SAAS"}
|
|
@@ -26,7 +26,7 @@ type HTTPBatchLinkOptions<TRoot extends AnyClientTypes> = HTTPLinkBaseOptions<TR
|
|
|
26
26
|
}) => HTTPHeaders | Promise<HTTPHeaders>);
|
|
27
27
|
/**
|
|
28
28
|
* The most calls one batch can have. Set it to the server's
|
|
29
|
-
* `maxBatchSize`
|
|
29
|
+
* `maxBatchSize` or lower.
|
|
30
30
|
* @see https://trpc.io/docs/client/links/httpBatchLink#limiting-batch-size
|
|
31
31
|
* @default Infinity
|
|
32
32
|
*/
|
|
@@ -43,4 +43,4 @@ type HTTPBatchLinkOptions<TRoot extends AnyClientTypes> = HTTPLinkBaseOptions<TR
|
|
|
43
43
|
declare function httpBatchLink<TRouter extends AnyRouter$1>(opts: HTTPBatchLinkOptions<TRouter['_def']['_config']['$types']>): TRPCLink<TRouter>;
|
|
44
44
|
//#endregion
|
|
45
45
|
export { HTTPBatchLinkOptions as n, httpBatchLink as t };
|
|
46
|
-
//# sourceMappingURL=httpBatchLink-
|
|
46
|
+
//# sourceMappingURL=httpBatchLink-Dxqsu9CE.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpBatchLink-
|
|
1
|
+
{"version":3,"file":"httpBatchLink-Dxqsu9CE.d.mts","names":[],"sources":["../src/links/HTTPBatchLinkOptions.ts","../src/links/httpBatchLink.ts"],"mappings":";;;;;;;;;KASY,qBAAqB,cAAc,kBAC7C,oBAAoB;;;;;;;;EAQlB;;;;;;EAMA,UACI,gBACE;IACA,QAAQ,cAAc;QAClB,cAAc,QAAQ;;;;;;;EAQhC;;;;;;;;;;iBCVY,cAAc,gBAAgB,aAC5C,MAAM,qBAAqB,wCAC1B,SAAS"}
|
package/dist/index.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import { t as TRPCConnectionState } from "./subscriptions-DcqRZc4h.cjs";
|
|
|
2
2
|
import { a as OperationResultEnvelope, c as TRPCClientRuntime, d as TRPCClientError, f as TRPCClientErrorBase, g as NativeFetchEsque, h as FetchEsque, i as OperationLink, l as TRPCFetch, m as isTRPCClientError, n as Operation, o as OperationResultObservable, p as TRPCClientErrorLike, r as OperationContext, s as OperationResultObserver, t as HTTPHeaders, u as TRPCLink, v as TRPCProcedureOptions } from "./types-BrCJd1zp.cjs";
|
|
3
3
|
import { n as TransformerOptions } from "./unstable-internals-CNoyg7Yf.cjs";
|
|
4
4
|
import { t as HTTPLinkBaseOptions } from "./httpUtils-CvL7UM_P.cjs";
|
|
5
|
-
import { n as HTTPBatchLinkOptions, t as httpBatchLink } from "./httpBatchLink-
|
|
5
|
+
import { n as HTTPBatchLinkOptions, t as httpBatchLink } from "./httpBatchLink-Dp4tIBfy.cjs";
|
|
6
6
|
import { n as httpLink, t as HTTPLinkOptions } from "./httpLink-DpCm7qgx.cjs";
|
|
7
7
|
import { n as loggerLink, t as LoggerLinkOptions } from "./loggerLink-BEMtA7V5.cjs";
|
|
8
8
|
import { t as splitLink } from "./splitLink-i7EskO_m.cjs";
|
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { t as TRPCConnectionState } from "./subscriptions-DcqRZc4h.mjs";
|
|
|
2
2
|
import { a as OperationResultEnvelope, c as TRPCClientRuntime, d as TRPCClientError, f as TRPCClientErrorBase, g as NativeFetchEsque, h as FetchEsque, i as OperationLink, l as TRPCFetch, m as isTRPCClientError, n as Operation, o as OperationResultObservable, p as TRPCClientErrorLike, r as OperationContext, s as OperationResultObserver, t as HTTPHeaders, u as TRPCLink, v as TRPCProcedureOptions } from "./types-DO-GCB2q.mjs";
|
|
3
3
|
import { n as TransformerOptions } from "./unstable-internals-CNoyg7Yf.mjs";
|
|
4
4
|
import { t as HTTPLinkBaseOptions } from "./httpUtils-BAwJ9mb3.mjs";
|
|
5
|
-
import { n as HTTPBatchLinkOptions, t as httpBatchLink } from "./httpBatchLink-
|
|
5
|
+
import { n as HTTPBatchLinkOptions, t as httpBatchLink } from "./httpBatchLink-Dxqsu9CE.mjs";
|
|
6
6
|
import { n as httpLink, t as HTTPLinkOptions } from "./httpLink-Cd3n7PrK.mjs";
|
|
7
7
|
import { n as loggerLink, t as LoggerLinkOptions } from "./loggerLink-Daki_B65.mjs";
|
|
8
8
|
import { t as splitLink } from "./splitLink-zyV5y7N1.mjs";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as httpBatchLink } from "../httpBatchLink-
|
|
1
|
+
import { t as httpBatchLink } from "../httpBatchLink-Dp4tIBfy.cjs";
|
|
2
2
|
export { httpBatchLink };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as httpBatchLink } from "../httpBatchLink-
|
|
1
|
+
import { t as httpBatchLink } from "../httpBatchLink-Dxqsu9CE.mjs";
|
|
2
2
|
export { httpBatchLink };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/client",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "11.
|
|
4
|
+
"version": "11.24.0",
|
|
5
5
|
"description": "The tRPC client library",
|
|
6
6
|
"author": "KATT",
|
|
7
7
|
"license": "MIT",
|
|
@@ -106,12 +106,12 @@
|
|
|
106
106
|
"skills"
|
|
107
107
|
],
|
|
108
108
|
"peerDependencies": {
|
|
109
|
-
"@trpc/server": "11.
|
|
109
|
+
"@trpc/server": "11.24.0",
|
|
110
110
|
"typescript": ">=5.7.2"
|
|
111
111
|
},
|
|
112
112
|
"devDependencies": {
|
|
113
113
|
"@tanstack/intent": "0.5.6",
|
|
114
|
-
"@trpc/server": "
|
|
114
|
+
"@trpc/server": "workspace:*",
|
|
115
115
|
"@types/isomorphic-fetch": "^0.0.39",
|
|
116
116
|
"@types/node": "^24.13.4",
|
|
117
117
|
"dataloader": "^2.2.2",
|
|
@@ -134,5 +134,5 @@
|
|
|
134
134
|
"keywords": [
|
|
135
135
|
"tanstack-intent"
|
|
136
136
|
],
|
|
137
|
-
"gitHead": "
|
|
137
|
+
"gitHead": "b147c52e0a6af43a8d735d24bc3d5ef6c7cd42ed"
|
|
138
138
|
}
|
package/skills/links/SKILL.md
CHANGED
|
@@ -17,7 +17,7 @@ sources:
|
|
|
17
17
|
metadata:
|
|
18
18
|
type: core
|
|
19
19
|
library: trpc
|
|
20
|
-
library_version: 11.
|
|
20
|
+
library_version: 11.24.0
|
|
21
21
|
---
|
|
22
22
|
|
|
23
23
|
<!-- Generated from www/v11/docs/client/links.md by www/build/skills.ts. Edit the docs instead. -->
|
|
@@ -155,7 +155,7 @@ For an example use case, see [Disable batching for certain requests](https://trp
|
|
|
155
155
|
- **Sending subscriptions through `httpLink`, `httpBatchLink` or `httpBatchStreamLink`.** They throw on subscriptions. Route them to `httpSubscriptionLink` or `wsLink` with a `splitLink`, as shown in [The terminating link](https://trpc.io/docs/client/links#the-terminating-link).
|
|
156
156
|
- **Returning an async generator from a query through `httpLink` or `httpBatchLink`.** The server responds with `Cannot use stream-like response in non-streaming request - use httpBatchStreamLink`.
|
|
157
157
|
- **Reading `op` in a batch link's `headers` callback.** `httpBatchLink` and `httpBatchStreamLink` call `headers({ opList })` once per batch, with all its operations. Only `httpLink` gets a single `{ op }`.
|
|
158
|
-
- **Unbounded batches.** `maxURLLength` and `maxItems` default to `Infinity`. If long URLs hit limits in your server or CDN, set `maxURLLength`.
|
|
158
|
+
- **Unbounded batches.** `maxURLLength` and `maxItems` default to `Infinity`. If long URLs hit limits in your server or CDN, set `maxURLLength`. If the server sets `maxBatchSize`, set `maxItems` to the same or a lower value, or larger batches are rejected with `400 Bad Request`. See [`httpBatchLink`](https://trpc.io/docs/client/links/httpBatchLink#setting-a-maximum-url-length).
|
|
159
159
|
- **Forgetting the transformer on one link.** If your server uses a [data transformer](https://trpc.io/docs/server/data-transformers), every terminating link needs the same `transformer`, in every `splitLink` branch.
|
|
160
160
|
|
|
161
161
|
## References
|
|
@@ -114,8 +114,6 @@ const client = createTRPCClient<AppRouter>({
|
|
|
114
114
|
|
|
115
115
|
`maxBatchSize` limits how many operations may be sent in a single batch request. Requests exceeding this limit will be rejected with a `400 Bad Request` error. This can be passed to any tRPC adapter.
|
|
116
116
|
|
|
117
|
-
It defaults to `100`. Set a lower number to tighten it, a higher one to allow larger batches, or `Infinity` to turn the limit off.
|
|
118
|
-
|
|
119
117
|
```ts no-check title="server.ts"
|
|
120
118
|
import { createHTTPServer } from '@trpc/server/adapters/standalone';
|
|
121
119
|
import { appRouter } from './router';
|
|
@@ -140,7 +138,7 @@ export default createNextApiHandler({
|
|
|
140
138
|
|
|
141
139
|
### 2. Set a matching limit on the client:
|
|
142
140
|
|
|
143
|
-
Use the `maxItems` option on your batch link to ensure the client doesn't exceed the server's limit. This splits large batches into multiple HTTP requests automatically
|
|
141
|
+
Use the `maxItems` option on your batch link to ensure the client doesn't exceed the server's limit. This splits large batches into multiple HTTP requests automatically
|
|
144
142
|
|
|
145
143
|
```ts title="client/index.ts"
|
|
146
144
|
import { createTRPCClient, httpBatchLink } from '@trpc/client';
|
|
@@ -30,7 +30,7 @@ export type HTTPBatchLinkOptions<TRoot extends AnyClientTypes> =
|
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* The most calls one batch can have. Set it to the server's
|
|
33
|
-
* `maxBatchSize`
|
|
33
|
+
* `maxBatchSize` or lower.
|
|
34
34
|
* @see https://trpc.io/docs/client/links/httpBatchLink#limiting-batch-size
|
|
35
35
|
* @default Infinity
|
|
36
36
|
*/
|