/** * SD Constraint Collector * * Extracts ALL constraints from a StructureDefinition to ensure complete * coverage. Unlike the regular constraint validator which may skip elements, * this collector guarantees every constraint is found and can be evaluated. * * This is key for HAPI parity - HAPI evaluates every single constraint * regardless of whether the target element exists. */ import type { StructureDefinition, Constraint } from '../core/structure-definition-types'; export interface CollectedConstraint { /** Full path to the element (e.g., "Patient.contact") */ elementPath: string; /** The constraint from the SD */ constraint: Constraint; /** Whether this is on the root element */ isRootConstraint: boolean; /** Element cardinality - 0 means optional */ minCardinality: number; /** Type(s) of the element */ elementTypes: string[]; /** * Slice name when the source element is part of a slice * (e.g. `Organization.identifier:NPI` → `'NPI'`). Constraints on * slice elements only apply to instances matching the slice * discriminator — the generic executor does not have slice-aware * context resolution and would fire the constraint on every value * at the path, so the executor uses this field to skip them. */ sliceName?: string; } export interface ConstraintCollectionResult { /** All constraints from the SD */ constraints: CollectedConstraint[]; /** Constraints grouped by key (e.g., 'dom-2', 'obs-6') */ byKey: Map; /** Root-level constraints (apply to entire resource) */ rootConstraints: CollectedConstraint[]; /** Element-level constraints */ elementConstraints: CollectedConstraint[]; /** Stats */ totalCount: number; uniqueKeys: string[]; } export declare class SDConstraintCollector { private collectionCache; /** * Collect ALL constraints from a StructureDefinition */ collect(structureDef: StructureDefinition): ConstraintCollectionResult; /** * Collect constraints for a specific resource type */ collectForResource(structureDef: StructureDefinition, _resource: any): CollectedConstraint[]; /** * Get constraints that MUST be evaluated (root + present elements) */ getMandatoryConstraints(structureDef: StructureDefinition, resource: any): CollectedConstraint[]; /** * Check if a path exists in a resource */ private pathExistsInResource; /** * Build the result object */ private buildResult; } export declare const sdConstraintCollector: SDConstraintCollector; //# sourceMappingURL=sd-constraint-collector.d.ts.map