windmill-cli 1.672.0 → 1.673.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 +74 -33
  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.672.0",
11815
+ VERSION: "1.673.0",
11816
11816
  WITH_CREDENTIALS: true,
11817
11817
  interceptors: {
11818
11818
  request: new Interceptors,
@@ -12210,6 +12210,7 @@ __export(exports_services_gen, {
12210
12210
  resumeSuspendedFlowAsOwner: () => resumeSuspendedFlowAsOwner,
12211
12211
  resumeSuspended: () => resumeSuspended,
12212
12212
  resultById: () => resultById,
12213
+ restartWorkerGroup: () => restartWorkerGroup,
12213
12214
  restartFlowAtStep: () => restartFlowAtStep,
12214
12215
  resolveNpmPackageVersion: () => resolveNpmPackageVersion,
12215
12216
  resetPassword: () => resetPassword,
@@ -13168,6 +13169,14 @@ var backendVersion = () => {
13168
13169
  method: "POST",
13169
13170
  url: "/settings/send_stats"
13170
13171
  });
13172
+ }, restartWorkerGroup = (data2) => {
13173
+ return request(OpenAPI, {
13174
+ method: "POST",
13175
+ url: "/settings/restart_worker_group/{worker_group}",
13176
+ path: {
13177
+ worker_group: data2.workerGroup
13178
+ }
13179
+ });
13171
13180
  }, getStats = () => {
13172
13181
  return request(OpenAPI, {
13173
13182
  method: "GET",
@@ -59809,6 +59818,19 @@ async function track_job(workspace, id) {
59809
59818
  info("Job appears to have completed, but no data can be retrieved");
59810
59819
  }
59811
59820
  }
59821
+ async function pollForJobResult(workspace, jobId) {
59822
+ while (true) {
59823
+ const maybeResult = await getCompletedJobResultMaybe({
59824
+ workspace,
59825
+ id: jobId,
59826
+ getStarted: false
59827
+ });
59828
+ if (maybeResult.completed) {
59829
+ return { result: maybeResult.result, success: maybeResult.success ?? false };
59830
+ }
59831
+ await new Promise((resolve7) => setTimeout(resolve7, POLL_INTERVAL_MS));
59832
+ }
59833
+ }
59812
59834
  async function show(opts, path6) {
59813
59835
  const workspace = await resolveWorkspace(opts);
59814
59836
  await requireLogin(opts);
@@ -60081,7 +60103,7 @@ async function preview(opts, filePath) {
60081
60103
  }
60082
60104
  }
60083
60105
  } else {
60084
- const result = await runScriptPreviewAndWaitResult({
60106
+ const jobId = await runScriptPreview({
60085
60107
  workspace: workspace.workspaceId,
60086
60108
  requestBody: {
60087
60109
  content,
@@ -60091,8 +60113,19 @@ async function preview(opts, filePath) {
60091
60113
  modules: modules ?? undefined
60092
60114
  }
60093
60115
  });
60116
+ const { result, success } = await pollForJobResult(workspace.workspaceId, jobId);
60117
+ if (!success) {
60118
+ if (opts.silent) {
60119
+ console.log(JSON.stringify(result));
60120
+ } else {
60121
+ info(colors.red.bold("Preview failed"));
60122
+ info(JSON.stringify(result, null, 2));
60123
+ }
60124
+ process.exitCode = 1;
60125
+ return;
60126
+ }
60094
60127
  if (opts.silent) {
60095
- console.log(JSON.stringify(result, null, 2));
60128
+ console.log(JSON.stringify(result));
60096
60129
  } else {
60097
60130
  info(colors.bold.underline.green("Preview completed"));
60098
60131
  info(JSON.stringify(result, null, 2));
@@ -60124,7 +60157,7 @@ async function history(opts, scriptPath) {
60124
60157
  ])).render();
60125
60158
  }
60126
60159
  }
60127
- var import_yaml5, exts, languageAliases, command3, script_default;
60160
+ var import_yaml5, exts, POLL_INTERVAL_MS = 2000, languageAliases, command3, script_default;
60128
60161
  var init_script = __esm(async () => {
60129
60162
  init_colors2();
60130
60163
  init_mod3();
@@ -63310,9 +63343,22 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
63310
63343
  }
63311
63344
  }
63312
63345
  for (const folderName of folderNames) {
63313
- try {
63314
- await stat6(path8.join("f", folderName, "folder.meta.yaml"));
63315
- } catch {
63346
+ const basePath = path8.join("f", folderName, "folder.meta.yaml");
63347
+ const branchPath = getBranchSpecificPath(`f/${folderName}/folder.meta.yaml`, specificItems, opts.branch);
63348
+ let found = false;
63349
+ if (branchPath) {
63350
+ try {
63351
+ await stat6(branchPath);
63352
+ found = true;
63353
+ } catch {}
63354
+ }
63355
+ if (!found) {
63356
+ try {
63357
+ await stat6(basePath);
63358
+ found = true;
63359
+ } catch {}
63360
+ }
63361
+ if (!found) {
63316
63362
  missingFolders.push(folderName);
63317
63363
  }
63318
63364
  }
@@ -64733,8 +64779,8 @@ async function parseMetadataFile(scriptPath, generateMetadataIfMissing) {
64733
64779
  }
64734
64780
  }
64735
64781
  }
64736
- info((await blueColor())(`Creating script metadata file for ${metadataFilePath}`));
64737
64782
  metadataFilePath = scriptPath + ".script.yaml";
64783
+ info((await blueColor())(`Creating script metadata file for ${metadataFilePath}`));
64738
64784
  let scriptInitialMetadata = defaultScriptMetadata();
64739
64785
  const lockPath = scriptPath + ".script.lock";
64740
64786
  scriptInitialMetadata.lock = "!inline " + lockPath;
@@ -71368,30 +71414,24 @@ async function preview2(opts, flowPath) {
71368
71414
  info(colors.yellow(`Running flow preview for ${flowPath}...`));
71369
71415
  }
71370
71416
  debug(`Flow value: ${JSON.stringify(localFlow.value, null, 2)}`);
71371
- let result;
71372
- try {
71373
- result = await runFlowPreviewAndWaitResult({
71374
- workspace: workspace.workspaceId,
71375
- requestBody: {
71376
- value: localFlow.value,
71377
- path: flowPath.substring(0, flowPath.indexOf(".flow")).replaceAll(SEP19, "/"),
71378
- args: input
71379
- }
71380
- });
71381
- } catch (e) {
71382
- if (e.body) {
71383
- if (e.body.result !== undefined) {
71384
- if (opts.silent) {
71385
- console.log(JSON.stringify(e.body.result));
71386
- } else {
71387
- info(colors.yellow.bold("Flow failed, error handler result:"));
71388
- info(JSON.stringify(e.body.result, null, 2));
71389
- }
71390
- process.exitCode = 1;
71391
- return;
71392
- }
71417
+ const jobId = await runFlowPreview({
71418
+ workspace: workspace.workspaceId,
71419
+ requestBody: {
71420
+ value: localFlow.value,
71421
+ path: flowPath.substring(0, flowPath.indexOf(".flow")).replaceAll(SEP19, "/"),
71422
+ args: input
71393
71423
  }
71394
- throw e;
71424
+ });
71425
+ const { result, success } = await pollForJobResult(workspace.workspaceId, jobId);
71426
+ if (!success) {
71427
+ if (opts.silent) {
71428
+ console.log(JSON.stringify(result));
71429
+ } else {
71430
+ info(colors.yellow.bold("Flow failed, error handler result:"));
71431
+ info(JSON.stringify(result, null, 2));
71432
+ }
71433
+ process.exitCode = 1;
71434
+ return;
71395
71435
  }
71396
71436
  if (opts.silent) {
71397
71437
  console.log(JSON.stringify(result));
@@ -82498,7 +82538,8 @@ async function generateMetadata2(opts, folder) {
82498
82538
  return;
82499
82539
  }
82500
82540
  info("");
82501
- if (!opts.yes && !await Confirm.prompt({
82541
+ const isInteractive = process.stdin.isTTY ?? false;
82542
+ if (!opts.yes && isInteractive && !await Confirm.prompt({
82502
82543
  message: "Update metadata?",
82503
82544
  default: true
82504
82545
  })) {
@@ -82657,7 +82698,7 @@ var config_default = command35;
82657
82698
 
82658
82699
  // src/main.ts
82659
82700
  await init_context();
82660
- var VERSION = "1.672.0";
82701
+ var VERSION = "1.673.0";
82661
82702
  var command36 = 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("job", job_default).command("group", group_default).command("audit", audit_default).command("token", token_default).command("generate-metadata", generate_metadata_default).command("docs", docs_default).command("config", config_default).command("version --version", "Show version information").action(async (opts) => {
82662
82703
  console.log("CLI version: " + VERSION);
82663
82704
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-cli",
3
- "version": "1.672.0",
3
+ "version": "1.673.0",
4
4
  "description": "CLI for Windmill",
5
5
  "license": "Apache 2.0",
6
6
  "type": "module",