chrono-forge
Version:
A comprehensive framework for building resilient Temporal workflows, advanced state management, and real-time streaming activities in TypeScript. Designed for a seamless developer experience with powerful abstractions, dynamic orchestration, and full cont
56 lines (55 loc) • 1.62 kB
TypeScript
import { StepMetadata } from '../decorators/Step';
export type DSLDefinition = {
variables: Record<string, unknown>;
plan: Statement;
};
export type Statement = {
condition?: (dsl: DSLDefinition) => Promise<boolean>;
retries?: number;
timeout?: number;
required?: boolean;
} & ({
sequence: Sequence;
} | {
parallel: Parallel;
} | {
execute: Execute;
});
export type Sequence = {
elements: Statement[];
};
export type Parallel = {
branches: Statement[];
};
export type Execute = {
code?: string;
step?: StepInvocation;
activity?: ActivityInvocation;
workflow?: WorkflowInvocation;
};
export type ActivityInvocation = {
name: string;
arguments?: string[];
result?: string;
group?: number;
};
export type WorkflowInvocation = {
name: string;
arguments?: string[];
result?: string;
group?: number;
};
export type StepInvocation = {
name: string;
arguments?: string[];
result?: string;
group?: number;
};
export declare function DSLInterpreter(dsl: DSLDefinition, injectedActivities?: Record<string, (...args: string[]) => Promise<string | undefined>>, injectedSteps?: Record<string, (...args: string[]) => Promise<string | undefined>>): Promise<unknown>;
/**
* Adapter function to convert StepMetadata from the @Step decorator into DSLDefinition format
*
* @param steps Array of step metadata from a Workflow class
* @returns DSLDefinition object representing the workflow steps
*/
export declare function convertStepsToDSL(steps: StepMetadata[], initialVariables?: Record<string, unknown>): DSLDefinition;