Releases: remorses/spiceflow
spiceflow@1.17.8
Patch Changes
- 0e7ac1d: Fix SSE streaming to gracefully handle abort errors without throwing. Previously, when a streaming request was aborted (e.g., user navigates away or cancels the request), the async generator would throw errors like "BodyStreamBuffer was aborted". Now these abort-related errors are caught and the generator simply stops without throwing, making the client more resilient to common abort scenarios.
spiceflow@1.17.7
spiceflow
1.17.6
Patch Changes
-
Add
preventProcessExitIfBusymiddleware for graceful shutdown handling. This middleware tracks in-flight requests and prevents the process from exiting while requests are being processed. It handles SIGINT and SIGTERM signals, waiting for active requests to complete before allowing process exit. The middleware is created withscoped: falseto ensure it applies globally across all mounted apps.import { preventProcessExitIfBusy } from 'spiceflow' const app = new Spiceflow() .use(preventProcessExitIfBusy({ maxWaitSeconds: 300, // Max time to wait for requests (default: 300) checkIntervalMs: 250 // Check interval in ms (default: 250) })) .get('/', () => ({ hello: 'world' }))
Particularly useful for platforms like Fly.io that support graceful shutdown periods (up to 5 minutes) during deployments, ensuring long-running requests like AI workloads complete successfully.
1.17.5
Patch Changes
- Internal improvements
1.17.4
Patch Changes
- Softer type for handler return type, allow Cloudflare Response
1.17.3
Patch Changes
-
268ba47: Add x-spiceflow-agent header to client requests to identify requests coming from the Spiceflow client. This header is set to 'spiceflow-client' for all requests made through the createSpiceflowClient function.
Add
disableSuperJsonUnlessRpcoption to Spiceflow constructor. When set totrue, superjson serialization is only applied to responses when the request includes thex-spiceflow-agent: spiceflow-clientheader. This allows you to disable superjson for regular HTTP requests while keeping it enabled for RPC clients. In a future major version, this will become the default behavior. When a parent app has this flag set totrue, all child apps mounted with.use()will inherit this setting.Convert
superjsonSerializeandturnHandlerResultIntoResponsefrom standalone functions to private methods of the Spiceflow class. This improves encapsulation and allows these methods to access instance properties like thedisableSuperJsonUnlessRpcflag.
1.17.2
Patch Changes
- Add resources to the server
1.17.1
Patch Changes
- Fix safePath not working for .route
1.17.0
Minor Changes
-
Remove
pathparameter fromaddMcpTools()function and makeignorePathsrequired. Users should now pass an array of paths to ignore directly instead of a single path. Example usage:await addMcpTools({ mcpServer, app, ignorePaths: ['/sse', '/mcp'], })
1.16.1
Patch Changes
- Improve MCP server initialization by adding explicit capabilities registration and cleaning up code formatting. The
mcpServer.server.registerCapabilities()call ensures proper MCP server setup with tools and resources capabilities.
1.16.0
Minor Changes
-
4e2a0e6: Make route method field optional with
*as default. Routes without an explicitmethodfield now listen on all HTTP methods instead of requiring a method to be specified. This change simplifies route creation for catch-all handlers.Before:
app.route({ method: 'GET', // required path: '/api/users', handler: () => 'users', })
After:
// Method is now optional, defaults to '*' (all methods) app.route({ path: '/api/users', handler: () => 'users', }) // Explicit method still works app.route({ method: 'GET', path: '/api/users', handler: () => 'users', })
1.15.1
Patch Changes
-
Add support for
*wildcard in route method field to listen on all HTTP methods. When usingmethod: '*'in the route configuration, the route will respond to all HTTP methods (GET, POST, PUT, DELETE, etc.). This provides a convenient way to create catch-all routes without having to specify each method individually.app.route({ method: '*', path: '/api/*', handler: ({ request }) => ({ method: request.method }), })
1.15.0
Minor Changes
-
Simplify addMcpTools API and make path parameter required. The addMcpTools function now always adds the OpenAPI route without checking if it exists, uses parameters directly instead of fetching from _mcp_config route, and requires the path parameter to be explicitly provided. This makes the API more predictable and straightforward to use.
-
Enable addMcpTools to work without mcp() plugin. The addMcpTools function now automatically adds the required OpenAPI and config routes (
/_mcp_openapiand/_mcp_config) if they don't already exist, allowing it to work with any Spiceflow app even without the mcp() plugin. This makes it easier to integrate MCP tools into existing applications.
1.14.2
Patch Changes
- Fix McpServer API usage by accessing setRequestHandler through the server property. The McpServer class changed its API and no longer exposes setRequestHandler directly - it must be accessed via mcpServer.server.setRequestHandler().
- Add test for addMcpTools function and update types. The addMcpTools function now properly types its parameters with McpServer from @modelcontextprotocol/sdk, ensuring better type safety when integrating external MCP servers with Spiceflow applications.
1.14.1
Patch Changes
-
Add
addMcpToolshelper function that configures MCP tools for an existing server and Spiceflow app. This provides a convenient way to add Spiceflow route tools to an existing MCP server instance.const mcpServer = await addMcpTools({ mcpServer, app })
1.14.0
Minor Changes
-
The
listenandlistenForNodemethods now return an object with{port, server}instead of just the server instance. The port field contains the actual listening port, which is especially useful when using port 0 for random port assignment.// Before const server = await app.listen(3000) // After const { port, server } = await app.listen(3000) console.log(`Server listening on port ${port}`) // Useful with port 0 for random port const { port, server } = await app.listen(0) console.log(`Server assigned random port ${port}`)
Patch Changes
-
37c3f7b: Add path parameter to onError handler and validate error status codes. The onError handler now receives the request path where the error occurred, making it easier to debug and log errors with context. Additionally, error status codes are now validated to ensure they are valid HTTP status codes (100-599), defaulting to 500 for invalid values. The error status resolution now also supports
statusCodeas a fallback whenstatusis not present.// Before app.onError(({ error, request }) => { console.log('Error occurred', error) return new Response('Error', { status: 500 }) }) // After app.onError(({ error, request, path }) => { console.log(`Error occurred at ${path}`, error) return new Response('Error', { status: 500 }) })
-
d4f555c: Fix duplicate base path handling in nested Spiceflow apps. The
joinBasePathsmethod now properly handles cases where parent paths are prefixes of child paths, preventing duplicate path segments from being concatenated. This ensures that nested Spiceflow instances with overlapping base paths generate correct URLs.
1.13.3
Patch Changes
-
Add path parameter to onError handler and validate error status codes. The onError handler now receives the request path where the error occurred, making it easier to debug and log errors with context. Additionally, error status codes are now validated to ensure they are valid HTTP status codes (100-599), defaulting to 500 for invalid values.
// Before app.onError(({ error, request }) => { console.log('Error occurred', error) return new Response('Error', { status: 500 }) }) // After app.onError(({ error, request, path }) => { console.log(`Error occurred at ${path}`, error) return new Response('Error', { status: 500 }) })
1.13.2
Patch Changes
- move the request check at runtime instead of type
1.13.1
Patch Changes
- Fix types because of an issue with array method params
1.13.0
Minor Changes
- Add waitUntil
1.12.3
Patch Changes
- .request is not allowed for GET routes
1.12.2
Patch Changes
- 915f7d9: query type has values always defined, no optional keys
1.12.1
Patch Changes
- app.safePath('/posts/', { '': 'some/key' }) support
1.12.0
Minor Changes
- Add this type inside handlers to reference the app
1.11.3
Patch Changes
- Fix type safety for .route and methods on client
1.11.2
Patch Changes
- Fix support for Cloudflare without node, fix ./_node-server exports
1.11.1
Patch Changes
- Fix support for request to pass schema
1.11.0
Minor Changes
- 7da7fb9: Deprecate body, use request instead. It aligns better with request reponse
- fe3c152: Added .route
Patch Changes
- fe3c152: Fix missing package.json package
1.10.1
Patch Changes
- Disable exposeHeaders in cors by default
1.10.0
Minor Changes
- add support for zod v4
1.9.1
Patch Changes
- return parsed schema value if defined
1.9.0
Minor Changes
- Use @standard-schema/spec, remove ajv, works on Cloudflare workers
1.8.0
Minor Changes
- Allow passing state as second arg to handle.
1.7.2
Patch Changes
- Fix Next.js usage, Next.js is so retarded it manages to fuck up Readable.toWeb somehow
1.7.1
Patch Changes
- Use writeHead in handleNode
1.7.0
Mi...
spiceflow@1.17.6
Patch Changes
-
Add
preventProcessExitIfBusymiddleware for graceful shutdown handling. This middleware tracks in-flight requests and prevents the process from exiting while requests are being processed. It handles SIGINT and SIGTERM signals, waiting for active requests to complete before allowing process exit. The middleware is created withscoped: falseto ensure it applies globally across all mounted apps.import { preventProcessExitIfBusy } from 'spiceflow' const app = new Spiceflow() .use(preventProcessExitIfBusy({ maxWaitSeconds: 300, // Max time to wait for requests (default: 300) checkIntervalMs: 250 // Check interval in ms (default: 250) })) .get('/', () => ({ hello: 'world' }))
Particularly useful for platforms like Fly.io that support graceful shutdown periods (up to 5 minutes) during deployments, ensuring long-running requests like AI workloads complete successfully.
spiceflow@1.17.5
Patch Changes
-
Add
preventProcessExitIfBusymiddleware for graceful shutdown handling. This middleware tracks in-flight requests and prevents the process from exiting while requests are being processed. It handles SIGINT and SIGTERM signals, waiting for active requests to complete before allowing process exit.import { preventProcessExitIfBusy } from 'spiceflow' const app = new Spiceflow() .use(preventProcessExitIfBusy({ maxWaitSeconds: 300, // Max time to wait for requests (default: 300) checkIntervalMs: 250 // Check interval in ms (default: 250) })) .get('/', () => ({ hello: 'world' }))
spiceflow@1.17.4
Patch Changes
- Softer type for handler return type, allow Cloudflare Response
spiceflow@1.17.3
Patch Changes
-
268ba47: Add x-spiceflow-agent header to client requests to identify requests coming from the Spiceflow client. This header is set to 'spiceflow-client' for all requests made through the createSpiceflowClient function.
Add
disableSuperJsonUnlessRpcoption to Spiceflow constructor. When set totrue, superjson serialization is only applied to responses when the request includes thex-spiceflow-agent: spiceflow-clientheader. This allows you to disable superjson for regular HTTP requests while keeping it enabled for RPC clients. In a future major version, this will become the default behavior. When a parent app has this flag set totrue, all child apps mounted with.use()will inherit this setting.Convert
superjsonSerializeandturnHandlerResultIntoResponsefrom standalone functions to private methods of the Spiceflow class. This improves encapsulation and allows these methods to access instance properties like thedisableSuperJsonUnlessRpcflag.
spiceflow@1.17.2
Patch Changes
- Add resources to the server
spiceflow@1.17.1
Patch Changes
- Fix safePath not working for .route
spiceflow@1.17.0
Minor Changes
-
Remove
pathparameter fromaddMcpTools()function and makeignorePathsrequired. Users should now pass an array of paths to ignore directly instead of a single path. Example usage:await addMcpTools({ mcpServer, app, ignorePaths: ['/sse', '/mcp'], })
spiceflow@1.16.1
Patch Changes
- Improve MCP server initialization by adding explicit capabilities registration and cleaning up code formatting. The
mcpServer.server.registerCapabilities()call ensures proper MCP server setup with tools and resources capabilities.