diff --git a/CHANGELOG.md b/CHANGELOG.md index dcf9f6a2a8..0d8316803f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [1.399.0](https://github.com/windmill-labs/windmill/compare/v1.398.1...v1.399.0) (2024-09-25) + + +### Features + +* add tag filtering to external JWT authentication ([#4425](https://github.com/windmill-labs/windmill/issues/4425)) ([590321f](https://github.com/windmill-labs/windmill/commit/590321fd3c88046a657e0a751b62a19424102060)) + + +### Bug Fixes + +* **cli:** version the whole client for deno compatibility ([81c2bb0](https://github.com/windmill-labs/windmill/commit/81c2bb069176a95b8fb9c52b31e5e03c1cc78afc)) +* correct AI generation for CRON and regex ([#4437](https://github.com/windmill-labs/windmill/issues/4437)) ([aeb5b5b](https://github.com/windmill-labs/windmill/commit/aeb5b5bcd163e2e7d1413d7e4aed8bd769996f24)) + ## [1.398.1](https://github.com/windmill-labs/windmill/compare/v1.398.0...v1.398.1) (2024-09-23) diff --git a/backend/.sqlx/query-0e52a588f3edeb8fb58d6d62247b8590e51171e2811c62737bdb81fb0ac8f182.json b/backend/.sqlx/query-0e52a588f3edeb8fb58d6d62247b8590e51171e2811c62737bdb81fb0ac8f182.json new file mode 100644 index 0000000000..f23cf3f710 --- /dev/null +++ b/backend/.sqlx/query-0e52a588f3edeb8fb58d6d62247b8590e51171e2811c62737bdb81fb0ac8f182.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE worker_ping SET \n ping_at = now(), \n jobs_executed = 1, \n current_job_id = $1, \n current_job_workspace_id = 'admins' \n WHERE worker = $2", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Text" + ] + }, + "nullable": [] + }, + "hash": "0e52a588f3edeb8fb58d6d62247b8590e51171e2811c62737bdb81fb0ac8f182" +} diff --git a/backend/Cargo.lock b/backend/Cargo.lock index dfa5b71823..a0eec388cd 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -696,9 +696,9 @@ checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.82" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", @@ -4670,9 +4670,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.158" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "libgit2-sys" @@ -4710,7 +4710,7 @@ checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ "bitflags 2.6.0", "libc", - "redox_syscall 0.5.4", + "redox_syscall 0.5.5", ] [[package]] @@ -5672,7 +5672,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.4", + "redox_syscall 0.5.5", "smallvec", "windows-targets 0.52.6", ] @@ -6120,7 +6120,7 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" dependencies = [ - "toml_edit 0.22.21", + "toml_edit 0.22.22", ] [[package]] @@ -6623,9 +6623,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" +checksum = "62871f2d65009c0256aed1b9cfeeb8ac272833c404e13d53d400cd0dad7a2ac0" dependencies = [ "bitflags 2.6.0", ] @@ -9019,9 +9019,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tar" -version = "0.4.41" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb797dad5fb5b76fcf519e702f4a589483b5ef06567f160c392832c1f5e44909" +checksum = "4ff6c40d3aedb5e06b57c6f669ad17ab063dd1e63d977c6a88e7f4dfa4f04020" dependencies = [ "filetime", "libc", @@ -9433,7 +9433,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.21", + "toml_edit 0.22.22", ] [[package]] @@ -9460,15 +9460,15 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.21" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b072cee73c449a636ffd6f32bd8de3a9f7119139aff882f44943ce2986dc5cf" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap 2.5.0", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.18", + "winnow 0.6.19", ] [[package]] @@ -10382,7 +10382,7 @@ version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "372d5b87f58ec45c384ba03563b03544dc5fadc3983e434b286913f5b4a9bb6d" dependencies = [ - "redox_syscall 0.5.4", + "redox_syscall 0.5.5", "wasite", "web-sys", ] @@ -10426,7 +10426,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windmill" -version = "1.398.1" +version = "1.399.0" dependencies = [ "anyhow", "axum", @@ -10468,7 +10468,7 @@ dependencies = [ [[package]] name = "windmill-api" -version = "1.398.1" +version = "1.399.0" dependencies = [ "anyhow", "argon2", @@ -10553,7 +10553,7 @@ dependencies = [ [[package]] name = "windmill-api-client" -version = "1.398.1" +version = "1.399.0" dependencies = [ "base64 0.21.7", "chrono", @@ -10571,7 +10571,7 @@ dependencies = [ [[package]] name = "windmill-audit" -version = "1.398.1" +version = "1.399.0" dependencies = [ "chrono", "serde", @@ -10584,7 +10584,7 @@ dependencies = [ [[package]] name = "windmill-common" -version = "1.398.1" +version = "1.399.0" dependencies = [ "anyhow", "async-stream", @@ -10628,7 +10628,7 @@ dependencies = [ [[package]] name = "windmill-git-sync" -version = "1.398.1" +version = "1.399.0" dependencies = [ "regex", "rsmq_async", @@ -10643,7 +10643,7 @@ dependencies = [ [[package]] name = "windmill-indexer" -version = "1.398.1" +version = "1.399.0" dependencies = [ "anyhow", "bytes", @@ -10664,7 +10664,7 @@ dependencies = [ [[package]] name = "windmill-parser" -version = "1.398.1" +version = "1.399.0" dependencies = [ "convert_case 0.6.0", "serde", @@ -10673,7 +10673,7 @@ dependencies = [ [[package]] name = "windmill-parser-bash" -version = "1.398.1" +version = "1.399.0" dependencies = [ "anyhow", "lazy_static", @@ -10685,7 +10685,7 @@ dependencies = [ [[package]] name = "windmill-parser-go" -version = "1.398.1" +version = "1.399.0" dependencies = [ "anyhow", "gosyn", @@ -10697,7 +10697,7 @@ dependencies = [ [[package]] name = "windmill-parser-graphql" -version = "1.398.1" +version = "1.399.0" dependencies = [ "anyhow", "lazy_static", @@ -10709,7 +10709,7 @@ dependencies = [ [[package]] name = "windmill-parser-php" -version = "1.398.1" +version = "1.399.0" dependencies = [ "anyhow", "itertools 0.13.0", @@ -10720,7 +10720,7 @@ dependencies = [ [[package]] name = "windmill-parser-py" -version = "1.398.1" +version = "1.399.0" dependencies = [ "anyhow", "itertools 0.13.0", @@ -10731,7 +10731,7 @@ dependencies = [ [[package]] name = "windmill-parser-py-imports" -version = "1.398.1" +version = "1.399.0" dependencies = [ "anyhow", "async-recursion", @@ -10749,7 +10749,7 @@ dependencies = [ [[package]] name = "windmill-parser-rust" -version = "1.398.1" +version = "1.399.0" dependencies = [ "anyhow", "convert_case 0.6.0", @@ -10766,7 +10766,7 @@ dependencies = [ [[package]] name = "windmill-parser-sql" -version = "1.398.1" +version = "1.399.0" dependencies = [ "anyhow", "lazy_static", @@ -10778,7 +10778,7 @@ dependencies = [ [[package]] name = "windmill-parser-ts" -version = "1.398.1" +version = "1.399.0" dependencies = [ "anyhow", "lazy_static", @@ -10796,7 +10796,7 @@ dependencies = [ [[package]] name = "windmill-parser-wasm" -version = "1.398.1" +version = "1.399.0" dependencies = [ "anyhow", "getrandom 0.2.15", @@ -10817,7 +10817,7 @@ dependencies = [ [[package]] name = "windmill-parser-yaml" -version = "1.398.1" +version = "1.399.0" dependencies = [ "anyhow", "serde_json", @@ -10827,7 +10827,7 @@ dependencies = [ [[package]] name = "windmill-queue" -version = "1.398.1" +version = "1.399.0" dependencies = [ "anyhow", "async-recursion", @@ -10860,7 +10860,7 @@ dependencies = [ [[package]] name = "windmill-sql-datatype-parser-wasm" -version = "1.398.1" +version = "1.399.0" dependencies = [ "wasm-bindgen", "wasm-bindgen-test", @@ -10870,7 +10870,7 @@ dependencies = [ [[package]] name = "windmill-worker" -version = "1.398.1" +version = "1.399.0" dependencies = [ "anyhow", "async-recursion", @@ -11142,9 +11142,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.18" +version = "0.6.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +checksum = "c52ac009d615e79296318c1bcce2d422aaca15ad08515e344feeda07df67a587" dependencies = [ "memchr", ] diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 2f04b941b1..7c6c77b380 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "windmill" -version = "1.398.1" +version = "1.399.0" authors.workspace = true edition.workspace = true @@ -27,7 +27,7 @@ members = [ ] [workspace.package] -version = "1.398.1" +version = "1.399.0" authors = ["Ruben Fiszel "] edition = "2021" diff --git a/backend/ee-repo-ref.txt b/backend/ee-repo-ref.txt index 531e0c3b9b..994e59747a 100644 --- a/backend/ee-repo-ref.txt +++ b/backend/ee-repo-ref.txt @@ -1 +1 @@ -e093d51a219ce4ff0562a02db24ec402554a1f05 \ No newline at end of file +3d37b6c31155265d8d026ae9d6ced0b433078f87 \ No newline at end of file diff --git a/backend/parsers/windmill-parser-wasm/publish-pkgs.sh b/backend/parsers/windmill-parser-wasm/publish-pkgs.sh index 7e2fd8beb2..c2f2c0d7ad 100755 --- a/backend/parsers/windmill-parser-wasm/publish-pkgs.sh +++ b/backend/parsers/windmill-parser-wasm/publish-pkgs.sh @@ -21,3 +21,6 @@ popd pushd "pkg-rust" && npm publish ${args} popd + +pushd "pkg-yaml" && npm publish ${args} +popd diff --git a/backend/parsers/windmill-parser-yaml/src/lib.rs b/backend/parsers/windmill-parser-yaml/src/lib.rs index 8c7068c54a..151d6eb562 100644 --- a/backend/parsers/windmill-parser-yaml/src/lib.rs +++ b/backend/parsers/windmill-parser-yaml/src/lib.rs @@ -25,14 +25,19 @@ pub fn parse_ansible_sig(inner_content: &str) -> anyhow::Result anyhow::Result Option { + if let Yaml::Hash(arg) = arg { + if let Some(def) = arg.get(&Yaml::String("default".to_string())) { + if let Some(Yaml::String(typ)) = arg.get(&Yaml::String("type".to_string())) { + if let Yaml::String(path) = def { + if typ.as_str() == "windmill_resource" { + return Some(serde_json::Value::String(format!("$res:{}", path))); + } + } + } + return Some(yaml_to_json(def)); + } + } + None +} + +enum ArgTyp { + Typ(Typ), + StaticVar(String), + StaticResource(String), +} + +fn parse_ansible_arg_typ(arg: &Yaml) -> ArgTyp { + if let Yaml::Hash(a) = arg { + if let Some(Yaml::String(typ)) = a.get(&Yaml::String("type".to_string())) { + if typ.as_str() == "windmill_variable" { + if let Some(Yaml::String(variable_path)) = + a.get(&Yaml::String("variable".to_string())) + { + return ArgTyp::StaticVar(variable_path.to_string()); + } + } + if typ.as_str() == "windmill_resource" { + if let Some(Yaml::String(resource_path)) = + a.get(&Yaml::String("resource".to_string())) + { + return ArgTyp::StaticResource(resource_path.to_string()); + } + } + } + } + ArgTyp::Typ(parse_ansible_typ(arg)) +} + fn parse_ansible_typ(arg: &Yaml) -> Typ { if let Yaml::Hash(arg) = arg { if let Some(Yaml::String(typ)) = arg.get(&Yaml::String("type".to_string())) { @@ -127,7 +176,19 @@ fn parse_ansible_typ(arg: &Yaml) -> Typ { } } -#[derive(Debug)] +#[derive(Debug, Clone)] +pub struct AnsiblePlaybookOptions { + // There are a lot more options + // TODO: Add the options as customers require them + // Add it here and then on the executors cmd_options + pub verbosity: Option, + pub forks: Option, + pub timeout: Option, + pub flush_cache: Option<()>, + pub force_handlers: Option<()>, +} + +#[derive(Debug, Clone)] pub struct FileResource { pub resource_path: String, pub target_path: String, @@ -140,12 +201,15 @@ pub struct AnsibleInventory { resource_type: Option, pub pinned_resource: Option, } -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct AnsibleRequirements { pub python_reqs: Vec, pub collections: Option, pub file_resources: Vec, pub inventories: Vec, + pub vars: Vec<(String, String)>, + pub resources: Vec<(String, String)>, + pub options: AnsiblePlaybookOptions, } fn parse_inventories(inventory_yaml: &Yaml) -> anyhow::Result> { @@ -204,11 +268,21 @@ pub fn parse_ansible_reqs( return Ok((logs, None, inner_content.to_string())); } + let opts = AnsiblePlaybookOptions { + verbosity: None, + forks: None, + timeout: None, + flush_cache: None, + force_handlers: None, + }; let mut ret = AnsibleRequirements { python_reqs: vec![], collections: None, file_resources: vec![], inventories: vec![], + vars: vec![], + resources: vec![], + options: opts, }; if let Yaml::Hash(doc) = &docs[0] { @@ -242,10 +316,33 @@ pub fn parse_ansible_reqs( ret.file_resources.append(&mut resources?); } } - Yaml::String(key) if key == "extra_vars" => {} + Yaml::String(key) if key == "extra_vars" => { + if let Yaml::Hash(v) = &value { + for (key, arg) in v { + if let Yaml::String(arg_name) = key { + match parse_ansible_arg_typ(arg) { + ArgTyp::StaticVar(p) => { + ret.vars + .push((arg_name.to_string(), format!("$var:{}", p))); + } + ArgTyp::StaticResource(p) => { + ret.resources + .push((arg_name.to_string(), format!("$res:{}", p))); + } + ArgTyp::Typ(_) => (), + } + } + } + } + } Yaml::String(key) if key == "inventory" => { ret.inventories = parse_inventories(value)?; } + Yaml::String(key) if key == "options" => { + if let Yaml::Array(opts) = &value { + ret.options = parse_ansible_options(opts); + } + } Yaml::String(key) => logs.push_str(&format!("\nUnknown field `{}`. Ignoring", key)), _ => (), } @@ -260,6 +357,82 @@ pub fn parse_ansible_reqs( Ok((logs, Some(ret), out_str)) } +fn parse_ansible_options(opts: &Vec) -> AnsiblePlaybookOptions { + let mut ret = AnsiblePlaybookOptions { + verbosity: None, + forks: None, + timeout: None, + flush_cache: None, + force_handlers: None, + }; + for opt in opts { + if let Yaml::String(o) = opt { + match o.as_str() { + "flush_cache" => { + ret.flush_cache = Some(()); + } + "force_handlers" => { + ret.force_handlers = Some(()); + } + s if count_consecutive_vs(s) > 0 => { + ret.verbosity = Some("v".repeat(count_consecutive_vs(s).min(6))); + } + _ => (), + } + } + if let Yaml::Hash(m) = opt { + if let Some((Yaml::String(name), value)) = m.iter().last() { + match name.as_str() { + "forks" => { + if let Yaml::Integer(count) = value { + ret.forks = Some(*count); + } + } + "timeout" => { + if let Yaml::Integer(timeout) = value { + ret.timeout = Some(*timeout); + } + } + "verbosity" => { + if let Yaml::String(verbosity) = value { + let c = count_consecutive_vs(verbosity); + if c > 0 && c <= 6 { + ret.verbosity = Some("v".repeat(c.min(6))); + } + + } + } + _ => () + + } + } + + + } + } + + ret +} + +fn count_consecutive_vs(s: &str) -> usize { + let mut max_count = 0; + let mut current_count = 0; + + for c in s.chars() { + if c == 'v' { + current_count += 1; + if current_count == 6 { + return 6; // Stop early if we reach 6 + } + } else { + current_count = 0; // Reset count if the character is not 'v' + } + max_count = max_count.max(current_count); + } + + max_count +} + fn parse_file_resource(yaml: &Yaml) -> anyhow::Result { if let Yaml::Hash(f) = yaml { if let Some(Yaml::String(resource_path)) = f.get(&Yaml::String("resource".to_string())) { @@ -279,3 +452,31 @@ fn parse_file_resource(yaml: &Yaml) -> anyhow::Result { } return Err(anyhow!("Invalid file resource: Should be a dictionary.")); } + +fn yaml_to_json(yaml: &Yaml) -> serde_json::Value { + match yaml { + Yaml::Array(arr) => { + let json_array: Vec = arr.into_iter().map(yaml_to_json).collect(); + serde_json::Value::Array(json_array) + } + Yaml::Hash(hash) => { + let json_object = hash + .into_iter() + .map(|(k, v)| { + let key = match k { + Yaml::String(s) => s.clone(), + _ => k.as_str().unwrap_or("").to_string(), + }; + (key, yaml_to_json(v)) + }) + .collect(); + serde_json::Value::Object(json_object) + } + Yaml::String(s) => serde_json::Value::String(s.to_string()), + Yaml::Integer(i) => serde_json::Value::Number(i.clone().into()), + Yaml::Real(r) => serde_json::Value::Number(r.parse().unwrap_or(0.into())), + Yaml::Boolean(b) => serde_json::Value::Bool(*b), + Yaml::Null => serde_json::Value::Null, + _ => serde_json::Value::Null, + } +} diff --git a/backend/tests/worker.rs b/backend/tests/worker.rs index e92578b02f..e97c53700a 100644 --- a/backend/tests/worker.rs +++ b/backend/tests/worker.rs @@ -1912,6 +1912,109 @@ def main(): assert_eq!(result, serde_json::json!("test-workspace")); } +#[sqlx::test(fixtures("base"))] +async fn test_bun_job_datetime(db: Pool) { + initialize_tracing().await; + let server = ApiServer::start(db.clone()).await; + let port = server.addr.port(); + + let content = r#" +export async function main(a: Date) { + return typeof a; +} + "# + .to_owned(); + + let result = RunJob::from(JobPayload::Code(RawCode { + hash: None, + content, + path: None, + lock: None, + language: ScriptLang::Bun, + custom_concurrency_key: None, + concurrent_limit: None, + concurrency_time_window_s: None, + cache_ttl: None, + dedicated_worker: None, + })) + .arg("a", json!("2024-09-24T10:00:00.000Z")) + .run_until_complete(&db, port) + .await + .json_result() + .unwrap(); + + assert_eq!(result, serde_json::json!("object")); +} + +#[sqlx::test(fixtures("base"))] +async fn test_deno_job_datetime(db: Pool) { + initialize_tracing().await; + let server = ApiServer::start(db.clone()).await; + let port = server.addr.port(); + + let content = r#" +export async function main(a: Date) { + return typeof a; +} + "# + .to_owned(); + + let result = RunJob::from(JobPayload::Code(RawCode { + hash: None, + content, + path: None, + lock: None, + language: ScriptLang::Deno, + custom_concurrency_key: None, + concurrent_limit: None, + concurrency_time_window_s: None, + cache_ttl: None, + dedicated_worker: None, + })) + .arg("a", json!("2024-09-24T10:00:00.000Z")) + .run_until_complete(&db, port) + .await + .json_result() + .unwrap(); + + assert_eq!(result, serde_json::json!("object")); +} + +#[sqlx::test(fixtures("base"))] +async fn test_python_job_datetime_and_bytes(db: Pool) { + initialize_tracing().await; + let server = ApiServer::start(db.clone()).await; + let port = server.addr.port(); + + let content = r#" +from datetime import datetime +def main(a: datetime, b: bytes): + return (isinstance(a, datetime), isinstance(b, bytes)) + "# + .to_owned(); + + let result = RunJob::from(JobPayload::Code(RawCode { + hash: None, + content, + path: None, + lock: None, + language: ScriptLang::Python3, + custom_concurrency_key: None, + concurrent_limit: None, + concurrency_time_window_s: None, + cache_ttl: None, + dedicated_worker: None, + })) + .arg("a", json!("2024-09-24T10:00:00.000Z")) + .arg("b", json!("dGVzdA==")) + .run_until_complete(&db, port) + .await + .json_result() + .unwrap(); + + assert_eq!(result, serde_json::json!([true, true])); +} + #[sqlx::test(fixtures("base"))] async fn test_empty_loop_1(db: Pool) { initialize_tracing().await; diff --git a/backend/windmill-api/openapi.yaml b/backend/windmill-api/openapi.yaml index 217fd46daf..b7e2459135 100644 --- a/backend/windmill-api/openapi.yaml +++ b/backend/windmill-api/openapi.yaml @@ -1,7 +1,7 @@ openapi: "3.0.3" info: - version: 1.398.1 + version: 1.399.0 title: Windmill API contact: diff --git a/backend/windmill-api/src/concurrency_groups.rs b/backend/windmill-api/src/concurrency_groups.rs index 9510dec475..945df75573 100644 --- a/backend/windmill-api/src/concurrency_groups.rs +++ b/backend/windmill-api/src/concurrency_groups.rs @@ -144,7 +144,7 @@ async fn get_concurrent_intervals( Query(iq): Query, Query(lq): Query, ) -> JsonResult { - check_scopes(&authed, || format!("listjobs"))?; + check_scopes(&authed, || format!("jobs:listjobs"))?; if lq.success.is_some() && lq.running.is_some_and(|x| x) { return Err(error::Error::BadRequest( diff --git a/backend/windmill-api/src/jobs.rs b/backend/windmill-api/src/jobs.rs index 21b4ee16db..c43d2935e3 100644 --- a/backend/windmill-api/src/jobs.rs +++ b/backend/windmill-api/src/jobs.rs @@ -33,6 +33,7 @@ use crate::add_webhook_allowed_origin; use crate::concurrency_groups::join_concurrency_key; use crate::db::ApiAuthed; +use crate::users::get_scope_tags; use crate::utils::content_plain; use crate::{ db::DB, @@ -1248,13 +1249,18 @@ pub fn list_queue_jobs_query( lq: &ListQueueQuery, fields: &[&str], join_outstanding_wait_times: bool, + tags: Option>, ) -> SqlBuilder { - let sqlb = SqlBuilder::select_from("queue") + let mut sqlb = SqlBuilder::select_from("queue") .fields(fields) .order_by("created_at", lq.order_desc.unwrap_or(true)) .limit(1000) .clone(); + if let Some(tags) = tags { + sqlb.and_where_in("tag", &tags.iter().map(|x| quote(x)).collect::>()); + } + filter_list_queue_query(sqlb, lq, w_id, join_outstanding_wait_times) } @@ -1310,6 +1316,7 @@ async fn list_queue_jobs( "workspace_id", ], false, + get_scope_tags(&authed), ) .sql()?; let mut tx = user_db.begin(&authed).await?; @@ -1498,6 +1505,10 @@ async fn list_filtered_uuids( sqlb.and_where_is_null("schedule_path"); + if let Some(tags) = get_scope_tags(&authed) { + sqlb.and_where_in("tag", &tags.iter().map(|x| quote(x)).collect::>()); + } + sqlb = filter_list_queue_query(sqlb, &lq, w_id.as_str(), false); let sql = sqlb.query()?; @@ -1557,7 +1568,7 @@ async fn list_jobs( Query(lq): Query, Extension(_api_list_jobs_query_duration): Extension>, ) -> error::JsonResult> { - check_scopes(&authed, || format!("listjobs"))?; + check_scopes(&authed, || format!("jobs:listjobs"))?; let (per_page, offset) = paginate(pagination); let lqc = lq.clone(); @@ -1575,6 +1586,7 @@ async fn list_jobs( &ListCompletedQuery { order_desc: Some(true), ..lqc }, UnifiedJob::completed_job_fields(), true, + get_scope_tags(&authed), )) } else { None @@ -1590,6 +1602,7 @@ async fn list_jobs( &ListQueueQuery { order_desc: Some(true), ..lq.into() }, UnifiedJob::queued_job_fields(), true, + get_scope_tags(&authed), ); if let Some(sqlc) = sqlc { @@ -1640,7 +1653,7 @@ pub async fn resume_suspended_flow_as_owner( Path((_w_id, flow_id)): Path<(String, Uuid)>, QueryOrBody(value): QueryOrBody, ) -> error::Result { - check_scopes(&authed, || format!("resumeflow"))?; + check_scopes(&authed, || format!("jobs:resumeflow"))?; let value = value.unwrap_or(serde_json::Value::Null); let mut tx = db.begin().await?; @@ -3847,7 +3860,7 @@ async fn run_preview_script( #[cfg(feature = "enterprise")] check_license_key_valid().await?; - check_scopes(&authed, || format!("runscript"))?; + check_scopes(&authed, || format!("jobs:runscript"))?; if authed.is_operator { return Err(error::Error::NotAuthorized( "Operators cannot run preview jobs for security reasons".to_string(), @@ -3917,7 +3930,7 @@ async fn run_bundle_preview_script( check_license_key_valid().await?; - check_scopes(&authed, || format!("runscript"))?; + check_scopes(&authed, || format!("jobs:runscript"))?; if authed.is_operator { return Err(error::Error::NotAuthorized( "Operators cannot run preview jobs for security reasons".to_string(), @@ -4403,7 +4416,7 @@ async fn run_preview_flow_job( Query(run_query): Query, Json(raw_flow): Json, ) -> error::Result<(StatusCode, String)> { - check_scopes(&authed, || format!("runflow"))?; + check_scopes(&authed, || format!("jobs:runflow"))?; if authed.is_operator { return Err(error::Error::NotAuthorized( "Operators cannot run preview jobs for security reasons".to_string(), @@ -4843,14 +4856,19 @@ pub fn list_completed_jobs_query( lq: &ListCompletedQuery, fields: &[&str], join_outstanding_wait_times: bool, + tags: Option>, ) -> SqlBuilder { - let sqlb = SqlBuilder::select_from("completed_job") + let mut sqlb = SqlBuilder::select_from("completed_job") .fields(fields) .order_by("created_at", lq.order_desc.unwrap_or(true)) .offset(offset) .limit(per_page) .clone(); + if let Some(tags) = tags { + sqlb.and_where_in("tag", &tags.iter().map(|x| quote(x)).collect::>()); + } + filter_list_completed_query(sqlb, lq, w_id, join_outstanding_wait_times) } #[derive(Deserialize, Clone)] @@ -4895,7 +4913,7 @@ async fn list_completed_jobs( Query(pagination): Query, Query(lq): Query, ) -> error::JsonResult> { - check_scopes(&authed, || format!("listjobs"))?; + check_scopes(&authed, || format!("jobs:listjobs"))?; let (per_page, offset) = paginate(pagination); @@ -4937,6 +4955,7 @@ async fn list_completed_jobs( "'CompletedJob' as type", ], false, + get_scope_tags(&authed), ) .sql()?; let mut tx = user_db.begin(&authed).await?; @@ -5161,7 +5180,7 @@ async fn delete_completed_job<'a>( Extension(user_db): Extension, Path((w_id, id)): Path<(String, Uuid)>, ) -> error::Result { - check_scopes(&authed, || format!("deletejob"))?; + check_scopes(&authed, || format!("jobs:deletejob"))?; let mut tx = user_db.begin(&authed).await?; diff --git a/backend/windmill-api/src/users.rs b/backend/windmill-api/src/users.rs index 7be613a93e..596e1f1d20 100644 --- a/backend/windmill-api/src/users.rs +++ b/backend/windmill-api/src/users.rs @@ -651,9 +651,12 @@ where { if let Some(authed) = cache.get_authed(workspace_id.clone(), &token).await { parts.extensions.insert(authed.clone()); - if authed.scopes.is_some() - && (path_vec.len() < 3 - || (path_vec[4] != "jobs" && path_vec[4] != "jobs_u")) + if authed.scopes.as_ref().is_some_and(|scopes| { + scopes + .iter() + .any(|s| s.starts_with("jobs:") || s.starts_with("run:")) + }) && (path_vec.len() < 3 + || (path_vec[4] != "jobs" && path_vec[4] != "jobs_u")) { BRUTE_FORCE_COUNTER.increment().await; return Err(( @@ -681,15 +684,30 @@ pub fn check_scopes(authed: &ApiAuthed, required: F) -> error::Result<()> where F: FnOnce() -> String, { - if let Some(scopes) = &authed.scopes { + if authed.scopes.as_ref().is_some_and(|scopes| { + scopes + .iter() + .any(|s| s.starts_with("jobs:") || s.starts_with("run:")) + }) { let req = &required(); - if !scopes.contains(req) { + if !authed.scopes.as_ref().unwrap().contains(req) { return Err(Error::BadRequest(format!("missing required scope: {req}"))); } } Ok(()) } +pub fn get_scope_tags(authed: &ApiAuthed) -> Option> { + authed + .scopes + .as_ref()? + .iter() + .find_map(|s| match s.split(":").collect::>().as_slice() { + ["if_jobs", "filter_tags", tags] => Some(tags.split(",").collect::>()), + _ => None, + }) +} + #[derive(Clone, Debug)] pub struct OptAuthed(pub Option); diff --git a/backend/windmill-api/src/workspaces.rs b/backend/windmill-api/src/workspaces.rs index 7306063856..685286d750 100644 --- a/backend/windmill-api/src/workspaces.rs +++ b/backend/windmill-api/src/workspaces.rs @@ -2577,7 +2577,7 @@ async fn tarball_workspace( } ScriptLang::Php => "php", ScriptLang::Rust => "rs", - ScriptLang::Ansible => "yaml", + ScriptLang::Ansible => "playbook.yml", }; archive .write_to_archive(&script.content, &format!("{}.{}", script.path, ext)) diff --git a/backend/windmill-common/src/auth.rs b/backend/windmill-common/src/auth.rs index ea1c2fe10a..22cdd4d52a 100644 --- a/backend/windmill-common/src/auth.rs +++ b/backend/windmill-common/src/auth.rs @@ -25,6 +25,7 @@ pub struct JWTAuthClaims { pub workspace_id: String, pub exp: usize, pub job_id: Option, + pub scopes: Option>, } #[derive(Deserialize)] diff --git a/backend/windmill-common/src/ee.rs b/backend/windmill-common/src/ee.rs index 482b61a0fe..2f32756e45 100644 --- a/backend/windmill-common/src/ee.rs +++ b/backend/windmill-common/src/ee.rs @@ -26,7 +26,10 @@ pub async fn get_license_plan() -> LicensePlan { #[derive(Deserialize)] #[serde(untagged)] -pub enum CriticalErrorChannel {} +pub enum CriticalErrorChannel { + Email { email: String }, + Slack { slack_channel: String }, +} pub enum CriticalAlertKind { #[cfg(feature = "enterprise")] diff --git a/backend/windmill-queue/src/jobs.rs b/backend/windmill-queue/src/jobs.rs index 68f415e7cf..ec2e688871 100644 --- a/backend/windmill-queue/src/jobs.rs +++ b/backend/windmill-queue/src/jobs.rs @@ -475,6 +475,11 @@ where } } +#[derive(Deserialize)] +struct RawFlowFailureModule { + failure_module: Option>, +} + #[instrument(level = "trace", skip_all)] pub async fn add_completed_job_error( db: &Pool, @@ -922,7 +927,17 @@ pub async fn add_completed_job< ) .await; } else if !skip_downstream_error_handlers - && matches!(queued_job.job_kind, JobKind::Flow | JobKind::Script) + && (matches!(queued_job.job_kind, JobKind::Script) + || matches!(queued_job.job_kind, JobKind::Flow) + && queued_job + .raw_flow + .as_ref() + .and_then(|v| { + serde_json::from_str::((**v).get()) + .ok() + .and_then(|v| v.failure_module) + }) + .is_none()) && queued_job.parent_job.is_none() { let result = serde_json::from_str( diff --git a/backend/windmill-worker/src/ansible_executor.rs b/backend/windmill-worker/src/ansible_executor.rs index 5130a41614..297458633a 100644 --- a/backend/windmill-worker/src/ansible_executor.rs +++ b/backend/windmill-worker/src/ansible_executor.rs @@ -1,5 +1,8 @@ use std::{ - collections::HashMap, os::unix::fs::PermissionsExt, path::{Path, PathBuf}, process::Stdio + collections::HashMap, + os::unix::fs::PermissionsExt, + path::{Path, PathBuf}, + process::Stdio, }; use anyhow::anyhow; @@ -10,16 +13,20 @@ use uuid::Uuid; use windmill_common::{ error, jobs::QueuedJob, - worker::{write_file, write_file_at_user_defined_location, WORKER_CONFIG}, + worker::{to_raw_value, write_file, write_file_at_user_defined_location, WORKER_CONFIG}, }; use windmill_parser_yaml::AnsibleRequirements; use windmill_queue::{append_logs, CanceledBy}; use crate::{ - bash_executor::BIN_BASH, common::{ + bash_executor::BIN_BASH, + common::{ get_reserved_variables, handle_child, read_and_check_result, start_child_process, transform_json, - }, python_executor::{create_dependencies_dir, handle_python_reqs, pip_compile}, AuthedClientBackgroundTask, DISABLE_NSJAIL, DISABLE_NUSER, HOME_ENV, NSJAIL_PATH, PATH_ENV, TZ_ENV + }, + python_executor::{create_dependencies_dir, handle_python_reqs, pip_compile}, + AuthedClientBackgroundTask, DISABLE_NSJAIL, DISABLE_NUSER, HOME_ENV, NSJAIL_PATH, PATH_ENV, + TZ_ENV, }; lazy_static::lazy_static! { @@ -198,7 +205,6 @@ pub async fn handle_ansible_job( append_logs(&job.id, &job.workspace_id, logs, db).await; write_file(job_dir, "main.yml", &playbook)?; - let additional_python_paths = handle_ansible_python_deps( job_dir, requirements_o, @@ -215,7 +221,13 @@ pub async fn handle_ansible_job( let interpolated_args; if let Some(args) = &job.args { - if let Some(x) = transform_json(client, &job.workspace_id, &args.0, job, db).await? { + let mut args = args.0.clone(); + if let Some(reqs) = reqs.clone() { + for (name, path) in reqs.resources.iter().chain(reqs.vars.iter()) { + args.insert(name.clone(), to_raw_value(path)); + } + } + if let Some(x) = transform_json(client, &job.workspace_id, &args, job, db).await? { write_file( job_dir, "args.json", @@ -228,7 +240,7 @@ pub async fn handle_ansible_job( "args.json", &serde_json::to_string(&args).unwrap_or_else(|_| "{}".to_string()), )?; - interpolated_args = Some(args.clone().0); + interpolated_args = Some(args); } } else { interpolated_args = None; @@ -236,6 +248,12 @@ pub async fn handle_ansible_job( }; write_file(job_dir, "result.json", "")?; + let cmd_options: Vec = reqs + .as_ref() + .map(|r| r.options.clone()) + .map(|r| get_cmd_options(r)) + .unwrap_or_default(); + let inventories: Vec = reqs .as_ref() .map(|x| { @@ -282,14 +300,16 @@ pub async fn handle_ansible_job( db, ) .await; - let ansible_cfg_content = format!(r#" + let ansible_cfg_content = format!( + r#" [defaults] collections_path = ./ roles_path = ./roles home={job_dir}/.ansible local_tmp={job_dir}/.ansible/tmp remote_tmp={job_dir}/.ansible/tmp -"#); +"# + ); write_file(job_dir, "ansible.cfg", &ansible_cfg_content)?; let mut reserved_variables = get_reserved_variables(job, &authed_client.token, db).await?; @@ -331,10 +351,11 @@ mount {{ let mut cmd_args = vec!["main.yml", "--extra-vars", "@args.json"]; cmd_args.extend(inventories.iter().map(|s| s.as_str())); + cmd_args.extend(cmd_options.iter().map(|s| s.as_str())); let child = if !*DISABLE_NSJAIL { - - let wrapper = format!(r#"set -eou pipefail + let wrapper = format!( + r#"set -eou pipefail {0} "$@" if [ -f "result" ]; then cat result > result_nsjail_mount.json @@ -342,7 +363,9 @@ fi if [ -f "result.json" ]; then cat result.json > result_nsjail_mount.json fi -"#, ANSIBLE_PLAYBOOK_PATH.as_str()); +"#, + ANSIBLE_PLAYBOOK_PATH.as_str() + ); let file = write_file(job_dir, "wrapper.sh", &wrapper)?; @@ -406,6 +429,36 @@ fi read_and_check_result(job_dir).await } +fn get_cmd_options(r: windmill_parser_yaml::AnsiblePlaybookOptions) -> Vec { + let mut ret = vec![]; + + if let Some(v) = r.verbosity { + if v.chars().all(|c| c == 'v') && v.len() <= 6 { + ret.push(format!("-{}", v)); + } + } + + if let Some(o) = r.timeout { + ret.push("--timeout".to_string()); + ret.push(o.to_string()); + } + + if let Some(o) = r.forks { + ret.push("--forks".to_string()); + ret.push(o.to_string()); + } + + if r.flush_cache.is_some() { + ret.push("--flush-cache".to_string()); + } + + if r.force_handlers.is_some() { + ret.push("--force-handlers".to_string()); + } + + ret +} + fn define_nsjail_mount(job_dir: &str, path: &PathBuf) -> anyhow::Result { Ok(format!( r#" diff --git a/backend/windmill-worker/src/common.rs b/backend/windmill-worker/src/common.rs index 4df77dc21f..1cda8fb03b 100644 --- a/backend/windmill-worker/src/common.rs +++ b/backend/windmill-worker/src/common.rs @@ -573,6 +573,28 @@ pub enum UpdateJobPollingExit { AlreadyCompleted, } +pub async fn update_worker_ping_for_failed_init_script( + db: &DB, + worker_name: &str, + last_job_id: Uuid, +) { + if let Err(e) = sqlx::query!( + "UPDATE worker_ping SET + ping_at = now(), + jobs_executed = 1, + current_job_id = $1, + current_job_workspace_id = 'admins' + WHERE worker = $2", + last_job_id, + worker_name + ) + .execute(db) + .await + { + tracing::error!("Error updating worker ping for failed init script: {e:?}"); + } +} + pub async fn update_job_poller( job_id: Uuid, db: &DB, diff --git a/backend/windmill-worker/src/result_processor.rs b/backend/windmill-worker/src/result_processor.rs index 9aaa4f2799..5203a65432 100644 --- a/backend/windmill-worker/src/result_processor.rs +++ b/backend/windmill-worker/src/result_processor.rs @@ -55,7 +55,7 @@ pub async fn process_result( column_order: Option>, new_args: Option>>, db: &DB, -) -> error::Result<()> { +) -> error::Result { match result { Ok(r) => { let job = if column_order.is_some() || new_args.is_some() { @@ -111,6 +111,7 @@ pub async fn process_result( token, ) .await; + Ok(true) } Err(e) => { let error_value = match e { @@ -152,9 +153,9 @@ pub async fn process_result( token, ) .await; + Ok(false) } - }; - Ok(()) + } } pub async fn handle_receive_completed_job< diff --git a/backend/windmill-worker/src/worker.rs b/backend/windmill-worker/src/worker.rs index 812fd78cd1..5c4a02431b 100644 --- a/backend/windmill-worker/src/worker.rs +++ b/backend/windmill-worker/src/worker.rs @@ -84,8 +84,7 @@ use rand::Rng; use crate::{ ansible_executor::handle_ansible_job, bash_executor::{handle_bash_job, handle_powershell_job}, bun_executor::handle_bun_job, common::{ - build_args_map, get_cached_resource_value_if_valid, get_reserved_variables, hash_args, - NO_LOGS_AT_ALL, SLOW_LOGS, + build_args_map, get_cached_resource_value_if_valid, get_reserved_variables, hash_args, update_worker_ping_for_failed_init_script, NO_LOGS_AT_ALL, SLOW_LOGS }, deno_executor::handle_deno_job, go_executor::handle_go_job, graphql_executor::do_graphql, handle_job_error, js_eval::{eval_fetch_timeout, transpile_ts}, mysql_executor::do_mysql, pg_executor::do_postgresql, php_executor::handle_php_job, python_executor::handle_python_job, result_processor::{handle_receive_completed_job, process_result}, rust_executor::handle_rust_job, worker_flow::{ handle_flow, update_flow_status_after_job_completion, update_flow_status_in_progress, Step, }, worker_lockfiles::{ @@ -195,6 +194,7 @@ pub async fn create_token_for_owner( exp: (chrono::Utc::now() + chrono::Duration::seconds(expires_in as i64)).timestamp() as usize, job_id: Some(job_id.to_string()), + scopes: None, }; let token = jsonwebtoken::encode( @@ -1143,6 +1143,8 @@ pub async fn run_worker { + handle_job_error( db, &authed_client.get_authed().await, arc_job.as_ref(), @@ -1730,12 +1734,20 @@ pub async fn run_worker { + tracing::error!("init script job failed, exiting"); + update_worker_ping_for_failed_init_script(db, &worker_name, arc_job.id).await; + break; + + } + _ => {} + } #[cfg(feature = "prometheus")] if let Some(duration) = _timer.map(|x| x.stop_and_record()) { @@ -1810,6 +1822,7 @@ pub async fn run_worker( same_worker_tx: SameWorkerSender, worker_name: &str, rsmq: Option, -) -> error::Result<()> { +) -> error::Result { if let Some(content) = WORKER_CONFIG.read().await.init_bash.clone() { let tx = PushIsolationLevel::IsolatedRoot(db.clone(), rsmq); let ehm = HashMap::new(); @@ -1889,8 +1906,10 @@ async fn queue_init_bash_maybe<'c, R: rsmq_async::RsmqConnection + Send + 'c>( .await .map_err(to_anyhow)?; tracing::info!("Creating initial job {uuid} from initial script script: {content}"); + Ok(true) + } else { + Ok(false) } - Ok(()) } // async fn process_result( @@ -2041,7 +2060,7 @@ async fn handle_queued_job( worker_code_execution_metric: &mut f32, _worker_flow_initial_transition_duration: Option, _worker_code_execution_duration: Option, -) -> windmill_common::error::Result<()> { +) -> windmill_common::error::Result { if job.canceled { return Err(Error::JsonErr(canceled_job_to_result(&job))); } @@ -2137,7 +2156,7 @@ async fn handle_queued_job( ) .fetch_one(db) .await - .map_err(|e| Error::InternalErr(format!("fetching step flow status: {e:#}")))? + .map_err(|e| Error::InternalErr(format!("Fetching script path from queue for caching purposes: {e:#}")))? .ok_or_else(|| Error::InternalErr(format!("Expected script_path")))?; let step = match step.unwrap() { Step::Step(i) => i.to_string(), @@ -2186,12 +2205,10 @@ async fn handle_queued_job( .await .expect("send job completed"); - return Ok(()); + return Ok(true); } }; if job.is_flow() { - #[cfg(feature = "prometheus")] - let timer = _worker_flow_initial_transition_duration.map(|x| x.start_timer()); handle_flow( job, db, @@ -2203,8 +2220,7 @@ async fn handle_queued_job( job_completed_tx.0.clone(), ) .await?; - #[cfg(feature = "prometheus")] - timer.map(|x| x.stop_and_record()); + Ok(true) } else { let mut logs = "".to_string(); let mut mem_peak: i32 = 0; @@ -2323,14 +2339,14 @@ async fn handle_queued_job( //it's a test job, no need to update the db if job.as_ref().workspace_id == "" { - return Ok(()); + return Ok(true); } if result .as_ref() .is_err_and(|err| matches!(err, &Error::AlreadyCompleted(_))) { - return Ok(()); + return Ok(false); } process_result( @@ -2346,9 +2362,8 @@ async fn handle_queued_job( new_args, db, ) - .await?; - }; - Ok(()) + .await + } } diff --git a/benchmarks/lib.ts b/benchmarks/lib.ts index e3171ae88b..4dd688aff7 100644 --- a/benchmarks/lib.ts +++ b/benchmarks/lib.ts @@ -2,7 +2,7 @@ import { sleep } from "https://deno.land/x/sleep@v1.2.1/mod.ts"; import * as windmill from "https://deno.land/x/windmill@v1.174.0/mod.ts"; import * as api from "https://deno.land/x/windmill@v1.174.0/windmill-api/index.ts"; -export const VERSION = "v1.398.1"; +export const VERSION = "v1.399.0"; export async function login(email: string, password: string): Promise { return await windmill.UserService.login({ diff --git a/cli/.gitignore b/cli/.gitignore index d0b1f2c514..409ee189ef 100644 --- a/cli/.gitignore +++ b/cli/.gitignore @@ -1,2 +1 @@ npm/ -gen/ \ No newline at end of file diff --git a/cli/build.sh b/cli/build.sh index 848e20d00c..bf00b99a57 100755 --- a/cli/build.sh +++ b/cli/build.sh @@ -1,2 +1,3 @@ +#!/bin/bash ./gen_wm_client.sh -deno run -A dnt.ts \ No newline at end of file +deno run -A dnt.ts diff --git a/cli/gen/core/ApiError.ts b/cli/gen/core/ApiError.ts new file mode 100644 index 0000000000..81aa78a668 --- /dev/null +++ b/cli/gen/core/ApiError.ts @@ -0,0 +1,21 @@ +import type { ApiRequestOptions } from './ApiRequestOptions.ts'; +import type { ApiResult } from './ApiResult.ts'; + +export class ApiError extends Error { + public readonly url: string; + public readonly status: number; + public readonly statusText: string; + public readonly body: unknown; + public readonly request: ApiRequestOptions; + + constructor(request: ApiRequestOptions, response: ApiResult, message: string) { + super(message); + + this.name = 'ApiError'; + this.url = response.url; + this.status = response.status; + this.statusText = response.statusText; + this.body = response.body; + this.request = request; + } +} \ No newline at end of file diff --git a/cli/gen/core/ApiRequestOptions.ts b/cli/gen/core/ApiRequestOptions.ts new file mode 100644 index 0000000000..939a0aa4c8 --- /dev/null +++ b/cli/gen/core/ApiRequestOptions.ts @@ -0,0 +1,21 @@ +export type ApiRequestOptions = { + readonly body?: any; + readonly cookies?: Record; + readonly errors?: Record; + readonly formData?: Record | any[] | Blob | File; + readonly headers?: Record; + readonly mediaType?: string; + readonly method: + | 'DELETE' + | 'GET' + | 'HEAD' + | 'OPTIONS' + | 'PATCH' + | 'POST' + | 'PUT'; + readonly path?: Record; + readonly query?: Record; + readonly responseHeader?: string; + readonly responseTransformer?: (data: unknown) => Promise; + readonly url: string; +}; \ No newline at end of file diff --git a/cli/gen/core/ApiResult.ts b/cli/gen/core/ApiResult.ts new file mode 100644 index 0000000000..4c58e39138 --- /dev/null +++ b/cli/gen/core/ApiResult.ts @@ -0,0 +1,7 @@ +export type ApiResult = { + readonly body: TData; + readonly ok: boolean; + readonly status: number; + readonly statusText: string; + readonly url: string; +}; \ No newline at end of file diff --git a/cli/gen/core/CancelablePromise.ts b/cli/gen/core/CancelablePromise.ts new file mode 100644 index 0000000000..ccc082e8f2 --- /dev/null +++ b/cli/gen/core/CancelablePromise.ts @@ -0,0 +1,126 @@ +export class CancelError extends Error { + constructor(message: string) { + super(message); + this.name = 'CancelError'; + } + + public get isCancelled(): boolean { + return true; + } +} + +export interface OnCancel { + readonly isResolved: boolean; + readonly isRejected: boolean; + readonly isCancelled: boolean; + + (cancelHandler: () => void): void; +} + +export class CancelablePromise implements Promise { + private _isResolved: boolean; + private _isRejected: boolean; + private _isCancelled: boolean; + readonly cancelHandlers: (() => void)[]; + readonly promise: Promise; + private _resolve?: (value: T | PromiseLike) => void; + private _reject?: (reason?: unknown) => void; + + constructor( + executor: ( + resolve: (value: T | PromiseLike) => void, + reject: (reason?: unknown) => void, + onCancel: OnCancel + ) => void + ) { + this._isResolved = false; + this._isRejected = false; + this._isCancelled = false; + this.cancelHandlers = []; + this.promise = new Promise((resolve, reject) => { + this._resolve = resolve; + this._reject = reject; + + const onResolve = (value: T | PromiseLike): void => { + if (this._isResolved || this._isRejected || this._isCancelled) { + return; + } + this._isResolved = true; + if (this._resolve) this._resolve(value); + }; + + const onReject = (reason?: unknown): void => { + if (this._isResolved || this._isRejected || this._isCancelled) { + return; + } + this._isRejected = true; + if (this._reject) this._reject(reason); + }; + + const onCancel = (cancelHandler: () => void): void => { + if (this._isResolved || this._isRejected || this._isCancelled) { + return; + } + this.cancelHandlers.push(cancelHandler); + }; + + Object.defineProperty(onCancel, 'isResolved', { + get: (): boolean => this._isResolved, + }); + + Object.defineProperty(onCancel, 'isRejected', { + get: (): boolean => this._isRejected, + }); + + Object.defineProperty(onCancel, 'isCancelled', { + get: (): boolean => this._isCancelled, + }); + + return executor(onResolve, onReject, onCancel as OnCancel); + }); + } + + get [Symbol.toStringTag]() { + return "Cancellable Promise"; + } + + public then( + onFulfilled?: ((value: T) => TResult1 | PromiseLike) | null, + onRejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): Promise { + return this.promise.then(onFulfilled, onRejected); + } + + public catch( + onRejected?: ((reason: unknown) => TResult | PromiseLike) | null + ): Promise { + return this.promise.catch(onRejected); + } + + public finally(onFinally?: (() => void) | null): Promise { + return this.promise.finally(onFinally); + } + + public cancel(): void { + if (this._isResolved || this._isRejected || this._isCancelled) { + return; + } + this._isCancelled = true; + if (this.cancelHandlers.length) { + try { + for (const cancelHandler of this.cancelHandlers) { + cancelHandler(); + } + } catch (error) { + console.warn('Cancellation threw an error', error); + return; + } + } + this.cancelHandlers.length = 0; + if (this._reject) this._reject(new CancelError('Request aborted')); + } + + public get isCancelled(): boolean { + return this._isCancelled; + } +} \ No newline at end of file diff --git a/cli/gen/core/OpenAPI.ts b/cli/gen/core/OpenAPI.ts new file mode 100644 index 0000000000..88e02785ee --- /dev/null +++ b/cli/gen/core/OpenAPI.ts @@ -0,0 +1,63 @@ +const getEnv = (key: string) => { + return Deno.env.get(key) +}; + +const baseUrl = getEnv("BASE_INTERNAL_URL") ?? getEnv("BASE_URL") ?? "http://localhost:8000"; +const baseUrlApi = (baseUrl ?? '') + "/api"; + +import type { ApiRequestOptions } from './ApiRequestOptions.ts'; + +type Headers = Record; +type Middleware = (value: T) => T | Promise; +type Resolver = (options: ApiRequestOptions) => Promise; + +export class Interceptors { + _fns: Middleware[]; + + constructor() { + this._fns = []; + } + + eject(fn: Middleware): void { + const index = this._fns.indexOf(fn); + if (index !== -1) { + this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)]; + } + } + + use(fn: Middleware): void { + this._fns = [...this._fns, fn]; + } +} + +export type OpenAPIConfig = { + BASE: string; + CREDENTIALS: 'include' | 'omit' | 'same-origin'; + ENCODE_PATH?: ((path: string) => string) | undefined; + HEADERS?: Headers | Resolver | undefined; + PASSWORD?: string | Resolver | undefined; + TOKEN?: string | Resolver | undefined; + USERNAME?: string | Resolver | undefined; + VERSION: string; + WITH_CREDENTIALS: boolean; + interceptors: { + request: Interceptors; + response: Interceptors; + }; +}; + +export const OpenAPI: OpenAPIConfig = { + BASE: baseUrlApi, + CREDENTIALS: 'include', + ENCODE_PATH: undefined, + HEADERS: undefined, + PASSWORD: undefined, + TOKEN: getEnv("WM_TOKEN"), + USERNAME: undefined, + VERSION: '1.398.1', + WITH_CREDENTIALS: true, + interceptors: { + request: new Interceptors(), + response: new Interceptors(), + }, +}; \ No newline at end of file diff --git a/cli/gen/core/request.ts b/cli/gen/core/request.ts new file mode 100644 index 0000000000..ed11eb4482 --- /dev/null +++ b/cli/gen/core/request.ts @@ -0,0 +1,350 @@ +import { ApiError } from './ApiError.ts'; +import type { ApiRequestOptions } from './ApiRequestOptions.ts'; +import type { ApiResult } from './ApiResult.ts'; +import { CancelablePromise } from './CancelablePromise.ts'; +import type { OnCancel } from './CancelablePromise.ts'; +import type { OpenAPIConfig } from './OpenAPI.ts'; + +export const isString = (value: unknown): value is string => { + return typeof value === 'string'; +}; + +export const isStringWithValue = (value: unknown): value is string => { + return isString(value) && value !== ''; +}; + +export const isBlob = (value: any): value is Blob => { + return value instanceof Blob; +}; + +export const isFormData = (value: unknown): value is FormData => { + return value instanceof FormData; +}; + +export const base64 = (str: string): string => { + try { + return btoa(str); + } catch (err) { + // @ts-ignore + return Buffer.from(str).toString('base64'); + } +}; + +export const getQueryString = (params: Record): string => { + const qs: string[] = []; + + const append = (key: string, value: unknown) => { + qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`); + }; + + const encodePair = (key: string, value: unknown) => { + if (value === undefined || value === null) { + return; + } + + if (value instanceof Date) { + append(key, value.toISOString()); + } else if (Array.isArray(value)) { + value.forEach(v => encodePair(key, v)); + } else if (typeof value === 'object') { + Object.entries(value).forEach(([k, v]) => encodePair(`${key}[${k}]`, v)); + } else { + append(key, value); + } + }; + + Object.entries(params).forEach(([key, value]) => encodePair(key, value)); + + return qs.length ? `?${qs.join('&')}` : ''; +}; + +const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => { + const encoder = config.ENCODE_PATH || encodeURI; + + const path = options.url + .replace('{api-version}', config.VERSION) + .replace(/{(.*?)}/g, (substring: string, group: string) => { + if (options.path?.hasOwnProperty(group)) { + return encoder(String(options.path[group])); + } + return substring; + }); + + const url = config.BASE + path; + return options.query ? url + getQueryString(options.query) : url; +}; + +export const getFormData = (options: ApiRequestOptions): FormData | undefined => { + if (options.formData) { + const formData = new FormData(); + + const process = (key: string, value: unknown) => { + if (isString(value) || isBlob(value)) { + formData.append(key, value); + } else { + formData.append(key, JSON.stringify(value)); + } + }; + + Object.entries(options.formData) + .filter(([, value]) => value !== undefined && value !== null) + .forEach(([key, value]) => { + if (Array.isArray(value)) { + value.forEach(v => process(key, v)); + } else { + process(key, value); + } + }); + + return formData; + } + return undefined; +}; + +type Resolver = (options: ApiRequestOptions) => Promise; + +export const resolve = async (options: ApiRequestOptions, resolver?: T | Resolver): Promise => { + if (typeof resolver === 'function') { + return (resolver as Resolver)(options); + } + return resolver; +}; + +export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Promise => { + const [token, username, password, additionalHeaders] = await Promise.all([ + // @ts-ignore + resolve(options, config.TOKEN), + // @ts-ignore + resolve(options, config.USERNAME), + // @ts-ignore + resolve(options, config.PASSWORD), + // @ts-ignore + resolve(options, config.HEADERS), + ]); + + const headers = Object.entries({ + Accept: 'application/json', + ...additionalHeaders, + ...options.headers, + }) + .filter(([, value]) => value !== undefined && value !== null) + .reduce((headers, [key, value]) => ({ + ...headers, + [key]: String(value), + }), {} as Record); + + if (isStringWithValue(token)) { + headers['Authorization'] = `Bearer ${token}`; + } + + if (isStringWithValue(username) && isStringWithValue(password)) { + const credentials = base64(`${username}:${password}`); + headers['Authorization'] = `Basic ${credentials}`; + } + + if (options.body !== undefined) { + if (options.mediaType) { + headers['Content-Type'] = options.mediaType; + } else if (isBlob(options.body)) { + headers['Content-Type'] = options.body.type || 'application/octet-stream'; + } else if (isString(options.body)) { + headers['Content-Type'] = 'text/plain'; + } else if (!isFormData(options.body)) { + headers['Content-Type'] = 'application/json'; + } + } + + return new Headers(headers); +}; + +export const getRequestBody = (options: ApiRequestOptions): unknown => { + if (options.body !== undefined) { + if (options.mediaType?.includes('application/json') || options.mediaType?.includes('+json')) { + return JSON.stringify(options.body); + } else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) { + return options.body; + } else { + return JSON.stringify(options.body); + } + } + return undefined; +}; + +export const sendRequest = async ( + config: OpenAPIConfig, + options: ApiRequestOptions, + url: string, + body: any, + formData: FormData | undefined, + headers: Headers, + onCancel: OnCancel +): Promise => { + const controller = new AbortController(); + + let request: RequestInit = { + headers, + body: body ?? formData, + method: options.method, + signal: controller.signal, + }; + + if (config.WITH_CREDENTIALS) { + request.credentials = config.CREDENTIALS; + } + + for (const fn of config.interceptors.request._fns) { + request = await fn(request); + } + + onCancel(() => controller.abort()); + + return await fetch(url, request); +}; + +export const getResponseHeader = (response: Response, responseHeader?: string): string | undefined => { + if (responseHeader) { + const content = response.headers.get(responseHeader); + if (isString(content)) { + return content; + } + } + return undefined; +}; + +export const getResponseBody = async (response: Response): Promise => { + if (response.status !== 204) { + try { + const contentType = response.headers.get('Content-Type'); + if (contentType) { + const binaryTypes = ['application/octet-stream', 'application/pdf', 'application/zip', 'audio/', 'image/', 'video/']; + if (contentType.includes('application/json') || contentType.includes('+json')) { + return await response.json(); + } else if (binaryTypes.some(type => contentType.includes(type))) { + return await response.blob(); + } else if (contentType.includes('multipart/form-data')) { + return await response.formData(); + } else if (contentType.includes('text/')) { + return await response.text(); + } + } + } catch (error) { + console.error(error); + } + } + return undefined; +}; + +export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => { + const errors: Record = { + 400: 'Bad Request', + 401: 'Unauthorized', + 402: 'Payment Required', + 403: 'Forbidden', + 404: 'Not Found', + 405: 'Method Not Allowed', + 406: 'Not Acceptable', + 407: 'Proxy Authentication Required', + 408: 'Request Timeout', + 409: 'Conflict', + 410: 'Gone', + 411: 'Length Required', + 412: 'Precondition Failed', + 413: 'Payload Too Large', + 414: 'URI Too Long', + 415: 'Unsupported Media Type', + 416: 'Range Not Satisfiable', + 417: 'Expectation Failed', + 418: 'Im a teapot', + 421: 'Misdirected Request', + 422: 'Unprocessable Content', + 423: 'Locked', + 424: 'Failed Dependency', + 425: 'Too Early', + 426: 'Upgrade Required', + 428: 'Precondition Required', + 429: 'Too Many Requests', + 431: 'Request Header Fields Too Large', + 451: 'Unavailable For Legal Reasons', + 500: 'Internal Server Error', + 501: 'Not Implemented', + 502: 'Bad Gateway', + 503: 'Service Unavailable', + 504: 'Gateway Timeout', + 505: 'HTTP Version Not Supported', + 506: 'Variant Also Negotiates', + 507: 'Insufficient Storage', + 508: 'Loop Detected', + 510: 'Not Extended', + 511: 'Network Authentication Required', + ...options.errors, + } + + const error = errors[result.status]; + if (error) { + throw new ApiError(options, result, error); + } + + if (!result.ok) { + const errorStatus = result.status ?? 'unknown'; + const errorStatusText = result.statusText ?? 'unknown'; + const errorBody = (() => { + try { + return JSON.stringify(result.body, null, 2); + } catch (e) { + return undefined; + } + })(); + + throw new ApiError(options, result, + `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}` + ); + } +}; + +/** + * Request method + * @param config The OpenAPI configuration object + * @param options The request options from the service + * @returns CancelablePromise + * @throws ApiError + */ +export const request = (config: OpenAPIConfig, options: ApiRequestOptions): CancelablePromise => { + return new CancelablePromise(async (resolve, reject, onCancel) => { + try { + const url = getUrl(config, options); + const formData = getFormData(options); + const body = getRequestBody(options); + const headers = await getHeaders(config, options); + + if (!onCancel.isCancelled) { + let response = await sendRequest(config, options, url, body, formData, headers, onCancel); + + for (const fn of config.interceptors.response._fns) { + response = await fn(response); + } + + const responseBody = await getResponseBody(response); + const responseHeader = getResponseHeader(response, options.responseHeader); + + let transformedBody = responseBody; + if (options.responseTransformer && response.ok) { + transformedBody = await options.responseTransformer(responseBody) + } + + const result: ApiResult = { + url, + ok: response.ok, + status: response.status, + statusText: response.statusText, + body: responseHeader ?? transformedBody, + }; + + catchErrorCodes(options, result); + + resolve(result.body); + } + } catch (error) { + reject(error); + } + }); +}; \ No newline at end of file diff --git a/cli/gen/index.ts b/cli/gen/index.ts new file mode 100644 index 0000000000..77b08aeebb --- /dev/null +++ b/cli/gen/index.ts @@ -0,0 +1,6 @@ +// This file is auto-generated by @hey-api/openapi-ts +export { ApiError } from './core/ApiError.ts'; +export { CancelablePromise, CancelError } from './core/CancelablePromise.ts'; +export { OpenAPI, type OpenAPIConfig } from './core/OpenAPI.ts'; +export * from './services.gen.ts'; +export * from './types.gen.ts'; \ No newline at end of file diff --git a/cli/gen/services.gen.ts b/cli/gen/services.gen.ts new file mode 100644 index 0000000000..9894d6de36 --- /dev/null +++ b/cli/gen/services.gen.ts @@ -0,0 +1,6616 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { CancelablePromise } from './core/CancelablePromise.ts'; +import { OpenAPI } from './core/OpenAPI.ts'; +import { request as __request } from './core/request.ts'; +import type { BackendVersionResponse, BackendUptodateResponse, GetLicenseIdResponse, GetOpenApiYamlResponse, GetAuditLogData, GetAuditLogResponse, ListAuditLogsData, ListAuditLogsResponse, LoginData, LoginResponse, LogoutResponse, GetUserData, GetUserResponse, UpdateUserData, UpdateUserResponse, IsOwnerOfPathData, IsOwnerOfPathResponse, SetPasswordData, SetPasswordResponse, CreateUserGloballyData, CreateUserGloballyResponse, GlobalUserUpdateData, GlobalUserUpdateResponse, GlobalUsernameInfoData, GlobalUsernameInfoResponse, GlobalUserRenameData, GlobalUserRenameResponse, GlobalUserDeleteData, GlobalUserDeleteResponse, GlobalUsersOverwriteData, GlobalUsersOverwriteResponse, GlobalUsersExportResponse, DeleteUserData, DeleteUserResponse, ListWorkspacesResponse, IsDomainAllowedResponse, ListUserWorkspacesResponse, ListWorkspacesAsSuperAdminData, ListWorkspacesAsSuperAdminResponse, CreateWorkspaceData, CreateWorkspaceResponse, ExistsWorkspaceData, ExistsWorkspaceResponse, ExistsUsernameData, ExistsUsernameResponse, GetGlobalData, GetGlobalResponse, SetGlobalData, SetGlobalResponse, GetLocalResponse, TestSmtpData, TestSmtpResponse, TestCriticalChannelsData, TestCriticalChannelsResponse, TestLicenseKeyData, TestLicenseKeyResponse, TestObjectStorageConfigData, TestObjectStorageConfigResponse, SendStatsResponse, GetLatestKeyRenewalAttemptResponse, RenewLicenseKeyData, RenewLicenseKeyResponse, CreateCustomerPortalSessionData, CreateCustomerPortalSessionResponse, TestMetadataData, TestMetadataResponse, ListGlobalSettingsResponse, GetCurrentEmailResponse, RefreshUserTokenResponse, GetTutorialProgressResponse, UpdateTutorialProgressData, UpdateTutorialProgressResponse, LeaveInstanceResponse, GetUsageResponse, GetRunnableResponse, GlobalWhoamiResponse, ListWorkspaceInvitesResponse, WhoamiData, WhoamiResponse, AcceptInviteData, AcceptInviteResponse, DeclineInviteData, DeclineInviteResponse, InviteUserData, InviteUserResponse, AddUserData, AddUserResponse, DeleteInviteData, DeleteInviteResponse, ArchiveWorkspaceData, ArchiveWorkspaceResponse, UnarchiveWorkspaceData, UnarchiveWorkspaceResponse, DeleteWorkspaceData, DeleteWorkspaceResponse, LeaveWorkspaceData, LeaveWorkspaceResponse, GetWorkspaceNameData, GetWorkspaceNameResponse, ChangeWorkspaceNameData, ChangeWorkspaceNameResponse, ChangeWorkspaceIdData, ChangeWorkspaceIdResponse, WhoisData, WhoisResponse, ExistsEmailData, ExistsEmailResponse, ListUsersAsSuperAdminData, ListUsersAsSuperAdminResponse, ListPendingInvitesData, ListPendingInvitesResponse, GetSettingsData, GetSettingsResponse, GetDeployToData, GetDeployToResponse, GetIsPremiumData, GetIsPremiumResponse, GetPremiumInfoData, GetPremiumInfoResponse, SetAutomaticBillingData, SetAutomaticBillingResponse, EditSlackCommandData, EditSlackCommandResponse, RunSlackMessageTestJobData, RunSlackMessageTestJobResponse, EditDeployToData, EditDeployToResponse, EditAutoInviteData, EditAutoInviteResponse, EditWebhookData, EditWebhookResponse, EditCopilotConfigData, EditCopilotConfigResponse, GetCopilotInfoData, GetCopilotInfoResponse, EditErrorHandlerData, EditErrorHandlerResponse, EditLargeFileStorageConfigData, EditLargeFileStorageConfigResponse, EditWorkspaceGitSyncConfigData, EditWorkspaceGitSyncConfigResponse, EditWorkspaceDeployUiSettingsData, EditWorkspaceDeployUiSettingsResponse, EditWorkspaceDefaultAppData, EditWorkspaceDefaultAppResponse, EditDefaultScriptsData, EditDefaultScriptsResponse, GetDefaultScriptsData, GetDefaultScriptsResponse, SetEnvironmentVariableData, SetEnvironmentVariableResponse, GetWorkspaceEncryptionKeyData, GetWorkspaceEncryptionKeyResponse, SetWorkspaceEncryptionKeyData, SetWorkspaceEncryptionKeyResponse, GetWorkspaceDefaultAppData, GetWorkspaceDefaultAppResponse, GetLargeFileStorageConfigData, GetLargeFileStorageConfigResponse, GetWorkspaceUsageData, GetWorkspaceUsageResponse, ListUsersData, ListUsersResponse, ListUsersUsageData, ListUsersUsageResponse, ListUsernamesData, ListUsernamesResponse, UsernameToEmailData, UsernameToEmailResponse, CreateTokenData, CreateTokenResponse, CreateTokenImpersonateData, CreateTokenImpersonateResponse, DeleteTokenData, DeleteTokenResponse, ListTokensData, ListTokensResponse, GetOidcTokenData, GetOidcTokenResponse, CreateVariableData, CreateVariableResponse, EncryptValueData, EncryptValueResponse, DeleteVariableData, DeleteVariableResponse, UpdateVariableData, UpdateVariableResponse, GetVariableData, GetVariableResponse, GetVariableValueData, GetVariableValueResponse, ExistsVariableData, ExistsVariableResponse, ListVariableData, ListVariableResponse, ListContextualVariablesData, ListContextualVariablesResponse, LoginWithOauthData, LoginWithOauthResponse, ConnectSlackCallbackData, ConnectSlackCallbackResponse, ConnectSlackCallbackInstanceData, ConnectSlackCallbackInstanceResponse, ConnectCallbackData, ConnectCallbackResponse, CreateAccountData, CreateAccountResponse, RefreshTokenData, RefreshTokenResponse, DisconnectAccountData, DisconnectAccountResponse, DisconnectSlackData, DisconnectSlackResponse, ListOauthLoginsResponse, ListOauthConnectsResponse, GetOauthConnectData, GetOauthConnectResponse, CreateResourceData, CreateResourceResponse, DeleteResourceData, DeleteResourceResponse, UpdateResourceData, UpdateResourceResponse, UpdateResourceValueData, UpdateResourceValueResponse, GetResourceData, GetResourceResponse, GetResourceValueInterpolatedData, GetResourceValueInterpolatedResponse, GetResourceValueData, GetResourceValueResponse, ExistsResourceData, ExistsResourceResponse, ListResourceData, ListResourceResponse, ListSearchResourceData, ListSearchResourceResponse, ListResourceNamesData, ListResourceNamesResponse, CreateResourceTypeData, CreateResourceTypeResponse, FileResourceTypeToFileExtMapData, FileResourceTypeToFileExtMapResponse, DeleteResourceTypeData, DeleteResourceTypeResponse, UpdateResourceTypeData, UpdateResourceTypeResponse, GetResourceTypeData, GetResourceTypeResponse, ExistsResourceTypeData, ExistsResourceTypeResponse, ListResourceTypeData, ListResourceTypeResponse, ListResourceTypeNamesData, ListResourceTypeNamesResponse, QueryResourceTypesData, QueryResourceTypesResponse, ListHubIntegrationsData, ListHubIntegrationsResponse, ListHubFlowsResponse, GetHubFlowByIdData, GetHubFlowByIdResponse, ListHubAppsResponse, GetHubAppByIdData, GetHubAppByIdResponse, GetHubScriptContentByPathData, GetHubScriptContentByPathResponse, GetHubScriptByPathData, GetHubScriptByPathResponse, GetTopHubScriptsData, GetTopHubScriptsResponse, QueryHubScriptsData, QueryHubScriptsResponse, ListSearchScriptData, ListSearchScriptResponse, ListScriptsData, ListScriptsResponse, ListScriptPathsData, ListScriptPathsResponse, CreateDraftData, CreateDraftResponse, DeleteDraftData, DeleteDraftResponse, CreateScriptData, CreateScriptResponse, ToggleWorkspaceErrorHandlerForScriptData, ToggleWorkspaceErrorHandlerForScriptResponse, GetCustomTagsResponse, GeDefaultTagsResponse, IsDefaultTagsPerWorkspaceResponse, ArchiveScriptByPathData, ArchiveScriptByPathResponse, ArchiveScriptByHashData, ArchiveScriptByHashResponse, DeleteScriptByHashData, DeleteScriptByHashResponse, DeleteScriptByPathData, DeleteScriptByPathResponse, GetScriptByPathData, GetScriptByPathResponse, GetScriptByPathWithDraftData, GetScriptByPathWithDraftResponse, GetScriptHistoryByPathData, GetScriptHistoryByPathResponse, UpdateScriptHistoryData, UpdateScriptHistoryResponse, RawScriptByPathData, RawScriptByPathResponse, RawScriptByPathTokenedData, RawScriptByPathTokenedResponse, ExistsScriptByPathData, ExistsScriptByPathResponse, GetScriptByHashData, GetScriptByHashResponse, RawScriptByHashData, RawScriptByHashResponse, GetScriptDeploymentStatusData, GetScriptDeploymentStatusResponse, RunScriptByPathData, RunScriptByPathResponse, OpenaiSyncScriptByPathData, OpenaiSyncScriptByPathResponse, RunWaitResultScriptByPathData, RunWaitResultScriptByPathResponse, RunWaitResultScriptByPathGetData, RunWaitResultScriptByPathGetResponse, OpenaiSyncFlowByPathData, OpenaiSyncFlowByPathResponse, RunWaitResultFlowByPathData, RunWaitResultFlowByPathResponse, ResultByIdData, ResultByIdResponse, ListFlowPathsData, ListFlowPathsResponse, ListSearchFlowData, ListSearchFlowResponse, ListFlowsData, ListFlowsResponse, GetFlowHistoryData, GetFlowHistoryResponse, GetFlowVersionData, GetFlowVersionResponse, UpdateFlowHistoryData, UpdateFlowHistoryResponse, GetFlowByPathData, GetFlowByPathResponse, ToggleWorkspaceErrorHandlerForFlowData, ToggleWorkspaceErrorHandlerForFlowResponse, GetFlowByPathWithDraftData, GetFlowByPathWithDraftResponse, ExistsFlowByPathData, ExistsFlowByPathResponse, CreateFlowData, CreateFlowResponse, UpdateFlowData, UpdateFlowResponse, ArchiveFlowByPathData, ArchiveFlowByPathResponse, DeleteFlowByPathData, DeleteFlowByPathResponse, ListRawAppsData, ListRawAppsResponse, ExistsRawAppData, ExistsRawAppResponse, GetRawAppDataData, GetRawAppDataResponse, ListSearchAppData, ListSearchAppResponse, ListAppsData, ListAppsResponse, CreateAppData, CreateAppResponse, ExistsAppData, ExistsAppResponse, GetAppByPathData, GetAppByPathResponse, GetAppByPathWithDraftData, GetAppByPathWithDraftResponse, GetAppHistoryByPathData, GetAppHistoryByPathResponse, UpdateAppHistoryData, UpdateAppHistoryResponse, GetPublicAppBySecretData, GetPublicAppBySecretResponse, GetPublicResourceData, GetPublicResourceResponse, GetPublicSecretOfAppData, GetPublicSecretOfAppResponse, GetAppByVersionData, GetAppByVersionResponse, CreateRawAppData, CreateRawAppResponse, UpdateRawAppData, UpdateRawAppResponse, DeleteRawAppData, DeleteRawAppResponse, DeleteAppData, DeleteAppResponse, UpdateAppData, UpdateAppResponse, ExecuteComponentData, ExecuteComponentResponse, RunFlowByPathData, RunFlowByPathResponse, RestartFlowAtStepData, RestartFlowAtStepResponse, RunScriptByHashData, RunScriptByHashResponse, RunScriptPreviewData, RunScriptPreviewResponse, RunCodeWorkflowTaskData, RunCodeWorkflowTaskResponse, RunRawScriptDependenciesData, RunRawScriptDependenciesResponse, RunFlowPreviewData, RunFlowPreviewResponse, ListQueueData, ListQueueResponse, GetQueueCountData, GetQueueCountResponse, GetCompletedCountData, GetCompletedCountResponse, ListFilteredUuidsData, ListFilteredUuidsResponse, CancelSelectionData, CancelSelectionResponse, ListCompletedJobsData, ListCompletedJobsResponse, ListJobsData, ListJobsResponse, GetDbClockResponse, GetJobData, GetJobResponse, GetRootJobIdData, GetRootJobIdResponse, GetJobLogsData, GetJobLogsResponse, GetJobArgsData, GetJobArgsResponse, GetJobUpdatesData, GetJobUpdatesResponse, GetLogFileFromStoreData, GetLogFileFromStoreResponse, GetFlowDebugInfoData, GetFlowDebugInfoResponse, GetCompletedJobData, GetCompletedJobResponse, GetCompletedJobResultData, GetCompletedJobResultResponse, GetCompletedJobResultMaybeData, GetCompletedJobResultMaybeResponse, DeleteCompletedJobData, DeleteCompletedJobResponse, CancelQueuedJobData, CancelQueuedJobResponse, CancelPersistentQueuedJobsData, CancelPersistentQueuedJobsResponse, ForceCancelQueuedJobData, ForceCancelQueuedJobResponse, CreateJobSignatureData, CreateJobSignatureResponse, GetResumeUrlsData, GetResumeUrlsResponse, ResumeSuspendedJobGetData, ResumeSuspendedJobGetResponse, ResumeSuspendedJobPostData, ResumeSuspendedJobPostResponse, SetFlowUserStateData, SetFlowUserStateResponse, GetFlowUserStateData, GetFlowUserStateResponse, ResumeSuspendedFlowAsOwnerData, ResumeSuspendedFlowAsOwnerResponse, CancelSuspendedJobGetData, CancelSuspendedJobGetResponse, CancelSuspendedJobPostData, CancelSuspendedJobPostResponse, GetSuspendedJobFlowData, GetSuspendedJobFlowResponse, PreviewScheduleData, PreviewScheduleResponse, CreateScheduleData, CreateScheduleResponse, UpdateScheduleData, UpdateScheduleResponse, SetScheduleEnabledData, SetScheduleEnabledResponse, DeleteScheduleData, DeleteScheduleResponse, GetScheduleData, GetScheduleResponse, ExistsScheduleData, ExistsScheduleResponse, ListSchedulesData, ListSchedulesResponse, ListSchedulesWithJobsData, ListSchedulesWithJobsResponse, SetDefaultErrorOrRecoveryHandlerData, SetDefaultErrorOrRecoveryHandlerResponse, CreateHttpTriggerData, CreateHttpTriggerResponse, UpdateHttpTriggerData, UpdateHttpTriggerResponse, DeleteHttpTriggerData, DeleteHttpTriggerResponse, GetHttpTriggerData, GetHttpTriggerResponse, ListHttpTriggersData, ListHttpTriggersResponse, ExistsHttpTriggerData, ExistsHttpTriggerResponse, ExistsRouteData, ExistsRouteResponse, UsedData, UsedResponse, ListInstanceGroupsResponse, GetInstanceGroupData, GetInstanceGroupResponse, CreateInstanceGroupData, CreateInstanceGroupResponse, UpdateInstanceGroupData, UpdateInstanceGroupResponse, DeleteInstanceGroupData, DeleteInstanceGroupResponse, AddUserToInstanceGroupData, AddUserToInstanceGroupResponse, RemoveUserFromInstanceGroupData, RemoveUserFromInstanceGroupResponse, ExportInstanceGroupsResponse, OverwriteInstanceGroupsData, OverwriteInstanceGroupsResponse, ListGroupsData, ListGroupsResponse, ListGroupNamesData, ListGroupNamesResponse, CreateGroupData, CreateGroupResponse, UpdateGroupData, UpdateGroupResponse, DeleteGroupData, DeleteGroupResponse, GetGroupData, GetGroupResponse, AddUserToGroupData, AddUserToGroupResponse, RemoveUserToGroupData, RemoveUserToGroupResponse, ListFoldersData, ListFoldersResponse, ListFolderNamesData, ListFolderNamesResponse, CreateFolderData, CreateFolderResponse, UpdateFolderData, UpdateFolderResponse, DeleteFolderData, DeleteFolderResponse, GetFolderData, GetFolderResponse, GetFolderUsageData, GetFolderUsageResponse, AddOwnerToFolderData, AddOwnerToFolderResponse, RemoveOwnerToFolderData, RemoveOwnerToFolderResponse, ListWorkersData, ListWorkersResponse, ExistsWorkerWithTagData, ExistsWorkerWithTagResponse, GetQueueMetricsResponse, ListWorkerGroupsResponse, GetConfigData, GetConfigResponse, UpdateConfigData, UpdateConfigResponse, DeleteConfigData, DeleteConfigResponse, ListConfigsResponse, GetGranularAclsData, GetGranularAclsResponse, AddGranularAclsData, AddGranularAclsResponse, RemoveGranularAclsData, RemoveGranularAclsResponse, UpdateCaptureData, UpdateCaptureResponse, CreateCaptureData, CreateCaptureResponse, GetCaptureData, GetCaptureResponse, StarData, StarResponse, UnstarData, UnstarResponse, GetInputHistoryData, GetInputHistoryResponse, GetArgsFromHistoryOrSavedInputData, GetArgsFromHistoryOrSavedInputResponse, ListInputsData, ListInputsResponse, CreateInputData, CreateInputResponse, UpdateInputData, UpdateInputResponse, DeleteInputData, DeleteInputResponse, DuckdbConnectionSettingsData, DuckdbConnectionSettingsResponse, DuckdbConnectionSettingsV2Data, DuckdbConnectionSettingsV2Response, PolarsConnectionSettingsData, PolarsConnectionSettingsResponse, PolarsConnectionSettingsV2Data, PolarsConnectionSettingsV2Response, S3ResourceInfoData, S3ResourceInfoResponse, DatasetStorageTestConnectionData, DatasetStorageTestConnectionResponse, ListStoredFilesData, ListStoredFilesResponse, LoadFileMetadataData, LoadFileMetadataResponse, LoadFilePreviewData, LoadFilePreviewResponse, LoadParquetPreviewData, LoadParquetPreviewResponse, LoadTableRowCountData, LoadTableRowCountResponse, LoadCsvPreviewData, LoadCsvPreviewResponse, DeleteS3FileData, DeleteS3FileResponse, MoveS3FileData, MoveS3FileResponse, FileUploadData, FileUploadResponse, FileDownloadData, FileDownloadResponse, FileDownloadParquetAsCsvData, FileDownloadParquetAsCsvResponse, GetJobMetricsData, GetJobMetricsResponse, SetJobProgressData, SetJobProgressResponse, GetJobProgressData, GetJobProgressResponse, ListLogFilesData, ListLogFilesResponse, GetLogFileData, GetLogFileResponse, ListConcurrencyGroupsResponse, DeleteConcurrencyGroupData, DeleteConcurrencyGroupResponse, GetConcurrencyKeyData, GetConcurrencyKeyResponse, ListExtendedJobsData, ListExtendedJobsResponse, SearchJobsIndexData, SearchJobsIndexResponse } from './types.gen.ts'; + +/** + * get backend version + * @returns string git version of backend + * @throws ApiError + */ +export const backendVersion = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/version' +}); }; + +/** + * is backend up to date + * @returns string is backend up to date + * @throws ApiError + */ +export const backendUptodate = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/uptodate' +}); }; + +/** + * get license id + * @returns string get license id (empty if not ee) + * @throws ApiError + */ +export const getLicenseId = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/ee_license' +}); }; + +/** + * get openapi yaml spec + * @returns string openapi yaml file content + * @throws ApiError + */ +export const getOpenApiYaml = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/openapi.yaml' +}); }; + +/** + * get audit log (requires admin privilege) + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @returns AuditLog an audit log + * @throws ApiError + */ +export const getAuditLog = (data: GetAuditLogData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/audit/get/{id}', + path: { + workspace: data.workspace, + id: data.id + } +}); }; + +/** + * list audit logs (requires admin privilege) + * @param data The data for the request. + * @param data.workspace + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @param data.before filter on started before (inclusive) timestamp + * @param data.after filter on created after (exclusive) timestamp + * @param data.username filter on exact username of user + * @param data.operation filter on exact or prefix name of operation + * @param data.operations comma separated list of exact operations to include + * @param data.excludeOperations comma separated list of operations to exclude + * @param data.resource filter on exact or prefix name of resource + * @param data.actionKind filter on type of operation + * @returns AuditLog a list of audit logs + * @throws ApiError + */ +export const listAuditLogs = (data: ListAuditLogsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/audit/list', + path: { + workspace: data.workspace + }, + query: { + page: data.page, + per_page: data.perPage, + before: data.before, + after: data.after, + username: data.username, + operation: data.operation, + operations: data.operations, + exclude_operations: data.excludeOperations, + resource: data.resource, + action_kind: data.actionKind + } +}); }; + +/** + * login with password + * @param data The data for the request. + * @param data.requestBody credentials + * @returns string Successfully authenticated. The session ID is returned in a cookie named `token` and as plaintext response. Preferred method of authorization is through the bearer token. The cookie is only for browser convenience. + * + * @throws ApiError + */ +export const login = (data: LoginData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/auth/login', + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * logout + * @returns string clear cookies and clear token (if applicable) + * @throws ApiError + */ +export const logout = (): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/auth/logout' +}); }; + +/** + * get user (require admin privilege) + * @param data The data for the request. + * @param data.workspace + * @param data.username + * @returns User user created + * @throws ApiError + */ +export const getUser = (data: GetUserData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/users/{username}', + path: { + workspace: data.workspace, + username: data.username + } +}); }; + +/** + * update user (require admin privilege) + * @param data The data for the request. + * @param data.workspace + * @param data.username + * @param data.requestBody new user + * @returns string edited user + * @throws ApiError + */ +export const updateUser = (data: UpdateUserData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/users/update/{username}', + path: { + workspace: data.workspace, + username: data.username + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * is owner of path + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns boolean is owner + * @throws ApiError + */ +export const isOwnerOfPath = (data: IsOwnerOfPathData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/users/is_owner/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * set password + * @param data The data for the request. + * @param data.requestBody set password + * @returns string password set + * @throws ApiError + */ +export const setPassword = (data: SetPasswordData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/users/setpassword', + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * create user + * @param data The data for the request. + * @param data.requestBody user info + * @returns string user created + * @throws ApiError + */ +export const createUserGlobally = (data: CreateUserGloballyData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/users/create', + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * global update user (require super admin) + * @param data The data for the request. + * @param data.email + * @param data.requestBody new user info + * @returns string user updated + * @throws ApiError + */ +export const globalUserUpdate = (data: GlobalUserUpdateData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/users/update/{email}', + path: { + email: data.email + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * global username info (require super admin) + * @param data The data for the request. + * @param data.email + * @returns unknown user renamed + * @throws ApiError + */ +export const globalUsernameInfo = (data: GlobalUsernameInfoData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/users/username_info/{email}', + path: { + email: data.email + } +}); }; + +/** + * global rename user (require super admin) + * @param data The data for the request. + * @param data.email + * @param data.requestBody new username + * @returns string user renamed + * @throws ApiError + */ +export const globalUserRename = (data: GlobalUserRenameData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/users/rename/{email}', + path: { + email: data.email + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * global delete user (require super admin) + * @param data The data for the request. + * @param data.email + * @returns string user deleted + * @throws ApiError + */ +export const globalUserDelete = (data: GlobalUserDeleteData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/users/delete/{email}', + path: { + email: data.email + } +}); }; + +/** + * global overwrite users (require super admin and EE) + * @param data The data for the request. + * @param data.requestBody List of users + * @returns string Success message + * @throws ApiError + */ +export const globalUsersOverwrite = (data: GlobalUsersOverwriteData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/users/overwrite', + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * global export users (require super admin and EE) + * @returns ExportedUser exported users + * @throws ApiError + */ +export const globalUsersExport = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/users/export' +}); }; + +/** + * delete user (require admin privilege) + * @param data The data for the request. + * @param data.workspace + * @param data.username + * @returns string delete user + * @throws ApiError + */ +export const deleteUser = (data: DeleteUserData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/w/{workspace}/users/delete/{username}', + path: { + workspace: data.workspace, + username: data.username + } +}); }; + +/** + * list all workspaces visible to me + * @returns Workspace all workspaces + * @throws ApiError + */ +export const listWorkspaces = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/workspaces/list' +}); }; + +/** + * is domain allowed for auto invi + * @returns boolean domain allowed or not + * @throws ApiError + */ +export const isDomainAllowed = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/workspaces/allowed_domain_auto_invite' +}); }; + +/** + * list all workspaces visible to me with user info + * @returns UserWorkspaceList workspace with associated username + * @throws ApiError + */ +export const listUserWorkspaces = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/workspaces/users' +}); }; + +/** + * list all workspaces as super admin (require to be super admin) + * @param data The data for the request. + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @returns Workspace workspaces + * @throws ApiError + */ +export const listWorkspacesAsSuperAdmin = (data: ListWorkspacesAsSuperAdminData = {}): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/workspaces/list_as_superadmin', + query: { + page: data.page, + per_page: data.perPage + } +}); }; + +/** + * create workspace + * @param data The data for the request. + * @param data.requestBody new token + * @returns string token created + * @throws ApiError + */ +export const createWorkspace = (data: CreateWorkspaceData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/workspaces/create', + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * exists workspace + * @param data The data for the request. + * @param data.requestBody id of workspace + * @returns boolean status + * @throws ApiError + */ +export const existsWorkspace = (data: ExistsWorkspaceData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/workspaces/exists', + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * exists username + * @param data The data for the request. + * @param data.requestBody + * @returns boolean status + * @throws ApiError + */ +export const existsUsername = (data: ExistsUsernameData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/workspaces/exists_username', + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * get global settings + * @param data The data for the request. + * @param data.key + * @returns unknown status + * @throws ApiError + */ +export const getGlobal = (data: GetGlobalData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/settings/global/{key}', + path: { + key: data.key + } +}); }; + +/** + * post global settings + * @param data The data for the request. + * @param data.key + * @param data.requestBody value set + * @returns string status + * @throws ApiError + */ +export const setGlobal = (data: SetGlobalData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/settings/global/{key}', + path: { + key: data.key + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * get local settings + * @returns unknown status + * @throws ApiError + */ +export const getLocal = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/settings/local' +}); }; + +/** + * test smtp + * @param data The data for the request. + * @param data.requestBody test smtp payload + * @returns string status + * @throws ApiError + */ +export const testSmtp = (data: TestSmtpData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/settings/test_smtp', + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * test critical channels + * @param data The data for the request. + * @param data.requestBody test critical channel payload + * @returns string status + * @throws ApiError + */ +export const testCriticalChannels = (data: TestCriticalChannelsData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/settings/test_critical_channels', + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * test license key + * @param data The data for the request. + * @param data.requestBody test license key + * @returns string status + * @throws ApiError + */ +export const testLicenseKey = (data: TestLicenseKeyData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/settings/test_license_key', + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * test object storage config + * @param data The data for the request. + * @param data.requestBody test object storage config + * @returns string status + * @throws ApiError + */ +export const testObjectStorageConfig = (data: TestObjectStorageConfigData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/settings/test_object_storage_config', + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * send stats + * @returns string status + * @throws ApiError + */ +export const sendStats = (): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/settings/send_stats' +}); }; + +/** + * get latest key renewal attempt + * @returns unknown status + * @throws ApiError + */ +export const getLatestKeyRenewalAttempt = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/settings/latest_key_renewal_attempt' +}); }; + +/** + * renew license key + * @param data The data for the request. + * @param data.licenseKey + * @returns string status + * @throws ApiError + */ +export const renewLicenseKey = (data: RenewLicenseKeyData = {}): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/settings/renew_license_key', + query: { + license_key: data.licenseKey + } +}); }; + +/** + * create customer portal session + * @param data The data for the request. + * @param data.licenseKey + * @returns string url to portal + * @throws ApiError + */ +export const createCustomerPortalSession = (data: CreateCustomerPortalSessionData = {}): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/settings/customer_portal', + query: { + license_key: data.licenseKey + } +}); }; + +/** + * test metadata + * @param data The data for the request. + * @param data.requestBody test metadata + * @returns string status + * @throws ApiError + */ +export const testMetadata = (data: TestMetadataData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/saml/test_metadata', + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * list global settings + * @returns GlobalSetting list of settings + * @throws ApiError + */ +export const listGlobalSettings = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/settings/list_global' +}); }; + +/** + * get current user email (if logged in) + * @returns string user email + * @throws ApiError + */ +export const getCurrentEmail = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/users/email' +}); }; + +/** + * refresh the current token + * @returns string free usage + * @throws ApiError + */ +export const refreshUserToken = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/users/refresh_token' +}); }; + +/** + * get tutorial progress + * @returns unknown tutorial progress + * @throws ApiError + */ +export const getTutorialProgress = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/users/tutorial_progress' +}); }; + +/** + * update tutorial progress + * @param data The data for the request. + * @param data.requestBody progress update + * @returns string tutorial progress + * @throws ApiError + */ +export const updateTutorialProgress = (data: UpdateTutorialProgressData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/users/tutorial_progress', + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * leave instance + * @returns string status + * @throws ApiError + */ +export const leaveInstance = (): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/users/leave_instance' +}); }; + +/** + * get current usage outside of premium workspaces + * @returns number free usage + * @throws ApiError + */ +export const getUsage = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/users/usage' +}); }; + +/** + * get all runnables in every workspace + * @returns unknown free all runnables + * @throws ApiError + */ +export const getRunnable = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/users/all_runnables' +}); }; + +/** + * get current global whoami (if logged in) + * @returns GlobalUserInfo user email + * @throws ApiError + */ +export const globalWhoami = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/users/whoami' +}); }; + +/** + * list all workspace invites + * @returns WorkspaceInvite list all workspace invites + * @throws ApiError + */ +export const listWorkspaceInvites = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/users/list_invites' +}); }; + +/** + * whoami + * @param data The data for the request. + * @param data.workspace + * @returns User user + * @throws ApiError + */ +export const whoami = (data: WhoamiData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/users/whoami', + path: { + workspace: data.workspace + } +}); }; + +/** + * accept invite to workspace + * @param data The data for the request. + * @param data.requestBody accept invite + * @returns string status + * @throws ApiError + */ +export const acceptInvite = (data: AcceptInviteData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/users/accept_invite', + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * decline invite to workspace + * @param data The data for the request. + * @param data.requestBody decline invite + * @returns string status + * @throws ApiError + */ +export const declineInvite = (data: DeclineInviteData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/users/decline_invite', + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * invite user to workspace + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody WorkspaceInvite + * @returns string status + * @throws ApiError + */ +export const inviteUser = (data: InviteUserData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/invite_user', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * add user to workspace + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody WorkspaceInvite + * @returns string status + * @throws ApiError + */ +export const addUser = (data: AddUserData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/add_user', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * delete user invite + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody WorkspaceInvite + * @returns string status + * @throws ApiError + */ +export const deleteInvite = (data: DeleteInviteData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/delete_invite', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * archive workspace + * @param data The data for the request. + * @param data.workspace + * @returns string status + * @throws ApiError + */ +export const archiveWorkspace = (data: ArchiveWorkspaceData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/archive', + path: { + workspace: data.workspace + } +}); }; + +/** + * unarchive workspace + * @param data The data for the request. + * @param data.workspace + * @returns string status + * @throws ApiError + */ +export const unarchiveWorkspace = (data: UnarchiveWorkspaceData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/workspaces/unarchive/{workspace}', + path: { + workspace: data.workspace + } +}); }; + +/** + * delete workspace (require super admin) + * @param data The data for the request. + * @param data.workspace + * @returns string status + * @throws ApiError + */ +export const deleteWorkspace = (data: DeleteWorkspaceData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/workspaces/delete/{workspace}', + path: { + workspace: data.workspace + } +}); }; + +/** + * leave workspace + * @param data The data for the request. + * @param data.workspace + * @returns string status + * @throws ApiError + */ +export const leaveWorkspace = (data: LeaveWorkspaceData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/leave', + path: { + workspace: data.workspace + } +}); }; + +/** + * get workspace name + * @param data The data for the request. + * @param data.workspace + * @returns string status + * @throws ApiError + */ +export const getWorkspaceName = (data: GetWorkspaceNameData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/workspaces/get_workspace_name', + path: { + workspace: data.workspace + } +}); }; + +/** + * change workspace name + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody + * @returns string status + * @throws ApiError + */ +export const changeWorkspaceName = (data: ChangeWorkspaceNameData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/change_workspace_name', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * change workspace id + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody + * @returns string status + * @throws ApiError + */ +export const changeWorkspaceId = (data: ChangeWorkspaceIdData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/change_workspace_id', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * whois + * @param data The data for the request. + * @param data.workspace + * @param data.username + * @returns User user + * @throws ApiError + */ +export const whois = (data: WhoisData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/users/whois/{username}', + path: { + workspace: data.workspace, + username: data.username + } +}); }; + +/** + * exists email + * @param data The data for the request. + * @param data.email + * @returns boolean user + * @throws ApiError + */ +export const existsEmail = (data: ExistsEmailData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/users/exists/{email}', + path: { + email: data.email + } +}); }; + +/** + * list all users as super admin (require to be super amdin) + * @param data The data for the request. + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @returns GlobalUserInfo user + * @throws ApiError + */ +export const listUsersAsSuperAdmin = (data: ListUsersAsSuperAdminData = {}): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/users/list_as_super_admin', + query: { + page: data.page, + per_page: data.perPage + } +}); }; + +/** + * list pending invites for a workspace + * @param data The data for the request. + * @param data.workspace + * @returns WorkspaceInvite user + * @throws ApiError + */ +export const listPendingInvites = (data: ListPendingInvitesData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/workspaces/list_pending_invites', + path: { + workspace: data.workspace + } +}); }; + +/** + * get settings + * @param data The data for the request. + * @param data.workspace + * @returns unknown status + * @throws ApiError + */ +export const getSettings = (data: GetSettingsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/workspaces/get_settings', + path: { + workspace: data.workspace + } +}); }; + +/** + * get deploy to + * @param data The data for the request. + * @param data.workspace + * @returns unknown status + * @throws ApiError + */ +export const getDeployTo = (data: GetDeployToData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/workspaces/get_deploy_to', + path: { + workspace: data.workspace + } +}); }; + +/** + * get if workspace is premium + * @param data The data for the request. + * @param data.workspace + * @returns boolean status + * @throws ApiError + */ +export const getIsPremium = (data: GetIsPremiumData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/workspaces/is_premium', + path: { + workspace: data.workspace + } +}); }; + +/** + * get premium info + * @param data The data for the request. + * @param data.workspace + * @returns unknown status + * @throws ApiError + */ +export const getPremiumInfo = (data: GetPremiumInfoData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/workspaces/premium_info', + path: { + workspace: data.workspace + } +}); }; + +/** + * set automatic billing + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody automatic billing + * @returns string status + * @throws ApiError + */ +export const setAutomaticBilling = (data: SetAutomaticBillingData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/set_automatic_billing', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * edit slack command + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody WorkspaceInvite + * @returns string status + * @throws ApiError + */ +export const editSlackCommand = (data: EditSlackCommandData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/edit_slack_command', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * run a job that sends a message to Slack + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody path to hub script to run and its corresponding args + * @returns unknown status + * @throws ApiError + */ +export const runSlackMessageTestJob = (data: RunSlackMessageTestJobData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/run_slack_message_test_job', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * edit deploy to + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody + * @returns string status + * @throws ApiError + */ +export const editDeployTo = (data: EditDeployToData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/edit_deploy_to', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * edit auto invite + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody WorkspaceInvite + * @returns string status + * @throws ApiError + */ +export const editAutoInvite = (data: EditAutoInviteData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/edit_auto_invite', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * edit webhook + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody WorkspaceWebhook + * @returns string status + * @throws ApiError + */ +export const editWebhook = (data: EditWebhookData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/edit_webhook', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * edit copilot config + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody WorkspaceCopilotConfig + * @returns string status + * @throws ApiError + */ +export const editCopilotConfig = (data: EditCopilotConfigData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/edit_copilot_config', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * get copilot info + * @param data The data for the request. + * @param data.workspace + * @returns unknown status + * @throws ApiError + */ +export const getCopilotInfo = (data: GetCopilotInfoData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/workspaces/get_copilot_info', + path: { + workspace: data.workspace + } +}); }; + +/** + * edit error handler + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody WorkspaceErrorHandler + * @returns string status + * @throws ApiError + */ +export const editErrorHandler = (data: EditErrorHandlerData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/edit_error_handler', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * edit large file storage settings + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody LargeFileStorage info + * @returns unknown status + * @throws ApiError + */ +export const editLargeFileStorageConfig = (data: EditLargeFileStorageConfigData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/edit_large_file_storage_config', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * edit workspace git sync settings + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody Workspace Git sync settings + * @returns unknown status + * @throws ApiError + */ +export const editWorkspaceGitSyncConfig = (data: EditWorkspaceGitSyncConfigData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/edit_git_sync_config', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * edit workspace deploy ui settings + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody Workspace deploy UI settings + * @returns unknown status + * @throws ApiError + */ +export const editWorkspaceDeployUiSettings = (data: EditWorkspaceDeployUiSettingsData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/edit_deploy_ui_config', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * edit default app for workspace + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody Workspace default app + * @returns string status + * @throws ApiError + */ +export const editWorkspaceDefaultApp = (data: EditWorkspaceDefaultAppData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/edit_default_app', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * edit default scripts for workspace + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody Workspace default app + * @returns string status + * @throws ApiError + */ +export const editDefaultScripts = (data: EditDefaultScriptsData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/default_scripts', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * get default scripts for workspace + * @param data The data for the request. + * @param data.workspace + * @returns WorkspaceDefaultScripts status + * @throws ApiError + */ +export const getDefaultScripts = (data: GetDefaultScriptsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/workspaces/default_scripts', + path: { + workspace: data.workspace + } +}); }; + +/** + * set environment variable + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody Workspace default app + * @returns string status + * @throws ApiError + */ +export const setEnvironmentVariable = (data: SetEnvironmentVariableData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/set_environment_variable', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * retrieves the encryption key for this workspace + * @param data The data for the request. + * @param data.workspace + * @returns unknown status + * @throws ApiError + */ +export const getWorkspaceEncryptionKey = (data: GetWorkspaceEncryptionKeyData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/workspaces/encryption_key', + path: { + workspace: data.workspace + } +}); }; + +/** + * update the encryption key for this workspace + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody New encryption key + * @returns string status + * @throws ApiError + */ +export const setWorkspaceEncryptionKey = (data: SetWorkspaceEncryptionKeyData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/workspaces/encryption_key', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * get default app for workspace + * @param data The data for the request. + * @param data.workspace + * @returns unknown status + * @throws ApiError + */ +export const getWorkspaceDefaultApp = (data: GetWorkspaceDefaultAppData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/workspaces/default_app', + path: { + workspace: data.workspace + } +}); }; + +/** + * get large file storage config + * @param data The data for the request. + * @param data.workspace + * @returns LargeFileStorage status + * @throws ApiError + */ +export const getLargeFileStorageConfig = (data: GetLargeFileStorageConfigData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/workspaces/get_large_file_storage_config', + path: { + workspace: data.workspace + } +}); }; + +/** + * get usage + * @param data The data for the request. + * @param data.workspace + * @returns number usage + * @throws ApiError + */ +export const getWorkspaceUsage = (data: GetWorkspaceUsageData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/workspaces/usage', + path: { + workspace: data.workspace + } +}); }; + +/** + * list users + * @param data The data for the request. + * @param data.workspace + * @returns User user + * @throws ApiError + */ +export const listUsers = (data: ListUsersData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/users/list', + path: { + workspace: data.workspace + } +}); }; + +/** + * list users usage + * @param data The data for the request. + * @param data.workspace + * @returns UserUsage user + * @throws ApiError + */ +export const listUsersUsage = (data: ListUsersUsageData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/users/list_usage', + path: { + workspace: data.workspace + } +}); }; + +/** + * list usernames + * @param data The data for the request. + * @param data.workspace + * @returns string user + * @throws ApiError + */ +export const listUsernames = (data: ListUsernamesData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/users/list_usernames', + path: { + workspace: data.workspace + } +}); }; + +/** + * get email from username + * @param data The data for the request. + * @param data.workspace + * @param data.username + * @returns string email + * @throws ApiError + */ +export const usernameToEmail = (data: UsernameToEmailData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/users/username_to_email/{username}', + path: { + workspace: data.workspace, + username: data.username + } +}); }; + +/** + * create token + * @param data The data for the request. + * @param data.requestBody new token + * @returns string token created + * @throws ApiError + */ +export const createToken = (data: CreateTokenData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/users/tokens/create', + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * create token to impersonate a user (require superadmin) + * @param data The data for the request. + * @param data.requestBody new token + * @returns string token created + * @throws ApiError + */ +export const createTokenImpersonate = (data: CreateTokenImpersonateData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/users/tokens/impersonate', + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * delete token + * @param data The data for the request. + * @param data.tokenPrefix + * @returns string delete token + * @throws ApiError + */ +export const deleteToken = (data: DeleteTokenData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/users/tokens/delete/{token_prefix}', + path: { + token_prefix: data.tokenPrefix + } +}); }; + +/** + * list token + * @param data The data for the request. + * @param data.excludeEphemeral + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @returns TruncatedToken truncated token + * @throws ApiError + */ +export const listTokens = (data: ListTokensData = {}): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/users/tokens/list', + query: { + exclude_ephemeral: data.excludeEphemeral, + page: data.page, + per_page: data.perPage + } +}); }; + +/** + * get OIDC token (ee only) + * @param data The data for the request. + * @param data.workspace + * @param data.audience + * @returns string new oidc token + * @throws ApiError + */ +export const getOidcToken = (data: GetOidcTokenData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/oidc/token/{audience}', + path: { + workspace: data.workspace, + audience: data.audience + } +}); }; + +/** + * create variable + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody new variable + * @param data.alreadyEncrypted + * @returns string variable created + * @throws ApiError + */ +export const createVariable = (data: CreateVariableData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/variables/create', + path: { + workspace: data.workspace + }, + query: { + already_encrypted: data.alreadyEncrypted + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * encrypt value + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody new variable + * @returns string encrypted value + * @throws ApiError + */ +export const encryptValue = (data: EncryptValueData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/variables/encrypt', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * delete variable + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns string variable deleted + * @throws ApiError + */ +export const deleteVariable = (data: DeleteVariableData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/w/{workspace}/variables/delete/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * update variable + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.requestBody updated variable + * @param data.alreadyEncrypted + * @returns string variable updated + * @throws ApiError + */ +export const updateVariable = (data: UpdateVariableData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/variables/update/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + query: { + already_encrypted: data.alreadyEncrypted + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * get variable + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.decryptSecret ask to decrypt secret if this variable is secret + * (if not secret no effect, default: true) + * + * @param data.includeEncrypted ask to include the encrypted value if secret and decrypt secret is not true (default: false) + * + * @returns ListableVariable variable + * @throws ApiError + */ +export const getVariable = (data: GetVariableData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/variables/get/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + query: { + decrypt_secret: data.decryptSecret, + include_encrypted: data.includeEncrypted + } +}); }; + +/** + * get variable value + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns string variable + * @throws ApiError + */ +export const getVariableValue = (data: GetVariableValueData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/variables/get_value/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * does variable exists at path + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns boolean variable + * @throws ApiError + */ +export const existsVariable = (data: ExistsVariableData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/variables/exists/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * list variables + * @param data The data for the request. + * @param data.workspace + * @param data.pathStart + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @returns ListableVariable variable list + * @throws ApiError + */ +export const listVariable = (data: ListVariableData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/variables/list', + path: { + workspace: data.workspace + }, + query: { + path_start: data.pathStart, + page: data.page, + per_page: data.perPage + } +}); }; + +/** + * list contextual variables + * @param data The data for the request. + * @param data.workspace + * @returns ContextualVariable contextual variable list + * @throws ApiError + */ +export const listContextualVariables = (data: ListContextualVariablesData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/variables/list_contextual', + path: { + workspace: data.workspace + } +}); }; + +/** + * login with oauth authorization flow + * @param data The data for the request. + * @param data.clientName + * @param data.requestBody Partially filled script + * @returns string Successfully authenticated. The session ID is returned in a cookie named `token` and as plaintext response. Preferred method of authorization is through the bearer token. The cookie is only for browser convenience. + * + * @throws ApiError + */ +export const loginWithOauth = (data: LoginWithOauthData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/oauth/login_callback/{client_name}', + path: { + client_name: data.clientName + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * connect slack callback + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody code endpoint + * @returns string slack token + * @throws ApiError + */ +export const connectSlackCallback = (data: ConnectSlackCallbackData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/oauth/connect_slack_callback', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * connect slack callback instance + * @param data The data for the request. + * @param data.requestBody code endpoint + * @returns string success message + * @throws ApiError + */ +export const connectSlackCallbackInstance = (data: ConnectSlackCallbackInstanceData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/oauth/connect_slack_callback', + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * connect callback + * @param data The data for the request. + * @param data.clientName + * @param data.requestBody code endpoint + * @returns TokenResponse oauth token + * @throws ApiError + */ +export const connectCallback = (data: ConnectCallbackData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/oauth/connect_callback/{client_name}', + path: { + client_name: data.clientName + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * create OAuth account + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody code endpoint + * @returns string account set + * @throws ApiError + */ +export const createAccount = (data: CreateAccountData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/oauth/create_account', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * refresh token + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @param data.requestBody variable path + * @returns string token refreshed + * @throws ApiError + */ +export const refreshToken = (data: RefreshTokenData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/oauth/refresh_token/{id}', + path: { + workspace: data.workspace, + id: data.id + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * disconnect account + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @returns string disconnected client + * @throws ApiError + */ +export const disconnectAccount = (data: DisconnectAccountData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/oauth/disconnect/{id}', + path: { + workspace: data.workspace, + id: data.id + } +}); }; + +/** + * disconnect slack + * @param data The data for the request. + * @param data.workspace + * @returns string disconnected slack + * @throws ApiError + */ +export const disconnectSlack = (data: DisconnectSlackData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/oauth/disconnect_slack', + path: { + workspace: data.workspace + } +}); }; + +/** + * list oauth logins + * @returns unknown list of oauth and saml login clients + * @throws ApiError + */ +export const listOauthLogins = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/oauth/list_logins' +}); }; + +/** + * list oauth connects + * @returns string list of oauth connects clients + * @throws ApiError + */ +export const listOauthConnects = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/oauth/list_connects' +}); }; + +/** + * get oauth connect + * @param data The data for the request. + * @param data.client client name + * @returns unknown get + * @throws ApiError + */ +export const getOauthConnect = (data: GetOauthConnectData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/oauth/get_connect/{client}', + path: { + client: data.client + } +}); }; + +/** + * create resource + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody new resource + * @param data.updateIfExists + * @returns string resource created + * @throws ApiError + */ +export const createResource = (data: CreateResourceData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/resources/create', + path: { + workspace: data.workspace + }, + query: { + update_if_exists: data.updateIfExists + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * delete resource + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns string resource deleted + * @throws ApiError + */ +export const deleteResource = (data: DeleteResourceData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/w/{workspace}/resources/delete/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * update resource + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.requestBody updated resource + * @returns string resource updated + * @throws ApiError + */ +export const updateResource = (data: UpdateResourceData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/resources/update/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * update resource value + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.requestBody updated resource + * @returns string resource value updated + * @throws ApiError + */ +export const updateResourceValue = (data: UpdateResourceValueData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/resources/update_value/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * get resource + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns Resource resource + * @throws ApiError + */ +export const getResource = (data: GetResourceData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/resources/get/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * get resource interpolated (variables and resources are fully unrolled) + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.jobId job id + * @returns unknown resource value + * @throws ApiError + */ +export const getResourceValueInterpolated = (data: GetResourceValueInterpolatedData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/resources/get_value_interpolated/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + query: { + job_id: data.jobId + } +}); }; + +/** + * get resource value + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns unknown resource value + * @throws ApiError + */ +export const getResourceValue = (data: GetResourceValueData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/resources/get_value/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * does resource exists + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns boolean does resource exists + * @throws ApiError + */ +export const existsResource = (data: ExistsResourceData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/resources/exists/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * list resources + * @param data The data for the request. + * @param data.workspace + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @param data.resourceType resource_types to list from, separated by ',', + * @param data.resourceTypeExclude resource_types to not list from, separated by ',', + * @param data.pathStart + * @returns ListableResource resource list + * @throws ApiError + */ +export const listResource = (data: ListResourceData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/resources/list', + path: { + workspace: data.workspace + }, + query: { + page: data.page, + per_page: data.perPage, + resource_type: data.resourceType, + resource_type_exclude: data.resourceTypeExclude, + path_start: data.pathStart + } +}); }; + +/** + * list resources for search + * @param data The data for the request. + * @param data.workspace + * @returns unknown resource list + * @throws ApiError + */ +export const listSearchResource = (data: ListSearchResourceData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/resources/list_search', + path: { + workspace: data.workspace + } +}); }; + +/** + * list resource names + * @param data The data for the request. + * @param data.workspace + * @param data.name + * @returns unknown resource list names + * @throws ApiError + */ +export const listResourceNames = (data: ListResourceNamesData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/resources/list_names/{name}', + path: { + workspace: data.workspace, + name: data.name + } +}); }; + +/** + * create resource_type + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody new resource_type + * @returns string resource_type created + * @throws ApiError + */ +export const createResourceType = (data: CreateResourceTypeData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/resources/type/create', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * get map from resource type to format extension + * @param data The data for the request. + * @param data.workspace + * @returns unknown map from resource type to file ext + * @throws ApiError + */ +export const fileResourceTypeToFileExtMap = (data: FileResourceTypeToFileExtMapData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/resources/file_resource_type_to_file_ext_map', + path: { + workspace: data.workspace + } +}); }; + +/** + * delete resource_type + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns string resource_type deleted + * @throws ApiError + */ +export const deleteResourceType = (data: DeleteResourceTypeData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/w/{workspace}/resources/type/delete/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * update resource_type + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.requestBody updated resource_type + * @returns string resource_type updated + * @throws ApiError + */ +export const updateResourceType = (data: UpdateResourceTypeData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/resources/type/update/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * get resource_type + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns ResourceType resource_type deleted + * @throws ApiError + */ +export const getResourceType = (data: GetResourceTypeData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/resources/type/get/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * does resource_type exists + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns boolean does resource_type exist + * @throws ApiError + */ +export const existsResourceType = (data: ExistsResourceTypeData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/resources/type/exists/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * list resource_types + * @param data The data for the request. + * @param data.workspace + * @returns ResourceType resource_type list + * @throws ApiError + */ +export const listResourceType = (data: ListResourceTypeData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/resources/type/list', + path: { + workspace: data.workspace + } +}); }; + +/** + * list resource_types names + * @param data The data for the request. + * @param data.workspace + * @returns string resource_type list + * @throws ApiError + */ +export const listResourceTypeNames = (data: ListResourceTypeNamesData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/resources/type/listnames', + path: { + workspace: data.workspace + } +}); }; + +/** + * query resource types by similarity + * @param data The data for the request. + * @param data.workspace + * @param data.text query text + * @param data.limit query limit + * @returns unknown resource type details + * @throws ApiError + */ +export const queryResourceTypes = (data: QueryResourceTypesData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/embeddings/query_resource_types', + path: { + workspace: data.workspace + }, + query: { + text: data.text, + limit: data.limit + } +}); }; + +/** + * list hub integrations + * @param data The data for the request. + * @param data.kind query integrations kind + * @returns unknown integrations details + * @throws ApiError + */ +export const listHubIntegrations = (data: ListHubIntegrationsData = {}): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/integrations/hub/list', + query: { + kind: data.kind + } +}); }; + +/** + * list all hub flows + * @returns unknown hub flows list + * @throws ApiError + */ +export const listHubFlows = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/flows/hub/list' +}); }; + +/** + * get hub flow by id + * @param data The data for the request. + * @param data.id + * @returns unknown flow + * @throws ApiError + */ +export const getHubFlowById = (data: GetHubFlowByIdData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/flows/hub/get/{id}', + path: { + id: data.id + } +}); }; + +/** + * list all hub apps + * @returns unknown hub apps list + * @throws ApiError + */ +export const listHubApps = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/apps/hub/list' +}); }; + +/** + * get hub app by id + * @param data The data for the request. + * @param data.id + * @returns unknown app + * @throws ApiError + */ +export const getHubAppById = (data: GetHubAppByIdData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/apps/hub/get/{id}', + path: { + id: data.id + } +}); }; + +/** + * get hub script content by path + * @param data The data for the request. + * @param data.path + * @returns string script details + * @throws ApiError + */ +export const getHubScriptContentByPath = (data: GetHubScriptContentByPathData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/scripts/hub/get/{path}', + path: { + path: data.path + } +}); }; + +/** + * get full hub script by path + * @param data The data for the request. + * @param data.path + * @returns unknown script details + * @throws ApiError + */ +export const getHubScriptByPath = (data: GetHubScriptByPathData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/scripts/hub/get_full/{path}', + path: { + path: data.path + } +}); }; + +/** + * get top hub scripts + * @param data The data for the request. + * @param data.limit query limit + * @param data.app query scripts app + * @param data.kind query scripts kind + * @returns unknown hub scripts list + * @throws ApiError + */ +export const getTopHubScripts = (data: GetTopHubScriptsData = {}): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/scripts/hub/top', + query: { + limit: data.limit, + app: data.app, + kind: data.kind + } +}); }; + +/** + * query hub scripts by similarity + * @param data The data for the request. + * @param data.text query text + * @param data.kind query scripts kind + * @param data.limit query limit + * @param data.app query scripts app + * @returns unknown script details + * @throws ApiError + */ +export const queryHubScripts = (data: QueryHubScriptsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/embeddings/query_hub_scripts', + query: { + text: data.text, + kind: data.kind, + limit: data.limit, + app: data.app + } +}); }; + +/** + * list scripts for search + * @param data The data for the request. + * @param data.workspace + * @returns unknown script list + * @throws ApiError + */ +export const listSearchScript = (data: ListSearchScriptData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/scripts/list_search', + path: { + workspace: data.workspace + } +}); }; + +/** + * list all scripts + * @param data The data for the request. + * @param data.workspace + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @param data.orderDesc order by desc order (default true) + * @param data.createdBy mask to filter exact matching user creator + * @param data.pathStart mask to filter matching starting path + * @param data.pathExact mask to filter exact matching path + * @param data.firstParentHash mask to filter scripts whom first direct parent has exact hash + * @param data.lastParentHash mask to filter scripts whom last parent in the chain has exact hash. + * Beware that each script stores only a limited number of parents. Hence + * the last parent hash for a script is not necessarily its top-most parent. + * To find the top-most parent you will have to jump from last to last hash + * until finding the parent + * + * @param data.parentHash is the hash present in the array of stored parent hashes for this script. + * The same warning applies than for last_parent_hash. A script only store a + * limited number of direct parent + * + * @param data.showArchived (default false) + * show only the archived files. + * when multiple archived hash share the same path, only the ones with the latest create_at + * are + * ed. + * + * @param data.includeWithoutMain (default false) + * include scripts without an exported main function + * + * @param data.includeDraftOnly (default false) + * include scripts that have no deployed version + * + * @param data.isTemplate (default regardless) + * if true show only the templates + * if false show only the non templates + * if not defined, show all regardless of if the script is a template + * + * @param data.kinds (default regardless) + * script kinds to filter, split by comma + * + * @param data.starredOnly (default false) + * show only the starred items + * + * @param data.withDeploymentMsg (default false) + * include deployment message + * + * @returns Script All scripts + * @throws ApiError + */ +export const listScripts = (data: ListScriptsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/scripts/list', + path: { + workspace: data.workspace + }, + query: { + page: data.page, + per_page: data.perPage, + order_desc: data.orderDesc, + created_by: data.createdBy, + path_start: data.pathStart, + path_exact: data.pathExact, + first_parent_hash: data.firstParentHash, + last_parent_hash: data.lastParentHash, + parent_hash: data.parentHash, + show_archived: data.showArchived, + include_without_main: data.includeWithoutMain, + include_draft_only: data.includeDraftOnly, + is_template: data.isTemplate, + kinds: data.kinds, + starred_only: data.starredOnly, + with_deployment_msg: data.withDeploymentMsg + } +}); }; + +/** + * list all scripts paths + * @param data The data for the request. + * @param data.workspace + * @returns string list of script paths + * @throws ApiError + */ +export const listScriptPaths = (data: ListScriptPathsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/scripts/list_paths', + path: { + workspace: data.workspace + } +}); }; + +/** + * create draft + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody + * @returns string draft created + * @throws ApiError + */ +export const createDraft = (data: CreateDraftData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/drafts/create', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * delete draft + * @param data The data for the request. + * @param data.workspace + * @param data.kind + * @param data.path + * @returns string draft deleted + * @throws ApiError + */ +export const deleteDraft = (data: DeleteDraftData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/w/{workspace}/drafts/delete/{kind}/{path}', + path: { + workspace: data.workspace, + kind: data.kind, + path: data.path + } +}); }; + +/** + * create script + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody Partially filled script + * @returns string script created + * @throws ApiError + */ +export const createScript = (data: CreateScriptData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/scripts/create', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * Toggle ON and OFF the workspace error handler for a given script + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.requestBody Workspace error handler enabled + * @returns string error handler toggled + * @throws ApiError + */ +export const toggleWorkspaceErrorHandlerForScript = (data: ToggleWorkspaceErrorHandlerForScriptData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/scripts/toggle_workspace_error_handler/p/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * get all instance custom tags (tags are used to dispatch jobs to different worker groups) + * @returns string list of custom tags + * @throws ApiError + */ +export const getCustomTags = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/workers/custom_tags' +}); }; + +/** + * get all instance default tags + * @returns string list of default tags + * @throws ApiError + */ +export const geDefaultTags = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/workers/get_default_tags' +}); }; + +/** + * is default tags per workspace + * @returns boolean is the default tags per workspace + * @throws ApiError + */ +export const isDefaultTagsPerWorkspace = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/workers/is_default_tags_per_workspace' +}); }; + +/** + * archive script by path + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns string script archived + * @throws ApiError + */ +export const archiveScriptByPath = (data: ArchiveScriptByPathData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/scripts/archive/p/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * archive script by hash + * @param data The data for the request. + * @param data.workspace + * @param data.hash + * @returns Script script details + * @throws ApiError + */ +export const archiveScriptByHash = (data: ArchiveScriptByHashData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/scripts/archive/h/{hash}', + path: { + workspace: data.workspace, + hash: data.hash + } +}); }; + +/** + * delete script by hash (erase content but keep hash, require admin) + * @param data The data for the request. + * @param data.workspace + * @param data.hash + * @returns Script script details + * @throws ApiError + */ +export const deleteScriptByHash = (data: DeleteScriptByHashData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/scripts/delete/h/{hash}', + path: { + workspace: data.workspace, + hash: data.hash + } +}); }; + +/** + * delete all scripts at a given path (require admin) + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns string script path + * @throws ApiError + */ +export const deleteScriptByPath = (data: DeleteScriptByPathData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/scripts/delete/p/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * get script by path + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.withStarredInfo + * @returns Script script details + * @throws ApiError + */ +export const getScriptByPath = (data: GetScriptByPathData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/scripts/get/p/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + query: { + with_starred_info: data.withStarredInfo + } +}); }; + +/** + * get script by path with draft + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns NewScriptWithDraft script details + * @throws ApiError + */ +export const getScriptByPathWithDraft = (data: GetScriptByPathWithDraftData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/scripts/get/draft/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * get history of a script by path + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns ScriptHistory script history + * @throws ApiError + */ +export const getScriptHistoryByPath = (data: GetScriptHistoryByPathData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/scripts/history/p/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * update history of a script + * @param data The data for the request. + * @param data.workspace + * @param data.hash + * @param data.path + * @param data.requestBody Script deployment message + * @returns string success + * @throws ApiError + */ +export const updateScriptHistory = (data: UpdateScriptHistoryData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/scripts/history_update/h/{hash}/p/{path}', + path: { + workspace: data.workspace, + hash: data.hash, + path: data.path + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * raw script by path + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns string script content + * @throws ApiError + */ +export const rawScriptByPath = (data: RawScriptByPathData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/scripts/raw/p/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * raw script by path with a token (mostly used by lsp to be used with import maps to resolve scripts) + * @param data The data for the request. + * @param data.workspace + * @param data.token + * @param data.path + * @returns string script content + * @throws ApiError + */ +export const rawScriptByPathTokened = (data: RawScriptByPathTokenedData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/scripts_u/tokened_raw/{workspace}/{token}/{path}', + path: { + workspace: data.workspace, + token: data.token, + path: data.path + } +}); }; + +/** + * exists script by path + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns boolean does it exists + * @throws ApiError + */ +export const existsScriptByPath = (data: ExistsScriptByPathData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/scripts/exists/p/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * get script by hash + * @param data The data for the request. + * @param data.workspace + * @param data.hash + * @param data.withStarredInfo + * @returns Script script details + * @throws ApiError + */ +export const getScriptByHash = (data: GetScriptByHashData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/scripts/get/h/{hash}', + path: { + workspace: data.workspace, + hash: data.hash + }, + query: { + with_starred_info: data.withStarredInfo + } +}); }; + +/** + * raw script by hash + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns string script content + * @throws ApiError + */ +export const rawScriptByHash = (data: RawScriptByHashData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/scripts/raw/h/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * get script deployment status + * @param data The data for the request. + * @param data.workspace + * @param data.hash + * @returns unknown script details + * @throws ApiError + */ +export const getScriptDeploymentStatus = (data: GetScriptDeploymentStatusData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/scripts/deployment_status/h/{hash}', + path: { + workspace: data.workspace, + hash: data.hash + } +}); }; + +/** + * run script by path + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.requestBody script args + * @param data.scheduledFor when to schedule this job (leave empty for immediate run) + * @param data.scheduledInSecs schedule the script to execute in the number of seconds starting now + * @param data.skipPreprocessor skip the preprocessor + * @param data.parentJob The parent job that is at the origin and responsible for the execution of this script if any + * @param data.tag Override the tag to use + * @param data.cacheTtl Override the cache time to live (in seconds). Can not be used to disable caching, only override with a new cache ttl + * @param data.jobId The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) + * @param data.invisibleToOwner make the run invisible to the the script owner (default false) + * @returns string job created + * @throws ApiError + */ +export const runScriptByPath = (data: RunScriptByPathData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/jobs/run/p/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + query: { + scheduled_for: data.scheduledFor, + scheduled_in_secs: data.scheduledInSecs, + skip_preprocessor: data.skipPreprocessor, + parent_job: data.parentJob, + tag: data.tag, + cache_ttl: data.cacheTtl, + job_id: data.jobId, + invisible_to_owner: data.invisibleToOwner + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * run script by path in openai format + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.requestBody script args + * @param data.parentJob The parent job that is at the origin and responsible for the execution of this script if any + * @param data.jobId The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) + * @param data.includeHeader List of headers's keys (separated with ',') whove value are added to the args + * Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key + * + * @param data.queueLimit The maximum size of the queue for which the request would get rejected if that job would push it above that limit + * + * @returns unknown job result + * @throws ApiError + */ +export const openaiSyncScriptByPath = (data: OpenaiSyncScriptByPathData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/jobs/openai_sync/p/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + query: { + parent_job: data.parentJob, + job_id: data.jobId, + include_header: data.includeHeader, + queue_limit: data.queueLimit + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * run script by path + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.requestBody script args + * @param data.parentJob The parent job that is at the origin and responsible for the execution of this script if any + * @param data.tag Override the tag to use + * @param data.cacheTtl Override the cache time to live (in seconds). Can not be used to disable caching, only override with a new cache ttl + * @param data.jobId The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) + * @param data.includeHeader List of headers's keys (separated with ',') whove value are added to the args + * Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key + * + * @param data.queueLimit The maximum size of the queue for which the request would get rejected if that job would push it above that limit + * + * @returns unknown job result + * @throws ApiError + */ +export const runWaitResultScriptByPath = (data: RunWaitResultScriptByPathData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/jobs/run_wait_result/p/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + query: { + parent_job: data.parentJob, + tag: data.tag, + cache_ttl: data.cacheTtl, + job_id: data.jobId, + include_header: data.includeHeader, + queue_limit: data.queueLimit + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * run script by path with get + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.parentJob The parent job that is at the origin and responsible for the execution of this script if any + * @param data.tag Override the tag to use + * @param data.cacheTtl Override the cache time to live (in seconds). Can not be used to disable caching, only override with a new cache ttl + * @param data.jobId The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) + * @param data.includeHeader List of headers's keys (separated with ',') whove value are added to the args + * Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key + * + * @param data.queueLimit The maximum size of the queue for which the request would get rejected if that job would push it above that limit + * + * @param data.payload The base64 encoded payload that has been encoded as a JSON. e.g how to encode such payload encodeURIComponent + * `encodeURIComponent(btoa(JSON.stringify({a: 2})))` + * + * @returns unknown job result + * @throws ApiError + */ +export const runWaitResultScriptByPathGet = (data: RunWaitResultScriptByPathGetData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs/run_wait_result/p/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + query: { + parent_job: data.parentJob, + tag: data.tag, + cache_ttl: data.cacheTtl, + job_id: data.jobId, + include_header: data.includeHeader, + queue_limit: data.queueLimit, + payload: data.payload + } +}); }; + +/** + * run flow by path and wait until completion in openai format + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.requestBody script args + * @param data.includeHeader List of headers's keys (separated with ',') whove value are added to the args + * Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key + * + * @param data.queueLimit The maximum size of the queue for which the request would get rejected if that job would push it above that limit + * + * @param data.jobId The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) + * @returns unknown job result + * @throws ApiError + */ +export const openaiSyncFlowByPath = (data: OpenaiSyncFlowByPathData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/jobs/openai_sync/f/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + query: { + include_header: data.includeHeader, + queue_limit: data.queueLimit, + job_id: data.jobId + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * run flow by path and wait until completion + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.requestBody script args + * @param data.includeHeader List of headers's keys (separated with ',') whove value are added to the args + * Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key + * + * @param data.queueLimit The maximum size of the queue for which the request would get rejected if that job would push it above that limit + * + * @param data.jobId The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) + * @returns unknown job result + * @throws ApiError + */ +export const runWaitResultFlowByPath = (data: RunWaitResultFlowByPathData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/jobs/run_wait_result/f/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + query: { + include_header: data.includeHeader, + queue_limit: data.queueLimit, + job_id: data.jobId + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * get job result by id + * @param data The data for the request. + * @param data.workspace + * @param data.flowJobId + * @param data.nodeId + * @returns unknown job result + * @throws ApiError + */ +export const resultById = (data: ResultByIdData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs/result_by_id/{flow_job_id}/{node_id}', + path: { + workspace: data.workspace, + flow_job_id: data.flowJobId, + node_id: data.nodeId + } +}); }; + +/** + * list all flow paths + * @param data The data for the request. + * @param data.workspace + * @returns string list of flow paths + * @throws ApiError + */ +export const listFlowPaths = (data: ListFlowPathsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/flows/list_paths', + path: { + workspace: data.workspace + } +}); }; + +/** + * list flows for search + * @param data The data for the request. + * @param data.workspace + * @returns unknown flow list + * @throws ApiError + */ +export const listSearchFlow = (data: ListSearchFlowData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/flows/list_search', + path: { + workspace: data.workspace + } +}); }; + +/** + * list all flows + * @param data The data for the request. + * @param data.workspace + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @param data.orderDesc order by desc order (default true) + * @param data.createdBy mask to filter exact matching user creator + * @param data.pathStart mask to filter matching starting path + * @param data.pathExact mask to filter exact matching path + * @param data.showArchived (default false) + * show only the archived files. + * when multiple archived hash share the same path, only the ones with the latest create_at + * are displayed. + * + * @param data.starredOnly (default false) + * show only the starred items + * + * @param data.includeDraftOnly (default false) + * include items that have no deployed version + * + * @param data.withDeploymentMsg (default false) + * include deployment message + * + * @returns unknown All flow + * @throws ApiError + */ +export const listFlows = (data: ListFlowsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/flows/list', + path: { + workspace: data.workspace + }, + query: { + page: data.page, + per_page: data.perPage, + order_desc: data.orderDesc, + created_by: data.createdBy, + path_start: data.pathStart, + path_exact: data.pathExact, + show_archived: data.showArchived, + starred_only: data.starredOnly, + include_draft_only: data.includeDraftOnly, + with_deployment_msg: data.withDeploymentMsg + } +}); }; + +/** + * get flow history by path + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns FlowVersion Flow history + * @throws ApiError + */ +export const getFlowHistory = (data: GetFlowHistoryData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/flows/history/p/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * get flow version + * @param data The data for the request. + * @param data.workspace + * @param data.version + * @param data.path + * @returns Flow flow details + * @throws ApiError + */ +export const getFlowVersion = (data: GetFlowVersionData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/flows/get/v/{version}/p/{path}', + path: { + workspace: data.workspace, + version: data.version, + path: data.path + } +}); }; + +/** + * update flow history + * @param data The data for the request. + * @param data.workspace + * @param data.version + * @param data.path + * @param data.requestBody Flow deployment message + * @returns string success + * @throws ApiError + */ +export const updateFlowHistory = (data: UpdateFlowHistoryData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/flows/history_update/v/{version}/p/{path}', + path: { + workspace: data.workspace, + version: data.version, + path: data.path + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * get flow by path + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.withStarredInfo + * @returns Flow flow details + * @throws ApiError + */ +export const getFlowByPath = (data: GetFlowByPathData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/flows/get/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + query: { + with_starred_info: data.withStarredInfo + } +}); }; + +/** + * Toggle ON and OFF the workspace error handler for a given flow + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.requestBody Workspace error handler enabled + * @returns string error handler toggled + * @throws ApiError + */ +export const toggleWorkspaceErrorHandlerForFlow = (data: ToggleWorkspaceErrorHandlerForFlowData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/flows/toggle_workspace_error_handler/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * get flow by path with draft + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns unknown flow details with draft + * @throws ApiError + */ +export const getFlowByPathWithDraft = (data: GetFlowByPathWithDraftData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/flows/get/draft/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * exists flow by path + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns boolean flow details + * @throws ApiError + */ +export const existsFlowByPath = (data: ExistsFlowByPathData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/flows/exists/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * create flow + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody Partially filled flow + * @returns string flow created + * @throws ApiError + */ +export const createFlow = (data: CreateFlowData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/flows/create', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * update flow + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.requestBody Partially filled flow + * @returns string flow updated + * @throws ApiError + */ +export const updateFlow = (data: UpdateFlowData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/flows/update/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * archive flow by path + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.requestBody archiveFlow + * @returns string flow archived + * @throws ApiError + */ +export const archiveFlowByPath = (data: ArchiveFlowByPathData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/flows/archive/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * delete flow by path + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns string flow delete + * @throws ApiError + */ +export const deleteFlowByPath = (data: DeleteFlowByPathData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/w/{workspace}/flows/delete/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * list all raw apps + * @param data The data for the request. + * @param data.workspace + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @param data.orderDesc order by desc order (default true) + * @param data.createdBy mask to filter exact matching user creator + * @param data.pathStart mask to filter matching starting path + * @param data.pathExact mask to filter exact matching path + * @param data.starredOnly (default false) + * show only the starred items + * + * @returns ListableRawApp All raw apps + * @throws ApiError + */ +export const listRawApps = (data: ListRawAppsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/raw_apps/list', + path: { + workspace: data.workspace + }, + query: { + page: data.page, + per_page: data.perPage, + order_desc: data.orderDesc, + created_by: data.createdBy, + path_start: data.pathStart, + path_exact: data.pathExact, + starred_only: data.starredOnly + } +}); }; + +/** + * does an app exisst at path + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns boolean app exists + * @throws ApiError + */ +export const existsRawApp = (data: ExistsRawAppData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/raw_apps/exists/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * get app by path + * @param data The data for the request. + * @param data.workspace + * @param data.version + * @param data.path + * @returns string app details + * @throws ApiError + */ +export const getRawAppData = (data: GetRawAppDataData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/apps/get_data/{version}/{path}', + path: { + workspace: data.workspace, + version: data.version, + path: data.path + } +}); }; + +/** + * list apps for search + * @param data The data for the request. + * @param data.workspace + * @returns unknown app list + * @throws ApiError + */ +export const listSearchApp = (data: ListSearchAppData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/apps/list_search', + path: { + workspace: data.workspace + } +}); }; + +/** + * list all apps + * @param data The data for the request. + * @param data.workspace + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @param data.orderDesc order by desc order (default true) + * @param data.createdBy mask to filter exact matching user creator + * @param data.pathStart mask to filter matching starting path + * @param data.pathExact mask to filter exact matching path + * @param data.starredOnly (default false) + * show only the starred items + * + * @param data.includeDraftOnly (default false) + * include items that have no deployed version + * + * @param data.withDeploymentMsg (default false) + * include deployment message + * + * @returns ListableApp All apps + * @throws ApiError + */ +export const listApps = (data: ListAppsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/apps/list', + path: { + workspace: data.workspace + }, + query: { + page: data.page, + per_page: data.perPage, + order_desc: data.orderDesc, + created_by: data.createdBy, + path_start: data.pathStart, + path_exact: data.pathExact, + starred_only: data.starredOnly, + include_draft_only: data.includeDraftOnly, + with_deployment_msg: data.withDeploymentMsg + } +}); }; + +/** + * create app + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody new app + * @returns string app created + * @throws ApiError + */ +export const createApp = (data: CreateAppData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/apps/create', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * does an app exisst at path + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns boolean app exists + * @throws ApiError + */ +export const existsApp = (data: ExistsAppData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/apps/exists/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * get app by path + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.withStarredInfo + * @returns AppWithLastVersion app details + * @throws ApiError + */ +export const getAppByPath = (data: GetAppByPathData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/apps/get/p/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + query: { + with_starred_info: data.withStarredInfo + } +}); }; + +/** + * get app by path with draft + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns AppWithLastVersionWDraft app details with draft + * @throws ApiError + */ +export const getAppByPathWithDraft = (data: GetAppByPathWithDraftData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/apps/get/draft/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * get app history by path + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns AppHistory app history + * @throws ApiError + */ +export const getAppHistoryByPath = (data: GetAppHistoryByPathData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/apps/history/p/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * update app history + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @param data.version + * @param data.requestBody App deployment message + * @returns string success + * @throws ApiError + */ +export const updateAppHistory = (data: UpdateAppHistoryData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/apps/history_update/a/{id}/v/{version}', + path: { + workspace: data.workspace, + id: data.id, + version: data.version + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * get public app by secret + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns AppWithLastVersion app details + * @throws ApiError + */ +export const getPublicAppBySecret = (data: GetPublicAppBySecretData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/apps_u/public_app/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * get public resource + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns unknown resource value + * @throws ApiError + */ +export const getPublicResource = (data: GetPublicResourceData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/apps_u/public_resource/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * get public secret of app + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns string app secret + * @throws ApiError + */ +export const getPublicSecretOfApp = (data: GetPublicSecretOfAppData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/apps/secret_of/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * get app by version + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @returns AppWithLastVersion app details + * @throws ApiError + */ +export const getAppByVersion = (data: GetAppByVersionData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/apps/get/v/{id}', + path: { + workspace: data.workspace, + id: data.id + } +}); }; + +/** + * create raw app + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody new raw app + * @returns string raw app created + * @throws ApiError + */ +export const createRawApp = (data: CreateRawAppData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/raw_apps/create', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * update app + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.requestBody updateraw app + * @returns string app updated + * @throws ApiError + */ +export const updateRawApp = (data: UpdateRawAppData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/raw_apps/update/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * delete raw app + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns string app deleted + * @throws ApiError + */ +export const deleteRawApp = (data: DeleteRawAppData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/w/{workspace}/raw_apps/delete/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * delete app + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns string app deleted + * @throws ApiError + */ +export const deleteApp = (data: DeleteAppData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/w/{workspace}/apps/delete/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * update app + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.requestBody update app + * @returns string app updated + * @throws ApiError + */ +export const updateApp = (data: UpdateAppData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/apps/update/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * executeComponent + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.requestBody update app + * @returns string job uuid + * @throws ApiError + */ +export const executeComponent = (data: ExecuteComponentData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/apps_u/execute_component/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * run flow by path + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.requestBody flow args + * @param data.scheduledFor when to schedule this job (leave empty for immediate run) + * @param data.scheduledInSecs schedule the script to execute in the number of seconds starting now + * @param data.skipPreprocessor skip the preprocessor + * @param data.parentJob The parent job that is at the origin and responsible for the execution of this script if any + * @param data.tag Override the tag to use + * @param data.jobId The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) + * @param data.includeHeader List of headers's keys (separated with ',') whove value are added to the args + * Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key + * + * @param data.invisibleToOwner make the run invisible to the the flow owner (default false) + * @returns string job created + * @throws ApiError + */ +export const runFlowByPath = (data: RunFlowByPathData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/jobs/run/f/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + query: { + scheduled_for: data.scheduledFor, + scheduled_in_secs: data.scheduledInSecs, + skip_preprocessor: data.skipPreprocessor, + parent_job: data.parentJob, + tag: data.tag, + job_id: data.jobId, + include_header: data.includeHeader, + invisible_to_owner: data.invisibleToOwner + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * restart a completed flow at a given step + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @param data.stepId step id to restart the flow from + * @param data.branchOrIterationN for branchall or loop, the iteration at which the flow should restart + * @param data.requestBody flow args + * @param data.scheduledFor when to schedule this job (leave empty for immediate run) + * @param data.scheduledInSecs schedule the script to execute in the number of seconds starting now + * @param data.parentJob The parent job that is at the origin and responsible for the execution of this script if any + * @param data.tag Override the tag to use + * @param data.jobId The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) + * @param data.includeHeader List of headers's keys (separated with ',') whove value are added to the args + * Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key + * + * @param data.invisibleToOwner make the run invisible to the the flow owner (default false) + * @returns string job created + * @throws ApiError + */ +export const restartFlowAtStep = (data: RestartFlowAtStepData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/jobs/restart/f/{id}/from/{step_id}/{branch_or_iteration_n}', + path: { + workspace: data.workspace, + id: data.id, + step_id: data.stepId, + branch_or_iteration_n: data.branchOrIterationN + }, + query: { + scheduled_for: data.scheduledFor, + scheduled_in_secs: data.scheduledInSecs, + parent_job: data.parentJob, + tag: data.tag, + job_id: data.jobId, + include_header: data.includeHeader, + invisible_to_owner: data.invisibleToOwner + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * run script by hash + * @param data The data for the request. + * @param data.workspace + * @param data.hash + * @param data.requestBody Partially filled args + * @param data.scheduledFor when to schedule this job (leave empty for immediate run) + * @param data.scheduledInSecs schedule the script to execute in the number of seconds starting now + * @param data.skipPreprocessor skip the preprocessor + * @param data.parentJob The parent job that is at the origin and responsible for the execution of this script if any + * @param data.tag Override the tag to use + * @param data.cacheTtl Override the cache time to live (in seconds). Can not be used to disable caching, only override with a new cache ttl + * @param data.jobId The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) + * @param data.includeHeader List of headers's keys (separated with ',') whove value are added to the args + * Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key + * + * @param data.invisibleToOwner make the run invisible to the the script owner (default false) + * @returns string job created + * @throws ApiError + */ +export const runScriptByHash = (data: RunScriptByHashData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/jobs/run/h/{hash}', + path: { + workspace: data.workspace, + hash: data.hash + }, + query: { + scheduled_for: data.scheduledFor, + scheduled_in_secs: data.scheduledInSecs, + skip_preprocessor: data.skipPreprocessor, + parent_job: data.parentJob, + tag: data.tag, + cache_ttl: data.cacheTtl, + job_id: data.jobId, + include_header: data.includeHeader, + invisible_to_owner: data.invisibleToOwner + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * run script preview + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody preview + * @param data.includeHeader List of headers's keys (separated with ',') whove value are added to the args + * Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key + * + * @param data.invisibleToOwner make the run invisible to the the script owner (default false) + * @param data.jobId The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) + * @returns string job created + * @throws ApiError + */ +export const runScriptPreview = (data: RunScriptPreviewData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/jobs/run/preview', + path: { + workspace: data.workspace + }, + query: { + include_header: data.includeHeader, + invisible_to_owner: data.invisibleToOwner, + job_id: data.jobId + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * run code-workflow task + * @param data The data for the request. + * @param data.workspace + * @param data.jobId + * @param data.entrypoint + * @param data.requestBody preview + * @returns string job created + * @throws ApiError + */ +export const runCodeWorkflowTask = (data: RunCodeWorkflowTaskData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/jobs/workflow_as_code/{job_id}/{entrypoint}', + path: { + workspace: data.workspace, + job_id: data.jobId, + entrypoint: data.entrypoint + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * run a one-off dependencies job + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody raw script content + * @returns unknown dependency job result + * @throws ApiError + */ +export const runRawScriptDependencies = (data: RunRawScriptDependenciesData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/jobs/run/dependencies', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * run flow preview + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody preview + * @param data.includeHeader List of headers's keys (separated with ',') whove value are added to the args + * Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key + * + * @param data.invisibleToOwner make the run invisible to the the script owner (default false) + * @param data.jobId The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) + * @returns string job created + * @throws ApiError + */ +export const runFlowPreview = (data: RunFlowPreviewData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/jobs/run/preview_flow', + path: { + workspace: data.workspace + }, + query: { + include_header: data.includeHeader, + invisible_to_owner: data.invisibleToOwner, + job_id: data.jobId + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * list all queued jobs + * @param data The data for the request. + * @param data.workspace + * @param data.orderDesc order by desc order (default true) + * @param data.createdBy mask to filter exact matching user creator + * @param data.parentJob The parent job that is at the origin and responsible for the execution of this script if any + * @param data.scriptPathExact mask to filter exact matching path + * @param data.scriptPathStart mask to filter matching starting path + * @param data.schedulePath mask to filter by schedule path + * @param data.scriptHash mask to filter exact matching path + * @param data.startedBefore filter on started before (inclusive) timestamp + * @param data.startedAfter filter on started after (exclusive) timestamp + * @param data.success filter on successful jobs + * @param data.scheduledForBeforeNow filter on jobs scheduled_for before now (hence waitinf for a worker) + * @param data.jobKinds filter on job kind (values 'preview', 'script', 'dependencies', 'flow') separated by, + * @param data.suspended filter on suspended jobs + * @param data.running filter on running jobs + * @param data.args filter on jobs containing those args as a json subset (@> in postgres) + * @param data.result filter on jobs containing those result as a json subset (@> in postgres) + * @param data.tag filter on jobs with a given tag/worker group + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @param data.allWorkspaces get jobs from all workspaces (only valid if request come from the `admins` workspace) + * @param data.isNotSchedule is not a scheduled job + * @returns QueuedJob All queued jobs + * @throws ApiError + */ +export const listQueue = (data: ListQueueData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs/queue/list', + path: { + workspace: data.workspace + }, + query: { + order_desc: data.orderDesc, + created_by: data.createdBy, + parent_job: data.parentJob, + script_path_exact: data.scriptPathExact, + script_path_start: data.scriptPathStart, + schedule_path: data.schedulePath, + script_hash: data.scriptHash, + started_before: data.startedBefore, + started_after: data.startedAfter, + success: data.success, + scheduled_for_before_now: data.scheduledForBeforeNow, + job_kinds: data.jobKinds, + suspended: data.suspended, + running: data.running, + args: data.args, + result: data.result, + tag: data.tag, + page: data.page, + per_page: data.perPage, + all_workspaces: data.allWorkspaces, + is_not_schedule: data.isNotSchedule + } +}); }; + +/** + * get queue count + * @param data The data for the request. + * @param data.workspace + * @param data.allWorkspaces get jobs from all workspaces (only valid if request come from the `admins` workspace) + * @returns unknown queue count + * @throws ApiError + */ +export const getQueueCount = (data: GetQueueCountData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs/queue/count', + path: { + workspace: data.workspace + }, + query: { + all_workspaces: data.allWorkspaces + } +}); }; + +/** + * get completed count + * @param data The data for the request. + * @param data.workspace + * @returns unknown completed count + * @throws ApiError + */ +export const getCompletedCount = (data: GetCompletedCountData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs/completed/count', + path: { + workspace: data.workspace + } +}); }; + +/** + * get the ids of all jobs matching the given filters + * @param data The data for the request. + * @param data.workspace + * @param data.orderDesc order by desc order (default true) + * @param data.createdBy mask to filter exact matching user creator + * @param data.parentJob The parent job that is at the origin and responsible for the execution of this script if any + * @param data.scriptPathExact mask to filter exact matching path + * @param data.scriptPathStart mask to filter matching starting path + * @param data.schedulePath mask to filter by schedule path + * @param data.scriptHash mask to filter exact matching path + * @param data.startedBefore filter on started before (inclusive) timestamp + * @param data.startedAfter filter on started after (exclusive) timestamp + * @param data.success filter on successful jobs + * @param data.scheduledForBeforeNow filter on jobs scheduled_for before now (hence waitinf for a worker) + * @param data.jobKinds filter on job kind (values 'preview', 'script', 'dependencies', 'flow') separated by, + * @param data.suspended filter on suspended jobs + * @param data.running filter on running jobs + * @param data.args filter on jobs containing those args as a json subset (@> in postgres) + * @param data.result filter on jobs containing those result as a json subset (@> in postgres) + * @param data.tag filter on jobs with a given tag/worker group + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @param data.concurrencyKey + * @param data.allWorkspaces get jobs from all workspaces (only valid if request come from the `admins` workspace) + * @param data.isNotSchedule is not a scheduled job + * @returns string uuids of jobs + * @throws ApiError + */ +export const listFilteredUuids = (data: ListFilteredUuidsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs/queue/list_filtered_uuids', + path: { + workspace: data.workspace + }, + query: { + order_desc: data.orderDesc, + created_by: data.createdBy, + parent_job: data.parentJob, + script_path_exact: data.scriptPathExact, + script_path_start: data.scriptPathStart, + schedule_path: data.schedulePath, + script_hash: data.scriptHash, + started_before: data.startedBefore, + started_after: data.startedAfter, + success: data.success, + scheduled_for_before_now: data.scheduledForBeforeNow, + job_kinds: data.jobKinds, + suspended: data.suspended, + running: data.running, + args: data.args, + result: data.result, + tag: data.tag, + page: data.page, + per_page: data.perPage, + concurrency_key: data.concurrencyKey, + all_workspaces: data.allWorkspaces, + is_not_schedule: data.isNotSchedule + } +}); }; + +/** + * cancel jobs based on the given uuids + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody uuids of the jobs to cancel + * @returns string uuids of canceled jobs + * @throws ApiError + */ +export const cancelSelection = (data: CancelSelectionData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/jobs/queue/cancel_selection', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * list all completed jobs + * @param data The data for the request. + * @param data.workspace + * @param data.orderDesc order by desc order (default true) + * @param data.createdBy mask to filter exact matching user creator + * @param data.label mask to filter exact matching job's label (job labels are completed jobs with as a result an object containing a string in the array at key 'wm_labels') + * @param data.parentJob The parent job that is at the origin and responsible for the execution of this script if any + * @param data.scriptPathExact mask to filter exact matching path + * @param data.scriptPathStart mask to filter matching starting path + * @param data.schedulePath mask to filter by schedule path + * @param data.scriptHash mask to filter exact matching path + * @param data.startedBefore filter on started before (inclusive) timestamp + * @param data.startedAfter filter on started after (exclusive) timestamp + * @param data.success filter on successful jobs + * @param data.jobKinds filter on job kind (values 'preview', 'script', 'dependencies', 'flow') separated by, + * @param data.args filter on jobs containing those args as a json subset (@> in postgres) + * @param data.result filter on jobs containing those result as a json subset (@> in postgres) + * @param data.tag filter on jobs with a given tag/worker group + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @param data.isSkipped is the job skipped + * @param data.isFlowStep is the job a flow step + * @param data.hasNullParent has null parent + * @param data.isNotSchedule is not a scheduled job + * @returns CompletedJob All completed jobs + * @throws ApiError + */ +export const listCompletedJobs = (data: ListCompletedJobsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs/completed/list', + path: { + workspace: data.workspace + }, + query: { + order_desc: data.orderDesc, + created_by: data.createdBy, + label: data.label, + parent_job: data.parentJob, + script_path_exact: data.scriptPathExact, + script_path_start: data.scriptPathStart, + schedule_path: data.schedulePath, + script_hash: data.scriptHash, + started_before: data.startedBefore, + started_after: data.startedAfter, + success: data.success, + job_kinds: data.jobKinds, + args: data.args, + result: data.result, + tag: data.tag, + page: data.page, + per_page: data.perPage, + is_skipped: data.isSkipped, + is_flow_step: data.isFlowStep, + has_null_parent: data.hasNullParent, + is_not_schedule: data.isNotSchedule + } +}); }; + +/** + * list all jobs + * @param data The data for the request. + * @param data.workspace + * @param data.createdBy mask to filter exact matching user creator + * @param data.label mask to filter exact matching job's label (job labels are completed jobs with as a result an object containing a string in the array at key 'wm_labels') + * @param data.parentJob The parent job that is at the origin and responsible for the execution of this script if any + * @param data.scriptPathExact mask to filter exact matching path + * @param data.scriptPathStart mask to filter matching starting path + * @param data.schedulePath mask to filter by schedule path + * @param data.scriptHash mask to filter exact matching path + * @param data.startedBefore filter on started before (inclusive) timestamp + * @param data.startedAfter filter on started after (exclusive) timestamp + * @param data.createdBefore filter on created before (inclusive) timestamp + * @param data.createdAfter filter on created after (exclusive) timestamp + * @param data.createdOrStartedBefore filter on created_at for non non started job and started_at otherwise before (inclusive) timestamp + * @param data.running filter on running jobs + * @param data.scheduledForBeforeNow filter on jobs scheduled_for before now (hence waitinf for a worker) + * @param data.createdOrStartedAfter filter on created_at for non non started job and started_at otherwise after (exclusive) timestamp + * @param data.createdOrStartedAfterCompletedJobs filter on created_at for non non started job and started_at otherwise after (exclusive) timestamp but only for the completed jobs + * @param data.jobKinds filter on job kind (values 'preview', 'script', 'dependencies', 'flow') separated by, + * @param data.suspended filter on suspended jobs + * @param data.args filter on jobs containing those args as a json subset (@> in postgres) + * @param data.tag filter on jobs with a given tag/worker group + * @param data.result filter on jobs containing those result as a json subset (@> in postgres) + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @param data.isSkipped is the job skipped + * @param data.isFlowStep is the job a flow step + * @param data.hasNullParent has null parent + * @param data.success filter on successful jobs + * @param data.allWorkspaces get jobs from all workspaces (only valid if request come from the `admins` workspace) + * @param data.isNotSchedule is not a scheduled job + * @returns Job All jobs + * @throws ApiError + */ +export const listJobs = (data: ListJobsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs/list', + path: { + workspace: data.workspace + }, + query: { + created_by: data.createdBy, + label: data.label, + parent_job: data.parentJob, + script_path_exact: data.scriptPathExact, + script_path_start: data.scriptPathStart, + schedule_path: data.schedulePath, + script_hash: data.scriptHash, + started_before: data.startedBefore, + started_after: data.startedAfter, + created_before: data.createdBefore, + created_after: data.createdAfter, + created_or_started_before: data.createdOrStartedBefore, + running: data.running, + scheduled_for_before_now: data.scheduledForBeforeNow, + created_or_started_after: data.createdOrStartedAfter, + created_or_started_after_completed_jobs: data.createdOrStartedAfterCompletedJobs, + job_kinds: data.jobKinds, + suspended: data.suspended, + args: data.args, + tag: data.tag, + result: data.result, + page: data.page, + per_page: data.perPage, + is_skipped: data.isSkipped, + is_flow_step: data.isFlowStep, + has_null_parent: data.hasNullParent, + success: data.success, + all_workspaces: data.allWorkspaces, + is_not_schedule: data.isNotSchedule + } +}); }; + +/** + * get db clock + * @returns number the timestamp of the db that can be used to compute the drift + * @throws ApiError + */ +export const getDbClock = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/jobs/db_clock' +}); }; + +/** + * get job + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @param data.noLogs + * @returns Job job details + * @throws ApiError + */ +export const getJob = (data: GetJobData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs_u/get/{id}', + path: { + workspace: data.workspace, + id: data.id + }, + query: { + no_logs: data.noLogs + } +}); }; + +/** + * get root job id + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @returns string get root job id + * @throws ApiError + */ +export const getRootJobId = (data: GetRootJobIdData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs_u/get_root_job_id/{id}', + path: { + workspace: data.workspace, + id: data.id + } +}); }; + +/** + * get job logs + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @returns string job details + * @throws ApiError + */ +export const getJobLogs = (data: GetJobLogsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs_u/get_logs/{id}', + path: { + workspace: data.workspace, + id: data.id + } +}); }; + +/** + * get job args + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @returns unknown job args + * @throws ApiError + */ +export const getJobArgs = (data: GetJobArgsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs_u/get_args/{id}', + path: { + workspace: data.workspace, + id: data.id + } +}); }; + +/** + * get job updates + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @param data.running + * @param data.logOffset + * @param data.getProgress + * @returns unknown job details + * @throws ApiError + */ +export const getJobUpdates = (data: GetJobUpdatesData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs_u/getupdate/{id}', + path: { + workspace: data.workspace, + id: data.id + }, + query: { + running: data.running, + log_offset: data.logOffset, + get_progress: data.getProgress + } +}); }; + +/** + * get log file from object store + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns unknown job log + * @throws ApiError + */ +export const getLogFileFromStore = (data: GetLogFileFromStoreData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs_u/get_log_file/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * get flow debug info + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @returns unknown flow debug info details + * @throws ApiError + */ +export const getFlowDebugInfo = (data: GetFlowDebugInfoData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs_u/get_flow_debug_info/{id}', + path: { + workspace: data.workspace, + id: data.id + } +}); }; + +/** + * get completed job + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @returns CompletedJob job details + * @throws ApiError + */ +export const getCompletedJob = (data: GetCompletedJobData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs_u/completed/get/{id}', + path: { + workspace: data.workspace, + id: data.id + } +}); }; + +/** + * get completed job result + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @param data.suspendedJob + * @param data.resumeId + * @param data.secret + * @param data.approver + * @returns unknown result + * @throws ApiError + */ +export const getCompletedJobResult = (data: GetCompletedJobResultData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs_u/completed/get_result/{id}', + path: { + workspace: data.workspace, + id: data.id + }, + query: { + suspended_job: data.suspendedJob, + resume_id: data.resumeId, + secret: data.secret, + approver: data.approver + } +}); }; + +/** + * get completed job result if job is completed + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @param data.getStarted + * @returns unknown result + * @throws ApiError + */ +export const getCompletedJobResultMaybe = (data: GetCompletedJobResultMaybeData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs_u/completed/get_result_maybe/{id}', + path: { + workspace: data.workspace, + id: data.id + }, + query: { + get_started: data.getStarted + } +}); }; + +/** + * delete completed job (erase content but keep run id) + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @returns CompletedJob job details + * @throws ApiError + */ +export const deleteCompletedJob = (data: DeleteCompletedJobData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/jobs/completed/delete/{id}', + path: { + workspace: data.workspace, + id: data.id + } +}); }; + +/** + * cancel queued or running job + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @param data.requestBody reason + * @returns string job canceled + * @throws ApiError + */ +export const cancelQueuedJob = (data: CancelQueuedJobData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/jobs_u/queue/cancel/{id}', + path: { + workspace: data.workspace, + id: data.id + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * cancel all queued jobs for persistent script + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.requestBody reason + * @returns string persistent job scaled down to zero + * @throws ApiError + */ +export const cancelPersistentQueuedJobs = (data: CancelPersistentQueuedJobsData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/jobs_u/queue/cancel_persistent/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * force cancel queued job + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @param data.requestBody reason + * @returns string job canceled + * @throws ApiError + */ +export const forceCancelQueuedJob = (data: ForceCancelQueuedJobData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/jobs_u/queue/force_cancel/{id}', + path: { + workspace: data.workspace, + id: data.id + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * create an HMac signature given a job id and a resume id + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @param data.resumeId + * @param data.approver + * @returns string job signature + * @throws ApiError + */ +export const createJobSignature = (data: CreateJobSignatureData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs/job_signature/{id}/{resume_id}', + path: { + workspace: data.workspace, + id: data.id, + resume_id: data.resumeId + }, + query: { + approver: data.approver + } +}); }; + +/** + * get resume urls given a job_id, resume_id and a nonce to resume a flow + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @param data.resumeId + * @param data.approver + * @returns unknown url endpoints + * @throws ApiError + */ +export const getResumeUrls = (data: GetResumeUrlsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs/resume_urls/{id}/{resume_id}', + path: { + workspace: data.workspace, + id: data.id, + resume_id: data.resumeId + }, + query: { + approver: data.approver + } +}); }; + +/** + * resume a job for a suspended flow + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @param data.resumeId + * @param data.signature + * @param data.payload The base64 encoded payload that has been encoded as a JSON. e.g how to encode such payload encodeURIComponent + * `encodeURIComponent(btoa(JSON.stringify({a: 2})))` + * + * @param data.approver + * @returns string job resumed + * @throws ApiError + */ +export const resumeSuspendedJobGet = (data: ResumeSuspendedJobGetData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs_u/resume/{id}/{resume_id}/{signature}', + path: { + workspace: data.workspace, + id: data.id, + resume_id: data.resumeId, + signature: data.signature + }, + query: { + payload: data.payload, + approver: data.approver + } +}); }; + +/** + * resume a job for a suspended flow + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @param data.resumeId + * @param data.signature + * @param data.requestBody + * @param data.approver + * @returns string job resumed + * @throws ApiError + */ +export const resumeSuspendedJobPost = (data: ResumeSuspendedJobPostData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/jobs_u/resume/{id}/{resume_id}/{signature}', + path: { + workspace: data.workspace, + id: data.id, + resume_id: data.resumeId, + signature: data.signature + }, + query: { + approver: data.approver + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * set flow user state at a given key + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @param data.key + * @param data.requestBody new value + * @returns string flow user state updated + * @throws ApiError + */ +export const setFlowUserState = (data: SetFlowUserStateData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/jobs/flow/user_states/{id}/{key}', + path: { + workspace: data.workspace, + id: data.id, + key: data.key + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * get flow user state at a given key + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @param data.key + * @returns unknown flow user state updated + * @throws ApiError + */ +export const getFlowUserState = (data: GetFlowUserStateData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs/flow/user_states/{id}/{key}', + path: { + workspace: data.workspace, + id: data.id, + key: data.key + } +}); }; + +/** + * resume a job for a suspended flow as an owner + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @param data.requestBody + * @returns string job resumed + * @throws ApiError + */ +export const resumeSuspendedFlowAsOwner = (data: ResumeSuspendedFlowAsOwnerData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/jobs/flow/resume/{id}', + path: { + workspace: data.workspace, + id: data.id + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * cancel a job for a suspended flow + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @param data.resumeId + * @param data.signature + * @param data.approver + * @returns string job canceled + * @throws ApiError + */ +export const cancelSuspendedJobGet = (data: CancelSuspendedJobGetData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs_u/cancel/{id}/{resume_id}/{signature}', + path: { + workspace: data.workspace, + id: data.id, + resume_id: data.resumeId, + signature: data.signature + }, + query: { + approver: data.approver + } +}); }; + +/** + * cancel a job for a suspended flow + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @param data.resumeId + * @param data.signature + * @param data.requestBody + * @param data.approver + * @returns string job canceled + * @throws ApiError + */ +export const cancelSuspendedJobPost = (data: CancelSuspendedJobPostData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/jobs_u/cancel/{id}/{resume_id}/{signature}', + path: { + workspace: data.workspace, + id: data.id, + resume_id: data.resumeId, + signature: data.signature + }, + query: { + approver: data.approver + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * get parent flow job of suspended job + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @param data.resumeId + * @param data.signature + * @param data.approver + * @returns unknown parent flow details + * @throws ApiError + */ +export const getSuspendedJobFlow = (data: GetSuspendedJobFlowData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/jobs_u/get_flow/{id}/{resume_id}/{signature}', + path: { + workspace: data.workspace, + id: data.id, + resume_id: data.resumeId, + signature: data.signature + }, + query: { + approver: data.approver + } +}); }; + +/** + * preview schedule + * @param data The data for the request. + * @param data.requestBody schedule + * @returns string List of 5 estimated upcoming execution events (in UTC) + * @throws ApiError + */ +export const previewSchedule = (data: PreviewScheduleData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/schedules/preview', + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * create schedule + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody new schedule + * @returns string schedule created + * @throws ApiError + */ +export const createSchedule = (data: CreateScheduleData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/schedules/create', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * update schedule + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.requestBody updated schedule + * @returns string schedule updated + * @throws ApiError + */ +export const updateSchedule = (data: UpdateScheduleData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/schedules/update/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * set enabled schedule + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.requestBody updated schedule enable + * @returns string schedule enabled set + * @throws ApiError + */ +export const setScheduleEnabled = (data: SetScheduleEnabledData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/schedules/setenabled/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * delete schedule + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns string schedule deleted + * @throws ApiError + */ +export const deleteSchedule = (data: DeleteScheduleData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/w/{workspace}/schedules/delete/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * get schedule + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns Schedule schedule deleted + * @throws ApiError + */ +export const getSchedule = (data: GetScheduleData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/schedules/get/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * does schedule exists + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns boolean schedule exists + * @throws ApiError + */ +export const existsSchedule = (data: ExistsScheduleData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/schedules/exists/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * list schedules + * @param data The data for the request. + * @param data.workspace + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @param data.args filter on jobs containing those args as a json subset (@> in postgres) + * @param data.path filter by path + * @param data.isFlow + * @param data.pathStart + * @returns Schedule schedule list + * @throws ApiError + */ +export const listSchedules = (data: ListSchedulesData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/schedules/list', + path: { + workspace: data.workspace + }, + query: { + page: data.page, + per_page: data.perPage, + args: data.args, + path: data.path, + is_flow: data.isFlow, + path_start: data.pathStart + } +}); }; + +/** + * list schedules with last 20 jobs + * @param data The data for the request. + * @param data.workspace + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @returns ScheduleWJobs schedule list + * @throws ApiError + */ +export const listSchedulesWithJobs = (data: ListSchedulesWithJobsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/schedules/list_with_jobs', + path: { + workspace: data.workspace + }, + query: { + page: data.page, + per_page: data.perPage + } +}); }; + +/** + * Set default error or recoevery handler + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody Handler description + * @returns unknown default error handler set + * @throws ApiError + */ +export const setDefaultErrorOrRecoveryHandler = (data: SetDefaultErrorOrRecoveryHandlerData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/schedules/setdefaulthandler', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * create http trigger + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody new http trigger + * @returns string http trigger created + * @throws ApiError + */ +export const createHttpTrigger = (data: CreateHttpTriggerData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/http_triggers/create', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * update http trigger + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.requestBody updated trigger + * @returns string http trigger updated + * @throws ApiError + */ +export const updateHttpTrigger = (data: UpdateHttpTriggerData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/http_triggers/update/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * delete http trigger + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns string http trigger deleted + * @throws ApiError + */ +export const deleteHttpTrigger = (data: DeleteHttpTriggerData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/w/{workspace}/http_triggers/delete/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * get http trigger + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns HttpTrigger http trigger deleted + * @throws ApiError + */ +export const getHttpTrigger = (data: GetHttpTriggerData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/http_triggers/get/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * list http triggers + * @param data The data for the request. + * @param data.workspace + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @param data.path filter by path + * @param data.isFlow + * @param data.pathStart + * @returns HttpTrigger http trigger list + * @throws ApiError + */ +export const listHttpTriggers = (data: ListHttpTriggersData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/http_triggers/list', + path: { + workspace: data.workspace + }, + query: { + page: data.page, + per_page: data.perPage, + path: data.path, + is_flow: data.isFlow, + path_start: data.pathStart + } +}); }; + +/** + * does http trigger exists + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns boolean http trigger exists + * @throws ApiError + */ +export const existsHttpTrigger = (data: ExistsHttpTriggerData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/http_triggers/exists/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * does route exists + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody route exists request + * @returns boolean route exists + * @throws ApiError + */ +export const existsRoute = (data: ExistsRouteData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/http_triggers/route_exists', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * whether http triggers are used + * @param data The data for the request. + * @param data.workspace + * @returns boolean whether http triggers are used + * @throws ApiError + */ +export const used = (data: UsedData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/http_triggers/used', + path: { + workspace: data.workspace + } +}); }; + +/** + * list instance groups + * @returns InstanceGroup instance group list + * @throws ApiError + */ +export const listInstanceGroups = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/groups/list' +}); }; + +/** + * get instance group + * @param data The data for the request. + * @param data.name + * @returns InstanceGroup instance group + * @throws ApiError + */ +export const getInstanceGroup = (data: GetInstanceGroupData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/groups/get/{name}', + path: { + name: data.name + } +}); }; + +/** + * create instance group + * @param data The data for the request. + * @param data.requestBody create instance group + * @returns string instance group created + * @throws ApiError + */ +export const createInstanceGroup = (data: CreateInstanceGroupData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/groups/create', + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * update instance group + * @param data The data for the request. + * @param data.name + * @param data.requestBody update instance group + * @returns string instance group updated + * @throws ApiError + */ +export const updateInstanceGroup = (data: UpdateInstanceGroupData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/groups/update/{name}', + path: { + name: data.name + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * delete instance group + * @param data The data for the request. + * @param data.name + * @returns string instance group deleted + * @throws ApiError + */ +export const deleteInstanceGroup = (data: DeleteInstanceGroupData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/groups/delete/{name}', + path: { + name: data.name + } +}); }; + +/** + * add user to instance group + * @param data The data for the request. + * @param data.name + * @param data.requestBody user to add to instance group + * @returns string user added to instance group + * @throws ApiError + */ +export const addUserToInstanceGroup = (data: AddUserToInstanceGroupData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/groups/adduser/{name}', + path: { + name: data.name + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * remove user from instance group + * @param data The data for the request. + * @param data.name + * @param data.requestBody user to remove from instance group + * @returns string user removed from instance group + * @throws ApiError + */ +export const removeUserFromInstanceGroup = (data: RemoveUserFromInstanceGroupData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/groups/removeuser/{name}', + path: { + name: data.name + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * export instance groups + * @returns ExportedInstanceGroup exported instance groups + * @throws ApiError + */ +export const exportInstanceGroups = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/groups/export' +}); }; + +/** + * overwrite instance groups + * @param data The data for the request. + * @param data.requestBody overwrite instance groups + * @returns string success message + * @throws ApiError + */ +export const overwriteInstanceGroups = (data: OverwriteInstanceGroupsData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/groups/overwrite', + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * list groups + * @param data The data for the request. + * @param data.workspace + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @returns Group group list + * @throws ApiError + */ +export const listGroups = (data: ListGroupsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/groups/list', + path: { + workspace: data.workspace + }, + query: { + page: data.page, + per_page: data.perPage + } +}); }; + +/** + * list group names + * @param data The data for the request. + * @param data.workspace + * @param data.onlyMemberOf only list the groups the user is member of (default false) + * @returns string group list + * @throws ApiError + */ +export const listGroupNames = (data: ListGroupNamesData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/groups/listnames', + path: { + workspace: data.workspace + }, + query: { + only_member_of: data.onlyMemberOf + } +}); }; + +/** + * create group + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody create group + * @returns string group created + * @throws ApiError + */ +export const createGroup = (data: CreateGroupData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/groups/create', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * update group + * @param data The data for the request. + * @param data.workspace + * @param data.name + * @param data.requestBody updated group + * @returns string group updated + * @throws ApiError + */ +export const updateGroup = (data: UpdateGroupData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/groups/update/{name}', + path: { + workspace: data.workspace, + name: data.name + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * delete group + * @param data The data for the request. + * @param data.workspace + * @param data.name + * @returns string group deleted + * @throws ApiError + */ +export const deleteGroup = (data: DeleteGroupData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/w/{workspace}/groups/delete/{name}', + path: { + workspace: data.workspace, + name: data.name + } +}); }; + +/** + * get group + * @param data The data for the request. + * @param data.workspace + * @param data.name + * @returns Group group + * @throws ApiError + */ +export const getGroup = (data: GetGroupData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/groups/get/{name}', + path: { + workspace: data.workspace, + name: data.name + } +}); }; + +/** + * add user to group + * @param data The data for the request. + * @param data.workspace + * @param data.name + * @param data.requestBody added user to group + * @returns string user added to group + * @throws ApiError + */ +export const addUserToGroup = (data: AddUserToGroupData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/groups/adduser/{name}', + path: { + workspace: data.workspace, + name: data.name + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * remove user to group + * @param data The data for the request. + * @param data.workspace + * @param data.name + * @param data.requestBody added user to group + * @returns string user removed from group + * @throws ApiError + */ +export const removeUserToGroup = (data: RemoveUserToGroupData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/groups/removeuser/{name}', + path: { + workspace: data.workspace, + name: data.name + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * list folders + * @param data The data for the request. + * @param data.workspace + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @returns Folder folder list + * @throws ApiError + */ +export const listFolders = (data: ListFoldersData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/folders/list', + path: { + workspace: data.workspace + }, + query: { + page: data.page, + per_page: data.perPage + } +}); }; + +/** + * list folder names + * @param data The data for the request. + * @param data.workspace + * @param data.onlyMemberOf only list the folders the user is member of (default false) + * @returns string folder list + * @throws ApiError + */ +export const listFolderNames = (data: ListFolderNamesData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/folders/listnames', + path: { + workspace: data.workspace + }, + query: { + only_member_of: data.onlyMemberOf + } +}); }; + +/** + * create folder + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody create folder + * @returns string folder created + * @throws ApiError + */ +export const createFolder = (data: CreateFolderData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/folders/create', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * update folder + * @param data The data for the request. + * @param data.workspace + * @param data.name + * @param data.requestBody update folder + * @returns string folder updated + * @throws ApiError + */ +export const updateFolder = (data: UpdateFolderData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/folders/update/{name}', + path: { + workspace: data.workspace, + name: data.name + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * delete folder + * @param data The data for the request. + * @param data.workspace + * @param data.name + * @returns string folder deleted + * @throws ApiError + */ +export const deleteFolder = (data: DeleteFolderData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/w/{workspace}/folders/delete/{name}', + path: { + workspace: data.workspace, + name: data.name + } +}); }; + +/** + * get folder + * @param data The data for the request. + * @param data.workspace + * @param data.name + * @returns Folder folder + * @throws ApiError + */ +export const getFolder = (data: GetFolderData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/folders/get/{name}', + path: { + workspace: data.workspace, + name: data.name + } +}); }; + +/** + * get folder usage + * @param data The data for the request. + * @param data.workspace + * @param data.name + * @returns unknown folder + * @throws ApiError + */ +export const getFolderUsage = (data: GetFolderUsageData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/folders/getusage/{name}', + path: { + workspace: data.workspace, + name: data.name + } +}); }; + +/** + * add owner to folder + * @param data The data for the request. + * @param data.workspace + * @param data.name + * @param data.requestBody owner user to folder + * @returns string owner added to folder + * @throws ApiError + */ +export const addOwnerToFolder = (data: AddOwnerToFolderData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/folders/addowner/{name}', + path: { + workspace: data.workspace, + name: data.name + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * remove owner to folder + * @param data The data for the request. + * @param data.workspace + * @param data.name + * @param data.requestBody added owner to folder + * @returns string owner removed from folder + * @throws ApiError + */ +export const removeOwnerToFolder = (data: RemoveOwnerToFolderData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/folders/removeowner/{name}', + path: { + workspace: data.workspace, + name: data.name + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * list workers + * @param data The data for the request. + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @param data.pingSince number of seconds the worker must have had a last ping more recent of (default to 300) + * @returns WorkerPing a list of workers + * @throws ApiError + */ +export const listWorkers = (data: ListWorkersData = {}): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/workers/list', + query: { + page: data.page, + per_page: data.perPage, + ping_since: data.pingSince + } +}); }; + +/** + * exists worker with tag + * @param data The data for the request. + * @param data.tag + * @returns boolean whether a worker with the tag exists + * @throws ApiError + */ +export const existsWorkerWithTag = (data: ExistsWorkerWithTagData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/workers/exists_worker_with_tag', + query: { + tag: data.tag + } +}); }; + +/** + * get queue metrics + * @returns unknown metrics + * @throws ApiError + */ +export const getQueueMetrics = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/workers/queue_metrics' +}); }; + +/** + * list worker groups + * @returns unknown a list of worker group configs + * @throws ApiError + */ +export const listWorkerGroups = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/configs/list_worker_groups' +}); }; + +/** + * get config + * @param data The data for the request. + * @param data.name + * @returns unknown a config + * @throws ApiError + */ +export const getConfig = (data: GetConfigData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/configs/get/{name}', + path: { + name: data.name + } +}); }; + +/** + * Update config + * @param data The data for the request. + * @param data.name + * @param data.requestBody worker group + * @returns string Update a worker group + * @throws ApiError + */ +export const updateConfig = (data: UpdateConfigData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/configs/update/{name}', + path: { + name: data.name + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * Delete Config + * @param data The data for the request. + * @param data.name + * @returns string Delete config + * @throws ApiError + */ +export const deleteConfig = (data: DeleteConfigData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/configs/update/{name}', + path: { + name: data.name + } +}); }; + +/** + * list configs + * @returns Config list of configs + * @throws ApiError + */ +export const listConfigs = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/configs/list' +}); }; + +/** + * get granular acls + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.kind + * @returns boolean acls + * @throws ApiError + */ +export const getGranularAcls = (data: GetGranularAclsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/acls/get/{kind}/{path}', + path: { + workspace: data.workspace, + path: data.path, + kind: data.kind + } +}); }; + +/** + * add granular acls + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.kind + * @param data.requestBody acl to add + * @returns string granular acl added + * @throws ApiError + */ +export const addGranularAcls = (data: AddGranularAclsData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/acls/add/{kind}/{path}', + path: { + workspace: data.workspace, + path: data.path, + kind: data.kind + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * remove granular acls + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.kind + * @param data.requestBody acl to add + * @returns string granular acl removed + * @throws ApiError + */ +export const removeGranularAcls = (data: RemoveGranularAclsData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/acls/remove/{kind}/{path}', + path: { + workspace: data.workspace, + path: data.path, + kind: data.kind + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * update flow preview capture + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns void flow preview captured + * @throws ApiError + */ +export const updateCapture = (data: UpdateCaptureData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/capture_u/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * create flow preview capture + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns unknown flow preview capture created + * @throws ApiError + */ +export const createCapture = (data: CreateCaptureData): CancelablePromise => { return __request(OpenAPI, { + method: 'PUT', + url: '/w/{workspace}/capture/{path}', + path: { + workspace: data.workspace, + path: data.path + } +}); }; + +/** + * get flow preview capture + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @returns unknown captured flow preview + * @throws ApiError + */ +export const getCapture = (data: GetCaptureData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/capture/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + errors: { + 404: 'capture does not exist for this flow' + } +}); }; + +/** + * star item + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody + * @returns unknown star item + * @throws ApiError + */ +export const star = (data: StarData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/favorites/star', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * unstar item + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody + * @returns unknown unstar item + * @throws ApiError + */ +export const unstar = (data: UnstarData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/favorites/unstar', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * List Inputs used in previously completed jobs + * @param data The data for the request. + * @param data.workspace + * @param data.runnableId + * @param data.runnableType + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @returns Input Input history for completed jobs + * @throws ApiError + */ +export const getInputHistory = (data: GetInputHistoryData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/inputs/history', + path: { + workspace: data.workspace + }, + query: { + runnable_id: data.runnableId, + runnable_type: data.runnableType, + page: data.page, + per_page: data.perPage + } +}); }; + +/** + * Get args from history or saved input + * @param data The data for the request. + * @param data.workspace + * @param data.jobOrInputId + * @param data.input + * @param data.allowLarge + * @returns unknown args + * @throws ApiError + */ +export const getArgsFromHistoryOrSavedInput = (data: GetArgsFromHistoryOrSavedInputData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/inputs/{jobOrInputId}/args', + path: { + workspace: data.workspace, + jobOrInputId: data.jobOrInputId + }, + query: { + input: data.input, + allow_large: data.allowLarge + } +}); }; + +/** + * List saved Inputs for a Runnable + * @param data The data for the request. + * @param data.workspace + * @param data.runnableId + * @param data.runnableType + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @returns Input Saved Inputs for a Runnable + * @throws ApiError + */ +export const listInputs = (data: ListInputsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/inputs/list', + path: { + workspace: data.workspace + }, + query: { + runnable_id: data.runnableId, + runnable_type: data.runnableType, + page: data.page, + per_page: data.perPage + } +}); }; + +/** + * Create an Input for future use in a script or flow + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody Input + * @param data.runnableId + * @param data.runnableType + * @returns string Input created + * @throws ApiError + */ +export const createInput = (data: CreateInputData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/inputs/create', + path: { + workspace: data.workspace + }, + query: { + runnable_id: data.runnableId, + runnable_type: data.runnableType + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * Update an Input + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody UpdateInput + * @returns string Input updated + * @throws ApiError + */ +export const updateInput = (data: UpdateInputData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/inputs/update', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * Delete a Saved Input + * @param data The data for the request. + * @param data.workspace + * @param data.input + * @returns string Input deleted + * @throws ApiError + */ +export const deleteInput = (data: DeleteInputData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/inputs/delete/{input}', + path: { + workspace: data.workspace, + input: data.input + } +}); }; + +/** + * Converts an S3 resource to the set of instructions necessary to connect DuckDB to an S3 bucket + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody S3 resource to connect to + * @returns unknown Connection settings + * @throws ApiError + */ +export const duckdbConnectionSettings = (data: DuckdbConnectionSettingsData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/job_helpers/duckdb_connection_settings', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * Converts an S3 resource to the set of instructions necessary to connect DuckDB to an S3 bucket + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody S3 resource path to use to generate the connection settings. If empty, the S3 resource defined in the workspace settings will be used + * @returns unknown Connection settings + * @throws ApiError + */ +export const duckdbConnectionSettingsV2 = (data: DuckdbConnectionSettingsV2Data): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/job_helpers/v2/duckdb_connection_settings', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * Converts an S3 resource to the set of arguments necessary to connect Polars to an S3 bucket + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody S3 resource to connect to + * @returns unknown Connection settings + * @throws ApiError + */ +export const polarsConnectionSettings = (data: PolarsConnectionSettingsData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/job_helpers/polars_connection_settings', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * Converts an S3 resource to the set of arguments necessary to connect Polars to an S3 bucket + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody S3 resource path to use to generate the connection settings. If empty, the S3 resource defined in the workspace settings will be used + * @returns unknown Connection settings + * @throws ApiError + */ +export const polarsConnectionSettingsV2 = (data: PolarsConnectionSettingsV2Data): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/job_helpers/v2/polars_connection_settings', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * Returns the s3 resource associated to the provided path, or the workspace default S3 resource + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody S3 resource path to use. If empty, the S3 resource defined in the workspace settings will be used + * @returns S3Resource Connection settings + * @throws ApiError + */ +export const s3ResourceInfo = (data: S3ResourceInfoData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/job_helpers/v2/s3_resource_info', + path: { + workspace: data.workspace + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * Test connection to the workspace object storage + * @param data The data for the request. + * @param data.workspace + * @param data.storage + * @returns unknown Connection settings + * @throws ApiError + */ +export const datasetStorageTestConnection = (data: DatasetStorageTestConnectionData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/job_helpers/test_connection', + path: { + workspace: data.workspace + }, + query: { + storage: data.storage + } +}); }; + +/** + * List the file keys available in a workspace object storage + * @param data The data for the request. + * @param data.workspace + * @param data.maxKeys + * @param data.marker + * @param data.prefix + * @param data.storage + * @returns unknown List of file keys + * @throws ApiError + */ +export const listStoredFiles = (data: ListStoredFilesData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/job_helpers/list_stored_files', + path: { + workspace: data.workspace + }, + query: { + max_keys: data.maxKeys, + marker: data.marker, + prefix: data.prefix, + storage: data.storage + } +}); }; + +/** + * Load metadata of the file + * @param data The data for the request. + * @param data.workspace + * @param data.fileKey + * @param data.storage + * @returns WindmillFileMetadata FileMetadata + * @throws ApiError + */ +export const loadFileMetadata = (data: LoadFileMetadataData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/job_helpers/load_file_metadata', + path: { + workspace: data.workspace + }, + query: { + file_key: data.fileKey, + storage: data.storage + } +}); }; + +/** + * Load a preview of the file + * @param data The data for the request. + * @param data.workspace + * @param data.fileKey + * @param data.fileSizeInBytes + * @param data.fileMimeType + * @param data.csvSeparator + * @param data.csvHasHeader + * @param data.readBytesFrom + * @param data.readBytesLength + * @param data.storage + * @returns WindmillFilePreview FilePreview + * @throws ApiError + */ +export const loadFilePreview = (data: LoadFilePreviewData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/job_helpers/load_file_preview', + path: { + workspace: data.workspace + }, + query: { + file_key: data.fileKey, + file_size_in_bytes: data.fileSizeInBytes, + file_mime_type: data.fileMimeType, + csv_separator: data.csvSeparator, + csv_has_header: data.csvHasHeader, + read_bytes_from: data.readBytesFrom, + read_bytes_length: data.readBytesLength, + storage: data.storage + } +}); }; + +/** + * Load a preview of a parquet file + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.offset + * @param data.limit + * @param data.sortCol + * @param data.sortDesc + * @param data.searchCol + * @param data.searchTerm + * @param data.storage + * @returns unknown Parquet Preview + * @throws ApiError + */ +export const loadParquetPreview = (data: LoadParquetPreviewData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/job_helpers/load_parquet_preview/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + query: { + offset: data.offset, + limit: data.limit, + sort_col: data.sortCol, + sort_desc: data.sortDesc, + search_col: data.searchCol, + search_term: data.searchTerm, + storage: data.storage + } +}); }; + +/** + * Load the table row count + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.searchCol + * @param data.searchTerm + * @param data.storage + * @returns unknown Table count + * @throws ApiError + */ +export const loadTableRowCount = (data: LoadTableRowCountData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/job_helpers/load_table_count/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + query: { + search_col: data.searchCol, + search_term: data.searchTerm, + storage: data.storage + } +}); }; + +/** + * Load a preview of a csv file + * @param data The data for the request. + * @param data.workspace + * @param data.path + * @param data.offset + * @param data.limit + * @param data.sortCol + * @param data.sortDesc + * @param data.searchCol + * @param data.searchTerm + * @param data.storage + * @param data.csvSeparator + * @returns unknown Csv Preview + * @throws ApiError + */ +export const loadCsvPreview = (data: LoadCsvPreviewData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/job_helpers/load_csv_preview/{path}', + path: { + workspace: data.workspace, + path: data.path + }, + query: { + offset: data.offset, + limit: data.limit, + sort_col: data.sortCol, + sort_desc: data.sortDesc, + search_col: data.searchCol, + search_term: data.searchTerm, + storage: data.storage, + csv_separator: data.csvSeparator + } +}); }; + +/** + * Permanently delete file from S3 + * @param data The data for the request. + * @param data.workspace + * @param data.fileKey + * @param data.storage + * @returns unknown Confirmation + * @throws ApiError + */ +export const deleteS3File = (data: DeleteS3FileData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/w/{workspace}/job_helpers/delete_s3_file', + path: { + workspace: data.workspace + }, + query: { + file_key: data.fileKey, + storage: data.storage + } +}); }; + +/** + * Move a S3 file from one path to the other within the same bucket + * @param data The data for the request. + * @param data.workspace + * @param data.srcFileKey + * @param data.destFileKey + * @param data.storage + * @returns unknown Confirmation + * @throws ApiError + */ +export const moveS3File = (data: MoveS3FileData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/job_helpers/move_s3_file', + path: { + workspace: data.workspace + }, + query: { + src_file_key: data.srcFileKey, + dest_file_key: data.destFileKey, + storage: data.storage + } +}); }; + +/** + * Upload file to S3 bucket + * @param data The data for the request. + * @param data.workspace + * @param data.requestBody File content + * @param data.fileKey + * @param data.fileExtension + * @param data.s3ResourcePath + * @param data.resourceType + * @param data.storage + * @returns unknown File upload status + * @throws ApiError + */ +export const fileUpload = (data: FileUploadData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/job_helpers/upload_s3_file', + path: { + workspace: data.workspace + }, + query: { + file_key: data.fileKey, + file_extension: data.fileExtension, + s3_resource_path: data.s3ResourcePath, + resource_type: data.resourceType, + storage: data.storage + }, + body: data.requestBody, + mediaType: 'application/octet-stream' +}); }; + +/** + * Download file to S3 bucket + * @param data The data for the request. + * @param data.workspace + * @param data.fileKey + * @param data.s3ResourcePath + * @param data.resourceType + * @param data.storage + * @returns binary Chunk of the downloaded file + * @throws ApiError + */ +export const fileDownload = (data: FileDownloadData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/job_helpers/download_s3_file', + path: { + workspace: data.workspace + }, + query: { + file_key: data.fileKey, + s3_resource_path: data.s3ResourcePath, + resource_type: data.resourceType, + storage: data.storage + } +}); }; + +/** + * Download file to S3 bucket + * @param data The data for the request. + * @param data.workspace + * @param data.fileKey + * @param data.s3ResourcePath + * @param data.resourceType + * @returns string The downloaded file + * @throws ApiError + */ +export const fileDownloadParquetAsCsv = (data: FileDownloadParquetAsCsvData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/job_helpers/download_s3_parquet_file_as_csv', + path: { + workspace: data.workspace + }, + query: { + file_key: data.fileKey, + s3_resource_path: data.s3ResourcePath, + resource_type: data.resourceType + } +}); }; + +/** + * get job metrics + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @param data.requestBody parameters for statistics retrieval + * @returns unknown job details + * @throws ApiError + */ +export const getJobMetrics = (data: GetJobMetricsData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/job_metrics/get/{id}', + path: { + workspace: data.workspace, + id: data.id + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * set job metrics + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @param data.requestBody parameters for statistics retrieval + * @returns unknown Job progress updated + * @throws ApiError + */ +export const setJobProgress = (data: SetJobProgressData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/w/{workspace}/job_metrics/set_progress/{id}', + path: { + workspace: data.workspace, + id: data.id + }, + body: data.requestBody, + mediaType: 'application/json' +}); }; + +/** + * get job progress + * @param data The data for the request. + * @param data.workspace + * @param data.id + * @returns number job progress between 0 and 99 + * @throws ApiError + */ +export const getJobProgress = (data: GetJobProgressData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/job_metrics/get_progress/{id}', + path: { + workspace: data.workspace, + id: data.id + } +}); }; + +/** + * list log files ordered by timestamp + * @param data The data for the request. + * @param data.before filter on started before (inclusive) timestamp + * @param data.after filter on created after (exclusive) timestamp + * @param data.withError + * @returns unknown time + * @throws ApiError + */ +export const listLogFiles = (data: ListLogFilesData = {}): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/service_logs/list_files', + query: { + before: data.before, + after: data.after, + with_error: data.withError + } +}); }; + +/** + * get log file by path + * @param data The data for the request. + * @param data.path + * @returns string log stream + * @throws ApiError + */ +export const getLogFile = (data: GetLogFileData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/service_logs/get_log_file/{path}', + path: { + path: data.path + } +}); }; + +/** + * List all concurrency groups + * @returns ConcurrencyGroup all concurrency groups + * @throws ApiError + */ +export const listConcurrencyGroups = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/concurrency_groups/list' +}); }; + +/** + * Delete concurrency group + * @param data The data for the request. + * @param data.concurrencyId + * @returns unknown concurrency group removed + * @throws ApiError + */ +export const deleteConcurrencyGroup = (data: DeleteConcurrencyGroupData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/concurrency_groups/prune/{concurrency_id}', + path: { + concurrency_id: data.concurrencyId + } +}); }; + +/** + * Get the concurrency key for a job that has concurrency limits enabled + * @param data The data for the request. + * @param data.id + * @returns string concurrency key for given job + * @throws ApiError + */ +export const getConcurrencyKey = (data: GetConcurrencyKeyData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/concurrency_groups/{id}/key', + path: { + id: data.id + } +}); }; + +/** + * Get intervals of job runtime concurrency + * @param data The data for the request. + * @param data.workspace + * @param data.concurrencyKey + * @param data.rowLimit + * @param data.createdBy mask to filter exact matching user creator + * @param data.label mask to filter exact matching job's label (job labels are completed jobs with as a result an object containing a string in the array at key 'wm_labels') + * @param data.parentJob The parent job that is at the origin and responsible for the execution of this script if any + * @param data.scriptPathExact mask to filter exact matching path + * @param data.scriptPathStart mask to filter matching starting path + * @param data.schedulePath mask to filter by schedule path + * @param data.scriptHash mask to filter exact matching path + * @param data.startedBefore filter on started before (inclusive) timestamp + * @param data.startedAfter filter on started after (exclusive) timestamp + * @param data.createdOrStartedBefore filter on created_at for non non started job and started_at otherwise before (inclusive) timestamp + * @param data.running filter on running jobs + * @param data.scheduledForBeforeNow filter on jobs scheduled_for before now (hence waitinf for a worker) + * @param data.createdOrStartedAfter filter on created_at for non non started job and started_at otherwise after (exclusive) timestamp + * @param data.createdOrStartedAfterCompletedJobs filter on created_at for non non started job and started_at otherwise after (exclusive) timestamp but only for the completed jobs + * @param data.jobKinds filter on job kind (values 'preview', 'script', 'dependencies', 'flow') separated by, + * @param data.args filter on jobs containing those args as a json subset (@> in postgres) + * @param data.tag filter on jobs with a given tag/worker group + * @param data.result filter on jobs containing those result as a json subset (@> in postgres) + * @param data.page which page to return (start at 1, default 1) + * @param data.perPage number of items to return for a given page (default 30, max 100) + * @param data.isSkipped is the job skipped + * @param data.isFlowStep is the job a flow step + * @param data.hasNullParent has null parent + * @param data.success filter on successful jobs + * @param data.allWorkspaces get jobs from all workspaces (only valid if request come from the `admins` workspace) + * @param data.isNotSchedule is not a scheduled job + * @returns ExtendedJobs time + * @throws ApiError + */ +export const listExtendedJobs = (data: ListExtendedJobsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/w/{workspace}/concurrency_groups/list_jobs', + path: { + workspace: data.workspace + }, + query: { + concurrency_key: data.concurrencyKey, + row_limit: data.rowLimit, + created_by: data.createdBy, + label: data.label, + parent_job: data.parentJob, + script_path_exact: data.scriptPathExact, + script_path_start: data.scriptPathStart, + schedule_path: data.schedulePath, + script_hash: data.scriptHash, + started_before: data.startedBefore, + started_after: data.startedAfter, + created_or_started_before: data.createdOrStartedBefore, + running: data.running, + scheduled_for_before_now: data.scheduledForBeforeNow, + created_or_started_after: data.createdOrStartedAfter, + created_or_started_after_completed_jobs: data.createdOrStartedAfterCompletedJobs, + job_kinds: data.jobKinds, + args: data.args, + tag: data.tag, + result: data.result, + page: data.page, + per_page: data.perPage, + is_skipped: data.isSkipped, + is_flow_step: data.isFlowStep, + has_null_parent: data.hasNullParent, + success: data.success, + all_workspaces: data.allWorkspaces, + is_not_schedule: data.isNotSchedule + } +}); }; + +/** + * Search through jobs with a string query + * @param data The data for the request. + * @param data.workspace + * @param data.searchQuery + * @returns unknown search results + * @throws ApiError + */ +export const searchJobsIndex = (data: SearchJobsIndexData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/srch/w/{workspace}/index/search/job', + path: { + workspace: data.workspace + }, + query: { + search_query: data.searchQuery + } +}); }; \ No newline at end of file diff --git a/cli/gen/types.gen.ts b/cli/gen/types.gen.ts new file mode 100644 index 0000000000..e066cf1436 --- /dev/null +++ b/cli/gen/types.gen.ts @@ -0,0 +1,5796 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type Script = { + workspace_id?: string; + hash: string; + path: string; + /** + * The first element is the direct parent of the script, the second is the parent of the first, etc + * + */ + parent_hashes?: Array<(string)>; + summary: string; + description: string; + content: string; + created_by: string; + created_at: string; + archived: boolean; + schema?: { + [key: string]: unknown; + }; + deleted: boolean; + is_template: boolean; + extra_perms: { + [key: string]: (boolean); + }; + lock?: string; + lock_error_logs?: string; + language: 'python3' | 'deno' | 'go' | 'bash' | 'powershell' | 'postgresql' | 'mysql' | 'bigquery' | 'snowflake' | 'mssql' | 'graphql' | 'nativets' | 'bun' | 'php' | 'rust' | 'ansible'; + kind: 'script' | 'failure' | 'trigger' | 'command' | 'approval'; + starred: boolean; + tag?: string; + has_draft?: boolean; + draft_only?: boolean; + envs?: Array<(string)>; + concurrent_limit?: number; + concurrency_time_window_s?: number; + concurrency_key?: string; + cache_ttl?: number; + dedicated_worker?: boolean; + ws_error_handler_muted?: boolean; + priority?: number; + restart_unless_cancelled?: boolean; + timeout?: number; + delete_after_use?: boolean; + visible_to_runner_only?: boolean; + no_main_func: boolean; + codebase?: string; + has_preprocessor: boolean; +}; + +export type language = 'python3' | 'deno' | 'go' | 'bash' | 'powershell' | 'postgresql' | 'mysql' | 'bigquery' | 'snowflake' | 'mssql' | 'graphql' | 'nativets' | 'bun' | 'php' | 'rust' | 'ansible'; + +export type kind = 'script' | 'failure' | 'trigger' | 'command' | 'approval'; + +export type NewScript = { + path: string; + parent_hash?: string; + summary: string; + description: string; + content: string; + schema?: { + [key: string]: unknown; + }; + is_template?: boolean; + lock?: string; + language: 'python3' | 'deno' | 'go' | 'bash' | 'powershell' | 'postgresql' | 'mysql' | 'bigquery' | 'snowflake' | 'mssql' | 'graphql' | 'nativets' | 'bun' | 'php' | 'rust' | 'ansible'; + kind?: 'script' | 'failure' | 'trigger' | 'command' | 'approval'; + tag?: string; + draft_only?: boolean; + envs?: Array<(string)>; + concurrent_limit?: number; + concurrency_time_window_s?: number; + cache_ttl?: number; + dedicated_worker?: boolean; + ws_error_handler_muted?: boolean; + priority?: number; + restart_unless_cancelled?: boolean; + timeout?: number; + delete_after_use?: boolean; + deployment_message?: string; + concurrency_key?: string; + visible_to_runner_only?: boolean; + no_main_func?: boolean; + codebase?: string; + has_preprocessor?: boolean; +}; + +export type NewScriptWithDraft = NewScript & { + draft?: NewScript; + hash: string; +}; + +export type ScriptHistory = { + script_hash: string; + deployment_msg?: string; +}; + +export type ScriptArgs = { + [key: string]: unknown; +}; + +export type Input = { + id: string; + name: string; + created_by: string; + created_at: string; + is_public: boolean; + success?: boolean; +}; + +export type CreateInput = { + name: string; + args: { + [key: string]: unknown; + }; +}; + +export type UpdateInput = { + id: string; + name: string; + is_public: boolean; +}; + +export type RunnableType = 'ScriptHash' | 'ScriptPath' | 'FlowPath'; + +export type QueuedJob = { + workspace_id?: string; + id: string; + parent_job?: string; + created_by?: string; + created_at?: string; + started_at?: string; + scheduled_for?: string; + running: boolean; + script_path?: string; + script_hash?: string; + args?: ScriptArgs; + logs?: string; + raw_code?: string; + canceled: boolean; + canceled_by?: string; + canceled_reason?: string; + last_ping?: string; + job_kind: 'script' | 'preview' | 'dependencies' | 'flowdependencies' | 'appdependencies' | 'flow' | 'flowpreview' | 'script_hub' | 'identity' | 'deploymentcallback' | 'singlescriptflow'; + schedule_path?: string; + /** + * The user (u/userfoo) or group (g/groupfoo) whom + * the execution of this script will be permissioned_as and by extension its DT_TOKEN. + * + */ + permissioned_as: string; + flow_status?: FlowStatus; + raw_flow?: FlowValue; + is_flow_step: boolean; + language?: 'python3' | 'deno' | 'go' | 'bash' | 'powershell' | 'postgresql' | 'mysql' | 'bigquery' | 'snowflake' | 'mssql' | 'graphql' | 'nativets' | 'bun' | 'php' | 'rust' | 'ansible'; + email: string; + visible_to_owner: boolean; + mem_peak?: number; + tag: string; + priority?: number; + self_wait_time_ms?: number; + aggregate_wait_time_ms?: number; +}; + +export type job_kind = 'script' | 'preview' | 'dependencies' | 'flowdependencies' | 'appdependencies' | 'flow' | 'flowpreview' | 'script_hub' | 'identity' | 'deploymentcallback' | 'singlescriptflow'; + +export type CompletedJob = { + workspace_id?: string; + id: string; + parent_job?: string; + created_by: string; + created_at: string; + started_at: string; + duration_ms: number; + success: boolean; + script_path?: string; + script_hash?: string; + args?: ScriptArgs; + result?: unknown; + logs?: string; + deleted?: boolean; + raw_code?: string; + canceled: boolean; + canceled_by?: string; + canceled_reason?: string; + job_kind: 'script' | 'preview' | 'dependencies' | 'flow' | 'flowdependencies' | 'appdependencies' | 'flowpreview' | 'script_hub' | 'identity' | 'deploymentcallback' | 'singlescriptflow'; + schedule_path?: string; + /** + * The user (u/userfoo) or group (g/groupfoo) whom + * the execution of this script will be permissioned_as and by extension its DT_TOKEN. + * + */ + permissioned_as: string; + flow_status?: FlowStatus; + raw_flow?: FlowValue; + is_flow_step: boolean; + language?: 'python3' | 'deno' | 'go' | 'bash' | 'powershell' | 'postgresql' | 'mysql' | 'bigquery' | 'snowflake' | 'mssql' | 'graphql' | 'nativets' | 'bun' | 'php' | 'rust' | 'ansible'; + is_skipped: boolean; + email: string; + visible_to_owner: boolean; + mem_peak?: number; + tag: string; + priority?: number; + labels?: Array<(string)>; + self_wait_time_ms?: number; + aggregate_wait_time_ms?: number; +}; + +export type ObscuredJob = { + typ?: string; + started_at?: string; + duration_ms?: number; +}; + +export type Job = (CompletedJob & { + type?: 'CompletedJob'; +}) | (QueuedJob & { + type?: 'QueuedJob'; +}); + +export type type = 'CompletedJob'; + +export type User = { + email: string; + username: string; + is_admin: boolean; + is_super_admin: boolean; + created_at: string; + operator: boolean; + disabled: boolean; + groups?: Array<(string)>; + folders: Array<(string)>; + folders_owners: Array<(string)>; +}; + +export type UserUsage = { + email?: string; + executions?: number; +}; + +export type Login = { + email: string; + password: string; +}; + +export type EditWorkspaceUser = { + is_admin?: boolean; + operator?: boolean; + disabled?: boolean; +}; + +export type TruncatedToken = { + label?: string; + expiration?: string; + token_prefix: string; + created_at: string; + last_used_at: string; + scopes?: Array<(string)>; +}; + +export type NewToken = { + label?: string; + expiration?: string; + scopes?: Array<(string)>; +}; + +export type NewTokenImpersonate = { + label?: string; + expiration?: string; + impersonate_email: string; +}; + +export type ListableVariable = { + workspace_id: string; + path: string; + value?: string; + is_secret: boolean; + description?: string; + account?: number; + is_oauth?: boolean; + extra_perms: { + [key: string]: (boolean); + }; + is_expired?: boolean; + refresh_error?: string; + is_linked?: boolean; + is_refreshed?: boolean; + expires_at?: string; +}; + +export type ContextualVariable = { + name: string; + value: string; + description: string; + is_custom: boolean; +}; + +export type CreateVariable = { + path: string; + value: string; + is_secret: boolean; + description: string; + account?: number; + is_oauth?: boolean; + expires_at?: string; +}; + +export type EditVariable = { + path?: string; + value?: string; + is_secret?: boolean; + description?: string; +}; + +export type AuditLog = { + id: number; + timestamp: string; + username: string; + operation: 'jobs.run' | 'jobs.run.script' | 'jobs.run.preview' | 'jobs.run.flow' | 'jobs.run.flow_preview' | 'jobs.run.script_hub' | 'jobs.run.dependencies' | 'jobs.run.identity' | 'jobs.run.noop' | 'jobs.flow_dependencies' | 'jobs' | 'jobs.cancel' | 'jobs.force_cancel' | 'jobs.disapproval' | 'jobs.delete' | 'account.delete' | 'openai.request' | 'resources.create' | 'resources.update' | 'resources.delete' | 'resource_types.create' | 'resource_types.update' | 'resource_types.delete' | 'schedule.create' | 'schedule.setenabled' | 'schedule.edit' | 'schedule.delete' | 'scripts.create' | 'scripts.update' | 'scripts.archive' | 'scripts.delete' | 'users.create' | 'users.delete' | 'users.update' | 'users.login' | 'users.logout' | 'users.accept_invite' | 'users.decline_invite' | 'users.token.create' | 'users.token.delete' | 'users.add_to_workspace' | 'users.add_global' | 'users.setpassword' | 'users.impersonate' | 'users.leave_workspace' | 'oauth.login' | 'oauth.signup' | 'variables.create' | 'variables.delete' | 'variables.update' | 'flows.create' | 'flows.update' | 'flows.delete' | 'flows.archive' | 'apps.create' | 'apps.update' | 'apps.delete' | 'folder.create' | 'folder.update' | 'folder.delete' | 'folder.add_owner' | 'folder.remove_owner' | 'group.create' | 'group.delete' | 'group.edit' | 'group.adduser' | 'group.removeuser' | 'igroup.create' | 'igroup.delete' | 'igroup.adduser' | 'igroup.removeuser' | 'variables.decrypt_secret' | 'workspaces.edit_command_script' | 'workspaces.edit_deploy_to' | 'workspaces.edit_auto_invite_domain' | 'workspaces.edit_webhook' | 'workspaces.edit_copilot_config' | 'workspaces.edit_error_handler' | 'workspaces.create' | 'workspaces.update' | 'workspaces.archive' | 'workspaces.unarchive' | 'workspaces.delete'; + action_kind: 'Created' | 'Updated' | 'Delete' | 'Execute'; + resource?: string; + parameters?: { + [key: string]: unknown; + }; +}; + +export type operation = 'jobs.run' | 'jobs.run.script' | 'jobs.run.preview' | 'jobs.run.flow' | 'jobs.run.flow_preview' | 'jobs.run.script_hub' | 'jobs.run.dependencies' | 'jobs.run.identity' | 'jobs.run.noop' | 'jobs.flow_dependencies' | 'jobs' | 'jobs.cancel' | 'jobs.force_cancel' | 'jobs.disapproval' | 'jobs.delete' | 'account.delete' | 'openai.request' | 'resources.create' | 'resources.update' | 'resources.delete' | 'resource_types.create' | 'resource_types.update' | 'resource_types.delete' | 'schedule.create' | 'schedule.setenabled' | 'schedule.edit' | 'schedule.delete' | 'scripts.create' | 'scripts.update' | 'scripts.archive' | 'scripts.delete' | 'users.create' | 'users.delete' | 'users.update' | 'users.login' | 'users.logout' | 'users.accept_invite' | 'users.decline_invite' | 'users.token.create' | 'users.token.delete' | 'users.add_to_workspace' | 'users.add_global' | 'users.setpassword' | 'users.impersonate' | 'users.leave_workspace' | 'oauth.login' | 'oauth.signup' | 'variables.create' | 'variables.delete' | 'variables.update' | 'flows.create' | 'flows.update' | 'flows.delete' | 'flows.archive' | 'apps.create' | 'apps.update' | 'apps.delete' | 'folder.create' | 'folder.update' | 'folder.delete' | 'folder.add_owner' | 'folder.remove_owner' | 'group.create' | 'group.delete' | 'group.edit' | 'group.adduser' | 'group.removeuser' | 'igroup.create' | 'igroup.delete' | 'igroup.adduser' | 'igroup.removeuser' | 'variables.decrypt_secret' | 'workspaces.edit_command_script' | 'workspaces.edit_deploy_to' | 'workspaces.edit_auto_invite_domain' | 'workspaces.edit_webhook' | 'workspaces.edit_copilot_config' | 'workspaces.edit_error_handler' | 'workspaces.create' | 'workspaces.update' | 'workspaces.archive' | 'workspaces.unarchive' | 'workspaces.delete'; + +export type action_kind = 'Created' | 'Updated' | 'Delete' | 'Execute'; + +export type MainArgSignature = { + type: 'Valid' | 'Invalid'; + error: string; + star_args: boolean; + star_kwargs?: boolean; + args: Array<{ + name: string; + typ: ('float' | 'int' | 'bool' | 'email' | 'unknown' | 'bytes' | 'dict' | 'datetime' | 'sql' | { + resource: (string) | null; +} | { + str: Array<(string)> | null; +} | { + object: Array<{ + key: string; + typ: ('float' | 'int' | 'bool' | 'email' | 'unknown' | 'bytes' | 'dict' | 'datetime' | 'sql' | { + str: unknown; +}); + }>; +} | { + list: (('float' | 'int' | 'bool' | 'email' | 'unknown' | 'bytes' | 'dict' | 'datetime' | 'sql' | { + str: unknown; +}) | null); +}); + has_default?: boolean; + default?: unknown; + }>; + no_main_func: (boolean) | null; + has_preprocessor: (boolean) | null; +}; + +export type type2 = 'Valid' | 'Invalid'; + +export type Preview = { + content?: string; + path?: string; + args: ScriptArgs; + language?: 'python3' | 'deno' | 'go' | 'bash' | 'powershell' | 'postgresql' | 'mysql' | 'bigquery' | 'snowflake' | 'mssql' | 'graphql' | 'nativets' | 'bun' | 'php' | 'rust' | 'ansible'; + tag?: string; + kind?: 'code' | 'identity' | 'http'; + dedicated_worker?: boolean; + lock?: string; +}; + +export type kind2 = 'code' | 'identity' | 'http'; + +export type WorkflowTask = { + args: ScriptArgs; +}; + +export type WorkflowStatusRecord = { + [key: string]: WorkflowStatus; +}; + +export type WorkflowStatus = { + scheduled_for?: string; + started_at?: string; + duration_ms?: number; + name?: string; +}; + +export type CreateResource = { + path: string; + value: unknown; + description?: string; + resource_type: string; +}; + +export type EditResource = { + path?: string; + description?: string; + value?: unknown; +}; + +export type Resource = { + workspace_id?: string; + path: string; + description?: string; + resource_type: string; + value?: unknown; + is_oauth: boolean; + extra_perms?: { + [key: string]: (boolean); + }; + created_by?: string; + edited_at?: string; +}; + +export type ListableResource = { + workspace_id?: string; + path: string; + description?: string; + resource_type: string; + value?: unknown; + is_oauth: boolean; + extra_perms?: { + [key: string]: (boolean); + }; + is_expired?: boolean; + refresh_error?: string; + is_linked: boolean; + is_refreshed: boolean; + account?: number; + created_by?: string; + edited_at?: string; +}; + +export type ResourceType = { + workspace_id?: string; + name: string; + schema?: unknown; + description?: string; + created_by?: string; + edited_at?: string; + format_extension?: string; +}; + +export type EditResourceType = { + schema?: unknown; + description?: string; +}; + +export type Schedule = { + path: string; + edited_by: string; + edited_at: string; + schedule: string; + timezone: string; + enabled: boolean; + script_path: string; + is_flow: boolean; + args?: ScriptArgs; + extra_perms: { + [key: string]: (boolean); + }; + email: string; + error?: string; + on_failure?: string; + on_failure_times?: number; + on_failure_exact?: boolean; + on_failure_extra_args?: ScriptArgs; + on_recovery?: string; + on_recovery_times?: number; + on_recovery_extra_args?: ScriptArgs; + on_success?: string; + on_success_extra_args?: ScriptArgs; + ws_error_handler_muted?: boolean; + retry?: Retry; + summary?: string; + no_flow_overlap?: boolean; + tag?: string; + paused_until?: string; +}; + +export type ScheduleWJobs = Schedule & { + jobs?: Array<{ + id: string; + success: boolean; + duration_ms: number; + }>; +}; + +export type NewSchedule = { + path: string; + schedule: string; + timezone: string; + script_path: string; + is_flow: boolean; + args: ScriptArgs; + enabled?: boolean; + on_failure?: string; + on_failure_times?: number; + on_failure_exact?: boolean; + on_failure_extra_args?: ScriptArgs; + on_recovery?: string; + on_recovery_times?: number; + on_recovery_extra_args?: ScriptArgs; + on_success?: string; + on_success_extra_args?: ScriptArgs; + ws_error_handler_muted?: boolean; + retry?: Retry; + no_flow_overlap?: boolean; + summary?: string; + tag?: string; + paused_until?: string; +}; + +export type EditSchedule = { + schedule: string; + timezone: string; + args: ScriptArgs; + on_failure?: string; + on_failure_times?: number; + on_failure_exact?: boolean; + on_failure_extra_args?: ScriptArgs; + on_recovery?: string; + on_recovery_times?: number; + on_recovery_extra_args?: ScriptArgs; + on_success?: string; + on_success_extra_args?: ScriptArgs; + ws_error_handler_muted?: boolean; + retry?: Retry; + no_flow_overlap?: boolean; + summary?: string; + tag?: string; + paused_until?: string; +}; + +export type HttpTrigger = { + path: string; + edited_by: string; + edited_at: string; + script_path: string; + route_path: string; + is_flow: boolean; + extra_perms: { + [key: string]: (boolean); + }; + email: string; + workspace_id: string; + http_method: 'get' | 'post' | 'put' | 'delete' | 'patch'; + is_async: boolean; + requires_auth: boolean; +}; + +export type http_method = 'get' | 'post' | 'put' | 'delete' | 'patch'; + +export type NewHttpTrigger = { + path: string; + script_path: string; + route_path: string; + is_flow: boolean; + http_method: 'get' | 'post' | 'put' | 'delete' | 'patch'; + is_async: boolean; + requires_auth: boolean; +}; + +export type EditHttpTrigger = { + path: string; + script_path: string; + route_path?: string; + is_flow: boolean; + http_method: 'get' | 'post' | 'put' | 'delete' | 'patch'; + is_async: boolean; + requires_auth: boolean; +}; + +export type Group = { + name: string; + summary?: string; + members?: Array<(string)>; + extra_perms?: { + [key: string]: (boolean); + }; +}; + +export type InstanceGroup = { + name: string; + summary?: string; + emails?: Array<(string)>; +}; + +export type Folder = { + name: string; + owners: Array<(string)>; + extra_perms: { + [key: string]: (boolean); + }; + summary?: string; + created_by?: string; + edited_at?: string; +}; + +export type WorkerPing = { + worker: string; + worker_instance: string; + last_ping?: number; + started_at: string; + ip: string; + jobs_executed: number; + custom_tags?: Array<(string)>; + worker_group: string; + wm_version: string; + last_job_id?: string; + last_job_workspace_id?: string; + occupancy_rate?: number; + memory?: number; + vcpus?: number; + memory_usage?: number; + wm_memory_usage?: number; +}; + +export type UserWorkspaceList = { + email: string; + workspaces: Array<{ + id: string; + name: string; + username: string; + }>; +}; + +export type CreateWorkspace = { + id: string; + name: string; + username?: string; +}; + +export type Workspace = { + id: string; + name: string; + owner: string; + domain?: string; +}; + +export type WorkspaceInvite = { + workspace_id: string; + email: string; + is_admin: boolean; + operator: boolean; +}; + +export type GlobalUserInfo = { + email: string; + login_type: 'password' | 'github'; + super_admin: boolean; + verified: boolean; + name?: string; + company?: string; + username?: string; +}; + +export type login_type = 'password' | 'github'; + +export type Flow = OpenFlow & FlowMetadata; + +export type ExtraPerms = { + [key: string]: (boolean); +}; + +export type FlowMetadata = { + workspace_id?: string; + path: string; + edited_by: string; + edited_at: string; + archived: boolean; + extra_perms: ExtraPerms; + starred?: boolean; + draft_only?: boolean; + tag?: string; + ws_error_handler_muted?: boolean; + priority?: number; + dedicated_worker?: boolean; + timeout?: number; + visible_to_runner_only?: boolean; +}; + +export type OpenFlowWPath = OpenFlow & { + path: string; + tag?: string; + ws_error_handler_muted?: boolean; + priority?: number; + dedicated_worker?: boolean; + timeout?: number; + visible_to_runner_only?: boolean; +}; + +export type FlowPreview = { + value: FlowValue; + path?: string; + args: ScriptArgs; + tag?: string; + restarted_from?: RestartedFrom; +}; + +export type RestartedFrom = { + flow_job_id?: string; + step_id?: string; + branch_or_iteration_n?: number; +}; + +export type Policy = { + triggerables?: { + [key: string]: { + [key: string]: unknown; + }; + }; + triggerables_v2?: { + [key: string]: { + [key: string]: unknown; + }; + }; + execution_mode?: 'viewer' | 'publisher' | 'anonymous'; + on_behalf_of?: string; + on_behalf_of_email?: string; +}; + +export type execution_mode = 'viewer' | 'publisher' | 'anonymous'; + +export type ListableApp = { + id: number; + workspace_id: string; + path: string; + summary: string; + version: number; + extra_perms: { + [key: string]: (boolean); + }; + starred?: boolean; + edited_at: string; + execution_mode: 'viewer' | 'publisher' | 'anonymous'; +}; + +export type ListableRawApp = { + workspace_id: string; + path: string; + summary: string; + extra_perms: { + [key: string]: (boolean); + }; + starred?: boolean; + version: number; + edited_at: string; +}; + +export type AppWithLastVersion = { + id: number; + workspace_id: string; + path: string; + summary: string; + versions: Array<(number)>; + created_by: string; + created_at: string; + value: { + [key: string]: unknown; + }; + policy: Policy; + execution_mode: 'viewer' | 'publisher' | 'anonymous'; + extra_perms: { + [key: string]: (boolean); + }; +}; + +export type AppWithLastVersionWDraft = AppWithLastVersion & { + draft_only?: boolean; + draft?: unknown; +}; + +export type AppHistory = { + version: number; + deployment_msg?: string; +}; + +export type FlowVersion = { + id: number; + created_at: string; + deployment_msg?: string; +}; + +export type SlackToken = { + access_token: string; + team_id: string; + team_name: string; + bot: { + bot_access_token?: string; + }; +}; + +export type TokenResponse = { + access_token: string; + expires_in?: number; + refresh_token?: string; + scope?: Array<(string)>; +}; + +export type HubScriptKind = unknown; + +export type PolarsClientKwargs = { + region_name: string; +}; + +export type LargeFileStorage = { + type?: 'S3Storage' | 'AzureBlobStorage' | 'AzureWorkloadIdentity' | 'S3AwsOidc'; + s3_resource_path?: string; + azure_blob_resource_path?: string; + public_resource?: boolean; + secondary_storage?: { + [key: string]: { + type?: 'S3Storage' | 'AzureBlobStorage' | 'AzureWorkloadIdentity' | 'S3AwsOidc'; + s3_resource_path?: string; + azure_blob_resource_path?: string; + public_resource?: boolean; + }; + }; +}; + +export type type3 = 'S3Storage' | 'AzureBlobStorage' | 'AzureWorkloadIdentity' | 'S3AwsOidc'; + +export type WindmillLargeFile = { + s3: string; +}; + +export type WindmillFileMetadata = { + mime_type?: string; + size_in_bytes?: number; + last_modified?: string; + expires?: string; + version_id?: string; +}; + +export type WindmillFilePreview = { + msg?: string; + content?: string; + content_type: 'RawText' | 'Csv' | 'Parquet' | 'Unknown'; +}; + +export type content_type = 'RawText' | 'Csv' | 'Parquet' | 'Unknown'; + +export type S3Resource = { + bucket: string; + region: string; + endPoint: string; + useSSL: boolean; + accessKey?: string; + secretKey?: string; + pathStyle: boolean; +}; + +export type WorkspaceGitSyncSettings = { + include_path?: Array<(string)>; + include_type?: Array<('script' | 'flow' | 'app' | 'folder' | 'resource' | 'variable' | 'secret' | 'resourcetype' | 'schedule' | 'user' | 'group')>; + repositories?: Array; +}; + +export type WorkspaceDeployUISettings = { + include_path?: Array<(string)>; + include_type?: Array<('script' | 'flow' | 'app' | 'resource' | 'variable' | 'secret')>; +}; + +export type WorkspaceDefaultScripts = { + order?: Array<(string)>; + hidden?: Array<(string)>; + default_script_content?: { + [key: string]: (string); + }; +}; + +export type GitRepositorySettings = { + script_path: string; + git_repo_resource_path: string; + use_individual_branch?: boolean; + group_by_folder?: boolean; + exclude_types_override?: Array<('script' | 'flow' | 'app' | 'folder' | 'resource' | 'variable' | 'secret' | 'resourcetype' | 'schedule' | 'user' | 'group')>; +}; + +export type UploadFilePart = { + part_number: number; + tag: string; +}; + +export type MetricMetadata = { + id: string; + name?: string; +}; + +export type ScalarMetric = { + metric_id?: string; + value: number; +}; + +export type TimeseriesMetric = { + metric_id?: string; + values: Array; +}; + +export type MetricDataPoint = { + timestamp: string; + value: number; +}; + +export type RawScriptForDependencies = { + raw_code: string; + path: string; + language: 'python3' | 'deno' | 'go' | 'bash' | 'powershell' | 'postgresql' | 'mysql' | 'bigquery' | 'snowflake' | 'mssql' | 'graphql' | 'nativets' | 'bun' | 'php' | 'rust' | 'ansible'; +}; + +export type ConcurrencyGroup = { + concurrency_key: string; + total_running: number; +}; + +export type ExtendedJobs = { + jobs: Array; + obscured_jobs: Array; + /** + * Obscured jobs omitted for security because of too specific filtering + */ + omitted_obscured_jobs?: boolean; +}; + +export type ExportedUser = { + email: string; + password_hash?: string; + super_admin: boolean; + verified: boolean; + name?: string; + company?: string; + first_time_user: boolean; + username?: string; +}; + +export type GlobalSetting = { + name: string; + value: { + [key: string]: unknown; + }; +}; + +export type Config = { + name: string; + config?: { + [key: string]: unknown; + }; +}; + +export type ExportedInstanceGroup = { + name: string; + summary?: string; + emails?: Array<(string)>; + id?: string; + scim_display_name?: string; + external_id?: string; +}; + +export type JobSearchHit = { + dancer?: string; +}; + +export type OpenFlow = { + summary: string; + description?: string; + value: FlowValue; + schema?: { + [key: string]: unknown; + }; +}; + +export type FlowValue = { + modules: Array; + failure_module?: FlowModule; + preprocessor_module?: FlowModule; + same_worker?: boolean; + concurrent_limit?: number; + concurrency_key?: string; + concurrency_time_window_s?: number; + skip_expr?: string; + cache_ttl?: number; + priority?: number; + early_return?: string; +}; + +export type Retry = { + constant?: { + attempts?: number; + seconds?: number; + }; + exponential?: { + attempts?: number; + multiplier?: number; + seconds?: number; + random_factor?: number; + }; +}; + +export type FlowModule = { + id: string; + value: FlowModuleValue; + stop_after_if?: { + skip_if_stopped?: boolean; + expr: string; + }; + stop_after_all_iters_if?: { + skip_if_stopped?: boolean; + expr: string; + }; + sleep?: InputTransform; + cache_ttl?: number; + timeout?: number; + delete_after_use?: boolean; + summary?: string; + mock?: { + enabled?: boolean; + return_value?: unknown; + }; + suspend?: { + required_events?: number; + timeout?: number; + resume_form?: { + schema?: { + [key: string]: unknown; + }; + }; + user_auth_required?: boolean; + user_groups_required?: InputTransform; + self_approval_disabled?: boolean; + hide_cancel?: boolean; + continue_on_disapprove_timeout?: boolean; + }; + priority?: number; + continue_on_error?: boolean; + retry?: Retry; +}; + +export type InputTransform = StaticTransform | JavascriptTransform; + +export type StaticTransform = { + value?: unknown; + type: 'static'; +}; + +export type JavascriptTransform = { + expr: string; + type: 'javascript'; +}; + +export type FlowModuleValue = RawScript | PathScript | PathFlow | ForloopFlow | WhileloopFlow | BranchOne | BranchAll | Identity; + +export type RawScript = { + input_transforms: { + [key: string]: InputTransform; + }; + content: string; + language: 'deno' | 'bun' | 'python3' | 'go' | 'bash' | 'powershell' | 'postgresql' | 'mysql' | 'bigquery' | 'snowflake' | 'mssql' | 'graphql' | 'nativets' | 'php'; + path?: string; + lock?: string; + type: 'rawscript'; + tag?: string; + concurrent_limit?: number; + concurrency_time_window_s?: number; + custom_concurrency_key?: string; +}; + +export type language2 = 'deno' | 'bun' | 'python3' | 'go' | 'bash' | 'powershell' | 'postgresql' | 'mysql' | 'bigquery' | 'snowflake' | 'mssql' | 'graphql' | 'nativets' | 'php'; + +export type PathScript = { + input_transforms: { + [key: string]: InputTransform; + }; + path: string; + hash?: string; + type: 'script'; + tag_override?: string; +}; + +export type PathFlow = { + input_transforms: { + [key: string]: InputTransform; + }; + path: string; + type: 'flow'; +}; + +export type ForloopFlow = { + modules: Array; + iterator: InputTransform; + skip_failures: boolean; + type: 'forloopflow'; + parallel?: boolean; + parallelism?: number; +}; + +export type WhileloopFlow = { + modules: Array; + skip_failures: boolean; + type: 'whileloopflow'; + parallel?: boolean; + parallelism?: number; +}; + +export type BranchOne = { + branches: Array<{ + summary?: string; + expr: string; + modules: Array; + }>; + default: Array; + type: 'branchone'; +}; + +export type BranchAll = { + branches: Array<{ + summary?: string; + skip_failure?: boolean; + modules: Array; + }>; + type: 'branchall'; + parallel?: boolean; +}; + +export type Identity = { + type: 'identity'; + flow?: boolean; +}; + +export type FlowStatus = { + step: number; + modules: Array; + user_states?: { + [key: string]: unknown; + }; + preprocessor_module?: (FlowStatusModule); + failure_module: (FlowStatusModule & { + parent_module?: string; +}); + retry?: { + fail_count?: number; + failed_jobs?: Array<(string)>; + }; +}; + +export type FlowStatusModule = { + type: 'WaitingForPriorSteps' | 'WaitingForEvents' | 'WaitingForExecutor' | 'InProgress' | 'Success' | 'Failure'; + id?: string; + job?: string; + count?: number; + progress?: number; + iterator?: { + index?: number; + itered?: Array; + args?: unknown; + }; + flow_jobs?: Array<(string)>; + flow_jobs_success?: Array<(boolean)>; + branch_chosen?: { + type: 'branch' | 'default'; + branch?: number; + }; + branchall?: { + branch: number; + len: number; + }; + approvers?: Array<{ + resume_id: number; + approver: string; + }>; + failed_retries?: Array<(string)>; +}; + +export type type4 = 'WaitingForPriorSteps' | 'WaitingForEvents' | 'WaitingForExecutor' | 'InProgress' | 'Success' | 'Failure'; + +export type ParameterKey = string; + +export type ParameterWorkspaceId = string; + +export type ParameterVersionId = number; + +export type ParameterToken = string; + +export type ParameterAccountId = number; + +export type ParameterClientName = string; + +export type ParameterScriptPath = string; + +export type ParameterScriptHash = string; + +export type ParameterJobId = string; + +export type ParameterPath = string; + +export type ParameterPathId = number; + +export type ParameterPathVersion = number; + +export type ParameterName = string; + +/** + * which page to return (start at 1, default 1) + */ +export type ParameterPage = number; + +/** + * number of items to return for a given page (default 30, max 100) + */ +export type ParameterPerPage = number; + +/** + * order by desc order (default true) + */ +export type ParameterOrderDesc = boolean; + +/** + * mask to filter exact matching user creator + */ +export type ParameterCreatedBy = string; + +/** + * mask to filter exact matching job's label (job labels are completed jobs with as a result an object containing a string in the array at key 'wm_labels') + */ +export type ParameterLabel = string; + +/** + * The parent job that is at the origin and responsible for the execution of this script if any + */ +export type ParameterParentJob = string; + +/** + * Override the tag to use + */ +export type ParameterWorkerTag = string; + +/** + * Override the cache time to live (in seconds). Can not be used to disable caching, only override with a new cache ttl + */ +export type ParameterCacheTtl = string; + +/** + * The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) + */ +export type ParameterNewJobId = string; + +/** + * List of headers's keys (separated with ',') whove value are added to the args + * Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key + * + */ +export type ParameterIncludeHeader = string; + +/** + * The maximum size of the queue for which the request would get rejected if that job would push it above that limit + * + */ +export type ParameterQueueLimit = string; + +/** + * The base64 encoded payload that has been encoded as a JSON. e.g how to encode such payload encodeURIComponent + * `encodeURIComponent(btoa(JSON.stringify({a: 2})))` + * + */ +export type ParameterPayload = string; + +/** + * mask to filter matching starting path + */ +export type ParameterScriptStartPath = string; + +/** + * mask to filter by schedule path + */ +export type ParameterSchedulePath = string; + +/** + * mask to filter exact matching path + */ +export type ParameterScriptExactPath = string; + +/** + * mask to filter exact matching path + */ +export type ParameterScriptExactHash = string; + +/** + * filter on created before (inclusive) timestamp + */ +export type ParameterCreatedBefore = string; + +/** + * filter on created after (exclusive) timestamp + */ +export type ParameterCreatedAfter = string; + +/** + * filter on started before (inclusive) timestamp + */ +export type ParameterStartedBefore = string; + +/** + * filter on started after (exclusive) timestamp + */ +export type ParameterStartedAfter = string; + +/** + * filter on started before (inclusive) timestamp + */ +export type ParameterBefore = string; + +/** + * filter on created_at for non non started job and started_at otherwise after (exclusive) timestamp + */ +export type ParameterCreatedOrStartedAfter = string; + +/** + * filter on created_at for non non started job and started_at otherwise after (exclusive) timestamp but only for the completed jobs + */ +export type ParameterCreatedOrStartedAfterCompletedJob = string; + +/** + * filter on created_at for non non started job and started_at otherwise before (inclusive) timestamp + */ +export type ParameterCreatedOrStartedBefore = string; + +/** + * filter on successful jobs + */ +export type ParameterSuccess = boolean; + +/** + * filter on jobs scheduled_for before now (hence waitinf for a worker) + */ +export type ParameterScheduledForBeforeNow = boolean; + +/** + * filter on suspended jobs + */ +export type ParameterSuspended = boolean; + +/** + * filter on running jobs + */ +export type ParameterRunning = boolean; + +/** + * filter on jobs containing those args as a json subset (@> in postgres) + */ +export type ParameterArgsFilter = string; + +/** + * filter on jobs with a given tag/worker group + */ +export type ParameterTag = string; + +/** + * filter on jobs containing those result as a json subset (@> in postgres) + */ +export type ParameterResultFilter = string; + +/** + * filter on created after (exclusive) timestamp + */ +export type ParameterAfter = string; + +/** + * filter on exact username of user + */ +export type ParameterUsername = string; + +/** + * filter on exact or prefix name of operation + */ +export type ParameterOperation = string; + +/** + * filter on exact or prefix name of resource + */ +export type ParameterResourceName = string; + +/** + * filter on type of operation + */ +export type ParameterActionKind = 'Create' | 'Update' | 'Delete' | 'Execute'; + +/** + * filter on job kind (values 'preview', 'script', 'dependencies', 'flow') separated by, + */ +export type ParameterJobKinds = string; + +export type ParameterRunnableId = string; + +export type ParameterRunnableTypeQuery = RunnableType; + +export type ParameterInputId = string; + +export type ParameterGetStarted = boolean; + +export type ParameterConcurrencyId = string; + +export type BackendVersionResponse = (string); + +export type BackendUptodateResponse = (string); + +export type GetLicenseIdResponse = (string); + +export type GetOpenApiYamlResponse = (string); + +export type GetAuditLogData = { + id: number; + workspace: string; +}; + +export type GetAuditLogResponse = (AuditLog); + +export type ListAuditLogsData = { + /** + * filter on type of operation + */ + actionKind?: 'Create' | 'Update' | 'Delete' | 'Execute'; + /** + * filter on created after (exclusive) timestamp + */ + after?: string; + /** + * filter on started before (inclusive) timestamp + */ + before?: string; + /** + * comma separated list of operations to exclude + */ + excludeOperations?: string; + /** + * filter on exact or prefix name of operation + */ + operation?: string; + /** + * comma separated list of exact operations to include + */ + operations?: string; + /** + * which page to return (start at 1, default 1) + */ + page?: number; + /** + * number of items to return for a given page (default 30, max 100) + */ + perPage?: number; + /** + * filter on exact or prefix name of resource + */ + resource?: string; + /** + * filter on exact username of user + */ + username?: string; + workspace: string; +}; + +export type ListAuditLogsResponse = (Array); + +export type LoginData = { + /** + * credentials + */ + requestBody: Login; +}; + +export type LoginResponse = (string); + +export type LogoutResponse = (string); + +export type GetUserData = { + username: string; + workspace: string; +}; + +export type GetUserResponse = (User); + +export type UpdateUserData = { + /** + * new user + */ + requestBody: EditWorkspaceUser; + username: string; + workspace: string; +}; + +export type UpdateUserResponse = (string); + +export type IsOwnerOfPathData = { + path: string; + workspace: string; +}; + +export type IsOwnerOfPathResponse = (boolean); + +export type SetPasswordData = { + /** + * set password + */ + requestBody: { + password: string; + }; +}; + +export type SetPasswordResponse = (string); + +export type CreateUserGloballyData = { + /** + * user info + */ + requestBody: { + email: string; + password: string; + super_admin: boolean; + name?: string; + company?: string; + }; +}; + +export type CreateUserGloballyResponse = (string); + +export type GlobalUserUpdateData = { + email: string; + /** + * new user info + */ + requestBody: { + is_super_admin?: boolean; + name?: string; + }; +}; + +export type GlobalUserUpdateResponse = (string); + +export type GlobalUsernameInfoData = { + email: string; +}; + +export type GlobalUsernameInfoResponse = ({ + username: string; + workspace_usernames: Array<{ + workspace_id: string; + username: string; + }>; +}); + +export type GlobalUserRenameData = { + email: string; + /** + * new username + */ + requestBody: { + new_username: string; + }; +}; + +export type GlobalUserRenameResponse = (string); + +export type GlobalUserDeleteData = { + email: string; +}; + +export type GlobalUserDeleteResponse = (string); + +export type GlobalUsersOverwriteData = { + /** + * List of users + */ + requestBody: Array; +}; + +export type GlobalUsersOverwriteResponse = (string); + +export type GlobalUsersExportResponse = (Array); + +export type DeleteUserData = { + username: string; + workspace: string; +}; + +export type DeleteUserResponse = (string); + +export type ListWorkspacesResponse = (Array); + +export type IsDomainAllowedResponse = (boolean); + +export type ListUserWorkspacesResponse = (UserWorkspaceList); + +export type ListWorkspacesAsSuperAdminData = { + /** + * which page to return (start at 1, default 1) + */ + page?: number; + /** + * number of items to return for a given page (default 30, max 100) + */ + perPage?: number; +}; + +export type ListWorkspacesAsSuperAdminResponse = (Array); + +export type CreateWorkspaceData = { + /** + * new token + */ + requestBody: CreateWorkspace; +}; + +export type CreateWorkspaceResponse = (string); + +export type ExistsWorkspaceData = { + /** + * id of workspace + */ + requestBody: { + id: string; + }; +}; + +export type ExistsWorkspaceResponse = (boolean); + +export type ExistsUsernameData = { + requestBody: { + id: string; + username: string; + }; +}; + +export type ExistsUsernameResponse = (boolean); + +export type GetGlobalData = { + key: string; +}; + +export type GetGlobalResponse = (unknown); + +export type SetGlobalData = { + key: string; + /** + * value set + */ + requestBody: { + value?: unknown; + }; +}; + +export type SetGlobalResponse = (string); + +export type GetLocalResponse = (unknown); + +export type TestSmtpData = { + /** + * test smtp payload + */ + requestBody: { + to: string; + smtp: { + host: string; + username: string; + password: string; + port: number; + from: string; + tls_implicit: boolean; + }; + }; +}; + +export type TestSmtpResponse = (string); + +export type TestCriticalChannelsData = { + /** + * test critical channel payload + */ + requestBody: Array<{ + email?: string; + slack_channel?: string; + }>; +}; + +export type TestCriticalChannelsResponse = (string); + +export type TestLicenseKeyData = { + /** + * test license key + */ + requestBody: { + license_key: string; + }; +}; + +export type TestLicenseKeyResponse = (string); + +export type TestObjectStorageConfigData = { + /** + * test object storage config + */ + requestBody: { + [key: string]: unknown; + }; +}; + +export type TestObjectStorageConfigResponse = (string); + +export type SendStatsResponse = (string); + +export type GetLatestKeyRenewalAttemptResponse = ({ + result: string; + attempted_at: string; +} | null); + +export type RenewLicenseKeyData = { + licenseKey?: string; +}; + +export type RenewLicenseKeyResponse = (string); + +export type CreateCustomerPortalSessionData = { + licenseKey?: string; +}; + +export type CreateCustomerPortalSessionResponse = (string); + +export type TestMetadataData = { + /** + * test metadata + */ + requestBody: string; +}; + +export type TestMetadataResponse = (string); + +export type ListGlobalSettingsResponse = (Array); + +export type GetCurrentEmailResponse = (string); + +export type RefreshUserTokenResponse = (string); + +export type GetTutorialProgressResponse = ({ + progress?: number; +}); + +export type UpdateTutorialProgressData = { + /** + * progress update + */ + requestBody: { + progress?: number; + }; +}; + +export type UpdateTutorialProgressResponse = (string); + +export type LeaveInstanceResponse = (string); + +export type GetUsageResponse = (number); + +export type GetRunnableResponse = ({ + workspace: string; + endpoint_async: string; + endpoint_sync: string; + endpoint_openai_sync: string; + summary: string; + description?: string; + kind: string; +}); + +export type GlobalWhoamiResponse = (GlobalUserInfo); + +export type ListWorkspaceInvitesResponse = (Array); + +export type WhoamiData = { + workspace: string; +}; + +export type WhoamiResponse = (User); + +export type AcceptInviteData = { + /** + * accept invite + */ + requestBody: { + workspace_id: string; + username?: string; + }; +}; + +export type AcceptInviteResponse = (string); + +export type DeclineInviteData = { + /** + * decline invite + */ + requestBody: { + workspace_id: string; + }; +}; + +export type DeclineInviteResponse = (string); + +export type InviteUserData = { + /** + * WorkspaceInvite + */ + requestBody: { + email: string; + is_admin: boolean; + operator: boolean; + }; + workspace: string; +}; + +export type InviteUserResponse = (string); + +export type AddUserData = { + /** + * WorkspaceInvite + */ + requestBody: { + email: string; + is_admin: boolean; + username?: string; + operator: boolean; + }; + workspace: string; +}; + +export type AddUserResponse = (string); + +export type DeleteInviteData = { + /** + * WorkspaceInvite + */ + requestBody: { + email: string; + is_admin: boolean; + operator: boolean; + }; + workspace: string; +}; + +export type DeleteInviteResponse = (string); + +export type ArchiveWorkspaceData = { + workspace: string; +}; + +export type ArchiveWorkspaceResponse = (string); + +export type UnarchiveWorkspaceData = { + workspace: string; +}; + +export type UnarchiveWorkspaceResponse = (string); + +export type DeleteWorkspaceData = { + workspace: string; +}; + +export type DeleteWorkspaceResponse = (string); + +export type LeaveWorkspaceData = { + workspace: string; +}; + +export type LeaveWorkspaceResponse = (string); + +export type GetWorkspaceNameData = { + workspace: string; +}; + +export type GetWorkspaceNameResponse = (string); + +export type ChangeWorkspaceNameData = { + requestBody?: { + new_name?: string; + }; + workspace: string; +}; + +export type ChangeWorkspaceNameResponse = (string); + +export type ChangeWorkspaceIdData = { + requestBody?: { + new_id?: string; + new_name?: string; + }; + workspace: string; +}; + +export type ChangeWorkspaceIdResponse = (string); + +export type WhoisData = { + username: string; + workspace: string; +}; + +export type WhoisResponse = (User); + +export type ExistsEmailData = { + email: string; +}; + +export type ExistsEmailResponse = (boolean); + +export type ListUsersAsSuperAdminData = { + /** + * which page to return (start at 1, default 1) + */ + page?: number; + /** + * number of items to return for a given page (default 30, max 100) + */ + perPage?: number; +}; + +export type ListUsersAsSuperAdminResponse = (Array); + +export type ListPendingInvitesData = { + workspace: string; +}; + +export type ListPendingInvitesResponse = (Array); + +export type GetSettingsData = { + workspace: string; +}; + +export type GetSettingsResponse = ({ + workspace_id?: string; + slack_name?: string; + slack_team_id?: string; + slack_command_script?: string; + auto_invite_domain?: string; + auto_invite_operator?: boolean; + auto_add?: boolean; + plan?: string; + automatic_billing: boolean; + customer_id?: string; + webhook?: string; + deploy_to?: string; + openai_resource_path?: string; + code_completion_enabled: boolean; + error_handler?: string; + error_handler_extra_args?: ScriptArgs; + error_handler_muted_on_cancel: boolean; + large_file_storage?: LargeFileStorage; + git_sync?: WorkspaceGitSyncSettings; + deploy_ui?: WorkspaceDeployUISettings; + default_app?: string; + default_scripts?: WorkspaceDefaultScripts; +}); + +export type GetDeployToData = { + workspace: string; +}; + +export type GetDeployToResponse = ({ + deploy_to?: string; +}); + +export type GetIsPremiumData = { + workspace: string; +}; + +export type GetIsPremiumResponse = (boolean); + +export type GetPremiumInfoData = { + workspace: string; +}; + +export type GetPremiumInfoResponse = ({ + premium: boolean; + usage?: number; + seats?: number; + automatic_billing: boolean; +}); + +export type SetAutomaticBillingData = { + /** + * automatic billing + */ + requestBody: { + automatic_billing: boolean; + seats?: number; + }; + workspace: string; +}; + +export type SetAutomaticBillingResponse = (string); + +export type EditSlackCommandData = { + /** + * WorkspaceInvite + */ + requestBody: { + slack_command_script?: string; + }; + workspace: string; +}; + +export type EditSlackCommandResponse = (string); + +export type RunSlackMessageTestJobData = { + /** + * path to hub script to run and its corresponding args + */ + requestBody: { + hub_script_path?: string; + channel?: string; + test_msg?: string; + }; + workspace: string; +}; + +export type RunSlackMessageTestJobResponse = ({ + job_uuid?: string; +}); + +export type EditDeployToData = { + requestBody: { + deploy_to?: string; + }; + workspace: string; +}; + +export type EditDeployToResponse = (string); + +export type EditAutoInviteData = { + /** + * WorkspaceInvite + */ + requestBody: { + operator?: boolean; + invite_all?: boolean; + auto_add?: boolean; + }; + workspace: string; +}; + +export type EditAutoInviteResponse = (string); + +export type EditWebhookData = { + /** + * WorkspaceWebhook + */ + requestBody: { + webhook?: string; + }; + workspace: string; +}; + +export type EditWebhookResponse = (string); + +export type EditCopilotConfigData = { + /** + * WorkspaceCopilotConfig + */ + requestBody: { + openai_resource_path?: string; + code_completion_enabled: boolean; + }; + workspace: string; +}; + +export type EditCopilotConfigResponse = (string); + +export type GetCopilotInfoData = { + workspace: string; +}; + +export type GetCopilotInfoResponse = ({ + exists_openai_resource_path: boolean; + code_completion_enabled: boolean; +}); + +export type EditErrorHandlerData = { + /** + * WorkspaceErrorHandler + */ + requestBody: { + error_handler?: string; + error_handler_extra_args?: ScriptArgs; + error_handler_muted_on_cancel?: boolean; + }; + workspace: string; +}; + +export type EditErrorHandlerResponse = (string); + +export type EditLargeFileStorageConfigData = { + /** + * LargeFileStorage info + */ + requestBody: { + large_file_storage?: LargeFileStorage; + }; + workspace: string; +}; + +export type EditLargeFileStorageConfigResponse = (unknown); + +export type EditWorkspaceGitSyncConfigData = { + /** + * Workspace Git sync settings + */ + requestBody: { + git_sync_settings?: WorkspaceGitSyncSettings; + }; + workspace: string; +}; + +export type EditWorkspaceGitSyncConfigResponse = (unknown); + +export type EditWorkspaceDeployUiSettingsData = { + /** + * Workspace deploy UI settings + */ + requestBody: { + deploy_ui_settings?: WorkspaceDeployUISettings; + }; + workspace: string; +}; + +export type EditWorkspaceDeployUiSettingsResponse = (unknown); + +export type EditWorkspaceDefaultAppData = { + /** + * Workspace default app + */ + requestBody: { + default_app_path?: string; + }; + workspace: string; +}; + +export type EditWorkspaceDefaultAppResponse = (string); + +export type EditDefaultScriptsData = { + /** + * Workspace default app + */ + requestBody?: WorkspaceDefaultScripts; + workspace: string; +}; + +export type EditDefaultScriptsResponse = (string); + +export type GetDefaultScriptsData = { + workspace: string; +}; + +export type GetDefaultScriptsResponse = (WorkspaceDefaultScripts); + +export type SetEnvironmentVariableData = { + /** + * Workspace default app + */ + requestBody: { + name: string; + value?: string; + }; + workspace: string; +}; + +export type SetEnvironmentVariableResponse = (string); + +export type GetWorkspaceEncryptionKeyData = { + workspace: string; +}; + +export type GetWorkspaceEncryptionKeyResponse = ({ + key: string; +}); + +export type SetWorkspaceEncryptionKeyData = { + /** + * New encryption key + */ + requestBody: { + new_key: string; + skip_reencrypt?: boolean; + }; + workspace: string; +}; + +export type SetWorkspaceEncryptionKeyResponse = (string); + +export type GetWorkspaceDefaultAppData = { + workspace: string; +}; + +export type GetWorkspaceDefaultAppResponse = ({ + default_app_path?: string; +}); + +export type GetLargeFileStorageConfigData = { + workspace: string; +}; + +export type GetLargeFileStorageConfigResponse = (LargeFileStorage); + +export type GetWorkspaceUsageData = { + workspace: string; +}; + +export type GetWorkspaceUsageResponse = (number); + +export type ListUsersData = { + workspace: string; +}; + +export type ListUsersResponse = (Array); + +export type ListUsersUsageData = { + workspace: string; +}; + +export type ListUsersUsageResponse = (Array); + +export type ListUsernamesData = { + workspace: string; +}; + +export type ListUsernamesResponse = (Array<(string)>); + +export type UsernameToEmailData = { + username: string; + workspace: string; +}; + +export type UsernameToEmailResponse = (string); + +export type CreateTokenData = { + /** + * new token + */ + requestBody: NewToken; +}; + +export type CreateTokenResponse = (string); + +export type CreateTokenImpersonateData = { + /** + * new token + */ + requestBody: NewTokenImpersonate; +}; + +export type CreateTokenImpersonateResponse = (string); + +export type DeleteTokenData = { + tokenPrefix: string; +}; + +export type DeleteTokenResponse = (string); + +export type ListTokensData = { + excludeEphemeral?: boolean; + /** + * which page to return (start at 1, default 1) + */ + page?: number; + /** + * number of items to return for a given page (default 30, max 100) + */ + perPage?: number; +}; + +export type ListTokensResponse = (Array); + +export type GetOidcTokenData = { + audience: string; + workspace: string; +}; + +export type GetOidcTokenResponse = (string); + +export type CreateVariableData = { + alreadyEncrypted?: boolean; + /** + * new variable + */ + requestBody: CreateVariable; + workspace: string; +}; + +export type CreateVariableResponse = (string); + +export type EncryptValueData = { + /** + * new variable + */ + requestBody: string; + workspace: string; +}; + +export type EncryptValueResponse = (string); + +export type DeleteVariableData = { + path: string; + workspace: string; +}; + +export type DeleteVariableResponse = (string); + +export type UpdateVariableData = { + alreadyEncrypted?: boolean; + path: string; + /** + * updated variable + */ + requestBody: EditVariable; + workspace: string; +}; + +export type UpdateVariableResponse = (string); + +export type GetVariableData = { + /** + * ask to decrypt secret if this variable is secret + * (if not secret no effect, default: true) + * + */ + decryptSecret?: boolean; + /** + * ask to include the encrypted value if secret and decrypt secret is not true (default: false) + * + */ + includeEncrypted?: boolean; + path: string; + workspace: string; +}; + +export type GetVariableResponse = (ListableVariable); + +export type GetVariableValueData = { + path: string; + workspace: string; +}; + +export type GetVariableValueResponse = (string); + +export type ExistsVariableData = { + path: string; + workspace: string; +}; + +export type ExistsVariableResponse = (boolean); + +export type ListVariableData = { + /** + * which page to return (start at 1, default 1) + */ + page?: number; + pathStart?: string; + /** + * number of items to return for a given page (default 30, max 100) + */ + perPage?: number; + workspace: string; +}; + +export type ListVariableResponse = (Array); + +export type ListContextualVariablesData = { + workspace: string; +}; + +export type ListContextualVariablesResponse = (Array); + +export type LoginWithOauthData = { + clientName: string; + /** + * Partially filled script + */ + requestBody: { + code?: string; + state?: string; + }; +}; + +export type LoginWithOauthResponse = (string); + +export type ConnectSlackCallbackData = { + /** + * code endpoint + */ + requestBody: { + code: string; + state: string; + }; + workspace: string; +}; + +export type ConnectSlackCallbackResponse = (string); + +export type ConnectSlackCallbackInstanceData = { + /** + * code endpoint + */ + requestBody: { + code: string; + state: string; + }; +}; + +export type ConnectSlackCallbackInstanceResponse = (string); + +export type ConnectCallbackData = { + clientName: string; + /** + * code endpoint + */ + requestBody: { + code: string; + state: string; + }; +}; + +export type ConnectCallbackResponse = (TokenResponse); + +export type CreateAccountData = { + /** + * code endpoint + */ + requestBody: { + refresh_token?: string; + expires_in: number; + client: string; + }; + workspace: string; +}; + +export type CreateAccountResponse = (string); + +export type RefreshTokenData = { + id: number; + /** + * variable path + */ + requestBody: { + path: string; + }; + workspace: string; +}; + +export type RefreshTokenResponse = (string); + +export type DisconnectAccountData = { + id: number; + workspace: string; +}; + +export type DisconnectAccountResponse = (string); + +export type DisconnectSlackData = { + workspace: string; +}; + +export type DisconnectSlackResponse = (string); + +export type ListOauthLoginsResponse = ({ + oauth: Array<(string)>; + saml?: string; +}); + +export type ListOauthConnectsResponse = (Array<(string)>); + +export type GetOauthConnectData = { + /** + * client name + */ + client: string; +}; + +export type GetOauthConnectResponse = ({ + extra_params?: { + [key: string]: unknown; + }; + scopes?: Array<(string)>; +}); + +export type CreateResourceData = { + /** + * new resource + */ + requestBody: CreateResource; + updateIfExists?: boolean; + workspace: string; +}; + +export type CreateResourceResponse = (string); + +export type DeleteResourceData = { + path: string; + workspace: string; +}; + +export type DeleteResourceResponse = (string); + +export type UpdateResourceData = { + path: string; + /** + * updated resource + */ + requestBody: EditResource; + workspace: string; +}; + +export type UpdateResourceResponse = (string); + +export type UpdateResourceValueData = { + path: string; + /** + * updated resource + */ + requestBody: { + value?: unknown; + }; + workspace: string; +}; + +export type UpdateResourceValueResponse = (string); + +export type GetResourceData = { + path: string; + workspace: string; +}; + +export type GetResourceResponse = (Resource); + +export type GetResourceValueInterpolatedData = { + /** + * job id + */ + jobId?: string; + path: string; + workspace: string; +}; + +export type GetResourceValueInterpolatedResponse = (unknown); + +export type GetResourceValueData = { + path: string; + workspace: string; +}; + +export type GetResourceValueResponse = (unknown); + +export type ExistsResourceData = { + path: string; + workspace: string; +}; + +export type ExistsResourceResponse = (boolean); + +export type ListResourceData = { + /** + * which page to return (start at 1, default 1) + */ + page?: number; + pathStart?: string; + /** + * number of items to return for a given page (default 30, max 100) + */ + perPage?: number; + /** + * resource_types to list from, separated by ',', + */ + resourceType?: string; + /** + * resource_types to not list from, separated by ',', + */ + resourceTypeExclude?: string; + workspace: string; +}; + +export type ListResourceResponse = (Array); + +export type ListSearchResourceData = { + workspace: string; +}; + +export type ListSearchResourceResponse = (Array<{ + path: string; + value: unknown; +}>); + +export type ListResourceNamesData = { + name: string; + workspace: string; +}; + +export type ListResourceNamesResponse = (Array<{ + name: string; + path: string; +}>); + +export type CreateResourceTypeData = { + /** + * new resource_type + */ + requestBody: ResourceType; + workspace: string; +}; + +export type CreateResourceTypeResponse = (string); + +export type FileResourceTypeToFileExtMapData = { + workspace: string; +}; + +export type FileResourceTypeToFileExtMapResponse = (unknown); + +export type DeleteResourceTypeData = { + path: string; + workspace: string; +}; + +export type DeleteResourceTypeResponse = (string); + +export type UpdateResourceTypeData = { + path: string; + /** + * updated resource_type + */ + requestBody: EditResourceType; + workspace: string; +}; + +export type UpdateResourceTypeResponse = (string); + +export type GetResourceTypeData = { + path: string; + workspace: string; +}; + +export type GetResourceTypeResponse = (ResourceType); + +export type ExistsResourceTypeData = { + path: string; + workspace: string; +}; + +export type ExistsResourceTypeResponse = (boolean); + +export type ListResourceTypeData = { + workspace: string; +}; + +export type ListResourceTypeResponse = (Array); + +export type ListResourceTypeNamesData = { + workspace: string; +}; + +export type ListResourceTypeNamesResponse = (Array<(string)>); + +export type QueryResourceTypesData = { + /** + * query limit + */ + limit?: number; + /** + * query text + */ + text: string; + workspace: string; +}; + +export type QueryResourceTypesResponse = (Array<{ + name: string; + score: number; + schema?: unknown; +}>); + +export type ListHubIntegrationsData = { + /** + * query integrations kind + */ + kind?: string; +}; + +export type ListHubIntegrationsResponse = (Array<{ + name: string; +}>); + +export type ListHubFlowsResponse = ({ + flows?: Array<{ + id: number; + flow_id: number; + summary: string; + apps: Array<(string)>; + approved: boolean; + votes: number; + }>; +}); + +export type GetHubFlowByIdData = { + id: number; +}; + +export type GetHubFlowByIdResponse = ({ + flow?: OpenFlow; +}); + +export type ListHubAppsResponse = ({ + apps?: Array<{ + id: number; + app_id: number; + summary: string; + apps: Array<(string)>; + approved: boolean; + votes: number; + }>; +}); + +export type GetHubAppByIdData = { + id: number; +}; + +export type GetHubAppByIdResponse = ({ + app: { + summary: string; + value: unknown; + }; +}); + +export type GetHubScriptContentByPathData = { + path: string; +}; + +export type GetHubScriptContentByPathResponse = (string); + +export type GetHubScriptByPathData = { + path: string; +}; + +export type GetHubScriptByPathResponse = ({ + content: string; + lockfile?: string; + schema?: unknown; + language: string; + summary?: string; +}); + +export type GetTopHubScriptsData = { + /** + * query scripts app + */ + app?: string; + /** + * query scripts kind + */ + kind?: string; + /** + * query limit + */ + limit?: number; +}; + +export type GetTopHubScriptsResponse = ({ + asks?: Array<{ + id: number; + ask_id: number; + summary: string; + app: string; + version_id: number; + kind: HubScriptKind; + votes: number; + views: number; + }>; +}); + +export type QueryHubScriptsData = { + /** + * query scripts app + */ + app?: string; + /** + * query scripts kind + */ + kind?: string; + /** + * query limit + */ + limit?: number; + /** + * query text + */ + text: string; +}; + +export type QueryHubScriptsResponse = (Array<{ + ask_id: number; + id: number; + version_id: number; + summary: string; + app: string; + kind: HubScriptKind; + score: number; +}>); + +export type ListSearchScriptData = { + workspace: string; +}; + +export type ListSearchScriptResponse = (Array<{ + path: string; + content: string; +}>); + +export type ListScriptsData = { + /** + * mask to filter exact matching user creator + */ + createdBy?: string; + /** + * mask to filter scripts whom first direct parent has exact hash + */ + firstParentHash?: string; + /** + * (default false) + * include scripts that have no deployed version + * + */ + includeDraftOnly?: boolean; + /** + * (default false) + * include scripts without an exported main function + * + */ + includeWithoutMain?: boolean; + /** + * (default regardless) + * if true show only the templates + * if false show only the non templates + * if not defined, show all regardless of if the script is a template + * + */ + isTemplate?: boolean; + /** + * (default regardless) + * script kinds to filter, split by comma + * + */ + kinds?: string; + /** + * mask to filter scripts whom last parent in the chain has exact hash. + * Beware that each script stores only a limited number of parents. Hence + * the last parent hash for a script is not necessarily its top-most parent. + * To find the top-most parent you will have to jump from last to last hash + * until finding the parent + * + */ + lastParentHash?: string; + /** + * order by desc order (default true) + */ + orderDesc?: boolean; + /** + * which page to return (start at 1, default 1) + */ + page?: number; + /** + * is the hash present in the array of stored parent hashes for this script. + * The same warning applies than for last_parent_hash. A script only store a + * limited number of direct parent + * + */ + parentHash?: string; + /** + * mask to filter exact matching path + */ + pathExact?: string; + /** + * mask to filter matching starting path + */ + pathStart?: string; + /** + * number of items to return for a given page (default 30, max 100) + */ + perPage?: number; + /** + * (default false) + * show only the archived files. + * when multiple archived hash share the same path, only the ones with the latest create_at + * are + * ed. + * + */ + showArchived?: boolean; + /** + * (default false) + * show only the starred items + * + */ + starredOnly?: boolean; + /** + * (default false) + * include deployment message + * + */ + withDeploymentMsg?: boolean; + workspace: string; +}; + +export type ListScriptsResponse = (Array diff --git a/frontend/src/lib/components/FlowGraphViewer.svelte b/frontend/src/lib/components/FlowGraphViewer.svelte index b3bc035fa4..fef1e0e1ca 100644 --- a/frontend/src/lib/components/FlowGraphViewer.svelte +++ b/frontend/src/lib/components/FlowGraphViewer.svelte @@ -40,8 +40,14 @@ failureModule={flow?.value?.failure_module} preprocessorModule={flow?.value?.preprocessor_module} on:select={(e) => { - const mod = dfs(flow?.value?.modules ?? [], (m) => m).find((m) => m?.id === e?.detail) - stepDetail = mod ?? e.detail + if (e?.detail === 'failure') { + stepDetail = flow?.value?.failure_module + } else if (e?.detail === 'preprocessor') { + stepDetail = flow?.value?.preprocessor_module + } else { + stepDetail = dfs(flow?.value?.modules ?? [], (m) => m).find((m) => m?.id === e?.detail) + } + stepDetail = stepDetail ?? e?.detail dispatch('select', stepDetail) }} on:triggerDetail diff --git a/frontend/src/lib/components/FlowGraphViewerStep.svelte b/frontend/src/lib/components/FlowGraphViewerStep.svelte index 789c0eed93..b2b7b9d381 100644 --- a/frontend/src/lib/components/FlowGraphViewerStep.svelte +++ b/frontend/src/lib/components/FlowGraphViewerStep.svelte @@ -103,12 +103,17 @@ {:else if typeof stepDetail != 'string' && stepDetail.value}
- {#if stepDetail.id} + {#if stepDetail.id && stepDetail.id != 'failure' && stepDetail.id != 'preprocessor'} {stepDetail.id} {/if} - + {#if stepDetail.summary} {stepDetail.summary} {:else if stepDetail.value.type == 'identity'} @@ -124,6 +129,10 @@ Inner flow {:else if stepDetail.value.type == 'whileloopflow'} While loop + {:else if stepDetail.id === 'failure'} + Error handler + {:else if stepDetail.id === 'preprocessor'} + Preprocessor {:else} Anonymous step {/if} @@ -147,10 +156,12 @@ An identity step returns its inputs as outputs

{:else if stepDetail.value.type == 'rawscript'} -
-

Step Inputs

- -
+ {#if stepDetail.id !== 'preprocessor'} +
+

Step Inputs

+ +
+ {/if}
@@ -180,10 +191,12 @@
{:else if stepDetail.value.type == 'script'} -
-

Step Inputs

- -
+ {#if stepDetail.id !== 'preprocessor'} +
+

Step Inputs

+ +
+ {/if} {#if stepDetail.value.path.startsWith('hub/')}
diff --git a/frontend/src/lib/components/FlowJobResult.svelte b/frontend/src/lib/components/FlowJobResult.svelte index a18ced04c0..0f0e4eebc0 100644 --- a/frontend/src/lib/components/FlowJobResult.svelte +++ b/frontend/src/lib/components/FlowJobResult.svelte @@ -40,7 +40,6 @@ let logOffset = 0 async function getLogs() { if (jobId) { - console.log('getLogs') const getUpdate = await JobService.getJobUpdates({ workspace: workspaceId ?? $workspaceStore!, diff --git a/frontend/src/lib/components/TestJobLoader.svelte b/frontend/src/lib/components/TestJobLoader.svelte index 688d10d7a4..92510174f1 100644 --- a/frontend/src/lib/components/TestJobLoader.svelte +++ b/frontend/src/lib/components/TestJobLoader.svelte @@ -15,16 +15,16 @@ export let lazyLogs = false // Will be set to number if job is not a flow // If you want to find out progress of subjobs of a flow, check job.flow_status.progress - export let scriptProgress: number | undefined = undefined; + export let scriptProgress: number | undefined = undefined /// Last time asked for job progress - let lastTimeCheckedProgress: number | undefined = undefined; + let lastTimeCheckedProgress: number | undefined = undefined - /// Will try to poll progress every 5s and if once progress returned was not undefined, will be ignored + /// Will try to poll progress every 5s and if once progress returned was not undefined, will be ignored /// and getProgressRate will be used instead - const getProgressRetryRate: number = 5000; + const getProgressRetryRate: number = 5000 /// How often loader poll progress - const getProgressRate: number = 1000; + const getProgressRate: number = 1000 const dispatch = createEventDispatcher() @@ -105,13 +105,11 @@ export async function getLogs() { if (job) { - console.log('getLogs') - const getUpdate = await JobService.getJobUpdates({ workspace: workspace!, id: job.id, running: `running` in job && job.running, - logOffset: job.logs?.length ?? 0, + logOffset: job.logs?.length ?? 0 }) if ((job.logs ?? '').length == 0) { @@ -129,11 +127,10 @@ tag: string | undefined, lock?: string ): Promise { - // Reset in case we rerun job without reloading - scriptProgress = undefined; - lastTimeCheckedProgress = undefined; - + scriptProgress = undefined + lastTimeCheckedProgress = undefined + return abstractRun(() => JobService.runScriptPreview({ workspace: $workspaceStore!, @@ -192,29 +189,30 @@ if (currentId === id) { try { if (job && `running` in job) { - - let getProgress: boolean | undefined = undefined; + let getProgress: boolean | undefined = undefined // We only pull individual job progress this way // Flow's progress we are getting from FlowStatusModule of flow job - if (job.job_kind == "script" || job.job_kind == "preview"){ + if (job.job_kind == 'script' || job.job_kind == 'preview') { // First time, before running job, lastTimeCheckedProgress is always undefined - if (lastTimeCheckedProgress){ - const lastTimeCheckedMs = Date.now() - lastTimeCheckedProgress; + if (lastTimeCheckedProgress) { + const lastTimeCheckedMs = Date.now() - lastTimeCheckedProgress // Ask for progress if the last time we asked is >5s OR the progress was once not undefined - if (lastTimeCheckedMs > getProgressRetryRate || (scriptProgress != undefined && lastTimeCheckedMs > getProgressRate)){ - lastTimeCheckedProgress = Date.now(); - getProgress = true; + if ( + lastTimeCheckedMs > getProgressRetryRate || + (scriptProgress != undefined && lastTimeCheckedMs > getProgressRate) + ) { + lastTimeCheckedProgress = Date.now() + getProgress = true } } else { // Make it think we asked for progress, but in reality we didnt. First 5s we want to wait without putting extra work on db // 99.99% of the jobs won't have progress be set so we have to do a balance between having low-latency for jobs that use it and job that don't // we would usually not care to have progress the first 5s and jobs that are less than 5s - lastTimeCheckedProgress = Date.now(); - } + lastTimeCheckedProgress = Date.now() + } } const offset = logOffset == 0 ? (job.logs?.length ? job.logs?.length + 1 : 0) : logOffset - console.log('getLogs') let previewJobUpdates = await JobService.getJobUpdates({ workspace: workspace!, @@ -225,14 +223,13 @@ }) // Clamp number between two values with the following line: - const clamp = (num, min, max) => Math.min(Math.max(num, min), max); + const clamp = (num, min, max) => Math.min(Math.max(num, min), max) - if (previewJobUpdates.progress){ + if (previewJobUpdates.progress) { // Progress cannot go back and cannot be set to 100 - scriptProgress = clamp(previewJobUpdates.progress, scriptProgress ?? 0, 99); + scriptProgress = clamp(previewJobUpdates.progress, scriptProgress ?? 0, 99) } - if (previewJobUpdates.new_logs) { if (offset == 0) { job.logs = previewJobUpdates.new_logs ?? '' diff --git a/frontend/src/lib/components/copilot/CronGen.svelte b/frontend/src/lib/components/copilot/CronGen.svelte index ae23510d30..6a1b5f9c06 100644 --- a/frontend/src/lib/components/copilot/CronGen.svelte +++ b/frontend/src/lib/components/copilot/CronGen.svelte @@ -15,7 +15,7 @@ let abortController = new AbortController() $: instructionsField && setTimeout(() => instructionsField?.focus(), 100) const SYSTEM = - "You are a helpful assitant for creating CRON schedules. The structure is 'second minute hour dayOfMonth month dayOfWeek'. Weekdays are Sunday (1), Monday (2), Tuesday (3), Wednesday (4), Thursday (5), Friday (6), Saturday (7). You only return the CRON string. If it is invalid, you will return an error message preceeded by 'ERROR:'." + "You are a helpful assitant for creating CRON schedules. The structure is 'second minute hour dayOfMonth month dayOfWeek'. Weekdays are Sunday (1), Monday (2), Tuesday (3), Wednesday (4), Thursday (5), Friday (6), Saturday (7). You only return the CRON string without any wrapping characters. If it is invalid, you will return an error message preceeded by 'ERROR:'." const USER = 'CRON schedule instructions: {instructions}' async function generateCron() { genLoading = true diff --git a/frontend/src/lib/components/copilot/RegexGen.svelte b/frontend/src/lib/components/copilot/RegexGen.svelte index cc7a4c301b..0817167bf5 100644 --- a/frontend/src/lib/components/copilot/RegexGen.svelte +++ b/frontend/src/lib/components/copilot/RegexGen.svelte @@ -31,7 +31,7 @@ { role: 'system', content: - 'Generate a regex pattern that one can use in a javascript Regex object. Output only the regex itself. The regex should match the following:' + 'Generate a regex pattern that one can use in a javascript Regex object. Output only the regex itself without any wrapping characters including the / characters. The regex should match the following:' }, { role: 'user', diff --git a/frontend/src/lib/components/flows/FlowProgressBar.svelte b/frontend/src/lib/components/flows/FlowProgressBar.svelte index 6970b1aca0..39ccbbf424 100644 --- a/frontend/src/lib/components/flows/FlowProgressBar.svelte +++ b/frontend/src/lib/components/flows/FlowProgressBar.svelte @@ -3,6 +3,7 @@ import ProgressBar from '../progressBar/ProgressBar.svelte' export let job: Job | undefined = undefined + export let currentSubJobProgress: number | undefined = undefined let error: number | undefined = undefined let index = 0 @@ -59,6 +60,9 @@ // Jitter protection >^^^^^^^^ subStepLength = 100 subIndexIsPercent = true; + currentSubJobProgress = subStepIndex + } else { + currentSubJobProgress = undefined } error = newError diff --git a/frontend/src/lib/components/graph/graphBuilder.ts b/frontend/src/lib/components/graph/graphBuilder.ts index b7a52544df..3bf37f4264 100644 --- a/frontend/src/lib/components/graph/graphBuilder.ts +++ b/frontend/src/lib/components/graph/graphBuilder.ts @@ -476,6 +476,10 @@ export default function graphBuilder( addEdge(id, 'Input', { type: 'empty' }) } + if (failureModule && !extra.flowModuleStates) { + addNode(failureModule, 0, 'module') + } + Object.keys(parents).forEach((key) => { const node = nodes.find((n) => n.id === key) diff --git a/frontend/src/lib/components/sidebar/SidebarContent.svelte b/frontend/src/lib/components/sidebar/SidebarContent.svelte index c50b9a8700..3b59a5d636 100644 --- a/frontend/src/lib/components/sidebar/SidebarContent.svelte +++ b/frontend/src/lib/components/sidebar/SidebarContent.svelte @@ -239,7 +239,7 @@
diff --git a/frontend/src/routes/(root)/(logged)/routes/+page.svelte b/frontend/src/routes/(root)/(logged)/routes/+page.svelte index a6783e43d3..a865544cb5 100644 --- a/frontend/src/routes/(root)/(logged)/routes/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/routes/+page.svelte @@ -160,7 +160,7 @@ {#if $userStore?.is_admin || $userStore?.is_super_admin}
- {#if job}{/if} + {#if job} + + {#if currentJobIsLongRunning && showExplicitProgressTip && !scriptProgress && 'running' in job} + + + + {/if} + {/if}
@@ -757,6 +789,9 @@
{/if} {#if job?.job_kind !== 'flow' && job?.job_kind !== 'flowpreview' && job?.job_kind !== 'singlescriptflow'} + {#if ['python3', 'bun', 'deno'].includes(job?.language ?? '') && (job?.job_kind == 'script' || job?.job_kind == 'preview')} + + {/if}
{#if job?.flow_status && typeof job.flow_status == 'object' && !('_metadata' in job.flow_status)}
@@ -823,7 +858,11 @@
{:else if !job?.['deleted']}
- +