windmill-components 1.406.0 → 1.406.2
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/components/EditorBar.svelte.d.ts +1 -1
- package/package/components/ScriptEditor.svelte.d.ts +1 -1
- package/package/components/flows/content/FlowModuleComponent.svelte.d.ts +1 -1
- package/package/script_helpers.d.ts +71 -37
- package/package/script_helpers.js +154 -110
- package/package.json +6 -6
|
@@ -18,7 +18,7 @@ declare const __propDef: {
|
|
|
18
18
|
iconOnly?: boolean | undefined;
|
|
19
19
|
validCode?: boolean | undefined;
|
|
20
20
|
kind?: "script" | "trigger" | "approval" | undefined;
|
|
21
|
-
template?: "powershell" | "mysql" | "script" | "bunnative" | "
|
|
21
|
+
template?: "powershell" | "mysql" | "script" | "bunnative" | "docker" | "pgsql" | undefined;
|
|
22
22
|
collabMode?: boolean | undefined;
|
|
23
23
|
collabLive?: boolean | undefined;
|
|
24
24
|
collabUsers?: {
|
|
@@ -11,7 +11,7 @@ declare const __propDef: {
|
|
|
11
11
|
path: string | undefined;
|
|
12
12
|
lang: Preview['language'];
|
|
13
13
|
kind?: string | undefined;
|
|
14
|
-
template?: "powershell" | "mysql" | "script" | "bunnative" | "
|
|
14
|
+
template?: "powershell" | "mysql" | "script" | "bunnative" | "docker" | "pgsql" | undefined;
|
|
15
15
|
tag: string | undefined;
|
|
16
16
|
initialArgs?: Record<string, any> | undefined;
|
|
17
17
|
fixedOverflowWidgets?: boolean | undefined;
|
|
@@ -8,7 +8,7 @@ declare const __propDef: {
|
|
|
8
8
|
parentModule?: FlowModule | undefined;
|
|
9
9
|
previousModule: FlowModule | undefined;
|
|
10
10
|
scriptKind?: "script" | "trigger" | "approval" | undefined;
|
|
11
|
-
scriptTemplate?: "powershell" | "mysql" | "script" | "
|
|
11
|
+
scriptTemplate?: "powershell" | "mysql" | "script" | "docker" | "pgsql" | undefined;
|
|
12
12
|
noEditor: boolean;
|
|
13
13
|
enableAi: boolean;
|
|
14
14
|
};
|
|
@@ -1,42 +1,76 @@
|
|
|
1
1
|
import { type Script } from './gen';
|
|
2
2
|
import type { SupportedLanguage } from './common';
|
|
3
|
-
export declare
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
3
|
+
export declare const INITIAL_CODE: {
|
|
4
|
+
bun: {
|
|
5
|
+
script: string;
|
|
6
|
+
trigger: string;
|
|
7
|
+
approval: string;
|
|
8
|
+
failure: string;
|
|
9
|
+
preprocessor: string;
|
|
10
|
+
};
|
|
11
|
+
python3: {
|
|
12
|
+
script: string;
|
|
13
|
+
trigger: string;
|
|
14
|
+
approval: string;
|
|
15
|
+
failure: string;
|
|
16
|
+
preprocessor: string;
|
|
17
|
+
};
|
|
18
|
+
deno: {
|
|
19
|
+
script: string;
|
|
20
|
+
trigger: string;
|
|
21
|
+
approval: string;
|
|
22
|
+
failure: string;
|
|
23
|
+
preprocessor: string;
|
|
24
|
+
fetch: string;
|
|
25
|
+
};
|
|
26
|
+
go: {
|
|
27
|
+
script: string;
|
|
28
|
+
trigger: string;
|
|
29
|
+
failure: string;
|
|
30
|
+
};
|
|
31
|
+
bash: {
|
|
32
|
+
script: string;
|
|
33
|
+
};
|
|
34
|
+
powershell: {
|
|
35
|
+
script: string;
|
|
36
|
+
};
|
|
37
|
+
nativets: {
|
|
38
|
+
script: string;
|
|
39
|
+
};
|
|
40
|
+
postgresql: {
|
|
41
|
+
script: string;
|
|
42
|
+
};
|
|
43
|
+
mysql: {
|
|
44
|
+
script: string;
|
|
45
|
+
};
|
|
46
|
+
bigquery: {
|
|
47
|
+
script: string;
|
|
48
|
+
};
|
|
49
|
+
snowflake: {
|
|
50
|
+
script: string;
|
|
51
|
+
};
|
|
52
|
+
mssql: {
|
|
53
|
+
script: string;
|
|
54
|
+
};
|
|
55
|
+
graphql: {
|
|
56
|
+
script: string;
|
|
57
|
+
};
|
|
58
|
+
php: {
|
|
59
|
+
script: string;
|
|
60
|
+
};
|
|
61
|
+
rust: {
|
|
62
|
+
script: string;
|
|
63
|
+
};
|
|
64
|
+
ansible: {
|
|
65
|
+
script: string;
|
|
66
|
+
};
|
|
67
|
+
docker: {
|
|
68
|
+
script: string;
|
|
69
|
+
};
|
|
70
|
+
bunnative: {
|
|
71
|
+
script: string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
40
74
|
export declare function isInitialCode(content: string): boolean;
|
|
41
75
|
export declare function initialCode(language: SupportedLanguage | 'bunnative' | undefined, kind: Script['kind'] | undefined, subkind: 'pgsql' | 'mysql' | 'flow' | 'script' | 'fetch' | 'docker' | 'powershell' | 'bunnative' | 'preprocessor' | undefined): string;
|
|
42
76
|
export declare function getResetCode(language: SupportedLanguage | 'bunnative' | undefined, kind: Script['kind'] | undefined, subkind: 'pgsql' | 'mysql' | 'flow' | 'script' | 'fetch' | 'docker' | 'powershell' | 'bunnative' | undefined): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {} from './gen';
|
|
2
|
-
|
|
2
|
+
const PYTHON_FAILURE_MODULE_CODE = `import os
|
|
3
3
|
|
|
4
4
|
def main(message: str, name: str, step_id: str):
|
|
5
5
|
flow_id = os.environ.get("WM_ROOT_FLOW_JOB_ID")
|
|
@@ -7,12 +7,12 @@ def main(message: str, name: str, step_id: str):
|
|
|
7
7
|
print("name", name)
|
|
8
8
|
print("step_id", step_id)
|
|
9
9
|
return { "message": message, "flow_id": flow_id, "step_id": step_id, "recover": False }`;
|
|
10
|
-
|
|
10
|
+
const PYTHON_INIT_CODE_CLEAR = `# import wmill
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
def main(x: str):
|
|
14
14
|
return x`;
|
|
15
|
-
|
|
15
|
+
const PYTHON_INIT_CODE_TRIGGER = `import wmill
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
def main():
|
|
@@ -26,7 +26,7 @@ def main():
|
|
|
26
26
|
# 4. Return the new rows
|
|
27
27
|
# return range from (state to newState)
|
|
28
28
|
return [1, 2, 3]`;
|
|
29
|
-
|
|
29
|
+
const PYTHON_INIT_CODE = `import os
|
|
30
30
|
import wmill
|
|
31
31
|
|
|
32
32
|
# You can import any PyPi package.
|
|
@@ -66,7 +66,7 @@ def main(
|
|
|
66
66
|
|
|
67
67
|
# return value is converted to JSON
|
|
68
68
|
return {"splitted": name.split(), "user": user, "state": new_state}`;
|
|
69
|
-
|
|
69
|
+
const NATIVETS_INIT_CODE = `// Fetch-only script, no imports allowed (except windmill) but benefits from a dedicated highly efficient runtime
|
|
70
70
|
//import * as wmill from './windmill.ts'
|
|
71
71
|
|
|
72
72
|
export async function main(example_input: number = 3) {
|
|
@@ -77,7 +77,7 @@ export async function main(example_input: number = 3) {
|
|
|
77
77
|
return res.json();
|
|
78
78
|
}
|
|
79
79
|
`;
|
|
80
|
-
|
|
80
|
+
const BUNNATIVE_INIT_CODE = `//native
|
|
81
81
|
//you can add proxy support using //proxy http(s)://host:port
|
|
82
82
|
|
|
83
83
|
// native scripts are bun scripts that are executed on native workers and can be parallelized
|
|
@@ -93,7 +93,7 @@ export async function main(example_input: number = 3) {
|
|
|
93
93
|
return res.json();
|
|
94
94
|
}
|
|
95
95
|
`;
|
|
96
|
-
|
|
96
|
+
const NATIVETS_INIT_CODE_CLEAR = `// Fetch-only script, no imports allowed (except windmill) but benefits from a dedicated highly efficient runtime
|
|
97
97
|
//import * as wmill from './windmill.ts'
|
|
98
98
|
|
|
99
99
|
export async function main() {
|
|
@@ -103,7 +103,7 @@ export async function main() {
|
|
|
103
103
|
return res.json();
|
|
104
104
|
}
|
|
105
105
|
`;
|
|
106
|
-
|
|
106
|
+
const DENO_INIT_CODE = `// Ctrl/CMD+. to cache dependencies on imports hover.
|
|
107
107
|
|
|
108
108
|
// Deno uses "npm:" prefix to import from npm (https://deno.land/manual@v1.36.3/node/npm_specifiers)
|
|
109
109
|
// import * as wmill from "npm:windmill-client@${__pkg__.version}"
|
|
@@ -123,7 +123,7 @@ export async function main(
|
|
|
123
123
|
return { foo: a };
|
|
124
124
|
}
|
|
125
125
|
`;
|
|
126
|
-
|
|
126
|
+
const BUN_INIT_CODE = `// there are multiple modes to add as header: //nobundling //native //npm //nodejs
|
|
127
127
|
// https://www.windmill.dev/docs/getting_started/scripts_quickstart/typescript#modes
|
|
128
128
|
|
|
129
129
|
// import { toWords } from "number-to-words@1"
|
|
@@ -153,7 +153,7 @@ export async function main(
|
|
|
153
153
|
return { foo: a };
|
|
154
154
|
}
|
|
155
155
|
`;
|
|
156
|
-
|
|
156
|
+
const GO_INIT_CODE = `package inner
|
|
157
157
|
|
|
158
158
|
import (
|
|
159
159
|
"fmt"
|
|
@@ -176,7 +176,7 @@ func main(x string, nested struct {
|
|
|
176
176
|
return x, nil
|
|
177
177
|
}
|
|
178
178
|
`;
|
|
179
|
-
|
|
179
|
+
const GO_FAILURE_MODULE_CODE = `package inner
|
|
180
180
|
|
|
181
181
|
import (
|
|
182
182
|
"fmt"
|
|
@@ -192,19 +192,19 @@ func main(message string, name string) (interface{}, error) {
|
|
|
192
192
|
return message, nil
|
|
193
193
|
}
|
|
194
194
|
`;
|
|
195
|
-
|
|
195
|
+
const DENO_INIT_CODE_CLEAR = `// import * as wmill from "npm:windmill-client@${__pkg__.version}"
|
|
196
196
|
|
|
197
197
|
export async function main(x: string) {
|
|
198
198
|
return x
|
|
199
199
|
}
|
|
200
200
|
`;
|
|
201
|
-
|
|
201
|
+
const BUN_INIT_CODE_CLEAR = `// import * as wmill from "windmill-client"
|
|
202
202
|
|
|
203
203
|
export async function main(x: string) {
|
|
204
204
|
return x
|
|
205
205
|
}
|
|
206
206
|
`;
|
|
207
|
-
|
|
207
|
+
const DENO_FAILURE_MODULE_CODE = `
|
|
208
208
|
export async function main(message: string, name: string, step_id: string) {
|
|
209
209
|
const flow_id = Deno.env.get("WM_ROOT_FLOW_JOB_ID")
|
|
210
210
|
console.log("message", message)
|
|
@@ -213,7 +213,7 @@ export async function main(message: string, name: string, step_id: string) {
|
|
|
213
213
|
return { message, flow_id, step_id, recover: false }
|
|
214
214
|
}
|
|
215
215
|
`;
|
|
216
|
-
|
|
216
|
+
const BUN_FAILURE_MODULE_CODE = `
|
|
217
217
|
export async function main(message: string, name: string, step_id: string) {
|
|
218
218
|
const flow_id = process.env.WM_ROOT_FLOW_JOB_ID
|
|
219
219
|
console.log("message", message)
|
|
@@ -222,7 +222,7 @@ export async function main(message: string, name: string, step_id: string) {
|
|
|
222
222
|
return { message, flow_id, step_id, recover: false }
|
|
223
223
|
}
|
|
224
224
|
`;
|
|
225
|
-
|
|
225
|
+
const POSTGRES_INIT_CODE = `-- to pin the database use '-- database f/your/path'
|
|
226
226
|
-- $1 name1 = default arg
|
|
227
227
|
-- $2 name2
|
|
228
228
|
-- $3 name3
|
|
@@ -230,14 +230,14 @@ export let POSTGRES_INIT_CODE = `-- to pin the database use '-- database f/your/
|
|
|
230
230
|
INSERT INTO demo VALUES (\$1::TEXT, \$2::INT, \$3::TEXT[]) RETURNING *;
|
|
231
231
|
UPDATE demo SET col2 = \$4::INT WHERE col2 = \$2::INT;
|
|
232
232
|
`;
|
|
233
|
-
|
|
233
|
+
const MYSQL_INIT_CODE = `-- to pin the database use '-- database f/your/path'
|
|
234
234
|
-- :name1 (text) = default arg
|
|
235
235
|
-- :name2 (int)
|
|
236
236
|
-- :name3 (int)
|
|
237
237
|
INSERT INTO demo VALUES (:name1, :name2);
|
|
238
238
|
UPDATE demo SET col2 = :name3 WHERE col2 = :name2;
|
|
239
239
|
`;
|
|
240
|
-
|
|
240
|
+
const BIGQUERY_INIT_CODE = `-- to pin the database use '-- database f/your/path'
|
|
241
241
|
-- @name1 (string) = default arg
|
|
242
242
|
-- @name2 (integer)
|
|
243
243
|
-- @name3 (string[])
|
|
@@ -245,7 +245,7 @@ export let BIGQUERY_INIT_CODE = `-- to pin the database use '-- database f/your/
|
|
|
245
245
|
INSERT INTO \`demodb.demo\` VALUES (@name1, @name2, @name3);
|
|
246
246
|
UPDATE \`demodb.demo\` SET col2 = @name4 WHERE col2 = @name2;
|
|
247
247
|
`;
|
|
248
|
-
|
|
248
|
+
const SNOWFLAKE_INIT_CODE = `-- to pin the database use '-- database f/your/path'
|
|
249
249
|
-- ? name1 (varchar) = default arg
|
|
250
250
|
-- ? name2 (int)
|
|
251
251
|
INSERT INTO demo VALUES (?, ?);
|
|
@@ -253,7 +253,7 @@ INSERT INTO demo VALUES (?, ?);
|
|
|
253
253
|
-- ? name2 (int)
|
|
254
254
|
UPDATE demo SET col2 = ? WHERE col2 = ?;
|
|
255
255
|
`;
|
|
256
|
-
|
|
256
|
+
const MSSQL_INIT_CODE = `-- return_last_result
|
|
257
257
|
-- to pin the database use '-- database f/your/path'
|
|
258
258
|
-- @p1 name1 (varchar) = default arg
|
|
259
259
|
-- @p2 name2 (int)
|
|
@@ -261,7 +261,7 @@ export let MSSQL_INIT_CODE = `-- return_last_result
|
|
|
261
261
|
INSERT INTO demo VALUES (@p1, @p2);
|
|
262
262
|
UPDATE demo SET col2 = @p3 WHERE col2 = @p2;
|
|
263
263
|
`;
|
|
264
|
-
|
|
264
|
+
const GRAPHQL_INIT_CODE = `query($name4: String, $name2: Int, $name3: [String]) {
|
|
265
265
|
demo(name1: $name1, name2: $name2, name3: $name3) {
|
|
266
266
|
name1,
|
|
267
267
|
name2,
|
|
@@ -269,7 +269,7 @@ export let GRAPHQL_INIT_CODE = `query($name4: String, $name2: Int, $name3: [Stri
|
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
`;
|
|
272
|
-
|
|
272
|
+
const PHP_INIT_CODE = `<?php
|
|
273
273
|
|
|
274
274
|
// remove the first // of the following lines to specify packages to install using composer
|
|
275
275
|
// // require:
|
|
@@ -288,7 +288,7 @@ function main(
|
|
|
288
288
|
return $d;
|
|
289
289
|
}
|
|
290
290
|
`;
|
|
291
|
-
|
|
291
|
+
const RUST_INIT_CODE = `//! Add dependencies in the following partial Cargo.toml manifest
|
|
292
292
|
//!
|
|
293
293
|
//! \`\`\`cargo
|
|
294
294
|
//! [dependencies]
|
|
@@ -322,7 +322,7 @@ fn main(who_to_greet: String, numbers: Vec<i8>) -> anyhow::Result<Ret> {
|
|
|
322
322
|
})
|
|
323
323
|
}
|
|
324
324
|
`;
|
|
325
|
-
|
|
325
|
+
const FETCH_INIT_CODE = `export async function main(
|
|
326
326
|
url: string | undefined,
|
|
327
327
|
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' = 'GET',
|
|
328
328
|
body: Object = {},
|
|
@@ -352,7 +352,7 @@ export let FETCH_INIT_CODE = `export async function main(
|
|
|
352
352
|
throw new Error('An error occured')
|
|
353
353
|
})
|
|
354
354
|
}`;
|
|
355
|
-
|
|
355
|
+
const BASH_INIT_CODE = `# shellcheck shell=bash
|
|
356
356
|
# arguments of the form X="$I" are parsed as parameters X of type string
|
|
357
357
|
msg="$1"
|
|
358
358
|
dflt="\${2:-default value}"
|
|
@@ -361,7 +361,7 @@ dflt="\${2:-default value}"
|
|
|
361
361
|
# unless you write json to './result.json' or a string to './result.out'
|
|
362
362
|
echo "Hello $msg"
|
|
363
363
|
`;
|
|
364
|
-
|
|
364
|
+
const DENO_INIT_CODE_TRIGGER = `import * as wmill from "npm:windmill-client@${__pkg__.version}"
|
|
365
365
|
|
|
366
366
|
export async function main() {
|
|
367
367
|
|
|
@@ -381,7 +381,7 @@ export async function main() {
|
|
|
381
381
|
// 'flow_input.iter.value'
|
|
382
382
|
}
|
|
383
383
|
`;
|
|
384
|
-
|
|
384
|
+
const BUN_INIT_CODE_TRIGGER = `import * as wmill from "windmill-client"
|
|
385
385
|
|
|
386
386
|
export async function main() {
|
|
387
387
|
|
|
@@ -401,7 +401,7 @@ export async function main() {
|
|
|
401
401
|
// 'flow_input.iter.value'
|
|
402
402
|
}
|
|
403
403
|
`;
|
|
404
|
-
|
|
404
|
+
const GO_INIT_CODE_TRIGGER = `package inner
|
|
405
405
|
|
|
406
406
|
import (
|
|
407
407
|
wmill "github.com/windmill-labs/windmill-go-client"
|
|
@@ -424,7 +424,7 @@ func main() (interface{}, error) {
|
|
|
424
424
|
// 'flow_input.iter.value'
|
|
425
425
|
}
|
|
426
426
|
`;
|
|
427
|
-
|
|
427
|
+
const DENO_INIT_CODE_APPROVAL = `import * as wmill from "npm:windmill-client@^1.158.2"
|
|
428
428
|
|
|
429
429
|
export async function main(approver?: string) {
|
|
430
430
|
const urls = await wmill.getResumeUrls(approver)
|
|
@@ -451,7 +451,7 @@ export async function main(approver?: string) {
|
|
|
451
451
|
|
|
452
452
|
// add a form in Advanced - Suspend
|
|
453
453
|
// all on approval steps: https://www.windmill.dev/docs/flows/flow_approval`;
|
|
454
|
-
|
|
454
|
+
const BUN_INIT_CODE_APPROVAL = `import * as wmill from "windmill-client@^1.158.2"
|
|
455
455
|
|
|
456
456
|
export async function main(approver?: string) {
|
|
457
457
|
const urls = await wmill.getResumeUrls(approver)
|
|
@@ -478,7 +478,7 @@ export async function main(approver?: string) {
|
|
|
478
478
|
|
|
479
479
|
// add a form in Advanced - Suspend
|
|
480
480
|
// all on approval steps: https://www.windmill.dev/docs/flows/flow_approval`;
|
|
481
|
-
|
|
481
|
+
const BUN_PREPROCESSOR_MODULE_CODE = `
|
|
482
482
|
export async function preprocessor(
|
|
483
483
|
wm_trigger: {
|
|
484
484
|
kind: 'http' | 'email' | 'webhook',
|
|
@@ -498,7 +498,7 @@ export async function preprocessor(
|
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
500
|
`;
|
|
501
|
-
|
|
501
|
+
const DENO_PREPROCESSOR_MODULE_CODE = `
|
|
502
502
|
export async function preprocessor(
|
|
503
503
|
wm_trigger: {
|
|
504
504
|
kind: 'http' | 'email' | 'wehbook',
|
|
@@ -518,7 +518,7 @@ export async function preprocessor(
|
|
|
518
518
|
}
|
|
519
519
|
}
|
|
520
520
|
`;
|
|
521
|
-
|
|
521
|
+
const PYTHON_INIT_CODE_APPROVAL = `import wmill
|
|
522
522
|
|
|
523
523
|
def main():
|
|
524
524
|
urls = wmill.get_resume_urls()
|
|
@@ -544,7 +544,7 @@ def main():
|
|
|
544
544
|
|
|
545
545
|
# add a form in Advanced - Suspend
|
|
546
546
|
# all on approval steps: https://www.windmill.dev/docs/flows/flow_approval`;
|
|
547
|
-
|
|
547
|
+
const PYTHON_PREPROCESSOR_MODULE_CODE = `from typing import TypedDict, Literal
|
|
548
548
|
|
|
549
549
|
class Http(TypedDict):
|
|
550
550
|
route: str # The route path, e.g. "/users/:id"
|
|
@@ -566,7 +566,7 @@ def preprocessor(
|
|
|
566
566
|
# return the args to be passed to the flow
|
|
567
567
|
}
|
|
568
568
|
`;
|
|
569
|
-
|
|
569
|
+
const DOCKER_INIT_CODE = `# shellcheck shell=bash
|
|
570
570
|
# Bash script that calls docker as a client to the host daemon
|
|
571
571
|
# See documentation: https://www.windmill.dev/docs/advanced/docker
|
|
572
572
|
msg="\${1:-world}"
|
|
@@ -578,7 +578,7 @@ COMMAND="/bin/echo Hello $msg"
|
|
|
578
578
|
docker pull $IMAGE
|
|
579
579
|
docker run --rm $IMAGE $COMMAND
|
|
580
580
|
`;
|
|
581
|
-
|
|
581
|
+
const POWERSHELL_INIT_CODE = `param($Msg, $Dflt = "default value", [int]$Nb = 3)
|
|
582
582
|
|
|
583
583
|
# Import-Module MyModule
|
|
584
584
|
|
|
@@ -588,7 +588,7 @@ export let POWERSHELL_INIT_CODE = `param($Msg, $Dflt = "default value", [int]$Nb
|
|
|
588
588
|
|
|
589
589
|
# the last line of the stdout is the return value
|
|
590
590
|
Write-Output "Hello $Msg"`;
|
|
591
|
-
|
|
591
|
+
const ANSIBLE_PLAYBOOK_INIT_CODE = `---
|
|
592
592
|
inventory:
|
|
593
593
|
- resource_type: ansible_inventory
|
|
594
594
|
# You can pin an inventory to this script by hardcoding the resource path:
|
|
@@ -632,41 +632,85 @@ dependencies:
|
|
|
632
632
|
content: "{{ my_result | to_json }}"
|
|
633
633
|
dest: result.json
|
|
634
634
|
`;
|
|
635
|
-
const
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
635
|
+
export const INITIAL_CODE = {
|
|
636
|
+
bun: {
|
|
637
|
+
script: BUN_INIT_CODE,
|
|
638
|
+
trigger: BUN_INIT_CODE_TRIGGER,
|
|
639
|
+
approval: BUN_INIT_CODE_APPROVAL,
|
|
640
|
+
failure: BUN_FAILURE_MODULE_CODE,
|
|
641
|
+
preprocessor: BUN_PREPROCESSOR_MODULE_CODE
|
|
642
|
+
},
|
|
643
|
+
python3: {
|
|
644
|
+
script: PYTHON_INIT_CODE,
|
|
645
|
+
trigger: PYTHON_INIT_CODE_TRIGGER,
|
|
646
|
+
approval: PYTHON_INIT_CODE_APPROVAL,
|
|
647
|
+
failure: PYTHON_FAILURE_MODULE_CODE,
|
|
648
|
+
preprocessor: PYTHON_PREPROCESSOR_MODULE_CODE
|
|
649
|
+
},
|
|
650
|
+
deno: {
|
|
651
|
+
script: DENO_INIT_CODE,
|
|
652
|
+
trigger: DENO_INIT_CODE_TRIGGER,
|
|
653
|
+
approval: DENO_INIT_CODE_APPROVAL,
|
|
654
|
+
failure: DENO_FAILURE_MODULE_CODE,
|
|
655
|
+
preprocessor: DENO_PREPROCESSOR_MODULE_CODE,
|
|
656
|
+
fetch: FETCH_INIT_CODE
|
|
657
|
+
},
|
|
658
|
+
go: {
|
|
659
|
+
script: GO_INIT_CODE,
|
|
660
|
+
trigger: GO_INIT_CODE_TRIGGER,
|
|
661
|
+
failure: GO_FAILURE_MODULE_CODE
|
|
662
|
+
},
|
|
663
|
+
bash: {
|
|
664
|
+
script: BASH_INIT_CODE
|
|
665
|
+
},
|
|
666
|
+
powershell: {
|
|
667
|
+
script: POWERSHELL_INIT_CODE
|
|
668
|
+
},
|
|
669
|
+
nativets: {
|
|
670
|
+
script: NATIVETS_INIT_CODE
|
|
671
|
+
},
|
|
672
|
+
postgresql: {
|
|
673
|
+
script: POSTGRES_INIT_CODE
|
|
674
|
+
},
|
|
675
|
+
mysql: {
|
|
676
|
+
script: MYSQL_INIT_CODE
|
|
677
|
+
},
|
|
678
|
+
bigquery: {
|
|
679
|
+
script: BIGQUERY_INIT_CODE
|
|
680
|
+
},
|
|
681
|
+
snowflake: {
|
|
682
|
+
script: SNOWFLAKE_INIT_CODE
|
|
683
|
+
},
|
|
684
|
+
mssql: {
|
|
685
|
+
script: MSSQL_INIT_CODE
|
|
686
|
+
},
|
|
687
|
+
graphql: {
|
|
688
|
+
script: GRAPHQL_INIT_CODE
|
|
689
|
+
},
|
|
690
|
+
php: {
|
|
691
|
+
script: PHP_INIT_CODE
|
|
692
|
+
},
|
|
693
|
+
rust: {
|
|
694
|
+
script: RUST_INIT_CODE
|
|
695
|
+
},
|
|
696
|
+
ansible: {
|
|
697
|
+
script: ANSIBLE_PLAYBOOK_INIT_CODE
|
|
698
|
+
},
|
|
699
|
+
docker: {
|
|
700
|
+
script: DOCKER_INIT_CODE
|
|
701
|
+
},
|
|
702
|
+
bunnative: {
|
|
703
|
+
script: BUNNATIVE_INIT_CODE
|
|
669
704
|
}
|
|
705
|
+
};
|
|
706
|
+
export function isInitialCode(content) {
|
|
707
|
+
Object.values(INITIAL_CODE).forEach((lang) => {
|
|
708
|
+
Object.values(lang).forEach((code) => {
|
|
709
|
+
if (content === code) {
|
|
710
|
+
return true;
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
});
|
|
670
714
|
return false;
|
|
671
715
|
}
|
|
672
716
|
export function initialCode(language, kind, subkind) {
|
|
@@ -675,129 +719,129 @@ export function initialCode(language, kind, subkind) {
|
|
|
675
719
|
}
|
|
676
720
|
if (language === 'deno') {
|
|
677
721
|
if (kind === 'trigger') {
|
|
678
|
-
return
|
|
722
|
+
return INITIAL_CODE.deno.trigger;
|
|
679
723
|
}
|
|
680
724
|
else if (kind === 'script') {
|
|
681
725
|
if (subkind === 'flow') {
|
|
682
|
-
return
|
|
726
|
+
return INITIAL_CODE.deno.script;
|
|
683
727
|
}
|
|
684
728
|
else if (subkind === 'pgsql') {
|
|
685
|
-
return
|
|
729
|
+
return INITIAL_CODE.postgresql.script;
|
|
686
730
|
}
|
|
687
731
|
else if (subkind === 'mysql') {
|
|
688
|
-
return
|
|
732
|
+
return INITIAL_CODE.mysql.script;
|
|
689
733
|
}
|
|
690
734
|
else if (subkind === 'fetch') {
|
|
691
|
-
return
|
|
735
|
+
return INITIAL_CODE.deno.fetch;
|
|
692
736
|
}
|
|
693
737
|
else if (subkind === 'preprocessor') {
|
|
694
|
-
return
|
|
738
|
+
return INITIAL_CODE.deno.preprocessor;
|
|
695
739
|
}
|
|
696
740
|
else {
|
|
697
|
-
return
|
|
741
|
+
return INITIAL_CODE.deno.script;
|
|
698
742
|
}
|
|
699
743
|
}
|
|
700
744
|
else if (kind === 'failure') {
|
|
701
|
-
return
|
|
745
|
+
return INITIAL_CODE.deno.failure;
|
|
702
746
|
}
|
|
703
747
|
else if (kind === 'approval') {
|
|
704
|
-
return
|
|
748
|
+
return INITIAL_CODE.deno.approval;
|
|
705
749
|
}
|
|
706
750
|
else {
|
|
707
|
-
return
|
|
751
|
+
return INITIAL_CODE.deno.script;
|
|
708
752
|
}
|
|
709
753
|
}
|
|
710
754
|
else if (language === 'python3') {
|
|
711
755
|
if (kind === 'trigger') {
|
|
712
|
-
return
|
|
756
|
+
return INITIAL_CODE.python3.trigger;
|
|
713
757
|
}
|
|
714
758
|
else if (kind === 'approval') {
|
|
715
|
-
return
|
|
759
|
+
return INITIAL_CODE.python3.approval;
|
|
716
760
|
}
|
|
717
761
|
else if (kind === 'failure') {
|
|
718
|
-
return
|
|
762
|
+
return INITIAL_CODE.python3.failure;
|
|
719
763
|
}
|
|
720
764
|
else if (subkind === 'flow') {
|
|
721
|
-
return
|
|
765
|
+
return INITIAL_CODE.python3.script;
|
|
722
766
|
}
|
|
723
767
|
else if (subkind === 'preprocessor') {
|
|
724
|
-
return
|
|
768
|
+
return INITIAL_CODE.python3.preprocessor;
|
|
725
769
|
}
|
|
726
770
|
else {
|
|
727
|
-
return
|
|
771
|
+
return INITIAL_CODE.python3.script;
|
|
728
772
|
}
|
|
729
773
|
}
|
|
730
774
|
else if (language == 'bash') {
|
|
731
775
|
if (subkind === 'docker') {
|
|
732
|
-
return
|
|
776
|
+
return INITIAL_CODE.docker.script;
|
|
733
777
|
}
|
|
734
778
|
else {
|
|
735
|
-
return
|
|
779
|
+
return INITIAL_CODE.bash.script;
|
|
736
780
|
}
|
|
737
781
|
}
|
|
738
782
|
else if (language == 'powershell') {
|
|
739
|
-
return
|
|
783
|
+
return INITIAL_CODE.powershell.script;
|
|
740
784
|
}
|
|
741
785
|
else if (language == 'nativets') {
|
|
742
|
-
return
|
|
786
|
+
return INITIAL_CODE.nativets.script;
|
|
743
787
|
}
|
|
744
788
|
else if (language == 'postgresql') {
|
|
745
|
-
return
|
|
789
|
+
return INITIAL_CODE.postgresql.script;
|
|
746
790
|
}
|
|
747
791
|
else if (language == 'mysql') {
|
|
748
|
-
return
|
|
792
|
+
return INITIAL_CODE.mysql.script;
|
|
749
793
|
}
|
|
750
794
|
else if (language == 'bigquery') {
|
|
751
|
-
return
|
|
795
|
+
return INITIAL_CODE.bigquery.script;
|
|
752
796
|
}
|
|
753
797
|
else if (language == 'snowflake') {
|
|
754
|
-
return
|
|
798
|
+
return INITIAL_CODE.snowflake.script;
|
|
755
799
|
}
|
|
756
800
|
else if (language == 'mssql') {
|
|
757
|
-
return
|
|
801
|
+
return INITIAL_CODE.mssql.script;
|
|
758
802
|
}
|
|
759
803
|
else if (language == 'graphql') {
|
|
760
|
-
return
|
|
804
|
+
return INITIAL_CODE.graphql.script;
|
|
761
805
|
}
|
|
762
806
|
else if (language == 'php') {
|
|
763
|
-
return
|
|
807
|
+
return INITIAL_CODE.php.script;
|
|
764
808
|
}
|
|
765
809
|
else if (language == 'rust') {
|
|
766
|
-
return
|
|
810
|
+
return INITIAL_CODE.rust.script;
|
|
767
811
|
}
|
|
768
812
|
else if (language == 'ansible') {
|
|
769
|
-
return
|
|
813
|
+
return INITIAL_CODE.ansible.script;
|
|
770
814
|
}
|
|
771
815
|
else if (language == 'bun' || language == 'bunnative') {
|
|
772
816
|
if (kind == 'trigger') {
|
|
773
|
-
return
|
|
817
|
+
return INITIAL_CODE.bun.trigger;
|
|
774
818
|
}
|
|
775
819
|
else if (language == 'bunnative' || subkind === 'bunnative') {
|
|
776
|
-
return
|
|
820
|
+
return INITIAL_CODE.bunnative.script;
|
|
777
821
|
}
|
|
778
822
|
else if (kind === 'approval') {
|
|
779
|
-
return
|
|
823
|
+
return INITIAL_CODE.bun.approval;
|
|
780
824
|
}
|
|
781
825
|
else if (kind === 'failure') {
|
|
782
|
-
return
|
|
826
|
+
return INITIAL_CODE.bun.failure;
|
|
783
827
|
}
|
|
784
828
|
else if (subkind === 'preprocessor') {
|
|
785
|
-
return
|
|
829
|
+
return INITIAL_CODE.bun.preprocessor;
|
|
786
830
|
}
|
|
787
831
|
else if (subkind === 'flow') {
|
|
788
|
-
return
|
|
832
|
+
return INITIAL_CODE.bun.script;
|
|
789
833
|
}
|
|
790
|
-
return
|
|
834
|
+
return INITIAL_CODE.bun.script;
|
|
791
835
|
}
|
|
792
836
|
else {
|
|
793
837
|
if (kind === 'failure') {
|
|
794
|
-
return
|
|
838
|
+
return INITIAL_CODE.go.failure;
|
|
795
839
|
}
|
|
796
840
|
else if (kind === 'trigger') {
|
|
797
|
-
return
|
|
841
|
+
return INITIAL_CODE.go.trigger;
|
|
798
842
|
}
|
|
799
843
|
else {
|
|
800
|
-
return
|
|
844
|
+
return INITIAL_CODE.go.script;
|
|
801
845
|
}
|
|
802
846
|
}
|
|
803
847
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "windmill-components",
|
|
3
|
-
"version": "1.406.
|
|
3
|
+
"version": "1.406.2",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite dev",
|
|
6
6
|
"build": "vite build",
|
|
@@ -300,9 +300,9 @@
|
|
|
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"
|
|
303
|
+
"./components/icons/store": {
|
|
304
|
+
"types": "./package/components/icons/store.d.ts",
|
|
305
|
+
"default": "./package/components/icons/store.js"
|
|
306
306
|
},
|
|
307
307
|
"./script_helpers": {
|
|
308
308
|
"types": "./package/script_helpers.d.ts",
|
|
@@ -481,8 +481,8 @@
|
|
|
481
481
|
"script_helpers": [
|
|
482
482
|
"./package/script_helpers.d.ts"
|
|
483
483
|
],
|
|
484
|
-
"icons/store": [
|
|
485
|
-
"./package/icons/store.d.ts"
|
|
484
|
+
"components/icons/store": [
|
|
485
|
+
"./package/components/icons/store.d.ts"
|
|
486
486
|
]
|
|
487
487
|
}
|
|
488
488
|
},
|