@ctrl/transmission 6.0.0 → 7.0.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.
@@ -1,4 +1,4 @@
1
- import { FetchResponse } from 'ofetch';
1
+ import { ofetch } from 'ofetch';
2
2
  import type { AddTorrentOptions as NormalizedAddTorrentOptions, AllClientData, NormalizedTorrent, TorrentClient, TorrentSettings } from '@ctrl/shared-torrent';
3
3
  import type { AddTorrentOptions, AddTorrentResponse, DefaultResponse, FreeSpaceResponse, GetTorrentRepsonse, NormalizedTorrentIds, RenamePathOptions, SessionArguments, SessionResponse, SetTorrentOptions } from './types.js';
4
4
  export declare class Transmission implements TorrentClient {
@@ -30,6 +30,7 @@ export declare class Transmission implements TorrentClient {
30
30
  renamePath(id: NormalizedTorrentIds, options?: Partial<RenamePathOptions>): Promise<DefaultResponse>;
31
31
  /**
32
32
  * Removing a Torrent
33
+ * @param removeData (default: false) If true, remove the downloaded data.
33
34
  */
34
35
  removeTorrent(id: NormalizedTorrentIds, removeData?: boolean): Promise<AddTorrentResponse>;
35
36
  /**
@@ -52,6 +53,6 @@ export declare class Transmission implements TorrentClient {
52
53
  getTorrent(id: NormalizedTorrentIds): Promise<NormalizedTorrent>;
53
54
  getAllData(): Promise<AllClientData>;
54
55
  listTorrents(id?: NormalizedTorrentIds, additionalFields?: string[]): Promise<GetTorrentRepsonse>;
55
- request<T>(method: string, args?: any): Promise<FetchResponse<T>>;
56
+ request<T>(method: string, args?: any): Promise<ReturnType<typeof ofetch.raw<T>>>;
56
57
  private _handleNormalizedIds;
57
58
  }
@@ -100,8 +100,9 @@ export class Transmission {
100
100
  }
101
101
  /**
102
102
  * Removing a Torrent
103
+ * @param removeData (default: false) If true, remove the downloaded data.
103
104
  */
104
- async removeTorrent(id, removeData = true) {
105
+ async removeTorrent(id, removeData = false) {
105
106
  const ids = this._handleNormalizedIds(id);
106
107
  const res = await this.request('torrent-remove', {
107
108
  ids,
@@ -315,10 +316,9 @@ export class Transmission {
315
316
  catch (error) {
316
317
  if (error instanceof FetchError && error.response.status === 409) {
317
318
  this.sessionId = error.response.headers.get('x-transmission-session-id');
318
- // eslint-disable-next-line no-return-await
319
+ // eslint-disable-next-line no-return-await, @typescript-eslint/return-await
319
320
  return await this.request(method, args);
320
321
  }
321
- // eslint-disable-next-line @typescript-eslint/no-throw-literal
322
322
  throw error;
323
323
  }
324
324
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctrl/transmission",
3
- "version": "6.0.0",
3
+ "version": "7.0.0",
4
4
  "description": "TypeScript api wrapper for transmission using got",
5
5
  "author": "Scott Cooper <scttcper@gmail.com>",
6
6
  "license": "MIT",
@@ -19,9 +19,9 @@
19
19
  "scripts": {
20
20
  "lint": "pnpm run '/^(lint:biome|lint:eslint)$/'",
21
21
  "lint:biome": "biome check .",
22
- "lint:eslint": "eslint --ext .ts,.tsx .",
22
+ "lint:eslint": "eslint .",
23
23
  "lint:fix": "pnpm run '/^(lint:biome|lint:eslint):fix$/'",
24
- "lint:eslint:fix": "eslint --ext .ts,.tsx . --fix",
24
+ "lint:eslint:fix": "eslint . --fix",
25
25
  "lint:biome:fix": "biome check . --apply",
26
26
  "prepare": "npm run build",
27
27
  "build": "tsc",
@@ -33,22 +33,22 @@
33
33
  "dependencies": {
34
34
  "@ctrl/magnet-link": "^4.0.2",
35
35
  "@ctrl/shared-torrent": "^6.0.0",
36
- "ofetch": "^1.3.3",
37
- "ufo": "^1.4.0",
38
- "uint8array-extras": "^1.1.0"
36
+ "ofetch": "^1.3.4",
37
+ "ufo": "^1.5.4",
38
+ "uint8array-extras": "^1.4.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@biomejs/biome": "1.6.0",
42
- "@ctrl/eslint-config-biome": "2.1.1",
41
+ "@biomejs/biome": "1.8.3",
42
+ "@ctrl/eslint-config-biome": "4.1.5",
43
43
  "@ctrl/magnet-link": "^4.0.2",
44
44
  "@ctrl/shared-torrent": "^6.0.0",
45
- "@sindresorhus/tsconfig": "5.0.0",
46
- "@types/node": "20.11.25",
47
- "@vitest/coverage-v8": "1.3.1",
45
+ "@sindresorhus/tsconfig": "6.0.0",
46
+ "@types/node": "22.5.1",
47
+ "@vitest/coverage-v8": "2.0.5",
48
48
  "p-wait-for": "5.0.2",
49
- "typedoc": "0.25.12",
50
- "typescript": "5.4.2",
51
- "vitest": "1.3.1"
49
+ "typedoc": "0.26.6",
50
+ "typescript": "5.5.4",
51
+ "vitest": "2.0.5"
52
52
  },
53
53
  "publishConfig": {
54
54
  "access": "public",