Repository navigation
v0.9.1
ExisJS Release v0.9.1
Release Date: 2026-10-16
Type: Patch: Bug Fixes, Conditional Requests & Request Path Cleanup
Affected Packages: exisjs, create-exisjs, @exisjs/fetch (all aligned to 0.9.1)
Highlights
Fixes from two reports on 0.9.0: the 0.8.1 test suite re-run against 0.9.0 (E-01, E-02), and a CRM built on 0.9.0 (nested object schemas). No breaking changes.
ETags and conditional requests follow RFC 9110 everywhere. Automatic ETags, static files and downloads share one evaluator for If-Match, If-Unmodified-Since, If-None-Match and If-Modified-Since. The new res.checkPreconditions() lets handlers answer 304 from a version column before loading data, and refuse lost updates with 412 / 428.
Fixed
- A returned
Bufferwas sent as JSON behind a boundary wrapper (E-01, was T-13). A boundaryhandle(ctx, next)/ default-export wrapper took the route's response back and re-sent every object withres.json, so aBufferbecame{"type":"Buffer","data":[...]}, andres.json(5)orres.json(null)became text. The wrapper now replays the response through the method the route used. A wrapper that awaitsnext()but returns nothing also sends the route's response; before, the request stayed open. .optional()on a nestedtex.objectwas ignored.Address.optional(),tex.object(shape).partial().optional()andextend({ address: Address.optional() })all required the key. The modifier now carries throughtex.object,tex.arrayitems,extend,merge,pick,omitandpartial, and the OpenAPI output agrees with the validator.partial()skipped nested objects. A nested object whose own fields were optional stayed required afterpartial().- A plain nested shape crashed.
tex.object({ address: { city: tex.string() } })failed withs.slice is not a function, although its types allow it. It now works the same astex.object({ city: ... }). - An array item error was listed twice in the validation error details.
- Unclear error for a missing field schema.
tex.object({ address: undefined })threwCannot read properties of undefined (reading 'length'); it now throwstex.object(): field "address" has no schema (got undefined). A transformed or discriminated-union schema used as a field, which never worked, gets a clear error too. - The generated
AGENTS.mdpointed tonode_modules/exisjs/docs/, which does not exist. The docs ship innode_modules/exisjs/dist/docs/. - The API reference index linked to absolute paths on the author's machine; the links are relative now.
- The
03-all-featuresexample sentX-Powered-By(E-02). - Binary request bodies were corrupted. The body was decoded as UTF-8 text and turned back into bytes, so
req.buffer()and@RawBody()replaced every byte that is not valid UTF-8 (images, protobuf, compressed or signed payloads). The bytes are now kept as received, and text is decoded from them only when asked for. @RawBody()hid body errors. A body overbodyLimitreached the handler as an empty Buffer instead of answering413.- The test client JSON-encoded Buffers.
.send(buffer)increateTestAppsent{"type":"Buffer","data":[...]}; it now sends the bytes, asapplication/octet-streamunless a content type is set. - In development,
res.cookie()copied each cookie into anX-Set-Cookieheader, which page scripts can read, sohttpOnlycookies were exposed to JavaScript. The header is gone. res.html()sent noContent-Lengthand skipped ETag /304handling; it now goes throughres.send().- A thrown non-
Errorvalue in a functional route is handled the same way as in class controllers.
Conditional Requests (ETag, 304, 412)
- New
res.checkPreconditions({ etag, lastModified, exists }, { required }). On GET/HEAD it setsETag/Last-Modifiedand answers304when the client's copy is current (returnstrue). On writes it throws412 PRECONDITION_FAILEDwhenIf-Match/If-Unmodified-Sinceno longer hold orIf-None-Match: *targets an existing resource, and428 PRECONDITION_REQUIREDwith{ required: true }when the client sent no precondition. - One RFC 9110 §13.2.2 evaluator for automatic ETags,
serveStatic,res.download(path)andreq.fresh: the standard evaluation order, strong comparison forIf-Match, weak forIf-None-Match, lists,*, and tags containing commas. Unparsable dates are ignored. If-None-Matchlists and weak tags now match on static files (only an exact single string matched before), andIf-Modified-Sinceworks: static files and downloads sendLast-Modified.- A
Cache-Control: no-cacherequest header no longer disables revalidation. It made the server answer200with the full body even when the client's tag matched; RFC 9110 has the origin evaluate conditionals regardless. 304responses carry no body metadata.Content-Type,Content-LengthandContent-Encodingare removed;ETag,Last-Modified,Cache-ControlandVaryare kept.- A failed
If-Matchon a read answers412with the standard error envelope. res.download(path)supportsETag,Last-Modified,304and412.- Automatic ETags (
etag: true) only on successful GET/HEAD responses. Writes and error responses were hashed for nothing. Hashing uses Node's one-shotcrypto.hash()where available (about 35% faster) and no longer copies string bodies into a Buffer first. serveStaticno longer blocks the event loop: it picks the.br/.gzvariant with asyncstatinstead of twoexistsSynccalls per request. It always sendsVary: Accept-Encoding, so a cache never serves the Brotli file to a client that did not ask for it.br;q=0is a refusal.serveStaticandcompression()treated any mention of an encoding inAccept-Encodingas acceptance.- Static file ETags are weak (
W/"size-mtime", assend/serve-staticuse): file metadata does not prove two files are byte-identical. - Dropped the
freshdependency;req.freshuses the same evaluator. - The in-process test client closes its connection once the response is complete. Tests of static files and downloads took about 4 s per request while it waited for the keep-alive socket to time out.
Database
@Transactionalhanded a transaction to concurrent requests. It wrote the transaction onto the service instance (this.db = tx) for the length of the call; services are shared singletons, so any other request using the same service meanwhile ran its queries inside that transaction, and could be committed or rolled back with it. The transaction is now visible only in the async context of the call (and the methods it calls), throughAsyncLocalStorage;thisstays the real instance, so#privatefields keep working.- Databases connect in parallel at boot.
connectAll()connected one after another, so boot took the sum of every connection time; it now takes the slowest one. A failure names every database that failed (error.failures), the others stay connected, and a retry only reconnects the failed ones. - Health checks run in parallel, with a timeout. One unresponsive database hung
/_ready(and the load balancer marked the instance dead on its own timeout); each check now fails afterhealthTimeoutMs(default 5 s) withstatus: 'error'. Probes that arrive while a check is running share its result. Customhealthcheck.checksget the same 5 s limit.
Changed
- 404s no longer scan the route table. Answering
405/Allowon a miss looked at every registered route on every unmatched request; the router now keeps the set of methods in use, so a miss costs the same with 10 or 10,000 routes. - Functional controllers (
controller({ ... })inroute.tsfiles) work out guards, interceptors and the route timeout once per route instead of on every request, and build the guard context only when a guard or interceptor needs it. fast-json-stringify(used for response schemas when installed) is loaded on first use instead of at startup.- Removed unused request/response pooling code (
ExisRequest.init()/cleanup(),ExisResponse.init()). - New
npm run bench:pipeline: per-request framework cost without the network, for checking routing, request and response changes.
Dependencies
pino10.4.0 andpino-pretty13.2.0 (runtime,exisjs).- Removed
fresh(replaced by the built-in conditional request evaluator). - Development and examples:
typescript-eslint/@typescript-eslint/*8.71.2,hono4.13.13 (benchmarks),mongoose8.24.5 (02-bookstore).
Added
.nullable()and.nullish()on object schemas (TexEngine), next to.optional().
Documentation
- Validation: modifiers on nested object schemas, and plain nested shapes.
- Boundaries: what a
handle(ctx, next)wrapper's return value does. - Middleware:
asyncmiddleware is awaited, and a thrownHttpErrorbecomes the response.
Upgrade Notes
npm install exisjs@0.9.1- Databases registered with
registerDatabase()now connect at the same time. If one database'sconnect()relies on another being connected first, connect the second inside the first'sconnect(). - Static file ETags change format once (strong to weak), so browsers download each file one more time after the upgrade.
- If your clients send
If-Matchon GET requests to routes withetag: true, a stale tag now answers412instead of200. - Code that relied on the development-only
X-Set-Cookieheader: read cookies fromSet-Cookiein your HTTP client or the browser's developer tools instead. - If you worked around nested optional objects with a hand-written rule such as
`object<…> | optional | nullable`, you can switch back toAddress.optional()orAddress.nullish(). - Projects created before 0.9.0 keep the old template defaults after upgrading. Check two places by hand:
docs: { enabled: process.env.NODE_ENV !== 'production' }inexis.config.ts, and noX-Powered-Byheader insrc/http/boundary.ts.
Full Changelog: v0.9.0...v0.9.1