(input: readonly StepJSON[])
| 7487 | export type StepJSON = [string, StepConfig, any[]?]; |
| 7488 | |
| 7489 | export function createStepsFromJSON(input: readonly StepJSON[]): readonly Step<any>[] { |
| 7490 | return input.map(([name, config, steps]) => { |
| 7491 | const StepClass = KnownSteps[name as keyof typeof KnownSteps] as unknown as new ( |
| 7492 | config: StepConfig, |
| 7493 | steps?: readonly Step<any>[], |
| 7494 | ) => Step<any>; |
| 7495 | if (StepClass === undefined) { |
| 7496 | throw new Error(`Unknown step: ${name}`); |
| 7497 | } |
| 7498 | if (Array.isArray(steps)) { |
| 7499 | return new StepClass(config, createStepsFromJSON(steps)); |
| 7500 | } |
| 7501 | return new StepClass(config); |
| 7502 | }); |
| 7503 | } |
no test coverage detected