Function: profileQuirkApplied()
profileQuirkApplied(
original,profileName):AstmRecordWarning
Build a PROFILE_QUIRK_APPLIED warning: the downgraded form an active vendor profile produces from
a deviation it expects. The original warning is not dropped: its code moves to
toleratedCode, the warning is re-badged PROFILE_QUIRK_APPLIED, expected is set, and the
tolerating profile is named. The original position and message are preserved (both PHI-free by
the same construction as every other factory), so a consumer can filter known, grounded noise while
the fact of the deviation, and where it was, survive. A profile can only ever reach this path for a
non-safety-critical code (enforced at profile-definition time by the safety gate).
Parameters
original
The warning the profile tolerated.
profileName
string
The name of the tolerating profile.
Returns
The re-badged, still-informative warning.
Example
import { profileQuirkApplied, unknownEscapeSequence } from "@cosyte/astm";
const original = unknownEscapeSequence({ recordIndex: 4, recordType: "R", fieldIndex: 5 });
const w = profileQuirkApplied(original, "referenceCorpus");
w.code; // "PROFILE_QUIRK_APPLIED"
w.toleratedCode; // "ASTM_UNKNOWN_ESCAPE_SEQUENCE"