import type inquirer from 'inquirer';
import type { DistinctQuestion, Answers as InquirerAnswers } from 'inquirer';
import type { Logger } from './logger.js';
/**
* Represents an answer-hash.
*/
export type PromptAnswers = InquirerAnswers;
export type PromptQuestion = DistinctQuestion;
/**
* Provides a set of questions.
*/
export type PromptQuestions = PromptQuestion | Array>; // | Observable>;
/**
* Abstraction layer that defines the I/O interactions.
*
* It provides a CLI interaction
*/
export type InputOutputAdapter = {
/**
* A component for logging messages.
*/
log: Logger;
/**
* An AbortSignal to communicate aborting ongoing operations.
*/
readonly signal?: AbortSignal;
/**
* Prompts the user for one or more questions.
*
* @param questions The questions to prompt.
* @param initialAnswers Initial answers.
*/
prompt(questions: PromptQuestions, initialAnswers?: Partial): Promise;
/**
* @deprecated use `abort` instead
* Close the adapter by aborting the adapter with default reason.
*/
close(): void;
/**
* Aborts ongoing operations and prevents to add new operations.
*/
abort?(reason?: any): void;
/**
* Creates a separator for prompt choices.
*/
separator?: (separator?: string) => InstanceType;
};
type Task =
| ((adapter: InputOutputAdapter) => PromiseLike)
| ((adapter: InputOutputAdapter) => TaskResultType);
export type ProgressCallback = (progress: {
step: (prefix: string, message: string, ...arguments_: any[]) => void;
}) => ReturnType;
export type ProgressOptions = { disabled?: boolean; name?: string };
export type QueuedAdapter = InputOutputAdapter & {
queue(function_: Task): Promise;
progress(function_: ProgressCallback, options?: ProgressOptions): Promise;
};