durable-execution - v0.32.0
    Preparing search index...

    Type Alias Serializer

    Interface for serializing and deserializing task inputs and outputs.

    The serializer is responsible for converting JavaScript values to/from strings for storage persistence. The executor uses this to store task inputs and outputs in the database.

    • Must handle all input and output types used by the application
    • Should preserve type information (Dates, etc.)
    • Must be deterministic (same input → same output)
    • Should handle circular references gracefully if they can be part of the input or output
    // Custom superjson serializer
    const customSerializer: Serializer = {
    serialize: (value) => superjson.stringify(value),
    deserialize: (str) => superjson.parse(str)
    }

    const executor = await DurableExecutor.make(storage, {
    serializer: customSerializer
    })
    type Serializer = {
        serialize: <T>(
            value: T,
        ) => string | Promise<string> | Effect.Effect<string, unknown>;
        deserialize: <T>(
            value: string,
        ) => T | Promise<T> | Effect.Effect<T, unknown>;
    }
    Index

    Properties

    serialize: <T>(
        value: T,
    ) => string | Promise<string> | Effect.Effect<string, unknown>
    deserialize: <T>(value: string) => T | Promise<T> | Effect.Effect<T, unknown>