windmill-cli 1.828.0 → 1.830.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 +84 -14
- 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.830.0",
|
|
16770
16770
|
WITH_CREDENTIALS: true,
|
|
16771
16771
|
interceptors: {
|
|
16772
16772
|
request: new Interceptors,
|
|
@@ -20051,7 +20051,7 @@ var init_auth = __esm(async () => {
|
|
|
20051
20051
|
});
|
|
20052
20052
|
|
|
20053
20053
|
// src/core/constants.ts
|
|
20054
|
-
var WM_FORK_PREFIX = "wm-fork", VERSION = "1.
|
|
20054
|
+
var WM_FORK_PREFIX = "wm-fork", VERSION = "1.830.0";
|
|
20055
20055
|
|
|
20056
20056
|
// src/utils/resource_folders.ts
|
|
20057
20057
|
import { existsSync } from "node:fs";
|
|
@@ -21122,9 +21122,6 @@ async function readConfigFile(opts) {
|
|
|
21122
21122
|
delete conf?.gitBranches;
|
|
21123
21123
|
delete conf?.environments;
|
|
21124
21124
|
delete conf?.git_branches;
|
|
21125
|
-
if (conf?.defaultTs == undefined) {
|
|
21126
|
-
warn("No defaultTs defined in your wmill.yaml. Using 'bun' as default.");
|
|
21127
|
-
}
|
|
21128
21125
|
setNonDottedPaths(conf?.nonDottedPaths ?? false);
|
|
21129
21126
|
const syncBehaviorVersion = parseSyncBehavior(conf?.syncBehavior);
|
|
21130
21127
|
if (syncBehaviorVersion > SUPPORTED_SYNC_BEHAVIOR_VERSION) {
|
|
@@ -21391,7 +21388,6 @@ var init_conf = __esm(async () => {
|
|
|
21391
21388
|
import_yaml3 = __toESM(require_dist(), 1);
|
|
21392
21389
|
GLOBAL_CONFIG_OPT = { noCdToRoot: false };
|
|
21393
21390
|
DEFAULT_SYNC_OPTIONS = {
|
|
21394
|
-
defaultTs: "bun",
|
|
21395
21391
|
includes: ["f/**"],
|
|
21396
21392
|
excludes: [],
|
|
21397
21393
|
codebases: [],
|
|
@@ -57061,7 +57057,7 @@ var init_openflow = __esm(() => {
|
|
|
57061
57057
|
openflow_default = {
|
|
57062
57058
|
openapi: "3.0.3",
|
|
57063
57059
|
info: {
|
|
57064
|
-
version: "1.
|
|
57060
|
+
version: "1.830.0",
|
|
57065
57061
|
title: "OpenFlow Spec",
|
|
57066
57062
|
contact: {
|
|
57067
57063
|
name: "Ruben Fiszel",
|
|
@@ -61254,8 +61250,8 @@ async function buildPermissionedAsContext(workspace, syncBehavior) {
|
|
|
61254
61250
|
return;
|
|
61255
61251
|
}
|
|
61256
61252
|
const user = await whoami({ workspace });
|
|
61257
|
-
const userIsAdminOrDeployer = user.is_admin || (user.groups ?? []).includes("wm_deployers");
|
|
61258
|
-
debug(`permissioned_as: user=${user.email}, is_admin=${user.is_admin}, groups=${JSON.stringify(user.groups)}, isAdminOrDeployer=${userIsAdminOrDeployer}`);
|
|
61253
|
+
const userIsAdminOrDeployer = user.is_admin || user.is_super_admin || (user.groups ?? []).includes("wm_deployers");
|
|
61254
|
+
debug(`permissioned_as: user=${user.email}, is_admin=${user.is_admin}, is_super_admin=${user.is_super_admin}, groups=${JSON.stringify(user.groups)}, isAdminOrDeployer=${userIsAdminOrDeployer}`);
|
|
61259
61255
|
return {
|
|
61260
61256
|
userCache: new Map,
|
|
61261
61257
|
userIsAdminOrDeployer,
|
|
@@ -75531,7 +75527,7 @@ async function pushWorkspaceSettings(workspace, _path, settings, localSettings)
|
|
|
75531
75527
|
const localOperatorSettings = localSettings.operator_settings && {
|
|
75532
75528
|
...localSettings.operator_settings
|
|
75533
75529
|
};
|
|
75534
|
-
for (const key of ["builder_flows", "manage_schedules", "manage_triggers"]) {
|
|
75530
|
+
for (const key of ["builder_flows", "builder_apps", "manage_schedules", "manage_triggers"]) {
|
|
75535
75531
|
const remote = settings.operator_settings?.[key];
|
|
75536
75532
|
if (localOperatorSettings && localOperatorSettings[key] === undefined && remote !== undefined) {
|
|
75537
75533
|
localOperatorSettings[key] = remote;
|
|
@@ -80572,6 +80568,14 @@ async setProgress(percent: number, jobId?: any): Promise<void>
|
|
|
80572
80568
|
*/
|
|
80573
80569
|
async getProgress(jobId?: any): Promise<number | null>
|
|
80574
80570
|
|
|
80571
|
+
/**
|
|
80572
|
+
* Whether the worker running this job has received its shutdown signal.
|
|
80573
|
+
* A draining worker waits for its current job to finish before exiting, so a
|
|
80574
|
+
* long-running script can poll this and return early to let the worker be replaced.
|
|
80575
|
+
* @param jobId? Job to check, defaults to the current job
|
|
80576
|
+
*/
|
|
80577
|
+
async workerIsDraining(jobId?: string): Promise<boolean>
|
|
80578
|
+
|
|
80575
80579
|
/**
|
|
80576
80580
|
* Set a flow user state
|
|
80577
80581
|
* @param key key of the state
|
|
@@ -81407,6 +81411,14 @@ async setProgress(percent: number, jobId?: any): Promise<void>
|
|
|
81407
81411
|
*/
|
|
81408
81412
|
async getProgress(jobId?: any): Promise<number | null>
|
|
81409
81413
|
|
|
81414
|
+
/**
|
|
81415
|
+
* Whether the worker running this job has received its shutdown signal.
|
|
81416
|
+
* A draining worker waits for its current job to finish before exiting, so a
|
|
81417
|
+
* long-running script can poll this and return early to let the worker be replaced.
|
|
81418
|
+
* @param jobId? Job to check, defaults to the current job
|
|
81419
|
+
*/
|
|
81420
|
+
async workerIsDraining(jobId?: string): Promise<boolean>
|
|
81421
|
+
|
|
81410
81422
|
/**
|
|
81411
81423
|
* Set a flow user state
|
|
81412
81424
|
* @param key key of the state
|
|
@@ -82348,6 +82360,14 @@ async setProgress(percent: number, jobId?: any): Promise<void>
|
|
|
82348
82360
|
*/
|
|
82349
82361
|
async getProgress(jobId?: any): Promise<number | null>
|
|
82350
82362
|
|
|
82363
|
+
/**
|
|
82364
|
+
* Whether the worker running this job has received its shutdown signal.
|
|
82365
|
+
* A draining worker waits for its current job to finish before exiting, so a
|
|
82366
|
+
* long-running script can poll this and return early to let the worker be replaced.
|
|
82367
|
+
* @param jobId? Job to check, defaults to the current job
|
|
82368
|
+
*/
|
|
82369
|
+
async workerIsDraining(jobId?: string): Promise<boolean>
|
|
82370
|
+
|
|
82351
82371
|
/**
|
|
82352
82372
|
* Set a flow user state
|
|
82353
82373
|
* @param key key of the state
|
|
@@ -84353,6 +84373,18 @@ def set_progress(value: int, job_id: Optional[str] = None)
|
|
|
84353
84373
|
# Progress value (0-100) or None if not set
|
|
84354
84374
|
def get_progress(job_id: Optional[str] = None) -> Any
|
|
84355
84375
|
|
|
84376
|
+
# Whether the worker running the job has received its shutdown signal.
|
|
84377
|
+
#
|
|
84378
|
+
# A draining worker waits for its current job to finish before exiting. A long-running
|
|
84379
|
+
# script can poll this and return early so the worker can be replaced.
|
|
84380
|
+
#
|
|
84381
|
+
# Args:
|
|
84382
|
+
# job_id: Job ID (defaults to current WM_JOB_ID)
|
|
84383
|
+
#
|
|
84384
|
+
# Returns:
|
|
84385
|
+
# True if the worker running the job is draining
|
|
84386
|
+
def worker_is_draining(job_id: Optional[str] = None) -> bool
|
|
84387
|
+
|
|
84356
84388
|
# Set the user state of a flow at a given key
|
|
84357
84389
|
def set_flow_user_state(key: str, value: Any) -> None
|
|
84358
84390
|
|
|
@@ -87612,10 +87644,48 @@ A **data pipeline** is NOT a flow. A flow is one runnable that orchestrates step
|
|
|
87612
87644
|
A pipeline node that produces a table should almost always be a **\`duckdb\`** node that materializes its output into a **DuckLake** table with \`-- materialize ducklake://<name>/<table>\` (in a DuckDB node the annotation uses SQL \`--\` comment syntax; write the body as a bare \`SELECT\` and let the runtime do the write). DuckLake is the default lakehouse store for pipelines and is the shape the pipeline editor is built around, so prefer it unless the work specifically calls for something else:
|
|
87613
87645
|
|
|
87614
87646
|
- \`postgresql\` / data tables — only for row-level, OLTP-style mutations against an existing Postgres data table (frequent single-row upserts/updates, transactional reads that an app queries live).
|
|
87615
|
-
- \`bun\` / \`python3\` — only for
|
|
87647
|
+
- \`bun\` / \`python3\` — only for work that doesn't map to SQL: calling an external API, wrangling files, arbitrary glue. When such a node produces tabular data for downstream steps, write it **straight into DuckLake** (or a data table) from the same script — see "Ingesting from Python / TypeScript" below — rather than inventing a parallel store.
|
|
87616
87648
|
|
|
87617
87649
|
Do not spread a pipeline across postgres, S3, and DuckLake when one DuckLake lake would do; a consistent DuckLake lakehouse is the goal.
|
|
87618
87650
|
|
|
87651
|
+
## Ingesting from Python / TypeScript
|
|
87652
|
+
|
|
87653
|
+
A node that fetches data in code (an API, a SaaS export, a scraper) writes the rows **directly** into their DuckLake table with \`wmill.ducklake()\`, or into a data table with \`wmill.datatable()\`. DuckLake already stores every table as parquet files in the workspace object storage, so **never stage the raw payload first** — no intermediate JSON / CSV / parquet file in S3 and no second "load the raw file" node. One ingestion node, one table.
|
|
87654
|
+
|
|
87655
|
+
Pass the rows as a query argument (a list of dicts / array of objects is sent as JSON) and let SQL unnest them; declare the column types so the table gets a real schema:
|
|
87656
|
+
|
|
87657
|
+
\`\`\`python
|
|
87658
|
+
# pipeline
|
|
87659
|
+
# on schedule
|
|
87660
|
+
import wmill
|
|
87661
|
+
|
|
87662
|
+
def main():
|
|
87663
|
+
rows = fetch_charges() # list[dict]
|
|
87664
|
+
lake = wmill.ducklake()
|
|
87665
|
+
lake.query("""
|
|
87666
|
+
CREATE OR REPLACE TABLE stripe_charges AS
|
|
87667
|
+
SELECT unnest(from_json($rows, '[{"id":"VARCHAR","amount":"BIGINT","created":"BIGINT"}]'), recursive := true)
|
|
87668
|
+
""", rows=rows).fetch()
|
|
87669
|
+
\`\`\`
|
|
87670
|
+
|
|
87671
|
+
\`\`\`ts
|
|
87672
|
+
// pipeline
|
|
87673
|
+
// on schedule
|
|
87674
|
+
import * as wmill from "windmill-client"
|
|
87675
|
+
|
|
87676
|
+
export async function main() {
|
|
87677
|
+
const rows = await fetchCharges()
|
|
87678
|
+
const lake = wmill.ducklake()
|
|
87679
|
+
await lake\`CREATE OR REPLACE TABLE stripe_charges AS
|
|
87680
|
+
SELECT unnest(from_json(\${rows}, '[{"id":"VARCHAR","amount":"BIGINT","created":"BIGINT"}]'), recursive := true)\`.fetch()
|
|
87681
|
+
}
|
|
87682
|
+
\`\`\`
|
|
87683
|
+
|
|
87684
|
+
- Use \`INSERT INTO <table> SELECT ...\` instead of \`CREATE OR REPLACE\` to append (an incremental pull), with a one-time \`CREATE TABLE IF NOT EXISTS\` first.
|
|
87685
|
+
- Assign the client to a variable (\`lake = wmill.ducklake()\`) and keep the SQL a **string literal** (Python) or a template without \`sql.raw\` (TS): that is what lets the graph record the node's write to \`ducklake://main/<table>\`. A chained \`wmill.ducklake().query(...)\` or SQL built in a variable records no output, so the downstream edge never forms.
|
|
87686
|
+
- \`wmill.ducklake("<name>")\` targets a non-default catalog; \`wmill.datatable("<name>")\` writes a Postgres data table the same way (Python \`db.query(sql, *args)\` with \`$1\` placeholders, TS the same template form) — use it only when the data belongs in Postgres (see above).
|
|
87687
|
+
- The downstream node triggers on the table itself: \`-- on ducklake://main/stripe_charges\`.
|
|
87688
|
+
|
|
87619
87689
|
## Storage prerequisites
|
|
87620
87690
|
|
|
87621
87691
|
A DuckLake pipeline only runs once the workspace has **object storage** (S3 / Azure Blob / GCS) **and a DuckLake catalog** configured — DuckLake tables and \`s3://\` assets can't be materialized or read without it. Check which DuckLake catalogs the workspace has before you build.
|
|
@@ -87659,7 +87729,7 @@ The key must be a **string literal** — the graph parser is static and cannot f
|
|
|
87659
87729
|
|
|
87660
87730
|
## Materialize (the managed output)
|
|
87661
87731
|
|
|
87662
|
-
> **A MANAGED \`// materialize\` is DuckDB-only**, and its target must be a DuckLake table (\`ducklake://<name>/<table>\`). Deploy **rejects** a \`ducklake://\` \`// materialize\` on any other language (\`python3\`, \`bun\`, \`postgresql\`). For a non-DuckDB node writing the lake, do **not** use \`// materialize\` — write the
|
|
87732
|
+
> **A MANAGED \`// materialize\` is DuckDB-only**, and its target must be a DuckLake table (\`ducklake://<name>/<table>\`). Deploy **rejects** a \`ducklake://\` \`// materialize\` on any other language (\`python3\`, \`bun\`, \`postgresql\`). For a non-DuckDB node writing the lake, do **not** use \`// materialize\` — write the table itself with \`wmill.ducklake()\` (see "Ingesting from Python / TypeScript") and let the output be inferred. Use \`duckdb\` when a node should materialize a DuckLake table.
|
|
87663
87733
|
>
|
|
87664
87734
|
> 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.
|
|
87665
87735
|
|
|
@@ -93680,8 +93750,8 @@ var CONFIG_REFERENCE = [
|
|
|
93680
93750
|
type: "string",
|
|
93681
93751
|
enum: ["bun", "deno"],
|
|
93682
93752
|
default: "bun",
|
|
93683
|
-
description: "
|
|
93684
|
-
|
|
93753
|
+
description: "TypeScript runtime of a plain .ts script (bun when absent)",
|
|
93754
|
+
skipInTemplate: true
|
|
93685
93755
|
},
|
|
93686
93756
|
{
|
|
93687
93757
|
name: "includes",
|