@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.
Files changed (119) hide show
  1. package/README.md +307 -215
  2. package/dist/adapters/WorkflowAdapter.d.ts +1 -1
  3. package/dist/adapters/WorkflowAdapter.js +30 -30
  4. package/dist/api/client.d.ts +24 -1
  5. package/dist/api/client.js +55 -38
  6. package/dist/api/enhanced-client.d.ts +46 -0
  7. package/dist/api/enhanced-client.js +211 -0
  8. package/dist/clients/ApiClient.d.ts +19 -23
  9. package/dist/clients/ApiClient.js +36 -34
  10. package/dist/components/App.svelte +1299 -230
  11. package/dist/components/App.svelte.d.ts +21 -1
  12. package/dist/components/CanvasBanner.svelte +50 -44
  13. package/dist/components/CanvasBanner.svelte.d.ts +5 -19
  14. package/dist/components/ConfigForm.svelte +555 -0
  15. package/dist/components/ConfigForm.svelte.d.ts +32 -0
  16. package/dist/components/ConfigModal.svelte +261 -0
  17. package/dist/components/ConfigModal.svelte.d.ts +31 -0
  18. package/dist/components/ConfigSidebar.svelte +934 -0
  19. package/dist/components/ConfigSidebar.svelte.d.ts +51 -0
  20. package/dist/components/ConnectionLine.svelte +32 -0
  21. package/dist/components/ConnectionLine.svelte.d.ts +3 -0
  22. package/dist/components/GatewayNode.svelte +471 -0
  23. package/dist/components/GatewayNode.svelte.d.ts +15 -0
  24. package/dist/components/LoadingSpinner.svelte +23 -23
  25. package/dist/components/LoadingSpinner.svelte.d.ts +1 -1
  26. package/dist/components/Logo.svelte +82 -0
  27. package/dist/components/Logo.svelte.d.ts +26 -0
  28. package/dist/components/LogsSidebar.svelte +565 -0
  29. package/dist/components/LogsSidebar.svelte.d.ts +34 -0
  30. package/dist/components/MarkdownDisplay.svelte +28 -0
  31. package/dist/components/MarkdownDisplay.svelte.d.ts +7 -0
  32. package/dist/components/Navbar.svelte +663 -0
  33. package/dist/components/Navbar.svelte.d.ts +21 -0
  34. package/dist/components/NodeSidebar.svelte +629 -488
  35. package/dist/components/NodeSidebar.svelte.d.ts +1 -2
  36. package/dist/components/NodeStatusOverlay.svelte +327 -0
  37. package/dist/components/NodeStatusOverlay.svelte.d.ts +11 -0
  38. package/dist/components/NotesNode.svelte +566 -0
  39. package/dist/components/NotesNode.svelte.d.ts +43 -0
  40. package/dist/components/PipelineStatus.svelte +331 -0
  41. package/dist/components/PipelineStatus.svelte.d.ts +18 -0
  42. package/dist/components/SimpleNode.svelte +447 -0
  43. package/dist/components/SimpleNode.svelte.d.ts +24 -0
  44. package/dist/components/SquareNode.svelte +346 -0
  45. package/dist/components/SquareNode.svelte.d.ts +24 -0
  46. package/dist/components/StatusIcon.svelte +112 -0
  47. package/dist/components/StatusIcon.svelte.d.ts +10 -0
  48. package/dist/components/StatusLabel.svelte +33 -0
  49. package/dist/components/StatusLabel.svelte.d.ts +7 -0
  50. package/dist/components/ToolNode.svelte +385 -0
  51. package/dist/components/ToolNode.svelte.d.ts +36 -0
  52. package/dist/components/UniversalNode.svelte +126 -0
  53. package/dist/components/UniversalNode.svelte.d.ts +15 -0
  54. package/dist/components/WorkflowEditor.svelte +871 -528
  55. package/dist/components/WorkflowEditor.svelte.d.ts +15 -5
  56. package/dist/components/WorkflowNode.svelte +428 -542
  57. package/dist/components/WorkflowNode.svelte.d.ts +7 -3
  58. package/dist/config/apiConfig.d.ts +33 -0
  59. package/dist/config/apiConfig.js +39 -0
  60. package/dist/config/defaultPortConfig.d.ts +6 -0
  61. package/dist/config/defaultPortConfig.js +192 -0
  62. package/dist/config/demo.d.ts +58 -0
  63. package/dist/config/demo.js +142 -0
  64. package/dist/config/endpoints.d.ts +106 -0
  65. package/dist/config/endpoints.js +128 -0
  66. package/dist/data/samples.d.ts +38 -4
  67. package/dist/data/samples.js +2789 -737
  68. package/dist/examples/adapter-usage.d.ts +4 -4
  69. package/dist/examples/adapter-usage.js +21 -26
  70. package/dist/examples/api-client-usage.d.ts +6 -6
  71. package/dist/examples/api-client-usage.js +55 -54
  72. package/dist/index.d.ts +23 -15
  73. package/dist/index.js +23 -15
  74. package/dist/mocks/app-environment.d.ts +8 -0
  75. package/dist/mocks/app-environment.js +16 -0
  76. package/dist/mocks/app-forms.d.ts +2 -0
  77. package/dist/mocks/app-forms.js +21 -0
  78. package/dist/mocks/app-navigation.d.ts +5 -0
  79. package/dist/mocks/app-navigation.js +34 -0
  80. package/dist/mocks/app-stores.d.ts +14 -0
  81. package/dist/mocks/app-stores.js +26 -0
  82. package/dist/services/api.d.ts +13 -3
  83. package/dist/services/api.js +91 -36
  84. package/dist/services/globalSave.d.ts +20 -0
  85. package/dist/services/globalSave.js +165 -0
  86. package/dist/services/nodeExecutionService.d.ts +63 -0
  87. package/dist/services/nodeExecutionService.js +261 -0
  88. package/dist/services/portConfigApi.d.ts +14 -0
  89. package/dist/services/portConfigApi.js +69 -0
  90. package/dist/services/toastService.d.ts +147 -0
  91. package/dist/services/toastService.js +235 -0
  92. package/dist/services/workflowStorage.d.ts +2 -2
  93. package/dist/services/workflowStorage.js +10 -10
  94. package/dist/stores/workflowStore.d.ts +53 -0
  95. package/dist/stores/workflowStore.js +264 -0
  96. package/dist/styles/base.css +896 -363
  97. package/dist/svelte-app.d.ts +52 -5
  98. package/dist/svelte-app.js +128 -6
  99. package/dist/types/config.d.ts +291 -0
  100. package/dist/types/config.js +4 -0
  101. package/dist/types/index.d.ts +231 -19
  102. package/dist/types/index.js +1 -1
  103. package/dist/utils/colors.d.ts +67 -33
  104. package/dist/utils/colors.js +183 -118
  105. package/dist/utils/config.d.ts +41 -0
  106. package/dist/utils/config.js +248 -0
  107. package/dist/utils/connections.d.ts +40 -3
  108. package/dist/utils/connections.js +115 -44
  109. package/dist/utils/icons.d.ts +1 -1
  110. package/dist/utils/icons.js +71 -70
  111. package/dist/utils/nodeStatus.d.ts +53 -0
  112. package/dist/utils/nodeStatus.js +183 -0
  113. package/dist/utils/nodeTypes.d.ts +57 -0
  114. package/dist/utils/nodeTypes.js +109 -0
  115. package/dist/utils/nodeWrapper.d.ts +39 -0
  116. package/dist/utils/nodeWrapper.js +62 -0
  117. package/package.json +129 -97
  118. package/dist/components/Node.svelte +0 -38
  119. 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 Svelte Flow-based library for building workflows with a drag-and-drop interface. Inspired by tools like n8n, Langflow, and Flowise.
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
- - ๐ŸŽฏ **Node-based Workflow Editor** - Drag and drop interface for building workflows
8
- - ๐Ÿ”Œ **HTTP API Integration** - Fetch node definitions and manage workflows via REST API
9
- - ๐ŸŽจ **Modern UI** - Built with DaisyUI and Tailwind CSS for a beautiful, responsive interface
10
- - ๐Ÿ“ฑ **Responsive Design** - Works seamlessly on desktop and mobile devices
11
- - ๐Ÿ”ง **TypeScript Support** - Full TypeScript support with comprehensive type definitions
12
- - ๐Ÿš€ **SvelteKit Ready** - Built for SvelteKit applications
13
- - ๐Ÿ“ฆ **Modular Architecture** - Easy to extend and customize
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
- ## Installation
16
+ ## ๐Ÿ“ Project Structure
16
17
 
17
- ```bash
18
- npm install flowdrop
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
- ## Quick Start
38
+ ## ๐Ÿ—๏ธ Architecture
22
39
 
23
- ### 1. Basic Setup
40
+ ### Core Components
24
41
 
25
- ```svelte
26
- <script lang="ts">
27
- import { WorkflowEditor } from "flowdrop";
28
- import type { FlowDropConfig } from "flowdrop";
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
- const config: FlowDropConfig = {
31
- apiBaseUrl: "https://your-api.com",
32
- theme: "auto",
33
- enableDebug: true
34
- };
35
- </script>
48
+ ### Node Categories
36
49
 
37
- <WorkflowEditor {config} />
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
- ### 2. With Sample Data
58
+ ## ๐Ÿ› ๏ธ Installation
41
59
 
42
- ```svelte
43
- <script lang="ts">
44
- import { WorkflowEditor, sampleWorkflow } from "flowdrop";
45
- import type { FlowDropConfig } from "flowdrop";
60
+ ### Prerequisites
46
61
 
47
- const config: FlowDropConfig = {
48
- apiBaseUrl: "https://your-api.com",
49
- theme: "auto"
50
- };
51
- </script>
62
+ - Drupal 10 or 11
63
+ - PHP 8.1+
64
+ - Node.js 18+ (for frontend development)
52
65
 
53
- <WorkflowEditor {config} workflow={sampleWorkflow} />
54
- ```
66
+ ### Installation Steps
55
67
 
56
- ### 3. Custom API Client
68
+ 1. **Install the module**:
57
69
 
58
- ```svelte
59
- <script lang="ts">
60
- import { WorkflowEditor, FlowDropApiClient } from "flowdrop";
61
- import type { FlowDropConfig } from "flowdrop";
70
+ ```bash
71
+ # Copy to your Drupal modules directory
72
+ cp -r flowdrop /path/to/drupal/web/modules/custom/
73
+ ```
62
74
 
63
- const config: FlowDropConfig = {
64
- apiBaseUrl: "https://your-api.com",
65
- apiKey: "your-api-key"
66
- };
75
+ 2. **Enable the module**:
67
76
 
68
- const apiClient = new FlowDropApiClient(config.apiBaseUrl, config.apiKey);
69
- </script>
77
+ ```bash
78
+ ddev drush en flowdrop flowdrop_workflow flowdrop_ui
79
+ ```
70
80
 
71
- <WorkflowEditor {config} />
72
- ```
81
+ 3. **Build the frontend**:
73
82
 
74
- ## API Reference
83
+ ```bash
84
+ cd modules/flowdrop_ui/app/flowdrop
85
+ npm install
86
+ npm run build:iife
87
+ ```
75
88
 
76
- ### Configuration
89
+ 4. **Clear Drupal cache**:
90
+ ```bash
91
+ ddev drush cr
92
+ ```
77
93
 
78
- ```typescript
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
- ### Node Types
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
- ### API Endpoints
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
- The library expects the following API endpoints:
102
+ ### Creating Workflows
122
103
 
123
- - `GET /api/nodes` - Fetch available node types
124
- - `GET /api/nodes?category={category}` - Fetch nodes by category
125
- - `GET /api/nodes/{id}` - Fetch specific node metadata
126
- - `POST /api/workflows` - Save workflow
127
- - `PUT /api/workflows/{id}` - Update workflow
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
- ## Components
110
+ ### Available Node Types
136
111
 
137
- ### WorkflowEditor
112
+ #### AI Models
138
113
 
139
- The main component that provides the complete workflow editing experience.
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
- ```svelte
142
- <WorkflowEditor
143
- config={config}
144
- workflow={workflow}
145
- apiKey="optional-api-key"
146
- />
147
- ```
119
+ #### Data Processing
148
120
 
149
- ### NodeSidebar
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
- A sidebar component that displays available nodes organized by category.
126
+ #### Input/Output
152
127
 
153
- ```svelte
154
- <NodeSidebar
155
- nodes={availableNodes}
156
- loading={false}
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
- ### WorkflowNode
133
+ #### HTTP & Integration
164
134
 
165
- A customizable node component for displaying workflow nodes.
135
+ - **URL Fetch**: HTTP GET requests
136
+ - **HTTP Request**: Full HTTP client
137
+ - **Webhook**: Webhook endpoint handling
166
138
 
167
- ```svelte
168
- <WorkflowNode
169
- data={nodeData}
170
- selected={false}
171
- on:configChanged={handleConfigChange}
172
- on:nodeSelected={handleNodeSelect}
173
- />
174
- ```
139
+ #### Logic & Control
175
140
 
176
- ## Events
141
+ - **Conditional**: If/else logic branching
142
+ - **Loop**: Iterative operations
143
+ - **Split Text**: Text segmentation
177
144
 
178
- The library dispatches various events for integration:
145
+ #### Utility
179
146
 
180
- ```typescript
181
- // Node events
182
- nodeSelected: { node: NodeMetadata }
183
- nodeAdded: { node: WorkflowNode }
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
- // Edge events
188
- edgeAdded: { edge: WorkflowEdge }
189
- edgeRemoved: { edgeId: string }
152
+ ## ๐Ÿ”ง Development
190
153
 
191
- // Workflow events
192
- workflowSaved: { workflow: Workflow }
193
- workflowLoaded: { workflow: Workflow }
154
+ ### Adding New Node Types
194
155
 
195
- // Execution events
196
- executionStarted: { workflowId: string }
197
- executionCompleted: { result: ExecutionResult }
198
- executionFailed: { error: string }
199
- ```
156
+ 1. **Create Node Class**:
200
157
 
201
- ## Customization
158
+ ```php
159
+ <?php
202
160
 
203
- ### Custom Node Types
161
+ namespace Drupal\flowdrop\Plugin\FlowDropNodeProcessor;
204
162
 
205
- You can create custom node types by extending the base components:
163
+ use Drupal\flowdrop\Attribute\FlowDropNodeProcessor;
206
164
 
207
- ```svelte
208
- <script lang="ts">
209
- import WorkflowNode from "flowdrop/WorkflowNode.svelte";
210
-
211
- // Custom node logic here
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
- <div class="custom-node">
215
- <!-- Your custom node UI -->
216
- </div>
217
- ```
171
+ public function execute(array $inputs, array $config): array {
172
+ // Your node logic here
173
+ return ['result' => 'processed data'];
174
+ }
218
175
 
219
- ### Custom Styling
176
+ public function getConfigSchema(): array {
177
+ return [
178
+ 'type' => 'object',
179
+ 'properties' => [
180
+ 'mySetting' => ['type' => 'string'],
181
+ ],
182
+ ];
183
+ }
184
+ }
185
+ ```
220
186
 
221
- The library uses DaisyUI and Tailwind CSS. You can customize the appearance by:
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
- 1. Overriding CSS variables
224
- 2. Using DaisyUI themes
225
- 3. Adding custom CSS classes
194
+ ### Frontend Development
226
195
 
227
- ```css
228
- :root {
229
- --primary: 220 14% 96%;
230
- --primary-content: 220 9% 46%;
231
- --secondary: 220 14% 96%;
232
- --secondary-content: 220 9% 46%;
233
- /* ... more variables */
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
- ## Development
205
+ ## ๐Ÿ“š API Documentation
238
206
 
239
- ### Prerequisites
207
+ ### IIFE Integration API
240
208
 
241
- - Node.js 18+
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
- ### Setup
211
+ #### Mounting Functions
245
212
 
246
- ```bash
247
- git clone https://github.com/your-repo/flowdrop.git
248
- cd flowdrop
249
- npm install
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
- ### Development Server
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
- ```bash
255
- npm run dev
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
- ### Build
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
- npm run build
349
+ ddev drush test:run flowdrop
262
350
  ```
263
351
 
264
- ### Testing
352
+ ### Frontend Testing
265
353
 
266
354
  ```bash
267
- npm run test
355
+ cd modules/flowdrop_ui/app/flowdrop
356
+ npm run test:unit
357
+ npm run test:e2e
268
358
  ```
269
359
 
270
- ## Contributing
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
- 1. Fork the repository
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
- ## License
373
+ Not accepting Contribution until the module stabilizes. Stay tuned.
279
374
 
280
- MIT License - see [LICENSE](LICENSE) file for details.
375
+ ## ๐Ÿ†˜ Support
281
376
 
282
- ## Support
377
+ For issues and questions:
283
378
 
284
- - ๐Ÿ“š [Documentation](https://flowdrop.dev)
285
- - ๐Ÿ› [Issue Tracker](https://github.com/your-repo/flowdrop/issues)
286
- - ๐Ÿ’ฌ [Discussions](https://github.com/your-repo/flowdrop/discussions)
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
- ## Acknowledgments
383
+ ---
289
384
 
290
- - [Svelte Flow](https://github.com/xyflow/xyflow) - The underlying flow library
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 "../types/index.js";
16
+ import type { Workflow, NodeMetadata } from '../types/index.js';
17
17
  /**
18
18
  * Standard workflow node interface (SvelteFlow-agnostic)
19
19
  */