@d34dman/flowdrop 0.0.26 → 0.0.28

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.
@@ -0,0 +1,445 @@
1
+ /**
2
+ * Dynamic Schema Service
3
+ * Handles fetching configuration schemas from REST endpoints at runtime.
4
+ * Used for nodes where the config schema cannot be determined at workflow load time.
5
+ *
6
+ * @module services/dynamicSchemaService
7
+ */
8
+ import { getEndpointConfig } from './api.js';
9
+ /**
10
+ * Schema cache with TTL support
11
+ * Key format: `{nodeTypeId}:{instanceId}` or `{nodeTypeId}` for type-level caching
12
+ */
13
+ const schemaCache = new Map();
14
+ /**
15
+ * Default cache TTL in milliseconds (5 minutes)
16
+ */
17
+ const DEFAULT_CACHE_TTL = 5 * 60 * 1000;
18
+ /**
19
+ * Resolves a template variable path from the node context.
20
+ * Supports dot-notation paths like "metadata.id", "config.apiKey", "id"
21
+ *
22
+ * @param context - The node context containing all available data
23
+ * @param path - Dot-notation path to resolve (e.g., "metadata.id")
24
+ * @returns The resolved value as a string, or undefined if not found
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * const context = { id: "node-1", metadata: { id: "llm-node" } };
29
+ * resolveVariablePath(context, "metadata.id"); // Returns "llm-node"
30
+ * resolveVariablePath(context, "id"); // Returns "node-1"
31
+ * ```
32
+ */
33
+ function resolveVariablePath(context, path) {
34
+ const parts = path.split('.');
35
+ let current = context;
36
+ for (const part of parts) {
37
+ if (current === null || current === undefined) {
38
+ return undefined;
39
+ }
40
+ if (typeof current === 'object' && part in current) {
41
+ current = current[part];
42
+ }
43
+ else {
44
+ return undefined;
45
+ }
46
+ }
47
+ // Convert to string if not already
48
+ if (current === null || current === undefined) {
49
+ return undefined;
50
+ }
51
+ return String(current);
52
+ }
53
+ /**
54
+ * Replaces template variables in a URL or string with values from the node context.
55
+ * Template variables use curly brace syntax: {variableName}
56
+ *
57
+ * @param template - The template string with variables
58
+ * @param parameterMapping - Maps variable names to context paths
59
+ * @param context - The node context containing all available data
60
+ * @returns The resolved string with all variables replaced
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * const url = "/api/nodes/{nodeTypeId}/schema?instance={instanceId}";
65
+ * const mapping = { nodeTypeId: "metadata.id", instanceId: "id" };
66
+ * const context = { id: "node-1", metadata: { id: "llm-node" } };
67
+ * resolveTemplate(url, mapping, context);
68
+ * // Returns "/api/nodes/llm-node/schema?instance=node-1"
69
+ * ```
70
+ */
71
+ function resolveTemplate(template, parameterMapping, context) {
72
+ if (!parameterMapping) {
73
+ return template;
74
+ }
75
+ let resolved = template;
76
+ // Replace each mapped variable
77
+ for (const [variableName, contextPath] of Object.entries(parameterMapping)) {
78
+ const value = resolveVariablePath(context, contextPath);
79
+ if (value !== undefined) {
80
+ // Use global regex to replace all occurrences
81
+ const regex = new RegExp(`\\{${variableName}\\}`, 'g');
82
+ resolved = resolved.replace(regex, encodeURIComponent(value));
83
+ }
84
+ }
85
+ // Also try to resolve any unmapped variables directly from context
86
+ const remainingVariables = resolved.match(/\{([^}]+)\}/g);
87
+ if (remainingVariables) {
88
+ for (const variable of remainingVariables) {
89
+ const variableName = variable.slice(1, -1); // Remove { and }
90
+ const value = resolveVariablePath(context, variableName);
91
+ if (value !== undefined) {
92
+ resolved = resolved.replace(variable, encodeURIComponent(value));
93
+ }
94
+ }
95
+ }
96
+ return resolved;
97
+ }
98
+ /**
99
+ * Generates a cache key for a schema based on the node context and endpoint configuration.
100
+ *
101
+ * @param endpoint - The dynamic schema endpoint configuration
102
+ * @param context - The node context
103
+ * @returns A unique cache key string
104
+ */
105
+ function generateCacheKey(endpoint, context) {
106
+ const url = resolveTemplate(endpoint.url, endpoint.parameterMapping, context);
107
+ return `schema:${url}`;
108
+ }
109
+ /**
110
+ * Checks if a cached schema is still valid (not expired).
111
+ *
112
+ * @param entry - The cache entry to check
113
+ * @param ttl - Time-to-live in milliseconds
114
+ * @returns True if the cache entry is still valid
115
+ */
116
+ function isCacheValid(entry, ttl = DEFAULT_CACHE_TTL) {
117
+ return Date.now() - entry.cachedAt < ttl;
118
+ }
119
+ /**
120
+ * Fetches a dynamic configuration schema from a REST endpoint.
121
+ *
122
+ * @param endpoint - The dynamic schema endpoint configuration
123
+ * @param node - The workflow node instance
124
+ * @param workflowId - Optional workflow ID for context
125
+ * @returns A promise that resolves to the schema result
126
+ *
127
+ * @example
128
+ * ```typescript
129
+ * const endpoint: DynamicSchemaEndpoint = {
130
+ * url: "/api/nodes/{nodeTypeId}/schema",
131
+ * method: "GET",
132
+ * parameterMapping: { nodeTypeId: "metadata.id" }
133
+ * };
134
+ *
135
+ * const result = await fetchDynamicSchema(endpoint, node);
136
+ * if (result.success && result.schema) {
137
+ * // Use the fetched schema
138
+ * }
139
+ * ```
140
+ */
141
+ export async function fetchDynamicSchema(endpoint, node, workflowId) {
142
+ // Build the context from the node
143
+ const context = {
144
+ id: node.id,
145
+ type: node.type,
146
+ metadata: node.data.metadata,
147
+ config: node.data.config,
148
+ extensions: node.data.extensions,
149
+ workflowId
150
+ };
151
+ // Generate cache key
152
+ const cacheKey = generateCacheKey(endpoint, context);
153
+ // Check cache first (if caching is enabled)
154
+ if (endpoint.cacheSchema !== false) {
155
+ const cached = schemaCache.get(cacheKey);
156
+ if (cached && isCacheValid(cached)) {
157
+ return {
158
+ success: true,
159
+ schema: cached.schema,
160
+ fromCache: true
161
+ };
162
+ }
163
+ }
164
+ // Resolve the URL with template variables
165
+ let url = resolveTemplate(endpoint.url, endpoint.parameterMapping, context);
166
+ // If URL is relative, try to prepend base URL from endpoint config
167
+ if (url.startsWith('/')) {
168
+ const currentConfig = getEndpointConfig();
169
+ if (currentConfig?.baseUrl) {
170
+ // Remove trailing slash from base URL and leading slash from relative URL
171
+ const baseUrl = currentConfig.baseUrl.replace(/\/$/, '');
172
+ url = `${baseUrl}${url}`;
173
+ }
174
+ }
175
+ // Prepare request options
176
+ const method = endpoint.method ?? 'GET';
177
+ const timeout = endpoint.timeout ?? 10000;
178
+ const headers = {
179
+ Accept: 'application/json',
180
+ 'Content-Type': 'application/json',
181
+ ...endpoint.headers
182
+ };
183
+ // Add auth headers from endpoint config if available
184
+ const currentConfig = getEndpointConfig();
185
+ if (currentConfig?.auth) {
186
+ if (currentConfig.auth.type === 'bearer' && currentConfig.auth.token) {
187
+ headers['Authorization'] = `Bearer ${currentConfig.auth.token}`;
188
+ }
189
+ else if (currentConfig.auth.type === 'api_key' && currentConfig.auth.apiKey) {
190
+ headers['X-API-Key'] = currentConfig.auth.apiKey;
191
+ }
192
+ else if (currentConfig.auth.type === 'custom' && currentConfig.auth.headers) {
193
+ Object.assign(headers, currentConfig.auth.headers);
194
+ }
195
+ }
196
+ // Prepare fetch options
197
+ const fetchOptions = {
198
+ method,
199
+ headers,
200
+ signal: AbortSignal.timeout(timeout)
201
+ };
202
+ // Add body for non-GET requests
203
+ if (method !== 'GET' && endpoint.body) {
204
+ // Resolve any template variables in the body
205
+ const resolvedBody = {};
206
+ for (const [key, value] of Object.entries(endpoint.body)) {
207
+ if (typeof value === 'string') {
208
+ resolvedBody[key] = resolveTemplate(value, endpoint.parameterMapping, context);
209
+ }
210
+ else {
211
+ resolvedBody[key] = value;
212
+ }
213
+ }
214
+ fetchOptions.body = JSON.stringify(resolvedBody);
215
+ }
216
+ try {
217
+ const response = await fetch(url, fetchOptions);
218
+ if (!response.ok) {
219
+ const errorText = await response.text();
220
+ return {
221
+ success: false,
222
+ error: `HTTP ${response.status}: ${errorText || response.statusText}`
223
+ };
224
+ }
225
+ const data = await response.json();
226
+ // The response could be:
227
+ // 1. Direct ConfigSchema object
228
+ // 2. Wrapped in { data: ConfigSchema } or { schema: ConfigSchema }
229
+ // 3. Wrapped in { success: true, data: ConfigSchema }
230
+ let schema;
231
+ if (data.type === 'object' && data.properties) {
232
+ // Direct ConfigSchema
233
+ schema = data;
234
+ }
235
+ else if (data.data?.type === 'object' && data.data?.properties) {
236
+ // Wrapped in { data: ... }
237
+ schema = data.data;
238
+ }
239
+ else if (data.schema?.type === 'object' && data.schema?.properties) {
240
+ // Wrapped in { schema: ... }
241
+ schema = data.schema;
242
+ }
243
+ else if (data.success && data.data?.type === 'object') {
244
+ // Wrapped in { success: true, data: ... }
245
+ schema = data.data;
246
+ }
247
+ if (!schema) {
248
+ return {
249
+ success: false,
250
+ error: 'Invalid schema format received from endpoint'
251
+ };
252
+ }
253
+ // Cache the schema (if caching is enabled)
254
+ if (endpoint.cacheSchema !== false) {
255
+ schemaCache.set(cacheKey, {
256
+ schema,
257
+ cachedAt: Date.now(),
258
+ cacheKey
259
+ });
260
+ }
261
+ return {
262
+ success: true,
263
+ schema,
264
+ fromCache: false
265
+ };
266
+ }
267
+ catch (error) {
268
+ // Handle specific error types
269
+ if (error instanceof Error) {
270
+ if (error.name === 'AbortError' || error.name === 'TimeoutError') {
271
+ return {
272
+ success: false,
273
+ error: `Request timed out after ${timeout}ms`
274
+ };
275
+ }
276
+ return {
277
+ success: false,
278
+ error: error.message
279
+ };
280
+ }
281
+ return {
282
+ success: false,
283
+ error: 'Unknown error occurred while fetching schema'
284
+ };
285
+ }
286
+ }
287
+ /**
288
+ * Resolves an external edit link URL with template variables.
289
+ *
290
+ * @param link - The external edit link configuration
291
+ * @param node - The workflow node instance
292
+ * @param workflowId - Optional workflow ID for context
293
+ * @param callbackUrl - Optional callback URL to append
294
+ * @returns The resolved URL string
295
+ *
296
+ * @example
297
+ * ```typescript
298
+ * const link: ExternalEditLink = {
299
+ * url: "https://admin.example.com/nodes/{nodeTypeId}/edit/{instanceId}",
300
+ * parameterMapping: { nodeTypeId: "metadata.id", instanceId: "id" }
301
+ * };
302
+ *
303
+ * const url = resolveExternalEditUrl(link, node, workflowId);
304
+ * // Returns "https://admin.example.com/nodes/llm-node/edit/node-1"
305
+ * ```
306
+ */
307
+ export function resolveExternalEditUrl(link, node, workflowId, callbackUrl) {
308
+ // Build the context from the node
309
+ const context = {
310
+ id: node.id,
311
+ type: node.type,
312
+ metadata: node.data.metadata,
313
+ config: node.data.config,
314
+ extensions: node.data.extensions,
315
+ workflowId
316
+ };
317
+ // Resolve the URL with template variables
318
+ let url = resolveTemplate(link.url, link.parameterMapping, context);
319
+ // Append callback URL if configured
320
+ if (callbackUrl && link.callbackUrlParam) {
321
+ const separator = url.includes('?') ? '&' : '?';
322
+ url = `${url}${separator}${link.callbackUrlParam}=${encodeURIComponent(callbackUrl)}`;
323
+ }
324
+ return url;
325
+ }
326
+ /**
327
+ * Gets the effective config edit options for a node.
328
+ * Merges node type defaults with instance-level overrides.
329
+ *
330
+ * @param node - The workflow node instance
331
+ * @returns The merged config edit options, or undefined if not configured
332
+ */
333
+ export function getEffectiveConfigEditOptions(node) {
334
+ const typeConfig = node.data.metadata?.configEdit;
335
+ const instanceConfig = node.data.extensions?.configEdit;
336
+ // If neither is defined, return undefined
337
+ if (!typeConfig && !instanceConfig) {
338
+ return undefined;
339
+ }
340
+ // If only one is defined, return it
341
+ if (!typeConfig) {
342
+ return instanceConfig;
343
+ }
344
+ if (!instanceConfig) {
345
+ return typeConfig;
346
+ }
347
+ // Merge both configurations (instance overrides type)
348
+ return {
349
+ ...typeConfig,
350
+ ...instanceConfig,
351
+ // Deep merge external edit link
352
+ externalEditLink: (instanceConfig.externalEditLink ?? typeConfig.externalEditLink)
353
+ ? {
354
+ ...typeConfig.externalEditLink,
355
+ ...instanceConfig.externalEditLink
356
+ }
357
+ : undefined,
358
+ // Deep merge dynamic schema
359
+ dynamicSchema: (instanceConfig.dynamicSchema ?? typeConfig.dynamicSchema)
360
+ ? {
361
+ ...typeConfig.dynamicSchema,
362
+ ...instanceConfig.dynamicSchema
363
+ }
364
+ : undefined
365
+ };
366
+ }
367
+ /**
368
+ * Clears the schema cache.
369
+ * Can optionally clear only entries matching a specific pattern.
370
+ *
371
+ * @param pattern - Optional pattern to match cache keys (e.g., node type ID)
372
+ */
373
+ export function clearSchemaCache(pattern) {
374
+ if (!pattern) {
375
+ schemaCache.clear();
376
+ return;
377
+ }
378
+ // Clear matching entries
379
+ for (const key of schemaCache.keys()) {
380
+ if (key.includes(pattern)) {
381
+ schemaCache.delete(key);
382
+ }
383
+ }
384
+ }
385
+ /**
386
+ * Invalidates a specific schema cache entry for a node.
387
+ *
388
+ * @param node - The workflow node to invalidate cache for
389
+ * @param endpoint - The dynamic schema endpoint configuration
390
+ */
391
+ export function invalidateSchemaCache(node, endpoint) {
392
+ const context = {
393
+ id: node.id,
394
+ type: node.type,
395
+ metadata: node.data.metadata,
396
+ config: node.data.config,
397
+ extensions: node.data.extensions
398
+ };
399
+ const cacheKey = generateCacheKey(endpoint, context);
400
+ schemaCache.delete(cacheKey);
401
+ }
402
+ /**
403
+ * Checks if a node has config edit options configured.
404
+ *
405
+ * @param node - The workflow node to check
406
+ * @returns True if the node has config edit options configured
407
+ */
408
+ export function hasConfigEditOptions(node) {
409
+ return getEffectiveConfigEditOptions(node) !== undefined;
410
+ }
411
+ /**
412
+ * Determines if external edit should be shown for a node.
413
+ *
414
+ * @param node - The workflow node to check
415
+ * @returns True if external edit link should be shown
416
+ */
417
+ export function shouldShowExternalEdit(node) {
418
+ const config = getEffectiveConfigEditOptions(node);
419
+ if (!config)
420
+ return false;
421
+ // Show external edit if configured and not preferring dynamic schema
422
+ if (config.externalEditLink) {
423
+ if (config.dynamicSchema && config.preferDynamicSchema) {
424
+ return false; // Prefer dynamic schema, so don't show external by default
425
+ }
426
+ return true;
427
+ }
428
+ return false;
429
+ }
430
+ /**
431
+ * Determines if dynamic schema should be used for a node.
432
+ *
433
+ * @param node - The workflow node to check
434
+ * @returns True if dynamic schema should be fetched
435
+ */
436
+ export function shouldUseDynamicSchema(node) {
437
+ const config = getEffectiveConfigEditOptions(node);
438
+ if (!config)
439
+ return false;
440
+ // Use dynamic schema if configured
441
+ if (config.dynamicSchema) {
442
+ return true;
443
+ }
444
+ return false;
445
+ }
@@ -147,6 +147,190 @@ export type BuiltinNodeType = 'note' | 'simple' | 'square' | 'tool' | 'gateway'
147
147
  * ```
148
148
  */
149
149
  export type NodeType = BuiltinNodeType | (string & Record<never, never>);
150
+ /**
151
+ * HTTP method types for dynamic schema endpoints
152
+ */
153
+ export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH';
154
+ /**
155
+ * Dynamic schema endpoint configuration
156
+ * Used when the config schema needs to be fetched at runtime from a REST endpoint
157
+ *
158
+ * @example
159
+ * ```typescript
160
+ * const schemaEndpoint: DynamicSchemaEndpoint = {
161
+ * url: "/api/nodes/{nodeTypeId}/schema",
162
+ * method: "GET",
163
+ * headers: { "X-Custom-Header": "value" },
164
+ * parameterMapping: {
165
+ * nodeTypeId: "metadata.id",
166
+ * instanceId: "id"
167
+ * }
168
+ * };
169
+ * ```
170
+ */
171
+ export interface DynamicSchemaEndpoint {
172
+ /**
173
+ * The URL to fetch the schema from.
174
+ * Supports template variables in curly braces (e.g., "/api/nodes/{nodeTypeId}/schema")
175
+ * Variables are resolved from node metadata, config, or instance data.
176
+ */
177
+ url: string;
178
+ /**
179
+ * HTTP method to use for fetching the schema.
180
+ * @default "GET"
181
+ */
182
+ method?: HttpMethod;
183
+ /**
184
+ * Custom headers to include in the request
185
+ */
186
+ headers?: Record<string, string>;
187
+ /**
188
+ * Maps template variables to their source paths.
189
+ * Keys are variable names used in the URL, values are dot-notation paths
190
+ * to resolve from the node context (e.g., "metadata.id", "config.apiKey", "id")
191
+ */
192
+ parameterMapping?: Record<string, string>;
193
+ /**
194
+ * Request body for POST/PUT/PATCH methods.
195
+ * Can include template variables like the URL.
196
+ */
197
+ body?: Record<string, unknown>;
198
+ /**
199
+ * Timeout in milliseconds for the schema fetch request
200
+ * @default 10000
201
+ */
202
+ timeout?: number;
203
+ /**
204
+ * Whether to cache the fetched schema per node instance
205
+ * @default true
206
+ */
207
+ cacheSchema?: boolean;
208
+ }
209
+ /**
210
+ * External edit link configuration
211
+ * Used when the node configuration should be handled by an external 3rd party form
212
+ *
213
+ * @example
214
+ * ```typescript
215
+ * const editLink: ExternalEditLink = {
216
+ * url: "https://admin.example.com/nodes/{nodeTypeId}/edit/{instanceId}",
217
+ * label: "Configure in Admin Panel",
218
+ * parameterMapping: {
219
+ * nodeTypeId: "metadata.id",
220
+ * instanceId: "id"
221
+ * },
222
+ * openInNewTab: true
223
+ * };
224
+ * ```
225
+ */
226
+ export interface ExternalEditLink {
227
+ /**
228
+ * The URL to the external edit form.
229
+ * Supports template variables in curly braces (e.g., "/admin/nodes/{nodeTypeId}/edit")
230
+ * Variables are resolved from node metadata, config, or instance data.
231
+ */
232
+ url: string;
233
+ /**
234
+ * Display label for the edit link button
235
+ * @default "Configure Externally"
236
+ */
237
+ label?: string;
238
+ /**
239
+ * Icon to display alongside the label (Iconify icon name)
240
+ * @default "heroicons:arrow-top-right-on-square"
241
+ */
242
+ icon?: string;
243
+ /**
244
+ * Maps template variables to their source paths.
245
+ * Keys are variable names used in the URL, values are dot-notation paths
246
+ * to resolve from the node context (e.g., "metadata.id", "config.apiKey", "id")
247
+ */
248
+ parameterMapping?: Record<string, string>;
249
+ /**
250
+ * Whether to open the link in a new tab
251
+ * @default true
252
+ */
253
+ openInNewTab?: boolean;
254
+ /**
255
+ * Optional tooltip/description for the link
256
+ */
257
+ description?: string;
258
+ /**
259
+ * Callback URL parameter name for FlowDrop to receive updates
260
+ * If set, the external form should redirect back with config updates
261
+ */
262
+ callbackUrlParam?: string;
263
+ }
264
+ /**
265
+ * Admin/Edit configuration for nodes with dynamic or external configuration
266
+ * Used when the config schema cannot be determined at workflow load time
267
+ * or when configuration is handled by a 3rd party system.
268
+ *
269
+ * @example
270
+ * ```typescript
271
+ * // Option 1: External edit link only (opens external form in new tab)
272
+ * const configEdit: ConfigEditOptions = {
273
+ * externalEditLink: {
274
+ * url: "https://admin.example.com/configure/{nodeId}",
275
+ * label: "Open Configuration Portal"
276
+ * }
277
+ * };
278
+ *
279
+ * // Option 2: Dynamic schema (fetches schema from REST endpoint)
280
+ * const configEdit: ConfigEditOptions = {
281
+ * dynamicSchema: {
282
+ * url: "/api/nodes/{nodeTypeId}/schema",
283
+ * method: "GET"
284
+ * }
285
+ * };
286
+ *
287
+ * // Option 3: Both (user can choose)
288
+ * const configEdit: ConfigEditOptions = {
289
+ * externalEditLink: {
290
+ * url: "https://admin.example.com/configure/{nodeId}",
291
+ * label: "Advanced Configuration"
292
+ * },
293
+ * dynamicSchema: {
294
+ * url: "/api/nodes/{nodeTypeId}/schema"
295
+ * },
296
+ * preferDynamicSchema: true
297
+ * };
298
+ * ```
299
+ */
300
+ export interface ConfigEditOptions {
301
+ /**
302
+ * External link configuration for 3rd party form
303
+ * When configured, shows a link/button to open external configuration
304
+ */
305
+ externalEditLink?: ExternalEditLink;
306
+ /**
307
+ * Dynamic schema endpoint configuration
308
+ * When configured, fetches the config schema from the specified endpoint
309
+ */
310
+ dynamicSchema?: DynamicSchemaEndpoint;
311
+ /**
312
+ * When both externalEditLink and dynamicSchema are configured,
313
+ * determines which to use by default
314
+ * @default false (prefer external link)
315
+ */
316
+ preferDynamicSchema?: boolean;
317
+ /**
318
+ * Show a "Refresh Schema" button when using dynamic schema
319
+ * Allows users to manually refresh the schema
320
+ * @default true
321
+ */
322
+ showRefreshButton?: boolean;
323
+ /**
324
+ * Message to display when schema is being loaded
325
+ * @default "Loading configuration options..."
326
+ */
327
+ loadingMessage?: string;
328
+ /**
329
+ * Message to display when schema fetch fails
330
+ * @default "Failed to load configuration. Use external editor instead."
331
+ */
332
+ errorMessage?: string;
333
+ }
150
334
  /**
151
335
  * UI-related extension settings for nodes
152
336
  * Used to control visual behavior in the workflow editor
@@ -183,6 +367,11 @@ export interface NodeExtensions {
183
367
  * Used to control visual behavior in the workflow editor
184
368
  */
185
369
  ui?: NodeUIExtensions;
370
+ /**
371
+ * Per-instance admin/edit configuration override
372
+ * Allows overriding the node type's configEdit settings for specific instances
373
+ */
374
+ configEdit?: ConfigEditOptions;
186
375
  /**
187
376
  * Namespaced extension data from 3rd party integrations
188
377
  * Use your package/organization name as the key (e.g., "myapp", "acme:analyzer")
@@ -214,6 +403,30 @@ export interface NodeMetadata {
214
403
  /** Default configuration values for this node type */
215
404
  config?: Record<string, unknown>;
216
405
  tags?: string[];
406
+ /**
407
+ * Admin/Edit configuration for nodes with dynamic or external configuration.
408
+ * Used when the config schema cannot be determined at workflow load time
409
+ * or when configuration is handled by a 3rd party system.
410
+ *
411
+ * Supports two options:
412
+ * 1. External edit link - Opens a 3rd party form in a new tab
413
+ * 2. Dynamic schema - Fetches the config schema from a REST endpoint
414
+ *
415
+ * @example
416
+ * ```typescript
417
+ * configEdit: {
418
+ * externalEditLink: {
419
+ * url: "https://admin.example.com/nodes/{nodeTypeId}/configure",
420
+ * label: "Configure in Admin Portal"
421
+ * },
422
+ * dynamicSchema: {
423
+ * url: "/api/nodes/{nodeTypeId}/schema",
424
+ * method: "GET"
425
+ * }
426
+ * }
427
+ * ```
428
+ */
429
+ configEdit?: ConfigEditOptions;
217
430
  /**
218
431
  * Custom extension properties for 3rd party integrations
219
432
  * Allows storing additional configuration and UI state data at the node type level
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.26",
5
+ "version": "0.0.28",
6
6
  "scripts": {
7
7
  "dev": "vite dev",
8
8
  "build": "vite build && npm run prepack",