tsarr 2.9.0 → 2.10.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 +7 -5
- package/dist/cli/commands/bazarr.d.ts +2 -0
- package/dist/cli/commands/bazarr.d.ts.map +1 -1
- package/dist/cli/commands/config.d.ts.map +1 -1
- package/dist/cli/commands/lidarr.d.ts +2 -0
- package/dist/cli/commands/lidarr.d.ts.map +1 -1
- package/dist/cli/commands/radarr.d.ts.map +1 -1
- package/dist/cli/commands/readarr.d.ts +2 -0
- package/dist/cli/commands/readarr.d.ts.map +1 -1
- package/dist/cli/commands/sonarr.d.ts.map +1 -1
- package/dist/cli/index.js +2138 -2405
- package/dist/clients/base.d.ts +136 -0
- package/dist/clients/base.d.ts.map +1 -0
- package/dist/clients/bazarr.d.ts +1 -1
- package/dist/clients/bazarr.d.ts.map +1 -1
- package/dist/clients/bazarr.js +100 -3
- package/dist/clients/lidarr.d.ts +24 -681
- package/dist/clients/lidarr.d.ts.map +1 -1
- package/dist/clients/lidarr.js +323 -196
- package/dist/clients/prowlarr.d.ts +25 -638
- package/dist/clients/prowlarr.d.ts.map +1 -1
- package/dist/clients/prowlarr.js +331 -175
- package/dist/clients/qbittorrent.d.ts +1 -17
- package/dist/clients/qbittorrent.d.ts.map +1 -1
- package/dist/clients/qbittorrent.js +97 -2
- package/dist/clients/radarr.d.ts +4 -657
- package/dist/clients/radarr.d.ts.map +1 -1
- package/dist/clients/radarr.js +323 -164
- package/dist/clients/readarr.d.ts +4 -635
- package/dist/clients/readarr.d.ts.map +1 -1
- package/dist/clients/readarr.js +323 -164
- package/dist/clients/seerr.d.ts +1 -1
- package/dist/clients/seerr.d.ts.map +1 -1
- package/dist/clients/seerr.js +100 -3
- package/dist/clients/sonarr.d.ts +181 -772
- package/dist/clients/sonarr.d.ts.map +1 -1
- package/dist/clients/sonarr.js +346 -157
- package/dist/core/client.d.ts +3 -0
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/fetch.d.ts +23 -0
- package/dist/core/fetch.d.ts.map +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/types.d.ts +7 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/tsarr-2.10.0.tgz +0 -0
- package/package.json +2 -4
- package/dist/tsarr-2.9.0.tgz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sonarr.d.ts","sourceRoot":"","sources":["../../src/clients/sonarr.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sonarr.d.ts","sourceRoot":"","sources":["../../src/clients/sonarr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EACV,wBAAwB,EACxB,oBAAoB,EACpB,0BAA0B,EAC1B,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,6BAA6B,EAC7B,oBAAoB,EACpB,sBAAsB,EACtB,cAAc,EACf,MAAM,+BAA+B,CAAC;AAEvC;;;;;;;;;;;;GAYG;AACH,qBAAa,YAAa,SAAQ,iBAAiB;IACjD,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,CAmEhC;gBAEU,MAAM,EAAE,mBAAmB;IAKjC,eAAe;;;;;;;;;;IAQf,SAAS;;;;;;;;;;IAST,MAAM;;;;;;;;;;IAMZ;;OAEG;IACG,SAAS;;;;;;;;;;IAIf;;OAEG;IACG,aAAa,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;IAI9B;;OAEG;IACG,SAAS,CAAC,MAAM,EAAE,cAAc;;;;;;;;;;IAItC;;OAEG;IACG,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE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,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM;;;;;;;;;;IAU7F;;OAEG;IACG,mBAAmB,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;IAIpC;;OAEG;IACG,wBAAwB,CAAC,GAAG,EAAE,MAAM,EAAE;;;;;;;;;;IAM5C;;OAEG;IACG,gBAAgB,CACpB,IAAI,CAAC,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,MAAM,EAChB,aAAa,CAAC,EAAE,MAAM;;;;;;;;;;IAWxB;;OAEG;IACG,eAAe,CACnB,IAAI,CAAC,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,MAAM,EAChB,aAAa,CAAC,EAAE,MAAM;;;;;;;;;;IAaxB;;OAEG;IACG,gBAAgB,CAAC,KAAK,EAAE,MAAM;;;;;;;;;;IAMpC;;OAEG;IACG,eAAe,CACnB,MAAM,CAAC,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,EACjB,mBAAmB,CAAC,EAAE,OAAO;;;;;;;;;;IAW/B;;OAEG;IACG,mBAAmB,CAAC,KAAK,EAAE,GAAG,EAAE;;;;;;;;;;IAItC;;OAEG;IACG,UAAU,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;CAG5B;AAGD,cAAc,mBAAmB,CAAC"}
|
package/dist/clients/sonarr.js
CHANGED
|
@@ -26,7 +26,95 @@ class ConnectionError extends TsarrError {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
// src/core/fetch.ts
|
|
30
|
+
var DEFAULT_TIMEOUT = 30000;
|
|
31
|
+
var DEFAULT_MAX_RETRIES = 3;
|
|
32
|
+
var DEFAULT_INITIAL_DELAY = 1000;
|
|
33
|
+
var DEFAULT_MAX_DELAY = 1e4;
|
|
34
|
+
var RETRYABLE_STATUS_CODES = new Set([408, 429, 502, 503, 504]);
|
|
35
|
+
function isRetryable(error) {
|
|
36
|
+
if (error instanceof DOMException && error.name === "AbortError") {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
if (error instanceof TypeError) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
function getRetryDelay(attempt, initialDelayMs, maxDelayMs) {
|
|
45
|
+
const delay = initialDelayMs * 2 ** attempt;
|
|
46
|
+
const jitter = delay * 0.2 * Math.random();
|
|
47
|
+
return Math.min(delay + jitter, maxDelayMs);
|
|
48
|
+
}
|
|
49
|
+
function createResilientFetch(options = {}) {
|
|
50
|
+
const timeout = options.timeout ?? DEFAULT_TIMEOUT;
|
|
51
|
+
const maxRetries = options.retry ? options.retry.maxRetries ?? DEFAULT_MAX_RETRIES : 0;
|
|
52
|
+
const initialDelayMs = options.retry?.initialDelayMs ?? DEFAULT_INITIAL_DELAY;
|
|
53
|
+
const maxDelayMs = options.retry?.maxDelayMs ?? DEFAULT_MAX_DELAY;
|
|
54
|
+
const resilientFetch = async (input, init) => {
|
|
55
|
+
let lastError;
|
|
56
|
+
const template = createRequestTemplate(input, init);
|
|
57
|
+
for (let attempt = 0;attempt <= maxRetries; attempt++) {
|
|
58
|
+
const controller = new AbortController;
|
|
59
|
+
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
60
|
+
const callerSignal = init?.signal;
|
|
61
|
+
if (callerSignal?.aborted) {
|
|
62
|
+
clearTimeout(timeoutId);
|
|
63
|
+
throw callerSignal.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
64
|
+
}
|
|
65
|
+
const onCallerAbort = () => controller.abort(callerSignal.reason);
|
|
66
|
+
callerSignal?.addEventListener("abort", onCallerAbort, { once: true });
|
|
67
|
+
try {
|
|
68
|
+
const response = await globalThis.fetch(new Request(template.clone(), { signal: controller.signal }));
|
|
69
|
+
clearTimeout(timeoutId);
|
|
70
|
+
callerSignal?.removeEventListener("abort", onCallerAbort);
|
|
71
|
+
if (RETRYABLE_STATUS_CODES.has(response.status) && attempt < maxRetries) {
|
|
72
|
+
lastError = new ConnectionError(`Request failed with status ${response.status}`);
|
|
73
|
+
const delay = getRetryDelay(attempt, initialDelayMs, maxDelayMs);
|
|
74
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
return response;
|
|
78
|
+
} catch (error) {
|
|
79
|
+
clearTimeout(timeoutId);
|
|
80
|
+
callerSignal?.removeEventListener("abort", onCallerAbort);
|
|
81
|
+
if (callerSignal?.aborted) {
|
|
82
|
+
throw callerSignal.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
83
|
+
}
|
|
84
|
+
if (error instanceof DOMException && error.name === "AbortError") {
|
|
85
|
+
lastError = new ConnectionError(`Request timed out after ${timeout}ms`);
|
|
86
|
+
if (attempt < maxRetries) {
|
|
87
|
+
const delay = getRetryDelay(attempt, initialDelayMs, maxDelayMs);
|
|
88
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
throw lastError;
|
|
92
|
+
}
|
|
93
|
+
if (isRetryable(error) && attempt < maxRetries) {
|
|
94
|
+
lastError = error;
|
|
95
|
+
const delay = getRetryDelay(attempt, initialDelayMs, maxDelayMs);
|
|
96
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
throw lastError;
|
|
103
|
+
};
|
|
104
|
+
return Object.assign(resilientFetch, {
|
|
105
|
+
preconnect: globalThis.fetch.preconnect?.bind(globalThis.fetch)
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function createRequestTemplate(input, init) {
|
|
109
|
+
const { signal: _signal, ...requestInit } = init ?? {};
|
|
110
|
+
if (input instanceof Request) {
|
|
111
|
+
return init ? new Request(input.clone(), requestInit) : input.clone();
|
|
112
|
+
}
|
|
113
|
+
return new Request(input, requestInit);
|
|
114
|
+
}
|
|
115
|
+
|
|
29
116
|
// src/core/client.ts
|
|
117
|
+
var DEFAULT_TIMEOUT_MS = 30000;
|
|
30
118
|
function createServarrClient(config) {
|
|
31
119
|
if (!config.apiKey) {
|
|
32
120
|
throw new ApiKeyError;
|
|
@@ -38,6 +126,11 @@ function createServarrClient(config) {
|
|
|
38
126
|
...config,
|
|
39
127
|
baseUrl: config.baseUrl.replace(/\/$/, "")
|
|
40
128
|
};
|
|
129
|
+
const timeoutMs = validatedConfig.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
130
|
+
const resilientFetch = createResilientFetch({
|
|
131
|
+
timeout: timeoutMs,
|
|
132
|
+
retry: validatedConfig.retry
|
|
133
|
+
});
|
|
41
134
|
return {
|
|
42
135
|
config: validatedConfig,
|
|
43
136
|
getHeaders: () => ({
|
|
@@ -45,10 +138,186 @@ function createServarrClient(config) {
|
|
|
45
138
|
"Content-Type": "application/json",
|
|
46
139
|
...validatedConfig.headers
|
|
47
140
|
}),
|
|
48
|
-
getBaseUrl: () => validatedConfig.baseUrl
|
|
141
|
+
getBaseUrl: () => validatedConfig.baseUrl,
|
|
142
|
+
getTimeout: () => timeoutMs,
|
|
143
|
+
getFetch: () => resilientFetch
|
|
49
144
|
};
|
|
50
145
|
}
|
|
51
146
|
|
|
147
|
+
// src/clients/base.ts
|
|
148
|
+
class ServarrBaseClient {
|
|
149
|
+
clientConfig;
|
|
150
|
+
rawClient;
|
|
151
|
+
constructor(config, rawClient) {
|
|
152
|
+
this.rawClient = rawClient;
|
|
153
|
+
this.clientConfig = createServarrClient(config);
|
|
154
|
+
this.configureRawClient();
|
|
155
|
+
}
|
|
156
|
+
configureRawClient() {
|
|
157
|
+
this.rawClient.setConfig(this.getClientConfig());
|
|
158
|
+
}
|
|
159
|
+
getClientConfig() {
|
|
160
|
+
return {
|
|
161
|
+
baseUrl: this.clientConfig.getBaseUrl(),
|
|
162
|
+
headers: this.clientConfig.getHeaders(),
|
|
163
|
+
fetch: this.clientConfig.getFetch()
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
async getSystemStatus() {
|
|
167
|
+
return this.ops.getSystemStatus();
|
|
168
|
+
}
|
|
169
|
+
async getHealth() {
|
|
170
|
+
return this.ops.getHealth();
|
|
171
|
+
}
|
|
172
|
+
async getTags() {
|
|
173
|
+
return this.ops.getTags();
|
|
174
|
+
}
|
|
175
|
+
async addTag(tag) {
|
|
176
|
+
return this.ops.createTag({ body: tag });
|
|
177
|
+
}
|
|
178
|
+
async getTag(id) {
|
|
179
|
+
return this.ops.getTagById({ path: { id } });
|
|
180
|
+
}
|
|
181
|
+
async updateTag(id, tag) {
|
|
182
|
+
return this.ops.updateTagById({ path: { id: String(id) }, body: tag });
|
|
183
|
+
}
|
|
184
|
+
async deleteTag(id) {
|
|
185
|
+
return this.ops.deleteTagById({ path: { id } });
|
|
186
|
+
}
|
|
187
|
+
async getTagDetails() {
|
|
188
|
+
return this.ops.getTagDetails();
|
|
189
|
+
}
|
|
190
|
+
async getTagDetailById(id) {
|
|
191
|
+
return this.ops.getTagDetailById({ path: { id } });
|
|
192
|
+
}
|
|
193
|
+
async getNotifications() {
|
|
194
|
+
return this.ops.getNotifications();
|
|
195
|
+
}
|
|
196
|
+
async getNotification(id) {
|
|
197
|
+
return this.ops.getNotificationById({ path: { id } });
|
|
198
|
+
}
|
|
199
|
+
async addNotification(notification) {
|
|
200
|
+
return this.ops.createNotification({ body: notification });
|
|
201
|
+
}
|
|
202
|
+
async updateNotification(id, notification) {
|
|
203
|
+
return this.ops.updateNotificationById({ path: { id: String(id) }, body: notification });
|
|
204
|
+
}
|
|
205
|
+
async deleteNotification(id) {
|
|
206
|
+
return this.ops.deleteNotificationById({ path: { id } });
|
|
207
|
+
}
|
|
208
|
+
async getNotificationSchema() {
|
|
209
|
+
return this.ops.getNotificationSchema();
|
|
210
|
+
}
|
|
211
|
+
async testNotification(notification) {
|
|
212
|
+
return this.ops.testNotification({ body: notification });
|
|
213
|
+
}
|
|
214
|
+
async testAllNotifications() {
|
|
215
|
+
return this.ops.testAllNotifications();
|
|
216
|
+
}
|
|
217
|
+
async getDownloadClients() {
|
|
218
|
+
return this.ops.getDownloadClients();
|
|
219
|
+
}
|
|
220
|
+
async getDownloadClient(id) {
|
|
221
|
+
return this.ops.getDownloadClientById({ path: { id } });
|
|
222
|
+
}
|
|
223
|
+
async addDownloadClient(client) {
|
|
224
|
+
return this.ops.createDownloadClient({ body: client });
|
|
225
|
+
}
|
|
226
|
+
async updateDownloadClient(id, client) {
|
|
227
|
+
return this.ops.updateDownloadClientById({ path: { id: String(id) }, body: client });
|
|
228
|
+
}
|
|
229
|
+
async deleteDownloadClient(id) {
|
|
230
|
+
return this.ops.deleteDownloadClientById({ path: { id } });
|
|
231
|
+
}
|
|
232
|
+
async getDownloadClientSchema() {
|
|
233
|
+
return this.ops.getDownloadClientSchema();
|
|
234
|
+
}
|
|
235
|
+
async testDownloadClient(client) {
|
|
236
|
+
return this.ops.testDownloadClient({ body: client });
|
|
237
|
+
}
|
|
238
|
+
async testAllDownloadClients() {
|
|
239
|
+
return this.ops.testAllDownloadClients();
|
|
240
|
+
}
|
|
241
|
+
async getIndexers() {
|
|
242
|
+
return this.ops.getIndexers();
|
|
243
|
+
}
|
|
244
|
+
async getIndexer(id) {
|
|
245
|
+
return this.ops.getIndexerById({ path: { id } });
|
|
246
|
+
}
|
|
247
|
+
async addIndexer(indexer) {
|
|
248
|
+
return this.ops.createIndexer({ body: indexer });
|
|
249
|
+
}
|
|
250
|
+
async updateIndexer(id, indexer) {
|
|
251
|
+
return this.ops.updateIndexerById({ path: { id: String(id) }, body: indexer });
|
|
252
|
+
}
|
|
253
|
+
async deleteIndexer(id) {
|
|
254
|
+
return this.ops.deleteIndexerById({ path: { id } });
|
|
255
|
+
}
|
|
256
|
+
async getIndexerSchema() {
|
|
257
|
+
return this.ops.getIndexerSchema();
|
|
258
|
+
}
|
|
259
|
+
async testIndexer(indexer) {
|
|
260
|
+
return this.ops.testIndexer({ body: indexer });
|
|
261
|
+
}
|
|
262
|
+
async testAllIndexers() {
|
|
263
|
+
return this.ops.testAllIndexers();
|
|
264
|
+
}
|
|
265
|
+
async restartSystem() {
|
|
266
|
+
return this.ops.restartSystem();
|
|
267
|
+
}
|
|
268
|
+
async shutdownSystem() {
|
|
269
|
+
return this.ops.shutdownSystem();
|
|
270
|
+
}
|
|
271
|
+
async getSystemBackups() {
|
|
272
|
+
return this.ops.getBackups();
|
|
273
|
+
}
|
|
274
|
+
async deleteSystemBackup(id) {
|
|
275
|
+
return this.ops.deleteBackup({ path: { id } });
|
|
276
|
+
}
|
|
277
|
+
async restoreSystemBackup(id) {
|
|
278
|
+
return this.ops.restoreBackup({ path: { id } });
|
|
279
|
+
}
|
|
280
|
+
async uploadSystemBackup() {
|
|
281
|
+
return this.ops.uploadBackup();
|
|
282
|
+
}
|
|
283
|
+
async getLogFiles() {
|
|
284
|
+
return this.ops.getLogFiles();
|
|
285
|
+
}
|
|
286
|
+
async getLogFileByName(filename) {
|
|
287
|
+
return this.ops.getLogFileByName({ path: { filename } });
|
|
288
|
+
}
|
|
289
|
+
async runCommand(command) {
|
|
290
|
+
return this.ops.runCommand({ body: command });
|
|
291
|
+
}
|
|
292
|
+
async getCommands() {
|
|
293
|
+
return this.ops.getCommands();
|
|
294
|
+
}
|
|
295
|
+
async getHostConfig() {
|
|
296
|
+
return this.ops.getHostConfig();
|
|
297
|
+
}
|
|
298
|
+
async getHostConfigById(id) {
|
|
299
|
+
return this.ops.getHostConfigById({ path: { id } });
|
|
300
|
+
}
|
|
301
|
+
async updateHostConfig(id, config) {
|
|
302
|
+
return this.ops.updateHostConfig({ path: { id: String(id) }, body: config });
|
|
303
|
+
}
|
|
304
|
+
async getUiConfig() {
|
|
305
|
+
return this.ops.getUiConfig();
|
|
306
|
+
}
|
|
307
|
+
async getUiConfigById(id) {
|
|
308
|
+
return this.ops.getUiConfigById({ path: { id } });
|
|
309
|
+
}
|
|
310
|
+
async updateUiConfig(id, config) {
|
|
311
|
+
return this.ops.updateUiConfig({ path: { id: String(id) }, body: config });
|
|
312
|
+
}
|
|
313
|
+
updateConfig(newConfig) {
|
|
314
|
+
const updatedConfig = { ...this.clientConfig.config, ...newConfig };
|
|
315
|
+
this.clientConfig = createServarrClient(updatedConfig);
|
|
316
|
+
this.configureRawClient();
|
|
317
|
+
return this.clientConfig.config;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
52
321
|
// src/generated/sonarr/core/bodySerializer.gen.ts
|
|
53
322
|
var jsonBodySerializer = {
|
|
54
323
|
bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
|
|
@@ -1536,6 +1805,24 @@ var getApiV3Log = (options) => (options?.client ?? client).get({
|
|
|
1536
1805
|
url: "/api/v3/log",
|
|
1537
1806
|
...options
|
|
1538
1807
|
});
|
|
1808
|
+
var getApiV3LogFile = (options) => (options?.client ?? client).get({
|
|
1809
|
+
security: [{ name: "X-Api-Key", type: "apiKey" }, {
|
|
1810
|
+
in: "query",
|
|
1811
|
+
name: "apikey",
|
|
1812
|
+
type: "apiKey"
|
|
1813
|
+
}],
|
|
1814
|
+
url: "/api/v3/log/file",
|
|
1815
|
+
...options
|
|
1816
|
+
});
|
|
1817
|
+
var getApiV3LogFileByFilename = (options) => (options.client ?? client).get({
|
|
1818
|
+
security: [{ name: "X-Api-Key", type: "apiKey" }, {
|
|
1819
|
+
in: "query",
|
|
1820
|
+
name: "apikey",
|
|
1821
|
+
type: "apiKey"
|
|
1822
|
+
}],
|
|
1823
|
+
url: "/api/v3/log/file/{filename}",
|
|
1824
|
+
...options
|
|
1825
|
+
});
|
|
1539
1826
|
var getApiV3Manualimport = (options) => (options?.client ?? client).get({
|
|
1540
1827
|
security: [{ name: "X-Api-Key", type: "apiKey" }, {
|
|
1541
1828
|
in: "query",
|
|
@@ -2096,17 +2383,60 @@ var getApiV3Update = (options) => (options?.client ?? client).get({
|
|
|
2096
2383
|
...options
|
|
2097
2384
|
});
|
|
2098
2385
|
// src/clients/sonarr.ts
|
|
2099
|
-
class SonarrClient {
|
|
2100
|
-
|
|
2386
|
+
class SonarrClient extends ServarrBaseClient {
|
|
2387
|
+
ops = {
|
|
2388
|
+
getSystemStatus: () => Promise.resolve(),
|
|
2389
|
+
getHealth: () => Promise.resolve(),
|
|
2390
|
+
getTags: getApiV3Tag,
|
|
2391
|
+
createTag: postApiV3Tag,
|
|
2392
|
+
getTagById: getApiV3TagById,
|
|
2393
|
+
updateTagById: putApiV3TagById,
|
|
2394
|
+
deleteTagById: deleteApiV3TagById,
|
|
2395
|
+
getTagDetails: getApiV3TagDetail,
|
|
2396
|
+
getTagDetailById: getApiV3TagDetailById,
|
|
2397
|
+
getNotifications: getApiV3Notification,
|
|
2398
|
+
createNotification: postApiV3Notification,
|
|
2399
|
+
getNotificationById: getApiV3NotificationById,
|
|
2400
|
+
updateNotificationById: putApiV3NotificationById,
|
|
2401
|
+
deleteNotificationById: deleteApiV3NotificationById,
|
|
2402
|
+
getNotificationSchema: getApiV3NotificationSchema,
|
|
2403
|
+
testNotification: postApiV3NotificationTest,
|
|
2404
|
+
testAllNotifications: postApiV3NotificationTestall,
|
|
2405
|
+
getDownloadClients: getApiV3Downloadclient,
|
|
2406
|
+
createDownloadClient: postApiV3Downloadclient,
|
|
2407
|
+
getDownloadClientById: getApiV3DownloadclientById,
|
|
2408
|
+
updateDownloadClientById: putApiV3DownloadclientById,
|
|
2409
|
+
deleteDownloadClientById: deleteApiV3DownloadclientById,
|
|
2410
|
+
getDownloadClientSchema: getApiV3DownloadclientSchema,
|
|
2411
|
+
testDownloadClient: postApiV3DownloadclientTest,
|
|
2412
|
+
testAllDownloadClients: postApiV3DownloadclientTestall,
|
|
2413
|
+
getIndexers: getApiV3Indexer,
|
|
2414
|
+
createIndexer: postApiV3Indexer,
|
|
2415
|
+
getIndexerById: getApiV3IndexerById,
|
|
2416
|
+
updateIndexerById: putApiV3IndexerById,
|
|
2417
|
+
deleteIndexerById: deleteApiV3IndexerById,
|
|
2418
|
+
getIndexerSchema: getApiV3IndexerSchema,
|
|
2419
|
+
testIndexer: postApiV3IndexerTest,
|
|
2420
|
+
testAllIndexers: postApiV3IndexerTestall,
|
|
2421
|
+
restartSystem: postApiV3SystemRestart,
|
|
2422
|
+
shutdownSystem: postApiV3SystemShutdown,
|
|
2423
|
+
getBackups: getApiV3SystemBackup,
|
|
2424
|
+
deleteBackup: deleteApiV3SystemBackupById,
|
|
2425
|
+
restoreBackup: postApiV3SystemBackupRestoreById,
|
|
2426
|
+
uploadBackup: postApiV3SystemBackupRestoreUpload,
|
|
2427
|
+
getLogFiles: getApiV3LogFile,
|
|
2428
|
+
getLogFileByName: getApiV3LogFileByFilename,
|
|
2429
|
+
runCommand: postApiV3Command,
|
|
2430
|
+
getCommands: getApiV3Command,
|
|
2431
|
+
getHostConfig: getApiV3ConfigHost,
|
|
2432
|
+
getHostConfigById: getApiV3ConfigHostById,
|
|
2433
|
+
updateHostConfig: putApiV3ConfigHostById,
|
|
2434
|
+
getUiConfig: getApiV3ConfigUi,
|
|
2435
|
+
getUiConfigById: getApiV3ConfigUiById,
|
|
2436
|
+
updateUiConfig: putApiV3ConfigUiById
|
|
2437
|
+
};
|
|
2101
2438
|
constructor(config) {
|
|
2102
|
-
|
|
2103
|
-
client.setConfig({
|
|
2104
|
-
baseUrl: this.clientConfig.getBaseUrl(),
|
|
2105
|
-
headers: this.clientConfig.getHeaders()
|
|
2106
|
-
});
|
|
2107
|
-
}
|
|
2108
|
-
async getApi() {
|
|
2109
|
-
return getApi();
|
|
2439
|
+
super(config, client);
|
|
2110
2440
|
}
|
|
2111
2441
|
async getSystemStatus() {
|
|
2112
2442
|
return client.get({
|
|
@@ -2122,6 +2452,9 @@ class SonarrClient {
|
|
|
2122
2452
|
baseUrl: this.clientConfig.getBaseUrl()
|
|
2123
2453
|
});
|
|
2124
2454
|
}
|
|
2455
|
+
async getApi() {
|
|
2456
|
+
return getApi();
|
|
2457
|
+
}
|
|
2125
2458
|
async getSeries() {
|
|
2126
2459
|
return getApiV3Series();
|
|
2127
2460
|
}
|
|
@@ -2180,15 +2513,6 @@ class SonarrClient {
|
|
|
2180
2513
|
async getUpdateSetting() {
|
|
2181
2514
|
return getApiV3Update();
|
|
2182
2515
|
}
|
|
2183
|
-
async getHostConfig() {
|
|
2184
|
-
return getApiV3ConfigHost();
|
|
2185
|
-
}
|
|
2186
|
-
async getHostConfigById(id) {
|
|
2187
|
-
return getApiV3ConfigHostById({ path: { id } });
|
|
2188
|
-
}
|
|
2189
|
-
async updateHostConfig(id, config) {
|
|
2190
|
-
return putApiV3ConfigHostById({ path: { id }, body: config });
|
|
2191
|
-
}
|
|
2192
2516
|
async getNamingConfig() {
|
|
2193
2517
|
return getApiV3ConfigNaming();
|
|
2194
2518
|
}
|
|
@@ -2210,57 +2534,9 @@ class SonarrClient {
|
|
|
2210
2534
|
async updateMediaManagementConfig(id, config) {
|
|
2211
2535
|
return putApiV3ConfigMediamanagementById({ path: { id }, body: config });
|
|
2212
2536
|
}
|
|
2213
|
-
async getUiConfig() {
|
|
2214
|
-
return getApiV3ConfigUi();
|
|
2215
|
-
}
|
|
2216
|
-
async getUiConfigById(id) {
|
|
2217
|
-
return getApiV3ConfigUiById({ path: { id } });
|
|
2218
|
-
}
|
|
2219
|
-
async updateUiConfig(id, config) {
|
|
2220
|
-
return putApiV3ConfigUiById({ path: { id }, body: config });
|
|
2221
|
-
}
|
|
2222
|
-
async restartSystem() {
|
|
2223
|
-
return postApiV3SystemRestart();
|
|
2224
|
-
}
|
|
2225
|
-
async shutdownSystem() {
|
|
2226
|
-
return postApiV3SystemShutdown();
|
|
2227
|
-
}
|
|
2228
|
-
async getSystemBackups() {
|
|
2229
|
-
return getApiV3SystemBackup();
|
|
2230
|
-
}
|
|
2231
|
-
async deleteSystemBackup(id) {
|
|
2232
|
-
return deleteApiV3SystemBackupById({ path: { id } });
|
|
2233
|
-
}
|
|
2234
|
-
async restoreSystemBackup(id) {
|
|
2235
|
-
return postApiV3SystemBackupRestoreById({ path: { id } });
|
|
2236
|
-
}
|
|
2237
|
-
async uploadSystemBackup() {
|
|
2238
|
-
return postApiV3SystemBackupRestoreUpload();
|
|
2239
|
-
}
|
|
2240
2537
|
async getDiskSpace() {
|
|
2241
2538
|
return getApiV3Diskspace();
|
|
2242
2539
|
}
|
|
2243
|
-
async getTags() {
|
|
2244
|
-
return getApiV3Tag();
|
|
2245
|
-
}
|
|
2246
|
-
async addTag(tag) {
|
|
2247
|
-
return postApiV3Tag({ body: tag });
|
|
2248
|
-
}
|
|
2249
|
-
async getTag(id) {
|
|
2250
|
-
return getApiV3TagById({ path: { id } });
|
|
2251
|
-
}
|
|
2252
|
-
async updateTag(id, tag) {
|
|
2253
|
-
return putApiV3TagById({ path: { id }, body: tag });
|
|
2254
|
-
}
|
|
2255
|
-
async deleteTag(id) {
|
|
2256
|
-
return deleteApiV3TagById({ path: { id } });
|
|
2257
|
-
}
|
|
2258
|
-
async getTagDetails() {
|
|
2259
|
-
return getApiV3TagDetail();
|
|
2260
|
-
}
|
|
2261
|
-
async getTagDetailById(id) {
|
|
2262
|
-
return getApiV3TagDetailById({ path: { id } });
|
|
2263
|
-
}
|
|
2264
2540
|
async getEpisodes(seriesId, episodeIds) {
|
|
2265
2541
|
const query = {};
|
|
2266
2542
|
if (seriesId !== undefined)
|
|
@@ -2343,60 +2619,12 @@ class SonarrClient {
|
|
|
2343
2619
|
async getCustomFormatSchema() {
|
|
2344
2620
|
return getApiV3CustomformatSchema();
|
|
2345
2621
|
}
|
|
2346
|
-
async getDownloadClients() {
|
|
2347
|
-
return getApiV3Downloadclient();
|
|
2348
|
-
}
|
|
2349
|
-
async getDownloadClient(id) {
|
|
2350
|
-
return getApiV3DownloadclientById({ path: { id } });
|
|
2351
|
-
}
|
|
2352
|
-
async addDownloadClient(client2) {
|
|
2353
|
-
return postApiV3Downloadclient({ body: client2 });
|
|
2354
|
-
}
|
|
2355
|
-
async updateDownloadClient(id, client2) {
|
|
2356
|
-
return putApiV3DownloadclientById({ path: { id }, body: client2 });
|
|
2357
|
-
}
|
|
2358
|
-
async deleteDownloadClient(id) {
|
|
2359
|
-
return deleteApiV3DownloadclientById({ path: { id } });
|
|
2360
|
-
}
|
|
2361
2622
|
async updateDownloadClientsBulk(clients) {
|
|
2362
2623
|
return putApiV3DownloadclientBulk({ body: clients });
|
|
2363
2624
|
}
|
|
2364
2625
|
async deleteDownloadClientsBulk(ids) {
|
|
2365
2626
|
return deleteApiV3DownloadclientBulk({ body: { ids } });
|
|
2366
2627
|
}
|
|
2367
|
-
async getDownloadClientSchema() {
|
|
2368
|
-
return getApiV3DownloadclientSchema();
|
|
2369
|
-
}
|
|
2370
|
-
async testDownloadClient(client2) {
|
|
2371
|
-
return postApiV3DownloadclientTest({ body: client2 });
|
|
2372
|
-
}
|
|
2373
|
-
async testAllDownloadClients() {
|
|
2374
|
-
return postApiV3DownloadclientTestall();
|
|
2375
|
-
}
|
|
2376
|
-
async getIndexers() {
|
|
2377
|
-
return getApiV3Indexer();
|
|
2378
|
-
}
|
|
2379
|
-
async getIndexer(id) {
|
|
2380
|
-
return getApiV3IndexerById({ path: { id } });
|
|
2381
|
-
}
|
|
2382
|
-
async addIndexer(indexer) {
|
|
2383
|
-
return postApiV3Indexer({ body: indexer });
|
|
2384
|
-
}
|
|
2385
|
-
async updateIndexer(id, indexer) {
|
|
2386
|
-
return putApiV3IndexerById({ path: { id }, body: indexer });
|
|
2387
|
-
}
|
|
2388
|
-
async deleteIndexer(id) {
|
|
2389
|
-
return deleteApiV3IndexerById({ path: { id } });
|
|
2390
|
-
}
|
|
2391
|
-
async getIndexerSchema() {
|
|
2392
|
-
return getApiV3IndexerSchema();
|
|
2393
|
-
}
|
|
2394
|
-
async testIndexer(indexer) {
|
|
2395
|
-
return postApiV3IndexerTest({ body: indexer });
|
|
2396
|
-
}
|
|
2397
|
-
async testAllIndexers() {
|
|
2398
|
-
return postApiV3IndexerTestall();
|
|
2399
|
-
}
|
|
2400
2628
|
async getImportLists() {
|
|
2401
2629
|
return getApiV3Importlist();
|
|
2402
2630
|
}
|
|
@@ -2421,39 +2649,6 @@ class SonarrClient {
|
|
|
2421
2649
|
async testAllImportLists() {
|
|
2422
2650
|
return postApiV3ImportlistTestall();
|
|
2423
2651
|
}
|
|
2424
|
-
async getNotifications() {
|
|
2425
|
-
return getApiV3Notification();
|
|
2426
|
-
}
|
|
2427
|
-
async getNotification(id) {
|
|
2428
|
-
return getApiV3NotificationById({ path: { id } });
|
|
2429
|
-
}
|
|
2430
|
-
async addNotification(notification) {
|
|
2431
|
-
return postApiV3Notification({ body: notification });
|
|
2432
|
-
}
|
|
2433
|
-
async updateNotification(id, notification) {
|
|
2434
|
-
return putApiV3NotificationById({ path: { id }, body: notification });
|
|
2435
|
-
}
|
|
2436
|
-
async deleteNotification(id) {
|
|
2437
|
-
return deleteApiV3NotificationById({ path: { id } });
|
|
2438
|
-
}
|
|
2439
|
-
async getNotificationSchema() {
|
|
2440
|
-
return getApiV3NotificationSchema();
|
|
2441
|
-
}
|
|
2442
|
-
async testNotification(notification) {
|
|
2443
|
-
return postApiV3NotificationTest({ body: notification });
|
|
2444
|
-
}
|
|
2445
|
-
async testAllNotifications() {
|
|
2446
|
-
return postApiV3NotificationTestall();
|
|
2447
|
-
}
|
|
2448
|
-
async runCommand(command) {
|
|
2449
|
-
return postApiV3Command({ body: command });
|
|
2450
|
-
}
|
|
2451
|
-
async getCommands() {
|
|
2452
|
-
return getApiV3Command();
|
|
2453
|
-
}
|
|
2454
|
-
async getCommand(id) {
|
|
2455
|
-
return getApiV3CommandById({ path: { id } });
|
|
2456
|
-
}
|
|
2457
2652
|
async getHistory(page, pageSize, sortKey, sortDirection, seriesId, downloadId) {
|
|
2458
2653
|
const query = {};
|
|
2459
2654
|
if (page !== undefined)
|
|
@@ -2623,14 +2818,8 @@ class SonarrClient {
|
|
|
2623
2818
|
async processManualImport(files) {
|
|
2624
2819
|
return postApiV3Manualimport({ body: files });
|
|
2625
2820
|
}
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
this.clientConfig = createServarrClient(updatedConfig);
|
|
2629
|
-
client.setConfig({
|
|
2630
|
-
baseUrl: this.clientConfig.getBaseUrl(),
|
|
2631
|
-
headers: this.clientConfig.getHeaders()
|
|
2632
|
-
});
|
|
2633
|
-
return this.clientConfig.config;
|
|
2821
|
+
async getCommand(id) {
|
|
2822
|
+
return getApiV3CommandById({ path: { id } });
|
|
2634
2823
|
}
|
|
2635
2824
|
}
|
|
2636
2825
|
export {
|
package/dist/core/client.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare function createServarrClient(config: ServarrClientConfig): {
|
|
|
4
4
|
baseUrl: string;
|
|
5
5
|
apiKey: string;
|
|
6
6
|
timeout?: number;
|
|
7
|
+
retry?: import("./fetch").RetryOptions;
|
|
7
8
|
headers?: Record<string, string>;
|
|
8
9
|
};
|
|
9
10
|
getHeaders: () => {
|
|
@@ -11,6 +12,8 @@ export declare function createServarrClient(config: ServarrClientConfig): {
|
|
|
11
12
|
'Content-Type': string;
|
|
12
13
|
};
|
|
13
14
|
getBaseUrl: () => string;
|
|
15
|
+
getTimeout: () => number;
|
|
16
|
+
getFetch: () => typeof fetch;
|
|
14
17
|
};
|
|
15
18
|
export declare function validateApiKey(apiKey: string | undefined): string;
|
|
16
19
|
export declare function validateBaseUrl(baseUrl: string | undefined): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/core/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/core/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAInD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB;;;;;;;;;;;;;;;EAgC9D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAKjE;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAmBnE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface RetryOptions {
|
|
2
|
+
/** Maximum number of retry attempts for transient failures (default: 3) */
|
|
3
|
+
maxRetries?: number;
|
|
4
|
+
/** Initial delay in ms before the first retry (default: 1000) */
|
|
5
|
+
initialDelayMs?: number;
|
|
6
|
+
/** Maximum delay in ms between retries (default: 10000) */
|
|
7
|
+
maxDelayMs?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface ResilientFetchOptions {
|
|
10
|
+
/** Request timeout in milliseconds (default: 30000) */
|
|
11
|
+
timeout?: number;
|
|
12
|
+
/** Retry configuration for transient failures. Omit to disable retries. */
|
|
13
|
+
retry?: RetryOptions;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Creates a fetch function with timeout and retry support.
|
|
17
|
+
*
|
|
18
|
+
* - Timeout uses AbortController to cancel requests that exceed the limit.
|
|
19
|
+
* - Retry uses exponential backoff with jitter for transient failures
|
|
20
|
+
* (network errors and 408/429/502/503/504 status codes).
|
|
21
|
+
*/
|
|
22
|
+
export declare function createResilientFetch(options?: ResilientFetchOptions): typeof fetch;
|
|
23
|
+
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/core/fetch.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AA0BD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,qBAA0B,GAAG,OAAO,KAAK,CAgFtF"}
|
package/dist/core/index.d.ts
CHANGED
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|