appwrite-cli 15.0.0 → 16.0.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 +14 -0
- package/README.md +3 -3
- package/cli.ts +2 -0
- package/dist/bundle-win-arm64.mjs +1387 -1087
- package/dist/cli.cjs +1331 -1031
- package/dist/index.cjs +987 -943
- package/dist/index.js +1043 -999
- package/dist/lib/commands/generators/typescript/databases.d.ts +5 -0
- package/dist/lib/commands/generators/typescript/databases.d.ts.map +1 -1
- package/dist/lib/commands/pull.d.ts.map +1 -1
- package/dist/lib/commands/services/functions.d.ts.map +1 -1
- package/dist/lib/commands/services/sites.d.ts.map +1 -1
- package/dist/lib/commands/services/storage.d.ts.map +1 -1
- package/dist/lib/commands/services/webhooks.d.ts +3 -0
- package/dist/lib/commands/services/webhooks.d.ts.map +1 -0
- package/dist/lib/commands/utils/deployment.d.ts +5 -0
- package/dist/lib/commands/utils/deployment.d.ts.map +1 -1
- package/dist/lib/constants.d.ts +1 -1
- package/dist/lib/parser.d.ts.map +1 -1
- package/docs/examples/webhooks/create.md +7 -0
- package/docs/examples/webhooks/delete.md +4 -0
- package/docs/examples/webhooks/get.md +4 -0
- package/docs/examples/webhooks/list.md +3 -0
- package/docs/examples/webhooks/update-signature.md +4 -0
- package/docs/examples/webhooks/update.md +7 -0
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/commands/generators/typescript/databases.ts +36 -6
- package/lib/commands/pull.ts +30 -12
- package/lib/commands/services/functions.ts +2 -1
- package/lib/commands/services/projects.ts +0 -100
- package/lib/commands/services/sites.ts +2 -1
- package/lib/commands/services/storage.ts +2 -1
- package/lib/commands/services/webhooks.ts +134 -0
- package/lib/commands/utils/deployment.ts +31 -7
- package/lib/constants.ts +1 -1
- package/lib/parser.ts +1 -0
- package/package.json +2 -2
- package/scoop/appwrite.config.json +3 -3
- package/docs/examples/projects/create-webhook.md +0 -8
- package/docs/examples/projects/delete-webhook.md +0 -5
- package/docs/examples/projects/get-webhook.md +0 -5
- package/docs/examples/projects/list-webhooks.md +0 -4
- package/docs/examples/projects/update-webhook-signature.md +0 -5
- package/docs/examples/projects/update-webhook.md +0 -9
|
@@ -30,6 +30,11 @@ export declare class TypeScriptDatabasesGenerator extends BaseDatabasesGenerator
|
|
|
30
30
|
private generateDatabasesFile;
|
|
31
31
|
private generateIndexFile;
|
|
32
32
|
private generateConstantsFile;
|
|
33
|
+
/**
|
|
34
|
+
* Deduplicate entities by composite key ($id + databaseId).
|
|
35
|
+
* Keeps the last occurrence to match addTable/addCollection semantics.
|
|
36
|
+
*/
|
|
37
|
+
private dedupeEntities;
|
|
33
38
|
generate(config: ConfigType, options?: GenerateOptions): Promise<GenerateResult>;
|
|
34
39
|
}
|
|
35
40
|
//# sourceMappingURL=databases.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"databases.d.ts","sourceRoot":"","sources":["../../../../../lib/commands/generators/typescript/databases.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAmB,MAAM,iBAAiB,CAAC;AAI9D,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAiCpB;;;GAGG;AACH,qBAAa,4BAA6B,SAAQ,sBAAsB;IACtE,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAgB;IACpD,QAAQ,CAAC,aAAa,QAAQ;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAoB;IACzC,OAAO,CAAC,kBAAkB,CAAqC;IAE/D,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI;IAIhE,OAAO,CAAC,SAAS;IAQjB;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAM9B,OAAO,CAAC,iBAAiB;IAwCzB,OAAO,CAAC,eAAe;IA6BvB,OAAO,CAAC,aAAa;IA4BrB,OAAO,CAAC,iB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G;IACU,aAAa,CACxB,MAAM,EAAE,UAAU,EAClB,OAAO,GAAE,WAAiD,GACzD,OAAO,CAAC,UAAU,CAAC;IA6DtB;;OAEG;IACU,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAezE;;OAEG;IACU,aAAa,CACxB,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,YAAY,EAAE,CAAC;IAkG1B;;OAEG;IACU,SAAS,CAAC,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAmG3E;;OAEG;IACU,eAAe,IAAI,OAAO,CAAC;QACtC,SAAS,EAAE,GAAG,EAAE,CAAC;QACjB,WAAW,EAAE,GAAG,EAAE,CAAC;KACpB,CAAC;IAiEF;;OAEG;IACU,UAAU,IAAI,OAAO,CAAC;QACjC,SAAS,EAAE,GAAG,EAAE,CAAC;QACjB,MAAM,EAAE,GAAG,EAAE,CAAC;KACf,CAAC;IA4EF;;OAEG;IACU,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAqC1C;;OAEG;IACU,SAAS,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAgCxC;;OAEG;IACU,mBAAmB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;CAoCnD;AAED,sCAAsC;AAEtC,eAAO,MAAM,aAAa,GAAU,sBAEjC;IACD,cAAc,CAAC,EAAE,OAAO,CAAC;CACrB,KAAG,OAAO,CAAC,IAAI,CAqCpB,CAAC;AAiOF,2BAA2B;AAE3B,eAAO,MAAM,IAAI,SAEqD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../../lib/commands/services/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../../lib/commands/services/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwBpC,eAAO,MAAM,SAAS,SAIlB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sites.d.ts","sourceRoot":"","sources":["../../../../lib/commands/services/sites.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"sites.d.ts","sourceRoot":"","sources":["../../../../lib/commands/services/sites.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwBpC,eAAO,MAAM,KAAK,SAId,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../lib/commands/services/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../lib/commands/services/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwBpC,eAAO,MAAM,OAAO,SAIhB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../../../lib/commands/services/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsBpC,eAAO,MAAM,QAAQ,SAIjB,CAAC"}
|
|
@@ -10,6 +10,11 @@ interface DeploymentDetails {
|
|
|
10
10
|
status: string;
|
|
11
11
|
[key: string]: unknown;
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Resolve a file path (file or directory) into a File object for upload.
|
|
15
|
+
* Directories are packaged into a tar.gz archive.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveFileParam(filePath: string): Promise<File>;
|
|
13
18
|
/**
|
|
14
19
|
* Download and extract deployment code for a resource
|
|
15
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployment.d.ts","sourceRoot":"","sources":["../../../../lib/commands/utils/deployment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deployment.d.ts","sourceRoot":"","sources":["../../../../lib/commands/utils/deployment.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAqB,MAAM,sBAAsB,CAAC;AAKjE,UAAU,oBAAoB;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,KAAK,CAAC;QACjB,GAAG,EAAE,MAAM,CAAC;KACb,CAAC,CAAC;CACJ;AAED,UAAU,iBAAiB;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAgCD;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAWtE;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,MAAM,EAAE;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC9C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,MAAM,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACrD,cAAc,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;IACjD,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6EhB;AAED,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,CAAC,QAAQ,EAAE,IAAI,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACjE,aAAa,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACrE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,iBAAiB,CAAC;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,oBAAoB,CAAC,CA6C/B"}
|
package/dist/lib/constants.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const SDK_TITLE = "Appwrite";
|
|
2
2
|
export declare const SDK_TITLE_LOWER = "appwrite";
|
|
3
|
-
export declare const SDK_VERSION = "
|
|
3
|
+
export declare const SDK_VERSION = "16.0.0";
|
|
4
4
|
export declare const SDK_NAME = "Command Line";
|
|
5
5
|
export declare const SDK_PLATFORM = "console";
|
|
6
6
|
export declare const SDK_LANGUAGE = "cli";
|
package/dist/lib/parser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../lib/parser.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAQ5C,QAAA,MAAM,SAAS,EAAE,SAQhB,CAAC;AAEF,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AA6B1C,eAAO,MAAM,KAAK,GAAI,MAAM,UAAU,KAAG,IA4BxC,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,MAAM,KAAK,CAAC,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC,KAAG,IA+DtE,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI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,SAAS,CAAC,KAAG,IA+DtE,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,MAAM,OAAO,KAAG,IAExC,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,KAAK,KAAK,KAAG,IA4DvC,CAAC;AAEF,eAAO,MAAM,YAAY,GACvB,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,EAElD,IAAI,CAAC,KACJ,CAAC,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAc5C,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,MAM5C,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,KAAG,OAIzC,CAAC;AAEF,eAAO,MAAM,GAAG,GAAI,UAAU,MAAM,KAAG,IAEtC,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,UAAU,MAAM,KAAG,IAIvC,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,UAAU,MAAM,KAAG,IAEvC,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,UAAU,MAAM,KAAG,IAI1C,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,UAAU,MAAM,KAAG,IAExC,CAAC;AAEF,eAAO,MAAM,IAAI,wXAAW,CAAC;AAE7B,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAgCtD,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
package/install.ps1
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
# You can use "View source" of this page to see the full script.
|
|
14
14
|
|
|
15
15
|
# REPO
|
|
16
|
-
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/
|
|
17
|
-
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/
|
|
16
|
+
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/16.0.0/appwrite-cli-win-x64.exe"
|
|
17
|
+
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/16.0.0/appwrite-cli-win-arm64.exe"
|
|
18
18
|
|
|
19
19
|
$APPWRITE_BINARY_NAME = "appwrite.exe"
|
|
20
20
|
|
package/install.sh
CHANGED
|
@@ -96,7 +96,7 @@ printSuccess() {
|
|
|
96
96
|
downloadBinary() {
|
|
97
97
|
echo "[2/4] Downloading executable for $OS ($ARCH) ..."
|
|
98
98
|
|
|
99
|
-
GITHUB_LATEST_VERSION="
|
|
99
|
+
GITHUB_LATEST_VERSION="16.0.0"
|
|
100
100
|
GITHUB_FILE="appwrite-cli-${OS}-${ARCH}"
|
|
101
101
|
GITHUB_URL="https://github.com/$GITHUB_REPOSITORY_NAME/releases/download/$GITHUB_LATEST_VERSION/$GITHUB_FILE"
|
|
102
102
|
|
|
@@ -425,6 +425,18 @@ ${
|
|
|
425
425
|
});
|
|
426
426
|
}
|
|
427
427
|
|
|
428
|
+
/**
|
|
429
|
+
* Deduplicate entities by composite key ($id + databaseId).
|
|
430
|
+
* Keeps the last occurrence to match addTable/addCollection semantics.
|
|
431
|
+
*/
|
|
432
|
+
private dedupeEntities<T extends Entity>(entities: T[]): T[] {
|
|
433
|
+
const seen = new Map<string, T>();
|
|
434
|
+
for (const entity of entities) {
|
|
435
|
+
seen.set(`${entity.databaseId}:${entity.$id}`, entity);
|
|
436
|
+
}
|
|
437
|
+
return Array.from(seen.values());
|
|
438
|
+
}
|
|
439
|
+
|
|
428
440
|
async generate(
|
|
429
441
|
config: ConfigType,
|
|
430
442
|
options?: GenerateOptions,
|
|
@@ -437,9 +449,20 @@ ${
|
|
|
437
449
|
options?.appwriteImportSource ?? getAppwriteDependency();
|
|
438
450
|
const importExt = options?.importExtension ?? detectImportExtension();
|
|
439
451
|
|
|
452
|
+
// Deduplicate entities to guard against corrupted configs
|
|
453
|
+
const dedupedConfig = { ...config };
|
|
454
|
+
if (dedupedConfig.tables && dedupedConfig.tables.length > 0) {
|
|
455
|
+
dedupedConfig.tables = this.dedupeEntities(dedupedConfig.tables);
|
|
456
|
+
}
|
|
457
|
+
if (dedupedConfig.collections && dedupedConfig.collections.length > 0) {
|
|
458
|
+
dedupedConfig.collections = this.dedupeEntities(
|
|
459
|
+
dedupedConfig.collections,
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
|
|
440
463
|
const hasEntities =
|
|
441
|
-
(
|
|
442
|
-
(
|
|
464
|
+
(dedupedConfig.tables && dedupedConfig.tables.length > 0) ||
|
|
465
|
+
(dedupedConfig.collections && dedupedConfig.collections.length > 0);
|
|
443
466
|
|
|
444
467
|
if (!hasEntities) {
|
|
445
468
|
console.log(
|
|
@@ -449,15 +472,22 @@ ${
|
|
|
449
472
|
dbContent: "// No tables or collections found in configuration\n",
|
|
450
473
|
typesContent: "// No tables or collections found in configuration\n",
|
|
451
474
|
indexContent: this.generateIndexFile(importExt),
|
|
452
|
-
constantsContent: this.generateConstantsFile(
|
|
475
|
+
constantsContent: this.generateConstantsFile(
|
|
476
|
+
dedupedConfig,
|
|
477
|
+
appwriteDep,
|
|
478
|
+
),
|
|
453
479
|
};
|
|
454
480
|
}
|
|
455
481
|
|
|
456
482
|
return {
|
|
457
|
-
dbContent: this.generateDatabasesFile(
|
|
458
|
-
|
|
483
|
+
dbContent: this.generateDatabasesFile(
|
|
484
|
+
dedupedConfig,
|
|
485
|
+
importExt,
|
|
486
|
+
appwriteDep,
|
|
487
|
+
),
|
|
488
|
+
typesContent: this.generateTypesFile(dedupedConfig, appwriteDep),
|
|
459
489
|
indexContent: this.generateIndexFile(importExt),
|
|
460
|
-
constantsContent: this.generateConstantsFile(
|
|
490
|
+
constantsContent: this.generateConstantsFile(dedupedConfig, appwriteDep),
|
|
461
491
|
};
|
|
462
492
|
}
|
|
463
493
|
}
|
package/lib/commands/pull.ts
CHANGED
|
@@ -266,7 +266,8 @@ export class Pull {
|
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
const { functions: allFunctions } = await paginate(
|
|
269
|
-
async () =>
|
|
269
|
+
async (args) =>
|
|
270
|
+
new Functions(this.projectClient).list(args.queries as string[]),
|
|
270
271
|
{},
|
|
271
272
|
100,
|
|
272
273
|
"functions",
|
|
@@ -366,7 +367,8 @@ export class Pull {
|
|
|
366
367
|
}
|
|
367
368
|
|
|
368
369
|
const { sites: fetchedSites } = await paginate(
|
|
369
|
-
async () =>
|
|
370
|
+
async (args) =>
|
|
371
|
+
new Sites(this.projectClient).list(args.queries as string[]),
|
|
370
372
|
{},
|
|
371
373
|
100,
|
|
372
374
|
"sites",
|
|
@@ -463,7 +465,8 @@ export class Pull {
|
|
|
463
465
|
}
|
|
464
466
|
|
|
465
467
|
const { databases } = await paginate(
|
|
466
|
-
async () =>
|
|
468
|
+
async (args) =>
|
|
469
|
+
new Databases(this.projectClient).list(args.queries as string[]),
|
|
467
470
|
{},
|
|
468
471
|
100,
|
|
469
472
|
"databases",
|
|
@@ -479,8 +482,11 @@ export class Pull {
|
|
|
479
482
|
allDatabases.push(database);
|
|
480
483
|
|
|
481
484
|
const { collections } = await paginate(
|
|
482
|
-
async () =>
|
|
483
|
-
new Databases(this.projectClient).listCollections(
|
|
485
|
+
async (args) =>
|
|
486
|
+
new Databases(this.projectClient).listCollections(
|
|
487
|
+
database.$id,
|
|
488
|
+
args.queries as string[],
|
|
489
|
+
),
|
|
484
490
|
{},
|
|
485
491
|
100,
|
|
486
492
|
"collections",
|
|
@@ -529,7 +535,10 @@ export class Pull {
|
|
|
529
535
|
}
|
|
530
536
|
|
|
531
537
|
const { databases } = await paginate(
|
|
532
|
-
async () =>
|
|
538
|
+
async (args) =>
|
|
539
|
+
new TablesDB(this.projectClient).list({
|
|
540
|
+
queries: args.queries as string[],
|
|
541
|
+
}),
|
|
533
542
|
{},
|
|
534
543
|
100,
|
|
535
544
|
"databases",
|
|
@@ -545,7 +554,11 @@ export class Pull {
|
|
|
545
554
|
allDatabases.push(filterBySchema(database, DatabaseSchema));
|
|
546
555
|
|
|
547
556
|
const { tables } = await paginate(
|
|
548
|
-
async () =>
|
|
557
|
+
async (args) =>
|
|
558
|
+
new TablesDB(this.projectClient).listTables({
|
|
559
|
+
databaseId: database.$id,
|
|
560
|
+
queries: args.queries as string[],
|
|
561
|
+
}),
|
|
549
562
|
{},
|
|
550
563
|
100,
|
|
551
564
|
"tables",
|
|
@@ -599,7 +612,8 @@ export class Pull {
|
|
|
599
612
|
}
|
|
600
613
|
|
|
601
614
|
const { buckets } = await paginate(
|
|
602
|
-
async () =>
|
|
615
|
+
async (args) =>
|
|
616
|
+
new Storage(this.projectClient).listBuckets(args.queries as string[]),
|
|
603
617
|
{},
|
|
604
618
|
100,
|
|
605
619
|
"buckets",
|
|
@@ -638,7 +652,8 @@ export class Pull {
|
|
|
638
652
|
}
|
|
639
653
|
|
|
640
654
|
const { teams } = await paginate(
|
|
641
|
-
async () =>
|
|
655
|
+
async (args) =>
|
|
656
|
+
new Teams(this.projectClient).list(args.queries as string[]),
|
|
642
657
|
{},
|
|
643
658
|
100,
|
|
644
659
|
"teams",
|
|
@@ -672,7 +687,8 @@ export class Pull {
|
|
|
672
687
|
}
|
|
673
688
|
|
|
674
689
|
const { topics } = await paginate(
|
|
675
|
-
async () =>
|
|
690
|
+
async (args) =>
|
|
691
|
+
new Messaging(this.projectClient).listTopics(args.queries as string[]),
|
|
676
692
|
{},
|
|
677
693
|
100,
|
|
678
694
|
"topics",
|
|
@@ -763,7 +779,8 @@ const pullFunctions = async ({
|
|
|
763
779
|
const functionsToCheck = cliConfig.all
|
|
764
780
|
? (
|
|
765
781
|
await paginate(
|
|
766
|
-
async () =>
|
|
782
|
+
async (args) =>
|
|
783
|
+
(await getFunctionsService()).list(args.queries as string[]),
|
|
767
784
|
{},
|
|
768
785
|
100,
|
|
769
786
|
"functions",
|
|
@@ -811,7 +828,8 @@ const pullSites = async ({
|
|
|
811
828
|
const sitesToCheck = cliConfig.all
|
|
812
829
|
? (
|
|
813
830
|
await paginate(
|
|
814
|
-
async () =>
|
|
831
|
+
async (args) =>
|
|
832
|
+
(await getSitesService()).list(args.queries as string[]),
|
|
815
833
|
{},
|
|
816
834
|
100,
|
|
817
835
|
"sites",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
2
|
import fs from "fs";
|
|
3
|
+
import { resolveFileParam } from "../utils/deployment.js";
|
|
3
4
|
import { sdkForProject } from "../../sdks.js";
|
|
4
5
|
import {
|
|
5
6
|
actionRunner,
|
|
@@ -263,7 +264,7 @@ Use the "command" param to set the entrypoint used to execute your code.`)
|
|
|
263
264
|
.action(
|
|
264
265
|
actionRunner(
|
|
265
266
|
async ({ functionId, code, activate, entrypoint, commands }) =>
|
|
266
|
-
parse(await (await getFunctionsClient()).createDeployment(functionId, code, activate, entrypoint, commands)),
|
|
267
|
+
parse(await (await getFunctionsClient()).createDeployment(functionId, code !== undefined ? await resolveFileParam(code) : undefined, activate, entrypoint, commands)),
|
|
267
268
|
),
|
|
268
269
|
);
|
|
269
270
|
|
|
@@ -760,103 +760,3 @@ projects
|
|
|
760
760
|
),
|
|
761
761
|
);
|
|
762
762
|
|
|
763
|
-
projects
|
|
764
|
-
.command(`list-webhooks`)
|
|
765
|
-
.description(`Get a list of all webhooks belonging to the project. You can use the query params to filter your results. `)
|
|
766
|
-
.requiredOption(`--project-id <project-id>`, `Project unique ID.`)
|
|
767
|
-
.option(
|
|
768
|
-
`--total [value]`,
|
|
769
|
-
`When set to false, the total count returned will be 0 and will not be calculated.`,
|
|
770
|
-
(value: string | undefined) =>
|
|
771
|
-
value === undefined ? true : parseBool(value),
|
|
772
|
-
)
|
|
773
|
-
.action(
|
|
774
|
-
actionRunner(
|
|
775
|
-
async ({ projectId, total }) =>
|
|
776
|
-
parse(await (await getProjectsClient()).listWebhooks(projectId, total)),
|
|
777
|
-
),
|
|
778
|
-
);
|
|
779
|
-
|
|
780
|
-
projects
|
|
781
|
-
.command(`create-webhook`)
|
|
782
|
-
.description(`Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur. `)
|
|
783
|
-
.requiredOption(`--project-id <project-id>`, `Project unique ID.`)
|
|
784
|
-
.requiredOption(`--name <name>`, `Webhook name. Max length: 128 chars.`)
|
|
785
|
-
.requiredOption(`--events [events...]`, `Events list. Maximum of 100 events are allowed.`)
|
|
786
|
-
.requiredOption(`--url <url>`, `Webhook URL.`)
|
|
787
|
-
.requiredOption(`--security <security>`, `Certificate verification, false for disabled or true for enabled.`, parseBool)
|
|
788
|
-
.option(
|
|
789
|
-
`--enabled [value]`,
|
|
790
|
-
`Enable or disable a webhook.`,
|
|
791
|
-
(value: string | undefined) =>
|
|
792
|
-
value === undefined ? true : parseBool(value),
|
|
793
|
-
)
|
|
794
|
-
.option(`--http-user <http-user>`, `Webhook HTTP user. Max length: 256 chars.`)
|
|
795
|
-
.option(`--http-pass <http-pass>`, `Webhook HTTP password. Max length: 256 chars.`)
|
|
796
|
-
.action(
|
|
797
|
-
actionRunner(
|
|
798
|
-
async ({ projectId, name, events, url, security, enabled, httpUser, httpPass }) =>
|
|
799
|
-
parse(await (await getProjectsClient()).createWebhook(projectId, name, events, url, security, enabled, httpUser, httpPass)),
|
|
800
|
-
),
|
|
801
|
-
);
|
|
802
|
-
|
|
803
|
-
projects
|
|
804
|
-
.command(`get-webhook`)
|
|
805
|
-
.description(`Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project. `)
|
|
806
|
-
.requiredOption(`--project-id <project-id>`, `Project unique ID.`)
|
|
807
|
-
.requiredOption(`--webhook-id <webhook-id>`, `Webhook unique ID.`)
|
|
808
|
-
.action(
|
|
809
|
-
actionRunner(
|
|
810
|
-
async ({ projectId, webhookId }) =>
|
|
811
|
-
parse(await (await getProjectsClient()).getWebhook(projectId, webhookId)),
|
|
812
|
-
),
|
|
813
|
-
);
|
|
814
|
-
|
|
815
|
-
projects
|
|
816
|
-
.command(`update-webhook`)
|
|
817
|
-
.description(`Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook. `)
|
|
818
|
-
.requiredOption(`--project-id <project-id>`, `Project unique ID.`)
|
|
819
|
-
.requiredOption(`--webhook-id <webhook-id>`, `Webhook unique ID.`)
|
|
820
|
-
.requiredOption(`--name <name>`, `Webhook name. Max length: 128 chars.`)
|
|
821
|
-
.requiredOption(`--events [events...]`, `Events list. Maximum of 100 events are allowed.`)
|
|
822
|
-
.requiredOption(`--url <url>`, `Webhook URL.`)
|
|
823
|
-
.requiredOption(`--security <security>`, `Certificate verification, false for disabled or true for enabled.`, parseBool)
|
|
824
|
-
.option(
|
|
825
|
-
`--enabled [value]`,
|
|
826
|
-
`Enable or disable a webhook.`,
|
|
827
|
-
(value: string | undefined) =>
|
|
828
|
-
value === undefined ? true : parseBool(value),
|
|
829
|
-
)
|
|
830
|
-
.option(`--http-user <http-user>`, `Webhook HTTP user. Max length: 256 chars.`)
|
|
831
|
-
.option(`--http-pass <http-pass>`, `Webhook HTTP password. Max length: 256 chars.`)
|
|
832
|
-
.action(
|
|
833
|
-
actionRunner(
|
|
834
|
-
async ({ projectId, webhookId, name, events, url, security, enabled, httpUser, httpPass }) =>
|
|
835
|
-
parse(await (await getProjectsClient()).updateWebhook(projectId, webhookId, name, events, url, security, enabled, httpUser, httpPass)),
|
|
836
|
-
),
|
|
837
|
-
);
|
|
838
|
-
|
|
839
|
-
projects
|
|
840
|
-
.command(`delete-webhook`)
|
|
841
|
-
.description(`Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events. `)
|
|
842
|
-
.requiredOption(`--project-id <project-id>`, `Project unique ID.`)
|
|
843
|
-
.requiredOption(`--webhook-id <webhook-id>`, `Webhook unique ID.`)
|
|
844
|
-
.action(
|
|
845
|
-
actionRunner(
|
|
846
|
-
async ({ projectId, webhookId }) =>
|
|
847
|
-
parse(await (await getProjectsClient()).deleteWebhook(projectId, webhookId)),
|
|
848
|
-
),
|
|
849
|
-
);
|
|
850
|
-
|
|
851
|
-
projects
|
|
852
|
-
.command(`update-webhook-signature`)
|
|
853
|
-
.description(`Update the webhook signature key. This endpoint can be used to regenerate the signature key used to sign and validate payload deliveries for a specific webhook. `)
|
|
854
|
-
.requiredOption(`--project-id <project-id>`, `Project unique ID.`)
|
|
855
|
-
.requiredOption(`--webhook-id <webhook-id>`, `Webhook unique ID.`)
|
|
856
|
-
.action(
|
|
857
|
-
actionRunner(
|
|
858
|
-
async ({ projectId, webhookId }) =>
|
|
859
|
-
parse(await (await getProjectsClient()).updateWebhookSignature(projectId, webhookId)),
|
|
860
|
-
),
|
|
861
|
-
);
|
|
862
|
-
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
2
|
import fs from "fs";
|
|
3
|
+
import { resolveFileParam } from "../utils/deployment.js";
|
|
3
4
|
import { sdkForProject } from "../../sdks.js";
|
|
4
5
|
import {
|
|
5
6
|
actionRunner,
|
|
@@ -261,7 +262,7 @@ sites
|
|
|
261
262
|
.action(
|
|
262
263
|
actionRunner(
|
|
263
264
|
async ({ siteId, code, installCommand, buildCommand, outputDirectory, activate }) =>
|
|
264
|
-
parse(await (await getSitesClient()).createDeployment(siteId, code, installCommand, buildCommand, outputDirectory, activate)),
|
|
265
|
+
parse(await (await getSitesClient()).createDeployment(siteId, code !== undefined ? await resolveFileParam(code) : undefined, installCommand, buildCommand, outputDirectory, activate)),
|
|
265
266
|
),
|
|
266
267
|
);
|
|
267
268
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
2
|
import fs from "fs";
|
|
3
|
+
import { resolveFileParam } from "../utils/deployment.js";
|
|
3
4
|
import { sdkForProject } from "../../sdks.js";
|
|
4
5
|
import {
|
|
5
6
|
actionRunner,
|
|
@@ -195,7 +196,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunking l
|
|
|
195
196
|
.action(
|
|
196
197
|
actionRunner(
|
|
197
198
|
async ({ bucketId, fileId, file, permissions }) =>
|
|
198
|
-
parse(await (await getStorageClient()).createFile(bucketId, fileId, file, permissions)),
|
|
199
|
+
parse(await (await getStorageClient()).createFile(bucketId, fileId, file !== undefined ? await resolveFileParam(file) : undefined, permissions)),
|
|
199
200
|
),
|
|
200
201
|
);
|
|
201
202
|
|
|
@@ -0,0 +1,134 @@
|
|
|
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 { Webhooks } from "@appwrite.io/console";
|
|
12
|
+
|
|
13
|
+
let webhooksClient: Webhooks | null = null;
|
|
14
|
+
|
|
15
|
+
const getWebhooksClient = async (): Promise<Webhooks> => {
|
|
16
|
+
if (!webhooksClient) {
|
|
17
|
+
const sdkClient = await sdkForProject();
|
|
18
|
+
webhooksClient = new Webhooks(sdkClient);
|
|
19
|
+
}
|
|
20
|
+
return webhooksClient;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const webhooks = new Command("webhooks")
|
|
24
|
+
.description(commandDescriptions["webhooks"] ?? "")
|
|
25
|
+
.configureHelp({
|
|
26
|
+
helpWidth: process.stdout.columns || 80,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
webhooks
|
|
30
|
+
.command(`list`)
|
|
31
|
+
.description(`Get a list of all webhooks belonging to the project. You can use the query params to filter your results.`)
|
|
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. You may filter on the following attributes: name, url, httpUser, security, events, enabled, logs, attempts`)
|
|
33
|
+
.option(
|
|
34
|
+
`--total [value]`,
|
|
35
|
+
`When set to false, the total count returned will be 0 and will not be calculated.`,
|
|
36
|
+
(value: string | undefined) =>
|
|
37
|
+
value === undefined ? true : parseBool(value),
|
|
38
|
+
)
|
|
39
|
+
.action(
|
|
40
|
+
actionRunner(
|
|
41
|
+
async ({ queries, total }) =>
|
|
42
|
+
parse(await (await getWebhooksClient()).list(queries, total)),
|
|
43
|
+
),
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
webhooks
|
|
47
|
+
.command(`create`)
|
|
48
|
+
.description(`Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur.`)
|
|
49
|
+
.requiredOption(`--webhook-id <webhook-id>`, `Webhook 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.`)
|
|
50
|
+
.requiredOption(`--url <url>`, `Webhook URL.`)
|
|
51
|
+
.requiredOption(`--name <name>`, `Webhook name. Max length: 128 chars.`)
|
|
52
|
+
.requiredOption(`--events [events...]`, `Events list. Maximum of 100 events are allowed.`)
|
|
53
|
+
.option(
|
|
54
|
+
`--enabled [value]`,
|
|
55
|
+
`Enable or disable a webhook.`,
|
|
56
|
+
(value: string | undefined) =>
|
|
57
|
+
value === undefined ? true : parseBool(value),
|
|
58
|
+
)
|
|
59
|
+
.option(
|
|
60
|
+
`--security [value]`,
|
|
61
|
+
`Certificate verification, false for disabled or true for enabled.`,
|
|
62
|
+
(value: string | undefined) =>
|
|
63
|
+
value === undefined ? true : parseBool(value),
|
|
64
|
+
)
|
|
65
|
+
.option(`--http-user <http-user>`, `Webhook HTTP user. Max length: 256 chars.`)
|
|
66
|
+
.option(`--http-pass <http-pass>`, `Webhook HTTP password. Max length: 256 chars.`)
|
|
67
|
+
.action(
|
|
68
|
+
actionRunner(
|
|
69
|
+
async ({ webhookId, url, name, events, enabled, security, httpUser, httpPass }) =>
|
|
70
|
+
parse(await (await getWebhooksClient()).create(webhookId, url, name, events, enabled, security, httpUser, httpPass)),
|
|
71
|
+
),
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
webhooks
|
|
75
|
+
.command(`get`)
|
|
76
|
+
.description(`Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project. `)
|
|
77
|
+
.requiredOption(`--webhook-id <webhook-id>`, `Webhook ID.`)
|
|
78
|
+
.action(
|
|
79
|
+
actionRunner(
|
|
80
|
+
async ({ webhookId }) =>
|
|
81
|
+
parse(await (await getWebhooksClient()).get(webhookId)),
|
|
82
|
+
),
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
webhooks
|
|
86
|
+
.command(`update`)
|
|
87
|
+
.description(`Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook.`)
|
|
88
|
+
.requiredOption(`--webhook-id <webhook-id>`, `Webhook ID.`)
|
|
89
|
+
.requiredOption(`--name <name>`, `Webhook name. Max length: 128 chars.`)
|
|
90
|
+
.requiredOption(`--url <url>`, `Webhook URL.`)
|
|
91
|
+
.requiredOption(`--events [events...]`, `Events list. Maximum of 100 events are allowed.`)
|
|
92
|
+
.option(
|
|
93
|
+
`--enabled [value]`,
|
|
94
|
+
`Enable or disable a webhook.`,
|
|
95
|
+
(value: string | undefined) =>
|
|
96
|
+
value === undefined ? true : parseBool(value),
|
|
97
|
+
)
|
|
98
|
+
.option(
|
|
99
|
+
`--security [value]`,
|
|
100
|
+
`Certificate verification, false for disabled or true for enabled.`,
|
|
101
|
+
(value: string | undefined) =>
|
|
102
|
+
value === undefined ? true : parseBool(value),
|
|
103
|
+
)
|
|
104
|
+
.option(`--http-user <http-user>`, `Webhook HTTP user. Max length: 256 chars.`)
|
|
105
|
+
.option(`--http-pass <http-pass>`, `Webhook HTTP password. Max length: 256 chars.`)
|
|
106
|
+
.action(
|
|
107
|
+
actionRunner(
|
|
108
|
+
async ({ webhookId, name, url, events, enabled, security, httpUser, httpPass }) =>
|
|
109
|
+
parse(await (await getWebhooksClient()).update(webhookId, name, url, events, enabled, security, httpUser, httpPass)),
|
|
110
|
+
),
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
webhooks
|
|
114
|
+
.command(`delete`)
|
|
115
|
+
.description(`Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events. `)
|
|
116
|
+
.requiredOption(`--webhook-id <webhook-id>`, `Webhook ID.`)
|
|
117
|
+
.action(
|
|
118
|
+
actionRunner(
|
|
119
|
+
async ({ webhookId }) =>
|
|
120
|
+
parse(await (await getWebhooksClient()).delete(webhookId)),
|
|
121
|
+
),
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
webhooks
|
|
125
|
+
.command(`update-signature`)
|
|
126
|
+
.description(`Update the webhook signature key. This endpoint can be used to regenerate the signature key used to sign and validate payload deliveries for a specific webhook.`)
|
|
127
|
+
.requiredOption(`--webhook-id <webhook-id>`, `Webhook ID.`)
|
|
128
|
+
.action(
|
|
129
|
+
actionRunner(
|
|
130
|
+
async ({ webhookId }) =>
|
|
131
|
+
parse(await (await getWebhooksClient()).updateSignature(webhookId)),
|
|
132
|
+
),
|
|
133
|
+
);
|
|
134
|
+
|