import type { AnnotationNode, ConstraintNode, JsonValue, PathTarget, Provenance, TypeNode } from "@stripe/formspec-core/internals"; type ConstraintDiagnosticSeverity = "error" | "warning"; export interface AnalysisTypeDefinition { readonly name: string; readonly type: TypeNode; readonly constraints?: readonly ConstraintNode[]; readonly annotations?: readonly AnnotationNode[]; readonly provenance: Provenance; } export type AnalysisTypeRegistry = Record; export interface EffectiveTargetState { readonly fieldName: string; readonly path: PathTarget | null; readonly targetName: string; readonly type: TypeNode; readonly inheritedConstraints: readonly ConstraintNode[]; readonly inheritedAnnotations: readonly AnnotationNode[]; readonly localConstraints: readonly ConstraintNode[]; readonly effectiveConstraints: readonly ConstraintNode[]; } export type ResolvedTargetState = ({ readonly kind: "resolved"; } & EffectiveTargetState) | { readonly kind: "missing-property"; readonly fieldName: string; readonly path: PathTarget; readonly targetName: string; readonly segment: string; readonly localConstraints: readonly ConstraintNode[]; } | { readonly kind: "unresolvable"; readonly fieldName: string; readonly path: PathTarget; readonly targetName: string; readonly type: TypeNode; readonly localConstraints: readonly ConstraintNode[]; }; export interface ConstraintSemanticDiagnostic { readonly code: string; readonly message: string; readonly severity: ConstraintDiagnosticSeverity; readonly primaryLocation: Provenance; readonly relatedLocations: readonly Provenance[]; } export interface ConstraintTargetAnalysisResult { readonly diagnostics: readonly ConstraintSemanticDiagnostic[]; readonly targetStates: readonly ResolvedTargetState[]; } export interface ConstraintSemanticRoleLike { readonly family: string; readonly bound: "lower" | "upper" | "exact"; readonly inclusive: boolean; } export interface ConstraintRegistrationLike { readonly constraintName: string; readonly applicableTypes: readonly TypeNode["kind"][] | null; readonly isApplicableToType?: (type: TypeNode) => boolean; readonly comparePayloads?: (left: JsonValue, right: JsonValue) => number; readonly semanticRole?: ConstraintSemanticRoleLike; } export interface ConstraintTagRegistrationLike { readonly tagName: string; readonly constraintName: string; readonly isApplicableToType?: (type: TypeNode) => boolean; } export interface ConstraintRegistryLike { findConstraint(constraintId: string): ConstraintRegistrationLike | undefined; findConstraintTag(tagName: string): { readonly extensionId: string; readonly registration: ConstraintTagRegistrationLike; } | undefined; findBuiltinConstraintBroadening?(typeId: string, tagName: string): { readonly extensionId: string; readonly registration: unknown; } | undefined; } export declare function formatConstraintTargetName(fieldName: string, path: PathTarget | null): string; export declare function dereferenceAnalysisType(type: TypeNode, typeRegistry: AnalysisTypeRegistry): TypeNode; export declare function collectReferencedTypeConstraints(type: TypeNode, typeRegistry: AnalysisTypeRegistry): readonly ConstraintNode[]; export declare function collectReferencedTypeAnnotations(type: TypeNode, typeRegistry: AnalysisTypeRegistry): readonly AnnotationNode[]; export declare function resolveConstraintTargetState(fieldName: string, fieldType: TypeNode, path: PathTarget | null, localConstraints: readonly ConstraintNode[], typeRegistry: AnalysisTypeRegistry): ResolvedTargetState; export declare function buildConstraintTargetStates(fieldName: string, fieldType: TypeNode, constraints: readonly ConstraintNode[], typeRegistry: AnalysisTypeRegistry): readonly ResolvedTargetState[]; /** * Resolves targeted constraints against a field type, producing effective * target states plus semantic diagnostics such as contradictions, unknown * paths, and type mismatches. */ export declare function analyzeConstraintTargets(fieldName: string, fieldType: TypeNode, constraints: readonly ConstraintNode[], typeRegistry: AnalysisTypeRegistry, options?: { readonly extensionRegistry?: ConstraintRegistryLike; }): ConstraintTargetAnalysisResult; export {}; //# sourceMappingURL=semantic-targets.d.ts.map