@flowdrop/flowdrop 1.14.0 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +475 -0
- package/MIGRATION-2.0.md +472 -0
- package/README.md +23 -23
- package/dist/adapters/WorkflowAdapter.d.ts +1 -1
- package/dist/adapters/WorkflowAdapter.js +14 -8
- package/dist/adapters/agentspec/AgentSpecAdapter.js +7 -7
- package/dist/chat/batchFeedback.d.ts +39 -0
- package/dist/chat/batchFeedback.js +51 -0
- package/dist/commands/executor.js +15 -1
- package/dist/commands/storeIntegration.svelte.d.ts +4 -1
- package/dist/commands/storeIntegration.svelte.js +26 -21
- package/dist/commands/types.d.ts +2 -0
- package/dist/components/App.svelte +162 -192
- package/dist/components/App.svelte.d.ts +47 -8
- package/dist/components/ConfigForm.svelte +110 -66
- package/dist/components/ConfigModal.svelte +7 -2
- package/dist/components/ConnectionLine.svelte +4 -2
- package/dist/components/Navbar.svelte +61 -1
- package/dist/components/NodeSidebar.svelte +27 -45
- package/dist/components/NodeStatusOverlay.svelte +94 -6
- package/dist/components/NodeSwapPicker.svelte +10 -8
- package/dist/components/PipelineStatus.svelte +16 -67
- package/dist/components/PortCoordinateTracker.svelte +5 -6
- package/dist/components/SchemaForm.stories.svelte +1 -3
- package/dist/components/SchemaForm.svelte +45 -40
- package/dist/components/SchemaForm.svelte.d.ts +0 -8
- package/dist/components/SettingsModal.svelte +8 -3
- package/dist/components/SettingsPanel.svelte +20 -4
- package/dist/components/SwapMappingEditor.svelte +67 -49
- package/dist/components/SwapMappingEditor.svelte.d.ts +0 -2
- package/dist/components/UniversalNode.svelte +9 -7
- package/dist/components/WorkflowEditor.svelte +118 -111
- package/dist/components/WorkflowEditor.svelte.d.ts +18 -10
- package/dist/components/chat/AIChatPanel.svelte +93 -89
- package/dist/components/chat/AIChatPanel.svelte.d.ts +0 -4
- package/dist/components/chat/CommandPreview.svelte +2 -1
- package/dist/components/console/CommandConsole.svelte +7 -5
- package/dist/components/console/ConsoleAutocomplete.svelte +10 -11
- package/dist/components/console/ConsoleAutocomplete.svelte.d.ts +6 -0
- package/dist/components/console/ConsoleInput.svelte +15 -6
- package/dist/components/console/ConsoleOutput.svelte +2 -1
- package/dist/components/form/FormArray.svelte +5 -9
- package/dist/components/form/FormArray.svelte.d.ts +2 -1
- package/dist/components/form/FormAutocomplete.svelte +29 -13
- package/dist/components/form/FormField.svelte +4 -2
- package/dist/components/form/FormFieldLight.svelte +4 -2
- package/dist/components/form/FormMarkdownEditor.svelte +9 -4
- package/dist/components/form/FormRangeField.svelte +1 -0
- package/dist/components/form/FormTemplateEditor.svelte +11 -3
- package/dist/components/form/FormToggle.svelte +5 -12
- package/dist/components/form/FormToggle.svelte.d.ts +4 -2
- package/dist/components/form/templateAutocomplete.js +1 -5
- package/dist/components/form/types.d.ts +1 -14
- package/dist/components/interrupt/FormPrompt.svelte +3 -2
- package/dist/components/interrupt/InterruptBubble.svelte +16 -17
- package/dist/components/interrupt/ReviewPrompt.svelte +10 -3
- package/dist/components/interrupt/TextInputPrompt.svelte +2 -1
- package/dist/components/layouts/MainLayout.svelte +20 -13
- package/dist/components/layouts/MainLayout.svelte.d.ts +4 -0
- package/dist/components/nodes/AtomNode.svelte +292 -0
- package/dist/components/nodes/AtomNode.svelte.d.ts +26 -0
- package/dist/components/nodes/GatewayNode.svelte +19 -10
- package/dist/components/nodes/IdeaNode.svelte +7 -0
- package/dist/components/nodes/SimpleNode.svelte +11 -6
- package/dist/components/nodes/SquareNode.svelte +15 -8
- package/dist/components/nodes/TerminalNode.svelte +9 -4
- package/dist/components/nodes/ToolNode.svelte +7 -1
- package/dist/components/nodes/WorkflowNode.svelte +16 -7
- package/dist/components/playground/ChatInput.svelte +11 -14
- package/dist/components/playground/ChatPanel.svelte +6 -49
- package/dist/components/playground/ChatPanel.svelte.d.ts +0 -14
- package/dist/components/playground/ControlPanel.svelte +134 -123
- package/dist/components/playground/ControlPanel.svelte.d.ts +3 -0
- package/dist/components/playground/ExecutionLogs.svelte +11 -9
- package/dist/components/playground/InputCollector.svelte +11 -9
- package/dist/components/playground/MessageStream.svelte +17 -23
- package/dist/components/playground/PipelineKanbanView.svelte +65 -6
- package/dist/components/playground/PipelinePanel.svelte +11 -5
- package/dist/components/playground/PipelineTableView.svelte +186 -44
- package/dist/components/playground/Playground.svelte +95 -92
- package/dist/components/playground/Playground.svelte.d.ts +2 -0
- package/dist/components/playground/PlaygroundApp.svelte +6 -1
- package/dist/components/playground/PlaygroundApp.svelte.d.ts +3 -0
- package/dist/components/playground/PlaygroundModal.svelte +13 -3
- package/dist/components/playground/PlaygroundModal.svelte.d.ts +3 -0
- package/dist/components/playground/PlaygroundStudio.svelte +34 -32
- package/dist/components/playground/PlaygroundStudio.svelte.d.ts +3 -0
- package/dist/components/playground/SessionManager.svelte +9 -12
- package/dist/components/playground/pipelineViewUtils.svelte.d.ts +28 -0
- package/dist/components/playground/pipelineViewUtils.svelte.js +38 -1
- package/dist/config/endpoints.d.ts +0 -7
- package/dist/config/endpoints.js +2 -10
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +6 -6
- package/dist/display/index.d.ts +0 -2
- package/dist/display/index.js +0 -6
- package/dist/editor/index.d.ts +19 -20
- package/dist/editor/index.js +25 -35
- package/dist/form/code.d.ts +25 -15
- package/dist/form/code.js +44 -41
- package/dist/form/fieldRegistry.d.ts +17 -13
- package/dist/form/fieldRegistry.js +32 -12
- package/dist/form/full.d.ts +17 -13
- package/dist/form/full.js +22 -27
- package/dist/form/index.d.ts +3 -3
- package/dist/form/index.js +3 -3
- package/dist/form/markdown.d.ts +13 -8
- package/dist/form/markdown.js +22 -23
- package/dist/helpers/proximityConnect.d.ts +7 -3
- package/dist/helpers/proximityConnect.js +19 -6
- package/dist/helpers/workflowEditorHelper.d.ts +12 -5
- package/dist/helpers/workflowEditorHelper.js +27 -25
- package/dist/index.d.ts +28 -24
- package/dist/index.js +27 -50
- package/dist/messages/defaults.d.ts +2 -5
- package/dist/messages/defaults.js +3 -6
- package/dist/messages/index.d.ts +0 -1
- package/dist/messages/index.js +0 -1
- package/dist/mocks/app-forms.d.ts +6 -2
- package/dist/mocks/app-forms.js +11 -4
- package/dist/openapi/v1/openapi.yaml +227 -164
- package/dist/playground/index.d.ts +2 -3
- package/dist/playground/index.js +2 -30
- package/dist/playground/mount.d.ts +15 -0
- package/dist/playground/mount.js +46 -20
- package/dist/registry/{BaseRegistry.d.ts → BaseRegistry.svelte.d.ts} +22 -1
- package/dist/registry/{BaseRegistry.js → BaseRegistry.svelte.js} +37 -1
- package/dist/registry/builtinFormats.d.ts +9 -18
- package/dist/registry/builtinFormats.js +9 -39
- package/dist/registry/builtinNodes.d.ts +1 -26
- package/dist/registry/builtinNodes.js +14 -50
- package/dist/registry/index.d.ts +3 -4
- package/dist/registry/index.js +4 -6
- package/dist/registry/nodeComponentRegistry.d.ts +182 -15
- package/dist/registry/nodeComponentRegistry.js +235 -17
- package/dist/registry/workflowFormatRegistry.d.ts +14 -9
- package/dist/registry/workflowFormatRegistry.js +24 -8
- package/dist/{schema → schemas}/index.d.ts +2 -2
- package/dist/{schema → schemas}/index.js +2 -2
- package/dist/schemas/v1/workflow.schema.json +53 -6
- package/dist/services/agentSpecExecutionService.js +0 -1
- package/dist/services/apiVariableService.d.ts +2 -1
- package/dist/services/apiVariableService.js +5 -22
- package/dist/services/autoSaveService.d.ts +7 -0
- package/dist/services/autoSaveService.js +6 -4
- package/dist/services/chatService.d.ts +8 -4
- package/dist/services/chatService.js +15 -15
- package/dist/services/draftStorage.d.ts +129 -13
- package/dist/services/draftStorage.js +185 -37
- package/dist/services/dynamicSchemaService.d.ts +2 -1
- package/dist/services/dynamicSchemaService.js +5 -22
- package/dist/services/globalSave.d.ts +13 -12
- package/dist/services/globalSave.js +29 -51
- package/dist/services/historyService.d.ts +9 -3
- package/dist/services/historyService.js +9 -3
- package/dist/services/interruptService.d.ts +14 -9
- package/dist/services/interruptService.js +27 -27
- package/dist/services/nodeExecutionService.d.ts +18 -3
- package/dist/services/nodeExecutionService.js +71 -45
- package/dist/services/playgroundService.d.ts +14 -9
- package/dist/services/playgroundService.js +31 -30
- package/dist/services/variableService.d.ts +2 -1
- package/dist/services/variableService.js +2 -2
- package/dist/services/workflowStorage.js +6 -6
- package/dist/stores/apiContext.d.ts +45 -0
- package/dist/stores/apiContext.js +65 -0
- package/dist/stores/categoriesStore.svelte.d.ts +28 -23
- package/dist/stores/categoriesStore.svelte.js +70 -64
- package/dist/stores/getInstance.svelte.d.ts +39 -0
- package/dist/stores/getInstance.svelte.js +65 -0
- package/dist/stores/historyStore.svelte.d.ts +77 -93
- package/dist/stores/historyStore.svelte.js +134 -160
- package/dist/stores/instanceContainer.svelte.d.ts +111 -0
- package/dist/stores/instanceContainer.svelte.js +114 -0
- package/dist/stores/interruptStore.svelte.d.ts +112 -82
- package/dist/stores/interruptStore.svelte.js +253 -226
- package/dist/stores/pipelinePanelStore.svelte.d.ts +27 -3
- package/dist/stores/pipelinePanelStore.svelte.js +61 -14
- package/dist/stores/playgroundStore.svelte.d.ts +169 -216
- package/dist/stores/playgroundStore.svelte.js +515 -572
- package/dist/stores/portCoordinateStore.svelte.d.ts +57 -51
- package/dist/stores/portCoordinateStore.svelte.js +109 -98
- package/dist/stores/settingsStore.svelte.d.ts +4 -1
- package/dist/stores/settingsStore.svelte.js +47 -12
- package/dist/stores/workflowStore.svelte.d.ts +178 -213
- package/dist/stores/workflowStore.svelte.js +449 -501
- package/dist/stories/EdgeDecorator.svelte +5 -2
- package/dist/stories/NodeDecorator.svelte +5 -3
- package/dist/svelte-app.d.ts +60 -10
- package/dist/svelte-app.js +157 -53
- package/dist/types/events.d.ts +6 -3
- package/dist/types/index.d.ts +71 -6
- package/dist/types/navbar.d.ts +7 -0
- package/dist/types/playground.d.ts +18 -3
- package/dist/types/settings.d.ts +13 -0
- package/dist/types/settings.js +1 -0
- package/dist/utils/colors.d.ts +47 -21
- package/dist/utils/colors.js +69 -68
- package/dist/utils/connections.d.ts +9 -15
- package/dist/utils/connections.js +13 -32
- package/dist/utils/duration.d.ts +13 -0
- package/dist/utils/duration.js +45 -0
- package/dist/utils/formMerge.d.ts +36 -0
- package/dist/utils/formMerge.js +70 -0
- package/dist/utils/icons.d.ts +5 -2
- package/dist/utils/icons.js +6 -5
- package/dist/utils/nodeSwap.d.ts +6 -2
- package/dist/utils/nodeSwap.js +62 -126
- package/dist/utils/nodeTypes.d.ts +17 -8
- package/dist/utils/nodeTypes.js +27 -19
- package/dist/utils/performanceUtils.js +7 -0
- package/package.json +6 -5
- package/dist/messages/deprecation.d.ts +0 -20
- package/dist/messages/deprecation.js +0 -33
- package/dist/registry/plugin.d.ts +0 -215
- package/dist/registry/plugin.js +0 -249
- package/dist/services/api.d.ts +0 -129
- package/dist/services/api.js +0 -217
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "A drop-in visual workflow editor for any web application. You own the backend. You own the data. You own the orchestration.",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
|
-
"version": "
|
|
6
|
+
"version": "2.0.0-beta.1",
|
|
7
7
|
"author": "Shibin Das (D34dMan)",
|
|
8
8
|
"bugs": {
|
|
9
9
|
"url": "https://github.com/flowdrop-io/flowdrop/issues"
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"dist",
|
|
48
48
|
"!dist/**/*.test.*",
|
|
49
49
|
"!dist/**/*.spec.*",
|
|
50
|
-
"!dist/**/*.map"
|
|
50
|
+
"!dist/**/*.map",
|
|
51
|
+
"CHANGELOG.md",
|
|
52
|
+
"MIGRATION-2.0.md"
|
|
51
53
|
],
|
|
52
54
|
"sideEffects": [
|
|
53
|
-
"**/*.css"
|
|
54
|
-
"./dist/styles/base.css",
|
|
55
|
-
"./dist/editor/index.js"
|
|
55
|
+
"**/*.css"
|
|
56
56
|
],
|
|
57
57
|
"svelte": "./dist/index.js",
|
|
58
58
|
"types": "./dist/index.d.ts",
|
|
@@ -269,6 +269,7 @@
|
|
|
269
269
|
"dependencies": {
|
|
270
270
|
"diff": "^8.0.3",
|
|
271
271
|
"dompurify": "^3.3.1",
|
|
272
|
+
"esm-env": "^1.2.2",
|
|
272
273
|
"marked": "^16.1.1",
|
|
273
274
|
"svelte-5-french-toast": "^2.0.6",
|
|
274
275
|
"uuid": "^11.1.0"
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* One-shot deprecation warning helper for the messages migration.
|
|
3
|
-
*
|
|
4
|
-
* Components that previously accepted per-string label props (e.g.
|
|
5
|
-
* `saveLabel`, `cancelLabel`, `placeholder`, `addLabel`) keep accepting them
|
|
6
|
-
* during the v1.x deprecation window. When a consumer passes one explicitly
|
|
7
|
-
* we emit a single console.warn per (component, prop) pair so the noise is
|
|
8
|
-
* bounded even if the prop is rebound on every render.
|
|
9
|
-
*
|
|
10
|
-
* Production builds skip the warning entirely.
|
|
11
|
-
*
|
|
12
|
-
* Removed in v2.0 along with the props themselves.
|
|
13
|
-
*/
|
|
14
|
-
export declare function warnDeprecatedProp(component: string, prop: string, replacement: string): void;
|
|
15
|
-
/**
|
|
16
|
-
* Test-only: clear the warned-once cache so subsequent renders re-emit the
|
|
17
|
-
* warning. Storybook stories and Vitest specs that share a module instance
|
|
18
|
-
* need this to assert the warning fires per case.
|
|
19
|
-
*/
|
|
20
|
-
export declare function __resetDeprecationWarningsForTests(): void;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* One-shot deprecation warning helper for the messages migration.
|
|
3
|
-
*
|
|
4
|
-
* Components that previously accepted per-string label props (e.g.
|
|
5
|
-
* `saveLabel`, `cancelLabel`, `placeholder`, `addLabel`) keep accepting them
|
|
6
|
-
* during the v1.x deprecation window. When a consumer passes one explicitly
|
|
7
|
-
* we emit a single console.warn per (component, prop) pair so the noise is
|
|
8
|
-
* bounded even if the prop is rebound on every render.
|
|
9
|
-
*
|
|
10
|
-
* Production builds skip the warning entirely.
|
|
11
|
-
*
|
|
12
|
-
* Removed in v2.0 along with the props themselves.
|
|
13
|
-
*/
|
|
14
|
-
const warned = new Set();
|
|
15
|
-
export function warnDeprecatedProp(component, prop, replacement) {
|
|
16
|
-
if (import.meta.env.PROD)
|
|
17
|
-
return;
|
|
18
|
-
const key = `${component}.${prop}`;
|
|
19
|
-
if (warned.has(key))
|
|
20
|
-
return;
|
|
21
|
-
warned.add(key);
|
|
22
|
-
// eslint-disable-next-line no-console
|
|
23
|
-
console.warn(`[flowdrop] <${component}> prop \`${prop}\` is deprecated and will be removed in v2.0. ` +
|
|
24
|
-
`Use \`messages\` on <FlowDrop> instead: ${replacement}`);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Test-only: clear the warned-once cache so subsequent renders re-emit the
|
|
28
|
-
* warning. Storybook stories and Vitest specs that share a module instance
|
|
29
|
-
* need this to assert the warning fires per case.
|
|
30
|
-
*/
|
|
31
|
-
export function __resetDeprecationWarningsForTests() {
|
|
32
|
-
warned.clear();
|
|
33
|
-
}
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FlowDrop Plugin System
|
|
3
|
-
* Provides APIs for external libraries to register custom node components.
|
|
4
|
-
*
|
|
5
|
-
* This enables a plugin ecosystem where:
|
|
6
|
-
* - Third-party libraries can provide custom node types
|
|
7
|
-
* - Custom nodes are namespaced to avoid conflicts
|
|
8
|
-
* - Registration is simplified with a clean API
|
|
9
|
-
*/
|
|
10
|
-
import { type NodeComponentProps, type NodeComponentCategory, type StatusPosition, type StatusSize } from './nodeComponentRegistry.js';
|
|
11
|
-
import type { Component } from 'svelte';
|
|
12
|
-
/**
|
|
13
|
-
* Plugin configuration for external libraries.
|
|
14
|
-
* Use this to register multiple node types from a library.
|
|
15
|
-
*/
|
|
16
|
-
export interface FlowDropPluginConfig {
|
|
17
|
-
/**
|
|
18
|
-
* Unique namespace for this plugin.
|
|
19
|
-
* Used to prefix all node types (e.g., "mylib" -> "mylib:nodename").
|
|
20
|
-
* Should be lowercase, alphanumeric with optional hyphens.
|
|
21
|
-
*/
|
|
22
|
-
namespace: string;
|
|
23
|
-
/** Display name for the plugin (for UI/debugging purposes) */
|
|
24
|
-
name: string;
|
|
25
|
-
/** Plugin version (optional, for debugging) */
|
|
26
|
-
version?: string;
|
|
27
|
-
/** Description of what this plugin provides */
|
|
28
|
-
description?: string;
|
|
29
|
-
/** Node components to register */
|
|
30
|
-
nodes: PluginNodeDefinition[];
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Simplified node definition for plugins.
|
|
34
|
-
* Provides a cleaner API than full NodeComponentRegistration.
|
|
35
|
-
*/
|
|
36
|
-
export interface PluginNodeDefinition {
|
|
37
|
-
/**
|
|
38
|
-
* Type identifier for this node.
|
|
39
|
-
* Will be prefixed with the plugin namespace (e.g., "fancy" -> "mylib:fancy").
|
|
40
|
-
*/
|
|
41
|
-
type: string;
|
|
42
|
-
/** Display name shown in UI */
|
|
43
|
-
displayName: string;
|
|
44
|
-
/** Description of what this node does */
|
|
45
|
-
description?: string;
|
|
46
|
-
/** The Svelte component to render */
|
|
47
|
-
component: Component<NodeComponentProps>;
|
|
48
|
-
/** Icon in iconify format (e.g., "mdi:star") */
|
|
49
|
-
icon?: string;
|
|
50
|
-
/** Category for organizing in UI */
|
|
51
|
-
category?: NodeComponentCategory;
|
|
52
|
-
/** Status overlay position */
|
|
53
|
-
statusPosition?: StatusPosition;
|
|
54
|
-
/** Status overlay size */
|
|
55
|
-
statusSize?: StatusSize;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Result of plugin registration.
|
|
59
|
-
* Contains information about what was registered and any errors.
|
|
60
|
-
*/
|
|
61
|
-
export interface PluginRegistrationResult {
|
|
62
|
-
/** Whether all nodes were registered successfully */
|
|
63
|
-
success: boolean;
|
|
64
|
-
/** The plugin namespace */
|
|
65
|
-
namespace: string;
|
|
66
|
-
/** Array of successfully registered type identifiers (namespaced) */
|
|
67
|
-
registeredTypes: string[];
|
|
68
|
-
/** Array of error messages for failed registrations */
|
|
69
|
-
errors: string[];
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Register a FlowDrop plugin with custom node components.
|
|
73
|
-
* All node types are automatically namespaced with the plugin namespace.
|
|
74
|
-
*
|
|
75
|
-
* @param config - Plugin configuration with namespace and node definitions
|
|
76
|
-
* @returns Result object with registered types and any errors
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```typescript
|
|
80
|
-
* import { registerFlowDropPlugin } from "@flowdrop/lib";
|
|
81
|
-
* import FancyNode from "./FancyNode.svelte";
|
|
82
|
-
* import GlowNode from "./GlowNode.svelte";
|
|
83
|
-
*
|
|
84
|
-
* const result = registerFlowDropPlugin({
|
|
85
|
-
* namespace: "awesome",
|
|
86
|
-
* name: "Awesome Nodes",
|
|
87
|
-
* version: "1.0.0",
|
|
88
|
-
* nodes: [
|
|
89
|
-
* {
|
|
90
|
-
* type: "fancy",
|
|
91
|
-
* displayName: "Fancy Node",
|
|
92
|
-
* component: FancyNode,
|
|
93
|
-
* icon: "mdi:sparkles"
|
|
94
|
-
* },
|
|
95
|
-
* {
|
|
96
|
-
* type: "glow",
|
|
97
|
-
* displayName: "Glowing Node",
|
|
98
|
-
* component: GlowNode,
|
|
99
|
-
* icon: "mdi:lightbulb"
|
|
100
|
-
* }
|
|
101
|
-
* ]
|
|
102
|
-
* });
|
|
103
|
-
*
|
|
104
|
-
* // Result:
|
|
105
|
-
* // {
|
|
106
|
-
* // success: true,
|
|
107
|
-
* // namespace: "awesome",
|
|
108
|
-
* // registeredTypes: ["awesome:fancy", "awesome:glow"],
|
|
109
|
-
* // errors: []
|
|
110
|
-
* // }
|
|
111
|
-
* ```
|
|
112
|
-
*/
|
|
113
|
-
export declare function registerFlowDropPlugin(config: FlowDropPluginConfig): PluginRegistrationResult;
|
|
114
|
-
/**
|
|
115
|
-
* Unregister all nodes from a plugin by namespace.
|
|
116
|
-
*
|
|
117
|
-
* @param namespace - The plugin namespace to unregister
|
|
118
|
-
* @returns Array of unregistered type identifiers
|
|
119
|
-
*
|
|
120
|
-
* @example
|
|
121
|
-
* ```typescript
|
|
122
|
-
* const removed = unregisterFlowDropPlugin("awesome");
|
|
123
|
-
* // Returns ["awesome:fancy", "awesome:glow"]
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
126
|
-
export declare function unregisterFlowDropPlugin(namespace: string): string[];
|
|
127
|
-
/**
|
|
128
|
-
* Check if a namespace is valid.
|
|
129
|
-
* Must be lowercase alphanumeric with optional hyphens.
|
|
130
|
-
*
|
|
131
|
-
* @param namespace - The namespace to validate
|
|
132
|
-
* @returns true if valid
|
|
133
|
-
*/
|
|
134
|
-
export declare function isValidNamespace(namespace: string): boolean;
|
|
135
|
-
/**
|
|
136
|
-
* Get all registered plugins (unique namespaces).
|
|
137
|
-
*
|
|
138
|
-
* @returns Array of namespace strings
|
|
139
|
-
*/
|
|
140
|
-
export declare function getRegisteredPlugins(): string[];
|
|
141
|
-
/**
|
|
142
|
-
* Get the count of nodes registered by a plugin.
|
|
143
|
-
*
|
|
144
|
-
* @param namespace - The plugin namespace
|
|
145
|
-
* @returns Number of nodes registered by this plugin
|
|
146
|
-
*/
|
|
147
|
-
export declare function getPluginNodeCount(namespace: string): number;
|
|
148
|
-
/**
|
|
149
|
-
* Register a single custom node without a full plugin.
|
|
150
|
-
* Useful for project-specific custom nodes.
|
|
151
|
-
*
|
|
152
|
-
* @param type - Type identifier (can be namespaced or plain)
|
|
153
|
-
* @param displayName - Display name for UI
|
|
154
|
-
* @param component - Svelte component
|
|
155
|
-
* @param options - Additional options
|
|
156
|
-
*
|
|
157
|
-
* @example
|
|
158
|
-
* ```typescript
|
|
159
|
-
* import { registerCustomNode } from "@flowdrop/lib";
|
|
160
|
-
* import MyNode from "./MyNode.svelte";
|
|
161
|
-
*
|
|
162
|
-
* registerCustomNode("myproject:special", "Special Node", MyNode, {
|
|
163
|
-
* icon: "mdi:star",
|
|
164
|
-
* description: "A special node for my project"
|
|
165
|
-
* });
|
|
166
|
-
* ```
|
|
167
|
-
*/
|
|
168
|
-
export declare function registerCustomNode(type: string, displayName: string, component: Component<NodeComponentProps>, options?: {
|
|
169
|
-
description?: string;
|
|
170
|
-
icon?: string;
|
|
171
|
-
category?: NodeComponentCategory;
|
|
172
|
-
source?: string;
|
|
173
|
-
statusPosition?: StatusPosition;
|
|
174
|
-
statusSize?: StatusSize;
|
|
175
|
-
}): void;
|
|
176
|
-
/**
|
|
177
|
-
* Create a plugin builder for a fluent API experience.
|
|
178
|
-
*
|
|
179
|
-
* @param namespace - Plugin namespace
|
|
180
|
-
* @param name - Plugin name
|
|
181
|
-
* @returns Plugin builder with chainable methods
|
|
182
|
-
*
|
|
183
|
-
* @example
|
|
184
|
-
* ```typescript
|
|
185
|
-
* import { createPlugin } from "@flowdrop/lib";
|
|
186
|
-
*
|
|
187
|
-
* createPlugin("awesome", "Awesome Nodes")
|
|
188
|
-
* .version("1.0.0")
|
|
189
|
-
* .node("fancy", "Fancy Node", FancyNode)
|
|
190
|
-
* .node("glow", "Glowing Node", GlowNode, { icon: "mdi:lightbulb" })
|
|
191
|
-
* .register();
|
|
192
|
-
* ```
|
|
193
|
-
*/
|
|
194
|
-
export declare function createPlugin(namespace: string, name: string): {
|
|
195
|
-
/**
|
|
196
|
-
* Set plugin version
|
|
197
|
-
*/
|
|
198
|
-
version(v: string): /*elided*/ any;
|
|
199
|
-
/**
|
|
200
|
-
* Set plugin description
|
|
201
|
-
*/
|
|
202
|
-
description(desc: string): /*elided*/ any;
|
|
203
|
-
/**
|
|
204
|
-
* Add a node to the plugin
|
|
205
|
-
*/
|
|
206
|
-
node(type: string, displayName: string, component: Component<NodeComponentProps>, options?: Partial<Omit<PluginNodeDefinition, "type" | "displayName" | "component">>): /*elided*/ any;
|
|
207
|
-
/**
|
|
208
|
-
* Register the plugin
|
|
209
|
-
*/
|
|
210
|
-
register(): PluginRegistrationResult;
|
|
211
|
-
/**
|
|
212
|
-
* Get the config without registering (for testing/inspection)
|
|
213
|
-
*/
|
|
214
|
-
getConfig(): FlowDropPluginConfig;
|
|
215
|
-
};
|
package/dist/registry/plugin.js
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FlowDrop Plugin System
|
|
3
|
-
* Provides APIs for external libraries to register custom node components.
|
|
4
|
-
*
|
|
5
|
-
* This enables a plugin ecosystem where:
|
|
6
|
-
* - Third-party libraries can provide custom node types
|
|
7
|
-
* - Custom nodes are namespaced to avoid conflicts
|
|
8
|
-
* - Registration is simplified with a clean API
|
|
9
|
-
*/
|
|
10
|
-
import { nodeComponentRegistry, createNamespacedType } from './nodeComponentRegistry.js';
|
|
11
|
-
/**
|
|
12
|
-
* Register a FlowDrop plugin with custom node components.
|
|
13
|
-
* All node types are automatically namespaced with the plugin namespace.
|
|
14
|
-
*
|
|
15
|
-
* @param config - Plugin configuration with namespace and node definitions
|
|
16
|
-
* @returns Result object with registered types and any errors
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* import { registerFlowDropPlugin } from "@flowdrop/lib";
|
|
21
|
-
* import FancyNode from "./FancyNode.svelte";
|
|
22
|
-
* import GlowNode from "./GlowNode.svelte";
|
|
23
|
-
*
|
|
24
|
-
* const result = registerFlowDropPlugin({
|
|
25
|
-
* namespace: "awesome",
|
|
26
|
-
* name: "Awesome Nodes",
|
|
27
|
-
* version: "1.0.0",
|
|
28
|
-
* nodes: [
|
|
29
|
-
* {
|
|
30
|
-
* type: "fancy",
|
|
31
|
-
* displayName: "Fancy Node",
|
|
32
|
-
* component: FancyNode,
|
|
33
|
-
* icon: "mdi:sparkles"
|
|
34
|
-
* },
|
|
35
|
-
* {
|
|
36
|
-
* type: "glow",
|
|
37
|
-
* displayName: "Glowing Node",
|
|
38
|
-
* component: GlowNode,
|
|
39
|
-
* icon: "mdi:lightbulb"
|
|
40
|
-
* }
|
|
41
|
-
* ]
|
|
42
|
-
* });
|
|
43
|
-
*
|
|
44
|
-
* // Result:
|
|
45
|
-
* // {
|
|
46
|
-
* // success: true,
|
|
47
|
-
* // namespace: "awesome",
|
|
48
|
-
* // registeredTypes: ["awesome:fancy", "awesome:glow"],
|
|
49
|
-
* // errors: []
|
|
50
|
-
* // }
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
export function registerFlowDropPlugin(config) {
|
|
54
|
-
const result = {
|
|
55
|
-
success: true,
|
|
56
|
-
namespace: config.namespace,
|
|
57
|
-
registeredTypes: [],
|
|
58
|
-
errors: []
|
|
59
|
-
};
|
|
60
|
-
// Validate namespace
|
|
61
|
-
if (!isValidNamespace(config.namespace)) {
|
|
62
|
-
result.success = false;
|
|
63
|
-
result.errors.push(`Invalid namespace "${config.namespace}". ` +
|
|
64
|
-
`Namespace must be lowercase alphanumeric with optional hyphens.`);
|
|
65
|
-
return result;
|
|
66
|
-
}
|
|
67
|
-
// Register each node
|
|
68
|
-
for (const nodeDef of config.nodes) {
|
|
69
|
-
try {
|
|
70
|
-
const namespacedType = createNamespacedType(config.namespace, nodeDef.type);
|
|
71
|
-
const registration = {
|
|
72
|
-
type: namespacedType,
|
|
73
|
-
displayName: nodeDef.displayName,
|
|
74
|
-
description: nodeDef.description,
|
|
75
|
-
component: nodeDef.component,
|
|
76
|
-
icon: nodeDef.icon,
|
|
77
|
-
category: nodeDef.category ?? 'custom',
|
|
78
|
-
source: config.namespace,
|
|
79
|
-
statusPosition: nodeDef.statusPosition,
|
|
80
|
-
statusSize: nodeDef.statusSize
|
|
81
|
-
};
|
|
82
|
-
nodeComponentRegistry.register(registration);
|
|
83
|
-
result.registeredTypes.push(namespacedType);
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
result.success = false;
|
|
87
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
88
|
-
result.errors.push(`Failed to register ${config.namespace}:${nodeDef.type}: ${errorMessage}`);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return result;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Unregister all nodes from a plugin by namespace.
|
|
95
|
-
*
|
|
96
|
-
* @param namespace - The plugin namespace to unregister
|
|
97
|
-
* @returns Array of unregistered type identifiers
|
|
98
|
-
*
|
|
99
|
-
* @example
|
|
100
|
-
* ```typescript
|
|
101
|
-
* const removed = unregisterFlowDropPlugin("awesome");
|
|
102
|
-
* // Returns ["awesome:fancy", "awesome:glow"]
|
|
103
|
-
* ```
|
|
104
|
-
*/
|
|
105
|
-
export function unregisterFlowDropPlugin(namespace) {
|
|
106
|
-
const unregistered = [];
|
|
107
|
-
const types = nodeComponentRegistry.getTypes();
|
|
108
|
-
for (const type of types) {
|
|
109
|
-
if (type.startsWith(`${namespace}:`)) {
|
|
110
|
-
if (nodeComponentRegistry.unregister(type)) {
|
|
111
|
-
unregistered.push(type);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return unregistered;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Check if a namespace is valid.
|
|
119
|
-
* Must be lowercase alphanumeric with optional hyphens.
|
|
120
|
-
*
|
|
121
|
-
* @param namespace - The namespace to validate
|
|
122
|
-
* @returns true if valid
|
|
123
|
-
*/
|
|
124
|
-
export function isValidNamespace(namespace) {
|
|
125
|
-
return /^[a-z][a-z0-9-]*$/.test(namespace);
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Get all registered plugins (unique namespaces).
|
|
129
|
-
*
|
|
130
|
-
* @returns Array of namespace strings
|
|
131
|
-
*/
|
|
132
|
-
export function getRegisteredPlugins() {
|
|
133
|
-
const sources = new Set();
|
|
134
|
-
const registrations = nodeComponentRegistry.getAll();
|
|
135
|
-
for (const reg of registrations) {
|
|
136
|
-
if (reg.source && reg.source !== 'flowdrop') {
|
|
137
|
-
sources.add(reg.source);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return Array.from(sources);
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Get the count of nodes registered by a plugin.
|
|
144
|
-
*
|
|
145
|
-
* @param namespace - The plugin namespace
|
|
146
|
-
* @returns Number of nodes registered by this plugin
|
|
147
|
-
*/
|
|
148
|
-
export function getPluginNodeCount(namespace) {
|
|
149
|
-
return nodeComponentRegistry.getBySource(namespace).length;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Register a single custom node without a full plugin.
|
|
153
|
-
* Useful for project-specific custom nodes.
|
|
154
|
-
*
|
|
155
|
-
* @param type - Type identifier (can be namespaced or plain)
|
|
156
|
-
* @param displayName - Display name for UI
|
|
157
|
-
* @param component - Svelte component
|
|
158
|
-
* @param options - Additional options
|
|
159
|
-
*
|
|
160
|
-
* @example
|
|
161
|
-
* ```typescript
|
|
162
|
-
* import { registerCustomNode } from "@flowdrop/lib";
|
|
163
|
-
* import MyNode from "./MyNode.svelte";
|
|
164
|
-
*
|
|
165
|
-
* registerCustomNode("myproject:special", "Special Node", MyNode, {
|
|
166
|
-
* icon: "mdi:star",
|
|
167
|
-
* description: "A special node for my project"
|
|
168
|
-
* });
|
|
169
|
-
* ```
|
|
170
|
-
*/
|
|
171
|
-
export function registerCustomNode(type, displayName, component, options = {}) {
|
|
172
|
-
nodeComponentRegistry.register({
|
|
173
|
-
type,
|
|
174
|
-
displayName,
|
|
175
|
-
component,
|
|
176
|
-
description: options.description,
|
|
177
|
-
icon: options.icon,
|
|
178
|
-
category: options.category ?? 'custom',
|
|
179
|
-
source: options.source ?? 'custom',
|
|
180
|
-
statusPosition: options.statusPosition,
|
|
181
|
-
statusSize: options.statusSize
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Create a plugin builder for a fluent API experience.
|
|
186
|
-
*
|
|
187
|
-
* @param namespace - Plugin namespace
|
|
188
|
-
* @param name - Plugin name
|
|
189
|
-
* @returns Plugin builder with chainable methods
|
|
190
|
-
*
|
|
191
|
-
* @example
|
|
192
|
-
* ```typescript
|
|
193
|
-
* import { createPlugin } from "@flowdrop/lib";
|
|
194
|
-
*
|
|
195
|
-
* createPlugin("awesome", "Awesome Nodes")
|
|
196
|
-
* .version("1.0.0")
|
|
197
|
-
* .node("fancy", "Fancy Node", FancyNode)
|
|
198
|
-
* .node("glow", "Glowing Node", GlowNode, { icon: "mdi:lightbulb" })
|
|
199
|
-
* .register();
|
|
200
|
-
* ```
|
|
201
|
-
*/
|
|
202
|
-
export function createPlugin(namespace, name) {
|
|
203
|
-
const config = {
|
|
204
|
-
namespace,
|
|
205
|
-
name,
|
|
206
|
-
nodes: []
|
|
207
|
-
};
|
|
208
|
-
const builder = {
|
|
209
|
-
/**
|
|
210
|
-
* Set plugin version
|
|
211
|
-
*/
|
|
212
|
-
version(v) {
|
|
213
|
-
config.version = v;
|
|
214
|
-
return builder;
|
|
215
|
-
},
|
|
216
|
-
/**
|
|
217
|
-
* Set plugin description
|
|
218
|
-
*/
|
|
219
|
-
description(desc) {
|
|
220
|
-
config.description = desc;
|
|
221
|
-
return builder;
|
|
222
|
-
},
|
|
223
|
-
/**
|
|
224
|
-
* Add a node to the plugin
|
|
225
|
-
*/
|
|
226
|
-
node(type, displayName, component, options = {}) {
|
|
227
|
-
config.nodes.push({
|
|
228
|
-
type,
|
|
229
|
-
displayName,
|
|
230
|
-
component,
|
|
231
|
-
...options
|
|
232
|
-
});
|
|
233
|
-
return builder;
|
|
234
|
-
},
|
|
235
|
-
/**
|
|
236
|
-
* Register the plugin
|
|
237
|
-
*/
|
|
238
|
-
register() {
|
|
239
|
-
return registerFlowDropPlugin(config);
|
|
240
|
-
},
|
|
241
|
-
/**
|
|
242
|
-
* Get the config without registering (for testing/inspection)
|
|
243
|
-
*/
|
|
244
|
-
getConfig() {
|
|
245
|
-
return { ...config };
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
return builder;
|
|
249
|
-
}
|
package/dist/services/api.d.ts
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Client-side API service for FlowDrop
|
|
3
|
-
* Provides methods to interact with the backend APIs using configurable endpoints
|
|
4
|
-
*/
|
|
5
|
-
import type { NodeMetadata, Workflow } from '../types/index.js';
|
|
6
|
-
import type { EndpointConfig } from '../config/endpoints.js';
|
|
7
|
-
/**
|
|
8
|
-
* Set the endpoint configuration at runtime
|
|
9
|
-
*/
|
|
10
|
-
export declare function setEndpointConfig(config: EndpointConfig): void;
|
|
11
|
-
/**
|
|
12
|
-
* Get the current endpoint configuration
|
|
13
|
-
*/
|
|
14
|
-
export declare function getEndpointConfig(): EndpointConfig | null;
|
|
15
|
-
/**
|
|
16
|
-
* Node API methods
|
|
17
|
-
*/
|
|
18
|
-
export declare const nodeApi: {
|
|
19
|
-
/**
|
|
20
|
-
* Get all node types with optional filtering
|
|
21
|
-
*/
|
|
22
|
-
getNodes(options?: {
|
|
23
|
-
category?: string;
|
|
24
|
-
search?: string;
|
|
25
|
-
limit?: number;
|
|
26
|
-
offset?: number;
|
|
27
|
-
}): Promise<NodeMetadata[]>;
|
|
28
|
-
/**
|
|
29
|
-
* Get a specific node type by ID
|
|
30
|
-
*/
|
|
31
|
-
getNode(id: string): Promise<NodeMetadata>;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Workflow API methods
|
|
35
|
-
*/
|
|
36
|
-
export declare const workflowApi: {
|
|
37
|
-
/**
|
|
38
|
-
* Get all workflows with optional filtering
|
|
39
|
-
*/
|
|
40
|
-
getWorkflows(options?: {
|
|
41
|
-
search?: string;
|
|
42
|
-
limit?: number;
|
|
43
|
-
offset?: number;
|
|
44
|
-
}): Promise<Workflow[]>;
|
|
45
|
-
/**
|
|
46
|
-
* Get a specific workflow by ID
|
|
47
|
-
*/
|
|
48
|
-
getWorkflow(id: string): Promise<Workflow>;
|
|
49
|
-
/**
|
|
50
|
-
* Create a new workflow
|
|
51
|
-
*/
|
|
52
|
-
createWorkflow(workflow: Omit<Workflow, "id">): Promise<Workflow>;
|
|
53
|
-
/**
|
|
54
|
-
* Update an existing workflow
|
|
55
|
-
*/
|
|
56
|
-
updateWorkflow(id: string, workflow: Partial<Workflow>): Promise<Workflow>;
|
|
57
|
-
/**
|
|
58
|
-
* Delete a workflow
|
|
59
|
-
*/
|
|
60
|
-
deleteWorkflow(id: string): Promise<void>;
|
|
61
|
-
/**
|
|
62
|
-
* Save workflow (create or update).
|
|
63
|
-
*
|
|
64
|
-
* A workflow is considered existing when it already has an id (any format —
|
|
65
|
-
* integer, UUID, slug). Only a missing/empty id means "truly new".
|
|
66
|
-
*
|
|
67
|
-
* Note: globalSave.ts bypasses this method and calls createWorkflow /
|
|
68
|
-
* updateWorkflow directly so it can capture the new/existing decision before
|
|
69
|
-
* the uuidv4() fallback. This method is kept for external callers.
|
|
70
|
-
*/
|
|
71
|
-
saveWorkflow(workflow: Workflow): Promise<Workflow>;
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* Export the API service
|
|
75
|
-
*/
|
|
76
|
-
export declare const api: {
|
|
77
|
-
nodes: {
|
|
78
|
-
/**
|
|
79
|
-
* Get all node types with optional filtering
|
|
80
|
-
*/
|
|
81
|
-
getNodes(options?: {
|
|
82
|
-
category?: string;
|
|
83
|
-
search?: string;
|
|
84
|
-
limit?: number;
|
|
85
|
-
offset?: number;
|
|
86
|
-
}): Promise<NodeMetadata[]>;
|
|
87
|
-
/**
|
|
88
|
-
* Get a specific node type by ID
|
|
89
|
-
*/
|
|
90
|
-
getNode(id: string): Promise<NodeMetadata>;
|
|
91
|
-
};
|
|
92
|
-
workflows: {
|
|
93
|
-
/**
|
|
94
|
-
* Get all workflows with optional filtering
|
|
95
|
-
*/
|
|
96
|
-
getWorkflows(options?: {
|
|
97
|
-
search?: string;
|
|
98
|
-
limit?: number;
|
|
99
|
-
offset?: number;
|
|
100
|
-
}): Promise<Workflow[]>;
|
|
101
|
-
/**
|
|
102
|
-
* Get a specific workflow by ID
|
|
103
|
-
*/
|
|
104
|
-
getWorkflow(id: string): Promise<Workflow>;
|
|
105
|
-
/**
|
|
106
|
-
* Create a new workflow
|
|
107
|
-
*/
|
|
108
|
-
createWorkflow(workflow: Omit<Workflow, "id">): Promise<Workflow>;
|
|
109
|
-
/**
|
|
110
|
-
* Update an existing workflow
|
|
111
|
-
*/
|
|
112
|
-
updateWorkflow(id: string, workflow: Partial<Workflow>): Promise<Workflow>;
|
|
113
|
-
/**
|
|
114
|
-
* Delete a workflow
|
|
115
|
-
*/
|
|
116
|
-
deleteWorkflow(id: string): Promise<void>;
|
|
117
|
-
/**
|
|
118
|
-
* Save workflow (create or update).
|
|
119
|
-
*
|
|
120
|
-
* A workflow is considered existing when it already has an id (any format —
|
|
121
|
-
* integer, UUID, slug). Only a missing/empty id means "truly new".
|
|
122
|
-
*
|
|
123
|
-
* Note: globalSave.ts bypasses this method and calls createWorkflow /
|
|
124
|
-
* updateWorkflow directly so it can capture the new/existing decision before
|
|
125
|
-
* the uuidv4() fallback. This method is kept for external callers.
|
|
126
|
-
*/
|
|
127
|
-
saveWorkflow(workflow: Workflow): Promise<Workflow>;
|
|
128
|
-
};
|
|
129
|
-
};
|