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.
Files changed (38) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +3 -3
  3. package/docs/examples/health/get-queue-builds.md +2 -0
  4. package/docs/examples/health/get-queue-certificates.md +2 -1
  5. package/docs/examples/health/get-queue-databases.md +3 -0
  6. package/docs/examples/health/get-queue-deletes.md +2 -0
  7. package/docs/examples/health/get-queue-functions.md +2 -1
  8. package/docs/examples/health/get-queue-logs.md +2 -1
  9. package/docs/examples/health/get-queue-mails.md +2 -0
  10. package/docs/examples/health/get-queue-messaging.md +2 -0
  11. package/docs/examples/health/get-queue-migrations.md +2 -0
  12. package/docs/examples/health/get-queue-webhooks.md +2 -1
  13. package/install.ps1 +2 -2
  14. package/install.sh +1 -1
  15. package/lib/client.js +61 -74
  16. package/lib/commands/account.js +564 -210
  17. package/lib/commands/assistant.js +42 -7
  18. package/lib/commands/avatars.js +199 -83
  19. package/lib/commands/console.js +42 -3
  20. package/lib/commands/databases.js +991 -562
  21. package/lib/commands/deploy.js +170 -99
  22. package/lib/commands/functions.js +564 -294
  23. package/lib/commands/graphql.js +58 -11
  24. package/lib/commands/health.js +496 -26
  25. package/lib/commands/init.js +11 -23
  26. package/lib/commands/locale.js +154 -17
  27. package/lib/commands/migrations.js +328 -147
  28. package/lib/commands/project.js +128 -33
  29. package/lib/commands/projects.js +788 -411
  30. package/lib/commands/proxy.js +113 -28
  31. package/lib/commands/storage.js +438 -223
  32. package/lib/commands/teams.js +284 -108
  33. package/lib/commands/users.js +559 -271
  34. package/lib/commands/vcs.js +186 -53
  35. package/lib/paginate.js +51 -0
  36. package/lib/questions.js +7 -10
  37. package/package.json +9 -9
  38. package/scoop/appwrite.json +3 -3
@@ -9,93 +9,141 @@ 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 migrations = new Command("migrations").description(commandDescriptions['migrations']).configureHelp({
14
39
  helpWidth: process.stdout.columns || 80
15
40
  })
16
41
 
42
+ /**
43
+ * @typedef {Object} MigrationsListRequestParams
44
+ * @property {string} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: status, stage, source, resources, statusCounters, resourceData, errors
45
+ * @property {string} search Search term to filter your list results. Max length: 256 chars.
46
+ * @property {boolean} parseOutput
47
+ * @property {libClient | undefined} sdk
48
+ */
49
+
50
+ /**
51
+ * @param {MigrationsListRequestParams} params
52
+ */
17
53
  const migrationsList = async ({ queries, search, parseOutput = true, sdk = undefined}) => {
18
- /* @param {string} queries */
19
- /* @param {string} search */
20
-
21
54
  let client = !sdk ? await sdkForProject() : sdk;
55
+
22
56
  let apiPath = '/migrations';
23
57
  let payload = {};
24
-
25
- /** Query Params */
26
58
  if (typeof queries !== 'undefined') {
27
59
  payload['queries'] = queries;
28
60
  }
29
61
  if (typeof search !== 'undefined') {
30
62
  payload['search'] = search;
31
63
  }
64
+
65
+
32
66
  let response = undefined;
67
+
33
68
  response = await client.call('get', apiPath, {
34
69
  'content-type': 'application/json',
35
70
  }, payload);
71
+
36
72
 
37
73
  if (parseOutput) {
38
74
  parse(response)
39
75
  success()
40
76
  }
77
+
41
78
  return response;
42
79
  }
43
80
 
81
+ /**
82
+ * @typedef {Object} MigrationsCreateAppwriteMigrationRequestParams
83
+ * @property {string[]} resources List of resources to migrate
84
+ * @property {string} endpoint Source's Appwrite Endpoint
85
+ * @property {string} projectId Source's Project ID
86
+ * @property {string} apiKey Source's API Key
87
+ * @property {boolean} parseOutput
88
+ * @property {libClient | undefined} sdk
89
+ */
90
+
91
+ /**
92
+ * @param {MigrationsCreateAppwriteMigrationRequestParams} params
93
+ */
44
94
  const migrationsCreateAppwriteMigration = async ({ resources, endpoint, projectId, apiKey, parseOutput = true, sdk = undefined}) => {
45
- /* @param {string[]} resources */
46
- /* @param {string} endpoint */
47
- /* @param {string} projectId */
48
- /* @param {string} apiKey */
49
-
50
95
  let client = !sdk ? await sdkForProject() : sdk;
96
+
51
97
  let apiPath = '/migrations/appwrite';
52
98
  let payload = {};
53
-
54
- /** Body Params */
55
99
  resources = resources === true ? [] : resources;
56
-
57
100
  if (typeof resources !== 'undefined') {
58
101
  payload['resources'] = resources;
59
102
  }
60
-
61
-
62
103
  if (typeof endpoint !== 'undefined') {
63
104
  payload['endpoint'] = endpoint;
64
105
  }
65
-
66
-
67
106
  if (typeof projectId !== 'undefined') {
68
107
  payload['projectId'] = projectId;
69
108
  }
70
-
71
-
72
109
  if (typeof apiKey !== 'undefined') {
73
110
  payload['apiKey'] = apiKey;
74
111
  }
75
112
 
113
+
76
114
  let response = undefined;
115
+
77
116
  response = await client.call('post', apiPath, {
78
117
  'content-type': 'application/json',
79
118
  }, payload);
119
+
80
120
 
81
121
  if (parseOutput) {
82
122
  parse(response)
83
123
  success()
84
124
  }
125
+
85
126
  return response;
86
127
  }
87
128
 
129
+ /**
130
+ * @typedef {Object} MigrationsGetAppwriteReportRequestParams
131
+ * @property {string[]} resources List of resources to migrate
132
+ * @property {string} endpoint Source's Appwrite Endpoint
133
+ * @property {string} projectID Source's Project ID
134
+ * @property {string} key Source's API Key
135
+ * @property {boolean} parseOutput
136
+ * @property {libClient | undefined} sdk
137
+ */
138
+
139
+ /**
140
+ * @param {MigrationsGetAppwriteReportRequestParams} params
141
+ */
88
142
  const migrationsGetAppwriteReport = async ({ resources, endpoint, projectID, key, parseOutput = true, sdk = undefined}) => {
89
- /* @param {string[]} resources */
90
- /* @param {string} endpoint */
91
- /* @param {string} projectID */
92
- /* @param {string} key */
93
-
94
143
  let client = !sdk ? await sdkForProject() : sdk;
144
+
95
145
  let apiPath = '/migrations/appwrite/report';
96
146
  let payload = {};
97
-
98
- /** Query Params */
99
147
  if (typeof resources !== 'undefined') {
100
148
  payload['resources'] = resources;
101
149
  }
@@ -108,253 +156,329 @@ const migrationsGetAppwriteReport = async ({ resources, endpoint, projectID, key
108
156
  if (typeof key !== 'undefined') {
109
157
  payload['key'] = key;
110
158
  }
159
+
160
+
111
161
  let response = undefined;
162
+
112
163
  response = await client.call('get', apiPath, {
113
164
  'content-type': 'application/json',
114
165
  }, payload);
166
+
115
167
 
116
168
  if (parseOutput) {
117
169
  parse(response)
118
170
  success()
119
171
  }
172
+
120
173
  return response;
121
174
  }
122
175
 
176
+ /**
177
+ * @typedef {Object} MigrationsCreateFirebaseMigrationRequestParams
178
+ * @property {string[]} resources List of resources to migrate
179
+ * @property {string} serviceAccount JSON of the Firebase service account credentials
180
+ * @property {boolean} parseOutput
181
+ * @property {libClient | undefined} sdk
182
+ */
183
+
184
+ /**
185
+ * @param {MigrationsCreateFirebaseMigrationRequestParams} params
186
+ */
123
187
  const migrationsCreateFirebaseMigration = async ({ resources, serviceAccount, parseOutput = true, sdk = undefined}) => {
124
- /* @param {string[]} resources */
125
- /* @param {string} serviceAccount */
126
-
127
188
  let client = !sdk ? await sdkForProject() : sdk;
189
+
128
190
  let apiPath = '/migrations/firebase';
129
191
  let payload = {};
130
-
131
- /** Body Params */
132
192
  resources = resources === true ? [] : resources;
133
-
134
193
  if (typeof resources !== 'undefined') {
135
194
  payload['resources'] = resources;
136
195
  }
137
-
138
-
139
196
  if (typeof serviceAccount !== 'undefined') {
140
197
  payload['serviceAccount'] = serviceAccount;
141
198
  }
142
199
 
200
+
143
201
  let response = undefined;
202
+
144
203
  response = await client.call('post', apiPath, {
145
204
  'content-type': 'application/json',
146
205
  }, payload);
206
+
147
207
 
148
208
  if (parseOutput) {
149
209
  parse(response)
150
210
  success()
151
211
  }
212
+
152
213
  return response;
153
214
  }
154
215
 
155
- const migrationsDeleteFirebaseAuth = async ({ parseOutput = true, sdk = undefined}) => {
216
+ /**
217
+ * @typedef {Object} MigrationsDeleteFirebaseAuthRequestParams
218
+ * @property {boolean} parseOutput
219
+ * @property {libClient | undefined} sdk
220
+ */
156
221
 
222
+ /**
223
+ * @param {MigrationsDeleteFirebaseAuthRequestParams} params
224
+ */
225
+ const migrationsDeleteFirebaseAuth = async ({ parseOutput = true, sdk = undefined}) => {
157
226
  let client = !sdk ? await sdkForProject() : sdk;
227
+
158
228
  let apiPath = '/migrations/firebase/deauthorize';
159
229
  let payload = {};
230
+
231
+
160
232
  let response = undefined;
233
+
161
234
  response = await client.call('get', apiPath, {
162
235
  'content-type': 'application/json',
163
236
  }, payload);
237
+
164
238
 
165
239
  if (parseOutput) {
166
240
  parse(response)
167
241
  success()
168
242
  }
243
+
169
244
  return response;
170
245
  }
171
246
 
247
+ /**
248
+ * @typedef {Object} MigrationsCreateFirebaseOAuthMigrationRequestParams
249
+ * @property {string[]} resources List of resources to migrate
250
+ * @property {string} projectId Project ID of the Firebase Project
251
+ * @property {boolean} parseOutput
252
+ * @property {libClient | undefined} sdk
253
+ */
254
+
255
+ /**
256
+ * @param {MigrationsCreateFirebaseOAuthMigrationRequestParams} params
257
+ */
172
258
  const migrationsCreateFirebaseOAuthMigration = async ({ resources, projectId, parseOutput = true, sdk = undefined}) => {
173
- /* @param {string[]} resources */
174
- /* @param {string} projectId */
175
-
176
259
  let client = !sdk ? await sdkForProject() : sdk;
260
+
177
261
  let apiPath = '/migrations/firebase/oauth';
178
262
  let payload = {};
179
-
180
- /** Body Params */
181
263
  resources = resources === true ? [] : resources;
182
-
183
264
  if (typeof resources !== 'undefined') {
184
265
  payload['resources'] = resources;
185
266
  }
186
-
187
-
188
267
  if (typeof projectId !== 'undefined') {
189
268
  payload['projectId'] = projectId;
190
269
  }
191
270
 
271
+
192
272
  let response = undefined;
273
+
193
274
  response = await client.call('post', apiPath, {
194
275
  'content-type': 'application/json',
195
276
  }, payload);
277
+
196
278
 
197
279
  if (parseOutput) {
198
280
  parse(response)
199
281
  success()
200
282
  }
283
+
201
284
  return response;
202
285
  }
203
286
 
204
- const migrationsListFirebaseProjects = async ({ parseOutput = true, sdk = undefined}) => {
287
+ /**
288
+ * @typedef {Object} MigrationsListFirebaseProjectsRequestParams
289
+ * @property {boolean} parseOutput
290
+ * @property {libClient | undefined} sdk
291
+ */
205
292
 
293
+ /**
294
+ * @param {MigrationsListFirebaseProjectsRequestParams} params
295
+ */
296
+ const migrationsListFirebaseProjects = async ({ parseOutput = true, sdk = undefined}) => {
206
297
  let client = !sdk ? await sdkForProject() : sdk;
298
+
207
299
  let apiPath = '/migrations/firebase/projects';
208
300
  let payload = {};
301
+
302
+
209
303
  let response = undefined;
304
+
210
305
  response = await client.call('get', apiPath, {
211
306
  'content-type': 'application/json',
212
307
  }, payload);
308
+
213
309
 
214
310
  if (parseOutput) {
215
311
  parse(response)
216
312
  success()
217
313
  }
314
+
218
315
  return response;
219
316
  }
220
317
 
318
+ /**
319
+ * @typedef {Object} MigrationsGetFirebaseReportRequestParams
320
+ * @property {string[]} resources List of resources to migrate
321
+ * @property {string} serviceAccount JSON of the Firebase service account credentials
322
+ * @property {boolean} parseOutput
323
+ * @property {libClient | undefined} sdk
324
+ */
325
+
326
+ /**
327
+ * @param {MigrationsGetFirebaseReportRequestParams} params
328
+ */
221
329
  const migrationsGetFirebaseReport = async ({ resources, serviceAccount, parseOutput = true, sdk = undefined}) => {
222
- /* @param {string[]} resources */
223
- /* @param {string} serviceAccount */
224
-
225
330
  let client = !sdk ? await sdkForProject() : sdk;
331
+
226
332
  let apiPath = '/migrations/firebase/report';
227
333
  let payload = {};
228
-
229
- /** Query Params */
230
334
  if (typeof resources !== 'undefined') {
231
335
  payload['resources'] = resources;
232
336
  }
233
337
  if (typeof serviceAccount !== 'undefined') {
234
338
  payload['serviceAccount'] = serviceAccount;
235
339
  }
340
+
341
+
236
342
  let response = undefined;
343
+
237
344
  response = await client.call('get', apiPath, {
238
345
  'content-type': 'application/json',
239
346
  }, payload);
347
+
240
348
 
241
349
  if (parseOutput) {
242
350
  parse(response)
243
351
  success()
244
352
  }
353
+
245
354
  return response;
246
355
  }
247
356
 
357
+ /**
358
+ * @typedef {Object} MigrationsGetFirebaseReportOAuthRequestParams
359
+ * @property {string[]} resources List of resources to migrate
360
+ * @property {string} projectId Project ID
361
+ * @property {boolean} parseOutput
362
+ * @property {libClient | undefined} sdk
363
+ */
364
+
365
+ /**
366
+ * @param {MigrationsGetFirebaseReportOAuthRequestParams} params
367
+ */
248
368
  const migrationsGetFirebaseReportOAuth = async ({ resources, projectId, parseOutput = true, sdk = undefined}) => {
249
- /* @param {string[]} resources */
250
- /* @param {string} projectId */
251
-
252
369
  let client = !sdk ? await sdkForProject() : sdk;
370
+
253
371
  let apiPath = '/migrations/firebase/report/oauth';
254
372
  let payload = {};
255
-
256
- /** Query Params */
257
373
  if (typeof resources !== 'undefined') {
258
374
  payload['resources'] = resources;
259
375
  }
260
376
  if (typeof projectId !== 'undefined') {
261
377
  payload['projectId'] = projectId;
262
378
  }
379
+
380
+
263
381
  let response = undefined;
382
+
264
383
  response = await client.call('get', apiPath, {
265
384
  'content-type': 'application/json',
266
385
  }, payload);
386
+
267
387
 
268
388
  if (parseOutput) {
269
389
  parse(response)
270
390
  success()
271
391
  }
392
+
272
393
  return response;
273
394
  }
274
395
 
396
+ /**
397
+ * @typedef {Object} MigrationsCreateNHostMigrationRequestParams
398
+ * @property {string[]} resources List of resources to migrate
399
+ * @property {string} subdomain Source's Subdomain
400
+ * @property {string} region Source's Region
401
+ * @property {string} adminSecret Source's Admin Secret
402
+ * @property {string} database Source's Database Name
403
+ * @property {string} username Source's Database Username
404
+ * @property {string} password Source's Database Password
405
+ * @property {number} port Source's Database Port
406
+ * @property {boolean} parseOutput
407
+ * @property {libClient | undefined} sdk
408
+ */
409
+
410
+ /**
411
+ * @param {MigrationsCreateNHostMigrationRequestParams} params
412
+ */
275
413
  const migrationsCreateNHostMigration = async ({ resources, subdomain, region, adminSecret, database, username, password, port, parseOutput = true, sdk = undefined}) => {
276
- /* @param {string[]} resources */
277
- /* @param {string} subdomain */
278
- /* @param {string} region */
279
- /* @param {string} adminSecret */
280
- /* @param {string} database */
281
- /* @param {string} username */
282
- /* @param {string} password */
283
- /* @param {number} port */
284
-
285
414
  let client = !sdk ? await sdkForProject() : sdk;
415
+
286
416
  let apiPath = '/migrations/nhost';
287
417
  let payload = {};
288
-
289
- /** Body Params */
290
418
  resources = resources === true ? [] : resources;
291
-
292
419
  if (typeof resources !== 'undefined') {
293
420
  payload['resources'] = resources;
294
421
  }
295
-
296
-
297
422
  if (typeof subdomain !== 'undefined') {
298
423
  payload['subdomain'] = subdomain;
299
424
  }
300
-
301
-
302
425
  if (typeof region !== 'undefined') {
303
426
  payload['region'] = region;
304
427
  }
305
-
306
-
307
428
  if (typeof adminSecret !== 'undefined') {
308
429
  payload['adminSecret'] = adminSecret;
309
430
  }
310
-
311
-
312
431
  if (typeof database !== 'undefined') {
313
432
  payload['database'] = database;
314
433
  }
315
-
316
-
317
434
  if (typeof username !== 'undefined') {
318
435
  payload['username'] = username;
319
436
  }
320
-
321
-
322
437
  if (typeof password !== 'undefined') {
323
438
  payload['password'] = password;
324
439
  }
325
-
326
-
327
440
  if (typeof port !== 'undefined') {
328
441
  payload['port'] = port;
329
442
  }
330
443
 
444
+
331
445
  let response = undefined;
446
+
332
447
  response = await client.call('post', apiPath, {
333
448
  'content-type': 'application/json',
334
449
  }, payload);
450
+
335
451
 
336
452
  if (parseOutput) {
337
453
  parse(response)
338
454
  success()
339
455
  }
456
+
340
457
  return response;
341
458
  }
342
459
 
460
+ /**
461
+ * @typedef {Object} MigrationsGetNHostReportRequestParams
462
+ * @property {string[]} resources List of resources to migrate.
463
+ * @property {string} subdomain Source's Subdomain.
464
+ * @property {string} region Source's Region.
465
+ * @property {string} adminSecret Source's Admin Secret.
466
+ * @property {string} database Source's Database Name.
467
+ * @property {string} username Source's Database Username.
468
+ * @property {string} password Source's Database Password.
469
+ * @property {number} port Source's Database Port.
470
+ * @property {boolean} parseOutput
471
+ * @property {libClient | undefined} sdk
472
+ */
473
+
474
+ /**
475
+ * @param {MigrationsGetNHostReportRequestParams} params
476
+ */
343
477
  const migrationsGetNHostReport = async ({ resources, subdomain, region, adminSecret, database, username, password, port, parseOutput = true, sdk = undefined}) => {
344
- /* @param {string[]} resources */
345
- /* @param {string} subdomain */
346
- /* @param {string} region */
347
- /* @param {string} adminSecret */
348
- /* @param {string} database */
349
- /* @param {string} username */
350
- /* @param {string} password */
351
- /* @param {number} port */
352
-
353
478
  let client = !sdk ? await sdkForProject() : sdk;
479
+
354
480
  let apiPath = '/migrations/nhost/report';
355
481
  let payload = {};
356
-
357
- /** Query Params */
358
482
  if (typeof resources !== 'undefined') {
359
483
  payload['resources'] = resources;
360
484
  }
@@ -379,94 +503,104 @@ const migrationsGetNHostReport = async ({ resources, subdomain, region, adminSec
379
503
  if (typeof port !== 'undefined') {
380
504
  payload['port'] = port;
381
505
  }
506
+
507
+
382
508
  let response = undefined;
509
+
383
510
  response = await client.call('get', apiPath, {
384
511
  'content-type': 'application/json',
385
512
  }, payload);
513
+
386
514
 
387
515
  if (parseOutput) {
388
516
  parse(response)
389
517
  success()
390
518
  }
519
+
391
520
  return response;
392
521
  }
393
522
 
523
+ /**
524
+ * @typedef {Object} MigrationsCreateSupabaseMigrationRequestParams
525
+ * @property {string[]} resources List of resources to migrate
526
+ * @property {string} endpoint Source's Supabase Endpoint
527
+ * @property {string} apiKey Source's API Key
528
+ * @property {string} databaseHost Source's Database Host
529
+ * @property {string} username Source's Database Username
530
+ * @property {string} password Source's Database Password
531
+ * @property {number} port Source's Database Port
532
+ * @property {boolean} parseOutput
533
+ * @property {libClient | undefined} sdk
534
+ */
535
+
536
+ /**
537
+ * @param {MigrationsCreateSupabaseMigrationRequestParams} params
538
+ */
394
539
  const migrationsCreateSupabaseMigration = async ({ resources, endpoint, apiKey, databaseHost, username, password, port, parseOutput = true, sdk = undefined}) => {
395
- /* @param {string[]} resources */
396
- /* @param {string} endpoint */
397
- /* @param {string} apiKey */
398
- /* @param {string} databaseHost */
399
- /* @param {string} username */
400
- /* @param {string} password */
401
- /* @param {number} port */
402
-
403
540
  let client = !sdk ? await sdkForProject() : sdk;
541
+
404
542
  let apiPath = '/migrations/supabase';
405
543
  let payload = {};
406
-
407
- /** Body Params */
408
544
  resources = resources === true ? [] : resources;
409
-
410
545
  if (typeof resources !== 'undefined') {
411
546
  payload['resources'] = resources;
412
547
  }
413
-
414
-
415
548
  if (typeof endpoint !== 'undefined') {
416
549
  payload['endpoint'] = endpoint;
417
550
  }
418
-
419
-
420
551
  if (typeof apiKey !== 'undefined') {
421
552
  payload['apiKey'] = apiKey;
422
553
  }
423
-
424
-
425
554
  if (typeof databaseHost !== 'undefined') {
426
555
  payload['databaseHost'] = databaseHost;
427
556
  }
428
-
429
-
430
557
  if (typeof username !== 'undefined') {
431
558
  payload['username'] = username;
432
559
  }
433
-
434
-
435
560
  if (typeof password !== 'undefined') {
436
561
  payload['password'] = password;
437
562
  }
438
-
439
-
440
563
  if (typeof port !== 'undefined') {
441
564
  payload['port'] = port;
442
565
  }
443
566
 
567
+
444
568
  let response = undefined;
569
+
445
570
  response = await client.call('post', apiPath, {
446
571
  'content-type': 'application/json',
447
572
  }, payload);
573
+
448
574
 
449
575
  if (parseOutput) {
450
576
  parse(response)
451
577
  success()
452
578
  }
579
+
453
580
  return response;
454
581
  }
455
582
 
583
+ /**
584
+ * @typedef {Object} MigrationsGetSupabaseReportRequestParams
585
+ * @property {string[]} resources List of resources to migrate
586
+ * @property {string} endpoint Source's Supabase Endpoint.
587
+ * @property {string} apiKey Source's API Key.
588
+ * @property {string} databaseHost Source's Database Host.
589
+ * @property {string} username Source's Database Username.
590
+ * @property {string} password Source's Database Password.
591
+ * @property {number} port Source's Database Port.
592
+ * @property {boolean} parseOutput
593
+ * @property {libClient | undefined} sdk
594
+ */
595
+
596
+ /**
597
+ * @param {MigrationsGetSupabaseReportRequestParams} params
598
+ */
456
599
  const migrationsGetSupabaseReport = async ({ resources, endpoint, apiKey, databaseHost, username, password, port, parseOutput = true, sdk = undefined}) => {
457
- /* @param {string[]} resources */
458
- /* @param {string} endpoint */
459
- /* @param {string} apiKey */
460
- /* @param {string} databaseHost */
461
- /* @param {string} username */
462
- /* @param {string} password */
463
- /* @param {number} port */
464
-
465
600
  let client = !sdk ? await sdkForProject() : sdk;
601
+
466
602
  let apiPath = '/migrations/supabase/report';
467
603
  let payload = {};
468
-
469
- /** Query Params */
470
604
  if (typeof resources !== 'undefined') {
471
605
  payload['resources'] = resources;
472
606
  }
@@ -488,69 +622,116 @@ const migrationsGetSupabaseReport = async ({ resources, endpoint, apiKey, databa
488
622
  if (typeof port !== 'undefined') {
489
623
  payload['port'] = port;
490
624
  }
625
+
626
+
491
627
  let response = undefined;
628
+
492
629
  response = await client.call('get', apiPath, {
493
630
  'content-type': 'application/json',
494
631
  }, payload);
632
+
495
633
 
496
634
  if (parseOutput) {
497
635
  parse(response)
498
636
  success()
499
637
  }
638
+
500
639
  return response;
501
640
  }
502
641
 
503
- const migrationsGet = async ({ migrationId, parseOutput = true, sdk = undefined}) => {
504
- /* @param {string} migrationId */
642
+ /**
643
+ * @typedef {Object} MigrationsGetRequestParams
644
+ * @property {string} migrationId Migration unique ID.
645
+ * @property {boolean} parseOutput
646
+ * @property {libClient | undefined} sdk
647
+ */
505
648
 
649
+ /**
650
+ * @param {MigrationsGetRequestParams} params
651
+ */
652
+ const migrationsGet = async ({ migrationId, parseOutput = true, sdk = undefined}) => {
506
653
  let client = !sdk ? await sdkForProject() : sdk;
654
+
507
655
  let apiPath = '/migrations/{migrationId}'.replace('{migrationId}', migrationId);
508
656
  let payload = {};
657
+
658
+
509
659
  let response = undefined;
660
+
510
661
  response = await client.call('get', apiPath, {
511
662
  'content-type': 'application/json',
512
663
  }, payload);
664
+
513
665
 
514
666
  if (parseOutput) {
515
667
  parse(response)
516
668
  success()
517
669
  }
670
+
518
671
  return response;
519
672
  }
520
673
 
521
- const migrationsRetry = async ({ migrationId, parseOutput = true, sdk = undefined}) => {
522
- /* @param {string} migrationId */
674
+ /**
675
+ * @typedef {Object} MigrationsRetryRequestParams
676
+ * @property {string} migrationId Migration unique ID.
677
+ * @property {boolean} parseOutput
678
+ * @property {libClient | undefined} sdk
679
+ */
523
680
 
681
+ /**
682
+ * @param {MigrationsRetryRequestParams} params
683
+ */
684
+ const migrationsRetry = async ({ migrationId, parseOutput = true, sdk = undefined}) => {
524
685
  let client = !sdk ? await sdkForProject() : sdk;
686
+
525
687
  let apiPath = '/migrations/{migrationId}'.replace('{migrationId}', migrationId);
526
688
  let payload = {};
689
+
690
+
527
691
  let response = undefined;
692
+
528
693
  response = await client.call('patch', apiPath, {
529
694
  'content-type': 'application/json',
530
695
  }, payload);
696
+
531
697
 
532
698
  if (parseOutput) {
533
699
  parse(response)
534
700
  success()
535
701
  }
702
+
536
703
  return response;
537
704
  }
538
705
 
539
- const migrationsDelete = async ({ migrationId, parseOutput = true, sdk = undefined}) => {
540
- /* @param {string} migrationId */
706
+ /**
707
+ * @typedef {Object} MigrationsDeleteRequestParams
708
+ * @property {string} migrationId Migration ID.
709
+ * @property {boolean} parseOutput
710
+ * @property {libClient | undefined} sdk
711
+ */
541
712
 
713
+ /**
714
+ * @param {MigrationsDeleteRequestParams} params
715
+ */
716
+ const migrationsDelete = async ({ migrationId, parseOutput = true, sdk = undefined}) => {
542
717
  let client = !sdk ? await sdkForProject() : sdk;
718
+
543
719
  let apiPath = '/migrations/{migrationId}'.replace('{migrationId}', migrationId);
544
720
  let payload = {};
721
+
722
+
545
723
  let response = undefined;
724
+
546
725
  response = await client.call('delete', apiPath, {
547
726
  'content-type': 'application/json',
548
727
  }, payload);
728
+
549
729
 
550
730
  if (parseOutput) {
551
731
  parse(response)
552
732
  success()
553
733
  }
734
+
554
735
  return response;
555
736
  }
556
737
 
@@ -689,20 +870,20 @@ migrations
689
870
 
690
871
  module.exports = {
691
872
  migrations,
692
- migrationsList,
693
- migrationsCreateAppwriteMigration,
694
- migrationsGetAppwriteReport,
695
- migrationsCreateFirebaseMigration,
696
- migrationsDeleteFirebaseAuth,
697
- migrationsCreateFirebaseOAuthMigration,
698
- migrationsListFirebaseProjects,
699
- migrationsGetFirebaseReport,
700
- migrationsGetFirebaseReportOAuth,
701
- migrationsCreateNHostMigration,
702
- migrationsGetNHostReport,
703
- migrationsCreateSupabaseMigration,
704
- migrationsGetSupabaseReport,
705
- migrationsGet,
706
- migrationsRetry,
707
- migrationsDelete
708
- };
873
+ migrationsList,
874
+ migrationsCreateAppwriteMigration,
875
+ migrationsGetAppwriteReport,
876
+ migrationsCreateFirebaseMigration,
877
+ migrationsDeleteFirebaseAuth,
878
+ migrationsCreateFirebaseOAuthMigration,
879
+ migrationsListFirebaseProjects,
880
+ migrationsGetFirebaseReport,
881
+ migrationsGetFirebaseReportOAuth,
882
+ migrationsCreateNHostMigration,
883
+ migrationsGetNHostReport,
884
+ migrationsCreateSupabaseMigration,
885
+ migrationsGetSupabaseReport,
886
+ migrationsGet,
887
+ migrationsRetry,
888
+ migrationsDelete
889
+ };