1 |
|
2 | import { Events, Executor, NoDataEvents, Handle } from '../executors/Executor';
|
3 | import { ErrorFormatOptions } from '../common/ErrorFormatter';
|
4 | export default class Reporter implements ReporterProperties {
|
5 | readonly executor: Executor;
|
6 | protected _console: Console | undefined;
|
7 | protected _executor: Executor | undefined;
|
8 | protected _handles: Handle[] | undefined;
|
9 | protected _output: ReporterOutput | undefined;
|
10 | protected _eventHandlers: {
|
11 | [eventName: string]: string;
|
12 | } | undefined;
|
13 | constructor(executor: Executor, options?: ReporterOptions);
|
14 | get console(): Console;
|
15 | set console(value: Console);
|
16 | get output(): ReporterOutput;
|
17 | set output(value: ReporterOutput);
|
18 | formatError(error: Error, options?: ErrorFormatOptions): string;
|
19 | protected _registerEventHandlers(): void;
|
20 | }
|
21 | export declare function createEventHandler<E extends Events, N extends NoDataEvents = NoDataEvents>(): () => {
|
22 | (target: any, propertyKey: N, _descriptor: TypedPropertyDescriptor<() => void | Promise<any>>): void;
|
23 | <T extends keyof E>(target: any, propertyKey: T, _descriptor: TypedPropertyDescriptor<(data: E[T]) => void | Promise<any>>): void;
|
24 | };
|
25 | export declare const eventHandler: () => {
|
26 | (target: any, propertyKey: NoDataEvents, _descriptor: TypedPropertyDescriptor<() => void | Promise<any>>): void;
|
27 | <T extends keyof Events>(target: any, propertyKey: T, _descriptor: TypedPropertyDescriptor<(data: Events[T]) => void | Promise<any>>): void;
|
28 | };
|
29 | export interface ReporterProperties {
|
30 | output: ReporterOutput;
|
31 | console: Console;
|
32 | }
|
33 | export declare type ReporterOptions = Partial<ReporterProperties>;
|
34 | export interface ReporterOutput {
|
35 | write(chunk: string | Buffer, encoding?: string, callback?: Function): void;
|
36 | end(chunk: string | Buffer, encoding?: string, callback?: Function): void;
|
37 | }
|
38 |
|
\ | No newline at end of file |