@beignet/next 0.0.3 → 0.0.4
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 +122 -0
- package/README.md +335 -113
- package/dist/index.d.ts +84 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +115 -16
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +260 -29
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,127 @@
|
|
|
1
1
|
# @beignet/next
|
|
2
2
|
|
|
3
|
+
## 0.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8bcb31f: Mark package READMEs with Beignet's experimental alpha status and 0.0.x stability expectations.
|
|
8
|
+
- d137044: Declare `@beignet/core` as a peer dependency with a lockstep version range in
|
|
9
|
+
every integration and provider package instead of a regular `"*"` dependency.
|
|
10
|
+
Installs now always resolve a single shared copy of core, so `instanceof`
|
|
11
|
+
checks such as `isContractError` and upload error identity keep working, and
|
|
12
|
+
mixed Beignet versions fail loudly at install time instead of at runtime.
|
|
13
|
+
|
|
14
|
+
If your package manager does not install peer dependencies automatically, add
|
|
15
|
+
`@beignet/core` to your app alongside these packages. `@beignet/nuqs` now also
|
|
16
|
+
declares `@beignet/react-query` as a peer dependency, and
|
|
17
|
+
`@beignet/provider-storage-s3` now expects you to install
|
|
18
|
+
`@aws-sdk/client-s3` and `@aws-sdk/s3-request-presigner` yourself, matching
|
|
19
|
+
how other providers treat their SDKs.
|
|
20
|
+
|
|
21
|
+
- 603478f: Align package documentation with the canonical route registry and AppContext conventions.
|
|
22
|
+
- ac78cdf: Make `createAuthHooks` the single route-scoped auth hook API. The factory is
|
|
23
|
+
now curried — `createAuthHooks<AppContext>()({ resolve })` — so added context
|
|
24
|
+
fields are inferred from `resolve` instead of passed as a type argument, and a
|
|
25
|
+
new optional `headers` schema validates the raw lowercase request header
|
|
26
|
+
record before `resolve` runs, giving `resolve` typed credential headers
|
|
27
|
+
without contract casts. On `required()` hooks a header schema failure returns
|
|
28
|
+
a framework-owned 401; `optional()` hooks skip auth resolution; `public()`
|
|
29
|
+
hooks never parse headers. `defineRouteHook` (and the `RouteHookBuilder`
|
|
30
|
+
types) are removed — write non-auth route hooks as plain `RouteHook` object
|
|
31
|
+
literals.
|
|
32
|
+
- 1a79090: Emit Node-compatible ESM: all relative imports in published packages now carry explicit .js extensions, fixing ERR_MODULE_NOT_FOUND when running the CLI or importing package dist files under plain Node.
|
|
33
|
+
- 079bf59: Clarify unsupported catch-all contract path diagnostics and document that catch-all route files belong to runtime adapters, not individual contracts.
|
|
34
|
+
- 303ba07: Define the public HTTP adapter contract and expose the Web Fetch adapter implementation.
|
|
35
|
+
- 493d23b: Make the framework own context assembly with a server context blueprint and first-class service contexts.
|
|
36
|
+
|
|
37
|
+
- `createServer(...)` (and the Next/Web adapters) replace the `createContext` option with `context`. Gate-less contexts keep the plain request-factory shorthand; contexts that declare a `gate` must use the blueprint form `{ gate: (ports) => ports.gate, request, service }`. Returning `gate` from a context factory or hook addition is now a compile error.
|
|
38
|
+
- The gate port gains `gate.attach(ctx)`: it attaches a live, non-enumerable `ctx.gate` getter that re-binds against the receiving object on every access, so identity changes (including auth-hook elevation) can never authorize against a stale context, and spread copies drop the gate loudly instead of silently keeping stale identity. `bind(...)` remains the low-level primitive.
|
|
39
|
+
- Servers expose `createRequestContext(req)` and `createServiceContext(input?)`; the optional `context.service` factory powers schedule, outbox, command, and background contexts. Provider `setup`, `start`, and `stop` receive a late-bound `createServiceContext` so infra providers no longer hand-build background contexts.
|
|
40
|
+
- `createTestContextFactory(...)` now attaches the gate after all `extra` and override fields merge, fixing a stale-identity bug in tests.
|
|
41
|
+
- CLI templates, generators, and doctor diagnostics emit and check the new context blueprint and service-context wrappers.
|
|
42
|
+
|
|
43
|
+
- eda7b59: Clarify that app-owned error details are public response data and should be
|
|
44
|
+
mapped explicitly rather than automatically redacted by the framework.
|
|
45
|
+
- ac78cdf: Add `createScheduleRoute(...)` to `@beignet/next` for triggering one registered schedule from a serverless cron route, with the same fail-closed bearer auth and JSON envelope conventions as `createOutboxDrainRoute(...)`. Unknown schedule names throw when the route module loads.
|
|
46
|
+
|
|
47
|
+
The inline schedule runner in `@beignet/core/schedules` now accepts `instrumentation` and `instrumentationContext` options and records `schedule` devtools events (`started`, `completed`, `failed`) itself. Recording failures are isolated from schedule execution and reported to `onHookError`. `createScheduleRoute(...)`, `beignet schedule run`, and generated cron routes use this instead of hand-rolled lifecycle hooks.
|
|
48
|
+
|
|
49
|
+
Security: cron route bearer secrets in `createScheduleRoute(...)` and `createOutboxDrainRoute(...)` are now compared with a timing-safe SHA-256 digest comparison instead of `!==`.
|
|
50
|
+
|
|
51
|
+
- 89390fe: Decouple devtools from app code with server-owned instrumentation.
|
|
52
|
+
|
|
53
|
+
- `@beignet/core/tracing` is a new dependency-free subpath with the W3C trace
|
|
54
|
+
primitives (`TraceContext`, `createTraceContext`, `createChildTraceContext`,
|
|
55
|
+
`parseTraceparent`, `createTraceparent`, `createTraceId`, `createSpanId`).
|
|
56
|
+
App context types now use `Partial<TraceContext>` instead of importing
|
|
57
|
+
`DevtoolsTraceContext` from `@beignet/devtools`.
|
|
58
|
+
- `createServer(...)` owns request instrumentation through a new
|
|
59
|
+
`instrumentation` option (`ServerInstrumentationOptions | false`). The server
|
|
60
|
+
resolves request IDs and trace context before user hooks and context
|
|
61
|
+
creation, passes them to context factories as `requestId` and `trace`,
|
|
62
|
+
writes `x-request-id`/`traceparent` response headers by default, and records
|
|
63
|
+
request/error events into the instrumentation port resolved from final ports
|
|
64
|
+
(`ports.instrumentation`, then `ports.devtools`). The ambient request
|
|
65
|
+
context (`enterActiveRequestContext` and friends) moved into
|
|
66
|
+
`@beignet/core/server`.
|
|
67
|
+
- `createUseCase(...)` instruments runs by default, resolving the
|
|
68
|
+
instrumentation port from `ctx.ports` per run; opt out with
|
|
69
|
+
`instrumentation: false`. App `onRun` observers run in addition.
|
|
70
|
+
- `createInstrumentedAuditLog({ audit, instrumentation })` in
|
|
71
|
+
`@beignet/core/ports` replaces `createDevtoolsAuditLog`.
|
|
72
|
+
- `createServer(...)` gains `validateResponses` (default `true`) to skip
|
|
73
|
+
route-owned response validation, mirroring the client option.
|
|
74
|
+
- Removed from `@beignet/devtools`: `createDevtoolsHooks`,
|
|
75
|
+
`createDevtoolsUseCaseObserver`, `createDevtoolsAuditLog`, and the
|
|
76
|
+
trace/request-context modules. Apps now only need `createDevtoolsProvider()`
|
|
77
|
+
plus the devtools route; deleting both leaves the rest of the app compiling
|
|
78
|
+
and running unchanged.
|
|
79
|
+
- `@beignet/next` cron and upload helpers resolve their instrumentation sink
|
|
80
|
+
with `resolveProviderInstrumentationPort(ctx.ports)` instead of hardcoding
|
|
81
|
+
`ports.devtools`.
|
|
82
|
+
- `beignet create` templates generate the decoupled shape.
|
|
83
|
+
|
|
84
|
+
- 16cc113: Clarify the canonical route registration story and align generated starters on `app-context.ts`.
|
|
85
|
+
- be85ab2: Document Next.js App Router server component, hydration, client component, and route handler patterns.
|
|
86
|
+
- ac78cdf: Split the client `validate` config flag into `validateInput` (default false)
|
|
87
|
+
and `validateResponses` (default true). Client-side input validation failures
|
|
88
|
+
now throw a client-source `ContractError` with code `INPUT_VALIDATION_ERROR`
|
|
89
|
+
and no HTTP status instead of a synthetic 422 `VALIDATION_ERROR`. Setting
|
|
90
|
+
`validateResponses: false` returns success bodies as-is and classifies non-2xx
|
|
91
|
+
responses structurally while keeping `INVALID_JSON` transport errors.
|
|
92
|
+
- cca08b1: Align generated apps and package docs around the canonical auth, policy, and AppContext model.
|
|
93
|
+
- d6ad8bb: Standardize generated client helpers around `client/index.ts`, add a typed
|
|
94
|
+
React Query invalidation helper, and align package docs with the canonical app
|
|
95
|
+
client entrypoint.
|
|
96
|
+
- a67c637: Add Beignet runtime boundary markers and extend `beignet lint` to catch client-safe roots that value-reach server-only code.
|
|
97
|
+
- 7b0f708: Add first-class outbox instrumentation and devtools visibility for delivered, retried, and dead-lettered messages.
|
|
98
|
+
- 493d23b: Add typed provider-contributed ports. `InferProviderPorts` (replacing
|
|
99
|
+
`ProvidedPortsOfList`) merges the ports a provider list contributes so apps can
|
|
100
|
+
type `ctx.ports` as `AppPorts & InferProviderPorts<typeof providers>` without
|
|
101
|
+
casts. The curried `definePorts<AppPorts>()({ bound, deferred })` form replaces
|
|
102
|
+
throwing stub boilerplate: deferred keys boot as descriptive placeholders and
|
|
103
|
+
`createServer(...)` fails startup with the unbound key list (configurable via
|
|
104
|
+
`onUnboundPorts: "error" | "warn" | "ignore"`). App-local providers can declare
|
|
105
|
+
required ports, app context, and service-context input through the curried
|
|
106
|
+
`createProvider<Requires, Context, ServiceInput>()` form, which types
|
|
107
|
+
`setup({ ports, createServiceContext })` and lifecycle contexts end to end.
|
|
108
|
+
CLI templates and `beignet make` generate and maintain the new forms.
|
|
109
|
+
- 8063d38: Rename the contract front door to `defineContract`/`defineContractGroup`, rename operational commands to tasks (`@beignet/core/tasks`, `defineTasks`, `runTask`, `beignet task run`, `beignet make task`, `server/tasks.ts`, `features/<feature>/tasks/`, `paths.tasks`), and standardize context binding: context-free declarations stay top-level (`defineEvent`), while context-bound definitions come from per-capability factories (`createListeners`, `createJobs`, `createSchedules`, `createNotifications`, `createTasks`) called once in `lib/`. Top-level context-generic `defineListener`, `defineJob`, `defineSchedule`, and `defineNotification` are removed.
|
|
110
|
+
- 192c6ad: Routes can bind a contract directly to a use case with `{ contract, useCase }` — status is inferred from a sole 2xx response, input defaults to merged path/query/body parts, and validated inputs are not re-parsed when the use case reuses the contract schema by reference. Full `handle` routes remain the escape hatch for headers, streaming, and multi-status responses.
|
|
111
|
+
- Updated dependencies [8bcb31f]
|
|
112
|
+
- Updated dependencies [d137044]
|
|
113
|
+
- Updated dependencies [ac78cdf]
|
|
114
|
+
- Updated dependencies [1a79090]
|
|
115
|
+
- Updated dependencies [82c48dc]
|
|
116
|
+
- Updated dependencies [303ba07]
|
|
117
|
+
- Updated dependencies [493d23b]
|
|
118
|
+
- Updated dependencies [89390fe]
|
|
119
|
+
- Updated dependencies [e9c3209]
|
|
120
|
+
- Updated dependencies [493d23b]
|
|
121
|
+
- Updated dependencies [192c6ad]
|
|
122
|
+
- Updated dependencies [255527d]
|
|
123
|
+
- @beignet/web@0.0.4
|
|
124
|
+
|
|
3
125
|
## 0.0.3
|
|
4
126
|
|
|
5
127
|
### Patch Changes
|