opinionated-machine 8.0.0 → 10.0.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/CHANGELOG.md +90 -0
- package/README.md +117 -6
- package/dist/lib/DIContext.js +33 -27
- package/dist/lib/DIContext.js.map +1 -1
- package/dist/lib/dualmode/AbstractDualModeController.d.ts +1 -1
- package/dist/lib/dualmode/AbstractDualModeController.js +1 -1
- package/dist/lib/gateway/gatewayMetadata.d.ts +0 -5
- package/dist/lib/gateway/gatewayMetadata.js +0 -1
- package/dist/lib/gateway/gatewayMetadata.js.map +1 -1
- package/dist/lib/gateway/manifest/manifestSchema.d.ts +0 -10
- package/dist/lib/routes/fastifyRouteBuilder.js +102 -33
- package/dist/lib/routes/fastifyRouteBuilder.js.map +1 -1
- package/dist/lib/routes/fastifyRouteTypes.d.ts +97 -12
- package/dist/lib/routes/fastifyRouteTypes.js.map +1 -1
- package/dist/lib/routes/fastifyRouteUtils.js +15 -5
- package/dist/lib/routes/fastifyRouteUtils.js.map +1 -1
- package/dist/lib/routes/index.d.ts +2 -1
- package/dist/lib/routes/index.js +2 -0
- package/dist/lib/routes/index.js.map +1 -1
- package/dist/lib/routes/sseResponseSchema.d.ts +35 -0
- package/dist/lib/routes/sseResponseSchema.js +115 -0
- package/dist/lib/routes/sseResponseSchema.js.map +1 -0
- package/dist/lib/sse/AbstractSSEController.d.ts +1 -1
- package/dist/lib/sse/AbstractSSEController.js +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,95 @@
|
|
|
1
1
|
# opinionated-machine
|
|
2
2
|
|
|
3
|
+
## 10.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- d06517a: Replace the silently-ignored per-route `heartbeatInterval` SSE option with `heartbeat: boolean`.
|
|
8
|
+
|
|
9
|
+
`@fastify/sse` has no per-route `heartbeatInterval`: the route-level knob is `heartbeat`, a boolean
|
|
10
|
+
that can only turn the heartbeat off, while the interval is a plugin-registration option shared by
|
|
11
|
+
all routes. The route builder was copying `heartbeatInterval` onto the route's `sse` option, where
|
|
12
|
+
the plugin never read it — so `buildHandler(contract, handlers, { heartbeatInterval: 5000 })`
|
|
13
|
+
type-checked, ran, and did nothing, and there was no way to disable the heartbeat for a single route.
|
|
14
|
+
|
|
15
|
+
Breaking changes:
|
|
16
|
+
|
|
17
|
+
- `FastifySSERouteOptions` / `FastifyDualModeRouteOptions`: `heartbeatInterval?: number` is replaced
|
|
18
|
+
by `heartbeat?: boolean`. Set `heartbeat: false` to suppress heartbeat comments on a route.
|
|
19
|
+
- `RegisterSSERoutesOptions` / `RegisterDualModeRoutesOptions`: `heartbeatInterval?: number` is
|
|
20
|
+
likewise replaced by `heartbeat?: boolean`. These options are applied to individual routes, not to
|
|
21
|
+
plugin registration, so they could never carry an interval either.
|
|
22
|
+
|
|
23
|
+
Configure the interval where it actually works, once for all routes:
|
|
24
|
+
`app.register(fastifySSE, { heartbeatInterval: 30000 })`.
|
|
25
|
+
|
|
26
|
+
Also fixes the registration-level `heartbeat` / `serializer` defaults from `registerSSERoutes()` and
|
|
27
|
+
`registerDualModeRoutes()`, which were written to `config.sse` — a location `@fastify/sse` never
|
|
28
|
+
reads — and are now merged into the top-level `sse` route option, with per-route values taking
|
|
29
|
+
precedence.
|
|
30
|
+
|
|
31
|
+
### Minor Changes
|
|
32
|
+
|
|
33
|
+
- e935a42: Register SSE and dual-mode routes with an explicit `@fastify/sse` kind of `'manual'` instead of falling back to the plugin's `'legacy'` kind.
|
|
34
|
+
|
|
35
|
+
Previously `buildFastifyRoute` emitted `sse: true` (or an options object without `kind`), which resolves to `'legacy'` and applies a strict `Accept` gate: a client that did not send an explicit `text/event-stream` token — a wildcard `Accept` header, `Accept: application/json`, or no `Accept` header at all — reached the SSE handler with `reply.sse` undefined, so the first `sse.start()` threw and the request returned a 500. The same applied to dual-mode routes configured with `defaultMode: 'sse'`. With `'manual'` there is no plugin-side negotiation: `reply.sse` is always attached and the handler decides whether to stream, which is what these route handlers already do.
|
|
36
|
+
|
|
37
|
+
Adds a `kind` route option so the default can be overridden, restricted per route type to the kinds that can actually work:
|
|
38
|
+
|
|
39
|
+
- SSE-only routes accept `'manual' | 'only'` (`SSEOnlyRouteKind`). `'only'` makes the plugin content-negotiate and answer `406 Not Acceptable` before the handler runs; note its gate admits a missing `Accept` header and the `*/*` and `text/*` wildcards but rejects every other concrete media type, `application/json` included.
|
|
40
|
+
- Dual-mode routes accept `'manual' | 'dual'` (`DualModeRouteKind`). Combining `kind: 'dual'` with `defaultMode: 'sse'` now throws at route-build time instead of returning a 500 per request, because the plugin's gate and the handler's own `determineMode()` disagree for wildcard or absent `Accept` headers.
|
|
41
|
+
|
|
42
|
+
Also stops the SSE teardown path from masking errors: `closeSSESession` re-read `reply.sse.isConnected` from inside its own `catch`, which raised a second `TypeError` and replaced the original failure, and `sse.start()` now marks the session started only after its first successful `reply.sse` access.
|
|
43
|
+
|
|
44
|
+
## 9.1.0
|
|
45
|
+
|
|
46
|
+
### Minor Changes
|
|
47
|
+
|
|
48
|
+
- a806edc: Document SSE and dual-mode route responses in the generated OpenAPI spec.
|
|
49
|
+
|
|
50
|
+
`buildFastifyRoute` left `schema.response` empty for `AbstractSSEController` and
|
|
51
|
+
`AbstractDualModeController` routes, so the spec showed a bare "Default Response" with no
|
|
52
|
+
event shapes and no error bodies, even though the same contract data was already used for
|
|
53
|
+
runtime validation. Both builders now derive `schema.response` from the contract: 200
|
|
54
|
+
describes the event stream under `text/event-stream` (one `{ id?, event, data, retry? }`
|
|
55
|
+
envelope per event, as a `oneOf` with the event name pinned to a `const`, matching what
|
|
56
|
+
`@lokalise/fastify-api-contracts` emits for `sseBody()`) plus the JSON body under
|
|
57
|
+
`application/json`, and each status in `responseBodySchemasByStatusCode` gets its declared
|
|
58
|
+
schema.
|
|
59
|
+
|
|
60
|
+
Statuses that more than one body shape can reach accept all of them, since Fastify rejects
|
|
61
|
+
anything the schema does not cover: a dual-mode 2xx accepts both `successResponseBodySchema`
|
|
62
|
+
(the `sync` handler) and the schema declared for that status (`sse.respond()`), and a non-2xx
|
|
63
|
+
accepts the framework error envelope alongside the declared body, so declaring a 400 no longer
|
|
64
|
+
turns a failed request validation into a 500. Errors the builders raise themselves before
|
|
65
|
+
streaming starts are sent pre-serialized and skip the schema, keeping the thrown error's
|
|
66
|
+
message intact.
|
|
67
|
+
|
|
68
|
+
This puts Fastify's serializer in the path for the status codes a contract declares. A
|
|
69
|
+
response body that previously went out through plain `JSON.stringify` is now serialized
|
|
70
|
+
against its contract schema, so keys the schema does not declare are dropped.
|
|
71
|
+
|
|
72
|
+
## 9.0.0
|
|
73
|
+
|
|
74
|
+
### Major Changes
|
|
75
|
+
|
|
76
|
+
- d6da03e: Adopt mandatory contract visibility (`@lokalise/api-contracts` v8):
|
|
77
|
+
|
|
78
|
+
- Raise peer dependency floors to `@lokalise/api-contracts` >= 8.0.0 (visibility is now a required
|
|
79
|
+
field of every contract builder config) and `@lokalise/fastify-api-contracts` >= 7.0.0.
|
|
80
|
+
- Derive the fastify-swagger `hide` flag from contract `visibility` in the SSE and dual-mode route
|
|
81
|
+
builders, failing closed: only `visibility: 'public'` contracts appear in generated OpenAPI docs.
|
|
82
|
+
Anything else — `'internal'`, or a contract that lacks the field at runtime because it was compiled
|
|
83
|
+
against a pre-visibility `@lokalise/api-contracts` — sets `schema.hide: true` and is excluded,
|
|
84
|
+
matching `@lokalise/fastify-api-contracts`. The same builders now also map the contract's
|
|
85
|
+
`description`, `summary` and `tags` to the route schema; previously these fields were dropped and
|
|
86
|
+
the routes appeared undocumented.
|
|
87
|
+
- Remove the unused `visibility` field from the gateway metadata schema. No generator consumed it
|
|
88
|
+
and it collided with the (unrelated) contract `visibility` — a docs-internal BFF route can still
|
|
89
|
+
be gateway-public, so the two concepts cannot be derived from each other. If gateway-level
|
|
90
|
+
exposure classification is needed later, it will be reintroduced under a non-colliding name
|
|
91
|
+
(e.g. `exposure`). The metadata schema is strict, so passing `visibility` now fails loudly.
|
|
92
|
+
|
|
3
93
|
## 8.0.0
|
|
4
94
|
|
|
5
95
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -475,6 +475,7 @@ const PATH_PARAMS_SCHEMA = z.object({
|
|
|
475
475
|
})
|
|
476
476
|
|
|
477
477
|
const contract = buildRestContract({
|
|
478
|
+
visibility: 'public',
|
|
478
479
|
method: 'delete',
|
|
479
480
|
successResponseBodySchema: BODY_SCHEMA,
|
|
480
481
|
requestPathParamsSchema: PATH_PARAMS_SCHEMA,
|
|
@@ -731,6 +732,13 @@ const app = fastify()
|
|
|
731
732
|
await app.register(FastifySSEPlugin)
|
|
732
733
|
```
|
|
733
734
|
|
|
735
|
+
Plugin-level options apply to every SSE route. The heartbeat interval is set here and only
|
|
736
|
+
here - it is not a per-route option:
|
|
737
|
+
|
|
738
|
+
```ts
|
|
739
|
+
await app.register(FastifySSEPlugin, { heartbeatInterval: 30000 })
|
|
740
|
+
```
|
|
741
|
+
|
|
734
742
|
### Defining SSE Contracts
|
|
735
743
|
|
|
736
744
|
Use `buildSseContract` from `@lokalise/api-contracts` to define SSE routes. The `method` field determines the HTTP method. Paths are defined using `pathResolver`, a type-safe function that receives typed params and returns the URL path:
|
|
@@ -741,6 +749,7 @@ import { buildSseContract } from '@lokalise/api-contracts'
|
|
|
741
749
|
|
|
742
750
|
// GET-based SSE stream with path params
|
|
743
751
|
export const channelStreamContract = buildSseContract({
|
|
752
|
+
visibility: 'public',
|
|
744
753
|
method: 'get',
|
|
745
754
|
pathResolver: (params) => `/api/channels/${params.channelId}/stream`,
|
|
746
755
|
requestPathParamsSchema: z.object({ channelId: z.string() }),
|
|
@@ -753,6 +762,7 @@ export const channelStreamContract = buildSseContract({
|
|
|
753
762
|
|
|
754
763
|
// GET-based SSE stream without path params
|
|
755
764
|
export const notificationsContract = buildSseContract({
|
|
765
|
+
visibility: 'public',
|
|
756
766
|
method: 'get',
|
|
757
767
|
pathResolver: () => '/api/notifications/stream',
|
|
758
768
|
requestPathParamsSchema: z.object({}),
|
|
@@ -768,6 +778,7 @@ export const notificationsContract = buildSseContract({
|
|
|
768
778
|
|
|
769
779
|
// POST-based SSE stream (e.g., AI chat completions)
|
|
770
780
|
export const chatCompletionContract = buildSseContract({
|
|
781
|
+
visibility: 'public',
|
|
771
782
|
method: 'post',
|
|
772
783
|
pathResolver: () => '/api/chat/completions',
|
|
773
784
|
requestPathParamsSchema: z.object({}),
|
|
@@ -1097,7 +1108,8 @@ private handleAdminStream = buildHandler(adminStreamContract, {
|
|
|
1097
1108
|
| `onReconnect` | Handle Last-Event-ID reconnection, return events to replay |
|
|
1098
1109
|
| `logger` | Optional `SSELogger` for error handling (compatible with pino and `@lokalise/node-core`). If not provided, errors in lifecycle hooks are silently ignored |
|
|
1099
1110
|
| `serializer` | Custom serializer for SSE data (e.g., for custom JSON encoding) |
|
|
1100
|
-
| `
|
|
1111
|
+
| `heartbeat` | Set to `false` to disable heartbeat keep-alive comments for this route. The *interval* is not per-route — configure it once via `app.register(fastifySSE, { heartbeatInterval })` |
|
|
1112
|
+
| `kind` | `@fastify/sse` route kind - how the `Accept` header is negotiated. Defaults to `'manual'` (see below) |
|
|
1101
1113
|
| `contractMetadataToRouteMapper` | Maps contract metadata to Fastify route options (see below) |
|
|
1102
1114
|
|
|
1103
1115
|
**onClose reason parameter:**
|
|
@@ -1112,10 +1124,65 @@ options: {
|
|
|
1112
1124
|
// reason is 'server' or 'client'
|
|
1113
1125
|
},
|
|
1114
1126
|
serializer: (data) => JSON.stringify(data, null, 2), // Pretty-print JSON
|
|
1115
|
-
|
|
1127
|
+
heartbeat: false, // Disable heartbeat comments on this route
|
|
1116
1128
|
}
|
|
1117
1129
|
```
|
|
1118
1130
|
|
|
1131
|
+
The heartbeat *interval* is not a route option - `@fastify/sse` only exposes a boolean at route
|
|
1132
|
+
level, and reads the interval once, when the plugin is registered, applying it to every SSE route:
|
|
1133
|
+
|
|
1134
|
+
```ts
|
|
1135
|
+
await app.register(FastifySSEPlugin, { heartbeatInterval: 30000 })
|
|
1136
|
+
```
|
|
1137
|
+
|
|
1138
|
+
#### `kind` and `Accept` header negotiation
|
|
1139
|
+
|
|
1140
|
+
Routes are registered with the `@fastify/sse` kind `'manual'`, which means the plugin performs **no**
|
|
1141
|
+
`Accept` header negotiation: `reply.sse` is always attached and the route handler decides at runtime
|
|
1142
|
+
whether to stream or to send a regular HTTP response.
|
|
1143
|
+
|
|
1144
|
+
This matters because SSE handlers built with `buildHandler` have a single code path that calls
|
|
1145
|
+
`sse.start()`. Clients that do not send an explicit `Accept: text/event-stream` token - a wildcard
|
|
1146
|
+
`Accept` header (the default for most non-browser HTTP clients), `Accept: application/json`, or no
|
|
1147
|
+
`Accept` header at all (typical of clients generated from the route's OpenAPI spec) - would otherwise
|
|
1148
|
+
reach the handler with `reply.sse` left undefined and get a `500` instead of a stream. It also keeps
|
|
1149
|
+
`sse.respond()` early returns available to every client. Dual-mode routes negotiate the `Accept`
|
|
1150
|
+
header themselves (honouring `defaultMode`), so they use the same kind.
|
|
1151
|
+
|
|
1152
|
+
Each route type accepts only the kinds that can actually work for it:
|
|
1153
|
+
|
|
1154
|
+
**SSE-only routes** - `'manual' | 'only'`
|
|
1155
|
+
|
|
1156
|
+
| Kind | Behavior |
|
|
1157
|
+
| ---- | -------- |
|
|
1158
|
+
| `'manual'` (default) | No negotiation. `reply.sse` is always attached, the handler decides |
|
|
1159
|
+
| `'only'` | The plugin gates on `Accept` and answers `406 Not Acceptable` before the handler runs. A missing `Accept` header and the wildcards `*/*` and `text/*` pass; **every other concrete media type is rejected**, `application/json` included - so `sse.respond()` early returns become unreachable for JSON clients |
|
|
1160
|
+
|
|
1161
|
+
**Dual-mode routes** - `'manual' | 'dual'`
|
|
1162
|
+
|
|
1163
|
+
| Kind | Behavior |
|
|
1164
|
+
| ---- | -------- |
|
|
1165
|
+
| `'manual'` (default) | No plugin-side negotiation. The route's own `determineMode()` picks the mode, honouring `defaultMode` |
|
|
1166
|
+
| `'dual'` | The plugin gates first: only an explicit `text/event-stream` token admits SSE, everything else reaches the handler with `reply.sse` undefined. Sound only with `defaultMode: 'json'` - pairing it with `defaultMode: 'sse'` is rejected at route-build time, because a wildcard or absent `Accept` header would select the SSE branch after the plugin already declined to attach the stream |
|
|
1167
|
+
|
|
1168
|
+
The plugin's other kinds are deliberately not exposed: `'dual'` on an SSE-only route (and the
|
|
1169
|
+
`sse: true` `'legacy'` default) can only ever leave a single-code-path handler without `reply.sse`,
|
|
1170
|
+
and `'only'` on a dual-mode route would make the JSON half unreachable.
|
|
1171
|
+
|
|
1172
|
+
Override it per route when you want different semantics:
|
|
1173
|
+
|
|
1174
|
+
```ts
|
|
1175
|
+
private handleAdminStream = buildHandler(adminStreamContract, {
|
|
1176
|
+
sse: async (request, sse) => {
|
|
1177
|
+
const session = sse.start('keepAlive')
|
|
1178
|
+
// ... handler logic
|
|
1179
|
+
},
|
|
1180
|
+
}, {
|
|
1181
|
+
// Content-negotiate: anything that does not accept text/event-stream gets 406 Not Acceptable
|
|
1182
|
+
kind: 'only',
|
|
1183
|
+
})
|
|
1184
|
+
```
|
|
1185
|
+
|
|
1119
1186
|
#### `contractMetadataToRouteMapper`
|
|
1120
1187
|
|
|
1121
1188
|
Allows attaching cross-cutting behavior (auth, rate limiting, tracing, etc.) to a route based on metadata defined in the
|
|
@@ -1128,6 +1195,7 @@ The mapper can return any of: `config`, `bodyLimit`, `onRequest`, `preParsing`,
|
|
|
1128
1195
|
```ts
|
|
1129
1196
|
// In the contract definition
|
|
1130
1197
|
const adminStreamContract = buildSseContract({
|
|
1198
|
+
visibility: 'public',
|
|
1131
1199
|
method: 'get',
|
|
1132
1200
|
pathResolver: () => '/api/admin/stream',
|
|
1133
1201
|
// ...schemas...
|
|
@@ -1521,6 +1589,7 @@ import { z } from 'zod'
|
|
|
1521
1589
|
import { injectSSE } from 'opinionated-machine'
|
|
1522
1590
|
|
|
1523
1591
|
const streamContract = buildSseContract({
|
|
1592
|
+
visibility: 'public',
|
|
1524
1593
|
method: 'get',
|
|
1525
1594
|
pathResolver: () => '/api/stream',
|
|
1526
1595
|
requestQuerySchema: z.object({}),
|
|
@@ -2262,6 +2331,7 @@ import { buildSseContract } from '@lokalise/api-contracts'
|
|
|
2262
2331
|
|
|
2263
2332
|
// GET dual-mode route (polling or streaming job status)
|
|
2264
2333
|
export const jobStatusContract = buildSseContract({
|
|
2334
|
+
visibility: 'public',
|
|
2265
2335
|
method: 'get',
|
|
2266
2336
|
pathResolver: (params) => `/api/jobs/${params.jobId}/status`,
|
|
2267
2337
|
requestPathParamsSchema: z.object({ jobId: z.string().uuid() }),
|
|
@@ -2280,6 +2350,7 @@ export const jobStatusContract = buildSseContract({
|
|
|
2280
2350
|
|
|
2281
2351
|
// POST dual-mode route (OpenAI-style chat completion)
|
|
2282
2352
|
export const chatCompletionContract = buildSseContract({
|
|
2353
|
+
visibility: 'public',
|
|
2283
2354
|
method: 'post',
|
|
2284
2355
|
pathResolver: (params) => `/api/chats/${params.chatId}/completions`,
|
|
2285
2356
|
requestPathParamsSchema: z.object({ chatId: z.string().uuid() }),
|
|
@@ -2305,6 +2376,7 @@ Dual-mode contracts support an optional `responseHeaderSchema` to define and val
|
|
|
2305
2376
|
|
|
2306
2377
|
```ts
|
|
2307
2378
|
export const rateLimitedContract = buildSseContract({
|
|
2379
|
+
visibility: 'public',
|
|
2308
2380
|
method: 'post',
|
|
2309
2381
|
pathResolver: () => '/api/rate-limited',
|
|
2310
2382
|
requestPathParamsSchema: z.object({}),
|
|
@@ -2350,6 +2422,7 @@ Dual-mode and SSE contracts support `responseBodySchemasByStatusCode` to define
|
|
|
2350
2422
|
|
|
2351
2423
|
```ts
|
|
2352
2424
|
export const resourceContract = buildSseContract({
|
|
2425
|
+
visibility: 'public',
|
|
2353
2426
|
method: 'post',
|
|
2354
2427
|
pathResolver: (params) => `/api/resources/${params.id}`,
|
|
2355
2428
|
requestPathParamsSchema: z.object({ id: z.string() }),
|
|
@@ -2438,9 +2511,44 @@ sync: (request, reply) => {
|
|
|
2438
2511
|
|
|
2439
2512
|
**Validation priority for 2xx status codes:**
|
|
2440
2513
|
|
|
2441
|
-
- All 2xx responses (200, 201, 204, etc.) are validated against
|
|
2442
|
-
|
|
2443
|
-
-
|
|
2514
|
+
- All 2xx responses (200, 201, 204, etc.) returned by the `sync` handler are validated against
|
|
2515
|
+
`successResponseBodySchema`
|
|
2516
|
+
- For the `sync` handler, `responseBodySchemasByStatusCode` is only used for non-2xx status codes,
|
|
2517
|
+
so `successResponseBodySchema` takes precedence when the same 2xx code is defined in both
|
|
2518
|
+
- `sse.respond(code, body)` is validated against `responseBodySchemasByStatusCode[code]` at every
|
|
2519
|
+
status, 2xx included, because that is the schema its argument is typed from
|
|
2520
|
+
|
|
2521
|
+
**OpenAPI output and serialization:**
|
|
2522
|
+
|
|
2523
|
+
`buildFastifyRoute` fills in the route's `schema.response` from the contract, so the generated
|
|
2524
|
+
spec describes each status instead of showing a bare "Default Response":
|
|
2525
|
+
|
|
2526
|
+
- 200 carries `text/event-stream` with one `{ id?, event, data, retry? }` envelope per entry in
|
|
2527
|
+
`serverSentEventSchemas`, rendered as a `oneOf` with the `event` name pinned to a `const` in
|
|
2528
|
+
each branch, plus `application/json` for the JSON body
|
|
2529
|
+
- Every status in `responseBodySchemasByStatusCode` gets its declared schema
|
|
2530
|
+
|
|
2531
|
+
Because Fastify drives serialization from the same `schema.response`, a response body for a
|
|
2532
|
+
status the contract declares is serialized against that schema. Keys the schema does not
|
|
2533
|
+
declare are dropped from the body that goes out. Streamed SSE events are written directly by
|
|
2534
|
+
`@fastify/sse` and bypass the serializer, so the 200 event schema documents the stream without
|
|
2535
|
+
affecting it.
|
|
2536
|
+
|
|
2537
|
+
A status can be reached by more than one body shape, and Fastify rejects anything the schema
|
|
2538
|
+
does not accept, so each status accepts every shape the runtime can produce there:
|
|
2539
|
+
|
|
2540
|
+
- On a 2xx of a dual-mode contract, `application/json` accepts `successResponseBodySchema` (what
|
|
2541
|
+
the `sync` handler is validated against) as well as the schema declared for that status (what
|
|
2542
|
+
`sse.respond()` is validated against), rather than one taking precedence over the other in the
|
|
2543
|
+
spec
|
|
2544
|
+
- On a non-2xx, the declared schema is joined by the framework error envelope
|
|
2545
|
+
(`{ statusCode, message, error?, code?, ... }`), which is what Fastify sends for a failed
|
|
2546
|
+
request validation and what an application-level error handler typically returns. Without it,
|
|
2547
|
+
declaring a 400 body would turn every `FST_ERR_VALIDATION` on that route into a 500
|
|
2548
|
+
|
|
2549
|
+
Both show up in the spec as an `anyOf`. Errors the SSE builders raise themselves, before
|
|
2550
|
+
streaming starts, are sent pre-serialized and skip the schema entirely, so the thrown error's
|
|
2551
|
+
message always reaches the client.
|
|
2444
2552
|
|
|
2445
2553
|
### Single Sync Handler
|
|
2446
2554
|
|
|
@@ -2876,12 +2984,14 @@ import {
|
|
|
2876
2984
|
import { z } from 'zod/v4'
|
|
2877
2985
|
|
|
2878
2986
|
const getUser = buildRestContract({
|
|
2987
|
+
visibility: 'public',
|
|
2879
2988
|
method: 'get',
|
|
2880
2989
|
successResponseBodySchema: z.object({ id: z.string() }),
|
|
2881
2990
|
requestPathParamsSchema: z.object({ userId: z.string() }),
|
|
2882
2991
|
pathResolver: (p) => `/users/${p.userId}`,
|
|
2883
2992
|
})
|
|
2884
2993
|
const createUser = buildRestContract({
|
|
2994
|
+
visibility: 'public',
|
|
2885
2995
|
method: 'post',
|
|
2886
2996
|
requestBodySchema: z.object({ name: z.string() }),
|
|
2887
2997
|
successResponseBodySchema: z.object({ id: z.string() }),
|
|
@@ -3031,6 +3141,7 @@ become compile errors before you ever ship a config:
|
|
|
3031
3141
|
|
|
3032
3142
|
```ts
|
|
3033
3143
|
const getUser = buildRestContract({
|
|
3144
|
+
visibility: 'public',
|
|
3034
3145
|
method: 'get',
|
|
3035
3146
|
successResponseBodySchema: ResponseBody,
|
|
3036
3147
|
requestHeaderSchema: z.object({ 'x-trace-id': z.string() }),
|
|
@@ -3088,7 +3199,7 @@ time.
|
|
|
3088
3199
|
| `rewrite` | `{ stripPrefix: '/v2' }` or `{ replacePrefix: { from: '/v1', to: '/v2' } }` | |
|
|
3089
3200
|
| `traffic` | `{ weights: [{ upstream: 'a', weight: 80 }, { upstream: 'b', weight: 20 }] }` | Also `shadow: { upstream, percent }` |
|
|
3090
3201
|
| `headers` | `{ request: { add: { 'x-internal': 'true' }, remove: ['cookie'] }, response: … }` | Free-form keys; typically infra headers not in the contract |
|
|
3091
|
-
| `tags
|
|
3202
|
+
| `tags` | `tags: ['users']` | Documentation / partitioning |
|
|
3092
3203
|
| `extensions` | `{ envoy: { … }, krakend: { … }, kong: { … } }` | Vendor escape hatch; merged onto the generated route last |
|
|
3093
3204
|
|
|
3094
3205
|
### Generating Gateway Configs
|
package/dist/lib/DIContext.js
CHANGED
|
@@ -1,8 +1,38 @@
|
|
|
1
1
|
import { AwilixManager } from 'awilix-manager';
|
|
2
|
-
import { merge } from 'ts-deepmerge';
|
|
3
2
|
import { mergeConfigAndDependencyOverrides } from './configUtils.js';
|
|
4
3
|
import { buildGatewayManifestFrom, } from './gateway/index.js';
|
|
5
4
|
import { buildFastifyRoute, } from './routes/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Apply registration-level SSE defaults (`heartbeat`, `serializer`) to a route.
|
|
7
|
+
*
|
|
8
|
+
* `@fastify/sse` reads its per-route configuration from the top-level `sse` route
|
|
9
|
+
* option (not from `config.sse`), and only supports a boolean `heartbeat` there —
|
|
10
|
+
* the heartbeat interval is a plugin-registration option shared by all routes.
|
|
11
|
+
*
|
|
12
|
+
* Values already set on the route by the route builder win over the registration-level
|
|
13
|
+
* defaults.
|
|
14
|
+
*/
|
|
15
|
+
function applyGlobalSSEOptions(route, options) {
|
|
16
|
+
if (options?.heartbeat === undefined && options?.serializer === undefined) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const routeWithSSE = route;
|
|
20
|
+
const routeSSEOption = routeWithSSE.sse;
|
|
21
|
+
if (!routeSSEOption) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
// The route option is either `true` (plain SSE), a bare kind string, or an options object.
|
|
25
|
+
const routeSSEConfig = typeof routeSSEOption === 'string'
|
|
26
|
+
? { kind: routeSSEOption }
|
|
27
|
+
: typeof routeSSEOption === 'object'
|
|
28
|
+
? routeSSEOption
|
|
29
|
+
: {};
|
|
30
|
+
routeWithSSE.sse = {
|
|
31
|
+
...(options.heartbeat !== undefined && { heartbeat: options.heartbeat }),
|
|
32
|
+
...(options.serializer !== undefined && { serializer: options.serializer }),
|
|
33
|
+
...routeSSEConfig,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
6
36
|
export class DIContext {
|
|
7
37
|
options;
|
|
8
38
|
awilixManager;
|
|
@@ -249,19 +279,7 @@ export class DIContext {
|
|
|
249
279
|
if (options?.rateLimit) {
|
|
250
280
|
this.applyRateLimit(route, options.rateLimit);
|
|
251
281
|
}
|
|
252
|
-
|
|
253
|
-
if (options?.heartbeatInterval !== undefined || options?.serializer !== undefined) {
|
|
254
|
-
// biome-ignore lint/suspicious/noExplicitAny: config types vary by plugins
|
|
255
|
-
const routeWithConfig = route;
|
|
256
|
-
routeWithConfig.config = merge(routeWithConfig.config || {}, {
|
|
257
|
-
sse: {
|
|
258
|
-
...(options.heartbeatInterval !== undefined && {
|
|
259
|
-
heartbeatInterval: options.heartbeatInterval,
|
|
260
|
-
}),
|
|
261
|
-
...(options.serializer !== undefined && { serializer: options.serializer }),
|
|
262
|
-
},
|
|
263
|
-
});
|
|
264
|
-
}
|
|
282
|
+
applyGlobalSSEOptions(route, options);
|
|
265
283
|
}
|
|
266
284
|
applySSERouteOptions(route, options) {
|
|
267
285
|
if (options?.preHandler) {
|
|
@@ -270,19 +288,7 @@ export class DIContext {
|
|
|
270
288
|
if (options?.rateLimit) {
|
|
271
289
|
this.applyRateLimit(route, options.rateLimit);
|
|
272
290
|
}
|
|
273
|
-
|
|
274
|
-
if (options?.heartbeatInterval !== undefined || options?.serializer !== undefined) {
|
|
275
|
-
// biome-ignore lint/suspicious/noExplicitAny: config types vary by plugins
|
|
276
|
-
const routeWithConfig = route;
|
|
277
|
-
routeWithConfig.config = merge(routeWithConfig.config || {}, {
|
|
278
|
-
sse: {
|
|
279
|
-
...(options.heartbeatInterval !== undefined && {
|
|
280
|
-
heartbeatInterval: options.heartbeatInterval,
|
|
281
|
-
}),
|
|
282
|
-
...(options.serializer !== undefined && { serializer: options.serializer }),
|
|
283
|
-
},
|
|
284
|
-
});
|
|
285
|
-
}
|
|
291
|
+
applyGlobalSSEOptions(route, options);
|
|
286
292
|
}
|
|
287
293
|
applyPreHandlers(route, globalPreHandler) {
|
|
288
294
|
const existingPreHandler = route.preHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DIContext.js","sourceRoot":"","sources":["../../lib/DIContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DIContext.js","sourceRoot":"","sources":["../../lib/DIContext.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAK9C,OAAO,EAAE,iCAAiC,EAAsB,MAAM,kBAAkB,CAAA;AAGxF,OAAO,EAEL,wBAAwB,GAGzB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,iBAAiB,GAGlB,MAAM,mBAAmB,CAAA;AA8B1B;;;;;;;;;GASG;AACH,SAAS,qBAAqB,CAC5B,KAAmB,EACnB,OAAoE;IAEpE,IAAI,OAAO,EAAE,SAAS,KAAK,SAAS,IAAI,OAAO,EAAE,UAAU,KAAK,SAAS,EAAE,CAAC;QAC1E,OAAM;IACR,CAAC;IAED,MAAM,YAAY,GAAG,KAAyC,CAAA;IAC9D,MAAM,cAAc,GAAG,YAAY,CAAC,GAAG,CAAA;IACvC,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAM;IACR,CAAC;IAED,2FAA2F;IAC3F,MAAM,cAAc,GAClB,OAAO,cAAc,KAAK,QAAQ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CAAC;YACjC,SAAS;SACV,CAAA;IACH,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,CAAA;QACzC,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAA;IAClC,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAA;IACxC,CAAC;CACF"}
|
|
@@ -28,7 +28,7 @@ export type ExtractDualModeEventSchema<Contracts extends Record<string, AnyDualM
|
|
|
28
28
|
* ```typescript
|
|
29
29
|
* class ChatController extends AbstractDualModeController<typeof contracts> {
|
|
30
30
|
* public static contracts = {
|
|
31
|
-
* chatCompletion: buildSseContract({ requestBodySchema: ..., successResponseBodySchema: ..., ... }),
|
|
31
|
+
* chatCompletion: buildSseContract({ visibility: 'public', requestBodySchema: ..., successResponseBodySchema: ..., ... }),
|
|
32
32
|
* } as const
|
|
33
33
|
*
|
|
34
34
|
* constructor(deps: Dependencies, config?: DualModeControllerConfig) {
|
|
@@ -14,7 +14,7 @@ import { AbstractSSEController } from "../sse/AbstractSSEController.js";
|
|
|
14
14
|
* ```typescript
|
|
15
15
|
* class ChatController extends AbstractDualModeController<typeof contracts> {
|
|
16
16
|
* public static contracts = {
|
|
17
|
-
* chatCompletion: buildSseContract({ requestBodySchema: ..., successResponseBodySchema: ..., ... }),
|
|
17
|
+
* chatCompletion: buildSseContract({ visibility: 'public', requestBodySchema: ..., successResponseBodySchema: ..., ... }),
|
|
18
18
|
* } as const
|
|
19
19
|
*
|
|
20
20
|
* constructor(deps: Dependencies, config?: DualModeControllerConfig) {
|
|
@@ -27,11 +27,6 @@ export type MatchRule = z.infer<typeof matchRuleSchema>;
|
|
|
27
27
|
export declare const gatewayMetadataSchema: z.ZodObject<{
|
|
28
28
|
id: z.ZodOptional<z.ZodString>;
|
|
29
29
|
upstream: z.ZodOptional<z.ZodString>;
|
|
30
|
-
visibility: z.ZodOptional<z.ZodEnum<{
|
|
31
|
-
public: "public";
|
|
32
|
-
internal: "internal";
|
|
33
|
-
admin: "admin";
|
|
34
|
-
}>>;
|
|
35
30
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
36
31
|
match: z.ZodOptional<z.ZodObject<{
|
|
37
32
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
@@ -149,7 +149,6 @@ export const gatewayMetadataSchema = z
|
|
|
149
149
|
.object({
|
|
150
150
|
id: z.string().optional(),
|
|
151
151
|
upstream: z.string().optional(),
|
|
152
|
-
visibility: z.enum(['public', 'internal', 'admin']).optional(),
|
|
153
152
|
tags: z.array(z.string()).optional(),
|
|
154
153
|
match: matchSchema.optional(),
|
|
155
154
|
rewrite: rewriteSchema.optional(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatewayMetadata.js","sourceRoot":"","sources":["../../../lib/gateway/gatewayMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,iBAAiB,EAAE;IAChE,OAAO,EAAE,4EAA4E;CACtF,CAAC,CAAA;AAGF;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC;IACrC,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;IAC/B,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;IAChC,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;CAChC,CAAC,CAAA;AAGF,MAAM,gBAAgB,GAAG,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,aAAa,CAAC,QAAQ,EAAE;IAEjC,UAAU,EAAE,gBAAgB,CAAC,QAAQ,EAAE;CACxC,CAAC;KACD,MAAM,EAAE,CAAA"}
|
|
@@ -16,11 +16,6 @@ export declare const gatewayManifestRouteSchema: z.ZodObject<{
|
|
|
16
16
|
metadata: z.ZodObject<{
|
|
17
17
|
id: z.ZodOptional<z.ZodString>;
|
|
18
18
|
upstream: z.ZodOptional<z.ZodString>;
|
|
19
|
-
visibility: z.ZodOptional<z.ZodEnum<{
|
|
20
|
-
public: "public";
|
|
21
|
-
internal: "internal";
|
|
22
|
-
admin: "admin";
|
|
23
|
-
}>>;
|
|
24
19
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
20
|
match: z.ZodOptional<z.ZodObject<{
|
|
26
21
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
@@ -177,11 +172,6 @@ export declare const gatewayManifestSchema: z.ZodObject<{
|
|
|
177
172
|
metadata: z.ZodObject<{
|
|
178
173
|
id: z.ZodOptional<z.ZodString>;
|
|
179
174
|
upstream: z.ZodOptional<z.ZodString>;
|
|
180
|
-
visibility: z.ZodOptional<z.ZodEnum<{
|
|
181
|
-
public: "public";
|
|
182
|
-
internal: "internal";
|
|
183
|
-
admin: "admin";
|
|
184
|
-
}>>;
|
|
185
175
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
186
176
|
match: z.ZodOptional<z.ZodObject<{
|
|
187
177
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|