@ctrl/shared-torrent 6.1.0 → 6.2.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.
Files changed (2) hide show
  1. package/dist/index.d.ts +40 -11
  2. package/package.json +6 -6
package/dist/index.d.ts CHANGED
@@ -1,16 +1,41 @@
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
+ * Create a new client instance from an existing state.
6
+ */
7
+ createFromState(config: TorrentClientConfig, state: TorrentClientState): TorrentClient;
8
+ /**
9
+ * Export the current state of the client. Can be restored with `createFromState`.
10
+ */
11
+ exportState(): TorrentClientState;
12
+ /**
13
+ * Returns all torrent data. Data has been normalized
14
+ */
15
+ getAllData(): Promise<AllClientData>;
16
+ getTorrent(id: any): Promise<NormalizedTorrent>;
17
+ pauseTorrent(id: any): Promise<unknown>;
18
+ resumeTorrent(id: any): Promise<unknown>;
19
+ removeTorrent(id: any, removeData?: boolean): Promise<unknown>;
20
+ queueUp(id: any): Promise<unknown>;
21
+ queueDown(id: any): Promise<unknown>;
22
+ addTorrent(torrent: string | Uint8Array, options?: any): Promise<unknown>;
23
+ normalizedAddTorrent(torrent: string | Uint8Array, options?: Partial<AddTorrentOptions>): Promise<NormalizedTorrent>;
24
+ }
25
+ /**
26
+ * A JSON serializable object that stores the state of the client.
27
+ */
28
+ export interface TorrentClientState {
29
+ /**
30
+ * Authentication credentials
31
+ */
32
+ auth?: Record<string, unknown>;
33
+ /**
34
+ * Client version information
35
+ */
36
+ version?: Record<string, unknown>;
12
37
  }
13
- export interface TorrentSettings {
38
+ export interface TorrentClientConfig {
14
39
  /**
15
40
  * ex - `http://localhost:4444/
16
41
  */
@@ -35,6 +60,10 @@ export interface TorrentSettings {
35
60
  */
36
61
  timeout?: number;
37
62
  }
63
+ /**
64
+ * @deprecated Use `TorrentClientConfig` instead.
65
+ */
66
+ export type TorrentSettings = TorrentClientConfig;
38
67
  export declare enum TorrentState {
39
68
  downloading = "downloading",
40
69
  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.0",
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",