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.
| Parameter | Type | Description |
|---|---|---|
| dictionary | Dictionary | DictionaryJSON | FixtDictionaries | A Dictionary index, a raw DictionaryJSON, or a FIXT transport/application pair. |
| options? | EngineOptions | Per-engine defaults (EngineOptions), overridable on each call. |
Returns FixEngine<Bodies> — A pure, reusable engine bound to the dictionary.
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 0import { 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: Dictionaryreadonly transport?: DictionaryThe FIXT transport dictionary, when the engine was created with a pair.
readonly app?: DictionaryThe (default) application dictionary, when the engine was created with a pair.
parse(raw: string | Uint8Array, options?: ParseOptions): ParseResultParse 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): stringEncode 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
MutableMessagefor aMsgType. SeecreateMessage. Typed toBodies[M]when the engine was created with aMessageBodiestype parameter.createImmutable<M extends keyof Bodies & string>(msgType: M, init?: MessageInit<Bodies[M] & object>): ImmutableMessage<Bodies[M] & object>Create a typed
ImmutableMessagefor aMsgType. SeecreateImmutableMessage.is: MessageTypeGuard<Bodies>Narrow a message of unknown body to a specific message's read surface, keyed on its
MsgTypevalue — the read-side counterpart ofFixEngine.create, withBodiesalready bound. Insideif (engine.is(msg, 'W')) { … },msg.get(…)is typed to that message's body. Runtime is a plainmsgTypecompare. SeemessageTypeGuard.
EngineOptionsinterfacesince 0.1.0
interface EngineOptionsSource: packages/fix/src/engine.ts:26
Defaults applied to every call, overridable per call.
soh?: stringField separator for parse/encode. Defaults to
SOH.checkFraming?: booleanVerify 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.