Skip to main content
Version: v0.0.4

Interface: AstmMessage

A parsed ASTM message: the header, the ordered records (the header is also records[0]), the resolved delimiters, and the accumulated warnings.

Example

import { parseAstmRecords } from "@cosyte/astm";
const msg = parseAstmRecords("H|\\^&\rL|1\r");
msg.header.delimiters.field; // "|"
msg.records.length; // 2

Properties

classification

readonly classification: AstmMessageClassification

The host-query classification of this message - whether it is a request (Q present), a result upload, an order download, or indeterminate. Gate on AstmMessageClassification.isHostQueryRequest before reading records as results.


delimiters

readonly delimiters: Delimiters

The delimiters the first header declared.

A stream may carry several messages (HL), and a later header may declare a different set, which is honored from that header onward. So this is not necessarily the set every record was read with - each header reports its own on HeaderRecord.delimiters, and a change is flagged ASTM_RECORD_DELIMITERS_REDECLARED.


readonly header: HeaderRecord

The first header in the stream. A multi-header stream's later headers are in AstmMessage.records.


profile?

readonly optional profile?: object

The vendor profile that was active for this parse, when one applied - its name and resolved lineage (attribution only; the profile object itself is not embedded). Absent when no profile applied. A profile that tolerated a deviation shows up as a PROFILE_QUIRK_APPLIED entry in warnings, not here.

lineage

readonly lineage: readonly string[]

name

readonly name: string


records

readonly records: readonly AstmRecord[]


warnings

readonly warnings: readonly AstmRecordWarning[]