v0.1.0-beta.24
core:
- Simplify generateContractFromType to work without providing filePath and exportName. filePath remains as fallback option (38a1e07)
core, express, fastify, fetch, hono, node, server, tanstack-query:
- Type helpers accept a route tree as well as a single route and infer a matching tree of types, so one exported type can be indexed per route:
InferServerRequest<typeof routes>["todos"]["create"]. This applies toInferClientRequest,InferClientResponse,InferServerRequest,InferServerResponse, the adapterInferServerHandler, and the TanStack QueryInfer*helpers. AddInferClientStreamDatato@rest-rpc/core, which infers thedataof each event received from a streaming route without theSseEventwrapper. (fec6317)
express, fastify, fetch, hono, node, server:
- Rename the adapter
RouteHandlertype toInferServerHandlerto match theInfer*style of the core helpers.InferServerHandlernow expects a plain return value for.output()routes instead of a status envelope. RemoveRouteRequestandRouteErrorsfrom the adapter roots: useInferServerRequestfor the validated request,Parameters<InferServerHandler<typeof route>>[0]for the full handler argument, andExtract<InferServerResponse<typeof route>, { status: 404 }>for specific status responses. (fec6317)
fetch, node:
- Move adapter building blocks out of the package roots.
createFetchResponseanddeserializeRequestBodyare now exported from@rest-rpc/fetch/adapter(replacing the@rest-rpc/fetch/deserializeRequestBodysubpath), andcreateRequestSignal,parseRequestTarget,createNodeResponseStream,writeNodeResponse,writeStreamResponse, andnodeBodyCodecsfrom@rest-rpc/node/adapter. Both roots now exportInferServerHandlerlike the other adapters, no longer export theImplicitResponse*/ServerFirst*types, and@rest-rpc/fetchexportsFetchRouteHandlerResult. (fec6317)
tanstack-query:
- Rename the TanStack Query type helpers to match the
Infer*style of the core helpers:RouteQueryData→InferQueryData,RouteQueryError→InferQueryError,RouteMutationVariables→InferMutationVariables,RouteInfiniteQueryData→InferInfiniteQueryData, andRouteStreamedQueryData→InferStreamedQueryData. (fec6317)