Engine & constants API

The dictionary-bound engine façade — parse, validate, encode and the typed message builder behind one binding — plus the package's exported constants. Generated from @boarteam/fix 0.5.2 as installed; the doc text is the library’s own. Guide: Getting started.

createFixEnginefunctionsince 0.1.0

function createFixEngine<Bodies = Record<string, UntypedBody>>(dictionary: Dictionary | DictionaryJSON | FixtDictionaries, options?: EngineOptions): FixEngine<Bodies>

Source: packages/fix/src/engine.ts:130

Create a FixEngine bound to a dictionary. Accepts a Dictionary runtime index, a raw DictionaryJSON (which is loaded for you), or a FIXT transport/application pair (FixtDictionaries) — the FIXT form parses/encodes over the pair's merged view and returns layer-attributed diagnostics from validate (see FixIssue.layer). The returned engine is pure and reusable across messages.

The // → annotations below are asserted outputs, not aspirations: every @example block is executed against the built packages by the doctest gate (examples/api-doctest.test.ts), which fails when a block does not run or does not print what it claims.

ParameterTypeDescription
dictionaryDictionary | DictionaryJSON | FixtDictionariesA Dictionary index, a raw DictionaryJSON, or a FIXT transport/application pair.
options?EngineOptionsPer-engine defaults (EngineOptions), overridable on each call.

Returns FixEngine<Bodies>A pure, reusable engine bound to the dictionary.

Example
import { createFixEngine } from '@boarteam/fix';import { dictionary } from '@boarteam/fix-dict-fix44';const fix = createFixEngine(dictionary);const raw = '8=FIX.4.4|9=58|35=A|49=BUY|56=SELL|34=1|52=20260807-12:00:00|98=0|108=30|10=164|';const { message, issues } = fix.parse(raw, { soh: '|' });console.log(message.name, issues.length); // → Logon 0
Example — FIXT.1.1 pair (layer-attributed validation)
import { createFixEngine } from '@boarteam/fix';import { dictionary as fixt11 } from '@boarteam/fix-dict-fixt11';import { dictionary as fix50sp2 } from '@boarteam/fix-dict-fix50sp2';const fix = createFixEngine({ transport: fixt11, app: fix50sp2 });// A FIXT Logon missing its required EncryptMethod(98) — a session-layer defect,// so the finding says: answer with a session Reject(3), not a BusinessMessageReject.const raw = '8=FIXT.1.1|9=60|35=A|49=BUY|56=SELL|34=1|52=20260807-12:00:00|108=30|1137=9|10=079|';const issues = fix.validate(fix.parse(raw, { soh: '|' }).message);const sessionFindings = issues.filter((i) => i.layer === 'session');console.log(sessionFindings.map((i) => `${i.code}(${i.refTagID})`)); // → [ 'validate/required-field-missing(98)' ]

The // → lines are asserted outputs: the library's doctest executes this exact block against the built packages and fails the build when it prints anything else.

FixEngineinterfacesince 0.1.0

interface FixEngine<Bodies = Record<string, UntypedBody>>

Source: packages/fix/src/engine.ts:44

A dictionary-bound façade over the stateless codec: parse/parseAll/encode/create with the dictionary and default options already applied. Holds no session state (sequence numbers, timestamps, comp-IDs) — it is a thin, pure convenience over the free functions, which remain available for callers who prefer to pass the dictionary explicitly.

The optional Bodies type parameter is the generated MessageBodies map (MsgType value → typed body) a dict package ships: createFixEngine<MessageBodies>(dictionary) makes FixEngine.create strongly typed per message. Omit it for the loose, name-keyed UntypedBody path.

  • readonly dictionary: Dictionary

    The runtime dictionary this engine is bound to. For an engine created with a FIXT transport/application pair this is the pair's merged view (the dictionary messages are structurally parsed and encoded against); the layers stay reachable via transport and app.

  • readonly transport?: Dictionary

    The FIXT transport dictionary, when the engine was created with a pair.

  • readonly app?: Dictionary

    The (default) application dictionary, when the engine was created with a pair.

  • parse(raw: string | Uint8Array, options?: ParseOptions): ParseResult

    Parse the first message in the input. See parse.

  • parseAll(raw: string | Uint8Array, options?: ParseOptions): ParseResult[]

    Parse every message in a concatenated buffer. See parseAll.

  • encode(message: EncodeMessage, options?: EncodeOptions): string

    Encode a message into a framed FIX string. See encode.

  • validate(message: ParsedMessage, options?: ValidateOptions): FixIssue[]

    Validate a parsed message against the dictionary. See validate.

  • create<M extends keyof Bodies & string>(msgType: M, init?: MessageInit<Bodies[M] & object>): MutableMessage<Bodies[M] & object>

    Create a typed, self-rendering MutableMessage for a MsgType. See createMessage. Typed to Bodies[M] when the engine was created with a MessageBodies type parameter.

  • createImmutable<M extends keyof Bodies & string>(msgType: M, init?: MessageInit<Bodies[M] & object>): ImmutableMessage<Bodies[M] & object>

    Create a typed ImmutableMessage for a MsgType. See createImmutableMessage.

  • is: MessageTypeGuard<Bodies>

    Narrow a message of unknown body to a specific message's read surface, keyed on its MsgType value — the read-side counterpart of FixEngine.create, with Bodies already bound. Inside if (engine.is(msg, 'W')) { … }, msg.get(…) is typed to that message's body. Runtime is a plain msgType compare. See messageTypeGuard.

EngineOptionsinterfacesince 0.1.0

interface EngineOptions

Source: packages/fix/src/engine.ts:26

Defaults applied to every call, overridable per call.

  • soh?: string

    Field separator for parse/encode. Defaults to SOH.

  • checkFraming?: boolean

    Verify the transport frame on parse (see ParseOptions.checkFraming).

SOHconstsince 0.1.0

const SOH = "\u0001"

Source: packages/fix/src/codec/tokenize.ts:4

The FIX field separator (SOH, ASCII 0x01).

VERSIONconstsince 0.1.0

const VERSION = "0.4.0"

Source: packages/fix/src/index.ts:9

@boarteam/fix — a dictionary-driven FIX protocol toolkit.

Parse, validate, and encode FIX messages with zero runtime dependencies, in the browser or Node. See the README and docs/ROADMAP.md for the roadmap; this package is in early (0.x) development.