import PQueue from 'p-queue'; import type { InputOutputAdapter, Logger, ProgressCallback, ProgressOptions, PromptAnswers, PromptQuestions, QueuedAdapter as QueuedAdapterApi } from '../types/index.js'; import { type TerminalAdapterOptions } from './adapter.js'; export type AdapterWithProgress = QueuedAdapterApi; type Task = ((adapter: InputOutputAdapter) => PromiseLike) | ((adapter: InputOutputAdapter) => TaskResultType); type QueuedAdapterOptions = TerminalAdapterOptions & { queue?: PQueue; delta?: number; adapter?: InputOutputAdapter; }; export declare class QueuedAdapter implements QueuedAdapterApi { #private; actualAdapter: InputOutputAdapter; delta: number; log: Logger; separator?: QueuedAdapterApi['separator']; readonly signal: AbortSignal; /** * `TerminalAdapter` is the default implementation of `Adapter`, an abstraction * layer that defines the I/O interactions. * * It provides a CLI interaction * * @constructor * @param {terminalAdapter} [import('./adapter.js').default] */ constructor(options?: QueuedAdapterOptions); newAdapter(delta?: number): QueuedAdapter; close(): void; abort(reason?: any): void; /** * Prompt a user for one or more questions and pass * the answer(s) to the provided callback. * * It shares its interface with `Base.prompt` * * (Defined inside the constructor to keep interfaces separated between * instances) * * @param {Object|Object[]} questions * @param {Object} [answers] Answers to be passed to inquirer * @return {Object} promise answers */ prompt(questions: PromptQuestions, initialAnswers?: Partial): Promise; onIdle(): Promise; /** * Basic queue is recommended for blocking calls. * @param fn * @returns */ queue(function_: Task): Promise; /** * Log has a highest priority and should be not blocking. * @param fn * @returns */ queueLog(function_: Task): Promise; /** * Progress is blocking, but will be skipped if the queue is not empty. * @param callback * @param options * @returns */ progress(function_: ProgressCallback, options?: ProgressOptions): Promise; } export {};