@flowdrop/flowdrop 2.1.1 → 2.2.0

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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.2.0] - 2026-08-18
11
+
12
+ ### Added
13
+
14
+ - **`workflowFormats` mount option.** Pass the format ids a host actually supports (e.g. `['flowdrop']`) to scope the "Workflow Format" select in Workflow Settings to that set. With one or zero options remaining the field is hidden entirely rather than rendered as a single-choice select, and an unknown id filters to nothing instead of erroring. Omit the option to keep offering every registered format.
15
+
16
+ ### Fixed
17
+
18
+ - **Applying workflow settings could rewrite a non-default format.** When the format field is absent from the settings form the applied config carries no `format` key, and the handler fell back to `DEFAULT_WORKFLOW_FORMAT` — silently rewriting a workflow's stored format on an unrelated name or description edit. It now falls back to the workflow's current format.
19
+
10
20
  ## [2.1.1] - 2026-08-18
11
21
 
12
22
  ### Fixed
@@ -163,6 +163,13 @@
163
163
  swapStrategies?: SwapStrategy[];
164
164
  /** Additional JSON Schema properties to show in the Workflow Settings panel. Values are persisted in workflow.config. */
165
165
  workflowSettingsSchema?: ConfigSchema;
166
+ /**
167
+ * Format ids this host supports (e.g. `['flowdrop']`). Filters the
168
+ * "Workflow Format" options in the Workflow Settings panel; when one or
169
+ * zero options remain the field is hidden entirely and the stored format
170
+ * is left untouched. Omit to offer every registered format.
171
+ */
172
+ workflowFormats?: string[];
166
173
  /**
167
174
  * Override user-facing strings. Pass either a partial of the `Messages`
168
175
  * tree directly, or a callback that returns one. Missing keys fall through
@@ -212,6 +219,7 @@
212
219
  showSettingsResetButton,
213
220
  swapStrategies,
214
221
  workflowSettingsSchema,
222
+ workflowFormats,
215
223
  messages: messagesOverride,
216
224
  instance
217
225
  }: Props = $props();
@@ -371,6 +379,15 @@
371
379
  // workflowSettingsSchema field, but a consumer schema could still collide.
372
380
  const WORKFLOW_SETTINGS_RESERVED = new Set(['name', 'description', 'format', 'interface']);
373
381
 
382
+ // Registered formats this host offers — the mount-level `workflowFormats`
383
+ // allowlist filters the registry (an unknown id filters to nothing rather
384
+ // than erroring; the field simply hides).
385
+ let workflowFormatOptions = $derived(
386
+ fd.formats
387
+ .getOneOfOptions()
388
+ .filter((option) => !workflowFormats || workflowFormats.includes(option.const))
389
+ );
390
+
374
391
  // Workflow configuration schema (derived to pick up dynamic format options)
375
392
  let workflowConfigSchema: ConfigSchema = $derived.by(() => {
376
393
  const extraProps = Object.fromEntries(
@@ -403,13 +420,18 @@
403
420
  format: 'multiline',
404
421
  default: ''
405
422
  },
406
- format: {
407
- type: 'string',
408
- title: 'Workflow Format',
409
- description: 'The specification format for this workflow',
410
- oneOf: fd.formats.getOneOfOptions(),
411
- default: 'flowdrop'
412
- },
423
+ // A format choice is only real when the host supports more than one
424
+ // format: with a single (or empty) filtered option set the field is
425
+ // hidden, and the stored format is preserved on apply (see onChange).
426
+ ...(workflowFormatOptions.length > 1 && {
427
+ format: {
428
+ type: 'string' as const,
429
+ title: 'Workflow Format',
430
+ description: 'The specification format for this workflow',
431
+ oneOf: workflowFormatOptions,
432
+ default: 'flowdrop'
433
+ }
434
+ }),
413
435
  ...extraProps
414
436
  },
415
437
  required: ['name', ...extraRequired]
@@ -420,7 +442,9 @@
420
442
  let workflowConfigValues = $derived({
421
443
  name: fd.workflow.name || '',
422
444
  description: fd.workflow.current?.description || '',
423
- format: fd.workflow.current?.metadata?.format || 'flowdrop',
445
+ ...(workflowFormatOptions.length > 1 && {
446
+ format: fd.workflow.current?.metadata?.format || 'flowdrop'
447
+ }),
424
448
  ...(fd.workflow.current?.config ?? {})
425
449
  });
426
450
 
@@ -1183,8 +1207,11 @@
1183
1207
  // Sync workflow settings changes immediately on field blur
1184
1208
  const wf = fd.workflow.current;
1185
1209
  if (wf) {
1186
- const newFormat = (config.format as string) || DEFAULT_WORKFLOW_FORMAT;
1187
1210
  const currentFormat = wf.metadata?.format || DEFAULT_WORKFLOW_FORMAT;
1211
+ // Fall back to the CURRENT format, not the default: when the field is
1212
+ // hidden (host supports one format) config.format is absent, and
1213
+ // applying name/description must not silently rewrite the format.
1214
+ const newFormat = (config.format as string) || currentFormat;
1188
1215
 
1189
1216
  // Warn about incompatible nodes when format changes
1190
1217
  if (newFormat !== currentFormat) {
@@ -109,6 +109,13 @@ interface Props {
109
109
  swapStrategies?: SwapStrategy[];
110
110
  /** Additional JSON Schema properties to show in the Workflow Settings panel. Values are persisted in workflow.config. */
111
111
  workflowSettingsSchema?: ConfigSchema;
112
+ /**
113
+ * Format ids this host supports (e.g. `['flowdrop']`). Filters the
114
+ * "Workflow Format" options in the Workflow Settings panel; when one or
115
+ * zero options remain the field is hidden entirely and the stored format
116
+ * is left untouched. Omit to offer every registered format.
117
+ */
118
+ workflowFormats?: string[];
112
119
  /**
113
120
  * Override user-facing strings. Pass either a partial of the `Messages`
114
121
  * tree directly, or a callback that returns one. Missing keys fall through
@@ -101,6 +101,13 @@ export interface FlowDropMountOptions {
101
101
  draftStorage?: DraftStorageOption;
102
102
  /** Custom workflow format adapters to register */
103
103
  formatAdapters?: WorkflowFormatAdapter[];
104
+ /**
105
+ * Format ids this host supports (e.g. `['flowdrop']`). Filters the
106
+ * "Workflow Format" options in the Workflow Settings panel; when one or
107
+ * zero options remain the field is hidden entirely and the stored format
108
+ * is left untouched. Omit to offer every registered format.
109
+ */
110
+ workflowFormats?: string[];
104
111
  /** Visual theme — named built-in ('default' | 'minimal') or custom theme object */
105
112
  theme?: FlowDropTheme | FlowDropThemeName;
106
113
  /** Which settings tabs to show in the modal (defaults to all) */
@@ -132,7 +132,7 @@ async function configureInstance(fd, options) {
132
132
  * ```
133
133
  */
134
134
  export async function mountFlowDropApp(container, options = {}) {
135
- const { workflow, nodes, endpointConfig, portConfig, categories, height = '100vh', width = '100%', showNavbar = false, disableSidebar, configPlacement, consolePlacement, mode, pipelineId, navbarTitle, navbarActions, showSettings, showStatus, authProvider, eventHandlers, features: userFeatures, settings: initialSettings, draftStorageKey: customDraftKey, draftStorage, formatAdapters, theme, settingsCategories, showSettingsSyncButton, showSettingsResetButton, instanceId } = options;
135
+ const { workflow, nodes, endpointConfig, portConfig, categories, height = '100vh', width = '100%', showNavbar = false, disableSidebar, configPlacement, consolePlacement, mode, pipelineId, navbarTitle, navbarActions, showSettings, showStatus, authProvider, eventHandlers, features: userFeatures, settings: initialSettings, draftStorageKey: customDraftKey, draftStorage, formatAdapters, workflowFormats, theme, settingsCategories, showSettingsSyncButton, showSettingsResetButton, instanceId } = options;
136
136
  // Per-instance state container — this is what allows multiple FlowDrop
137
137
  // editors to coexist on one page without sharing workflow/history state.
138
138
  const { fd, isDefault } = acquireInstance(instanceId);
@@ -206,7 +206,8 @@ export async function mountFlowDropApp(container, options = {}) {
206
206
  theme,
207
207
  settingsCategories,
208
208
  showSettingsSyncButton,
209
- showSettingsResetButton
209
+ showSettingsResetButton,
210
+ workflowFormats
210
211
  }
211
212
  });
212
213
  // Set up draft auto-save manager
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A drop-in visual workflow editor for any web application. You own the backend. You own the data. You own the orchestration.",
4
4
  "license": "MIT",
5
5
  "private": false,
6
- "version": "2.1.1",
6
+ "version": "2.2.0",
7
7
  "author": "Shibin Das (D34dMan)",
8
8
  "bugs": {
9
9
  "url": "https://github.com/flowdrop-io/flowdrop/issues"