windmill-cli 1.831.0 → 1.833.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.
Files changed (2) hide show
  1. package/esm/main.js +30 -5
  2. 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.831.0",
16769
+ VERSION: "1.833.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.831.0";
20054
+ var WM_FORK_PREFIX = "wm-fork", VERSION = "1.833.0";
20055
20055
 
20056
20056
  // src/utils/resource_folders.ts
20057
20057
  import { existsSync } from "node:fs";
@@ -57054,7 +57054,7 @@ var init_openflow = __esm(() => {
57054
57054
  openflow_default = {
57055
57055
  openapi: "3.0.3",
57056
57056
  info: {
57057
- version: "1.831.0",
57057
+ version: "1.833.0",
57058
57058
  title: "OpenFlow Spec",
57059
57059
  contact: {
57060
57060
  name: "Ruben Fiszel",
@@ -70976,10 +70976,26 @@ async function pushRawApp(workspace, remotePath, localPath, message, defaultTs =
70976
70976
  }
70977
70977
  await applyExtraPermsDiff(workspace, "raw_app", remotePath, localPerms, app?.extra_perms);
70978
70978
  }
70979
+ function carryViewerDataAccess(runnables, policy) {
70980
+ const triggerables = policy?.triggerables_v2;
70981
+ if (!runnables || !triggerables)
70982
+ return;
70983
+ for (const [id, runnable] of Object.entries(runnables)) {
70984
+ if (runnable?.viewer_data_access !== true)
70985
+ continue;
70986
+ if (runnable.type !== "inline" && runnable.type !== "runnableByName")
70987
+ continue;
70988
+ for (const [key, triggerable] of Object.entries(triggerables)) {
70989
+ if (key.startsWith(`${id}:rawscript/`))
70990
+ triggerable.viewer_data_access = true;
70991
+ }
70992
+ }
70993
+ }
70979
70994
  async function generatingPolicy(app, path, executionMode, base, isolation) {
70980
70995
  info(colors.gray(`Generating fresh policy for app ${path}...`));
70981
70996
  try {
70982
70997
  app.policy = await Q(app.runnables, base);
70998
+ carryViewerDataAccess(app.runnables, app.policy);
70983
70999
  finalizeDerivedPolicy(app.policy, executionMode, isolation, true);
70984
71000
  } catch (e) {
70985
71001
  error(colors.red(`Error generating policy for app ${path}: ${e}`));
@@ -86348,6 +86364,8 @@ fields:
86348
86364
  value: "default_user"
86349
86365
  \`\`\`
86350
86366
 
86367
+ \`viewer_data_access: true\` makes an inline runnable read data tables and object storage as the person using the app instead of as the app's identity (see "Reading data as the viewer").
86368
+
86351
86369
  ### Referencing existing scripts
86352
86370
 
86353
86371
  To use an existing Windmill script instead of inline code:
@@ -86384,7 +86402,7 @@ data:
86384
86402
  - \`<datatable>/<table>\` — Specific table in public schema
86385
86403
  - \`<datatable>/<schema>:<table>\` — Table in specific schema
86386
86404
 
86387
- **Roles:** when a datatable is under roles, its queries run as a role, which only reaches what it was granted. \`roles\` records the role the app uses each datatable through; the app's code must pass the same role: \`wmill.datatable('main', { role: 'analyst' })\` in TypeScript, \`wmill.datatable('main', role='analyst')\` in Python. A datatable without an entry is used as its default role, if it has one, plus the roles of whoever is using the app unless that default is \`admin\`.
86405
+ **Roles:** when a datatable is under roles, its queries run as a role, which only reaches what it was granted. \`roles\` records the role the app uses each datatable through; the app's code must pass the same role: \`wmill.datatable('main', { role: 'analyst' })\` in TypeScript, \`wmill.datatable('main', role='analyst')\` in Python. A datatable without an entry is used as its default role, if it has one, plus the roles of the app's identity, or of whoever is using the app for a runnable with \`viewer_data_access: true\`, unless that default is \`admin\`.
86388
86406
 
86389
86407
  ## SQL Migrations (sql_to_apply/)
86390
86408
 
@@ -86505,6 +86523,8 @@ Svelte (\`index.ts\`): \`mount(App, { target: document.getElementById('root')! }
86505
86523
 
86506
86524
  **Never replace the entrypoint with a bare component** (\`export default function App() { ... }\` and no mount call). A component that is defined but never mounted renders a blank screen with **no error thrown** — it never executes, so nothing reaches the console or the error overlay. If an app renders blank, check that the entrypoint still mounts \`App\` into \`#root\`.
86507
86525
 
86526
+ **Set the browser tab title with \`document.title = '...'\`** (or a \`<title>\` the framework renders into \`<head>\`). The app has no \`index.html\` of its own, so a \`<title>\` written there is never served; the deployed app's page shows whatever \`document.title\` holds, and follows it when it changes.
86527
+
86508
86528
  **Always begin every React file (\`.tsx\`/\`.jsx\`) that uses JSX with \`import React from 'react'\`.** esbuild uses the classic JSX transform, so \`React\` must be in scope wherever JSX appears — a missing import compiles fine but throws \`React is not defined\` at runtime, leaving a blank screen.
86509
86529
 
86510
86530
  ### Generated bindings (\`wmill.d.ts\` / \`wmill.ts\`)
@@ -86679,6 +86699,11 @@ frontend_api: [jobs:run, users:read]
86679
86699
 
86680
86700
  A file with a \`sandbox\` key states both settings: \`sandbox: false\` turns isolation off, and a missing \`frontend_api\` means no scopes. A file without the key leaves the deployed app's isolation and scopes as they are, so removing \`sandbox: true\` does not unsandbox it. \`frontend_api\` needs \`sandbox: true\`; the push fails otherwise.
86681
86701
 
86702
+ ## Reading data as the viewer
86703
+
86704
+ A backend runnable reads data as the app's identity (the publisher in publisher mode), the same for every viewer. An inline runnable can instead read data as the person using the app: its data table connections that name no role hold that viewer's roles, and object storage permission rules (which paths may be listed, read, written) are checked against the viewer. Resources, variables and everything else stay the app's, and an anonymous viewer is refused. Turn it on only when what the runnable reads should differ per viewer: row-level security on a data table, or per-user paths in object storage. Both are Enterprise Edition features.
86705
+ Set it with \`viewer_data_access: true\` in the runnable's \`backend/<id>.yaml\`.
86706
+
86682
86707
  ## Data Tables
86683
86708
 
86684
86709
  Data tables are PostgreSQL databases managed by Windmill. Backend runnables query them via the \`wmill\` client; the frontend never queries them directly. **When the app needs to store or persist data** (user data, settings, application state, records, logs), use a data table.
@@ -86690,7 +86715,7 @@ Data tables are PostgreSQL databases managed by Windmill. Backend runnables quer
86690
86715
  3. **No DDL inside runnables**: runnables only read and write rows (SELECT, INSERT, UPDATE, DELETE) on existing tables. Never CREATE, ALTER or DROP a table from a runnable.
86691
86716
  4. **Qualify table names**: an unqualified name means the \`public\` schema, so write every other table as \`schema.table\`, in table creation and queries alike. The app's \`data\` config sets the default datatable and schema its tables go in; use them consistently across runnables.
86692
86717
  5. **Pass the role**: when the app's \`data.roles\` gives a data table a role, every \`wmill.datatable\` call on it passes that role (\`wmill.datatable('main', { role: 'analyst' })\` in TypeScript, \`wmill.datatable('main', role='analyst')\` in Python). The role only reaches what it was granted, so a query outside it fails with \`permission denied\`.
86693
- 6. **Per-viewer rows**: a data table with no entry in \`data.roles\` is called with no role. Unless its default role is \`admin\`, the connection then holds the default role, if it has one, plus every role the person using the app is a tenant of, and is refused when that is none. Row-level security policies written as \`pg_has_role(current_user, '<role>', 'member')\` return that viewer's rows with nothing added to the runnable. A role pins the connection to that one role for every viewer, so where rows should differ per viewer give the data table no \`data.roles\` entry.
86718
+ 6. **Per-viewer rows**: a data table with no entry in \`data.roles\` is called with no role. Unless its default role is \`admin\`, the connection then holds the default role, if it may use it, plus every role it is a tenant of, and is refused when that is none. Whose roles those are follows the runnable's identity (see "Reading data as the viewer"). Row-level security policies written as \`pg_has_role(current_user, '<role>', 'member')\` then return the right rows with nothing added to the code. A role pins the connection to that one role either way, so a data table whose rows should differ per viewer gets no \`data.roles\` entry. Data table roles are an Enterprise Edition feature, self-hosted only.
86694
86719
 
86695
86720
  \`wmill datatable list\` lists the workspace's data tables. Create or change tables with a migration in \`sql_to_apply/\` (see "SQL Migrations" above), then add them to \`data.tables\` in \`raw_app.yaml\`.
86696
86721
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-cli",
3
- "version": "1.831.0",
3
+ "version": "1.833.0",
4
4
  "description": "CLI for Windmill",
5
5
  "license": "Apache 2.0",
6
6
  "type": "module",