windmill-cli 1.642.0 → 1.643.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 +210 -60
  2. package/package.json +1 -1
package/esm/main.js CHANGED
@@ -11767,7 +11767,7 @@ var init_OpenAPI = __esm(() => {
11767
11767
  PASSWORD: undefined,
11768
11768
  TOKEN: getEnv2("WM_TOKEN"),
11769
11769
  USERNAME: undefined,
11770
- VERSION: "1.642.0",
11770
+ VERSION: "1.643.0",
11771
11771
  WITH_CREDENTIALS: true,
11772
11772
  interceptors: {
11773
11773
  request: new Interceptors,
@@ -14083,6 +14083,9 @@ var backendVersion = () => {
14083
14083
  },
14084
14084
  query: {
14085
14085
  path_start: data2.pathStart,
14086
+ path: data2.path,
14087
+ description: data2.description,
14088
+ value: data2.value,
14086
14089
  page: data2.page,
14087
14090
  per_page: data2.perPage
14088
14091
  }
@@ -14439,7 +14442,10 @@ var backendVersion = () => {
14439
14442
  per_page: data2.perPage,
14440
14443
  resource_type: data2.resourceType,
14441
14444
  resource_type_exclude: data2.resourceTypeExclude,
14442
- path_start: data2.pathStart
14445
+ path_start: data2.pathStart,
14446
+ path: data2.path,
14447
+ description: data2.description,
14448
+ value: data2.value
14443
14449
  }
14444
14450
  });
14445
14451
  }, listSearchResource = (data2) => {
@@ -16847,7 +16853,10 @@ var backendVersion = () => {
16847
16853
  args: data2.args,
16848
16854
  path: data2.path,
16849
16855
  is_flow: data2.isFlow,
16850
- path_start: data2.pathStart
16856
+ path_start: data2.pathStart,
16857
+ schedule_path: data2.schedulePath,
16858
+ description: data2.description,
16859
+ summary: data2.summary
16851
16860
  }
16852
16861
  });
16853
16862
  }, listSchedulesWithJobs = (data2) => {
@@ -19106,7 +19115,9 @@ var backendVersion = () => {
19106
19115
  cursor_id: data2.cursorId,
19107
19116
  asset_path: data2.assetPath,
19108
19117
  usage_path: data2.usagePath,
19109
- asset_kinds: data2.assetKinds
19118
+ asset_kinds: data2.assetKinds,
19119
+ path: data2.path,
19120
+ columns: data2.columns
19110
19121
  }
19111
19122
  });
19112
19123
  }, listAssetsByUsage = (data2) => {
@@ -23401,6 +23412,9 @@ function isFileResource(path3) {
23401
23412
  const splitPath = path3.split(".");
23402
23413
  return splitPath.length >= 4 && splitPath[splitPath.length - 3] == "resource" && splitPath[splitPath.length - 2] == "file";
23403
23414
  }
23415
+ function isFilesetResource(path3) {
23416
+ return path3.includes(".fileset/") || path3.includes(".fileset\\");
23417
+ }
23404
23418
  function isRawAppFile(path3) {
23405
23419
  return isRawAppPath(path3);
23406
23420
  }
@@ -55905,7 +55919,7 @@ function isItemTypeConfigured(path5, specificItems) {
55905
55919
  if (path5 === "settings.yaml") {
55906
55920
  return specificItems.settings !== undefined;
55907
55921
  }
55908
- if (isFileResource(path5)) {
55922
+ if (isFileResource(path5) || isFilesetResource(path5)) {
55909
55923
  return specificItems.resources !== undefined;
55910
55924
  }
55911
55925
  return false;
@@ -55940,6 +55954,13 @@ function isSpecificItem(path5, specificItems) {
55940
55954
  return matchesPatterns(basePath, specificItems.resources);
55941
55955
  }
55942
55956
  }
55957
+ if (isFilesetResource(path5)) {
55958
+ const basePathMatch = path5.match(/^(.+?)\.fileset[/\\]/);
55959
+ if (basePathMatch && specificItems.resources) {
55960
+ const basePath = basePathMatch[1] + ".resource.yaml";
55961
+ return matchesPatterns(basePath, specificItems.resources);
55962
+ }
55963
+ }
55943
55964
  return false;
55944
55965
  }
55945
55966
  function toBranchSpecificPath(basePath, branchName) {
@@ -59946,8 +59967,26 @@ var init_lint = __esm(async () => {
59946
59967
  });
59947
59968
 
59948
59969
  // src/commands/resource/resource.ts
59949
- import { stat as stat5, writeFile as writeFile5 } from "node:fs/promises";
59970
+ import { stat as stat5, writeFile as writeFile5, readdir as readdir3, readFile as readFile6 } from "node:fs/promises";
59971
+ import nodePath from "node:path";
59950
59972
  import { sep as SEP6 } from "node:path";
59973
+ async function readFilesetDirectory(dirPath) {
59974
+ const result = {};
59975
+ async function walk(currentPath, prefix) {
59976
+ const entries = await readdir3(currentPath, { withFileTypes: true });
59977
+ for (const entry of entries) {
59978
+ const entryPath = nodePath.join(currentPath, entry.name);
59979
+ const relPath = prefix ? prefix + "/" + entry.name : entry.name;
59980
+ if (entry.isDirectory()) {
59981
+ await walk(entryPath, relPath);
59982
+ } else if (entry.isFile()) {
59983
+ result[relPath] = await readFile6(entryPath, "utf-8");
59984
+ }
59985
+ }
59986
+ }
59987
+ await walk(dirPath, "");
59988
+ return result;
59989
+ }
59951
59990
  async function pushResource(workspace, remotePath, resource, localResource, originalLocalPath) {
59952
59991
  remotePath = removeType(remotePath, "resource");
59953
59992
  try {
@@ -59957,7 +59996,10 @@ async function pushResource(workspace, remotePath, resource, localResource, orig
59957
59996
  });
59958
59997
  } catch {}
59959
59998
  const resolveInlineContent = async () => {
59960
- if (localResource.value["content"]?.startsWith("!inline ")) {
59999
+ if (typeof localResource.value === "string" && localResource.value.startsWith("!inline_fileset ")) {
60000
+ const dirPath = localResource.value.split(" ")[1];
60001
+ localResource.value = await readFilesetDirectory(dirPath.replaceAll("/", SEP6));
60002
+ } else if (localResource.value["content"]?.startsWith("!inline ")) {
59961
60003
  const basePath = localResource.value["content"].split(" ")[1];
59962
60004
  let pathToRead = basePath;
59963
60005
  if (originalLocalPath && isBranchSpecificFile(originalLocalPath)) {
@@ -60330,7 +60372,7 @@ async function replaceInlineScripts(modules, fileReader, logger = {
60330
60372
  // src/commands/flow/flow_metadata.ts
60331
60373
  import * as path6 from "node:path";
60332
60374
  import { sep as SEP7 } from "node:path";
60333
- import { readFile as readFile6 } from "node:fs/promises";
60375
+ import { readFile as readFile7 } from "node:fs/promises";
60334
60376
  async function generateFlowHash(rawWorkspaceDependencies, folder, defaultTs) {
60335
60377
  const elems = await FSFSElement(path6.join(process.cwd(), folder), [], true);
60336
60378
  const hashes = {};
@@ -60377,7 +60419,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
60377
60419
  }
60378
60420
  }
60379
60421
  info(`Recomputing locks of ${changedScripts.join(", ")} in ${folder}`);
60380
- await replaceInlineScripts(flowValue.value.modules, async (path7) => await readFile6(folder + SEP7 + path7, "utf-8"), exports_log, folder + SEP7, SEP7, changedScripts);
60422
+ await replaceInlineScripts(flowValue.value.modules, async (path7) => await readFile7(folder + SEP7 + path7, "utf-8"), exports_log, folder + SEP7, SEP7, changedScripts);
60381
60423
  flowValue.value = await updateFlow2(workspace, flowValue.value, remote_path, filteredDeps);
60382
60424
  const inlineScripts = extractInlineScripts(flowValue.value.modules, {}, SEP7, opts.defaultTs);
60383
60425
  inlineScripts.forEach((s) => {
@@ -60486,7 +60528,7 @@ __export(exports_sync, {
60486
60528
  default: () => sync_default,
60487
60529
  FSFSElement: () => FSFSElement
60488
60530
  });
60489
- import { readFile as readFile7, writeFile as writeFile6, readdir as readdir3, stat as stat6, rm, copyFile, mkdir as mkdir3 } from "node:fs/promises";
60531
+ import { readFile as readFile8, writeFile as writeFile6, readdir as readdir4, stat as stat6, rm, copyFile, mkdir as mkdir3 } from "node:fs/promises";
60490
60532
  import * as path7 from "node:path";
60491
60533
  import { sep as SEP8 } from "node:path";
60492
60534
  function mergeCliWithEffectiveOptions(cliOpts, effectiveOpts) {
@@ -60578,7 +60620,7 @@ async function FSFSElement(p, codebases, ignoreCodebaseChanges) {
60578
60620
  if (!isDir)
60579
60621
  return [];
60580
60622
  try {
60581
- const entries = await readdir3(localP, { withFileTypes: true });
60623
+ const entries = await readdir4(localP, { withFileTypes: true });
60582
60624
  for (const e of entries) {
60583
60625
  yield _internal_element(path7.join(localP, e.name), e.isDirectory(), codebases2);
60584
60626
  }
@@ -60587,7 +60629,7 @@ async function FSFSElement(p, codebases, ignoreCodebaseChanges) {
60587
60629
  }
60588
60630
  },
60589
60631
  async getContentText() {
60590
- const content = await readFile7(localP, "utf-8");
60632
+ const content = await readFile8(localP, "utf-8");
60591
60633
  const itemPath = localP.substring(p.length + 1);
60592
60634
  const r = await addCodebaseDigestIfRelevant(itemPath, content, codebases2, ignoreCodebaseChanges);
60593
60635
  return r;
@@ -60785,7 +60827,39 @@ function extractInlineScriptsForApps(key, rec, pathAssigner, toId, removeSchema)
60785
60827
  }
60786
60828
  return [];
60787
60829
  }
60788
- function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, ignoreCodebaseChanges) {
60830
+ function parseFileResourceTypeMap(raw) {
60831
+ const formatExtMap = {};
60832
+ const filesetMap = {};
60833
+ for (const [k, v] of Object.entries(raw)) {
60834
+ if (typeof v === "string") {
60835
+ formatExtMap[k] = v;
60836
+ filesetMap[k] = false;
60837
+ } else {
60838
+ if (v.format_extension) {
60839
+ formatExtMap[k] = v.format_extension;
60840
+ }
60841
+ filesetMap[k] = v.is_fileset ?? false;
60842
+ }
60843
+ }
60844
+ return { formatExtMap, filesetMap };
60845
+ }
60846
+ async function findFilesetResourceFile(changePath) {
60847
+ const filesetIdx = changePath.indexOf(".fileset" + SEP8);
60848
+ if (filesetIdx === -1) {
60849
+ throw new Error(`Not a fileset resource path: ${changePath}`);
60850
+ }
60851
+ const basePath = changePath.substring(0, filesetIdx);
60852
+ const candidates = [basePath + ".resource.json", basePath + ".resource.yaml"];
60853
+ for (const candidate of candidates) {
60854
+ try {
60855
+ const s = await stat6(candidate);
60856
+ if (s.isFile())
60857
+ return candidate;
60858
+ } catch {}
60859
+ }
60860
+ throw new Error(`No resource metadata file found for fileset resource: ${changePath}`);
60861
+ }
60862
+ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, resourceTypeToIsFileset, ignoreCodebaseChanges) {
60789
60863
  async function _internal_file(p, f) {
60790
60864
  const kind = isFlowMetadataFile(p) ? "flow" : isAppMetadataFile(p) ? "app" : isRawAppMetadataFile(p) ? "raw_app" : p.endsWith(".script.json") ? "script" : p.endsWith(".resource.json") ? "resource" : p.startsWith("dependencies/") ? "dependencies" : "other";
60791
60865
  const isJson = p.endsWith(".json");
@@ -61041,8 +61115,12 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, ig
61041
61115
  error(`Failed to parse resource.yaml at path: ${p}`);
61042
61116
  throw error2;
61043
61117
  }
61044
- const formatExtension = resourceTypeToFormatExtension[parsed["resource_type"]];
61045
- if (formatExtension) {
61118
+ const resourceType = parsed["resource_type"];
61119
+ const formatExtension = resourceTypeToFormatExtension[resourceType];
61120
+ const isFileset = resourceTypeToIsFileset[resourceType] ?? false;
61121
+ if (isFileset) {
61122
+ parsed["value"] = "!inline_fileset " + removeSuffix(p.replaceAll(SEP8, "/"), ".resource.json") + ".fileset";
61123
+ } else if (formatExtension) {
61046
61124
  parsed["value"]["content"] = "!inline " + removeSuffix(p.replaceAll(SEP8, "/"), ".resource.json") + ".resource.file." + formatExtension;
61047
61125
  }
61048
61126
  return useYaml ? import_yaml10.stringify(parsed, yamlOptions) : JSON.stringify(parsed, null, 2);
@@ -61088,8 +61166,33 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, ig
61088
61166
  error(`Failed to parse resource file content at path: ${p}`);
61089
61167
  throw error2;
61090
61168
  }
61091
- const formatExtension = resourceTypeToFormatExtension[parsed["resource_type"]];
61092
- if (formatExtension) {
61169
+ const resourceType = parsed["resource_type"];
61170
+ const formatExtension = resourceTypeToFormatExtension[resourceType];
61171
+ const isFileset = resourceTypeToIsFileset[resourceType] ?? false;
61172
+ if (isFileset && typeof parsed["value"] === "object" && parsed["value"] !== null) {
61173
+ const filesetBasePath = removeSuffix(finalPath, ".resource.json") + ".fileset";
61174
+ r.push({
61175
+ isDirectory: true,
61176
+ path: filesetBasePath,
61177
+ async* getChildren() {
61178
+ for (const [relPath, fileContent] of Object.entries(parsed["value"])) {
61179
+ if (typeof fileContent === "string") {
61180
+ yield {
61181
+ isDirectory: false,
61182
+ path: path7.join(filesetBasePath, relPath),
61183
+ async* getChildren() {},
61184
+ async getContentText() {
61185
+ return fileContent;
61186
+ }
61187
+ };
61188
+ }
61189
+ }
61190
+ },
61191
+ async getContentText() {
61192
+ throw new Error("Cannot get content of directory");
61193
+ }
61194
+ });
61195
+ } else if (formatExtension) {
61093
61196
  const fileContent = parsed["value"]["content"];
61094
61197
  if (typeof fileContent === "string") {
61095
61198
  r.push({
@@ -61172,7 +61275,7 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
61172
61275
  continue;
61173
61276
  }
61174
61277
  const path8 = entry.path;
61175
- if (!isFileResource(path8) && !isRawAppFile(path8) && !isWorkspaceDependencies(path8)) {
61278
+ if (!isFileResource(path8) && !isFilesetResource(path8) && !isRawAppFile(path8) && !isWorkspaceDependencies(path8)) {
61176
61279
  if (json && path8.endsWith(".yaml"))
61177
61280
  continue;
61178
61281
  if (!json && path8.endsWith(".json"))
@@ -61206,7 +61309,7 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
61206
61309
  continue;
61207
61310
  }
61208
61311
  }
61209
- if (skips.skipResources && isFileResource(path8))
61312
+ if (skips.skipResources && (isFileResource(path8) || isFilesetResource(path8)))
61210
61313
  continue;
61211
61314
  const ext2 = json ? ".json" : ".yaml";
61212
61315
  if (!skips.includeSchedules && path8.endsWith(".schedule" + ext2))
@@ -61589,13 +61692,17 @@ async function pull(opts) {
61589
61692
  const codebases = await listSyncCodebases(opts);
61590
61693
  info(colors.gray("Computing the files to update locally to match remote (taking wmill.yaml into account)"));
61591
61694
  let resourceTypeToFormatExtension = {};
61695
+ let resourceTypeToIsFileset = {};
61592
61696
  try {
61593
- resourceTypeToFormatExtension = await fileResourceTypeToFileExtMap({
61697
+ const raw = await fileResourceTypeToFileExtMap({
61594
61698
  workspace: workspace.workspaceId
61595
61699
  });
61700
+ const parsed = parseFileResourceTypeMap(raw);
61701
+ resourceTypeToFormatExtension = parsed.formatExtMap;
61702
+ resourceTypeToIsFileset = parsed.filesetMap;
61596
61703
  } catch {}
61597
61704
  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);
61598
- const remote = ZipFSElement(zipFile, !opts.json, opts.defaultTs ?? "bun", resourceTypeToFormatExtension, true);
61705
+ const remote = ZipFSElement(zipFile, !opts.json, opts.defaultTs ?? "bun", resourceTypeToFormatExtension, resourceTypeToIsFileset, true);
61599
61706
  const local = !opts.stateful ? await FSFSElement(process.cwd(), codebases, true) : await FSFSElement(path7.join(process.cwd(), ".wmill"), [], true);
61600
61707
  const changes = await compareDynFSElement(remote, local, await ignoreF(opts), opts.json ?? false, opts, false, codebases, true, specificItems, opts.branch, true);
61601
61708
  info(`remote (${workspace.name}) -> local: ${changes.length} changes to apply`);
@@ -61645,7 +61752,7 @@ async function pull(opts) {
61645
61752
  if (change.name === "edited") {
61646
61753
  if (opts.stateful) {
61647
61754
  try {
61648
- const currentLocal = await readFile7(target, "utf-8");
61755
+ const currentLocal = await readFile8(target, "utf-8");
61649
61756
  if (currentLocal !== change.before && currentLocal !== change.after) {
61650
61757
  info(colors.red(`Conflict detected on ${change.path}
61651
61758
  Both local and remote have been modified.`));
@@ -61852,12 +61959,16 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
61852
61959
  }
61853
61960
  info(colors.gray("Computing the files to update on the remote to match local (taking wmill.yaml includes/excludes into account)"));
61854
61961
  let resourceTypeToFormatExtension = {};
61962
+ let resourceTypeToIsFileset = {};
61855
61963
  try {
61856
- resourceTypeToFormatExtension = await fileResourceTypeToFileExtMap({
61964
+ const raw = await fileResourceTypeToFileExtMap({
61857
61965
  workspace: workspace.workspaceId
61858
61966
  });
61967
+ const parsed = parseFileResourceTypeMap(raw);
61968
+ resourceTypeToFormatExtension = parsed.formatExtMap;
61969
+ resourceTypeToIsFileset = parsed.filesetMap;
61859
61970
  } catch {}
61860
- 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, false);
61971
+ 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);
61861
61972
  const local = await FSFSElement(path7.join(process.cwd(), ""), codebases, false);
61862
61973
  const changes = await compareDynFSElement(local, remote, await ignoreF(opts), opts.json ?? false, opts, true, codebases, false, specificItems, opts.branch, false);
61863
61974
  const rawWorkspaceDependencies = await getRawWorkspaceDependencies();
@@ -62018,7 +62129,24 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
62018
62129
  const resourceFilePath = await findResourceFile(change.path);
62019
62130
  if (!alreadySynced.includes(resourceFilePath)) {
62020
62131
  alreadySynced.push(resourceFilePath);
62021
- const newObj2 = parseFromPath(resourceFilePath, await readFile7(resourceFilePath, "utf-8"));
62132
+ const newObj2 = parseFromPath(resourceFilePath, await readFile8(resourceFilePath, "utf-8"));
62133
+ let serverPath = resourceFilePath;
62134
+ const currentBranch = cachedBranchForPush;
62135
+ if (currentBranch && isBranchSpecificFile(resourceFilePath)) {
62136
+ serverPath = fromBranchSpecificPath(resourceFilePath, currentBranch);
62137
+ }
62138
+ await pushResource(workspace.workspaceId, serverPath, undefined, newObj2, resourceFilePath);
62139
+ if (stateTarget) {
62140
+ await writeFile6(stateTarget, change.after, "utf-8");
62141
+ }
62142
+ continue;
62143
+ }
62144
+ }
62145
+ if (isFilesetResource(change.path)) {
62146
+ const resourceFilePath = await findFilesetResourceFile(change.path);
62147
+ if (!alreadySynced.includes(resourceFilePath)) {
62148
+ alreadySynced.push(resourceFilePath);
62149
+ const newObj2 = parseFromPath(resourceFilePath, await readFile8(resourceFilePath, "utf-8"));
62022
62150
  let serverPath = resourceFilePath;
62023
62151
  const currentBranch = cachedBranchForPush;
62024
62152
  if (currentBranch && isBranchSpecificFile(resourceFilePath)) {
@@ -62042,7 +62170,7 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
62042
62170
  await writeFile6(stateTarget, change.after, "utf-8");
62043
62171
  }
62044
62172
  } else if (change.name === "added") {
62045
- if (change.path.endsWith(".script.json") || change.path.endsWith(".script.yaml") || change.path.endsWith(".lock") || isFileResource(change.path)) {
62173
+ if (change.path.endsWith(".script.json") || change.path.endsWith(".script.yaml") || change.path.endsWith(".lock") || isFileResource(change.path) || isFilesetResource(change.path)) {
62046
62174
  continue;
62047
62175
  } else if (await handleFile(change.path, workspace, alreadySynced, opts.message, opts, rawWorkspaceDependencies, codebases)) {
62048
62176
  continue;
@@ -62586,7 +62714,7 @@ __export(exports_metadata, {
62586
62714
  LockfileGenerationError: () => LockfileGenerationError
62587
62715
  });
62588
62716
  import { sep as SEP9 } from "node:path";
62589
- import { readFile as readFile8, writeFile as writeFile7, stat as stat7, rm as rm2, readdir as readdir4 } from "node:fs/promises";
62717
+ import { readFile as readFile9, writeFile as writeFile7, stat as stat7, rm as rm2, readdir as readdir5 } from "node:fs/promises";
62590
62718
  import { readFileSync as readFileSync3 } from "node:fs";
62591
62719
  import { createRequire as createRequire2 } from "node:module";
62592
62720
  function loadParser(pkgName) {
@@ -62606,12 +62734,12 @@ async function generateAllMetadata() {}
62606
62734
  async function getRawWorkspaceDependencies() {
62607
62735
  const rawWorkspaceDeps = {};
62608
62736
  try {
62609
- const entries = await readdir4("dependencies", { withFileTypes: true });
62737
+ const entries = await readdir5("dependencies", { withFileTypes: true });
62610
62738
  for (const entry of entries) {
62611
62739
  if (entry.isDirectory())
62612
62740
  continue;
62613
62741
  const filePath = `dependencies/${entry.name}`;
62614
- const content = await readFile8(filePath, "utf-8");
62742
+ const content = await readFile9(filePath, "utf-8");
62615
62743
  for (const lang of workspaceDependenciesLanguages) {
62616
62744
  if (entry.name.endsWith(lang.filename)) {
62617
62745
  const contentHash = await generateHash(content + filePath);
@@ -62657,7 +62785,7 @@ async function filterWorkspaceDependenciesForScripts(scripts, rawWorkspaceDepend
62657
62785
  if (content.startsWith("!inline ")) {
62658
62786
  const filePath = folder + sep3 + content.replace("!inline ", "");
62659
62787
  try {
62660
- content = await readFile8(filePath, "utf-8");
62788
+ content = await readFile9(filePath, "utf-8");
62661
62789
  } catch {
62662
62790
  continue;
62663
62791
  }
@@ -62677,8 +62805,8 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
62677
62805
  const remotePath = scriptPath.substring(0, scriptPath.indexOf(".")).replaceAll(SEP9, "/");
62678
62806
  const language = inferContentTypeFromFilePath(scriptPath, opts.defaultTs);
62679
62807
  const metadataWithType = await parseMetadataFile(remotePath, undefined);
62680
- const scriptContent = await readFile8(scriptPath, "utf-8");
62681
- const metadataContent = await readFile8(metadataWithType.path, "utf-8");
62808
+ const scriptContent = await readFile9(scriptPath, "utf-8");
62809
+ const metadataContent = await readFile9(metadataWithType.path, "utf-8");
62682
62810
  const filteredRawWorkspaceDependencies = filterWorkspaceDependencies(rawWorkspaceDependencies, scriptContent, language);
62683
62811
  let hash2 = await generateScriptHash(filteredRawWorkspaceDependencies, scriptContent, metadataContent);
62684
62812
  if (await checkifMetadataUptodate(remotePath, hash2, undefined)) {
@@ -63022,7 +63150,7 @@ async function parseMetadataFile(scriptPath, generateMetadataIfMissing) {
63022
63150
  await stat7(metadataFilePath);
63023
63151
  return {
63024
63152
  path: metadataFilePath,
63025
- payload: JSON.parse(await readFile8(metadataFilePath, "utf-8")),
63153
+ payload: JSON.parse(await readFile9(metadataFilePath, "utf-8")),
63026
63154
  isJson: true
63027
63155
  };
63028
63156
  } catch {
@@ -63189,7 +63317,7 @@ var init_metadata = __esm(async () => {
63189
63317
  // src/commands/app/raw_apps.ts
63190
63318
  import { sep as SEP10 } from "node:path";
63191
63319
  import path8 from "node:path";
63192
- import { readFile as readFile9, readdir as readdir5 } from "node:fs/promises";
63320
+ import { readFile as readFile10, readdir as readdir6 } from "node:fs/promises";
63193
63321
  async function findRunnableContentFile(backendPath, runnableId, allFiles) {
63194
63322
  for (const fileName of allFiles) {
63195
63323
  if (fileName.endsWith(".yaml") || fileName.endsWith(".lock")) {
@@ -63201,7 +63329,7 @@ async function findRunnableContentFile(backendPath, runnableId, allFiles) {
63201
63329
  const ext2 = fileName.substring(runnableId.length + 1);
63202
63330
  if (EXTENSION_TO_LANGUAGE[ext2]) {
63203
63331
  try {
63204
- const content = await readFile9(path8.join(backendPath, fileName), "utf-8");
63332
+ const content = await readFile10(path8.join(backendPath, fileName), "utf-8");
63205
63333
  return { ext: ext2, content };
63206
63334
  } catch {
63207
63335
  continue;
@@ -63225,7 +63353,7 @@ async function loadRunnablesFromBackend(backendPath, defaultTs = "bun") {
63225
63353
  const runnables = {};
63226
63354
  try {
63227
63355
  const allFiles = [];
63228
- const _entries = await readdir5(backendPath, { withFileTypes: true });
63356
+ const _entries = await readdir6(backendPath, { withFileTypes: true });
63229
63357
  for (const entry of _entries) {
63230
63358
  if (entry.isFile()) {
63231
63359
  allFiles.push(entry.name);
@@ -63246,7 +63374,7 @@ async function loadRunnablesFromBackend(backendPath, defaultTs = "bun") {
63246
63374
  const language = getLanguageFromExtension(contentFile.ext, defaultTs);
63247
63375
  let lock;
63248
63376
  try {
63249
- lock = await readFile9(path8.join(backendPath, `${runnableId}.lock`), "utf-8");
63377
+ lock = await readFile10(path8.join(backendPath, `${runnableId}.lock`), "utf-8");
63250
63378
  } catch {}
63251
63379
  runnable.inlineScript = {
63252
63380
  content: contentFile.content,
@@ -63277,7 +63405,7 @@ async function loadRunnablesFromBackend(backendPath, defaultTs = "bun") {
63277
63405
  const language = getLanguageFromExtension(contentFile.ext, defaultTs);
63278
63406
  let lock;
63279
63407
  try {
63280
- lock = await readFile9(path8.join(backendPath, `${runnableId}.lock`), "utf-8");
63408
+ lock = await readFile10(path8.join(backendPath, `${runnableId}.lock`), "utf-8");
63281
63409
  } catch {}
63282
63410
  runnables[runnableId] = {
63283
63411
  type: "inline",
@@ -63311,7 +63439,7 @@ function writeRunnableToBackend(backendPath, runnableId, runnable) {
63311
63439
  async function collectAppFiles(localPath) {
63312
63440
  const files = {};
63313
63441
  async function readDirRecursive(dir, basePath = "/") {
63314
- const dirEntries = await readdir5(dir, { withFileTypes: true });
63442
+ const dirEntries = await readdir6(dir, { withFileTypes: true });
63315
63443
  for (const entry of dirEntries) {
63316
63444
  const fullPath = dir + entry.name;
63317
63445
  const relativePath = basePath + entry.name;
@@ -63324,7 +63452,7 @@ async function collectAppFiles(localPath) {
63324
63452
  if (entry.name === "raw_app.yaml" || entry.name === "package-lock.json" || entry.name === "DATATABLES.md" || entry.name === "AGENTS.md" || entry.name === "wmill.d.ts") {
63325
63453
  continue;
63326
63454
  }
63327
- const content = await readFile9(fullPath, "utf-8");
63455
+ const content = await readFile10(fullPath, "utf-8");
63328
63456
  files[relativePath] = content;
63329
63457
  }
63330
63458
  }
@@ -63475,7 +63603,7 @@ __export(exports_app_metadata, {
63475
63603
  APP_BACKEND_FOLDER: () => APP_BACKEND_FOLDER
63476
63604
  });
63477
63605
  import path9 from "node:path";
63478
- import { readFile as readFile10, mkdir as mkdir4 } from "node:fs/promises";
63606
+ import { readFile as readFile11, mkdir as mkdir4 } from "node:fs/promises";
63479
63607
  import { sep as SEP11 } from "node:path";
63480
63608
  async function generateAppHash(rawReqs, folder, rawApp, defaultTs) {
63481
63609
  const runnablesFolder = rawApp ? path9.join(folder, APP_BACKEND_FOLDER) : folder;
@@ -63790,7 +63918,7 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath) {
63790
63918
  const fullFilePath = path9.join(appFolder, APP_BACKEND_FOLDER, runnableFilePath);
63791
63919
  let content;
63792
63920
  try {
63793
- content = await readFile10(fullFilePath, "utf-8");
63921
+ content = await readFile11(fullFilePath, "utf-8");
63794
63922
  } catch {
63795
63923
  warn(colors.yellow(`Could not read file: ${fullFilePath}`));
63796
63924
  return;
@@ -64092,7 +64220,7 @@ import * as fs10 from "node:fs";
64092
64220
  import * as path11 from "node:path";
64093
64221
  import process14 from "node:process";
64094
64222
  import { writeFileSync as writeFileSync2 } from "node:fs";
64095
- import { readFile as readFile11 } from "node:fs/promises";
64223
+ import { readFile as readFile12 } from "node:fs/promises";
64096
64224
  async function dev(opts, appFolder) {
64097
64225
  GLOBAL_CONFIG_OPT.noCdToRoot = true;
64098
64226
  await loadNonDottedPathsSetting();
@@ -64366,7 +64494,7 @@ data: reload
64366
64494
  currentSqlFile = filePath;
64367
64495
  const fileName = path11.basename(filePath);
64368
64496
  try {
64369
- const sqlContent = await readFile11(filePath, "utf-8");
64497
+ const sqlContent = await readFile12(filePath, "utf-8");
64370
64498
  if (!sqlContent.trim()) {
64371
64499
  info(colors.gray(`Skipping empty file: ${fileName}`));
64372
64500
  currentSqlFile = null;
@@ -64398,7 +64526,7 @@ data: reload
64398
64526
  info(colors.cyan("[WebSocket] Client connected"));
64399
64527
  if (currentSqlFile && fs10.existsSync(currentSqlFile)) {
64400
64528
  try {
64401
- const sqlContent = await readFile11(currentSqlFile, "utf-8");
64529
+ const sqlContent = await readFile12(currentSqlFile, "utf-8");
64402
64530
  const datatable = await getDatatableConfig();
64403
64531
  const fileName = path11.basename(currentSqlFile);
64404
64532
  ws.send(JSON.stringify({
@@ -67232,13 +67360,13 @@ var init_settings = __esm(async () => {
67232
67360
  });
67233
67361
 
67234
67362
  // src/commands/instance/instance.ts
67235
- import { readFile as readFile12, writeFile as writeFile15, readdir as readdir6, mkdir as mkdir7, rm as rm3, stat as stat13 } from "node:fs/promises";
67363
+ import { readFile as readFile13, writeFile as writeFile15, readdir as readdir7, mkdir as mkdir7, rm as rm3, stat as stat13 } from "node:fs/promises";
67236
67364
  import { appendFile } from "node:fs/promises";
67237
67365
  import * as path15 from "node:path";
67238
67366
  async function allInstances() {
67239
67367
  try {
67240
67368
  const file = await getInstancesConfigFilePath();
67241
- const txt = await readFile12(file, "utf-8");
67369
+ const txt = await readFile13(file, "utf-8");
67242
67370
  return txt.split(`
67243
67371
  `).map((line) => {
67244
67372
  if (line.length <= 2) {
@@ -67632,7 +67760,7 @@ async function getLocalWorkspaces(rootDir, localPrefix, folderPerInstance) {
67632
67760
  await mkdir7(localPrefix);
67633
67761
  }
67634
67762
  if (folderPerInstance) {
67635
- const prefixEntries = await readdir6(rootDir + "/" + localPrefix, { withFileTypes: true });
67763
+ const prefixEntries = await readdir7(rootDir + "/" + localPrefix, { withFileTypes: true });
67636
67764
  for (const dir of prefixEntries) {
67637
67765
  if (dir.isDirectory()) {
67638
67766
  const dirName = dir.name;
@@ -67643,7 +67771,7 @@ async function getLocalWorkspaces(rootDir, localPrefix, folderPerInstance) {
67643
67771
  }
67644
67772
  }
67645
67773
  } else {
67646
- const rootEntries = await readdir6(rootDir, { withFileTypes: true });
67774
+ const rootEntries = await readdir7(rootDir, { withFileTypes: true });
67647
67775
  for (const dir of rootEntries) {
67648
67776
  const dirName = dir.name;
67649
67777
  if (dirName.startsWith(localPrefix + "_")) {
@@ -67675,7 +67803,7 @@ async function getActiveInstance(opts) {
67675
67803
  return opts.instance;
67676
67804
  }
67677
67805
  try {
67678
- return await readFile12(await getActiveInstanceFilePath(), "utf-8");
67806
+ return await readFile13(await getActiveInstanceFilePath(), "utf-8");
67679
67807
  } catch {
67680
67808
  return;
67681
67809
  }
@@ -68756,7 +68884,7 @@ function getTypeStrFromPath(p) {
68756
68884
  if (typeEnding === "script" || typeEnding === "variable" || typeEnding === "resource" || typeEnding === "resource-type" || typeEnding === "app" || typeEnding === "schedule" || typeEnding === "http_trigger" || typeEnding === "websocket_trigger" || typeEnding === "kafka_trigger" || typeEnding === "nats_trigger" || typeEnding === "postgres_trigger" || typeEnding === "mqtt_trigger" || typeEnding === "sqs_trigger" || typeEnding === "gcp_trigger" || typeEnding === "email_trigger" || typeEnding === "user" || typeEnding === "group" || typeEnding === "settings" || typeEnding === "encryption_key") {
68757
68885
  return typeEnding;
68758
68886
  } else {
68759
- if (isFileResource(p)) {
68887
+ if (isFileResource(p) || isFilesetResource(p)) {
68760
68888
  return "resource";
68761
68889
  }
68762
68890
  throw new Error("Could not infer type of path " + JSON.stringify(parsed));
@@ -68854,7 +68982,7 @@ function defaultFlowDefinition() {
68854
68982
 
68855
68983
  // src/commands/flow/flow.ts
68856
68984
  import { sep as SEP19 } from "node:path";
68857
- import { readFile as readFile13 } from "node:fs/promises";
68985
+ import { readFile as readFile14 } from "node:fs/promises";
68858
68986
  import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync4 } from "node:fs";
68859
68987
  async function pushFlow(workspace, remotePath, localPath, message) {
68860
68988
  if (alreadySynced3.includes(localPath)) {
@@ -68873,7 +69001,7 @@ async function pushFlow(workspace, remotePath, localPath, message) {
68873
69001
  localPath += SEP19;
68874
69002
  }
68875
69003
  const localFlow = await yamlParseFile(localPath + "flow.yaml");
68876
- await replaceInlineScripts(localFlow.value.modules, async (path17) => await readFile13(localPath + path17, "utf-8"), exports_log, localPath, SEP19);
69004
+ await replaceInlineScripts(localFlow.value.modules, async (path17) => await readFile14(localPath + path17, "utf-8"), exports_log, localPath, SEP19);
68877
69005
  if (flow) {
68878
69006
  if (isSuperset(localFlow, flow)) {
68879
69007
  info(colors.green(`Flow ${remotePath} is up to date`));
@@ -69015,7 +69143,7 @@ async function preview2(opts, flowPath) {
69015
69143
  flowPath += SEP19;
69016
69144
  }
69017
69145
  const localFlow = await yamlParseFile(flowPath + "flow.yaml");
69018
- await replaceInlineScripts(localFlow.value.modules, async (path17) => await readFile13(flowPath + path17, "utf-8"), exports_log, flowPath, SEP19);
69146
+ await replaceInlineScripts(localFlow.value.modules, async (path17) => await readFile14(flowPath + path17, "utf-8"), exports_log, flowPath, SEP19);
69019
69147
  const input = opts.data ? await resolve6(opts.data) : {};
69020
69148
  if (!opts.silent) {
69021
69149
  info(colors.yellow(`Running flow preview for ${flowPath}...`));
@@ -70778,6 +70906,19 @@ To enable shell completions for this program add the following line to your ${di
70778
70906
  }).noGlobals().action(() => this.showHelp()).command("bash", new BashCompletionsCommand(this.#cmd)).command("fish", new FishCompletionsCommand(this.#cmd)).command("zsh", new ZshCompletionsCommand(this.#cmd)).command("complete", new CompleteCommand(this.#cmd)).hidden().reset();
70779
70907
  }
70780
70908
  }
70909
+ // node_modules/@cliffy/command/completions/generate.js
70910
+ function generateShellCompletions(cmd, shell, { name = cmd.getName() } = {}) {
70911
+ switch (shell) {
70912
+ case "bash":
70913
+ return BashCompletionsGenerator.generate(name, cmd);
70914
+ case "fish":
70915
+ return FishCompletionsGenerator.generate(name, cmd);
70916
+ case "zsh":
70917
+ return ZshCompletionsGenerator.generate(name, cmd);
70918
+ default:
70919
+ throw new Error(`Unsupported shell: ${shell}`);
70920
+ }
70921
+ }
70781
70922
  // node_modules/@jsr/std__semver/_shared.js
70782
70923
  function compareNumber(a, b) {
70783
70924
  if (isNaN(a) || isNaN(b)) {
@@ -71314,7 +71455,7 @@ async function pull2(opts) {
71314
71455
  info("failed to parse schema for " + x.name);
71315
71456
  continue;
71316
71457
  }
71317
- if (resourceTypes.find((y) => y.name === x.name && typeof y.schema !== "string" && deepEqual(y.schema, x.schema) && y.description === x.description)) {
71458
+ if (resourceTypes.find((y) => y.name === x.name && typeof y.schema !== "string" && deepEqual(y.schema, x.schema) && y.description === x.description && (y.is_fileset ?? false) === (x.is_fileset ?? false))) {
71318
71459
  info("skipping " + x.name + " (same as current)");
71319
71460
  continue;
71320
71461
  }
@@ -71357,7 +71498,7 @@ await __promiseAll([
71357
71498
  ]);
71358
71499
  import { sep as SEP20 } from "node:path";
71359
71500
  import * as http3 from "node:http";
71360
- import { readFile as readFile14, realpath } from "node:fs/promises";
71501
+ import { readFile as readFile15, realpath } from "node:fs/promises";
71361
71502
  import { watch as watch2 } from "node:fs";
71362
71503
  var PORT = 3001;
71363
71504
  async function dev2(opts) {
@@ -71406,7 +71547,7 @@ async function dev2(opts) {
71406
71547
  if (typ == "flow") {
71407
71548
  const localPath = extractFolderPath(cpath, "flow");
71408
71549
  const localFlow = await yamlParseFile(localPath + "flow.yaml");
71409
- await replaceInlineScripts(localFlow.value.modules, async (path17) => await readFile14(localPath + path17, "utf-8"), exports_log, localPath, SEP20, undefined);
71550
+ await replaceInlineScripts(localFlow.value.modules, async (path17) => await readFile15(localPath + path17, "utf-8"), exports_log, localPath, SEP20, undefined);
71410
71551
  currentLastEdit = {
71411
71552
  type: "flow",
71412
71553
  flow: localFlow,
@@ -71415,7 +71556,7 @@ async function dev2(opts) {
71415
71556
  info("Updated " + localPath);
71416
71557
  broadcastChanges(currentLastEdit);
71417
71558
  } else if (typ == "script") {
71418
- const content = await readFile14(cpath, "utf-8");
71559
+ const content = await readFile15(cpath, "utf-8");
71419
71560
  const splitted = cpath.split(".");
71420
71561
  const wmPath = splitted[0];
71421
71562
  const lang = inferContentTypeFromFilePath(cpath, conf.defaultTs);
@@ -77964,7 +78105,7 @@ var jobs_default = command28;
77964
78105
 
77965
78106
  // src/main.ts
77966
78107
  await init_context();
77967
- var VERSION = "1.642.0";
78108
+ var VERSION = "1.643.0";
77968
78109
  var command29 = new Command().name("wmill").action(() => info(`Welcome to Windmill CLI ${VERSION}. Use -h for help.`)).description("Windmill CLI").globalOption("--workspace <workspace:string>", "Specify the target workspace. This overrides the default workspace.").globalOption("--debug --verbose", "Show debug/verbose logs").globalOption("--show-diffs", "Show diff informations when syncing (may show sensitive informations)").globalOption("--token <token:string>", "Specify an API token. This will override any stored token.").globalOption("--base-url <baseUrl:string>", "Specify the base URL of the API. If used, --token and --workspace are required and no local remote/workspace already set will be used.").globalOption("--config-dir <configDir:string>", "Specify a custom config directory. Overrides WMILL_CONFIG_DIR environment variable and default ~/.config location.").env("HEADERS <headers:string>", `Specify headers to use for all requests. e.g: "HEADERS='h1: v1, h2: v2'"`).version(VERSION).versionOption(false).command("init", init_default).command("app", app_default).command("flow", flow_default).command("script", script_default).command("workspace", workspace_default).command("resource", resource_default).command("resource-type", resource_type_default).command("user", user_default).command("variable", variable_default).command("hub", hub_default).command("folder", folder_default).command("schedule", schedule_default).command("trigger", trigger_default).command("dev", dev_default2).command("sync", sync_default).command("lint", lint_default).command("gitsync-settings", gitsync_settings_default).command("instance", instance_default).command("worker-groups", worker_groups_default).command("workers", workers_default).command("queues", queues_default).command("dependencies", dependencies_default).command("jobs", jobs_default).command("version --version", "Show version information").action(async (opts) => {
77969
78110
  console.log("CLI version: " + VERSION);
77970
78111
  try {
@@ -77994,7 +78135,16 @@ var command29 = new Command().name("wmill").action(() => info(`Welcome to Windmi
77994
78135
  }).error((e) => {
77995
78136
  error(e);
77996
78137
  info("Try running with sudo and otherwise check the result of the command: npm uninstall windmill-cli && npm install -g windmill-cli");
77997
- })).command("completions", new CompletionsCommand);
78138
+ })).command("completions", new Command().description("Generate shell completions.").command("bash", new Command().description("Generate bash completions.").action(() => {
78139
+ process.stdout.write(generateShellCompletions(command29, "bash") + `
78140
+ `);
78141
+ })).command("zsh", new Command().description("Generate zsh completions.").action(() => {
78142
+ process.stdout.write(generateShellCompletions(command29, "zsh") + `
78143
+ `);
78144
+ })).command("fish", new Command().description("Generate fish completions.").action(() => {
78145
+ process.stdout.write(generateShellCompletions(command29, "fish") + `
78146
+ `);
78147
+ })));
77998
78148
  async function main2() {
77999
78149
  try {
78000
78150
  const args = process.argv.slice(2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-cli",
3
- "version": "1.642.0",
3
+ "version": "1.643.0",
4
4
  "description": "CLI for Windmill",
5
5
  "license": "Apache 2.0",
6
6
  "type": "module",