import './vendor/TypeDef.2.js';
import { E as Exception } from './vendor/TypeDef.8.js';
export { D as DTO, J as JSONSchema } from './vendor/TypeDef.5.js';
export { T as Time } from './vendor/TypeDef.1.js';
import { a as ModuleOptions$1, b as ModuleConfigLoader, c as LoadObjectOptions, B as BaseObject, d as ConstructorOptions, e as event, f as ListenerFn, E as EventAndListener, M as Module, P as Provider } from './vendor/TypeDef.3.js';
export { C as Component, g as Container, I as IBaseObjectConstructor, h as LoadAnonymousObjectOptions, i as LoadNamedObjectOptions, j as ModuleLoadObjectsOptions, O as OverridableNamedObjectOptions, k as OverridableObjectOptions } from './vendor/TypeDef.3.js';
import { Logger } from './com/logger.js';
export { A as ActionPattern } from './vendor/TypeDef.9.js';
export { C as ClassDecorator, P as PropertyDecorator } from './vendor/TypeDef.12.js';
export { M as MethodDecorator } from './vendor/TypeDef.10.js';
export { B as BaseComponentOptions, a as ComponentOptions, C as ComponentOptionsBuilder } from './vendor/TypeDef.6.js';
export { I as IConstructor } from './vendor/TypeDef.11.js';
export { I as IPatRun } from './vendor/TypeDef.7.js';

declare class ApplicationOptions extends ModuleOptions$1 {
    /**
     * AppId
     */
    readonly id: string;
    /**
     * AppName
     */
    readonly name: string;
    /**
     * Application timezone
     */
    readonly timezone?: string | 'auto';
    /**
     * runtime environment (development or production, default value is development)
     */
    readonly mode?: 'development' | 'production';
}

/**
 * Application configurations loader
 */
declare class ApplicationConfigLoader extends ModuleConfigLoader {
    /**
     * Constructor
     * @param app
     * @param applicationOptions
     * @param presetLoadOptions
     */
    constructor(app: Application, applicationOptions: ApplicationOptions, presetLoadOptions?: (LoadObjectOptions | typeof BaseObject | string)[]);
}

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>;
}

type TEventEmitterOptions = ConstructorOptions;
declare class EventEmitter {
    constructor(options?: TEventEmitterOptions);
    /**
     * 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;
}

/**
 * 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;
}

declare class AliasExistsException extends Exception {
    errno: number | string;
}

declare class AliasNotFoundException extends Exception {
    errno: number | string;
}

declare class InvalidAliasNameException extends Exception {
    errno: number | string;
}

declare class DependencyInjectionException extends Exception {
    errno: number | string;
}

declare class LifetimeLockedException extends Exception {
    errno: string | number;
}

declare class OverridableObjectTargetConfigNotFoundException extends Exception {
    errno: string | number;
}

declare class InvalidMethodAcceptException extends Exception {
    errno: number | string;
}

declare class InvalidMethodReturnException extends Exception {
    errno: number | string;
}

declare class InvalidValueException extends Exception {
    errno: string | number;
}

declare class DestroyRuntimeContainerException extends Exception {
    errno: string | number;
}

declare class InvalidActionPatternDepthException extends Exception {
    errno: string | number;
}

declare class InvalidAssistantFunctionTypeException extends Exception {
    errno: string | number;
}

declare class InvalidObjectTypeException extends Exception {
    errno: string | number;
}

declare class MethodNotFoundException extends Exception {
    errno: string | number;
}

type ParameterDecorator<ClassPrototype> = (target: ClassPrototype, propertyKey: string | symbol, parameterIndex: number) => void;

interface BaseObjectOptions {
    class: typeof BaseObject;
    [prop: string]: any;
}
type ObjectOptions<T> = T & BaseObjectOptions;
type ObjectOptionsBuilder<T> = (options: T) => ObjectOptions<T>;

interface BaseProviderOptions {
    class: typeof Provider;
    [prop: string]: any;
}
type ProviderOptions<T> = T & BaseProviderOptions;
type ProviderOptionsBuilder<T> = (options: T) => ProviderOptions<T>;

interface BaseModuleOptions {
    class: typeof Module;
    [prop: string]: any;
}
type ModuleOptions<T> = T & BaseModuleOptions;
type ModuleOptionsBuilder<T> = (options: T) => ModuleOptions<T>;

export { AliasExistsException, AliasNotFoundException, Application, ApplicationOptions, BaseObject, DependencyInjectionException, DestroyRuntimeContainerException, Exception, InvalidActionPatternDepthException, InvalidAliasNameException, InvalidAssistantFunctionTypeException, InvalidMethodAcceptException, InvalidMethodReturnException, InvalidObjectTypeException, InvalidValueException, LifetimeLockedException, LoadObjectOptions, MethodNotFoundException, Module, ModuleOptions$1 as ModuleOptions, OverridableObjectTargetConfigNotFoundException, Provider };
export type { BaseModuleOptions, BaseObjectOptions, BaseProviderOptions, ModuleOptionsBuilder, ObjectOptions, ObjectOptionsBuilder, ParameterDecorator, ProviderOptions, ProviderOptionsBuilder };
