import { FxError } from "@microsoft/teamsfx-api"; import { Result } from "neverthrow"; import { EvalValue, ExpressionNode, Scope } from "../expression/evaluateExpression"; import { Answers } from "../model/dataModel"; /** An authored visibility / value guard — the same closed form the evaluator parses. */ export type ConditionNode = ExpressionNode; /** Identity-only option; computed values flow through provider `derived.*`. */ export interface OptionItem { id: string; label?: string; description?: string; detail?: string; groupName?: string; condition?: ConditionNode; keyPrefix?: string; } export interface InputBoxConfig { name: string; title?: string; placeholder?: string; prompt?: string; default?: string; step?: number; keyPrefix?: string; validation?: string | ValidationSpec; } /** Native question kinds the surface-neutral driver renders. */ export type QuestionType = "singleSelect" | "multiSelect" | "text" | "confirm" | "singleFile" | "folder" | "singleFileOrText"; /** A validator reference: the registry name, or `{ use, params }`. */ export interface ValidationSpec { use: string; params?: Record; } /** One authored question. Only one option source may be present. */ export interface QuestionSpec { name: string; type: QuestionType; title?: string; cliDescription?: string; cliShortName?: string; placeholder?: string; prompt?: string; default?: string; filters?: Record; inputOptionItem?: OptionItem; inputBoxConfig?: InputBoxConfig; validation?: string | ValidationSpec; staticOptions?: OptionItem[]; optionsFrom?: string; optionsFromParams?: Record; skipSingleOption?: boolean; optional?: boolean; condition?: ConditionNode; keyPrefix?: string; } /** The Q2 options JSON Schema; only its identifier domain is read here. */ export interface OptionsSchema { properties?: Record; } /** What an `optionsFrom` provider yields. */ export interface ResolvedOptions { options: OptionItem[]; derived?: Record; } export type OptionsSource = OptionItem[] | (() => Promise); /** Engine-registered `optionsFrom` provider. */ export interface OptionsProvider { derivedSchema?: string[]; fetch(params: Record): Promise | ResolvedOptions; } /** Engine-registered validator: an error message, or `undefined` when valid. */ export type Validator = (value: string, answers: Answers) => string | undefined | Promise; export type PromptValidation = (value: string) => string | undefined | Promise; /** One prompt's outcome: a chosen value or the host's `back` request. */ export type Asked = { kind: "value"; value: T; } | { kind: "back"; }; /** Surface-neutral prompt driver. */ export interface PromptUI { /** Render one scalar question. */ ask(question: QuestionSpec, options: OptionsSource | undefined, step?: number, validation?: PromptValidation, inputBoxValidation?: PromptValidation): Promise, FxError>>; /** Render one multi-pick question without collapsing selected ids to a scalar. */ askMulti(question: QuestionSpec, options: OptionsSource | undefined, step?: number): Promise, FxError>>; } /** Narrow input-collection port: prompt UI, registries, and shared evaluator. */ export interface CollectInputsPort { ui: PromptUI; optionsProvider(providerId: string): OptionsProvider | undefined; validator(name: string): Validator | undefined; evaluate(node: ConditionNode, scope: Scope): Result; } export interface CollectInputsOptions { appendLanguage?: boolean; } /** `SystemError` names for engine-side input collection breaks. */ export declare const INPUT_BOTH_OPTION_SOURCES = "InputBothOptionSources"; export declare const INPUT_UNKNOWN_PROVIDER = "InputUnknownProvider"; export declare const INPUT_UNKNOWN_VALIDATOR = "InputUnknownValidator"; export declare const INPUT_FORWARD_DERIVED_REFERENCE = "InputForwardDerivedReference"; export declare const INPUT_PROVIDER_FAILED = "InputProviderFailed"; /** `UserError` name for input validation failures. */ export declare const INPUT_VALIDATION_FAILED = "InputValidationFailed"; /** `UserError` name for cancelling the walk from the first prompt. */ export declare const INPUT_WALK_CANCELLED = "InputWalkCancelled"; /** Walk one template's questions into the resolved answer object. */ export declare function collectInputs(questions: QuestionSpec[], optionsSchema: OptionsSchema, entryParams: Answers, languages: string[], port: CollectInputsPort, options?: CollectInputsOptions): Promise>; //# sourceMappingURL=collectInputs.d.ts.map