@flowdrop/flowdrop 2.17.0 → 2.18.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/api/enhanced-client.d.ts +3 -1
  3. package/dist/api/enhanced-client.js +4 -2
  4. package/dist/commands/executor.js +9 -0
  5. package/dist/commands/storeIntegration.svelte.js +6 -0
  6. package/dist/commands/types.d.ts +8 -0
  7. package/dist/components/App.svelte +209 -106
  8. package/dist/components/App.svelte.d.ts +29 -0
  9. package/dist/components/FlowDropZone.svelte +7 -1
  10. package/dist/components/FlowDropZone.svelte.d.ts +5 -0
  11. package/dist/components/ImpactConfirm.svelte +246 -33
  12. package/dist/components/ImpactConfirm.svelte.d.ts +13 -3
  13. package/dist/components/Input.svelte +8 -2
  14. package/dist/components/LockBanner.svelte +76 -0
  15. package/dist/components/LockBanner.svelte.d.ts +14 -0
  16. package/dist/components/LockFence.svelte +33 -0
  17. package/dist/components/LockFence.svelte.d.ts +19 -0
  18. package/dist/components/Navbar.svelte +35 -6
  19. package/dist/components/Navbar.svelte.d.ts +6 -0
  20. package/dist/components/RunBar.svelte +16 -4
  21. package/dist/components/Textarea.svelte +7 -1
  22. package/dist/components/WorkflowEditor.svelte +32 -9
  23. package/dist/components/WorkflowInterfaceEditor.svelte +3 -0
  24. package/dist/components/WorkflowInterfaceEntryCard.svelte +21 -4
  25. package/dist/components/WorkflowPlaygroundSettings.svelte +9 -1
  26. package/dist/components/form/FieldFactory.svelte +13 -6
  27. package/dist/components/form/FormArray.svelte +0 -1
  28. package/dist/components/form/FormArrayRows.svelte +4 -4
  29. package/dist/components/form/FormCodeEditor.svelte +18 -2
  30. package/dist/components/form/FormMarkdownEditor.svelte +22 -8
  31. package/dist/components/form/FormTemplateEditor.svelte +17 -1
  32. package/dist/components/form/readOnly.d.ts +13 -0
  33. package/dist/components/form/readOnly.js +18 -0
  34. package/dist/components/nodes/CaptionNode.svelte +1 -0
  35. package/dist/components/primitives/Checkbox.svelte +5 -1
  36. package/dist/components/primitives/Select.svelte +6 -1
  37. package/dist/components/primitives/Switch.svelte +5 -1
  38. package/dist/editor/index.d.ts +1 -0
  39. package/dist/index.d.ts +2 -1
  40. package/dist/messages/defaults.d.ts +45 -0
  41. package/dist/messages/defaults.js +51 -3
  42. package/dist/openapi/v1/openapi.yaml +492 -0
  43. package/dist/registry/nodeComponentRegistry.d.ts +5 -0
  44. package/dist/schemas/v1/workflow.schema.json +2 -0
  45. package/dist/services/globalSave.d.ts +17 -0
  46. package/dist/services/globalSave.js +166 -6
  47. package/dist/services/impactGate.d.ts +7 -3
  48. package/dist/services/impactGate.js +9 -7
  49. package/dist/services/impactService.d.ts +18 -1
  50. package/dist/services/impactService.js +93 -7
  51. package/dist/services/runsService.d.ts +9 -0
  52. package/dist/services/runsService.js +13 -0
  53. package/dist/services/workflowLaunchService.d.ts +6 -0
  54. package/dist/services/workflowLaunchService.js +2 -0
  55. package/dist/stores/historyStore.svelte.d.ts +12 -2
  56. package/dist/stores/historyStore.svelte.js +25 -2
  57. package/dist/stores/instanceContainer.svelte.d.ts +7 -0
  58. package/dist/stores/instanceContainer.svelte.js +10 -0
  59. package/dist/stores/lockStore.svelte.d.ts +39 -0
  60. package/dist/stores/lockStore.svelte.js +109 -0
  61. package/dist/stores/runController.svelte.d.ts +2 -0
  62. package/dist/stores/runController.svelte.js +27 -11
  63. package/dist/stores/workflowStore.svelte.d.ts +7 -1
  64. package/dist/stores/workflowStore.svelte.js +41 -13
  65. package/dist/styles/base.css +6 -0
  66. package/dist/svelte-app.d.ts +31 -0
  67. package/dist/svelte-app.js +110 -26
  68. package/dist/types/events.d.ts +17 -0
  69. package/dist/types/impact.d.ts +52 -0
  70. package/dist/types/lock.d.ts +35 -0
  71. package/dist/types/lock.js +13 -0
  72. package/dist/types/navbar.d.ts +6 -0
  73. package/dist/utils/links.d.ts +29 -0
  74. package/dist/utils/links.js +63 -0
  75. package/dist/webmcp/runtime.js +16 -3
  76. package/dist/webmcp/types.d.ts +11 -1
  77. package/package.json +1 -1
@@ -195,6 +195,13 @@
195
195
  /** Flag to prevent update loops */
196
196
  let isInternalUpdate = false;
197
197
 
198
+ /** Compartment so the editor can turn read-only on and off after it is mounted. */
199
+ const readOnlyCompartment = new Compartment();
200
+
201
+ function readOnlyExtensions(readOnly: boolean) {
202
+ return readOnly ? [EditorState.readOnly.of(true), EditorView.editable.of(false)] : [];
203
+ }
204
+
198
205
  /** Compartment for dynamic autocomplete reconfiguration */
199
206
  const autocompleteCompartment = new Compartment();
200
207
 
@@ -267,7 +274,7 @@
267
274
  : [history(), keymap.of([...defaultKeymap, ...historyKeymap, indentWithTab])]),
268
275
 
269
276
  // Read-only: prevent document changes and mark content as non-editable
270
- ...(disabled ? [EditorState.readOnly.of(true), EditorView.editable.of(false)] : []),
277
+ readOnlyCompartment.of(readOnlyExtensions(disabled)),
271
278
 
272
279
  // Syntax highlighting - use default for light mode, oneDark handles dark mode
273
280
  ...(darkTheme ? [] : [syntaxHighlighting(defaultHighlightStyle, { fallback: true })]),
@@ -450,6 +457,15 @@
450
457
  }
451
458
  });
452
459
 
460
+ /** Follow `disabled` after mount (for example when the editor gets locked). */
461
+ $effect(() => {
462
+ const readOnly = disabled;
463
+ if (!editorView) return;
464
+ editorView.dispatch({
465
+ effects: [readOnlyCompartment.reconfigure(readOnlyExtensions(readOnly))]
466
+ });
467
+ });
468
+
453
469
  /**
454
470
  * Update editor content when value prop changes externally
455
471
  */
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Read-only context for forms.
3
+ *
4
+ * A parent (for example the lock fence) calls `provideFormReadOnly` with a getter.
5
+ * Form fields call `useFormReadOnly` and treat a `true` answer like a read-only
6
+ * schema: the value cannot be changed, but the field can still be looked at.
7
+ * The getter is read each time, so it may be reactive.
8
+ */
9
+ export declare const FORM_READ_ONLY_KEY = "flowdrop:formReadOnly";
10
+ /** Tell every form field below this component whether it is read-only. */
11
+ export declare function provideFormReadOnly(isReadOnly: () => boolean): void;
12
+ /** Whether the form around this component is read-only. Call during component setup. */
13
+ export declare function useFormReadOnly(): () => boolean;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Read-only context for forms.
3
+ *
4
+ * A parent (for example the lock fence) calls `provideFormReadOnly` with a getter.
5
+ * Form fields call `useFormReadOnly` and treat a `true` answer like a read-only
6
+ * schema: the value cannot be changed, but the field can still be looked at.
7
+ * The getter is read each time, so it may be reactive.
8
+ */
9
+ import { getContext, setContext } from 'svelte';
10
+ export const FORM_READ_ONLY_KEY = 'flowdrop:formReadOnly';
11
+ /** Tell every form field below this component whether it is read-only. */
12
+ export function provideFormReadOnly(isReadOnly) {
13
+ setContext(FORM_READ_ONLY_KEY, isReadOnly);
14
+ }
15
+ /** Whether the form around this component is read-only. Call during component setup. */
16
+ export function useFormReadOnly() {
17
+ return getContext(FORM_READ_ONLY_KEY) ?? (() => false);
18
+ }
@@ -245,6 +245,7 @@
245
245
  role="textbox"
246
246
  tabindex="0"
247
247
  aria-label={caption.editLabel}
248
+ data-lock-commit
248
249
  data-placeholder={caption.placeholder}
249
250
  bind:this={editorEl}
250
251
  {@attach editable}
@@ -14,6 +14,7 @@
14
14
  <script lang="ts">
15
15
  import type { Snippet } from 'svelte';
16
16
  import type { HTMLInputAttributes } from 'svelte/elements';
17
+ import { useFormReadOnly } from '../form/readOnly.js';
17
18
 
18
19
  interface Props extends Omit<HTMLInputAttributes, 'type' | 'checked' | 'onchange' | 'class'> {
19
20
  /** Current state. */
@@ -31,9 +32,12 @@
31
32
  label,
32
33
  onchange,
33
34
  class: className = '',
34
- disabled = false,
35
+ disabled: disabledProp = false,
35
36
  ...rest
36
37
  }: Props = $props();
38
+
39
+ const formReadOnly = useFormReadOnly();
40
+ const disabled = $derived(disabledProp || formReadOnly());
37
41
  </script>
38
42
 
39
43
  <label class="flowdrop-ui-checkbox {className}" class:flowdrop-ui-checkbox--disabled={disabled}>
@@ -22,6 +22,7 @@
22
22
  import type { Snippet } from 'svelte';
23
23
  import type { HTMLSelectAttributes } from 'svelte/elements';
24
24
  import Combobox from './Combobox.svelte';
25
+ import { useFormReadOnly } from '../form/readOnly.js';
25
26
  import { selectRendering, type SelectOption } from '../../utils/selectOptions.js';
26
27
 
27
28
  // Omit native numeric `size` so our design-token size (matching Button) wins.
@@ -59,6 +60,9 @@
59
60
  ...rest
60
61
  }: Props = $props();
61
62
 
63
+ const formReadOnly = useFormReadOnly();
64
+ const isDisabled = $derived(rest.disabled || formReadOnly());
65
+
62
66
  const rendering = $derived(options ? selectRendering(options, searchable) : 'native');
63
67
  const hasValue = $derived(options?.some((o) => o.value === value) ?? false);
64
68
 
@@ -86,7 +90,7 @@
86
90
  class={className}
87
91
  id={rest.id ?? undefined}
88
92
  name={rest.name ?? undefined}
89
- disabled={rest.disabled ?? false}
93
+ disabled={isDisabled}
90
94
  aria-label={rest['aria-label'] ?? undefined}
91
95
  aria-labelledby={rest['aria-labelledby'] ?? undefined}
92
96
  aria-describedby={rest['aria-describedby'] ?? undefined}
@@ -97,6 +101,7 @@
97
101
  <select
98
102
  class={selectClass}
99
103
  {...rest}
104
+ disabled={isDisabled}
100
105
  {...value !== undefined ? { value } : {}}
101
106
  onchange={(event) => {
102
107
  // `rest.onchange` is the caller's handler (an event handler, or a list of them).
@@ -14,6 +14,7 @@
14
14
 
15
15
  <script lang="ts">
16
16
  import type { HTMLInputAttributes } from 'svelte/elements';
17
+ import { useFormReadOnly } from '../form/readOnly.js';
17
18
 
18
19
  interface Props extends Omit<HTMLInputAttributes, 'type' | 'checked' | 'onchange' | 'class'> {
19
20
  /** Current state. */
@@ -31,9 +32,12 @@
31
32
  label,
32
33
  onchange,
33
34
  class: className = '',
34
- disabled = false,
35
+ disabled: disabledProp = false,
35
36
  ...rest
36
37
  }: Props = $props();
38
+
39
+ const formReadOnly = useFormReadOnly();
40
+ const disabled = $derived(disabledProp || formReadOnly());
37
41
  </script>
38
42
 
39
43
  <span class="flowdrop-ui-switch {className}">
@@ -78,6 +78,7 @@ export { showSuccess, showError, showWarning, showInfo, showLoading, dismissToas
78
78
  export { NodeExecutionService } from '../services/nodeExecutionService.js';
79
79
  export { saveWorkflow, updateWorkflow, getWorkflow, getWorkflows, deleteWorkflow, getWorkflowCount, initializeSampleWorkflows } from '../services/workflowStorage.js';
80
80
  export { globalSaveWorkflow, globalExportWorkflow } from '../services/globalSave.js';
81
+ export type { SaveRefusalOutcome } from '../services/globalSave.js';
81
82
  export { fetchPortConfig, validatePortConfig } from '../services/portConfigApi.js';
82
83
  export { fetchCategories, validateCategories } from '../services/categoriesApi.js';
83
84
  export { fetchDynamicSchema, resolveExternalEditUrl, getEffectiveConfigEditOptions, clearSchemaCache, invalidateSchemaCache, hasConfigEditOptions, shouldShowExternalEdit, shouldUseDynamicSchema } from '../services/dynamicSchemaService.js';
package/dist/index.d.ts CHANGED
@@ -39,5 +39,6 @@ export type { AuthProvider } from './types/auth.js';
39
39
  export type { FlowDropInstance } from './stores/instanceContainer.svelte.js';
40
40
  export type { FlowDropMountOptions, MountedFlowDropApp, RunCommandOptions } from './svelte-app.js';
41
41
  export type { FlowDropEventHandlers } from './types/events.js';
42
- export type { ImpactSeverity, ImpactItem, ImpactReport } from './types/impact.js';
42
+ export type { EditorLock, EditorLockReason, EditorLockAction } from './types/lock.js';
43
+ export type { ImpactSeverity, ImpactItem, ImpactReport, ImpactRename, ImpactRenamePlace, SavedCopy } from './types/impact.js';
43
44
  export type { Messages, MessagesOverride } from './messages/index.js';
@@ -442,6 +442,7 @@ export declare const defaultMessages: {
442
442
  readonly title: "Run this workflow";
443
443
  readonly failed: "The run could not be started.";
444
444
  readonly queued: "The run is queued. It starts when the site's queue runs (cron).";
445
+ readonly lockedUnsaved: "The editor is locked, so unsaved changes are not part of this run.";
445
446
  };
446
447
  readonly runInputsDialog: {
447
448
  readonly title: ({ name }: {
@@ -458,6 +459,7 @@ export declare const defaultMessages: {
458
459
  readonly runBar: {
459
460
  readonly label: "Run";
460
461
  readonly running: "Running";
462
+ readonly waitingForWorker: "Waiting for a worker";
461
463
  readonly waiting: "Waiting";
462
464
  readonly failed: "Failed";
463
465
  readonly done: "Done";
@@ -467,11 +469,14 @@ export declare const defaultMessages: {
467
469
  readonly open: "Open";
468
470
  readonly openLabel: "Open the run in Test mode";
469
471
  readonly openRun: "Open run";
472
+ readonly viewResult: "View result";
473
+ readonly viewResultTitle: "Open the run page to see its result";
470
474
  readonly openRunTitle: "Open the run page";
471
475
  readonly askAssistant: "Ask the Assistant";
472
476
  readonly askAssistantLabel: "Ask the Assistant about this run";
473
477
  readonly announce: {
474
478
  readonly running: "Run started.";
479
+ readonly waitingForWorker: "Run is waiting for a worker.";
475
480
  readonly waiting: "Run is waiting for you.";
476
481
  readonly failed: "Run failed.";
477
482
  readonly done: "Run finished.";
@@ -1384,6 +1389,40 @@ export declare const defaultMessages: {
1384
1389
  }) => string;
1385
1390
  readonly cancel: "Cancel";
1386
1391
  readonly save: "Save anyway";
1392
+ readonly saveRenames: "Save";
1393
+ readonly refused: {
1394
+ readonly title: "This change can't be saved";
1395
+ readonly body: ({ count }: {
1396
+ count: number;
1397
+ }) => string;
1398
+ readonly keepEditing: "Keep editing";
1399
+ readonly discard: "Discard my changes";
1400
+ readonly discarding: "Discarding…";
1401
+ readonly discardFailed: ({ message }: {
1402
+ message: string;
1403
+ }) => string;
1404
+ readonly copy: "Save as a copy";
1405
+ readonly copying: "Saving a copy…";
1406
+ readonly copyFailed: ({ message }: {
1407
+ message: string;
1408
+ }) => string;
1409
+ readonly copied: "Saved a copy of this workflow.";
1410
+ };
1411
+ readonly renames: {
1412
+ readonly heading: "Renames";
1413
+ readonly title: ({ kind, from, to }: {
1414
+ kind: string;
1415
+ from: string;
1416
+ to: string;
1417
+ }) => string;
1418
+ readonly input: "input";
1419
+ readonly output: "output";
1420
+ readonly noPlaces: "Nothing uses it yet.";
1421
+ readonly disabledPlace: "switched off";
1422
+ readonly follow: ({ count }: {
1423
+ count: number;
1424
+ }) => string;
1425
+ };
1387
1426
  };
1388
1427
  readonly webmcp: {
1389
1428
  readonly bridge: {
@@ -1464,6 +1503,7 @@ export declare const defaultMessages: {
1464
1503
  readonly savedSince: "The workflow was saved after this draft. Restoring puts your draft over that version.";
1465
1504
  readonly restore: "Restore";
1466
1505
  readonly discard: "Discard";
1506
+ readonly restoreLocked: "The editor is locked, so the draft was not restored. It is kept and offered again when the workflow next opens.";
1467
1507
  };
1468
1508
  readonly composer: {
1469
1509
  readonly placeholder: "Type a message";
@@ -1474,6 +1514,11 @@ export declare const defaultMessages: {
1474
1514
  readonly notice: {
1475
1515
  readonly dismiss: "Dismiss";
1476
1516
  };
1517
+ readonly lock: {
1518
+ readonly title: "This workflow is read-only";
1519
+ readonly learnMore: "Learn more";
1520
+ readonly saveRefused: "The editor is locked, so nothing was saved.";
1521
+ };
1477
1522
  readonly field: {
1478
1523
  readonly required: "required";
1479
1524
  readonly examples: "Examples";
@@ -383,7 +383,9 @@ export const defaultMessages = {
383
383
  // Toast when the run could not start and the server gave no message.
384
384
  failed: 'The run could not be started.',
385
385
  // Info toast when the run was accepted but waits for the site's queue.
386
- queued: "The run is queued. It starts when the site's queue runs (cron)."
386
+ queued: "The run is queued. It starts when the site's queue runs (cron).",
387
+ // Info toast when the editor is locked and the workflow has unsaved changes.
388
+ lockedUnsaved: 'The editor is locked, so unsaved changes are not part of this run.'
387
389
  },
388
390
  // The form Run opens for a workflow that has inputs.
389
391
  runInputsDialog: {
@@ -398,6 +400,8 @@ export const defaultMessages = {
398
400
  runBar: {
399
401
  label: 'Run',
400
402
  running: 'Running',
403
+ // A run that is queued while no worker has picked it up.
404
+ waitingForWorker: 'Waiting for a worker',
401
405
  waiting: 'Waiting',
402
406
  failed: 'Failed',
403
407
  done: 'Done',
@@ -407,12 +411,16 @@ export const defaultMessages = {
407
411
  open: 'Open',
408
412
  openLabel: 'Open the run in Test mode',
409
413
  openRun: 'Open run',
414
+ // The same link once the run has ended: the run page shows what it produced.
415
+ viewResult: 'View result',
416
+ viewResultTitle: 'Open the run page to see its result',
410
417
  openRunTitle: 'Open the run page',
411
418
  askAssistant: 'Ask the Assistant',
412
419
  askAssistantLabel: 'Ask the Assistant about this run',
413
420
  // Read out politely when the status changes.
414
421
  announce: {
415
422
  running: 'Run started.',
423
+ waitingForWorker: 'Run is waiting for a worker.',
416
424
  waiting: 'Run is waiting for you.',
417
425
  failed: 'Run failed.',
418
426
  done: 'Run finished.',
@@ -1184,7 +1192,40 @@ export const defaultMessages = {
1184
1192
  },
1185
1193
  failed: ({ message }) => `The check of what uses this workflow failed: ${message}`,
1186
1194
  cancel: 'Cancel',
1187
- save: 'Save anyway'
1195
+ save: 'Save anyway',
1196
+ // Shown when the only reason to ask is a rename: nothing breaks, so "anyway" would mislead.
1197
+ saveRenames: 'Save',
1198
+ // The save is refused while things use the workflow.
1199
+ refused: {
1200
+ title: "This change can't be saved",
1201
+ // `count` is the places the change breaks; none counted means no number.
1202
+ body: ({ count }) => count === 0
1203
+ ? "This change can't be saved while other things use this workflow."
1204
+ : count === 1
1205
+ ? "This change can't be saved while 1 place uses it."
1206
+ : `This change can't be saved while ${count} places use it.`,
1207
+ keepEditing: 'Keep editing',
1208
+ // Throws away every unsaved edit and loads the saved version.
1209
+ discard: 'Discard my changes',
1210
+ discarding: 'Discarding\u2026',
1211
+ discardFailed: ({ message }) => `Could not discard your changes: ${message}`,
1212
+ copy: 'Save as a copy',
1213
+ copying: 'Saving a copy\u2026',
1214
+ copyFailed: ({ message }) => `Could not save a copy: ${message}`,
1215
+ // Shown when the copy was saved and the editor stays where it is.
1216
+ copied: 'Saved a copy of this workflow.'
1217
+ },
1218
+ // Renamed inputs and outputs, and the opt-in to follow them.
1219
+ renames: {
1220
+ heading: 'Renames',
1221
+ title: ({ kind, from, to }) => `Renaming ${kind} ${from} \u2192 ${to}. Places that use it:`,
1222
+ input: 'input',
1223
+ output: 'output',
1224
+ noPlaces: 'Nothing uses it yet.',
1225
+ // After a place that is switched off.
1226
+ disabledPlace: 'switched off',
1227
+ follow: ({ count }) => count === 1 ? 'Also update this 1 place' : `Also update these ${count} places`
1228
+ }
1188
1229
  },
1189
1230
  // The confirm dialog the WebMCP adapter shows before a browser agent's change runs.
1190
1231
  webmcp: {
@@ -1243,7 +1284,8 @@ export const defaultMessages = {
1243
1284
  found: ({ time }) => `Unsaved changes from ${time} were found.`,
1244
1285
  savedSince: 'The workflow was saved after this draft. Restoring puts your draft over that version.',
1245
1286
  restore: 'Restore',
1246
- discard: 'Discard'
1287
+ discard: 'Discard',
1288
+ restoreLocked: 'The editor is locked, so the draft was not restored. It is kept and offered again when the workflow next opens.'
1247
1289
  },
1248
1290
  composer: {
1249
1291
  placeholder: 'Type a message',
@@ -1254,6 +1296,12 @@ export const defaultMessages = {
1254
1296
  notice: {
1255
1297
  dismiss: 'Dismiss'
1256
1298
  },
1299
+ lock: {
1300
+ title: 'This workflow is read-only',
1301
+ learnMore: 'Learn more',
1302
+ // A person's save (a host's own Save button, app.save()) while the editor is locked.
1303
+ saveRefused: 'The editor is locked, so nothing was saved.'
1304
+ },
1257
1305
  field: {
1258
1306
  required: 'required',
1259
1307
  examples: 'Examples'