@flowdrop/flowdrop 2.0.0-beta.5 → 2.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -2
- package/dist/commands/executor.js +46 -20
- package/dist/components/App.svelte +1 -10
- package/dist/components/ConfigForm.svelte +98 -529
- package/dist/components/ConfigForm.svelte.d.ts +4 -6
- package/dist/components/ConfigModal.svelte +0 -1
- package/dist/components/form/FormField.svelte +15 -0
- package/dist/components/form/FormFieldLight.svelte +14 -0
- package/dist/components/form/FormFieldset.svelte +44 -10
- package/dist/components/form/FormPorts.svelte +262 -0
- package/dist/components/form/FormPorts.svelte.d.ts +13 -0
- package/dist/components/form/FormRangeField.svelte +43 -3
- package/dist/components/nodes/AtomNode.svelte +13 -39
- package/dist/components/nodes/GatewayNode.svelte +20 -56
- package/dist/components/nodes/SimpleNode.svelte +23 -49
- package/dist/components/nodes/SquareNode.svelte +23 -49
- package/dist/components/nodes/TerminalNode.svelte +25 -31
- package/dist/components/nodes/WorkflowNode.svelte +37 -84
- package/dist/core/index.d.ts +1 -1
- package/dist/openapi/v1/openapi.yaml +33 -21
- package/dist/schemas/v1/workflow.schema.json +16 -14
- package/dist/services/dynamicSchemaService.d.ts +29 -2
- package/dist/services/dynamicSchemaService.js +54 -25
- package/dist/stores/workflowStore.svelte.d.ts +1 -1
- package/dist/stores/workflowStore.svelte.js +7 -2
- package/dist/types/index.d.ts +74 -20
- package/dist/types/uischema.d.ts +5 -0
- package/dist/utils/colors.d.ts +27 -0
- package/dist/utils/colors.js +23 -0
- package/dist/utils/portUtils.d.ts +47 -11
- package/dist/utils/portUtils.js +67 -14
- package/dist/utils/schemaMerge.d.ts +25 -0
- package/dist/utils/schemaMerge.js +61 -0
- package/package.json +1 -1
|
@@ -4,26 +4,27 @@
|
|
|
4
4
|
Uses SvelteFlow's Handle for connection ports
|
|
5
5
|
Styled with BEM syntax
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
-
|
|
7
|
+
Port rendering:
|
|
8
|
+
- Exposure (data.config.ports, falling back to each port's exposedByDefault)
|
|
9
|
+
decides which ports render — a not-exposed port is hidden.
|
|
10
|
+
- Order: data.config.ports order overrides the metadata default (displayOrder);
|
|
11
|
+
cosmetic only, no effect on execution.
|
|
11
12
|
-->
|
|
12
13
|
|
|
13
14
|
<script lang="ts">
|
|
14
15
|
import { Position, Handle } from '@xyflow/svelte';
|
|
15
|
-
import type { WorkflowNode,
|
|
16
|
+
import type { WorkflowNode, DynamicPort, PortsConfig } from '../../types/index.js';
|
|
16
17
|
import { dynamicPortToNodePort } from '../../types/index.js';
|
|
17
18
|
import Icon from '@iconify/svelte';
|
|
18
19
|
import { getNodeIcon } from '../../utils/icons.js';
|
|
19
20
|
import NodeConfigButton from './NodeConfigButton.svelte';
|
|
20
21
|
import {
|
|
21
|
-
getDataTypeColorToken,
|
|
22
22
|
getCategoryColorToken,
|
|
23
|
-
|
|
23
|
+
getPortColorToken,
|
|
24
|
+
getPortBackgroundColorForPort
|
|
24
25
|
} from '../../utils/colors.js';
|
|
25
26
|
import { getInstance } from '../../stores/getInstance.svelte.js';
|
|
26
|
-
import {
|
|
27
|
+
import { orderPortsFor, isPortVisible } from '../../utils/portUtils.js';
|
|
27
28
|
import { m } from '../../messages/index.js';
|
|
28
29
|
|
|
29
30
|
interface Props {
|
|
@@ -61,30 +62,11 @@
|
|
|
61
62
|
);
|
|
62
63
|
|
|
63
64
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
65
|
+
* Per-instance port order + exposure, in config. Order overrides the metadata
|
|
66
|
+
* default; exposure is semantic (a not-exposed port is hidden, not wireable,
|
|
67
|
+
* not runtime-overridable).
|
|
66
68
|
*/
|
|
67
|
-
const
|
|
68
|
-
props.data.extensions?.ui?.hideUnconnectedHandles ??
|
|
69
|
-
props.data.metadata?.extensions?.ui?.hideUnconnectedHandles ??
|
|
70
|
-
false
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Get the portOrder setting from extensions (visual-only, no effect on execution)
|
|
75
|
-
* Merges node type defaults with instance overrides
|
|
76
|
-
*/
|
|
77
|
-
const portOrder = $derived(
|
|
78
|
-
props.data.extensions?.ui?.portOrder ?? props.data.metadata?.extensions?.ui?.portOrder ?? {}
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Get the hiddenPorts setting from extensions (visual-only, no effect on execution)
|
|
83
|
-
* Merges node type defaults with instance overrides
|
|
84
|
-
*/
|
|
85
|
-
const hiddenPorts = $derived(
|
|
86
|
-
props.data.extensions?.ui?.hiddenPorts ?? props.data.metadata?.extensions?.ui?.hiddenPorts ?? {}
|
|
87
|
-
);
|
|
69
|
+
const portsConfig = $derived((props.data.config?.ports as PortsConfig | undefined) ?? {});
|
|
88
70
|
|
|
89
71
|
/**
|
|
90
72
|
* Dynamic inputs from config - user-defined input ports
|
|
@@ -108,61 +90,32 @@
|
|
|
108
90
|
|
|
109
91
|
/**
|
|
110
92
|
* Combined input ports: static metadata inputs + dynamic config inputs,
|
|
111
|
-
*
|
|
93
|
+
* in effective order (metadata default, then config override; cosmetic).
|
|
112
94
|
*/
|
|
113
95
|
const allInputPorts = $derived(
|
|
114
|
-
|
|
96
|
+
orderPortsFor([...props.data.metadata.inputs, ...dynamicInputs], portsConfig.inputs)
|
|
115
97
|
);
|
|
116
98
|
|
|
117
99
|
/**
|
|
118
100
|
* Combined output ports: static metadata outputs + dynamic config outputs,
|
|
119
|
-
*
|
|
101
|
+
* in effective order (metadata default, then config override; cosmetic).
|
|
120
102
|
*/
|
|
121
103
|
const allOutputPorts = $derived(
|
|
122
|
-
|
|
104
|
+
orderPortsFor([...props.data.metadata.outputs, ...dynamicOutputs], portsConfig.outputs)
|
|
123
105
|
);
|
|
124
106
|
|
|
125
107
|
/**
|
|
126
|
-
*
|
|
127
|
-
* @param port - The port to check
|
|
128
|
-
* @param type - Whether this is an 'input' or 'output' port
|
|
129
|
-
* @returns true if the port should be visible
|
|
108
|
+
* Derived list of exposed input ports (static + dynamic).
|
|
130
109
|
*/
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
type === 'input'
|
|
135
|
-
? hiddenPorts.inputs?.includes(port.id)
|
|
136
|
-
: hiddenPorts.outputs?.includes(port.id);
|
|
137
|
-
if (manuallyHidden) return false;
|
|
138
|
-
|
|
139
|
-
// Always show if hideUnconnectedHandles is disabled
|
|
140
|
-
if (!hideUnconnectedHandles) {
|
|
141
|
-
return true;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// Always show required ports
|
|
145
|
-
if (port.required) {
|
|
146
|
-
return true;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// Check if port is connected
|
|
150
|
-
const handleId = `${props.id}-${type}-${port.id}`;
|
|
151
|
-
return fd.workflow.connectedHandles.has(handleId);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Derived list of visible input ports based on hideUnconnectedHandles setting
|
|
156
|
-
* Now includes both static and dynamic inputs
|
|
157
|
-
*/
|
|
158
|
-
const visibleInputPorts = $derived(allInputPorts.filter((port) => isPortVisible(port, 'input')));
|
|
110
|
+
const visibleInputPorts = $derived(
|
|
111
|
+
allInputPorts.filter((port) => isPortVisible(port, 'input', portsConfig))
|
|
112
|
+
);
|
|
159
113
|
|
|
160
114
|
/**
|
|
161
|
-
* Derived list of
|
|
162
|
-
* Now includes both static and dynamic outputs
|
|
115
|
+
* Derived list of exposed output ports (static + dynamic).
|
|
163
116
|
*/
|
|
164
117
|
const visibleOutputPorts = $derived(
|
|
165
|
-
allOutputPorts.filter((port) => isPortVisible(port, 'output'))
|
|
118
|
+
allOutputPorts.filter((port) => isPortVisible(port, 'output', portsConfig))
|
|
166
119
|
);
|
|
167
120
|
|
|
168
121
|
/**
|
|
@@ -248,9 +201,9 @@
|
|
|
248
201
|
position={Position.Left}
|
|
249
202
|
id={`${props.id}-input-${port.id}`}
|
|
250
203
|
class="flowdrop-workflow-node__handle"
|
|
251
|
-
style="top: var(--fd-node-port-row-height); transform: translateY(-50%); --fd-handle-fill: var(--fd-port-skin-color, {
|
|
204
|
+
style="top: var(--fd-node-port-row-height); transform: translateY(-50%); --fd-handle-fill: var(--fd-port-skin-color, {getPortColorToken(
|
|
252
205
|
checker,
|
|
253
|
-
port
|
|
206
|
+
port
|
|
254
207
|
)}); --fd-handle-border-color: var(--fd-handle-border);"
|
|
255
208
|
tabindex={-1}
|
|
256
209
|
/>
|
|
@@ -261,14 +214,14 @@
|
|
|
261
214
|
<span class="flowdrop-text--xs flowdrop-font--medium">{port.name}</span>
|
|
262
215
|
<span
|
|
263
216
|
class="flowdrop-badge flowdrop-badge--sm"
|
|
264
|
-
style="background-color: {
|
|
217
|
+
style="background-color: {getPortBackgroundColorForPort(
|
|
265
218
|
checker,
|
|
266
|
-
port
|
|
219
|
+
port,
|
|
267
220
|
15
|
|
268
|
-
)}; color: {
|
|
221
|
+
)}; color: {getPortColorToken(
|
|
269
222
|
checker,
|
|
270
|
-
port
|
|
271
|
-
)}; border: 1px solid {
|
|
223
|
+
port
|
|
224
|
+
)}; border: 1px solid {getPortBackgroundColorForPort(checker, port, 30)};"
|
|
272
225
|
>
|
|
273
226
|
{port.dataType}
|
|
274
227
|
</span>
|
|
@@ -304,14 +257,14 @@
|
|
|
304
257
|
<span class="flowdrop-text--xs flowdrop-font--medium">{port.name}</span>
|
|
305
258
|
<span
|
|
306
259
|
class="flowdrop-badge flowdrop-badge--sm"
|
|
307
|
-
style="background-color: {
|
|
260
|
+
style="background-color: {getPortBackgroundColorForPort(
|
|
308
261
|
checker,
|
|
309
|
-
port
|
|
262
|
+
port,
|
|
310
263
|
15
|
|
311
|
-
)}; color: {
|
|
264
|
+
)}; color: {getPortColorToken(
|
|
312
265
|
checker,
|
|
313
|
-
port
|
|
314
|
-
)}; border: 1px solid {
|
|
266
|
+
port
|
|
267
|
+
)}; border: 1px solid {getPortBackgroundColorForPort(checker, port, 30)};"
|
|
315
268
|
>
|
|
316
269
|
{port.dataType}
|
|
317
270
|
</span>
|
|
@@ -329,9 +282,9 @@
|
|
|
329
282
|
position={Position.Right}
|
|
330
283
|
id={`${props.id}-output-${port.id}`}
|
|
331
284
|
class="flowdrop-workflow-node__handle"
|
|
332
|
-
style="top: var(--fd-node-port-row-height); transform: translateY(-50%); --fd-handle-fill: var(--fd-port-skin-color, {
|
|
285
|
+
style="top: var(--fd-node-port-row-height); transform: translateY(-50%); --fd-handle-fill: var(--fd-port-skin-color, {getPortColorToken(
|
|
333
286
|
checker,
|
|
334
|
-
port
|
|
287
|
+
port
|
|
335
288
|
)}); --fd-handle-border-color: var(--fd-handle-border);"
|
|
336
289
|
tabindex={-1}
|
|
337
290
|
/>
|
package/dist/core/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
export type { WorkflowFormat, BuiltinWorkflowFormat } from '../types/index.js';
|
|
18
18
|
export { DEFAULT_WORKFLOW_FORMAT } from '../types/index.js';
|
|
19
|
-
export type { NodeCategory, BuiltinNodeCategory, CategoryDefinition, NodeDataType, NodePort, DynamicPort, Branch, NodeMetadata, NodeExtensions, NodeUIExtensions, ConfigValues, WorkflowNode, WorkflowEdge, Workflow, ApiResponse, NodesResponse, WorkflowResponse, WorkflowsResponse, ExecutionStatus, ExecutionResult, FlowDropConfig, WorkflowEvents, BuiltinNodeType, PortConfig, PortCompatibilityRule, ConfigSchema, ConfigProperty, HttpMethod, DynamicSchemaEndpoint, ExternalEditLink, ConfigEditOptions, EdgeCategory, UISchemaElementType, UISchemaElementBase, UISchemaControl, UISchemaVerticalLayout, UISchemaGroup, UISchemaElement } from '../types/index.js';
|
|
19
|
+
export type { NodeCategory, BuiltinNodeCategory, CategoryDefinition, NodeDataType, NodePort, DynamicPort, Branch, NodeMetadata, NodeExtensions, NodeUIExtensions, PortsConfig, PortConfigEntry, ConfigValues, WorkflowNode, WorkflowEdge, Workflow, ApiResponse, NodesResponse, WorkflowResponse, WorkflowsResponse, ExecutionStatus, ExecutionResult, FlowDropConfig, WorkflowEvents, BuiltinNodeType, PortConfig, PortCompatibilityRule, ConfigSchema, ConfigProperty, HttpMethod, DynamicSchemaEndpoint, ExternalEditLink, ConfigEditOptions, EdgeCategory, UISchemaElementType, UISchemaElementBase, UISchemaControl, UISchemaVerticalLayout, UISchemaGroup, UISchemaElement } from '../types/index.js';
|
|
20
20
|
export { isUISchemaControl, isUISchemaVerticalLayout, isUISchemaGroup } from '../types/index.js';
|
|
21
21
|
export type { WorkflowEditorConfig, EditorFeatures, UIConfig, APIConfig, ExecutionConfig, StorageConfig } from '../types/config.js';
|
|
22
22
|
export type { AuthProvider, StaticAuthConfig, CallbackAuthConfig } from '../types/auth.js';
|
|
@@ -250,7 +250,7 @@ paths:
|
|
|
250
250
|
value:
|
|
251
251
|
success: true
|
|
252
252
|
data:
|
|
253
|
-
-
|
|
253
|
+
- node_type_id: openai_chat_executor
|
|
254
254
|
name: OpenAI Chat
|
|
255
255
|
description: Chat completion using OpenAI's GPT models
|
|
256
256
|
category: ai
|
|
@@ -563,7 +563,7 @@ paths:
|
|
|
563
563
|
config:
|
|
564
564
|
placeholder: Enter your question
|
|
565
565
|
metadata:
|
|
566
|
-
|
|
566
|
+
node_type_id: text_input
|
|
567
567
|
name: Text Input
|
|
568
568
|
description: Text input field for user data
|
|
569
569
|
category: inputs
|
|
@@ -2550,10 +2550,12 @@ components:
|
|
|
2550
2550
|
for user-defined input/output handles
|
|
2551
2551
|
- **gateway**: Supports `config.branches` for conditional branching paths
|
|
2552
2552
|
|
|
2553
|
-
##
|
|
2553
|
+
## Port order + exposure
|
|
2554
2554
|
|
|
2555
|
-
|
|
2556
|
-
|
|
2555
|
+
Render order and exposure are controlled per instance via `config.ports`
|
|
2556
|
+
(a per-direction ordered list of `{id, exposed?}`), over each port's metadata
|
|
2557
|
+
`displayOrder` / `exposedByDefault` defaults. Order is cosmetic; a not-exposed
|
|
2558
|
+
port is hidden, not wireable, and not runtime-overridable.
|
|
2557
2559
|
NodeExecutionStatus:
|
|
2558
2560
|
type: string
|
|
2559
2561
|
enum:
|
|
@@ -3213,6 +3215,26 @@ components:
|
|
|
3213
3215
|
example: Parsed JSON response from the HTTP request
|
|
3214
3216
|
defaultValue:
|
|
3215
3217
|
description: Default value used when no connection provides data
|
|
3218
|
+
exposedByDefault:
|
|
3219
|
+
type: boolean
|
|
3220
|
+
default: true
|
|
3221
|
+
description: |
|
|
3222
|
+
Whether the port is exposed when the instance sets no explicit exposure
|
|
3223
|
+
for it (in `data.config.ports`). Defaults to true — a missing override
|
|
3224
|
+
reads as exposed. Reserved ports that ship hidden until an author opts in
|
|
3225
|
+
(e.g. the `error` output) carry false. In v2 exposure is semantic: a
|
|
3226
|
+
not-exposed port is hidden on the canvas, not wireable, and not
|
|
3227
|
+
runtime-overridable.
|
|
3228
|
+
displayOrder:
|
|
3229
|
+
type: integer
|
|
3230
|
+
default: 0
|
|
3231
|
+
description: |
|
|
3232
|
+
Default sort weight for the port's render position, ascending; ties
|
|
3233
|
+
break on declaration order. Author-declared ports default to 0. Reserved
|
|
3234
|
+
ports (the `error` output and `trigger`/`tool` control ports) need no
|
|
3235
|
+
value — the renderer sinks them to the bottom automatically; set this
|
|
3236
|
+
only to override that. Cosmetic only. The instance's `config.ports`
|
|
3237
|
+
order overrides this when present.
|
|
3216
3238
|
schema:
|
|
3217
3239
|
$ref: '#/components/schemas/PortDataSchema'
|
|
3218
3240
|
description: |
|
|
@@ -3449,13 +3471,6 @@ components:
|
|
|
3449
3471
|
|
|
3450
3472
|
Instance-level settings take precedence over type-level defaults.
|
|
3451
3473
|
properties:
|
|
3452
|
-
hideUnconnectedHandles:
|
|
3453
|
-
type: boolean
|
|
3454
|
-
description: |
|
|
3455
|
-
Show/hide unconnected handles (ports) to reduce visual noise.
|
|
3456
|
-
When true, only ports with active connections are displayed.
|
|
3457
|
-
Useful for nodes with many optional ports.
|
|
3458
|
-
example: true
|
|
3459
3474
|
atom:
|
|
3460
3475
|
$ref: '#/components/schemas/AtomUIConfig'
|
|
3461
3476
|
style:
|
|
@@ -3492,7 +3507,6 @@ components:
|
|
|
3492
3507
|
additionalProperties: true
|
|
3493
3508
|
example:
|
|
3494
3509
|
ui:
|
|
3495
|
-
hideUnconnectedHandles: true
|
|
3496
3510
|
style:
|
|
3497
3511
|
opacity: 0.8
|
|
3498
3512
|
agentspec:component_type: llm_node
|
|
@@ -3514,10 +3528,11 @@ components:
|
|
|
3514
3528
|
## Extensions Support
|
|
3515
3529
|
|
|
3516
3530
|
The `extensions` property allows storing UI settings and 3rd party data:
|
|
3517
|
-
- Use `extensions.ui.
|
|
3531
|
+
- Use `extensions.ui.style` for custom per-node styling
|
|
3518
3532
|
- Use namespaced keys for custom integrations (e.g., "myapp:settings")
|
|
3533
|
+
(Port order + exposure live in `config.ports`, not here.)
|
|
3519
3534
|
properties:
|
|
3520
|
-
|
|
3535
|
+
node_type_id:
|
|
3521
3536
|
type: string
|
|
3522
3537
|
description: Node type unique identifier
|
|
3523
3538
|
example: calculator
|
|
@@ -3607,7 +3622,7 @@ components:
|
|
|
3607
3622
|
Default extension properties for all instances of this node type.
|
|
3608
3623
|
Can be overridden at the instance level via WorkflowNode.data.extensions.
|
|
3609
3624
|
required:
|
|
3610
|
-
-
|
|
3625
|
+
- node_type_id
|
|
3611
3626
|
- name
|
|
3612
3627
|
- description
|
|
3613
3628
|
- category
|
|
@@ -3801,7 +3816,7 @@ components:
|
|
|
3801
3816
|
description: Node instance UUID
|
|
3802
3817
|
type:
|
|
3803
3818
|
type: string
|
|
3804
|
-
description: Node type ID (references NodeMetadata.
|
|
3819
|
+
description: Node type ID (references NodeMetadata.node_type_id)
|
|
3805
3820
|
example: calculator
|
|
3806
3821
|
position:
|
|
3807
3822
|
$ref: '#/components/schemas/Position'
|
|
@@ -3825,9 +3840,6 @@ components:
|
|
|
3825
3840
|
error:
|
|
3826
3841
|
type: string
|
|
3827
3842
|
description: Error message if node execution failed
|
|
3828
|
-
nodeId:
|
|
3829
|
-
type: string
|
|
3830
|
-
description: Alternative node ID
|
|
3831
3843
|
executionInfo:
|
|
3832
3844
|
$ref: '#/components/schemas/NodeExecutionInfo'
|
|
3833
3845
|
extensions:
|
|
@@ -3838,8 +3850,8 @@ components:
|
|
|
3838
3850
|
Use for instance-specific UI states or custom data.
|
|
3839
3851
|
|
|
3840
3852
|
Common use cases:
|
|
3841
|
-
- `extensions.ui.hideUnconnectedHandles`: Hide ports without connections
|
|
3842
3853
|
- `extensions.ui.style`: Custom styling for this node instance
|
|
3854
|
+
(Port order + exposure live in `config.ports`, not here.)
|
|
3843
3855
|
required:
|
|
3844
3856
|
- label
|
|
3845
3857
|
- config
|
|
@@ -560,9 +560,9 @@
|
|
|
560
560
|
},
|
|
561
561
|
"NodeMetadata": {
|
|
562
562
|
"type": "object",
|
|
563
|
-
"description": "Complete metadata for a node type including ports, configuration schema, and extensions.\n\n## Dynamic Port Support\n\nNodes can support user-defined dynamic ports through their configSchema:\n- Add `dynamicInputs` array property to allow custom input handles\n- Add `dynamicOutputs` array property to allow custom output handles\n- Add `branches` array property for gateway nodes with conditional paths\n\n## Extensions Support\n\nThe `extensions` property allows storing UI settings and 3rd party data:\n- Use `extensions.ui.
|
|
563
|
+
"description": "Complete metadata for a node type including ports, configuration schema, and extensions.\n\n## Dynamic Port Support\n\nNodes can support user-defined dynamic ports through their configSchema:\n- Add `dynamicInputs` array property to allow custom input handles\n- Add `dynamicOutputs` array property to allow custom output handles\n- Add `branches` array property for gateway nodes with conditional paths\n\n## Extensions Support\n\nThe `extensions` property allows storing UI settings and 3rd party data:\n- Use `extensions.ui.style` for custom per-node styling\n- Use namespaced keys for custom integrations (e.g., \"myapp:settings\")\n(Port order + exposure live in `config.ports`, not here.)\n",
|
|
564
564
|
"properties": {
|
|
565
|
-
"
|
|
565
|
+
"node_type_id": {
|
|
566
566
|
"type": "string",
|
|
567
567
|
"description": "Node type unique identifier"
|
|
568
568
|
},
|
|
@@ -650,7 +650,7 @@
|
|
|
650
650
|
}
|
|
651
651
|
},
|
|
652
652
|
"required": [
|
|
653
|
-
"
|
|
653
|
+
"node_type_id",
|
|
654
654
|
"name",
|
|
655
655
|
"description",
|
|
656
656
|
"category",
|
|
@@ -695,6 +695,16 @@
|
|
|
695
695
|
"defaultValue": {
|
|
696
696
|
"description": "Default value used when no connection provides data"
|
|
697
697
|
},
|
|
698
|
+
"exposedByDefault": {
|
|
699
|
+
"type": "boolean",
|
|
700
|
+
"default": true,
|
|
701
|
+
"description": "Whether the port is exposed when the instance sets no explicit exposure\nfor it (in `data.config.ports`). Defaults to true — a missing override\nreads as exposed. Reserved ports that ship hidden until an author opts in\n(e.g. the `error` output) carry false. In v2 exposure is semantic: a\nnot-exposed port is hidden on the canvas, not wireable, and not\nruntime-overridable.\n"
|
|
702
|
+
},
|
|
703
|
+
"displayOrder": {
|
|
704
|
+
"type": "integer",
|
|
705
|
+
"default": 0,
|
|
706
|
+
"description": "Default sort weight for the port's render position, ascending; ties\nbreak on declaration order. Author-declared ports default to 0. Reserved\nports (the `error` output and `trigger`/`tool` control ports) need no\nvalue — the renderer sinks them to the bottom automatically; set this\nonly to override that. Cosmetic only. The instance's `config.ports`\norder overrides this when present.\n"
|
|
707
|
+
},
|
|
698
708
|
"schema": {
|
|
699
709
|
"allOf": [
|
|
700
710
|
{
|
|
@@ -726,16 +736,12 @@
|
|
|
726
736
|
"idea",
|
|
727
737
|
"default"
|
|
728
738
|
],
|
|
729
|
-
"description": "Visual rendering type for the node.\n\nBuilt-in types:\n- `note` - Sticky note with markdown support\n- `simple` - Compact layout with header and description\n- `square` - Minimal square node with centered icon\n- `atom` - Minimal label-only pill/rectangle for value/transform nodes (uses extensions.ui.atom)\n- `tool` - Specialized node for agent tools\n- `gateway` - Branching control flow with dynamic branches (uses config.branches)\n- `terminal` - Circular node for workflow start/end/exit points\n- `idea` - Conceptual idea node for BPMN-like flow diagrams\n- `default` - Full-featured workflow node with dynamic port support\n\n## Dynamic Port Support\n\nThe `default` and `gateway` node types support dynamic ports:\n\n- **default**: Supports `config.dynamicInputs` and `config.dynamicOutputs`\n for user-defined input/output handles\n- **gateway**: Supports `config.branches` for conditional branching paths\n\n##
|
|
739
|
+
"description": "Visual rendering type for the node.\n\nBuilt-in types:\n- `note` - Sticky note with markdown support\n- `simple` - Compact layout with header and description\n- `square` - Minimal square node with centered icon\n- `atom` - Minimal label-only pill/rectangle for value/transform nodes (uses extensions.ui.atom)\n- `tool` - Specialized node for agent tools\n- `gateway` - Branching control flow with dynamic branches (uses config.branches)\n- `terminal` - Circular node for workflow start/end/exit points\n- `idea` - Conceptual idea node for BPMN-like flow diagrams\n- `default` - Full-featured workflow node with dynamic port support\n\n## Dynamic Port Support\n\nThe `default` and `gateway` node types support dynamic ports:\n\n- **default**: Supports `config.dynamicInputs` and `config.dynamicOutputs`\n for user-defined input/output handles\n- **gateway**: Supports `config.branches` for conditional branching paths\n\n## Port order + exposure\n\nRender order and exposure are controlled per instance via `config.ports`\n(a per-direction ordered list of `{id, exposed?}`), over each port's metadata\n`displayOrder` / `exposedByDefault` defaults. Order is cosmetic; a not-exposed\nport is hidden, not wireable, and not runtime-overridable.\n"
|
|
730
740
|
},
|
|
731
741
|
"NodeUIExtensions": {
|
|
732
742
|
"type": "object",
|
|
733
743
|
"description": "UI-related extension settings for nodes.\nUsed to control visual behavior in the workflow editor.\n\nThese settings can be defined at two levels:\n1. **Node Type Level** (`metadata.extensions.ui`): Default settings for all instances\n2. **Instance Level** (`data.extensions.ui`): Override for specific node instances\n\nInstance-level settings take precedence over type-level defaults.\n",
|
|
734
744
|
"properties": {
|
|
735
|
-
"hideUnconnectedHandles": {
|
|
736
|
-
"type": "boolean",
|
|
737
|
-
"description": "Show/hide unconnected handles (ports) to reduce visual noise.\nWhen true, only ports with active connections are displayed.\nUseful for nodes with many optional ports.\n"
|
|
738
|
-
},
|
|
739
745
|
"atom": {
|
|
740
746
|
"$ref": "#/$defs/AtomUIConfig"
|
|
741
747
|
},
|
|
@@ -1109,7 +1115,7 @@
|
|
|
1109
1115
|
},
|
|
1110
1116
|
"type": {
|
|
1111
1117
|
"type": "string",
|
|
1112
|
-
"description": "Node type ID (references NodeMetadata.
|
|
1118
|
+
"description": "Node type ID (references NodeMetadata.node_type_id)"
|
|
1113
1119
|
},
|
|
1114
1120
|
"position": {
|
|
1115
1121
|
"$ref": "#/$defs/Position"
|
|
@@ -1139,10 +1145,6 @@
|
|
|
1139
1145
|
"type": "string",
|
|
1140
1146
|
"description": "Error message if node execution failed"
|
|
1141
1147
|
},
|
|
1142
|
-
"nodeId": {
|
|
1143
|
-
"type": "string",
|
|
1144
|
-
"description": "Alternative node ID"
|
|
1145
|
-
},
|
|
1146
1148
|
"executionInfo": {
|
|
1147
1149
|
"$ref": "#/$defs/NodeExecutionInfo"
|
|
1148
1150
|
},
|
|
@@ -1152,7 +1154,7 @@
|
|
|
1152
1154
|
"$ref": "#/$defs/NodeExtensions"
|
|
1153
1155
|
},
|
|
1154
1156
|
{
|
|
1155
|
-
"description": "Per-instance extension properties for 3rd party integrations.\nOverrides or extends the node type extensions defined in metadata.extensions.\nUse for instance-specific UI states or custom data.\n\nCommon use cases:\n- `extensions.ui.
|
|
1157
|
+
"description": "Per-instance extension properties for 3rd party integrations.\nOverrides or extends the node type extensions defined in metadata.extensions.\nUse for instance-specific UI states or custom data.\n\nCommon use cases:\n- `extensions.ui.style`: Custom styling for this node instance\n(Port order + exposure live in `config.ports`, not here.)\n"
|
|
1156
1158
|
}
|
|
1157
1159
|
]
|
|
1158
1160
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @module services/dynamicSchemaService
|
|
7
7
|
*/
|
|
8
|
-
import type { ConfigSchema, DynamicSchemaEndpoint, ExternalEditLink, ConfigEditOptions, WorkflowNode } from '../types/index.js';
|
|
8
|
+
import type { ConfigSchema, DynamicSchemaEndpoint, ExternalEditLink, ConfigEditOptions, UISchemaElement, WorkflowNode } from '../types/index.js';
|
|
9
9
|
import type { EndpointConfig } from '../config/endpoints.js';
|
|
10
10
|
/**
|
|
11
11
|
* Result of a dynamic schema fetch operation
|
|
@@ -15,11 +15,33 @@ export interface DynamicSchemaResult {
|
|
|
15
15
|
success: boolean;
|
|
16
16
|
/** The fetched config schema (if successful) */
|
|
17
17
|
schema?: ConfigSchema;
|
|
18
|
+
/**
|
|
19
|
+
* The fetched uiSchema, when the endpoint returns one alongside the schema.
|
|
20
|
+
* Lets a server-hydrated response carry its own field grouping/layout so the
|
|
21
|
+
* form isn't stuck with the node's static-metadata uiSchema (which only
|
|
22
|
+
* references the static schema's properties).
|
|
23
|
+
*/
|
|
24
|
+
uiSchema?: UISchemaElement;
|
|
18
25
|
/** Error message (if failed) */
|
|
19
26
|
error?: string;
|
|
20
27
|
/** Whether the schema was loaded from cache */
|
|
21
28
|
fromCache?: boolean;
|
|
22
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Resolves the fetch key for a node's dynamic-schema endpoint: the endpoint URL
|
|
32
|
+
* with all template variables substituted from the node context.
|
|
33
|
+
*
|
|
34
|
+
* The key changes whenever a config value the endpoint's `parameterMapping`
|
|
35
|
+
* references changes (e.g. a trigger node's `event_type`). Callers watch it to
|
|
36
|
+
* refetch the schema when the inputs that shape it change, keeping the rendered
|
|
37
|
+
* form in step with the current configuration.
|
|
38
|
+
*
|
|
39
|
+
* @param endpoint - The dynamic schema endpoint configuration
|
|
40
|
+
* @param node - The workflow node instance
|
|
41
|
+
* @param workflowId - Optional workflow ID for context
|
|
42
|
+
* @returns The resolved endpoint URL, used as a reactive refetch key
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveDynamicSchemaKey(endpoint: DynamicSchemaEndpoint, node: WorkflowNode, workflowId?: string): string;
|
|
23
45
|
/**
|
|
24
46
|
* Fetches a dynamic configuration schema from a REST endpoint.
|
|
25
47
|
*
|
|
@@ -82,10 +104,15 @@ export declare function clearSchemaCache(pattern?: string): void;
|
|
|
82
104
|
/**
|
|
83
105
|
* Invalidates a specific schema cache entry for a node.
|
|
84
106
|
*
|
|
107
|
+
* The workflow ID must match the value passed when the schema was fetched:
|
|
108
|
+
* endpoints whose URL references `{workflowId}` resolve to a different cache key
|
|
109
|
+
* without it, so omitting it here would miss the entry the fetch created.
|
|
110
|
+
*
|
|
85
111
|
* @param node - The workflow node to invalidate cache for
|
|
86
112
|
* @param endpoint - The dynamic schema endpoint configuration
|
|
113
|
+
* @param workflowId - Optional workflow ID, matching the fetch context
|
|
87
114
|
*/
|
|
88
|
-
export declare function invalidateSchemaCache(node: WorkflowNode, endpoint: DynamicSchemaEndpoint): void;
|
|
115
|
+
export declare function invalidateSchemaCache(node: WorkflowNode, endpoint: DynamicSchemaEndpoint, workflowId?: string): void;
|
|
89
116
|
/**
|
|
90
117
|
* Checks if a node has config edit options configured.
|
|
91
118
|
*
|
|
@@ -104,6 +104,44 @@ function generateCacheKey(endpoint, context) {
|
|
|
104
104
|
const url = resolveTemplate(endpoint.url, endpoint.parameterMapping, context);
|
|
105
105
|
return `schema:${url}`;
|
|
106
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Builds the template-resolution context for a node.
|
|
109
|
+
*
|
|
110
|
+
* Shared by every function that resolves a dynamic-schema URL, external-edit
|
|
111
|
+
* URL, or cache key, so they all read identical values — and therefore compute
|
|
112
|
+
* matching keys — from a single place.
|
|
113
|
+
*
|
|
114
|
+
* @param node - The workflow node instance
|
|
115
|
+
* @param workflowId - Optional workflow ID for context
|
|
116
|
+
* @returns The node context used for template resolution
|
|
117
|
+
*/
|
|
118
|
+
function buildNodeContext(node, workflowId) {
|
|
119
|
+
return {
|
|
120
|
+
id: node.id,
|
|
121
|
+
type: node.type,
|
|
122
|
+
metadata: node.data.metadata,
|
|
123
|
+
config: node.data.config,
|
|
124
|
+
extensions: node.data.extensions,
|
|
125
|
+
workflowId
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Resolves the fetch key for a node's dynamic-schema endpoint: the endpoint URL
|
|
130
|
+
* with all template variables substituted from the node context.
|
|
131
|
+
*
|
|
132
|
+
* The key changes whenever a config value the endpoint's `parameterMapping`
|
|
133
|
+
* references changes (e.g. a trigger node's `event_type`). Callers watch it to
|
|
134
|
+
* refetch the schema when the inputs that shape it change, keeping the rendered
|
|
135
|
+
* form in step with the current configuration.
|
|
136
|
+
*
|
|
137
|
+
* @param endpoint - The dynamic schema endpoint configuration
|
|
138
|
+
* @param node - The workflow node instance
|
|
139
|
+
* @param workflowId - Optional workflow ID for context
|
|
140
|
+
* @returns The resolved endpoint URL, used as a reactive refetch key
|
|
141
|
+
*/
|
|
142
|
+
export function resolveDynamicSchemaKey(endpoint, node, workflowId) {
|
|
143
|
+
return resolveTemplate(endpoint.url, endpoint.parameterMapping, buildNodeContext(node, workflowId));
|
|
144
|
+
}
|
|
107
145
|
/**
|
|
108
146
|
* Checks if a cached schema is still valid (not expired).
|
|
109
147
|
*
|
|
@@ -138,14 +176,7 @@ function isCacheValid(entry, ttl = DEFAULT_CACHE_TTL) {
|
|
|
138
176
|
*/
|
|
139
177
|
export async function fetchDynamicSchema(endpointConfig, endpoint, node, workflowId) {
|
|
140
178
|
// Build the context from the node
|
|
141
|
-
const context =
|
|
142
|
-
id: node.id,
|
|
143
|
-
type: node.type,
|
|
144
|
-
metadata: node.data.metadata,
|
|
145
|
-
config: node.data.config,
|
|
146
|
-
extensions: node.data.extensions,
|
|
147
|
-
workflowId
|
|
148
|
-
};
|
|
179
|
+
const context = buildNodeContext(node, workflowId);
|
|
149
180
|
// Generate cache key
|
|
150
181
|
const cacheKey = generateCacheKey(endpoint, context);
|
|
151
182
|
// Check cache first (if caching is enabled)
|
|
@@ -155,6 +186,7 @@ export async function fetchDynamicSchema(endpointConfig, endpoint, node, workflo
|
|
|
155
186
|
return {
|
|
156
187
|
success: true,
|
|
157
188
|
schema: cached.schema,
|
|
189
|
+
uiSchema: cached.uiSchema,
|
|
158
190
|
fromCache: true
|
|
159
191
|
};
|
|
160
192
|
}
|
|
@@ -232,10 +264,15 @@ export async function fetchDynamicSchema(endpointConfig, endpoint, node, workflo
|
|
|
232
264
|
error: 'Invalid schema format received from endpoint'
|
|
233
265
|
};
|
|
234
266
|
}
|
|
267
|
+
// A companion uiSchema may ride alongside the schema (server-hydrated
|
|
268
|
+
// forms). Look for it next to wherever the schema was found — sibling of
|
|
269
|
+
// the envelope, or nested in the same `data`/`schema` wrapper.
|
|
270
|
+
const uiSchema = (data.uiSchema ?? data.data?.uiSchema ?? data.schema?.uiSchema);
|
|
235
271
|
// Cache the schema (if caching is enabled)
|
|
236
272
|
if (endpoint.cacheSchema !== false) {
|
|
237
273
|
schemaCache.set(cacheKey, {
|
|
238
274
|
schema,
|
|
275
|
+
uiSchema,
|
|
239
276
|
cachedAt: Date.now(),
|
|
240
277
|
cacheKey
|
|
241
278
|
});
|
|
@@ -243,6 +280,7 @@ export async function fetchDynamicSchema(endpointConfig, endpoint, node, workflo
|
|
|
243
280
|
return {
|
|
244
281
|
success: true,
|
|
245
282
|
schema,
|
|
283
|
+
uiSchema,
|
|
246
284
|
fromCache: false
|
|
247
285
|
};
|
|
248
286
|
}
|
|
@@ -288,14 +326,7 @@ export async function fetchDynamicSchema(endpointConfig, endpoint, node, workflo
|
|
|
288
326
|
*/
|
|
289
327
|
export function resolveExternalEditUrl(link, node, workflowId, callbackUrl) {
|
|
290
328
|
// Build the context from the node
|
|
291
|
-
const context =
|
|
292
|
-
id: node.id,
|
|
293
|
-
type: node.type,
|
|
294
|
-
metadata: node.data.metadata,
|
|
295
|
-
config: node.data.config,
|
|
296
|
-
extensions: node.data.extensions,
|
|
297
|
-
workflowId
|
|
298
|
-
};
|
|
329
|
+
const context = buildNodeContext(node, workflowId);
|
|
299
330
|
// Resolve the URL with template variables
|
|
300
331
|
let url = resolveTemplate(link.url, link.parameterMapping, context);
|
|
301
332
|
// Append callback URL if configured
|
|
@@ -367,18 +398,16 @@ export function clearSchemaCache(pattern) {
|
|
|
367
398
|
/**
|
|
368
399
|
* Invalidates a specific schema cache entry for a node.
|
|
369
400
|
*
|
|
401
|
+
* The workflow ID must match the value passed when the schema was fetched:
|
|
402
|
+
* endpoints whose URL references `{workflowId}` resolve to a different cache key
|
|
403
|
+
* without it, so omitting it here would miss the entry the fetch created.
|
|
404
|
+
*
|
|
370
405
|
* @param node - The workflow node to invalidate cache for
|
|
371
406
|
* @param endpoint - The dynamic schema endpoint configuration
|
|
407
|
+
* @param workflowId - Optional workflow ID, matching the fetch context
|
|
372
408
|
*/
|
|
373
|
-
export function invalidateSchemaCache(node, endpoint) {
|
|
374
|
-
const
|
|
375
|
-
id: node.id,
|
|
376
|
-
type: node.type,
|
|
377
|
-
metadata: node.data.metadata,
|
|
378
|
-
config: node.data.config,
|
|
379
|
-
extensions: node.data.extensions
|
|
380
|
-
};
|
|
381
|
-
const cacheKey = generateCacheKey(endpoint, context);
|
|
409
|
+
export function invalidateSchemaCache(node, endpoint, workflowId) {
|
|
410
|
+
const cacheKey = generateCacheKey(endpoint, buildNodeContext(node, workflowId));
|
|
382
411
|
schemaCache.delete(cacheKey);
|
|
383
412
|
}
|
|
384
413
|
/**
|
|
@@ -129,7 +129,7 @@ export declare class WorkflowStore {
|
|
|
129
129
|
/**
|
|
130
130
|
* Set of all handle IDs currently connected to edges.
|
|
131
131
|
*
|
|
132
|
-
*
|
|
132
|
+
* Handle IDs are formatted `{nodeId}-{direction}-{portId}`.
|
|
133
133
|
*/
|
|
134
134
|
get connectedHandles(): Set<string>;
|
|
135
135
|
/**
|