@d34dman/flowdrop 0.0.63 → 0.0.65
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 +2 -0
- package/dist/adapters/agentspec/AgentSpecAdapter.js +1 -40
- package/dist/api/enhanced-client.d.ts +19 -0
- package/dist/api/enhanced-client.js +9 -0
- package/dist/components/App.svelte +32 -36
- package/dist/components/CanvasBanner.stories.svelte +12 -8
- package/dist/components/CanvasBanner.stories.svelte.d.ts +1 -1
- package/dist/components/ConfigModal.svelte +7 -11
- package/dist/components/ConfigModal.svelte.d.ts +5 -23
- package/dist/components/ConfigPanel.stories.svelte +35 -26
- package/dist/components/ConfigPanel.stories.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/Logo.stories.svelte +4 -4
- package/dist/components/Logo.stories.svelte.d.ts +1 -1
- package/dist/components/LogsSidebar.svelte +6 -9
- package/dist/components/LogsSidebar.svelte.d.ts +3 -20
- package/dist/components/MarkdownDisplay.stories.svelte +25 -10
- package/dist/components/MarkdownDisplay.stories.svelte.d.ts +1 -1
- package/dist/components/Navbar.stories.svelte +42 -30
- package/dist/components/Navbar.stories.svelte.d.ts +1 -1
- package/dist/components/Navbar.svelte +6 -3
- package/dist/components/NodeSidebar.svelte +1 -0
- package/dist/components/NodeStatusOverlay.stories.svelte +61 -50
- package/dist/components/NodeStatusOverlay.stories.svelte.d.ts +1 -1
- package/dist/components/NodeStatusOverlay.svelte +4 -4
- package/dist/components/PipelineStatus.svelte +10 -12
- package/dist/components/PipelineStatus.svelte.d.ts +2 -2
- package/dist/components/SchemaForm.stories.svelte +97 -82
- package/dist/components/SchemaForm.stories.svelte.d.ts +1 -1
- package/dist/components/SchemaForm.svelte +6 -2
- package/dist/components/SettingsPanel.svelte +6 -1
- package/dist/components/StatusIcon.stories.svelte +15 -15
- package/dist/components/StatusIcon.stories.svelte.d.ts +1 -1
- package/dist/components/StatusIcon.svelte +1 -1
- package/dist/components/StatusLabel.stories.svelte +8 -8
- package/dist/components/StatusLabel.stories.svelte.d.ts +1 -1
- package/dist/components/ThemeToggle.stories.svelte +10 -10
- package/dist/components/ThemeToggle.stories.svelte.d.ts +1 -1
- package/dist/components/WorkflowEditor.svelte +23 -5
- package/dist/components/form/FormAutocomplete.svelte +2 -0
- package/dist/components/form/FormCheckboxGroup.stories.svelte +13 -13
- package/dist/components/form/FormCheckboxGroup.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormField.svelte +2 -2
- package/dist/components/form/FormFieldLight.svelte +4 -4
- package/dist/components/form/FormFieldWrapper.stories.svelte +38 -16
- package/dist/components/form/FormFieldWrapper.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormNumberField.stories.svelte +21 -18
- package/dist/components/form/FormNumberField.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormRangeField.stories.svelte +13 -13
- package/dist/components/form/FormRangeField.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormSelect.stories.svelte +21 -21
- package/dist/components/form/FormSelect.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormTemplateEditor.svelte +0 -13
- package/dist/components/form/FormTemplateEditor.svelte.d.ts +1 -7
- package/dist/components/form/FormTextField.stories.svelte +17 -17
- package/dist/components/form/FormTextField.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormTextarea.stories.svelte +21 -18
- package/dist/components/form/FormTextarea.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormToggle.stories.svelte +13 -13
- package/dist/components/form/FormToggle.stories.svelte.d.ts +1 -1
- package/dist/components/form/index.d.ts +2 -1
- package/dist/components/form/index.js +1 -2
- package/dist/components/form/types.d.ts +8 -20
- package/dist/components/form/types.js +3 -8
- package/dist/components/interrupt/ChoicePrompt.stories.svelte +37 -28
- package/dist/components/interrupt/ChoicePrompt.stories.svelte.d.ts +1 -1
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte +57 -35
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte.d.ts +1 -1
- package/dist/components/interrupt/FormPrompt.svelte +1 -0
- package/dist/components/interrupt/ReviewPrompt.stories.svelte +52 -31
- package/dist/components/interrupt/ReviewPrompt.stories.svelte.d.ts +1 -1
- package/dist/components/interrupt/ReviewPrompt.svelte +44 -25
- package/dist/components/interrupt/TextInputPrompt.stories.svelte +32 -19
- package/dist/components/interrupt/TextInputPrompt.stories.svelte.d.ts +1 -1
- package/dist/components/interrupt/TextInputPrompt.svelte +1 -0
- package/dist/components/layouts/MainLayout.svelte +3 -0
- package/dist/components/nodes/GatewayNode.stories.svelte +96 -64
- package/dist/components/nodes/IdeaNode.stories.svelte +40 -36
- package/dist/components/nodes/NotesNode.stories.svelte +61 -54
- package/dist/components/nodes/SimpleNode.stories.svelte +141 -83
- package/dist/components/nodes/SquareNode.stories.svelte +70 -44
- package/dist/components/nodes/TerminalNode.stories.svelte +10 -10
- package/dist/components/nodes/TerminalNode.svelte +6 -2
- package/dist/components/nodes/ToolNode.stories.svelte +177 -59
- package/dist/components/nodes/WorkflowNode.stories.svelte +43 -38
- package/dist/components/playground/MessageBubble.stories.svelte +51 -38
- package/dist/components/playground/MessageBubble.stories.svelte.d.ts +1 -1
- package/dist/components/playground/Playground.svelte +2 -4
- package/dist/config/constants.d.ts +21 -0
- package/dist/config/constants.js +9 -0
- package/dist/core/index.d.ts +7 -5
- package/dist/core/index.js +5 -5
- package/dist/editor/index.d.ts +4 -4
- package/dist/editor/index.js +3 -4
- package/dist/form/code.js +16 -4
- package/dist/form/fieldRegistry.d.ts +8 -82
- package/dist/form/fieldRegistry.js +9 -101
- package/dist/form/full.d.ts +4 -1
- package/dist/form/full.js +6 -1
- package/dist/form/index.d.ts +1 -1
- package/dist/form/index.js +0 -2
- package/dist/form/markdown.js +11 -3
- package/dist/helpers/workflowEditorHelper.d.ts +0 -3
- package/dist/helpers/workflowEditorHelper.js +7 -26
- package/dist/index.js +3 -0
- package/dist/services/apiVariableService.d.ts +1 -3
- package/dist/services/apiVariableService.js +3 -4
- package/dist/services/dynamicSchemaService.js +3 -4
- package/dist/stories/CanvasDecorator.svelte +7 -8
- package/dist/stories/CanvasDecorator.svelte.d.ts +2 -2
- package/dist/stories/NodeDecorator.svelte +13 -14
- package/dist/stories/NodeDecorator.svelte.d.ts +1 -1
- package/dist/stories/utils.d.ts +2 -2
- package/dist/stories/utils.js +55 -55
- package/dist/styles/base.css +12 -4
- package/dist/styles/tokens.css +138 -130
- package/dist/types/interrupt.d.ts +1 -4
- package/dist/utils/errors.d.ts +28 -0
- package/dist/utils/errors.js +44 -0
- package/dist/utils/handleIds.d.ts +35 -0
- package/dist/utils/handleIds.js +58 -0
- package/package.json +53 -12
- package/dist/api/client.d.ts +0 -110
- package/dist/api/client.js +0 -240
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error Handling Utilities
|
|
3
|
+
*
|
|
4
|
+
* @module utils/errors
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Normalize an unknown caught value into an Error instance.
|
|
8
|
+
*
|
|
9
|
+
* Use in catch blocks where the error type is `unknown`:
|
|
10
|
+
* ```typescript
|
|
11
|
+
* try { ... } catch (error) {
|
|
12
|
+
* const err = normalizeError(error);
|
|
13
|
+
* logger.error(err.message);
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param error - The caught value (may be Error, string, or anything)
|
|
18
|
+
* @returns An Error instance with a meaningful message
|
|
19
|
+
*/
|
|
20
|
+
export function normalizeError(error) {
|
|
21
|
+
if (error instanceof Error) {
|
|
22
|
+
return error;
|
|
23
|
+
}
|
|
24
|
+
if (typeof error === 'string') {
|
|
25
|
+
return new Error(error);
|
|
26
|
+
}
|
|
27
|
+
return new Error(String(error));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Extract a human-readable message from an unknown error.
|
|
31
|
+
*
|
|
32
|
+
* @param error - The caught value
|
|
33
|
+
* @param fallback - Fallback message if error has no useful info
|
|
34
|
+
* @returns A string message
|
|
35
|
+
*/
|
|
36
|
+
export function getErrorMessage(error, fallback = 'Unknown error') {
|
|
37
|
+
if (error instanceof Error) {
|
|
38
|
+
return error.message;
|
|
39
|
+
}
|
|
40
|
+
if (typeof error === 'string') {
|
|
41
|
+
return error;
|
|
42
|
+
}
|
|
43
|
+
return fallback;
|
|
44
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handle ID utilities for FlowDrop
|
|
3
|
+
*
|
|
4
|
+
* Handle IDs encode node + direction + port in the format:
|
|
5
|
+
* `${nodeId}-${direction}-${portId}` (e.g., "node1-output-trigger")
|
|
6
|
+
*
|
|
7
|
+
* @module utils/handleIds
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Build a handle ID from its parts.
|
|
11
|
+
*
|
|
12
|
+
* @param nodeId - The node identifier
|
|
13
|
+
* @param direction - 'input' or 'output'
|
|
14
|
+
* @param portId - The port identifier
|
|
15
|
+
* @returns A composite handle ID string
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildHandleId(nodeId: string, direction: 'input' | 'output', portId: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Extract the port ID from a composite handle ID.
|
|
20
|
+
*
|
|
21
|
+
* Supports two formats:
|
|
22
|
+
* 1. Standard: `${nodeId}-output-${portId}` or `${nodeId}-input-${portId}`
|
|
23
|
+
* 2. Short: just the portId itself (returned as-is)
|
|
24
|
+
*
|
|
25
|
+
* @param handleId - The handle ID string
|
|
26
|
+
* @returns The port ID, or null if handleId is empty/undefined
|
|
27
|
+
*/
|
|
28
|
+
export declare function extractPortId(handleId: string | undefined): string | null;
|
|
29
|
+
/**
|
|
30
|
+
* Extract the direction from a composite handle ID.
|
|
31
|
+
*
|
|
32
|
+
* @param handleId - The handle ID string
|
|
33
|
+
* @returns 'input', 'output', or null if not found
|
|
34
|
+
*/
|
|
35
|
+
export declare function extractDirection(handleId: string | undefined): 'input' | 'output' | null;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handle ID utilities for FlowDrop
|
|
3
|
+
*
|
|
4
|
+
* Handle IDs encode node + direction + port in the format:
|
|
5
|
+
* `${nodeId}-${direction}-${portId}` (e.g., "node1-output-trigger")
|
|
6
|
+
*
|
|
7
|
+
* @module utils/handleIds
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Build a handle ID from its parts.
|
|
11
|
+
*
|
|
12
|
+
* @param nodeId - The node identifier
|
|
13
|
+
* @param direction - 'input' or 'output'
|
|
14
|
+
* @param portId - The port identifier
|
|
15
|
+
* @returns A composite handle ID string
|
|
16
|
+
*/
|
|
17
|
+
export function buildHandleId(nodeId, direction, portId) {
|
|
18
|
+
return `${nodeId}-${direction}-${portId}`;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Extract the port ID from a composite handle ID.
|
|
22
|
+
*
|
|
23
|
+
* Supports two formats:
|
|
24
|
+
* 1. Standard: `${nodeId}-output-${portId}` or `${nodeId}-input-${portId}`
|
|
25
|
+
* 2. Short: just the portId itself (returned as-is)
|
|
26
|
+
*
|
|
27
|
+
* @param handleId - The handle ID string
|
|
28
|
+
* @returns The port ID, or null if handleId is empty/undefined
|
|
29
|
+
*/
|
|
30
|
+
export function extractPortId(handleId) {
|
|
31
|
+
if (!handleId)
|
|
32
|
+
return null;
|
|
33
|
+
const outputMatch = handleId.lastIndexOf('-output-');
|
|
34
|
+
if (outputMatch !== -1) {
|
|
35
|
+
return handleId.substring(outputMatch + '-output-'.length);
|
|
36
|
+
}
|
|
37
|
+
const inputMatch = handleId.lastIndexOf('-input-');
|
|
38
|
+
if (inputMatch !== -1) {
|
|
39
|
+
return handleId.substring(inputMatch + '-input-'.length);
|
|
40
|
+
}
|
|
41
|
+
// Short format: the handleId IS the port ID
|
|
42
|
+
return handleId;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Extract the direction from a composite handle ID.
|
|
46
|
+
*
|
|
47
|
+
* @param handleId - The handle ID string
|
|
48
|
+
* @returns 'input', 'output', or null if not found
|
|
49
|
+
*/
|
|
50
|
+
export function extractDirection(handleId) {
|
|
51
|
+
if (!handleId)
|
|
52
|
+
return null;
|
|
53
|
+
if (handleId.includes('-output-'))
|
|
54
|
+
return 'output';
|
|
55
|
+
if (handleId.includes('-input-'))
|
|
56
|
+
return 'input';
|
|
57
|
+
return null;
|
|
58
|
+
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@d34dman/flowdrop",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.65",
|
|
6
6
|
"watch": {
|
|
7
7
|
"build": {
|
|
8
8
|
"ignore": "build",
|
|
@@ -112,12 +112,53 @@
|
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
114
|
"peerDependencies": {
|
|
115
|
+
"@codemirror/autocomplete": "^6.20.0",
|
|
116
|
+
"@codemirror/commands": "^6.10.2",
|
|
117
|
+
"@codemirror/lang-json": "^6.0.2",
|
|
118
|
+
"@codemirror/lang-markdown": "^6.5.0",
|
|
119
|
+
"@codemirror/language": "^6.12.1",
|
|
120
|
+
"@codemirror/lint": "^6.9.2",
|
|
121
|
+
"@codemirror/state": "^6.5.4",
|
|
122
|
+
"@codemirror/theme-one-dark": "^6.1.3",
|
|
123
|
+
"@codemirror/view": "^6.39.14",
|
|
115
124
|
"@iconify/svelte": "^5.0.0",
|
|
125
|
+
"@xyflow/svelte": "^1.2",
|
|
126
|
+
"codemirror": "^6.0.2",
|
|
116
127
|
"svelte": "^5.0.0"
|
|
117
128
|
},
|
|
118
129
|
"peerDependenciesMeta": {
|
|
130
|
+
"@codemirror/autocomplete": {
|
|
131
|
+
"optional": true
|
|
132
|
+
},
|
|
133
|
+
"@codemirror/commands": {
|
|
134
|
+
"optional": true
|
|
135
|
+
},
|
|
136
|
+
"@codemirror/lang-json": {
|
|
137
|
+
"optional": true
|
|
138
|
+
},
|
|
139
|
+
"@codemirror/lang-markdown": {
|
|
140
|
+
"optional": true
|
|
141
|
+
},
|
|
142
|
+
"@codemirror/language": {
|
|
143
|
+
"optional": true
|
|
144
|
+
},
|
|
145
|
+
"@codemirror/lint": {
|
|
146
|
+
"optional": true
|
|
147
|
+
},
|
|
148
|
+
"@codemirror/state": {
|
|
149
|
+
"optional": true
|
|
150
|
+
},
|
|
151
|
+
"@codemirror/theme-one-dark": {
|
|
152
|
+
"optional": true
|
|
153
|
+
},
|
|
154
|
+
"@codemirror/view": {
|
|
155
|
+
"optional": true
|
|
156
|
+
},
|
|
119
157
|
"@iconify/svelte": {
|
|
120
158
|
"optional": true
|
|
159
|
+
},
|
|
160
|
+
"codemirror": {
|
|
161
|
+
"optional": true
|
|
121
162
|
}
|
|
122
163
|
},
|
|
123
164
|
"repository": {
|
|
@@ -126,6 +167,17 @@
|
|
|
126
167
|
},
|
|
127
168
|
"devDependencies": {
|
|
128
169
|
"@chromatic-com/storybook": "^5.0.1",
|
|
170
|
+
"@xyflow/svelte": "^1.2",
|
|
171
|
+
"@codemirror/autocomplete": "^6.20.0",
|
|
172
|
+
"@codemirror/commands": "^6.10.2",
|
|
173
|
+
"@codemirror/lang-json": "^6.0.2",
|
|
174
|
+
"@codemirror/lang-markdown": "^6.5.0",
|
|
175
|
+
"@codemirror/language": "^6.12.1",
|
|
176
|
+
"@codemirror/lint": "^6.9.2",
|
|
177
|
+
"@codemirror/state": "^6.5.4",
|
|
178
|
+
"@codemirror/theme-one-dark": "^6.1.3",
|
|
179
|
+
"@codemirror/view": "^6.39.14",
|
|
180
|
+
"codemirror": "^6.0.2",
|
|
129
181
|
"@eslint/compat": "^1.2.5",
|
|
130
182
|
"@eslint/js": "^9.18.0",
|
|
131
183
|
"@iconify/svelte": "^5.0.0",
|
|
@@ -191,17 +243,6 @@
|
|
|
191
243
|
"dag"
|
|
192
244
|
],
|
|
193
245
|
"dependencies": {
|
|
194
|
-
"@codemirror/autocomplete": "^6.20.0",
|
|
195
|
-
"@codemirror/commands": "^6.10.2",
|
|
196
|
-
"@codemirror/lang-json": "^6.0.2",
|
|
197
|
-
"@codemirror/lang-markdown": "^6.5.0",
|
|
198
|
-
"@codemirror/language": "^6.12.1",
|
|
199
|
-
"@codemirror/lint": "^6.9.2",
|
|
200
|
-
"@codemirror/state": "^6.5.4",
|
|
201
|
-
"@codemirror/theme-one-dark": "^6.1.3",
|
|
202
|
-
"@codemirror/view": "^6.39.14",
|
|
203
|
-
"@xyflow/svelte": "^1.2",
|
|
204
|
-
"codemirror": "^6.0.2",
|
|
205
246
|
"diff": "^8.0.3",
|
|
206
247
|
"dompurify": "^3.3.1",
|
|
207
248
|
"marked": "^16.1.1",
|
package/dist/api/client.d.ts
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* API Client for FlowDrop Workflow Library
|
|
3
|
-
*/
|
|
4
|
-
import type { NodeMetadata, Workflow, ExecutionResult, PortConfig, CategoryDefinition } from '../types/index.js';
|
|
5
|
-
/**
|
|
6
|
-
* HTTP API client for FlowDrop
|
|
7
|
-
*
|
|
8
|
-
* @deprecated Use {@link EnhancedFlowDropApiClient} instead, which supports
|
|
9
|
-
* configurable endpoints, authentication providers, retry logic, and timeouts.
|
|
10
|
-
* This class will be removed in a future major version.
|
|
11
|
-
*/
|
|
12
|
-
export declare class FlowDropApiClient {
|
|
13
|
-
private baseUrl;
|
|
14
|
-
private headers;
|
|
15
|
-
constructor(baseUrl: string, apiKey?: string);
|
|
16
|
-
/**
|
|
17
|
-
* Make HTTP request with error handling
|
|
18
|
-
*/
|
|
19
|
-
private request;
|
|
20
|
-
/**
|
|
21
|
-
* Fetch available node types and their metadata
|
|
22
|
-
*/
|
|
23
|
-
getAvailableNodes(): Promise<NodeMetadata[]>;
|
|
24
|
-
/**
|
|
25
|
-
* Fetch nodes by category
|
|
26
|
-
*/
|
|
27
|
-
getNodesByCategory(category: string): Promise<NodeMetadata[]>;
|
|
28
|
-
/**
|
|
29
|
-
* Fetch a specific node's metadata
|
|
30
|
-
*/
|
|
31
|
-
getNodeMetadata(nodeId: string): Promise<NodeMetadata>;
|
|
32
|
-
/**
|
|
33
|
-
* Save a workflow
|
|
34
|
-
*/
|
|
35
|
-
saveWorkflow(workflow: Workflow): Promise<Workflow>;
|
|
36
|
-
/**
|
|
37
|
-
* Update an existing workflow
|
|
38
|
-
*/
|
|
39
|
-
updateWorkflow(workflowId: string, workflow: Partial<Workflow>): Promise<Workflow>;
|
|
40
|
-
/**
|
|
41
|
-
* Load a workflow by ID
|
|
42
|
-
*/
|
|
43
|
-
loadWorkflow(workflowId: string): Promise<Workflow>;
|
|
44
|
-
/**
|
|
45
|
-
* List all workflows
|
|
46
|
-
*/
|
|
47
|
-
listWorkflows(): Promise<Workflow[]>;
|
|
48
|
-
/**
|
|
49
|
-
* Delete a workflow
|
|
50
|
-
*/
|
|
51
|
-
deleteWorkflow(workflowId: string): Promise<void>;
|
|
52
|
-
/**
|
|
53
|
-
* Execute a workflow
|
|
54
|
-
*/
|
|
55
|
-
executeWorkflow(workflowId: string, inputs?: Record<string, unknown>): Promise<ExecutionResult>;
|
|
56
|
-
/**
|
|
57
|
-
* Get execution status
|
|
58
|
-
*/
|
|
59
|
-
getExecutionStatus(executionId: string): Promise<ExecutionResult>;
|
|
60
|
-
/**
|
|
61
|
-
* Cancel workflow execution
|
|
62
|
-
*/
|
|
63
|
-
cancelExecution(executionId: string): Promise<void>;
|
|
64
|
-
/**
|
|
65
|
-
* Get execution logs
|
|
66
|
-
*/
|
|
67
|
-
getExecutionLogs(executionId: string): Promise<string[]>;
|
|
68
|
-
/**
|
|
69
|
-
* Validate workflow configuration
|
|
70
|
-
*/
|
|
71
|
-
validateWorkflow(workflow: Workflow): Promise<{
|
|
72
|
-
valid: boolean;
|
|
73
|
-
errors: string[];
|
|
74
|
-
}>;
|
|
75
|
-
/**
|
|
76
|
-
* Export workflow as JSON
|
|
77
|
-
*/
|
|
78
|
-
exportWorkflow(workflowId: string): Promise<string>;
|
|
79
|
-
/**
|
|
80
|
-
* Import workflow from JSON
|
|
81
|
-
*/
|
|
82
|
-
importWorkflow(workflowJson: string): Promise<Workflow>;
|
|
83
|
-
/**
|
|
84
|
-
* Fetch port configuration
|
|
85
|
-
*/
|
|
86
|
-
getPortConfig(): Promise<PortConfig>;
|
|
87
|
-
/**
|
|
88
|
-
* Fetch category definitions
|
|
89
|
-
*/
|
|
90
|
-
getCategories(): Promise<CategoryDefinition[]>;
|
|
91
|
-
/**
|
|
92
|
-
* Fetch pipeline data including job information and status
|
|
93
|
-
*/
|
|
94
|
-
getPipelineData(pipelineId: string): Promise<{
|
|
95
|
-
status: string;
|
|
96
|
-
jobs: Array<Record<string, unknown>>;
|
|
97
|
-
node_statuses: Record<string, {
|
|
98
|
-
status: string;
|
|
99
|
-
[key: string]: unknown;
|
|
100
|
-
}>;
|
|
101
|
-
job_status_summary: {
|
|
102
|
-
total: number;
|
|
103
|
-
pending: number;
|
|
104
|
-
running: number;
|
|
105
|
-
completed: number;
|
|
106
|
-
failed: number;
|
|
107
|
-
cancelled: number;
|
|
108
|
-
};
|
|
109
|
-
}>;
|
|
110
|
-
}
|
package/dist/api/client.js
DELETED
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* API Client for FlowDrop Workflow Library
|
|
3
|
-
*/
|
|
4
|
-
import { logger } from '../utils/logger.js';
|
|
5
|
-
/**
|
|
6
|
-
* HTTP API client for FlowDrop
|
|
7
|
-
*
|
|
8
|
-
* @deprecated Use {@link EnhancedFlowDropApiClient} instead, which supports
|
|
9
|
-
* configurable endpoints, authentication providers, retry logic, and timeouts.
|
|
10
|
-
* This class will be removed in a future major version.
|
|
11
|
-
*/
|
|
12
|
-
export class FlowDropApiClient {
|
|
13
|
-
baseUrl;
|
|
14
|
-
headers;
|
|
15
|
-
constructor(baseUrl, apiKey) {
|
|
16
|
-
this.baseUrl = baseUrl.replace(/\/$/, '');
|
|
17
|
-
this.headers = {
|
|
18
|
-
'Content-Type': 'application/json'
|
|
19
|
-
};
|
|
20
|
-
if (apiKey) {
|
|
21
|
-
this.headers['Authorization'] = `Bearer ${apiKey}`;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Make HTTP request with error handling
|
|
26
|
-
*/
|
|
27
|
-
async request(endpoint, options = {}) {
|
|
28
|
-
const url = `${this.baseUrl}${endpoint}`;
|
|
29
|
-
const config = {
|
|
30
|
-
headers: this.headers,
|
|
31
|
-
...options
|
|
32
|
-
};
|
|
33
|
-
try {
|
|
34
|
-
const response = await fetch(url, config);
|
|
35
|
-
if (!response.ok) {
|
|
36
|
-
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
37
|
-
}
|
|
38
|
-
const data = await response.json();
|
|
39
|
-
return data;
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
logger.error('API request failed:', error);
|
|
43
|
-
throw new Error(`API request failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Fetch available node types and their metadata
|
|
48
|
-
*/
|
|
49
|
-
async getAvailableNodes() {
|
|
50
|
-
const response = await this.request('/nodes');
|
|
51
|
-
if (!response.success || !response.data) {
|
|
52
|
-
throw new Error(response.error || 'Failed to fetch available nodes');
|
|
53
|
-
}
|
|
54
|
-
return response.data;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Fetch nodes by category
|
|
58
|
-
*/
|
|
59
|
-
async getNodesByCategory(category) {
|
|
60
|
-
const response = await this.request(`/nodes?category=${encodeURIComponent(category)}`);
|
|
61
|
-
if (!response.success || !response.data) {
|
|
62
|
-
throw new Error(response.error || 'Failed to fetch nodes by category');
|
|
63
|
-
}
|
|
64
|
-
return response.data;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Fetch a specific node's metadata
|
|
68
|
-
*/
|
|
69
|
-
async getNodeMetadata(nodeId) {
|
|
70
|
-
const response = await this.request(`/nodes/${encodeURIComponent(nodeId)}`);
|
|
71
|
-
if (!response.success || !response.data) {
|
|
72
|
-
throw new Error(response.error || 'Failed to fetch node metadata');
|
|
73
|
-
}
|
|
74
|
-
return response.data;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Save a workflow
|
|
78
|
-
*/
|
|
79
|
-
async saveWorkflow(workflow) {
|
|
80
|
-
const response = await this.request('/workflows', {
|
|
81
|
-
method: 'POST',
|
|
82
|
-
body: JSON.stringify(workflow)
|
|
83
|
-
});
|
|
84
|
-
if (!response.success || !response.data) {
|
|
85
|
-
throw new Error(response.error || 'Failed to save workflow');
|
|
86
|
-
}
|
|
87
|
-
return response.data;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Update an existing workflow
|
|
91
|
-
*/
|
|
92
|
-
async updateWorkflow(workflowId, workflow) {
|
|
93
|
-
const response = await this.request(`/workflows/${encodeURIComponent(workflowId)}`, {
|
|
94
|
-
method: 'PUT',
|
|
95
|
-
body: JSON.stringify(workflow)
|
|
96
|
-
});
|
|
97
|
-
if (!response.success || !response.data) {
|
|
98
|
-
throw new Error(response.error || 'Failed to update workflow');
|
|
99
|
-
}
|
|
100
|
-
return response.data;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Load a workflow by ID
|
|
104
|
-
*/
|
|
105
|
-
async loadWorkflow(workflowId) {
|
|
106
|
-
const response = await this.request(`/workflows/${encodeURIComponent(workflowId)}`);
|
|
107
|
-
if (!response.success || !response.data) {
|
|
108
|
-
throw new Error(response.error || 'Failed to load workflow');
|
|
109
|
-
}
|
|
110
|
-
return response.data;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* List all workflows
|
|
114
|
-
*/
|
|
115
|
-
async listWorkflows() {
|
|
116
|
-
const response = await this.request('/workflows');
|
|
117
|
-
if (!response.success || !response.data) {
|
|
118
|
-
throw new Error(response.error || 'Failed to list workflows');
|
|
119
|
-
}
|
|
120
|
-
return response.data;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Delete a workflow
|
|
124
|
-
*/
|
|
125
|
-
async deleteWorkflow(workflowId) {
|
|
126
|
-
const response = await this.request(`/workflows/${encodeURIComponent(workflowId)}`, {
|
|
127
|
-
method: 'DELETE'
|
|
128
|
-
});
|
|
129
|
-
if (!response.success) {
|
|
130
|
-
throw new Error(response.error || 'Failed to delete workflow');
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Execute a workflow
|
|
135
|
-
*/
|
|
136
|
-
async executeWorkflow(workflowId, inputs) {
|
|
137
|
-
const response = await this.request(`/workflows/${encodeURIComponent(workflowId)}/execute`, {
|
|
138
|
-
method: 'POST',
|
|
139
|
-
body: JSON.stringify({ inputs })
|
|
140
|
-
});
|
|
141
|
-
if (!response.success || !response.data) {
|
|
142
|
-
throw new Error(response.error || 'Failed to execute workflow');
|
|
143
|
-
}
|
|
144
|
-
return response.data;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Get execution status
|
|
148
|
-
*/
|
|
149
|
-
async getExecutionStatus(executionId) {
|
|
150
|
-
const response = await this.request(`/executions/${encodeURIComponent(executionId)}`);
|
|
151
|
-
if (!response.success || !response.data) {
|
|
152
|
-
throw new Error(response.error || 'Failed to get execution status');
|
|
153
|
-
}
|
|
154
|
-
return response.data;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Cancel workflow execution
|
|
158
|
-
*/
|
|
159
|
-
async cancelExecution(executionId) {
|
|
160
|
-
const response = await this.request(`/executions/${encodeURIComponent(executionId)}/cancel`, {
|
|
161
|
-
method: 'POST'
|
|
162
|
-
});
|
|
163
|
-
if (!response.success) {
|
|
164
|
-
throw new Error(response.error || 'Failed to cancel execution');
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Get execution logs
|
|
169
|
-
*/
|
|
170
|
-
async getExecutionLogs(executionId) {
|
|
171
|
-
const response = await this.request(`/executions/${encodeURIComponent(executionId)}/logs`);
|
|
172
|
-
if (!response.success || !response.data) {
|
|
173
|
-
throw new Error(response.error || 'Failed to get execution logs');
|
|
174
|
-
}
|
|
175
|
-
return response.data;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Validate workflow configuration
|
|
179
|
-
*/
|
|
180
|
-
async validateWorkflow(workflow) {
|
|
181
|
-
const response = await this.request('/workflows/validate', {
|
|
182
|
-
method: 'POST',
|
|
183
|
-
body: JSON.stringify(workflow)
|
|
184
|
-
});
|
|
185
|
-
if (!response.success || !response.data) {
|
|
186
|
-
throw new Error(response.error || 'Failed to validate workflow');
|
|
187
|
-
}
|
|
188
|
-
return response.data;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Export workflow as JSON
|
|
192
|
-
*/
|
|
193
|
-
async exportWorkflow(workflowId) {
|
|
194
|
-
const response = await this.request(`/workflows/${encodeURIComponent(workflowId)}/export`);
|
|
195
|
-
if (!response.success || !response.data) {
|
|
196
|
-
throw new Error(response.error || 'Failed to export workflow');
|
|
197
|
-
}
|
|
198
|
-
return response.data;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Import workflow from JSON
|
|
202
|
-
*/
|
|
203
|
-
async importWorkflow(workflowJson) {
|
|
204
|
-
const response = await this.request('/workflows/import', {
|
|
205
|
-
method: 'POST',
|
|
206
|
-
body: JSON.stringify({ workflow: workflowJson })
|
|
207
|
-
});
|
|
208
|
-
if (!response.success || !response.data) {
|
|
209
|
-
throw new Error(response.error || 'Failed to import workflow');
|
|
210
|
-
}
|
|
211
|
-
return response.data;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Fetch port configuration
|
|
215
|
-
*/
|
|
216
|
-
async getPortConfig() {
|
|
217
|
-
const response = await this.request('/port-config');
|
|
218
|
-
if (!response.success || !response.data) {
|
|
219
|
-
throw new Error(response.error || 'Failed to fetch port configuration');
|
|
220
|
-
}
|
|
221
|
-
return response.data;
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Fetch category definitions
|
|
225
|
-
*/
|
|
226
|
-
async getCategories() {
|
|
227
|
-
const response = await this.request('/categories');
|
|
228
|
-
if (!response.success || !response.data) {
|
|
229
|
-
throw new Error(response.error || 'Failed to fetch categories');
|
|
230
|
-
}
|
|
231
|
-
return response.data;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Fetch pipeline data including job information and status
|
|
235
|
-
*/
|
|
236
|
-
async getPipelineData(pipelineId) {
|
|
237
|
-
const response = await this.request(`/pipeline/${encodeURIComponent(pipelineId)}`);
|
|
238
|
-
return response;
|
|
239
|
-
}
|
|
240
|
-
}
|