/** * The diagnostic vocabulary. * * Layer 1. Imports nothing, so every other module may depend on it. * * A diagnostic is a *value*, never a log line. Each code has exactly one severity and one * disposition, both fixed here: * * - `fatal` — edfcore cannot proceed without inventing something. Always throws, even when * `strict` is false. * - `deferred` — the header parses, but one signal cannot be scaled. `signal.scale` becomes * `undefined`, `decodeDigital` keeps working, and `toPhysical` throws. * - `warning` — the file is impolite but readable, and what we return is true. * - `info` — the file is correct; the note exists because the situation surprises people. */ /** * How much a diagnostic should worry you. `info` is the one to know: those describe correct * files, are carried by nearly every conforming EDF, and are exempt from `strict` — so filtering * on severity rather than treating the array as uniformly bad is usually what a caller wants. */ export type EdfSeverity = 'error' | 'warning' | 'info'; /** How a code behaves when it fires. See the module comment. */ export type EdfDiagnosticDisposition = 'fatal' | 'deferred' | 'warning' | 'info'; /** * Every code edfcore itself can emit, grouped by disposition. * * This union and the `DISPOSITIONS` map below are checked against each other by the compiler: * the map is typed as a total `Record` over this union, so a code added to one and not the * other is a build error rather than a silent gap. */ export type EdfKnownDiagnosticCode = 'NOT_AN_EDF_FILE' | 'SOURCE_TOO_SMALL' | 'SIGNAL_COUNT_INVALID' | 'NUMERIC_FIELD_INVALID' | 'COMMA_DECIMAL_SEPARATOR' | 'RECORD_SIZE_ZERO' | 'EDFPLUS_WITHOUT_ANNOTATION_SIGNAL' | 'TIMELINE_NOT_MONOTONIC' | 'RECORDING_SPAN_UNREPRESENTABLE' | 'DEGENERATE_DIGITAL_RANGE' | 'DEGENERATE_PHYSICAL_RANGE' | 'INVERTED_DIGITAL_RANGE' | 'LOG_TRANSFORMED_CHANNEL' | 'SCALE_UNAVAILABLE' | 'HEADER_SIZE_MISMATCH' | 'RECORD_COUNT_RECOVERED' | 'TRUNCATED_FILE' | 'PARTIAL_FINAL_RECORD' | 'TRAILING_BYTES' | 'RECORD_SIZE_ABOVE_RECOMMENDED' | 'NONSTANDARD_RESERVED_FIELD' | 'NON_ASCII_HEADER_FIELD' | 'NUMERIC_FIELD_NOT_LEFT_JUSTIFIED' | 'DATE_FIELDS_DISAGREE' | 'DATE_UNPARSEABLE' | 'STARTTIME_UNPARSEABLE' | 'PATIENT_ID_NONCONFORMANT' | 'RECORDING_ID_NONCONFORMANT' | 'DUPLICATE_SIGNAL_LABEL' | 'DIGITAL_RANGE_EXCEEDS_FORMAT' | 'ZERO_SAMPLES_PER_RECORD' | 'ZERO_RECORD_DURATION' | 'ANNOTATION_SIGNAL_HEADER_NONCONFORMANT' | 'MISSING_EDFPLUS_MARKER' | 'TIMEKEEPING_TAL_MISSING' | 'TIMEKEEPING_TAL_NONCONFORMANT' | 'START_OFFSET_OUT_OF_RANGE' | 'TAL_MALFORMED' | 'TAL_TRUNCATED_AT_REGION_END' | 'TAL_REGION_NOT_NUL_TERMINATED' | 'ANNOTATION_TEXT_NOT_UTF8' | 'RECORD_ONSET_SPACING_VIOLATION' | 'DISCONTINUITY_IN_CONTINUOUS_FILE' | 'DATE_CLIPPED_TO_1985_2084' | 'INVERTED_PHYSICAL_RANGE' | 'NEGATIVE_ANNOTATION_ONSET'; /** * Open union: known codes autocomplete, and a `default` branch stays mandatory so adding a * code in a minor release cannot break a consumer's exhaustive switch. */ export type EdfDiagnosticCode = EdfKnownDiagnosticCode | (string & {}); /** * Every known code and how it behaves, as one table. Typed by `EdfKnownDiagnosticCode`, so adding * a code to the union without deciding its disposition fails to compile — which is what keeps the * two from drifting apart. */ export declare const DIAGNOSTIC_DISPOSITIONS: Readonly>; /** Unknown codes are treated as warnings — an unrecognised note must never escalate. */ export declare function dispositionOf(code: EdfDiagnosticCode): EdfDiagnosticDisposition; /** * The severity a consumer sees, collapsed from the disposition. `fatal` and `deferred` both * surface as `error` on purpose: they differ in WHEN they stop a parse, not in how wrong the file * is, and that distinction is this module's business rather than a reader's. */ export declare function severityOf(code: EdfDiagnosticCode): EdfSeverity; /** Fires regardless of `strict`: proceeding would require inventing data. */ export declare function isAlwaysFatal(code: EdfDiagnosticCode): boolean; //# sourceMappingURL=codes.d.ts.map