lakutata
Version:
An IoC-based universal application framework.
1,032 lines (1,022 loc) • 32.2 kB
TypeScript
import { DataValidator, ModuleConfigLoader, ApplicationConfigLoader } from './TypeDef.internal.116.js';
import { ValidationOptions, ObjectSchema } from './TypeDef.internal.121.js';
import { Schema } from './TypeDef.internal.129.js';
import { JSONSchema } from './TypeDef.internal.100.js';
import './TypeDef.internal.30.js';
import { event, ListenerFn, EventAndListener } from './TypeDef.internal.19.js';
import { BaseObject, EventEmitter } from './TypeDef.internal.120.js';
import { BuildResolverOptions, NameAndRegistrationPair } from './TypeDef.internal.128.js';
import { ModuleOptions, LoadObjectOptions, ApplicationOptions } from './TypeDef.internal.137.js';
import { IBaseObjectConstructor } from './TypeDef.internal.118.js';
import { Logger } from './TypeDef.internal.95.js';
/**
* DTO base class
*/
declare class DTO extends DataValidator {
constructor(props?: Record<string, any>);
[prop: string | symbol]: any;
/**
* Prepare schema and validate options
* @param schemaOrOptions
* @param options
* @protected
*/
protected static prepareValidation(schemaOrOptions?: Schema | ValidationOptions, options?: ValidationOptions): {
schema: Schema;
options: ValidationOptions;
};
/**
* Convert current DTO to JSONSchema
*/
static toJsonSchema(version?: 'draft-07' | 'draft-2019-09' | 'draft-04'): JSONSchema;
/**
* Convert current DTO to OpenAPI JSONSchema
*/
static toOpenAPIJsonSchema(version?: '3.0' | '3.1'): JSONSchema;
/**
* Set description
* @param desc
*/
static description(desc: string): typeof DTO;
/**
* DTO schema
* @constructor
*/
static Schema(): ObjectSchema;
/**
* Marks DTO schema as required which will not allow undefined as value.
*/
static required(): ObjectSchema;
/**
* Marks a DTO schema as optional which will allow undefined as values.
*/
static optional(): ObjectSchema;
/**
* Overrides the validate() options for the current key and any sub-key.
* @param options
*/
static options(options: ValidationOptions): ObjectSchema;
/**
* Is data matched with given schema
* @param data
*/
static isValid<T = any>(data: T): boolean;
/**
* Is data matched with given schema
* @param data
* @param options
*/
static isValid<T = any>(data: T, options: ValidationOptions): boolean;
/**
* Is data matched with given schema
* @param data
* @param schema
*/
static isValid<T = any>(data: T, schema: Schema): boolean;
/**
* Is data matched with given schema
* @param data
* @param schema
* @param options
*/
static isValid<T = any>(data: T, schema: Schema, options: ValidationOptions): boolean;
/**
*
* @param data
*/
static isValidAsync<T = any>(data: T): Promise<boolean>;
/**
* Is data matched with given schema
* @param data
* @param options
*/
static isValidAsync<T = any>(data: T, options: ValidationOptions): Promise<boolean>;
/**
* Is data matched with given schema
* @param data
* @param schema
*/
static isValidAsync<T = any>(data: T, schema: Schema): Promise<boolean>;
/**
* Is data matched with given schema
* @param data
* @param schema
* @param options
*/
static isValidAsync<T = any>(data: T, schema: Schema, options: ValidationOptions): Promise<boolean>;
/**
* Validates a value using the schema and options.
* @param data
*/
static validate<T = any>(data: T): T;
/**
* Validates a value using the schema and options.
* @param data
* @param options
*/
static validate<T = any>(data: T, options: ValidationOptions): T;
/**
* Validates a value using the schema and options.
* @param data
* @param schema
*/
static validate<T = any>(data: T, schema: Schema): T;
/**
* Validates a value using the schema and options.
* @param data
* @param schema
* @param options
*/
static validate<T = any>(data: T, schema: Schema, options: ValidationOptions): T;
/**
* Validates a value using the schema and options.
* @param data
*/
static validateAsync<T = any>(data: T): Promise<T>;
/**
* Validates a value using the schema and options.
* @param data
* @param options
*/
static validateAsync<T = any>(data: T, options: ValidationOptions): Promise<T>;
/**
* Validates a value using the schema and options.
* @param data
* @param schema
*/
static validateAsync<T = any>(data: T, schema: Schema): Promise<T>;
/**
* Validates a value using the schema and options.
* @param data
* @param schema
* @param options
*/
static validateAsync<T = any>(data: T, schema: Schema, options: ValidationOptions): Promise<T>;
}
declare namespace UnitOfTime {
type Base = ('year' | 'years' | 'y' | 'month' | 'months' | 'M' | 'week' | 'weeks' | 'w' | 'day' | 'days' | 'd' | 'hour' | 'hours' | 'h' | 'minute' | 'minutes' | 'm' | 'second' | 'seconds' | 's' | 'millisecond' | 'milliseconds' | 'ms');
type _quarter = 'quarter' | 'quarters' | 'Q';
type _isoWeek = 'isoWeek' | 'isoWeeks' | 'W';
type _date = 'date' | 'dates' | 'D';
type DurationConstructor = Base | _quarter;
type DurationAs = Base;
type StartOf = Base | _quarter | _isoWeek | _date | null;
type Diff = Base | _quarter;
type MomentConstructor = Base | _date;
type All = Base | _quarter | _isoWeek | _date | 'weekYear' | 'weekYears' | 'gg' | 'isoWeekYear' | 'isoWeekYears' | 'GG' | 'dayOfYear' | 'dayOfYears' | 'DDD' | 'weekday' | 'weekdays' | 'e' | 'isoWeekday' | 'isoWeekdays' | 'E';
}
type TimeInput = Time | Date | string | number | (number | string)[] | null;
type TimeObject = {
years: number;
months: number;
date: number;
hours: number;
minutes: number;
seconds: number;
milliseconds: number;
};
/**
* Time class
*/
declare class Time extends Date {
#private;
/**
* Constructor
* @param inp
*/
constructor(inp?: TimeInput);
/**
* Get all timezone names
*/
static timezones(): string[];
/**
* Returns the maximum value for a given instance (farthest into the future)
* @param times
*/
static max(...times: Time[]): Time;
/**
* Returns the minimum value (most distant past) of the given instance
* @param times
*/
static min(...times: Time[]): Time;
/**
* Update the current instance internal timestamp and return new Time instance
* @param time
* @protected
*/
protected updateTimestampWithNewTime(time: number): Time;
/**
* Internal get or set time zone
* @protected
*/
protected tz(): string | undefined;
protected tz(tz: string): this;
/**
* Get time zone offset
*/
getTimezoneOffset(): number;
/**
* Get or set time zone
*/
timezone(): string | undefined;
timezone(tz: string): Time;
/**
* Get or set the number of milliseconds
*/
milliseconds(): number;
milliseconds(value: number): Time;
/**
* Get or set seconds
*/
seconds(): number;
seconds(value: number): Time;
/**
* Get or set minutes
*/
minutes(): number;
minutes(value: number): Time;
/**
* Get or set the hour
*/
hours(): number;
hours(value: number): Time;
/**
* Get or set the day of the month
* Accepts numbers from 1 to 31. If out of range it will bubble up to months
*/
date(): number;
date(value: number): Time;
/**
* Set to get or set the day of the week
*/
weekday(): number;
weekday(value: number): Time;
/**
* Get or set the ISO day of the week, 1 is Monday, 7 is Sunday
*/
isoWeekday(): number;
isoWeekday(value: number): Time;
/**
* Get or set the day of the year
* Accepts numbers from 1 to 366. If out of range it will bubble up to the year
*/
dayOfYear(): number;
dayOfYear(value: number): Time;
/**
* Gets or sets the week of the year
*/
weeks(): number;
weeks(value: number): Time;
/**
* Gets or sets the ISO week of the year
*/
isoWeeks(): number;
isoWeeks(value: number): Time;
/**
* Get or set the month
* Accepts numbers from 0 to 11. If out of range it will bubble up to the year
*/
month(): number;
month(value: number): Time;
/**
* Gets or sets the quarter (1 to 4)
*/
quarters(): number;
quarters(value: number): Time;
/**
* Get or set the year
* Accepts numbers from -270,000 to 270,000
*/
year(): number;
year(value: number): Time;
/**
* Gets or sets the week of the year in ISO time
*/
isoWeekYear(): number;
isoWeekYear(value: number): Time;
/**
* Gets the week number based on the locale of the current instance's year
*/
weeksInYear(): number;
/**
* Get the week number of the year where the current instance is located based on the week number
*/
isoWeeksInYear(): number;
/**
* Universal getter (Depends on input unit)
* @param unit
*/
get(unit: UnitOfTime.All): number;
/**
* Universal setter (Depends on input unit)
* @param unit
* @param value
*/
set(unit: UnitOfTime.All, value: number): Time;
/**
* Increase time
* @param amount
* @param unit
*/
add(amount: number, unit: UnitOfTime.DurationConstructor): Time;
/**
* Minus time
* @param amount
* @param unit
*/
subtract(amount: number, unit: UnitOfTime.DurationConstructor): Time;
/**
* Set to the start of a time unit
* @param unit
*/
startOf(unit: UnitOfTime.StartOf): Time;
/**
* Set to the end of the time unit
* @param unit
*/
endOf(unit: UnitOfTime.StartOf): Time;
/**
* Format output time string
*/
format(): string;
format(format: string): string;
/**
* Get time difference
* @param inp
* @param unit
* @param precise
*/
diff(inp: TimeInput, unit?: UnitOfTime.Diff, precise?: boolean): number;
/**
* Outputs a Unix timestamp (number of seconds since the Unix epoch)
*/
unix(): number;
/**
* Get the number of days in the current month
*/
daysInMonth(): number;
/**
* This will return an array that reflects the parameters in new Date()
*/
toArray(): [number, number, number, number, number, number, number];
/**
* Returns an object containing the year, month, day of the month, hour, minute, second, and millisecond
*/
toObject(): TimeObject;
/**
* To string
*/
toString(): string;
/**
* To time string
*/
toTimeString(): string;
/**
* To UTC string
*/
toUTCString(): string;
/**
* To date string
*/
toDateString(): string;
/**
* Return ISO format time string
*/
toISOString(): string;
/**
* Convert current time object to Date object
*/
toDate(): Date;
/**
* Is current time before input time
* @param inp
* @param granularity
*/
isBefore(inp?: TimeInput, granularity?: UnitOfTime.StartOf): boolean;
/**
* Is current time same with input time
* @param inp
* @param granularity
*/
isSame(inp?: TimeInput, granularity?: UnitOfTime.StartOf): boolean;
/**
* Is current time after input time
* @param inp
* @param granularity
*/
isAfter(inp?: TimeInput, granularity?: UnitOfTime.StartOf): boolean;
/**
* Is current time same or before input time
* @param inp
* @param granularity
*/
isSameOrBefore(inp?: TimeInput, granularity?: UnitOfTime.StartOf): boolean;
/**
* Is current time same or after input time
* @param inp
* @param granularity
*/
isSameOrAfter(inp?: TimeInput, granularity?: UnitOfTime.StartOf): boolean;
/**
* Is current time between two input times
* @param a
* @param b
* @param granularity
* @param inclusivity
*/
isBetween(a: TimeInput, b: TimeInput, granularity?: UnitOfTime.StartOf, inclusivity?: '()' | '[)' | '(]' | '[]'): boolean;
/**
* Check current time instance is leap year
*/
isLeapYear(): boolean;
/**
* Clone a time instance
*/
clone(): Time;
}
/**
* Provider base class
*/
declare class Provider extends BaseObject {
/**
* Get environment variable
* @param name
* @protected
*/
protected getEnv(name: string): string | undefined;
/**
* Get environment variable
* @param name
* @param defaultValue
* @protected
*/
protected getEnv(name: string, defaultValue: string): string;
}
/**
* Component base class
*/
declare class Component extends Provider {
#private;
/**
* Get container
* @protected
*/
protected get container(): Container;
/**
* Create sub scope container
* @protected
*/
protected createScope(): Container;
/**
* emitter.emit(event | eventNS, [arg1], [arg2], [...])
* Execute each of the listeners that may be listening for the specified event name in order with the list of arguments.
* @param event
* @param values
*/
emit(event: string | symbol | event[], ...values: any[]): boolean;
/**
* emitter.emitRequest(event | eventNS, [arg1], [arg2], [...])
* Return the results of the listeners via Promise.all.
* @param event
* @param values
*/
emitRequest(event: string | symbol | event[], ...values: any[]): Promise<any[]>;
/**
* Adds a listener to the end of the listeners array for the specified event.
* @param event
* @param listener
*/
addListener(event: string | symbol | event[], listener: ListenerFn): this;
/**
* Adds a listener to the end of the listeners array for the specified event.
* @param event
* @param listener
*/
on(event: string | symbol | event[], listener: ListenerFn): this;
/**
* Adds a listener to the beginning of the listeners array for the specified event.
* @param event
* @param listener
*/
prependListener(event: string | symbol | event[], listener: ListenerFn): this;
/**
* Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed.
* @param event
* @param listener
*/
once(event: string | symbol | event[], listener: ListenerFn): this;
/**
* Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. The listener is added to the beginning of the listeners array
* @param event
* @param listener
*/
prependOnceListener(event: string | symbol | event[], listener: ListenerFn): this;
/**
* Adds a listener that will execute n times for the event before being removed. The listener is invoked only the first n times the event is fired, after which it is removed.
* @param event
* @param timesToListen
* @param listener
*/
many(event: string | symbol | event[], timesToListen: number, listener: ListenerFn): this;
/**
* Adds a listener that will execute n times for the event before being removed. The listener is invoked only the first n times the event is fired, after which it is removed. The listener is added to the beginning of the listeners array.
* @param event
* @param timesToListen
* @param listener
*/
prependMany(event: string | symbol | event[], timesToListen: number, listener: ListenerFn): this;
/**
* Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the callback.
* @param listener
*/
onAny(listener: EventAndListener): this;
/**
* Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the callback. The listener is added to the beginning of the listeners array
* @param listener
*/
prependAny(listener: EventAndListener): this;
/**
* Removes the listener that will be fired when any event is emitted.
* @param listener
*/
offAny(listener: ListenerFn): this;
/**
* Remove a specific listener from the listener array for the specified event.
* @param event
* @param listener
*/
removeListener(event: string | symbol | event[], listener: ListenerFn): this;
/**
* emitter.off(event | eventNS, listener)
* Remove a listener from the listener array for the specified event. Caution: Calling this method changes the array indices in the listener array behind the listener.
* @param event
* @param listener
*/
off(event: string | symbol | event[], listener: ListenerFn): this;
/**
* emitter.removeAllListeners([event | eventNS])
* Removes all listeners, or those of the specified event.
* @param event
*/
removeAllListeners(event?: string | symbol | event[] | undefined): this;
/**
* emitter.setMaxListeners(n)
* By default EventEmitters will print a warning if more than 10 listeners are added to it. This is a useful default which helps finding memory leaks. Obviously not all Emitters should be limited to 10. This function allows that to be increased. Set to zero for unlimited.
* @param n
*/
setMaxListeners(n: number): void;
/**
* emitter.getMaxListeners()
* Returns the current max listener value for the EventEmitter which is either set by emitter.setMaxListeners(n)
*/
getMaxListeners(): number;
/**
* emitter.eventNames(nsAsArray)
* Returns an array listing the events for which the emitter has registered listeners.
* Listeners order not guaranteed
* @param nsAsArray
*/
eventNames(nsAsArray?: boolean | undefined): (string | symbol | event[])[];
/**
* Returns listener count that are listening for specific event or events
* @param event
*/
listenerCount(event?: string | symbol | event[] | undefined): number;
/**
* emitter.listeners(event | eventNS)
* Returns an array of listeners for the specified event. This array can be manipulated, e.g. to remove listeners.
* @param event
*/
listeners(event?: string | symbol | event[] | undefined): ListenerFn[];
/**
* Returns an array of listeners that are listening for any event that is specified. This array can be manipulated, e.g. to remove listeners.
*/
listenersAny(): ListenerFn[];
/**
* hasListeners(event | eventNS?:String)
* Checks whether emitter has any listeners.
* @param event
*/
hasListeners(event?: String | undefined): boolean;
/**
* Reload self
*/
reload(): Promise<void>;
}
/**
* Module base class
*/
declare class Module extends Component {
#private;
/**
* Config loader constructor
* @protected
*/
protected readonly ConfigLoader: typeof ModuleConfigLoader;
/**
* Module embed options
* @protected
*/
protected options: ModuleOptions;
/**
* Get container
* @protected
*/
protected get container(): Container;
/**
* Constructor
* @param cradleProxy
*/
constructor(cradleProxy: Record<string | symbol, any>);
/**
* Get current runtime env is production or development
*/
mode(): 'development' | 'production';
/**
* Reload self
*/
reload(): Promise<void>;
/**
* Get registered object via constructor
* @param constructor
* @param configurableRecords
*/
getObject<T extends BaseObject>(constructor: IBaseObjectConstructor<T>, configurableRecords?: Record<string, any>): Promise<T>;
/**
* Get registered object via string
* @param name
* @param configurableRecords
*/
getObject<T extends BaseObject>(name: string, configurableRecords?: Record<string, any>): Promise<T>;
/**
* Get registered object via symbol
* @param name
* @param configurableRecords
*/
getObject<T extends BaseObject>(name: symbol, configurableRecords?: Record<string, any>): Promise<T>;
/**
* Get registered object via string or symbol
* @param name
* @param configurableRecords
* @protected
*/
getObject<T extends BaseObject>(name: string | symbol, configurableRecords?: Record<string, any>): Promise<T>;
/**
* Get registered object via string or symbol or constructor
* @param nameOrConstructor
* @param configurableRecords
* @protected
*/
getObject<T extends BaseObject>(nameOrConstructor: string | symbol | IBaseObjectConstructor<T>, configurableRecords?: Record<string, any>): Promise<T>;
}
declare class Container {
#private;
readonly parent?: Container;
constructor(parent?: Container, owner?: BaseObject);
/**
* Destroy objects inside container
* @param instance
* @protected
*/
protected disposer<T extends BaseObject>(instance: T): Promise<void>;
/**
* Get build resolver options by class constructor
* @param target
* @protected
*/
protected buildResolverOptions<T extends BaseObject>(target: IBaseObjectConstructor<T>): BuildResolverOptions<T>;
/**
* Process resolved
* @param resolved
* @param registrationName
* @param configurableRecords
* @protected
*/
protected processResolved<T extends BaseObject>(resolved: T | Promise<T>, registrationName: string | symbol, configurableRecords?: Record<string, any>): Promise<T>;
/**
* Build name and registration pair from container load options
* @param options
* @protected
*/
protected buildNameAndRegistrationPairFromOptions<T extends BaseObject>(options: LoadObjectOptions): NameAndRegistrationPair<T>;
/**
* Build name and registration pair from glob
* @param glob
* @protected
*/
protected buildNameAndRegistrationPairFromGlob<T extends typeof BaseObject>(glob: string): Promise<NameAndRegistrationPair<T>>;
/**
* Get current container owner
*/
owner<Owner extends BaseObject = BaseObject>(): Owner | undefined;
protected injectionNames: Set<string | symbol>;
/**
* Load objects
* @param options
*/
load<T extends typeof BaseObject>(options: (LoadObjectOptions | typeof BaseObject | string)[]): Promise<void>;
/**
* Get registered object via constructor
* @param constructor
* @param configurableRecords
*/
get<T extends BaseObject>(constructor: IBaseObjectConstructor<T>, configurableRecords?: Record<string, any>): Promise<T>;
/**
* Get registered object via string
* @param name
* @param configurableRecords
*/
get<T extends BaseObject>(name: string, configurableRecords?: Record<string, any>): Promise<T>;
/**
* Get registered object via symbol
* @param name
* @param configurableRecords
*/
get<T extends BaseObject>(name: symbol, configurableRecords?: Record<string, any>): Promise<T>;
/**
* Get registered object via string or symbol
* @param name
* @param configurableRecords
*/
get<T extends BaseObject>(name: string | symbol, configurableRecords?: Record<string, any>): Promise<T>;
/**
* Get registered object via string or symbol or constructor
* @param nameOrConstructor
* @param configurableRecords
*/
get<T extends BaseObject>(nameOrConstructor: string | symbol | IBaseObjectConstructor<T>, configurableRecords?: Record<string, any>): Promise<T>;
/**
* Is object registered in container (By symbol)
* @param symbol
*/
has(symbol: symbol): boolean;
/**
* Is object registered in container (By name)
* @param name
*/
has(name: string): boolean;
/**
* Is object registered in container (By name or symbol)
* @param nameOrSymbol
*/
has(nameOrSymbol: string | symbol): boolean;
/**
* Is object registered in container (By constructor)
* @param constructor
*/
has<ClassConstructor extends typeof BaseObject>(constructor: ClassConstructor): boolean;
/**
* Builds an instance of a base object class by injecting dependencies, and registering it in the container
* @param target
* @param configurableRecords
*/
set<T extends BaseObject>(target: IBaseObjectConstructor<T>, configurableRecords?: Record<string, any>): Promise<T>;
/**
* Builds a named instance of a base object class by injecting dependencies, and registering it in the container
* @param name
* @param target
* @param configurableRecords
*/
setNamed<T extends BaseObject>(name: string | symbol, target: IBaseObjectConstructor<T>, configurableRecords?: Record<string, any>): Promise<T>;
/**
* Register base object class in the container
* @param target
* @param configurableRecords
*/
register<T extends BaseObject>(target: IBaseObjectConstructor<T>, configurableRecords?: Record<string, any>): Promise<void>;
/**
* Register named base object class in the container
* @param name
* @param target
* @param configurableRecords
*/
registerNamed<T extends BaseObject>(name: string | symbol, target: IBaseObjectConstructor<T>, configurableRecords?: Record<string, any>): Promise<void>;
/**
* Builds an instance of a base object class by injecting dependencies, but without registering it in the container
* @param target
* @param configurableRecords
*/
build<T extends BaseObject>(target: IBaseObjectConstructor<T>, configurableRecords?: Record<string, any>): Promise<T>;
/**
* Create sub container scope
*/
createScope(): Container;
/**
* Register current container to its parent subContainerSet
*/
registerContainerToItsParent(): void;
/**
* Clear current container but not destroy it
*/
clear(): Promise<void>;
/**
* Destroy current container
*/
destroy(): Promise<void>;
}
declare class Alias {
protected aliasNameRegExp: RegExp;
protected readonly aliasMap: Map<string, string>;
/**
* Constructor
*/
constructor();
/**
* Init alias manager, must init it before application instance init
*/
static init(): void;
/**
* Get alias manager instance
*/
static getAliasInstance(): Alias;
/**
* Register alias
* @param aliasName
* @param aliasPath
*/
set(aliasName: string, aliasPath: string): void;
/**
* Register alias
* @param aliasName
* @param aliasPath
* @param override
*/
set(aliasName: string, aliasPath: string, override: boolean): void;
/**
* Resolve alias
* @param aliasName
*/
get(aliasName: string): string;
/**
* Whether an alias exists
* @param aliasName
*/
has(aliasName: string): boolean;
/**
* Resolve string and replace alias name to alias value inside the string
* @param containAliasPath
*/
resolve(containAliasPath: string): string;
/**
* List aliases
*/
list(): Record<string, string>;
}
/**
* On application launched event handler
*/
type LaunchedHandler = (app: Application, logger: Logger) => void | Promise<void>;
/**
* On application done event handler
*/
type DoneHandler = (app: Application, logger: Logger) => void | Promise<void>;
/**
* On process uncaught exception event handler
*/
type UncaughtExceptionHandler = (error: Error, logger: Logger) => void | Promise<void>;
/**
* On application fatal exception event handler
*/
type FatalExceptionHandler = (error: Error, logger: Logger) => number | undefined | void | Promise<number | undefined | void>;
/**
* Application module
*/
declare class Application extends Module {
/**
* Event emitter
* @protected
*/
protected static readonly eventEmitter: EventEmitter;
/**
* Application instance, if the application boot failed, the property will be undefined
* @protected
*/
protected static readonly appInstance: Application | undefined;
/**
* Environment variables map
* @protected
*/
protected static readonly environmentVariableMap: Map<string, string>;
/**
* Alias declarations
* @protected
*/
protected static readonly aliasDeclarations: {
alias: Record<string, string>;
createIfNotExist: boolean;
}[];
/**
* Options or options getter function for application booting
* @protected
*/
protected static readonly launchOptions: ApplicationOptions | (() => ApplicationOptions | Promise<ApplicationOptions>);
/**
* The timer for application booting.
* This property will be overwriting multiple times during static invoke-chain
* @protected
*/
protected static launchTimeout: NodeJS.Timeout;
/**
* Get logger
* @protected
*/
protected static getLogger(): Promise<Logger>;
/**
* Set environment variables
* @param env
*/
static env(env: Record<string, string>): typeof Application;
/**
* Register path aliases
* @param alias
* @param createIfNotExist
*/
static alias(alias: Record<string, string>, createIfNotExist?: boolean): typeof Application;
/**
* Application has been launched
* @param handler
*/
static onLaunched(handler: LaunchedHandler): typeof Application;
/**
* Application execution completed successfully
* @param handler
*/
static onDone(handler: DoneHandler): typeof Application;
/**
* Uncaught exception occurred during application execution
* @param handler
*/
static onUncaughtException(handler: UncaughtExceptionHandler): typeof Application;
/**
* Fatal exception occurred during application execution
* @param handler
*/
static onFatalException(handler: FatalExceptionHandler): typeof Application;
/**
* Run application with options object
* @param options
*/
static run(options: ApplicationOptions): typeof Application;
/**
* Run application with options getter
* @param optionsGetter
*/
static run(optionsGetter: () => ApplicationOptions | Promise<ApplicationOptions>): typeof Application;
/**
* Launch application after invoke chain processed
* @protected
*/
protected static launch(): typeof Application;
/**
* Process fatal exception
* @param error
* @protected
*/
protected static processFatalException(error: Error): void;
/**
* Internal launch application process
* @protected
*/
protected static launchApplication(): Promise<Application>;
/**
* Override config loader
* @protected
*/
protected ConfigLoader: typeof ApplicationConfigLoader;
/**
* Application embed options
* @protected
*/
protected options: Partial<ApplicationOptions>;
/**
* Alias manager
*/
get alias(): Alias;
/**
* Get application's ID
*/
get appId(): string;
/**
* Get application's name
*/
get appName(): string;
/**
* Get application's timezone
*/
get timezone(): string;
/**
* Get application's uptime
*/
get uptime(): number;
/**
* Exit application
* @param exitCode
*/
exit(exitCode: number): void;
/**
* Exit application
* @param force
*/
exit(force: true): void;
}
export { Application, Component, Container, DTO, Module, Provider, Time };