@remote-app/qbittorrent-client 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 +121 -0
- package/dist/index.cjs +275 -0
- package/dist/index.d.cts +62 -0
- package/dist/index.d.mts +62 -0
- package/dist/index.mjs +271 -0
- package/dist/schemas.cjs +287 -0
- package/dist/schemas.d.cts +861 -0
- package/dist/schemas.d.mts +861 -0
- package/dist/schemas.mjs +274 -0
- package/package.json +55 -0
package/dist/schemas.mjs
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/schemas.ts
|
|
4
|
+
const QBittorrentConfigSchema = z.object({
|
|
5
|
+
url: z.string(),
|
|
6
|
+
username: z.string().optional(),
|
|
7
|
+
password: z.string().optional()
|
|
8
|
+
});
|
|
9
|
+
const TorrentStateSchema = z.enum([
|
|
10
|
+
"error",
|
|
11
|
+
"missingFiles",
|
|
12
|
+
"uploading",
|
|
13
|
+
"stoppedUP",
|
|
14
|
+
"queuedUP",
|
|
15
|
+
"stalledUP",
|
|
16
|
+
"checkingUP",
|
|
17
|
+
"forcedUP",
|
|
18
|
+
"allocating",
|
|
19
|
+
"downloading",
|
|
20
|
+
"metaDL",
|
|
21
|
+
"forcedMetaDL",
|
|
22
|
+
"stoppedDL",
|
|
23
|
+
"queuedDL",
|
|
24
|
+
"stalledDL",
|
|
25
|
+
"checkingDL",
|
|
26
|
+
"forcedDL",
|
|
27
|
+
"checkingResumeData",
|
|
28
|
+
"moving",
|
|
29
|
+
"unknown"
|
|
30
|
+
]);
|
|
31
|
+
const TorrentInfoSchema = z.object({
|
|
32
|
+
hash: z.string(),
|
|
33
|
+
infohash_v1: z.string(),
|
|
34
|
+
infohash_v2: z.string(),
|
|
35
|
+
name: z.string(),
|
|
36
|
+
magnet_uri: z.string(),
|
|
37
|
+
size: z.number(),
|
|
38
|
+
total_size: z.number(),
|
|
39
|
+
progress: z.number(),
|
|
40
|
+
dlspeed: z.number(),
|
|
41
|
+
upspeed: z.number(),
|
|
42
|
+
priority: z.number(),
|
|
43
|
+
num_seeds: z.number(),
|
|
44
|
+
num_complete: z.number(),
|
|
45
|
+
num_leechs: z.number(),
|
|
46
|
+
num_incomplete: z.number(),
|
|
47
|
+
ratio: z.number(),
|
|
48
|
+
eta: z.number(),
|
|
49
|
+
state: TorrentStateSchema,
|
|
50
|
+
seq_dl: z.boolean(),
|
|
51
|
+
f_l_piece_prio: z.boolean(),
|
|
52
|
+
category: z.string(),
|
|
53
|
+
tags: z.string(),
|
|
54
|
+
super_seeding: z.boolean(),
|
|
55
|
+
force_start: z.boolean(),
|
|
56
|
+
save_path: z.string(),
|
|
57
|
+
download_path: z.string(),
|
|
58
|
+
content_path: z.string(),
|
|
59
|
+
added_on: z.number(),
|
|
60
|
+
completion_on: z.number(),
|
|
61
|
+
tracker: z.string(),
|
|
62
|
+
trackers_count: z.number(),
|
|
63
|
+
dl_limit: z.number(),
|
|
64
|
+
up_limit: z.number(),
|
|
65
|
+
downloaded: z.number(),
|
|
66
|
+
uploaded: z.number(),
|
|
67
|
+
downloaded_session: z.number(),
|
|
68
|
+
uploaded_session: z.number(),
|
|
69
|
+
amount_left: z.number(),
|
|
70
|
+
completed: z.number(),
|
|
71
|
+
max_ratio: z.number(),
|
|
72
|
+
max_seeding_time: z.number(),
|
|
73
|
+
max_inactive_seeding_time: z.number(),
|
|
74
|
+
ratio_limit: z.number(),
|
|
75
|
+
seeding_time_limit: z.number(),
|
|
76
|
+
inactive_seeding_time_limit: z.number(),
|
|
77
|
+
seen_complete: z.number(),
|
|
78
|
+
last_activity: z.number(),
|
|
79
|
+
auto_tmm: z.boolean(),
|
|
80
|
+
time_active: z.number(),
|
|
81
|
+
seeding_time: z.number(),
|
|
82
|
+
availability: z.number(),
|
|
83
|
+
reannounce: z.number(),
|
|
84
|
+
comment: z.string(),
|
|
85
|
+
popularity: z.number()
|
|
86
|
+
}).passthrough();
|
|
87
|
+
const TorrentInfoParamsSchema = z.object({
|
|
88
|
+
filter: z.enum([
|
|
89
|
+
"all",
|
|
90
|
+
"downloading",
|
|
91
|
+
"seeding",
|
|
92
|
+
"completed",
|
|
93
|
+
"stopped",
|
|
94
|
+
"active",
|
|
95
|
+
"inactive",
|
|
96
|
+
"running",
|
|
97
|
+
"stalled",
|
|
98
|
+
"stalled_uploading",
|
|
99
|
+
"stalled_downloading",
|
|
100
|
+
"errored"
|
|
101
|
+
]).optional(),
|
|
102
|
+
category: z.string().optional(),
|
|
103
|
+
tag: z.string().optional(),
|
|
104
|
+
sort: z.string().optional(),
|
|
105
|
+
reverse: z.boolean().optional(),
|
|
106
|
+
limit: z.number().optional(),
|
|
107
|
+
offset: z.number().optional(),
|
|
108
|
+
hashes: z.string().optional()
|
|
109
|
+
});
|
|
110
|
+
const TorrentPropertiesSchema = z.object({
|
|
111
|
+
addition_date: z.number(),
|
|
112
|
+
comment: z.string(),
|
|
113
|
+
completion_date: z.number(),
|
|
114
|
+
created_by: z.string(),
|
|
115
|
+
creation_date: z.number(),
|
|
116
|
+
dl_limit: z.number(),
|
|
117
|
+
dl_speed: z.number(),
|
|
118
|
+
dl_speed_avg: z.number(),
|
|
119
|
+
eta: z.number(),
|
|
120
|
+
isPrivate: z.boolean().optional(),
|
|
121
|
+
last_seen: z.number(),
|
|
122
|
+
nb_connections: z.number(),
|
|
123
|
+
nb_connections_limit: z.number(),
|
|
124
|
+
peers: z.number(),
|
|
125
|
+
peers_total: z.number(),
|
|
126
|
+
piece_size: z.number(),
|
|
127
|
+
pieces_have: z.number(),
|
|
128
|
+
pieces_num: z.number(),
|
|
129
|
+
reannounce: z.number(),
|
|
130
|
+
save_path: z.string(),
|
|
131
|
+
seeding_time: z.number(),
|
|
132
|
+
seeds: z.number(),
|
|
133
|
+
seeds_total: z.number(),
|
|
134
|
+
share_ratio: z.number(),
|
|
135
|
+
time_elapsed: z.number(),
|
|
136
|
+
total_downloaded: z.number(),
|
|
137
|
+
total_downloaded_session: z.number(),
|
|
138
|
+
total_size: z.number(),
|
|
139
|
+
total_uploaded: z.number(),
|
|
140
|
+
total_uploaded_session: z.number(),
|
|
141
|
+
total_wasted: z.number(),
|
|
142
|
+
up_limit: z.number(),
|
|
143
|
+
up_speed: z.number(),
|
|
144
|
+
up_speed_avg: z.number()
|
|
145
|
+
}).passthrough();
|
|
146
|
+
const TorrentFileSchema = z.object({
|
|
147
|
+
index: z.number(),
|
|
148
|
+
name: z.string(),
|
|
149
|
+
size: z.number(),
|
|
150
|
+
progress: z.number(),
|
|
151
|
+
priority: z.number(),
|
|
152
|
+
is_seed: z.boolean(),
|
|
153
|
+
piece_range: z.array(z.number()),
|
|
154
|
+
availability: z.number()
|
|
155
|
+
}).passthrough();
|
|
156
|
+
const TorrentTrackerSchema = z.object({
|
|
157
|
+
url: z.string(),
|
|
158
|
+
status: z.number(),
|
|
159
|
+
tier: z.number(),
|
|
160
|
+
num_peers: z.number(),
|
|
161
|
+
num_seeds: z.number(),
|
|
162
|
+
num_leeches: z.number(),
|
|
163
|
+
num_downloaded: z.number(),
|
|
164
|
+
msg: z.string()
|
|
165
|
+
}).passthrough();
|
|
166
|
+
const TorrentPeerSchema = z.object({
|
|
167
|
+
ip: z.string(),
|
|
168
|
+
port: z.number(),
|
|
169
|
+
client: z.string(),
|
|
170
|
+
peer_id_client: z.string(),
|
|
171
|
+
progress: z.number(),
|
|
172
|
+
dl_speed: z.number(),
|
|
173
|
+
up_speed: z.number(),
|
|
174
|
+
downloaded: z.number(),
|
|
175
|
+
uploaded: z.number(),
|
|
176
|
+
connection: z.string(),
|
|
177
|
+
flags: z.string(),
|
|
178
|
+
flags_desc: z.string(),
|
|
179
|
+
country: z.string(),
|
|
180
|
+
country_code: z.string(),
|
|
181
|
+
relevance: z.number(),
|
|
182
|
+
files: z.string()
|
|
183
|
+
}).passthrough();
|
|
184
|
+
const TorrentPeersResponseSchema = z.object({
|
|
185
|
+
rid: z.number(),
|
|
186
|
+
peers: z.record(z.string(), TorrentPeerSchema),
|
|
187
|
+
peers_removed: z.array(z.string()).optional(),
|
|
188
|
+
full_update: z.boolean().optional()
|
|
189
|
+
}).passthrough();
|
|
190
|
+
const TransferInfoSchema = z.object({
|
|
191
|
+
dl_info_speed: z.number(),
|
|
192
|
+
dl_info_data: z.number(),
|
|
193
|
+
up_info_speed: z.number(),
|
|
194
|
+
up_info_data: z.number(),
|
|
195
|
+
dl_rate_limit: z.number(),
|
|
196
|
+
up_rate_limit: z.number(),
|
|
197
|
+
dht_nodes: z.number(),
|
|
198
|
+
connection_status: z.string()
|
|
199
|
+
}).passthrough();
|
|
200
|
+
const PreferencesSchema = z.object({
|
|
201
|
+
save_path: z.string(),
|
|
202
|
+
temp_path_enabled: z.boolean(),
|
|
203
|
+
temp_path: z.string(),
|
|
204
|
+
start_paused_enabled: z.boolean().optional(),
|
|
205
|
+
preallocate_all: z.boolean(),
|
|
206
|
+
auto_tmm_enabled: z.boolean(),
|
|
207
|
+
dl_limit: z.number(),
|
|
208
|
+
up_limit: z.number(),
|
|
209
|
+
alt_dl_limit: z.number(),
|
|
210
|
+
alt_up_limit: z.number(),
|
|
211
|
+
scheduler_enabled: z.boolean(),
|
|
212
|
+
schedule_from_hour: z.number(),
|
|
213
|
+
schedule_from_min: z.number(),
|
|
214
|
+
schedule_to_hour: z.number(),
|
|
215
|
+
schedule_to_min: z.number(),
|
|
216
|
+
scheduler_days: z.number(),
|
|
217
|
+
listen_port: z.number(),
|
|
218
|
+
upnp: z.boolean(),
|
|
219
|
+
random_port: z.boolean(),
|
|
220
|
+
max_connec: z.number(),
|
|
221
|
+
max_connec_per_torrent: z.number(),
|
|
222
|
+
max_uploads: z.number(),
|
|
223
|
+
max_uploads_per_torrent: z.number(),
|
|
224
|
+
dht: z.boolean(),
|
|
225
|
+
pex: z.boolean(),
|
|
226
|
+
lsd: z.boolean(),
|
|
227
|
+
encryption: z.number(),
|
|
228
|
+
anonymous_mode: z.boolean(),
|
|
229
|
+
max_ratio_enabled: z.boolean(),
|
|
230
|
+
max_ratio: z.number(),
|
|
231
|
+
max_ratio_act: z.number(),
|
|
232
|
+
max_seeding_time_enabled: z.boolean(),
|
|
233
|
+
max_seeding_time: z.number(),
|
|
234
|
+
max_inactive_seeding_time_enabled: z.boolean().optional(),
|
|
235
|
+
max_inactive_seeding_time: z.number().optional(),
|
|
236
|
+
queueing_enabled: z.boolean(),
|
|
237
|
+
max_active_downloads: z.number(),
|
|
238
|
+
max_active_torrents: z.number(),
|
|
239
|
+
max_active_uploads: z.number(),
|
|
240
|
+
dont_count_slow_torrents: z.boolean(),
|
|
241
|
+
slow_torrent_dl_rate_threshold: z.number(),
|
|
242
|
+
slow_torrent_ul_rate_threshold: z.number(),
|
|
243
|
+
slow_torrent_inactive_timer: z.number(),
|
|
244
|
+
web_ui_port: z.number()
|
|
245
|
+
}).passthrough();
|
|
246
|
+
const TorrentFileInputBlobSchema = z.custom((value) => typeof Blob !== "undefined" && value instanceof Blob, "Expected Blob");
|
|
247
|
+
const TorrentFileInputObjectSchema = z.object({
|
|
248
|
+
uri: z.string(),
|
|
249
|
+
type: z.string(),
|
|
250
|
+
name: z.string()
|
|
251
|
+
});
|
|
252
|
+
const TorrentFileInputSchema = z.union([TorrentFileInputBlobSchema, TorrentFileInputObjectSchema]);
|
|
253
|
+
const AddTorrentParamsSchema = z.object({
|
|
254
|
+
urls: z.string().optional(),
|
|
255
|
+
torrents: TorrentFileInputSchema.optional(),
|
|
256
|
+
savepath: z.string().optional(),
|
|
257
|
+
cookie: z.string().optional(),
|
|
258
|
+
category: z.string().optional(),
|
|
259
|
+
tags: z.string().optional(),
|
|
260
|
+
skip_checking: z.boolean().optional(),
|
|
261
|
+
paused: z.boolean().optional(),
|
|
262
|
+
root_folder: z.boolean().optional(),
|
|
263
|
+
rename: z.string().optional(),
|
|
264
|
+
upLimit: z.number().optional(),
|
|
265
|
+
dlLimit: z.number().optional(),
|
|
266
|
+
ratioLimit: z.number().optional(),
|
|
267
|
+
seedingTimeLimit: z.number().optional(),
|
|
268
|
+
autoTMM: z.boolean().optional(),
|
|
269
|
+
sequentialDownload: z.boolean().optional(),
|
|
270
|
+
firstLastPiecePrio: z.boolean().optional()
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
//#endregion
|
|
274
|
+
export { AddTorrentParamsSchema, PreferencesSchema, QBittorrentConfigSchema, TorrentFileInputSchema, TorrentFileSchema, TorrentInfoParamsSchema, TorrentInfoSchema, TorrentPeerSchema, TorrentPeersResponseSchema, TorrentPropertiesSchema, TorrentStateSchema, TorrentTrackerSchema, TransferInfoSchema };
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@remote-app/qbittorrent-client",
|
|
3
|
+
"version": "0.22.0",
|
|
4
|
+
"description": "qBittorrent WebUI API client",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"qbittorrent",
|
|
7
|
+
"webui",
|
|
8
|
+
"api",
|
|
9
|
+
"client"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/jgalat/remote-app.git",
|
|
15
|
+
"directory": "packages/qbittorrent-client"
|
|
16
|
+
},
|
|
17
|
+
"main": "dist/index.cjs",
|
|
18
|
+
"module": "dist/index.mjs",
|
|
19
|
+
"types": "dist/index.d.mts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"react-native": "./src/index.ts",
|
|
23
|
+
"import": {
|
|
24
|
+
"types": "./dist/index.d.mts",
|
|
25
|
+
"default": "./dist/index.mjs"
|
|
26
|
+
},
|
|
27
|
+
"require": {
|
|
28
|
+
"types": "./dist/index.d.cts",
|
|
29
|
+
"default": "./dist/index.cjs"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"./schemas": {
|
|
33
|
+
"react-native": "./src/schemas.ts",
|
|
34
|
+
"import": {
|
|
35
|
+
"types": "./dist/schemas.d.mts",
|
|
36
|
+
"default": "./dist/schemas.mjs"
|
|
37
|
+
},
|
|
38
|
+
"require": {
|
|
39
|
+
"types": "./dist/schemas.d.cts",
|
|
40
|
+
"default": "./dist/schemas.cjs"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"react-native": "src/index.ts",
|
|
45
|
+
"files": [
|
|
46
|
+
"dist"
|
|
47
|
+
],
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "tsdown",
|
|
50
|
+
"test": "vitest run"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"zod": "^3.25.76"
|
|
54
|
+
}
|
|
55
|
+
}
|