Skip to content

Release notes

Flare 0.3.x breaking changes and new surfaces since 0.2.

AI generated, pending review Updated 10 days ago · Flare 0.3

What changed since Flare 0.2, summarized from the @flare-ts/core changelog. Signatures and validator codes live in the API Reference.

WebSocket upgrade hook. One pre-handshake moment with request context, attached with .upgrade() on the handle route() or controller() returns (the controller form now returns a WebSocketControllerHandle). Return nothing to proceed (with provides seeding ws.state), a FlareResponse to deny before the handshake, or a WebSocketRefusal(code, reason) to accept then immediately close with a code and reason a browser can read. Front-door only: a hooked route on a Durable Object’s .ws arc fails host.build() with WS_UPGRADE_IN_DURABLE_OBJECT.

Logging. New log.unhandledErrors config field (default true): errors reaching the framework’s fallback response are logged at error level before the response envelope replaces them.

ChangeMigration
flareContract renamed to httpContractUpdate imports; no alias ships
Handler inject: [Token] removedUse named map: inject: { name: Token }, read scope.name
scope.inject(token) removedDestructure from scope or use property access
Bare object contract route option removedUse inline descriptor fields or a branded httpContract entry
CFWExportedHandle renamedImport WorkerExportedHandle from @flare-ts/core/cloudflare

Renamed type and accessor names, with no aliases. Update imports mechanically; the shapes are unchanged.

OldNew
FlareHandlerScopeHttpHandlerScope
FlareErrorHandlerHttpErrorHandler
RouteOptionsHttpRouteOptions
RouteHandlerHttpRouteHandler
MiddlewareOptionsHttpMiddlewareOptions
BeforeMiddlewareHandlerHttpBeforeHandler
AfterMiddlewareHandlerHttpAfterHandler
FinallyMiddlewareHandlerHttpFinallyHandler
ErrorHandlerOptionsHttpErrorHandlerOptions
FlareHostConfigHostConfig
FlareCookiesConfigCookiesConfig
FlareLogConfigLogConfig
FlareWebSocketsConfigWebSocketsConfig
exposedDetailrawDetail
CFWLoggerTransportCfLoggerTransport
CFWLoggerTransportClassCfLoggerTransportClass
FlareReadonlyDeepReadonly
FlareErrorCategoriesErrorCategories
FlareErrorCategoryErrorCategory
CodeDescriptorErrorCodeDescriptor
FlareTestReqTestRequestInit
FlareBuildSnapshotBuildSnapshot

Durable Objects. host.durableObject(Class) registers a class extending FlareDurableObject with typed .http, .ws, .mount, and .resolve on the returned handle. Request state crosses the Worker-to-instance boundary through blessed seams (.mount, durable(...).forward); raw durable(...).fetch() strips framework state headers by design. White-box testing helpers ship on @flare-ts/core/cloudflare (composeDurableInstance, fakes for env and storage).

WebSockets. host.ws.route(path) and host.ws.controller register WebSocket endpoints on Node, Workers, and Durable Objects. socketContract types messages; scope.input carries upgrade params and parsed messages. Channels (WebSocketChannels), per-connection ws.state, and hibernation on Durable Objects are first-class.

Host extensions. defineHostExtension lets packages add typed members to FlareHost when passed in the constructor array.

HTTP additions. Server-sent events via ctx.sse(producer). Signed cookies via ctx.cookies.setSigned / getSigned with a cookies config section and optional signedCookies: true on route descriptors.

Logging. WebSocket connections get a WebSocketLogContext; Durable Object handlers can correlate to the parent HTTP request via parentRequestId.

  • httpContract entries are branded by arc; wrong-arc contracts fail at build() with CONTRACT_KIND_MISMATCH.
  • Inline HTTP handlers read parsed route, query, and body values from scope.input when declared on the route options. Controller methods with httpContract still use ctx.extract(entry).

This site is a greenfield rewrite for 0.3. Old 0.2 paths (/core/http/routes/, etc.) do not carry forward. Use the sidebar to find a topic’s new home.

Full framework changelog: github.com/lumex-solutions/flare-ts.