appwrite-cli 15.1.0 → 17.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 +17 -0
- package/README.md +4 -4
- package/cli.ts +2 -0
- package/dist/bundle-win-arm64.mjs +1785 -1288
- package/dist/cli.cjs +1729 -1232
- package/dist/index.cjs +836 -994
- package/dist/index.js +892 -1050
- 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/push.d.ts.map +1 -1
- package/dist/lib/commands/run.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.map +1 -1
- package/dist/lib/constants.d.ts +1 -1
- package/dist/lib/parser.d.ts.map +1 -1
- package/dist/lib/questions.d.ts.map +1 -1
- package/docs/examples/project/create-variable.md +1 -0
- package/docs/examples/project/update-variable.md +1 -2
- package/docs/examples/users/update-impersonator.md +5 -0
- 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/push.ts +6 -24
- package/lib/commands/run.ts +5 -7
- package/lib/commands/services/account.ts +0 -169
- package/lib/commands/services/health.ts +0 -68
- package/lib/commands/services/project.ts +21 -12
- package/lib/commands/services/projects.ts +0 -112
- package/lib/commands/services/users.ts +14 -1
- package/lib/commands/services/webhooks.ts +134 -0
- package/lib/commands/utils/deployment.ts +4 -1
- package/lib/constants.ts +1 -1
- package/lib/parser.ts +1 -0
- package/lib/questions.ts +13 -7
- 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
|
@@ -64,19 +64,6 @@ health
|
|
|
64
64
|
),
|
|
65
65
|
);
|
|
66
66
|
|
|
67
|
-
health
|
|
68
|
-
.command(`get-console-pausing`)
|
|
69
|
-
.description(`Get console pausing health status. Monitors projects approaching the pause threshold to detect potential issues with console access tracking.
|
|
70
|
-
`)
|
|
71
|
-
.option(`--threshold <threshold>`, `Percentage threshold of projects approaching pause. When hit (equal or higher), endpoint returns server error. Default value is 10.`, parseInteger)
|
|
72
|
-
.option(`--inactivity-days <inactivity-days>`, `Number of days of inactivity before a project is paused. Should match the plan's projectInactivityDays setting. Default value is 7.`, parseInteger)
|
|
73
|
-
.action(
|
|
74
|
-
actionRunner(
|
|
75
|
-
async ({ threshold, inactivityDays }) =>
|
|
76
|
-
parse(await (await getHealthClient()).getConsolePausing(threshold, inactivityDays)),
|
|
77
|
-
),
|
|
78
|
-
);
|
|
79
|
-
|
|
80
67
|
health
|
|
81
68
|
.command(`get-db`)
|
|
82
69
|
.description(`Check the Appwrite database servers are up and connection is successful.`)
|
|
@@ -106,28 +93,6 @@ health
|
|
|
106
93
|
),
|
|
107
94
|
);
|
|
108
95
|
|
|
109
|
-
health
|
|
110
|
-
.command(`get-queue-billing-project-aggregation`)
|
|
111
|
-
.description(`Get billing project aggregation queue.`)
|
|
112
|
-
.option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
|
|
113
|
-
.action(
|
|
114
|
-
actionRunner(
|
|
115
|
-
async ({ threshold }) =>
|
|
116
|
-
parse(await (await getHealthClient()).getQueueBillingProjectAggregation(threshold)),
|
|
117
|
-
),
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
health
|
|
121
|
-
.command(`get-queue-billing-team-aggregation`)
|
|
122
|
-
.description(`Get billing team aggregation queue.`)
|
|
123
|
-
.option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger)
|
|
124
|
-
.action(
|
|
125
|
-
actionRunner(
|
|
126
|
-
async ({ threshold }) =>
|
|
127
|
-
parse(await (await getHealthClient()).getQueueBillingTeamAggregation(threshold)),
|
|
128
|
-
),
|
|
129
|
-
);
|
|
130
|
-
|
|
131
96
|
health
|
|
132
97
|
.command(`get-queue-builds`)
|
|
133
98
|
.description(`Get the number of builds that are waiting to be processed in the Appwrite internal queue server.`)
|
|
@@ -139,17 +104,6 @@ health
|
|
|
139
104
|
),
|
|
140
105
|
);
|
|
141
106
|
|
|
142
|
-
health
|
|
143
|
-
.command(`get-queue-priority-builds`)
|
|
144
|
-
.description(`Get the priority builds queue size.`)
|
|
145
|
-
.option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 500.`, parseInteger)
|
|
146
|
-
.action(
|
|
147
|
-
actionRunner(
|
|
148
|
-
async ({ threshold }) =>
|
|
149
|
-
parse(await (await getHealthClient()).getQueuePriorityBuilds(threshold)),
|
|
150
|
-
),
|
|
151
|
-
);
|
|
152
|
-
|
|
153
107
|
health
|
|
154
108
|
.command(`get-queue-certificates`)
|
|
155
109
|
.description(`Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server.`)
|
|
@@ -252,17 +206,6 @@ health
|
|
|
252
206
|
),
|
|
253
207
|
);
|
|
254
208
|
|
|
255
|
-
health
|
|
256
|
-
.command(`get-queue-region-manager`)
|
|
257
|
-
.description(`Get region manager queue.`)
|
|
258
|
-
.option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100.`, parseInteger)
|
|
259
|
-
.action(
|
|
260
|
-
actionRunner(
|
|
261
|
-
async ({ threshold }) =>
|
|
262
|
-
parse(await (await getHealthClient()).getQueueRegionManager(threshold)),
|
|
263
|
-
),
|
|
264
|
-
);
|
|
265
|
-
|
|
266
209
|
health
|
|
267
210
|
.command(`get-queue-stats-resources`)
|
|
268
211
|
.description(`Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue.`)
|
|
@@ -285,17 +228,6 @@ health
|
|
|
285
228
|
),
|
|
286
229
|
);
|
|
287
230
|
|
|
288
|
-
health
|
|
289
|
-
.command(`get-queue-threats`)
|
|
290
|
-
.description(`Get threats queue.`)
|
|
291
|
-
.option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100.`, parseInteger)
|
|
292
|
-
.action(
|
|
293
|
-
actionRunner(
|
|
294
|
-
async ({ threshold }) =>
|
|
295
|
-
parse(await (await getHealthClient()).getQueueThreats(threshold)),
|
|
296
|
-
),
|
|
297
|
-
);
|
|
298
|
-
|
|
299
231
|
health
|
|
300
232
|
.command(`get-queue-webhooks`)
|
|
301
233
|
.description(`Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.`)
|
|
@@ -41,16 +41,25 @@ project
|
|
|
41
41
|
|
|
42
42
|
project
|
|
43
43
|
.command(`list-variables`)
|
|
44
|
-
.description(`Get a list of all project
|
|
44
|
+
.description(`Get a list of all project environment variables.`)
|
|
45
|
+
.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: key, resourceType, resourceId, secret`)
|
|
46
|
+
.option(
|
|
47
|
+
`--total [value]`,
|
|
48
|
+
`When set to false, the total count returned will be 0 and will not be calculated.`,
|
|
49
|
+
(value: string | undefined) =>
|
|
50
|
+
value === undefined ? true : parseBool(value),
|
|
51
|
+
)
|
|
45
52
|
.action(
|
|
46
53
|
actionRunner(
|
|
47
|
-
async (
|
|
54
|
+
async ({ queries, total }) =>
|
|
55
|
+
parse(await (await getProjectClient()).listVariables(queries, total)),
|
|
48
56
|
),
|
|
49
57
|
);
|
|
50
58
|
|
|
51
59
|
project
|
|
52
60
|
.command(`create-variable`)
|
|
53
|
-
.description(`Create a new project variable.
|
|
61
|
+
.description(`Create a new project environment variable. These variables can be accessed by all functions and sites in the project.`)
|
|
62
|
+
.requiredOption(`--variable-id <variable-id>`, `Variable 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.`)
|
|
54
63
|
.requiredOption(`--key <key>`, `Variable key. Max length: 255 chars.`)
|
|
55
64
|
.requiredOption(`--value <value>`, `Variable value. Max length: 8192 chars.`)
|
|
56
65
|
.option(
|
|
@@ -61,15 +70,15 @@ project
|
|
|
61
70
|
)
|
|
62
71
|
.action(
|
|
63
72
|
actionRunner(
|
|
64
|
-
async ({ key, value, secret }) =>
|
|
65
|
-
parse(await (await getProjectClient()).createVariable(key, value, secret)),
|
|
73
|
+
async ({ variableId, key, value, secret }) =>
|
|
74
|
+
parse(await (await getProjectClient()).createVariable(variableId, key, value, secret)),
|
|
66
75
|
),
|
|
67
76
|
);
|
|
68
77
|
|
|
69
78
|
project
|
|
70
79
|
.command(`get-variable`)
|
|
71
|
-
.description(`Get a
|
|
72
|
-
.requiredOption(`--variable-id <variable-id>`, `Variable
|
|
80
|
+
.description(`Get a variable by its unique ID. `)
|
|
81
|
+
.requiredOption(`--variable-id <variable-id>`, `Variable ID.`)
|
|
73
82
|
.action(
|
|
74
83
|
actionRunner(
|
|
75
84
|
async ({ variableId }) =>
|
|
@@ -79,9 +88,9 @@ project
|
|
|
79
88
|
|
|
80
89
|
project
|
|
81
90
|
.command(`update-variable`)
|
|
82
|
-
.description(`Update
|
|
83
|
-
.requiredOption(`--variable-id <variable-id>`, `Variable
|
|
84
|
-
.
|
|
91
|
+
.description(`Update variable by its unique ID.`)
|
|
92
|
+
.requiredOption(`--variable-id <variable-id>`, `Variable ID.`)
|
|
93
|
+
.option(`--key <key>`, `Variable key. Max length: 255 chars.`)
|
|
85
94
|
.option(`--value <value>`, `Variable value. Max length: 8192 chars.`)
|
|
86
95
|
.option(
|
|
87
96
|
`--secret [value]`,
|
|
@@ -98,8 +107,8 @@ project
|
|
|
98
107
|
|
|
99
108
|
project
|
|
100
109
|
.command(`delete-variable`)
|
|
101
|
-
.description(`Delete a
|
|
102
|
-
.requiredOption(`--variable-id <variable-id>`, `Variable
|
|
110
|
+
.description(`Delete a variable by its unique ID. `)
|
|
111
|
+
.requiredOption(`--variable-id <variable-id>`, `Variable ID.`)
|
|
103
112
|
.action(
|
|
104
113
|
actionRunner(
|
|
105
114
|
async ({ variableId }) =>
|
|
@@ -270,18 +270,6 @@ projects
|
|
|
270
270
|
),
|
|
271
271
|
);
|
|
272
272
|
|
|
273
|
-
projects
|
|
274
|
-
.command(`update-console-access`)
|
|
275
|
-
.description(`Record console access to a project. This endpoint updates the last accessed timestamp for the project to track console activity.
|
|
276
|
-
`)
|
|
277
|
-
.requiredOption(`--project-id <project-id>`, `Project ID`)
|
|
278
|
-
.action(
|
|
279
|
-
actionRunner(
|
|
280
|
-
async ({ projectId }) =>
|
|
281
|
-
parse(await (await getProjectsClient()).updateConsoleAccess(projectId)),
|
|
282
|
-
),
|
|
283
|
-
);
|
|
284
|
-
|
|
285
273
|
projects
|
|
286
274
|
.command(`list-dev-keys`)
|
|
287
275
|
.description(`List all the project\'s dev keys. Dev keys are project specific and allow you to bypass rate limits and get better error logging during development.'`)
|
|
@@ -760,103 +748,3 @@ projects
|
|
|
760
748
|
),
|
|
761
749
|
);
|
|
762
750
|
|
|
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
|
-
|
|
@@ -29,7 +29,7 @@ export const users = new Command("users")
|
|
|
29
29
|
users
|
|
30
30
|
.command(`list`)
|
|
31
31
|
.description(`Get a list of all the project's users. 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, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels`)
|
|
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, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator`)
|
|
33
33
|
.option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
|
|
34
34
|
.option(
|
|
35
35
|
`--total [value]`,
|
|
@@ -241,6 +241,19 @@ users
|
|
|
241
241
|
),
|
|
242
242
|
);
|
|
243
243
|
|
|
244
|
+
users
|
|
245
|
+
.command(`update-impersonator`)
|
|
246
|
+
.description(`Enable or disable whether a user can impersonate other users. When impersonation headers are used, the request runs as the target user for API behavior, while internal audit logs still attribute the action to the original impersonator and store the impersonated target details only in internal audit payload data.
|
|
247
|
+
`)
|
|
248
|
+
.requiredOption(`--user-id <user-id>`, `User ID.`)
|
|
249
|
+
.requiredOption(`--impersonator <impersonator>`, `Whether the user can impersonate other users. When true, the user can browse project users to choose a target and can pass impersonation headers to act as that user. Internal audit logs still attribute impersonated actions to the original impersonator and store the target user details only in internal audit payload data.`, parseBool)
|
|
250
|
+
.action(
|
|
251
|
+
actionRunner(
|
|
252
|
+
async ({ userId, impersonator }) =>
|
|
253
|
+
parse(await (await getUsersClient()).updateImpersonator(userId, impersonator)),
|
|
254
|
+
),
|
|
255
|
+
);
|
|
256
|
+
|
|
244
257
|
users
|
|
245
258
|
.command(`create-jwt`)
|
|
246
259
|
.description(`Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted.`)
|
|
@@ -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
|
+
|
|
@@ -24,7 +24,10 @@ interface DeploymentDetails {
|
|
|
24
24
|
* Package a directory into a tar.gz File object for deployment
|
|
25
25
|
*/
|
|
26
26
|
async function packageDirectory(dirPath: string): Promise<File> {
|
|
27
|
-
const tempFile = path.join(
|
|
27
|
+
const tempFile = path.join(
|
|
28
|
+
os.tmpdir(),
|
|
29
|
+
`appwrite-deploy-${Date.now()}.tar.gz`,
|
|
30
|
+
);
|
|
28
31
|
|
|
29
32
|
await create(
|
|
30
33
|
{
|
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 = '
|
|
4
|
+
export const SDK_VERSION = '17.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/lib/questions.ts
CHANGED
|
@@ -187,15 +187,19 @@ export const questionsInitProject: Question[] = [
|
|
|
187
187
|
const client = await sdkForConsole(true);
|
|
188
188
|
const { teams } = isCloud()
|
|
189
189
|
? await paginate(
|
|
190
|
-
async (
|
|
191
|
-
(await getOrganizationsService(
|
|
190
|
+
async (args) =>
|
|
191
|
+
(await getOrganizationsService(args.sdk as Client)).list({
|
|
192
|
+
queries: args.queries as string[],
|
|
193
|
+
}),
|
|
192
194
|
{ sdk: client },
|
|
193
195
|
100,
|
|
194
196
|
"teams",
|
|
195
197
|
)
|
|
196
198
|
: await paginate(
|
|
197
|
-
async (
|
|
198
|
-
(await getTeamsService(
|
|
199
|
+
async (args) =>
|
|
200
|
+
(await getTeamsService(args.sdk as Client)).list({
|
|
201
|
+
queries: args.queries as string[],
|
|
202
|
+
}),
|
|
199
203
|
{ parseOutput: false, sdk: client },
|
|
200
204
|
100,
|
|
201
205
|
"teams",
|
|
@@ -247,7 +251,7 @@ export const questionsInitProject: Question[] = [
|
|
|
247
251
|
];
|
|
248
252
|
|
|
249
253
|
const { projects } = await paginate(
|
|
250
|
-
async () => (await getProjectsService()).list(queries),
|
|
254
|
+
async (args) => (await getProjectsService()).list(args.queries as string[]),
|
|
251
255
|
{ parseOutput: false },
|
|
252
256
|
100,
|
|
253
257
|
"projects",
|
|
@@ -342,7 +346,8 @@ export const questionsPullFunctions: Question[] = [
|
|
|
342
346
|
validate: (value: any) => validateRequired("function", value),
|
|
343
347
|
choices: async () => {
|
|
344
348
|
const { functions } = await paginate(
|
|
345
|
-
async () =>
|
|
349
|
+
async (args) =>
|
|
350
|
+
(await getFunctionsService()).list(args.queries as string[]),
|
|
346
351
|
{ parseOutput: false },
|
|
347
352
|
100,
|
|
348
353
|
"functions",
|
|
@@ -385,7 +390,8 @@ export const questionsPullSites: Question[] = [
|
|
|
385
390
|
validate: (value: any) => validateRequired("site", value),
|
|
386
391
|
choices: async () => {
|
|
387
392
|
const { sites } = await paginate(
|
|
388
|
-
async () =>
|
|
393
|
+
async (args) =>
|
|
394
|
+
(await getSitesService()).list(args.queries as string[]),
|
|
389
395
|
{ parseOutput: false },
|
|
390
396
|
100,
|
|
391
397
|
"sites",
|
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": "
|
|
6
|
+
"version": "17.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": "
|
|
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": "
|
|
3
|
+
"version": "17.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/
|
|
9
|
+
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/17.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/
|
|
18
|
+
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/17.0.0/appwrite-cli-win-arm64.exe",
|
|
19
19
|
"bin": [
|
|
20
20
|
[
|
|
21
21
|
"appwrite-cli-win-arm64.exe",
|