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
33 lines • 1.49 kB
TypeScript
import { Caller } from "./types";
import { Actor, SnapshotFrom } from "xstate";
import { BaseActorKitStateMachine } from "./types";
export declare enum LogLevel {
ERROR = 0,
WARN = 1,
INFO = 2,
DEBUG = 3
}
declare global {
var DEBUG_LEVEL: LogLevel | undefined;
}
export declare function debug(message: string, level?: LogLevel, data?: any): void;
export declare const logError: (message: string, data?: any) => void;
export declare const logWarn: (message: string, data?: any) => void;
export declare const logInfo: (message: string, data?: any) => void;
export declare const json: <T>(data: T, status?: number) => Response;
export declare const ok: () => Response;
export declare const error: (err: string | {
message: string;
}, status?: number) => Response;
export declare const notFound: () => Response;
export declare const parseQueryParams: (url: string) => URLSearchParams;
export declare function assert<T>(expression: T, errorMessage: string): asserts expression;
export declare function getCallerFromRequest(request: Request, actorType: string, actorId: string, secret: string): Promise<Caller>;
export declare function parseAccessTokenForCaller({ accessToken, type, id, secret, }: {
accessToken: string;
type: string;
id: string;
secret: string;
}): Promise<Caller>;
export declare function getSnapshot<TMachine extends BaseActorKitStateMachine>(actor: Actor<TMachine>): SnapshotFrom<TMachine> | undefined;
//# sourceMappingURL=utils.d.ts.map