tsarr 2.7.2 → 2.7.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"qbit.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/qbit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,eAAO,MAAM,SAAS,EAAE,WAAW,EAkFlC,CAAC;AAEF,eAAO,MAAM,IAAI,qDAKhB,CAAC"}
1
+ {"version":3,"file":"qbit.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/qbit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,eAAO,MAAM,SAAS,EAAE,WAAW,EAgGlC,CAAC;AAEF,eAAO,MAAM,IAAI,qDAKhB,CAAC"}
@@ -3,6 +3,7 @@ export interface ActionArg {
3
3
  description: string;
4
4
  required?: boolean;
5
5
  type?: 'string' | 'number' | 'boolean';
6
+ values?: string[];
6
7
  }
7
8
  export interface ActionDef {
8
9
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/service.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;CACxC;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB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AK,OAAO,CAAC,GAAG,CAAC,CAAC;CAC/D;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,SAAS,EAAE,CAAC;CACtB;AAED,eAAO,MAAM,sBAAsB,UAA0D,CAAC;AAE9F,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,CAAC,EAAE,CAM5E;AAED,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,EACnC,SAAS,EAAE,WAAW,EAAE,uDA+MzB"}
package/dist/cli/index.js CHANGED
@@ -5384,6 +5384,10 @@ function buildServiceCommand(serviceName, description, clientFactory, resources)
5384
5384
  } else if (argDef.type === "boolean" && resolvedArgs[argDef.name] != null) {
5385
5385
  resolvedArgs[argDef.name] = coerceBooleanArg(resolvedArgs[argDef.name]);
5386
5386
  }
5387
+ if (argDef.values && resolvedArgs[argDef.name] != null && !argDef.values.includes(resolvedArgs[argDef.name])) {
5388
+ consola.error(`Invalid ${argDef.name}: "${resolvedArgs[argDef.name]}". Must be one of: ${argDef.values.join(", ")}`);
5389
+ process.exit(1);
5390
+ }
5387
5391
  }
5388
5392
  const format = detectFormat(args);
5389
5393
  const noHeader = process.argv.includes("--no-header") || !!args.noHeader;
@@ -5412,6 +5416,18 @@ Run \`tsarr config init\` or set TSARR_${serviceName.toUpperCase()}_API_KEY`;
5412
5416
  consola.error(`Unauthorized. ${authHint}`);
5413
5417
  } else if (status === 404) {
5414
5418
  consola.error("Not found.");
5419
+ } else if (!status && err?.code) {
5420
+ const code = err.code;
5421
+ if (code === "ConnectionRefused" || code === "ECONNREFUSED") {
5422
+ consola.error(`Connection refused. Is ${serviceName} running?
5423
+ Run \`tsarr doctor\` to diagnose.`);
5424
+ } else if (code === "ConnectionReset" || code === "ECONNRESET") {
5425
+ consola.error(`Connection reset. ${serviceName} may have crashed.
5426
+ Run \`tsarr doctor\` to diagnose.`);
5427
+ } else {
5428
+ consola.error(`${err?.message ?? `Network error (${code})`}
5429
+ Run \`tsarr doctor\` to diagnose.`);
5430
+ }
5415
5431
  } else {
5416
5432
  consola.error(err?.title ?? err?.message ?? `API error (${status ?? "unknown"})`);
5417
5433
  }
@@ -5509,12 +5525,39 @@ Run \`tsarr doctor\` to diagnose.`);
5509
5525
  } else if (error instanceof TsarrError) {
5510
5526
  consola.error(`Error: ${error.message}`);
5511
5527
  } else if (error instanceof Error) {
5512
- consola.error(error.message);
5528
+ const networkMsg = classifyNetworkError(error, serviceName);
5529
+ if (networkMsg) {
5530
+ consola.error(`${networkMsg}
5531
+ Run \`tsarr doctor\` to diagnose.`);
5532
+ } else {
5533
+ consola.error(error.message);
5534
+ }
5513
5535
  } else {
5514
5536
  consola.error("An unexpected error occurred.");
5515
5537
  }
5516
5538
  process.exit(1);
5517
5539
  }
5540
+ function classifyNetworkError(error, serviceName) {
5541
+ const cause = error.cause;
5542
+ const code = cause?.code ?? error.code;
5543
+ const msg = error.message;
5544
+ if (code === "ECONNREFUSED" || code === "ConnectionRefused") {
5545
+ return `Connection refused. Is ${serviceName} running?`;
5546
+ }
5547
+ if (code === "ENOTFOUND") {
5548
+ return `Host not found for ${serviceName}. Check the URL.`;
5549
+ }
5550
+ if (code === "ECONNRESET" || code === "ConnectionReset") {
5551
+ return `Connection reset. ${serviceName} may have crashed.`;
5552
+ }
5553
+ if (code === "ETIMEDOUT") {
5554
+ return `Connection timed out for ${serviceName}.`;
5555
+ }
5556
+ if (msg === "fetch failed" || msg.includes("fetch failed")) {
5557
+ return `Unable to reach ${serviceName}${cause?.message ? `: ${cause.message}` : ""}`;
5558
+ }
5559
+ return null;
5560
+ }
5518
5561
  var COMMAND_OUTPUT_COLUMNS;
5519
5562
  var init_service = __esm(() => {
5520
5563
  init_dist();
@@ -19991,7 +20034,21 @@ var init_qbit = __esm(() => {
19991
20034
  args: [
19992
20035
  {
19993
20036
  name: "filter",
19994
- description: "Filter (all|downloading|seeding|completed|paused|active|inactive|stalled|errored)"
20037
+ description: "Filter (all|downloading|seeding|completed|paused|active|inactive|stalled|errored)",
20038
+ values: [
20039
+ "all",
20040
+ "downloading",
20041
+ "seeding",
20042
+ "completed",
20043
+ "paused",
20044
+ "active",
20045
+ "inactive",
20046
+ "resumed",
20047
+ "stalled",
20048
+ "stalled_uploading",
20049
+ "stalled_downloading",
20050
+ "errored"
20051
+ ]
19995
20052
  }
19996
20053
  ],
19997
20054
  columns: ["hash", "name", "state", "progress", "size", "dlspeed", "upspeed"],
@@ -21734,7 +21791,7 @@ init_dist();
21734
21791
  // package.json
21735
21792
  var package_default = {
21736
21793
  name: "tsarr",
21737
- version: "2.7.2",
21794
+ version: "2.7.4",
21738
21795
  author: "Robbe Verhelst",
21739
21796
  repository: {
21740
21797
  type: "git",
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsarr",
3
- "version": "2.7.2",
3
+ "version": "2.7.4",
4
4
  "author": "Robbe Verhelst",
5
5
  "repository": {
6
6
  "type": "git",
Binary file