@flowdrop/flowdrop 1.15.0 → 2.0.0-beta.10
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 +648 -0
- package/MIGRATION-2.0.md +642 -0
- package/README.md +28 -28
- package/dist/adapters/WorkflowAdapter.d.ts +1 -1
- package/dist/adapters/WorkflowAdapter.js +18 -13
- package/dist/adapters/agentspec/AgentSpecAdapter.js +10 -10
- package/dist/adapters/agentspec/defaultNodeTypes.js +9 -9
- package/dist/api/enhanced-client.js +6 -11
- package/dist/chat/batchFeedback.d.ts +39 -0
- package/dist/chat/batchFeedback.js +51 -0
- package/dist/commands/executor.js +66 -27
- package/dist/commands/storeIntegration.svelte.d.ts +4 -1
- package/dist/commands/storeIntegration.svelte.js +36 -21
- package/dist/commands/types.d.ts +2 -0
- package/dist/commands/types.js +5 -5
- package/dist/components/App.svelte +696 -565
- package/dist/components/App.svelte.d.ts +63 -16
- package/dist/components/Button.stories.svelte +65 -0
- package/dist/components/Button.stories.svelte.d.ts +19 -0
- package/dist/components/Button.svelte +62 -0
- package/dist/components/Button.svelte.d.ts +24 -0
- package/dist/components/CanvasIconButton.svelte +76 -0
- package/dist/components/CanvasIconButton.svelte.d.ts +18 -0
- package/dist/components/ConfigForm.svelte +181 -552
- package/dist/components/ConfigForm.svelte.d.ts +24 -7
- package/dist/components/ConfigModal.svelte +16 -3
- package/dist/components/ConfigPanel.svelte +234 -15
- package/dist/components/ConfigPanel.svelte.d.ts +6 -0
- package/dist/components/ConnectionLine.svelte +4 -2
- package/dist/components/EditorStatusBar.stories.svelte +44 -0
- package/dist/components/EditorStatusBar.stories.svelte.d.ts +27 -0
- package/dist/components/EditorStatusBar.svelte +99 -0
- package/dist/components/EditorStatusBar.svelte.d.ts +15 -0
- package/dist/components/IconButton.svelte +80 -0
- package/dist/components/IconButton.svelte.d.ts +30 -0
- package/dist/components/Input.svelte +74 -0
- package/dist/components/Input.svelte.d.ts +17 -0
- package/dist/components/LogoWordmark.svelte +113 -0
- package/dist/components/LogoWordmark.svelte.d.ts +26 -0
- package/dist/components/Navbar.svelte +78 -64
- package/dist/components/Navbar.svelte.d.ts +3 -0
- package/dist/components/NodeSidebar.svelte +48 -171
- package/dist/components/NodeStatusOverlay.svelte +94 -6
- package/dist/components/NodeSwapPicker.svelte +22 -38
- package/dist/components/PipelineStatus.svelte +22 -68
- package/dist/components/PipelineStatus.svelte.d.ts +3 -0
- package/dist/components/PortCoordinateTracker.svelte +5 -6
- package/dist/components/PortMappingRow.svelte +0 -2
- package/dist/components/SchemaForm.stories.svelte +1 -3
- package/dist/components/SchemaForm.svelte +22 -39
- package/dist/components/SchemaForm.svelte.d.ts +0 -8
- package/dist/components/Select.svelte +53 -0
- package/dist/components/Select.svelte.d.ts +15 -0
- package/dist/components/SettingsModal.svelte +8 -8
- package/dist/components/SettingsPanel.svelte +44 -10
- package/dist/components/SwapMappingEditor.svelte +67 -49
- package/dist/components/SwapMappingEditor.svelte.d.ts +0 -2
- package/dist/components/Textarea.svelte +39 -0
- package/dist/components/Textarea.svelte.d.ts +12 -0
- package/dist/components/ThemeToggle.svelte +15 -94
- package/dist/components/UniversalNode.svelte +45 -11
- package/dist/components/UniversalNode.svelte.d.ts +1 -1
- package/dist/components/WorkflowEditor.svelte +183 -162
- package/dist/components/WorkflowEditor.svelte.d.ts +39 -10
- package/dist/components/chat/AIChatPanel.svelte +99 -90
- package/dist/components/chat/AIChatPanel.svelte.d.ts +0 -4
- package/dist/components/chat/CommandPreview.svelte +2 -1
- package/dist/components/console/CommandConsole.svelte +7 -5
- package/dist/components/console/ConsoleAutocomplete.svelte +11 -12
- package/dist/components/console/ConsoleAutocomplete.svelte.d.ts +6 -0
- package/dist/components/console/ConsoleInput.svelte +18 -9
- package/dist/components/console/ConsoleOutput.svelte +4 -3
- package/dist/components/form/FormArray.svelte +42 -182
- package/dist/components/form/FormArray.svelte.d.ts +2 -1
- package/dist/components/form/FormAutocomplete.svelte +26 -21
- package/dist/components/form/FormCheckboxGroup.svelte +1 -5
- package/dist/components/form/FormCodeEditor.svelte +9 -7
- package/dist/components/form/FormField.svelte +22 -44
- package/dist/components/form/FormFieldLight.svelte +56 -50
- package/dist/components/form/FormFieldLight.svelte.d.ts +12 -0
- package/dist/components/form/FormFieldset.svelte +45 -11
- package/dist/components/form/FormMarkdownEditor.svelte +17 -9
- package/dist/components/form/FormNumberField.svelte +4 -36
- package/dist/components/form/FormPorts.svelte +262 -0
- package/dist/components/form/FormPorts.svelte.d.ts +13 -0
- package/dist/components/form/FormRangeField.svelte +62 -30
- package/dist/components/form/FormSelect.svelte +13 -75
- package/dist/components/form/FormTemplateEditor.svelte +17 -7
- package/dist/components/form/FormTextField.svelte +3 -35
- package/dist/components/form/FormTextarea.svelte +4 -39
- package/dist/components/form/FormToggle.svelte +5 -16
- package/dist/components/form/FormToggle.svelte.d.ts +4 -2
- package/dist/components/form/FormUISchemaRenderer.svelte +3 -1
- package/dist/components/form/resolveFieldType.d.ts +24 -0
- package/dist/components/form/resolveFieldType.js +55 -0
- package/dist/components/form/templateAutocomplete.js +1 -5
- package/dist/components/form/types.d.ts +1 -14
- package/dist/components/icons/CloseIcon.svelte +6 -0
- package/dist/components/icons/CloseIcon.svelte.d.ts +26 -0
- package/dist/components/icons/CommandLineIcon.svelte +15 -0
- package/dist/components/icons/CommandLineIcon.svelte.d.ts +26 -0
- package/dist/components/icons/MenuIcon.svelte +4 -0
- package/dist/components/icons/MenuIcon.svelte.d.ts +26 -0
- package/dist/components/icons/MenuOpenIcon.svelte +6 -0
- package/dist/components/icons/MenuOpenIcon.svelte.d.ts +26 -0
- package/dist/components/interrupt/ChoicePrompt.svelte +0 -10
- package/dist/components/interrupt/ConfirmationPrompt.svelte +0 -5
- package/dist/components/interrupt/FormPrompt.svelte +3 -2
- package/dist/components/interrupt/InterruptBubble.svelte +25 -27
- package/dist/components/interrupt/ReviewPrompt.svelte +10 -23
- package/dist/components/interrupt/TextInputPrompt.svelte +2 -7
- package/dist/components/layouts/MainLayout.svelte +24 -18
- package/dist/components/layouts/MainLayout.svelte.d.ts +4 -0
- package/dist/components/nodes/AtomNode.svelte +70 -72
- package/dist/components/nodes/AtomNode.svelte.d.ts +1 -1
- package/dist/components/nodes/GatewayNode.svelte +134 -172
- package/dist/components/nodes/GatewayNode.svelte.d.ts +1 -1
- package/dist/components/nodes/IdeaNode.svelte +79 -98
- package/dist/components/nodes/IdeaNode.svelte.d.ts +8 -4
- package/dist/components/nodes/NodeConfigButton.svelte +86 -0
- package/dist/components/nodes/NodeConfigButton.svelte.d.ts +15 -0
- package/dist/components/nodes/NotesNode.svelte +76 -85
- package/dist/components/nodes/NotesNode.svelte.d.ts +8 -4
- package/dist/components/nodes/SimpleNode.svelte +68 -137
- package/dist/components/nodes/SimpleNode.svelte.d.ts +4 -4
- package/dist/components/nodes/SquareNode.svelte +122 -169
- package/dist/components/nodes/SquareNode.svelte.d.ts +4 -4
- package/dist/components/nodes/TerminalNode.svelte +70 -127
- package/dist/components/nodes/TerminalNode.svelte.d.ts +4 -4
- package/dist/components/nodes/ToolNode.svelte +99 -104
- package/dist/components/nodes/ToolNode.svelte.d.ts +6 -6
- package/dist/components/nodes/WorkflowNode.svelte +145 -195
- package/dist/components/nodes/WorkflowNode.svelte.d.ts +1 -1
- package/dist/components/playground/ChatInput.svelte +11 -15
- package/dist/components/playground/ChatPanel.svelte +6 -49
- package/dist/components/playground/ChatPanel.svelte.d.ts +0 -14
- package/dist/components/playground/ControlPanel.svelte +134 -123
- package/dist/components/playground/ControlPanel.svelte.d.ts +3 -0
- package/dist/components/playground/ExecutionLogs.svelte +11 -9
- package/dist/components/playground/InputCollector.svelte +22 -57
- package/dist/components/playground/MessageStream.svelte +17 -23
- package/dist/components/playground/PipelineKanbanView.svelte +69 -8
- package/dist/components/playground/PipelineKanbanView.svelte.d.ts +2 -0
- package/dist/components/playground/PipelinePanel.svelte +31 -8
- package/dist/components/playground/PipelinePanel.svelte.d.ts +2 -0
- package/dist/components/playground/PipelineTableView.svelte +188 -44
- package/dist/components/playground/PipelineTableView.svelte.d.ts +2 -0
- package/dist/components/playground/Playground.svelte +154 -105
- package/dist/components/playground/Playground.svelte.d.ts +5 -0
- package/dist/components/playground/PlaygroundApp.svelte +12 -2
- package/dist/components/playground/PlaygroundApp.svelte.d.ts +6 -0
- package/dist/components/playground/PlaygroundModal.svelte +18 -3
- package/dist/components/playground/PlaygroundModal.svelte.d.ts +6 -0
- package/dist/components/playground/PlaygroundStudio.svelte +40 -37
- package/dist/components/playground/PlaygroundStudio.svelte.d.ts +6 -0
- package/dist/components/playground/SessionManager.svelte +9 -12
- package/dist/components/playground/pipelineViewUtils.svelte.d.ts +30 -1
- package/dist/components/playground/pipelineViewUtils.svelte.js +40 -3
- package/dist/components/surfaces/SurfaceOverlay.svelte +153 -0
- package/dist/components/surfaces/SurfaceOverlay.svelte.d.ts +14 -0
- package/dist/components/surfaces/TabbedSurface.svelte +133 -0
- package/dist/components/surfaces/TabbedSurface.svelte.d.ts +27 -0
- package/dist/config/endpoints.d.ts +23 -7
- package/dist/config/endpoints.js +30 -10
- package/dist/core/index.d.ts +6 -7
- package/dist/core/index.js +8 -12
- package/dist/display/index.d.ts +6 -3
- package/dist/display/index.js +7 -5
- package/dist/editor/index.d.ts +20 -21
- package/dist/editor/index.js +26 -36
- package/dist/form/code.d.ts +25 -15
- package/dist/form/code.js +44 -41
- package/dist/form/fieldRegistry.d.ts +17 -13
- package/dist/form/fieldRegistry.js +32 -12
- package/dist/form/full.d.ts +19 -14
- package/dist/form/full.js +26 -28
- package/dist/form/index.d.ts +3 -4
- package/dist/form/index.js +6 -5
- package/dist/form/markdown.d.ts +13 -8
- package/dist/form/markdown.js +22 -23
- package/dist/helpers/proximityConnect.d.ts +3 -2
- package/dist/helpers/proximityConnect.js +2 -5
- package/dist/helpers/workflowEditorHelper.d.ts +14 -5
- package/dist/helpers/workflowEditorHelper.js +32 -30
- package/dist/index.d.ts +28 -24
- package/dist/index.js +27 -50
- package/dist/messages/defaults.d.ts +2 -5
- package/dist/messages/defaults.js +3 -6
- package/dist/messages/index.d.ts +1 -2
- package/dist/messages/index.js +1 -2
- package/dist/mocks/app-forms.d.ts +6 -2
- package/dist/mocks/app-forms.js +11 -4
- package/dist/openapi/v1/openapi.yaml +38 -26
- package/dist/playground/index.d.ts +4 -5
- package/dist/playground/index.js +4 -32
- package/dist/playground/mount.d.ts +34 -5
- package/dist/playground/mount.js +58 -24
- package/dist/registry/{BaseRegistry.d.ts → BaseRegistry.svelte.d.ts} +22 -1
- package/dist/registry/{BaseRegistry.js → BaseRegistry.svelte.js} +37 -1
- package/dist/registry/builtinFormats.d.ts +9 -18
- package/dist/registry/builtinFormats.js +9 -39
- package/dist/registry/builtinNodeTypes.d.ts +53 -0
- package/dist/registry/builtinNodeTypes.js +67 -0
- package/dist/registry/builtinNodes.d.ts +2 -64
- package/dist/registry/builtinNodes.js +7 -103
- package/dist/registry/index.d.ts +3 -4
- package/dist/registry/index.js +4 -6
- package/dist/registry/nodeComponentRegistry.d.ts +184 -16
- package/dist/registry/nodeComponentRegistry.js +235 -17
- package/dist/registry/workflowFormatRegistry.d.ts +14 -9
- package/dist/registry/workflowFormatRegistry.js +24 -8
- package/dist/{schema → schemas}/index.d.ts +2 -2
- package/dist/{schema → schemas}/index.js +2 -2
- package/dist/schemas/v1/workflow.schema.json +19 -17
- package/dist/services/agentSpecExecutionService.d.ts +0 -2
- package/dist/services/agentSpecExecutionService.js +0 -3
- package/dist/services/apiVariableService.d.ts +2 -1
- package/dist/services/apiVariableService.js +16 -47
- package/dist/services/autoSaveService.d.ts +7 -0
- package/dist/services/autoSaveService.js +6 -4
- package/dist/services/categoriesApi.js +3 -6
- package/dist/services/chatService.d.ts +9 -4
- package/dist/services/chatService.js +23 -28
- package/dist/services/draftStorage.d.ts +129 -13
- package/dist/services/draftStorage.js +185 -37
- package/dist/services/dynamicSchemaService.d.ts +33 -5
- package/dist/services/dynamicSchemaService.js +67 -55
- package/dist/services/globalSave.d.ts +13 -12
- package/dist/services/globalSave.js +29 -51
- package/dist/services/historyService.d.ts +39 -11
- package/dist/services/historyService.js +60 -18
- package/dist/services/interruptService.d.ts +15 -9
- package/dist/services/interruptService.js +35 -37
- package/dist/services/nodeExecutionService.d.ts +18 -3
- package/dist/services/nodeExecutionService.js +71 -45
- package/dist/services/playgroundService.d.ts +16 -10
- package/dist/services/playgroundService.js +42 -43
- package/dist/services/portConfigApi.js +3 -6
- package/dist/services/settingsService.d.ts +9 -4
- package/dist/services/settingsService.js +23 -12
- package/dist/services/variableService.d.ts +2 -1
- package/dist/services/variableService.js +2 -2
- package/dist/services/workflowStorage.js +6 -6
- package/dist/skins/drafter.d.ts +30 -0
- package/dist/skins/drafter.js +198 -0
- package/dist/skins/index.d.ts +2 -1
- package/dist/skins/index.js +4 -2
- package/dist/stores/apiContext.d.ts +56 -0
- package/dist/stores/apiContext.js +80 -0
- package/dist/stores/categoriesStore.svelte.d.ts +28 -23
- package/dist/stores/categoriesStore.svelte.js +69 -64
- package/dist/stores/getInstance.svelte.d.ts +39 -0
- package/dist/stores/getInstance.svelte.js +65 -0
- package/dist/stores/historyStore.svelte.d.ts +89 -91
- package/dist/stores/historyStore.svelte.js +159 -158
- package/dist/stores/instanceContainer.svelte.d.ts +111 -0
- package/dist/stores/instanceContainer.svelte.js +119 -0
- package/dist/stores/interruptStore.svelte.d.ts +112 -82
- package/dist/stores/interruptStore.svelte.js +253 -226
- package/dist/stores/pipelinePanelStore.svelte.d.ts +27 -3
- package/dist/stores/pipelinePanelStore.svelte.js +61 -14
- package/dist/stores/playgroundStore.svelte.d.ts +169 -222
- package/dist/stores/playgroundStore.svelte.js +513 -580
- package/dist/stores/portCoordinateStore.svelte.d.ts +57 -51
- package/dist/stores/portCoordinateStore.svelte.js +109 -98
- package/dist/stores/settingsStore.svelte.d.ts +17 -1
- package/dist/stores/settingsStore.svelte.js +79 -12
- package/dist/stores/workflowStore.svelte.d.ts +212 -210
- package/dist/stores/workflowStore.svelte.js +527 -502
- package/dist/stories/EdgeDecorator.svelte +5 -2
- package/dist/stories/NodeDecorator.svelte +5 -3
- package/dist/styles/base.css +285 -14
- package/dist/styles/tokens.css +60 -2
- package/dist/svelte-app.d.ts +78 -11
- package/dist/svelte-app.js +210 -141
- package/dist/themes/drafter.d.ts +2 -0
- package/dist/themes/drafter.js +15 -0
- package/dist/themes/index.d.ts +2 -1
- package/dist/themes/index.js +8 -2
- package/dist/types/auth.d.ts +9 -51
- package/dist/types/auth.js +4 -54
- package/dist/types/events.d.ts +24 -3
- package/dist/types/events.js +2 -1
- package/dist/types/index.d.ts +117 -32
- package/dist/types/index.js +0 -1
- package/dist/types/navbar.d.ts +7 -0
- package/dist/types/playground.d.ts +18 -3
- package/dist/types/settings.d.ts +30 -1
- package/dist/types/settings.js +5 -2
- package/dist/types/skin.d.ts +1 -1
- package/dist/types/theme.d.ts +16 -2
- package/dist/types/uischema.d.ts +5 -0
- package/dist/utils/colors.d.ts +74 -21
- package/dist/utils/colors.js +92 -68
- package/dist/utils/connections.d.ts +9 -15
- package/dist/utils/connections.js +33 -88
- package/dist/utils/duration.d.ts +13 -0
- package/dist/utils/duration.js +45 -0
- package/dist/utils/edgeStyling.js +9 -5
- package/dist/utils/fetchWithAuth.d.ts +36 -15
- package/dist/utils/fetchWithAuth.js +53 -23
- package/dist/utils/icons.d.ts +5 -2
- package/dist/utils/icons.js +6 -5
- package/dist/utils/nodeIds.d.ts +1 -1
- package/dist/utils/nodeIds.js +1 -1
- package/dist/utils/nodeSwap.d.ts +6 -2
- package/dist/utils/nodeSwap.js +62 -129
- package/dist/utils/nodeTypes.d.ts +17 -8
- package/dist/utils/nodeTypes.js +27 -20
- package/dist/utils/performanceUtils.js +7 -0
- package/dist/utils/portUtils.d.ts +47 -11
- package/dist/utils/portUtils.js +67 -14
- package/dist/utils/portal.d.ts +18 -0
- package/dist/utils/portal.js +34 -0
- package/dist/utils/schemaMerge.d.ts +25 -0
- package/dist/utils/schemaMerge.js +61 -0
- package/package.json +7 -5
- package/dist/messages/deprecation.d.ts +0 -20
- package/dist/messages/deprecation.js +0 -33
- package/dist/registry/plugin.d.ts +0 -215
- package/dist/registry/plugin.js +0 -249
- package/dist/services/api.d.ts +0 -129
- package/dist/services/api.js +0 -217
|
@@ -45,6 +45,15 @@ export class PortCompatibilityChecker {
|
|
|
45
45
|
this.compatibilityMap = new Map();
|
|
46
46
|
this.buildCompatibilityMap();
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Replace the port configuration and rebuild the compatibility map in place.
|
|
50
|
+
* Used by mount to apply the backend-fetched port config to an instance's
|
|
51
|
+
* checker without swapping the instance field.
|
|
52
|
+
*/
|
|
53
|
+
reinitialize(portConfig) {
|
|
54
|
+
this.portConfig = portConfig;
|
|
55
|
+
this.buildCompatibilityMap();
|
|
56
|
+
}
|
|
48
57
|
/**
|
|
49
58
|
* Build the compatibility map from configuration rules
|
|
50
59
|
*/
|
|
@@ -106,46 +115,21 @@ export class PortCompatibilityChecker {
|
|
|
106
115
|
return this.portConfig.dataTypes.filter((dt) => dt.enabled !== false);
|
|
107
116
|
}
|
|
108
117
|
}
|
|
109
|
-
// Global instance - will be initialized with configuration
|
|
110
|
-
let globalCompatibilityChecker = null;
|
|
111
|
-
/**
|
|
112
|
-
* Initialize the global port compatibility checker
|
|
113
|
-
*/
|
|
114
|
-
export function initializePortCompatibility(portConfig) {
|
|
115
|
-
globalCompatibilityChecker = new PortCompatibilityChecker(portConfig);
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Returns true if the port compatibility checker has been initialized.
|
|
119
|
-
*/
|
|
120
|
-
export function isPortCompatibilityInitialized() {
|
|
121
|
-
return globalCompatibilityChecker !== null;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Get the global port compatibility checker
|
|
125
|
-
*/
|
|
126
|
-
export function getPortCompatibilityChecker() {
|
|
127
|
-
if (!globalCompatibilityChecker) {
|
|
128
|
-
throw new Error('Port compatibility checker not initialized. Call initializePortCompatibility() first.');
|
|
129
|
-
}
|
|
130
|
-
return globalCompatibilityChecker;
|
|
131
|
-
}
|
|
132
118
|
/**
|
|
133
119
|
* Get all possible connections from a source node to target nodes
|
|
134
120
|
*/
|
|
135
|
-
export function getPossibleConnections(sourceNode, targetNodes, nodeTypes) {
|
|
136
|
-
const sourceMetadata = nodeTypes.find((nt) => nt.
|
|
121
|
+
export function getPossibleConnections(checker, sourceNode, targetNodes, nodeTypes) {
|
|
122
|
+
const sourceMetadata = nodeTypes.find((nt) => nt.node_type_id === sourceNode.data.metadata.node_type_id);
|
|
137
123
|
if (!sourceMetadata)
|
|
138
124
|
return [];
|
|
139
125
|
const possibleConnections = [];
|
|
140
126
|
// Get all output ports from source node
|
|
141
127
|
const sourceOutputs = sourceMetadata.outputs;
|
|
142
|
-
// Get the compatibility checker instance
|
|
143
|
-
const checker = getPortCompatibilityChecker();
|
|
144
128
|
// Check each target node
|
|
145
129
|
for (const targetNode of targetNodes) {
|
|
146
130
|
if (targetNode.id === sourceNode.id)
|
|
147
131
|
continue; // Skip self-connection
|
|
148
|
-
const targetMetadata = nodeTypes.find((nt) => nt.
|
|
132
|
+
const targetMetadata = nodeTypes.find((nt) => nt.node_type_id === targetNode.data.metadata.node_type_id);
|
|
149
133
|
if (!targetMetadata)
|
|
150
134
|
continue;
|
|
151
135
|
// Get all input ports from target node
|
|
@@ -171,7 +155,7 @@ export function getPossibleConnections(sourceNode, targetNodes, nodeTypes) {
|
|
|
171
155
|
/**
|
|
172
156
|
* Validate if a specific connection is valid
|
|
173
157
|
*/
|
|
174
|
-
export function validateConnection(sourceNodeId, sourcePortId, targetNodeId, targetPortId, nodes, nodeTypes) {
|
|
158
|
+
export function validateConnection(checker, sourceNodeId, sourcePortId, targetNodeId, targetPortId, nodes, nodeTypes) {
|
|
175
159
|
// Check if nodes exist
|
|
176
160
|
const sourceNode = nodes.find((n) => n.id === sourceNodeId);
|
|
177
161
|
const targetNode = nodes.find((n) => n.id === targetNodeId);
|
|
@@ -186,8 +170,8 @@ export function validateConnection(sourceNodeId, sourcePortId, targetNodeId, tar
|
|
|
186
170
|
return { valid: false, error: 'Cannot connect node to itself' };
|
|
187
171
|
}
|
|
188
172
|
// Get node metadata
|
|
189
|
-
const sourceMetadata = nodeTypes.find((nt) => nt.
|
|
190
|
-
const targetMetadata = nodeTypes.find((nt) => nt.
|
|
173
|
+
const sourceMetadata = nodeTypes.find((nt) => nt.node_type_id === sourceNode.data.metadata.node_type_id);
|
|
174
|
+
const targetMetadata = nodeTypes.find((nt) => nt.node_type_id === targetNode.data.metadata.node_type_id);
|
|
191
175
|
if (!sourceMetadata || !targetMetadata) {
|
|
192
176
|
return { valid: false, error: 'Node metadata not found' };
|
|
193
177
|
}
|
|
@@ -200,8 +184,7 @@ export function validateConnection(sourceNodeId, sourcePortId, targetNodeId, tar
|
|
|
200
184
|
if (!targetPort) {
|
|
201
185
|
return { valid: false, error: 'Target port not found' };
|
|
202
186
|
}
|
|
203
|
-
// Check data type compatibility using the
|
|
204
|
-
const checker = getPortCompatibilityChecker();
|
|
187
|
+
// Check data type compatibility using the instance's checker
|
|
205
188
|
if (!checker.areDataTypesCompatible(sourcePort.dataType, targetPort.dataType)) {
|
|
206
189
|
return {
|
|
207
190
|
valid: false,
|
|
@@ -213,20 +196,18 @@ export function validateConnection(sourceNodeId, sourcePortId, targetNodeId, tar
|
|
|
213
196
|
/**
|
|
214
197
|
* Get connection suggestions for a node
|
|
215
198
|
*/
|
|
216
|
-
export function getConnectionSuggestions(nodeId, nodes, nodeTypes) {
|
|
199
|
+
export function getConnectionSuggestions(checker, nodeId, nodes, nodeTypes) {
|
|
217
200
|
const node = nodes.find((n) => n.id === nodeId);
|
|
218
201
|
if (!node)
|
|
219
202
|
return [];
|
|
220
|
-
const metadata = nodeTypes.find((nt) => nt.
|
|
203
|
+
const metadata = nodeTypes.find((nt) => nt.node_type_id === node.data.metadata.node_type_id);
|
|
221
204
|
if (!metadata)
|
|
222
205
|
return [];
|
|
223
206
|
const suggestions = [];
|
|
224
207
|
// Get all other nodes
|
|
225
208
|
const otherNodes = nodes.filter((n) => n.id !== nodeId);
|
|
226
|
-
// Get the compatibility checker instance
|
|
227
|
-
const checker = getPortCompatibilityChecker();
|
|
228
209
|
for (const otherNode of otherNodes) {
|
|
229
|
-
const otherMetadata = nodeTypes.find((nt) => nt.
|
|
210
|
+
const otherMetadata = nodeTypes.find((nt) => nt.node_type_id === otherNode.data.metadata.node_type_id);
|
|
230
211
|
if (!otherMetadata)
|
|
231
212
|
continue;
|
|
232
213
|
// Check outputs from other nodes to inputs of current node
|
|
@@ -272,8 +253,17 @@ export function getConnectionSuggestions(nodeId, nodes, nodeTypes) {
|
|
|
272
253
|
* @returns True if any cycle exists in the workflow
|
|
273
254
|
*/
|
|
274
255
|
export function hasCycles(nodes, edges) {
|
|
275
|
-
|
|
276
|
-
|
|
256
|
+
return detectCycles(nodes, edges);
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Detect whether a directed graph contains a cycle, using DFS over a pre-built
|
|
260
|
+
* adjacency map (O(E) build, O(1) per neighbour lookup — avoids the O(V*E) of
|
|
261
|
+
* re-scanning every edge on each recursive call).
|
|
262
|
+
*
|
|
263
|
+
* Shared by `hasCycles` (all edges) and `hasInvalidCycles` (loopback edges
|
|
264
|
+
* pre-filtered out by the caller).
|
|
265
|
+
*/
|
|
266
|
+
function detectCycles(nodes, edges) {
|
|
277
267
|
const adjacencyMap = new Map();
|
|
278
268
|
for (const node of nodes) {
|
|
279
269
|
adjacencyMap.set(node.id, []);
|
|
@@ -293,7 +283,6 @@ export function hasCycles(nodes, edges) {
|
|
|
293
283
|
return false;
|
|
294
284
|
visited.add(nodeId);
|
|
295
285
|
recursionStack.add(nodeId);
|
|
296
|
-
// Use pre-built adjacency map instead of filtering all edges each call
|
|
297
286
|
const neighbors = adjacencyMap.get(nodeId) || [];
|
|
298
287
|
for (const target of neighbors) {
|
|
299
288
|
if (hasCycleUtil(target))
|
|
@@ -302,7 +291,6 @@ export function hasCycles(nodes, edges) {
|
|
|
302
291
|
recursionStack.delete(nodeId);
|
|
303
292
|
return false;
|
|
304
293
|
}
|
|
305
|
-
// Check each node
|
|
306
294
|
for (const node of nodes) {
|
|
307
295
|
if (!visited.has(node.id)) {
|
|
308
296
|
if (hasCycleUtil(node.id))
|
|
@@ -328,53 +316,10 @@ export function hasCycles(nodes, edges) {
|
|
|
328
316
|
* ```
|
|
329
317
|
*/
|
|
330
318
|
export function hasInvalidCycles(nodes, edges) {
|
|
331
|
-
// Filter out loopback edges - these create valid cycles for loop iteration
|
|
319
|
+
// Filter out loopback edges - these create valid cycles for loop iteration,
|
|
320
|
+
// then reuse the shared detector over the remaining edges.
|
|
332
321
|
const nonLoopbackEdges = edges.filter((edge) => !isLoopbackEdge(edge));
|
|
333
|
-
|
|
334
|
-
// loop is O(1) per lookup instead of scanning all edges on every recursive
|
|
335
|
-
// call (which was O(V*E)).
|
|
336
|
-
const adjacencyMap = new Map();
|
|
337
|
-
for (const node of nodes) {
|
|
338
|
-
adjacencyMap.set(node.id, []);
|
|
339
|
-
}
|
|
340
|
-
for (const edge of nonLoopbackEdges) {
|
|
341
|
-
const neighbors = adjacencyMap.get(edge.source);
|
|
342
|
-
if (neighbors) {
|
|
343
|
-
neighbors.push(edge.target);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
// Check for cycles using only non-loopback edges
|
|
347
|
-
const visited = new Set();
|
|
348
|
-
const recursionStack = new Set();
|
|
349
|
-
/**
|
|
350
|
-
* DFS utility to detect cycles in the graph
|
|
351
|
-
* @param nodeId - Current node being visited
|
|
352
|
-
* @returns True if a cycle is found from this node
|
|
353
|
-
*/
|
|
354
|
-
function hasCycleUtil(nodeId) {
|
|
355
|
-
if (recursionStack.has(nodeId))
|
|
356
|
-
return true;
|
|
357
|
-
if (visited.has(nodeId))
|
|
358
|
-
return false;
|
|
359
|
-
visited.add(nodeId);
|
|
360
|
-
recursionStack.add(nodeId);
|
|
361
|
-
// Use pre-built adjacency map instead of filtering all edges each call
|
|
362
|
-
const neighbors = adjacencyMap.get(nodeId) || [];
|
|
363
|
-
for (const target of neighbors) {
|
|
364
|
-
if (hasCycleUtil(target))
|
|
365
|
-
return true;
|
|
366
|
-
}
|
|
367
|
-
recursionStack.delete(nodeId);
|
|
368
|
-
return false;
|
|
369
|
-
}
|
|
370
|
-
// Check each node for cycles
|
|
371
|
-
for (const node of nodes) {
|
|
372
|
-
if (!visited.has(node.id)) {
|
|
373
|
-
if (hasCycleUtil(node.id))
|
|
374
|
-
return true;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
return false;
|
|
322
|
+
return detectCycles(nodes, nonLoopbackEdges);
|
|
378
323
|
}
|
|
379
324
|
/**
|
|
380
325
|
* Get the execution order for a workflow (topological sort)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Duration formatting helpers.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the backend `Drupal\flowdrop\Utility\Duration::formatMicroseconds()`
|
|
5
|
+
* tiers so the playground and the Drupal admin pages render identical values.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Formats a duration in human-readable form from microseconds.
|
|
9
|
+
*
|
|
10
|
+
* Examples: `150µs`, `2.5ms`, `25.1ms`, `250ms`, `1.23s`, `45s`,
|
|
11
|
+
* `2m 30s`, `1h 30m`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function formatMicroseconds(microseconds: number | null | undefined): string | null;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Duration formatting helpers.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the backend `Drupal\flowdrop\Utility\Duration::formatMicroseconds()`
|
|
5
|
+
* tiers so the playground and the Drupal admin pages render identical values.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Formats a duration in human-readable form from microseconds.
|
|
9
|
+
*
|
|
10
|
+
* Examples: `150µs`, `2.5ms`, `25.1ms`, `250ms`, `1.23s`, `45s`,
|
|
11
|
+
* `2m 30s`, `1h 30m`.
|
|
12
|
+
*/
|
|
13
|
+
export function formatMicroseconds(microseconds) {
|
|
14
|
+
if (microseconds == null || !Number.isFinite(microseconds) || microseconds < 0)
|
|
15
|
+
return null;
|
|
16
|
+
const us = Math.round(microseconds);
|
|
17
|
+
if (us < 1000) {
|
|
18
|
+
return `${us}µs`;
|
|
19
|
+
}
|
|
20
|
+
if (us < 1_000_000) {
|
|
21
|
+
const ms = us / 1000;
|
|
22
|
+
if (us < 100_000) {
|
|
23
|
+
// 2 decimals below 10ms, 1 decimal below 100ms — matches PHP round().
|
|
24
|
+
const decimals = us < 10_000 ? 2 : 1;
|
|
25
|
+
// Drop trailing zeros the way PHP round() renders (2.50 → 2.5, 3.00 → 3).
|
|
26
|
+
return `${parseFloat(ms.toFixed(decimals))}ms`;
|
|
27
|
+
}
|
|
28
|
+
return `${Math.round(ms)}ms`;
|
|
29
|
+
}
|
|
30
|
+
if (us < 10_000_000) {
|
|
31
|
+
return `${parseFloat((us / 1_000_000).toFixed(2))}s`;
|
|
32
|
+
}
|
|
33
|
+
if (us < 60_000_000) {
|
|
34
|
+
return `${Math.floor(us / 1_000_000)}s`;
|
|
35
|
+
}
|
|
36
|
+
const totalSeconds = Math.floor(us / 1_000_000);
|
|
37
|
+
if (us < 3_600_000_000) {
|
|
38
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
39
|
+
const secs = totalSeconds % 60;
|
|
40
|
+
return secs > 0 ? `${minutes}m ${secs}s` : `${minutes}m`;
|
|
41
|
+
}
|
|
42
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
43
|
+
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
|
44
|
+
return minutes > 0 ? `${hours}h ${minutes}m` : `${hours}h`;
|
|
45
|
+
}
|
|
@@ -5,10 +5,14 @@
|
|
|
5
5
|
* visual styling to workflow edges based on source port data types.
|
|
6
6
|
* Used by both the visual editor and the command DSL system.
|
|
7
7
|
*/
|
|
8
|
-
import { MarkerType } from '@xyflow/svelte';
|
|
9
8
|
import { extractPortId } from '../utils/handleIds.js';
|
|
10
9
|
import { isLoopbackEdge } from '../utils/connections.js';
|
|
11
10
|
import { EDGE_MARKER_SIZES } from '../config/constants.js';
|
|
11
|
+
// xyflow's `MarkerType.ArrowClosed`, inlined as its literal value. This module
|
|
12
|
+
// is shared with the headless command DSL (reachable from `@flowdrop/flowdrop/core`),
|
|
13
|
+
// so it must NOT carry a runtime import of @xyflow/svelte — a type-only import
|
|
14
|
+
// plus this constant keeps the marker type-safe without the dependency.
|
|
15
|
+
const ARROW_CLOSED_MARKER = 'arrowclosed';
|
|
12
16
|
/**
|
|
13
17
|
* Check if a port ID matches a dynamic branch in a Gateway node.
|
|
14
18
|
* Gateway nodes store branches in config.branches array.
|
|
@@ -101,7 +105,7 @@ export function applyConnectionStyling(edge, sourceNode, targetNode) {
|
|
|
101
105
|
'stroke: var(--fd-edge-loopback); stroke-dasharray: var(--fd-edge-loopback-dasharray); stroke-width: var(--fd-edge-loopback-width); opacity: var(--fd-edge-loopback-opacity);';
|
|
102
106
|
edge.class = 'flowdrop--edge--loopback';
|
|
103
107
|
edge.markerEnd = {
|
|
104
|
-
type:
|
|
108
|
+
type: ARROW_CLOSED_MARKER,
|
|
105
109
|
...EDGE_MARKER_SIZES.loopback,
|
|
106
110
|
color: 'var(--fd-edge-loopback)'
|
|
107
111
|
};
|
|
@@ -110,7 +114,7 @@ export function applyConnectionStyling(edge, sourceNode, targetNode) {
|
|
|
110
114
|
edge.style = 'stroke: var(--fd-edge-trigger); stroke-width: var(--fd-edge-trigger-width);';
|
|
111
115
|
edge.class = 'flowdrop--edge--trigger';
|
|
112
116
|
edge.markerEnd = {
|
|
113
|
-
type:
|
|
117
|
+
type: ARROW_CLOSED_MARKER,
|
|
114
118
|
...EDGE_MARKER_SIZES.trigger,
|
|
115
119
|
color: 'var(--fd-edge-trigger)'
|
|
116
120
|
};
|
|
@@ -119,7 +123,7 @@ export function applyConnectionStyling(edge, sourceNode, targetNode) {
|
|
|
119
123
|
edge.style = 'stroke: var(--fd-edge-tool); stroke-dasharray: 5 3;';
|
|
120
124
|
edge.class = 'flowdrop--edge--tool';
|
|
121
125
|
edge.markerEnd = {
|
|
122
|
-
type:
|
|
126
|
+
type: ARROW_CLOSED_MARKER,
|
|
123
127
|
...EDGE_MARKER_SIZES.tool,
|
|
124
128
|
color: 'var(--fd-edge-tool)'
|
|
125
129
|
};
|
|
@@ -129,7 +133,7 @@ export function applyConnectionStyling(edge, sourceNode, targetNode) {
|
|
|
129
133
|
edge.style = 'stroke: var(--fd-edge-data);';
|
|
130
134
|
edge.class = 'flowdrop--edge--data';
|
|
131
135
|
edge.markerEnd = {
|
|
132
|
-
type:
|
|
136
|
+
type: ARROW_CLOSED_MARKER,
|
|
133
137
|
...EDGE_MARKER_SIZES.data,
|
|
134
138
|
color: 'var(--fd-edge-data)'
|
|
135
139
|
};
|
|
@@ -1,25 +1,46 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Authenticated fetch
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* The single fetch path for FlowDrop's per-instance services. It builds request
|
|
5
|
+
* headers (static endpoint headers + the {@link AuthProvider}'s headers + any
|
|
6
|
+
* caller headers) and uniformly applies the auth lifecycle: on `401` it invokes
|
|
7
|
+
* `onUnauthorized()` and — if that reports a successful refresh — retries the
|
|
8
|
+
* request once with freshly fetched headers; on `403` it invokes
|
|
9
|
+
* `onForbidden()`. Callers receive the raw {@link Response} and keep their own
|
|
10
|
+
* status/parse handling.
|
|
11
|
+
*
|
|
12
|
+
* Routing every service through this helper means a configured `AuthProvider`
|
|
13
|
+
* authenticates *and* refreshes consistently — matching the behaviour the typed
|
|
14
|
+
* workflow/node API gets from {@link EnhancedFlowDropApiClient}.
|
|
6
15
|
*
|
|
7
16
|
* @module utils/fetchWithAuth
|
|
8
17
|
*/
|
|
18
|
+
import type { EndpointConfig } from '../config/endpoints.js';
|
|
9
19
|
import type { AuthProvider } from '../types/auth.js';
|
|
10
20
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* Constructs standard JSON request headers and merges in authentication
|
|
14
|
-
* headers from the provided AuthProvider, if available.
|
|
21
|
+
* Options describing how to authenticate and where the base headers come from.
|
|
15
22
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
23
|
+
* Provide `config` + `endpointKey` to source static endpoint headers (the usual
|
|
24
|
+
* case for endpoint-keyed services), or `baseHeaders` for ad-hoc requests that
|
|
25
|
+
* are not tied to a configured endpoint (e.g. a user-configured autocomplete
|
|
26
|
+
* URL). When neither is given the request carries only JSON defaults plus auth.
|
|
27
|
+
*/
|
|
28
|
+
export interface AuthenticatedFetchOptions {
|
|
29
|
+
/** Auth provider supplying `Authorization` etc. and 401/403 lifecycle hooks. */
|
|
30
|
+
authProvider?: AuthProvider;
|
|
31
|
+
/** Endpoint configuration, used with `endpointKey` to look up static headers. */
|
|
32
|
+
config?: EndpointConfig;
|
|
33
|
+
/** Endpoint key identifying which static headers to apply. */
|
|
34
|
+
endpointKey?: string;
|
|
35
|
+
/** Base headers for requests not tied to a configured endpoint. */
|
|
36
|
+
baseHeaders?: Record<string, string>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Perform an authenticated fetch with consistent 401/403 handling.
|
|
18
40
|
*
|
|
19
|
-
* @
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* ```
|
|
41
|
+
* @param url - The fully-resolved request URL
|
|
42
|
+
* @param init - Standard fetch options (method, body, signal, headers, …)
|
|
43
|
+
* @param opts - Auth provider and header source
|
|
44
|
+
* @returns The raw {@link Response}; callers handle `.ok`/parsing themselves
|
|
24
45
|
*/
|
|
25
|
-
export declare function
|
|
46
|
+
export declare function authenticatedFetch(url: string, init?: RequestInit, opts?: AuthenticatedFetchOptions): Promise<Response>;
|
|
@@ -1,34 +1,64 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Authenticated fetch
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* The single fetch path for FlowDrop's per-instance services. It builds request
|
|
5
|
+
* headers (static endpoint headers + the {@link AuthProvider}'s headers + any
|
|
6
|
+
* caller headers) and uniformly applies the auth lifecycle: on `401` it invokes
|
|
7
|
+
* `onUnauthorized()` and — if that reports a successful refresh — retries the
|
|
8
|
+
* request once with freshly fetched headers; on `403` it invokes
|
|
9
|
+
* `onForbidden()`. Callers receive the raw {@link Response} and keep their own
|
|
10
|
+
* status/parse handling.
|
|
11
|
+
*
|
|
12
|
+
* Routing every service through this helper means a configured `AuthProvider`
|
|
13
|
+
* authenticates *and* refreshes consistently — matching the behaviour the typed
|
|
14
|
+
* workflow/node API gets from {@link EnhancedFlowDropApiClient}.
|
|
6
15
|
*
|
|
7
16
|
* @module utils/fetchWithAuth
|
|
8
17
|
*/
|
|
18
|
+
import { getEndpointHeaders } from '../config/endpoints.js';
|
|
19
|
+
const DEFAULT_HEADERS = {
|
|
20
|
+
Accept: 'application/json',
|
|
21
|
+
'Content-Type': 'application/json'
|
|
22
|
+
};
|
|
9
23
|
/**
|
|
10
|
-
* Build
|
|
11
|
-
*
|
|
12
|
-
* Constructs standard JSON request headers and merges in authentication
|
|
13
|
-
* headers from the provided AuthProvider, if available.
|
|
14
|
-
*
|
|
15
|
-
* @param authProvider - Optional auth provider to get headers from
|
|
16
|
-
* @returns Promise resolving to a complete headers object
|
|
24
|
+
* Build the merged header set: base headers < auth headers < per-request headers.
|
|
17
25
|
*
|
|
18
|
-
*
|
|
19
|
-
* ```typescript
|
|
20
|
-
* const headers = await buildFetchHeaders(authProvider);
|
|
21
|
-
* const response = await fetch(url, { headers });
|
|
22
|
-
* ```
|
|
26
|
+
* Re-invoked for the retry so a refreshed token is picked up.
|
|
23
27
|
*/
|
|
24
|
-
|
|
25
|
-
const headers =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
async function buildHeaders(init, opts) {
|
|
29
|
+
const headers = opts.config && opts.endpointKey
|
|
30
|
+
? getEndpointHeaders(opts.config, opts.endpointKey)
|
|
31
|
+
: { ...DEFAULT_HEADERS, ...opts.baseHeaders };
|
|
32
|
+
if (opts.authProvider) {
|
|
33
|
+
Object.assign(headers, await opts.authProvider.getAuthHeaders());
|
|
34
|
+
}
|
|
35
|
+
if (init.headers) {
|
|
36
|
+
Object.assign(headers, init.headers);
|
|
32
37
|
}
|
|
33
38
|
return headers;
|
|
34
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Perform an authenticated fetch with consistent 401/403 handling.
|
|
42
|
+
*
|
|
43
|
+
* @param url - The fully-resolved request URL
|
|
44
|
+
* @param init - Standard fetch options (method, body, signal, headers, …)
|
|
45
|
+
* @param opts - Auth provider and header source
|
|
46
|
+
* @returns The raw {@link Response}; callers handle `.ok`/parsing themselves
|
|
47
|
+
*/
|
|
48
|
+
export async function authenticatedFetch(url, init = {}, opts = {}) {
|
|
49
|
+
const headers = await buildHeaders(init, opts);
|
|
50
|
+
let response = await fetch(url, { ...init, headers });
|
|
51
|
+
// 401 → let the provider refresh, then retry once with fresh headers.
|
|
52
|
+
if (response.status === 401 && opts.authProvider?.onUnauthorized) {
|
|
53
|
+
const refreshed = await opts.authProvider.onUnauthorized();
|
|
54
|
+
if (refreshed) {
|
|
55
|
+
const retryHeaders = await buildHeaders(init, opts);
|
|
56
|
+
response = await fetch(url, { ...init, headers: retryHeaders });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// 403 → notify the provider (e.g. surface a permission error).
|
|
60
|
+
if (response.status === 403 && opts.authProvider?.onForbidden) {
|
|
61
|
+
await opts.authProvider.onForbidden();
|
|
62
|
+
}
|
|
63
|
+
return response;
|
|
64
|
+
}
|
package/dist/utils/icons.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Ensures consistent icon usage across all components
|
|
4
4
|
*/
|
|
5
5
|
import type { NodeCategory } from '../types/index.js';
|
|
6
|
+
import type { CategoriesStore } from '../stores/categoriesStore.svelte.js';
|
|
6
7
|
/**
|
|
7
8
|
* Default icons for different contexts
|
|
8
9
|
*/
|
|
@@ -72,19 +73,21 @@ export declare const DEFAULT_ICONS: {
|
|
|
72
73
|
export declare const CATEGORY_ICONS: Record<string, string>;
|
|
73
74
|
/**
|
|
74
75
|
* Get the appropriate icon for a node
|
|
76
|
+
* @param categories - The instance's categories store (e.g. `fd.categories`)
|
|
75
77
|
* @param nodeIcon - The node's specific icon
|
|
76
78
|
* @param category - The node's category
|
|
77
79
|
* @returns The icon to use
|
|
78
80
|
*/
|
|
79
|
-
export declare function getNodeIcon(nodeIcon?: string, category?: NodeCategory): string;
|
|
81
|
+
export declare function getNodeIcon(categories: CategoriesStore, nodeIcon?: string, category?: NodeCategory): string;
|
|
80
82
|
/**
|
|
81
83
|
* Get the appropriate icon for a category.
|
|
82
84
|
* Checks the categories store first (which includes API overrides),
|
|
83
85
|
* then falls back to the static CATEGORY_ICONS map, then to the default.
|
|
86
|
+
* @param categories - The instance's categories store (e.g. `fd.categories`)
|
|
84
87
|
* @param category - The category
|
|
85
88
|
* @returns The icon to use
|
|
86
89
|
*/
|
|
87
|
-
export declare function getCategoryIcon(category: NodeCategory): string;
|
|
90
|
+
export declare function getCategoryIcon(categories: CategoriesStore, category: NodeCategory): string;
|
|
88
91
|
/**
|
|
89
92
|
* Get a default icon by key
|
|
90
93
|
* @param key - The icon key from DEFAULT_ICONS
|
package/dist/utils/icons.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Centralized icon management for FlowDrop
|
|
3
3
|
* Ensures consistent icon usage across all components
|
|
4
4
|
*/
|
|
5
|
-
import { getCategoryIcon as getCategoryIconFromStore } from '../stores/categoriesStore.svelte.js';
|
|
6
5
|
/**
|
|
7
6
|
* Default icons for different contexts
|
|
8
7
|
*/
|
|
@@ -103,18 +102,19 @@ export const CATEGORY_ICONS = {
|
|
|
103
102
|
};
|
|
104
103
|
/**
|
|
105
104
|
* Get the appropriate icon for a node
|
|
105
|
+
* @param categories - The instance's categories store (e.g. `fd.categories`)
|
|
106
106
|
* @param nodeIcon - The node's specific icon
|
|
107
107
|
* @param category - The node's category
|
|
108
108
|
* @returns The icon to use
|
|
109
109
|
*/
|
|
110
|
-
export function getNodeIcon(nodeIcon, category) {
|
|
110
|
+
export function getNodeIcon(categories, nodeIcon, category) {
|
|
111
111
|
// If node has a specific icon, use it
|
|
112
112
|
if (nodeIcon) {
|
|
113
113
|
return nodeIcon;
|
|
114
114
|
}
|
|
115
115
|
// If category is provided, use category icon from store (which includes API overrides)
|
|
116
116
|
if (category) {
|
|
117
|
-
return
|
|
117
|
+
return categories.getIcon(category);
|
|
118
118
|
}
|
|
119
119
|
// Fallback to default node icon
|
|
120
120
|
return DEFAULT_ICONS.NODE;
|
|
@@ -123,11 +123,12 @@ export function getNodeIcon(nodeIcon, category) {
|
|
|
123
123
|
* Get the appropriate icon for a category.
|
|
124
124
|
* Checks the categories store first (which includes API overrides),
|
|
125
125
|
* then falls back to the static CATEGORY_ICONS map, then to the default.
|
|
126
|
+
* @param categories - The instance's categories store (e.g. `fd.categories`)
|
|
126
127
|
* @param category - The category
|
|
127
128
|
* @returns The icon to use
|
|
128
129
|
*/
|
|
129
|
-
export function getCategoryIcon(category) {
|
|
130
|
-
return
|
|
130
|
+
export function getCategoryIcon(categories, category) {
|
|
131
|
+
return categories.getIcon(category);
|
|
131
132
|
}
|
|
132
133
|
/**
|
|
133
134
|
* Get a default icon by key
|
package/dist/utils/nodeIds.d.ts
CHANGED
package/dist/utils/nodeIds.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
export function generateNodeId(nodeTypeId, existingNodes) {
|
|
12
12
|
// Count how many nodes of this type already exist
|
|
13
13
|
const existingNodeIds = existingNodes
|
|
14
|
-
.filter((node) => node.data?.metadata?.
|
|
14
|
+
.filter((node) => node.data?.metadata?.node_type_id === nodeTypeId)
|
|
15
15
|
.map((node) => node.id);
|
|
16
16
|
// Extract the numbers from existing IDs with the same prefix
|
|
17
17
|
const existingNumbers = existingNodeIds
|
package/dist/utils/nodeSwap.d.ts
CHANGED
|
@@ -161,6 +161,10 @@ export declare function mapConfig(oldConfig: ConfigValues, newConfigSchema: Conf
|
|
|
161
161
|
*
|
|
162
162
|
* This does NOT mutate anything — it returns a preview that can be displayed
|
|
163
163
|
* to the user for confirmation before executing the swap.
|
|
164
|
+
*
|
|
165
|
+
* Thin wrapper over {@link computeSwapPreviewWithOptions} — with no strategies
|
|
166
|
+
* or overrides the cascade reduces to the built-in exact matching, so both
|
|
167
|
+
* entry points share one implementation.
|
|
164
168
|
*/
|
|
165
169
|
export declare function computeSwapPreview(oldNode: WorkflowNode, newMetadata: NodeMetadata, edges: WorkflowEdge[], allNodes: WorkflowNode[], checker?: PortCompatibilityChecker | null): SwapPreview;
|
|
166
170
|
/**
|
|
@@ -183,7 +187,7 @@ export declare function getVersionUpgrade(currentMetadata: NodeMetadata, allNode
|
|
|
183
187
|
*
|
|
184
188
|
* Resolution order:
|
|
185
189
|
* 1. Check strategies — first canHandle() match wins for mapPorts()/mapConfig()
|
|
186
|
-
* 2. Fall through to built-in
|
|
190
|
+
* 2. Fall through to built-in exact matching (ID, then name) for ports not covered by strategy
|
|
187
191
|
* 3. Apply portOverrides on top (highest priority — user's manual overrides)
|
|
188
192
|
* 4. Same cascade for config
|
|
189
193
|
*/
|
|
@@ -199,7 +203,7 @@ export declare function computeInteractiveState(oldNode: WorkflowNode, newMetada
|
|
|
199
203
|
* Convert user-edited InteractiveSwapState back into a SwapPreview
|
|
200
204
|
* for executeSwap(). Pure function, no side effects.
|
|
201
205
|
*/
|
|
202
|
-
export declare function buildSwapPreviewFromState(state: InteractiveSwapState,
|
|
206
|
+
export declare function buildSwapPreviewFromState(state: InteractiveSwapState, _allEdges: WorkflowEdge[]): SwapPreview;
|
|
203
207
|
/**
|
|
204
208
|
* Headless one-shot swap with full validation.
|
|
205
209
|
*
|