appwrite-cli 4.1.0 → 4.2.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.
- package/LICENSE.md +1 -1
- package/README.md +3 -3
- package/docs/examples/health/get-queue-builds.md +2 -0
- package/docs/examples/health/get-queue-certificates.md +2 -1
- package/docs/examples/health/get-queue-databases.md +3 -0
- package/docs/examples/health/get-queue-deletes.md +2 -0
- package/docs/examples/health/get-queue-functions.md +2 -1
- package/docs/examples/health/get-queue-logs.md +2 -1
- package/docs/examples/health/get-queue-mails.md +2 -0
- package/docs/examples/health/get-queue-messaging.md +2 -0
- package/docs/examples/health/get-queue-migrations.md +2 -0
- package/docs/examples/health/get-queue-webhooks.md +2 -1
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/client.js +61 -74
- package/lib/commands/account.js +564 -210
- package/lib/commands/assistant.js +42 -7
- package/lib/commands/avatars.js +199 -83
- package/lib/commands/console.js +42 -3
- package/lib/commands/databases.js +991 -562
- package/lib/commands/deploy.js +170 -99
- package/lib/commands/functions.js +564 -294
- package/lib/commands/graphql.js +58 -11
- package/lib/commands/health.js +496 -26
- package/lib/commands/init.js +11 -23
- package/lib/commands/locale.js +154 -17
- package/lib/commands/migrations.js +328 -147
- package/lib/commands/project.js +128 -33
- package/lib/commands/projects.js +788 -411
- package/lib/commands/proxy.js +113 -28
- package/lib/commands/storage.js +438 -223
- package/lib/commands/teams.js +284 -108
- package/lib/commands/users.js +559 -271
- package/lib/commands/vcs.js +186 -53
- package/lib/paginate.js +51 -0
- package/lib/questions.js +7 -10
- package/package.json +9 -9
- package/scoop/appwrite.json +3 -3
package/lib/commands/health.js
CHANGED
|
@@ -9,212 +9,635 @@ const { Command } = require('commander');
|
|
|
9
9
|
const { sdkForProject, sdkForConsole } = require('../sdks')
|
|
10
10
|
const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
|
|
11
11
|
const { localConfig, globalConfig } = require("../config");
|
|
12
|
+
const { File } = require('undici');
|
|
13
|
+
const { ReadableStream } = require('stream/web');
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {fs.ReadStream} readStream
|
|
17
|
+
* @returns {ReadableStream}
|
|
18
|
+
*/
|
|
19
|
+
function convertReadStreamToReadableStream(readStream) {
|
|
20
|
+
return new ReadableStream({
|
|
21
|
+
start(controller) {
|
|
22
|
+
readStream.on("data", (chunk) => {
|
|
23
|
+
controller.enqueue(chunk);
|
|
24
|
+
});
|
|
25
|
+
readStream.on("end", () => {
|
|
26
|
+
controller.close();
|
|
27
|
+
});
|
|
28
|
+
readStream.on("error", (err) => {
|
|
29
|
+
controller.error(err);
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
cancel() {
|
|
33
|
+
readStream.destroy();
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}
|
|
12
37
|
|
|
13
38
|
const health = new Command("health").description(commandDescriptions['health']).configureHelp({
|
|
14
39
|
helpWidth: process.stdout.columns || 80
|
|
15
40
|
})
|
|
16
41
|
|
|
17
|
-
|
|
42
|
+
/**
|
|
43
|
+
* @typedef {Object} HealthGetRequestParams
|
|
44
|
+
* @property {boolean} parseOutput
|
|
45
|
+
* @property {libClient | undefined} sdk
|
|
46
|
+
*/
|
|
18
47
|
|
|
48
|
+
/**
|
|
49
|
+
* @param {HealthGetRequestParams} params
|
|
50
|
+
*/
|
|
51
|
+
const healthGet = async ({ parseOutput = true, sdk = undefined}) => {
|
|
19
52
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
53
|
+
|
|
20
54
|
let apiPath = '/health';
|
|
21
55
|
let payload = {};
|
|
56
|
+
|
|
57
|
+
|
|
22
58
|
let response = undefined;
|
|
59
|
+
|
|
23
60
|
response = await client.call('get', apiPath, {
|
|
24
61
|
'content-type': 'application/json',
|
|
25
62
|
}, payload);
|
|
63
|
+
|
|
26
64
|
|
|
27
65
|
if (parseOutput) {
|
|
28
66
|
parse(response)
|
|
29
67
|
success()
|
|
30
68
|
}
|
|
69
|
+
|
|
31
70
|
return response;
|
|
32
71
|
}
|
|
33
72
|
|
|
34
|
-
|
|
73
|
+
/**
|
|
74
|
+
* @typedef {Object} HealthGetAntivirusRequestParams
|
|
75
|
+
* @property {boolean} parseOutput
|
|
76
|
+
* @property {libClient | undefined} sdk
|
|
77
|
+
*/
|
|
35
78
|
|
|
79
|
+
/**
|
|
80
|
+
* @param {HealthGetAntivirusRequestParams} params
|
|
81
|
+
*/
|
|
82
|
+
const healthGetAntivirus = async ({ parseOutput = true, sdk = undefined}) => {
|
|
36
83
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
84
|
+
|
|
37
85
|
let apiPath = '/health/anti-virus';
|
|
38
86
|
let payload = {};
|
|
87
|
+
|
|
88
|
+
|
|
39
89
|
let response = undefined;
|
|
90
|
+
|
|
40
91
|
response = await client.call('get', apiPath, {
|
|
41
92
|
'content-type': 'application/json',
|
|
42
93
|
}, payload);
|
|
94
|
+
|
|
43
95
|
|
|
44
96
|
if (parseOutput) {
|
|
45
97
|
parse(response)
|
|
46
98
|
success()
|
|
47
99
|
}
|
|
100
|
+
|
|
48
101
|
return response;
|
|
49
102
|
}
|
|
50
103
|
|
|
51
|
-
|
|
104
|
+
/**
|
|
105
|
+
* @typedef {Object} HealthGetCacheRequestParams
|
|
106
|
+
* @property {boolean} parseOutput
|
|
107
|
+
* @property {libClient | undefined} sdk
|
|
108
|
+
*/
|
|
52
109
|
|
|
110
|
+
/**
|
|
111
|
+
* @param {HealthGetCacheRequestParams} params
|
|
112
|
+
*/
|
|
113
|
+
const healthGetCache = async ({ parseOutput = true, sdk = undefined}) => {
|
|
53
114
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
115
|
+
|
|
54
116
|
let apiPath = '/health/cache';
|
|
55
117
|
let payload = {};
|
|
118
|
+
|
|
119
|
+
|
|
56
120
|
let response = undefined;
|
|
121
|
+
|
|
57
122
|
response = await client.call('get', apiPath, {
|
|
58
123
|
'content-type': 'application/json',
|
|
59
124
|
}, payload);
|
|
125
|
+
|
|
60
126
|
|
|
61
127
|
if (parseOutput) {
|
|
62
128
|
parse(response)
|
|
63
129
|
success()
|
|
64
130
|
}
|
|
131
|
+
|
|
65
132
|
return response;
|
|
66
133
|
}
|
|
67
134
|
|
|
68
|
-
|
|
135
|
+
/**
|
|
136
|
+
* @typedef {Object} HealthGetDBRequestParams
|
|
137
|
+
* @property {boolean} parseOutput
|
|
138
|
+
* @property {libClient | undefined} sdk
|
|
139
|
+
*/
|
|
69
140
|
|
|
141
|
+
/**
|
|
142
|
+
* @param {HealthGetDBRequestParams} params
|
|
143
|
+
*/
|
|
144
|
+
const healthGetDB = async ({ parseOutput = true, sdk = undefined}) => {
|
|
70
145
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
146
|
+
|
|
71
147
|
let apiPath = '/health/db';
|
|
72
148
|
let payload = {};
|
|
149
|
+
|
|
150
|
+
|
|
73
151
|
let response = undefined;
|
|
152
|
+
|
|
74
153
|
response = await client.call('get', apiPath, {
|
|
75
154
|
'content-type': 'application/json',
|
|
76
155
|
}, payload);
|
|
156
|
+
|
|
77
157
|
|
|
78
158
|
if (parseOutput) {
|
|
79
159
|
parse(response)
|
|
80
160
|
success()
|
|
81
161
|
}
|
|
162
|
+
|
|
82
163
|
return response;
|
|
83
164
|
}
|
|
84
165
|
|
|
85
|
-
|
|
166
|
+
/**
|
|
167
|
+
* @typedef {Object} HealthGetPubSubRequestParams
|
|
168
|
+
* @property {boolean} parseOutput
|
|
169
|
+
* @property {libClient | undefined} sdk
|
|
170
|
+
*/
|
|
86
171
|
|
|
172
|
+
/**
|
|
173
|
+
* @param {HealthGetPubSubRequestParams} params
|
|
174
|
+
*/
|
|
175
|
+
const healthGetPubSub = async ({ parseOutput = true, sdk = undefined}) => {
|
|
87
176
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
177
|
+
|
|
88
178
|
let apiPath = '/health/pubsub';
|
|
89
179
|
let payload = {};
|
|
180
|
+
|
|
181
|
+
|
|
90
182
|
let response = undefined;
|
|
183
|
+
|
|
91
184
|
response = await client.call('get', apiPath, {
|
|
92
185
|
'content-type': 'application/json',
|
|
93
186
|
}, payload);
|
|
187
|
+
|
|
94
188
|
|
|
95
189
|
if (parseOutput) {
|
|
96
190
|
parse(response)
|
|
97
191
|
success()
|
|
98
192
|
}
|
|
193
|
+
|
|
99
194
|
return response;
|
|
100
195
|
}
|
|
101
196
|
|
|
102
|
-
|
|
197
|
+
/**
|
|
198
|
+
* @typedef {Object} HealthGetQueueRequestParams
|
|
199
|
+
* @property {boolean} parseOutput
|
|
200
|
+
* @property {libClient | undefined} sdk
|
|
201
|
+
*/
|
|
103
202
|
|
|
203
|
+
/**
|
|
204
|
+
* @param {HealthGetQueueRequestParams} params
|
|
205
|
+
*/
|
|
206
|
+
const healthGetQueue = async ({ parseOutput = true, sdk = undefined}) => {
|
|
104
207
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
208
|
+
|
|
105
209
|
let apiPath = '/health/queue';
|
|
106
210
|
let payload = {};
|
|
211
|
+
|
|
212
|
+
|
|
107
213
|
let response = undefined;
|
|
214
|
+
|
|
108
215
|
response = await client.call('get', apiPath, {
|
|
109
216
|
'content-type': 'application/json',
|
|
110
217
|
}, payload);
|
|
218
|
+
|
|
111
219
|
|
|
112
220
|
if (parseOutput) {
|
|
113
221
|
parse(response)
|
|
114
222
|
success()
|
|
115
223
|
}
|
|
224
|
+
|
|
116
225
|
return response;
|
|
117
226
|
}
|
|
118
227
|
|
|
119
|
-
|
|
228
|
+
/**
|
|
229
|
+
* @typedef {Object} HealthGetQueueBuildsRequestParams
|
|
230
|
+
* @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
|
|
231
|
+
* @property {boolean} parseOutput
|
|
232
|
+
* @property {libClient | undefined} sdk
|
|
233
|
+
*/
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* @param {HealthGetQueueBuildsRequestParams} params
|
|
237
|
+
*/
|
|
238
|
+
const healthGetQueueBuilds = async ({ threshold, parseOutput = true, sdk = undefined}) => {
|
|
239
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
240
|
+
|
|
241
|
+
let apiPath = '/health/queue/builds';
|
|
242
|
+
let payload = {};
|
|
243
|
+
if (typeof threshold !== 'undefined') {
|
|
244
|
+
payload['threshold'] = threshold;
|
|
245
|
+
}
|
|
246
|
+
|
|
120
247
|
|
|
248
|
+
let response = undefined;
|
|
249
|
+
|
|
250
|
+
response = await client.call('get', apiPath, {
|
|
251
|
+
'content-type': 'application/json',
|
|
252
|
+
}, payload);
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
if (parseOutput) {
|
|
256
|
+
parse(response)
|
|
257
|
+
success()
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
return response;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* @typedef {Object} HealthGetQueueCertificatesRequestParams
|
|
265
|
+
* @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
|
|
266
|
+
* @property {boolean} parseOutput
|
|
267
|
+
* @property {libClient | undefined} sdk
|
|
268
|
+
*/
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* @param {HealthGetQueueCertificatesRequestParams} params
|
|
272
|
+
*/
|
|
273
|
+
const healthGetQueueCertificates = async ({ threshold, parseOutput = true, sdk = undefined}) => {
|
|
121
274
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
275
|
+
|
|
122
276
|
let apiPath = '/health/queue/certificates';
|
|
123
277
|
let payload = {};
|
|
278
|
+
if (typeof threshold !== 'undefined') {
|
|
279
|
+
payload['threshold'] = threshold;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
|
|
124
283
|
let response = undefined;
|
|
284
|
+
|
|
125
285
|
response = await client.call('get', apiPath, {
|
|
126
286
|
'content-type': 'application/json',
|
|
127
287
|
}, payload);
|
|
288
|
+
|
|
128
289
|
|
|
129
290
|
if (parseOutput) {
|
|
130
291
|
parse(response)
|
|
131
292
|
success()
|
|
132
293
|
}
|
|
294
|
+
|
|
133
295
|
return response;
|
|
134
296
|
}
|
|
135
297
|
|
|
136
|
-
|
|
298
|
+
/**
|
|
299
|
+
* @typedef {Object} HealthGetQueueDatabasesRequestParams
|
|
300
|
+
* @property {string} name Queue name for which to check the queue size
|
|
301
|
+
* @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
|
|
302
|
+
* @property {boolean} parseOutput
|
|
303
|
+
* @property {libClient | undefined} sdk
|
|
304
|
+
*/
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* @param {HealthGetQueueDatabasesRequestParams} params
|
|
308
|
+
*/
|
|
309
|
+
const healthGetQueueDatabases = async ({ name, threshold, parseOutput = true, sdk = undefined}) => {
|
|
310
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
311
|
+
|
|
312
|
+
let apiPath = '/health/queue/databases';
|
|
313
|
+
let payload = {};
|
|
314
|
+
if (typeof name !== 'undefined') {
|
|
315
|
+
payload['name'] = name;
|
|
316
|
+
}
|
|
317
|
+
if (typeof threshold !== 'undefined') {
|
|
318
|
+
payload['threshold'] = threshold;
|
|
319
|
+
}
|
|
320
|
+
|
|
137
321
|
|
|
322
|
+
let response = undefined;
|
|
323
|
+
|
|
324
|
+
response = await client.call('get', apiPath, {
|
|
325
|
+
'content-type': 'application/json',
|
|
326
|
+
}, payload);
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
if (parseOutput) {
|
|
330
|
+
parse(response)
|
|
331
|
+
success()
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
return response;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* @typedef {Object} HealthGetQueueDeletesRequestParams
|
|
339
|
+
* @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
|
|
340
|
+
* @property {boolean} parseOutput
|
|
341
|
+
* @property {libClient | undefined} sdk
|
|
342
|
+
*/
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* @param {HealthGetQueueDeletesRequestParams} params
|
|
346
|
+
*/
|
|
347
|
+
const healthGetQueueDeletes = async ({ threshold, parseOutput = true, sdk = undefined}) => {
|
|
138
348
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
139
|
-
|
|
349
|
+
|
|
350
|
+
let apiPath = '/health/queue/deletes';
|
|
140
351
|
let payload = {};
|
|
352
|
+
if (typeof threshold !== 'undefined') {
|
|
353
|
+
payload['threshold'] = threshold;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
|
|
141
357
|
let response = undefined;
|
|
358
|
+
|
|
142
359
|
response = await client.call('get', apiPath, {
|
|
143
360
|
'content-type': 'application/json',
|
|
144
361
|
}, payload);
|
|
362
|
+
|
|
145
363
|
|
|
146
364
|
if (parseOutput) {
|
|
147
365
|
parse(response)
|
|
148
366
|
success()
|
|
149
367
|
}
|
|
368
|
+
|
|
150
369
|
return response;
|
|
151
370
|
}
|
|
152
371
|
|
|
153
|
-
|
|
372
|
+
/**
|
|
373
|
+
* @typedef {Object} HealthGetQueueFunctionsRequestParams
|
|
374
|
+
* @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
|
|
375
|
+
* @property {boolean} parseOutput
|
|
376
|
+
* @property {libClient | undefined} sdk
|
|
377
|
+
*/
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* @param {HealthGetQueueFunctionsRequestParams} params
|
|
381
|
+
*/
|
|
382
|
+
const healthGetQueueFunctions = async ({ threshold, parseOutput = true, sdk = undefined}) => {
|
|
383
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
384
|
+
|
|
385
|
+
let apiPath = '/health/queue/functions';
|
|
386
|
+
let payload = {};
|
|
387
|
+
if (typeof threshold !== 'undefined') {
|
|
388
|
+
payload['threshold'] = threshold;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
let response = undefined;
|
|
393
|
+
|
|
394
|
+
response = await client.call('get', apiPath, {
|
|
395
|
+
'content-type': 'application/json',
|
|
396
|
+
}, payload);
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
if (parseOutput) {
|
|
400
|
+
parse(response)
|
|
401
|
+
success()
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
return response;
|
|
405
|
+
}
|
|
154
406
|
|
|
407
|
+
/**
|
|
408
|
+
* @typedef {Object} HealthGetQueueLogsRequestParams
|
|
409
|
+
* @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
|
|
410
|
+
* @property {boolean} parseOutput
|
|
411
|
+
* @property {libClient | undefined} sdk
|
|
412
|
+
*/
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* @param {HealthGetQueueLogsRequestParams} params
|
|
416
|
+
*/
|
|
417
|
+
const healthGetQueueLogs = async ({ threshold, parseOutput = true, sdk = undefined}) => {
|
|
155
418
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
419
|
+
|
|
156
420
|
let apiPath = '/health/queue/logs';
|
|
157
421
|
let payload = {};
|
|
422
|
+
if (typeof threshold !== 'undefined') {
|
|
423
|
+
payload['threshold'] = threshold;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
|
|
158
427
|
let response = undefined;
|
|
428
|
+
|
|
159
429
|
response = await client.call('get', apiPath, {
|
|
160
430
|
'content-type': 'application/json',
|
|
161
431
|
}, payload);
|
|
432
|
+
|
|
162
433
|
|
|
163
434
|
if (parseOutput) {
|
|
164
435
|
parse(response)
|
|
165
436
|
success()
|
|
166
437
|
}
|
|
438
|
+
|
|
167
439
|
return response;
|
|
168
440
|
}
|
|
169
441
|
|
|
170
|
-
|
|
442
|
+
/**
|
|
443
|
+
* @typedef {Object} HealthGetQueueMailsRequestParams
|
|
444
|
+
* @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
|
|
445
|
+
* @property {boolean} parseOutput
|
|
446
|
+
* @property {libClient | undefined} sdk
|
|
447
|
+
*/
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* @param {HealthGetQueueMailsRequestParams} params
|
|
451
|
+
*/
|
|
452
|
+
const healthGetQueueMails = async ({ threshold, parseOutput = true, sdk = undefined}) => {
|
|
453
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
454
|
+
|
|
455
|
+
let apiPath = '/health/queue/mails';
|
|
456
|
+
let payload = {};
|
|
457
|
+
if (typeof threshold !== 'undefined') {
|
|
458
|
+
payload['threshold'] = threshold;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
let response = undefined;
|
|
463
|
+
|
|
464
|
+
response = await client.call('get', apiPath, {
|
|
465
|
+
'content-type': 'application/json',
|
|
466
|
+
}, payload);
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
if (parseOutput) {
|
|
470
|
+
parse(response)
|
|
471
|
+
success()
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
return response;
|
|
475
|
+
}
|
|
171
476
|
|
|
477
|
+
/**
|
|
478
|
+
* @typedef {Object} HealthGetQueueMessagingRequestParams
|
|
479
|
+
* @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
|
|
480
|
+
* @property {boolean} parseOutput
|
|
481
|
+
* @property {libClient | undefined} sdk
|
|
482
|
+
*/
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* @param {HealthGetQueueMessagingRequestParams} params
|
|
486
|
+
*/
|
|
487
|
+
const healthGetQueueMessaging = async ({ threshold, parseOutput = true, sdk = undefined}) => {
|
|
172
488
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
489
|
+
|
|
490
|
+
let apiPath = '/health/queue/messaging';
|
|
491
|
+
let payload = {};
|
|
492
|
+
if (typeof threshold !== 'undefined') {
|
|
493
|
+
payload['threshold'] = threshold;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
let response = undefined;
|
|
498
|
+
|
|
499
|
+
response = await client.call('get', apiPath, {
|
|
500
|
+
'content-type': 'application/json',
|
|
501
|
+
}, payload);
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
if (parseOutput) {
|
|
505
|
+
parse(response)
|
|
506
|
+
success()
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
return response;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* @typedef {Object} HealthGetQueueMigrationsRequestParams
|
|
514
|
+
* @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
|
|
515
|
+
* @property {boolean} parseOutput
|
|
516
|
+
* @property {libClient | undefined} sdk
|
|
517
|
+
*/
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* @param {HealthGetQueueMigrationsRequestParams} params
|
|
521
|
+
*/
|
|
522
|
+
const healthGetQueueMigrations = async ({ threshold, parseOutput = true, sdk = undefined}) => {
|
|
523
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
524
|
+
|
|
525
|
+
let apiPath = '/health/queue/migrations';
|
|
526
|
+
let payload = {};
|
|
527
|
+
if (typeof threshold !== 'undefined') {
|
|
528
|
+
payload['threshold'] = threshold;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
let response = undefined;
|
|
533
|
+
|
|
534
|
+
response = await client.call('get', apiPath, {
|
|
535
|
+
'content-type': 'application/json',
|
|
536
|
+
}, payload);
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
if (parseOutput) {
|
|
540
|
+
parse(response)
|
|
541
|
+
success()
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
return response;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* @typedef {Object} HealthGetQueueWebhooksRequestParams
|
|
549
|
+
* @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
|
|
550
|
+
* @property {boolean} parseOutput
|
|
551
|
+
* @property {libClient | undefined} sdk
|
|
552
|
+
*/
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* @param {HealthGetQueueWebhooksRequestParams} params
|
|
556
|
+
*/
|
|
557
|
+
const healthGetQueueWebhooks = async ({ threshold, parseOutput = true, sdk = undefined}) => {
|
|
558
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
559
|
+
|
|
173
560
|
let apiPath = '/health/queue/webhooks';
|
|
174
561
|
let payload = {};
|
|
562
|
+
if (typeof threshold !== 'undefined') {
|
|
563
|
+
payload['threshold'] = threshold;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
|
|
175
567
|
let response = undefined;
|
|
568
|
+
|
|
176
569
|
response = await client.call('get', apiPath, {
|
|
177
570
|
'content-type': 'application/json',
|
|
178
571
|
}, payload);
|
|
572
|
+
|
|
179
573
|
|
|
180
574
|
if (parseOutput) {
|
|
181
575
|
parse(response)
|
|
182
576
|
success()
|
|
183
577
|
}
|
|
578
|
+
|
|
184
579
|
return response;
|
|
185
580
|
}
|
|
186
581
|
|
|
187
|
-
|
|
582
|
+
/**
|
|
583
|
+
* @typedef {Object} HealthGetStorageLocalRequestParams
|
|
584
|
+
* @property {boolean} parseOutput
|
|
585
|
+
* @property {libClient | undefined} sdk
|
|
586
|
+
*/
|
|
188
587
|
|
|
588
|
+
/**
|
|
589
|
+
* @param {HealthGetStorageLocalRequestParams} params
|
|
590
|
+
*/
|
|
591
|
+
const healthGetStorageLocal = async ({ parseOutput = true, sdk = undefined}) => {
|
|
189
592
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
593
|
+
|
|
190
594
|
let apiPath = '/health/storage/local';
|
|
191
595
|
let payload = {};
|
|
596
|
+
|
|
597
|
+
|
|
192
598
|
let response = undefined;
|
|
599
|
+
|
|
193
600
|
response = await client.call('get', apiPath, {
|
|
194
601
|
'content-type': 'application/json',
|
|
195
602
|
}, payload);
|
|
603
|
+
|
|
196
604
|
|
|
197
605
|
if (parseOutput) {
|
|
198
606
|
parse(response)
|
|
199
607
|
success()
|
|
200
608
|
}
|
|
609
|
+
|
|
201
610
|
return response;
|
|
202
611
|
}
|
|
203
612
|
|
|
204
|
-
|
|
613
|
+
/**
|
|
614
|
+
* @typedef {Object} HealthGetTimeRequestParams
|
|
615
|
+
* @property {boolean} parseOutput
|
|
616
|
+
* @property {libClient | undefined} sdk
|
|
617
|
+
*/
|
|
205
618
|
|
|
619
|
+
/**
|
|
620
|
+
* @param {HealthGetTimeRequestParams} params
|
|
621
|
+
*/
|
|
622
|
+
const healthGetTime = async ({ parseOutput = true, sdk = undefined}) => {
|
|
206
623
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
624
|
+
|
|
207
625
|
let apiPath = '/health/time';
|
|
208
626
|
let payload = {};
|
|
627
|
+
|
|
628
|
+
|
|
209
629
|
let response = undefined;
|
|
630
|
+
|
|
210
631
|
response = await client.call('get', apiPath, {
|
|
211
632
|
'content-type': 'application/json',
|
|
212
633
|
}, payload);
|
|
634
|
+
|
|
213
635
|
|
|
214
636
|
if (parseOutput) {
|
|
215
637
|
parse(response)
|
|
216
638
|
success()
|
|
217
639
|
}
|
|
640
|
+
|
|
218
641
|
return response;
|
|
219
642
|
}
|
|
220
643
|
|
|
@@ -249,24 +672,65 @@ health
|
|
|
249
672
|
.description(`Check the Appwrite queue messaging servers are up and connection is successful.`)
|
|
250
673
|
.action(actionRunner(healthGetQueue))
|
|
251
674
|
|
|
675
|
+
health
|
|
676
|
+
.command(`getQueueBuilds`)
|
|
677
|
+
.description(`Get the number of builds that are waiting to be processed in the Appwrite internal queue server.`)
|
|
678
|
+
.option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
|
|
679
|
+
.action(actionRunner(healthGetQueueBuilds))
|
|
680
|
+
|
|
252
681
|
health
|
|
253
682
|
.command(`getQueueCertificates`)
|
|
254
683
|
.description(`Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server.`)
|
|
684
|
+
.option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
|
|
255
685
|
.action(actionRunner(healthGetQueueCertificates))
|
|
256
686
|
|
|
687
|
+
health
|
|
688
|
+
.command(`getQueueDatabases`)
|
|
689
|
+
.description(`Get the number of database changes that are waiting to be processed in the Appwrite internal queue server.`)
|
|
690
|
+
.option(`--name <name>`, `Queue name for which to check the queue size`)
|
|
691
|
+
.option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
|
|
692
|
+
.action(actionRunner(healthGetQueueDatabases))
|
|
693
|
+
|
|
694
|
+
health
|
|
695
|
+
.command(`getQueueDeletes`)
|
|
696
|
+
.description(`Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server.`)
|
|
697
|
+
.option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
|
|
698
|
+
.action(actionRunner(healthGetQueueDeletes))
|
|
699
|
+
|
|
257
700
|
health
|
|
258
701
|
.command(`getQueueFunctions`)
|
|
259
702
|
.description(``)
|
|
703
|
+
.option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
|
|
260
704
|
.action(actionRunner(healthGetQueueFunctions))
|
|
261
705
|
|
|
262
706
|
health
|
|
263
707
|
.command(`getQueueLogs`)
|
|
264
708
|
.description(`Get the number of logs that are waiting to be processed in the Appwrite internal queue server.`)
|
|
709
|
+
.option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
|
|
265
710
|
.action(actionRunner(healthGetQueueLogs))
|
|
266
711
|
|
|
712
|
+
health
|
|
713
|
+
.command(`getQueueMails`)
|
|
714
|
+
.description(`Get the number of mails that are waiting to be processed in the Appwrite internal queue server.`)
|
|
715
|
+
.option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
|
|
716
|
+
.action(actionRunner(healthGetQueueMails))
|
|
717
|
+
|
|
718
|
+
health
|
|
719
|
+
.command(`getQueueMessaging`)
|
|
720
|
+
.description(`Get the number of messages that are waiting to be processed in the Appwrite internal queue server.`)
|
|
721
|
+
.option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
|
|
722
|
+
.action(actionRunner(healthGetQueueMessaging))
|
|
723
|
+
|
|
724
|
+
health
|
|
725
|
+
.command(`getQueueMigrations`)
|
|
726
|
+
.description(`Get the number of migrations that are waiting to be processed in the Appwrite internal queue server.`)
|
|
727
|
+
.option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
|
|
728
|
+
.action(actionRunner(healthGetQueueMigrations))
|
|
729
|
+
|
|
267
730
|
health
|
|
268
731
|
.command(`getQueueWebhooks`)
|
|
269
732
|
.description(`Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.`)
|
|
733
|
+
.option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
|
|
270
734
|
.action(actionRunner(healthGetQueueWebhooks))
|
|
271
735
|
|
|
272
736
|
health
|
|
@@ -282,16 +746,22 @@ health
|
|
|
282
746
|
|
|
283
747
|
module.exports = {
|
|
284
748
|
health,
|
|
285
|
-
healthGet,
|
|
286
|
-
healthGetAntivirus,
|
|
287
|
-
healthGetCache,
|
|
288
|
-
healthGetDB,
|
|
289
|
-
healthGetPubSub,
|
|
290
|
-
healthGetQueue,
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
749
|
+
healthGet,
|
|
750
|
+
healthGetAntivirus,
|
|
751
|
+
healthGetCache,
|
|
752
|
+
healthGetDB,
|
|
753
|
+
healthGetPubSub,
|
|
754
|
+
healthGetQueue,
|
|
755
|
+
healthGetQueueBuilds,
|
|
756
|
+
healthGetQueueCertificates,
|
|
757
|
+
healthGetQueueDatabases,
|
|
758
|
+
healthGetQueueDeletes,
|
|
759
|
+
healthGetQueueFunctions,
|
|
760
|
+
healthGetQueueLogs,
|
|
761
|
+
healthGetQueueMails,
|
|
762
|
+
healthGetQueueMessaging,
|
|
763
|
+
healthGetQueueMigrations,
|
|
764
|
+
healthGetQueueWebhooks,
|
|
765
|
+
healthGetStorageLocal,
|
|
766
|
+
healthGetTime
|
|
767
|
+
};
|