@d34dman/flowdrop 0.0.15 → 0.0.17

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 (40) hide show
  1. package/README.md +64 -1
  2. package/dist/api/enhanced-client.d.ts +119 -3
  3. package/dist/api/enhanced-client.js +233 -54
  4. package/dist/components/App.svelte +145 -33
  5. package/dist/components/App.svelte.d.ts +27 -1
  6. package/dist/components/FlowDropZone.svelte +4 -5
  7. package/dist/components/FlowDropZone.svelte.d.ts +1 -1
  8. package/dist/components/UniversalNode.svelte +94 -34
  9. package/dist/components/WorkflowEditor.svelte +63 -3
  10. package/dist/config/runtimeConfig.d.ts +2 -2
  11. package/dist/config/runtimeConfig.js +7 -7
  12. package/dist/data/samples.js +9 -9
  13. package/dist/examples/adapter-usage.js +1 -1
  14. package/dist/helpers/workflowEditorHelper.d.ts +44 -4
  15. package/dist/helpers/workflowEditorHelper.js +161 -30
  16. package/dist/index.d.ts +12 -2
  17. package/dist/index.js +20 -1
  18. package/dist/registry/builtinNodes.d.ts +77 -0
  19. package/dist/registry/builtinNodes.js +181 -0
  20. package/dist/registry/index.d.ts +7 -0
  21. package/dist/registry/index.js +10 -0
  22. package/dist/registry/nodeComponentRegistry.d.ts +307 -0
  23. package/dist/registry/nodeComponentRegistry.js +315 -0
  24. package/dist/registry/plugin.d.ts +215 -0
  25. package/dist/registry/plugin.js +249 -0
  26. package/dist/services/draftStorage.d.ts +171 -0
  27. package/dist/services/draftStorage.js +298 -0
  28. package/dist/stores/workflowStore.d.ts +103 -0
  29. package/dist/stores/workflowStore.js +249 -29
  30. package/dist/styles/base.css +15 -0
  31. package/dist/svelte-app.d.ts +110 -28
  32. package/dist/svelte-app.js +150 -27
  33. package/dist/types/auth.d.ts +278 -0
  34. package/dist/types/auth.js +244 -0
  35. package/dist/types/events.d.ts +163 -0
  36. package/dist/types/events.js +30 -0
  37. package/dist/types/index.d.ts +38 -3
  38. package/dist/utils/nodeTypes.d.ts +76 -21
  39. package/dist/utils/nodeTypes.js +180 -32
  40. package/package.json +1 -2
@@ -24,7 +24,7 @@ export async function fetchRuntimeConfig(force = false) {
24
24
  return cachedConfig;
25
25
  }
26
26
  try {
27
- const response = await fetch("/api/config");
27
+ const response = await fetch('/api/config');
28
28
  if (!response.ok) {
29
29
  throw new Error(`Failed to fetch runtime config: ${response.statusText}`);
30
30
  }
@@ -35,15 +35,15 @@ export async function fetchRuntimeConfig(force = false) {
35
35
  return config;
36
36
  }
37
37
  catch (error) {
38
- console.error("Failed to fetch runtime configuration:", error);
38
+ console.error('Failed to fetch runtime configuration:', error);
39
39
  // Return default configuration if fetch fails
40
40
  const defaultConfig = {
41
- apiBaseUrl: "/api/flowdrop",
42
- theme: "auto",
41
+ apiBaseUrl: '/api/flowdrop',
42
+ theme: 'auto',
43
43
  timeout: 30000,
44
- authType: "none",
45
- version: "1.0.0",
46
- environment: "production",
44
+ authType: 'none',
45
+ version: '1.0.0',
46
+ environment: 'production'
47
47
  };
48
48
  // Cache the default config to avoid repeated failed requests
49
49
  if (!cachedConfig) {
@@ -444,8 +444,8 @@ export const sampleNodes = [
444
444
  type: 'string',
445
445
  title: 'Model',
446
446
  description: 'OpenAI model to use',
447
- default: 'gpt-3.5-turbo',
448
- enum: ['gpt-3.5-turbo', 'gpt-4', 'gpt-4-turbo']
447
+ default: 'gpt-4o-mini',
448
+ enum: ['gpt-4o-mini', 'gpt-5-chat-latest', 'gpt-4.1']
449
449
  },
450
450
  temperature: {
451
451
  type: 'number',
@@ -2107,8 +2107,8 @@ export const sampleNodes = [
2107
2107
  type: 'string',
2108
2108
  title: 'Model',
2109
2109
  description: 'Chat model to use',
2110
- default: 'gpt-3.5-turbo',
2111
- enum: ['gpt-3.5-turbo', 'gpt-4', 'claude-3-sonnet']
2110
+ default: 'gpt-4o-mini',
2111
+ enum: ['gpt-4o-mini', 'gpt-5-chat-latest', 'claude-3-sonnet']
2112
2112
  },
2113
2113
  temperature: {
2114
2114
  type: 'number',
@@ -2601,8 +2601,8 @@ export const sampleNodes = [
2601
2601
  type: 'string',
2602
2602
  title: 'AI Model',
2603
2603
  description: 'AI model to use for content analysis',
2604
- default: 'gpt-4',
2605
- enum: ['gpt-3.5-turbo', 'gpt-4', 'claude-3-sonnet', 'claude-3-haiku']
2604
+ default: 'gpt-5-chat-latest',
2605
+ enum: ['gpt-4o-mini', 'gpt-5-chat-latest', 'claude-3-sonnet', 'claude-3-haiku']
2606
2606
  },
2607
2607
  analysisType: {
2608
2608
  type: 'string',
@@ -2725,8 +2725,8 @@ export const sampleNodes = [
2725
2725
  type: 'string',
2726
2726
  title: 'AI Model',
2727
2727
  description: 'AI model to use for content editing',
2728
- default: 'gpt-4',
2729
- enum: ['gpt-3.5-turbo', 'gpt-4', 'claude-3-sonnet', 'claude-3-haiku']
2728
+ default: 'gpt-5-chat-latest',
2729
+ enum: ['gpt-4o-mini', 'gpt-5-chat-latest', 'claude-3-sonnet', 'claude-3-haiku']
2730
2730
  },
2731
2731
  editingStyle: {
2732
2732
  type: 'string',
@@ -3184,7 +3184,7 @@ export const sampleWorkflow = {
3184
3184
  data: {
3185
3185
  label: 'OpenAI',
3186
3186
  config: {
3187
- model: 'gpt-3.5-turbo',
3187
+ model: 'gpt-4o-mini',
3188
3188
  temperature: 0.7,
3189
3189
  maxTokens: 1000
3190
3190
  },
@@ -14,7 +14,7 @@ function createSimpleWorkflow() {
14
14
  placeholder: 'Enter your message'
15
15
  });
16
16
  const modelNode = adapter.addNode(workflow, 'openai', { x: 300, y: 100 }, {
17
- model: 'gpt-4',
17
+ model: 'gpt-4o-mini',
18
18
  temperature: 0.7
19
19
  });
20
20
  const outputNode = adapter.addNode(workflow, 'text-output', { x: 500, y: 100 });
@@ -11,13 +11,53 @@ import type { EndpointConfig } from '../config/endpoints.js';
11
11
  */
12
12
  export declare function generateNodeId(nodeTypeId: string, existingNodes: WorkflowNodeType[]): string;
13
13
  /**
14
- * Edge styling configuration
14
+ * Edge category type for styling purposes
15
+ * - trigger: For control flow connections (dataType: "trigger")
16
+ * - tool: Dashed amber line for tool connections (dataType: "tool")
17
+ * - data: Normal gray line for all other data connections
18
+ */
19
+ export type EdgeCategory = 'trigger' | 'tool' | 'data';
20
+ /**
21
+ * Edge styling configuration based on source port data type
15
22
  */
16
23
  export declare class EdgeStylingHelper {
17
24
  /**
18
- * Apply custom styling to connection edges based on rules:
19
- * - Dashed lines for connections to tool nodes
20
- * - Arrow markers pointing towards input ports
25
+ * Extract the port ID from a handle ID
26
+ * Supports two formats:
27
+ * 1. New format: "${nodeId}-output-${portId}" or "${nodeId}-input-${portId}"
28
+ * 2. Legacy format: just the portId (e.g., "text", "trigger")
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 legacy format
31
+ */
32
+ static extractPortIdFromHandle(handleId: string | undefined): string | null;
33
+ /**
34
+ * Check if a port ID matches a dynamic branch in a Gateway node
35
+ * Gateway nodes store branches in config.branches array
36
+ * @param node - The workflow node to check
37
+ * @param portId - The port ID to look up
38
+ * @returns true if the portId matches a gateway branch
39
+ */
40
+ static isGatewayBranch(node: WorkflowNodeType, portId: string): boolean;
41
+ /**
42
+ * Get the data type of a port from a node's metadata
43
+ * Also handles dynamic ports like Gateway branches
44
+ * @param node - The workflow node containing the port
45
+ * @param portId - The port ID to look up
46
+ * @param portType - Whether to look in "inputs" or "outputs"
47
+ * @returns The port's dataType or null if not found
48
+ */
49
+ static getPortDataType(node: WorkflowNodeType, portId: string, portType: 'input' | 'output'): string | null;
50
+ /**
51
+ * Determine the edge category based on source port data type
52
+ * @param sourcePortDataType - The data type of the source output port
53
+ * @returns The edge category for styling
54
+ */
55
+ static getEdgeCategory(sourcePortDataType: string | null): EdgeCategory;
56
+ /**
57
+ * Apply custom styling to connection edges based on source port data type:
58
+ * - Trigger ports: Solid black line with arrow
59
+ * - Tool ports: Dashed amber line with arrow
60
+ * - Data ports: Normal gray line with arrow
21
61
  */
22
62
  static applyConnectionStyling(edge: WorkflowEdge, sourceNode: WorkflowNodeType, targetNode: WorkflowNodeType): void;
23
63
  /**
@@ -30,44 +30,166 @@ export function generateNodeId(nodeTypeId, existingNodes) {
30
30
  return `${nodeTypeId}.${nextNumber}`;
31
31
  }
32
32
  /**
33
- * Edge styling configuration
33
+ * Edge styling configuration based on source port data type
34
34
  */
35
35
  export class EdgeStylingHelper {
36
36
  /**
37
- * Apply custom styling to connection edges based on rules:
38
- * - Dashed lines for connections to tool nodes
39
- * - Arrow markers pointing towards input ports
37
+ * Extract the port ID from a handle ID
38
+ * Supports two formats:
39
+ * 1. New format: "${nodeId}-output-${portId}" or "${nodeId}-input-${portId}"
40
+ * 2. Legacy format: just the portId (e.g., "text", "trigger")
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 legacy format
40
43
  */
41
- static applyConnectionStyling(edge, sourceNode, targetNode) {
42
- // Rule 1: Dashed lines for tool nodes
43
- // A node is a tool node when it uses the ToolNode component,
44
- // which happens when sourceNode.type === "tool"
45
- const isToolNode = sourceNode.type === 'tool';
46
- // Use inline styles for dashed lines (more reliable than CSS classes)
47
- if (isToolNode) {
48
- edge.style = 'stroke-dasharray: 0 4 0; stroke: amber !important;';
49
- edge.class = 'flowdrop--edge--tool';
44
+ static extractPortIdFromHandle(handleId) {
45
+ if (!handleId) {
46
+ return null;
47
+ }
48
+ // Try new format: "${nodeId}-output-${portId}" or "${nodeId}-input-${portId}"
49
+ // We need to find the last occurrence of "-output-" or "-input-" and get what follows
50
+ const outputMatch = handleId.lastIndexOf('-output-');
51
+ const inputMatch = handleId.lastIndexOf('-input-');
52
+ if (outputMatch !== -1) {
53
+ return handleId.substring(outputMatch + '-output-'.length);
54
+ }
55
+ if (inputMatch !== -1) {
56
+ return handleId.substring(inputMatch + '-input-'.length);
57
+ }
58
+ // Legacy format: the handleId IS the port ID
59
+ return handleId;
60
+ }
61
+ /**
62
+ * Check if a port ID matches a dynamic branch in a Gateway node
63
+ * Gateway nodes store branches in config.branches array
64
+ * @param node - The workflow node to check
65
+ * @param portId - The port ID to look up
66
+ * @returns true if the portId matches a gateway branch
67
+ */
68
+ static isGatewayBranch(node, portId) {
69
+ // Check if this is a gateway node with dynamic branches
70
+ const nodeType = node.data?.metadata?.type || node.type;
71
+ if (nodeType !== 'gateway') {
72
+ return false;
73
+ }
74
+ // Check if the portId matches a branch name in config.branches
75
+ const branches = node.data?.config?.branches;
76
+ if (!branches || !Array.isArray(branches)) {
77
+ return false;
78
+ }
79
+ return branches.some((branch) => branch.name === portId);
80
+ }
81
+ /**
82
+ * Get the data type of a port from a node's metadata
83
+ * Also handles dynamic ports like Gateway branches
84
+ * @param node - The workflow node containing the port
85
+ * @param portId - The port ID to look up
86
+ * @param portType - Whether to look in "inputs" or "outputs"
87
+ * @returns The port's dataType or null if not found
88
+ */
89
+ static getPortDataType(node, portId, portType) {
90
+ // First, check static ports in metadata
91
+ const ports = portType === 'output' ? node.data?.metadata?.outputs : node.data?.metadata?.inputs;
92
+ if (ports && Array.isArray(ports)) {
93
+ const port = ports.find((p) => p.id === portId);
94
+ if (port?.dataType) {
95
+ return port.dataType;
96
+ }
97
+ }
98
+ // For output ports, also check dynamic Gateway branches
99
+ // Gateway branches are always trigger type (control flow)
100
+ if (portType === 'output' && this.isGatewayBranch(node, portId)) {
101
+ return 'trigger';
102
+ }
103
+ return null;
104
+ }
105
+ /**
106
+ * Determine the edge category based on source port data type
107
+ * @param sourcePortDataType - The data type of the source output port
108
+ * @returns The edge category for styling
109
+ */
110
+ static getEdgeCategory(sourcePortDataType) {
111
+ if (sourcePortDataType === 'trigger') {
112
+ return 'trigger';
113
+ }
114
+ if (sourcePortDataType === 'tool') {
115
+ return 'tool';
50
116
  }
51
- else {
52
- edge.style = 'stroke: grey;';
117
+ // All other data types (string, number, boolean, array, etc.) are "data" edges
118
+ return 'data';
119
+ }
120
+ /**
121
+ * Apply custom styling to connection edges based on source port data type:
122
+ * - Trigger ports: Solid black line with arrow
123
+ * - Tool ports: Dashed amber line with arrow
124
+ * - Data ports: Normal gray line with arrow
125
+ */
126
+ static applyConnectionStyling(edge, sourceNode, targetNode) {
127
+ // Extract port ID from sourceHandle
128
+ const sourcePortId = this.extractPortIdFromHandle(edge.sourceHandle);
129
+ // Get the source port's data type
130
+ const sourcePortDataType = sourcePortId
131
+ ? this.getPortDataType(sourceNode, sourcePortId, 'output')
132
+ : null;
133
+ // Determine edge category based on source port data type
134
+ const edgeCategory = this.getEdgeCategory(sourcePortDataType);
135
+ // Edge color constants (matching CSS tokens in base.css)
136
+ const EDGE_COLORS = {
137
+ trigger: '#111827', // --color-ref-gray-900
138
+ tool: '#f59e0b', // --color-ref-amber-500
139
+ data: '#9ca3af' // --color-ref-gray-400
140
+ };
141
+ // Apply styling based on edge category
142
+ // CSS classes handle styling via tokens; inline styles are fallback
143
+ switch (edgeCategory) {
144
+ case 'trigger':
145
+ // Trigger edges: solid dark line for control flow
146
+ edge.style =
147
+ 'stroke: var(--flowdrop-edge-trigger-color); stroke-width: var(--flowdrop-edge-trigger-width);';
148
+ edge.class = 'flowdrop--edge--trigger';
149
+ edge.markerEnd = {
150
+ type: MarkerType.ArrowClosed,
151
+ width: 16,
152
+ height: 16,
153
+ color: EDGE_COLORS.trigger
154
+ };
155
+ break;
156
+ case 'tool':
157
+ // Tool edges: dashed amber line
158
+ edge.style = 'stroke: var(--flowdrop-edge-tool-color); stroke-dasharray: 5 3;';
159
+ edge.class = 'flowdrop--edge--tool';
160
+ edge.markerEnd = {
161
+ type: MarkerType.ArrowClosed,
162
+ width: 16,
163
+ height: 16,
164
+ color: EDGE_COLORS.tool
165
+ };
166
+ break;
167
+ case 'data':
168
+ default:
169
+ // Data edges: normal gray line
170
+ edge.style = 'stroke: var(--flowdrop-edge-data-color);';
171
+ edge.class = 'flowdrop--edge--data';
172
+ edge.markerEnd = {
173
+ type: MarkerType.ArrowClosed,
174
+ width: 16,
175
+ height: 16,
176
+ color: EDGE_COLORS.data
177
+ };
178
+ break;
53
179
  }
54
- // Store metadata in edge data for debugging
180
+ // Store metadata in edge data for API and persistence
55
181
  edge.data = {
56
182
  ...edge.data,
57
- isToolConnection: isToolNode,
183
+ metadata: {
184
+ ...(edge.data?.metadata || {}),
185
+ edgeType: edgeCategory,
186
+ sourcePortDataType: sourcePortDataType || undefined
187
+ },
188
+ // Keep legacy fields for backward compatibility
189
+ isToolConnection: edgeCategory === 'tool',
58
190
  targetNodeType: targetNode.type,
59
191
  targetCategory: targetNode.data.metadata.category
60
192
  };
61
- // Rule 2: Always add arrow pointing towards input port
62
- // This replaces the default arrows we removed
63
- if (!isToolNode) {
64
- edge.markerEnd = {
65
- type: MarkerType.ArrowClosed,
66
- width: 16,
67
- height: 16,
68
- color: 'grey'
69
- };
70
- }
71
193
  }
72
194
  /**
73
195
  * Update existing edges with custom styling rules
@@ -77,11 +199,20 @@ export class EdgeStylingHelper {
77
199
  // Find source and target nodes
78
200
  const sourceNode = nodes.find((node) => node.id === edge.source);
79
201
  const targetNode = nodes.find((node) => node.id === edge.target);
202
+ // Create a copy of the edge
203
+ const updatedEdge = { ...edge };
80
204
  if (!sourceNode || !targetNode) {
81
- return edge;
205
+ // Set default edgeType even when nodes are not found
206
+ updatedEdge.data = {
207
+ ...updatedEdge.data,
208
+ metadata: {
209
+ ...(updatedEdge.data?.metadata || {}),
210
+ edgeType: 'data'
211
+ }
212
+ };
213
+ return updatedEdge;
82
214
  }
83
- // Create a copy of the edge and apply styling
84
- const updatedEdge = { ...edge };
215
+ // Apply full styling when nodes are available
85
216
  this.applyConnectionStyling(updatedEdge, sourceNode, targetNode);
86
217
  return updatedEdge;
87
218
  });
package/dist/index.d.ts CHANGED
@@ -3,8 +3,13 @@
3
3
  * A Svelte 5 component library built on @xyflow/svelte for creating node-based workflow editors
4
4
  */
5
5
  import './styles/base.css';
6
- export type { NodeCategory, NodeDataType, NodePort, NodeMetadata, NodeConfig, WorkflowNode, WorkflowEdge, Workflow, ApiResponse, NodesResponse, WorkflowResponse, WorkflowsResponse, ExecutionStatus, ExecutionResult, FlowDropConfig, WorkflowEvents } from './types/index.js';
6
+ import './registry/builtinNodes.js';
7
+ export type { NodeCategory, NodeDataType, NodePort, NodeMetadata, NodeConfig, WorkflowNode, WorkflowEdge, Workflow, ApiResponse, NodesResponse, WorkflowResponse, WorkflowsResponse, ExecutionStatus, ExecutionResult, FlowDropConfig, WorkflowEvents, BuiltinNodeType } from './types/index.js';
7
8
  export type { WorkflowEditorConfig, EditorFeatures, UIConfig, APIConfig, ExecutionConfig, StorageConfig, NodeType, WorkflowData, ExecutionResult as EditorExecutionResult, EditorState } from './types/config.js';
9
+ export type { AuthProvider, StaticAuthConfig, CallbackAuthConfig } from './types/auth.js';
10
+ export { StaticAuthProvider, CallbackAuthProvider, NoAuthProvider, createAuthProviderFromLegacyConfig } from './types/auth.js';
11
+ export type { WorkflowChangeType, FlowDropEventHandlers, FlowDropFeatures } from './types/events.js';
12
+ export { DEFAULT_FEATURES, mergeFeatures } from './types/events.js';
8
13
  export { FlowDropApiClient } from './api/client.js';
9
14
  export { EnhancedFlowDropApiClient } from './api/enhanced-client.js';
10
15
  export { default as WorkflowEditor } from './components/WorkflowEditor.svelte';
@@ -39,6 +44,8 @@ export * from './utils/nodeTypes.js';
39
44
  export { getStatusColor, getStatusIcon, getStatusLabel, getStatusBackgroundColor, getStatusTextColor, createDefaultExecutionInfo, updateExecutionStart, updateExecutionComplete, updateExecutionFailed, resetExecutionInfo, formatExecutionDuration, formatLastExecuted } from './utils/nodeStatus.js';
40
45
  export { createNodeWrapperConfig, shouldShowNodeStatus, getOptimalStatusPosition, getOptimalStatusSize, DEFAULT_NODE_STATUS_CONFIG } from './utils/nodeWrapper.js';
41
46
  export type { NodeStatusConfig } from './utils/nodeWrapper.js';
47
+ export { nodeComponentRegistry, createNamespacedType, parseNamespacedType, BUILTIN_NODE_COMPONENTS, BUILTIN_NODE_TYPES, FLOWDROP_SOURCE, registerBuiltinNodes, areBuiltinsRegistered, isBuiltinType, getBuiltinTypes, resolveBuiltinAlias, registerFlowDropPlugin, unregisterFlowDropPlugin, registerCustomNode, createPlugin, isValidNamespace, getRegisteredPlugins, getPluginNodeCount } from './registry/index.js';
48
+ export type { NodeComponentProps, NodeComponentRegistration, NodeComponentCategory, StatusPosition, StatusSize, NodeRegistrationFilter, FlowDropPluginConfig, PluginNodeDefinition, PluginRegistrationResult } from './registry/index.js';
42
49
  export * from './services/api.js';
43
50
  export { showSuccess, showError, showWarning, showInfo, showLoading, dismissToast, dismissAllToasts, showPromise, showConfirmation, apiToasts, workflowToasts, pipelineToasts } from './services/toastService.js';
44
51
  export type { ToastType, ToastOptions } from './services/toastService.js';
@@ -46,8 +53,9 @@ export { NodeExecutionService, nodeExecutionService } from './services/nodeExecu
46
53
  export { saveWorkflow, updateWorkflow, getWorkflow, getWorkflows, deleteWorkflow, getWorkflowCount, initializeSampleWorkflows } from './services/workflowStorage.js';
47
54
  export { globalSaveWorkflow, globalExportWorkflow, initializeGlobalSave } from './services/globalSave.js';
48
55
  export { fetchPortConfig, validatePortConfig } from './services/portConfigApi.js';
56
+ export { getDraftStorageKey, saveDraft, loadDraft, deleteDraft, hasDraft, getDraftMetadata, DraftAutoSaveManager } from './services/draftStorage.js';
49
57
  export { EdgeStylingHelper, NodeOperationsHelper, WorkflowOperationsHelper, ConfigurationHelper } from './helpers/workflowEditorHelper.js';
50
- export { workflowStore, workflowActions, workflowId, workflowName, workflowNodes, workflowEdges, workflowMetadata, workflowChanged, workflowValidation, workflowMetadataChanged } from './stores/workflowStore.js';
58
+ export { workflowStore, workflowActions, workflowId, workflowName, workflowNodes, workflowEdges, workflowMetadata, workflowChanged, workflowValidation, workflowMetadataChanged, isDirtyStore, isDirty, markAsSaved, getWorkflow as getWorkflowFromStore, setOnDirtyStateChange, setOnWorkflowChange } from './stores/workflowStore.js';
51
59
  export * from './config/endpoints.js';
52
60
  export { defaultApiConfig, getEndpointUrl } from './config/apiConfig.js';
53
61
  export type { ApiConfig } from './config/apiConfig.js';
@@ -56,3 +64,5 @@ export * from './config/runtimeConfig.js';
56
64
  export * from './adapters/WorkflowAdapter.js';
57
65
  export * from './clients/ApiClient.js';
58
66
  export { mountWorkflowEditor, unmountWorkflowEditor, mountFlowDropApp, unmountFlowDropApp } from './svelte-app.js';
67
+ export type { FlowDropMountOptions, MountedFlowDropApp, NavbarAction } from './svelte-app.js';
68
+ export { ApiError } from './api/enhanced-client.js';
package/dist/index.js CHANGED
@@ -4,6 +4,11 @@
4
4
  */
5
5
  // Import CSS to ensure styles are included in the library build
6
6
  import './styles/base.css';
7
+ // Initialize built-in node components in the registry
8
+ // This import has a side effect of registering all built-in nodes
9
+ import './registry/builtinNodes.js';
10
+ export { StaticAuthProvider, CallbackAuthProvider, NoAuthProvider, createAuthProviderFromLegacyConfig } from './types/auth.js';
11
+ export { DEFAULT_FEATURES, mergeFeatures } from './types/events.js';
7
12
  // Export API clients
8
13
  export { FlowDropApiClient } from './api/client.js';
9
14
  export { EnhancedFlowDropApiClient } from './api/enhanced-client.js';
@@ -41,6 +46,14 @@ export * from './utils/config.js';
41
46
  export * from './utils/nodeTypes.js';
42
47
  export { getStatusColor, getStatusIcon, getStatusLabel, getStatusBackgroundColor, getStatusTextColor, createDefaultExecutionInfo, updateExecutionStart, updateExecutionComplete, updateExecutionFailed, resetExecutionInfo, formatExecutionDuration, formatLastExecuted } from './utils/nodeStatus.js';
43
48
  export { createNodeWrapperConfig, shouldShowNodeStatus, getOptimalStatusPosition, getOptimalStatusSize, DEFAULT_NODE_STATUS_CONFIG } from './utils/nodeWrapper.js';
49
+ // Export node component registry
50
+ export {
51
+ // Core registry
52
+ nodeComponentRegistry, createNamespacedType, parseNamespacedType,
53
+ // Built-in nodes
54
+ BUILTIN_NODE_COMPONENTS, BUILTIN_NODE_TYPES, FLOWDROP_SOURCE, registerBuiltinNodes, areBuiltinsRegistered, isBuiltinType, getBuiltinTypes, resolveBuiltinAlias,
55
+ // Plugin system
56
+ registerFlowDropPlugin, unregisterFlowDropPlugin, registerCustomNode, createPlugin, isValidNamespace, getRegisteredPlugins, getPluginNodeCount } from './registry/index.js';
44
57
  // Export services
45
58
  export * from './services/api.js';
46
59
  export { showSuccess, showError, showWarning, showInfo, showLoading, dismissToast, dismissAllToasts, showPromise, showConfirmation, apiToasts, workflowToasts, pipelineToasts } from './services/toastService.js';
@@ -48,10 +61,14 @@ export { NodeExecutionService, nodeExecutionService } from './services/nodeExecu
48
61
  export { saveWorkflow, updateWorkflow, getWorkflow, getWorkflows, deleteWorkflow, getWorkflowCount, initializeSampleWorkflows } from './services/workflowStorage.js';
49
62
  export { globalSaveWorkflow, globalExportWorkflow, initializeGlobalSave } from './services/globalSave.js';
50
63
  export { fetchPortConfig, validatePortConfig } from './services/portConfigApi.js';
64
+ // Export draft storage service
65
+ export { getDraftStorageKey, saveDraft, loadDraft, deleteDraft, hasDraft, getDraftMetadata, DraftAutoSaveManager } from './services/draftStorage.js';
51
66
  // Export helpers
52
67
  export { EdgeStylingHelper, NodeOperationsHelper, WorkflowOperationsHelper, ConfigurationHelper } from './helpers/workflowEditorHelper.js';
53
68
  // Export stores
54
- export { workflowStore, workflowActions, workflowId, workflowName, workflowNodes, workflowEdges, workflowMetadata, workflowChanged, workflowValidation, workflowMetadataChanged } from './stores/workflowStore.js';
69
+ export { workflowStore, workflowActions, workflowId, workflowName, workflowNodes, workflowEdges, workflowMetadata, workflowChanged, workflowValidation, workflowMetadataChanged,
70
+ // Dirty state tracking
71
+ isDirtyStore, isDirty, markAsSaved, getWorkflow as getWorkflowFromStore, setOnDirtyStateChange, setOnWorkflowChange } from './stores/workflowStore.js';
55
72
  // Export endpoint configuration
56
73
  export * from './config/endpoints.js';
57
74
  export { defaultApiConfig, getEndpointUrl } from './config/apiConfig.js';
@@ -63,3 +80,5 @@ export * from './adapters/WorkflowAdapter.js';
63
80
  export * from './clients/ApiClient.js';
64
81
  // Export Svelte app wrapper for framework integration
65
82
  export { mountWorkflowEditor, unmountWorkflowEditor, mountFlowDropApp, unmountFlowDropApp } from './svelte-app.js';
83
+ // Export API error class
84
+ export { ApiError } from './api/enhanced-client.js';
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Built-in Node Components Registration
3
+ * Registers all default FlowDrop node components with the registry.
4
+ *
5
+ * This module is automatically loaded when the library initializes,
6
+ * ensuring all built-in node types are available without user action.
7
+ */
8
+ import { type NodeComponentRegistration } from './nodeComponentRegistry.js';
9
+ /**
10
+ * Source identifier for built-in FlowDrop components
11
+ */
12
+ export declare const FLOWDROP_SOURCE = "flowdrop";
13
+ /**
14
+ * Built-in FlowDrop node component registrations.
15
+ * These are the default node types that ship with FlowDrop.
16
+ */
17
+ export declare const BUILTIN_NODE_COMPONENTS: NodeComponentRegistration[];
18
+ /**
19
+ * Alias mapping for backwards compatibility.
20
+ * Maps old type names to their canonical registration.
21
+ */
22
+ export declare const BUILTIN_TYPE_ALIASES: Record<string, string>;
23
+ /**
24
+ * Initialize the registry with built-in components.
25
+ * This is called automatically when the library loads.
26
+ *
27
+ * Safe to call multiple times - will only register once.
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * // Usually not needed - called automatically
32
+ * // But can be called manually if needed
33
+ * registerBuiltinNodes();
34
+ * ```
35
+ */
36
+ export declare function registerBuiltinNodes(): void;
37
+ /**
38
+ * Check if built-in nodes have been registered.
39
+ *
40
+ * @returns true if registerBuiltinNodes() has been called
41
+ */
42
+ export declare function areBuiltinsRegistered(): boolean;
43
+ /**
44
+ * Reset the registration state.
45
+ * Primarily useful for testing.
46
+ */
47
+ export declare function resetBuiltinRegistration(): void;
48
+ /**
49
+ * Get the canonical type for a given type string.
50
+ * Handles aliases like "default" -> "workflowNode".
51
+ *
52
+ * @param type - The type string to resolve
53
+ * @returns The canonical type string
54
+ */
55
+ export declare function resolveBuiltinAlias(type: string): string;
56
+ /**
57
+ * Check if a type is a built-in FlowDrop type.
58
+ *
59
+ * @param type - The type to check
60
+ * @returns true if this is a built-in type
61
+ */
62
+ export declare function isBuiltinType(type: string): boolean;
63
+ /**
64
+ * Get all built-in type identifiers.
65
+ *
66
+ * @returns Array of built-in type strings
67
+ */
68
+ export declare function getBuiltinTypes(): string[];
69
+ /**
70
+ * Type for built-in node types.
71
+ * Use this when you specifically need a built-in type.
72
+ */
73
+ export type BuiltinNodeType = 'workflowNode' | 'simple' | 'square' | 'tool' | 'gateway' | 'note';
74
+ /**
75
+ * Array of built-in type strings for runtime validation.
76
+ */
77
+ export declare const BUILTIN_NODE_TYPES: BuiltinNodeType[];