windmill-cli 1.685.0 → 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 +658 -592
  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.685.0",
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))) {
@@ -63342,7 +63408,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
63342
63408
  continue;
63343
63409
  }
63344
63410
  }
63345
- const treePath = folderNormalized + "/" + path8.basename(script.path, path8.extname(script.path));
63411
+ const treePath = folderNormalized + "/" + path9.basename(script.path, path9.extname(script.path));
63346
63412
  const language = script.language;
63347
63413
  const imports = await extractRelativeImports(content, treePath, language);
63348
63414
  await tree.addNode(treePath, content, language, "", imports, "inline_script", folderNormalized, folder, false);
@@ -63377,29 +63443,29 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
63377
63443
  const c = script.content;
63378
63444
  if (c.startsWith("!inline ")) {
63379
63445
  const fileName = c.replace("!inline ", "");
63380
- const treePath = folderNormalized + "/" + path8.basename(script.path, path8.extname(script.path));
63446
+ const treePath = folderNormalized + "/" + path9.basename(script.path, path9.extname(script.path));
63381
63447
  fileToTreePath.set(fileName, treePath);
63382
63448
  }
63383
63449
  }
63384
63450
  if (!justUpdateMetadataLock) {
63385
63451
  const hashes = await generateFlowHash(filteredDeps, folder, opts.defaultTs);
63386
- for (const [path9, hash2] of Object.entries(hashes)) {
63387
- if (path9 == TOP_HASH) {
63452
+ for (const [path10, hash2] of Object.entries(hashes)) {
63453
+ if (path10 == TOP_HASH) {
63388
63454
  continue;
63389
63455
  }
63390
- if (!await checkifMetadataUptodate(folder, hash2, conf, path9)) {
63391
- changedScripts.push(path9);
63456
+ if (!await checkifMetadataUptodate(folder, hash2, conf, path10)) {
63457
+ changedScripts.push(path10);
63392
63458
  }
63393
63459
  }
63394
63460
  if (!noStaleMessage) {
63395
63461
  info(`Recomputing locks of ${changedScripts.join(", ")} in ${folder}`);
63396
63462
  }
63397
- const fileReader = async (path9) => await readFile7(folder + SEP7 + path9, "utf-8");
63463
+ const fileReader = async (path10) => await readFile7(folder + SEP7 + path10, "utf-8");
63398
63464
  const currentMapping = extractCurrentMapping(flowValue.value.modules, {}, flowValue.value.failure_module, flowValue.value.preprocessor_module);
63399
63465
  const locksToRemove = tree ? Object.keys(hashes).filter((k) => {
63400
63466
  if (k === TOP_HASH)
63401
63467
  return false;
63402
- 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));
63403
63469
  return tree.isStale(treePath);
63404
63470
  }) : changedScripts;
63405
63471
  await replaceInlineScripts(flowValue.value.modules, fileReader, exports_log, folder + SEP7, SEP7, locksToRemove);
@@ -63435,8 +63501,8 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
63435
63501
  const depsForHash = tree ? {} : filteredDeps;
63436
63502
  const finalHashes = await generateFlowHash(depsForHash, folder, opts.defaultTs);
63437
63503
  await clearGlobalLock(folder);
63438
- for (const [path9, hash2] of Object.entries(finalHashes)) {
63439
- await updateMetadataGlobalLock(folder, hash2, path9);
63504
+ for (const [path10, hash2] of Object.entries(finalHashes)) {
63505
+ await updateMetadataGlobalLock(folder, hash2, path10);
63440
63506
  }
63441
63507
  if (!noStaleMessage) {
63442
63508
  info(colors.green(`Flow ${remote_path} lockfiles updated`));
@@ -63444,7 +63510,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
63444
63510
  const relocked = tree ? Object.keys(finalHashes).filter((k) => {
63445
63511
  if (k === TOP_HASH)
63446
63512
  return false;
63447
- 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));
63448
63514
  return tree.isStale(treePath);
63449
63515
  }) : changedScripts;
63450
63516
  const updatedScripts = relocked.map((p) => {
@@ -63560,7 +63626,7 @@ __export(exports_sync, {
63560
63626
  FSFSElement: () => FSFSElement
63561
63627
  });
63562
63628
  import { readFile as readFile8, writeFile as writeFile7, readdir as readdir4, stat as stat7, rm, copyFile, mkdir as mkdir5 } from "node:fs/promises";
63563
- import * as path9 from "node:path";
63629
+ import * as path10 from "node:path";
63564
63630
  import { sep as SEP8 } from "node:path";
63565
63631
  function resolveWsNameFromBranch(opts, branchName) {
63566
63632
  const match2 = findWorkspaceByGitBranch(opts.workspaces, branchName);
@@ -63618,8 +63684,8 @@ function mergeCliWithEffectiveOptions(cliOpts, effectiveOpts) {
63618
63684
  async function resolveEffectiveSyncOptions(workspace, localConfig, promotion, workspaceNameOverride) {
63619
63685
  return await getEffectiveSettings(localConfig, promotion, false, false, workspaceNameOverride);
63620
63686
  }
63621
- function findCodebase(path10, codebases) {
63622
- if (!path10.endsWith(".ts")) {
63687
+ function findCodebase(path11, codebases) {
63688
+ if (!path11.endsWith(".ts")) {
63623
63689
  return;
63624
63690
  }
63625
63691
  for (const c of codebases) {
@@ -63635,7 +63701,7 @@ function findCodebase(path10, codebases) {
63635
63701
  if (included) {
63636
63702
  break;
63637
63703
  }
63638
- if (minimatch(path10, r)) {
63704
+ if (minimatch(path11, r)) {
63639
63705
  included = true;
63640
63706
  }
63641
63707
  }
@@ -63643,7 +63709,7 @@ function findCodebase(path10, codebases) {
63643
63709
  c.excludes = [c.excludes];
63644
63710
  }
63645
63711
  for (const r of c.excludes ?? []) {
63646
- if (minimatch(path10, r)) {
63712
+ if (minimatch(path11, r)) {
63647
63713
  excluded = true;
63648
63714
  }
63649
63715
  }
@@ -63652,13 +63718,13 @@ function findCodebase(path10, codebases) {
63652
63718
  }
63653
63719
  }
63654
63720
  }
63655
- async function addCodebaseDigestIfRelevant(path10, content, codebases, ignoreCodebaseChanges) {
63656
- const isScript = path10.endsWith(".script.yaml");
63721
+ async function addCodebaseDigestIfRelevant(path11, content, codebases, ignoreCodebaseChanges) {
63722
+ const isScript = path11.endsWith(".script.yaml");
63657
63723
  if (!isScript) {
63658
63724
  return content;
63659
63725
  }
63660
63726
  let isTs = true;
63661
- const replacedPath = path10.replace(".script.yaml", ".ts");
63727
+ const replacedPath = path11.replace(".script.yaml", ".ts");
63662
63728
  try {
63663
63729
  await stat7(replacedPath);
63664
63730
  } catch {
@@ -63672,9 +63738,9 @@ async function addCodebaseDigestIfRelevant(path10, content, codebases, ignoreCod
63672
63738
  if (c) {
63673
63739
  let parsed;
63674
63740
  try {
63675
- parsed = yamlParseContent(path10, content);
63741
+ parsed = yamlParseContent(path11, content);
63676
63742
  } catch (error2) {
63677
- 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}`);
63678
63744
  throw error2;
63679
63745
  }
63680
63746
  if (parsed && typeof parsed == "object") {
@@ -63686,7 +63752,7 @@ async function addCodebaseDigestIfRelevant(path10, content, codebases, ignoreCod
63686
63752
  parsed["lock"] = "";
63687
63753
  return import_yaml11.stringify(parsed, yamlOptions);
63688
63754
  } else {
63689
- 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`);
63690
63756
  }
63691
63757
  }
63692
63758
  }
@@ -63703,7 +63769,7 @@ async function FSFSElement(p, codebases, ignoreCodebaseChanges) {
63703
63769
  try {
63704
63770
  const entries = await readdir4(localP, { withFileTypes: true });
63705
63771
  for (const e of entries) {
63706
- yield _internal_element(path9.join(localP, e.name), e.isDirectory(), codebases2);
63772
+ yield _internal_element(path10.join(localP, e.name), e.isDirectory(), codebases2);
63707
63773
  }
63708
63774
  } catch (e) {
63709
63775
  warn(`Error reading dir: ${localP}, ${e}`);
@@ -63874,7 +63940,7 @@ function extractInlineScriptsForApps(key, rec, pathAssigner, toId, removeSchema)
63874
63940
  }
63875
63941
  if (typeof rec == "object") {
63876
63942
  return Object.entries(rec).flatMap(([k, v]) => {
63877
- if (k == "inlineScript" && typeof v == "object") {
63943
+ if (k == "inlineScript" && v != null && typeof v == "object") {
63878
63944
  rec["type"] = undefined;
63879
63945
  const o = v;
63880
63946
  const name = toId(key ?? "", rec);
@@ -63982,9 +64048,9 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
63982
64048
  for (const basePath of moduleScripts) {
63983
64049
  if (normalizedP.startsWith(basePath + ".")) {
63984
64050
  const ext2 = normalizedP.slice(basePath.length);
63985
- const dir = path9.dirname(finalPath);
63986
- const base = path9.basename(basePath);
63987
- 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);
63988
64054
  break;
63989
64055
  }
63990
64056
  }
@@ -64020,7 +64086,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64020
64086
  for (const s of inlineScripts) {
64021
64087
  yield {
64022
64088
  isDirectory: false,
64023
- path: path9.join(finalPath, s.path),
64089
+ path: path10.join(finalPath, s.path),
64024
64090
  async* getChildren() {},
64025
64091
  async getContentText() {
64026
64092
  return s.content;
@@ -64033,7 +64099,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64033
64099
  }
64034
64100
  yield {
64035
64101
  isDirectory: false,
64036
- path: path9.join(finalPath, "flow.yaml"),
64102
+ path: path10.join(finalPath, "flow.yaml"),
64037
64103
  async* getChildren() {},
64038
64104
  async getContentText() {
64039
64105
  return import_yaml11.stringify(flow, yamlOptions);
@@ -64057,7 +64123,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64057
64123
  for (const s of inlineScripts) {
64058
64124
  yield {
64059
64125
  isDirectory: false,
64060
- path: path9.join(finalPath, s.path),
64126
+ path: path10.join(finalPath, s.path),
64061
64127
  async* getChildren() {},
64062
64128
  async getContentText() {
64063
64129
  return s.content;
@@ -64070,7 +64136,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64070
64136
  app.policy = undefined;
64071
64137
  yield {
64072
64138
  isDirectory: false,
64073
- path: path9.join(finalPath, "app.yaml"),
64139
+ path: path10.join(finalPath, "app.yaml"),
64074
64140
  async* getChildren() {},
64075
64141
  async getContentText() {
64076
64142
  return import_yaml11.stringify(app, yamlOptions);
@@ -64125,7 +64191,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64125
64191
  }
64126
64192
  yield {
64127
64193
  isDirectory: false,
64128
- path: path9.join(finalPath, filePath.substring(1)),
64194
+ path: path10.join(finalPath, filePath.substring(1)),
64129
64195
  async* getChildren() {},
64130
64196
  async getContentText() {
64131
64197
  if (typeof content !== "string") {
@@ -64142,7 +64208,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64142
64208
  for (const s of inlineScripts) {
64143
64209
  yield {
64144
64210
  isDirectory: false,
64145
- path: path9.join(finalPath, APP_BACKEND_FOLDER, s.path),
64211
+ path: path10.join(finalPath, APP_BACKEND_FOLDER, s.path),
64146
64212
  async* getChildren() {},
64147
64213
  async getContentText() {
64148
64214
  return s.content;
@@ -64178,7 +64244,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64178
64244
  }
64179
64245
  yield {
64180
64246
  isDirectory: false,
64181
- path: path9.join(finalPath, APP_BACKEND_FOLDER, `${runnableId}.yaml`),
64247
+ path: path10.join(finalPath, APP_BACKEND_FOLDER, `${runnableId}.yaml`),
64182
64248
  async* getChildren() {},
64183
64249
  async getContentText() {
64184
64250
  return import_yaml11.stringify(simplifiedRunnable, yamlOptions);
@@ -64192,7 +64258,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64192
64258
  delete rawApp?.["value"];
64193
64259
  yield {
64194
64260
  isDirectory: false,
64195
- path: path9.join(finalPath, "raw_app.yaml"),
64261
+ path: path10.join(finalPath, "raw_app.yaml"),
64196
64262
  async* getChildren() {},
64197
64263
  async getContentText() {
64198
64264
  return import_yaml11.stringify(rawApp, yamlOptions);
@@ -64200,7 +64266,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64200
64266
  };
64201
64267
  yield {
64202
64268
  isDirectory: false,
64203
- path: path9.join(finalPath, "DATATABLES.md"),
64269
+ path: path10.join(finalPath, "DATATABLES.md"),
64204
64270
  async* getChildren() {},
64205
64271
  async getContentText() {
64206
64272
  return generateDatatablesDocumentation(data3);
@@ -64303,12 +64369,12 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64303
64369
  const scriptBasePath = removeSuffix(removeSuffix(finalPath, metaExt), ".script");
64304
64370
  const moduleFolderPath = scriptBasePath + getModuleFolderSuffix();
64305
64371
  if (hasModules) {
64306
- r[0].path = path9.join(moduleFolderPath, "script" + metaExt);
64372
+ r[0].path = path10.join(moduleFolderPath, "script" + metaExt);
64307
64373
  }
64308
64374
  if (lock && lock != "") {
64309
64375
  r.push({
64310
64376
  isDirectory: false,
64311
- path: hasModules ? path9.join(moduleFolderPath, "script.lock") : removeSuffix(finalPath, metaExt) + ".lock",
64377
+ path: hasModules ? path10.join(moduleFolderPath, "script.lock") : removeSuffix(finalPath, metaExt) + ".lock",
64312
64378
  async* getChildren() {},
64313
64379
  async getContentText() {
64314
64380
  return lock;
@@ -64323,7 +64389,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64323
64389
  for (const [relPath, mod] of Object.entries(scriptModules)) {
64324
64390
  yield {
64325
64391
  isDirectory: false,
64326
- path: path9.join(moduleFolderPath, relPath),
64392
+ path: path10.join(moduleFolderPath, relPath),
64327
64393
  async* getChildren() {},
64328
64394
  async getContentText() {
64329
64395
  return mod.content;
@@ -64333,7 +64399,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64333
64399
  const baseName = relPath.replace(/\.[^.]+$/, "");
64334
64400
  yield {
64335
64401
  isDirectory: false,
64336
- path: path9.join(moduleFolderPath, baseName + ".lock"),
64402
+ path: path10.join(moduleFolderPath, baseName + ".lock"),
64337
64403
  async* getChildren() {},
64338
64404
  async getContentText() {
64339
64405
  return mod.lock;
@@ -64370,7 +64436,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64370
64436
  if (typeof fileContent === "string") {
64371
64437
  yield {
64372
64438
  isDirectory: false,
64373
- path: path9.join(filesetBasePath, relPath),
64439
+ path: path10.join(filesetBasePath, relPath),
64374
64440
  async* getChildren() {},
64375
64441
  async getContentText() {
64376
64442
  return fileContent;
@@ -64406,7 +64472,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64406
64472
  async* getChildren() {
64407
64473
  for (const filename in zip2.files) {
64408
64474
  const file = zip2.files[filename];
64409
- const totalPath = path9.join(p, filename);
64475
+ const totalPath = path10.join(p, filename);
64410
64476
  if (file.dir) {
64411
64477
  const e = zip2.folder(file.name);
64412
64478
  yield _internal_folder(totalPath, e);
@@ -64475,15 +64541,15 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
64475
64541
  if (entry.ignored) {
64476
64542
  continue;
64477
64543
  }
64478
- const path10 = entry.path;
64479
- if (isScriptModulePath(path10)) {
64480
- map[path10] = await entry.getContentText();
64544
+ const path11 = entry.path;
64545
+ if (isScriptModulePath(path11)) {
64546
+ map[path11] = await entry.getContentText();
64481
64547
  continue;
64482
64548
  }
64483
- if (!isFileResource(path10) && !isFilesetResource(path10) && !isRawAppFile(path10) && !isWorkspaceDependencies(path10)) {
64484
- if (json && path10.endsWith(".yaml"))
64549
+ if (!isFileResource(path11) && !isFilesetResource(path11) && !isRawAppFile(path11) && !isWorkspaceDependencies(path11)) {
64550
+ if (json && path11.endsWith(".yaml"))
64485
64551
  continue;
64486
- if (!json && path10.endsWith(".json"))
64552
+ if (!json && path11.endsWith(".json"))
64487
64553
  continue;
64488
64554
  if (![
64489
64555
  "json",
@@ -64505,39 +64571,39 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
64505
64571
  "java",
64506
64572
  "rb",
64507
64573
  "r"
64508
- ].includes(path10.split(".").pop() ?? "")) {
64574
+ ].includes(path11.split(".").pop() ?? "")) {
64509
64575
  continue;
64510
64576
  }
64511
64577
  }
64512
- if (isRawAppFile(path10)) {
64513
- const suffix = path10.split(getFolderSuffix("raw_app") + SEP8).pop();
64578
+ if (isRawAppFile(path11)) {
64579
+ const suffix = path11.split(getFolderSuffix("raw_app") + SEP8).pop();
64514
64580
  if (suffix?.startsWith("dist/") || suffix == "wmill.d.ts" || suffix == "package-lock.json" || suffix == "DATATABLES.md") {
64515
64581
  continue;
64516
64582
  }
64517
64583
  }
64518
- if (skips.skipResources && (isFileResource(path10) || isFilesetResource(path10)))
64584
+ if (skips.skipResources && (isFileResource(path11) || isFilesetResource(path11)))
64519
64585
  continue;
64520
64586
  const ext2 = json ? ".json" : ".yaml";
64521
- if (!skips.includeSchedules && path10.endsWith(".schedule" + ext2))
64587
+ if (!skips.includeSchedules && path11.endsWith(".schedule" + ext2))
64522
64588
  continue;
64523
- 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))) {
64524
64590
  continue;
64525
64591
  }
64526
- if (!skips.includeUsers && path10.endsWith(".user" + ext2))
64592
+ if (!skips.includeUsers && path11.endsWith(".user" + ext2))
64527
64593
  continue;
64528
- if (!skips.includeGroups && path10.endsWith(".group" + ext2))
64594
+ if (!skips.includeGroups && path11.endsWith(".group" + ext2))
64529
64595
  continue;
64530
- if (!skips.includeSettings && path10 === "settings" + ext2)
64596
+ if (!skips.includeSettings && path11 === "settings" + ext2)
64531
64597
  continue;
64532
- if (!skips.includeKey && path10 === "encryption_key")
64598
+ if (!skips.includeKey && path11 === "encryption_key")
64533
64599
  continue;
64534
- if (skips.skipResources && path10.endsWith(".resource" + ext2))
64600
+ if (skips.skipResources && path11.endsWith(".resource" + ext2))
64535
64601
  continue;
64536
- if (skips.skipResourceTypes && path10.endsWith(".resource-type" + ext2)) {
64602
+ if (skips.skipResourceTypes && path11.endsWith(".resource-type" + ext2)) {
64537
64603
  continue;
64538
64604
  }
64539
64605
  try {
64540
- const fileType = getTypeStrFromPath(path10);
64606
+ const fileType = getTypeStrFromPath(path11);
64541
64607
  if (skips.skipVariables && fileType === "variable")
64542
64608
  continue;
64543
64609
  if (skips.skipScripts && fileType === "script")
@@ -64551,27 +64617,27 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
64551
64617
  if (skips.skipWorkspaceDependencies && fileType === "workspace_dependencies")
64552
64618
  continue;
64553
64619
  } catch {}
64554
- if (specificItems && isWorkspaceSpecificFile(path10)) {
64555
- if (!isCurrentWorkspaceFile(path10, cachedWsName)) {
64620
+ if (specificItems && isWorkspaceSpecificFile(path11)) {
64621
+ if (!isCurrentWorkspaceFile(path11, cachedWsName)) {
64556
64622
  continue;
64557
64623
  }
64558
64624
  }
64559
64625
  const content = await entry.getContentText();
64560
- if (skips.skipSecrets && path10.endsWith(".variable" + ext2)) {
64626
+ if (skips.skipSecrets && path11.endsWith(".variable" + ext2)) {
64561
64627
  try {
64562
64628
  let o;
64563
64629
  if (json) {
64564
64630
  try {
64565
64631
  o = JSON.parse(content);
64566
64632
  } catch (error2) {
64567
- error(`Failed to parse JSON variable content at path: ${path10}`);
64633
+ error(`Failed to parse JSON variable content at path: ${path11}`);
64568
64634
  throw error2;
64569
64635
  }
64570
64636
  } else {
64571
64637
  try {
64572
- o = yamlParseContent(path10, content);
64638
+ o = yamlParseContent(path11, content);
64573
64639
  } catch (error2) {
64574
- error(`Failed to parse YAML variable content at path: ${path10}`);
64640
+ error(`Failed to parse YAML variable content at path: ${path11}`);
64575
64641
  throw error2;
64576
64642
  }
64577
64643
  }
@@ -64579,12 +64645,12 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
64579
64645
  continue;
64580
64646
  }
64581
64647
  } catch (e) {
64582
- warn(`Error reading variable ${path10} to check for secrets`);
64648
+ warn(`Error reading variable ${path11} to check for secrets`);
64583
64649
  }
64584
64650
  }
64585
- if (cachedWsName && isCurrentWorkspaceFile(path10, cachedWsName)) {
64651
+ if (cachedWsName && isCurrentWorkspaceFile(path11, cachedWsName)) {
64586
64652
  const currentBranch = cachedWsName;
64587
- const basePath = fromWorkspaceSpecificPath(path10, currentBranch);
64653
+ const basePath = fromWorkspaceSpecificPath(path11, currentBranch);
64588
64654
  if (!isItemTypeConfigured(basePath, specificItems)) {
64589
64655
  continue;
64590
64656
  }
@@ -64593,14 +64659,14 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
64593
64659
  }
64594
64660
  map[basePath] = content;
64595
64661
  processedBasePaths.add(basePath);
64596
- } else if (!isWorkspaceSpecificFile(path10)) {
64597
- if (processedBasePaths.has(path10)) {
64662
+ } else if (!isWorkspaceSpecificFile(path11)) {
64663
+ if (processedBasePaths.has(path11)) {
64598
64664
  continue;
64599
64665
  }
64600
- if (!isRemote && isSpecificItem(path10, specificItems)) {
64666
+ if (!isRemote && isSpecificItem(path11, specificItems)) {
64601
64667
  continue;
64602
64668
  }
64603
- map[path10] = content;
64669
+ map[path11] = content;
64604
64670
  }
64605
64671
  }
64606
64672
  if (wrongFormatPaths.length > 0) {
@@ -64980,7 +65046,7 @@ async function pull(opts) {
64980
65046
  throw error2;
64981
65047
  }
64982
65048
  if (opts.stateful) {
64983
- await mkdir5(path9.join(process.cwd(), ".wmill"), { recursive: true });
65049
+ await mkdir5(path10.join(process.cwd(), ".wmill"), { recursive: true });
64984
65050
  }
64985
65051
  const workspace = await resolveWorkspace(opts, wsNameForConfig);
64986
65052
  await requireLogin(opts);
@@ -65005,7 +65071,7 @@ async function pull(opts) {
65005
65071
  } catch {}
65006
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);
65007
65073
  const remote = ZipFSElement(zipFile, !opts.json, opts.defaultTs ?? "bun", resourceTypeToFormatExtension, resourceTypeToIsFileset, true, parseSyncBehavior(opts.syncBehavior) >= 1);
65008
- 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);
65009
65075
  const changes = await compareDynFSElement(remote, local, await ignoreF(opts), opts.json ?? false, opts, false, codebases, true, specificItems, wsNameForFiles, true);
65010
65076
  info(`remote (${workspace.name}) -> local: ${changes.length} changes to apply`);
65011
65077
  if (opts.dryRun && opts.jsonOutput) {
@@ -65049,8 +65115,8 @@ async function pull(opts) {
65049
65115
  targetPath = workspaceSpecificPath;
65050
65116
  }
65051
65117
  }
65052
- const target = path9.join(process.cwd(), targetPath);
65053
- 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);
65054
65120
  if (change.name === "edited") {
65055
65121
  if (opts.stateful) {
65056
65122
  try {
@@ -65083,13 +65149,13 @@ Both local and remote have been modified.`));
65083
65149
  }
65084
65150
  await writeFile7(target, change.after, "utf-8");
65085
65151
  if (opts.stateful) {
65086
- await mkdir5(path9.dirname(stateTarget), { recursive: true });
65152
+ await mkdir5(path10.dirname(stateTarget), { recursive: true });
65087
65153
  await copyFile(target, stateTarget);
65088
65154
  }
65089
65155
  } else if (change.name === "added") {
65090
- await mkdir5(path9.dirname(target), { recursive: true });
65156
+ await mkdir5(path10.dirname(target), { recursive: true });
65091
65157
  if (opts.stateful) {
65092
- await mkdir5(path9.dirname(stateTarget), { recursive: true });
65158
+ await mkdir5(path10.dirname(stateTarget), { recursive: true });
65093
65159
  info(`Adding ${getTypeStrFromPath(change.path)} ${targetPath}${targetPath !== change.path ? colors.gray(` (workspace-specific override for ${change.path})`) : ""}`);
65094
65160
  }
65095
65161
  await writeFile7(target, change.content, "utf-8");
@@ -65294,7 +65360,7 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
65294
65360
  resourceTypeToIsFileset = parsed.filesetMap;
65295
65361
  } catch {}
65296
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);
65297
- const local = await FSFSElement(path9.join(process.cwd(), ""), codebases, false);
65363
+ const local = await FSFSElement(path10.join(process.cwd(), ""), codebases, false);
65298
65364
  const changes = await compareDynFSElement(local, remote, await ignoreF(opts), opts.json ?? false, opts, true, codebases, false, specificItems, wsNameForFiles, false);
65299
65365
  const rawWorkspaceDependencies = await getRawWorkspaceDependencies(true);
65300
65366
  const tracker = await buildTracker(changes);
@@ -65408,7 +65474,7 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
65408
65474
  }
65409
65475
  }
65410
65476
  for (const folderName2 of folderNames) {
65411
- const basePath = path9.join("f", folderName2, "folder.meta.yaml");
65477
+ const basePath = path10.join("f", folderName2, "folder.meta.yaml");
65412
65478
  const branchPath = getWorkspaceSpecificPath(`f/${folderName2}/folder.meta.yaml`, specificItems, wsNameForFiles);
65413
65479
  let found = false;
65414
65480
  if (branchPath) {
@@ -65530,7 +65596,7 @@ ${folderList}
65530
65596
  let stateful = opts.stateful;
65531
65597
  if (stateful) {
65532
65598
  try {
65533
- await stat7(path9.join(process.cwd(), ".wmill"));
65599
+ await stat7(path10.join(process.cwd(), ".wmill"));
65534
65600
  } catch {
65535
65601
  stateful = false;
65536
65602
  }
@@ -65581,7 +65647,7 @@ ${folderList}
65581
65647
  let stateTarget = undefined;
65582
65648
  if (stateful) {
65583
65649
  try {
65584
- stateTarget = path9.join(process.cwd(), ".wmill", change.path);
65650
+ stateTarget = path10.join(process.cwd(), ".wmill", change.path);
65585
65651
  await stat7(stateTarget);
65586
65652
  } catch {
65587
65653
  stateTarget = undefined;
@@ -65606,7 +65672,7 @@ ${folderList}
65606
65672
  continue;
65607
65673
  }
65608
65674
  if (stateTarget) {
65609
- await mkdir5(path9.dirname(stateTarget), { recursive: true });
65675
+ await mkdir5(path10.dirname(stateTarget), { recursive: true });
65610
65676
  info(`Editing ${getTypeStrFromPath(change.path)} ${change.path}`);
65611
65677
  }
65612
65678
  if (isFileResource(change.path)) {
@@ -65663,7 +65729,7 @@ ${folderList}
65663
65729
  continue;
65664
65730
  }
65665
65731
  if (stateTarget) {
65666
- await mkdir5(path9.dirname(stateTarget), { recursive: true });
65732
+ await mkdir5(path10.dirname(stateTarget), { recursive: true });
65667
65733
  info(`Adding ${getTypeStrFromPath(change.path)} ${change.path}`);
65668
65734
  }
65669
65735
  const obj = parseFromPath(change.path, change.content);
@@ -66256,8 +66322,8 @@ var init_parse_schema = __esm(() => {
66256
66322
  // src/utils/metadata.ts
66257
66323
  import { sep as SEP9 } from "node:path";
66258
66324
  import { readFile as readFile9, writeFile as writeFile8, stat as stat8, rm as rm2, readdir as readdir5 } from "node:fs/promises";
66259
- import { readFileSync as readFileSync3, existsSync as existsSync4, readdirSync, statSync, writeFileSync as writeFileSync3 } from "node:fs";
66260
- 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";
66261
66327
  import { createRequire as createRequire2 } from "node:module";
66262
66328
  function loadParser(pkgName) {
66263
66329
  let p = _parserCache.get(pkgName);
@@ -66299,8 +66365,8 @@ async function getRawWorkspaceDependencies(legacyBehaviour) {
66299
66365
  } catch {}
66300
66366
  return rawWorkspaceDeps;
66301
66367
  }
66302
- function workspaceDependenciesPathToLanguageAndFilename(path11) {
66303
- const relativePath = path11.replace("dependencies/", "");
66368
+ function workspaceDependenciesPathToLanguageAndFilename(path12) {
66369
+ const relativePath = path12.replace("dependencies/", "");
66304
66370
  for (const { filename, language } of workspaceDependenciesLanguages) {
66305
66371
  if (relativePath.endsWith(filename)) {
66306
66372
  return {
@@ -66354,8 +66420,8 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
66354
66420
  const scriptContent = await readFile9(scriptPath, "utf-8");
66355
66421
  const metadataContent = await readFile9(metadataWithType.path, "utf-8");
66356
66422
  const filteredRawWorkspaceDependencies = filterWorkspaceDependencies(rawWorkspaceDependencies, scriptContent, language);
66357
- const moduleFolderPath = isFolderLayout ? path10.dirname(scriptPath) : scriptPath.substring(0, scriptPath.indexOf(".")) + getModuleFolderSuffix();
66358
- 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();
66359
66425
  const depsForHash = tree ? {} : filteredRawWorkspaceDependencies;
66360
66426
  let hash2 = await generateScriptHash(depsForHash, scriptContent, metadataContent);
66361
66427
  let moduleHashes = {};
@@ -66411,7 +66477,7 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
66411
66477
  const hasCodebase = findCodebase(scriptPath, codebases) != null;
66412
66478
  if (!hasCodebase) {
66413
66479
  const tempScriptRefs = tree?.getTempScriptRefs(remotePath);
66414
- const lockPathOverride = isFolderLayout ? path10.dirname(scriptPath) + "/script.lock" : undefined;
66480
+ const lockPathOverride = isFolderLayout ? path11.dirname(scriptPath) + "/script.lock" : undefined;
66415
66481
  await updateScriptLock(workspace, scriptContent, language, remotePath, metadataParsedContent, filteredRawWorkspaceDependencies, tempScriptRefs, lockPathOverride);
66416
66482
  } else {
66417
66483
  metadataParsedContent.lock = "";
@@ -66442,10 +66508,10 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
66442
66508
  let newMetadataContent;
66443
66509
  if (isFolderLayout) {
66444
66510
  if (metadataWithType.isJson) {
66445
- metaPath = path10.dirname(scriptPath) + "/script.json";
66511
+ metaPath = path11.dirname(scriptPath) + "/script.json";
66446
66512
  newMetadataContent = JSON.stringify(metadataParsedContent);
66447
66513
  } else {
66448
- metaPath = path10.dirname(scriptPath) + "/script.yaml";
66514
+ metaPath = path11.dirname(scriptPath) + "/script.yaml";
66449
66515
  newMetadataContent = import_yaml13.stringify(metadataParsedContent, yamlOptions);
66450
66516
  }
66451
66517
  } else {
@@ -66475,8 +66541,8 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
66475
66541
  }
66476
66542
  return `${remotePath} (${language})`;
66477
66543
  }
66478
- async function updateScriptSchema(scriptContent, language, metadataContent, path11) {
66479
- 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);
66480
66546
  metadataContent.schema = result.schema;
66481
66547
  if (result.has_preprocessor) {
66482
66548
  metadataContent.has_preprocessor = result.has_preprocessor;
@@ -66630,7 +66696,7 @@ async function updateScriptLock(workspace, scriptContent, language, remotePath,
66630
66696
  async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath, rawWorkspaceDependencies, defaultTs, changedModules) {
66631
66697
  const entries = readdirSync(dirPath, { withFileTypes: true });
66632
66698
  for (const entry of entries) {
66633
- const fullPath = path10.join(dirPath, entry.name);
66699
+ const fullPath = path11.join(dirPath, entry.name);
66634
66700
  const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
66635
66701
  if (entry.isDirectory()) {
66636
66702
  await updateModuleLocks(workspace, fullPath, relPath, scriptRemotePath, rawWorkspaceDependencies, defaultTs, changedModules);
@@ -66654,12 +66720,12 @@ async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath
66654
66720
  try {
66655
66721
  const lock = await fetchScriptLock(workspace, moduleContent, modLanguage, moduleRemotePath, rawWorkspaceDependencies);
66656
66722
  const baseName = entry.name.replace(/\.[^.]+$/, "");
66657
- const lockPath = path10.join(dirPath, baseName + ".lock");
66723
+ const lockPath = path11.join(dirPath, baseName + ".lock");
66658
66724
  if (lock != "") {
66659
- writeFileSync3(lockPath, lock, "utf-8");
66725
+ writeFileSync4(lockPath, lock, "utf-8");
66660
66726
  } else {
66661
66727
  try {
66662
- if (existsSync4(lockPath)) {
66728
+ if (existsSync5(lockPath)) {
66663
66729
  const { rm: rmAsync } = await import("node:fs/promises");
66664
66730
  await rmAsync(lockPath);
66665
66731
  }
@@ -66671,7 +66737,7 @@ async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath
66671
66737
  }
66672
66738
  }
66673
66739
  }
66674
- async function inferSchema(language, content, currentSchema, path11) {
66740
+ async function inferSchema(language, content, currentSchema, path12) {
66675
66741
  let inferedSchema;
66676
66742
  if (language === "python3") {
66677
66743
  const { parse_python } = await loadParser("windmill-parser-wasm-py");
@@ -66774,7 +66840,7 @@ async function inferSchema(language, content, currentSchema, path11) {
66774
66840
  throw new Error("Invalid language: " + language);
66775
66841
  }
66776
66842
  if (inferedSchema.type == "Invalid") {
66777
- 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.`));
66778
66844
  return {
66779
66845
  schema: defaultScriptMetadata().schema,
66780
66846
  has_preprocessor: false,
@@ -66946,15 +67012,15 @@ async function readLockfile() {
66946
67012
  return lock;
66947
67013
  }
66948
67014
  }
66949
- function v2LockPath(path11, subpath) {
66950
- const normalizedPath = normalizeLockPath(path11);
67015
+ function v2LockPath(path12, subpath) {
67016
+ const normalizedPath = normalizeLockPath(path12);
66951
67017
  if (subpath) {
66952
67018
  return `${normalizedPath}+${normalizeLockPath(subpath)}`;
66953
67019
  } else {
66954
67020
  return normalizedPath;
66955
67021
  }
66956
67022
  }
66957
- async function checkifMetadataUptodate(path11, hash2, conf, subpath) {
67023
+ async function checkifMetadataUptodate(path12, hash2, conf, subpath) {
66958
67024
  if (!conf) {
66959
67025
  conf = await readLockfile();
66960
67026
  }
@@ -66963,10 +67029,10 @@ async function checkifMetadataUptodate(path11, hash2, conf, subpath) {
66963
67029
  }
66964
67030
  const isV2 = conf?.version == "v2";
66965
67031
  if (isV2) {
66966
- const current = conf.locks?.[v2LockPath(path11, subpath)];
67032
+ const current = conf.locks?.[v2LockPath(path12, subpath)];
66967
67033
  return current == hash2;
66968
67034
  } else {
66969
- const obj = conf.locks?.[path11];
67035
+ const obj = conf.locks?.[path12];
66970
67036
  const current = subpath && typeof obj == "object" ? obj?.[subpath] : obj;
66971
67037
  return current == hash2;
66972
67038
  }
@@ -66979,7 +67045,7 @@ async function computeModuleHashes(moduleFolderPath, defaultTs, rawWorkspaceDepe
66979
67045
  async function readDir2(dirPath, relPrefix) {
66980
67046
  const entries = readdirSync(dirPath, { withFileTypes: true });
66981
67047
  for (const entry of entries) {
66982
- const fullPath = path10.join(dirPath, entry.name);
67048
+ const fullPath = path11.join(dirPath, entry.name);
66983
67049
  const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
66984
67050
  const isTopLevel = relPrefix === "";
66985
67051
  if (entry.isDirectory()) {
@@ -66999,14 +67065,14 @@ async function computeModuleHashes(moduleFolderPath, defaultTs, rawWorkspaceDepe
66999
67065
  await readDir2(moduleFolderPath, "");
67000
67066
  return hashes;
67001
67067
  }
67002
- async function clearGlobalLock(path11) {
67068
+ async function clearGlobalLock(path12) {
67003
67069
  const conf = await readLockfile();
67004
67070
  if (!conf?.locks) {
67005
67071
  conf.locks = {};
67006
67072
  }
67007
67073
  const isV2 = conf?.version == "v2";
67008
67074
  if (isV2) {
67009
- const key = v2LockPath(path11);
67075
+ const key = v2LockPath(path12);
67010
67076
  if (conf.locks) {
67011
67077
  Object.keys(conf.locks).forEach((k) => {
67012
67078
  if (conf.locks) {
@@ -67019,24 +67085,24 @@ async function clearGlobalLock(path11) {
67019
67085
  await writeFile8(WMILL_LOCKFILE, import_yaml13.stringify(conf, yamlOptions), "utf-8");
67020
67086
  }
67021
67087
  }
67022
- async function updateMetadataGlobalLock(path11, hash2, subpath) {
67088
+ async function updateMetadataGlobalLock(path12, hash2, subpath) {
67023
67089
  const conf = await readLockfile();
67024
67090
  if (!conf?.locks) {
67025
67091
  conf.locks = {};
67026
67092
  }
67027
67093
  const isV2 = conf?.version == "v2";
67028
67094
  if (isV2) {
67029
- conf.locks[v2LockPath(path11, subpath)] = hash2;
67095
+ conf.locks[v2LockPath(path12, subpath)] = hash2;
67030
67096
  } else {
67031
67097
  if (subpath) {
67032
- let prev = conf.locks[path11];
67098
+ let prev = conf.locks[path12];
67033
67099
  if (!prev || typeof prev != "object") {
67034
67100
  prev = {};
67035
- conf.locks[path11] = prev;
67101
+ conf.locks[path12] = prev;
67036
67102
  }
67037
67103
  prev[subpath] = hash2;
67038
67104
  } else {
67039
- conf.locks[path11] = hash2;
67105
+ conf.locks[path12] = hash2;
67040
67106
  }
67041
67107
  }
67042
67108
  await writeFile8(WMILL_LOCKFILE, import_yaml13.stringify(conf, yamlOptions), "utf-8");
@@ -67086,7 +67152,7 @@ __export(exports_raw_apps, {
67086
67152
  generatingPolicy: () => generatingPolicy
67087
67153
  });
67088
67154
  import { sep as SEP10 } from "node:path";
67089
- import path11 from "node:path";
67155
+ import path12 from "node:path";
67090
67156
  import { readFile as readFile10, readdir as readdir6 } from "node:fs/promises";
67091
67157
  async function findRunnableContentFile(backendPath, runnableId, allFiles) {
67092
67158
  for (const fileName of allFiles) {
@@ -67099,7 +67165,7 @@ async function findRunnableContentFile(backendPath, runnableId, allFiles) {
67099
67165
  const ext2 = fileName.substring(runnableId.length + 1);
67100
67166
  if (EXTENSION_TO_LANGUAGE[ext2]) {
67101
67167
  try {
67102
- const content = await readFile10(path11.join(backendPath, fileName), "utf-8");
67168
+ const content = await readFile10(path12.join(backendPath, fileName), "utf-8");
67103
67169
  return { ext: ext2, content };
67104
67170
  } catch {
67105
67171
  continue;
@@ -67136,7 +67202,7 @@ async function loadRunnablesFromBackend(backendPath, defaultTs = "bun") {
67136
67202
  }
67137
67203
  const runnableId = fileName.replace(".yaml", "");
67138
67204
  processedIds.add(runnableId);
67139
- const filePath = path11.join(backendPath, fileName);
67205
+ const filePath = path12.join(backendPath, fileName);
67140
67206
  const runnable = await yamlParseFile(filePath);
67141
67207
  if (runnable?.type === "inline") {
67142
67208
  const contentFile = await findRunnableContentFile(backendPath, runnableId, allFiles);
@@ -67144,7 +67210,7 @@ async function loadRunnablesFromBackend(backendPath, defaultTs = "bun") {
67144
67210
  const language = getLanguageFromExtension(contentFile.ext, defaultTs);
67145
67211
  let lock;
67146
67212
  try {
67147
- lock = await readFile10(path11.join(backendPath, `${runnableId}.lock`), "utf-8");
67213
+ lock = await readFile10(path12.join(backendPath, `${runnableId}.lock`), "utf-8");
67148
67214
  } catch {}
67149
67215
  runnable.inlineScript = {
67150
67216
  content: contentFile.content,
@@ -67175,7 +67241,7 @@ async function loadRunnablesFromBackend(backendPath, defaultTs = "bun") {
67175
67241
  const language = getLanguageFromExtension(contentFile.ext, defaultTs);
67176
67242
  let lock;
67177
67243
  try {
67178
- lock = await readFile10(path11.join(backendPath, `${runnableId}.lock`), "utf-8");
67244
+ lock = await readFile10(path12.join(backendPath, `${runnableId}.lock`), "utf-8");
67179
67245
  } catch {}
67180
67246
  runnables[runnableId] = {
67181
67247
  type: "inline",
@@ -67203,7 +67269,7 @@ function writeRunnableToBackend(backendPath, runnableId, runnable) {
67203
67269
  ...rest
67204
67270
  };
67205
67271
  }
67206
- const filePath = path11.join(backendPath, `${runnableId}.yaml`);
67272
+ const filePath = path12.join(backendPath, `${runnableId}.yaml`);
67207
67273
  writeIfChanged(filePath, import_yaml16.stringify(runnableToWrite, yamlOptions));
67208
67274
  }
67209
67275
  async function collectAppFiles(localPath) {
@@ -67254,7 +67320,7 @@ async function pushRawApp(workspace, remotePath, localPath, message) {
67254
67320
  }
67255
67321
  const appFilePath = localPath + "raw_app.yaml";
67256
67322
  const localApp = await yamlParseFile(appFilePath);
67257
- const backendPath = path11.join(localPath, APP_BACKEND_FOLDER);
67323
+ const backendPath = path12.join(localPath, APP_BACKEND_FOLDER);
67258
67324
  const runnablesFromBackend = await loadRunnablesFromBackend(backendPath);
67259
67325
  let runnables;
67260
67326
  if (Object.keys(runnablesFromBackend).length > 0) {
@@ -67330,13 +67396,13 @@ async function pushRawApp(workspace, remotePath, localPath, message) {
67330
67396
  });
67331
67397
  }
67332
67398
  }
67333
- async function generatingPolicy(app, path12, publicApp) {
67334
- 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}...`));
67335
67401
  try {
67336
67402
  app.policy = await updateRawAppPolicy(app.runnables, app.policy);
67337
67403
  app.policy.execution_mode = publicApp ? "anonymous" : "publisher";
67338
67404
  } catch (e) {
67339
- error(colors.red(`Error generating policy for app ${path12}: ${e}`));
67405
+ error(colors.red(`Error generating policy for app ${path13}: ${e}`));
67340
67406
  throw e;
67341
67407
  }
67342
67408
  }
@@ -67373,11 +67439,11 @@ __export(exports_app_metadata, {
67373
67439
  filterWorkspaceDependenciesForApp: () => filterWorkspaceDependenciesForApp,
67374
67440
  APP_BACKEND_FOLDER: () => APP_BACKEND_FOLDER
67375
67441
  });
67376
- import path12 from "node:path";
67442
+ import path13 from "node:path";
67377
67443
  import { readFile as readFile11, mkdir as mkdir6 } from "node:fs/promises";
67378
67444
  import { sep as SEP11 } from "node:path";
67379
67445
  async function generateAppHash(rawReqs, folder, rawApp, defaultTs) {
67380
- const runnablesFolder = rawApp ? path12.join(folder, APP_BACKEND_FOLDER) : folder;
67446
+ const runnablesFolder = rawApp ? path13.join(folder, APP_BACKEND_FOLDER) : folder;
67381
67447
  const hashes = {};
67382
67448
  try {
67383
67449
  const elems = await FSFSElement(runnablesFolder, [], true);
@@ -67412,7 +67478,7 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
67412
67478
  if (!justUpdateMetadataLock && !noStaleMessage) {
67413
67479
  info(`Generating locks for app ${appFolder} at ${remote_path}`);
67414
67480
  }
67415
- const appFilePath = path12.join(appFolder, rawApp ? "raw_app.yaml" : "app.yaml");
67481
+ const appFilePath = path13.join(appFolder, rawApp ? "raw_app.yaml" : "app.yaml");
67416
67482
  const appFile = await yamlParseFile(appFilePath);
67417
67483
  const appValue = rawApp ? appFile.runnables : appFile.value;
67418
67484
  const folderNormalized = appFolder.replaceAll(SEP11, "/");
@@ -67424,7 +67490,7 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
67424
67490
  const isDirectlyStale = !await checkifMetadataUptodate(appFolder, hashes[TOP_HASH2], conf, TOP_HASH2);
67425
67491
  let treeAppValue = structuredClone(appValue);
67426
67492
  if (rawApp) {
67427
- const runnablesPath = path12.join(appFolder, APP_BACKEND_FOLDER);
67493
+ const runnablesPath = path13.join(appFolder, APP_BACKEND_FOLDER);
67428
67494
  const runnablesFromFiles = await loadRunnablesFromBackend(runnablesPath);
67429
67495
  if (Object.keys(runnablesFromFiles).length > 0) {
67430
67496
  treeAppValue = runnablesFromFiles;
@@ -67490,7 +67556,7 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
67490
67556
  info(`Recomputing locks of ${changedScripts.join(", ")} in ${appFolder}`);
67491
67557
  }
67492
67558
  if (rawApp) {
67493
- const runnablesPath = path12.join(appFolder, APP_BACKEND_FOLDER);
67559
+ const runnablesPath = path13.join(appFolder, APP_BACKEND_FOLDER);
67494
67560
  const rawAppFile = appFile;
67495
67561
  let runnables = await loadRunnablesFromBackend(runnablesPath);
67496
67562
  if (Object.keys(runnables).length === 0 && rawAppFile.runnables) {
@@ -67563,7 +67629,7 @@ async function traverseAndProcessInlineScripts(obj, processor, currentPath = [])
67563
67629
  }
67564
67630
  async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder, rawDeps, defaultTs = "bun", noStaleMessage, tempScriptRefs) {
67565
67631
  const updatedRunnables = [];
67566
- const runnablesFolder = path12.join(appFolder, APP_BACKEND_FOLDER);
67632
+ const runnablesFolder = path13.join(appFolder, APP_BACKEND_FOLDER);
67567
67633
  try {
67568
67634
  await mkdir6(runnablesFolder, { recursive: true });
67569
67635
  } catch {}
@@ -67588,7 +67654,7 @@ async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder
67588
67654
  if (language === "frontend") {
67589
67655
  const [basePathO, ext2] = pathAssigner.assignPath(runnableId, language);
67590
67656
  const basePath = basePathO.replaceAll(SEP11, "/");
67591
- const contentPath = path12.join(runnablesFolder, `${basePath}${ext2}`);
67657
+ const contentPath = path13.join(runnablesFolder, `${basePath}${ext2}`);
67592
67658
  writeIfChanged(contentPath, content);
67593
67659
  const simplifiedRunnable = { type: "inline" };
67594
67660
  for (const [key, value] of Object.entries(runnable)) {
@@ -67606,8 +67672,8 @@ async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder
67606
67672
  const lock = await generateInlineScriptLock(workspace, content, language, `${remotePath}/${runnableId}`, rawDeps, tempScriptRefs);
67607
67673
  const [basePathO, ext2] = pathAssigner.assignPath(runnableId, language);
67608
67674
  const basePath = basePathO.replaceAll(SEP11, "/");
67609
- const contentPath = path12.join(runnablesFolder, `${basePath}${ext2}`);
67610
- const lockPath = path12.join(runnablesFolder, `${basePath}lock`);
67675
+ const contentPath = path13.join(runnablesFolder, `${basePath}${ext2}`);
67676
+ const lockPath = path13.join(runnablesFolder, `${basePath}lock`);
67611
67677
  writeIfChanged(contentPath, content);
67612
67678
  if (lock && lock !== "") {
67613
67679
  writeIfChanged(lockPath, lock);
@@ -67655,8 +67721,8 @@ async function updateAppInlineScripts(workspace, appValue, remotePath, appFolder
67655
67721
  }
67656
67722
  const [basePathO, ext2] = pathAssigner.assignPath(scriptName, language);
67657
67723
  const basePath = basePathO.replaceAll(SEP11, "/");
67658
- const contentPath = path12.join(appFolder, `${basePath}${ext2}`);
67659
- const lockPath = path12.join(appFolder, `${basePath}lock`);
67724
+ const contentPath = path13.join(appFolder, `${basePath}${ext2}`);
67725
+ const lockPath = path13.join(appFolder, `${basePath}lock`);
67660
67726
  writeIfChanged(contentPath, content);
67661
67727
  if (lock && lock !== "") {
67662
67728
  writeIfChanged(lockPath, lock);
@@ -67727,7 +67793,7 @@ ${text}`);
67727
67793
  }
67728
67794
  }
67729
67795
  async function inferRunnableSchemaFromFile(appFolder, runnableFilePath) {
67730
- const fileName = path12.basename(runnableFilePath);
67796
+ const fileName = path13.basename(runnableFilePath);
67731
67797
  if (fileName.endsWith(".lock") || fileName.endsWith(".yaml")) {
67732
67798
  return;
67733
67799
  }
@@ -67736,13 +67802,13 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath) {
67736
67802
  return;
67737
67803
  }
67738
67804
  const runnableId = match2[1];
67739
- const runnableFilePath2 = path12.join(appFolder, APP_BACKEND_FOLDER, `${runnableId}.yaml`);
67805
+ const runnableFilePath2 = path13.join(appFolder, APP_BACKEND_FOLDER, `${runnableId}.yaml`);
67740
67806
  let runnable;
67741
67807
  try {
67742
67808
  runnable = await yamlParseFile(runnableFilePath2);
67743
67809
  } catch {
67744
67810
  try {
67745
- const appFilePath = path12.join(appFolder, "raw_app.yaml");
67811
+ const appFilePath = path13.join(appFolder, "raw_app.yaml");
67746
67812
  const appFile = await yamlParseFile(appFilePath);
67747
67813
  if (!appFile.runnables?.[runnableId]) {
67748
67814
  warn(colors.yellow(`Runnable ${runnableId} not found in backend folder or raw_app.yaml`));
@@ -67759,7 +67825,7 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath) {
67759
67825
  }
67760
67826
  const inlineScript = runnable.inlineScript;
67761
67827
  const language = inlineScript.language;
67762
- const fullFilePath = path12.join(appFolder, APP_BACKEND_FOLDER, runnableFilePath);
67828
+ const fullFilePath = path13.join(appFolder, APP_BACKEND_FOLDER, runnableFilePath);
67763
67829
  let content;
67764
67830
  try {
67765
67831
  content = await readFile11(fullFilePath, "utf-8");
@@ -67869,8 +67935,8 @@ var init_app_metadata = __esm(async () => {
67869
67935
  // src/commands/app/generate_agents.ts
67870
67936
  import * as fs9 from "node:fs";
67871
67937
  import { writeFile as writeFile9 } from "node:fs/promises";
67872
- import path13 from "node:path";
67873
- import process14 from "node:process";
67938
+ import path14 from "node:path";
67939
+ import process15 from "node:process";
67874
67940
  function generateDatatablesMarkdown(schemas, localData) {
67875
67941
  const defaultDatatable = localData?.datatable;
67876
67942
  const defaultSchema = localData?.schema;
@@ -67969,7 +68035,7 @@ Configure datatables in Workspace Settings > Windmill Data Tables.
67969
68035
  return content;
67970
68036
  }
67971
68037
  async function regenerateAgentDocs(workspaceId, targetDir, silent = false) {
67972
- const rawAppPath = path13.join(targetDir, "raw_app.yaml");
68038
+ const rawAppPath = path14.join(targetDir, "raw_app.yaml");
67973
68039
  if (!fs9.existsSync(rawAppPath)) {
67974
68040
  if (!silent) {
67975
68041
  error(colors.red(`Error: raw_app.yaml not found in ${targetDir}`));
@@ -67996,11 +68062,11 @@ async function regenerateAgentDocs(workspaceId, targetDir, silent = false) {
67996
68062
  }
67997
68063
  } catch {}
67998
68064
  const agentsContent = generateAgentsDocumentation(localData);
67999
- await writeFile9(path13.join(targetDir, "AGENTS.md"), agentsContent, "utf-8");
68000
- 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
68001
68067
  `, "utf-8");
68002
68068
  const datatablesContent = generateDatatablesMarkdown(schemas, localData);
68003
- await writeFile9(path13.join(targetDir, "DATATABLES.md"), datatablesContent, "utf-8");
68069
+ await writeFile9(path14.join(targetDir, "DATATABLES.md"), datatablesContent, "utf-8");
68004
68070
  if (!silent) {
68005
68071
  info(colors.green(`✓ Generated AGENTS.md, CLAUDE.md, and DATATABLES.md`));
68006
68072
  const datatableCount = schemas.length;
@@ -68018,24 +68084,24 @@ async function regenerateAgentDocs(workspaceId, targetDir, silent = false) {
68018
68084
  }
68019
68085
  }
68020
68086
  async function generateAgents(opts, appFolder) {
68021
- const cwd = process14.cwd();
68087
+ const cwd = process15.cwd();
68022
68088
  let targetDir = cwd;
68023
68089
  if (appFolder) {
68024
- targetDir = path13.isAbsolute(appFolder) ? appFolder : path13.join(cwd, appFolder);
68090
+ targetDir = path14.isAbsolute(appFolder) ? appFolder : path14.join(cwd, appFolder);
68025
68091
  }
68026
68092
  await loadNonDottedPathsSetting();
68027
- const dirName = path13.basename(targetDir);
68093
+ const dirName = path14.basename(targetDir);
68028
68094
  if (!hasFolderSuffix(dirName, "raw_app")) {
68029
- if (!hasFolderSuffix(path13.basename(cwd), "raw_app") && !appFolder) {
68095
+ if (!hasFolderSuffix(path14.basename(cwd), "raw_app") && !appFolder) {
68030
68096
  error(colors.red(`Error: Must be run inside a ${getFolderSuffix("raw_app")} folder or specify one as argument.`));
68031
68097
  info(colors.gray("Usage: wmill app generate-agents [app_folder]"));
68032
- process14.exit(1);
68098
+ process15.exit(1);
68033
68099
  }
68034
68100
  }
68035
- const rawAppPath = path13.join(targetDir, "raw_app.yaml");
68101
+ const rawAppPath = path14.join(targetDir, "raw_app.yaml");
68036
68102
  if (!fs9.existsSync(rawAppPath)) {
68037
68103
  error(colors.red(`Error: raw_app.yaml not found in ${targetDir}`));
68038
- process14.exit(1);
68104
+ process15.exit(1);
68039
68105
  }
68040
68106
  const workspace = await resolveWorkspace(opts);
68041
68107
  await requireLogin(opts);
@@ -68062,40 +68128,40 @@ var init_generate_agents = __esm(async () => {
68062
68128
  import { sep as SEP12 } from "node:path";
68063
68129
  import * as http2 from "node:http";
68064
68130
  import * as fs10 from "node:fs";
68065
- import * as path14 from "node:path";
68066
- import process15 from "node:process";
68067
- 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";
68068
68134
  import { readFile as readFile12 } from "node:fs/promises";
68069
68135
  async function dev(opts, appFolder) {
68070
68136
  GLOBAL_CONFIG_OPT.noCdToRoot = true;
68071
68137
  await loadNonDottedPathsSetting();
68072
- const originalCwd = process15.cwd();
68138
+ const originalCwd = process16.cwd();
68073
68139
  let targetDir = originalCwd;
68074
68140
  if (appFolder) {
68075
- targetDir = path14.isAbsolute(appFolder) ? appFolder : path14.join(originalCwd, appFolder);
68141
+ targetDir = path15.isAbsolute(appFolder) ? appFolder : path15.join(originalCwd, appFolder);
68076
68142
  if (!fs10.existsSync(targetDir)) {
68077
68143
  error(colors.red(`Error: Directory not found: ${targetDir}`));
68078
- process15.exit(1);
68144
+ process16.exit(1);
68079
68145
  }
68080
68146
  }
68081
- const targetDirName = path14.basename(targetDir);
68147
+ const targetDirName = path15.basename(targetDir);
68082
68148
  if (!hasFolderSuffix(targetDirName, "raw_app")) {
68083
68149
  error(colors.red(`Error: The dev command must be run inside a ${getFolderSuffix("raw_app")} folder.
68084
68150
  ` + `Target directory: ${targetDirName}
68085
68151
  ` + `Please navigate to a folder ending with '${getFolderSuffix("raw_app")}' or specify one as argument.`));
68086
- process15.exit(1);
68152
+ process16.exit(1);
68087
68153
  }
68088
- const rawAppPath = path14.join(targetDir, "raw_app.yaml");
68154
+ const rawAppPath = path15.join(targetDir, "raw_app.yaml");
68089
68155
  if (!fs10.existsSync(rawAppPath)) {
68090
68156
  error(colors.red(`Error: raw_app.yaml not found in ${targetDir}.
68091
68157
  ` + `The dev command requires a ${getFolderSuffix("raw_app")} folder containing a raw_app.yaml file.`));
68092
- process15.exit(1);
68158
+ process16.exit(1);
68093
68159
  }
68094
68160
  const workspace = await resolveWorkspace(opts);
68095
68161
  await requireLogin(opts);
68096
68162
  const workspaceId = workspace.workspaceId;
68097
68163
  if (appFolder) {
68098
- process15.chdir(targetDir);
68164
+ process16.chdir(targetDir);
68099
68165
  }
68100
68166
  const rawApp = await yamlParseFile(rawAppPath);
68101
68167
  const appPath = rawApp?.custom_path ?? "u/unknown/newapp";
@@ -68105,18 +68171,18 @@ async function dev(opts, appFolder) {
68105
68171
  });
68106
68172
  const host = opts.host ?? DEFAULT_HOST;
68107
68173
  const shouldOpen = opts.open ?? true;
68108
- const frameworks = detectFrameworks(process15.cwd());
68174
+ const frameworks = detectFrameworks(process16.cwd());
68109
68175
  const defaultEntry = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
68110
68176
  const entryPoint = opts.entry ?? defaultEntry;
68111
68177
  if (!fs10.existsSync(entryPoint)) {
68112
68178
  error(colors.red(`Entry point "${entryPoint}" not found. Please specify a valid entry point with --entry.`));
68113
- process15.exit(1);
68179
+ process16.exit(1);
68114
68180
  }
68115
- const appDir = path14.dirname(entryPoint) || process15.cwd();
68181
+ const appDir = path15.dirname(entryPoint) || process16.cwd();
68116
68182
  await ensureNodeModules(appDir);
68117
68183
  const inferredSchemas = {};
68118
68184
  genRunnablesTs(inferredSchemas);
68119
- const distDir = path14.join(process15.cwd(), "dist");
68185
+ const distDir = path15.join(process16.cwd(), "dist");
68120
68186
  if (!fs10.existsSync(distDir)) {
68121
68187
  fs10.mkdirSync(distDir);
68122
68188
  }
@@ -68179,7 +68245,7 @@ data: reload
68179
68245
  info(colors.blue(`\uD83D\uDC40 Watching for file changes...
68180
68246
  `));
68181
68247
  await ctx.rebuild();
68182
- const runnablesPath = path14.join(process15.cwd(), APP_BACKEND_FOLDER);
68248
+ const runnablesPath = path15.join(process16.cwd(), APP_BACKEND_FOLDER);
68183
68249
  let runnablesWatcher;
68184
68250
  if (fs10.existsSync(runnablesPath)) {
68185
68251
  info(colors.blue(`\uD83D\uDC41️ Watching runnables folder at: ${runnablesPath}
@@ -68191,8 +68257,8 @@ data: reload
68191
68257
  if (!filename)
68192
68258
  return;
68193
68259
  const fileStr = typeof filename === "string" ? filename : filename.toString();
68194
- const changedPath = path14.join(runnablesPath, fileStr);
68195
- const relativePath = path14.relative(process15.cwd(), changedPath);
68260
+ const changedPath = path15.join(runnablesPath, fileStr);
68261
+ const relativePath = path15.relative(process16.cwd(), changedPath);
68196
68262
  const relativeToRunnables = fileStr;
68197
68263
  if (changedPath.endsWith(".lock")) {
68198
68264
  return;
@@ -68205,7 +68271,7 @@ data: reload
68205
68271
  delete schemaInferenceTimeouts[changedPath];
68206
68272
  try {
68207
68273
  info(colors.cyan(`\uD83D\uDCDD Inferring schema for: ${relativeToRunnables}`));
68208
- const result = await inferRunnableSchemaFromFile(process15.cwd(), relativeToRunnables);
68274
+ const result = await inferRunnableSchemaFromFile(process16.cwd(), relativeToRunnables);
68209
68275
  if (result) {
68210
68276
  inferredSchemas[result.runnableId] = result.schema;
68211
68277
  info(colors.green(` Inferred Schemas: ${JSON.stringify(inferredSchemas, null, 2)}`));
@@ -68243,7 +68309,7 @@ data: reload
68243
68309
  return;
68244
68310
  }
68245
68311
  if (url === "/dist/bundle.js" || url === "/bundle.js") {
68246
- const jsPath = path14.join(process15.cwd(), "dist/bundle.js");
68312
+ const jsPath = path15.join(process16.cwd(), "dist/bundle.js");
68247
68313
  if (fs10.existsSync(jsPath)) {
68248
68314
  res.writeHead(200, { "Content-Type": "application/javascript" });
68249
68315
  res.end(fs10.readFileSync(jsPath));
@@ -68254,7 +68320,7 @@ data: reload
68254
68320
  return;
68255
68321
  }
68256
68322
  if (url === "/dist/bundle.css" || url === "/bundle.css") {
68257
- const cssPath = path14.join(process15.cwd(), "dist/bundle.css");
68323
+ const cssPath = path15.join(process16.cwd(), "dist/bundle.css");
68258
68324
  if (fs10.existsSync(cssPath)) {
68259
68325
  res.writeHead(200, { "Content-Type": "text/css" });
68260
68326
  res.end(fs10.readFileSync(cssPath));
@@ -68265,7 +68331,7 @@ data: reload
68265
68331
  return;
68266
68332
  }
68267
68333
  if (url === "/dist/bundle.js.map" || url === "/bundle.js.map") {
68268
- const mapPath = path14.join(process15.cwd(), "dist/bundle.js.map");
68334
+ const mapPath = path15.join(process16.cwd(), "dist/bundle.js.map");
68269
68335
  if (fs10.existsSync(mapPath)) {
68270
68336
  res.writeHead(200, { "Content-Type": "application/json" });
68271
68337
  res.end(fs10.readFileSync(mapPath));
@@ -68276,7 +68342,7 @@ data: reload
68276
68342
  return;
68277
68343
  }
68278
68344
  if (url === "/dist/bundle.css.map" || url === "/bundle.css.map") {
68279
- const mapPath = path14.join(process15.cwd(), "dist/bundle.css.map");
68345
+ const mapPath = path15.join(process16.cwd(), "dist/bundle.css.map");
68280
68346
  if (fs10.existsSync(mapPath)) {
68281
68347
  res.writeHead(200, { "Content-Type": "application/json" });
68282
68348
  res.end(fs10.readFileSync(mapPath));
@@ -68290,12 +68356,12 @@ data: reload
68290
68356
  res.end(createHTML("/dist/bundle.js", "/dist/bundle.css"));
68291
68357
  });
68292
68358
  const wss = new import_websocket_server.default({ server });
68293
- const sqlToApplyPath = path14.join(process15.cwd(), "sql_to_apply");
68359
+ const sqlToApplyPath = path15.join(process16.cwd(), "sql_to_apply");
68294
68360
  const sqlFileQueue = [];
68295
68361
  let currentSqlFile = null;
68296
68362
  async function getDatatableConfig() {
68297
68363
  try {
68298
- const rawApp2 = await yamlParseFile(path14.join(process15.cwd(), "raw_app.yaml"));
68364
+ const rawApp2 = await yamlParseFile(path15.join(process16.cwd(), "raw_app.yaml"));
68299
68365
  return rawApp2?.data?.datatable;
68300
68366
  } catch {
68301
68367
  return;
@@ -68332,12 +68398,12 @@ data: reload
68332
68398
  }
68333
68399
  const filePath = sqlFileQueue.shift();
68334
68400
  if (!fs10.existsSync(filePath)) {
68335
- info(colors.gray(`File no longer exists: ${path14.basename(filePath)}`));
68401
+ info(colors.gray(`File no longer exists: ${path15.basename(filePath)}`));
68336
68402
  await processNextSqlFile();
68337
68403
  return;
68338
68404
  }
68339
68405
  currentSqlFile = filePath;
68340
- const fileName = path14.basename(filePath);
68406
+ const fileName = path15.basename(filePath);
68341
68407
  try {
68342
68408
  const sqlContent = await readFile12(filePath, "utf-8");
68343
68409
  if (!sqlContent.trim()) {
@@ -68359,9 +68425,9 @@ data: reload
68359
68425
  if (deleteFile && fs10.existsSync(filePath)) {
68360
68426
  try {
68361
68427
  fs10.unlinkSync(filePath);
68362
- info(colors.green(`✓ Deleted: ${path14.basename(filePath)}`));
68428
+ info(colors.green(`✓ Deleted: ${path15.basename(filePath)}`));
68363
68429
  } catch (error2) {
68364
- error(colors.red(`Failed to delete ${path14.basename(filePath)}: ${error2.message}`));
68430
+ error(colors.red(`Failed to delete ${path15.basename(filePath)}: ${error2.message}`));
68365
68431
  }
68366
68432
  }
68367
68433
  currentSqlFile = null;
@@ -68373,7 +68439,7 @@ data: reload
68373
68439
  try {
68374
68440
  const sqlContent = await readFile12(currentSqlFile, "utf-8");
68375
68441
  const datatable = await getDatatableConfig();
68376
- const fileName = path14.basename(currentSqlFile);
68442
+ const fileName = path15.basename(currentSqlFile);
68377
68443
  ws.send(JSON.stringify({
68378
68444
  type: "sqlMigration",
68379
68445
  fileName,
@@ -68387,7 +68453,7 @@ data: reload
68387
68453
  const sqlFiles = entries.filter((entry) => entry.endsWith(".sql"));
68388
68454
  if (sqlFiles.length > 0 && sqlFileQueue.length === 0) {
68389
68455
  for (const sqlFile of sqlFiles.sort()) {
68390
- queueSqlFile(path14.join(sqlToApplyPath, sqlFile));
68456
+ queueSqlFile(path15.join(sqlToApplyPath, sqlFile));
68391
68457
  }
68392
68458
  await processNextSqlFile();
68393
68459
  }
@@ -68514,7 +68580,7 @@ data: reload
68514
68580
  await onSqlFileCompleted(currentSqlFile, true);
68515
68581
  }
68516
68582
  try {
68517
- await regenerateAgentDocs(workspaceId, process15.cwd(), true);
68583
+ await regenerateAgentDocs(workspaceId, process16.cwd(), true);
68518
68584
  info(colors.gray(`[SQL Migration] Refreshed AGENTS.md and DATATABLES.md`));
68519
68585
  } catch (regenError) {
68520
68586
  warn(colors.yellow(`[SQL Migration] Could not refresh docs: ${regenError.message}`));
@@ -68566,7 +68632,7 @@ data: reload
68566
68632
  }
68567
68633
  info(colors.blue(`\uD83D\uDD0D Found ${sqlFiles.length} SQL file(s) in sql_to_apply/`));
68568
68634
  for (const sqlFile of sqlFiles) {
68569
- const filePath = path14.join(sqlToApplyPath, sqlFile);
68635
+ const filePath = path15.join(sqlToApplyPath, sqlFile);
68570
68636
  queueSqlFile(filePath);
68571
68637
  }
68572
68638
  await processNextSqlFile();
@@ -68584,11 +68650,11 @@ data: reload
68584
68650
  if (!filename)
68585
68651
  return;
68586
68652
  const fileStr = typeof filename === "string" ? filename : filename.toString();
68587
- const changedPath = path14.join(sqlToApplyPath, fileStr);
68653
+ const changedPath = path15.join(sqlToApplyPath, fileStr);
68588
68654
  if (!changedPath.endsWith(".sql")) {
68589
68655
  return;
68590
68656
  }
68591
- const fileName = path14.basename(changedPath);
68657
+ const fileName = path15.basename(changedPath);
68592
68658
  if (sqlDebounceTimeouts[changedPath]) {
68593
68659
  clearTimeout(sqlDebounceTimeouts[changedPath]);
68594
68660
  }
@@ -68613,7 +68679,7 @@ data: reload
68613
68679
  const url = `http://${host}:${port}`;
68614
68680
  info(colors.bold.green(`\uD83D\uDE80 Dev server running at ${url}`));
68615
68681
  info(colors.cyan(`\uD83D\uDD0C WebSocket server running at ws://${host}:${port}`));
68616
- info(colors.gray(`\uD83D\uDCE6 Serving files from: ${process15.cwd()}`));
68682
+ info(colors.gray(`\uD83D\uDCE6 Serving files from: ${process16.cwd()}`));
68617
68683
  info(colors.gray(`\uD83D\uDD04 Live reload enabled
68618
68684
  `));
68619
68685
  if (shouldOpen) {
@@ -68627,7 +68693,7 @@ data: reload
68627
68693
  }
68628
68694
  }
68629
68695
  });
68630
- process15.on("SIGINT", async () => {
68696
+ process16.on("SIGINT", async () => {
68631
68697
  info(colors.yellow(`
68632
68698
 
68633
68699
  \uD83D\uDED1 Shutting down...`));
@@ -68640,17 +68706,17 @@ data: reload
68640
68706
  sqlWatcher.close();
68641
68707
  }
68642
68708
  await ctx.dispose();
68643
- process15.exit(0);
68709
+ process16.exit(0);
68644
68710
  });
68645
68711
  }
68646
68712
  async function genRunnablesTs(schemaOverrides = {}) {
68647
68713
  info(colors.blue("\uD83D\uDD04 Generating wmill.d.ts..."));
68648
- const localPath = process15.cwd();
68649
- const backendPath = path14.join(localPath, APP_BACKEND_FOLDER);
68714
+ const localPath = process16.cwd();
68715
+ const backendPath = path15.join(localPath, APP_BACKEND_FOLDER);
68650
68716
  let runnables = await loadRunnablesFromBackend(backendPath);
68651
68717
  if (Object.keys(runnables).length === 0) {
68652
68718
  try {
68653
- const rawApp = await yamlParseFile(path14.join(localPath, "raw_app.yaml"));
68719
+ const rawApp = await yamlParseFile(path15.join(localPath, "raw_app.yaml"));
68654
68720
  runnables = rawApp?.["runnables"] ?? {};
68655
68721
  } catch {
68656
68722
  runnables = {};
@@ -68666,7 +68732,7 @@ async function genRunnablesTs(schemaOverrides = {}) {
68666
68732
  }
68667
68733
  try {
68668
68734
  const newWmillTs = genWmillTs(runnables);
68669
- writeFileSync4(path14.join(process15.cwd(), "wmill.d.ts"), newWmillTs);
68735
+ writeFileSync5(path15.join(process16.cwd(), "wmill.d.ts"), newWmillTs);
68670
68736
  } catch (error2) {
68671
68737
  error(colors.red(`Failed to generate wmill.d.ts: ${error2.message}`));
68672
68738
  }
@@ -68683,11 +68749,11 @@ function convertRunnablesToApiFormat(runnables) {
68683
68749
  }
68684
68750
  async function loadRunnables() {
68685
68751
  try {
68686
- const localPath = process15.cwd();
68687
- const backendPath = path14.join(localPath, APP_BACKEND_FOLDER);
68752
+ const localPath = process16.cwd();
68753
+ const backendPath = path15.join(localPath, APP_BACKEND_FOLDER);
68688
68754
  let runnables = await loadRunnablesFromBackend(backendPath);
68689
68755
  if (Object.keys(runnables).length === 0) {
68690
- const rawApp = await yamlParseFile(path14.join(localPath, "raw_app.yaml"));
68756
+ const rawApp = await yamlParseFile(path15.join(localPath, "raw_app.yaml"));
68691
68757
  runnables = rawApp?.runnables ?? {};
68692
68758
  }
68693
68759
  convertRunnablesToApiFormat(runnables);
@@ -69168,8 +69234,8 @@ var init_dev = __esm(async () => {
69168
69234
 
69169
69235
  // src/commands/app/lint.ts
69170
69236
  import * as fs11 from "node:fs";
69171
- import * as path15 from "node:path";
69172
- import process16 from "node:process";
69237
+ import * as path16 from "node:path";
69238
+ import process17 from "node:process";
69173
69239
  function validateRawAppYaml(appData) {
69174
69240
  const errors = [];
69175
69241
  const warnings = [];
@@ -69183,7 +69249,7 @@ function validateRawAppYaml(appData) {
69183
69249
  async function validateRunnables(appDir, appData) {
69184
69250
  const errors = [];
69185
69251
  const warnings = [];
69186
- const backendPath = path15.join(appDir, APP_BACKEND_FOLDER);
69252
+ const backendPath = path16.join(appDir, APP_BACKEND_FOLDER);
69187
69253
  const runnablesFromBackend = await loadRunnablesFromBackend(backendPath);
69188
69254
  const hasBackendRunnables = Object.keys(runnablesFromBackend).length > 0;
69189
69255
  const hasYamlRunnables = appData.runnables && typeof appData.runnables === "object" && !Array.isArray(appData.runnables) && Object.keys(appData.runnables).length > 0;
@@ -69206,7 +69272,7 @@ async function validateBuild(appDir) {
69206
69272
  info(colors.blue("\uD83D\uDD28 Testing build..."));
69207
69273
  const frameworks = detectFrameworks(appDir);
69208
69274
  const entryFile = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
69209
- const entryPoint = path15.join(appDir, entryFile);
69275
+ const entryPoint = path16.join(appDir, entryFile);
69210
69276
  await createBundle({
69211
69277
  entryPoint,
69212
69278
  production: true,
@@ -69221,12 +69287,12 @@ async function validateBuild(appDir) {
69221
69287
  async function lintRawApp(appDir, opts) {
69222
69288
  const errors = [];
69223
69289
  const warnings = [];
69224
- const currentDirName = path15.basename(appDir);
69290
+ const currentDirName = path16.basename(appDir);
69225
69291
  if (!hasFolderSuffix(currentDirName, "raw_app")) {
69226
69292
  errors.push(`Not a raw app folder: '${currentDirName}' does not end with '${getFolderSuffix("raw_app")}'`);
69227
69293
  return { valid: false, errors, warnings };
69228
69294
  }
69229
- const rawAppPath = path15.join(appDir, "raw_app.yaml");
69295
+ const rawAppPath = path16.join(appDir, "raw_app.yaml");
69230
69296
  if (!fs11.existsSync(rawAppPath)) {
69231
69297
  errors.push("Missing raw_app.yaml file");
69232
69298
  return { valid: false, errors, warnings };
@@ -69265,7 +69331,7 @@ async function lintRawApp(appDir, opts) {
69265
69331
  }
69266
69332
  async function lint2(opts, appFolder) {
69267
69333
  await loadNonDottedPathsSetting();
69268
- const targetDir = appFolder ?? process16.cwd();
69334
+ const targetDir = appFolder ?? process17.cwd();
69269
69335
  info(colors.bold.blue(`
69270
69336
  \uD83D\uDD0D Linting raw app: ${targetDir}
69271
69337
  `));
@@ -69286,7 +69352,7 @@ async function lint2(opts, appFolder) {
69286
69352
  info(colors.red(`
69287
69353
  ❌ Lint failed
69288
69354
  `));
69289
- process16.exit(1);
69355
+ process17.exit(1);
69290
69356
  }
69291
69357
  info(colors.green(`
69292
69358
  ✅ All checks passed
@@ -69310,7 +69376,7 @@ var init_lint2 = __esm(async () => {
69310
69376
 
69311
69377
  // src/commands/app/new.ts
69312
69378
  import { stat as stat9, writeFile as writeFile10, mkdir as mkdir7 } from "node:fs/promises";
69313
- import path16 from "node:path";
69379
+ import path17 from "node:path";
69314
69380
  function validateAppPath(appPath) {
69315
69381
  if (!appPath.startsWith("u/") && !appPath.startsWith("f/")) {
69316
69382
  return {
@@ -69515,7 +69581,7 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
69515
69581
  }
69516
69582
  await loadNonDottedPathsSetting();
69517
69583
  const folderName2 = buildFolderPath(appPath, "raw_app");
69518
- const appDir = path16.join(process.cwd(), folderName2);
69584
+ const appDir = path17.join(process.cwd(), folderName2);
69519
69585
  try {
69520
69586
  await stat9(appDir);
69521
69587
  const overwrite = await Confirm.prompt({
@@ -69528,17 +69594,17 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
69528
69594
  }
69529
69595
  } catch {}
69530
69596
  await mkdir7(appDir, { recursive: true });
69531
- await mkdir7(path16.join(appDir, "backend"), { recursive: true });
69532
- 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 });
69533
69599
  const rawAppConfig = {
69534
69600
  summary
69535
69601
  };
69536
69602
  if (dataConfig.datatable) {
69537
69603
  rawAppConfig.data = dataConfig;
69538
69604
  }
69539
- 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");
69540
69606
  for (const [filePath, content] of Object.entries(template.files)) {
69541
- const fullPath = path16.join(appDir, filePath.slice(1));
69607
+ const fullPath = path17.join(appDir, filePath.slice(1));
69542
69608
  await writeFile10(fullPath, content.trim() + `
69543
69609
  `, "utf-8");
69544
69610
  }
@@ -69548,21 +69614,21 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
69548
69614
  schema: dataConfig.schema
69549
69615
  } : undefined;
69550
69616
  const agentsContent = generateAgentsDocumentation(dataForDocs);
69551
- await writeFile10(path16.join(appDir, "AGENTS.md"), agentsContent, "utf-8");
69552
- 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
69553
69619
  `, "utf-8");
69554
69620
  const datatablesContent = generateDatatablesDocumentation(dataForDocs);
69555
- await writeFile10(path16.join(appDir, "DATATABLES.md"), datatablesContent, "utf-8");
69621
+ await writeFile10(path17.join(appDir, "DATATABLES.md"), datatablesContent, "utf-8");
69556
69622
  const exampleRunnable = {
69557
69623
  type: "inline",
69558
69624
  path: undefined
69559
69625
  };
69560
- await writeFile10(path16.join(appDir, "backend", "a.yaml"), import_yaml22.stringify(exampleRunnable, yamlOptions), "utf-8");
69561
- 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> {
69562
69628
  return \`Hello from backend! x = \${x}\`;
69563
69629
  }
69564
69630
  `, "utf-8");
69565
- 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
69566
69632
 
69567
69633
  This folder is for SQL migration files that will be applied to datatables during development.
69568
69634
 
@@ -69590,7 +69656,7 @@ This folder is for SQL migration files that will be applied to datatables during
69590
69656
  - Use idempotent SQL (\`CREATE TABLE IF NOT EXISTS\`, etc.)
69591
69657
  `);
69592
69658
  if (createSchemaSQL && schemaName) {
69593
- 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");
69594
69660
  }
69595
69661
  info("");
69596
69662
  info(colors.bold.green(`App created successfully at ${folderName2}/`));
@@ -69891,8 +69957,8 @@ async function pushApp(workspace, remotePath, localPath, message, permissionedAs
69891
69957
  if (!localPath.endsWith(SEP13)) {
69892
69958
  localPath += SEP13;
69893
69959
  }
69894
- const path17 = localPath + "app.yaml";
69895
- const localApp = await yamlParseFile(path17);
69960
+ const path18 = localPath + "app.yaml";
69961
+ const localApp = await yamlParseFile(path18);
69896
69962
  replaceInlineScripts2(localApp.value, localPath, true);
69897
69963
  await generatingPolicy2(localApp, remotePath, localApp?.["public"] ?? localApp?.["policy"]?.["execution_mode"] == "anonymous");
69898
69964
  const preserveFields = {};
@@ -69934,13 +70000,13 @@ async function pushApp(workspace, remotePath, localPath, message, permissionedAs
69934
70000
  });
69935
70001
  }
69936
70002
  }
69937
- async function generatingPolicy2(app, path17, publicApp) {
69938
- 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}...`));
69939
70005
  try {
69940
70006
  app.policy = await updatePolicy(app.value, undefined);
69941
70007
  app.policy.execution_mode = publicApp ? "anonymous" : "publisher";
69942
70008
  } catch (e) {
69943
- error(colors.red(`Error generating policy for app ${path17}: ${e}`));
70009
+ error(colors.red(`Error generating policy for app ${path18}: ${e}`));
69944
70010
  throw e;
69945
70011
  }
69946
70012
  }
@@ -69969,12 +70035,12 @@ async function list6(opts) {
69969
70035
  new Table2().header(["path", "summary"]).padding(2).border(true).body(total.map((x) => [x.path, x.summary])).render();
69970
70036
  }
69971
70037
  }
69972
- async function get4(opts, path17) {
70038
+ async function get4(opts, path18) {
69973
70039
  const workspace = await resolveWorkspace(opts);
69974
70040
  await requireLogin(opts);
69975
70041
  const a = await getAppByPath({
69976
70042
  workspace: workspace.workspaceId,
69977
- path: path17
70043
+ path: path18
69978
70044
  });
69979
70045
  if (opts.json) {
69980
70046
  console.log(JSON.stringify(a));
@@ -70312,11 +70378,11 @@ async function list8(opts) {
70312
70378
  ])).render();
70313
70379
  }
70314
70380
  }
70315
- async function newVariable(opts, path17) {
70316
- if (!validatePath(path17)) {
70381
+ async function newVariable(opts, path18) {
70382
+ if (!validatePath(path18)) {
70317
70383
  return;
70318
70384
  }
70319
- const filePath = path17 + ".variable.yaml";
70385
+ const filePath = path18 + ".variable.yaml";
70320
70386
  try {
70321
70387
  await stat12(filePath);
70322
70388
  throw new Error("File already exists: " + filePath);
@@ -70336,14 +70402,14 @@ async function newVariable(opts, path17) {
70336
70402
  });
70337
70403
  info(colors.green(`Created ${filePath}`));
70338
70404
  }
70339
- async function get6(opts, path17) {
70405
+ async function get6(opts, path18) {
70340
70406
  if (opts.json)
70341
70407
  setSilent(true);
70342
70408
  const workspace = await resolveWorkspace(opts);
70343
70409
  await requireLogin(opts);
70344
70410
  const v = await getVariable({
70345
70411
  workspace: workspace.workspaceId,
70346
- path: path17
70412
+ path: path18
70347
70413
  });
70348
70414
  if (opts.json) {
70349
70415
  console.log(JSON.stringify(v));
@@ -70472,11 +70538,11 @@ async function list9(opts) {
70472
70538
  new Table2().header(["Path", "Schedule"]).padding(2).border(true).body(schedules.map((x) => [x.path, x.schedule])).render();
70473
70539
  }
70474
70540
  }
70475
- async function newSchedule(opts, path17) {
70476
- if (!validatePath(path17)) {
70541
+ async function newSchedule(opts, path18) {
70542
+ if (!validatePath(path18)) {
70477
70543
  return;
70478
70544
  }
70479
- const filePath = path17 + ".schedule.yaml";
70545
+ const filePath = path18 + ".schedule.yaml";
70480
70546
  try {
70481
70547
  await stat13(filePath);
70482
70548
  throw new Error("File already exists: " + filePath);
@@ -70500,14 +70566,14 @@ async function newSchedule(opts, path17) {
70500
70566
  });
70501
70567
  info(colors.green(`Created ${filePath}`));
70502
70568
  }
70503
- async function get7(opts, path17) {
70569
+ async function get7(opts, path18) {
70504
70570
  if (opts.json)
70505
70571
  setSilent(true);
70506
70572
  const workspace = await resolveWorkspace(opts);
70507
70573
  await requireLogin(opts);
70508
70574
  const s = await getSchedule({
70509
70575
  workspace: workspace.workspaceId,
70510
- path: path17
70576
+ path: path18
70511
70577
  });
70512
70578
  if (opts.json) {
70513
70579
  console.log(JSON.stringify(s));
@@ -70520,14 +70586,14 @@ async function get7(opts, path17) {
70520
70586
  console.log(colors.bold("Enabled:") + " " + (s.enabled ? "true" : "false"));
70521
70587
  }
70522
70588
  }
70523
- async function pushSchedule(workspace, path17, schedule, localSchedule, permissionedAsContext) {
70524
- path17 = removeType(path17, "schedule").replaceAll(SEP16, "/");
70525
- 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}`);
70526
70592
  try {
70527
- schedule = await getSchedule({ workspace, path: path17 });
70528
- debug(`Schedule ${path17} exists on remote`);
70593
+ schedule = await getSchedule({ workspace, path: path18 });
70594
+ debug(`Schedule ${path18} exists on remote`);
70529
70595
  } catch {
70530
- debug(`Schedule ${path17} does not exist on remote`);
70596
+ debug(`Schedule ${path18} does not exist on remote`);
70531
70597
  }
70532
70598
  delete localSchedule.has_permissioned_as;
70533
70599
  const preserveFields = {};
@@ -70536,31 +70602,31 @@ async function pushSchedule(workspace, path17, schedule, localSchedule, permissi
70536
70602
  preserveFields.preserve_permissioned_as = true;
70537
70603
  if (schedule.permissioned_as) {
70538
70604
  preserveFields.permissioned_as = schedule.permissioned_as;
70539
- info(`Preserving ${schedule.permissioned_as} as permissioned_as for schedule ${path17}`);
70605
+ info(`Preserving ${schedule.permissioned_as} as permissioned_as for schedule ${path18}`);
70540
70606
  }
70541
70607
  }
70542
70608
  }
70543
70609
  if (schedule) {
70544
70610
  if (isSuperset(localSchedule, schedule)) {
70545
- debug(`Schedule ${path17} is up to date`);
70611
+ debug(`Schedule ${path18} is up to date`);
70546
70612
  return;
70547
70613
  }
70548
- debug(`Updating schedule ${path17}`);
70614
+ debug(`Updating schedule ${path18}`);
70549
70615
  try {
70550
- info(colors.bold.yellow(`Updating schedule ${path17}`));
70616
+ info(colors.bold.yellow(`Updating schedule ${path18}`));
70551
70617
  await updateSchedule({
70552
70618
  workspace,
70553
- path: path17,
70619
+ path: path18,
70554
70620
  requestBody: {
70555
70621
  ...localSchedule,
70556
70622
  ...preserveFields
70557
70623
  }
70558
70624
  });
70559
70625
  if (localSchedule.enabled != schedule.enabled) {
70560
- 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`));
70561
70627
  await setScheduleEnabled({
70562
70628
  workspace,
70563
- path: path17,
70629
+ path: path18,
70564
70630
  requestBody: {
70565
70631
  enabled: localSchedule.enabled
70566
70632
  }
@@ -70571,12 +70637,12 @@ async function pushSchedule(workspace, path17, schedule, localSchedule, permissi
70571
70637
  throw e;
70572
70638
  }
70573
70639
  } else {
70574
- console.log(colors.bold.yellow("Creating new schedule " + path17));
70640
+ console.log(colors.bold.yellow("Creating new schedule " + path18));
70575
70641
  try {
70576
70642
  await createSchedule({
70577
70643
  workspace,
70578
70644
  requestBody: {
70579
- path: path17,
70645
+ path: path18,
70580
70646
  ...localSchedule,
70581
70647
  ...preserveFields
70582
70648
  }
@@ -70587,27 +70653,27 @@ async function pushSchedule(workspace, path17, schedule, localSchedule, permissi
70587
70653
  }
70588
70654
  }
70589
70655
  }
70590
- async function enable(opts, path17) {
70656
+ async function enable(opts, path18) {
70591
70657
  opts = await mergeConfigWithConfigFile(opts);
70592
70658
  const workspace = await resolveWorkspace(opts);
70593
70659
  await requireLogin(opts);
70594
70660
  await setScheduleEnabled({
70595
70661
  workspace: workspace.workspaceId,
70596
- path: path17,
70662
+ path: path18,
70597
70663
  requestBody: { enabled: true }
70598
70664
  });
70599
- info(colors.green(`Schedule ${path17} enabled.`));
70665
+ info(colors.green(`Schedule ${path18} enabled.`));
70600
70666
  }
70601
- async function disable(opts, path17) {
70667
+ async function disable(opts, path18) {
70602
70668
  opts = await mergeConfigWithConfigFile(opts);
70603
70669
  const workspace = await resolveWorkspace(opts);
70604
70670
  await requireLogin(opts);
70605
70671
  await setScheduleEnabled({
70606
70672
  workspace: workspace.workspaceId,
70607
- path: path17,
70673
+ path: path18,
70608
70674
  requestBody: { enabled: false }
70609
70675
  });
70610
- info(colors.yellow(`Schedule ${path17} disabled.`));
70676
+ info(colors.yellow(`Schedule ${path18} disabled.`));
70611
70677
  }
70612
70678
  async function push8(opts, filePath, remotePath) {
70613
70679
  const workspace = await resolveWorkspace(opts);
@@ -70711,7 +70777,7 @@ async function decrypt(combinedCiphertext, keyString) {
70711
70777
  var init_local_encryption = () => {};
70712
70778
 
70713
70779
  // src/core/settings.ts
70714
- import process17 from "node:process";
70780
+ import process18 from "node:process";
70715
70781
  import { writeFile as writeFile14 } from "node:fs/promises";
70716
70782
  function migrateToGroupedFormat(settings) {
70717
70783
  const result = { name: settings.name ?? "" };
@@ -71020,7 +71086,7 @@ async function readInstanceSettings(opts) {
71020
71086
  return localSettings;
71021
71087
  }
71022
71088
  async function processInstanceSettings(settings, mode) {
71023
- const encKey = process17.env.WMILL_INSTANCE_LOCAL_ENCRYPTION_KEY;
71089
+ const encKey = process18.env.WMILL_INSTANCE_LOCAL_ENCRYPTION_KEY;
71024
71090
  if (encKey) {
71025
71091
  const res = [];
71026
71092
  for (const s of settings) {
@@ -71194,7 +71260,7 @@ var init_settings = __esm(async () => {
71194
71260
  // src/commands/instance/instance.ts
71195
71261
  import { readFile as readFile13, writeFile as writeFile15, readdir as readdir8, mkdir as mkdir11, rm as rm3, stat as stat14 } from "node:fs/promises";
71196
71262
  import { appendFile } from "node:fs/promises";
71197
- import * as path17 from "node:path";
71263
+ import * as path18 from "node:path";
71198
71264
  async function allInstances() {
71199
71265
  try {
71200
71266
  const file = await getInstancesConfigFilePath();
@@ -71386,7 +71452,7 @@ async function instancePull(opts) {
71386
71452
  if (confirm) {
71387
71453
  if (uChanges > 0) {
71388
71454
  if (opts.folderPerInstance && opts.prefixSettings) {
71389
- await mkdir11(path17.join(rootDir, opts.prefix), {
71455
+ await mkdir11(path18.join(rootDir, opts.prefix), {
71390
71456
  recursive: true
71391
71457
  });
71392
71458
  }
@@ -71420,10 +71486,10 @@ Pulling all workspaces`);
71420
71486
  info(`
71421
71487
  Pulling workspace ` + remoteWorkspace.id);
71422
71488
  const workspaceName = opts?.folderPerInstance ? instance.prefix + "/" + remoteWorkspace.id : instance.prefix + "_" + remoteWorkspace.id;
71423
- await mkdir11(path17.join(rootDir, workspaceName), {
71489
+ await mkdir11(path18.join(rootDir, workspaceName), {
71424
71490
  recursive: true
71425
71491
  });
71426
- process.chdir(path17.join(rootDir, workspaceName));
71492
+ process.chdir(path18.join(rootDir, workspaceName));
71427
71493
  await addWorkspace({
71428
71494
  remote: instance.remote,
71429
71495
  name: workspaceName,
@@ -71458,7 +71524,7 @@ Pulling workspace ` + remoteWorkspace.id);
71458
71524
  if (confirmDelete) {
71459
71525
  for (const workspace of localWorkspacesToDelete) {
71460
71526
  await removeWorkspace(workspace.id, false, {});
71461
- await rm3(path17.join(rootDir, workspace.dir), {
71527
+ await rm3(path18.join(rootDir, workspace.dir), {
71462
71528
  recursive: true
71463
71529
  });
71464
71530
  }
@@ -71547,12 +71613,12 @@ Pushing all workspaces: ${localWorkspaces.map((x) => x.id).join(", ")}`);
71547
71613
  info(`
71548
71614
  Pushing workspace ` + localWorkspace.id);
71549
71615
  try {
71550
- process.chdir(path17.join(rootDir, localWorkspace.dir));
71616
+ process.chdir(path18.join(rootDir, localWorkspace.dir));
71551
71617
  } catch (_) {
71552
71618
  throw new Error("Workspace folder not found, are you in the right directory?");
71553
71619
  }
71554
71620
  try {
71555
- const workspaceSettings = await yamlParseFile(path17.join(process.cwd(), "settings.yaml"));
71621
+ const workspaceSettings = await yamlParseFile(path18.join(process.cwd(), "settings.yaml"));
71556
71622
  await add({
71557
71623
  token: instance.token,
71558
71624
  workspace: undefined,
@@ -71815,8 +71881,8 @@ async function createToken2(opts) {
71815
71881
  }
71816
71882
  info("Token: " + await createToken({ requestBody: {} }));
71817
71883
  }
71818
- async function pushWorkspaceUser(workspace, path18, user, localUser) {
71819
- const email = removePathPrefix(removeType(path18, "user"), "users");
71884
+ async function pushWorkspaceUser(workspace, path19, user, localUser) {
71885
+ const email = removePathPrefix(removeType(path19, "user"), "users");
71820
71886
  debug(`Processing local user ${email}`);
71821
71887
  if (!["operator", "developer", "admin"].includes(localUser.role)) {
71822
71888
  throw new Error(`Invalid role for user ${email}: ${localUser.role}`);
@@ -71879,8 +71945,8 @@ async function pushWorkspaceUser(workspace, path18, user, localUser) {
71879
71945
  }
71880
71946
  }
71881
71947
  }
71882
- async function pushGroup(workspace, path18, group, localGroup) {
71883
- const name = removePathPrefix(removeType(path18, "group"), "groups");
71948
+ async function pushGroup(workspace, path19, group, localGroup) {
71949
+ const name = removePathPrefix(removeType(path19, "group"), "groups");
71884
71950
  debug(`Processing local group ${name}`);
71885
71951
  try {
71886
71952
  const remoteGroup = await getGroup({
@@ -72131,10 +72197,10 @@ async function push9(opts, filePath) {
72131
72197
  const content = fs12.readFileSync(filePath, "utf8");
72132
72198
  await pushWorkspaceDependencies(workspace.workspaceId, filePath, null, content);
72133
72199
  }
72134
- async function pushWorkspaceDependencies(workspace, path18, _befObj, newDependenciesContent) {
72135
- const res = workspaceDependenciesPathToLanguageAndFilename(path18);
72200
+ async function pushWorkspaceDependencies(workspace, path19, _befObj, newDependenciesContent) {
72201
+ const res = workspaceDependenciesPathToLanguageAndFilename(path19);
72136
72202
  if (!res) {
72137
- 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`);
72138
72204
  }
72139
72205
  const { language, name } = res;
72140
72206
  const displayName = name ? `named dependencies "${name}"` : `workspace default dependencies`;
@@ -72185,7 +72251,7 @@ var init_dependencies = __esm(async () => {
72185
72251
  import { mkdir as mkdir12, stat as stat15, writeFile as writeFile17 } from "node:fs/promises";
72186
72252
  import { dirname as dirname15 } from "node:path";
72187
72253
  import { sep as SEP17 } from "node:path";
72188
- async function getTrigger(triggerType, workspace, path18) {
72254
+ async function getTrigger(triggerType, workspace, path19) {
72189
72255
  const triggerFunctions = {
72190
72256
  http: getHttpTrigger,
72191
72257
  websocket: getWebsocketTrigger,
@@ -72198,10 +72264,10 @@ async function getTrigger(triggerType, workspace, path18) {
72198
72264
  email: getEmailTrigger
72199
72265
  };
72200
72266
  const triggerFunction = triggerFunctions[triggerType];
72201
- const trigger = await triggerFunction({ workspace, path: path18 });
72267
+ const trigger = await triggerFunction({ workspace, path: path19 });
72202
72268
  return trigger;
72203
72269
  }
72204
- async function updateTrigger(triggerType, workspace, path18, trigger) {
72270
+ async function updateTrigger(triggerType, workspace, path19, trigger) {
72205
72271
  const triggerFunctions = {
72206
72272
  http: updateHttpTrigger,
72207
72273
  websocket: updateWebsocketTrigger,
@@ -72214,9 +72280,9 @@ async function updateTrigger(triggerType, workspace, path18, trigger) {
72214
72280
  email: updateEmailTrigger
72215
72281
  };
72216
72282
  const triggerFunction = triggerFunctions[triggerType];
72217
- await triggerFunction({ workspace, path: path18, requestBody: trigger });
72283
+ await triggerFunction({ workspace, path: path19, requestBody: trigger });
72218
72284
  }
72219
- async function createTrigger(triggerType, workspace, path18, trigger) {
72285
+ async function createTrigger(triggerType, workspace, path19, trigger) {
72220
72286
  const triggerFunctions = {
72221
72287
  http: createHttpTrigger,
72222
72288
  websocket: createWebsocketTrigger,
@@ -72229,16 +72295,16 @@ async function createTrigger(triggerType, workspace, path18, trigger) {
72229
72295
  email: createEmailTrigger
72230
72296
  };
72231
72297
  const triggerFunction = triggerFunctions[triggerType];
72232
- await triggerFunction({ workspace, path: path18, requestBody: trigger });
72298
+ await triggerFunction({ workspace, path: path19, requestBody: trigger });
72233
72299
  }
72234
- async function pushTrigger(triggerType, workspace, path18, trigger, localTrigger, permissionedAsContext) {
72235
- path18 = removeType(path18, triggerType + "_trigger").replaceAll(SEP17, "/");
72236
- 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}`);
72237
72303
  try {
72238
- trigger = await getTrigger(triggerType, workspace, path18);
72239
- debug(`${triggerType} trigger ${path18} exists on remote`);
72304
+ trigger = await getTrigger(triggerType, workspace, path19);
72305
+ debug(`${triggerType} trigger ${path19} exists on remote`);
72240
72306
  } catch {
72241
- debug(`${triggerType} trigger ${path18} does not exist on remote`);
72307
+ debug(`${triggerType} trigger ${path19} does not exist on remote`);
72242
72308
  }
72243
72309
  delete localTrigger.has_permissioned_as;
72244
72310
  const preserveFields = {};
@@ -72247,33 +72313,33 @@ async function pushTrigger(triggerType, workspace, path18, trigger, localTrigger
72247
72313
  preserveFields.preserve_permissioned_as = true;
72248
72314
  if (trigger.permissioned_as) {
72249
72315
  preserveFields.permissioned_as = trigger.permissioned_as;
72250
- info(`Preserving ${trigger.permissioned_as} as permissioned_as for trigger ${path18}`);
72316
+ info(`Preserving ${trigger.permissioned_as} as permissioned_as for trigger ${path19}`);
72251
72317
  }
72252
72318
  }
72253
72319
  }
72254
72320
  if (trigger) {
72255
72321
  if (isSuperset(localTrigger, trigger)) {
72256
- debug(`${triggerType} trigger ${path18} is up to date`);
72322
+ debug(`${triggerType} trigger ${path19} is up to date`);
72257
72323
  return;
72258
72324
  }
72259
- debug(`${triggerType} trigger ${path18} is not up-to-date, updating...`);
72325
+ debug(`${triggerType} trigger ${path19} is not up-to-date, updating...`);
72260
72326
  try {
72261
- await updateTrigger(triggerType, workspace, path18, {
72327
+ await updateTrigger(triggerType, workspace, path19, {
72262
72328
  ...localTrigger,
72263
72329
  ...preserveFields,
72264
- path: path18
72330
+ path: path19
72265
72331
  });
72266
72332
  } catch (e) {
72267
72333
  console.error(e.body);
72268
72334
  throw e;
72269
72335
  }
72270
72336
  } else {
72271
- console.log(colors.bold.yellow(`Creating new ${triggerType} trigger: ${path18}`));
72337
+ console.log(colors.bold.yellow(`Creating new ${triggerType} trigger: ${path19}`));
72272
72338
  try {
72273
- await createTrigger(triggerType, workspace, path18, {
72339
+ await createTrigger(triggerType, workspace, path19, {
72274
72340
  ...localTrigger,
72275
72341
  ...preserveFields,
72276
- path: path18
72342
+ path: path19
72277
72343
  });
72278
72344
  } catch (e) {
72279
72345
  console.error(e.body);
@@ -72358,8 +72424,8 @@ async function pushNativeTrigger(workspace, filePath, _remoteTrigger, localTrigg
72358
72424
  }
72359
72425
  }
72360
72426
  }
72361
- async function newTrigger(opts, path18) {
72362
- if (!validatePath(path18)) {
72427
+ async function newTrigger(opts, path19) {
72428
+ if (!validatePath(path19)) {
72363
72429
  return;
72364
72430
  }
72365
72431
  if (!opts.kind) {
@@ -72369,7 +72435,7 @@ async function newTrigger(opts, path18) {
72369
72435
  throw new Error("Invalid trigger kind: " + opts.kind + ". Valid kinds: " + TRIGGER_TYPES.join(", "));
72370
72436
  }
72371
72437
  const kind = opts.kind;
72372
- const filePath = `${path18}.${kind}_trigger.yaml`;
72438
+ const filePath = `${path19}.${kind}_trigger.yaml`;
72373
72439
  try {
72374
72440
  await stat15(filePath);
72375
72441
  throw new Error("File already exists: " + filePath);
@@ -72405,7 +72471,7 @@ function printTriggerDetails(trigger, kind) {
72405
72471
  console.log(colors.bold(label + ":") + " " + display);
72406
72472
  }
72407
72473
  }
72408
- async function get8(opts, path18) {
72474
+ async function get8(opts, path19) {
72409
72475
  if (opts.json)
72410
72476
  setSilent(true);
72411
72477
  const workspace = await resolveWorkspace(opts);
@@ -72414,7 +72480,7 @@ async function get8(opts, path18) {
72414
72480
  if (!checkIfValidTrigger(opts.kind)) {
72415
72481
  throw new Error("Invalid trigger kind: " + opts.kind + ". Valid kinds: " + TRIGGER_TYPES.join(", "));
72416
72482
  }
72417
- const trigger = await getTrigger(opts.kind, workspace.workspaceId, path18);
72483
+ const trigger = await getTrigger(opts.kind, workspace.workspaceId, path19);
72418
72484
  if (opts.json) {
72419
72485
  console.log(JSON.stringify(trigger));
72420
72486
  } else {
@@ -72425,12 +72491,12 @@ async function get8(opts, path18) {
72425
72491
  const matches = [];
72426
72492
  for (const kind of TRIGGER_TYPES) {
72427
72493
  try {
72428
- const trigger = await getTrigger(kind, workspace.workspaceId, path18);
72494
+ const trigger = await getTrigger(kind, workspace.workspaceId, path19);
72429
72495
  matches.push({ kind, trigger });
72430
72496
  } catch {}
72431
72497
  }
72432
72498
  if (matches.length === 0) {
72433
- throw new Error("No trigger found at path: " + path18);
72499
+ throw new Error("No trigger found at path: " + path19);
72434
72500
  }
72435
72501
  if (matches.length === 1) {
72436
72502
  const { kind, trigger } = matches[0];
@@ -72441,7 +72507,7 @@ async function get8(opts, path18) {
72441
72507
  }
72442
72508
  return;
72443
72509
  }
72444
- console.log("Multiple triggers found at path " + path18 + ":");
72510
+ console.log("Multiple triggers found at path " + path19 + ":");
72445
72511
  for (const m of matches) {
72446
72512
  console.log(" - " + m.kind);
72447
72513
  }
@@ -72658,7 +72724,7 @@ var init_trigger = __esm(async () => {
72658
72724
  });
72659
72725
 
72660
72726
  // src/types.ts
72661
- import * as path18 from "node:path";
72727
+ import * as path19 from "node:path";
72662
72728
  import { sep as SEP18 } from "node:path";
72663
72729
  import { readFileSync as readFileSync5 } from "node:fs";
72664
72730
  function isSuperset(subset, superset) {
@@ -72703,8 +72769,8 @@ function showDiff(local, remote) {
72703
72769
  }
72704
72770
  info(finalString);
72705
72771
  }
72706
- function showConflict(path19, local, remote) {
72707
- info(colors.yellow(`- ${path19}`));
72772
+ function showConflict(path20, local, remote) {
72773
+ info(colors.yellow(`- ${path20}`));
72708
72774
  showDiff(local, remote);
72709
72775
  info("\x1B[31mlocal\x1B[31m - \x1B[32mremote\x1B[32m");
72710
72776
  info(`
@@ -72808,7 +72874,7 @@ function getTypeStrFromPath(p) {
72808
72874
  if (isFileResource(p) || isFilesetResource(p)) {
72809
72875
  return "resource";
72810
72876
  }
72811
- const parsed = path18.parse(p);
72877
+ const parsed = path19.parse(p);
72812
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") {
72813
72879
  return "script";
72814
72880
  }
@@ -72832,7 +72898,7 @@ function getTypeStrFromPath(p) {
72832
72898
  }
72833
72899
  }
72834
72900
  function removeType(str, type) {
72835
- const normalizedStr = path18.normalize(str).replaceAll(SEP18, "/");
72901
+ const normalizedStr = path19.normalize(str).replaceAll(SEP18, "/");
72836
72902
  if (normalizedStr.endsWith("." + type + ".yaml") || normalizedStr.endsWith("." + type + ".json")) {
72837
72903
  return normalizedStr.slice(0, normalizedStr.length - type.length - 6);
72838
72904
  }
@@ -72842,7 +72908,7 @@ function removeType(str, type) {
72842
72908
  return normalizedStr;
72843
72909
  }
72844
72910
  function extractNativeTriggerInfo(p) {
72845
- const normalizedPath = path18.normalize(p).replaceAll(SEP18, "/");
72911
+ const normalizedPath = path19.normalize(p).replaceAll(SEP18, "/");
72846
72912
  const withoutExt = normalizedPath.replace(/\.(json|yaml)$/, "");
72847
72913
  const match2 = withoutExt.match(/^(.+)\.(flow|script)\.([^.]+)\.(\w+)_native_trigger$/);
72848
72914
  if (!match2) {
@@ -72856,8 +72922,8 @@ function extractNativeTriggerInfo(p) {
72856
72922
  };
72857
72923
  }
72858
72924
  function removePathPrefix(str, prefix) {
72859
- const normalizedStr = path18.normalize(str).replaceAll(SEP18, "/");
72860
- const normalizedPrefix = path18.normalize(prefix).replaceAll(SEP18, "/");
72925
+ const normalizedStr = path19.normalize(str).replaceAll(SEP18, "/");
72926
+ const normalizedPrefix = path19.normalize(prefix).replaceAll(SEP18, "/");
72861
72927
  if (normalizedStr === normalizedPrefix) {
72862
72928
  return "";
72863
72929
  }
@@ -73029,7 +73095,7 @@ var init_local_path_scripts = __esm(async () => {
73029
73095
  // src/commands/flow/flow.ts
73030
73096
  import { sep as SEP19 } from "node:path";
73031
73097
  import { readFile as readFile15 } from "node:fs/promises";
73032
- import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync5 } from "node:fs";
73098
+ import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync6 } from "node:fs";
73033
73099
  function normalizeOptionalString(value) {
73034
73100
  return typeof value === "string" && value.trim() === "" ? undefined : value ?? undefined;
73035
73101
  }
@@ -73071,12 +73137,12 @@ function warnAboutLocalPathScriptDivergence(divergence) {
73071
73137
  const details = [];
73072
73138
  if (divergence.changed.length > 0) {
73073
73139
  details.push(`These workspace scripts differ from the deployed version:
73074
- ${divergence.changed.map((path19) => `- ${path19}`).join(`
73140
+ ${divergence.changed.map((path20) => `- ${path20}`).join(`
73075
73141
  `)}`);
73076
73142
  }
73077
73143
  if (divergence.missing.length > 0) {
73078
73144
  details.push(`These scripts do not exist in the workspace yet:
73079
- ${divergence.missing.map((path19) => `- ${path19}`).join(`
73145
+ ${divergence.missing.map((path20) => `- ${path20}`).join(`
73080
73146
  `)}`);
73081
73147
  }
73082
73148
  warn(`Using local PathScript files for flow preview.
@@ -73101,7 +73167,7 @@ async function pushFlow(workspace, remotePath, localPath, message, permissionedA
73101
73167
  localPath += SEP19;
73102
73168
  }
73103
73169
  const localFlow = await yamlParseFile(localPath + "flow.yaml");
73104
- const fileReader = async (path19) => await readFile15(localPath + path19, "utf-8");
73170
+ const fileReader = async (path20) => await readFile15(localPath + path20, "utf-8");
73105
73171
  const missingFiles = [];
73106
73172
  await replaceInlineScripts(localFlow.value.modules, fileReader, exports_log, localPath, SEP19, undefined, missingFiles);
73107
73173
  if (localFlow.value.failure_module) {
@@ -73193,14 +73259,14 @@ async function list12(opts) {
73193
73259
  new Table2().header(["path", "summary", "edited by"]).padding(2).border(true).body(total.map((x) => [x.path, x.summary, x.edited_by])).render();
73194
73260
  }
73195
73261
  }
73196
- async function get9(opts, path19) {
73262
+ async function get9(opts, path20) {
73197
73263
  if (opts.json)
73198
73264
  setSilent(true);
73199
73265
  const workspace = await resolveWorkspace(opts);
73200
73266
  await requireLogin(opts);
73201
73267
  const f = await getFlowByPath({
73202
73268
  workspace: workspace.workspaceId,
73203
- path: path19
73269
+ path: path20
73204
73270
  });
73205
73271
  if (opts.json) {
73206
73272
  console.log(JSON.stringify(f));
@@ -73238,7 +73304,7 @@ async function get9(opts, path19) {
73238
73304
  }
73239
73305
  }
73240
73306
  }
73241
- async function run3(opts, path19) {
73307
+ async function run3(opts, path20) {
73242
73308
  if (opts.silent) {
73243
73309
  setSilent(true);
73244
73310
  }
@@ -73249,7 +73315,7 @@ async function run3(opts, path19) {
73249
73315
  try {
73250
73316
  const flow = await getFlowByPath({
73251
73317
  workspace: workspace.workspaceId,
73252
- path: path19
73318
+ path: path20
73253
73319
  });
73254
73320
  validateRequiredArgs(flow.schema);
73255
73321
  } catch (e) {
@@ -73260,7 +73326,7 @@ async function run3(opts, path19) {
73260
73326
  }
73261
73327
  const id = await runFlowByPath({
73262
73328
  workspace: workspace.workspaceId,
73263
- path: path19,
73329
+ path: path20,
73264
73330
  requestBody: input
73265
73331
  });
73266
73332
  const stepLabels = new Map;
@@ -73406,7 +73472,7 @@ async function preview2(opts, flowPath) {
73406
73472
  flowPath += SEP19;
73407
73473
  }
73408
73474
  const localFlow = await yamlParseFile(flowPath + "flow.yaml");
73409
- const fileReader = async (path19) => await readFile15(flowPath + path19, "utf-8");
73475
+ const fileReader = async (path20) => await readFile15(flowPath + path20, "utf-8");
73410
73476
  await replaceInlineScripts(localFlow.value.modules, fileReader, exports_log, flowPath, SEP19);
73411
73477
  if (localFlow.value.failure_module) {
73412
73478
  await replaceInlineScripts([localFlow.value.failure_module], fileReader, exports_log, flowPath, SEP19);
@@ -73521,7 +73587,7 @@ async function bootstrap2(opts, flowPath) {
73521
73587
  const newFlowDefinitionYaml = import_yaml36.stringify(newFlowDefinition);
73522
73588
  const metadataFile = getMetadataFileName("flow", "yaml");
73523
73589
  const flowYamlPath = `${flowDirFullPath}/${metadataFile}`;
73524
- writeFileSync5(flowYamlPath, newFlowDefinitionYaml, { flag: "wx", encoding: "utf-8" });
73590
+ writeFileSync6(flowYamlPath, newFlowDefinitionYaml, { flag: "wx", encoding: "utf-8" });
73525
73591
  }
73526
73592
  async function history2(opts, flowPath) {
73527
73593
  if (opts.json)
@@ -73754,7 +73820,7 @@ class GitSyncSettingsConverter {
73754
73820
  }
73755
73821
 
73756
73822
  // src/commands/gitsync-settings/legacySettings.ts
73757
- import process18 from "node:process";
73823
+ import process19 from "node:process";
73758
73824
  async function handleLegacyRepositoryMigration(selectedRepo, gitSyncSettings, workspace, opts, operationName = "operation") {
73759
73825
  if (selectedRepo.settings) {
73760
73826
  return selectedRepo;
@@ -73764,7 +73830,7 @@ async function handleLegacyRepositoryMigration(selectedRepo, gitSyncSettings, wo
73764
73830
  }
73765
73831
  const workspaceIncludePath = gitSyncSettings.include_path;
73766
73832
  const workspaceIncludeType = gitSyncSettings.include_type;
73767
- if (!!process18.stdout.isTTY && !opts.yes) {
73833
+ if (!!process19.stdout.isTTY && !opts.yes) {
73768
73834
  console.log(colors.yellow(`
73769
73835
  ⚠️ Legacy git-sync settings detected!`));
73770
73836
  console.log(`
@@ -73870,7 +73936,7 @@ Repository "${selectedRepo.git_repo_resource_path}" has legacy settings format.`
73870
73936
  console.error(` wmill gitsync-settings push
73871
73937
  `);
73872
73938
  }
73873
- process18.exit(1);
73939
+ process19.exit(1);
73874
73940
  }
73875
73941
  }
73876
73942
  var init_legacySettings = __esm(async () => {
@@ -73914,8 +73980,8 @@ function outputResult(opts, result) {
73914
73980
  error(colors.red(result.error));
73915
73981
  }
73916
73982
  }
73917
- function normalizeRepoPath(path19) {
73918
- return path19.replace(/^\$res:/, "");
73983
+ function normalizeRepoPath(path20) {
73984
+ return path20.replace(/^\$res:/, "");
73919
73985
  }
73920
73986
  function getOrCreateBranchConfig(config, branchName) {
73921
73987
  if (!config.workspaces) {
@@ -74326,14 +74392,14 @@ var init_pull2 = __esm(async () => {
74326
74392
  });
74327
74393
 
74328
74394
  // src/commands/gitsync-settings/push.ts
74329
- import process19 from "node:process";
74395
+ import process20 from "node:process";
74330
74396
  async function pushGitSyncSettings(opts) {
74331
74397
  try {
74332
74398
  await validateBranchConfiguration({ yes: opts.yes });
74333
74399
  } catch (error2) {
74334
74400
  if (error2 instanceof Error && error2.message.includes("overrides")) {
74335
74401
  error(error2.message);
74336
- process19.exit(1);
74402
+ process20.exit(1);
74337
74403
  }
74338
74404
  throw error2;
74339
74405
  }
@@ -74343,7 +74409,7 @@ async function pushGitSyncSettings(opts) {
74343
74409
  const wmillYamlPath = getWmillYamlPath();
74344
74410
  if (!wmillYamlPath) {
74345
74411
  error(colors.red("No wmill.yaml file found. Please run 'wmill init' first to create the configuration file."));
74346
- process19.exit(1);
74412
+ process20.exit(1);
74347
74413
  }
74348
74414
  const localConfig = await readConfigFile();
74349
74415
  let settings;
@@ -74459,7 +74525,7 @@ async function pushGitSyncSettings(opts) {
74459
74525
  displayChanges(changes);
74460
74526
  }
74461
74527
  }
74462
- if (!opts.yes && !!process19.stdin.isTTY) {
74528
+ if (!opts.yes && !!process20.stdin.isTTY) {
74463
74529
  const confirmed = await Confirm.prompt({
74464
74530
  message: `Do you want to apply these changes to the remote?`,
74465
74531
  default: true
@@ -74570,22 +74636,22 @@ var init_gitsync_settings = __esm(async () => {
74570
74636
  async function uploadScripts(tree, workspace) {
74571
74637
  const scriptHashes = {};
74572
74638
  const workspaceDeps = [];
74573
- for (const path19 of tree.allPaths()) {
74574
- const content = tree.getContent(path19);
74575
- const itemType = tree.getItemType(path19);
74639
+ for (const path20 of tree.allPaths()) {
74640
+ const content = tree.getContent(path20);
74641
+ const itemType = tree.getItemType(path20);
74576
74642
  if (itemType === "dependencies") {
74577
74643
  if (content === undefined)
74578
74644
  continue;
74579
- const info2 = workspaceDependenciesPathToLanguageAndFilename(path19);
74645
+ const info2 = workspaceDependenciesPathToLanguageAndFilename(path20);
74580
74646
  if (info2) {
74581
74647
  const hash2 = await generateHash(content);
74582
- 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 });
74583
74649
  }
74584
74650
  } else if (itemType === "script") {
74585
74651
  if (!content)
74586
74652
  continue;
74587
74653
  const hash2 = await generateHash(content);
74588
- scriptHashes[path19] = hash2;
74654
+ scriptHashes[path20] = hash2;
74589
74655
  }
74590
74656
  }
74591
74657
  if (Object.keys(scriptHashes).length === 0 && workspaceDeps.length === 0)
@@ -74597,19 +74663,19 @@ async function uploadScripts(tree, workspace) {
74597
74663
  workspace_deps: workspaceDeps
74598
74664
  }
74599
74665
  });
74600
- for (const path19 of mismatched) {
74601
- const content = tree.getContent(path19);
74602
- const itemType = tree.getItemType(path19);
74666
+ for (const path20 of mismatched) {
74667
+ const content = tree.getContent(path20);
74668
+ const itemType = tree.getItemType(path20);
74603
74669
  if (itemType === "dependencies") {
74604
74670
  if (content !== undefined) {
74605
- tree.setContentHash(path19, "mismatched");
74671
+ tree.setContentHash(path20, "mismatched");
74606
74672
  }
74607
74673
  } else if (content) {
74608
74674
  const hash2 = await storeRawScriptTemp({
74609
74675
  workspace: workspace.workspaceId,
74610
74676
  requestBody: content
74611
74677
  });
74612
- tree.setContentHash(path19, hash2);
74678
+ tree.setContentHash(path20, hash2);
74613
74679
  }
74614
74680
  }
74615
74681
  }
@@ -74620,12 +74686,12 @@ class DoubleLinkedDependencyTree {
74620
74686
  setWorkspaceDeps(deps) {
74621
74687
  this.workspaceDeps = deps;
74622
74688
  }
74623
- 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) {
74624
74690
  const hasWorkspaceDeps = itemType === "script" || itemType === "inline_script";
74625
74691
  const filteredDeps = hasWorkspaceDeps ? filterWorkspaceDependencies(this.workspaceDeps, content, language) : {};
74626
74692
  const stalenessHash = await generateScriptHash({}, content, metadata);
74627
- if (!this.nodes.has(path19)) {
74628
- this.nodes.set(path19, {
74693
+ if (!this.nodes.has(path20)) {
74694
+ this.nodes.set(path20, {
74629
74695
  content: "",
74630
74696
  stalenessHash: "",
74631
74697
  language: "deno",
@@ -74638,7 +74704,7 @@ class DoubleLinkedDependencyTree {
74638
74704
  isDirectlyStale: false
74639
74705
  });
74640
74706
  }
74641
- const node = this.nodes.get(path19);
74707
+ const node = this.nodes.get(path20);
74642
74708
  node.content = content;
74643
74709
  node.stalenessHash = stalenessHash;
74644
74710
  node.language = language;
@@ -74685,59 +74751,59 @@ class DoubleLinkedDependencyTree {
74685
74751
  isDirectlyStale: false
74686
74752
  });
74687
74753
  }
74688
- this.nodes.get(importPath).importedBy.add(path19);
74754
+ this.nodes.get(importPath).importedBy.add(path20);
74689
74755
  }
74690
74756
  }
74691
- getContent(path19) {
74692
- return this.nodes.get(path19)?.content;
74757
+ getContent(path20) {
74758
+ return this.nodes.get(path20)?.content;
74693
74759
  }
74694
- getStalenessHash(path19) {
74695
- return this.nodes.get(path19)?.stalenessHash;
74760
+ getStalenessHash(path20) {
74761
+ return this.nodes.get(path20)?.stalenessHash;
74696
74762
  }
74697
- getContentHash(path19) {
74698
- return this.nodes.get(path19)?.contentHash;
74763
+ getContentHash(path20) {
74764
+ return this.nodes.get(path20)?.contentHash;
74699
74765
  }
74700
- setContentHash(path19, hash2) {
74701
- const node = this.nodes.get(path19);
74766
+ setContentHash(path20, hash2) {
74767
+ const node = this.nodes.get(path20);
74702
74768
  if (node) {
74703
74769
  node.contentHash = hash2;
74704
74770
  }
74705
74771
  }
74706
- getLanguage(path19) {
74707
- return this.nodes.get(path19)?.language;
74772
+ getLanguage(path20) {
74773
+ return this.nodes.get(path20)?.language;
74708
74774
  }
74709
- getMetadata(path19) {
74710
- return this.nodes.get(path19)?.metadata;
74775
+ getMetadata(path20) {
74776
+ return this.nodes.get(path20)?.metadata;
74711
74777
  }
74712
- getStaleReason(path19) {
74713
- return this.nodes.get(path19)?.staleReason;
74778
+ getStaleReason(path20) {
74779
+ return this.nodes.get(path20)?.staleReason;
74714
74780
  }
74715
- getItemType(path19) {
74716
- return this.nodes.get(path19)?.itemType;
74781
+ getItemType(path20) {
74782
+ return this.nodes.get(path20)?.itemType;
74717
74783
  }
74718
- getFolder(path19) {
74719
- return this.nodes.get(path19)?.folder;
74784
+ getFolder(path20) {
74785
+ return this.nodes.get(path20)?.folder;
74720
74786
  }
74721
- getIsRawApp(path19) {
74722
- return this.nodes.get(path19)?.isRawApp;
74787
+ getIsRawApp(path20) {
74788
+ return this.nodes.get(path20)?.isRawApp;
74723
74789
  }
74724
- getIsDirectlyStale(path19) {
74725
- return this.nodes.get(path19)?.isDirectlyStale ?? false;
74790
+ getIsDirectlyStale(path20) {
74791
+ return this.nodes.get(path20)?.isDirectlyStale ?? false;
74726
74792
  }
74727
- getOriginalPath(path19) {
74728
- return this.nodes.get(path19)?.originalPath;
74793
+ getOriginalPath(path20) {
74794
+ return this.nodes.get(path20)?.originalPath;
74729
74795
  }
74730
- getImports(path19) {
74731
- return this.nodes.get(path19)?.imports;
74796
+ getImports(path20) {
74797
+ return this.nodes.get(path20)?.imports;
74732
74798
  }
74733
- isStale(path19) {
74734
- return this.nodes.get(path19)?.staleReason !== undefined;
74799
+ isStale(path20) {
74800
+ return this.nodes.get(path20)?.staleReason !== undefined;
74735
74801
  }
74736
74802
  propagateStaleness() {
74737
74803
  const directlyStale = new Set;
74738
- for (const [path19, node] of this.nodes.entries()) {
74804
+ for (const [path20, node] of this.nodes.entries()) {
74739
74805
  if (node.isDirectlyStale) {
74740
- directlyStale.add(path19);
74806
+ directlyStale.add(path20);
74741
74807
  node.staleReason = "content changed";
74742
74808
  }
74743
74809
  }
@@ -74789,20 +74855,20 @@ class DoubleLinkedDependencyTree {
74789
74855
  return this.nodes.keys();
74790
74856
  }
74791
74857
  *stalePaths() {
74792
- for (const [path19, node] of this.nodes.entries()) {
74858
+ for (const [path20, node] of this.nodes.entries()) {
74793
74859
  if (node.staleReason) {
74794
- yield path19;
74860
+ yield path20;
74795
74861
  }
74796
74862
  }
74797
74863
  }
74798
- has(path19) {
74799
- return this.nodes.has(path19);
74864
+ has(path20) {
74865
+ return this.nodes.has(path20);
74800
74866
  }
74801
74867
  getMismatchedWorkspaceDeps() {
74802
74868
  const result2 = {};
74803
- for (const [path19, node] of this.nodes.entries()) {
74869
+ for (const [path20, node] of this.nodes.entries()) {
74804
74870
  if (node.itemType === "dependencies" && node.contentHash && node.content !== undefined) {
74805
- result2[path19] = node.content;
74871
+ result2[path20] = node.content;
74806
74872
  }
74807
74873
  }
74808
74874
  return result2;
@@ -74817,11 +74883,11 @@ class DoubleLinkedDependencyTree {
74817
74883
  return result2;
74818
74884
  }
74819
74885
  async persistDepsHashes(depsPaths) {
74820
- for (const path19 of depsPaths) {
74821
- const node = this.nodes.get(path19);
74886
+ for (const path20 of depsPaths) {
74887
+ const node = this.nodes.get(path20);
74822
74888
  if (node?.itemType === "dependencies" && node.content !== undefined) {
74823
- const hash2 = await generateHash(node.content + path19);
74824
- await updateMetadataGlobalLock(path19, hash2);
74889
+ const hash2 = await generateHash(node.content + path20);
74890
+ await updateMetadataGlobalLock(path20, hash2);
74825
74891
  }
74826
74892
  }
74827
74893
  }
@@ -76270,7 +76336,7 @@ async function dev2(opts) {
76270
76336
  const flowFolderSuffix = getFolderSuffixWithSep("flow");
76271
76337
  const flowMetadataFile = getMetadataFileName("flow", "yaml");
76272
76338
  async function loadPaths(pathsToLoad) {
76273
- 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)));
76274
76340
  if (paths.length == 0) {
76275
76341
  return;
76276
76342
  }
@@ -76282,7 +76348,7 @@ async function dev2(opts) {
76282
76348
  if (typ == "flow") {
76283
76349
  const localPath = extractFolderPath(cpath, "flow");
76284
76350
  const localFlow = await yamlParseFile(localPath + "flow.yaml");
76285
- 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);
76286
76352
  const localScriptReader = createPreviewLocalScriptReader({
76287
76353
  exts,
76288
76354
  defaultTs: opts.defaultTs,
@@ -85224,8 +85290,8 @@ async function generateMetadata2(opts, folder) {
85224
85290
  info("");
85225
85291
  if (errors.length > 0) {
85226
85292
  info(`Done. Updated ${colors.bold(String(succeeded))}/${total} item(s). ${colors.red(String(errors.length) + " failed")}:`);
85227
- for (const { path: path19, error: error2 } of errors) {
85228
- error(` ${path19}: ${error2}`);
85293
+ for (const { path: path20, error: error2 } of errors) {
85294
+ error(` ${path20}: ${error2}`);
85229
85295
  }
85230
85296
  process.exitCode = 1;
85231
85297
  } else {
@@ -85379,7 +85445,7 @@ var config_default = command35;
85379
85445
 
85380
85446
  // src/main.ts
85381
85447
  await init_context();
85382
- var VERSION = "1.685.0";
85448
+ var VERSION = "1.686.0";
85383
85449
  async function checkVersionSafe(cmd) {
85384
85450
  const mainCommand = cmd.getMainCommand();
85385
85451
  const upgradeCommand = mainCommand.getCommand("upgrade");