APIs

Host API

sirius.* is the library your mapping script calls while a message is in flight. It is the same catalog in every language pack — 248 symbols. Studio autocomplete and hover docs are generated from it. The live JSON is GET /studio/sirius-api.

This page is the contract and the index. Every symbol, with signature and return type, is on the family pages:

PageWhat it coversSymbols
CoreText, JSON, dates, crypto, codecs, XML, logging, env74
StandardsHL7, FHIR, X12, EDIFACT, ISO 20022, FIX, and other interchange formats79
I/O and runtimeHTTP, databases, files, routing, store, tables, metrics, AI51
Devices and protocolsMQTT, CoAP, OPC UA, BACnet, SIP, SMPP44

The contract

Inbound data arrives as msg. You assign result. A run that assigns no result fails with mapping script produced no result.

const order = sirius.json.decode(msg.raw);
order.facility = sirius.table.lookup("facilities", order.site, "UNKNOWN");
sirius.route.push(order);
result = { message: order };

msg includes raw, content_type, sample_name, and — for recognized formats — a parsed msg.parsed tree. Recognized content_type values: json, hl7 / hl7v2, x12 / edi, fhir. Anything else is raw text.

Pure helpers (text, JSON, dates, crypto, parsers) always run. Connector-bound calls (HTTP, database, file, network, SMTP) deliver for real only when Live I/O is enabled and a connector is wired; otherwise they are recorded and simulated (simulated: true on the result).

Languages

PackFormExample
JavaScript, TypeScript, Lua, Pythonsirius.family.member(...)sirius.log.info("ok")
Tclsirius::family::membersirius::log::info "ok"
GoFlat helperssirius.LogInfo("ok") / sirius.Query(...)
Java, Rust, C, C++, WASMLanguage-idiomatic flat namesGuest bindings on the same catalog

Availability:

  • Core symbols run in every pack.
  • Schema helpers (sirius.schema.parse, sirius.spec.parse, *.parse_schema) are a JavaScript / TypeScript surface.
  • Context (route, emit, HTTP, DB, store, …) is available in JavaScript, TypeScript, Lua, and Tcl. Python has the core catalog; Go and WASM use the flat I/O helpers (Query, Send, SiriusHTTPGet, …).

Family index

Every family below is documented with every member on the linked page.

Core — full list

FamilyMembersUse it for
sirius.text13Pad, split, regex, case, templates
sirius.json4Decode, encode, merge, dotted path
sirius.codec14Base64, hex, gzip, zlib, bzip2, URL, HTML, uuencode
sirius.crypto13Digest, HMAC, AES, RSA, PBKDF2, constant-time compare
sirius.datetime6Parse, format, add, diff, HL7 stamps
sirius.date / now / clock / time7Wall clock and strftime helpers
sirius.log4debug, info, warn, error
sirius.env2Tenant environment variables
sirius.uuid / hash / util4IDs and short hashes
sirius.xml4Build, parse, XPath, navigable tree
sirius.validate2HL7 well-formedness, JSON-schema subset

Standards — full list

FamilyMembersUse it for
sirius.hl79Get/set/parse/serialize/ACK/tree/schema
sirius.fhir4Path, bundle, reference, profile validate
sirius.x128Get/set/parse/serialize/ACK/validate/tree/schema
sirius.edifact6Get/set/parse/serialize/CONTRL/validate
sirius.edi1Infer a draft implementation guide from samples
sirius.iso200225Pain/pacs XML get/set/parse/serialize/validate
sirius.swift.mt5FIN blocks and fields
sirius.fix5Tag path, checksum, MsgType allowlist
sirius.fpml5Trade XML
sirius.ncpdp5SCRIPT XML and Telecom D.0
sirius.gs13GTIN/GLN/SSCC check digit and AIs
sirius.rosettanet6RNIF MIME parts and PIP ack
sirius.as25MDN, MIC, disposition options
sirius.dicom3Part-10 detect, routing UIDs, transfer syntax
sirius.ack4Detect, classify, build, assert any standard ACK
sirius.batch2Split and wrap HL7/X12 envelopes
sirius.terminology3Expand, translate, validate codes

I/O and runtime — full list

FamilyMembersUse it for
sirius.http8GET through TRACE via a destination connector
sirius.db3Bound query / exec / ping on a connector id
sirius.file2Read/write through a File connector
sirius.net5FTP, FTPS, SFTP, SMTP, raw TCP
sirius.smtp1Mail via an SMTP destination
sirius.route / emit / output / done / reject7Downstream, fan-out, reply, drop
sirius.store / table7Scoped KV and code-set lookup
sirius.component / message5Current component and message ids
sirius.idempotency / dedupe3Exactly-once helpers
sirius.trace / metric5Spans, events, counters, gauges
sirius.ai3Governed classify / complete / extract
sirius.schema / spec2Parse against a message schema

Devices — full list

FamilyMembersUse it for
sirius.mqtt7Topic filters, QoS, user properties
sirius.coap7Datagram parse/build, codes, options
sirius.opcua6NodeId, Variant, StatusCode, samples
sirius.bacnet7Object id, priority array, COV, properties
sirius.sip7Request/response, headers, URI
sirius.smpp10PDU, DCS, DLR, TLV, concatenated SMS

Worked examples

JSON, text, dates

const obj = sirius.json.decode(msg.raw);
const site = sirius.json.path(obj, "ship.to.site");
const stamp = sirius.datetime.format(sirius.now(), "%Y-%m-%dT%H:%M:%S");
const padded = sirius.text.pad("7", 3, "0", "left"); // "007"

HTTP and databases

const ref = sirius.http.get({ url: "https://example.org/sites/" + site });
const name = sirius.json.decode(ref.body).name;

const rows = sirius.db.query(
  "warehouse",
  "select name from sites where id = ?",
  [site],
);
const ping = sirius.db.ping("warehouse");
if (!ping.ok) sirius.log.warn("warehouse: " + ping.error);

Parameters are always bound. sirius.db.exec commits writes.

Routing

sirius.route.push(out);   // the primary downstream
sirius.emit(extra);       // an additional message
sirius.route.reply(ack);  // source-response only
sirius.reject("bad site");

Store and tables

sirius.store.put("message", "site", site);
const facility = sirius.table.lookup("facilities", site, "UNKNOWN");

Standards

const mrn = sirius.hl7.get(msg.raw, "PID-3.1");
const out = sirius.hl7.set(msg.raw, "PID-5.1", "DOE");
const issues = sirius.fhir.validate(resource, profile);
const ack = sirius.x12.ack(msg.raw, "997", true);

Logging, traces, metrics

sirius.log.info("mapped " + site);
sirius.trace.event("mapped", { site: site });
sirius.metric.inc("messages_mapped");

These light up the Studio run panel and, at runtime, your operations views.

Safety

Keep secrets out of code. Keyed crypto pulls material from managed secrets. Prefer sirius.crypto.constant_time_equal for tokens and MACs. Do not interpolate SQL. Mapping scripts cannot see the host filesystem or the network unless you go through a wired connector.

Discover the live catalog

curl -s "$SIRIUS/studio/sirius-api" | jq '.symbols | length'
curl -s "$SIRIUS/studio/sirius-api" \
  | jq '.symbols[] | select(.family=="http") | {dotted, signature, summary}'

Studio’s editor uses that document. If a symbol is in the catalog, it is in these pages.

Task-oriented walkthrough: Write a transform. Programmable workbench: Studio API.