Skip to content

RPC transforms API

Starts a transform definition. Chain .caller(factory) and/or .callee(factory).

Binds callee options for applyTransforms. Parameterless transforms omit options.

Installs transforms on all async methods or selected methods. Installation mutates the prototype and is cumulative.

Added to configured bindings by the Vite plugin. Returns a target with transformed async method types.

Manually wraps one Durable Object stub or Worker service binding.

Manually wraps a Durable Object namespace so returned stubs expose .with().

createTransformContextTarget(target, context)

Section titled “createTransformContextTarget(target, context)”

Creates a promise-pipelined target carrying typed context. Return it from setContext() when a caller transform invokes next({ context }).

The underlying context-target class. Prefer the factory in normal integrations.

Import from @durability/transforms/vite:

doTransforms({ wrangler: './wrangler.jsonc' })

The plugin validates Wrangler configuration, wraps matching bindings, and emits do-transforms.generated.d.ts by default.

TransformCaller-visible return
betterResultCodecPreserved or rehydrated Result<T, E>
errorBoundaryResult<T, unknown>
abortAsSuccessResult<T | undefined, never>
timeoutOriginal method return type
retryOriginal method return type
largeObjectStreamOriginal method return type after runtime validation
  • CallerTimeoutError
  • LargeObjectEncodeLimitError
  • LargeObjectDecodeLimitError
  • LargeObjectValidationError

Transform chains check target compatibility, caller and callee options, context compatibility, async method names, and transformed return types at compile time.