@beignet/core 0.0.48 → 0.0.50
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 +46 -0
- package/README.md +224 -20
- package/dist/client/client.d.ts +0 -2
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +28 -25
- package/dist/client/client.js.map +1 -1
- package/dist/contracts/contract-builder.d.ts +7 -2
- package/dist/contracts/contract-builder.d.ts.map +1 -1
- package/dist/contracts/contract-builder.js +20 -2
- package/dist/contracts/contract-builder.js.map +1 -1
- package/dist/contracts/contract-group.d.ts.map +1 -1
- package/dist/contracts/contract-group.js +1 -0
- package/dist/contracts/contract-group.js.map +1 -1
- package/dist/contracts/contract-like.d.ts +2 -0
- package/dist/contracts/contract-like.d.ts.map +1 -1
- package/dist/contracts/contract-like.js +27 -1
- package/dist/contracts/contract-like.js.map +1 -1
- package/dist/contracts/index.d.ts +4 -0
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +4 -0
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/query-transport.d.ts +126 -0
- package/dist/contracts/query-transport.d.ts.map +1 -0
- package/dist/contracts/query-transport.js +406 -0
- package/dist/contracts/query-transport.js.map +1 -0
- package/dist/contracts/schema-shape.d.ts +11 -0
- package/dist/contracts/schema-shape.d.ts.map +1 -1
- package/dist/contracts/schema-shape.js +13 -0
- package/dist/contracts/schema-shape.js.map +1 -1
- package/dist/contracts/types.d.ts +5 -0
- package/dist/contracts/types.d.ts.map +1 -1
- package/dist/contracts/types.js.map +1 -1
- package/dist/events/index.d.ts +54 -5
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +183 -32
- package/dist/events/index.js.map +1 -1
- package/dist/idempotency/index.d.ts +7 -3
- package/dist/idempotency/index.d.ts.map +1 -1
- package/dist/idempotency/index.js +45 -12
- package/dist/idempotency/index.js.map +1 -1
- package/dist/mail/index.d.ts.map +1 -1
- package/dist/mail/index.js +6 -3
- package/dist/mail/index.js.map +1 -1
- package/dist/openapi/index.d.ts +8 -0
- package/dist/openapi/index.d.ts.map +1 -1
- package/dist/openapi/index.js +79 -5
- package/dist/openapi/index.js.map +1 -1
- package/dist/outbox/index.d.ts +8 -5
- package/dist/outbox/index.d.ts.map +1 -1
- package/dist/outbox/index.js +17 -3
- package/dist/outbox/index.js.map +1 -1
- package/dist/ports/best-effort-work.d.ts +21 -0
- package/dist/ports/best-effort-work.d.ts.map +1 -0
- package/dist/ports/best-effort-work.js +2 -0
- package/dist/ports/best-effort-work.js.map +1 -0
- package/dist/ports/cache.d.ts +9 -1
- package/dist/ports/cache.d.ts.map +1 -1
- package/dist/ports/cache.js +20 -5
- package/dist/ports/cache.js.map +1 -1
- package/dist/ports/events.d.ts +7 -5
- package/dist/ports/events.d.ts.map +1 -1
- package/dist/ports/index.d.ts +7 -2
- package/dist/ports/index.d.ts.map +1 -1
- package/dist/ports/index.js +2 -1
- package/dist/ports/index.js.map +1 -1
- package/dist/ports/testing.d.ts +15 -0
- package/dist/ports/testing.d.ts.map +1 -1
- package/dist/ports/testing.js +38 -0
- package/dist/ports/testing.js.map +1 -1
- package/dist/providers/provider.d.ts +8 -5
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/provider.js.map +1 -1
- package/dist/server/hooks/cors.d.ts +2 -2
- package/dist/server/hooks/cors.d.ts.map +1 -1
- package/dist/server/hooks/cors.js +2 -1
- package/dist/server/hooks/cors.js.map +1 -1
- package/dist/server/hooks/logging.d.ts +2 -2
- package/dist/server/hooks/logging.d.ts.map +1 -1
- package/dist/server/hooks/logging.js.map +1 -1
- package/dist/server/hooks/rate-limit.d.ts +16 -8
- package/dist/server/hooks/rate-limit.d.ts.map +1 -1
- package/dist/server/hooks/rate-limit.js +31 -17
- package/dist/server/hooks/rate-limit.js.map +1 -1
- package/dist/server/hooks/security.d.ts +2 -2
- package/dist/server/hooks/security.d.ts.map +1 -1
- package/dist/server/hooks/security.js.map +1 -1
- package/dist/server/http.d.ts +21 -2
- package/dist/server/http.d.ts.map +1 -1
- package/dist/server/index.d.ts +4 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +4 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/instrumentation.d.ts.map +1 -1
- package/dist/server/instrumentation.js +5 -3
- package/dist/server/instrumentation.js.map +1 -1
- package/dist/server/request-executor.d.ts.map +1 -1
- package/dist/server/request-executor.js +18 -9
- package/dist/server/request-executor.js.map +1 -1
- package/dist/server/request-preparation.d.ts.map +1 -1
- package/dist/server/request-preparation.js +31 -11
- package/dist/server/request-preparation.js.map +1 -1
- package/dist/server/response-finalization.d.ts +2 -2
- package/dist/server/response-finalization.d.ts.map +1 -1
- package/dist/server/response-finalization.js +25 -8
- package/dist/server/response-finalization.js.map +1 -1
- package/dist/server/route-matching.d.ts.map +1 -1
- package/dist/server/route-matching.js +12 -1
- package/dist/server/route-matching.js.map +1 -1
- package/dist/server/server-sent-events.d.ts +94 -0
- package/dist/server/server-sent-events.d.ts.map +1 -0
- package/dist/server/server-sent-events.js +275 -0
- package/dist/server/server-sent-events.js.map +1 -0
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/server.js +43 -22
- package/dist/server/server.js.map +1 -1
- package/dist/server/trusted-proxy-internal.d.ts +4 -0
- package/dist/server/trusted-proxy-internal.d.ts.map +1 -1
- package/dist/server/trusted-proxy-internal.js +20 -0
- package/dist/server/trusted-proxy-internal.js.map +1 -1
- package/dist/server/trusted-proxy.d.ts.map +1 -1
- package/dist/server/trusted-proxy.js +3 -8
- package/dist/server/trusted-proxy.js.map +1 -1
- package/dist/server/use-case-route.d.ts +8 -5
- package/dist/server/use-case-route.d.ts.map +1 -1
- package/dist/server/use-case-route.js +44 -17
- package/dist/server/use-case-route.js.map +1 -1
- package/dist/testing/index.d.ts +17 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +6 -1
- package/dist/testing/index.js.map +1 -1
- package/package.json +3 -3
- package/skills/app-architecture/SKILL.md +50 -4
- package/src/client/client.ts +29 -28
- package/src/contracts/contract-builder.ts +32 -2
- package/src/contracts/contract-group.ts +1 -0
- package/src/contracts/contract-like.ts +40 -1
- package/src/contracts/index.ts +23 -0
- package/src/contracts/query-transport.ts +697 -0
- package/src/contracts/schema-shape.ts +24 -0
- package/src/contracts/types.ts +5 -0
- package/src/events/index.ts +263 -38
- package/src/idempotency/index.ts +65 -17
- package/src/mail/index.ts +7 -3
- package/src/openapi/index.ts +126 -2
- package/src/outbox/index.ts +26 -5
- package/src/ports/best-effort-work.ts +21 -0
- package/src/ports/cache.ts +29 -7
- package/src/ports/events.ts +9 -4
- package/src/ports/index.ts +10 -1
- package/src/ports/testing.ts +45 -0
- package/src/providers/provider.ts +8 -5
- package/src/server/hooks/cors.ts +11 -5
- package/src/server/hooks/logging.ts +6 -2
- package/src/server/hooks/rate-limit.ts +50 -24
- package/src/server/hooks/security.ts +8 -4
- package/src/server/http.ts +23 -2
- package/src/server/index.ts +4 -0
- package/src/server/instrumentation.ts +12 -4
- package/src/server/request-executor.ts +31 -9
- package/src/server/request-preparation.ts +45 -12
- package/src/server/response-finalization.ts +51 -15
- package/src/server/route-matching.ts +24 -1
- package/src/server/server-sent-events.ts +415 -0
- package/src/server/server.ts +48 -22
- package/src/server/trusted-proxy-internal.ts +20 -0
- package/src/server/trusted-proxy.ts +6 -7
- package/src/server/use-case-route.ts +62 -23
- package/src/testing/index.ts +30 -0
- package/dist/query-codec.d.ts +0 -3
- package/dist/query-codec.d.ts.map +0 -1
- package/dist/query-codec.js +0 -110
- package/dist/query-codec.js.map +0 -1
- package/src/query-codec.ts +0 -130
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# @beignet/core
|
|
2
2
|
|
|
3
|
+
## 0.0.50
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6fe026a: Expose event-subscription readiness and asynchronous cleanup, await listener
|
|
8
|
+
registries during provider startup with bounded rollback, diagnose unsafe app
|
|
9
|
+
wiring, and make Redis subscription lifecycle failures observable with bounded
|
|
10
|
+
provider shutdown and recoverable channel state.
|
|
11
|
+
- 4be4573: Keep mail content out of provider instrumentation, document the Redis
|
|
12
|
+
deployment policy required for monotonic fencing, and align generated agent
|
|
13
|
+
guidance with optional seed, worker, and migration paths.
|
|
14
|
+
- ee402a9: Map invalid adapter URLs to framework responses, cancel oversized request
|
|
15
|
+
streams, distinguish typed idempotency inputs, preserve repeated response
|
|
16
|
+
headers, and match Unicode static routes against encoded URL pathnames.
|
|
17
|
+
- d1db53e: Add a portable Server-Sent Events response helper with JSON framing,
|
|
18
|
+
heartbeats, bounded unread buffering, optional maximum lifetime,
|
|
19
|
+
cancellation-aware asynchronous setup, eventual late cleanup, and safe
|
|
20
|
+
response headers, expose native request cancellation through
|
|
21
|
+
`HttpRequestLike.signal`, and use recoverable bounded snapshots for the
|
|
22
|
+
Devtools live stream with visible partial-data reporting.
|
|
23
|
+
- 7b0961b: Add a non-durable best-effort work port, a recording test adapter, and a Next.js `after()` adapter that isolates scheduler and callback failures.
|
|
24
|
+
|
|
25
|
+
## 0.0.49
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- e597d53: Require Node.js 22.12 or newer across every Beignet package, generated app,
|
|
30
|
+
and documented workflow.
|
|
31
|
+
- 3049831: Prevent outbox job registries from silently running without a dispatcher by
|
|
32
|
+
wiring generated jobs, reporting incomplete app-port configuration, and
|
|
33
|
+
validating delivery transports before claiming messages. Jobs provider presets
|
|
34
|
+
replace only the marked generated inline fallback.
|
|
35
|
+
- 60edd56: Preserve scalar and array inputs in bound use cases, settle finalizers after
|
|
36
|
+
unexpected response-validator failures, and replace Beignet's general-purpose
|
|
37
|
+
typed query envelopes with OpenAPI form and deepObject serialization. A narrow,
|
|
38
|
+
versioned extension preserves otherwise unrepresentable empty collections.
|
|
39
|
+
- a06c5b9: Require contracts with query schemas to declare an explicit transport shared by typed clients, servers, and OpenAPI generation. Add deterministic scalar, repeated-array, and flat deep-object transports, migrate CLI generators, and diagnose legacy one-argument query declarations.
|
|
40
|
+
- 8c0b355: Isolate and safely frame default rate-limit buckets, fail closed for unresolved user scopes, escape Swagger script data, and require an explicit access policy for devtools routes.
|
|
41
|
+
- b2188d8: Align provider production behavior by validating cache TTLs consistently,
|
|
42
|
+
requiring encrypted SMTP transport by default, and streaming unknown-size S3
|
|
43
|
+
uploads through bounded managed multipart uploads with explicit cleanup across
|
|
44
|
+
all failure stages.
|
|
45
|
+
|
|
46
|
+
The S3 provider now requires `@aws-sdk/lib-storage`; the Beignet provider
|
|
47
|
+
preset installs the compatible version automatically.
|
|
48
|
+
|
|
3
49
|
## 0.0.48
|
|
4
50
|
|
|
5
51
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# @beignet/core
|
|
2
2
|
|
|
3
|
+
> **Runtime:** Beignet requires Node.js 22.12 or newer. Bun 1.3.14 or newer is
|
|
4
|
+
> supported for Beignet commands.
|
|
5
|
+
|
|
3
6
|
> Core framework primitives for Beignet
|
|
4
7
|
|
|
5
8
|
> [!CAUTION]
|
|
@@ -69,11 +72,11 @@ name the framework area they depend on.
|
|
|
69
72
|
| `@beignet/core/outbox` | Durable event and job outbox |
|
|
70
73
|
| `@beignet/core/payments` | Payments port, memory payments adapter, and memory payments provider |
|
|
71
74
|
| `@beignet/core/pagination` | Offset/cursor page types, normalizers, and result helpers |
|
|
72
|
-
| `@beignet/core/ports` | App-facing ports, auth, audit, policies, cache, storage, logging, and redaction |
|
|
75
|
+
| `@beignet/core/ports` | App-facing ports, auth, audit, policies, cache, storage, best-effort work, logging, and redaction |
|
|
73
76
|
| `@beignet/core/providers` | Provider lifecycle and instrumentation primitives |
|
|
74
77
|
| `@beignet/core/search` | Search index definitions, SearchPort, memory adapter, memory provider, and helpers |
|
|
75
78
|
| `@beignet/core/schedules` | Schedule primitives |
|
|
76
|
-
| `@beignet/core/server` | Framework-agnostic server runtime, security headers, CSRF, and hook helpers |
|
|
79
|
+
| `@beignet/core/server` | Framework-agnostic server runtime, SSE responses, security headers, CSRF, and hook helpers |
|
|
77
80
|
| `@beignet/core/server-only` | Static lint marker for modules that must stay out of client bundles |
|
|
78
81
|
| `@beignet/core/tasks` | Operational task definitions and inline task execution |
|
|
79
82
|
| `@beignet/core/tenancy` | Branded tenant scope helpers for repository boundaries |
|
|
@@ -310,6 +313,55 @@ and dead-lettered messages when you pass a devtools or instrumentation port to
|
|
|
310
313
|
`drainOutbox(...)`. Pass `instrumentationContext` when the worker has request or
|
|
311
314
|
trace IDs that should connect the drain to devtools rows.
|
|
312
315
|
|
|
316
|
+
## Best-effort work
|
|
317
|
+
|
|
318
|
+
`BestEffortWorkPort` lets application code request non-durable follow-up work
|
|
319
|
+
without waiting for it in the originating operation:
|
|
320
|
+
|
|
321
|
+
```ts
|
|
322
|
+
import type { BestEffortWorkPort } from "@beignet/core/ports";
|
|
323
|
+
|
|
324
|
+
export type AppPorts = {
|
|
325
|
+
bestEffortWork: BestEffortWorkPort;
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
ctx.ports.bestEffortWork.defer(() =>
|
|
329
|
+
ctx.ports.workspaceBroadcast.publish(workspaceId, message),
|
|
330
|
+
);
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
Use it only when losing the callback does not change the operation's result,
|
|
334
|
+
such as publishing a cache-invalidation hint after the authoritative write has
|
|
335
|
+
committed. The adapter owns scheduler and callback error isolation. Use a job
|
|
336
|
+
or transaction-scoped outbox when work must be retried or survive process
|
|
337
|
+
termination.
|
|
338
|
+
|
|
339
|
+
Tests can use `createRecordingBestEffortWork()` directly or the default
|
|
340
|
+
`bestEffortWork` returned by `createTestPorts(...)`. Call
|
|
341
|
+
`fixture.flushBestEffortWork()` to run the current queued batch deterministically;
|
|
342
|
+
callbacks deferred by that batch remain pending until the next flush. A flush
|
|
343
|
+
attempts the complete batch before rejecting with any callback failures.
|
|
344
|
+
|
|
345
|
+
## Event subscriptions
|
|
346
|
+
|
|
347
|
+
`EventBusPort.subscribe(...)` returns an `EventSubscription` with a `ready`
|
|
348
|
+
promise and asynchronous, idempotent `unsubscribe()` method. Await `ready`
|
|
349
|
+
before advertising that a process can receive events, and await
|
|
350
|
+
`unsubscribe()` during shutdown. The memory adapter is ready immediately;
|
|
351
|
+
transport adapters resolve readiness only after their initial subscription is
|
|
352
|
+
active.
|
|
353
|
+
|
|
354
|
+
`registerListeners(...)` combines a listener registry into one subscription.
|
|
355
|
+
It waits for every child subscription and applies one 10-second registration
|
|
356
|
+
deadline by default. When setup fails or times out, Beignet starts every child
|
|
357
|
+
cleanup within the remaining deadline. If cleanup does not settle in time,
|
|
358
|
+
`ready` rejects with both the startup failure and a
|
|
359
|
+
`ListenerRegistrationCleanupTimeoutError` instead of hanging startup. Set
|
|
360
|
+
`readyTimeoutMs` when the process needs a different bounded startup policy.
|
|
361
|
+
Normal teardown after successful readiness still awaits transport cleanup;
|
|
362
|
+
apply a host-level shutdown deadline when required. Readiness is an initial
|
|
363
|
+
lifecycle signal, not an ongoing health check or durability guarantee.
|
|
364
|
+
|
|
313
365
|
## Provider-contributed ports
|
|
314
366
|
|
|
315
367
|
Apps bind app-owned ports directly and defer the rest to providers with the
|
|
@@ -378,7 +430,9 @@ defer those ports before choosing production infrastructure.
|
|
|
378
430
|
`createMemoryMailerProvider(options?)` contributes `{ mailer: MailerPort }`
|
|
379
431
|
backed by `createMemoryMailer(...)`. Deliveries are captured in memory and
|
|
380
432
|
recorded as `mail.sent` devtools events through the `mail` watcher when an
|
|
381
|
-
instrumentation port is installed.
|
|
433
|
+
instrumentation port is installed. Instrumentation records only the provider,
|
|
434
|
+
recipient count, delivery ID, and duration; it does not record addresses,
|
|
435
|
+
subjects, or message bodies. Options extend
|
|
382
436
|
`CreateMemoryMailerOptions` (`defaultFrom`, `now`, `id`, `onSend`) plus a
|
|
383
437
|
provider `name` that defaults to `"memory-mailer"`.
|
|
384
438
|
|
|
@@ -924,7 +978,11 @@ A **contract group** allows you to share configuration across related endpoints,
|
|
|
924
978
|
|
|
925
979
|
```ts
|
|
926
980
|
import { z } from "zod";
|
|
927
|
-
import {
|
|
981
|
+
import {
|
|
982
|
+
defineContractGroup,
|
|
983
|
+
defineQueryTransport,
|
|
984
|
+
query,
|
|
985
|
+
} from "@beignet/core/contracts";
|
|
928
986
|
|
|
929
987
|
// Create a contract group for related endpoints
|
|
930
988
|
const todos = defineContractGroup()
|
|
@@ -968,10 +1026,16 @@ export const createTodo = todos
|
|
|
968
1026
|
|
|
969
1027
|
export const listTodos = todos
|
|
970
1028
|
.get("/")
|
|
971
|
-
.query(
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
1029
|
+
.query(
|
|
1030
|
+
z.object({
|
|
1031
|
+
completed: z.boolean().optional(),
|
|
1032
|
+
limit: z.number().int().optional(),
|
|
1033
|
+
}),
|
|
1034
|
+
defineQueryTransport({
|
|
1035
|
+
completed: query.boolean(),
|
|
1036
|
+
limit: query.integer(),
|
|
1037
|
+
}),
|
|
1038
|
+
)
|
|
975
1039
|
.responses({ 200: z.array(TodoSchema) });
|
|
976
1040
|
```
|
|
977
1041
|
|
|
@@ -979,6 +1043,24 @@ Clients and OpenAPI generation infer required path argument keys from literal
|
|
|
979
1043
|
path templates. Use `.pathParams(...)` when you want runtime validation,
|
|
980
1044
|
coercion, richer OpenAPI schemas, or parameter descriptions.
|
|
981
1045
|
|
|
1046
|
+
Query schemas define logical values and validation; query transports define URL
|
|
1047
|
+
encoding. The same explicit transport drives typed-client encoding, server
|
|
1048
|
+
decoding, and OpenAPI `form` or `deepObject` metadata. Use the scalar helpers
|
|
1049
|
+
`query.string()`, `query.number()`, `query.integer()`, `query.boolean()`,
|
|
1050
|
+
`query.dateTime()`, and `query.date()`. Arrays repeat one scalar field, and
|
|
1051
|
+
`query.deepObject(...)` supports one flat object. Empty collections are omitted
|
|
1052
|
+
unless the array or object transport opts into `{ empty: "preserve" }`, a
|
|
1053
|
+
versioned Beignet extension for typed clients.
|
|
1054
|
+
|
|
1055
|
+
`query.integer()` accepts JavaScript safe integers and publishes that range in
|
|
1056
|
+
OpenAPI.
|
|
1057
|
+
|
|
1058
|
+
The client serializes schema input values and, when `validateInput: true` is
|
|
1059
|
+
enabled, validates them without using transformed output as the query wire
|
|
1060
|
+
value. The server decodes the transport once and then runs the Standard Schema,
|
|
1061
|
+
so handlers receive defaults and transformed schema outputs. Keep HTTP wire
|
|
1062
|
+
conversion in the transport rather than a schema transform.
|
|
1063
|
+
|
|
982
1064
|
`createServer(...)` enforces registration-time guarantees: each method + path
|
|
983
1065
|
may only be registered once, contract names must be unique across the route
|
|
984
1066
|
registry because typed clients, OpenAPI operations, and devtools key on them,
|
|
@@ -1049,6 +1131,78 @@ feeds metadata-driven hooks such as rate limiting exactly like contract
|
|
|
1049
1131
|
metadata, and the route is not added to the registry — the adapter mounts
|
|
1050
1132
|
the returned handler at the route's own path.
|
|
1051
1133
|
|
|
1134
|
+
### Server-sent events
|
|
1135
|
+
|
|
1136
|
+
`createServerSentEventResponse(...)` creates a portable Fetch `Response` for
|
|
1137
|
+
an SSE endpoint. Use it from a contract handler or raw route after
|
|
1138
|
+
application-owned authentication and authorization:
|
|
1139
|
+
|
|
1140
|
+
```ts
|
|
1141
|
+
import { createServerSentEventResponse } from "@beignet/core/server";
|
|
1142
|
+
|
|
1143
|
+
return createServerSentEventResponse({
|
|
1144
|
+
signal: req.signal,
|
|
1145
|
+
maxLifetimeMs: 240_000,
|
|
1146
|
+
start({ send }) {
|
|
1147
|
+
send({ event: "reconcile", data: { workspaceId } });
|
|
1148
|
+
const subscription = ctx.ports.workspaceBroadcast.subscribe(
|
|
1149
|
+
workspaceId,
|
|
1150
|
+
(change) => {
|
|
1151
|
+
send({ event: "changed", data: change });
|
|
1152
|
+
},
|
|
1153
|
+
);
|
|
1154
|
+
return { close: () => subscription.unsubscribe() };
|
|
1155
|
+
},
|
|
1156
|
+
onError: (error) => ctx.ports.logger.error("SSE stream failed", { error }),
|
|
1157
|
+
});
|
|
1158
|
+
```
|
|
1159
|
+
|
|
1160
|
+
Event `data` is JSON-encoded. Optional `event`, `id`, and `retry` fields use
|
|
1161
|
+
standard SSE framing; `retry` sets the browser reconnection delay in
|
|
1162
|
+
milliseconds. `comment(...)` sends an explicit comment, and `close()` ends the
|
|
1163
|
+
response. `send(...)` and `comment(...)` return `true` when they enqueue a
|
|
1164
|
+
frame and `false` after closure, when framing or encoding fails, or when the
|
|
1165
|
+
unread byte limit would be exceeded. Event names and IDs must fit on one line,
|
|
1166
|
+
and IDs cannot contain null characters. A producer, framing, encoding, stream,
|
|
1167
|
+
or buffer-overflow failure reports through `onError` and closes the connection.
|
|
1168
|
+
|
|
1169
|
+
Heartbeat comments default to 25 seconds; `heartbeatMs: false` disables them.
|
|
1170
|
+
`maxLifetimeMs` is opt-in. Both options accept `false` or an integer from `1`
|
|
1171
|
+
through `2_147_483_647`; `retry` accepts an integer from `0` through the same
|
|
1172
|
+
maximum. `start(...)` receives a stream-scoped `signal` that aborts whenever
|
|
1173
|
+
the response closes. Pass it to subscription APIs that perform asynchronous
|
|
1174
|
+
setup. `start(...)` may return a cleanup callback, a closeable subscription, a
|
|
1175
|
+
promise of either, or nothing. If it returns cleanup, request abort, response
|
|
1176
|
+
cancellation, explicit close, and maximum lifetime invoke that cleanup exactly
|
|
1177
|
+
once. `onError` also observes cleanup failures without creating an unhandled
|
|
1178
|
+
rejection. When stream closure aborts asynchronous setup, an expected
|
|
1179
|
+
`AbortError` rejection is treated as cancellation rather than a producer
|
|
1180
|
+
failure; other setup rejections still reach `onError`.
|
|
1181
|
+
|
|
1182
|
+
Unread encoded frames are bounded to `1_048_576` bytes by default. Set
|
|
1183
|
+
`maxBufferedBytes` to an integer from `1` through `2_147_483_647` when the
|
|
1184
|
+
endpoint has a verified frame-size requirement. If one frame or the
|
|
1185
|
+
accumulated unread queue would exceed the limit, the helper reports a
|
|
1186
|
+
`RangeError` and closes the connection; the limit remains active even when
|
|
1187
|
+
`maxLifetimeMs` is disabled. Response-body cancellation waits for cleanup that
|
|
1188
|
+
has already been registered, but it does not wait indefinitely for pending
|
|
1189
|
+
asynchronous setup. The stream signal lets setup stop cooperatively, and any
|
|
1190
|
+
cleanup returned after closure still runs exactly once.
|
|
1191
|
+
|
|
1192
|
+
The response always sets `Content-Type: text/event-stream`,
|
|
1193
|
+
`Cache-Control: no-store, no-transform`, and `X-Accel-Buffering: no`, removes
|
|
1194
|
+
`Content-Length` and hop-by-hop streaming headers, and preserves other custom
|
|
1195
|
+
headers supplied through `headers`. The helper does not own authorization,
|
|
1196
|
+
replay, durability, distributed connection limits, or client reconciliation.
|
|
1197
|
+
Keep authoritative state elsewhere and reconcile on initial connection and
|
|
1198
|
+
reconnect when messages are best-effort hints.
|
|
1199
|
+
|
|
1200
|
+
Use a contract handler when the stream belongs in the route registry and
|
|
1201
|
+
OpenAPI document. Use a raw route when the endpoint is transport-only and the
|
|
1202
|
+
app owns its request and response shape. Document a contract stream with a
|
|
1203
|
+
`.responses({ 200: null })` success schema and an OpenAPI `text/event-stream`
|
|
1204
|
+
media override.
|
|
1205
|
+
|
|
1052
1206
|
Use `.headers(...)` for request headers that are part of the endpoint contract. Declare header keys in lowercase; server and client runtime matching is case-insensitive.
|
|
1053
1207
|
|
|
1054
1208
|
Request bodies are supported for `POST`, `PUT`, and `PATCH` contracts only.
|
|
@@ -1146,7 +1300,8 @@ const tester = createUseCaseTester<AppContext>(createContext);
|
|
|
1146
1300
|
The returned fixture exposes captured side effects such as `events`,
|
|
1147
1301
|
`dispatchedJobs`, `audit.entries`, `mailer.deliveries`,
|
|
1148
1302
|
`notifications.deliveries`, `outbox.messages`, and memory storage for
|
|
1149
|
-
assertions.
|
|
1303
|
+
assertions. Its default `bestEffortWork` port queues callbacks in
|
|
1304
|
+
`pendingBestEffortWork`; call `flushBestEffortWork()` to run the current batch.
|
|
1150
1305
|
|
|
1151
1306
|
`overrides` is typed as `TestPortsOverrides<Ports>`, which accepts typed
|
|
1152
1307
|
partial ports without casts. The partial rule is one level deep: an
|
|
@@ -1681,6 +1836,11 @@ const server = await createServer<AppContext, AppPorts>({
|
|
|
1681
1836
|
- `global` and `ip` scopes run in `onRequest` before parsing and context
|
|
1682
1837
|
creation; `user` scope runs in `beforeHandle` after route hooks have resolved
|
|
1683
1838
|
identity and `ctx.actor` exists.
|
|
1839
|
+
- Default buckets use `contract:<contract-name>:global`,
|
|
1840
|
+
`contract:<contract-name>:ip:<client-ip>`, or
|
|
1841
|
+
`contract:<contract-name>:user:<user-id>`, so traffic to one contract does
|
|
1842
|
+
not consume another contract's limit. A user-scoped limit fails with
|
|
1843
|
+
`AuthUnauthorizedError` when route hooks do not resolve a user actor.
|
|
1684
1844
|
- `ip` scopes require an explicit server-level `trustedProxy.clientIp`,
|
|
1685
1845
|
hook-local `trustedProxy.clientIp`, `ipSource`, or
|
|
1686
1846
|
custom `earlyKey`. The hook's `validate` phase fails `createServer(...)`
|
|
@@ -1695,7 +1855,8 @@ const server = await createServer<AppContext, AppPorts>({
|
|
|
1695
1855
|
platform headers.
|
|
1696
1856
|
- Pass `ipSource: "none"` to explicitly opt out of client-IP resolution:
|
|
1697
1857
|
Beignet then trusts no forwarding headers and all `ip`-scoped traffic
|
|
1698
|
-
shares
|
|
1858
|
+
for each contract shares that contract's
|
|
1859
|
+
`contract:<contract-name>:ip:unknown` bucket.
|
|
1699
1860
|
- Denials throw the framework `429 Too Many Requests` catalog error with
|
|
1700
1861
|
`scope`, `retryAfterSeconds`, and `resetAt` details, and the response
|
|
1701
1862
|
carries a standard `Retry-After` header when the limiter reports a reset
|
|
@@ -1703,6 +1864,9 @@ const server = await createServer<AppContext, AppPorts>({
|
|
|
1703
1864
|
- Each denial emits a `rateLimit.denied` instrumentation event carrying the
|
|
1704
1865
|
key, scope, limit, and window when the app ports include an
|
|
1705
1866
|
`instrumentation` or `devtools` sink, so operators keep bucket visibility.
|
|
1867
|
+
- A custom `key` or `earlyKey` owns the complete bucket key and bypasses the
|
|
1868
|
+
default contract namespace. Include route identity when custom buckets should
|
|
1869
|
+
remain independent per contract.
|
|
1706
1870
|
|
|
1707
1871
|
### Idempotency
|
|
1708
1872
|
|
|
@@ -1781,6 +1945,14 @@ import { createMemoryIdempotencyStore } from "@beignet/core/idempotency";
|
|
|
1781
1945
|
const idempotency = createMemoryIdempotencyStore();
|
|
1782
1946
|
```
|
|
1783
1947
|
|
|
1948
|
+
`createIdempotencyFingerprint(...)` sorts object keys and tags non-JSON values
|
|
1949
|
+
before hashing while retaining the stable representation of ordinary JSON
|
|
1950
|
+
payloads. BigInts and Dates therefore remain distinct from same-looking
|
|
1951
|
+
strings; invalid dates, non-finite numbers, circular values, and the reserved
|
|
1952
|
+
tag key fail instead of producing ambiguous fingerprints. Non-plain objects
|
|
1953
|
+
other than `Date` fail as unsupported; project them to plain command data
|
|
1954
|
+
before hashing.
|
|
1955
|
+
|
|
1784
1956
|
Reservation tokens use Web Crypto `randomUUID()` or `getRandomValues()` when
|
|
1785
1957
|
available and securely fall back to `node:crypto` on supported Node runtimes.
|
|
1786
1958
|
The memory adapter accepts `createReservationToken` when a deterministic test
|
|
@@ -1862,6 +2034,12 @@ await drainOutbox({
|
|
|
1862
2034
|
});
|
|
1863
2035
|
```
|
|
1864
2036
|
|
|
2037
|
+
Registry entries describe what the drain may deliver; they do not install the
|
|
2038
|
+
delivery transports. A registry with events requires `eventBus`, and a
|
|
2039
|
+
registry with jobs requires `jobs`. `drainOutbox(...)` validates those
|
|
2040
|
+
capabilities before claiming a batch, so incomplete worker wiring fails
|
|
2041
|
+
without consuming delivery attempts.
|
|
2042
|
+
|
|
1865
2043
|
The outbox is at-least-once delivery. Use idempotent listeners or jobs when a
|
|
1866
2044
|
duplicate delivery would be harmful. Drizzle-backed outbox tables persist the
|
|
1867
2045
|
optional versioned trace carrier in `trace_context_json`; add that nullable
|
|
@@ -1994,17 +2172,37 @@ export const messageRoutes = defineRouteGroup({
|
|
|
1994
2172
|
|
|
1995
2173
|
Ordinary app routes bind `{ contract, useCase }`. The response status is
|
|
1996
2174
|
inferred when the contract declares exactly one `2xx` response (otherwise
|
|
1997
|
-
`status` is required and typed to the declared keys)
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
`
|
|
2001
|
-
|
|
2002
|
-
input
|
|
2175
|
+
`status` is required and typed to the declared keys). A sole path, query, or
|
|
2176
|
+
body schema passes through unchanged when no additional path, query, or object
|
|
2177
|
+
body values are present. Multiple sources merge via
|
|
2178
|
+
`defaultBinderInput` — query lowest, then body, then path. Headers are never
|
|
2179
|
+
merged, and a scalar or array body combined with another source needs an
|
|
2180
|
+
explicit `input: (parts) => ...` mapper. When the use case `.input(...)`
|
|
2181
|
+
schema is the contract's sole request schema by reference, the server skips
|
|
2182
|
+
the use case's input re-parse — one schema, one parse.
|
|
2003
2183
|
|
|
2004
2184
|
Use `{ contract, handle }` as the escape hatch for response headers,
|
|
2005
2185
|
streaming, and multi-status responses. `defineRoute` remains
|
|
2006
2186
|
available for full handlers that read hook-added `ctx` fields.
|
|
2007
2187
|
|
|
2188
|
+
Framework-neutral response header values may be strings or string arrays.
|
|
2189
|
+
Use an array for repeated fields such as `Set-Cookie`; Web-compatible adapters
|
|
2190
|
+
append every item separately, and hooks receive the same string-or-array
|
|
2191
|
+
header record:
|
|
2192
|
+
|
|
2193
|
+
```ts
|
|
2194
|
+
return {
|
|
2195
|
+
status: 200,
|
|
2196
|
+
headers: {
|
|
2197
|
+
"set-cookie": [
|
|
2198
|
+
"session=abc; Path=/; HttpOnly; Secure; SameSite=Lax",
|
|
2199
|
+
"theme=dark; Path=/; Secure; SameSite=Lax",
|
|
2200
|
+
],
|
|
2201
|
+
},
|
|
2202
|
+
body: { ok: true },
|
|
2203
|
+
};
|
|
2204
|
+
```
|
|
2205
|
+
|
|
2008
2206
|
When credentials live in request headers, declare a `headers` schema on the
|
|
2009
2207
|
auth hooks. The hook validates the raw lowercase request header record before
|
|
2010
2208
|
`resolve` runs, so `resolve` receives typed header values; on `required()`
|
|
@@ -2106,13 +2304,17 @@ status, including when reading the response stream itself fails.
|
|
|
2106
2304
|
request validation, response validation, error mapping, and provider lifecycle.
|
|
2107
2305
|
Adapters own the platform edge only:
|
|
2108
2306
|
|
|
2109
|
-
- Convert the native request into `HttpRequestLike
|
|
2307
|
+
- Convert the native request into `HttpRequestLike`, including its abort
|
|
2308
|
+
signal when the platform exposes one
|
|
2110
2309
|
- Call `server.api(...)` or a single route handler
|
|
2111
2310
|
- Convert `HttpResponse` back into the native response type
|
|
2112
2311
|
|
|
2113
2312
|
The public adapter contract is `HttpAdapter<NativeRequest, NativeResponse>`.
|
|
2114
2313
|
Use it when building a runtime package beyond the first-party `@beignet/web`
|
|
2115
|
-
and `@beignet/next` adapters.
|
|
2314
|
+
and `@beignet/next` adapters. Custom adapters must supply an absolute HTTP or
|
|
2315
|
+
HTTPS `HttpRequestLike.url`; invalid values are converted to a framework-owned
|
|
2316
|
+
`400 INVALID_REQUEST_URL` response instead of escaping as a rejected handler
|
|
2317
|
+
promise.
|
|
2116
2318
|
|
|
2117
2319
|
### Health and readiness
|
|
2118
2320
|
|
|
@@ -2388,7 +2590,7 @@ standard error envelope.
|
|
|
2388
2590
|
| `.patch(path)` | Define a PATCH endpoint |
|
|
2389
2591
|
| `.delete(path)` | Define a DELETE endpoint |
|
|
2390
2592
|
| `.pathParams(schema)` | Define path parameter schema |
|
|
2391
|
-
| `.query(schema)` | Define query
|
|
2593
|
+
| `.query(schema, transport)` | Define a query schema and its deterministic URL transport |
|
|
2392
2594
|
| `.headers(schema)` | Define request header schema |
|
|
2393
2595
|
| `.body(schema)` | Define request body schema |
|
|
2394
2596
|
| `.responses({ ... })` | Define or merge response schemas by status code |
|
|
@@ -2408,7 +2610,9 @@ This package works with any [Standard Schema](https://github.com/standard-schema
|
|
|
2408
2610
|
OpenAPI generation includes a Zod converter and introspector by default. Other
|
|
2409
2611
|
Standard Schema libraries can supply `schemaConverters` and a
|
|
2410
2612
|
`schemaIntrospector`; opaque path parameter schemas degrade to required string
|
|
2411
|
-
parameters derived from the contract path.
|
|
2613
|
+
parameters derived from the contract path. Query schemas always require an
|
|
2614
|
+
explicit transport. OpenAPI generation also requires an introspector for query
|
|
2615
|
+
field requiredness, descriptions, and constraints.
|
|
2412
2616
|
|
|
2413
2617
|
## Related packages
|
|
2414
2618
|
|
package/dist/client/client.d.ts
CHANGED
|
@@ -271,8 +271,6 @@ export declare class Endpoint<TContract extends HttpContractConfig, TProvidedHea
|
|
|
271
271
|
* Build the full URL with path and query parameters
|
|
272
272
|
*/
|
|
273
273
|
private buildUrl;
|
|
274
|
-
private serializeQueryParam;
|
|
275
|
-
private invalidQueryParam;
|
|
276
274
|
/**
|
|
277
275
|
* Build request headers
|
|
278
276
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,kBAAkB,EAGvB,KAAK,eAAe,EAEpB,KAAK,yBAAyB,EAE9B,KAAK,gBAAgB,EACtB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EAEZ,cAAc,EACd,0BAA0B,EAC1B,kCAAkC,EAClC,wBAAwB,EACxB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,uBAAuB,CACjC,MAAM,EACN,OAAO,SAAS,mBAAmB,IACjC,OAAO,CAAC,MAAM,EAAE;IAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,uBAAuB,CAAC,MAAM,EAAE,OAAO,SAAS,MAAM,IAAI,OAAO,CAC3E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NER_HEADER, getContractHeaderSchemas, methodSupportsRequestBody, parsePathTemplate, resolveContract, } from "../contracts/index.js";
|
|
1
|
+
import { BEIGNET_ERROR_OWNER_HEADER, encodeQueryTransport, getContractHeaderSchemas, methodSupportsRequestBody, parsePathTemplate, QueryTransportError, resolveContract, } from "../contracts/index.js";
|
|
2
2
|
import { isErrorResponseBody, SchemaValidationError } from "../errors/index.js";
|
|
3
|
-
import { encodeQueryValue } from "../query-codec.js";
|
|
4
3
|
/**
|
|
5
4
|
* Error thrown by Beignet contract clients.
|
|
6
5
|
*
|
|
@@ -485,12 +484,28 @@ export class Endpoint {
|
|
|
485
484
|
: encodeURIComponent(String(normalizedPath?.[segment.name])))
|
|
486
485
|
.join("/")}`;
|
|
487
486
|
// Add query parameters
|
|
488
|
-
let queryToSerialize = query;
|
|
489
487
|
if (query) {
|
|
488
|
+
if (!this.contract.queryTransport) {
|
|
489
|
+
throw new ContractError({
|
|
490
|
+
source: "contract",
|
|
491
|
+
code: "INVALID_QUERY_TRANSPORT",
|
|
492
|
+
message: `Contract "${this.contract.name}" does not declare a query transport.`,
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
let params;
|
|
496
|
+
let transportFailure;
|
|
497
|
+
try {
|
|
498
|
+
// Serialize before validation so even a non-conforming Standard Schema
|
|
499
|
+
// that mutates its input cannot turn validation into a wire transform.
|
|
500
|
+
params = encodeQueryTransport(this.contract.queryTransport, query);
|
|
501
|
+
}
|
|
502
|
+
catch (error) {
|
|
503
|
+
transportFailure = { error };
|
|
504
|
+
}
|
|
490
505
|
// Validate query params if schema exists and validation is enabled
|
|
491
506
|
if (this.config.validateInput && this.contract.query) {
|
|
492
507
|
try {
|
|
493
|
-
|
|
508
|
+
await validateSchema(this.contract.query, query);
|
|
494
509
|
}
|
|
495
510
|
catch (err) {
|
|
496
511
|
if (err instanceof SchemaValidationError) {
|
|
@@ -503,14 +518,17 @@ export class Endpoint {
|
|
|
503
518
|
throw err;
|
|
504
519
|
}
|
|
505
520
|
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
521
|
+
if (transportFailure) {
|
|
522
|
+
if (transportFailure.error instanceof QueryTransportError) {
|
|
523
|
+
throw this.createError({
|
|
524
|
+
code: "INVALID_QUERY_PARAM",
|
|
525
|
+
message: "Query transport encoding failed",
|
|
526
|
+
details: transportFailure.error.issues,
|
|
527
|
+
});
|
|
511
528
|
}
|
|
529
|
+
throw transportFailure.error;
|
|
512
530
|
}
|
|
513
|
-
const queryString = params
|
|
531
|
+
const queryString = params?.toString() ?? "";
|
|
514
532
|
if (queryString) {
|
|
515
533
|
url += `?${queryString}`;
|
|
516
534
|
}
|
|
@@ -522,21 +540,6 @@ export class Endpoint {
|
|
|
522
540
|
}
|
|
523
541
|
return baseUrl + url;
|
|
524
542
|
}
|
|
525
|
-
serializeQueryParam(key, value) {
|
|
526
|
-
try {
|
|
527
|
-
return encodeQueryValue(value);
|
|
528
|
-
}
|
|
529
|
-
catch {
|
|
530
|
-
throw this.invalidQueryParam(key, "contains a non-serializable value");
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
invalidQueryParam(key, reason) {
|
|
534
|
-
return new ContractError({
|
|
535
|
-
source: "client",
|
|
536
|
-
code: "INVALID_QUERY_PARAM",
|
|
537
|
-
message: `Query parameter "${key}" ${reason}. Use primitive values, Dates, JSON-serializable objects, or arrays of those values.`,
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
543
|
/**
|
|
541
544
|
* Build request headers
|
|
542
545
|
*/
|