import type { FetchFn, WithId } from "./types.js"; /** Options for {@link FhirResourceWriter.create}. */ export interface CreateOptions { /** * FHIR conditional create — the `If-None-Exist` header, given as a search string * (e.g. `identifier=https://example.org/mrn|12345`). * * The server creates the resource only when that search matches nothing; on a match it returns * the existing resource instead of a duplicate. This is what makes a create idempotent, and so * what makes a write safe to retry: a provisioning job that runs twice produces one resource. * * Pass the raw search string, NOT url-encoded — this is a header, not a query string, and * encoding the `|` makes the search match nothing, which silently turns every retry into * another copy. */ ifNoneExist?: string; } /** * Generic FHIR resource writer with create, update, delete and createOrUpdate (PUT). */ export declare class FhirResourceWriter { readonly baseUrl: string; readonly resourceType: string; private readonly fetchFn; constructor(baseUrl: string, resourceType: string, fetchFn?: FetchFn); /** * Create a new resource (POST). * * With {@link CreateOptions.ifNoneExist} this is a conditional create: `201` for a resource that * was created, `200` for one that already matched. Both resolve to the resource; check * `meta.versionId` or search first if the caller needs to tell them apart. */ create(resource: T, options?: CreateOptions): Promise>; /** Update an existing resource (PUT with ID). */ update(resource: WithId): Promise>; /** Delete a resource by ID. */ delete(id: string): Promise; /** Create-or-update via conditional PUT. */ createOrUpdate(resource: WithId): Promise>; /** * The resource a write responded with, falling back to the `Location` header. * * A conditional create that MATCHES is allowed to answer `200` with no body — the server has * nothing new to report — and the id then exists only in `Location`. Parsing the body alone * would throw there, which would make the idempotent path the one that fails. */ private resourceFromResponse; } //# sourceMappingURL=writer.d.ts.map