windmill-components 1.22.42 → 1.28.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.
- package/components/AppConnect.svelte +93 -47
- package/components/AppConnect.svelte.d.ts +2 -2
- package/components/ArgInfo.svelte +0 -5
- package/components/ArgInput.svelte +91 -64
- package/components/ArgInput.svelte.d.ts +8 -3
- package/components/Button.svelte +4 -4
- package/components/CenteredPage.svelte +1 -1
- package/components/CollapseLink.svelte +12 -0
- package/components/CollapseLink.svelte.d.ts +19 -0
- package/components/CronInput.svelte +84 -0
- package/components/CronInput.svelte.d.ts +18 -0
- package/components/DisplayResult.svelte +23 -7
- package/components/Editor.svelte +136 -66
- package/components/Editor.svelte.d.ts +2 -0
- package/components/EditorBar.svelte +56 -45
- package/components/FlowBuilder.svelte +150 -71
- package/components/FlowEditor.svelte +75 -200
- package/components/FlowEditor.svelte.d.ts +3 -2
- package/components/FlowJobResult.svelte +1 -1
- package/components/FlowPreview.svelte +18 -24
- package/components/FlowPreviewContent.svelte +68 -0
- package/components/FlowPreviewContent.svelte.d.ts +21 -0
- package/components/FlowStatusViewer.svelte +85 -37
- package/components/FlowStatusViewer.svelte.d.ts +3 -2
- package/components/FlowViewer.svelte +77 -45
- package/components/FlowViewer.svelte.d.ts +1 -1
- package/components/IconedResourceType.svelte +30 -5
- package/components/InputTransformForm.svelte +209 -0
- package/components/InputTransformForm.svelte.d.ts +26 -0
- package/components/InviteGlobalUser.svelte +2 -2
- package/components/InviteUser.svelte +2 -2
- package/components/JobStatus.svelte +32 -25
- package/components/Modal.svelte +44 -42
- package/components/ModuleStep.svelte +94 -79
- package/components/ObjectResourceInput.svelte +58 -38
- package/components/ObjectTypeNarrowing.svelte +4 -19
- package/components/Path.svelte +1 -0
- package/components/Path.svelte.d.ts +1 -1
- package/components/RadioButton.svelte +11 -96
- package/components/RadioButton.svelte.d.ts +4 -2
- package/components/ResourceEditor.svelte +4 -5
- package/components/ResourceEditor.svelte.d.ts +2 -2
- package/components/ResourcePicker.svelte +25 -2
- package/components/ResourcePicker.svelte.d.ts +3 -0
- package/components/ResourceTypePicker.svelte +17 -29
- package/components/ResourceTypePicker.svelte.d.ts +1 -0
- package/components/RunForm.svelte +14 -15
- package/components/RunForm.svelte.d.ts +1 -1
- package/components/SchemaEditor.svelte +87 -71
- package/components/SchemaEditor.svelte.d.ts +2 -0
- package/components/SchemaEditorProperty.svelte +11 -0
- package/components/SchemaEditorProperty.svelte.d.ts +17 -0
- package/components/SchemaForm.svelte +21 -127
- package/components/SchemaForm.svelte.d.ts +3 -4
- package/components/SchemaModal.svelte +20 -33
- package/components/SchemaModal.svelte.d.ts +1 -1
- package/components/SchemaViewer.svelte +4 -6
- package/components/ScriptBuilder.svelte +40 -43
- package/components/ScriptEditor.svelte +71 -66
- package/components/ScriptPicker.svelte +10 -12
- package/components/ScriptPicker.svelte.d.ts +1 -1
- package/components/ScriptSchema.svelte +0 -5
- package/components/ShareModal.svelte +1 -1
- package/components/SharedBadge.svelte +12 -10
- package/components/StringTypeNarrowing.svelte +8 -4
- package/components/StringTypeNarrowing.svelte.d.ts +1 -0
- package/components/TableCustom.svelte +7 -9
- package/components/TableSimple.svelte +1 -1
- package/components/Toggle.svelte +8 -10
- package/components/Toggle.svelte.d.ts +5 -11
- package/components/Tooltip.svelte +3 -2
- package/components/VariableEditor.svelte +21 -6
- package/components/flows/CopyFirstStepSchema.svelte +7 -5
- package/components/flows/DynamicInputHelpBox.svelte +1 -1
- package/components/flows/FlowBox.svelte +3 -0
- package/components/flows/FlowBox.svelte.d.ts +23 -0
- package/components/flows/FlowBoxHeader.svelte +9 -0
- package/components/flows/FlowBoxHeader.svelte.d.ts +18 -0
- package/components/flows/FlowInput.svelte +20 -0
- package/components/flows/FlowInput.svelte.d.ts +14 -0
- package/components/flows/FlowInputs.svelte +7 -3
- package/components/flows/FlowModuleHeader.svelte +42 -40
- package/components/flows/FlowModuleHeader.svelte.d.ts +1 -1
- package/components/flows/FlowSettings.svelte +174 -0
- package/components/flows/FlowSettings.svelte.d.ts +21 -0
- package/components/flows/flowStore.d.ts +5 -2
- package/components/flows/flowStore.js +65 -9
- package/components/flows/pickers/FlowScriptPicker.svelte +6 -1
- package/components/flows/pickers/FlowScriptPicker.svelte.d.ts +1 -0
- package/components/flows/utils.d.ts +11 -7
- package/components/flows/utils.js +104 -43
- package/components/icons/AirtableIcon.svelte +17 -0
- package/components/icons/AirtableIcon.svelte.d.ts +17 -0
- package/components/icons/GCloudIcon.svelte +16 -0
- package/components/icons/GCloudIcon.svelte.d.ts +17 -0
- package/components/icons/GItlabIcon.svelte +16 -0
- package/components/icons/GItlabIcon.svelte.d.ts +17 -0
- package/components/icons/GSheetsIcon.svelte +16 -0
- package/components/icons/GSheetsIcon.svelte.d.ts +17 -0
- package/components/icons/GcalIcon.svelte +16 -0
- package/components/icons/GcalIcon.svelte.d.ts +17 -0
- package/components/icons/GdriveIcon.svelte +16 -0
- package/components/icons/GdriveIcon.svelte.d.ts +17 -0
- package/components/icons/GmailIcon.svelte +16 -0
- package/components/icons/GmailIcon.svelte.d.ts +17 -0
- package/components/icons/PostgresIcon.svelte +8 -49
- package/components/icons/Slack.svelte +9 -18
- package/components/icons/TogglIcon.svelte +59 -0
- package/components/icons/TogglIcon.svelte.d.ts +17 -0
- package/components/propertyPicker/ObjectViewer.svelte +35 -37
- package/components/propertyPicker/ObjectViewer.svelte.d.ts +1 -0
- package/components/propertyPicker/OverlayPropertyPicker.svelte +53 -53
- package/components/propertyPicker/OverlayPropertyPicker.svelte.d.ts +5 -2
- package/components/propertyPicker/PropPicker.svelte +13 -15
- package/components/propertyPicker/PropPicker.svelte.d.ts +1 -1
- package/components/propertyPicker/WarningMessage.svelte +14 -41
- package/components/propertyPicker/WarningMessage.svelte.d.ts +11 -8
- package/components/propertyPicker/utils.d.ts +1 -0
- package/components/propertyPicker/utils.js +25 -0
- package/gen/core/OpenAPI.js +1 -1
- package/gen/index.d.ts +11 -2
- package/gen/index.js +1 -2
- package/gen/models/CompletedJob.d.ts +1 -1
- package/gen/models/Flow.d.ts +3 -13
- package/gen/models/FlowMetadata.d.ts +9 -0
- package/gen/models/FlowMetadata.js +4 -0
- package/gen/models/FlowModuleValue.d.ts +5 -22
- package/gen/models/FlowModuleValue.js +1 -15
- package/gen/models/ForloopFlow.d.ts +8 -0
- package/gen/models/ForloopFlow.js +4 -0
- package/gen/models/InputTransform.d.ts +3 -12
- package/gen/models/InputTransform.js +1 -8
- package/gen/models/JavascriptTransform.d.ts +4 -0
- package/gen/models/JavascriptTransform.js +4 -0
- package/gen/models/MainArgSignature.d.ts +1 -1
- package/gen/models/NewSchedule.d.ts +1 -0
- package/gen/models/OpenFlowWPath.d.ts +4 -0
- package/gen/models/OpenFlowWPath.js +4 -0
- package/gen/models/PathFlow.d.ts +4 -0
- package/gen/models/PathFlow.js +4 -0
- package/gen/models/PathScript.d.ts +4 -0
- package/gen/models/PathScript.js +4 -0
- package/gen/models/RawScript.d.ts +12 -0
- package/gen/models/RawScript.js +11 -0
- package/gen/models/Schedule.d.ts +1 -1
- package/gen/models/StaticTransform.d.ts +4 -0
- package/gen/models/StaticTransform.js +4 -0
- package/gen/models/TokenResponse.d.ts +3 -3
- package/gen/models/Usage.d.ts +5 -0
- package/gen/models/Usage.js +4 -0
- package/gen/models/User.d.ts +2 -0
- package/gen/schemas/$AuditLog.d.ts +32 -0
- package/gen/schemas/$AuditLog.js +35 -0
- package/gen/schemas/$CompletedJob.d.ts +98 -0
- package/gen/schemas/$CompletedJob.js +103 -0
- package/gen/schemas/$ContextualVariable.d.ts +16 -0
- package/gen/schemas/$ContextualVariable.js +19 -0
- package/gen/schemas/$CreateResource.d.ts +22 -0
- package/gen/schemas/$CreateResource.js +25 -0
- package/gen/schemas/$CreateVariable.d.ts +26 -0
- package/gen/schemas/$CreateVariable.js +29 -0
- package/gen/schemas/$CreateWorkspace.d.ts +20 -0
- package/gen/schemas/$CreateWorkspace.js +23 -0
- package/gen/schemas/$EditResource.d.ts +13 -0
- package/gen/schemas/$EditResource.js +16 -0
- package/gen/schemas/$EditResourceType.d.ts +10 -0
- package/gen/schemas/$EditResourceType.js +13 -0
- package/gen/schemas/$EditSchedule.d.ts +20 -0
- package/gen/schemas/$EditSchedule.js +23 -0
- package/gen/schemas/$EditVariable.d.ts +16 -0
- package/gen/schemas/$EditVariable.js +19 -0
- package/gen/schemas/$EditWorkspaceUser.d.ts +7 -0
- package/gen/schemas/$EditWorkspaceUser.js +10 -0
- package/gen/schemas/$Flow.d.ts +23 -0
- package/gen/schemas/$Flow.js +26 -0
- package/gen/schemas/$FlowMetadata.d.ts +31 -0
- package/gen/schemas/$FlowMetadata.js +34 -0
- package/gen/schemas/$FlowPreview.d.ts +80 -0
- package/gen/schemas/$FlowPreview.js +83 -0
- package/gen/schemas/$GlobalUserInfo.d.ts +26 -0
- package/gen/schemas/$GlobalUserInfo.js +29 -0
- package/gen/schemas/$Group.d.ts +23 -0
- package/gen/schemas/$Group.js +26 -0
- package/gen/schemas/$Job.d.ts +17 -0
- package/gen/schemas/$Job.js +20 -0
- package/gen/schemas/$ListableVariable.d.ts +35 -0
- package/gen/schemas/$ListableVariable.js +38 -0
- package/gen/schemas/$Login.d.ts +12 -0
- package/gen/schemas/$Login.js +15 -0
- package/gen/schemas/$MainArgSignature.d.ts +50 -0
- package/gen/schemas/$MainArgSignature.js +53 -0
- package/gen/schemas/$NewSchedule.d.ts +30 -0
- package/gen/schemas/$NewSchedule.js +33 -0
- package/gen/schemas/$NewToken.d.ts +11 -0
- package/gen/schemas/$NewToken.js +14 -0
- package/gen/schemas/$NewUser.d.ts +16 -0
- package/gen/schemas/$NewUser.js +19 -0
- package/gen/schemas/$Preview.d.ts +19 -0
- package/gen/schemas/$Preview.js +22 -0
- package/gen/schemas/$QueuedJob.d.ts +139 -0
- package/gen/schemas/$QueuedJob.js +144 -0
- package/gen/schemas/$Resource.d.ts +31 -0
- package/gen/schemas/$Resource.js +34 -0
- package/gen/schemas/$ResourceType.d.ts +17 -0
- package/gen/schemas/$ResourceType.js +20 -0
- package/gen/schemas/$Schedule.d.ts +47 -0
- package/gen/schemas/$Schedule.js +50 -0
- package/gen/schemas/$Script.d.ts +77 -0
- package/gen/schemas/$Script.js +80 -0
- package/gen/schemas/$ScriptArgs.d.ts +6 -0
- package/gen/schemas/$ScriptArgs.js +9 -0
- package/gen/schemas/$SlackToken.d.ts +24 -0
- package/gen/schemas/$SlackToken.js +27 -0
- package/gen/schemas/$TokenResponse.d.ts +23 -0
- package/gen/schemas/$TokenResponse.js +26 -0
- package/gen/schemas/$TruncatedToken.d.ts +25 -0
- package/gen/schemas/$TruncatedToken.js +28 -0
- package/gen/schemas/$Usage.d.ts +13 -0
- package/gen/schemas/$Usage.js +16 -0
- package/gen/schemas/$User.d.ts +42 -0
- package/gen/schemas/$User.js +45 -0
- package/gen/schemas/$UserWorkspaceList.d.ts +28 -0
- package/gen/schemas/$UserWorkspaceList.js +31 -0
- package/gen/schemas/$WorkerPing.d.ts +31 -0
- package/gen/schemas/$WorkerPing.js +34 -0
- package/gen/schemas/$Workspace.d.ts +19 -0
- package/gen/schemas/$Workspace.js +22 -0
- package/gen/schemas/$WorkspaceInvite.d.ts +16 -0
- package/gen/schemas/$WorkspaceInvite.js +19 -0
- package/gen/services/FlowService.d.ts +24 -23
- package/gen/services/FlowService.js +14 -0
- package/gen/services/JobService.d.ts +1 -1
- package/gen/services/ScriptService.d.ts +13 -19
- package/gen/services/ScriptService.js +0 -14
- package/gen/services/WorkspaceService.d.ts +1 -1
- package/gen/services/WorkspaceService.js +1 -1
- package/infer.js +8 -1
- package/package.json +83 -15
- package/script_helpers.d.ts +1 -1
- package/script_helpers.js +7 -6
- package/sql.d.ts +89 -0
- package/sql.js +817 -0
- package/stores.d.ts +0 -1
- package/stores.js +0 -6
- package/utils.d.ts +12 -5
- package/utils.js +55 -9
- package/components/RadioButtonV2.svelte +0 -33
- package/components/RadioButtonV2.svelte.d.ts +0 -20
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import { emptySchema, sendUserToast } from '../utils';
|
|
2
|
+
import { faPen, faPlus, faTrash } from '@fortawesome/free-solid-svg-icons';
|
|
3
|
+
import { Button } from 'flowbite-svelte';
|
|
4
|
+
import { createEventDispatcher } from 'svelte';
|
|
5
|
+
import Icon from 'svelte-awesome';
|
|
2
6
|
import Editor from './Editor.svelte';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
7
|
+
import SchemaEditorProperty from './SchemaEditorProperty.svelte';
|
|
8
|
+
import SchemaModal, { DEFAULT_PROPERTY, schemaToModal } from './SchemaModal.svelte';
|
|
5
9
|
import TableCustom from './TableCustom.svelte';
|
|
10
|
+
import Toggle from './Toggle.svelte';
|
|
11
|
+
import Tooltip from './Tooltip.svelte';
|
|
12
|
+
const dispatch = createEventDispatcher();
|
|
6
13
|
export let schema = emptySchema();
|
|
7
14
|
let schemaModal;
|
|
8
15
|
let schemaString = '';
|
|
@@ -28,6 +35,18 @@ export function getSchema() {
|
|
|
28
35
|
throw Error(`Error: input is not a valid schema: ${err}`);
|
|
29
36
|
}
|
|
30
37
|
}
|
|
38
|
+
function modalToSchema(schema) {
|
|
39
|
+
return {
|
|
40
|
+
type: schema.selectedType,
|
|
41
|
+
description: schema.description,
|
|
42
|
+
pattern: schema.pattern,
|
|
43
|
+
default: schema.default,
|
|
44
|
+
enum: schema.enum_,
|
|
45
|
+
items: schema.items,
|
|
46
|
+
contentEncoding: schema.contentEncoding,
|
|
47
|
+
format: schema.format
|
|
48
|
+
};
|
|
49
|
+
}
|
|
31
50
|
function handleAddOrEditArgument() {
|
|
32
51
|
// If editing the arg's name, oldName containing the old argument name must be provided
|
|
33
52
|
argError = '';
|
|
@@ -58,14 +77,15 @@ function handleAddOrEditArgument() {
|
|
|
58
77
|
}
|
|
59
78
|
schema = schema;
|
|
60
79
|
schemaString = JSON.stringify(schema, null, '\t');
|
|
80
|
+
dispatch('change', schema);
|
|
61
81
|
}
|
|
62
82
|
function startEditArgument(argName) {
|
|
63
83
|
argError = '';
|
|
64
84
|
if (Object.keys(schema.properties).includes(argName)) {
|
|
65
|
-
schemaModal.openModal();
|
|
66
85
|
editing = true;
|
|
67
86
|
modalProperty = schemaToModal(schema.properties[argName], argName, schema.required.includes(argName));
|
|
68
87
|
oldArgName = argName;
|
|
88
|
+
schemaModal.openModal();
|
|
69
89
|
}
|
|
70
90
|
else {
|
|
71
91
|
sendUserToast(`This argument does not exist and can't be edited`, true);
|
|
@@ -75,8 +95,13 @@ function handleDeleteArgument(argName) {
|
|
|
75
95
|
try {
|
|
76
96
|
if (Object.keys(schema.properties).includes(argName)) {
|
|
77
97
|
delete schema.properties[argName];
|
|
98
|
+
const requiredIndex = schema.required.findIndex((arg) => arg === argName);
|
|
99
|
+
if (requiredIndex > -1) {
|
|
100
|
+
schema.required = schema.required.slice(requiredIndex, 1);
|
|
101
|
+
}
|
|
78
102
|
schema = schema;
|
|
79
103
|
schemaString = JSON.stringify(schema, null, '\t');
|
|
104
|
+
dispatch('change', schema);
|
|
80
105
|
}
|
|
81
106
|
else {
|
|
82
107
|
throw Error('Argument not found!');
|
|
@@ -101,93 +126,84 @@ function switchTab() {
|
|
|
101
126
|
</script>
|
|
102
127
|
|
|
103
128
|
<div class="flex flex-col">
|
|
104
|
-
<div class="
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
schemaModal.openModal()
|
|
130
|
-
}}>Add argument</button
|
|
131
|
-
>
|
|
129
|
+
<div class="flex justify-between">
|
|
130
|
+
<Button
|
|
131
|
+
on:click={() => {
|
|
132
|
+
modalProperty = Object.assign({}, DEFAULT_PROPERTY)
|
|
133
|
+
schemaModal.openModal()
|
|
134
|
+
}}
|
|
135
|
+
class="blue-button"
|
|
136
|
+
>
|
|
137
|
+
<Icon data={faPlus} class="mr-1" />
|
|
138
|
+
Add argument
|
|
139
|
+
</Button>
|
|
140
|
+
|
|
141
|
+
<div class="flex items-center">
|
|
142
|
+
<Toggle
|
|
143
|
+
on:change={() => switchTab()}
|
|
144
|
+
options={{
|
|
145
|
+
right: 'Json Schema Editor'
|
|
146
|
+
}}
|
|
147
|
+
/>
|
|
148
|
+
<div class="ml-2">
|
|
149
|
+
<Tooltip>
|
|
150
|
+
Arguments can be edited either using the wizard, or by editing their json-schema
|
|
151
|
+
<a href="https://docs.windmill.dev/docs/reference/script_arguments_reference">docs</a>
|
|
152
|
+
</Tooltip>
|
|
153
|
+
</div>
|
|
132
154
|
</div>
|
|
133
155
|
</div>
|
|
156
|
+
|
|
134
157
|
<!--json schema or table view-->
|
|
135
|
-
<div class="
|
|
158
|
+
<div class="h-full overflow-y-auto">
|
|
136
159
|
{#if !viewJsonSchema}
|
|
137
160
|
<div class="h-full">
|
|
138
161
|
{#if schema.properties && Object.keys(schema.properties).length > 0 && schema.required}
|
|
139
|
-
<TableCustom
|
|
140
|
-
<tr slot="header-row"
|
|
141
|
-
<th>
|
|
142
|
-
<th>
|
|
143
|
-
<th>
|
|
144
|
-
<th>
|
|
145
|
-
<th>
|
|
162
|
+
<TableCustom>
|
|
163
|
+
<tr slot="header-row">
|
|
164
|
+
<th>Name</th>
|
|
165
|
+
<th>Type</th>
|
|
166
|
+
<th>Description</th>
|
|
167
|
+
<th>Default</th>
|
|
168
|
+
<th>Required</th>
|
|
169
|
+
<th />
|
|
146
170
|
</tr>
|
|
147
171
|
<tbody slot="body">
|
|
148
172
|
{#each Object.entries(schema.properties) as [name, property] (name)}
|
|
149
173
|
<tr>
|
|
150
|
-
<td>{name}</td>
|
|
151
|
-
<td
|
|
152
|
-
|
|
153
|
-
>
|
|
174
|
+
<td class="font-bold">{name}</td>
|
|
175
|
+
<td>
|
|
176
|
+
<SchemaEditorProperty {property} />
|
|
177
|
+
</td>
|
|
154
178
|
<td>{property.description}</td>
|
|
155
179
|
<td>{JSON.stringify(property.default) ?? ''}</td>
|
|
156
|
-
<td>{schema.required.includes(name) ? '
|
|
157
|
-
<td class="">
|
|
158
|
-
<
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
165
|
-
>
|
|
166
|
-
<path
|
|
167
|
-
stroke-linecap="round"
|
|
168
|
-
stroke-linejoin="round"
|
|
169
|
-
stroke-width="2"
|
|
170
|
-
d="M6 18L18 6M6 6l12 12"
|
|
171
|
-
/>
|
|
172
|
-
</svg></button
|
|
180
|
+
<td>{schema.required.includes(name) ? 'Required' : 'Optional'}</td>
|
|
181
|
+
<td class="justify-end flex">
|
|
182
|
+
<Button
|
|
183
|
+
color="red"
|
|
184
|
+
outline
|
|
185
|
+
class="mr-2"
|
|
186
|
+
size="xs"
|
|
187
|
+
on:click={() => handleDeleteArgument(name)}
|
|
173
188
|
>
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}}
|
|
179
|
-
|
|
180
|
-
|
|
189
|
+
<Icon data={faTrash} class="mr-2" scale={0.8} />
|
|
190
|
+
Delete
|
|
191
|
+
</Button>
|
|
192
|
+
<Button color="alternative" size="xs" on:click={() => startEditArgument(name)}>
|
|
193
|
+
<Icon data={faPen} class="mr-2" scale={0.8} />
|
|
194
|
+
Edit
|
|
195
|
+
</Button>
|
|
196
|
+
</td>
|
|
181
197
|
</tr>
|
|
182
198
|
{/each}
|
|
183
199
|
</tbody>
|
|
184
200
|
</TableCustom>
|
|
185
201
|
{:else}
|
|
186
|
-
<div class="text-gray-700 text-xs italic">This
|
|
202
|
+
<div class="text-gray-700 text-xs italic mt-2">This schema has no arguments.</div>
|
|
187
203
|
{/if}
|
|
188
204
|
</div>
|
|
189
205
|
{:else}
|
|
190
|
-
<div>
|
|
206
|
+
<div class="border rounded mt-4 p-2">
|
|
191
207
|
<Editor
|
|
192
208
|
on:change={() => {
|
|
193
209
|
try {
|
|
@@ -197,7 +213,7 @@ function switchTab() {
|
|
|
197
213
|
}
|
|
198
214
|
}}
|
|
199
215
|
bind:code={schemaString}
|
|
200
|
-
lang=
|
|
216
|
+
lang="json"
|
|
201
217
|
class="small-editor"
|
|
202
218
|
/>
|
|
203
219
|
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<script>import { Badge } from 'flowbite-svelte';
|
|
2
|
+
export let property;
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<Badge color="blue">{property.type?.toUpperCase() ?? 'ANY'}</Badge>
|
|
6
|
+
{#if property.format}
|
|
7
|
+
<Badge color="green">{property.format?.toUpperCase()}</Badge>
|
|
8
|
+
{/if}
|
|
9
|
+
{#if property.contentEncoding}
|
|
10
|
+
<Badge color="indigo">{property.contentEncoding?.toUpperCase()}</Badge>
|
|
11
|
+
{/if}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { SchemaProperty } from '../common';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
property: SchemaProperty;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export declare type SchemaEditorPropertyProps = typeof __propDef.props;
|
|
13
|
+
export declare type SchemaEditorPropertyEvents = typeof __propDef.events;
|
|
14
|
+
export declare type SchemaEditorPropertySlots = typeof __propDef.slots;
|
|
15
|
+
export default class SchemaEditorProperty extends SvelteComponentTyped<SchemaEditorPropertyProps, SchemaEditorPropertyEvents, SchemaEditorPropertySlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -1,145 +1,39 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
import { allTrue } from '../utils';
|
|
1
|
+
<script>import { allTrue } from '../utils';
|
|
3
2
|
import ArgInput from './ArgInput.svelte';
|
|
4
|
-
import
|
|
5
|
-
import FieldHeader from './FieldHeader.svelte';
|
|
6
|
-
import DynamicInputHelpBox from './flows/DynamicInputHelpBox.svelte';
|
|
7
|
-
import { getCodeInjectionExpr, getDefaultExpr, isCodeInjection } from './flows/utils';
|
|
8
|
-
import OverlayPropertyPicker from './propertyPicker/OverlayPropertyPicker.svelte';
|
|
9
|
-
import Toggle from './Toggle.svelte';
|
|
3
|
+
import InputTransformForm from './InputTransformForm.svelte';
|
|
10
4
|
export let inputTransform = false;
|
|
11
5
|
export let schema;
|
|
12
6
|
export let args = {};
|
|
13
7
|
export let editableSchema = false;
|
|
14
|
-
export let extraLib = 'missing extraLib';
|
|
15
8
|
export let isValid = true;
|
|
9
|
+
export let pickableProperties = undefined;
|
|
10
|
+
export let extraLib = 'missing extraLib';
|
|
16
11
|
export let i = undefined;
|
|
17
|
-
export let previousSchema = undefined;
|
|
18
12
|
let inputCheck = {};
|
|
19
13
|
$: isValid = allTrue(inputCheck) ?? false;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (!arg) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
if (isCodeInjection(rawValue)) {
|
|
28
|
-
args[id].expr = getCodeInjectionExpr(rawValue, isRaw);
|
|
29
|
-
args[id].type = InputTransform.type.JAVASCRIPT;
|
|
30
|
-
propertiesTypes[id] = InputTransform.type.STATIC;
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
if (args[id].type === InputTransform.type.JAVASCRIPT &&
|
|
34
|
-
propertiesTypes[id] === InputTransform.type.STATIC) {
|
|
35
|
-
args[id].type = InputTransform.type.STATIC;
|
|
36
|
-
if (inputCats[id] == 'number') {
|
|
37
|
-
args[id].value = Number(args[id].value);
|
|
38
|
-
}
|
|
14
|
+
function removeExtraKey() {
|
|
15
|
+
Object.keys(args).forEach((key) => {
|
|
16
|
+
if (!Object.keys(schema?.properties ?? {}).includes(key)) {
|
|
17
|
+
delete args[key];
|
|
39
18
|
}
|
|
40
|
-
|
|
41
|
-
propertiesTypes[id] = arg.type;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function hasOverlay(inputCat) {
|
|
46
|
-
return inputCat === 'string' || inputCat === 'number';
|
|
19
|
+
});
|
|
47
20
|
}
|
|
21
|
+
$: Object.keys(schema?.properties ?? {}).length > 0 && removeExtraKey();
|
|
48
22
|
</script>
|
|
49
23
|
|
|
50
24
|
<div class="w-full">
|
|
51
25
|
{#if Object.keys(schema?.properties ?? {}).length > 0}
|
|
52
|
-
{#each Object.keys(schema?.properties ?? {}) as argName
|
|
53
|
-
{#if inputTransform
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
itemsType={schema.properties[argName].items}
|
|
64
|
-
/>
|
|
65
|
-
{#if propertiesTypes[argName] === InputTransform.type.STATIC && args[argName].type === InputTransform.type.JAVASCRIPT}
|
|
66
|
-
<span
|
|
67
|
-
class="bg-blue-100 text-blue-800 text-sm font-medium mr-2 px-2.5 py-0.5 rounded ml-2"
|
|
68
|
-
>
|
|
69
|
-
{'${...}'}
|
|
70
|
-
</span>
|
|
71
|
-
{/if}
|
|
72
|
-
</div>
|
|
73
|
-
<Toggle
|
|
74
|
-
options={{
|
|
75
|
-
left: { label: '', value: InputTransform.type.STATIC },
|
|
76
|
-
right: { label: 'Raw Javascript Editor', value: InputTransform.type.JAVASCRIPT }
|
|
77
|
-
}}
|
|
78
|
-
bind:value={propertiesTypes[argName]}
|
|
79
|
-
on:change={(e) => {
|
|
80
|
-
if (e.detail === InputTransform.type.JAVASCRIPT) {
|
|
81
|
-
args[argName].expr = getDefaultExpr(i ?? -1, argName)
|
|
82
|
-
args[argName].value = undefined
|
|
83
|
-
} else {
|
|
84
|
-
args[argName].expr = undefined
|
|
85
|
-
args[argName].value = undefined
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
args[argName].type = e.detail
|
|
89
|
-
}}
|
|
90
|
-
/>
|
|
91
|
-
</div>
|
|
92
|
-
<div class="max-w-xs" />
|
|
93
|
-
|
|
94
|
-
{#if propertiesTypes[argName] === undefined || propertiesTypes[argName] === InputTransform.type.STATIC}
|
|
95
|
-
<OverlayPropertyPicker
|
|
96
|
-
{previousSchema}
|
|
97
|
-
disabled={!hasOverlay(inputCats[argName])}
|
|
98
|
-
on:select={(event) => {
|
|
99
|
-
const toAppend = `\$\{previous_result.${event.detail}}`
|
|
100
|
-
args[argName].value = `${args[argName].value ?? ''}${toAppend}`
|
|
101
|
-
setPropertyType(argName, args[argName].value, false)
|
|
102
|
-
}}
|
|
103
|
-
>
|
|
104
|
-
<ArgInput
|
|
105
|
-
label={argName}
|
|
106
|
-
bind:description={schema.properties[argName].description}
|
|
107
|
-
bind:value={args[argName].value}
|
|
108
|
-
type={schema.properties[argName].type}
|
|
109
|
-
required={schema.required.includes(argName)}
|
|
110
|
-
bind:pattern={schema.properties[argName].pattern}
|
|
111
|
-
bind:valid={inputCheck[argName]}
|
|
112
|
-
defaultValue={schema.properties[argName].default}
|
|
113
|
-
bind:enum_={schema.properties[argName].enum}
|
|
114
|
-
bind:format={schema.properties[argName].format}
|
|
115
|
-
contentEncoding={schema.properties[argName].contentEncoding}
|
|
116
|
-
bind:itemsType={schema.properties[argName].items}
|
|
117
|
-
displayHeader={false}
|
|
118
|
-
bind:inputCat={inputCats[argName]}
|
|
119
|
-
numberAsString={true}
|
|
120
|
-
on:input={(e) => {
|
|
121
|
-
if (hasOverlay(inputCats[argName])) {
|
|
122
|
-
setPropertyType(argName, e.detail.rawValue, e.detail.isRaw)
|
|
123
|
-
}
|
|
124
|
-
}}
|
|
125
|
-
/>
|
|
126
|
-
</OverlayPropertyPicker>
|
|
127
|
-
{:else if propertiesTypes[argName] === InputTransform.type.JAVASCRIPT}
|
|
128
|
-
{#if args[argName].expr != undefined}
|
|
129
|
-
<div class="border rounded p-2 mt-2 border-gray-300">
|
|
130
|
-
<Editor
|
|
131
|
-
bind:code={args[argName].expr}
|
|
132
|
-
lang="typescript"
|
|
133
|
-
class="few-lines-editor"
|
|
134
|
-
{extraLib}
|
|
135
|
-
extraLibPath="file:///node_modules/@types/windmill@{i}/index.d.ts"
|
|
136
|
-
/>
|
|
137
|
-
</div>
|
|
138
|
-
<DynamicInputHelpBox />
|
|
139
|
-
{/if}
|
|
140
|
-
{:else}
|
|
141
|
-
<p>Not recognized arg type {args[argName].type}</p>
|
|
142
|
-
{/if}
|
|
26
|
+
{#each Object.keys(schema?.properties ?? {}) as argName}
|
|
27
|
+
{#if inputTransform}
|
|
28
|
+
<InputTransformForm
|
|
29
|
+
bind:arg={args[argName]}
|
|
30
|
+
bind:schema
|
|
31
|
+
bind:argName
|
|
32
|
+
bind:inputCheck
|
|
33
|
+
bind:pickableProperties
|
|
34
|
+
bind:extraLib
|
|
35
|
+
bind:i
|
|
36
|
+
/>
|
|
143
37
|
{:else}
|
|
144
38
|
<ArgInput
|
|
145
39
|
label={argName}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import type { Schema } from '../common';
|
|
3
|
-
import { InputTransform } from '../gen';
|
|
4
3
|
declare const __propDef: {
|
|
5
4
|
props: {
|
|
6
5
|
inputTransform?: boolean | undefined;
|
|
7
6
|
schema: Schema;
|
|
8
|
-
args?: Record<string,
|
|
7
|
+
args?: Record<string, any> | undefined;
|
|
9
8
|
editableSchema?: boolean | undefined;
|
|
10
|
-
extraLib?: string | undefined;
|
|
11
9
|
isValid?: boolean | undefined;
|
|
10
|
+
pickableProperties?: Object | undefined;
|
|
11
|
+
extraLib?: string | undefined;
|
|
12
12
|
i?: number | undefined;
|
|
13
|
-
previousSchema?: Object | undefined;
|
|
14
13
|
};
|
|
15
14
|
events: {
|
|
16
15
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
<script context="module">import Modal from './Modal.svelte';
|
|
2
2
|
export const ARG_TYPES = ['integer', 'number', 'string', 'boolean', 'object', 'array'];
|
|
3
|
-
export function modalToSchema(schema) {
|
|
4
|
-
return {
|
|
5
|
-
type: schema.selectedType,
|
|
6
|
-
description: schema.description,
|
|
7
|
-
pattern: schema.pattern,
|
|
8
|
-
default: schema.default,
|
|
9
|
-
enum: schema.enum_,
|
|
10
|
-
items: schema.items
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
3
|
export function schemaToModal(schema, name, required) {
|
|
14
4
|
return {
|
|
15
5
|
name,
|
|
@@ -17,6 +7,8 @@ export function schemaToModal(schema, name, required) {
|
|
|
17
7
|
description: schema.description,
|
|
18
8
|
pattern: schema.pattern,
|
|
19
9
|
default: schema.default,
|
|
10
|
+
contentEncoding: schema.contentEncoding,
|
|
11
|
+
format: schema.format,
|
|
20
12
|
required
|
|
21
13
|
};
|
|
22
14
|
}
|
|
@@ -33,14 +25,17 @@ import { createEventDispatcher } from 'svelte';
|
|
|
33
25
|
import ArgInput from './ArgInput.svelte';
|
|
34
26
|
import StringTypeNarrowing from './StringTypeNarrowing.svelte';
|
|
35
27
|
import Required from './Required.svelte';
|
|
28
|
+
import ObjectTypeNarrowing from './ObjectTypeNarrowing.svelte';
|
|
36
29
|
export let property = DEFAULT_PROPERTY;
|
|
37
30
|
export let error = '';
|
|
38
31
|
export let editing = false;
|
|
39
32
|
export let oldArgName = undefined;
|
|
33
|
+
let resource_type = undefined;
|
|
40
34
|
const dispatch = createEventDispatcher();
|
|
41
35
|
let modal;
|
|
42
36
|
export function openModal() {
|
|
43
37
|
modal.openModal();
|
|
38
|
+
resource_type = property.format?.substring(5);
|
|
44
39
|
}
|
|
45
40
|
export function closeModal() {
|
|
46
41
|
modal.closeModal();
|
|
@@ -54,6 +49,11 @@ function clearModal() {
|
|
|
54
49
|
property.description = DEFAULT_PROPERTY.description;
|
|
55
50
|
property.required = DEFAULT_PROPERTY.required;
|
|
56
51
|
property.selectedType = DEFAULT_PROPERTY.selectedType;
|
|
52
|
+
property.format = undefined;
|
|
53
|
+
resource_type = undefined;
|
|
54
|
+
}
|
|
55
|
+
$: if (property.selectedType == 'object' && resource_type) {
|
|
56
|
+
property.format = resource_type ? `$res:${resource_type}` : undefined;
|
|
57
57
|
}
|
|
58
58
|
</script>
|
|
59
59
|
|
|
@@ -77,12 +77,16 @@ function clearModal() {
|
|
|
77
77
|
/>
|
|
78
78
|
</label>
|
|
79
79
|
<h3 class="font-semibold text-gray-700">Type<Required required={true} /></h3>
|
|
80
|
-
<div class="grid sm:grid-cols-3 md:grid-cols-4 gap-x-2 gap-y-1 items-center mb-2">
|
|
80
|
+
<div class="grid sm:grid-cols-3 md:grid-cols-4 gap-x-2 gap-y-1 items-center mb-2 w-full">
|
|
81
81
|
{#each ARG_TYPES as argType}
|
|
82
82
|
<button
|
|
83
83
|
class={argType == property.selectedType ? 'item-button-selected' : 'item-button'}
|
|
84
84
|
on:click={() => {
|
|
85
85
|
property.selectedType = argType
|
|
86
|
+
property.format = undefined
|
|
87
|
+
property.contentEncoding = undefined
|
|
88
|
+
property.enum_ = undefined
|
|
89
|
+
property.pattern = undefined
|
|
86
90
|
}}>{argType}</button
|
|
87
91
|
>
|
|
88
92
|
{/each}
|
|
@@ -106,13 +110,14 @@ function clearModal() {
|
|
|
106
110
|
pattern={property.pattern}
|
|
107
111
|
/>
|
|
108
112
|
{#if property.selectedType !== 'boolean'}
|
|
109
|
-
<h2 class="mb-2">Advanced</h2>
|
|
113
|
+
<h2 class="mb-2 mt-4">Advanced</h2>
|
|
110
114
|
|
|
111
115
|
{#if property.selectedType == 'string'}
|
|
112
116
|
<StringTypeNarrowing
|
|
113
117
|
bind:format={property.format}
|
|
114
118
|
bind:pattern={property.pattern}
|
|
115
119
|
bind:enum_={property.enum_}
|
|
120
|
+
bind:contentEncoding={property.contentEncoding}
|
|
116
121
|
/>
|
|
117
122
|
{:else if property.selectedType == 'array'}
|
|
118
123
|
<select bind:value={property.items}>
|
|
@@ -120,6 +125,9 @@ function clearModal() {
|
|
|
120
125
|
<option value={{ type: 'string' }}> Items are strings</option>
|
|
121
126
|
<option value={{ type: 'number' }}>Items are numbers</option>
|
|
122
127
|
</select>
|
|
128
|
+
{:else if property.selectedType == 'object'}
|
|
129
|
+
<h3 class="mb-2 font-bold mt-4">Resource type</h3>
|
|
130
|
+
<ObjectTypeNarrowing bind:format={property.format} />
|
|
123
131
|
{:else}
|
|
124
132
|
<p>No advanced configuration for this type</p>
|
|
125
133
|
{/if}
|
|
@@ -137,24 +145,3 @@ function clearModal() {
|
|
|
137
145
|
Save
|
|
138
146
|
</button>
|
|
139
147
|
</Modal>
|
|
140
|
-
|
|
141
|
-
<style>
|
|
142
|
-
.item-button {
|
|
143
|
-
padding-top: 0.25rem;
|
|
144
|
-
padding-bottom: 0.25rem;
|
|
145
|
-
border-width: 1px;
|
|
146
|
-
border-radius: 0.125rem
|
|
147
|
-
}
|
|
148
|
-
.item-button-selected {
|
|
149
|
-
-webkit-text-decoration-line: underline;
|
|
150
|
-
text-decoration-line: underline;
|
|
151
|
-
font-weight: 700;
|
|
152
|
-
padding-top: 0.25rem;
|
|
153
|
-
padding-bottom: 0.25rem;
|
|
154
|
-
border-width: 1px;
|
|
155
|
-
--tw-border-opacity: 1;
|
|
156
|
-
border-color: rgb(59 130 246 / var(--tw-border-opacity));
|
|
157
|
-
--tw-bg-opacity: 1;
|
|
158
|
-
background-color: rgb(239 246 255 / var(--tw-bg-opacity));
|
|
159
|
-
border-radius: 0.125rem
|
|
160
|
-
}</style>
|
|
@@ -14,8 +14,8 @@ export interface ModalSchemaProperty {
|
|
|
14
14
|
items?: {
|
|
15
15
|
type?: 'string' | 'number';
|
|
16
16
|
};
|
|
17
|
+
contentEncoding?: 'base64' | 'binary';
|
|
17
18
|
}
|
|
18
|
-
export declare function modalToSchema(schema: ModalSchemaProperty): SchemaProperty;
|
|
19
19
|
export declare function schemaToModal(schema: SchemaProperty, name: string, required: boolean): ModalSchemaProperty;
|
|
20
20
|
export declare const DEFAULT_PROPERTY: ModalSchemaProperty;
|
|
21
21
|
declare const __propDef: {
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
<script>import { emptySchema } from '../utils';
|
|
2
2
|
import Highlight from 'svelte-highlight';
|
|
3
3
|
import json from 'svelte-highlight/languages/json';
|
|
4
|
-
import github from 'svelte-highlight/styles/github';
|
|
5
4
|
import TableCustom from './TableCustom.svelte';
|
|
6
5
|
export let schema = emptySchema();
|
|
7
6
|
let viewJsonSchema = false;
|
|
8
7
|
</script>
|
|
9
8
|
|
|
10
|
-
<svelte:head>
|
|
11
|
-
{@html github}
|
|
12
|
-
</svelte:head>
|
|
13
|
-
|
|
14
9
|
<div class="w-full">
|
|
15
10
|
<div class="flex flex-col sm:flex-row text-base">
|
|
16
11
|
<button
|
|
@@ -59,7 +54,10 @@ let viewJsonSchema = false;
|
|
|
59
54
|
? JSON.stringify(property.default)
|
|
60
55
|
: ''}</td
|
|
61
56
|
>
|
|
62
|
-
<td
|
|
57
|
+
<td
|
|
58
|
+
>{property.format ?? ''}
|
|
59
|
+
{property.contentEncoding ? `(encoding: ${property.contentEncoding})` : ''}</td
|
|
60
|
+
>
|
|
63
61
|
<td>{schema.required.includes(name) ? 'required' : 'optional'}</td>
|
|
64
62
|
</tr>
|
|
65
63
|
{/each}
|