@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
package/CHANGELOG.md
CHANGED
|
@@ -7,14 +7,51 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.0.0-beta.7] - 2026-07-09
|
|
11
|
+
|
|
12
|
+
Seventh 2.0 beta, published under the npm `beta` dist-tag (`npm install @flowdrop/flowdrop@beta`). `latest` remains 1.15.0 until 2.0.0 GA. Dynamic config schemas become composable and self-refreshing. A dynamic-schema endpoint can now **layer onto** a node's static schema instead of replacing the whole form — merging in the fields it owns, or targeting a single region — so an endpoint only returns what it actually drives and the rest of the form stays exactly as authored. The fetched form also **refetches on its own** when a config value its URL depends on changes (e.g. picking a different trigger `event_type`), rather than loading only once on mount. All additive: the historical whole-form `replace` behaviour is still the default, so existing dynamic-schema configs are unchanged.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- **Dynamic config schema can layer onto the static schema (`mergeStrategy` + `target`).** `DynamicSchemaEndpoint` gains two optional fields. `mergeStrategy: 'replace' | 'merge'` — `merge` combines the fetched schema with the node's static schema (`schema` prop / `metadata.configSchema`): properties are merged (fetched wins per key), `required` is unioned, so an endpoint only has to return the fields it drives. `target` — a dot-path of property keys (e.g. `"advanced"` or `"advanced.retry"`) that restricts the fetch to one region of the form, splicing the fetched schema in at that location and leaving every other field static; `mergeStrategy` then decides replace-vs-merge at that node. Both default to whole-form `replace`, matching prior behaviour. When `merge`/`target` is configured, the schema is now fetched even if a static schema is present (previously a static schema suppressed the fetch). New `applyFetchedSchema` util backs the combination.
|
|
17
|
+
- **Dynamic schema auto-refetches when its inputs change.** `ConfigForm` now watches the resolved endpoint URL — template variables substituted from the node context — as a reactive key and refetches whenever it changes, so choosing a different value that the endpoint depends on (e.g. a trigger's `event_type`) reloads the matching schema instead of showing the schema captured at mount. A fetch already in flight is left to settle before the next one runs, and the key only reflects what the URL actually references, so static endpoints never spuriously refetch. New `resolveDynamicSchemaKey` export.
|
|
18
|
+
- **Dynamic schema endpoints can return a companion `uiSchema`.** When the endpoint response includes a `uiSchema` (read from `uiSchema`, `data.uiSchema`, or `schema.uiSchema`), `ConfigForm` uses it to lay out the fetched schema and caches it alongside the schema. It takes precedence over the node's static-metadata `uiSchema` — which can only reference the static schema's fields and would mislay a server-hydrated form — while a directly-passed `uiSchema` prop still wins. `DynamicSchemaResult` and the cache entry gain an optional `uiSchema`.
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- **Config values are no longer silently dropped on save.** `ConfigForm` rebuilt the saved config solely from the active schema's properties, so any stored config key the schema didn't render — for example after a dynamic schema returned a narrower field set — was lost on the next blur/save. The commit paths (`onChange` on blur, and explicit save) now preserve config keys the active schema doesn't own, with the rendered fields still taking precedence.
|
|
23
|
+
- **`invalidateSchemaCache` now matches the fetch cache key.** It built the node context without the `workflowId`, so for endpoints whose URL references `{workflowId}` it resolved a different cache key than `fetchDynamicSchema` and failed to evict the entry — a manual schema refresh then re-served the stale cached schema. It now accepts `workflowId` (matching the fetch context); the context-building for schema-URL, external-edit-URL, and cache-key resolution was consolidated so they can no longer drift apart.
|
|
24
|
+
|
|
25
|
+
## [2.0.0-beta.6] - 2026-06-22
|
|
26
|
+
|
|
27
|
+
Sixth 2.0 beta, published under the npm `beta` dist-tag (`npm install @flowdrop/flowdrop@beta`). `latest` remains 1.15.0 until 2.0.0 GA. This release unifies port **order** and **exposure** into a single per-instance `data.config.ports` value and makes exposure semantic — "what you see is what runs": a not-exposed port is hidden on the canvas, not wireable, and not runtime-overridable. The two older, separate mechanisms (`extensions.ui.portOrder` for order and `hideUnconnectedHandles` for visibility) are removed. A single combined "Ports" widget in the config panel now handles both reorder and expose/hide per port, and reserved ports (the `error` output and `trigger`/`tool` control ports) sort to the bottom automatically.
|
|
28
|
+
|
|
29
|
+
### Breaking Changes
|
|
30
|
+
|
|
31
|
+
- **Port order + exposure unified into `data.config.ports`.** Order and exposure are now one per-direction ordered list of `{ id, exposed? }` entries (`PortsConfig`): array position encodes display order, and the optional `exposed` flag overrides the port's metadata `exposedByDefault` — stored only when it diverges. An untouched node persists no `ports` key. This replaces `extensions.ui.portOrder` (removed) and the interim `exposedPorts` map. Consumers that read or write either must migrate to `config.ports`; the OpenAPI/JSON schema (`PortsConfig`, `PortConfigEntry`, `NodePort.displayOrder`) was updated to match.
|
|
32
|
+
- **`hideUnconnectedHandles` removed end-to-end.** Visibility is no longer derived from connection state. A port renders iff it is exposed (`config.ports` override, else metadata `exposedByDefault`, which defaults to exposed). Dropped from `NodeUIExtensions`, every node renderer, the config form, fixtures, and the schema; `hiddenPorts` retired with it.
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
- **Combined `FormPorts` widget.** A single "Ports" group in the config panel renders one row per port with reorder (up/down) and an expose/hide toggle, replacing the separate Port Order panel and the interim exposed-ports widget. Edits write the minimal `config.ports` value and collapse back to `undefined` on the default order with no exposure override.
|
|
37
|
+
- **`NodePort.displayOrder` + automatic reserved-port ordering.** A cosmetic default sort weight (ascending; ties on declaration order). Reserved ports — the `error` output and `trigger`/`tool` control ports — sink to the bottom of their direction automatically via `RESERVED_PORT_DISPLAY_ORDER`, with no value required from authors; an explicit `displayOrder` overrides. New `byDefaultOrder`, `orderPortsFor`, `isPortExposed`, and `isReservedPort` utilities.
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
|
|
41
|
+
- **OpenAPI `NodeMetadata` aligned with the `node_type_id` rename.** Follow-up to beta.5: the spec's `NodeMetadata` now references `node_type_id` consistently (the bundled spec shipped in the package was regenerated).
|
|
42
|
+
|
|
43
|
+
### Docs
|
|
44
|
+
|
|
45
|
+
- **`maxRetries` added to the reserved config-property table.**
|
|
46
|
+
|
|
10
47
|
## [2.0.0-beta.5] - 2026-06-20
|
|
11
48
|
|
|
12
49
|
Fifth 2.0 beta, published under the npm `beta` dist-tag (`npm install @flowdrop/flowdrop@beta`). `latest` remains 1.15.0 until 2.0.0 GA. This release is a node-identity cleanup: node components now derive their instance id from the canonical `id` prop SvelteFlow already passes, dropping the duplicate `data.nodeId` copy and its load-time healing, and the node-_type_ entity id is renamed `metadata.id` → `metadata.node_type_id` to disambiguate it from the instance id. Six node components were also moved off the type-erasing `$props<T>()` onto a typed `interface Props`, which surfaced and fixed latent config-access errors in `ToolNode`.
|
|
13
50
|
|
|
14
51
|
### Breaking Changes
|
|
15
52
|
|
|
16
|
-
- **Node-type entity id renamed `metadata.id` → `metadata.node_type_id`.** The node-type entity id collided conceptually with the node _instance_ id; it is now `metadata.node_type_id` to disambiguate the two. It is a server-owned wire field, so the library preserves the snake_case name as a non-opinionated passthrough — adapters, the command type-map, connection validation, and the dynamic-schema paths were all updated to match. Consumers reading `metadata.id` for the node type must read `metadata.node_type_id`.
|
|
17
|
-
- **Dropped the duplicate `data.nodeId` field.** Node components now derive their id from the canonical `id` prop that SvelteFlow already passes to every node, instead of a copy stored in `data.nodeId`. Handle ids, config-open callbacks, and status overlays read `id` directly. The field and its load-time "healing" are gone, so an intact graph can no longer look corrupted from a missing copy.
|
|
53
|
+
- **Node-type entity id renamed `metadata.id` → `metadata.node_type_id`.** The node-type entity id collided conceptually with the node _instance_ id; it is now `metadata.node_type_id` to disambiguate the two. It is a server-owned wire field, so the library preserves the snake_case name as a non-opinionated passthrough — adapters, the command type-map, connection validation, and the dynamic-schema paths were all updated to match. Consumers reading `metadata.id` for the node type must read `metadata.node_type_id`. **Backend impact:** the `GET /nodes` response and `metadata` blocks in persisted workflows must now use `node_type_id`; the OpenAPI spec (`NodeMetadata`) and the bundled spec shipped in the package were updated accordingly.
|
|
54
|
+
- **Dropped the duplicate `data.nodeId` field.** Node components now derive their id from the canonical `id` prop that SvelteFlow already passes to every node, instead of a copy stored in `data.nodeId`. Handle ids, config-open callbacks, and status overlays read `id` directly. The field and its load-time "healing" are gone, so an intact graph can no longer look corrupted from a missing copy. `WorkflowNode.data.nodeId` was also removed from the OpenAPI spec.
|
|
18
55
|
|
|
19
56
|
### Changed (internal — no API change)
|
|
20
57
|
|
|
@@ -378,38 +378,49 @@ function executeInfo(command, context) {
|
|
|
378
378
|
*/
|
|
379
379
|
function findPort(node, portId, preferDirection) {
|
|
380
380
|
const metadata = node.data?.metadata;
|
|
381
|
-
|
|
381
|
+
const config = node.data?.config;
|
|
382
|
+
if (!metadata && !config)
|
|
382
383
|
return null;
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
if (
|
|
389
|
-
return
|
|
390
|
-
|
|
391
|
-
|
|
384
|
+
// Resolve an output port from static metadata or config-driven ports. The
|
|
385
|
+
// latter are not in metadata.outputs: gateway branches live in config.branches
|
|
386
|
+
// and user-defined handles live in config.dynamicOutputs (both keyed by name).
|
|
387
|
+
const resolveOutput = () => {
|
|
388
|
+
const meta = metadata?.outputs?.find((p) => p.id === portId);
|
|
389
|
+
if (meta)
|
|
390
|
+
return meta;
|
|
391
|
+
const branch = config?.branches?.find((b) => b.name === portId);
|
|
392
|
+
if (branch)
|
|
393
|
+
return { id: portId, name: branch.label ?? portId, dataType: 'trigger' };
|
|
394
|
+
const dynamic = config?.dynamicOutputs?.find((p) => p.name === portId);
|
|
395
|
+
if (dynamic)
|
|
396
|
+
return { id: portId, name: dynamic.label ?? portId, dataType: dynamic.dataType };
|
|
397
|
+
return null;
|
|
398
|
+
};
|
|
399
|
+
// Resolve an input port from static metadata or config.dynamicInputs.
|
|
400
|
+
const resolveInput = () => {
|
|
401
|
+
const meta = metadata?.inputs?.find((p) => p.id === portId);
|
|
402
|
+
if (meta)
|
|
403
|
+
return meta;
|
|
404
|
+
const dynamic = config?.dynamicInputs?.find((p) => p.name === portId);
|
|
405
|
+
if (dynamic)
|
|
406
|
+
return { id: portId, name: dynamic.label ?? portId, dataType: dynamic.dataType };
|
|
407
|
+
return null;
|
|
408
|
+
};
|
|
409
|
+
const outputPort = resolveOutput();
|
|
410
|
+
const inputPort = resolveInput();
|
|
411
|
+
if (preferDirection === 'input') {
|
|
392
412
|
if (inputPort)
|
|
393
413
|
return { port: inputPort, direction: 'input' };
|
|
394
414
|
if (outputPort)
|
|
395
415
|
return { port: outputPort, direction: 'output' };
|
|
396
416
|
}
|
|
397
417
|
else {
|
|
418
|
+
// Default and explicit 'output' both prefer the output port first.
|
|
398
419
|
if (outputPort)
|
|
399
420
|
return { port: outputPort, direction: 'output' };
|
|
400
421
|
if (inputPort)
|
|
401
422
|
return { port: inputPort, direction: 'input' };
|
|
402
423
|
}
|
|
403
|
-
// Gateway nodes have dynamic branch ports stored in config.branches, not metadata.outputs
|
|
404
|
-
if (metadata.type === 'gateway') {
|
|
405
|
-
const branches = node.data.config?.branches;
|
|
406
|
-
if (branches?.some((b) => b.name === portId)) {
|
|
407
|
-
return {
|
|
408
|
-
port: { id: portId, name: portId, dataType: 'trigger' },
|
|
409
|
-
direction: 'output'
|
|
410
|
-
};
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
424
|
return null;
|
|
414
425
|
}
|
|
415
426
|
function executeConnect(command, context) {
|
|
@@ -483,6 +494,21 @@ function executeConnect(command, context) {
|
|
|
483
494
|
const targetHandle = buildHandleId(targetNode.id, 'input', command.targetPort);
|
|
484
495
|
// Generate edge ID
|
|
485
496
|
const edgeId = `${sourceNode.id}-${sourceHandle}-${targetNode.id}-${targetHandle}`;
|
|
497
|
+
// Idempotency guard: re-applying the same connection (e.g. a second
|
|
498
|
+
// AI-assistant Apply that re-emits an existing edge) must not append a
|
|
499
|
+
// duplicate. Two edges sharing an id crash the canvas with Svelte's
|
|
500
|
+
// `each_key_duplicate`. Treat an existing identical connection as a no-op.
|
|
501
|
+
const alreadyConnected = workflow.edges.some((e) => e.id === edgeId ||
|
|
502
|
+
(e.source === sourceNode.id &&
|
|
503
|
+
e.target === targetNode.id &&
|
|
504
|
+
e.sourceHandle === sourceHandle &&
|
|
505
|
+
e.targetHandle === targetHandle));
|
|
506
|
+
if (alreadyConnected) {
|
|
507
|
+
return {
|
|
508
|
+
ok: true,
|
|
509
|
+
message: `Already connected ${toShortId(sourceNode.id)}:${command.sourcePort} → ${toShortId(targetNode.id)}:${command.targetPort}`
|
|
510
|
+
};
|
|
511
|
+
}
|
|
486
512
|
// Build edge
|
|
487
513
|
const edge = {
|
|
488
514
|
id: edgeId,
|
|
@@ -1069,7 +1069,6 @@
|
|
|
1069
1069
|
{authProvider}
|
|
1070
1070
|
schema={workflowConfigSchema}
|
|
1071
1071
|
values={workflowConfigValues}
|
|
1072
|
-
showUIExtensions={false}
|
|
1073
1072
|
onChange={(config) => {
|
|
1074
1073
|
// Sync workflow settings changes immediately on field blur
|
|
1075
1074
|
const wf = fd.workflow.current;
|
|
@@ -1132,7 +1131,7 @@
|
|
|
1132
1131
|
workflowId={fd.workflow.current?.id}
|
|
1133
1132
|
workflowNodes={fd.workflow.current?.nodes}
|
|
1134
1133
|
workflowEdges={fd.workflow.current?.edges}
|
|
1135
|
-
onChange={async (updatedConfig
|
|
1134
|
+
onChange={async (updatedConfig) => {
|
|
1136
1135
|
// Sync config changes to workflow immediately on field blur
|
|
1137
1136
|
if (selectedNodeId && currentNode) {
|
|
1138
1137
|
// Build the updated node data
|
|
@@ -1141,14 +1140,6 @@
|
|
|
1141
1140
|
config: updatedConfig
|
|
1142
1141
|
};
|
|
1143
1142
|
|
|
1144
|
-
// Include UI extensions if provided
|
|
1145
|
-
if (uiExtensions) {
|
|
1146
|
-
updatedData.extensions = {
|
|
1147
|
-
...currentNode.data.extensions,
|
|
1148
|
-
ui: uiExtensions
|
|
1149
|
-
};
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
1143
|
// Update the node in the workflow store
|
|
1153
1144
|
const nodeUpdates: Record<string, unknown> = {
|
|
1154
1145
|
data: updatedData
|