Operations
DSP defines 16 typed operations for mutating scenes. Operations are sent in batches via the applyOps endpoint.
Node operations
createNode
Create a new node element.
{
"op": "createNode",
"id": "my-node",
"nodeType": "service",
"shape": "roundedRect",
"label": "API Gateway",
"layout": {
"mode": "absolute",
"x": 50, "y": 100,
"width": 180, "height": 70
}
}
Required: id, nodeType, shape
updateNode
Update properties of an existing node.
{
"op": "updateNode",
"targetId": "my-node",
"label": "Updated Label",
"shape": "ellipse"
}
deleteElement
Remove any element from the scene.
{ "op": "deleteElement", "targetId": "my-node" }
moveElement
Change an element’s position.
{ "op": "moveElement", "targetId": "my-node", "x": 200, "y": 300 }
resizeElement
Change an element’s dimensions.
{ "op": "resizeElement", "targetId": "my-node", "width": 250, "height": 100 }
Edge operations
createEdge
Create a connection between two nodes.
{
"op": "createEdge",
"id": "e1",
"from": { "elementId": "node-a" },
"to": { "elementId": "node-b" },
"label": "connects to",
"router": "straight"
}
Router options: straight, orthogonal, polyline
updateEdge
Update properties of an existing edge.
{
"op": "updateEdge",
"targetId": "e1",
"label": "new label",
"router": "orthogonal"
}
Style and text
setStyle
Apply a style token to an element.
{ "op": "setStyle", "targetId": "my-node", "styleId": "highlight" }
setText
Set the text content of an element.
{ "op": "setText", "targetId": "my-node", "text": "New Label" }
Grouping
groupElements
Group multiple elements together.
{
"op": "groupElements",
"id": "group-1",
"childIds": ["node-a", "node-b", "e1"]
}
ungroupElements
Dissolve a group, releasing its children.
{ "op": "ungroupElements", "targetId": "group-1" }
createFrame
Create a visual frame container.
{
"op": "createFrame",
"id": "frame-1",
"label": "Backend Services",
"childIds": ["api", "db"],
"layout": { "mode": "absolute", "x": 20, "y": 20, "width": 500, "height": 300 }
}
Constraints
addConstraint
Add a spatial constraint.
{
"op": "addConstraint",
"constraint": {
"type": "align",
"axis": "centerY",
"members": ["node-a", "node-b", "node-c"]
}
}
removeConstraint
Remove a constraint by index.
{ "op": "removeConstraint", "constraintIndex": 0 }
Layout
autoLayout
Trigger automatic layout computation.
{ "op": "autoLayout", "targetIds": ["node-a", "node-b", "node-c"] }
normalizeScene
Re-normalize the entire scene (recompute defaults, resolve layout).
{ "op": "normalizeScene" }
Operation envelope
Operations are sent in an envelope with metadata:
{
"schemaVersion": "0.1",
"sceneId": "my-scene",
"baseRevision": 1,
"transactionMode": "allOrNothing",
"ops": [ ... ]
}
Transaction modes:
allOrNothing(default) — If any operation fails validation, none are appliedbestEffort— Valid operations are applied, invalid ones are skipped