windmill-cli 1.414.1 → 1.414.2

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.
@@ -32,7 +32,7 @@ export const OpenAPI = {
32
32
  PASSWORD: undefined,
33
33
  TOKEN: getEnv("WM_TOKEN"),
34
34
  USERNAME: undefined,
35
- VERSION: '1.414.1',
35
+ VERSION: '1.414.2',
36
36
  WITH_CREDENTIALS: true,
37
37
  interceptors: {
38
38
  request: new Interceptors(),
package/esm/instance.js CHANGED
@@ -202,7 +202,7 @@ async function instancePull(opts) {
202
202
  if (opts.includeWorkspaces) {
203
203
  log.info("\nPulling all workspaces");
204
204
  const rootDir = dntShim.Deno.cwd();
205
- const localWorkspaces = await getLocalWorkspaces(rootDir, instance.prefix);
205
+ const localWorkspaces = await getLocalWorkspaces(rootDir, instance.prefix, opts.folderPerInstance);
206
206
  const previousActiveWorkspace = await getActiveWorkspace(undefined);
207
207
  const remoteWorkspaces = await wmill.listWorkspacesAsSuperAdmin({
208
208
  page: 1,
@@ -210,7 +210,9 @@ async function instancePull(opts) {
210
210
  });
211
211
  for (const remoteWorkspace of remoteWorkspaces) {
212
212
  log.info("\nPulling workspace " + remoteWorkspace.id);
213
- const workspaceName = instance.prefix + "_" + remoteWorkspace.id;
213
+ const workspaceName = opts?.folderPerInstance
214
+ ? instance.prefix + "/" + remoteWorkspace.id
215
+ : instance.prefix + "_" + remoteWorkspace.id;
214
216
  await dntShim.Deno.mkdir(path.join(rootDir, workspaceName), {
215
217
  recursive: true,
216
218
  });
@@ -310,22 +312,28 @@ async function instancePush(opts) {
310
312
  if (opts.includeWorkspaces) {
311
313
  instances = await allInstances();
312
314
  const rootDir = dntShim.Deno.cwd();
313
- const localPrefix = (await Select.prompt({
314
- message: "What is the prefix of the local workspaces you want to sync?",
315
- options: [
316
- ...instances.map((i) => ({
317
- name: `${i.prefix} (${i.name} - ${i.remote})`,
318
- value: i.prefix,
319
- })),
320
- ],
321
- default: instance.prefix,
322
- }));
315
+ let localPrefix;
316
+ if (opts.baseUrl && opts.token) {
317
+ localPrefix = "custom";
318
+ }
319
+ else {
320
+ localPrefix = (await Select.prompt({
321
+ message: "What is the prefix of the local workspaces you want to sync?",
322
+ options: [
323
+ ...instances.map((i) => ({
324
+ name: `${i.prefix} (${i.name} - ${i.remote})`,
325
+ value: i.prefix,
326
+ })),
327
+ ],
328
+ default: instance.prefix,
329
+ }));
330
+ }
323
331
  const remoteWorkspaces = await wmill.listWorkspacesAsSuperAdmin({
324
332
  page: 1,
325
333
  perPage: 1000,
326
334
  });
327
335
  const previousActiveWorkspace = await getActiveWorkspace(undefined);
328
- const localWorkspaces = await getLocalWorkspaces(rootDir, localPrefix);
336
+ const localWorkspaces = await getLocalWorkspaces(rootDir, localPrefix, opts.folderPerInstance);
329
337
  log.info(`\nPushing all workspaces: ${localWorkspaces.map((x) => x.id).join(", ")}`);
330
338
  for (const localWorkspace of localWorkspaces) {
331
339
  log.info("\nPushing workspace " + localWorkspace.id);
@@ -383,16 +391,31 @@ async function instancePush(opts) {
383
391
  log.info(colors.green.underline.bold("All workspaces pushed"));
384
392
  }
385
393
  }
386
- async function getLocalWorkspaces(rootDir, localPrefix) {
394
+ async function getLocalWorkspaces(rootDir, localPrefix, folderPerInstance) {
387
395
  const localWorkspaces = [];
388
- for await (const dir of dntShim.Deno.readDir(rootDir)) {
389
- const dirName = dir.name;
390
- if (dirName.startsWith(localPrefix + "_")) {
396
+ if (!(await dntShim.Deno.stat(localPrefix).catch(() => null))) {
397
+ await dntShim.Deno.mkdir(localPrefix);
398
+ }
399
+ if (folderPerInstance) {
400
+ for await (const dir of dntShim.Deno.readDir(rootDir + "/" + localPrefix)) {
401
+ const dirName = dir.name;
391
402
  localWorkspaces.push({
392
- dir: dirName,
393
- id: dirName.substring(localPrefix.length + 1),
403
+ dir: localPrefix + "/" + dirName,
404
+ id: dirName,
394
405
  });
395
406
  }
407
+ log.info(localWorkspaces);
408
+ }
409
+ else {
410
+ for await (const dir of dntShim.Deno.readDir(rootDir)) {
411
+ const dirName = dir.name;
412
+ if (dirName.startsWith(localPrefix + "_")) {
413
+ localWorkspaces.push({
414
+ dir: dirName,
415
+ id: dirName.substring(localPrefix.length + 1),
416
+ });
417
+ }
418
+ }
396
419
  }
397
420
  return localWorkspaces;
398
421
  }
@@ -489,6 +512,7 @@ const command = new Command()
489
512
  .option("--skip-configs", "Skip pulling configs (worker groups and SMTP)")
490
513
  .option("--skip-groups", "Skip pulling instance groups")
491
514
  .option("--include-workspaces", "Also pull workspaces")
515
+ .option("--folder-per-instance", "Create a folder per instance")
492
516
  .option("--instance <instance:string>", "Name of the instance to push to, override the active instance")
493
517
  .action(instancePull)
494
518
  .command("push")
@@ -499,6 +523,7 @@ const command = new Command()
499
523
  .option("--skip-configs", "Skip pushing configs (worker groups and SMTP)")
500
524
  .option("--skip-groups", "Skip pushing instance groups")
501
525
  .option("--include-workspaces", "Also push workspaces")
526
+ .option("--folder-per-instance", "Create a folder per instance")
502
527
  .option("--instance <instance:string>", "Name of the instance to push to, override the active instance")
503
528
  .action(instancePush)
504
529
  .command("whoami")
package/esm/main.js CHANGED
@@ -33,7 +33,7 @@ export { flow, app, script, workspace, resource, user, variable, hub, folder, sc
33
33
  // console.error(JSON.stringify(event.error, null, 4));
34
34
  // }
35
35
  // });
36
- export const VERSION = "1.414.1";
36
+ export const VERSION = "1.414.2";
37
37
  const command = new Command()
38
38
  .name("wmill")
39
39
  .action(() => log.info(`Welcome to Windmill CLI ${VERSION}. Use -h for help.`))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-cli",
3
- "version": "1.414.1",
3
+ "version": "1.414.2",
4
4
  "description": "CLI for Windmill",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,6 +25,7 @@ export type InstanceSyncOptions = {
25
25
  instance?: string;
26
26
  baseUrl?: string;
27
27
  token?: string;
28
+ folderPerInstance?: boolean;
28
29
  yes?: boolean;
29
30
  };
30
31
  export declare function pickInstance(opts: InstanceSyncOptions, allowNew: boolean): Promise<Instance>;
@@ -1 +1 @@
1
- {"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../src/instance.ts"],"names":[],"mappings":"AACA,OAAO,EAML,OAAO,EAGR,MAAM,WAAW,CAAC;AAgCnB,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,YAAY,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,CAiBxD;AACD,wBAAsB,WAAW,CAC/B,IAAI,EAAE,EAAE,EACR,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,KAAK,EAAE,MAAM,GAAG,SAAS;;;;;GA2C1B;AA4BD,KAAK,aAAa,CAAC,CAAC,SAAS,MAAM,IAAI;KACpC,CAAC,IAAI,CAAC,GAAG,MAAM;CACjB,CAAC;AACF,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,EACrD,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,EAC/B,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,EAC7B,MAAM,EAAE,CAAC,EACT,UAAU,EAAE,MAAM,UAwBnB;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,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C,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,wBAAsB,YAAY,CAChC,IAAI,EAAE,mBAAmB,EACzB,QAAQ,EAAE,OAAO,qBAwDlB;AA4VD,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAS9B;AAgBD,QAAA,MAAM,OAAO;;;;;;oBA0FW,CAAC;AAEzB,eAAe,OAAO,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"local_encryption.d.ts","sourceRoot":"","sources":["../src/local_encryption.ts"],"names":[],"mappings":"AAoCA,wBAAsB,OAAO,CAC3B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CAoBjB;AAGD,wBAAsB,OAAO,CAC3B,kBAAkB,EAAE,MAAM,EAC1B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CAuBjB"}
1
+ {"version":3,"file":"local_encryption.d.ts","sourceRoot":"","sources":["../src/local_encryption.ts"],"names":[],"mappings":"AAmCA,wBAAsB,OAAO,CAC3B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CAoBjB;AAGD,wBAAsB,OAAO,CAC3B,kBAAkB,EAAE,MAAM,EAC1B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CAuBjB"}
package/types/main.d.ts CHANGED
@@ -19,7 +19,7 @@ import { pull as hubPull } from "./hub.js";
19
19
  import { pull, push } from "./sync.js";
20
20
  import { add as workspaceAdd } from "./workspace.js";
21
21
  export { flow, app, script, workspace, resource, user, variable, hub, folder, schedule, sync, instance, dev, hubPull, pull, push, workspaceAdd, };
22
- export declare const VERSION = "1.414.1";
22
+ export declare const VERSION = "1.414.2";
23
23
  declare const command: Command<{
24
24
  workspace?: (import("./deps/jsr.io/@windmill-labs/cliffy-command/1.0.0-rc.5/mod.js").StringType & string) | undefined;
25
25
  } & {