UNPKG

downtimer

Version:
52 lines (51 loc) 1.93 kB
import { DeepPartial } from './types'; export type LogMode = 'off' | 'minimal' | 'full'; /** * Configuration options for downtimer object. */ export type DowntimerOptions = { /** * Use colours in log output. Defaults to `true`, can also be disabled using `NO_COLOR` * environment variable. */ useColor: boolean; /** Configuration for event logging */ logConfig: { /** Log when a new timer is scheduled */ schedule: LogMode; /** Log options when executing a timer */ execute: { /** Log just before a timer callback is executed */ before: LogMode; /** Log when an error occurs in a timer callback */ onError: LogMode; }; /** Log options when clearing a timer */ clear: { /** * Log when an attempt is made to clear a timer with an unknown ID. * * This happens if the timer has already been cleared or has already executed. */ notFound: LogMode; /** Log when a timer is cleared successfully */ success: LogMode; /** Log when all outstanding timers are cleared */ allOutstanding: LogMode; }; /** Log when the server exits with outstanding timers */ exitWithOutstandingTimers: LogMode; }; }; /** Default options for Downtimer */ export declare const defaultOptions: DowntimerOptions; /** * Merge a `DeepPartial<T>` object with a collection of defaults of type `T` * * If `T extends object`, then all properties are optional, and any value that is `undefined` in the * `options` will be replaced with the corresponding value in `defaults`. * * Otherwise, the object is considered to be a complete type, and so is only checked for * undefined-ness. */ export declare function mergeDeepPartial<T>(defaults: T, options?: DeepPartial<T>): T;