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.
Files changed (45) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +3 -3
  3. package/cli.ts +2 -0
  4. package/dist/bundle-win-arm64.mjs +1387 -1087
  5. package/dist/cli.cjs +1331 -1031
  6. package/dist/index.cjs +987 -943
  7. package/dist/index.js +1043 -999
  8. package/dist/lib/commands/generators/typescript/databases.d.ts +5 -0
  9. package/dist/lib/commands/generators/typescript/databases.d.ts.map +1 -1
  10. package/dist/lib/commands/pull.d.ts.map +1 -1
  11. package/dist/lib/commands/services/functions.d.ts.map +1 -1
  12. package/dist/lib/commands/services/sites.d.ts.map +1 -1
  13. package/dist/lib/commands/services/storage.d.ts.map +1 -1
  14. package/dist/lib/commands/services/webhooks.d.ts +3 -0
  15. package/dist/lib/commands/services/webhooks.d.ts.map +1 -0
  16. package/dist/lib/commands/utils/deployment.d.ts +5 -0
  17. package/dist/lib/commands/utils/deployment.d.ts.map +1 -1
  18. package/dist/lib/constants.d.ts +1 -1
  19. package/dist/lib/parser.d.ts.map +1 -1
  20. package/docs/examples/webhooks/create.md +7 -0
  21. package/docs/examples/webhooks/delete.md +4 -0
  22. package/docs/examples/webhooks/get.md +4 -0
  23. package/docs/examples/webhooks/list.md +3 -0
  24. package/docs/examples/webhooks/update-signature.md +4 -0
  25. package/docs/examples/webhooks/update.md +7 -0
  26. package/install.ps1 +2 -2
  27. package/install.sh +1 -1
  28. package/lib/commands/generators/typescript/databases.ts +36 -6
  29. package/lib/commands/pull.ts +30 -12
  30. package/lib/commands/services/functions.ts +2 -1
  31. package/lib/commands/services/projects.ts +0 -100
  32. package/lib/commands/services/sites.ts +2 -1
  33. package/lib/commands/services/storage.ts +2 -1
  34. package/lib/commands/services/webhooks.ts +134 -0
  35. package/lib/commands/utils/deployment.ts +31 -7
  36. package/lib/constants.ts +1 -1
  37. package/lib/parser.ts +1 -0
  38. package/package.json +2 -2
  39. package/scoop/appwrite.config.json +3 -3
  40. package/docs/examples/projects/create-webhook.md +0 -8
  41. package/docs/examples/projects/delete-webhook.md +0 -5
  42. package/docs/examples/projects/get-webhook.md +0 -5
  43. package/docs/examples/projects/list-webhooks.md +0 -4
  44. package/docs/examples/projects/update-webhook-signature.md +0 -5
  45. package/docs/examples/projects/update-webhook.md +0 -9
@@ -1,4 +1,5 @@
1
1
  import fs from "fs";
2
+ import os from "os";
2
3
  import path from "path";
3
4
  import { create, extract } from "tar";
4
5
  import { Client, AppwriteException } from "@appwrite.io/console";
@@ -21,10 +22,12 @@ interface DeploymentDetails {
21
22
 
22
23
  /**
23
24
  * Package a directory into a tar.gz File object for deployment
24
- * @private - Only used internally by pushDeployment
25
25
  */
26
26
  async function packageDirectory(dirPath: string): Promise<File> {
27
- const tempFile = `${dirPath.replace(/[^a-zA-Z0-9]/g, "_")}-${Date.now()}.tar.gz`;
27
+ const tempFile = path.join(
28
+ os.tmpdir(),
29
+ `appwrite-deploy-${Date.now()}.tar.gz`,
30
+ );
28
31
 
29
32
  await create(
30
33
  {
@@ -35,12 +38,33 @@ async function packageDirectory(dirPath: string): Promise<File> {
35
38
  ["."],
36
39
  );
37
40
 
38
- const buffer = fs.readFileSync(tempFile);
39
- fs.unlinkSync(tempFile);
41
+ try {
42
+ const buffer = fs.readFileSync(tempFile);
43
+ return new File([buffer], path.basename(tempFile), {
44
+ type: "application/gzip",
45
+ });
46
+ } finally {
47
+ if (fs.existsSync(tempFile)) {
48
+ fs.unlinkSync(tempFile);
49
+ }
50
+ }
51
+ }
40
52
 
41
- return new File([buffer], path.basename(tempFile), {
42
- type: "application/gzip",
43
- });
53
+ /**
54
+ * Resolve a file path (file or directory) into a File object for upload.
55
+ * Directories are packaged into a tar.gz archive.
56
+ */
57
+ export async function resolveFileParam(filePath: string): Promise<File> {
58
+ const resolved = path.resolve(filePath);
59
+ if (!fs.existsSync(resolved)) {
60
+ throw new Error(`File or directory not found: ${resolved}`);
61
+ }
62
+ const stat = fs.statSync(resolved);
63
+ if (stat.isDirectory()) {
64
+ return packageDirectory(resolved);
65
+ }
66
+ const buffer = fs.readFileSync(resolved);
67
+ return new File([buffer], path.basename(resolved));
44
68
  }
45
69
 
46
70
  /**
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 = '15.0.0';
4
+ export const SDK_VERSION = '16.0.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/parser.ts CHANGED
@@ -305,6 +305,7 @@ export const commandDescriptions: Record<string, string> = {
305
305
  messaging: `The messaging command allows you to manage topics and targets and send messages.`,
306
306
  migrations: `The migrations command allows you to migrate data between services.`,
307
307
  vcs: `The vcs command allows you to interact with VCS providers and manage your code repositories.`,
308
+ webhooks: `The webhooks command allows you to manage your project webhooks.`,
308
309
  main: chalk.redBright(`${logo}${description}`),
309
310
  };
310
311
 
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": "15.0.0",
6
+ "version": "16.0.0",
7
7
  "license": "BSD-3-Clause",
8
8
  "main": "dist/index.cjs",
9
9
  "module": "dist/index.js",
@@ -47,7 +47,7 @@
47
47
  "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"
48
48
  },
49
49
  "dependencies": {
50
- "@appwrite.io/console": "^5.0.0",
50
+ "@appwrite.io/console": "*",
51
51
  "chalk": "4.1.2",
52
52
  "chokidar": "^3.6.0",
53
53
  "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": "15.0.0",
3
+ "version": "16.0.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/15.0.0/appwrite-cli-win-x64.exe",
9
+ "url": "https://github.com/appwrite/sdk-for-cli/releases/download/16.0.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/15.0.0/appwrite-cli-win-arm64.exe",
18
+ "url": "https://github.com/appwrite/sdk-for-cli/releases/download/16.0.0/appwrite-cli-win-arm64.exe",
19
19
  "bin": [
20
20
  [
21
21
  "appwrite-cli-win-arm64.exe",
@@ -1,8 +0,0 @@
1
- ```bash
2
- appwrite projects create-webhook \
3
- --project-id <PROJECT_ID> \
4
- --name <NAME> \
5
- --events one two three \
6
- --url '' \
7
- --security false
8
- ```
@@ -1,5 +0,0 @@
1
- ```bash
2
- appwrite projects delete-webhook \
3
- --project-id <PROJECT_ID> \
4
- --webhook-id <WEBHOOK_ID>
5
- ```
@@ -1,5 +0,0 @@
1
- ```bash
2
- appwrite projects get-webhook \
3
- --project-id <PROJECT_ID> \
4
- --webhook-id <WEBHOOK_ID>
5
- ```
@@ -1,4 +0,0 @@
1
- ```bash
2
- appwrite projects list-webhooks \
3
- --project-id <PROJECT_ID>
4
- ```
@@ -1,5 +0,0 @@
1
- ```bash
2
- appwrite projects update-webhook-signature \
3
- --project-id <PROJECT_ID> \
4
- --webhook-id <WEBHOOK_ID>
5
- ```
@@ -1,9 +0,0 @@
1
- ```bash
2
- appwrite projects update-webhook \
3
- --project-id <PROJECT_ID> \
4
- --webhook-id <WEBHOOK_ID> \
5
- --name <NAME> \
6
- --events one two three \
7
- --url '' \
8
- --security false
9
- ```