Compare commits

...
7 Commits
Author SHA1 Message Date
Ruben Fiszelandrubenfiszel 03519f5cac chore(main): release 1.332.1 (#3766)
* chore(main): release 1.332.1

* Apply automatic changes

---------

Co-authored-by: rubenfiszel <rubenfiszel@users.noreply.github.com>
2024-05-18 10:12:45 +02:00
Ruben Fiszel 32bf061627 fix(cli): improve handling of schema for script bundles 2024-05-18 10:00:19 +02:00
HugoCasaandellipsis-dev[bot] f0b3527e53 fix(frontend): improve json display for large table objects (#3765)
* fix(frontend): fix check for displaying table-col

* fix: improve display result json limit for tables

* fix: nit

* Update frontend/src/lib/components/DisplayResult.svelte

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* fix: nit

---------

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
2024-05-17 18:45:13 +02:00
Ruben Fiszel ed54974ebd chore: fix tag_latest to wait for build 2024-05-17 01:05:50 +02:00
Ruben Fiszelandrubenfiszel 583e132da9 chore(main): release 1.332.0 (#3755)
* chore(main): release 1.332.0

* Apply automatic changes

---------

Co-authored-by: rubenfiszel <rubenfiszel@users.noreply.github.com>
2024-05-17 00:35:22 +02:00
Faton RamadaniandRuben Fiszel e11a3751c3 feat(frontend): Fix App Select component initial value (#3752)
* feat(frontend): Fix App Select component initial value

* Update AppSelect.svelte

---------

Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
2024-05-17 00:31:32 +02:00
Ruben Fiszel 2b06d9ae79 fix: fix args interpolation for tag and concurrency key for non string values 2024-05-17 00:27:38 +02:00
24 changed files with 291 additions and 229 deletions
+2 -2
View File
@@ -415,7 +415,7 @@ jobs:
tag_latest:
runs-on: ubicloud
needs: [run_integration_test]
needs: [run_integration_test, build]
steps:
- uses: actions/checkout@v3
with:
@@ -433,7 +433,7 @@ jobs:
tag_latest_ee:
runs-on: ubicloud
needs: [run_integration_test]
needs: [run_integration_test, build_ee]
steps:
- uses: actions/checkout@v3
with:
+20
View File
@@ -1,5 +1,25 @@
# Changelog
## [1.332.1](https://github.com/windmill-labs/windmill/compare/v1.332.0...v1.332.1) (2024-05-18)
### Bug Fixes
* **cli:** improve handling of schema for script bundles ([32bf061](https://github.com/windmill-labs/windmill/commit/32bf061627f087e1ec4e88a3e03be0ca1b7fa9f7))
* **frontend:** improve json display for large table objects ([#3765](https://github.com/windmill-labs/windmill/issues/3765)) ([f0b3527](https://github.com/windmill-labs/windmill/commit/f0b3527e53e077f9c9ab4c9c6373f35cee77e566))
## [1.332.0](https://github.com/windmill-labs/windmill/compare/v1.331.2...v1.332.0) (2024-05-16)
### Features
* **frontend:** Fix App Select component initial value ([#3752](https://github.com/windmill-labs/windmill/issues/3752)) ([e11a375](https://github.com/windmill-labs/windmill/commit/e11a3751c3d188522360010a03e1fbc92311f554))
### Bug Fixes
* fix args interpolation for tag and concurrency key for non string values ([2b06d9a](https://github.com/windmill-labs/windmill/commit/2b06d9ae793f9e5fddee4ca0889634429ff53416))
## [1.331.2](https://github.com/windmill-labs/windmill/compare/v1.331.1...v1.331.2) (2024-05-16)
+44 -44
View File
@@ -170,9 +170,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.83"
version = "1.0.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3"
checksum = "27a4bd113ab6da4cd0f521068a6e2ee1065eab54107266a11835d02c8ec86a37"
[[package]]
name = "archiver-rs"
@@ -2521,9 +2521,9 @@ dependencies = [
[[package]]
name = "either"
version = "1.11.0"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2"
checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b"
dependencies = [
"serde",
]
@@ -3328,15 +3328,15 @@ dependencies = [
[[package]]
name = "h2"
version = "0.4.4"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069"
checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab"
dependencies = [
"atomic-waker",
"bytes",
"fnv",
"futures-core",
"futures-sink",
"futures-util",
"http 1.1.0",
"indexmap 2.2.6",
"slab",
@@ -3610,7 +3610,7 @@ dependencies = [
"bytes",
"futures-channel",
"futures-util",
"h2 0.4.4",
"h2 0.4.5",
"http 1.1.0",
"http-body 1.0.0",
"httparse",
@@ -3784,9 +3784,9 @@ dependencies = [
[[package]]
name = "instant"
version = "0.1.12"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222"
dependencies = [
"cfg-if",
]
@@ -3962,9 +3962,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "libc"
version = "0.2.154"
version = "0.2.155"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346"
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
[[package]]
name = "libgit2-sys"
@@ -4046,9 +4046,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
[[package]]
name = "linux-raw-sys"
version = "0.4.13"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
[[package]]
name = "lock_api"
@@ -4336,9 +4336,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "miniz_oxide"
version = "0.7.2"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7"
checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae"
dependencies = [
"adler",
]
@@ -4469,9 +4469,9 @@ dependencies = [
[[package]]
name = "mysql_common"
version = "0.32.2"
version = "0.32.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ccdc1fe2bb3ef97e07ba4397327ed45509a1e2e499e2f8265243879cbc7313c"
checksum = "d1e52cf194ab414202ead9dfda216d2a9ec59cc97ac024ba499ca686d82f040d"
dependencies = [
"base64 0.21.7",
"bigdecimal 0.4.3",
@@ -6360,7 +6360,7 @@ dependencies = [
"encoding_rs",
"futures-core",
"futures-util",
"h2 0.4.4",
"h2 0.4.5",
"http 1.1.0",
"http-body 1.0.0",
"http-body-util",
@@ -6641,7 +6641,7 @@ dependencies = [
"bitflags 2.5.0",
"errno",
"libc",
"linux-raw-sys 0.4.13",
"linux-raw-sys 0.4.14",
"windows-sys 0.52.0",
]
@@ -8400,18 +8400,18 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.60"
version = "1.0.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "579e9083ca58dd9dcf91a9923bb9054071b9ebbd800b342194c9feb0ee89fc18"
checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.60"
version = "1.0.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524"
checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
dependencies = [
"proc-macro2",
"quote",
@@ -9688,7 +9688,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windmill"
version = "1.331.2"
version = "1.332.1"
dependencies = [
"anyhow",
"axum",
@@ -9726,7 +9726,7 @@ dependencies = [
[[package]]
name = "windmill-api"
version = "1.331.2"
version = "1.332.1"
dependencies = [
"anyhow",
"argon2",
@@ -9802,7 +9802,7 @@ dependencies = [
[[package]]
name = "windmill-api-client"
version = "1.331.2"
version = "1.332.1"
dependencies = [
"base64 0.21.7",
"chrono",
@@ -9820,7 +9820,7 @@ dependencies = [
[[package]]
name = "windmill-audit"
version = "1.331.2"
version = "1.332.1"
dependencies = [
"chrono",
"serde",
@@ -9833,7 +9833,7 @@ dependencies = [
[[package]]
name = "windmill-common"
version = "1.331.2"
version = "1.332.1"
dependencies = [
"anyhow",
"aws-config",
@@ -9871,7 +9871,7 @@ dependencies = [
[[package]]
name = "windmill-git-sync"
version = "1.331.2"
version = "1.332.1"
dependencies = [
"regex",
"rsmq_async",
@@ -9886,7 +9886,7 @@ dependencies = [
[[package]]
name = "windmill-parser"
version = "1.331.2"
version = "1.332.1"
dependencies = [
"serde",
"serde_json",
@@ -9894,7 +9894,7 @@ dependencies = [
[[package]]
name = "windmill-parser-bash"
version = "1.331.2"
version = "1.332.1"
dependencies = [
"anyhow",
"lazy_static",
@@ -9905,7 +9905,7 @@ dependencies = [
[[package]]
name = "windmill-parser-go"
version = "1.331.2"
version = "1.332.1"
dependencies = [
"anyhow",
"gosyn",
@@ -9917,7 +9917,7 @@ dependencies = [
[[package]]
name = "windmill-parser-graphql"
version = "1.331.2"
version = "1.332.1"
dependencies = [
"anyhow",
"lazy_static",
@@ -9928,7 +9928,7 @@ dependencies = [
[[package]]
name = "windmill-parser-php"
version = "1.331.2"
version = "1.332.1"
dependencies = [
"anyhow",
"convert_case 0.6.0",
@@ -9942,7 +9942,7 @@ dependencies = [
[[package]]
name = "windmill-parser-py"
version = "1.331.2"
version = "1.332.1"
dependencies = [
"anyhow",
"itertools 0.13.0",
@@ -9953,7 +9953,7 @@ dependencies = [
[[package]]
name = "windmill-parser-py-imports"
version = "1.331.2"
version = "1.332.1"
dependencies = [
"anyhow",
"async-recursion",
@@ -9970,7 +9970,7 @@ dependencies = [
[[package]]
name = "windmill-parser-sql"
version = "1.331.2"
version = "1.332.1"
dependencies = [
"anyhow",
"lazy_static",
@@ -9981,7 +9981,7 @@ dependencies = [
[[package]]
name = "windmill-parser-ts"
version = "1.331.2"
version = "1.332.1"
dependencies = [
"anyhow",
"convert_case 0.6.0",
@@ -9999,7 +9999,7 @@ dependencies = [
[[package]]
name = "windmill-parser-wasm"
version = "1.331.2"
version = "1.332.1"
dependencies = [
"anyhow",
"getrandom 0.2.15",
@@ -10018,7 +10018,7 @@ dependencies = [
[[package]]
name = "windmill-queue"
version = "1.331.2"
version = "1.332.1"
dependencies = [
"anyhow",
"async-recursion",
@@ -10051,7 +10051,7 @@ dependencies = [
[[package]]
name = "windmill-sql-datatype-parser-wasm"
version = "1.331.2"
version = "1.332.1"
dependencies = [
"serde",
"wasm-bindgen",
@@ -10062,7 +10062,7 @@ dependencies = [
[[package]]
name = "windmill-worker"
version = "1.331.2"
version = "1.332.1"
dependencies = [
"anyhow",
"async-recursion",
@@ -10342,7 +10342,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f"
dependencies = [
"libc",
"linux-raw-sys 0.4.13",
"linux-raw-sys 0.4.14",
"rustix 0.38.34",
]
+2 -2
View File
@@ -1,6 +1,6 @@
[package]
name = "windmill"
version = "1.331.2"
version = "1.332.1"
authors.workspace = true
edition.workspace = true
@@ -24,7 +24,7 @@ members = [
]
[workspace.package]
version = "1.331.2"
version = "1.332.1"
authors = ["Ruben Fiszel <ruben@windmill.dev>"]
edition = "2021"
+1 -1
View File
@@ -1,7 +1,7 @@
openapi: "3.0.3"
info:
version: 1.331.2
version: 1.332.1
title: Windmill API
contact:
+3 -2
View File
@@ -2046,9 +2046,10 @@ fn interpolate_args<T: Serialize>(
let arg_name = cap.get(1).unwrap().as_str();
let arg_value = value
.get(arg_name)
.and_then(|x| x.as_str())
.map(|x| serde_json::to_string(x).unwrap_or_default())
.unwrap_or_default();
interpolated = interpolated.replace(format!("$args[{}]", arg_name).as_str(), arg_value);
interpolated =
interpolated.replace(format!("$args[{}]", arg_name).as_str(), &arg_value);
}
interpolated
} else {
+1 -1
View File
@@ -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.331.2";
export const VERSION = "v1.332.1";
export async function login(email: string, password: string): Promise<string> {
return await windmill.UserService.login({
+1 -1
View File
@@ -33,7 +33,7 @@ addEventListener("error", (event) => {
}
});
export const VERSION = "v1.331.2";
export const VERSION = "v1.332.1";
let command: any = new Command()
.name("wmill")
+53 -36
View File
@@ -24,8 +24,9 @@ import { SchemaProperty } from "./bootstrap/common.ts";
import { ScriptLanguage } from "./script_common.ts";
import { inferContentTypeFromFilePath } from "./script_common.ts";
import { GlobalDeps } from "./script.ts";
import { yamlOptions } from "./sync.ts";
import { findCodebase, yamlOptions } from "./sync.ts";
import { generateHash } from "./utils.ts";
import { SyncCodebase } from "./codebase.ts";
export async function generateAllMetadata() {}
@@ -77,7 +78,8 @@ export async function generateMetadataInternal(
},
dryRun: boolean,
noStaleMessage: boolean,
globalDeps: GlobalDeps
globalDeps: GlobalDeps,
codebases: SyncCodebase[]
): Promise<string | undefined> {
const remotePath = scriptPath
.substring(0, scriptPath.indexOf("."))
@@ -100,7 +102,8 @@ export async function generateMetadataInternal(
const metadataWithType = await parseMetadataFile(
remotePath,
undefined,
globalDeps
globalDeps,
codebases
);
// read script content
@@ -138,7 +141,9 @@ export async function generateMetadataInternal(
);
}
if (!opts.schemaOnly) {
const c = findCodebase(scriptPath, codebases);
if (!opts.schemaOnly && !c) {
await updateScriptLock(
workspace,
scriptContent,
@@ -163,7 +168,7 @@ export async function generateMetadataInternal(
return `${remotePath} (${language})`;
}
async function updateScriptSchema(
export async function updateScriptSchema(
scriptContent: string,
language: ScriptLanguage,
metadataContent: Record<string, any>,
@@ -355,8 +360,8 @@ function sortObject(obj: any): any {
);
}
function argSigToJsonSchemaType(
typ:
export function argSigToJsonSchemaType(
t:
| string
| { resource: string | null }
| {
@@ -371,55 +376,55 @@ function argSigToJsonSchemaType(
oldS: SchemaProperty
): void {
const newS: SchemaProperty = { type: "" };
if (typ === "int") {
if (t === "int") {
newS.type = "integer";
} else if (typ === "float") {
} else if (t === "float") {
newS.type = "number";
} else if (typ === "bool") {
} else if (t === "bool") {
newS.type = "boolean";
} else if (typ === "email") {
} else if (t === "email") {
newS.type = "string";
newS.format = "email";
} else if (typ === "sql") {
} else if (t === "sql") {
newS.type = "string";
newS.format = "sql";
} else if (typ === "yaml") {
} else if (t === "yaml") {
newS.type = "string";
newS.format = "yaml";
} else if (typ === "bytes") {
} else if (t === "bytes") {
newS.type = "string";
newS.contentEncoding = "base64";
} else if (typ === "datetime") {
} else if (t === "datetime") {
newS.type = "string";
newS.format = "date-time";
} else if (typeof typ !== "string" && `object` in typ) {
} else if (typeof t !== "string" && `object` in t) {
newS.type = "object";
if (typ.object) {
const properties: Record<string, SchemaProperty> = {};
for (const prop of typ.object) {
properties[prop.key] = { type: undefined };
if (t.object) {
const properties: Record<string, any> = {};
for (const prop of t.object) {
properties[prop.key] = {};
argSigToJsonSchemaType(prop.typ, properties[prop.key]);
}
newS.properties = properties;
}
} else if (typeof typ !== "string" && `str` in typ) {
} else if (typeof t !== "string" && `str` in t) {
newS.type = "string";
if (typ.str) {
newS.enum = typ.str;
if (t.str) {
newS.enum = t.str;
}
} else if (typeof typ !== "string" && `resource` in typ) {
} else if (typeof t !== "string" && `resource` in t) {
newS.type = "object";
newS.format = `resource-${typ.resource}`;
} else if (typeof typ !== "string" && `list` in typ) {
newS.format = `resource-${t.resource}`;
} else if (typeof t !== "string" && `list` in t) {
newS.type = "array";
if (typ.list === "int" || typ.list === "float") {
if (t.list === "int" || t.list === "float") {
newS.items = { type: "number" };
} else if (typ.list === "bytes") {
} else if (t.list === "bytes") {
newS.items = { type: "string", contentEncoding: "base64" };
} else if (typ.list == "string") {
} else if (t.list == "string") {
newS.items = { type: "string" };
} else if (typ.list && typeof typ.list == "object" && "str" in typ.list) {
newS.items = { type: "string", enum: typ.list.str };
} else if (t.list && typeof t.list == "object" && "str" in t.list) {
newS.items = { type: "string", enum: t.list.str };
} else {
newS.items = { type: "object" };
}
@@ -430,17 +435,27 @@ function argSigToJsonSchemaType(
if (oldS.type != newS.type) {
for (const prop of Object.getOwnPropertyNames(newS)) {
if (prop != "description") {
// @ts-ignore: fix
delete oldS[prop];
}
}
} else if (oldS.format == "date-time" && newS.format != "date-time") {
delete oldS.format;
} else if (
(oldS.format == "date" || oldS.format === "date-time") &&
newS.format == "string"
) {
newS.format = oldS.format;
} else if (newS.format == "date-time" && oldS.format == "date") {
newS.format = "date";
} else if (oldS.items?.type != newS.items?.type) {
delete oldS.items;
}
Object.assign(oldS, newS);
// if (sameItems && savedItems != undefined && savedItems.enum != undefined) {
// sendUserToast(JSON.stringify(savedItems))
// oldS.items = savedItems
// }
if (oldS.format?.startsWith("resource-") && newS.type != "object") {
oldS.format = undefined;
}
@@ -474,7 +489,8 @@ export async function parseMetadataFile(
schemaOnly?: boolean;
})
| undefined,
globalDeps: GlobalDeps
globalDeps: GlobalDeps,
codebases: SyncCodebase[]
): Promise<{ isJson: boolean; payload: any; path: string }> {
let metadataFilePath = scriptPath + ".script.json";
try {
@@ -522,7 +538,8 @@ export async function parseMetadataFile(
generateMetadataIfMissing,
false,
false,
globalDeps
globalDeps,
codebases
);
scriptInitialMetadata = yamlParse(
await Deno.readTextFile(metadataFilePath)
+42 -16
View File
@@ -1,5 +1,5 @@
// deno-lint-ignore-file no-explicit-any
import { GlobalOptions } from "./types.ts";
import { GlobalOptions, showDiff } from "./types.ts";
import { requireLogin, resolveWorkspace, validatePath } from "./context.ts";
import {
colors,
@@ -21,7 +21,11 @@ import {
} from "./bootstrap/script_bootstrap.ts";
import { Workspace } from "./workspace.ts";
import { generateMetadataInternal, parseMetadataFile } from "./metadata.ts";
import {
generateMetadataInternal,
parseMetadataFile,
updateScriptSchema,
} from "./metadata.ts";
import {
ScriptLanguage,
inferContentTypeFromFilePath,
@@ -74,7 +78,7 @@ async function push(opts: PushOptions, filePath: string) {
await requireLogin(opts);
const codebases = await listSyncCodebases(opts as SyncOptions);
const globalDeps = await findGlobalDeps(codebases);
const globalDeps = await findGlobalDeps();
await handleFile(
filePath,
workspace,
@@ -169,7 +173,8 @@ export async function handleFile(
schemaOnly: codebase ? true : undefined,
}
: undefined,
globalDeps
globalDeps,
codebases
)
)?.payload;
@@ -187,6 +192,22 @@ export async function handleFile(
}
const content = await Deno.readTextFile(path);
if (codebase) {
const typedBefore = JSON.parse(JSON.stringify(typed.schema));
await updateScriptSchema(content, language, typed, path);
if (typedBefore != typed.schema) {
log.info(`Updated metadata for bundle ${path}`);
showDiff(
yamlStringify(typedBefore, yamlOptions),
yamlStringify(typed.schema, yamlOptions)
);
await Deno.writeTextFile(
remotePath + ".script.yaml",
yamlStringify(typed as Record<string, any>, yamlOptions)
);
}
}
const requestBodyCommon = {
content,
description: typed?.description ?? "",
@@ -662,12 +683,16 @@ async function bootstrap(
yamlOptions
);
Deno.writeTextFile(scriptCodeFileFullPath, scriptInitialCode, {
createNew: true,
});
Deno.writeTextFile(scriptMetadataFileFullPath, scriptInitialMetadataYaml, {
await Deno.writeTextFile(scriptCodeFileFullPath, scriptInitialCode, {
createNew: true,
});
await Deno.writeTextFile(
scriptMetadataFileFullPath,
scriptInitialMetadataYaml,
{
createNew: true,
}
);
}
export type GlobalDeps = {
@@ -675,13 +700,11 @@ export type GlobalDeps = {
reqs: Record<string, string>;
composers: Record<string, string>;
};
export async function findGlobalDeps(
codebases: SyncCodebase[]
): Promise<GlobalDeps> {
export async function findGlobalDeps(): Promise<GlobalDeps> {
const pkgs: { [key: string]: string } = {};
const reqs: { [key: string]: string } = {};
const composers: { [key: string]: string } = {};
const els = await FSFSElement(Deno.cwd(), codebases);
const els = await FSFSElement(Deno.cwd(), []);
for await (const entry of readDirRecursiveWithIgnore((p, isDir) => {
p = "/" + p;
return (
@@ -725,7 +748,7 @@ async function generateMetadata(
opts = await mergeConfigWithConfigFile(opts);
const codebases = await listSyncCodebases(opts);
const globalDeps = await findGlobalDeps(codebases);
const globalDeps = await findGlobalDeps();
if (scriptPath) {
// read script metadata file
await generateMetadataInternal(
@@ -734,7 +757,8 @@ async function generateMetadata(
opts,
false,
false,
globalDeps
globalDeps,
codebases
);
} else {
const ignore = await ignoreF(opts);
@@ -760,7 +784,8 @@ async function generateMetadata(
opts,
true,
true,
globalDeps
globalDeps,
codebases
);
if (candidate) {
hasAny = true;
@@ -788,7 +813,8 @@ async function generateMetadata(
opts,
false,
true,
globalDeps
globalDeps,
codebases
);
}
}
+42 -31
View File
@@ -266,7 +266,7 @@ function ZipFSElement(zip: JSZip, useYaml: boolean): DynFSElement {
const r = [{ path: path, content: content }];
m.value.content = "!inline " + path;
const lock = m.value.lock;
if (lock) {
if (lock && lock != "") {
const lockPath = basePath + "lock";
m.value.lock = "!inline " + lockPath;
r.push({ path: lockPath, content: lock });
@@ -312,7 +312,7 @@ function ZipFSElement(zip: JSZip, useYaml: boolean): DynFSElement {
content: content,
});
}
if (o["lock"]) {
if (o["lock"] && o["lock"] != "") {
const lock = o["lock"];
o["lock"] = "!inline " + basePath + "lock";
r.push({
@@ -403,8 +403,14 @@ function ZipFSElement(zip: JSZip, useYaml: boolean): DynFSElement {
if (kind == "script") {
const parsed = JSON.parse(content);
if (parsed["lock"]) {
if (
parsed["lock"] &&
parsed["lock"] != "" &&
parsed["codebase"] == undefined
) {
parsed["lock"] = "!inline " + removeSuffix(p, ".json") + ".lock";
} else {
parsed["lock"] = undefined;
}
return useYaml
? yamlStringify(parsed, yamlOptions)
@@ -421,7 +427,7 @@ function ZipFSElement(zip: JSZip, useYaml: boolean): DynFSElement {
const content = await f.async("text");
const parsed = JSON.parse(content);
const lock = parsed["lock"];
if (lock) {
if (lock && lock != "") {
r.push({
isDirectory: false,
path: removeSuffix(finalPath, ".json") + ".lock",
@@ -867,40 +873,45 @@ async function pull(opts: GlobalOptions & SyncOptions) {
const target = path.join(Deno.cwd(), change.path);
const stateTarget = path.join(Deno.cwd(), ".wmill", change.path);
if (change.name === "edited") {
try {
const currentLocal = await Deno.readTextFile(target);
if (currentLocal !== change.before && currentLocal !== change.after) {
log.info(
colors.red(
`Conflict detected on ${change.path}\nBoth local and remote have been modified.`
)
);
if (opts.failConflicts) {
conflicts.push({
local: currentLocal,
change,
path: change.path,
});
continue;
} else if (opts.yes) {
if (opts.stateful) {
try {
const currentLocal = await Deno.readTextFile(target);
if (
currentLocal !== change.before &&
currentLocal !== change.after
) {
log.info(
colors.red(
`Override local version with remote since --yes was passed and no --fail-conflicts.`
`Conflict detected on ${change.path}\nBoth local and remote have been modified.`
)
);
} else {
showConflict(change.path, currentLocal, change.after);
if (
await Confirm.prompt(
"Preserve local (push to change remote and avoid seeing this again)?"
)
) {
if (opts.failConflicts) {
conflicts.push({
local: currentLocal,
change,
path: change.path,
});
continue;
} else if (opts.yes) {
log.info(
colors.red(
`Override local version with remote since --yes was passed and no --fail-conflicts.`
)
);
} else {
showConflict(change.path, currentLocal, change.after);
if (
await Confirm.prompt(
"Preserve local (push to change remote and avoid seeing this again)?"
)
) {
continue;
}
}
}
} catch {
// ignore
}
} catch {
// ignore
}
if (!change.path.endsWith(".json") && !change.path.endsWith(".yaml")) {
log.info(`Editing script content of ${change.path}`);
@@ -1083,7 +1094,7 @@ async function push(opts: GlobalOptions & SyncOptions) {
log.info(colors.gray(`Applying changes to files ...`));
const alreadySynced: string[] = [];
const globalDeps = await findGlobalDeps(codebases);
const globalDeps = await findGlobalDeps();
for await (const change of changes) {
const stateTarget = path.join(Deno.cwd(), ".wmill", change.path);
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "windmill-components",
"version": "1.331.2",
"version": "1.332.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "windmill-components",
"version": "1.331.2",
"version": "1.332.1",
"license": "AGPL-3.0",
"dependencies": {
"@aws-crypto/sha256-js": "^4.0.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "windmill-components",
"version": "1.331.2",
"version": "1.332.1",
"scripts": {
"dev": "vite dev",
"build": "vite build",
@@ -38,6 +38,10 @@
export let noControls: boolean = false
export let drawerOpen = false
const IMG_MAX_SIZE = 10000000
const TABLE_MAX_SIZE = 5000000
const DISPLAY_MAX_SIZE = 100000
let resultKind:
| 'json'
| 'table-col'
@@ -65,18 +69,46 @@
let enableHtml = false
let s3FileDisplayRawMode = false
function isArrayOfArrays(result: any): boolean {
function isTableRow(result: any): boolean {
return Array.isArray(result) && result.every((x) => Array.isArray(x))
}
function isObjectOfArrays(result: any[], keys: string[]): boolean {
function isTableCol(result: any, keys: string[]): boolean {
return (
!Array.isArray(result) && keys.map((k) => Array.isArray(result[k])).reduce((a, b) => a && b)
!Array.isArray(result) &&
keys.map((k) => Array.isArray(result[k])).reduce((a, b) => a && b, true)
)
}
function isTableRowObject(json) {
// check array of objects (with possible a first row of headers)
return (
Array.isArray(json) &&
json.length > 0 &&
(json.every(
(item) =>
item && typeof item === 'object' && Object.keys(item).length > 0 && !Array.isArray(item)
) ||
(Array.isArray(json[0]) &&
json[0].every((item) => typeof item === 'string') &&
json
.slice(1)
.every(
(item) =>
item &&
typeof item === 'object' &&
Object.keys(item).length > 0 &&
!Array.isArray(item)
)))
)
}
let largeObject: boolean | undefined = undefined
function checkIfS3(result: any, keys: string[]) {
return keys.length === 1 && keys.includes('s3') && typeof result.s3 === 'string'
}
let is_render_all = false
function inferResultKind(result: any) {
if (result == 'WINDMILL_TOO_BIG') {
@@ -97,71 +129,52 @@
keys.length == 1 && keys.includes('render_all') && Array.isArray(result['render_all'])
// Check if the result is an image
if (
[
'png',
'svg',
'jpeg',
'html',
'gif',
'table-row',
'table-col',
'table-row-object'
].includes(keys[0]) &&
keys.length == 1
) {
if (['png', 'svg', 'jpeg', 'html', 'gif'].includes(keys[0]) && keys.length == 1) {
// Check if the image is too large (10mb)
largeObject = roughSizeOfObject(result) > 10000000
largeObject = roughSizeOfObject(result) > IMG_MAX_SIZE
return keys[0] as
| 'png'
| 'svg'
| 'jpeg'
| 'html'
| 'gif'
| 'table-row'
| 'table-col'
| 'table-row-object'
return keys[0] as 'png' | 'svg' | 'jpeg' | 'html' | 'gif'
}
const tableLargeObject = roughSizeOfObject(result) > TABLE_MAX_SIZE
// Otherwise, check if the result is too large (10kb) for json
largeObject = tableLargeObject || roughSizeOfObject(result) > DISPLAY_MAX_SIZE
if (tableLargeObject) {
return 'json'
}
if (Array.isArray(result)) {
largeObject = roughSizeOfObject(result) > 5000000
if (largeObject) {
if (result.length === 0) {
return 'json'
} else if (result.every((elt) => inferResultKind(elt) === 's3object')) {
} else if (
result.every((elt) => typeof elt === 'object' && checkIfS3(elt, Object.keys(elt)))
) {
largeObject = result.length > 100
if (largeObject) {
return 'json'
}
return 's3object-list'
} else if (isArrayOfArrays(result)) {
} else if (isTableRow(result)) {
return 'table-row'
} else if (isObjectOfArrays(result, keys)) {
return 'table-col'
} else if (isArrayOfObjects(result)) {
} else if (isTableRowObject(result)) {
return 'table-row-object'
} else {
return 'json'
}
} else if (
keys.length === 1 &&
['table-row', 'table-row-object', 'table-col'].includes(keys[0])
) {
return keys[0] as 'table-row' | 'table-row-object' | 'table-col'
}
let length = roughSizeOfObject(result)
// Otherwise, check if the result is too large (10kb) for json
largeObject = length > 100000
if (largeObject) {
return 'json'
}
if (keys.length != 0) {
if (keys.length == 1 && keys[0] == 'table-row') {
return 'table-row'
} else if (keys.length == 1 && keys[0] == 'table-col') {
return 'table-col'
} else if (keys.length == 1 && keys[0] == 'table-row-object') {
return 'table-row-object'
} else if (keys.length == 1 && keys[0] == 'html') {
if (keys.length == 1 && keys[0] == 'html') {
return 'html'
} else if (keys.length == 1 && keys[0] == 'map') {
return 'map'
@@ -196,10 +209,12 @@
keys.includes('approvalPage')
) {
return 'approval'
} else if (keys.length === 1 && keys.includes('s3') && typeof result.s3 === 'string') {
} else if (checkIfS3(result, keys)) {
return 's3object'
} else if (keys.length === 1 && (keys.includes('md') || keys.includes('markdown'))) {
return 'markdown'
} else if (isTableCol(result, keys)) {
return 'table-col'
}
}
} catch (err) {}
@@ -225,29 +240,6 @@
}
}
function isArrayOfObjects(json) {
// check array of objects (with possible a first row of headers)
return (
Array.isArray(json) &&
json.length > 0 &&
(json.every(
(item) =>
item && typeof item === 'object' && Object.keys(item).length > 0 && !Array.isArray(item)
) ||
(Array.isArray(json[0]) &&
json[0].every((item) => typeof item === 'string') &&
json
.slice(1)
.every(
(item) =>
item &&
typeof item === 'object' &&
Object.keys(item).length > 0 &&
!Array.isArray(item)
)))
)
}
function handleArrayOfObjectsHeaders(json: any) {
// handle possible a first row of headers
if (
@@ -71,7 +71,12 @@
result: undefined as string | undefined
})
let value: string | undefined = noDefault ? undefined : outputs?.result.peak()
// The library expects double quotes around the value
let value: string | undefined = noDefault
? undefined
: outputs?.result.peak()
? JSON.stringify(outputs?.result.peak())
: undefined
$: resolvedConfig.items && handleItems()
@@ -58,7 +58,7 @@
if (auto_invite) {
await WorkspaceService.editAutoInvite({
workspace: id,
requestBody: { operator: operatorOnly, invite_all: !isCloudHosted(), auto_add: autoAdd }
requestBody: { operator: operatorOnly, invite_all: !isCloudHosted(), auto_add: true }
})
}
if (openAiKey != '') {
@@ -148,7 +148,6 @@
let auto_invite = false
let operatorOnly = false
let autoAdd = false
</script>
<CenteredModal title="New Workspace">
@@ -216,15 +215,6 @@
<div class="text-xs mb-1 leading-6 pt-2">
Mode <Tooltip>Whether to invite or add users directly to the workspace.</Tooltip>
</div>
<ToggleButtonGroup
selected={autoAdd ? 'add' : 'invite'}
on:selected={(e) => {
autoAdd = e.detail == 'add'
}}
>
<ToggleButton value="invite" size="xs" label="Auto-invite" />
<ToggleButton value="add" size="xs" label="Auto-add" />
</ToggleButtonGroup>
<div class="text-xs mb-1 leading-6 pt-2"
>Role <Tooltip>Role of the auto-invited users</Tooltip></div
+2 -2
View File
@@ -4,8 +4,8 @@ verify_ssl = true
name = "pypi"
[packages]
wmill = ">=1.331.2"
wmill_pg = ">=1.331.2"
wmill = ">=1.332.1"
wmill_pg = ">=1.332.1"
sendgrid = "*"
mysql-connector-python = "*"
pymongo = "*"
+1 -1
View File
@@ -1,7 +1,7 @@
openapi: "3.0.3"
info:
version: 1.331.2
version: 1.332.1
title: OpenFlow Spec
contact:
name: Ruben Fiszel
@@ -12,7 +12,7 @@
RootModule = 'WindmillClient.psm1'
# Version number of this module.
ModuleVersion = '1.331.2'
ModuleVersion = '1.332.1'
# Supported PSEditions
# CompatiblePSEditions = @()
+1 -1
View File
@@ -1,6 +1,6 @@
[tool.poetry]
name = "wmill"
version = "1.331.2"
version = "1.332.1"
description = "A client library for accessing Windmill server wrapping the Windmill client API"
license = "Apache-2.0"
homepage = "https://windmill.dev"
+1 -1
View File
@@ -1,6 +1,6 @@
[tool.poetry]
name = "wmill-pg"
version = "1.331.2"
version = "1.332.1"
description = "An extension client for the wmill client library focused on pg"
license = "Apache-2.0"
homepage = "https://windmill.dev"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@windmill/windmill",
"version": "1.331.2",
"version": "1.332.1",
"exports": "./src/index.ts",
"publish": {
"exclude": ["!src", "./s3Types.ts", "./client.ts"]
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "windmill-client",
"description": "Windmill SDK client for browsers and Node.js",
"version": "1.331.2",
"version": "1.332.1",
"author": "Ruben Fiszel",
"license": "Apache 2.0",
"devDependencies": {
+1 -1
View File
@@ -1 +1 @@
1.331.2
1.332.1