parent
89f8b61713
commit
6d455a46e2
@ -1,77 +0,0 @@ |
|||||||
interface Message { |
|
||||||
readonly message: string; |
|
||||||
readonly prefix: string; |
|
||||||
} |
|
||||||
|
|
||||||
interface PartialMessagesLeaf { |
|
||||||
readonly $messages?: string[]; |
|
||||||
} |
|
||||||
|
|
||||||
interface PartialMessagesRecursive { |
|
||||||
readonly [propName: string]: Messages | string[] | Message[]; // workaround for compatibility with PartialMessagesLeaf and PartialMessagesRoot
|
|
||||||
} |
|
||||||
|
|
||||||
interface PartialMessagesRoot { |
|
||||||
readonly $allMessages: Message[]; |
|
||||||
} |
|
||||||
|
|
||||||
type Messages = PartialMessagesLeaf & PartialMessagesRecursive; |
|
||||||
|
|
||||||
type MessagesRoot = PartialMessagesLeaf & PartialMessagesRecursive & PartialMessagesRoot; |
|
||||||
|
|
||||||
interface ReportResult { |
|
||||||
readonly errors: MessagesRoot; |
|
||||||
readonly warns: MessagesRoot; |
|
||||||
readonly infos: MessagesRoot; |
|
||||||
readonly messages: MessagesRoot; |
|
||||||
} |
|
||||||
|
|
||||||
interface Report { |
|
||||||
readonly date: number; |
|
||||||
readonly err?: string; |
|
||||||
readonly result?: ReportResult; |
|
||||||
} |
|
||||||
|
|
||||||
interface TaskProcessorCallback { |
|
||||||
(err: string): void; |
|
||||||
} |
|
||||||
|
|
||||||
interface TaskProcessorCore { |
|
||||||
readonly onError: (message: string | Error, prefix?: string) => void; |
|
||||||
readonly onWarn: (message: string, prefix?: string) => void; |
|
||||||
readonly onInfo: (message: string, prefix?: string) => void; |
|
||||||
readonly context?: any; |
|
||||||
} |
|
||||||
|
|
||||||
interface TaskProcessor extends TaskProcessorCore { |
|
||||||
readonly process: () => void; |
|
||||||
readonly processTask: (task: TaskInfo, innerCallback: TaskProcessorCallback) => void; |
|
||||||
readonly done: () => void; |
|
||||||
} |
|
||||||
|
|
||||||
interface TaskInfo { |
|
||||||
name?: string; |
|
||||||
type: string; |
|
||||||
params: any; |
|
||||||
} |
|
||||||
|
|
||||||
interface Task { |
|
||||||
(params: any, processor: TaskProcessor): () => void; |
|
||||||
} |
|
||||||
|
|
||||||
interface Tasks { |
|
||||||
readonly [taskName: string]: Task; |
|
||||||
} |
|
||||||
|
|
||||||
export { |
|
||||||
Message, |
|
||||||
MessagesRoot, |
|
||||||
Report, |
|
||||||
ReportResult, |
|
||||||
Task, |
|
||||||
TaskInfo, |
|
||||||
TaskProcessor, |
|
||||||
TaskProcessorCore, |
|
||||||
TaskProcessorCallback, |
|
||||||
Tasks, |
|
||||||
} |
|
@ -0,0 +1,15 @@ |
|||||||
|
import * as ReportTypes from "./report-types"; |
||||||
|
import * as TaskProcessorTypes from "./task-processor-types"; |
||||||
|
|
||||||
|
export type Message = ReportTypes.IMessage; |
||||||
|
export type Messages = ReportTypes.Messages; |
||||||
|
export type MessagesRoot = ReportTypes.MessagesRoot; |
||||||
|
export type Report = ReportTypes.IReport; |
||||||
|
export type ReportResult = ReportTypes.IReportResult; |
||||||
|
|
||||||
|
export type Task = TaskProcessorTypes.Task; |
||||||
|
export type TaskInfo = TaskProcessorTypes.ITaskInfo; |
||||||
|
export type TaskProcessor = TaskProcessorTypes.ITaskProcessor; |
||||||
|
export type TaskProcessorCallback = TaskProcessorTypes.TaskProcessorCallback; |
||||||
|
export type TaskProcessorCore = TaskProcessorTypes.ITaskProcessorCore; |
||||||
|
export type Tasks = TaskProcessorTypes.ITasks; |
@ -0,0 +1,41 @@ |
|||||||
|
export interface IMessage { |
||||||
|
readonly message: string; |
||||||
|
readonly prefix: string; |
||||||
|
} |
||||||
|
|
||||||
|
type IPartialMessageLeafContent = string[]; |
||||||
|
type IPartialMessageRootContent = IMessage[]; |
||||||
|
|
||||||
|
interface IPartialMessagesLeaf { |
||||||
|
readonly $messages?: string[]; |
||||||
|
} |
||||||
|
|
||||||
|
// workaround for compatibility with PartialMessagesLeaf and PartialMessagesRoot
|
||||||
|
interface IPartialMessagesRecursive { |
||||||
|
readonly [propName: string]: Messages | IPartialMessageLeafContent; |
||||||
|
} |
||||||
|
|
||||||
|
interface IPartialMessagesRecursiveRoot { |
||||||
|
readonly [propName: string]: Messages | IPartialMessageRootContent | IPartialMessageLeafContent; |
||||||
|
} |
||||||
|
|
||||||
|
interface IPartialMessagesRoot { |
||||||
|
readonly $allMessages: IPartialMessageRootContent; |
||||||
|
} |
||||||
|
|
||||||
|
export type Messages = IPartialMessagesRecursive & IPartialMessagesLeaf; |
||||||
|
|
||||||
|
export type MessagesRoot = IPartialMessagesRecursiveRoot & IPartialMessagesRoot & IPartialMessagesLeaf; |
||||||
|
|
||||||
|
export interface IReportResult { |
||||||
|
readonly errors: MessagesRoot; |
||||||
|
readonly warns: MessagesRoot; |
||||||
|
readonly infos: MessagesRoot; |
||||||
|
readonly messages: MessagesRoot; |
||||||
|
} |
||||||
|
|
||||||
|
export interface IReport { |
||||||
|
readonly date: number; |
||||||
|
readonly err?: string; |
||||||
|
readonly result?: IReportResult; |
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
export type TaskProcessorCallback = (err: string) => void; |
||||||
|
|
||||||
|
export interface ITaskProcessorCore { |
||||||
|
readonly onError: (message: string | Error, prefix?: string) => void; |
||||||
|
readonly onWarn: (message: string, prefix?: string) => void; |
||||||
|
readonly onInfo: (message: string, prefix?: string) => void; |
||||||
|
readonly context?: any; |
||||||
|
} |
||||||
|
|
||||||
|
export interface ITaskProcessor extends ITaskProcessorCore { |
||||||
|
readonly process: () => void; |
||||||
|
readonly processTask: (task: ITaskInfo, innerCallback: TaskProcessorCallback) => void; |
||||||
|
readonly done: () => void; |
||||||
|
} |
||||||
|
|
||||||
|
export interface ITaskInfo { |
||||||
|
name?: string; |
||||||
|
type: string; |
||||||
|
params: any; |
||||||
|
} |
||||||
|
|
||||||
|
export type Task = (params: any, processor: ITaskProcessor) => () => void; |
||||||
|
|
||||||
|
export interface ITasks { |
||||||
|
readonly [taskName: string]: Task; |
||||||
|
} |
Loading…
Reference in new issue