windmill-cli 1.685.0 → 1.687.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 +673 -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.687.0",
11816
11816
  WITH_CREDENTIALS: true,
11817
11817
  interceptors: {
11818
11818
  request: new Interceptors,
@@ -12335,6 +12335,7 @@ __export(exports_services_gen, {
12335
12335
  listGoogleDriveFiles: () => listGoogleDriveFiles,
12336
12336
  listGoogleCalendars: () => listGoogleCalendars,
12337
12337
  listGlobalSettings: () => listGlobalSettings,
12338
+ listGithubRepos: () => listGithubRepos,
12338
12339
  listGitRepoFiles: () => listGitRepoFiles,
12339
12340
  listGcpTriggers: () => listGcpTriggers,
12340
12341
  listFolders: () => listFolders,
@@ -12379,6 +12380,7 @@ __export(exports_services_gen, {
12379
12380
  leaveInstance: () => leaveInstance,
12380
12381
  isValidPostgresConfiguration: () => isValidPostgresConfiguration,
12381
12382
  isSmtpConfigured: () => isSmtpConfigured,
12383
+ isPasswordLoginDisabled: () => isPasswordLoginDisabled,
12382
12384
  isOwnerOfPath: () => isOwnerOfPath,
12383
12385
  isDomainAllowed: () => isDomainAllowed,
12384
12386
  isDefaultTagsPerWorkspace: () => isDefaultTagsPerWorkspace,
@@ -12867,6 +12869,11 @@ var backendVersion = () => {
12867
12869
  method: "GET",
12868
12870
  url: "/auth/is_smtp_configured"
12869
12871
  });
12872
+ }, isPasswordLoginDisabled = () => {
12873
+ return request(OpenAPI, {
12874
+ method: "GET",
12875
+ url: "/auth/is_password_login_disabled"
12876
+ });
12870
12877
  }, requestPasswordReset = (data2) => {
12871
12878
  return request(OpenAPI, {
12872
12879
  method: "POST",
@@ -18125,6 +18132,14 @@ var backendVersion = () => {
18125
18132
  workspace: data2.workspace
18126
18133
  }
18127
18134
  });
18135
+ }, listGithubRepos = (data2) => {
18136
+ return request(OpenAPI, {
18137
+ method: "GET",
18138
+ url: "/w/{workspace}/native_triggers/github/repos",
18139
+ path: {
18140
+ workspace: data2.workspace
18141
+ }
18142
+ });
18128
18143
  }, nativeTriggerWebhook = (data2) => {
18129
18144
  return request(OpenAPI, {
18130
18145
  method: "POST",
@@ -26760,6 +26775,70 @@ var init_conf = __esm(async () => {
26760
26775
  RESERVED_WORKSPACE_KEYS = new Set(["commonSpecificItems"]);
26761
26776
  });
26762
26777
 
26778
+ // src/commands/resource-type/tsconfig.ts
26779
+ import { execSync as execSync3 } from "node:child_process";
26780
+ import { existsSync as existsSync3, writeFileSync as writeFileSync2 } from "node:fs";
26781
+ import path3 from "node:path";
26782
+ import process10 from "node:process";
26783
+ async function generateTsconfigForIde() {
26784
+ const tsconfigPath = path3.join(process10.cwd(), "tsconfig.json");
26785
+ if (existsSync3(tsconfigPath)) {
26786
+ info(colors.gray("tsconfig.json already exists, skipping"));
26787
+ return;
26788
+ }
26789
+ let defaultTs = "bun";
26790
+ try {
26791
+ const conf = await readConfigFile({ warnIfMissing: false });
26792
+ if (conf?.defaultTs === "deno") {
26793
+ defaultTs = "deno";
26794
+ }
26795
+ } catch {}
26796
+ const bunTypesAvailable = defaultTs === "bun" ? ensureBunTypesAvailable() : false;
26797
+ const tsconfig = {
26798
+ compilerOptions: {
26799
+ target: "ESNext",
26800
+ module: "ESNext",
26801
+ moduleResolution: "bundler",
26802
+ noEmit: true,
26803
+ strict: false
26804
+ },
26805
+ include: ["**/*.ts", "rt.d.ts"]
26806
+ };
26807
+ if (bunTypesAvailable) {
26808
+ tsconfig.compilerOptions.types = ["bun-types"];
26809
+ }
26810
+ writeFileSync2(tsconfigPath, JSON.stringify(tsconfig, null, 2) + `
26811
+ `);
26812
+ info(colors.green("Created tsconfig.json for IDE type support."));
26813
+ }
26814
+ function ensureBunTypesAvailable() {
26815
+ const cwd = process10.cwd();
26816
+ if (existsSync3(path3.join(cwd, "node_modules", "bun-types"))) {
26817
+ return true;
26818
+ }
26819
+ try {
26820
+ execSync3("bun --version", { stdio: "ignore" });
26821
+ } catch {
26822
+ 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.`);
26823
+ return false;
26824
+ }
26825
+ try {
26826
+ info(colors.yellow("Installing bun-types with 'bun add -d bun-types'..."));
26827
+ execSync3("bun add -d bun-types", { stdio: "inherit" });
26828
+ info(colors.green("Installed bun-types."));
26829
+ return true;
26830
+ } catch (e) {
26831
+ warn(`Failed to install bun-types automatically: ${e instanceof Error ? e.message : e}`);
26832
+ info(`Run 'bun add -d bun-types' manually and add "types": ["bun-types"] to tsconfig.json for Bun API autocompletion.`);
26833
+ return false;
26834
+ }
26835
+ }
26836
+ var init_tsconfig = __esm(async () => {
26837
+ init_colors2();
26838
+ init_log();
26839
+ await init_conf();
26840
+ });
26841
+
26763
26842
  // src/utils/resource_types.ts
26764
26843
  function compileResourceTypeToTsType(schema) {
26765
26844
  function rec(x, root = false) {
@@ -26802,10 +26881,10 @@ __export(exports_resource_type, {
26802
26881
  generateRTNamespace: () => generateRTNamespace,
26803
26882
  default: () => resource_type_default
26804
26883
  });
26805
- import { writeFileSync as writeFileSync2 } from "node:fs";
26884
+ import { writeFileSync as writeFileSync3 } from "node:fs";
26806
26885
  import { stat as stat3, writeFile as writeFile2 } from "node:fs/promises";
26807
- import path3 from "node:path";
26808
- import process10 from "node:process";
26886
+ import path4 from "node:path";
26887
+ import process11 from "node:process";
26809
26888
  async function pushResourceType(workspace, remotePath, resource, localResource) {
26810
26889
  remotePath = removeType(remotePath, "resource-type");
26811
26890
  try {
@@ -26890,12 +26969,12 @@ async function newResourceType(opts, name) {
26890
26969
  });
26891
26970
  info(colors.green(`Created ${filePath}`));
26892
26971
  }
26893
- async function get(opts, path4) {
26972
+ async function get(opts, path5) {
26894
26973
  const workspace = await resolveWorkspace(opts);
26895
26974
  await requireLogin(opts);
26896
26975
  const rt = await getResourceType({
26897
26976
  workspace: workspace.workspaceId,
26898
- path: path4
26977
+ path: path5
26899
26978
  });
26900
26979
  if (opts.json) {
26901
26980
  console.log(JSON.stringify(rt));
@@ -26925,8 +27004,9 @@ async function generateRTNamespace(opts) {
26925
27004
  `);
26926
27005
  namespaceContent += `
26927
27006
  }`;
26928
- writeFileSync2(path3.join(process10.cwd(), "rt.d.ts"), namespaceContent);
27007
+ writeFileSync3(path4.join(process11.cwd(), "rt.d.ts"), namespaceContent);
26929
27008
  info(colors.green("Created rt.d.ts with resource types namespace (RT) for TypeScript."));
27009
+ await generateTsconfigForIde();
26930
27010
  }
26931
27011
  var import_yaml5, command, resource_type_default;
26932
27012
  var init_resource_type = __esm(async () => {
@@ -26939,6 +27019,7 @@ var init_resource_type = __esm(async () => {
26939
27019
  init_types(),
26940
27020
  init_auth(),
26941
27021
  init_context(),
27022
+ init_tsconfig(),
26942
27023
  init_utils()
26943
27024
  ]);
26944
27025
  import_yaml5 = __toESM(require_dist(), 1);
@@ -26961,7 +27042,7 @@ __export(exports_workspace, {
26961
27042
  add: () => add
26962
27043
  });
26963
27044
  import { readFile as readFile3, writeFile as writeFile3, open as fsOpen } from "node:fs/promises";
26964
- import process11 from "node:process";
27045
+ import process12 from "node:process";
26965
27046
  async function allWorkspaces(configDirOverride) {
26966
27047
  try {
26967
27048
  const file = await getWorkspaceConfigFilePath(configDirOverride);
@@ -27073,7 +27154,7 @@ async function add(opts, workspaceName, workspaceId, remote) {
27073
27154
  }
27074
27155
  remote = new URL(remote).toString();
27075
27156
  let token = await tryGetLoginInfo(opts);
27076
- if (!token && !(process11.stdin.isTTY ?? false)) {
27157
+ if (!token && !(process12.stdin.isTTY ?? false)) {
27077
27158
  info("Not a TTY, can't login interactively. Pass the token in --token");
27078
27159
  return;
27079
27160
  }
@@ -27115,7 +27196,7 @@ async function add(opts, workspaceName, workspaceId, remote) {
27115
27196
  info(`- ${workspace.id} (name: ${workspace.name})`);
27116
27197
  }
27117
27198
  }
27118
- process11.exit(1);
27199
+ process12.exit(1);
27119
27200
  }
27120
27201
  const added = await addWorkspace({
27121
27202
  name: workspaceName,
@@ -27132,7 +27213,7 @@ async function add(opts, workspaceName, workspaceId, remote) {
27132
27213
  async function addWorkspace(workspace, opts) {
27133
27214
  workspace.remote = new URL(workspace.remote).toString();
27134
27215
  const existingWorkspaces = await allWorkspaces(opts.configDir);
27135
- const isInteractive = (process11.stdin.isTTY ?? false) && (process11.stdout.isTTY ?? false) && !opts.force;
27216
+ const isInteractive = (process12.stdin.isTTY ?? false) && (process12.stdout.isTTY ?? false) && !opts.force;
27136
27217
  const nameConflict = existingWorkspaces.find((w) => w.name === workspace.name);
27137
27218
  if (nameConflict) {
27138
27219
  if (nameConflict.remote === workspace.remote && nameConflict.workspaceId === workspace.workspaceId) {
@@ -27285,7 +27366,7 @@ async function bind(opts, doBind) {
27285
27366
  if (!config.workspaces) {
27286
27367
  config.workspaces = {};
27287
27368
  }
27288
- const isInteractive = !!process11.stdin.isTTY;
27369
+ const isInteractive = !!process12.stdin.isTTY;
27289
27370
  const inGitRepo = isGitRepository2();
27290
27371
  const currentBranch = inGitRepo ? getCurrentGitBranch2() : null;
27291
27372
  if (doBind) {
@@ -27472,16 +27553,16 @@ async function getBranchProfilesPath(configDirOverride) {
27472
27553
  }
27473
27554
  async function loadBranchProfiles(configDirOverride) {
27474
27555
  try {
27475
- const path4 = await getBranchProfilesPath(configDirOverride);
27476
- const content = await readFile4(path4, "utf-8");
27556
+ const path5 = await getBranchProfilesPath(configDirOverride);
27557
+ const content = await readFile4(path5, "utf-8");
27477
27558
  return JSON.parse(content);
27478
27559
  } catch {
27479
27560
  return { lastUsed: {} };
27480
27561
  }
27481
27562
  }
27482
27563
  async function saveBranchProfiles(mapping, configDirOverride) {
27483
- const path4 = await getBranchProfilesPath(configDirOverride);
27484
- await writeFile4(path4, JSON.stringify(mapping, null, 2), "utf-8");
27564
+ const path5 = await getBranchProfilesPath(configDirOverride);
27565
+ await writeFile4(path5, JSON.stringify(mapping, null, 2), "utf-8");
27485
27566
  }
27486
27567
  function getBranchProfileKey(branch, baseUrl2, workspaceId) {
27487
27568
  let normalizedUrl;
@@ -27914,8 +27995,8 @@ async function tryResolveVersion(opts) {
27914
27995
  return;
27915
27996
  }
27916
27997
  }
27917
- function validatePath(path4) {
27918
- if (!(path4.startsWith("g") || path4.startsWith("u") || path4.startsWith("f"))) {
27998
+ function validatePath(path5) {
27999
+ if (!(path5.startsWith("g") || path5.startsWith("u") || path5.startsWith("f"))) {
27919
28000
  info(colors.red("Given remote path looks invalid. Remote paths are typically of the form <u|g|f>/<username|group|folder>/..."));
27920
28001
  return false;
27921
28002
  }
@@ -32741,11 +32822,11 @@ var init_wrapper = __esm(() => {
32741
32822
 
32742
32823
  // src/commands/app/bundle.ts
32743
32824
  import * as fs7 from "node:fs";
32744
- import * as path4 from "node:path";
32745
- import process12 from "node:process";
32825
+ import * as path5 from "node:path";
32826
+ import process13 from "node:process";
32746
32827
  import { spawn } from "node:child_process";
32747
32828
  function detectFrameworks(appDir) {
32748
- const packageJsonPath = path4.join(appDir, "package.json");
32829
+ const packageJsonPath = path5.join(appDir, "package.json");
32749
32830
  if (!fs7.existsSync(packageJsonPath)) {
32750
32831
  return { svelte: false, vue: false };
32751
32832
  }
@@ -32770,7 +32851,7 @@ function createSveltePlugin(appDir) {
32770
32851
  build.onLoad({ filter: /\.svelte$/ }, async (args) => {
32771
32852
  const svelte = await import("svelte/compiler");
32772
32853
  const source = await fs7.promises.readFile(args.path, "utf8");
32773
- const filename = path4.relative(process12.cwd(), args.path);
32854
+ const filename = path5.relative(process13.cwd(), args.path);
32774
32855
  const convertMessage = ({ message, start, end }) => {
32775
32856
  let location;
32776
32857
  if (start && end) {
@@ -32811,8 +32892,8 @@ async function createFrameworkPlugins(appDir) {
32811
32892
  return plugins;
32812
32893
  }
32813
32894
  async function ensureNodeModules(appDir) {
32814
- const targetDir = appDir ?? process12.cwd();
32815
- const nodeModulesPath = path4.join(targetDir, "node_modules");
32895
+ const targetDir = appDir ?? process13.cwd();
32896
+ const nodeModulesPath = path5.join(targetDir, "node_modules");
32816
32897
  if (!fs7.existsSync(nodeModulesPath)) {
32817
32898
  info(colors.yellow("\uD83D\uDCE6 node_modules not found, running npm install..."));
32818
32899
  const code2 = await new Promise((resolve6, reject) => {
@@ -32832,7 +32913,7 @@ async function ensureNodeModules(appDir) {
32832
32913
  }
32833
32914
  async function createBundle(options = {}) {
32834
32915
  const esbuild = await import("esbuild");
32835
- const appDir = options.entryPoint ? path4.dirname(options.entryPoint) : process12.cwd();
32916
+ const appDir = options.entryPoint ? path5.dirname(options.entryPoint) : process13.cwd();
32836
32917
  const frameworks = detectFrameworks(appDir);
32837
32918
  const defaultEntry = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
32838
32919
  const entryPoint = options.entryPoint ?? defaultEntry;
@@ -32845,11 +32926,11 @@ async function createBundle(options = {}) {
32845
32926
  }
32846
32927
  await ensureNodeModules(appDir);
32847
32928
  const frameworkPlugins = await createFrameworkPlugins(appDir);
32848
- const distDir = path4.join(process12.cwd(), outDir);
32929
+ const distDir = path5.join(process13.cwd(), outDir);
32849
32930
  if (!fs7.existsSync(distDir)) {
32850
32931
  fs7.mkdirSync(distDir, { recursive: true });
32851
32932
  }
32852
- const outfile = path4.join(outDir, "bundle.js");
32933
+ const outfile = path5.join(outDir, "bundle.js");
32853
32934
  const wmillTs = rawAppWmillTs_exports.default ?? rawAppWmillTs_exports;
32854
32935
  const wmillPlugin = {
32855
32936
  name: "wmill-virtual",
@@ -32892,8 +32973,8 @@ async function createBundle(options = {}) {
32892
32973
  throw new Error("Build failed with errors");
32893
32974
  }
32894
32975
  info(colors.green("✅ Bundle created successfully"));
32895
- const jsPath = path4.join(process12.cwd(), outfile);
32896
- const cssPath = path4.join(process12.cwd(), outDir, "bundle.css");
32976
+ const jsPath = path5.join(process13.cwd(), outfile);
32977
+ const cssPath = path5.join(process13.cwd(), outDir, "bundle.css");
32897
32978
  if (!fs7.existsSync(jsPath)) {
32898
32979
  throw new Error(`Expected JS bundle at ${jsPath} but file not found`);
32899
32980
  }
@@ -34614,7 +34695,7 @@ var minimatch = (p, pattern, options = {}) => {
34614
34695
  }, qmarksTestNoExtDot = ([$0]) => {
34615
34696
  const len = $0.length;
34616
34697
  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) => {
34698
+ }, 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
34699
  if (!def || typeof def !== "object" || !Object.keys(def).length) {
34619
34700
  return minimatch;
34620
34701
  }
@@ -34672,11 +34753,11 @@ var init_esm2 = __esm(() => {
34672
34753
  starRE = /^\*+$/;
34673
34754
  qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
34674
34755
  defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
34675
- path5 = {
34756
+ path6 = {
34676
34757
  win32: { sep: "\\" },
34677
34758
  posix: { sep: "/" }
34678
34759
  };
34679
- sep2 = defaultPlatform === "win32" ? path5.win32.sep : path5.posix.sep;
34760
+ sep2 = defaultPlatform === "win32" ? path6.win32.sep : path6.posix.sep;
34680
34761
  minimatch.sep = sep2;
34681
34762
  GLOBSTAR = Symbol("globstar **");
34682
34763
  minimatch.GLOBSTAR = GLOBSTAR;
@@ -37405,8 +37486,8 @@ var require_utils = __commonJS((exports) => {
37405
37486
  var result = transform[inputType][outputType](input);
37406
37487
  return result;
37407
37488
  };
37408
- exports.resolve = function(path6) {
37409
- var parts = path6.split("/");
37489
+ exports.resolve = function(path7) {
37490
+ var parts = path7.split("/");
37410
37491
  var result = [];
37411
37492
  for (var index = 0;index < parts.length; index++) {
37412
37493
  var part = parts[index];
@@ -42856,18 +42937,18 @@ var require_object = __commonJS((exports, module) => {
42856
42937
  var object = new ZipObject(name, zipObjectContent, o);
42857
42938
  this.files[name] = object;
42858
42939
  };
42859
- var parentFolder = function(path6) {
42860
- if (path6.slice(-1) === "/") {
42861
- path6 = path6.substring(0, path6.length - 1);
42940
+ var parentFolder = function(path7) {
42941
+ if (path7.slice(-1) === "/") {
42942
+ path7 = path7.substring(0, path7.length - 1);
42862
42943
  }
42863
- var lastSlash = path6.lastIndexOf("/");
42864
- return lastSlash > 0 ? path6.substring(0, lastSlash) : "";
42944
+ var lastSlash = path7.lastIndexOf("/");
42945
+ return lastSlash > 0 ? path7.substring(0, lastSlash) : "";
42865
42946
  };
42866
- var forceTrailingSlash = function(path6) {
42867
- if (path6.slice(-1) !== "/") {
42868
- path6 += "/";
42947
+ var forceTrailingSlash = function(path7) {
42948
+ if (path7.slice(-1) !== "/") {
42949
+ path7 += "/";
42869
42950
  }
42870
- return path6;
42951
+ return path7;
42871
42952
  };
42872
42953
  var folderAdd = function(name, createFolders) {
42873
42954
  createFolders = typeof createFolders !== "undefined" ? createFolders : defaults2.createFolders;
@@ -49369,8 +49450,8 @@ var require_utils2 = __commonJS((exports, module) => {
49369
49450
  }
49370
49451
  return ind;
49371
49452
  }
49372
- function removeDotSegments(path6) {
49373
- let input = path6;
49453
+ function removeDotSegments(path7) {
49454
+ let input = path7;
49374
49455
  const output = [];
49375
49456
  let nextSlash = -1;
49376
49457
  let len = 0;
@@ -49560,8 +49641,8 @@ var require_schemes = __commonJS((exports, module) => {
49560
49641
  wsComponent.secure = undefined;
49561
49642
  }
49562
49643
  if (wsComponent.resourceName) {
49563
- const [path6, query] = wsComponent.resourceName.split("?");
49564
- wsComponent.path = path6 && path6 !== "/" ? path6 : undefined;
49644
+ const [path7, query] = wsComponent.resourceName.split("?");
49645
+ wsComponent.path = path7 && path7 !== "/" ? path7 : undefined;
49565
49646
  wsComponent.query = query;
49566
49647
  wsComponent.resourceName = undefined;
49567
49648
  }
@@ -52994,13 +53075,13 @@ var require_tslib = __commonJS((exports, module) => {
52994
53075
  }
52995
53076
  return next();
52996
53077
  };
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) {
53078
+ __rewriteRelativeImportExtension = function(path7, preserveJsx) {
53079
+ if (typeof path7 === "string" && /^\.\.?\//.test(path7)) {
53080
+ return path7.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext2, cm) {
53000
53081
  return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext2 || !cm) ? m : d + ext2 + "." + cm.toLowerCase() + "js";
53001
53082
  });
53002
53083
  }
53003
- return path6;
53084
+ return path7;
53004
53085
  };
53005
53086
  exporter("__extends", __extends2);
53006
53087
  exporter("__assign", __assign2);
@@ -56304,19 +56385,19 @@ var require_buildJsonPath = __commonJS((exports) => {
56304
56385
  var types_1 = require_types2();
56305
56386
  var utils_1 = require_utils3();
56306
56387
  function buildJsonPath(node) {
56307
- const path6 = [];
56388
+ const path7 = [];
56308
56389
  let prevNode = node;
56309
56390
  while (node) {
56310
56391
  switch (node.kind) {
56311
56392
  case types_1.Kind.SCALAR:
56312
- path6.unshift(node.value);
56393
+ path7.unshift(node.value);
56313
56394
  break;
56314
56395
  case types_1.Kind.MAPPING:
56315
56396
  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;
56397
+ if (path7.length > 0 && utils_1.isObject(node.value) && node.value.value === path7[0]) {
56398
+ path7[0] = node.key.value;
56318
56399
  } else {
56319
- path6.unshift(node.key.value);
56400
+ path7.unshift(node.key.value);
56320
56401
  }
56321
56402
  }
56322
56403
  break;
@@ -56324,9 +56405,9 @@ var require_buildJsonPath = __commonJS((exports) => {
56324
56405
  if (prevNode) {
56325
56406
  const index = node.items.indexOf(prevNode);
56326
56407
  if (prevNode.kind === types_1.Kind.SCALAR) {
56327
- path6[0] = index;
56408
+ path7[0] = index;
56328
56409
  } else if (index !== -1) {
56329
- path6.unshift(index);
56410
+ path7.unshift(index);
56330
56411
  }
56331
56412
  }
56332
56413
  break;
@@ -56334,7 +56415,7 @@ var require_buildJsonPath = __commonJS((exports) => {
56334
56415
  prevNode = node;
56335
56416
  node = node.parent;
56336
56417
  }
56337
- return path6;
56418
+ return path7;
56338
56419
  }
56339
56420
  exports.buildJsonPath = buildJsonPath;
56340
56421
  });
@@ -56393,10 +56474,10 @@ var require_getJsonPathForPosition = __commonJS((exports) => {
56393
56474
  const node = findClosestScalar(ast, Math.min(lineMap[line] - 1, startOffset + character), line, lineMap);
56394
56475
  if (!utils_1.isObject(node))
56395
56476
  return;
56396
- const path6 = buildJsonPath_1.buildJsonPath(node);
56397
- if (path6.length === 0)
56477
+ const path7 = buildJsonPath_1.buildJsonPath(node);
56478
+ if (path7.length === 0)
56398
56479
  return;
56399
- return path6;
56480
+ return path7;
56400
56481
  };
56401
56482
  function* walk(node) {
56402
56483
  switch (node.kind) {
@@ -56517,8 +56598,8 @@ var require_getLocationForJsonPath = __commonJS((exports) => {
56517
56598
  var lineForPosition_1 = require_lineForPosition();
56518
56599
  var types_1 = require_types2();
56519
56600
  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 });
56601
+ exports.getLocationForJsonPath = ({ ast, lineMap, metadata }, path7, closest = false) => {
56602
+ const node = findNodeAtPath(ast, path7, { closest, mergeKeys: metadata !== undefined && metadata.mergeKeys === true });
56522
56603
  if (node === undefined)
56523
56604
  return;
56524
56605
  return getLoc(lineMap, {
@@ -56569,9 +56650,9 @@ var require_getLocationForJsonPath = __commonJS((exports) => {
56569
56650
  }
56570
56651
  return node.endPosition;
56571
56652
  }
56572
- function findNodeAtPath(node, path6, { closest, mergeKeys }) {
56653
+ function findNodeAtPath(node, path7, { closest, mergeKeys }) {
56573
56654
  pathLoop:
56574
- for (const segment of path6) {
56655
+ for (const segment of path7) {
56575
56656
  if (!utils_1.isObject(node)) {
56576
56657
  return closest ? node : undefined;
56577
56658
  }
@@ -60511,14 +60592,14 @@ var require_yaml_validator = __commonJS((exports) => {
60511
60592
  email: email_json_1.default
60512
60593
  };
60513
60594
  function getValidationTargetFromFilename(filePath) {
60514
- const path6 = filePath.toLowerCase();
60515
- if (/[/\\]flow\.ya?ml$/.test(path6) || /^flow\.ya?ml$/.test(path6)) {
60595
+ const path7 = filePath.toLowerCase();
60596
+ if (/[/\\]flow\.ya?ml$/.test(path7) || /^flow\.ya?ml$/.test(path7)) {
60516
60597
  return { type: "flow" };
60517
60598
  }
60518
- if (/\.schedule\.ya?ml$/.test(path6)) {
60599
+ if (/\.schedule\.ya?ml$/.test(path7)) {
60519
60600
  return { type: "schedule" };
60520
60601
  }
60521
- const triggerMatch = path6.match(/\.(http|websocket|kafka|nats|postgres|mqtt|sqs|gcp|email)_trigger\.ya?ml$/);
60602
+ const triggerMatch = path7.match(/\.(http|websocket|kafka|nats|postgres|mqtt|sqs|gcp|email)_trigger\.ya?ml$/);
60522
60603
  if (triggerMatch) {
60523
60604
  return {
60524
60605
  type: "trigger",
@@ -60637,19 +60718,19 @@ function getWorkspaceSpecificTypes() {
60637
60718
  ...Object.fromEntries(TRIGGER_TYPES.map((t) => [`${t}_trigger`, `.${t}_trigger.yaml`]))
60638
60719
  };
60639
60720
  }
60640
- function isTriggerFile(path6) {
60641
- return TRIGGER_TYPES.some((type) => path6.endsWith(`.${type}_trigger.yaml`));
60721
+ function isTriggerFile(path7) {
60722
+ return TRIGGER_TYPES.some((type) => path7.endsWith(`.${type}_trigger.yaml`));
60642
60723
  }
60643
- function isScheduleFile(path6) {
60644
- return path6.endsWith(".schedule.yaml");
60724
+ function isScheduleFile(path7) {
60725
+ return path7.endsWith(".schedule.yaml");
60645
60726
  }
60646
- function getFileTypeSuffix(path6) {
60727
+ function getFileTypeSuffix(path7) {
60647
60728
  for (const [_, suffix] of Object.entries(getWorkspaceSpecificTypes())) {
60648
- if (path6.endsWith(suffix)) {
60729
+ if (path7.endsWith(suffix)) {
60649
60730
  return suffix;
60650
60731
  }
60651
60732
  }
60652
- const resourceFileMatch = path6.match(/(\\.resource\\.file\\..+)$/);
60733
+ const resourceFileMatch = path7.match(/(\\.resource\\.file\\..+)$/);
60653
60734
  if (resourceFileMatch) {
60654
60735
  return resourceFileMatch[1];
60655
60736
  }
@@ -60720,71 +60801,71 @@ function getSpecificItemsForCurrentBranch(config, workspaceNameOverride) {
60720
60801
  }
60721
60802
  return merged;
60722
60803
  }
60723
- function matchesPatterns(path6, patterns) {
60724
- return patterns.some((pattern) => minimatch(path6, pattern));
60804
+ function matchesPatterns(path7, patterns) {
60805
+ return patterns.some((pattern) => minimatch(path7, pattern));
60725
60806
  }
60726
- function isItemTypeConfigured(path6, specificItems) {
60807
+ function isItemTypeConfigured(path7, specificItems) {
60727
60808
  if (!specificItems) {
60728
60809
  return false;
60729
60810
  }
60730
- if (path6.endsWith(".variable.yaml")) {
60811
+ if (path7.endsWith(".variable.yaml")) {
60731
60812
  return specificItems.variables !== undefined;
60732
60813
  }
60733
- if (path6.endsWith(".resource.yaml")) {
60814
+ if (path7.endsWith(".resource.yaml")) {
60734
60815
  return specificItems.resources !== undefined;
60735
60816
  }
60736
- if (isTriggerFile(path6)) {
60817
+ if (isTriggerFile(path7)) {
60737
60818
  return specificItems.triggers !== undefined;
60738
60819
  }
60739
- if (isScheduleFile(path6)) {
60820
+ if (isScheduleFile(path7)) {
60740
60821
  return specificItems.schedules !== undefined;
60741
60822
  }
60742
- if (path6.endsWith("/folder.meta.yaml")) {
60823
+ if (path7.endsWith("/folder.meta.yaml")) {
60743
60824
  return specificItems.folders !== undefined;
60744
60825
  }
60745
- if (path6 === "settings.yaml") {
60826
+ if (path7 === "settings.yaml") {
60746
60827
  return specificItems.settings !== undefined;
60747
60828
  }
60748
- if (isFileResource(path6) || isFilesetResource(path6)) {
60829
+ if (isFileResource(path7) || isFilesetResource(path7)) {
60749
60830
  return specificItems.resources !== undefined;
60750
60831
  }
60751
60832
  return false;
60752
60833
  }
60753
- function isSpecificItem(path6, specificItems) {
60834
+ function isSpecificItem(path7, specificItems) {
60754
60835
  if (!specificItems) {
60755
60836
  return false;
60756
60837
  }
60757
- if (path6.endsWith(".variable.yaml")) {
60758
- return specificItems.variables ? matchesPatterns(path6, specificItems.variables) : false;
60838
+ if (path7.endsWith(".variable.yaml")) {
60839
+ return specificItems.variables ? matchesPatterns(path7, specificItems.variables) : false;
60759
60840
  }
60760
- if (path6.endsWith(".resource.yaml")) {
60761
- return specificItems.resources ? matchesPatterns(path6, specificItems.resources) : false;
60841
+ if (path7.endsWith(".resource.yaml")) {
60842
+ return specificItems.resources ? matchesPatterns(path7, specificItems.resources) : false;
60762
60843
  }
60763
- if (isTriggerFile(path6)) {
60764
- return specificItems.triggers ? matchesPatterns(path6, specificItems.triggers) : false;
60844
+ if (isTriggerFile(path7)) {
60845
+ return specificItems.triggers ? matchesPatterns(path7, specificItems.triggers) : false;
60765
60846
  }
60766
- if (isScheduleFile(path6)) {
60767
- return specificItems.schedules ? matchesPatterns(path6, specificItems.schedules) : false;
60847
+ if (isScheduleFile(path7)) {
60848
+ return specificItems.schedules ? matchesPatterns(path7, specificItems.schedules) : false;
60768
60849
  }
60769
- if (path6.endsWith("/folder.meta.yaml")) {
60850
+ if (path7.endsWith("/folder.meta.yaml")) {
60770
60851
  if (specificItems.folders) {
60771
- const folderPath = path6.slice(0, -"/folder.meta.yaml".length);
60852
+ const folderPath = path7.slice(0, -"/folder.meta.yaml".length);
60772
60853
  return matchesPatterns(folderPath, specificItems.folders);
60773
60854
  }
60774
60855
  return false;
60775
60856
  }
60776
- if (path6 === "settings.yaml") {
60857
+ if (path7 === "settings.yaml") {
60777
60858
  return specificItems.settings === true;
60778
60859
  }
60779
- if (isFileResource(path6)) {
60780
- const basePathMatch = path6.match(/^(.+?)\.resource\.file\./);
60860
+ if (isFileResource(path7)) {
60861
+ const basePathMatch = path7.match(/^(.+?)\.resource\.file\./);
60781
60862
  if (basePathMatch && specificItems.resources) {
60782
60863
  const basePath = basePathMatch[1] + ".resource.yaml";
60783
60864
  return matchesPatterns(basePath, specificItems.resources);
60784
60865
  }
60785
60866
  }
60786
- if (isFilesetResource(path6)) {
60787
- const basePathMatch = path6.match(/^(.+?)\.fileset[/\\]/);
60867
+ if (isFilesetResource(path7)) {
60868
+ const basePathMatch = path7.match(/^(.+?)\.fileset[/\\]/);
60788
60869
  if (basePathMatch && specificItems.resources) {
60789
60870
  const basePath = basePathMatch[1] + ".resource.yaml";
60790
60871
  return matchesPatterns(basePath, specificItems.resources);
@@ -60865,7 +60946,7 @@ function getWorkspaceSpecificPath(basePath, specificItems, workspaceNameOverride
60865
60946
  }
60866
60947
  return;
60867
60948
  }
60868
- function isCurrentWorkspaceFile(path6, workspaceNameOverride) {
60949
+ function isCurrentWorkspaceFile(path7, workspaceNameOverride) {
60869
60950
  let currentWorkspace = null;
60870
60951
  if (workspaceNameOverride) {
60871
60952
  currentWorkspace = workspaceNameOverride;
@@ -60882,11 +60963,11 @@ function isCurrentWorkspaceFile(path6, workspaceNameOverride) {
60882
60963
  pattern = new RegExp(`\\.${escapedName}\\.${buildYamlTypePattern()}\\.yaml$|` + `\\.${escapedName}\\.resource\\.file\\..+$|` + `/folder\\.${escapedName}\\.meta\\.yaml$|` + `^settings\\.${escapedName}\\.yaml$`);
60883
60964
  workspacePatternCache.set(currentWorkspace, pattern);
60884
60965
  }
60885
- return pattern.test(path6);
60966
+ return pattern.test(path7);
60886
60967
  }
60887
- function isWorkspaceSpecificFile(path6) {
60968
+ function isWorkspaceSpecificFile(path7) {
60888
60969
  const yamlTypePattern = buildYamlTypePattern();
60889
- return new RegExp(`\\.[^.]+\\.${yamlTypePattern}\\.yaml$|` + `\\.[^.]+\\.resource\\.file\\..+$|` + `/folder\\.[^.]+\\.meta\\.yaml$|` + `^settings\\.[^.]+\\.yaml$`).test(path6);
60970
+ return new RegExp(`\\.[^.]+\\.${yamlTypePattern}\\.yaml$|` + `\\.[^.]+\\.resource\\.file\\..+$|` + `/folder\\.[^.]+\\.meta\\.yaml$|` + `^settings\\.[^.]+\\.yaml$`).test(path7);
60890
60971
  }
60891
60972
  var workspacePatternCache;
60892
60973
  var init_specific_items = __esm(async () => {
@@ -60960,9 +61041,9 @@ var init_tar = __esm(() => {
60960
61041
  import { readFile as readFile5, writeFile as writeFile5, stat as stat4, mkdir as mkdir3 } from "node:fs/promises";
60961
61042
  import { Buffer as Buffer4 } from "node:buffer";
60962
61043
  import { sep as SEP4 } from "node:path";
60963
- import * as path6 from "node:path";
61044
+ import * as path7 from "node:path";
60964
61045
  import fs8 from "node:fs";
60965
- import { execSync as execSync3 } from "node:child_process";
61046
+ import { execSync as execSync4 } from "node:child_process";
60966
61047
  function isRawAppBackendPath2(filePath) {
60967
61048
  return isRawAppBackendPath(filePath);
60968
61049
  }
@@ -61009,8 +61090,8 @@ async function push2(opts, filePath) {
61009
61090
  await handleFile(filePath, workspace, [], opts.message, opts, await getRawWorkspaceDependencies(true), codebases);
61010
61091
  info(colors.bold.underline.green(`Script ${filePath} pushed`));
61011
61092
  }
61012
- async function findResourceFile(path7) {
61013
- const splitPath = path7.split(".");
61093
+ async function findResourceFile(path8) {
61094
+ const splitPath = path8.split(".");
61014
61095
  let contentBasePathJSON = splitPath[0] + "." + splitPath[1] + ".json";
61015
61096
  let contentBasePathYAML = splitPath[0] + "." + splitPath[1] + ".yaml";
61016
61097
  const currentBranch = getCurrentGitBranch();
@@ -61031,48 +61112,48 @@ async function findResourceFile(path7) {
61031
61112
  throw new Error("Found two resource files for the same resource" + validCandidates.join(", "));
61032
61113
  }
61033
61114
  if (validCandidates.length < 1) {
61034
- throw new Error(`No resource matching file resource: ${path7}.`);
61115
+ throw new Error(`No resource matching file resource: ${path8}.`);
61035
61116
  }
61036
61117
  return validCandidates[0];
61037
61118
  }
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"));
61119
+ async function handleScriptMetadata(path8, workspace, alreadySynced, message, rawWorkspaceDependencies, codebases, opts, permissionedAsContext) {
61120
+ const isFlatMeta = path8.endsWith(".script.json") || path8.endsWith(".script.yaml") || path8.endsWith(".script.lock");
61121
+ const isFolderMeta = !isFlatMeta && isScriptModulePath(path8) && (path8.endsWith("/script.yaml") || path8.endsWith("/script.json") || path8.endsWith("/script.lock"));
61041
61122
  if (isFlatMeta || isFolderMeta) {
61042
- const contentPath = await findContentFile(path7);
61123
+ const contentPath = await findContentFile(path8);
61043
61124
  return handleFile(contentPath, workspace, alreadySynced, message, opts, rawWorkspaceDependencies, codebases, permissionedAsContext);
61044
61125
  } else {
61045
61126
  return false;
61046
61127
  }
61047
61128
  }
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)) {
61129
+ async function handleFile(path8, workspace, alreadySynced, message, opts, rawWorkspaceDependencies, codebases, permissionedAsContext) {
61130
+ const moduleEntryPoint = isModuleEntryPoint(path8);
61131
+ if (!isAppInlineScriptPath2(path8) && !isFlowInlineScriptPath2(path8) && !isRawAppBackendPath2(path8) && (!isScriptModulePath(path8) || moduleEntryPoint) && exts.some((exts) => path8.endsWith(exts))) {
61132
+ if (alreadySynced.includes(path8)) {
61052
61133
  return true;
61053
61134
  }
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;
61135
+ debug(`Processing local script ${path8}`);
61136
+ alreadySynced.push(path8);
61137
+ const remotePath = moduleEntryPoint ? getScriptBasePathFromModulePath(path8).replaceAll(SEP4, "/") : path8.substring(0, path8.indexOf(".")).replaceAll(SEP4, "/");
61138
+ const language = inferContentTypeFromFilePath(path8, opts?.defaultTs);
61139
+ const codebase = language == "bun" ? findCodebase(path8, codebases) : undefined;
61059
61140
  let bundleContent = undefined;
61060
61141
  let forceTar = false;
61061
61142
  if (codebase) {
61062
61143
  let outputFiles = [];
61063
61144
  if (codebase.customBundler) {
61064
- info(`Using custom bundler ${codebase.customBundler} for ${path7}`);
61065
- bundleContent = execSync3(codebase.customBundler + " " + path7, {
61145
+ info(`Using custom bundler ${codebase.customBundler} for ${path8}`);
61146
+ bundleContent = execSync4(codebase.customBundler + " " + path8, {
61066
61147
  maxBuffer: 1024 * 1024 * 50
61067
61148
  }).toString();
61068
- info("Custom bundler executed for " + path7);
61149
+ info("Custom bundler executed for " + path8);
61069
61150
  } else {
61070
61151
  const esbuild = await import("esbuild");
61071
- info(`Started bundling ${path7} ...`);
61152
+ info(`Started bundling ${path8} ...`);
61072
61153
  const startTime = performance.now();
61073
61154
  const format6 = codebase.format ?? "cjs";
61074
61155
  const out = await esbuild.build({
61075
- entryPoints: [path7],
61156
+ entryPoints: [path8],
61076
61157
  format: format6,
61077
61158
  bundle: true,
61078
61159
  write: false,
@@ -61090,15 +61171,15 @@ async function handleFile(path7, workspace, alreadySynced, message, opts, rawWor
61090
61171
  bundleContent = out.outputFiles[0].text;
61091
61172
  outputFiles = out.outputFiles ?? [];
61092
61173
  if (outputFiles.length == 0) {
61093
- throw new Error(`No output files found for ${path7}`);
61174
+ throw new Error(`No output files found for ${path8}`);
61094
61175
  }
61095
- info(`Finished bundling ${path7}: ${(bundleContent.length / 1024).toFixed(0)}kB (${(endTime - startTime).toFixed(0)}ms)`);
61176
+ info(`Finished bundling ${path8}: ${(bundleContent.length / 1024).toFixed(0)}kB (${(endTime - startTime).toFixed(0)}ms)`);
61096
61177
  }
61097
61178
  if (outputFiles.length > 1) {
61098
- info(`Found multiple output files for ${path7}, creating a tarball... ${outputFiles.map((file) => file.path).join(", ")}`);
61179
+ info(`Found multiple output files for ${path8}, creating a tarball... ${outputFiles.map((file) => file.path).join(", ")}`);
61099
61180
  forceTar = true;
61100
61181
  const startTime = performance.now();
61101
- const mainPath = path7.split(SEP4).pop()?.split(".")[0] + ".js";
61182
+ const mainPath = path8.split(SEP4).pop()?.split(".")[0] + ".js";
61102
61183
  const mainContent = outputFiles.find((file) => file.path == "/" + mainPath)?.text ?? "";
61103
61184
  info(`Main content: ${mainContent.length}chars`);
61104
61185
  const entries = [
@@ -61113,10 +61194,10 @@ async function handleFile(path7, workspace, alreadySynced, message, opts, rawWor
61113
61194
  }
61114
61195
  bundleContent = await createTarBlob(entries);
61115
61196
  const endTime = performance.now();
61116
- info(`Finished creating tarball for ${path7}: ${(bundleContent.size / 1024).toFixed(0)}kB (${(endTime - startTime).toFixed(0)}ms)`);
61197
+ info(`Finished creating tarball for ${path8}: ${(bundleContent.size / 1024).toFixed(0)}kB (${(endTime - startTime).toFixed(0)}ms)`);
61117
61198
  } else {
61118
61199
  if (Array.isArray(codebase.assets) && codebase.assets.length > 0) {
61119
- info(`Using the following asset configuration for ${path7}: ${JSON.stringify(codebase.assets)}`);
61200
+ info(`Using the following asset configuration for ${path8}: ${JSON.stringify(codebase.assets)}`);
61120
61201
  const startTime = performance.now();
61121
61202
  const entries = [
61122
61203
  { name: "main.js", content: bundleContent }
@@ -61127,13 +61208,13 @@ async function handleFile(path7, workspace, alreadySynced, message, opts, rawWor
61127
61208
  }
61128
61209
  bundleContent = await createTarBlob(entries);
61129
61210
  const endTime = performance.now();
61130
- info(`Finished creating tarball for ${path7}: ${(bundleContent.size / 1024).toFixed(0)}kB (${(endTime - startTime).toFixed(0)}ms)`);
61211
+ info(`Finished creating tarball for ${path8}: ${(bundleContent.size / 1024).toFixed(0)}kB (${(endTime - startTime).toFixed(0)}ms)`);
61131
61212
  }
61132
61213
  }
61133
61214
  }
61134
61215
  let typed = opts?.skipScriptsMetadata ? undefined : (await parseMetadataFile(remotePath, opts ? {
61135
61216
  ...opts,
61136
- path: path7,
61217
+ path: path8,
61137
61218
  workspaceRemote: workspace,
61138
61219
  schemaOnly: codebase ? true : undefined,
61139
61220
  rawWorkspaceDependencies,
@@ -61150,14 +61231,14 @@ async function handleFile(path7, workspace, alreadySynced, message, opts, rawWor
61150
61231
  } catch {
61151
61232
  debug(`Script ${remotePath} does not exist on remote`);
61152
61233
  }
61153
- const content = await readFile5(path7, "utf-8");
61234
+ const content = await readFile5(path8, "utf-8");
61154
61235
  if (opts?.skipScriptsMetadata) {
61155
61236
  typed = structuredClone(remote);
61156
61237
  }
61157
61238
  if (typed && codebase) {
61158
61239
  typed.codebase = await codebase.getDigest(forceTar);
61159
61240
  }
61160
- const scriptBasePath = moduleEntryPoint ? getScriptBasePathFromModulePath(path7) : path7.substring(0, path7.indexOf("."));
61241
+ const scriptBasePath = moduleEntryPoint ? getScriptBasePathFromModulePath(path8) : path8.substring(0, path8.indexOf("."));
61161
61242
  const moduleFolderPath = scriptBasePath + getModuleFolderSuffix();
61162
61243
  const modules = await readModulesFromDisk(moduleFolderPath, opts?.defaultTs, moduleEntryPoint);
61163
61244
  const requestBodyCommon = {
@@ -61241,7 +61322,7 @@ async function readModulesFromDisk(moduleFolderPath, defaultTs, folderLayout = f
61241
61322
  function readDir2(dirPath, relPrefix) {
61242
61323
  const entries = fs8.readdirSync(dirPath, { withFileTypes: true });
61243
61324
  for (const entry of entries) {
61244
- const fullPath = path6.join(dirPath, entry.name);
61325
+ const fullPath = path7.join(dirPath, entry.name);
61245
61326
  const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
61246
61327
  const isTopLevel = relPrefix === "";
61247
61328
  if (entry.isDirectory()) {
@@ -61251,7 +61332,7 @@ async function readModulesFromDisk(moduleFolderPath, defaultTs, folderLayout = f
61251
61332
  const content = fs8.readFileSync(fullPath, "utf-8");
61252
61333
  const language = inferContentTypeFromFilePath(entry.name, defaultTs);
61253
61334
  const baseName = entry.name.replace(/\.[^.]+$/, "");
61254
- const lockPath = path6.join(dirPath, baseName + ".lock");
61335
+ const lockPath = path7.join(dirPath, baseName + ".lock");
61255
61336
  let lock;
61256
61337
  if (fs8.existsSync(lockPath)) {
61257
61338
  lock = fs8.readFileSync(lockPath, "utf-8");
@@ -61376,13 +61457,13 @@ function filePathExtensionFromContentType(language, defaultTs) {
61376
61457
  throw new Error("Invalid language: " + language);
61377
61458
  }
61378
61459
  }
61379
- function removeExtensionToPath(path7) {
61460
+ function removeExtensionToPath(path8) {
61380
61461
  for (const ext2 of exts) {
61381
- if (path7.endsWith(ext2)) {
61382
- return path7.substring(0, path7.length - ext2.length);
61462
+ if (path8.endsWith(ext2)) {
61463
+ return path8.substring(0, path8.length - ext2.length);
61383
61464
  }
61384
61465
  }
61385
- throw new Error("Invalid extension: " + path7);
61466
+ throw new Error("Invalid extension: " + path8);
61386
61467
  }
61387
61468
  async function list4(opts) {
61388
61469
  if (opts.json)
@@ -61433,7 +61514,7 @@ async function resolve6(input) {
61433
61514
  throw e;
61434
61515
  }
61435
61516
  }
61436
- async function run2(opts, path7) {
61517
+ async function run2(opts, path8) {
61437
61518
  if (opts.silent) {
61438
61519
  setSilent(true);
61439
61520
  }
@@ -61444,7 +61525,7 @@ async function run2(opts, path7) {
61444
61525
  try {
61445
61526
  const script = await getScriptByPath({
61446
61527
  workspace: workspace.workspaceId,
61447
- path: path7
61528
+ path: path8
61448
61529
  });
61449
61530
  validateRequiredArgs(script.schema);
61450
61531
  } catch (e) {
@@ -61457,7 +61538,7 @@ async function run2(opts, path7) {
61457
61538
  try {
61458
61539
  id = await runScriptByPath({
61459
61540
  workspace: workspace.workspaceId,
61460
- path: path7,
61541
+ path: path8,
61461
61542
  requestBody: input
61462
61543
  });
61463
61544
  } catch (e) {
@@ -61465,10 +61546,10 @@ async function run2(opts, path7) {
61465
61546
  try {
61466
61547
  const script = await getScriptByPath({
61467
61548
  workspace: workspace.workspaceId,
61468
- path: path7
61549
+ path: path8
61469
61550
  });
61470
61551
  if (script.lock_error_logs) {
61471
- throw new Error(`Script '${path7}' has a deployment error and cannot be run:
61552
+ throw new Error(`Script '${path8}' has a deployment error and cannot be run:
61472
61553
  ${script.lock_error_logs}`);
61473
61554
  }
61474
61555
  } catch (lookupErr) {
@@ -61477,7 +61558,7 @@ ${script.lock_error_logs}`);
61477
61558
  if (lookupErr?.status && lookupErr.status !== 404)
61478
61559
  throw lookupErr;
61479
61560
  }
61480
- throw new Error(`Script '${path7}' not found. Run 'wmill script list' to see available scripts.`);
61561
+ throw new Error(`Script '${path8}' not found. Run 'wmill script list' to see available scripts.`);
61481
61562
  }
61482
61563
  throw e;
61483
61564
  }
@@ -61593,12 +61674,12 @@ async function pollForJobResult(workspace, jobId) {
61593
61674
  await new Promise((resolve7) => setTimeout(resolve7, POLL_INTERVAL_MS));
61594
61675
  }
61595
61676
  }
61596
- async function show(opts, path7) {
61677
+ async function show(opts, path8) {
61597
61678
  const workspace = await resolveWorkspace(opts);
61598
61679
  await requireLogin(opts);
61599
61680
  const s = await getScriptByPath({
61600
61681
  workspace: workspace.workspaceId,
61601
- path: path7
61682
+ path: path8
61602
61683
  });
61603
61684
  info(colors.underline(s.path));
61604
61685
  if (s.description)
@@ -61606,14 +61687,14 @@ async function show(opts, path7) {
61606
61687
  info("");
61607
61688
  info(s.content);
61608
61689
  }
61609
- async function get2(opts, path7) {
61690
+ async function get2(opts, path8) {
61610
61691
  if (opts.json)
61611
61692
  setSilent(true);
61612
61693
  const workspace = await resolveWorkspace(opts);
61613
61694
  await requireLogin(opts);
61614
61695
  const s = await getScriptByPath({
61615
61696
  workspace: workspace.workspaceId,
61616
- path: path7
61697
+ path: path8
61617
61698
  });
61618
61699
  if (opts.json) {
61619
61700
  console.log(JSON.stringify(s));
@@ -61663,7 +61744,7 @@ async function bootstrap(opts, scriptPath, language) {
61663
61744
  scriptMetadata.description = opts.description;
61664
61745
  }
61665
61746
  const scriptInitialMetadataYaml = import_yaml6.stringify(scriptMetadata, yamlOptions);
61666
- const parentDir = path6.dirname(scriptCodeFileFullPath);
61747
+ const parentDir = path7.dirname(scriptCodeFileFullPath);
61667
61748
  await mkdir3(parentDir, { recursive: true });
61668
61749
  await writeFile5(scriptCodeFileFullPath, scriptInitialCode, {
61669
61750
  flag: "wx",
@@ -61746,7 +61827,7 @@ async function preview(opts, filePath) {
61746
61827
  const content = await readFile5(filePath, "utf-8");
61747
61828
  const input = opts.data ? await resolve6(opts.data) : {};
61748
61829
  const isFolderLayout = isModuleEntryPoint(filePath);
61749
- const moduleFolderPath = isFolderLayout ? path6.dirname(filePath) : filePath.substring(0, filePath.indexOf(".")) + getModuleFolderSuffix();
61830
+ const moduleFolderPath = isFolderLayout ? path7.dirname(filePath) : filePath.substring(0, filePath.indexOf(".")) + getModuleFolderSuffix();
61750
61831
  const modules = await readModulesFromDisk(moduleFolderPath, opts?.defaultTs, isFolderLayout);
61751
61832
  const codebase = language == "bun" ? findCodebase(filePath, codebases) : undefined;
61752
61833
  let bundledContent = undefined;
@@ -61756,7 +61837,7 @@ async function preview(opts, filePath) {
61756
61837
  if (!opts.silent) {
61757
61838
  info(`Using custom bundler ${codebase.customBundler} for preview`);
61758
61839
  }
61759
- bundledContent = execSync3(codebase.customBundler + " " + filePath, {
61840
+ bundledContent = execSync4(codebase.customBundler + " " + filePath, {
61760
61841
  maxBuffer: 52428800
61761
61842
  }).toString();
61762
61843
  } else {
@@ -62004,8 +62085,8 @@ var init_script = __esm(async () => {
62004
62085
 
62005
62086
  // src/commands/lint/lint.ts
62006
62087
  import { stat as stat5, readdir as readdir2 } from "node:fs/promises";
62007
- import process13 from "node:process";
62008
- import * as path7 from "node:path";
62088
+ import process14 from "node:process";
62089
+ import * as path8 from "node:path";
62009
62090
  import { sep as SEP5 } from "node:path";
62010
62091
  function normalizePath(p) {
62011
62092
  return p.replaceAll(SEP5, "/");
@@ -62064,7 +62145,7 @@ async function isLockResolved(lockValue, baseDir) {
62064
62145
  return true;
62065
62146
  }
62066
62147
  async function checkInlineFile(relativePath, baseDir) {
62067
- const fullPath = path7.join(baseDir, relativePath.trim());
62148
+ const fullPath = path8.join(baseDir, relativePath.trim());
62068
62149
  try {
62069
62150
  const s = await stat5(fullPath);
62070
62151
  return s.size > 0;
@@ -62154,7 +62235,7 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
62154
62235
  continue;
62155
62236
  const runnableId = fileName.replace(".yaml", "");
62156
62237
  processedIds.add(runnableId);
62157
- const filePath = path7.join(backendDir, fileName);
62238
+ const filePath = path8.join(backendDir, fileName);
62158
62239
  let runnable;
62159
62240
  try {
62160
62241
  runnable = await yamlParseFile(filePath);
@@ -62172,7 +62253,7 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
62172
62253
  }
62173
62254
  if (!language || !languageNeedsLock(language))
62174
62255
  continue;
62175
- const lockFile = path7.join(backendDir, `${runnableId}.lock`);
62256
+ const lockFile = path8.join(backendDir, `${runnableId}.lock`);
62176
62257
  let hasLock = false;
62177
62258
  try {
62178
62259
  const s = await stat5(lockFile);
@@ -62219,7 +62300,7 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
62219
62300
  }
62220
62301
  if (!languageNeedsLock(language))
62221
62302
  continue;
62222
- const lockFile = path7.join(backendDir, `${runnableId}.lock`);
62303
+ const lockFile = path8.join(backendDir, `${runnableId}.lock`);
62223
62304
  let hasLock = false;
62224
62305
  try {
62225
62306
  const s = await stat5(lockFile);
@@ -62238,8 +62319,8 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
62238
62319
  return issues;
62239
62320
  }
62240
62321
  async function checkMissingLocks(opts, directory) {
62241
- const initialCwd = process13.cwd();
62242
- const targetDirectory = directory ? path7.resolve(initialCwd, directory) : process13.cwd();
62322
+ const initialCwd = process14.cwd();
62323
+ const targetDirectory = directory ? path8.resolve(initialCwd, directory) : process14.cwd();
62243
62324
  const { ...syncOpts } = opts;
62244
62325
  const mergedOpts = await mergeConfigWithConfigFile(syncOpts);
62245
62326
  const ignore = await ignoreF(mergedOpts);
@@ -62263,19 +62344,19 @@ async function checkMissingLocks(opts, directory) {
62263
62344
  if (normalizedPath.endsWith("/flow.yaml") && normalizedPath.includes(flowSuffix + "/")) {
62264
62345
  flowYamls.push({
62265
62346
  normalizedPath,
62266
- fullPath: path7.join(targetDirectory, entry.path)
62347
+ fullPath: path8.join(targetDirectory, entry.path)
62267
62348
  });
62268
62349
  }
62269
62350
  if (normalizedPath.endsWith("/app.yaml") && normalizedPath.includes(appSuffix + "/")) {
62270
62351
  appYamls.push({
62271
62352
  normalizedPath,
62272
- fullPath: path7.join(targetDirectory, entry.path)
62353
+ fullPath: path8.join(targetDirectory, entry.path)
62273
62354
  });
62274
62355
  }
62275
62356
  if (normalizedPath.endsWith("/raw_app.yaml") && normalizedPath.includes(rawAppSuffix + "/")) {
62276
62357
  rawAppYamls.push({
62277
62358
  normalizedPath,
62278
- fullPath: path7.join(targetDirectory, entry.path)
62359
+ fullPath: path8.join(targetDirectory, entry.path)
62279
62360
  });
62280
62361
  }
62281
62362
  }
@@ -62284,14 +62365,14 @@ async function checkMissingLocks(opts, directory) {
62284
62365
  let language = null;
62285
62366
  for (const ext2 of exts) {
62286
62367
  try {
62287
- await stat5(path7.join(targetDirectory, basePath + ext2));
62368
+ await stat5(path8.join(targetDirectory, basePath + ext2));
62288
62369
  language = inferContentTypeFromFilePath(basePath + ext2, defaultTs);
62289
62370
  break;
62290
62371
  } catch {}
62291
62372
  }
62292
62373
  if (language && languageNeedsLock(language)) {
62293
62374
  try {
62294
- const metadata = await yamlParseFile(path7.join(targetDirectory, yamlPath));
62375
+ const metadata = await yamlParseFile(path8.join(targetDirectory, yamlPath));
62295
62376
  const lockResolved = await isLockResolved(metadata?.lock, targetDirectory);
62296
62377
  if (!lockResolved) {
62297
62378
  issues.push({
@@ -62308,7 +62389,7 @@ async function checkMissingLocks(opts, directory) {
62308
62389
  }
62309
62390
  }
62310
62391
  for (const { normalizedPath: flowYamlPath, fullPath } of flowYamls) {
62311
- const flowDir = path7.dirname(fullPath);
62392
+ const flowDir = path8.dirname(fullPath);
62312
62393
  try {
62313
62394
  const flowFile = await yamlParseFile(fullPath);
62314
62395
  if (!flowFile?.value?.modules)
@@ -62333,7 +62414,7 @@ async function checkMissingLocks(opts, directory) {
62333
62414
  }
62334
62415
  }
62335
62416
  for (const { normalizedPath: appYamlPath, fullPath } of appYamls) {
62336
- const appDir = path7.dirname(fullPath);
62417
+ const appDir = path8.dirname(fullPath);
62337
62418
  try {
62338
62419
  const appFile = await yamlParseFile(fullPath);
62339
62420
  if (!appFile?.value)
@@ -62358,8 +62439,8 @@ async function checkMissingLocks(opts, directory) {
62358
62439
  }
62359
62440
  }
62360
62441
  for (const { normalizedPath: rawAppYamlPath, fullPath } of rawAppYamls) {
62361
- const rawAppDir = path7.dirname(fullPath);
62362
- const backendDir = path7.join(rawAppDir, "backend");
62442
+ const rawAppDir = path8.dirname(fullPath);
62443
+ const backendDir = path8.join(rawAppDir, "backend");
62363
62444
  try {
62364
62445
  await stat5(backendDir);
62365
62446
  } catch {
@@ -62375,11 +62456,11 @@ async function checkMissingLocks(opts, directory) {
62375
62456
  return issues;
62376
62457
  }
62377
62458
  async function runLint(opts, directory) {
62378
- const initialCwd = process13.cwd();
62379
- const explicitTargetDirectory = directory ? path7.resolve(initialCwd, directory) : undefined;
62459
+ const initialCwd = process14.cwd();
62460
+ const explicitTargetDirectory = directory ? path8.resolve(initialCwd, directory) : undefined;
62380
62461
  const { json: _json, ...syncOpts } = opts;
62381
62462
  const mergedOpts = await mergeConfigWithConfigFile(syncOpts);
62382
- const targetDirectory = explicitTargetDirectory ?? process13.cwd();
62463
+ const targetDirectory = explicitTargetDirectory ?? process14.cwd();
62383
62464
  const stats = await stat5(targetDirectory).catch(() => null);
62384
62465
  if (!stats) {
62385
62466
  throw new Error(`Directory not found: ${targetDirectory}`);
@@ -62387,7 +62468,7 @@ async function runLint(opts, directory) {
62387
62468
  if (!stats.isDirectory()) {
62388
62469
  throw new Error(`Path is not a directory: ${targetDirectory}`);
62389
62470
  }
62390
- const isSubdirectory = explicitTargetDirectory && !await stat5(path7.join(targetDirectory, "wmill.yaml")).catch(() => null);
62471
+ const isSubdirectory = explicitTargetDirectory && !await stat5(path8.join(targetDirectory, "wmill.yaml")).catch(() => null);
62391
62472
  const ignore = isSubdirectory ? (_p, _isDir) => false : await ignoreF(mergedOpts);
62392
62473
  const root = await FSFSElement(targetDirectory, [], false);
62393
62474
  const validator = new import_windmill_yaml_validator.WindmillYamlValidator;
@@ -62494,7 +62575,7 @@ async function lint(opts, directory) {
62494
62575
  const report = await runLint(opts, directory);
62495
62576
  printReport(report, !!opts.json);
62496
62577
  if (report.exitCode !== 0) {
62497
- process13.exit(report.exitCode);
62578
+ process14.exit(report.exitCode);
62498
62579
  }
62499
62580
  } catch (error2) {
62500
62581
  const message = error2 instanceof Error ? error2.message : String(error2);
@@ -62507,17 +62588,17 @@ async function lint(opts, directory) {
62507
62588
  } else {
62508
62589
  error(colors.red(`❌ ${message}`));
62509
62590
  }
62510
- process13.exit(1);
62591
+ process14.exit(1);
62511
62592
  }
62512
62593
  }
62513
62594
  async function lintWatch(opts, directory) {
62514
62595
  const { watch } = await import("node:fs");
62515
- const targetDir = directory ? path7.resolve(process13.cwd(), directory) : process13.cwd();
62596
+ const targetDir = directory ? path8.resolve(process14.cwd(), directory) : process14.cwd();
62516
62597
  info(colors.blue(`Watching ${targetDir} for changes... (Ctrl+C to stop)`));
62517
62598
  async function runAndReport() {
62518
62599
  try {
62519
62600
  const report = await runLint(opts, directory);
62520
- process13.stdout.write("\x1Bc");
62601
+ process14.stdout.write("\x1Bc");
62521
62602
  info(colors.gray(`[${new Date().toLocaleTimeString()}] Lint results:
62522
62603
  `));
62523
62604
  printReport(report, false);
@@ -62819,11 +62900,11 @@ async function list5(opts) {
62819
62900
  new Table2().header(["Path", "Resource Type"]).padding(2).border(true).body(total.map((x) => [x.path, x.resource_type])).render();
62820
62901
  }
62821
62902
  }
62822
- async function newResource(opts, path8) {
62823
- if (!validatePath(path8)) {
62903
+ async function newResource(opts, path9) {
62904
+ if (!validatePath(path9)) {
62824
62905
  return;
62825
62906
  }
62826
- const filePath = path8 + ".resource.yaml";
62907
+ const filePath = path9 + ".resource.yaml";
62827
62908
  try {
62828
62909
  await stat6(filePath);
62829
62910
  throw new Error("File already exists: " + filePath);
@@ -62843,14 +62924,14 @@ async function newResource(opts, path8) {
62843
62924
  });
62844
62925
  info(colors.green(`Created ${filePath}`));
62845
62926
  }
62846
- async function get3(opts, path8) {
62927
+ async function get3(opts, path9) {
62847
62928
  if (opts.json)
62848
62929
  setSilent(true);
62849
62930
  const workspace = await resolveWorkspace(opts);
62850
62931
  await requireLogin(opts);
62851
62932
  const r = await getResource({
62852
62933
  workspace: workspace.workspaceId,
62853
- path: path8
62934
+ path: path9
62854
62935
  });
62855
62936
  if (opts.json) {
62856
62937
  console.log(JSON.stringify(r));
@@ -63009,11 +63090,11 @@ var init_path_assigner = __esm(() => {
63009
63090
  function extractRawscriptInline(id, summary, rawscript, mapping, separator, assigner) {
63010
63091
  const [basePath, ext2] = assigner.assignPath(summary ?? id, rawscript.language);
63011
63092
  const mappedPath = mapping[id];
63012
- const path8 = mappedPath ?? basePath + ext2;
63093
+ const path9 = mappedPath ?? basePath + ext2;
63013
63094
  const language = rawscript.language;
63014
63095
  const content = rawscript.content;
63015
- const r = [{ path: path8, content, language, is_lock: false }];
63016
- rawscript.content = "!inline " + path8.replaceAll(separator, "/");
63096
+ const r = [{ path: path9, content, language, is_lock: false }];
63097
+ rawscript.content = "!inline " + path9.replaceAll(separator, "/");
63017
63098
  const lock = rawscript.lock;
63018
63099
  if (lock && lock != "") {
63019
63100
  const dotIdx = mappedPath ? mappedPath.lastIndexOf(".") : -1;
@@ -63099,23 +63180,23 @@ async function replaceRawscriptInline(id, rawscript, fileReader, logger, separat
63099
63180
  if (!rawscript.content || !rawscript.content.startsWith("!inline")) {
63100
63181
  return;
63101
63182
  }
63102
- const path8 = rawscript.content.split(" ")[1];
63103
- const pathSuffix = path8.split(".").slice(1).join(".");
63183
+ const path9 = rawscript.content.split(" ")[1];
63184
+ const pathSuffix = path9.split(".").slice(1).join(".");
63104
63185
  const newPath = id + "." + pathSuffix;
63105
63186
  try {
63106
- rawscript.content = await fileReader(path8);
63187
+ rawscript.content = await fileReader(path9);
63107
63188
  } catch {
63108
- logger.error(`Script file ${path8} not found`);
63189
+ logger.error(`Script file ${path9} not found`);
63109
63190
  try {
63110
63191
  rawscript.content = await fileReader(newPath);
63111
63192
  } catch {
63112
63193
  logger.error(`Script file ${newPath} not found`);
63113
63194
  if (missingFiles)
63114
- missingFiles.push(path8);
63195
+ missingFiles.push(path9);
63115
63196
  }
63116
63197
  }
63117
63198
  const lock = rawscript.lock;
63118
- if (removeLocks && removeLocks.includes(path8)) {
63199
+ if (removeLocks && removeLocks.includes(path9)) {
63119
63200
  rawscript.lock = undefined;
63120
63201
  } else if (lock && typeof lock === "string" && lock.trimStart().startsWith("!inline ")) {
63121
63202
  const lockPath = lock.split(" ")[1];
@@ -63298,11 +63379,11 @@ var init_relative_imports = __esm(async () => {
63298
63379
  });
63299
63380
 
63300
63381
  // src/commands/flow/flow_metadata.ts
63301
- import * as path8 from "node:path";
63382
+ import * as path9 from "node:path";
63302
63383
  import { sep as SEP7 } from "node:path";
63303
63384
  import { readFile as readFile7 } from "node:fs/promises";
63304
63385
  async function generateFlowHash(rawWorkspaceDependencies, folder, defaultTs) {
63305
- const elems = await FSFSElement(path8.join(process.cwd(), folder), [], true);
63386
+ const elems = await FSFSElement(path9.join(process.cwd(), folder), [], true);
63306
63387
  const hashes = {};
63307
63388
  for await (const f of elems.getChildren()) {
63308
63389
  if (exts.some((e) => f.path.endsWith(e))) {
@@ -63342,7 +63423,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
63342
63423
  continue;
63343
63424
  }
63344
63425
  }
63345
- const treePath = folderNormalized + "/" + path8.basename(script.path, path8.extname(script.path));
63426
+ const treePath = folderNormalized + "/" + path9.basename(script.path, path9.extname(script.path));
63346
63427
  const language = script.language;
63347
63428
  const imports = await extractRelativeImports(content, treePath, language);
63348
63429
  await tree.addNode(treePath, content, language, "", imports, "inline_script", folderNormalized, folder, false);
@@ -63377,29 +63458,29 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
63377
63458
  const c = script.content;
63378
63459
  if (c.startsWith("!inline ")) {
63379
63460
  const fileName = c.replace("!inline ", "");
63380
- const treePath = folderNormalized + "/" + path8.basename(script.path, path8.extname(script.path));
63461
+ const treePath = folderNormalized + "/" + path9.basename(script.path, path9.extname(script.path));
63381
63462
  fileToTreePath.set(fileName, treePath);
63382
63463
  }
63383
63464
  }
63384
63465
  if (!justUpdateMetadataLock) {
63385
63466
  const hashes = await generateFlowHash(filteredDeps, folder, opts.defaultTs);
63386
- for (const [path9, hash2] of Object.entries(hashes)) {
63387
- if (path9 == TOP_HASH) {
63467
+ for (const [path10, hash2] of Object.entries(hashes)) {
63468
+ if (path10 == TOP_HASH) {
63388
63469
  continue;
63389
63470
  }
63390
- if (!await checkifMetadataUptodate(folder, hash2, conf, path9)) {
63391
- changedScripts.push(path9);
63471
+ if (!await checkifMetadataUptodate(folder, hash2, conf, path10)) {
63472
+ changedScripts.push(path10);
63392
63473
  }
63393
63474
  }
63394
63475
  if (!noStaleMessage) {
63395
63476
  info(`Recomputing locks of ${changedScripts.join(", ")} in ${folder}`);
63396
63477
  }
63397
- const fileReader = async (path9) => await readFile7(folder + SEP7 + path9, "utf-8");
63478
+ const fileReader = async (path10) => await readFile7(folder + SEP7 + path10, "utf-8");
63398
63479
  const currentMapping = extractCurrentMapping(flowValue.value.modules, {}, flowValue.value.failure_module, flowValue.value.preprocessor_module);
63399
63480
  const locksToRemove = tree ? Object.keys(hashes).filter((k) => {
63400
63481
  if (k === TOP_HASH)
63401
63482
  return false;
63402
- const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path8.basename(k, path8.extname(k));
63483
+ const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path9.basename(k, path9.extname(k));
63403
63484
  return tree.isStale(treePath);
63404
63485
  }) : changedScripts;
63405
63486
  await replaceInlineScripts(flowValue.value.modules, fileReader, exports_log, folder + SEP7, SEP7, locksToRemove);
@@ -63435,8 +63516,8 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
63435
63516
  const depsForHash = tree ? {} : filteredDeps;
63436
63517
  const finalHashes = await generateFlowHash(depsForHash, folder, opts.defaultTs);
63437
63518
  await clearGlobalLock(folder);
63438
- for (const [path9, hash2] of Object.entries(finalHashes)) {
63439
- await updateMetadataGlobalLock(folder, hash2, path9);
63519
+ for (const [path10, hash2] of Object.entries(finalHashes)) {
63520
+ await updateMetadataGlobalLock(folder, hash2, path10);
63440
63521
  }
63441
63522
  if (!noStaleMessage) {
63442
63523
  info(colors.green(`Flow ${remote_path} lockfiles updated`));
@@ -63444,7 +63525,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
63444
63525
  const relocked = tree ? Object.keys(finalHashes).filter((k) => {
63445
63526
  if (k === TOP_HASH)
63446
63527
  return false;
63447
- const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path8.basename(k, path8.extname(k));
63528
+ const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path9.basename(k, path9.extname(k));
63448
63529
  return tree.isStale(treePath);
63449
63530
  }) : changedScripts;
63450
63531
  const updatedScripts = relocked.map((p) => {
@@ -63560,7 +63641,7 @@ __export(exports_sync, {
63560
63641
  FSFSElement: () => FSFSElement
63561
63642
  });
63562
63643
  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";
63644
+ import * as path10 from "node:path";
63564
63645
  import { sep as SEP8 } from "node:path";
63565
63646
  function resolveWsNameFromBranch(opts, branchName) {
63566
63647
  const match2 = findWorkspaceByGitBranch(opts.workspaces, branchName);
@@ -63618,8 +63699,8 @@ function mergeCliWithEffectiveOptions(cliOpts, effectiveOpts) {
63618
63699
  async function resolveEffectiveSyncOptions(workspace, localConfig, promotion, workspaceNameOverride) {
63619
63700
  return await getEffectiveSettings(localConfig, promotion, false, false, workspaceNameOverride);
63620
63701
  }
63621
- function findCodebase(path10, codebases) {
63622
- if (!path10.endsWith(".ts")) {
63702
+ function findCodebase(path11, codebases) {
63703
+ if (!path11.endsWith(".ts")) {
63623
63704
  return;
63624
63705
  }
63625
63706
  for (const c of codebases) {
@@ -63635,7 +63716,7 @@ function findCodebase(path10, codebases) {
63635
63716
  if (included) {
63636
63717
  break;
63637
63718
  }
63638
- if (minimatch(path10, r)) {
63719
+ if (minimatch(path11, r)) {
63639
63720
  included = true;
63640
63721
  }
63641
63722
  }
@@ -63643,7 +63724,7 @@ function findCodebase(path10, codebases) {
63643
63724
  c.excludes = [c.excludes];
63644
63725
  }
63645
63726
  for (const r of c.excludes ?? []) {
63646
- if (minimatch(path10, r)) {
63727
+ if (minimatch(path11, r)) {
63647
63728
  excluded = true;
63648
63729
  }
63649
63730
  }
@@ -63652,13 +63733,13 @@ function findCodebase(path10, codebases) {
63652
63733
  }
63653
63734
  }
63654
63735
  }
63655
- async function addCodebaseDigestIfRelevant(path10, content, codebases, ignoreCodebaseChanges) {
63656
- const isScript = path10.endsWith(".script.yaml");
63736
+ async function addCodebaseDigestIfRelevant(path11, content, codebases, ignoreCodebaseChanges) {
63737
+ const isScript = path11.endsWith(".script.yaml");
63657
63738
  if (!isScript) {
63658
63739
  return content;
63659
63740
  }
63660
63741
  let isTs = true;
63661
- const replacedPath = path10.replace(".script.yaml", ".ts");
63742
+ const replacedPath = path11.replace(".script.yaml", ".ts");
63662
63743
  try {
63663
63744
  await stat7(replacedPath);
63664
63745
  } catch {
@@ -63672,9 +63753,9 @@ async function addCodebaseDigestIfRelevant(path10, content, codebases, ignoreCod
63672
63753
  if (c) {
63673
63754
  let parsed;
63674
63755
  try {
63675
- parsed = yamlParseContent(path10, content);
63756
+ parsed = yamlParseContent(path11, content);
63676
63757
  } catch (error2) {
63677
- error(`Failed to parse YAML content for codebase digest at path: ${path10}`);
63758
+ error(`Failed to parse YAML content for codebase digest at path: ${path11}`);
63678
63759
  throw error2;
63679
63760
  }
63680
63761
  if (parsed && typeof parsed == "object") {
@@ -63686,7 +63767,7 @@ async function addCodebaseDigestIfRelevant(path10, content, codebases, ignoreCod
63686
63767
  parsed["lock"] = "";
63687
63768
  return import_yaml11.stringify(parsed, yamlOptions);
63688
63769
  } else {
63689
- throw Error(`Expected local yaml ${path10} to be an object, found: ${content} instead`);
63770
+ throw Error(`Expected local yaml ${path11} to be an object, found: ${content} instead`);
63690
63771
  }
63691
63772
  }
63692
63773
  }
@@ -63703,7 +63784,7 @@ async function FSFSElement(p, codebases, ignoreCodebaseChanges) {
63703
63784
  try {
63704
63785
  const entries = await readdir4(localP, { withFileTypes: true });
63705
63786
  for (const e of entries) {
63706
- yield _internal_element(path9.join(localP, e.name), e.isDirectory(), codebases2);
63787
+ yield _internal_element(path10.join(localP, e.name), e.isDirectory(), codebases2);
63707
63788
  }
63708
63789
  } catch (e) {
63709
63790
  warn(`Error reading dir: ${localP}, ${e}`);
@@ -63874,7 +63955,7 @@ function extractInlineScriptsForApps(key, rec, pathAssigner, toId, removeSchema)
63874
63955
  }
63875
63956
  if (typeof rec == "object") {
63876
63957
  return Object.entries(rec).flatMap(([k, v]) => {
63877
- if (k == "inlineScript" && typeof v == "object") {
63958
+ if (k == "inlineScript" && v != null && typeof v == "object") {
63878
63959
  rec["type"] = undefined;
63879
63960
  const o = v;
63880
63961
  const name = toId(key ?? "", rec);
@@ -63982,9 +64063,9 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
63982
64063
  for (const basePath of moduleScripts) {
63983
64064
  if (normalizedP.startsWith(basePath + ".")) {
63984
64065
  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);
64066
+ const dir = path10.dirname(finalPath);
64067
+ const base = path10.basename(basePath);
64068
+ finalPath = path10.join(dir, base + getModuleFolderSuffix(), "script" + ext2);
63988
64069
  break;
63989
64070
  }
63990
64071
  }
@@ -64020,7 +64101,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64020
64101
  for (const s of inlineScripts) {
64021
64102
  yield {
64022
64103
  isDirectory: false,
64023
- path: path9.join(finalPath, s.path),
64104
+ path: path10.join(finalPath, s.path),
64024
64105
  async* getChildren() {},
64025
64106
  async getContentText() {
64026
64107
  return s.content;
@@ -64033,7 +64114,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64033
64114
  }
64034
64115
  yield {
64035
64116
  isDirectory: false,
64036
- path: path9.join(finalPath, "flow.yaml"),
64117
+ path: path10.join(finalPath, "flow.yaml"),
64037
64118
  async* getChildren() {},
64038
64119
  async getContentText() {
64039
64120
  return import_yaml11.stringify(flow, yamlOptions);
@@ -64057,7 +64138,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64057
64138
  for (const s of inlineScripts) {
64058
64139
  yield {
64059
64140
  isDirectory: false,
64060
- path: path9.join(finalPath, s.path),
64141
+ path: path10.join(finalPath, s.path),
64061
64142
  async* getChildren() {},
64062
64143
  async getContentText() {
64063
64144
  return s.content;
@@ -64070,7 +64151,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64070
64151
  app.policy = undefined;
64071
64152
  yield {
64072
64153
  isDirectory: false,
64073
- path: path9.join(finalPath, "app.yaml"),
64154
+ path: path10.join(finalPath, "app.yaml"),
64074
64155
  async* getChildren() {},
64075
64156
  async getContentText() {
64076
64157
  return import_yaml11.stringify(app, yamlOptions);
@@ -64125,7 +64206,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64125
64206
  }
64126
64207
  yield {
64127
64208
  isDirectory: false,
64128
- path: path9.join(finalPath, filePath.substring(1)),
64209
+ path: path10.join(finalPath, filePath.substring(1)),
64129
64210
  async* getChildren() {},
64130
64211
  async getContentText() {
64131
64212
  if (typeof content !== "string") {
@@ -64142,7 +64223,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64142
64223
  for (const s of inlineScripts) {
64143
64224
  yield {
64144
64225
  isDirectory: false,
64145
- path: path9.join(finalPath, APP_BACKEND_FOLDER, s.path),
64226
+ path: path10.join(finalPath, APP_BACKEND_FOLDER, s.path),
64146
64227
  async* getChildren() {},
64147
64228
  async getContentText() {
64148
64229
  return s.content;
@@ -64178,7 +64259,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64178
64259
  }
64179
64260
  yield {
64180
64261
  isDirectory: false,
64181
- path: path9.join(finalPath, APP_BACKEND_FOLDER, `${runnableId}.yaml`),
64262
+ path: path10.join(finalPath, APP_BACKEND_FOLDER, `${runnableId}.yaml`),
64182
64263
  async* getChildren() {},
64183
64264
  async getContentText() {
64184
64265
  return import_yaml11.stringify(simplifiedRunnable, yamlOptions);
@@ -64192,7 +64273,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64192
64273
  delete rawApp?.["value"];
64193
64274
  yield {
64194
64275
  isDirectory: false,
64195
- path: path9.join(finalPath, "raw_app.yaml"),
64276
+ path: path10.join(finalPath, "raw_app.yaml"),
64196
64277
  async* getChildren() {},
64197
64278
  async getContentText() {
64198
64279
  return import_yaml11.stringify(rawApp, yamlOptions);
@@ -64200,7 +64281,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64200
64281
  };
64201
64282
  yield {
64202
64283
  isDirectory: false,
64203
- path: path9.join(finalPath, "DATATABLES.md"),
64284
+ path: path10.join(finalPath, "DATATABLES.md"),
64204
64285
  async* getChildren() {},
64205
64286
  async getContentText() {
64206
64287
  return generateDatatablesDocumentation(data3);
@@ -64303,12 +64384,12 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64303
64384
  const scriptBasePath = removeSuffix(removeSuffix(finalPath, metaExt), ".script");
64304
64385
  const moduleFolderPath = scriptBasePath + getModuleFolderSuffix();
64305
64386
  if (hasModules) {
64306
- r[0].path = path9.join(moduleFolderPath, "script" + metaExt);
64387
+ r[0].path = path10.join(moduleFolderPath, "script" + metaExt);
64307
64388
  }
64308
64389
  if (lock && lock != "") {
64309
64390
  r.push({
64310
64391
  isDirectory: false,
64311
- path: hasModules ? path9.join(moduleFolderPath, "script.lock") : removeSuffix(finalPath, metaExt) + ".lock",
64392
+ path: hasModules ? path10.join(moduleFolderPath, "script.lock") : removeSuffix(finalPath, metaExt) + ".lock",
64312
64393
  async* getChildren() {},
64313
64394
  async getContentText() {
64314
64395
  return lock;
@@ -64323,7 +64404,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64323
64404
  for (const [relPath, mod] of Object.entries(scriptModules)) {
64324
64405
  yield {
64325
64406
  isDirectory: false,
64326
- path: path9.join(moduleFolderPath, relPath),
64407
+ path: path10.join(moduleFolderPath, relPath),
64327
64408
  async* getChildren() {},
64328
64409
  async getContentText() {
64329
64410
  return mod.content;
@@ -64333,7 +64414,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64333
64414
  const baseName = relPath.replace(/\.[^.]+$/, "");
64334
64415
  yield {
64335
64416
  isDirectory: false,
64336
- path: path9.join(moduleFolderPath, baseName + ".lock"),
64417
+ path: path10.join(moduleFolderPath, baseName + ".lock"),
64337
64418
  async* getChildren() {},
64338
64419
  async getContentText() {
64339
64420
  return mod.lock;
@@ -64370,7 +64451,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64370
64451
  if (typeof fileContent === "string") {
64371
64452
  yield {
64372
64453
  isDirectory: false,
64373
- path: path9.join(filesetBasePath, relPath),
64454
+ path: path10.join(filesetBasePath, relPath),
64374
64455
  async* getChildren() {},
64375
64456
  async getContentText() {
64376
64457
  return fileContent;
@@ -64406,7 +64487,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
64406
64487
  async* getChildren() {
64407
64488
  for (const filename in zip2.files) {
64408
64489
  const file = zip2.files[filename];
64409
- const totalPath = path9.join(p, filename);
64490
+ const totalPath = path10.join(p, filename);
64410
64491
  if (file.dir) {
64411
64492
  const e = zip2.folder(file.name);
64412
64493
  yield _internal_folder(totalPath, e);
@@ -64475,15 +64556,15 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
64475
64556
  if (entry.ignored) {
64476
64557
  continue;
64477
64558
  }
64478
- const path10 = entry.path;
64479
- if (isScriptModulePath(path10)) {
64480
- map[path10] = await entry.getContentText();
64559
+ const path11 = entry.path;
64560
+ if (isScriptModulePath(path11)) {
64561
+ map[path11] = await entry.getContentText();
64481
64562
  continue;
64482
64563
  }
64483
- if (!isFileResource(path10) && !isFilesetResource(path10) && !isRawAppFile(path10) && !isWorkspaceDependencies(path10)) {
64484
- if (json && path10.endsWith(".yaml"))
64564
+ if (!isFileResource(path11) && !isFilesetResource(path11) && !isRawAppFile(path11) && !isWorkspaceDependencies(path11)) {
64565
+ if (json && path11.endsWith(".yaml"))
64485
64566
  continue;
64486
- if (!json && path10.endsWith(".json"))
64567
+ if (!json && path11.endsWith(".json"))
64487
64568
  continue;
64488
64569
  if (![
64489
64570
  "json",
@@ -64505,39 +64586,39 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
64505
64586
  "java",
64506
64587
  "rb",
64507
64588
  "r"
64508
- ].includes(path10.split(".").pop() ?? "")) {
64589
+ ].includes(path11.split(".").pop() ?? "")) {
64509
64590
  continue;
64510
64591
  }
64511
64592
  }
64512
- if (isRawAppFile(path10)) {
64513
- const suffix = path10.split(getFolderSuffix("raw_app") + SEP8).pop();
64593
+ if (isRawAppFile(path11)) {
64594
+ const suffix = path11.split(getFolderSuffix("raw_app") + SEP8).pop();
64514
64595
  if (suffix?.startsWith("dist/") || suffix == "wmill.d.ts" || suffix == "package-lock.json" || suffix == "DATATABLES.md") {
64515
64596
  continue;
64516
64597
  }
64517
64598
  }
64518
- if (skips.skipResources && (isFileResource(path10) || isFilesetResource(path10)))
64599
+ if (skips.skipResources && (isFileResource(path11) || isFilesetResource(path11)))
64519
64600
  continue;
64520
64601
  const ext2 = json ? ".json" : ".yaml";
64521
- if (!skips.includeSchedules && path10.endsWith(".schedule" + ext2))
64602
+ if (!skips.includeSchedules && path11.endsWith(".schedule" + ext2))
64522
64603
  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))) {
64604
+ 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
64605
  continue;
64525
64606
  }
64526
- if (!skips.includeUsers && path10.endsWith(".user" + ext2))
64607
+ if (!skips.includeUsers && path11.endsWith(".user" + ext2))
64527
64608
  continue;
64528
- if (!skips.includeGroups && path10.endsWith(".group" + ext2))
64609
+ if (!skips.includeGroups && path11.endsWith(".group" + ext2))
64529
64610
  continue;
64530
- if (!skips.includeSettings && path10 === "settings" + ext2)
64611
+ if (!skips.includeSettings && path11 === "settings" + ext2)
64531
64612
  continue;
64532
- if (!skips.includeKey && path10 === "encryption_key")
64613
+ if (!skips.includeKey && path11 === "encryption_key")
64533
64614
  continue;
64534
- if (skips.skipResources && path10.endsWith(".resource" + ext2))
64615
+ if (skips.skipResources && path11.endsWith(".resource" + ext2))
64535
64616
  continue;
64536
- if (skips.skipResourceTypes && path10.endsWith(".resource-type" + ext2)) {
64617
+ if (skips.skipResourceTypes && path11.endsWith(".resource-type" + ext2)) {
64537
64618
  continue;
64538
64619
  }
64539
64620
  try {
64540
- const fileType = getTypeStrFromPath(path10);
64621
+ const fileType = getTypeStrFromPath(path11);
64541
64622
  if (skips.skipVariables && fileType === "variable")
64542
64623
  continue;
64543
64624
  if (skips.skipScripts && fileType === "script")
@@ -64551,27 +64632,27 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
64551
64632
  if (skips.skipWorkspaceDependencies && fileType === "workspace_dependencies")
64552
64633
  continue;
64553
64634
  } catch {}
64554
- if (specificItems && isWorkspaceSpecificFile(path10)) {
64555
- if (!isCurrentWorkspaceFile(path10, cachedWsName)) {
64635
+ if (specificItems && isWorkspaceSpecificFile(path11)) {
64636
+ if (!isCurrentWorkspaceFile(path11, cachedWsName)) {
64556
64637
  continue;
64557
64638
  }
64558
64639
  }
64559
64640
  const content = await entry.getContentText();
64560
- if (skips.skipSecrets && path10.endsWith(".variable" + ext2)) {
64641
+ if (skips.skipSecrets && path11.endsWith(".variable" + ext2)) {
64561
64642
  try {
64562
64643
  let o;
64563
64644
  if (json) {
64564
64645
  try {
64565
64646
  o = JSON.parse(content);
64566
64647
  } catch (error2) {
64567
- error(`Failed to parse JSON variable content at path: ${path10}`);
64648
+ error(`Failed to parse JSON variable content at path: ${path11}`);
64568
64649
  throw error2;
64569
64650
  }
64570
64651
  } else {
64571
64652
  try {
64572
- o = yamlParseContent(path10, content);
64653
+ o = yamlParseContent(path11, content);
64573
64654
  } catch (error2) {
64574
- error(`Failed to parse YAML variable content at path: ${path10}`);
64655
+ error(`Failed to parse YAML variable content at path: ${path11}`);
64575
64656
  throw error2;
64576
64657
  }
64577
64658
  }
@@ -64579,12 +64660,12 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
64579
64660
  continue;
64580
64661
  }
64581
64662
  } catch (e) {
64582
- warn(`Error reading variable ${path10} to check for secrets`);
64663
+ warn(`Error reading variable ${path11} to check for secrets`);
64583
64664
  }
64584
64665
  }
64585
- if (cachedWsName && isCurrentWorkspaceFile(path10, cachedWsName)) {
64666
+ if (cachedWsName && isCurrentWorkspaceFile(path11, cachedWsName)) {
64586
64667
  const currentBranch = cachedWsName;
64587
- const basePath = fromWorkspaceSpecificPath(path10, currentBranch);
64668
+ const basePath = fromWorkspaceSpecificPath(path11, currentBranch);
64588
64669
  if (!isItemTypeConfigured(basePath, specificItems)) {
64589
64670
  continue;
64590
64671
  }
@@ -64593,14 +64674,14 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
64593
64674
  }
64594
64675
  map[basePath] = content;
64595
64676
  processedBasePaths.add(basePath);
64596
- } else if (!isWorkspaceSpecificFile(path10)) {
64597
- if (processedBasePaths.has(path10)) {
64677
+ } else if (!isWorkspaceSpecificFile(path11)) {
64678
+ if (processedBasePaths.has(path11)) {
64598
64679
  continue;
64599
64680
  }
64600
- if (!isRemote && isSpecificItem(path10, specificItems)) {
64681
+ if (!isRemote && isSpecificItem(path11, specificItems)) {
64601
64682
  continue;
64602
64683
  }
64603
- map[path10] = content;
64684
+ map[path11] = content;
64604
64685
  }
64605
64686
  }
64606
64687
  if (wrongFormatPaths.length > 0) {
@@ -64980,7 +65061,7 @@ async function pull(opts) {
64980
65061
  throw error2;
64981
65062
  }
64982
65063
  if (opts.stateful) {
64983
- await mkdir5(path9.join(process.cwd(), ".wmill"), { recursive: true });
65064
+ await mkdir5(path10.join(process.cwd(), ".wmill"), { recursive: true });
64984
65065
  }
64985
65066
  const workspace = await resolveWorkspace(opts, wsNameForConfig);
64986
65067
  await requireLogin(opts);
@@ -65005,7 +65086,7 @@ async function pull(opts) {
65005
65086
  } catch {}
65006
65087
  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
65088
  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);
65089
+ const local = !opts.stateful ? await FSFSElement(process.cwd(), codebases, true) : await FSFSElement(path10.join(process.cwd(), ".wmill"), [], true);
65009
65090
  const changes = await compareDynFSElement(remote, local, await ignoreF(opts), opts.json ?? false, opts, false, codebases, true, specificItems, wsNameForFiles, true);
65010
65091
  info(`remote (${workspace.name}) -> local: ${changes.length} changes to apply`);
65011
65092
  if (opts.dryRun && opts.jsonOutput) {
@@ -65049,8 +65130,8 @@ async function pull(opts) {
65049
65130
  targetPath = workspaceSpecificPath;
65050
65131
  }
65051
65132
  }
65052
- const target = path9.join(process.cwd(), targetPath);
65053
- const stateTarget = path9.join(process.cwd(), ".wmill", targetPath);
65133
+ const target = path10.join(process.cwd(), targetPath);
65134
+ const stateTarget = path10.join(process.cwd(), ".wmill", targetPath);
65054
65135
  if (change.name === "edited") {
65055
65136
  if (opts.stateful) {
65056
65137
  try {
@@ -65083,13 +65164,13 @@ Both local and remote have been modified.`));
65083
65164
  }
65084
65165
  await writeFile7(target, change.after, "utf-8");
65085
65166
  if (opts.stateful) {
65086
- await mkdir5(path9.dirname(stateTarget), { recursive: true });
65167
+ await mkdir5(path10.dirname(stateTarget), { recursive: true });
65087
65168
  await copyFile(target, stateTarget);
65088
65169
  }
65089
65170
  } else if (change.name === "added") {
65090
- await mkdir5(path9.dirname(target), { recursive: true });
65171
+ await mkdir5(path10.dirname(target), { recursive: true });
65091
65172
  if (opts.stateful) {
65092
- await mkdir5(path9.dirname(stateTarget), { recursive: true });
65173
+ await mkdir5(path10.dirname(stateTarget), { recursive: true });
65093
65174
  info(`Adding ${getTypeStrFromPath(change.path)} ${targetPath}${targetPath !== change.path ? colors.gray(` (workspace-specific override for ${change.path})`) : ""}`);
65094
65175
  }
65095
65176
  await writeFile7(target, change.content, "utf-8");
@@ -65294,7 +65375,7 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
65294
65375
  resourceTypeToIsFileset = parsed.filesetMap;
65295
65376
  } catch {}
65296
65377
  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);
65378
+ const local = await FSFSElement(path10.join(process.cwd(), ""), codebases, false);
65298
65379
  const changes = await compareDynFSElement(local, remote, await ignoreF(opts), opts.json ?? false, opts, true, codebases, false, specificItems, wsNameForFiles, false);
65299
65380
  const rawWorkspaceDependencies = await getRawWorkspaceDependencies(true);
65300
65381
  const tracker = await buildTracker(changes);
@@ -65408,7 +65489,7 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
65408
65489
  }
65409
65490
  }
65410
65491
  for (const folderName2 of folderNames) {
65411
- const basePath = path9.join("f", folderName2, "folder.meta.yaml");
65492
+ const basePath = path10.join("f", folderName2, "folder.meta.yaml");
65412
65493
  const branchPath = getWorkspaceSpecificPath(`f/${folderName2}/folder.meta.yaml`, specificItems, wsNameForFiles);
65413
65494
  let found = false;
65414
65495
  if (branchPath) {
@@ -65530,7 +65611,7 @@ ${folderList}
65530
65611
  let stateful = opts.stateful;
65531
65612
  if (stateful) {
65532
65613
  try {
65533
- await stat7(path9.join(process.cwd(), ".wmill"));
65614
+ await stat7(path10.join(process.cwd(), ".wmill"));
65534
65615
  } catch {
65535
65616
  stateful = false;
65536
65617
  }
@@ -65581,7 +65662,7 @@ ${folderList}
65581
65662
  let stateTarget = undefined;
65582
65663
  if (stateful) {
65583
65664
  try {
65584
- stateTarget = path9.join(process.cwd(), ".wmill", change.path);
65665
+ stateTarget = path10.join(process.cwd(), ".wmill", change.path);
65585
65666
  await stat7(stateTarget);
65586
65667
  } catch {
65587
65668
  stateTarget = undefined;
@@ -65606,7 +65687,7 @@ ${folderList}
65606
65687
  continue;
65607
65688
  }
65608
65689
  if (stateTarget) {
65609
- await mkdir5(path9.dirname(stateTarget), { recursive: true });
65690
+ await mkdir5(path10.dirname(stateTarget), { recursive: true });
65610
65691
  info(`Editing ${getTypeStrFromPath(change.path)} ${change.path}`);
65611
65692
  }
65612
65693
  if (isFileResource(change.path)) {
@@ -65663,7 +65744,7 @@ ${folderList}
65663
65744
  continue;
65664
65745
  }
65665
65746
  if (stateTarget) {
65666
- await mkdir5(path9.dirname(stateTarget), { recursive: true });
65747
+ await mkdir5(path10.dirname(stateTarget), { recursive: true });
65667
65748
  info(`Adding ${getTypeStrFromPath(change.path)} ${change.path}`);
65668
65749
  }
65669
65750
  const obj = parseFromPath(change.path, change.content);
@@ -66256,8 +66337,8 @@ var init_parse_schema = __esm(() => {
66256
66337
  // src/utils/metadata.ts
66257
66338
  import { sep as SEP9 } from "node:path";
66258
66339
  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";
66340
+ import { readFileSync as readFileSync3, existsSync as existsSync5, readdirSync, statSync, writeFileSync as writeFileSync4 } from "node:fs";
66341
+ import * as path11 from "node:path";
66261
66342
  import { createRequire as createRequire2 } from "node:module";
66262
66343
  function loadParser(pkgName) {
66263
66344
  let p = _parserCache.get(pkgName);
@@ -66299,8 +66380,8 @@ async function getRawWorkspaceDependencies(legacyBehaviour) {
66299
66380
  } catch {}
66300
66381
  return rawWorkspaceDeps;
66301
66382
  }
66302
- function workspaceDependenciesPathToLanguageAndFilename(path11) {
66303
- const relativePath = path11.replace("dependencies/", "");
66383
+ function workspaceDependenciesPathToLanguageAndFilename(path12) {
66384
+ const relativePath = path12.replace("dependencies/", "");
66304
66385
  for (const { filename, language } of workspaceDependenciesLanguages) {
66305
66386
  if (relativePath.endsWith(filename)) {
66306
66387
  return {
@@ -66354,8 +66435,8 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
66354
66435
  const scriptContent = await readFile9(scriptPath, "utf-8");
66355
66436
  const metadataContent = await readFile9(metadataWithType.path, "utf-8");
66356
66437
  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();
66438
+ const moduleFolderPath = isFolderLayout ? path11.dirname(scriptPath) : scriptPath.substring(0, scriptPath.indexOf(".")) + getModuleFolderSuffix();
66439
+ const hasModules = existsSync5(moduleFolderPath) && statSync(moduleFolderPath).isDirectory();
66359
66440
  const depsForHash = tree ? {} : filteredRawWorkspaceDependencies;
66360
66441
  let hash2 = await generateScriptHash(depsForHash, scriptContent, metadataContent);
66361
66442
  let moduleHashes = {};
@@ -66411,7 +66492,7 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
66411
66492
  const hasCodebase = findCodebase(scriptPath, codebases) != null;
66412
66493
  if (!hasCodebase) {
66413
66494
  const tempScriptRefs = tree?.getTempScriptRefs(remotePath);
66414
- const lockPathOverride = isFolderLayout ? path10.dirname(scriptPath) + "/script.lock" : undefined;
66495
+ const lockPathOverride = isFolderLayout ? path11.dirname(scriptPath) + "/script.lock" : undefined;
66415
66496
  await updateScriptLock(workspace, scriptContent, language, remotePath, metadataParsedContent, filteredRawWorkspaceDependencies, tempScriptRefs, lockPathOverride);
66416
66497
  } else {
66417
66498
  metadataParsedContent.lock = "";
@@ -66442,10 +66523,10 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
66442
66523
  let newMetadataContent;
66443
66524
  if (isFolderLayout) {
66444
66525
  if (metadataWithType.isJson) {
66445
- metaPath = path10.dirname(scriptPath) + "/script.json";
66526
+ metaPath = path11.dirname(scriptPath) + "/script.json";
66446
66527
  newMetadataContent = JSON.stringify(metadataParsedContent);
66447
66528
  } else {
66448
- metaPath = path10.dirname(scriptPath) + "/script.yaml";
66529
+ metaPath = path11.dirname(scriptPath) + "/script.yaml";
66449
66530
  newMetadataContent = import_yaml13.stringify(metadataParsedContent, yamlOptions);
66450
66531
  }
66451
66532
  } else {
@@ -66475,8 +66556,8 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
66475
66556
  }
66476
66557
  return `${remotePath} (${language})`;
66477
66558
  }
66478
- async function updateScriptSchema(scriptContent, language, metadataContent, path11) {
66479
- const result = await inferSchema(language, scriptContent, metadataContent.schema, path11);
66559
+ async function updateScriptSchema(scriptContent, language, metadataContent, path12) {
66560
+ const result = await inferSchema(language, scriptContent, metadataContent.schema, path12);
66480
66561
  metadataContent.schema = result.schema;
66481
66562
  if (result.has_preprocessor) {
66482
66563
  metadataContent.has_preprocessor = result.has_preprocessor;
@@ -66630,7 +66711,7 @@ async function updateScriptLock(workspace, scriptContent, language, remotePath,
66630
66711
  async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath, rawWorkspaceDependencies, defaultTs, changedModules) {
66631
66712
  const entries = readdirSync(dirPath, { withFileTypes: true });
66632
66713
  for (const entry of entries) {
66633
- const fullPath = path10.join(dirPath, entry.name);
66714
+ const fullPath = path11.join(dirPath, entry.name);
66634
66715
  const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
66635
66716
  if (entry.isDirectory()) {
66636
66717
  await updateModuleLocks(workspace, fullPath, relPath, scriptRemotePath, rawWorkspaceDependencies, defaultTs, changedModules);
@@ -66654,12 +66735,12 @@ async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath
66654
66735
  try {
66655
66736
  const lock = await fetchScriptLock(workspace, moduleContent, modLanguage, moduleRemotePath, rawWorkspaceDependencies);
66656
66737
  const baseName = entry.name.replace(/\.[^.]+$/, "");
66657
- const lockPath = path10.join(dirPath, baseName + ".lock");
66738
+ const lockPath = path11.join(dirPath, baseName + ".lock");
66658
66739
  if (lock != "") {
66659
- writeFileSync3(lockPath, lock, "utf-8");
66740
+ writeFileSync4(lockPath, lock, "utf-8");
66660
66741
  } else {
66661
66742
  try {
66662
- if (existsSync4(lockPath)) {
66743
+ if (existsSync5(lockPath)) {
66663
66744
  const { rm: rmAsync } = await import("node:fs/promises");
66664
66745
  await rmAsync(lockPath);
66665
66746
  }
@@ -66671,7 +66752,7 @@ async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath
66671
66752
  }
66672
66753
  }
66673
66754
  }
66674
- async function inferSchema(language, content, currentSchema, path11) {
66755
+ async function inferSchema(language, content, currentSchema, path12) {
66675
66756
  let inferedSchema;
66676
66757
  if (language === "python3") {
66677
66758
  const { parse_python } = await loadParser("windmill-parser-wasm-py");
@@ -66774,7 +66855,7 @@ async function inferSchema(language, content, currentSchema, path11) {
66774
66855
  throw new Error("Invalid language: " + language);
66775
66856
  }
66776
66857
  if (inferedSchema.type == "Invalid") {
66777
- info(colors.yellow(`Script ${path11} invalid, it cannot be parsed to infer schema.`));
66858
+ info(colors.yellow(`Script ${path12} invalid, it cannot be parsed to infer schema.`));
66778
66859
  return {
66779
66860
  schema: defaultScriptMetadata().schema,
66780
66861
  has_preprocessor: false,
@@ -66946,15 +67027,15 @@ async function readLockfile() {
66946
67027
  return lock;
66947
67028
  }
66948
67029
  }
66949
- function v2LockPath(path11, subpath) {
66950
- const normalizedPath = normalizeLockPath(path11);
67030
+ function v2LockPath(path12, subpath) {
67031
+ const normalizedPath = normalizeLockPath(path12);
66951
67032
  if (subpath) {
66952
67033
  return `${normalizedPath}+${normalizeLockPath(subpath)}`;
66953
67034
  } else {
66954
67035
  return normalizedPath;
66955
67036
  }
66956
67037
  }
66957
- async function checkifMetadataUptodate(path11, hash2, conf, subpath) {
67038
+ async function checkifMetadataUptodate(path12, hash2, conf, subpath) {
66958
67039
  if (!conf) {
66959
67040
  conf = await readLockfile();
66960
67041
  }
@@ -66963,10 +67044,10 @@ async function checkifMetadataUptodate(path11, hash2, conf, subpath) {
66963
67044
  }
66964
67045
  const isV2 = conf?.version == "v2";
66965
67046
  if (isV2) {
66966
- const current = conf.locks?.[v2LockPath(path11, subpath)];
67047
+ const current = conf.locks?.[v2LockPath(path12, subpath)];
66967
67048
  return current == hash2;
66968
67049
  } else {
66969
- const obj = conf.locks?.[path11];
67050
+ const obj = conf.locks?.[path12];
66970
67051
  const current = subpath && typeof obj == "object" ? obj?.[subpath] : obj;
66971
67052
  return current == hash2;
66972
67053
  }
@@ -66979,7 +67060,7 @@ async function computeModuleHashes(moduleFolderPath, defaultTs, rawWorkspaceDepe
66979
67060
  async function readDir2(dirPath, relPrefix) {
66980
67061
  const entries = readdirSync(dirPath, { withFileTypes: true });
66981
67062
  for (const entry of entries) {
66982
- const fullPath = path10.join(dirPath, entry.name);
67063
+ const fullPath = path11.join(dirPath, entry.name);
66983
67064
  const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
66984
67065
  const isTopLevel = relPrefix === "";
66985
67066
  if (entry.isDirectory()) {
@@ -66999,14 +67080,14 @@ async function computeModuleHashes(moduleFolderPath, defaultTs, rawWorkspaceDepe
66999
67080
  await readDir2(moduleFolderPath, "");
67000
67081
  return hashes;
67001
67082
  }
67002
- async function clearGlobalLock(path11) {
67083
+ async function clearGlobalLock(path12) {
67003
67084
  const conf = await readLockfile();
67004
67085
  if (!conf?.locks) {
67005
67086
  conf.locks = {};
67006
67087
  }
67007
67088
  const isV2 = conf?.version == "v2";
67008
67089
  if (isV2) {
67009
- const key = v2LockPath(path11);
67090
+ const key = v2LockPath(path12);
67010
67091
  if (conf.locks) {
67011
67092
  Object.keys(conf.locks).forEach((k) => {
67012
67093
  if (conf.locks) {
@@ -67019,24 +67100,24 @@ async function clearGlobalLock(path11) {
67019
67100
  await writeFile8(WMILL_LOCKFILE, import_yaml13.stringify(conf, yamlOptions), "utf-8");
67020
67101
  }
67021
67102
  }
67022
- async function updateMetadataGlobalLock(path11, hash2, subpath) {
67103
+ async function updateMetadataGlobalLock(path12, hash2, subpath) {
67023
67104
  const conf = await readLockfile();
67024
67105
  if (!conf?.locks) {
67025
67106
  conf.locks = {};
67026
67107
  }
67027
67108
  const isV2 = conf?.version == "v2";
67028
67109
  if (isV2) {
67029
- conf.locks[v2LockPath(path11, subpath)] = hash2;
67110
+ conf.locks[v2LockPath(path12, subpath)] = hash2;
67030
67111
  } else {
67031
67112
  if (subpath) {
67032
- let prev = conf.locks[path11];
67113
+ let prev = conf.locks[path12];
67033
67114
  if (!prev || typeof prev != "object") {
67034
67115
  prev = {};
67035
- conf.locks[path11] = prev;
67116
+ conf.locks[path12] = prev;
67036
67117
  }
67037
67118
  prev[subpath] = hash2;
67038
67119
  } else {
67039
- conf.locks[path11] = hash2;
67120
+ conf.locks[path12] = hash2;
67040
67121
  }
67041
67122
  }
67042
67123
  await writeFile8(WMILL_LOCKFILE, import_yaml13.stringify(conf, yamlOptions), "utf-8");
@@ -67086,7 +67167,7 @@ __export(exports_raw_apps, {
67086
67167
  generatingPolicy: () => generatingPolicy
67087
67168
  });
67088
67169
  import { sep as SEP10 } from "node:path";
67089
- import path11 from "node:path";
67170
+ import path12 from "node:path";
67090
67171
  import { readFile as readFile10, readdir as readdir6 } from "node:fs/promises";
67091
67172
  async function findRunnableContentFile(backendPath, runnableId, allFiles) {
67092
67173
  for (const fileName of allFiles) {
@@ -67099,7 +67180,7 @@ async function findRunnableContentFile(backendPath, runnableId, allFiles) {
67099
67180
  const ext2 = fileName.substring(runnableId.length + 1);
67100
67181
  if (EXTENSION_TO_LANGUAGE[ext2]) {
67101
67182
  try {
67102
- const content = await readFile10(path11.join(backendPath, fileName), "utf-8");
67183
+ const content = await readFile10(path12.join(backendPath, fileName), "utf-8");
67103
67184
  return { ext: ext2, content };
67104
67185
  } catch {
67105
67186
  continue;
@@ -67136,7 +67217,7 @@ async function loadRunnablesFromBackend(backendPath, defaultTs = "bun") {
67136
67217
  }
67137
67218
  const runnableId = fileName.replace(".yaml", "");
67138
67219
  processedIds.add(runnableId);
67139
- const filePath = path11.join(backendPath, fileName);
67220
+ const filePath = path12.join(backendPath, fileName);
67140
67221
  const runnable = await yamlParseFile(filePath);
67141
67222
  if (runnable?.type === "inline") {
67142
67223
  const contentFile = await findRunnableContentFile(backendPath, runnableId, allFiles);
@@ -67144,7 +67225,7 @@ async function loadRunnablesFromBackend(backendPath, defaultTs = "bun") {
67144
67225
  const language = getLanguageFromExtension(contentFile.ext, defaultTs);
67145
67226
  let lock;
67146
67227
  try {
67147
- lock = await readFile10(path11.join(backendPath, `${runnableId}.lock`), "utf-8");
67228
+ lock = await readFile10(path12.join(backendPath, `${runnableId}.lock`), "utf-8");
67148
67229
  } catch {}
67149
67230
  runnable.inlineScript = {
67150
67231
  content: contentFile.content,
@@ -67175,7 +67256,7 @@ async function loadRunnablesFromBackend(backendPath, defaultTs = "bun") {
67175
67256
  const language = getLanguageFromExtension(contentFile.ext, defaultTs);
67176
67257
  let lock;
67177
67258
  try {
67178
- lock = await readFile10(path11.join(backendPath, `${runnableId}.lock`), "utf-8");
67259
+ lock = await readFile10(path12.join(backendPath, `${runnableId}.lock`), "utf-8");
67179
67260
  } catch {}
67180
67261
  runnables[runnableId] = {
67181
67262
  type: "inline",
@@ -67203,7 +67284,7 @@ function writeRunnableToBackend(backendPath, runnableId, runnable) {
67203
67284
  ...rest
67204
67285
  };
67205
67286
  }
67206
- const filePath = path11.join(backendPath, `${runnableId}.yaml`);
67287
+ const filePath = path12.join(backendPath, `${runnableId}.yaml`);
67207
67288
  writeIfChanged(filePath, import_yaml16.stringify(runnableToWrite, yamlOptions));
67208
67289
  }
67209
67290
  async function collectAppFiles(localPath) {
@@ -67254,7 +67335,7 @@ async function pushRawApp(workspace, remotePath, localPath, message) {
67254
67335
  }
67255
67336
  const appFilePath = localPath + "raw_app.yaml";
67256
67337
  const localApp = await yamlParseFile(appFilePath);
67257
- const backendPath = path11.join(localPath, APP_BACKEND_FOLDER);
67338
+ const backendPath = path12.join(localPath, APP_BACKEND_FOLDER);
67258
67339
  const runnablesFromBackend = await loadRunnablesFromBackend(backendPath);
67259
67340
  let runnables;
67260
67341
  if (Object.keys(runnablesFromBackend).length > 0) {
@@ -67330,13 +67411,13 @@ async function pushRawApp(workspace, remotePath, localPath, message) {
67330
67411
  });
67331
67412
  }
67332
67413
  }
67333
- async function generatingPolicy(app, path12, publicApp) {
67334
- info(colors.gray(`Generating fresh policy for app ${path12}...`));
67414
+ async function generatingPolicy(app, path13, publicApp) {
67415
+ info(colors.gray(`Generating fresh policy for app ${path13}...`));
67335
67416
  try {
67336
67417
  app.policy = await updateRawAppPolicy(app.runnables, app.policy);
67337
67418
  app.policy.execution_mode = publicApp ? "anonymous" : "publisher";
67338
67419
  } catch (e) {
67339
- error(colors.red(`Error generating policy for app ${path12}: ${e}`));
67420
+ error(colors.red(`Error generating policy for app ${path13}: ${e}`));
67340
67421
  throw e;
67341
67422
  }
67342
67423
  }
@@ -67373,11 +67454,11 @@ __export(exports_app_metadata, {
67373
67454
  filterWorkspaceDependenciesForApp: () => filterWorkspaceDependenciesForApp,
67374
67455
  APP_BACKEND_FOLDER: () => APP_BACKEND_FOLDER
67375
67456
  });
67376
- import path12 from "node:path";
67457
+ import path13 from "node:path";
67377
67458
  import { readFile as readFile11, mkdir as mkdir6 } from "node:fs/promises";
67378
67459
  import { sep as SEP11 } from "node:path";
67379
67460
  async function generateAppHash(rawReqs, folder, rawApp, defaultTs) {
67380
- const runnablesFolder = rawApp ? path12.join(folder, APP_BACKEND_FOLDER) : folder;
67461
+ const runnablesFolder = rawApp ? path13.join(folder, APP_BACKEND_FOLDER) : folder;
67381
67462
  const hashes = {};
67382
67463
  try {
67383
67464
  const elems = await FSFSElement(runnablesFolder, [], true);
@@ -67412,7 +67493,7 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
67412
67493
  if (!justUpdateMetadataLock && !noStaleMessage) {
67413
67494
  info(`Generating locks for app ${appFolder} at ${remote_path}`);
67414
67495
  }
67415
- const appFilePath = path12.join(appFolder, rawApp ? "raw_app.yaml" : "app.yaml");
67496
+ const appFilePath = path13.join(appFolder, rawApp ? "raw_app.yaml" : "app.yaml");
67416
67497
  const appFile = await yamlParseFile(appFilePath);
67417
67498
  const appValue = rawApp ? appFile.runnables : appFile.value;
67418
67499
  const folderNormalized = appFolder.replaceAll(SEP11, "/");
@@ -67424,7 +67505,7 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
67424
67505
  const isDirectlyStale = !await checkifMetadataUptodate(appFolder, hashes[TOP_HASH2], conf, TOP_HASH2);
67425
67506
  let treeAppValue = structuredClone(appValue);
67426
67507
  if (rawApp) {
67427
- const runnablesPath = path12.join(appFolder, APP_BACKEND_FOLDER);
67508
+ const runnablesPath = path13.join(appFolder, APP_BACKEND_FOLDER);
67428
67509
  const runnablesFromFiles = await loadRunnablesFromBackend(runnablesPath);
67429
67510
  if (Object.keys(runnablesFromFiles).length > 0) {
67430
67511
  treeAppValue = runnablesFromFiles;
@@ -67490,7 +67571,7 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
67490
67571
  info(`Recomputing locks of ${changedScripts.join(", ")} in ${appFolder}`);
67491
67572
  }
67492
67573
  if (rawApp) {
67493
- const runnablesPath = path12.join(appFolder, APP_BACKEND_FOLDER);
67574
+ const runnablesPath = path13.join(appFolder, APP_BACKEND_FOLDER);
67494
67575
  const rawAppFile = appFile;
67495
67576
  let runnables = await loadRunnablesFromBackend(runnablesPath);
67496
67577
  if (Object.keys(runnables).length === 0 && rawAppFile.runnables) {
@@ -67563,7 +67644,7 @@ async function traverseAndProcessInlineScripts(obj, processor, currentPath = [])
67563
67644
  }
67564
67645
  async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder, rawDeps, defaultTs = "bun", noStaleMessage, tempScriptRefs) {
67565
67646
  const updatedRunnables = [];
67566
- const runnablesFolder = path12.join(appFolder, APP_BACKEND_FOLDER);
67647
+ const runnablesFolder = path13.join(appFolder, APP_BACKEND_FOLDER);
67567
67648
  try {
67568
67649
  await mkdir6(runnablesFolder, { recursive: true });
67569
67650
  } catch {}
@@ -67588,7 +67669,7 @@ async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder
67588
67669
  if (language === "frontend") {
67589
67670
  const [basePathO, ext2] = pathAssigner.assignPath(runnableId, language);
67590
67671
  const basePath = basePathO.replaceAll(SEP11, "/");
67591
- const contentPath = path12.join(runnablesFolder, `${basePath}${ext2}`);
67672
+ const contentPath = path13.join(runnablesFolder, `${basePath}${ext2}`);
67592
67673
  writeIfChanged(contentPath, content);
67593
67674
  const simplifiedRunnable = { type: "inline" };
67594
67675
  for (const [key, value] of Object.entries(runnable)) {
@@ -67606,8 +67687,8 @@ async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder
67606
67687
  const lock = await generateInlineScriptLock(workspace, content, language, `${remotePath}/${runnableId}`, rawDeps, tempScriptRefs);
67607
67688
  const [basePathO, ext2] = pathAssigner.assignPath(runnableId, language);
67608
67689
  const basePath = basePathO.replaceAll(SEP11, "/");
67609
- const contentPath = path12.join(runnablesFolder, `${basePath}${ext2}`);
67610
- const lockPath = path12.join(runnablesFolder, `${basePath}lock`);
67690
+ const contentPath = path13.join(runnablesFolder, `${basePath}${ext2}`);
67691
+ const lockPath = path13.join(runnablesFolder, `${basePath}lock`);
67611
67692
  writeIfChanged(contentPath, content);
67612
67693
  if (lock && lock !== "") {
67613
67694
  writeIfChanged(lockPath, lock);
@@ -67655,8 +67736,8 @@ async function updateAppInlineScripts(workspace, appValue, remotePath, appFolder
67655
67736
  }
67656
67737
  const [basePathO, ext2] = pathAssigner.assignPath(scriptName, language);
67657
67738
  const basePath = basePathO.replaceAll(SEP11, "/");
67658
- const contentPath = path12.join(appFolder, `${basePath}${ext2}`);
67659
- const lockPath = path12.join(appFolder, `${basePath}lock`);
67739
+ const contentPath = path13.join(appFolder, `${basePath}${ext2}`);
67740
+ const lockPath = path13.join(appFolder, `${basePath}lock`);
67660
67741
  writeIfChanged(contentPath, content);
67661
67742
  if (lock && lock !== "") {
67662
67743
  writeIfChanged(lockPath, lock);
@@ -67727,7 +67808,7 @@ ${text}`);
67727
67808
  }
67728
67809
  }
67729
67810
  async function inferRunnableSchemaFromFile(appFolder, runnableFilePath) {
67730
- const fileName = path12.basename(runnableFilePath);
67811
+ const fileName = path13.basename(runnableFilePath);
67731
67812
  if (fileName.endsWith(".lock") || fileName.endsWith(".yaml")) {
67732
67813
  return;
67733
67814
  }
@@ -67736,13 +67817,13 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath) {
67736
67817
  return;
67737
67818
  }
67738
67819
  const runnableId = match2[1];
67739
- const runnableFilePath2 = path12.join(appFolder, APP_BACKEND_FOLDER, `${runnableId}.yaml`);
67820
+ const runnableFilePath2 = path13.join(appFolder, APP_BACKEND_FOLDER, `${runnableId}.yaml`);
67740
67821
  let runnable;
67741
67822
  try {
67742
67823
  runnable = await yamlParseFile(runnableFilePath2);
67743
67824
  } catch {
67744
67825
  try {
67745
- const appFilePath = path12.join(appFolder, "raw_app.yaml");
67826
+ const appFilePath = path13.join(appFolder, "raw_app.yaml");
67746
67827
  const appFile = await yamlParseFile(appFilePath);
67747
67828
  if (!appFile.runnables?.[runnableId]) {
67748
67829
  warn(colors.yellow(`Runnable ${runnableId} not found in backend folder or raw_app.yaml`));
@@ -67759,7 +67840,7 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath) {
67759
67840
  }
67760
67841
  const inlineScript = runnable.inlineScript;
67761
67842
  const language = inlineScript.language;
67762
- const fullFilePath = path12.join(appFolder, APP_BACKEND_FOLDER, runnableFilePath);
67843
+ const fullFilePath = path13.join(appFolder, APP_BACKEND_FOLDER, runnableFilePath);
67763
67844
  let content;
67764
67845
  try {
67765
67846
  content = await readFile11(fullFilePath, "utf-8");
@@ -67869,8 +67950,8 @@ var init_app_metadata = __esm(async () => {
67869
67950
  // src/commands/app/generate_agents.ts
67870
67951
  import * as fs9 from "node:fs";
67871
67952
  import { writeFile as writeFile9 } from "node:fs/promises";
67872
- import path13 from "node:path";
67873
- import process14 from "node:process";
67953
+ import path14 from "node:path";
67954
+ import process15 from "node:process";
67874
67955
  function generateDatatablesMarkdown(schemas, localData) {
67875
67956
  const defaultDatatable = localData?.datatable;
67876
67957
  const defaultSchema = localData?.schema;
@@ -67969,7 +68050,7 @@ Configure datatables in Workspace Settings > Windmill Data Tables.
67969
68050
  return content;
67970
68051
  }
67971
68052
  async function regenerateAgentDocs(workspaceId, targetDir, silent = false) {
67972
- const rawAppPath = path13.join(targetDir, "raw_app.yaml");
68053
+ const rawAppPath = path14.join(targetDir, "raw_app.yaml");
67973
68054
  if (!fs9.existsSync(rawAppPath)) {
67974
68055
  if (!silent) {
67975
68056
  error(colors.red(`Error: raw_app.yaml not found in ${targetDir}`));
@@ -67996,11 +68077,11 @@ async function regenerateAgentDocs(workspaceId, targetDir, silent = false) {
67996
68077
  }
67997
68078
  } catch {}
67998
68079
  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
68080
+ await writeFile9(path14.join(targetDir, "AGENTS.md"), agentsContent, "utf-8");
68081
+ await writeFile9(path14.join(targetDir, "CLAUDE.md"), `Instructions are in @AGENTS.md
68001
68082
  `, "utf-8");
68002
68083
  const datatablesContent = generateDatatablesMarkdown(schemas, localData);
68003
- await writeFile9(path13.join(targetDir, "DATATABLES.md"), datatablesContent, "utf-8");
68084
+ await writeFile9(path14.join(targetDir, "DATATABLES.md"), datatablesContent, "utf-8");
68004
68085
  if (!silent) {
68005
68086
  info(colors.green(`✓ Generated AGENTS.md, CLAUDE.md, and DATATABLES.md`));
68006
68087
  const datatableCount = schemas.length;
@@ -68018,24 +68099,24 @@ async function regenerateAgentDocs(workspaceId, targetDir, silent = false) {
68018
68099
  }
68019
68100
  }
68020
68101
  async function generateAgents(opts, appFolder) {
68021
- const cwd = process14.cwd();
68102
+ const cwd = process15.cwd();
68022
68103
  let targetDir = cwd;
68023
68104
  if (appFolder) {
68024
- targetDir = path13.isAbsolute(appFolder) ? appFolder : path13.join(cwd, appFolder);
68105
+ targetDir = path14.isAbsolute(appFolder) ? appFolder : path14.join(cwd, appFolder);
68025
68106
  }
68026
68107
  await loadNonDottedPathsSetting();
68027
- const dirName = path13.basename(targetDir);
68108
+ const dirName = path14.basename(targetDir);
68028
68109
  if (!hasFolderSuffix(dirName, "raw_app")) {
68029
- if (!hasFolderSuffix(path13.basename(cwd), "raw_app") && !appFolder) {
68110
+ if (!hasFolderSuffix(path14.basename(cwd), "raw_app") && !appFolder) {
68030
68111
  error(colors.red(`Error: Must be run inside a ${getFolderSuffix("raw_app")} folder or specify one as argument.`));
68031
68112
  info(colors.gray("Usage: wmill app generate-agents [app_folder]"));
68032
- process14.exit(1);
68113
+ process15.exit(1);
68033
68114
  }
68034
68115
  }
68035
- const rawAppPath = path13.join(targetDir, "raw_app.yaml");
68116
+ const rawAppPath = path14.join(targetDir, "raw_app.yaml");
68036
68117
  if (!fs9.existsSync(rawAppPath)) {
68037
68118
  error(colors.red(`Error: raw_app.yaml not found in ${targetDir}`));
68038
- process14.exit(1);
68119
+ process15.exit(1);
68039
68120
  }
68040
68121
  const workspace = await resolveWorkspace(opts);
68041
68122
  await requireLogin(opts);
@@ -68062,40 +68143,40 @@ var init_generate_agents = __esm(async () => {
68062
68143
  import { sep as SEP12 } from "node:path";
68063
68144
  import * as http2 from "node:http";
68064
68145
  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";
68146
+ import * as path15 from "node:path";
68147
+ import process16 from "node:process";
68148
+ import { writeFileSync as writeFileSync5 } from "node:fs";
68068
68149
  import { readFile as readFile12 } from "node:fs/promises";
68069
68150
  async function dev(opts, appFolder) {
68070
68151
  GLOBAL_CONFIG_OPT.noCdToRoot = true;
68071
68152
  await loadNonDottedPathsSetting();
68072
- const originalCwd = process15.cwd();
68153
+ const originalCwd = process16.cwd();
68073
68154
  let targetDir = originalCwd;
68074
68155
  if (appFolder) {
68075
- targetDir = path14.isAbsolute(appFolder) ? appFolder : path14.join(originalCwd, appFolder);
68156
+ targetDir = path15.isAbsolute(appFolder) ? appFolder : path15.join(originalCwd, appFolder);
68076
68157
  if (!fs10.existsSync(targetDir)) {
68077
68158
  error(colors.red(`Error: Directory not found: ${targetDir}`));
68078
- process15.exit(1);
68159
+ process16.exit(1);
68079
68160
  }
68080
68161
  }
68081
- const targetDirName = path14.basename(targetDir);
68162
+ const targetDirName = path15.basename(targetDir);
68082
68163
  if (!hasFolderSuffix(targetDirName, "raw_app")) {
68083
68164
  error(colors.red(`Error: The dev command must be run inside a ${getFolderSuffix("raw_app")} folder.
68084
68165
  ` + `Target directory: ${targetDirName}
68085
68166
  ` + `Please navigate to a folder ending with '${getFolderSuffix("raw_app")}' or specify one as argument.`));
68086
- process15.exit(1);
68167
+ process16.exit(1);
68087
68168
  }
68088
- const rawAppPath = path14.join(targetDir, "raw_app.yaml");
68169
+ const rawAppPath = path15.join(targetDir, "raw_app.yaml");
68089
68170
  if (!fs10.existsSync(rawAppPath)) {
68090
68171
  error(colors.red(`Error: raw_app.yaml not found in ${targetDir}.
68091
68172
  ` + `The dev command requires a ${getFolderSuffix("raw_app")} folder containing a raw_app.yaml file.`));
68092
- process15.exit(1);
68173
+ process16.exit(1);
68093
68174
  }
68094
68175
  const workspace = await resolveWorkspace(opts);
68095
68176
  await requireLogin(opts);
68096
68177
  const workspaceId = workspace.workspaceId;
68097
68178
  if (appFolder) {
68098
- process15.chdir(targetDir);
68179
+ process16.chdir(targetDir);
68099
68180
  }
68100
68181
  const rawApp = await yamlParseFile(rawAppPath);
68101
68182
  const appPath = rawApp?.custom_path ?? "u/unknown/newapp";
@@ -68105,18 +68186,18 @@ async function dev(opts, appFolder) {
68105
68186
  });
68106
68187
  const host = opts.host ?? DEFAULT_HOST;
68107
68188
  const shouldOpen = opts.open ?? true;
68108
- const frameworks = detectFrameworks(process15.cwd());
68189
+ const frameworks = detectFrameworks(process16.cwd());
68109
68190
  const defaultEntry = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
68110
68191
  const entryPoint = opts.entry ?? defaultEntry;
68111
68192
  if (!fs10.existsSync(entryPoint)) {
68112
68193
  error(colors.red(`Entry point "${entryPoint}" not found. Please specify a valid entry point with --entry.`));
68113
- process15.exit(1);
68194
+ process16.exit(1);
68114
68195
  }
68115
- const appDir = path14.dirname(entryPoint) || process15.cwd();
68196
+ const appDir = path15.dirname(entryPoint) || process16.cwd();
68116
68197
  await ensureNodeModules(appDir);
68117
68198
  const inferredSchemas = {};
68118
68199
  genRunnablesTs(inferredSchemas);
68119
- const distDir = path14.join(process15.cwd(), "dist");
68200
+ const distDir = path15.join(process16.cwd(), "dist");
68120
68201
  if (!fs10.existsSync(distDir)) {
68121
68202
  fs10.mkdirSync(distDir);
68122
68203
  }
@@ -68179,7 +68260,7 @@ data: reload
68179
68260
  info(colors.blue(`\uD83D\uDC40 Watching for file changes...
68180
68261
  `));
68181
68262
  await ctx.rebuild();
68182
- const runnablesPath = path14.join(process15.cwd(), APP_BACKEND_FOLDER);
68263
+ const runnablesPath = path15.join(process16.cwd(), APP_BACKEND_FOLDER);
68183
68264
  let runnablesWatcher;
68184
68265
  if (fs10.existsSync(runnablesPath)) {
68185
68266
  info(colors.blue(`\uD83D\uDC41️ Watching runnables folder at: ${runnablesPath}
@@ -68191,8 +68272,8 @@ data: reload
68191
68272
  if (!filename)
68192
68273
  return;
68193
68274
  const fileStr = typeof filename === "string" ? filename : filename.toString();
68194
- const changedPath = path14.join(runnablesPath, fileStr);
68195
- const relativePath = path14.relative(process15.cwd(), changedPath);
68275
+ const changedPath = path15.join(runnablesPath, fileStr);
68276
+ const relativePath = path15.relative(process16.cwd(), changedPath);
68196
68277
  const relativeToRunnables = fileStr;
68197
68278
  if (changedPath.endsWith(".lock")) {
68198
68279
  return;
@@ -68205,7 +68286,7 @@ data: reload
68205
68286
  delete schemaInferenceTimeouts[changedPath];
68206
68287
  try {
68207
68288
  info(colors.cyan(`\uD83D\uDCDD Inferring schema for: ${relativeToRunnables}`));
68208
- const result = await inferRunnableSchemaFromFile(process15.cwd(), relativeToRunnables);
68289
+ const result = await inferRunnableSchemaFromFile(process16.cwd(), relativeToRunnables);
68209
68290
  if (result) {
68210
68291
  inferredSchemas[result.runnableId] = result.schema;
68211
68292
  info(colors.green(` Inferred Schemas: ${JSON.stringify(inferredSchemas, null, 2)}`));
@@ -68243,7 +68324,7 @@ data: reload
68243
68324
  return;
68244
68325
  }
68245
68326
  if (url === "/dist/bundle.js" || url === "/bundle.js") {
68246
- const jsPath = path14.join(process15.cwd(), "dist/bundle.js");
68327
+ const jsPath = path15.join(process16.cwd(), "dist/bundle.js");
68247
68328
  if (fs10.existsSync(jsPath)) {
68248
68329
  res.writeHead(200, { "Content-Type": "application/javascript" });
68249
68330
  res.end(fs10.readFileSync(jsPath));
@@ -68254,7 +68335,7 @@ data: reload
68254
68335
  return;
68255
68336
  }
68256
68337
  if (url === "/dist/bundle.css" || url === "/bundle.css") {
68257
- const cssPath = path14.join(process15.cwd(), "dist/bundle.css");
68338
+ const cssPath = path15.join(process16.cwd(), "dist/bundle.css");
68258
68339
  if (fs10.existsSync(cssPath)) {
68259
68340
  res.writeHead(200, { "Content-Type": "text/css" });
68260
68341
  res.end(fs10.readFileSync(cssPath));
@@ -68265,7 +68346,7 @@ data: reload
68265
68346
  return;
68266
68347
  }
68267
68348
  if (url === "/dist/bundle.js.map" || url === "/bundle.js.map") {
68268
- const mapPath = path14.join(process15.cwd(), "dist/bundle.js.map");
68349
+ const mapPath = path15.join(process16.cwd(), "dist/bundle.js.map");
68269
68350
  if (fs10.existsSync(mapPath)) {
68270
68351
  res.writeHead(200, { "Content-Type": "application/json" });
68271
68352
  res.end(fs10.readFileSync(mapPath));
@@ -68276,7 +68357,7 @@ data: reload
68276
68357
  return;
68277
68358
  }
68278
68359
  if (url === "/dist/bundle.css.map" || url === "/bundle.css.map") {
68279
- const mapPath = path14.join(process15.cwd(), "dist/bundle.css.map");
68360
+ const mapPath = path15.join(process16.cwd(), "dist/bundle.css.map");
68280
68361
  if (fs10.existsSync(mapPath)) {
68281
68362
  res.writeHead(200, { "Content-Type": "application/json" });
68282
68363
  res.end(fs10.readFileSync(mapPath));
@@ -68290,12 +68371,12 @@ data: reload
68290
68371
  res.end(createHTML("/dist/bundle.js", "/dist/bundle.css"));
68291
68372
  });
68292
68373
  const wss = new import_websocket_server.default({ server });
68293
- const sqlToApplyPath = path14.join(process15.cwd(), "sql_to_apply");
68374
+ const sqlToApplyPath = path15.join(process16.cwd(), "sql_to_apply");
68294
68375
  const sqlFileQueue = [];
68295
68376
  let currentSqlFile = null;
68296
68377
  async function getDatatableConfig() {
68297
68378
  try {
68298
- const rawApp2 = await yamlParseFile(path14.join(process15.cwd(), "raw_app.yaml"));
68379
+ const rawApp2 = await yamlParseFile(path15.join(process16.cwd(), "raw_app.yaml"));
68299
68380
  return rawApp2?.data?.datatable;
68300
68381
  } catch {
68301
68382
  return;
@@ -68332,12 +68413,12 @@ data: reload
68332
68413
  }
68333
68414
  const filePath = sqlFileQueue.shift();
68334
68415
  if (!fs10.existsSync(filePath)) {
68335
- info(colors.gray(`File no longer exists: ${path14.basename(filePath)}`));
68416
+ info(colors.gray(`File no longer exists: ${path15.basename(filePath)}`));
68336
68417
  await processNextSqlFile();
68337
68418
  return;
68338
68419
  }
68339
68420
  currentSqlFile = filePath;
68340
- const fileName = path14.basename(filePath);
68421
+ const fileName = path15.basename(filePath);
68341
68422
  try {
68342
68423
  const sqlContent = await readFile12(filePath, "utf-8");
68343
68424
  if (!sqlContent.trim()) {
@@ -68359,9 +68440,9 @@ data: reload
68359
68440
  if (deleteFile && fs10.existsSync(filePath)) {
68360
68441
  try {
68361
68442
  fs10.unlinkSync(filePath);
68362
- info(colors.green(`✓ Deleted: ${path14.basename(filePath)}`));
68443
+ info(colors.green(`✓ Deleted: ${path15.basename(filePath)}`));
68363
68444
  } catch (error2) {
68364
- error(colors.red(`Failed to delete ${path14.basename(filePath)}: ${error2.message}`));
68445
+ error(colors.red(`Failed to delete ${path15.basename(filePath)}: ${error2.message}`));
68365
68446
  }
68366
68447
  }
68367
68448
  currentSqlFile = null;
@@ -68373,7 +68454,7 @@ data: reload
68373
68454
  try {
68374
68455
  const sqlContent = await readFile12(currentSqlFile, "utf-8");
68375
68456
  const datatable = await getDatatableConfig();
68376
- const fileName = path14.basename(currentSqlFile);
68457
+ const fileName = path15.basename(currentSqlFile);
68377
68458
  ws.send(JSON.stringify({
68378
68459
  type: "sqlMigration",
68379
68460
  fileName,
@@ -68387,7 +68468,7 @@ data: reload
68387
68468
  const sqlFiles = entries.filter((entry) => entry.endsWith(".sql"));
68388
68469
  if (sqlFiles.length > 0 && sqlFileQueue.length === 0) {
68389
68470
  for (const sqlFile of sqlFiles.sort()) {
68390
- queueSqlFile(path14.join(sqlToApplyPath, sqlFile));
68471
+ queueSqlFile(path15.join(sqlToApplyPath, sqlFile));
68391
68472
  }
68392
68473
  await processNextSqlFile();
68393
68474
  }
@@ -68514,7 +68595,7 @@ data: reload
68514
68595
  await onSqlFileCompleted(currentSqlFile, true);
68515
68596
  }
68516
68597
  try {
68517
- await regenerateAgentDocs(workspaceId, process15.cwd(), true);
68598
+ await regenerateAgentDocs(workspaceId, process16.cwd(), true);
68518
68599
  info(colors.gray(`[SQL Migration] Refreshed AGENTS.md and DATATABLES.md`));
68519
68600
  } catch (regenError) {
68520
68601
  warn(colors.yellow(`[SQL Migration] Could not refresh docs: ${regenError.message}`));
@@ -68566,7 +68647,7 @@ data: reload
68566
68647
  }
68567
68648
  info(colors.blue(`\uD83D\uDD0D Found ${sqlFiles.length} SQL file(s) in sql_to_apply/`));
68568
68649
  for (const sqlFile of sqlFiles) {
68569
- const filePath = path14.join(sqlToApplyPath, sqlFile);
68650
+ const filePath = path15.join(sqlToApplyPath, sqlFile);
68570
68651
  queueSqlFile(filePath);
68571
68652
  }
68572
68653
  await processNextSqlFile();
@@ -68584,11 +68665,11 @@ data: reload
68584
68665
  if (!filename)
68585
68666
  return;
68586
68667
  const fileStr = typeof filename === "string" ? filename : filename.toString();
68587
- const changedPath = path14.join(sqlToApplyPath, fileStr);
68668
+ const changedPath = path15.join(sqlToApplyPath, fileStr);
68588
68669
  if (!changedPath.endsWith(".sql")) {
68589
68670
  return;
68590
68671
  }
68591
- const fileName = path14.basename(changedPath);
68672
+ const fileName = path15.basename(changedPath);
68592
68673
  if (sqlDebounceTimeouts[changedPath]) {
68593
68674
  clearTimeout(sqlDebounceTimeouts[changedPath]);
68594
68675
  }
@@ -68613,7 +68694,7 @@ data: reload
68613
68694
  const url = `http://${host}:${port}`;
68614
68695
  info(colors.bold.green(`\uD83D\uDE80 Dev server running at ${url}`));
68615
68696
  info(colors.cyan(`\uD83D\uDD0C WebSocket server running at ws://${host}:${port}`));
68616
- info(colors.gray(`\uD83D\uDCE6 Serving files from: ${process15.cwd()}`));
68697
+ info(colors.gray(`\uD83D\uDCE6 Serving files from: ${process16.cwd()}`));
68617
68698
  info(colors.gray(`\uD83D\uDD04 Live reload enabled
68618
68699
  `));
68619
68700
  if (shouldOpen) {
@@ -68627,7 +68708,7 @@ data: reload
68627
68708
  }
68628
68709
  }
68629
68710
  });
68630
- process15.on("SIGINT", async () => {
68711
+ process16.on("SIGINT", async () => {
68631
68712
  info(colors.yellow(`
68632
68713
 
68633
68714
  \uD83D\uDED1 Shutting down...`));
@@ -68640,17 +68721,17 @@ data: reload
68640
68721
  sqlWatcher.close();
68641
68722
  }
68642
68723
  await ctx.dispose();
68643
- process15.exit(0);
68724
+ process16.exit(0);
68644
68725
  });
68645
68726
  }
68646
68727
  async function genRunnablesTs(schemaOverrides = {}) {
68647
68728
  info(colors.blue("\uD83D\uDD04 Generating wmill.d.ts..."));
68648
- const localPath = process15.cwd();
68649
- const backendPath = path14.join(localPath, APP_BACKEND_FOLDER);
68729
+ const localPath = process16.cwd();
68730
+ const backendPath = path15.join(localPath, APP_BACKEND_FOLDER);
68650
68731
  let runnables = await loadRunnablesFromBackend(backendPath);
68651
68732
  if (Object.keys(runnables).length === 0) {
68652
68733
  try {
68653
- const rawApp = await yamlParseFile(path14.join(localPath, "raw_app.yaml"));
68734
+ const rawApp = await yamlParseFile(path15.join(localPath, "raw_app.yaml"));
68654
68735
  runnables = rawApp?.["runnables"] ?? {};
68655
68736
  } catch {
68656
68737
  runnables = {};
@@ -68666,7 +68747,7 @@ async function genRunnablesTs(schemaOverrides = {}) {
68666
68747
  }
68667
68748
  try {
68668
68749
  const newWmillTs = genWmillTs(runnables);
68669
- writeFileSync4(path14.join(process15.cwd(), "wmill.d.ts"), newWmillTs);
68750
+ writeFileSync5(path15.join(process16.cwd(), "wmill.d.ts"), newWmillTs);
68670
68751
  } catch (error2) {
68671
68752
  error(colors.red(`Failed to generate wmill.d.ts: ${error2.message}`));
68672
68753
  }
@@ -68683,11 +68764,11 @@ function convertRunnablesToApiFormat(runnables) {
68683
68764
  }
68684
68765
  async function loadRunnables() {
68685
68766
  try {
68686
- const localPath = process15.cwd();
68687
- const backendPath = path14.join(localPath, APP_BACKEND_FOLDER);
68767
+ const localPath = process16.cwd();
68768
+ const backendPath = path15.join(localPath, APP_BACKEND_FOLDER);
68688
68769
  let runnables = await loadRunnablesFromBackend(backendPath);
68689
68770
  if (Object.keys(runnables).length === 0) {
68690
- const rawApp = await yamlParseFile(path14.join(localPath, "raw_app.yaml"));
68771
+ const rawApp = await yamlParseFile(path15.join(localPath, "raw_app.yaml"));
68691
68772
  runnables = rawApp?.runnables ?? {};
68692
68773
  }
68693
68774
  convertRunnablesToApiFormat(runnables);
@@ -69168,8 +69249,8 @@ var init_dev = __esm(async () => {
69168
69249
 
69169
69250
  // src/commands/app/lint.ts
69170
69251
  import * as fs11 from "node:fs";
69171
- import * as path15 from "node:path";
69172
- import process16 from "node:process";
69252
+ import * as path16 from "node:path";
69253
+ import process17 from "node:process";
69173
69254
  function validateRawAppYaml(appData) {
69174
69255
  const errors = [];
69175
69256
  const warnings = [];
@@ -69183,7 +69264,7 @@ function validateRawAppYaml(appData) {
69183
69264
  async function validateRunnables(appDir, appData) {
69184
69265
  const errors = [];
69185
69266
  const warnings = [];
69186
- const backendPath = path15.join(appDir, APP_BACKEND_FOLDER);
69267
+ const backendPath = path16.join(appDir, APP_BACKEND_FOLDER);
69187
69268
  const runnablesFromBackend = await loadRunnablesFromBackend(backendPath);
69188
69269
  const hasBackendRunnables = Object.keys(runnablesFromBackend).length > 0;
69189
69270
  const hasYamlRunnables = appData.runnables && typeof appData.runnables === "object" && !Array.isArray(appData.runnables) && Object.keys(appData.runnables).length > 0;
@@ -69206,7 +69287,7 @@ async function validateBuild(appDir) {
69206
69287
  info(colors.blue("\uD83D\uDD28 Testing build..."));
69207
69288
  const frameworks = detectFrameworks(appDir);
69208
69289
  const entryFile = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
69209
- const entryPoint = path15.join(appDir, entryFile);
69290
+ const entryPoint = path16.join(appDir, entryFile);
69210
69291
  await createBundle({
69211
69292
  entryPoint,
69212
69293
  production: true,
@@ -69221,12 +69302,12 @@ async function validateBuild(appDir) {
69221
69302
  async function lintRawApp(appDir, opts) {
69222
69303
  const errors = [];
69223
69304
  const warnings = [];
69224
- const currentDirName = path15.basename(appDir);
69305
+ const currentDirName = path16.basename(appDir);
69225
69306
  if (!hasFolderSuffix(currentDirName, "raw_app")) {
69226
69307
  errors.push(`Not a raw app folder: '${currentDirName}' does not end with '${getFolderSuffix("raw_app")}'`);
69227
69308
  return { valid: false, errors, warnings };
69228
69309
  }
69229
- const rawAppPath = path15.join(appDir, "raw_app.yaml");
69310
+ const rawAppPath = path16.join(appDir, "raw_app.yaml");
69230
69311
  if (!fs11.existsSync(rawAppPath)) {
69231
69312
  errors.push("Missing raw_app.yaml file");
69232
69313
  return { valid: false, errors, warnings };
@@ -69265,7 +69346,7 @@ async function lintRawApp(appDir, opts) {
69265
69346
  }
69266
69347
  async function lint2(opts, appFolder) {
69267
69348
  await loadNonDottedPathsSetting();
69268
- const targetDir = appFolder ?? process16.cwd();
69349
+ const targetDir = appFolder ?? process17.cwd();
69269
69350
  info(colors.bold.blue(`
69270
69351
  \uD83D\uDD0D Linting raw app: ${targetDir}
69271
69352
  `));
@@ -69286,7 +69367,7 @@ async function lint2(opts, appFolder) {
69286
69367
  info(colors.red(`
69287
69368
  ❌ Lint failed
69288
69369
  `));
69289
- process16.exit(1);
69370
+ process17.exit(1);
69290
69371
  }
69291
69372
  info(colors.green(`
69292
69373
  ✅ All checks passed
@@ -69310,7 +69391,7 @@ var init_lint2 = __esm(async () => {
69310
69391
 
69311
69392
  // src/commands/app/new.ts
69312
69393
  import { stat as stat9, writeFile as writeFile10, mkdir as mkdir7 } from "node:fs/promises";
69313
- import path16 from "node:path";
69394
+ import path17 from "node:path";
69314
69395
  function validateAppPath(appPath) {
69315
69396
  if (!appPath.startsWith("u/") && !appPath.startsWith("f/")) {
69316
69397
  return {
@@ -69515,7 +69596,7 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
69515
69596
  }
69516
69597
  await loadNonDottedPathsSetting();
69517
69598
  const folderName2 = buildFolderPath(appPath, "raw_app");
69518
- const appDir = path16.join(process.cwd(), folderName2);
69599
+ const appDir = path17.join(process.cwd(), folderName2);
69519
69600
  try {
69520
69601
  await stat9(appDir);
69521
69602
  const overwrite = await Confirm.prompt({
@@ -69528,17 +69609,17 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
69528
69609
  }
69529
69610
  } catch {}
69530
69611
  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 });
69612
+ await mkdir7(path17.join(appDir, "backend"), { recursive: true });
69613
+ await mkdir7(path17.join(appDir, "sql_to_apply"), { recursive: true });
69533
69614
  const rawAppConfig = {
69534
69615
  summary
69535
69616
  };
69536
69617
  if (dataConfig.datatable) {
69537
69618
  rawAppConfig.data = dataConfig;
69538
69619
  }
69539
- await writeFile10(path16.join(appDir, "raw_app.yaml"), import_yaml22.stringify(rawAppConfig, yamlOptions), "utf-8");
69620
+ await writeFile10(path17.join(appDir, "raw_app.yaml"), import_yaml22.stringify(rawAppConfig, yamlOptions), "utf-8");
69540
69621
  for (const [filePath, content] of Object.entries(template.files)) {
69541
- const fullPath = path16.join(appDir, filePath.slice(1));
69622
+ const fullPath = path17.join(appDir, filePath.slice(1));
69542
69623
  await writeFile10(fullPath, content.trim() + `
69543
69624
  `, "utf-8");
69544
69625
  }
@@ -69548,21 +69629,21 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
69548
69629
  schema: dataConfig.schema
69549
69630
  } : undefined;
69550
69631
  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
69632
+ await writeFile10(path17.join(appDir, "AGENTS.md"), agentsContent, "utf-8");
69633
+ await writeFile10(path17.join(appDir, "CLAUDE.md"), `Instructions are in @AGENTS.md
69553
69634
  `, "utf-8");
69554
69635
  const datatablesContent = generateDatatablesDocumentation(dataForDocs);
69555
- await writeFile10(path16.join(appDir, "DATATABLES.md"), datatablesContent, "utf-8");
69636
+ await writeFile10(path17.join(appDir, "DATATABLES.md"), datatablesContent, "utf-8");
69556
69637
  const exampleRunnable = {
69557
69638
  type: "inline",
69558
69639
  path: undefined
69559
69640
  };
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> {
69641
+ await writeFile10(path17.join(appDir, "backend", "a.yaml"), import_yaml22.stringify(exampleRunnable, yamlOptions), "utf-8");
69642
+ await writeFile10(path17.join(appDir, "backend", "a.ts"), `export async function main(x: number): Promise<string> {
69562
69643
  return \`Hello from backend! x = \${x}\`;
69563
69644
  }
69564
69645
  `, "utf-8");
69565
- await writeFile10(path16.join(appDir, "sql_to_apply", "README.md"), `# SQL Migrations Folder
69646
+ await writeFile10(path17.join(appDir, "sql_to_apply", "README.md"), `# SQL Migrations Folder
69566
69647
 
69567
69648
  This folder is for SQL migration files that will be applied to datatables during development.
69568
69649
 
@@ -69590,7 +69671,7 @@ This folder is for SQL migration files that will be applied to datatables during
69590
69671
  - Use idempotent SQL (\`CREATE TABLE IF NOT EXISTS\`, etc.)
69591
69672
  `);
69592
69673
  if (createSchemaSQL && schemaName) {
69593
- await writeFile10(path16.join(appDir, "sql_to_apply", `000_create_schema_${schemaName}.sql`), createSchemaSQL, "utf-8");
69674
+ await writeFile10(path17.join(appDir, "sql_to_apply", `000_create_schema_${schemaName}.sql`), createSchemaSQL, "utf-8");
69594
69675
  }
69595
69676
  info("");
69596
69677
  info(colors.bold.green(`App created successfully at ${folderName2}/`));
@@ -69891,8 +69972,8 @@ async function pushApp(workspace, remotePath, localPath, message, permissionedAs
69891
69972
  if (!localPath.endsWith(SEP13)) {
69892
69973
  localPath += SEP13;
69893
69974
  }
69894
- const path17 = localPath + "app.yaml";
69895
- const localApp = await yamlParseFile(path17);
69975
+ const path18 = localPath + "app.yaml";
69976
+ const localApp = await yamlParseFile(path18);
69896
69977
  replaceInlineScripts2(localApp.value, localPath, true);
69897
69978
  await generatingPolicy2(localApp, remotePath, localApp?.["public"] ?? localApp?.["policy"]?.["execution_mode"] == "anonymous");
69898
69979
  const preserveFields = {};
@@ -69934,13 +70015,13 @@ async function pushApp(workspace, remotePath, localPath, message, permissionedAs
69934
70015
  });
69935
70016
  }
69936
70017
  }
69937
- async function generatingPolicy2(app, path17, publicApp) {
69938
- info(colors.gray(`Generating fresh policy for app ${path17}...`));
70018
+ async function generatingPolicy2(app, path18, publicApp) {
70019
+ info(colors.gray(`Generating fresh policy for app ${path18}...`));
69939
70020
  try {
69940
70021
  app.policy = await updatePolicy(app.value, undefined);
69941
70022
  app.policy.execution_mode = publicApp ? "anonymous" : "publisher";
69942
70023
  } catch (e) {
69943
- error(colors.red(`Error generating policy for app ${path17}: ${e}`));
70024
+ error(colors.red(`Error generating policy for app ${path18}: ${e}`));
69944
70025
  throw e;
69945
70026
  }
69946
70027
  }
@@ -69969,12 +70050,12 @@ async function list6(opts) {
69969
70050
  new Table2().header(["path", "summary"]).padding(2).border(true).body(total.map((x) => [x.path, x.summary])).render();
69970
70051
  }
69971
70052
  }
69972
- async function get4(opts, path17) {
70053
+ async function get4(opts, path18) {
69973
70054
  const workspace = await resolveWorkspace(opts);
69974
70055
  await requireLogin(opts);
69975
70056
  const a = await getAppByPath({
69976
70057
  workspace: workspace.workspaceId,
69977
- path: path17
70058
+ path: path18
69978
70059
  });
69979
70060
  if (opts.json) {
69980
70061
  console.log(JSON.stringify(a));
@@ -70312,11 +70393,11 @@ async function list8(opts) {
70312
70393
  ])).render();
70313
70394
  }
70314
70395
  }
70315
- async function newVariable(opts, path17) {
70316
- if (!validatePath(path17)) {
70396
+ async function newVariable(opts, path18) {
70397
+ if (!validatePath(path18)) {
70317
70398
  return;
70318
70399
  }
70319
- const filePath = path17 + ".variable.yaml";
70400
+ const filePath = path18 + ".variable.yaml";
70320
70401
  try {
70321
70402
  await stat12(filePath);
70322
70403
  throw new Error("File already exists: " + filePath);
@@ -70336,14 +70417,14 @@ async function newVariable(opts, path17) {
70336
70417
  });
70337
70418
  info(colors.green(`Created ${filePath}`));
70338
70419
  }
70339
- async function get6(opts, path17) {
70420
+ async function get6(opts, path18) {
70340
70421
  if (opts.json)
70341
70422
  setSilent(true);
70342
70423
  const workspace = await resolveWorkspace(opts);
70343
70424
  await requireLogin(opts);
70344
70425
  const v = await getVariable({
70345
70426
  workspace: workspace.workspaceId,
70346
- path: path17
70427
+ path: path18
70347
70428
  });
70348
70429
  if (opts.json) {
70349
70430
  console.log(JSON.stringify(v));
@@ -70472,11 +70553,11 @@ async function list9(opts) {
70472
70553
  new Table2().header(["Path", "Schedule"]).padding(2).border(true).body(schedules.map((x) => [x.path, x.schedule])).render();
70473
70554
  }
70474
70555
  }
70475
- async function newSchedule(opts, path17) {
70476
- if (!validatePath(path17)) {
70556
+ async function newSchedule(opts, path18) {
70557
+ if (!validatePath(path18)) {
70477
70558
  return;
70478
70559
  }
70479
- const filePath = path17 + ".schedule.yaml";
70560
+ const filePath = path18 + ".schedule.yaml";
70480
70561
  try {
70481
70562
  await stat13(filePath);
70482
70563
  throw new Error("File already exists: " + filePath);
@@ -70500,14 +70581,14 @@ async function newSchedule(opts, path17) {
70500
70581
  });
70501
70582
  info(colors.green(`Created ${filePath}`));
70502
70583
  }
70503
- async function get7(opts, path17) {
70584
+ async function get7(opts, path18) {
70504
70585
  if (opts.json)
70505
70586
  setSilent(true);
70506
70587
  const workspace = await resolveWorkspace(opts);
70507
70588
  await requireLogin(opts);
70508
70589
  const s = await getSchedule({
70509
70590
  workspace: workspace.workspaceId,
70510
- path: path17
70591
+ path: path18
70511
70592
  });
70512
70593
  if (opts.json) {
70513
70594
  console.log(JSON.stringify(s));
@@ -70520,14 +70601,14 @@ async function get7(opts, path17) {
70520
70601
  console.log(colors.bold("Enabled:") + " " + (s.enabled ? "true" : "false"));
70521
70602
  }
70522
70603
  }
70523
- async function pushSchedule(workspace, path17, schedule, localSchedule, permissionedAsContext) {
70524
- path17 = removeType(path17, "schedule").replaceAll(SEP16, "/");
70525
- debug(`Processing local schedule ${path17}`);
70604
+ async function pushSchedule(workspace, path18, schedule, localSchedule, permissionedAsContext) {
70605
+ path18 = removeType(path18, "schedule").replaceAll(SEP16, "/");
70606
+ debug(`Processing local schedule ${path18}`);
70526
70607
  try {
70527
- schedule = await getSchedule({ workspace, path: path17 });
70528
- debug(`Schedule ${path17} exists on remote`);
70608
+ schedule = await getSchedule({ workspace, path: path18 });
70609
+ debug(`Schedule ${path18} exists on remote`);
70529
70610
  } catch {
70530
- debug(`Schedule ${path17} does not exist on remote`);
70611
+ debug(`Schedule ${path18} does not exist on remote`);
70531
70612
  }
70532
70613
  delete localSchedule.has_permissioned_as;
70533
70614
  const preserveFields = {};
@@ -70536,31 +70617,31 @@ async function pushSchedule(workspace, path17, schedule, localSchedule, permissi
70536
70617
  preserveFields.preserve_permissioned_as = true;
70537
70618
  if (schedule.permissioned_as) {
70538
70619
  preserveFields.permissioned_as = schedule.permissioned_as;
70539
- info(`Preserving ${schedule.permissioned_as} as permissioned_as for schedule ${path17}`);
70620
+ info(`Preserving ${schedule.permissioned_as} as permissioned_as for schedule ${path18}`);
70540
70621
  }
70541
70622
  }
70542
70623
  }
70543
70624
  if (schedule) {
70544
70625
  if (isSuperset(localSchedule, schedule)) {
70545
- debug(`Schedule ${path17} is up to date`);
70626
+ debug(`Schedule ${path18} is up to date`);
70546
70627
  return;
70547
70628
  }
70548
- debug(`Updating schedule ${path17}`);
70629
+ debug(`Updating schedule ${path18}`);
70549
70630
  try {
70550
- info(colors.bold.yellow(`Updating schedule ${path17}`));
70631
+ info(colors.bold.yellow(`Updating schedule ${path18}`));
70551
70632
  await updateSchedule({
70552
70633
  workspace,
70553
- path: path17,
70634
+ path: path18,
70554
70635
  requestBody: {
70555
70636
  ...localSchedule,
70556
70637
  ...preserveFields
70557
70638
  }
70558
70639
  });
70559
70640
  if (localSchedule.enabled != schedule.enabled) {
70560
- info(colors.bold.yellow(`Schedule ${path17} is ${localSchedule.enabled ? "enabled" : "disabled"} locally but not on remote, updating remote`));
70641
+ info(colors.bold.yellow(`Schedule ${path18} is ${localSchedule.enabled ? "enabled" : "disabled"} locally but not on remote, updating remote`));
70561
70642
  await setScheduleEnabled({
70562
70643
  workspace,
70563
- path: path17,
70644
+ path: path18,
70564
70645
  requestBody: {
70565
70646
  enabled: localSchedule.enabled
70566
70647
  }
@@ -70571,12 +70652,12 @@ async function pushSchedule(workspace, path17, schedule, localSchedule, permissi
70571
70652
  throw e;
70572
70653
  }
70573
70654
  } else {
70574
- console.log(colors.bold.yellow("Creating new schedule " + path17));
70655
+ console.log(colors.bold.yellow("Creating new schedule " + path18));
70575
70656
  try {
70576
70657
  await createSchedule({
70577
70658
  workspace,
70578
70659
  requestBody: {
70579
- path: path17,
70660
+ path: path18,
70580
70661
  ...localSchedule,
70581
70662
  ...preserveFields
70582
70663
  }
@@ -70587,27 +70668,27 @@ async function pushSchedule(workspace, path17, schedule, localSchedule, permissi
70587
70668
  }
70588
70669
  }
70589
70670
  }
70590
- async function enable(opts, path17) {
70671
+ async function enable(opts, path18) {
70591
70672
  opts = await mergeConfigWithConfigFile(opts);
70592
70673
  const workspace = await resolveWorkspace(opts);
70593
70674
  await requireLogin(opts);
70594
70675
  await setScheduleEnabled({
70595
70676
  workspace: workspace.workspaceId,
70596
- path: path17,
70677
+ path: path18,
70597
70678
  requestBody: { enabled: true }
70598
70679
  });
70599
- info(colors.green(`Schedule ${path17} enabled.`));
70680
+ info(colors.green(`Schedule ${path18} enabled.`));
70600
70681
  }
70601
- async function disable(opts, path17) {
70682
+ async function disable(opts, path18) {
70602
70683
  opts = await mergeConfigWithConfigFile(opts);
70603
70684
  const workspace = await resolveWorkspace(opts);
70604
70685
  await requireLogin(opts);
70605
70686
  await setScheduleEnabled({
70606
70687
  workspace: workspace.workspaceId,
70607
- path: path17,
70688
+ path: path18,
70608
70689
  requestBody: { enabled: false }
70609
70690
  });
70610
- info(colors.yellow(`Schedule ${path17} disabled.`));
70691
+ info(colors.yellow(`Schedule ${path18} disabled.`));
70611
70692
  }
70612
70693
  async function push8(opts, filePath, remotePath) {
70613
70694
  const workspace = await resolveWorkspace(opts);
@@ -70711,7 +70792,7 @@ async function decrypt(combinedCiphertext, keyString) {
70711
70792
  var init_local_encryption = () => {};
70712
70793
 
70713
70794
  // src/core/settings.ts
70714
- import process17 from "node:process";
70795
+ import process18 from "node:process";
70715
70796
  import { writeFile as writeFile14 } from "node:fs/promises";
70716
70797
  function migrateToGroupedFormat(settings) {
70717
70798
  const result = { name: settings.name ?? "" };
@@ -71020,7 +71101,7 @@ async function readInstanceSettings(opts) {
71020
71101
  return localSettings;
71021
71102
  }
71022
71103
  async function processInstanceSettings(settings, mode) {
71023
- const encKey = process17.env.WMILL_INSTANCE_LOCAL_ENCRYPTION_KEY;
71104
+ const encKey = process18.env.WMILL_INSTANCE_LOCAL_ENCRYPTION_KEY;
71024
71105
  if (encKey) {
71025
71106
  const res = [];
71026
71107
  for (const s of settings) {
@@ -71194,7 +71275,7 @@ var init_settings = __esm(async () => {
71194
71275
  // src/commands/instance/instance.ts
71195
71276
  import { readFile as readFile13, writeFile as writeFile15, readdir as readdir8, mkdir as mkdir11, rm as rm3, stat as stat14 } from "node:fs/promises";
71196
71277
  import { appendFile } from "node:fs/promises";
71197
- import * as path17 from "node:path";
71278
+ import * as path18 from "node:path";
71198
71279
  async function allInstances() {
71199
71280
  try {
71200
71281
  const file = await getInstancesConfigFilePath();
@@ -71386,7 +71467,7 @@ async function instancePull(opts) {
71386
71467
  if (confirm) {
71387
71468
  if (uChanges > 0) {
71388
71469
  if (opts.folderPerInstance && opts.prefixSettings) {
71389
- await mkdir11(path17.join(rootDir, opts.prefix), {
71470
+ await mkdir11(path18.join(rootDir, opts.prefix), {
71390
71471
  recursive: true
71391
71472
  });
71392
71473
  }
@@ -71420,10 +71501,10 @@ Pulling all workspaces`);
71420
71501
  info(`
71421
71502
  Pulling workspace ` + remoteWorkspace.id);
71422
71503
  const workspaceName = opts?.folderPerInstance ? instance.prefix + "/" + remoteWorkspace.id : instance.prefix + "_" + remoteWorkspace.id;
71423
- await mkdir11(path17.join(rootDir, workspaceName), {
71504
+ await mkdir11(path18.join(rootDir, workspaceName), {
71424
71505
  recursive: true
71425
71506
  });
71426
- process.chdir(path17.join(rootDir, workspaceName));
71507
+ process.chdir(path18.join(rootDir, workspaceName));
71427
71508
  await addWorkspace({
71428
71509
  remote: instance.remote,
71429
71510
  name: workspaceName,
@@ -71458,7 +71539,7 @@ Pulling workspace ` + remoteWorkspace.id);
71458
71539
  if (confirmDelete) {
71459
71540
  for (const workspace of localWorkspacesToDelete) {
71460
71541
  await removeWorkspace(workspace.id, false, {});
71461
- await rm3(path17.join(rootDir, workspace.dir), {
71542
+ await rm3(path18.join(rootDir, workspace.dir), {
71462
71543
  recursive: true
71463
71544
  });
71464
71545
  }
@@ -71547,12 +71628,12 @@ Pushing all workspaces: ${localWorkspaces.map((x) => x.id).join(", ")}`);
71547
71628
  info(`
71548
71629
  Pushing workspace ` + localWorkspace.id);
71549
71630
  try {
71550
- process.chdir(path17.join(rootDir, localWorkspace.dir));
71631
+ process.chdir(path18.join(rootDir, localWorkspace.dir));
71551
71632
  } catch (_) {
71552
71633
  throw new Error("Workspace folder not found, are you in the right directory?");
71553
71634
  }
71554
71635
  try {
71555
- const workspaceSettings = await yamlParseFile(path17.join(process.cwd(), "settings.yaml"));
71636
+ const workspaceSettings = await yamlParseFile(path18.join(process.cwd(), "settings.yaml"));
71556
71637
  await add({
71557
71638
  token: instance.token,
71558
71639
  workspace: undefined,
@@ -71815,8 +71896,8 @@ async function createToken2(opts) {
71815
71896
  }
71816
71897
  info("Token: " + await createToken({ requestBody: {} }));
71817
71898
  }
71818
- async function pushWorkspaceUser(workspace, path18, user, localUser) {
71819
- const email = removePathPrefix(removeType(path18, "user"), "users");
71899
+ async function pushWorkspaceUser(workspace, path19, user, localUser) {
71900
+ const email = removePathPrefix(removeType(path19, "user"), "users");
71820
71901
  debug(`Processing local user ${email}`);
71821
71902
  if (!["operator", "developer", "admin"].includes(localUser.role)) {
71822
71903
  throw new Error(`Invalid role for user ${email}: ${localUser.role}`);
@@ -71879,8 +71960,8 @@ async function pushWorkspaceUser(workspace, path18, user, localUser) {
71879
71960
  }
71880
71961
  }
71881
71962
  }
71882
- async function pushGroup(workspace, path18, group, localGroup) {
71883
- const name = removePathPrefix(removeType(path18, "group"), "groups");
71963
+ async function pushGroup(workspace, path19, group, localGroup) {
71964
+ const name = removePathPrefix(removeType(path19, "group"), "groups");
71884
71965
  debug(`Processing local group ${name}`);
71885
71966
  try {
71886
71967
  const remoteGroup = await getGroup({
@@ -72131,10 +72212,10 @@ async function push9(opts, filePath) {
72131
72212
  const content = fs12.readFileSync(filePath, "utf8");
72132
72213
  await pushWorkspaceDependencies(workspace.workspaceId, filePath, null, content);
72133
72214
  }
72134
- async function pushWorkspaceDependencies(workspace, path18, _befObj, newDependenciesContent) {
72135
- const res = workspaceDependenciesPathToLanguageAndFilename(path18);
72215
+ async function pushWorkspaceDependencies(workspace, path19, _befObj, newDependenciesContent) {
72216
+ const res = workspaceDependenciesPathToLanguageAndFilename(path19);
72136
72217
  if (!res) {
72137
- throw new Error(`Unknown workspace dependencies file format: ${path18}. ` + `Valid files: package.json, requirements.in, composer.json, go.mod, modules.json`);
72218
+ throw new Error(`Unknown workspace dependencies file format: ${path19}. ` + `Valid files: package.json, requirements.in, composer.json, go.mod, modules.json`);
72138
72219
  }
72139
72220
  const { language, name } = res;
72140
72221
  const displayName = name ? `named dependencies "${name}"` : `workspace default dependencies`;
@@ -72185,7 +72266,7 @@ var init_dependencies = __esm(async () => {
72185
72266
  import { mkdir as mkdir12, stat as stat15, writeFile as writeFile17 } from "node:fs/promises";
72186
72267
  import { dirname as dirname15 } from "node:path";
72187
72268
  import { sep as SEP17 } from "node:path";
72188
- async function getTrigger(triggerType, workspace, path18) {
72269
+ async function getTrigger(triggerType, workspace, path19) {
72189
72270
  const triggerFunctions = {
72190
72271
  http: getHttpTrigger,
72191
72272
  websocket: getWebsocketTrigger,
@@ -72198,10 +72279,10 @@ async function getTrigger(triggerType, workspace, path18) {
72198
72279
  email: getEmailTrigger
72199
72280
  };
72200
72281
  const triggerFunction = triggerFunctions[triggerType];
72201
- const trigger = await triggerFunction({ workspace, path: path18 });
72282
+ const trigger = await triggerFunction({ workspace, path: path19 });
72202
72283
  return trigger;
72203
72284
  }
72204
- async function updateTrigger(triggerType, workspace, path18, trigger) {
72285
+ async function updateTrigger(triggerType, workspace, path19, trigger) {
72205
72286
  const triggerFunctions = {
72206
72287
  http: updateHttpTrigger,
72207
72288
  websocket: updateWebsocketTrigger,
@@ -72214,9 +72295,9 @@ async function updateTrigger(triggerType, workspace, path18, trigger) {
72214
72295
  email: updateEmailTrigger
72215
72296
  };
72216
72297
  const triggerFunction = triggerFunctions[triggerType];
72217
- await triggerFunction({ workspace, path: path18, requestBody: trigger });
72298
+ await triggerFunction({ workspace, path: path19, requestBody: trigger });
72218
72299
  }
72219
- async function createTrigger(triggerType, workspace, path18, trigger) {
72300
+ async function createTrigger(triggerType, workspace, path19, trigger) {
72220
72301
  const triggerFunctions = {
72221
72302
  http: createHttpTrigger,
72222
72303
  websocket: createWebsocketTrigger,
@@ -72229,16 +72310,16 @@ async function createTrigger(triggerType, workspace, path18, trigger) {
72229
72310
  email: createEmailTrigger
72230
72311
  };
72231
72312
  const triggerFunction = triggerFunctions[triggerType];
72232
- await triggerFunction({ workspace, path: path18, requestBody: trigger });
72313
+ await triggerFunction({ workspace, path: path19, requestBody: trigger });
72233
72314
  }
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}`);
72315
+ async function pushTrigger(triggerType, workspace, path19, trigger, localTrigger, permissionedAsContext) {
72316
+ path19 = removeType(path19, triggerType + "_trigger").replaceAll(SEP17, "/");
72317
+ debug(`Processing local ${triggerType} trigger ${path19}`);
72237
72318
  try {
72238
- trigger = await getTrigger(triggerType, workspace, path18);
72239
- debug(`${triggerType} trigger ${path18} exists on remote`);
72319
+ trigger = await getTrigger(triggerType, workspace, path19);
72320
+ debug(`${triggerType} trigger ${path19} exists on remote`);
72240
72321
  } catch {
72241
- debug(`${triggerType} trigger ${path18} does not exist on remote`);
72322
+ debug(`${triggerType} trigger ${path19} does not exist on remote`);
72242
72323
  }
72243
72324
  delete localTrigger.has_permissioned_as;
72244
72325
  const preserveFields = {};
@@ -72247,33 +72328,33 @@ async function pushTrigger(triggerType, workspace, path18, trigger, localTrigger
72247
72328
  preserveFields.preserve_permissioned_as = true;
72248
72329
  if (trigger.permissioned_as) {
72249
72330
  preserveFields.permissioned_as = trigger.permissioned_as;
72250
- info(`Preserving ${trigger.permissioned_as} as permissioned_as for trigger ${path18}`);
72331
+ info(`Preserving ${trigger.permissioned_as} as permissioned_as for trigger ${path19}`);
72251
72332
  }
72252
72333
  }
72253
72334
  }
72254
72335
  if (trigger) {
72255
72336
  if (isSuperset(localTrigger, trigger)) {
72256
- debug(`${triggerType} trigger ${path18} is up to date`);
72337
+ debug(`${triggerType} trigger ${path19} is up to date`);
72257
72338
  return;
72258
72339
  }
72259
- debug(`${triggerType} trigger ${path18} is not up-to-date, updating...`);
72340
+ debug(`${triggerType} trigger ${path19} is not up-to-date, updating...`);
72260
72341
  try {
72261
- await updateTrigger(triggerType, workspace, path18, {
72342
+ await updateTrigger(triggerType, workspace, path19, {
72262
72343
  ...localTrigger,
72263
72344
  ...preserveFields,
72264
- path: path18
72345
+ path: path19
72265
72346
  });
72266
72347
  } catch (e) {
72267
72348
  console.error(e.body);
72268
72349
  throw e;
72269
72350
  }
72270
72351
  } else {
72271
- console.log(colors.bold.yellow(`Creating new ${triggerType} trigger: ${path18}`));
72352
+ console.log(colors.bold.yellow(`Creating new ${triggerType} trigger: ${path19}`));
72272
72353
  try {
72273
- await createTrigger(triggerType, workspace, path18, {
72354
+ await createTrigger(triggerType, workspace, path19, {
72274
72355
  ...localTrigger,
72275
72356
  ...preserveFields,
72276
- path: path18
72357
+ path: path19
72277
72358
  });
72278
72359
  } catch (e) {
72279
72360
  console.error(e.body);
@@ -72358,8 +72439,8 @@ async function pushNativeTrigger(workspace, filePath, _remoteTrigger, localTrigg
72358
72439
  }
72359
72440
  }
72360
72441
  }
72361
- async function newTrigger(opts, path18) {
72362
- if (!validatePath(path18)) {
72442
+ async function newTrigger(opts, path19) {
72443
+ if (!validatePath(path19)) {
72363
72444
  return;
72364
72445
  }
72365
72446
  if (!opts.kind) {
@@ -72369,7 +72450,7 @@ async function newTrigger(opts, path18) {
72369
72450
  throw new Error("Invalid trigger kind: " + opts.kind + ". Valid kinds: " + TRIGGER_TYPES.join(", "));
72370
72451
  }
72371
72452
  const kind = opts.kind;
72372
- const filePath = `${path18}.${kind}_trigger.yaml`;
72453
+ const filePath = `${path19}.${kind}_trigger.yaml`;
72373
72454
  try {
72374
72455
  await stat15(filePath);
72375
72456
  throw new Error("File already exists: " + filePath);
@@ -72405,7 +72486,7 @@ function printTriggerDetails(trigger, kind) {
72405
72486
  console.log(colors.bold(label + ":") + " " + display);
72406
72487
  }
72407
72488
  }
72408
- async function get8(opts, path18) {
72489
+ async function get8(opts, path19) {
72409
72490
  if (opts.json)
72410
72491
  setSilent(true);
72411
72492
  const workspace = await resolveWorkspace(opts);
@@ -72414,7 +72495,7 @@ async function get8(opts, path18) {
72414
72495
  if (!checkIfValidTrigger(opts.kind)) {
72415
72496
  throw new Error("Invalid trigger kind: " + opts.kind + ". Valid kinds: " + TRIGGER_TYPES.join(", "));
72416
72497
  }
72417
- const trigger = await getTrigger(opts.kind, workspace.workspaceId, path18);
72498
+ const trigger = await getTrigger(opts.kind, workspace.workspaceId, path19);
72418
72499
  if (opts.json) {
72419
72500
  console.log(JSON.stringify(trigger));
72420
72501
  } else {
@@ -72425,12 +72506,12 @@ async function get8(opts, path18) {
72425
72506
  const matches = [];
72426
72507
  for (const kind of TRIGGER_TYPES) {
72427
72508
  try {
72428
- const trigger = await getTrigger(kind, workspace.workspaceId, path18);
72509
+ const trigger = await getTrigger(kind, workspace.workspaceId, path19);
72429
72510
  matches.push({ kind, trigger });
72430
72511
  } catch {}
72431
72512
  }
72432
72513
  if (matches.length === 0) {
72433
- throw new Error("No trigger found at path: " + path18);
72514
+ throw new Error("No trigger found at path: " + path19);
72434
72515
  }
72435
72516
  if (matches.length === 1) {
72436
72517
  const { kind, trigger } = matches[0];
@@ -72441,7 +72522,7 @@ async function get8(opts, path18) {
72441
72522
  }
72442
72523
  return;
72443
72524
  }
72444
- console.log("Multiple triggers found at path " + path18 + ":");
72525
+ console.log("Multiple triggers found at path " + path19 + ":");
72445
72526
  for (const m of matches) {
72446
72527
  console.log(" - " + m.kind);
72447
72528
  }
@@ -72658,7 +72739,7 @@ var init_trigger = __esm(async () => {
72658
72739
  });
72659
72740
 
72660
72741
  // src/types.ts
72661
- import * as path18 from "node:path";
72742
+ import * as path19 from "node:path";
72662
72743
  import { sep as SEP18 } from "node:path";
72663
72744
  import { readFileSync as readFileSync5 } from "node:fs";
72664
72745
  function isSuperset(subset, superset) {
@@ -72703,8 +72784,8 @@ function showDiff(local, remote) {
72703
72784
  }
72704
72785
  info(finalString);
72705
72786
  }
72706
- function showConflict(path19, local, remote) {
72707
- info(colors.yellow(`- ${path19}`));
72787
+ function showConflict(path20, local, remote) {
72788
+ info(colors.yellow(`- ${path20}`));
72708
72789
  showDiff(local, remote);
72709
72790
  info("\x1B[31mlocal\x1B[31m - \x1B[32mremote\x1B[32m");
72710
72791
  info(`
@@ -72808,7 +72889,7 @@ function getTypeStrFromPath(p) {
72808
72889
  if (isFileResource(p) || isFilesetResource(p)) {
72809
72890
  return "resource";
72810
72891
  }
72811
- const parsed = path18.parse(p);
72892
+ const parsed = path19.parse(p);
72812
72893
  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
72894
  return "script";
72814
72895
  }
@@ -72832,7 +72913,7 @@ function getTypeStrFromPath(p) {
72832
72913
  }
72833
72914
  }
72834
72915
  function removeType(str, type) {
72835
- const normalizedStr = path18.normalize(str).replaceAll(SEP18, "/");
72916
+ const normalizedStr = path19.normalize(str).replaceAll(SEP18, "/");
72836
72917
  if (normalizedStr.endsWith("." + type + ".yaml") || normalizedStr.endsWith("." + type + ".json")) {
72837
72918
  return normalizedStr.slice(0, normalizedStr.length - type.length - 6);
72838
72919
  }
@@ -72842,7 +72923,7 @@ function removeType(str, type) {
72842
72923
  return normalizedStr;
72843
72924
  }
72844
72925
  function extractNativeTriggerInfo(p) {
72845
- const normalizedPath = path18.normalize(p).replaceAll(SEP18, "/");
72926
+ const normalizedPath = path19.normalize(p).replaceAll(SEP18, "/");
72846
72927
  const withoutExt = normalizedPath.replace(/\.(json|yaml)$/, "");
72847
72928
  const match2 = withoutExt.match(/^(.+)\.(flow|script)\.([^.]+)\.(\w+)_native_trigger$/);
72848
72929
  if (!match2) {
@@ -72856,8 +72937,8 @@ function extractNativeTriggerInfo(p) {
72856
72937
  };
72857
72938
  }
72858
72939
  function removePathPrefix(str, prefix) {
72859
- const normalizedStr = path18.normalize(str).replaceAll(SEP18, "/");
72860
- const normalizedPrefix = path18.normalize(prefix).replaceAll(SEP18, "/");
72940
+ const normalizedStr = path19.normalize(str).replaceAll(SEP18, "/");
72941
+ const normalizedPrefix = path19.normalize(prefix).replaceAll(SEP18, "/");
72861
72942
  if (normalizedStr === normalizedPrefix) {
72862
72943
  return "";
72863
72944
  }
@@ -73029,7 +73110,7 @@ var init_local_path_scripts = __esm(async () => {
73029
73110
  // src/commands/flow/flow.ts
73030
73111
  import { sep as SEP19 } from "node:path";
73031
73112
  import { readFile as readFile15 } from "node:fs/promises";
73032
- import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync5 } from "node:fs";
73113
+ import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync6 } from "node:fs";
73033
73114
  function normalizeOptionalString(value) {
73034
73115
  return typeof value === "string" && value.trim() === "" ? undefined : value ?? undefined;
73035
73116
  }
@@ -73071,12 +73152,12 @@ function warnAboutLocalPathScriptDivergence(divergence) {
73071
73152
  const details = [];
73072
73153
  if (divergence.changed.length > 0) {
73073
73154
  details.push(`These workspace scripts differ from the deployed version:
73074
- ${divergence.changed.map((path19) => `- ${path19}`).join(`
73155
+ ${divergence.changed.map((path20) => `- ${path20}`).join(`
73075
73156
  `)}`);
73076
73157
  }
73077
73158
  if (divergence.missing.length > 0) {
73078
73159
  details.push(`These scripts do not exist in the workspace yet:
73079
- ${divergence.missing.map((path19) => `- ${path19}`).join(`
73160
+ ${divergence.missing.map((path20) => `- ${path20}`).join(`
73080
73161
  `)}`);
73081
73162
  }
73082
73163
  warn(`Using local PathScript files for flow preview.
@@ -73101,7 +73182,7 @@ async function pushFlow(workspace, remotePath, localPath, message, permissionedA
73101
73182
  localPath += SEP19;
73102
73183
  }
73103
73184
  const localFlow = await yamlParseFile(localPath + "flow.yaml");
73104
- const fileReader = async (path19) => await readFile15(localPath + path19, "utf-8");
73185
+ const fileReader = async (path20) => await readFile15(localPath + path20, "utf-8");
73105
73186
  const missingFiles = [];
73106
73187
  await replaceInlineScripts(localFlow.value.modules, fileReader, exports_log, localPath, SEP19, undefined, missingFiles);
73107
73188
  if (localFlow.value.failure_module) {
@@ -73193,14 +73274,14 @@ async function list12(opts) {
73193
73274
  new Table2().header(["path", "summary", "edited by"]).padding(2).border(true).body(total.map((x) => [x.path, x.summary, x.edited_by])).render();
73194
73275
  }
73195
73276
  }
73196
- async function get9(opts, path19) {
73277
+ async function get9(opts, path20) {
73197
73278
  if (opts.json)
73198
73279
  setSilent(true);
73199
73280
  const workspace = await resolveWorkspace(opts);
73200
73281
  await requireLogin(opts);
73201
73282
  const f = await getFlowByPath({
73202
73283
  workspace: workspace.workspaceId,
73203
- path: path19
73284
+ path: path20
73204
73285
  });
73205
73286
  if (opts.json) {
73206
73287
  console.log(JSON.stringify(f));
@@ -73238,7 +73319,7 @@ async function get9(opts, path19) {
73238
73319
  }
73239
73320
  }
73240
73321
  }
73241
- async function run3(opts, path19) {
73322
+ async function run3(opts, path20) {
73242
73323
  if (opts.silent) {
73243
73324
  setSilent(true);
73244
73325
  }
@@ -73249,7 +73330,7 @@ async function run3(opts, path19) {
73249
73330
  try {
73250
73331
  const flow = await getFlowByPath({
73251
73332
  workspace: workspace.workspaceId,
73252
- path: path19
73333
+ path: path20
73253
73334
  });
73254
73335
  validateRequiredArgs(flow.schema);
73255
73336
  } catch (e) {
@@ -73260,7 +73341,7 @@ async function run3(opts, path19) {
73260
73341
  }
73261
73342
  const id = await runFlowByPath({
73262
73343
  workspace: workspace.workspaceId,
73263
- path: path19,
73344
+ path: path20,
73264
73345
  requestBody: input
73265
73346
  });
73266
73347
  const stepLabels = new Map;
@@ -73406,7 +73487,7 @@ async function preview2(opts, flowPath) {
73406
73487
  flowPath += SEP19;
73407
73488
  }
73408
73489
  const localFlow = await yamlParseFile(flowPath + "flow.yaml");
73409
- const fileReader = async (path19) => await readFile15(flowPath + path19, "utf-8");
73490
+ const fileReader = async (path20) => await readFile15(flowPath + path20, "utf-8");
73410
73491
  await replaceInlineScripts(localFlow.value.modules, fileReader, exports_log, flowPath, SEP19);
73411
73492
  if (localFlow.value.failure_module) {
73412
73493
  await replaceInlineScripts([localFlow.value.failure_module], fileReader, exports_log, flowPath, SEP19);
@@ -73521,7 +73602,7 @@ async function bootstrap2(opts, flowPath) {
73521
73602
  const newFlowDefinitionYaml = import_yaml36.stringify(newFlowDefinition);
73522
73603
  const metadataFile = getMetadataFileName("flow", "yaml");
73523
73604
  const flowYamlPath = `${flowDirFullPath}/${metadataFile}`;
73524
- writeFileSync5(flowYamlPath, newFlowDefinitionYaml, { flag: "wx", encoding: "utf-8" });
73605
+ writeFileSync6(flowYamlPath, newFlowDefinitionYaml, { flag: "wx", encoding: "utf-8" });
73525
73606
  }
73526
73607
  async function history2(opts, flowPath) {
73527
73608
  if (opts.json)
@@ -73754,7 +73835,7 @@ class GitSyncSettingsConverter {
73754
73835
  }
73755
73836
 
73756
73837
  // src/commands/gitsync-settings/legacySettings.ts
73757
- import process18 from "node:process";
73838
+ import process19 from "node:process";
73758
73839
  async function handleLegacyRepositoryMigration(selectedRepo, gitSyncSettings, workspace, opts, operationName = "operation") {
73759
73840
  if (selectedRepo.settings) {
73760
73841
  return selectedRepo;
@@ -73764,7 +73845,7 @@ async function handleLegacyRepositoryMigration(selectedRepo, gitSyncSettings, wo
73764
73845
  }
73765
73846
  const workspaceIncludePath = gitSyncSettings.include_path;
73766
73847
  const workspaceIncludeType = gitSyncSettings.include_type;
73767
- if (!!process18.stdout.isTTY && !opts.yes) {
73848
+ if (!!process19.stdout.isTTY && !opts.yes) {
73768
73849
  console.log(colors.yellow(`
73769
73850
  ⚠️ Legacy git-sync settings detected!`));
73770
73851
  console.log(`
@@ -73870,7 +73951,7 @@ Repository "${selectedRepo.git_repo_resource_path}" has legacy settings format.`
73870
73951
  console.error(` wmill gitsync-settings push
73871
73952
  `);
73872
73953
  }
73873
- process18.exit(1);
73954
+ process19.exit(1);
73874
73955
  }
73875
73956
  }
73876
73957
  var init_legacySettings = __esm(async () => {
@@ -73914,8 +73995,8 @@ function outputResult(opts, result) {
73914
73995
  error(colors.red(result.error));
73915
73996
  }
73916
73997
  }
73917
- function normalizeRepoPath(path19) {
73918
- return path19.replace(/^\$res:/, "");
73998
+ function normalizeRepoPath(path20) {
73999
+ return path20.replace(/^\$res:/, "");
73919
74000
  }
73920
74001
  function getOrCreateBranchConfig(config, branchName) {
73921
74002
  if (!config.workspaces) {
@@ -74326,14 +74407,14 @@ var init_pull2 = __esm(async () => {
74326
74407
  });
74327
74408
 
74328
74409
  // src/commands/gitsync-settings/push.ts
74329
- import process19 from "node:process";
74410
+ import process20 from "node:process";
74330
74411
  async function pushGitSyncSettings(opts) {
74331
74412
  try {
74332
74413
  await validateBranchConfiguration({ yes: opts.yes });
74333
74414
  } catch (error2) {
74334
74415
  if (error2 instanceof Error && error2.message.includes("overrides")) {
74335
74416
  error(error2.message);
74336
- process19.exit(1);
74417
+ process20.exit(1);
74337
74418
  }
74338
74419
  throw error2;
74339
74420
  }
@@ -74343,7 +74424,7 @@ async function pushGitSyncSettings(opts) {
74343
74424
  const wmillYamlPath = getWmillYamlPath();
74344
74425
  if (!wmillYamlPath) {
74345
74426
  error(colors.red("No wmill.yaml file found. Please run 'wmill init' first to create the configuration file."));
74346
- process19.exit(1);
74427
+ process20.exit(1);
74347
74428
  }
74348
74429
  const localConfig = await readConfigFile();
74349
74430
  let settings;
@@ -74459,7 +74540,7 @@ async function pushGitSyncSettings(opts) {
74459
74540
  displayChanges(changes);
74460
74541
  }
74461
74542
  }
74462
- if (!opts.yes && !!process19.stdin.isTTY) {
74543
+ if (!opts.yes && !!process20.stdin.isTTY) {
74463
74544
  const confirmed = await Confirm.prompt({
74464
74545
  message: `Do you want to apply these changes to the remote?`,
74465
74546
  default: true
@@ -74570,22 +74651,22 @@ var init_gitsync_settings = __esm(async () => {
74570
74651
  async function uploadScripts(tree, workspace) {
74571
74652
  const scriptHashes = {};
74572
74653
  const workspaceDeps = [];
74573
- for (const path19 of tree.allPaths()) {
74574
- const content = tree.getContent(path19);
74575
- const itemType = tree.getItemType(path19);
74654
+ for (const path20 of tree.allPaths()) {
74655
+ const content = tree.getContent(path20);
74656
+ const itemType = tree.getItemType(path20);
74576
74657
  if (itemType === "dependencies") {
74577
74658
  if (content === undefined)
74578
74659
  continue;
74579
- const info2 = workspaceDependenciesPathToLanguageAndFilename(path19);
74660
+ const info2 = workspaceDependenciesPathToLanguageAndFilename(path20);
74580
74661
  if (info2) {
74581
74662
  const hash2 = await generateHash(content);
74582
- workspaceDeps.push({ path: path19, language: info2.language, name: info2.name, hash: hash2 });
74663
+ workspaceDeps.push({ path: path20, language: info2.language, name: info2.name, hash: hash2 });
74583
74664
  }
74584
74665
  } else if (itemType === "script") {
74585
74666
  if (!content)
74586
74667
  continue;
74587
74668
  const hash2 = await generateHash(content);
74588
- scriptHashes[path19] = hash2;
74669
+ scriptHashes[path20] = hash2;
74589
74670
  }
74590
74671
  }
74591
74672
  if (Object.keys(scriptHashes).length === 0 && workspaceDeps.length === 0)
@@ -74597,19 +74678,19 @@ async function uploadScripts(tree, workspace) {
74597
74678
  workspace_deps: workspaceDeps
74598
74679
  }
74599
74680
  });
74600
- for (const path19 of mismatched) {
74601
- const content = tree.getContent(path19);
74602
- const itemType = tree.getItemType(path19);
74681
+ for (const path20 of mismatched) {
74682
+ const content = tree.getContent(path20);
74683
+ const itemType = tree.getItemType(path20);
74603
74684
  if (itemType === "dependencies") {
74604
74685
  if (content !== undefined) {
74605
- tree.setContentHash(path19, "mismatched");
74686
+ tree.setContentHash(path20, "mismatched");
74606
74687
  }
74607
74688
  } else if (content) {
74608
74689
  const hash2 = await storeRawScriptTemp({
74609
74690
  workspace: workspace.workspaceId,
74610
74691
  requestBody: content
74611
74692
  });
74612
- tree.setContentHash(path19, hash2);
74693
+ tree.setContentHash(path20, hash2);
74613
74694
  }
74614
74695
  }
74615
74696
  }
@@ -74620,12 +74701,12 @@ class DoubleLinkedDependencyTree {
74620
74701
  setWorkspaceDeps(deps) {
74621
74702
  this.workspaceDeps = deps;
74622
74703
  }
74623
- async addNode(path19, content, language, metadata, imports, itemType, folder, originalPath, isDirectlyStale, isRawApp) {
74704
+ async addNode(path20, content, language, metadata, imports, itemType, folder, originalPath, isDirectlyStale, isRawApp) {
74624
74705
  const hasWorkspaceDeps = itemType === "script" || itemType === "inline_script";
74625
74706
  const filteredDeps = hasWorkspaceDeps ? filterWorkspaceDependencies(this.workspaceDeps, content, language) : {};
74626
74707
  const stalenessHash = await generateScriptHash({}, content, metadata);
74627
- if (!this.nodes.has(path19)) {
74628
- this.nodes.set(path19, {
74708
+ if (!this.nodes.has(path20)) {
74709
+ this.nodes.set(path20, {
74629
74710
  content: "",
74630
74711
  stalenessHash: "",
74631
74712
  language: "deno",
@@ -74638,7 +74719,7 @@ class DoubleLinkedDependencyTree {
74638
74719
  isDirectlyStale: false
74639
74720
  });
74640
74721
  }
74641
- const node = this.nodes.get(path19);
74722
+ const node = this.nodes.get(path20);
74642
74723
  node.content = content;
74643
74724
  node.stalenessHash = stalenessHash;
74644
74725
  node.language = language;
@@ -74685,59 +74766,59 @@ class DoubleLinkedDependencyTree {
74685
74766
  isDirectlyStale: false
74686
74767
  });
74687
74768
  }
74688
- this.nodes.get(importPath).importedBy.add(path19);
74769
+ this.nodes.get(importPath).importedBy.add(path20);
74689
74770
  }
74690
74771
  }
74691
- getContent(path19) {
74692
- return this.nodes.get(path19)?.content;
74772
+ getContent(path20) {
74773
+ return this.nodes.get(path20)?.content;
74693
74774
  }
74694
- getStalenessHash(path19) {
74695
- return this.nodes.get(path19)?.stalenessHash;
74775
+ getStalenessHash(path20) {
74776
+ return this.nodes.get(path20)?.stalenessHash;
74696
74777
  }
74697
- getContentHash(path19) {
74698
- return this.nodes.get(path19)?.contentHash;
74778
+ getContentHash(path20) {
74779
+ return this.nodes.get(path20)?.contentHash;
74699
74780
  }
74700
- setContentHash(path19, hash2) {
74701
- const node = this.nodes.get(path19);
74781
+ setContentHash(path20, hash2) {
74782
+ const node = this.nodes.get(path20);
74702
74783
  if (node) {
74703
74784
  node.contentHash = hash2;
74704
74785
  }
74705
74786
  }
74706
- getLanguage(path19) {
74707
- return this.nodes.get(path19)?.language;
74787
+ getLanguage(path20) {
74788
+ return this.nodes.get(path20)?.language;
74708
74789
  }
74709
- getMetadata(path19) {
74710
- return this.nodes.get(path19)?.metadata;
74790
+ getMetadata(path20) {
74791
+ return this.nodes.get(path20)?.metadata;
74711
74792
  }
74712
- getStaleReason(path19) {
74713
- return this.nodes.get(path19)?.staleReason;
74793
+ getStaleReason(path20) {
74794
+ return this.nodes.get(path20)?.staleReason;
74714
74795
  }
74715
- getItemType(path19) {
74716
- return this.nodes.get(path19)?.itemType;
74796
+ getItemType(path20) {
74797
+ return this.nodes.get(path20)?.itemType;
74717
74798
  }
74718
- getFolder(path19) {
74719
- return this.nodes.get(path19)?.folder;
74799
+ getFolder(path20) {
74800
+ return this.nodes.get(path20)?.folder;
74720
74801
  }
74721
- getIsRawApp(path19) {
74722
- return this.nodes.get(path19)?.isRawApp;
74802
+ getIsRawApp(path20) {
74803
+ return this.nodes.get(path20)?.isRawApp;
74723
74804
  }
74724
- getIsDirectlyStale(path19) {
74725
- return this.nodes.get(path19)?.isDirectlyStale ?? false;
74805
+ getIsDirectlyStale(path20) {
74806
+ return this.nodes.get(path20)?.isDirectlyStale ?? false;
74726
74807
  }
74727
- getOriginalPath(path19) {
74728
- return this.nodes.get(path19)?.originalPath;
74808
+ getOriginalPath(path20) {
74809
+ return this.nodes.get(path20)?.originalPath;
74729
74810
  }
74730
- getImports(path19) {
74731
- return this.nodes.get(path19)?.imports;
74811
+ getImports(path20) {
74812
+ return this.nodes.get(path20)?.imports;
74732
74813
  }
74733
- isStale(path19) {
74734
- return this.nodes.get(path19)?.staleReason !== undefined;
74814
+ isStale(path20) {
74815
+ return this.nodes.get(path20)?.staleReason !== undefined;
74735
74816
  }
74736
74817
  propagateStaleness() {
74737
74818
  const directlyStale = new Set;
74738
- for (const [path19, node] of this.nodes.entries()) {
74819
+ for (const [path20, node] of this.nodes.entries()) {
74739
74820
  if (node.isDirectlyStale) {
74740
- directlyStale.add(path19);
74821
+ directlyStale.add(path20);
74741
74822
  node.staleReason = "content changed";
74742
74823
  }
74743
74824
  }
@@ -74789,20 +74870,20 @@ class DoubleLinkedDependencyTree {
74789
74870
  return this.nodes.keys();
74790
74871
  }
74791
74872
  *stalePaths() {
74792
- for (const [path19, node] of this.nodes.entries()) {
74873
+ for (const [path20, node] of this.nodes.entries()) {
74793
74874
  if (node.staleReason) {
74794
- yield path19;
74875
+ yield path20;
74795
74876
  }
74796
74877
  }
74797
74878
  }
74798
- has(path19) {
74799
- return this.nodes.has(path19);
74879
+ has(path20) {
74880
+ return this.nodes.has(path20);
74800
74881
  }
74801
74882
  getMismatchedWorkspaceDeps() {
74802
74883
  const result2 = {};
74803
- for (const [path19, node] of this.nodes.entries()) {
74884
+ for (const [path20, node] of this.nodes.entries()) {
74804
74885
  if (node.itemType === "dependencies" && node.contentHash && node.content !== undefined) {
74805
- result2[path19] = node.content;
74886
+ result2[path20] = node.content;
74806
74887
  }
74807
74888
  }
74808
74889
  return result2;
@@ -74817,11 +74898,11 @@ class DoubleLinkedDependencyTree {
74817
74898
  return result2;
74818
74899
  }
74819
74900
  async persistDepsHashes(depsPaths) {
74820
- for (const path19 of depsPaths) {
74821
- const node = this.nodes.get(path19);
74901
+ for (const path20 of depsPaths) {
74902
+ const node = this.nodes.get(path20);
74822
74903
  if (node?.itemType === "dependencies" && node.content !== undefined) {
74823
- const hash2 = await generateHash(node.content + path19);
74824
- await updateMetadataGlobalLock(path19, hash2);
74904
+ const hash2 = await generateHash(node.content + path20);
74905
+ await updateMetadataGlobalLock(path20, hash2);
74825
74906
  }
74826
74907
  }
74827
74908
  }
@@ -76270,7 +76351,7 @@ async function dev2(opts) {
76270
76351
  const flowFolderSuffix = getFolderSuffixWithSep("flow");
76271
76352
  const flowMetadataFile = getMetadataFileName("flow", "yaml");
76272
76353
  async function loadPaths(pathsToLoad) {
76273
- const paths = pathsToLoad.filter((path19) => exts.some((ext2) => path19.endsWith(ext2) || path19.endsWith(flowFolderSuffix + flowMetadataFile)));
76354
+ const paths = pathsToLoad.filter((path20) => exts.some((ext2) => path20.endsWith(ext2) || path20.endsWith(flowFolderSuffix + flowMetadataFile)));
76274
76355
  if (paths.length == 0) {
76275
76356
  return;
76276
76357
  }
@@ -76282,7 +76363,7 @@ async function dev2(opts) {
76282
76363
  if (typ == "flow") {
76283
76364
  const localPath = extractFolderPath(cpath, "flow");
76284
76365
  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);
76366
+ await replaceInlineScripts(localFlow.value.modules, async (path20) => await readFile16(localPath + path20, "utf-8"), exports_log, localPath, SEP20, undefined);
76286
76367
  const localScriptReader = createPreviewLocalScriptReader({
76287
76368
  exts,
76288
76369
  defaultTs: opts.defaultTs,
@@ -85224,8 +85305,8 @@ async function generateMetadata2(opts, folder) {
85224
85305
  info("");
85225
85306
  if (errors.length > 0) {
85226
85307
  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}`);
85308
+ for (const { path: path20, error: error2 } of errors) {
85309
+ error(` ${path20}: ${error2}`);
85229
85310
  }
85230
85311
  process.exitCode = 1;
85231
85312
  } else {
@@ -85379,7 +85460,7 @@ var config_default = command35;
85379
85460
 
85380
85461
  // src/main.ts
85381
85462
  await init_context();
85382
- var VERSION = "1.685.0";
85463
+ var VERSION = "1.687.0";
85383
85464
  async function checkVersionSafe(cmd) {
85384
85465
  const mainCommand = cmd.getMainCommand();
85385
85466
  const upgradeCommand = mainCommand.getCommand("upgrade");