appwrite-cli 2.0.2 → 4.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/README.md +11 -6
- package/docs/examples/account/delete-identity.md +2 -0
- package/docs/examples/account/list-identities.md +2 -0
- package/docs/examples/assistant/chat.md +2 -0
- package/docs/examples/databases/create-collection.md +1 -0
- package/docs/examples/databases/create-string-attribute.md +1 -0
- package/docs/examples/databases/create.md +2 -1
- package/docs/examples/databases/list-attributes.md +2 -1
- package/docs/examples/databases/list-indexes.md +2 -1
- package/docs/examples/databases/update.md +2 -1
- package/docs/examples/functions/create-deployment.md +3 -2
- package/docs/examples/functions/create-execution.md +3 -0
- package/docs/examples/functions/create.md +13 -1
- package/docs/examples/functions/download-deployment.md +3 -0
- package/docs/examples/functions/update.md +9 -0
- package/docs/examples/health/get-pub-sub.md +1 -0
- package/docs/examples/health/get-queue.md +1 -0
- package/docs/examples/locale/list-codes.md +1 -0
- package/docs/examples/migrations/create-appwrite-migration.md +5 -0
- package/docs/examples/migrations/create-firebase-migration.md +3 -0
- package/docs/examples/migrations/create-firebase-o-auth-migration.md +3 -0
- package/docs/examples/migrations/create-n-host-migration.md +9 -0
- package/docs/examples/migrations/create-supabase-migration.md +8 -0
- package/docs/examples/migrations/delete-firebase-auth.md +1 -0
- package/docs/examples/migrations/delete.md +2 -0
- package/docs/examples/migrations/get-appwrite-report.md +5 -0
- package/docs/examples/migrations/get-firebase-report-o-auth.md +3 -0
- package/docs/examples/migrations/get-firebase-report.md +3 -0
- package/docs/examples/migrations/get-n-host-report.md +9 -0
- package/docs/examples/migrations/get-supabase-report.md +8 -0
- package/docs/examples/migrations/get.md +2 -0
- package/docs/examples/migrations/list-firebase-projects.md +1 -0
- package/docs/examples/migrations/list.md +3 -0
- package/docs/examples/migrations/retry.md +2 -0
- package/docs/examples/project/create-variable.md +3 -0
- package/docs/examples/project/delete-variable.md +2 -0
- package/docs/examples/project/get-usage.md +2 -0
- package/docs/examples/project/get-variable.md +2 -0
- package/docs/examples/project/list-variables.md +1 -0
- package/docs/examples/project/update-variable.md +4 -0
- package/docs/examples/projects/create.md +1 -1
- package/docs/examples/projects/delete-email-template.md +4 -0
- package/docs/examples/projects/delete-sms-template.md +4 -0
- package/docs/examples/projects/delete.md +1 -2
- package/docs/examples/projects/get-email-template.md +4 -0
- package/docs/examples/projects/get-sms-template.md +4 -0
- package/docs/examples/projects/update-email-template.md +9 -0
- package/docs/examples/projects/update-personal-data-check.md +3 -0
- package/docs/examples/projects/update-service-status-all.md +3 -0
- package/docs/examples/projects/update-sms-template.md +5 -0
- package/docs/examples/projects/update-smtp-configuration.md +11 -0
- package/docs/examples/projects/update-team.md +3 -0
- package/docs/examples/proxy/create-rule.md +4 -0
- package/docs/examples/proxy/delete-rule.md +2 -0
- package/docs/examples/proxy/get-rule.md +2 -0
- package/docs/examples/proxy/list-rules.md +3 -0
- package/docs/examples/proxy/update-rule-verification.md +2 -0
- package/docs/examples/storage/update-file.md +1 -0
- package/docs/examples/teams/create-membership.md +1 -1
- package/docs/examples/teams/{update-membership-roles.md → update-membership.md} +1 -1
- package/docs/examples/users/delete-identity.md +2 -0
- package/docs/examples/users/list-identities.md +3 -0
- package/docs/examples/users/update-labels.md +3 -0
- package/docs/examples/vcs/create-repository-detection.md +4 -0
- package/docs/examples/vcs/create-repository.md +4 -0
- package/docs/examples/vcs/delete-installation.md +2 -0
- package/docs/examples/vcs/get-installation.md +2 -0
- package/docs/examples/vcs/get-repository.md +3 -0
- package/docs/examples/vcs/list-installations.md +3 -0
- package/docs/examples/vcs/list-repositories.md +3 -0
- package/docs/examples/vcs/list-repository-branches.md +3 -0
- package/docs/examples/vcs/update-external-deployments.md +4 -0
- package/index.js +10 -0
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/client.js +3 -3
- package/lib/commands/account.js +122 -67
- package/lib/commands/assistant.js +53 -0
- package/lib/commands/avatars.js +21 -21
- package/lib/commands/console.js +2 -2
- package/lib/commands/databases.js +146 -104
- package/lib/commands/deploy.js +11 -2
- package/lib/commands/functions.js +292 -94
- package/lib/commands/generic.js +1 -0
- package/lib/commands/graphql.js +4 -4
- package/lib/commands/health.js +68 -22
- package/lib/commands/init.js +13 -4
- package/lib/commands/locale.js +37 -14
- package/lib/commands/migrations.js +708 -0
- package/lib/commands/project.js +204 -0
- package/lib/commands/projects.js +459 -196
- package/lib/commands/proxy.js +177 -0
- package/lib/commands/storage.js +63 -65
- package/lib/commands/teams.js +36 -36
- package/lib/commands/users.js +147 -52
- package/lib/commands/vcs.js +305 -0
- package/lib/config.js +1 -2
- package/lib/parser.js +7 -2
- package/lib/questions.js +45 -10
- package/package.json +2 -2
- package/scoop/appwrite.json +30 -0
- package/docs/examples/projects/create-domain.md +0 -3
- package/docs/examples/projects/delete-domain.md +0 -3
- package/docs/examples/projects/get-domain.md +0 -3
- package/docs/examples/projects/list-domains.md +0 -2
- package/docs/examples/projects/update-domain-verification.md +0 -3
|
@@ -19,7 +19,7 @@ const functionsList = async ({ queries, search, parseOutput = true, sdk = undefi
|
|
|
19
19
|
/* @param {string} search */
|
|
20
20
|
|
|
21
21
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
22
|
-
let
|
|
22
|
+
let apiPath = '/functions';
|
|
23
23
|
let payload = {};
|
|
24
24
|
|
|
25
25
|
/** Query Params */
|
|
@@ -30,7 +30,7 @@ const functionsList = async ({ queries, search, parseOutput = true, sdk = undefi
|
|
|
30
30
|
payload['search'] = search;
|
|
31
31
|
}
|
|
32
32
|
let response = undefined;
|
|
33
|
-
response = await client.call('get',
|
|
33
|
+
response = await client.call('get', apiPath, {
|
|
34
34
|
'content-type': 'application/json',
|
|
35
35
|
}, payload);
|
|
36
36
|
|
|
@@ -41,7 +41,7 @@ const functionsList = async ({ queries, search, parseOutput = true, sdk = undefi
|
|
|
41
41
|
return response;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
const functionsCreate = async ({ functionId, name, runtime, execute, events, schedule, timeout, enabled, parseOutput = true, sdk = undefined}) => {
|
|
44
|
+
const functionsCreate = async ({ functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, templateRepository, templateOwner, templateRootDirectory, templateBranch, parseOutput = true, sdk = undefined}) => {
|
|
45
45
|
/* @param {string} functionId */
|
|
46
46
|
/* @param {string} name */
|
|
47
47
|
/* @param {string} runtime */
|
|
@@ -50,9 +50,21 @@ const functionsCreate = async ({ functionId, name, runtime, execute, events, sch
|
|
|
50
50
|
/* @param {string} schedule */
|
|
51
51
|
/* @param {number} timeout */
|
|
52
52
|
/* @param {boolean} enabled */
|
|
53
|
+
/* @param {boolean} logging */
|
|
54
|
+
/* @param {string} entrypoint */
|
|
55
|
+
/* @param {string} commands */
|
|
56
|
+
/* @param {string} installationId */
|
|
57
|
+
/* @param {string} providerRepositoryId */
|
|
58
|
+
/* @param {string} providerBranch */
|
|
59
|
+
/* @param {boolean} providerSilentMode */
|
|
60
|
+
/* @param {string} providerRootDirectory */
|
|
61
|
+
/* @param {string} templateRepository */
|
|
62
|
+
/* @param {string} templateOwner */
|
|
63
|
+
/* @param {string} templateRootDirectory */
|
|
64
|
+
/* @param {string} templateBranch */
|
|
53
65
|
|
|
54
66
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
55
|
-
let
|
|
67
|
+
let apiPath = '/functions';
|
|
56
68
|
let payload = {};
|
|
57
69
|
|
|
58
70
|
/** Body Params */
|
|
@@ -66,15 +78,15 @@ const functionsCreate = async ({ functionId, name, runtime, execute, events, sch
|
|
|
66
78
|
payload['name'] = name;
|
|
67
79
|
}
|
|
68
80
|
|
|
69
|
-
execute = execute === true ? [] : execute;
|
|
70
81
|
|
|
71
|
-
if (typeof
|
|
72
|
-
payload['
|
|
82
|
+
if (typeof runtime !== 'undefined') {
|
|
83
|
+
payload['runtime'] = runtime;
|
|
73
84
|
}
|
|
74
85
|
|
|
86
|
+
execute = execute === true ? [] : execute;
|
|
75
87
|
|
|
76
|
-
if (typeof
|
|
77
|
-
payload['
|
|
88
|
+
if (typeof execute !== 'undefined') {
|
|
89
|
+
payload['execute'] = execute;
|
|
78
90
|
}
|
|
79
91
|
|
|
80
92
|
events = events === true ? [] : events;
|
|
@@ -98,8 +110,68 @@ const functionsCreate = async ({ functionId, name, runtime, execute, events, sch
|
|
|
98
110
|
payload['enabled'] = enabled;
|
|
99
111
|
}
|
|
100
112
|
|
|
113
|
+
|
|
114
|
+
if (typeof logging !== 'undefined') {
|
|
115
|
+
payload['logging'] = logging;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
if (typeof entrypoint !== 'undefined') {
|
|
120
|
+
payload['entrypoint'] = entrypoint;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
if (typeof commands !== 'undefined') {
|
|
125
|
+
payload['commands'] = commands;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
if (typeof installationId !== 'undefined') {
|
|
130
|
+
payload['installationId'] = installationId;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
if (typeof providerRepositoryId !== 'undefined') {
|
|
135
|
+
payload['providerRepositoryId'] = providerRepositoryId;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
if (typeof providerBranch !== 'undefined') {
|
|
140
|
+
payload['providerBranch'] = providerBranch;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
if (typeof providerSilentMode !== 'undefined') {
|
|
145
|
+
payload['providerSilentMode'] = providerSilentMode;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
if (typeof providerRootDirectory !== 'undefined') {
|
|
150
|
+
payload['providerRootDirectory'] = providerRootDirectory;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
if (typeof templateRepository !== 'undefined') {
|
|
155
|
+
payload['templateRepository'] = templateRepository;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
if (typeof templateOwner !== 'undefined') {
|
|
160
|
+
payload['templateOwner'] = templateOwner;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
if (typeof templateRootDirectory !== 'undefined') {
|
|
165
|
+
payload['templateRootDirectory'] = templateRootDirectory;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
if (typeof templateBranch !== 'undefined') {
|
|
170
|
+
payload['templateBranch'] = templateBranch;
|
|
171
|
+
}
|
|
172
|
+
|
|
101
173
|
let response = undefined;
|
|
102
|
-
response = await client.call('post',
|
|
174
|
+
response = await client.call('post', apiPath, {
|
|
103
175
|
'content-type': 'application/json',
|
|
104
176
|
}, payload);
|
|
105
177
|
|
|
@@ -113,10 +185,10 @@ const functionsCreate = async ({ functionId, name, runtime, execute, events, sch
|
|
|
113
185
|
const functionsListRuntimes = async ({ parseOutput = true, sdk = undefined}) => {
|
|
114
186
|
|
|
115
187
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
116
|
-
let
|
|
188
|
+
let apiPath = '/functions/runtimes';
|
|
117
189
|
let payload = {};
|
|
118
190
|
let response = undefined;
|
|
119
|
-
response = await client.call('get',
|
|
191
|
+
response = await client.call('get', apiPath, {
|
|
120
192
|
'content-type': 'application/json',
|
|
121
193
|
}, payload);
|
|
122
194
|
|
|
@@ -131,7 +203,7 @@ const functionsGetUsage = async ({ range, parseOutput = true, sdk = undefined})
|
|
|
131
203
|
/* @param {string} range */
|
|
132
204
|
|
|
133
205
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
134
|
-
let
|
|
206
|
+
let apiPath = '/functions/usage';
|
|
135
207
|
let payload = {};
|
|
136
208
|
|
|
137
209
|
/** Query Params */
|
|
@@ -139,7 +211,7 @@ const functionsGetUsage = async ({ range, parseOutput = true, sdk = undefined})
|
|
|
139
211
|
payload['range'] = range;
|
|
140
212
|
}
|
|
141
213
|
let response = undefined;
|
|
142
|
-
response = await client.call('get',
|
|
214
|
+
response = await client.call('get', apiPath, {
|
|
143
215
|
'content-type': 'application/json',
|
|
144
216
|
}, payload);
|
|
145
217
|
|
|
@@ -154,10 +226,10 @@ const functionsGet = async ({ functionId, parseOutput = true, sdk = undefined})
|
|
|
154
226
|
/* @param {string} functionId */
|
|
155
227
|
|
|
156
228
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
157
|
-
let
|
|
229
|
+
let apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
158
230
|
let payload = {};
|
|
159
231
|
let response = undefined;
|
|
160
|
-
response = await client.call('get',
|
|
232
|
+
response = await client.call('get', apiPath, {
|
|
161
233
|
'content-type': 'application/json',
|
|
162
234
|
}, payload);
|
|
163
235
|
|
|
@@ -168,17 +240,26 @@ const functionsGet = async ({ functionId, parseOutput = true, sdk = undefined})
|
|
|
168
240
|
return response;
|
|
169
241
|
}
|
|
170
242
|
|
|
171
|
-
const functionsUpdate = async ({ functionId, name, execute, events, schedule, timeout, enabled, parseOutput = true, sdk = undefined}) => {
|
|
243
|
+
const functionsUpdate = async ({ functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, parseOutput = true, sdk = undefined}) => {
|
|
172
244
|
/* @param {string} functionId */
|
|
173
245
|
/* @param {string} name */
|
|
246
|
+
/* @param {string} runtime */
|
|
174
247
|
/* @param {string[]} execute */
|
|
175
248
|
/* @param {string[]} events */
|
|
176
249
|
/* @param {string} schedule */
|
|
177
250
|
/* @param {number} timeout */
|
|
178
251
|
/* @param {boolean} enabled */
|
|
252
|
+
/* @param {boolean} logging */
|
|
253
|
+
/* @param {string} entrypoint */
|
|
254
|
+
/* @param {string} commands */
|
|
255
|
+
/* @param {string} installationId */
|
|
256
|
+
/* @param {string} providerRepositoryId */
|
|
257
|
+
/* @param {string} providerBranch */
|
|
258
|
+
/* @param {boolean} providerSilentMode */
|
|
259
|
+
/* @param {string} providerRootDirectory */
|
|
179
260
|
|
|
180
261
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
181
|
-
let
|
|
262
|
+
let apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
182
263
|
let payload = {};
|
|
183
264
|
|
|
184
265
|
/** Body Params */
|
|
@@ -187,6 +268,11 @@ const functionsUpdate = async ({ functionId, name, execute, events, schedule, ti
|
|
|
187
268
|
payload['name'] = name;
|
|
188
269
|
}
|
|
189
270
|
|
|
271
|
+
|
|
272
|
+
if (typeof runtime !== 'undefined') {
|
|
273
|
+
payload['runtime'] = runtime;
|
|
274
|
+
}
|
|
275
|
+
|
|
190
276
|
execute = execute === true ? [] : execute;
|
|
191
277
|
|
|
192
278
|
if (typeof execute !== 'undefined') {
|
|
@@ -214,8 +300,48 @@ const functionsUpdate = async ({ functionId, name, execute, events, schedule, ti
|
|
|
214
300
|
payload['enabled'] = enabled;
|
|
215
301
|
}
|
|
216
302
|
|
|
303
|
+
|
|
304
|
+
if (typeof logging !== 'undefined') {
|
|
305
|
+
payload['logging'] = logging;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
if (typeof entrypoint !== 'undefined') {
|
|
310
|
+
payload['entrypoint'] = entrypoint;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
if (typeof commands !== 'undefined') {
|
|
315
|
+
payload['commands'] = commands;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
if (typeof installationId !== 'undefined') {
|
|
320
|
+
payload['installationId'] = installationId;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
if (typeof providerRepositoryId !== 'undefined') {
|
|
325
|
+
payload['providerRepositoryId'] = providerRepositoryId;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
if (typeof providerBranch !== 'undefined') {
|
|
330
|
+
payload['providerBranch'] = providerBranch;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
if (typeof providerSilentMode !== 'undefined') {
|
|
335
|
+
payload['providerSilentMode'] = providerSilentMode;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
if (typeof providerRootDirectory !== 'undefined') {
|
|
340
|
+
payload['providerRootDirectory'] = providerRootDirectory;
|
|
341
|
+
}
|
|
342
|
+
|
|
217
343
|
let response = undefined;
|
|
218
|
-
response = await client.call('put',
|
|
344
|
+
response = await client.call('put', apiPath, {
|
|
219
345
|
'content-type': 'application/json',
|
|
220
346
|
}, payload);
|
|
221
347
|
|
|
@@ -230,10 +356,10 @@ const functionsDelete = async ({ functionId, parseOutput = true, sdk = undefined
|
|
|
230
356
|
/* @param {string} functionId */
|
|
231
357
|
|
|
232
358
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
233
|
-
let
|
|
359
|
+
let apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
234
360
|
let payload = {};
|
|
235
361
|
let response = undefined;
|
|
236
|
-
response = await client.call('delete',
|
|
362
|
+
response = await client.call('delete', apiPath, {
|
|
237
363
|
'content-type': 'application/json',
|
|
238
364
|
}, payload);
|
|
239
365
|
|
|
@@ -250,7 +376,7 @@ const functionsListDeployments = async ({ functionId, queries, search, parseOutp
|
|
|
250
376
|
/* @param {string} search */
|
|
251
377
|
|
|
252
378
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
253
|
-
let
|
|
379
|
+
let apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
|
|
254
380
|
let payload = {};
|
|
255
381
|
|
|
256
382
|
/** Query Params */
|
|
@@ -261,7 +387,7 @@ const functionsListDeployments = async ({ functionId, queries, search, parseOutp
|
|
|
261
387
|
payload['search'] = search;
|
|
262
388
|
}
|
|
263
389
|
let response = undefined;
|
|
264
|
-
response = await client.call('get',
|
|
390
|
+
response = await client.call('get', apiPath, {
|
|
265
391
|
'content-type': 'application/json',
|
|
266
392
|
}, payload);
|
|
267
393
|
|
|
@@ -272,14 +398,15 @@ const functionsListDeployments = async ({ functionId, queries, search, parseOutp
|
|
|
272
398
|
return response;
|
|
273
399
|
}
|
|
274
400
|
|
|
275
|
-
const functionsCreateDeployment = async ({ functionId,
|
|
401
|
+
const functionsCreateDeployment = async ({ functionId, code, activate, entrypoint, commands, parseOutput = true, sdk = undefined, onProgress = () => {}}) => {
|
|
276
402
|
/* @param {string} functionId */
|
|
277
|
-
/* @param {string} entrypoint */
|
|
278
403
|
/* @param {InputFile} code */
|
|
279
404
|
/* @param {boolean} activate */
|
|
405
|
+
/* @param {string} entrypoint */
|
|
406
|
+
/* @param {string} commands */
|
|
280
407
|
|
|
281
408
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
282
|
-
let
|
|
409
|
+
let apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
|
|
283
410
|
let payload = {};
|
|
284
411
|
|
|
285
412
|
/** Body Params */
|
|
@@ -288,6 +415,11 @@ const functionsCreateDeployment = async ({ functionId, entrypoint, code, activat
|
|
|
288
415
|
payload['entrypoint'] = entrypoint;
|
|
289
416
|
}
|
|
290
417
|
|
|
418
|
+
|
|
419
|
+
if (typeof commands !== 'undefined') {
|
|
420
|
+
payload['commands'] = commands;
|
|
421
|
+
}
|
|
422
|
+
|
|
291
423
|
let folderPath = fs.realpathSync(code);
|
|
292
424
|
if (!fs.lstatSync(folderPath).isDirectory())
|
|
293
425
|
throw new Error('The path is not a directory.');
|
|
@@ -330,7 +462,7 @@ const functionsCreateDeployment = async ({ functionId, entrypoint, code, activat
|
|
|
330
462
|
if (size <= libClient.CHUNK_SIZE) {
|
|
331
463
|
payload['code'] = fs.createReadStream(payload['code']);
|
|
332
464
|
|
|
333
|
-
response = await client.call('post',
|
|
465
|
+
response = await client.call('post', apiPath, {
|
|
334
466
|
'content-type': 'multipart/form-data',
|
|
335
467
|
}, payload).catch(err => {
|
|
336
468
|
fs.unlinkSync(archivePath);
|
|
@@ -338,47 +470,38 @@ const functionsCreateDeployment = async ({ functionId, entrypoint, code, activat
|
|
|
338
470
|
});
|
|
339
471
|
} else {
|
|
340
472
|
const streamFilePath = payload['code'];
|
|
341
|
-
let id = undefined;
|
|
342
473
|
|
|
343
|
-
|
|
344
|
-
const totalCounters = Math.ceil(size / libClient.CHUNK_SIZE);
|
|
345
|
-
|
|
346
|
-
const headers = {
|
|
474
|
+
const apiHeaders = {
|
|
347
475
|
'content-type': 'multipart/form-data',
|
|
348
476
|
};
|
|
349
477
|
|
|
478
|
+
let offset = 0;
|
|
350
479
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
const end = Math.min((((counter * libClient.CHUNK_SIZE) + libClient.CHUNK_SIZE) - 1), size);
|
|
354
|
-
|
|
355
|
-
headers['content-range'] = 'bytes ' + start + '-' + end + '/' + size;
|
|
480
|
+
while (offset < size) {
|
|
481
|
+
let end = Math.min(offset + libClient.CHUNK_SIZE - 1, size - 1);
|
|
356
482
|
|
|
357
|
-
|
|
358
|
-
|
|
483
|
+
apiHeaders['content-range'] = 'bytes ' + offset + '-' + end + '/' + size;
|
|
484
|
+
if (response && response.$id) {
|
|
485
|
+
apiHeaders['x-appwrite-id'] = response.$id;
|
|
359
486
|
}
|
|
360
487
|
|
|
361
488
|
const stream = fs.createReadStream(streamFilePath, {
|
|
362
|
-
start,
|
|
489
|
+
start: offset,
|
|
363
490
|
end
|
|
364
491
|
});
|
|
365
492
|
payload['code'] = stream;
|
|
493
|
+
response = await client.call('post', apiPath, apiHeaders, payload);
|
|
366
494
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
if (!id) {
|
|
370
|
-
id = response['$id'];
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
if (onProgress !== null) {
|
|
495
|
+
if (onProgress) {
|
|
374
496
|
onProgress({
|
|
375
|
-
$id: response
|
|
376
|
-
progress:
|
|
377
|
-
sizeUploaded:
|
|
378
|
-
chunksTotal: response
|
|
379
|
-
chunksUploaded: response
|
|
497
|
+
$id: response.$id,
|
|
498
|
+
progress: ( offset / size ) * 100,
|
|
499
|
+
sizeUploaded: offset,
|
|
500
|
+
chunksTotal: response.chunksTotal,
|
|
501
|
+
chunksUploaded: response.chunksUploaded
|
|
380
502
|
});
|
|
381
503
|
}
|
|
504
|
+
offset += libClient.CHUNK_SIZE;
|
|
382
505
|
}
|
|
383
506
|
}
|
|
384
507
|
|
|
@@ -396,10 +519,10 @@ const functionsGetDeployment = async ({ functionId, deploymentId, parseOutput =
|
|
|
396
519
|
/* @param {string} deploymentId */
|
|
397
520
|
|
|
398
521
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
399
|
-
let
|
|
522
|
+
let apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
400
523
|
let payload = {};
|
|
401
524
|
let response = undefined;
|
|
402
|
-
response = await client.call('get',
|
|
525
|
+
response = await client.call('get', apiPath, {
|
|
403
526
|
'content-type': 'application/json',
|
|
404
527
|
}, payload);
|
|
405
528
|
|
|
@@ -415,10 +538,10 @@ const functionsUpdateDeployment = async ({ functionId, deploymentId, parseOutput
|
|
|
415
538
|
/* @param {string} deploymentId */
|
|
416
539
|
|
|
417
540
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
418
|
-
let
|
|
541
|
+
let apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
419
542
|
let payload = {};
|
|
420
543
|
let response = undefined;
|
|
421
|
-
response = await client.call('patch',
|
|
544
|
+
response = await client.call('patch', apiPath, {
|
|
422
545
|
'content-type': 'application/json',
|
|
423
546
|
}, payload);
|
|
424
547
|
|
|
@@ -434,10 +557,10 @@ const functionsDeleteDeployment = async ({ functionId, deploymentId, parseOutput
|
|
|
434
557
|
/* @param {string} deploymentId */
|
|
435
558
|
|
|
436
559
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
437
|
-
let
|
|
560
|
+
let apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
438
561
|
let payload = {};
|
|
439
562
|
let response = undefined;
|
|
440
|
-
response = await client.call('delete',
|
|
563
|
+
response = await client.call('delete', apiPath, {
|
|
441
564
|
'content-type': 'application/json',
|
|
442
565
|
}, payload);
|
|
443
566
|
|
|
@@ -454,10 +577,10 @@ const functionsCreateBuild = async ({ functionId, deploymentId, buildId, parseOu
|
|
|
454
577
|
/* @param {string} buildId */
|
|
455
578
|
|
|
456
579
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
457
|
-
let
|
|
580
|
+
let apiPath = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId);
|
|
458
581
|
let payload = {};
|
|
459
582
|
let response = undefined;
|
|
460
|
-
response = await client.call('post',
|
|
583
|
+
response = await client.call('post', apiPath, {
|
|
461
584
|
'content-type': 'application/json',
|
|
462
585
|
}, payload);
|
|
463
586
|
|
|
@@ -468,13 +591,37 @@ const functionsCreateBuild = async ({ functionId, deploymentId, buildId, parseOu
|
|
|
468
591
|
return response;
|
|
469
592
|
}
|
|
470
593
|
|
|
594
|
+
const functionsDownloadDeployment = async ({ functionId, deploymentId, parseOutput = true, sdk = undefined, destination}) => {
|
|
595
|
+
/* @param {string} functionId */
|
|
596
|
+
/* @param {string} deploymentId */
|
|
597
|
+
|
|
598
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
599
|
+
let apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
600
|
+
let payload = {};
|
|
601
|
+
payload['project'] = localConfig.getProject().projectId
|
|
602
|
+
payload['key'] = globalConfig.getKey();
|
|
603
|
+
const queryParams = new URLSearchParams(payload);
|
|
604
|
+
apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
|
|
605
|
+
|
|
606
|
+
const response = await client.call('get', apiPath, {
|
|
607
|
+
'content-type': 'application/json',
|
|
608
|
+
}, payload, 'arraybuffer');
|
|
609
|
+
|
|
610
|
+
fs.writeFileSync(destination, response);
|
|
611
|
+
|
|
612
|
+
if (parseOutput) {
|
|
613
|
+
log(`File stored in ${destination}`)
|
|
614
|
+
success()
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
471
618
|
const functionsListExecutions = async ({ functionId, queries, search, parseOutput = true, sdk = undefined}) => {
|
|
472
619
|
/* @param {string} functionId */
|
|
473
620
|
/* @param {string[]} queries */
|
|
474
621
|
/* @param {string} search */
|
|
475
622
|
|
|
476
623
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
477
|
-
let
|
|
624
|
+
let apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
|
|
478
625
|
let payload = {};
|
|
479
626
|
|
|
480
627
|
/** Query Params */
|
|
@@ -485,7 +632,7 @@ const functionsListExecutions = async ({ functionId, queries, search, parseOutpu
|
|
|
485
632
|
payload['search'] = search;
|
|
486
633
|
}
|
|
487
634
|
let response = undefined;
|
|
488
|
-
response = await client.call('get',
|
|
635
|
+
response = await client.call('get', apiPath, {
|
|
489
636
|
'content-type': 'application/json',
|
|
490
637
|
}, payload);
|
|
491
638
|
|
|
@@ -496,19 +643,22 @@ const functionsListExecutions = async ({ functionId, queries, search, parseOutpu
|
|
|
496
643
|
return response;
|
|
497
644
|
}
|
|
498
645
|
|
|
499
|
-
const functionsCreateExecution = async ({ functionId,
|
|
646
|
+
const functionsCreateExecution = async ({ functionId, body, async, xpath, method, headers, parseOutput = true, sdk = undefined}) => {
|
|
500
647
|
/* @param {string} functionId */
|
|
501
|
-
/* @param {string}
|
|
648
|
+
/* @param {string} body */
|
|
502
649
|
/* @param {boolean} async */
|
|
650
|
+
/* @param {string} xpath */
|
|
651
|
+
/* @param {string} method */
|
|
652
|
+
/* @param {object} headers */
|
|
503
653
|
|
|
504
654
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
505
|
-
let
|
|
655
|
+
let apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
|
|
506
656
|
let payload = {};
|
|
507
657
|
|
|
508
658
|
/** Body Params */
|
|
509
659
|
|
|
510
|
-
if (typeof
|
|
511
|
-
payload['
|
|
660
|
+
if (typeof body !== 'undefined') {
|
|
661
|
+
payload['body'] = body;
|
|
512
662
|
}
|
|
513
663
|
|
|
514
664
|
|
|
@@ -516,8 +666,22 @@ const functionsCreateExecution = async ({ functionId, data, async, parseOutput =
|
|
|
516
666
|
payload['async'] = async;
|
|
517
667
|
}
|
|
518
668
|
|
|
669
|
+
|
|
670
|
+
if (typeof xpath !== 'undefined') {
|
|
671
|
+
payload['path'] = xpath;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
if (typeof method !== 'undefined') {
|
|
676
|
+
payload['method'] = method;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
if (typeof headers !== 'undefined') {
|
|
680
|
+
payload['headers'] = JSON.parse(headers);
|
|
681
|
+
}
|
|
682
|
+
|
|
519
683
|
let response = undefined;
|
|
520
|
-
response = await client.call('post',
|
|
684
|
+
response = await client.call('post', apiPath, {
|
|
521
685
|
'content-type': 'application/json',
|
|
522
686
|
}, payload);
|
|
523
687
|
|
|
@@ -533,10 +697,10 @@ const functionsGetExecution = async ({ functionId, executionId, parseOutput = tr
|
|
|
533
697
|
/* @param {string} executionId */
|
|
534
698
|
|
|
535
699
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
536
|
-
let
|
|
700
|
+
let apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
|
|
537
701
|
let payload = {};
|
|
538
702
|
let response = undefined;
|
|
539
|
-
response = await client.call('get',
|
|
703
|
+
response = await client.call('get', apiPath, {
|
|
540
704
|
'content-type': 'application/json',
|
|
541
705
|
}, payload);
|
|
542
706
|
|
|
@@ -552,7 +716,7 @@ const functionsGetFunctionUsage = async ({ functionId, range, parseOutput = true
|
|
|
552
716
|
/* @param {string} range */
|
|
553
717
|
|
|
554
718
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
555
|
-
let
|
|
719
|
+
let apiPath = '/functions/{functionId}/usage'.replace('{functionId}', functionId);
|
|
556
720
|
let payload = {};
|
|
557
721
|
|
|
558
722
|
/** Query Params */
|
|
@@ -560,7 +724,7 @@ const functionsGetFunctionUsage = async ({ functionId, range, parseOutput = true
|
|
|
560
724
|
payload['range'] = range;
|
|
561
725
|
}
|
|
562
726
|
let response = undefined;
|
|
563
|
-
response = await client.call('get',
|
|
727
|
+
response = await client.call('get', apiPath, {
|
|
564
728
|
'content-type': 'application/json',
|
|
565
729
|
}, payload);
|
|
566
730
|
|
|
@@ -575,10 +739,10 @@ const functionsListVariables = async ({ functionId, parseOutput = true, sdk = un
|
|
|
575
739
|
/* @param {string} functionId */
|
|
576
740
|
|
|
577
741
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
578
|
-
let
|
|
742
|
+
let apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
|
|
579
743
|
let payload = {};
|
|
580
744
|
let response = undefined;
|
|
581
|
-
response = await client.call('get',
|
|
745
|
+
response = await client.call('get', apiPath, {
|
|
582
746
|
'content-type': 'application/json',
|
|
583
747
|
}, payload);
|
|
584
748
|
|
|
@@ -595,7 +759,7 @@ const functionsCreateVariable = async ({ functionId, key, value, parseOutput = t
|
|
|
595
759
|
/* @param {string} value */
|
|
596
760
|
|
|
597
761
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
598
|
-
let
|
|
762
|
+
let apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
|
|
599
763
|
let payload = {};
|
|
600
764
|
|
|
601
765
|
/** Body Params */
|
|
@@ -610,7 +774,7 @@ const functionsCreateVariable = async ({ functionId, key, value, parseOutput = t
|
|
|
610
774
|
}
|
|
611
775
|
|
|
612
776
|
let response = undefined;
|
|
613
|
-
response = await client.call('post',
|
|
777
|
+
response = await client.call('post', apiPath, {
|
|
614
778
|
'content-type': 'application/json',
|
|
615
779
|
}, payload);
|
|
616
780
|
|
|
@@ -626,10 +790,10 @@ const functionsGetVariable = async ({ functionId, variableId, parseOutput = true
|
|
|
626
790
|
/* @param {string} variableId */
|
|
627
791
|
|
|
628
792
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
629
|
-
let
|
|
793
|
+
let apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
|
|
630
794
|
let payload = {};
|
|
631
795
|
let response = undefined;
|
|
632
|
-
response = await client.call('get',
|
|
796
|
+
response = await client.call('get', apiPath, {
|
|
633
797
|
'content-type': 'application/json',
|
|
634
798
|
}, payload);
|
|
635
799
|
|
|
@@ -647,7 +811,7 @@ const functionsUpdateVariable = async ({ functionId, variableId, key, value, par
|
|
|
647
811
|
/* @param {string} value */
|
|
648
812
|
|
|
649
813
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
650
|
-
let
|
|
814
|
+
let apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
|
|
651
815
|
let payload = {};
|
|
652
816
|
|
|
653
817
|
/** Body Params */
|
|
@@ -662,7 +826,7 @@ const functionsUpdateVariable = async ({ functionId, variableId, key, value, par
|
|
|
662
826
|
}
|
|
663
827
|
|
|
664
828
|
let response = undefined;
|
|
665
|
-
response = await client.call('put',
|
|
829
|
+
response = await client.call('put', apiPath, {
|
|
666
830
|
'content-type': 'application/json',
|
|
667
831
|
}, payload);
|
|
668
832
|
|
|
@@ -678,10 +842,10 @@ const functionsDeleteVariable = async ({ functionId, variableId, parseOutput = t
|
|
|
678
842
|
/* @param {string} variableId */
|
|
679
843
|
|
|
680
844
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
681
|
-
let
|
|
845
|
+
let apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
|
|
682
846
|
let payload = {};
|
|
683
847
|
let response = undefined;
|
|
684
|
-
response = await client.call('delete',
|
|
848
|
+
response = await client.call('delete', apiPath, {
|
|
685
849
|
'content-type': 'application/json',
|
|
686
850
|
}, payload);
|
|
687
851
|
|
|
@@ -696,7 +860,7 @@ const functionsDeleteVariable = async ({ functionId, variableId, parseOutput = t
|
|
|
696
860
|
functions
|
|
697
861
|
.command(`list`)
|
|
698
862
|
.description(`Get a list of all the project's functions. You can use the query params to filter your results.`)
|
|
699
|
-
.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, enabled, runtime, deployment, schedule, scheduleNext, schedulePrevious, timeout`)
|
|
863
|
+
.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, enabled, runtime, deployment, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId`)
|
|
700
864
|
.option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
|
|
701
865
|
.action(actionRunner(functionsList))
|
|
702
866
|
|
|
@@ -706,11 +870,23 @@ functions
|
|
|
706
870
|
.requiredOption(`--functionId <functionId>`, `Function 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.`)
|
|
707
871
|
.requiredOption(`--name <name>`, `Function name. Max length: 128 chars.`)
|
|
708
872
|
.requiredOption(`--runtime <runtime>`, `Execution runtime.`)
|
|
709
|
-
.option(`--execute [execute...]`, `An array of strings with execution
|
|
873
|
+
.option(`--execute [execute...]`, `An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.`)
|
|
710
874
|
.option(`--events [events...]`, `Events list. Maximum of 100 events are allowed.`)
|
|
711
875
|
.option(`--schedule <schedule>`, `Schedule CRON syntax.`)
|
|
712
876
|
.option(`--timeout <timeout>`, `Function maximum execution time in seconds.`, parseInteger)
|
|
713
|
-
.option(`--enabled <enabled>`, `Is function enabled
|
|
877
|
+
.option(`--enabled <enabled>`, `Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.`, parseBool)
|
|
878
|
+
.option(`--logging <logging>`, `Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.`, parseBool)
|
|
879
|
+
.option(`--entrypoint <entrypoint>`, `Entrypoint File. This path is relative to the "providerRootDirectory".`)
|
|
880
|
+
.option(`--commands <commands>`, `Build Commands.`)
|
|
881
|
+
.option(`--installationId <installationId>`, `Appwrite Installation ID for VCS (Version Control System) deployment.`)
|
|
882
|
+
.option(`--providerRepositoryId <providerRepositoryId>`, `Repository ID of the repo linked to the function.`)
|
|
883
|
+
.option(`--providerBranch <providerBranch>`, `Production branch for the repo linked to the function.`)
|
|
884
|
+
.option(`--providerSilentMode <providerSilentMode>`, `Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.`, parseBool)
|
|
885
|
+
.option(`--providerRootDirectory <providerRootDirectory>`, `Path to function code in the linked repo.`)
|
|
886
|
+
.option(`--templateRepository <templateRepository>`, `Repository name of the template.`)
|
|
887
|
+
.option(`--templateOwner <templateOwner>`, `The name of the owner of the template.`)
|
|
888
|
+
.option(`--templateRootDirectory <templateRootDirectory>`, `Path to function code in the template repo.`)
|
|
889
|
+
.option(`--templateBranch <templateBranch>`, `Production branch for the repo linked to the function template.`)
|
|
714
890
|
.action(actionRunner(functionsCreate))
|
|
715
891
|
|
|
716
892
|
functions
|
|
@@ -735,11 +911,20 @@ functions
|
|
|
735
911
|
.description(`Update function by its unique ID.`)
|
|
736
912
|
.requiredOption(`--functionId <functionId>`, `Function ID.`)
|
|
737
913
|
.requiredOption(`--name <name>`, `Function name. Max length: 128 chars.`)
|
|
738
|
-
.option(`--
|
|
914
|
+
.option(`--runtime <runtime>`, `Execution runtime.`)
|
|
915
|
+
.option(`--execute [execute...]`, `An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.`)
|
|
739
916
|
.option(`--events [events...]`, `Events list. Maximum of 100 events are allowed.`)
|
|
740
917
|
.option(`--schedule <schedule>`, `Schedule CRON syntax.`)
|
|
741
918
|
.option(`--timeout <timeout>`, `Maximum execution time in seconds.`, parseInteger)
|
|
742
|
-
.option(`--enabled <enabled>`, `Is function enabled
|
|
919
|
+
.option(`--enabled <enabled>`, `Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.`, parseBool)
|
|
920
|
+
.option(`--logging <logging>`, `Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.`, parseBool)
|
|
921
|
+
.option(`--entrypoint <entrypoint>`, `Entrypoint File. This path is relative to the "providerRootDirectory".`)
|
|
922
|
+
.option(`--commands <commands>`, `Build Commands.`)
|
|
923
|
+
.option(`--installationId <installationId>`, `Appwrite Installation ID for VCS (Version Controle System) deployment.`)
|
|
924
|
+
.option(`--providerRepositoryId <providerRepositoryId>`, `Repository ID of the repo linked to the function`)
|
|
925
|
+
.option(`--providerBranch <providerBranch>`, `Production branch for the repo linked to the function`)
|
|
926
|
+
.option(`--providerSilentMode <providerSilentMode>`, `Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.`, parseBool)
|
|
927
|
+
.option(`--providerRootDirectory <providerRootDirectory>`, `Path to function code in the linked repo.`)
|
|
743
928
|
.action(actionRunner(functionsUpdate))
|
|
744
929
|
|
|
745
930
|
functions
|
|
@@ -752,17 +937,18 @@ functions
|
|
|
752
937
|
.command(`listDeployments`)
|
|
753
938
|
.description(`Get a list of all the project's code deployments. You can use the query params to filter your results.`)
|
|
754
939
|
.requiredOption(`--functionId <functionId>`, `Function ID.`)
|
|
755
|
-
.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:
|
|
940
|
+
.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: size, buildId, activate, entrypoint, commands`)
|
|
756
941
|
.option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
|
|
757
942
|
.action(actionRunner(functionsListDeployments))
|
|
758
943
|
|
|
759
944
|
functions
|
|
760
945
|
.command(`createDeployment`)
|
|
761
|
-
.description(`Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID. This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](/docs/functions). Use the "command" param to set the
|
|
946
|
+
.description(`Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID. This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](/docs/functions). Use the "command" param to set the entrypoint used to execute your code.`)
|
|
762
947
|
.requiredOption(`--functionId <functionId>`, `Function ID.`)
|
|
763
|
-
.requiredOption(`--entrypoint <entrypoint>`, `Entrypoint File.`)
|
|
764
948
|
.requiredOption(`--code <code>`, `Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.`)
|
|
765
949
|
.requiredOption(`--activate <activate>`, `Automatically activate the deployment when it is finished building.`, parseBool)
|
|
950
|
+
.option(`--entrypoint <entrypoint>`, `Entrypoint File.`)
|
|
951
|
+
.option(`--commands <commands>`, `Build Commands.`)
|
|
766
952
|
.action(actionRunner(functionsCreateDeployment))
|
|
767
953
|
|
|
768
954
|
functions
|
|
@@ -788,17 +974,25 @@ functions
|
|
|
788
974
|
|
|
789
975
|
functions
|
|
790
976
|
.command(`createBuild`)
|
|
791
|
-
.description(
|
|
977
|
+
.description(`Create a new build for an Appwrite Function deployment. This endpoint can be used to retry a failed build.`)
|
|
792
978
|
.requiredOption(`--functionId <functionId>`, `Function ID.`)
|
|
793
979
|
.requiredOption(`--deploymentId <deploymentId>`, `Deployment ID.`)
|
|
794
980
|
.requiredOption(`--buildId <buildId>`, `Build unique ID.`)
|
|
795
981
|
.action(actionRunner(functionsCreateBuild))
|
|
796
982
|
|
|
983
|
+
functions
|
|
984
|
+
.command(`downloadDeployment`)
|
|
985
|
+
.description(``)
|
|
986
|
+
.requiredOption(`--functionId <functionId>`, `Function ID.`)
|
|
987
|
+
.requiredOption(`--deploymentId <deploymentId>`, `Deployment ID.`)
|
|
988
|
+
.requiredOption(`--destination <path>`, `output file path.`)
|
|
989
|
+
.action(actionRunner(functionsDownloadDeployment))
|
|
990
|
+
|
|
797
991
|
functions
|
|
798
992
|
.command(`listExecutions`)
|
|
799
993
|
.description(`Get a list of all the current user function execution logs. You can use the query params to filter your results.`)
|
|
800
994
|
.requiredOption(`--functionId <functionId>`, `Function ID.`)
|
|
801
|
-
.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: trigger, status,
|
|
995
|
+
.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: trigger, status, responseStatusCode, duration`)
|
|
802
996
|
.option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
|
|
803
997
|
.action(actionRunner(functionsListExecutions))
|
|
804
998
|
|
|
@@ -806,8 +1000,11 @@ functions
|
|
|
806
1000
|
.command(`createExecution`)
|
|
807
1001
|
.description(`Trigger a function execution. The returned object will return you the current execution status. You can ping the 'Get Execution' endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.`)
|
|
808
1002
|
.requiredOption(`--functionId <functionId>`, `Function ID.`)
|
|
809
|
-
.option(`--
|
|
1003
|
+
.option(`--body <body>`, `HTTP body of execution. Default value is empty string.`)
|
|
810
1004
|
.option(`--async <async>`, `Execute code in the background. Default value is false.`, parseBool)
|
|
1005
|
+
.option(`--xpath <xpath>`, `HTTP path of execution. Path can include query params. Default value is /`)
|
|
1006
|
+
.option(`--method <method>`, `HTTP method of execution. Default value is GET.`)
|
|
1007
|
+
.option(`--headers <headers>`, `HTTP headers of execution. Defaults to empty.`)
|
|
811
1008
|
.action(actionRunner(functionsCreateExecution))
|
|
812
1009
|
|
|
813
1010
|
functions
|
|
@@ -832,7 +1029,7 @@ functions
|
|
|
832
1029
|
|
|
833
1030
|
functions
|
|
834
1031
|
.command(`createVariable`)
|
|
835
|
-
.description(`Create a new function variable. These variables can be accessed
|
|
1032
|
+
.description(`Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables.`)
|
|
836
1033
|
.requiredOption(`--functionId <functionId>`, `Function unique ID.`)
|
|
837
1034
|
.requiredOption(`--key <key>`, `Variable key. Max length: 255 chars.`)
|
|
838
1035
|
.requiredOption(`--value <value>`, `Variable value. Max length: 8192 chars.`)
|
|
@@ -877,6 +1074,7 @@ module.exports = {
|
|
|
877
1074
|
functionsUpdateDeployment,
|
|
878
1075
|
functionsDeleteDeployment,
|
|
879
1076
|
functionsCreateBuild,
|
|
1077
|
+
functionsDownloadDeployment,
|
|
880
1078
|
functionsListExecutions,
|
|
881
1079
|
functionsCreateExecution,
|
|
882
1080
|
functionsGetExecution,
|