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/locale.js
CHANGED
|
@@ -9,148 +9,260 @@ 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 locale = new Command("locale").description(commandDescriptions['locale']).configureHelp({
|
|
14
39
|
helpWidth: process.stdout.columns || 80
|
|
15
|
-
|
|
40
|
+
})
|
|
16
41
|
|
|
17
|
-
|
|
42
|
+
/**
|
|
43
|
+
* @typedef {Object} LocaleGetRequestParams
|
|
44
|
+
* @property {boolean} parseOutput
|
|
45
|
+
* @property {libClient | undefined} sdk
|
|
46
|
+
*/
|
|
18
47
|
|
|
48
|
+
/**
|
|
49
|
+
* @param {LocaleGetRequestParams} params
|
|
50
|
+
*/
|
|
51
|
+
const localeGet = async ({ parseOutput = true, sdk = undefined}) => {
|
|
19
52
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
20
53
|
let apiPath = '/locale';
|
|
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} LocaleListCodesRequestParams
|
|
72
|
+
* @property {boolean} parseOutput
|
|
73
|
+
* @property {libClient | undefined} sdk
|
|
74
|
+
*/
|
|
35
75
|
|
|
76
|
+
/**
|
|
77
|
+
* @param {LocaleListCodesRequestParams} params
|
|
78
|
+
*/
|
|
79
|
+
const localeListCodes = async ({ parseOutput = true, sdk = undefined}) => {
|
|
36
80
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
37
81
|
let apiPath = '/locale/codes';
|
|
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} LocaleListContinentsRequestParams
|
|
100
|
+
* @property {boolean} parseOutput
|
|
101
|
+
* @property {libClient | undefined} sdk
|
|
102
|
+
*/
|
|
52
103
|
|
|
104
|
+
/**
|
|
105
|
+
* @param {LocaleListContinentsRequestParams} params
|
|
106
|
+
*/
|
|
107
|
+
const localeListContinents = async ({ parseOutput = true, sdk = undefined}) => {
|
|
53
108
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
54
109
|
let apiPath = '/locale/continents';
|
|
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} LocaleListCountriesRequestParams
|
|
128
|
+
* @property {boolean} parseOutput
|
|
129
|
+
* @property {libClient | undefined} sdk
|
|
130
|
+
*/
|
|
69
131
|
|
|
132
|
+
/**
|
|
133
|
+
* @param {LocaleListCountriesRequestParams} params
|
|
134
|
+
*/
|
|
135
|
+
const localeListCountries = async ({ parseOutput = true, sdk = undefined}) => {
|
|
70
136
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
71
137
|
let apiPath = '/locale/countries';
|
|
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} LocaleListCountriesEURequestParams
|
|
156
|
+
* @property {boolean} parseOutput
|
|
157
|
+
* @property {libClient | undefined} sdk
|
|
158
|
+
*/
|
|
86
159
|
|
|
160
|
+
/**
|
|
161
|
+
* @param {LocaleListCountriesEURequestParams} params
|
|
162
|
+
*/
|
|
163
|
+
const localeListCountriesEU = async ({ parseOutput = true, sdk = undefined}) => {
|
|
87
164
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
88
165
|
let apiPath = '/locale/countries/eu';
|
|
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} LocaleListCountriesPhonesRequestParams
|
|
184
|
+
* @property {boolean} parseOutput
|
|
185
|
+
* @property {libClient | undefined} sdk
|
|
186
|
+
*/
|
|
103
187
|
|
|
188
|
+
/**
|
|
189
|
+
* @param {LocaleListCountriesPhonesRequestParams} params
|
|
190
|
+
*/
|
|
191
|
+
const localeListCountriesPhones = async ({ parseOutput = true, sdk = undefined}) => {
|
|
104
192
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
105
193
|
let apiPath = '/locale/countries/phones';
|
|
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
|
-
|
|
210
|
+
/**
|
|
211
|
+
* @typedef {Object} LocaleListCurrenciesRequestParams
|
|
212
|
+
* @property {boolean} parseOutput
|
|
213
|
+
* @property {libClient | undefined} sdk
|
|
214
|
+
*/
|
|
120
215
|
|
|
216
|
+
/**
|
|
217
|
+
* @param {LocaleListCurrenciesRequestParams} params
|
|
218
|
+
*/
|
|
219
|
+
const localeListCurrencies = async ({ parseOutput = true, sdk = undefined}) => {
|
|
121
220
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
122
221
|
let apiPath = '/locale/currencies';
|
|
123
222
|
let payload = {};
|
|
223
|
+
|
|
124
224
|
let response = undefined;
|
|
225
|
+
|
|
125
226
|
response = await client.call('get', apiPath, {
|
|
126
227
|
'content-type': 'application/json',
|
|
127
228
|
}, payload);
|
|
128
|
-
|
|
229
|
+
|
|
129
230
|
if (parseOutput) {
|
|
130
231
|
parse(response)
|
|
131
232
|
success()
|
|
132
233
|
}
|
|
234
|
+
|
|
133
235
|
return response;
|
|
134
236
|
}
|
|
135
237
|
|
|
136
|
-
|
|
238
|
+
/**
|
|
239
|
+
* @typedef {Object} LocaleListLanguagesRequestParams
|
|
240
|
+
* @property {boolean} parseOutput
|
|
241
|
+
* @property {libClient | undefined} sdk
|
|
242
|
+
*/
|
|
137
243
|
|
|
244
|
+
/**
|
|
245
|
+
* @param {LocaleListLanguagesRequestParams} params
|
|
246
|
+
*/
|
|
247
|
+
const localeListLanguages = async ({ parseOutput = true, sdk = undefined}) => {
|
|
138
248
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
139
249
|
let apiPath = '/locale/languages';
|
|
140
250
|
let payload = {};
|
|
251
|
+
|
|
141
252
|
let response = undefined;
|
|
253
|
+
|
|
142
254
|
response = await client.call('get', apiPath, {
|
|
143
255
|
'content-type': 'application/json',
|
|
144
256
|
}, payload);
|
|
145
|
-
|
|
257
|
+
|
|
146
258
|
if (parseOutput) {
|
|
147
259
|
parse(response)
|
|
148
260
|
success()
|
|
149
261
|
}
|
|
262
|
+
|
|
150
263
|
return response;
|
|
151
264
|
}
|
|
152
265
|
|
|
153
|
-
|
|
154
266
|
locale
|
|
155
267
|
.command(`get`)
|
|
156
268
|
.description(`Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language. ([IP Geolocation by DB-IP](https://db-ip.com))`)
|
|
@@ -191,7 +303,6 @@ locale
|
|
|
191
303
|
.description(`List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.`)
|
|
192
304
|
.action(actionRunner(localeListLanguages))
|
|
193
305
|
|
|
194
|
-
|
|
195
306
|
module.exports = {
|
|
196
307
|
locale,
|
|
197
308
|
localeGet,
|
|
@@ -202,4 +313,4 @@ module.exports = {
|
|
|
202
313
|
localeListCountriesPhones,
|
|
203
314
|
localeListCurrencies,
|
|
204
315
|
localeListLanguages
|
|
205
|
-
};
|
|
316
|
+
};
|