@trpc/server 11.15.2-canary.2 → 11.15.2-canary.3
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/package.json +2 -2
- package/skills/adapter-aws-lambda/SKILL.md +16 -1
- package/skills/adapter-express/SKILL.md +25 -1
- package/skills/adapter-fastify/SKILL.md +16 -1
- package/skills/adapter-fetch/SKILL.md +23 -1
- package/skills/adapter-standalone/SKILL.md +15 -1
- package/skills/auth/SKILL.md +1 -1
- package/skills/caching/SKILL.md +1 -1
- package/skills/error-handling/SKILL.md +1 -1
- package/skills/middlewares/SKILL.md +1 -1
- package/skills/non-json-content-types/SKILL.md +1 -1
- package/skills/server-setup/SKILL.md +1 -1
- package/skills/server-side-calls/SKILL.md +1 -1
- package/skills/service-oriented-architecture/SKILL.md +1 -1
- package/skills/subscriptions/SKILL.md +1 -1
- package/skills/trpc-router/SKILL.md +1 -1
- package/skills/validators/SKILL.md +1 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@trpc/server",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "11.15.2-canary.
|
|
5
|
+
"version": "11.15.2-canary.3+c4b1d7458",
|
|
6
6
|
"description": "The tRPC server library",
|
|
7
7
|
"author": "KATT",
|
|
8
8
|
"license": "MIT",
|
|
@@ -238,5 +238,5 @@
|
|
|
238
238
|
"bin": {
|
|
239
239
|
"intent": "./bin/intent.js"
|
|
240
240
|
},
|
|
241
|
-
"gitHead": "
|
|
241
|
+
"gitHead": "c4b1d7458ec869f6c51469f7fcd84b517d53ffae"
|
|
242
242
|
}
|
|
@@ -9,7 +9,7 @@ description: >
|
|
|
9
9
|
context for context creation.
|
|
10
10
|
type: core
|
|
11
11
|
library: trpc
|
|
12
|
-
library_version: '11.
|
|
12
|
+
library_version: '11.15.1'
|
|
13
13
|
requires:
|
|
14
14
|
- server-setup
|
|
15
15
|
sources:
|
|
@@ -122,6 +122,21 @@ export const appRouter = t.router({
|
|
|
122
122
|
|
|
123
123
|
Pair with `httpBatchStreamLink` on the client for streamed responses.
|
|
124
124
|
|
|
125
|
+
### Limiting batch size with maxBatchSize
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
import { awsLambdaRequestHandler } from '@trpc/server/adapters/aws-lambda';
|
|
129
|
+
import { appRouter } from './router';
|
|
130
|
+
|
|
131
|
+
export const handler = awsLambdaRequestHandler({
|
|
132
|
+
router: appRouter,
|
|
133
|
+
createContext,
|
|
134
|
+
maxBatchSize: 10,
|
|
135
|
+
});
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Requests batching more than `maxBatchSize` operations are rejected with a `400 Bad Request` error. Set `maxItems` on your client's `httpBatchLink` to the same value to avoid exceeding the limit.
|
|
139
|
+
|
|
125
140
|
## Common Mistakes
|
|
126
141
|
|
|
127
142
|
### HIGH Using httpBatchLink with per-procedure API Gateway resources
|
|
@@ -7,7 +7,7 @@ description: >
|
|
|
7
7
|
Avoid global express.json() conflicting with tRPC body parsing for FormData.
|
|
8
8
|
type: core
|
|
9
9
|
library: trpc
|
|
10
|
-
library_version: '11.
|
|
10
|
+
library_version: '11.15.1'
|
|
11
11
|
requires:
|
|
12
12
|
- server-setup
|
|
13
13
|
sources:
|
|
@@ -107,6 +107,30 @@ app.use(
|
|
|
107
107
|
app.listen(4000);
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
+
### Limiting batch size with maxBatchSize
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
import * as trpcExpress from '@trpc/server/adapters/express';
|
|
114
|
+
import express from 'express';
|
|
115
|
+
import { createContext } from './context';
|
|
116
|
+
import { appRouter } from './router';
|
|
117
|
+
|
|
118
|
+
const app = express();
|
|
119
|
+
|
|
120
|
+
app.use(
|
|
121
|
+
'/trpc',
|
|
122
|
+
trpcExpress.createExpressMiddleware({
|
|
123
|
+
router: appRouter,
|
|
124
|
+
createContext,
|
|
125
|
+
maxBatchSize: 10,
|
|
126
|
+
}),
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
app.listen(4000);
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Requests batching more than `maxBatchSize` operations are rejected with a `400 Bad Request` error. Set `maxItems` on your client's `httpBatchLink` to the same value to avoid exceeding the limit.
|
|
133
|
+
|
|
110
134
|
## Common Mistakes
|
|
111
135
|
|
|
112
136
|
### HIGH Global express.json() consuming tRPC request body
|
|
@@ -9,7 +9,7 @@ description: >
|
|
|
9
9
|
CreateFastifyContextOptions provides req, res.
|
|
10
10
|
type: core
|
|
11
11
|
library: trpc
|
|
12
|
-
library_version: '11.
|
|
12
|
+
library_version: '11.15.1'
|
|
13
13
|
requires:
|
|
14
14
|
- server-setup
|
|
15
15
|
sources:
|
|
@@ -132,6 +132,21 @@ server.register(fastifyTRPCPlugin, {
|
|
|
132
132
|
|
|
133
133
|
Due to Fastify plugin type inference limitations, use `satisfies FastifyTRPCPluginOptions<AppRouter>['trpcOptions']` to get correct types on `onError` and other callbacks.
|
|
134
134
|
|
|
135
|
+
### Limiting batch size with maxBatchSize
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
server.register(fastifyTRPCPlugin, {
|
|
139
|
+
prefix: '/trpc',
|
|
140
|
+
trpcOptions: {
|
|
141
|
+
router: appRouter,
|
|
142
|
+
createContext,
|
|
143
|
+
maxBatchSize: 10,
|
|
144
|
+
} satisfies FastifyTRPCPluginOptions<AppRouter>['trpcOptions'],
|
|
145
|
+
});
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Requests batching more than `maxBatchSize` operations are rejected with a `400 Bad Request` error. Set `maxItems` on your client's `httpBatchLink` to the same value to avoid exceeding the limit.
|
|
149
|
+
|
|
135
150
|
## Common Mistakes
|
|
136
151
|
|
|
137
152
|
### HIGH Registering @fastify/websocket after tRPC plugin
|
|
@@ -8,7 +8,7 @@ description: >
|
|
|
8
8
|
must match the URL path prefix where the handler is mounted.
|
|
9
9
|
type: core
|
|
10
10
|
library: trpc
|
|
11
|
-
library_version: '11.
|
|
11
|
+
library_version: '11.15.1'
|
|
12
12
|
requires:
|
|
13
13
|
- server-setup
|
|
14
14
|
sources:
|
|
@@ -135,6 +135,28 @@ Deno.serve((request) => {
|
|
|
135
135
|
});
|
|
136
136
|
```
|
|
137
137
|
|
|
138
|
+
### Limiting batch size with maxBatchSize
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
import { fetchRequestHandler } from '@trpc/server/adapters/fetch';
|
|
142
|
+
import { createContext } from './context';
|
|
143
|
+
import { appRouter } from './router';
|
|
144
|
+
|
|
145
|
+
export default {
|
|
146
|
+
async fetch(request: Request): Promise<Response> {
|
|
147
|
+
return fetchRequestHandler({
|
|
148
|
+
endpoint: '/trpc',
|
|
149
|
+
req: request,
|
|
150
|
+
router: appRouter,
|
|
151
|
+
createContext,
|
|
152
|
+
maxBatchSize: 10,
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Requests batching more than `maxBatchSize` operations are rejected with a `400 Bad Request` error. Set `maxItems` on your client's `httpBatchLink` to the same value to avoid exceeding the limit.
|
|
159
|
+
|
|
138
160
|
## Common Mistakes
|
|
139
161
|
|
|
140
162
|
### HIGH Mismatched endpoint path in fetchRequestHandler
|
|
@@ -8,7 +8,7 @@ description: >
|
|
|
8
8
|
provides req and res for context creation.
|
|
9
9
|
type: core
|
|
10
10
|
library: trpc
|
|
11
|
-
library_version: '11.
|
|
11
|
+
library_version: '11.15.1'
|
|
12
12
|
requires:
|
|
13
13
|
- server-setup
|
|
14
14
|
sources:
|
|
@@ -143,6 +143,20 @@ const server = http2.createSecureServer(
|
|
|
143
143
|
server.listen(3001);
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
+
### Limiting batch size with maxBatchSize
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
import { createHTTPServer } from '@trpc/server/adapters/standalone';
|
|
150
|
+
import { appRouter } from './router';
|
|
151
|
+
|
|
152
|
+
createHTTPServer({
|
|
153
|
+
router: appRouter,
|
|
154
|
+
maxBatchSize: 10,
|
|
155
|
+
}).listen(3000);
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Requests batching more than `maxBatchSize` operations are rejected with a `400 Bad Request` error. Set `maxItems` on your client's `httpBatchLink` to the same value to avoid exceeding the limit.
|
|
159
|
+
|
|
146
160
|
## Common Mistakes
|
|
147
161
|
|
|
148
162
|
### HIGH No CORS configuration for cross-origin requests
|
package/skills/auth/SKILL.md
CHANGED
package/skills/caching/SKILL.md
CHANGED