appwrite-cli 4.2.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.
@@ -9,144 +9,281 @@ 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
- const localeGet = async ({ parseOutput = true, sdk = undefined}) => {
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;
53
+
20
54
  let apiPath = '/locale';
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
- const localeListCodes = async ({ parseOutput = true, sdk = undefined}) => {
73
+ /**
74
+ * @typedef {Object} LocaleListCodesRequestParams
75
+ * @property {boolean} parseOutput
76
+ * @property {libClient | undefined} sdk
77
+ */
35
78
 
79
+ /**
80
+ * @param {LocaleListCodesRequestParams} params
81
+ */
82
+ const localeListCodes = async ({ parseOutput = true, sdk = undefined}) => {
36
83
  let client = !sdk ? await sdkForProject() : sdk;
84
+
37
85
  let apiPath = '/locale/codes';
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
- const localeListContinents = async ({ parseOutput = true, sdk = undefined}) => {
104
+ /**
105
+ * @typedef {Object} LocaleListContinentsRequestParams
106
+ * @property {boolean} parseOutput
107
+ * @property {libClient | undefined} sdk
108
+ */
52
109
 
110
+ /**
111
+ * @param {LocaleListContinentsRequestParams} params
112
+ */
113
+ const localeListContinents = async ({ parseOutput = true, sdk = undefined}) => {
53
114
  let client = !sdk ? await sdkForProject() : sdk;
115
+
54
116
  let apiPath = '/locale/continents';
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
- const localeListCountries = async ({ parseOutput = true, sdk = undefined}) => {
135
+ /**
136
+ * @typedef {Object} LocaleListCountriesRequestParams
137
+ * @property {boolean} parseOutput
138
+ * @property {libClient | undefined} sdk
139
+ */
69
140
 
141
+ /**
142
+ * @param {LocaleListCountriesRequestParams} params
143
+ */
144
+ const localeListCountries = async ({ parseOutput = true, sdk = undefined}) => {
70
145
  let client = !sdk ? await sdkForProject() : sdk;
146
+
71
147
  let apiPath = '/locale/countries';
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
- const localeListCountriesEU = async ({ parseOutput = true, sdk = undefined}) => {
166
+ /**
167
+ * @typedef {Object} LocaleListCountriesEURequestParams
168
+ * @property {boolean} parseOutput
169
+ * @property {libClient | undefined} sdk
170
+ */
86
171
 
172
+ /**
173
+ * @param {LocaleListCountriesEURequestParams} params
174
+ */
175
+ const localeListCountriesEU = async ({ parseOutput = true, sdk = undefined}) => {
87
176
  let client = !sdk ? await sdkForProject() : sdk;
177
+
88
178
  let apiPath = '/locale/countries/eu';
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
- const localeListCountriesPhones = async ({ parseOutput = true, sdk = undefined}) => {
197
+ /**
198
+ * @typedef {Object} LocaleListCountriesPhonesRequestParams
199
+ * @property {boolean} parseOutput
200
+ * @property {libClient | undefined} sdk
201
+ */
103
202
 
203
+ /**
204
+ * @param {LocaleListCountriesPhonesRequestParams} params
205
+ */
206
+ const localeListCountriesPhones = async ({ parseOutput = true, sdk = undefined}) => {
104
207
  let client = !sdk ? await sdkForProject() : sdk;
208
+
105
209
  let apiPath = '/locale/countries/phones';
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
- const localeListCurrencies = async ({ parseOutput = true, sdk = undefined}) => {
228
+ /**
229
+ * @typedef {Object} LocaleListCurrenciesRequestParams
230
+ * @property {boolean} parseOutput
231
+ * @property {libClient | undefined} sdk
232
+ */
120
233
 
234
+ /**
235
+ * @param {LocaleListCurrenciesRequestParams} params
236
+ */
237
+ const localeListCurrencies = async ({ parseOutput = true, sdk = undefined}) => {
121
238
  let client = !sdk ? await sdkForProject() : sdk;
239
+
122
240
  let apiPath = '/locale/currencies';
123
241
  let payload = {};
242
+
243
+
124
244
  let response = undefined;
245
+
125
246
  response = await client.call('get', apiPath, {
126
247
  'content-type': 'application/json',
127
248
  }, payload);
249
+
128
250
 
129
251
  if (parseOutput) {
130
252
  parse(response)
131
253
  success()
132
254
  }
255
+
133
256
  return response;
134
257
  }
135
258
 
136
- const localeListLanguages = async ({ parseOutput = true, sdk = undefined}) => {
259
+ /**
260
+ * @typedef {Object} LocaleListLanguagesRequestParams
261
+ * @property {boolean} parseOutput
262
+ * @property {libClient | undefined} sdk
263
+ */
137
264
 
265
+ /**
266
+ * @param {LocaleListLanguagesRequestParams} params
267
+ */
268
+ const localeListLanguages = async ({ parseOutput = true, sdk = undefined}) => {
138
269
  let client = !sdk ? await sdkForProject() : sdk;
270
+
139
271
  let apiPath = '/locale/languages';
140
272
  let payload = {};
273
+
274
+
141
275
  let response = undefined;
276
+
142
277
  response = await client.call('get', apiPath, {
143
278
  'content-type': 'application/json',
144
279
  }, payload);
280
+
145
281
 
146
282
  if (parseOutput) {
147
283
  parse(response)
148
284
  success()
149
285
  }
286
+
150
287
  return response;
151
288
  }
152
289
 
@@ -194,12 +331,12 @@ locale
194
331
 
195
332
  module.exports = {
196
333
  locale,
197
- localeGet,
198
- localeListCodes,
199
- localeListContinents,
200
- localeListCountries,
201
- localeListCountriesEU,
202
- localeListCountriesPhones,
203
- localeListCurrencies,
204
- localeListLanguages
205
- };
334
+ localeGet,
335
+ localeListCodes,
336
+ localeListContinents,
337
+ localeListCountries,
338
+ localeListCountriesEU,
339
+ localeListCountriesPhones,
340
+ localeListCurrencies,
341
+ localeListLanguages
342
+ };