windmill-cli 1.655.0 → 1.657.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 +81 -23
  2. package/package.json +1 -1
package/esm/main.js CHANGED
@@ -11785,7 +11785,7 @@ var init_OpenAPI = __esm(() => {
11785
11785
  PASSWORD: undefined,
11786
11786
  TOKEN: getEnv2("WM_TOKEN"),
11787
11787
  USERNAME: undefined,
11788
- VERSION: "1.655.0",
11788
+ VERSION: "1.657.0",
11789
11789
  WITH_CREDENTIALS: true,
11790
11790
  interceptors: {
11791
11791
  request: new Interceptors,
@@ -59380,7 +59380,7 @@ async function generateMetadata(opts, scriptPath) {
59380
59380
  } else {
59381
59381
  const ignore = await ignoreF(opts);
59382
59382
  const elems = await elementsToMap(await FSFSElement(process.cwd(), codebases, false), (p, isD) => {
59383
- return !isD && !exts.some((ext2) => p.endsWith(ext2)) || ignore(p, isD) || isFlowPath(p) || isAppPath(p);
59383
+ return !isD && !exts.some((ext2) => p.endsWith(ext2)) || ignore(p, isD) || isFlowPath(p) || isAppPath(p) || isRawAppPath(p);
59384
59384
  }, false, {});
59385
59385
  let hasAny = false;
59386
59386
  info("Generating metadata for all stale scripts:");
@@ -60584,8 +60584,8 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
60584
60584
  if (Object.keys(filteredDeps).length > 0 && !noStaleMessage) {
60585
60585
  info((await blueColor())(`Found workspace dependencies (${workspaceDependenciesLanguages.map((l) => l.filename).join("/")}) for ${folder}, using them`));
60586
60586
  }
60587
+ let changedScripts = [];
60587
60588
  if (!justUpdateMetadataLock) {
60588
- const changedScripts = [];
60589
60589
  for (const [path7, hash2] of Object.entries(hashes)) {
60590
60590
  if (path7 == TOP_HASH) {
60591
60591
  continue;
@@ -60627,6 +60627,11 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
60627
60627
  if (!noStaleMessage) {
60628
60628
  info(colors.green(`Flow ${remote_path} lockfiles updated`));
60629
60629
  }
60630
+ const updatedScripts = changedScripts.map((p) => {
60631
+ const parts = p.split(SEP7);
60632
+ return parts[parts.length - 1].replace(/\.[^.]+$/, "");
60633
+ });
60634
+ return { path: remote_path, updatedScripts };
60630
60635
  }
60631
60636
  async function filterWorkspaceDependenciesForFlow(flowValue, rawWorkspaceDependencies, folder) {
60632
60637
  const clonedValue = structuredClone(flowValue);
@@ -62984,7 +62989,6 @@ __export(exports_metadata, {
62984
62989
  getRawWorkspaceDependencies: () => getRawWorkspaceDependencies,
62985
62990
  generateScriptMetadataInternal: () => generateScriptMetadataInternal,
62986
62991
  generateScriptHash: () => generateScriptHash,
62987
- generateAllMetadata: () => generateAllMetadata,
62988
62992
  filterWorkspaceDependenciesForScripts: () => filterWorkspaceDependenciesForScripts,
62989
62993
  filterWorkspaceDependencies: () => filterWorkspaceDependencies,
62990
62994
  extractWorkspaceDepsAnnotation: () => extractWorkspaceDepsAnnotation,
@@ -63012,7 +63016,6 @@ function loadParser(pkgName) {
63012
63016
  }
63013
63017
  return p;
63014
63018
  }
63015
- async function generateAllMetadata() {}
63016
63019
  async function getRawWorkspaceDependencies() {
63017
63020
  const rawWorkspaceDeps = {};
63018
63021
  try {
@@ -63407,6 +63410,9 @@ async function inferSchema(language, content, currentSchema, path8) {
63407
63410
  }
63408
63411
  currentSchema.properties[arg.name] = sortObject(currentSchema.properties[arg.name]);
63409
63412
  argSigToJsonSchemaType(arg.typ, currentSchema.properties[arg.name]);
63413
+ if (arg.otyp && arg.otyp.includes("[") && arg.otyp.includes("|")) {
63414
+ currentSchema.properties[arg.name].originalType = arg.otyp;
63415
+ }
63410
63416
  currentSchema.properties[arg.name].default = arg.default;
63411
63417
  if (!arg.has_default && !currentSchema.required.includes(arg.name)) {
63412
63418
  currentSchema.required.push(arg.name);
@@ -63951,6 +63957,7 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
63951
63957
  if (Object.keys(filteredDeps).length > 0 && !noStaleMessage) {
63952
63958
  info((await blueColor())(`Found workspace dependencies (${workspaceDependenciesLanguages.map((l) => l.filename).join("/")}) for ${appFolder}, using them`));
63953
63959
  }
63960
+ let updatedScripts = [];
63954
63961
  if (!justUpdateMetadataLock) {
63955
63962
  const changedScripts = [];
63956
63963
  for (const [scriptPath, hash2] of Object.entries(hashes)) {
@@ -63973,11 +63980,13 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
63973
63980
  runnables = rawAppFile.runnables;
63974
63981
  }
63975
63982
  replaceInlineScripts2(runnables, runnablesPath + SEP11, false);
63976
- await updateRawAppRunnables(workspace, runnables, remote_path, appFolder, filteredDeps, opts.defaultTs);
63983
+ updatedScripts = await updateRawAppRunnables(workspace, runnables, remote_path, appFolder, filteredDeps, opts.defaultTs, noStaleMessage);
63977
63984
  } else {
63978
63985
  const normalAppFile = appFile;
63979
63986
  replaceInlineScripts2(normalAppFile.value, appFolder + SEP11, false);
63980
- normalAppFile.value = await updateAppInlineScripts(workspace, normalAppFile.value, remote_path, appFolder, filteredDeps, opts.defaultTs);
63987
+ const result = await updateAppInlineScripts(workspace, normalAppFile.value, remote_path, appFolder, filteredDeps, opts.defaultTs, noStaleMessage);
63988
+ normalAppFile.value = result.value;
63989
+ updatedScripts = result.updatedScripts;
63981
63990
  writeIfChanged(appFilePath, import_yaml17.stringify(appFile, yamlOptions));
63982
63991
  }
63983
63992
  } else if (!noStaleMessage) {
@@ -63992,6 +64001,7 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
63992
64001
  if (!noStaleMessage) {
63993
64002
  info(colors.green(`App ${remote_path} lockfiles updated`));
63994
64003
  }
64004
+ return { path: remote_path, updatedScripts };
63995
64005
  }
63996
64006
  async function filterWorkspaceDependenciesForApp(appValue, rawWorkspaceDependencies, folder) {
63997
64007
  const scripts = [];
@@ -64033,7 +64043,8 @@ async function traverseAndProcessInlineScripts(obj, processor, currentPath = [])
64033
64043
  }
64034
64044
  return result;
64035
64045
  }
64036
- async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder, rawDeps, defaultTs = "bun") {
64046
+ async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder, rawDeps, defaultTs = "bun", noStaleMessage) {
64047
+ const updatedRunnables = [];
64037
64048
  const runnablesFolder = path9.join(appFolder, APP_BACKEND_FOLDER);
64038
64049
  try {
64039
64050
  await mkdir4(runnablesFolder, { recursive: true });
@@ -64070,8 +64081,9 @@ async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder
64070
64081
  writeRunnableToBackend(runnablesFolder, runnableId, simplifiedRunnable);
64071
64082
  continue;
64072
64083
  }
64073
- info(colors.gray(`Generating lock for runnable ${runnableId} (${language})
64074
- }`));
64084
+ if (!noStaleMessage) {
64085
+ info(colors.gray(`Generating lock for runnable ${runnableId} (${language})`));
64086
+ }
64075
64087
  try {
64076
64088
  const lock = await generateInlineScriptLock(workspace, content, language, `${remotePath}/${runnableId}`, rawDeps);
64077
64089
  const [basePathO, ext2] = pathAssigner.assignPath(runnable.name ?? runnableId, language);
@@ -64089,15 +64101,20 @@ async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder
64089
64101
  }
64090
64102
  }
64091
64103
  writeRunnableToBackend(runnablesFolder, runnableId, simplifiedRunnable);
64092
- info(colors.gray(` Written ${runnableId}.yaml, ${basePath}${ext2}${lock ? ` and ${basePath}lock` : ""}`));
64104
+ updatedRunnables.push(runnableId);
64105
+ if (!noStaleMessage) {
64106
+ info(colors.gray(` Written ${runnableId}.yaml, ${basePath}${ext2}${lock ? ` and ${basePath}lock` : ""}`));
64107
+ }
64093
64108
  } catch (error2) {
64094
64109
  error(colors.red(`Failed to generate lock for runnable ${runnableId}: ${error2.message}`));
64095
64110
  writeRunnableToBackend(runnablesFolder, runnableId, runnable);
64096
64111
  }
64097
64112
  }
64113
+ return updatedRunnables;
64098
64114
  }
64099
- async function updateAppInlineScripts(workspace, appValue, remotePath, appFolder, rawDeps, defaultTs = "bun") {
64115
+ async function updateAppInlineScripts(workspace, appValue, remotePath, appFolder, rawDeps, defaultTs = "bun", noStaleMessage) {
64100
64116
  const pathAssigner = newPathAssigner(defaultTs, { skipInlineScriptSuffix: getNonDottedPaths() });
64117
+ const updatedScripts = [];
64101
64118
  const processor = async (inlineScript, context) => {
64102
64119
  const language = inlineScript.language;
64103
64120
  const content = inlineScript.content;
@@ -64113,7 +64130,9 @@ async function updateAppInlineScripts(workspace, appValue, remotePath, appFolder
64113
64130
  try {
64114
64131
  let lock;
64115
64132
  if (language !== "frontend") {
64116
- info(colors.gray(`Generating lock for inline script "${scriptName}" at ${context.path.join(".")} (${language})`));
64133
+ if (!noStaleMessage) {
64134
+ info(colors.gray(`Generating lock for inline script "${scriptName}" at ${context.path.join(".")} (${language})`));
64135
+ }
64117
64136
  lock = await generateInlineScriptLock(workspace, content, language, scriptPath, rawDeps);
64118
64137
  }
64119
64138
  const [basePathO, ext2] = pathAssigner.assignPath(scriptName, language);
@@ -64126,7 +64145,12 @@ async function updateAppInlineScripts(workspace, appValue, remotePath, appFolder
64126
64145
  }
64127
64146
  const inlineContentRef = `!inline ${basePath}${ext2}`;
64128
64147
  const inlineLockRef = lock && lock !== "" ? `!inline ${basePath}lock` : "";
64129
- info(colors.gray(` Written ${basePath}${ext2}${lock ? ` and ${basePath}lock` : ""}`));
64148
+ if (!noStaleMessage) {
64149
+ info(colors.gray(` Written ${basePath}${ext2}${lock ? ` and ${basePath}lock` : ""}`));
64150
+ }
64151
+ if (language !== "frontend") {
64152
+ updatedScripts.push(scriptName);
64153
+ }
64130
64154
  return {
64131
64155
  ...inlineScript,
64132
64156
  content: inlineContentRef,
@@ -64137,7 +64161,8 @@ async function updateAppInlineScripts(workspace, appValue, remotePath, appFolder
64137
64161
  return inlineScript;
64138
64162
  }
64139
64163
  };
64140
- return await traverseAndProcessInlineScripts(appValue, processor);
64164
+ const updatedValue = await traverseAndProcessInlineScripts(appValue, processor);
64165
+ return { value: updatedValue, updatedScripts };
64141
64166
  }
64142
64167
  async function generateInlineScriptLock(workspace, content, language, scriptPath, rawWorkspaceDependencies) {
64143
64168
  const filteredDeps = rawWorkspaceDependencies ? filterWorkspaceDependencies(rawWorkspaceDependencies, content, language) : undefined;
@@ -67265,6 +67290,8 @@ function migrateToGroupedFormat(settings) {
67265
67290
  result.color = settings.color;
67266
67291
  if (settings.operator_settings !== undefined)
67267
67292
  result.operator_settings = settings.operator_settings;
67293
+ if (settings.datatable !== undefined)
67294
+ result.datatable = settings.datatable;
67268
67295
  if (settings.slack_team_id !== undefined)
67269
67296
  result.slack_team_id = settings.slack_team_id;
67270
67297
  if (settings.slack_name !== undefined)
@@ -67333,6 +67360,7 @@ async function pushWorkspaceSettings(workspace, _path, settings, localSettings)
67333
67360
  mute_critical_alerts: remoteSettings.mute_critical_alerts,
67334
67361
  color: remoteSettings.color,
67335
67362
  operator_settings: remoteSettings.operator_settings,
67363
+ datatable: remoteSettings.datatable,
67336
67364
  slack_team_id: remoteSettings.slack_team_id,
67337
67365
  slack_name: remoteSettings.slack_name,
67338
67366
  slack_command_script: remoteSettings.slack_command_script
@@ -67491,6 +67519,13 @@ async function pushWorkspaceSettings(workspace, _path, settings, localSettings)
67491
67519
  requestBody: localSettings.operator_settings
67492
67520
  });
67493
67521
  }
67522
+ if (!deepEqual(localSettings.datatable, settings.datatable)) {
67523
+ debug(`Updating datatable config...`);
67524
+ await editDataTableConfig({
67525
+ workspace,
67526
+ requestBody: { settings: localSettings.datatable ?? { datatables: {} } }
67527
+ });
67528
+ }
67494
67529
  if (localSettings.slack_command_script != settings.slack_command_script) {
67495
67530
  debug(`Updating slack command script...`);
67496
67531
  await editSlackCommand({
@@ -77322,6 +77357,23 @@ folder related commands
77322
77357
  - \`folder add-missing\` - create default folder.meta.yaml for all subdirectories of f/ that are missing one
77323
77358
  - \`-y, --yes\` - skip confirmation prompt
77324
77359
 
77360
+ ### generate-metadata
77361
+
77362
+ Generate metadata (locks, schemas) for all scripts, flows, and apps
77363
+
77364
+ **Arguments:** \`[folder:string]\`
77365
+
77366
+ **Options:**
77367
+ - \`--yes\` - Skip confirmation prompt
77368
+ - \`--dry-run\` - Show what would be updated without making changes
77369
+ - \`--lock-only\` - Re-generate only the lock files
77370
+ - \`--schema-only\` - Re-generate only script schemas (skips flows and apps)
77371
+ - \`--skip-scripts\` - Skip processing scripts
77372
+ - \`--skip-flows\` - Skip processing flows
77373
+ - \`--skip-apps\` - Skip processing apps
77374
+ - \`-i --includes <patterns:file[]>\` - Comma separated patterns to specify which files to include
77375
+ - \`-e --excludes <patterns:file[]>\` - Comma separated patterns to specify which files to exclude
77376
+
77325
77377
  ### gitsync-settings
77326
77378
 
77327
77379
  Manage git-sync settings between local wmill.yaml and Windmill backend
@@ -78996,7 +79048,7 @@ async function generateMetadata2(opts, folder) {
78996
79048
  info(colors.gray(`Checking ${checking.join(", ")}...`));
78997
79049
  if (!skipScripts) {
78998
79050
  const scriptElems = await elementsToMap(await FSFSElement(process.cwd(), codebases, false), (p, isD) => {
78999
- return !isD && !exts.some((ext2) => p.endsWith(ext2)) || ignore(p, isD) || isFlowPath(p) || isAppPath(p);
79051
+ return !isD && !exts.some((ext2) => p.endsWith(ext2)) || ignore(p, isD) || isFlowPath(p) || isAppPath(p) || isRawAppPath(p);
79000
79052
  }, false, {});
79001
79053
  for (const e of Object.keys(scriptElems)) {
79002
79054
  const candidate = await generateScriptMetadataInternal(e, workspace, opts, true, true, rawWorkspaceDependencies, codebases, false);
@@ -79037,10 +79089,14 @@ async function generateMetadata2(opts, folder) {
79037
79089
  }
79038
79090
  let filteredItems = staleItems;
79039
79091
  if (folder) {
79040
- if (folder.endsWith(SEP21)) {
79092
+ folder = folder.replaceAll("\\", "/");
79093
+ if (folder.endsWith("/")) {
79041
79094
  folder = folder.substring(0, folder.length - 1);
79042
79095
  }
79043
- filteredItems = staleItems.filter((item) => item.folder === folder || item.folder.startsWith(folder + SEP21));
79096
+ filteredItems = staleItems.filter((item) => {
79097
+ const normalizedFolder = item.folder.replaceAll("\\", "/");
79098
+ return normalizedFolder === folder || normalizedFolder.startsWith(folder + "/");
79099
+ });
79044
79100
  }
79045
79101
  if (filteredItems.length === 0) {
79046
79102
  info(colors.green("All metadata up-to-date"));
@@ -79094,13 +79150,15 @@ async function generateMetadata2(opts, folder) {
79094
79150
  }
79095
79151
  for (const item of flows) {
79096
79152
  current++;
79097
- info(`${formatProgress(current)} flow ${colors.cyan(item.path)}`);
79098
- await generateFlowLockInternal(item.folder, false, workspace, opts, false, true);
79153
+ const result = await generateFlowLockInternal(item.folder, false, workspace, opts, false, true);
79154
+ const scriptsInfo = result?.updatedScripts?.length ? `: ${colors.gray(result.updatedScripts.join(", "))}` : "";
79155
+ info(`${formatProgress(current)} flow ${colors.cyan(item.path)}${scriptsInfo}`);
79099
79156
  }
79100
79157
  for (const item of apps2) {
79101
79158
  current++;
79102
- info(`${formatProgress(current)} app ${colors.cyan(item.path)}`);
79103
- await generateAppLocksInternal(item.folder, item.isRawApp, false, workspace, opts, false, true);
79159
+ const result = await generateAppLocksInternal(item.folder, item.isRawApp, false, workspace, opts, false, true);
79160
+ const scriptsInfo = result?.updatedScripts?.length ? `: ${colors.gray(result.updatedScripts.join(", "))}` : "";
79161
+ info(`${formatProgress(current)} app ${colors.cyan(item.path)}${scriptsInfo}`);
79104
79162
  }
79105
79163
  info("");
79106
79164
  info(colors.green(`Done. Updated ${total} item(s).`));
@@ -79183,7 +79241,7 @@ var docs_default = command30;
79183
79241
 
79184
79242
  // src/main.ts
79185
79243
  await init_context();
79186
- var VERSION = "1.655.0";
79244
+ var VERSION = "1.657.0";
79187
79245
  var command31 = 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("generate-metadata", generate_metadata_default).command("docs", docs_default).command("version --version", "Show version information").action(async (opts) => {
79188
79246
  console.log("CLI version: " + VERSION);
79189
79247
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-cli",
3
- "version": "1.655.0",
3
+ "version": "1.657.0",
4
4
  "description": "CLI for Windmill",
5
5
  "license": "Apache 2.0",
6
6
  "type": "module",