docs: document router completeness for beta
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
5 files changed
+45
-19
No files matched your search
+31
-9
@@ -8,7 +8,18 @@ npm treats versions as semver and semver forbids leading zeros.
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [26.8.0-beta.0] - 2026-08-02
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
- **Safe constrained route parameters:** patterns such as `:id(\d+)` match a complete decoded
|
||||||
|
segment. The parser accepts a deliberately small, bounded regex subset and rejects unsafe or
|
||||||
|
malformed expressions at boot. Specificity is now static ▸ constrained param ▸ plain param ▸
|
||||||
|
catch-all; matching remains a linear scan.
|
||||||
|
- **`@Head` and `@Options` route decorators**, explicit-handler priority, buffered-GET HEAD fallback,
|
||||||
|
and automatic `204` OPTIONS responses with deterministic `Allow` ordering. GET implies HEAD and
|
||||||
|
every existing path implies OPTIONS; streaming GET routes do not become implicit HEAD routes.
|
||||||
|
- **OpenAPI route constraints and methods:** constrained path params emit `schema.pattern`, and
|
||||||
|
explicitly declared HEAD/OPTIONS handlers appear as operations without inventing automatic ones.
|
||||||
- **HTML / views:** `@Html` decorator (string, file, and template modes), a zero-dep built-in
|
- **HTML / views:** `@Html` decorator (string, file, and template modes), a zero-dep built-in
|
||||||
template engine (`{{ }}` escaped / `{{{ }}}` raw, exported as `render`) with a `viewEngine`
|
template engine (`{{ }}` escaped / `{{{ }}}` raw, exported as `render`) with a `viewEngine`
|
||||||
bring-your-own hook, and zero-config `static` directory serving (`createApp({ static: true })`).
|
bring-your-own hook, and zero-config `static` directory serving (`createApp({ static: true })`).
|
||||||
@@ -42,6 +53,12 @@ npm treats versions as semver and semver forbids leading zeros.
|
|||||||
pings — the platform `WebSocket` on Deno/Bun does not expose `ws.ping()`.
|
pings — the platform `WebSocket` on Deno/Bun does not expose `ws.ping()`.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
- Repeated slashes and malformed path encoding now return `400` consistently across Node and Fetch
|
||||||
|
adapters, retaining configured security/CORS headers. `/path` and `/path/` remain equivalent.
|
||||||
|
- Ambiguous same-method route shapes now fail at boot with both declarations named. Effective-shape
|
||||||
|
checks also cover remote mesh conflicts and local routes that shadow a remote export.
|
||||||
|
- HEAD responses always suppress the body while preserving handler status and headers; Fetch
|
||||||
|
responses also avoid constructing forbidden bodies for `204`, `205`, and `304` statuses.
|
||||||
- The opt-in dev routes `/__graph__` (graph viewer) and `/__openapi__` are now
|
- The opt-in dev routes `/__graph__` (graph viewer) and `/__openapi__` are now
|
||||||
served over `app.fetch` too, so they work on every runtime (Deno/Bun/edge),
|
served over `app.fetch` too, so they work on every runtime (Deno/Bun/edge),
|
||||||
not only the Node `app.listen()` path.
|
not only the Node `app.listen()` path.
|
||||||
@@ -55,9 +72,9 @@ npm treats versions as semver and semver forbids leading zeros.
|
|||||||
- **`request:step:enter`/`leave` are now emitted for `@Ws` and mesh routes.** Only HTTP routes
|
- **`request:step:enter`/`leave` are now emitted for `@Ws` and mesh routes.** Only HTTP routes
|
||||||
emitted them, so a logging plugin silently observed nothing on a WebSocket route — a gap in a
|
emitted them, so a logging plugin silently observed nothing on a WebSocket route — a gap in a
|
||||||
documented plugin API. All transports now run their steps through one path.
|
documented plugin API. All transports now run their steps through one path.
|
||||||
- **A mesh route exported by two teapots now fails the boot**, naming the route and both teapots,
|
- **A mesh route exported by two teapots now fails the boot**, naming both effective patterns and
|
||||||
instead of silently serving whichever connected first and leaving the other dead. There is no
|
both teapots, instead of silently serving whichever connected first and leaving the other dead.
|
||||||
load balancing to fall back on, so green-tea will not pick for you.
|
There is no load balancing to fall back on, so green-tea will not pick for you.
|
||||||
- **A local route shadowing a remote one now warns.** Local still takes precedence — that is how you
|
- **A local route shadowing a remote one now warns.** Local still takes precedence — that is how you
|
||||||
override a teapot — but a silently shadowed export used to look like a broken teapot.
|
override a teapot — but a silently shadowed export used to look like a broken teapot.
|
||||||
- **`app.close()` closes mesh links even with no server**, so a mesh app booted through `app.fetch`
|
- **`app.close()` closes mesh links even with no server**, so a mesh app booted through `app.fetch`
|
||||||
@@ -69,6 +86,9 @@ npm treats versions as semver and semver forbids leading zeros.
|
|||||||
`request:step:leave`.
|
`request:step:leave`.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
- Root, runtime-only, and website dependency audits are clean after supported package updates and
|
||||||
|
narrow pins for vulnerable transitives. CI audits root + website trees and builds the docs; the
|
||||||
|
GitHub OIDC release workflow audits immediately before its publish gate.
|
||||||
- App-scope providers now boot exactly once (memoized): a second `app.listen()`
|
- App-scope providers now boot exactly once (memoized): a second `app.listen()`
|
||||||
call no longer re-runs provider factories or their side effects.
|
call no longer re-runs provider factories or their side effects.
|
||||||
- **`WsOpenCtx.req`** (available in `@Ws`/`@Sse` handlers) is now a neutral
|
- **`WsOpenCtx.req`** (available in `@Ws`/`@Sse` handlers) is now a neutral
|
||||||
@@ -78,10 +98,11 @@ npm treats versions as semver and semver forbids leading zeros.
|
|||||||
`ctx.req`; use `ctx.protocol` / `ctx.ip` / `ctx.query` / `ctx.headers`
|
`ctx.req`; use `ctx.protocol` / `ctx.ip` / `ctx.query` / `ctx.headers`
|
||||||
instead — all still provided.
|
instead — all still provided.
|
||||||
- **Breaking (pre-1.0): transport is now enforced by declaration.** A buffered route
|
- **Breaking (pre-1.0): transport is now enforced by declaration.** A buffered route
|
||||||
(`@Get`/`@Post`/`@Put`/`@Patch`/`@Delete`) whose handler returns an `AsyncIterable`, or a streaming
|
(`@Get`/`@Head`/`@Post`/`@Put`/`@Patch`/`@Delete`/`@Options`) whose handler returns an
|
||||||
route (`@Sse`/`@Ws`) whose handler returns a plain value, now fails with a 500 `TransportMismatchError`
|
`AsyncIterable`, or a streaming route (`@Sse`/`@Ws`) whose handler returns a plain value, now
|
||||||
instead of silently switching behavior. `@Stream` still negotiates both. Declare `@Sse`/`@Stream`/`@Ws`
|
fails with a 500 `TransportMismatchError` instead of silently switching behavior. `@Stream`
|
||||||
to stream — a return value no longer changes a route's wire contract.
|
still negotiates both. Declare `@Sse`/`@Stream`/`@Ws` to stream — a return value no longer
|
||||||
|
changes a route's wire contract.
|
||||||
|
|
||||||
## [26.7.0-beta.0] - 2026-07-07
|
## [26.7.0-beta.0] - 2026-07-07
|
||||||
|
|
||||||
@@ -130,5 +151,6 @@ change before the stable release.
|
|||||||
- **Benchmarks** — reproducible `npm run bench` harness vs Express 5, Fastify 5,
|
- **Benchmarks** — reproducible `npm run bench` harness vs Express 5, Fastify 5,
|
||||||
NestJS, and raw `http`; results in [BENCHMARKS.md](./BENCHMARKS.md).
|
NestJS, and raw `http`; results in [BENCHMARKS.md](./BENCHMARKS.md).
|
||||||
|
|
||||||
[Unreleased]: https://git.svc.zoit.services/Green-Tea/core/compare/26.7.0-beta.0...develop
|
[Unreleased]: https://git.svc.zoit.services/Green-Tea/core/compare/v26.8.0-beta.0...develop
|
||||||
[26.7.0-beta.0]: https://git.svc.zoit.services/Green-Tea/core/releases/tag/26.7.0-beta.0
|
[26.8.0-beta.0]: https://git.svc.zoit.services/Green-Tea/core/compare/v26.7.0-beta.0...v26.8.0-beta.0
|
||||||
|
[26.7.0-beta.0]: https://git.svc.zoit.services/Green-Tea/core/releases/tag/v26.7.0-beta.0
|
||||||
@@ -193,17 +193,20 @@ The handler signature declares exactly what it wants — in any order, nothing m
|
|||||||
|
|
||||||
`@needs` keys are validated at boot: nothing provides the key → `createApp` throws with a clear error instead of serving `undefined`. Pass a Standard Schema (`@body(User)`) and the value is validated, coerced, and typed before your handler sees it.
|
`@needs` keys are validated at boot: nothing provides the key → `createApp` throws with a clear error instead of serving `undefined`. Pass a Standard Schema (`@body(User)`) and the value is validated, coerced, and typed before your handler sees it.
|
||||||
|
|
||||||
> **Optional providers degrade, they don't crash.** A provider marked `optional: true` that throws on boot does **not** abort startup — it is left unregistered and logged. On `listen()` the app prints a one-line summary of what's running degraded, and the list is queryable via `app.degraded()`. Routes that actually need a degraded provider fail at request time, not at boot. This is deliberate (graceful degradation); wire an alert off `app.degraded()` or the `boot:provider:fail` bus event in production so a degraded start is never silent.
|
> **Optional providers degrade, they don't crash.** A provider marked `optional: true` that throws on boot does **not** abort startup — it is left unregistered and logged. The first serving call (`fetch`, `upgrade`, or `listen`) prints a one-line summary of what's running degraded, and the list is queryable via `app.degraded()`. Routes that actually need a degraded provider fail at request time, not at boot. This is deliberate (graceful degradation); wire an alert off `app.degraded()` or the `boot:provider:fail` bus event in production so a degraded start is never silent.
|
||||||
|
|
||||||
## Routing
|
## Routing
|
||||||
|
|
||||||
Patterns match by segment: static, `:param` (one segment), and a trailing `:name*` **catch-all** that captures the rest of the path — slashes included — into `params.name`. When more than one route matches, the **most specific wins** (static ▸ `:param` ▸ catch-all), independent of registration order. A path that exists under a *different* method returns **`405` with an `Allow` header**, not `404`.
|
Patterns match by segment: static, constrained params such as `:id(\d+)`, plain `:param`, and a trailing `:name*` **catch-all**. The most specific wins (static ▸ constrained ▸ plain param ▸ catch-all), and ambiguous same-method shapes fail at boot instead of depending on registration order.
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
|
@Get('/users/:id(\\d+)') // /users/42
|
||||||
@Get('/files/:path*') // /files/img/2026/logo.png → params.path = "img/2026/logo.png"
|
@Get('/files/:path*') // /files/img/2026/logo.png → params.path = "img/2026/logo.png"
|
||||||
```
|
```
|
||||||
|
|
||||||
**Not yet** (post-beta, on the roadmap): regex / typed param constraints like `:id(\d+)`, and route matching is a linear scan — fine for typical route tables, but a radix-tree matcher for very large ones isn't built.
|
`@Head` and `@Options` provide explicit handlers. Otherwise a buffered GET can serve HEAD without a body, and OPTIONS on an existing path returns `204` with canonical `Allow`; other method mismatches return `405`. `/path` and `/path/` are equivalent, while repeated slashes and malformed encoding return `400` rather than being normalized ambiguously. Constraints use a deliberately safe regex subset. See the full [routing guide](https://green-tea.expressive-tea.io/docs/guides/routing/).
|
||||||
|
|
||||||
|
Matching is still a linear scan — fine for typical route tables. A radix tree for very large tables remains post-beta work.
|
||||||
|
|
||||||
## Two layers
|
## Two layers
|
||||||
|
|
||||||
@@ -251,13 +254,14 @@ npm run docs:dev # the documentation site (website/)
|
|||||||
- ✅ **mesh (walking skeleton)** — `teapot`/`teacup` distributed DI over a secret-gated WS control channel. A BEAM/OTP-style cluster, *not* microservices.
|
- ✅ **mesh (walking skeleton)** — `teapot`/`teacup` distributed DI over a secret-gated WS control channel. A BEAM/OTP-style cluster, *not* microservices.
|
||||||
- ✅ **runs everywhere** — Node, Deno, Bun, and Cloudflare Workers over web-standard `Request`/`Response`, with identical WebSocket behaviour on all four.
|
- ✅ **runs everywhere** — Node, Deno, Bun, and Cloudflare Workers over web-standard `Request`/`Response`, with identical WebSocket behaviour on all four.
|
||||||
- ✅ **HTML** — `@Html` (string / file / template), a built-in template engine with a bring-your-own `viewEngine` hook, and `static` serving.
|
- ✅ **HTML** — `@Html` (string / file / template), a built-in template engine with a bring-your-own `viewEngine` hook, and `static` serving.
|
||||||
- **next** — API freeze + first published release, mesh sub-specs (discovery, load-balancing, failover), official plugins, router regex constraints and a radix-tree matcher.
|
- ✅ **router completeness for beta** — safe constrained params, deterministic precedence, explicit/automatic HEAD and OPTIONS, strict path validation, and ambiguity checks across local and mesh routes.
|
||||||
|
- **next** — API freeze + first published release, mesh sub-specs (discovery, load-balancing, failover), official plugins, and a radix-tree matcher for very large route tables.
|
||||||
|
|
||||||
## Versioning
|
## Versioning
|
||||||
|
|
||||||
green-tea uses **calendar versioning**: `YY.M.PATCH` (e.g. `26.7.0` = the first release cut in July 2026, patch 0). The month is **not** zero-padded — npm treats versions as semver, which forbids leading zeros. A version tells you *when* it shipped, not how many breaking changes preceded it — those are always called out in the [CHANGELOG](./CHANGELOG.md).
|
green-tea uses **calendar versioning**: `YY.M.PATCH` (e.g. `26.8.0` = the first release cut in August 2026, patch 0). The month is **not** zero-padded — npm treats versions as semver, which forbids leading zeros. A version tells you *when* it shipped, not how many breaking changes preceded it — those are always called out in the [CHANGELOG](./CHANGELOG.md).
|
||||||
|
|
||||||
**While in beta**, releases carry a `-beta.N` pre-release suffix on the calendar version (e.g. `26.7.0-beta.0`) and publish under the npm `beta` dist-tag — so a plain `npm install @green-tea/core` won't pick one up until the first stable calendar release. The API can still change between betas.
|
**While in beta**, releases carry a `-beta.N` pre-release suffix on the calendar version (e.g. `26.8.0-beta.0`) and publish under the npm `beta` dist-tag — so a plain `npm install @green-tea/core` won't pick one up until the first stable calendar release. The API can still change between betas.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@green-tea/core",
|
"name": "@green-tea/core",
|
||||||
"version": "26.7.0-beta.0",
|
"version": "26.8.0-beta.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@green-tea/core",
|
"name": "@green-tea/core",
|
||||||
"version": "26.7.0-beta.0",
|
"version": "26.8.0-beta.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"reflect-metadata": "0.2.2"
|
"reflect-metadata": "0.2.2"
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@green-tea/core",
|
"name": "@green-tea/core",
|
||||||
"version": "26.7.0-beta.0",
|
"version": "26.8.0-beta.0",
|
||||||
"description": "A zen, opinionated, type-safe framework — your API is a graph, not a middleware chain.",
|
"description": "A zen, opinionated, type-safe framework — your API is a graph, not a middleware chain.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "green-tea contributors",
|
"author": "green-tea contributors",
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
import 'reflect-metadata';
|
import 'reflect-metadata';
|
||||||
|
|
||||||
/** Package version, replaced at publish time. */
|
/** Package version, replaced at publish time. */
|
||||||
export const VERSION = '26.7.0-beta.0';
|
export const VERSION = '26.8.0-beta.0';
|
||||||
|
|
||||||
// Application
|
// Application
|
||||||
export { createApp } from './app';
|
export { createApp } from './app';
|
||||||
|
|||||||
Reference in new issue
Block a user