import type { Bundle, FhirResourceType, ResourceOfType } from "./types.js"; /** * Extracts typed resources from a FHIR Bundle. * * Every method keeps the type information the caller already has. `getAllResources` * returns the bundle's own element type, and the `*ByType` methods derive their * return type from the `resourceType` argument — an argument that is not a FHIR * R5 resource type, or that disagrees with an explicit type argument, * is a compile error rather than a wrong type at runtime. * * `id` is optional in FHIR, so nothing here promises `WithId`. Chain the `hasId` * guard where the guarantee is needed: * `BundleParser.getResourcesByType(bundle, "Patient").filter(hasId)`. */ export declare class BundleParser { /** Resources of one type, without the type-level narrowing the overloads add. */ private static ofType; /** * Get all resources of a given type from a Bundle. * * @param bundle The FHIR Bundle to parse * @param resourceType The resourceType to filter by (e.g. "Patient"). The return * type follows it, so base resources need no type argument. Pass one explicitly * for profile types from other generated packages — `resourceType` is then * constrained to that type's own discriminant. A resourceType chosen at runtime * should be typed `FhirResourceType` rather than `string`. */ static getResourcesByType(bundle: Bundle, resourceType: K): ResourceOfType[]; static getResourcesByType(bundle: Bundle, resourceType: T["resourceType"] & FhirResourceType): T[]; /** * Get the first resource of a given type from a Bundle, or undefined. */ static getFirstResourceByType(bundle: Bundle, resourceType: K): ResourceOfType | undefined; static getFirstResourceByType(bundle: Bundle, resourceType: T["resourceType"] & FhirResourceType): T | undefined; /** * Get all resources from a Bundle regardless of type. * * The bundle's element type is preserved, so the searchset a * `FhirResourceReader` returns comes back as what it already was. */ static getAllResources(bundle: Bundle): T[]; /** * Resolve a FHIR reference within a Bundle. * Supports "ResourceType/id" relative references and full-URL references * matched against entry.fullUrl. * * The resolved resource carries the bundle's element type. Use * {@link BundleParser.resolveReferenceOfType} to narrow a mixed bundle by a * checked resourceType. * * @param ref A FHIR Reference object (e.g. `{ reference: "Patient/123" }`) * @param bundle The Bundle to search within * @returns The resolved resource, or undefined if not found */ static resolveReference(ref: { reference?: string; } | undefined, bundle: Bundle): T | undefined; /** * Resolve a FHIR reference and require the resolved resource to be of a given * type. Returns undefined when the reference resolves to something else, so the * returned type is checked rather than asserted. */ static resolveReferenceOfType(ref: { reference?: string; } | undefined, bundle: Bundle, resourceType: K): ResourceOfType | undefined; static resolveReferenceOfType(ref: { reference?: string; } | undefined, bundle: Bundle, resourceType: T["resourceType"] & FhirResourceType): T | undefined; } //# sourceMappingURL=bundle-parser.d.ts.map