tsarr 2.7.1 → 2.7.3

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":"doctor.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/doctor.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;EAsFjB,CAAC"}
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/doctor.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;EA8FjB,CAAC"}
@@ -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"}
@@ -1 +1 @@
1
- {"version":3,"file":"seerr.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/seerr.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,eAAO,MAAM,SAAS,EAAE,WAAW,EAgGlC,CAAC;AAEF,eAAO,MAAM,KAAK,qDAKjB,CAAC"}
1
+ {"version":3,"file":"seerr.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/seerr.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,eAAO,MAAM,SAAS,EAAE,WAAW,EA4GlC,CAAC;AAEF,eAAO,MAAM,KAAK,qDAKjB,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,GAAG,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,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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AS,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
  }
@@ -5439,14 +5455,21 @@ Run \`tsarr config init\` or set TSARR_${serviceName.toUpperCase()}_API_KEY`;
5439
5455
  }
5440
5456
  });
5441
5457
  }
5442
- const singleAction = resource.actions.length === 1 ? actionCommands[resource.actions[0].name] : undefined;
5458
+ const singleAction = resource.actions.length === 1 ? resource.actions[0] : undefined;
5459
+ const singleActionCommand = singleAction ? actionCommands[singleAction.name] : undefined;
5443
5460
  subCommands[resource.name] = defineCommand({
5444
5461
  meta: {
5445
5462
  name: resource.name,
5446
5463
  description: resource.description
5447
5464
  },
5448
5465
  subCommands: actionCommands,
5449
- ...singleAction ? { run: singleAction.run } : {}
5466
+ ...singleActionCommand ? {
5467
+ run: (ctx) => {
5468
+ if (process.argv.includes(singleAction.name))
5469
+ return;
5470
+ return singleActionCommand.run(ctx);
5471
+ }
5472
+ } : {}
5450
5473
  });
5451
5474
  }
5452
5475
  return defineCommand({
@@ -19984,7 +20007,21 @@ var init_qbit = __esm(() => {
19984
20007
  args: [
19985
20008
  {
19986
20009
  name: "filter",
19987
- description: "Filter (all|downloading|seeding|completed|paused|active|inactive|stalled|errored)"
20010
+ description: "Filter (all|downloading|seeding|completed|paused|active|inactive|stalled|errored)",
20011
+ values: [
20012
+ "all",
20013
+ "downloading",
20014
+ "seeding",
20015
+ "completed",
20016
+ "paused",
20017
+ "active",
20018
+ "inactive",
20019
+ "resumed",
20020
+ "stalled",
20021
+ "stalled_uploading",
20022
+ "stalled_downloading",
20023
+ "errored"
20024
+ ]
19988
20025
  }
19989
20026
  ],
19990
20027
  columns: ["hash", "name", "state", "progress", "size", "dlspeed", "upspeed"],
@@ -21060,7 +21097,20 @@ var init_seerr3 = __esm(() => {
21060
21097
  ],
21061
21098
  columns: ["id", "status", "requestedBy", "createdAt", "updatedAt"],
21062
21099
  idField: "id",
21063
- run: (c3, a2) => c3.getRequests(a2.filter ? { filter: a2.filter } : undefined)
21100
+ run: async (c3, a2) => {
21101
+ const result = await c3.getRequests(a2.filter ? { filter: a2.filter } : undefined);
21102
+ const data = result?.data ?? result;
21103
+ const items = data?.results ?? data;
21104
+ if (!Array.isArray(items))
21105
+ return result;
21106
+ return {
21107
+ ...data,
21108
+ results: items.map((r3) => ({
21109
+ ...r3,
21110
+ requestedBy: r3.requestedBy?.displayName ?? r3.requestedBy?.email ?? r3.requestedBy
21111
+ }))
21112
+ };
21113
+ }
21064
21114
  },
21065
21115
  {
21066
21116
  name: "count",
@@ -21153,13 +21203,13 @@ function classifyError(error) {
21153
21203
  return "Unknown error";
21154
21204
  const msg = error.message;
21155
21205
  const cause = error.cause;
21156
- if (cause?.code === "ECONNREFUSED" || msg.includes("ECONNREFUSED")) {
21206
+ if (cause?.code === "ECONNREFUSED" || cause?.code === "ConnectionRefused" || msg.includes("ECONNREFUSED")) {
21157
21207
  return "Connection refused - is the service running?";
21158
21208
  }
21159
21209
  if (cause?.code === "ENOTFOUND" || msg.includes("ENOTFOUND")) {
21160
21210
  return "Host not found - check the URL";
21161
21211
  }
21162
- if (cause?.code === "ECONNRESET" || msg.includes("ECONNRESET")) {
21212
+ if (cause?.code === "ECONNRESET" || cause?.code === "ConnectionReset" || msg.includes("ECONNRESET")) {
21163
21213
  return "Connection reset - service may have crashed";
21164
21214
  }
21165
21215
  if (cause?.code === "ETIMEDOUT" || msg.includes("ETIMEDOUT") || msg.includes("timed out")) {
@@ -21267,6 +21317,11 @@ var init_doctor = __esm(() => {
21267
21317
  }
21268
21318
  const client9 = factory(svcConfig);
21269
21319
  const status = await client9.getSystemStatus();
21320
+ if (status?.error !== undefined) {
21321
+ const err = status.error;
21322
+ const cause = err?.code ? { code: err.code } : undefined;
21323
+ throw Object.assign(new Error(err?.message ?? err?.code ?? "Unknown API error"), cause ? { cause } : {});
21324
+ }
21270
21325
  const version = extractVersion(service, status) ?? "?";
21271
21326
  if (version === "?") {
21272
21327
  throw new Error("Unexpected response payload");
@@ -21709,7 +21764,7 @@ init_dist();
21709
21764
  // package.json
21710
21765
  var package_default = {
21711
21766
  name: "tsarr",
21712
- version: "2.7.1",
21767
+ version: "2.7.3",
21713
21768
  author: "Robbe Verhelst",
21714
21769
  repository: {
21715
21770
  type: "git",
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsarr",
3
- "version": "2.7.1",
3
+ "version": "2.7.3",
4
4
  "author": "Robbe Verhelst",
5
5
  "repository": {
6
6
  "type": "git",
Binary file