Releases: restatedev/sdk-typescript
Release v1.13.0
Changes
Check release 1.12.0 in case you missed it!
-
a296aa5: Fixes to
RestatePromise.map:- Bug fix: for promises created via
RestatePromise.resolve()/RestatePromise.reject(),.map()is now correctly executed. - Bug fix/Behavioral breaking change: for all other promises, the mapper closure now runs exactly once, regardless of how many times the resulting promise is awaited. Previously it ran on every await.
- Bug fix: for promises created via
-
a296aa5: Add
setOutputContentTypeIfEmptyhandler option, allowing handlers to configure the responsecontent-typeheader when the output body is empty.
This is needed when using Protobuf, where an empty body is still a valid message and thecontent-typemust be set accordingly.
Full Changelog: v1.12.0...v1.13.0
Release v1.12.0
New Features
Hooks and OpenTelemetry
A new hooks system lets you intercept handler execution and ctx.run() closures at the endpoint, service, or handler level.
Use it to integrate with your favourite observability libraries:
const myHookProvider: HooksProvider = (ctx) => ({
interceptor: {
handler: async (next) => {
console.log(`before ${ctx.request.target}`);
try {
await next();
} finally {
console.log(`after ${ctx.request.target}`);
}
},
run: async (name, next) => {
console.log(` run "${name}" executing`);
await next();
},
},
});
// Then in the service configuration:
const myService = restate.service({
name: "MyService",
handlers: { ... },
options: {
hooks: [myHookProvider],
},
});Together with the hooks interface, the new @restatedev/restate-sdk-opentelemetry package provides a ready-made OpenTelemetry integration.
It automatically propagates trace context from Restate and creates spans with standard Restate attributes (restate.invocation.id, restate.invocation.target):
import {openTelemetryHook} from "@restatedev/restate-sdk-opentelemetry";
import {trace} from "@opentelemetry/api";
const greeter = restate.service({
name: "Greeter",
options: {
// Set up the openTelemetryHook
hooks: [openTelemetryHook({tracer: trace.getTracer("greeter-service")})],
},
handlers: {
greet: async (ctx: Context, name: string) => {
// Add an event using trace.getActiveSpan().addEvent()
trace.getActiveSpan()?.addEvent("my.event", {name});
// ctx.runs get automatically their span, child of the handler attempt span.
const greeting = await ctx.run("compute-greet", async () => {
// You can get the ctx.run span here for downstream propagation
const span = trace.getActiveSpan();
return `Hello ${name}!`
});
return greeting;
},
},
});For more complete examples, check out:
- OpenTelemetry integration example: https://github.com/restatedev/examples/tree/main/typescript/integrations/opentelemetry
HTTP/1.1 Handler for Node.js
restate.createEndpointHandler() now returns a handler that works with both HTTP/2 and HTTP/1.1. It auto-detects the HTTP version per request:
import * as http from "node:http";
const restateSDKHandler = restate.createEndpointHandler({ services: [myService] });
const server = http.createServer(restateSDKHandler);
server.listen(9080);RestatePromise improvements
New factory methods to create already-completed Restate promises, mirroring Promise.resolve/Promise.reject:
RestatePromise.resolve(myValue);
RestatePromise.reject(new restate.TerminalError("Access denied"));We also expose isRestatePromise to reliably detect whether a promise is a RestatePromise.
Testcontainer options
alwaysReplay and disableRetries options added to the Restate testcontainer, to simplify testing edge cases in your code.
Check RestateContainer documentation for more details.
Experimental APIs
We're releasing two new experimental APIs:
- Explicit cancellation, to manually handle Restate's cancellation, instead of relying on
RestatePromisefailing withCancelledErrorwhen cancellation is received. - Signals, a way for invocations to communicate between each other.
For more info on these features, refer to the ContextInternal documentation.
The API of these features is experimental and might change in future releases.
Improvements and bug fixes
Awakeable.reject()now accepts aTerminalError, propagating error message, code, and metadata.- Added
asTerminalErrorand defaultserdehandler option. These take precedence over the already existing service/endpoint level configuration. RestatePromisecombinators now correctly handle empty input arrays (#611).Request.idis now anInvocationId.- Added
Request.targetto get the full invocation target. - Removed deprecated
SendOpts(useSendOptions). - Removed deprecated
*millisfields in retry policy.
Full Changelog: v1.11.1...v1.12.0
Release v1.11.1
What's Changed
- Test TerminalError.metadata by @slinkydeveloper in #658
- Bump testcontainers and wrangler dependency by @slinkydeveloper in #660
Full Changelog: v1.11.0...v1.11.1
Release v1.11.0
What's Changed
- Re-designed the GenericHandler interface. by @slinkydeveloper in #655
- Add support for metadata in TerminalError by @PfisterFactor in #646
New Contributors
- @PfisterFactor made their first contribution in #646
Full Changelog: v1.10.4...v1.11.0
Release v1.10.4
What's Changed
- Upgrade restate-sdk-shared-core to 0.9.0 (jsonwebtoken v10) by @tillrohrmann in #649
- Handle correctly closing the request stream by @slinkydeveloper in #651
- Context internal by @slinkydeveloper in #652
Full Changelog: v1.10.3...v1.10.4
Release v1.10.3
What's Changed
- New shared core assertion by @slinkydeveloper in #638
- Wait for all partitions are up before testcontainer is ready by @nikrooz in #640
- Use npm trusted publishing by @jackkleeman in #639
- Set publish.yml as the only non-reuseable publisher by @jackkleeman in #641
- Do npm publishing in release.yml by @jackkleeman in #642
- Add
rpc.opts({name})/rpc.sendOpts({name})to propagate entry name for call/send. by @slinkydeveloper in #644 - Add request signing tests to multi-runtime compatibility CI by @tillrohrmann in #645
- Bump Cloudflare Worker compatibility_date to 2026-02-19 by @tillrohrmann in #647
Full Changelog: v1.10.2...v1.10.3
Release v1.10.2
What's Changed
- Update sdk-shared-core to 0.7.0 by @slinkydeveloper in #636
- Fix StandardSchemaSerde constructor by @slinkydeveloper in #637
Full Changelog: v1.10.1...v1.10.2
Release v1.10.1
StandardSchema support
Introduced serde.schema API, allowing you to use any StandardSchema compliant library together with the Restate SDK:
import * as restate from "@restatedev/restate-sdk";
import { z } from "zod";
const Greeting = z.object({
name: z.string(),
});
const GreetingResponse = z.object({
result: z.string(),
});
const greeter = restate.service({
name: "Greeter",
handlers: {
greet: restate.createServiceHandler(
{
// New serde.schema API
input: restate.serde.schema(Greeting),
output: restate.serde.schema(GreetingResponse)
},
handler
),
},
});Note for zod users: You can use this API with Zod 4.2+ already, removing the need to use the restate-sdk-zod package. If you're using Zod < 4.2, either update zod or keep using the restate-sdk-zod package, we will continue to support it for a while.
What's Changed
- Test SDK against different templates (runtimes/bundler/...) by @nikrooz in #602
- Only publish packages inside
./packagesby @nikrooz in #603 - Better error message for
AbortErrorby @slinkydeveloper in #604 - Add
DO_NOT_TRACKto restate CI jobs by @nikrooz in #606 - Introduce the defaultSerde option by @slinkydeveloper in #605
- Little fix by @slinkydeveloper in #608
- Test suite 3.2 upgrade by @slinkydeveloper in #609
- Skip building docker image when service image is provided by @slinkydeveloper in #610
- Use unrepresentable with zod toJSONSchema by @slinkydeveloper in #613
- Run CI on release branches by @slinkydeveloper in #614
- Update Eslint and Typescript with stricter type checking by @nikrooz in #612
- Add better error description for negative duration by @slinkydeveloper in #617
- Switch to using
tsdownby @nikrooz in #618 - Update
crazy-max/ghaction-setup-dockerto v4 by @muhamadazmy in #621 - Reorg monorepo by @nikrooz in #619
- Add Standard Schema support with
restate.serde.schemaby @slinkydeveloper in #631 - Improve validation error message by @slinkydeveloper in #632
- Re-export standard schema instead of importing the package by @slinkydeveloper in #633
Full Changelog: v1.9.1...v1.10.1
Release 1.9.1
- Run CI on release branches (9359989)
- Use unrepresentable with zod toJSONSchema (#613) (86679aa)
- Pull the services docker image in advance (e722738)
- Skip building docker image when service image is provided (#610) (31dac34)
- Test suite 3.2 upgrade (#609) (55966d7)
- Better error message for
AbortError(#604) (87dd8ee) - Typo in release-docs.yml (fb0c752)
- Add github workflow for releasing tsdocs (163d2b3)
Release 1.9.0
Zod v4
Our integration module with zod now supports Zod v4.
If you're a Zod v3 users, we suggest to continue using @restatedev/restate-sdk-zod version 1.8.3, which is fully compatible with the SDK 1.9
Invocation retry policy
When used with Restate 1.5, you can now configure the invocation retry policy from the SDK directly. See https://github.com/restatedev/restate/releases/tag/v1.5.0 for more details on the new invocation retry policy configuration.
AWS Lambda compression
Restate server will now compress requests before sending them to AWS Lambda, when approaching the invocation payload limit. This allows for larger replays without hitting the PAYLOAD_TOO_LARGE error from Lambda.
Requires Restate 1.5 and re-registering the deployment. See https://github.com/restatedev/restate/releases/tag/v1.5.0 for more details.
Changes to ctx.rand
We have updated how the ctx.rand seed is generated. As usual with minor SDK releases, make sure to register a new deployment to register the new service revisions. Refer to the versioning documentation for more details.
Full changelog
- Update shared core (#599) (d0b5bc9)
- Update versions (77d9c53)
- Zod v4 support (#598) (bed4b23)
- Deprecate endpoint() API (7bf6c68)
- Clarification on max attempts meaning (#596) (84b6b85)
- Test suite 3.1 (#595) (258feec)
- Service Protocol V6 + random seed (#593) (6a62407)
- [CI] support env vars and test artifact output parameters in integration.yaml (14cf983)
- Add retry policy configuration for service/handlers (#592) (a4c4d74)
- Revert "Flush early context run (#591)" (198f2d0)
- Flush early context run (#591) (51f2578)
- Bump CI to Node 20 (#589) (8122a0b)
- Fix localCompare usage in LambdaHandler (#588) (6e8c5ca)
- Lambda Compression (#586) (62ef7ab)