@d34dman/flowdrop 0.0.2 → 0.0.4
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 +262 -320
- package/dist/components/App.svelte +4 -4
- package/dist/components/WorkflowEditor.svelte +3 -3
- package/dist/config/demo.js +20 -20
- package/dist/data/samples.d.ts +1 -1
- package/dist/data/samples.js +1 -1
- package/dist/examples/api-client-usage.d.ts +2 -1
- package/dist/examples/api-client-usage.js +2 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/dist/svelte-app.d.ts +9 -5
- package/dist/svelte-app.js +9 -5
- package/package.json +7 -4
- package/dist/app.css +0 -0
package/README.md
CHANGED
|
@@ -1,385 +1,327 @@
|
|
|
1
|
-
# FlowDrop
|
|
1
|
+
# FlowDrop
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A visual workflow editor component library built with Svelte 5 and @xyflow/svelte. Create complex workflows with drag-and-drop functionality, node-based editing, and configurable API integration.
|
|
4
4
|
|
|
5
5
|
## 🚀 Features
|
|
6
6
|
|
|
7
|
-
- **Visual Workflow Editor**: Drag-and-drop interface for building
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
12
|
-
- **
|
|
13
|
-
- **
|
|
14
|
-
- **Drupal Native**: Built specifically for Drupal 10/11
|
|
7
|
+
- **Visual Workflow Editor**: Drag-and-drop interface for building node-based workflows
|
|
8
|
+
- **Svelte 5 Components**: Modern, reactive components with runes
|
|
9
|
+
- **Configurable API Client**: Flexible endpoint configuration for backend integration
|
|
10
|
+
- **Node System**: Extensible node types with customizable configuration
|
|
11
|
+
- **Real-time Updates**: Live workflow state management with stores
|
|
12
|
+
- **Framework Agnostic**: Can be integrated into any web application
|
|
13
|
+
- **TypeScript Support**: Full type definitions included
|
|
15
14
|
|
|
16
|
-
##
|
|
15
|
+
## 📦 Installation
|
|
17
16
|
|
|
17
|
+
```bash
|
|
18
|
+
npm install @d34dman/flowdrop
|
|
18
19
|
```
|
|
19
|
-
flowdrop/
|
|
20
|
-
├── src/ # Core PHP classes
|
|
21
|
-
│ ├── Service/NodeRuntime/ # Node execution engine
|
|
22
|
-
│ ├── Plugin/FlowDropNodeProcessor/ # 25+ node processors
|
|
23
|
-
│ ├── Attribute/ # Plugin discovery attributes
|
|
24
|
-
│ └── Exception/ # Custom exception classes
|
|
25
|
-
├── modules/ # Drupal sub-modules
|
|
26
|
-
│ ├── flowdrop_workflow/ # Workflow entity management
|
|
27
|
-
│ ├── flowdrop_ui/ # Svelte frontend application
|
|
28
|
-
│ ├── flowdrop_node_type/ # Node type definitions
|
|
29
|
-
│ ├── flowdrop_node_category/ # Node categorization
|
|
30
|
-
│ ├── flowdrop_pipeline/ # Pipeline management
|
|
31
|
-
│ ├── flowdrop_job/ # Job execution system
|
|
32
|
-
│ ├── flowdrop_runner/ # Workflow execution engine
|
|
33
|
-
│ └── flowdrop_ai/ # AI integration features
|
|
34
|
-
├── js/ # Drupal JavaScript integration
|
|
35
|
-
└── config/ # Drupal configuration
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## 🏗️ Architecture
|
|
39
|
-
|
|
40
|
-
### Core Components
|
|
41
|
-
|
|
42
|
-
1. **Plugin System**: Attribute-based discovery of node processors
|
|
43
|
-
2. **Node Runtime**: Execution engine for workflow nodes
|
|
44
|
-
3. **Workflow Engine**: Drupal entity-based workflow management
|
|
45
|
-
4. **Frontend**: Svelte-based visual editor
|
|
46
|
-
5. **API Layer**: RESTful API for workflow operations
|
|
47
|
-
|
|
48
|
-
### Node Categories
|
|
49
|
-
|
|
50
|
-
- **AI Models**: OpenAI Chat, Embeddings, HuggingFace
|
|
51
|
-
- **Data Processing**: Calculator, Dataframe Operations, Data Operations
|
|
52
|
-
- **Input/Output**: Text Input, Chat Output, File Upload
|
|
53
|
-
- **HTTP Operations**: URL Fetch, HTTP Request, Webhook
|
|
54
|
-
- **Conditional Logic**: Conditional nodes, Loop operations
|
|
55
|
-
- **Utility**: DateTime, Regex Extractor, Split Text
|
|
56
|
-
- **Storage**: Save to File, Chroma Vector Store
|
|
57
|
-
|
|
58
|
-
## 🛠️ Installation
|
|
59
|
-
|
|
60
|
-
### Prerequisites
|
|
61
20
|
|
|
62
|
-
|
|
63
|
-
- PHP 8.1+
|
|
64
|
-
- Node.js 18+ (for frontend development)
|
|
65
|
-
|
|
66
|
-
### Installation Steps
|
|
67
|
-
|
|
68
|
-
1. **Install the module**:
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
# Copy to your Drupal modules directory
|
|
72
|
-
cp -r flowdrop /path/to/drupal/web/modules/custom/
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
2. **Enable the module**:
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
ddev drush en flowdrop flowdrop_workflow flowdrop_ui
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
3. **Build the frontend**:
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
cd modules/flowdrop_ui/app/flowdrop
|
|
85
|
-
npm install
|
|
86
|
-
npm run build:iife
|
|
87
|
-
```
|
|
21
|
+
## 📁 Project Structure
|
|
88
22
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
23
|
+
```
|
|
24
|
+
@d34dman/flowdrop/
|
|
25
|
+
├── dist/ # Built library files
|
|
26
|
+
│ ├── components/ # Svelte components
|
|
27
|
+
│ ├── types/ # TypeScript definitions
|
|
28
|
+
│ ├── services/ # API and state management
|
|
29
|
+
│ ├── utils/ # Utility functions
|
|
30
|
+
│ └── styles/ # CSS styles
|
|
31
|
+
├── src/ # Source code
|
|
32
|
+
│ └── lib/ # Library source
|
|
33
|
+
│ ├── components/ # Svelte components
|
|
34
|
+
│ ├── services/ # Services and APIs
|
|
35
|
+
│ ├── stores/ # State management
|
|
36
|
+
│ └── types/ # Type definitions
|
|
37
|
+
└── api/ # API documentation
|
|
38
|
+
```
|
|
93
39
|
|
|
94
40
|
## 🎯 Usage
|
|
95
41
|
|
|
96
|
-
###
|
|
97
|
-
|
|
98
|
-
1. Navigate to `/admin/structure/flowdrop-workflow`
|
|
99
|
-
2. Create a new workflow or edit an existing one
|
|
100
|
-
3. Use the visual editor to build your workflow
|
|
101
|
-
|
|
102
|
-
### Creating Workflows
|
|
103
|
-
|
|
104
|
-
1. **Add Nodes**: Drag nodes from the palette to the canvas
|
|
105
|
-
2. **Configure Nodes**: Set parameters and configuration for each node
|
|
106
|
-
3. **Connect Nodes**: Create connections between node inputs and outputs
|
|
107
|
-
4. **Test Execution**: Use the execution panel to test your workflow
|
|
108
|
-
5. **Save & Deploy**: Save your workflow for production use
|
|
109
|
-
|
|
110
|
-
### Available Node Types
|
|
111
|
-
|
|
112
|
-
#### AI Models
|
|
113
|
-
|
|
114
|
-
- **OpenAI Chat**: GPT model integration
|
|
115
|
-
- **OpenAI Embeddings**: Text embedding generation
|
|
116
|
-
- **HuggingFace Embeddings**: Alternative embedding models
|
|
117
|
-
- **Simple Agent**: Basic AI agent implementation
|
|
118
|
-
|
|
119
|
-
#### Data Processing
|
|
120
|
-
|
|
121
|
-
- **Calculator**: Mathematical operations
|
|
122
|
-
- **Dataframe Operations**: Advanced data manipulation
|
|
123
|
-
- **Data Operations**: General data processing
|
|
124
|
-
- **Data to Dataframe**: Data format conversion
|
|
125
|
-
|
|
126
|
-
#### Input/Output
|
|
127
|
-
|
|
128
|
-
- **Text Input**: User input collection
|
|
129
|
-
- **Text Output**: Display text results
|
|
130
|
-
- **Chat Output**: Chat interface output
|
|
131
|
-
- **File Upload**: File upload handling
|
|
132
|
-
|
|
133
|
-
#### HTTP & Integration
|
|
134
|
-
|
|
135
|
-
- **URL Fetch**: HTTP GET requests
|
|
136
|
-
- **HTTP Request**: Full HTTP client
|
|
137
|
-
- **Webhook**: Webhook endpoint handling
|
|
138
|
-
|
|
139
|
-
#### Logic & Control
|
|
140
|
-
|
|
141
|
-
- **Conditional**: If/else logic branching
|
|
142
|
-
- **Loop**: Iterative operations
|
|
143
|
-
- **Split Text**: Text segmentation
|
|
144
|
-
|
|
145
|
-
#### Utility
|
|
146
|
-
|
|
147
|
-
- **DateTime**: Date/time operations
|
|
148
|
-
- **Regex Extractor**: Pattern matching
|
|
149
|
-
- **Conversation Buffer**: Chat history management
|
|
150
|
-
- **Structured Output**: Formatted output generation
|
|
151
|
-
|
|
152
|
-
## 🔧 Development
|
|
153
|
-
|
|
154
|
-
### Adding New Node Types
|
|
155
|
-
|
|
156
|
-
1. **Create Node Class**:
|
|
42
|
+
### Basic Import
|
|
157
43
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
44
|
+
```javascript
|
|
45
|
+
import { WorkflowEditor } from "@d34dman/flowdrop";
|
|
46
|
+
import "@d34dman/flowdrop/styles/base.css";
|
|
47
|
+
```
|
|
162
48
|
|
|
163
|
-
|
|
49
|
+
### Using the WorkflowEditor Component
|
|
50
|
+
|
|
51
|
+
```svelte
|
|
52
|
+
<script lang="ts">
|
|
53
|
+
import { WorkflowEditor } from "@d34dman/flowdrop";
|
|
54
|
+
import type { NodeMetadata, Workflow } from "@d34dman/flowdrop";
|
|
55
|
+
|
|
56
|
+
let nodes: NodeMetadata[] = [
|
|
57
|
+
{
|
|
58
|
+
id: "text_input",
|
|
59
|
+
name: "Text Input",
|
|
60
|
+
category: "input_output",
|
|
61
|
+
description: "User input field",
|
|
62
|
+
inputs: [],
|
|
63
|
+
outputs: [{ id: "value", name: "Value", type: "output", dataType: "string" }]
|
|
64
|
+
}
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
let workflow: Workflow = {
|
|
68
|
+
id: "workflow_1",
|
|
69
|
+
name: "My Workflow",
|
|
70
|
+
nodes: [],
|
|
71
|
+
edges: []
|
|
72
|
+
};
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<WorkflowEditor {nodes} />
|
|
76
|
+
```
|
|
164
77
|
|
|
165
|
-
|
|
166
|
-
id: "my_custom_node",
|
|
167
|
-
label: new \Drupal\Core\StringTranslation\TranslatableMarkup("My Custom Node")
|
|
168
|
-
)]
|
|
169
|
-
class MyCustomNode extends AbstractFlowDropNodeProcessor {
|
|
78
|
+
### Integration Methods
|
|
170
79
|
|
|
171
|
-
|
|
172
|
-
// Your node logic here
|
|
173
|
-
return ['result' => 'processed data'];
|
|
174
|
-
}
|
|
80
|
+
#### 1. As a Svelte Component (Recommended)
|
|
175
81
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
'mySetting' => ['type' => 'string'],
|
|
181
|
-
],
|
|
182
|
-
];
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
```
|
|
82
|
+
```svelte
|
|
83
|
+
<script>
|
|
84
|
+
import { WorkflowEditor, NodeSidebar } from "@d34dman/flowdrop";
|
|
85
|
+
</script>
|
|
186
86
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
- `validateInputs()`: Input validation
|
|
87
|
+
<div class="editor-container">
|
|
88
|
+
<NodeSidebar {nodes} />
|
|
89
|
+
<WorkflowEditor {nodes} />
|
|
90
|
+
</div>
|
|
91
|
+
```
|
|
193
92
|
|
|
194
|
-
|
|
93
|
+
#### 2. Using Mount Functions (Vanilla JS/Other Frameworks)
|
|
195
94
|
|
|
196
|
-
|
|
95
|
+
```javascript
|
|
96
|
+
import { mountWorkflowEditor } from "@d34dman/flowdrop";
|
|
97
|
+
|
|
98
|
+
const container = document.getElementById("workflow-container");
|
|
99
|
+
const editor = mountWorkflowEditor(container, {
|
|
100
|
+
nodes: availableNodes,
|
|
101
|
+
endpointConfig: {
|
|
102
|
+
baseUrl: "/api/flowdrop",
|
|
103
|
+
endpoints: {
|
|
104
|
+
workflows: {
|
|
105
|
+
list: "/workflows",
|
|
106
|
+
get: "/workflows/{id}",
|
|
107
|
+
create: "/workflows",
|
|
108
|
+
update: "/workflows/{id}"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
});
|
|
197
113
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
npm run dev # Development server
|
|
201
|
-
npm run build:iife # Build for Drupal integration
|
|
202
|
-
npm run test # Run tests
|
|
114
|
+
// Cleanup
|
|
115
|
+
editor.destroy();
|
|
203
116
|
```
|
|
204
117
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
### IIFE Integration API
|
|
208
|
-
|
|
209
|
-
The FlowDrop library can be integrated into Drupal using the IIFE (Immediately Invoked Function Expression) build. The library provides two main mounting functions:
|
|
118
|
+
#### 3. Integration with Backend Frameworks
|
|
210
119
|
|
|
211
|
-
|
|
120
|
+
##### Drupal Example
|
|
212
121
|
|
|
213
122
|
```javascript
|
|
214
|
-
|
|
215
|
-
|
|
123
|
+
Drupal.behaviors.flowdropEditor = {
|
|
124
|
+
attach: function (context, settings) {
|
|
125
|
+
const container = context.querySelector(".flowdrop-container");
|
|
126
|
+
if (container && window.FlowDrop) {
|
|
127
|
+
window.FlowDrop.mountWorkflowEditor(container, {
|
|
128
|
+
endpointConfig: settings.flowdrop.endpointConfig,
|
|
129
|
+
nodes: settings.flowdrop.nodes
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
```
|
|
216
135
|
|
|
217
|
-
|
|
218
|
-
|
|
136
|
+
## 📚 Core Components
|
|
137
|
+
|
|
138
|
+
### WorkflowEditor
|
|
139
|
+
|
|
140
|
+
Main editor component for creating and editing workflows.
|
|
141
|
+
|
|
142
|
+
**Props:**
|
|
143
|
+
- `nodes`: Array of available node types
|
|
144
|
+
- `endpointConfig`: API endpoint configuration
|
|
145
|
+
- `height`: Editor height (default: "100vh")
|
|
146
|
+
- `width`: Editor width (default: "100%")
|
|
147
|
+
- `lockWorkflow`: Disable editing
|
|
148
|
+
- `readOnly`: Read-only mode
|
|
149
|
+
|
|
150
|
+
### NodeSidebar
|
|
151
|
+
|
|
152
|
+
Sidebar displaying available node types.
|
|
153
|
+
|
|
154
|
+
**Props:**
|
|
155
|
+
- `nodes`: Array of node types to display
|
|
156
|
+
|
|
157
|
+
### ConfigSidebar
|
|
158
|
+
|
|
159
|
+
Configuration panel for selected nodes.
|
|
160
|
+
|
|
161
|
+
**Props:**
|
|
162
|
+
- `isOpen`: Sidebar visibility
|
|
163
|
+
- `configSchema`: JSON schema for configuration
|
|
164
|
+
- `configValues`: Current configuration values
|
|
165
|
+
- `onSave`: Save handler
|
|
166
|
+
- `onClose`: Close handler
|
|
167
|
+
|
|
168
|
+
## 🔧 API Configuration
|
|
169
|
+
|
|
170
|
+
Configure the API client to connect to your backend:
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
import { createEndpointConfig } from "@d34dman/flowdrop";
|
|
174
|
+
|
|
175
|
+
const config = createEndpointConfig({
|
|
176
|
+
baseUrl: "https://api.example.com",
|
|
177
|
+
endpoints: {
|
|
178
|
+
nodes: {
|
|
179
|
+
list: "/nodes",
|
|
180
|
+
get: "/nodes/{id}"
|
|
181
|
+
},
|
|
182
|
+
workflows: {
|
|
183
|
+
list: "/workflows",
|
|
184
|
+
get: "/workflows/{id}",
|
|
185
|
+
create: "/workflows",
|
|
186
|
+
update: "/workflows/{id}",
|
|
187
|
+
delete: "/workflows/{id}",
|
|
188
|
+
execute: "/workflows/{id}/execute"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
timeout: 30000,
|
|
192
|
+
auth: {
|
|
193
|
+
type: "bearer",
|
|
194
|
+
token: "your-token"
|
|
195
|
+
}
|
|
196
|
+
});
|
|
219
197
|
```
|
|
220
198
|
|
|
221
|
-
|
|
199
|
+
## 🎨 Customization
|
|
222
200
|
|
|
223
|
-
|
|
224
|
-
// Basic usage with default configuration
|
|
225
|
-
window.FlowDrop.mountWorkflowEditor(container, {
|
|
226
|
-
workflow: myWorkflow,
|
|
227
|
-
nodes: availableNodes
|
|
228
|
-
});
|
|
201
|
+
### Styling
|
|
229
202
|
|
|
230
|
-
|
|
231
|
-
window.FlowDrop.mountWorkflowEditor(container, {
|
|
232
|
-
workflow: myWorkflow,
|
|
233
|
-
nodes: availableNodes,
|
|
234
|
-
endpointConfig: {
|
|
235
|
-
baseUrl: '/api/flowdrop',
|
|
236
|
-
endpoints: {
|
|
237
|
-
nodes: {
|
|
238
|
-
list: '/nodes',
|
|
239
|
-
get: '/nodes/{id}',
|
|
240
|
-
byCategory: '/nodes?category={category}',
|
|
241
|
-
metadata: '/nodes/{id}/metadata'
|
|
242
|
-
},
|
|
243
|
-
workflows: {
|
|
244
|
-
list: '/workflows',
|
|
245
|
-
get: '/workflows/{id}',
|
|
246
|
-
create: '/workflows',
|
|
247
|
-
update: '/workflows/{id}',
|
|
248
|
-
delete: '/workflows/{id}',
|
|
249
|
-
validate: '/workflows/validate',
|
|
250
|
-
export: '/workflows/{id}/export',
|
|
251
|
-
import: '/workflows/import'
|
|
252
|
-
},
|
|
253
|
-
executions: {
|
|
254
|
-
execute: '/workflows/{id}/execute',
|
|
255
|
-
status: '/executions/{id}',
|
|
256
|
-
cancel: '/executions/{id}/cancel',
|
|
257
|
-
logs: '/executions/{id}/logs',
|
|
258
|
-
history: '/executions'
|
|
259
|
-
}
|
|
260
|
-
},
|
|
261
|
-
timeout: 30000,
|
|
262
|
-
retry: {
|
|
263
|
-
enabled: true,
|
|
264
|
-
maxAttempts: 3,
|
|
265
|
-
delay: 1000,
|
|
266
|
-
backoff: 'exponential'
|
|
267
|
-
},
|
|
268
|
-
auth: {
|
|
269
|
-
type: 'bearer',
|
|
270
|
-
token: 'your-auth-token'
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
```
|
|
203
|
+
Override CSS custom properties:
|
|
275
204
|
|
|
276
|
-
|
|
205
|
+
```css
|
|
206
|
+
:root {
|
|
207
|
+
--flowdrop-background-color: #f9fafb;
|
|
208
|
+
--flowdrop-primary-color: #3b82f6;
|
|
209
|
+
--flowdrop-border-color: #e5e7eb;
|
|
210
|
+
--flowdrop-text-color: #1f2937;
|
|
211
|
+
}
|
|
212
|
+
```
|
|
277
213
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
214
|
+
### Node Types
|
|
215
|
+
|
|
216
|
+
Define custom node types:
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
const customNode: NodeMetadata = {
|
|
220
|
+
id: "custom_processor",
|
|
221
|
+
name: "Custom Processor",
|
|
222
|
+
category: "data_processing",
|
|
223
|
+
description: "Process data with custom logic",
|
|
224
|
+
icon: "mdi:cog",
|
|
225
|
+
color: "#3b82f6",
|
|
226
|
+
inputs: [
|
|
227
|
+
{
|
|
228
|
+
id: "input",
|
|
229
|
+
name: "Input",
|
|
230
|
+
type: "input",
|
|
231
|
+
dataType: "mixed"
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
outputs: [
|
|
235
|
+
{
|
|
236
|
+
id: "output",
|
|
237
|
+
name: "Output",
|
|
238
|
+
type: "output",
|
|
239
|
+
dataType: "mixed"
|
|
240
|
+
}
|
|
241
|
+
],
|
|
242
|
+
configSchema: {
|
|
243
|
+
type: "object",
|
|
244
|
+
properties: {
|
|
245
|
+
operation: {
|
|
246
|
+
type: "string",
|
|
247
|
+
title: "Operation"
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
291
251
|
};
|
|
292
252
|
```
|
|
293
253
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
#### Workflows
|
|
254
|
+
## 🔌 Backend Integration
|
|
297
255
|
|
|
298
|
-
-
|
|
299
|
-
- `POST /api/flowdrop/workflows` - Create workflow
|
|
300
|
-
- `GET /api/flowdrop/workflows/{id}` - Get workflow
|
|
301
|
-
- `PUT /api/flowdrop/workflows/{id}` - Update workflow
|
|
302
|
-
- `DELETE /api/flowdrop/workflows/{id}` - Delete workflow
|
|
303
|
-
- `POST /api/flowdrop/workflows/{id}/execute` - Execute workflow
|
|
256
|
+
FlowDrop is backend-agnostic. Implement the API endpoints expected by the client:
|
|
304
257
|
|
|
305
|
-
|
|
258
|
+
### Required Endpoints
|
|
306
259
|
|
|
307
|
-
- `GET /api/
|
|
308
|
-
- `GET /api/
|
|
309
|
-
- `GET /api/
|
|
260
|
+
- `GET /api/nodes` - List available node types
|
|
261
|
+
- `GET /api/workflows` - List workflows
|
|
262
|
+
- `GET /api/workflows/{id}` - Get workflow
|
|
263
|
+
- `POST /api/workflows` - Create workflow
|
|
264
|
+
- `PUT /api/workflows/{id}` - Update workflow
|
|
265
|
+
- `DELETE /api/workflows/{id}` - Delete workflow
|
|
266
|
+
- `POST /api/workflows/{id}/execute` - Execute workflow
|
|
310
267
|
|
|
311
|
-
|
|
268
|
+
See `API.md` for detailed endpoint specifications.
|
|
312
269
|
|
|
313
|
-
|
|
314
|
-
- `GET /api/flowdrop/executions/{id}/state` - Execution status
|
|
270
|
+
## 🧪 Testing
|
|
315
271
|
|
|
316
|
-
|
|
272
|
+
```bash
|
|
273
|
+
# Unit tests
|
|
274
|
+
npm run test:unit
|
|
317
275
|
|
|
318
|
-
|
|
276
|
+
# E2E tests
|
|
277
|
+
npm run test:e2e
|
|
319
278
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
"type": "object",
|
|
323
|
-
"properties": {
|
|
324
|
-
"setting1": {
|
|
325
|
-
"type": "string",
|
|
326
|
-
"title": "Setting 1",
|
|
327
|
-
"description": "Description of setting"
|
|
328
|
-
},
|
|
329
|
-
"setting2": {
|
|
330
|
-
"type": "number",
|
|
331
|
-
"default": 0
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
}
|
|
279
|
+
# All tests
|
|
280
|
+
npm test
|
|
335
281
|
```
|
|
336
282
|
|
|
337
|
-
##
|
|
283
|
+
## 🛠️ Development
|
|
338
284
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
- Logging of all workflow operations
|
|
285
|
+
```bash
|
|
286
|
+
# Install dependencies
|
|
287
|
+
npm install
|
|
343
288
|
|
|
344
|
-
|
|
289
|
+
# Development server
|
|
290
|
+
npm run dev
|
|
345
291
|
|
|
346
|
-
|
|
292
|
+
# Build library
|
|
293
|
+
npm run build
|
|
347
294
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
```
|
|
295
|
+
# Build for production
|
|
296
|
+
npm run build:production
|
|
351
297
|
|
|
352
|
-
|
|
298
|
+
# Linting
|
|
299
|
+
npm run lint
|
|
353
300
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
npm run test:unit
|
|
357
|
-
npm run test:e2e
|
|
301
|
+
# Format code
|
|
302
|
+
npm run format
|
|
358
303
|
```
|
|
359
304
|
|
|
360
|
-
##
|
|
305
|
+
## 📖 Documentation
|
|
361
306
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
$this->loggerFactory->get('flowdrop')->info('Workflow executed', [
|
|
366
|
-
'workflow_id' => $workflowId,
|
|
367
|
-
'execution_time' => $executionTime,
|
|
368
|
-
]);
|
|
369
|
-
```
|
|
307
|
+
- **API.md** - REST API specification
|
|
308
|
+
- **CHANGELOG.md** - Version history
|
|
309
|
+
- **Storybook** - Component documentation (run `npm run storybook`)
|
|
370
310
|
|
|
371
311
|
## 🤝 Contributing
|
|
372
312
|
|
|
373
|
-
Not accepting
|
|
313
|
+
Not accepting contributions until the library stabilizes. Stay tuned.
|
|
374
314
|
|
|
375
|
-
##
|
|
315
|
+
## 📄 License
|
|
376
316
|
|
|
377
|
-
|
|
317
|
+
MIT
|
|
318
|
+
|
|
319
|
+
## 🆘 Support
|
|
378
320
|
|
|
379
|
-
- Check the API documentation in `
|
|
380
|
-
- Review the security guidelines in `modules/flowdrop_ui/app/flowdrop/SECURITY.md`
|
|
321
|
+
- Check the API documentation in `API.md`
|
|
381
322
|
- Create an issue in the project repository
|
|
323
|
+
- Review the examples in `src/lib/examples/`
|
|
382
324
|
|
|
383
325
|
---
|
|
384
326
|
|
|
385
|
-
**FlowDrop** -
|
|
327
|
+
**FlowDrop** - Visual workflow editing for modern web applications
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
FlowDrop
|
|
3
|
-
|
|
2
|
+
FlowDrop App Component
|
|
3
|
+
Main application wrapper with navbar, sidebars, and workflow editor
|
|
4
4
|
Styled with BEM syntax
|
|
5
5
|
-->
|
|
6
6
|
|
|
@@ -310,7 +310,7 @@
|
|
|
310
310
|
const savedWorkflow = await workflowApi.saveWorkflow(finalWorkflow);
|
|
311
311
|
|
|
312
312
|
// Update the workflow ID if it changed (new workflow)
|
|
313
|
-
// Keep our current workflow state, only update ID and metadata from
|
|
313
|
+
// Keep our current workflow state, only update ID and metadata from backend
|
|
314
314
|
if (savedWorkflow.id && savedWorkflow.id !== finalWorkflow.id) {
|
|
315
315
|
workflowActions.batchUpdate({
|
|
316
316
|
nodes: finalWorkflow.nodes,
|
|
@@ -508,7 +508,7 @@
|
|
|
508
508
|
class="flowdrop-btn flowdrop-btn--sm flowdrop-btn--outline"
|
|
509
509
|
onclick={() => {
|
|
510
510
|
const defaultUrl = '/api/flowdrop';
|
|
511
|
-
const newUrl = prompt('Enter
|
|
511
|
+
const newUrl = prompt('Enter Backend API URL:', defaultUrl);
|
|
512
512
|
if (newUrl) {
|
|
513
513
|
const endpointConfig = createEndpointConfig(newUrl);
|
|
514
514
|
setEndpointConfig(endpointConfig);
|
|
@@ -511,7 +511,7 @@
|
|
|
511
511
|
}
|
|
512
512
|
};
|
|
513
513
|
|
|
514
|
-
console.log('💾 WorkflowEditor: Saving workflow to
|
|
514
|
+
console.log('💾 WorkflowEditor: Saving workflow to backend:');
|
|
515
515
|
console.log(' - ID:', workflow.id);
|
|
516
516
|
console.log(' - Name:', workflow.name);
|
|
517
517
|
console.log(' - Nodes count:', workflow.nodes.length);
|
|
@@ -520,14 +520,14 @@
|
|
|
520
520
|
|
|
521
521
|
const savedWorkflow = await workflowApi.saveWorkflow(workflow);
|
|
522
522
|
|
|
523
|
-
console.log('✅ WorkflowEditor: Received workflow from
|
|
523
|
+
console.log('✅ WorkflowEditor: Received workflow from backend:');
|
|
524
524
|
console.log(' - ID:', savedWorkflow.id);
|
|
525
525
|
console.log(' - Name:', savedWorkflow.name);
|
|
526
526
|
console.log(' - Nodes count:', savedWorkflow.nodes?.length || 0);
|
|
527
527
|
console.log(' - Edges count:', savedWorkflow.edges?.length || 0);
|
|
528
528
|
|
|
529
529
|
// Update the workflow ID if it changed (new workflow)
|
|
530
|
-
// Keep our current workflow state, only update ID and metadata from
|
|
530
|
+
// Keep our current workflow state, only update ID and metadata from backend
|
|
531
531
|
if (savedWorkflow.id && savedWorkflow.id !== workflow.id) {
|
|
532
532
|
console.log('🔄 Updating workflow ID from', workflow.id, 'to', savedWorkflow.id);
|
|
533
533
|
workflowActions.batchUpdate({
|
package/dist/config/demo.js
CHANGED
|
@@ -77,14 +77,14 @@ export const demoWorkflowConfig = {
|
|
|
77
77
|
* Demo instructions for non-technical users
|
|
78
78
|
*/
|
|
79
79
|
export const demoInstructions = {
|
|
80
|
-
title: 'Multi-Agent
|
|
81
|
-
description: 'This demo shows how FlowDrop uses multiple AI agents working together to
|
|
80
|
+
title: 'Multi-Agent Workflow Demo',
|
|
81
|
+
description: 'This demo shows how FlowDrop uses multiple AI agents working together to process and manage data workflows.',
|
|
82
82
|
steps: [
|
|
83
83
|
{
|
|
84
84
|
step: 1,
|
|
85
85
|
title: 'User Input',
|
|
86
|
-
description: 'Start by
|
|
87
|
-
example:
|
|
86
|
+
description: 'Start by providing input data or instructions to the main agent.',
|
|
87
|
+
example: 'Analyze and process the provided dataset'
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
90
|
step: 2,
|
|
@@ -94,20 +94,20 @@ export const demoInstructions = {
|
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
step: 3,
|
|
97
|
-
title: '
|
|
98
|
-
description: 'Specialized agent analyzes
|
|
99
|
-
note: 'Uses
|
|
97
|
+
title: 'Data Analysis Agent',
|
|
98
|
+
description: 'Specialized agent analyzes data using search and processing tools to find and examine relevant information.',
|
|
99
|
+
note: 'Uses connected data sources and search tools for intelligent data discovery'
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
step: 4,
|
|
103
|
-
title: '
|
|
104
|
-
description: 'Specialized agent
|
|
105
|
-
note: 'Has access to multiple tools and makes
|
|
103
|
+
title: 'Data Processing Agent',
|
|
104
|
+
description: 'Specialized agent processes and transforms data using available tools and formatters.',
|
|
105
|
+
note: 'Has access to multiple tools and makes tracked transformations'
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
step: 5,
|
|
109
109
|
title: 'Tool Integration',
|
|
110
|
-
description: 'Sub-agents use specialized tools
|
|
110
|
+
description: 'Sub-agents use specialized tools for data processing, formatting, and transformation.',
|
|
111
111
|
note: "Tools are connected via special 'tool' interface ports"
|
|
112
112
|
},
|
|
113
113
|
{
|
|
@@ -120,23 +120,23 @@ export const demoInstructions = {
|
|
|
120
120
|
step: 7,
|
|
121
121
|
title: 'Orchestrated Response',
|
|
122
122
|
description: 'Main agent compiles results from all sub-agents and provides a comprehensive response.',
|
|
123
|
-
note: 'Includes summaries,
|
|
123
|
+
note: 'Includes summaries, results, and next steps for review'
|
|
124
124
|
}
|
|
125
125
|
],
|
|
126
126
|
benefits: [
|
|
127
127
|
'Multi-agent collaboration for complex tasks',
|
|
128
|
-
'Specialized agents for specific
|
|
128
|
+
'Specialized agents for specific data processing functions',
|
|
129
129
|
'Intelligent task orchestration and coordination',
|
|
130
130
|
'Tool-based architecture for extensibility',
|
|
131
|
-
'Human oversight through
|
|
131
|
+
'Human oversight through review process',
|
|
132
132
|
'Scalable agent-to-agent communication patterns'
|
|
133
133
|
],
|
|
134
134
|
useCases: [
|
|
135
|
-
'Multi-agent
|
|
136
|
-
'Coordinated
|
|
137
|
-
'Agent-orchestrated
|
|
138
|
-
'Collaborative
|
|
139
|
-
'Tool-assisted bulk
|
|
140
|
-
'Intelligent
|
|
135
|
+
'Multi-agent data analysis and processing',
|
|
136
|
+
'Coordinated data transformation workflows',
|
|
137
|
+
'Agent-orchestrated data quality checks',
|
|
138
|
+
'Collaborative data processing pipelines',
|
|
139
|
+
'Tool-assisted bulk data operations',
|
|
140
|
+
'Intelligent workflow automation'
|
|
141
141
|
]
|
|
142
142
|
};
|
package/dist/data/samples.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sample data for FlowDrop development and testing
|
|
3
|
-
*
|
|
3
|
+
* Includes sample nodes and workflows for demonstration and testing purposes
|
|
4
4
|
*/
|
|
5
5
|
import type { NodeMetadata, Workflow } from '../types/index.js';
|
|
6
6
|
import { CATEGORY_ICONS } from '../utils/icons.js';
|
package/dist/data/samples.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Example: Using FlowDrop API Client
|
|
3
|
-
*
|
|
3
|
+
* Demonstrates how to integrate with FlowDrop API from applications
|
|
4
|
+
* This client can be used with any backend that implements the FlowDrop API specification
|
|
4
5
|
*/
|
|
5
6
|
import type { Workflow } from '../types/index.js';
|
|
6
7
|
declare function checkApiHealth(): Promise<{
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Example: Using FlowDrop API Client
|
|
3
|
-
*
|
|
3
|
+
* Demonstrates how to integrate with FlowDrop API from applications
|
|
4
|
+
* This client can be used with any backend that implements the FlowDrop API specification
|
|
4
5
|
*/
|
|
5
6
|
import { ApiClient } from '../clients/ApiClient.js';
|
|
6
7
|
// Initialize the API client
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* FlowDrop - Workflow Library
|
|
3
|
-
* A Svelte
|
|
2
|
+
* FlowDrop - Visual Workflow Editor Library
|
|
3
|
+
* A Svelte 5 component library built on @xyflow/svelte for creating node-based workflow editors
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import "./styles/base.css";
|
|
6
6
|
export type { NodeCategory, NodeDataType, NodePort, NodeMetadata, NodeConfig, WorkflowNode, WorkflowEdge, Workflow, ApiResponse, NodesResponse, WorkflowResponse, WorkflowsResponse, ExecutionStatus, ExecutionResult, FlowDropConfig, WorkflowEvents } from './types/index.js';
|
|
7
7
|
export type { WorkflowEditorConfig, EditorFeatures, UIConfig, APIConfig, ExecutionConfig, StorageConfig, NodeType, WorkflowData, ExecutionResult as EditorExecutionResult, EditorState } from './types/config.js';
|
|
8
8
|
export { FlowDropApiClient } from './api/client.js';
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* FlowDrop - Workflow Library
|
|
3
|
-
* A Svelte
|
|
2
|
+
* FlowDrop - Visual Workflow Editor Library
|
|
3
|
+
* A Svelte 5 component library built on @xyflow/svelte for creating node-based workflow editors
|
|
4
4
|
*/
|
|
5
5
|
// Import CSS to ensure styles are included in the library build
|
|
6
|
-
import
|
|
6
|
+
import "./styles/base.css";
|
|
7
7
|
// Export API clients
|
|
8
8
|
export { FlowDropApiClient } from './api/client.js';
|
|
9
9
|
export { EnhancedFlowDropApiClient } from './api/enhanced-client.js';
|
|
@@ -31,5 +31,5 @@ export * from './config/endpoints.js';
|
|
|
31
31
|
export * from './adapters/WorkflowAdapter.js';
|
|
32
32
|
// Export API client
|
|
33
33
|
export * from './clients/ApiClient.js';
|
|
34
|
-
// Export Svelte app wrapper for
|
|
34
|
+
// Export Svelte app wrapper for framework integration
|
|
35
35
|
export { mountWorkflowEditor, unmountWorkflowEditor, mountFlowDropApp, unmountFlowDropApp } from './svelte-app.js';
|
package/dist/svelte-app.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Svelte App Wrapper for
|
|
3
|
-
*
|
|
2
|
+
* Svelte App Wrapper for Framework Integration
|
|
3
|
+
* Provides mount/unmount functions for integrating FlowDrop into any web application
|
|
4
|
+
* Particularly useful for integration with vanilla JS, Drupal, WordPress, or other frameworks
|
|
4
5
|
*/
|
|
5
6
|
import type { Workflow, NodeMetadata, PortConfig } from './types/index.js';
|
|
6
7
|
import type { EndpointConfig } from './config/endpoints.js';
|
|
@@ -19,8 +20,10 @@ interface MountedSvelteApp {
|
|
|
19
20
|
export?: () => void;
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
|
-
* Mount the full FlowDrop App with
|
|
23
|
-
*
|
|
23
|
+
* Mount the full FlowDrop App with navbar, sidebars, and workflow editor
|
|
24
|
+
* Use this for a complete workflow editing experience with all UI components
|
|
25
|
+
* @param container - DOM element to mount the app into
|
|
26
|
+
* @param options - Configuration options for the app
|
|
24
27
|
*/
|
|
25
28
|
export declare function mountFlowDropApp(container: HTMLElement, options?: {
|
|
26
29
|
workflow?: Workflow;
|
|
@@ -45,7 +48,8 @@ export declare function mountFlowDropApp(container: HTMLElement, options?: {
|
|
|
45
48
|
}>;
|
|
46
49
|
}): Promise<MountedSvelteApp>;
|
|
47
50
|
/**
|
|
48
|
-
* Mount the WorkflowEditor component in a
|
|
51
|
+
* Mount the WorkflowEditor component in a container
|
|
52
|
+
* Simpler alternative to mountFlowDropApp - only mounts the editor without navbar
|
|
49
53
|
*/
|
|
50
54
|
export declare function mountWorkflowEditor(container: HTMLElement, options?: {
|
|
51
55
|
workflow?: Workflow;
|
package/dist/svelte-app.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Svelte App Wrapper for
|
|
3
|
-
*
|
|
2
|
+
* Svelte App Wrapper for Framework Integration
|
|
3
|
+
* Provides mount/unmount functions for integrating FlowDrop into any web application
|
|
4
|
+
* Particularly useful for integration with vanilla JS, Drupal, WordPress, or other frameworks
|
|
4
5
|
*/
|
|
5
6
|
import { mount } from 'svelte';
|
|
6
7
|
import WorkflowEditor from './components/WorkflowEditor.svelte';
|
|
@@ -10,8 +11,10 @@ import { initializePortCompatibility } from './utils/connections.js';
|
|
|
10
11
|
import { DEFAULT_PORT_CONFIG } from './config/defaultPortConfig.js';
|
|
11
12
|
import { fetchPortConfig } from './services/portConfigApi.js';
|
|
12
13
|
/**
|
|
13
|
-
* Mount the full FlowDrop App with
|
|
14
|
-
*
|
|
14
|
+
* Mount the full FlowDrop App with navbar, sidebars, and workflow editor
|
|
15
|
+
* Use this for a complete workflow editing experience with all UI components
|
|
16
|
+
* @param container - DOM element to mount the app into
|
|
17
|
+
* @param options - Configuration options for the app
|
|
15
18
|
*/
|
|
16
19
|
export async function mountFlowDropApp(container, options = {}) {
|
|
17
20
|
const { workflow, nodes = [], endpointConfig, portConfig, height = '100vh', width = '100%', showNavbar = false, disableSidebar, lockWorkflow, readOnly, nodeStatuses, pipelineId, navbarTitle, navbarActions } = options;
|
|
@@ -87,7 +90,8 @@ export async function mountFlowDropApp(container, options = {}) {
|
|
|
87
90
|
return app;
|
|
88
91
|
}
|
|
89
92
|
/**
|
|
90
|
-
* Mount the WorkflowEditor component in a
|
|
93
|
+
* Mount the WorkflowEditor component in a container
|
|
94
|
+
* Simpler alternative to mountFlowDropApp - only mounts the editor without navbar
|
|
91
95
|
*/
|
|
92
96
|
export async function mountWorkflowEditor(container, options = {}) {
|
|
93
97
|
const { workflow, nodes = [], endpointConfig, portConfig } = options;
|
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.4",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite dev",
|
|
8
8
|
"build": "vite build && npm run prepack",
|
|
@@ -65,7 +65,8 @@
|
|
|
65
65
|
"!dist/**/*.spec.*"
|
|
66
66
|
],
|
|
67
67
|
"sideEffects": [
|
|
68
|
-
"**/*.css"
|
|
68
|
+
"**/*.css",
|
|
69
|
+
"./dist/styles/base.css"
|
|
69
70
|
],
|
|
70
71
|
"svelte": "./dist/index.js",
|
|
71
72
|
"types": "./dist/index.d.ts",
|
|
@@ -73,8 +74,10 @@
|
|
|
73
74
|
"exports": {
|
|
74
75
|
".": {
|
|
75
76
|
"types": "./dist/index.d.ts",
|
|
76
|
-
"svelte": "./dist/index.js"
|
|
77
|
-
|
|
77
|
+
"svelte": "./dist/index.js",
|
|
78
|
+
"default": "./dist/index.js"
|
|
79
|
+
},
|
|
80
|
+
"./styles/base.css": "./dist/styles/base.css"
|
|
78
81
|
},
|
|
79
82
|
"peerDependencies": {
|
|
80
83
|
"svelte": "^5.0.0"
|
package/dist/app.css
DELETED
|
File without changes
|