@ctrl/shared-torrent 6.1.0 → 6.2.1

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/dist/index.d.ts +36 -11
  2. package/package.json +6 -6
package/dist/index.d.ts CHANGED
@@ -1,16 +1,37 @@
1
1
  export interface TorrentClient {
2
- config: TorrentSettings;
3
- getAllData: () => Promise<AllClientData>;
4
- getTorrent: (id: any) => Promise<NormalizedTorrent>;
5
- pauseTorrent: (id: any) => Promise<any>;
6
- resumeTorrent: (id: any) => Promise<any>;
7
- removeTorrent: (id: any, removeData?: boolean) => Promise<any>;
8
- queueUp: (id: any) => Promise<any>;
9
- queueDown: (id: any) => Promise<any>;
10
- addTorrent: (torrent: string | Uint8Array, options?: any) => Promise<any>;
11
- normalizedAddTorrent: (torrent: string | Uint8Array, options?: Partial<AddTorrentOptions>) => Promise<NormalizedTorrent>;
2
+ config: TorrentClientConfig;
3
+ state: TorrentClientState;
4
+ /**
5
+ * Export the current state of the client. Can be restored with `createFromState`.
6
+ */
7
+ exportState(): TorrentClientState;
8
+ /**
9
+ * Returns all torrent data. Data has been normalized
10
+ */
11
+ getAllData(): Promise<AllClientData>;
12
+ getTorrent(id: any): Promise<NormalizedTorrent>;
13
+ pauseTorrent(id: any): Promise<unknown>;
14
+ resumeTorrent(id: any): Promise<unknown>;
15
+ removeTorrent(id: any, removeData?: boolean): Promise<unknown>;
16
+ queueUp(id: any): Promise<unknown>;
17
+ queueDown(id: any): Promise<unknown>;
18
+ addTorrent(torrent: string | Uint8Array, options?: any): Promise<unknown>;
19
+ normalizedAddTorrent(torrent: string | Uint8Array, options?: Partial<AddTorrentOptions>): Promise<NormalizedTorrent>;
20
+ }
21
+ /**
22
+ * A JSON serializable object that stores the state of the client.
23
+ */
24
+ export interface TorrentClientState {
25
+ /**
26
+ * Authentication credentials
27
+ */
28
+ auth?: Record<string, unknown>;
29
+ /**
30
+ * Client version information
31
+ */
32
+ version?: Record<string, unknown>;
12
33
  }
13
- export interface TorrentSettings {
34
+ export interface TorrentClientConfig {
14
35
  /**
15
36
  * ex - `http://localhost:4444/
16
37
  */
@@ -35,6 +56,10 @@ export interface TorrentSettings {
35
56
  */
36
57
  timeout?: number;
37
58
  }
59
+ /**
60
+ * @deprecated Use `TorrentClientConfig` instead.
61
+ */
62
+ export type TorrentSettings = TorrentClientConfig;
38
63
  export declare enum TorrentState {
39
64
  downloading = "downloading",
40
65
  seeding = "seeding",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctrl/shared-torrent",
3
- "version": "6.1.0",
3
+ "version": "6.2.1",
4
4
  "description": "shared types and interfaces between torrent clients",
5
5
  "author": "Scott Cooper <scttcper@gmail.com>",
6
6
  "license": "MIT",
@@ -26,11 +26,11 @@
26
26
  "dependencies": {},
27
27
  "devDependencies": {
28
28
  "@biomejs/biome": "1.9.4",
29
- "@ctrl/eslint-config-biome": "4.2.11",
30
- "@sindresorhus/tsconfig": "6.0.0",
31
- "@types/node": "22.9.0",
32
- "typescript": "5.6.3",
33
- "undici": "^6.20.1"
29
+ "@ctrl/eslint-config-biome": "4.3.1",
30
+ "@sindresorhus/tsconfig": "7.0.0",
31
+ "@types/node": "22.10.2",
32
+ "typescript": "5.7.2",
33
+ "undici": "^7.2.0"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public",