windmill-components 1.405.0 → 1.406.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/package/assets/app.css +20 -0
- package/package/components/AppConnectLightweightResourcePicker.svelte +66 -0
- package/package/components/AppConnectLightweightResourcePicker.svelte.d.ts +21 -0
- package/package/components/ArgInput.svelte +6 -2
- package/package/components/ArgInput.svelte.d.ts +1 -0
- package/package/components/CustomPopover.svelte +1 -1
- package/package/components/DisplayResult.svelte +1 -1
- package/package/components/FlowBuilder.svelte +2 -0
- package/package/components/FlowBuilder.svelte.d.ts +1 -0
- package/package/components/FlowInputViewer.svelte +25 -0
- package/package/components/FlowInputViewer.svelte.d.ts +19 -0
- package/package/components/FlowJobResult.svelte +8 -1
- package/package/components/FlowJobResult.svelte.d.ts +1 -0
- package/package/components/FlowMetadata.svelte +2 -2
- package/package/components/FlowPreviewContent.svelte +2 -1
- package/package/components/FlowStatusViewer.svelte +3 -1
- package/package/components/FlowStatusViewer.svelte.d.ts +1 -0
- package/package/components/FlowStatusViewerInner.svelte +4 -1
- package/package/components/FlowViewer.svelte +2 -21
- package/package/components/LightweightResourcePicker.svelte +34 -30
- package/package/components/LogViewer.svelte +4 -3
- package/package/components/LogViewer.svelte.d.ts +1 -0
- package/package/components/ManualPopover.svelte +1 -1
- package/package/components/ObjectResourceInput.svelte +5 -2
- package/package/components/ObjectResourceInput.svelte.d.ts +2 -0
- package/package/components/Popover.svelte +1 -1
- package/package/components/Portal.svelte +7 -8
- package/package/components/Portal.svelte.d.ts +3 -7
- package/package/components/QueueMetricsDrawer.svelte +368 -3
- package/package/components/QueueMetricsDrawer.svelte.d.ts +2 -0
- package/package/components/ResourceEditor.svelte +4 -5
- package/package/components/ResourcePicker.svelte +14 -9
- package/package/components/ResourcePicker.svelte.d.ts +1 -0
- package/package/components/RunForm.svelte +1 -1
- package/package/components/SavedInputs.svelte +2 -2
- package/package/components/ScriptVersionHistory.svelte +54 -59
- package/package/components/TestConnection.svelte +1 -0
- package/package/components/TimeAgo.svelte +5 -6
- package/package/components/TimeAgo.svelte.d.ts +1 -1
- package/package/components/apps/components/buttons/AppButton.svelte +1 -1
- package/package/components/apps/components/display/dbtable/AppDbExplorer.svelte +1 -1
- package/package/components/apps/components/inputs/AppMultiSelect.svelte +1 -1
- package/package/components/apps/components/inputs/AppMultiSelectV2.svelte +1 -1
- package/package/components/apps/components/layout/AppDrawer.svelte +1 -1
- package/package/components/apps/components/layout/AppModal.svelte +1 -1
- package/package/components/apps/editor/AppEditor.svelte +11 -3
- package/package/components/apps/editor/GridEditor.svelte +57 -4
- package/package/components/apps/editor/GridEditor.svelte.d.ts +8 -0
- package/package/components/apps/editor/GridEditorMenu.svelte +1 -1
- package/package/components/apps/editor/SubGridEditor.svelte +82 -3
- package/package/components/apps/editor/SubGridEditor.svelte.d.ts +16 -0
- package/package/components/apps/editor/appUtils.d.ts +19 -2
- package/package/components/apps/editor/appUtils.js +103 -7
- package/package/components/apps/editor/component/Component.svelte +36 -8
- package/package/components/apps/editor/component/Component.svelte.d.ts +3 -1
- package/package/components/apps/editor/contextPanel/components/OutputHeader.svelte +1 -1
- package/package/components/apps/svelte-grid/Grid.svelte +235 -12
- package/package/components/apps/svelte-grid/Grid.svelte.d.ts +7 -7
- package/package/components/apps/svelte-grid/MoveResize.svelte +104 -11
- package/package/components/apps/svelte-grid/MoveResize.svelte.d.ts +7 -0
- package/package/components/apps/svelte-grid/utils/item.d.ts +4 -1
- package/package/components/apps/svelte-grid/utils/item.js +2 -3
- package/package/components/apps/svelte-select/lib/ConditionalPortal.svelte +1 -1
- package/package/components/apps/svelte-select/lib/ConditionalPortalGlobal.svelte +1 -1
- package/package/components/common/button/ButtonDropdown.svelte +1 -1
- package/package/components/common/drawer/ConditionalPortal.svelte +1 -1
- package/package/components/common/menu/MenuV2.svelte +1 -1
- package/package/components/common/modal/AlwaysMountedModal.svelte +1 -1
- package/package/components/common/popup/PopupV2.svelte +1 -1
- package/package/components/copilot/StepGenQuick.svelte +3 -2
- package/package/components/copilot/StepGenQuick.svelte.d.ts +1 -0
- package/package/components/custom_ui.d.ts +1 -0
- package/package/components/details/Menu.svelte +1 -1
- package/package/components/flows/CreateActionsApp.svelte +1 -1
- package/package/components/flows/FlowEditor.svelte +2 -1
- package/package/components/flows/FlowEditor.svelte.d.ts +1 -0
- package/package/components/flows/FlowHistory.svelte +10 -195
- package/package/components/flows/FlowHistory.svelte.d.ts +0 -1
- package/package/components/flows/FlowHistoryInner.svelte +200 -0
- package/package/components/flows/FlowHistoryInner.svelte.d.ts +19 -0
- package/package/components/flows/content/FlowEditorPanel.svelte +2 -1
- package/package/components/flows/content/FlowEditorPanel.svelte.d.ts +1 -0
- package/package/components/flows/content/FlowInput.svelte +66 -58
- package/package/components/flows/content/FlowInput.svelte.d.ts +1 -0
- package/package/components/flows/content/FlowModuleScript.svelte +1 -1
- package/package/components/flows/header/FlowYamlEditor.svelte +6 -2
- package/package/components/flows/map/FlowModuleSchemaMap.svelte +3 -2
- package/package/components/flows/map/InsertModuleButton.svelte +1 -1
- package/package/components/flows/pickers/WorkspaceScriptPickerQuick.svelte +1 -1
- package/package/components/graph/model.d.ts +1 -0
- package/package/components/icons/WindmillIcon.svelte +119 -105
- package/package/components/icons/store.d.ts +4 -0
- package/package/components/icons/store.js +1 -0
- package/package/components/multiselect/MultiSelectWrapper.svelte +1 -1
- package/package/components/propertyPicker/ObjectViewer.svelte +1 -1
- package/package/components/runs/RunRow.svelte +3 -7
- package/package/components/schema/FlowPropertyEditor.svelte +1 -0
- package/package/components/search/GlobalSearchModal.svelte +1 -1
- package/package/script_helpers.d.ts +37 -38
- package/package/script_helpers.js +100 -38
- package/package.json +23 -1
- package/package/init_scripts/python_failure_module.d.ts +0 -2
- package/package/init_scripts/python_failure_module.js +0 -8
- package/package/init_scripts/python_init_code.d.ts +0 -2
- package/package/init_scripts/python_init_code.js +0 -40
- package/package/init_scripts/python_init_code_clear.d.ts +0 -2
- package/package/init_scripts/python_init_code_clear.js +0 -5
- package/package/init_scripts/python_init_code_trigger.d.ts +0 -2
- package/package/init_scripts/python_init_code_trigger.js +0 -14
|
@@ -1,43 +1,42 @@
|
|
|
1
1
|
import { type Script } from './gen';
|
|
2
|
-
import PYTHON_INIT_CODE from './init_scripts/python_init_code';
|
|
3
|
-
import PYTHON_INIT_CODE_CLEAR from './init_scripts/python_init_code_clear';
|
|
4
|
-
import PYTHON_INIT_CODE_TRIGGER from './init_scripts/python_init_code_trigger';
|
|
5
|
-
import PYTHON_FAILURE_MODULE_CODE from './init_scripts/python_failure_module';
|
|
6
2
|
import type { SupportedLanguage } from './common';
|
|
7
|
-
export
|
|
8
|
-
export declare
|
|
9
|
-
export declare
|
|
10
|
-
export declare
|
|
11
|
-
export declare
|
|
12
|
-
export declare
|
|
13
|
-
export declare
|
|
14
|
-
export declare
|
|
15
|
-
export declare
|
|
16
|
-
export declare
|
|
17
|
-
export declare
|
|
18
|
-
export declare
|
|
19
|
-
export declare
|
|
20
|
-
export declare
|
|
21
|
-
export declare
|
|
22
|
-
export declare
|
|
23
|
-
export declare
|
|
24
|
-
export declare
|
|
25
|
-
export declare
|
|
26
|
-
export declare
|
|
27
|
-
export declare
|
|
28
|
-
export declare
|
|
29
|
-
export declare
|
|
30
|
-
export declare
|
|
31
|
-
export declare
|
|
32
|
-
export declare
|
|
33
|
-
export declare
|
|
34
|
-
export declare
|
|
35
|
-
export declare
|
|
36
|
-
export declare
|
|
37
|
-
export declare
|
|
38
|
-
export declare
|
|
39
|
-
export declare
|
|
40
|
-
export declare
|
|
3
|
+
export declare let PYTHON_FAILURE_MODULE_CODE: string;
|
|
4
|
+
export declare let PYTHON_INIT_CODE_CLEAR: string;
|
|
5
|
+
export declare let PYTHON_INIT_CODE_TRIGGER: string;
|
|
6
|
+
export declare let PYTHON_INIT_CODE: string;
|
|
7
|
+
export declare let NATIVETS_INIT_CODE: string;
|
|
8
|
+
export declare let BUNNATIVE_INIT_CODE: string;
|
|
9
|
+
export declare let NATIVETS_INIT_CODE_CLEAR: string;
|
|
10
|
+
export declare let DENO_INIT_CODE: string;
|
|
11
|
+
export declare let BUN_INIT_CODE: string;
|
|
12
|
+
export declare let GO_INIT_CODE: string;
|
|
13
|
+
export declare let GO_FAILURE_MODULE_CODE: string;
|
|
14
|
+
export declare let DENO_INIT_CODE_CLEAR: string;
|
|
15
|
+
export declare let BUN_INIT_CODE_CLEAR: string;
|
|
16
|
+
export declare let DENO_FAILURE_MODULE_CODE: string;
|
|
17
|
+
export declare let BUN_FAILURE_MODULE_CODE: string;
|
|
18
|
+
export declare let POSTGRES_INIT_CODE: string;
|
|
19
|
+
export declare let MYSQL_INIT_CODE: string;
|
|
20
|
+
export declare let BIGQUERY_INIT_CODE: string;
|
|
21
|
+
export declare let SNOWFLAKE_INIT_CODE: string;
|
|
22
|
+
export declare let MSSQL_INIT_CODE: string;
|
|
23
|
+
export declare let GRAPHQL_INIT_CODE: string;
|
|
24
|
+
export declare let PHP_INIT_CODE: string;
|
|
25
|
+
export declare let RUST_INIT_CODE: string;
|
|
26
|
+
export declare let FETCH_INIT_CODE: string;
|
|
27
|
+
export declare let BASH_INIT_CODE: string;
|
|
28
|
+
export declare let DENO_INIT_CODE_TRIGGER: string;
|
|
29
|
+
export declare let BUN_INIT_CODE_TRIGGER: string;
|
|
30
|
+
export declare let GO_INIT_CODE_TRIGGER: string;
|
|
31
|
+
export declare let DENO_INIT_CODE_APPROVAL: string;
|
|
32
|
+
export declare let BUN_INIT_CODE_APPROVAL: string;
|
|
33
|
+
export declare let BUN_PREPROCESSOR_MODULE_CODE: string;
|
|
34
|
+
export declare let DENO_PREPROCESSOR_MODULE_CODE: string;
|
|
35
|
+
export declare let PYTHON_INIT_CODE_APPROVAL: string;
|
|
36
|
+
export declare let PYTHON_PREPROCESSOR_MODULE_CODE: string;
|
|
37
|
+
export declare let DOCKER_INIT_CODE: string;
|
|
38
|
+
export declare let POWERSHELL_INIT_CODE: string;
|
|
39
|
+
export declare let ANSIBLE_PLAYBOOK_INIT_CODE: string;
|
|
41
40
|
export declare function isInitialCode(content: string): boolean;
|
|
42
41
|
export declare function initialCode(language: SupportedLanguage | 'bunnative' | undefined, kind: Script['kind'] | undefined, subkind: 'pgsql' | 'mysql' | 'flow' | 'script' | 'fetch' | 'docker' | 'powershell' | 'bunnative' | 'preprocessor' | undefined): string;
|
|
43
42
|
export declare function getResetCode(language: SupportedLanguage | 'bunnative' | undefined, kind: Script['kind'] | undefined, subkind: 'pgsql' | 'mysql' | 'flow' | 'script' | 'fetch' | 'docker' | 'powershell' | 'bunnative' | undefined): string;
|
|
@@ -1,10 +1,72 @@
|
|
|
1
1
|
import {} from './gen';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
export let PYTHON_FAILURE_MODULE_CODE = `import os
|
|
3
|
+
|
|
4
|
+
def main(message: str, name: str, step_id: str):
|
|
5
|
+
flow_id = os.environ.get("WM_ROOT_FLOW_JOB_ID")
|
|
6
|
+
print("message", message)
|
|
7
|
+
print("name", name)
|
|
8
|
+
print("step_id", step_id)
|
|
9
|
+
return { "message": message, "flow_id": flow_id, "step_id": step_id, "recover": False }`;
|
|
10
|
+
export let PYTHON_INIT_CODE_CLEAR = `# import wmill
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def main(x: str):
|
|
14
|
+
return x`;
|
|
15
|
+
export let PYTHON_INIT_CODE_TRIGGER = `import wmill
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def main():
|
|
19
|
+
# A common trigger script would follow this pattern:
|
|
20
|
+
# 1. Get the last saved state
|
|
21
|
+
# state = wmill.get_state()
|
|
22
|
+
# 2. Get the actual state from the external service
|
|
23
|
+
# newState = ...
|
|
24
|
+
# 3. Compare the two states and update the internal state
|
|
25
|
+
# wmill.setState(newState)
|
|
26
|
+
# 4. Return the new rows
|
|
27
|
+
# return range from (state to newState)
|
|
28
|
+
return [1, 2, 3]`;
|
|
29
|
+
export let PYTHON_INIT_CODE = `import os
|
|
30
|
+
import wmill
|
|
31
|
+
|
|
32
|
+
# You can import any PyPi package.
|
|
33
|
+
# See here for more info: https://www.windmill.dev/docs/advanced/dependencies_in_python
|
|
34
|
+
|
|
35
|
+
# you can use typed resources by doing a type alias to dict
|
|
36
|
+
#postgresql = dict
|
|
37
|
+
|
|
38
|
+
def main(
|
|
39
|
+
no_default: str,
|
|
40
|
+
#db: postgresql,
|
|
41
|
+
name="Nicolas Bourbaki",
|
|
42
|
+
age=42,
|
|
43
|
+
obj: dict = {"even": "dicts"},
|
|
44
|
+
l: list = ["or", "lists!"],
|
|
45
|
+
file_: bytes = bytes(0),
|
|
46
|
+
):
|
|
47
|
+
|
|
48
|
+
print(f"Hello World and a warm welcome especially to {name}")
|
|
49
|
+
print("and its acolytes..", age, obj, l, len(file_))
|
|
50
|
+
|
|
51
|
+
# retrieve variables, resources, states using the wmill client
|
|
52
|
+
try:
|
|
53
|
+
secret = wmill.get_variable("f/examples/secret")
|
|
54
|
+
except:
|
|
55
|
+
secret = "No secret yet at f/examples/secret !"
|
|
56
|
+
print(f"The variable at \`f/examples/secret\`: {secret}")
|
|
57
|
+
|
|
58
|
+
# Get last state of this script execution by the same trigger/user
|
|
59
|
+
last_state = wmill.get_state()
|
|
60
|
+
new_state = {"foo": 42} if last_state is None else last_state
|
|
61
|
+
new_state["foo"] += 1
|
|
62
|
+
wmill.set_state(new_state)
|
|
63
|
+
|
|
64
|
+
# fetch context variables
|
|
65
|
+
user = os.environ.get("WM_USERNAME")
|
|
66
|
+
|
|
67
|
+
# return value is converted to JSON
|
|
68
|
+
return {"splitted": name.split(), "user": user, "state": new_state}`;
|
|
69
|
+
export let NATIVETS_INIT_CODE = `// Fetch-only script, no imports allowed (except windmill) but benefits from a dedicated highly efficient runtime
|
|
8
70
|
//import * as wmill from './windmill.ts'
|
|
9
71
|
|
|
10
72
|
export async function main(example_input: number = 3) {
|
|
@@ -15,7 +77,7 @@ export async function main(example_input: number = 3) {
|
|
|
15
77
|
return res.json();
|
|
16
78
|
}
|
|
17
79
|
`;
|
|
18
|
-
export
|
|
80
|
+
export let BUNNATIVE_INIT_CODE = `//native
|
|
19
81
|
//you can add proxy support using //proxy http(s)://host:port
|
|
20
82
|
|
|
21
83
|
// native scripts are bun scripts that are executed on native workers and can be parallelized
|
|
@@ -31,7 +93,7 @@ export async function main(example_input: number = 3) {
|
|
|
31
93
|
return res.json();
|
|
32
94
|
}
|
|
33
95
|
`;
|
|
34
|
-
export
|
|
96
|
+
export let NATIVETS_INIT_CODE_CLEAR = `// Fetch-only script, no imports allowed (except windmill) but benefits from a dedicated highly efficient runtime
|
|
35
97
|
//import * as wmill from './windmill.ts'
|
|
36
98
|
|
|
37
99
|
export async function main() {
|
|
@@ -41,7 +103,7 @@ export async function main() {
|
|
|
41
103
|
return res.json();
|
|
42
104
|
}
|
|
43
105
|
`;
|
|
44
|
-
export
|
|
106
|
+
export let DENO_INIT_CODE = `// Ctrl/CMD+. to cache dependencies on imports hover.
|
|
45
107
|
|
|
46
108
|
// Deno uses "npm:" prefix to import from npm (https://deno.land/manual@v1.36.3/node/npm_specifiers)
|
|
47
109
|
// import * as wmill from "npm:windmill-client@${__pkg__.version}"
|
|
@@ -61,7 +123,7 @@ export async function main(
|
|
|
61
123
|
return { foo: a };
|
|
62
124
|
}
|
|
63
125
|
`;
|
|
64
|
-
export
|
|
126
|
+
export let BUN_INIT_CODE = `// there are multiple modes to add as header: //nobundling //native //npm //nodejs
|
|
65
127
|
// https://www.windmill.dev/docs/getting_started/scripts_quickstart/typescript#modes
|
|
66
128
|
|
|
67
129
|
// import { toWords } from "number-to-words@1"
|
|
@@ -91,7 +153,7 @@ export async function main(
|
|
|
91
153
|
return { foo: a };
|
|
92
154
|
}
|
|
93
155
|
`;
|
|
94
|
-
export
|
|
156
|
+
export let GO_INIT_CODE = `package inner
|
|
95
157
|
|
|
96
158
|
import (
|
|
97
159
|
"fmt"
|
|
@@ -114,7 +176,7 @@ func main(x string, nested struct {
|
|
|
114
176
|
return x, nil
|
|
115
177
|
}
|
|
116
178
|
`;
|
|
117
|
-
export
|
|
179
|
+
export let GO_FAILURE_MODULE_CODE = `package inner
|
|
118
180
|
|
|
119
181
|
import (
|
|
120
182
|
"fmt"
|
|
@@ -130,19 +192,19 @@ func main(message string, name string) (interface{}, error) {
|
|
|
130
192
|
return message, nil
|
|
131
193
|
}
|
|
132
194
|
`;
|
|
133
|
-
export
|
|
195
|
+
export let DENO_INIT_CODE_CLEAR = `// import * as wmill from "npm:windmill-client@${__pkg__.version}"
|
|
134
196
|
|
|
135
197
|
export async function main(x: string) {
|
|
136
198
|
return x
|
|
137
199
|
}
|
|
138
200
|
`;
|
|
139
|
-
export
|
|
201
|
+
export let BUN_INIT_CODE_CLEAR = `// import * as wmill from "windmill-client"
|
|
140
202
|
|
|
141
203
|
export async function main(x: string) {
|
|
142
204
|
return x
|
|
143
205
|
}
|
|
144
206
|
`;
|
|
145
|
-
export
|
|
207
|
+
export let DENO_FAILURE_MODULE_CODE = `
|
|
146
208
|
export async function main(message: string, name: string, step_id: string) {
|
|
147
209
|
const flow_id = Deno.env.get("WM_ROOT_FLOW_JOB_ID")
|
|
148
210
|
console.log("message", message)
|
|
@@ -151,7 +213,7 @@ export async function main(message: string, name: string, step_id: string) {
|
|
|
151
213
|
return { message, flow_id, step_id, recover: false }
|
|
152
214
|
}
|
|
153
215
|
`;
|
|
154
|
-
export
|
|
216
|
+
export let BUN_FAILURE_MODULE_CODE = `
|
|
155
217
|
export async function main(message: string, name: string, step_id: string) {
|
|
156
218
|
const flow_id = process.env.WM_ROOT_FLOW_JOB_ID
|
|
157
219
|
console.log("message", message)
|
|
@@ -160,7 +222,7 @@ export async function main(message: string, name: string, step_id: string) {
|
|
|
160
222
|
return { message, flow_id, step_id, recover: false }
|
|
161
223
|
}
|
|
162
224
|
`;
|
|
163
|
-
export
|
|
225
|
+
export let POSTGRES_INIT_CODE = `-- to pin the database use '-- database f/your/path'
|
|
164
226
|
-- $1 name1 = default arg
|
|
165
227
|
-- $2 name2
|
|
166
228
|
-- $3 name3
|
|
@@ -168,14 +230,14 @@ export const POSTGRES_INIT_CODE = `-- to pin the database use '-- database f/you
|
|
|
168
230
|
INSERT INTO demo VALUES (\$1::TEXT, \$2::INT, \$3::TEXT[]) RETURNING *;
|
|
169
231
|
UPDATE demo SET col2 = \$4::INT WHERE col2 = \$2::INT;
|
|
170
232
|
`;
|
|
171
|
-
export
|
|
233
|
+
export let MYSQL_INIT_CODE = `-- to pin the database use '-- database f/your/path'
|
|
172
234
|
-- :name1 (text) = default arg
|
|
173
235
|
-- :name2 (int)
|
|
174
236
|
-- :name3 (int)
|
|
175
237
|
INSERT INTO demo VALUES (:name1, :name2);
|
|
176
238
|
UPDATE demo SET col2 = :name3 WHERE col2 = :name2;
|
|
177
239
|
`;
|
|
178
|
-
export
|
|
240
|
+
export let BIGQUERY_INIT_CODE = `-- to pin the database use '-- database f/your/path'
|
|
179
241
|
-- @name1 (string) = default arg
|
|
180
242
|
-- @name2 (integer)
|
|
181
243
|
-- @name3 (string[])
|
|
@@ -183,7 +245,7 @@ export const BIGQUERY_INIT_CODE = `-- to pin the database use '-- database f/you
|
|
|
183
245
|
INSERT INTO \`demodb.demo\` VALUES (@name1, @name2, @name3);
|
|
184
246
|
UPDATE \`demodb.demo\` SET col2 = @name4 WHERE col2 = @name2;
|
|
185
247
|
`;
|
|
186
|
-
export
|
|
248
|
+
export let SNOWFLAKE_INIT_CODE = `-- to pin the database use '-- database f/your/path'
|
|
187
249
|
-- ? name1 (varchar) = default arg
|
|
188
250
|
-- ? name2 (int)
|
|
189
251
|
INSERT INTO demo VALUES (?, ?);
|
|
@@ -191,7 +253,7 @@ INSERT INTO demo VALUES (?, ?);
|
|
|
191
253
|
-- ? name2 (int)
|
|
192
254
|
UPDATE demo SET col2 = ? WHERE col2 = ?;
|
|
193
255
|
`;
|
|
194
|
-
export
|
|
256
|
+
export let MSSQL_INIT_CODE = `-- return_last_result
|
|
195
257
|
-- to pin the database use '-- database f/your/path'
|
|
196
258
|
-- @p1 name1 (varchar) = default arg
|
|
197
259
|
-- @p2 name2 (int)
|
|
@@ -199,7 +261,7 @@ export const MSSQL_INIT_CODE = `-- return_last_result
|
|
|
199
261
|
INSERT INTO demo VALUES (@p1, @p2);
|
|
200
262
|
UPDATE demo SET col2 = @p3 WHERE col2 = @p2;
|
|
201
263
|
`;
|
|
202
|
-
export
|
|
264
|
+
export let GRAPHQL_INIT_CODE = `query($name4: String, $name2: Int, $name3: [String]) {
|
|
203
265
|
demo(name1: $name1, name2: $name2, name3: $name3) {
|
|
204
266
|
name1,
|
|
205
267
|
name2,
|
|
@@ -207,7 +269,7 @@ export const GRAPHQL_INIT_CODE = `query($name4: String, $name2: Int, $name3: [St
|
|
|
207
269
|
}
|
|
208
270
|
}
|
|
209
271
|
`;
|
|
210
|
-
export
|
|
272
|
+
export let PHP_INIT_CODE = `<?php
|
|
211
273
|
|
|
212
274
|
// remove the first // of the following lines to specify packages to install using composer
|
|
213
275
|
// // require:
|
|
@@ -226,7 +288,7 @@ function main(
|
|
|
226
288
|
return $d;
|
|
227
289
|
}
|
|
228
290
|
`;
|
|
229
|
-
export
|
|
291
|
+
export let RUST_INIT_CODE = `//! Add dependencies in the following partial Cargo.toml manifest
|
|
230
292
|
//!
|
|
231
293
|
//! \`\`\`cargo
|
|
232
294
|
//! [dependencies]
|
|
@@ -260,7 +322,7 @@ fn main(who_to_greet: String, numbers: Vec<i8>) -> anyhow::Result<Ret> {
|
|
|
260
322
|
})
|
|
261
323
|
}
|
|
262
324
|
`;
|
|
263
|
-
export
|
|
325
|
+
export let FETCH_INIT_CODE = `export async function main(
|
|
264
326
|
url: string | undefined,
|
|
265
327
|
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' = 'GET',
|
|
266
328
|
body: Object = {},
|
|
@@ -290,7 +352,7 @@ export const FETCH_INIT_CODE = `export async function main(
|
|
|
290
352
|
throw new Error('An error occured')
|
|
291
353
|
})
|
|
292
354
|
}`;
|
|
293
|
-
export
|
|
355
|
+
export let BASH_INIT_CODE = `# shellcheck shell=bash
|
|
294
356
|
# arguments of the form X="$I" are parsed as parameters X of type string
|
|
295
357
|
msg="$1"
|
|
296
358
|
dflt="\${2:-default value}"
|
|
@@ -299,7 +361,7 @@ dflt="\${2:-default value}"
|
|
|
299
361
|
# unless you write json to './result.json' or a string to './result.out'
|
|
300
362
|
echo "Hello $msg"
|
|
301
363
|
`;
|
|
302
|
-
export
|
|
364
|
+
export let DENO_INIT_CODE_TRIGGER = `import * as wmill from "npm:windmill-client@${__pkg__.version}"
|
|
303
365
|
|
|
304
366
|
export async function main() {
|
|
305
367
|
|
|
@@ -319,7 +381,7 @@ export async function main() {
|
|
|
319
381
|
// 'flow_input.iter.value'
|
|
320
382
|
}
|
|
321
383
|
`;
|
|
322
|
-
export
|
|
384
|
+
export let BUN_INIT_CODE_TRIGGER = `import * as wmill from "windmill-client"
|
|
323
385
|
|
|
324
386
|
export async function main() {
|
|
325
387
|
|
|
@@ -339,7 +401,7 @@ export async function main() {
|
|
|
339
401
|
// 'flow_input.iter.value'
|
|
340
402
|
}
|
|
341
403
|
`;
|
|
342
|
-
export
|
|
404
|
+
export let GO_INIT_CODE_TRIGGER = `package inner
|
|
343
405
|
|
|
344
406
|
import (
|
|
345
407
|
wmill "github.com/windmill-labs/windmill-go-client"
|
|
@@ -362,7 +424,7 @@ func main() (interface{}, error) {
|
|
|
362
424
|
// 'flow_input.iter.value'
|
|
363
425
|
}
|
|
364
426
|
`;
|
|
365
|
-
export
|
|
427
|
+
export let DENO_INIT_CODE_APPROVAL = `import * as wmill from "npm:windmill-client@^1.158.2"
|
|
366
428
|
|
|
367
429
|
export async function main(approver?: string) {
|
|
368
430
|
const urls = await wmill.getResumeUrls(approver)
|
|
@@ -389,7 +451,7 @@ export async function main(approver?: string) {
|
|
|
389
451
|
|
|
390
452
|
// add a form in Advanced - Suspend
|
|
391
453
|
// all on approval steps: https://www.windmill.dev/docs/flows/flow_approval`;
|
|
392
|
-
export
|
|
454
|
+
export let BUN_INIT_CODE_APPROVAL = `import * as wmill from "windmill-client@^1.158.2"
|
|
393
455
|
|
|
394
456
|
export async function main(approver?: string) {
|
|
395
457
|
const urls = await wmill.getResumeUrls(approver)
|
|
@@ -416,7 +478,7 @@ export async function main(approver?: string) {
|
|
|
416
478
|
|
|
417
479
|
// add a form in Advanced - Suspend
|
|
418
480
|
// all on approval steps: https://www.windmill.dev/docs/flows/flow_approval`;
|
|
419
|
-
export
|
|
481
|
+
export let BUN_PREPROCESSOR_MODULE_CODE = `
|
|
420
482
|
export async function preprocessor(
|
|
421
483
|
wm_trigger: {
|
|
422
484
|
kind: 'http' | 'email' | 'webhook',
|
|
@@ -436,7 +498,7 @@ export async function preprocessor(
|
|
|
436
498
|
}
|
|
437
499
|
}
|
|
438
500
|
`;
|
|
439
|
-
export
|
|
501
|
+
export let DENO_PREPROCESSOR_MODULE_CODE = `
|
|
440
502
|
export async function preprocessor(
|
|
441
503
|
wm_trigger: {
|
|
442
504
|
kind: 'http' | 'email' | 'wehbook',
|
|
@@ -456,7 +518,7 @@ export async function preprocessor(
|
|
|
456
518
|
}
|
|
457
519
|
}
|
|
458
520
|
`;
|
|
459
|
-
export
|
|
521
|
+
export let PYTHON_INIT_CODE_APPROVAL = `import wmill
|
|
460
522
|
|
|
461
523
|
def main():
|
|
462
524
|
urls = wmill.get_resume_urls()
|
|
@@ -482,7 +544,7 @@ def main():
|
|
|
482
544
|
|
|
483
545
|
# add a form in Advanced - Suspend
|
|
484
546
|
# all on approval steps: https://www.windmill.dev/docs/flows/flow_approval`;
|
|
485
|
-
export
|
|
547
|
+
export let PYTHON_PREPROCESSOR_MODULE_CODE = `from typing import TypedDict, Literal
|
|
486
548
|
|
|
487
549
|
class Http(TypedDict):
|
|
488
550
|
route: str # The route path, e.g. "/users/:id"
|
|
@@ -504,7 +566,7 @@ def preprocessor(
|
|
|
504
566
|
# return the args to be passed to the flow
|
|
505
567
|
}
|
|
506
568
|
`;
|
|
507
|
-
export
|
|
569
|
+
export let DOCKER_INIT_CODE = `# shellcheck shell=bash
|
|
508
570
|
# Bash script that calls docker as a client to the host daemon
|
|
509
571
|
# See documentation: https://www.windmill.dev/docs/advanced/docker
|
|
510
572
|
msg="\${1:-world}"
|
|
@@ -516,7 +578,7 @@ COMMAND="/bin/echo Hello $msg"
|
|
|
516
578
|
docker pull $IMAGE
|
|
517
579
|
docker run --rm $IMAGE $COMMAND
|
|
518
580
|
`;
|
|
519
|
-
export
|
|
581
|
+
export let POWERSHELL_INIT_CODE = `param($Msg, $Dflt = "default value", [int]$Nb = 3)
|
|
520
582
|
|
|
521
583
|
# Import-Module MyModule
|
|
522
584
|
|
|
@@ -526,7 +588,7 @@ export const POWERSHELL_INIT_CODE = `param($Msg, $Dflt = "default value", [int]$
|
|
|
526
588
|
|
|
527
589
|
# the last line of the stdout is the return value
|
|
528
590
|
Write-Output "Hello $Msg"`;
|
|
529
|
-
export
|
|
591
|
+
export let ANSIBLE_PLAYBOOK_INIT_CODE = `---
|
|
530
592
|
inventory:
|
|
531
593
|
- resource_type: ansible_inventory
|
|
532
594
|
# You can pin an inventory to this script by hardcoding the resource path:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "windmill-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.406.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite dev",
|
|
6
6
|
"build": "vite build",
|
|
@@ -300,6 +300,14 @@
|
|
|
300
300
|
"types": "./package/utils.d.ts",
|
|
301
301
|
"default": "./package/utils.js"
|
|
302
302
|
},
|
|
303
|
+
"./icons/store": {
|
|
304
|
+
"types": "./package/icons/store.d.ts",
|
|
305
|
+
"default": "./package/icons/store.js"
|
|
306
|
+
},
|
|
307
|
+
"./script_helpers": {
|
|
308
|
+
"types": "./package/script_helpers.d.ts",
|
|
309
|
+
"default": "./package/script_helpers.js"
|
|
310
|
+
},
|
|
303
311
|
"./infer": {
|
|
304
312
|
"types": "./package/infer.d.ts",
|
|
305
313
|
"default": "./package/infer.js"
|
|
@@ -341,6 +349,11 @@
|
|
|
341
349
|
"types": "./package/components/DropdownV2.svelte.d.ts",
|
|
342
350
|
"svelte": "./package/components/DropdownV2.svelte",
|
|
343
351
|
"default": "./package/components/DropdownV2.svelte"
|
|
352
|
+
},
|
|
353
|
+
"./components/flows/FlowHistoryInner.svelte": {
|
|
354
|
+
"types": "./package/components/flows/FlowHistoryInner.svelte.d.ts",
|
|
355
|
+
"svelte": "./package/components/flows/FlowHistoryInner.svelte",
|
|
356
|
+
"default": "./package/components/flows/FlowHistoryInner.svelte"
|
|
344
357
|
}
|
|
345
358
|
},
|
|
346
359
|
"files": [
|
|
@@ -426,6 +439,9 @@
|
|
|
426
439
|
"components/EditableSchemaWrapper.svelte": [
|
|
427
440
|
"./package/components/schema/EditableSchemaWrapper.svelte.d.ts"
|
|
428
441
|
],
|
|
442
|
+
"components/flows/FlowHistoryInner.svelte": [
|
|
443
|
+
"./package/components/flows/FlowHistoryInner.svelte.d.ts"
|
|
444
|
+
],
|
|
429
445
|
"utils": [
|
|
430
446
|
"./package/utils.d.ts"
|
|
431
447
|
],
|
|
@@ -461,6 +477,12 @@
|
|
|
461
477
|
],
|
|
462
478
|
"components/DropdownV2.svelte": [
|
|
463
479
|
"./package/components/DropdownV2.svelte.d.ts"
|
|
480
|
+
],
|
|
481
|
+
"script_helpers": [
|
|
482
|
+
"./package/script_helpers.d.ts"
|
|
483
|
+
],
|
|
484
|
+
"icons/store": [
|
|
485
|
+
"./package/icons/store.d.ts"
|
|
464
486
|
]
|
|
465
487
|
}
|
|
466
488
|
},
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const _default: "import os\n\ndef main(message: str, name: str, step_id: str):\n flow_id = os.environ.get(\"WM_ROOT_FLOW_JOB_ID\")\n print(\"message\", message)\n print(\"name\", name)\n print(\"step_id\", step_id)\n return { \"message\": message, \"flow_id\": flow_id, \"step_id\": step_id, \"recover\": False }";
|
|
2
|
-
export default _default;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export default `import os
|
|
2
|
-
|
|
3
|
-
def main(message: str, name: str, step_id: str):
|
|
4
|
-
flow_id = os.environ.get("WM_ROOT_FLOW_JOB_ID")
|
|
5
|
-
print("message", message)
|
|
6
|
-
print("name", name)
|
|
7
|
-
print("step_id", step_id)
|
|
8
|
-
return { "message": message, "flow_id": flow_id, "step_id": step_id, "recover": False }`;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const _default: "import os\nimport wmill\n\n# You can import any PyPi package. \n# See here for more info: https://www.windmill.dev/docs/advanced/dependencies_in_python\n\n# you can use typed resources by doing a type alias to dict\n#postgresql = dict\n\ndef main(\n no_default: str,\n #db: postgresql,\n name=\"Nicolas Bourbaki\",\n age=42,\n obj: dict = {\"even\": \"dicts\"},\n l: list = [\"or\", \"lists!\"],\n file_: bytes = bytes(0),\n):\n\n print(f\"Hello World and a warm welcome especially to {name}\")\n print(\"and its acolytes..\", age, obj, l, len(file_))\n\n # retrieve variables, resources, states using the wmill client\n try:\n secret = wmill.get_variable(\"f/examples/secret\")\n except:\n secret = \"No secret yet at f/examples/secret !\"\n print(f\"The variable at `f/examples/secret`: {secret}\")\n\n # Get last state of this script execution by the same trigger/user\n last_state = wmill.get_state()\n new_state = {\"foo\": 42} if last_state is None else last_state\n new_state[\"foo\"] += 1\n wmill.set_state(new_state)\n\n # fetch context variables\n user = os.environ.get(\"WM_USERNAME\")\n\n # return value is converted to JSON\n return {\"splitted\": name.split(), \"user\": user, \"state\": new_state}";
|
|
2
|
-
export default _default;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export default `import os
|
|
2
|
-
import wmill
|
|
3
|
-
|
|
4
|
-
# You can import any PyPi package.
|
|
5
|
-
# See here for more info: https://www.windmill.dev/docs/advanced/dependencies_in_python
|
|
6
|
-
|
|
7
|
-
# you can use typed resources by doing a type alias to dict
|
|
8
|
-
#postgresql = dict
|
|
9
|
-
|
|
10
|
-
def main(
|
|
11
|
-
no_default: str,
|
|
12
|
-
#db: postgresql,
|
|
13
|
-
name="Nicolas Bourbaki",
|
|
14
|
-
age=42,
|
|
15
|
-
obj: dict = {"even": "dicts"},
|
|
16
|
-
l: list = ["or", "lists!"],
|
|
17
|
-
file_: bytes = bytes(0),
|
|
18
|
-
):
|
|
19
|
-
|
|
20
|
-
print(f"Hello World and a warm welcome especially to {name}")
|
|
21
|
-
print("and its acolytes..", age, obj, l, len(file_))
|
|
22
|
-
|
|
23
|
-
# retrieve variables, resources, states using the wmill client
|
|
24
|
-
try:
|
|
25
|
-
secret = wmill.get_variable("f/examples/secret")
|
|
26
|
-
except:
|
|
27
|
-
secret = "No secret yet at f/examples/secret !"
|
|
28
|
-
print(f"The variable at \`f/examples/secret\`: {secret}")
|
|
29
|
-
|
|
30
|
-
# Get last state of this script execution by the same trigger/user
|
|
31
|
-
last_state = wmill.get_state()
|
|
32
|
-
new_state = {"foo": 42} if last_state is None else last_state
|
|
33
|
-
new_state["foo"] += 1
|
|
34
|
-
wmill.set_state(new_state)
|
|
35
|
-
|
|
36
|
-
# fetch context variables
|
|
37
|
-
user = os.environ.get("WM_USERNAME")
|
|
38
|
-
|
|
39
|
-
# return value is converted to JSON
|
|
40
|
-
return {"splitted": name.split(), "user": user, "state": new_state}`;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const _default: "import wmill\n\n\ndef main():\n # A common trigger script would follow this pattern:\n # 1. Get the last saved state\n # state = wmill.get_state()\n # 2. Get the actual state from the external service\n # newState = ...\n # 3. Compare the two states and update the internal state\n # wmill.setState(newState)\n # 4. Return the new rows\n # return range from (state to newState)\n return [1, 2, 3]";
|
|
2
|
-
export default _default;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export default `import wmill
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def main():
|
|
5
|
-
# A common trigger script would follow this pattern:
|
|
6
|
-
# 1. Get the last saved state
|
|
7
|
-
# state = wmill.get_state()
|
|
8
|
-
# 2. Get the actual state from the external service
|
|
9
|
-
# newState = ...
|
|
10
|
-
# 3. Compare the two states and update the internal state
|
|
11
|
-
# wmill.setState(newState)
|
|
12
|
-
# 4. Return the new rows
|
|
13
|
-
# return range from (state to newState)
|
|
14
|
-
return [1, 2, 3]`;
|