shareTransforms
Adds transforms applied when a macro is shared, scoped by an appliesTo pattern.
Details #
A share transform rewrites a macro just before it leaves your hands. Typical jobs are removing personal paths, blanking account names, or dropping history. Your code gets the macro, returns the cleaned copy, and that copy is what is shared.
Declare it in switchboard.json under adds.shareTransforms. Every entry has an id (lowercase, digits and . _ -, up to 64 characters, starting with a letter), a title (1 to 80 characters) and an optional description. Ids must be unique within the list.
{
"adds": {
"shareTransforms": [
{ "id": "strip-paths", "title": "Strip personal paths", "appliesTo": "*" }
]
}
}
Gotchas #
A call that takes more than 10 seconds without answering fails.
A transform only sees the macro. It cannot see the files or secrets a step points at.
Walk the whole macro, not just
do: personal details can sit in triggers and conditions too.The manifest checks the entry's shape; the handler does the work. Without a matching handler the extension doesn't load.
Unknown keys in an entry are refused.
The sample below can be downloaded from the Full example section and edited into your own.
Where it runs #
The engine runs a transform with POST /extensions/<extension id>/share/<transform id> and the body {"macro": {...}}.
The handler #
The handler gets { macro }: the macro as JSON, with its do steps, when triggers and onlyIf conditions. It returns { macro } (or the macro itself). Build a new object instead of editing the one you were given. Your code must keep the macro valid: do not remove id, name or do.