UNPKG

restate-for-dummies

Version:

Type-safe Restate SDK wrapper with simplified API

63 lines 3.76 kB
import type { Serde, ServiceDefinition, VirtualObjectDefinition, WorkflowDefinition } from "@restatedev/restate-sdk"; import * as restate from "@restatedev/restate-sdk-clients"; import type { IngressWorkflowClient } from "@restatedev/restate-sdk-clients"; /** * Standalone typed client functions for use outside of Restate contexts. * These functions create properly typed clients with automatic SuperJSON serde handling. * * The serde automatically handles: * - Date objects * - undefined values * - BigInt * - RegExp * - Set/Map * - And other JavaScript types that standard JSON cannot serialize */ /** * Creates a typed service client for use outside of Restate contexts * Automatically applies SuperJSON serde for proper type serialization * @param service The service definition * @param serde The serialization/deserialization configuration */ export declare function createServiceClient<THandlers>(service: ServiceDefinition<string, THandlers>, serde: Serde<THandlers>, url: string): restate.IngressClient<THandlers>; /** * Creates a typed service send client for use outside of Restate contexts * Automatically applies SuperJSON serde for proper type serialization * @param service The service definition * @param serde The serialization/deserialization configuration */ export declare function createServiceSendClient<THandlers>(service: ServiceDefinition<string, THandlers>, serde: Serde<THandlers>, url: string): restate.IngressSendClient<THandlers>; /** * Creates a typed object client for use outside of Restate contexts * Automatically applies SuperJSON serde for proper type serialization * @param object The virtual object definition to create a client for * @param key The unique identifier for the object instance * @param serde The serialization/deserialization configuration */ export declare function createObjectClient<THandlers>(object: VirtualObjectDefinition<string, THandlers>, key: string, serde: Serde<THandlers>, url: string): restate.IngressClient<THandlers>; /** * Creates a typed object send client for use outside of Restate contexts * Automatically applies SuperJSON serde for proper type serialization * @param object The virtual object definition for send operations * @param key The unique identifier for the object instance * @param serde The serialization/deserialization configuration */ export declare function createObjectSendClient<THandlers>(object: VirtualObjectDefinition<string, THandlers>, key: string, serde: Serde<THandlers>, url: string): restate.IngressSendClient<THandlers>; /** * Creates a typed workflow client for use outside of Restate contexts * Automatically applies SuperJSON serde for proper type serialization * @param workflow The workflow definition to create a client for * @param key The unique identifier for the workflow instance * @param serde The serialization/deserialization configuration */ export declare function createWorkflowClient<THandlers>(workflow: WorkflowDefinition<string, THandlers>, key: string, serde: Serde<THandlers>, url: string): IngressWorkflowClient<THandlers>; /** * Creates a typed workflow send client for use outside of Restate contexts * Automatically applies SuperJSON serde for proper type serialization * Note: Uses the regular workflow client which supports send operations * @param workflow The workflow definition to create a client for * @param key The unique identifier for the workflow instance * @param serde The serialization/deserialization configuration */ export declare function createWorkflowSendClient<THandlers>(workflow: WorkflowDefinition<string, THandlers>, key: string, serde: Serde<THandlers>, url: string): IngressWorkflowClient<THandlers>; //# sourceMappingURL=standalone-clients.d.ts.map