windmill-components 1.28.7 → 1.34.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/common.d.ts +3 -0
- package/components/AppConnect.svelte +28 -12
- package/components/ArgInput.svelte +25 -14
- package/components/ArgInput.svelte.d.ts +4 -0
- package/components/CenteredPage.svelte +1 -1
- package/components/DisplayResult.svelte +3 -3
- package/components/Drawer.svelte +108 -0
- package/components/Drawer.svelte.d.ts +23 -0
- package/components/Editor.svelte +70 -78
- package/components/Editor.svelte.d.ts +3 -0
- package/components/EditorBar.svelte +23 -10
- package/components/FlowBuilder.svelte +39 -33
- package/components/FlowEditor.svelte +17 -58
- package/components/FlowJobResult.svelte +18 -17
- package/components/FlowPreview.svelte +13 -34
- package/components/FlowPreview.svelte.d.ts +2 -4
- package/components/FlowPreviewContent.svelte +56 -44
- package/components/FlowPreviewContent.svelte.d.ts +0 -1
- package/components/FlowStatusViewer.svelte +123 -205
- package/components/FlowStatusViewer.svelte.d.ts +7 -4
- package/components/FlowViewer.svelte +4 -1
- package/components/IconedPath.svelte +12 -0
- package/components/IconedPath.svelte.d.ts +16 -0
- package/components/IconedResourceType.svelte +21 -2
- package/components/IconedResourceType.svelte.d.ts +1 -0
- package/components/InputTransformForm.svelte +9 -8
- package/components/InputTransformForm.svelte.d.ts +1 -1
- package/components/InviteGlobalUser.svelte +1 -1
- package/components/ItemPicker.svelte +6 -1
- package/components/JobStatus.svelte +1 -1
- package/components/ModuleStep.svelte +73 -93
- package/components/ModuleStep.svelte.d.ts +7 -2
- package/components/Path.svelte +62 -40
- package/components/Path.svelte.d.ts +2 -0
- package/components/ProgressBar.svelte +31 -0
- package/components/ProgressBar.svelte.d.ts +17 -0
- package/components/ProgressBarPart.svelte +20 -0
- package/components/ProgressBarPart.svelte.d.ts +20 -0
- package/components/ResourceEditor.svelte +2 -1
- package/components/ResourcePicker.svelte +9 -0
- package/components/SchemaForm.svelte +9 -4
- package/components/SchemaForm.svelte.d.ts +1 -1
- package/components/SchemaModal.svelte +20 -3
- package/components/ScriptBuilder.svelte +58 -21
- package/components/ScriptBuilder.svelte.d.ts +1 -0
- package/components/ScriptEditor.svelte +4 -2
- package/components/SharedBadge.svelte +8 -3
- package/components/VariableEditor.svelte +1 -1
- package/components/flows/CopyFirstStepSchema.svelte +4 -3
- package/components/flows/DynamicInputHelpBox.svelte +6 -4
- package/components/flows/DynamicInputHelpBox.svelte.d.ts +1 -1
- package/components/flows/FlowBox.svelte +15 -2
- package/components/flows/FlowBox.svelte.d.ts +14 -14
- package/components/flows/FlowBoxHeader.svelte +10 -3
- package/components/flows/FlowBoxHeader.svelte.d.ts +3 -0
- package/components/flows/FlowInput.svelte +14 -12
- package/components/flows/FlowInputs.svelte +55 -35
- package/components/flows/FlowInputs.svelte.d.ts +3 -1
- package/components/flows/FlowModuleHeader.svelte +71 -55
- package/components/flows/FlowModuleHeader.svelte.d.ts +6 -6
- package/components/flows/FlowSettings.svelte +34 -57
- package/components/flows/FlowSettings.svelte.d.ts +0 -1
- package/components/flows/FlowTimeline.svelte +169 -0
- package/components/flows/FlowTimeline.svelte.d.ts +21 -0
- package/components/flows/flowState.d.ts +14 -0
- package/components/flows/flowState.js +52 -0
- package/components/flows/flowStateUtils.d.ts +37 -0
- package/components/flows/flowStateUtils.js +222 -0
- package/components/flows/flowStore.d.ts +1 -16
- package/components/flows/flowStore.js +7 -208
- package/components/flows/pickers/FlowScriptPicker.svelte +5 -9
- package/components/flows/pickers/FlowScriptPicker.svelte.d.ts +0 -1
- package/components/flows/pickers/PickHubScript.svelte +1 -1
- package/components/flows/pickers/PickHubScript.svelte.d.ts +1 -1
- package/components/flows/pickers/PickScript.svelte +1 -1
- package/components/flows/pickers/PickScript.svelte.d.ts +1 -1
- package/components/flows/scheduleUtils.d.ts +7 -0
- package/components/flows/scheduleUtils.js +21 -0
- package/components/flows/stepOpenedStore.d.ts +1 -0
- package/components/flows/stepOpenedStore.js +6 -0
- package/components/flows/utils.d.ts +5 -12
- package/components/flows/utils.js +40 -112
- package/components/icons/DiscordIcon.svelte +16 -0
- package/components/icons/DiscordIcon.svelte.d.ts +17 -0
- package/components/icons/HttpIcon.svelte +21 -0
- package/components/icons/HttpIcon.svelte.d.ts +17 -0
- package/components/icons/MastodonIcon.svelte +16 -0
- package/components/icons/MastodonIcon.svelte.d.ts +17 -0
- package/components/icons/MatrixIcon.svelte +16 -0
- package/components/icons/MatrixIcon.svelte.d.ts +17 -0
- package/components/icons/S3Icon.svelte +16 -0
- package/components/icons/S3Icon.svelte.d.ts +17 -0
- package/components/icons/WindmillIcon.svelte +68 -0
- package/components/icons/WindmillIcon.svelte.d.ts +17 -0
- package/components/preview/FlowPreviewStatus.svelte +28 -0
- package/components/preview/FlowPreviewStatus.svelte.d.ts +17 -0
- package/components/propertyPicker/ObjectViewer.svelte +13 -13
- package/components/propertyPicker/utils.js +3 -2
- package/components/tabs/Tab.svelte +12 -0
- package/components/tabs/Tab.svelte.d.ts +19 -0
- package/components/tabs/TabPanel.svelte +11 -0
- package/components/tabs/TabPanel.svelte.d.ts +20 -0
- package/components/tabs/Tabs.svelte +3 -0
- package/components/tabs/Tabs.svelte.d.ts +23 -0
- package/gen/core/OpenAPI.js +1 -1
- package/gen/core/request.js +1 -0
- package/gen/models/MainArgSignature.d.ts +14 -3
- package/gen/services/JobService.d.ts +10 -2
- package/gen/services/JobService.js +4 -2
- package/gen/services/ScriptService.d.ts +18 -0
- package/gen/services/ScriptService.js +30 -0
- package/infer.js +47 -24
- package/package.json +39 -20
- package/script_helpers.d.ts +4 -1
- package/script_helpers.js +68 -17
- package/stores.d.ts +1 -2
- package/stores.js +1 -4
- package/utils.d.ts +4 -2
- package/utils.js +33 -5
|
@@ -2,17 +2,17 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
import type { FlowModule } from '../../gen';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
-
|
|
6
|
-
i: number;
|
|
7
|
-
shouldPick?: boolean | undefined;
|
|
5
|
+
indexes: number[];
|
|
8
6
|
mod: FlowModule;
|
|
9
7
|
};
|
|
10
8
|
events: {
|
|
9
|
+
fork: CustomEvent<any>;
|
|
10
|
+
createScriptFromInlineScript: CustomEvent<any>;
|
|
11
|
+
delete: CustomEvent<any>;
|
|
12
|
+
} & {
|
|
11
13
|
[evt: string]: CustomEvent<any>;
|
|
12
14
|
};
|
|
13
|
-
slots: {
|
|
14
|
-
default: {};
|
|
15
|
-
};
|
|
15
|
+
slots: {};
|
|
16
16
|
};
|
|
17
17
|
export declare type FlowModuleHeaderProps = typeof __propDef.props;
|
|
18
18
|
export declare type FlowModuleHeaderEvents = typeof __propDef.events;
|
|
@@ -5,25 +5,23 @@ import Icon from 'svelte-awesome';
|
|
|
5
5
|
import Editor from '../Editor.svelte';
|
|
6
6
|
import FlowViewer from '../FlowViewer.svelte';
|
|
7
7
|
import Modal from '../Modal.svelte';
|
|
8
|
-
import RadioButton from '../RadioButton.svelte';
|
|
9
8
|
import CollapseLink from './../CollapseLink.svelte';
|
|
10
9
|
import CronInput from './../CronInput.svelte';
|
|
11
10
|
import FlowBox from './../flows/FlowBox.svelte';
|
|
12
|
-
import { flowStore, initFlow
|
|
13
|
-
import { flowToMode } from './../flows/utils';
|
|
11
|
+
import { flowStore, initFlow } from './../flows/flowStore';
|
|
14
12
|
import Path from './../Path.svelte';
|
|
15
13
|
import Required from './../Required.svelte';
|
|
16
14
|
import SchemaForm from './../SchemaForm.svelte';
|
|
17
15
|
import Toggle from './../Toggle.svelte';
|
|
18
16
|
import Tooltip from './../Tooltip.svelte';
|
|
19
|
-
import
|
|
17
|
+
import { stepOpened } from './stepOpenedStore';
|
|
18
|
+
import { cleanInputs } from './utils';
|
|
20
19
|
export let pathError = '';
|
|
21
20
|
export let initialPath = '';
|
|
22
21
|
export let previewArgs = {};
|
|
23
22
|
export let scheduleArgs = {};
|
|
24
23
|
export let scheduleEnabled = false;
|
|
25
24
|
export let scheduleCron = '0 */5 * * *';
|
|
26
|
-
export let open;
|
|
27
25
|
let jsonSetter;
|
|
28
26
|
let jsonViewer;
|
|
29
27
|
let jsonValue = '';
|
|
@@ -40,7 +38,7 @@ let jsonValue = '';
|
|
|
40
38
|
on:click={() => {
|
|
41
39
|
Object.assign($flowStore, JSON.parse(jsonValue))
|
|
42
40
|
initFlow($flowStore)
|
|
43
|
-
|
|
41
|
+
stepOpened.update(() => undefined)
|
|
44
42
|
sendUserToast('OpenFlow imported from JSON')
|
|
45
43
|
jsonSetter.closeModal()
|
|
46
44
|
}}
|
|
@@ -53,12 +51,12 @@ let jsonValue = '';
|
|
|
53
51
|
<Modal bind:this={jsonViewer}>
|
|
54
52
|
<div slot="title">See JSON</div>
|
|
55
53
|
<div slot="content" class="h-full">
|
|
56
|
-
<FlowViewer flow={
|
|
54
|
+
<FlowViewer flow={cleanInputs($flowStore)} tab="json" />
|
|
57
55
|
</div>
|
|
58
56
|
</Modal>
|
|
59
57
|
|
|
60
|
-
<FlowBox>
|
|
61
|
-
<
|
|
58
|
+
<FlowBox title="Flow Settings">
|
|
59
|
+
<div slot="header">
|
|
62
60
|
<div class="flex flex-row-reverse">
|
|
63
61
|
<Dropdown class="w-fit" placement="bottom-end">
|
|
64
62
|
<button slot="trigger" class="text-gray-900 bg-white dark:text-white dark:bg-gray-800">
|
|
@@ -89,7 +87,7 @@ let jsonValue = '';
|
|
|
89
87
|
description: $flowStore.description,
|
|
90
88
|
schema: $flowStore.schema
|
|
91
89
|
}
|
|
92
|
-
url.searchParams.append('flow', btoa(JSON.stringify(
|
|
90
|
+
url.searchParams.append('flow', btoa(JSON.stringify(openFlow)))
|
|
93
91
|
window.open(url, '_blank')?.focus()
|
|
94
92
|
}}
|
|
95
93
|
>
|
|
@@ -98,55 +96,34 @@ let jsonValue = '';
|
|
|
98
96
|
</DropdownItem>
|
|
99
97
|
</Dropdown>
|
|
100
98
|
</div>
|
|
101
|
-
</
|
|
99
|
+
</div>
|
|
102
100
|
|
|
103
|
-
<div
|
|
104
|
-
<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
101
|
+
<div slot="content">
|
|
102
|
+
<div class="p-6 border-t border-gray-300">
|
|
103
|
+
<Path
|
|
104
|
+
bind:error={pathError}
|
|
105
|
+
bind:path={$flowStore.path}
|
|
106
|
+
{initialPath}
|
|
107
|
+
namePlaceholder="my_flow"
|
|
108
|
+
kind="flow"
|
|
109
|
+
>
|
|
110
|
+
<div slot="ownerToolkit">
|
|
111
|
+
Flow permissions depend on their path. Select the group <span class="font-mono">all</span>
|
|
112
|
+
to share your flow, and <span class="font-mono">user</span> to keep it private.
|
|
113
|
+
<a href="https://docs.windmill.dev/docs/reference/namespaces">docs</a>
|
|
114
|
+
</div>
|
|
115
|
+
</Path>
|
|
117
116
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
117
|
+
<label class="block mt-4">
|
|
118
|
+
<span class="text-gray-700">Summary <Required required={false} /></span>
|
|
119
|
+
<textarea
|
|
120
|
+
bind:value={$flowStore.summary}
|
|
121
|
+
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"
|
|
122
|
+
placeholder="A very short summary of the flow displayed when the flow is listed"
|
|
123
|
+
rows="1"
|
|
124
|
+
/>
|
|
125
|
+
</label>
|
|
127
126
|
|
|
128
|
-
<div class="mt-4">
|
|
129
|
-
<RadioButton
|
|
130
|
-
options={[
|
|
131
|
-
[
|
|
132
|
-
{
|
|
133
|
-
title: 'UI or webhook triggered',
|
|
134
|
-
desc: 'Trigger this flow through the generated UI, a manual schedule or by calling the associated webhook'
|
|
135
|
-
},
|
|
136
|
-
'push'
|
|
137
|
-
],
|
|
138
|
-
[
|
|
139
|
-
{
|
|
140
|
-
title: 'Watching changes regularly',
|
|
141
|
-
desc: 'The first module of this flow is a trigger script whose purpose is to pull data from an external source and return all new items since last run. This flow is meant to be scheduled very regularly to reduce latency to react to new events. It will trigger the rest of the flow once per item. If no new items, the flow will be skipped.'
|
|
142
|
-
},
|
|
143
|
-
'pull'
|
|
144
|
-
]
|
|
145
|
-
]}
|
|
146
|
-
bind:value={$mode}
|
|
147
|
-
/>
|
|
148
|
-
</div>
|
|
149
|
-
{#if $mode == 'pull'}
|
|
150
127
|
<CollapseLink text="set primary schedule" open={true}>
|
|
151
128
|
<Tooltip>
|
|
152
129
|
The primary schedule of a flow is simply a schedule that has the same name as a flow. It
|
|
@@ -179,6 +156,6 @@ let jsonValue = '';
|
|
|
179
156
|
</div>
|
|
180
157
|
<SchemaForm schema={$flowStore.schema} bind:args={scheduleArgs} />
|
|
181
158
|
</CollapseLink>
|
|
182
|
-
|
|
159
|
+
</div>
|
|
183
160
|
</div>
|
|
184
161
|
</FlowBox>
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
<script>import { faInfoCircle, faPen, faPlus, faSliders, faTrashAlt } from '@fortawesome/free-solid-svg-icons';
|
|
2
|
+
import { Button, Toggle, Tooltip } from 'flowbite-svelte';
|
|
3
|
+
import Icon from 'svelte-awesome';
|
|
4
|
+
import ModuleStep from '../ModuleStep.svelte';
|
|
5
|
+
import FlowInput from './FlowInput.svelte';
|
|
6
|
+
import { emptyFlowModuleSchema } from './flowStateUtils';
|
|
7
|
+
import { stepOpened } from './stepOpenedStore';
|
|
8
|
+
export let args = {};
|
|
9
|
+
export let flowModuleSchemas;
|
|
10
|
+
export let parentIndex = undefined;
|
|
11
|
+
const root = parentIndex === undefined;
|
|
12
|
+
function insertAtIndex(index) {
|
|
13
|
+
flowModuleSchemas.splice(index, 0, emptyFlowModuleSchema());
|
|
14
|
+
flowModuleSchemas = flowModuleSchemas;
|
|
15
|
+
const indexes = getIndexes(parentIndex, index);
|
|
16
|
+
stepOpened.update(() => String(indexes.join('-')));
|
|
17
|
+
}
|
|
18
|
+
function removeAtIndex(index) {
|
|
19
|
+
flowModuleSchemas.splice(index, 1);
|
|
20
|
+
flowModuleSchemas = flowModuleSchemas;
|
|
21
|
+
}
|
|
22
|
+
function getIndexes(parentIndex, childIndex) {
|
|
23
|
+
const indexes = [];
|
|
24
|
+
if (parentIndex !== undefined) {
|
|
25
|
+
indexes.push(parentIndex);
|
|
26
|
+
}
|
|
27
|
+
indexes.push(childIndex);
|
|
28
|
+
return indexes;
|
|
29
|
+
}
|
|
30
|
+
const color = root ? 'blue' : 'orange';
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<div class="w-full">
|
|
34
|
+
<ol class="relative ml-4 border-l border-gray-200 dark:border-gray-700 space-y-12 border-dashed">
|
|
35
|
+
{#if root}
|
|
36
|
+
<li class="ml-8">
|
|
37
|
+
<span class="relative">
|
|
38
|
+
<span
|
|
39
|
+
class={`flex absolute -left-12 justify-center items-center w-8 h-8 bg-${color}-200 rounded-full ring-8 ring-white dark:ring-gray-900 dark:bg-${color}-900`}
|
|
40
|
+
>
|
|
41
|
+
<Icon
|
|
42
|
+
class={`text-${color}-600 dark:text-${color}-400 text-font-bold text-center`}
|
|
43
|
+
data={faSliders}
|
|
44
|
+
/>
|
|
45
|
+
</span>
|
|
46
|
+
</span>
|
|
47
|
+
<slot name="settings" />
|
|
48
|
+
</li>
|
|
49
|
+
<li class="ml-8 ">
|
|
50
|
+
<span class="relative">
|
|
51
|
+
<span
|
|
52
|
+
class={`flex absolute top-4 -left-12 justify-center items-center w-8 h-8 bg-${color}-200 rounded-full ring-8 ring-white dark:ring-gray-900 dark:bg-${color}-900`}
|
|
53
|
+
>
|
|
54
|
+
<Icon
|
|
55
|
+
class={`text-${color}-600 dark:text-${color}-400 font-bold text-center`}
|
|
56
|
+
data={faPen}
|
|
57
|
+
/>
|
|
58
|
+
</span>
|
|
59
|
+
</span>
|
|
60
|
+
<FlowInput />
|
|
61
|
+
</li>
|
|
62
|
+
{/if}
|
|
63
|
+
{#each flowModuleSchemas as flowModuleSchema, index (index)}
|
|
64
|
+
{#if flowModuleSchema.flowModule.value.type === 'forloopflow'}
|
|
65
|
+
<li id="module-{index}" class="ml-4 relative">
|
|
66
|
+
<button
|
|
67
|
+
on:click={() => insertAtIndex(index)}
|
|
68
|
+
class="flex absolute -top-10 -left-8 justify-center items-center bg-white border-2 border-gray-200 w-8 h-8 rounded-full ring-8 ring-white dark:ring-gray-900 dark:bg-${color}-900"
|
|
69
|
+
>
|
|
70
|
+
<Icon class="text-gray-400" data={faPlus} />
|
|
71
|
+
</button>
|
|
72
|
+
<div
|
|
73
|
+
class="py-2 px-6 ml-4 mb-16 flex justify-between text-sm font-bold border border-gray-300 rounded-md shadow-md"
|
|
74
|
+
role="alert"
|
|
75
|
+
>
|
|
76
|
+
<span class="flex items-center z-50">
|
|
77
|
+
For loop
|
|
78
|
+
<Tooltip
|
|
79
|
+
content="Inside a loop, the flow input has an 'iter' property. It contains the value and the index of the iteration"
|
|
80
|
+
placement="bottom"
|
|
81
|
+
arrow
|
|
82
|
+
>
|
|
83
|
+
<Icon data={faInfoCircle} class="ml-2" /></Tooltip
|
|
84
|
+
>
|
|
85
|
+
</span>
|
|
86
|
+
<span class="flex items-center space-x-2">
|
|
87
|
+
<Toggle size="small" bind:checked={flowModuleSchema.flowModule.value.skip_failures}>
|
|
88
|
+
Skip failures
|
|
89
|
+
</Toggle>
|
|
90
|
+
<Button size="xs" color="alternative" on:click={() => removeAtIndex(index)}>
|
|
91
|
+
<Icon data={faTrashAlt} class="mr-2" />
|
|
92
|
+
Remove loop
|
|
93
|
+
</Button>
|
|
94
|
+
</span>
|
|
95
|
+
</div>
|
|
96
|
+
<span
|
|
97
|
+
class="flex absolute top-3 -left-8 justify-center items-center w-8 h-8 bg-orange-200 rounded-full ring-8 ring-white dark:ring-gray-900 dark:bg-orange-900"
|
|
98
|
+
>
|
|
99
|
+
<span class={`text-orange-600 dark:text-orange-400 font-bold text-center`}>
|
|
100
|
+
{index + 1}
|
|
101
|
+
</span>
|
|
102
|
+
</span>
|
|
103
|
+
|
|
104
|
+
<svelte:self
|
|
105
|
+
bind:args
|
|
106
|
+
bind:flowModuleSchemas={flowModuleSchema.childFlowModules}
|
|
107
|
+
parentIndex={index}
|
|
108
|
+
/>
|
|
109
|
+
|
|
110
|
+
<div
|
|
111
|
+
class="flex px-6 py-4 ml-4 mt-4 text-sm font-bold border border-gray-300 rounded-md shadow-md z-50"
|
|
112
|
+
role="alert"
|
|
113
|
+
>
|
|
114
|
+
End of For Loop
|
|
115
|
+
<Tooltip
|
|
116
|
+
content="The results of each iteration are collecting in an array and is the result of the step. "
|
|
117
|
+
placement="bottom"
|
|
118
|
+
arrow
|
|
119
|
+
>
|
|
120
|
+
<Icon data={faInfoCircle} class="ml-2" /></Tooltip
|
|
121
|
+
>
|
|
122
|
+
</div>
|
|
123
|
+
</li>
|
|
124
|
+
{:else}
|
|
125
|
+
<li id="module-{String(getIndexes(parentIndex, index).join('-'))}" class="ml-8">
|
|
126
|
+
<span class="relative">
|
|
127
|
+
<button
|
|
128
|
+
on:click={() => insertAtIndex(index)}
|
|
129
|
+
class="flex absolute -top-10 -left-12 justify-center items-center bg-white border-2 border-gray-200 w-8 h-8 rounded-full ring-8 ring-white dark:ring-gray-900 dark:bg-${color}-900"
|
|
130
|
+
>
|
|
131
|
+
<Icon class="text-gray-400" data={faPlus} />
|
|
132
|
+
</button>
|
|
133
|
+
<span
|
|
134
|
+
class={`flex absolute top-4 -left-12 justify-center items-center w-8 h-8 bg-${color}-200 rounded-full ring-8 ring-white dark:ring-gray-900 dark:bg-${color}-900`}
|
|
135
|
+
>
|
|
136
|
+
<span class={`text-${color}-600 dark:text-${color}-400 font-bold text-center`}>
|
|
137
|
+
{index + 1}
|
|
138
|
+
</span>
|
|
139
|
+
</span>
|
|
140
|
+
<ModuleStep
|
|
141
|
+
indexes={getIndexes(parentIndex, index)}
|
|
142
|
+
bind:mod={flowModuleSchema.flowModule}
|
|
143
|
+
bind:args
|
|
144
|
+
bind:schema={flowModuleSchema.schema}
|
|
145
|
+
bind:childFlowModules={flowModuleSchema.childFlowModules}
|
|
146
|
+
on:delete={() => removeAtIndex(index)}
|
|
147
|
+
/>
|
|
148
|
+
</span>
|
|
149
|
+
</li>
|
|
150
|
+
{/if}
|
|
151
|
+
{#if flowModuleSchemas.length - 1 === index}
|
|
152
|
+
<button
|
|
153
|
+
on:click={() => insertAtIndex(flowModuleSchemas.length)}
|
|
154
|
+
class="-ml-4 -mt-4 flex justify-center items-center bg-white border-2 border-gray-200 w-8 h-8 rounded-full ring-8 ring-white dark:ring-gray-900 dark:bg-${color}-900"
|
|
155
|
+
>
|
|
156
|
+
<Icon class="text-gray-400" data={faPlus} />
|
|
157
|
+
</button>
|
|
158
|
+
{/if}
|
|
159
|
+
{/each}
|
|
160
|
+
{#if flowModuleSchemas.length === 0}
|
|
161
|
+
<button
|
|
162
|
+
on:click={() => insertAtIndex(0)}
|
|
163
|
+
class="-ml-4 flex justify-center items-center bg-white border-2 border-gray-200 w-8 h-8 rounded-full ring-8 ring-white dark:ring-gray-900 dark:bg-${color}-900"
|
|
164
|
+
>
|
|
165
|
+
<Icon class="text-gray-400" data={faPlus} />
|
|
166
|
+
</button>
|
|
167
|
+
{/if}
|
|
168
|
+
</ol>
|
|
169
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { FlowState } from './flowState';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
args?: Record<string, any> | undefined;
|
|
6
|
+
flowModuleSchemas: FlowState;
|
|
7
|
+
parentIndex?: number | undefined;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {
|
|
13
|
+
settings: {};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare type FlowTimelineProps = typeof __propDef.props;
|
|
17
|
+
export declare type FlowTimelineEvents = typeof __propDef.events;
|
|
18
|
+
export declare type FlowTimelineSlots = typeof __propDef.slots;
|
|
19
|
+
export default class FlowTimeline extends SvelteComponentTyped<FlowTimelineProps, FlowTimelineEvents, FlowTimelineSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Schema } from '../../common';
|
|
2
|
+
import type { Flow, FlowModule } from '../../gen';
|
|
3
|
+
export declare type FlowModuleSchema = {
|
|
4
|
+
flowModule: FlowModule;
|
|
5
|
+
schema: Schema;
|
|
6
|
+
childFlowModules?: FlowModuleSchema[];
|
|
7
|
+
previewResult?: any;
|
|
8
|
+
};
|
|
9
|
+
export declare type FlowState = FlowModuleSchema[];
|
|
10
|
+
export declare const flowStateStore: import("svelte/store").Writable<FlowState>;
|
|
11
|
+
export declare function initFlowState(flow: Flow): Promise<void>;
|
|
12
|
+
export declare const isCopyFirstStepSchemaDisabled: import("svelte/store").Readable<boolean>;
|
|
13
|
+
export declare function flowModulesToFlowState(flowModules: FlowModule[]): Promise<FlowState>;
|
|
14
|
+
export declare function flowStateToFlow(flowState: FlowState, flow: Flow): Flow;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { derived, writable } from 'svelte/store';
|
|
2
|
+
import { emptyFlowModuleSchema, isEmptyFlowModule, loadFlowModuleSchema } from './flowStateUtils';
|
|
3
|
+
export const flowStateStore = writable(undefined);
|
|
4
|
+
export async function initFlowState(flow) {
|
|
5
|
+
const flowState = await flowModulesToFlowState(flow.value.modules);
|
|
6
|
+
flowStateStore.set(flowState);
|
|
7
|
+
}
|
|
8
|
+
export const isCopyFirstStepSchemaDisabled = derived(flowStateStore, (flowState) => {
|
|
9
|
+
if (flowState) {
|
|
10
|
+
const firstModule = flowState[0];
|
|
11
|
+
if (!firstModule) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
const fm = firstModule.flowModule;
|
|
15
|
+
return flowState.length === 0 || isEmptyFlowModule(fm);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
export async function flowModulesToFlowState(flowModules) {
|
|
22
|
+
return Promise.all(flowModules.map(async (flowModule) => {
|
|
23
|
+
const value = flowModule.value;
|
|
24
|
+
if (value.type === 'forloopflow') {
|
|
25
|
+
const childFlowModules = await Promise.all(value.value.modules.map(async (module) => loadFlowModuleSchema(module)));
|
|
26
|
+
const loopFlowModule = await loadFlowModuleSchema(flowModule);
|
|
27
|
+
return {
|
|
28
|
+
...loopFlowModule,
|
|
29
|
+
childFlowModules
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
if (isEmptyFlowModule(flowModule)) {
|
|
33
|
+
return emptyFlowModuleSchema();
|
|
34
|
+
}
|
|
35
|
+
return loadFlowModuleSchema(flowModule);
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
export function flowStateToFlow(flowState, flow) {
|
|
39
|
+
if (!flowState || !flow) {
|
|
40
|
+
return flow;
|
|
41
|
+
}
|
|
42
|
+
const modules = flowState.map(({ flowModule, childFlowModules }) => {
|
|
43
|
+
const fmv = flowModule.value;
|
|
44
|
+
if (fmv.type === 'forloopflow' && childFlowModules && Array.isArray(childFlowModules)) {
|
|
45
|
+
fmv.value.modules = childFlowModules.map((cfm) => cfm.flowModule);
|
|
46
|
+
flowModule.value = fmv;
|
|
47
|
+
}
|
|
48
|
+
return flowModule;
|
|
49
|
+
});
|
|
50
|
+
flow.value.modules = modules;
|
|
51
|
+
return flow;
|
|
52
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Schema } from '../../common';
|
|
2
|
+
import { Job, type FlowModule, type RawScript } from '../../gen';
|
|
3
|
+
import { type FlowModuleSchema, type FlowState } from './flowState';
|
|
4
|
+
export declare function emptyFlowModuleSchema(): FlowModuleSchema;
|
|
5
|
+
export declare function loadFlowModuleSchema(flowModule: FlowModule): Promise<FlowModuleSchema>;
|
|
6
|
+
export declare function pickScript(path: string): Promise<FlowModuleSchema>;
|
|
7
|
+
export declare function createInlineScriptModule({ language, type }: {
|
|
8
|
+
language: RawScript.language;
|
|
9
|
+
type: 'trigger' | 'flow' | 'pgsql';
|
|
10
|
+
}): Promise<FlowModuleSchema>;
|
|
11
|
+
export declare function createLoop(): Promise<FlowModuleSchema>;
|
|
12
|
+
export declare function fork(flowModule: FlowModule): Promise<FlowModuleSchema>;
|
|
13
|
+
export declare function createInlineScriptModuleFromPath(path: string): Promise<FlowModule>;
|
|
14
|
+
export declare function createScriptFromInlineScript({ flowModule, suffix, schema }: {
|
|
15
|
+
flowModule: FlowModule;
|
|
16
|
+
suffix: string;
|
|
17
|
+
schema: Schema;
|
|
18
|
+
}): Promise<FlowModuleSchema>;
|
|
19
|
+
export declare function isEmptyFlowModule(flowModule: FlowModule): boolean;
|
|
20
|
+
declare type Result = any;
|
|
21
|
+
declare type PickableProperties = {
|
|
22
|
+
flow_input?: Object;
|
|
23
|
+
previous_result: Result | undefined;
|
|
24
|
+
step: Result[];
|
|
25
|
+
};
|
|
26
|
+
declare type StepPropPicker = {
|
|
27
|
+
pickableProperties: PickableProperties;
|
|
28
|
+
extraLib: string;
|
|
29
|
+
};
|
|
30
|
+
export declare function getStepPropPicker(indexes: number[], flowInputSchema: Schema, flowState: FlowState, args: Record<string, any>): StepPropPicker;
|
|
31
|
+
export declare type JobResult = {
|
|
32
|
+
job?: Job;
|
|
33
|
+
innerJobs?: JobResult[];
|
|
34
|
+
loopJobs?: JobResult[];
|
|
35
|
+
};
|
|
36
|
+
export declare function mapJobResultsToFlowState(jobs: JobResult, config: 'upto' | 'justthis', configIndex: number): void;
|
|
37
|
+
export {};
|