appwrite-cli 6.1.0 → 6.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.
@@ -41,7 +41,7 @@ const migrations = new Command("migrations").description(commandDescriptions['mi
41
41
 
42
42
  /**
43
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
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, destination, resources, statusCounters, resourceData, errors
45
45
  * @property {string} search Search term to filter your list results. Max length: 256 chars.
46
46
  * @property {boolean} overrideForCli
47
47
  * @property {boolean} parseOutput
@@ -209,105 +209,6 @@ const migrationsCreateFirebaseMigration = async ({resources,serviceAccount,parse
209
209
 
210
210
  }
211
211
 
212
- /**
213
- * @typedef {Object} MigrationsDeleteFirebaseAuthRequestParams
214
- * @property {boolean} overrideForCli
215
- * @property {boolean} parseOutput
216
- * @property {libClient | undefined} sdk
217
- */
218
-
219
- /**
220
- * @param {MigrationsDeleteFirebaseAuthRequestParams} params
221
- */
222
- const migrationsDeleteFirebaseAuth = async ({parseOutput = true, overrideForCli = false, sdk = undefined}) => {
223
- let client = !sdk ? await sdkForProject() :
224
- sdk;
225
- let apiPath = '/migrations/firebase/deauthorize';
226
- let payload = {};
227
-
228
- let response = undefined;
229
-
230
- response = await client.call('get', apiPath, {
231
- 'content-type': 'application/json',
232
- }, payload);
233
-
234
- if (parseOutput) {
235
- parse(response)
236
- }
237
-
238
- return response;
239
-
240
- }
241
-
242
- /**
243
- * @typedef {Object} MigrationsCreateFirebaseOAuthMigrationRequestParams
244
- * @property {string[]} resources List of resources to migrate
245
- * @property {string} projectId Project ID of the Firebase Project
246
- * @property {boolean} overrideForCli
247
- * @property {boolean} parseOutput
248
- * @property {libClient | undefined} sdk
249
- */
250
-
251
- /**
252
- * @param {MigrationsCreateFirebaseOAuthMigrationRequestParams} params
253
- */
254
- const migrationsCreateFirebaseOAuthMigration = async ({resources,projectId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
255
- let client = !sdk ? await sdkForProject() :
256
- sdk;
257
- let apiPath = '/migrations/firebase/oauth';
258
- let payload = {};
259
- resources = resources === true ? [] : resources;
260
- if (typeof resources !== 'undefined') {
261
- payload['resources'] = resources;
262
- }
263
- if (typeof projectId !== 'undefined') {
264
- payload['projectId'] = projectId;
265
- }
266
-
267
- let response = undefined;
268
-
269
- response = await client.call('post', apiPath, {
270
- 'content-type': 'application/json',
271
- }, payload);
272
-
273
- if (parseOutput) {
274
- parse(response)
275
- }
276
-
277
- return response;
278
-
279
- }
280
-
281
- /**
282
- * @typedef {Object} MigrationsListFirebaseProjectsRequestParams
283
- * @property {boolean} overrideForCli
284
- * @property {boolean} parseOutput
285
- * @property {libClient | undefined} sdk
286
- */
287
-
288
- /**
289
- * @param {MigrationsListFirebaseProjectsRequestParams} params
290
- */
291
- const migrationsListFirebaseProjects = async ({parseOutput = true, overrideForCli = false, sdk = undefined}) => {
292
- let client = !sdk ? await sdkForProject() :
293
- sdk;
294
- let apiPath = '/migrations/firebase/projects';
295
- let payload = {};
296
-
297
- let response = undefined;
298
-
299
- response = await client.call('get', apiPath, {
300
- 'content-type': 'application/json',
301
- }, payload);
302
-
303
- if (parseOutput) {
304
- parse(response)
305
- }
306
-
307
- return response;
308
-
309
- }
310
-
311
212
  /**
312
213
  * @typedef {Object} MigrationsGetFirebaseReportRequestParams
313
214
  * @property {string[]} resources List of resources to migrate
@@ -346,44 +247,6 @@ const migrationsGetFirebaseReport = async ({resources,serviceAccount,parseOutput
346
247
 
347
248
  }
348
249
 
349
- /**
350
- * @typedef {Object} MigrationsGetFirebaseReportOAuthRequestParams
351
- * @property {string[]} resources List of resources to migrate
352
- * @property {string} projectId Project ID
353
- * @property {boolean} overrideForCli
354
- * @property {boolean} parseOutput
355
- * @property {libClient | undefined} sdk
356
- */
357
-
358
- /**
359
- * @param {MigrationsGetFirebaseReportOAuthRequestParams} params
360
- */
361
- const migrationsGetFirebaseReportOAuth = async ({resources,projectId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
362
- let client = !sdk ? await sdkForProject() :
363
- sdk;
364
- let apiPath = '/migrations/firebase/report/oauth';
365
- let payload = {};
366
- if (typeof resources !== 'undefined') {
367
- payload['resources'] = resources;
368
- }
369
- if (typeof projectId !== 'undefined') {
370
- payload['projectId'] = projectId;
371
- }
372
-
373
- let response = undefined;
374
-
375
- response = await client.call('get', apiPath, {
376
- 'content-type': 'application/json',
377
- }, payload);
378
-
379
- if (parseOutput) {
380
- parse(response)
381
- }
382
-
383
- return response;
384
-
385
- }
386
-
387
250
  /**
388
251
  * @typedef {Object} MigrationsCreateNHostMigrationRequestParams
389
252
  * @property {string[]} resources List of resources to migrate
@@ -721,14 +584,14 @@ const migrationsDelete = async ({migrationId,parseOutput = true, overrideForCli
721
584
 
722
585
  migrations
723
586
  .command(`list`)
724
- .description(``)
725
- .option(`--queries [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`)
587
+ .description(`List all migrations in the current project. This endpoint returns a list of all migrations including their status, progress, and any errors that occurred during the migration process.`)
588
+ .option(`--queries [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, destination, resources, statusCounters, resourceData, errors`)
726
589
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
727
590
  .action(actionRunner(migrationsList))
728
591
 
729
592
  migrations
730
593
  .command(`create-appwrite-migration`)
731
- .description(``)
594
+ .description(`Migrate data from another Appwrite project to your current project. This endpoint allows you to migrate resources like databases, collections, documents, users, and files from an existing Appwrite project. `)
732
595
  .requiredOption(`--resources [resources...]`, `List of resources to migrate`)
733
596
  .requiredOption(`--endpoint <endpoint>`, `Source's Appwrite Endpoint`)
734
597
  .requiredOption(`--project-id <project-id>`, `Source's Project ID`)
@@ -737,7 +600,7 @@ migrations
737
600
 
738
601
  migrations
739
602
  .command(`get-appwrite-report`)
740
- .description(``)
603
+ .description(`Generate a report of the data in an Appwrite project before migrating. This endpoint analyzes the source project and returns information about the resources that can be migrated.`)
741
604
  .requiredOption(`--resources [resources...]`, `List of resources to migrate`)
742
605
  .requiredOption(`--endpoint <endpoint>`, `Source's Appwrite Endpoint`)
743
606
  .requiredOption(`--project-id <project-id>`, `Source's Project ID`)
@@ -746,45 +609,21 @@ migrations
746
609
 
747
610
  migrations
748
611
  .command(`create-firebase-migration`)
749
- .description(``)
612
+ .description(`Migrate data from a Firebase project to your Appwrite project. This endpoint allows you to migrate resources like authentication and other supported services from a Firebase project. `)
750
613
  .requiredOption(`--resources [resources...]`, `List of resources to migrate`)
751
614
  .requiredOption(`--service-account <service-account>`, `JSON of the Firebase service account credentials`)
752
615
  .action(actionRunner(migrationsCreateFirebaseMigration))
753
616
 
754
- migrations
755
- .command(`delete-firebase-auth`)
756
- .description(``)
757
- .action(actionRunner(migrationsDeleteFirebaseAuth))
758
-
759
- migrations
760
- .command(`create-firebase-o-auth-migration`)
761
- .description(``)
762
- .requiredOption(`--resources [resources...]`, `List of resources to migrate`)
763
- .requiredOption(`--project-id <project-id>`, `Project ID of the Firebase Project`)
764
- .action(actionRunner(migrationsCreateFirebaseOAuthMigration))
765
-
766
- migrations
767
- .command(`list-firebase-projects`)
768
- .description(``)
769
- .action(actionRunner(migrationsListFirebaseProjects))
770
-
771
617
  migrations
772
618
  .command(`get-firebase-report`)
773
- .description(``)
619
+ .description(`Generate a report of the data in a Firebase project before migrating. This endpoint analyzes the source project and returns information about the resources that can be migrated.`)
774
620
  .requiredOption(`--resources [resources...]`, `List of resources to migrate`)
775
621
  .requiredOption(`--service-account <service-account>`, `JSON of the Firebase service account credentials`)
776
622
  .action(actionRunner(migrationsGetFirebaseReport))
777
623
 
778
- migrations
779
- .command(`get-firebase-report-o-auth`)
780
- .description(``)
781
- .requiredOption(`--resources [resources...]`, `List of resources to migrate`)
782
- .requiredOption(`--project-id <project-id>`, `Project ID`)
783
- .action(actionRunner(migrationsGetFirebaseReportOAuth))
784
-
785
624
  migrations
786
625
  .command(`create-n-host-migration`)
787
- .description(``)
626
+ .description(`Migrate data from an NHost project to your Appwrite project. This endpoint allows you to migrate resources like authentication, databases, and other supported services from an NHost project. `)
788
627
  .requiredOption(`--resources [resources...]`, `List of resources to migrate`)
789
628
  .requiredOption(`--subdomain <subdomain>`, `Source's Subdomain`)
790
629
  .requiredOption(`--region <region>`, `Source's Region`)
@@ -797,7 +636,7 @@ migrations
797
636
 
798
637
  migrations
799
638
  .command(`get-n-host-report`)
800
- .description(``)
639
+ .description(`Generate a detailed report of the data in an NHost project before migrating. This endpoint analyzes the source project and returns information about the resources that can be migrated. `)
801
640
  .requiredOption(`--resources [resources...]`, `List of resources to migrate.`)
802
641
  .requiredOption(`--subdomain <subdomain>`, `Source's Subdomain.`)
803
642
  .requiredOption(`--region <region>`, `Source's Region.`)
@@ -810,7 +649,7 @@ migrations
810
649
 
811
650
  migrations
812
651
  .command(`create-supabase-migration`)
813
- .description(``)
652
+ .description(`Migrate data from a Supabase project to your Appwrite project. This endpoint allows you to migrate resources like authentication, databases, and other supported services from a Supabase project. `)
814
653
  .requiredOption(`--resources [resources...]`, `List of resources to migrate`)
815
654
  .requiredOption(`--endpoint <endpoint>`, `Source's Supabase Endpoint`)
816
655
  .requiredOption(`--api-key <api-key>`, `Source's API Key`)
@@ -822,7 +661,7 @@ migrations
822
661
 
823
662
  migrations
824
663
  .command(`get-supabase-report`)
825
- .description(``)
664
+ .description(`Generate a report of the data in a Supabase project before migrating. This endpoint analyzes the source project and returns information about the resources that can be migrated. `)
826
665
  .requiredOption(`--resources [resources...]`, `List of resources to migrate`)
827
666
  .requiredOption(`--endpoint <endpoint>`, `Source's Supabase Endpoint.`)
828
667
  .requiredOption(`--api-key <api-key>`, `Source's API Key.`)
@@ -834,19 +673,19 @@ migrations
834
673
 
835
674
  migrations
836
675
  .command(`get`)
837
- .description(``)
676
+ .description(`Get a migration by its unique ID. This endpoint returns detailed information about a specific migration including its current status, progress, and any errors that occurred during the migration process. `)
838
677
  .requiredOption(`--migration-id <migration-id>`, `Migration unique ID.`)
839
678
  .action(actionRunner(migrationsGet))
840
679
 
841
680
  migrations
842
681
  .command(`retry`)
843
- .description(``)
682
+ .description(`Retry a failed migration. This endpoint allows you to retry a migration that has previously failed.`)
844
683
  .requiredOption(`--migration-id <migration-id>`, `Migration unique ID.`)
845
684
  .action(actionRunner(migrationsRetry))
846
685
 
847
686
  migrations
848
687
  .command(`delete`)
849
- .description(``)
688
+ .description(`Delete a migration by its unique ID. This endpoint allows you to remove a migration from your project's migration history. `)
850
689
  .requiredOption(`--migration-id <migration-id>`, `Migration ID.`)
851
690
  .action(actionRunner(migrationsDelete))
852
691
 
@@ -856,11 +695,7 @@ module.exports = {
856
695
  migrationsCreateAppwriteMigration,
857
696
  migrationsGetAppwriteReport,
858
697
  migrationsCreateFirebaseMigration,
859
- migrationsDeleteFirebaseAuth,
860
- migrationsCreateFirebaseOAuthMigration,
861
- migrationsListFirebaseProjects,
862
698
  migrationsGetFirebaseReport,
863
- migrationsGetFirebaseReportOAuth,
864
699
  migrationsCreateNHostMigration,
865
700
  migrationsGetNHostReport,
866
701
  migrationsCreateSupabaseMigration,
@@ -0,0 +1,48 @@
1
+ const { sdkForProject } = require('../sdks')
2
+ const { parse } = require('../parser')
3
+ const { showConsoleLink } = require('../utils.js');
4
+
5
+ /**
6
+ * @typedef {Object} OrganizationsListRequestParams
7
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, total, billingPlan
8
+ * @property {string} search Search term to filter your list results. Max length: 256 chars.
9
+ * @property {boolean} parseOutput
10
+ * @property {libClient | undefined} sdk
11
+ */
12
+
13
+ /**
14
+ * @param {OrganizationsListRequestParams} params
15
+ */
16
+ const organizationsList = async ({queries, search, parseOutput = true, sdk = undefined, console}) => {
17
+ let client = !sdk ? await sdkForProject() :
18
+ sdk;
19
+ let apiPath = '/organizations';
20
+ let payload = {};
21
+ if (typeof queries !== 'undefined') {
22
+ payload['queries'] = queries;
23
+ }
24
+ if (typeof search !== 'undefined') {
25
+ payload['search'] = search;
26
+ }
27
+
28
+ let response = undefined;
29
+
30
+ response = await client.call('get', apiPath, {
31
+ 'content-type': 'application/json',
32
+ }, payload);
33
+
34
+ if (parseOutput) {
35
+ if(console) {
36
+ showConsoleLink('organizations', 'list');
37
+ } else {
38
+ parse(response)
39
+ }
40
+ }
41
+
42
+ return response;
43
+
44
+ }
45
+
46
+ module.exports = {
47
+ organizationsList
48
+ }
@@ -252,7 +252,7 @@ const projectDeleteVariable = async ({variableId,parseOutput = true, overrideFor
252
252
 
253
253
  project
254
254
  .command(`get-usage`)
255
- .description(``)
255
+ .description(`Get comprehensive usage statistics for your project. View metrics including network requests, bandwidth, storage, function executions, database usage, and user activity. Specify a time range with startDate and endDate, and optionally set the data granularity with period (1h or 1d). The response includes both total counts and detailed breakdowns by resource, along with historical data over the specified period.`)
256
256
  .requiredOption(`--start-date <start-date>`, `Starting date for the usage`)
257
257
  .requiredOption(`--end-date <end-date>`, `End date for the usage`)
258
258
  .option(`--period <period>`, `Period used`)