UNPKG

1.2 kBTypeScriptView Raw
1/// <reference types="node" />
2import { Readable } from 'stream';
3import { Command, CommandIdentifier } from '../command';
4import { Logger } from '../logger';
5import { FlowController } from './flow-controller';
6/**
7 * Sends input from concurrently through to commands.
8 *
9 * Input can start with a command identifier, in which case it will be sent to that specific command.
10 * For instance, `0:bla` will send `bla` to command at index `0`, and `server:stop` will send `stop`
11 * to command with name `server`.
12 *
13 * If the input doesn't start with a command identifier, it is then always sent to the default target.
14 */
15export declare class InputHandler implements FlowController {
16 private readonly logger;
17 private readonly defaultInputTarget;
18 private readonly inputStream?;
19 private readonly pauseInputStreamOnFinish;
20 constructor({ defaultInputTarget, inputStream, pauseInputStreamOnFinish, logger, }: {
21 inputStream?: Readable;
22 logger: Logger;
23 defaultInputTarget?: CommandIdentifier;
24 pauseInputStreamOnFinish?: boolean;
25 });
26 handle(commands: Command[]): {
27 commands: Command[];
28 onFinish?: () => void | undefined;
29 };
30}