Skip to content

v0.6.2

Choose a tag to compare

@github-actions github-actions released this 05 Oct 22:00
· 7 commits to main since this release
v0.6.2
5168974

Added

  • @tetsujs/core: serve(app, { stop: false }) leaves the server running for the caller, and request.stop() stops it. A server started in beforeAll needs both: Bun runs an afterAll registered inside a hook as soon as the hook returns, so the one serve() registers stopped it before the first test (#72).
  • Every package's README links its page on the site, the same page as Markdown, and llms-full.txt, the whole documentation in one file, and says that the type definitions document every option. The core's pointed at llms.txt, which is only the index (#75).

Fixed

  • @tetsujs/sse: a stream with a keep-alive — every sse() by default, a stream() given one — sets its request's idle timeout to the interval and ten seconds more once it is read (#71). Bun closes a connection that sends nothing for 10 seconds by default, and a quiet feed was cut before its first heartbeat at 15. The stream's timeout replaces the server's even where that one is longer, or 0, and one the handler set itself, such as the server.timeout(req, 0) of Bun's own guide; a generator that wants another sets its own. A quiet feed now stays open, so one without until holds a stopping server for its whole grace period: end it on draining. On a unix socket, where Bun ignores a request's timeout, the heartbeat has to stay under 8 seconds.
  • @tetsujs/sse: a heartbeatMs, or a keep-alive's everyMs, that is NaN, Infinity, a negative, over 2³¹ − 1 or not a number at all is refused with a TypeError where the stream is made. Read as none, a NaN heartbeat — what Number() of an unset variable gives — let Bun close every quiet feed, and Infinity made a timer beat every millisecond. A string, read from JSON say, used to pass as the number it spelled.
  • @tetsujs/core: a server serve() started says what stopped it — its own afterAll, request.stop() or stopServers() — when a request, a client or request.url reaches it afterwards. One started in beforeAll failed every request with a bare ConnectionRefused.
  • @tetsujs/core: in testCtx(), ctx.server.timeout() does nothing instead of throwing, since a unit test has no connection to time out. A handler that sets a timeout, or returns a stream with a keep-alive, can be called and read directly.
  • @tetsujs/lifecycle, @tetsujs/sse: the examples of stopping and draining are written in the order an application can be: the route, then the server, then onShutdownSignals(server), with the handler reading the signal when a request comes in. They took the signal from a server the routes had to exist before (#73).
  • @tetsujs/sse: sse() sends x-accel-buffering: no. nginx, which buffers a proxied response by default, held the events until its buffer filled or the stream ended, so a live feed behind it looked dead while the server was sending (#79).

Full Changelog: v0.6.1...v0.6.2