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.
Files changed (109) hide show
  1. package/package/assets/app.css +20 -0
  2. package/package/components/AppConnectLightweightResourcePicker.svelte +66 -0
  3. package/package/components/AppConnectLightweightResourcePicker.svelte.d.ts +21 -0
  4. package/package/components/ArgInput.svelte +6 -2
  5. package/package/components/ArgInput.svelte.d.ts +1 -0
  6. package/package/components/CustomPopover.svelte +1 -1
  7. package/package/components/DisplayResult.svelte +1 -1
  8. package/package/components/FlowBuilder.svelte +2 -0
  9. package/package/components/FlowBuilder.svelte.d.ts +1 -0
  10. package/package/components/FlowInputViewer.svelte +25 -0
  11. package/package/components/FlowInputViewer.svelte.d.ts +19 -0
  12. package/package/components/FlowJobResult.svelte +8 -1
  13. package/package/components/FlowJobResult.svelte.d.ts +1 -0
  14. package/package/components/FlowMetadata.svelte +2 -2
  15. package/package/components/FlowPreviewContent.svelte +2 -1
  16. package/package/components/FlowStatusViewer.svelte +3 -1
  17. package/package/components/FlowStatusViewer.svelte.d.ts +1 -0
  18. package/package/components/FlowStatusViewerInner.svelte +4 -1
  19. package/package/components/FlowViewer.svelte +2 -21
  20. package/package/components/LightweightResourcePicker.svelte +34 -30
  21. package/package/components/LogViewer.svelte +4 -3
  22. package/package/components/LogViewer.svelte.d.ts +1 -0
  23. package/package/components/ManualPopover.svelte +1 -1
  24. package/package/components/ObjectResourceInput.svelte +5 -2
  25. package/package/components/ObjectResourceInput.svelte.d.ts +2 -0
  26. package/package/components/Popover.svelte +1 -1
  27. package/package/components/Portal.svelte +7 -8
  28. package/package/components/Portal.svelte.d.ts +3 -7
  29. package/package/components/QueueMetricsDrawer.svelte +368 -3
  30. package/package/components/QueueMetricsDrawer.svelte.d.ts +2 -0
  31. package/package/components/ResourceEditor.svelte +4 -5
  32. package/package/components/ResourcePicker.svelte +14 -9
  33. package/package/components/ResourcePicker.svelte.d.ts +1 -0
  34. package/package/components/RunForm.svelte +1 -1
  35. package/package/components/SavedInputs.svelte +2 -2
  36. package/package/components/ScriptVersionHistory.svelte +54 -59
  37. package/package/components/TestConnection.svelte +1 -0
  38. package/package/components/TimeAgo.svelte +5 -6
  39. package/package/components/TimeAgo.svelte.d.ts +1 -1
  40. package/package/components/apps/components/buttons/AppButton.svelte +1 -1
  41. package/package/components/apps/components/display/dbtable/AppDbExplorer.svelte +1 -1
  42. package/package/components/apps/components/inputs/AppMultiSelect.svelte +1 -1
  43. package/package/components/apps/components/inputs/AppMultiSelectV2.svelte +1 -1
  44. package/package/components/apps/components/layout/AppDrawer.svelte +1 -1
  45. package/package/components/apps/components/layout/AppModal.svelte +1 -1
  46. package/package/components/apps/editor/AppEditor.svelte +11 -3
  47. package/package/components/apps/editor/GridEditor.svelte +57 -4
  48. package/package/components/apps/editor/GridEditor.svelte.d.ts +8 -0
  49. package/package/components/apps/editor/GridEditorMenu.svelte +1 -1
  50. package/package/components/apps/editor/SubGridEditor.svelte +82 -3
  51. package/package/components/apps/editor/SubGridEditor.svelte.d.ts +16 -0
  52. package/package/components/apps/editor/appUtils.d.ts +19 -2
  53. package/package/components/apps/editor/appUtils.js +103 -7
  54. package/package/components/apps/editor/component/Component.svelte +36 -8
  55. package/package/components/apps/editor/component/Component.svelte.d.ts +3 -1
  56. package/package/components/apps/editor/contextPanel/components/OutputHeader.svelte +1 -1
  57. package/package/components/apps/svelte-grid/Grid.svelte +235 -12
  58. package/package/components/apps/svelte-grid/Grid.svelte.d.ts +7 -7
  59. package/package/components/apps/svelte-grid/MoveResize.svelte +104 -11
  60. package/package/components/apps/svelte-grid/MoveResize.svelte.d.ts +7 -0
  61. package/package/components/apps/svelte-grid/utils/item.d.ts +4 -1
  62. package/package/components/apps/svelte-grid/utils/item.js +2 -3
  63. package/package/components/apps/svelte-select/lib/ConditionalPortal.svelte +1 -1
  64. package/package/components/apps/svelte-select/lib/ConditionalPortalGlobal.svelte +1 -1
  65. package/package/components/common/button/ButtonDropdown.svelte +1 -1
  66. package/package/components/common/drawer/ConditionalPortal.svelte +1 -1
  67. package/package/components/common/menu/MenuV2.svelte +1 -1
  68. package/package/components/common/modal/AlwaysMountedModal.svelte +1 -1
  69. package/package/components/common/popup/PopupV2.svelte +1 -1
  70. package/package/components/copilot/StepGenQuick.svelte +3 -2
  71. package/package/components/copilot/StepGenQuick.svelte.d.ts +1 -0
  72. package/package/components/custom_ui.d.ts +1 -0
  73. package/package/components/details/Menu.svelte +1 -1
  74. package/package/components/flows/CreateActionsApp.svelte +1 -1
  75. package/package/components/flows/FlowEditor.svelte +2 -1
  76. package/package/components/flows/FlowEditor.svelte.d.ts +1 -0
  77. package/package/components/flows/FlowHistory.svelte +10 -195
  78. package/package/components/flows/FlowHistory.svelte.d.ts +0 -1
  79. package/package/components/flows/FlowHistoryInner.svelte +200 -0
  80. package/package/components/flows/FlowHistoryInner.svelte.d.ts +19 -0
  81. package/package/components/flows/content/FlowEditorPanel.svelte +2 -1
  82. package/package/components/flows/content/FlowEditorPanel.svelte.d.ts +1 -0
  83. package/package/components/flows/content/FlowInput.svelte +66 -58
  84. package/package/components/flows/content/FlowInput.svelte.d.ts +1 -0
  85. package/package/components/flows/content/FlowModuleScript.svelte +1 -1
  86. package/package/components/flows/header/FlowYamlEditor.svelte +6 -2
  87. package/package/components/flows/map/FlowModuleSchemaMap.svelte +3 -2
  88. package/package/components/flows/map/InsertModuleButton.svelte +1 -1
  89. package/package/components/flows/pickers/WorkspaceScriptPickerQuick.svelte +1 -1
  90. package/package/components/graph/model.d.ts +1 -0
  91. package/package/components/icons/WindmillIcon.svelte +119 -105
  92. package/package/components/icons/store.d.ts +4 -0
  93. package/package/components/icons/store.js +1 -0
  94. package/package/components/multiselect/MultiSelectWrapper.svelte +1 -1
  95. package/package/components/propertyPicker/ObjectViewer.svelte +1 -1
  96. package/package/components/runs/RunRow.svelte +3 -7
  97. package/package/components/schema/FlowPropertyEditor.svelte +1 -0
  98. package/package/components/search/GlobalSearchModal.svelte +1 -1
  99. package/package/script_helpers.d.ts +37 -38
  100. package/package/script_helpers.js +100 -38
  101. package/package.json +23 -1
  102. package/package/init_scripts/python_failure_module.d.ts +0 -2
  103. package/package/init_scripts/python_failure_module.js +0 -8
  104. package/package/init_scripts/python_init_code.d.ts +0 -2
  105. package/package/init_scripts/python_init_code.js +0 -40
  106. package/package/init_scripts/python_init_code_clear.d.ts +0 -2
  107. package/package/init_scripts/python_init_code_clear.js +0 -5
  108. package/package/init_scripts/python_init_code_trigger.d.ts +0 -2
  109. 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 { PYTHON_INIT_CODE, PYTHON_INIT_CODE_CLEAR, PYTHON_INIT_CODE_TRIGGER, PYTHON_FAILURE_MODULE_CODE };
8
- export declare const NATIVETS_INIT_CODE = "// Fetch-only script, no imports allowed (except windmill) but benefits from a dedicated highly efficient runtime\n//import * as wmill from './windmill.ts'\n\nexport async function main(example_input: number = 3) {\n // \"3\" is the default value of example_input, it can be overriden with code or using the UI\n const res = await fetch(`https://jsonplaceholder.typicode.com/todos/${example_input}`, {\n headers: { \"Content-Type\": \"application/json\" },\n });\n return res.json();\n}\n";
9
- export declare const BUNNATIVE_INIT_CODE = "//native\n//you can add proxy support using //proxy http(s)://host:port\n\n// native scripts are bun scripts that are executed on native workers and can be parallelized\n// only fetch is allowed, but imports will work as long as they also use only fetch and the standard lib\n\n//import * as wmill from \"windmill-client\"\n\nexport async function main(example_input: number = 3) {\n // \"3\" is the default value of example_input, it can be overriden with code or using the UI\n const res = await fetch(`https://jsonplaceholder.typicode.com/todos/${example_input}`, {\n headers: { \"Content-Type\": \"application/json\" },\n });\n return res.json();\n}\n";
10
- export declare const NATIVETS_INIT_CODE_CLEAR = "// Fetch-only script, no imports allowed (except windmill) but benefits from a dedicated highly efficient runtime\n//import * as wmill from './windmill.ts'\n\nexport async function main() {\n const res = await fetch(\"https://jsonplaceholder.typicode.com/todos/1\", {\n headers: { \"Content-Type\": \"application/json\" },\n });\n return res.json();\n}\n";
11
- export declare const DENO_INIT_CODE: string;
12
- export declare const BUN_INIT_CODE = "// there are multiple modes to add as header: //nobundling //native //npm //nodejs\n// https://www.windmill.dev/docs/getting_started/scripts_quickstart/typescript#modes\n\n// import { toWords } from \"number-to-words@1\"\nimport * as wmill from \"windmill-client\"\n\n// fill the type, or use the +Resource type to get a type-safe reference to a resource\n// type Postgresql = object\n\n\nexport async function main(\n a: number,\n b: \"my\" | \"enum\",\n //c: Postgresql,\n //d: wmill.S3Object, // https://www.windmill.dev/docs/core_concepts/persistent_storage/large_data_files \n //d: DynSelect_foo, // https://www.windmill.dev/docs/core_concepts/json_schema_and_parsing#dynamic-select\n e = \"inferred type string from default arg\",\n f = { nested: \"object\" },\n g: {\n label: \"Variant 1\",\n foo: string\n } | {\n label: \"Variant 2\",\n bar: number\n }\n) {\n // let x = await wmill.getVariable('u/user/foo')\n return { foo: a };\n}\n";
13
- export declare const GO_INIT_CODE = "package inner\n\nimport (\n\t\"fmt\"\n\t\"rsc.io/quote\"\n\t// wmill \"github.com/windmill-labs/windmill-go-client\"\n)\n\n// Pin dependencies partially in go.mod with a comment starting with \"//require\":\n//require rsc.io/quote v1.5.1\n\n// the main must return (interface{}, error)\n\nfunc main(x string, nested struct {\n\tFoo string `json:\"foo\"`\n}) (interface{}, error) {\n\tfmt.Println(\"Hello, World\")\n\tfmt.Println(nested.Foo)\n\tfmt.Println(quote.Opt())\n\t// v, _ := wmill.GetVariable(\"f/examples/secret\")\n\treturn x, nil\n}\n";
14
- export declare const GO_FAILURE_MODULE_CODE = "package inner\n\nimport (\n\t\"fmt\"\n \"os\"\n)\n\n// connect the error parameter to 'previous_result.error'\n\nfunc main(message string, name string) (interface{}, error) {\n\tfmt.Println(message)\n\tfmt.Println(name)\n\tfmt.Println(\"flow id that failed\", os.Getenv(\"WM_FLOW_JOB_ID\"))\n return message, nil\n}\n";
15
- export declare const DENO_INIT_CODE_CLEAR: string;
16
- export declare const BUN_INIT_CODE_CLEAR = "// import * as wmill from \"windmill-client\"\n\nexport async function main(x: string) {\n return x\n}\n";
17
- export declare const DENO_FAILURE_MODULE_CODE = "\nexport async function main(message: string, name: string, step_id: string) {\n const flow_id = Deno.env.get(\"WM_ROOT_FLOW_JOB_ID\")\n console.log(\"message\", message)\n console.log(\"name\",name)\n console.log(\"step_id\", step_id)\n return { message, flow_id, step_id, recover: false }\n}\n";
18
- export declare const BUN_FAILURE_MODULE_CODE = "\nexport async function main(message: string, name: string, step_id: string) {\n const flow_id = process.env.WM_ROOT_FLOW_JOB_ID\n console.log(\"message\", message)\n console.log(\"name\",name)\n console.log(\"step_id\", step_id)\n return { message, flow_id, step_id, recover: false }\n}\n";
19
- export declare const POSTGRES_INIT_CODE = "-- to pin the database use '-- database f/your/path'\n-- $1 name1 = default arg\n-- $2 name2\n-- $3 name3\n-- $4 name4\nINSERT INTO demo VALUES ($1::TEXT, $2::INT, $3::TEXT[]) RETURNING *;\nUPDATE demo SET col2 = $4::INT WHERE col2 = $2::INT;\n";
20
- export declare const MYSQL_INIT_CODE = "-- to pin the database use '-- database f/your/path'\n-- :name1 (text) = default arg\n-- :name2 (int)\n-- :name3 (int)\nINSERT INTO demo VALUES (:name1, :name2);\nUPDATE demo SET col2 = :name3 WHERE col2 = :name2;\n";
21
- export declare const BIGQUERY_INIT_CODE = "-- to pin the database use '-- database f/your/path'\n-- @name1 (string) = default arg\n-- @name2 (integer)\n-- @name3 (string[])\n-- @name4 (integer)\nINSERT INTO `demodb.demo` VALUES (@name1, @name2, @name3);\nUPDATE `demodb.demo` SET col2 = @name4 WHERE col2 = @name2;\n";
22
- export declare const SNOWFLAKE_INIT_CODE = "-- to pin the database use '-- database f/your/path'\n-- ? name1 (varchar) = default arg\n-- ? name2 (int)\nINSERT INTO demo VALUES (?, ?);\n-- ? name3 (int)\n-- ? name2 (int)\nUPDATE demo SET col2 = ? WHERE col2 = ?;\n";
23
- export declare const MSSQL_INIT_CODE = "-- return_last_result\n-- to pin the database use '-- database f/your/path'\n-- @p1 name1 (varchar) = default arg\n-- @p2 name2 (int)\n-- @p3 name3 (int)\nINSERT INTO demo VALUES (@p1, @p2);\nUPDATE demo SET col2 = @p3 WHERE col2 = @p2;\n";
24
- export declare const GRAPHQL_INIT_CODE = "query($name4: String, $name2: Int, $name3: [String]) {\n\tdemo(name1: $name1, name2: $name2, name3: $name3) {\n\t\tname1,\n\t\tname2,\n\t\tname3\n\t}\n}\n";
25
- export declare const PHP_INIT_CODE = "<?php\n\n// remove the first // of the following lines to specify packages to install using composer\n// // require:\n// // monolog/monolog@3.6.0\n// // stripe/stripe-php\n\nfunction main(\n // Postgresql $a,\n // array $b,\n // object $c,\n int $d = 123,\n string $e = \"default value\",\n float $f = 3.5,\n bool $g = true,\n) {\n return $d;\n}\n";
26
- export declare const RUST_INIT_CODE = "//! Add dependencies in the following partial Cargo.toml manifest\n//!\n//! ```cargo\n//! [dependencies]\n//! anyhow = \"1.0.86\"\n//! rand = \"0.7.2\"\n//! ```\n//!\n//! Note that serde is used by default with the `derive` feature.\n//! You can still reimport it if you need additional features.\n\nuse anyhow::anyhow;\nuse rand::seq::SliceRandom;\nuse serde::Serialize;\n\n#[derive(Serialize, Debug)]\nstruct Ret {\n msg: String,\n number: i8,\n}\n\nfn main(who_to_greet: String, numbers: Vec<i8>) -> anyhow::Result<Ret> {\n println!(\n \"Person to greet: {} - numbers to choose: {:?}\",\n who_to_greet, numbers\n );\n Ok(Ret {\n msg: format!(\"Greetings {}!\", who_to_greet),\n number: *numbers\n .choose(&mut rand::thread_rng())\n .ok_or(anyhow!(\"There should be some numbers to choose from\"))?,\n })\n}\n";
27
- export declare const FETCH_INIT_CODE = "export async function main(\n\turl: string | undefined,\n\tmethod: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' = 'GET',\n\tbody: Object = {},\n\theaders: Record<string, string> = {}\n): Promise<Response | null> {\n\tif (!url) {\n\t\tconsole.error('Error: URL is undefined')\n\t\treturn null\n\t}\n\n\tconst requestOptions: RequestInit = {\n\t\tmethod: method || 'GET',\n\t\theaders: headers || {}\n\t}\n\n\tif (requestOptions.method !== 'GET' && requestOptions.method !== 'HEAD' && body !== undefined) {\n\t\trequestOptions.body = JSON.stringify(body)\n\t\trequestOptions.headers = {\n\t\t\t'Content-Type': 'application/json',\n\t\t\t...requestOptions.headers\n\t\t}\n\t}\n\n\treturn await fetch(url, requestOptions)\n\t\t.then((res) => res.json())\n\t\t.catch(() => {\n\t\t\tthrow new Error('An error occured')\n\t\t})\n}";
28
- export declare const BASH_INIT_CODE = "# shellcheck shell=bash\n# arguments of the form X=\"$I\" are parsed as parameters X of type string\nmsg=\"$1\"\ndflt=\"${2:-default value}\"\n\n# the last line of the stdout is the return value\n# unless you write json to './result.json' or a string to './result.out'\necho \"Hello $msg\"\n";
29
- export declare const DENO_INIT_CODE_TRIGGER: string;
30
- export declare const BUN_INIT_CODE_TRIGGER = "import * as wmill from \"windmill-client\"\n\nexport async function main() {\n\n // A common trigger script would follow this pattern:\n // 1. Get the last saved state\n // const state = await wmill.getState()\n // 2. Get the actual state from the external service\n // const newState = await (await fetch('https://hacker-news.firebaseio.com/v0/topstories.json')).json()\n // 3. Compare the two states and update the internal state\n // await wmill.setState(newState)\n // 4. Return the new rows\n // return range from (state to newState)\n\n return [1,2,3]\n\n // In subsequent scripts, you may refer to each row/value returned by the trigger script using\n // 'flow_input.iter.value'\n}\n";
31
- export declare const GO_INIT_CODE_TRIGGER = "package inner\n\nimport (\n\twmill \"github.com/windmill-labs/windmill-go-client\"\n)\n\nfunc main() (interface{}, error) {\n\n\t// A common trigger script would follow this pattern:\n\t// 1. Get the last saved state\n\tstate, _ := wmill.GetState()\n\t// 2. Get the actual state from the external service\n\t// newState := ...\n\t// 3. Compare the two states and update the internal state\n\twmill.SetState(4)\n\t// 4. Return the new rows\n\n\treturn state, nil\n\n\t// In subsequent scripts, you may refer to each row/value returned by the trigger script using\n\t// 'flow_input.iter.value'\n}\n";
32
- export declare const DENO_INIT_CODE_APPROVAL = "import * as wmill from \"npm:windmill-client@^1.158.2\"\n\nexport async function main(approver?: string) {\n const urls = await wmill.getResumeUrls(approver)\n // send the urls to their intended recipients\n\n return {\n // if the resumeUrls are part of the response, they will be available to any persons having access\n // to the run page and allowed to be approved from there, even from non owners of the flow\n // self-approval is disableable in the suspend options\n \t...urls,\n\n // to have prompts (self-approvable steps), clude instead the resume url in the returned payload of the step\n // the UX will automatically adapt and show the prompt to the operator when running the flow. e.g:\n // resume: urls['resume'],\n\n\t\tdefault_args: {},\n\t\tenums: {},\n\t\tdescription: undefined\n\t\t// supports all formats from rich display rendering such as simple strings,\n\t\t// but also markdown, html, images, tables, maps, render_all, etc...\n\t\t// https://www.windmill.dev/docs/core_concepts/rich_display_rendering\n }\n}\n\n// add a form in Advanced - Suspend\n// all on approval steps: https://www.windmill.dev/docs/flows/flow_approval";
33
- export declare const BUN_INIT_CODE_APPROVAL = "import * as wmill from \"windmill-client@^1.158.2\"\n\nexport async function main(approver?: string) {\n const urls = await wmill.getResumeUrls(approver)\n // send the urls to their intended recipients\n\n return {\n // if the resumeUrls are part of the response, they will be available to any persons having access\n // to the run page and allowed to be approved from there, even from non owners of the flow\n // self-approval is disableable in the suspend options\n \t...urls,\n\n // to have prompts (self-approvable steps), clude instead the resume url in the returned payload of the step\n // the UX will automatically adapt and show the prompt to the operator when running the flow. e.g:\n // resume: urls['resume'],\n\n\t\tdefault_args: {},\n\t\tenums: {},\n\t\tdescription: undefined\n\t\t// supports all formats from rich display rendering such as simple strings,\n\t\t// but also markdown, html, images, tables, maps, render_all, etc...\n\t\t// https://www.windmill.dev/docs/core_concepts/rich_display_rendering\n }\n}\n\n// add a form in Advanced - Suspend\n// all on approval steps: https://www.windmill.dev/docs/flows/flow_approval";
34
- export declare const BUN_PREPROCESSOR_MODULE_CODE = "\nexport async function preprocessor(\n\twm_trigger: {\n\t\tkind: 'http' | 'email' | 'webhook',\n\t\thttp?: {\n\t\t\troute: string // The route path, e.g. \"/users/:id\"\n\t\t\tpath: string // The actual path called, e.g. \"/users/123\"\n\t\t\tmethod: string\n\t\t\tparams: Record<string, string>\n\t\t\tquery: Record<string, string>\n\t\t\theaders: Record<string, string>\n\t\t}\n\t},\n\t/* your other args */ \n) {\n\treturn {\n\t\t// return the args to be passed to the flow\n\t}\n}\n";
35
- export declare const DENO_PREPROCESSOR_MODULE_CODE = "\nexport async function preprocessor(\n\twm_trigger: {\n\t\tkind: 'http' | 'email' | 'wehbook',\n\t\thttp?: {\n\t\t\troute: string // The route path, e.g. \"/users/:id\"\n\t\t\tpath: string // The actual path called, e.g. \"/users/123\"\n\t\t\tmethod: string\n\t\t\tparams: Record<string, string>\n\t\t\tquery: Record<string, string>\n\t\t\theaders: Record<string, string>\n\t\t}\n\t},\n\t/* your other args */ \n) {\n\treturn {\n\t\t// return the args to be passed to the flow\n\t}\n}\n";
36
- export declare const PYTHON_INIT_CODE_APPROVAL = "import wmill\n\ndef main():\n urls = wmill.get_resume_urls()\n # send the urls to their intended recipients\n\n return {\n # if the get_resume_urls are part of the response, they will be available to any persons having access\n # to the run page and allowed to be approved from there, even from non owners of the flow\n # self-approval is disableable in the suspend options\n **urls,\n\n # to have prompts (self-approvable steps), clude instead the resume url in the returned payload of the step\n # the UX will automatically adapt and show the prompt to the operator when running the flow. e.g:\n # \"resume\": urls[\"resume\"],\n\n \"default_args\": {},\n \"enums\": {},\n \"description\": None,\n # supports all formats from rich display rendering such as simple strings,\n # but also markdown, html, images, tables, maps, render_all, etc...\n # https://www.windmill.dev/docs/core_concepts/rich_display_rendering\n }\n\n# add a form in Advanced - Suspend\n# all on approval steps: https://www.windmill.dev/docs/flows/flow_approval";
37
- export declare const PYTHON_PREPROCESSOR_MODULE_CODE = "from typing import TypedDict, Literal\n\nclass Http(TypedDict):\n\troute: str # The route path, e.g. \"/users/:id\"\n\tpath: str # The actual path called, e.g. \"/users/123\"\n\tmethod: str\n\tparams: dict[str, str]\n\tquery: dict[str, str]\n\theaders: dict[str, str]\n\nclass WmTrigger(TypedDict):\n kind: Literal[\"http\", \"email\", \"webhook\"]\n http: Http | None\n\ndef preprocessor(\n\twm_trigger: WmTrigger,\n\t# your other args\n):\n\treturn {\n\t\t# return the args to be passed to the flow\n\t}\n";
38
- export declare const DOCKER_INIT_CODE = "# shellcheck shell=bash\n# Bash script that calls docker as a client to the host daemon\n# See documentation: https://www.windmill.dev/docs/advanced/docker\nmsg=\"${1:-world}\"\n\nIMAGE=\"alpine:latest\"\nCOMMAND=\"/bin/echo Hello $msg\"\n\n# ensure that the image is up-to-date\ndocker pull $IMAGE\ndocker run --rm $IMAGE $COMMAND\n";
39
- export declare const POWERSHELL_INIT_CODE = "param($Msg, $Dflt = \"default value\", [int]$Nb = 3)\n\n# Import-Module MyModule\n\n# Import-Module WindmillClient\n# Connect-Windmill\n# Get-WindmillVariable -Path 'u/user/foo'\n\n# the last line of the stdout is the return value\nWrite-Output \"Hello $Msg\"";
40
- export declare const ANSIBLE_PLAYBOOK_INIT_CODE = "---\ninventory:\n - resource_type: ansible_inventory\n # You can pin an inventory to this script by hardcoding the resource path:\n # resource: u/user/your_resource\n\n# File resources will be written in the relative `target` location before\n# running the playbook\n# file_resources:\n # - resource: u/user/fabulous_jinja_template\n # target: ./config_template.j2\n\n# Define the arguments of the windmill script\nextra_vars:\n world_qualifier:\n type: string\n\ndependencies:\n galaxy:\n collections:\n - name: community.general\n - name: community.vmware\n python:\n - jmespath\n---\n- name: Echo\n hosts: 127.0.0.1\n connection: local\n vars:\n my_result:\n a: 2\n b: true\n c: \"Hello\"\n\n tasks:\n - name: Print debug message\n debug:\n msg: \"Hello, {{world_qualifier}} world!\"\n - name: Write variable my_result to result.json\n delegate_to: localhost\n copy:\n content: \"{{ my_result | to_json }}\"\n dest: result.json\n";
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
- 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
- export { PYTHON_INIT_CODE, PYTHON_INIT_CODE_CLEAR, PYTHON_INIT_CODE_TRIGGER, PYTHON_FAILURE_MODULE_CODE };
7
- export const NATIVETS_INIT_CODE = `// Fetch-only script, no imports allowed (except windmill) but benefits from a dedicated highly efficient runtime
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 const BUNNATIVE_INIT_CODE = `//native
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 const NATIVETS_INIT_CODE_CLEAR = `// Fetch-only script, no imports allowed (except windmill) but benefits from a dedicated highly efficient runtime
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 const DENO_INIT_CODE = `// Ctrl/CMD+. to cache dependencies on imports hover.
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 const BUN_INIT_CODE = `// there are multiple modes to add as header: //nobundling //native //npm //nodejs
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 const GO_INIT_CODE = `package inner
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 const GO_FAILURE_MODULE_CODE = `package inner
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 const DENO_INIT_CODE_CLEAR = `// import * as wmill from "npm:windmill-client@${__pkg__.version}"
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 const BUN_INIT_CODE_CLEAR = `// import * as wmill from "windmill-client"
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 const DENO_FAILURE_MODULE_CODE = `
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 const BUN_FAILURE_MODULE_CODE = `
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 const POSTGRES_INIT_CODE = `-- to pin the database use '-- database f/your/path'
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 const MYSQL_INIT_CODE = `-- to pin the database use '-- database f/your/path'
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 const BIGQUERY_INIT_CODE = `-- to pin the database use '-- database f/your/path'
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 const SNOWFLAKE_INIT_CODE = `-- to pin the database use '-- database f/your/path'
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 const MSSQL_INIT_CODE = `-- return_last_result
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 const GRAPHQL_INIT_CODE = `query($name4: String, $name2: Int, $name3: [String]) {
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 const PHP_INIT_CODE = `<?php
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 const RUST_INIT_CODE = `//! Add dependencies in the following partial Cargo.toml manifest
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 const FETCH_INIT_CODE = `export async function main(
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 const BASH_INIT_CODE = `# shellcheck shell=bash
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 const DENO_INIT_CODE_TRIGGER = `import * as wmill from "npm:windmill-client@${__pkg__.version}"
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 const BUN_INIT_CODE_TRIGGER = `import * as wmill from "windmill-client"
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 const GO_INIT_CODE_TRIGGER = `package inner
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 const DENO_INIT_CODE_APPROVAL = `import * as wmill from "npm:windmill-client@^1.158.2"
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 const BUN_INIT_CODE_APPROVAL = `import * as wmill from "windmill-client@^1.158.2"
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 const BUN_PREPROCESSOR_MODULE_CODE = `
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 const DENO_PREPROCESSOR_MODULE_CODE = `
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 const PYTHON_INIT_CODE_APPROVAL = `import wmill
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 const PYTHON_PREPROCESSOR_MODULE_CODE = `from typing import TypedDict, Literal
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 const DOCKER_INIT_CODE = `# shellcheck shell=bash
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 const POWERSHELL_INIT_CODE = `param($Msg, $Dflt = "default value", [int]$Nb = 3)
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 const ANSIBLE_PLAYBOOK_INIT_CODE = `---
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.405.0",
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(x: str):\n return x";
2
- export default _default;
@@ -1,5 +0,0 @@
1
- export default `# import wmill
2
-
3
-
4
- def main(x: str):
5
- return x`;
@@ -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]`;