@d34dman/flowdrop 0.0.4 → 0.0.6

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.
@@ -26,23 +26,23 @@ async function ensureApiConfiguration() {
26
26
  return;
27
27
  }
28
28
  }
29
- catch (error) {
29
+ catch {
30
30
  // Could not check existing API configuration, initializing
31
31
  }
32
32
  // API configuration is not initialized, so let's initialize it
33
- // Use the same environment variable priority as the App component
34
- // Prioritize VITE_API_BASE_URL since it's configured correctly
35
- const apiBaseUrl = import.meta.env.VITE_API_BASE_URL ||
36
- import.meta.env.VITE_DRUPAL_API_URL ||
37
- import.meta.env.VITE_FLOWDROP_API_URL ||
38
- (() => {
39
- // If we're in development (localhost:5173), use relative path
33
+ // Use runtime detection to determine appropriate API base URL
34
+ const apiBaseUrl = (() => {
35
+ // If we're in development (localhost:5173), use relative path
36
+ if (typeof window !== 'undefined') {
40
37
  if (window.location.hostname === 'localhost' && window.location.port === '5173') {
41
38
  return '/api/flowdrop';
42
39
  }
43
40
  // Otherwise, use the current domain
44
41
  return `${window.location.protocol}//${window.location.host}/api/flowdrop`;
45
- })();
42
+ }
43
+ // Fallback to relative path
44
+ return '/api/flowdrop';
45
+ })();
46
46
  const config = createEndpointConfig(apiBaseUrl, {
47
47
  auth: {
48
48
  type: 'none' // No authentication for now
@@ -96,7 +96,7 @@ export async function globalSaveWorkflow() {
96
96
  updatedAt: new Date().toISOString()
97
97
  }
98
98
  };
99
- const savedWorkflow = await workflowApi.saveWorkflow(finalWorkflow);
99
+ await workflowApi.saveWorkflow(finalWorkflow);
100
100
  // Dismiss loading toast and show success toast
101
101
  if (loadingToast)
102
102
  dismissToast(loadingToast);
@@ -157,9 +157,9 @@ export async function globalExportWorkflow() {
157
157
  */
158
158
  export function initializeGlobalSave() {
159
159
  if (typeof window !== 'undefined') {
160
- // @ts-ignore - Adding to window for external access
160
+ // @ts-expect-error - Adding to window for external access
161
161
  window.flowdropGlobalSave = globalSaveWorkflow;
162
- // @ts-ignore - Adding to window for external access
162
+ // @ts-expect-error - Adding to window for external access
163
163
  window.flowdropGlobalExport = globalExportWorkflow;
164
164
  }
165
165
  }
@@ -6,7 +6,6 @@
6
6
  import { mount } from 'svelte';
7
7
  import WorkflowEditor from './components/WorkflowEditor.svelte';
8
8
  import App from './components/App.svelte';
9
- import { createEndpointConfig } from './config/endpoints.js';
10
9
  import { initializePortCompatibility } from './utils/connections.js';
11
10
  import { DEFAULT_PORT_CONFIG } from './config/defaultPortConfig.js';
12
11
  import { fetchPortConfig } from './services/portConfigApi.js';
@@ -17,7 +16,7 @@ import { fetchPortConfig } from './services/portConfigApi.js';
17
16
  * @param options - Configuration options for the app
18
17
  */
19
18
  export async function mountFlowDropApp(container, options = {}) {
20
- const { workflow, nodes = [], endpointConfig, portConfig, height = '100vh', width = '100%', showNavbar = false, disableSidebar, lockWorkflow, readOnly, nodeStatuses, pipelineId, navbarTitle, navbarActions } = options;
19
+ const { workflow, endpointConfig, portConfig, height = '100vh', width = '100%', showNavbar = false, disableSidebar, lockWorkflow, readOnly, nodeStatuses, pipelineId, navbarTitle, navbarActions } = options;
21
20
  // Create endpoint configuration
22
21
  let config;
23
22
  if (endpointConfig) {
@@ -94,7 +93,7 @@ export async function mountFlowDropApp(container, options = {}) {
94
93
  * Simpler alternative to mountFlowDropApp - only mounts the editor without navbar
95
94
  */
96
95
  export async function mountWorkflowEditor(container, options = {}) {
97
- const { workflow, nodes = [], endpointConfig, portConfig } = options;
96
+ const { nodes = [], endpointConfig, portConfig } = options;
98
97
  // Create endpoint configuration
99
98
  let config;
100
99
  if (endpointConfig) {
@@ -36,6 +36,10 @@ export declare function mergeConfig(userConfig: Partial<WorkflowEditorConfig>, d
36
36
  */
37
37
  export declare function validateConfig(config: WorkflowEditorConfig): string[];
38
38
  /**
39
- * Create configuration from environment variables
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
40
44
  */
41
45
  export declare function createConfigFromEnv(): WorkflowEditorConfig;
@@ -225,24 +225,16 @@ export function validateConfig(config) {
225
225
  return errors;
226
226
  }
227
227
  /**
228
- * Create configuration from environment variables
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
229
233
  */
230
234
  export function createConfigFromEnv() {
231
- const apiBaseUrl = import.meta.env.VITE_FLOWDROP_API_URL || '/api/flowdrop';
235
+ // Return default configuration without environment variables
236
+ // Configuration should be provided at runtime via props/parameters
237
+ const apiBaseUrl = '/api/flowdrop';
232
238
  const endpointConfig = createEndpointConfig(apiBaseUrl);
233
- const config = createDefaultConfig(endpointConfig);
234
- // Override with environment variables
235
- if (import.meta.env.VITE_FLOWDROP_THEME) {
236
- config.theme = import.meta.env.VITE_FLOWDROP_THEME;
237
- }
238
- if (import.meta.env.VITE_FLOWDROP_TIMEOUT) {
239
- config.api.timeout = parseInt(import.meta.env.VITE_FLOWDROP_TIMEOUT);
240
- }
241
- if (import.meta.env.VITE_FLOWDROP_AUTH_TYPE) {
242
- config.api.auth.type = import.meta.env.VITE_FLOWDROP_AUTH_TYPE;
243
- }
244
- if (import.meta.env.VITE_FLOWDROP_AUTH_TOKEN) {
245
- config.api.auth.token = import.meta.env.VITE_FLOWDROP_AUTH_TOKEN;
246
- }
247
- return config;
239
+ return createDefaultConfig(endpointConfig);
248
240
  }
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.4",
5
+ "version": "0.0.6",
6
6
  "scripts": {
7
7
  "dev": "vite dev",
8
8
  "build": "vite build && npm run prepack",
@@ -80,6 +80,7 @@
80
80
  "./styles/base.css": "./dist/styles/base.css"
81
81
  },
82
82
  "peerDependencies": {
83
+ "@sveltejs/kit": "^2.0.0",
83
84
  "svelte": "^5.0.0"
84
85
  },
85
86
  "devDependencies": {