@flowdrop/flowdrop 1.4.0 → 1.6.0
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/README.md +94 -51
- package/dist/adapters/WorkflowAdapter.d.ts +1 -1
- package/dist/adapters/WorkflowAdapter.js +27 -47
- package/dist/adapters/agentspec/AgentSpecAdapter.d.ts +2 -2
- package/dist/adapters/agentspec/AgentSpecAdapter.js +122 -133
- package/dist/adapters/agentspec/agentAdapter.d.ts +2 -2
- package/dist/adapters/agentspec/agentAdapter.js +10 -10
- package/dist/adapters/agentspec/autoLayout.d.ts +52 -6
- package/dist/adapters/agentspec/autoLayout.js +118 -23
- package/dist/adapters/agentspec/componentTypeDefaults.d.ts +1 -1
- package/dist/adapters/agentspec/componentTypeDefaults.js +120 -120
- package/dist/adapters/agentspec/defaultNodeTypes.d.ts +2 -2
- package/dist/adapters/agentspec/defaultNodeTypes.js +307 -307
- package/dist/adapters/agentspec/index.d.ts +10 -10
- package/dist/adapters/agentspec/index.js +6 -6
- package/dist/adapters/agentspec/validator.d.ts +2 -2
- package/dist/adapters/agentspec/validator.js +20 -22
- package/dist/api/enhanced-client.d.ts +3 -3
- package/dist/api/enhanced-client.js +72 -73
- package/dist/chat/commandClassifier.d.ts +19 -0
- package/dist/chat/commandClassifier.js +30 -0
- package/dist/chat/index.d.ts +27 -0
- package/dist/chat/index.js +32 -0
- package/dist/chat/responseParser.d.ts +21 -0
- package/dist/chat/responseParser.js +91 -0
- package/dist/commands/batch.d.ts +18 -0
- package/dist/commands/batch.js +54 -0
- package/dist/commands/executor.d.ts +37 -0
- package/dist/commands/executor.js +1133 -0
- package/dist/commands/index.d.ts +14 -0
- package/dist/commands/index.js +17 -0
- package/dist/commands/parser.d.ts +16 -0
- package/dist/commands/parser.js +295 -0
- package/dist/commands/positioner.d.ts +19 -0
- package/dist/commands/positioner.js +33 -0
- package/dist/commands/storeIntegration.svelte.d.ts +16 -0
- package/dist/commands/storeIntegration.svelte.js +67 -0
- package/dist/commands/types.d.ts +343 -0
- package/dist/commands/types.js +45 -0
- package/dist/components/App.svelte +522 -237
- package/dist/components/App.svelte.d.ts +11 -8
- package/dist/components/CanvasBanner.stories.svelte +10 -16
- package/dist/components/CanvasBanner.stories.svelte.d.ts +1 -1
- package/dist/components/CanvasBanner.svelte +2 -2
- package/dist/components/CanvasBanner.svelte.d.ts +1 -1
- package/dist/components/CanvasController.svelte +37 -0
- package/dist/components/CanvasController.svelte.d.ts +32 -0
- package/dist/components/ConfigForm.svelte +118 -256
- package/dist/components/ConfigForm.svelte.d.ts +2 -2
- package/dist/components/ConfigMappingRow.svelte +128 -0
- package/dist/components/ConfigMappingRow.svelte.d.ts +8 -0
- package/dist/components/ConfigModal.svelte +3 -3
- package/dist/components/ConfigModal.svelte.d.ts +1 -1
- package/dist/components/ConfigPanel.stories.svelte +19 -19
- package/dist/components/ConfigPanel.stories.svelte.d.ts +1 -1
- package/dist/components/ConfigPanel.svelte +57 -19
- package/dist/components/ConfigPanel.svelte.d.ts +3 -1
- package/dist/components/ConnectionLine.svelte +4 -4
- package/dist/components/EdgeRefresher.svelte +1 -1
- package/dist/components/FlowDropEdge.stories.svelte +110 -110
- package/dist/components/FlowDropEdge.svelte +11 -19
- package/dist/components/FlowDropEdge.svelte.d.ts +1 -1
- package/dist/components/FlowDropZone.svelte +6 -9
- package/dist/components/FlowDropZone.svelte.d.ts +1 -1
- package/dist/components/LoadingSpinner.stories.svelte +13 -13
- package/dist/components/LoadingSpinner.stories.svelte.d.ts +1 -1
- package/dist/components/LoadingSpinner.svelte +3 -3
- package/dist/components/LoadingSpinner.svelte.d.ts +1 -1
- package/dist/components/Logo.stories.svelte +4 -4
- package/dist/components/Logo.stories.svelte.d.ts +1 -1
- package/dist/components/Logo.svelte +3 -9
- package/dist/components/LogsSidebar.svelte +46 -53
- package/dist/components/LogsSidebar.svelte.d.ts +1 -1
- package/dist/components/MarkdownDisplay.stories.svelte +10 -14
- package/dist/components/MarkdownDisplay.stories.svelte.d.ts +1 -1
- package/dist/components/MarkdownDisplay.svelte +4 -6
- package/dist/components/Navbar.stories.svelte +19 -19
- package/dist/components/Navbar.stories.svelte.d.ts +1 -1
- package/dist/components/Navbar.svelte +28 -49
- package/dist/components/Navbar.svelte.d.ts +2 -2
- package/dist/components/NodeSidebar.svelte +55 -135
- package/dist/components/NodeSidebar.svelte.d.ts +1 -1
- package/dist/components/NodeStatusOverlay.stories.svelte +19 -31
- package/dist/components/NodeStatusOverlay.stories.svelte.d.ts +1 -1
- package/dist/components/NodeStatusOverlay.svelte +40 -55
- package/dist/components/NodeStatusOverlay.svelte.d.ts +3 -3
- package/dist/components/NodeSwapPicker.svelte +493 -0
- package/dist/components/NodeSwapPicker.svelte.d.ts +16 -0
- package/dist/components/PipelineStatus.svelte +63 -89
- package/dist/components/PipelineStatus.svelte.d.ts +4 -4
- package/dist/components/PortCoordinateTracker.svelte +5 -7
- package/dist/components/PortCoordinateTracker.svelte.d.ts +1 -1
- package/dist/components/PortMappingRow.svelte +205 -0
- package/dist/components/PortMappingRow.svelte.d.ts +12 -0
- package/dist/components/ReadOnlyDetails.svelte +1 -1
- package/dist/components/SchemaForm.stories.svelte +53 -53
- package/dist/components/SchemaForm.stories.svelte.d.ts +1 -1
- package/dist/components/SchemaForm.svelte +24 -51
- package/dist/components/SchemaForm.svelte.d.ts +2 -2
- package/dist/components/SettingsModal.svelte +6 -9
- package/dist/components/SettingsModal.svelte.d.ts +1 -1
- package/dist/components/SettingsPanel.svelte +138 -158
- package/dist/components/SettingsPanel.svelte.d.ts +1 -1
- package/dist/components/StatusIcon.stories.svelte +16 -29
- package/dist/components/StatusIcon.stories.svelte.d.ts +1 -1
- package/dist/components/StatusIcon.svelte +19 -19
- package/dist/components/StatusIcon.svelte.d.ts +2 -2
- package/dist/components/StatusLabel.stories.svelte +8 -8
- package/dist/components/StatusLabel.stories.svelte.d.ts +1 -1
- package/dist/components/SwapMappingEditor.svelte +529 -0
- package/dist/components/SwapMappingEditor.svelte.d.ts +12 -0
- package/dist/components/ThemeToggle.stories.svelte +10 -10
- package/dist/components/ThemeToggle.stories.svelte.d.ts +1 -1
- package/dist/components/ThemeToggle.svelte +22 -33
- package/dist/components/ThemeToggle.svelte.d.ts +1 -1
- package/dist/components/UniversalNode.svelte +29 -41
- package/dist/components/UniversalNode.svelte.d.ts +3 -3
- package/dist/components/WorkflowEditor.svelte +210 -170
- package/dist/components/WorkflowEditor.svelte.d.ts +12 -4
- package/dist/components/chat/AIChatPanel.svelte +797 -0
- package/dist/components/chat/AIChatPanel.svelte.d.ts +13 -0
- package/dist/components/chat/CommandPreview.svelte +234 -0
- package/dist/components/chat/CommandPreview.svelte.d.ts +9 -0
- package/dist/components/console/CommandConsole.stories.svelte +111 -0
- package/dist/components/console/CommandConsole.stories.svelte.d.ts +27 -0
- package/dist/components/console/CommandConsole.svelte +263 -0
- package/dist/components/console/CommandConsole.svelte.d.ts +11 -0
- package/dist/components/console/ConsoleAutocomplete.svelte +142 -0
- package/dist/components/console/ConsoleAutocomplete.svelte.d.ts +21 -0
- package/dist/components/console/ConsoleInput.svelte +771 -0
- package/dist/components/console/ConsoleInput.svelte.d.ts +16 -0
- package/dist/components/console/ConsoleOutput.svelte +116 -0
- package/dist/components/console/ConsoleOutput.svelte.d.ts +11 -0
- package/dist/components/console/formatters.d.ts +26 -0
- package/dist/components/console/formatters.js +116 -0
- package/dist/components/form/FormArray.svelte +75 -132
- package/dist/components/form/FormArray.svelte.d.ts +1 -1
- package/dist/components/form/FormAutocomplete.svelte +65 -108
- package/dist/components/form/FormAutocomplete.svelte.d.ts +1 -1
- package/dist/components/form/FormCheckboxGroup.stories.svelte +13 -16
- package/dist/components/form/FormCheckboxGroup.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormCheckboxGroup.svelte +2 -2
- package/dist/components/form/FormCodeEditor.svelte +42 -56
- package/dist/components/form/FormField.svelte +79 -90
- package/dist/components/form/FormField.svelte.d.ts +2 -2
- package/dist/components/form/FormFieldLight.svelte +72 -88
- package/dist/components/form/FormFieldLight.svelte.d.ts +1 -1
- package/dist/components/form/FormFieldWrapper.stories.svelte +14 -14
- package/dist/components/form/FormFieldWrapper.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormFieldWrapper.svelte +2 -9
- package/dist/components/form/FormFieldWrapper.svelte.d.ts +1 -1
- package/dist/components/form/FormFieldset.svelte +3 -3
- package/dist/components/form/FormFieldset.svelte.d.ts +2 -2
- package/dist/components/form/FormMarkdownEditor.svelte +123 -156
- package/dist/components/form/FormNumberField.stories.svelte +18 -18
- package/dist/components/form/FormNumberField.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormNumberField.svelte +6 -6
- package/dist/components/form/FormRangeField.stories.svelte +13 -13
- package/dist/components/form/FormRangeField.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormRangeField.svelte +4 -12
- package/dist/components/form/FormSelect.stories.svelte +21 -21
- package/dist/components/form/FormSelect.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormSelect.svelte +5 -5
- package/dist/components/form/FormSelect.svelte.d.ts +1 -1
- package/dist/components/form/FormTemplateEditor.svelte +126 -175
- package/dist/components/form/FormTemplateEditor.svelte.d.ts +1 -1
- package/dist/components/form/FormTextField.stories.svelte +17 -23
- package/dist/components/form/FormTextField.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormTextField.svelte +4 -4
- package/dist/components/form/FormTextarea.stories.svelte +18 -21
- package/dist/components/form/FormTextarea.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormTextarea.svelte +4 -4
- package/dist/components/form/FormToggle.stories.svelte +13 -16
- package/dist/components/form/FormToggle.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormToggle.svelte +3 -3
- package/dist/components/form/FormUISchemaRenderer.svelte +12 -19
- package/dist/components/form/FormUISchemaRenderer.svelte.d.ts +3 -3
- package/dist/components/form/index.d.ts +19 -19
- package/dist/components/form/index.js +18 -18
- package/dist/components/form/templateAutocomplete.d.ts +2 -2
- package/dist/components/form/templateAutocomplete.js +55 -64
- package/dist/components/form/types.d.ts +6 -6
- package/dist/components/form/types.js +4 -9
- package/dist/components/icons/AlertCircleIcon.svelte +1 -6
- package/dist/components/icons/CogIcon.svelte +1 -6
- package/dist/components/interrupt/ChoicePrompt.stories.svelte +27 -27
- package/dist/components/interrupt/ChoicePrompt.stories.svelte.d.ts +1 -1
- package/dist/components/interrupt/ChoicePrompt.svelte +17 -41
- package/dist/components/interrupt/ChoicePrompt.svelte.d.ts +1 -1
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte +17 -17
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte.d.ts +1 -1
- package/dist/components/interrupt/ConfirmationPrompt.svelte +10 -16
- package/dist/components/interrupt/ConfirmationPrompt.svelte.d.ts +1 -1
- package/dist/components/interrupt/FormPrompt.svelte +10 -15
- package/dist/components/interrupt/FormPrompt.svelte.d.ts +1 -1
- package/dist/components/interrupt/InterruptBubble.svelte +87 -121
- package/dist/components/interrupt/InterruptBubble.svelte.d.ts +2 -2
- package/dist/components/interrupt/ReviewPrompt.stories.svelte +37 -37
- package/dist/components/interrupt/ReviewPrompt.stories.svelte.d.ts +1 -1
- package/dist/components/interrupt/ReviewPrompt.svelte +55 -75
- package/dist/components/interrupt/ReviewPrompt.svelte.d.ts +1 -1
- package/dist/components/interrupt/TextInputPrompt.stories.svelte +16 -17
- package/dist/components/interrupt/TextInputPrompt.stories.svelte.d.ts +1 -1
- package/dist/components/interrupt/TextInputPrompt.svelte +13 -18
- package/dist/components/interrupt/TextInputPrompt.svelte.d.ts +1 -1
- package/dist/components/interrupt/index.d.ts +6 -5
- package/dist/components/interrupt/index.js +6 -5
- package/dist/components/layouts/MainLayout.svelte +46 -84
- package/dist/components/layouts/MainLayout.svelte.d.ts +6 -6
- package/dist/components/nodes/GatewayNode.stories.svelte +64 -65
- package/dist/components/nodes/GatewayNode.svelte +37 -70
- package/dist/components/nodes/GatewayNode.svelte.d.ts +3 -3
- package/dist/components/nodes/IdeaNode.stories.svelte +25 -26
- package/dist/components/nodes/IdeaNode.svelte +22 -36
- package/dist/components/nodes/IdeaNode.svelte.d.ts +1 -1
- package/dist/components/nodes/NotesNode.stories.svelte +37 -38
- package/dist/components/nodes/NotesNode.svelte +28 -39
- package/dist/components/nodes/NotesNode.svelte.d.ts +1 -1
- package/dist/components/nodes/SimpleNode.stories.svelte +137 -138
- package/dist/components/nodes/SimpleNode.svelte +44 -74
- package/dist/components/nodes/SimpleNode.svelte.d.ts +1 -1
- package/dist/components/nodes/SquareNode.stories.svelte +75 -75
- package/dist/components/nodes/SquareNode.svelte +42 -68
- package/dist/components/nodes/SquareNode.svelte.d.ts +1 -1
- package/dist/components/nodes/TerminalNode.stories.svelte +10 -10
- package/dist/components/nodes/TerminalNode.svelte +74 -112
- package/dist/components/nodes/TerminalNode.svelte.d.ts +1 -1
- package/dist/components/nodes/ToolNode.stories.svelte +115 -116
- package/dist/components/nodes/ToolNode.svelte +31 -64
- package/dist/components/nodes/ToolNode.svelte.d.ts +1 -1
- package/dist/components/nodes/WorkflowNode.stories.svelte +84 -89
- package/dist/components/nodes/WorkflowNode.svelte +50 -103
- package/dist/components/nodes/WorkflowNode.svelte.d.ts +3 -3
- package/dist/components/playground/ChatPanel.svelte +47 -103
- package/dist/components/playground/ExecutionLogs.svelte +45 -68
- package/dist/components/playground/InputCollector.svelte +32 -51
- package/dist/components/playground/MessageBubble.stories.svelte +25 -25
- package/dist/components/playground/MessageBubble.stories.svelte.d.ts +1 -1
- package/dist/components/playground/MessageBubble.svelte +54 -70
- package/dist/components/playground/MessageBubble.svelte.d.ts +1 -1
- package/dist/components/playground/Playground.svelte +60 -91
- package/dist/components/playground/Playground.svelte.d.ts +3 -3
- package/dist/components/playground/PlaygroundModal.svelte +8 -12
- package/dist/components/playground/PlaygroundModal.svelte.d.ts +3 -3
- package/dist/components/playground/SessionManager.svelte +34 -40
- package/dist/components/playground/SessionManager.svelte.d.ts +1 -1
- package/dist/config/agentSpecEndpoints.d.ts +1 -1
- package/dist/config/agentSpecEndpoints.js +20 -20
- package/dist/config/constants.js +2 -2
- package/dist/config/defaultCategories.d.ts +1 -1
- package/dist/config/defaultCategories.js +86 -86
- package/dist/config/defaultPortConfig.d.ts +1 -1
- package/dist/config/defaultPortConfig.js +144 -144
- package/dist/config/endpoints.d.ts +12 -4
- package/dist/config/endpoints.js +70 -65
- package/dist/config/runtimeConfig.d.ts +2 -2
- package/dist/config/runtimeConfig.js +8 -8
- package/dist/core/index.d.ts +68 -63
- package/dist/core/index.js +44 -35
- package/dist/display/index.d.ts +2 -2
- package/dist/display/index.js +2 -2
- package/dist/editor/index.d.ts +64 -62
- package/dist/editor/index.js +57 -55
- package/dist/form/code.d.ts +5 -5
- package/dist/form/code.js +14 -14
- package/dist/form/fieldRegistry.d.ts +3 -3
- package/dist/form/fieldRegistry.js +9 -11
- package/dist/form/full.d.ts +8 -8
- package/dist/form/full.js +9 -9
- package/dist/form/index.d.ts +18 -18
- package/dist/form/index.js +16 -16
- package/dist/form/markdown.d.ts +4 -4
- package/dist/form/markdown.js +8 -8
- package/dist/helpers/proximityConnect.d.ts +3 -3
- package/dist/helpers/proximityConnect.js +40 -35
- package/dist/helpers/workflowEditorHelper.d.ts +8 -58
- package/dist/helpers/workflowEditorHelper.js +73 -292
- package/dist/index.d.ts +6 -6
- package/dist/index.js +6 -6
- package/dist/mocks/app-environment.js +2 -2
- package/dist/mocks/app-forms.js +1 -1
- package/dist/mocks/app-navigation.js +2 -2
- package/dist/mocks/app-stores.js +3 -3
- package/dist/playground/index.d.ts +19 -19
- package/dist/playground/index.js +16 -16
- package/dist/playground/mount.d.ts +3 -3
- package/dist/playground/mount.js +24 -24
- package/dist/registry/builtinFormats.js +13 -13
- package/dist/registry/builtinNodes.d.ts +2 -2
- package/dist/registry/builtinNodes.js +77 -77
- package/dist/registry/index.d.ts +4 -4
- package/dist/registry/index.js +4 -4
- package/dist/registry/nodeComponentRegistry.d.ts +8 -8
- package/dist/registry/nodeComponentRegistry.js +9 -11
- package/dist/registry/plugin.d.ts +2 -2
- package/dist/registry/plugin.js +11 -11
- package/dist/registry/workflowFormatRegistry.d.ts +3 -3
- package/dist/registry/workflowFormatRegistry.js +2 -2
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.js +2 -2
- package/dist/schemas/v1/workflow.schema.json +107 -22
- package/dist/services/agentSpecExecutionService.d.ts +3 -3
- package/dist/services/agentSpecExecutionService.js +55 -56
- package/dist/services/api.d.ts +2 -2
- package/dist/services/api.js +37 -37
- package/dist/services/apiVariableService.d.ts +1 -1
- package/dist/services/apiVariableService.js +34 -41
- package/dist/services/autoSaveService.js +8 -8
- package/dist/services/categoriesApi.d.ts +2 -2
- package/dist/services/categoriesApi.js +8 -8
- package/dist/services/chatService.d.ts +65 -0
- package/dist/services/chatService.js +131 -0
- package/dist/services/draftStorage.d.ts +1 -1
- package/dist/services/draftStorage.js +11 -11
- package/dist/services/dynamicSchemaService.d.ts +1 -1
- package/dist/services/dynamicSchemaService.js +39 -41
- package/dist/services/globalSave.d.ts +2 -2
- package/dist/services/globalSave.js +38 -41
- package/dist/services/historyService.d.ts +7 -5
- package/dist/services/historyService.js +29 -14
- package/dist/services/interruptService.d.ts +1 -1
- package/dist/services/interruptService.js +29 -35
- package/dist/services/nodeExecutionService.d.ts +1 -1
- package/dist/services/nodeExecutionService.js +44 -45
- package/dist/services/playgroundService.d.ts +1 -1
- package/dist/services/playgroundService.js +29 -29
- package/dist/services/portConfigApi.d.ts +2 -2
- package/dist/services/portConfigApi.js +8 -8
- package/dist/services/settingsService.d.ts +2 -2
- package/dist/services/settingsService.js +19 -25
- package/dist/services/toastService.d.ts +4 -4
- package/dist/services/toastService.js +33 -33
- package/dist/services/variableService.d.ts +1 -1
- package/dist/services/variableService.js +36 -36
- package/dist/services/workflowStorage.d.ts +2 -2
- package/dist/services/workflowStorage.js +13 -13
- package/dist/settings/index.d.ts +7 -7
- package/dist/settings/index.js +6 -6
- package/dist/skins/default.d.ts +1 -1
- package/dist/skins/default.js +1 -1
- package/dist/skins/index.d.ts +3 -3
- package/dist/skins/index.js +7 -7
- package/dist/skins/slate.d.ts +1 -1
- package/dist/skins/slate.js +69 -69
- package/dist/stores/categoriesStore.svelte.d.ts +1 -1
- package/dist/stores/categoriesStore.svelte.js +5 -5
- package/dist/stores/editorStateMachine.svelte.d.ts +2 -2
- package/dist/stores/editorStateMachine.svelte.js +34 -34
- package/dist/stores/historyStore.svelte.d.ts +4 -4
- package/dist/stores/historyStore.svelte.js +4 -4
- package/dist/stores/interruptStore.svelte.d.ts +3 -3
- package/dist/stores/interruptStore.svelte.js +27 -22
- package/dist/stores/playgroundStore.svelte.d.ts +3 -3
- package/dist/stores/playgroundStore.svelte.js +29 -23
- package/dist/stores/portCoordinateStore.svelte.d.ts +6 -2
- package/dist/stores/portCoordinateStore.svelte.js +30 -39
- package/dist/stores/settingsStore.svelte.d.ts +2 -2
- package/dist/stores/settingsStore.svelte.js +57 -62
- package/dist/stores/workflowStore.svelte.d.ts +34 -5
- package/dist/stores/workflowStore.svelte.js +127 -108
- package/dist/stories/CanvasDecorator.svelte +7 -10
- package/dist/stories/CanvasDecorator.svelte.d.ts +2 -2
- package/dist/stories/EdgeDecorator.svelte +28 -31
- package/dist/stories/EdgeDecorator.svelte.d.ts +1 -1
- package/dist/stories/NodeDecorator.svelte +14 -20
- package/dist/stories/NodeDecorator.svelte.d.ts +1 -1
- package/dist/stories/utils.d.ts +2 -2
- package/dist/stories/utils.js +89 -93
- package/dist/styles/base.css +16 -50
- package/dist/styles/tokens.css +10 -28
- package/dist/svelte-app.d.ts +10 -10
- package/dist/svelte-app.js +39 -39
- package/dist/themes/default.d.ts +1 -1
- package/dist/themes/default.js +4 -4
- package/dist/themes/index.d.ts +3 -3
- package/dist/themes/index.js +11 -11
- package/dist/themes/minimal.d.ts +1 -1
- package/dist/themes/minimal.js +5 -5
- package/dist/types/agentspec.d.ts +18 -18
- package/dist/types/agentspec.js +2 -2
- package/dist/types/auth.d.ts +1 -1
- package/dist/types/auth.js +6 -6
- package/dist/types/chat.d.ts +63 -0
- package/dist/types/chat.js +9 -0
- package/dist/types/config.d.ts +6 -6
- package/dist/types/events.d.ts +28 -2
- package/dist/types/events.js +2 -1
- package/dist/types/index.d.ts +40 -32
- package/dist/types/index.js +6 -6
- package/dist/types/interrupt.d.ts +6 -6
- package/dist/types/interrupt.js +21 -21
- package/dist/types/interruptState.d.ts +12 -12
- package/dist/types/interruptState.js +66 -66
- package/dist/types/playground.d.ts +7 -7
- package/dist/types/playground.js +14 -14
- package/dist/types/settings.d.ts +12 -4
- package/dist/types/settings.js +21 -23
- package/dist/types/skin.d.ts +1 -1
- package/dist/types/theme.d.ts +2 -2
- package/dist/types/uischema.d.ts +4 -4
- package/dist/types/uischema.js +3 -3
- package/dist/utils/colors.d.ts +1 -1
- package/dist/utils/colors.js +95 -97
- package/dist/utils/config.d.ts +2 -2
- package/dist/utils/config.js +48 -48
- package/dist/utils/connections.d.ts +2 -2
- package/dist/utils/connections.js +15 -15
- package/dist/utils/edgeStyling.d.ts +42 -0
- package/dist/utils/edgeStyling.js +173 -0
- package/dist/utils/errors.js +3 -3
- package/dist/utils/fetchWithAuth.d.ts +1 -1
- package/dist/utils/fetchWithAuth.js +2 -2
- package/dist/utils/handleIds.d.ts +2 -2
- package/dist/utils/handleIds.js +8 -8
- package/dist/utils/handlePositioning.d.ts +1 -1
- package/dist/utils/handlePositioning.js +2 -2
- package/dist/utils/icons.d.ts +1 -1
- package/dist/utils/icons.js +74 -74
- package/dist/utils/logger.d.ts +1 -1
- package/dist/utils/logger.js +7 -7
- package/dist/utils/nodeIds.d.ts +31 -0
- package/dist/utils/nodeIds.js +42 -0
- package/dist/utils/nodeStatus.d.ts +1 -1
- package/dist/utils/nodeStatus.js +48 -48
- package/dist/utils/nodeSwap.d.ts +221 -0
- package/dist/utils/nodeSwap.js +680 -0
- package/dist/utils/nodeTypes.d.ts +1 -1
- package/dist/utils/nodeTypes.js +20 -21
- package/dist/utils/nodeWrapper.d.ts +7 -7
- package/dist/utils/nodeWrapper.js +19 -21
- package/dist/utils/performanceUtils.d.ts +1 -1
- package/dist/utils/performanceUtils.js +1 -2
- package/dist/utils/portUtils.d.ts +2 -2
- package/dist/utils/portUtils.js +1 -1
- package/dist/utils/sanitize.js +1 -1
- package/dist/utils/uischema.d.ts +2 -2
- package/dist/utils/uischema.js +8 -8
- package/dist/utils/validation.js +8 -8
- package/package.json +12 -11
- package/dist/helpers/nodeLayoutHelper.d.ts +0 -14
- package/dist/helpers/nodeLayoutHelper.js +0 -19
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module services/autoSaveService
|
|
8
8
|
*/
|
|
9
|
-
import { getBehaviorSettings, onSettingsChange
|
|
10
|
-
import { isDirty } from
|
|
11
|
-
import { logger } from
|
|
9
|
+
import { getBehaviorSettings, onSettingsChange } from '../stores/settingsStore.svelte.js';
|
|
10
|
+
import { isDirty } from '../stores/workflowStore.svelte.js';
|
|
11
|
+
import { logger } from '../utils/logger.js';
|
|
12
12
|
/**
|
|
13
13
|
* Initialize auto-save functionality based on user settings
|
|
14
14
|
*
|
|
@@ -45,7 +45,7 @@ export function initAutoSave(options) {
|
|
|
45
45
|
intervalId: null,
|
|
46
46
|
isSaving: false,
|
|
47
47
|
settingsUnsubscriber: null,
|
|
48
|
-
dirtyUnsubscriber: null
|
|
48
|
+
dirtyUnsubscriber: null
|
|
49
49
|
};
|
|
50
50
|
/**
|
|
51
51
|
* Perform auto-save if conditions are met
|
|
@@ -62,7 +62,7 @@ export function initAutoSave(options) {
|
|
|
62
62
|
}
|
|
63
63
|
catch (error) {
|
|
64
64
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
65
|
-
logger.error(
|
|
65
|
+
logger.error('Auto-save failed:', err);
|
|
66
66
|
onError?.(err);
|
|
67
67
|
}
|
|
68
68
|
finally {
|
|
@@ -88,7 +88,7 @@ export function initAutoSave(options) {
|
|
|
88
88
|
}
|
|
89
89
|
// Listen for settings changes to react to auto-save toggle/interval changes
|
|
90
90
|
state.settingsUnsubscriber = onSettingsChange((event) => {
|
|
91
|
-
if (event.category ===
|
|
91
|
+
if (event.category === 'behavior') {
|
|
92
92
|
updateAutoSaveInterval();
|
|
93
93
|
}
|
|
94
94
|
});
|
|
@@ -147,7 +147,7 @@ export class AutoSaveManager {
|
|
|
147
147
|
return; // Already started
|
|
148
148
|
}
|
|
149
149
|
this.settingsUnsubscriber = onSettingsChange((event) => {
|
|
150
|
-
if (event.category ===
|
|
150
|
+
if (event.category === 'behavior') {
|
|
151
151
|
this.updateInterval();
|
|
152
152
|
}
|
|
153
153
|
});
|
|
@@ -217,7 +217,7 @@ export class AutoSaveManager {
|
|
|
217
217
|
}
|
|
218
218
|
catch (error) {
|
|
219
219
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
220
|
-
logger.error(
|
|
220
|
+
logger.error('Auto-save failed:', err);
|
|
221
221
|
this.onError?.(err);
|
|
222
222
|
}
|
|
223
223
|
finally {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Categories API Service
|
|
3
3
|
* Handles fetching category definitions from the backend
|
|
4
4
|
*/
|
|
5
|
-
import type { CategoryDefinition } from
|
|
6
|
-
import type { EndpointConfig } from
|
|
5
|
+
import type { CategoryDefinition } from '../types/index.js';
|
|
6
|
+
import type { EndpointConfig } from '../config/endpoints.js';
|
|
7
7
|
/**
|
|
8
8
|
* Fetch category definitions from API
|
|
9
9
|
*/
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Categories API Service
|
|
3
3
|
* Handles fetching category definitions from the backend
|
|
4
4
|
*/
|
|
5
|
-
import { buildEndpointUrl } from
|
|
6
|
-
import { DEFAULT_CATEGORIES } from
|
|
7
|
-
import { logger } from
|
|
5
|
+
import { buildEndpointUrl } from '../config/endpoints.js';
|
|
6
|
+
import { DEFAULT_CATEGORIES } from '../config/defaultCategories.js';
|
|
7
|
+
import { logger } from '../utils/logger.js';
|
|
8
8
|
/**
|
|
9
9
|
* Fetch category definitions from API
|
|
10
10
|
*/
|
|
@@ -12,7 +12,7 @@ export async function fetchCategories(endpointConfig) {
|
|
|
12
12
|
try {
|
|
13
13
|
const url = buildEndpointUrl(endpointConfig, endpointConfig.endpoints.categories);
|
|
14
14
|
const response = await fetch(url, {
|
|
15
|
-
headers: {
|
|
15
|
+
headers: { 'Content-Type': 'application/json' }
|
|
16
16
|
});
|
|
17
17
|
if (!response.ok) {
|
|
18
18
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
@@ -20,13 +20,13 @@ export async function fetchCategories(endpointConfig) {
|
|
|
20
20
|
const data = await response.json();
|
|
21
21
|
const categories = data.data ?? data;
|
|
22
22
|
if (!categories || !Array.isArray(categories)) {
|
|
23
|
-
logger.warn(
|
|
23
|
+
logger.warn('Invalid categories received from API, using default');
|
|
24
24
|
return DEFAULT_CATEGORIES;
|
|
25
25
|
}
|
|
26
26
|
return categories;
|
|
27
27
|
}
|
|
28
28
|
catch (error) {
|
|
29
|
-
logger.error(
|
|
29
|
+
logger.error('Error fetching categories:', error);
|
|
30
30
|
return DEFAULT_CATEGORIES;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -38,10 +38,10 @@ export function validateCategories(categories) {
|
|
|
38
38
|
return false;
|
|
39
39
|
}
|
|
40
40
|
for (const category of categories) {
|
|
41
|
-
if (!category.name || typeof category.name !==
|
|
41
|
+
if (!category.name || typeof category.name !== 'string') {
|
|
42
42
|
return false;
|
|
43
43
|
}
|
|
44
|
-
if (!category.label || typeof category.label !==
|
|
44
|
+
if (!category.label || typeof category.label !== 'string') {
|
|
45
45
|
return false;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat Service
|
|
3
|
+
*
|
|
4
|
+
* Handles API interactions for the LLM Chat feature including
|
|
5
|
+
* sending messages, retrieving history, and clearing history.
|
|
6
|
+
*
|
|
7
|
+
* @module services/chatService
|
|
8
|
+
*/
|
|
9
|
+
import type { ChatRequest, ChatResponse, ChatHistoryMessage } from '../types/chat.js';
|
|
10
|
+
/**
|
|
11
|
+
* Chat Service class
|
|
12
|
+
*
|
|
13
|
+
* Provides methods to interact with the chat API endpoints
|
|
14
|
+
* for LLM-powered workflow building assistance.
|
|
15
|
+
*/
|
|
16
|
+
export declare class ChatService {
|
|
17
|
+
private static instance;
|
|
18
|
+
private constructor();
|
|
19
|
+
/**
|
|
20
|
+
* Get the singleton instance of ChatService
|
|
21
|
+
*
|
|
22
|
+
* @returns The ChatService singleton instance
|
|
23
|
+
*/
|
|
24
|
+
static getInstance(): ChatService;
|
|
25
|
+
/**
|
|
26
|
+
* Get the endpoint configuration
|
|
27
|
+
*
|
|
28
|
+
* @throws Error if endpoint configuration is not set
|
|
29
|
+
* @returns The endpoint configuration
|
|
30
|
+
*/
|
|
31
|
+
private getConfig;
|
|
32
|
+
/**
|
|
33
|
+
* Generic API request helper
|
|
34
|
+
*
|
|
35
|
+
* @param url - The URL to fetch
|
|
36
|
+
* @param options - Fetch options
|
|
37
|
+
* @returns The parsed JSON response
|
|
38
|
+
*/
|
|
39
|
+
private request;
|
|
40
|
+
/**
|
|
41
|
+
* Send a message to the chat endpoint
|
|
42
|
+
*
|
|
43
|
+
* @param workflowId - The workflow ID
|
|
44
|
+
* @param request - The chat request payload
|
|
45
|
+
* @returns The chat response from the LLM
|
|
46
|
+
*/
|
|
47
|
+
sendMessage(workflowId: string, request: ChatRequest): Promise<ChatResponse>;
|
|
48
|
+
/**
|
|
49
|
+
* Get conversation history for a workflow
|
|
50
|
+
*
|
|
51
|
+
* @param workflowId - The workflow ID
|
|
52
|
+
* @returns Array of chat history messages
|
|
53
|
+
*/
|
|
54
|
+
getHistory(workflowId: string): Promise<ChatHistoryMessage[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Clear conversation history for a workflow
|
|
57
|
+
*
|
|
58
|
+
* @param workflowId - The workflow ID
|
|
59
|
+
*/
|
|
60
|
+
clearHistory(workflowId: string): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Pre-instantiated ChatService singleton
|
|
64
|
+
*/
|
|
65
|
+
export declare const chatService: ChatService;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat Service
|
|
3
|
+
*
|
|
4
|
+
* Handles API interactions for the LLM Chat feature including
|
|
5
|
+
* sending messages, retrieving history, and clearing history.
|
|
6
|
+
*
|
|
7
|
+
* @module services/chatService
|
|
8
|
+
*/
|
|
9
|
+
import { buildEndpointUrl, getEndpointHeaders } from '../config/endpoints.js';
|
|
10
|
+
import { getEndpointConfig } from './api.js';
|
|
11
|
+
import { logger } from '../utils/logger.js';
|
|
12
|
+
/**
|
|
13
|
+
* Chat Service class
|
|
14
|
+
*
|
|
15
|
+
* Provides methods to interact with the chat API endpoints
|
|
16
|
+
* for LLM-powered workflow building assistance.
|
|
17
|
+
*/
|
|
18
|
+
export class ChatService {
|
|
19
|
+
static instance;
|
|
20
|
+
constructor() { }
|
|
21
|
+
/**
|
|
22
|
+
* Get the singleton instance of ChatService
|
|
23
|
+
*
|
|
24
|
+
* @returns The ChatService singleton instance
|
|
25
|
+
*/
|
|
26
|
+
static getInstance() {
|
|
27
|
+
if (!ChatService.instance) {
|
|
28
|
+
ChatService.instance = new ChatService();
|
|
29
|
+
}
|
|
30
|
+
return ChatService.instance;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get the endpoint configuration
|
|
34
|
+
*
|
|
35
|
+
* @throws Error if endpoint configuration is not set
|
|
36
|
+
* @returns The endpoint configuration
|
|
37
|
+
*/
|
|
38
|
+
getConfig() {
|
|
39
|
+
const config = getEndpointConfig();
|
|
40
|
+
if (!config) {
|
|
41
|
+
throw new Error('Endpoint configuration not set. Call setEndpointConfig() first.');
|
|
42
|
+
}
|
|
43
|
+
return config;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Generic API request helper
|
|
47
|
+
*
|
|
48
|
+
* @param url - The URL to fetch
|
|
49
|
+
* @param options - Fetch options
|
|
50
|
+
* @returns The parsed JSON response
|
|
51
|
+
*/
|
|
52
|
+
async request(url, options = {}) {
|
|
53
|
+
const config = this.getConfig();
|
|
54
|
+
const headers = getEndpointHeaders(config, 'chat');
|
|
55
|
+
const response = await fetch(url, {
|
|
56
|
+
...options,
|
|
57
|
+
headers: {
|
|
58
|
+
...headers,
|
|
59
|
+
...options.headers
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
if (!response.ok) {
|
|
63
|
+
const errorData = await response.json().catch(() => ({}));
|
|
64
|
+
const errorMessage = errorData.error ||
|
|
65
|
+
errorData.message ||
|
|
66
|
+
`HTTP ${response.status}: ${response.statusText}`;
|
|
67
|
+
throw new Error(errorMessage);
|
|
68
|
+
}
|
|
69
|
+
const json = await response.json();
|
|
70
|
+
// Unwrap the { success, data } envelope used by the Drupal backend.
|
|
71
|
+
if (json && typeof json === 'object' && 'data' in json) {
|
|
72
|
+
return json.data;
|
|
73
|
+
}
|
|
74
|
+
return json;
|
|
75
|
+
}
|
|
76
|
+
// =========================================================================
|
|
77
|
+
// Chat Operations
|
|
78
|
+
// =========================================================================
|
|
79
|
+
/**
|
|
80
|
+
* Send a message to the chat endpoint
|
|
81
|
+
*
|
|
82
|
+
* @param workflowId - The workflow ID
|
|
83
|
+
* @param request - The chat request payload
|
|
84
|
+
* @returns The chat response from the LLM
|
|
85
|
+
*/
|
|
86
|
+
async sendMessage(workflowId, request) {
|
|
87
|
+
const config = this.getConfig();
|
|
88
|
+
const url = buildEndpointUrl(config, config.endpoints.chat.sendMessage, {
|
|
89
|
+
id: workflowId
|
|
90
|
+
});
|
|
91
|
+
logger.debug('[ChatService] Sending message to', url);
|
|
92
|
+
return this.request(url, {
|
|
93
|
+
method: 'POST',
|
|
94
|
+
body: JSON.stringify(request)
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Get conversation history for a workflow
|
|
99
|
+
*
|
|
100
|
+
* @param workflowId - The workflow ID
|
|
101
|
+
* @returns Array of chat history messages
|
|
102
|
+
*/
|
|
103
|
+
async getHistory(workflowId) {
|
|
104
|
+
const config = this.getConfig();
|
|
105
|
+
const url = buildEndpointUrl(config, config.endpoints.chat.getHistory, {
|
|
106
|
+
id: workflowId
|
|
107
|
+
});
|
|
108
|
+
logger.debug('[ChatService] Getting history from', url);
|
|
109
|
+
return this.request(url);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Clear conversation history for a workflow
|
|
113
|
+
*
|
|
114
|
+
* @param workflowId - The workflow ID
|
|
115
|
+
*/
|
|
116
|
+
async clearHistory(workflowId) {
|
|
117
|
+
const config = this.getConfig();
|
|
118
|
+
const url = buildEndpointUrl(config, config.endpoints.chat.clearHistory, {
|
|
119
|
+
id: workflowId
|
|
120
|
+
});
|
|
121
|
+
logger.debug('[ChatService] Clearing history at', url);
|
|
122
|
+
await fetch(url, {
|
|
123
|
+
method: 'DELETE',
|
|
124
|
+
headers: getEndpointHeaders(config, 'chat')
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Pre-instantiated ChatService singleton
|
|
130
|
+
*/
|
|
131
|
+
export const chatService = ChatService.getInstance();
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module services/draftStorage
|
|
8
8
|
*/
|
|
9
|
-
import { logger } from
|
|
9
|
+
import { logger } from '../utils/logger.js';
|
|
10
10
|
/**
|
|
11
11
|
* Default storage key prefix
|
|
12
12
|
*/
|
|
13
|
-
const STORAGE_KEY_PREFIX =
|
|
13
|
+
const STORAGE_KEY_PREFIX = 'flowdrop:draft';
|
|
14
14
|
/**
|
|
15
15
|
* Generate a storage key for a workflow
|
|
16
16
|
*
|
|
@@ -44,15 +44,15 @@ export function saveDraft(workflow, storageKey) {
|
|
|
44
44
|
metadata: {
|
|
45
45
|
savedAt: new Date().toISOString(),
|
|
46
46
|
workflowId: workflow.id,
|
|
47
|
-
workflowName: workflow.name
|
|
48
|
-
}
|
|
47
|
+
workflowName: workflow.name
|
|
48
|
+
}
|
|
49
49
|
};
|
|
50
50
|
localStorage.setItem(storageKey, JSON.stringify(draft));
|
|
51
51
|
return true;
|
|
52
52
|
}
|
|
53
53
|
catch (error) {
|
|
54
54
|
// localStorage might be full or disabled
|
|
55
|
-
logger.warn(
|
|
55
|
+
logger.warn('Failed to save draft to localStorage:', error);
|
|
56
56
|
return false;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -71,13 +71,13 @@ export function loadDraft(storageKey) {
|
|
|
71
71
|
const draft = JSON.parse(stored);
|
|
72
72
|
// Validate the draft structure
|
|
73
73
|
if (!draft.workflow || !draft.metadata) {
|
|
74
|
-
logger.warn(
|
|
74
|
+
logger.warn('Invalid draft structure in localStorage');
|
|
75
75
|
return null;
|
|
76
76
|
}
|
|
77
77
|
return draft;
|
|
78
78
|
}
|
|
79
79
|
catch (error) {
|
|
80
|
-
logger.warn(
|
|
80
|
+
logger.warn('Failed to load draft from localStorage:', error);
|
|
81
81
|
return null;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -91,7 +91,7 @@ export function deleteDraft(storageKey) {
|
|
|
91
91
|
localStorage.removeItem(storageKey);
|
|
92
92
|
}
|
|
93
93
|
catch (error) {
|
|
94
|
-
logger.warn(
|
|
94
|
+
logger.warn('Failed to delete draft from localStorage:', error);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
@@ -272,15 +272,15 @@ export class DraftAutoSaveManager {
|
|
|
272
272
|
nodes: workflow.nodes.map((n) => ({
|
|
273
273
|
id: n.id,
|
|
274
274
|
position: n.position,
|
|
275
|
-
data: n.data
|
|
275
|
+
data: n.data
|
|
276
276
|
})),
|
|
277
277
|
edges: workflow.edges.map((e) => ({
|
|
278
278
|
id: e.id,
|
|
279
279
|
source: e.source,
|
|
280
280
|
target: e.target,
|
|
281
281
|
sourceHandle: e.sourceHandle,
|
|
282
|
-
targetHandle: e.targetHandle
|
|
283
|
-
}))
|
|
282
|
+
targetHandle: e.targetHandle
|
|
283
|
+
}))
|
|
284
284
|
};
|
|
285
285
|
return JSON.stringify(toHash);
|
|
286
286
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @module services/dynamicSchemaService
|
|
7
7
|
*/
|
|
8
|
-
import type { ConfigSchema, DynamicSchemaEndpoint, ExternalEditLink, ConfigEditOptions, WorkflowNode } from
|
|
8
|
+
import type { ConfigSchema, DynamicSchemaEndpoint, ExternalEditLink, ConfigEditOptions, WorkflowNode } from '../types/index.js';
|
|
9
9
|
/**
|
|
10
10
|
* Result of a dynamic schema fetch operation
|
|
11
11
|
*/
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @module services/dynamicSchemaService
|
|
7
7
|
*/
|
|
8
|
-
import { getEndpointConfig } from
|
|
9
|
-
import { DEFAULT_CACHE_TTL_MS } from
|
|
8
|
+
import { getEndpointConfig } from './api.js';
|
|
9
|
+
import { DEFAULT_CACHE_TTL_MS } from '../config/constants.js';
|
|
10
10
|
/**
|
|
11
11
|
* Schema cache with TTL support
|
|
12
12
|
* Key format: `{nodeTypeId}:{instanceId}` or `{nodeTypeId}` for type-level caching
|
|
@@ -30,13 +30,13 @@ const DEFAULT_CACHE_TTL = DEFAULT_CACHE_TTL_MS;
|
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
32
|
function resolveVariablePath(context, path) {
|
|
33
|
-
const parts = path.split(
|
|
33
|
+
const parts = path.split('.');
|
|
34
34
|
let current = context;
|
|
35
35
|
for (const part of parts) {
|
|
36
36
|
if (current === null || current === undefined) {
|
|
37
37
|
return undefined;
|
|
38
38
|
}
|
|
39
|
-
if (typeof current ===
|
|
39
|
+
if (typeof current === 'object' && part in current) {
|
|
40
40
|
current = current[part];
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
@@ -77,7 +77,7 @@ function resolveTemplate(template, parameterMapping, context) {
|
|
|
77
77
|
const value = resolveVariablePath(context, contextPath);
|
|
78
78
|
if (value !== undefined) {
|
|
79
79
|
// Use global regex to replace all occurrences
|
|
80
|
-
const regex = new RegExp(`\\{${variableName}\\}`,
|
|
80
|
+
const regex = new RegExp(`\\{${variableName}\\}`, 'g');
|
|
81
81
|
resolved = resolved.replace(regex, encodeURIComponent(value));
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -145,7 +145,7 @@ export async function fetchDynamicSchema(endpoint, node, workflowId) {
|
|
|
145
145
|
metadata: node.data.metadata,
|
|
146
146
|
config: node.data.config,
|
|
147
147
|
extensions: node.data.extensions,
|
|
148
|
-
workflowId
|
|
148
|
+
workflowId
|
|
149
149
|
};
|
|
150
150
|
// Generate cache key
|
|
151
151
|
const cacheKey = generateCacheKey(endpoint, context);
|
|
@@ -156,41 +156,39 @@ export async function fetchDynamicSchema(endpoint, node, workflowId) {
|
|
|
156
156
|
return {
|
|
157
157
|
success: true,
|
|
158
158
|
schema: cached.schema,
|
|
159
|
-
fromCache: true
|
|
159
|
+
fromCache: true
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
// Resolve the URL with template variables
|
|
164
164
|
let url = resolveTemplate(endpoint.url, endpoint.parameterMapping, context);
|
|
165
165
|
// If URL is relative, try to prepend base URL from endpoint config
|
|
166
|
-
if (url.startsWith(
|
|
166
|
+
if (url.startsWith('/')) {
|
|
167
167
|
const currentConfig = getEndpointConfig();
|
|
168
168
|
if (currentConfig?.baseUrl) {
|
|
169
169
|
// Remove trailing slash from base URL and leading slash from relative URL
|
|
170
|
-
const baseUrl = currentConfig.baseUrl.replace(/\/$/,
|
|
170
|
+
const baseUrl = currentConfig.baseUrl.replace(/\/$/, '');
|
|
171
171
|
url = `${baseUrl}${url}`;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
// Prepare request options
|
|
175
|
-
const method = endpoint.method ??
|
|
175
|
+
const method = endpoint.method ?? 'GET';
|
|
176
176
|
const timeout = endpoint.timeout ?? 10000;
|
|
177
177
|
const headers = {
|
|
178
|
-
Accept:
|
|
179
|
-
|
|
180
|
-
...endpoint.headers
|
|
178
|
+
Accept: 'application/json',
|
|
179
|
+
'Content-Type': 'application/json',
|
|
180
|
+
...endpoint.headers
|
|
181
181
|
};
|
|
182
182
|
// Add auth headers from endpoint config if available
|
|
183
183
|
const currentConfig = getEndpointConfig();
|
|
184
184
|
if (currentConfig?.auth) {
|
|
185
|
-
if (currentConfig.auth.type ===
|
|
186
|
-
headers[
|
|
185
|
+
if (currentConfig.auth.type === 'bearer' && currentConfig.auth.token) {
|
|
186
|
+
headers['Authorization'] = `Bearer ${currentConfig.auth.token}`;
|
|
187
187
|
}
|
|
188
|
-
else if (currentConfig.auth.type ===
|
|
189
|
-
currentConfig.auth.apiKey
|
|
190
|
-
headers["X-API-Key"] = currentConfig.auth.apiKey;
|
|
188
|
+
else if (currentConfig.auth.type === 'api_key' && currentConfig.auth.apiKey) {
|
|
189
|
+
headers['X-API-Key'] = currentConfig.auth.apiKey;
|
|
191
190
|
}
|
|
192
|
-
else if (currentConfig.auth.type ===
|
|
193
|
-
currentConfig.auth.headers) {
|
|
191
|
+
else if (currentConfig.auth.type === 'custom' && currentConfig.auth.headers) {
|
|
194
192
|
Object.assign(headers, currentConfig.auth.headers);
|
|
195
193
|
}
|
|
196
194
|
}
|
|
@@ -198,14 +196,14 @@ export async function fetchDynamicSchema(endpoint, node, workflowId) {
|
|
|
198
196
|
const fetchOptions = {
|
|
199
197
|
method,
|
|
200
198
|
headers,
|
|
201
|
-
signal: AbortSignal.timeout(timeout)
|
|
199
|
+
signal: AbortSignal.timeout(timeout)
|
|
202
200
|
};
|
|
203
201
|
// Add body for non-GET requests
|
|
204
|
-
if (method !==
|
|
202
|
+
if (method !== 'GET' && endpoint.body) {
|
|
205
203
|
// Resolve any template variables in the body
|
|
206
204
|
const resolvedBody = {};
|
|
207
205
|
for (const [key, value] of Object.entries(endpoint.body)) {
|
|
208
|
-
if (typeof value ===
|
|
206
|
+
if (typeof value === 'string') {
|
|
209
207
|
resolvedBody[key] = resolveTemplate(value, endpoint.parameterMapping, context);
|
|
210
208
|
}
|
|
211
209
|
else {
|
|
@@ -220,7 +218,7 @@ export async function fetchDynamicSchema(endpoint, node, workflowId) {
|
|
|
220
218
|
const errorText = await response.text();
|
|
221
219
|
return {
|
|
222
220
|
success: false,
|
|
223
|
-
error: `HTTP ${response.status}: ${errorText || response.statusText}
|
|
221
|
+
error: `HTTP ${response.status}: ${errorText || response.statusText}`
|
|
224
222
|
};
|
|
225
223
|
}
|
|
226
224
|
const data = await response.json();
|
|
@@ -229,26 +227,26 @@ export async function fetchDynamicSchema(endpoint, node, workflowId) {
|
|
|
229
227
|
// 2. Wrapped in { data: ConfigSchema } or { schema: ConfigSchema }
|
|
230
228
|
// 3. Wrapped in { success: true, data: ConfigSchema }
|
|
231
229
|
let schema;
|
|
232
|
-
if (data.type ===
|
|
230
|
+
if (data.type === 'object' && data.properties) {
|
|
233
231
|
// Direct ConfigSchema
|
|
234
232
|
schema = data;
|
|
235
233
|
}
|
|
236
|
-
else if (data.data?.type ===
|
|
234
|
+
else if (data.data?.type === 'object' && data.data?.properties) {
|
|
237
235
|
// Wrapped in { data: ... }
|
|
238
236
|
schema = data.data;
|
|
239
237
|
}
|
|
240
|
-
else if (data.schema?.type ===
|
|
238
|
+
else if (data.schema?.type === 'object' && data.schema?.properties) {
|
|
241
239
|
// Wrapped in { schema: ... }
|
|
242
240
|
schema = data.schema;
|
|
243
241
|
}
|
|
244
|
-
else if (data.success && data.data?.type ===
|
|
242
|
+
else if (data.success && data.data?.type === 'object') {
|
|
245
243
|
// Wrapped in { success: true, data: ... }
|
|
246
244
|
schema = data.data;
|
|
247
245
|
}
|
|
248
246
|
if (!schema) {
|
|
249
247
|
return {
|
|
250
248
|
success: false,
|
|
251
|
-
error:
|
|
249
|
+
error: 'Invalid schema format received from endpoint'
|
|
252
250
|
};
|
|
253
251
|
}
|
|
254
252
|
// Cache the schema (if caching is enabled)
|
|
@@ -256,32 +254,32 @@ export async function fetchDynamicSchema(endpoint, node, workflowId) {
|
|
|
256
254
|
schemaCache.set(cacheKey, {
|
|
257
255
|
schema,
|
|
258
256
|
cachedAt: Date.now(),
|
|
259
|
-
cacheKey
|
|
257
|
+
cacheKey
|
|
260
258
|
});
|
|
261
259
|
}
|
|
262
260
|
return {
|
|
263
261
|
success: true,
|
|
264
262
|
schema,
|
|
265
|
-
fromCache: false
|
|
263
|
+
fromCache: false
|
|
266
264
|
};
|
|
267
265
|
}
|
|
268
266
|
catch (error) {
|
|
269
267
|
// Handle specific error types
|
|
270
268
|
if (error instanceof Error) {
|
|
271
|
-
if (error.name ===
|
|
269
|
+
if (error.name === 'AbortError' || error.name === 'TimeoutError') {
|
|
272
270
|
return {
|
|
273
271
|
success: false,
|
|
274
|
-
error: `Request timed out after ${timeout}ms
|
|
272
|
+
error: `Request timed out after ${timeout}ms`
|
|
275
273
|
};
|
|
276
274
|
}
|
|
277
275
|
return {
|
|
278
276
|
success: false,
|
|
279
|
-
error: error.message
|
|
277
|
+
error: error.message
|
|
280
278
|
};
|
|
281
279
|
}
|
|
282
280
|
return {
|
|
283
281
|
success: false,
|
|
284
|
-
error:
|
|
282
|
+
error: 'Unknown error occurred while fetching schema'
|
|
285
283
|
};
|
|
286
284
|
}
|
|
287
285
|
}
|
|
@@ -313,13 +311,13 @@ export function resolveExternalEditUrl(link, node, workflowId, callbackUrl) {
|
|
|
313
311
|
metadata: node.data.metadata,
|
|
314
312
|
config: node.data.config,
|
|
315
313
|
extensions: node.data.extensions,
|
|
316
|
-
workflowId
|
|
314
|
+
workflowId
|
|
317
315
|
};
|
|
318
316
|
// Resolve the URL with template variables
|
|
319
317
|
let url = resolveTemplate(link.url, link.parameterMapping, context);
|
|
320
318
|
// Append callback URL if configured
|
|
321
319
|
if (callbackUrl && link.callbackUrlParam) {
|
|
322
|
-
const separator = url.includes(
|
|
320
|
+
const separator = url.includes('?') ? '&' : '?';
|
|
323
321
|
url = `${url}${separator}${link.callbackUrlParam}=${encodeURIComponent(callbackUrl)}`;
|
|
324
322
|
}
|
|
325
323
|
return url;
|
|
@@ -353,16 +351,16 @@ export function getEffectiveConfigEditOptions(node) {
|
|
|
353
351
|
externalEditLink: (instanceConfig.externalEditLink ?? typeConfig.externalEditLink)
|
|
354
352
|
? {
|
|
355
353
|
...(typeConfig.externalEditLink ?? {}),
|
|
356
|
-
...(instanceConfig.externalEditLink ?? {})
|
|
354
|
+
...(instanceConfig.externalEditLink ?? {})
|
|
357
355
|
}
|
|
358
356
|
: undefined,
|
|
359
357
|
// Deep merge dynamic schema
|
|
360
358
|
dynamicSchema: (instanceConfig.dynamicSchema ?? typeConfig.dynamicSchema)
|
|
361
359
|
? {
|
|
362
360
|
...(typeConfig.dynamicSchema ?? {}),
|
|
363
|
-
...(instanceConfig.dynamicSchema ?? {})
|
|
361
|
+
...(instanceConfig.dynamicSchema ?? {})
|
|
364
362
|
}
|
|
365
|
-
: undefined
|
|
363
|
+
: undefined
|
|
366
364
|
};
|
|
367
365
|
}
|
|
368
366
|
/**
|
|
@@ -395,7 +393,7 @@ export function invalidateSchemaCache(node, endpoint) {
|
|
|
395
393
|
type: node.type,
|
|
396
394
|
metadata: node.data.metadata,
|
|
397
395
|
config: node.data.config,
|
|
398
|
-
extensions: node.data.extensions
|
|
396
|
+
extensions: node.data.extensions
|
|
399
397
|
};
|
|
400
398
|
const cacheKey = generateCacheKey(endpoint, context);
|
|
401
399
|
schemaCache.delete(cacheKey);
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* reimplementing the logic, ensuring "blur active element" flushing and metadata
|
|
8
8
|
* construction happen in exactly one place.
|
|
9
9
|
*/
|
|
10
|
-
import type { Workflow } from
|
|
11
|
-
import type { FlowDropEventHandlers, FlowDropFeatures } from
|
|
10
|
+
import type { Workflow } from '../types/index.js';
|
|
11
|
+
import type { FlowDropEventHandlers, FlowDropFeatures } from '../types/events.js';
|
|
12
12
|
/**
|
|
13
13
|
* Minimal interface for the enhanced API client used when an authProvider is present.
|
|
14
14
|
* Matches the surface of EnhancedFlowDropApiClient that save needs.
|