How-to

Write a transform

1. Create a workspace

Open Studio → new workspace. Pick a language pack that matches the team. JavaScript is the default. The pack can change later; sirius.* does not.

2. Assign result

The inbound payload is msg. A pass-through:

result = { message: sirius.json.decode(msg.raw) };

If you see mapping script produced no result, you forgot this assignment.

3. Run on a sample

Paste a payload into the Run panel, or import a sample and make it active. You get output, logs as annotations, and any simulated connector calls.

Keep Live I/O off while you are shaping the mapping. Outbound HTTP and database calls are recorded, not delivered.

4. Use the host API

Start typing sirius. — autocomplete is the catalog. Typical first calls:

const body = sirius.json.decode(msg.raw);
body.site = sirius.table.lookup("sites", body.site_id, "UNKNOWN");
body.processed_at = sirius.datetime.format(sirius.now(), "%Y-%m-%dT%H:%M:%S");
sirius.log.info("mapped " + body.site);
result = { message: body };

Field-level helpers exist for HL7, FHIR, X12, and other standards when msg.parsed is populated. The complete catalog is the Host API — every sirius.* symbol the editor offers.

5. Turn samples into tests

Capture the current output as a golden expectation. Add a few more samples (happy path, missing field, oversized payload). Run Test. Comparison is JSON-normalized and works across language packs.

6. Promote a milestone

When the suite is green, promote a milestone with tests required. That snapshot is what you restore if the next edit goes wrong. Export the workspace bundle when you move from a laptop to a shared environment.

From the API

The same loop is POST /studio/workspaces, PUT …/files, PUT …/samples, POST …/run, POST …/test, POST …/milestones. See the Studio API.