Function: resolveQuirk()
resolveQuirk(
registry,format,name):QuirkDescriptor
Resolve a requested quirk name against a format's registry, or fail closed. A quirk the format's
profile system does not support is a fatal SYNTH_UNSUPPORTED_QUIRK - never a silent no-op and never
a fabricated quirk with a made-up warning.
The refusal names neither the request nor the registry. registry, format and name are all
caller-supplied, and a diagnostic that quotes its input is a diagnostic that can be made to carry
anything the caller was holding - which for a fixture generator wired into someone else's pipeline
is not a hypothetical. Branch on err.code; the supported set is the registry you passed
(HL7_QUIRKS, CCDA_QUIRKS, ASTM_QUIRKS), which you can enumerate directly.
Parameters
registry
Readonly<Record<string, QuirkDescriptor>>
The format's quirk descriptors, keyed by name.
format
The format being generated.
name
string
The requested quirk name.
Returns
The matching QuirkDescriptor.
Throws
SynthError with code SYNTH_UNSUPPORTED_QUIRK when name is not a supported quirk.
Example
import { resolveQuirk } from "@cosyte/synth";
import { HL7_QUIRKS } from "@cosyte/synth/hl7";
resolveQuirk(HL7_QUIRKS, "hl7v2", "unknown-zsegment").intendedWarnings; // ["UNKNOWN_SEGMENT"]