/** * Profile Loader Utilities * * Utilities for loading StructureDefinitions and generating snapshots. * Extracted from validator-engine.ts to comply with global.mdc guidelines. */ import type { StructureDefinition } from './structure-definition-types'; import type { ValidationIssue, ValidationSettings } from '../types'; import { StructureDefinitionLoader } from './structure-definition-loader'; import { ProfileCache } from '../cache/profile-cache'; import { SnapshotGenerator } from './snapshot-generator'; import type { ProfileSourceContext } from '../persistence'; /** Minimal interface for FHIR client to avoid circular dependencies */ export interface FhirClientLike { searchResources(resourceType: string, params: Record, count?: number, options?: Record): Promise<{ entry?: Array<{ resource: StructureDefinition; }>; }>; } /** * Load a profile with snapshot generation if needed */ export declare function loadProfileWithSnapshot(sdLoader: StructureDefinitionLoader, profileCache: ProfileCache, snapshotGenerator: SnapshotGenerator, profileUrl: string, fhirVersion: 'R4' | 'R5' | 'R6', _fhirClient?: FhirClientLike): Promise; /** * Result of loading a profile with base-SD fallback. * `usedBaseFallback` is true when the declared profile was unresolvable * and we fell back to the resource type's base StructureDefinition so * callers can still emit a warning and run the non-profile aspects. */ export interface ProfileLoadResult { structureDef: StructureDefinition | null; declaredProfileUrl: string; usedBaseFallback: boolean; incompatibleProfileType?: string; } /** * Load a profile with base-SD fallback. * * Why this exists: if a resource declares `meta.profile` pointing at a URL * the loader can't resolve (unknown IG, typo), returning null causes the * batch validator to skip ALL aspects. HAPI falls back to the resource * type's base SD in that case. We do the same so structural / invariant / * reference / metadata issues still surface. */ export declare function loadProfileOrBase(sdLoader: StructureDefinitionLoader, snapshotGenerator: SnapshotGenerator, declaredProfileUrl: string, resourceType: string, fhirVersion: 'R4' | 'R5' | 'R6', profileCache?: ProfileCache, fhirClient?: FhirClientLike, resolutionContext?: ProfileSourceContext, settings?: ValidationSettings): Promise; /** * Build the warning issue emitted when a declared profile couldn't be * resolved and validation fell back to the resource type's base SD. */ export declare function createProfileFallbackIssue(profileUrl: string, resourceType: string, profileSource?: Pick): ValidationIssue; export declare function suggestProfilesForUnresolvedCanonical(profileUrl: string, availableProfiles: string[], limit?: number): string[]; export { createProfileResourceTypeMismatchIssue } from './profile-resource-type'; /** * Load a profile and ensure snapshot exists (for validate method) */ export declare function loadProfileForValidation(sdLoader: StructureDefinitionLoader, snapshotGenerator: SnapshotGenerator, profileUrl: string, fhirVersion: 'R4' | 'R5' | 'R6', profileCache?: ProfileCache, // Optional for backward compat, but recommended _fhirClient?: FhirClientLike, resolutionContext?: ProfileSourceContext, _settings?: ValidationSettings): Promise; //# sourceMappingURL=profile-loader-utils.d.ts.map