import type { FxError } from "@microsoft/teamsfx-api"; import type { Result } from "neverthrow"; /** Create one caller-owned, author-fixable validation failure. */ export type TemplatePackageErrorFactory = (name: string, message: string) => FxError; /** Package namespace. */ export type PackageKind = "create" | "modify"; /** Validation mode; only `load` compares this engine against `minEngineVersion`. */ export type ValidateMode = "build" | "load"; /** One content file's path plus extracted `{{token}}` names. */ export interface ContentFile { path: string; placeholders: string[]; } /** JSON-schema validator face; `undefined` means valid. */ export type SchemaValidator = (data: unknown) => string | undefined; /** Template-visible extension-point categories with source-owned introduction versions. */ export type CapabilityKind = "step" | "provider" | "validator"; /** Narrow validation port; schema, package, and engine-context data stay injected. */ export interface TemplatePackagePort { /** Adapt an author-fixable diagnosis to the caller's concrete error type. */ userError: TemplatePackageErrorFactory; /** The package's parsed `descriptor.json`, or `undefined` when absent. */ descriptor(): unknown | undefined; /** The package's parsed `questions.json`, or `undefined` when absent. */ questions(): unknown | undefined; /** The package's parsed `pipeline.json`, or `undefined` when absent. */ pipeline(): unknown | undefined; /** Each content file's path + `{{token}}` set, or `undefined` when `content/` is absent. */ content(): ContentFile[] | undefined; /** The per-kind `selector.json` (parsed). */ selector(kind: PackageKind): unknown; /** The JSON-schema validators under `templates/v4/schema/`. */ schemas: { descriptor: SchemaValidator; question: SchemaValidator; pipeline: SchemaValidator; selector: SchemaValidator; }; /** The engine introduction version for a named capability; `undefined` means unknown. */ capabilityFloor(kind: CapabilityKind, id: string): string | undefined; /** Output names a capability may add to the render context. */ capabilityOutputs(kind: CapabilityKind, id: string): string[]; /** The consuming engine's SemVer (the `load`-mode reverse gate). */ engineVersion(): string; /** The closed caller-injected identifier names (`appName`, the `language` axis, …). */ callerFloor(): string[]; /** The `templateId`s whose `descriptor.json` is present in the artifact, per kind. */ presentTemplateIds(kind: PackageKind): string[]; } /** The validated package outcome. */ export interface ValidatedPackage { /** The parsed, schema-valid descriptor. */ descriptor: Record; /** The resolved reverse-gate floor (recorded on outcome / telemetry). */ minEngineVersion: string; /** The validated content-file list (empty when `content/` is absent). */ contentFiles: ContentFile[]; } /** `UserError` name: a required package file (`descriptor`/`questions`/`pipeline`) is absent. */ export declare const VALIDATE_REQUIRED_FILE = "TemplatePackageRequiredFile"; /** `UserError` name: a package file failed its JSON schema. */ export declare const VALIDATE_SCHEMA = "TemplatePackageSchema"; /** `UserError` name: a content token has no producer, or a required var has no consumer. */ export declare const VALIDATE_PLACEHOLDER_DRIFT = "TemplatePackagePlaceholderDrift"; /** `UserError` name: a v4 selector route names a `templateId` with no present descriptor. */ export declare const VALIDATE_DANGLING_ROUTE = "TemplatePackageDanglingRoute"; /** `UserError` name: the same `templateId` is routed in both the create and modify selectors. */ export declare const VALIDATE_KIND_OVERLAP = "TemplatePackageKindOverlap"; /** `UserError` name: `descriptor.minEngineVersion` is missing (it is mandatory). */ export declare const VALIDATE_MIN_ENGINE_MISSING = "TemplatePackageMinEngineVersionMissing"; /** `UserError` name: `engineVersion < minEngineVersion` — the engine is too old. */ export declare const VALIDATE_ENGINE_TOO_OLD = "TemplatePackageEngineTooOld"; /** `UserError` name: a package or consuming engine version is not valid SemVer. */ export declare const VALIDATE_ENGINE_VERSION_INVALID = "TemplatePackageEngineVersionInvalid"; /** `UserError` name: package data references a capability absent from the engine catalogue. */ export declare const VALIDATE_UNKNOWN_CAPABILITY = "TemplatePackageUnknownCapability"; /** `UserError` name: `minEngineVersion` predates a referenced capability. */ export declare const VALIDATE_CAPABILITY_FLOOR = "TemplatePackageCapabilityFloor"; /** Apply the package's reverse engine-version gate before any content is rendered. */ export declare function validateMinEngineVersion(kind: PackageKind, id: string, descriptor: unknown, engineVersion: string, userError: TemplatePackageErrorFactory): Result; /** Validate one `/` package before any content is rendered. */ export declare function validateTemplatePackage(kind: PackageKind, id: string, mode: ValidateMode, port: TemplatePackagePort): Result; //# sourceMappingURL=validateTemplatePackage.d.ts.map