appwrite-cli 13.3.2 → 13.5.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 +13 -0
- package/README.md +2 -2
- package/dist/bundle-win-arm64.mjs +1465 -3750
- package/dist/cli.cjs +1465 -3750
- package/dist/index.cjs +109626 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +904 -3243
- package/dist/lib/commands/generators/base.d.ts +16 -5
- package/dist/lib/commands/generators/base.d.ts.map +1 -1
- package/dist/lib/commands/generators/typescript/databases.d.ts.map +1 -1
- package/dist/lib/commands/push.d.ts +1 -0
- package/dist/lib/commands/push.d.ts.map +1 -1
- package/dist/lib/commands/utils/attributes.d.ts +3 -1
- package/dist/lib/commands/utils/attributes.d.ts.map +1 -1
- package/dist/lib/commands/utils/pools.d.ts +3 -1
- package/dist/lib/commands/utils/pools.d.ts.map +1 -1
- package/dist/lib/constants.d.ts +1 -1
- package/dist/lib/json.d.ts.map +1 -1
- package/dist/lib/utils.d.ts +1 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/docs/examples/projects/create-schedule.md +7 -0
- package/docs/examples/projects/get-schedule.md +5 -0
- package/docs/examples/projects/list-schedules.md +4 -0
- package/index.ts +1 -0
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/commands/generators/base.ts +30 -9
- package/lib/commands/generators/typescript/databases.ts +12 -18
- package/lib/commands/push.ts +294 -197
- package/lib/commands/services/databases.ts +32 -8
- package/lib/commands/services/migrations.ts +1 -1
- package/lib/commands/services/projects.ts +57 -4
- package/lib/commands/services/tables-db.ts +32 -8
- package/lib/commands/utils/attributes.ts +9 -6
- package/lib/commands/utils/pools.ts +9 -6
- package/lib/constants.ts +1 -1
- package/lib/json.ts +12 -2
- package/lib/utils.ts +15 -0
- package/package.json +19 -6
- package/scoop/appwrite.config.json +3 -3
|
@@ -640,10 +640,16 @@ databases
|
|
|
640
640
|
(value: string | undefined) =>
|
|
641
641
|
value === undefined ? true : parseBool(value),
|
|
642
642
|
)
|
|
643
|
+
.option(
|
|
644
|
+
`--encrypt [value]`,
|
|
645
|
+
`Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried.`,
|
|
646
|
+
(value: string | undefined) =>
|
|
647
|
+
value === undefined ? true : parseBool(value),
|
|
648
|
+
)
|
|
643
649
|
.action(
|
|
644
650
|
actionRunner(
|
|
645
|
-
async ({ databaseId, collectionId, key, required, xdefault, array }) =>
|
|
646
|
-
parse(await (await getDatabasesClient()).createLongtextAttribute(databaseId, collectionId, key, required, xdefault, array)),
|
|
651
|
+
async ({ databaseId, collectionId, key, required, xdefault, array, encrypt }) =>
|
|
652
|
+
parse(await (await getDatabasesClient()).createLongtextAttribute(databaseId, collectionId, key, required, xdefault, array, encrypt)),
|
|
647
653
|
),
|
|
648
654
|
);
|
|
649
655
|
|
|
@@ -679,10 +685,16 @@ databases
|
|
|
679
685
|
(value: string | undefined) =>
|
|
680
686
|
value === undefined ? true : parseBool(value),
|
|
681
687
|
)
|
|
688
|
+
.option(
|
|
689
|
+
`--encrypt [value]`,
|
|
690
|
+
`Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried.`,
|
|
691
|
+
(value: string | undefined) =>
|
|
692
|
+
value === undefined ? true : parseBool(value),
|
|
693
|
+
)
|
|
682
694
|
.action(
|
|
683
695
|
actionRunner(
|
|
684
|
-
async ({ databaseId, collectionId, key, required, xdefault, array }) =>
|
|
685
|
-
parse(await (await getDatabasesClient()).createMediumtextAttribute(databaseId, collectionId, key, required, xdefault, array)),
|
|
696
|
+
async ({ databaseId, collectionId, key, required, xdefault, array, encrypt }) =>
|
|
697
|
+
parse(await (await getDatabasesClient()).createMediumtextAttribute(databaseId, collectionId, key, required, xdefault, array, encrypt)),
|
|
686
698
|
),
|
|
687
699
|
);
|
|
688
700
|
|
|
@@ -851,10 +863,16 @@ databases
|
|
|
851
863
|
(value: string | undefined) =>
|
|
852
864
|
value === undefined ? true : parseBool(value),
|
|
853
865
|
)
|
|
866
|
+
.option(
|
|
867
|
+
`--encrypt [value]`,
|
|
868
|
+
`Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried.`,
|
|
869
|
+
(value: string | undefined) =>
|
|
870
|
+
value === undefined ? true : parseBool(value),
|
|
871
|
+
)
|
|
854
872
|
.action(
|
|
855
873
|
actionRunner(
|
|
856
|
-
async ({ databaseId, collectionId, key, required, xdefault, array }) =>
|
|
857
|
-
parse(await (await getDatabasesClient()).createTextAttribute(databaseId, collectionId, key, required, xdefault, array)),
|
|
874
|
+
async ({ databaseId, collectionId, key, required, xdefault, array, encrypt }) =>
|
|
875
|
+
parse(await (await getDatabasesClient()).createTextAttribute(databaseId, collectionId, key, required, xdefault, array, encrypt)),
|
|
858
876
|
),
|
|
859
877
|
);
|
|
860
878
|
|
|
@@ -930,10 +948,16 @@ databases
|
|
|
930
948
|
(value: string | undefined) =>
|
|
931
949
|
value === undefined ? true : parseBool(value),
|
|
932
950
|
)
|
|
951
|
+
.option(
|
|
952
|
+
`--encrypt [value]`,
|
|
953
|
+
`Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried.`,
|
|
954
|
+
(value: string | undefined) =>
|
|
955
|
+
value === undefined ? true : parseBool(value),
|
|
956
|
+
)
|
|
933
957
|
.action(
|
|
934
958
|
actionRunner(
|
|
935
|
-
async ({ databaseId, collectionId, key, size, required, xdefault, array }) =>
|
|
936
|
-
parse(await (await getDatabasesClient()).createVarcharAttribute(databaseId, collectionId, key, size, required, xdefault, array)),
|
|
959
|
+
async ({ databaseId, collectionId, key, size, required, xdefault, array, encrypt }) =>
|
|
960
|
+
parse(await (await getDatabasesClient()).createVarcharAttribute(databaseId, collectionId, key, size, required, xdefault, array, encrypt)),
|
|
937
961
|
),
|
|
938
962
|
);
|
|
939
963
|
|
|
@@ -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]`,
|
|
@@ -350,6 +350,7 @@ projects
|
|
|
350
350
|
.command(`list-keys`)
|
|
351
351
|
.description(`Get a list of all API keys from the current project. `)
|
|
352
352
|
.requiredOption(`--project-id <project-id>`, `Project unique ID.`)
|
|
353
|
+
.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: expire, accessedAt, name, scopes`)
|
|
353
354
|
.option(
|
|
354
355
|
`--total [value]`,
|
|
355
356
|
`When set to false, the total count returned will be 0 and will not be calculated.`,
|
|
@@ -358,8 +359,8 @@ projects
|
|
|
358
359
|
)
|
|
359
360
|
.action(
|
|
360
361
|
actionRunner(
|
|
361
|
-
async ({ projectId, total }) =>
|
|
362
|
-
parse(await (await getProjectsClient()).listKeys(projectId, total)),
|
|
362
|
+
async ({ projectId, queries, total }) =>
|
|
363
|
+
parse(await (await getProjectsClient()).listKeys(projectId, queries, total)),
|
|
363
364
|
),
|
|
364
365
|
);
|
|
365
366
|
|
|
@@ -369,11 +370,12 @@ projects
|
|
|
369
370
|
.requiredOption(`--project-id <project-id>`, `Project unique ID.`)
|
|
370
371
|
.requiredOption(`--name <name>`, `Key name. Max length: 128 chars.`)
|
|
371
372
|
.requiredOption(`--scopes [scopes...]`, `Key scopes list. Maximum of 100 scopes are allowed.`)
|
|
373
|
+
.option(`--key-id <key-id>`, `Key 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.`)
|
|
372
374
|
.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.`)
|
|
373
375
|
.action(
|
|
374
376
|
actionRunner(
|
|
375
|
-
async ({ projectId, name, scopes, expire }) =>
|
|
376
|
-
parse(await (await getProjectsClient()).createKey(projectId, name, scopes, expire)),
|
|
377
|
+
async ({ projectId, name, scopes, keyId, expire }) =>
|
|
378
|
+
parse(await (await getProjectsClient()).createKey(projectId, name, scopes, keyId, expire)),
|
|
377
379
|
),
|
|
378
380
|
);
|
|
379
381
|
|
|
@@ -521,6 +523,57 @@ projects
|
|
|
521
523
|
),
|
|
522
524
|
);
|
|
523
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.`)
|
|
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
|
+
|
|
524
577
|
projects
|
|
525
578
|
.command(`update-service-status`)
|
|
526
579
|
.description(`Update the status of a specific service. Use this endpoint to enable or disable a service in your project. `)
|
|
@@ -639,10 +639,16 @@ tablesDB
|
|
|
639
639
|
(value: string | undefined) =>
|
|
640
640
|
value === undefined ? true : parseBool(value),
|
|
641
641
|
)
|
|
642
|
+
.option(
|
|
643
|
+
`--encrypt [value]`,
|
|
644
|
+
`Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried.`,
|
|
645
|
+
(value: string | undefined) =>
|
|
646
|
+
value === undefined ? true : parseBool(value),
|
|
647
|
+
)
|
|
642
648
|
.action(
|
|
643
649
|
actionRunner(
|
|
644
|
-
async ({ databaseId, tableId, key, required, xdefault, array }) =>
|
|
645
|
-
parse(await (await getTablesDBClient()).createLongtextColumn(databaseId, tableId, key, required, xdefault, array)),
|
|
650
|
+
async ({ databaseId, tableId, key, required, xdefault, array, encrypt }) =>
|
|
651
|
+
parse(await (await getTablesDBClient()).createLongtextColumn(databaseId, tableId, key, required, xdefault, array, encrypt)),
|
|
646
652
|
),
|
|
647
653
|
);
|
|
648
654
|
|
|
@@ -678,10 +684,16 @@ tablesDB
|
|
|
678
684
|
(value: string | undefined) =>
|
|
679
685
|
value === undefined ? true : parseBool(value),
|
|
680
686
|
)
|
|
687
|
+
.option(
|
|
688
|
+
`--encrypt [value]`,
|
|
689
|
+
`Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried.`,
|
|
690
|
+
(value: string | undefined) =>
|
|
691
|
+
value === undefined ? true : parseBool(value),
|
|
692
|
+
)
|
|
681
693
|
.action(
|
|
682
694
|
actionRunner(
|
|
683
|
-
async ({ databaseId, tableId, key, required, xdefault, array }) =>
|
|
684
|
-
parse(await (await getTablesDBClient()).createMediumtextColumn(databaseId, tableId, key, required, xdefault, array)),
|
|
695
|
+
async ({ databaseId, tableId, key, required, xdefault, array, encrypt }) =>
|
|
696
|
+
parse(await (await getTablesDBClient()).createMediumtextColumn(databaseId, tableId, key, required, xdefault, array, encrypt)),
|
|
685
697
|
),
|
|
686
698
|
);
|
|
687
699
|
|
|
@@ -850,10 +862,16 @@ tablesDB
|
|
|
850
862
|
(value: string | undefined) =>
|
|
851
863
|
value === undefined ? true : parseBool(value),
|
|
852
864
|
)
|
|
865
|
+
.option(
|
|
866
|
+
`--encrypt [value]`,
|
|
867
|
+
`Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried.`,
|
|
868
|
+
(value: string | undefined) =>
|
|
869
|
+
value === undefined ? true : parseBool(value),
|
|
870
|
+
)
|
|
853
871
|
.action(
|
|
854
872
|
actionRunner(
|
|
855
|
-
async ({ databaseId, tableId, key, required, xdefault, array }) =>
|
|
856
|
-
parse(await (await getTablesDBClient()).createTextColumn(databaseId, tableId, key, required, xdefault, array)),
|
|
873
|
+
async ({ databaseId, tableId, key, required, xdefault, array, encrypt }) =>
|
|
874
|
+
parse(await (await getTablesDBClient()).createTextColumn(databaseId, tableId, key, required, xdefault, array, encrypt)),
|
|
857
875
|
),
|
|
858
876
|
);
|
|
859
877
|
|
|
@@ -929,10 +947,16 @@ tablesDB
|
|
|
929
947
|
(value: string | undefined) =>
|
|
930
948
|
value === undefined ? true : parseBool(value),
|
|
931
949
|
)
|
|
950
|
+
.option(
|
|
951
|
+
`--encrypt [value]`,
|
|
952
|
+
`Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried.`,
|
|
953
|
+
(value: string | undefined) =>
|
|
954
|
+
value === undefined ? true : parseBool(value),
|
|
955
|
+
)
|
|
932
956
|
.action(
|
|
933
957
|
actionRunner(
|
|
934
|
-
async ({ databaseId, tableId, key, size, required, xdefault, array }) =>
|
|
935
|
-
parse(await (await getTablesDBClient()).createVarcharColumn(databaseId, tableId, key, size, required, xdefault, array)),
|
|
958
|
+
async ({ databaseId, tableId, key, size, required, xdefault, array, encrypt }) =>
|
|
959
|
+
parse(await (await getTablesDBClient()).createVarcharColumn(databaseId, tableId, key, size, required, xdefault, array, encrypt)),
|
|
936
960
|
),
|
|
937
961
|
);
|
|
938
962
|
|
|
@@ -4,6 +4,7 @@ import { KeysAttributes } from "../../config.js";
|
|
|
4
4
|
import { log, success, error, cliConfig, drawTable } from "../../parser.js";
|
|
5
5
|
import { Pools } from "./pools.js";
|
|
6
6
|
import inquirer from "inquirer";
|
|
7
|
+
import type { Client } from "@appwrite.io/console";
|
|
7
8
|
|
|
8
9
|
const changeableKeys = [
|
|
9
10
|
"status",
|
|
@@ -53,9 +54,11 @@ const questionPushChangesConfirmation = [
|
|
|
53
54
|
export class Attributes {
|
|
54
55
|
private pools: Pools;
|
|
55
56
|
private skipConfirmation: boolean;
|
|
57
|
+
private client?: Client;
|
|
56
58
|
|
|
57
|
-
constructor(pools?: Pools, skipConfirmation = false) {
|
|
58
|
-
this.
|
|
59
|
+
constructor(pools?: Pools, skipConfirmation = false, client?: Client) {
|
|
60
|
+
this.client = client;
|
|
61
|
+
this.pools = pools || new Pools(undefined, client);
|
|
59
62
|
this.skipConfirmation = skipConfirmation;
|
|
60
63
|
}
|
|
61
64
|
|
|
@@ -197,7 +200,7 @@ export class Attributes {
|
|
|
197
200
|
collectionId: string,
|
|
198
201
|
attribute: any,
|
|
199
202
|
): Promise<any> => {
|
|
200
|
-
const databasesService = await getDatabasesService();
|
|
203
|
+
const databasesService = await getDatabasesService(this.client);
|
|
201
204
|
switch (attribute.type) {
|
|
202
205
|
case "string":
|
|
203
206
|
switch (attribute.format) {
|
|
@@ -373,7 +376,7 @@ export class Attributes {
|
|
|
373
376
|
collectionId: string,
|
|
374
377
|
attribute: any,
|
|
375
378
|
): Promise<any> => {
|
|
376
|
-
const databasesService = await getDatabasesService();
|
|
379
|
+
const databasesService = await getDatabasesService(this.client);
|
|
377
380
|
switch (attribute.type) {
|
|
378
381
|
case "string":
|
|
379
382
|
switch (attribute.format) {
|
|
@@ -533,7 +536,7 @@ export class Attributes {
|
|
|
533
536
|
`Deleting ${isIndex ? "index" : "attribute"} ${attribute.key} of ${collection.name} ( ${collection["$id"]} )`,
|
|
534
537
|
);
|
|
535
538
|
|
|
536
|
-
const databasesService = await getDatabasesService();
|
|
539
|
+
const databasesService = await getDatabasesService(this.client);
|
|
537
540
|
if (isIndex) {
|
|
538
541
|
await databasesService.deleteIndex(
|
|
539
542
|
collection["databaseId"],
|
|
@@ -733,7 +736,7 @@ export class Attributes {
|
|
|
733
736
|
): Promise<void> => {
|
|
734
737
|
log(`Creating indexes ...`);
|
|
735
738
|
|
|
736
|
-
const databasesService = await getDatabasesService();
|
|
739
|
+
const databasesService = await getDatabasesService(this.client);
|
|
737
740
|
for (let index of indexes) {
|
|
738
741
|
await databasesService.createIndex({
|
|
739
742
|
databaseId: collection["databaseId"],
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { getDatabasesService } from "../../services.js";
|
|
2
2
|
import { paginate } from "../../paginate.js";
|
|
3
3
|
import { log } from "../../parser.js";
|
|
4
|
+
import type { Client } from "@appwrite.io/console";
|
|
4
5
|
|
|
5
6
|
export class Pools {
|
|
6
7
|
private STEP_SIZE = 100; // Resources
|
|
7
8
|
private POLL_DEBOUNCE = 2000; // Milliseconds
|
|
8
9
|
private pollMaxDebounces = 30;
|
|
9
10
|
private POLL_DEFAULT_VALUE = 30;
|
|
11
|
+
private client?: Client;
|
|
10
12
|
|
|
11
|
-
constructor(pollMaxDebounces?: number) {
|
|
13
|
+
constructor(pollMaxDebounces?: number, client?: Client) {
|
|
14
|
+
this.client = client;
|
|
12
15
|
if (pollMaxDebounces) {
|
|
13
16
|
this.pollMaxDebounces = pollMaxDebounces;
|
|
14
17
|
}
|
|
@@ -23,7 +26,7 @@ export class Pools {
|
|
|
23
26
|
return false;
|
|
24
27
|
}
|
|
25
28
|
|
|
26
|
-
const databasesService = await getDatabasesService();
|
|
29
|
+
const databasesService = await getDatabasesService(this.client);
|
|
27
30
|
const response = await databasesService.listAttributes(
|
|
28
31
|
databaseId,
|
|
29
32
|
collectionId,
|
|
@@ -62,7 +65,7 @@ export class Pools {
|
|
|
62
65
|
return false;
|
|
63
66
|
}
|
|
64
67
|
|
|
65
|
-
const databasesService = await getDatabasesService();
|
|
68
|
+
const databasesService = await getDatabasesService(this.client);
|
|
66
69
|
const response = await databasesService.listIndexes(
|
|
67
70
|
databaseId,
|
|
68
71
|
collectionId,
|
|
@@ -117,7 +120,7 @@ export class Pools {
|
|
|
117
120
|
|
|
118
121
|
const { attributes } = await paginate(
|
|
119
122
|
async (args: any) => {
|
|
120
|
-
const databasesService = await getDatabasesService();
|
|
123
|
+
const databasesService = await getDatabasesService(this.client);
|
|
121
124
|
return await databasesService.listAttributes({
|
|
122
125
|
databaseId: args.databaseId,
|
|
123
126
|
collectionId: args.collectionId,
|
|
@@ -175,7 +178,7 @@ export class Pools {
|
|
|
175
178
|
|
|
176
179
|
const { attributes } = await paginate(
|
|
177
180
|
async (args: any) => {
|
|
178
|
-
const databasesService = await getDatabasesService();
|
|
181
|
+
const databasesService = await getDatabasesService(this.client);
|
|
179
182
|
return await databasesService.listAttributes(
|
|
180
183
|
args.databaseId,
|
|
181
184
|
args.collectionId,
|
|
@@ -243,7 +246,7 @@ export class Pools {
|
|
|
243
246
|
|
|
244
247
|
const { indexes } = await paginate(
|
|
245
248
|
async (args: any) => {
|
|
246
|
-
const databasesService = await getDatabasesService();
|
|
249
|
+
const databasesService = await getDatabasesService(this.client);
|
|
247
250
|
return await databasesService.listIndexes(
|
|
248
251
|
args.databaseId,
|
|
249
252
|
args.collectionId,
|
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.5.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
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import JSONbigModule from "json-bigint";
|
|
2
|
-
import { BigNumber } from "bignumber.js";
|
|
3
2
|
|
|
4
3
|
const JSONbigParser = JSONbigModule({ storeAsString: false });
|
|
5
4
|
const JSONbigSerializer = JSONbigModule({ useNativeBigInt: true });
|
|
@@ -7,8 +6,19 @@ const JSONbigSerializer = JSONbigModule({ useNativeBigInt: true });
|
|
|
7
6
|
const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
|
|
8
7
|
const MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);
|
|
9
8
|
|
|
9
|
+
function isBigNumber(value: any): boolean {
|
|
10
|
+
return (
|
|
11
|
+
value !== null &&
|
|
12
|
+
typeof value === "object" &&
|
|
13
|
+
value._isBigNumber === true &&
|
|
14
|
+
typeof value.isInteger === "function" &&
|
|
15
|
+
typeof value.toFixed === "function" &&
|
|
16
|
+
typeof value.toNumber === "function"
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
10
20
|
function reviver(_key: string, value: any): any {
|
|
11
|
-
if (
|
|
21
|
+
if (isBigNumber(value)) {
|
|
12
22
|
if (value.isInteger()) {
|
|
13
23
|
const str = value.toFixed();
|
|
14
24
|
const bi = BigInt(str);
|
package/lib/utils.ts
CHANGED
|
@@ -160,6 +160,21 @@ export function isCloud(): boolean {
|
|
|
160
160
|
return hostname.endsWith("appwrite.io");
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
+
export function arrayEqualsUnordered(left: unknown, right: unknown): boolean {
|
|
164
|
+
const a = Array.isArray(left)
|
|
165
|
+
? [...left].map((item) => String(item)).sort()
|
|
166
|
+
: [];
|
|
167
|
+
const b = Array.isArray(right)
|
|
168
|
+
? [...right].map((item) => String(item)).sort()
|
|
169
|
+
: [];
|
|
170
|
+
|
|
171
|
+
if (a.length !== b.length) {
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return a.every((value, index) => value === b[index]);
|
|
176
|
+
}
|
|
177
|
+
|
|
163
178
|
/**
|
|
164
179
|
* Filters an object to only include fields defined in a Zod object schema.
|
|
165
180
|
* Uses the schema's shape to determine allowed keys.
|
package/package.json
CHANGED
|
@@ -3,10 +3,23 @@
|
|
|
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.5.0",
|
|
7
7
|
"license": "BSD-3-Clause",
|
|
8
|
-
"main": "dist/index.
|
|
8
|
+
"main": "dist/index.cjs",
|
|
9
|
+
"module": "dist/index.js",
|
|
9
10
|
"types": "dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"require": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.cjs"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
10
23
|
"bin": {
|
|
11
24
|
"appwrite": "dist/cli.cjs"
|
|
12
25
|
},
|
|
@@ -17,8 +30,9 @@
|
|
|
17
30
|
"scripts": {
|
|
18
31
|
"build": "npm run build:types && npm run build:runtime",
|
|
19
32
|
"build:types": "tsc -p tsconfig.json --emitDeclarationOnly",
|
|
20
|
-
"build:runtime": "npm run build:lib:
|
|
21
|
-
"build:lib:
|
|
33
|
+
"build:runtime": "npm run build:lib:esm && npm run build:lib:cjs && npm run build:cli",
|
|
34
|
+
"build:lib:esm": "esbuild index.ts --bundle --platform=node --target=node18 --format=esm --loader:.hbs=text --outfile=dist/index.js",
|
|
35
|
+
"build:lib:cjs": "esbuild index.ts --bundle --platform=node --target=node18 --format=cjs --loader:.hbs=text --outfile=dist/index.cjs",
|
|
22
36
|
"build:cli": "esbuild cli.ts --bundle --platform=node --target=node18 --format=cjs --loader:.hbs=text --external:fsevents --outfile=dist/cli.cjs",
|
|
23
37
|
"format": "prettier --write \"**/*.{js,ts,json,md}\"",
|
|
24
38
|
"generate": "tsx scripts/generate-commands.ts",
|
|
@@ -32,8 +46,7 @@
|
|
|
32
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"
|
|
33
47
|
},
|
|
34
48
|
"dependencies": {
|
|
35
|
-
"@appwrite.io/console": "^
|
|
36
|
-
"bignumber.js": "^9.0.0",
|
|
49
|
+
"@appwrite.io/console": "^3.0.0",
|
|
37
50
|
"chalk": "4.1.2",
|
|
38
51
|
"chokidar": "^3.6.0",
|
|
39
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.5.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.5.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.5.0/appwrite-cli-win-arm64.exe",
|
|
19
19
|
"bin": [
|
|
20
20
|
[
|
|
21
21
|
"appwrite-cli-win-arm64.exe",
|