windmill-cli 1.684.1 → 1.686.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 +868 -609
  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.686.0",
11816
11816
  WITH_CREDENTIALS: true,
11817
11817
  interceptors: {
11818
11818
  request: new Interceptors,
@@ -26760,6 +26760,70 @@ var init_conf = __esm(async () => {
26760
26760
  RESERVED_WORKSPACE_KEYS = new Set(["commonSpecificItems"]);
26761
26761
  });
26762
26762
 
26763
+ // src/commands/resource-type/tsconfig.ts
26764
+ import { execSync as execSync3 } from "node:child_process";
26765
+ import { existsSync as existsSync3, writeFileSync as writeFileSync2 } from "node:fs";
26766
+ import path3 from "node:path";
26767
+ import process10 from "node:process";
26768
+ async function generateTsconfigForIde() {
26769
+ const tsconfigPath = path3.join(process10.cwd(), "tsconfig.json");
26770
+ if (existsSync3(tsconfigPath)) {
26771
+ info(colors.gray("tsconfig.json already exists, skipping"));
26772
+ return;
26773
+ }
26774
+ let defaultTs = "bun";
26775
+ try {
26776
+ const conf = await readConfigFile({ warnIfMissing: false });
26777
+ if (conf?.defaultTs === "deno") {
26778
+ defaultTs = "deno";
26779
+ }
26780
+ } catch {}
26781
+ const bunTypesAvailable = defaultTs === "bun" ? ensureBunTypesAvailable() : false;
26782
+ const tsconfig = {
26783
+ compilerOptions: {
26784
+ target: "ESNext",
26785
+ module: "ESNext",
26786
+ moduleResolution: "bundler",
26787
+ noEmit: true,
26788
+ strict: false
26789
+ },
26790
+ include: ["**/*.ts", "rt.d.ts"]
26791
+ };
26792
+ if (bunTypesAvailable) {
26793
+ tsconfig.compilerOptions.types = ["bun-types"];
26794
+ }
26795
+ writeFileSync2(tsconfigPath, JSON.stringify(tsconfig, null, 2) + `
26796
+ `);
26797
+ info(colors.green("Created tsconfig.json for IDE type support."));
26798
+ }
26799
+ function ensureBunTypesAvailable() {
26800
+ const cwd = process10.cwd();
26801
+ if (existsSync3(path3.join(cwd, "node_modules", "bun-types"))) {
26802
+ return true;
26803
+ }
26804
+ try {
26805
+ execSync3("bun --version", { stdio: "ignore" });
26806
+ } catch {
26807
+ info(`Install bun (https://bun.sh) then run 'bun add -d bun-types' and add "types": ["bun-types"] to tsconfig.json for Bun API autocompletion.`);
26808
+ return false;
26809
+ }
26810
+ try {
26811
+ info(colors.yellow("Installing bun-types with 'bun add -d bun-types'..."));
26812
+ execSync3("bun add -d bun-types", { stdio: "inherit" });
26813
+ info(colors.green("Installed bun-types."));
26814
+ return true;
26815
+ } catch (e) {
26816
+ warn(`Failed to install bun-types automatically: ${e instanceof Error ? e.message : e}`);
26817
+ info(`Run 'bun add -d bun-types' manually and add "types": ["bun-types"] to tsconfig.json for Bun API autocompletion.`);
26818
+ return false;
26819
+ }
26820
+ }
26821
+ var init_tsconfig = __esm(async () => {
26822
+ init_colors2();
26823
+ init_log();
26824
+ await init_conf();
26825
+ });
26826
+
26763
26827
  // src/utils/resource_types.ts
26764
26828
  function compileResourceTypeToTsType(schema) {
26765
26829
  function rec(x, root = false) {
@@ -26802,10 +26866,10 @@ __export(exports_resource_type, {
26802
26866
  generateRTNamespace: () => generateRTNamespace,
26803
26867
  default: () => resource_type_default
26804
26868
  });
26805
- import { writeFileSync as writeFileSync2 } from "node:fs";
26869
+ import { writeFileSync as writeFileSync3 } from "node:fs";
26806
26870
  import { stat as stat3, writeFile as writeFile2 } from "node:fs/promises";
26807
- import path3 from "node:path";
26808
- import process10 from "node:process";
26871
+ import path4 from "node:path";
26872
+ import process11 from "node:process";
26809
26873
  async function pushResourceType(workspace, remotePath, resource, localResource) {
26810
26874
  remotePath = removeType(remotePath, "resource-type");
26811
26875
  try {
@@ -26890,12 +26954,12 @@ async function newResourceType(opts, name) {
26890
26954
  });
26891
26955
  info(colors.green(`Created ${filePath}`));
26892
26956
  }
26893
- async function get(opts, path4) {
26957
+ async function get(opts, path5) {
26894
26958
  const workspace = await resolveWorkspace(opts);
26895
26959
  await requireLogin(opts);
26896
26960
  const rt = await getResourceType({
26897
26961
  workspace: workspace.workspaceId,
26898
- path: path4
26962
+ path: path5
26899
26963
  });
26900
26964
  if (opts.json) {
26901
26965
  console.log(JSON.stringify(rt));
@@ -26925,8 +26989,9 @@ async function generateRTNamespace(opts) {
26925
26989
  `);
26926
26990
  namespaceContent += `
26927
26991
  }`;
26928
- writeFileSync2(path3.join(process10.cwd(), "rt.d.ts"), namespaceContent);
26992
+ writeFileSync3(path4.join(process11.cwd(), "rt.d.ts"), namespaceContent);
26929
26993
  info(colors.green("Created rt.d.ts with resource types namespace (RT) for TypeScript."));
26994
+ await generateTsconfigForIde();
26930
26995
  }
26931
26996
  var import_yaml5, command, resource_type_default;
26932
26997
  var init_resource_type = __esm(async () => {
@@ -26939,6 +27004,7 @@ var init_resource_type = __esm(async () => {
26939
27004
  init_types(),
26940
27005
  init_auth(),
26941
27006
  init_context(),
27007
+ init_tsconfig(),
26942
27008
  init_utils()
26943
27009
  ]);
26944
27010
  import_yaml5 = __toESM(require_dist(), 1);
@@ -26961,7 +27027,7 @@ __export(exports_workspace, {
26961
27027
  add: () => add
26962
27028
  });
26963
27029
  import { readFile as readFile3, writeFile as writeFile3, open as fsOpen } from "node:fs/promises";
26964
- import process11 from "node:process";
27030
+ import process12 from "node:process";
26965
27031
  async function allWorkspaces(configDirOverride) {
26966
27032
  try {
26967
27033
  const file = await getWorkspaceConfigFilePath(configDirOverride);
@@ -27073,7 +27139,7 @@ async function add(opts, workspaceName, workspaceId, remote) {
27073
27139
  }
27074
27140
  remote = new URL(remote).toString();
27075
27141
  let token = await tryGetLoginInfo(opts);
27076
- if (!token && !(process11.stdin.isTTY ?? false)) {
27142
+ if (!token && !(process12.stdin.isTTY ?? false)) {
27077
27143
  info("Not a TTY, can't login interactively. Pass the token in --token");
27078
27144
  return;
27079
27145
  }
@@ -27115,7 +27181,7 @@ async function add(opts, workspaceName, workspaceId, remote) {
27115
27181
  info(`- ${workspace.id} (name: ${workspace.name})`);
27116
27182
  }
27117
27183
  }
27118
- process11.exit(1);
27184
+ process12.exit(1);
27119
27185
  }
27120
27186
  const added = await addWorkspace({
27121
27187
  name: workspaceName,
@@ -27132,7 +27198,7 @@ async function add(opts, workspaceName, workspaceId, remote) {
27132
27198
  async function addWorkspace(workspace, opts) {
27133
27199
  workspace.remote = new URL(workspace.remote).toString();
27134
27200
  const existingWorkspaces = await allWorkspaces(opts.configDir);
27135
- const isInteractive = (process11.stdin.isTTY ?? false) && (process11.stdout.isTTY ?? false) && !opts.force;
27201
+ const isInteractive = (process12.stdin.isTTY ?? false) && (process12.stdout.isTTY ?? false) && !opts.force;
27136
27202
  const nameConflict = existingWorkspaces.find((w) => w.name === workspace.name);
27137
27203
  if (nameConflict) {
27138
27204
  if (nameConflict.remote === workspace.remote && nameConflict.workspaceId === workspace.workspaceId) {
@@ -27285,7 +27351,7 @@ async function bind(opts, doBind) {
27285
27351
  if (!config.workspaces) {
27286
27352
  config.workspaces = {};
27287
27353
  }
27288
- const isInteractive = !!process11.stdin.isTTY;
27354
+ const isInteractive = !!process12.stdin.isTTY;
27289
27355
  const inGitRepo = isGitRepository2();
27290
27356
  const currentBranch = inGitRepo ? getCurrentGitBranch2() : null;
27291
27357
  if (doBind) {
@@ -27472,16 +27538,16 @@ async function getBranchProfilesPath(configDirOverride) {
27472
27538
  }
27473
27539
  async function loadBranchProfiles(configDirOverride) {
27474
27540
  try {
27475
- const path4 = await getBranchProfilesPath(configDirOverride);
27476
- const content = await readFile4(path4, "utf-8");
27541
+ const path5 = await getBranchProfilesPath(configDirOverride);
27542
+ const content = await readFile4(path5, "utf-8");
27477
27543
  return JSON.parse(content);
27478
27544
  } catch {
27479
27545
  return { lastUsed: {} };
27480
27546
  }
27481
27547
  }
27482
27548
  async function saveBranchProfiles(mapping, configDirOverride) {
27483
- const path4 = await getBranchProfilesPath(configDirOverride);
27484
- await writeFile4(path4, JSON.stringify(mapping, null, 2), "utf-8");
27549
+ const path5 = await getBranchProfilesPath(configDirOverride);
27550
+ await writeFile4(path5, JSON.stringify(mapping, null, 2), "utf-8");
27485
27551
  }
27486
27552
  function getBranchProfileKey(branch, baseUrl2, workspaceId) {
27487
27553
  let normalizedUrl;
@@ -27914,8 +27980,8 @@ async function tryResolveVersion(opts) {
27914
27980
  return;
27915
27981
  }
27916
27982
  }
27917
- function validatePath(path4) {
27918
- if (!(path4.startsWith("g") || path4.startsWith("u") || path4.startsWith("f"))) {
27983
+ function validatePath(path5) {
27984
+ if (!(path5.startsWith("g") || path5.startsWith("u") || path5.startsWith("f"))) {
27919
27985
  info(colors.red("Given remote path looks invalid. Remote paths are typically of the form <u|g|f>/<username|group|folder>/..."));
27920
27986
  return false;
27921
27987
  }
@@ -32741,11 +32807,11 @@ var init_wrapper = __esm(() => {
32741
32807
 
32742
32808
  // src/commands/app/bundle.ts
32743
32809
  import * as fs7 from "node:fs";
32744
- import * as path4 from "node:path";
32745
- import process12 from "node:process";
32810
+ import * as path5 from "node:path";
32811
+ import process13 from "node:process";
32746
32812
  import { spawn } from "node:child_process";
32747
32813
  function detectFrameworks(appDir) {
32748
- const packageJsonPath = path4.join(appDir, "package.json");
32814
+ const packageJsonPath = path5.join(appDir, "package.json");
32749
32815
  if (!fs7.existsSync(packageJsonPath)) {
32750
32816
  return { svelte: false, vue: false };
32751
32817
  }
@@ -32770,7 +32836,7 @@ function createSveltePlugin(appDir) {
32770
32836
  build.onLoad({ filter: /\.svelte$/ }, async (args) => {
32771
32837
  const svelte = await import("svelte/compiler");
32772
32838
  const source = await fs7.promises.readFile(args.path, "utf8");
32773
- const filename = path4.relative(process12.cwd(), args.path);
32839
+ const filename = path5.relative(process13.cwd(), args.path);
32774
32840
  const convertMessage = ({ message, start, end }) => {
32775
32841
  let location;
32776
32842
  if (start && end) {
@@ -32811,8 +32877,8 @@ async function createFrameworkPlugins(appDir) {
32811
32877
  return plugins;
32812
32878
  }
32813
32879
  async function ensureNodeModules(appDir) {
32814
- const targetDir = appDir ?? process12.cwd();
32815
- const nodeModulesPath = path4.join(targetDir, "node_modules");
32880
+ const targetDir = appDir ?? process13.cwd();
32881
+ const nodeModulesPath = path5.join(targetDir, "node_modules");
32816
32882
  if (!fs7.existsSync(nodeModulesPath)) {
32817
32883
  info(colors.yellow("\uD83D\uDCE6 node_modules not found, running npm install..."));
32818
32884
  const code2 = await new Promise((resolve6, reject) => {
@@ -32832,7 +32898,7 @@ async function ensureNodeModules(appDir) {
32832
32898
  }
32833
32899
  async function createBundle(options = {}) {
32834
32900
  const esbuild = await import("esbuild");
32835
- const appDir = options.entryPoint ? path4.dirname(options.entryPoint) : process12.cwd();
32901
+ const appDir = options.entryPoint ? path5.dirname(options.entryPoint) : process13.cwd();
32836
32902
  const frameworks = detectFrameworks(appDir);
32837
32903
  const defaultEntry = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
32838
32904
  const entryPoint = options.entryPoint ?? defaultEntry;
@@ -32845,11 +32911,11 @@ async function createBundle(options = {}) {
32845
32911
  }
32846
32912
  await ensureNodeModules(appDir);
32847
32913
  const frameworkPlugins = await createFrameworkPlugins(appDir);
32848
- const distDir = path4.join(process12.cwd(), outDir);
32914
+ const distDir = path5.join(process13.cwd(), outDir);
32849
32915
  if (!fs7.existsSync(distDir)) {
32850
32916
  fs7.mkdirSync(distDir, { recursive: true });
32851
32917
  }
32852
- const outfile = path4.join(outDir, "bundle.js");
32918
+ const outfile = path5.join(outDir, "bundle.js");
32853
32919
  const wmillTs = rawAppWmillTs_exports.default ?? rawAppWmillTs_exports;
32854
32920
  const wmillPlugin = {
32855
32921
  name: "wmill-virtual",
@@ -32892,8 +32958,8 @@ async function createBundle(options = {}) {
32892
32958
  throw new Error("Build failed with errors");
32893
32959
  }
32894
32960
  info(colors.green("✅ Bundle created successfully"));
32895
- const jsPath = path4.join(process12.cwd(), outfile);
32896
- const cssPath = path4.join(process12.cwd(), outDir, "bundle.css");
32961
+ const jsPath = path5.join(process13.cwd(), outfile);
32962
+ const cssPath = path5.join(process13.cwd(), outDir, "bundle.css");
32897
32963
  if (!fs7.existsSync(jsPath)) {
32898
32964
  throw new Error(`Expected JS bundle at ${jsPath} but file not found`);
32899
32965
  }
@@ -34614,7 +34680,7 @@ var minimatch = (p, pattern, options = {}) => {
34614
34680
  }, qmarksTestNoExtDot = ([$0]) => {
34615
34681
  const len = $0.length;
34616
34682
  return (f) => f.length === len && f !== "." && f !== "..";
34617
- }, defaultPlatform, path5, sep2, GLOBSTAR, qmark2 = "[^/]", star3, twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?", filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options), ext = (a, b = {}) => Object.assign({}, a, b), defaults = (def) => {
34683
+ }, defaultPlatform, path6, sep2, GLOBSTAR, qmark2 = "[^/]", star3, twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?", filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options), ext = (a, b = {}) => Object.assign({}, a, b), defaults = (def) => {
34618
34684
  if (!def || typeof def !== "object" || !Object.keys(def).length) {
34619
34685
  return minimatch;
34620
34686
  }
@@ -34672,11 +34738,11 @@ var init_esm2 = __esm(() => {
34672
34738
  starRE = /^\*+$/;
34673
34739
  qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
34674
34740
  defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
34675
- path5 = {
34741
+ path6 = {
34676
34742
  win32: { sep: "\\" },
34677
34743
  posix: { sep: "/" }
34678
34744
  };
34679
- sep2 = defaultPlatform === "win32" ? path5.win32.sep : path5.posix.sep;
34745
+ sep2 = defaultPlatform === "win32" ? path6.win32.sep : path6.posix.sep;
34680
34746
  minimatch.sep = sep2;
34681
34747
  GLOBSTAR = Symbol("globstar **");
34682
34748
  minimatch.GLOBSTAR = GLOBSTAR;
@@ -37405,8 +37471,8 @@ var require_utils = __commonJS((exports) => {
37405
37471
  var result = transform[inputType][outputType](input);
37406
37472
  return result;
37407
37473
  };
37408
- exports.resolve = function(path6) {
37409
- var parts = path6.split("/");
37474
+ exports.resolve = function(path7) {
37475
+ var parts = path7.split("/");
37410
37476
  var result = [];
37411
37477
  for (var index = 0;index < parts.length; index++) {
37412
37478
  var part = parts[index];
@@ -42856,18 +42922,18 @@ var require_object = __commonJS((exports, module) => {
42856
42922
  var object = new ZipObject(name, zipObjectContent, o);
42857
42923
  this.files[name] = object;
42858
42924
  };
42859
- var parentFolder = function(path6) {
42860
- if (path6.slice(-1) === "/") {
42861
- path6 = path6.substring(0, path6.length - 1);
42925
+ var parentFolder = function(path7) {
42926
+ if (path7.slice(-1) === "/") {
42927
+ path7 = path7.substring(0, path7.length - 1);
42862
42928
  }
42863
- var lastSlash = path6.lastIndexOf("/");
42864
- return lastSlash > 0 ? path6.substring(0, lastSlash) : "";
42929
+ var lastSlash = path7.lastIndexOf("/");
42930
+ return lastSlash > 0 ? path7.substring(0, lastSlash) : "";
42865
42931
  };
42866
- var forceTrailingSlash = function(path6) {
42867
- if (path6.slice(-1) !== "/") {
42868
- path6 += "/";
42932
+ var forceTrailingSlash = function(path7) {
42933
+ if (path7.slice(-1) !== "/") {
42934
+ path7 += "/";
42869
42935
  }
42870
- return path6;
42936
+ return path7;
42871
42937
  };
42872
42938
  var folderAdd = function(name, createFolders) {
42873
42939
  createFolders = typeof createFolders !== "undefined" ? createFolders : defaults2.createFolders;
@@ -49369,8 +49435,8 @@ var require_utils2 = __commonJS((exports, module) => {
49369
49435
  }
49370
49436
  return ind;
49371
49437
  }
49372
- function removeDotSegments(path6) {
49373
- let input = path6;
49438
+ function removeDotSegments(path7) {
49439
+ let input = path7;
49374
49440
  const output = [];
49375
49441
  let nextSlash = -1;
49376
49442
  let len = 0;
@@ -49560,8 +49626,8 @@ var require_schemes = __commonJS((exports, module) => {
49560
49626
  wsComponent.secure = undefined;
49561
49627
  }
49562
49628
  if (wsComponent.resourceName) {
49563
- const [path6, query] = wsComponent.resourceName.split("?");
49564
- wsComponent.path = path6 && path6 !== "/" ? path6 : undefined;
49629
+ const [path7, query] = wsComponent.resourceName.split("?");
49630
+ wsComponent.path = path7 && path7 !== "/" ? path7 : undefined;
49565
49631
  wsComponent.query = query;
49566
49632
  wsComponent.resourceName = undefined;
49567
49633
  }
@@ -52994,13 +53060,13 @@ var require_tslib = __commonJS((exports, module) => {
52994
53060
  }
52995
53061
  return next();
52996
53062
  };
52997
- __rewriteRelativeImportExtension = function(path6, preserveJsx) {
52998
- if (typeof path6 === "string" && /^\.\.?\//.test(path6)) {
52999
- return path6.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext2, cm) {
53063
+ __rewriteRelativeImportExtension = function(path7, preserveJsx) {
53064
+ if (typeof path7 === "string" && /^\.\.?\//.test(path7)) {
53065
+ return path7.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext2, cm) {
53000
53066
  return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext2 || !cm) ? m : d + ext2 + "." + cm.toLowerCase() + "js";
53001
53067
  });
53002
53068
  }
53003
- return path6;
53069
+ return path7;
53004
53070
  };
53005
53071
  exporter("__extends", __extends2);
53006
53072
  exporter("__assign", __assign2);
@@ -56304,19 +56370,19 @@ var require_buildJsonPath = __commonJS((exports) => {
56304
56370
  var types_1 = require_types2();
56305
56371
  var utils_1 = require_utils3();
56306
56372
  function buildJsonPath(node) {
56307
- const path6 = [];
56373
+ const path7 = [];
56308
56374
  let prevNode = node;
56309
56375
  while (node) {
56310
56376
  switch (node.kind) {
56311
56377
  case types_1.Kind.SCALAR:
56312
- path6.unshift(node.value);
56378
+ path7.unshift(node.value);
56313
56379
  break;
56314
56380
  case types_1.Kind.MAPPING:
56315
56381
  if (prevNode !== node.key) {
56316
- if (path6.length > 0 && utils_1.isObject(node.value) && node.value.value === path6[0]) {
56317
- path6[0] = node.key.value;
56382
+ if (path7.length > 0 && utils_1.isObject(node.value) && node.value.value === path7[0]) {
56383
+ path7[0] = node.key.value;
56318
56384
  } else {
56319
- path6.unshift(node.key.value);
56385
+ path7.unshift(node.key.value);
56320
56386
  }
56321
56387
  }
56322
56388
  break;
@@ -56324,9 +56390,9 @@ var require_buildJsonPath = __commonJS((exports) => {
56324
56390
  if (prevNode) {
56325
56391
  const index = node.items.indexOf(prevNode);
56326
56392
  if (prevNode.kind === types_1.Kind.SCALAR) {
56327
- path6[0] = index;
56393
+ path7[0] = index;
56328
56394
  } else if (index !== -1) {
56329
- path6.unshift(index);
56395
+ path7.unshift(index);
56330
56396
  }
56331
56397
  }
56332
56398
  break;
@@ -56334,7 +56400,7 @@ var require_buildJsonPath = __commonJS((exports) => {
56334
56400
  prevNode = node;
56335
56401
  node = node.parent;
56336
56402
  }
56337
- return path6;
56403
+ return path7;
56338
56404
  }
56339
56405
  exports.buildJsonPath = buildJsonPath;
56340
56406
  });
@@ -56393,10 +56459,10 @@ var require_getJsonPathForPosition = __commonJS((exports) => {
56393
56459
  const node = findClosestScalar(ast, Math.min(lineMap[line] - 1, startOffset + character), line, lineMap);
56394
56460
  if (!utils_1.isObject(node))
56395
56461
  return;
56396
- const path6 = buildJsonPath_1.buildJsonPath(node);
56397
- if (path6.length === 0)
56462
+ const path7 = buildJsonPath_1.buildJsonPath(node);
56463
+ if (path7.length === 0)
56398
56464
  return;
56399
- return path6;
56465
+ return path7;
56400
56466
  };
56401
56467
  function* walk(node) {
56402
56468
  switch (node.kind) {
@@ -56517,8 +56583,8 @@ var require_getLocationForJsonPath = __commonJS((exports) => {
56517
56583
  var lineForPosition_1 = require_lineForPosition();
56518
56584
  var types_1 = require_types2();
56519
56585
  var utils_1 = require_utils3();
56520
- exports.getLocationForJsonPath = ({ ast, lineMap, metadata }, path6, closest = false) => {
56521
- const node = findNodeAtPath(ast, path6, { closest, mergeKeys: metadata !== undefined && metadata.mergeKeys === true });
56586
+ exports.getLocationForJsonPath = ({ ast, lineMap, metadata }, path7, closest = false) => {
56587
+ const node = findNodeAtPath(ast, path7, { closest, mergeKeys: metadata !== undefined && metadata.mergeKeys === true });
56522
56588
  if (node === undefined)
56523
56589
  return;
56524
56590
  return getLoc(lineMap, {
@@ -56569,9 +56635,9 @@ var require_getLocationForJsonPath = __commonJS((exports) => {
56569
56635
  }
56570
56636
  return node.endPosition;
56571
56637
  }
56572
- function findNodeAtPath(node, path6, { closest, mergeKeys }) {
56638
+ function findNodeAtPath(node, path7, { closest, mergeKeys }) {
56573
56639
  pathLoop:
56574
- for (const segment of path6) {
56640
+ for (const segment of path7) {
56575
56641
  if (!utils_1.isObject(node)) {
56576
56642
  return closest ? node : undefined;
56577
56643
  }
@@ -60511,14 +60577,14 @@ var require_yaml_validator = __commonJS((exports) => {
60511
60577
  email: email_json_1.default
60512
60578
  };
60513
60579
  function getValidationTargetFromFilename(filePath) {
60514
- const path6 = filePath.toLowerCase();
60515
- if (/[/\\]flow\.ya?ml$/.test(path6) || /^flow\.ya?ml$/.test(path6)) {
60580
+ const path7 = filePath.toLowerCase();
60581
+ if (/[/\\]flow\.ya?ml$/.test(path7) || /^flow\.ya?ml$/.test(path7)) {
60516
60582
  return { type: "flow" };
60517
60583
  }
60518
- if (/\.schedule\.ya?ml$/.test(path6)) {
60584
+ if (/\.schedule\.ya?ml$/.test(path7)) {
60519
60585
  return { type: "schedule" };
60520
60586
  }
60521
- const triggerMatch = path6.match(/\.(http|websocket|kafka|nats|postgres|mqtt|sqs|gcp|email)_trigger\.ya?ml$/);
60587
+ const triggerMatch = path7.match(/\.(http|websocket|kafka|nats|postgres|mqtt|sqs|gcp|email)_trigger\.ya?ml$/);
60522
60588
  if (triggerMatch) {
60523
60589
  return {
60524
60590
  type: "trigger",
@@ -60637,19 +60703,19 @@ function getWorkspaceSpecificTypes() {
60637
60703
  ...Object.fromEntries(TRIGGER_TYPES.map((t) => [`${t}_trigger`, `.${t}_trigger.yaml`]))
60638
60704
  };
60639
60705
  }
60640
- function isTriggerFile(path6) {
60641
- return TRIGGER_TYPES.some((type) => path6.endsWith(`.${type}_trigger.yaml`));
60706
+ function isTriggerFile(path7) {
60707
+ return TRIGGER_TYPES.some((type) => path7.endsWith(`.${type}_trigger.yaml`));
60642
60708
  }
60643
- function isScheduleFile(path6) {
60644
- return path6.endsWith(".schedule.yaml");
60709
+ function isScheduleFile(path7) {
60710
+ return path7.endsWith(".schedule.yaml");
60645
60711
  }
60646
- function getFileTypeSuffix(path6) {
60712
+ function getFileTypeSuffix(path7) {
60647
60713
  for (const [_, suffix] of Object.entries(getWorkspaceSpecificTypes())) {
60648
- if (path6.endsWith(suffix)) {
60714
+ if (path7.endsWith(suffix)) {
60649
60715
  return suffix;
60650
60716
  }
60651
60717
  }
60652
- const resourceFileMatch = path6.match(/(\\.resource\\.file\\..+)$/);
60718
+ const resourceFileMatch = path7.match(/(\\.resource\\.file\\..+)$/);
60653
60719
  if (resourceFileMatch) {
60654
60720
  return resourceFileMatch[1];
60655
60721
  }
@@ -60720,71 +60786,71 @@ function getSpecificItemsForCurrentBranch(config, workspaceNameOverride) {
60720
60786
  }
60721
60787
  return merged;
60722
60788
  }
60723
- function matchesPatterns(path6, patterns) {
60724
- return patterns.some((pattern) => minimatch(path6, pattern));
60789
+ function matchesPatterns(path7, patterns) {
60790
+ return patterns.some((pattern) => minimatch(path7, pattern));
60725
60791
  }
60726
- function isItemTypeConfigured(path6, specificItems) {
60792
+ function isItemTypeConfigured(path7, specificItems) {
60727
60793
  if (!specificItems) {
60728
60794
  return false;
60729
60795
  }
60730
- if (path6.endsWith(".variable.yaml")) {
60796
+ if (path7.endsWith(".variable.yaml")) {
60731
60797
  return specificItems.variables !== undefined;
60732
60798
  }
60733
- if (path6.endsWith(".resource.yaml")) {
60799
+ if (path7.endsWith(".resource.yaml")) {
60734
60800
  return specificItems.resources !== undefined;
60735
60801
  }
60736
- if (isTriggerFile(path6)) {
60802
+ if (isTriggerFile(path7)) {
60737
60803
  return specificItems.triggers !== undefined;
60738
60804
  }
60739
- if (isScheduleFile(path6)) {
60805
+ if (isScheduleFile(path7)) {
60740
60806
  return specificItems.schedules !== undefined;
60741
60807
  }
60742
- if (path6.endsWith("/folder.meta.yaml")) {
60808
+ if (path7.endsWith("/folder.meta.yaml")) {
60743
60809
  return specificItems.folders !== undefined;
60744
60810
  }
60745
- if (path6 === "settings.yaml") {
60811
+ if (path7 === "settings.yaml") {
60746
60812
  return specificItems.settings !== undefined;
60747
60813
  }
60748
- if (isFileResource(path6) || isFilesetResource(path6)) {
60814
+ if (isFileResource(path7) || isFilesetResource(path7)) {
60749
60815
  return specificItems.resources !== undefined;
60750
60816
  }
60751
60817
  return false;
60752
60818
  }
60753
- function isSpecificItem(path6, specificItems) {
60819
+ function isSpecificItem(path7, specificItems) {
60754
60820
  if (!specificItems) {
60755
60821
  return false;
60756
60822
  }
60757
- if (path6.endsWith(".variable.yaml")) {
60758
- return specificItems.variables ? matchesPatterns(path6, specificItems.variables) : false;
60823
+ if (path7.endsWith(".variable.yaml")) {
60824
+ return specificItems.variables ? matchesPatterns(path7, specificItems.variables) : false;
60759
60825
  }
60760
- if (path6.endsWith(".resource.yaml")) {
60761
- return specificItems.resources ? matchesPatterns(path6, specificItems.resources) : false;
60826
+ if (path7.endsWith(".resource.yaml")) {
60827
+ return specificItems.resources ? matchesPatterns(path7, specificItems.resources) : false;
60762
60828
  }
60763
- if (isTriggerFile(path6)) {
60764
- return specificItems.triggers ? matchesPatterns(path6, specificItems.triggers) : false;
60829
+ if (isTriggerFile(path7)) {
60830
+ return specificItems.triggers ? matchesPatterns(path7, specificItems.triggers) : false;
60765
60831
  }
60766
- if (isScheduleFile(path6)) {
60767
- return specificItems.schedules ? matchesPatterns(path6, specificItems.schedules) : false;
60832
+ if (isScheduleFile(path7)) {
60833
+ return specificItems.schedules ? matchesPatterns(path7, specificItems.schedules) : false;
60768
60834
  }
60769
- if (path6.endsWith("/folder.meta.yaml")) {
60835
+ if (path7.endsWith("/folder.meta.yaml")) {
60770
60836
  if (specificItems.folders) {
60771
- const folderPath = path6.slice(0, -"/folder.meta.yaml".length);
60837
+ const folderPath = path7.slice(0, -"/folder.meta.yaml".length);
60772
60838
  return matchesPatterns(folderPath, specificItems.folders);
60773
60839
  }
60774
60840
  return false;
60775
60841
  }
60776
- if (path6 === "settings.yaml") {
60842
+ if (path7 === "settings.yaml") {
60777
60843
  return specificItems.settings === true;
60778
60844
  }
60779
- if (isFileResource(path6)) {
60780
- const basePathMatch = path6.match(/^(.+?)\.resource\.file\./);
60845
+ if (isFileResource(path7)) {
60846
+ const basePathMatch = path7.match(/^(.+?)\.resource\.file\./);
60781
60847
  if (basePathMatch && specificItems.resources) {
60782
60848
  const basePath = basePathMatch[1] + ".resource.yaml";
60783
60849
  return matchesPatterns(basePath, specificItems.resources);
60784
60850
  }
60785
60851
  }
60786
- if (isFilesetResource(path6)) {
60787
- const basePathMatch = path6.match(/^(.+?)\.fileset[/\\]/);
60852
+ if (isFilesetResource(path7)) {
60853
+ const basePathMatch = path7.match(/^(.+?)\.fileset[/\\]/);
60788
60854
  if (basePathMatch && specificItems.resources) {
60789
60855
  const basePath = basePathMatch[1] + ".resource.yaml";
60790
60856
  return matchesPatterns(basePath, specificItems.resources);
@@ -60865,7 +60931,7 @@ function getWorkspaceSpecificPath(basePath, specificItems, workspaceNameOverride
60865
60931
  }
60866
60932
  return;
60867
60933
  }
60868
- function isCurrentWorkspaceFile(path6, workspaceNameOverride) {
60934
+ function isCurrentWorkspaceFile(path7, workspaceNameOverride) {
60869
60935
  let currentWorkspace = null;
60870
60936
  if (workspaceNameOverride) {
60871
60937
  currentWorkspace = workspaceNameOverride;
@@ -60882,11 +60948,11 @@ function isCurrentWorkspaceFile(path6, workspaceNameOverride) {
60882
60948
  pattern = new RegExp(`\\.${escapedName}\\.${buildYamlTypePattern()}\\.yaml$|` + `\\.${escapedName}\\.resource\\.file\\..+$|` + `/folder\\.${escapedName}\\.meta\\.yaml$|` + `^settings\\.${escapedName}\\.yaml$`);
60883
60949
  workspacePatternCache.set(currentWorkspace, pattern);
60884
60950
  }
60885
- return pattern.test(path6);
60951
+ return pattern.test(path7);
60886
60952
  }
60887
- function isWorkspaceSpecificFile(path6) {
60953
+ function isWorkspaceSpecificFile(path7) {
60888
60954
  const yamlTypePattern = buildYamlTypePattern();
60889
- return new RegExp(`\\.[^.]+\\.${yamlTypePattern}\\.yaml$|` + `\\.[^.]+\\.resource\\.file\\..+$|` + `/folder\\.[^.]+\\.meta\\.yaml$|` + `^settings\\.[^.]+\\.yaml$`).test(path6);
60955
+ return new RegExp(`\\.[^.]+\\.${yamlTypePattern}\\.yaml$|` + `\\.[^.]+\\.resource\\.file\\..+$|` + `/folder\\.[^.]+\\.meta\\.yaml$|` + `^settings\\.[^.]+\\.yaml$`).test(path7);
60890
60956
  }
60891
60957
  var workspacePatternCache;
60892
60958
  var init_specific_items = __esm(async () => {
@@ -60960,9 +61026,9 @@ var init_tar = __esm(() => {
60960
61026
  import { readFile as readFile5, writeFile as writeFile5, stat as stat4, mkdir as mkdir3 } from "node:fs/promises";
60961
61027
  import { Buffer as Buffer4 } from "node:buffer";
60962
61028
  import { sep as SEP4 } from "node:path";
60963
- import * as path6 from "node:path";
61029
+ import * as path7 from "node:path";
60964
61030
  import fs8 from "node:fs";
60965
- import { execSync as execSync3 } from "node:child_process";
61031
+ import { execSync as execSync4 } from "node:child_process";
60966
61032
  function isRawAppBackendPath2(filePath) {
60967
61033
  return isRawAppBackendPath(filePath);
60968
61034
  }
@@ -61009,8 +61075,8 @@ async function push2(opts, filePath) {
61009
61075
  await handleFile(filePath, workspace, [], opts.message, opts, await getRawWorkspaceDependencies(true), codebases);
61010
61076
  info(colors.bold.underline.green(`Script ${filePath} pushed`));
61011
61077
  }
61012
- async function findResourceFile(path7) {
61013
- const splitPath = path7.split(".");
61078
+ async function findResourceFile(path8) {
61079
+ const splitPath = path8.split(".");
61014
61080
  let contentBasePathJSON = splitPath[0] + "." + splitPath[1] + ".json";
61015
61081
  let contentBasePathYAML = splitPath[0] + "." + splitPath[1] + ".yaml";
61016
61082
  const currentBranch = getCurrentGitBranch();
@@ -61031,48 +61097,48 @@ async function findResourceFile(path7) {
61031
61097
  throw new Error("Found two resource files for the same resource" + validCandidates.join(", "));
61032
61098
  }
61033
61099
  if (validCandidates.length < 1) {
61034
- throw new Error(`No resource matching file resource: ${path7}.`);
61100
+ throw new Error(`No resource matching file resource: ${path8}.`);
61035
61101
  }
61036
61102
  return validCandidates[0];
61037
61103
  }
61038
- async function handleScriptMetadata(path7, workspace, alreadySynced, message, rawWorkspaceDependencies, codebases, opts, permissionedAsContext) {
61039
- const isFlatMeta = path7.endsWith(".script.json") || path7.endsWith(".script.yaml") || path7.endsWith(".script.lock");
61040
- const isFolderMeta = !isFlatMeta && isScriptModulePath(path7) && (path7.endsWith("/script.yaml") || path7.endsWith("/script.json") || path7.endsWith("/script.lock"));
61104
+ async function handleScriptMetadata(path8, workspace, alreadySynced, message, rawWorkspaceDependencies, codebases, opts, permissionedAsContext) {
61105
+ const isFlatMeta = path8.endsWith(".script.json") || path8.endsWith(".script.yaml") || path8.endsWith(".script.lock");
61106
+ const isFolderMeta = !isFlatMeta && isScriptModulePath(path8) && (path8.endsWith("/script.yaml") || path8.endsWith("/script.json") || path8.endsWith("/script.lock"));
61041
61107
  if (isFlatMeta || isFolderMeta) {
61042
- const contentPath = await findContentFile(path7);
61108
+ const contentPath = await findContentFile(path8);
61043
61109
  return handleFile(contentPath, workspace, alreadySynced, message, opts, rawWorkspaceDependencies, codebases, permissionedAsContext);
61044
61110
  } else {
61045
61111
  return false;
61046
61112
  }
61047
61113
  }
61048
- async function handleFile(path7, workspace, alreadySynced, message, opts, rawWorkspaceDependencies, codebases, permissionedAsContext) {
61049
- const moduleEntryPoint = isModuleEntryPoint(path7);
61050
- if (!isAppInlineScriptPath2(path7) && !isFlowInlineScriptPath2(path7) && !isRawAppBackendPath2(path7) && (!isScriptModulePath(path7) || moduleEntryPoint) && exts.some((exts) => path7.endsWith(exts))) {
61051
- if (alreadySynced.includes(path7)) {
61114
+ async function handleFile(path8, workspace, alreadySynced, message, opts, rawWorkspaceDependencies, codebases, permissionedAsContext) {
61115
+ const moduleEntryPoint = isModuleEntryPoint(path8);
61116
+ if (!isAppInlineScriptPath2(path8) && !isFlowInlineScriptPath2(path8) && !isRawAppBackendPath2(path8) && (!isScriptModulePath(path8) || moduleEntryPoint) && exts.some((exts) => path8.endsWith(exts))) {
61117
+ if (alreadySynced.includes(path8)) {
61052
61118
  return true;
61053
61119
  }
61054
- debug(`Processing local script ${path7}`);
61055
- alreadySynced.push(path7);
61056
- const remotePath = moduleEntryPoint ? getScriptBasePathFromModulePath(path7).replaceAll(SEP4, "/") : path7.substring(0, path7.indexOf(".")).replaceAll(SEP4, "/");
61057
- const language = inferContentTypeFromFilePath(path7, opts?.defaultTs);
61058
- const codebase = language == "bun" ? findCodebase(path7, codebases) : undefined;
61120
+ debug(`Processing local script ${path8}`);
61121
+ alreadySynced.push(path8);
61122
+ const remotePath = moduleEntryPoint ? getScriptBasePathFromModulePath(path8).replaceAll(SEP4, "/") : path8.substring(0, path8.indexOf(".")).replaceAll(SEP4, "/");
61123
+ const language = inferContentTypeFromFilePath(path8, opts?.defaultTs);
61124
+ const codebase = language == "bun" ? findCodebase(path8, codebases) : undefined;
61059
61125
  let bundleContent = undefined;
61060
61126
  let forceTar = false;
61061
61127
  if (codebase) {
61062
61128
  let outputFiles = [];
61063
61129
  if (codebase.customBundler) {
61064
- info(`Using custom bundler ${codebase.customBundler} for ${path7}`);
61065
- bundleContent = execSync3(codebase.customBundler + " " + path7, {
61130
+ info(`Using custom bundler ${codebase.customBundler} for ${path8}`);
61131
+ bundleContent = execSync4(codebase.customBundler + " " + path8, {
61066
61132
  maxBuffer: 1024 * 1024 * 50
61067
61133
  }).toString();
61068
- info("Custom bundler executed for " + path7);
61134
+ info("Custom bundler executed for " + path8);
61069
61135
  } else {
61070
61136
  const esbuild = await import("esbuild");
61071
- info(`Started bundling ${path7} ...`);
61137
+ info(`Started bundling ${path8} ...`);
61072
61138
  const startTime = performance.now();
61073
61139
  const format6 = codebase.format ?? "cjs";
61074
61140
  const out = await esbuild.build({
61075
- entryPoints: [path7],
61141
+ entryPoints: [path8],
61076
61142
  format: format6,
61077
61143
  bundle: true,
61078
61144
  write: false,
@@ -61090,15 +61156,15 @@ async function handleFile(path7, workspace, alreadySynced, message, opts, rawWor
61090
61156
  bundleContent = out.outputFiles[0].text;
61091
61157
  outputFiles = out.outputFiles ?? [];
61092
61158
  if (outputFiles.length == 0) {
61093
- throw new Error(`No output files found for ${path7}`);
61159
+ throw new Error(`No output files found for ${path8}`);
61094
61160
  }
61095
- info(`Finished bundling ${path7}: ${(bundleContent.length / 1024).toFixed(0)}kB (${(endTime - startTime).toFixed(0)}ms)`);
61161
+ info(`Finished bundling ${path8}: ${(bundleContent.length / 1024).toFixed(0)}kB (${(endTime - startTime).toFixed(0)}ms)`);
61096
61162
  }
61097
61163
  if (outputFiles.length > 1) {
61098
- info(`Found multiple output files for ${path7}, creating a tarball... ${outputFiles.map((file) => file.path).join(", ")}`);
61164
+ info(`Found multiple output files for ${path8}, creating a tarball... ${outputFiles.map((file) => file.path).join(", ")}`);
61099
61165
  forceTar = true;
61100
61166
  const startTime = performance.now();
61101
- const mainPath = path7.split(SEP4).pop()?.split(".")[0] + ".js";
61167
+ const mainPath = path8.split(SEP4).pop()?.split(".")[0] + ".js";
61102
61168
  const mainContent = outputFiles.find((file) => file.path == "/" + mainPath)?.text ?? "";
61103
61169
  info(`Main content: ${mainContent.length}chars`);
61104
61170
  const entries = [
@@ -61113,10 +61179,10 @@ async function handleFile(path7, workspace, alreadySynced, message, opts, rawWor
61113
61179
  }
61114
61180
  bundleContent = await createTarBlob(entries);
61115
61181
  const endTime = performance.now();
61116
- info(`Finished creating tarball for ${path7}: ${(bundleContent.size / 1024).toFixed(0)}kB (${(endTime - startTime).toFixed(0)}ms)`);
61182
+ info(`Finished creating tarball for ${path8}: ${(bundleContent.size / 1024).toFixed(0)}kB (${(endTime - startTime).toFixed(0)}ms)`);
61117
61183
  } else {
61118
61184
  if (Array.isArray(codebase.assets) && codebase.assets.length > 0) {
61119
- info(`Using the following asset configuration for ${path7}: ${JSON.stringify(codebase.assets)}`);
61185
+ info(`Using the following asset configuration for ${path8}: ${JSON.stringify(codebase.assets)}`);
61120
61186
  const startTime = performance.now();
61121
61187
  const entries = [
61122
61188
  { name: "main.js", content: bundleContent }
@@ -61127,13 +61193,13 @@ async function handleFile(path7, workspace, alreadySynced, message, opts, rawWor
61127
61193
  }
61128
61194
  bundleContent = await createTarBlob(entries);
61129
61195
  const endTime = performance.now();
61130
- info(`Finished creating tarball for ${path7}: ${(bundleContent.size / 1024).toFixed(0)}kB (${(endTime - startTime).toFixed(0)}ms)`);
61196
+ info(`Finished creating tarball for ${path8}: ${(bundleContent.size / 1024).toFixed(0)}kB (${(endTime - startTime).toFixed(0)}ms)`);
61131
61197
  }
61132
61198
  }
61133
61199
  }
61134
61200
  let typed = opts?.skipScriptsMetadata ? undefined : (await parseMetadataFile(remotePath, opts ? {
61135
61201
  ...opts,
61136
- path: path7,
61202
+ path: path8,
61137
61203
  workspaceRemote: workspace,
61138
61204
  schemaOnly: codebase ? true : undefined,
61139
61205
  rawWorkspaceDependencies,
@@ -61150,14 +61216,14 @@ async function handleFile(path7, workspace, alreadySynced, message, opts, rawWor
61150
61216
  } catch {
61151
61217
  debug(`Script ${remotePath} does not exist on remote`);
61152
61218
  }
61153
- const content = await readFile5(path7, "utf-8");
61219
+ const content = await readFile5(path8, "utf-8");
61154
61220
  if (opts?.skipScriptsMetadata) {
61155
61221
  typed = structuredClone(remote);
61156
61222
  }
61157
61223
  if (typed && codebase) {
61158
61224
  typed.codebase = await codebase.getDigest(forceTar);
61159
61225
  }
61160
- const scriptBasePath = moduleEntryPoint ? getScriptBasePathFromModulePath(path7) : path7.substring(0, path7.indexOf("."));
61226
+ const scriptBasePath = moduleEntryPoint ? getScriptBasePathFromModulePath(path8) : path8.substring(0, path8.indexOf("."));
61161
61227
  const moduleFolderPath = scriptBasePath + getModuleFolderSuffix();
61162
61228
  const modules = await readModulesFromDisk(moduleFolderPath, opts?.defaultTs, moduleEntryPoint);
61163
61229
  const requestBodyCommon = {
@@ -61241,7 +61307,7 @@ async function readModulesFromDisk(moduleFolderPath, defaultTs, folderLayout = f
61241
61307
  function readDir2(dirPath, relPrefix) {
61242
61308
  const entries = fs8.readdirSync(dirPath, { withFileTypes: true });
61243
61309
  for (const entry of entries) {
61244
- const fullPath = path6.join(dirPath, entry.name);
61310
+ const fullPath = path7.join(dirPath, entry.name);
61245
61311
  const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
61246
61312
  const isTopLevel = relPrefix === "";
61247
61313
  if (entry.isDirectory()) {
@@ -61251,7 +61317,7 @@ async function readModulesFromDisk(moduleFolderPath, defaultTs, folderLayout = f
61251
61317
  const content = fs8.readFileSync(fullPath, "utf-8");
61252
61318
  const language = inferContentTypeFromFilePath(entry.name, defaultTs);
61253
61319
  const baseName = entry.name.replace(/\.[^.]+$/, "");
61254
- const lockPath = path6.join(dirPath, baseName + ".lock");
61320
+ const lockPath = path7.join(dirPath, baseName + ".lock");
61255
61321
  let lock;
61256
61322
  if (fs8.existsSync(lockPath)) {
61257
61323
  lock = fs8.readFileSync(lockPath, "utf-8");
@@ -61376,13 +61442,13 @@ function filePathExtensionFromContentType(language, defaultTs) {
61376
61442
  throw new Error("Invalid language: " + language);
61377
61443
  }
61378
61444
  }
61379
- function removeExtensionToPath(path7) {
61445
+ function removeExtensionToPath(path8) {
61380
61446
  for (const ext2 of exts) {
61381
- if (path7.endsWith(ext2)) {
61382
- return path7.substring(0, path7.length - ext2.length);
61447
+ if (path8.endsWith(ext2)) {
61448
+ return path8.substring(0, path8.length - ext2.length);
61383
61449
  }
61384
61450
  }
61385
- throw new Error("Invalid extension: " + path7);
61451
+ throw new Error("Invalid extension: " + path8);
61386
61452
  }
61387
61453
  async function list4(opts) {
61388
61454
  if (opts.json)
@@ -61433,7 +61499,7 @@ async function resolve6(input) {
61433
61499
  throw e;
61434
61500
  }
61435
61501
  }
61436
- async function run2(opts, path7) {
61502
+ async function run2(opts, path8) {
61437
61503
  if (opts.silent) {
61438
61504
  setSilent(true);
61439
61505
  }
@@ -61444,7 +61510,7 @@ async function run2(opts, path7) {
61444
61510
  try {
61445
61511
  const script = await getScriptByPath({
61446
61512
  workspace: workspace.workspaceId,
61447
- path: path7
61513
+ path: path8
61448
61514
  });
61449
61515
  validateRequiredArgs(script.schema);
61450
61516
  } catch (e) {
@@ -61457,7 +61523,7 @@ async function run2(opts, path7) {
61457
61523
  try {
61458
61524
  id = await runScriptByPath({
61459
61525
  workspace: workspace.workspaceId,
61460
- path: path7,
61526
+ path: path8,
61461
61527
  requestBody: input
61462
61528
  });
61463
61529
  } catch (e) {
@@ -61465,10 +61531,10 @@ async function run2(opts, path7) {
61465
61531
  try {
61466
61532
  const script = await getScriptByPath({
61467
61533
  workspace: workspace.workspaceId,
61468
- path: path7
61534
+ path: path8
61469
61535
  });
61470
61536
  if (script.lock_error_logs) {
61471
- throw new Error(`Script '${path7}' has a deployment error and cannot be run:
61537
+ throw new Error(`Script '${path8}' has a deployment error and cannot be run:
61472
61538
  ${script.lock_error_logs}`);
61473
61539
  }
61474
61540
  } catch (lookupErr) {
@@ -61477,7 +61543,7 @@ ${script.lock_error_logs}`);
61477
61543
  if (lookupErr?.status && lookupErr.status !== 404)
61478
61544
  throw lookupErr;
61479
61545
  }
61480
- throw new Error(`Script '${path7}' not found. Run 'wmill script list' to see available scripts.`);
61546
+ throw new Error(`Script '${path8}' not found. Run 'wmill script list' to see available scripts.`);
61481
61547
  }
61482
61548
  throw e;
61483
61549
  }
@@ -61593,12 +61659,12 @@ async function pollForJobResult(workspace, jobId) {
61593
61659
  await new Promise((resolve7) => setTimeout(resolve7, POLL_INTERVAL_MS));
61594
61660
  }
61595
61661
  }
61596
- async function show(opts, path7) {
61662
+ async function show(opts, path8) {
61597
61663
  const workspace = await resolveWorkspace(opts);
61598
61664
  await requireLogin(opts);
61599
61665
  const s = await getScriptByPath({
61600
61666
  workspace: workspace.workspaceId,
61601
- path: path7
61667
+ path: path8
61602
61668
  });
61603
61669
  info(colors.underline(s.path));
61604
61670
  if (s.description)
@@ -61606,14 +61672,14 @@ async function show(opts, path7) {
61606
61672
  info("");
61607
61673
  info(s.content);
61608
61674
  }
61609
- async function get2(opts, path7) {
61675
+ async function get2(opts, path8) {
61610
61676
  if (opts.json)
61611
61677
  setSilent(true);
61612
61678
  const workspace = await resolveWorkspace(opts);
61613
61679
  await requireLogin(opts);
61614
61680
  const s = await getScriptByPath({
61615
61681
  workspace: workspace.workspaceId,
61616
- path: path7
61682
+ path: path8
61617
61683
  });
61618
61684
  if (opts.json) {
61619
61685
  console.log(JSON.stringify(s));
@@ -61663,7 +61729,7 @@ async function bootstrap(opts, scriptPath, language) {
61663
61729
  scriptMetadata.description = opts.description;
61664
61730
  }
61665
61731
  const scriptInitialMetadataYaml = import_yaml6.stringify(scriptMetadata, yamlOptions);
61666
- const parentDir = path6.dirname(scriptCodeFileFullPath);
61732
+ const parentDir = path7.dirname(scriptCodeFileFullPath);
61667
61733
  await mkdir3(parentDir, { recursive: true });
61668
61734
  await writeFile5(scriptCodeFileFullPath, scriptInitialCode, {
61669
61735
  flag: "wx",
@@ -61746,7 +61812,7 @@ async function preview(opts, filePath) {
61746
61812
  const content = await readFile5(filePath, "utf-8");
61747
61813
  const input = opts.data ? await resolve6(opts.data) : {};
61748
61814
  const isFolderLayout = isModuleEntryPoint(filePath);
61749
- const moduleFolderPath = isFolderLayout ? path6.dirname(filePath) : filePath.substring(0, filePath.indexOf(".")) + getModuleFolderSuffix();
61815
+ const moduleFolderPath = isFolderLayout ? path7.dirname(filePath) : filePath.substring(0, filePath.indexOf(".")) + getModuleFolderSuffix();
61750
61816
  const modules = await readModulesFromDisk(moduleFolderPath, opts?.defaultTs, isFolderLayout);
61751
61817
  const codebase = language == "bun" ? findCodebase(filePath, codebases) : undefined;
61752
61818
  let bundledContent = undefined;
@@ -61756,7 +61822,7 @@ async function preview(opts, filePath) {
61756
61822
  if (!opts.silent) {
61757
61823
  info(`Using custom bundler ${codebase.customBundler} for preview`);
61758
61824
  }
61759
- bundledContent = execSync3(codebase.customBundler + " " + filePath, {
61825
+ bundledContent = execSync4(codebase.customBundler + " " + filePath, {
61760
61826
  maxBuffer: 52428800
61761
61827
  }).toString();
61762
61828
  } else {
@@ -62004,8 +62070,8 @@ var init_script = __esm(async () => {
62004
62070
 
62005
62071
  // src/commands/lint/lint.ts
62006
62072
  import { stat as stat5, readdir as readdir2 } from "node:fs/promises";
62007
- import process13 from "node:process";
62008
- import * as path7 from "node:path";
62073
+ import process14 from "node:process";
62074
+ import * as path8 from "node:path";
62009
62075
  import { sep as SEP5 } from "node:path";
62010
62076
  function normalizePath(p) {
62011
62077
  return p.replaceAll(SEP5, "/");
@@ -62064,7 +62130,7 @@ async function isLockResolved(lockValue, baseDir) {
62064
62130
  return true;
62065
62131
  }
62066
62132
  async function checkInlineFile(relativePath, baseDir) {
62067
- const fullPath = path7.join(baseDir, relativePath.trim());
62133
+ const fullPath = path8.join(baseDir, relativePath.trim());
62068
62134
  try {
62069
62135
  const s = await stat5(fullPath);
62070
62136
  return s.size > 0;
@@ -62154,7 +62220,7 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
62154
62220
  continue;
62155
62221
  const runnableId = fileName.replace(".yaml", "");
62156
62222
  processedIds.add(runnableId);
62157
- const filePath = path7.join(backendDir, fileName);
62223
+ const filePath = path8.join(backendDir, fileName);
62158
62224
  let runnable;
62159
62225
  try {
62160
62226
  runnable = await yamlParseFile(filePath);
@@ -62172,7 +62238,7 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
62172
62238
  }
62173
62239
  if (!language || !languageNeedsLock(language))
62174
62240
  continue;
62175
- const lockFile = path7.join(backendDir, `${runnableId}.lock`);
62241
+ const lockFile = path8.join(backendDir, `${runnableId}.lock`);
62176
62242
  let hasLock = false;
62177
62243
  try {
62178
62244
  const s = await stat5(lockFile);
@@ -62219,7 +62285,7 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
62219
62285
  }
62220
62286
  if (!languageNeedsLock(language))
62221
62287
  continue;
62222
- const lockFile = path7.join(backendDir, `${runnableId}.lock`);
62288
+ const lockFile = path8.join(backendDir, `${runnableId}.lock`);
62223
62289
  let hasLock = false;
62224
62290
  try {
62225
62291
  const s = await stat5(lockFile);
@@ -62238,8 +62304,8 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
62238
62304
  return issues;
62239
62305
  }
62240
62306
  async function checkMissingLocks(opts, directory) {
62241
- const initialCwd = process13.cwd();
62242
- const targetDirectory = directory ? path7.resolve(initialCwd, directory) : process13.cwd();
62307
+ const initialCwd = process14.cwd();
62308
+ const targetDirectory = directory ? path8.resolve(initialCwd, directory) : process14.cwd();
62243
62309
  const { ...syncOpts } = opts;
62244
62310
  const mergedOpts = await mergeConfigWithConfigFile(syncOpts);
62245
62311
  const ignore = await ignoreF(mergedOpts);
@@ -62263,19 +62329,19 @@ async function checkMissingLocks(opts, directory) {
62263
62329
  if (normalizedPath.endsWith("/flow.yaml") && normalizedPath.includes(flowSuffix + "/")) {
62264
62330
  flowYamls.push({
62265
62331
  normalizedPath,
62266
- fullPath: path7.join(targetDirectory, entry.path)
62332
+ fullPath: path8.join(targetDirectory, entry.path)
62267
62333
  });
62268
62334
  }
62269
62335
  if (normalizedPath.endsWith("/app.yaml") && normalizedPath.includes(appSuffix + "/")) {
62270
62336
  appYamls.push({
62271
62337
  normalizedPath,
62272
- fullPath: path7.join(targetDirectory, entry.path)
62338
+ fullPath: path8.join(targetDirectory, entry.path)
62273
62339
  });
62274
62340
  }
62275
62341
  if (normalizedPath.endsWith("/raw_app.yaml") && normalizedPath.includes(rawAppSuffix + "/")) {
62276
62342
  rawAppYamls.push({
62277
62343
  normalizedPath,
62278
- fullPath: path7.join(targetDirectory, entry.path)
62344
+ fullPath: path8.join(targetDirectory, entry.path)
62279
62345
  });
62280
62346
  }
62281
62347
  }
@@ -62284,14 +62350,14 @@ async function checkMissingLocks(opts, directory) {
62284
62350
  let language = null;
62285
62351
  for (const ext2 of exts) {
62286
62352
  try {
62287
- await stat5(path7.join(targetDirectory, basePath + ext2));
62353
+ await stat5(path8.join(targetDirectory, basePath + ext2));
62288
62354
  language = inferContentTypeFromFilePath(basePath + ext2, defaultTs);
62289
62355
  break;
62290
62356
  } catch {}
62291
62357
  }
62292
62358
  if (language && languageNeedsLock(language)) {
62293
62359
  try {
62294
- const metadata = await yamlParseFile(path7.join(targetDirectory, yamlPath));
62360
+ const metadata = await yamlParseFile(path8.join(targetDirectory, yamlPath));
62295
62361
  const lockResolved = await isLockResolved(metadata?.lock, targetDirectory);
62296
62362
  if (!lockResolved) {
62297
62363
  issues.push({
@@ -62308,7 +62374,7 @@ async function checkMissingLocks(opts, directory) {
62308
62374
  }
62309
62375
  }
62310
62376
  for (const { normalizedPath: flowYamlPath, fullPath } of flowYamls) {
62311
- const flowDir = path7.dirname(fullPath);
62377
+ const flowDir = path8.dirname(fullPath);
62312
62378
  try {
62313
62379
  const flowFile = await yamlParseFile(fullPath);
62314
62380
  if (!flowFile?.value?.modules)
@@ -62333,7 +62399,7 @@ async function checkMissingLocks(opts, directory) {
62333
62399
  }
62334
62400
  }
62335
62401
  for (const { normalizedPath: appYamlPath, fullPath } of appYamls) {
62336
- const appDir = path7.dirname(fullPath);
62402
+ const appDir = path8.dirname(fullPath);
62337
62403
  try {
62338
62404
  const appFile = await yamlParseFile(fullPath);
62339
62405
  if (!appFile?.value)
@@ -62358,8 +62424,8 @@ async function checkMissingLocks(opts, directory) {
62358
62424
  }
62359
62425
  }
62360
62426
  for (const { normalizedPath: rawAppYamlPath, fullPath } of rawAppYamls) {
62361
- const rawAppDir = path7.dirname(fullPath);
62362
- const backendDir = path7.join(rawAppDir, "backend");
62427
+ const rawAppDir = path8.dirname(fullPath);
62428
+ const backendDir = path8.join(rawAppDir, "backend");
62363
62429
  try {
62364
62430
  await stat5(backendDir);
62365
62431
  } catch {
@@ -62375,11 +62441,11 @@ async function checkMissingLocks(opts, directory) {
62375
62441
  return issues;
62376
62442
  }
62377
62443
  async function runLint(opts, directory) {
62378
- const initialCwd = process13.cwd();
62379
- const explicitTargetDirectory = directory ? path7.resolve(initialCwd, directory) : undefined;
62444
+ const initialCwd = process14.cwd();
62445
+ const explicitTargetDirectory = directory ? path8.resolve(initialCwd, directory) : undefined;
62380
62446
  const { json: _json, ...syncOpts } = opts;
62381
62447
  const mergedOpts = await mergeConfigWithConfigFile(syncOpts);
62382
- const targetDirectory = explicitTargetDirectory ?? process13.cwd();
62448
+ const targetDirectory = explicitTargetDirectory ?? process14.cwd();
62383
62449
  const stats = await stat5(targetDirectory).catch(() => null);
62384
62450
  if (!stats) {
62385
62451
  throw new Error(`Directory not found: ${targetDirectory}`);
@@ -62387,7 +62453,7 @@ async function runLint(opts, directory) {
62387
62453
  if (!stats.isDirectory()) {
62388
62454
  throw new Error(`Path is not a directory: ${targetDirectory}`);
62389
62455
  }
62390
- const isSubdirectory = explicitTargetDirectory && !await stat5(path7.join(targetDirectory, "wmill.yaml")).catch(() => null);
62456
+ const isSubdirectory = explicitTargetDirectory && !await stat5(path8.join(targetDirectory, "wmill.yaml")).catch(() => null);
62391
62457
  const ignore = isSubdirectory ? (_p, _isDir) => false : await ignoreF(mergedOpts);
62392
62458
  const root = await FSFSElement(targetDirectory, [], false);
62393
62459
  const validator = new import_windmill_yaml_validator.WindmillYamlValidator;
@@ -62494,7 +62560,7 @@ async function lint(opts, directory) {
62494
62560
  const report = await runLint(opts, directory);
62495
62561
  printReport(report, !!opts.json);
62496
62562
  if (report.exitCode !== 0) {
62497
- process13.exit(report.exitCode);
62563
+ process14.exit(report.exitCode);
62498
62564
  }
62499
62565
  } catch (error2) {
62500
62566
  const message = error2 instanceof Error ? error2.message : String(error2);
@@ -62507,17 +62573,17 @@ async function lint(opts, directory) {
62507
62573
  } else {
62508
62574
  error(colors.red(`❌ ${message}`));
62509
62575
  }
62510
- process13.exit(1);
62576
+ process14.exit(1);
62511
62577
  }
62512
62578
  }
62513
62579
  async function lintWatch(opts, directory) {
62514
62580
  const { watch } = await import("node:fs");
62515
- const targetDir = directory ? path7.resolve(process13.cwd(), directory) : process13.cwd();
62581
+ const targetDir = directory ? path8.resolve(process14.cwd(), directory) : process14.cwd();
62516
62582
  info(colors.blue(`Watching ${targetDir} for changes... (Ctrl+C to stop)`));
62517
62583
  async function runAndReport() {
62518
62584
  try {
62519
62585
  const report = await runLint(opts, directory);
62520
- process13.stdout.write("\x1Bc");
62586
+ process14.stdout.write("\x1Bc");
62521
62587
  info(colors.gray(`[${new Date().toLocaleTimeString()}] Lint results:
62522
62588
  `));
62523
62589
  printReport(report, false);
@@ -62819,11 +62885,11 @@ async function list5(opts) {
62819
62885
  new Table2().header(["Path", "Resource Type"]).padding(2).border(true).body(total.map((x) => [x.path, x.resource_type])).render();
62820
62886
  }
62821
62887
  }
62822
- async function newResource(opts, path8) {
62823
- if (!validatePath(path8)) {
62888
+ async function newResource(opts, path9) {
62889
+ if (!validatePath(path9)) {
62824
62890
  return;
62825
62891
  }
62826
- const filePath = path8 + ".resource.yaml";
62892
+ const filePath = path9 + ".resource.yaml";
62827
62893
  try {
62828
62894
  await stat6(filePath);
62829
62895
  throw new Error("File already exists: " + filePath);
@@ -62843,14 +62909,14 @@ async function newResource(opts, path8) {
62843
62909
  });
62844
62910
  info(colors.green(`Created ${filePath}`));
62845
62911
  }
62846
- async function get3(opts, path8) {
62912
+ async function get3(opts, path9) {
62847
62913
  if (opts.json)
62848
62914
  setSilent(true);
62849
62915
  const workspace = await resolveWorkspace(opts);
62850
62916
  await requireLogin(opts);
62851
62917
  const r = await getResource({
62852
62918
  workspace: workspace.workspaceId,
62853
- path: path8
62919
+ path: path9
62854
62920
  });
62855
62921
  if (opts.json) {
62856
62922
  console.log(JSON.stringify(r));
@@ -63009,11 +63075,11 @@ var init_path_assigner = __esm(() => {
63009
63075
  function extractRawscriptInline(id, summary, rawscript, mapping, separator, assigner) {
63010
63076
  const [basePath, ext2] = assigner.assignPath(summary ?? id, rawscript.language);
63011
63077
  const mappedPath = mapping[id];
63012
- const path8 = mappedPath ?? basePath + ext2;
63078
+ const path9 = mappedPath ?? basePath + ext2;
63013
63079
  const language = rawscript.language;
63014
63080
  const content = rawscript.content;
63015
- const r = [{ path: path8, content, language, is_lock: false }];
63016
- rawscript.content = "!inline " + path8.replaceAll(separator, "/");
63081
+ const r = [{ path: path9, content, language, is_lock: false }];
63082
+ rawscript.content = "!inline " + path9.replaceAll(separator, "/");
63017
63083
  const lock = rawscript.lock;
63018
63084
  if (lock && lock != "") {
63019
63085
  const dotIdx = mappedPath ? mappedPath.lastIndexOf(".") : -1;
@@ -63099,23 +63165,23 @@ async function replaceRawscriptInline(id, rawscript, fileReader, logger, separat
63099
63165
  if (!rawscript.content || !rawscript.content.startsWith("!inline")) {
63100
63166
  return;
63101
63167
  }
63102
- const path8 = rawscript.content.split(" ")[1];
63103
- const pathSuffix = path8.split(".").slice(1).join(".");
63168
+ const path9 = rawscript.content.split(" ")[1];
63169
+ const pathSuffix = path9.split(".").slice(1).join(".");
63104
63170
  const newPath = id + "." + pathSuffix;
63105
63171
  try {
63106
- rawscript.content = await fileReader(path8);
63172
+ rawscript.content = await fileReader(path9);
63107
63173
  } catch {
63108
- logger.error(`Script file ${path8} not found`);
63174
+ logger.error(`Script file ${path9} not found`);
63109
63175
  try {
63110
63176
  rawscript.content = await fileReader(newPath);
63111
63177
  } catch {
63112
63178
  logger.error(`Script file ${newPath} not found`);
63113
63179
  if (missingFiles)
63114
- missingFiles.push(path8);
63180
+ missingFiles.push(path9);
63115
63181
  }
63116
63182
  }
63117
63183
  const lock = rawscript.lock;
63118
- if (removeLocks && removeLocks.includes(path8)) {
63184
+ if (removeLocks && removeLocks.includes(path9)) {
63119
63185
  rawscript.lock = undefined;
63120
63186
  } else if (lock && typeof lock === "string" && lock.trimStart().startsWith("!inline ")) {
63121
63187
  const lockPath = lock.split(" ")[1];
@@ -63298,11 +63364,11 @@ var init_relative_imports = __esm(async () => {
63298
63364
  });
63299
63365
 
63300
63366
  // src/commands/flow/flow_metadata.ts
63301
- import * as path8 from "node:path";
63367
+ import * as path9 from "node:path";
63302
63368
  import { sep as SEP7 } from "node:path";
63303
63369
  import { readFile as readFile7 } from "node:fs/promises";
63304
63370
  async function generateFlowHash(rawWorkspaceDependencies, folder, defaultTs) {
63305
- const elems = await FSFSElement(path8.join(process.cwd(), folder), [], true);
63371
+ const elems = await FSFSElement(path9.join(process.cwd(), folder), [], true);
63306
63372
  const hashes = {};
63307
63373
  for await (const f of elems.getChildren()) {
63308
63374
  if (exts.some((e) => f.path.endsWith(e))) {
@@ -63310,7 +63376,11 @@ async function generateFlowHash(rawWorkspaceDependencies, folder, defaultTs) {
63310
63376
  hashes[normalizedPath] = await generateHash(await f.getContentText() + JSON.stringify(rawWorkspaceDependencies));
63311
63377
  }
63312
63378
  }
63313
- return { ...hashes, [TOP_HASH]: await generateHash(JSON.stringify(hashes)) };
63379
+ const sortedHashes = {};
63380
+ for (const k of Object.keys(hashes).sort()) {
63381
+ sortedHashes[k] = hashes[k];
63382
+ }
63383
+ return { ...sortedHashes, [TOP_HASH]: await generateHash(JSON.stringify(sortedHashes)) };
63314
63384
  }
63315
63385
  async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpdateMetadataLock, noStaleMessage, tree) {
63316
63386
  if (folder.endsWith(SEP7)) {
@@ -63338,7 +63408,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
63338
63408
  continue;
63339
63409
  }
63340
63410
  }
63341
- const treePath = folderNormalized + "/" + path8.basename(script.path, path8.extname(script.path));
63411
+ const treePath = folderNormalized + "/" + path9.basename(script.path, path9.extname(script.path));
63342
63412
  const language = script.language;
63343
63413
  const imports = await extractRelativeImports(content, treePath, language);
63344
63414
  await tree.addNode(treePath, content, language, "", imports, "inline_script", folderNormalized, folder, false);
@@ -63373,29 +63443,29 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
63373
63443
  const c = script.content;
63374
63444
  if (c.startsWith("!inline ")) {
63375
63445
  const fileName = c.replace("!inline ", "");
63376
- const treePath = folderNormalized + "/" + path8.basename(script.path, path8.extname(script.path));
63446
+ const treePath = folderNormalized + "/" + path9.basename(script.path, path9.extname(script.path));
63377
63447
  fileToTreePath.set(fileName, treePath);
63378
63448
  }
63379
63449
  }
63380
63450
  if (!justUpdateMetadataLock) {
63381
63451
  const hashes = await generateFlowHash(filteredDeps, folder, opts.defaultTs);
63382
- for (const [path9, hash2] of Object.entries(hashes)) {
63383
- if (path9 == TOP_HASH) {
63452
+ for (const [path10, hash2] of Object.entries(hashes)) {
63453
+ if (path10 == TOP_HASH) {
63384
63454
  continue;
63385
63455
  }
63386
- if (!await checkifMetadataUptodate(folder, hash2, conf, path9)) {
63387
- changedScripts.push(path9);
63456
+ if (!await checkifMetadataUptodate(folder, hash2, conf, path10)) {
63457
+ changedScripts.push(path10);
63388
63458
  }
63389
63459
  }
63390
63460
  if (!noStaleMessage) {
63391
63461
  info(`Recomputing locks of ${changedScripts.join(", ")} in ${folder}`);
63392
63462
  }
63393
- const fileReader = async (path9) => await readFile7(folder + SEP7 + path9, "utf-8");
63463
+ const fileReader = async (path10) => await readFile7(folder + SEP7 + path10, "utf-8");
63394
63464
  const currentMapping = extractCurrentMapping(flowValue.value.modules, {}, flowValue.value.failure_module, flowValue.value.preprocessor_module);
63395
63465
  const locksToRemove = tree ? Object.keys(hashes).filter((k) => {
63396
63466
  if (k === TOP_HASH)
63397
63467
  return false;
63398
- const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path8.basename(k, path8.extname(k));
63468
+ const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path9.basename(k, path9.extname(k));
63399
63469
  return tree.isStale(treePath);
63400
63470
  }) : changedScripts;
63401
63471
  await replaceInlineScripts(flowValue.value.modules, fileReader, exports_log, folder + SEP7, SEP7, locksToRemove);
@@ -63431,8 +63501,8 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
63431
63501
  const depsForHash = tree ? {} : filteredDeps;
63432
63502
  const finalHashes = await generateFlowHash(depsForHash, folder, opts.defaultTs);
63433
63503
  await clearGlobalLock(folder);
63434
- for (const [path9, hash2] of Object.entries(finalHashes)) {
63435
- await updateMetadataGlobalLock(folder, hash2, path9);
63504
+ for (const [path10, hash2] of Object.entries(finalHashes)) {
63505
+ await updateMetadataGlobalLock(folder, hash2, path10);
63436
63506
  }
63437
63507
  if (!noStaleMessage) {
63438
63508
  info(colors.green(`Flow ${remote_path} lockfiles updated`));
@@ -63440,7 +63510,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
63440
63510
  const relocked = tree ? Object.keys(finalHashes).filter((k) => {
63441
63511
  if (k === TOP_HASH)
63442
63512
  return false;
63443
- const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path8.basename(k, path8.extname(k));
63513
+ const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path9.basename(k, path9.extname(k));
63444
63514
  return tree.isStale(treePath);
63445
63515
  }) : changedScripts;
63446
63516
  const updatedScripts = relocked.map((p) => {
@@ -63556,7 +63626,7 @@ __export(exports_sync, {
63556
63626
  FSFSElement: () => FSFSElement
63557
63627
  });
63558
63628
  import { readFile as readFile8, writeFile as writeFile7, readdir as readdir4, stat as stat7, rm, copyFile, mkdir as mkdir5 } from "node:fs/promises";
63559
- import * as path9 from "node:path";
63629
+ import * as path10 from "node:path";
63560
63630
  import { sep as SEP8 } from "node:path";
63561
63631
  function resolveWsNameFromBranch(opts, branchName) {
63562
63632
  const match2 = findWorkspaceByGitBranch(opts.workspaces, branchName);
@@ -63614,8 +63684,8 @@ function mergeCliWithEffectiveOptions(cliOpts, effectiveOpts) {
63614
63684
  async function resolveEffectiveSyncOptions(workspace, localConfig, promotion, workspaceNameOverride) {
63615
63685
  return await getEffectiveSettings(localConfig, promotion, false, false, workspaceNameOverride);
63616
63686
  }
63617
- function findCodebase(path10, codebases) {
63618
- if (!path10.endsWith(".ts")) {
63687
+ function findCodebase(path11, codebases) {
63688
+ if (!path11.endsWith(".ts")) {
63619
63689
  return;
63620
63690
  }
63621
63691
  for (const c of codebases) {
@@ -63631,7 +63701,7 @@ function findCodebase(path10, codebases) {
63631
63701
  if (included) {
63632
63702
  break;
63633
63703
  }
63634
- if (minimatch(path10, r)) {
63704
+ if (minimatch(path11, r)) {
63635
63705
  included = true;
63636
63706
  }
63637
63707
  }
@@ -63639,7 +63709,7 @@ function findCodebase(path10, codebases) {
63639
63709
  c.excludes = [c.excludes];
63640
63710
  }
63641
63711
  for (const r of c.excludes ?? []) {
63642
- if (minimatch(path10, r)) {
63712
+ if (minimatch(path11, r)) {
63643
63713
  excluded = true;
63644
63714
  }
63645
63715
  }
@@ -63648,13 +63718,13 @@ function findCodebase(path10, codebases) {
63648
63718
  }
63649
63719
  }
63650
63720
  }
63651
- async function addCodebaseDigestIfRelevant(path10, content, codebases, ignoreCodebaseChanges) {
63652
- const isScript = path10.endsWith(".script.yaml");
63721
+ async function addCodebaseDigestIfRelevant(path11, content, codebases, ignoreCodebaseChanges) {
63722
+ const isScript = path11.endsWith(".script.yaml");
63653
63723
  if (!isScript) {
63654
63724
  return content;
63655
63725
  }
63656
63726
  let isTs = true;
63657
- const replacedPath = path10.replace(".script.yaml", ".ts");
63727
+ const replacedPath = path11.replace(".script.yaml", ".ts");
63658
63728
  try {
63659
63729
  await stat7(replacedPath);
63660
63730
  } catch {
@@ -63668,9 +63738,9 @@ async function addCodebaseDigestIfRelevant(path10, content, codebases, ignoreCod
63668
63738
  if (c) {
63669
63739
  let parsed;
63670
63740
  try {
63671
- parsed = yamlParseContent(path10, content);
63741
+ parsed = yamlParseContent(path11, content);
63672
63742
  } catch (error2) {
63673
- error(`Failed to parse YAML content for codebase digest at path: ${path10}`);
63743
+ error(`Failed to parse YAML content for codebase digest at path: ${path11}`);
63674
63744
  throw error2;
63675
63745
  }
63676
63746
  if (parsed && typeof parsed == "object") {
@@ -63682,7 +63752,7 @@ async function addCodebaseDigestIfRelevant(path10, content, codebases, ignoreCod
63682
63752
  parsed["lock"] = "";
63683
63753
  return import_yaml11.stringify(parsed, yamlOptions);
63684
63754
  } else {
63685
- throw Error(`Expected local yaml ${path10} to be an object, found: ${content} instead`);
63755
+ throw Error(`Expected local yaml ${path11} to be an object, found: ${content} instead`);
63686
63756
  }
63687
63757
  }
63688
63758
  }
@@ -63699,7 +63769,7 @@ async function FSFSElement(p, codebases, ignoreCodebaseChanges) {
63699
63769
  try {
63700
63770
  const entries = await readdir4(localP, { withFileTypes: true });
63701
63771
  for (const e of entries) {
63702
- yield _internal_element(path9.join(localP, e.name), e.isDirectory(), codebases2);
63772
+ yield _internal_element(path10.join(localP, e.name), e.isDirectory(), codebases2);
63703
63773
  }
63704
63774
  } catch (e) {
63705
63775
  warn(`Error reading dir: ${localP}, ${e}`);
@@ -63870,7 +63940,7 @@ function extractInlineScriptsForApps(key, rec, pathAssigner, toId, removeSchema)
63870
63940
  }
63871
63941
  if (typeof rec == "object") {
63872
63942
  return Object.entries(rec).flatMap(([k, v]) => {
63873
- if (k == "inlineScript" && typeof v == "object") {
63943
+ if (k == "inlineScript" && v != null && typeof v == "object") {
63874
63944
  rec["type"] = undefined;
63875
63945
  const o = v;
63876
63946
  const name = toId(key ?? "", rec);
@@ -63978,9 +64048,9 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
63978
64048
  for (const basePath of moduleScripts) {
63979
64049
  if (normalizedP.startsWith(basePath + ".")) {
63980
64050
  const ext2 = normalizedP.slice(basePath.length);
63981
- const dir = path9.dirname(finalPath);
63982
- const base = path9.basename(basePath);
63983
- finalPath = path9.join(dir, base + getModuleFolderSuffix(), "script" + ext2);
64051
+ const dir = path10.dirname(finalPath);
64052
+ const base = path10.basename(basePath);
64053
+ finalPath = path10.join(dir, base + getModuleFolderSuffix(), "script" + ext2);
63984
64054
  break;
63985
64055
  }
63986
64056
  }
@@ -64016,7 +64086,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64016
64086
  for (const s of inlineScripts) {
64017
64087
  yield {
64018
64088
  isDirectory: false,
64019
- path: path9.join(finalPath, s.path),
64089
+ path: path10.join(finalPath, s.path),
64020
64090
  async* getChildren() {},
64021
64091
  async getContentText() {
64022
64092
  return s.content;
@@ -64029,7 +64099,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64029
64099
  }
64030
64100
  yield {
64031
64101
  isDirectory: false,
64032
- path: path9.join(finalPath, "flow.yaml"),
64102
+ path: path10.join(finalPath, "flow.yaml"),
64033
64103
  async* getChildren() {},
64034
64104
  async getContentText() {
64035
64105
  return import_yaml11.stringify(flow, yamlOptions);
@@ -64053,7 +64123,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64053
64123
  for (const s of inlineScripts) {
64054
64124
  yield {
64055
64125
  isDirectory: false,
64056
- path: path9.join(finalPath, s.path),
64126
+ path: path10.join(finalPath, s.path),
64057
64127
  async* getChildren() {},
64058
64128
  async getContentText() {
64059
64129
  return s.content;
@@ -64066,7 +64136,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64066
64136
  app.policy = undefined;
64067
64137
  yield {
64068
64138
  isDirectory: false,
64069
- path: path9.join(finalPath, "app.yaml"),
64139
+ path: path10.join(finalPath, "app.yaml"),
64070
64140
  async* getChildren() {},
64071
64141
  async getContentText() {
64072
64142
  return import_yaml11.stringify(app, yamlOptions);
@@ -64121,7 +64191,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64121
64191
  }
64122
64192
  yield {
64123
64193
  isDirectory: false,
64124
- path: path9.join(finalPath, filePath.substring(1)),
64194
+ path: path10.join(finalPath, filePath.substring(1)),
64125
64195
  async* getChildren() {},
64126
64196
  async getContentText() {
64127
64197
  if (typeof content !== "string") {
@@ -64138,7 +64208,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64138
64208
  for (const s of inlineScripts) {
64139
64209
  yield {
64140
64210
  isDirectory: false,
64141
- path: path9.join(finalPath, APP_BACKEND_FOLDER, s.path),
64211
+ path: path10.join(finalPath, APP_BACKEND_FOLDER, s.path),
64142
64212
  async* getChildren() {},
64143
64213
  async getContentText() {
64144
64214
  return s.content;
@@ -64174,7 +64244,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64174
64244
  }
64175
64245
  yield {
64176
64246
  isDirectory: false,
64177
- path: path9.join(finalPath, APP_BACKEND_FOLDER, `${runnableId}.yaml`),
64247
+ path: path10.join(finalPath, APP_BACKEND_FOLDER, `${runnableId}.yaml`),
64178
64248
  async* getChildren() {},
64179
64249
  async getContentText() {
64180
64250
  return import_yaml11.stringify(simplifiedRunnable, yamlOptions);
@@ -64188,7 +64258,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64188
64258
  delete rawApp?.["value"];
64189
64259
  yield {
64190
64260
  isDirectory: false,
64191
- path: path9.join(finalPath, "raw_app.yaml"),
64261
+ path: path10.join(finalPath, "raw_app.yaml"),
64192
64262
  async* getChildren() {},
64193
64263
  async getContentText() {
64194
64264
  return import_yaml11.stringify(rawApp, yamlOptions);
@@ -64196,7 +64266,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64196
64266
  };
64197
64267
  yield {
64198
64268
  isDirectory: false,
64199
- path: path9.join(finalPath, "DATATABLES.md"),
64269
+ path: path10.join(finalPath, "DATATABLES.md"),
64200
64270
  async* getChildren() {},
64201
64271
  async getContentText() {
64202
64272
  return generateDatatablesDocumentation(data3);
@@ -64299,12 +64369,12 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64299
64369
  const scriptBasePath = removeSuffix(removeSuffix(finalPath, metaExt), ".script");
64300
64370
  const moduleFolderPath = scriptBasePath + getModuleFolderSuffix();
64301
64371
  if (hasModules) {
64302
- r[0].path = path9.join(moduleFolderPath, "script" + metaExt);
64372
+ r[0].path = path10.join(moduleFolderPath, "script" + metaExt);
64303
64373
  }
64304
64374
  if (lock && lock != "") {
64305
64375
  r.push({
64306
64376
  isDirectory: false,
64307
- path: hasModules ? path9.join(moduleFolderPath, "script.lock") : removeSuffix(finalPath, metaExt) + ".lock",
64377
+ path: hasModules ? path10.join(moduleFolderPath, "script.lock") : removeSuffix(finalPath, metaExt) + ".lock",
64308
64378
  async* getChildren() {},
64309
64379
  async getContentText() {
64310
64380
  return lock;
@@ -64319,7 +64389,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64319
64389
  for (const [relPath, mod] of Object.entries(scriptModules)) {
64320
64390
  yield {
64321
64391
  isDirectory: false,
64322
- path: path9.join(moduleFolderPath, relPath),
64392
+ path: path10.join(moduleFolderPath, relPath),
64323
64393
  async* getChildren() {},
64324
64394
  async getContentText() {
64325
64395
  return mod.content;
@@ -64329,7 +64399,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64329
64399
  const baseName = relPath.replace(/\.[^.]+$/, "");
64330
64400
  yield {
64331
64401
  isDirectory: false,
64332
- path: path9.join(moduleFolderPath, baseName + ".lock"),
64402
+ path: path10.join(moduleFolderPath, baseName + ".lock"),
64333
64403
  async* getChildren() {},
64334
64404
  async getContentText() {
64335
64405
  return mod.lock;
@@ -64366,7 +64436,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64366
64436
  if (typeof fileContent === "string") {
64367
64437
  yield {
64368
64438
  isDirectory: false,
64369
- path: path9.join(filesetBasePath, relPath),
64439
+ path: path10.join(filesetBasePath, relPath),
64370
64440
  async* getChildren() {},
64371
64441
  async getContentText() {
64372
64442
  return fileContent;
@@ -64402,7 +64472,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64402
64472
  async* getChildren() {
64403
64473
  for (const filename in zip2.files) {
64404
64474
  const file = zip2.files[filename];
64405
- const totalPath = path9.join(p, filename);
64475
+ const totalPath = path10.join(p, filename);
64406
64476
  if (file.dir) {
64407
64477
  const e = zip2.folder(file.name);
64408
64478
  yield _internal_folder(totalPath, e);
@@ -64471,15 +64541,15 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
64471
64541
  if (entry.ignored) {
64472
64542
  continue;
64473
64543
  }
64474
- const path10 = entry.path;
64475
- if (isScriptModulePath(path10)) {
64476
- map[path10] = await entry.getContentText();
64544
+ const path11 = entry.path;
64545
+ if (isScriptModulePath(path11)) {
64546
+ map[path11] = await entry.getContentText();
64477
64547
  continue;
64478
64548
  }
64479
- if (!isFileResource(path10) && !isFilesetResource(path10) && !isRawAppFile(path10) && !isWorkspaceDependencies(path10)) {
64480
- if (json && path10.endsWith(".yaml"))
64549
+ if (!isFileResource(path11) && !isFilesetResource(path11) && !isRawAppFile(path11) && !isWorkspaceDependencies(path11)) {
64550
+ if (json && path11.endsWith(".yaml"))
64481
64551
  continue;
64482
- if (!json && path10.endsWith(".json"))
64552
+ if (!json && path11.endsWith(".json"))
64483
64553
  continue;
64484
64554
  if (![
64485
64555
  "json",
@@ -64501,39 +64571,39 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
64501
64571
  "java",
64502
64572
  "rb",
64503
64573
  "r"
64504
- ].includes(path10.split(".").pop() ?? "")) {
64574
+ ].includes(path11.split(".").pop() ?? "")) {
64505
64575
  continue;
64506
64576
  }
64507
64577
  }
64508
- if (isRawAppFile(path10)) {
64509
- const suffix = path10.split(getFolderSuffix("raw_app") + SEP8).pop();
64578
+ if (isRawAppFile(path11)) {
64579
+ const suffix = path11.split(getFolderSuffix("raw_app") + SEP8).pop();
64510
64580
  if (suffix?.startsWith("dist/") || suffix == "wmill.d.ts" || suffix == "package-lock.json" || suffix == "DATATABLES.md") {
64511
64581
  continue;
64512
64582
  }
64513
64583
  }
64514
- if (skips.skipResources && (isFileResource(path10) || isFilesetResource(path10)))
64584
+ if (skips.skipResources && (isFileResource(path11) || isFilesetResource(path11)))
64515
64585
  continue;
64516
64586
  const ext2 = json ? ".json" : ".yaml";
64517
- if (!skips.includeSchedules && path10.endsWith(".schedule" + ext2))
64587
+ if (!skips.includeSchedules && path11.endsWith(".schedule" + ext2))
64518
64588
  continue;
64519
- if (!skips.includeTriggers && (path10.endsWith(".http_trigger" + ext2) || path10.endsWith(".websocket_trigger" + ext2) || path10.endsWith(".kafka_trigger" + ext2) || path10.endsWith(".nats_trigger" + ext2) || path10.endsWith(".postgres_trigger" + ext2) || path10.endsWith(".mqtt_trigger" + ext2) || path10.endsWith(".sqs_trigger" + ext2) || path10.endsWith(".gcp_trigger" + ext2) || path10.endsWith(".email_trigger" + ext2) || path10.endsWith("_native_trigger" + ext2))) {
64589
+ if (!skips.includeTriggers && (path11.endsWith(".http_trigger" + ext2) || path11.endsWith(".websocket_trigger" + ext2) || path11.endsWith(".kafka_trigger" + ext2) || path11.endsWith(".nats_trigger" + ext2) || path11.endsWith(".postgres_trigger" + ext2) || path11.endsWith(".mqtt_trigger" + ext2) || path11.endsWith(".sqs_trigger" + ext2) || path11.endsWith(".gcp_trigger" + ext2) || path11.endsWith(".email_trigger" + ext2) || path11.endsWith("_native_trigger" + ext2))) {
64520
64590
  continue;
64521
64591
  }
64522
- if (!skips.includeUsers && path10.endsWith(".user" + ext2))
64592
+ if (!skips.includeUsers && path11.endsWith(".user" + ext2))
64523
64593
  continue;
64524
- if (!skips.includeGroups && path10.endsWith(".group" + ext2))
64594
+ if (!skips.includeGroups && path11.endsWith(".group" + ext2))
64525
64595
  continue;
64526
- if (!skips.includeSettings && path10 === "settings" + ext2)
64596
+ if (!skips.includeSettings && path11 === "settings" + ext2)
64527
64597
  continue;
64528
- if (!skips.includeKey && path10 === "encryption_key")
64598
+ if (!skips.includeKey && path11 === "encryption_key")
64529
64599
  continue;
64530
- if (skips.skipResources && path10.endsWith(".resource" + ext2))
64600
+ if (skips.skipResources && path11.endsWith(".resource" + ext2))
64531
64601
  continue;
64532
- if (skips.skipResourceTypes && path10.endsWith(".resource-type" + ext2)) {
64602
+ if (skips.skipResourceTypes && path11.endsWith(".resource-type" + ext2)) {
64533
64603
  continue;
64534
64604
  }
64535
64605
  try {
64536
- const fileType = getTypeStrFromPath(path10);
64606
+ const fileType = getTypeStrFromPath(path11);
64537
64607
  if (skips.skipVariables && fileType === "variable")
64538
64608
  continue;
64539
64609
  if (skips.skipScripts && fileType === "script")
@@ -64547,27 +64617,27 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
64547
64617
  if (skips.skipWorkspaceDependencies && fileType === "workspace_dependencies")
64548
64618
  continue;
64549
64619
  } catch {}
64550
- if (specificItems && isWorkspaceSpecificFile(path10)) {
64551
- if (!isCurrentWorkspaceFile(path10, cachedWsName)) {
64620
+ if (specificItems && isWorkspaceSpecificFile(path11)) {
64621
+ if (!isCurrentWorkspaceFile(path11, cachedWsName)) {
64552
64622
  continue;
64553
64623
  }
64554
64624
  }
64555
64625
  const content = await entry.getContentText();
64556
- if (skips.skipSecrets && path10.endsWith(".variable" + ext2)) {
64626
+ if (skips.skipSecrets && path11.endsWith(".variable" + ext2)) {
64557
64627
  try {
64558
64628
  let o;
64559
64629
  if (json) {
64560
64630
  try {
64561
64631
  o = JSON.parse(content);
64562
64632
  } catch (error2) {
64563
- error(`Failed to parse JSON variable content at path: ${path10}`);
64633
+ error(`Failed to parse JSON variable content at path: ${path11}`);
64564
64634
  throw error2;
64565
64635
  }
64566
64636
  } else {
64567
64637
  try {
64568
- o = yamlParseContent(path10, content);
64638
+ o = yamlParseContent(path11, content);
64569
64639
  } catch (error2) {
64570
- error(`Failed to parse YAML variable content at path: ${path10}`);
64640
+ error(`Failed to parse YAML variable content at path: ${path11}`);
64571
64641
  throw error2;
64572
64642
  }
64573
64643
  }
@@ -64575,12 +64645,12 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
64575
64645
  continue;
64576
64646
  }
64577
64647
  } catch (e) {
64578
- warn(`Error reading variable ${path10} to check for secrets`);
64648
+ warn(`Error reading variable ${path11} to check for secrets`);
64579
64649
  }
64580
64650
  }
64581
- if (cachedWsName && isCurrentWorkspaceFile(path10, cachedWsName)) {
64651
+ if (cachedWsName && isCurrentWorkspaceFile(path11, cachedWsName)) {
64582
64652
  const currentBranch = cachedWsName;
64583
- const basePath = fromWorkspaceSpecificPath(path10, currentBranch);
64653
+ const basePath = fromWorkspaceSpecificPath(path11, currentBranch);
64584
64654
  if (!isItemTypeConfigured(basePath, specificItems)) {
64585
64655
  continue;
64586
64656
  }
@@ -64589,14 +64659,14 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
64589
64659
  }
64590
64660
  map[basePath] = content;
64591
64661
  processedBasePaths.add(basePath);
64592
- } else if (!isWorkspaceSpecificFile(path10)) {
64593
- if (processedBasePaths.has(path10)) {
64662
+ } else if (!isWorkspaceSpecificFile(path11)) {
64663
+ if (processedBasePaths.has(path11)) {
64594
64664
  continue;
64595
64665
  }
64596
- if (!isRemote && isSpecificItem(path10, specificItems)) {
64666
+ if (!isRemote && isSpecificItem(path11, specificItems)) {
64597
64667
  continue;
64598
64668
  }
64599
- map[path10] = content;
64669
+ map[path11] = content;
64600
64670
  }
64601
64671
  }
64602
64672
  if (wrongFormatPaths.length > 0) {
@@ -64851,7 +64921,7 @@ async function ignoreF(wmillconf) {
64851
64921
  };
64852
64922
  }
64853
64923
  async function addToChangedIfNotExists(p, tracker) {
64854
- const isScript = exts.some((e) => p.endsWith(e));
64924
+ const isScript = exts.some((e) => p.endsWith(e)) && !isFileResource(p) && !isFilesetResource(p);
64855
64925
  if (isScript) {
64856
64926
  if (isFlowPath(p)) {
64857
64927
  const folder = extractFolderPath(p, "flow");
@@ -64976,7 +65046,7 @@ async function pull(opts) {
64976
65046
  throw error2;
64977
65047
  }
64978
65048
  if (opts.stateful) {
64979
- await mkdir5(path9.join(process.cwd(), ".wmill"), { recursive: true });
65049
+ await mkdir5(path10.join(process.cwd(), ".wmill"), { recursive: true });
64980
65050
  }
64981
65051
  const workspace = await resolveWorkspace(opts, wsNameForConfig);
64982
65052
  await requireLogin(opts);
@@ -65001,7 +65071,7 @@ async function pull(opts) {
65001
65071
  } catch {}
65002
65072
  const zipFile = await downloadZip(workspace, opts.plainSecrets, opts.skipVariables, opts.skipResources, opts.skipResourceTypes, opts.skipSecrets, opts.includeSchedules, opts.includeTriggers, opts.includeUsers, opts.includeGroups, opts.includeSettings, opts.includeKey, opts.skipWorkspaceDependencies, opts.defaultTs);
65003
65073
  const remote = ZipFSElement(zipFile, !opts.json, opts.defaultTs ?? "bun", resourceTypeToFormatExtension, resourceTypeToIsFileset, true, parseSyncBehavior(opts.syncBehavior) >= 1);
65004
- const local = !opts.stateful ? await FSFSElement(process.cwd(), codebases, true) : await FSFSElement(path9.join(process.cwd(), ".wmill"), [], true);
65074
+ const local = !opts.stateful ? await FSFSElement(process.cwd(), codebases, true) : await FSFSElement(path10.join(process.cwd(), ".wmill"), [], true);
65005
65075
  const changes = await compareDynFSElement(remote, local, await ignoreF(opts), opts.json ?? false, opts, false, codebases, true, specificItems, wsNameForFiles, true);
65006
65076
  info(`remote (${workspace.name}) -> local: ${changes.length} changes to apply`);
65007
65077
  if (opts.dryRun && opts.jsonOutput) {
@@ -65045,8 +65115,8 @@ async function pull(opts) {
65045
65115
  targetPath = workspaceSpecificPath;
65046
65116
  }
65047
65117
  }
65048
- const target = path9.join(process.cwd(), targetPath);
65049
- const stateTarget = path9.join(process.cwd(), ".wmill", targetPath);
65118
+ const target = path10.join(process.cwd(), targetPath);
65119
+ const stateTarget = path10.join(process.cwd(), ".wmill", targetPath);
65050
65120
  if (change.name === "edited") {
65051
65121
  if (opts.stateful) {
65052
65122
  try {
@@ -65079,13 +65149,13 @@ Both local and remote have been modified.`));
65079
65149
  }
65080
65150
  await writeFile7(target, change.after, "utf-8");
65081
65151
  if (opts.stateful) {
65082
- await mkdir5(path9.dirname(stateTarget), { recursive: true });
65152
+ await mkdir5(path10.dirname(stateTarget), { recursive: true });
65083
65153
  await copyFile(target, stateTarget);
65084
65154
  }
65085
65155
  } else if (change.name === "added") {
65086
- await mkdir5(path9.dirname(target), { recursive: true });
65156
+ await mkdir5(path10.dirname(target), { recursive: true });
65087
65157
  if (opts.stateful) {
65088
- await mkdir5(path9.dirname(stateTarget), { recursive: true });
65158
+ await mkdir5(path10.dirname(stateTarget), { recursive: true });
65089
65159
  info(`Adding ${getTypeStrFromPath(change.path)} ${targetPath}${targetPath !== change.path ? colors.gray(` (workspace-specific override for ${change.path})`) : ""}`);
65090
65160
  }
65091
65161
  await writeFile7(target, change.content, "utf-8");
@@ -65290,7 +65360,7 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
65290
65360
  resourceTypeToIsFileset = parsed.filesetMap;
65291
65361
  } catch {}
65292
65362
  const remote = ZipFSElement(await downloadZip(workspace, opts.plainSecrets, opts.skipVariables, opts.skipResources, opts.skipResourceTypes, opts.skipSecrets, opts.includeSchedules, opts.includeTriggers, opts.includeUsers, opts.includeGroups, opts.includeSettings, opts.includeKey, opts.skipWorkspaceDependencies, opts.defaultTs), !opts.json, opts.defaultTs ?? "bun", resourceTypeToFormatExtension, resourceTypeToIsFileset, false, parseSyncBehavior(opts.syncBehavior) >= 1);
65293
- const local = await FSFSElement(path9.join(process.cwd(), ""), codebases, false);
65363
+ const local = await FSFSElement(path10.join(process.cwd(), ""), codebases, false);
65294
65364
  const changes = await compareDynFSElement(local, remote, await ignoreF(opts), opts.json ?? false, opts, true, codebases, false, specificItems, wsNameForFiles, false);
65295
65365
  const rawWorkspaceDependencies = await getRawWorkspaceDependencies(true);
65296
65366
  const tracker = await buildTracker(changes);
@@ -65404,7 +65474,7 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
65404
65474
  }
65405
65475
  }
65406
65476
  for (const folderName2 of folderNames) {
65407
- const basePath = path9.join("f", folderName2, "folder.meta.yaml");
65477
+ const basePath = path10.join("f", folderName2, "folder.meta.yaml");
65408
65478
  const branchPath = getWorkspaceSpecificPath(`f/${folderName2}/folder.meta.yaml`, specificItems, wsNameForFiles);
65409
65479
  let found = false;
65410
65480
  if (branchPath) {
@@ -65526,7 +65596,7 @@ ${folderList}
65526
65596
  let stateful = opts.stateful;
65527
65597
  if (stateful) {
65528
65598
  try {
65529
- await stat7(path9.join(process.cwd(), ".wmill"));
65599
+ await stat7(path10.join(process.cwd(), ".wmill"));
65530
65600
  } catch {
65531
65601
  stateful = false;
65532
65602
  }
@@ -65577,7 +65647,7 @@ ${folderList}
65577
65647
  let stateTarget = undefined;
65578
65648
  if (stateful) {
65579
65649
  try {
65580
- stateTarget = path9.join(process.cwd(), ".wmill", change.path);
65650
+ stateTarget = path10.join(process.cwd(), ".wmill", change.path);
65581
65651
  await stat7(stateTarget);
65582
65652
  } catch {
65583
65653
  stateTarget = undefined;
@@ -65602,7 +65672,7 @@ ${folderList}
65602
65672
  continue;
65603
65673
  }
65604
65674
  if (stateTarget) {
65605
- await mkdir5(path9.dirname(stateTarget), { recursive: true });
65675
+ await mkdir5(path10.dirname(stateTarget), { recursive: true });
65606
65676
  info(`Editing ${getTypeStrFromPath(change.path)} ${change.path}`);
65607
65677
  }
65608
65678
  if (isFileResource(change.path)) {
@@ -65659,7 +65729,7 @@ ${folderList}
65659
65729
  continue;
65660
65730
  }
65661
65731
  if (stateTarget) {
65662
- await mkdir5(path9.dirname(stateTarget), { recursive: true });
65732
+ await mkdir5(path10.dirname(stateTarget), { recursive: true });
65663
65733
  info(`Adding ${getTypeStrFromPath(change.path)} ${change.path}`);
65664
65734
  }
65665
65735
  const obj = parseFromPath(change.path, change.content);
@@ -66252,8 +66322,8 @@ var init_parse_schema = __esm(() => {
66252
66322
  // src/utils/metadata.ts
66253
66323
  import { sep as SEP9 } from "node:path";
66254
66324
  import { readFile as readFile9, writeFile as writeFile8, stat as stat8, rm as rm2, readdir as readdir5 } from "node:fs/promises";
66255
- import { readFileSync as readFileSync3, existsSync as existsSync4, readdirSync, statSync, writeFileSync as writeFileSync3 } from "node:fs";
66256
- import * as path10 from "node:path";
66325
+ import { readFileSync as readFileSync3, existsSync as existsSync5, readdirSync, statSync, writeFileSync as writeFileSync4 } from "node:fs";
66326
+ import * as path11 from "node:path";
66257
66327
  import { createRequire as createRequire2 } from "node:module";
66258
66328
  function loadParser(pkgName) {
66259
66329
  let p = _parserCache.get(pkgName);
@@ -66295,8 +66365,8 @@ async function getRawWorkspaceDependencies(legacyBehaviour) {
66295
66365
  } catch {}
66296
66366
  return rawWorkspaceDeps;
66297
66367
  }
66298
- function workspaceDependenciesPathToLanguageAndFilename(path11) {
66299
- const relativePath = path11.replace("dependencies/", "");
66368
+ function workspaceDependenciesPathToLanguageAndFilename(path12) {
66369
+ const relativePath = path12.replace("dependencies/", "");
66300
66370
  for (const { filename, language } of workspaceDependenciesLanguages) {
66301
66371
  if (relativePath.endsWith(filename)) {
66302
66372
  return {
@@ -66350,8 +66420,8 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
66350
66420
  const scriptContent = await readFile9(scriptPath, "utf-8");
66351
66421
  const metadataContent = await readFile9(metadataWithType.path, "utf-8");
66352
66422
  const filteredRawWorkspaceDependencies = filterWorkspaceDependencies(rawWorkspaceDependencies, scriptContent, language);
66353
- const moduleFolderPath = isFolderLayout ? path10.dirname(scriptPath) : scriptPath.substring(0, scriptPath.indexOf(".")) + getModuleFolderSuffix();
66354
- const hasModules = existsSync4(moduleFolderPath) && statSync(moduleFolderPath).isDirectory();
66423
+ const moduleFolderPath = isFolderLayout ? path11.dirname(scriptPath) : scriptPath.substring(0, scriptPath.indexOf(".")) + getModuleFolderSuffix();
66424
+ const hasModules = existsSync5(moduleFolderPath) && statSync(moduleFolderPath).isDirectory();
66355
66425
  const depsForHash = tree ? {} : filteredRawWorkspaceDependencies;
66356
66426
  let hash2 = await generateScriptHash(depsForHash, scriptContent, metadataContent);
66357
66427
  let moduleHashes = {};
@@ -66407,7 +66477,7 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
66407
66477
  const hasCodebase = findCodebase(scriptPath, codebases) != null;
66408
66478
  if (!hasCodebase) {
66409
66479
  const tempScriptRefs = tree?.getTempScriptRefs(remotePath);
66410
- const lockPathOverride = isFolderLayout ? path10.dirname(scriptPath) + "/script.lock" : undefined;
66480
+ const lockPathOverride = isFolderLayout ? path11.dirname(scriptPath) + "/script.lock" : undefined;
66411
66481
  await updateScriptLock(workspace, scriptContent, language, remotePath, metadataParsedContent, filteredRawWorkspaceDependencies, tempScriptRefs, lockPathOverride);
66412
66482
  } else {
66413
66483
  metadataParsedContent.lock = "";
@@ -66438,10 +66508,10 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
66438
66508
  let newMetadataContent;
66439
66509
  if (isFolderLayout) {
66440
66510
  if (metadataWithType.isJson) {
66441
- metaPath = path10.dirname(scriptPath) + "/script.json";
66511
+ metaPath = path11.dirname(scriptPath) + "/script.json";
66442
66512
  newMetadataContent = JSON.stringify(metadataParsedContent);
66443
66513
  } else {
66444
- metaPath = path10.dirname(scriptPath) + "/script.yaml";
66514
+ metaPath = path11.dirname(scriptPath) + "/script.yaml";
66445
66515
  newMetadataContent = import_yaml13.stringify(metadataParsedContent, yamlOptions);
66446
66516
  }
66447
66517
  } else {
@@ -66453,7 +66523,7 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
66453
66523
  newMetadataContent = import_yaml13.stringify(metadataParsedContent, yamlOptions);
66454
66524
  }
66455
66525
  }
66456
- const metadataContentUsedForHash = newMetadataContent;
66526
+ const metadataContentUsedForHash = justUpdateMetadataLock ? metadataContent : newMetadataContent;
66457
66527
  hash2 = await generateScriptHash(depsForHash, scriptContent, metadataContentUsedForHash);
66458
66528
  if (hasModuleHashes) {
66459
66529
  const sortedEntries = Object.entries(moduleHashes).sort(([a], [b]) => a.localeCompare(b));
@@ -66471,8 +66541,8 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
66471
66541
  }
66472
66542
  return `${remotePath} (${language})`;
66473
66543
  }
66474
- async function updateScriptSchema(scriptContent, language, metadataContent, path11) {
66475
- const result = await inferSchema(language, scriptContent, metadataContent.schema, path11);
66544
+ async function updateScriptSchema(scriptContent, language, metadataContent, path12) {
66545
+ const result = await inferSchema(language, scriptContent, metadataContent.schema, path12);
66476
66546
  metadataContent.schema = result.schema;
66477
66547
  if (result.has_preprocessor) {
66478
66548
  metadataContent.has_preprocessor = result.has_preprocessor;
@@ -66626,7 +66696,7 @@ async function updateScriptLock(workspace, scriptContent, language, remotePath,
66626
66696
  async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath, rawWorkspaceDependencies, defaultTs, changedModules) {
66627
66697
  const entries = readdirSync(dirPath, { withFileTypes: true });
66628
66698
  for (const entry of entries) {
66629
- const fullPath = path10.join(dirPath, entry.name);
66699
+ const fullPath = path11.join(dirPath, entry.name);
66630
66700
  const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
66631
66701
  if (entry.isDirectory()) {
66632
66702
  await updateModuleLocks(workspace, fullPath, relPath, scriptRemotePath, rawWorkspaceDependencies, defaultTs, changedModules);
@@ -66650,12 +66720,12 @@ async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath
66650
66720
  try {
66651
66721
  const lock = await fetchScriptLock(workspace, moduleContent, modLanguage, moduleRemotePath, rawWorkspaceDependencies);
66652
66722
  const baseName = entry.name.replace(/\.[^.]+$/, "");
66653
- const lockPath = path10.join(dirPath, baseName + ".lock");
66723
+ const lockPath = path11.join(dirPath, baseName + ".lock");
66654
66724
  if (lock != "") {
66655
- writeFileSync3(lockPath, lock, "utf-8");
66725
+ writeFileSync4(lockPath, lock, "utf-8");
66656
66726
  } else {
66657
66727
  try {
66658
- if (existsSync4(lockPath)) {
66728
+ if (existsSync5(lockPath)) {
66659
66729
  const { rm: rmAsync } = await import("node:fs/promises");
66660
66730
  await rmAsync(lockPath);
66661
66731
  }
@@ -66667,7 +66737,7 @@ async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath
66667
66737
  }
66668
66738
  }
66669
66739
  }
66670
- async function inferSchema(language, content, currentSchema, path11) {
66740
+ async function inferSchema(language, content, currentSchema, path12) {
66671
66741
  let inferedSchema;
66672
66742
  if (language === "python3") {
66673
66743
  const { parse_python } = await loadParser("windmill-parser-wasm-py");
@@ -66770,7 +66840,7 @@ async function inferSchema(language, content, currentSchema, path11) {
66770
66840
  throw new Error("Invalid language: " + language);
66771
66841
  }
66772
66842
  if (inferedSchema.type == "Invalid") {
66773
- info(colors.yellow(`Script ${path11} invalid, it cannot be parsed to infer schema.`));
66843
+ info(colors.yellow(`Script ${path12} invalid, it cannot be parsed to infer schema.`));
66774
66844
  return {
66775
66845
  schema: defaultScriptMetadata().schema,
66776
66846
  has_preprocessor: false,
@@ -66942,15 +67012,15 @@ async function readLockfile() {
66942
67012
  return lock;
66943
67013
  }
66944
67014
  }
66945
- function v2LockPath(path11, subpath) {
66946
- const normalizedPath = normalizeLockPath(path11);
67015
+ function v2LockPath(path12, subpath) {
67016
+ const normalizedPath = normalizeLockPath(path12);
66947
67017
  if (subpath) {
66948
67018
  return `${normalizedPath}+${normalizeLockPath(subpath)}`;
66949
67019
  } else {
66950
67020
  return normalizedPath;
66951
67021
  }
66952
67022
  }
66953
- async function checkifMetadataUptodate(path11, hash2, conf, subpath) {
67023
+ async function checkifMetadataUptodate(path12, hash2, conf, subpath) {
66954
67024
  if (!conf) {
66955
67025
  conf = await readLockfile();
66956
67026
  }
@@ -66959,10 +67029,10 @@ async function checkifMetadataUptodate(path11, hash2, conf, subpath) {
66959
67029
  }
66960
67030
  const isV2 = conf?.version == "v2";
66961
67031
  if (isV2) {
66962
- const current = conf.locks?.[v2LockPath(path11, subpath)];
67032
+ const current = conf.locks?.[v2LockPath(path12, subpath)];
66963
67033
  return current == hash2;
66964
67034
  } else {
66965
- const obj = conf.locks?.[path11];
67035
+ const obj = conf.locks?.[path12];
66966
67036
  const current = subpath && typeof obj == "object" ? obj?.[subpath] : obj;
66967
67037
  return current == hash2;
66968
67038
  }
@@ -66975,7 +67045,7 @@ async function computeModuleHashes(moduleFolderPath, defaultTs, rawWorkspaceDepe
66975
67045
  async function readDir2(dirPath, relPrefix) {
66976
67046
  const entries = readdirSync(dirPath, { withFileTypes: true });
66977
67047
  for (const entry of entries) {
66978
- const fullPath = path10.join(dirPath, entry.name);
67048
+ const fullPath = path11.join(dirPath, entry.name);
66979
67049
  const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
66980
67050
  const isTopLevel = relPrefix === "";
66981
67051
  if (entry.isDirectory()) {
@@ -66995,14 +67065,14 @@ async function computeModuleHashes(moduleFolderPath, defaultTs, rawWorkspaceDepe
66995
67065
  await readDir2(moduleFolderPath, "");
66996
67066
  return hashes;
66997
67067
  }
66998
- async function clearGlobalLock(path11) {
67068
+ async function clearGlobalLock(path12) {
66999
67069
  const conf = await readLockfile();
67000
67070
  if (!conf?.locks) {
67001
67071
  conf.locks = {};
67002
67072
  }
67003
67073
  const isV2 = conf?.version == "v2";
67004
67074
  if (isV2) {
67005
- const key = v2LockPath(path11);
67075
+ const key = v2LockPath(path12);
67006
67076
  if (conf.locks) {
67007
67077
  Object.keys(conf.locks).forEach((k) => {
67008
67078
  if (conf.locks) {
@@ -67015,24 +67085,24 @@ async function clearGlobalLock(path11) {
67015
67085
  await writeFile8(WMILL_LOCKFILE, import_yaml13.stringify(conf, yamlOptions), "utf-8");
67016
67086
  }
67017
67087
  }
67018
- async function updateMetadataGlobalLock(path11, hash2, subpath) {
67088
+ async function updateMetadataGlobalLock(path12, hash2, subpath) {
67019
67089
  const conf = await readLockfile();
67020
67090
  if (!conf?.locks) {
67021
67091
  conf.locks = {};
67022
67092
  }
67023
67093
  const isV2 = conf?.version == "v2";
67024
67094
  if (isV2) {
67025
- conf.locks[v2LockPath(path11, subpath)] = hash2;
67095
+ conf.locks[v2LockPath(path12, subpath)] = hash2;
67026
67096
  } else {
67027
67097
  if (subpath) {
67028
- let prev = conf.locks[path11];
67098
+ let prev = conf.locks[path12];
67029
67099
  if (!prev || typeof prev != "object") {
67030
67100
  prev = {};
67031
- conf.locks[path11] = prev;
67101
+ conf.locks[path12] = prev;
67032
67102
  }
67033
67103
  prev[subpath] = hash2;
67034
67104
  } else {
67035
- conf.locks[path11] = hash2;
67105
+ conf.locks[path12] = hash2;
67036
67106
  }
67037
67107
  }
67038
67108
  await writeFile8(WMILL_LOCKFILE, import_yaml13.stringify(conf, yamlOptions), "utf-8");
@@ -67082,7 +67152,7 @@ __export(exports_raw_apps, {
67082
67152
  generatingPolicy: () => generatingPolicy
67083
67153
  });
67084
67154
  import { sep as SEP10 } from "node:path";
67085
- import path11 from "node:path";
67155
+ import path12 from "node:path";
67086
67156
  import { readFile as readFile10, readdir as readdir6 } from "node:fs/promises";
67087
67157
  async function findRunnableContentFile(backendPath, runnableId, allFiles) {
67088
67158
  for (const fileName of allFiles) {
@@ -67095,7 +67165,7 @@ async function findRunnableContentFile(backendPath, runnableId, allFiles) {
67095
67165
  const ext2 = fileName.substring(runnableId.length + 1);
67096
67166
  if (EXTENSION_TO_LANGUAGE[ext2]) {
67097
67167
  try {
67098
- const content = await readFile10(path11.join(backendPath, fileName), "utf-8");
67168
+ const content = await readFile10(path12.join(backendPath, fileName), "utf-8");
67099
67169
  return { ext: ext2, content };
67100
67170
  } catch {
67101
67171
  continue;
@@ -67132,7 +67202,7 @@ async function loadRunnablesFromBackend(backendPath, defaultTs = "bun") {
67132
67202
  }
67133
67203
  const runnableId = fileName.replace(".yaml", "");
67134
67204
  processedIds.add(runnableId);
67135
- const filePath = path11.join(backendPath, fileName);
67205
+ const filePath = path12.join(backendPath, fileName);
67136
67206
  const runnable = await yamlParseFile(filePath);
67137
67207
  if (runnable?.type === "inline") {
67138
67208
  const contentFile = await findRunnableContentFile(backendPath, runnableId, allFiles);
@@ -67140,7 +67210,7 @@ async function loadRunnablesFromBackend(backendPath, defaultTs = "bun") {
67140
67210
  const language = getLanguageFromExtension(contentFile.ext, defaultTs);
67141
67211
  let lock;
67142
67212
  try {
67143
- lock = await readFile10(path11.join(backendPath, `${runnableId}.lock`), "utf-8");
67213
+ lock = await readFile10(path12.join(backendPath, `${runnableId}.lock`), "utf-8");
67144
67214
  } catch {}
67145
67215
  runnable.inlineScript = {
67146
67216
  content: contentFile.content,
@@ -67171,7 +67241,7 @@ async function loadRunnablesFromBackend(backendPath, defaultTs = "bun") {
67171
67241
  const language = getLanguageFromExtension(contentFile.ext, defaultTs);
67172
67242
  let lock;
67173
67243
  try {
67174
- lock = await readFile10(path11.join(backendPath, `${runnableId}.lock`), "utf-8");
67244
+ lock = await readFile10(path12.join(backendPath, `${runnableId}.lock`), "utf-8");
67175
67245
  } catch {}
67176
67246
  runnables[runnableId] = {
67177
67247
  type: "inline",
@@ -67199,7 +67269,7 @@ function writeRunnableToBackend(backendPath, runnableId, runnable) {
67199
67269
  ...rest
67200
67270
  };
67201
67271
  }
67202
- const filePath = path11.join(backendPath, `${runnableId}.yaml`);
67272
+ const filePath = path12.join(backendPath, `${runnableId}.yaml`);
67203
67273
  writeIfChanged(filePath, import_yaml16.stringify(runnableToWrite, yamlOptions));
67204
67274
  }
67205
67275
  async function collectAppFiles(localPath) {
@@ -67250,7 +67320,7 @@ async function pushRawApp(workspace, remotePath, localPath, message) {
67250
67320
  }
67251
67321
  const appFilePath = localPath + "raw_app.yaml";
67252
67322
  const localApp = await yamlParseFile(appFilePath);
67253
- const backendPath = path11.join(localPath, APP_BACKEND_FOLDER);
67323
+ const backendPath = path12.join(localPath, APP_BACKEND_FOLDER);
67254
67324
  const runnablesFromBackend = await loadRunnablesFromBackend(backendPath);
67255
67325
  let runnables;
67256
67326
  if (Object.keys(runnablesFromBackend).length > 0) {
@@ -67326,13 +67396,13 @@ async function pushRawApp(workspace, remotePath, localPath, message) {
67326
67396
  });
67327
67397
  }
67328
67398
  }
67329
- async function generatingPolicy(app, path12, publicApp) {
67330
- info(colors.gray(`Generating fresh policy for app ${path12}...`));
67399
+ async function generatingPolicy(app, path13, publicApp) {
67400
+ info(colors.gray(`Generating fresh policy for app ${path13}...`));
67331
67401
  try {
67332
67402
  app.policy = await updateRawAppPolicy(app.runnables, app.policy);
67333
67403
  app.policy.execution_mode = publicApp ? "anonymous" : "publisher";
67334
67404
  } catch (e) {
67335
- error(colors.red(`Error generating policy for app ${path12}: ${e}`));
67405
+ error(colors.red(`Error generating policy for app ${path13}: ${e}`));
67336
67406
  throw e;
67337
67407
  }
67338
67408
  }
@@ -67369,11 +67439,11 @@ __export(exports_app_metadata, {
67369
67439
  filterWorkspaceDependenciesForApp: () => filterWorkspaceDependenciesForApp,
67370
67440
  APP_BACKEND_FOLDER: () => APP_BACKEND_FOLDER
67371
67441
  });
67372
- import path12 from "node:path";
67442
+ import path13 from "node:path";
67373
67443
  import { readFile as readFile11, mkdir as mkdir6 } from "node:fs/promises";
67374
67444
  import { sep as SEP11 } from "node:path";
67375
67445
  async function generateAppHash(rawReqs, folder, rawApp, defaultTs) {
67376
- const runnablesFolder = rawApp ? path12.join(folder, APP_BACKEND_FOLDER) : folder;
67446
+ const runnablesFolder = rawApp ? path13.join(folder, APP_BACKEND_FOLDER) : folder;
67377
67447
  const hashes = {};
67378
67448
  try {
67379
67449
  const elems = await FSFSElement(runnablesFolder, [], true);
@@ -67394,7 +67464,11 @@ async function generateAppHash(rawReqs, folder, rawApp, defaultTs) {
67394
67464
  throw error2;
67395
67465
  }
67396
67466
  }
67397
- return { ...hashes, [TOP_HASH2]: await generateHash(JSON.stringify(hashes)) };
67467
+ const sortedHashes = {};
67468
+ for (const k of Object.keys(hashes).sort()) {
67469
+ sortedHashes[k] = hashes[k];
67470
+ }
67471
+ return { ...sortedHashes, [TOP_HASH2]: await generateHash(JSON.stringify(sortedHashes)) };
67398
67472
  }
67399
67473
  async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, opts, justUpdateMetadataLock, noStaleMessage, tree) {
67400
67474
  if (appFolder.endsWith(SEP11)) {
@@ -67404,7 +67478,7 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
67404
67478
  if (!justUpdateMetadataLock && !noStaleMessage) {
67405
67479
  info(`Generating locks for app ${appFolder} at ${remote_path}`);
67406
67480
  }
67407
- const appFilePath = path12.join(appFolder, rawApp ? "raw_app.yaml" : "app.yaml");
67481
+ const appFilePath = path13.join(appFolder, rawApp ? "raw_app.yaml" : "app.yaml");
67408
67482
  const appFile = await yamlParseFile(appFilePath);
67409
67483
  const appValue = rawApp ? appFile.runnables : appFile.value;
67410
67484
  const folderNormalized = appFolder.replaceAll(SEP11, "/");
@@ -67416,7 +67490,7 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
67416
67490
  const isDirectlyStale = !await checkifMetadataUptodate(appFolder, hashes[TOP_HASH2], conf, TOP_HASH2);
67417
67491
  let treeAppValue = structuredClone(appValue);
67418
67492
  if (rawApp) {
67419
- const runnablesPath = path12.join(appFolder, APP_BACKEND_FOLDER);
67493
+ const runnablesPath = path13.join(appFolder, APP_BACKEND_FOLDER);
67420
67494
  const runnablesFromFiles = await loadRunnablesFromBackend(runnablesPath);
67421
67495
  if (Object.keys(runnablesFromFiles).length > 0) {
67422
67496
  treeAppValue = runnablesFromFiles;
@@ -67482,7 +67556,7 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
67482
67556
  info(`Recomputing locks of ${changedScripts.join(", ")} in ${appFolder}`);
67483
67557
  }
67484
67558
  if (rawApp) {
67485
- const runnablesPath = path12.join(appFolder, APP_BACKEND_FOLDER);
67559
+ const runnablesPath = path13.join(appFolder, APP_BACKEND_FOLDER);
67486
67560
  const rawAppFile = appFile;
67487
67561
  let runnables = await loadRunnablesFromBackend(runnablesPath);
67488
67562
  if (Object.keys(runnables).length === 0 && rawAppFile.runnables) {
@@ -67555,7 +67629,7 @@ async function traverseAndProcessInlineScripts(obj, processor, currentPath = [])
67555
67629
  }
67556
67630
  async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder, rawDeps, defaultTs = "bun", noStaleMessage, tempScriptRefs) {
67557
67631
  const updatedRunnables = [];
67558
- const runnablesFolder = path12.join(appFolder, APP_BACKEND_FOLDER);
67632
+ const runnablesFolder = path13.join(appFolder, APP_BACKEND_FOLDER);
67559
67633
  try {
67560
67634
  await mkdir6(runnablesFolder, { recursive: true });
67561
67635
  } catch {}
@@ -67580,7 +67654,7 @@ async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder
67580
67654
  if (language === "frontend") {
67581
67655
  const [basePathO, ext2] = pathAssigner.assignPath(runnableId, language);
67582
67656
  const basePath = basePathO.replaceAll(SEP11, "/");
67583
- const contentPath = path12.join(runnablesFolder, `${basePath}${ext2}`);
67657
+ const contentPath = path13.join(runnablesFolder, `${basePath}${ext2}`);
67584
67658
  writeIfChanged(contentPath, content);
67585
67659
  const simplifiedRunnable = { type: "inline" };
67586
67660
  for (const [key, value] of Object.entries(runnable)) {
@@ -67598,8 +67672,8 @@ async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder
67598
67672
  const lock = await generateInlineScriptLock(workspace, content, language, `${remotePath}/${runnableId}`, rawDeps, tempScriptRefs);
67599
67673
  const [basePathO, ext2] = pathAssigner.assignPath(runnableId, language);
67600
67674
  const basePath = basePathO.replaceAll(SEP11, "/");
67601
- const contentPath = path12.join(runnablesFolder, `${basePath}${ext2}`);
67602
- const lockPath = path12.join(runnablesFolder, `${basePath}lock`);
67675
+ const contentPath = path13.join(runnablesFolder, `${basePath}${ext2}`);
67676
+ const lockPath = path13.join(runnablesFolder, `${basePath}lock`);
67603
67677
  writeIfChanged(contentPath, content);
67604
67678
  if (lock && lock !== "") {
67605
67679
  writeIfChanged(lockPath, lock);
@@ -67647,8 +67721,8 @@ async function updateAppInlineScripts(workspace, appValue, remotePath, appFolder
67647
67721
  }
67648
67722
  const [basePathO, ext2] = pathAssigner.assignPath(scriptName, language);
67649
67723
  const basePath = basePathO.replaceAll(SEP11, "/");
67650
- const contentPath = path12.join(appFolder, `${basePath}${ext2}`);
67651
- const lockPath = path12.join(appFolder, `${basePath}lock`);
67724
+ const contentPath = path13.join(appFolder, `${basePath}${ext2}`);
67725
+ const lockPath = path13.join(appFolder, `${basePath}lock`);
67652
67726
  writeIfChanged(contentPath, content);
67653
67727
  if (lock && lock !== "") {
67654
67728
  writeIfChanged(lockPath, lock);
@@ -67719,7 +67793,7 @@ ${text}`);
67719
67793
  }
67720
67794
  }
67721
67795
  async function inferRunnableSchemaFromFile(appFolder, runnableFilePath) {
67722
- const fileName = path12.basename(runnableFilePath);
67796
+ const fileName = path13.basename(runnableFilePath);
67723
67797
  if (fileName.endsWith(".lock") || fileName.endsWith(".yaml")) {
67724
67798
  return;
67725
67799
  }
@@ -67728,13 +67802,13 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath) {
67728
67802
  return;
67729
67803
  }
67730
67804
  const runnableId = match2[1];
67731
- const runnableFilePath2 = path12.join(appFolder, APP_BACKEND_FOLDER, `${runnableId}.yaml`);
67805
+ const runnableFilePath2 = path13.join(appFolder, APP_BACKEND_FOLDER, `${runnableId}.yaml`);
67732
67806
  let runnable;
67733
67807
  try {
67734
67808
  runnable = await yamlParseFile(runnableFilePath2);
67735
67809
  } catch {
67736
67810
  try {
67737
- const appFilePath = path12.join(appFolder, "raw_app.yaml");
67811
+ const appFilePath = path13.join(appFolder, "raw_app.yaml");
67738
67812
  const appFile = await yamlParseFile(appFilePath);
67739
67813
  if (!appFile.runnables?.[runnableId]) {
67740
67814
  warn(colors.yellow(`Runnable ${runnableId} not found in backend folder or raw_app.yaml`));
@@ -67751,7 +67825,7 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath) {
67751
67825
  }
67752
67826
  const inlineScript = runnable.inlineScript;
67753
67827
  const language = inlineScript.language;
67754
- const fullFilePath = path12.join(appFolder, APP_BACKEND_FOLDER, runnableFilePath);
67828
+ const fullFilePath = path13.join(appFolder, APP_BACKEND_FOLDER, runnableFilePath);
67755
67829
  let content;
67756
67830
  try {
67757
67831
  content = await readFile11(fullFilePath, "utf-8");
@@ -67861,8 +67935,8 @@ var init_app_metadata = __esm(async () => {
67861
67935
  // src/commands/app/generate_agents.ts
67862
67936
  import * as fs9 from "node:fs";
67863
67937
  import { writeFile as writeFile9 } from "node:fs/promises";
67864
- import path13 from "node:path";
67865
- import process14 from "node:process";
67938
+ import path14 from "node:path";
67939
+ import process15 from "node:process";
67866
67940
  function generateDatatablesMarkdown(schemas, localData) {
67867
67941
  const defaultDatatable = localData?.datatable;
67868
67942
  const defaultSchema = localData?.schema;
@@ -67961,7 +68035,7 @@ Configure datatables in Workspace Settings > Windmill Data Tables.
67961
68035
  return content;
67962
68036
  }
67963
68037
  async function regenerateAgentDocs(workspaceId, targetDir, silent = false) {
67964
- const rawAppPath = path13.join(targetDir, "raw_app.yaml");
68038
+ const rawAppPath = path14.join(targetDir, "raw_app.yaml");
67965
68039
  if (!fs9.existsSync(rawAppPath)) {
67966
68040
  if (!silent) {
67967
68041
  error(colors.red(`Error: raw_app.yaml not found in ${targetDir}`));
@@ -67988,11 +68062,11 @@ async function regenerateAgentDocs(workspaceId, targetDir, silent = false) {
67988
68062
  }
67989
68063
  } catch {}
67990
68064
  const agentsContent = generateAgentsDocumentation(localData);
67991
- await writeFile9(path13.join(targetDir, "AGENTS.md"), agentsContent, "utf-8");
67992
- await writeFile9(path13.join(targetDir, "CLAUDE.md"), `Instructions are in @AGENTS.md
68065
+ await writeFile9(path14.join(targetDir, "AGENTS.md"), agentsContent, "utf-8");
68066
+ await writeFile9(path14.join(targetDir, "CLAUDE.md"), `Instructions are in @AGENTS.md
67993
68067
  `, "utf-8");
67994
68068
  const datatablesContent = generateDatatablesMarkdown(schemas, localData);
67995
- await writeFile9(path13.join(targetDir, "DATATABLES.md"), datatablesContent, "utf-8");
68069
+ await writeFile9(path14.join(targetDir, "DATATABLES.md"), datatablesContent, "utf-8");
67996
68070
  if (!silent) {
67997
68071
  info(colors.green(`✓ Generated AGENTS.md, CLAUDE.md, and DATATABLES.md`));
67998
68072
  const datatableCount = schemas.length;
@@ -68010,24 +68084,24 @@ async function regenerateAgentDocs(workspaceId, targetDir, silent = false) {
68010
68084
  }
68011
68085
  }
68012
68086
  async function generateAgents(opts, appFolder) {
68013
- const cwd = process14.cwd();
68087
+ const cwd = process15.cwd();
68014
68088
  let targetDir = cwd;
68015
68089
  if (appFolder) {
68016
- targetDir = path13.isAbsolute(appFolder) ? appFolder : path13.join(cwd, appFolder);
68090
+ targetDir = path14.isAbsolute(appFolder) ? appFolder : path14.join(cwd, appFolder);
68017
68091
  }
68018
68092
  await loadNonDottedPathsSetting();
68019
- const dirName = path13.basename(targetDir);
68093
+ const dirName = path14.basename(targetDir);
68020
68094
  if (!hasFolderSuffix(dirName, "raw_app")) {
68021
- if (!hasFolderSuffix(path13.basename(cwd), "raw_app") && !appFolder) {
68095
+ if (!hasFolderSuffix(path14.basename(cwd), "raw_app") && !appFolder) {
68022
68096
  error(colors.red(`Error: Must be run inside a ${getFolderSuffix("raw_app")} folder or specify one as argument.`));
68023
68097
  info(colors.gray("Usage: wmill app generate-agents [app_folder]"));
68024
- process14.exit(1);
68098
+ process15.exit(1);
68025
68099
  }
68026
68100
  }
68027
- const rawAppPath = path13.join(targetDir, "raw_app.yaml");
68101
+ const rawAppPath = path14.join(targetDir, "raw_app.yaml");
68028
68102
  if (!fs9.existsSync(rawAppPath)) {
68029
68103
  error(colors.red(`Error: raw_app.yaml not found in ${targetDir}`));
68030
- process14.exit(1);
68104
+ process15.exit(1);
68031
68105
  }
68032
68106
  const workspace = await resolveWorkspace(opts);
68033
68107
  await requireLogin(opts);
@@ -68054,40 +68128,40 @@ var init_generate_agents = __esm(async () => {
68054
68128
  import { sep as SEP12 } from "node:path";
68055
68129
  import * as http2 from "node:http";
68056
68130
  import * as fs10 from "node:fs";
68057
- import * as path14 from "node:path";
68058
- import process15 from "node:process";
68059
- import { writeFileSync as writeFileSync4 } from "node:fs";
68131
+ import * as path15 from "node:path";
68132
+ import process16 from "node:process";
68133
+ import { writeFileSync as writeFileSync5 } from "node:fs";
68060
68134
  import { readFile as readFile12 } from "node:fs/promises";
68061
68135
  async function dev(opts, appFolder) {
68062
68136
  GLOBAL_CONFIG_OPT.noCdToRoot = true;
68063
68137
  await loadNonDottedPathsSetting();
68064
- const originalCwd = process15.cwd();
68138
+ const originalCwd = process16.cwd();
68065
68139
  let targetDir = originalCwd;
68066
68140
  if (appFolder) {
68067
- targetDir = path14.isAbsolute(appFolder) ? appFolder : path14.join(originalCwd, appFolder);
68141
+ targetDir = path15.isAbsolute(appFolder) ? appFolder : path15.join(originalCwd, appFolder);
68068
68142
  if (!fs10.existsSync(targetDir)) {
68069
68143
  error(colors.red(`Error: Directory not found: ${targetDir}`));
68070
- process15.exit(1);
68144
+ process16.exit(1);
68071
68145
  }
68072
68146
  }
68073
- const targetDirName = path14.basename(targetDir);
68147
+ const targetDirName = path15.basename(targetDir);
68074
68148
  if (!hasFolderSuffix(targetDirName, "raw_app")) {
68075
68149
  error(colors.red(`Error: The dev command must be run inside a ${getFolderSuffix("raw_app")} folder.
68076
68150
  ` + `Target directory: ${targetDirName}
68077
68151
  ` + `Please navigate to a folder ending with '${getFolderSuffix("raw_app")}' or specify one as argument.`));
68078
- process15.exit(1);
68152
+ process16.exit(1);
68079
68153
  }
68080
- const rawAppPath = path14.join(targetDir, "raw_app.yaml");
68154
+ const rawAppPath = path15.join(targetDir, "raw_app.yaml");
68081
68155
  if (!fs10.existsSync(rawAppPath)) {
68082
68156
  error(colors.red(`Error: raw_app.yaml not found in ${targetDir}.
68083
68157
  ` + `The dev command requires a ${getFolderSuffix("raw_app")} folder containing a raw_app.yaml file.`));
68084
- process15.exit(1);
68158
+ process16.exit(1);
68085
68159
  }
68086
68160
  const workspace = await resolveWorkspace(opts);
68087
68161
  await requireLogin(opts);
68088
68162
  const workspaceId = workspace.workspaceId;
68089
68163
  if (appFolder) {
68090
- process15.chdir(targetDir);
68164
+ process16.chdir(targetDir);
68091
68165
  }
68092
68166
  const rawApp = await yamlParseFile(rawAppPath);
68093
68167
  const appPath = rawApp?.custom_path ?? "u/unknown/newapp";
@@ -68097,18 +68171,18 @@ async function dev(opts, appFolder) {
68097
68171
  });
68098
68172
  const host = opts.host ?? DEFAULT_HOST;
68099
68173
  const shouldOpen = opts.open ?? true;
68100
- const frameworks = detectFrameworks(process15.cwd());
68174
+ const frameworks = detectFrameworks(process16.cwd());
68101
68175
  const defaultEntry = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
68102
68176
  const entryPoint = opts.entry ?? defaultEntry;
68103
68177
  if (!fs10.existsSync(entryPoint)) {
68104
68178
  error(colors.red(`Entry point "${entryPoint}" not found. Please specify a valid entry point with --entry.`));
68105
- process15.exit(1);
68179
+ process16.exit(1);
68106
68180
  }
68107
- const appDir = path14.dirname(entryPoint) || process15.cwd();
68181
+ const appDir = path15.dirname(entryPoint) || process16.cwd();
68108
68182
  await ensureNodeModules(appDir);
68109
68183
  const inferredSchemas = {};
68110
68184
  genRunnablesTs(inferredSchemas);
68111
- const distDir = path14.join(process15.cwd(), "dist");
68185
+ const distDir = path15.join(process16.cwd(), "dist");
68112
68186
  if (!fs10.existsSync(distDir)) {
68113
68187
  fs10.mkdirSync(distDir);
68114
68188
  }
@@ -68171,7 +68245,7 @@ data: reload
68171
68245
  info(colors.blue(`\uD83D\uDC40 Watching for file changes...
68172
68246
  `));
68173
68247
  await ctx.rebuild();
68174
- const runnablesPath = path14.join(process15.cwd(), APP_BACKEND_FOLDER);
68248
+ const runnablesPath = path15.join(process16.cwd(), APP_BACKEND_FOLDER);
68175
68249
  let runnablesWatcher;
68176
68250
  if (fs10.existsSync(runnablesPath)) {
68177
68251
  info(colors.blue(`\uD83D\uDC41️ Watching runnables folder at: ${runnablesPath}
@@ -68183,8 +68257,8 @@ data: reload
68183
68257
  if (!filename)
68184
68258
  return;
68185
68259
  const fileStr = typeof filename === "string" ? filename : filename.toString();
68186
- const changedPath = path14.join(runnablesPath, fileStr);
68187
- const relativePath = path14.relative(process15.cwd(), changedPath);
68260
+ const changedPath = path15.join(runnablesPath, fileStr);
68261
+ const relativePath = path15.relative(process16.cwd(), changedPath);
68188
68262
  const relativeToRunnables = fileStr;
68189
68263
  if (changedPath.endsWith(".lock")) {
68190
68264
  return;
@@ -68197,7 +68271,7 @@ data: reload
68197
68271
  delete schemaInferenceTimeouts[changedPath];
68198
68272
  try {
68199
68273
  info(colors.cyan(`\uD83D\uDCDD Inferring schema for: ${relativeToRunnables}`));
68200
- const result = await inferRunnableSchemaFromFile(process15.cwd(), relativeToRunnables);
68274
+ const result = await inferRunnableSchemaFromFile(process16.cwd(), relativeToRunnables);
68201
68275
  if (result) {
68202
68276
  inferredSchemas[result.runnableId] = result.schema;
68203
68277
  info(colors.green(` Inferred Schemas: ${JSON.stringify(inferredSchemas, null, 2)}`));
@@ -68235,7 +68309,7 @@ data: reload
68235
68309
  return;
68236
68310
  }
68237
68311
  if (url === "/dist/bundle.js" || url === "/bundle.js") {
68238
- const jsPath = path14.join(process15.cwd(), "dist/bundle.js");
68312
+ const jsPath = path15.join(process16.cwd(), "dist/bundle.js");
68239
68313
  if (fs10.existsSync(jsPath)) {
68240
68314
  res.writeHead(200, { "Content-Type": "application/javascript" });
68241
68315
  res.end(fs10.readFileSync(jsPath));
@@ -68246,7 +68320,7 @@ data: reload
68246
68320
  return;
68247
68321
  }
68248
68322
  if (url === "/dist/bundle.css" || url === "/bundle.css") {
68249
- const cssPath = path14.join(process15.cwd(), "dist/bundle.css");
68323
+ const cssPath = path15.join(process16.cwd(), "dist/bundle.css");
68250
68324
  if (fs10.existsSync(cssPath)) {
68251
68325
  res.writeHead(200, { "Content-Type": "text/css" });
68252
68326
  res.end(fs10.readFileSync(cssPath));
@@ -68257,7 +68331,7 @@ data: reload
68257
68331
  return;
68258
68332
  }
68259
68333
  if (url === "/dist/bundle.js.map" || url === "/bundle.js.map") {
68260
- const mapPath = path14.join(process15.cwd(), "dist/bundle.js.map");
68334
+ const mapPath = path15.join(process16.cwd(), "dist/bundle.js.map");
68261
68335
  if (fs10.existsSync(mapPath)) {
68262
68336
  res.writeHead(200, { "Content-Type": "application/json" });
68263
68337
  res.end(fs10.readFileSync(mapPath));
@@ -68268,7 +68342,7 @@ data: reload
68268
68342
  return;
68269
68343
  }
68270
68344
  if (url === "/dist/bundle.css.map" || url === "/bundle.css.map") {
68271
- const mapPath = path14.join(process15.cwd(), "dist/bundle.css.map");
68345
+ const mapPath = path15.join(process16.cwd(), "dist/bundle.css.map");
68272
68346
  if (fs10.existsSync(mapPath)) {
68273
68347
  res.writeHead(200, { "Content-Type": "application/json" });
68274
68348
  res.end(fs10.readFileSync(mapPath));
@@ -68282,12 +68356,12 @@ data: reload
68282
68356
  res.end(createHTML("/dist/bundle.js", "/dist/bundle.css"));
68283
68357
  });
68284
68358
  const wss = new import_websocket_server.default({ server });
68285
- const sqlToApplyPath = path14.join(process15.cwd(), "sql_to_apply");
68359
+ const sqlToApplyPath = path15.join(process16.cwd(), "sql_to_apply");
68286
68360
  const sqlFileQueue = [];
68287
68361
  let currentSqlFile = null;
68288
68362
  async function getDatatableConfig() {
68289
68363
  try {
68290
- const rawApp2 = await yamlParseFile(path14.join(process15.cwd(), "raw_app.yaml"));
68364
+ const rawApp2 = await yamlParseFile(path15.join(process16.cwd(), "raw_app.yaml"));
68291
68365
  return rawApp2?.data?.datatable;
68292
68366
  } catch {
68293
68367
  return;
@@ -68324,12 +68398,12 @@ data: reload
68324
68398
  }
68325
68399
  const filePath = sqlFileQueue.shift();
68326
68400
  if (!fs10.existsSync(filePath)) {
68327
- info(colors.gray(`File no longer exists: ${path14.basename(filePath)}`));
68401
+ info(colors.gray(`File no longer exists: ${path15.basename(filePath)}`));
68328
68402
  await processNextSqlFile();
68329
68403
  return;
68330
68404
  }
68331
68405
  currentSqlFile = filePath;
68332
- const fileName = path14.basename(filePath);
68406
+ const fileName = path15.basename(filePath);
68333
68407
  try {
68334
68408
  const sqlContent = await readFile12(filePath, "utf-8");
68335
68409
  if (!sqlContent.trim()) {
@@ -68351,9 +68425,9 @@ data: reload
68351
68425
  if (deleteFile && fs10.existsSync(filePath)) {
68352
68426
  try {
68353
68427
  fs10.unlinkSync(filePath);
68354
- info(colors.green(`✓ Deleted: ${path14.basename(filePath)}`));
68428
+ info(colors.green(`✓ Deleted: ${path15.basename(filePath)}`));
68355
68429
  } catch (error2) {
68356
- error(colors.red(`Failed to delete ${path14.basename(filePath)}: ${error2.message}`));
68430
+ error(colors.red(`Failed to delete ${path15.basename(filePath)}: ${error2.message}`));
68357
68431
  }
68358
68432
  }
68359
68433
  currentSqlFile = null;
@@ -68365,7 +68439,7 @@ data: reload
68365
68439
  try {
68366
68440
  const sqlContent = await readFile12(currentSqlFile, "utf-8");
68367
68441
  const datatable = await getDatatableConfig();
68368
- const fileName = path14.basename(currentSqlFile);
68442
+ const fileName = path15.basename(currentSqlFile);
68369
68443
  ws.send(JSON.stringify({
68370
68444
  type: "sqlMigration",
68371
68445
  fileName,
@@ -68379,7 +68453,7 @@ data: reload
68379
68453
  const sqlFiles = entries.filter((entry) => entry.endsWith(".sql"));
68380
68454
  if (sqlFiles.length > 0 && sqlFileQueue.length === 0) {
68381
68455
  for (const sqlFile of sqlFiles.sort()) {
68382
- queueSqlFile(path14.join(sqlToApplyPath, sqlFile));
68456
+ queueSqlFile(path15.join(sqlToApplyPath, sqlFile));
68383
68457
  }
68384
68458
  await processNextSqlFile();
68385
68459
  }
@@ -68506,7 +68580,7 @@ data: reload
68506
68580
  await onSqlFileCompleted(currentSqlFile, true);
68507
68581
  }
68508
68582
  try {
68509
- await regenerateAgentDocs(workspaceId, process15.cwd(), true);
68583
+ await regenerateAgentDocs(workspaceId, process16.cwd(), true);
68510
68584
  info(colors.gray(`[SQL Migration] Refreshed AGENTS.md and DATATABLES.md`));
68511
68585
  } catch (regenError) {
68512
68586
  warn(colors.yellow(`[SQL Migration] Could not refresh docs: ${regenError.message}`));
@@ -68558,7 +68632,7 @@ data: reload
68558
68632
  }
68559
68633
  info(colors.blue(`\uD83D\uDD0D Found ${sqlFiles.length} SQL file(s) in sql_to_apply/`));
68560
68634
  for (const sqlFile of sqlFiles) {
68561
- const filePath = path14.join(sqlToApplyPath, sqlFile);
68635
+ const filePath = path15.join(sqlToApplyPath, sqlFile);
68562
68636
  queueSqlFile(filePath);
68563
68637
  }
68564
68638
  await processNextSqlFile();
@@ -68576,11 +68650,11 @@ data: reload
68576
68650
  if (!filename)
68577
68651
  return;
68578
68652
  const fileStr = typeof filename === "string" ? filename : filename.toString();
68579
- const changedPath = path14.join(sqlToApplyPath, fileStr);
68653
+ const changedPath = path15.join(sqlToApplyPath, fileStr);
68580
68654
  if (!changedPath.endsWith(".sql")) {
68581
68655
  return;
68582
68656
  }
68583
- const fileName = path14.basename(changedPath);
68657
+ const fileName = path15.basename(changedPath);
68584
68658
  if (sqlDebounceTimeouts[changedPath]) {
68585
68659
  clearTimeout(sqlDebounceTimeouts[changedPath]);
68586
68660
  }
@@ -68605,7 +68679,7 @@ data: reload
68605
68679
  const url = `http://${host}:${port}`;
68606
68680
  info(colors.bold.green(`\uD83D\uDE80 Dev server running at ${url}`));
68607
68681
  info(colors.cyan(`\uD83D\uDD0C WebSocket server running at ws://${host}:${port}`));
68608
- info(colors.gray(`\uD83D\uDCE6 Serving files from: ${process15.cwd()}`));
68682
+ info(colors.gray(`\uD83D\uDCE6 Serving files from: ${process16.cwd()}`));
68609
68683
  info(colors.gray(`\uD83D\uDD04 Live reload enabled
68610
68684
  `));
68611
68685
  if (shouldOpen) {
@@ -68619,7 +68693,7 @@ data: reload
68619
68693
  }
68620
68694
  }
68621
68695
  });
68622
- process15.on("SIGINT", async () => {
68696
+ process16.on("SIGINT", async () => {
68623
68697
  info(colors.yellow(`
68624
68698
 
68625
68699
  \uD83D\uDED1 Shutting down...`));
@@ -68632,17 +68706,17 @@ data: reload
68632
68706
  sqlWatcher.close();
68633
68707
  }
68634
68708
  await ctx.dispose();
68635
- process15.exit(0);
68709
+ process16.exit(0);
68636
68710
  });
68637
68711
  }
68638
68712
  async function genRunnablesTs(schemaOverrides = {}) {
68639
68713
  info(colors.blue("\uD83D\uDD04 Generating wmill.d.ts..."));
68640
- const localPath = process15.cwd();
68641
- const backendPath = path14.join(localPath, APP_BACKEND_FOLDER);
68714
+ const localPath = process16.cwd();
68715
+ const backendPath = path15.join(localPath, APP_BACKEND_FOLDER);
68642
68716
  let runnables = await loadRunnablesFromBackend(backendPath);
68643
68717
  if (Object.keys(runnables).length === 0) {
68644
68718
  try {
68645
- const rawApp = await yamlParseFile(path14.join(localPath, "raw_app.yaml"));
68719
+ const rawApp = await yamlParseFile(path15.join(localPath, "raw_app.yaml"));
68646
68720
  runnables = rawApp?.["runnables"] ?? {};
68647
68721
  } catch {
68648
68722
  runnables = {};
@@ -68658,7 +68732,7 @@ async function genRunnablesTs(schemaOverrides = {}) {
68658
68732
  }
68659
68733
  try {
68660
68734
  const newWmillTs = genWmillTs(runnables);
68661
- writeFileSync4(path14.join(process15.cwd(), "wmill.d.ts"), newWmillTs);
68735
+ writeFileSync5(path15.join(process16.cwd(), "wmill.d.ts"), newWmillTs);
68662
68736
  } catch (error2) {
68663
68737
  error(colors.red(`Failed to generate wmill.d.ts: ${error2.message}`));
68664
68738
  }
@@ -68675,11 +68749,11 @@ function convertRunnablesToApiFormat(runnables) {
68675
68749
  }
68676
68750
  async function loadRunnables() {
68677
68751
  try {
68678
- const localPath = process15.cwd();
68679
- const backendPath = path14.join(localPath, APP_BACKEND_FOLDER);
68752
+ const localPath = process16.cwd();
68753
+ const backendPath = path15.join(localPath, APP_BACKEND_FOLDER);
68680
68754
  let runnables = await loadRunnablesFromBackend(backendPath);
68681
68755
  if (Object.keys(runnables).length === 0) {
68682
- const rawApp = await yamlParseFile(path14.join(localPath, "raw_app.yaml"));
68756
+ const rawApp = await yamlParseFile(path15.join(localPath, "raw_app.yaml"));
68683
68757
  runnables = rawApp?.runnables ?? {};
68684
68758
  }
68685
68759
  convertRunnablesToApiFormat(runnables);
@@ -69160,8 +69234,8 @@ var init_dev = __esm(async () => {
69160
69234
 
69161
69235
  // src/commands/app/lint.ts
69162
69236
  import * as fs11 from "node:fs";
69163
- import * as path15 from "node:path";
69164
- import process16 from "node:process";
69237
+ import * as path16 from "node:path";
69238
+ import process17 from "node:process";
69165
69239
  function validateRawAppYaml(appData) {
69166
69240
  const errors = [];
69167
69241
  const warnings = [];
@@ -69175,7 +69249,7 @@ function validateRawAppYaml(appData) {
69175
69249
  async function validateRunnables(appDir, appData) {
69176
69250
  const errors = [];
69177
69251
  const warnings = [];
69178
- const backendPath = path15.join(appDir, APP_BACKEND_FOLDER);
69252
+ const backendPath = path16.join(appDir, APP_BACKEND_FOLDER);
69179
69253
  const runnablesFromBackend = await loadRunnablesFromBackend(backendPath);
69180
69254
  const hasBackendRunnables = Object.keys(runnablesFromBackend).length > 0;
69181
69255
  const hasYamlRunnables = appData.runnables && typeof appData.runnables === "object" && !Array.isArray(appData.runnables) && Object.keys(appData.runnables).length > 0;
@@ -69198,7 +69272,7 @@ async function validateBuild(appDir) {
69198
69272
  info(colors.blue("\uD83D\uDD28 Testing build..."));
69199
69273
  const frameworks = detectFrameworks(appDir);
69200
69274
  const entryFile = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
69201
- const entryPoint = path15.join(appDir, entryFile);
69275
+ const entryPoint = path16.join(appDir, entryFile);
69202
69276
  await createBundle({
69203
69277
  entryPoint,
69204
69278
  production: true,
@@ -69213,12 +69287,12 @@ async function validateBuild(appDir) {
69213
69287
  async function lintRawApp(appDir, opts) {
69214
69288
  const errors = [];
69215
69289
  const warnings = [];
69216
- const currentDirName = path15.basename(appDir);
69290
+ const currentDirName = path16.basename(appDir);
69217
69291
  if (!hasFolderSuffix(currentDirName, "raw_app")) {
69218
69292
  errors.push(`Not a raw app folder: '${currentDirName}' does not end with '${getFolderSuffix("raw_app")}'`);
69219
69293
  return { valid: false, errors, warnings };
69220
69294
  }
69221
- const rawAppPath = path15.join(appDir, "raw_app.yaml");
69295
+ const rawAppPath = path16.join(appDir, "raw_app.yaml");
69222
69296
  if (!fs11.existsSync(rawAppPath)) {
69223
69297
  errors.push("Missing raw_app.yaml file");
69224
69298
  return { valid: false, errors, warnings };
@@ -69257,7 +69331,7 @@ async function lintRawApp(appDir, opts) {
69257
69331
  }
69258
69332
  async function lint2(opts, appFolder) {
69259
69333
  await loadNonDottedPathsSetting();
69260
- const targetDir = appFolder ?? process16.cwd();
69334
+ const targetDir = appFolder ?? process17.cwd();
69261
69335
  info(colors.bold.blue(`
69262
69336
  \uD83D\uDD0D Linting raw app: ${targetDir}
69263
69337
  `));
@@ -69278,7 +69352,7 @@ async function lint2(opts, appFolder) {
69278
69352
  info(colors.red(`
69279
69353
  ❌ Lint failed
69280
69354
  `));
69281
- process16.exit(1);
69355
+ process17.exit(1);
69282
69356
  }
69283
69357
  info(colors.green(`
69284
69358
  ✅ All checks passed
@@ -69302,7 +69376,7 @@ var init_lint2 = __esm(async () => {
69302
69376
 
69303
69377
  // src/commands/app/new.ts
69304
69378
  import { stat as stat9, writeFile as writeFile10, mkdir as mkdir7 } from "node:fs/promises";
69305
- import path16 from "node:path";
69379
+ import path17 from "node:path";
69306
69380
  function validateAppPath(appPath) {
69307
69381
  if (!appPath.startsWith("u/") && !appPath.startsWith("f/")) {
69308
69382
  return {
@@ -69507,7 +69581,7 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
69507
69581
  }
69508
69582
  await loadNonDottedPathsSetting();
69509
69583
  const folderName2 = buildFolderPath(appPath, "raw_app");
69510
- const appDir = path16.join(process.cwd(), folderName2);
69584
+ const appDir = path17.join(process.cwd(), folderName2);
69511
69585
  try {
69512
69586
  await stat9(appDir);
69513
69587
  const overwrite = await Confirm.prompt({
@@ -69520,17 +69594,17 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
69520
69594
  }
69521
69595
  } catch {}
69522
69596
  await mkdir7(appDir, { recursive: true });
69523
- await mkdir7(path16.join(appDir, "backend"), { recursive: true });
69524
- await mkdir7(path16.join(appDir, "sql_to_apply"), { recursive: true });
69597
+ await mkdir7(path17.join(appDir, "backend"), { recursive: true });
69598
+ await mkdir7(path17.join(appDir, "sql_to_apply"), { recursive: true });
69525
69599
  const rawAppConfig = {
69526
69600
  summary
69527
69601
  };
69528
69602
  if (dataConfig.datatable) {
69529
69603
  rawAppConfig.data = dataConfig;
69530
69604
  }
69531
- await writeFile10(path16.join(appDir, "raw_app.yaml"), import_yaml22.stringify(rawAppConfig, yamlOptions), "utf-8");
69605
+ await writeFile10(path17.join(appDir, "raw_app.yaml"), import_yaml22.stringify(rawAppConfig, yamlOptions), "utf-8");
69532
69606
  for (const [filePath, content] of Object.entries(template.files)) {
69533
- const fullPath = path16.join(appDir, filePath.slice(1));
69607
+ const fullPath = path17.join(appDir, filePath.slice(1));
69534
69608
  await writeFile10(fullPath, content.trim() + `
69535
69609
  `, "utf-8");
69536
69610
  }
@@ -69540,21 +69614,21 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
69540
69614
  schema: dataConfig.schema
69541
69615
  } : undefined;
69542
69616
  const agentsContent = generateAgentsDocumentation(dataForDocs);
69543
- await writeFile10(path16.join(appDir, "AGENTS.md"), agentsContent, "utf-8");
69544
- await writeFile10(path16.join(appDir, "CLAUDE.md"), `Instructions are in @AGENTS.md
69617
+ await writeFile10(path17.join(appDir, "AGENTS.md"), agentsContent, "utf-8");
69618
+ await writeFile10(path17.join(appDir, "CLAUDE.md"), `Instructions are in @AGENTS.md
69545
69619
  `, "utf-8");
69546
69620
  const datatablesContent = generateDatatablesDocumentation(dataForDocs);
69547
- await writeFile10(path16.join(appDir, "DATATABLES.md"), datatablesContent, "utf-8");
69621
+ await writeFile10(path17.join(appDir, "DATATABLES.md"), datatablesContent, "utf-8");
69548
69622
  const exampleRunnable = {
69549
69623
  type: "inline",
69550
69624
  path: undefined
69551
69625
  };
69552
- await writeFile10(path16.join(appDir, "backend", "a.yaml"), import_yaml22.stringify(exampleRunnable, yamlOptions), "utf-8");
69553
- await writeFile10(path16.join(appDir, "backend", "a.ts"), `export async function main(x: number): Promise<string> {
69626
+ await writeFile10(path17.join(appDir, "backend", "a.yaml"), import_yaml22.stringify(exampleRunnable, yamlOptions), "utf-8");
69627
+ await writeFile10(path17.join(appDir, "backend", "a.ts"), `export async function main(x: number): Promise<string> {
69554
69628
  return \`Hello from backend! x = \${x}\`;
69555
69629
  }
69556
69630
  `, "utf-8");
69557
- await writeFile10(path16.join(appDir, "sql_to_apply", "README.md"), `# SQL Migrations Folder
69631
+ await writeFile10(path17.join(appDir, "sql_to_apply", "README.md"), `# SQL Migrations Folder
69558
69632
 
69559
69633
  This folder is for SQL migration files that will be applied to datatables during development.
69560
69634
 
@@ -69582,7 +69656,7 @@ This folder is for SQL migration files that will be applied to datatables during
69582
69656
  - Use idempotent SQL (\`CREATE TABLE IF NOT EXISTS\`, etc.)
69583
69657
  `);
69584
69658
  if (createSchemaSQL && schemaName) {
69585
- await writeFile10(path16.join(appDir, "sql_to_apply", `000_create_schema_${schemaName}.sql`), createSchemaSQL, "utf-8");
69659
+ await writeFile10(path17.join(appDir, "sql_to_apply", `000_create_schema_${schemaName}.sql`), createSchemaSQL, "utf-8");
69586
69660
  }
69587
69661
  info("");
69588
69662
  info(colors.bold.green(`App created successfully at ${folderName2}/`));
@@ -69883,8 +69957,8 @@ async function pushApp(workspace, remotePath, localPath, message, permissionedAs
69883
69957
  if (!localPath.endsWith(SEP13)) {
69884
69958
  localPath += SEP13;
69885
69959
  }
69886
- const path17 = localPath + "app.yaml";
69887
- const localApp = await yamlParseFile(path17);
69960
+ const path18 = localPath + "app.yaml";
69961
+ const localApp = await yamlParseFile(path18);
69888
69962
  replaceInlineScripts2(localApp.value, localPath, true);
69889
69963
  await generatingPolicy2(localApp, remotePath, localApp?.["public"] ?? localApp?.["policy"]?.["execution_mode"] == "anonymous");
69890
69964
  const preserveFields = {};
@@ -69926,13 +70000,13 @@ async function pushApp(workspace, remotePath, localPath, message, permissionedAs
69926
70000
  });
69927
70001
  }
69928
70002
  }
69929
- async function generatingPolicy2(app, path17, publicApp) {
69930
- info(colors.gray(`Generating fresh policy for app ${path17}...`));
70003
+ async function generatingPolicy2(app, path18, publicApp) {
70004
+ info(colors.gray(`Generating fresh policy for app ${path18}...`));
69931
70005
  try {
69932
70006
  app.policy = await updatePolicy(app.value, undefined);
69933
70007
  app.policy.execution_mode = publicApp ? "anonymous" : "publisher";
69934
70008
  } catch (e) {
69935
- error(colors.red(`Error generating policy for app ${path17}: ${e}`));
70009
+ error(colors.red(`Error generating policy for app ${path18}: ${e}`));
69936
70010
  throw e;
69937
70011
  }
69938
70012
  }
@@ -69961,12 +70035,12 @@ async function list6(opts) {
69961
70035
  new Table2().header(["path", "summary"]).padding(2).border(true).body(total.map((x) => [x.path, x.summary])).render();
69962
70036
  }
69963
70037
  }
69964
- async function get4(opts, path17) {
70038
+ async function get4(opts, path18) {
69965
70039
  const workspace = await resolveWorkspace(opts);
69966
70040
  await requireLogin(opts);
69967
70041
  const a = await getAppByPath({
69968
70042
  workspace: workspace.workspaceId,
69969
- path: path17
70043
+ path: path18
69970
70044
  });
69971
70045
  if (opts.json) {
69972
70046
  console.log(JSON.stringify(a));
@@ -70304,11 +70378,11 @@ async function list8(opts) {
70304
70378
  ])).render();
70305
70379
  }
70306
70380
  }
70307
- async function newVariable(opts, path17) {
70308
- if (!validatePath(path17)) {
70381
+ async function newVariable(opts, path18) {
70382
+ if (!validatePath(path18)) {
70309
70383
  return;
70310
70384
  }
70311
- const filePath = path17 + ".variable.yaml";
70385
+ const filePath = path18 + ".variable.yaml";
70312
70386
  try {
70313
70387
  await stat12(filePath);
70314
70388
  throw new Error("File already exists: " + filePath);
@@ -70328,14 +70402,14 @@ async function newVariable(opts, path17) {
70328
70402
  });
70329
70403
  info(colors.green(`Created ${filePath}`));
70330
70404
  }
70331
- async function get6(opts, path17) {
70405
+ async function get6(opts, path18) {
70332
70406
  if (opts.json)
70333
70407
  setSilent(true);
70334
70408
  const workspace = await resolveWorkspace(opts);
70335
70409
  await requireLogin(opts);
70336
70410
  const v = await getVariable({
70337
70411
  workspace: workspace.workspaceId,
70338
- path: path17
70412
+ path: path18
70339
70413
  });
70340
70414
  if (opts.json) {
70341
70415
  console.log(JSON.stringify(v));
@@ -70464,11 +70538,11 @@ async function list9(opts) {
70464
70538
  new Table2().header(["Path", "Schedule"]).padding(2).border(true).body(schedules.map((x) => [x.path, x.schedule])).render();
70465
70539
  }
70466
70540
  }
70467
- async function newSchedule(opts, path17) {
70468
- if (!validatePath(path17)) {
70541
+ async function newSchedule(opts, path18) {
70542
+ if (!validatePath(path18)) {
70469
70543
  return;
70470
70544
  }
70471
- const filePath = path17 + ".schedule.yaml";
70545
+ const filePath = path18 + ".schedule.yaml";
70472
70546
  try {
70473
70547
  await stat13(filePath);
70474
70548
  throw new Error("File already exists: " + filePath);
@@ -70492,14 +70566,14 @@ async function newSchedule(opts, path17) {
70492
70566
  });
70493
70567
  info(colors.green(`Created ${filePath}`));
70494
70568
  }
70495
- async function get7(opts, path17) {
70569
+ async function get7(opts, path18) {
70496
70570
  if (opts.json)
70497
70571
  setSilent(true);
70498
70572
  const workspace = await resolveWorkspace(opts);
70499
70573
  await requireLogin(opts);
70500
70574
  const s = await getSchedule({
70501
70575
  workspace: workspace.workspaceId,
70502
- path: path17
70576
+ path: path18
70503
70577
  });
70504
70578
  if (opts.json) {
70505
70579
  console.log(JSON.stringify(s));
@@ -70512,14 +70586,14 @@ async function get7(opts, path17) {
70512
70586
  console.log(colors.bold("Enabled:") + " " + (s.enabled ? "true" : "false"));
70513
70587
  }
70514
70588
  }
70515
- async function pushSchedule(workspace, path17, schedule, localSchedule, permissionedAsContext) {
70516
- path17 = removeType(path17, "schedule").replaceAll(SEP16, "/");
70517
- debug(`Processing local schedule ${path17}`);
70589
+ async function pushSchedule(workspace, path18, schedule, localSchedule, permissionedAsContext) {
70590
+ path18 = removeType(path18, "schedule").replaceAll(SEP16, "/");
70591
+ debug(`Processing local schedule ${path18}`);
70518
70592
  try {
70519
- schedule = await getSchedule({ workspace, path: path17 });
70520
- debug(`Schedule ${path17} exists on remote`);
70593
+ schedule = await getSchedule({ workspace, path: path18 });
70594
+ debug(`Schedule ${path18} exists on remote`);
70521
70595
  } catch {
70522
- debug(`Schedule ${path17} does not exist on remote`);
70596
+ debug(`Schedule ${path18} does not exist on remote`);
70523
70597
  }
70524
70598
  delete localSchedule.has_permissioned_as;
70525
70599
  const preserveFields = {};
@@ -70528,31 +70602,31 @@ async function pushSchedule(workspace, path17, schedule, localSchedule, permissi
70528
70602
  preserveFields.preserve_permissioned_as = true;
70529
70603
  if (schedule.permissioned_as) {
70530
70604
  preserveFields.permissioned_as = schedule.permissioned_as;
70531
- info(`Preserving ${schedule.permissioned_as} as permissioned_as for schedule ${path17}`);
70605
+ info(`Preserving ${schedule.permissioned_as} as permissioned_as for schedule ${path18}`);
70532
70606
  }
70533
70607
  }
70534
70608
  }
70535
70609
  if (schedule) {
70536
70610
  if (isSuperset(localSchedule, schedule)) {
70537
- debug(`Schedule ${path17} is up to date`);
70611
+ debug(`Schedule ${path18} is up to date`);
70538
70612
  return;
70539
70613
  }
70540
- debug(`Updating schedule ${path17}`);
70614
+ debug(`Updating schedule ${path18}`);
70541
70615
  try {
70542
- info(colors.bold.yellow(`Updating schedule ${path17}`));
70616
+ info(colors.bold.yellow(`Updating schedule ${path18}`));
70543
70617
  await updateSchedule({
70544
70618
  workspace,
70545
- path: path17,
70619
+ path: path18,
70546
70620
  requestBody: {
70547
70621
  ...localSchedule,
70548
70622
  ...preserveFields
70549
70623
  }
70550
70624
  });
70551
70625
  if (localSchedule.enabled != schedule.enabled) {
70552
- info(colors.bold.yellow(`Schedule ${path17} is ${localSchedule.enabled ? "enabled" : "disabled"} locally but not on remote, updating remote`));
70626
+ info(colors.bold.yellow(`Schedule ${path18} is ${localSchedule.enabled ? "enabled" : "disabled"} locally but not on remote, updating remote`));
70553
70627
  await setScheduleEnabled({
70554
70628
  workspace,
70555
- path: path17,
70629
+ path: path18,
70556
70630
  requestBody: {
70557
70631
  enabled: localSchedule.enabled
70558
70632
  }
@@ -70563,12 +70637,12 @@ async function pushSchedule(workspace, path17, schedule, localSchedule, permissi
70563
70637
  throw e;
70564
70638
  }
70565
70639
  } else {
70566
- console.log(colors.bold.yellow("Creating new schedule " + path17));
70640
+ console.log(colors.bold.yellow("Creating new schedule " + path18));
70567
70641
  try {
70568
70642
  await createSchedule({
70569
70643
  workspace,
70570
70644
  requestBody: {
70571
- path: path17,
70645
+ path: path18,
70572
70646
  ...localSchedule,
70573
70647
  ...preserveFields
70574
70648
  }
@@ -70579,27 +70653,27 @@ async function pushSchedule(workspace, path17, schedule, localSchedule, permissi
70579
70653
  }
70580
70654
  }
70581
70655
  }
70582
- async function enable(opts, path17) {
70656
+ async function enable(opts, path18) {
70583
70657
  opts = await mergeConfigWithConfigFile(opts);
70584
70658
  const workspace = await resolveWorkspace(opts);
70585
70659
  await requireLogin(opts);
70586
70660
  await setScheduleEnabled({
70587
70661
  workspace: workspace.workspaceId,
70588
- path: path17,
70662
+ path: path18,
70589
70663
  requestBody: { enabled: true }
70590
70664
  });
70591
- info(colors.green(`Schedule ${path17} enabled.`));
70665
+ info(colors.green(`Schedule ${path18} enabled.`));
70592
70666
  }
70593
- async function disable(opts, path17) {
70667
+ async function disable(opts, path18) {
70594
70668
  opts = await mergeConfigWithConfigFile(opts);
70595
70669
  const workspace = await resolveWorkspace(opts);
70596
70670
  await requireLogin(opts);
70597
70671
  await setScheduleEnabled({
70598
70672
  workspace: workspace.workspaceId,
70599
- path: path17,
70673
+ path: path18,
70600
70674
  requestBody: { enabled: false }
70601
70675
  });
70602
- info(colors.yellow(`Schedule ${path17} disabled.`));
70676
+ info(colors.yellow(`Schedule ${path18} disabled.`));
70603
70677
  }
70604
70678
  async function push8(opts, filePath, remotePath) {
70605
70679
  const workspace = await resolveWorkspace(opts);
@@ -70703,7 +70777,7 @@ async function decrypt(combinedCiphertext, keyString) {
70703
70777
  var init_local_encryption = () => {};
70704
70778
 
70705
70779
  // src/core/settings.ts
70706
- import process17 from "node:process";
70780
+ import process18 from "node:process";
70707
70781
  import { writeFile as writeFile14 } from "node:fs/promises";
70708
70782
  function migrateToGroupedFormat(settings) {
70709
70783
  const result = { name: settings.name ?? "" };
@@ -71012,7 +71086,7 @@ async function readInstanceSettings(opts) {
71012
71086
  return localSettings;
71013
71087
  }
71014
71088
  async function processInstanceSettings(settings, mode) {
71015
- const encKey = process17.env.WMILL_INSTANCE_LOCAL_ENCRYPTION_KEY;
71089
+ const encKey = process18.env.WMILL_INSTANCE_LOCAL_ENCRYPTION_KEY;
71016
71090
  if (encKey) {
71017
71091
  const res = [];
71018
71092
  for (const s of settings) {
@@ -71186,7 +71260,7 @@ var init_settings = __esm(async () => {
71186
71260
  // src/commands/instance/instance.ts
71187
71261
  import { readFile as readFile13, writeFile as writeFile15, readdir as readdir8, mkdir as mkdir11, rm as rm3, stat as stat14 } from "node:fs/promises";
71188
71262
  import { appendFile } from "node:fs/promises";
71189
- import * as path17 from "node:path";
71263
+ import * as path18 from "node:path";
71190
71264
  async function allInstances() {
71191
71265
  try {
71192
71266
  const file = await getInstancesConfigFilePath();
@@ -71378,7 +71452,7 @@ async function instancePull(opts) {
71378
71452
  if (confirm) {
71379
71453
  if (uChanges > 0) {
71380
71454
  if (opts.folderPerInstance && opts.prefixSettings) {
71381
- await mkdir11(path17.join(rootDir, opts.prefix), {
71455
+ await mkdir11(path18.join(rootDir, opts.prefix), {
71382
71456
  recursive: true
71383
71457
  });
71384
71458
  }
@@ -71412,10 +71486,10 @@ Pulling all workspaces`);
71412
71486
  info(`
71413
71487
  Pulling workspace ` + remoteWorkspace.id);
71414
71488
  const workspaceName = opts?.folderPerInstance ? instance.prefix + "/" + remoteWorkspace.id : instance.prefix + "_" + remoteWorkspace.id;
71415
- await mkdir11(path17.join(rootDir, workspaceName), {
71489
+ await mkdir11(path18.join(rootDir, workspaceName), {
71416
71490
  recursive: true
71417
71491
  });
71418
- process.chdir(path17.join(rootDir, workspaceName));
71492
+ process.chdir(path18.join(rootDir, workspaceName));
71419
71493
  await addWorkspace({
71420
71494
  remote: instance.remote,
71421
71495
  name: workspaceName,
@@ -71450,7 +71524,7 @@ Pulling workspace ` + remoteWorkspace.id);
71450
71524
  if (confirmDelete) {
71451
71525
  for (const workspace of localWorkspacesToDelete) {
71452
71526
  await removeWorkspace(workspace.id, false, {});
71453
- await rm3(path17.join(rootDir, workspace.dir), {
71527
+ await rm3(path18.join(rootDir, workspace.dir), {
71454
71528
  recursive: true
71455
71529
  });
71456
71530
  }
@@ -71539,12 +71613,12 @@ Pushing all workspaces: ${localWorkspaces.map((x) => x.id).join(", ")}`);
71539
71613
  info(`
71540
71614
  Pushing workspace ` + localWorkspace.id);
71541
71615
  try {
71542
- process.chdir(path17.join(rootDir, localWorkspace.dir));
71616
+ process.chdir(path18.join(rootDir, localWorkspace.dir));
71543
71617
  } catch (_) {
71544
71618
  throw new Error("Workspace folder not found, are you in the right directory?");
71545
71619
  }
71546
71620
  try {
71547
- const workspaceSettings = await yamlParseFile(path17.join(process.cwd(), "settings.yaml"));
71621
+ const workspaceSettings = await yamlParseFile(path18.join(process.cwd(), "settings.yaml"));
71548
71622
  await add({
71549
71623
  token: instance.token,
71550
71624
  workspace: undefined,
@@ -71807,8 +71881,8 @@ async function createToken2(opts) {
71807
71881
  }
71808
71882
  info("Token: " + await createToken({ requestBody: {} }));
71809
71883
  }
71810
- async function pushWorkspaceUser(workspace, path18, user, localUser) {
71811
- const email = removePathPrefix(removeType(path18, "user"), "users");
71884
+ async function pushWorkspaceUser(workspace, path19, user, localUser) {
71885
+ const email = removePathPrefix(removeType(path19, "user"), "users");
71812
71886
  debug(`Processing local user ${email}`);
71813
71887
  if (!["operator", "developer", "admin"].includes(localUser.role)) {
71814
71888
  throw new Error(`Invalid role for user ${email}: ${localUser.role}`);
@@ -71871,8 +71945,8 @@ async function pushWorkspaceUser(workspace, path18, user, localUser) {
71871
71945
  }
71872
71946
  }
71873
71947
  }
71874
- async function pushGroup(workspace, path18, group, localGroup) {
71875
- const name = removePathPrefix(removeType(path18, "group"), "groups");
71948
+ async function pushGroup(workspace, path19, group, localGroup) {
71949
+ const name = removePathPrefix(removeType(path19, "group"), "groups");
71876
71950
  debug(`Processing local group ${name}`);
71877
71951
  try {
71878
71952
  const remoteGroup = await getGroup({
@@ -72123,10 +72197,10 @@ async function push9(opts, filePath) {
72123
72197
  const content = fs12.readFileSync(filePath, "utf8");
72124
72198
  await pushWorkspaceDependencies(workspace.workspaceId, filePath, null, content);
72125
72199
  }
72126
- async function pushWorkspaceDependencies(workspace, path18, _befObj, newDependenciesContent) {
72127
- const res = workspaceDependenciesPathToLanguageAndFilename(path18);
72200
+ async function pushWorkspaceDependencies(workspace, path19, _befObj, newDependenciesContent) {
72201
+ const res = workspaceDependenciesPathToLanguageAndFilename(path19);
72128
72202
  if (!res) {
72129
- throw new Error(`Unknown workspace dependencies file format: ${path18}. ` + `Valid files: package.json, requirements.in, composer.json, go.mod, modules.json`);
72203
+ throw new Error(`Unknown workspace dependencies file format: ${path19}. ` + `Valid files: package.json, requirements.in, composer.json, go.mod, modules.json`);
72130
72204
  }
72131
72205
  const { language, name } = res;
72132
72206
  const displayName = name ? `named dependencies "${name}"` : `workspace default dependencies`;
@@ -72177,7 +72251,7 @@ var init_dependencies = __esm(async () => {
72177
72251
  import { mkdir as mkdir12, stat as stat15, writeFile as writeFile17 } from "node:fs/promises";
72178
72252
  import { dirname as dirname15 } from "node:path";
72179
72253
  import { sep as SEP17 } from "node:path";
72180
- async function getTrigger(triggerType, workspace, path18) {
72254
+ async function getTrigger(triggerType, workspace, path19) {
72181
72255
  const triggerFunctions = {
72182
72256
  http: getHttpTrigger,
72183
72257
  websocket: getWebsocketTrigger,
@@ -72190,10 +72264,10 @@ async function getTrigger(triggerType, workspace, path18) {
72190
72264
  email: getEmailTrigger
72191
72265
  };
72192
72266
  const triggerFunction = triggerFunctions[triggerType];
72193
- const trigger = await triggerFunction({ workspace, path: path18 });
72267
+ const trigger = await triggerFunction({ workspace, path: path19 });
72194
72268
  return trigger;
72195
72269
  }
72196
- async function updateTrigger(triggerType, workspace, path18, trigger) {
72270
+ async function updateTrigger(triggerType, workspace, path19, trigger) {
72197
72271
  const triggerFunctions = {
72198
72272
  http: updateHttpTrigger,
72199
72273
  websocket: updateWebsocketTrigger,
@@ -72206,9 +72280,9 @@ async function updateTrigger(triggerType, workspace, path18, trigger) {
72206
72280
  email: updateEmailTrigger
72207
72281
  };
72208
72282
  const triggerFunction = triggerFunctions[triggerType];
72209
- await triggerFunction({ workspace, path: path18, requestBody: trigger });
72283
+ await triggerFunction({ workspace, path: path19, requestBody: trigger });
72210
72284
  }
72211
- async function createTrigger(triggerType, workspace, path18, trigger) {
72285
+ async function createTrigger(triggerType, workspace, path19, trigger) {
72212
72286
  const triggerFunctions = {
72213
72287
  http: createHttpTrigger,
72214
72288
  websocket: createWebsocketTrigger,
@@ -72221,16 +72295,16 @@ async function createTrigger(triggerType, workspace, path18, trigger) {
72221
72295
  email: createEmailTrigger
72222
72296
  };
72223
72297
  const triggerFunction = triggerFunctions[triggerType];
72224
- await triggerFunction({ workspace, path: path18, requestBody: trigger });
72298
+ await triggerFunction({ workspace, path: path19, requestBody: trigger });
72225
72299
  }
72226
- async function pushTrigger(triggerType, workspace, path18, trigger, localTrigger, permissionedAsContext) {
72227
- path18 = removeType(path18, triggerType + "_trigger").replaceAll(SEP17, "/");
72228
- debug(`Processing local ${triggerType} trigger ${path18}`);
72300
+ async function pushTrigger(triggerType, workspace, path19, trigger, localTrigger, permissionedAsContext) {
72301
+ path19 = removeType(path19, triggerType + "_trigger").replaceAll(SEP17, "/");
72302
+ debug(`Processing local ${triggerType} trigger ${path19}`);
72229
72303
  try {
72230
- trigger = await getTrigger(triggerType, workspace, path18);
72231
- debug(`${triggerType} trigger ${path18} exists on remote`);
72304
+ trigger = await getTrigger(triggerType, workspace, path19);
72305
+ debug(`${triggerType} trigger ${path19} exists on remote`);
72232
72306
  } catch {
72233
- debug(`${triggerType} trigger ${path18} does not exist on remote`);
72307
+ debug(`${triggerType} trigger ${path19} does not exist on remote`);
72234
72308
  }
72235
72309
  delete localTrigger.has_permissioned_as;
72236
72310
  const preserveFields = {};
@@ -72239,33 +72313,33 @@ async function pushTrigger(triggerType, workspace, path18, trigger, localTrigger
72239
72313
  preserveFields.preserve_permissioned_as = true;
72240
72314
  if (trigger.permissioned_as) {
72241
72315
  preserveFields.permissioned_as = trigger.permissioned_as;
72242
- info(`Preserving ${trigger.permissioned_as} as permissioned_as for trigger ${path18}`);
72316
+ info(`Preserving ${trigger.permissioned_as} as permissioned_as for trigger ${path19}`);
72243
72317
  }
72244
72318
  }
72245
72319
  }
72246
72320
  if (trigger) {
72247
72321
  if (isSuperset(localTrigger, trigger)) {
72248
- debug(`${triggerType} trigger ${path18} is up to date`);
72322
+ debug(`${triggerType} trigger ${path19} is up to date`);
72249
72323
  return;
72250
72324
  }
72251
- debug(`${triggerType} trigger ${path18} is not up-to-date, updating...`);
72325
+ debug(`${triggerType} trigger ${path19} is not up-to-date, updating...`);
72252
72326
  try {
72253
- await updateTrigger(triggerType, workspace, path18, {
72327
+ await updateTrigger(triggerType, workspace, path19, {
72254
72328
  ...localTrigger,
72255
72329
  ...preserveFields,
72256
- path: path18
72330
+ path: path19
72257
72331
  });
72258
72332
  } catch (e) {
72259
72333
  console.error(e.body);
72260
72334
  throw e;
72261
72335
  }
72262
72336
  } else {
72263
- console.log(colors.bold.yellow(`Creating new ${triggerType} trigger: ${path18}`));
72337
+ console.log(colors.bold.yellow(`Creating new ${triggerType} trigger: ${path19}`));
72264
72338
  try {
72265
- await createTrigger(triggerType, workspace, path18, {
72339
+ await createTrigger(triggerType, workspace, path19, {
72266
72340
  ...localTrigger,
72267
72341
  ...preserveFields,
72268
- path: path18
72342
+ path: path19
72269
72343
  });
72270
72344
  } catch (e) {
72271
72345
  console.error(e.body);
@@ -72350,8 +72424,8 @@ async function pushNativeTrigger(workspace, filePath, _remoteTrigger, localTrigg
72350
72424
  }
72351
72425
  }
72352
72426
  }
72353
- async function newTrigger(opts, path18) {
72354
- if (!validatePath(path18)) {
72427
+ async function newTrigger(opts, path19) {
72428
+ if (!validatePath(path19)) {
72355
72429
  return;
72356
72430
  }
72357
72431
  if (!opts.kind) {
@@ -72361,7 +72435,7 @@ async function newTrigger(opts, path18) {
72361
72435
  throw new Error("Invalid trigger kind: " + opts.kind + ". Valid kinds: " + TRIGGER_TYPES.join(", "));
72362
72436
  }
72363
72437
  const kind = opts.kind;
72364
- const filePath = `${path18}.${kind}_trigger.yaml`;
72438
+ const filePath = `${path19}.${kind}_trigger.yaml`;
72365
72439
  try {
72366
72440
  await stat15(filePath);
72367
72441
  throw new Error("File already exists: " + filePath);
@@ -72397,7 +72471,7 @@ function printTriggerDetails(trigger, kind) {
72397
72471
  console.log(colors.bold(label + ":") + " " + display);
72398
72472
  }
72399
72473
  }
72400
- async function get8(opts, path18) {
72474
+ async function get8(opts, path19) {
72401
72475
  if (opts.json)
72402
72476
  setSilent(true);
72403
72477
  const workspace = await resolveWorkspace(opts);
@@ -72406,7 +72480,7 @@ async function get8(opts, path18) {
72406
72480
  if (!checkIfValidTrigger(opts.kind)) {
72407
72481
  throw new Error("Invalid trigger kind: " + opts.kind + ". Valid kinds: " + TRIGGER_TYPES.join(", "));
72408
72482
  }
72409
- const trigger = await getTrigger(opts.kind, workspace.workspaceId, path18);
72483
+ const trigger = await getTrigger(opts.kind, workspace.workspaceId, path19);
72410
72484
  if (opts.json) {
72411
72485
  console.log(JSON.stringify(trigger));
72412
72486
  } else {
@@ -72417,12 +72491,12 @@ async function get8(opts, path18) {
72417
72491
  const matches = [];
72418
72492
  for (const kind of TRIGGER_TYPES) {
72419
72493
  try {
72420
- const trigger = await getTrigger(kind, workspace.workspaceId, path18);
72494
+ const trigger = await getTrigger(kind, workspace.workspaceId, path19);
72421
72495
  matches.push({ kind, trigger });
72422
72496
  } catch {}
72423
72497
  }
72424
72498
  if (matches.length === 0) {
72425
- throw new Error("No trigger found at path: " + path18);
72499
+ throw new Error("No trigger found at path: " + path19);
72426
72500
  }
72427
72501
  if (matches.length === 1) {
72428
72502
  const { kind, trigger } = matches[0];
@@ -72433,7 +72507,7 @@ async function get8(opts, path18) {
72433
72507
  }
72434
72508
  return;
72435
72509
  }
72436
- console.log("Multiple triggers found at path " + path18 + ":");
72510
+ console.log("Multiple triggers found at path " + path19 + ":");
72437
72511
  for (const m of matches) {
72438
72512
  console.log(" - " + m.kind);
72439
72513
  }
@@ -72650,7 +72724,7 @@ var init_trigger = __esm(async () => {
72650
72724
  });
72651
72725
 
72652
72726
  // src/types.ts
72653
- import * as path18 from "node:path";
72727
+ import * as path19 from "node:path";
72654
72728
  import { sep as SEP18 } from "node:path";
72655
72729
  import { readFileSync as readFileSync5 } from "node:fs";
72656
72730
  function isSuperset(subset, superset) {
@@ -72695,8 +72769,8 @@ function showDiff(local, remote) {
72695
72769
  }
72696
72770
  info(finalString);
72697
72771
  }
72698
- function showConflict(path19, local, remote) {
72699
- info(colors.yellow(`- ${path19}`));
72772
+ function showConflict(path20, local, remote) {
72773
+ info(colors.yellow(`- ${path20}`));
72700
72774
  showDiff(local, remote);
72701
72775
  info("\x1B[31mlocal\x1B[31m - \x1B[32mremote\x1B[32m");
72702
72776
  info(`
@@ -72797,7 +72871,10 @@ function getTypeStrFromPath(p) {
72797
72871
  if (p.startsWith("dependencies" + SEP18)) {
72798
72872
  return "workspace_dependencies";
72799
72873
  }
72800
- const parsed = path18.parse(p);
72874
+ if (isFileResource(p) || isFilesetResource(p)) {
72875
+ return "resource";
72876
+ }
72877
+ const parsed = path19.parse(p);
72801
72878
  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
72879
  return "script";
72803
72880
  }
@@ -72817,14 +72894,11 @@ function getTypeStrFromPath(p) {
72817
72894
  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
72895
  return typeEnding;
72819
72896
  } else {
72820
- if (isFileResource(p) || isFilesetResource(p)) {
72821
- return "resource";
72822
- }
72823
72897
  throw new Error("Could not infer type of path " + JSON.stringify(parsed));
72824
72898
  }
72825
72899
  }
72826
72900
  function removeType(str, type) {
72827
- const normalizedStr = path18.normalize(str).replaceAll(SEP18, "/");
72901
+ const normalizedStr = path19.normalize(str).replaceAll(SEP18, "/");
72828
72902
  if (normalizedStr.endsWith("." + type + ".yaml") || normalizedStr.endsWith("." + type + ".json")) {
72829
72903
  return normalizedStr.slice(0, normalizedStr.length - type.length - 6);
72830
72904
  }
@@ -72834,7 +72908,7 @@ function removeType(str, type) {
72834
72908
  return normalizedStr;
72835
72909
  }
72836
72910
  function extractNativeTriggerInfo(p) {
72837
- const normalizedPath = path18.normalize(p).replaceAll(SEP18, "/");
72911
+ const normalizedPath = path19.normalize(p).replaceAll(SEP18, "/");
72838
72912
  const withoutExt = normalizedPath.replace(/\.(json|yaml)$/, "");
72839
72913
  const match2 = withoutExt.match(/^(.+)\.(flow|script)\.([^.]+)\.(\w+)_native_trigger$/);
72840
72914
  if (!match2) {
@@ -72848,8 +72922,8 @@ function extractNativeTriggerInfo(p) {
72848
72922
  };
72849
72923
  }
72850
72924
  function removePathPrefix(str, prefix) {
72851
- const normalizedStr = path18.normalize(str).replaceAll(SEP18, "/");
72852
- const normalizedPrefix = path18.normalize(prefix).replaceAll(SEP18, "/");
72925
+ const normalizedStr = path19.normalize(str).replaceAll(SEP18, "/");
72926
+ const normalizedPrefix = path19.normalize(prefix).replaceAll(SEP18, "/");
72853
72927
  if (normalizedStr === normalizedPrefix) {
72854
72928
  return "";
72855
72929
  }
@@ -73021,7 +73095,7 @@ var init_local_path_scripts = __esm(async () => {
73021
73095
  // src/commands/flow/flow.ts
73022
73096
  import { sep as SEP19 } from "node:path";
73023
73097
  import { readFile as readFile15 } from "node:fs/promises";
73024
- import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync5 } from "node:fs";
73098
+ import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync6 } from "node:fs";
73025
73099
  function normalizeOptionalString(value) {
73026
73100
  return typeof value === "string" && value.trim() === "" ? undefined : value ?? undefined;
73027
73101
  }
@@ -73063,12 +73137,12 @@ function warnAboutLocalPathScriptDivergence(divergence) {
73063
73137
  const details = [];
73064
73138
  if (divergence.changed.length > 0) {
73065
73139
  details.push(`These workspace scripts differ from the deployed version:
73066
- ${divergence.changed.map((path19) => `- ${path19}`).join(`
73140
+ ${divergence.changed.map((path20) => `- ${path20}`).join(`
73067
73141
  `)}`);
73068
73142
  }
73069
73143
  if (divergence.missing.length > 0) {
73070
73144
  details.push(`These scripts do not exist in the workspace yet:
73071
- ${divergence.missing.map((path19) => `- ${path19}`).join(`
73145
+ ${divergence.missing.map((path20) => `- ${path20}`).join(`
73072
73146
  `)}`);
73073
73147
  }
73074
73148
  warn(`Using local PathScript files for flow preview.
@@ -73093,7 +73167,7 @@ async function pushFlow(workspace, remotePath, localPath, message, permissionedA
73093
73167
  localPath += SEP19;
73094
73168
  }
73095
73169
  const localFlow = await yamlParseFile(localPath + "flow.yaml");
73096
- const fileReader = async (path19) => await readFile15(localPath + path19, "utf-8");
73170
+ const fileReader = async (path20) => await readFile15(localPath + path20, "utf-8");
73097
73171
  const missingFiles = [];
73098
73172
  await replaceInlineScripts(localFlow.value.modules, fileReader, exports_log, localPath, SEP19, undefined, missingFiles);
73099
73173
  if (localFlow.value.failure_module) {
@@ -73185,14 +73259,14 @@ async function list12(opts) {
73185
73259
  new Table2().header(["path", "summary", "edited by"]).padding(2).border(true).body(total.map((x) => [x.path, x.summary, x.edited_by])).render();
73186
73260
  }
73187
73261
  }
73188
- async function get9(opts, path19) {
73262
+ async function get9(opts, path20) {
73189
73263
  if (opts.json)
73190
73264
  setSilent(true);
73191
73265
  const workspace = await resolveWorkspace(opts);
73192
73266
  await requireLogin(opts);
73193
73267
  const f = await getFlowByPath({
73194
73268
  workspace: workspace.workspaceId,
73195
- path: path19
73269
+ path: path20
73196
73270
  });
73197
73271
  if (opts.json) {
73198
73272
  console.log(JSON.stringify(f));
@@ -73230,7 +73304,7 @@ async function get9(opts, path19) {
73230
73304
  }
73231
73305
  }
73232
73306
  }
73233
- async function run3(opts, path19) {
73307
+ async function run3(opts, path20) {
73234
73308
  if (opts.silent) {
73235
73309
  setSilent(true);
73236
73310
  }
@@ -73241,7 +73315,7 @@ async function run3(opts, path19) {
73241
73315
  try {
73242
73316
  const flow = await getFlowByPath({
73243
73317
  workspace: workspace.workspaceId,
73244
- path: path19
73318
+ path: path20
73245
73319
  });
73246
73320
  validateRequiredArgs(flow.schema);
73247
73321
  } catch (e) {
@@ -73252,7 +73326,7 @@ async function run3(opts, path19) {
73252
73326
  }
73253
73327
  const id = await runFlowByPath({
73254
73328
  workspace: workspace.workspaceId,
73255
- path: path19,
73329
+ path: path20,
73256
73330
  requestBody: input
73257
73331
  });
73258
73332
  const stepLabels = new Map;
@@ -73398,7 +73472,7 @@ async function preview2(opts, flowPath) {
73398
73472
  flowPath += SEP19;
73399
73473
  }
73400
73474
  const localFlow = await yamlParseFile(flowPath + "flow.yaml");
73401
- const fileReader = async (path19) => await readFile15(flowPath + path19, "utf-8");
73475
+ const fileReader = async (path20) => await readFile15(flowPath + path20, "utf-8");
73402
73476
  await replaceInlineScripts(localFlow.value.modules, fileReader, exports_log, flowPath, SEP19);
73403
73477
  if (localFlow.value.failure_module) {
73404
73478
  await replaceInlineScripts([localFlow.value.failure_module], fileReader, exports_log, flowPath, SEP19);
@@ -73513,7 +73587,7 @@ async function bootstrap2(opts, flowPath) {
73513
73587
  const newFlowDefinitionYaml = import_yaml36.stringify(newFlowDefinition);
73514
73588
  const metadataFile = getMetadataFileName("flow", "yaml");
73515
73589
  const flowYamlPath = `${flowDirFullPath}/${metadataFile}`;
73516
- writeFileSync5(flowYamlPath, newFlowDefinitionYaml, { flag: "wx", encoding: "utf-8" });
73590
+ writeFileSync6(flowYamlPath, newFlowDefinitionYaml, { flag: "wx", encoding: "utf-8" });
73517
73591
  }
73518
73592
  async function history2(opts, flowPath) {
73519
73593
  if (opts.json)
@@ -73746,7 +73820,7 @@ class GitSyncSettingsConverter {
73746
73820
  }
73747
73821
 
73748
73822
  // src/commands/gitsync-settings/legacySettings.ts
73749
- import process18 from "node:process";
73823
+ import process19 from "node:process";
73750
73824
  async function handleLegacyRepositoryMigration(selectedRepo, gitSyncSettings, workspace, opts, operationName = "operation") {
73751
73825
  if (selectedRepo.settings) {
73752
73826
  return selectedRepo;
@@ -73756,7 +73830,7 @@ async function handleLegacyRepositoryMigration(selectedRepo, gitSyncSettings, wo
73756
73830
  }
73757
73831
  const workspaceIncludePath = gitSyncSettings.include_path;
73758
73832
  const workspaceIncludeType = gitSyncSettings.include_type;
73759
- if (!!process18.stdout.isTTY && !opts.yes) {
73833
+ if (!!process19.stdout.isTTY && !opts.yes) {
73760
73834
  console.log(colors.yellow(`
73761
73835
  ⚠️ Legacy git-sync settings detected!`));
73762
73836
  console.log(`
@@ -73862,7 +73936,7 @@ Repository "${selectedRepo.git_repo_resource_path}" has legacy settings format.`
73862
73936
  console.error(` wmill gitsync-settings push
73863
73937
  `);
73864
73938
  }
73865
- process18.exit(1);
73939
+ process19.exit(1);
73866
73940
  }
73867
73941
  }
73868
73942
  var init_legacySettings = __esm(async () => {
@@ -73906,8 +73980,8 @@ function outputResult(opts, result) {
73906
73980
  error(colors.red(result.error));
73907
73981
  }
73908
73982
  }
73909
- function normalizeRepoPath(path19) {
73910
- return path19.replace(/^\$res:/, "");
73983
+ function normalizeRepoPath(path20) {
73984
+ return path20.replace(/^\$res:/, "");
73911
73985
  }
73912
73986
  function getOrCreateBranchConfig(config, branchName) {
73913
73987
  if (!config.workspaces) {
@@ -74318,14 +74392,14 @@ var init_pull2 = __esm(async () => {
74318
74392
  });
74319
74393
 
74320
74394
  // src/commands/gitsync-settings/push.ts
74321
- import process19 from "node:process";
74395
+ import process20 from "node:process";
74322
74396
  async function pushGitSyncSettings(opts) {
74323
74397
  try {
74324
74398
  await validateBranchConfiguration({ yes: opts.yes });
74325
74399
  } catch (error2) {
74326
74400
  if (error2 instanceof Error && error2.message.includes("overrides")) {
74327
74401
  error(error2.message);
74328
- process19.exit(1);
74402
+ process20.exit(1);
74329
74403
  }
74330
74404
  throw error2;
74331
74405
  }
@@ -74335,7 +74409,7 @@ async function pushGitSyncSettings(opts) {
74335
74409
  const wmillYamlPath = getWmillYamlPath();
74336
74410
  if (!wmillYamlPath) {
74337
74411
  error(colors.red("No wmill.yaml file found. Please run 'wmill init' first to create the configuration file."));
74338
- process19.exit(1);
74412
+ process20.exit(1);
74339
74413
  }
74340
74414
  const localConfig = await readConfigFile();
74341
74415
  let settings;
@@ -74451,7 +74525,7 @@ async function pushGitSyncSettings(opts) {
74451
74525
  displayChanges(changes);
74452
74526
  }
74453
74527
  }
74454
- if (!opts.yes && !!process19.stdin.isTTY) {
74528
+ if (!opts.yes && !!process20.stdin.isTTY) {
74455
74529
  const confirmed = await Confirm.prompt({
74456
74530
  message: `Do you want to apply these changes to the remote?`,
74457
74531
  default: true
@@ -74562,22 +74636,22 @@ var init_gitsync_settings = __esm(async () => {
74562
74636
  async function uploadScripts(tree, workspace) {
74563
74637
  const scriptHashes = {};
74564
74638
  const workspaceDeps = [];
74565
- for (const path19 of tree.allPaths()) {
74566
- const content = tree.getContent(path19);
74567
- const itemType = tree.getItemType(path19);
74639
+ for (const path20 of tree.allPaths()) {
74640
+ const content = tree.getContent(path20);
74641
+ const itemType = tree.getItemType(path20);
74568
74642
  if (itemType === "dependencies") {
74569
74643
  if (content === undefined)
74570
74644
  continue;
74571
- const info2 = workspaceDependenciesPathToLanguageAndFilename(path19);
74645
+ const info2 = workspaceDependenciesPathToLanguageAndFilename(path20);
74572
74646
  if (info2) {
74573
74647
  const hash2 = await generateHash(content);
74574
- workspaceDeps.push({ path: path19, language: info2.language, name: info2.name, hash: hash2 });
74648
+ workspaceDeps.push({ path: path20, language: info2.language, name: info2.name, hash: hash2 });
74575
74649
  }
74576
74650
  } else if (itemType === "script") {
74577
74651
  if (!content)
74578
74652
  continue;
74579
74653
  const hash2 = await generateHash(content);
74580
- scriptHashes[path19] = hash2;
74654
+ scriptHashes[path20] = hash2;
74581
74655
  }
74582
74656
  }
74583
74657
  if (Object.keys(scriptHashes).length === 0 && workspaceDeps.length === 0)
@@ -74589,19 +74663,19 @@ async function uploadScripts(tree, workspace) {
74589
74663
  workspace_deps: workspaceDeps
74590
74664
  }
74591
74665
  });
74592
- for (const path19 of mismatched) {
74593
- const content = tree.getContent(path19);
74594
- const itemType = tree.getItemType(path19);
74666
+ for (const path20 of mismatched) {
74667
+ const content = tree.getContent(path20);
74668
+ const itemType = tree.getItemType(path20);
74595
74669
  if (itemType === "dependencies") {
74596
74670
  if (content !== undefined) {
74597
- tree.setContentHash(path19, "mismatched");
74671
+ tree.setContentHash(path20, "mismatched");
74598
74672
  }
74599
74673
  } else if (content) {
74600
74674
  const hash2 = await storeRawScriptTemp({
74601
74675
  workspace: workspace.workspaceId,
74602
74676
  requestBody: content
74603
74677
  });
74604
- tree.setContentHash(path19, hash2);
74678
+ tree.setContentHash(path20, hash2);
74605
74679
  }
74606
74680
  }
74607
74681
  }
@@ -74612,12 +74686,12 @@ class DoubleLinkedDependencyTree {
74612
74686
  setWorkspaceDeps(deps) {
74613
74687
  this.workspaceDeps = deps;
74614
74688
  }
74615
- async addNode(path19, content, language, metadata, imports, itemType, folder, originalPath, isDirectlyStale, isRawApp) {
74689
+ async addNode(path20, content, language, metadata, imports, itemType, folder, originalPath, isDirectlyStale, isRawApp) {
74616
74690
  const hasWorkspaceDeps = itemType === "script" || itemType === "inline_script";
74617
74691
  const filteredDeps = hasWorkspaceDeps ? filterWorkspaceDependencies(this.workspaceDeps, content, language) : {};
74618
74692
  const stalenessHash = await generateScriptHash({}, content, metadata);
74619
- if (!this.nodes.has(path19)) {
74620
- this.nodes.set(path19, {
74693
+ if (!this.nodes.has(path20)) {
74694
+ this.nodes.set(path20, {
74621
74695
  content: "",
74622
74696
  stalenessHash: "",
74623
74697
  language: "deno",
@@ -74630,7 +74704,7 @@ class DoubleLinkedDependencyTree {
74630
74704
  isDirectlyStale: false
74631
74705
  });
74632
74706
  }
74633
- const node = this.nodes.get(path19);
74707
+ const node = this.nodes.get(path20);
74634
74708
  node.content = content;
74635
74709
  node.stalenessHash = stalenessHash;
74636
74710
  node.language = language;
@@ -74677,59 +74751,59 @@ class DoubleLinkedDependencyTree {
74677
74751
  isDirectlyStale: false
74678
74752
  });
74679
74753
  }
74680
- this.nodes.get(importPath).importedBy.add(path19);
74754
+ this.nodes.get(importPath).importedBy.add(path20);
74681
74755
  }
74682
74756
  }
74683
- getContent(path19) {
74684
- return this.nodes.get(path19)?.content;
74757
+ getContent(path20) {
74758
+ return this.nodes.get(path20)?.content;
74685
74759
  }
74686
- getStalenessHash(path19) {
74687
- return this.nodes.get(path19)?.stalenessHash;
74760
+ getStalenessHash(path20) {
74761
+ return this.nodes.get(path20)?.stalenessHash;
74688
74762
  }
74689
- getContentHash(path19) {
74690
- return this.nodes.get(path19)?.contentHash;
74763
+ getContentHash(path20) {
74764
+ return this.nodes.get(path20)?.contentHash;
74691
74765
  }
74692
- setContentHash(path19, hash2) {
74693
- const node = this.nodes.get(path19);
74766
+ setContentHash(path20, hash2) {
74767
+ const node = this.nodes.get(path20);
74694
74768
  if (node) {
74695
74769
  node.contentHash = hash2;
74696
74770
  }
74697
74771
  }
74698
- getLanguage(path19) {
74699
- return this.nodes.get(path19)?.language;
74772
+ getLanguage(path20) {
74773
+ return this.nodes.get(path20)?.language;
74700
74774
  }
74701
- getMetadata(path19) {
74702
- return this.nodes.get(path19)?.metadata;
74775
+ getMetadata(path20) {
74776
+ return this.nodes.get(path20)?.metadata;
74703
74777
  }
74704
- getStaleReason(path19) {
74705
- return this.nodes.get(path19)?.staleReason;
74778
+ getStaleReason(path20) {
74779
+ return this.nodes.get(path20)?.staleReason;
74706
74780
  }
74707
- getItemType(path19) {
74708
- return this.nodes.get(path19)?.itemType;
74781
+ getItemType(path20) {
74782
+ return this.nodes.get(path20)?.itemType;
74709
74783
  }
74710
- getFolder(path19) {
74711
- return this.nodes.get(path19)?.folder;
74784
+ getFolder(path20) {
74785
+ return this.nodes.get(path20)?.folder;
74712
74786
  }
74713
- getIsRawApp(path19) {
74714
- return this.nodes.get(path19)?.isRawApp;
74787
+ getIsRawApp(path20) {
74788
+ return this.nodes.get(path20)?.isRawApp;
74715
74789
  }
74716
- getIsDirectlyStale(path19) {
74717
- return this.nodes.get(path19)?.isDirectlyStale ?? false;
74790
+ getIsDirectlyStale(path20) {
74791
+ return this.nodes.get(path20)?.isDirectlyStale ?? false;
74718
74792
  }
74719
- getOriginalPath(path19) {
74720
- return this.nodes.get(path19)?.originalPath;
74793
+ getOriginalPath(path20) {
74794
+ return this.nodes.get(path20)?.originalPath;
74721
74795
  }
74722
- getImports(path19) {
74723
- return this.nodes.get(path19)?.imports;
74796
+ getImports(path20) {
74797
+ return this.nodes.get(path20)?.imports;
74724
74798
  }
74725
- isStale(path19) {
74726
- return this.nodes.get(path19)?.staleReason !== undefined;
74799
+ isStale(path20) {
74800
+ return this.nodes.get(path20)?.staleReason !== undefined;
74727
74801
  }
74728
74802
  propagateStaleness() {
74729
74803
  const directlyStale = new Set;
74730
- for (const [path19, node] of this.nodes.entries()) {
74804
+ for (const [path20, node] of this.nodes.entries()) {
74731
74805
  if (node.isDirectlyStale) {
74732
- directlyStale.add(path19);
74806
+ directlyStale.add(path20);
74733
74807
  node.staleReason = "content changed";
74734
74808
  }
74735
74809
  }
@@ -74781,20 +74855,20 @@ class DoubleLinkedDependencyTree {
74781
74855
  return this.nodes.keys();
74782
74856
  }
74783
74857
  *stalePaths() {
74784
- for (const [path19, node] of this.nodes.entries()) {
74858
+ for (const [path20, node] of this.nodes.entries()) {
74785
74859
  if (node.staleReason) {
74786
- yield path19;
74860
+ yield path20;
74787
74861
  }
74788
74862
  }
74789
74863
  }
74790
- has(path19) {
74791
- return this.nodes.has(path19);
74864
+ has(path20) {
74865
+ return this.nodes.has(path20);
74792
74866
  }
74793
74867
  getMismatchedWorkspaceDeps() {
74794
74868
  const result2 = {};
74795
- for (const [path19, node] of this.nodes.entries()) {
74869
+ for (const [path20, node] of this.nodes.entries()) {
74796
74870
  if (node.itemType === "dependencies" && node.contentHash && node.content !== undefined) {
74797
- result2[path19] = node.content;
74871
+ result2[path20] = node.content;
74798
74872
  }
74799
74873
  }
74800
74874
  return result2;
@@ -74809,11 +74883,11 @@ class DoubleLinkedDependencyTree {
74809
74883
  return result2;
74810
74884
  }
74811
74885
  async persistDepsHashes(depsPaths) {
74812
- for (const path19 of depsPaths) {
74813
- const node = this.nodes.get(path19);
74886
+ for (const path20 of depsPaths) {
74887
+ const node = this.nodes.get(path20);
74814
74888
  if (node?.itemType === "dependencies" && node.content !== undefined) {
74815
- const hash2 = await generateHash(node.content + path19);
74816
- await updateMetadataGlobalLock(path19, hash2);
74889
+ const hash2 = await generateHash(node.content + path20);
74890
+ await updateMetadataGlobalLock(path20, hash2);
74817
74891
  }
74818
74892
  }
74819
74893
  }
@@ -76262,7 +76336,7 @@ async function dev2(opts) {
76262
76336
  const flowFolderSuffix = getFolderSuffixWithSep("flow");
76263
76337
  const flowMetadataFile = getMetadataFileName("flow", "yaml");
76264
76338
  async function loadPaths(pathsToLoad) {
76265
- const paths = pathsToLoad.filter((path19) => exts.some((ext2) => path19.endsWith(ext2) || path19.endsWith(flowFolderSuffix + flowMetadataFile)));
76339
+ const paths = pathsToLoad.filter((path20) => exts.some((ext2) => path20.endsWith(ext2) || path20.endsWith(flowFolderSuffix + flowMetadataFile)));
76266
76340
  if (paths.length == 0) {
76267
76341
  return;
76268
76342
  }
@@ -76274,7 +76348,7 @@ async function dev2(opts) {
76274
76348
  if (typ == "flow") {
76275
76349
  const localPath = extractFolderPath(cpath, "flow");
76276
76350
  const localFlow = await yamlParseFile(localPath + "flow.yaml");
76277
- await replaceInlineScripts(localFlow.value.modules, async (path19) => await readFile16(localPath + path19, "utf-8"), exports_log, localPath, SEP20, undefined);
76351
+ await replaceInlineScripts(localFlow.value.modules, async (path20) => await readFile16(localPath + path20, "utf-8"), exports_log, localPath, SEP20, undefined);
76278
76352
  const localScriptReader = createPreviewLocalScriptReader({
76279
76353
  exts,
76280
76354
  defaultTs: opts.defaultTs,
@@ -81026,6 +81100,53 @@ The OpenFlow schema (openflow.openapi.yaml) is the source of truth for flow stru
81026
81100
  - \`preprocessor\` - Reserved for preprocessor module
81027
81101
  - \`Input\` - Reserved for flow input reference
81028
81102
 
81103
+ ## Hard Structural Rules
81104
+
81105
+ These are strict Windmill schema rules. Follow them exactly.
81106
+
81107
+ - \`value.modules\` is only for normal sequential steps
81108
+ - \`value.preprocessor_module\` and \`value.failure_module\` are special top-level fields inside \`value\`, not entries in \`value.modules\`
81109
+ - If a flow needs a preprocessor, create \`value.preprocessor_module\` with \`id: preprocessor\`
81110
+ - If a flow needs a failure handler, create \`value.failure_module\` with \`id: failure\`
81111
+ - Do NOT create regular modules inside \`value.modules\` named \`preprocessor\` or \`failure\`
81112
+ - \`preprocessor_module\` and \`failure_module\` only support \`script\` or \`rawscript\`
81113
+ - \`preprocessor_module\` runs before normal modules and cannot reference \`results.*\`
81114
+ - \`failure_module\` can use the \`error\` object with \`error.message\`, \`error.step_id\`, \`error.name\`, and \`error.stack\`
81115
+
81116
+ Correct shape:
81117
+
81118
+ \`\`\`yaml
81119
+ value:
81120
+ preprocessor_module:
81121
+ id: preprocessor
81122
+ value:
81123
+ type: rawscript
81124
+ ...
81125
+ failure_module:
81126
+ id: failure
81127
+ value:
81128
+ type: rawscript
81129
+ ...
81130
+ modules:
81131
+ - id: process_event
81132
+ value:
81133
+ type: rawscript
81134
+ ...
81135
+ \`\`\`
81136
+
81137
+ Incorrect shape:
81138
+
81139
+ \`\`\`yaml
81140
+ value:
81141
+ modules:
81142
+ - id: preprocessor
81143
+ ...
81144
+ - id: process_event
81145
+ ...
81146
+ - id: failure
81147
+ ...
81148
+ \`\`\`
81149
+
81029
81150
  ## Module ID Rules
81030
81151
 
81031
81152
  - Must be unique across the entire flow
@@ -81041,10 +81162,148 @@ The OpenFlow schema (openflow.openapi.yaml) is the source of truth for flow stru
81041
81162
  ## Data Flow Between Steps
81042
81163
 
81043
81164
  - \`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
81165
+ - \`results.step_id\` - Access output from a previous step only when that step result is in scope
81166
+ - \`results.step_id.property\` - Access specific property from a previous step output only when that step result is in scope
81167
+ - \`flow_input.iter.value\` - Current iteration value when inside a loop (\`forloopflow\` or \`whileloopflow\`)
81168
+ - \`flow_input.iter.index\` - Current loop index when inside a loop (\`forloopflow\` or \`whileloopflow\`)
81169
+
81170
+ ## Loop Structure Rules
81171
+
81172
+ - For \`whileloopflow\`, use module-level \`stop_after_if\` on the loop module itself when the loop should stop after an iteration result
81173
+ - Do NOT put \`stop_after_if\` inside \`value\` of a \`whileloopflow\`
81174
+ - \`stop_after_all_iters_if\` is for checks after the whole loop finishes, not the normal per-iteration break condition
81175
+ - 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
81176
+ - 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
81177
+ - 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
81178
+
81179
+ Correct \`whileloopflow\` shape:
81180
+
81181
+ \`\`\`yaml
81182
+ - id: loop_until_done
81183
+ stop_after_if:
81184
+ expr: result.done === true
81185
+ skip_if_stopped: false
81186
+ value:
81187
+ type: whileloopflow
81188
+ skip_failures: false
81189
+ modules:
81190
+ - id: advance_state
81191
+ value:
81192
+ type: rawscript
81193
+ input_transforms:
81194
+ state:
81195
+ type: javascript
81196
+ expr: flow_input.iter && flow_input.iter.value !== undefined ? flow_input.iter.value : flow_input.initial_state
81197
+ - id: return_final_state
81198
+ value:
81199
+ type: rawscript
81200
+ input_transforms:
81201
+ final_state:
81202
+ type: javascript
81203
+ expr: results.loop_until_done[results.loop_until_done.length - 1]
81204
+ \`\`\`
81205
+
81206
+ Incorrect \`whileloopflow\` patterns:
81207
+
81208
+ \`\`\`yaml
81209
+ - id: loop_until_done
81210
+ value:
81211
+ type: whileloopflow
81212
+ stop_after_if:
81213
+ expr: result.done === true
81214
+ \`\`\`
81215
+
81216
+ \`\`\`yaml
81217
+ input_transforms:
81218
+ state:
81219
+ type: javascript
81220
+ expr: flow_input.iter.index
81221
+ \`\`\`
81222
+
81223
+ \`\`\`yaml
81224
+ input_transforms:
81225
+ final_state:
81226
+ type: javascript
81227
+ expr: results.loop_until_done
81228
+ \`\`\`
81229
+
81230
+ ## Approval / Suspend Structure
81231
+
81232
+ - \`suspend\` belongs on the flow module object itself, as a sibling of \`id\` and \`value\`
81233
+ - Never put \`suspend\` inside \`value\`
81234
+
81235
+ Correct shape:
81236
+
81237
+ \`\`\`yaml
81238
+ - id: request_approval
81239
+ suspend:
81240
+ required_events: 1
81241
+ resume_form:
81242
+ schema:
81243
+ type: object
81244
+ properties:
81245
+ comment:
81246
+ type: string
81247
+ required: [comment]
81248
+ value:
81249
+ type: identity
81250
+ \`\`\`
81251
+
81252
+ Incorrect shape:
81253
+
81254
+ \`\`\`yaml
81255
+ - id: request_approval
81256
+ value:
81257
+ type: rawscript
81258
+ suspend:
81259
+ required_events: 1
81260
+ \`\`\`
81261
+
81262
+ ## Branch Result Scope Rules
81263
+
81264
+ - Inside a branch, you may reference earlier outer steps and earlier steps in the same branch
81265
+ - Outside a \`branchone\`, do NOT reference ids of steps that only exist inside its branches or default branch. Use \`results.<branchone_module_id>\` instead
81266
+ - Outside a \`branchall\`, do NOT reference ids of steps inside its branches. Use \`results.<branchall_module_id>\` instead
81267
+ - If downstream steps need a stable shape after a branch, make each branch return the same fields
81268
+ - When needed, add a normalization step immediately after the branch and consume \`results.<branch_module_id>\` there
81269
+
81270
+ Correct after \`branchone\`:
81271
+
81272
+ \`\`\`yaml
81273
+ - id: route_order
81274
+ value:
81275
+ type: branchone
81276
+ ...
81277
+ - id: send_confirmation
81278
+ value:
81279
+ input_transforms:
81280
+ routed:
81281
+ type: javascript
81282
+ expr: results.route_order
81283
+ \`\`\`
81284
+
81285
+ Incorrect after \`branchone\`:
81286
+
81287
+ \`\`\`yaml
81288
+ expr: results.create_shipment
81289
+ expr: results.create_backorder
81290
+ \`\`\`
81291
+
81292
+ Correct after \`branchall\`:
81293
+
81294
+ \`\`\`yaml
81295
+ - id: enrich_parallel
81296
+ value:
81297
+ type: branchall
81298
+ parallel: true
81299
+ ...
81300
+ - id: combine_data
81301
+ value:
81302
+ input_transforms:
81303
+ enrichments:
81304
+ type: javascript
81305
+ expr: results.enrich_parallel
81306
+ \`\`\`
81048
81307
 
81049
81308
  ## Input Transforms
81050
81309
 
@@ -81061,14 +81320,14 @@ JavaScript transform (dynamic expression):
81061
81320
  - For flow inputs: Use type \`"object"\` with format \`"resource-{type}"\` (e.g., \`"resource-postgresql"\`)
81062
81321
  - For step inputs: Use static value \`"$res:path/to/resource"\`
81063
81322
 
81064
- ## Failure Handler
81323
+ ## Final Structural Self-Check
81065
81324
 
81066
- Executes when any step fails. Has access to error details:
81325
+ Before finalizing a flow, verify:
81067
81326
 
81068
- - \`error.message\` - Error message
81069
- - \`error.step_id\` - ID of failed step
81070
- - \`error.name\` - Error name
81071
- - \`error.stack\` - Stack trace
81327
+ - any preprocessor is in \`value.preprocessor_module\`
81328
+ - any failure handler is in \`value.failure_module\`
81329
+ - any approval step has module-level \`suspend\`
81330
+ - no downstream step references inner branch step ids from outside the branch
81072
81331
 
81073
81332
  ## S3 Object Operations
81074
81333
 
@@ -85031,8 +85290,8 @@ async function generateMetadata2(opts, folder) {
85031
85290
  info("");
85032
85291
  if (errors.length > 0) {
85033
85292
  info(`Done. Updated ${colors.bold(String(succeeded))}/${total} item(s). ${colors.red(String(errors.length) + " failed")}:`);
85034
- for (const { path: path19, error: error2 } of errors) {
85035
- error(` ${path19}: ${error2}`);
85293
+ for (const { path: path20, error: error2 } of errors) {
85294
+ error(` ${path20}: ${error2}`);
85036
85295
  }
85037
85296
  process.exitCode = 1;
85038
85297
  } else {
@@ -85186,7 +85445,7 @@ var config_default = command35;
85186
85445
 
85187
85446
  // src/main.ts
85188
85447
  await init_context();
85189
- var VERSION = "1.684.1";
85448
+ var VERSION = "1.686.0";
85190
85449
  async function checkVersionSafe(cmd) {
85191
85450
  const mainCommand = cmd.getMainCommand();
85192
85451
  const upgradeCommand = mainCommand.getCommand("upgrade");