@types/orchestrator
- Version 0.3.6
- Published
- 10.1 kB
- 2 dependencies
- MIT license
Install
npm i @types/orchestrator
yarn add @types/orchestrator
pnpm add @types/orchestrator
Overview
TypeScript definitions for orchestrator
Index
Classes
Interfaces
Type Aliases
Classes
class Orchestrator
class Orchestrator extends events.EventEmitter {}
A module for sequencing and executing tasks and dependencies in maximum concurrency
property doneCallback
doneCallback?: (error?: any) => any;
property isRunning
isRunning: boolean;
property seq
seq: any[];
property sequence
sequence: Orchestrator.Sequencify;
property start
start: Orchestrator.StartMethod;
property tasks
tasks: { [name: string]: Orchestrator.Task };
method add
add: { (name: string, fn?: Orchestrator.TaskFunc): Orchestrator; (name: string, deps?: string[], fn?: Orchestrator.TaskFunc): Orchestrator;};
Define a task
Parameter name
The name of the task.
Parameter fn
The function that performs the task's operations. For asynchronous tasks, you need to provide a hint when the task is complete: - Take in a callback - Return a stream or a promise
Define a task
Parameter name
The name of the task.
Parameter deps
An array of task names to be executed and completed before your task will run.
Parameter fn
The function that performs the task's operations. For asynchronous tasks, you need to provide a hint when the task is complete: - Take in a callback - Return a stream or a promise
method allDone
allDone: () => boolean;
method hasTask
hasTask: (name: string) => boolean;
Have you defined a task with this name?
Parameter name
The task name to query
method on
on: ( event: Orchestrator.EventNames, cb: (e: Orchestrator.OnCallbackEvent) => any) => this;
Listen to orchestrator internals
Parameter event
Event name to listen to: - start: from start() method, shows you the task sequence - stop: from stop() method, the queue finished successfully - err: from stop() method, the queue was aborted due to a task error - task_start: from _runTask() method, task was started - task_stop: from _runTask() method, task completed successfully - task_err: from _runTask() method, task errored - task_not_found: from start() method, you're trying to start a task that doesn't exist - task_recursion: from start() method, there are recursive dependencies in your task list
Parameter cb
Passes single argument: e: event details
method onAll
onAll: (cb: (e: Orchestrator.OnAllCallbackEvent) => any) => void;
Listen to all orchestrator events from one callback
Parameter cb
Passes single argument: e: event details
method reset
reset: () => Orchestrator;
method stop
stop: (err?: any, successfulFinish?: boolean) => void;
method task
task: { (name: string): Orchestrator.Task; (name: string, fn: Orchestrator.TaskFunc): void; (name: string, dep: string[], fn: Orchestrator.TaskFunc): void;};
Interfaces
interface AddMethod
interface AddMethod {}
call signature
(name: string, fn?: TaskFunc): Orchestrator;
Define a task
Parameter name
The name of the task.
Parameter fn
The function that performs the task's operations. For asynchronous tasks, you need to provide a hint when the task is complete: - Take in a callback - Return a stream or a promise
call signature
(name: string, deps?: string[], fn?: TaskFunc): Orchestrator;
Define a task
Parameter name
The name of the task.
Parameter deps
An array of task names to be executed and completed before your task will run.
Parameter fn
The function that performs the task's operations. For asynchronous tasks, you need to provide a hint when the task is complete: - Take in a callback - Return a stream or a promise
interface Meta
interface Meta {}
property duration
duration: number;
property hrDuration
hrDuration: [number, number];
property runMethod
runMethod: 'callback' | 'catch' | 'promise' | 'stream' | 'sync';
interface OnAllCallbackEvent
interface OnAllCallbackEvent extends OnCallbackEvent {}
property src
src: string;
interface OnCallbackEvent
interface OnCallbackEvent {}
interface StartMethod
interface StartMethod {}
Start running the tasks
call signature
(tasks: Strings, cb?: (error?: any) => any): Orchestrator;
Start running the tasks
Parameter tasks
Tasks to be executed. You may pass any number of tasks as individual arguments.
Parameter cb
Callback to call after run completed.
call signature
(...tasks: Strings[] /*, cb?: (error: any) => any */): Orchestrator;
Start running the tasks
Parameter tasks
Tasks to be executed. You may pass any number of tasks as individual arguments.
Parameter cb
Callback to call after run completed.
call signature
(task1: Strings, task2: Strings, cb?: (error?: any) => any): Orchestrator;
call signature
( task1: Strings, task2: Strings, task3: Strings, cb?: (error?: any) => any): Orchestrator;
call signature
( task1: Strings, task2: Strings, task3: Strings, task4: Strings, cb?: (error?: any) => any): Orchestrator;
call signature
( task1: Strings, task2: Strings, task3: Strings, task4: Strings, task5: Strings, cb?: (error?: any) => any): Orchestrator;
call signature
( task1: Strings, task2: Strings, task3: Strings, task4: Strings, task5: Strings, task6: Strings, cb?: (error?: any) => any): Orchestrator;
interface Task
interface Task {}
Type Aliases
type EventNames
type EventNames = | 'start' | 'stop' | 'err' | 'task_start' | 'task_stop' | 'task_err' | 'task_not_found' | 'task_recursion';
type RunTask
type RunTask = ( task: Orchestrator.TaskFunc, done: (err: any, meta: Orchestrator.Meta) => void) => void;
The method export generated by orchestrator/lib/runTask.js
type Sequencify
type Sequencify = ( tasks: Array<{ dep: string[] }>, names: string[]) => { sequence: string[]; missingTasks: string[]; recursiveDependencies: string[];};
The module export of the sequencify package: https://www.npmjs.com/package/sequencify
type Strings
type Strings = string | string[];
type TaskFunc
type TaskFunc = ( callback: (err?: any) => void) => Q.Promise<any> | stream.Stream | any;
A task, can either call a callback to indicate task completion or return a promise or a stream: (task is marked complete when promise.then() resolves/fails or stream ends)
Package Files (1)
Dependencies (2)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/orchestrator
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/orchestrator)
- HTML<a href="https://www.jsdocs.io/package/@types/orchestrator"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3366 ms. - Missing or incorrect documentation? Open an issue for this package.