import { ProgressBarOptions as BaseProgressBarOptions } from '../progressBar/types'; import { SpinnerOptions as BaseSpinnerOptions } from '../spinner/types'; import { GlobalOptions as ColumifyOptions } from 'columnify'; import { OutletToTransportHandlerFn } from '../transport/types'; import { VerbaString } from '../verbaString/types'; export declare enum Outlet { LOG = "log", INFO = "info", STEP = "step", SUCCESS = "success", WARN = "warn", ERROR = "error", TABLE = "table", JSON = "json", DIVIDER = "divider", SPACER = "spacer", SPINNER = "spinner", PROGRESS_BAR = "progressBar" } export type SimpleOutlet = Outlet.INFO | Outlet.STEP | Outlet.SUCCESS | Outlet.WARN | Outlet.ERROR; export type NonReturningOutlet = keyof { [TOutlet in Outlet as ReturnType extends void ? TOutlet : never]: 1; }; export type ReturningOutlet = keyof { [TOutlet in Outlet as ReturnType extends void ? never : TOutlet]: 1; }; export type SimpleOutletPrefixesOptions = Partial>; export type SimpleOutletPrefixes = Record; export type BaseOutletOptions = { /** * Optional data to associate with the log message. */ data?: TData; /** * Optional code to describe the area of the app that the log message is about. * * @example * 'INIT' * 'CONNECT_DB' * 'USER_AUTHENTICATE' */ code?: TCode; }; export type BaseNormalizedOutletOptions = { /** * Data associated with the log message. */ data: TData | undefined; /** * Log code of the log message. */ code: TCode | undefined; }; export type SimpleOutletOptions = VerbaString | (BaseOutletOptions & { /** * The log message. * * @example * '5 users found' * f => `${f.yellow('5')} users found` */ msg: VerbaString; }); export type NormalizedSimpleOutletOptions = BaseNormalizedOutletOptions & { /** * The log message. */ msg: VerbaString; }; export type JsonOptions = BaseOutletOptions & { /** * If `true`, the output JSON will be indented as per `JSON.stringify({ ... }, null, 2)`. * * @default false */ pretty?: boolean; }; export type NormalizedJsonOptions = BaseNormalizedOutletOptions & { /** * If `true`, the output JSON will be indented as per `JSON.stringify({ ... }, null, 2)`. */ pretty: boolean; }; export type TableOptions = ColumifyOptions & BaseOutletOptions; export type NormalizedTableOptions = ColumifyOptions & BaseNormalizedOutletOptions; /** * Options for `spacer` log calls. This can take either an integer value * to denote the number of lines, or an object to provide more information. * * @default 1 */ export type SpacerOptions = number | (BaseOutletOptions & { /** * The number of lines. * * @default 1 */ numLines?: number; }); export type NormalizedSpacerOptions = BaseNormalizedOutletOptions & { /** * The number of lines. */ numLines: number; }; export type DividerOptions = BaseOutletOptions; export type NormalizedDividerOptions = BaseNormalizedOutletOptions; export type SpinnerOptions = (Pick & { /** * If `true`, this will cause the initial text defined for the spinner * to be persisted once upon it being interrupted by another different * log call whilst it is active (spinning). * * @default true */ persistInitialTextAsStepLogUponOtherLog?: boolean; } & BaseOutletOptions) | VerbaString; export type NormalizedSpinnerOptions = Required> & { /** * If `true`, this will cause the initial text defined for the spinner * to be persisted once upon it being interrupted by another different * log call whilst it is active (spinning). * * @default true */ persistInitialTextAsStepLogUponOtherLog?: boolean; } & BaseNormalizedOutletOptions; export type ProgressBarOptions = Pick & BaseOutletOptions; export type NormalizedProgressBarOptions = Required> & BaseNormalizedOutletOptions; export type OutletToNormalizedArgsObj = { [Outlet.LOG]: { options: NormalizedSimpleOutletOptions; }; [Outlet.INFO]: { options: NormalizedSimpleOutletOptions; }; [Outlet.STEP]: { options: NormalizedSimpleOutletOptions; }; [Outlet.SUCCESS]: { options: NormalizedSimpleOutletOptions; }; [Outlet.WARN]: { options: NormalizedSimpleOutletOptions; }; [Outlet.ERROR]: { options: NormalizedSimpleOutletOptions; }; [Outlet.TABLE]: { data: any; options: NormalizedTableOptions; }; [Outlet.JSON]: { value: any; options: NormalizedJsonOptions; }; [Outlet.DIVIDER]: { options: NormalizedDividerOptions; }; [Outlet.SPACER]: { options: NormalizedSpacerOptions; }; [Outlet.PROGRESS_BAR]: { options: NormalizedProgressBarOptions; }; [Outlet.SPINNER]: { options: NormalizedSpinnerOptions; }; };