diff --git a/backend/Cargo.lock b/backend/Cargo.lock index de67c5a390..2431ea251c 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -186,22 +186,13 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" -[[package]] -name = "ascii-canvas" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" -dependencies = [ - "term", -] - [[package]] name = "ast_node" version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c09c69dffe06d222d072c878c3afe86eee2179806f20503faec97250268b4c24" dependencies = [ - "pmutil", + "pmutil 0.6.1", "proc-macro2", "quote", "swc_macros_common", @@ -637,21 +628,6 @@ dependencies = [ "syn 2.0.38", ] -[[package]] -name = "bit-set" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - [[package]] name = "bitflags" version = "1.3.2" @@ -805,17 +781,6 @@ dependencies = [ "alloc-stdlib", ] -[[package]] -name = "bstr" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" -dependencies = [ - "lazy_static", - "memchr", - "regex-automata 0.1.10", -] - [[package]] name = "built" version = "0.6.1" @@ -1142,7 +1107,7 @@ checksum = "e2f5ebdc942f57ed96d560a6d1a459bae5851102a25d5bf89dc04ae453e31ecf" dependencies = [ "parse-zoneinfo", "phf 0.11.2", - "phf_codegen 0.11.2", + "phf_codegen", ] [[package]] @@ -1720,7 +1685,7 @@ dependencies = [ "deno-proc-macro-rules", "lazy-regex", "once_cell", - "pmutil", + "pmutil 0.6.1", "proc-macro-crate 1.3.1", "proc-macro2", "quote", @@ -1872,12 +1837,6 @@ dependencies = [ "opaque-debug", ] -[[package]] -name = "diff" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" - [[package]] name = "digest" version = "0.9.0" @@ -2001,12 +1960,15 @@ dependencies = [ ] [[package]] -name = "ena" -version = "0.14.2" +name = "embed-doc-image" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c533630cf40e9caa44bd91aadc88a75d75a4c3a12b4cfde353cbed41daa1e1f1" +checksum = "af36f591236d9d822425cb6896595658fa558fcebf5ee8accac1d4b92c47166e" dependencies = [ - "log", + "base64 0.13.1", + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] @@ -2105,12 +2067,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" -[[package]] -name = "fixedbitset" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" - [[package]] name = "flate2" version = "1.0.28" @@ -2170,7 +2126,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03ec5dc38ee19078d84a692b1c41181ff9f94331c76cee66ff0208c770b5e54f" dependencies = [ - "pmutil", + "pmutil 0.6.1", "proc-macro2", "swc_macros_common", "syn 2.0.38", @@ -2890,6 +2846,19 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +[[package]] +name = "is-macro" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7d079e129b77477a49c5c4f1cfe9ce6c2c909ef52520693e8e811a714c7b20" +dependencies = [ + "Inflector", + "pmutil 0.5.3", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "is-macro" version = "0.3.0" @@ -2897,21 +2866,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4467ed1321b310c2625c5aa6c1b1ffc5de4d9e42668cf697a08fb033ee8265e" dependencies = [ "Inflector", - "pmutil", + "pmutil 0.6.1", "proc-macro2", "quote", "syn 2.0.38", ] [[package]] -name = "is-terminal" -version = "0.4.9" +name = "itertools" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" dependencies = [ - "hermit-abi", - "rustix 0.38.20", - "windows-sys 0.48.0", + "either", ] [[package]] @@ -2970,6 +2937,15 @@ dependencies = [ "simple_asn1", ] +[[package]] +name = "keccak" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +dependencies = [ + "cpufeatures", +] + [[package]] name = "konst" version = "0.2.19" @@ -2994,36 +2970,11 @@ dependencies = [ "log", ] -[[package]] -name = "lalrpop" -version = "0.19.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a1cbf952127589f2851ab2046af368fd20645491bb4b376f04b7f94d7a9837b" -dependencies = [ - "ascii-canvas", - "bit-set", - "diff", - "ena", - "is-terminal", - "itertools 0.10.5", - "lalrpop-util", - "petgraph", - "regex", - "regex-syntax 0.6.29", - "string_cache", - "term", - "tiny-keccak", - "unicode-xid", -] - [[package]] name = "lalrpop-util" -version = "0.19.12" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3c48237b9604c5a4702de6b824e02006c3214327564636aef27c1028a8fa0ed" -dependencies = [ - "regex", -] +checksum = "365d88f9d803538a06641e6736f21d95ecf9226dc1693421212e62c405cdd199" [[package]] name = "lazy-regex" @@ -3254,15 +3205,6 @@ dependencies = [ "hashbrown 0.13.2", ] -[[package]] -name = "lz4_flex" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a8cbbb2831780bc3b9c15a41f5b49222ef756b6730a95f3decfdd15903eb5a3" -dependencies = [ - "twox-hash", -] - [[package]] name = "lzma-sys" version = "0.1.20" @@ -3332,6 +3274,65 @@ dependencies = [ "webpki-roots 0.25.2", ] +[[package]] +name = "malachite" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6cf7f4730c30071ba374fac86ad35b1cb7a0716f774737768667ea3fa1828e3" +dependencies = [ + "malachite-base", + "malachite-nz", + "malachite-q", +] + +[[package]] +name = "malachite-base" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b06bfa98a4b4802af5a4263b4ad4660e28e51e8490f6354eb9336c70767e1c5" +dependencies = [ + "itertools 0.9.0", + "rand 0.7.3", + "rand_chacha 0.2.2", + "ryu", + "sha3", +] + +[[package]] +name = "malachite-bigint" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a5110aee54537b0cef214efbebdd7df79b7408db8eef4f6a4b6db9d0d8fc01b" +dependencies = [ + "derive_more", + "malachite", + "num-integer", + "num-traits", + "paste", +] + +[[package]] +name = "malachite-nz" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89e21c64b7af5be3dc8cef16f786243faf59459fe4ba93b44efdeb264e5ade4" +dependencies = [ + "embed-doc-image", + "itertools 0.9.0", + "malachite-base", +] + +[[package]] +name = "malachite-q" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3755e541d5134b5016594c9043094172c4dda9259b3ce824a7b8101941850360" +dependencies = [ + "itertools 0.9.0", + "malachite-base", + "malachite-nz", +] + [[package]] name = "matchers" version = "0.1.0" @@ -3644,7 +3645,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" dependencies = [ "num-traits", - "serde", ] [[package]] @@ -3941,16 +3941,6 @@ dependencies = [ "ucd-trie", ] -[[package]] -name = "petgraph" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" -dependencies = [ - "fixedbitset", - "indexmap 2.0.2", -] - [[package]] name = "phf" version = "0.10.1" @@ -3972,16 +3962,6 @@ dependencies = [ "phf_shared 0.11.2", ] -[[package]] -name = "phf_codegen" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" -dependencies = [ - "phf_generator 0.10.0", - "phf_shared 0.10.0", -] - [[package]] name = "phf_codegen" version = "0.11.2" @@ -4149,6 +4129,17 @@ version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +[[package]] +name = "pmutil" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3894e5d549cccbe44afecf72922f277f603cd4bb0219c8342631ef18fffbe004" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "pmutil" version = "0.6.1" @@ -5103,58 +5094,61 @@ dependencies = [ [[package]] name = "rustpython-ast" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7b83af38212db64ecfc76b6d53a1c6de89733236e39c69d4bc8ab565ae167b2" +checksum = "fcf9438da3660e6b88bd659fdc0cd13bcff4b85c584026a48b800c75bf0f8d00" dependencies = [ - "num-bigint", - "rustpython-compiler-core", -] - -[[package]] -name = "rustpython-compiler-core" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81870eb757460989d43ce41e069f1a01d0292b33011b23b0455d0a6394e4c77a" -dependencies = [ - "bincode", - "bitflags 1.3.2", - "bstr", - "itertools 0.10.5", - "lz4_flex", - "num-bigint", - "num-complex", - "serde", + "is-macro 0.2.2", + "malachite-bigint", + "rustpython-parser-core", "static_assertions", - "thiserror", ] [[package]] name = "rustpython-parser" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db7348e148144ba85bc1284d97004062137306554fd00e7eb500d91720de5e78" +checksum = "9db993974ff12f33c5be8a801741463691502f85ead5c503277937c4077bd92a" dependencies = [ - "ahash 0.7.6", "anyhow", + "is-macro 0.2.2", "itertools 0.10.5", - "lalrpop", "lalrpop-util", "log", - "num-bigint", + "malachite-bigint", "num-traits", - "phf 0.10.1", - "phf_codegen 0.10.0", + "phf 0.11.2", + "phf_codegen", "rustc-hash", "rustpython-ast", - "rustpython-compiler-core", - "thiserror", + "rustpython-parser-core", "tiny-keccak", "unic-emoji-char", "unic-ucd-ident", "unicode_names2", ] +[[package]] +name = "rustpython-parser-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e9d560c6dd4dc774d4bbad48c770e074c178c4ed5f6fd0521fcdb639af21bdd" +dependencies = [ + "is-macro 0.2.2", + "memchr", + "rustpython-parser-vendored", +] + +[[package]] +name = "rustpython-parser-vendored" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ae3062d7fe5fe38073f3a1c7145ed9a04e15f6e4a596d642c7db2d5cd2b51b" +dependencies = [ + "memchr", + "once_cell", +] + [[package]] name = "rustversion" version = "1.0.14" @@ -5573,6 +5567,18 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "sha3" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "keccak", + "opaque-debug", +] + [[package]] name = "sharded-slab" version = "0.1.7" @@ -6064,7 +6070,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fa4d4f81d7c05b9161f8de839975d3326328b8ba2831164b465524cc2f55252" dependencies = [ - "pmutil", + "pmutil 0.6.1", "proc-macro2", "quote", "swc_macros_common", @@ -6185,7 +6191,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5b5aaca9a0082be4515f0fbbecc191bf5829cd25b5b9c0a2810f6a2bb0d6829" dependencies = [ - "pmutil", + "pmutil 0.6.1", "proc-macro2", "quote", "swc_macros_common", @@ -6199,7 +6205,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7191c8c57af059b75a2aadc927a2608c3962d19e4d09ce8f9c3f03739ddf833" dependencies = [ "bitflags 2.4.1", - "is-macro", + "is-macro 0.3.0", "num-bigint", "scoped-tls", "serde", @@ -6234,7 +6240,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcdff076dccca6cc6a0e0b2a2c8acfb066014382bc6df98ec99e755484814384" dependencies = [ - "pmutil", + "pmutil 0.6.1", "proc-macro2", "quote", "swc_macros_common", @@ -6317,7 +6323,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f59c4b6ed5d78d3ad9fc7c6f8ab4f85bba99573d31d9a2c0a712077a6b45efd2" dependencies = [ - "pmutil", + "pmutil 0.6.1", "proc-macro2", "quote", "swc_macros_common", @@ -6422,7 +6428,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05a95d367e228d52484c53336991fdcf47b6b553ef835d9159db4ba40efb0ee8" dependencies = [ - "pmutil", + "pmutil 0.6.1", "proc-macro2", "quote", "syn 2.0.38", @@ -6434,7 +6440,7 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a273205ccb09b51fabe88c49f3b34c5a4631c4c00a16ae20e03111d6a42e832" dependencies = [ - "pmutil", + "pmutil 0.6.1", "proc-macro2", "quote", "syn 2.0.38", @@ -6457,7 +6463,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f322730fb82f3930a450ac24de8c98523af7d34ab8cb2f46bcb405839891a99" dependencies = [ "Inflector", - "pmutil", + "pmutil 0.6.1", "proc-macro2", "quote", "swc_macros_common", @@ -6544,17 +6550,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "term" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" -dependencies = [ - "dirs-next", - "rustversion", - "winapi", -] - [[package]] name = "termcolor" version = "1.3.0" @@ -6670,7 +6665,7 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tinyvector" version = "0.1.0" -source = "git+https://github.com/windmill-labs/tinyvector#20823b94c20f2b9093f318badd24026cf54dcc85" +source = "git+https://github.com/windmill-labs/tinyvector?rev=20823b94c20f2b9093f318badd24026cf54dcc85#20823b94c20f2b9093f318badd24026cf54dcc85" dependencies = [ "anyhow", "bincode", @@ -7305,9 +7300,9 @@ checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" [[package]] name = "unicode_names2" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "029df4cc8238cefc911704ff8fa210853a0f3bce2694d8f51181dd41ee0f3301" +checksum = "446c96c6dd42604779487f0a981060717156648c1706aa1f464677f03c6cc059" [[package]] name = "unsafe-libyaml" diff --git a/backend/Cargo.toml b/backend/Cargo.toml index e043a42b9b..56b5449714 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -118,7 +118,7 @@ rand = "0.8.5" rand_core = { version = "^0", features = ["std"] } magic-crypt = "^3" git-version = "^0" -rustpython-parser = "0.2.0" +rustpython-parser = "0.3.0" cron = "^0" mail-send = { version = "0.4.0", features = ["builder"], default-features=false } urlencoding = "^2" @@ -190,11 +190,11 @@ postgres-native-tls = "^0" native-tls = "^0" samael = { version = "0.0.12", features = ["xmlsec"] } gcp_auth = "0.9.0" -rust_decimal = { version = "1.31.0", features = ["db-postgres"]} +rust_decimal = { version = "^1", features = ["db-postgres"]} jsonwebtoken = "8.3.0" pem = "3.0.1" nix = { version = "0.27.1", features = ["process", "signal"] } -tinyvector = { git = "https://github.com/windmill-labs/tinyvector" } +tinyvector = { git = "https://github.com/windmill-labs/tinyvector", rev = "20823b94c20f2b9093f318badd24026cf54dcc85" } hf-hub = "0.3.2" tokenizers = "0.14.1" candle-core = "0.3.0" diff --git a/backend/parsers/windmill-parser-py-imports/src/lib.rs b/backend/parsers/windmill-parser-py-imports/src/lib.rs index 52b5289c6a..44650483b2 100644 --- a/backend/parsers/windmill-parser-py-imports/src/lib.rs +++ b/backend/parsers/windmill-parser-py-imports/src/lib.rs @@ -12,12 +12,13 @@ use lazy_static::lazy_static; use phf::phf_map; use regex::Regex; +use rustpython_parser::{ + ast::{Stmt, StmtImport, StmtImportFrom}, + parse_program, +}; use sqlx::{Pool, Postgres}; use windmill_common::error; -use rustpython_parser::ast::{Located, StmtKind}; -use rustpython_parser::parser::parse_program; - const DEF_MAIN: &str = "def main("; static PYTHON_IMPORTS_REPLACEMENT: phf::Map<&'static str, &'static str> = phf_map! { @@ -129,25 +130,29 @@ pub async fn parse_python_imports( let nimports: Vec = ast .into_iter() .filter_map(|x| match x { - Located { node, .. } => match node { - StmtKind::Import { names } => Some( - names - .into_iter() - .map(|x| { - let name = x.node.name; - process_import(Some(name), path, 0) - }) - .flatten() - .collect::>(), - ), - StmtKind::ImportFrom { level: Some(i), module, .. } if i > 0 => { - Some(process_import(module, path, i)) - } - StmtKind::ImportFrom { level: _, module, names: _ } => { - Some(process_import(module, path, 0)) - } - _ => None, - }, + Stmt::Import(StmtImport { names, .. }) => Some( + names + .into_iter() + .map(|x| { + let name = x.name.to_string(); + process_import(Some(name), path, 0) + }) + .flatten() + .collect::>(), + ), + Stmt::ImportFrom(StmtImportFrom { level: Some(i), module, .. }) + if i.to_u32() > 0 => + { + Some(process_import( + module.map(|x| x.to_string()), + path, + i.to_usize(), + )) + } + Stmt::ImportFrom(StmtImportFrom { level: _, module, .. }) => { + Some(process_import(module.map(|x| x.to_string()), path, 0)) + } + _ => None, }) .flatten() .filter(|x| !STDIMPORTS.contains(&x.as_str())) diff --git a/backend/parsers/windmill-parser-py/src/lib.rs b/backend/parsers/windmill-parser-py/src/lib.rs index d4bd08dbdd..85d718104d 100644 --- a/backend/parsers/windmill-parser-py/src/lib.rs +++ b/backend/parsers/windmill-parser-py/src/lib.rs @@ -13,8 +13,10 @@ use itertools::Itertools; use serde_json::json; use windmill_parser::{json_to_typ, Arg, MainArgSignature, Typ}; -use rustpython_parser::ast::{Constant, ExprKind, Located, StmtKind}; -use rustpython_parser::parser::parse_program; +use rustpython_parser::{ + ast::{Constant, Expr, ExprConstant, ExprDict, ExprList, ExprName, Stmt, StmtFunctionDef}, + parse_program, +}; const DEF_MAIN: &str = "def main("; const FUNCTION_CALL: &str = ""; @@ -61,45 +63,50 @@ pub fn parse_python_signature(code: &str) -> anyhow::Result { let ast = parse_program(&filtered_code, "main.py") .map_err(|e| anyhow::anyhow!("Error parsing code: {}", e.to_string()))?; let param = ast.into_iter().find_map(|x| match x { - Located { node: StmtKind::FunctionDef { name, args, .. }, .. } if &name == "main" => { - Some(*args) - } + Stmt::FunctionDef(StmtFunctionDef { name, args, .. }) if &name == "main" => Some(*args), _ => None, }); if let Some(params) = param { //println!("{:?}", params); - let def_arg_start = params.args.len() - params.defaults.len(); + let def_arg_start = params.args.len() - params.defaults().count(); Ok(MainArgSignature { star_args: params.vararg.is_some(), star_kwargs: params.kwarg.is_some(), args: params .args - .into_iter() + .iter() .enumerate() .map(|(i, x)| { - let x = x.node; let default = if i >= def_arg_start { - to_value(¶ms.defaults[i - def_arg_start].node) + params + .defaults() + .nth(i - def_arg_start) + .map(to_value) + .flatten() } else { None }; - let mut typ = x.annotation.map_or(Typ::Unknown, |e| match *e { - Located { node: ExprKind::Name { id, .. }, .. } => match id.as_ref() { - "str" => Typ::Str(None), - "float" => Typ::Float, - "int" => Typ::Int, - "bool" => Typ::Bool, - "dict" => Typ::Object(vec![]), - "list" => Typ::List(Box::new(Typ::Str(None))), - "bytes" => Typ::Bytes, - "datetime" => Typ::Datetime, - "datetime.datetime" => Typ::Datetime, - "Sql" | "sql" => Typ::Sql, - _ => Typ::Resource(id), - }, - _ => Typ::Unknown, - }); + let mut typ = x + .as_arg() + .annotation + .as_ref() + .map_or(Typ::Unknown, |e| match e.as_ref() { + Expr::Name(ExprName { id, .. }) => match id.as_ref() { + "str" => Typ::Str(None), + "float" => Typ::Float, + "int" => Typ::Int, + "bool" => Typ::Bool, + "dict" => Typ::Object(vec![]), + "list" => Typ::List(Box::new(Typ::Str(None))), + "bytes" => Typ::Bytes, + "datetime" => Typ::Datetime, + "datetime.datetime" => Typ::Datetime, + "Sql" | "sql" => Typ::Sql, + _ => Typ::Resource(id.to_string()), + }, + _ => Typ::Unknown, + }); if typ == Typ::Unknown && default.is_some() @@ -108,7 +115,13 @@ pub fn parse_python_signature(code: &str) -> anyhow::Result { typ = json_to_typ(default.as_ref().unwrap()); } - Arg { otyp: None, name: x.arg, typ, has_default: default.is_some(), default } + Arg { + otyp: None, + name: x.as_arg().arg.to_string(), + typ, + has_default: default.is_some(), + default, + } }) .collect(), }) @@ -119,33 +132,33 @@ pub fn parse_python_signature(code: &str) -> anyhow::Result { } } -fn to_value(et: &ExprKind) -> Option { +fn to_value(et: &Expr) -> Option { match et { - ExprKind::Constant { value, .. } => Some(constant_to_value(value)), - ExprKind::Dict { keys, values } => { + Expr::Constant(ExprConstant { value, .. }) => Some(constant_to_value(value)), + Expr::Dict(ExprDict { keys, values, .. }) => { let v = keys .into_iter() .zip(values) .map(|(k, v)| { - let key = to_value(&k.node) + let key = k + .as_ref() + .map(to_value) + .flatten() .and_then(|x| match x { serde_json::Value::String(s) => Some(s), _ => None, }) .unwrap_or_else(|| "no_key".to_string()); - (key, to_value(&v.node)) + (key, to_value(&v)) }) .collect::>(); Some(json!(v)) } - ExprKind::List { elts, .. } => { - let v = elts - .into_iter() - .map(|x| to_value(&x.node)) - .collect::>(); + Expr::List(ExprList { elts, .. }) => { + let v = elts.into_iter().map(|x| to_value(&x)).collect::>(); Some(json!(v)) } - ExprKind::Call { .. } => Some(json!(FUNCTION_CALL)), + Expr::Call { .. } => Some(json!(FUNCTION_CALL)), _ => None, } } diff --git a/backend/parsers/windmill-parser-wasm/pkg/package.json b/backend/parsers/windmill-parser-wasm/pkg/package.json index 995262e043..b2ada6eca7 100644 --- a/backend/parsers/windmill-parser-wasm/pkg/package.json +++ b/backend/parsers/windmill-parser-wasm/pkg/package.json @@ -3,7 +3,7 @@ "collaborators": [ "Ruben Fiszel " ], - "version": "1.186.0", + "version": "1.190.0", "files": [ "windmill_parser_wasm_bg.wasm", "windmill_parser_wasm.js", diff --git a/backend/parsers/windmill-parser-wasm/pkg/windmill_parser_wasm.js b/backend/parsers/windmill-parser-wasm/pkg/windmill_parser_wasm.js index 1f40312a79..cc0c9b8310 100644 --- a/backend/parsers/windmill-parser-wasm/pkg/windmill_parser_wasm.js +++ b/backend/parsers/windmill-parser-wasm/pkg/windmill_parser_wasm.js @@ -106,15 +106,6 @@ function addHeapObject(obj) { return idx; } -let cachedFloat64Memory0 = null; - -function getFloat64Memory0() { - if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) { - cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer); - } - return cachedFloat64Memory0; -} - const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; @@ -124,6 +115,15 @@ function getStringFromWasm0(ptr, len) { return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } +let cachedFloat64Memory0 = null; + +function getFloat64Memory0() { + if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) { + cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer); + } + return cachedFloat64Memory0; +} + let cachedBigInt64Memory0 = null; function getBigInt64Memory0() { @@ -495,10 +495,6 @@ function __wbg_get_imports() { imports.wbg.__wbindgen_object_drop_ref = function(arg0) { takeObject(arg0); }; - imports.wbg.__wbg_eval_4cf9c172060c8b3d = function(arg0, arg1) { - const ret = eval(getStringFromWasm0(arg0, arg1)); - return addHeapObject(ret); - }; imports.wbg.__wbindgen_string_get = function(arg0, arg1) { const obj = getObject(arg1); const ret = typeof(obj) === 'string' ? obj : undefined; @@ -528,6 +524,10 @@ function __wbg_get_imports() { const ret = BigInt.asUintN(64, arg0); return addHeapObject(ret); }; + imports.wbg.__wbindgen_error_new = function(arg0, arg1) { + const ret = new Error(getStringFromWasm0(arg0, arg1)); + return addHeapObject(ret); + }; imports.wbg.__wbindgen_number_get = function(arg0, arg1) { const obj = getObject(arg1); const ret = typeof(obj) === 'number' ? obj : undefined; @@ -543,8 +543,8 @@ function __wbg_get_imports() { const ret = getObject(arg0) in getObject(arg1); return ret; }; - imports.wbg.__wbindgen_error_new = function(arg0, arg1) { - const ret = new Error(getStringFromWasm0(arg0, arg1)); + imports.wbg.__wbg_eval_d090ffdbb4b6658b = function(arg0, arg1) { + const ret = eval(getStringFromWasm0(arg0, arg1)); return addHeapObject(ret); }; imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) { diff --git a/backend/parsers/windmill-parser-wasm/pkg/windmill_parser_wasm_bg.wasm b/backend/parsers/windmill-parser-wasm/pkg/windmill_parser_wasm_bg.wasm index 63db1be65f..3b14273e74 100644 Binary files a/backend/parsers/windmill-parser-wasm/pkg/windmill_parser_wasm_bg.wasm and b/backend/parsers/windmill-parser-wasm/pkg/windmill_parser_wasm_bg.wasm differ diff --git a/benchmarks/pulumi/index.ts b/benchmarks/pulumi/index.ts index dfd9593282..0aa66ebee7 100644 --- a/benchmarks/pulumi/index.ts +++ b/benchmarks/pulumi/index.ts @@ -261,7 +261,7 @@ db.address.apply((address) => { containerDefinitions: JSON.stringify([ { name: "windmill-worker", - image: "ghcr.io/windmill-labs/windmill-ee:main", + image: "ghcr.io/windmill-labs/windmill-ee:latest", cpu: 1024, memory: 1800, essential: true, @@ -312,7 +312,7 @@ db.address.apply((address) => { containerDefinitions: JSON.stringify([ { name: "windmill-worker", - image: "ghcr.io/windmill-labs/windmill-ee:main", + image: "ghcr.io/windmill-labs/windmill-ee:latest", cpu: 1024, memory: 1800, essential: true, @@ -364,7 +364,7 @@ db.address.apply((address) => { containerDefinitions: JSON.stringify([ { name: "windmill-server", - image: "ghcr.io/windmill-labs/windmill-ee:main", + image: "ghcr.io/windmill-labs/windmill-ee:latest", cpu: 1024, memory: 1024, essential: true, @@ -437,7 +437,7 @@ db.address.apply((address) => { const service_worker2 = new aws.ecs.Service("service-worker-2", { cluster: cluster.id, taskDefinition: worker_td2.arn, - desiredCount: 5, + desiredCount: 20, forceNewDeployment: true, orderedPlacementStrategies: [ { diff --git a/frontend/package-lock.json b/frontend/package-lock.json index b57bbfcba9..f3edb040d2 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -47,7 +47,7 @@ "svelte-tiny-virtual-list": "^2.0.5", "tailwind-merge": "^1.13.2", "vscode-ws-jsonrpc": "3.0.0", - "windmill-parser-wasm": "^1.186.0", + "windmill-parser-wasm": "^1.190.0", "y-monaco": "^0.1.4", "y-websocket": "^1.5.0", "yjs": "^13.6.7" @@ -9985,9 +9985,9 @@ } }, "node_modules/windmill-parser-wasm": { - "version": "1.186.0", - "resolved": "https://registry.npmjs.org/windmill-parser-wasm/-/windmill-parser-wasm-1.186.0.tgz", - "integrity": "sha512-xoeGloTQHl54WWp97rmy94Us6bzY4ckU+Y7+f4NcR4l9DG9XpzsHQrjwzZH1Ak9zM91oIQDdgTBZkrAsZ5N97w==" + "version": "1.190.0", + "resolved": "https://registry.npmjs.org/windmill-parser-wasm/-/windmill-parser-wasm-1.190.0.tgz", + "integrity": "sha512-E2VUFVfsL2pHyaElUM8pK4aoV3KKTY50e1UZY14oKnQRmtYYrjxYfFFlOoFVbPyT29AyWws7ZXEt6M1qb8MwUw==" }, "node_modules/wordwrap": { "version": "1.0.0", @@ -17080,9 +17080,9 @@ } }, "windmill-parser-wasm": { - "version": "1.186.0", - "resolved": "https://registry.npmjs.org/windmill-parser-wasm/-/windmill-parser-wasm-1.186.0.tgz", - "integrity": "sha512-xoeGloTQHl54WWp97rmy94Us6bzY4ckU+Y7+f4NcR4l9DG9XpzsHQrjwzZH1Ak9zM91oIQDdgTBZkrAsZ5N97w==" + "version": "1.190.0", + "resolved": "https://registry.npmjs.org/windmill-parser-wasm/-/windmill-parser-wasm-1.190.0.tgz", + "integrity": "sha512-E2VUFVfsL2pHyaElUM8pK4aoV3KKTY50e1UZY14oKnQRmtYYrjxYfFFlOoFVbPyT29AyWws7ZXEt6M1qb8MwUw==" }, "wordwrap": { "version": "1.0.0", diff --git a/frontend/package.json b/frontend/package.json index 82987b03c1..0dea31b906 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -125,7 +125,7 @@ "svelte-tiny-virtual-list": "^2.0.5", "tailwind-merge": "^1.13.2", "vscode-ws-jsonrpc": "3.0.0", - "windmill-parser-wasm": "^1.186.0", + "windmill-parser-wasm": "^1.190.0", "y-monaco": "^0.1.4", "y-websocket": "^1.5.0", "yjs": "^13.6.7"