@d34dman/flowdrop 0.0.4 → 0.0.5

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.
@@ -185,10 +185,8 @@
185
185
  * Initialize API endpoints
186
186
  */
187
187
  async function initializeApiEndpoints(): Promise<void> {
188
- // Use the same environment variable priority as the global save function
189
- // Prioritize VITE_API_BASE_URL since it's configured correctly
190
- const apiBaseUrl =
191
- import.meta.env.VITE_API_BASE_URL || import.meta.env.VITE_DRUPAL_API_URL || '/api/flowdrop';
188
+ // Use default API base URL - can be overridden via runtime configuration
189
+ const apiBaseUrl = '/api/flowdrop';
192
190
 
193
191
  const config = createEndpointConfig(apiBaseUrl, {
194
192
  auth: {
@@ -24,7 +24,8 @@ export interface ApiConfig {
24
24
  }
25
25
  /**
26
26
  * Default API configuration
27
- * Can be overridden by environment variables or runtime config
27
+ * For library usage, configuration should be provided at runtime
28
+ * This provides sensible defaults that can be overridden
28
29
  */
29
30
  export declare const defaultApiConfig: ApiConfig;
30
31
  /**
@@ -4,10 +4,11 @@
4
4
  */
5
5
  /**
6
6
  * Default API configuration
7
- * Can be overridden by environment variables or runtime config
7
+ * For library usage, configuration should be provided at runtime
8
+ * This provides sensible defaults that can be overridden
8
9
  */
9
10
  export const defaultApiConfig = {
10
- baseUrl: import.meta.env.VITE_API_BASE_URL || '/api/flowdrop',
11
+ baseUrl: '/api/flowdrop',
11
12
  endpoints: {
12
13
  workflows: {
13
14
  list: '/workflows',
@@ -30,19 +30,19 @@ async function ensureApiConfiguration() {
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
@@ -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.5",
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": {