appwrite-cli 4.2.1 → 5.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/.github/workflows/npm-publish.yml +1 -1
- package/README.md +6 -9
- package/docs/examples/account/{create-email-session.md → create-email-password-session.md} +1 -1
- package/docs/examples/account/create-email-token.md +4 -0
- package/docs/examples/account/create-magic-u-r-l-token.md +5 -0
- package/docs/examples/account/create-mfa-authenticator.md +2 -0
- package/docs/examples/account/create-mfa-challenge.md +2 -0
- package/docs/examples/account/create-mfa-recovery-codes.md +1 -0
- package/docs/examples/account/create-o-auth2token.md +5 -0
- package/docs/examples/account/create-phone-token.md +3 -0
- package/docs/examples/account/create-push-target.md +4 -0
- package/docs/examples/account/create-session.md +3 -0
- package/docs/examples/account/create.md +1 -1
- package/docs/examples/account/delete-identity.md +1 -1
- package/docs/examples/account/delete-mfa-authenticator.md +3 -0
- package/docs/examples/account/delete-push-target.md +2 -0
- package/docs/examples/account/delete-session.md +1 -1
- package/docs/examples/account/delete.md +1 -0
- package/docs/examples/account/get-mfa-recovery-codes.md +1 -0
- package/docs/examples/account/get-session.md +1 -1
- package/docs/examples/account/list-mfa-factors.md +1 -0
- package/docs/examples/account/update-m-f-a.md +2 -0
- package/docs/examples/account/update-magic-u-r-l-session.md +2 -2
- package/docs/examples/account/update-mfa-authenticator.md +3 -0
- package/docs/examples/account/update-mfa-challenge.md +3 -0
- package/docs/examples/account/update-mfa-recovery-codes.md +1 -0
- package/docs/examples/account/update-name.md +1 -1
- package/docs/examples/account/update-phone-session.md +2 -2
- package/docs/examples/account/update-phone-verification.md +2 -2
- package/docs/examples/account/update-push-target.md +3 -0
- package/docs/examples/account/update-recovery.md +3 -4
- package/docs/examples/account/update-session.md +1 -1
- package/docs/examples/account/update-verification.md +2 -2
- package/docs/examples/assistant/chat.md +1 -1
- package/docs/examples/avatars/get-q-r.md +1 -1
- package/docs/examples/databases/create-boolean-attribute.md +2 -2
- package/docs/examples/databases/create-collection.md +3 -3
- package/docs/examples/databases/create-datetime-attribute.md +2 -2
- package/docs/examples/databases/create-document.md +3 -3
- package/docs/examples/databases/create-email-attribute.md +2 -2
- package/docs/examples/databases/create-enum-attribute.md +2 -2
- package/docs/examples/databases/create-float-attribute.md +2 -2
- package/docs/examples/databases/create-index.md +2 -2
- package/docs/examples/databases/create-integer-attribute.md +2 -2
- package/docs/examples/databases/create-ip-attribute.md +2 -2
- package/docs/examples/databases/create-relationship-attribute.md +3 -3
- package/docs/examples/databases/create-string-attribute.md +2 -2
- package/docs/examples/databases/create-url-attribute.md +2 -2
- package/docs/examples/databases/create.md +2 -2
- package/docs/examples/databases/delete-attribute.md +2 -2
- package/docs/examples/databases/delete-collection.md +2 -2
- package/docs/examples/databases/delete-document.md +3 -3
- package/docs/examples/databases/delete-index.md +2 -2
- package/docs/examples/databases/delete.md +1 -1
- package/docs/examples/databases/get-attribute.md +2 -2
- package/docs/examples/databases/get-collection-usage.md +2 -2
- package/docs/examples/databases/get-collection.md +2 -2
- package/docs/examples/databases/get-database-usage.md +1 -1
- package/docs/examples/databases/get-document.md +3 -3
- package/docs/examples/databases/get-index.md +2 -2
- package/docs/examples/databases/get.md +1 -1
- package/docs/examples/databases/list-attributes.md +2 -2
- package/docs/examples/databases/list-collection-logs.md +2 -2
- package/docs/examples/databases/list-collections.md +1 -1
- package/docs/examples/databases/list-document-logs.md +3 -3
- package/docs/examples/databases/list-documents.md +2 -2
- package/docs/examples/databases/list-indexes.md +2 -2
- package/docs/examples/databases/list-logs.md +1 -1
- package/docs/examples/databases/update-boolean-attribute.md +2 -2
- package/docs/examples/databases/update-collection.md +3 -3
- package/docs/examples/databases/update-datetime-attribute.md +2 -2
- package/docs/examples/databases/update-document.md +3 -3
- package/docs/examples/databases/update-email-attribute.md +2 -2
- package/docs/examples/databases/update-enum-attribute.md +3 -3
- package/docs/examples/databases/update-float-attribute.md +2 -2
- package/docs/examples/databases/update-integer-attribute.md +2 -2
- package/docs/examples/databases/update-ip-attribute.md +2 -2
- package/docs/examples/databases/update-relationship-attribute.md +2 -2
- package/docs/examples/databases/update-string-attribute.md +3 -3
- package/docs/examples/databases/update-url-attribute.md +2 -2
- package/docs/examples/databases/update.md +2 -2
- package/docs/examples/functions/create-build.md +3 -3
- package/docs/examples/functions/create-deployment.md +1 -1
- package/docs/examples/functions/create-execution.md +1 -1
- package/docs/examples/functions/create-variable.md +3 -3
- package/docs/examples/functions/create.md +3 -3
- package/docs/examples/functions/delete-deployment.md +2 -2
- package/docs/examples/functions/delete-variable.md +2 -2
- package/docs/examples/functions/delete.md +1 -1
- package/docs/examples/functions/download-deployment.md +2 -2
- package/docs/examples/functions/get-deployment.md +2 -2
- package/docs/examples/functions/get-execution.md +2 -2
- package/docs/examples/functions/get-function-usage.md +1 -1
- package/docs/examples/functions/get-variable.md +2 -2
- package/docs/examples/functions/get.md +1 -1
- package/docs/examples/functions/list-deployments.md +1 -1
- package/docs/examples/functions/list-executions.md +1 -1
- package/docs/examples/functions/list-variables.md +1 -1
- package/docs/examples/functions/update-deployment.md +2 -2
- package/docs/examples/functions/update-variable.md +3 -3
- package/docs/examples/functions/update.md +2 -2
- package/docs/examples/health/get-certificate.md +2 -0
- package/docs/examples/health/get-failed-jobs.md +3 -0
- package/docs/examples/health/get-queue-usage-dump.md +2 -0
- package/docs/examples/health/get-queue-usage.md +2 -0
- package/docs/examples/health/get-storage.md +1 -0
- package/docs/examples/messaging/create-apns-provider.md +9 -0
- package/docs/examples/messaging/create-email.md +13 -0
- package/docs/examples/messaging/create-fcm-provider.md +5 -0
- package/docs/examples/messaging/create-mailgun-provider.md +11 -0
- package/docs/examples/messaging/create-msg91provider.md +7 -0
- package/docs/examples/messaging/create-push.md +17 -0
- package/docs/examples/messaging/create-sendgrid-provider.md +9 -0
- package/docs/examples/messaging/create-sms.md +8 -0
- package/docs/examples/messaging/create-smtp-provider.md +15 -0
- package/docs/examples/messaging/create-subscriber.md +4 -0
- package/docs/examples/messaging/create-telesign-provider.md +7 -0
- package/docs/examples/messaging/create-textmagic-provider.md +7 -0
- package/docs/examples/messaging/create-topic.md +4 -0
- package/docs/examples/messaging/create-twilio-provider.md +7 -0
- package/docs/examples/messaging/create-vonage-provider.md +7 -0
- package/docs/examples/messaging/delete-provider.md +2 -0
- package/docs/examples/messaging/delete-subscriber.md +3 -0
- package/docs/examples/messaging/delete-topic.md +2 -0
- package/docs/examples/messaging/delete.md +2 -0
- package/docs/examples/messaging/get-message.md +2 -0
- package/docs/examples/messaging/get-provider.md +2 -0
- package/docs/examples/messaging/get-subscriber.md +3 -0
- package/docs/examples/messaging/get-topic.md +2 -0
- package/docs/examples/messaging/list-message-logs.md +3 -0
- package/docs/examples/messaging/list-messages.md +3 -0
- package/docs/examples/messaging/list-provider-logs.md +3 -0
- package/docs/examples/messaging/list-providers.md +3 -0
- package/docs/examples/messaging/list-subscriber-logs.md +3 -0
- package/docs/examples/messaging/list-subscribers.md +4 -0
- package/docs/examples/messaging/list-targets.md +3 -0
- package/docs/examples/messaging/list-topic-logs.md +3 -0
- package/docs/examples/messaging/list-topics.md +3 -0
- package/docs/examples/messaging/update-apns-provider.md +9 -0
- package/docs/examples/messaging/update-email.md +12 -0
- package/docs/examples/messaging/update-fcm-provider.md +5 -0
- package/docs/examples/messaging/update-mailgun-provider.md +11 -0
- package/docs/examples/messaging/update-msg91provider.md +7 -0
- package/docs/examples/messaging/update-push.md +17 -0
- package/docs/examples/messaging/update-sendgrid-provider.md +9 -0
- package/docs/examples/messaging/update-sms.md +8 -0
- package/docs/examples/messaging/update-smtp-provider.md +15 -0
- package/docs/examples/messaging/update-telesign-provider.md +7 -0
- package/docs/examples/messaging/update-textmagic-provider.md +7 -0
- package/docs/examples/messaging/update-topic.md +4 -0
- package/docs/examples/messaging/update-twilio-provider.md +7 -0
- package/docs/examples/messaging/update-vonage-provider.md +7 -0
- package/docs/examples/migrations/create-appwrite-migration.md +2 -2
- package/docs/examples/migrations/create-firebase-migration.md +1 -1
- package/docs/examples/migrations/create-firebase-o-auth-migration.md +1 -1
- package/docs/examples/migrations/create-n-host-migration.md +6 -6
- package/docs/examples/migrations/create-supabase-migration.md +4 -4
- package/docs/examples/migrations/delete.md +1 -1
- package/docs/examples/migrations/get-appwrite-report.md +2 -2
- package/docs/examples/migrations/get-firebase-report-o-auth.md +1 -1
- package/docs/examples/migrations/get-firebase-report.md +1 -1
- package/docs/examples/migrations/get-n-host-report.md +6 -6
- package/docs/examples/migrations/get-supabase-report.md +4 -4
- package/docs/examples/migrations/get.md +1 -1
- package/docs/examples/migrations/retry.md +1 -1
- package/docs/examples/project/create-variable.md +2 -2
- package/docs/examples/project/delete-variable.md +1 -1
- package/docs/examples/project/get-usage.md +2 -0
- package/docs/examples/project/get-variable.md +1 -1
- package/docs/examples/project/update-variable.md +2 -2
- package/docs/examples/projects/create-key.md +2 -2
- package/docs/examples/projects/create-platform.md +2 -2
- package/docs/examples/projects/create-smtp-test.md +11 -0
- package/docs/examples/projects/create-webhook.md +4 -3
- package/docs/examples/projects/create.md +2 -2
- package/docs/examples/projects/delete-email-template.md +1 -1
- package/docs/examples/projects/delete-key.md +2 -2
- package/docs/examples/projects/delete-platform.md +2 -2
- package/docs/examples/projects/delete-sms-template.md +1 -1
- package/docs/examples/projects/delete-webhook.md +2 -2
- package/docs/examples/projects/delete.md +1 -1
- package/docs/examples/projects/get-email-template.md +1 -1
- package/docs/examples/projects/get-key.md +2 -2
- package/docs/examples/projects/get-platform.md +2 -2
- package/docs/examples/projects/get-sms-template.md +1 -1
- package/docs/examples/projects/get-webhook.md +2 -2
- package/docs/examples/projects/get.md +1 -1
- package/docs/examples/projects/list-keys.md +1 -1
- package/docs/examples/projects/list-platforms.md +1 -1
- package/docs/examples/projects/list-webhooks.md +1 -1
- package/docs/examples/projects/update-api-status-all.md +3 -0
- package/docs/examples/projects/update-api-status.md +4 -0
- package/docs/examples/projects/update-auth-duration.md +1 -1
- package/docs/examples/projects/update-auth-limit.md +1 -1
- package/docs/examples/projects/update-auth-password-dictionary.md +1 -1
- package/docs/examples/projects/update-auth-password-history.md +1 -1
- package/docs/examples/projects/update-auth-sessions-limit.md +1 -1
- package/docs/examples/projects/update-auth-status.md +1 -1
- package/docs/examples/projects/update-email-template.md +3 -3
- package/docs/examples/projects/update-key.md +3 -3
- package/docs/examples/projects/update-o-auth2.md +1 -1
- package/docs/examples/projects/update-personal-data-check.md +1 -1
- package/docs/examples/projects/update-platform.md +3 -3
- package/docs/examples/projects/update-service-status-all.md +1 -1
- package/docs/examples/projects/update-service-status.md +1 -1
- package/docs/examples/projects/update-sms-template.md +2 -2
- package/docs/examples/projects/update-smtp.md +11 -0
- package/docs/examples/projects/update-team.md +2 -2
- package/docs/examples/projects/update-webhook-signature.md +2 -2
- package/docs/examples/projects/update-webhook.md +5 -4
- package/docs/examples/projects/update.md +2 -2
- package/docs/examples/proxy/delete-rule.md +1 -1
- package/docs/examples/proxy/get-rule.md +1 -1
- package/docs/examples/proxy/update-rule-verification.md +1 -1
- package/docs/examples/storage/create-bucket.md +2 -2
- package/docs/examples/storage/create-file.md +2 -2
- package/docs/examples/storage/delete-bucket.md +1 -1
- package/docs/examples/storage/delete-file.md +2 -2
- package/docs/examples/storage/get-bucket-usage.md +1 -1
- package/docs/examples/storage/get-bucket.md +1 -1
- package/docs/examples/storage/get-file-download.md +2 -2
- package/docs/examples/storage/get-file-preview.md +2 -2
- package/docs/examples/storage/get-file-view.md +2 -2
- package/docs/examples/storage/get-file.md +2 -2
- package/docs/examples/storage/list-files.md +1 -1
- package/docs/examples/storage/update-bucket.md +2 -2
- package/docs/examples/storage/update-file.md +2 -2
- package/docs/examples/teams/create-membership.md +1 -1
- package/docs/examples/teams/create.md +2 -2
- package/docs/examples/teams/delete-membership.md +2 -2
- package/docs/examples/teams/delete.md +1 -1
- package/docs/examples/teams/get-membership.md +2 -2
- package/docs/examples/teams/get-prefs.md +1 -1
- package/docs/examples/teams/get.md +1 -1
- package/docs/examples/teams/list-logs.md +1 -1
- package/docs/examples/teams/list-memberships.md +1 -1
- package/docs/examples/teams/update-membership-status.md +4 -4
- package/docs/examples/teams/update-membership.md +2 -2
- package/docs/examples/teams/update-name.md +2 -2
- package/docs/examples/teams/update-prefs.md +1 -1
- package/docs/examples/users/create-argon2user.md +1 -1
- package/docs/examples/users/create-bcrypt-user.md +1 -1
- package/docs/examples/users/create-m-d5user.md +1 -1
- package/docs/examples/users/create-mfa-recovery-codes.md +2 -0
- package/docs/examples/users/create-p-h-pass-user.md +1 -1
- package/docs/examples/users/create-s-h-a-user.md +1 -1
- package/docs/examples/users/create-scrypt-modified-user.md +4 -4
- package/docs/examples/users/create-scrypt-user.md +2 -2
- package/docs/examples/users/create-session.md +2 -0
- package/docs/examples/users/create-target.md +7 -0
- package/docs/examples/users/create-token.md +4 -0
- package/docs/examples/users/create.md +1 -1
- package/docs/examples/users/delete-identity.md +1 -1
- package/docs/examples/users/delete-mfa-authenticator.md +3 -0
- package/docs/examples/users/delete-session.md +2 -2
- package/docs/examples/users/delete-sessions.md +1 -1
- package/docs/examples/users/delete-target.md +3 -0
- package/docs/examples/users/delete.md +1 -1
- package/docs/examples/users/get-mfa-recovery-codes.md +2 -0
- package/docs/examples/users/get-prefs.md +1 -1
- package/docs/examples/users/get-target.md +3 -0
- package/docs/examples/users/get-usage.md +0 -1
- package/docs/examples/users/get.md +1 -1
- package/docs/examples/users/list-logs.md +1 -1
- package/docs/examples/users/list-memberships.md +1 -1
- package/docs/examples/users/list-mfa-factors.md +2 -0
- package/docs/examples/users/list-sessions.md +1 -1
- package/docs/examples/users/list-targets.md +3 -0
- package/docs/examples/users/update-email-verification.md +1 -1
- package/docs/examples/users/update-email.md +1 -1
- package/docs/examples/users/update-labels.md +1 -1
- package/docs/examples/users/update-mfa-recovery-codes.md +2 -0
- package/docs/examples/users/update-mfa.md +3 -0
- package/docs/examples/users/update-name.md +2 -2
- package/docs/examples/users/update-password.md +1 -1
- package/docs/examples/users/update-phone-verification.md +1 -1
- package/docs/examples/users/update-phone.md +1 -1
- package/docs/examples/users/update-prefs.md +1 -1
- package/docs/examples/users/update-status.md +1 -1
- package/docs/examples/users/update-target.md +6 -0
- package/docs/examples/vcs/create-repository-detection.md +2 -2
- package/docs/examples/vcs/create-repository.md +2 -2
- package/docs/examples/vcs/delete-installation.md +1 -1
- package/docs/examples/vcs/get-installation.md +1 -1
- package/docs/examples/vcs/get-repository.md +2 -2
- package/docs/examples/vcs/list-repositories.md +1 -1
- package/docs/examples/vcs/list-repository-branches.md +2 -2
- package/docs/examples/vcs/update-external-deployments.md +3 -3
- package/index.js +2 -0
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/client.js +9 -4
- package/lib/commands/account.js +966 -381
- package/lib/commands/assistant.js +3 -8
- package/lib/commands/avatars.js +32 -48
- package/lib/commands/console.js +3 -8
- package/lib/commands/databases.js +119 -265
- package/lib/commands/deploy.js +45 -6
- package/lib/commands/functions.js +59 -124
- package/lib/commands/generic.js +0 -1
- package/lib/commands/graphql.js +5 -13
- package/lib/commands/health.js +225 -89
- package/lib/commands/locale.js +17 -43
- package/lib/commands/messaging.js +2815 -0
- package/lib/commands/migrations.js +35 -85
- package/lib/commands/project.js +28 -38
- package/lib/commands/projects.js +286 -270
- package/lib/commands/proxy.js +12 -29
- package/lib/commands/storage.js +42 -87
- package/lib/commands/teams.js +31 -75
- package/lib/commands/users.js +677 -235
- package/lib/commands/vcs.js +19 -48
- package/lib/paginate.js +2 -2
- package/lib/parser.js +1 -0
- package/package.json +1 -1
- package/scoop/appwrite.json +3 -3
- package/docs/examples/account/create-magic-u-r-l-session.md +0 -4
- package/docs/examples/account/create-phone-session.md +0 -3
- package/docs/examples/projects/get-usage.md +0 -3
- package/docs/examples/projects/update-smtp-configuration.md +0 -11
|
@@ -37,7 +37,7 @@ function convertReadStreamToReadableStream(readStream) {
|
|
|
37
37
|
|
|
38
38
|
const functions = new Command("functions").description(commandDescriptions['functions']).configureHelp({
|
|
39
39
|
helpWidth: process.stdout.columns || 80
|
|
40
|
-
|
|
40
|
+
})
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* @typedef {Object} FunctionsListRequestParams
|
|
@@ -52,7 +52,6 @@ const functions = new Command("functions").description(commandDescriptions['func
|
|
|
52
52
|
*/
|
|
53
53
|
const functionsList = async ({ queries, search, parseOutput = true, sdk = undefined}) => {
|
|
54
54
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
55
|
-
|
|
56
55
|
let apiPath = '/functions';
|
|
57
56
|
let payload = {};
|
|
58
57
|
if (typeof queries !== 'undefined') {
|
|
@@ -62,14 +61,12 @@ const functionsList = async ({ queries, search, parseOutput = true, sdk = undefi
|
|
|
62
61
|
payload['search'] = search;
|
|
63
62
|
}
|
|
64
63
|
|
|
65
|
-
|
|
66
64
|
let response = undefined;
|
|
67
|
-
|
|
65
|
+
|
|
68
66
|
response = await client.call('get', apiPath, {
|
|
69
67
|
'content-type': 'application/json',
|
|
70
68
|
}, payload);
|
|
71
69
|
|
|
72
|
-
|
|
73
70
|
if (parseOutput) {
|
|
74
71
|
parse(response)
|
|
75
72
|
success()
|
|
@@ -82,7 +79,7 @@ const functionsList = async ({ queries, search, parseOutput = true, sdk = undefi
|
|
|
82
79
|
* @typedef {Object} FunctionsCreateRequestParams
|
|
83
80
|
* @property {string} 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.
|
|
84
81
|
* @property {string} name Function name. Max length: 128 chars.
|
|
85
|
-
* @property {
|
|
82
|
+
* @property {Runtime} runtime Execution runtime.
|
|
86
83
|
* @property {string[]} 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.
|
|
87
84
|
* @property {string[]} events Events list. Maximum of 100 events are allowed.
|
|
88
85
|
* @property {string} schedule Schedule CRON syntax.
|
|
@@ -109,7 +106,6 @@ const functionsList = async ({ queries, search, parseOutput = true, sdk = undefi
|
|
|
109
106
|
*/
|
|
110
107
|
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}) => {
|
|
111
108
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
112
|
-
|
|
113
109
|
let apiPath = '/functions';
|
|
114
110
|
let payload = {};
|
|
115
111
|
if (typeof functionId !== 'undefined') {
|
|
@@ -175,14 +171,12 @@ const functionsCreate = async ({ functionId, name, runtime, execute, events, sch
|
|
|
175
171
|
payload['templateBranch'] = templateBranch;
|
|
176
172
|
}
|
|
177
173
|
|
|
178
|
-
|
|
179
174
|
let response = undefined;
|
|
180
|
-
|
|
175
|
+
|
|
181
176
|
response = await client.call('post', apiPath, {
|
|
182
177
|
'content-type': 'application/json',
|
|
183
178
|
}, payload);
|
|
184
179
|
|
|
185
|
-
|
|
186
180
|
if (parseOutput) {
|
|
187
181
|
parse(response)
|
|
188
182
|
success()
|
|
@@ -202,18 +196,15 @@ const functionsCreate = async ({ functionId, name, runtime, execute, events, sch
|
|
|
202
196
|
*/
|
|
203
197
|
const functionsListRuntimes = async ({ parseOutput = true, sdk = undefined}) => {
|
|
204
198
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
205
|
-
|
|
206
199
|
let apiPath = '/functions/runtimes';
|
|
207
200
|
let payload = {};
|
|
208
201
|
|
|
209
|
-
|
|
210
202
|
let response = undefined;
|
|
211
|
-
|
|
203
|
+
|
|
212
204
|
response = await client.call('get', apiPath, {
|
|
213
205
|
'content-type': 'application/json',
|
|
214
206
|
}, payload);
|
|
215
207
|
|
|
216
|
-
|
|
217
208
|
if (parseOutput) {
|
|
218
209
|
parse(response)
|
|
219
210
|
success()
|
|
@@ -224,7 +215,7 @@ const functionsListRuntimes = async ({ parseOutput = true, sdk = undefined}) =>
|
|
|
224
215
|
|
|
225
216
|
/**
|
|
226
217
|
* @typedef {Object} FunctionsGetUsageRequestParams
|
|
227
|
-
* @property {
|
|
218
|
+
* @property {FunctionUsageRange} range Date range.
|
|
228
219
|
* @property {boolean} parseOutput
|
|
229
220
|
* @property {libClient | undefined} sdk
|
|
230
221
|
*/
|
|
@@ -234,21 +225,18 @@ const functionsListRuntimes = async ({ parseOutput = true, sdk = undefined}) =>
|
|
|
234
225
|
*/
|
|
235
226
|
const functionsGetUsage = async ({ range, parseOutput = true, sdk = undefined}) => {
|
|
236
227
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
237
|
-
|
|
238
228
|
let apiPath = '/functions/usage';
|
|
239
229
|
let payload = {};
|
|
240
230
|
if (typeof range !== 'undefined') {
|
|
241
231
|
payload['range'] = range;
|
|
242
232
|
}
|
|
243
233
|
|
|
244
|
-
|
|
245
234
|
let response = undefined;
|
|
246
|
-
|
|
235
|
+
|
|
247
236
|
response = await client.call('get', apiPath, {
|
|
248
237
|
'content-type': 'application/json',
|
|
249
238
|
}, payload);
|
|
250
239
|
|
|
251
|
-
|
|
252
240
|
if (parseOutput) {
|
|
253
241
|
parse(response)
|
|
254
242
|
success()
|
|
@@ -269,18 +257,15 @@ const functionsGetUsage = async ({ range, parseOutput = true, sdk = undefined})
|
|
|
269
257
|
*/
|
|
270
258
|
const functionsGet = async ({ functionId, parseOutput = true, sdk = undefined}) => {
|
|
271
259
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
272
|
-
|
|
273
260
|
let apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
274
261
|
let payload = {};
|
|
275
262
|
|
|
276
|
-
|
|
277
263
|
let response = undefined;
|
|
278
|
-
|
|
264
|
+
|
|
279
265
|
response = await client.call('get', apiPath, {
|
|
280
266
|
'content-type': 'application/json',
|
|
281
267
|
}, payload);
|
|
282
268
|
|
|
283
|
-
|
|
284
269
|
if (parseOutput) {
|
|
285
270
|
parse(response)
|
|
286
271
|
success()
|
|
@@ -293,7 +278,7 @@ const functionsGet = async ({ functionId, parseOutput = true, sdk = undefined})
|
|
|
293
278
|
* @typedef {Object} FunctionsUpdateRequestParams
|
|
294
279
|
* @property {string} functionId Function ID.
|
|
295
280
|
* @property {string} name Function name. Max length: 128 chars.
|
|
296
|
-
* @property {
|
|
281
|
+
* @property {Runtime} runtime Execution runtime.
|
|
297
282
|
* @property {string[]} 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.
|
|
298
283
|
* @property {string[]} events Events list. Maximum of 100 events are allowed.
|
|
299
284
|
* @property {string} schedule Schedule CRON syntax.
|
|
@@ -316,7 +301,6 @@ const functionsGet = async ({ functionId, parseOutput = true, sdk = undefined})
|
|
|
316
301
|
*/
|
|
317
302
|
const functionsUpdate = async ({ functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, parseOutput = true, sdk = undefined}) => {
|
|
318
303
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
319
|
-
|
|
320
304
|
let apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
321
305
|
let payload = {};
|
|
322
306
|
if (typeof name !== 'undefined') {
|
|
@@ -367,14 +351,12 @@ const functionsUpdate = async ({ functionId, name, runtime, execute, events, sch
|
|
|
367
351
|
payload['providerRootDirectory'] = providerRootDirectory;
|
|
368
352
|
}
|
|
369
353
|
|
|
370
|
-
|
|
371
354
|
let response = undefined;
|
|
372
|
-
|
|
355
|
+
|
|
373
356
|
response = await client.call('put', apiPath, {
|
|
374
357
|
'content-type': 'application/json',
|
|
375
358
|
}, payload);
|
|
376
359
|
|
|
377
|
-
|
|
378
360
|
if (parseOutput) {
|
|
379
361
|
parse(response)
|
|
380
362
|
success()
|
|
@@ -395,18 +377,15 @@ const functionsUpdate = async ({ functionId, name, runtime, execute, events, sch
|
|
|
395
377
|
*/
|
|
396
378
|
const functionsDelete = async ({ functionId, parseOutput = true, sdk = undefined}) => {
|
|
397
379
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
398
|
-
|
|
399
380
|
let apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
400
381
|
let payload = {};
|
|
401
382
|
|
|
402
|
-
|
|
403
383
|
let response = undefined;
|
|
404
|
-
|
|
384
|
+
|
|
405
385
|
response = await client.call('delete', apiPath, {
|
|
406
386
|
'content-type': 'application/json',
|
|
407
387
|
}, payload);
|
|
408
388
|
|
|
409
|
-
|
|
410
389
|
if (parseOutput) {
|
|
411
390
|
parse(response)
|
|
412
391
|
success()
|
|
@@ -429,7 +408,6 @@ const functionsDelete = async ({ functionId, parseOutput = true, sdk = undefined
|
|
|
429
408
|
*/
|
|
430
409
|
const functionsListDeployments = async ({ functionId, queries, search, parseOutput = true, sdk = undefined}) => {
|
|
431
410
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
432
|
-
|
|
433
411
|
let apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
|
|
434
412
|
let payload = {};
|
|
435
413
|
if (typeof queries !== 'undefined') {
|
|
@@ -439,14 +417,12 @@ const functionsListDeployments = async ({ functionId, queries, search, parseOutp
|
|
|
439
417
|
payload['search'] = search;
|
|
440
418
|
}
|
|
441
419
|
|
|
442
|
-
|
|
443
420
|
let response = undefined;
|
|
444
|
-
|
|
421
|
+
|
|
445
422
|
response = await client.call('get', apiPath, {
|
|
446
423
|
'content-type': 'application/json',
|
|
447
424
|
}, payload);
|
|
448
425
|
|
|
449
|
-
|
|
450
426
|
if (parseOutput) {
|
|
451
427
|
parse(response)
|
|
452
428
|
success()
|
|
@@ -472,7 +448,6 @@ const functionsListDeployments = async ({ functionId, queries, search, parseOutp
|
|
|
472
448
|
*/
|
|
473
449
|
const functionsCreateDeployment = async ({ functionId, code, activate, entrypoint, commands, parseOutput = true, sdk = undefined, onProgress = () => {}}) => {
|
|
474
450
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
475
|
-
|
|
476
451
|
let apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
|
|
477
452
|
let payload = {};
|
|
478
453
|
if (typeof entrypoint !== 'undefined') {
|
|
@@ -508,6 +483,12 @@ const functionsCreateDeployment = async ({ functionId, code, activate, entrypoin
|
|
|
508
483
|
file: 'code.tar.gz'
|
|
509
484
|
}, files);
|
|
510
485
|
|
|
486
|
+
let archivePath = fs.realpathSync('code.tar.gz')
|
|
487
|
+
if (typeof archivePath !== 'undefined') {
|
|
488
|
+
payload['code'] = archivePath;
|
|
489
|
+
code = archivePath;
|
|
490
|
+
}
|
|
491
|
+
|
|
511
492
|
const filePath = fs.realpathSync(code);
|
|
512
493
|
const nodeStream = fs.createReadStream(filePath);
|
|
513
494
|
const stream = convertReadStreamToReadableStream(nodeStream);
|
|
@@ -520,8 +501,6 @@ const functionsCreateDeployment = async ({ functionId, code, activate, entrypoin
|
|
|
520
501
|
payload['activate'] = activate;
|
|
521
502
|
}
|
|
522
503
|
|
|
523
|
-
|
|
524
|
-
|
|
525
504
|
const size = code.size;
|
|
526
505
|
|
|
527
506
|
const apiHeaders = {
|
|
@@ -611,7 +590,6 @@ const functionsCreateDeployment = async ({ functionId, code, activate, entrypoin
|
|
|
611
590
|
}
|
|
612
591
|
|
|
613
592
|
return response;
|
|
614
|
-
|
|
615
593
|
}
|
|
616
594
|
|
|
617
595
|
/**
|
|
@@ -627,18 +605,15 @@ const functionsCreateDeployment = async ({ functionId, code, activate, entrypoin
|
|
|
627
605
|
*/
|
|
628
606
|
const functionsGetDeployment = async ({ functionId, deploymentId, parseOutput = true, sdk = undefined}) => {
|
|
629
607
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
630
|
-
|
|
631
608
|
let apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
632
609
|
let payload = {};
|
|
633
610
|
|
|
634
|
-
|
|
635
611
|
let response = undefined;
|
|
636
|
-
|
|
612
|
+
|
|
637
613
|
response = await client.call('get', apiPath, {
|
|
638
614
|
'content-type': 'application/json',
|
|
639
615
|
}, payload);
|
|
640
616
|
|
|
641
|
-
|
|
642
617
|
if (parseOutput) {
|
|
643
618
|
parse(response)
|
|
644
619
|
success()
|
|
@@ -660,18 +635,15 @@ const functionsGetDeployment = async ({ functionId, deploymentId, parseOutput =
|
|
|
660
635
|
*/
|
|
661
636
|
const functionsUpdateDeployment = async ({ functionId, deploymentId, parseOutput = true, sdk = undefined}) => {
|
|
662
637
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
663
|
-
|
|
664
638
|
let apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
665
639
|
let payload = {};
|
|
666
640
|
|
|
667
|
-
|
|
668
641
|
let response = undefined;
|
|
669
|
-
|
|
642
|
+
|
|
670
643
|
response = await client.call('patch', apiPath, {
|
|
671
644
|
'content-type': 'application/json',
|
|
672
645
|
}, payload);
|
|
673
646
|
|
|
674
|
-
|
|
675
647
|
if (parseOutput) {
|
|
676
648
|
parse(response)
|
|
677
649
|
success()
|
|
@@ -693,18 +665,15 @@ const functionsUpdateDeployment = async ({ functionId, deploymentId, parseOutput
|
|
|
693
665
|
*/
|
|
694
666
|
const functionsDeleteDeployment = async ({ functionId, deploymentId, parseOutput = true, sdk = undefined}) => {
|
|
695
667
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
696
|
-
|
|
697
668
|
let apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
698
669
|
let payload = {};
|
|
699
670
|
|
|
700
|
-
|
|
701
671
|
let response = undefined;
|
|
702
|
-
|
|
672
|
+
|
|
703
673
|
response = await client.call('delete', apiPath, {
|
|
704
674
|
'content-type': 'application/json',
|
|
705
675
|
}, payload);
|
|
706
676
|
|
|
707
|
-
|
|
708
677
|
if (parseOutput) {
|
|
709
678
|
parse(response)
|
|
710
679
|
success()
|
|
@@ -727,18 +696,15 @@ const functionsDeleteDeployment = async ({ functionId, deploymentId, parseOutput
|
|
|
727
696
|
*/
|
|
728
697
|
const functionsCreateBuild = async ({ functionId, deploymentId, buildId, parseOutput = true, sdk = undefined}) => {
|
|
729
698
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
730
|
-
|
|
731
699
|
let apiPath = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId);
|
|
732
700
|
let payload = {};
|
|
733
701
|
|
|
734
|
-
|
|
735
702
|
let response = undefined;
|
|
736
|
-
|
|
703
|
+
|
|
737
704
|
response = await client.call('post', apiPath, {
|
|
738
705
|
'content-type': 'application/json',
|
|
739
706
|
}, payload);
|
|
740
707
|
|
|
741
|
-
|
|
742
708
|
if (parseOutput) {
|
|
743
709
|
parse(response)
|
|
744
710
|
success()
|
|
@@ -753,7 +719,7 @@ const functionsCreateBuild = async ({ functionId, deploymentId, buildId, parseOu
|
|
|
753
719
|
* @property {string} deploymentId Deployment ID.
|
|
754
720
|
* @property {boolean} parseOutput
|
|
755
721
|
* @property {libClient | undefined} sdk
|
|
756
|
-
* @property {string} destination
|
|
722
|
+
* @property {string} destination
|
|
757
723
|
*/
|
|
758
724
|
|
|
759
725
|
/**
|
|
@@ -761,23 +727,21 @@ const functionsCreateBuild = async ({ functionId, deploymentId, buildId, parseOu
|
|
|
761
727
|
*/
|
|
762
728
|
const functionsDownloadDeployment = async ({ functionId, deploymentId, parseOutput = true, sdk = undefined, destination}) => {
|
|
763
729
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
764
|
-
|
|
765
730
|
let apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
766
731
|
let payload = {};
|
|
767
|
-
|
|
768
732
|
payload['project'] = localConfig.getProject().projectId
|
|
769
733
|
payload['key'] = globalConfig.getKey();
|
|
770
734
|
const queryParams = new URLSearchParams(payload);
|
|
771
735
|
apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
|
|
772
736
|
|
|
773
737
|
let response = undefined;
|
|
774
|
-
|
|
738
|
+
|
|
775
739
|
response = await client.call('get', apiPath, {
|
|
776
740
|
'content-type': 'application/json',
|
|
777
741
|
}, payload, 'arraybuffer');
|
|
778
742
|
|
|
779
743
|
fs.writeFileSync(destination, response);
|
|
780
|
-
|
|
744
|
+
|
|
781
745
|
if (parseOutput) {
|
|
782
746
|
parse(response)
|
|
783
747
|
success()
|
|
@@ -800,7 +764,6 @@ const functionsDownloadDeployment = async ({ functionId, deploymentId, parseOutp
|
|
|
800
764
|
*/
|
|
801
765
|
const functionsListExecutions = async ({ functionId, queries, search, parseOutput = true, sdk = undefined}) => {
|
|
802
766
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
803
|
-
|
|
804
767
|
let apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
|
|
805
768
|
let payload = {};
|
|
806
769
|
if (typeof queries !== 'undefined') {
|
|
@@ -810,14 +773,12 @@ const functionsListExecutions = async ({ functionId, queries, search, parseOutpu
|
|
|
810
773
|
payload['search'] = search;
|
|
811
774
|
}
|
|
812
775
|
|
|
813
|
-
|
|
814
776
|
let response = undefined;
|
|
815
|
-
|
|
777
|
+
|
|
816
778
|
response = await client.call('get', apiPath, {
|
|
817
779
|
'content-type': 'application/json',
|
|
818
780
|
}, payload);
|
|
819
781
|
|
|
820
|
-
|
|
821
782
|
if (parseOutput) {
|
|
822
783
|
parse(response)
|
|
823
784
|
success()
|
|
@@ -832,7 +793,7 @@ const functionsListExecutions = async ({ functionId, queries, search, parseOutpu
|
|
|
832
793
|
* @property {string} body HTTP body of execution. Default value is empty string.
|
|
833
794
|
* @property {boolean} async Execute code in the background. Default value is false.
|
|
834
795
|
* @property {string} xpath HTTP path of execution. Path can include query params. Default value is /
|
|
835
|
-
* @property {
|
|
796
|
+
* @property {ExecutionMethod} method HTTP method of execution. Default value is GET.
|
|
836
797
|
* @property {object} headers HTTP headers of execution. Defaults to empty.
|
|
837
798
|
* @property {boolean} parseOutput
|
|
838
799
|
* @property {libClient | undefined} sdk
|
|
@@ -843,7 +804,6 @@ const functionsListExecutions = async ({ functionId, queries, search, parseOutpu
|
|
|
843
804
|
*/
|
|
844
805
|
const functionsCreateExecution = async ({ functionId, body, async, xpath, method, headers, parseOutput = true, sdk = undefined}) => {
|
|
845
806
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
846
|
-
|
|
847
807
|
let apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
|
|
848
808
|
let payload = {};
|
|
849
809
|
if (typeof body !== 'undefined') {
|
|
@@ -862,14 +822,12 @@ const functionsCreateExecution = async ({ functionId, body, async, xpath, method
|
|
|
862
822
|
payload['headers'] = JSON.parse(headers);
|
|
863
823
|
}
|
|
864
824
|
|
|
865
|
-
|
|
866
825
|
let response = undefined;
|
|
867
|
-
|
|
826
|
+
|
|
868
827
|
response = await client.call('post', apiPath, {
|
|
869
828
|
'content-type': 'application/json',
|
|
870
829
|
}, payload);
|
|
871
830
|
|
|
872
|
-
|
|
873
831
|
if (parseOutput) {
|
|
874
832
|
parse(response)
|
|
875
833
|
success()
|
|
@@ -891,18 +849,15 @@ const functionsCreateExecution = async ({ functionId, body, async, xpath, method
|
|
|
891
849
|
*/
|
|
892
850
|
const functionsGetExecution = async ({ functionId, executionId, parseOutput = true, sdk = undefined}) => {
|
|
893
851
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
894
|
-
|
|
895
852
|
let apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
|
|
896
853
|
let payload = {};
|
|
897
854
|
|
|
898
|
-
|
|
899
855
|
let response = undefined;
|
|
900
|
-
|
|
856
|
+
|
|
901
857
|
response = await client.call('get', apiPath, {
|
|
902
858
|
'content-type': 'application/json',
|
|
903
859
|
}, payload);
|
|
904
860
|
|
|
905
|
-
|
|
906
861
|
if (parseOutput) {
|
|
907
862
|
parse(response)
|
|
908
863
|
success()
|
|
@@ -914,7 +869,7 @@ const functionsGetExecution = async ({ functionId, executionId, parseOutput = tr
|
|
|
914
869
|
/**
|
|
915
870
|
* @typedef {Object} FunctionsGetFunctionUsageRequestParams
|
|
916
871
|
* @property {string} functionId Function ID.
|
|
917
|
-
* @property {
|
|
872
|
+
* @property {FunctionUsageRange} range Date range.
|
|
918
873
|
* @property {boolean} parseOutput
|
|
919
874
|
* @property {libClient | undefined} sdk
|
|
920
875
|
*/
|
|
@@ -924,21 +879,18 @@ const functionsGetExecution = async ({ functionId, executionId, parseOutput = tr
|
|
|
924
879
|
*/
|
|
925
880
|
const functionsGetFunctionUsage = async ({ functionId, range, parseOutput = true, sdk = undefined}) => {
|
|
926
881
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
927
|
-
|
|
928
882
|
let apiPath = '/functions/{functionId}/usage'.replace('{functionId}', functionId);
|
|
929
883
|
let payload = {};
|
|
930
884
|
if (typeof range !== 'undefined') {
|
|
931
885
|
payload['range'] = range;
|
|
932
886
|
}
|
|
933
887
|
|
|
934
|
-
|
|
935
888
|
let response = undefined;
|
|
936
|
-
|
|
889
|
+
|
|
937
890
|
response = await client.call('get', apiPath, {
|
|
938
891
|
'content-type': 'application/json',
|
|
939
892
|
}, payload);
|
|
940
893
|
|
|
941
|
-
|
|
942
894
|
if (parseOutput) {
|
|
943
895
|
parse(response)
|
|
944
896
|
success()
|
|
@@ -959,18 +911,15 @@ const functionsGetFunctionUsage = async ({ functionId, range, parseOutput = true
|
|
|
959
911
|
*/
|
|
960
912
|
const functionsListVariables = async ({ functionId, parseOutput = true, sdk = undefined}) => {
|
|
961
913
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
962
|
-
|
|
963
914
|
let apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
|
|
964
915
|
let payload = {};
|
|
965
916
|
|
|
966
|
-
|
|
967
917
|
let response = undefined;
|
|
968
|
-
|
|
918
|
+
|
|
969
919
|
response = await client.call('get', apiPath, {
|
|
970
920
|
'content-type': 'application/json',
|
|
971
921
|
}, payload);
|
|
972
922
|
|
|
973
|
-
|
|
974
923
|
if (parseOutput) {
|
|
975
924
|
parse(response)
|
|
976
925
|
success()
|
|
@@ -993,7 +942,6 @@ const functionsListVariables = async ({ functionId, parseOutput = true, sdk = un
|
|
|
993
942
|
*/
|
|
994
943
|
const functionsCreateVariable = async ({ functionId, key, value, parseOutput = true, sdk = undefined}) => {
|
|
995
944
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
996
|
-
|
|
997
945
|
let apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
|
|
998
946
|
let payload = {};
|
|
999
947
|
if (typeof key !== 'undefined') {
|
|
@@ -1003,14 +951,12 @@ const functionsCreateVariable = async ({ functionId, key, value, parseOutput = t
|
|
|
1003
951
|
payload['value'] = value;
|
|
1004
952
|
}
|
|
1005
953
|
|
|
1006
|
-
|
|
1007
954
|
let response = undefined;
|
|
1008
|
-
|
|
955
|
+
|
|
1009
956
|
response = await client.call('post', apiPath, {
|
|
1010
957
|
'content-type': 'application/json',
|
|
1011
958
|
}, payload);
|
|
1012
959
|
|
|
1013
|
-
|
|
1014
960
|
if (parseOutput) {
|
|
1015
961
|
parse(response)
|
|
1016
962
|
success()
|
|
@@ -1032,18 +978,15 @@ const functionsCreateVariable = async ({ functionId, key, value, parseOutput = t
|
|
|
1032
978
|
*/
|
|
1033
979
|
const functionsGetVariable = async ({ functionId, variableId, parseOutput = true, sdk = undefined}) => {
|
|
1034
980
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
1035
|
-
|
|
1036
981
|
let apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
|
|
1037
982
|
let payload = {};
|
|
1038
983
|
|
|
1039
|
-
|
|
1040
984
|
let response = undefined;
|
|
1041
|
-
|
|
985
|
+
|
|
1042
986
|
response = await client.call('get', apiPath, {
|
|
1043
987
|
'content-type': 'application/json',
|
|
1044
988
|
}, payload);
|
|
1045
989
|
|
|
1046
|
-
|
|
1047
990
|
if (parseOutput) {
|
|
1048
991
|
parse(response)
|
|
1049
992
|
success()
|
|
@@ -1067,7 +1010,6 @@ const functionsGetVariable = async ({ functionId, variableId, parseOutput = true
|
|
|
1067
1010
|
*/
|
|
1068
1011
|
const functionsUpdateVariable = async ({ functionId, variableId, key, value, parseOutput = true, sdk = undefined}) => {
|
|
1069
1012
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
1070
|
-
|
|
1071
1013
|
let apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
|
|
1072
1014
|
let payload = {};
|
|
1073
1015
|
if (typeof key !== 'undefined') {
|
|
@@ -1077,14 +1019,12 @@ const functionsUpdateVariable = async ({ functionId, variableId, key, value, par
|
|
|
1077
1019
|
payload['value'] = value;
|
|
1078
1020
|
}
|
|
1079
1021
|
|
|
1080
|
-
|
|
1081
1022
|
let response = undefined;
|
|
1082
|
-
|
|
1023
|
+
|
|
1083
1024
|
response = await client.call('put', apiPath, {
|
|
1084
1025
|
'content-type': 'application/json',
|
|
1085
1026
|
}, payload);
|
|
1086
1027
|
|
|
1087
|
-
|
|
1088
1028
|
if (parseOutput) {
|
|
1089
1029
|
parse(response)
|
|
1090
1030
|
success()
|
|
@@ -1106,18 +1046,15 @@ const functionsUpdateVariable = async ({ functionId, variableId, key, value, par
|
|
|
1106
1046
|
*/
|
|
1107
1047
|
const functionsDeleteVariable = async ({ functionId, variableId, parseOutput = true, sdk = undefined}) => {
|
|
1108
1048
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
1109
|
-
|
|
1110
1049
|
let apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
|
|
1111
1050
|
let payload = {};
|
|
1112
1051
|
|
|
1113
|
-
|
|
1114
1052
|
let response = undefined;
|
|
1115
|
-
|
|
1053
|
+
|
|
1116
1054
|
response = await client.call('delete', apiPath, {
|
|
1117
1055
|
'content-type': 'application/json',
|
|
1118
1056
|
}, payload);
|
|
1119
1057
|
|
|
1120
|
-
|
|
1121
1058
|
if (parseOutput) {
|
|
1122
1059
|
parse(response)
|
|
1123
1060
|
success()
|
|
@@ -1126,7 +1063,6 @@ const functionsDeleteVariable = async ({ functionId, variableId, parseOutput = t
|
|
|
1126
1063
|
return response;
|
|
1127
1064
|
}
|
|
1128
1065
|
|
|
1129
|
-
|
|
1130
1066
|
functions
|
|
1131
1067
|
.command(`list`)
|
|
1132
1068
|
.description(`Get a list of all the project's functions. You can use the query params to filter your results.`)
|
|
@@ -1328,30 +1264,29 @@ functions
|
|
|
1328
1264
|
.requiredOption(`--variableId <variableId>`, `Variable unique ID.`)
|
|
1329
1265
|
.action(actionRunner(functionsDeleteVariable))
|
|
1330
1266
|
|
|
1331
|
-
|
|
1332
1267
|
module.exports = {
|
|
1333
1268
|
functions,
|
|
1334
|
-
functionsList,
|
|
1335
|
-
functionsCreate,
|
|
1336
|
-
functionsListRuntimes,
|
|
1337
|
-
functionsGetUsage,
|
|
1338
|
-
functionsGet,
|
|
1339
|
-
functionsUpdate,
|
|
1340
|
-
functionsDelete,
|
|
1341
|
-
functionsListDeployments,
|
|
1342
|
-
functionsCreateDeployment,
|
|
1343
|
-
functionsGetDeployment,
|
|
1344
|
-
functionsUpdateDeployment,
|
|
1345
|
-
functionsDeleteDeployment,
|
|
1346
|
-
functionsCreateBuild,
|
|
1347
|
-
functionsDownloadDeployment,
|
|
1348
|
-
functionsListExecutions,
|
|
1349
|
-
functionsCreateExecution,
|
|
1350
|
-
functionsGetExecution,
|
|
1351
|
-
functionsGetFunctionUsage,
|
|
1352
|
-
functionsListVariables,
|
|
1353
|
-
functionsCreateVariable,
|
|
1354
|
-
functionsGetVariable,
|
|
1355
|
-
functionsUpdateVariable,
|
|
1356
|
-
functionsDeleteVariable
|
|
1269
|
+
functionsList,
|
|
1270
|
+
functionsCreate,
|
|
1271
|
+
functionsListRuntimes,
|
|
1272
|
+
functionsGetUsage,
|
|
1273
|
+
functionsGet,
|
|
1274
|
+
functionsUpdate,
|
|
1275
|
+
functionsDelete,
|
|
1276
|
+
functionsListDeployments,
|
|
1277
|
+
functionsCreateDeployment,
|
|
1278
|
+
functionsGetDeployment,
|
|
1279
|
+
functionsUpdateDeployment,
|
|
1280
|
+
functionsDeleteDeployment,
|
|
1281
|
+
functionsCreateBuild,
|
|
1282
|
+
functionsDownloadDeployment,
|
|
1283
|
+
functionsListExecutions,
|
|
1284
|
+
functionsCreateExecution,
|
|
1285
|
+
functionsGetExecution,
|
|
1286
|
+
functionsGetFunctionUsage,
|
|
1287
|
+
functionsListVariables,
|
|
1288
|
+
functionsCreateVariable,
|
|
1289
|
+
functionsGetVariable,
|
|
1290
|
+
functionsUpdateVariable,
|
|
1291
|
+
functionsDeleteVariable
|
|
1357
1292
|
};
|