@flowdrop/flowdrop 1.0.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/LICENSE +21 -0
- package/README.md +252 -0
- package/dist/adapters/WorkflowAdapter.d.ts +167 -0
- package/dist/adapters/WorkflowAdapter.js +368 -0
- package/dist/adapters/agentspec/AgentSpecAdapter.d.ts +96 -0
- package/dist/adapters/agentspec/AgentSpecAdapter.js +626 -0
- package/dist/adapters/agentspec/agentAdapter.d.ts +59 -0
- package/dist/adapters/agentspec/agentAdapter.js +91 -0
- package/dist/adapters/agentspec/autoLayout.d.ts +34 -0
- package/dist/adapters/agentspec/autoLayout.js +127 -0
- package/dist/adapters/agentspec/componentTypeDefaults.d.ts +73 -0
- package/dist/adapters/agentspec/componentTypeDefaults.js +238 -0
- package/dist/adapters/agentspec/defaultNodeTypes.d.ts +53 -0
- package/dist/adapters/agentspec/defaultNodeTypes.js +561 -0
- package/dist/adapters/agentspec/index.d.ts +37 -0
- package/dist/adapters/agentspec/index.js +39 -0
- package/dist/adapters/agentspec/validator.d.ts +34 -0
- package/dist/adapters/agentspec/validator.js +169 -0
- package/dist/api/enhanced-client.d.ts +183 -0
- package/dist/api/enhanced-client.js +430 -0
- package/dist/components/App.svelte +981 -0
- package/dist/components/App.svelte.d.ts +54 -0
- package/dist/components/CanvasBanner.stories.svelte +29 -0
- package/dist/components/CanvasBanner.stories.svelte.d.ts +27 -0
- package/dist/components/CanvasBanner.svelte +57 -0
- package/dist/components/CanvasBanner.svelte.d.ts +8 -0
- package/dist/components/ConfigForm.svelte +1138 -0
- package/dist/components/ConfigForm.svelte.d.ts +44 -0
- package/dist/components/ConfigModal.svelte +188 -0
- package/dist/components/ConfigModal.svelte.d.ts +13 -0
- package/dist/components/ConfigPanel.stories.svelte +47 -0
- package/dist/components/ConfigPanel.stories.svelte.d.ts +27 -0
- package/dist/components/ConfigPanel.svelte +182 -0
- package/dist/components/ConfigPanel.svelte.d.ts +32 -0
- package/dist/components/ConnectionLine.svelte +32 -0
- package/dist/components/ConnectionLine.svelte.d.ts +3 -0
- package/dist/components/EdgeRefresher.svelte +41 -0
- package/dist/components/EdgeRefresher.svelte.d.ts +9 -0
- package/dist/components/FlowDropZone.svelte +83 -0
- package/dist/components/FlowDropZone.svelte.d.ts +13 -0
- package/dist/components/LoadingSpinner.stories.svelte +30 -0
- package/dist/components/LoadingSpinner.stories.svelte.d.ts +27 -0
- package/dist/components/LoadingSpinner.svelte +36 -0
- package/dist/components/LoadingSpinner.svelte.d.ts +8 -0
- package/dist/components/Logo.stories.svelte +22 -0
- package/dist/components/Logo.stories.svelte.d.ts +27 -0
- package/dist/components/Logo.svelte +102 -0
- package/dist/components/Logo.svelte.d.ts +26 -0
- package/dist/components/LogsSidebar.svelte +563 -0
- package/dist/components/LogsSidebar.svelte.d.ts +17 -0
- package/dist/components/MarkdownDisplay.stories.svelte +36 -0
- package/dist/components/MarkdownDisplay.stories.svelte.d.ts +27 -0
- package/dist/components/MarkdownDisplay.svelte +29 -0
- package/dist/components/MarkdownDisplay.svelte.d.ts +7 -0
- package/dist/components/Navbar.stories.svelte +53 -0
- package/dist/components/Navbar.stories.svelte.d.ts +27 -0
- package/dist/components/Navbar.svelte +726 -0
- package/dist/components/Navbar.svelte.d.ts +29 -0
- package/dist/components/NodeSidebar.svelte +762 -0
- package/dist/components/NodeSidebar.svelte.d.ts +9 -0
- package/dist/components/NodeStatusOverlay.stories.svelte +85 -0
- package/dist/components/NodeStatusOverlay.stories.svelte.d.ts +27 -0
- package/dist/components/NodeStatusOverlay.svelte +327 -0
- package/dist/components/NodeStatusOverlay.svelte.d.ts +11 -0
- package/dist/components/PipelineStatus.svelte +314 -0
- package/dist/components/PipelineStatus.svelte.d.ts +20 -0
- package/dist/components/PortCoordinateTracker.svelte +58 -0
- package/dist/components/PortCoordinateTracker.svelte.d.ts +12 -0
- package/dist/components/ReadOnlyDetails.svelte +170 -0
- package/dist/components/ReadOnlyDetails.svelte.d.ts +25 -0
- package/dist/components/SchemaForm.stories.svelte +116 -0
- package/dist/components/SchemaForm.stories.svelte.d.ts +27 -0
- package/dist/components/SchemaForm.svelte +536 -0
- package/dist/components/SchemaForm.svelte.d.ts +83 -0
- package/dist/components/SettingsModal.svelte +279 -0
- package/dist/components/SettingsModal.svelte.d.ts +23 -0
- package/dist/components/SettingsPanel.svelte +638 -0
- package/dist/components/SettingsPanel.svelte.d.ts +21 -0
- package/dist/components/StatusIcon.stories.svelte +60 -0
- package/dist/components/StatusIcon.stories.svelte.d.ts +27 -0
- package/dist/components/StatusIcon.svelte +119 -0
- package/dist/components/StatusIcon.svelte.d.ts +10 -0
- package/dist/components/StatusLabel.stories.svelte +17 -0
- package/dist/components/StatusLabel.stories.svelte.d.ts +27 -0
- package/dist/components/StatusLabel.svelte +33 -0
- package/dist/components/StatusLabel.svelte.d.ts +7 -0
- package/dist/components/ThemeToggle.stories.svelte +25 -0
- package/dist/components/ThemeToggle.stories.svelte.d.ts +27 -0
- package/dist/components/ThemeToggle.svelte +185 -0
- package/dist/components/ThemeToggle.svelte.d.ts +14 -0
- package/dist/components/UniversalNode.svelte +155 -0
- package/dist/components/UniversalNode.svelte.d.ts +15 -0
- package/dist/components/WorkflowEditor.svelte +1035 -0
- package/dist/components/WorkflowEditor.svelte.d.ts +23 -0
- package/dist/components/form/FormArray.svelte +1049 -0
- package/dist/components/form/FormArray.svelte.d.ts +22 -0
- package/dist/components/form/FormAutocomplete.svelte +1009 -0
- package/dist/components/form/FormAutocomplete.svelte.d.ts +25 -0
- package/dist/components/form/FormCheckboxGroup.stories.svelte +28 -0
- package/dist/components/form/FormCheckboxGroup.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormCheckboxGroup.svelte +155 -0
- package/dist/components/form/FormCheckboxGroup.svelte.d.ts +17 -0
- package/dist/components/form/FormCodeEditor.svelte +458 -0
- package/dist/components/form/FormCodeEditor.svelte.d.ts +25 -0
- package/dist/components/form/FormField.svelte +417 -0
- package/dist/components/form/FormField.svelte.d.ts +29 -0
- package/dist/components/form/FormFieldLight.svelte +425 -0
- package/dist/components/form/FormFieldLight.svelte.d.ts +18 -0
- package/dist/components/form/FormFieldWrapper.stories.svelte +53 -0
- package/dist/components/form/FormFieldWrapper.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormFieldWrapper.svelte +125 -0
- package/dist/components/form/FormFieldWrapper.svelte.d.ts +18 -0
- package/dist/components/form/FormFieldset.svelte +142 -0
- package/dist/components/form/FormFieldset.svelte.d.ts +11 -0
- package/dist/components/form/FormMarkdownEditor.svelte +752 -0
- package/dist/components/form/FormMarkdownEditor.svelte.d.ts +33 -0
- package/dist/components/form/FormNumberField.stories.svelte +36 -0
- package/dist/components/form/FormNumberField.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormNumberField.svelte +112 -0
- package/dist/components/form/FormNumberField.svelte.d.ts +25 -0
- package/dist/components/form/FormRangeField.stories.svelte +31 -0
- package/dist/components/form/FormRangeField.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormRangeField.svelte +246 -0
- package/dist/components/form/FormRangeField.svelte.d.ts +23 -0
- package/dist/components/form/FormSelect.stories.svelte +50 -0
- package/dist/components/form/FormSelect.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormSelect.svelte +129 -0
- package/dist/components/form/FormSelect.svelte.d.ts +20 -0
- package/dist/components/form/FormTemplateEditor.svelte +825 -0
- package/dist/components/form/FormTemplateEditor.svelte.d.ts +41 -0
- package/dist/components/form/FormTextField.stories.svelte +30 -0
- package/dist/components/form/FormTextField.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormTextField.svelte +91 -0
- package/dist/components/form/FormTextField.svelte.d.ts +19 -0
- package/dist/components/form/FormTextarea.stories.svelte +34 -0
- package/dist/components/form/FormTextarea.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormTextarea.svelte +97 -0
- package/dist/components/form/FormTextarea.svelte.d.ts +21 -0
- package/dist/components/form/FormToggle.stories.svelte +30 -0
- package/dist/components/form/FormToggle.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormToggle.svelte +126 -0
- package/dist/components/form/FormToggle.svelte.d.ts +19 -0
- package/dist/components/form/FormUISchemaRenderer.svelte +136 -0
- package/dist/components/form/FormUISchemaRenderer.svelte.d.ts +32 -0
- package/dist/components/form/index.d.ts +50 -0
- package/dist/components/form/index.js +54 -0
- package/dist/components/form/templateAutocomplete.d.ts +29 -0
- package/dist/components/form/templateAutocomplete.js +254 -0
- package/dist/components/form/types.d.ts +485 -0
- package/dist/components/form/types.js +73 -0
- package/dist/components/interrupt/ChoicePrompt.stories.svelte +52 -0
- package/dist/components/interrupt/ChoicePrompt.stories.svelte.d.ts +27 -0
- package/dist/components/interrupt/ChoicePrompt.svelte +401 -0
- package/dist/components/interrupt/ChoicePrompt.svelte.d.ts +23 -0
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte +71 -0
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte.d.ts +27 -0
- package/dist/components/interrupt/ConfirmationPrompt.svelte +292 -0
- package/dist/components/interrupt/ConfirmationPrompt.svelte.d.ts +25 -0
- package/dist/components/interrupt/FormPrompt.svelte +236 -0
- package/dist/components/interrupt/FormPrompt.svelte.d.ts +23 -0
- package/dist/components/interrupt/InterruptBubble.svelte +601 -0
- package/dist/components/interrupt/InterruptBubble.svelte.d.ts +16 -0
- package/dist/components/interrupt/ReviewPrompt.stories.svelte +67 -0
- package/dist/components/interrupt/ReviewPrompt.stories.svelte.d.ts +27 -0
- package/dist/components/interrupt/ReviewPrompt.svelte +861 -0
- package/dist/components/interrupt/ReviewPrompt.svelte.d.ts +23 -0
- package/dist/components/interrupt/TextInputPrompt.stories.svelte +47 -0
- package/dist/components/interrupt/TextInputPrompt.stories.svelte.d.ts +27 -0
- package/dist/components/interrupt/TextInputPrompt.svelte +346 -0
- package/dist/components/interrupt/TextInputPrompt.svelte.d.ts +23 -0
- package/dist/components/interrupt/index.d.ts +13 -0
- package/dist/components/interrupt/index.js +15 -0
- package/dist/components/layouts/MainLayout.svelte +718 -0
- package/dist/components/layouts/MainLayout.svelte.d.ts +62 -0
- package/dist/components/nodes/GatewayNode.stories.svelte +108 -0
- package/dist/components/nodes/GatewayNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/GatewayNode.svelte +591 -0
- package/dist/components/nodes/GatewayNode.svelte.d.ts +15 -0
- package/dist/components/nodes/IdeaNode.stories.svelte +52 -0
- package/dist/components/nodes/IdeaNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/IdeaNode.svelte +455 -0
- package/dist/components/nodes/IdeaNode.svelte.d.ts +24 -0
- package/dist/components/nodes/NotesNode.stories.svelte +76 -0
- package/dist/components/nodes/NotesNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/NotesNode.svelte +378 -0
- package/dist/components/nodes/NotesNode.svelte.d.ts +24 -0
- package/dist/components/nodes/SimpleNode.stories.svelte +159 -0
- package/dist/components/nodes/SimpleNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/SimpleNode.svelte +451 -0
- package/dist/components/nodes/SimpleNode.svelte.d.ts +25 -0
- package/dist/components/nodes/SquareNode.stories.svelte +82 -0
- package/dist/components/nodes/SquareNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/SquareNode.svelte +407 -0
- package/dist/components/nodes/SquareNode.svelte.d.ts +25 -0
- package/dist/components/nodes/TerminalNode.stories.svelte +25 -0
- package/dist/components/nodes/TerminalNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/TerminalNode.svelte +690 -0
- package/dist/components/nodes/TerminalNode.svelte.d.ts +25 -0
- package/dist/components/nodes/ToolNode.stories.svelte +189 -0
- package/dist/components/nodes/ToolNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/ToolNode.svelte +471 -0
- package/dist/components/nodes/ToolNode.svelte.d.ts +36 -0
- package/dist/components/nodes/WorkflowNode.stories.svelte +55 -0
- package/dist/components/nodes/WorkflowNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/WorkflowNode.svelte +571 -0
- package/dist/components/nodes/WorkflowNode.svelte.d.ts +15 -0
- package/dist/components/playground/ChatPanel.svelte +905 -0
- package/dist/components/playground/ChatPanel.svelte.d.ts +46 -0
- package/dist/components/playground/ExecutionLogs.svelte +488 -0
- package/dist/components/playground/ExecutionLogs.svelte.d.ts +14 -0
- package/dist/components/playground/InputCollector.svelte +444 -0
- package/dist/components/playground/InputCollector.svelte.d.ts +16 -0
- package/dist/components/playground/MessageBubble.stories.svelte +62 -0
- package/dist/components/playground/MessageBubble.stories.svelte.d.ts +27 -0
- package/dist/components/playground/MessageBubble.svelte +633 -0
- package/dist/components/playground/MessageBubble.svelte.d.ts +24 -0
- package/dist/components/playground/Playground.svelte +1075 -0
- package/dist/components/playground/Playground.svelte.d.ts +25 -0
- package/dist/components/playground/PlaygroundModal.svelte +220 -0
- package/dist/components/playground/PlaygroundModal.svelte.d.ts +25 -0
- package/dist/components/playground/SessionManager.svelte +538 -0
- package/dist/components/playground/SessionManager.svelte.d.ts +20 -0
- package/dist/config/agentSpecEndpoints.d.ts +70 -0
- package/dist/config/agentSpecEndpoints.js +65 -0
- package/dist/config/constants.d.ts +43 -0
- package/dist/config/constants.js +31 -0
- package/dist/config/defaultCategories.d.ts +7 -0
- package/dist/config/defaultCategories.js +126 -0
- package/dist/config/defaultPortConfig.d.ts +6 -0
- package/dist/config/defaultPortConfig.js +201 -0
- package/dist/config/endpoints.d.ts +160 -0
- package/dist/config/endpoints.js +146 -0
- package/dist/config/runtimeConfig.d.ts +47 -0
- package/dist/config/runtimeConfig.js +80 -0
- package/dist/core/index.d.ts +75 -0
- package/dist/core/index.js +92 -0
- package/dist/display/index.d.ts +29 -0
- package/dist/display/index.js +36 -0
- package/dist/editor/index.d.ts +95 -0
- package/dist/editor/index.js +138 -0
- package/dist/form/code.d.ts +101 -0
- package/dist/form/code.js +168 -0
- package/dist/form/fieldRegistry.d.ts +169 -0
- package/dist/form/fieldRegistry.js +152 -0
- package/dist/form/full.d.ts +56 -0
- package/dist/form/full.js +80 -0
- package/dist/form/index.d.ts +77 -0
- package/dist/form/index.js +91 -0
- package/dist/form/markdown.d.ts +69 -0
- package/dist/form/markdown.js +103 -0
- package/dist/helpers/nodeLayoutHelper.d.ts +14 -0
- package/dist/helpers/nodeLayoutHelper.js +19 -0
- package/dist/helpers/proximityConnect.d.ts +94 -0
- package/dist/helpers/proximityConnect.js +314 -0
- package/dist/helpers/workflowEditorHelper.d.ts +183 -0
- package/dist/helpers/workflowEditorHelper.js +595 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +64 -0
- package/dist/mocks/app-environment.d.ts +8 -0
- package/dist/mocks/app-environment.js +16 -0
- package/dist/mocks/app-forms.d.ts +2 -0
- package/dist/mocks/app-forms.js +22 -0
- package/dist/mocks/app-navigation.d.ts +5 -0
- package/dist/mocks/app-navigation.js +36 -0
- package/dist/mocks/app-stores.d.ts +14 -0
- package/dist/mocks/app-stores.js +26 -0
- package/dist/playground/index.d.ts +131 -0
- package/dist/playground/index.js +172 -0
- package/dist/playground/mount.d.ts +203 -0
- package/dist/playground/mount.js +235 -0
- package/dist/registry/BaseRegistry.d.ts +92 -0
- package/dist/registry/BaseRegistry.js +124 -0
- package/dist/registry/builtinFormats.d.ts +23 -0
- package/dist/registry/builtinFormats.js +70 -0
- package/dist/registry/builtinNodes.d.ts +77 -0
- package/dist/registry/builtinNodes.js +211 -0
- package/dist/registry/index.d.ts +8 -0
- package/dist/registry/index.js +12 -0
- package/dist/registry/nodeComponentRegistry.d.ts +276 -0
- package/dist/registry/nodeComponentRegistry.js +262 -0
- package/dist/registry/plugin.d.ts +215 -0
- package/dist/registry/plugin.js +249 -0
- package/dist/registry/workflowFormatRegistry.d.ts +122 -0
- package/dist/registry/workflowFormatRegistry.js +96 -0
- package/dist/schema/index.d.ts +23 -0
- package/dist/schema/index.js +23 -0
- package/dist/schemas/v1/workflow.schema.json +1078 -0
- package/dist/services/agentSpecExecutionService.d.ts +106 -0
- package/dist/services/agentSpecExecutionService.js +334 -0
- package/dist/services/api.d.ts +115 -0
- package/dist/services/api.js +214 -0
- package/dist/services/apiVariableService.d.ts +114 -0
- package/dist/services/apiVariableService.js +338 -0
- package/dist/services/autoSaveService.d.ts +112 -0
- package/dist/services/autoSaveService.js +227 -0
- package/dist/services/categoriesApi.d.ts +14 -0
- package/dist/services/categoriesApi.js +49 -0
- package/dist/services/draftStorage.d.ts +171 -0
- package/dist/services/draftStorage.js +299 -0
- package/dist/services/dynamicSchemaService.d.ts +108 -0
- package/dist/services/dynamicSchemaService.js +444 -0
- package/dist/services/globalSave.d.ts +69 -0
- package/dist/services/globalSave.js +248 -0
- package/dist/services/historyService.d.ts +208 -0
- package/dist/services/historyService.js +321 -0
- package/dist/services/interruptService.d.ts +133 -0
- package/dist/services/interruptService.js +280 -0
- package/dist/services/nodeExecutionService.d.ts +63 -0
- package/dist/services/nodeExecutionService.js +266 -0
- package/dist/services/playgroundService.d.ts +130 -0
- package/dist/services/playgroundService.js +321 -0
- package/dist/services/portConfigApi.d.ts +14 -0
- package/dist/services/portConfigApi.js +54 -0
- package/dist/services/settingsService.d.ts +92 -0
- package/dist/services/settingsService.js +196 -0
- package/dist/services/toastService.d.ts +156 -0
- package/dist/services/toastService.js +265 -0
- package/dist/services/variableService.d.ts +141 -0
- package/dist/services/variableService.js +463 -0
- package/dist/services/workflowStorage.d.ts +37 -0
- package/dist/services/workflowStorage.js +116 -0
- package/dist/settings/index.d.ts +25 -0
- package/dist/settings/index.js +33 -0
- package/dist/stores/categoriesStore.svelte.d.ts +32 -0
- package/dist/stores/categoriesStore.svelte.js +77 -0
- package/dist/stores/editorStateMachine.svelte.d.ts +42 -0
- package/dist/stores/editorStateMachine.svelte.js +132 -0
- package/dist/stores/historyStore.svelte.d.ts +136 -0
- package/dist/stores/historyStore.svelte.js +207 -0
- package/dist/stores/interruptStore.svelte.d.ts +179 -0
- package/dist/stores/interruptStore.svelte.js +346 -0
- package/dist/stores/playgroundStore.svelte.d.ts +230 -0
- package/dist/stores/playgroundStore.svelte.js +515 -0
- package/dist/stores/portCoordinateStore.svelte.d.ts +66 -0
- package/dist/stores/portCoordinateStore.svelte.js +186 -0
- package/dist/stores/settingsStore.svelte.d.ts +158 -0
- package/dist/stores/settingsStore.svelte.js +544 -0
- package/dist/stores/workflowStore.svelte.d.ts +260 -0
- package/dist/stores/workflowStore.svelte.js +649 -0
- package/dist/stories/CanvasDecorator.svelte +49 -0
- package/dist/stories/CanvasDecorator.svelte.d.ts +8 -0
- package/dist/stories/NodeDecorator.svelte +73 -0
- package/dist/stories/NodeDecorator.svelte.d.ts +8 -0
- package/dist/stories/utils.d.ts +93 -0
- package/dist/stories/utils.js +122 -0
- package/dist/styles/base.css +1300 -0
- package/dist/styles/toast.css +35 -0
- package/dist/styles/tokens.css +475 -0
- package/dist/svelte-app.d.ts +150 -0
- package/dist/svelte-app.js +295 -0
- package/dist/types/agentspec.d.ts +318 -0
- package/dist/types/agentspec.js +48 -0
- package/dist/types/auth.d.ts +263 -0
- package/dist/types/auth.js +229 -0
- package/dist/types/config.d.ts +151 -0
- package/dist/types/config.js +7 -0
- package/dist/types/events.d.ts +190 -0
- package/dist/types/events.js +30 -0
- package/dist/types/index.d.ts +1234 -0
- package/dist/types/index.js +27 -0
- package/dist/types/interrupt.d.ts +390 -0
- package/dist/types/interrupt.js +145 -0
- package/dist/types/interruptState.d.ts +211 -0
- package/dist/types/interruptState.js +308 -0
- package/dist/types/playground.d.ts +351 -0
- package/dist/types/playground.js +95 -0
- package/dist/types/settings.d.ts +189 -0
- package/dist/types/settings.js +97 -0
- package/dist/types/uischema.d.ts +144 -0
- package/dist/types/uischema.js +51 -0
- package/dist/utils/colors.d.ts +288 -0
- package/dist/utils/colors.js +548 -0
- package/dist/utils/config.d.ts +37 -0
- package/dist/utils/config.js +226 -0
- package/dist/utils/connections.d.ts +125 -0
- package/dist/utils/connections.js +414 -0
- package/dist/utils/errors.d.ts +28 -0
- package/dist/utils/errors.js +44 -0
- package/dist/utils/fetchWithAuth.d.ts +25 -0
- package/dist/utils/fetchWithAuth.js +34 -0
- package/dist/utils/handleIds.d.ts +35 -0
- package/dist/utils/handleIds.js +58 -0
- package/dist/utils/handlePositioning.d.ts +31 -0
- package/dist/utils/handlePositioning.js +35 -0
- package/dist/utils/icons.d.ts +106 -0
- package/dist/utils/icons.js +157 -0
- package/dist/utils/logger.d.ts +47 -0
- package/dist/utils/logger.js +72 -0
- package/dist/utils/nodeStatus.d.ts +53 -0
- package/dist/utils/nodeStatus.js +183 -0
- package/dist/utils/nodeTypes.d.ts +117 -0
- package/dist/utils/nodeTypes.js +244 -0
- package/dist/utils/nodeWrapper.d.ts +39 -0
- package/dist/utils/nodeWrapper.js +62 -0
- package/dist/utils/performanceUtils.d.ts +30 -0
- package/dist/utils/performanceUtils.js +108 -0
- package/dist/utils/sanitize.d.ts +19 -0
- package/dist/utils/sanitize.js +31 -0
- package/dist/utils/uischema.d.ts +52 -0
- package/dist/utils/uischema.js +88 -0
- package/dist/utils/validation.d.ts +29 -0
- package/dist/utils/validation.js +39 -0
- package/package.json +292 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-save Service for FlowDrop
|
|
3
|
+
*
|
|
4
|
+
* Handles automatic saving of workflows based on user settings.
|
|
5
|
+
* Uses behaviorSettings for auto-save configuration.
|
|
6
|
+
*
|
|
7
|
+
* @module services/autoSaveService
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Auto-save configuration options
|
|
11
|
+
*/
|
|
12
|
+
interface AutoSaveOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Callback function to save the workflow
|
|
15
|
+
* Should return a promise that resolves when save is complete
|
|
16
|
+
*/
|
|
17
|
+
onSave: () => Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Optional callback for save errors
|
|
20
|
+
*/
|
|
21
|
+
onError?: (error: Error) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Optional callback for successful saves
|
|
24
|
+
*/
|
|
25
|
+
onSuccess?: () => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Initialize auto-save functionality based on user settings
|
|
29
|
+
*
|
|
30
|
+
* Creates an interval-based auto-save mechanism that:
|
|
31
|
+
* - Listens to behaviorSettings changes for auto-save configuration
|
|
32
|
+
* - Monitors the isDirty state to check for unsaved changes
|
|
33
|
+
* - Calls the provided save callback when dirty and auto-save is enabled
|
|
34
|
+
*
|
|
35
|
+
* @param options - Auto-save configuration options
|
|
36
|
+
* @returns Cleanup function to stop auto-save and unsubscribe from stores
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* // In App.svelte onMount
|
|
41
|
+
* const cleanupAutoSave = initAutoSave({
|
|
42
|
+
* onSave: async () => {
|
|
43
|
+
* await saveWorkflow();
|
|
44
|
+
* },
|
|
45
|
+
* onError: (error) => {
|
|
46
|
+
* console.error("Auto-save failed:", error);
|
|
47
|
+
* },
|
|
48
|
+
* onSuccess: () => {
|
|
49
|
+
* console.log("Auto-saved workflow");
|
|
50
|
+
* }
|
|
51
|
+
* });
|
|
52
|
+
*
|
|
53
|
+
* // In onDestroy
|
|
54
|
+
* cleanupAutoSave();
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function initAutoSave(options: AutoSaveOptions): () => void;
|
|
58
|
+
/**
|
|
59
|
+
* Create an auto-save manager with more control
|
|
60
|
+
*
|
|
61
|
+
* This is a class-based alternative to initAutoSave for cases where
|
|
62
|
+
* you need more fine-grained control over the auto-save behavior.
|
|
63
|
+
*/
|
|
64
|
+
export declare class AutoSaveManager {
|
|
65
|
+
private intervalId;
|
|
66
|
+
private isSaving;
|
|
67
|
+
private settingsUnsubscriber;
|
|
68
|
+
private onSave;
|
|
69
|
+
private onError?;
|
|
70
|
+
private onSuccess?;
|
|
71
|
+
/**
|
|
72
|
+
* Create a new AutoSaveManager
|
|
73
|
+
*
|
|
74
|
+
* @param options - Auto-save configuration options
|
|
75
|
+
*/
|
|
76
|
+
constructor(options: AutoSaveOptions);
|
|
77
|
+
/**
|
|
78
|
+
* Start the auto-save manager
|
|
79
|
+
*
|
|
80
|
+
* Listens for settings changes and starts the auto-save interval.
|
|
81
|
+
*/
|
|
82
|
+
start(): void;
|
|
83
|
+
/**
|
|
84
|
+
* Stop the auto-save manager
|
|
85
|
+
*
|
|
86
|
+
* Clears the interval and unsubscribes from settings.
|
|
87
|
+
*/
|
|
88
|
+
stop(): void;
|
|
89
|
+
/**
|
|
90
|
+
* Force an immediate save (if dirty)
|
|
91
|
+
*
|
|
92
|
+
* @returns Promise that resolves when save is complete
|
|
93
|
+
*/
|
|
94
|
+
saveNow(): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Check if auto-save is currently enabled
|
|
97
|
+
*/
|
|
98
|
+
isEnabled(): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Check if auto-save is currently running
|
|
101
|
+
*/
|
|
102
|
+
isRunning(): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Update the interval based on current settings
|
|
105
|
+
*/
|
|
106
|
+
private updateInterval;
|
|
107
|
+
/**
|
|
108
|
+
* Perform the save operation
|
|
109
|
+
*/
|
|
110
|
+
private performSave;
|
|
111
|
+
}
|
|
112
|
+
export {};
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-save Service for FlowDrop
|
|
3
|
+
*
|
|
4
|
+
* Handles automatic saving of workflows based on user settings.
|
|
5
|
+
* Uses behaviorSettings for auto-save configuration.
|
|
6
|
+
*
|
|
7
|
+
* @module services/autoSaveService
|
|
8
|
+
*/
|
|
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
|
+
/**
|
|
13
|
+
* Initialize auto-save functionality based on user settings
|
|
14
|
+
*
|
|
15
|
+
* Creates an interval-based auto-save mechanism that:
|
|
16
|
+
* - Listens to behaviorSettings changes for auto-save configuration
|
|
17
|
+
* - Monitors the isDirty state to check for unsaved changes
|
|
18
|
+
* - Calls the provided save callback when dirty and auto-save is enabled
|
|
19
|
+
*
|
|
20
|
+
* @param options - Auto-save configuration options
|
|
21
|
+
* @returns Cleanup function to stop auto-save and unsubscribe from stores
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* // In App.svelte onMount
|
|
26
|
+
* const cleanupAutoSave = initAutoSave({
|
|
27
|
+
* onSave: async () => {
|
|
28
|
+
* await saveWorkflow();
|
|
29
|
+
* },
|
|
30
|
+
* onError: (error) => {
|
|
31
|
+
* console.error("Auto-save failed:", error);
|
|
32
|
+
* },
|
|
33
|
+
* onSuccess: () => {
|
|
34
|
+
* console.log("Auto-saved workflow");
|
|
35
|
+
* }
|
|
36
|
+
* });
|
|
37
|
+
*
|
|
38
|
+
* // In onDestroy
|
|
39
|
+
* cleanupAutoSave();
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export function initAutoSave(options) {
|
|
43
|
+
const { onSave, onError, onSuccess } = options;
|
|
44
|
+
const state = {
|
|
45
|
+
intervalId: null,
|
|
46
|
+
isSaving: false,
|
|
47
|
+
settingsUnsubscriber: null,
|
|
48
|
+
dirtyUnsubscriber: null
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Perform auto-save if conditions are met
|
|
52
|
+
*/
|
|
53
|
+
async function performAutoSave() {
|
|
54
|
+
// Skip if already saving or not dirty
|
|
55
|
+
if (state.isSaving || !isDirty()) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
state.isSaving = true;
|
|
59
|
+
try {
|
|
60
|
+
await onSave();
|
|
61
|
+
onSuccess?.();
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
65
|
+
logger.error('Auto-save failed:', err);
|
|
66
|
+
onError?.(err);
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
state.isSaving = false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Start or restart the auto-save interval based on current settings
|
|
74
|
+
*/
|
|
75
|
+
function updateAutoSaveInterval() {
|
|
76
|
+
// Clear existing interval
|
|
77
|
+
if (state.intervalId) {
|
|
78
|
+
clearInterval(state.intervalId);
|
|
79
|
+
state.intervalId = null;
|
|
80
|
+
}
|
|
81
|
+
const settings = getBehaviorSettings();
|
|
82
|
+
// Start new interval if auto-save is enabled
|
|
83
|
+
if (settings.autoSave) {
|
|
84
|
+
state.intervalId = setInterval(() => {
|
|
85
|
+
performAutoSave();
|
|
86
|
+
}, settings.autoSaveInterval);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// Listen for settings changes to react to auto-save toggle/interval changes
|
|
90
|
+
state.settingsUnsubscriber = onSettingsChange((event) => {
|
|
91
|
+
if (event.category === 'behavior') {
|
|
92
|
+
updateAutoSaveInterval();
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
// Initial setup
|
|
96
|
+
updateAutoSaveInterval();
|
|
97
|
+
/**
|
|
98
|
+
* Cleanup function to stop auto-save and unsubscribe from stores
|
|
99
|
+
*/
|
|
100
|
+
return function cleanup() {
|
|
101
|
+
// Clear the interval
|
|
102
|
+
if (state.intervalId) {
|
|
103
|
+
clearInterval(state.intervalId);
|
|
104
|
+
state.intervalId = null;
|
|
105
|
+
}
|
|
106
|
+
// Unsubscribe from settings changes
|
|
107
|
+
if (state.settingsUnsubscriber) {
|
|
108
|
+
state.settingsUnsubscriber();
|
|
109
|
+
state.settingsUnsubscriber = null;
|
|
110
|
+
}
|
|
111
|
+
if (state.dirtyUnsubscriber) {
|
|
112
|
+
state.dirtyUnsubscriber();
|
|
113
|
+
state.dirtyUnsubscriber = null;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Create an auto-save manager with more control
|
|
119
|
+
*
|
|
120
|
+
* This is a class-based alternative to initAutoSave for cases where
|
|
121
|
+
* you need more fine-grained control over the auto-save behavior.
|
|
122
|
+
*/
|
|
123
|
+
export class AutoSaveManager {
|
|
124
|
+
intervalId = null;
|
|
125
|
+
isSaving = false;
|
|
126
|
+
settingsUnsubscriber = null;
|
|
127
|
+
onSave;
|
|
128
|
+
onError;
|
|
129
|
+
onSuccess;
|
|
130
|
+
/**
|
|
131
|
+
* Create a new AutoSaveManager
|
|
132
|
+
*
|
|
133
|
+
* @param options - Auto-save configuration options
|
|
134
|
+
*/
|
|
135
|
+
constructor(options) {
|
|
136
|
+
this.onSave = options.onSave;
|
|
137
|
+
this.onError = options.onError;
|
|
138
|
+
this.onSuccess = options.onSuccess;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Start the auto-save manager
|
|
142
|
+
*
|
|
143
|
+
* Listens for settings changes and starts the auto-save interval.
|
|
144
|
+
*/
|
|
145
|
+
start() {
|
|
146
|
+
if (this.settingsUnsubscriber) {
|
|
147
|
+
return; // Already started
|
|
148
|
+
}
|
|
149
|
+
this.settingsUnsubscriber = onSettingsChange((event) => {
|
|
150
|
+
if (event.category === 'behavior') {
|
|
151
|
+
this.updateInterval();
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
this.updateInterval();
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Stop the auto-save manager
|
|
158
|
+
*
|
|
159
|
+
* Clears the interval and unsubscribes from settings.
|
|
160
|
+
*/
|
|
161
|
+
stop() {
|
|
162
|
+
if (this.intervalId) {
|
|
163
|
+
clearInterval(this.intervalId);
|
|
164
|
+
this.intervalId = null;
|
|
165
|
+
}
|
|
166
|
+
if (this.settingsUnsubscriber) {
|
|
167
|
+
this.settingsUnsubscriber();
|
|
168
|
+
this.settingsUnsubscriber = null;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Force an immediate save (if dirty)
|
|
173
|
+
*
|
|
174
|
+
* @returns Promise that resolves when save is complete
|
|
175
|
+
*/
|
|
176
|
+
async saveNow() {
|
|
177
|
+
await this.performSave();
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Check if auto-save is currently enabled
|
|
181
|
+
*/
|
|
182
|
+
isEnabled() {
|
|
183
|
+
return getBehaviorSettings().autoSave;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Check if auto-save is currently running
|
|
187
|
+
*/
|
|
188
|
+
isRunning() {
|
|
189
|
+
return this.intervalId !== null;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Update the interval based on current settings
|
|
193
|
+
*/
|
|
194
|
+
updateInterval() {
|
|
195
|
+
if (this.intervalId) {
|
|
196
|
+
clearInterval(this.intervalId);
|
|
197
|
+
this.intervalId = null;
|
|
198
|
+
}
|
|
199
|
+
const settings = getBehaviorSettings();
|
|
200
|
+
if (settings.autoSave) {
|
|
201
|
+
this.intervalId = setInterval(() => {
|
|
202
|
+
this.performSave();
|
|
203
|
+
}, settings.autoSaveInterval);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Perform the save operation
|
|
208
|
+
*/
|
|
209
|
+
async performSave() {
|
|
210
|
+
if (this.isSaving || !isDirty()) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
this.isSaving = true;
|
|
214
|
+
try {
|
|
215
|
+
await this.onSave();
|
|
216
|
+
this.onSuccess?.();
|
|
217
|
+
}
|
|
218
|
+
catch (error) {
|
|
219
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
220
|
+
logger.error('Auto-save failed:', err);
|
|
221
|
+
this.onError?.(err);
|
|
222
|
+
}
|
|
223
|
+
finally {
|
|
224
|
+
this.isSaving = false;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Categories API Service
|
|
3
|
+
* Handles fetching category definitions from the backend
|
|
4
|
+
*/
|
|
5
|
+
import type { CategoryDefinition } from '../types/index.js';
|
|
6
|
+
import type { EndpointConfig } from '../config/endpoints.js';
|
|
7
|
+
/**
|
|
8
|
+
* Fetch category definitions from API
|
|
9
|
+
*/
|
|
10
|
+
export declare function fetchCategories(endpointConfig: EndpointConfig): Promise<CategoryDefinition[]>;
|
|
11
|
+
/**
|
|
12
|
+
* Validate category definitions structure
|
|
13
|
+
*/
|
|
14
|
+
export declare function validateCategories(categories: CategoryDefinition[]): boolean;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Categories API Service
|
|
3
|
+
* Handles fetching category definitions from the backend
|
|
4
|
+
*/
|
|
5
|
+
import { buildEndpointUrl } from '../config/endpoints.js';
|
|
6
|
+
import { DEFAULT_CATEGORIES } from '../config/defaultCategories.js';
|
|
7
|
+
import { logger } from '../utils/logger.js';
|
|
8
|
+
/**
|
|
9
|
+
* Fetch category definitions from API
|
|
10
|
+
*/
|
|
11
|
+
export async function fetchCategories(endpointConfig) {
|
|
12
|
+
try {
|
|
13
|
+
const url = buildEndpointUrl(endpointConfig, endpointConfig.endpoints.categories);
|
|
14
|
+
const response = await fetch(url, {
|
|
15
|
+
headers: { 'Content-Type': 'application/json' }
|
|
16
|
+
});
|
|
17
|
+
if (!response.ok) {
|
|
18
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
19
|
+
}
|
|
20
|
+
const data = await response.json();
|
|
21
|
+
const categories = data.data ?? data;
|
|
22
|
+
if (!categories || !Array.isArray(categories)) {
|
|
23
|
+
logger.warn('Invalid categories received from API, using default');
|
|
24
|
+
return DEFAULT_CATEGORIES;
|
|
25
|
+
}
|
|
26
|
+
return categories;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
logger.error('Error fetching categories:', error);
|
|
30
|
+
return DEFAULT_CATEGORIES;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Validate category definitions structure
|
|
35
|
+
*/
|
|
36
|
+
export function validateCategories(categories) {
|
|
37
|
+
if (!categories || !Array.isArray(categories)) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
for (const category of categories) {
|
|
41
|
+
if (!category.name || typeof category.name !== 'string') {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
if (!category.label || typeof category.label !== 'string') {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Draft Storage Service for FlowDrop
|
|
3
|
+
*
|
|
4
|
+
* Handles saving and loading workflow drafts to/from localStorage.
|
|
5
|
+
* Provides interval-based auto-save functionality.
|
|
6
|
+
*
|
|
7
|
+
* @module services/draftStorage
|
|
8
|
+
*/
|
|
9
|
+
import type { Workflow } from '../types/index.js';
|
|
10
|
+
/**
|
|
11
|
+
* Draft metadata stored alongside the workflow
|
|
12
|
+
*/
|
|
13
|
+
interface DraftMetadata {
|
|
14
|
+
/** Timestamp when the draft was saved */
|
|
15
|
+
savedAt: string;
|
|
16
|
+
/** Workflow ID (if available) */
|
|
17
|
+
workflowId?: string;
|
|
18
|
+
/** Workflow name */
|
|
19
|
+
workflowName?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Complete draft data stored in localStorage
|
|
23
|
+
*/
|
|
24
|
+
interface StoredDraft {
|
|
25
|
+
/** The workflow data */
|
|
26
|
+
workflow: Workflow;
|
|
27
|
+
/** Draft metadata */
|
|
28
|
+
metadata: DraftMetadata;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Generate a storage key for a workflow
|
|
32
|
+
*
|
|
33
|
+
* If a custom key is provided, use it directly.
|
|
34
|
+
* Otherwise, generate based on workflow ID or use "new" for unsaved workflows.
|
|
35
|
+
*
|
|
36
|
+
* @param workflowId - The workflow ID (optional)
|
|
37
|
+
* @param customKey - Custom storage key provided by enterprise (optional)
|
|
38
|
+
* @returns The storage key to use
|
|
39
|
+
*/
|
|
40
|
+
export declare function getDraftStorageKey(workflowId?: string, customKey?: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Save a workflow draft to localStorage
|
|
43
|
+
*
|
|
44
|
+
* @param workflow - The workflow to save
|
|
45
|
+
* @param storageKey - The storage key to use
|
|
46
|
+
* @returns true if saved successfully, false otherwise
|
|
47
|
+
*/
|
|
48
|
+
export declare function saveDraft(workflow: Workflow, storageKey: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Load a workflow draft from localStorage
|
|
51
|
+
*
|
|
52
|
+
* @param storageKey - The storage key to load from
|
|
53
|
+
* @returns The stored draft, or null if not found
|
|
54
|
+
*/
|
|
55
|
+
export declare function loadDraft(storageKey: string): StoredDraft | null;
|
|
56
|
+
/**
|
|
57
|
+
* Delete a workflow draft from localStorage
|
|
58
|
+
*
|
|
59
|
+
* @param storageKey - The storage key to delete
|
|
60
|
+
*/
|
|
61
|
+
export declare function deleteDraft(storageKey: string): void;
|
|
62
|
+
/**
|
|
63
|
+
* Check if a draft exists for a given storage key
|
|
64
|
+
*
|
|
65
|
+
* @param storageKey - The storage key to check
|
|
66
|
+
* @returns true if a draft exists
|
|
67
|
+
*/
|
|
68
|
+
export declare function hasDraft(storageKey: string): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Get draft metadata without loading the full workflow
|
|
71
|
+
*
|
|
72
|
+
* Useful for displaying draft information without parsing the entire workflow.
|
|
73
|
+
*
|
|
74
|
+
* @param storageKey - The storage key to check
|
|
75
|
+
* @returns Draft metadata, or null if not found
|
|
76
|
+
*/
|
|
77
|
+
export declare function getDraftMetadata(storageKey: string): DraftMetadata | null;
|
|
78
|
+
/**
|
|
79
|
+
* Draft auto-save manager
|
|
80
|
+
*
|
|
81
|
+
* Handles interval-based auto-saving of workflow drafts.
|
|
82
|
+
* Should be instantiated per FlowDrop instance.
|
|
83
|
+
*/
|
|
84
|
+
export declare class DraftAutoSaveManager {
|
|
85
|
+
/** Interval timer ID */
|
|
86
|
+
private intervalId;
|
|
87
|
+
/** Storage key for drafts */
|
|
88
|
+
private storageKey;
|
|
89
|
+
/** Auto-save interval in milliseconds */
|
|
90
|
+
private interval;
|
|
91
|
+
/** Whether auto-save is enabled */
|
|
92
|
+
private enabled;
|
|
93
|
+
/** Function to get current workflow */
|
|
94
|
+
private getWorkflow;
|
|
95
|
+
/** Function to check if workflow is dirty */
|
|
96
|
+
private isDirty;
|
|
97
|
+
/** Last saved workflow hash (for change detection) */
|
|
98
|
+
private lastSavedHash;
|
|
99
|
+
/**
|
|
100
|
+
* Create a new DraftAutoSaveManager
|
|
101
|
+
*
|
|
102
|
+
* @param options - Configuration options
|
|
103
|
+
*/
|
|
104
|
+
constructor(options: {
|
|
105
|
+
storageKey: string;
|
|
106
|
+
interval: number;
|
|
107
|
+
enabled: boolean;
|
|
108
|
+
getWorkflow: () => Workflow | null;
|
|
109
|
+
isDirty: () => boolean;
|
|
110
|
+
});
|
|
111
|
+
/**
|
|
112
|
+
* Start auto-save interval
|
|
113
|
+
*
|
|
114
|
+
* Will save drafts at the configured interval if there are unsaved changes.
|
|
115
|
+
*/
|
|
116
|
+
start(): void;
|
|
117
|
+
/**
|
|
118
|
+
* Stop auto-save interval
|
|
119
|
+
*/
|
|
120
|
+
stop(): void;
|
|
121
|
+
/**
|
|
122
|
+
* Save draft if there are unsaved changes
|
|
123
|
+
*
|
|
124
|
+
* @returns true if a draft was saved
|
|
125
|
+
*/
|
|
126
|
+
saveIfDirty(): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Force save the current workflow as a draft
|
|
129
|
+
*
|
|
130
|
+
* Saves regardless of dirty state.
|
|
131
|
+
*
|
|
132
|
+
* @returns true if saved successfully
|
|
133
|
+
*/
|
|
134
|
+
forceSave(): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Clear the draft from storage
|
|
137
|
+
*/
|
|
138
|
+
clearDraft(): void;
|
|
139
|
+
/**
|
|
140
|
+
* Mark the current state as saved
|
|
141
|
+
*
|
|
142
|
+
* Updates the hash so the next saveIfDirty won't save unless there are new changes.
|
|
143
|
+
*/
|
|
144
|
+
markAsSaved(): void;
|
|
145
|
+
/**
|
|
146
|
+
* Update the storage key
|
|
147
|
+
*
|
|
148
|
+
* Useful when the workflow ID changes (e.g., after first save).
|
|
149
|
+
*
|
|
150
|
+
* @param newKey - The new storage key
|
|
151
|
+
*/
|
|
152
|
+
updateStorageKey(newKey: string): void;
|
|
153
|
+
/**
|
|
154
|
+
* Simple hash function for change detection
|
|
155
|
+
*
|
|
156
|
+
* Not cryptographically secure, just for detecting changes.
|
|
157
|
+
*
|
|
158
|
+
* @param workflow - The workflow to hash
|
|
159
|
+
* @returns A simple hash string
|
|
160
|
+
*/
|
|
161
|
+
private hashWorkflow;
|
|
162
|
+
/**
|
|
163
|
+
* Check if auto-save is currently running
|
|
164
|
+
*/
|
|
165
|
+
isRunning(): boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Get the current storage key
|
|
168
|
+
*/
|
|
169
|
+
getStorageKey(): string;
|
|
170
|
+
}
|
|
171
|
+
export {};
|