Compare commits
1 Commits
v1.656.0
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9af8e4e626 |
2
.github/workflows/backend-test-windows.yml
vendored
2
.github/workflows/backend-test-windows.yml
vendored
@@ -66,7 +66,7 @@ jobs:
|
||||
with:
|
||||
bun-version: 1.3.10
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
|
||||
2
.github/workflows/backend-test.yml
vendored
2
.github/workflows/backend-test.yml
vendored
@@ -57,7 +57,7 @@ jobs:
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: 1.3.10
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: "20"
|
||||
- uses: astral-sh/setup-uv@v6.2.1
|
||||
|
||||
6
.github/workflows/cli-tests.yml
vendored
6
.github/workflows/cli-tests.yml
vendored
@@ -24,7 +24,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
@@ -70,7 +70,7 @@ jobs:
|
||||
cache-workspaces: backend
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
@@ -124,7 +124,7 @@ jobs:
|
||||
cache-workspaces: backend
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
|
||||
2
.github/workflows/frontend-check.yml
vendored
2
.github/workflows/frontend-check.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
||||
runs-on: ubicloud-standard-8
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v5
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 24
|
||||
cache: "npm"
|
||||
|
||||
2
.github/workflows/git-sync-test.yml
vendored
2
.github/workflows/git-sync-test.yml
vendored
@@ -129,7 +129,7 @@ jobs:
|
||||
with:
|
||||
deno-version: v2.x
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
|
||||
4
.github/workflows/npm_on_release.yml
vendored
4
.github/workflows/npm_on_release.yml
vendored
@@ -10,7 +10,7 @@ jobs:
|
||||
runs-on: ubicloud-standard-8
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: "20.x"
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
@@ -21,7 +21,7 @@ jobs:
|
||||
runs-on: ubicloud-standard-8
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: "20.x"
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
||||
2
.github/workflows/validate-openapi.yml
vendored
2
.github/workflows/validate-openapi.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
|
||||
24
CHANGELOG.md
24
CHANGELOG.md
@@ -1,29 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## [1.656.0](https://github.com/windmill-labs/windmill/compare/v1.655.0...v1.656.0) (2026-03-13)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add GitHub Enterprise Server (GHES) support for GitHub App git sync ([#8344](https://github.com/windmill-labs/windmill/issues/8344)) ([2e430c4](https://github.com/windmill-labs/windmill/commit/2e430c4c0b8540df7b6997434a7a9f9134858026))
|
||||
* **cli:** add unified generate-metadata command ([#8335](https://github.com/windmill-labs/windmill/issues/8335)) ([4c2c165](https://github.com/windmill-labs/windmill/commit/4c2c165a5b757bd5f2f49074bb290407bce3b2fb))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **ci:** add NODE_AUTH_TOKEN for npm publish authentication ([2a8e276](https://github.com/windmill-labs/windmill/commit/2a8e276b6d2761bb2798b6bc5f8d90ab34fbb403))
|
||||
* **ci:** remove provenance flag and use NPM_TOKEN for npm publish ([44dd3ee](https://github.com/windmill-labs/windmill/commit/44dd3ee8cd05d288828d1d46c84cbcdf40f8fa78))
|
||||
* **cli:** exclude raw app backend files from script metadata generation ([#8362](https://github.com/windmill-labs/windmill/issues/8362)) ([060687b](https://github.com/windmill-labs/windmill/commit/060687b1fa6b627a7b06fbdc4b3f4eb0b63411c0))
|
||||
* **cli:** normalize path separators in generate-metadata folder filter for Windows ([#8358](https://github.com/windmill-labs/windmill/issues/8358)) ([404ae09](https://github.com/windmill-labs/windmill/commit/404ae09d429fb545610ba17d747e1903c542d4a3))
|
||||
* **cli:** suppress verbose lock generation messages in generate-metadata ([#8357](https://github.com/windmill-labs/windmill/issues/8357)) ([51933be](https://github.com/windmill-labs/windmill/commit/51933be3cabd853960d384cd358c7bcaef6bfa86))
|
||||
* **frontend:** collapse flow topbar buttons to icon-only in narrow panes ([#8322](https://github.com/windmill-labs/windmill/issues/8322)) ([b585dee](https://github.com/windmill-labs/windmill/commit/b585dee64dfd63d20812ca969b17ff9ee9989493))
|
||||
* **frontend:** filter webhook/email tokens by scope instead of label ([#8363](https://github.com/windmill-labs/windmill/issues/8363)) ([0d31c35](https://github.com/windmill-labs/windmill/commit/0d31c35f3e12d637c757a95fe350294002cbf640))
|
||||
* **frontend:** improve native mode alert message and fix workspaced tag detection ([#8361](https://github.com/windmill-labs/windmill/issues/8361)) ([fb12b31](https://github.com/windmill-labs/windmill/commit/fb12b31df081b2f1ac63becea6e6538ca80f8c46))
|
||||
* **frontend:** prevent duplicate and reserved agent tool names ([#8367](https://github.com/windmill-labs/windmill/issues/8367)) ([c431053](https://github.com/windmill-labs/windmill/commit/c431053a1e24ef29cd551a86de4d013fd7f158be))
|
||||
* graceful shutdown instead of panic on job completion channel failure ([#8345](https://github.com/windmill-labs/windmill/issues/8345)) ([724d135](https://github.com/windmill-labs/windmill/commit/724d1350d070fcf078034a52166d3048fb74e6f3))
|
||||
* Linked resources and vars not triggering both sync jobs on delete ([#8342](https://github.com/windmill-labs/windmill/issues/8342)) ([8e3b8bd](https://github.com/windmill-labs/windmill/commit/8e3b8bdfd2ded9652bc7e876c6bcd0ac2cfae148))
|
||||
* lower default indexer memory/batch settings to prevent OOM ([#8347](https://github.com/windmill-labs/windmill/issues/8347)) ([d9d45cf](https://github.com/windmill-labs/windmill/commit/d9d45cf2f9235b0e7118d0fc97ccdc0776ca9726))
|
||||
|
||||
## [1.655.0](https://github.com/windmill-labs/windmill/compare/v1.654.0...v1.655.0) (2026-03-12)
|
||||
|
||||
|
||||
|
||||
22
CLAUDE.md
22
CLAUDE.md
@@ -4,7 +4,7 @@ Open-source platform for internal tools, workflows, API integrations, background
|
||||
|
||||
## Workflow
|
||||
|
||||
1. **Understand**: Before coding, explore the codebase (see Code Navigation below). Use `outline` to understand file structure, `body` to read specific symbols, `def`/`callers`/`callees` to trace code, `Grep` to find usages. Read `docs/` for domain context.
|
||||
1. **Understand**: Before coding, use `wm-ts-nav` to explore (see Code Navigation below). Use `outline` to understand file structure, `body` to read specific symbols, `def`/`callers`/`callees` to trace code. Read `docs/` for domain context.
|
||||
2. **Plan**: For non-trivial changes, use plan mode. For large features, break into reviewable stages
|
||||
3. **Execute**: Follow coding patterns from skills (`rust-backend`, `svelte-frontend`)
|
||||
4. **Validate**: After every change, run the appropriate checks per `docs/validation.md`
|
||||
@@ -52,9 +52,11 @@ let { my_prop = $bindable(default_value) }: { my_prop?: string } = $props()
|
||||
|
||||
## Code Navigation
|
||||
|
||||
`wm-ts-nav` is an AST-aware code navigator. Use **wm-ts-nav** for structural queries — it skips comments/strings and understands symbol boundaries.
|
||||
`wm-ts-nav` is an AST-aware code navigator. Use **Grep** for regex/pattern search. Use **wm-ts-nav** for structural queries — it skips comments/strings and understands symbol boundaries.
|
||||
|
||||
**MUST use `outline` before `Read`** on unfamiliar files — a 500-line file costs ~500 lines of context, while `outline` costs ~20. Then **MUST use `body "X"`** instead of reading a full file to see one function/struct. Use `Read` with offset/limit only when you need surrounding context that `body` doesn't capture.
|
||||
**Prefer wm-ts-nav over Read** to save context window:
|
||||
- `outline <file>` instead of reading a full file — understand structure first, then `body` or Read for specifics
|
||||
- `body "X"` instead of reading a full file to see one function/struct
|
||||
- `refs "X" --caller` instead of reading files to find which function contains each reference
|
||||
- `callers "X"` / `callees "X"` for call-graph questions
|
||||
|
||||
@@ -71,14 +73,20 @@ $NAV --root backend callers "X" # who calls X?
|
||||
$NAV --root backend callees "X" # what does X call?
|
||||
```
|
||||
|
||||
**Limitations** — syntax-level analysis, no type inference. Use **Grep** instead when completeness matters (finding all usages, exhaustiveness checks):
|
||||
- `refs`/`callers`/`callees` can't follow re-exports, glob imports, or different import paths to the same symbol
|
||||
- Trait impls, macro-generated symbols (`sqlx::FromRow`), and namespace member access (`ns.X`) are invisible
|
||||
**Limitations** — syntax-level analysis, no type inference:
|
||||
- Import paths are stored literally — `crate::X` and `super::X` pointing to the same type won't be linked
|
||||
- Re-export chains (`pub use`) aren't followed — refs through different re-export paths won't connect
|
||||
- Trait methods can't be resolved to their trait definition
|
||||
- Nested `use` trees (`use foo::{bar::{A, B}, baz::C}`) aren't parsed correctly
|
||||
- Glob imports (`use foo::*`) — refs won't show import origin
|
||||
- Macro-generated symbols (e.g. `sqlx::FromRow`) — invisible to tree-sitter
|
||||
- Single-char identifiers — intentionally filtered out of refs
|
||||
- `callees` shows all identifiers in a function body, not just actual calls
|
||||
- `import * as ns` namespace imports — member accesses through `ns.X` aren't resolved
|
||||
|
||||
## Core Principles
|
||||
|
||||
- **MUST `outline` before `Read`** on unfamiliar files — then `body` or `Read` with offset/limit for specifics
|
||||
- **Use `outline`/`body` to explore, then `Read` with offset/limit from the results before editing** — avoid reading full files
|
||||
- Search for existing code to reuse before writing new code
|
||||
- Follow established patterns in the codebase
|
||||
- Keep changes focused — don't refactor beyond what's asked
|
||||
|
||||
@@ -25,50 +25,6 @@ pub mod pydantic_parser;
|
||||
|
||||
const FUNCTION_CALL: &str = "<function call>";
|
||||
|
||||
/// Get the simple type name from an expression (e.g. `str`, `int`).
|
||||
fn simple_type_name(e: &Expr) -> Option<&str> {
|
||||
match e {
|
||||
Expr::Name(ExprName { id, .. }) => Some(id.as_ref()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// If `e` is `list[T]` or `List[T]`, return the inner expression `T`.
|
||||
fn list_elem_expr(e: &Expr) -> Option<&Expr> {
|
||||
match e {
|
||||
Expr::Subscript(x) => match x.value.as_ref() {
|
||||
Expr::Name(ExprName { id, .. }) if id == "list" || id == "List" => {
|
||||
Some(x.slice.as_ref())
|
||||
}
|
||||
_ => None,
|
||||
},
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Detect `T | list[T]` or `list[T] | T` union patterns.
|
||||
/// Returns the original type string (e.g. "str | list[str]") for use as `otyp`.
|
||||
fn detect_py_union_array_otyp(e: &Expr) -> Option<String> {
|
||||
let Expr::BinOp(x) = e else { return None };
|
||||
// T | list[T]
|
||||
if let (Some(scalar), Some(elem)) = (simple_type_name(&x.left), list_elem_expr(&x.right)) {
|
||||
if let Some(elem_name) = simple_type_name(elem) {
|
||||
if scalar == elem_name {
|
||||
return Some(format!("{} | list[{}]", scalar, elem_name));
|
||||
}
|
||||
}
|
||||
}
|
||||
// list[T] | T
|
||||
if let (Some(elem), Some(scalar)) = (list_elem_expr(&x.left), simple_type_name(&x.right)) {
|
||||
if let Some(elem_name) = simple_type_name(elem) {
|
||||
if scalar == elem_name {
|
||||
return Some(format!("list[{}] | {}", elem_name, scalar));
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Cheap string-based check to see if code might contain Pydantic models or dataclasses.
|
||||
/// Returns true if we should do full AST parsing for type detection, false otherwise.
|
||||
/// This avoids expensive parsing for the common case where scripts don't use these features.
|
||||
@@ -434,19 +390,8 @@ pub fn parse_python_signature(
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// Detect T | list[T] union types and set otyp for
|
||||
// debounce accumulation support. Falls back to docstring
|
||||
// description if no union array pattern is found.
|
||||
let union_otyp = params.args[i]
|
||||
.as_arg()
|
||||
.annotation
|
||||
.as_ref()
|
||||
.and_then(|ann| detect_py_union_array_otyp(ann.as_ref()));
|
||||
|
||||
Arg {
|
||||
otyp: union_otyp.or_else(|| {
|
||||
metadata.descriptions.get(&arg_name).map(|d| d.to_string())
|
||||
}),
|
||||
otyp: metadata.descriptions.get(&arg_name).map(|d| d.to_string()),
|
||||
name: arg_name,
|
||||
typ,
|
||||
has_default: has_default || default.is_some(),
|
||||
@@ -496,9 +441,6 @@ fn parse_expr(
|
||||
Expr::Constant(ExprConstant { value: Constant::None, .. })
|
||||
) {
|
||||
(parse_expr(&x.left, enums, module).0, true)
|
||||
} else if detect_py_union_array_otyp(e.as_ref()).is_some() {
|
||||
// T | list[T] — parsed type is Unknown; otyp is set separately
|
||||
(Typ::Unknown, false)
|
||||
} else {
|
||||
(Typ::Unknown, false)
|
||||
}
|
||||
@@ -1104,33 +1046,6 @@ def main(a: str, b: Optional[str], c: str | None): return
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_python_union_array_type() -> anyhow::Result<()> {
|
||||
let code = r#"
|
||||
def main(items: str | list[str], numbers: list[int] | int, plain: str):
|
||||
pass
|
||||
"#;
|
||||
let result = parse_python_signature(code, None, false)?;
|
||||
assert_eq!(result.args.len(), 3);
|
||||
|
||||
// str | list[str] → otyp set, typ Unknown
|
||||
assert_eq!(result.args[0].name, "items");
|
||||
assert_eq!(result.args[0].otyp, Some("str | list[str]".to_string()));
|
||||
assert_eq!(result.args[0].typ, Typ::Unknown);
|
||||
|
||||
// list[int] | int → otyp set, typ Unknown
|
||||
assert_eq!(result.args[1].name, "numbers");
|
||||
assert_eq!(result.args[1].otyp, Some("list[int] | int".to_string()));
|
||||
assert_eq!(result.args[1].typ, Typ::Unknown);
|
||||
|
||||
// plain str → no otyp
|
||||
assert_eq!(result.args[2].name, "plain");
|
||||
assert_eq!(result.args[2].otyp, None);
|
||||
assert_eq!(result.args[2].typ, Typ::Str(None));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_python_sig_enum() -> anyhow::Result<()> {
|
||||
let code = r#"
|
||||
|
||||
@@ -363,12 +363,8 @@ fn parse_param(
|
||||
let r = match param.pat {
|
||||
Pat::Ident(ident) => {
|
||||
let (name, typ, nullable) = binding_ident_to_arg(symbol_table, type_resolver, &ident);
|
||||
let otyp = ident
|
||||
.type_ann
|
||||
.as_ref()
|
||||
.and_then(|ta| detect_union_array_otyp(&ta.type_ann));
|
||||
Ok(Arg {
|
||||
otyp,
|
||||
otyp: None,
|
||||
name,
|
||||
typ,
|
||||
default: None,
|
||||
@@ -378,21 +374,13 @@ fn parse_param(
|
||||
}
|
||||
// Pat::Object(ObjectPat { ... }) = todo!()
|
||||
Pat::Assign(AssignPat { left, right, .. }) => {
|
||||
let (name, mut typ, _nullable, otyp) = match *left {
|
||||
Pat::Ident(ident) => {
|
||||
let otyp = ident
|
||||
.type_ann
|
||||
.as_ref()
|
||||
.and_then(|ta| detect_union_array_otyp(&ta.type_ann));
|
||||
let (name, typ, nullable) =
|
||||
binding_ident_to_arg(symbol_table, type_resolver, &ident);
|
||||
(name, typ, nullable, otyp)
|
||||
}
|
||||
let (name, mut typ, _nullable) = match *left {
|
||||
Pat::Ident(ident) => binding_ident_to_arg(symbol_table, type_resolver, &ident),
|
||||
Pat::Object(ObjectPat { type_ann, .. }) => {
|
||||
let (typ, nullable) = eval_type_ann(symbol_table, type_resolver, &type_ann);
|
||||
*counter += 1;
|
||||
let name = format!("anon{}", counter);
|
||||
(name, typ, nullable, None)
|
||||
(name, typ, nullable)
|
||||
}
|
||||
_ => {
|
||||
return Err(anyhow::anyhow!(
|
||||
@@ -428,7 +416,7 @@ fn parse_param(
|
||||
if typ == Typ::Unknown && dflt.is_some() {
|
||||
typ = json_to_typ(dflt.as_ref().unwrap(), false);
|
||||
}
|
||||
Ok(Arg { otyp, name, typ, default: dflt, has_default: true, oidx: None })
|
||||
Ok(Arg { otyp: None, name, typ, default: dflt, has_default: true, oidx: None })
|
||||
}
|
||||
Pat::Object(ObjectPat { type_ann, .. }) => {
|
||||
let (typ, nullable) = eval_type_ann(symbol_table, type_resolver, &type_ann);
|
||||
@@ -973,75 +961,6 @@ fn one_of_properties(
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn ts_type_to_string(ts_type: &TsType) -> Option<String> {
|
||||
match ts_type {
|
||||
TsType::TsKeywordType(t) => Some(
|
||||
match t.kind {
|
||||
TsKeywordTypeKind::TsStringKeyword => "string",
|
||||
TsKeywordTypeKind::TsNumberKeyword => "number",
|
||||
TsKeywordTypeKind::TsBooleanKeyword => "boolean",
|
||||
TsKeywordTypeKind::TsObjectKeyword => "object",
|
||||
TsKeywordTypeKind::TsBigIntKeyword => "bigint",
|
||||
TsKeywordTypeKind::TsAnyKeyword => "any",
|
||||
_ => return None,
|
||||
}
|
||||
.to_string(),
|
||||
),
|
||||
TsType::TsTypeRef(TsTypeRef { type_name, .. }) => match type_name {
|
||||
TsEntityName::Ident(Ident { sym, .. }) => Some(sym.to_string()),
|
||||
_ => None,
|
||||
},
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn get_array_elem_type(ts_type: &TsType) -> Option<&TsType> {
|
||||
match ts_type {
|
||||
TsType::TsArrayType(TsArrayType { elem_type, .. }) => Some(elem_type),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Detects union types of the form `T | T[]` or `T[] | T` and returns
|
||||
/// the original type string (e.g. "string | string[]").
|
||||
fn detect_union_array_otyp(ts_type: &TsType) -> Option<String> {
|
||||
let TsType::TsUnionOrIntersectionType(TsUnionOrIntersectionType::TsUnionType(TsUnionType {
|
||||
types,
|
||||
..
|
||||
})) = ts_type
|
||||
else {
|
||||
return None;
|
||||
};
|
||||
|
||||
if types.len() != 2 {
|
||||
return None;
|
||||
}
|
||||
|
||||
// Check pattern: T | T[]
|
||||
if let (Some(scalar_name), Some(array_elem)) =
|
||||
(ts_type_to_string(&types[0]), get_array_elem_type(&types[1]))
|
||||
{
|
||||
if let Some(elem_name) = ts_type_to_string(array_elem) {
|
||||
if scalar_name == elem_name {
|
||||
return Some(format!("{} | {}[]", scalar_name, elem_name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check pattern: T[] | T
|
||||
if let (Some(array_elem), Some(scalar_name)) =
|
||||
(get_array_elem_type(&types[0]), ts_type_to_string(&types[1]))
|
||||
{
|
||||
if let Some(elem_name) = ts_type_to_string(array_elem) {
|
||||
if scalar_name == elem_name {
|
||||
return Some(format!("{}[] | {}", elem_name, scalar_name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
fn find_undefined(types: &Vec<Box<TsType>>) -> Option<usize> {
|
||||
types.into_iter().position(|x| match **x {
|
||||
TsType::TsKeywordType(TsKeywordType { kind, .. }) => {
|
||||
|
||||
@@ -646,55 +646,6 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_union_array_type() {
|
||||
let code = r#"
|
||||
export async function main(
|
||||
items: string | string[],
|
||||
numbers: number[] | number,
|
||||
plain: string
|
||||
) {
|
||||
return { items, numbers, plain };
|
||||
}
|
||||
"#;
|
||||
let sig = parse_deno_signature(code, false, false, None).unwrap();
|
||||
assert_eq!(
|
||||
sig,
|
||||
MainArgSignature {
|
||||
star_args: false,
|
||||
star_kwargs: false,
|
||||
args: vec![
|
||||
Arg {
|
||||
name: "items".to_string(),
|
||||
otyp: Some("string | string[]".to_string()),
|
||||
typ: Typ::Unknown,
|
||||
default: None,
|
||||
has_default: false,
|
||||
oidx: None,
|
||||
},
|
||||
Arg {
|
||||
name: "numbers".to_string(),
|
||||
otyp: Some("number[] | number".to_string()),
|
||||
typ: Typ::Unknown,
|
||||
default: None,
|
||||
has_default: false,
|
||||
oidx: None,
|
||||
},
|
||||
Arg {
|
||||
name: "plain".to_string(),
|
||||
otyp: None,
|
||||
typ: Typ::Str(None),
|
||||
default: None,
|
||||
has_default: false,
|
||||
oidx: None,
|
||||
},
|
||||
],
|
||||
no_main_func: Some(false),
|
||||
has_preprocessor: Some(false),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_invalid_typescript() {
|
||||
let code = r#"
|
||||
|
||||
@@ -3030,16 +3030,8 @@ impl PulledJobResult {
|
||||
if let Some(s) = str_o.as_ref() {
|
||||
match serde_json::from_str::<Vec<Box<RawValue>>>(s) {
|
||||
Ok(ref mut vec) => accumulated_arg.append(vec),
|
||||
Err(_) => {
|
||||
// Value is not an array — wrap the scalar into a
|
||||
// single-element array. This supports union types
|
||||
// like T | T[] where the caller may pass a bare T.
|
||||
match RawValue::from_string(s.to_string()) {
|
||||
Ok(raw) => accumulated_arg.push(raw),
|
||||
Err(e) => {
|
||||
return Err(error::Error::ArgumentErr(format!("cannot consolidate argument `{arg_name_to_accumulate}`: value is neither a valid list nor a valid JSON value\nUnwrapped Error: {e}")));
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
return Err(error::Error::ArgumentErr(format!("cannot consolidate arguments of non-list type. Type provided for argument `{arg_name_to_accumulate}` is not a list\nUnwrapped Error: {e}")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,16 +93,7 @@ async function generateAppHash(
|
||||
}
|
||||
|
||||
/**
|
||||
* Result of generating app locks, including which scripts were updated
|
||||
*/
|
||||
export interface AppLocksResult {
|
||||
path: string;
|
||||
updatedScripts: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates locks for inline scripts in an app.
|
||||
* Returns the path if dry-run, or AppLocksResult with updated scripts if actual update occurred.
|
||||
* Updates locks for inline scripts in an app
|
||||
*/
|
||||
export async function generateAppLocksInternal(
|
||||
appFolder: string,
|
||||
@@ -114,7 +105,7 @@ export async function generateAppLocksInternal(
|
||||
},
|
||||
justUpdateMetadataLock?: boolean,
|
||||
noStaleMessage?: boolean
|
||||
): Promise<string | AppLocksResult | void> {
|
||||
): Promise<string | void> {
|
||||
if (appFolder.endsWith(SEP)) {
|
||||
appFolder = appFolder.substring(0, appFolder.length - 1);
|
||||
}
|
||||
@@ -176,8 +167,6 @@ export async function generateAppLocksInternal(
|
||||
);
|
||||
}
|
||||
|
||||
let updatedScripts: string[] = [];
|
||||
|
||||
if (!justUpdateMetadataLock) {
|
||||
const changedScripts = [];
|
||||
// Find hashes that do not correspond to previous hashes
|
||||
@@ -212,14 +201,13 @@ export async function generateAppLocksInternal(
|
||||
replaceInlineScripts(runnables, runnablesPath + SEP, false);
|
||||
|
||||
// Update the app runnables with new locks (writes to separate files)
|
||||
updatedScripts = await updateRawAppRunnables(
|
||||
await updateRawAppRunnables(
|
||||
workspace,
|
||||
runnables,
|
||||
remote_path,
|
||||
appFolder,
|
||||
filteredDeps,
|
||||
opts.defaultTs,
|
||||
noStaleMessage
|
||||
opts.defaultTs
|
||||
);
|
||||
// Note: updateRawAppRunnables now writes each runnable to its own file
|
||||
} else {
|
||||
@@ -229,17 +217,14 @@ export async function generateAppLocksInternal(
|
||||
replaceInlineScripts(normalAppFile.value, appFolder + SEP, false);
|
||||
|
||||
// Update the app value with new locks
|
||||
const result = await updateAppInlineScripts(
|
||||
normalAppFile.value = await updateAppInlineScripts(
|
||||
workspace,
|
||||
normalAppFile.value,
|
||||
remote_path,
|
||||
appFolder,
|
||||
filteredDeps,
|
||||
opts.defaultTs,
|
||||
noStaleMessage
|
||||
opts.defaultTs
|
||||
);
|
||||
normalAppFile.value = result.value;
|
||||
updatedScripts = result.updatedScripts;
|
||||
|
||||
// Write the updated app file (only for normal apps, raw apps use separate files)
|
||||
writeIfChanged(
|
||||
@@ -266,8 +251,6 @@ export async function generateAppLocksInternal(
|
||||
if (!noStaleMessage) {
|
||||
log.info(colors.green(`App ${remote_path} lockfiles updated`));
|
||||
}
|
||||
|
||||
return { path: remote_path, updatedScripts };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -357,7 +340,6 @@ async function traverseAndProcessInlineScripts(
|
||||
* Updates locks for all runnables in a raw app, generating locks inline script by inline script.
|
||||
* Writes each runnable to its own YAML file in the backend folder (new format).
|
||||
* Also writes content and lock files to the runnables folder.
|
||||
* Returns the list of runnable IDs that had their locks updated.
|
||||
*/
|
||||
async function updateRawAppRunnables(
|
||||
workspace: Workspace,
|
||||
@@ -365,10 +347,8 @@ async function updateRawAppRunnables(
|
||||
remotePath: string,
|
||||
appFolder: string,
|
||||
rawDeps?: Record<string, string>,
|
||||
defaultTs: "bun" | "deno" = "bun",
|
||||
noStaleMessage?: boolean
|
||||
): Promise<string[]> {
|
||||
const updatedRunnables: string[] = [];
|
||||
defaultTs: "bun" | "deno" = "bun"
|
||||
): Promise<void> {
|
||||
const runnablesFolder = path.join(appFolder, APP_BACKEND_FOLDER);
|
||||
|
||||
// Ensure runnables folder exists
|
||||
@@ -434,11 +414,12 @@ async function updateRawAppRunnables(
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!noStaleMessage) {
|
||||
log.info(
|
||||
colors.gray(`Generating lock for runnable ${runnableId} (${language})`)
|
||||
);
|
||||
}
|
||||
log.info(
|
||||
colors.gray(
|
||||
`Generating lock for runnable ${runnableId} (${language})
|
||||
}`
|
||||
)
|
||||
);
|
||||
|
||||
try {
|
||||
const lock = await generateInlineScriptLock(
|
||||
@@ -478,15 +459,11 @@ async function updateRawAppRunnables(
|
||||
// Write the runnable to its own YAML file
|
||||
writeRunnableToBackend(runnablesFolder, runnableId, simplifiedRunnable);
|
||||
|
||||
updatedRunnables.push(runnableId);
|
||||
|
||||
if (!noStaleMessage) {
|
||||
log.info(
|
||||
colors.gray(
|
||||
` Written ${runnableId}.yaml, ${basePath}${ext}${lock ? ` and ${basePath}lock` : ""}`
|
||||
)
|
||||
);
|
||||
}
|
||||
log.info(
|
||||
colors.gray(
|
||||
` Written ${runnableId}.yaml, ${basePath}${ext}${lock ? ` and ${basePath}lock` : ""}`
|
||||
)
|
||||
);
|
||||
} catch (error: any) {
|
||||
log.error(
|
||||
colors.red(
|
||||
@@ -497,14 +474,11 @@ async function updateRawAppRunnables(
|
||||
writeRunnableToBackend(runnablesFolder, runnableId, runnable);
|
||||
}
|
||||
}
|
||||
|
||||
return updatedRunnables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates locks for all inline scripts in a normal app, similar to updateRawAppRunnables
|
||||
* but for the app.value structure instead of app.runnables.
|
||||
* Returns a tuple of [updated app value, list of script names that were updated].
|
||||
* but for the app.value structure instead of app.runnables
|
||||
*/
|
||||
async function updateAppInlineScripts(
|
||||
workspace: Workspace,
|
||||
@@ -512,11 +486,9 @@ async function updateAppInlineScripts(
|
||||
remotePath: string,
|
||||
appFolder: string,
|
||||
rawDeps?: Record<string, string>,
|
||||
defaultTs: "bun" | "deno" = "bun",
|
||||
noStaleMessage?: boolean
|
||||
): Promise<{ value: any; updatedScripts: string[] }> {
|
||||
defaultTs: "bun" | "deno" = "bun"
|
||||
): Promise<any> {
|
||||
const pathAssigner = newPathAssigner(defaultTs, { skipInlineScriptSuffix: getNonDottedPaths() });
|
||||
const updatedScripts: string[] = [];
|
||||
|
||||
const processor: InlineScriptProcessor = async (inlineScript, context) => {
|
||||
const language = inlineScript.language as SupportedLanguage;
|
||||
@@ -546,15 +518,13 @@ async function updateAppInlineScripts(
|
||||
try {
|
||||
let lock: string | undefined;
|
||||
if (language !== "frontend") {
|
||||
if (!noStaleMessage) {
|
||||
log.info(
|
||||
colors.gray(
|
||||
`Generating lock for inline script "${scriptName}" at ${context.path.join(
|
||||
"."
|
||||
)} (${language})`
|
||||
)
|
||||
);
|
||||
}
|
||||
log.info(
|
||||
colors.gray(
|
||||
`Generating lock for inline script "${scriptName}" at ${context.path.join(
|
||||
"."
|
||||
)} (${language})`
|
||||
)
|
||||
);
|
||||
|
||||
lock = await generateInlineScriptLock(
|
||||
workspace,
|
||||
@@ -583,18 +553,11 @@ async function updateAppInlineScripts(
|
||||
const inlineLockRef =
|
||||
lock && lock !== "" ? `!inline ${basePath}lock` : "";
|
||||
|
||||
if (!noStaleMessage) {
|
||||
log.info(
|
||||
colors.gray(
|
||||
` Written ${basePath}${ext}${lock ? ` and ${basePath}lock` : ""}`
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Track that this script was updated (only for non-frontend scripts that needed locks)
|
||||
if (language !== "frontend") {
|
||||
updatedScripts.push(scriptName);
|
||||
}
|
||||
log.info(
|
||||
colors.gray(
|
||||
` Written ${basePath}${ext}${lock ? ` and ${basePath}lock` : ""}`
|
||||
)
|
||||
);
|
||||
|
||||
return {
|
||||
...inlineScript,
|
||||
@@ -614,8 +577,7 @@ async function updateAppInlineScripts(
|
||||
}
|
||||
};
|
||||
|
||||
const updatedValue = await traverseAndProcessInlineScripts(appValue, processor);
|
||||
return { value: updatedValue, updatedScripts };
|
||||
return await traverseAndProcessInlineScripts(appValue, processor);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -51,14 +51,6 @@ async function generateFlowHash(
|
||||
}
|
||||
return { ...hashes, [TOP_HASH]: await generateHash(JSON.stringify(hashes)) };
|
||||
}
|
||||
/**
|
||||
* Result of generating flow locks, including which scripts were updated
|
||||
*/
|
||||
export interface FlowLocksResult {
|
||||
path: string;
|
||||
updatedScripts: string[];
|
||||
}
|
||||
|
||||
export async function generateFlowLockInternal(
|
||||
folder: string,
|
||||
dryRun: boolean,
|
||||
@@ -68,7 +60,7 @@ export async function generateFlowLockInternal(
|
||||
},
|
||||
justUpdateMetadataLock?: boolean,
|
||||
noStaleMessage?: boolean
|
||||
): Promise<string | FlowLocksResult | void> {
|
||||
): Promise<string | void> {
|
||||
if (folder.endsWith(SEP)) {
|
||||
folder = folder.substring(0, folder.length - 1);
|
||||
}
|
||||
@@ -117,9 +109,8 @@ export async function generateFlowLockInternal(
|
||||
}
|
||||
|
||||
|
||||
let changedScripts: string[] = [];
|
||||
|
||||
if (!justUpdateMetadataLock) {
|
||||
const changedScripts = [];
|
||||
//find hashes that do not correspond to previous hashes
|
||||
for (const [path, hash] of Object.entries(hashes)) {
|
||||
if (path == TOP_HASH) {
|
||||
@@ -194,13 +185,6 @@ export async function generateFlowLockInternal(
|
||||
if (!noStaleMessage) {
|
||||
log.info(colors.green(`Flow ${remote_path} lockfiles updated`));
|
||||
}
|
||||
|
||||
// Return the list of updated scripts (extract just the filename from the path)
|
||||
const updatedScripts = changedScripts.map(p => {
|
||||
const parts = p.split(SEP);
|
||||
return parts[parts.length - 1].replace(/\.[^.]+$/, ""); // Remove extension
|
||||
});
|
||||
return { path: remote_path, updatedScripts };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,15 +11,15 @@ import {
|
||||
generateScriptMetadataInternal,
|
||||
getRawWorkspaceDependencies,
|
||||
} from "../../utils/metadata.ts";
|
||||
import { generateFlowLockInternal, FlowLocksResult } from "../flow/flow_metadata.ts";
|
||||
import { generateAppLocksInternal, getAppFolders, AppLocksResult } from "../app/app_metadata.ts";
|
||||
import { generateFlowLockInternal } from "../flow/flow_metadata.ts";
|
||||
import { generateAppLocksInternal, getAppFolders } from "../app/app_metadata.ts";
|
||||
import {
|
||||
elementsToMap,
|
||||
FSFSElement,
|
||||
ignoreF,
|
||||
} from "../sync/sync.ts";
|
||||
import { exts } from "../script/script.ts";
|
||||
import { isFlowPath, isAppPath, isRawAppPath } from "../../utils/resource_folders.ts";
|
||||
import { isFlowPath, isAppPath } from "../../utils/resource_folders.ts";
|
||||
import { listSyncCodebases } from "../../utils/codebase.ts";
|
||||
|
||||
interface StaleItem {
|
||||
@@ -82,8 +82,7 @@ async function generateMetadata(
|
||||
(!isD && !exts.some((ext) => p.endsWith(ext))) ||
|
||||
ignore(p, isD) ||
|
||||
isFlowPath(p) ||
|
||||
isAppPath(p) ||
|
||||
isRawAppPath(p)
|
||||
isAppPath(p)
|
||||
);
|
||||
},
|
||||
false,
|
||||
@@ -193,17 +192,12 @@ async function generateMetadata(
|
||||
// === Filter by folder if specified ===
|
||||
let filteredItems = staleItems;
|
||||
if (folder) {
|
||||
// Normalize to forward slashes (Windows users may use backslashes)
|
||||
folder = folder.replaceAll("\\", "/");
|
||||
// Strip trailing slash to match deprecated flow/app handler behavior
|
||||
if (folder.endsWith("/")) {
|
||||
// Strip trailing separator to match deprecated flow/app handler behavior
|
||||
// (see generateFlowLockInternal line 64-66, generateAppLocksInternal line 109-110)
|
||||
if (folder.endsWith(SEP)) {
|
||||
folder = folder.substring(0, folder.length - 1);
|
||||
}
|
||||
// Normalize item.folder for comparison (Windows file paths use backslashes)
|
||||
filteredItems = staleItems.filter((item) => {
|
||||
const normalizedFolder = item.folder.replaceAll("\\", "/");
|
||||
return normalizedFolder === folder || normalizedFolder.startsWith(folder + "/");
|
||||
});
|
||||
filteredItems = staleItems.filter((item) => item.folder === folder || item.folder.startsWith(folder + SEP));
|
||||
}
|
||||
|
||||
// === Show stale items and confirm ===
|
||||
@@ -286,23 +280,21 @@ async function generateMetadata(
|
||||
// Process flows
|
||||
for (const item of flows) {
|
||||
current++;
|
||||
const result = await generateFlowLockInternal(
|
||||
log.info(`${formatProgress(current)} flow ${colors.cyan(item.path)}`);
|
||||
await generateFlowLockInternal(
|
||||
item.folder,
|
||||
false, // dryRun
|
||||
workspace,
|
||||
opts,
|
||||
false,
|
||||
true // noStaleMessage - we handle output
|
||||
) as FlowLocksResult | void;
|
||||
const scriptsInfo = result?.updatedScripts?.length
|
||||
? `: ${colors.gray(result.updatedScripts.join(", "))}`
|
||||
: "";
|
||||
log.info(`${formatProgress(current)} flow ${colors.cyan(item.path)}${scriptsInfo}`);
|
||||
);
|
||||
}
|
||||
// Process apps
|
||||
for (const item of apps) {
|
||||
current++;
|
||||
const result = await generateAppLocksInternal(
|
||||
log.info(`${formatProgress(current)} app ${colors.cyan(item.path)}`);
|
||||
await generateAppLocksInternal(
|
||||
item.folder,
|
||||
item.isRawApp!, // rawApp
|
||||
false, // dryRun
|
||||
@@ -310,11 +302,7 @@ async function generateMetadata(
|
||||
opts,
|
||||
false,
|
||||
true // noStaleMessage - we handle output
|
||||
) as AppLocksResult | void;
|
||||
const scriptsInfo = result?.updatedScripts?.length
|
||||
? `: ${colors.gray(result.updatedScripts.join(", "))}`
|
||||
: "";
|
||||
log.info(`${formatProgress(current)} app ${colors.cyan(item.path)}${scriptsInfo}`);
|
||||
);
|
||||
}
|
||||
|
||||
log.info("");
|
||||
|
||||
@@ -58,7 +58,6 @@ import {
|
||||
isFlowInlineScriptPath as isFlowInlineScriptPathInternal,
|
||||
isFlowPath,
|
||||
isAppPath,
|
||||
isRawAppPath,
|
||||
} from "../../utils/resource_folders.ts";
|
||||
|
||||
export interface ScriptFile {
|
||||
@@ -1028,8 +1027,7 @@ export async function generateMetadata(
|
||||
(!isD && !exts.some((ext) => p.endsWith(ext))) ||
|
||||
ignore(p, isD) ||
|
||||
isFlowPath(p) ||
|
||||
isAppPath(p) ||
|
||||
isRawAppPath(p)
|
||||
isAppPath(p)
|
||||
);
|
||||
},
|
||||
false,
|
||||
|
||||
@@ -50,25 +50,26 @@ export class LockfileGenerationError extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
export async function generateAllMetadata() {}
|
||||
|
||||
export async function getRawWorkspaceDependencies(): Promise<Record<string, string>> {
|
||||
const rawWorkspaceDeps: Record<string, string> = {};
|
||||
|
||||
|
||||
try {
|
||||
const entries = await readdir("dependencies", { withFileTypes: true });
|
||||
for (const entry of entries) {
|
||||
if (entry.isDirectory()) continue;
|
||||
|
||||
|
||||
const filePath = `dependencies/${entry.name}`;
|
||||
const content = await readFile(filePath, "utf-8");
|
||||
|
||||
|
||||
// Find matching language
|
||||
for (const lang of workspaceDependenciesLanguages) {
|
||||
if (entry.name.endsWith(lang.filename)) {
|
||||
// Check if out of sync
|
||||
const contentHash = await generateHash(content + filePath);
|
||||
const isUpToDate = await checkifMetadataUptodate(filePath, contentHash, undefined);
|
||||
|
||||
|
||||
if (!isUpToDate) {
|
||||
rawWorkspaceDeps[filePath] = content;
|
||||
}
|
||||
@@ -690,11 +691,6 @@ export async function inferSchema(
|
||||
|
||||
argSigToJsonSchemaType(arg.typ, currentSchema.properties[arg.name]);
|
||||
|
||||
// For T | T[] detection for debouncing arg accumulation
|
||||
if ((arg as any).otyp && (arg as any).otyp.includes('[') && (arg as any).otyp.includes('|')) {
|
||||
currentSchema.properties[arg.name].originalType = (arg as any).otyp
|
||||
}
|
||||
|
||||
currentSchema.properties[arg.name].default = arg.default;
|
||||
|
||||
if (!arg.has_default && !currentSchema.required.includes(arg.name)) {
|
||||
|
||||
@@ -107,7 +107,7 @@ async function readFileContent(filePath: string): Promise<string> {
|
||||
* Create a raw app directory structure on disk
|
||||
* Uses .raw_app folder suffix with raw_app.yaml metadata
|
||||
*/
|
||||
async function createRawAppOnDisk(appDir: string, includeBackend: boolean = false): Promise<void> {
|
||||
async function createRawAppOnDisk(appDir: string): Promise<void> {
|
||||
await mkdir(appDir, { recursive: true });
|
||||
await mkdir(path.join(appDir, "inline_scripts"), { recursive: true });
|
||||
|
||||
@@ -131,16 +131,6 @@ async function createRawAppOnDisk(appDir: string, includeBackend: boolean = fals
|
||||
INLINE_SCRIPT_A_LOCK,
|
||||
"utf-8"
|
||||
);
|
||||
|
||||
// Optionally create backend runnable (type: inline)
|
||||
if (includeBackend) {
|
||||
await mkdir(path.join(appDir, "backend"), { recursive: true });
|
||||
await writeFile(path.join(appDir, "backend", "query.yaml"), "type: inline\n", "utf-8");
|
||||
await writeFile(path.join(appDir, "backend", "query.ts"), `export async function main(x: number): Promise<string> {
|
||||
return \`Result: \${x}\`;
|
||||
}
|
||||
`, "utf-8");
|
||||
}
|
||||
}
|
||||
|
||||
test("Raw App: full sync workflow - push, pull, modify, push, clear, pull", async () => {
|
||||
@@ -163,7 +153,7 @@ excludes: []`, "utf-8");
|
||||
// Create folder structure
|
||||
const appDir = path.join(tempDir, "f", "test", "my_raw_app.raw_app");
|
||||
await mkdir(path.join(tempDir, "f", "test"), { recursive: true });
|
||||
await createRawAppOnDisk(appDir, true); // Include backend for metadata test
|
||||
await createRawAppOnDisk(appDir);
|
||||
|
||||
// =========================================================================
|
||||
// STEP 1: Initial push - create raw app on backend
|
||||
@@ -276,47 +266,6 @@ excludes: []`, "utf-8");
|
||||
|
||||
const pulledInlineScript = await readFileContent(inlineScriptPath);
|
||||
expect(pulledInlineScript).toContain("modified:");
|
||||
|
||||
// =========================================================================
|
||||
// STEP 7: Test that script generate-metadata does NOT process backend runnables
|
||||
// =========================================================================
|
||||
|
||||
// Create a standalone script (should be processed by script generate-metadata)
|
||||
await writeFile(path.join(tempDir, "f", "test", "standalone.ts"), `export async function main(): Promise<string> {
|
||||
return "hello";
|
||||
}
|
||||
`, "utf-8");
|
||||
|
||||
// Run script generate-metadata
|
||||
const metaResult1 = await backend.runCLICommand(
|
||||
['script', 'generate-metadata', '--yes'],
|
||||
tempDir, "raw_app_test"
|
||||
);
|
||||
expect(metaResult1.code).toEqual(0);
|
||||
|
||||
// Run generate-metadata --skip-flows --skip-apps
|
||||
const metaResult2 = await backend.runCLICommand(
|
||||
['generate-metadata', '--skip-flows', '--skip-apps', '--yes'],
|
||||
tempDir, "raw_app_test"
|
||||
);
|
||||
expect(metaResult2.code).toEqual(0);
|
||||
|
||||
// Backend runnables should NOT have .script.yaml files
|
||||
const backendDir = path.join(appDir, "backend");
|
||||
expect(await fileExists(path.join(backendDir, "query.yaml"))).toBeTruthy();
|
||||
expect(await fileExists(path.join(backendDir, "query.ts"))).toBeTruthy();
|
||||
expect(await fileExists(path.join(backendDir, "query.script.yaml"))).toBeFalsy();
|
||||
expect(await fileExists(path.join(backendDir, "query.script.lock"))).toBeFalsy();
|
||||
|
||||
// Bug: raw app backend files get misprocessed and create script files at wrong location
|
||||
// The path f/test/my_raw_app.raw_app/backend/query.ts gets truncated at first "."
|
||||
// becoming f/test/my_raw_app.script.yaml (stripping .raw_app/backend/query.ts)
|
||||
expect(await fileExists(path.join(tempDir, "f", "test", "my_raw_app.script.yaml"))).toBeFalsy();
|
||||
expect(await fileExists(path.join(tempDir, "f", "test", "my_raw_app.script.lock"))).toBeFalsy();
|
||||
|
||||
// Standalone script SHOULD have metadata
|
||||
expect(await fileExists(path.join(tempDir, "f", "test", "standalone.script.yaml"))).toBeTruthy();
|
||||
expect(await fileExists(path.join(tempDir, "f", "test", "standalone.script.lock"))).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
66
frontend/package-lock.json
generated
66
frontend/package-lock.json
generated
@@ -81,11 +81,11 @@
|
||||
"windmill-parser-wasm-java": "1.510.1",
|
||||
"windmill-parser-wasm-nu": "1.510.1",
|
||||
"windmill-parser-wasm-php": "1.647.1",
|
||||
"windmill-parser-wasm-py": "1.655.0",
|
||||
"windmill-parser-wasm-py": "1.653.0",
|
||||
"windmill-parser-wasm-regex": "1.653.0",
|
||||
"windmill-parser-wasm-ruby": "1.526.1",
|
||||
"windmill-parser-wasm-rust": "1.647.1",
|
||||
"windmill-parser-wasm-ts": "1.655.0",
|
||||
"windmill-parser-wasm-ts": "1.653.0",
|
||||
"windmill-parser-wasm-yaml": "1.593.0",
|
||||
"windmill-sql-datatype-parser-wasm": "1.512.0",
|
||||
"windmill-utils-internal": "^1.3.4",
|
||||
@@ -837,7 +837,6 @@
|
||||
"version": "1.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.9.0.tgz",
|
||||
"integrity": "sha512-0DQ98G9ZQZOxfUcQn1waV2yS8aWdZ6kJMbYCJB3oUBecjWYO1fqJ+a1DRfPF3O5JEkwqwP1A9QEN/9mYm2Yd0w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
@@ -849,7 +848,6 @@
|
||||
"version": "1.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.9.0.tgz",
|
||||
"integrity": "sha512-QN75eB0IH2ywSpRpNddCRfQIhmJYBCJ1x5Lb3IscKAL8bMnVAKnRg8dCoXbHzVLLH7P38N2Z3mtulB7W0J0FKw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
@@ -860,7 +858,6 @@
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.0.tgz",
|
||||
"integrity": "sha512-N10dEJNSsUx41Z6pZsXU8FjPjpBEplgH24sfkmITrBED1/U2Esum9F3lfLrMjKHHjmi557zQn7kR9R+XWXu5Rg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
@@ -1350,7 +1347,6 @@
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.1.tgz",
|
||||
"integrity": "sha512-p64ah1M1ld8xjWv3qbvFwHiFVWrq1yFvV4f7w+mzaqiR4IlSgkqhcRdHwsGgomwzBH51sRY4NEowLxnaBjcW/A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
@@ -1507,7 +1503,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1524,7 +1519,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1541,7 +1535,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1558,7 +1551,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1575,7 +1567,6 @@
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1592,7 +1583,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1609,7 +1599,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1626,7 +1615,6 @@
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1643,7 +1631,6 @@
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1660,7 +1647,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1677,7 +1663,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1694,7 +1679,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1711,7 +1695,6 @@
|
||||
"cpu": [
|
||||
"wasm32"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
@@ -1728,7 +1711,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1745,7 +1727,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -2051,7 +2032,6 @@
|
||||
"version": "0.10.1",
|
||||
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.1.tgz",
|
||||
"integrity": "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
@@ -6860,7 +6840,7 @@
|
||||
"version": "1.21.7",
|
||||
"resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.7.tgz",
|
||||
"integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==",
|
||||
"dev": true,
|
||||
"devOptional": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"jiti": "bin/jiti.js"
|
||||
@@ -7359,7 +7339,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -7380,7 +7359,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -7401,7 +7379,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -7422,7 +7399,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -7443,7 +7419,6 @@
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -7464,7 +7439,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -7485,7 +7459,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -7506,7 +7479,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -7527,7 +7499,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -7548,7 +7519,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -7569,7 +7539,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -12145,21 +12114,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/svelte-check/node_modules/picomatch": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
|
||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/jonschlinkert"
|
||||
}
|
||||
},
|
||||
"node_modules/svelte-eslint-parser": {
|
||||
"version": "0.43.0",
|
||||
"resolved": "https://registry.npmjs.org/svelte-eslint-parser/-/svelte-eslint-parser-0.43.0.tgz",
|
||||
@@ -12890,7 +12844,7 @@
|
||||
"version": "5.9.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
|
||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||
"dev": true,
|
||||
"devOptional": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
@@ -13671,9 +13625,9 @@
|
||||
"integrity": "sha512-u2qaMkupSdhJibxvkLh3r/y36IARvnYNTLXWvOKxcQ0G/BPUB4+yF5o/yf47vv9zUV5WZv4mrdsKDt/pZDYeDg=="
|
||||
},
|
||||
"node_modules/windmill-parser-wasm-py": {
|
||||
"version": "1.655.0",
|
||||
"resolved": "https://registry.npmjs.org/windmill-parser-wasm-py/-/windmill-parser-wasm-py-1.655.0.tgz",
|
||||
"integrity": "sha512-kWpAE2Me/8KwNqq4n+0ZoEqMJZ9aCZf1744j0S6Om+F+XyHFR3e7GYK/slJ4cF7zA9TF6mKUSiW4oHJ+WUlNXQ=="
|
||||
"version": "1.653.0",
|
||||
"resolved": "https://registry.npmjs.org/windmill-parser-wasm-py/-/windmill-parser-wasm-py-1.653.0.tgz",
|
||||
"integrity": "sha512-vMkSL3JpELpag7nmyGA8onhYNiAG3K1mkh2k4vwVHC3W5dUd12fSS9gsBco2FqPGUPnWv1gCaHwmjBrOBVGL1w=="
|
||||
},
|
||||
"node_modules/windmill-parser-wasm-regex": {
|
||||
"version": "1.653.0",
|
||||
@@ -13691,9 +13645,9 @@
|
||||
"integrity": "sha512-9yGLYZX2Hn9TdTqGY/5Fp50ftzgUsrfBkSK9vJkKJd5Amyg+yXLBGzd8pz6Org+4uxMenz/16wpsgijvo6uhhQ=="
|
||||
},
|
||||
"node_modules/windmill-parser-wasm-ts": {
|
||||
"version": "1.655.0",
|
||||
"resolved": "https://registry.npmjs.org/windmill-parser-wasm-ts/-/windmill-parser-wasm-ts-1.655.0.tgz",
|
||||
"integrity": "sha512-nzvxILV68MccOKuZcGwjZLB+mWzPMMqEP0FTOb9nmkRWzKPFMxs5ADAXrDZINeNLNv64hYQhGw66ouq0P1G6jQ=="
|
||||
"version": "1.653.0",
|
||||
"resolved": "https://registry.npmjs.org/windmill-parser-wasm-ts/-/windmill-parser-wasm-ts-1.653.0.tgz",
|
||||
"integrity": "sha512-zwBUy7ijo58ooAKcsYflISY/+xllCw3Aq34Kj1PED6uABWVbV6A8MWHqEsjiVzC6iWfihWNtZJpck8zsRr9DCg=="
|
||||
},
|
||||
"node_modules/windmill-parser-wasm-yaml": {
|
||||
"version": "1.593.0",
|
||||
|
||||
@@ -154,11 +154,11 @@
|
||||
"windmill-parser-wasm-java": "1.510.1",
|
||||
"windmill-parser-wasm-nu": "1.510.1",
|
||||
"windmill-parser-wasm-php": "1.647.1",
|
||||
"windmill-parser-wasm-py": "1.655.0",
|
||||
"windmill-parser-wasm-py": "1.653.0",
|
||||
"windmill-parser-wasm-regex": "1.653.0",
|
||||
"windmill-parser-wasm-ruby": "1.526.1",
|
||||
"windmill-parser-wasm-rust": "1.647.1",
|
||||
"windmill-parser-wasm-ts": "1.655.0",
|
||||
"windmill-parser-wasm-ts": "1.653.0",
|
||||
"windmill-parser-wasm-yaml": "1.593.0",
|
||||
"windmill-sql-datatype-parser-wasm": "1.512.0",
|
||||
"windmill-utils-internal": "^1.3.4",
|
||||
@@ -583,4 +583,4 @@
|
||||
"@rollup/rollup-linux-x64-gnu": "^4.35.0",
|
||||
"fsevents": "^2.3.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,12 +291,7 @@
|
||||
workers.some(([_, pings]) => pings.some((p) => p.native_mode === true)))
|
||||
)
|
||||
let nonNativeTags = $derived(
|
||||
(nconfig?.worker_tags ?? []).filter(
|
||||
(t) =>
|
||||
!nativeTags.some((nt) => t === nt || t.startsWith(`${nt}-`)) &&
|
||||
t !== 'flow' &&
|
||||
!t.startsWith('flow-')
|
||||
)
|
||||
(nconfig?.worker_tags ?? []).filter((t) => !nativeTags.includes(t) && t !== 'flow')
|
||||
)
|
||||
let isAutoNativeMode = $derived(name === 'native')
|
||||
let isNativeModeEnabled = $derived(nconfig?.native_mode === true || isAutoNativeMode)
|
||||
@@ -574,8 +569,8 @@
|
||||
<Alert size="xs" type="warning" title="Non-native tags detected">
|
||||
This worker group has native mode enabled but includes non-native tags: {nonNativeTags.join(
|
||||
', '
|
||||
)}. This is fine if jobs sent to those tags are native only, otherwise they will be
|
||||
failed.
|
||||
)}. Non-native jobs will be failed. This is fine if those custom tags are only used
|
||||
for native language jobs.
|
||||
</Alert>
|
||||
{/if}
|
||||
{#if isNativeModeEnabled && nconfig?.worker_tags != undefined && !nconfig.worker_tags.includes(defaultTagPerWorkspace && workspaceTag ? `flow-${workspaceTag}` : 'flow')}
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
<script lang="ts" module>
|
||||
export let openedDrawers: { val: string[] } = $state({ val: [] })
|
||||
|
||||
// When a disposable with minZIndex is open, all disposables use that as
|
||||
// their z-index base so that overlays opened on top (e.g. a Drawer from
|
||||
// inside a Modal) stack correctly above it.
|
||||
// We track per-id entries so concurrent modals don't clobber each other
|
||||
// (closing one must not reset the base while another is still open).
|
||||
let minZIndexEntries: Record<string, number> = $state({})
|
||||
let activeMinZIndex = $derived.by(() => {
|
||||
const values = Object.values(minZIndexEntries)
|
||||
return values.length > 0 ? Math.max(...values) : 0
|
||||
})
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -22,11 +11,6 @@
|
||||
id?: any
|
||||
preventEscape?: boolean
|
||||
initialOffset?: number
|
||||
/** Minimum z-index base for this overlay. While any disposable with a
|
||||
* minZIndex is open, all disposables use that as their base so that
|
||||
* subsequent overlays stack above it (e.g. zIndexes.aiChat + 1 for
|
||||
* modals that need to render above the AI chat panel). */
|
||||
minZIndex?: number
|
||||
children?: import('svelte').Snippet<[any]>
|
||||
onOpen?: () => void
|
||||
onClose?: () => void
|
||||
@@ -37,17 +21,13 @@
|
||||
id = (Math.random() + 1).toString(36).substring(10),
|
||||
preventEscape = false,
|
||||
initialOffset = 0,
|
||||
minZIndex = 0,
|
||||
children,
|
||||
onOpen,
|
||||
onClose
|
||||
}: Props = $props()
|
||||
|
||||
let offset = $state(untrack(() => initialOffset))
|
||||
// Note: when a Modal with minZIndex is open, all disposables (including
|
||||
// already-open Drawers) are elevated. This is acceptable — relative
|
||||
// stacking order is preserved by the per-instance offset.
|
||||
let zIndex = $derived(Math.max(zIndexes.disposables, activeMinZIndex) + offset)
|
||||
let zIndex = $derived(zIndexes.disposables + offset)
|
||||
|
||||
export function toggleDrawer() {
|
||||
if (!open) {
|
||||
@@ -64,9 +44,6 @@
|
||||
}
|
||||
openedDrawers.val.push(id)
|
||||
offset = initialOffset + openedDrawers.val.length
|
||||
if (minZIndex > 0) {
|
||||
minZIndexEntries[id] = minZIndex
|
||||
}
|
||||
}
|
||||
|
||||
export function closeDrawer() {
|
||||
@@ -74,9 +51,6 @@
|
||||
offset = initialOffset
|
||||
if (openedDrawers.val.includes(id)) {
|
||||
openedDrawers.val = openedDrawers.val.filter((drawer) => drawer !== id)
|
||||
if (minZIndex > 0) {
|
||||
delete minZIndexEntries[id]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,9 +89,6 @@
|
||||
if (open) {
|
||||
openedDrawers.val.push(untrack(() => id))
|
||||
offset = untrack(() => initialOffset) + openedDrawers.val.length
|
||||
if (minZIndex > 0) {
|
||||
minZIndexEntries[untrack(() => id)] = minZIndex
|
||||
}
|
||||
}
|
||||
|
||||
let wasEverOpen = false
|
||||
|
||||
@@ -2,14 +2,11 @@
|
||||
import { createBubbler, stopPropagation } from 'svelte/legacy'
|
||||
|
||||
const bubble = createBubbler()
|
||||
import { createEventDispatcher, untrack } from 'svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import { fade } from 'svelte/transition'
|
||||
import Button from '../button/Button.svelte'
|
||||
import { twMerge } from 'tailwind-merge'
|
||||
import CloseButton from '../CloseButton.svelte'
|
||||
import Disposable from '../drawer/Disposable.svelte'
|
||||
import { zIndexes } from '$lib/zIndexes'
|
||||
import { chatState } from '$lib/components/copilot/chat/sharedChatState.svelte'
|
||||
|
||||
interface Props {
|
||||
title: string
|
||||
@@ -31,28 +28,12 @@
|
||||
cancelText = undefined,
|
||||
kind = 'button',
|
||||
settings,
|
||||
children: children_render,
|
||||
children,
|
||||
actions
|
||||
}: Props = $props()
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
let disposable: Disposable | undefined = $state(undefined)
|
||||
|
||||
// Only elevate above the AI chat panel when it's actually open —
|
||||
// when chat is closed there's nothing at z-index 1200 to stack above.
|
||||
const minZIndex = $derived(chatState.size > 0 ? zIndexes.aiChat + 1 : 0)
|
||||
|
||||
// Both `bind:open` and this $effect are needed: bind:open syncs the
|
||||
// boolean, while the effect calls openDrawer/closeDrawer to register
|
||||
// the disposable in the stacking system (same pattern as Drawer.svelte).
|
||||
$effect(() => {
|
||||
open
|
||||
untrack(() => {
|
||||
open ? disposable?.openDrawer() : disposable?.closeDrawer()
|
||||
})
|
||||
})
|
||||
|
||||
function onKeyDown(event: KeyboardEvent) {
|
||||
if (open) {
|
||||
switch (event.key) {
|
||||
@@ -77,80 +58,70 @@
|
||||
|
||||
<svelte:window onkeydowncapture={onKeyDown} />
|
||||
|
||||
<Disposable bind:open bind:this={disposable} preventEscape {minZIndex}>
|
||||
{#snippet children({ zIndex })}
|
||||
{#if open}
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
||||
<!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
|
||||
<div
|
||||
onclick={() => (open = false)}
|
||||
transition:fadeFast|local
|
||||
class="fixed top-0 bottom-0 left-0 right-0"
|
||||
style="z-index: {zIndex}"
|
||||
role="dialog"
|
||||
tabindex="-1"
|
||||
>
|
||||
{#if open}
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
||||
<!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
|
||||
<div
|
||||
onclick={() => (open = false)}
|
||||
transition:fadeFast|local
|
||||
class={'fixed top-0 bottom-0 left-0 right-0 z-[9999]'}
|
||||
role="dialog"
|
||||
tabindex="-1"
|
||||
>
|
||||
<div
|
||||
class={twMerge(
|
||||
'fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity',
|
||||
open ? 'ease-out duration-300 opacity-100' : 'ease-in duration-200 opacity-0'
|
||||
)}
|
||||
></div>
|
||||
|
||||
<div class="fixed inset-0 z-10 overflow-y-auto">
|
||||
<div class="flex min-h-full items-center justify-center p-4">
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<div
|
||||
onclick={stopPropagation(bubble('click'))}
|
||||
class={twMerge(
|
||||
'fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity',
|
||||
'relative transform overflow-hidden rounded-md bg-surface px-4 pt-5 pb-4 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg sm:p-6',
|
||||
c,
|
||||
open
|
||||
? 'ease-out duration-300 opacity-100'
|
||||
: 'ease-in duration-200 opacity-0'
|
||||
? 'ease-out duration-300 opacity-100 translate-y-0 sm:scale-100'
|
||||
: 'ease-in duration-200 opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95'
|
||||
)}
|
||||
></div>
|
||||
|
||||
<div class="fixed inset-0 z-10 overflow-y-auto">
|
||||
<div class="flex min-h-full items-center justify-center p-4">
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<div
|
||||
onclick={stopPropagation(bubble('click'))}
|
||||
class={twMerge(
|
||||
'relative transform overflow-hidden rounded-md bg-surface px-4 pt-5 pb-4 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg sm:p-6',
|
||||
c,
|
||||
open
|
||||
? 'ease-out duration-300 opacity-100 translate-y-0 sm:scale-100'
|
||||
: 'ease-in duration-200 opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95'
|
||||
)}
|
||||
{style}
|
||||
{style}
|
||||
>
|
||||
{#if kind == 'X'}
|
||||
<div class="absolute top-4 right-4"><CloseButton on:close={() => (open = false)} /></div
|
||||
>
|
||||
{#if kind == 'X'}
|
||||
<div class="absolute top-4 right-4"
|
||||
><CloseButton on:close={() => (open = false)} /></div
|
||||
>
|
||||
{/if}
|
||||
<div class="flex">
|
||||
<div class="text-left flex-1">
|
||||
<div class="flex flex-row items-center justify-between">
|
||||
<h3 class="text-emphasis text-lg font-semibold">{title}</h3>
|
||||
{@render settings?.()}
|
||||
</div>
|
||||
|
||||
<div class="mt-4 text-sm text-primary">
|
||||
{@render children_render?.()}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="flex">
|
||||
<div class="text-left flex-1">
|
||||
<div class="flex flex-row items-center justify-between">
|
||||
<h3 class="text-emphasis text-lg font-semibold">{title}</h3>
|
||||
{@render settings?.()}
|
||||
</div>
|
||||
|
||||
<div class="mt-4 text-sm text-primary">
|
||||
{@render children?.()}
|
||||
</div>
|
||||
{#if kind == 'button'}
|
||||
<div
|
||||
class="flex items-center space-x-2 flex-row-reverse space-x-reverse mt-4"
|
||||
>
|
||||
{@render actions?.()}
|
||||
<Button
|
||||
on:click={() => {
|
||||
dispatch('canceled')
|
||||
open = false
|
||||
}}
|
||||
color="light"
|
||||
size="sm"
|
||||
>
|
||||
{cancelText ?? 'Cancel'}
|
||||
</Button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{#if kind == 'button'}
|
||||
<div class="flex items-center space-x-2 flex-row-reverse space-x-reverse mt-4">
|
||||
{@render actions?.()}
|
||||
<Button
|
||||
on:click={() => {
|
||||
dispatch('canceled')
|
||||
open = false
|
||||
}}
|
||||
color="light"
|
||||
size="sm"
|
||||
>
|
||||
{cancelText ?? 'Cancel'}
|
||||
</Button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/snippet}
|
||||
</Disposable>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
import { yamlStringifyExceptKeys } from './utils'
|
||||
import type { ChatCompletionMessageParam } from 'openai/resources/index.mjs'
|
||||
import { triggerableByAI } from '$lib/actions/triggerableByAI.svelte'
|
||||
import { getToolNameError } from '$lib/components/graph/renderers/nodes/AIToolNode.svelte'
|
||||
import { validateToolName } from '$lib/components/graph/renderers/nodes/AIToolNode.svelte'
|
||||
import {
|
||||
inputBaseClass,
|
||||
inputBorderClass,
|
||||
@@ -117,7 +117,6 @@ Generate a tool name for the script below:
|
||||
elementProps?: Record<string, any>
|
||||
class?: string
|
||||
onChange?: (content: string) => void
|
||||
siblingToolNames?: string[]
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -131,16 +130,9 @@ Generate a tool name for the script below:
|
||||
elementType = 'input',
|
||||
elementProps = {},
|
||||
class: clazz = '',
|
||||
onChange = undefined,
|
||||
siblingToolNames = undefined
|
||||
onChange = undefined
|
||||
}: Props = $props()
|
||||
|
||||
let toolNameError = $derived(
|
||||
promptConfigName === 'agentToolFunctionName'
|
||||
? getToolNameError(content ?? '', undefined, siblingToolNames)
|
||||
: undefined
|
||||
)
|
||||
|
||||
let el: HTMLElement | undefined = $state()
|
||||
let generatedContent = $state('')
|
||||
let active = $state(false)
|
||||
@@ -355,16 +347,16 @@ Generate a tool name for the script below:
|
||||
inputBaseClass,
|
||||
inputSizeClasses.md,
|
||||
inputBorderClass({
|
||||
error: !!toolNameError
|
||||
error: promptConfigName === 'agentToolFunctionName' && !validateToolName(content ?? '')
|
||||
}),
|
||||
'w-full'
|
||||
)}
|
||||
onfocus={() => (focused = true)}
|
||||
onblur={() => (focused = false)}
|
||||
/>
|
||||
{#if toolNameError}
|
||||
{#if promptConfigName === 'agentToolFunctionName' && !validateToolName(content ?? '')}
|
||||
<p class="text-3xs text-red-400 leading-tight mt-0.5">
|
||||
{toolNameError}
|
||||
Invalid tool name, should only contain letters, numbers and underscores
|
||||
</p>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
@@ -30,37 +30,11 @@
|
||||
fontClass?: string
|
||||
} = $props()
|
||||
|
||||
// Check if an originalType like "string | string[]" is a top-level
|
||||
// union where at least one member is an array type (ends with "[]").
|
||||
// Splits on "|" only at the top level (not inside {}, <>, or ()).
|
||||
function isUnionWithArray(originalType: string | undefined): boolean {
|
||||
if (!originalType) return false
|
||||
let depth = 0
|
||||
const parts: string[] = []
|
||||
let cur = ''
|
||||
for (const ch of originalType) {
|
||||
if (ch === '{' || ch === '<' || ch === '(') depth++
|
||||
else if (ch === '}' || ch === '>' || ch === ')') depth--
|
||||
else if (ch === '|' && depth === 0) {
|
||||
parts.push(cur.trim())
|
||||
cur = ''
|
||||
continue
|
||||
}
|
||||
cur += ch
|
||||
}
|
||||
parts.push(cur.trim())
|
||||
// Match TS array syntax (T[]) and Python list syntax (list[T] / List[T])
|
||||
return parts.length > 1 && parts.some((p) => p.endsWith('[]') || /^[Ll]ist\[.+\]$/.test(p))
|
||||
}
|
||||
|
||||
// Get list of arguments eligible for accumulation from schema.
|
||||
// Includes array-type arguments and union types like T | T[]
|
||||
// whose scalar values are wrapped into single-element arrays
|
||||
// at aggregation time.
|
||||
// Get list of array-type arguments from schema
|
||||
let arrayArgs = $derived(
|
||||
schema?.properties
|
||||
? Object.entries(schema.properties)
|
||||
.filter(([_, prop]) => prop.type === 'array' || isUnionWithArray(prop.originalType))
|
||||
.filter(([_, prop]) => prop.type === 'array')
|
||||
.map(([key, _]) => key)
|
||||
: []
|
||||
)
|
||||
@@ -137,8 +111,8 @@
|
||||
<Label label="Argument to accumulate (optional)">
|
||||
{#snippet header()}
|
||||
<Tooltip>
|
||||
Select a list-type argument to accumulate across debounced executions. Values from each
|
||||
debounced execution will be appended together.</Tooltip
|
||||
Select a list-type argument to accumulate across debounced executions. Values from
|
||||
each debounced execution will be appended together.</Tooltip
|
||||
>
|
||||
{/snippet}
|
||||
<select disabled={!$enterpriseLicense} bind:value={selectedArg}>
|
||||
@@ -157,8 +131,8 @@
|
||||
<Label label="Max total debouncing time (optional)">
|
||||
{#snippet header()}
|
||||
<Tooltip>
|
||||
Maximum total time (in seconds) that a job can be debounced before it must execute. Once
|
||||
this time is reached, the job will run regardless of ongoing debouncing.</Tooltip
|
||||
Maximum total time (in seconds) that a job can be debounced before it must execute.
|
||||
Once this time is reached, the job will run regardless of ongoing debouncing.</Tooltip
|
||||
>
|
||||
{/snippet}
|
||||
<SecondsInput disabled={!$enterpriseLicense} bind:seconds={max_total_debouncing_time} />
|
||||
@@ -166,16 +140,11 @@
|
||||
<Label label="Max total debounces amount (optional)">
|
||||
{#snippet header()}
|
||||
<Tooltip>
|
||||
Maximum number of times a job can be debounced before it must execute. Once this count
|
||||
is reached, the job will run regardless of ongoing debouncing.</Tooltip
|
||||
Maximum number of times a job can be debounced before it must execute. Once this
|
||||
count is reached, the job will run regardless of ongoing debouncing.</Tooltip
|
||||
>
|
||||
{/snippet}
|
||||
<input
|
||||
type="number"
|
||||
disabled={!$enterpriseLicense}
|
||||
bind:value={max_total_debounces_amount}
|
||||
min="0"
|
||||
/>
|
||||
<input type="number" disabled={!$enterpriseLicense} bind:value={max_total_debounces_amount} min="0" />
|
||||
</Label>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
action?: import('svelte').Snippet
|
||||
children?: import('svelte').Snippet
|
||||
isAgentTool?: boolean
|
||||
siblingToolNames?: string[]
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -24,8 +23,7 @@
|
||||
header,
|
||||
action,
|
||||
children,
|
||||
isAgentTool = false,
|
||||
siblingToolNames = undefined
|
||||
isAgentTool = false
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
@@ -40,7 +38,6 @@
|
||||
{flowModuleValue}
|
||||
{action}
|
||||
{isAgentTool}
|
||||
{siblingToolNames}
|
||||
>
|
||||
{@render header?.()}
|
||||
</FlowCardHeader>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
import { Flag, Lock, RefreshCw, Unlock } from 'lucide-svelte'
|
||||
import { createEventDispatcher, untrack } from 'svelte'
|
||||
import { twMerge } from 'tailwind-merge'
|
||||
import { getToolNameError } from '$lib/components/graph/renderers/nodes/AIToolNode.svelte'
|
||||
import { validateToolName } from '$lib/components/graph/renderers/nodes/AIToolNode.svelte'
|
||||
import { DEFAULT_HUB_BASE_URL, PRIVATE_HUB_MIN_VERSION } from '$lib/hub'
|
||||
|
||||
interface Props {
|
||||
@@ -28,7 +28,6 @@
|
||||
children?: import('svelte').Snippet
|
||||
action?: import('svelte').Snippet
|
||||
isAgentTool?: boolean
|
||||
siblingToolNames?: string[]
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -37,14 +36,9 @@
|
||||
summary = $bindable(undefined),
|
||||
children,
|
||||
action,
|
||||
isAgentTool = false,
|
||||
siblingToolNames = undefined
|
||||
isAgentTool = false
|
||||
}: Props = $props()
|
||||
|
||||
let toolNameError = $derived(
|
||||
isAgentTool ? getToolNameError(summary ?? '', undefined, siblingToolNames) : undefined
|
||||
)
|
||||
|
||||
let latestHash: string | undefined = $state(undefined)
|
||||
|
||||
// Extract version_id from hub path (format: hub/{version_id}/{app}/{summary})
|
||||
@@ -109,7 +103,6 @@
|
||||
elementProps={{
|
||||
placeholder: isAgentTool ? 'Tool name' : 'Summary'
|
||||
}}
|
||||
{siblingToolNames}
|
||||
/>
|
||||
{:else if flowModuleValue.type === 'script' && 'path' in flowModuleValue && flowModuleValue.path}
|
||||
<IconedPath path={flowModuleValue.path} hash={flowModuleValue.hash} class="grow" />
|
||||
@@ -180,16 +173,14 @@
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="flex flex-col w-full grow">
|
||||
<input
|
||||
bind:value={summary}
|
||||
placeholder={isAgentTool ? 'Tool name' : 'Summary'}
|
||||
class={twMerge('w-full grow', toolNameError && '!border-red-400')}
|
||||
/>
|
||||
{#if toolNameError}
|
||||
<p class="text-3xs text-red-400 leading-tight mt-0.5">{toolNameError}</p>
|
||||
{/if}
|
||||
</div>
|
||||
<input
|
||||
bind:value={summary}
|
||||
placeholder={isAgentTool ? 'Tool name' : 'Summary'}
|
||||
class={twMerge(
|
||||
'w-full grow',
|
||||
isAgentTool && !validateToolName(summary ?? '') && '!border-red-400'
|
||||
)}
|
||||
/>
|
||||
{:else if flowModuleValue.type === 'flow'}
|
||||
<Badge color="indigo" capitalize>flow</Badge>
|
||||
<input bind:value={summary} placeholder="Summary" class="w-full grow" />
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
previousModule?: FlowModule | undefined
|
||||
forceTestTab?: Record<string, boolean>
|
||||
highlightArg?: Record<string, string | undefined>
|
||||
siblingToolNames?: string[]
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -24,8 +23,7 @@
|
||||
parentModule = undefined,
|
||||
previousModule = undefined,
|
||||
forceTestTab,
|
||||
highlightArg,
|
||||
siblingToolNames = undefined
|
||||
highlightArg
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
@@ -45,7 +43,6 @@
|
||||
forceTestTab={forceTestTab?.[tool.id]}
|
||||
highlightArg={highlightArg?.[tool.id]}
|
||||
isAgentTool={true}
|
||||
{siblingToolNames}
|
||||
/>
|
||||
{:else if isMcpTool(tool)}
|
||||
<!-- MCP tool - use McpToolEditor -->
|
||||
|
||||
@@ -101,7 +101,9 @@
|
||||
)
|
||||
let canMoveSelected = $derived(
|
||||
resolvedModuleIds.length > 0 &&
|
||||
areContiguousSiblings(locateModules(resolvedModuleIds, flowStore.val.value.modules ?? []))
|
||||
areContiguousSiblings(
|
||||
locateModules(resolvedModuleIds, flowStore.val.value.modules ?? [])
|
||||
)
|
||||
)
|
||||
</script>
|
||||
|
||||
|
||||
@@ -110,7 +110,6 @@
|
||||
forceTestTab?: boolean
|
||||
highlightArg?: string
|
||||
isAgentTool?: boolean
|
||||
siblingToolNames?: string[]
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -126,8 +125,7 @@
|
||||
savedModule = undefined,
|
||||
forceTestTab = false,
|
||||
highlightArg = undefined,
|
||||
isAgentTool = false,
|
||||
siblingToolNames = undefined
|
||||
isAgentTool = false
|
||||
}: Props = $props()
|
||||
|
||||
let workspaceScriptTag: string | undefined = $state(undefined)
|
||||
@@ -239,9 +237,7 @@
|
||||
}
|
||||
|
||||
let forceReload = $state(0)
|
||||
let editorPanelSize = $state(
|
||||
untrack(() => noEditor) ? 0 : flowModule.value.type == 'script' ? 30 : 50
|
||||
)
|
||||
let editorPanelSize = $state(untrack(() => noEditor) ? 0 : flowModule.value.type == 'script' ? 30 : 50)
|
||||
let editorSettingsPanelSize = $state(100 - untrack(() => editorPanelSize))
|
||||
let stepHistoryLoader = getStepHistoryLoaderContext()
|
||||
|
||||
@@ -730,7 +726,6 @@
|
||||
}}
|
||||
bind:summary={flowModule.summary}
|
||||
{isAgentTool}
|
||||
{siblingToolNames}
|
||||
>
|
||||
{#snippet header()}
|
||||
<FlowModuleHeader
|
||||
@@ -1067,8 +1062,8 @@
|
||||
{enableAi}
|
||||
{isAgentTool}
|
||||
allowedAiTransforms={isAgentTool && flowModule.value.type === 'aiagent'
|
||||
? ['user_message']
|
||||
: undefined}
|
||||
? ['user_message']
|
||||
: undefined}
|
||||
helperScript={retrieveDynCodeAndLang(flowModule.value)}
|
||||
chatInputEnabled={flowStore.val.value?.chat_input_enabled ?? false}
|
||||
/>
|
||||
|
||||
@@ -305,7 +305,6 @@
|
||||
{enableAi}
|
||||
{forceTestTab}
|
||||
{highlightArg}
|
||||
siblingToolNames={flowModule.value.tools.map((t) => t.summary ?? '')}
|
||||
/>
|
||||
{/if}
|
||||
{/each}
|
||||
|
||||
@@ -300,7 +300,6 @@ export type AiToolN = {
|
||||
data: {
|
||||
tool: string
|
||||
type?: string
|
||||
nameError?: string
|
||||
eventHandlers: GraphEventHandlers
|
||||
moduleId: string
|
||||
insertable: boolean
|
||||
|
||||
@@ -1,29 +1,10 @@
|
||||
<script module lang="ts">
|
||||
import { forbiddenIds } from '$lib/components/flows/idUtils'
|
||||
|
||||
export function getToolNameError(
|
||||
name: string,
|
||||
type?: string,
|
||||
siblingNames?: string[]
|
||||
): string | undefined {
|
||||
if (type === 'websearch') return undefined
|
||||
if (type === 'mcp') {
|
||||
return name.length > 0 ? undefined : 'Tool name must not be empty'
|
||||
}
|
||||
if (!/^[a-zA-Z0-9_]+$/.test(name)) {
|
||||
return 'Tool name must only contain letters, numbers and underscores'
|
||||
}
|
||||
if (forbiddenIds.includes(name)) {
|
||||
return `'${name}' is a reserved name`
|
||||
}
|
||||
if (siblingNames && siblingNames.filter((n) => n === name).length > 1) {
|
||||
return 'Duplicate tool name'
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
export function validateToolName(name: string, type?: string) {
|
||||
return getToolNameError(name, type) === undefined
|
||||
if (type === 'websearch') return true
|
||||
if (type === 'mcp') {
|
||||
return name.length > 0
|
||||
}
|
||||
return /^[a-zA-Z0-9_]+$/.test(name)
|
||||
}
|
||||
|
||||
export const AI_TOOL_BASE_OFFSET = 5
|
||||
@@ -166,7 +147,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
const siblingNames = tools.map((t) => t.name)
|
||||
const toolNodes: (Node & AiToolN)[] = tools.map((tool, i) => {
|
||||
let inputToolXGap = 12
|
||||
let inputToolWidth = (ROW_WIDTH - inputToolXGap) / 2
|
||||
@@ -180,7 +160,6 @@
|
||||
data: {
|
||||
tool: tool.name,
|
||||
type: tool.type,
|
||||
nameError: getToolNameError(tool.name, tool.type, siblingNames),
|
||||
eventHandlers,
|
||||
moduleId: tool.id,
|
||||
insertable,
|
||||
@@ -190,13 +169,13 @@
|
||||
width: inputToolWidth,
|
||||
position: {
|
||||
x:
|
||||
tools.length === 1
|
||||
(tools.length === 1
|
||||
? (ROW_WIDTH - inputToolWidth) / 2
|
||||
: (i + 1) % 2 === 0
|
||||
? inputToolWidth + inputToolXGap
|
||||
: isLastRow && tools.length % 2 === 1
|
||||
? (ROW_WIDTH - inputToolWidth) / 2
|
||||
: 0,
|
||||
: 0),
|
||||
y:
|
||||
baseOffset +
|
||||
rowOffset *
|
||||
@@ -308,7 +287,7 @@
|
||||
const flowModuleState = $derived(data.flowModuleStates?.[data.moduleId])
|
||||
let colorClasses = $derived(
|
||||
getNodeColorClasses(
|
||||
data.nameError ? 'Failure' : flowModuleState?.type,
|
||||
!validateToolName(data.tool, data.type) ? 'Failure' : flowModuleState?.type,
|
||||
selectionManager?.getSelectedId() === data.moduleId
|
||||
)
|
||||
)
|
||||
@@ -345,7 +324,12 @@
|
||||
<Wrench size={16} class="ml-1 shrink-0" />
|
||||
{/if}
|
||||
|
||||
<span class={twMerge('text-3xs truncate flex-1', data.nameError && 'text-red-400')}>
|
||||
<span
|
||||
class={twMerge(
|
||||
'text-3xs truncate flex-1',
|
||||
!validateToolName(data.tool, data.type) && 'text-red-400'
|
||||
)}
|
||||
>
|
||||
{data.tool || 'Missing name'}
|
||||
</span>
|
||||
</button>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy'
|
||||
import { run } from 'svelte/legacy';
|
||||
|
||||
import { FlowService, ScriptService, UserService, type TruncatedToken } from '$lib/gen'
|
||||
import { userStore, workspaceStore } from '$lib/stores'
|
||||
@@ -10,21 +10,23 @@
|
||||
import { capitalize } from '$lib/utils'
|
||||
|
||||
interface Props {
|
||||
isFlow: boolean
|
||||
path: string
|
||||
labelPrefix: 'email' | 'webhook'
|
||||
isFlow: boolean;
|
||||
path: string;
|
||||
labelPrefix: 'email' | 'webhook';
|
||||
}
|
||||
|
||||
let { isFlow, path, labelPrefix }: Props = $props()
|
||||
let { isFlow, path, labelPrefix }: Props = $props();
|
||||
|
||||
const { triggersCount } = getContext<TriggerContext>('TriggerContext')
|
||||
|
||||
let tokens: TruncatedToken[] | undefined = $state(undefined)
|
||||
|
||||
export async function listTokens() {
|
||||
tokens = isFlow
|
||||
? await FlowService.listTokensOfFlow({ workspace: $workspaceStore!, path })
|
||||
: await ScriptService.listTokensOfScript({ workspace: $workspaceStore!, path })
|
||||
tokens = (
|
||||
isFlow
|
||||
? await FlowService.listTokensOfFlow({ workspace: $workspaceStore!, path })
|
||||
: await ScriptService.listTokensOfScript({ workspace: $workspaceStore!, path })
|
||||
).filter((x) => x.label && x.label.startsWith(labelPrefix + '-'))
|
||||
if (labelPrefix == 'email') {
|
||||
$triggersCount = { ...($triggersCount ?? {}), default_email_count: tokens?.length }
|
||||
} else {
|
||||
@@ -41,14 +43,14 @@
|
||||
|
||||
run(() => {
|
||||
$workspaceStore && listTokens()
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col gap-2">
|
||||
<Label label="Existing {capitalize(labelPrefix)} Tokens">
|
||||
{#if tokens}
|
||||
{#if tokens.length == 0}
|
||||
<div class="text-xs text-secondary">No tokens with matching scopes found</div>
|
||||
<div class="text-xs text-secondary">No {labelPrefix} specific tokens found</div>
|
||||
{:else}
|
||||
<div class="flex flex-col divide-y pt-2">
|
||||
<div class="grid grid-cols-6 text-2xs items-center py-2">
|
||||
|
||||
@@ -105,17 +105,17 @@ async function initWasmAsset() {
|
||||
|
||||
type InferAssetsResult =
|
||||
| {
|
||||
status: 'ok'
|
||||
assets: AssetWithAccessType[]
|
||||
sql_queries?: InferAssetsSqlQueryDetails[]
|
||||
columns?: Record<string, AssetUsageAccessType>
|
||||
}
|
||||
status: 'ok'
|
||||
assets: AssetWithAccessType[]
|
||||
sql_queries?: InferAssetsSqlQueryDetails[]
|
||||
columns?: Record<string, AssetUsageAccessType>
|
||||
}
|
||||
| {
|
||||
status: 'error'
|
||||
error: string
|
||||
assets?: undefined
|
||||
sql_queries?: undefined
|
||||
}
|
||||
status: 'error'
|
||||
error: string
|
||||
assets?: undefined
|
||||
sql_queries?: undefined
|
||||
}
|
||||
|
||||
export type InferAssetsSqlQueryDetails = {
|
||||
query_string: string // SQL query with $1 placeholders for interpolations
|
||||
@@ -384,11 +384,6 @@ export async function inferArgs(
|
||||
|
||||
argSigToJsonSchemaType(arg.typ, schema.properties[arg.name])
|
||||
|
||||
// For T | T[] detection for debouncing arg accumulation
|
||||
if ((arg as any).otyp && (arg as any).otyp.includes('[') && (arg as any).otyp.includes('|')) {
|
||||
schema.properties[arg.name].originalType = (arg as any).otyp
|
||||
}
|
||||
|
||||
schema.properties[arg.name].default = arg.default
|
||||
|
||||
if (!arg.has_default && !schema.required.includes(arg.name)) {
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.656.0
|
||||
1.655.0
|
||||
|
||||
Reference in New Issue
Block a user