Skip to content

Commit b50da05

Browse files
committed
feat: add transform node input key examples
1 parent 3b1a18b commit b50da05

1 file changed

Lines changed: 79 additions & 0 deletions

File tree

docs/user-guide/workflows/configuration/specialized-nodes.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,71 @@ custom_nodes:
143143
| `on_error` | string | No | `fail` | Error strategy: `fail`, `skip`, `default`, `partial` |
144144
| `default_output` | object | No | `{}` | Default output when `on_error: default` |
145145

146+
#### Input Key Path Extraction
147+
148+
The `input_key` parameter controls how data is extracted from the context store and made available to your mappings.
149+
150+
All examples below use this context store:
151+
152+
```json
153+
{
154+
"name": "Alice",
155+
"age": 30,
156+
"city": "NYC",
157+
"user": {
158+
"name": "Bob",
159+
"age": 25
160+
},
161+
"api": {
162+
"response": {
163+
"data": {
164+
"items": [1, 2, 3],
165+
"total": 3
166+
}
167+
}
168+
},
169+
"stats": {
170+
"total": {
171+
"count": 42,
172+
"sum": 1050,
173+
"average": 25.0
174+
}
175+
},
176+
"users": [
177+
{"name": "Alice", "role": "admin"},
178+
{"name": "Bob", "role": "user"}
179+
]
180+
}
181+
```
182+
183+
##### Extraction Examples
184+
185+
| Input Key | Extracted Value | Available Variables |
186+
|-----------|-----------------|---------------------|
187+
| *(null/omitted)* | Entire context | `name`=`"Alice"`, `age`=`30`, `city`=`"NYC"`, `user`=`{...}`, `api`=`{...}`, `stats`=`{...}`, `users`=`[...]` |
188+
| `age` | `30` | `age` = `30` |
189+
| `user` | `{"name": "Bob", "age": 25}` | `name` = `"Bob"`, `age` = `25` |
190+
| `users` | `[{"name": "Alice", ...}, ...]` | `users` = `[{"name": "Alice", "role": "admin"}, {"name": "Bob", "role": "user"}]` |
191+
| `api.response.data` | `{"items": [1,2,3], "total": 3}` | `data` = `{"items": [1, 2, 3], "total": 3}` |
192+
| `api.response.data.total` | `3` | `total` = `3` |
193+
| `stats.total` | `{"count": 42, "sum": 1050, ...}` | `total` = `{"count": 42, "sum": 1050, "average": 25.0}` |
194+
| `users[0]` | `{"name": "Alice", "role": "admin"}` | `users` = `{"name": "Alice", "role": "admin"}` |
195+
| `users[-1]` | `{"name": "Bob", "role": "user"}` | `users` = `{"name": "Bob", "role": "user"}` |
196+
| `users[0:2]` | `[{"name": "Alice", ...}, ...]` | `users` = `[{"name": "Alice", "role": "admin"}, {"name": "Bob", "role": "user"}]` |
197+
| `users[0].name` | `"Alice"` | `name` = `"Alice"` |
198+
| `users[1].role` | `"user"` | `role` = `"user"` |
199+
| `api.response.data.items[0]` | `1` | `items` = `1` |
200+
201+
##### Behavior Rules
202+
203+
1. **No key** (`null` or omitted): Entire context store merged - all top-level keys become variables
204+
2. **Simple key** (no dots):
205+
- If value is **dict**: Contents unwrapped → dict keys become variables
206+
- If value is **not dict**: Value wrapped with key name
207+
3. **Nested key** (with dots): Value always wrapped with **last part** of the path
208+
4. **Array indexing** (`[n]`, `[-n]`, `[start:end]`): Element/slice wrapped with **array name** (part before `[`)
209+
5. **Chained indexing** (e.g., `users[0].name`): Continues path after index, wraps with **last part** of remaining path
210+
146211
#### Mapping Types
147212

148213
Transform Node supports six mapping types:
@@ -219,6 +284,20 @@ Execute Python expressions with restricted namespace.
219284
script: "urgency * 2 + importance"
220285
```
221286

287+
**Available Python Builtins:**
288+
289+
For security, scripts run in a restricted environment with only these Python builtins:
290+
291+
| Category | Available |
292+
|----------|-----------|
293+
| **Constants** | `True`, `False`, `None` |
294+
| **Type Constructors** | `str`, `int`, `float`, `bool` |
295+
| **Common Functions** | `len`, `min`, `max`, `sum`, `abs` |
296+
| **Collections** | `list`, `dict`, `set`, `tuple` |
297+
| **Utilities** | `any`, `all`, `isinstance` |
298+
299+
**Note:** Import statements, file I/O, and other Python builtins are not available for security reasons.
300+
222301
#### Sequential Processing
223302

224303
**Important:** Mappings are processed sequentially. Later mappings can reference fields created by earlier mappings.

0 commit comments

Comments
 (0)