tsarr 2.8.0 → 2.9.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 (43) hide show
  1. package/README.md +7 -5
  2. package/dist/cli/commands/bazarr.d.ts +2 -0
  3. package/dist/cli/commands/bazarr.d.ts.map +1 -1
  4. package/dist/cli/commands/config.d.ts.map +1 -1
  5. package/dist/cli/commands/lidarr.d.ts +2 -0
  6. package/dist/cli/commands/lidarr.d.ts.map +1 -1
  7. package/dist/cli/commands/radarr.d.ts.map +1 -1
  8. package/dist/cli/commands/readarr.d.ts +2 -0
  9. package/dist/cli/commands/readarr.d.ts.map +1 -1
  10. package/dist/cli/commands/sonarr.d.ts.map +1 -1
  11. package/dist/cli/index.js +2722 -3054
  12. package/dist/clients/base.d.ts +131 -0
  13. package/dist/clients/base.d.ts.map +1 -0
  14. package/dist/clients/bazarr.d.ts +0 -1
  15. package/dist/clients/bazarr.d.ts.map +1 -1
  16. package/dist/clients/bazarr.js +8 -3
  17. package/dist/clients/lidarr.d.ts +25 -683
  18. package/dist/clients/lidarr.d.ts.map +1 -1
  19. package/dist/clients/lidarr.js +227 -197
  20. package/dist/clients/prowlarr.d.ts +26 -640
  21. package/dist/clients/prowlarr.d.ts.map +1 -1
  22. package/dist/clients/prowlarr.js +235 -176
  23. package/dist/clients/qbittorrent.d.ts +1 -17
  24. package/dist/clients/qbittorrent.d.ts.map +1 -1
  25. package/dist/clients/qbittorrent.js +8 -2
  26. package/dist/clients/radarr.d.ts +5 -659
  27. package/dist/clients/radarr.d.ts.map +1 -1
  28. package/dist/clients/radarr.js +227 -165
  29. package/dist/clients/readarr.d.ts +5 -637
  30. package/dist/clients/readarr.d.ts.map +1 -1
  31. package/dist/clients/readarr.js +227 -165
  32. package/dist/clients/seerr.d.ts +0 -1
  33. package/dist/clients/seerr.d.ts.map +1 -1
  34. package/dist/clients/seerr.js +8 -3
  35. package/dist/clients/sonarr.d.ts +182 -774
  36. package/dist/clients/sonarr.d.ts.map +1 -1
  37. package/dist/clients/sonarr.js +250 -158
  38. package/dist/core/client.d.ts +1 -0
  39. package/dist/core/client.d.ts.map +1 -1
  40. package/dist/index.js +1 -1
  41. package/dist/tsarr-2.9.1.tgz +0 -0
  42. package/package.json +2 -4
  43. package/dist/tsarr-2.8.0.tgz +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"prowlarr.d.ts","sourceRoot":"","sources":["../../src/clients/prowlarr.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,KAAK,WAAW,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EACzB,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,WAAW,EACX,gBAAgB,EACjB,MAAM,iCAAiC,CAAC;AAEzC;;;;;;;;;;;;GAYG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,YAAY,CAAyC;gBAEjD,MAAM,EAAE,mBAAmB;IAWjC,eAAe;;;;;;;;;;IAIf,SAAS;;;;;;;;;;IAMf;;OAEG;IACG,WAAW;;;;;;;;;;IAIX,UAAU,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;IAIrB,UAAU,CAAC,OAAO,EAAE,eAAe;;;;;;;;;;IAInC,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe;;;;;;;;;;IAIlD,aAAa,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;IAMxB,eAAe;;;;;;;;;;IAMrB;;OAEG;IACG,kBAAkB;;;;;;;;;;IAIxB;;OAEG;IACG,iBAAiB,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;IAIlC;;OAEG;IACG,iBAAiB,CAAC,cAAc,EAAE,sBAAsB;;;;;;;;;;IAI9D;;OAEG;IACG,oBAAoB,CAAC,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,sBA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;;;;;;;IAIpE;;OAEG;IACG,iBAAiB,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;IAIlC;;OAEG;IACG,eAAe,CAAC,WAAW,EAAE,mBAAmB;;;;;;;;;;IAItD;;OAEG;IACG,mBAAmB;;;;;;;;;;IAIzB;;OAEG;IACG,oBAAoB;;;;;;;;;;IAM1B;;OAEG;IACG,oBAAoB;;;;;;;;;;IAI1B;;OAEG;IACG,wBAAwB,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;IAIzC;;OAEG;IACG,uBAAuB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,yBAAyB;;;;;;;;;;IAM3E;;OAEG;IACG,aAAa;;;;;;;;;;CAGpB;AAGD,cAAc,qBAAqB,CAAC"}
@@ -27,6 +27,7 @@ class ConnectionError extends TsarrError {
27
27
  }
28
28
 
29
29
  // src/core/client.ts
30
+ var DEFAULT_TIMEOUT_MS = 30000;
30
31
  function createServarrClient(config) {
31
32
  if (!config.apiKey) {
32
33
  throw new ApiKeyError;
@@ -38,6 +39,7 @@ function createServarrClient(config) {
38
39
  ...config,
39
40
  baseUrl: config.baseUrl.replace(/\/$/, "")
40
41
  };
42
+ const timeoutMs = validatedConfig.timeout ?? DEFAULT_TIMEOUT_MS;
41
43
  return {
42
44
  config: validatedConfig,
43
45
  getHeaders: () => ({
@@ -45,10 +47,180 @@ function createServarrClient(config) {
45
47
  "Content-Type": "application/json",
46
48
  ...validatedConfig.headers
47
49
  }),
48
- getBaseUrl: () => validatedConfig.baseUrl
50
+ getBaseUrl: () => validatedConfig.baseUrl,
51
+ getTimeout: () => timeoutMs
49
52
  };
50
53
  }
51
54
 
55
+ // src/clients/base.ts
56
+ class ServarrBaseClient {
57
+ clientConfig;
58
+ constructor(config) {
59
+ this.clientConfig = createServarrClient(config);
60
+ this.configureRawClient();
61
+ }
62
+ getClientConfig() {
63
+ return {
64
+ baseUrl: this.clientConfig.getBaseUrl(),
65
+ headers: this.clientConfig.getHeaders(),
66
+ signal: AbortSignal.timeout(this.clientConfig.getTimeout())
67
+ };
68
+ }
69
+ async getSystemStatus() {
70
+ return this.ops.getSystemStatus();
71
+ }
72
+ async getHealth() {
73
+ return this.ops.getHealth();
74
+ }
75
+ async getTags() {
76
+ return this.ops.getTags();
77
+ }
78
+ async addTag(tag) {
79
+ return this.ops.createTag({ body: tag });
80
+ }
81
+ async getTag(id) {
82
+ return this.ops.getTagById({ path: { id } });
83
+ }
84
+ async updateTag(id, tag) {
85
+ return this.ops.updateTagById({ path: { id: String(id) }, body: tag });
86
+ }
87
+ async deleteTag(id) {
88
+ return this.ops.deleteTagById({ path: { id } });
89
+ }
90
+ async getTagDetails() {
91
+ return this.ops.getTagDetails();
92
+ }
93
+ async getTagDetailById(id) {
94
+ return this.ops.getTagDetailById({ path: { id } });
95
+ }
96
+ async getNotifications() {
97
+ return this.ops.getNotifications();
98
+ }
99
+ async getNotification(id) {
100
+ return this.ops.getNotificationById({ path: { id } });
101
+ }
102
+ async addNotification(notification) {
103
+ return this.ops.createNotification({ body: notification });
104
+ }
105
+ async updateNotification(id, notification) {
106
+ return this.ops.updateNotificationById({ path: { id: String(id) }, body: notification });
107
+ }
108
+ async deleteNotification(id) {
109
+ return this.ops.deleteNotificationById({ path: { id } });
110
+ }
111
+ async getNotificationSchema() {
112
+ return this.ops.getNotificationSchema();
113
+ }
114
+ async testNotification(notification) {
115
+ return this.ops.testNotification({ body: notification });
116
+ }
117
+ async testAllNotifications() {
118
+ return this.ops.testAllNotifications();
119
+ }
120
+ async getDownloadClients() {
121
+ return this.ops.getDownloadClients();
122
+ }
123
+ async getDownloadClient(id) {
124
+ return this.ops.getDownloadClientById({ path: { id } });
125
+ }
126
+ async addDownloadClient(client) {
127
+ return this.ops.createDownloadClient({ body: client });
128
+ }
129
+ async updateDownloadClient(id, client) {
130
+ return this.ops.updateDownloadClientById({ path: { id: String(id) }, body: client });
131
+ }
132
+ async deleteDownloadClient(id) {
133
+ return this.ops.deleteDownloadClientById({ path: { id } });
134
+ }
135
+ async getDownloadClientSchema() {
136
+ return this.ops.getDownloadClientSchema();
137
+ }
138
+ async testDownloadClient(client) {
139
+ return this.ops.testDownloadClient({ body: client });
140
+ }
141
+ async testAllDownloadClients() {
142
+ return this.ops.testAllDownloadClients();
143
+ }
144
+ async getIndexers() {
145
+ return this.ops.getIndexers();
146
+ }
147
+ async getIndexer(id) {
148
+ return this.ops.getIndexerById({ path: { id } });
149
+ }
150
+ async addIndexer(indexer) {
151
+ return this.ops.createIndexer({ body: indexer });
152
+ }
153
+ async updateIndexer(id, indexer) {
154
+ return this.ops.updateIndexerById({ path: { id: String(id) }, body: indexer });
155
+ }
156
+ async deleteIndexer(id) {
157
+ return this.ops.deleteIndexerById({ path: { id } });
158
+ }
159
+ async getIndexerSchema() {
160
+ return this.ops.getIndexerSchema();
161
+ }
162
+ async testIndexer(indexer) {
163
+ return this.ops.testIndexer({ body: indexer });
164
+ }
165
+ async testAllIndexers() {
166
+ return this.ops.testAllIndexers();
167
+ }
168
+ async restartSystem() {
169
+ return this.ops.restartSystem();
170
+ }
171
+ async shutdownSystem() {
172
+ return this.ops.shutdownSystem();
173
+ }
174
+ async getSystemBackups() {
175
+ return this.ops.getBackups();
176
+ }
177
+ async deleteSystemBackup(id) {
178
+ return this.ops.deleteBackup({ path: { id } });
179
+ }
180
+ async restoreSystemBackup(id) {
181
+ return this.ops.restoreBackup({ path: { id } });
182
+ }
183
+ async uploadSystemBackup() {
184
+ return this.ops.uploadBackup();
185
+ }
186
+ async getLogFiles() {
187
+ return this.ops.getLogFiles();
188
+ }
189
+ async getLogFileByName(filename) {
190
+ return this.ops.getLogFileByName({ path: { filename } });
191
+ }
192
+ async runCommand(command) {
193
+ return this.ops.runCommand({ body: command });
194
+ }
195
+ async getCommands() {
196
+ return this.ops.getCommands();
197
+ }
198
+ async getHostConfig() {
199
+ return this.ops.getHostConfig();
200
+ }
201
+ async getHostConfigById(id) {
202
+ return this.ops.getHostConfigById({ path: { id } });
203
+ }
204
+ async updateHostConfig(id, config) {
205
+ return this.ops.updateHostConfig({ path: { id: String(id) }, body: config });
206
+ }
207
+ async getUiConfig() {
208
+ return this.ops.getUiConfig();
209
+ }
210
+ async getUiConfigById(id) {
211
+ return this.ops.getUiConfigById({ path: { id } });
212
+ }
213
+ async updateUiConfig(id, config) {
214
+ return this.ops.updateUiConfig({ path: { id: String(id) }, body: config });
215
+ }
216
+ updateConfig(newConfig) {
217
+ const updatedConfig = { ...this.clientConfig.config, ...newConfig };
218
+ this.clientConfig = createServarrClient(updatedConfig);
219
+ this.configureRawClient();
220
+ return this.clientConfig.config;
221
+ }
222
+ }
223
+
52
224
  // src/generated/prowlarr/core/bodySerializer.gen.ts
53
225
  var jsonBodySerializer = {
54
226
  bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
@@ -1481,66 +1653,64 @@ var getApiV1ConfigUi = (options) => (options?.client ?? client).get({
1481
1653
  ...options
1482
1654
  });
1483
1655
  // src/clients/prowlarr.ts
1484
- class ProwlarrClient {
1485
- clientConfig;
1486
- constructor(config) {
1487
- this.clientConfig = createServarrClient(config);
1488
- client.setConfig({
1489
- baseUrl: this.clientConfig.getBaseUrl(),
1490
- headers: this.clientConfig.getHeaders()
1491
- });
1492
- }
1493
- async getSystemStatus() {
1494
- return getApiV1SystemStatus();
1495
- }
1496
- async getHealth() {
1497
- return getApiV1Health();
1498
- }
1499
- async getIndexers() {
1500
- return getApiV1Indexer();
1501
- }
1502
- async getIndexer(id) {
1503
- return getApiV1IndexerById({ path: { id } });
1504
- }
1505
- async addIndexer(indexer) {
1506
- return postApiV1Indexer({ body: indexer });
1507
- }
1508
- async updateIndexer(id, indexer) {
1509
- return putApiV1IndexerById({ path: { id: String(id) }, body: indexer });
1510
- }
1511
- async deleteIndexer(id) {
1512
- return deleteApiV1IndexerById({ path: { id } });
1656
+ class ProwlarrClient extends ServarrBaseClient {
1657
+ ops = {
1658
+ getSystemStatus: getApiV1SystemStatus,
1659
+ getHealth: getApiV1Health,
1660
+ getTags: getApiV1Tag,
1661
+ createTag: postApiV1Tag,
1662
+ getTagById: getApiV1TagById,
1663
+ updateTagById: putApiV1TagById,
1664
+ deleteTagById: deleteApiV1TagById,
1665
+ getTagDetails: getApiV1TagDetail,
1666
+ getTagDetailById: getApiV1TagDetailById,
1667
+ getNotifications: getApiV1Notification,
1668
+ createNotification: postApiV1Notification,
1669
+ getNotificationById: getApiV1NotificationById,
1670
+ updateNotificationById: putApiV1NotificationById,
1671
+ deleteNotificationById: deleteApiV1NotificationById,
1672
+ getNotificationSchema: getApiV1NotificationSchema,
1673
+ testNotification: postApiV1NotificationTest,
1674
+ testAllNotifications: postApiV1NotificationTestall,
1675
+ getDownloadClients: getApiV1Downloadclient,
1676
+ createDownloadClient: postApiV1Downloadclient,
1677
+ getDownloadClientById: getApiV1DownloadclientById,
1678
+ updateDownloadClientById: putApiV1DownloadclientById,
1679
+ deleteDownloadClientById: deleteApiV1DownloadclientById,
1680
+ getDownloadClientSchema: getApiV1DownloadclientSchema,
1681
+ testDownloadClient: postApiV1DownloadclientTest,
1682
+ testAllDownloadClients: postApiV1DownloadclientTestall,
1683
+ getIndexers: getApiV1Indexer,
1684
+ createIndexer: postApiV1Indexer,
1685
+ getIndexerById: getApiV1IndexerById,
1686
+ updateIndexerById: putApiV1IndexerById,
1687
+ deleteIndexerById: deleteApiV1IndexerById,
1688
+ getIndexerSchema: getApiV1IndexerSchema,
1689
+ testIndexer: postApiV1IndexerTest,
1690
+ testAllIndexers: postApiV1IndexerTestall,
1691
+ restartSystem: postApiV1SystemRestart,
1692
+ shutdownSystem: postApiV1SystemShutdown,
1693
+ getBackups: getApiV1SystemBackup,
1694
+ deleteBackup: deleteApiV1SystemBackupById,
1695
+ restoreBackup: postApiV1SystemBackupRestoreById,
1696
+ uploadBackup: postApiV1SystemBackupRestoreUpload,
1697
+ getLogFiles: getApiV1LogFile,
1698
+ getLogFileByName: getApiV1LogFileByFilename,
1699
+ runCommand: postApiV1Command,
1700
+ getCommands: getApiV1Command,
1701
+ getHostConfig: getApiV1ConfigHost,
1702
+ getHostConfigById: getApiV1ConfigHostById,
1703
+ updateHostConfig: putApiV1ConfigHostById,
1704
+ getUiConfig: getApiV1ConfigUi,
1705
+ getUiConfigById: getApiV1ConfigUiById,
1706
+ updateUiConfig: putApiV1ConfigUiById
1707
+ };
1708
+ configureRawClient() {
1709
+ client.setConfig(this.getClientConfig());
1513
1710
  }
1514
1711
  async getIndexerStats() {
1515
1712
  return getApiV1Indexerstats();
1516
1713
  }
1517
- async getDownloadClients() {
1518
- return getApiV1Downloadclient();
1519
- }
1520
- async getDownloadClient(id) {
1521
- return getApiV1DownloadclientById({ path: { id } });
1522
- }
1523
- async addDownloadClient(downloadClient) {
1524
- return postApiV1Downloadclient({ body: downloadClient });
1525
- }
1526
- async updateDownloadClient(id, downloadClient) {
1527
- return putApiV1DownloadclientById({
1528
- path: { id: String(id) },
1529
- body: downloadClient
1530
- });
1531
- }
1532
- async deleteDownloadClient(id) {
1533
- return deleteApiV1DownloadclientById({ path: { id } });
1534
- }
1535
- async testDownloadClient(downloadClient) {
1536
- return postApiV1DownloadclientTest({ body: downloadClient });
1537
- }
1538
- async testAllDownloadClients() {
1539
- return postApiV1DownloadclientTestall();
1540
- }
1541
- async getDownloadClientSchema() {
1542
- return getApiV1DownloadclientSchema();
1543
- }
1544
1714
  async search(query, indexerIds) {
1545
1715
  return getApiV1Search({
1546
1716
  query: {
@@ -1552,87 +1722,6 @@ class ProwlarrClient {
1552
1722
  async getApplications() {
1553
1723
  return getApiV1Applications();
1554
1724
  }
1555
- async runCommand(command) {
1556
- return postApiV1Command({ body: command });
1557
- }
1558
- async getCommands() {
1559
- return getApiV1Command();
1560
- }
1561
- async getHostConfig() {
1562
- return getApiV1ConfigHost();
1563
- }
1564
- async getHostConfigById(id) {
1565
- return getApiV1ConfigHostById({ path: { id } });
1566
- }
1567
- async updateHostConfig(id, config) {
1568
- return putApiV1ConfigHostById({ path: { id: String(id) }, body: config });
1569
- }
1570
- async getUiConfig() {
1571
- return getApiV1ConfigUi();
1572
- }
1573
- async getUiConfigById(id) {
1574
- return getApiV1ConfigUiById({ path: { id } });
1575
- }
1576
- async updateUiConfig(id, config) {
1577
- return putApiV1ConfigUiById({ path: { id: String(id) }, body: config });
1578
- }
1579
- async getDevelopmentConfig() {
1580
- return getApiV1ConfigDevelopment();
1581
- }
1582
- async getDevelopmentConfigById(id) {
1583
- return getApiV1ConfigDevelopmentById({ path: { id } });
1584
- }
1585
- async updateDevelopmentConfig(id, config) {
1586
- return putApiV1ConfigDevelopmentById({ path: { id: String(id) }, body: config });
1587
- }
1588
- async restartSystem() {
1589
- return postApiV1SystemRestart();
1590
- }
1591
- async shutdownSystem() {
1592
- return postApiV1SystemShutdown();
1593
- }
1594
- async getSystemBackups() {
1595
- return getApiV1SystemBackup();
1596
- }
1597
- async deleteSystemBackup(id) {
1598
- return deleteApiV1SystemBackupById({ path: { id } });
1599
- }
1600
- async restoreSystemBackup(id) {
1601
- return postApiV1SystemBackupRestoreById({ path: { id } });
1602
- }
1603
- async uploadSystemBackup() {
1604
- return postApiV1SystemBackupRestoreUpload();
1605
- }
1606
- async getSystemLogs() {
1607
- return getApiV1Log();
1608
- }
1609
- async getLogFiles() {
1610
- return getApiV1LogFile();
1611
- }
1612
- async getLogFileByName(filename) {
1613
- return getApiV1LogFileByFilename({ path: { filename } });
1614
- }
1615
- async getTags() {
1616
- return getApiV1Tag();
1617
- }
1618
- async addTag(tag) {
1619
- return postApiV1Tag({ body: tag });
1620
- }
1621
- async getTag(id) {
1622
- return getApiV1TagById({ path: { id } });
1623
- }
1624
- async updateTag(id, tag) {
1625
- return putApiV1TagById({ path: { id: String(id) }, body: tag });
1626
- }
1627
- async deleteTag(id) {
1628
- return deleteApiV1TagById({ path: { id } });
1629
- }
1630
- async getTagDetails() {
1631
- return getApiV1TagDetail();
1632
- }
1633
- async getTagDetailById(id) {
1634
- return getApiV1TagDetailById({ path: { id } });
1635
- }
1636
1725
  async getApplication(id) {
1637
1726
  return getApiV1ApplicationsById({ path: { id } });
1638
1727
  }
@@ -1654,47 +1743,17 @@ class ProwlarrClient {
1654
1743
  async getApplicationSchema() {
1655
1744
  return getApiV1ApplicationsSchema();
1656
1745
  }
1657
- async getIndexerSchema() {
1658
- return getApiV1IndexerSchema();
1659
- }
1660
- async testIndexer(indexer) {
1661
- return postApiV1IndexerTest({ body: indexer });
1662
- }
1663
- async testAllIndexers() {
1664
- return postApiV1IndexerTestall();
1665
- }
1666
- async getNotifications() {
1667
- return getApiV1Notification();
1668
- }
1669
- async getNotification(id) {
1670
- return getApiV1NotificationById({ path: { id } });
1671
- }
1672
- async addNotification(notification) {
1673
- return postApiV1Notification({ body: notification });
1674
- }
1675
- async updateNotification(id, notification) {
1676
- return putApiV1NotificationById({ path: { id: String(id) }, body: notification });
1677
- }
1678
- async deleteNotification(id) {
1679
- return deleteApiV1NotificationById({ path: { id } });
1680
- }
1681
- async getNotificationSchema() {
1682
- return getApiV1NotificationSchema();
1746
+ async getDevelopmentConfig() {
1747
+ return getApiV1ConfigDevelopment();
1683
1748
  }
1684
- async testNotification(notification) {
1685
- return postApiV1NotificationTest({ body: notification });
1749
+ async getDevelopmentConfigById(id) {
1750
+ return getApiV1ConfigDevelopmentById({ path: { id } });
1686
1751
  }
1687
- async testAllNotifications() {
1688
- return postApiV1NotificationTestall();
1752
+ async updateDevelopmentConfig(id, config) {
1753
+ return putApiV1ConfigDevelopmentById({ path: { id: String(id) }, body: config });
1689
1754
  }
1690
- updateConfig(newConfig) {
1691
- const updatedConfig = { ...this.clientConfig.config, ...newConfig };
1692
- this.clientConfig = createServarrClient(updatedConfig);
1693
- client.setConfig({
1694
- baseUrl: this.clientConfig.getBaseUrl(),
1695
- headers: this.clientConfig.getHeaders()
1696
- });
1697
- return this.clientConfig.config;
1755
+ async getSystemLogs() {
1756
+ return getApiV1Log();
1698
1757
  }
1699
1758
  }
1700
1759
  export {
@@ -1,27 +1,12 @@
1
1
  import type { QBittorrentClientConfig } from '../core/types';
2
2
  import type { TorrentInfo, TorrentsInfoPostData, TransferInfo } from '../generated/qbittorrent/types.gen';
3
3
  type TorrentFilter = NonNullable<TorrentsInfoPostData['body']['filter']>;
4
- /**
5
- * qBittorrent WebUI API client
6
- *
7
- * Uses cookie-based session authentication (SID) instead of API keys.
8
- *
9
- * @example
10
- * ```typescript
11
- * const qbit = new QBittorrentClient({
12
- * baseUrl: 'http://localhost:8080',
13
- * username: 'admin',
14
- * password: 'adminadmin'
15
- * });
16
- *
17
- * const torrents = await qbit.getTorrents();
18
- * ```
19
- */
20
4
  export declare class QBittorrentClient {
21
5
  private baseUrl;
22
6
  private username;
23
7
  private password;
24
8
  private sid;
9
+ private timeoutMs;
25
10
  constructor(config: QBittorrentClientConfig);
26
11
  private ensureAuth;
27
12
  private login;
@@ -36,6 +21,5 @@ export declare class QBittorrentClient {
36
21
  resumeTorrents(hashes: string): Promise<void>;
37
22
  deleteTorrents(hashes: string, deleteFiles?: boolean): Promise<void>;
38
23
  }
39
- export * from './qbittorrent-types';
40
24
  export * from './qbittorrent-types.js';
41
25
  //# sourceMappingURL=qbittorrent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"qbittorrent.d.ts","sourceRoot":"","sources":["../../src/clients/qbittorrent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAG7D,OAAO,KAAK,EACV,WAAW,EACX,oBAAoB,EACpB,YAAY,EACb,MAAM,oCAAoC,CAAC;AAE5C,KAAK,aAAa,GAAG,WAAW,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;AAEzE;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,GAAG,CAAuB;gB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,CAAC,YAAY,CAAC;IAOxC,WAAW,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAS3D,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM5C,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM7C,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAKzE;AAGD,cAAc,wBAAwB,CAAC"}
@@ -917,11 +917,14 @@ var torrentsDeletePost = (options) => (options.client ?? client).post({
917
917
  }
918
918
  });
919
919
  // src/clients/qbittorrent.ts
920
+ var DEFAULT_TIMEOUT_MS = 30000;
921
+
920
922
  class QBittorrentClient {
921
923
  baseUrl;
922
924
  username;
923
925
  password;
924
926
  sid = null;
927
+ timeoutMs;
925
928
  constructor(config) {
926
929
  if (!config.baseUrl) {
927
930
  throw new ConnectionError("No base URL provided");
@@ -929,9 +932,11 @@ class QBittorrentClient {
929
932
  this.baseUrl = config.baseUrl.replace(/\/$/, "");
930
933
  this.username = config.username;
931
934
  this.password = config.password;
935
+ this.timeoutMs = config.timeout ?? DEFAULT_TIMEOUT_MS;
932
936
  client.setConfig({
933
937
  baseUrl: `${this.baseUrl}/api/v2`,
934
- auth: () => this.ensureAuth()
938
+ auth: () => this.ensureAuth(),
939
+ signal: AbortSignal.timeout(this.timeoutMs)
935
940
  });
936
941
  }
937
942
  async ensureAuth() {
@@ -950,7 +955,8 @@ class QBittorrentClient {
950
955
  body: new URLSearchParams({
951
956
  username: this.username,
952
957
  password: this.password
953
- })
958
+ }),
959
+ signal: AbortSignal.timeout(this.timeoutMs)
954
960
  });
955
961
  if (!response.ok) {
956
962
  throw new ConnectionError(`qBittorrent login failed (${response.status})`);