@d34dman/flowdrop 0.0.1 โ 0.0.2
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 +307 -215
- package/dist/adapters/WorkflowAdapter.d.ts +1 -1
- package/dist/adapters/WorkflowAdapter.js +30 -30
- package/dist/api/client.d.ts +24 -1
- package/dist/api/client.js +55 -38
- package/dist/api/enhanced-client.d.ts +46 -0
- package/dist/api/enhanced-client.js +211 -0
- package/dist/clients/ApiClient.d.ts +19 -23
- package/dist/clients/ApiClient.js +36 -34
- package/dist/components/App.svelte +1299 -230
- package/dist/components/App.svelte.d.ts +21 -1
- package/dist/components/CanvasBanner.svelte +50 -44
- package/dist/components/CanvasBanner.svelte.d.ts +5 -19
- package/dist/components/ConfigForm.svelte +555 -0
- package/dist/components/ConfigForm.svelte.d.ts +32 -0
- package/dist/components/ConfigModal.svelte +261 -0
- package/dist/components/ConfigModal.svelte.d.ts +31 -0
- package/dist/components/ConfigSidebar.svelte +934 -0
- package/dist/components/ConfigSidebar.svelte.d.ts +51 -0
- package/dist/components/ConnectionLine.svelte +32 -0
- package/dist/components/ConnectionLine.svelte.d.ts +3 -0
- package/dist/components/GatewayNode.svelte +471 -0
- package/dist/components/GatewayNode.svelte.d.ts +15 -0
- package/dist/components/LoadingSpinner.svelte +23 -23
- package/dist/components/LoadingSpinner.svelte.d.ts +1 -1
- package/dist/components/Logo.svelte +82 -0
- package/dist/components/Logo.svelte.d.ts +26 -0
- package/dist/components/LogsSidebar.svelte +565 -0
- package/dist/components/LogsSidebar.svelte.d.ts +34 -0
- package/dist/components/MarkdownDisplay.svelte +28 -0
- package/dist/components/MarkdownDisplay.svelte.d.ts +7 -0
- package/dist/components/Navbar.svelte +663 -0
- package/dist/components/Navbar.svelte.d.ts +21 -0
- package/dist/components/NodeSidebar.svelte +629 -488
- package/dist/components/NodeSidebar.svelte.d.ts +1 -2
- package/dist/components/NodeStatusOverlay.svelte +327 -0
- package/dist/components/NodeStatusOverlay.svelte.d.ts +11 -0
- package/dist/components/NotesNode.svelte +566 -0
- package/dist/components/NotesNode.svelte.d.ts +43 -0
- package/dist/components/PipelineStatus.svelte +331 -0
- package/dist/components/PipelineStatus.svelte.d.ts +18 -0
- package/dist/components/SimpleNode.svelte +447 -0
- package/dist/components/SimpleNode.svelte.d.ts +24 -0
- package/dist/components/SquareNode.svelte +346 -0
- package/dist/components/SquareNode.svelte.d.ts +24 -0
- package/dist/components/StatusIcon.svelte +112 -0
- package/dist/components/StatusIcon.svelte.d.ts +10 -0
- package/dist/components/StatusLabel.svelte +33 -0
- package/dist/components/StatusLabel.svelte.d.ts +7 -0
- package/dist/components/ToolNode.svelte +385 -0
- package/dist/components/ToolNode.svelte.d.ts +36 -0
- package/dist/components/UniversalNode.svelte +126 -0
- package/dist/components/UniversalNode.svelte.d.ts +15 -0
- package/dist/components/WorkflowEditor.svelte +871 -528
- package/dist/components/WorkflowEditor.svelte.d.ts +15 -5
- package/dist/components/WorkflowNode.svelte +428 -542
- package/dist/components/WorkflowNode.svelte.d.ts +7 -3
- package/dist/config/apiConfig.d.ts +33 -0
- package/dist/config/apiConfig.js +39 -0
- package/dist/config/defaultPortConfig.d.ts +6 -0
- package/dist/config/defaultPortConfig.js +192 -0
- package/dist/config/demo.d.ts +58 -0
- package/dist/config/demo.js +142 -0
- package/dist/config/endpoints.d.ts +106 -0
- package/dist/config/endpoints.js +128 -0
- package/dist/data/samples.d.ts +38 -4
- package/dist/data/samples.js +2789 -737
- package/dist/examples/adapter-usage.d.ts +4 -4
- package/dist/examples/adapter-usage.js +21 -26
- package/dist/examples/api-client-usage.d.ts +6 -6
- package/dist/examples/api-client-usage.js +55 -54
- package/dist/index.d.ts +23 -15
- package/dist/index.js +23 -15
- package/dist/mocks/app-environment.d.ts +8 -0
- package/dist/mocks/app-environment.js +16 -0
- package/dist/mocks/app-forms.d.ts +2 -0
- package/dist/mocks/app-forms.js +21 -0
- package/dist/mocks/app-navigation.d.ts +5 -0
- package/dist/mocks/app-navigation.js +34 -0
- package/dist/mocks/app-stores.d.ts +14 -0
- package/dist/mocks/app-stores.js +26 -0
- package/dist/services/api.d.ts +13 -3
- package/dist/services/api.js +91 -36
- package/dist/services/globalSave.d.ts +20 -0
- package/dist/services/globalSave.js +165 -0
- package/dist/services/nodeExecutionService.d.ts +63 -0
- package/dist/services/nodeExecutionService.js +261 -0
- package/dist/services/portConfigApi.d.ts +14 -0
- package/dist/services/portConfigApi.js +69 -0
- package/dist/services/toastService.d.ts +147 -0
- package/dist/services/toastService.js +235 -0
- package/dist/services/workflowStorage.d.ts +2 -2
- package/dist/services/workflowStorage.js +10 -10
- package/dist/stores/workflowStore.d.ts +53 -0
- package/dist/stores/workflowStore.js +264 -0
- package/dist/styles/base.css +896 -363
- package/dist/svelte-app.d.ts +52 -5
- package/dist/svelte-app.js +128 -6
- package/dist/types/config.d.ts +291 -0
- package/dist/types/config.js +4 -0
- package/dist/types/index.d.ts +231 -19
- package/dist/types/index.js +1 -1
- package/dist/utils/colors.d.ts +67 -33
- package/dist/utils/colors.js +183 -118
- package/dist/utils/config.d.ts +41 -0
- package/dist/utils/config.js +248 -0
- package/dist/utils/connections.d.ts +40 -3
- package/dist/utils/connections.js +115 -44
- package/dist/utils/icons.d.ts +1 -1
- package/dist/utils/icons.js +71 -70
- package/dist/utils/nodeStatus.d.ts +53 -0
- package/dist/utils/nodeStatus.js +183 -0
- package/dist/utils/nodeTypes.d.ts +57 -0
- package/dist/utils/nodeTypes.js +109 -0
- package/dist/utils/nodeWrapper.d.ts +39 -0
- package/dist/utils/nodeWrapper.js +62 -0
- package/package.json +129 -97
- package/dist/components/Node.svelte +0 -38
- package/dist/components/Node.svelte.d.ts +0 -4
package/README.md
CHANGED
|
@@ -1,293 +1,385 @@
|
|
|
1
|
-
# FlowDrop
|
|
1
|
+
# FlowDrop - Drupal Workflow Editor
|
|
2
2
|
|
|
3
|
-
A powerful
|
|
3
|
+
A powerful visual workflow editor for Drupal that enables drag-and-drop creation of complex workflows with AI integration, data processing, and automation capabilities.
|
|
4
4
|
|
|
5
|
-
## Features
|
|
5
|
+
## ๐ Features
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
7
|
+
- **Visual Workflow Editor**: Drag-and-drop interface for building complex workflows
|
|
8
|
+
- **AI Integration**: OpenAI, Anthropic, and other AI model integrations
|
|
9
|
+
- **Data Processing**: Advanced data manipulation and transformation nodes
|
|
10
|
+
- **HTTP Integration**: Webhook and API request capabilities
|
|
11
|
+
- **File Operations**: Upload, download, and file processing
|
|
12
|
+
- **Conditional Logic**: Advanced branching and decision-making nodes
|
|
13
|
+
- **Real-time Execution**: Live workflow execution with status monitoring
|
|
14
|
+
- **Drupal Native**: Built specifically for Drupal 10/11
|
|
14
15
|
|
|
15
|
-
##
|
|
16
|
+
## ๐ Project Structure
|
|
16
17
|
|
|
17
|
-
```
|
|
18
|
-
|
|
18
|
+
```
|
|
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
|
|
19
36
|
```
|
|
20
37
|
|
|
21
|
-
##
|
|
38
|
+
## ๐๏ธ Architecture
|
|
22
39
|
|
|
23
|
-
###
|
|
40
|
+
### Core Components
|
|
24
41
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
|
29
47
|
|
|
30
|
-
|
|
31
|
-
apiBaseUrl: "https://your-api.com",
|
|
32
|
-
theme: "auto",
|
|
33
|
-
enableDebug: true
|
|
34
|
-
};
|
|
35
|
-
</script>
|
|
48
|
+
### Node Categories
|
|
36
49
|
|
|
37
|
-
|
|
38
|
-
|
|
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
|
|
39
57
|
|
|
40
|
-
|
|
58
|
+
## ๐ ๏ธ Installation
|
|
41
59
|
|
|
42
|
-
|
|
43
|
-
<script lang="ts">
|
|
44
|
-
import { WorkflowEditor, sampleWorkflow } from "flowdrop";
|
|
45
|
-
import type { FlowDropConfig } from "flowdrop";
|
|
60
|
+
### Prerequisites
|
|
46
61
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
</script>
|
|
62
|
+
- Drupal 10 or 11
|
|
63
|
+
- PHP 8.1+
|
|
64
|
+
- Node.js 18+ (for frontend development)
|
|
52
65
|
|
|
53
|
-
|
|
54
|
-
```
|
|
66
|
+
### Installation Steps
|
|
55
67
|
|
|
56
|
-
|
|
68
|
+
1. **Install the module**:
|
|
57
69
|
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
70
|
+
```bash
|
|
71
|
+
# Copy to your Drupal modules directory
|
|
72
|
+
cp -r flowdrop /path/to/drupal/web/modules/custom/
|
|
73
|
+
```
|
|
62
74
|
|
|
63
|
-
|
|
64
|
-
apiBaseUrl: "https://your-api.com",
|
|
65
|
-
apiKey: "your-api-key"
|
|
66
|
-
};
|
|
75
|
+
2. **Enable the module**:
|
|
67
76
|
|
|
68
|
-
|
|
69
|
-
|
|
77
|
+
```bash
|
|
78
|
+
ddev drush en flowdrop flowdrop_workflow flowdrop_ui
|
|
79
|
+
```
|
|
70
80
|
|
|
71
|
-
|
|
72
|
-
```
|
|
81
|
+
3. **Build the frontend**:
|
|
73
82
|
|
|
74
|
-
|
|
83
|
+
```bash
|
|
84
|
+
cd modules/flowdrop_ui/app/flowdrop
|
|
85
|
+
npm install
|
|
86
|
+
npm run build:iife
|
|
87
|
+
```
|
|
75
88
|
|
|
76
|
-
|
|
89
|
+
4. **Clear Drupal cache**:
|
|
90
|
+
```bash
|
|
91
|
+
ddev drush cr
|
|
92
|
+
```
|
|
77
93
|
|
|
78
|
-
|
|
79
|
-
interface FlowDropConfig {
|
|
80
|
-
apiBaseUrl: string; // Your API endpoint
|
|
81
|
-
theme?: "light" | "dark" | "auto";
|
|
82
|
-
enableDebug?: boolean;
|
|
83
|
-
autoSave?: boolean;
|
|
84
|
-
autoSaveInterval?: number; // milliseconds
|
|
85
|
-
maxUndoSteps?: number;
|
|
86
|
-
nodeSpacing?: number;
|
|
87
|
-
gridSize?: number;
|
|
88
|
-
}
|
|
89
|
-
```
|
|
94
|
+
## ๐ฏ Usage
|
|
90
95
|
|
|
91
|
-
###
|
|
92
|
-
|
|
93
|
-
The library supports various node categories:
|
|
94
|
-
|
|
95
|
-
- **Models** - OpenAI, Anthropic, and other model providers
|
|
96
|
-
- **Input/Output** - Text input, file upload, display output
|
|
97
|
-
- **Processing** - Text transformation, data processing
|
|
98
|
-
- **Conditional** - Logic gates, conditional flows
|
|
99
|
-
- **Utility** - Helper functions, data manipulation
|
|
100
|
-
- **Integration** - External service connections
|
|
101
|
-
|
|
102
|
-
### Node Metadata Structure
|
|
103
|
-
|
|
104
|
-
```typescript
|
|
105
|
-
interface NodeMetadata {
|
|
106
|
-
id: string;
|
|
107
|
-
name: string;
|
|
108
|
-
description: string;
|
|
109
|
-
category: NodeCategory;
|
|
110
|
-
icon?: string;
|
|
111
|
-
color?: string;
|
|
112
|
-
inputs: NodePort[];
|
|
113
|
-
outputs: NodePort[];
|
|
114
|
-
configSchema?: Record<string, unknown>;
|
|
115
|
-
tags?: string[];
|
|
116
|
-
}
|
|
117
|
-
```
|
|
96
|
+
### Accessing the Workflow Editor
|
|
118
97
|
|
|
119
|
-
|
|
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
|
|
120
101
|
|
|
121
|
-
|
|
102
|
+
### Creating Workflows
|
|
122
103
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
- `GET /api/workflows/{id}` - Load workflow
|
|
129
|
-
- `GET /api/workflows` - List workflows
|
|
130
|
-
- `DELETE /api/workflows/{id}` - Delete workflow
|
|
131
|
-
- `POST /api/workflows/{id}/execute` - Execute workflow
|
|
132
|
-
- `GET /api/executions/{id}` - Get execution status
|
|
133
|
-
- `POST /api/executions/{id}/cancel` - Cancel execution
|
|
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
|
|
134
109
|
|
|
135
|
-
|
|
110
|
+
### Available Node Types
|
|
136
111
|
|
|
137
|
-
|
|
112
|
+
#### AI Models
|
|
138
113
|
|
|
139
|
-
|
|
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
|
|
140
118
|
|
|
141
|
-
|
|
142
|
-
<WorkflowEditor
|
|
143
|
-
config={config}
|
|
144
|
-
workflow={workflow}
|
|
145
|
-
apiKey="optional-api-key"
|
|
146
|
-
/>
|
|
147
|
-
```
|
|
119
|
+
#### Data Processing
|
|
148
120
|
|
|
149
|
-
|
|
121
|
+
- **Calculator**: Mathematical operations
|
|
122
|
+
- **Dataframe Operations**: Advanced data manipulation
|
|
123
|
+
- **Data Operations**: General data processing
|
|
124
|
+
- **Data to Dataframe**: Data format conversion
|
|
150
125
|
|
|
151
|
-
|
|
126
|
+
#### Input/Output
|
|
152
127
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
on:nodeSelected={handleNodeSelected}
|
|
158
|
-
on:categoryChanged={handleCategoryChanged}
|
|
159
|
-
on:searchChanged={handleSearchChanged}
|
|
160
|
-
/>
|
|
161
|
-
```
|
|
128
|
+
- **Text Input**: User input collection
|
|
129
|
+
- **Text Output**: Display text results
|
|
130
|
+
- **Chat Output**: Chat interface output
|
|
131
|
+
- **File Upload**: File upload handling
|
|
162
132
|
|
|
163
|
-
|
|
133
|
+
#### HTTP & Integration
|
|
164
134
|
|
|
165
|
-
|
|
135
|
+
- **URL Fetch**: HTTP GET requests
|
|
136
|
+
- **HTTP Request**: Full HTTP client
|
|
137
|
+
- **Webhook**: Webhook endpoint handling
|
|
166
138
|
|
|
167
|
-
|
|
168
|
-
<WorkflowNode
|
|
169
|
-
data={nodeData}
|
|
170
|
-
selected={false}
|
|
171
|
-
on:configChanged={handleConfigChange}
|
|
172
|
-
on:nodeSelected={handleNodeSelect}
|
|
173
|
-
/>
|
|
174
|
-
```
|
|
139
|
+
#### Logic & Control
|
|
175
140
|
|
|
176
|
-
|
|
141
|
+
- **Conditional**: If/else logic branching
|
|
142
|
+
- **Loop**: Iterative operations
|
|
143
|
+
- **Split Text**: Text segmentation
|
|
177
144
|
|
|
178
|
-
|
|
145
|
+
#### Utility
|
|
179
146
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
nodeRemoved: { nodeId: string }
|
|
185
|
-
nodeUpdated: { node: WorkflowNode }
|
|
147
|
+
- **DateTime**: Date/time operations
|
|
148
|
+
- **Regex Extractor**: Pattern matching
|
|
149
|
+
- **Conversation Buffer**: Chat history management
|
|
150
|
+
- **Structured Output**: Formatted output generation
|
|
186
151
|
|
|
187
|
-
|
|
188
|
-
edgeAdded: { edge: WorkflowEdge }
|
|
189
|
-
edgeRemoved: { edgeId: string }
|
|
152
|
+
## ๐ง Development
|
|
190
153
|
|
|
191
|
-
|
|
192
|
-
workflowSaved: { workflow: Workflow }
|
|
193
|
-
workflowLoaded: { workflow: Workflow }
|
|
154
|
+
### Adding New Node Types
|
|
194
155
|
|
|
195
|
-
|
|
196
|
-
executionStarted: { workflowId: string }
|
|
197
|
-
executionCompleted: { result: ExecutionResult }
|
|
198
|
-
executionFailed: { error: string }
|
|
199
|
-
```
|
|
156
|
+
1. **Create Node Class**:
|
|
200
157
|
|
|
201
|
-
|
|
158
|
+
```php
|
|
159
|
+
<?php
|
|
202
160
|
|
|
203
|
-
|
|
161
|
+
namespace Drupal\flowdrop\Plugin\FlowDropNodeProcessor;
|
|
204
162
|
|
|
205
|
-
|
|
163
|
+
use Drupal\flowdrop\Attribute\FlowDropNodeProcessor;
|
|
206
164
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
</script>
|
|
165
|
+
#[FlowDropNodeProcessor(
|
|
166
|
+
id: "my_custom_node",
|
|
167
|
+
label: new \Drupal\Core\StringTranslation\TranslatableMarkup("My Custom Node")
|
|
168
|
+
)]
|
|
169
|
+
class MyCustomNode extends AbstractFlowDropNodeProcessor {
|
|
213
170
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
171
|
+
public function execute(array $inputs, array $config): array {
|
|
172
|
+
// Your node logic here
|
|
173
|
+
return ['result' => 'processed data'];
|
|
174
|
+
}
|
|
218
175
|
|
|
219
|
-
|
|
176
|
+
public function getConfigSchema(): array {
|
|
177
|
+
return [
|
|
178
|
+
'type' => 'object',
|
|
179
|
+
'properties' => [
|
|
180
|
+
'mySetting' => ['type' => 'string'],
|
|
181
|
+
],
|
|
182
|
+
];
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
```
|
|
220
186
|
|
|
221
|
-
|
|
187
|
+
2. **Implement Required Methods**:
|
|
188
|
+
- `execute()`: Main node logic
|
|
189
|
+
- `getConfigSchema()`: Configuration schema
|
|
190
|
+
- `getInputSchema()`: Input validation schema
|
|
191
|
+
- `getOutputSchema()`: Output schema
|
|
192
|
+
- `validateInputs()`: Input validation
|
|
222
193
|
|
|
223
|
-
|
|
224
|
-
2. Using DaisyUI themes
|
|
225
|
-
3. Adding custom CSS classes
|
|
194
|
+
### Frontend Development
|
|
226
195
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}
|
|
196
|
+
The frontend is a Svelte application located in `modules/flowdrop_ui/app/flowdrop/`.
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
cd modules/flowdrop_ui/app/flowdrop
|
|
200
|
+
npm run dev # Development server
|
|
201
|
+
npm run build:iife # Build for Drupal integration
|
|
202
|
+
npm run test # Run tests
|
|
235
203
|
```
|
|
236
204
|
|
|
237
|
-
##
|
|
205
|
+
## ๐ API Documentation
|
|
238
206
|
|
|
239
|
-
###
|
|
207
|
+
### IIFE Integration API
|
|
240
208
|
|
|
241
|
-
|
|
242
|
-
- npm or yarn
|
|
209
|
+
The FlowDrop library can be integrated into Drupal using the IIFE (Immediately Invoked Function Expression) build. The library provides two main mounting functions:
|
|
243
210
|
|
|
244
|
-
|
|
211
|
+
#### Mounting Functions
|
|
245
212
|
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
213
|
+
```javascript
|
|
214
|
+
// Mount the full FlowDrop App
|
|
215
|
+
window.FlowDrop.mountFlowDropApp(container, options);
|
|
216
|
+
|
|
217
|
+
// Mount just the WorkflowEditor component
|
|
218
|
+
window.FlowDrop.mountWorkflowEditor(container, options);
|
|
250
219
|
```
|
|
251
220
|
|
|
252
|
-
|
|
221
|
+
#### Configuration Options
|
|
222
|
+
|
|
223
|
+
```javascript
|
|
224
|
+
// Basic usage with default configuration
|
|
225
|
+
window.FlowDrop.mountWorkflowEditor(container, {
|
|
226
|
+
workflow: myWorkflow,
|
|
227
|
+
nodes: availableNodes
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// Advanced usage with custom endpoint configuration
|
|
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
|
+
```
|
|
253
275
|
|
|
254
|
-
|
|
255
|
-
|
|
276
|
+
#### Drupal Integration Example
|
|
277
|
+
|
|
278
|
+
```javascript
|
|
279
|
+
// Drupal behavior for FlowDrop integration
|
|
280
|
+
Drupal.behaviors.flowdropWorkflowEditor = {
|
|
281
|
+
attach: function (context, settings) {
|
|
282
|
+
const container = context.querySelector('.flowdrop-workflow-editor');
|
|
283
|
+
if (container && window.FlowDrop) {
|
|
284
|
+
window.FlowDrop.mountWorkflowEditor(container, {
|
|
285
|
+
endpointConfig: settings.flowdrop.endpointConfig,
|
|
286
|
+
workflow: settings.flowdrop.workflow,
|
|
287
|
+
nodes: settings.flowdrop.nodes
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### REST API Endpoints
|
|
295
|
+
|
|
296
|
+
#### Workflows
|
|
297
|
+
|
|
298
|
+
- `GET /api/flowdrop/workflows` - List workflows
|
|
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
|
|
304
|
+
|
|
305
|
+
#### Nodes
|
|
306
|
+
|
|
307
|
+
- `GET /api/flowdrop/nodes` - List available nodes
|
|
308
|
+
- `GET /api/flowdrop/nodes/{id}` - Get node metadata
|
|
309
|
+
- `GET /api/flowdrop/nodes?category={category}` - Filter by category
|
|
310
|
+
|
|
311
|
+
#### Executions
|
|
312
|
+
|
|
313
|
+
- `GET /api/flowdrop/executions/active` - Active executions
|
|
314
|
+
- `GET /api/flowdrop/executions/{id}/state` - Execution status
|
|
315
|
+
|
|
316
|
+
### Node Configuration Schema
|
|
317
|
+
|
|
318
|
+
Each node type defines its configuration schema:
|
|
319
|
+
|
|
320
|
+
```json
|
|
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
|
+
}
|
|
256
335
|
```
|
|
257
336
|
|
|
258
|
-
|
|
337
|
+
## ๐ Security
|
|
338
|
+
|
|
339
|
+
- All API endpoints require appropriate Drupal permissions
|
|
340
|
+
- Input validation on all node processors
|
|
341
|
+
- Exception handling for failed executions
|
|
342
|
+
- Logging of all workflow operations
|
|
343
|
+
|
|
344
|
+
## ๐งช Testing
|
|
345
|
+
|
|
346
|
+
### Backend Testing
|
|
259
347
|
|
|
260
348
|
```bash
|
|
261
|
-
|
|
349
|
+
ddev drush test:run flowdrop
|
|
262
350
|
```
|
|
263
351
|
|
|
264
|
-
### Testing
|
|
352
|
+
### Frontend Testing
|
|
265
353
|
|
|
266
354
|
```bash
|
|
267
|
-
|
|
355
|
+
cd modules/flowdrop_ui/app/flowdrop
|
|
356
|
+
npm run test:unit
|
|
357
|
+
npm run test:e2e
|
|
268
358
|
```
|
|
269
359
|
|
|
270
|
-
##
|
|
360
|
+
## ๐ Logging
|
|
361
|
+
|
|
362
|
+
Workflow execution is logged through Drupal's logging system:
|
|
363
|
+
|
|
364
|
+
```php
|
|
365
|
+
$this->loggerFactory->get('flowdrop')->info('Workflow executed', [
|
|
366
|
+
'workflow_id' => $workflowId,
|
|
367
|
+
'execution_time' => $executionTime,
|
|
368
|
+
]);
|
|
369
|
+
```
|
|
271
370
|
|
|
272
|
-
|
|
273
|
-
2. Create a feature branch
|
|
274
|
-
3. Make your changes
|
|
275
|
-
4. Add tests if applicable
|
|
276
|
-
5. Submit a pull request
|
|
371
|
+
## ๐ค Contributing
|
|
277
372
|
|
|
278
|
-
|
|
373
|
+
Not accepting Contribution until the module stabilizes. Stay tuned.
|
|
279
374
|
|
|
280
|
-
|
|
375
|
+
## ๐ Support
|
|
281
376
|
|
|
282
|
-
|
|
377
|
+
For issues and questions:
|
|
283
378
|
|
|
284
|
-
-
|
|
285
|
-
-
|
|
286
|
-
-
|
|
379
|
+
- Check the API documentation in `modules/flowdrop_ui/app/flowdrop/API.md`
|
|
380
|
+
- Review the security guidelines in `modules/flowdrop_ui/app/flowdrop/SECURITY.md`
|
|
381
|
+
- Create an issue in the project repository
|
|
287
382
|
|
|
288
|
-
|
|
383
|
+
---
|
|
289
384
|
|
|
290
|
-
-
|
|
291
|
-
- [DaisyUI](https://daisyui.com/) - Beautiful UI components
|
|
292
|
-
- [Tailwind CSS](https://tailwindcss.com/) - Utility-first CSS framework
|
|
293
|
-
- [SvelteKit](https://kit.svelte.dev/) - The web framework
|
|
385
|
+
**FlowDrop** - Empowering Drupal with visual workflow automation.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* - External applications that want to integrate with FlowDrop
|
|
14
14
|
* - Systems that need to generate or modify workflows programmatically
|
|
15
15
|
*/
|
|
16
|
-
import type { Workflow, NodeMetadata } from
|
|
16
|
+
import type { Workflow, NodeMetadata } from '../types/index.js';
|
|
17
17
|
/**
|
|
18
18
|
* Standard workflow node interface (SvelteFlow-agnostic)
|
|
19
19
|
*/
|