windmill-cli 1.684.1 → 1.685.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 +212 -19
  2. package/package.json +1 -1
package/esm/main.js CHANGED
@@ -11812,7 +11812,7 @@ var init_OpenAPI = __esm(() => {
11812
11812
  PASSWORD: undefined,
11813
11813
  TOKEN: getEnv2("WM_TOKEN"),
11814
11814
  USERNAME: undefined,
11815
- VERSION: "1.684.1",
11815
+ VERSION: "1.685.0",
11816
11816
  WITH_CREDENTIALS: true,
11817
11817
  interceptors: {
11818
11818
  request: new Interceptors,
@@ -63310,7 +63310,11 @@ async function generateFlowHash(rawWorkspaceDependencies, folder, defaultTs) {
63310
63310
  hashes[normalizedPath] = await generateHash(await f.getContentText() + JSON.stringify(rawWorkspaceDependencies));
63311
63311
  }
63312
63312
  }
63313
- return { ...hashes, [TOP_HASH]: await generateHash(JSON.stringify(hashes)) };
63313
+ const sortedHashes = {};
63314
+ for (const k of Object.keys(hashes).sort()) {
63315
+ sortedHashes[k] = hashes[k];
63316
+ }
63317
+ return { ...sortedHashes, [TOP_HASH]: await generateHash(JSON.stringify(sortedHashes)) };
63314
63318
  }
63315
63319
  async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpdateMetadataLock, noStaleMessage, tree) {
63316
63320
  if (folder.endsWith(SEP7)) {
@@ -64851,7 +64855,7 @@ async function ignoreF(wmillconf) {
64851
64855
  };
64852
64856
  }
64853
64857
  async function addToChangedIfNotExists(p, tracker) {
64854
- const isScript = exts.some((e) => p.endsWith(e));
64858
+ const isScript = exts.some((e) => p.endsWith(e)) && !isFileResource(p) && !isFilesetResource(p);
64855
64859
  if (isScript) {
64856
64860
  if (isFlowPath(p)) {
64857
64861
  const folder = extractFolderPath(p, "flow");
@@ -66453,7 +66457,7 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
66453
66457
  newMetadataContent = import_yaml13.stringify(metadataParsedContent, yamlOptions);
66454
66458
  }
66455
66459
  }
66456
- const metadataContentUsedForHash = newMetadataContent;
66460
+ const metadataContentUsedForHash = justUpdateMetadataLock ? metadataContent : newMetadataContent;
66457
66461
  hash2 = await generateScriptHash(depsForHash, scriptContent, metadataContentUsedForHash);
66458
66462
  if (hasModuleHashes) {
66459
66463
  const sortedEntries = Object.entries(moduleHashes).sort(([a], [b]) => a.localeCompare(b));
@@ -67394,7 +67398,11 @@ async function generateAppHash(rawReqs, folder, rawApp, defaultTs) {
67394
67398
  throw error2;
67395
67399
  }
67396
67400
  }
67397
- return { ...hashes, [TOP_HASH2]: await generateHash(JSON.stringify(hashes)) };
67401
+ const sortedHashes = {};
67402
+ for (const k of Object.keys(hashes).sort()) {
67403
+ sortedHashes[k] = hashes[k];
67404
+ }
67405
+ return { ...sortedHashes, [TOP_HASH2]: await generateHash(JSON.stringify(sortedHashes)) };
67398
67406
  }
67399
67407
  async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, opts, justUpdateMetadataLock, noStaleMessage, tree) {
67400
67408
  if (appFolder.endsWith(SEP11)) {
@@ -72797,6 +72805,9 @@ function getTypeStrFromPath(p) {
72797
72805
  if (p.startsWith("dependencies" + SEP18)) {
72798
72806
  return "workspace_dependencies";
72799
72807
  }
72808
+ if (isFileResource(p) || isFilesetResource(p)) {
72809
+ return "resource";
72810
+ }
72800
72811
  const parsed = path18.parse(p);
72801
72812
  if (parsed.ext == ".go" || parsed.ext == ".ts" || parsed.ext == ".sh" || parsed.ext == ".py" || parsed.ext == ".sql" || parsed.ext == ".gql" || parsed.ext == ".ps1" || parsed.ext == ".js" || parsed.ext == ".php" || parsed.ext == ".rs" || parsed.ext == ".cs" || parsed.ext == ".nu" || parsed.ext == ".java" || parsed.ext == ".rb" || parsed.ext == ".r" || parsed.ext == ".yml" && parsed.name.split(".").pop() == "playbook") {
72802
72813
  return "script";
@@ -72817,9 +72828,6 @@ function getTypeStrFromPath(p) {
72817
72828
  if (typeEnding === "script" || typeEnding === "variable" || typeEnding === "resource" || typeEnding === "resource-type" || typeEnding === "app" || typeEnding === "schedule" || typeEnding === "http_trigger" || typeEnding === "websocket_trigger" || typeEnding === "kafka_trigger" || typeEnding === "nats_trigger" || typeEnding === "postgres_trigger" || typeEnding === "mqtt_trigger" || typeEnding === "sqs_trigger" || typeEnding === "gcp_trigger" || typeEnding === "email_trigger" || typeEnding === "user" || typeEnding === "group" || typeEnding === "settings" || typeEnding === "encryption_key") {
72818
72829
  return typeEnding;
72819
72830
  } else {
72820
- if (isFileResource(p) || isFilesetResource(p)) {
72821
- return "resource";
72822
- }
72823
72831
  throw new Error("Could not infer type of path " + JSON.stringify(parsed));
72824
72832
  }
72825
72833
  }
@@ -81026,6 +81034,53 @@ The OpenFlow schema (openflow.openapi.yaml) is the source of truth for flow stru
81026
81034
  - \`preprocessor\` - Reserved for preprocessor module
81027
81035
  - \`Input\` - Reserved for flow input reference
81028
81036
 
81037
+ ## Hard Structural Rules
81038
+
81039
+ These are strict Windmill schema rules. Follow them exactly.
81040
+
81041
+ - \`value.modules\` is only for normal sequential steps
81042
+ - \`value.preprocessor_module\` and \`value.failure_module\` are special top-level fields inside \`value\`, not entries in \`value.modules\`
81043
+ - If a flow needs a preprocessor, create \`value.preprocessor_module\` with \`id: preprocessor\`
81044
+ - If a flow needs a failure handler, create \`value.failure_module\` with \`id: failure\`
81045
+ - Do NOT create regular modules inside \`value.modules\` named \`preprocessor\` or \`failure\`
81046
+ - \`preprocessor_module\` and \`failure_module\` only support \`script\` or \`rawscript\`
81047
+ - \`preprocessor_module\` runs before normal modules and cannot reference \`results.*\`
81048
+ - \`failure_module\` can use the \`error\` object with \`error.message\`, \`error.step_id\`, \`error.name\`, and \`error.stack\`
81049
+
81050
+ Correct shape:
81051
+
81052
+ \`\`\`yaml
81053
+ value:
81054
+ preprocessor_module:
81055
+ id: preprocessor
81056
+ value:
81057
+ type: rawscript
81058
+ ...
81059
+ failure_module:
81060
+ id: failure
81061
+ value:
81062
+ type: rawscript
81063
+ ...
81064
+ modules:
81065
+ - id: process_event
81066
+ value:
81067
+ type: rawscript
81068
+ ...
81069
+ \`\`\`
81070
+
81071
+ Incorrect shape:
81072
+
81073
+ \`\`\`yaml
81074
+ value:
81075
+ modules:
81076
+ - id: preprocessor
81077
+ ...
81078
+ - id: process_event
81079
+ ...
81080
+ - id: failure
81081
+ ...
81082
+ \`\`\`
81083
+
81029
81084
  ## Module ID Rules
81030
81085
 
81031
81086
  - Must be unique across the entire flow
@@ -81041,10 +81096,148 @@ The OpenFlow schema (openflow.openapi.yaml) is the source of truth for flow stru
81041
81096
  ## Data Flow Between Steps
81042
81097
 
81043
81098
  - \`flow_input.property\` - Access flow input parameters
81044
- - \`results.step_id\` - Access output from a previous step
81045
- - \`results.step_id.property\` - Access specific property from previous step output
81046
- - \`flow_input.iter.value\` - Current item when inside a for-loop
81047
- - \`flow_input.iter.index\` - Current index when inside a for-loop
81099
+ - \`results.step_id\` - Access output from a previous step only when that step result is in scope
81100
+ - \`results.step_id.property\` - Access specific property from a previous step output only when that step result is in scope
81101
+ - \`flow_input.iter.value\` - Current iteration value when inside a loop (\`forloopflow\` or \`whileloopflow\`)
81102
+ - \`flow_input.iter.index\` - Current loop index when inside a loop (\`forloopflow\` or \`whileloopflow\`)
81103
+
81104
+ ## Loop Structure Rules
81105
+
81106
+ - For \`whileloopflow\`, use module-level \`stop_after_if\` on the loop module itself when the loop should stop after an iteration result
81107
+ - Do NOT put \`stop_after_if\` inside \`value\` of a \`whileloopflow\`
81108
+ - \`stop_after_all_iters_if\` is for checks after the whole loop finishes, not the normal per-iteration break condition
81109
+ - When a \`whileloopflow\` carries state forward between iterations, use \`flow_input.iter.value\` as the current loop value and provide an explicit first-iteration fallback when needed
81110
+ - Use \`flow_input.iter.index\` only when the loop logic is truly based on the iteration index, not as a replacement for the current loop value
81111
+ - If the user asks for a final scalar/object after a loop, add a normal step after the loop that extracts the final value from the loop result instead of returning the whole loop result array
81112
+
81113
+ Correct \`whileloopflow\` shape:
81114
+
81115
+ \`\`\`yaml
81116
+ - id: loop_until_done
81117
+ stop_after_if:
81118
+ expr: result.done === true
81119
+ skip_if_stopped: false
81120
+ value:
81121
+ type: whileloopflow
81122
+ skip_failures: false
81123
+ modules:
81124
+ - id: advance_state
81125
+ value:
81126
+ type: rawscript
81127
+ input_transforms:
81128
+ state:
81129
+ type: javascript
81130
+ expr: flow_input.iter && flow_input.iter.value !== undefined ? flow_input.iter.value : flow_input.initial_state
81131
+ - id: return_final_state
81132
+ value:
81133
+ type: rawscript
81134
+ input_transforms:
81135
+ final_state:
81136
+ type: javascript
81137
+ expr: results.loop_until_done[results.loop_until_done.length - 1]
81138
+ \`\`\`
81139
+
81140
+ Incorrect \`whileloopflow\` patterns:
81141
+
81142
+ \`\`\`yaml
81143
+ - id: loop_until_done
81144
+ value:
81145
+ type: whileloopflow
81146
+ stop_after_if:
81147
+ expr: result.done === true
81148
+ \`\`\`
81149
+
81150
+ \`\`\`yaml
81151
+ input_transforms:
81152
+ state:
81153
+ type: javascript
81154
+ expr: flow_input.iter.index
81155
+ \`\`\`
81156
+
81157
+ \`\`\`yaml
81158
+ input_transforms:
81159
+ final_state:
81160
+ type: javascript
81161
+ expr: results.loop_until_done
81162
+ \`\`\`
81163
+
81164
+ ## Approval / Suspend Structure
81165
+
81166
+ - \`suspend\` belongs on the flow module object itself, as a sibling of \`id\` and \`value\`
81167
+ - Never put \`suspend\` inside \`value\`
81168
+
81169
+ Correct shape:
81170
+
81171
+ \`\`\`yaml
81172
+ - id: request_approval
81173
+ suspend:
81174
+ required_events: 1
81175
+ resume_form:
81176
+ schema:
81177
+ type: object
81178
+ properties:
81179
+ comment:
81180
+ type: string
81181
+ required: [comment]
81182
+ value:
81183
+ type: identity
81184
+ \`\`\`
81185
+
81186
+ Incorrect shape:
81187
+
81188
+ \`\`\`yaml
81189
+ - id: request_approval
81190
+ value:
81191
+ type: rawscript
81192
+ suspend:
81193
+ required_events: 1
81194
+ \`\`\`
81195
+
81196
+ ## Branch Result Scope Rules
81197
+
81198
+ - Inside a branch, you may reference earlier outer steps and earlier steps in the same branch
81199
+ - Outside a \`branchone\`, do NOT reference ids of steps that only exist inside its branches or default branch. Use \`results.<branchone_module_id>\` instead
81200
+ - Outside a \`branchall\`, do NOT reference ids of steps inside its branches. Use \`results.<branchall_module_id>\` instead
81201
+ - If downstream steps need a stable shape after a branch, make each branch return the same fields
81202
+ - When needed, add a normalization step immediately after the branch and consume \`results.<branch_module_id>\` there
81203
+
81204
+ Correct after \`branchone\`:
81205
+
81206
+ \`\`\`yaml
81207
+ - id: route_order
81208
+ value:
81209
+ type: branchone
81210
+ ...
81211
+ - id: send_confirmation
81212
+ value:
81213
+ input_transforms:
81214
+ routed:
81215
+ type: javascript
81216
+ expr: results.route_order
81217
+ \`\`\`
81218
+
81219
+ Incorrect after \`branchone\`:
81220
+
81221
+ \`\`\`yaml
81222
+ expr: results.create_shipment
81223
+ expr: results.create_backorder
81224
+ \`\`\`
81225
+
81226
+ Correct after \`branchall\`:
81227
+
81228
+ \`\`\`yaml
81229
+ - id: enrich_parallel
81230
+ value:
81231
+ type: branchall
81232
+ parallel: true
81233
+ ...
81234
+ - id: combine_data
81235
+ value:
81236
+ input_transforms:
81237
+ enrichments:
81238
+ type: javascript
81239
+ expr: results.enrich_parallel
81240
+ \`\`\`
81048
81241
 
81049
81242
  ## Input Transforms
81050
81243
 
@@ -81061,14 +81254,14 @@ JavaScript transform (dynamic expression):
81061
81254
  - For flow inputs: Use type \`"object"\` with format \`"resource-{type}"\` (e.g., \`"resource-postgresql"\`)
81062
81255
  - For step inputs: Use static value \`"$res:path/to/resource"\`
81063
81256
 
81064
- ## Failure Handler
81257
+ ## Final Structural Self-Check
81065
81258
 
81066
- Executes when any step fails. Has access to error details:
81259
+ Before finalizing a flow, verify:
81067
81260
 
81068
- - \`error.message\` - Error message
81069
- - \`error.step_id\` - ID of failed step
81070
- - \`error.name\` - Error name
81071
- - \`error.stack\` - Stack trace
81261
+ - any preprocessor is in \`value.preprocessor_module\`
81262
+ - any failure handler is in \`value.failure_module\`
81263
+ - any approval step has module-level \`suspend\`
81264
+ - no downstream step references inner branch step ids from outside the branch
81072
81265
 
81073
81266
  ## S3 Object Operations
81074
81267
 
@@ -85186,7 +85379,7 @@ var config_default = command35;
85186
85379
 
85187
85380
  // src/main.ts
85188
85381
  await init_context();
85189
- var VERSION = "1.684.1";
85382
+ var VERSION = "1.685.0";
85190
85383
  async function checkVersionSafe(cmd) {
85191
85384
  const mainCommand = cmd.getMainCommand();
85192
85385
  const upgradeCommand = mainCommand.getCommand("upgrade");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-cli",
3
- "version": "1.684.1",
3
+ "version": "1.685.0",
4
4
  "description": "CLI for Windmill",
5
5
  "license": "Apache 2.0",
6
6
  "type": "module",