windmill-components 1.35.43 → 1.36.1

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 (155) hide show
  1. package/components/AppConnect.svelte +85 -59
  2. package/components/ArgInput.svelte +31 -14
  3. package/components/Button.svelte +15 -48
  4. package/components/Button.svelte.d.ts +1 -1
  5. package/components/CronInput.svelte +1 -1
  6. package/components/DisplayResult.svelte +31 -29
  7. package/components/Dropdown.svelte +9 -7
  8. package/components/Editor.svelte +10 -14
  9. package/components/EditorBar.svelte +115 -91
  10. package/components/FlowBuilder.svelte +63 -74
  11. package/components/FlowPreviewContent.svelte +44 -24
  12. package/components/FlowStatusViewer.svelte +2 -5
  13. package/components/FlowViewer.svelte +12 -10
  14. package/components/GroupModal.svelte +10 -1
  15. package/components/HighlightCode.svelte +4 -3
  16. package/components/InputTransformForm.svelte +15 -14
  17. package/components/InputTransformsViewer.svelte +1 -1
  18. package/components/InviteGlobalUser.svelte +8 -8
  19. package/components/InviteUser.svelte +9 -9
  20. package/components/ItemPicker.svelte +36 -29
  21. package/components/ItemPicker.svelte.d.ts +2 -1
  22. package/components/JobStatus.svelte +2 -1
  23. package/components/ModulePreview.svelte +7 -8
  24. package/components/Path.svelte +1 -1
  25. package/components/RadioButton.svelte +3 -2
  26. package/components/ResourceEditor.svelte +22 -34
  27. package/components/ResourceTypePicker.svelte +23 -34
  28. package/components/RunForm.svelte +23 -31
  29. package/components/SchemaEditor.svelte +16 -10
  30. package/components/SchemaForm.svelte +3 -1
  31. package/components/SchemaForm.svelte.d.ts +1 -0
  32. package/components/SchemaModal.svelte +18 -7
  33. package/components/ScriptBuilder.svelte +22 -17
  34. package/components/ScriptEditor.svelte +2 -1
  35. package/components/ScriptPicker.svelte +21 -11
  36. package/components/ScriptSchema.svelte +8 -11
  37. package/components/ScriptSchema.svelte.d.ts +0 -1
  38. package/components/ShareModal.svelte +6 -6
  39. package/components/SimpleEditor.svelte +10 -10
  40. package/components/StringTypeNarrowing.svelte +24 -30
  41. package/components/TestJobLoader.svelte +15 -7
  42. package/components/Tooltip.svelte +1 -1
  43. package/components/VariableEditor.svelte +15 -24
  44. package/components/common/actionRow/ActionRow.svelte +11 -6
  45. package/components/common/actionRow/ActionRow.svelte.d.ts +1 -0
  46. package/components/common/badge/Badge.svelte +2 -8
  47. package/components/common/badge/model.d.ts +1 -1
  48. package/components/common/button/Button.svelte +45 -79
  49. package/components/common/button/Button.svelte.d.ts +14 -15
  50. package/components/common/button/ButtonPopup.svelte +67 -0
  51. package/components/common/button/ButtonPopup.svelte.d.ts +33 -0
  52. package/components/common/button/ButtonPopupItem.svelte +47 -0
  53. package/components/common/button/ButtonPopupItem.svelte.d.ts +27 -0
  54. package/components/common/button/model.d.ts +14 -1
  55. package/components/common/button/model.js +26 -1
  56. package/components/common/confirmationModal/ConfirmationModal.svelte +19 -2
  57. package/components/common/confirmationModal/UnsavedConfirmationModal.svelte +41 -0
  58. package/components/common/confirmationModal/UnsavedConfirmationModal.svelte.d.ts +14 -0
  59. package/components/common/confirmationModal/dirtyStore.d.ts +1 -0
  60. package/components/common/confirmationModal/dirtyStore.js +2 -0
  61. package/components/common/drawer/Drawer.svelte +1 -0
  62. package/components/common/drawer/Drawer.svelte.d.ts +2 -0
  63. package/components/common/drawer/DrawerContent.svelte +1 -1
  64. package/components/common/index.d.ts +4 -0
  65. package/components/common/index.js +4 -0
  66. package/components/common/kbd/Kbd.svelte +7 -0
  67. package/components/common/kbd/Kbd.svelte.d.ts +27 -0
  68. package/components/common/popup/Popup.svelte +147 -0
  69. package/components/common/popup/Popup.svelte.d.ts +46 -0
  70. package/components/flows/FlowEditor.svelte +7 -7
  71. package/components/flows/FlowEditor.svelte.d.ts +3 -1
  72. package/components/flows/common/FlowCardHeader.svelte +1 -1
  73. package/components/flows/content/FlowEditorPanel.svelte +5 -6
  74. package/components/flows/content/FlowEditorPanel.svelte.d.ts +3 -1
  75. package/components/flows/content/FlowFailureModule.svelte +2 -4
  76. package/components/flows/content/FlowInput.svelte +5 -1
  77. package/components/flows/content/FlowInputs.svelte +27 -12
  78. package/components/flows/content/FlowInputs.svelte.d.ts +1 -0
  79. package/components/flows/content/FlowLoop.svelte +159 -29
  80. package/components/flows/content/FlowLoop.svelte.d.ts +5 -1
  81. package/components/flows/content/FlowLoopWrapper.svelte +9 -0
  82. package/components/flows/content/FlowLoopWrapper.svelte.d.ts +14 -0
  83. package/components/flows/content/FlowModule.svelte +31 -10
  84. package/components/flows/content/FlowModule.svelte.d.ts +1 -1
  85. package/components/flows/content/FlowModuleEarlyStop.svelte +76 -0
  86. package/components/flows/content/FlowModuleEarlyStop.svelte.d.ts +17 -0
  87. package/components/flows/content/FlowModuleHeader.svelte +92 -3
  88. package/components/flows/content/FlowModuleHeader.svelte.d.ts +3 -0
  89. package/components/flows/content/FlowModuleSuspend.svelte +27 -0
  90. package/components/flows/content/FlowModuleSuspend.svelte.d.ts +17 -0
  91. package/components/flows/content/FlowModuleWrapper.svelte +4 -6
  92. package/components/flows/content/FlowRetries.svelte +18 -18
  93. package/components/flows/content/FlowRetries.svelte.d.ts +4 -1
  94. package/components/flows/content/FlowSettings.svelte +51 -11
  95. package/components/flows/content/FlowSettings.svelte.d.ts +1 -0
  96. package/components/flows/content/RemoveStepConfirmationModal.svelte +1 -1
  97. package/components/flows/flowStateUtils.d.ts +1 -1
  98. package/components/flows/flowStateUtils.js +2 -2
  99. package/components/flows/header/FlowImportExportMenu.svelte +4 -5
  100. package/components/flows/header/FlowPreviewButtons.svelte +24 -16
  101. package/components/flows/map/FlowErrorHandlerItem.svelte +14 -8
  102. package/components/flows/map/FlowModuleSchemaItem.svelte +41 -19
  103. package/components/flows/map/FlowModuleSchemaItem.svelte.d.ts +6 -1
  104. package/components/flows/map/FlowModuleSchemaMap.svelte +86 -6
  105. package/components/flows/pickers/PickHubScript.svelte +1 -0
  106. package/components/flows/pickers/model.d.ts +5 -0
  107. package/components/flows/pickers/model.js +1 -0
  108. package/components/flows/propPicker/PropPickerWrapper.svelte +3 -1
  109. package/components/flows/propPicker/PropPickerWrapper.svelte.d.ts +2 -0
  110. package/components/flows/types.d.ts +0 -1
  111. package/components/flows/utils.d.ts +2 -0
  112. package/components/flows/utils.js +19 -0
  113. package/components/icons/AirtableIcon.svelte +1 -1
  114. package/components/icons/DiscordIcon.svelte +1 -1
  115. package/components/icons/GCloudIcon.svelte +1 -1
  116. package/components/icons/GItlabIcon.svelte +1 -1
  117. package/components/icons/GSheetsIcon.svelte +1 -1
  118. package/components/icons/GcalIcon.svelte +1 -1
  119. package/components/icons/GdriveIcon.svelte +1 -1
  120. package/components/icons/GithubIcon.svelte +1 -1
  121. package/components/icons/GmailIcon.svelte +1 -1
  122. package/components/icons/MastodonIcon.svelte +1 -1
  123. package/components/icons/MatrixIcon.svelte +1 -1
  124. package/components/icons/PostgresIcon.svelte +1 -1
  125. package/components/icons/S3Icon.svelte +1 -1
  126. package/components/icons/Slack.svelte +1 -1
  127. package/components/icons/TogglIcon.svelte +8 -46
  128. package/components/jobs/JobDetail.svelte +1 -1
  129. package/components/propertyPicker/ObjectViewer.svelte +9 -12
  130. package/components/propertyPicker/ObjectViewer.svelte.d.ts +1 -0
  131. package/components/propertyPicker/PropPicker.svelte +85 -14
  132. package/components/script_editor/LogPanel.svelte +1 -1
  133. package/components/scripts/CreateActions.svelte +114 -0
  134. package/components/scripts/CreateActions.svelte.d.ts +14 -0
  135. package/editorUtils.d.ts +3 -0
  136. package/editorUtils.js +1 -0
  137. package/gen/core/OpenAPI.js +1 -1
  138. package/gen/index.d.ts +1 -0
  139. package/gen/models/FlowModule.d.ts +2 -0
  140. package/gen/models/FlowValue.d.ts +1 -11
  141. package/gen/models/Retry.d.ts +11 -0
  142. package/gen/models/Retry.js +4 -0
  143. package/package.json +25 -15
  144. package/script_helpers.d.ts +4 -1
  145. package/script_helpers.js +48 -4
  146. package/stateMachine.d.ts +30 -0
  147. package/stateMachine.js +41 -0
  148. package/utils.d.ts +5 -3
  149. package/utils.js +32 -20
  150. package/components/flows/content/FlowModuleAdvancedSettings.svelte +0 -64
  151. package/components/flows/content/FlowModuleAdvancedSettings.svelte.d.ts +0 -17
  152. package/components/flows/header/FlowEditorHeader.svelte +0 -23
  153. package/components/flows/header/FlowEditorHeader.svelte.d.ts +0 -14
  154. package/components/flows/header/FlowStatus.svelte +0 -36
  155. package/components/flows/header/FlowStatus.svelte.d.ts +0 -14
@@ -19,21 +19,25 @@ import { flowStateStore } from '../flowState';
19
19
  import { scriptLangToEditorLang } from '../../../utils';
20
20
  import PropPickerWrapper from '../propPicker/PropPickerWrapper.svelte';
21
21
  import { getContext, setContext } from 'svelte';
22
- import FlowModuleAdvancedSettings from './FlowModuleAdvancedSettings.svelte';
23
- import { loadSchemaFromModule } from '../utils';
22
+ import { loadSchemaFromModule, selectedIdToIndexes } from '../utils';
24
23
  import { writable } from 'svelte/store';
25
24
  import FlowModuleScript from './FlowModuleScript.svelte';
26
- const { selectedId, select } = getContext('FlowEditorContext');
25
+ import FlowModuleEarlyStop from './FlowModuleEarlyStop.svelte';
26
+ import FlowModuleSuspend from './FlowModuleSuspend.svelte';
27
+ import FlowRetries from './FlowRetries.svelte';
28
+ const { selectedId, select, previewArgs } = getContext('FlowEditorContext');
27
29
  export let flowModule;
28
- export let previewArgs = {};
29
30
  export let flowModuleState;
30
- $: [parentIndex, childIndex] = $selectedId.split('-').map(Number);
31
+ export let failureModule;
32
+ $: [parentIndex, childIndex] = selectedIdToIndexes($selectedId);
31
33
  let editor;
32
34
  let modulePreview;
33
35
  let websocketAlive = { pyright: false, black: false, deno: false };
34
36
  let selected = 'inputs';
35
37
  $: shouldPick = isEmptyFlowModule(flowModule);
36
- $: stepPropPicker = getStepPropPicker($selectedId.split('-').map(Number), $flowStore.schema, $flowStateStore, previewArgs);
38
+ $: stepPropPicker = failureModule
39
+ ? { pickableProperties: { previous_result: { error: 'the error message' } }, extraLib: '' }
40
+ : getStepPropPicker([parentIndex, childIndex], $flowStore.schema, $flowStateStore, $previewArgs);
37
41
  function onKeyDown(event) {
38
42
  if ((event.ctrlKey || event.metaKey) && event.key == 'Enter') {
39
43
  event.preventDefault();
@@ -73,6 +77,8 @@ setContext('FlowModuleWidth', {
73
77
  <FlowModuleHeader
74
78
  bind:module={flowModule}
75
79
  on:delete
80
+ on:toggleRetry={() => (selected = 'retries')}
81
+ on:toggleStopAfterIf={() => (selected = 'early-stop')}
76
82
  on:fork={() => apply(fork, flowModule)}
77
83
  on:createScriptFromInlineScript={() => {
78
84
  apply(createScriptFromInlineScript, {
@@ -100,6 +106,7 @@ setContext('FlowModuleWidth', {
100
106
  kind: e.detail.kind,
101
107
  subkind: e.detail.subkind
102
108
  })}
109
+ {failureModule}
103
110
  />
104
111
  {:else}
105
112
  {#if flowModule.value.type === 'rawscript'}
@@ -147,14 +154,16 @@ setContext('FlowModuleWidth', {
147
154
  <Tabs bind:selected>
148
155
  <Tab value="inputs">Inputs</Tab>
149
156
  <Tab value="test">Test</Tab>
157
+ <Tab value="retries">Retries</Tab>
150
158
  {#if !$selectedId.includes('failure')}
151
- <Tab value="advanced">Advanced</Tab>
159
+ <Tab value="early-stop">Early Stop</Tab>
160
+ <Tab value="suspend">Suspend</Tab>
152
161
  {/if}
153
162
 
154
163
  <svelte:fragment slot="content">
155
164
  <div class="overflow-hidden bg-white" style="height:calc(100% - 32px);">
156
165
  <TabContent value="inputs" class="flex flex-col flex-1 h-full">
157
- <PropPickerWrapper bind:pickableProperties={stepPropPicker.pickableProperties}>
166
+ <PropPickerWrapper pickableProperties={stepPropPicker.pickableProperties}>
158
167
  <!-- <pre class="text-xs">{JSON.stringify($flowStateStore, null, 4)}</pre> -->
159
168
  <SchemaForm
160
169
  schema={flowModuleState.schema}
@@ -174,9 +183,21 @@ setContext('FlowModuleWidth', {
174
183
  />
175
184
  </TabContent>
176
185
 
177
- <TabContent value="advanced" class="flex flex-col flex-1 h-full">
186
+ <TabContent value="retries" class="flex flex-col flex-1 h-full">
178
187
  <div class="p-4 overflow-y-auto">
179
- <FlowModuleAdvancedSettings bind:flowModule />
188
+ <FlowRetries bind:flowModule />
189
+ </div>
190
+ </TabContent>
191
+
192
+ <TabContent value="early-stop" class="flex flex-col flex-1 h-full">
193
+ <div class="p-4 overflow-y-auto">
194
+ <FlowModuleEarlyStop bind:flowModule />
195
+ </div>
196
+ </TabContent>
197
+
198
+ <TabContent value="suspend" class="flex flex-col flex-1 h-full">
199
+ <div class="p-4 overflow-y-auto">
200
+ <FlowModuleSuspend bind:flowModule />
180
201
  </div>
181
202
  </TabContent>
182
203
  </div>
@@ -9,8 +9,8 @@ import { type Writable } from 'svelte/store';
9
9
  declare const __propDef: {
10
10
  props: {
11
11
  flowModule: FlowModule;
12
- previewArgs?: Record<string, any> | undefined;
13
12
  flowModuleState: FlowModuleState;
13
+ failureModule: boolean;
14
14
  FLOW_MODULE_WIDTH_THRESHOLD?: 768 | undefined;
15
15
  };
16
16
  events: {
@@ -0,0 +1,76 @@
1
+ <script>import SimpleEditor from '../../SimpleEditor.svelte';
2
+ import Toggle from '../../Toggle.svelte';
3
+ import PropPickerWrapper from '../propPicker/PropPickerWrapper.svelte';
4
+ import { getStepPropPicker } from '../flowStateUtils';
5
+ import { flowStore } from '../flowStore';
6
+ import { flowStateStore } from '../flowState';
7
+ import { getContext } from 'svelte';
8
+ import { selectedIdToIndexes } from '../utils';
9
+ const { selectedId, previewArgs } = getContext('FlowEditorContext');
10
+ export let flowModule;
11
+ let editor = undefined;
12
+ $: isStopAfterIfEnabled = Boolean(flowModule.stop_after_if);
13
+ let pickableProperties = {};
14
+ $: {
15
+ let indices = selectedIdToIndexes($selectedId);
16
+ if (indices[1]) {
17
+ indices[1] += 1;
18
+ }
19
+ else {
20
+ indices[0] += 1;
21
+ }
22
+ const props = getStepPropPicker(indices, $flowStore.schema, $flowStateStore, $previewArgs).pickableProperties;
23
+ props['result'] = props['previous_result'];
24
+ delete props['previous_result'];
25
+ props.step = props.step?.slice(0, props.step.length - 1);
26
+ pickableProperties = props;
27
+ }
28
+ </script>
29
+
30
+ <div class="flex flex-col items-start space-y-2">
31
+ <Toggle
32
+ checked={isStopAfterIfEnabled}
33
+ on:change={() => {
34
+ if (isStopAfterIfEnabled && flowModule.stop_after_if) {
35
+ flowModule.stop_after_if = undefined
36
+ } else {
37
+ flowModule.stop_after_if = {
38
+ expr: 'result == undefined',
39
+ skip_if_stopped: false
40
+ }
41
+ }
42
+ }}
43
+ options={{
44
+ right: 'Early stop if condition met'
45
+ }}
46
+ />
47
+
48
+ {#if flowModule.stop_after_if}
49
+ <span class="text-xs font-bold">Should skip if stopped</span>
50
+
51
+ <input type="checkbox" bind:checked={flowModule.stop_after_if.skip_if_stopped} />
52
+
53
+ <span class="text-xs font-bold">Stop condition expression</span>
54
+
55
+ <div class="border w-full">
56
+ <PropPickerWrapper
57
+ {pickableProperties}
58
+ on:select={({ detail }) => {
59
+ editor?.insertAtCursor(detail)
60
+ }}
61
+ >
62
+ <SimpleEditor
63
+ bind:this={editor}
64
+ lang="javascript"
65
+ bind:code={flowModule.stop_after_if.expr}
66
+ class="small-editor"
67
+ />
68
+ </PropPickerWrapper>
69
+ </div>
70
+ {:else}
71
+ <span class="text-xs font-bold">Should skip if stopped</span>
72
+ <input type="checkbox" disabled />
73
+ <span class="text-xs font-bold">Stop condition expression</span>
74
+ <textarea disabled rows="3" />
75
+ {/if}
76
+ </div>
@@ -0,0 +1,17 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { FlowModule } from '../../../gen';
3
+ declare const __propDef: {
4
+ props: {
5
+ flowModule: FlowModule;
6
+ };
7
+ events: {
8
+ [evt: string]: CustomEvent<any>;
9
+ };
10
+ slots: {};
11
+ };
12
+ export declare type FlowModuleEarlyStopProps = typeof __propDef.props;
13
+ export declare type FlowModuleEarlyStopEvents = typeof __propDef.events;
14
+ export declare type FlowModuleEarlyStopSlots = typeof __propDef.slots;
15
+ export default class FlowModuleEarlyStop extends SvelteComponentTyped<FlowModuleEarlyStopProps, FlowModuleEarlyStopEvents, FlowModuleEarlyStopSlots> {
16
+ }
17
+ export {};
@@ -1,7 +1,9 @@
1
1
  <script>import Button from '../../common/button/Button.svelte';
2
2
  import { isEmptyFlowModule } from '../flowStateUtils';
3
- import { faCodeBranch, faSave, faTrashAlt } from '@fortawesome/free-solid-svg-icons';
3
+ import { classNames } from '../../../utils';
4
+ import { faArrowRotateBack, faArrowRotateForward, faBed, faCodeBranch, faSave, faStop, faTrashAlt } from '@fortawesome/free-solid-svg-icons';
4
5
  import { createEventDispatcher, getContext } from 'svelte';
6
+ import Icon from 'svelte-awesome';
5
7
  import RemoveStepConfirmationModal from './RemoveStepConfirmationModal.svelte';
6
8
  export let module;
7
9
  let confirmationModalOpen = false;
@@ -10,9 +12,30 @@ const dispatch = createEventDispatcher();
10
12
  const { selectedId, select } = getContext('FlowEditorContext');
11
13
  const { width, threshold } = getContext('FlowModuleWidth');
12
14
  $: iconOnly = $width < threshold;
15
+ $: moduleRetry = module.retry?.constant || module.retry?.exponential;
13
16
  </script>
14
17
 
15
18
  <div class="flex flex-row space-x-2">
19
+ {#if !shouldPick}
20
+ <span
21
+ class={classNames('badge', module.stop_after_if ? 'badge-on' : 'badge-off')}
22
+ on:click={() => dispatch('toggleStopAfterIf')}
23
+ >
24
+ <Icon data={faStop} scale={0.8} />
25
+ </span>
26
+ <span
27
+ class={classNames('badge', moduleRetry ? 'badge-on' : 'badge-off')}
28
+ on:click={() => dispatch('toggleRetry')}
29
+ >
30
+ <Icon data={faArrowRotateForward} scale={0.8} />
31
+ </span>
32
+ <span
33
+ class={classNames('badge', Boolean(module.suspend) ? 'badge-on' : 'badge-off')}
34
+ on:click={() => dispatch('toggleSuspend')}
35
+ >
36
+ <Icon data={faBed} scale={0.8} />
37
+ </span>
38
+ {/if}
16
39
  {#if module.value.type === 'script' && !shouldPick}
17
40
  <Button
18
41
  size="xs"
@@ -44,8 +67,8 @@ $: iconOnly = $width < threshold;
44
67
  variant="border"
45
68
  startIcon={{ icon: faTrashAlt }}
46
69
  {iconOnly}
47
- on:click={(event) => {
48
- if (event.shiftKey || shouldPick) {
70
+ on:click={({ detail }) => {
71
+ if (detail.shiftKey || shouldPick) {
49
72
  dispatch('delete')
50
73
  select('settings')
51
74
  } else {
@@ -66,3 +89,69 @@ $: iconOnly = $width < threshold;
66
89
  })
67
90
  }}
68
91
  />
92
+
93
+ <style>
94
+ .badge {
95
+
96
+ display: flex;
97
+
98
+ cursor: pointer;
99
+
100
+ align-items: center;
101
+
102
+ white-space: nowrap;
103
+
104
+ border-radius: 0.25rem;
105
+
106
+ border-width: 1px;
107
+
108
+ padding-left: 0.625rem;
109
+
110
+ padding-right: 0.625rem;
111
+
112
+ padding-top: 0.125rem;
113
+
114
+ padding-bottom: 0.125rem;
115
+
116
+ font-size: 0.875rem;
117
+
118
+ line-height: 1.25rem;
119
+
120
+ font-weight: 500
121
+ }
122
+
123
+ .badge-on {
124
+
125
+ --tw-bg-opacity: 1;
126
+
127
+ background-color: rgb(225 239 254 / var(--tw-bg-opacity));
128
+
129
+ --tw-text-opacity: 1;
130
+
131
+ color: rgb(30 66 159 / var(--tw-text-opacity))
132
+ }
133
+
134
+ .badge-on:hover {
135
+
136
+ --tw-bg-opacity: 1;
137
+
138
+ background-color: rgb(195 221 253 / var(--tw-bg-opacity))
139
+ }
140
+
141
+ .badge-off {
142
+
143
+ --tw-bg-opacity: 1;
144
+
145
+ background-color: rgb(243 244 246 / var(--tw-bg-opacity));
146
+
147
+ --tw-text-opacity: 1;
148
+
149
+ color: rgb(31 41 55 / var(--tw-text-opacity))
150
+ }
151
+
152
+ .badge-off:hover {
153
+
154
+ --tw-bg-opacity: 1;
155
+
156
+ background-color: rgb(229 231 235 / var(--tw-bg-opacity))
157
+ }</style>
@@ -5,6 +5,9 @@ declare const __propDef: {
5
5
  module: FlowModule;
6
6
  };
7
7
  events: {
8
+ toggleStopAfterIf: CustomEvent<any>;
9
+ toggleRetry: CustomEvent<any>;
10
+ toggleSuspend: CustomEvent<any>;
8
11
  fork: CustomEvent<any>;
9
12
  createScriptFromInlineScript: CustomEvent<any>;
10
13
  delete: CustomEvent<any>;
@@ -0,0 +1,27 @@
1
+ <script>import Toggle from '../../Toggle.svelte';
2
+ export let flowModule;
3
+ $: isSuspendEnabled = Boolean(flowModule.suspend);
4
+ </script>
5
+
6
+ <Toggle
7
+ checked={isSuspendEnabled}
8
+ on:change={() => {
9
+ if (isSuspendEnabled && flowModule.suspend != undefined) {
10
+ flowModule.suspend = undefined
11
+ } else {
12
+ flowModule.suspend = 1
13
+ }
14
+ }}
15
+ options={{
16
+ right: 'Suspend flow execution until events received'
17
+ }}
18
+ />
19
+ <div>
20
+ <span class="text-xs font-bold">Number of events to wait for</span>
21
+
22
+ {#if flowModule.suspend}
23
+ <input bind:value={flowModule.suspend} type="number" min="1" placeholder="1" />
24
+ {:else}
25
+ <input type="number" disabled />
26
+ {/if}
27
+ </div>
@@ -0,0 +1,17 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { FlowModule } from '../../../gen';
3
+ declare const __propDef: {
4
+ props: {
5
+ flowModule: FlowModule;
6
+ };
7
+ events: {
8
+ [evt: string]: CustomEvent<any>;
9
+ };
10
+ slots: {};
11
+ };
12
+ export declare type FlowModuleSuspendProps = typeof __propDef.props;
13
+ export declare type FlowModuleSuspendEvents = typeof __propDef.events;
14
+ export declare type FlowModuleSuspendSlots = typeof __propDef.slots;
15
+ export default class FlowModuleSuspend extends SvelteComponentTyped<FlowModuleSuspendProps, FlowModuleSuspendEvents, FlowModuleSuspendSlots> {
16
+ }
17
+ export {};
@@ -1,11 +1,9 @@
1
1
  <script>import { getContext } from 'svelte';
2
2
  import { flowStateStore } from '../flowState';
3
3
  import { flowStore } from '../flowStore';
4
+ import { selectedIdToIndexes } from '../utils';
4
5
  import FlowModule from './FlowModule.svelte';
5
- const { selectedId, previewArgs, select } = getContext('FlowEditorContext');
6
- function selectedIdToIndexes(selectedId) {
7
- return selectedId.split('-').map(Number);
8
- }
6
+ const { selectedId } = getContext('FlowEditorContext');
9
7
  $: [parentIndex, childIndex] = selectedIdToIndexes($selectedId);
10
8
  </script>
11
9
 
@@ -14,7 +12,7 @@ $: [parentIndex, childIndex] = selectedIdToIndexes($selectedId);
14
12
  {#each [$flowStateStore.modules[parentIndex].childFlowModules] as state}
15
13
  {#if mod.type == 'forloopflow' && state != undefined}
16
14
  <FlowModule
17
- previewArgs={$previewArgs}
15
+ failureModule={false}
18
16
  bind:flowModule={mod.modules[childIndex]}
19
17
  bind:flowModuleState={state[childIndex]}
20
18
  on:delete={() => {
@@ -34,7 +32,7 @@ $: [parentIndex, childIndex] = selectedIdToIndexes($selectedId);
34
32
  {/each}
35
33
  {:else if $flowStore.value.modules[parentIndex]}
36
34
  <FlowModule
37
- previewArgs={$previewArgs}
35
+ failureModule={false}
38
36
  bind:flowModule={$flowStore.value.modules[parentIndex]}
39
37
  bind:flowModuleState={$flowStateStore.modules[parentIndex]}
40
38
  on:delete={() => {
@@ -1,8 +1,8 @@
1
1
  <script>import Toggle from '../../Toggle.svelte';
2
- import { flowStore } from '../flowStore';
2
+ export let flowModule;
3
3
  function setConstantRetries() {
4
- $flowStore.value.retry = {
5
- ...$flowStore.value.retry,
4
+ flowModule.retry = {
5
+ ...flowModule.retry,
6
6
  constant: {
7
7
  attempts: 0,
8
8
  seconds: 0
@@ -10,8 +10,8 @@ function setConstantRetries() {
10
10
  };
11
11
  }
12
12
  function setExpoentialRetries() {
13
- $flowStore.value.retry = {
14
- ...$flowStore.value.retry,
13
+ flowModule.retry = {
14
+ ...flowModule.retry,
15
15
  exponential: {
16
16
  attempts: 0,
17
17
  multiplier: 1,
@@ -19,16 +19,16 @@ function setExpoentialRetries() {
19
19
  }
20
20
  };
21
21
  }
22
- $: isConstantRetryEnabled = Boolean($flowStore.value.retry?.constant);
23
- $: isExponentialRetryEnabled = Boolean($flowStore.value.retry?.exponential);
22
+ $: isConstantRetryEnabled = Boolean(flowModule.retry?.constant);
23
+ $: isExponentialRetryEnabled = Boolean(flowModule.retry?.exponential);
24
24
  </script>
25
25
 
26
26
  <div class="flex flex-col items-start space-y-1">
27
27
  <Toggle
28
28
  checked={isConstantRetryEnabled}
29
29
  on:change={() => {
30
- if (isConstantRetryEnabled && $flowStore.value.retry?.constant) {
31
- $flowStore.value.retry.constant = undefined
30
+ if (isConstantRetryEnabled && flowModule.retry?.constant) {
31
+ flowModule.retry.constant = undefined
32
32
  } else {
33
33
  setConstantRetries()
34
34
  }
@@ -37,11 +37,11 @@ $: isExponentialRetryEnabled = Boolean($flowStore.value.retry?.exponential);
37
37
  right: 'Constant retry enabled'
38
38
  }}
39
39
  />
40
- {#if $flowStore.value.retry?.constant}
40
+ {#if flowModule.retry?.constant}
41
41
  <span class="text-xs font-bold">Attempts</span>
42
- <input bind:value={$flowStore.value.retry.constant.attempts} type="number" />
42
+ <input bind:value={flowModule.retry.constant.attempts} type="number" />
43
43
  <span class="text-xs font-bold">Delay (seconds)</span>
44
- <input bind:value={$flowStore.value.retry.constant.seconds} type="number" />
44
+ <input bind:value={flowModule.retry.constant.seconds} type="number" />
45
45
  {:else}
46
46
  <span class="text-xs font-bold">Attempts</span>
47
47
  <input type="number" disabled />
@@ -52,8 +52,8 @@ $: isExponentialRetryEnabled = Boolean($flowStore.value.retry?.exponential);
52
52
  <Toggle
53
53
  checked={isExponentialRetryEnabled}
54
54
  on:change={() => {
55
- if (isExponentialRetryEnabled && $flowStore.value.retry?.exponential) {
56
- $flowStore.value.retry.exponential = undefined
55
+ if (isExponentialRetryEnabled && flowModule.retry?.exponential) {
56
+ flowModule.retry.exponential = undefined
57
57
  } else {
58
58
  setExpoentialRetries()
59
59
  }
@@ -62,13 +62,13 @@ $: isExponentialRetryEnabled = Boolean($flowStore.value.retry?.exponential);
62
62
  right: 'Exponential retry enabled'
63
63
  }}
64
64
  />
65
- {#if $flowStore.value.retry?.exponential}
65
+ {#if flowModule.retry?.exponential}
66
66
  <span class="text-xs font-bold">Attempts</span>
67
- <input bind:value={$flowStore.value.retry.exponential.attempts} type="number" />
67
+ <input bind:value={flowModule.retry.exponential.attempts} type="number" />
68
68
  <span class="text-xs font-bold">Mulitplier</span>
69
- <input bind:value={$flowStore.value.retry.exponential.multiplier} type="number" />
69
+ <input bind:value={flowModule.retry.exponential.multiplier} type="number" />
70
70
  <span class="text-xs font-bold">Initial delay (seconds)</span>
71
- <input bind:value={$flowStore.value.retry.exponential.seconds} type="number" />
71
+ <input bind:value={flowModule.retry.exponential.seconds} type="number" />
72
72
  {:else}
73
73
  <span class="text-xs font-bold">Attempts</span>
74
74
  <input type="number" disabled />
@@ -1,6 +1,9 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
+ import type { FlowModule } from '../../../gen';
2
3
  declare const __propDef: {
3
- props: {};
4
+ props: {
5
+ flowModule: FlowModule;
6
+ };
4
7
  events: {
5
8
  [evt: string]: CustomEvent<any>;
6
9
  };
@@ -4,23 +4,23 @@ import TabContent from '../../common/tabs/TabContent.svelte';
4
4
  import { flowStore } from '../flowStore';
5
5
  import Path from '../../Path.svelte';
6
6
  import Required from '../../Required.svelte';
7
- import { getContext } from 'svelte';
8
7
  import FlowCard from '../common/FlowCard.svelte';
9
8
  import FlowSchedules from './FlowSchedules.svelte';
10
- import FlowRetries from './FlowRetries.svelte';
11
- const { path } = getContext('FlowEditorContext');
12
- export let defaultTab = 'configuration';
9
+ import SvelteMarkdown from 'svelte-markdown';
10
+ import { Toggle } from 'flowbite-svelte';
11
+ export let initialPath;
12
+ export let defaultTab = 'metadata';
13
13
  </script>
14
14
 
15
15
  <FlowCard title="Settings">
16
16
  <Tabs selected={defaultTab}>
17
- <Tab value="configuration">Configuration</Tab>
17
+ <Tab value="metadata">Metadata</Tab>
18
18
  <Tab value="schedule">Schedule</Tab>
19
- <Tab value="retries">Retries</Tab>
19
+ <Tab value="same-worker">Same Worker</Tab>
20
20
 
21
21
  <svelte:fragment slot="content">
22
- <TabContent value="configuration" class="p-4">
23
- <Path bind:path={$flowStore.path} initialPath={path} namePlaceholder="my_flow" kind="flow">
22
+ <TabContent value="metadata" class="p-4">
23
+ <Path bind:path={$flowStore.path} {initialPath} namePlaceholder="my_flow" kind="flow">
24
24
  <div slot="ownerToolkit">
25
25
  Flow permissions depend on their path. Select the group <span class="font-mono"
26
26
  >all</span
@@ -30,21 +30,61 @@ export let defaultTab = 'configuration';
30
30
  </div>
31
31
  </Path>
32
32
 
33
- <label class="block mt-4">
33
+ <label class="block my-4">
34
34
  <span class="text-gray-700">Summary <Required required={false} /></span>
35
35
  <textarea
36
36
  bind:value={$flowStore.summary}
37
37
  class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50"
38
38
  placeholder="A very short summary of the flow displayed when the flow is listed"
39
39
  rows="1"
40
+ id="flow-summary"
40
41
  />
41
42
  </label>
43
+
44
+ <label class="block my-4" for="inp">
45
+ <span class="text-gray-700"
46
+ >Description<Required required={false} detail="accept markdown formatting" />
47
+ <textarea
48
+ id="inp"
49
+ bind:value={$flowStore.description}
50
+ class="
51
+ mt-1
52
+ block
53
+ w-full
54
+ rounded-md
55
+ border-gray-300
56
+ shadow-sm
57
+ focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50
58
+ "
59
+ placeholder="A description to help users understand what this script does and how to use it."
60
+ rows="3"
61
+ />
62
+ </span>
63
+ </label>
64
+
65
+ <div>
66
+ <h3 class="text-gray-700 ">Description rendered</h3>
67
+ <div
68
+ class="prose mt-5 text-xs shadow-inner shadow-blue p-4 overflow-auto"
69
+ style="max-height: 200px;"
70
+ >
71
+ <SvelteMarkdown source={$flowStore.description ?? ''} />
72
+ </div>
73
+ </div>
42
74
  </TabContent>
43
75
  <TabContent value="schedule" class="p-4">
44
76
  <FlowSchedules />
45
77
  </TabContent>
46
- <TabContent value="retries" class="px-4">
47
- <FlowRetries />
78
+
79
+ <TabContent value="same-worker" class="p-4">
80
+ <span class="my-2 text-sm font-bold">Same Worker</span>
81
+
82
+ <Toggle
83
+ bind:checked={$flowStore.value.same_worker}
84
+ options={{
85
+ right: 'Same Worker'
86
+ }}
87
+ />
48
88
  </TabContent>
49
89
  </svelte:fragment>
50
90
  </Tabs>
@@ -1,6 +1,7 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
+ initialPath: string;
4
5
  defaultTab?: string | undefined;
5
6
  };
6
7
  events: {
@@ -24,7 +24,7 @@ const dispatch = createEventDispatcher();
24
24
  <Alert type="info" title="Bypass confirmation">
25
25
  <div>
26
26
  You can press
27
- <Badge color="dark-gray">SHIFT</Badge>
27
+ <kbd color="dark-gray">SHIFT</kbd>
28
28
  while removing a step to bypass confirmation.
29
29
  </div>
30
30
  </Alert>
@@ -22,7 +22,7 @@ declare type Result = any;
22
22
  declare type PickableProperties = {
23
23
  flow_input?: Object;
24
24
  previous_result: Result | undefined;
25
- step: Result[];
25
+ step?: Result[];
26
26
  };
27
27
  declare type StepPropPicker = {
28
28
  pickableProperties: PickableProperties;
@@ -1,5 +1,5 @@
1
1
  import { CompletedJob, Job, Script, ScriptService } from '../../gen';
2
- import { initialCode } from '../../script_helpers';
2
+ import { DENO_FAILURE_MODULE_CODE, initialCode } from '../../script_helpers';
3
3
  import { userStore, workspaceStore } from '../../stores';
4
4
  import { buildExtraLib, emptySchema, getScriptByPath, objectToTsType, schemaToObject, schemaToTsType } from '../../utils';
5
5
  import { get } from 'svelte/store';
@@ -149,7 +149,7 @@ export function getStepPropPicker(indexes, flowInputSchema, flowState, args) {
149
149
  if (flowState.modules[parentIndex]?.previewArgs) {
150
150
  forLoopFlowInput = flowState.modules[parentIndex]?.previewArgs;
151
151
  }
152
- const innerResults = getPreviousResults(flowState.modules[parentIndex].childFlowModules, childIndex);
152
+ const innerResults = getPreviousResults(flowState.modules[parentIndex]?.childFlowModules, childIndex);
153
153
  const innerLastResult = childIndex == 0
154
154
  ? forLoopFlowInput
155
155
  : innerResults.length > 0