@d34dman/flowdrop 0.0.7 → 0.0.9
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/dist/components/App.svelte +13 -7
- package/dist/components/App.svelte.d.ts +2 -0
- package/dist/components/ConfigModal.svelte +0 -3
- package/dist/components/NodeSidebar.svelte +0 -1
- package/dist/components/PipelineStatus.svelte +5 -2
- package/dist/components/PipelineStatus.svelte.d.ts +2 -0
- package/dist/components/WorkflowEditor.svelte +1 -30
- package/dist/helpers/workflowEditorHelper.js +2 -15
- package/dist/services/nodeExecutionService.js +0 -3
- package/dist/services/portConfigApi.js +2 -10
- package/dist/stores/workflowStore.js +0 -12
- package/dist/svelte-app.js +2 -1
- package/dist/utils/connections.js +0 -7
- package/package.json +1 -1
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
}>;
|
|
44
44
|
// API configuration - optional, defaults to '/api/flowdrop'
|
|
45
45
|
apiBaseUrl?: string;
|
|
46
|
+
endpointConfig?: EndpointConfig;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
let {
|
|
@@ -57,7 +58,8 @@
|
|
|
57
58
|
pipelineId,
|
|
58
59
|
navbarTitle,
|
|
59
60
|
navbarActions = [],
|
|
60
|
-
apiBaseUrl
|
|
61
|
+
apiBaseUrl,
|
|
62
|
+
endpointConfig: propEndpointConfig
|
|
61
63
|
}: Props = $props();
|
|
62
64
|
|
|
63
65
|
// Create breadcrumb-style title - at top level to avoid store subscription issues
|
|
@@ -182,10 +184,17 @@
|
|
|
182
184
|
|
|
183
185
|
/**
|
|
184
186
|
* Initialize API endpoints
|
|
185
|
-
*
|
|
187
|
+
* Priority: propEndpointConfig > existingConfig > apiBaseUrl > default
|
|
186
188
|
*/
|
|
187
189
|
async function initializeApiEndpoints(): Promise<void> {
|
|
188
|
-
//
|
|
190
|
+
// First priority: Use endpointConfig prop if provided (from mountFlowDropApp)
|
|
191
|
+
if (propEndpointConfig) {
|
|
192
|
+
setEndpointConfig(propEndpointConfig);
|
|
193
|
+
endpointConfig = propEndpointConfig;
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Second priority: Check if endpoint config is already set (e.g., by parent layout)
|
|
189
198
|
const { getEndpointConfig } = await import('../services/api.js');
|
|
190
199
|
const existingConfig = getEndpointConfig();
|
|
191
200
|
|
|
@@ -195,7 +204,7 @@
|
|
|
195
204
|
return;
|
|
196
205
|
}
|
|
197
206
|
|
|
198
|
-
// Use provided apiBaseUrl or default
|
|
207
|
+
// Third priority: Use provided apiBaseUrl or default
|
|
199
208
|
const baseUrl = apiBaseUrl || '/api/flowdrop';
|
|
200
209
|
|
|
201
210
|
const config = createEndpointConfig(baseUrl, {
|
|
@@ -249,8 +258,6 @@
|
|
|
249
258
|
* Handle workflow configuration save
|
|
250
259
|
*/
|
|
251
260
|
async function handleWorkflowSave(config: any): Promise<void> {
|
|
252
|
-
console.log('Workflow configuration saved:', config);
|
|
253
|
-
|
|
254
261
|
// Update the workflow store
|
|
255
262
|
if ($workflowStore) {
|
|
256
263
|
$workflowStore.name = config.name;
|
|
@@ -263,7 +270,6 @@
|
|
|
263
270
|
// Also save the workflow to the backend
|
|
264
271
|
try {
|
|
265
272
|
await saveWorkflow();
|
|
266
|
-
console.log('Workflow saved to backend successfully');
|
|
267
273
|
} catch (error) {
|
|
268
274
|
console.error('Failed to save workflow to backend:', error);
|
|
269
275
|
// Note: We don't throw the error here to avoid breaking the UI flow
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Workflow } from '../types/index.js';
|
|
2
|
+
import type { EndpointConfig } from '../config/endpoints.js';
|
|
2
3
|
interface Props {
|
|
3
4
|
workflow?: Workflow;
|
|
4
5
|
height?: string | number;
|
|
@@ -18,6 +19,7 @@ interface Props {
|
|
|
18
19
|
onclick?: (event: Event) => void;
|
|
19
20
|
}>;
|
|
20
21
|
apiBaseUrl?: string;
|
|
22
|
+
endpointConfig?: EndpointConfig;
|
|
21
23
|
}
|
|
22
24
|
declare const App: import("svelte").Component<Props, {}, "">;
|
|
23
25
|
type App = ReturnType<typeof App>;
|
|
@@ -10,12 +10,14 @@
|
|
|
10
10
|
import LogsSidebar from './LogsSidebar.svelte';
|
|
11
11
|
import { FlowDropApiClient } from '../api/client.js';
|
|
12
12
|
import type { Workflow } from '../types/index.js';
|
|
13
|
+
import type { EndpointConfig } from '../config/endpoints.js';
|
|
13
14
|
|
|
14
15
|
interface Props {
|
|
15
16
|
pipelineId: string;
|
|
16
17
|
workflow: Workflow;
|
|
17
18
|
apiClient?: FlowDropApiClient;
|
|
18
19
|
baseUrl?: string;
|
|
20
|
+
endpointConfig?: EndpointConfig;
|
|
19
21
|
onActionsReady?: (
|
|
20
22
|
actions: Array<{
|
|
21
23
|
label: string;
|
|
@@ -27,10 +29,10 @@
|
|
|
27
29
|
) => void;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
let { pipelineId, workflow, apiClient, baseUrl, onActionsReady }: Props = $props();
|
|
32
|
+
let { pipelineId, workflow, apiClient, baseUrl, endpointConfig, onActionsReady }: Props = $props();
|
|
31
33
|
|
|
32
34
|
// Initialize API client if not provided
|
|
33
|
-
const client = apiClient || new FlowDropApiClient(baseUrl || "/api/flowdrop");
|
|
35
|
+
const client = apiClient || new FlowDropApiClient(endpointConfig?.baseUrl || baseUrl || "/api/flowdrop");
|
|
34
36
|
|
|
35
37
|
// Pipeline status and job data
|
|
36
38
|
let pipelineStatus = $state<string>('unknown');
|
|
@@ -276,6 +278,7 @@
|
|
|
276
278
|
readOnly={true}
|
|
277
279
|
{nodeStatuses}
|
|
278
280
|
{pipelineId}
|
|
281
|
+
{endpointConfig}
|
|
279
282
|
/>
|
|
280
283
|
|
|
281
284
|
<!-- Logs Sidebar -->
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { FlowDropApiClient } from '../api/client.js';
|
|
2
2
|
import type { Workflow } from '../types/index.js';
|
|
3
|
+
import type { EndpointConfig } from '../config/endpoints.js';
|
|
3
4
|
interface Props {
|
|
4
5
|
pipelineId: string;
|
|
5
6
|
workflow: Workflow;
|
|
6
7
|
apiClient?: FlowDropApiClient;
|
|
7
8
|
baseUrl?: string;
|
|
9
|
+
endpointConfig?: EndpointConfig;
|
|
8
10
|
onActionsReady?: (actions: Array<{
|
|
9
11
|
label: string;
|
|
10
12
|
href: string;
|
|
@@ -55,16 +55,6 @@
|
|
|
55
55
|
|
|
56
56
|
let props: Props = $props();
|
|
57
57
|
|
|
58
|
-
// Debug logging for props
|
|
59
|
-
$effect(() => {
|
|
60
|
-
console.log('🔧 WorkflowEditor: Props received:', {
|
|
61
|
-
hasOpenConfigSidebar: !!props.openConfigSidebar,
|
|
62
|
-
hasCloseConfigSidebar: !!props.closeConfigSidebar,
|
|
63
|
-
selectedNodeForConfig: props.selectedNodeForConfig?.id,
|
|
64
|
-
isConfigSidebarOpen: props.isConfigSidebarOpen
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
|
|
68
58
|
// Create a local currentWorkflow variable that we can control directly
|
|
69
59
|
let currentWorkflow = $state<Workflow | null>(null);
|
|
70
60
|
|
|
@@ -106,18 +96,6 @@
|
|
|
106
96
|
// Function to update the global store when currentWorkflow changes
|
|
107
97
|
function updateGlobalStore(): void {
|
|
108
98
|
if (currentWorkflow) {
|
|
109
|
-
console.log('🔍 WorkflowEditor: Updating global store from currentWorkflow:', {
|
|
110
|
-
nodeCount: currentWorkflow.nodes.length,
|
|
111
|
-
edgeCount: currentWorkflow.edges.length,
|
|
112
|
-
nodePositions: currentWorkflow.nodes.map((node) => ({
|
|
113
|
-
id: node.id,
|
|
114
|
-
position: node.position
|
|
115
|
-
})),
|
|
116
|
-
workflowName: currentWorkflow.name,
|
|
117
|
-
versionId: currentWorkflow.metadata?.versionId,
|
|
118
|
-
updateNumber: currentWorkflow.metadata?.updateNumber
|
|
119
|
-
});
|
|
120
|
-
|
|
121
99
|
workflowActions.updateWorkflow(currentWorkflow);
|
|
122
100
|
}
|
|
123
101
|
}
|
|
@@ -186,7 +164,6 @@
|
|
|
186
164
|
const edgesChanged = JSON.stringify(flowEdges) !== JSON.stringify(previousEdges);
|
|
187
165
|
|
|
188
166
|
if ((nodesChanged || edgesChanged) && currentWorkflow) {
|
|
189
|
-
console.log('🔍 WorkflowEditor: SvelteFlow changed nodes/edges, updating currentWorkflow');
|
|
190
167
|
updateCurrentWorkflowFromSvelteFlow();
|
|
191
168
|
|
|
192
169
|
// Update previous values
|
|
@@ -227,8 +204,6 @@
|
|
|
227
204
|
targetHandle?: string;
|
|
228
205
|
}): Promise<void> {
|
|
229
206
|
// SvelteFlow will automatically create the edge due to bind:edges
|
|
230
|
-
console.log('Connection created:', connection);
|
|
231
|
-
|
|
232
207
|
// Wait for DOM update before applying styling
|
|
233
208
|
await tick();
|
|
234
209
|
|
|
@@ -311,19 +286,15 @@
|
|
|
311
286
|
const newNode = NodeOperationsHelper.createNodeFromDrop(nodeTypeData, position);
|
|
312
287
|
|
|
313
288
|
if (newNode && currentWorkflow) {
|
|
314
|
-
console.log('🔧 WorkflowEditor: Adding new node to currentWorkflow:', newNode.id);
|
|
315
289
|
currentWorkflow = WorkflowOperationsHelper.addNode(currentWorkflow, newNode);
|
|
316
290
|
|
|
317
|
-
console.log(
|
|
318
|
-
'🔧 WorkflowEditor: Updated currentWorkflow with new node, calling updateGlobalStore'
|
|
319
|
-
);
|
|
320
291
|
// Update the global store
|
|
321
292
|
updateGlobalStore();
|
|
322
293
|
|
|
323
294
|
// Wait for DOM update to ensure SvelteFlow updates
|
|
324
295
|
await tick();
|
|
325
296
|
} else if (!currentWorkflow) {
|
|
326
|
-
console.warn('
|
|
297
|
+
console.warn('No currentWorkflow available for new node');
|
|
327
298
|
}
|
|
328
299
|
}
|
|
329
300
|
}}
|
|
@@ -57,7 +57,6 @@ export class EdgeStylingHelper {
|
|
|
57
57
|
const sourceNode = nodes.find((node) => node.id === edge.source);
|
|
58
58
|
const targetNode = nodes.find((node) => node.id === edge.target);
|
|
59
59
|
if (!sourceNode || !targetNode) {
|
|
60
|
-
console.warn('Could not find nodes for edge:', edge.id);
|
|
61
60
|
return edge;
|
|
62
61
|
}
|
|
63
62
|
// Create a copy of the edge and apply styling
|
|
@@ -258,7 +257,7 @@ export class WorkflowOperationsHelper {
|
|
|
258
257
|
*/
|
|
259
258
|
static async saveWorkflow(workflow) {
|
|
260
259
|
if (!workflow) {
|
|
261
|
-
console.warn('
|
|
260
|
+
console.warn('No workflow data available to save');
|
|
262
261
|
return null;
|
|
263
262
|
}
|
|
264
263
|
try {
|
|
@@ -283,21 +282,9 @@ export class WorkflowOperationsHelper {
|
|
|
283
282
|
updatedAt: new Date().toISOString()
|
|
284
283
|
}
|
|
285
284
|
};
|
|
286
|
-
console.log('💾 WorkflowEditor: Saving workflow to backend:');
|
|
287
|
-
console.log(' - ID:', workflowToSave.id);
|
|
288
|
-
console.log(' - Name:', workflowToSave.name);
|
|
289
|
-
console.log(' - Nodes count:', workflowToSave.nodes.length);
|
|
290
|
-
console.log(' - Edges count:', workflowToSave.edges.length);
|
|
291
|
-
console.log(' - Full workflow object:', JSON.stringify(workflowToSave, null, 2));
|
|
292
285
|
const savedWorkflow = await workflowApi.saveWorkflow(workflowToSave);
|
|
293
|
-
console.log('✅ WorkflowEditor: Received workflow from backend:');
|
|
294
|
-
console.log(' - ID:', savedWorkflow.id);
|
|
295
|
-
console.log(' - Name:', savedWorkflow.name);
|
|
296
|
-
console.log(' - Nodes count:', savedWorkflow.nodes?.length || 0);
|
|
297
|
-
console.log(' - Edges count:', savedWorkflow.edges?.length || 0);
|
|
298
286
|
// Update the workflow ID if it changed (new workflow)
|
|
299
287
|
if (savedWorkflow.id && savedWorkflow.id !== workflowToSave.id) {
|
|
300
|
-
console.log('🔄 Updating workflow ID from', workflowToSave.id, 'to', savedWorkflow.id);
|
|
301
288
|
workflowActions.batchUpdate({
|
|
302
289
|
nodes: workflowToSave.nodes,
|
|
303
290
|
edges: workflowToSave.edges,
|
|
@@ -320,7 +307,7 @@ export class WorkflowOperationsHelper {
|
|
|
320
307
|
*/
|
|
321
308
|
static exportWorkflow(workflow) {
|
|
322
309
|
if (!workflow) {
|
|
323
|
-
console.warn('
|
|
310
|
+
console.warn('No workflow data available to export');
|
|
324
311
|
return;
|
|
325
312
|
}
|
|
326
313
|
// Use the same ID logic as saveWorkflow
|
|
@@ -26,7 +26,6 @@ export class NodeExecutionService {
|
|
|
26
26
|
*/
|
|
27
27
|
async getNodeExecutionInfo(nodeId, pipelineId) {
|
|
28
28
|
if (!pipelineId) {
|
|
29
|
-
console.warn('Pipeline ID is required to fetch node execution info');
|
|
30
29
|
return null;
|
|
31
30
|
}
|
|
32
31
|
try {
|
|
@@ -72,12 +71,10 @@ export class NodeExecutionService {
|
|
|
72
71
|
*/
|
|
73
72
|
async getMultipleNodeExecutionInfo(nodeIds, pipelineId) {
|
|
74
73
|
if (!pipelineId) {
|
|
75
|
-
console.warn('Pipeline ID is required to fetch node execution info');
|
|
76
74
|
return {};
|
|
77
75
|
}
|
|
78
76
|
// Check if API is temporarily unavailable
|
|
79
77
|
if (this.apiUnavailable && Date.now() < this.apiUnavailableUntil) {
|
|
80
|
-
console.log('API temporarily unavailable, returning cached/default values');
|
|
81
78
|
const defaultExecutionInfo = {};
|
|
82
79
|
nodeIds.forEach((nodeId) => {
|
|
83
80
|
defaultExecutionInfo[nodeId] = {
|
|
@@ -11,27 +11,19 @@ import { FlowDropApiClient } from '../api/client.js';
|
|
|
11
11
|
export async function fetchPortConfig(endpointConfig) {
|
|
12
12
|
try {
|
|
13
13
|
const url = buildEndpointUrl(endpointConfig, endpointConfig.endpoints.portConfig);
|
|
14
|
-
console.log('📡 Fetching port configuration from:', url);
|
|
15
14
|
// Create API client instance
|
|
16
15
|
const client = new FlowDropApiClient(endpointConfig.baseUrl);
|
|
17
16
|
// Use the client to fetch port configuration
|
|
18
17
|
const portConfig = await client.getPortConfig();
|
|
19
18
|
// Validate the configuration has required fields
|
|
20
19
|
if (!portConfig.dataTypes || !Array.isArray(portConfig.dataTypes)) {
|
|
21
|
-
console.warn('
|
|
20
|
+
console.warn('Invalid port config received from API, using default');
|
|
22
21
|
return DEFAULT_PORT_CONFIG;
|
|
23
22
|
}
|
|
24
|
-
console.log('✅ Port configuration loaded successfully:', {
|
|
25
|
-
version: portConfig.version,
|
|
26
|
-
dataTypesCount: portConfig.dataTypes.length,
|
|
27
|
-
rulesCount: portConfig.compatibilityRules?.length || 0,
|
|
28
|
-
defaultType: portConfig.defaultDataType
|
|
29
|
-
});
|
|
30
23
|
return portConfig;
|
|
31
24
|
}
|
|
32
25
|
catch (error) {
|
|
33
|
-
console.error('
|
|
34
|
-
console.log('🔄 Falling back to default port configuration');
|
|
26
|
+
console.error('Error fetching port configuration:', error);
|
|
35
27
|
return DEFAULT_PORT_CONFIG;
|
|
36
28
|
}
|
|
37
29
|
}
|
|
@@ -52,15 +52,11 @@ function hasWorkflowDataChanged(currentWorkflow, newNodes, newEdges) {
|
|
|
52
52
|
export const workflowActions = {
|
|
53
53
|
// Initialize workflow
|
|
54
54
|
initialize: (workflow) => {
|
|
55
|
-
console.log('🔍 Debug: initialize called with:', workflow);
|
|
56
55
|
workflowStore.set(workflow);
|
|
57
|
-
console.log('🔍 Debug: workflow store initialized');
|
|
58
56
|
},
|
|
59
57
|
// Update the entire workflow
|
|
60
58
|
updateWorkflow: (workflow) => {
|
|
61
|
-
console.log('🔍 Debug: updateWorkflow called with:', workflow);
|
|
62
59
|
workflowStore.set(workflow);
|
|
63
|
-
console.log('🔍 Debug: workflow store updated');
|
|
64
60
|
},
|
|
65
61
|
// Update nodes
|
|
66
62
|
updateNodes: (nodes) => {
|
|
@@ -69,16 +65,10 @@ export const workflowActions = {
|
|
|
69
65
|
return null;
|
|
70
66
|
// Check if nodes have actually changed to prevent infinite loops
|
|
71
67
|
if (!hasWorkflowDataChanged($workflow, nodes, $workflow.edges)) {
|
|
72
|
-
console.log('🔍 Debug: Nodes unchanged, skipping update to prevent infinite loop');
|
|
73
68
|
return $workflow;
|
|
74
69
|
}
|
|
75
70
|
// Generate unique version identifier
|
|
76
71
|
const versionId = `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
77
|
-
console.log('🔍 Debug: Updating nodes with versionId:', versionId);
|
|
78
|
-
console.log('🔍 Debug: Node position changes detected:', nodes.map((node) => ({
|
|
79
|
-
id: node.id,
|
|
80
|
-
position: node.position
|
|
81
|
-
})));
|
|
82
72
|
return {
|
|
83
73
|
...$workflow,
|
|
84
74
|
nodes,
|
|
@@ -98,12 +88,10 @@ export const workflowActions = {
|
|
|
98
88
|
return null;
|
|
99
89
|
// Check if edges have actually changed to prevent infinite loops
|
|
100
90
|
if (!hasWorkflowDataChanged($workflow, $workflow.nodes, edges)) {
|
|
101
|
-
console.log('🔍 Debug: Edges unchanged, skipping update to prevent infinite loop');
|
|
102
91
|
return $workflow;
|
|
103
92
|
}
|
|
104
93
|
// Generate unique version identifier
|
|
105
94
|
const versionId = `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
106
|
-
console.log('🔍 Debug: Updating edges with versionId:', versionId);
|
|
107
95
|
return {
|
|
108
96
|
...$workflow,
|
|
109
97
|
edges,
|
package/dist/svelte-app.js
CHANGED
|
@@ -159,13 +159,6 @@ export function validateConnection(sourceNodeId, sourcePortId, targetNodeId, tar
|
|
|
159
159
|
const sourceMetadata = nodeTypes.find((nt) => nt.id === sourceNode.data.metadata.id);
|
|
160
160
|
const targetMetadata = nodeTypes.find((nt) => nt.id === targetNode.data.metadata.id);
|
|
161
161
|
if (!sourceMetadata || !targetMetadata) {
|
|
162
|
-
console.log('Metadata lookup failed:', {
|
|
163
|
-
sourceNodeId,
|
|
164
|
-
targetNodeId,
|
|
165
|
-
sourceMetadataId: sourceNode.data.metadata.id,
|
|
166
|
-
targetMetadataId: targetNode.data.metadata.id,
|
|
167
|
-
availableNodeTypes: nodeTypes.map((nt) => nt.id)
|
|
168
|
-
});
|
|
169
162
|
return { valid: false, error: 'Node metadata not found' };
|
|
170
163
|
}
|
|
171
164
|
// Find ports
|