windmill-cli 1.700.2 → 1.701.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 +33 -23
  2. package/package.json +1 -1
package/esm/main.js CHANGED
@@ -16752,7 +16752,7 @@ var init_OpenAPI = __esm(() => {
16752
16752
  PASSWORD: undefined,
16753
16753
  TOKEN: getEnv3("WM_TOKEN"),
16754
16754
  USERNAME: undefined,
16755
- VERSION: "1.700.2",
16755
+ VERSION: "1.701.0",
16756
16756
  WITH_CREDENTIALS: true,
16757
16757
  interceptors: {
16758
16758
  request: new Interceptors,
@@ -44417,7 +44417,7 @@ var require_zipEntries = __commonJS((exports, module) => {
44417
44417
  if (this.centralDirRecords !== this.files.length) {
44418
44418
  if (this.centralDirRecords !== 0 && this.files.length === 0) {
44419
44419
  throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length);
44420
- } else {}
44420
+ }
44421
44421
  }
44422
44422
  },
44423
44423
  readEndOfCentral: function() {
@@ -55347,7 +55347,7 @@ var require_loader = __commonJS((exports, module) => {
55347
55347
  var error2 = generateError(state, message);
55348
55348
  if (state.onWarning) {
55349
55349
  state.onWarning.call(null, error2);
55350
- } else {}
55350
+ }
55351
55351
  }
55352
55352
  var directiveHandlers = {
55353
55353
  YAML: function handleYamlDirective(state, name, args) {
@@ -55885,7 +55885,7 @@ var require_loader = __commonJS((exports, module) => {
55885
55885
  } else if (detectedIndent) {
55886
55886
  sc.value += common3.repeat(`
55887
55887
  `, emptyLines + 1);
55888
- } else {}
55888
+ }
55889
55889
  detectedIndent = true;
55890
55890
  emptyLines = 0;
55891
55891
  captureStart = state.position;
@@ -64370,12 +64370,16 @@ var init_path_assigner = __esm(() => {
64370
64370
  });
64371
64371
 
64372
64372
  // windmill-utils-internal/src/inline-scripts/extractor.ts
64373
- function extractRawscriptInline(id, summary, rawscript, mapping, separator, assigner) {
64373
+ function extractRawscriptInline(id, summary, rawscript, mapping, separator, assigner, failOnInlineDirective) {
64374
64374
  const [basePath, ext2] = assigner.assignPath(summary ?? id, rawscript.language);
64375
64375
  const mappedPath = mapping[id];
64376
64376
  const path10 = mappedPath ?? basePath + ext2;
64377
64377
  const language = rawscript.language;
64378
64378
  const content = rawscript.content;
64379
+ if (failOnInlineDirective && typeof content === "string" && content.startsWith("!inline ")) {
64380
+ throw new Error(`Refusing to extract corrupted inline script for module '${id}': ` + `rawscript.content is the literal string \`${content.split(`
64381
+ `)[0]}\` ` + `instead of script source. The backend's flow_version.value is corrupt — ` + `re-push from a known-good local copy to repair it.`);
64382
+ }
64379
64383
  const r = [{ path: path10, content, language, is_lock: false }];
64380
64384
  rawscript.content = "!inline " + path10.replaceAll(separator, "/");
64381
64385
  const lock = rawscript.lock;
@@ -64390,19 +64394,20 @@ function extractRawscriptInline(id, summary, rawscript, mapping, separator, assi
64390
64394
  }
64391
64395
  function extractInlineScripts(modules, mapping = {}, separator = "/", defaultTs, pathAssigner, options) {
64392
64396
  const assigner = pathAssigner ?? newPathAssigner(defaultTs ?? "bun", { skipInlineScriptSuffix: options?.skipInlineScriptSuffix });
64397
+ const failOnInlineDirective = options?.failOnInlineDirective ?? false;
64393
64398
  return modules.flatMap((m) => {
64394
64399
  if (m.value.type == "rawscript") {
64395
- return extractRawscriptInline(m.id, m.summary, m.value, mapping, separator, assigner);
64400
+ return extractRawscriptInline(m.id, m.summary, m.value, mapping, separator, assigner, failOnInlineDirective);
64396
64401
  } else if (m.value.type == "forloopflow") {
64397
- return extractInlineScripts(m.value.modules, mapping, separator, defaultTs, assigner);
64402
+ return extractInlineScripts(m.value.modules, mapping, separator, defaultTs, assigner, options);
64398
64403
  } else if (m.value.type == "branchall") {
64399
- return m.value.branches.flatMap((b) => extractInlineScripts(b.modules, mapping, separator, defaultTs, assigner));
64404
+ return m.value.branches.flatMap((b) => extractInlineScripts(b.modules, mapping, separator, defaultTs, assigner, options));
64400
64405
  } else if (m.value.type == "whileloopflow") {
64401
- return extractInlineScripts(m.value.modules, mapping, separator, defaultTs, assigner);
64406
+ return extractInlineScripts(m.value.modules, mapping, separator, defaultTs, assigner, options);
64402
64407
  } else if (m.value.type == "branchone") {
64403
64408
  return [
64404
- ...m.value.branches.flatMap((b) => extractInlineScripts(b.modules, mapping, separator, defaultTs, assigner)),
64405
- ...extractInlineScripts(m.value.default, mapping, separator, defaultTs, assigner)
64409
+ ...m.value.branches.flatMap((b) => extractInlineScripts(b.modules, mapping, separator, defaultTs, assigner, options)),
64410
+ ...extractInlineScripts(m.value.default, mapping, separator, defaultTs, assigner, options)
64406
64411
  ];
64407
64412
  } else if (m.value.type == "aiagent") {
64408
64413
  return (m.value.tools ?? []).flatMap((tool) => {
@@ -64410,7 +64415,7 @@ function extractInlineScripts(modules, mapping = {}, separator = "/", defaultTs,
64410
64415
  if (!toolValue || toolValue.tool_type !== "flowmodule" || toolValue.type !== "rawscript") {
64411
64416
  return [];
64412
64417
  }
64413
- return extractRawscriptInline(tool.id, tool.summary, toolValue, mapping, separator, assigner);
64418
+ return extractRawscriptInline(tool.id, tool.summary, toolValue, mapping, separator, assigner, failOnInlineDirective);
64414
64419
  });
64415
64420
  } else {
64416
64421
  return [];
@@ -64786,12 +64791,16 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
64786
64791
  const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path10.basename(k, path10.extname(k));
64787
64792
  return tree.isStale(treePath);
64788
64793
  }) : changedScripts;
64789
- await replaceInlineScripts(flowValue.value.modules, fileReader, exports_log, folder + SEP7, SEP7, locksToRemove);
64794
+ const missingFiles = [];
64795
+ await replaceInlineScripts(flowValue.value.modules, fileReader, exports_log, folder + SEP7, SEP7, locksToRemove, missingFiles);
64790
64796
  if (flowValue.value.failure_module) {
64791
- await replaceInlineScripts([flowValue.value.failure_module], fileReader, exports_log, folder + SEP7, SEP7, locksToRemove);
64797
+ await replaceInlineScripts([flowValue.value.failure_module], fileReader, exports_log, folder + SEP7, SEP7, locksToRemove, missingFiles);
64792
64798
  }
64793
64799
  if (flowValue.value.preprocessor_module) {
64794
- await replaceInlineScripts([flowValue.value.preprocessor_module], fileReader, exports_log, folder + SEP7, SEP7, locksToRemove);
64800
+ await replaceInlineScripts([flowValue.value.preprocessor_module], fileReader, exports_log, folder + SEP7, SEP7, locksToRemove, missingFiles);
64801
+ }
64802
+ if (missingFiles.length > 0) {
64803
+ throw new Error(`Cannot regenerate lock for flow ${remote_path}: missing inline script file(s): ${missingFiles.join(", ")}. ` + `Either restore the file(s) or remove the !inline reference(s) from flow.yaml before retrying.`);
64795
64804
  }
64796
64805
  const tempScriptRefs = tree?.getTempScriptRefs(folderNormalized);
64797
64806
  const savedNotes = flowValue.value.notes;
@@ -64804,12 +64813,13 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
64804
64813
  const lockAssigner = newPathAssigner(opts.defaultTs ?? "bun", {
64805
64814
  skipInlineScriptSuffix: getNonDottedPaths()
64806
64815
  });
64807
- const inlineScripts = extractInlineScripts(flowValue.value.modules, currentMapping, SEP7, opts.defaultTs, lockAssigner);
64816
+ const extractOpts = { skipInlineScriptSuffix: getNonDottedPaths(), failOnInlineDirective: true };
64817
+ const inlineScripts = extractInlineScripts(flowValue.value.modules, currentMapping, SEP7, opts.defaultTs, lockAssigner, extractOpts);
64808
64818
  if (flowValue.value.failure_module) {
64809
- inlineScripts.push(...extractInlineScripts([flowValue.value.failure_module], currentMapping, SEP7, opts.defaultTs, lockAssigner));
64819
+ inlineScripts.push(...extractInlineScripts([flowValue.value.failure_module], currentMapping, SEP7, opts.defaultTs, lockAssigner, extractOpts));
64810
64820
  }
64811
64821
  if (flowValue.value.preprocessor_module) {
64812
- inlineScripts.push(...extractInlineScripts([flowValue.value.preprocessor_module], currentMapping, SEP7, opts.defaultTs, lockAssigner));
64822
+ inlineScripts.push(...extractInlineScripts([flowValue.value.preprocessor_module], currentMapping, SEP7, opts.defaultTs, lockAssigner, extractOpts));
64813
64823
  }
64814
64824
  inlineScripts.forEach((s) => {
64815
64825
  writeIfChanged(process.cwd() + SEP7 + folder + SEP7 + s.path, s.content);
@@ -65931,12 +65941,12 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
65931
65941
  try {
65932
65942
  const assigner = newPathAssigner(defaultTs, { skipInlineScriptSuffix: getNonDottedPaths() });
65933
65943
  const inlineMapping = extractCurrentMapping(flow.value.modules, {}, flow.value.failure_module, flow.value.preprocessor_module);
65934
- inlineScripts = extractInlineScripts(flow.value.modules, inlineMapping, SEP9, defaultTs, assigner, { skipInlineScriptSuffix: getNonDottedPaths() });
65944
+ inlineScripts = extractInlineScripts(flow.value.modules, inlineMapping, SEP9, defaultTs, assigner, { skipInlineScriptSuffix: getNonDottedPaths(), failOnInlineDirective: true });
65935
65945
  if (flow.value.failure_module) {
65936
- inlineScripts.push(...extractInlineScripts([flow.value.failure_module], inlineMapping, SEP9, defaultTs, assigner, { skipInlineScriptSuffix: getNonDottedPaths() }));
65946
+ inlineScripts.push(...extractInlineScripts([flow.value.failure_module], inlineMapping, SEP9, defaultTs, assigner, { skipInlineScriptSuffix: getNonDottedPaths(), failOnInlineDirective: true }));
65937
65947
  }
65938
65948
  if (flow.value.preprocessor_module) {
65939
- inlineScripts.push(...extractInlineScripts([flow.value.preprocessor_module], inlineMapping, SEP9, defaultTs, assigner, { skipInlineScriptSuffix: getNonDottedPaths() }));
65949
+ inlineScripts.push(...extractInlineScripts([flow.value.preprocessor_module], inlineMapping, SEP9, defaultTs, assigner, { skipInlineScriptSuffix: getNonDottedPaths(), failOnInlineDirective: true }));
65940
65950
  }
65941
65951
  } catch (error2) {
65942
65952
  error(`Failed to extract inline scripts for flow at path: ${p}`);
@@ -75684,7 +75694,7 @@ async function pushFlow(workspace, remotePath, localPath, message, permissionedA
75684
75694
  await replaceInlineScripts([localFlow.value.preprocessor_module], fileReader, exports_log, localPath, SEP20, undefined, missingFiles);
75685
75695
  }
75686
75696
  if (missingFiles.length > 0) {
75687
- warn(colors.yellow(`Warning: missing inline script file(s): ${missingFiles.join(", ")}. ` + `The flow will be pushed with unresolved !inline references.`));
75697
+ throw new Error(`Cannot push flow ${remotePath}: missing inline script file(s): ${missingFiles.join(", ")}. ` + `Either restore the file(s) or remove the !inline reference(s) from flow.yaml before pushing.`);
75688
75698
  }
75689
75699
  const hasOnBehalfOf = localFlow.has_on_behalf_of ?? !!localFlow.on_behalf_of_email;
75690
75700
  delete localFlow.has_on_behalf_of;
@@ -89676,7 +89686,7 @@ var config_default = command35;
89676
89686
 
89677
89687
  // src/main.ts
89678
89688
  await init_context();
89679
- var VERSION = "1.700.2";
89689
+ var VERSION = "1.701.0";
89680
89690
  async function checkVersionSafe(cmd) {
89681
89691
  const mainCommand = cmd.getMainCommand();
89682
89692
  const upgradeCommand = mainCommand.getCommand("upgrade");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-cli",
3
- "version": "1.700.2",
3
+ "version": "1.701.0",
4
4
  "description": "CLI for Windmill",
5
5
  "license": "Apache 2.0",
6
6
  "type": "module",