@d34dman/flowdrop 0.0.18 → 0.0.19
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 +0 -55
- package/dist/api/enhanced-client.d.ts +2 -2
- package/dist/api/enhanced-client.js +5 -5
- package/dist/components/NotesNode.svelte +3 -3
- package/dist/components/NotesNode.svelte.d.ts +3 -3
- package/dist/components/SimpleNode.svelte +3 -3
- package/dist/components/SimpleNode.svelte.d.ts +3 -3
- package/dist/components/SquareNode.svelte +3 -3
- package/dist/components/SquareNode.svelte.d.ts +3 -3
- package/dist/components/TerminalNode.svelte +84 -66
- package/dist/components/TerminalNode.svelte.d.ts +3 -3
- package/dist/components/UniversalNode.svelte +7 -33
- package/dist/components/WorkflowEditor.svelte +1 -9
- package/dist/helpers/workflowEditorHelper.d.ts +3 -3
- package/dist/helpers/workflowEditorHelper.js +5 -7
- package/dist/index.d.ts +4 -7
- package/dist/index.js +2 -5
- package/dist/registry/builtinNodes.d.ts +2 -2
- package/dist/registry/builtinNodes.js +2 -2
- package/dist/services/api.d.ts +0 -5
- package/dist/services/api.js +0 -20
- package/dist/svelte-app.d.ts +0 -6
- package/dist/svelte-app.js +0 -8
- package/dist/types/auth.d.ts +0 -15
- package/dist/types/auth.js +0 -15
- package/dist/types/config.d.ts +11 -151
- package/dist/types/config.js +3 -0
- package/dist/types/index.d.ts +0 -6
- package/dist/utils/colors.d.ts +0 -5
- package/dist/utils/colors.js +3 -4
- package/dist/utils/config.d.ts +0 -8
- package/dist/utils/config.js +0 -14
- package/dist/utils/connections.d.ts +0 -5
- package/dist/utils/connections.js +10 -16
- package/dist/utils/icons.js +1 -1
- package/dist/utils/nodeTypes.d.ts +1 -1
- package/dist/utils/nodeTypes.js +3 -20
- package/package.json +144 -138
- package/dist/clients/ApiClient.d.ts +0 -199
- package/dist/clients/ApiClient.js +0 -214
- package/dist/config/apiConfig.d.ts +0 -34
- package/dist/config/apiConfig.js +0 -40
- package/dist/examples/adapter-usage.d.ts +0 -66
- package/dist/examples/adapter-usage.js +0 -133
- package/dist/examples/api-client-usage.d.ts +0 -32
- package/dist/examples/api-client-usage.js +0 -243
|
@@ -244,16 +244,8 @@
|
|
|
244
244
|
|
|
245
245
|
// Node types for Svelte Flow - using UniversalNode for all node types
|
|
246
246
|
// All nodes use 'universalNode' type, and UniversalNode handles internal switching
|
|
247
|
-
// Include legacy types for backward compatibility with existing workflows
|
|
248
247
|
const nodeTypes = {
|
|
249
|
-
universalNode: UniversalNode
|
|
250
|
-
// Legacy types for backward compatibility
|
|
251
|
-
workflowNode: UniversalNode,
|
|
252
|
-
note: UniversalNode,
|
|
253
|
-
simple: UniversalNode,
|
|
254
|
-
square: UniversalNode,
|
|
255
|
-
tool: UniversalNode,
|
|
256
|
-
gateway: UniversalNode
|
|
248
|
+
universalNode: UniversalNode
|
|
257
249
|
};
|
|
258
250
|
|
|
259
251
|
// Handle arrows in our custom connection handler
|
|
@@ -24,10 +24,10 @@ export declare class EdgeStylingHelper {
|
|
|
24
24
|
/**
|
|
25
25
|
* Extract the port ID from a handle ID
|
|
26
26
|
* Supports two formats:
|
|
27
|
-
* 1.
|
|
28
|
-
* 2.
|
|
27
|
+
* 1. Standard format: "${nodeId}-output-${portId}" or "${nodeId}-input-${portId}"
|
|
28
|
+
* 2. Short format: just the portId (e.g., "text", "trigger")
|
|
29
29
|
* @param handleId - The handle ID string (e.g., "sample-node.1-output-trigger" or "trigger")
|
|
30
|
-
* @returns The port ID (e.g., "trigger") or the handleId itself for
|
|
30
|
+
* @returns The port ID (e.g., "trigger") or the handleId itself for short format
|
|
31
31
|
*/
|
|
32
32
|
static extractPortIdFromHandle(handleId: string | undefined): string | null;
|
|
33
33
|
/**
|
|
@@ -36,16 +36,16 @@ export class EdgeStylingHelper {
|
|
|
36
36
|
/**
|
|
37
37
|
* Extract the port ID from a handle ID
|
|
38
38
|
* Supports two formats:
|
|
39
|
-
* 1.
|
|
40
|
-
* 2.
|
|
39
|
+
* 1. Standard format: "${nodeId}-output-${portId}" or "${nodeId}-input-${portId}"
|
|
40
|
+
* 2. Short format: just the portId (e.g., "text", "trigger")
|
|
41
41
|
* @param handleId - The handle ID string (e.g., "sample-node.1-output-trigger" or "trigger")
|
|
42
|
-
* @returns The port ID (e.g., "trigger") or the handleId itself for
|
|
42
|
+
* @returns The port ID (e.g., "trigger") or the handleId itself for short format
|
|
43
43
|
*/
|
|
44
44
|
static extractPortIdFromHandle(handleId) {
|
|
45
45
|
if (!handleId) {
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
48
|
-
// Try
|
|
48
|
+
// Try standard format: "${nodeId}-output-${portId}" or "${nodeId}-input-${portId}"
|
|
49
49
|
// We need to find the last occurrence of "-output-" or "-input-" and get what follows
|
|
50
50
|
const outputMatch = handleId.lastIndexOf('-output-');
|
|
51
51
|
const inputMatch = handleId.lastIndexOf('-input-');
|
|
@@ -55,7 +55,7 @@ export class EdgeStylingHelper {
|
|
|
55
55
|
if (inputMatch !== -1) {
|
|
56
56
|
return handleId.substring(inputMatch + '-input-'.length);
|
|
57
57
|
}
|
|
58
|
-
//
|
|
58
|
+
// Short format: the handleId IS the port ID
|
|
59
59
|
return handleId;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
@@ -185,8 +185,6 @@ export class EdgeStylingHelper {
|
|
|
185
185
|
edgeType: edgeCategory,
|
|
186
186
|
sourcePortDataType: sourcePortDataType || undefined
|
|
187
187
|
},
|
|
188
|
-
// Keep legacy fields for backward compatibility
|
|
189
|
-
isToolConnection: edgeCategory === 'tool',
|
|
190
188
|
targetNodeType: targetNode.type,
|
|
191
189
|
targetCategory: targetNode.data.metadata.category
|
|
192
190
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import './styles/base.css';
|
|
6
6
|
import './registry/builtinNodes.js';
|
|
7
|
-
export type { NodeCategory, NodeDataType, NodePort, NodeMetadata,
|
|
8
|
-
export type { WorkflowEditorConfig, EditorFeatures, UIConfig, APIConfig, ExecutionConfig, StorageConfig
|
|
7
|
+
export type { NodeCategory, NodeDataType, NodePort, NodeMetadata, ConfigValues, WorkflowNode, WorkflowEdge, Workflow, ApiResponse, NodesResponse, WorkflowResponse, WorkflowsResponse, ExecutionStatus, ExecutionResult, FlowDropConfig, WorkflowEvents, BuiltinNodeType } from './types/index.js';
|
|
8
|
+
export type { WorkflowEditorConfig, EditorFeatures, UIConfig, APIConfig, ExecutionConfig, StorageConfig } from './types/config.js';
|
|
9
9
|
export type { AuthProvider, StaticAuthConfig, CallbackAuthConfig } from './types/auth.js';
|
|
10
|
-
export { StaticAuthProvider, CallbackAuthProvider, NoAuthProvider
|
|
10
|
+
export { StaticAuthProvider, CallbackAuthProvider, NoAuthProvider } from './types/auth.js';
|
|
11
11
|
export type { WorkflowChangeType, FlowDropEventHandlers, FlowDropFeatures } from './types/events.js';
|
|
12
12
|
export { DEFAULT_FEATURES, mergeFeatures } from './types/events.js';
|
|
13
13
|
export { FlowDropApiClient } from './api/client.js';
|
|
@@ -57,12 +57,9 @@ export { getDraftStorageKey, saveDraft, loadDraft, deleteDraft, hasDraft, getDra
|
|
|
57
57
|
export { EdgeStylingHelper, NodeOperationsHelper, WorkflowOperationsHelper, ConfigurationHelper } from './helpers/workflowEditorHelper.js';
|
|
58
58
|
export { workflowStore, workflowActions, workflowId, workflowName, workflowNodes, workflowEdges, workflowMetadata, workflowChanged, workflowValidation, workflowMetadataChanged, isDirtyStore, isDirty, markAsSaved, getWorkflow as getWorkflowFromStore, setOnDirtyStateChange, setOnWorkflowChange } from './stores/workflowStore.js';
|
|
59
59
|
export * from './config/endpoints.js';
|
|
60
|
-
export { defaultApiConfig, getEndpointUrl } from './config/apiConfig.js';
|
|
61
|
-
export type { ApiConfig } from './config/apiConfig.js';
|
|
62
60
|
export { DEFAULT_PORT_CONFIG } from './config/defaultPortConfig.js';
|
|
63
61
|
export * from './config/runtimeConfig.js';
|
|
64
62
|
export * from './adapters/WorkflowAdapter.js';
|
|
65
|
-
export
|
|
66
|
-
export { mountWorkflowEditor, unmountWorkflowEditor, mountFlowDropApp, unmountFlowDropApp } from './svelte-app.js';
|
|
63
|
+
export { mountWorkflowEditor, mountFlowDropApp, unmountFlowDropApp } from './svelte-app.js';
|
|
67
64
|
export type { FlowDropMountOptions, MountedFlowDropApp, NavbarAction } from './svelte-app.js';
|
|
68
65
|
export { ApiError } from './api/enhanced-client.js';
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import './styles/base.css';
|
|
|
7
7
|
// Initialize built-in node components in the registry
|
|
8
8
|
// This import has a side effect of registering all built-in nodes
|
|
9
9
|
import './registry/builtinNodes.js';
|
|
10
|
-
export { StaticAuthProvider, CallbackAuthProvider, NoAuthProvider
|
|
10
|
+
export { StaticAuthProvider, CallbackAuthProvider, NoAuthProvider } from './types/auth.js';
|
|
11
11
|
export { DEFAULT_FEATURES, mergeFeatures } from './types/events.js';
|
|
12
12
|
// Export API clients
|
|
13
13
|
export { FlowDropApiClient } from './api/client.js';
|
|
@@ -71,14 +71,11 @@ export { workflowStore, workflowActions, workflowId, workflowName, workflowNodes
|
|
|
71
71
|
isDirtyStore, isDirty, markAsSaved, getWorkflow as getWorkflowFromStore, setOnDirtyStateChange, setOnWorkflowChange } from './stores/workflowStore.js';
|
|
72
72
|
// Export endpoint configuration
|
|
73
73
|
export * from './config/endpoints.js';
|
|
74
|
-
export { defaultApiConfig, getEndpointUrl } from './config/apiConfig.js';
|
|
75
74
|
export { DEFAULT_PORT_CONFIG } from './config/defaultPortConfig.js';
|
|
76
75
|
export * from './config/runtimeConfig.js';
|
|
77
76
|
// Export adapters
|
|
78
77
|
export * from './adapters/WorkflowAdapter.js';
|
|
79
|
-
// Export API client
|
|
80
|
-
export * from './clients/ApiClient.js';
|
|
81
78
|
// Export Svelte app wrapper for framework integration
|
|
82
|
-
export { mountWorkflowEditor,
|
|
79
|
+
export { mountWorkflowEditor, mountFlowDropApp, unmountFlowDropApp } from './svelte-app.js';
|
|
83
80
|
// Export API error class
|
|
84
81
|
export { ApiError } from './api/enhanced-client.js';
|
|
@@ -16,8 +16,8 @@ export declare const FLOWDROP_SOURCE = "flowdrop";
|
|
|
16
16
|
*/
|
|
17
17
|
export declare const BUILTIN_NODE_COMPONENTS: NodeComponentRegistration[];
|
|
18
18
|
/**
|
|
19
|
-
* Alias mapping for
|
|
20
|
-
* Maps
|
|
19
|
+
* Alias mapping for type resolution.
|
|
20
|
+
* Maps alternative type names to their canonical registration.
|
|
21
21
|
*/
|
|
22
22
|
export declare const BUILTIN_TYPE_ALIASES: Record<string, string>;
|
|
23
23
|
/**
|
|
@@ -101,8 +101,8 @@ export const BUILTIN_NODE_COMPONENTS = [
|
|
|
101
101
|
}
|
|
102
102
|
];
|
|
103
103
|
/**
|
|
104
|
-
* Alias mapping for
|
|
105
|
-
* Maps
|
|
104
|
+
* Alias mapping for type resolution.
|
|
105
|
+
* Maps alternative type names to their canonical registration.
|
|
106
106
|
*/
|
|
107
107
|
export const BUILTIN_TYPE_ALIASES = {
|
|
108
108
|
default: 'workflowNode'
|
package/dist/services/api.d.ts
CHANGED
|
@@ -12,11 +12,6 @@ export declare function setEndpointConfig(config: EndpointConfig): void;
|
|
|
12
12
|
* Get the current endpoint configuration
|
|
13
13
|
*/
|
|
14
14
|
export declare function getEndpointConfig(): EndpointConfig | null;
|
|
15
|
-
/**
|
|
16
|
-
* Set the API base URL (deprecated - use setEndpointConfig instead)
|
|
17
|
-
* @deprecated Use setEndpointConfig() with a full EndpointConfig object instead
|
|
18
|
-
*/
|
|
19
|
-
export declare function setApiBaseUrl(url: string): void;
|
|
20
15
|
/**
|
|
21
16
|
* Node API methods
|
|
22
17
|
*/
|
package/dist/services/api.js
CHANGED
|
@@ -16,26 +16,6 @@ export function setEndpointConfig(config) {
|
|
|
16
16
|
export function getEndpointConfig() {
|
|
17
17
|
return endpointConfig;
|
|
18
18
|
}
|
|
19
|
-
/**
|
|
20
|
-
* Set the API base URL (deprecated - use setEndpointConfig instead)
|
|
21
|
-
* @deprecated Use setEndpointConfig() with a full EndpointConfig object instead
|
|
22
|
-
*/
|
|
23
|
-
export function setApiBaseUrl(url) {
|
|
24
|
-
console.warn('⚠️ setApiBaseUrl() is deprecated. Use setEndpointConfig() with a full EndpointConfig object instead.');
|
|
25
|
-
if (!endpointConfig) {
|
|
26
|
-
// Dynamic import for backward compatibility
|
|
27
|
-
import('../config/endpoints.js')
|
|
28
|
-
.then(({ createEndpointConfig }) => {
|
|
29
|
-
endpointConfig = createEndpointConfig(url);
|
|
30
|
-
})
|
|
31
|
-
.catch(() => {
|
|
32
|
-
// Failed to load endpoint config
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
endpointConfig.baseUrl = url.replace(/\/$/, '');
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
19
|
/**
|
|
40
20
|
* Generic API request helper with endpoint configuration
|
|
41
21
|
*/
|
package/dist/svelte-app.d.ts
CHANGED
|
@@ -142,9 +142,3 @@ export declare function mountWorkflowEditor(container: HTMLElement, options?: {
|
|
|
142
142
|
* @param app - The mounted app to unmount
|
|
143
143
|
*/
|
|
144
144
|
export declare function unmountFlowDropApp(app: MountedFlowDropApp): void;
|
|
145
|
-
/**
|
|
146
|
-
* Unmount a FlowDrop app (alias for backward compatibility)
|
|
147
|
-
*
|
|
148
|
-
* @param app - The mounted app to unmount
|
|
149
|
-
*/
|
|
150
|
-
export declare function unmountWorkflowEditor(app: MountedFlowDropApp): void;
|
package/dist/svelte-app.js
CHANGED
|
@@ -269,11 +269,3 @@ export function unmountFlowDropApp(app) {
|
|
|
269
269
|
app.destroy();
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
|
-
/**
|
|
273
|
-
* Unmount a FlowDrop app (alias for backward compatibility)
|
|
274
|
-
*
|
|
275
|
-
* @param app - The mounted app to unmount
|
|
276
|
-
*/
|
|
277
|
-
export function unmountWorkflowEditor(app) {
|
|
278
|
-
unmountFlowDropApp(app);
|
|
279
|
-
}
|
package/dist/types/auth.d.ts
CHANGED
|
@@ -261,18 +261,3 @@ export declare class NoAuthProvider implements AuthProvider {
|
|
|
261
261
|
*/
|
|
262
262
|
isAuthenticated(): boolean;
|
|
263
263
|
}
|
|
264
|
-
/**
|
|
265
|
-
* Create an AuthProvider from legacy endpointConfig.auth configuration
|
|
266
|
-
*
|
|
267
|
-
* Used internally for backward compatibility with existing code that uses
|
|
268
|
-
* the old auth configuration format in EndpointConfig.
|
|
269
|
-
*
|
|
270
|
-
* @param authConfig - Legacy auth configuration from EndpointConfig
|
|
271
|
-
* @returns AuthProvider instance
|
|
272
|
-
*/
|
|
273
|
-
export declare function createAuthProviderFromLegacyConfig(authConfig?: {
|
|
274
|
-
type: 'none' | 'bearer' | 'api_key' | 'custom';
|
|
275
|
-
token?: string;
|
|
276
|
-
apiKey?: string;
|
|
277
|
-
headers?: Record<string, string>;
|
|
278
|
-
}): AuthProvider;
|
package/dist/types/auth.js
CHANGED
|
@@ -227,18 +227,3 @@ export class NoAuthProvider {
|
|
|
227
227
|
return false;
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
-
/**
|
|
231
|
-
* Create an AuthProvider from legacy endpointConfig.auth configuration
|
|
232
|
-
*
|
|
233
|
-
* Used internally for backward compatibility with existing code that uses
|
|
234
|
-
* the old auth configuration format in EndpointConfig.
|
|
235
|
-
*
|
|
236
|
-
* @param authConfig - Legacy auth configuration from EndpointConfig
|
|
237
|
-
* @returns AuthProvider instance
|
|
238
|
-
*/
|
|
239
|
-
export function createAuthProviderFromLegacyConfig(authConfig) {
|
|
240
|
-
if (!authConfig || authConfig.type === 'none') {
|
|
241
|
-
return new NoAuthProvider();
|
|
242
|
-
}
|
|
243
|
-
return new StaticAuthProvider(authConfig);
|
|
244
|
-
}
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* FlowDrop Editor Configuration Types
|
|
3
|
+
*
|
|
4
|
+
* This module contains configuration-specific types for the workflow editor.
|
|
5
|
+
* For core workflow types (WorkflowNode, WorkflowEdge, etc.), see ./index.ts
|
|
3
6
|
*/
|
|
4
7
|
import type { EndpointConfig } from '../config/endpoints.js';
|
|
5
|
-
import type { PortConfig } from './index.js';
|
|
8
|
+
import type { PortConfig, NodeMetadata } from './index.js';
|
|
9
|
+
/**
|
|
10
|
+
* Re-export core types from index.ts for convenience
|
|
11
|
+
* This allows consumers to import from either location
|
|
12
|
+
*/
|
|
13
|
+
export type { WorkflowNode, WorkflowEdge, NodePort, ExecutionResult, NodeMetadata } from './index.js';
|
|
6
14
|
export interface WorkflowEditorConfig {
|
|
7
15
|
/** API configuration with endpoints */
|
|
8
16
|
api: APIConfig;
|
|
9
|
-
/** Available node types loaded from API */
|
|
10
|
-
nodeTypes?:
|
|
17
|
+
/** Available node types loaded from API (uses NodeMetadata from index.ts) */
|
|
18
|
+
nodeTypes?: NodeMetadata[];
|
|
11
19
|
/** Port configuration system */
|
|
12
20
|
ports: PortConfig;
|
|
13
21
|
/** Theme configuration */
|
|
@@ -141,151 +149,3 @@ export interface StorageConfig {
|
|
|
141
149
|
delete: (key: string) => Promise<void>;
|
|
142
150
|
};
|
|
143
151
|
}
|
|
144
|
-
export interface NodeType {
|
|
145
|
-
/** Unique node type identifier */
|
|
146
|
-
id: string;
|
|
147
|
-
/** Display name */
|
|
148
|
-
name: string;
|
|
149
|
-
/** Description */
|
|
150
|
-
description: string;
|
|
151
|
-
/** Category */
|
|
152
|
-
category: string;
|
|
153
|
-
/** Icon (can be icon name or URL) */
|
|
154
|
-
icon?: string;
|
|
155
|
-
/** Node color */
|
|
156
|
-
color?: string;
|
|
157
|
-
/** Input ports */
|
|
158
|
-
inputs: NodePort[];
|
|
159
|
-
/** Output ports */
|
|
160
|
-
outputs: NodePort[];
|
|
161
|
-
/** Configuration schema */
|
|
162
|
-
configSchema?: Record<string, unknown>;
|
|
163
|
-
/** Tags for search and filtering */
|
|
164
|
-
tags?: string[];
|
|
165
|
-
/** Whether node is enabled */
|
|
166
|
-
enabled?: boolean;
|
|
167
|
-
/** Custom component to render */
|
|
168
|
-
component?: string;
|
|
169
|
-
}
|
|
170
|
-
export interface NodePort {
|
|
171
|
-
/** Port identifier */
|
|
172
|
-
id: string;
|
|
173
|
-
/** Display name */
|
|
174
|
-
name: string;
|
|
175
|
-
/** Port type */
|
|
176
|
-
type: 'input' | 'output';
|
|
177
|
-
/** Data type */
|
|
178
|
-
dataType: string;
|
|
179
|
-
/** Whether port is required */
|
|
180
|
-
required: boolean;
|
|
181
|
-
/** Description */
|
|
182
|
-
description?: string;
|
|
183
|
-
/** Default value */
|
|
184
|
-
defaultValue?: unknown;
|
|
185
|
-
/** Validation rules */
|
|
186
|
-
validation?: unknown;
|
|
187
|
-
}
|
|
188
|
-
export interface WorkflowData {
|
|
189
|
-
/** Workflow ID */
|
|
190
|
-
id: string;
|
|
191
|
-
/** Workflow name */
|
|
192
|
-
name: string;
|
|
193
|
-
/** Workflow description */
|
|
194
|
-
description?: string;
|
|
195
|
-
/** Workflow nodes */
|
|
196
|
-
nodes: WorkflowNode[];
|
|
197
|
-
/** Workflow edges */
|
|
198
|
-
edges: WorkflowEdge[];
|
|
199
|
-
/** Workflow metadata */
|
|
200
|
-
metadata?: Record<string, unknown>;
|
|
201
|
-
/** Creation timestamp */
|
|
202
|
-
createdAt?: number;
|
|
203
|
-
/** Last modified timestamp */
|
|
204
|
-
updatedAt?: number;
|
|
205
|
-
}
|
|
206
|
-
export interface WorkflowNode {
|
|
207
|
-
/** Node ID */
|
|
208
|
-
id: string;
|
|
209
|
-
/** Node type */
|
|
210
|
-
type: string;
|
|
211
|
-
/** Node position */
|
|
212
|
-
position: {
|
|
213
|
-
x: number;
|
|
214
|
-
y: number;
|
|
215
|
-
};
|
|
216
|
-
/** Node data */
|
|
217
|
-
data: {
|
|
218
|
-
/** Node label */
|
|
219
|
-
label: string;
|
|
220
|
-
/** Node configuration */
|
|
221
|
-
config: Record<string, unknown>;
|
|
222
|
-
/** Node metadata */
|
|
223
|
-
metadata?: Record<string, unknown>;
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
export interface WorkflowEdge {
|
|
227
|
-
/** Edge ID */
|
|
228
|
-
id: string;
|
|
229
|
-
/** Source node ID */
|
|
230
|
-
source: string;
|
|
231
|
-
/** Target node ID */
|
|
232
|
-
target: string;
|
|
233
|
-
/** Source port */
|
|
234
|
-
sourceHandle?: string;
|
|
235
|
-
/** Target port */
|
|
236
|
-
targetHandle?: string;
|
|
237
|
-
/** Edge type */
|
|
238
|
-
type?: string;
|
|
239
|
-
/** Edge data */
|
|
240
|
-
data?: Record<string, unknown>;
|
|
241
|
-
}
|
|
242
|
-
export interface ExecutionResult {
|
|
243
|
-
/** Execution ID */
|
|
244
|
-
executionId: string;
|
|
245
|
-
/** Workflow ID */
|
|
246
|
-
workflowId: string;
|
|
247
|
-
/** Execution status */
|
|
248
|
-
status: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
249
|
-
/** Execution results by node */
|
|
250
|
-
nodeResults: Record<string, unknown>;
|
|
251
|
-
/** Execution metadata */
|
|
252
|
-
metadata: {
|
|
253
|
-
startTime: number;
|
|
254
|
-
endTime?: number;
|
|
255
|
-
duration?: number;
|
|
256
|
-
error?: string;
|
|
257
|
-
};
|
|
258
|
-
/** Execution progress */
|
|
259
|
-
progress?: {
|
|
260
|
-
current: number;
|
|
261
|
-
total: number;
|
|
262
|
-
percentage: number;
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
export interface EditorState {
|
|
266
|
-
/** Current workflow data */
|
|
267
|
-
workflow: WorkflowData | null;
|
|
268
|
-
/** Selected nodes */
|
|
269
|
-
selectedNodes: string[];
|
|
270
|
-
/** Selected edges */
|
|
271
|
-
selectedEdges: string[];
|
|
272
|
-
/** Viewport state */
|
|
273
|
-
viewport: {
|
|
274
|
-
x: number;
|
|
275
|
-
y: number;
|
|
276
|
-
zoom: number;
|
|
277
|
-
};
|
|
278
|
-
/** Execution state */
|
|
279
|
-
execution: {
|
|
280
|
-
isExecuting: boolean;
|
|
281
|
-
currentExecution?: ExecutionResult;
|
|
282
|
-
executionHistory: ExecutionResult[];
|
|
283
|
-
};
|
|
284
|
-
/** UI state */
|
|
285
|
-
ui: {
|
|
286
|
-
sidebarOpen: boolean;
|
|
287
|
-
toolbarVisible: boolean;
|
|
288
|
-
minimapVisible: boolean;
|
|
289
|
-
gridVisible: boolean;
|
|
290
|
-
};
|
|
291
|
-
}
|
package/dist/types/config.js
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -248,10 +248,6 @@ export type SchemaTypeMap<T extends SchemaType> = T extends 'config' ? ConfigSch
|
|
|
248
248
|
export interface ConfigValues {
|
|
249
249
|
[key: string]: unknown;
|
|
250
250
|
}
|
|
251
|
-
/**
|
|
252
|
-
* Node configuration type (alias for backward compatibility)
|
|
253
|
-
*/
|
|
254
|
-
export type NodeConfig = ConfigValues;
|
|
255
251
|
/**
|
|
256
252
|
* Extended node type for workflows
|
|
257
253
|
*/
|
|
@@ -301,8 +297,6 @@ export interface WorkflowEdge extends Edge {
|
|
|
301
297
|
/** Data type of the source output port (e.g., "tool", "string", "number") */
|
|
302
298
|
sourcePortDataType?: string;
|
|
303
299
|
};
|
|
304
|
-
/** @deprecated Use metadata.edgeType instead - kept for backward compatibility */
|
|
305
|
-
isToolConnection?: boolean;
|
|
306
300
|
targetNodeType?: string;
|
|
307
301
|
targetCategory?: string;
|
|
308
302
|
};
|
package/dist/utils/colors.d.ts
CHANGED
|
@@ -8,11 +8,6 @@ import type { NodeCategory, PortDataTypeConfig } from '../types/index.js';
|
|
|
8
8
|
* Category color mapping to reference tokens (CSS variables)
|
|
9
9
|
*/
|
|
10
10
|
export declare const CATEGORY_COLOR_TOKENS: Record<NodeCategory, string>;
|
|
11
|
-
/**
|
|
12
|
-
* Data type color mapping to reference tokens (CSS variables)
|
|
13
|
-
* @deprecated Use getDataTypeColorToken() with port configuration instead
|
|
14
|
-
*/
|
|
15
|
-
export declare const DATA_TYPE_COLOR_TOKENS: Record<string, string>;
|
|
16
11
|
/**
|
|
17
12
|
* Get the reference color token for a category
|
|
18
13
|
*/
|
package/dist/utils/colors.js
CHANGED
|
@@ -25,10 +25,9 @@ export const CATEGORY_COLOR_TOKENS = {
|
|
|
25
25
|
bundles: 'var(--color-ref-slate-500)'
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
|
-
* @deprecated Use getDataTypeColorToken() with port configuration instead
|
|
28
|
+
* Default data type colors for fallback when port configuration is not available
|
|
30
29
|
*/
|
|
31
|
-
|
|
30
|
+
const DEFAULT_DATA_TYPE_COLORS = {
|
|
32
31
|
string: 'var(--color-ref-emerald-500)',
|
|
33
32
|
text: 'var(--color-ref-emerald-500)',
|
|
34
33
|
number: 'var(--color-ref-blue-600)',
|
|
@@ -78,7 +77,7 @@ export function getDataTypeColorToken(dataType) {
|
|
|
78
77
|
// Fallback to static color mapping if port checker not initialized
|
|
79
78
|
// console.warn("Port compatibility checker not initialized, using fallback colors");
|
|
80
79
|
}
|
|
81
|
-
return
|
|
80
|
+
return DEFAULT_DATA_TYPE_COLORS[dataType.toLowerCase()] || 'var(--color-ref-slate-500)';
|
|
82
81
|
}
|
|
83
82
|
/**
|
|
84
83
|
* Get data type configuration from port config
|
package/dist/utils/config.d.ts
CHANGED
|
@@ -35,11 +35,3 @@ export declare function mergeConfig(userConfig: Partial<WorkflowEditorConfig>, d
|
|
|
35
35
|
* Validate configuration
|
|
36
36
|
*/
|
|
37
37
|
export declare function validateConfig(config: WorkflowEditorConfig): string[];
|
|
38
|
-
/**
|
|
39
|
-
* Create default configuration
|
|
40
|
-
* For library usage, all configuration should be provided at runtime
|
|
41
|
-
* This function is kept for backward compatibility but returns defaults
|
|
42
|
-
*
|
|
43
|
-
* @deprecated Use createDefaultConfig() instead and pass runtime configuration
|
|
44
|
-
*/
|
|
45
|
-
export declare function createConfigFromEnv(): WorkflowEditorConfig;
|
package/dist/utils/config.js
CHANGED
|
@@ -224,17 +224,3 @@ export function validateConfig(config) {
|
|
|
224
224
|
}
|
|
225
225
|
return errors;
|
|
226
226
|
}
|
|
227
|
-
/**
|
|
228
|
-
* Create default configuration
|
|
229
|
-
* For library usage, all configuration should be provided at runtime
|
|
230
|
-
* This function is kept for backward compatibility but returns defaults
|
|
231
|
-
*
|
|
232
|
-
* @deprecated Use createDefaultConfig() instead and pass runtime configuration
|
|
233
|
-
*/
|
|
234
|
-
export function createConfigFromEnv() {
|
|
235
|
-
// Return default configuration without environment variables
|
|
236
|
-
// Configuration should be provided at runtime via props/parameters
|
|
237
|
-
const apiBaseUrl = '/api/flowdrop';
|
|
238
|
-
const endpointConfig = createEndpointConfig(apiBaseUrl);
|
|
239
|
-
return createDefaultConfig(endpointConfig);
|
|
240
|
-
}
|
|
@@ -38,11 +38,6 @@ export declare function initializePortCompatibility(portConfig: PortConfig): voi
|
|
|
38
38
|
* Get the global port compatibility checker
|
|
39
39
|
*/
|
|
40
40
|
export declare function getPortCompatibilityChecker(): PortCompatibilityChecker;
|
|
41
|
-
/**
|
|
42
|
-
* Check if two data types are compatible for connection (legacy function)
|
|
43
|
-
* @deprecated Use PortCompatibilityChecker.areDataTypesCompatible() instead
|
|
44
|
-
*/
|
|
45
|
-
export declare function areDataTypesCompatible(outputType: NodeDataType, inputType: NodeDataType): boolean;
|
|
46
41
|
/**
|
|
47
42
|
* Get all possible connections from a source node to target nodes
|
|
48
43
|
*/
|
|
@@ -90,17 +90,6 @@ export function getPortCompatibilityChecker() {
|
|
|
90
90
|
}
|
|
91
91
|
return globalCompatibilityChecker;
|
|
92
92
|
}
|
|
93
|
-
/**
|
|
94
|
-
* Check if two data types are compatible for connection (legacy function)
|
|
95
|
-
* @deprecated Use PortCompatibilityChecker.areDataTypesCompatible() instead
|
|
96
|
-
*/
|
|
97
|
-
export function areDataTypesCompatible(outputType, inputType) {
|
|
98
|
-
if (!globalCompatibilityChecker) {
|
|
99
|
-
// Fallback to basic compatibility for backward compatibility
|
|
100
|
-
return outputType === inputType;
|
|
101
|
-
}
|
|
102
|
-
return globalCompatibilityChecker.areDataTypesCompatible(outputType, inputType);
|
|
103
|
-
}
|
|
104
93
|
/**
|
|
105
94
|
* Get all possible connections from a source node to target nodes
|
|
106
95
|
*/
|
|
@@ -111,6 +100,8 @@ export function getPossibleConnections(sourceNode, targetNodes, nodeTypes) {
|
|
|
111
100
|
const possibleConnections = [];
|
|
112
101
|
// Get all output ports from source node
|
|
113
102
|
const sourceOutputs = sourceMetadata.outputs;
|
|
103
|
+
// Get the compatibility checker instance
|
|
104
|
+
const checker = getPortCompatibilityChecker();
|
|
114
105
|
// Check each target node
|
|
115
106
|
for (const targetNode of targetNodes) {
|
|
116
107
|
if (targetNode.id === sourceNode.id)
|
|
@@ -123,7 +114,7 @@ export function getPossibleConnections(sourceNode, targetNodes, nodeTypes) {
|
|
|
123
114
|
// Check each output-input combination
|
|
124
115
|
for (const sourcePort of sourceOutputs) {
|
|
125
116
|
for (const targetPort of targetInputs) {
|
|
126
|
-
const compatible = areDataTypesCompatible(sourcePort.dataType, targetPort.dataType);
|
|
117
|
+
const compatible = checker.areDataTypesCompatible(sourcePort.dataType, targetPort.dataType);
|
|
127
118
|
possibleConnections.push({
|
|
128
119
|
sourceNodeId: sourceNode.id,
|
|
129
120
|
sourcePortId: sourcePort.id,
|
|
@@ -170,8 +161,9 @@ export function validateConnection(sourceNodeId, sourcePortId, targetNodeId, tar
|
|
|
170
161
|
if (!targetPort) {
|
|
171
162
|
return { valid: false, error: 'Target port not found' };
|
|
172
163
|
}
|
|
173
|
-
// Check data type compatibility
|
|
174
|
-
|
|
164
|
+
// Check data type compatibility using the global checker
|
|
165
|
+
const checker = getPortCompatibilityChecker();
|
|
166
|
+
if (!checker.areDataTypesCompatible(sourcePort.dataType, targetPort.dataType)) {
|
|
175
167
|
return {
|
|
176
168
|
valid: false,
|
|
177
169
|
error: `Incompatible data types: ${sourcePort.dataType} cannot connect to ${targetPort.dataType}`
|
|
@@ -192,6 +184,8 @@ export function getConnectionSuggestions(nodeId, nodes, nodeTypes) {
|
|
|
192
184
|
const suggestions = [];
|
|
193
185
|
// Get all other nodes
|
|
194
186
|
const otherNodes = nodes.filter((n) => n.id !== nodeId);
|
|
187
|
+
// Get the compatibility checker instance
|
|
188
|
+
const checker = getPortCompatibilityChecker();
|
|
195
189
|
for (const otherNode of otherNodes) {
|
|
196
190
|
const otherMetadata = nodeTypes.find((nt) => nt.id === otherNode.data.metadata.id);
|
|
197
191
|
if (!otherMetadata)
|
|
@@ -199,7 +193,7 @@ export function getConnectionSuggestions(nodeId, nodes, nodeTypes) {
|
|
|
199
193
|
// Check outputs from other nodes to inputs of current node
|
|
200
194
|
for (const output of otherMetadata.outputs) {
|
|
201
195
|
for (const input of metadata.inputs) {
|
|
202
|
-
const compatible = areDataTypesCompatible(output.dataType, input.dataType);
|
|
196
|
+
const compatible = checker.areDataTypesCompatible(output.dataType, input.dataType);
|
|
203
197
|
suggestions.push({
|
|
204
198
|
nodeId: otherNode.id,
|
|
205
199
|
nodeName: otherNode.data.label,
|
|
@@ -214,7 +208,7 @@ export function getConnectionSuggestions(nodeId, nodes, nodeTypes) {
|
|
|
214
208
|
// Check outputs from current node to inputs of other nodes
|
|
215
209
|
for (const output of metadata.outputs) {
|
|
216
210
|
for (const input of otherMetadata.inputs) {
|
|
217
|
-
const compatible = areDataTypesCompatible(output.dataType, input.dataType);
|
|
211
|
+
const compatible = checker.areDataTypesCompatible(output.dataType, input.dataType);
|
|
218
212
|
suggestions.push({
|
|
219
213
|
nodeId: otherNode.id,
|
|
220
214
|
nodeName: otherNode.data.label,
|
package/dist/utils/icons.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import type { NodeType, NodeMetadata } from '../types/index.js';
|
|
13
13
|
/**
|
|
14
14
|
* Gets the SvelteFlow component name for a given NodeType.
|
|
15
|
-
*
|
|
15
|
+
* Uses the node component registry to resolve types.
|
|
16
16
|
*
|
|
17
17
|
* @param nodeType - The node type identifier
|
|
18
18
|
* @returns The component name to use
|