@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
package/README.md CHANGED
@@ -14,6 +14,14 @@ A visual workflow editor component library built with Svelte 5 and @xyflow/svelt
14
14
  - **TypeScript Support**: Full type definitions included
15
15
  - **Docker Ready**: Production-ready Dockerfile and Docker Compose configuration
16
16
 
17
+ ### Enterprise Features (v0.0.16+)
18
+
19
+ - **Pluggable Authentication**: AuthProvider interface for OAuth, JWT, SSO integration
20
+ - **Workflow Lifecycle Events**: Hooks for save, load, change, and unmount events
21
+ - **Dirty State Tracking**: Monitor unsaved changes with reactive stores
22
+ - **Draft Auto-Save**: Automatic localStorage drafts with configurable intervals
23
+ - **Feature Flags**: Customize behavior for security and UX requirements
24
+
17
25
  ## 📦 Installation
18
26
 
19
27
  ```bash
@@ -117,6 +125,52 @@ const editor = mountWorkflowEditor(container, {
117
125
  editor.destroy();
118
126
  ```
119
127
 
128
+ #### 3. Enterprise Integration (v0.0.16+)
129
+
130
+ ```javascript
131
+ import { mountFlowDropApp, createEndpointConfig, CallbackAuthProvider } from '@d34dman/flowdrop';
132
+
133
+ const app = await mountFlowDropApp(container, {
134
+ workflow: myWorkflow,
135
+ endpointConfig: createEndpointConfig('/api/flowdrop'),
136
+
137
+ // Dynamic authentication with token refresh
138
+ authProvider: new CallbackAuthProvider({
139
+ getToken: () => authService.getAccessToken(),
140
+ onUnauthorized: () => authService.refreshToken()
141
+ }),
142
+
143
+ // Workflow lifecycle hooks
144
+ eventHandlers: {
145
+ onDirtyStateChange: (isDirty) => updateSaveButton(isDirty),
146
+ onAfterSave: (workflow) => showSuccess('Saved!'),
147
+ onBeforeUnmount: (workflow, isDirty) => {
148
+ if (isDirty) saveDraft(workflow);
149
+ }
150
+ },
151
+
152
+ // Feature configuration
153
+ features: {
154
+ autoSaveDraft: true,
155
+ autoSaveDraftInterval: 30000,
156
+ showToasts: true
157
+ }
158
+ });
159
+
160
+ // Access instance methods
161
+ if (app.isDirty()) {
162
+ await app.save();
163
+ }
164
+
165
+ // Get current workflow data
166
+ const workflow = app.getWorkflow();
167
+
168
+ // Cleanup
169
+ app.destroy();
170
+ ```
171
+
172
+ See the [Enterprise Integration Guide](./docs/enterprise-integration.md) for React, Vue, Angular, and Drupal examples.
173
+
120
174
  #### 3. Integration with Backend Frameworks
121
175
 
122
176
  ##### Drupal Example
@@ -313,6 +367,13 @@ npm run format
313
367
  - **CHANGELOG.md** - Version history
314
368
  - **Storybook** - Component documentation (run `npm run storybook`)
315
369
 
370
+ ### Enterprise Features (v0.0.16+)
371
+
372
+ - **[Enterprise Integration Guide](./docs/enterprise-integration.md)** - Complete integration patterns for React, Vue, Angular, Drupal
373
+ - **[Authentication Guide](./docs/authentication-guide.md)** - OAuth, JWT, SSO, and custom auth providers
374
+ - **[Event Handlers](./docs/event-handlers.md)** - Workflow lifecycle events and hooks
375
+ - **[Features Configuration](./docs/features-configuration.md)** - Feature flags, draft auto-save, and customization
376
+
316
377
  ## 🤝 Contributing
317
378
 
318
379
  Not accepting contributions until the library stabilizes. Stay tuned.
@@ -347,6 +408,7 @@ docker-compose up -d
347
408
  ### Environment Variables
348
409
 
349
410
  **Production (Runtime):**
411
+
350
412
  - `FLOWDROP_API_BASE_URL` - Backend API URL
351
413
  - `FLOWDROP_THEME` - UI theme (light/dark/auto)
352
414
  - `FLOWDROP_TIMEOUT` - Request timeout in milliseconds
@@ -354,6 +416,7 @@ docker-compose up -d
354
416
  - `FLOWDROP_AUTH_TOKEN` - Authentication token
355
417
 
356
418
  **Development (Build-time):**
419
+
357
420
  - `VITE_API_BASE_URL` - Dev API URL (used only during `npm run dev`)
358
421
 
359
422
  ### Build for Production
@@ -371,7 +434,7 @@ node build
371
434
  ```
372
435
 
373
436
  For detailed deployment instructions, see:
374
- - [DEPLOYMENT.md](./DEPLOYMENT.md) - Complete deployment guide
437
+
375
438
  - [DOCKER.md](./DOCKER.md) - Docker quick start
376
439
 
377
440
  ---
@@ -1,44 +1,160 @@
1
1
  /**
2
2
  * Enhanced API Client for FlowDrop
3
- * Uses configurable endpoints for all API actions
3
+ *
4
+ * Uses configurable endpoints and supports pluggable authentication providers.
5
+ *
6
+ * @module api/enhanced-client
4
7
  */
5
8
  import type { NodeMetadata, Workflow, ExecutionResult } from '../types/index.js';
6
9
  import type { EndpointConfig } from '../config/endpoints.js';
10
+ import type { AuthProvider } from '../types/auth.js';
11
+ /**
12
+ * API error with additional context
13
+ */
14
+ export declare class ApiError extends Error {
15
+ /** HTTP status code */
16
+ readonly status: number;
17
+ /** Original error data from API */
18
+ readonly errorData: Record<string, unknown>;
19
+ /** Operation that was being performed */
20
+ readonly operation: string;
21
+ constructor(message: string, status: number, operation: string, errorData?: Record<string, unknown>);
22
+ }
7
23
  /**
8
24
  * Enhanced HTTP API client for FlowDrop with configurable endpoints
25
+ *
26
+ * Supports pluggable authentication via AuthProvider interface.
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * // With AuthProvider
31
+ * const client = new EnhancedFlowDropApiClient(config, authProvider);
32
+ *
33
+ * // Backward compatible (uses config.auth)
34
+ * const client = new EnhancedFlowDropApiClient(config);
35
+ * ```
9
36
  */
10
37
  export declare class EnhancedFlowDropApiClient {
11
38
  private config;
12
- constructor(config: EndpointConfig);
39
+ private authProvider;
13
40
  /**
14
- * Make HTTP request with error handling and retry logic
41
+ * Create a new EnhancedFlowDropApiClient
42
+ *
43
+ * @param config - Endpoint configuration
44
+ * @param authProvider - Optional authentication provider (if not provided, uses config.auth)
45
+ */
46
+ constructor(config: EndpointConfig, authProvider?: AuthProvider);
47
+ /**
48
+ * Make HTTP request with error handling, retry logic, and auth support
49
+ *
50
+ * @param endpointKey - Key identifying the endpoint (for method/header lookup)
51
+ * @param endpointPath - The endpoint path template
52
+ * @param params - URL parameters to substitute
53
+ * @param options - Additional fetch options
54
+ * @param operation - Description of the operation (for error messages)
15
55
  */
16
56
  private request;
57
+ /**
58
+ * Update the auth provider
59
+ *
60
+ * Useful for updating auth after token refresh in parent application.
61
+ * Note: Per specification, this should rarely be needed as auth is typically
62
+ * set at mount time and requires remount to change.
63
+ *
64
+ * @param authProvider - New authentication provider
65
+ */
66
+ setAuthProvider(authProvider: AuthProvider): void;
67
+ /**
68
+ * Get current auth provider
69
+ *
70
+ * @returns The current AuthProvider instance
71
+ */
72
+ getAuthProvider(): AuthProvider;
73
+ /**
74
+ * Fetch all available node types
75
+ */
17
76
  getAvailableNodes(): Promise<NodeMetadata[]>;
77
+ /**
78
+ * Fetch nodes filtered by category
79
+ */
18
80
  getNodesByCategory(category: string): Promise<NodeMetadata[]>;
81
+ /**
82
+ * Fetch metadata for a specific node type
83
+ */
19
84
  getNodeMetadata(nodeId: string): Promise<NodeMetadata>;
85
+ /**
86
+ * Save a new workflow
87
+ */
20
88
  saveWorkflow(workflow: Workflow): Promise<Workflow>;
89
+ /**
90
+ * Update an existing workflow
91
+ */
21
92
  updateWorkflow(workflowId: string, workflow: Partial<Workflow>): Promise<Workflow>;
93
+ /**
94
+ * Load a workflow by ID
95
+ */
22
96
  loadWorkflow(workflowId: string): Promise<Workflow>;
97
+ /**
98
+ * List all workflows
99
+ */
23
100
  listWorkflows(): Promise<Workflow[]>;
101
+ /**
102
+ * Delete a workflow
103
+ */
24
104
  deleteWorkflow(workflowId: string): Promise<void>;
105
+ /**
106
+ * Validate a workflow
107
+ */
25
108
  validateWorkflow(workflow: Workflow): Promise<{
26
109
  valid: boolean;
27
110
  errors: string[];
28
111
  }>;
112
+ /**
113
+ * Export a workflow as JSON string
114
+ */
29
115
  exportWorkflow(workflowId: string): Promise<string>;
116
+ /**
117
+ * Import a workflow from JSON
118
+ */
30
119
  importWorkflow(workflowJson: string): Promise<Workflow>;
120
+ /**
121
+ * Execute a workflow
122
+ */
31
123
  executeWorkflow(workflowId: string, inputs?: Record<string, unknown>): Promise<ExecutionResult>;
124
+ /**
125
+ * Get execution status
126
+ */
32
127
  getExecutionStatus(executionId: string): Promise<ExecutionResult>;
128
+ /**
129
+ * Cancel a running execution
130
+ */
33
131
  cancelExecution(executionId: string): Promise<void>;
132
+ /**
133
+ * Get execution logs
134
+ */
34
135
  getExecutionLogs(executionId: string): Promise<string[]>;
136
+ /**
137
+ * List available templates
138
+ */
35
139
  listTemplates(): Promise<Workflow[]>;
140
+ /**
141
+ * Get a template by ID
142
+ */
36
143
  getTemplate(templateId: string): Promise<Workflow>;
144
+ /**
145
+ * Get system health status
146
+ */
37
147
  getSystemHealth(): Promise<{
38
148
  status: string;
39
149
  timestamp: number;
40
150
  }>;
151
+ /**
152
+ * Get system configuration
153
+ */
41
154
  getSystemConfig(): Promise<Record<string, unknown>>;
155
+ /**
156
+ * Get system version information
157
+ */
42
158
  getSystemVersion(): Promise<{
43
159
  version: string;
44
160
  build: string;