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:
| Page | What it covers | Symbols |
|---|---|---|
| Core | Text, JSON, dates, crypto, codecs, XML, logging, env | 74 |
| Standards | HL7, FHIR, X12, EDIFACT, ISO 20022, FIX, and other interchange formats | 79 |
| I/O and runtime | HTTP, databases, files, routing, store, tables, metrics, AI | 51 |
| Devices and protocols | MQTT, CoAP, OPC UA, BACnet, SIP, SMPP | 44 |
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
| Pack | Form | Example |
|---|---|---|
| JavaScript, TypeScript, Lua, Python | sirius.family.member(...) | sirius.log.info("ok") |
| Tcl | sirius::family::member | sirius::log::info "ok" |
| Go | Flat helpers | sirius.LogInfo("ok") / sirius.Query(...) |
| Java, Rust, C, C++, WASM | Language-idiomatic flat names | Guest 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
| Family | Members | Use it for |
|---|---|---|
sirius.text | 13 | Pad, split, regex, case, templates |
sirius.json | 4 | Decode, encode, merge, dotted path |
sirius.codec | 14 | Base64, hex, gzip, zlib, bzip2, URL, HTML, uuencode |
sirius.crypto | 13 | Digest, HMAC, AES, RSA, PBKDF2, constant-time compare |
sirius.datetime | 6 | Parse, format, add, diff, HL7 stamps |
sirius.date / now / clock / time | 7 | Wall clock and strftime helpers |
sirius.log | 4 | debug, info, warn, error |
sirius.env | 2 | Tenant environment variables |
sirius.uuid / hash / util | 4 | IDs and short hashes |
sirius.xml | 4 | Build, parse, XPath, navigable tree |
sirius.validate | 2 | HL7 well-formedness, JSON-schema subset |
Standards — full list
| Family | Members | Use it for |
|---|---|---|
sirius.hl7 | 9 | Get/set/parse/serialize/ACK/tree/schema |
sirius.fhir | 4 | Path, bundle, reference, profile validate |
sirius.x12 | 8 | Get/set/parse/serialize/ACK/validate/tree/schema |
sirius.edifact | 6 | Get/set/parse/serialize/CONTRL/validate |
sirius.edi | 1 | Infer a draft implementation guide from samples |
sirius.iso20022 | 5 | Pain/pacs XML get/set/parse/serialize/validate |
sirius.swift.mt | 5 | FIN blocks and fields |
sirius.fix | 5 | Tag path, checksum, MsgType allowlist |
sirius.fpml | 5 | Trade XML |
sirius.ncpdp | 5 | SCRIPT XML and Telecom D.0 |
sirius.gs1 | 3 | GTIN/GLN/SSCC check digit and AIs |
sirius.rosettanet | 6 | RNIF MIME parts and PIP ack |
sirius.as2 | 5 | MDN, MIC, disposition options |
sirius.dicom | 3 | Part-10 detect, routing UIDs, transfer syntax |
sirius.ack | 4 | Detect, classify, build, assert any standard ACK |
sirius.batch | 2 | Split and wrap HL7/X12 envelopes |
sirius.terminology | 3 | Expand, translate, validate codes |
I/O and runtime — full list
| Family | Members | Use it for |
|---|---|---|
sirius.http | 8 | GET through TRACE via a destination connector |
sirius.db | 3 | Bound query / exec / ping on a connector id |
sirius.file | 2 | Read/write through a File connector |
sirius.net | 5 | FTP, FTPS, SFTP, SMTP, raw TCP |
sirius.smtp | 1 | Mail via an SMTP destination |
sirius.route / emit / output / done / reject | 7 | Downstream, fan-out, reply, drop |
sirius.store / table | 7 | Scoped KV and code-set lookup |
sirius.component / message | 5 | Current component and message ids |
sirius.idempotency / dedupe | 3 | Exactly-once helpers |
sirius.trace / metric | 5 | Spans, events, counters, gauges |
sirius.ai | 3 | Governed classify / complete / extract |
sirius.schema / spec | 2 | Parse against a message schema |
Devices — full list
| Family | Members | Use it for |
|---|---|---|
sirius.mqtt | 7 | Topic filters, QoS, user properties |
sirius.coap | 7 | Datagram parse/build, codes, options |
sirius.opcua | 6 | NodeId, Variant, StatusCode, samples |
sirius.bacnet | 7 | Object id, priority array, COV, properties |
sirius.sip | 7 | Request/response, headers, URI |
sirius.smpp | 10 | PDU, 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.