Restate Typescript SDK
    Preparing search index...

    Options for connect.

    A usual connect setup requires 3 configuration options:

    • The services to expose
    • The name (or env RESTATE_CONNECT_NAME) of the deployment, used to identify this version of the code.
    • The key (or RESTATE_CONNECT_KEY) required to connect to Restate Cloud/BYOC
    interface ConnectOptions {
        connection?: ConnectionOptions;
        defaultServiceOptions?: DefaultServiceOptions;
        identityKeys?: string[];
        journalValueCodecProvider?: () => Promise<JournalValueCodec>;
        key?: string;
        logger?: LoggerTransport;
        name?: string;
        services: (
            | ServiceDefinition<string, unknown>
            | VirtualObjectDefinition<string, unknown>
            | WorkflowDefinition<string, unknown>
        )[];
    }

    Hierarchy (View Summary)

    Index

    Properties

    connection?: ConnectionOptions

    Advanced connection options.

    defaultServiceOptions?: DefaultServiceOptions

    Default service options that will be used by all services bind to this endpoint.

    Options can be overridden on each service/handler.

    identityKeys?: string[]

    Provide a list of v1 request identity public keys eg publickeyv1_2G8dCQhArfvGpzPw5Vx2ALciR4xCLHfS5YaT93XjNxX9 to validate incoming requests against, limiting requests to Restate clusters with the corresponding private keys. This public key format is logged by the Restate process at startup if a request identity private key is provided.

    If this function is called, all incoming requests irrelevant of endpoint type will be expected to have x-restate-signature-scheme: v1 and x-restate-jwt-v1: <valid jwt signed with one of these keys>. If not called,

    journalValueCodecProvider?: () => Promise<JournalValueCodec>

    Provider for the codec to use for journal values. One codec will be instantiated globally for this endpoint. Check JournalValueCodec for more details

    key?: string

    The connect key from the Cloud UI -> Development → Configure SDK.

    Also configurable via env RESTATE_CONNECT_KEY.

    Replace the default console-based LoggerTransport

    Using console:

    createEndpointHandler({ logger: (meta, message, ...o) => {console.log(`${meta.level}: `, message, ...o)}})
    

    Using winston:

    const logger = createLogger({ ... })
    createEndpointHandler({ logger: (meta, message, ...o) => {logger.log(meta.level, {invocationId: meta.context?.invocationId}, [message, ...o].join(' '))} })

    Using pino:

    const logger = pino()
    createEndpointHandler({ logger: (meta, message, ...o) => {logger[meta.level]({invocationId: meta.context?.invocationId}, [message, ...o].join(' '))}} )
    name?: string

    Required: The deployment name, e.g. "greeter-v1": the identity you register (restate deployments register connect://<name>). Restate Cloud/BYOC routes by <environment>/<name> and load-balances across every connection under it, so replicas of the same deployment share one name and distinct deployments each have their own. Letters, digits, ., _ and -.

    Also configurable via env RESTATE_CONNECT_NAME.

    services: (
        | ServiceDefinition<string, unknown>
        | VirtualObjectDefinition<string, unknown>
        | WorkflowDefinition<string, unknown>
    )[]

    A list of Restate services, virtual objects, or workflows that will be exposed via the endpoint.