appwrite-cli 13.4.0 → 13.6.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 (75) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +2 -2
  3. package/cli.ts +4 -2
  4. package/dist/bundle-win-arm64.mjs +1633 -2075
  5. package/dist/cli.cjs +1633 -2075
  6. package/dist/index.cjs +109645 -0
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +780 -1831
  10. package/dist/lib/commands/generators/base.d.ts +16 -5
  11. package/dist/lib/commands/generators/base.d.ts.map +1 -1
  12. package/dist/lib/commands/generators/typescript/databases.d.ts.map +1 -1
  13. package/dist/lib/commands/push.d.ts +1 -0
  14. package/dist/lib/commands/push.d.ts.map +1 -1
  15. package/dist/lib/commands/schema.d.ts.map +1 -1
  16. package/dist/lib/commands/services/activities.d.ts +3 -0
  17. package/dist/lib/commands/services/activities.d.ts.map +1 -0
  18. package/dist/lib/commands/services/backups.d.ts +3 -0
  19. package/dist/lib/commands/services/backups.d.ts.map +1 -0
  20. package/dist/lib/commands/utils/attributes.d.ts +3 -1
  21. package/dist/lib/commands/utils/attributes.d.ts.map +1 -1
  22. package/dist/lib/commands/utils/pools.d.ts +3 -1
  23. package/dist/lib/commands/utils/pools.d.ts.map +1 -1
  24. package/dist/lib/constants.d.ts +1 -1
  25. package/dist/lib/json.d.ts.map +1 -1
  26. package/dist/lib/utils.d.ts +1 -0
  27. package/dist/lib/utils.d.ts.map +1 -1
  28. package/docs/examples/account/create-key.md +5 -0
  29. package/docs/examples/account/delete-key.md +4 -0
  30. package/docs/examples/account/get-key.md +4 -0
  31. package/docs/examples/account/list-keys.md +3 -0
  32. package/docs/examples/account/update-key.md +6 -0
  33. package/docs/examples/activities/get-event.md +4 -0
  34. package/docs/examples/activities/list-events.md +3 -0
  35. package/docs/examples/backups/create-archive.md +4 -0
  36. package/docs/examples/backups/create-policy.md +7 -0
  37. package/docs/examples/backups/create-restoration.md +5 -0
  38. package/docs/examples/backups/delete-archive.md +4 -0
  39. package/docs/examples/backups/delete-policy.md +4 -0
  40. package/docs/examples/backups/get-archive.md +4 -0
  41. package/docs/examples/backups/get-policy.md +4 -0
  42. package/docs/examples/backups/get-restoration.md +4 -0
  43. package/docs/examples/backups/list-archives.md +3 -0
  44. package/docs/examples/backups/list-policies.md +3 -0
  45. package/docs/examples/backups/list-restorations.md +3 -0
  46. package/docs/examples/backups/update-policy.md +4 -0
  47. package/docs/examples/projects/create-schedule.md +7 -0
  48. package/docs/examples/projects/get-schedule.md +5 -0
  49. package/docs/examples/projects/list-schedules.md +4 -0
  50. package/index.ts +1 -0
  51. package/install.ps1 +2 -2
  52. package/install.sh +1 -1
  53. package/lib/commands/generators/base.ts +30 -9
  54. package/lib/commands/generators/typescript/databases.ts +12 -18
  55. package/lib/commands/push.ts +276 -201
  56. package/lib/commands/schema.ts +1 -3
  57. package/lib/commands/services/account.ts +234 -0
  58. package/lib/commands/services/activities.ts +51 -0
  59. package/lib/commands/services/backups.ts +184 -0
  60. package/lib/commands/services/health.ts +55 -0
  61. package/lib/commands/services/migrations.ts +1 -1
  62. package/lib/commands/services/projects.ts +51 -0
  63. package/lib/commands/services/storage.ts +2 -2
  64. package/lib/commands/utils/attributes.ts +9 -6
  65. package/lib/commands/utils/pools.ts +9 -6
  66. package/lib/constants.ts +1 -1
  67. package/lib/json.ts +14 -7
  68. package/lib/utils.ts +15 -0
  69. package/package.json +19 -5
  70. package/scoop/appwrite.config.json +3 -3
  71. package/dist/lib/commands/services/console.d.ts +0 -3
  72. package/dist/lib/commands/services/console.d.ts.map +0 -1
  73. package/docs/examples/console/get-resource.md +0 -5
  74. package/docs/examples/console/variables.md +0 -3
  75. package/lib/commands/services/console.ts +0 -49
@@ -58,6 +58,83 @@ 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
+
61
138
  account
62
139
  .command(`update-email`)
63
140
  .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.
@@ -100,6 +177,17 @@ account
100
177
  ),
101
178
  );
102
179
 
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, 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
+
103
191
  account
104
192
  .command(`create-jwt`)
105
193
  .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.`)
@@ -111,6 +199,71 @@ account
111
199
  ),
112
200
  );
113
201
 
202
+ account
203
+ .command(`list-keys`)
204
+ .description(`Get a list of all API keys from the current account. `)
205
+ .option(
206
+ `--total [value]`,
207
+ `When set to false, the total count returned will be 0 and will not be calculated.`,
208
+ (value: string | undefined) =>
209
+ value === undefined ? true : parseBool(value),
210
+ )
211
+ .action(
212
+ actionRunner(
213
+ async ({ total }) =>
214
+ parse(await (await getAccountClient()).listKeys(total)),
215
+ ),
216
+ );
217
+
218
+ account
219
+ .command(`create-key`)
220
+ .description(`Create a new account API key.`)
221
+ .requiredOption(`--name <name>`, `Key name. Max length: 128 chars.`)
222
+ .requiredOption(`--scopes [scopes...]`, `Key scopes list. Maximum of 100 scopes are allowed.`)
223
+ .option(`--expire <expire>`, `Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration.`)
224
+ .action(
225
+ actionRunner(
226
+ async ({ name, scopes, expire }) =>
227
+ parse(await (await getAccountClient()).createKey(name, scopes, expire)),
228
+ ),
229
+ );
230
+
231
+ account
232
+ .command(`get-key`)
233
+ .description(`Get a key by its unique ID. This endpoint returns details about a specific API key in your account including it's scopes.`)
234
+ .requiredOption(`--key-id <key-id>`, `Key unique ID.`)
235
+ .action(
236
+ actionRunner(
237
+ async ({ keyId }) =>
238
+ parse(await (await getAccountClient()).getKey(keyId)),
239
+ ),
240
+ );
241
+
242
+ account
243
+ .command(`update-key`)
244
+ .description(`Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key.`)
245
+ .requiredOption(`--key-id <key-id>`, `Key unique ID.`)
246
+ .requiredOption(`--name <name>`, `Key name. Max length: 128 chars.`)
247
+ .requiredOption(`--scopes [scopes...]`, `Key scopes list. Maximum of 100 scopes are allowed.`)
248
+ .option(`--expire <expire>`, `Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration.`)
249
+ .action(
250
+ actionRunner(
251
+ async ({ keyId, name, scopes, expire }) =>
252
+ parse(await (await getAccountClient()).updateKey(keyId, name, scopes, expire)),
253
+ ),
254
+ );
255
+
256
+ account
257
+ .command(`delete-key`)
258
+ .description(`Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls.`)
259
+ .requiredOption(`--key-id <key-id>`, `Key unique ID.`)
260
+ .action(
261
+ actionRunner(
262
+ async ({ keyId }) =>
263
+ parse(await (await getAccountClient()).deleteKey(keyId)),
264
+ ),
265
+ );
266
+
114
267
  account
115
268
  .command(`list-logs`)
116
269
  .description(`Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log.`)
@@ -255,6 +408,87 @@ account
255
408
  ),
256
409
  );
257
410
 
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
+
258
492
  account
259
493
  .command(`update-phone`)
260
494
  .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.`)
@@ -0,0 +1,51 @@
1
+ import { Command } from "commander";
2
+ import { sdkForProject } from "../../sdks.js";
3
+ import {
4
+ actionRunner,
5
+ commandDescriptions,
6
+ success,
7
+ parse,
8
+ parseBool,
9
+ parseInteger,
10
+ } from "../../parser.js";
11
+ import { Activities } from "@appwrite.io/console";
12
+
13
+ let activitiesClient: Activities | null = null;
14
+
15
+ const getActivitiesClient = async (): Promise<Activities> => {
16
+ if (!activitiesClient) {
17
+ const sdkClient = await sdkForProject();
18
+ activitiesClient = new Activities(sdkClient);
19
+ }
20
+ return activitiesClient;
21
+ };
22
+
23
+ export const activities = new Command("activities")
24
+ .description(commandDescriptions["activities"] ?? "")
25
+ .configureHelp({
26
+ helpWidth: process.stdout.columns || 80,
27
+ });
28
+
29
+ activities
30
+ .command(`list-events`)
31
+ .description(`List all events for selected filters.`)
32
+ .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 attributes such as userId, teamId, etc.`)
33
+ .action(
34
+ actionRunner(
35
+ async ({ queries }) =>
36
+ parse(await (await getActivitiesClient()).listEvents(queries)),
37
+ ),
38
+ );
39
+
40
+ activities
41
+ .command(`get-event`)
42
+ .description(`Get event by ID.
43
+ `)
44
+ .requiredOption(`--event-id <event-id>`, `Event ID.`)
45
+ .action(
46
+ actionRunner(
47
+ async ({ eventId }) =>
48
+ parse(await (await getActivitiesClient()).getEvent(eventId)),
49
+ ),
50
+ );
51
+
@@ -0,0 +1,184 @@
1
+ import { Command } from "commander";
2
+ import { sdkForProject } from "../../sdks.js";
3
+ import {
4
+ actionRunner,
5
+ commandDescriptions,
6
+ success,
7
+ parse,
8
+ parseBool,
9
+ parseInteger,
10
+ } from "../../parser.js";
11
+ import { Backups } from "@appwrite.io/console";
12
+
13
+ let backupsClient: Backups | null = null;
14
+
15
+ const getBackupsClient = async (): Promise<Backups> => {
16
+ if (!backupsClient) {
17
+ const sdkClient = await sdkForProject();
18
+ backupsClient = new Backups(sdkClient);
19
+ }
20
+ return backupsClient;
21
+ };
22
+
23
+ export const backups = new Command("backups")
24
+ .description(commandDescriptions["backups"] ?? "")
25
+ .configureHelp({
26
+ helpWidth: process.stdout.columns || 80,
27
+ });
28
+
29
+ backups
30
+ .command(`list-archives`)
31
+ .description(`List all archives for a project.`)
32
+ .option(`--queries [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.`)
33
+ .action(
34
+ actionRunner(
35
+ async ({ queries }) =>
36
+ parse(await (await getBackupsClient()).listArchives(queries)),
37
+ ),
38
+ );
39
+
40
+ backups
41
+ .command(`create-archive`)
42
+ .description(`Create a new archive asynchronously for a project.`)
43
+ .requiredOption(`--services [services...]`, `Array of services to backup`)
44
+ .option(`--resource-id <resource-id>`, `Resource ID. When set, only this single resource will be backed up.`)
45
+ .action(
46
+ actionRunner(
47
+ async ({ services, resourceId }) =>
48
+ parse(await (await getBackupsClient()).createArchive(services, resourceId)),
49
+ ),
50
+ );
51
+
52
+ backups
53
+ .command(`get-archive`)
54
+ .description(`Get a backup archive using it's ID.`)
55
+ .requiredOption(`--archive-id <archive-id>`, `Archive ID. Choose a custom ID\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
56
+ .action(
57
+ actionRunner(
58
+ async ({ archiveId }) =>
59
+ parse(await (await getBackupsClient()).getArchive(archiveId)),
60
+ ),
61
+ );
62
+
63
+ backups
64
+ .command(`delete-archive`)
65
+ .description(`Delete an existing archive for a project.`)
66
+ .requiredOption(`--archive-id <archive-id>`, `Policy ID. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
67
+ .action(
68
+ actionRunner(
69
+ async ({ archiveId }) =>
70
+ parse(await (await getBackupsClient()).deleteArchive(archiveId)),
71
+ ),
72
+ );
73
+
74
+ backups
75
+ .command(`list-policies`)
76
+ .description(`List all policies for a project.`)
77
+ .option(`--queries [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.`)
78
+ .action(
79
+ actionRunner(
80
+ async ({ queries }) =>
81
+ parse(await (await getBackupsClient()).listPolicies(queries)),
82
+ ),
83
+ );
84
+
85
+ backups
86
+ .command(`create-policy`)
87
+ .description(`Create a new backup policy.`)
88
+ .requiredOption(`--policy-id <policy-id>`, `Policy ID. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
89
+ .requiredOption(`--services [services...]`, `Array of services to backup`)
90
+ .requiredOption(`--retention <retention>`, `Days to keep backups before deletion`, parseInteger)
91
+ .requiredOption(`--schedule <schedule>`, `Schedule CRON syntax.`)
92
+ .option(`--name <name>`, `Policy name. Max length: 128 chars.`)
93
+ .option(`--resource-id <resource-id>`, `Resource ID. When set, only this single resource will be backed up.`)
94
+ .option(
95
+ `--enabled [value]`,
96
+ `Is policy enabled? When set to 'disabled', no backups will be taken`,
97
+ (value: string | undefined) =>
98
+ value === undefined ? true : parseBool(value),
99
+ )
100
+ .action(
101
+ actionRunner(
102
+ async ({ policyId, services, retention, schedule, name, resourceId, enabled }) =>
103
+ parse(await (await getBackupsClient()).createPolicy(policyId, services, retention, schedule, name, resourceId, enabled)),
104
+ ),
105
+ );
106
+
107
+ backups
108
+ .command(`get-policy`)
109
+ .description(`Get a backup policy using it's ID.`)
110
+ .requiredOption(`--policy-id <policy-id>`, `Policy ID. Choose a custom ID\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
111
+ .action(
112
+ actionRunner(
113
+ async ({ policyId }) =>
114
+ parse(await (await getBackupsClient()).getPolicy(policyId)),
115
+ ),
116
+ );
117
+
118
+ backups
119
+ .command(`update-policy`)
120
+ .description(`Update an existing policy using it's ID.`)
121
+ .requiredOption(`--policy-id <policy-id>`, `Policy ID. Choose a custom ID\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
122
+ .option(`--name <name>`, `Policy name. Max length: 128 chars.`)
123
+ .option(`--retention <retention>`, `Days to keep backups before deletion`, parseInteger)
124
+ .option(`--schedule <schedule>`, `Cron expression`)
125
+ .option(
126
+ `--enabled [value]`,
127
+ `Is Backup enabled? When set to 'disabled', No backup will be taken`,
128
+ (value: string | undefined) =>
129
+ value === undefined ? true : parseBool(value),
130
+ )
131
+ .action(
132
+ actionRunner(
133
+ async ({ policyId, name, retention, schedule, enabled }) =>
134
+ parse(await (await getBackupsClient()).updatePolicy(policyId, name, retention, schedule, enabled)),
135
+ ),
136
+ );
137
+
138
+ backups
139
+ .command(`delete-policy`)
140
+ .description(`Delete a policy using it's ID.`)
141
+ .requiredOption(`--policy-id <policy-id>`, `Policy ID. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
142
+ .action(
143
+ actionRunner(
144
+ async ({ policyId }) =>
145
+ parse(await (await getBackupsClient()).deletePolicy(policyId)),
146
+ ),
147
+ );
148
+
149
+ backups
150
+ .command(`create-restoration`)
151
+ .description(`Create and trigger a new restoration for a backup on a project.`)
152
+ .requiredOption(`--archive-id <archive-id>`, `Backup archive ID to restore`)
153
+ .requiredOption(`--services [services...]`, `Array of services to restore`)
154
+ .option(`--new-resource-id <new-resource-id>`, `Unique Id. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
155
+ .option(`--new-resource-name <new-resource-name>`, `Database name. Max length: 128 chars.`)
156
+ .action(
157
+ actionRunner(
158
+ async ({ archiveId, services, newResourceId, newResourceName }) =>
159
+ parse(await (await getBackupsClient()).createRestoration(archiveId, services, newResourceId, newResourceName)),
160
+ ),
161
+ );
162
+
163
+ backups
164
+ .command(`list-restorations`)
165
+ .description(`List all backup restorations for a project.`)
166
+ .option(`--queries [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.`)
167
+ .action(
168
+ actionRunner(
169
+ async ({ queries }) =>
170
+ parse(await (await getBackupsClient()).listRestorations(queries)),
171
+ ),
172
+ );
173
+
174
+ backups
175
+ .command(`get-restoration`)
176
+ .description(`Get the current status of a backup restoration.`)
177
+ .requiredOption(`--restoration-id <restoration-id>`, `Restoration ID. Choose a custom ID\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
178
+ .action(
179
+ actionRunner(
180
+ async ({ restorationId }) =>
181
+ parse(await (await getBackupsClient()).getRestoration(restorationId)),
182
+ ),
183
+ );
184
+
@@ -93,6 +93,28 @@ health
93
93
  ),
94
94
  );
95
95
 
96
+ health
97
+ .command(`get-queue-billing-project-aggregation`)
98
+ .description(`Get billing project aggregation queue.`)
99
+ .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
100
+ .action(
101
+ actionRunner(
102
+ async ({ threshold }) =>
103
+ parse(await (await getHealthClient()).getQueueBillingProjectAggregation(threshold)),
104
+ ),
105
+ );
106
+
107
+ health
108
+ .command(`get-queue-billing-team-aggregation`)
109
+ .description(`Get billing team aggregation queue.`)
110
+ .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
111
+ .action(
112
+ actionRunner(
113
+ async ({ threshold }) =>
114
+ parse(await (await getHealthClient()).getQueueBillingTeamAggregation(threshold)),
115
+ ),
116
+ );
117
+
96
118
  health
97
119
  .command(`get-queue-builds`)
98
120
  .description(`Get the number of builds that are waiting to be processed in the Appwrite internal queue server.`)
@@ -104,6 +126,17 @@ health
104
126
  ),
105
127
  );
106
128
 
129
+ health
130
+ .command(`get-queue-priority-builds`)
131
+ .description(`Get the priority builds queue size.`)
132
+ .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 500.`, parseInteger)
133
+ .action(
134
+ actionRunner(
135
+ async ({ threshold }) =>
136
+ parse(await (await getHealthClient()).getQueuePriorityBuilds(threshold)),
137
+ ),
138
+ );
139
+
107
140
  health
108
141
  .command(`get-queue-certificates`)
109
142
  .description(`Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server.`)
@@ -206,6 +239,17 @@ health
206
239
  ),
207
240
  );
208
241
 
242
+ health
243
+ .command(`get-queue-region-manager`)
244
+ .description(`Get region manager queue.`)
245
+ .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100.`, parseInteger)
246
+ .action(
247
+ actionRunner(
248
+ async ({ threshold }) =>
249
+ parse(await (await getHealthClient()).getQueueRegionManager(threshold)),
250
+ ),
251
+ );
252
+
209
253
  health
210
254
  .command(`get-queue-stats-resources`)
211
255
  .description(`Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue.`)
@@ -228,6 +272,17 @@ health
228
272
  ),
229
273
  );
230
274
 
275
+ health
276
+ .command(`get-queue-threats`)
277
+ .description(`Get threats queue.`)
278
+ .option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100.`, parseInteger)
279
+ .action(
280
+ actionRunner(
281
+ async ({ threshold }) =>
282
+ parse(await (await getHealthClient()).getQueueThreats(threshold)),
283
+ ),
284
+ );
285
+
231
286
  health
232
287
  .command(`get-queue-webhooks`)
233
288
  .description(`Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.`)
@@ -29,7 +29,7 @@ export const migrations = new Command("migrations")
29
29
  migrations
30
30
  .command(`list`)
31
31
  .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.`)
32
- .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`)
32
+ .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, resourceId, resourceType, statusCounters, resourceData, errors`)
33
33
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
34
34
  .option(
35
35
  `--total [value]`,
@@ -523,6 +523,57 @@ projects
523
523
  ),
524
524
  );
525
525
 
526
+ projects
527
+ .command(`list-schedules`)
528
+ .description(`Get a list of all the project's schedules. You can use the query params to filter your results.`)
529
+ .requiredOption(`--project-id <project-id>`, `Project unique ID.`)
530
+ .option(`--queries [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: resourceType, resourceId, projectId, schedule, active, region`)
531
+ .option(
532
+ `--total [value]`,
533
+ `When set to false, the total count returned will be 0 and will not be calculated.`,
534
+ (value: string | undefined) =>
535
+ value === undefined ? true : parseBool(value),
536
+ )
537
+ .action(
538
+ actionRunner(
539
+ async ({ projectId, queries, total }) =>
540
+ parse(await (await getProjectsClient()).listSchedules(projectId, queries, total)),
541
+ ),
542
+ );
543
+
544
+ projects
545
+ .command(`create-schedule`)
546
+ .description(`Create a new schedule for a resource.`)
547
+ .requiredOption(`--project-id <project-id>`, `Project unique ID.`)
548
+ .requiredOption(`--resource-type <resource-type>`, `The resource type for the schedule. Possible values: function, execution, message, backup.`)
549
+ .requiredOption(`--resource-id <resource-id>`, `The resource ID to associate with this schedule.`)
550
+ .requiredOption(`--schedule <schedule>`, `Schedule CRON expression.`)
551
+ .option(
552
+ `--active [value]`,
553
+ `Whether the schedule is active.`,
554
+ (value: string | undefined) =>
555
+ value === undefined ? true : parseBool(value),
556
+ )
557
+ .option(`--data <data>`, `Schedule data as a JSON string. Used to store resource-specific context needed for execution.`)
558
+ .action(
559
+ actionRunner(
560
+ async ({ projectId, resourceType, resourceId, schedule, active, data }) =>
561
+ parse(await (await getProjectsClient()).createSchedule(projectId, resourceType, resourceId, schedule, active, JSON.parse(data))),
562
+ ),
563
+ );
564
+
565
+ projects
566
+ .command(`get-schedule`)
567
+ .description(`Get a schedule by its unique ID.`)
568
+ .requiredOption(`--project-id <project-id>`, `Project unique ID.`)
569
+ .requiredOption(`--schedule-id <schedule-id>`, `Schedule ID.`)
570
+ .action(
571
+ actionRunner(
572
+ async ({ projectId, scheduleId }) =>
573
+ parse(await (await getProjectsClient()).getSchedule(projectId, scheduleId)),
574
+ ),
575
+ );
576
+
526
577
  projects
527
578
  .command(`update-service-status`)
528
579
  .description(`Update the status of a specific service. Use this endpoint to enable or disable a service in your project. `)
@@ -63,7 +63,7 @@ storage
63
63
  (value: string | undefined) =>
64
64
  value === undefined ? true : parseBool(value),
65
65
  )
66
- .option(`--maximum-file-size <maximum-file-size>`, `Maximum file size allowed in bytes. Maximum allowed value is 30MB.`, parseInteger)
66
+ .option(`--maximum-file-size <maximum-file-size>`, `Maximum file size allowed in bytes. Maximum allowed value is 5GB.`, parseInteger)
67
67
  .option(`--allowed-file-extensions [allowed-file-extensions...]`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`)
68
68
  .option(`--compression <compression>`, `Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled`)
69
69
  .option(
@@ -120,7 +120,7 @@ storage
120
120
  (value: string | undefined) =>
121
121
  value === undefined ? true : parseBool(value),
122
122
  )
123
- .option(`--maximum-file-size <maximum-file-size>`, `Maximum file size allowed in bytes. Maximum allowed value is 30MB.`, parseInteger)
123
+ .option(`--maximum-file-size <maximum-file-size>`, `Maximum file size allowed in bytes. Maximum allowed value is 5GB.`, parseInteger)
124
124
  .option(`--allowed-file-extensions [allowed-file-extensions...]`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`)
125
125
  .option(`--compression <compression>`, `Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled`)
126
126
  .option(