appwrite-cli 17.0.0 → 17.2.1
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/.github/workflows/ci.yml +1 -1
- package/.github/workflows/publish.yml +1 -1
- package/CHANGELOG.md +20 -0
- package/README.md +2 -2
- package/bun.lock +783 -0
- package/cli.ts +19 -1
- package/dist/bundle-win-arm64.mjs +1515 -744
- package/dist/cli.cjs +1515 -744
- package/dist/index.cjs +322 -118
- package/dist/index.js +322 -118
- package/dist/lib/client.d.ts +9 -0
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/commands/init.d.ts.map +1 -1
- package/dist/lib/commands/services/organizations.d.ts +3 -0
- package/dist/lib/commands/services/organizations.d.ts.map +1 -0
- package/dist/lib/commands/services/teams.d.ts.map +1 -1
- package/dist/lib/constants.d.ts +1 -1
- package/dist/lib/emulation/docker.d.ts.map +1 -1
- package/dist/lib/emulation/utils.d.ts.map +1 -1
- package/dist/lib/parser.d.ts.map +1 -1
- package/dist/lib/questions.d.ts.map +1 -1
- package/dist/lib/types.d.ts +3 -0
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/utils.d.ts +12 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/docs/examples/organizations/add-credit.md +5 -0
- package/docs/examples/organizations/cancel-downgrade.md +4 -0
- package/docs/examples/organizations/create-downgrade-feedback.md +8 -0
- package/docs/examples/organizations/create-invoice-payment.md +6 -0
- package/docs/examples/organizations/create-key.md +6 -0
- package/docs/examples/organizations/create.md +6 -0
- package/docs/examples/organizations/delete-backup-payment-method.md +4 -0
- package/docs/examples/organizations/delete-default-payment-method.md +4 -0
- package/docs/examples/organizations/delete-key.md +5 -0
- package/docs/examples/organizations/delete.md +4 -0
- package/docs/examples/organizations/estimation-create-organization.md +4 -0
- package/docs/examples/organizations/estimation-delete-organization.md +4 -0
- package/docs/examples/organizations/estimation-update-plan.md +5 -0
- package/docs/examples/organizations/get-aggregation.md +5 -0
- package/docs/examples/organizations/get-available-credits.md +4 -0
- package/docs/examples/organizations/get-credit.md +5 -0
- package/docs/examples/organizations/get-invoice-download.md +5 -0
- package/docs/examples/organizations/get-invoice-view.md +5 -0
- package/docs/examples/organizations/get-invoice.md +5 -0
- package/docs/examples/organizations/get-key.md +5 -0
- package/docs/examples/organizations/get-plan.md +4 -0
- package/docs/examples/organizations/get-scopes.md +4 -0
- package/docs/examples/organizations/get-usage.md +4 -0
- package/docs/examples/organizations/list-aggregations.md +4 -0
- package/docs/examples/organizations/list-credits.md +4 -0
- package/docs/examples/organizations/list-keys.md +4 -0
- package/docs/examples/organizations/list-regions.md +4 -0
- package/docs/examples/organizations/list.md +3 -0
- package/docs/examples/organizations/set-backup-payment-method.md +5 -0
- package/docs/examples/organizations/set-billing-address.md +5 -0
- package/docs/examples/organizations/set-billing-email.md +5 -0
- package/docs/examples/organizations/set-billing-tax-id.md +5 -0
- package/docs/examples/organizations/set-default-payment-method.md +5 -0
- package/docs/examples/organizations/update-budget.md +5 -0
- package/docs/examples/organizations/update-key.md +7 -0
- package/docs/examples/organizations/update-plan.md +5 -0
- package/docs/examples/organizations/validate-invoice.md +5 -0
- package/docs/examples/organizations/validate-payment.md +4 -0
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/client.ts +12 -0
- package/lib/commands/init.ts +109 -2
- package/lib/commands/services/account.ts +110 -55
- package/lib/commands/services/activities.ts +4 -2
- package/lib/commands/services/backups.ts +24 -12
- package/lib/commands/services/databases.ts +150 -75
- package/lib/commands/services/functions.ts +60 -30
- package/lib/commands/services/graphql.ts +4 -2
- package/lib/commands/services/health.ts +46 -23
- package/lib/commands/services/locale.ts +16 -8
- package/lib/commands/services/messaging.ts +96 -48
- package/lib/commands/services/migrations.ts +30 -16
- package/lib/commands/services/organizations.ts +555 -0
- package/lib/commands/services/project.ts +12 -6
- package/lib/commands/services/projects.ts +105 -53
- package/lib/commands/services/proxy.ts +18 -10
- package/lib/commands/services/sites.ts +58 -29
- package/lib/commands/services/storage.ts +30 -15
- package/lib/commands/services/tables-db.ts +148 -74
- package/lib/commands/services/teams.ts +38 -15
- package/lib/commands/services/tokens.ts +10 -5
- package/lib/commands/services/users.ts +88 -44
- package/lib/commands/services/vcs.ts +22 -12
- package/lib/commands/services/webhooks.ts +12 -6
- package/lib/constants.ts +1 -1
- package/lib/emulation/docker.ts +1 -0
- package/lib/emulation/utils.ts +3 -2
- package/lib/parser.ts +356 -77
- package/lib/questions.ts +8 -3
- package/lib/types.ts +3 -0
- package/lib/utils.ts +234 -0
- package/package.json +1 -1
- package/scoop/appwrite.config.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
import {
|
|
2
|
+
import { sdkForConsole } from "../../sdks.js";
|
|
3
3
|
import {
|
|
4
4
|
actionRunner,
|
|
5
5
|
commandDescriptions,
|
|
@@ -14,7 +14,7 @@ let vcsClient: Vcs | null = null;
|
|
|
14
14
|
|
|
15
15
|
const getVcsClient = async (): Promise<Vcs> => {
|
|
16
16
|
if (!vcsClient) {
|
|
17
|
-
const sdkClient = await
|
|
17
|
+
const sdkClient = await sdkForConsole();
|
|
18
18
|
vcsClient = new Vcs(sdkClient);
|
|
19
19
|
}
|
|
20
20
|
return vcsClient;
|
|
@@ -26,7 +26,7 @@ export const vcs = new Command("vcs")
|
|
|
26
26
|
helpWidth: process.stdout.columns || 80,
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
vcs
|
|
29
|
+
const vcsCreateRepositoryDetectionCommand = vcs
|
|
30
30
|
.command(`create-repository-detection`)
|
|
31
31
|
.description(`Analyze a GitHub repository to automatically detect the programming language and runtime environment. This endpoint scans the repository's files and language statistics to determine the appropriate runtime settings for your function. The GitHub installation must be properly configured and the repository must be accessible through your installation for this endpoint to work.`)
|
|
32
32
|
.requiredOption(`--installation-id <installation-id>`, `Installation Id`)
|
|
@@ -40,7 +40,8 @@ vcs
|
|
|
40
40
|
),
|
|
41
41
|
);
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
|
|
44
|
+
const vcsListRepositoriesCommand = vcs
|
|
44
45
|
.command(`list-repositories`)
|
|
45
46
|
.description(`Get a list of GitHub repositories available through your installation. This endpoint returns repositories with their basic information, detected runtime environments, and latest push dates. You can optionally filter repositories using a search term. Each repository's runtime is automatically detected based on its contents and language statistics. The GitHub installation must be properly configured for this endpoint to work.`)
|
|
46
47
|
.requiredOption(`--installation-id <installation-id>`, `Installation Id`)
|
|
@@ -54,7 +55,8 @@ vcs
|
|
|
54
55
|
),
|
|
55
56
|
);
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
|
|
59
|
+
const vcsCreateRepositoryCommand = vcs
|
|
58
60
|
.command(`create-repository`)
|
|
59
61
|
.description(`Create a new GitHub repository through your installation. This endpoint allows you to create either a public or private repository by specifying a name and visibility setting. The repository will be created under your GitHub user account or organization, depending on your installation type. The GitHub installation must be properly configured and have the necessary permissions for repository creation.`)
|
|
60
62
|
.requiredOption(`--installation-id <installation-id>`, `Installation Id`)
|
|
@@ -67,7 +69,8 @@ vcs
|
|
|
67
69
|
),
|
|
68
70
|
);
|
|
69
71
|
|
|
70
|
-
|
|
72
|
+
|
|
73
|
+
const vcsGetRepositoryCommand = vcs
|
|
71
74
|
.command(`get-repository`)
|
|
72
75
|
.description(`Get detailed information about a specific GitHub repository from your installation. This endpoint returns repository details including its ID, name, visibility status, organization, and latest push date. The GitHub installation must be properly configured and have access to the requested repository for this endpoint to work.`)
|
|
73
76
|
.requiredOption(`--installation-id <installation-id>`, `Installation Id`)
|
|
@@ -79,7 +82,8 @@ vcs
|
|
|
79
82
|
),
|
|
80
83
|
);
|
|
81
84
|
|
|
82
|
-
|
|
85
|
+
|
|
86
|
+
const vcsListRepositoryBranchesCommand = vcs
|
|
83
87
|
.command(`list-repository-branches`)
|
|
84
88
|
.description(`Get a list of all branches from a GitHub repository in your installation. This endpoint returns the names of all branches in the repository and their total count. The GitHub installation must be properly configured and have access to the requested repository for this endpoint to work.
|
|
85
89
|
`)
|
|
@@ -92,7 +96,8 @@ vcs
|
|
|
92
96
|
),
|
|
93
97
|
);
|
|
94
98
|
|
|
95
|
-
|
|
99
|
+
|
|
100
|
+
const vcsGetRepositoryContentsCommand = vcs
|
|
96
101
|
.command(`get-repository-contents`)
|
|
97
102
|
.description(`Get a list of files and directories from a GitHub repository connected to your project. This endpoint returns the contents of a specified repository path, including file names, sizes, and whether each item is a file or directory. The GitHub installation must be properly configured and the repository must be accessible through your installation for this endpoint to work.`)
|
|
98
103
|
.requiredOption(`--installation-id <installation-id>`, `Installation Id`)
|
|
@@ -106,7 +111,8 @@ vcs
|
|
|
106
111
|
),
|
|
107
112
|
);
|
|
108
113
|
|
|
109
|
-
|
|
114
|
+
|
|
115
|
+
const vcsUpdateExternalDeploymentsCommand = vcs
|
|
110
116
|
.command(`update-external-deployments`)
|
|
111
117
|
.description(`Authorize and create deployments for a GitHub pull request in your project. This endpoint allows external contributions by creating deployments from pull requests, enabling preview environments for code review. The pull request must be open and not previously authorized. The GitHub installation must be properly configured and have access to both the repository and pull request for this endpoint to work.`)
|
|
112
118
|
.requiredOption(`--installation-id <installation-id>`, `Installation Id`)
|
|
@@ -119,7 +125,8 @@ vcs
|
|
|
119
125
|
),
|
|
120
126
|
);
|
|
121
127
|
|
|
122
|
-
|
|
128
|
+
|
|
129
|
+
const vcsListInstallationsCommand = vcs
|
|
123
130
|
.command(`list-installations`)
|
|
124
131
|
.description(`List all VCS installations configured for the current project. This endpoint returns a list of installations including their provider, organization, and other configuration details.
|
|
125
132
|
`)
|
|
@@ -138,7 +145,8 @@ vcs
|
|
|
138
145
|
),
|
|
139
146
|
);
|
|
140
147
|
|
|
141
|
-
|
|
148
|
+
|
|
149
|
+
const vcsGetInstallationCommand = vcs
|
|
142
150
|
.command(`get-installation`)
|
|
143
151
|
.description(`Get a VCS installation by its unique ID. This endpoint returns the installation's details including its provider, organization, and configuration. `)
|
|
144
152
|
.requiredOption(`--installation-id <installation-id>`, `Installation Id`)
|
|
@@ -149,7 +157,8 @@ vcs
|
|
|
149
157
|
),
|
|
150
158
|
);
|
|
151
159
|
|
|
152
|
-
|
|
160
|
+
|
|
161
|
+
const vcsDeleteInstallationCommand = vcs
|
|
153
162
|
.command(`delete-installation`)
|
|
154
163
|
.description(`Delete a VCS installation by its unique ID. This endpoint removes the installation and all its associated repositories from the project.`)
|
|
155
164
|
.requiredOption(`--installation-id <installation-id>`, `Installation Id`)
|
|
@@ -160,3 +169,4 @@ vcs
|
|
|
160
169
|
),
|
|
161
170
|
);
|
|
162
171
|
|
|
172
|
+
|
|
@@ -26,7 +26,7 @@ export const webhooks = new Command("webhooks")
|
|
|
26
26
|
helpWidth: process.stdout.columns || 80,
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
webhooks
|
|
29
|
+
const webhooksListCommand = webhooks
|
|
30
30
|
.command(`list`)
|
|
31
31
|
.description(`Get a list of all webhooks belonging to the project. You can use the query params to filter your results.`)
|
|
32
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`)
|
|
@@ -43,7 +43,8 @@ webhooks
|
|
|
43
43
|
),
|
|
44
44
|
);
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
|
|
47
|
+
const webhooksCreateCommand = webhooks
|
|
47
48
|
.command(`create`)
|
|
48
49
|
.description(`Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur.`)
|
|
49
50
|
.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.`)
|
|
@@ -71,7 +72,8 @@ webhooks
|
|
|
71
72
|
),
|
|
72
73
|
);
|
|
73
74
|
|
|
74
|
-
|
|
75
|
+
|
|
76
|
+
const webhooksGetCommand = webhooks
|
|
75
77
|
.command(`get`)
|
|
76
78
|
.description(`Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project. `)
|
|
77
79
|
.requiredOption(`--webhook-id <webhook-id>`, `Webhook ID.`)
|
|
@@ -82,7 +84,8 @@ webhooks
|
|
|
82
84
|
),
|
|
83
85
|
);
|
|
84
86
|
|
|
85
|
-
|
|
87
|
+
|
|
88
|
+
const webhooksUpdateCommand = webhooks
|
|
86
89
|
.command(`update`)
|
|
87
90
|
.description(`Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook.`)
|
|
88
91
|
.requiredOption(`--webhook-id <webhook-id>`, `Webhook ID.`)
|
|
@@ -110,7 +113,8 @@ webhooks
|
|
|
110
113
|
),
|
|
111
114
|
);
|
|
112
115
|
|
|
113
|
-
|
|
116
|
+
|
|
117
|
+
const webhooksDeleteCommand = webhooks
|
|
114
118
|
.command(`delete`)
|
|
115
119
|
.description(`Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events. `)
|
|
116
120
|
.requiredOption(`--webhook-id <webhook-id>`, `Webhook ID.`)
|
|
@@ -121,7 +125,8 @@ webhooks
|
|
|
121
125
|
),
|
|
122
126
|
);
|
|
123
127
|
|
|
124
|
-
|
|
128
|
+
|
|
129
|
+
const webhooksUpdateSignatureCommand = webhooks
|
|
125
130
|
.command(`update-signature`)
|
|
126
131
|
.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
132
|
.requiredOption(`--webhook-id <webhook-id>`, `Webhook ID.`)
|
|
@@ -132,3 +137,4 @@ webhooks
|
|
|
132
137
|
),
|
|
133
138
|
);
|
|
134
139
|
|
|
140
|
+
|
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 = '17.
|
|
4
|
+
export const SDK_VERSION = '17.2.1';
|
|
5
5
|
export const SDK_NAME = 'Command Line';
|
|
6
6
|
export const SDK_PLATFORM = 'console';
|
|
7
7
|
export const SDK_LANGUAGE = 'cli';
|
package/lib/emulation/docker.ts
CHANGED
|
@@ -219,6 +219,7 @@ export async function dockerStart(
|
|
|
219
219
|
params.push("-p", `${port}:3000`);
|
|
220
220
|
params.push("-e", "OPEN_RUNTIMES_ENV=development");
|
|
221
221
|
params.push("-e", "OPEN_RUNTIMES_SECRET=");
|
|
222
|
+
params.push("-e", `OPEN_RUNTIMES_ENTRYPOINT=${func.entrypoint}`);
|
|
222
223
|
|
|
223
224
|
for (const k of Object.keys(variables)) {
|
|
224
225
|
params.push("-e", `${k}=${variables[k]}`);
|
package/lib/emulation/utils.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventEmitter } from "node:events";
|
|
2
2
|
import { localConfig } from "../config.js";
|
|
3
3
|
import { log } from "../parser.js";
|
|
4
|
-
import { sdkForConsole } from "../sdks.js";
|
|
4
|
+
import { sdkForConsole, sdkForProject } from "../sdks.js";
|
|
5
5
|
import { Projects, Scopes, Users } from "@appwrite.io/console";
|
|
6
6
|
|
|
7
7
|
export const openRuntimesVersion = "v4";
|
|
@@ -108,7 +108,6 @@ export const JwtManager = {
|
|
|
108
108
|
projectScopes: Scopes[] = [],
|
|
109
109
|
): Promise<void> {
|
|
110
110
|
const consoleClient = await sdkForConsole();
|
|
111
|
-
const usersClient = new Users(consoleClient);
|
|
112
111
|
const projectsClient = new Projects(consoleClient);
|
|
113
112
|
|
|
114
113
|
if (this.timerWarn) {
|
|
@@ -139,6 +138,8 @@ export const JwtManager = {
|
|
|
139
138
|
); // 60 mins
|
|
140
139
|
|
|
141
140
|
if (userId) {
|
|
141
|
+
const projectClient = await sdkForProject();
|
|
142
|
+
const usersClient = new Users(projectClient);
|
|
142
143
|
await usersClient.get({
|
|
143
144
|
userId,
|
|
144
145
|
});
|