import { AsyncLocalStorage } from "async_hooks"; import { ParentPool } from "./ParentPool"; export declare const asyncLocalStorage: AsyncLocalStorage; interface PromiseInfo { reject: (reason: any) => void; syncExit: boolean; result: "rejected" | "resolved" | undefined; } export declare class ProcessAwarePromiseFactory { private processExitError; setProcessExit(e: Error): void; clearProcessExit(): void; idx: number; parentPool: ParentPool; transferTimers: Set; origSetTimeout: typeof setTimeout; from: "await-then" | "then" | "catch" | "yield-then" | "finally" | undefined; constructor(origSetTimeout: typeof setTimeout); makePromiseClass(): { new (executor: (res: (r: T | PromiseLike) => void, rej: (e: any) => void) => void): { transferTimer: NodeJS.Timeout; /** * The id of this promise as a parent in the parent pool */ selfParentId: string; catch(onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined): Promise; finally(onfinally?: (() => void) | null | undefined): Promise; releaseParentClaims(): void; readonly [Symbol.toStringTag]: string; }; all(values: Iterable>): Promise[]>; all(values: T): Promise<{ -readonly [P in keyof T]: Awaited; }>; race(values: Iterable>): Promise>; race(values: T): Promise>; reject(reason?: any): Promise; resolve(): Promise; resolve(value: T): Promise>; resolve(value: T | PromiseLike): Promise>; allSettled(values: T): Promise<{ -readonly [P in keyof T]: PromiseSettledResult>; }>; allSettled(values: Iterable>): Promise>[]>; readonly [Symbol.species]: PromiseConstructor; }; private getProcessExitError; /** * Used to make sure we don't overlap state */ clear(): void; private handleThenableCatch; } export {};