UNPKG

@ofzza/adventofcode

Version:
64 lines (63 loc) 1.96 kB
import { TTaskConfiguration } from '../config/types'; /** * Implements task management and running functinoality */ export declare class Task implements TTaskConfiguration { /** * Gets list of all runnable tasks * @param tasks Array of tasks to run * @param name Start of name of task(s) to run * @param type Type of tasks to run * @returns List of all runnable tasks */ static get({ tasks, name, type }?: { tasks?: number[]; name?: string; type?: string; }): Task[]; /** * Runs requested tasks * @param argv Startup arguments * @param name Start of name of task(s) to run * @param type Type of tasks to run * @param stdoutCallback: (text: string) => void */ static run(argv: Record<string, string | string[]>, stdoutCallback: (text: string) => void): AsyncGenerator<Task | TaskResult>; name?: string; type?: string; command: string; args?: string[]; value?: string; runs?: Record<string, string>[]; private custom?; constructor(task: TTaskConfiguration, custom?: Record<string, string>); /** * Gets high resolution time in [ms] * @returns High resolution time in [ms] */ private getHRTime; /** * Execute task * @returns Task execution result * @param stdoutCallback Callback function called on every stdout event */ run(stdoutCallback: (text: string) => void): Promise<TaskResult>; } /** * Contains results from an executed task */ export declare class TaskResult { task: TTaskConfiguration; time: number; value: string | Error; output?: string; /** * If error was thrown while executing the task command */ get isError(): boolean; /** * If returned value matches expected value */ get isValid(): boolean | undefined; constructor(task: TTaskConfiguration, time: number, value: string | Error, output?: string); }