Skip to main content

abstractRoutine <Output, Input, Options>

Hierarchy

Index

Events

readonlyonCommand

onCommand: Event<[string, string[]], string> = ...

Called after execa was executed.

readonlyonCommandData

onCommandData: Event<[string, string], string> = ...

Called while a command is being executed.

readonlyonFail

onFail: Event<[null | Error, Input], string> = ...

Called when an execution fails.

readonlyonPass

onPass: Event<[Output, Input], string> = ...

Called when an execution succeeds.

readonlyonRun

onRun: BailEvent<[Input], string> = ...

Called before a work unit is executed. Can return true to skip the work unit.

readonlyonSkip

onSkip: Event<[Input], string> = ...

Called when an execution is skipped.

Other

constructor

  • new Routine<Output, Input, Options>(key: string | string[], title: string, options?: Options): Routine<Output, Input, Options>
  • Type parameters

    • Output = unknown
    • Input = unknown
    • Options: object = {}

readonlydebug

debug: Debugger

depth

depth: number = 0

Current depth of nested pipelines.

index

index: number = 0

Current index amongst sibling work units.

optionalinput

input?: Input

readonlykey

key: string

readonlyoptions

options: Readonly<Required<Options>>

Validated and configured options.

optionaloutput

output?: Output

startTime

startTime: number = 0

statusText

statusText: string = ''

stopTime

stopTime: number = 0

readonlytitle

title: string

id

  • get id(): string
  • Return a unique hierarchical ID.

abstractblueprint

  • blueprint(_schemas: __module, onConstruction?: boolean): object
  • Define an optimal blueprint in which to validate and build the options object passed to the constructor, or when manual setting.

    A boolean is passed as the 2nd argument to determine whether this is validating on class instantiation (first time), or by calling configure() (all other times).

configure

  • configure(options?: Partial<Options> | (options: Required<Options>) => Partial<Options>): Readonly<Required<Options>>
  • Set an options object by merging the new partial and existing options with the defined blueprint, while running all validation checks. Freeze and return the options object.

    object.configure({ name: 'Boost' });

    object.configure((prevOptions) => ({
    nestedObject: {
    ...prevOptions.nestedObject,
    some: 'value',
    },
    }));

createAggregatedPipeline

  • Create and return a AggregatedPipeline. This pipeline will execute all work units in parallel without interruption. Returns an object with a list of errors and results once all resolve.


    Type parameters

createConcurrentPipeline

  • Create and return a ConcurrentPipeline. This pipeline will execute all work units in parallel. Returns a list of values once all resolve.


    Type parameters

createPooledPipeline

  • Create and return a PooledPipeline. This pipeline will execute a distinct set of work units in parallel without interruption, based on a max concurrency, until all work units have ran. Returns a list of errors and results once all resolve.


    Type parameters

createWaterfallPipeline

  • Create and return a WaterfallPipeline. This pipeline will execute each work unit one by one, with the return value of the previous being passed to the next. Returns the final value once all resolve.


    Type parameters

abstractexecute

  • execute(context: Context, value: Input): Promise<Output>
  • Execute the current routine and return a new value.

executeCommand

  • executeCommand(command: string, args: string[], options?: {} & CommonOptions<utf8> & ExecuteCommandOptions): Promise<ExecaReturnValue<string>>
  • Execute a command with the given arguments and pass the results through a promise.

hasFailed

  • hasFailed(): boolean
  • Return true if the task failed when executing.

hasPassed

  • hasPassed(): boolean
  • Return true if the task executed successfully.

isComplete

  • isComplete(): boolean
  • Return true if the task has been completed in any form.

isPending

  • isPending(): boolean
  • Return true if the task has not been executed yet.

isRunning

  • isRunning(): boolean
  • Return true if the task is currently running.

isSkipped

  • isSkipped(): boolean
  • Return true if the task was or will be skipped.

run

  • run(context: Context, value: Input): Promise<Output>
  • Run the current task by executing it and performing any before and after processes.

setMonitor

  • Set the monitor to pass to nested pipelines.

skip

  • skip(condition?: boolean): this
  • Mark a task as skipped if the condition is true.