appwrite-cli 16.0.0 → 17.1.0

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 (81) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +4 -4
  3. package/cli.ts +6 -0
  4. package/dist/bundle-win-arm64.mjs +1355 -773
  5. package/dist/cli.cjs +1327 -745
  6. package/dist/index.cjs +466 -572
  7. package/dist/index.js +494 -600
  8. package/dist/lib/commands/push.d.ts.map +1 -1
  9. package/dist/lib/commands/run.d.ts.map +1 -1
  10. package/dist/lib/commands/services/organizations.d.ts +3 -0
  11. package/dist/lib/commands/services/organizations.d.ts.map +1 -0
  12. package/dist/lib/commands/services/teams.d.ts.map +1 -1
  13. package/dist/lib/constants.d.ts +1 -1
  14. package/dist/lib/emulation/utils.d.ts.map +1 -1
  15. package/dist/lib/parser.d.ts.map +1 -1
  16. package/dist/lib/questions.d.ts.map +1 -1
  17. package/dist/lib/types.d.ts +1 -0
  18. package/dist/lib/types.d.ts.map +1 -1
  19. package/docs/examples/organizations/add-credit.md +5 -0
  20. package/docs/examples/organizations/cancel-downgrade.md +4 -0
  21. package/docs/examples/organizations/create-downgrade-feedback.md +8 -0
  22. package/docs/examples/organizations/create-invoice-payment.md +6 -0
  23. package/docs/examples/organizations/create-key.md +6 -0
  24. package/docs/examples/organizations/create.md +6 -0
  25. package/docs/examples/organizations/delete-backup-payment-method.md +4 -0
  26. package/docs/examples/organizations/delete-default-payment-method.md +4 -0
  27. package/docs/examples/organizations/delete-key.md +5 -0
  28. package/docs/examples/organizations/delete.md +4 -0
  29. package/docs/examples/organizations/estimation-create-organization.md +4 -0
  30. package/docs/examples/organizations/estimation-delete-organization.md +4 -0
  31. package/docs/examples/organizations/estimation-update-plan.md +5 -0
  32. package/docs/examples/organizations/get-aggregation.md +5 -0
  33. package/docs/examples/organizations/get-available-credits.md +4 -0
  34. package/docs/examples/organizations/get-credit.md +5 -0
  35. package/docs/examples/organizations/get-invoice-download.md +5 -0
  36. package/docs/examples/organizations/get-invoice-view.md +5 -0
  37. package/docs/examples/organizations/get-invoice.md +5 -0
  38. package/docs/examples/organizations/get-key.md +5 -0
  39. package/docs/examples/organizations/get-plan.md +4 -0
  40. package/docs/examples/organizations/get-scopes.md +4 -0
  41. package/docs/examples/organizations/get-usage.md +4 -0
  42. package/docs/examples/organizations/list-aggregations.md +4 -0
  43. package/docs/examples/organizations/list-credits.md +4 -0
  44. package/docs/examples/organizations/list-keys.md +4 -0
  45. package/docs/examples/organizations/list-regions.md +4 -0
  46. package/docs/examples/organizations/list.md +3 -0
  47. package/docs/examples/organizations/set-backup-payment-method.md +5 -0
  48. package/docs/examples/organizations/set-billing-address.md +5 -0
  49. package/docs/examples/organizations/set-billing-email.md +5 -0
  50. package/docs/examples/organizations/set-billing-tax-id.md +5 -0
  51. package/docs/examples/organizations/set-default-payment-method.md +5 -0
  52. package/docs/examples/organizations/update-budget.md +5 -0
  53. package/docs/examples/organizations/update-key.md +7 -0
  54. package/docs/examples/organizations/update-plan.md +5 -0
  55. package/docs/examples/organizations/validate-invoice.md +5 -0
  56. package/docs/examples/organizations/validate-payment.md +4 -0
  57. package/docs/examples/project/create-variable.md +1 -0
  58. package/docs/examples/project/update-variable.md +1 -2
  59. package/docs/examples/users/update-impersonator.md +5 -0
  60. package/install.ps1 +2 -2
  61. package/install.sh +1 -1
  62. package/lib/commands/push.ts +6 -24
  63. package/lib/commands/run.ts +5 -7
  64. package/lib/commands/services/account.ts +0 -169
  65. package/lib/commands/services/health.ts +0 -68
  66. package/lib/commands/services/migrations.ts +2 -2
  67. package/lib/commands/services/organizations.ts +517 -0
  68. package/lib/commands/services/project.ts +21 -12
  69. package/lib/commands/services/projects.ts +2 -14
  70. package/lib/commands/services/proxy.ts +2 -2
  71. package/lib/commands/services/teams.ts +10 -1
  72. package/lib/commands/services/users.ts +14 -1
  73. package/lib/commands/services/vcs.ts +2 -2
  74. package/lib/constants.ts +1 -1
  75. package/lib/emulation/utils.ts +3 -2
  76. package/lib/parser.ts +149 -27
  77. package/lib/questions.ts +15 -9
  78. package/lib/sdks.ts +1 -0
  79. package/lib/types.ts +1 -0
  80. package/package.json +1 -1
  81. package/scoop/appwrite.config.json +3 -3
@@ -58,83 +58,6 @@ account
58
58
  ),
59
59
  );
60
60
 
61
- account
62
- .command(`list-billing-addresses`)
63
- .description(`List all billing addresses for a user.`)
64
- .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: userId, expired, failed`)
65
- .action(
66
- actionRunner(
67
- async ({ queries }) =>
68
- parse(await (await getAccountClient()).listBillingAddresses(queries)),
69
- ),
70
- );
71
-
72
- account
73
- .command(`create-billing-address`)
74
- .description(`Add a new billing address to a user's account.`)
75
- .requiredOption(`--country <country>`, `Country`)
76
- .requiredOption(`--city <city>`, `City`)
77
- .requiredOption(`--street-address <street-address>`, `Street address`)
78
- .option(`--address-line-2 <address-line-2>`, `Address line 2`)
79
- .option(`--state <state>`, `State or province`)
80
- .option(`--postal-code <postal-code>`, `Postal code`)
81
- .action(
82
- actionRunner(
83
- async ({ country, city, streetAddress, addressLine2, state, postalCode }) =>
84
- parse(await (await getAccountClient()).createBillingAddress(country, city, streetAddress, addressLine2, state, postalCode)),
85
- ),
86
- );
87
-
88
- account
89
- .command(`get-billing-address`)
90
- .description(`Get a specific billing address for a user using it's ID.`)
91
- .requiredOption(`--billing-address-id <billing-address-id>`, `Unique ID of billing address`)
92
- .action(
93
- actionRunner(
94
- async ({ billingAddressId }) =>
95
- parse(await (await getAccountClient()).getBillingAddress(billingAddressId)),
96
- ),
97
- );
98
-
99
- account
100
- .command(`update-billing-address`)
101
- .description(`Update a specific billing address using it's ID.`)
102
- .requiredOption(`--billing-address-id <billing-address-id>`, `Unique ID of billing address`)
103
- .requiredOption(`--country <country>`, `Country`)
104
- .requiredOption(`--city <city>`, `City`)
105
- .requiredOption(`--street-address <street-address>`, `Street address`)
106
- .option(`--address-line-2 <address-line-2>`, `Address line 2`)
107
- .option(`--state <state>`, `State or province`)
108
- .option(`--postal-code <postal-code>`, `Postal code`)
109
- .action(
110
- actionRunner(
111
- async ({ billingAddressId, country, city, streetAddress, addressLine2, state, postalCode }) =>
112
- parse(await (await getAccountClient()).updateBillingAddress(billingAddressId, country, city, streetAddress, addressLine2, state, postalCode)),
113
- ),
114
- );
115
-
116
- account
117
- .command(`delete-billing-address`)
118
- .description(`Delete a specific billing address using it's ID.`)
119
- .requiredOption(`--billing-address-id <billing-address-id>`, `Billing address unique ID`)
120
- .action(
121
- actionRunner(
122
- async ({ billingAddressId }) =>
123
- parse(await (await getAccountClient()).deleteBillingAddress(billingAddressId)),
124
- ),
125
- );
126
-
127
- account
128
- .command(`get-coupon`)
129
- .description(`Get coupon details for an account.`)
130
- .requiredOption(`--coupon-id <coupon-id>`, `ID of the coupon`)
131
- .action(
132
- actionRunner(
133
- async ({ couponId }) =>
134
- parse(await (await getAccountClient()).getCoupon(couponId)),
135
- ),
136
- );
137
-
138
61
  account
139
62
  .command(`update-email`)
140
63
  .description(`Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request.
@@ -177,17 +100,6 @@ account
177
100
  ),
178
101
  );
179
102
 
180
- account
181
- .command(`list-invoices`)
182
- .description(`List all invoices tied to an account.`)
183
- .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: teamId, aggregationId, type, amount, currency, from, to, dueAt, attempts, status, grossAmount`)
184
- .action(
185
- actionRunner(
186
- async ({ queries }) =>
187
- parse(await (await getAccountClient()).listInvoices(queries)),
188
- ),
189
- );
190
-
191
103
  account
192
104
  .command(`create-jwt`)
193
105
  .description(`Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.`)
@@ -408,87 +320,6 @@ account
408
320
  ),
409
321
  );
410
322
 
411
- account
412
- .command(`list-payment-methods`)
413
- .description(`List payment methods for this account.`)
414
- .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: userId, expired, failed`)
415
- .action(
416
- actionRunner(
417
- async ({ queries }) =>
418
- parse(await (await getAccountClient()).listPaymentMethods(queries)),
419
- ),
420
- );
421
-
422
- account
423
- .command(`create-payment-method`)
424
- .description(`Create a new payment method for the current user account.`)
425
- .action(
426
- actionRunner(
427
- async () => parse(await (await getAccountClient()).createPaymentMethod()),
428
- ),
429
- );
430
-
431
- account
432
- .command(`get-payment-method`)
433
- .description(`Get a specific payment method for the user.`)
434
- .requiredOption(`--payment-method-id <payment-method-id>`, `Unique ID of payment method`)
435
- .action(
436
- actionRunner(
437
- async ({ paymentMethodId }) =>
438
- parse(await (await getAccountClient()).getPaymentMethod(paymentMethodId)),
439
- ),
440
- );
441
-
442
- account
443
- .command(`update-payment-method`)
444
- .description(`Update a new payment method for the current user account.`)
445
- .requiredOption(`--payment-method-id <payment-method-id>`, `Unique ID of payment method`)
446
- .requiredOption(`--expiry-month <expiry-month>`, `Payment expiry month`, parseInteger)
447
- .requiredOption(`--expiry-year <expiry-year>`, `Expiry year`, parseInteger)
448
- .option(`--state <state>`, `State of the payment method country`)
449
- .action(
450
- actionRunner(
451
- async ({ paymentMethodId, expiryMonth, expiryYear, state }) =>
452
- parse(await (await getAccountClient()).updatePaymentMethod(paymentMethodId, expiryMonth, expiryYear, state)),
453
- ),
454
- );
455
-
456
- account
457
- .command(`delete-payment-method`)
458
- .description(`Delete a specific payment method from a user's account.`)
459
- .requiredOption(`--payment-method-id <payment-method-id>`, `Unique ID of payment method`)
460
- .action(
461
- actionRunner(
462
- async ({ paymentMethodId }) =>
463
- parse(await (await getAccountClient()).deletePaymentMethod(paymentMethodId)),
464
- ),
465
- );
466
-
467
- account
468
- .command(`update-payment-method-provider`)
469
- .description(`Update payment method provider.`)
470
- .requiredOption(`--payment-method-id <payment-method-id>`, `Unique ID of payment method`)
471
- .requiredOption(`--provider-method-id <provider-method-id>`, `Payment method ID from the payment provider`)
472
- .requiredOption(`--name <name>`, `Name in the payment method`)
473
- .option(`--state <state>`, `State of the payment method country`)
474
- .action(
475
- actionRunner(
476
- async ({ paymentMethodId, providerMethodId, name, state }) =>
477
- parse(await (await getAccountClient()).updatePaymentMethodProvider(paymentMethodId, providerMethodId, name, state)),
478
- ),
479
- );
480
-
481
- account
482
- .command(`update-payment-method-mandate-options`)
483
- .description(`Update payment method mandate options.`)
484
- .requiredOption(`--payment-method-id <payment-method-id>`, `Unique ID of payment method`)
485
- .action(
486
- actionRunner(
487
- async ({ paymentMethodId }) =>
488
- parse(await (await getAccountClient()).updatePaymentMethodMandateOptions(paymentMethodId)),
489
- ),
490
- );
491
-
492
323
  account
493
324
  .command(`update-phone`)
494
325
  .description(`Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS.`)
@@ -64,19 +64,6 @@ health
64
64
  ),
65
65
  );
66
66
 
67
- health
68
- .command(`get-console-pausing`)
69
- .description(`Get console pausing health status. Monitors projects approaching the pause threshold to detect potential issues with console access tracking.
70
- `)
71
- .option(`--threshold <threshold>`, `Percentage threshold of projects approaching pause. When hit (equal or higher), endpoint returns server error. Default value is 10.`, parseInteger)
72
- .option(`--inactivity-days <inactivity-days>`, `Number of days of inactivity before a project is paused. Should match the plan's projectInactivityDays setting. Default value is 7.`, parseInteger)
73
- .action(
74
- actionRunner(
75
- async ({ threshold, inactivityDays }) =>
76
- parse(await (await getHealthClient()).getConsolePausing(threshold, inactivityDays)),
77
- ),
78
- );
79
-
80
67
  health
81
68
  .command(`get-db`)
82
69
  .description(`Check the Appwrite database servers are up and connection is successful.`)
@@ -106,28 +93,6 @@ health
106
93
  ),
107
94
  );
108
95
 
109
- health
110
- .command(`get-queue-billing-project-aggregation`)
111
- .description(`Get billing project aggregation queue.`)
112
- .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
113
- .action(
114
- actionRunner(
115
- async ({ threshold }) =>
116
- parse(await (await getHealthClient()).getQueueBillingProjectAggregation(threshold)),
117
- ),
118
- );
119
-
120
- health
121
- .command(`get-queue-billing-team-aggregation`)
122
- .description(`Get billing team aggregation queue.`)
123
- .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
124
- .action(
125
- actionRunner(
126
- async ({ threshold }) =>
127
- parse(await (await getHealthClient()).getQueueBillingTeamAggregation(threshold)),
128
- ),
129
- );
130
-
131
96
  health
132
97
  .command(`get-queue-builds`)
133
98
  .description(`Get the number of builds that are waiting to be processed in the Appwrite internal queue server.`)
@@ -139,17 +104,6 @@ health
139
104
  ),
140
105
  );
141
106
 
142
- health
143
- .command(`get-queue-priority-builds`)
144
- .description(`Get the priority builds queue size.`)
145
- .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 500.`, parseInteger)
146
- .action(
147
- actionRunner(
148
- async ({ threshold }) =>
149
- parse(await (await getHealthClient()).getQueuePriorityBuilds(threshold)),
150
- ),
151
- );
152
-
153
107
  health
154
108
  .command(`get-queue-certificates`)
155
109
  .description(`Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server.`)
@@ -252,17 +206,6 @@ health
252
206
  ),
253
207
  );
254
208
 
255
- health
256
- .command(`get-queue-region-manager`)
257
- .description(`Get region manager queue.`)
258
- .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100.`, parseInteger)
259
- .action(
260
- actionRunner(
261
- async ({ threshold }) =>
262
- parse(await (await getHealthClient()).getQueueRegionManager(threshold)),
263
- ),
264
- );
265
-
266
209
  health
267
210
  .command(`get-queue-stats-resources`)
268
211
  .description(`Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue.`)
@@ -285,17 +228,6 @@ health
285
228
  ),
286
229
  );
287
230
 
288
- health
289
- .command(`get-queue-threats`)
290
- .description(`Get threats queue.`)
291
- .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100.`, parseInteger)
292
- .action(
293
- actionRunner(
294
- async ({ threshold }) =>
295
- parse(await (await getHealthClient()).getQueueThreats(threshold)),
296
- ),
297
- );
298
-
299
231
  health
300
232
  .command(`get-queue-webhooks`)
301
233
  .description(`Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.`)
@@ -1,5 +1,5 @@
1
1
  import { Command } from "commander";
2
- import { sdkForProject } from "../../sdks.js";
2
+ import { sdkForConsole } from "../../sdks.js";
3
3
  import {
4
4
  actionRunner,
5
5
  commandDescriptions,
@@ -14,7 +14,7 @@ let migrationsClient: Migrations | null = null;
14
14
 
15
15
  const getMigrationsClient = async (): Promise<Migrations> => {
16
16
  if (!migrationsClient) {
17
- const sdkClient = await sdkForProject();
17
+ const sdkClient = await sdkForConsole();
18
18
  migrationsClient = new Migrations(sdkClient);
19
19
  }
20
20
  return migrationsClient;