actor-kit
Version:
Actor Kit is a library for running state machines in Cloudflare Workers, leveraging XState for robust state management. It provides a framework for managing the logic, lifecycle, persistence, synchronization, and access control of actors in a distributed
20 lines • 1.16 kB
TypeScript
import { AnyEventObject } from "xstate";
import { z } from "zod";
import { ActorKitStateMachine, ActorKitSystemEvent, ActorServer, Caller, EnvFromMachine, MachineServerOptions, WithActorKitContext, WithActorKitEvent } from "./types";
export declare const createMachineServer: <TClientEvent extends AnyEventObject, TServiceEvent extends AnyEventObject, TInputSchema extends z.ZodObject<z.ZodRawShape>, TMachine extends ActorKitStateMachine<(WithActorKitEvent<TClientEvent, "client"> | WithActorKitEvent<TServiceEvent, "service"> | ActorKitSystemEvent) & {
storage: DurableObjectStorage;
env: EnvFromMachine<TMachine>;
}, z.infer<TInputSchema> & {
id: string;
caller: Caller;
storage: DurableObjectStorage;
}, WithActorKitContext<any, any, any>>>({ machine, schemas, options, }: {
machine: TMachine;
schemas: {
clientEvent: z.ZodSchema<TClientEvent>;
serviceEvent: z.ZodSchema<TServiceEvent>;
inputProps: TInputSchema;
};
options?: MachineServerOptions;
}) => new (state: DurableObjectState, env: EnvFromMachine<TMachine>) => ActorServer<TMachine>;
//# sourceMappingURL=createMachineServer.d.ts.map