@remote-app/transmission-client 0.1.4 → 0.22.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.
- package/README.md +90 -47
- package/dist/index.cjs +106 -0
- package/dist/index.d.cts +371 -0
- package/dist/index.d.mts +371 -0
- package/dist/index.mjs +99 -0
- package/dist/schemas.cjs +541 -0
- package/dist/schemas.d.cts +4657 -0
- package/dist/schemas.d.mts +4657 -0
- package/dist/schemas.mjs +506 -0
- package/dist/torrent-get-BosdT1jx.d.cts +195 -0
- package/dist/torrent-get-C1p73gUr.cjs +44 -0
- package/dist/torrent-get-D7xfEr_w.mjs +26 -0
- package/dist/torrent-get-Dqn7FoFh.d.mts +195 -0
- package/package.json +33 -7
- package/dist/client.d.ts +0 -10
- package/dist/client.js +0 -50
- package/dist/config.d.ts +0 -5
- package/dist/config.js +0 -1
- package/dist/error.d.ts +0 -9
- package/dist/error.js +0 -15
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -3
- package/dist/rpc-call.d.ts +0 -51
- package/dist/rpc-call.js +0 -1
- package/dist/rpc-calls/free-space.d.ts +0 -7
- package/dist/rpc-calls/free-space.js +0 -1
- package/dist/rpc-calls/index.d.ts +0 -14
- package/dist/rpc-calls/index.js +0 -1
- package/dist/rpc-calls/session-get.d.ts +0 -61
- package/dist/rpc-calls/session-get.js +0 -1
- package/dist/rpc-calls/session-set.d.ts +0 -2
- package/dist/rpc-calls/session-set.js +0 -1
- package/dist/rpc-calls/session-stats.d.ts +0 -24
- package/dist/rpc-calls/session-stats.js +0 -1
- package/dist/rpc-calls/torrent-add.d.ts +0 -24
- package/dist/rpc-calls/torrent-add.js +0 -1
- package/dist/rpc-calls/torrent-get.d.ts +0 -166
- package/dist/rpc-calls/torrent-get.js +0 -10
- package/dist/rpc-calls/torrent-reannounce.d.ts +0 -1
- package/dist/rpc-calls/torrent-reannounce.js +0 -1
- package/dist/rpc-calls/torrent-remove.d.ts +0 -4
- package/dist/rpc-calls/torrent-remove.js +0 -1
- package/dist/rpc-calls/torrent-set-location.d.ts +0 -5
- package/dist/rpc-calls/torrent-set-location.js +0 -1
- package/dist/rpc-calls/torrent-set.d.ts +0 -25
- package/dist/rpc-calls/torrent-set.js +0 -1
- package/dist/rpc-calls/torrent-start-now.d.ts +0 -1
- package/dist/rpc-calls/torrent-start-now.js +0 -1
- package/dist/rpc-calls/torrent-start.d.ts +0 -1
- package/dist/rpc-calls/torrent-start.js +0 -1
- package/dist/rpc-calls/torrent-stop.d.ts +0 -1
- package/dist/rpc-calls/torrent-stop.js +0 -1
- package/dist/rpc-calls/torrent-verify.d.ts +0 -1
- package/dist/rpc-calls/torrent-verify.js +0 -1
- package/dist/rpc-calls/utils.d.ts +0 -6
- package/dist/rpc-calls/utils.js +0 -1
package/dist/schemas.mjs
ADDED
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
import { n as Priority, r as TorrentStatus, t as Mode } from "./torrent-get-D7xfEr_w.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/schemas.ts
|
|
5
|
+
const IdentifierIdsSchema = z.union([
|
|
6
|
+
z.number(),
|
|
7
|
+
z.array(z.union([z.number(), z.string()])),
|
|
8
|
+
z.literal("recently-active")
|
|
9
|
+
]);
|
|
10
|
+
const IdentifiersSchema = z.object({ ids: IdentifierIdsSchema.optional() });
|
|
11
|
+
const UnitsSchema = z.object({
|
|
12
|
+
"speed-units": z.array(z.string()),
|
|
13
|
+
"speed-bytes": z.number(),
|
|
14
|
+
"size-units": z.array(z.string()),
|
|
15
|
+
"size-bytes": z.number(),
|
|
16
|
+
"memory-units": z.array(z.string()),
|
|
17
|
+
"memory-bytes": z.number()
|
|
18
|
+
}).passthrough();
|
|
19
|
+
const SessionGetResponseSchema = z.object({
|
|
20
|
+
"alt-speed-down": z.number().optional(),
|
|
21
|
+
"alt-speed-enabled": z.boolean().optional(),
|
|
22
|
+
"alt-speed-time-begin": z.number().optional(),
|
|
23
|
+
"alt-speed-time-enabled": z.boolean().optional(),
|
|
24
|
+
"alt-speed-time-end": z.number().optional(),
|
|
25
|
+
"alt-speed-time-day": z.number().optional(),
|
|
26
|
+
"alt-speed-up": z.number().optional(),
|
|
27
|
+
"blocklist-url": z.string().optional(),
|
|
28
|
+
"blocklist-enabled": z.boolean().optional(),
|
|
29
|
+
"blocklist-size": z.number().optional(),
|
|
30
|
+
"cache-size-mb": z.number().optional(),
|
|
31
|
+
"config-dir": z.string().optional(),
|
|
32
|
+
"default-trackers": z.string().optional(),
|
|
33
|
+
"dht-enabled": z.boolean().optional(),
|
|
34
|
+
"download-dir": z.string().optional(),
|
|
35
|
+
"download-dir-free-space": z.number().optional(),
|
|
36
|
+
"download-queue-size": z.number().optional(),
|
|
37
|
+
"download-queue-enabled": z.boolean().optional(),
|
|
38
|
+
encryption: z.string().optional(),
|
|
39
|
+
"idle-seeding-limit": z.number().optional(),
|
|
40
|
+
"idle-seeding-limit-enabled": z.boolean().optional(),
|
|
41
|
+
"incomplete-dir": z.string().optional(),
|
|
42
|
+
"incomplete-dir-enabled": z.boolean().optional(),
|
|
43
|
+
"lpd-enabled": z.boolean().optional(),
|
|
44
|
+
"peer-limit-global": z.number().optional(),
|
|
45
|
+
"peer-limit-per-torrent": z.number().optional(),
|
|
46
|
+
"pex-enabled": z.boolean().optional(),
|
|
47
|
+
"peer-port": z.number().optional(),
|
|
48
|
+
"peer-port-random-on-start": z.boolean().optional(),
|
|
49
|
+
"port-forwarding-enabled": z.boolean().optional(),
|
|
50
|
+
"queue-stalled-enabled": z.boolean().optional(),
|
|
51
|
+
"queue-stalled-minutes": z.number().optional(),
|
|
52
|
+
"rename-partial-files": z.boolean().optional(),
|
|
53
|
+
reqq: z.number().optional(),
|
|
54
|
+
"rpc-version": z.number().optional(),
|
|
55
|
+
"rpc-version-minimum": z.number().optional(),
|
|
56
|
+
"rpc-version-semver": z.string().optional(),
|
|
57
|
+
"script-torrent-added-enabled": z.boolean().optional(),
|
|
58
|
+
"script-torrent-added-filename": z.string().optional(),
|
|
59
|
+
"script-torrent-done-filename": z.string().optional(),
|
|
60
|
+
"script-torrent-done-enabled": z.boolean().optional(),
|
|
61
|
+
"script-torrent-done-seeding-enabled": z.boolean().optional(),
|
|
62
|
+
"script-torrent-done-seeding-filename": z.string().optional(),
|
|
63
|
+
seedRatioLimit: z.number().optional(),
|
|
64
|
+
seedRatioLimited: z.boolean().optional(),
|
|
65
|
+
"seed-queue-size": z.number().optional(),
|
|
66
|
+
"seed-queue-enabled": z.boolean().optional(),
|
|
67
|
+
"sequential-download": z.boolean().optional(),
|
|
68
|
+
"session-id": z.string().optional(),
|
|
69
|
+
"speed-limit-down": z.number().optional(),
|
|
70
|
+
"speed-limit-down-enabled": z.boolean().optional(),
|
|
71
|
+
"speed-limit-up": z.number().optional(),
|
|
72
|
+
"speed-limit-up-enabled": z.boolean().optional(),
|
|
73
|
+
"start-added-torrents": z.boolean().optional(),
|
|
74
|
+
"trash-original-torrent-files": z.boolean().optional(),
|
|
75
|
+
units: UnitsSchema.optional(),
|
|
76
|
+
"utp-enabled": z.boolean().optional(),
|
|
77
|
+
version: z.string().optional()
|
|
78
|
+
}).passthrough();
|
|
79
|
+
const SessionGetFieldSchema = z.enum([
|
|
80
|
+
"alt-speed-down",
|
|
81
|
+
"alt-speed-enabled",
|
|
82
|
+
"alt-speed-time-begin",
|
|
83
|
+
"alt-speed-time-enabled",
|
|
84
|
+
"alt-speed-time-end",
|
|
85
|
+
"alt-speed-time-day",
|
|
86
|
+
"alt-speed-up",
|
|
87
|
+
"blocklist-url",
|
|
88
|
+
"blocklist-enabled",
|
|
89
|
+
"blocklist-size",
|
|
90
|
+
"cache-size-mb",
|
|
91
|
+
"config-dir",
|
|
92
|
+
"default-trackers",
|
|
93
|
+
"dht-enabled",
|
|
94
|
+
"download-dir",
|
|
95
|
+
"download-dir-free-space",
|
|
96
|
+
"download-queue-size",
|
|
97
|
+
"download-queue-enabled",
|
|
98
|
+
"encryption",
|
|
99
|
+
"idle-seeding-limit",
|
|
100
|
+
"idle-seeding-limit-enabled",
|
|
101
|
+
"incomplete-dir",
|
|
102
|
+
"incomplete-dir-enabled",
|
|
103
|
+
"lpd-enabled",
|
|
104
|
+
"peer-limit-global",
|
|
105
|
+
"peer-limit-per-torrent",
|
|
106
|
+
"pex-enabled",
|
|
107
|
+
"peer-port",
|
|
108
|
+
"peer-port-random-on-start",
|
|
109
|
+
"port-forwarding-enabled",
|
|
110
|
+
"queue-stalled-enabled",
|
|
111
|
+
"queue-stalled-minutes",
|
|
112
|
+
"rename-partial-files",
|
|
113
|
+
"reqq",
|
|
114
|
+
"rpc-version",
|
|
115
|
+
"rpc-version-minimum",
|
|
116
|
+
"rpc-version-semver",
|
|
117
|
+
"script-torrent-added-enabled",
|
|
118
|
+
"script-torrent-added-filename",
|
|
119
|
+
"script-torrent-done-filename",
|
|
120
|
+
"script-torrent-done-enabled",
|
|
121
|
+
"script-torrent-done-seeding-enabled",
|
|
122
|
+
"script-torrent-done-seeding-filename",
|
|
123
|
+
"seedRatioLimit",
|
|
124
|
+
"seedRatioLimited",
|
|
125
|
+
"seed-queue-size",
|
|
126
|
+
"seed-queue-enabled",
|
|
127
|
+
"sequential-download",
|
|
128
|
+
"session-id",
|
|
129
|
+
"speed-limit-down",
|
|
130
|
+
"speed-limit-down-enabled",
|
|
131
|
+
"speed-limit-up",
|
|
132
|
+
"speed-limit-up-enabled",
|
|
133
|
+
"start-added-torrents",
|
|
134
|
+
"trash-original-torrent-files",
|
|
135
|
+
"units",
|
|
136
|
+
"utp-enabled",
|
|
137
|
+
"version"
|
|
138
|
+
]);
|
|
139
|
+
const SessionGetRequestSchema = z.object({ fields: z.array(SessionGetFieldSchema).optional() });
|
|
140
|
+
const SessionSetRequestSchema = SessionGetResponseSchema;
|
|
141
|
+
const StatsSchema = z.object({
|
|
142
|
+
uploadedBytes: z.number(),
|
|
143
|
+
downloadedBytes: z.number(),
|
|
144
|
+
filesAdded: z.number(),
|
|
145
|
+
sessionCount: z.number(),
|
|
146
|
+
secondsActive: z.number()
|
|
147
|
+
}).passthrough();
|
|
148
|
+
const SessionStatsResponseSchema = z.object({
|
|
149
|
+
activeTorrentCount: z.number(),
|
|
150
|
+
downloadSpeed: z.number(),
|
|
151
|
+
pausedTorrentCount: z.number(),
|
|
152
|
+
torrentCount: z.number(),
|
|
153
|
+
uploadSpeed: z.number(),
|
|
154
|
+
"cumulative-stats": StatsSchema,
|
|
155
|
+
"current-stats": StatsSchema
|
|
156
|
+
}).passthrough();
|
|
157
|
+
const SessionCloseRequestSchema = z.never();
|
|
158
|
+
const FreeSpaceResponseSchema = z.object({
|
|
159
|
+
path: z.string(),
|
|
160
|
+
"size-bytes": z.number()
|
|
161
|
+
}).passthrough();
|
|
162
|
+
const FreeSpaceRequestSchema = z.object({ path: z.string() });
|
|
163
|
+
const FileSchema = z.object({
|
|
164
|
+
bytesCompleted: z.number(),
|
|
165
|
+
length: z.number(),
|
|
166
|
+
name: z.string(),
|
|
167
|
+
beginPiece: z.number().optional(),
|
|
168
|
+
endPiece: z.number().optional()
|
|
169
|
+
}).passthrough();
|
|
170
|
+
const FileStatsSchema = z.object({
|
|
171
|
+
bytesCompleted: z.number(),
|
|
172
|
+
wanted: z.boolean(),
|
|
173
|
+
priority: z.nativeEnum(Priority)
|
|
174
|
+
}).passthrough();
|
|
175
|
+
const PeerSchema = z.object({
|
|
176
|
+
address: z.string(),
|
|
177
|
+
clientName: z.string(),
|
|
178
|
+
clientIsChoked: z.boolean(),
|
|
179
|
+
clientIsInterested: z.boolean(),
|
|
180
|
+
flagStr: z.string(),
|
|
181
|
+
isDownloadingFrom: z.boolean(),
|
|
182
|
+
isEncrypted: z.boolean(),
|
|
183
|
+
isIncoming: z.boolean(),
|
|
184
|
+
isUploadingTo: z.boolean(),
|
|
185
|
+
isUTP: z.boolean(),
|
|
186
|
+
peerIsChoked: z.boolean(),
|
|
187
|
+
peerIsInterested: z.boolean(),
|
|
188
|
+
port: z.number(),
|
|
189
|
+
progress: z.number(),
|
|
190
|
+
rateToClient: z.number(),
|
|
191
|
+
rateToPeer: z.number()
|
|
192
|
+
}).passthrough();
|
|
193
|
+
const PeersFromSchema = z.object({
|
|
194
|
+
fromCache: z.number(),
|
|
195
|
+
fromDht: z.number(),
|
|
196
|
+
fromIncoming: z.number(),
|
|
197
|
+
fromLpd: z.number(),
|
|
198
|
+
fromLtep: z.number(),
|
|
199
|
+
fromPex: z.number(),
|
|
200
|
+
fromTracker: z.number()
|
|
201
|
+
}).passthrough();
|
|
202
|
+
const TrackerSchema = z.object({
|
|
203
|
+
announce: z.string(),
|
|
204
|
+
id: z.number(),
|
|
205
|
+
scrape: z.string(),
|
|
206
|
+
sitename: z.string().optional(),
|
|
207
|
+
tier: z.number()
|
|
208
|
+
}).passthrough();
|
|
209
|
+
const TrackerStatsSchema = z.object({
|
|
210
|
+
announce: z.string(),
|
|
211
|
+
announceState: z.number(),
|
|
212
|
+
downloadCount: z.number(),
|
|
213
|
+
hasAnnounced: z.boolean(),
|
|
214
|
+
hasScraped: z.boolean(),
|
|
215
|
+
host: z.string(),
|
|
216
|
+
id: z.number(),
|
|
217
|
+
isBackup: z.boolean(),
|
|
218
|
+
lastAnnouncePeerCount: z.number(),
|
|
219
|
+
lastAnnounceResult: z.string(),
|
|
220
|
+
lastAnnounceStartTime: z.number(),
|
|
221
|
+
lastAnnounceSucceeded: z.boolean(),
|
|
222
|
+
lastAnnounceTime: z.number(),
|
|
223
|
+
lastAnnounceTimedOut: z.boolean(),
|
|
224
|
+
lastScrapeResult: z.string(),
|
|
225
|
+
lastScrapeStartTime: z.number(),
|
|
226
|
+
lastScrapeSucceeded: z.boolean(),
|
|
227
|
+
lastScrapeTime: z.number(),
|
|
228
|
+
lastScrapeTimedOut: z.boolean(),
|
|
229
|
+
leecherCount: z.number(),
|
|
230
|
+
nextAnnounceTime: z.number(),
|
|
231
|
+
nextScrapeTime: z.number(),
|
|
232
|
+
scrape: z.string(),
|
|
233
|
+
scrapeState: z.number(),
|
|
234
|
+
seederCount: z.number(),
|
|
235
|
+
sitename: z.string().optional(),
|
|
236
|
+
tier: z.number()
|
|
237
|
+
}).passthrough();
|
|
238
|
+
const TorrentSchema = z.object({
|
|
239
|
+
activityDate: z.number().optional(),
|
|
240
|
+
addedDate: z.number().optional(),
|
|
241
|
+
availability: z.array(z.number()).optional(),
|
|
242
|
+
bandwidthPriority: z.nativeEnum(Priority).optional(),
|
|
243
|
+
comment: z.string().optional(),
|
|
244
|
+
corruptEver: z.number().optional(),
|
|
245
|
+
creator: z.string().optional(),
|
|
246
|
+
dateCreated: z.number().optional(),
|
|
247
|
+
desiredAvailable: z.number().optional(),
|
|
248
|
+
doneDate: z.number().optional(),
|
|
249
|
+
downloadDir: z.string().optional(),
|
|
250
|
+
downloadedEver: z.number().optional(),
|
|
251
|
+
downloadLimit: z.number().optional(),
|
|
252
|
+
downloadLimited: z.boolean().optional(),
|
|
253
|
+
editDate: z.number().optional(),
|
|
254
|
+
error: z.number().optional(),
|
|
255
|
+
errorString: z.string().optional(),
|
|
256
|
+
eta: z.number().optional(),
|
|
257
|
+
etaIdle: z.number().optional(),
|
|
258
|
+
"file-count": z.number().optional(),
|
|
259
|
+
files: z.array(FileSchema).optional(),
|
|
260
|
+
fileStats: z.array(FileStatsSchema).optional(),
|
|
261
|
+
group: z.string().optional(),
|
|
262
|
+
hashString: z.string().optional(),
|
|
263
|
+
haveUnchecked: z.number().optional(),
|
|
264
|
+
haveValid: z.number().optional(),
|
|
265
|
+
honorsSessionLimits: z.boolean().optional(),
|
|
266
|
+
id: z.number().optional(),
|
|
267
|
+
isFinished: z.boolean().optional(),
|
|
268
|
+
isPrivate: z.boolean().optional(),
|
|
269
|
+
isStalled: z.boolean().optional(),
|
|
270
|
+
labels: z.array(z.string()).optional(),
|
|
271
|
+
leftUntilDone: z.number().optional(),
|
|
272
|
+
magnetLink: z.string().optional(),
|
|
273
|
+
manualAnnounceTime: z.number().optional(),
|
|
274
|
+
maxConnectedPeers: z.number().optional(),
|
|
275
|
+
metadataPercentComplete: z.number().optional(),
|
|
276
|
+
name: z.string().optional(),
|
|
277
|
+
"peer-limit": z.number().optional(),
|
|
278
|
+
peers: z.array(PeerSchema).optional(),
|
|
279
|
+
peersConnected: z.number().optional(),
|
|
280
|
+
peersFrom: PeersFromSchema.optional(),
|
|
281
|
+
peersGettingFromUs: z.number().optional(),
|
|
282
|
+
peersSendingToUs: z.number().optional(),
|
|
283
|
+
percentComplete: z.number().optional(),
|
|
284
|
+
percentDone: z.number().optional(),
|
|
285
|
+
pieces: z.string().optional(),
|
|
286
|
+
pieceCount: z.number().optional(),
|
|
287
|
+
pieceSize: z.number().optional(),
|
|
288
|
+
priorities: z.array(z.nativeEnum(Priority)).optional(),
|
|
289
|
+
"primary-mime-type": z.string().optional(),
|
|
290
|
+
queuePosition: z.number().optional(),
|
|
291
|
+
rateDownload: z.number().optional(),
|
|
292
|
+
rateUpload: z.number().optional(),
|
|
293
|
+
recheckProgress: z.number().optional(),
|
|
294
|
+
secondsDownloading: z.number().optional(),
|
|
295
|
+
secondsSeeding: z.number().optional(),
|
|
296
|
+
seedIdleLimit: z.number().optional(),
|
|
297
|
+
seedIdleMode: z.nativeEnum(Mode).optional(),
|
|
298
|
+
seedRatioLimit: z.number().optional(),
|
|
299
|
+
seedRatioMode: z.nativeEnum(Mode).optional(),
|
|
300
|
+
sequentialDownload: z.boolean().optional(),
|
|
301
|
+
sizeWhenDone: z.number().optional(),
|
|
302
|
+
startDate: z.number().optional(),
|
|
303
|
+
status: z.nativeEnum(TorrentStatus).optional(),
|
|
304
|
+
trackers: z.array(TrackerSchema).optional(),
|
|
305
|
+
trackerList: z.string().optional(),
|
|
306
|
+
trackerStats: z.array(TrackerStatsSchema).optional(),
|
|
307
|
+
totalSize: z.number().optional(),
|
|
308
|
+
torrentFile: z.string().optional(),
|
|
309
|
+
uploadedEver: z.number().optional(),
|
|
310
|
+
uploadLimit: z.number().optional(),
|
|
311
|
+
uploadLimited: z.boolean().optional(),
|
|
312
|
+
uploadRatio: z.number().optional(),
|
|
313
|
+
wanted: z.array(z.number()).optional(),
|
|
314
|
+
webseeds: z.array(z.string()).optional(),
|
|
315
|
+
webseedsSendingToUs: z.number().optional()
|
|
316
|
+
}).passthrough();
|
|
317
|
+
const TorrentFormatSchema = z.enum(["objects", "table"]);
|
|
318
|
+
const TorrentFieldSchema = z.enum([
|
|
319
|
+
"activityDate",
|
|
320
|
+
"addedDate",
|
|
321
|
+
"availability",
|
|
322
|
+
"bandwidthPriority",
|
|
323
|
+
"comment",
|
|
324
|
+
"corruptEver",
|
|
325
|
+
"creator",
|
|
326
|
+
"dateCreated",
|
|
327
|
+
"desiredAvailable",
|
|
328
|
+
"doneDate",
|
|
329
|
+
"downloadDir",
|
|
330
|
+
"downloadedEver",
|
|
331
|
+
"downloadLimit",
|
|
332
|
+
"downloadLimited",
|
|
333
|
+
"editDate",
|
|
334
|
+
"error",
|
|
335
|
+
"errorString",
|
|
336
|
+
"eta",
|
|
337
|
+
"etaIdle",
|
|
338
|
+
"file-count",
|
|
339
|
+
"files",
|
|
340
|
+
"fileStats",
|
|
341
|
+
"group",
|
|
342
|
+
"hashString",
|
|
343
|
+
"haveUnchecked",
|
|
344
|
+
"haveValid",
|
|
345
|
+
"honorsSessionLimits",
|
|
346
|
+
"id",
|
|
347
|
+
"isFinished",
|
|
348
|
+
"isPrivate",
|
|
349
|
+
"isStalled",
|
|
350
|
+
"labels",
|
|
351
|
+
"leftUntilDone",
|
|
352
|
+
"magnetLink",
|
|
353
|
+
"manualAnnounceTime",
|
|
354
|
+
"maxConnectedPeers",
|
|
355
|
+
"metadataPercentComplete",
|
|
356
|
+
"name",
|
|
357
|
+
"peer-limit",
|
|
358
|
+
"peers",
|
|
359
|
+
"peersConnected",
|
|
360
|
+
"peersFrom",
|
|
361
|
+
"peersGettingFromUs",
|
|
362
|
+
"peersSendingToUs",
|
|
363
|
+
"percentComplete",
|
|
364
|
+
"percentDone",
|
|
365
|
+
"pieces",
|
|
366
|
+
"pieceCount",
|
|
367
|
+
"pieceSize",
|
|
368
|
+
"priorities",
|
|
369
|
+
"primary-mime-type",
|
|
370
|
+
"queuePosition",
|
|
371
|
+
"rateDownload",
|
|
372
|
+
"rateUpload",
|
|
373
|
+
"recheckProgress",
|
|
374
|
+
"secondsDownloading",
|
|
375
|
+
"secondsSeeding",
|
|
376
|
+
"seedIdleLimit",
|
|
377
|
+
"seedIdleMode",
|
|
378
|
+
"seedRatioLimit",
|
|
379
|
+
"seedRatioMode",
|
|
380
|
+
"sequentialDownload",
|
|
381
|
+
"sizeWhenDone",
|
|
382
|
+
"startDate",
|
|
383
|
+
"status",
|
|
384
|
+
"trackers",
|
|
385
|
+
"trackerList",
|
|
386
|
+
"trackerStats",
|
|
387
|
+
"totalSize",
|
|
388
|
+
"torrentFile",
|
|
389
|
+
"uploadedEver",
|
|
390
|
+
"uploadLimit",
|
|
391
|
+
"uploadLimited",
|
|
392
|
+
"uploadRatio",
|
|
393
|
+
"wanted",
|
|
394
|
+
"webseeds",
|
|
395
|
+
"webseedsSendingToUs"
|
|
396
|
+
]);
|
|
397
|
+
const TorrentGetResponseSchema = z.object({
|
|
398
|
+
torrents: z.array(TorrentSchema),
|
|
399
|
+
removed: z.array(z.number()).optional()
|
|
400
|
+
}).passthrough();
|
|
401
|
+
const TorrentGetRequestSchema = IdentifiersSchema.extend({
|
|
402
|
+
fields: z.array(TorrentFieldSchema),
|
|
403
|
+
format: TorrentFormatSchema.optional()
|
|
404
|
+
});
|
|
405
|
+
const TorrentStartRequestSchema = IdentifiersSchema;
|
|
406
|
+
const TorrentStartNowRequestSchema = IdentifiersSchema;
|
|
407
|
+
const TorrentStopRequestSchema = IdentifiersSchema;
|
|
408
|
+
const TorrentVerifyRequestSchema = IdentifiersSchema;
|
|
409
|
+
const TorrentReannounceRequestSchema = IdentifiersSchema;
|
|
410
|
+
const TorrentSetRequestSchema = IdentifiersSchema.extend({
|
|
411
|
+
bandwidthPriority: z.nativeEnum(Priority).optional(),
|
|
412
|
+
downloadLimit: z.number().optional(),
|
|
413
|
+
downloadLimited: z.boolean().optional(),
|
|
414
|
+
"files-wanted": z.array(z.number()).optional(),
|
|
415
|
+
"files-unwanted": z.array(z.number()).optional(),
|
|
416
|
+
honorsSessionLimits: z.boolean().optional(),
|
|
417
|
+
labels: z.array(z.string()).optional(),
|
|
418
|
+
location: z.string().optional(),
|
|
419
|
+
"peer-limit": z.number().optional(),
|
|
420
|
+
"priority-high": z.array(z.number()).optional(),
|
|
421
|
+
"priority-low": z.array(z.number()).optional(),
|
|
422
|
+
"priority-normal": z.array(z.number()).optional(),
|
|
423
|
+
queuePosition: z.number().optional(),
|
|
424
|
+
seedIdleLimit: z.number().optional(),
|
|
425
|
+
seedIdleMode: z.nativeEnum(Mode).optional(),
|
|
426
|
+
seedRatioLimit: z.number().optional(),
|
|
427
|
+
seedRatioMode: z.nativeEnum(Mode).optional(),
|
|
428
|
+
trackerAdd: z.array(z.string()).optional(),
|
|
429
|
+
trackerRemove: z.array(z.number()).optional(),
|
|
430
|
+
trackerReplace: z.array(z.object({
|
|
431
|
+
id: z.number(),
|
|
432
|
+
announce: z.string()
|
|
433
|
+
})).optional(),
|
|
434
|
+
trackerList: z.string().optional(),
|
|
435
|
+
group: z.string().optional(),
|
|
436
|
+
sequentialDownload: z.boolean().optional(),
|
|
437
|
+
uploadLimit: z.number().optional(),
|
|
438
|
+
uploadLimited: z.boolean().optional()
|
|
439
|
+
});
|
|
440
|
+
const TorrentAddOptionalsSchema = z.object({
|
|
441
|
+
cookies: z.string().optional(),
|
|
442
|
+
"download-dir": z.string().optional(),
|
|
443
|
+
labels: z.array(z.string()).optional(),
|
|
444
|
+
paused: z.boolean().optional(),
|
|
445
|
+
"peer-limit": z.number().optional(),
|
|
446
|
+
bandwidthPriority: z.number().optional(),
|
|
447
|
+
"files-wanted": z.array(z.number()).optional(),
|
|
448
|
+
"files-unwanted": z.array(z.number()).optional(),
|
|
449
|
+
"priority-high": z.array(z.number()).optional(),
|
|
450
|
+
"priority-low": z.array(z.number()).optional(),
|
|
451
|
+
"priority-normal": z.array(z.number()).optional(),
|
|
452
|
+
"sequential-download": z.boolean().optional()
|
|
453
|
+
});
|
|
454
|
+
const TorrentAddRequestSchema = z.union([TorrentAddOptionalsSchema.extend({ filename: z.string() }), TorrentAddOptionalsSchema.extend({ metainfo: z.string() })]);
|
|
455
|
+
const TorrentAddResultSchema = z.object({
|
|
456
|
+
id: z.number().optional(),
|
|
457
|
+
name: z.string().optional(),
|
|
458
|
+
hashString: z.string().optional()
|
|
459
|
+
}).passthrough();
|
|
460
|
+
const TorrentAddResponseSchema = z.union([z.object({ "torrent-added": z.array(TorrentAddResultSchema) }).passthrough(), z.object({ "torrent-duplicate": z.array(TorrentAddResultSchema) }).passthrough()]);
|
|
461
|
+
const TorrentRemoveRequestSchema = IdentifiersSchema.extend({ "delete-local-data": z.boolean().optional() });
|
|
462
|
+
const TorrentSetLocationRequestSchema = IdentifiersSchema.extend({
|
|
463
|
+
location: z.string(),
|
|
464
|
+
move: z.boolean().optional()
|
|
465
|
+
});
|
|
466
|
+
const TorrentRenamePathRequestSchema = IdentifiersSchema.extend({
|
|
467
|
+
path: z.string(),
|
|
468
|
+
name: z.string()
|
|
469
|
+
});
|
|
470
|
+
const TorrentRenamePathResponseSchema = z.object({
|
|
471
|
+
path: z.string(),
|
|
472
|
+
name: z.string(),
|
|
473
|
+
id: z.number()
|
|
474
|
+
}).passthrough();
|
|
475
|
+
const QueueMoveTopRequestSchema = IdentifiersSchema;
|
|
476
|
+
const QueueMoveUpRequestSchema = IdentifiersSchema;
|
|
477
|
+
const QueueMoveDownRequestSchema = IdentifiersSchema;
|
|
478
|
+
const QueueMoveBottomRequestSchema = IdentifiersSchema;
|
|
479
|
+
const BlocklistUpdateRequestSchema = z.never();
|
|
480
|
+
const BlocklistUpdateResponseSchema = z.object({ "blocklist-size": z.number() }).passthrough();
|
|
481
|
+
const PortTestRequestSchema = z.object({ ipProtocol: z.enum(["ipv4", "ipv6"]).optional() });
|
|
482
|
+
const PortTestResponseSchema = z.object({
|
|
483
|
+
"port-is-open": z.boolean(),
|
|
484
|
+
ipProtocol: z.enum(["ipv4", "ipv6"]).optional()
|
|
485
|
+
}).passthrough();
|
|
486
|
+
const BandwidthGroupSchema = z.object({
|
|
487
|
+
honorsSessionLimits: z.boolean(),
|
|
488
|
+
name: z.string(),
|
|
489
|
+
"speed-limit-down-enabled": z.boolean(),
|
|
490
|
+
"speed-limit-down": z.number(),
|
|
491
|
+
"speed-limit-up-enabled": z.boolean(),
|
|
492
|
+
"speed-limit-up": z.number()
|
|
493
|
+
}).passthrough();
|
|
494
|
+
const GroupGetRequestSchema = z.object({ group: z.union([z.string(), z.array(z.string())]).optional() });
|
|
495
|
+
const GroupGetResponseSchema = z.object({ group: z.array(BandwidthGroupSchema) }).passthrough();
|
|
496
|
+
const GroupSetRequestSchema = z.object({
|
|
497
|
+
honorsSessionLimits: z.boolean().optional(),
|
|
498
|
+
name: z.string(),
|
|
499
|
+
"speed-limit-down-enabled": z.boolean().optional(),
|
|
500
|
+
"speed-limit-down": z.number().optional(),
|
|
501
|
+
"speed-limit-up-enabled": z.boolean().optional(),
|
|
502
|
+
"speed-limit-up": z.number().optional()
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
//#endregion
|
|
506
|
+
export { BandwidthGroupSchema, BlocklistUpdateRequestSchema, BlocklistUpdateResponseSchema, FreeSpaceRequestSchema, FreeSpaceResponseSchema, GroupGetRequestSchema, GroupGetResponseSchema, GroupSetRequestSchema, PortTestRequestSchema, PortTestResponseSchema, QueueMoveBottomRequestSchema, QueueMoveDownRequestSchema, QueueMoveTopRequestSchema, QueueMoveUpRequestSchema, SessionCloseRequestSchema, SessionGetRequestSchema, SessionGetResponseSchema, SessionSetRequestSchema, SessionStatsResponseSchema, TorrentAddRequestSchema, TorrentAddResponseSchema, TorrentFormatSchema, TorrentGetRequestSchema, TorrentGetResponseSchema, TorrentReannounceRequestSchema, TorrentRemoveRequestSchema, TorrentRenamePathRequestSchema, TorrentRenamePathResponseSchema, TorrentSchema, TorrentSetLocationRequestSchema, TorrentSetRequestSchema, TorrentStartNowRequestSchema, TorrentStartRequestSchema, TorrentStopRequestSchema, TorrentVerifyRequestSchema };
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
//#region src/rpc-calls/utils.d.ts
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
ids?: number | (number | string)[] | "recently-active";
|
|
4
|
+
};
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/rpc-calls/torrent-get.d.ts
|
|
7
|
+
type File = {
|
|
8
|
+
bytesCompleted: number;
|
|
9
|
+
length: number;
|
|
10
|
+
name: string;
|
|
11
|
+
beginPiece?: number;
|
|
12
|
+
endPiece?: number;
|
|
13
|
+
};
|
|
14
|
+
type FileStats = {
|
|
15
|
+
bytesCompleted: number;
|
|
16
|
+
wanted: boolean;
|
|
17
|
+
priority: Priority;
|
|
18
|
+
};
|
|
19
|
+
type Peer = {
|
|
20
|
+
address: string;
|
|
21
|
+
clientName: string;
|
|
22
|
+
clientIsChoked: boolean;
|
|
23
|
+
clientIsInterested: boolean;
|
|
24
|
+
flagStr: string;
|
|
25
|
+
isDownloadingFrom: boolean;
|
|
26
|
+
isEncrypted: boolean;
|
|
27
|
+
isIncoming: boolean;
|
|
28
|
+
isUploadingTo: boolean;
|
|
29
|
+
isUTP: boolean;
|
|
30
|
+
peerIsChoked: boolean;
|
|
31
|
+
peerIsInterested: boolean;
|
|
32
|
+
port: number;
|
|
33
|
+
progress: number;
|
|
34
|
+
rateToClient: number;
|
|
35
|
+
rateToPeer: number;
|
|
36
|
+
};
|
|
37
|
+
type PeersFrom = {
|
|
38
|
+
fromCache: number;
|
|
39
|
+
fromDht: number;
|
|
40
|
+
fromIncoming: number;
|
|
41
|
+
fromLpd: number;
|
|
42
|
+
fromLtep: number;
|
|
43
|
+
fromPex: number;
|
|
44
|
+
fromTracker: number;
|
|
45
|
+
};
|
|
46
|
+
type Tracker = {
|
|
47
|
+
announce: string;
|
|
48
|
+
id: number;
|
|
49
|
+
scrape: string;
|
|
50
|
+
sitename?: string;
|
|
51
|
+
tier: number;
|
|
52
|
+
};
|
|
53
|
+
type TrackerStats = {
|
|
54
|
+
announce: string;
|
|
55
|
+
announceState: number;
|
|
56
|
+
downloadCount: number;
|
|
57
|
+
hasAnnounced: boolean;
|
|
58
|
+
hasScraped: boolean;
|
|
59
|
+
host: string;
|
|
60
|
+
id: number;
|
|
61
|
+
isBackup: boolean;
|
|
62
|
+
lastAnnouncePeerCount: number;
|
|
63
|
+
lastAnnounceResult: string;
|
|
64
|
+
lastAnnounceStartTime: number;
|
|
65
|
+
lastAnnounceSucceeded: boolean;
|
|
66
|
+
lastAnnounceTime: number;
|
|
67
|
+
lastAnnounceTimedOut: boolean;
|
|
68
|
+
lastScrapeResult: string;
|
|
69
|
+
lastScrapeStartTime: number;
|
|
70
|
+
lastScrapeSucceeded: boolean;
|
|
71
|
+
lastScrapeTime: number;
|
|
72
|
+
lastScrapeTimedOut: boolean;
|
|
73
|
+
leecherCount: number;
|
|
74
|
+
nextAnnounceTime: number;
|
|
75
|
+
nextScrapeTime: number;
|
|
76
|
+
scrape: string;
|
|
77
|
+
scrapeState: number;
|
|
78
|
+
seederCount: number;
|
|
79
|
+
sitename?: string;
|
|
80
|
+
tier: number;
|
|
81
|
+
};
|
|
82
|
+
declare enum TorrentStatus {
|
|
83
|
+
STOPPED = 0,
|
|
84
|
+
QUEUED_TO_VERIFY_LOCAL_DATA = 1,
|
|
85
|
+
VERIFYING_LOCAL_DATA = 2,
|
|
86
|
+
QUEUED_TO_DOWNLOAD = 3,
|
|
87
|
+
DOWNLOADING = 4,
|
|
88
|
+
QUEUED_TO_SEED = 5,
|
|
89
|
+
SEEDING = 6
|
|
90
|
+
}
|
|
91
|
+
declare enum Priority {
|
|
92
|
+
LOW = -1,
|
|
93
|
+
NORMAL = 0,
|
|
94
|
+
HIGH = 1
|
|
95
|
+
}
|
|
96
|
+
declare enum Mode {
|
|
97
|
+
GLOBAL = 0,
|
|
98
|
+
SINGLE = 1,
|
|
99
|
+
UNLIMITED = 2
|
|
100
|
+
}
|
|
101
|
+
type Torrent = {
|
|
102
|
+
activityDate?: number;
|
|
103
|
+
addedDate?: number;
|
|
104
|
+
availability?: number[];
|
|
105
|
+
bandwidthPriority?: Priority;
|
|
106
|
+
comment?: string;
|
|
107
|
+
corruptEver?: number;
|
|
108
|
+
creator?: string;
|
|
109
|
+
dateCreated?: number;
|
|
110
|
+
desiredAvailable?: number;
|
|
111
|
+
doneDate?: number;
|
|
112
|
+
downloadDir?: string;
|
|
113
|
+
downloadedEver?: number;
|
|
114
|
+
downloadLimit?: number;
|
|
115
|
+
downloadLimited?: boolean;
|
|
116
|
+
editDate?: number;
|
|
117
|
+
error?: number;
|
|
118
|
+
errorString?: string;
|
|
119
|
+
eta?: number;
|
|
120
|
+
etaIdle?: number;
|
|
121
|
+
"file-count"?: number;
|
|
122
|
+
files?: File[];
|
|
123
|
+
fileStats?: FileStats[];
|
|
124
|
+
group?: string;
|
|
125
|
+
hashString?: string;
|
|
126
|
+
haveUnchecked?: number;
|
|
127
|
+
haveValid?: number;
|
|
128
|
+
honorsSessionLimits?: boolean;
|
|
129
|
+
id?: number;
|
|
130
|
+
isFinished?: boolean;
|
|
131
|
+
isPrivate?: boolean;
|
|
132
|
+
isStalled?: boolean;
|
|
133
|
+
labels?: string[];
|
|
134
|
+
leftUntilDone?: number;
|
|
135
|
+
magnetLink?: string;
|
|
136
|
+
manualAnnounceTime?: number;
|
|
137
|
+
maxConnectedPeers?: number;
|
|
138
|
+
metadataPercentComplete?: number;
|
|
139
|
+
name?: string;
|
|
140
|
+
"peer-limit"?: number;
|
|
141
|
+
peers?: Peer[];
|
|
142
|
+
peersConnected?: number;
|
|
143
|
+
peersFrom?: PeersFrom;
|
|
144
|
+
peersGettingFromUs?: number;
|
|
145
|
+
peersSendingToUs?: number;
|
|
146
|
+
percentComplete?: number;
|
|
147
|
+
percentDone?: number;
|
|
148
|
+
pieces?: string;
|
|
149
|
+
pieceCount?: number;
|
|
150
|
+
pieceSize?: number;
|
|
151
|
+
priorities?: Priority[];
|
|
152
|
+
"primary-mime-type"?: string;
|
|
153
|
+
queuePosition?: number;
|
|
154
|
+
rateDownload?: number;
|
|
155
|
+
rateUpload?: number;
|
|
156
|
+
recheckProgress?: number;
|
|
157
|
+
secondsDownloading?: number;
|
|
158
|
+
secondsSeeding?: number;
|
|
159
|
+
seedIdleLimit?: number;
|
|
160
|
+
seedIdleMode?: Mode;
|
|
161
|
+
seedRatioLimit?: number;
|
|
162
|
+
seedRatioMode?: Mode;
|
|
163
|
+
sequentialDownload?: boolean;
|
|
164
|
+
sizeWhenDone?: number;
|
|
165
|
+
startDate?: number;
|
|
166
|
+
status?: TorrentStatus;
|
|
167
|
+
trackers?: Tracker[];
|
|
168
|
+
trackerList?: string;
|
|
169
|
+
trackerStats?: TrackerStats[];
|
|
170
|
+
totalSize?: number;
|
|
171
|
+
torrentFile?: string;
|
|
172
|
+
uploadedEver?: number;
|
|
173
|
+
uploadLimit?: number;
|
|
174
|
+
uploadLimited?: boolean;
|
|
175
|
+
uploadRatio?: number;
|
|
176
|
+
wanted?: number[];
|
|
177
|
+
webseeds?: string[];
|
|
178
|
+
webseedsSendingToUs?: number;
|
|
179
|
+
};
|
|
180
|
+
type TorrentFormat = "objects" | "table";
|
|
181
|
+
type TorrentField = keyof Torrent;
|
|
182
|
+
type SelectedTorrentFields<F extends readonly TorrentField[]> = { [K in F[number]]-?: NonNullable<Torrent[K]> };
|
|
183
|
+
type IsTuple<T extends readonly unknown[]> = number extends T["length"] ? false : true;
|
|
184
|
+
type TorrentForFields<F extends readonly TorrentField[]> = IsTuple<F> extends true ? SelectedTorrentFields<F> : Torrent;
|
|
185
|
+
type ResponseFor<F extends readonly TorrentField[]> = {
|
|
186
|
+
torrents: TorrentForFields<F>[];
|
|
187
|
+
removed?: number[];
|
|
188
|
+
};
|
|
189
|
+
type Response = ResponseFor<readonly TorrentField[]>;
|
|
190
|
+
type Request<F extends readonly TorrentField[] = readonly TorrentField[]> = Identifiers & {
|
|
191
|
+
fields: F;
|
|
192
|
+
format?: TorrentFormat;
|
|
193
|
+
};
|
|
194
|
+
//#endregion
|
|
195
|
+
export { ResponseFor as a, TorrentStatus as c, Response as i, Identifiers as l, Priority as n, TorrentField as o, Request as r, TorrentForFields as s, Mode as t };
|