appwrite-cli 4.2.1 → 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/README.md +2 -2
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/client.js +7 -2
- package/lib/commands/account.js +63 -158
- package/lib/commands/assistant.js +3 -8
- package/lib/commands/avatars.js +29 -45
- package/lib/commands/console.js +3 -8
- package/lib/commands/databases.js +97 -243
- package/lib/commands/functions.js +54 -119
- package/lib/commands/generic.js +0 -1
- package/lib/commands/graphql.js +5 -13
- package/lib/commands/health.js +37 -93
- package/lib/commands/locale.js +17 -43
- package/lib/commands/migrations.js +33 -83
- package/lib/commands/project.js +13 -33
- package/lib/commands/projects.js +81 -203
- package/lib/commands/proxy.js +11 -28
- package/lib/commands/storage.js +36 -81
- package/lib/commands/teams.js +29 -73
- package/lib/commands/users.js +59 -148
- package/lib/commands/vcs.js +19 -48
- package/package.json +1 -1
- package/scoop/appwrite.json +3 -3
|
@@ -37,7 +37,7 @@ function convertReadStreamToReadableStream(readStream) {
|
|
|
37
37
|
|
|
38
38
|
const assistant = new Command("assistant").description(commandDescriptions['assistant']).configureHelp({
|
|
39
39
|
helpWidth: process.stdout.columns || 80
|
|
40
|
-
|
|
40
|
+
})
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* @typedef {Object} AssistantChatRequestParams
|
|
@@ -51,21 +51,18 @@ const assistant = new Command("assistant").description(commandDescriptions['assi
|
|
|
51
51
|
*/
|
|
52
52
|
const assistantChat = async ({ prompt, parseOutput = true, sdk = undefined}) => {
|
|
53
53
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
54
|
-
|
|
55
54
|
let apiPath = '/console/assistant';
|
|
56
55
|
let payload = {};
|
|
57
56
|
if (typeof prompt !== 'undefined') {
|
|
58
57
|
payload['prompt'] = prompt;
|
|
59
58
|
}
|
|
60
59
|
|
|
61
|
-
|
|
62
60
|
let response = undefined;
|
|
63
|
-
|
|
61
|
+
|
|
64
62
|
response = await client.call('post', apiPath, {
|
|
65
63
|
'content-type': 'application/json',
|
|
66
64
|
}, payload);
|
|
67
65
|
|
|
68
|
-
|
|
69
66
|
if (parseOutput) {
|
|
70
67
|
parse(response)
|
|
71
68
|
success()
|
|
@@ -74,15 +71,13 @@ const assistantChat = async ({ prompt, parseOutput = true, sdk = undefined}) =>
|
|
|
74
71
|
return response;
|
|
75
72
|
}
|
|
76
73
|
|
|
77
|
-
|
|
78
74
|
assistant
|
|
79
75
|
.command(`chat`)
|
|
80
76
|
.description(``)
|
|
81
77
|
.requiredOption(`--prompt <prompt>`, `Prompt. A string containing questions asked to the AI assistant.`)
|
|
82
78
|
.action(actionRunner(assistantChat))
|
|
83
79
|
|
|
84
|
-
|
|
85
80
|
module.exports = {
|
|
86
81
|
assistant,
|
|
87
|
-
assistantChat
|
|
82
|
+
assistantChat
|
|
88
83
|
};
|
package/lib/commands/avatars.js
CHANGED
|
@@ -37,7 +37,7 @@ function convertReadStreamToReadableStream(readStream) {
|
|
|
37
37
|
|
|
38
38
|
const avatars = new Command("avatars").description(commandDescriptions['avatars']).configureHelp({
|
|
39
39
|
helpWidth: process.stdout.columns || 80
|
|
40
|
-
|
|
40
|
+
})
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* @typedef {Object} AvatarsGetBrowserRequestParams
|
|
@@ -47,7 +47,7 @@ const avatars = new Command("avatars").description(commandDescriptions['avatars'
|
|
|
47
47
|
* @property {number} quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
|
|
48
48
|
* @property {boolean} parseOutput
|
|
49
49
|
* @property {libClient | undefined} sdk
|
|
50
|
-
* @property {string} destination
|
|
50
|
+
* @property {string} destination
|
|
51
51
|
*/
|
|
52
52
|
|
|
53
53
|
/**
|
|
@@ -55,7 +55,6 @@ const avatars = new Command("avatars").description(commandDescriptions['avatars'
|
|
|
55
55
|
*/
|
|
56
56
|
const avatarsGetBrowser = async ({ code, width, height, quality, parseOutput = true, sdk = undefined, destination}) => {
|
|
57
57
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
58
|
-
|
|
59
58
|
let apiPath = '/avatars/browsers/{code}'.replace('{code}', code);
|
|
60
59
|
let payload = {};
|
|
61
60
|
if (typeof width !== 'undefined') {
|
|
@@ -67,20 +66,19 @@ const avatarsGetBrowser = async ({ code, width, height, quality, parseOutput = t
|
|
|
67
66
|
if (typeof quality !== 'undefined') {
|
|
68
67
|
payload['quality'] = quality;
|
|
69
68
|
}
|
|
70
|
-
|
|
71
69
|
payload['project'] = localConfig.getProject().projectId
|
|
72
70
|
payload['key'] = globalConfig.getKey();
|
|
73
71
|
const queryParams = new URLSearchParams(payload);
|
|
74
72
|
apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
|
|
75
73
|
|
|
76
74
|
let response = undefined;
|
|
77
|
-
|
|
75
|
+
|
|
78
76
|
response = await client.call('get', apiPath, {
|
|
79
77
|
'content-type': 'application/json',
|
|
80
78
|
}, payload, 'arraybuffer');
|
|
81
79
|
|
|
82
80
|
fs.writeFileSync(destination, response);
|
|
83
|
-
|
|
81
|
+
|
|
84
82
|
if (parseOutput) {
|
|
85
83
|
parse(response)
|
|
86
84
|
success()
|
|
@@ -97,7 +95,7 @@ const avatarsGetBrowser = async ({ code, width, height, quality, parseOutput = t
|
|
|
97
95
|
* @property {number} quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
|
|
98
96
|
* @property {boolean} parseOutput
|
|
99
97
|
* @property {libClient | undefined} sdk
|
|
100
|
-
* @property {string} destination
|
|
98
|
+
* @property {string} destination
|
|
101
99
|
*/
|
|
102
100
|
|
|
103
101
|
/**
|
|
@@ -105,7 +103,6 @@ const avatarsGetBrowser = async ({ code, width, height, quality, parseOutput = t
|
|
|
105
103
|
*/
|
|
106
104
|
const avatarsGetCreditCard = async ({ code, width, height, quality, parseOutput = true, sdk = undefined, destination}) => {
|
|
107
105
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
108
|
-
|
|
109
106
|
let apiPath = '/avatars/credit-cards/{code}'.replace('{code}', code);
|
|
110
107
|
let payload = {};
|
|
111
108
|
if (typeof width !== 'undefined') {
|
|
@@ -117,20 +114,19 @@ const avatarsGetCreditCard = async ({ code, width, height, quality, parseOutput
|
|
|
117
114
|
if (typeof quality !== 'undefined') {
|
|
118
115
|
payload['quality'] = quality;
|
|
119
116
|
}
|
|
120
|
-
|
|
121
117
|
payload['project'] = localConfig.getProject().projectId
|
|
122
118
|
payload['key'] = globalConfig.getKey();
|
|
123
119
|
const queryParams = new URLSearchParams(payload);
|
|
124
120
|
apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
|
|
125
121
|
|
|
126
122
|
let response = undefined;
|
|
127
|
-
|
|
123
|
+
|
|
128
124
|
response = await client.call('get', apiPath, {
|
|
129
125
|
'content-type': 'application/json',
|
|
130
126
|
}, payload, 'arraybuffer');
|
|
131
127
|
|
|
132
128
|
fs.writeFileSync(destination, response);
|
|
133
|
-
|
|
129
|
+
|
|
134
130
|
if (parseOutput) {
|
|
135
131
|
parse(response)
|
|
136
132
|
success()
|
|
@@ -144,7 +140,7 @@ const avatarsGetCreditCard = async ({ code, width, height, quality, parseOutput
|
|
|
144
140
|
* @property {string} url Website URL which you want to fetch the favicon from.
|
|
145
141
|
* @property {boolean} parseOutput
|
|
146
142
|
* @property {libClient | undefined} sdk
|
|
147
|
-
* @property {string} destination
|
|
143
|
+
* @property {string} destination
|
|
148
144
|
*/
|
|
149
145
|
|
|
150
146
|
/**
|
|
@@ -152,26 +148,24 @@ const avatarsGetCreditCard = async ({ code, width, height, quality, parseOutput
|
|
|
152
148
|
*/
|
|
153
149
|
const avatarsGetFavicon = async ({ url, parseOutput = true, sdk = undefined, destination}) => {
|
|
154
150
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
155
|
-
|
|
156
151
|
let apiPath = '/avatars/favicon';
|
|
157
152
|
let payload = {};
|
|
158
153
|
if (typeof url !== 'undefined') {
|
|
159
154
|
payload['url'] = url;
|
|
160
155
|
}
|
|
161
|
-
|
|
162
156
|
payload['project'] = localConfig.getProject().projectId
|
|
163
157
|
payload['key'] = globalConfig.getKey();
|
|
164
158
|
const queryParams = new URLSearchParams(payload);
|
|
165
159
|
apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
|
|
166
160
|
|
|
167
161
|
let response = undefined;
|
|
168
|
-
|
|
162
|
+
|
|
169
163
|
response = await client.call('get', apiPath, {
|
|
170
164
|
'content-type': 'application/json',
|
|
171
165
|
}, payload, 'arraybuffer');
|
|
172
166
|
|
|
173
167
|
fs.writeFileSync(destination, response);
|
|
174
|
-
|
|
168
|
+
|
|
175
169
|
if (parseOutput) {
|
|
176
170
|
parse(response)
|
|
177
171
|
success()
|
|
@@ -188,7 +182,7 @@ const avatarsGetFavicon = async ({ url, parseOutput = true, sdk = undefined, des
|
|
|
188
182
|
* @property {number} quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
|
|
189
183
|
* @property {boolean} parseOutput
|
|
190
184
|
* @property {libClient | undefined} sdk
|
|
191
|
-
* @property {string} destination
|
|
185
|
+
* @property {string} destination
|
|
192
186
|
*/
|
|
193
187
|
|
|
194
188
|
/**
|
|
@@ -196,7 +190,6 @@ const avatarsGetFavicon = async ({ url, parseOutput = true, sdk = undefined, des
|
|
|
196
190
|
*/
|
|
197
191
|
const avatarsGetFlag = async ({ code, width, height, quality, parseOutput = true, sdk = undefined, destination}) => {
|
|
198
192
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
199
|
-
|
|
200
193
|
let apiPath = '/avatars/flags/{code}'.replace('{code}', code);
|
|
201
194
|
let payload = {};
|
|
202
195
|
if (typeof width !== 'undefined') {
|
|
@@ -208,20 +201,19 @@ const avatarsGetFlag = async ({ code, width, height, quality, parseOutput = true
|
|
|
208
201
|
if (typeof quality !== 'undefined') {
|
|
209
202
|
payload['quality'] = quality;
|
|
210
203
|
}
|
|
211
|
-
|
|
212
204
|
payload['project'] = localConfig.getProject().projectId
|
|
213
205
|
payload['key'] = globalConfig.getKey();
|
|
214
206
|
const queryParams = new URLSearchParams(payload);
|
|
215
207
|
apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
|
|
216
208
|
|
|
217
209
|
let response = undefined;
|
|
218
|
-
|
|
210
|
+
|
|
219
211
|
response = await client.call('get', apiPath, {
|
|
220
212
|
'content-type': 'application/json',
|
|
221
213
|
}, payload, 'arraybuffer');
|
|
222
214
|
|
|
223
215
|
fs.writeFileSync(destination, response);
|
|
224
|
-
|
|
216
|
+
|
|
225
217
|
if (parseOutput) {
|
|
226
218
|
parse(response)
|
|
227
219
|
success()
|
|
@@ -237,7 +229,7 @@ const avatarsGetFlag = async ({ code, width, height, quality, parseOutput = true
|
|
|
237
229
|
* @property {number} height Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400.
|
|
238
230
|
* @property {boolean} parseOutput
|
|
239
231
|
* @property {libClient | undefined} sdk
|
|
240
|
-
* @property {string} destination
|
|
232
|
+
* @property {string} destination
|
|
241
233
|
*/
|
|
242
234
|
|
|
243
235
|
/**
|
|
@@ -245,7 +237,6 @@ const avatarsGetFlag = async ({ code, width, height, quality, parseOutput = true
|
|
|
245
237
|
*/
|
|
246
238
|
const avatarsGetImage = async ({ url, width, height, parseOutput = true, sdk = undefined, destination}) => {
|
|
247
239
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
248
|
-
|
|
249
240
|
let apiPath = '/avatars/image';
|
|
250
241
|
let payload = {};
|
|
251
242
|
if (typeof url !== 'undefined') {
|
|
@@ -257,20 +248,19 @@ const avatarsGetImage = async ({ url, width, height, parseOutput = true, sdk = u
|
|
|
257
248
|
if (typeof height !== 'undefined') {
|
|
258
249
|
payload['height'] = height;
|
|
259
250
|
}
|
|
260
|
-
|
|
261
251
|
payload['project'] = localConfig.getProject().projectId
|
|
262
252
|
payload['key'] = globalConfig.getKey();
|
|
263
253
|
const queryParams = new URLSearchParams(payload);
|
|
264
254
|
apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
|
|
265
255
|
|
|
266
256
|
let response = undefined;
|
|
267
|
-
|
|
257
|
+
|
|
268
258
|
response = await client.call('get', apiPath, {
|
|
269
259
|
'content-type': 'application/json',
|
|
270
260
|
}, payload, 'arraybuffer');
|
|
271
261
|
|
|
272
262
|
fs.writeFileSync(destination, response);
|
|
273
|
-
|
|
263
|
+
|
|
274
264
|
if (parseOutput) {
|
|
275
265
|
parse(response)
|
|
276
266
|
success()
|
|
@@ -287,7 +277,7 @@ const avatarsGetImage = async ({ url, width, height, parseOutput = true, sdk = u
|
|
|
287
277
|
* @property {string} background Changes background color. By default a random color will be picked and stay will persistent to the given name.
|
|
288
278
|
* @property {boolean} parseOutput
|
|
289
279
|
* @property {libClient | undefined} sdk
|
|
290
|
-
* @property {string} destination
|
|
280
|
+
* @property {string} destination
|
|
291
281
|
*/
|
|
292
282
|
|
|
293
283
|
/**
|
|
@@ -295,7 +285,6 @@ const avatarsGetImage = async ({ url, width, height, parseOutput = true, sdk = u
|
|
|
295
285
|
*/
|
|
296
286
|
const avatarsGetInitials = async ({ name, width, height, background, parseOutput = true, sdk = undefined, destination}) => {
|
|
297
287
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
298
|
-
|
|
299
288
|
let apiPath = '/avatars/initials';
|
|
300
289
|
let payload = {};
|
|
301
290
|
if (typeof name !== 'undefined') {
|
|
@@ -310,20 +299,19 @@ const avatarsGetInitials = async ({ name, width, height, background, parseOutput
|
|
|
310
299
|
if (typeof background !== 'undefined') {
|
|
311
300
|
payload['background'] = background;
|
|
312
301
|
}
|
|
313
|
-
|
|
314
302
|
payload['project'] = localConfig.getProject().projectId
|
|
315
303
|
payload['key'] = globalConfig.getKey();
|
|
316
304
|
const queryParams = new URLSearchParams(payload);
|
|
317
305
|
apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
|
|
318
306
|
|
|
319
307
|
let response = undefined;
|
|
320
|
-
|
|
308
|
+
|
|
321
309
|
response = await client.call('get', apiPath, {
|
|
322
310
|
'content-type': 'application/json',
|
|
323
311
|
}, payload, 'arraybuffer');
|
|
324
312
|
|
|
325
313
|
fs.writeFileSync(destination, response);
|
|
326
|
-
|
|
314
|
+
|
|
327
315
|
if (parseOutput) {
|
|
328
316
|
parse(response)
|
|
329
317
|
success()
|
|
@@ -340,7 +328,7 @@ const avatarsGetInitials = async ({ name, width, height, background, parseOutput
|
|
|
340
328
|
* @property {boolean} download Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.
|
|
341
329
|
* @property {boolean} parseOutput
|
|
342
330
|
* @property {libClient | undefined} sdk
|
|
343
|
-
* @property {string} destination
|
|
331
|
+
* @property {string} destination
|
|
344
332
|
*/
|
|
345
333
|
|
|
346
334
|
/**
|
|
@@ -348,7 +336,6 @@ const avatarsGetInitials = async ({ name, width, height, background, parseOutput
|
|
|
348
336
|
*/
|
|
349
337
|
const avatarsGetQR = async ({ text, size, margin, download, parseOutput = true, sdk = undefined, destination}) => {
|
|
350
338
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
351
|
-
|
|
352
339
|
let apiPath = '/avatars/qr';
|
|
353
340
|
let payload = {};
|
|
354
341
|
if (typeof text !== 'undefined') {
|
|
@@ -363,20 +350,19 @@ const avatarsGetQR = async ({ text, size, margin, download, parseOutput = true,
|
|
|
363
350
|
if (typeof download !== 'undefined') {
|
|
364
351
|
payload['download'] = download;
|
|
365
352
|
}
|
|
366
|
-
|
|
367
353
|
payload['project'] = localConfig.getProject().projectId
|
|
368
354
|
payload['key'] = globalConfig.getKey();
|
|
369
355
|
const queryParams = new URLSearchParams(payload);
|
|
370
356
|
apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
|
|
371
357
|
|
|
372
358
|
let response = undefined;
|
|
373
|
-
|
|
359
|
+
|
|
374
360
|
response = await client.call('get', apiPath, {
|
|
375
361
|
'content-type': 'application/json',
|
|
376
362
|
}, payload, 'arraybuffer');
|
|
377
363
|
|
|
378
364
|
fs.writeFileSync(destination, response);
|
|
379
|
-
|
|
365
|
+
|
|
380
366
|
if (parseOutput) {
|
|
381
367
|
parse(response)
|
|
382
368
|
success()
|
|
@@ -385,7 +371,6 @@ const avatarsGetQR = async ({ text, size, margin, download, parseOutput = true,
|
|
|
385
371
|
return response;
|
|
386
372
|
}
|
|
387
373
|
|
|
388
|
-
|
|
389
374
|
avatars
|
|
390
375
|
.command(`getBrowser`)
|
|
391
376
|
.description(`You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings. When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px.`)
|
|
@@ -452,14 +437,13 @@ avatars
|
|
|
452
437
|
.requiredOption(`--destination <path>`, `output file path.`)
|
|
453
438
|
.action(actionRunner(avatarsGetQR))
|
|
454
439
|
|
|
455
|
-
|
|
456
440
|
module.exports = {
|
|
457
441
|
avatars,
|
|
458
|
-
avatarsGetBrowser,
|
|
459
|
-
avatarsGetCreditCard,
|
|
460
|
-
avatarsGetFavicon,
|
|
461
|
-
avatarsGetFlag,
|
|
462
|
-
avatarsGetImage,
|
|
463
|
-
avatarsGetInitials,
|
|
464
|
-
avatarsGetQR
|
|
442
|
+
avatarsGetBrowser,
|
|
443
|
+
avatarsGetCreditCard,
|
|
444
|
+
avatarsGetFavicon,
|
|
445
|
+
avatarsGetFlag,
|
|
446
|
+
avatarsGetImage,
|
|
447
|
+
avatarsGetInitials,
|
|
448
|
+
avatarsGetQR
|
|
465
449
|
};
|
package/lib/commands/console.js
CHANGED
|
@@ -37,7 +37,7 @@ function convertReadStreamToReadableStream(readStream) {
|
|
|
37
37
|
|
|
38
38
|
const console = new Command("console").description(commandDescriptions['console']).configureHelp({
|
|
39
39
|
helpWidth: process.stdout.columns || 80
|
|
40
|
-
|
|
40
|
+
})
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* @typedef {Object} ConsoleVariablesRequestParams
|
|
@@ -50,18 +50,15 @@ const console = new Command("console").description(commandDescriptions['console'
|
|
|
50
50
|
*/
|
|
51
51
|
const consoleVariables = async ({ parseOutput = true, sdk = undefined}) => {
|
|
52
52
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
53
|
-
|
|
54
53
|
let apiPath = '/console/variables';
|
|
55
54
|
let payload = {};
|
|
56
55
|
|
|
57
|
-
|
|
58
56
|
let response = undefined;
|
|
59
|
-
|
|
57
|
+
|
|
60
58
|
response = await client.call('get', apiPath, {
|
|
61
59
|
'content-type': 'application/json',
|
|
62
60
|
}, payload);
|
|
63
61
|
|
|
64
|
-
|
|
65
62
|
if (parseOutput) {
|
|
66
63
|
parse(response)
|
|
67
64
|
success()
|
|
@@ -70,14 +67,12 @@ const consoleVariables = async ({ parseOutput = true, sdk = undefined}) => {
|
|
|
70
67
|
return response;
|
|
71
68
|
}
|
|
72
69
|
|
|
73
|
-
|
|
74
70
|
console
|
|
75
71
|
.command(`variables`)
|
|
76
72
|
.description(`Get all Environment Variables that are relevant for the console.`)
|
|
77
73
|
.action(actionRunner(consoleVariables))
|
|
78
74
|
|
|
79
|
-
|
|
80
75
|
module.exports = {
|
|
81
76
|
console,
|
|
82
|
-
consoleVariables
|
|
77
|
+
consoleVariables
|
|
83
78
|
};
|