import { ResourceEvent } from './events'; import { ActionController } from '../core'; import { ExecuteParams } from '../core/execute-context'; import { ActionMetadata } from '../metadata'; declare module './interfaces' { interface InternalResourceEventType { $CancellationToken: CancellationTokenResourceEvent; $ExecuteInit: ExecuteInitResourceEvent; $StateChange: StateChangeResourceEvent; } } export declare function isInternalError(event: ResourceEvent): boolean; /** * Sends the cancellation token (function) so the listener (resource control) can cancel. * * @internal */ export declare class CancellationTokenResourceEvent extends ResourceEvent { readonly resource: any; readonly cancel: () => void; constructor(resource: any, cancel: () => void); } /** * * @internal */ export interface ExecuteInitResourceEventArgs { ac: ActionController; action: ActionMetadata; params: ExecuteParams; } /** * @internal */ export declare class ExecuteInitResourceEvent extends ResourceEvent { readonly resource: any; readonly data: ExecuteInitResourceEventArgs; readonly mode: 'promise' | 'instance'; /** * The promise that is used by the execution. * * A promise is always used, it is returned to the user when the execution run's in promise mode, otherwise it is * instance mode and the instance is returned, yet the promise always exist. * * When working with DAO the returned value is the promise, which makes it impossible to track the resource control * because the user does not get it back, the promise can be used to track the instance. */ promise: Promise; /** * True instructs the resource control to stay alive when the promise resolves. * False will cause the resource control to destroy itself once the promise resolve. */ keepAlive: boolean; constructor(resource: any, data: ExecuteInitResourceEventArgs, mode: 'promise' | 'instance', promise: Promise, keepAlive: boolean); } /** * @internal */ export declare class StateChangeResourceEvent extends ResourceEvent { readonly resource: any; readonly key: string; readonly oldVal: any; readonly newVal: any; constructor(resource: any, key: string, oldVal: any, newVal: any); }