appwrite-cli 13.5.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.
- package/CHANGELOG.md +10 -0
- package/README.md +2 -2
- package/cli.ts +4 -2
- package/dist/bundle-win-arm64.mjs +658 -52
- package/dist/cli.cjs +658 -52
- package/dist/index.cjs +33 -14
- package/dist/index.js +33 -14
- package/dist/lib/commands/schema.d.ts.map +1 -1
- package/dist/lib/commands/services/activities.d.ts +3 -0
- package/dist/lib/commands/services/activities.d.ts.map +1 -0
- package/dist/lib/commands/services/backups.d.ts +3 -0
- package/dist/lib/commands/services/backups.d.ts.map +1 -0
- package/dist/lib/constants.d.ts +1 -1
- package/dist/lib/json.d.ts.map +1 -1
- package/docs/examples/account/create-key.md +5 -0
- package/docs/examples/account/delete-key.md +4 -0
- package/docs/examples/account/get-key.md +4 -0
- package/docs/examples/account/list-keys.md +3 -0
- package/docs/examples/account/update-key.md +6 -0
- package/docs/examples/activities/get-event.md +4 -0
- package/docs/examples/activities/list-events.md +3 -0
- package/docs/examples/backups/create-archive.md +4 -0
- package/docs/examples/backups/create-policy.md +7 -0
- package/docs/examples/backups/create-restoration.md +5 -0
- package/docs/examples/backups/delete-archive.md +4 -0
- package/docs/examples/backups/delete-policy.md +4 -0
- package/docs/examples/backups/get-archive.md +4 -0
- package/docs/examples/backups/get-policy.md +4 -0
- package/docs/examples/backups/get-restoration.md +4 -0
- package/docs/examples/backups/list-archives.md +3 -0
- package/docs/examples/backups/list-policies.md +3 -0
- package/docs/examples/backups/list-restorations.md +3 -0
- package/docs/examples/backups/update-policy.md +4 -0
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/commands/schema.ts +1 -3
- package/lib/commands/services/account.ts +234 -0
- package/lib/commands/services/activities.ts +51 -0
- package/lib/commands/services/backups.ts +184 -0
- package/lib/commands/services/health.ts +55 -0
- package/lib/commands/services/projects.ts +1 -1
- package/lib/commands/services/storage.ts +2 -2
- package/lib/constants.ts +1 -1
- package/lib/json.ts +6 -1
- package/package.json +2 -2
- package/scoop/appwrite.config.json +3 -3
- package/dist/lib/commands/services/console.d.ts +0 -3
- package/dist/lib/commands/services/console.d.ts.map +0 -1
- package/docs/examples/console/get-resource.md +0 -5
- package/docs/examples/console/variables.md +0 -3
- 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.`)
|
|
@@ -545,7 +545,7 @@ projects
|
|
|
545
545
|
.command(`create-schedule`)
|
|
546
546
|
.description(`Create a new schedule for a resource.`)
|
|
547
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.`)
|
|
548
|
+
.requiredOption(`--resource-type <resource-type>`, `The resource type for the schedule. Possible values: function, execution, message, backup.`)
|
|
549
549
|
.requiredOption(`--resource-id <resource-id>`, `The resource ID to associate with this schedule.`)
|
|
550
550
|
.requiredOption(`--schedule <schedule>`, `Schedule CRON expression.`)
|
|
551
551
|
.option(
|
|
@@ -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
|
|
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
|
|
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(
|
package/lib/constants.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SDK
|
|
2
2
|
export const SDK_TITLE = 'Appwrite';
|
|
3
3
|
export const SDK_TITLE_LOWER = 'appwrite';
|
|
4
|
-
export const SDK_VERSION = '13.
|
|
4
|
+
export const SDK_VERSION = '13.6.0';
|
|
5
5
|
export const SDK_NAME = 'Command Line';
|
|
6
6
|
export const SDK_PLATFORM = 'console';
|
|
7
7
|
export const SDK_LANGUAGE = 'cli';
|
package/lib/json.ts
CHANGED
|
@@ -5,6 +5,8 @@ const JSONbigSerializer = JSONbigModule({ useNativeBigInt: true });
|
|
|
5
5
|
|
|
6
6
|
const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
|
|
7
7
|
const MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);
|
|
8
|
+
const MAX_INT64 = BigInt("9223372036854775807");
|
|
9
|
+
const MIN_INT64 = BigInt("-9223372036854775808");
|
|
8
10
|
|
|
9
11
|
function isBigNumber(value: any): boolean {
|
|
10
12
|
return (
|
|
@@ -25,7 +27,10 @@ function reviver(_key: string, value: any): any {
|
|
|
25
27
|
if (bi >= MIN_SAFE && bi <= MAX_SAFE) {
|
|
26
28
|
return Number(str);
|
|
27
29
|
}
|
|
28
|
-
|
|
30
|
+
if (bi >= MIN_INT64 && bi <= MAX_INT64) {
|
|
31
|
+
return bi;
|
|
32
|
+
}
|
|
33
|
+
return value.toNumber();
|
|
29
34
|
}
|
|
30
35
|
return value.toNumber();
|
|
31
36
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"homepage": "https://appwrite.io/support",
|
|
5
5
|
"description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API",
|
|
6
|
-
"version": "13.
|
|
6
|
+
"version": "13.6.0",
|
|
7
7
|
"license": "BSD-3-Clause",
|
|
8
8
|
"main": "dist/index.cjs",
|
|
9
9
|
"module": "dist/index.js",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"windows-arm64": "esbuild cli.ts --bundle --loader:.hbs=text --platform=node --target=node18 --format=esm --external:fsevents --outfile=dist/bundle-win-arm64.mjs && pkg dist/bundle-win-arm64.mjs -t node18-win-arm64 -o build/appwrite-cli-win-arm64.exe"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@appwrite.io/console": "^3.
|
|
49
|
+
"@appwrite.io/console": "^3.1.0",
|
|
50
50
|
"chalk": "4.1.2",
|
|
51
51
|
"chokidar": "^3.6.0",
|
|
52
52
|
"cli-progress": "^3.12.0",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/schema.json",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.6.0",
|
|
4
4
|
"description": "The Appwrite CLI is a command-line application that allows you to interact with Appwrite and perform server-side tasks using your terminal.",
|
|
5
5
|
"homepage": "https://github.com/appwrite/sdk-for-cli",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"architecture": {
|
|
8
8
|
"64bit": {
|
|
9
|
-
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/13.
|
|
9
|
+
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/13.6.0/appwrite-cli-win-x64.exe",
|
|
10
10
|
"bin": [
|
|
11
11
|
[
|
|
12
12
|
"appwrite-cli-win-x64.exe",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
]
|
|
16
16
|
},
|
|
17
17
|
"arm64": {
|
|
18
|
-
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/13.
|
|
18
|
+
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/13.6.0/appwrite-cli-win-arm64.exe",
|
|
19
19
|
"bin": [
|
|
20
20
|
[
|
|
21
21
|
"appwrite-cli-win-arm64.exe",
|