@d34dman/flowdrop 0.0.6 → 0.0.8
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/api/client.js
CHANGED
|
@@ -42,7 +42,7 @@ export class FlowDropApiClient {
|
|
|
42
42
|
* Fetch available node types and their metadata
|
|
43
43
|
*/
|
|
44
44
|
async getAvailableNodes() {
|
|
45
|
-
const response = await this.request('/
|
|
45
|
+
const response = await this.request('/nodes');
|
|
46
46
|
if (!response.success || !response.data) {
|
|
47
47
|
throw new Error(response.error || 'Failed to fetch available nodes');
|
|
48
48
|
}
|
|
@@ -52,7 +52,7 @@ export class FlowDropApiClient {
|
|
|
52
52
|
* Fetch nodes by category
|
|
53
53
|
*/
|
|
54
54
|
async getNodesByCategory(category) {
|
|
55
|
-
const response = await this.request(`/
|
|
55
|
+
const response = await this.request(`/nodes?category=${encodeURIComponent(category)}`);
|
|
56
56
|
if (!response.success || !response.data) {
|
|
57
57
|
throw new Error(response.error || 'Failed to fetch nodes by category');
|
|
58
58
|
}
|
|
@@ -62,7 +62,7 @@ export class FlowDropApiClient {
|
|
|
62
62
|
* Fetch a specific node's metadata
|
|
63
63
|
*/
|
|
64
64
|
async getNodeMetadata(nodeId) {
|
|
65
|
-
const response = await this.request(`/
|
|
65
|
+
const response = await this.request(`/nodes/${encodeURIComponent(nodeId)}`);
|
|
66
66
|
if (!response.success || !response.data) {
|
|
67
67
|
throw new Error(response.error || 'Failed to fetch node metadata');
|
|
68
68
|
}
|
|
@@ -72,7 +72,7 @@ export class FlowDropApiClient {
|
|
|
72
72
|
* Save a workflow
|
|
73
73
|
*/
|
|
74
74
|
async saveWorkflow(workflow) {
|
|
75
|
-
const response = await this.request('/
|
|
75
|
+
const response = await this.request('/workflows', {
|
|
76
76
|
method: 'POST',
|
|
77
77
|
body: JSON.stringify(workflow)
|
|
78
78
|
});
|
|
@@ -85,7 +85,7 @@ export class FlowDropApiClient {
|
|
|
85
85
|
* Update an existing workflow
|
|
86
86
|
*/
|
|
87
87
|
async updateWorkflow(workflowId, workflow) {
|
|
88
|
-
const response = await this.request(`/
|
|
88
|
+
const response = await this.request(`/workflows/${encodeURIComponent(workflowId)}`, {
|
|
89
89
|
method: 'PUT',
|
|
90
90
|
body: JSON.stringify(workflow)
|
|
91
91
|
});
|
|
@@ -98,7 +98,7 @@ export class FlowDropApiClient {
|
|
|
98
98
|
* Load a workflow by ID
|
|
99
99
|
*/
|
|
100
100
|
async loadWorkflow(workflowId) {
|
|
101
|
-
const response = await this.request(`/
|
|
101
|
+
const response = await this.request(`/workflows/${encodeURIComponent(workflowId)}`);
|
|
102
102
|
if (!response.success || !response.data) {
|
|
103
103
|
throw new Error(response.error || 'Failed to load workflow');
|
|
104
104
|
}
|
|
@@ -108,7 +108,7 @@ export class FlowDropApiClient {
|
|
|
108
108
|
* List all workflows
|
|
109
109
|
*/
|
|
110
110
|
async listWorkflows() {
|
|
111
|
-
const response = await this.request('/
|
|
111
|
+
const response = await this.request('/workflows');
|
|
112
112
|
if (!response.success || !response.data) {
|
|
113
113
|
throw new Error(response.error || 'Failed to list workflows');
|
|
114
114
|
}
|
|
@@ -118,7 +118,7 @@ export class FlowDropApiClient {
|
|
|
118
118
|
* Delete a workflow
|
|
119
119
|
*/
|
|
120
120
|
async deleteWorkflow(workflowId) {
|
|
121
|
-
const response = await this.request(`/
|
|
121
|
+
const response = await this.request(`/workflows/${encodeURIComponent(workflowId)}`, {
|
|
122
122
|
method: 'DELETE'
|
|
123
123
|
});
|
|
124
124
|
if (!response.success) {
|
|
@@ -129,7 +129,7 @@ export class FlowDropApiClient {
|
|
|
129
129
|
* Execute a workflow
|
|
130
130
|
*/
|
|
131
131
|
async executeWorkflow(workflowId, inputs) {
|
|
132
|
-
const response = await this.request(`/
|
|
132
|
+
const response = await this.request(`/workflows/${encodeURIComponent(workflowId)}/execute`, {
|
|
133
133
|
method: 'POST',
|
|
134
134
|
body: JSON.stringify({ inputs })
|
|
135
135
|
});
|
|
@@ -142,7 +142,7 @@ export class FlowDropApiClient {
|
|
|
142
142
|
* Get execution status
|
|
143
143
|
*/
|
|
144
144
|
async getExecutionStatus(executionId) {
|
|
145
|
-
const response = await this.request(`/
|
|
145
|
+
const response = await this.request(`/executions/${encodeURIComponent(executionId)}`);
|
|
146
146
|
if (!response.success || !response.data) {
|
|
147
147
|
throw new Error(response.error || 'Failed to get execution status');
|
|
148
148
|
}
|
|
@@ -152,7 +152,7 @@ export class FlowDropApiClient {
|
|
|
152
152
|
* Cancel workflow execution
|
|
153
153
|
*/
|
|
154
154
|
async cancelExecution(executionId) {
|
|
155
|
-
const response = await this.request(`/
|
|
155
|
+
const response = await this.request(`/executions/${encodeURIComponent(executionId)}/cancel`, {
|
|
156
156
|
method: 'POST'
|
|
157
157
|
});
|
|
158
158
|
if (!response.success) {
|
|
@@ -163,7 +163,7 @@ export class FlowDropApiClient {
|
|
|
163
163
|
* Get execution logs
|
|
164
164
|
*/
|
|
165
165
|
async getExecutionLogs(executionId) {
|
|
166
|
-
const response = await this.request(`/
|
|
166
|
+
const response = await this.request(`/executions/${encodeURIComponent(executionId)}/logs`);
|
|
167
167
|
if (!response.success || !response.data) {
|
|
168
168
|
throw new Error(response.error || 'Failed to get execution logs');
|
|
169
169
|
}
|
|
@@ -173,7 +173,7 @@ export class FlowDropApiClient {
|
|
|
173
173
|
* Validate workflow configuration
|
|
174
174
|
*/
|
|
175
175
|
async validateWorkflow(workflow) {
|
|
176
|
-
const response = await this.request('/
|
|
176
|
+
const response = await this.request('/workflows/validate', {
|
|
177
177
|
method: 'POST',
|
|
178
178
|
body: JSON.stringify(workflow)
|
|
179
179
|
});
|
|
@@ -186,7 +186,7 @@ export class FlowDropApiClient {
|
|
|
186
186
|
* Export workflow as JSON
|
|
187
187
|
*/
|
|
188
188
|
async exportWorkflow(workflowId) {
|
|
189
|
-
const response = await this.request(`/
|
|
189
|
+
const response = await this.request(`/workflows/${encodeURIComponent(workflowId)}/export`);
|
|
190
190
|
if (!response.success || !response.data) {
|
|
191
191
|
throw new Error(response.error || 'Failed to export workflow');
|
|
192
192
|
}
|
|
@@ -196,7 +196,7 @@ export class FlowDropApiClient {
|
|
|
196
196
|
* Import workflow from JSON
|
|
197
197
|
*/
|
|
198
198
|
async importWorkflow(workflowJson) {
|
|
199
|
-
const response = await this.request('/
|
|
199
|
+
const response = await this.request('/workflows/import', {
|
|
200
200
|
method: 'POST',
|
|
201
201
|
body: JSON.stringify({ workflow: workflowJson })
|
|
202
202
|
});
|
|
@@ -209,7 +209,7 @@ export class FlowDropApiClient {
|
|
|
209
209
|
* Fetch port configuration
|
|
210
210
|
*/
|
|
211
211
|
async getPortConfig() {
|
|
212
|
-
const response = await this.request('/
|
|
212
|
+
const response = await this.request('/port-config');
|
|
213
213
|
if (!response.success || !response.data) {
|
|
214
214
|
throw new Error(response.error || 'Failed to fetch port configuration');
|
|
215
215
|
}
|
|
@@ -219,7 +219,7 @@ export class FlowDropApiClient {
|
|
|
219
219
|
* Fetch pipeline data including job information and status
|
|
220
220
|
*/
|
|
221
221
|
async getPipelineData(pipelineId) {
|
|
222
|
-
const response = await this.request(`/
|
|
222
|
+
const response = await this.request(`/pipeline/${encodeURIComponent(pipelineId)}`);
|
|
223
223
|
return response;
|
|
224
224
|
}
|
|
225
225
|
}
|
|
@@ -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
|
|
@@ -164,27 +166,35 @@
|
|
|
164
166
|
*/
|
|
165
167
|
async function testApiConnection(): Promise<void> {
|
|
166
168
|
try {
|
|
167
|
-
const
|
|
169
|
+
const baseUrl = endpointConfig?.baseUrl || apiBaseUrl || "/api/flowdrop";
|
|
170
|
+
const testUrl = `${baseUrl}/nodes`;
|
|
168
171
|
|
|
169
172
|
const response = await fetch(testUrl);
|
|
170
173
|
const data = await response.json();
|
|
171
174
|
|
|
172
175
|
if (response.ok && data.success) {
|
|
173
|
-
apiToasts.success(
|
|
176
|
+
apiToasts.success("API connection test", "Connection successful");
|
|
174
177
|
} else {
|
|
175
|
-
apiToasts.error(
|
|
178
|
+
apiToasts.error("API connection test", "Connection failed");
|
|
176
179
|
}
|
|
177
180
|
} catch (err) {
|
|
178
|
-
apiToasts.error(
|
|
181
|
+
apiToasts.error("API connection test", err instanceof Error ? err.message : "Unknown error");
|
|
179
182
|
}
|
|
180
183
|
}
|
|
181
184
|
|
|
182
185
|
/**
|
|
183
186
|
* Initialize API endpoints
|
|
184
|
-
*
|
|
187
|
+
* Priority: propEndpointConfig > existingConfig > apiBaseUrl > default
|
|
185
188
|
*/
|
|
186
189
|
async function initializeApiEndpoints(): Promise<void> {
|
|
187
|
-
//
|
|
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)
|
|
188
198
|
const { getEndpointConfig } = await import('../services/api.js');
|
|
189
199
|
const existingConfig = getEndpointConfig();
|
|
190
200
|
|
|
@@ -194,7 +204,7 @@
|
|
|
194
204
|
return;
|
|
195
205
|
}
|
|
196
206
|
|
|
197
|
-
// Use provided apiBaseUrl or default
|
|
207
|
+
// Third priority: Use provided apiBaseUrl or default
|
|
198
208
|
const baseUrl = apiBaseUrl || '/api/flowdrop';
|
|
199
209
|
|
|
200
210
|
const config = createEndpointConfig(baseUrl, {
|
|
@@ -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 ||
|
|
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;
|
package/dist/svelte-app.js
CHANGED
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.8",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite dev",
|
|
8
8
|
"build": "vite build && npm run prepack",
|
|
@@ -83,6 +83,10 @@
|
|
|
83
83
|
"@sveltejs/kit": "^2.0.0",
|
|
84
84
|
"svelte": "^5.0.0"
|
|
85
85
|
},
|
|
86
|
+
"repository": {
|
|
87
|
+
"type": "git",
|
|
88
|
+
"url": "git+https://github.com/d34dman/flowdrop.git"
|
|
89
|
+
},
|
|
86
90
|
"devDependencies": {
|
|
87
91
|
"@chromatic-com/storybook": "^4.0.1",
|
|
88
92
|
"@eslint/compat": "^1.2.5",
|