appwrite-cli 4.2.0 → 4.2.2
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/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/client.js +66 -74
- package/lib/commands/account.js +458 -199
- package/lib/commands/assistant.js +40 -10
- package/lib/commands/avatars.js +171 -71
- package/lib/commands/console.js +40 -6
- package/lib/commands/databases.js +838 -555
- package/lib/commands/functions.js +493 -288
- package/lib/commands/generic.js +0 -1
- package/lib/commands/graphql.js +53 -14
- package/lib/commands/health.js +272 -71
- package/lib/commands/locale.js +131 -20
- package/lib/commands/migrations.js +282 -151
- package/lib/commands/project.js +111 -36
- package/lib/commands/projects.js +670 -415
- package/lib/commands/proxy.js +100 -32
- package/lib/commands/storage.js +374 -204
- package/lib/commands/teams.js +239 -107
- package/lib/commands/users.js +465 -266
- package/lib/commands/vcs.js +161 -57
- package/package.json +9 -9
- package/scoop/appwrite.json +3 -3
package/lib/commands/health.js
CHANGED
|
@@ -9,382 +9,584 @@ 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;
|
|
20
53
|
let apiPath = '/health';
|
|
21
54
|
let payload = {};
|
|
55
|
+
|
|
22
56
|
let response = undefined;
|
|
57
|
+
|
|
23
58
|
response = await client.call('get', apiPath, {
|
|
24
59
|
'content-type': 'application/json',
|
|
25
60
|
}, payload);
|
|
26
|
-
|
|
61
|
+
|
|
27
62
|
if (parseOutput) {
|
|
28
63
|
parse(response)
|
|
29
64
|
success()
|
|
30
65
|
}
|
|
66
|
+
|
|
31
67
|
return response;
|
|
32
68
|
}
|
|
33
69
|
|
|
34
|
-
|
|
70
|
+
/**
|
|
71
|
+
* @typedef {Object} HealthGetAntivirusRequestParams
|
|
72
|
+
* @property {boolean} parseOutput
|
|
73
|
+
* @property {libClient | undefined} sdk
|
|
74
|
+
*/
|
|
35
75
|
|
|
76
|
+
/**
|
|
77
|
+
* @param {HealthGetAntivirusRequestParams} params
|
|
78
|
+
*/
|
|
79
|
+
const healthGetAntivirus = async ({ parseOutput = true, sdk = undefined}) => {
|
|
36
80
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
37
81
|
let apiPath = '/health/anti-virus';
|
|
38
82
|
let payload = {};
|
|
83
|
+
|
|
39
84
|
let response = undefined;
|
|
85
|
+
|
|
40
86
|
response = await client.call('get', apiPath, {
|
|
41
87
|
'content-type': 'application/json',
|
|
42
88
|
}, payload);
|
|
43
|
-
|
|
89
|
+
|
|
44
90
|
if (parseOutput) {
|
|
45
91
|
parse(response)
|
|
46
92
|
success()
|
|
47
93
|
}
|
|
94
|
+
|
|
48
95
|
return response;
|
|
49
96
|
}
|
|
50
97
|
|
|
51
|
-
|
|
98
|
+
/**
|
|
99
|
+
* @typedef {Object} HealthGetCacheRequestParams
|
|
100
|
+
* @property {boolean} parseOutput
|
|
101
|
+
* @property {libClient | undefined} sdk
|
|
102
|
+
*/
|
|
52
103
|
|
|
104
|
+
/**
|
|
105
|
+
* @param {HealthGetCacheRequestParams} params
|
|
106
|
+
*/
|
|
107
|
+
const healthGetCache = async ({ parseOutput = true, sdk = undefined}) => {
|
|
53
108
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
54
109
|
let apiPath = '/health/cache';
|
|
55
110
|
let payload = {};
|
|
111
|
+
|
|
56
112
|
let response = undefined;
|
|
113
|
+
|
|
57
114
|
response = await client.call('get', apiPath, {
|
|
58
115
|
'content-type': 'application/json',
|
|
59
116
|
}, payload);
|
|
60
|
-
|
|
117
|
+
|
|
61
118
|
if (parseOutput) {
|
|
62
119
|
parse(response)
|
|
63
120
|
success()
|
|
64
121
|
}
|
|
122
|
+
|
|
65
123
|
return response;
|
|
66
124
|
}
|
|
67
125
|
|
|
68
|
-
|
|
126
|
+
/**
|
|
127
|
+
* @typedef {Object} HealthGetDBRequestParams
|
|
128
|
+
* @property {boolean} parseOutput
|
|
129
|
+
* @property {libClient | undefined} sdk
|
|
130
|
+
*/
|
|
69
131
|
|
|
132
|
+
/**
|
|
133
|
+
* @param {HealthGetDBRequestParams} params
|
|
134
|
+
*/
|
|
135
|
+
const healthGetDB = async ({ parseOutput = true, sdk = undefined}) => {
|
|
70
136
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
71
137
|
let apiPath = '/health/db';
|
|
72
138
|
let payload = {};
|
|
139
|
+
|
|
73
140
|
let response = undefined;
|
|
141
|
+
|
|
74
142
|
response = await client.call('get', apiPath, {
|
|
75
143
|
'content-type': 'application/json',
|
|
76
144
|
}, payload);
|
|
77
|
-
|
|
145
|
+
|
|
78
146
|
if (parseOutput) {
|
|
79
147
|
parse(response)
|
|
80
148
|
success()
|
|
81
149
|
}
|
|
150
|
+
|
|
82
151
|
return response;
|
|
83
152
|
}
|
|
84
153
|
|
|
85
|
-
|
|
154
|
+
/**
|
|
155
|
+
* @typedef {Object} HealthGetPubSubRequestParams
|
|
156
|
+
* @property {boolean} parseOutput
|
|
157
|
+
* @property {libClient | undefined} sdk
|
|
158
|
+
*/
|
|
86
159
|
|
|
160
|
+
/**
|
|
161
|
+
* @param {HealthGetPubSubRequestParams} params
|
|
162
|
+
*/
|
|
163
|
+
const healthGetPubSub = async ({ parseOutput = true, sdk = undefined}) => {
|
|
87
164
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
88
165
|
let apiPath = '/health/pubsub';
|
|
89
166
|
let payload = {};
|
|
167
|
+
|
|
90
168
|
let response = undefined;
|
|
169
|
+
|
|
91
170
|
response = await client.call('get', apiPath, {
|
|
92
171
|
'content-type': 'application/json',
|
|
93
172
|
}, payload);
|
|
94
|
-
|
|
173
|
+
|
|
95
174
|
if (parseOutput) {
|
|
96
175
|
parse(response)
|
|
97
176
|
success()
|
|
98
177
|
}
|
|
178
|
+
|
|
99
179
|
return response;
|
|
100
180
|
}
|
|
101
181
|
|
|
102
|
-
|
|
182
|
+
/**
|
|
183
|
+
* @typedef {Object} HealthGetQueueRequestParams
|
|
184
|
+
* @property {boolean} parseOutput
|
|
185
|
+
* @property {libClient | undefined} sdk
|
|
186
|
+
*/
|
|
103
187
|
|
|
188
|
+
/**
|
|
189
|
+
* @param {HealthGetQueueRequestParams} params
|
|
190
|
+
*/
|
|
191
|
+
const healthGetQueue = async ({ parseOutput = true, sdk = undefined}) => {
|
|
104
192
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
105
193
|
let apiPath = '/health/queue';
|
|
106
194
|
let payload = {};
|
|
195
|
+
|
|
107
196
|
let response = undefined;
|
|
197
|
+
|
|
108
198
|
response = await client.call('get', apiPath, {
|
|
109
199
|
'content-type': 'application/json',
|
|
110
200
|
}, payload);
|
|
111
|
-
|
|
201
|
+
|
|
112
202
|
if (parseOutput) {
|
|
113
203
|
parse(response)
|
|
114
204
|
success()
|
|
115
205
|
}
|
|
206
|
+
|
|
116
207
|
return response;
|
|
117
208
|
}
|
|
118
209
|
|
|
119
|
-
|
|
120
|
-
|
|
210
|
+
/**
|
|
211
|
+
* @typedef {Object} HealthGetQueueBuildsRequestParams
|
|
212
|
+
* @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
|
|
213
|
+
* @property {boolean} parseOutput
|
|
214
|
+
* @property {libClient | undefined} sdk
|
|
215
|
+
*/
|
|
121
216
|
|
|
217
|
+
/**
|
|
218
|
+
* @param {HealthGetQueueBuildsRequestParams} params
|
|
219
|
+
*/
|
|
220
|
+
const healthGetQueueBuilds = async ({ threshold, parseOutput = true, sdk = undefined}) => {
|
|
122
221
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
123
222
|
let apiPath = '/health/queue/builds';
|
|
124
223
|
let payload = {};
|
|
125
|
-
|
|
126
|
-
/** Query Params */
|
|
127
224
|
if (typeof threshold !== 'undefined') {
|
|
128
225
|
payload['threshold'] = threshold;
|
|
129
226
|
}
|
|
227
|
+
|
|
130
228
|
let response = undefined;
|
|
229
|
+
|
|
131
230
|
response = await client.call('get', apiPath, {
|
|
132
231
|
'content-type': 'application/json',
|
|
133
232
|
}, payload);
|
|
134
|
-
|
|
233
|
+
|
|
135
234
|
if (parseOutput) {
|
|
136
235
|
parse(response)
|
|
137
236
|
success()
|
|
138
237
|
}
|
|
238
|
+
|
|
139
239
|
return response;
|
|
140
240
|
}
|
|
141
241
|
|
|
142
|
-
|
|
143
|
-
|
|
242
|
+
/**
|
|
243
|
+
* @typedef {Object} HealthGetQueueCertificatesRequestParams
|
|
244
|
+
* @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
|
|
245
|
+
* @property {boolean} parseOutput
|
|
246
|
+
* @property {libClient | undefined} sdk
|
|
247
|
+
*/
|
|
144
248
|
|
|
249
|
+
/**
|
|
250
|
+
* @param {HealthGetQueueCertificatesRequestParams} params
|
|
251
|
+
*/
|
|
252
|
+
const healthGetQueueCertificates = async ({ threshold, parseOutput = true, sdk = undefined}) => {
|
|
145
253
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
146
254
|
let apiPath = '/health/queue/certificates';
|
|
147
255
|
let payload = {};
|
|
148
|
-
|
|
149
|
-
/** Query Params */
|
|
150
256
|
if (typeof threshold !== 'undefined') {
|
|
151
257
|
payload['threshold'] = threshold;
|
|
152
258
|
}
|
|
259
|
+
|
|
153
260
|
let response = undefined;
|
|
261
|
+
|
|
154
262
|
response = await client.call('get', apiPath, {
|
|
155
263
|
'content-type': 'application/json',
|
|
156
264
|
}, payload);
|
|
157
|
-
|
|
265
|
+
|
|
158
266
|
if (parseOutput) {
|
|
159
267
|
parse(response)
|
|
160
268
|
success()
|
|
161
269
|
}
|
|
270
|
+
|
|
162
271
|
return response;
|
|
163
272
|
}
|
|
164
273
|
|
|
274
|
+
/**
|
|
275
|
+
* @typedef {Object} HealthGetQueueDatabasesRequestParams
|
|
276
|
+
* @property {string} name Queue name for which to check the queue size
|
|
277
|
+
* @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
|
|
278
|
+
* @property {boolean} parseOutput
|
|
279
|
+
* @property {libClient | undefined} sdk
|
|
280
|
+
*/
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* @param {HealthGetQueueDatabasesRequestParams} params
|
|
284
|
+
*/
|
|
165
285
|
const healthGetQueueDatabases = async ({ name, threshold, parseOutput = true, sdk = undefined}) => {
|
|
166
|
-
/* @param {string} name */
|
|
167
|
-
/* @param {number} threshold */
|
|
168
|
-
|
|
169
286
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
170
287
|
let apiPath = '/health/queue/databases';
|
|
171
288
|
let payload = {};
|
|
172
|
-
|
|
173
|
-
/** Query Params */
|
|
174
289
|
if (typeof name !== 'undefined') {
|
|
175
290
|
payload['name'] = name;
|
|
176
291
|
}
|
|
177
292
|
if (typeof threshold !== 'undefined') {
|
|
178
293
|
payload['threshold'] = threshold;
|
|
179
294
|
}
|
|
295
|
+
|
|
180
296
|
let response = undefined;
|
|
297
|
+
|
|
181
298
|
response = await client.call('get', apiPath, {
|
|
182
299
|
'content-type': 'application/json',
|
|
183
300
|
}, payload);
|
|
184
|
-
|
|
301
|
+
|
|
185
302
|
if (parseOutput) {
|
|
186
303
|
parse(response)
|
|
187
304
|
success()
|
|
188
305
|
}
|
|
306
|
+
|
|
189
307
|
return response;
|
|
190
308
|
}
|
|
191
309
|
|
|
192
|
-
|
|
193
|
-
|
|
310
|
+
/**
|
|
311
|
+
* @typedef {Object} HealthGetQueueDeletesRequestParams
|
|
312
|
+
* @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
|
|
313
|
+
* @property {boolean} parseOutput
|
|
314
|
+
* @property {libClient | undefined} sdk
|
|
315
|
+
*/
|
|
194
316
|
|
|
317
|
+
/**
|
|
318
|
+
* @param {HealthGetQueueDeletesRequestParams} params
|
|
319
|
+
*/
|
|
320
|
+
const healthGetQueueDeletes = async ({ threshold, parseOutput = true, sdk = undefined}) => {
|
|
195
321
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
196
322
|
let apiPath = '/health/queue/deletes';
|
|
197
323
|
let payload = {};
|
|
198
|
-
|
|
199
|
-
/** Query Params */
|
|
200
324
|
if (typeof threshold !== 'undefined') {
|
|
201
325
|
payload['threshold'] = threshold;
|
|
202
326
|
}
|
|
327
|
+
|
|
203
328
|
let response = undefined;
|
|
329
|
+
|
|
204
330
|
response = await client.call('get', apiPath, {
|
|
205
331
|
'content-type': 'application/json',
|
|
206
332
|
}, payload);
|
|
207
|
-
|
|
333
|
+
|
|
208
334
|
if (parseOutput) {
|
|
209
335
|
parse(response)
|
|
210
336
|
success()
|
|
211
337
|
}
|
|
338
|
+
|
|
212
339
|
return response;
|
|
213
340
|
}
|
|
214
341
|
|
|
215
|
-
|
|
216
|
-
|
|
342
|
+
/**
|
|
343
|
+
* @typedef {Object} HealthGetQueueFunctionsRequestParams
|
|
344
|
+
* @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
|
|
345
|
+
* @property {boolean} parseOutput
|
|
346
|
+
* @property {libClient | undefined} sdk
|
|
347
|
+
*/
|
|
217
348
|
|
|
349
|
+
/**
|
|
350
|
+
* @param {HealthGetQueueFunctionsRequestParams} params
|
|
351
|
+
*/
|
|
352
|
+
const healthGetQueueFunctions = async ({ threshold, parseOutput = true, sdk = undefined}) => {
|
|
218
353
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
219
354
|
let apiPath = '/health/queue/functions';
|
|
220
355
|
let payload = {};
|
|
221
|
-
|
|
222
|
-
/** Query Params */
|
|
223
356
|
if (typeof threshold !== 'undefined') {
|
|
224
357
|
payload['threshold'] = threshold;
|
|
225
358
|
}
|
|
359
|
+
|
|
226
360
|
let response = undefined;
|
|
361
|
+
|
|
227
362
|
response = await client.call('get', apiPath, {
|
|
228
363
|
'content-type': 'application/json',
|
|
229
364
|
}, payload);
|
|
230
|
-
|
|
365
|
+
|
|
231
366
|
if (parseOutput) {
|
|
232
367
|
parse(response)
|
|
233
368
|
success()
|
|
234
369
|
}
|
|
370
|
+
|
|
235
371
|
return response;
|
|
236
372
|
}
|
|
237
373
|
|
|
238
|
-
|
|
239
|
-
|
|
374
|
+
/**
|
|
375
|
+
* @typedef {Object} HealthGetQueueLogsRequestParams
|
|
376
|
+
* @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
|
|
377
|
+
* @property {boolean} parseOutput
|
|
378
|
+
* @property {libClient | undefined} sdk
|
|
379
|
+
*/
|
|
240
380
|
|
|
381
|
+
/**
|
|
382
|
+
* @param {HealthGetQueueLogsRequestParams} params
|
|
383
|
+
*/
|
|
384
|
+
const healthGetQueueLogs = async ({ threshold, parseOutput = true, sdk = undefined}) => {
|
|
241
385
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
242
386
|
let apiPath = '/health/queue/logs';
|
|
243
387
|
let payload = {};
|
|
244
|
-
|
|
245
|
-
/** Query Params */
|
|
246
388
|
if (typeof threshold !== 'undefined') {
|
|
247
389
|
payload['threshold'] = threshold;
|
|
248
390
|
}
|
|
391
|
+
|
|
249
392
|
let response = undefined;
|
|
393
|
+
|
|
250
394
|
response = await client.call('get', apiPath, {
|
|
251
395
|
'content-type': 'application/json',
|
|
252
396
|
}, payload);
|
|
253
|
-
|
|
397
|
+
|
|
254
398
|
if (parseOutput) {
|
|
255
399
|
parse(response)
|
|
256
400
|
success()
|
|
257
401
|
}
|
|
402
|
+
|
|
258
403
|
return response;
|
|
259
404
|
}
|
|
260
405
|
|
|
261
|
-
|
|
262
|
-
|
|
406
|
+
/**
|
|
407
|
+
* @typedef {Object} HealthGetQueueMailsRequestParams
|
|
408
|
+
* @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
|
|
409
|
+
* @property {boolean} parseOutput
|
|
410
|
+
* @property {libClient | undefined} sdk
|
|
411
|
+
*/
|
|
263
412
|
|
|
413
|
+
/**
|
|
414
|
+
* @param {HealthGetQueueMailsRequestParams} params
|
|
415
|
+
*/
|
|
416
|
+
const healthGetQueueMails = async ({ threshold, parseOutput = true, sdk = undefined}) => {
|
|
264
417
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
265
418
|
let apiPath = '/health/queue/mails';
|
|
266
419
|
let payload = {};
|
|
267
|
-
|
|
268
|
-
/** Query Params */
|
|
269
420
|
if (typeof threshold !== 'undefined') {
|
|
270
421
|
payload['threshold'] = threshold;
|
|
271
422
|
}
|
|
423
|
+
|
|
272
424
|
let response = undefined;
|
|
425
|
+
|
|
273
426
|
response = await client.call('get', apiPath, {
|
|
274
427
|
'content-type': 'application/json',
|
|
275
428
|
}, payload);
|
|
276
|
-
|
|
429
|
+
|
|
277
430
|
if (parseOutput) {
|
|
278
431
|
parse(response)
|
|
279
432
|
success()
|
|
280
433
|
}
|
|
434
|
+
|
|
281
435
|
return response;
|
|
282
436
|
}
|
|
283
437
|
|
|
284
|
-
|
|
285
|
-
|
|
438
|
+
/**
|
|
439
|
+
* @typedef {Object} HealthGetQueueMessagingRequestParams
|
|
440
|
+
* @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
|
|
441
|
+
* @property {boolean} parseOutput
|
|
442
|
+
* @property {libClient | undefined} sdk
|
|
443
|
+
*/
|
|
286
444
|
|
|
445
|
+
/**
|
|
446
|
+
* @param {HealthGetQueueMessagingRequestParams} params
|
|
447
|
+
*/
|
|
448
|
+
const healthGetQueueMessaging = async ({ threshold, parseOutput = true, sdk = undefined}) => {
|
|
287
449
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
288
450
|
let apiPath = '/health/queue/messaging';
|
|
289
451
|
let payload = {};
|
|
290
|
-
|
|
291
|
-
/** Query Params */
|
|
292
452
|
if (typeof threshold !== 'undefined') {
|
|
293
453
|
payload['threshold'] = threshold;
|
|
294
454
|
}
|
|
455
|
+
|
|
295
456
|
let response = undefined;
|
|
457
|
+
|
|
296
458
|
response = await client.call('get', apiPath, {
|
|
297
459
|
'content-type': 'application/json',
|
|
298
460
|
}, payload);
|
|
299
|
-
|
|
461
|
+
|
|
300
462
|
if (parseOutput) {
|
|
301
463
|
parse(response)
|
|
302
464
|
success()
|
|
303
465
|
}
|
|
466
|
+
|
|
304
467
|
return response;
|
|
305
468
|
}
|
|
306
469
|
|
|
307
|
-
|
|
308
|
-
|
|
470
|
+
/**
|
|
471
|
+
* @typedef {Object} HealthGetQueueMigrationsRequestParams
|
|
472
|
+
* @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
|
|
473
|
+
* @property {boolean} parseOutput
|
|
474
|
+
* @property {libClient | undefined} sdk
|
|
475
|
+
*/
|
|
309
476
|
|
|
477
|
+
/**
|
|
478
|
+
* @param {HealthGetQueueMigrationsRequestParams} params
|
|
479
|
+
*/
|
|
480
|
+
const healthGetQueueMigrations = async ({ threshold, parseOutput = true, sdk = undefined}) => {
|
|
310
481
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
311
482
|
let apiPath = '/health/queue/migrations';
|
|
312
483
|
let payload = {};
|
|
313
|
-
|
|
314
|
-
/** Query Params */
|
|
315
484
|
if (typeof threshold !== 'undefined') {
|
|
316
485
|
payload['threshold'] = threshold;
|
|
317
486
|
}
|
|
487
|
+
|
|
318
488
|
let response = undefined;
|
|
489
|
+
|
|
319
490
|
response = await client.call('get', apiPath, {
|
|
320
491
|
'content-type': 'application/json',
|
|
321
492
|
}, payload);
|
|
322
|
-
|
|
493
|
+
|
|
323
494
|
if (parseOutput) {
|
|
324
495
|
parse(response)
|
|
325
496
|
success()
|
|
326
497
|
}
|
|
498
|
+
|
|
327
499
|
return response;
|
|
328
500
|
}
|
|
329
501
|
|
|
330
|
-
|
|
331
|
-
|
|
502
|
+
/**
|
|
503
|
+
* @typedef {Object} HealthGetQueueWebhooksRequestParams
|
|
504
|
+
* @property {number} threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
|
|
505
|
+
* @property {boolean} parseOutput
|
|
506
|
+
* @property {libClient | undefined} sdk
|
|
507
|
+
*/
|
|
332
508
|
|
|
509
|
+
/**
|
|
510
|
+
* @param {HealthGetQueueWebhooksRequestParams} params
|
|
511
|
+
*/
|
|
512
|
+
const healthGetQueueWebhooks = async ({ threshold, parseOutput = true, sdk = undefined}) => {
|
|
333
513
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
334
514
|
let apiPath = '/health/queue/webhooks';
|
|
335
515
|
let payload = {};
|
|
336
|
-
|
|
337
|
-
/** Query Params */
|
|
338
516
|
if (typeof threshold !== 'undefined') {
|
|
339
517
|
payload['threshold'] = threshold;
|
|
340
518
|
}
|
|
519
|
+
|
|
341
520
|
let response = undefined;
|
|
521
|
+
|
|
342
522
|
response = await client.call('get', apiPath, {
|
|
343
523
|
'content-type': 'application/json',
|
|
344
524
|
}, payload);
|
|
345
|
-
|
|
525
|
+
|
|
346
526
|
if (parseOutput) {
|
|
347
527
|
parse(response)
|
|
348
528
|
success()
|
|
349
529
|
}
|
|
530
|
+
|
|
350
531
|
return response;
|
|
351
532
|
}
|
|
352
533
|
|
|
353
|
-
|
|
534
|
+
/**
|
|
535
|
+
* @typedef {Object} HealthGetStorageLocalRequestParams
|
|
536
|
+
* @property {boolean} parseOutput
|
|
537
|
+
* @property {libClient | undefined} sdk
|
|
538
|
+
*/
|
|
354
539
|
|
|
540
|
+
/**
|
|
541
|
+
* @param {HealthGetStorageLocalRequestParams} params
|
|
542
|
+
*/
|
|
543
|
+
const healthGetStorageLocal = async ({ parseOutput = true, sdk = undefined}) => {
|
|
355
544
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
356
545
|
let apiPath = '/health/storage/local';
|
|
357
546
|
let payload = {};
|
|
547
|
+
|
|
358
548
|
let response = undefined;
|
|
549
|
+
|
|
359
550
|
response = await client.call('get', apiPath, {
|
|
360
551
|
'content-type': 'application/json',
|
|
361
552
|
}, payload);
|
|
362
|
-
|
|
553
|
+
|
|
363
554
|
if (parseOutput) {
|
|
364
555
|
parse(response)
|
|
365
556
|
success()
|
|
366
557
|
}
|
|
558
|
+
|
|
367
559
|
return response;
|
|
368
560
|
}
|
|
369
561
|
|
|
370
|
-
|
|
562
|
+
/**
|
|
563
|
+
* @typedef {Object} HealthGetTimeRequestParams
|
|
564
|
+
* @property {boolean} parseOutput
|
|
565
|
+
* @property {libClient | undefined} sdk
|
|
566
|
+
*/
|
|
371
567
|
|
|
568
|
+
/**
|
|
569
|
+
* @param {HealthGetTimeRequestParams} params
|
|
570
|
+
*/
|
|
571
|
+
const healthGetTime = async ({ parseOutput = true, sdk = undefined}) => {
|
|
372
572
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
373
573
|
let apiPath = '/health/time';
|
|
374
574
|
let payload = {};
|
|
575
|
+
|
|
375
576
|
let response = undefined;
|
|
577
|
+
|
|
376
578
|
response = await client.call('get', apiPath, {
|
|
377
579
|
'content-type': 'application/json',
|
|
378
580
|
}, payload);
|
|
379
|
-
|
|
581
|
+
|
|
380
582
|
if (parseOutput) {
|
|
381
583
|
parse(response)
|
|
382
584
|
success()
|
|
383
585
|
}
|
|
586
|
+
|
|
384
587
|
return response;
|
|
385
588
|
}
|
|
386
589
|
|
|
387
|
-
|
|
388
590
|
health
|
|
389
591
|
.command(`get`)
|
|
390
592
|
.description(`Check the Appwrite HTTP server is up and responsive.`)
|
|
@@ -486,7 +688,6 @@ health
|
|
|
486
688
|
.description(`Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP.`)
|
|
487
689
|
.action(actionRunner(healthGetTime))
|
|
488
690
|
|
|
489
|
-
|
|
490
691
|
module.exports = {
|
|
491
692
|
health,
|
|
492
693
|
healthGet,
|
|
@@ -507,4 +708,4 @@ module.exports = {
|
|
|
507
708
|
healthGetQueueWebhooks,
|
|
508
709
|
healthGetStorageLocal,
|
|
509
710
|
healthGetTime
|
|
510
|
-
};
|
|
711
|
+
};
|