windmill-cli 1.855.1 → 1.857.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/main.js +80 -17
- package/package.json +1 -1
package/esm/main.js
CHANGED
|
@@ -16766,7 +16766,7 @@ var init_OpenAPI = __esm(() => {
|
|
|
16766
16766
|
PASSWORD: undefined,
|
|
16767
16767
|
TOKEN: getEnv3("WM_TOKEN"),
|
|
16768
16768
|
USERNAME: undefined,
|
|
16769
|
-
VERSION: "1.
|
|
16769
|
+
VERSION: "1.857.0",
|
|
16770
16770
|
WITH_CREDENTIALS: true,
|
|
16771
16771
|
interceptors: {
|
|
16772
16772
|
request: new Interceptors,
|
|
@@ -20092,7 +20092,7 @@ var init_auth = __esm(async () => {
|
|
|
20092
20092
|
});
|
|
20093
20093
|
|
|
20094
20094
|
// src/core/constants.ts
|
|
20095
|
-
var WM_FORK_PREFIX = "wm-fork", VERSION = "1.
|
|
20095
|
+
var WM_FORK_PREFIX = "wm-fork", VERSION = "1.857.0";
|
|
20096
20096
|
|
|
20097
20097
|
// src/utils/resource_folders.ts
|
|
20098
20098
|
import { existsSync } from "node:fs";
|
|
@@ -22115,11 +22115,18 @@ async function deployItem(provider, kind, path, workspaceFrom, workspaceTo, onBe
|
|
|
22115
22115
|
}
|
|
22116
22116
|
}
|
|
22117
22117
|
} else if (kind === "variable") {
|
|
22118
|
-
|
|
22118
|
+
let variable = await provider.getVariable({
|
|
22119
22119
|
workspace: workspaceFrom,
|
|
22120
22120
|
path,
|
|
22121
|
-
decryptSecret:
|
|
22121
|
+
decryptSecret: false
|
|
22122
22122
|
});
|
|
22123
|
+
if (variable.is_secret && !variable.value?.startsWith("$external:")) {
|
|
22124
|
+
variable = await provider.getVariable({
|
|
22125
|
+
workspace: workspaceFrom,
|
|
22126
|
+
path,
|
|
22127
|
+
decryptSecret: true
|
|
22128
|
+
});
|
|
22129
|
+
}
|
|
22123
22130
|
if (alreadyExists) {
|
|
22124
22131
|
await provider.updateVariable({
|
|
22125
22132
|
workspace: workspaceTo,
|
|
@@ -35274,16 +35281,18 @@ async function createToken2(opts) {
|
|
|
35274
35281
|
async function pushWorkspaceUser(workspace, path, user, localUser) {
|
|
35275
35282
|
const email = removePathPrefix(removeType(path, "user"), "users");
|
|
35276
35283
|
debug(`Processing local user ${email}`);
|
|
35277
|
-
if (
|
|
35284
|
+
if (typeof localUser.role !== "string" || localUser.role.trim() === "") {
|
|
35278
35285
|
throw new Error(`Invalid role for user ${email}: ${localUser.role}`);
|
|
35279
35286
|
}
|
|
35287
|
+
const isAdmin = localUser.role === "admin";
|
|
35288
|
+
const role = isAdmin ? undefined : localUser.role;
|
|
35280
35289
|
try {
|
|
35281
35290
|
const remoteUser = await getUser({
|
|
35282
35291
|
workspace,
|
|
35283
35292
|
username: localUser.username
|
|
35284
35293
|
});
|
|
35285
35294
|
user = {
|
|
35286
|
-
role: remoteUser.is_admin ? "admin" : remoteUser.operator ? "operator" : "developer",
|
|
35295
|
+
role: remoteUser.is_admin ? "admin" : remoteUser.role ?? (remoteUser.operator ? "operator" : "developer"),
|
|
35287
35296
|
username: remoteUser.username,
|
|
35288
35297
|
disabled: remoteUser.disabled
|
|
35289
35298
|
};
|
|
@@ -35305,8 +35314,8 @@ async function pushWorkspaceUser(workspace, path, user, localUser) {
|
|
|
35305
35314
|
workspace,
|
|
35306
35315
|
username: localUser.username,
|
|
35307
35316
|
requestBody: {
|
|
35308
|
-
is_admin:
|
|
35309
|
-
|
|
35317
|
+
is_admin: isAdmin,
|
|
35318
|
+
role,
|
|
35310
35319
|
disabled: localUser.disabled
|
|
35311
35320
|
}
|
|
35312
35321
|
});
|
|
@@ -35324,8 +35333,8 @@ async function pushWorkspaceUser(workspace, path, user, localUser) {
|
|
|
35324
35333
|
workspace,
|
|
35325
35334
|
requestBody: {
|
|
35326
35335
|
email,
|
|
35327
|
-
is_admin:
|
|
35328
|
-
|
|
35336
|
+
is_admin: isAdmin,
|
|
35337
|
+
role,
|
|
35329
35338
|
username: !automatedUsernameCreation ? localUser.username : undefined
|
|
35330
35339
|
}
|
|
35331
35340
|
});
|
|
@@ -36799,7 +36808,8 @@ var init_settings2 = __esm(async () => {
|
|
|
36799
36808
|
"guest_jwt_jwks_url",
|
|
36800
36809
|
"error_handler_fallback_to_instance_alerts",
|
|
36801
36810
|
"add_admins_and_developers_to_forks",
|
|
36802
|
-
"variable_expiration_handler"
|
|
36811
|
+
"variable_expiration_handler",
|
|
36812
|
+
"role_overrides"
|
|
36803
36813
|
];
|
|
36804
36814
|
RETIRED_SETTINGS = ["guest_access_enabled"];
|
|
36805
36815
|
instanceSettingsPath = INSTANCE_SETTINGS_PATH;
|
|
@@ -58845,7 +58855,7 @@ var init_openflow = __esm(() => {
|
|
|
58845
58855
|
openflow_default = {
|
|
58846
58856
|
openapi: "3.0.3",
|
|
58847
58857
|
info: {
|
|
58848
|
-
version: "1.
|
|
58858
|
+
version: "1.857.0",
|
|
58849
58859
|
title: "OpenFlow Spec",
|
|
58850
58860
|
contact: {
|
|
58851
58861
|
name: "Ruben Fiszel",
|
|
@@ -77133,7 +77143,7 @@ async function get6(opts, path) {
|
|
|
77133
77143
|
}
|
|
77134
77144
|
}
|
|
77135
77145
|
function looksLikeWorkspaceCiphertext(value) {
|
|
77136
|
-
if (value.startsWith("$vault:") || value.startsWith("$aws_sm:") || value.startsWith("$azure_kv:") || value.startsWith("$http_store:")) {
|
|
77146
|
+
if (value.startsWith("$vault:") || value.startsWith("$aws_sm:") || value.startsWith("$azure_kv:") || value.startsWith("$http_store:") || value.startsWith("$external:")) {
|
|
77137
77147
|
return true;
|
|
77138
77148
|
}
|
|
77139
77149
|
if (value.length === 0 || value.length % 4 !== 0)
|
|
@@ -88891,7 +88901,11 @@ The key must be a **string literal** — the graph parser is static and cannot f
|
|
|
88891
88901
|
>
|
|
88892
88902
|
> The one target ANY language may declare (except a dbt script, whose writes come from its manifest) is a **warehouse relation**: \`// materialize manual dbt://<warehouse>/<schema>/<name>\`, where \`<warehouse>\` is a warehouse the workspace configures under Settings → dbt. \`manual\` is the only mode it has — nothing generates warehouse DDL, so the node issues its own write (a postgresql \`CREATE TABLE\` / \`INSERT\`, an SDK load, …) and the annotation records the outcome. Use it on an ingestion node whose output a dbt project reads as a \`source\`: the declared relation and the dbt model land on ONE graph node, and a downstream \`// on dbt://<warehouse>/<schema>/<name>\` fires when the ingestion node completes.
|
|
88893
88903
|
|
|
88894
|
-
A managed \`// materialize ducklake://<name>/<table>\` tells the runtime to write the node's output table **for you**: write the body as a single \`SELECT\` and the runtime wraps it in the create/replace — do **not** also write your own \`CREATE TABLE\` / \`INSERT\`. (The opposite holds for the \`dbt://\` target above: there the node writes its own DDL and the strategies below do not apply.)
|
|
88904
|
+
A managed \`// materialize ducklake://<name>/<table>\` tells the runtime to write the node's output table **for you**: write the body as a single \`SELECT\` and the runtime wraps it in the create/replace — do **not** also write your own \`CREATE TABLE\` / \`INSERT\`. (The opposite holds for the \`dbt://\` target above: there the node writes its own DDL and the strategies below do not apply.)
|
|
88905
|
+
|
|
88906
|
+
A target that names no table — \`// materialize\`, \`// materialize ducklake://<name>\`, or options alone such as \`// materialize key=id\` — writes the table named after the script: node \`f/shop/orders_daily\` materializes \`ducklake://main/orders_daily\` (characters other than letters, digits and \`_\` become \`_\`, and a name starting with a digit gets a leading \`_\`). Name the node after the table it produces and the bare form is enough; write the full target when the table's name differs from the node's, and use that same name in every downstream \`// on\` and read.
|
|
88907
|
+
|
|
88908
|
+
Write strategy:
|
|
88895
88909
|
|
|
88896
88910
|
- no option → **replace** the whole table each run (full refresh; the only mode whose output columns may change);
|
|
88897
88911
|
- \`// materialize <uri> append\` → INSERT-append rows (incremental);
|
|
@@ -88922,7 +88936,8 @@ On a node that materializes a DuckLake table, \`// measure <name> = <aggregate>
|
|
|
88922
88936
|
2. Write each node as its own script. Default to \`duckdb\` materializing into DuckLake (see "Default to DuckDB + DuckLake" above); pick \`postgresql\`, \`bun\`, or \`python3\` only when that section says the work calls for it.
|
|
88923
88937
|
3. Start each body with \`// pipeline\`, then the \`// on\` input declarations, then the transform that writes the output.
|
|
88924
88938
|
4. **Chain nodes by asset URI**: read an upstream node's output asset, then \`// on <that-same-uri>\` in the downstream node so the edge forms. Reuse exact asset paths from existing nodes rather than inventing parallel ones.
|
|
88925
|
-
5.
|
|
88939
|
+
5. Never guess the columns of a file or table you have not seen: read them first with a query that writes nothing, such as \`DESCRIBE SELECT * FROM read_csv('s3:///raw/orders/*.csv')\` or \`ATTACH 'ducklake://main' AS lake; DESCRIBE lake.orders\`, and use those exact column names. A test run of a node that materializes a table writes that table into the workspace's lake: test-run such a node only while its table does not exist yet, and ask before running one that would replace a table already there.
|
|
88940
|
+
6. Don't deploy nodes unless the user asks to. A pipeline only "runs" once its scripts are deployed and their triggers exist.
|
|
88926
88941
|
|
|
88927
88942
|
Locally:
|
|
88928
88943
|
|
|
@@ -88948,9 +88963,12 @@ Node \`f/sales/orders_daily\` (runs when \`orders\` is produced, writes a rollup
|
|
|
88948
88963
|
-- pipeline
|
|
88949
88964
|
-- on ducklake://main/orders
|
|
88950
88965
|
-- materialize ducklake://main/orders_daily
|
|
88966
|
+
ATTACH 'ducklake://main' AS lake;
|
|
88951
88967
|
SELECT date_trunc('day', ts) AS day, count(*) AS n
|
|
88952
|
-
FROM
|
|
88968
|
+
FROM lake.orders GROUP BY 1
|
|
88953
88969
|
\`\`\`
|
|
88970
|
+
|
|
88971
|
+
A node reads a DuckLake table only through a lake it attaches itself (\`ATTACH 'ducklake://<name>' AS lake;\`, then \`lake.<table>\`); the materialize target is attached by the runtime under a name of its own, so \`ducklake.main.<table>\` does not resolve.
|
|
88954
88972
|
`,
|
|
88955
88973
|
datatables: `---
|
|
88956
88974
|
name: datatables
|
|
@@ -100218,6 +100236,13 @@ function workspaceRoot() {
|
|
|
100218
100236
|
const yaml = getWmillYamlPath();
|
|
100219
100237
|
return yaml ? path27.dirname(yaml) : process26.cwd();
|
|
100220
100238
|
}
|
|
100239
|
+
function withDefaultTable(m, scriptPath) {
|
|
100240
|
+
if (m.target_kind !== "ducklake" || /[/.]/.test(m.target_path))
|
|
100241
|
+
return m;
|
|
100242
|
+
const name = (scriptPath.split("/").pop() ?? "").trim().replace(/[^A-Za-z0-9_]/gu, "_");
|
|
100243
|
+
const table = /^[0-9]/.test(name) ? `_${name}` : name;
|
|
100244
|
+
return table ? { ...m, target_path: `${m.target_path}/${table}` } : m;
|
|
100245
|
+
}
|
|
100221
100246
|
function wasmFnForLanguage(language) {
|
|
100222
100247
|
switch (language) {
|
|
100223
100248
|
case "bun":
|
|
@@ -100334,6 +100359,43 @@ var MUTE_ASSET_PREFIXES = [
|
|
|
100334
100359
|
["datatable://", "datatable"],
|
|
100335
100360
|
["volume://", "volume"]
|
|
100336
100361
|
];
|
|
100362
|
+
function recoverBareMaterialize(content) {
|
|
100363
|
+
for (const rawLine of content.split(`
|
|
100364
|
+
`)) {
|
|
100365
|
+
const line = rawLine.trimStart();
|
|
100366
|
+
if (line === "")
|
|
100367
|
+
continue;
|
|
100368
|
+
let rest;
|
|
100369
|
+
if (line.startsWith("//") || line.startsWith("--"))
|
|
100370
|
+
rest = line.slice(2);
|
|
100371
|
+
else if (line.startsWith("#"))
|
|
100372
|
+
rest = line.slice(1);
|
|
100373
|
+
else
|
|
100374
|
+
break;
|
|
100375
|
+
const m = rest.trim().match(/^materialize(?:\s+(.*))?$/);
|
|
100376
|
+
if (!m)
|
|
100377
|
+
continue;
|
|
100378
|
+
let tokens = (m[1] ?? "").split(/\s+/).filter((t) => t !== "");
|
|
100379
|
+
if (tokens[0] === "manual")
|
|
100380
|
+
return;
|
|
100381
|
+
const scd2Keyword = tokens[0] === "scd2";
|
|
100382
|
+
if (scd2Keyword)
|
|
100383
|
+
tokens = tokens.slice(1);
|
|
100384
|
+
const first = tokens[0] ?? "";
|
|
100385
|
+
const namesTarget = first.includes("://") || first !== "" && first !== "append" && first !== "history" && !first.includes("=");
|
|
100386
|
+
if (namesTarget)
|
|
100387
|
+
return;
|
|
100388
|
+
const key = tokens.find((t) => t.startsWith("key="))?.slice("key=".length);
|
|
100389
|
+
return {
|
|
100390
|
+
target_kind: "ducklake",
|
|
100391
|
+
target_path: "main",
|
|
100392
|
+
...tokens.includes("append") ? { append: true } : {},
|
|
100393
|
+
...key ? { unique_key: key } : {},
|
|
100394
|
+
...scd2Keyword || tokens.includes("history") ? { scd2: true } : {}
|
|
100395
|
+
};
|
|
100396
|
+
}
|
|
100397
|
+
return;
|
|
100398
|
+
}
|
|
100337
100399
|
function parseMuteAnnotations(content) {
|
|
100338
100400
|
const muted = new Set;
|
|
100339
100401
|
let muteAll = false;
|
|
@@ -100542,7 +100604,8 @@ async function buildLocalPipelineGraph(args) {
|
|
|
100542
100604
|
const retry = normalizeRetry(out.retry);
|
|
100543
100605
|
const nativeTriggers = recoverHeaderNativeTriggers(s.content, s.language);
|
|
100544
100606
|
pipelineScripts.push(out.tag ? { ...s, tag: out.tag } : s);
|
|
100545
|
-
const
|
|
100607
|
+
const parsedMat = out.materialize ?? recoverBareMaterialize(s.content);
|
|
100608
|
+
const mat = parsedMat && withDefaultTable(parsedMat, s.path);
|
|
100546
100609
|
const materialize_strategy = mat && !mat.manual ? mat.scd2 ? "scd2" : mat.append ? "append" : mat.unique_key ? "merge" : "replace" : undefined;
|
|
100547
100610
|
runnables.push({
|
|
100548
100611
|
path: s.path,
|