From 8e18b1e4c28b960db0f93684ba505559da041f15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Sat, 27 Jul 2024 09:46:16 +0000 Subject: [PATCH] RC update --- README.md | 8 +- install.ps1 | 4 +- install.sh | 2 +- lib/client.js | 4 +- lib/commands/account.js | 130 ++++++------ lib/commands/avatars.js | 18 +- lib/commands/databases.js | 280 ++++++++++++------------- lib/commands/functions.js | 138 ++++++------- lib/commands/generic.js | 7 +- lib/commands/health.js | 44 ++-- lib/commands/init.js | 7 +- lib/commands/locale.js | 14 +- lib/commands/messaging.js | 320 ++++++++++++++--------------- lib/commands/migrations.js | 56 ++--- lib/commands/project.js | 22 +- lib/commands/projects.js | 244 +++++++++++----------- lib/commands/proxy.js | 20 +- lib/commands/pull.js | 8 +- lib/commands/push.js | 408 ++++++++++++++++++++++++++++--------- lib/commands/run.js | 56 ++++- lib/commands/storage.js | 88 ++++---- lib/commands/teams.js | 58 +++--- lib/commands/users.js | 198 +++++++++--------- lib/commands/vcs.js | 54 ++--- lib/config.js | 32 ++- lib/emulation/docker.js | 83 +++++++- lib/parser.js | 17 +- lib/questions.js | 36 ++-- lib/spinner.js | 1 + package.json | 2 +- scoop/appwrite.json | 6 +- 31 files changed, 1345 insertions(+), 1020 deletions(-) diff --git a/README.md b/README.md index 047af5e..365f8be 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Appwrite Command Line SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-cli.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.5.7-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.6.0-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.6.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-cli/releases).** +**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-cli/releases).** Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Command Line SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) @@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using ```sh $ appwrite -v -6.0.0-rc.4 +6.0.0-rc.5 ``` ### Install using prebuilt binaries @@ -60,7 +60,7 @@ $ scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/sc Once the installation completes, you can verify your install using ``` $ appwrite -v -6.0.0-rc.4 +6.0.0-rc.5 ``` ## Getting Started diff --git a/install.ps1 b/install.ps1 index c4117bf..dcc1ed2 100644 --- a/install.ps1 +++ b/install.ps1 @@ -13,8 +13,8 @@ # You can use "View source" of this page to see the full script. # REPO -$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.4/appwrite-cli-win-x64.exe" -$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.4/appwrite-cli-win-arm64.exe" +$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.5/appwrite-cli-win-x64.exe" +$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.5/appwrite-cli-win-arm64.exe" $APPWRITE_BINARY_NAME = "appwrite.exe" diff --git a/install.sh b/install.sh index 61ac1c3..823437c 100644 --- a/install.sh +++ b/install.sh @@ -97,7 +97,7 @@ printSuccess() { downloadBinary() { echo "[2/4] Downloading executable for $OS ($ARCH) ..." - GITHUB_LATEST_VERSION="6.0.0-rc.4" + GITHUB_LATEST_VERSION="6.0.0-rc.5" GITHUB_FILE="appwrite-cli-${OS}-${ARCH}" GITHUB_URL="https://github.com/$GITHUB_REPOSITORY_NAME/releases/download/$GITHUB_LATEST_VERSION/$GITHUB_FILE" diff --git a/lib/client.js b/lib/client.js index f91d767..f9260d9 100644 --- a/lib/client.js +++ b/lib/client.js @@ -16,8 +16,8 @@ class Client { 'x-sdk-name': 'Command Line', 'x-sdk-platform': 'console', 'x-sdk-language': 'cli', - 'x-sdk-version': '6.0.0-rc.4', - 'user-agent' : `AppwriteCLI/6.0.0-rc.4 (${os.type()} ${os.version()}; ${os.arch()})`, + 'x-sdk-version': '6.0.0-rc.5', + 'user-agent' : `AppwriteCLI/6.0.0-rc.5 (${os.type()} ${os.version()}; ${os.arch()})`, 'X-Appwrite-Response-Format' : '1.5.0', }; } diff --git a/lib/commands/account.js b/lib/commands/account.js index 883e8d5..5df93fa 100644 --- a/lib/commands/account.js +++ b/lib/commands/account.js @@ -1779,7 +1779,7 @@ account account .command(`create`) .description(`Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).`) - .requiredOption(`--userId `, `User 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.`) + .requiredOption(`--user-id `, `User 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.`) .requiredOption(`--email `, `User email.`) .requiredOption(`--password `, `New user password. Must be between 8 and 256 chars.`) .option(`--name `, `User name. Max length: 128 chars.`) @@ -1791,171 +1791,171 @@ account .action(actionRunner(accountDelete)) account - .command(`updateEmail`) + .command(`update-email`) .description(`Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request. This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. `) .requiredOption(`--email `, `User email.`) .requiredOption(`--password `, `User password. Must be at least 8 chars.`) .action(actionRunner(accountUpdateEmail)) account - .command(`listIdentities`) + .command(`list-identities`) .description(`Get the list of identities for the currently logged in user.`) .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: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry`) .action(actionRunner(accountListIdentities)) account - .command(`deleteIdentity`) + .command(`delete-identity`) .description(`Delete an identity by its unique ID.`) - .requiredOption(`--identityId `, `Identity ID.`) + .requiredOption(`--identity-id `, `Identity ID.`) .action(actionRunner(accountDeleteIdentity)) account - .command(`createJWT`) + .command(`create-jwt`) .description(`Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.`) .action(actionRunner(accountCreateJWT)) account - .command(`listLogs`) + .command(`list-logs`) .description(`Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log.`) .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). Only supported methods are limit and offset`) .action(actionRunner(accountListLogs)) account - .command(`updateMFA`) + .command(`update-mfa`) .description(`Enable or disable MFA on an account.`) .requiredOption(`--mfa `, `Enable or disable MFA.`, parseBool) .action(actionRunner(accountUpdateMFA)) account - .command(`createMfaAuthenticator`) + .command(`create-mfa-authenticator`) .description(`Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.`) .requiredOption(`--type `, `Type of authenticator. Must be 'totp'`) .action(actionRunner(accountCreateMfaAuthenticator)) account - .command(`updateMfaAuthenticator`) + .command(`update-mfa-authenticator`) .description(`Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.`) .requiredOption(`--type `, `Type of authenticator.`) .requiredOption(`--otp `, `Valid verification token.`) .action(actionRunner(accountUpdateMfaAuthenticator)) account - .command(`deleteMfaAuthenticator`) + .command(`delete-mfa-authenticator`) .description(`Delete an authenticator for a user by ID.`) .requiredOption(`--type `, `Type of authenticator.`) .action(actionRunner(accountDeleteMfaAuthenticator)) account - .command(`createMfaChallenge`) + .command(`create-mfa-challenge`) .description(`Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.`) .requiredOption(`--factor `, `Factor used for verification. Must be one of following: 'email', 'phone', 'totp', 'recoveryCode'.`) .action(actionRunner(accountCreateMfaChallenge)) account - .command(`updateMfaChallenge`) + .command(`update-mfa-challenge`) .description(`Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.`) - .requiredOption(`--challengeId `, `ID of the challenge.`) + .requiredOption(`--challenge-id `, `ID of the challenge.`) .requiredOption(`--otp `, `Valid verification token.`) .action(actionRunner(accountUpdateMfaChallenge)) account - .command(`listMfaFactors`) + .command(`list-mfa-factors`) .description(`List the factors available on the account to be used as a MFA challange.`) .action(actionRunner(accountListMfaFactors)) account - .command(`getMfaRecoveryCodes`) + .command(`get-mfa-recovery-codes`) .description(`Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes.`) .action(actionRunner(accountGetMfaRecoveryCodes)) account - .command(`createMfaRecoveryCodes`) + .command(`create-mfa-recovery-codes`) .description(`Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.`) .action(actionRunner(accountCreateMfaRecoveryCodes)) account - .command(`updateMfaRecoveryCodes`) + .command(`update-mfa-recovery-codes`) .description(`Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.`) .action(actionRunner(accountUpdateMfaRecoveryCodes)) account - .command(`updateName`) + .command(`update-name`) .description(`Update currently logged in user account name.`) .requiredOption(`--name `, `User name. Max length: 128 chars.`) .action(actionRunner(accountUpdateName)) account - .command(`updatePassword`) + .command(`update-password`) .description(`Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional.`) .requiredOption(`--password `, `New user password. Must be at least 8 chars.`) - .option(`--oldPassword `, `Current user password. Must be at least 8 chars.`) + .option(`--old-password `, `Current user password. Must be at least 8 chars.`) .action(actionRunner(accountUpdatePassword)) account - .command(`updatePhone`) + .command(`update-phone`) .description(`Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS.`) .requiredOption(`--phone `, `Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.`) .requiredOption(`--password `, `User password. Must be at least 8 chars.`) .action(actionRunner(accountUpdatePhone)) account - .command(`getPrefs`) + .command(`get-prefs`) .description(`Get the preferences as a key-value object for the currently logged in user.`) .action(actionRunner(accountGetPrefs)) account - .command(`updatePrefs`) + .command(`update-prefs`) .description(`Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.`) .requiredOption(`--prefs `, `Prefs key-value JSON object.`) .action(actionRunner(accountUpdatePrefs)) account - .command(`createRecovery`) + .command(`create-recovery`) .description(`Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.`) .requiredOption(`--email `, `User email.`) .requiredOption(`--url `, `URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`) .action(actionRunner(accountCreateRecovery)) account - .command(`updateRecovery`) + .command(`update-recovery`) .description(`Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) endpoint. Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.`) - .requiredOption(`--userId `, `User ID.`) + .requiredOption(`--user-id `, `User ID.`) .requiredOption(`--secret `, `Valid reset token.`) .requiredOption(`--password `, `New user password. Must be between 8 and 256 chars.`) .action(actionRunner(accountUpdateRecovery)) account - .command(`listSessions`) + .command(`list-sessions`) .description(`Get the list of active sessions across different devices for the currently logged in user.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(accountListSessions)) account - .command(`deleteSessions`) + .command(`delete-sessions`) .description(`Delete all sessions from the user account and remove any sessions cookies from the end client.`) .action(actionRunner(accountDeleteSessions)) account - .command(`createAnonymousSession`) + .command(`create-anonymous-session`) .description(`Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its [email and password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail) or create an [OAuth2 session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session).`) .action(actionRunner(accountCreateAnonymousSession)) account - .command(`createEmailPasswordSession`) + .command(`create-email-password-session`) .description(`Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).`) .requiredOption(`--email `, `User email.`) .requiredOption(`--password `, `User password. Must be at least 8 chars.`) .action(actionRunner(accountCreateEmailPasswordSession)) account - .command(`updateMagicURLSession`) + .command(`update-magic-url-session`) .description(`Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.`) - .requiredOption(`--userId `, `User 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.`) + .requiredOption(`--user-id `, `User 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.`) .requiredOption(`--secret `, `Valid verification token.`) .action(actionRunner(accountUpdateMagicURLSession)) account - .command(`createOAuth2Session`) + .command(`create-o-auth-2-session`) .description(`Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed. If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). `) .requiredOption(`--provider `, `OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.`) .option(`--success `, `URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`) @@ -1964,82 +1964,82 @@ account .action(actionRunner(accountCreateOAuth2Session)) account - .command(`updatePhoneSession`) + .command(`update-phone-session`) .description(`Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.`) - .requiredOption(`--userId `, `User 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.`) + .requiredOption(`--user-id `, `User 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.`) .requiredOption(`--secret `, `Valid verification token.`) .action(actionRunner(accountUpdatePhoneSession)) account - .command(`createSession`) + .command(`create-session`) .description(`Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.`) - .requiredOption(`--userId `, `User 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.`) + .requiredOption(`--user-id `, `User 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.`) .requiredOption(`--secret `, `Secret of a token generated by login methods. For example, the 'createMagicURLToken' or 'createPhoneToken' methods.`) .action(actionRunner(accountCreateSession)) account - .command(`getSession`) + .command(`get-session`) .description(`Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.`) - .requiredOption(`--sessionId `, `Session ID. Use the string 'current' to get the current device session.`) + .requiredOption(`--session-id `, `Session ID. Use the string 'current' to get the current device session.`) .action(actionRunner(accountGetSession)) account - .command(`updateSession`) + .command(`update-session`) .description(`Use this endpoint to extend a session's length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider.`) - .requiredOption(`--sessionId `, `Session ID. Use the string 'current' to update the current device session.`) + .requiredOption(`--session-id `, `Session ID. Use the string 'current' to update the current device session.`) .action(actionRunner(accountUpdateSession)) account - .command(`deleteSession`) + .command(`delete-session`) .description(`Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead.`) - .requiredOption(`--sessionId `, `Session ID. Use the string 'current' to delete the current device session.`) + .requiredOption(`--session-id `, `Session ID. Use the string 'current' to delete the current device session.`) .action(actionRunner(accountDeleteSession)) account - .command(`updateStatus`) + .command(`update-status`) .description(`Block the currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. To completely delete a user, use the Users API instead.`) .action(actionRunner(accountUpdateStatus)) account - .command(`createPushTarget`) + .command(`create-push-target`) .description(``) - .requiredOption(`--targetId `, `Target 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.`) + .requiredOption(`--target-id `, `Target 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.`) .requiredOption(`--identifier `, `The target identifier (token, email, phone etc.)`) - .option(`--providerId `, `Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.`) + .option(`--provider-id `, `Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.`) .action(actionRunner(accountCreatePushTarget)) account - .command(`updatePushTarget`) + .command(`update-push-target`) .description(``) - .requiredOption(`--targetId `, `Target ID.`) + .requiredOption(`--target-id `, `Target ID.`) .requiredOption(`--identifier `, `The target identifier (token, email, phone etc.)`) .action(actionRunner(accountUpdatePushTarget)) account - .command(`deletePushTarget`) + .command(`delete-push-target`) .description(``) - .requiredOption(`--targetId `, `Target ID.`) + .requiredOption(`--target-id `, `Target ID.`) .action(actionRunner(accountDeletePushTarget)) account - .command(`createEmailToken`) + .command(`create-email-token`) .description(`Sends the user an email with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).`) - .requiredOption(`--userId `, `User 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.`) + .requiredOption(`--user-id `, `User 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.`) .requiredOption(`--email `, `User email.`) .option(`--phrase `, `Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.`, parseBool) .action(actionRunner(accountCreateEmailToken)) account - .command(`createMagicURLToken`) + .command(`create-magic-url-token`) .description(`Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appwrite instance by default. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). `) - .requiredOption(`--userId `, `Unique 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.`) + .requiredOption(`--user-id `, `Unique 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.`) .requiredOption(`--email `, `User email.`) .option(`--url `, `URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`) .option(`--phrase `, `Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.`, parseBool) .action(actionRunner(accountCreateMagicURLToken)) account - .command(`createOAuth2Token`) + .command(`create-o-auth-2-token`) .description(`Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed. If authentication succeeds, 'userId' and 'secret' of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).`) .requiredOption(`--provider `, `OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.`) .option(`--success `, `URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`) @@ -2048,34 +2048,34 @@ account .action(actionRunner(accountCreateOAuth2Token)) account - .command(`createPhoneToken`) + .command(`create-phone-token`) .description(`Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).`) - .requiredOption(`--userId `, `Unique 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.`) + .requiredOption(`--user-id `, `Unique 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.`) .requiredOption(`--phone `, `Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.`) .action(actionRunner(accountCreatePhoneToken)) account - .command(`createVerification`) + .command(`create-verification`) .description(`Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days. Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. `) .requiredOption(`--url `, `URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`) .action(actionRunner(accountCreateVerification)) account - .command(`updateVerification`) + .command(`update-verification`) .description(`Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.`) - .requiredOption(`--userId `, `User ID.`) + .requiredOption(`--user-id `, `User ID.`) .requiredOption(`--secret `, `Valid verification token.`) .action(actionRunner(accountUpdateVerification)) account - .command(`createPhoneVerification`) + .command(`create-phone-verification`) .description(`Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user's phone number using the [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user's phone number is valid for 15 minutes.`) .action(actionRunner(accountCreatePhoneVerification)) account - .command(`updatePhoneVerification`) + .command(`update-phone-verification`) .description(`Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code.`) - .requiredOption(`--userId `, `User ID.`) + .requiredOption(`--user-id `, `User ID.`) .requiredOption(`--secret `, `Valid verification token.`) .action(actionRunner(accountUpdatePhoneVerification)) diff --git a/lib/commands/avatars.js b/lib/commands/avatars.js index 4d423d6..c0649d8 100644 --- a/lib/commands/avatars.js +++ b/lib/commands/avatars.js @@ -428,7 +428,7 @@ const avatarsGetQR = async ({text,size,margin,download,parseOutput = true, overr } avatars - .command(`getBrowser`) + .command(`get-browser`) .description(`You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings. When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px.`) .requiredOption(`--code `, `Browser Code.`) .option(`--width `, `Image width. Pass an integer between 0 to 2000. Defaults to 100.`, parseInteger) @@ -438,7 +438,7 @@ avatars .action(actionRunner(avatarsGetBrowser)) avatars - .command(`getCreditCard`) + .command(`get-credit-card`) .description(`The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings. When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. `) .requiredOption(`--code `, `Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.`) .option(`--width `, `Image width. Pass an integer between 0 to 2000. Defaults to 100.`, parseInteger) @@ -448,14 +448,14 @@ avatars .action(actionRunner(avatarsGetCreditCard)) avatars - .command(`getFavicon`) - .description(`Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL. `) + .command(`get-favicon`) + .description(`Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL. This endpoint does not follow HTTP redirects.`) .requiredOption(`--url `, `Website URL which you want to fetch the favicon from.`) .requiredOption(`--destination `, `output file path.`) .action(actionRunner(avatarsGetFavicon)) avatars - .command(`getFlag`) + .command(`get-flag`) .description(`You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. `) .requiredOption(`--code `, `Country Code. ISO Alpha-2 country code format.`) .option(`--width `, `Image width. Pass an integer between 0 to 2000. Defaults to 100.`, parseInteger) @@ -465,8 +465,8 @@ avatars .action(actionRunner(avatarsGetFlag)) avatars - .command(`getImage`) - .description(`Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol. When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 400x400px. `) + .command(`get-image`) + .description(`Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol. When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 400x400px. This endpoint does not follow HTTP redirects.`) .requiredOption(`--url `, `Image URL which you want to crop.`) .option(`--width `, `Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400.`, parseInteger) .option(`--height `, `Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400.`, parseInteger) @@ -474,7 +474,7 @@ avatars .action(actionRunner(avatarsGetImage)) avatars - .command(`getInitials`) + .command(`get-initials`) .description(`Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned. You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials. When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. `) .option(`--name `, `Full Name. When empty, current user name or email will be used. Max length: 128 chars.`) .option(`--width `, `Image width. Pass an integer between 0 to 2000. Defaults to 100.`, parseInteger) @@ -484,7 +484,7 @@ avatars .action(actionRunner(avatarsGetInitials)) avatars - .command(`getQR`) + .command(`get-qr`) .description(`Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image. `) .requiredOption(`--text `, `Plain text to be converted to QR code image.`) .option(`--size `, `QR code size. Pass an integer between 1 to 1000. Defaults to 400.`, parseInteger) diff --git a/lib/commands/databases.js b/lib/commands/databases.js index d2b989b..3174403 100644 --- a/lib/commands/databases.js +++ b/lib/commands/databases.js @@ -2123,13 +2123,13 @@ databases databases .command(`create`) .description(`Create a new Database. `) - .requiredOption(`--databaseId `, `Unique 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.`) + .requiredOption(`--database-id `, `Unique 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.`) .requiredOption(`--name `, `Database name. Max length: 128 chars.`) .option(`--enabled `, `Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.`, parseBool) .action(actionRunner(databasesCreate)) databases - .command(`getUsage`) + .command(`get-usage`) .description(``) .option(`--range `, `'Date range.`) .action(actionRunner(databasesGetUsage)) @@ -2137,14 +2137,14 @@ databases databases .command(`get`) .description(`Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata.`) - .requiredOption(`--databaseId `, `Database ID.`) + .requiredOption(`--database-id `, `Database ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(databasesGet)) databases .command(`update`) .description(`Update a database by its unique ID.`) - .requiredOption(`--databaseId `, `Database ID.`) + .requiredOption(`--database-id `, `Database ID.`) .requiredOption(`--name `, `Database name. Max length: 128 chars.`) .option(`--enabled `, `Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.`, parseBool) .action(actionRunner(databasesUpdate)) @@ -2152,69 +2152,69 @@ databases databases .command(`delete`) .description(`Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database.`) - .requiredOption(`--databaseId `, `Database ID.`) + .requiredOption(`--database-id `, `Database ID.`) .action(actionRunner(databasesDelete)) databases - .command(`listCollections`) + .command(`list-collections`) .description(`Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results.`) - .requiredOption(`--databaseId `, `Database ID.`) + .requiredOption(`--database-id `, `Database ID.`) .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, documentSecurity`) .option(`--search `, `Search term to filter your list results. Max length: 256 chars.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(databasesListCollections)) databases - .command(`createCollection`) + .command(`create-collection`) .description(`Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.`) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Unique 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.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Unique 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.`) .requiredOption(`--name `, `Collection name. Max length: 128 chars.`) .option(`--permissions [permissions...]`, `An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).`) - .option(`--documentSecurity `, `Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).`, parseBool) + .option(`--document-security `, `Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).`, parseBool) .option(`--enabled `, `Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.`, parseBool) .action(actionRunner(databasesCreateCollection)) databases - .command(`getCollection`) + .command(`get-collection`) .description(`Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.`) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(databasesGetCollection)) databases - .command(`updateCollection`) + .command(`update-collection`) .description(`Update a collection by its unique ID.`) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) .requiredOption(`--name `, `Collection name. Max length: 128 chars.`) .option(`--permissions [permissions...]`, `An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`) - .option(`--documentSecurity `, `Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).`, parseBool) + .option(`--document-security `, `Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).`, parseBool) .option(`--enabled `, `Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.`, parseBool) .action(actionRunner(databasesUpdateCollection)) databases - .command(`deleteCollection`) + .command(`delete-collection`) .description(`Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.`) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) .action(actionRunner(databasesDeleteCollection)) databases - .command(`listAttributes`) + .command(`list-attributes`) .description(`List attributes in the collection.`) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, size, required, array, status, error`) .option(`--console`, `Get the resource console url`) .action(actionRunner(databasesListAttributes)) databases - .command(`createBooleanAttribute`) + .command(`create-boolean-attribute`) .description(`Create a boolean attribute. `) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .option(`--xdefault `, `Default value for attribute when not provided. Cannot be set when attribute is required.`, parseBool) @@ -2222,20 +2222,20 @@ databases .action(actionRunner(databasesCreateBooleanAttribute)) databases - .command(`updateBooleanAttribute`) + .command(`update-boolean-attribute`) .description(`Update a boolean attribute. Changing the 'default' value will not update already existing documents.`) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .option(`--xdefault `, `Default value for attribute when not provided. Cannot be set when attribute is required.`, parseBool) .action(actionRunner(databasesUpdateBooleanAttribute)) databases - .command(`createDatetimeAttribute`) + .command(`create-datetime-attribute`) .description(`Create a date time attribute according to the ISO 8601 standard.`) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .option(`--xdefault `, `Default value for the attribute in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when attribute is required.`) @@ -2243,20 +2243,20 @@ databases .action(actionRunner(databasesCreateDatetimeAttribute)) databases - .command(`updateDatetimeAttribute`) + .command(`update-datetime-attribute`) .description(`Update a date time attribute. Changing the 'default' value will not update already existing documents.`) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .option(`--xdefault `, `Default value for attribute when not provided. Cannot be set when attribute is required.`) .action(actionRunner(databasesUpdateDatetimeAttribute)) databases - .command(`createEmailAttribute`) + .command(`create-email-attribute`) .description(`Create an email attribute. `) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .option(`--xdefault `, `Default value for attribute when not provided. Cannot be set when attribute is required.`) @@ -2264,20 +2264,20 @@ databases .action(actionRunner(databasesCreateEmailAttribute)) databases - .command(`updateEmailAttribute`) + .command(`update-email-attribute`) .description(`Update an email attribute. Changing the 'default' value will not update already existing documents. `) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .option(`--xdefault `, `Default value for attribute when not provided. Cannot be set when attribute is required.`) .action(actionRunner(databasesUpdateEmailAttribute)) databases - .command(`createEnumAttribute`) + .command(`create-enum-attribute`) .description(`Create an enumeration attribute. The 'elements' param acts as a white-list of accepted values for this attribute. `) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--elements [elements...]`, `Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) @@ -2286,10 +2286,10 @@ databases .action(actionRunner(databasesCreateEnumAttribute)) databases - .command(`updateEnumAttribute`) + .command(`update-enum-attribute`) .description(`Update an enum attribute. Changing the 'default' value will not update already existing documents. `) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--elements [elements...]`, `Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) @@ -2297,10 +2297,10 @@ databases .action(actionRunner(databasesUpdateEnumAttribute)) databases - .command(`createFloatAttribute`) + .command(`create-float-attribute`) .description(`Create a float attribute. Optionally, minimum and maximum values can be provided. `) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .option(`--min `, `Minimum value to enforce on new documents`, parseInteger) @@ -2310,10 +2310,10 @@ databases .action(actionRunner(databasesCreateFloatAttribute)) databases - .command(`updateFloatAttribute`) + .command(`update-float-attribute`) .description(`Update a float attribute. Changing the 'default' value will not update already existing documents. `) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .requiredOption(`--min `, `Minimum value to enforce on new documents`, parseInteger) @@ -2322,10 +2322,10 @@ databases .action(actionRunner(databasesUpdateFloatAttribute)) databases - .command(`createIntegerAttribute`) + .command(`create-integer-attribute`) .description(`Create an integer attribute. Optionally, minimum and maximum values can be provided. `) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .option(`--min `, `Minimum value to enforce on new documents`, parseInteger) @@ -2335,10 +2335,10 @@ databases .action(actionRunner(databasesCreateIntegerAttribute)) databases - .command(`updateIntegerAttribute`) + .command(`update-integer-attribute`) .description(`Update an integer attribute. Changing the 'default' value will not update already existing documents. `) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .requiredOption(`--min `, `Minimum value to enforce on new documents`, parseInteger) @@ -2347,10 +2347,10 @@ databases .action(actionRunner(databasesUpdateIntegerAttribute)) databases - .command(`createIpAttribute`) + .command(`create-ip-attribute`) .description(`Create IP address attribute. `) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .option(`--xdefault `, `Default value for attribute when not provided. Cannot be set when attribute is required.`) @@ -2358,33 +2358,33 @@ databases .action(actionRunner(databasesCreateIpAttribute)) databases - .command(`updateIpAttribute`) + .command(`update-ip-attribute`) .description(`Update an ip attribute. Changing the 'default' value will not update already existing documents. `) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .option(`--xdefault `, `Default value for attribute when not provided. Cannot be set when attribute is required.`) .action(actionRunner(databasesUpdateIpAttribute)) databases - .command(`createRelationshipAttribute`) + .command(`create-relationship-attribute`) .description(`Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). `) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) - .requiredOption(`--relatedCollectionId `, `Related Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--related-collection-id `, `Related Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--type `, `Relation type`) - .option(`--twoWay `, `Is Two Way?`, parseBool) + .option(`--two-way `, `Is Two Way?`, parseBool) .option(`--key `, `Attribute Key.`) - .option(`--twoWayKey `, `Two Way Attribute Key.`) - .option(`--onDelete `, `Constraints option`) + .option(`--two-way-key `, `Two Way Attribute Key.`) + .option(`--on-delete `, `Constraints option`) .action(actionRunner(databasesCreateRelationshipAttribute)) databases - .command(`createStringAttribute`) + .command(`create-string-attribute`) .description(`Create a string attribute. `) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--size `, `Attribute size for text attributes, in number of characters.`, parseInteger) .requiredOption(`--required `, `Is attribute required?`, parseBool) @@ -2394,20 +2394,20 @@ databases .action(actionRunner(databasesCreateStringAttribute)) databases - .command(`updateStringAttribute`) + .command(`update-string-attribute`) .description(`Update a string attribute. Changing the 'default' value will not update already existing documents. `) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .option(`--xdefault `, `Default value for attribute when not provided. Cannot be set when attribute is required.`) .action(actionRunner(databasesUpdateStringAttribute)) databases - .command(`createUrlAttribute`) + .command(`create-url-attribute`) .description(`Create a URL attribute. `) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .option(`--xdefault `, `Default value for attribute when not provided. Cannot be set when attribute is required.`) @@ -2415,110 +2415,110 @@ databases .action(actionRunner(databasesCreateUrlAttribute)) databases - .command(`updateUrlAttribute`) + .command(`update-url-attribute`) .description(`Update an url attribute. Changing the 'default' value will not update already existing documents. `) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .option(`--xdefault `, `Default value for attribute when not provided. Cannot be set when attribute is required.`) .action(actionRunner(databasesUpdateUrlAttribute)) databases - .command(`getAttribute`) + .command(`get-attribute`) .description(`Get attribute by ID.`) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .action(actionRunner(databasesGetAttribute)) databases - .command(`deleteAttribute`) + .command(`delete-attribute`) .description(`Deletes an attribute.`) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .action(actionRunner(databasesDeleteAttribute)) databases - .command(`updateRelationshipAttribute`) + .command(`update-relationship-attribute`) .description(`Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). `) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) - .option(`--onDelete `, `Constraints option`) + .option(`--on-delete `, `Constraints option`) .action(actionRunner(databasesUpdateRelationshipAttribute)) databases - .command(`listDocuments`) + .command(`list-documents`) .description(`Get a list of all the user's documents in a given collection. You can use the query params to filter your results.`) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .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.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(databasesListDocuments)) databases - .command(`createDocument`) + .command(`create-document`) .description(`Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.`) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.`) - .requiredOption(`--documentId `, `Document 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.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.`) + .requiredOption(`--document-id `, `Document 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.`) .requiredOption(`--data `, `Document data as JSON object.`) .option(`--permissions [permissions...]`, `An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).`) .action(actionRunner(databasesCreateDocument)) databases - .command(`getDocument`) + .command(`get-document`) .description(`Get a document by its unique ID. This endpoint response returns a JSON object with the document data.`) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) - .requiredOption(`--documentId `, `Document ID.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--document-id `, `Document ID.`) .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.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(databasesGetDocument)) databases - .command(`updateDocument`) + .command(`update-document`) .description(`Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.`) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID.`) - .requiredOption(`--documentId `, `Document ID.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .requiredOption(`--document-id `, `Document ID.`) .option(`--data `, `Document data as JSON object. Include only attribute and value pairs to be updated.`) .option(`--permissions [permissions...]`, `An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`) .action(actionRunner(databasesUpdateDocument)) databases - .command(`deleteDocument`) + .command(`delete-document`) .description(`Delete a document by its unique ID.`) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) - .requiredOption(`--documentId `, `Document ID.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--document-id `, `Document ID.`) .action(actionRunner(databasesDeleteDocument)) databases - .command(`listDocumentLogs`) + .command(`list-document-logs`) .description(`Get the document activity logs list by its unique ID.`) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID.`) - .requiredOption(`--documentId `, `Document ID.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) + .requiredOption(`--document-id `, `Document ID.`) .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). Only supported methods are limit and offset`) .action(actionRunner(databasesListDocumentLogs)) databases - .command(`listIndexes`) + .command(`list-indexes`) .description(`List indexes in the collection.`) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error`) .option(`--console`, `Get the resource console url`) .action(actionRunner(databasesListIndexes)) databases - .command(`createIndex`) + .command(`create-index`) .description(`Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. Attributes can be 'key', 'fulltext', and 'unique'.`) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Index Key.`) .requiredOption(`--type `, `Index type.`) .requiredOption(`--attributes [attributes...]`, `Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.`) @@ -2526,48 +2526,48 @@ databases .action(actionRunner(databasesCreateIndex)) databases - .command(`getIndex`) + .command(`get-index`) .description(`Get index by ID.`) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Index Key.`) .action(actionRunner(databasesGetIndex)) databases - .command(`deleteIndex`) + .command(`delete-index`) .description(`Delete an index.`) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Index Key.`) .action(actionRunner(databasesDeleteIndex)) databases - .command(`listCollectionLogs`) + .command(`list-collection-logs`) .description(`Get the collection activity logs list by its unique ID.`) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) .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). Only supported methods are limit and offset`) .action(actionRunner(databasesListCollectionLogs)) databases - .command(`getCollectionUsage`) + .command(`get-collection-usage`) .description(``) - .requiredOption(`--databaseId `, `Database ID.`) - .requiredOption(`--collectionId `, `Collection ID.`) + .requiredOption(`--database-id `, `Database ID.`) + .requiredOption(`--collection-id `, `Collection ID.`) .option(`--range `, `Date range.`) .action(actionRunner(databasesGetCollectionUsage)) databases - .command(`listLogs`) + .command(`list-logs`) .description(`Get the database activity logs list by its unique ID.`) - .requiredOption(`--databaseId `, `Database ID.`) + .requiredOption(`--database-id `, `Database ID.`) .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). Only supported methods are limit and offset`) .action(actionRunner(databasesListLogs)) databases - .command(`getDatabaseUsage`) + .command(`get-database-usage`) .description(``) - .requiredOption(`--databaseId `, `Database ID.`) + .requiredOption(`--database-id `, `Database ID.`) .option(`--range `, `'Date range.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(databasesGetDatabaseUsage)) diff --git a/lib/commands/functions.js b/lib/commands/functions.js index f169303..7f82da9 100644 --- a/lib/commands/functions.js +++ b/lib/commands/functions.js @@ -1258,7 +1258,7 @@ functions functions .command(`create`) .description(`Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API.`) - .requiredOption(`--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.`) + .requiredOption(`--function-id `, `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.`) .requiredOption(`--name `, `Function name. Max length: 128 chars.`) .requiredOption(`--runtime `, `Execution runtime.`) .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.`) @@ -1270,24 +1270,24 @@ functions .option(`--entrypoint `, `Entrypoint File. This path is relative to the "providerRootDirectory".`) .option(`--commands `, `Build Commands.`) .option(`--scopes [scopes...]`, `List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed.`) - .option(`--installationId `, `Appwrite Installation ID for VCS (Version Control System) deployment.`) - .option(`--providerRepositoryId `, `Repository ID of the repo linked to the function.`) - .option(`--providerBranch `, `Production branch for the repo linked to the function.`) - .option(`--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) - .option(`--providerRootDirectory `, `Path to function code in the linked repo.`) - .option(`--templateRepository `, `Repository name of the template.`) - .option(`--templateOwner `, `The name of the owner of the template.`) - .option(`--templateRootDirectory `, `Path to function code in the template repo.`) - .option(`--templateBranch `, `Production branch for the repo linked to the function template.`) + .option(`--installation-id `, `Appwrite Installation ID for VCS (Version Control System) deployment.`) + .option(`--provider-repository-id `, `Repository ID of the repo linked to the function.`) + .option(`--provider-branch `, `Production branch for the repo linked to the function.`) + .option(`--provider-silent-mode `, `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) + .option(`--provider-root-directory `, `Path to function code in the linked repo.`) + .option(`--template-repository `, `Repository name of the template.`) + .option(`--template-owner `, `The name of the owner of the template.`) + .option(`--template-root-directory `, `Path to function code in the template repo.`) + .option(`--template-branch `, `Production branch for the repo linked to the function template.`) .action(actionRunner(functionsCreate)) functions - .command(`listRuntimes`) + .command(`list-runtimes`) .description(`Get a list of all runtimes that are currently active on your instance.`) .action(actionRunner(functionsListRuntimes)) functions - .command(`getUsage`) + .command(`get-usage`) .description(``) .option(`--range `, `Date range.`) .action(actionRunner(functionsGetUsage)) @@ -1295,14 +1295,14 @@ functions functions .command(`get`) .description(`Get a function by its unique ID.`) - .requiredOption(`--functionId `, `Function ID.`) + .requiredOption(`--function-id `, `Function ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(functionsGet)) functions .command(`update`) .description(`Update function by its unique ID.`) - .requiredOption(`--functionId `, `Function ID.`) + .requiredOption(`--function-id `, `Function ID.`) .requiredOption(`--name `, `Function name. Max length: 128 chars.`) .option(`--runtime `, `Execution runtime.`) .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.`) @@ -1314,32 +1314,32 @@ functions .option(`--entrypoint `, `Entrypoint File. This path is relative to the "providerRootDirectory".`) .option(`--commands `, `Build Commands.`) .option(`--scopes [scopes...]`, `List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed.`) - .option(`--installationId `, `Appwrite Installation ID for VCS (Version Controle System) deployment.`) - .option(`--providerRepositoryId `, `Repository ID of the repo linked to the function`) - .option(`--providerBranch `, `Production branch for the repo linked to the function`) - .option(`--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) - .option(`--providerRootDirectory `, `Path to function code in the linked repo.`) + .option(`--installation-id `, `Appwrite Installation ID for VCS (Version Controle System) deployment.`) + .option(`--provider-repository-id `, `Repository ID of the repo linked to the function`) + .option(`--provider-branch `, `Production branch for the repo linked to the function`) + .option(`--provider-silent-mode `, `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) + .option(`--provider-root-directory `, `Path to function code in the linked repo.`) .action(actionRunner(functionsUpdate)) functions .command(`delete`) .description(`Delete a function by its unique ID.`) - .requiredOption(`--functionId `, `Function ID.`) + .requiredOption(`--function-id `, `Function ID.`) .action(actionRunner(functionsDelete)) functions - .command(`listDeployments`) + .command(`list-deployments`) .description(`Get a list of all the project's code deployments. You can use the query params to filter your results.`) - .requiredOption(`--functionId `, `Function ID.`) + .requiredOption(`--function-id `, `Function ID.`) .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`) .option(`--search `, `Search term to filter your list results. Max length: 256 chars.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(functionsListDeployments)) functions - .command(`createDeployment`) + .command(`create-deployment`) .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](https://appwrite.io/docs/functions). Use the "command" param to set the entrypoint used to execute your code.`) - .requiredOption(`--functionId `, `Function ID.`) + .requiredOption(`--function-id `, `Function ID.`) .requiredOption(`--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.`) .requiredOption(`--activate `, `Automatically activate the deployment when it is finished building.`, parseBool) .option(`--entrypoint `, `Entrypoint File.`) @@ -1347,129 +1347,129 @@ functions .action(actionRunner(functionsCreateDeployment)) functions - .command(`getDeployment`) + .command(`get-deployment`) .description(`Get a code deployment by its unique ID.`) - .requiredOption(`--functionId `, `Function ID.`) - .requiredOption(`--deploymentId `, `Deployment ID.`) + .requiredOption(`--function-id `, `Function ID.`) + .requiredOption(`--deployment-id `, `Deployment ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(functionsGetDeployment)) functions - .command(`updateDeployment`) + .command(`update-deployment`) .description(`Update the function code deployment ID using the unique function ID. Use this endpoint to switch the code deployment that should be executed by the execution endpoint.`) - .requiredOption(`--functionId `, `Function ID.`) - .requiredOption(`--deploymentId `, `Deployment ID.`) + .requiredOption(`--function-id `, `Function ID.`) + .requiredOption(`--deployment-id `, `Deployment ID.`) .action(actionRunner(functionsUpdateDeployment)) functions - .command(`deleteDeployment`) + .command(`delete-deployment`) .description(`Delete a code deployment by its unique ID.`) - .requiredOption(`--functionId `, `Function ID.`) - .requiredOption(`--deploymentId `, `Deployment ID.`) + .requiredOption(`--function-id `, `Function ID.`) + .requiredOption(`--deployment-id `, `Deployment ID.`) .action(actionRunner(functionsDeleteDeployment)) functions - .command(`createBuild`) + .command(`create-build`) .description(``) - .requiredOption(`--functionId `, `Function ID.`) - .requiredOption(`--deploymentId `, `Deployment ID.`) - .option(`--buildId `, `Build unique ID.`) + .requiredOption(`--function-id `, `Function ID.`) + .requiredOption(`--deployment-id `, `Deployment ID.`) + .option(`--build-id `, `Build unique ID.`) .action(actionRunner(functionsCreateBuild)) functions - .command(`updateDeploymentBuild`) + .command(`update-deployment-build`) .description(``) - .requiredOption(`--functionId `, `Function ID.`) - .requiredOption(`--deploymentId `, `Deployment ID.`) + .requiredOption(`--function-id `, `Function ID.`) + .requiredOption(`--deployment-id `, `Deployment ID.`) .action(actionRunner(functionsUpdateDeploymentBuild)) functions - .command(`downloadDeployment`) + .command(`download-deployment`) .description(`Get a Deployment's contents by its unique ID. This endpoint supports range requests for partial or streaming file download.`) - .requiredOption(`--functionId `, `Function ID.`) - .requiredOption(`--deploymentId `, `Deployment ID.`) + .requiredOption(`--function-id `, `Function ID.`) + .requiredOption(`--deployment-id `, `Deployment ID.`) .requiredOption(`--destination `, `output file path.`) .action(actionRunner(functionsDownloadDeployment)) functions - .command(`listExecutions`) + .command(`list-executions`) .description(`Get a list of all the current user function execution logs. You can use the query params to filter your results.`) - .requiredOption(`--functionId `, `Function ID.`) + .requiredOption(`--function-id `, `Function ID.`) .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, requestMethod, requestPath, deploymentId`) .option(`--search `, `Search term to filter your list results. Max length: 256 chars.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(functionsListExecutions)) functions - .command(`createExecution`) + .command(`create-execution`) .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.`) - .requiredOption(`--functionId `, `Function ID.`) + .requiredOption(`--function-id `, `Function ID.`) .option(`--body `, `HTTP body of execution. Default value is empty string.`) .option(`--async `, `Execute code in the background. Default value is false.`, parseBool) .option(`--xpath `, `HTTP path of execution. Path can include query params. Default value is /`) .option(`--method `, `HTTP method of execution. Default value is GET.`) .option(`--headers `, `HTTP headers of execution. Defaults to empty.`) - .option(`--scheduledAt `, `Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`) + .option(`--scheduled-at `, `Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`) .action(actionRunner(functionsCreateExecution)) functions - .command(`getExecution`) + .command(`get-execution`) .description(`Get a function execution log by its unique ID.`) - .requiredOption(`--functionId `, `Function ID.`) - .requiredOption(`--executionId `, `Execution ID.`) + .requiredOption(`--function-id `, `Function ID.`) + .requiredOption(`--execution-id `, `Execution ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(functionsGetExecution)) functions - .command(`deleteExecution`) + .command(`delete-execution`) .description(`Delete a function execution by its unique ID. `) - .requiredOption(`--functionId `, `Function ID.`) - .requiredOption(`--executionId `, `Execution ID.`) + .requiredOption(`--function-id `, `Function ID.`) + .requiredOption(`--execution-id `, `Execution ID.`) .action(actionRunner(functionsDeleteExecution)) functions - .command(`getFunctionUsage`) + .command(`get-function-usage`) .description(``) - .requiredOption(`--functionId `, `Function ID.`) + .requiredOption(`--function-id `, `Function ID.`) .option(`--range `, `Date range.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(functionsGetFunctionUsage)) functions - .command(`listVariables`) + .command(`list-variables`) .description(`Get a list of all variables of a specific function.`) - .requiredOption(`--functionId `, `Function unique ID.`) + .requiredOption(`--function-id `, `Function unique ID.`) .action(actionRunner(functionsListVariables)) functions - .command(`createVariable`) + .command(`create-variable`) .description(`Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables.`) - .requiredOption(`--functionId `, `Function unique ID.`) + .requiredOption(`--function-id `, `Function unique ID.`) .requiredOption(`--key `, `Variable key. Max length: 255 chars.`) .requiredOption(`--value `, `Variable value. Max length: 8192 chars.`) .action(actionRunner(functionsCreateVariable)) functions - .command(`getVariable`) + .command(`get-variable`) .description(`Get a variable by its unique ID.`) - .requiredOption(`--functionId `, `Function unique ID.`) - .requiredOption(`--variableId `, `Variable unique ID.`) + .requiredOption(`--function-id `, `Function unique ID.`) + .requiredOption(`--variable-id `, `Variable unique ID.`) .action(actionRunner(functionsGetVariable)) functions - .command(`updateVariable`) + .command(`update-variable`) .description(`Update variable by its unique ID.`) - .requiredOption(`--functionId `, `Function unique ID.`) - .requiredOption(`--variableId `, `Variable unique ID.`) + .requiredOption(`--function-id `, `Function unique ID.`) + .requiredOption(`--variable-id `, `Variable unique ID.`) .requiredOption(`--key `, `Variable key. Max length: 255 chars.`) .option(`--value `, `Variable value. Max length: 8192 chars.`) .action(actionRunner(functionsUpdateVariable)) functions - .command(`deleteVariable`) + .command(`delete-variable`) .description(`Delete a variable by its unique ID.`) - .requiredOption(`--functionId `, `Function unique ID.`) - .requiredOption(`--variableId `, `Variable unique ID.`) + .requiredOption(`--function-id `, `Function unique ID.`) + .requiredOption(`--variable-id `, `Variable unique ID.`) .action(actionRunner(functionsDeleteVariable)) module.exports = { diff --git a/lib/commands/generic.js b/lib/commands/generic.js index bc913fe..691ff85 100644 --- a/lib/commands/generic.js +++ b/lib/commands/generic.js @@ -187,7 +187,8 @@ const logout = new Command("logout") const sessions = globalConfig.getSessions(); const current = globalConfig.getCurrentSession(); - if (current === '') { + if (current === '' || !sessions.length) { + log('No active sessions found.'); return; } if (sessions.length === 1) { @@ -223,9 +224,9 @@ const client = new Command("client") .configureHelp({ helpWidth: process.stdout.columns || 80 }) - .option("-ss, --selfSigned ", "Configure the CLI to use a self-signed certificate ( true or false )", parseBool) + .option("-ss, --self-signed ", "Configure the CLI to use a self-signed certificate ( true or false )", parseBool) .option("-e, --endpoint ", "Set your Appwrite server endpoint") - .option("-p, --projectId ", "Set your Appwrite project ID") + .option("-p, --project-id ", "Set your Appwrite project ID") .option("-k, --key ", "Set your Appwrite server's API key") .option("-d, --debug", "Print CLI debug information") .option("-r, --reset", "Reset the CLI configuration") diff --git a/lib/commands/health.js b/lib/commands/health.js index 9f028ee..70a291b 100644 --- a/lib/commands/health.js +++ b/lib/commands/health.js @@ -819,128 +819,128 @@ health .action(actionRunner(healthGet)) health - .command(`getAntivirus`) + .command(`get-antivirus`) .description(`Check the Appwrite Antivirus server is up and connection is successful.`) .action(actionRunner(healthGetAntivirus)) health - .command(`getCache`) + .command(`get-cache`) .description(`Check the Appwrite in-memory cache servers are up and connection is successful.`) .action(actionRunner(healthGetCache)) health - .command(`getCertificate`) + .command(`get-certificate`) .description(`Get the SSL certificate for a domain`) .option(`--domain `, `string`) .action(actionRunner(healthGetCertificate)) health - .command(`getDB`) + .command(`get-db`) .description(`Check the Appwrite database servers are up and connection is successful.`) .action(actionRunner(healthGetDB)) health - .command(`getPubSub`) + .command(`get-pub-sub`) .description(`Check the Appwrite pub-sub servers are up and connection is successful.`) .action(actionRunner(healthGetPubSub)) health - .command(`getQueue`) + .command(`get-queue`) .description(`Check the Appwrite queue messaging servers are up and connection is successful.`) .action(actionRunner(healthGetQueue)) health - .command(`getQueueBuilds`) + .command(`get-queue-builds`) .description(`Get the number of builds that are waiting to be processed in the Appwrite internal queue server.`) .option(`--threshold `, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger) .action(actionRunner(healthGetQueueBuilds)) health - .command(`getQueueCertificates`) + .command(`get-queue-certificates`) .description(`Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server.`) .option(`--threshold `, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger) .action(actionRunner(healthGetQueueCertificates)) health - .command(`getQueueDatabases`) + .command(`get-queue-databases`) .description(`Get the number of database changes that are waiting to be processed in the Appwrite internal queue server.`) .option(`--name `, `Queue name for which to check the queue size`) .option(`--threshold `, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger) .action(actionRunner(healthGetQueueDatabases)) health - .command(`getQueueDeletes`) + .command(`get-queue-deletes`) .description(`Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server.`) .option(`--threshold `, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger) .action(actionRunner(healthGetQueueDeletes)) health - .command(`getFailedJobs`) + .command(`get-failed-jobs`) .description(`Returns the amount of failed jobs in a given queue. `) .requiredOption(`--name `, `The name of the queue`) .option(`--threshold `, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger) .action(actionRunner(healthGetFailedJobs)) health - .command(`getQueueFunctions`) + .command(`get-queue-functions`) .description(`Get the number of function executions that are waiting to be processed in the Appwrite internal queue server.`) .option(`--threshold `, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger) .action(actionRunner(healthGetQueueFunctions)) health - .command(`getQueueLogs`) + .command(`get-queue-logs`) .description(`Get the number of logs that are waiting to be processed in the Appwrite internal queue server.`) .option(`--threshold `, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger) .action(actionRunner(healthGetQueueLogs)) health - .command(`getQueueMails`) + .command(`get-queue-mails`) .description(`Get the number of mails that are waiting to be processed in the Appwrite internal queue server.`) .option(`--threshold `, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger) .action(actionRunner(healthGetQueueMails)) health - .command(`getQueueMessaging`) + .command(`get-queue-messaging`) .description(`Get the number of messages that are waiting to be processed in the Appwrite internal queue server.`) .option(`--threshold `, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger) .action(actionRunner(healthGetQueueMessaging)) health - .command(`getQueueMigrations`) + .command(`get-queue-migrations`) .description(`Get the number of migrations that are waiting to be processed in the Appwrite internal queue server.`) .option(`--threshold `, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger) .action(actionRunner(healthGetQueueMigrations)) health - .command(`getQueueUsage`) + .command(`get-queue-usage`) .description(`Get the number of metrics that are waiting to be processed in the Appwrite internal queue server.`) .option(`--threshold `, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger) .action(actionRunner(healthGetQueueUsage)) health - .command(`getQueueUsageDump`) + .command(`get-queue-usage-dump`) .description(`Get the number of projects containing metrics that are waiting to be processed in the Appwrite internal queue server.`) .option(`--threshold `, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger) .action(actionRunner(healthGetQueueUsageDump)) health - .command(`getQueueWebhooks`) + .command(`get-queue-webhooks`) .description(`Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.`) .option(`--threshold `, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger) .action(actionRunner(healthGetQueueWebhooks)) health - .command(`getStorage`) + .command(`get-storage`) .description(`Check the Appwrite storage device is up and connection is successful.`) .action(actionRunner(healthGetStorage)) health - .command(`getStorageLocal`) + .command(`get-storage-local`) .description(`Check the Appwrite local storage device is up and connection is successful.`) .action(actionRunner(healthGetStorageLocal)) health - .command(`getTime`) + .command(`get-time`) .description(`Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP.`) .action(actionRunner(healthGetTime)) diff --git a/lib/commands/init.js b/lib/commands/init.js index 9cbe03b..69e34c1 100644 --- a/lib/commands/init.js +++ b/lib/commands/init.js @@ -110,6 +110,7 @@ const initProject = async ({ organizationId, projectId, projectName } = {}) => { answers = await inquirer.prompt(questionsInitProjectAutopull); if(answers.autopull) { cliConfig.all = true; + cliConfig.force = true; await pullResources(); } else { log("You can run 'appwrite pull all' to synchronize all of your existing resources."); @@ -333,9 +334,9 @@ const init = new Command("init") init .command("project") .description("Init a new Appwrite project") - .option("--organizationId ", "Appwrite organization ID") - .option("--projectId ", "Appwrite project ID") - .option("--projectName ", "Appwrite project ID") + .option("--organization-id ", "Appwrite organization ID") + .option("--project-id ", "Appwrite project ID") + .option("--project-name ", "Appwrite project ID") .action(actionRunner(initProject)); init diff --git a/lib/commands/locale.js b/lib/commands/locale.js index ef02bf9..1382b96 100644 --- a/lib/commands/locale.js +++ b/lib/commands/locale.js @@ -293,37 +293,37 @@ locale .action(actionRunner(localeGet)) locale - .command(`listCodes`) + .command(`list-codes`) .description(`List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).`) .action(actionRunner(localeListCodes)) locale - .command(`listContinents`) + .command(`list-continents`) .description(`List of all continents. You can use the locale header to get the data in a supported language.`) .action(actionRunner(localeListContinents)) locale - .command(`listCountries`) + .command(`list-countries`) .description(`List of all countries. You can use the locale header to get the data in a supported language.`) .action(actionRunner(localeListCountries)) locale - .command(`listCountriesEU`) + .command(`list-countries-eu`) .description(`List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.`) .action(actionRunner(localeListCountriesEU)) locale - .command(`listCountriesPhones`) + .command(`list-countries-phones`) .description(`List of all countries phone codes. You can use the locale header to get the data in a supported language.`) .action(actionRunner(localeListCountriesPhones)) locale - .command(`listCurrencies`) + .command(`list-currencies`) .description(`List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.`) .action(actionRunner(localeListCurrencies)) locale - .command(`listLanguages`) + .command(`list-languages`) .description(`List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.`) .action(actionRunner(localeListLanguages)) diff --git a/lib/commands/messaging.js b/lib/commands/messaging.js index 4093463..b775315 100644 --- a/lib/commands/messaging.js +++ b/lib/commands/messaging.js @@ -2455,7 +2455,7 @@ const messagingDeleteSubscriber = async ({topicId,subscriberId,parseOutput = tru } messaging - .command(`listMessages`) + .command(`list-messages`) .description(`Get a list of all messages from the current Appwrite project.`) .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: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType`) .option(`--search `, `Search term to filter your list results. Max length: 256 chars.`) @@ -2463,9 +2463,9 @@ messaging .action(actionRunner(messagingListMessages)) messaging - .command(`createEmail`) + .command(`create-email`) .description(`Create a new email message.`) - .requiredOption(`--messageId `, `Message 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.`) + .requiredOption(`--message-id `, `Message 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.`) .requiredOption(`--subject `, `Email Subject.`) .requiredOption(`--content `, `Email Content.`) .option(`--topics [topics...]`, `List of Topic IDs.`) @@ -2476,13 +2476,13 @@ messaging .option(`--attachments [attachments...]`, `Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as :.`) .option(`--draft `, `Is message a draft`, parseBool) .option(`--html `, `Is content of type HTML`, parseBool) - .option(`--scheduledAt `, `Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`) + .option(`--scheduled-at `, `Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`) .action(actionRunner(messagingCreateEmail)) messaging - .command(`updateEmail`) + .command(`update-email`) .description(`Update an email message by its unique ID. `) - .requiredOption(`--messageId `, `Message ID.`) + .requiredOption(`--message-id `, `Message ID.`) .option(`--topics [topics...]`, `List of Topic IDs.`) .option(`--users [users...]`, `List of User IDs.`) .option(`--targets [targets...]`, `List of Targets IDs.`) @@ -2492,14 +2492,14 @@ messaging .option(`--html `, `Is content of type HTML`, parseBool) .option(`--cc [cc...]`, `Array of target IDs to be added as CC.`) .option(`--bcc [bcc...]`, `Array of target IDs to be added as BCC.`) - .option(`--scheduledAt `, `Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`) + .option(`--scheduled-at `, `Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`) .option(`--attachments [attachments...]`, `Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as :.`) .action(actionRunner(messagingUpdateEmail)) messaging - .command(`createPush`) + .command(`create-push`) .description(`Create a new push notification.`) - .requiredOption(`--messageId `, `Message 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.`) + .requiredOption(`--message-id `, `Message 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.`) .requiredOption(`--title `, `Title for push notification.`) .requiredOption(`--body <body>`, `Body for push notification.`) .option(`--topics [topics...]`, `List of Topic IDs.`) @@ -2514,13 +2514,13 @@ messaging .option(`--tag <tag>`, `Tag for push notification. Available only for Android Platform.`) .option(`--badge <badge>`, `Badge for push notification. Available only for IOS Platform.`) .option(`--draft <draft>`, `Is message a draft`, parseBool) - .option(`--scheduledAt <scheduledAt>`, `Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`) + .option(`--scheduled-at <scheduled-at>`, `Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`) .action(actionRunner(messagingCreatePush)) messaging - .command(`updatePush`) + .command(`update-push`) .description(`Update a push notification by its unique ID. `) - .requiredOption(`--messageId <messageId>`, `Message ID.`) + .requiredOption(`--message-id <message-id>`, `Message ID.`) .option(`--topics [topics...]`, `List of Topic IDs.`) .option(`--users [users...]`, `List of User IDs.`) .option(`--targets [targets...]`, `List of Targets IDs.`) @@ -2535,63 +2535,63 @@ messaging .option(`--tag <tag>`, `Tag for push notification. Available only for Android platforms.`) .option(`--badge <badge>`, `Badge for push notification. Available only for iOS platforms.`, parseInteger) .option(`--draft <draft>`, `Is message a draft`, parseBool) - .option(`--scheduledAt <scheduledAt>`, `Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`) + .option(`--scheduled-at <scheduled-at>`, `Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`) .action(actionRunner(messagingUpdatePush)) messaging - .command(`createSms`) + .command(`create-sms`) .description(`Create a new SMS message.`) - .requiredOption(`--messageId <messageId>`, `Message 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.`) + .requiredOption(`--message-id <message-id>`, `Message 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.`) .requiredOption(`--content <content>`, `SMS Content.`) .option(`--topics [topics...]`, `List of Topic IDs.`) .option(`--users [users...]`, `List of User IDs.`) .option(`--targets [targets...]`, `List of Targets IDs.`) .option(`--draft <draft>`, `Is message a draft`, parseBool) - .option(`--scheduledAt <scheduledAt>`, `Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`) + .option(`--scheduled-at <scheduled-at>`, `Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`) .action(actionRunner(messagingCreateSms)) messaging - .command(`updateSms`) + .command(`update-sms`) .description(`Update an email message by its unique ID. `) - .requiredOption(`--messageId <messageId>`, `Message ID.`) + .requiredOption(`--message-id <message-id>`, `Message ID.`) .option(`--topics [topics...]`, `List of Topic IDs.`) .option(`--users [users...]`, `List of User IDs.`) .option(`--targets [targets...]`, `List of Targets IDs.`) .option(`--content <content>`, `Email Content.`) .option(`--draft <draft>`, `Is message a draft`, parseBool) - .option(`--scheduledAt <scheduledAt>`, `Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`) + .option(`--scheduled-at <scheduled-at>`, `Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`) .action(actionRunner(messagingUpdateSms)) messaging - .command(`getMessage`) + .command(`get-message`) .description(`Get a message by its unique ID. `) - .requiredOption(`--messageId <messageId>`, `Message ID.`) + .requiredOption(`--message-id <message-id>`, `Message ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(messagingGetMessage)) messaging .command(`delete`) .description(`Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message.`) - .requiredOption(`--messageId <messageId>`, `Message ID.`) + .requiredOption(`--message-id <message-id>`, `Message ID.`) .action(actionRunner(messagingDelete)) messaging - .command(`listMessageLogs`) + .command(`list-message-logs`) .description(`Get the message activity logs listed by its unique ID.`) - .requiredOption(`--messageId <messageId>`, `Message ID.`) + .requiredOption(`--message-id <message-id>`, `Message ID.`) .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). Only supported methods are limit and offset`) .option(`--console`, `Get the resource console url`) .action(actionRunner(messagingListMessageLogs)) messaging - .command(`listTargets`) + .command(`list-targets`) .description(`Get a list of the targets associated with a message.`) - .requiredOption(`--messageId <messageId>`, `Message ID.`) + .requiredOption(`--message-id <message-id>`, `Message ID.`) .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: userId, providerId, identifier, providerType`) .action(actionRunner(messagingListTargets)) messaging - .command(`listProviders`) + .command(`list-providers`) .description(`Get a list of all providers from the current Appwrite project.`) .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, provider, type, enabled`) .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`) @@ -2599,282 +2599,282 @@ messaging .action(actionRunner(messagingListProviders)) messaging - .command(`createApnsProvider`) + .command(`create-apns-provider`) .description(`Create a new Apple Push Notification service provider.`) - .requiredOption(`--providerId <providerId>`, `Provider 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.`) + .requiredOption(`--provider-id <provider-id>`, `Provider 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.`) .requiredOption(`--name <name>`, `Provider name.`) - .option(`--authKey <authKey>`, `APNS authentication key.`) - .option(`--authKeyId <authKeyId>`, `APNS authentication key ID.`) - .option(`--teamId <teamId>`, `APNS team ID.`) - .option(`--bundleId <bundleId>`, `APNS bundle ID.`) + .option(`--auth-key <auth-key>`, `APNS authentication key.`) + .option(`--auth-key-id <auth-key-id>`, `APNS authentication key ID.`) + .option(`--team-id <team-id>`, `APNS team ID.`) + .option(`--bundle-id <bundle-id>`, `APNS bundle ID.`) .option(`--sandbox <sandbox>`, `Use APNS sandbox environment.`, parseBool) .option(`--enabled <enabled>`, `Set as enabled.`, parseBool) .action(actionRunner(messagingCreateApnsProvider)) messaging - .command(`updateApnsProvider`) + .command(`update-apns-provider`) .description(`Update a Apple Push Notification service provider by its unique ID.`) - .requiredOption(`--providerId <providerId>`, `Provider ID.`) + .requiredOption(`--provider-id <provider-id>`, `Provider ID.`) .option(`--name <name>`, `Provider name.`) .option(`--enabled <enabled>`, `Set as enabled.`, parseBool) - .option(`--authKey <authKey>`, `APNS authentication key.`) - .option(`--authKeyId <authKeyId>`, `APNS authentication key ID.`) - .option(`--teamId <teamId>`, `APNS team ID.`) - .option(`--bundleId <bundleId>`, `APNS bundle ID.`) + .option(`--auth-key <auth-key>`, `APNS authentication key.`) + .option(`--auth-key-id <auth-key-id>`, `APNS authentication key ID.`) + .option(`--team-id <team-id>`, `APNS team ID.`) + .option(`--bundle-id <bundle-id>`, `APNS bundle ID.`) .option(`--sandbox <sandbox>`, `Use APNS sandbox environment.`, parseBool) .action(actionRunner(messagingUpdateApnsProvider)) messaging - .command(`createFcmProvider`) + .command(`create-fcm-provider`) .description(`Create a new Firebase Cloud Messaging provider.`) - .requiredOption(`--providerId <providerId>`, `Provider 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.`) + .requiredOption(`--provider-id <provider-id>`, `Provider 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.`) .requiredOption(`--name <name>`, `Provider name.`) - .option(`--serviceAccountJSON <serviceAccountJSON>`, `FCM service account JSON.`) + .option(`--service-account-json <service-account-json>`, `FCM service account JSON.`) .option(`--enabled <enabled>`, `Set as enabled.`, parseBool) .action(actionRunner(messagingCreateFcmProvider)) messaging - .command(`updateFcmProvider`) + .command(`update-fcm-provider`) .description(`Update a Firebase Cloud Messaging provider by its unique ID.`) - .requiredOption(`--providerId <providerId>`, `Provider ID.`) + .requiredOption(`--provider-id <provider-id>`, `Provider ID.`) .option(`--name <name>`, `Provider name.`) .option(`--enabled <enabled>`, `Set as enabled.`, parseBool) - .option(`--serviceAccountJSON <serviceAccountJSON>`, `FCM service account JSON.`) + .option(`--service-account-json <service-account-json>`, `FCM service account JSON.`) .action(actionRunner(messagingUpdateFcmProvider)) messaging - .command(`createMailgunProvider`) + .command(`create-mailgun-provider`) .description(`Create a new Mailgun provider.`) - .requiredOption(`--providerId <providerId>`, `Provider 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.`) + .requiredOption(`--provider-id <provider-id>`, `Provider 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.`) .requiredOption(`--name <name>`, `Provider name.`) - .option(`--apiKey <apiKey>`, `Mailgun API Key.`) + .option(`--api-key <api-key>`, `Mailgun API Key.`) .option(`--domain <domain>`, `Mailgun Domain.`) - .option(`--isEuRegion <isEuRegion>`, `Set as EU region.`, parseBool) - .option(`--fromName <fromName>`, `Sender Name.`) - .option(`--fromEmail <fromEmail>`, `Sender email address.`) - .option(`--replyToName <replyToName>`, `Name set in the reply to field for the mail. Default value is sender name. Reply to name must have reply to email as well.`) - .option(`--replyToEmail <replyToEmail>`, `Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well.`) + .option(`--is-eu-region <is-eu-region>`, `Set as EU region.`, parseBool) + .option(`--from-name <from-name>`, `Sender Name.`) + .option(`--from-email <from-email>`, `Sender email address.`) + .option(`--reply-to-name <reply-to-name>`, `Name set in the reply to field for the mail. Default value is sender name. Reply to name must have reply to email as well.`) + .option(`--reply-to-email <reply-to-email>`, `Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well.`) .option(`--enabled <enabled>`, `Set as enabled.`, parseBool) .action(actionRunner(messagingCreateMailgunProvider)) messaging - .command(`updateMailgunProvider`) + .command(`update-mailgun-provider`) .description(`Update a Mailgun provider by its unique ID.`) - .requiredOption(`--providerId <providerId>`, `Provider ID.`) + .requiredOption(`--provider-id <provider-id>`, `Provider ID.`) .option(`--name <name>`, `Provider name.`) - .option(`--apiKey <apiKey>`, `Mailgun API Key.`) + .option(`--api-key <api-key>`, `Mailgun API Key.`) .option(`--domain <domain>`, `Mailgun Domain.`) - .option(`--isEuRegion <isEuRegion>`, `Set as EU region.`, parseBool) + .option(`--is-eu-region <is-eu-region>`, `Set as EU region.`, parseBool) .option(`--enabled <enabled>`, `Set as enabled.`, parseBool) - .option(`--fromName <fromName>`, `Sender Name.`) - .option(`--fromEmail <fromEmail>`, `Sender email address.`) - .option(`--replyToName <replyToName>`, `Name set in the reply to field for the mail. Default value is sender name.`) - .option(`--replyToEmail <replyToEmail>`, `Email set in the reply to field for the mail. Default value is sender email.`) + .option(`--from-name <from-name>`, `Sender Name.`) + .option(`--from-email <from-email>`, `Sender email address.`) + .option(`--reply-to-name <reply-to-name>`, `Name set in the reply to field for the mail. Default value is sender name.`) + .option(`--reply-to-email <reply-to-email>`, `Email set in the reply to field for the mail. Default value is sender email.`) .action(actionRunner(messagingUpdateMailgunProvider)) messaging - .command(`createMsg91Provider`) + .command(`create-msg-91-provider`) .description(`Create a new MSG91 provider.`) - .requiredOption(`--providerId <providerId>`, `Provider 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.`) + .requiredOption(`--provider-id <provider-id>`, `Provider 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.`) .requiredOption(`--name <name>`, `Provider name.`) - .option(`--templateId <templateId>`, `Msg91 template ID`) - .option(`--senderId <senderId>`, `Msg91 sender ID.`) - .option(`--authKey <authKey>`, `Msg91 auth key.`) + .option(`--template-id <template-id>`, `Msg91 template ID`) + .option(`--sender-id <sender-id>`, `Msg91 sender ID.`) + .option(`--auth-key <auth-key>`, `Msg91 auth key.`) .option(`--enabled <enabled>`, `Set as enabled.`, parseBool) .action(actionRunner(messagingCreateMsg91Provider)) messaging - .command(`updateMsg91Provider`) + .command(`update-msg-91-provider`) .description(`Update a MSG91 provider by its unique ID.`) - .requiredOption(`--providerId <providerId>`, `Provider ID.`) + .requiredOption(`--provider-id <provider-id>`, `Provider ID.`) .option(`--name <name>`, `Provider name.`) .option(`--enabled <enabled>`, `Set as enabled.`, parseBool) - .option(`--templateId <templateId>`, `Msg91 template ID.`) - .option(`--senderId <senderId>`, `Msg91 sender ID.`) - .option(`--authKey <authKey>`, `Msg91 auth key.`) + .option(`--template-id <template-id>`, `Msg91 template ID.`) + .option(`--sender-id <sender-id>`, `Msg91 sender ID.`) + .option(`--auth-key <auth-key>`, `Msg91 auth key.`) .action(actionRunner(messagingUpdateMsg91Provider)) messaging - .command(`createSendgridProvider`) + .command(`create-sendgrid-provider`) .description(`Create a new Sendgrid provider.`) - .requiredOption(`--providerId <providerId>`, `Provider 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.`) + .requiredOption(`--provider-id <provider-id>`, `Provider 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.`) .requiredOption(`--name <name>`, `Provider name.`) - .option(`--apiKey <apiKey>`, `Sendgrid API key.`) - .option(`--fromName <fromName>`, `Sender Name.`) - .option(`--fromEmail <fromEmail>`, `Sender email address.`) - .option(`--replyToName <replyToName>`, `Name set in the reply to field for the mail. Default value is sender name.`) - .option(`--replyToEmail <replyToEmail>`, `Email set in the reply to field for the mail. Default value is sender email.`) + .option(`--api-key <api-key>`, `Sendgrid API key.`) + .option(`--from-name <from-name>`, `Sender Name.`) + .option(`--from-email <from-email>`, `Sender email address.`) + .option(`--reply-to-name <reply-to-name>`, `Name set in the reply to field for the mail. Default value is sender name.`) + .option(`--reply-to-email <reply-to-email>`, `Email set in the reply to field for the mail. Default value is sender email.`) .option(`--enabled <enabled>`, `Set as enabled.`, parseBool) .action(actionRunner(messagingCreateSendgridProvider)) messaging - .command(`updateSendgridProvider`) + .command(`update-sendgrid-provider`) .description(`Update a Sendgrid provider by its unique ID.`) - .requiredOption(`--providerId <providerId>`, `Provider ID.`) + .requiredOption(`--provider-id <provider-id>`, `Provider ID.`) .option(`--name <name>`, `Provider name.`) .option(`--enabled <enabled>`, `Set as enabled.`, parseBool) - .option(`--apiKey <apiKey>`, `Sendgrid API key.`) - .option(`--fromName <fromName>`, `Sender Name.`) - .option(`--fromEmail <fromEmail>`, `Sender email address.`) - .option(`--replyToName <replyToName>`, `Name set in the Reply To field for the mail. Default value is Sender Name.`) - .option(`--replyToEmail <replyToEmail>`, `Email set in the Reply To field for the mail. Default value is Sender Email.`) + .option(`--api-key <api-key>`, `Sendgrid API key.`) + .option(`--from-name <from-name>`, `Sender Name.`) + .option(`--from-email <from-email>`, `Sender email address.`) + .option(`--reply-to-name <reply-to-name>`, `Name set in the Reply To field for the mail. Default value is Sender Name.`) + .option(`--reply-to-email <reply-to-email>`, `Email set in the Reply To field for the mail. Default value is Sender Email.`) .action(actionRunner(messagingUpdateSendgridProvider)) messaging - .command(`createSmtpProvider`) + .command(`create-smtp-provider`) .description(`Create a new SMTP provider.`) - .requiredOption(`--providerId <providerId>`, `Provider 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.`) + .requiredOption(`--provider-id <provider-id>`, `Provider 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.`) .requiredOption(`--name <name>`, `Provider name.`) .requiredOption(`--host <host>`, `SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as 'smtp1.example.com:25;smtp2.example.com'. You can also specify encryption type, for example: 'tls://smtp1.example.com:587;ssl://smtp2.example.com:465"'. Hosts will be tried in order.`) .option(`--port <port>`, `The default SMTP server port.`, parseInteger) .option(`--username <username>`, `Authentication username.`) .option(`--password <password>`, `Authentication password.`) .option(`--encryption <encryption>`, `Encryption type. Can be omitted, 'ssl', or 'tls'`) - .option(`--autoTLS <autoTLS>`, `Enable SMTP AutoTLS feature.`, parseBool) + .option(`--auto-tls <auto-tls>`, `Enable SMTP AutoTLS feature.`, parseBool) .option(`--mailer <mailer>`, `The value to use for the X-Mailer header.`) - .option(`--fromName <fromName>`, `Sender Name.`) - .option(`--fromEmail <fromEmail>`, `Sender email address.`) - .option(`--replyToName <replyToName>`, `Name set in the reply to field for the mail. Default value is sender name.`) - .option(`--replyToEmail <replyToEmail>`, `Email set in the reply to field for the mail. Default value is sender email.`) + .option(`--from-name <from-name>`, `Sender Name.`) + .option(`--from-email <from-email>`, `Sender email address.`) + .option(`--reply-to-name <reply-to-name>`, `Name set in the reply to field for the mail. Default value is sender name.`) + .option(`--reply-to-email <reply-to-email>`, `Email set in the reply to field for the mail. Default value is sender email.`) .option(`--enabled <enabled>`, `Set as enabled.`, parseBool) .action(actionRunner(messagingCreateSmtpProvider)) messaging - .command(`updateSmtpProvider`) + .command(`update-smtp-provider`) .description(`Update a SMTP provider by its unique ID.`) - .requiredOption(`--providerId <providerId>`, `Provider ID.`) + .requiredOption(`--provider-id <provider-id>`, `Provider ID.`) .option(`--name <name>`, `Provider name.`) .option(`--host <host>`, `SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as 'smtp1.example.com:25;smtp2.example.com'. You can also specify encryption type, for example: 'tls://smtp1.example.com:587;ssl://smtp2.example.com:465"'. Hosts will be tried in order.`) .option(`--port <port>`, `SMTP port.`, parseInteger) .option(`--username <username>`, `Authentication username.`) .option(`--password <password>`, `Authentication password.`) .option(`--encryption <encryption>`, `Encryption type. Can be 'ssl' or 'tls'`) - .option(`--autoTLS <autoTLS>`, `Enable SMTP AutoTLS feature.`, parseBool) + .option(`--auto-tls <auto-tls>`, `Enable SMTP AutoTLS feature.`, parseBool) .option(`--mailer <mailer>`, `The value to use for the X-Mailer header.`) - .option(`--fromName <fromName>`, `Sender Name.`) - .option(`--fromEmail <fromEmail>`, `Sender email address.`) - .option(`--replyToName <replyToName>`, `Name set in the Reply To field for the mail. Default value is Sender Name.`) - .option(`--replyToEmail <replyToEmail>`, `Email set in the Reply To field for the mail. Default value is Sender Email.`) + .option(`--from-name <from-name>`, `Sender Name.`) + .option(`--from-email <from-email>`, `Sender email address.`) + .option(`--reply-to-name <reply-to-name>`, `Name set in the Reply To field for the mail. Default value is Sender Name.`) + .option(`--reply-to-email <reply-to-email>`, `Email set in the Reply To field for the mail. Default value is Sender Email.`) .option(`--enabled <enabled>`, `Set as enabled.`, parseBool) .action(actionRunner(messagingUpdateSmtpProvider)) messaging - .command(`createTelesignProvider`) + .command(`create-telesign-provider`) .description(`Create a new Telesign provider.`) - .requiredOption(`--providerId <providerId>`, `Provider 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.`) + .requiredOption(`--provider-id <provider-id>`, `Provider 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.`) .requiredOption(`--name <name>`, `Provider name.`) .option(`--from <from>`, `Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.`) - .option(`--customerId <customerId>`, `Telesign customer ID.`) - .option(`--apiKey <apiKey>`, `Telesign API key.`) + .option(`--customer-id <customer-id>`, `Telesign customer ID.`) + .option(`--api-key <api-key>`, `Telesign API key.`) .option(`--enabled <enabled>`, `Set as enabled.`, parseBool) .action(actionRunner(messagingCreateTelesignProvider)) messaging - .command(`updateTelesignProvider`) + .command(`update-telesign-provider`) .description(`Update a Telesign provider by its unique ID.`) - .requiredOption(`--providerId <providerId>`, `Provider ID.`) + .requiredOption(`--provider-id <provider-id>`, `Provider ID.`) .option(`--name <name>`, `Provider name.`) .option(`--enabled <enabled>`, `Set as enabled.`, parseBool) - .option(`--customerId <customerId>`, `Telesign customer ID.`) - .option(`--apiKey <apiKey>`, `Telesign API key.`) + .option(`--customer-id <customer-id>`, `Telesign customer ID.`) + .option(`--api-key <api-key>`, `Telesign API key.`) .option(`--from <from>`, `Sender number.`) .action(actionRunner(messagingUpdateTelesignProvider)) messaging - .command(`createTextmagicProvider`) + .command(`create-textmagic-provider`) .description(`Create a new Textmagic provider.`) - .requiredOption(`--providerId <providerId>`, `Provider 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.`) + .requiredOption(`--provider-id <provider-id>`, `Provider 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.`) .requiredOption(`--name <name>`, `Provider name.`) .option(`--from <from>`, `Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.`) .option(`--username <username>`, `Textmagic username.`) - .option(`--apiKey <apiKey>`, `Textmagic apiKey.`) + .option(`--api-key <api-key>`, `Textmagic apiKey.`) .option(`--enabled <enabled>`, `Set as enabled.`, parseBool) .action(actionRunner(messagingCreateTextmagicProvider)) messaging - .command(`updateTextmagicProvider`) + .command(`update-textmagic-provider`) .description(`Update a Textmagic provider by its unique ID.`) - .requiredOption(`--providerId <providerId>`, `Provider ID.`) + .requiredOption(`--provider-id <provider-id>`, `Provider ID.`) .option(`--name <name>`, `Provider name.`) .option(`--enabled <enabled>`, `Set as enabled.`, parseBool) .option(`--username <username>`, `Textmagic username.`) - .option(`--apiKey <apiKey>`, `Textmagic apiKey.`) + .option(`--api-key <api-key>`, `Textmagic apiKey.`) .option(`--from <from>`, `Sender number.`) .action(actionRunner(messagingUpdateTextmagicProvider)) messaging - .command(`createTwilioProvider`) + .command(`create-twilio-provider`) .description(`Create a new Twilio provider.`) - .requiredOption(`--providerId <providerId>`, `Provider 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.`) + .requiredOption(`--provider-id <provider-id>`, `Provider 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.`) .requiredOption(`--name <name>`, `Provider name.`) .option(`--from <from>`, `Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.`) - .option(`--accountSid <accountSid>`, `Twilio account secret ID.`) - .option(`--authToken <authToken>`, `Twilio authentication token.`) + .option(`--account-sid <account-sid>`, `Twilio account secret ID.`) + .option(`--auth-token <auth-token>`, `Twilio authentication token.`) .option(`--enabled <enabled>`, `Set as enabled.`, parseBool) .action(actionRunner(messagingCreateTwilioProvider)) messaging - .command(`updateTwilioProvider`) + .command(`update-twilio-provider`) .description(`Update a Twilio provider by its unique ID.`) - .requiredOption(`--providerId <providerId>`, `Provider ID.`) + .requiredOption(`--provider-id <provider-id>`, `Provider ID.`) .option(`--name <name>`, `Provider name.`) .option(`--enabled <enabled>`, `Set as enabled.`, parseBool) - .option(`--accountSid <accountSid>`, `Twilio account secret ID.`) - .option(`--authToken <authToken>`, `Twilio authentication token.`) + .option(`--account-sid <account-sid>`, `Twilio account secret ID.`) + .option(`--auth-token <auth-token>`, `Twilio authentication token.`) .option(`--from <from>`, `Sender number.`) .action(actionRunner(messagingUpdateTwilioProvider)) messaging - .command(`createVonageProvider`) + .command(`create-vonage-provider`) .description(`Create a new Vonage provider.`) - .requiredOption(`--providerId <providerId>`, `Provider 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.`) + .requiredOption(`--provider-id <provider-id>`, `Provider 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.`) .requiredOption(`--name <name>`, `Provider name.`) .option(`--from <from>`, `Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.`) - .option(`--apiKey <apiKey>`, `Vonage API key.`) - .option(`--apiSecret <apiSecret>`, `Vonage API secret.`) + .option(`--api-key <api-key>`, `Vonage API key.`) + .option(`--api-secret <api-secret>`, `Vonage API secret.`) .option(`--enabled <enabled>`, `Set as enabled.`, parseBool) .action(actionRunner(messagingCreateVonageProvider)) messaging - .command(`updateVonageProvider`) + .command(`update-vonage-provider`) .description(`Update a Vonage provider by its unique ID.`) - .requiredOption(`--providerId <providerId>`, `Provider ID.`) + .requiredOption(`--provider-id <provider-id>`, `Provider ID.`) .option(`--name <name>`, `Provider name.`) .option(`--enabled <enabled>`, `Set as enabled.`, parseBool) - .option(`--apiKey <apiKey>`, `Vonage API key.`) - .option(`--apiSecret <apiSecret>`, `Vonage API secret.`) + .option(`--api-key <api-key>`, `Vonage API key.`) + .option(`--api-secret <api-secret>`, `Vonage API secret.`) .option(`--from <from>`, `Sender number.`) .action(actionRunner(messagingUpdateVonageProvider)) messaging - .command(`getProvider`) + .command(`get-provider`) .description(`Get a provider by its unique ID. `) - .requiredOption(`--providerId <providerId>`, `Provider ID.`) + .requiredOption(`--provider-id <provider-id>`, `Provider ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(messagingGetProvider)) messaging - .command(`deleteProvider`) + .command(`delete-provider`) .description(`Delete a provider by its unique ID.`) - .requiredOption(`--providerId <providerId>`, `Provider ID.`) + .requiredOption(`--provider-id <provider-id>`, `Provider ID.`) .action(actionRunner(messagingDeleteProvider)) messaging - .command(`listProviderLogs`) + .command(`list-provider-logs`) .description(`Get the provider activity logs listed by its unique ID.`) - .requiredOption(`--providerId <providerId>`, `Provider ID.`) + .requiredOption(`--provider-id <provider-id>`, `Provider ID.`) .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). Only supported methods are limit and offset`) .action(actionRunner(messagingListProviderLogs)) messaging - .command(`listSubscriberLogs`) + .command(`list-subscriber-logs`) .description(`Get the subscriber activity logs listed by its unique ID.`) - .requiredOption(`--subscriberId <subscriberId>`, `Subscriber ID.`) + .requiredOption(`--subscriber-id <subscriber-id>`, `Subscriber ID.`) .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). Only supported methods are limit and offset`) .action(actionRunner(messagingListSubscriberLogs)) messaging - .command(`listTopics`) + .command(`list-topics`) .description(`Get a list of all topics from the current Appwrite project.`) .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, description, emailTotal, smsTotal, pushTotal`) .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`) @@ -2882,70 +2882,70 @@ messaging .action(actionRunner(messagingListTopics)) messaging - .command(`createTopic`) + .command(`create-topic`) .description(`Create a new topic.`) - .requiredOption(`--topicId <topicId>`, `Topic ID. Choose a custom Topic ID or a new Topic ID.`) + .requiredOption(`--topic-id <topic-id>`, `Topic ID. Choose a custom Topic ID or a new Topic ID.`) .requiredOption(`--name <name>`, `Topic Name.`) .option(`--subscribe [subscribe...]`, `An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.`) .action(actionRunner(messagingCreateTopic)) messaging - .command(`getTopic`) + .command(`get-topic`) .description(`Get a topic by its unique ID. `) - .requiredOption(`--topicId <topicId>`, `Topic ID.`) + .requiredOption(`--topic-id <topic-id>`, `Topic ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(messagingGetTopic)) messaging - .command(`updateTopic`) + .command(`update-topic`) .description(`Update a topic by its unique ID. `) - .requiredOption(`--topicId <topicId>`, `Topic ID.`) + .requiredOption(`--topic-id <topic-id>`, `Topic ID.`) .option(`--name <name>`, `Topic Name.`) .option(`--subscribe [subscribe...]`, `An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.`) .action(actionRunner(messagingUpdateTopic)) messaging - .command(`deleteTopic`) + .command(`delete-topic`) .description(`Delete a topic by its unique ID.`) - .requiredOption(`--topicId <topicId>`, `Topic ID.`) + .requiredOption(`--topic-id <topic-id>`, `Topic ID.`) .action(actionRunner(messagingDeleteTopic)) messaging - .command(`listTopicLogs`) + .command(`list-topic-logs`) .description(`Get the topic activity logs listed by its unique ID.`) - .requiredOption(`--topicId <topicId>`, `Topic ID.`) + .requiredOption(`--topic-id <topic-id>`, `Topic ID.`) .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). Only supported methods are limit and offset`) .action(actionRunner(messagingListTopicLogs)) messaging - .command(`listSubscribers`) + .command(`list-subscribers`) .description(`Get a list of all subscribers from the current Appwrite project.`) - .requiredOption(`--topicId <topicId>`, `Topic ID. The topic ID subscribed to.`) + .requiredOption(`--topic-id <topic-id>`, `Topic ID. The topic ID subscribed to.`) .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, provider, type, enabled`) .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(messagingListSubscribers)) messaging - .command(`createSubscriber`) + .command(`create-subscriber`) .description(`Create a new subscriber.`) - .requiredOption(`--topicId <topicId>`, `Topic ID. The topic ID to subscribe to.`) - .requiredOption(`--subscriberId <subscriberId>`, `Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID.`) - .requiredOption(`--targetId <targetId>`, `Target ID. The target ID to link to the specified Topic ID.`) + .requiredOption(`--topic-id <topic-id>`, `Topic ID. The topic ID to subscribe to.`) + .requiredOption(`--subscriber-id <subscriber-id>`, `Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID.`) + .requiredOption(`--target-id <target-id>`, `Target ID. The target ID to link to the specified Topic ID.`) .action(actionRunner(messagingCreateSubscriber)) messaging - .command(`getSubscriber`) + .command(`get-subscriber`) .description(`Get a subscriber by its unique ID. `) - .requiredOption(`--topicId <topicId>`, `Topic ID. The topic ID subscribed to.`) - .requiredOption(`--subscriberId <subscriberId>`, `Subscriber ID.`) + .requiredOption(`--topic-id <topic-id>`, `Topic ID. The topic ID subscribed to.`) + .requiredOption(`--subscriber-id <subscriber-id>`, `Subscriber ID.`) .action(actionRunner(messagingGetSubscriber)) messaging - .command(`deleteSubscriber`) + .command(`delete-subscriber`) .description(`Delete a subscriber by its unique ID.`) - .requiredOption(`--topicId <topicId>`, `Topic ID. The topic ID subscribed to.`) - .requiredOption(`--subscriberId <subscriberId>`, `Subscriber ID.`) + .requiredOption(`--topic-id <topic-id>`, `Topic ID. The topic ID subscribed to.`) + .requiredOption(`--subscriber-id <subscriber-id>`, `Subscriber ID.`) .action(actionRunner(messagingDeleteSubscriber)) module.exports = { diff --git a/lib/commands/migrations.js b/lib/commands/migrations.js index 02e5db3..3b80874 100644 --- a/lib/commands/migrations.js +++ b/lib/commands/migrations.js @@ -743,68 +743,68 @@ migrations .action(actionRunner(migrationsList)) migrations - .command(`createAppwriteMigration`) + .command(`create-appwrite-migration`) .description(``) .requiredOption(`--resources [resources...]`, `List of resources to migrate`) .requiredOption(`--endpoint <endpoint>`, `Source's Appwrite Endpoint`) - .requiredOption(`--projectId <projectId>`, `Source's Project ID`) - .requiredOption(`--apiKey <apiKey>`, `Source's API Key`) + .requiredOption(`--project-id <project-id>`, `Source's Project ID`) + .requiredOption(`--api-key <api-key>`, `Source's API Key`) .action(actionRunner(migrationsCreateAppwriteMigration)) migrations - .command(`getAppwriteReport`) + .command(`get-appwrite-report`) .description(``) .requiredOption(`--resources [resources...]`, `List of resources to migrate`) .requiredOption(`--endpoint <endpoint>`, `Source's Appwrite Endpoint`) - .requiredOption(`--projectID <projectID>`, `Source's Project ID`) + .requiredOption(`--project-id <project-id>`, `Source's Project ID`) .requiredOption(`--key <key>`, `Source's API Key`) .action(actionRunner(migrationsGetAppwriteReport)) migrations - .command(`createFirebaseMigration`) + .command(`create-firebase-migration`) .description(``) .requiredOption(`--resources [resources...]`, `List of resources to migrate`) - .requiredOption(`--serviceAccount <serviceAccount>`, `JSON of the Firebase service account credentials`) + .requiredOption(`--service-account <service-account>`, `JSON of the Firebase service account credentials`) .action(actionRunner(migrationsCreateFirebaseMigration)) migrations - .command(`deleteFirebaseAuth`) + .command(`delete-firebase-auth`) .description(``) .action(actionRunner(migrationsDeleteFirebaseAuth)) migrations - .command(`createFirebaseOAuthMigration`) + .command(`create-firebase-o-auth-migration`) .description(``) .requiredOption(`--resources [resources...]`, `List of resources to migrate`) - .requiredOption(`--projectId <projectId>`, `Project ID of the Firebase Project`) + .requiredOption(`--project-id <project-id>`, `Project ID of the Firebase Project`) .action(actionRunner(migrationsCreateFirebaseOAuthMigration)) migrations - .command(`listFirebaseProjects`) + .command(`list-firebase-projects`) .description(``) .action(actionRunner(migrationsListFirebaseProjects)) migrations - .command(`getFirebaseReport`) + .command(`get-firebase-report`) .description(``) .requiredOption(`--resources [resources...]`, `List of resources to migrate`) - .requiredOption(`--serviceAccount <serviceAccount>`, `JSON of the Firebase service account credentials`) + .requiredOption(`--service-account <service-account>`, `JSON of the Firebase service account credentials`) .action(actionRunner(migrationsGetFirebaseReport)) migrations - .command(`getFirebaseReportOAuth`) + .command(`get-firebase-report-o-auth`) .description(``) .requiredOption(`--resources [resources...]`, `List of resources to migrate`) - .requiredOption(`--projectId <projectId>`, `Project ID`) + .requiredOption(`--project-id <project-id>`, `Project ID`) .action(actionRunner(migrationsGetFirebaseReportOAuth)) migrations - .command(`createNHostMigration`) + .command(`create-n-host-migration`) .description(``) .requiredOption(`--resources [resources...]`, `List of resources to migrate`) .requiredOption(`--subdomain <subdomain>`, `Source's Subdomain`) .requiredOption(`--region <region>`, `Source's Region`) - .requiredOption(`--adminSecret <adminSecret>`, `Source's Admin Secret`) + .requiredOption(`--admin-secret <admin-secret>`, `Source's Admin Secret`) .requiredOption(`--database <database>`, `Source's Database Name`) .requiredOption(`--username <username>`, `Source's Database Username`) .requiredOption(`--password <password>`, `Source's Database Password`) @@ -812,12 +812,12 @@ migrations .action(actionRunner(migrationsCreateNHostMigration)) migrations - .command(`getNHostReport`) + .command(`get-n-host-report`) .description(``) .requiredOption(`--resources [resources...]`, `List of resources to migrate.`) .requiredOption(`--subdomain <subdomain>`, `Source's Subdomain.`) .requiredOption(`--region <region>`, `Source's Region.`) - .requiredOption(`--adminSecret <adminSecret>`, `Source's Admin Secret.`) + .requiredOption(`--admin-secret <admin-secret>`, `Source's Admin Secret.`) .requiredOption(`--database <database>`, `Source's Database Name.`) .requiredOption(`--username <username>`, `Source's Database Username.`) .requiredOption(`--password <password>`, `Source's Database Password.`) @@ -825,24 +825,24 @@ migrations .action(actionRunner(migrationsGetNHostReport)) migrations - .command(`createSupabaseMigration`) + .command(`create-supabase-migration`) .description(``) .requiredOption(`--resources [resources...]`, `List of resources to migrate`) .requiredOption(`--endpoint <endpoint>`, `Source's Supabase Endpoint`) - .requiredOption(`--apiKey <apiKey>`, `Source's API Key`) - .requiredOption(`--databaseHost <databaseHost>`, `Source's Database Host`) + .requiredOption(`--api-key <api-key>`, `Source's API Key`) + .requiredOption(`--database-host <database-host>`, `Source's Database Host`) .requiredOption(`--username <username>`, `Source's Database Username`) .requiredOption(`--password <password>`, `Source's Database Password`) .option(`--port <port>`, `Source's Database Port`, parseInteger) .action(actionRunner(migrationsCreateSupabaseMigration)) migrations - .command(`getSupabaseReport`) + .command(`get-supabase-report`) .description(``) .requiredOption(`--resources [resources...]`, `List of resources to migrate`) .requiredOption(`--endpoint <endpoint>`, `Source's Supabase Endpoint.`) - .requiredOption(`--apiKey <apiKey>`, `Source's API Key.`) - .requiredOption(`--databaseHost <databaseHost>`, `Source's Database Host.`) + .requiredOption(`--api-key <api-key>`, `Source's API Key.`) + .requiredOption(`--database-host <database-host>`, `Source's Database Host.`) .requiredOption(`--username <username>`, `Source's Database Username.`) .requiredOption(`--password <password>`, `Source's Database Password.`) .option(`--port <port>`, `Source's Database Port.`, parseInteger) @@ -851,19 +851,19 @@ migrations migrations .command(`get`) .description(``) - .requiredOption(`--migrationId <migrationId>`, `Migration unique ID.`) + .requiredOption(`--migration-id <migration-id>`, `Migration unique ID.`) .action(actionRunner(migrationsGet)) migrations .command(`retry`) .description(``) - .requiredOption(`--migrationId <migrationId>`, `Migration unique ID.`) + .requiredOption(`--migration-id <migration-id>`, `Migration unique ID.`) .action(actionRunner(migrationsRetry)) migrations .command(`delete`) .description(``) - .requiredOption(`--migrationId <migrationId>`, `Migration ID.`) + .requiredOption(`--migration-id <migration-id>`, `Migration ID.`) .action(actionRunner(migrationsDelete)) module.exports = { diff --git a/lib/commands/project.js b/lib/commands/project.js index 1251a64..c81e2b5 100644 --- a/lib/commands/project.js +++ b/lib/commands/project.js @@ -257,43 +257,43 @@ const projectDeleteVariable = async ({variableId,parseOutput = true, overrideFor } project - .command(`getUsage`) + .command(`get-usage`) .description(``) - .requiredOption(`--startDate <startDate>`, `Starting date for the usage`) - .requiredOption(`--endDate <endDate>`, `End date for the usage`) + .requiredOption(`--start-date <start-date>`, `Starting date for the usage`) + .requiredOption(`--end-date <end-date>`, `End date for the usage`) .option(`--period <period>`, `Period used`) .action(actionRunner(projectGetUsage)) project - .command(`listVariables`) + .command(`list-variables`) .description(`Get a list of all project variables. These variables will be accessible in all Appwrite Functions at runtime.`) .action(actionRunner(projectListVariables)) project - .command(`createVariable`) + .command(`create-variable`) .description(`Create a new project variable. This variable will be accessible in all Appwrite Functions at runtime.`) .requiredOption(`--key <key>`, `Variable key. Max length: 255 chars.`) .requiredOption(`--value <value>`, `Variable value. Max length: 8192 chars.`) .action(actionRunner(projectCreateVariable)) project - .command(`getVariable`) + .command(`get-variable`) .description(`Get a project variable by its unique ID.`) - .requiredOption(`--variableId <variableId>`, `Variable unique ID.`) + .requiredOption(`--variable-id <variable-id>`, `Variable unique ID.`) .action(actionRunner(projectGetVariable)) project - .command(`updateVariable`) + .command(`update-variable`) .description(`Update project variable by its unique ID. This variable will be accessible in all Appwrite Functions at runtime.`) - .requiredOption(`--variableId <variableId>`, `Variable unique ID.`) + .requiredOption(`--variable-id <variable-id>`, `Variable unique ID.`) .requiredOption(`--key <key>`, `Variable key. Max length: 255 chars.`) .option(`--value <value>`, `Variable value. Max length: 8192 chars.`) .action(actionRunner(projectUpdateVariable)) project - .command(`deleteVariable`) + .command(`delete-variable`) .description(`Delete a project variable by its unique ID. `) - .requiredOption(`--variableId <variableId>`, `Variable unique ID.`) + .requiredOption(`--variable-id <variable-id>`, `Variable unique ID.`) .action(actionRunner(projectDeleteVariable)) module.exports = { diff --git a/lib/commands/projects.js b/lib/commands/projects.js index 5b5c153..4623d2e 100644 --- a/lib/commands/projects.js +++ b/lib/commands/projects.js @@ -1950,199 +1950,199 @@ projects projects .command(`create`) .description(``) - .requiredOption(`--projectId <projectId>`, `Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, and hyphen. Can't start with a special char. Max length is 36 chars.`) + .requiredOption(`--project-id <project-id>`, `Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, and hyphen. Can't start with a special char. Max length is 36 chars.`) .requiredOption(`--name <name>`, `Project name. Max length: 128 chars.`) - .requiredOption(`--teamId <teamId>`, `Team unique ID.`) + .requiredOption(`--team-id <team-id>`, `Team unique ID.`) .option(`--region <region>`, `Project Region.`) .option(`--description <description>`, `Project description. Max length: 256 chars.`) .option(`--logo <logo>`, `Project logo.`) .option(`--url <url>`, `Project URL.`) - .option(`--legalName <legalName>`, `Project legal Name. Max length: 256 chars.`) - .option(`--legalCountry <legalCountry>`, `Project legal Country. Max length: 256 chars.`) - .option(`--legalState <legalState>`, `Project legal State. Max length: 256 chars.`) - .option(`--legalCity <legalCity>`, `Project legal City. Max length: 256 chars.`) - .option(`--legalAddress <legalAddress>`, `Project legal Address. Max length: 256 chars.`) - .option(`--legalTaxId <legalTaxId>`, `Project legal Tax ID. Max length: 256 chars.`) + .option(`--legal-name <legal-name>`, `Project legal Name. Max length: 256 chars.`) + .option(`--legal-country <legal-country>`, `Project legal Country. Max length: 256 chars.`) + .option(`--legal-state <legal-state>`, `Project legal State. Max length: 256 chars.`) + .option(`--legal-city <legal-city>`, `Project legal City. Max length: 256 chars.`) + .option(`--legal-address <legal-address>`, `Project legal Address. Max length: 256 chars.`) + .option(`--legal-tax-id <legal-tax-id>`, `Project legal Tax ID. Max length: 256 chars.`) .action(actionRunner(projectsCreate)) projects .command(`get`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(projectsGet)) projects .command(`update`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--name <name>`, `Project name. Max length: 128 chars.`) .option(`--description <description>`, `Project description. Max length: 256 chars.`) .option(`--logo <logo>`, `Project logo.`) .option(`--url <url>`, `Project URL.`) - .option(`--legalName <legalName>`, `Project legal name. Max length: 256 chars.`) - .option(`--legalCountry <legalCountry>`, `Project legal country. Max length: 256 chars.`) - .option(`--legalState <legalState>`, `Project legal state. Max length: 256 chars.`) - .option(`--legalCity <legalCity>`, `Project legal city. Max length: 256 chars.`) - .option(`--legalAddress <legalAddress>`, `Project legal address. Max length: 256 chars.`) - .option(`--legalTaxId <legalTaxId>`, `Project legal tax ID. Max length: 256 chars.`) + .option(`--legal-name <legal-name>`, `Project legal name. Max length: 256 chars.`) + .option(`--legal-country <legal-country>`, `Project legal country. Max length: 256 chars.`) + .option(`--legal-state <legal-state>`, `Project legal state. Max length: 256 chars.`) + .option(`--legal-city <legal-city>`, `Project legal city. Max length: 256 chars.`) + .option(`--legal-address <legal-address>`, `Project legal address. Max length: 256 chars.`) + .option(`--legal-tax-id <legal-tax-id>`, `Project legal tax ID. Max length: 256 chars.`) .action(actionRunner(projectsUpdate)) projects .command(`delete`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .action(actionRunner(projectsDelete)) projects - .command(`updateApiStatus`) + .command(`update-api-status`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--api <api>`, `API name.`) .requiredOption(`--status <status>`, `API status.`, parseBool) .action(actionRunner(projectsUpdateApiStatus)) projects - .command(`updateApiStatusAll`) + .command(`update-api-status-all`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--status <status>`, `API status.`, parseBool) .action(actionRunner(projectsUpdateApiStatusAll)) projects - .command(`updateAuthDuration`) + .command(`update-auth-duration`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--duration <duration>`, `Project session length in seconds. Max length: 31536000 seconds.`, parseInteger) .action(actionRunner(projectsUpdateAuthDuration)) projects - .command(`updateAuthLimit`) + .command(`update-auth-limit`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--limit <limit>`, `Set the max number of users allowed in this project. Use 0 for unlimited.`, parseInteger) .action(actionRunner(projectsUpdateAuthLimit)) projects - .command(`updateAuthSessionsLimit`) + .command(`update-auth-sessions-limit`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--limit <limit>`, `Set the max number of users allowed in this project. Value allowed is between 1-100. Default is 10`, parseInteger) .action(actionRunner(projectsUpdateAuthSessionsLimit)) projects - .command(`updateMockNumbers`) + .command(`update-mock-numbers`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--numbers [numbers...]`, `An array of mock numbers and their corresponding verification codes (OTPs). Each number should be a valid E.164 formatted phone number. Maximum of 10 numbers are allowed.`) .action(actionRunner(projectsUpdateMockNumbers)) projects - .command(`updateAuthPasswordDictionary`) + .command(`update-auth-password-dictionary`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--enabled <enabled>`, `Set whether or not to enable checking user's password against most commonly used passwords. Default is false.`, parseBool) .action(actionRunner(projectsUpdateAuthPasswordDictionary)) projects - .command(`updateAuthPasswordHistory`) + .command(`update-auth-password-history`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--limit <limit>`, `Set the max number of passwords to store in user history. User can't choose a new password that is already stored in the password history list. Max number of passwords allowed in history is20. Default value is 0`, parseInteger) .action(actionRunner(projectsUpdateAuthPasswordHistory)) projects - .command(`updatePersonalDataCheck`) + .command(`update-personal-data-check`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--enabled <enabled>`, `Set whether or not to check a password for similarity with personal data. Default is false.`, parseBool) .action(actionRunner(projectsUpdatePersonalDataCheck)) projects - .command(`updateSessionAlerts`) + .command(`update-session-alerts`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--alerts <alerts>`, `Set to true to enable session emails.`, parseBool) .action(actionRunner(projectsUpdateSessionAlerts)) projects - .command(`updateAuthStatus`) + .command(`update-auth-status`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--method <method>`, `Auth Method. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone`) .requiredOption(`--status <status>`, `Set the status of this auth method.`, parseBool) .action(actionRunner(projectsUpdateAuthStatus)) projects - .command(`createJWT`) + .command(`create-jwt`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--scopes [scopes...]`, `List of scopes allowed for JWT key. Maximum of 100 scopes are allowed.`) .option(`--duration <duration>`, `Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.`, parseInteger) .action(actionRunner(projectsCreateJWT)) projects - .command(`listKeys`) + .command(`list-keys`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(projectsListKeys)) projects - .command(`createKey`) + .command(`create-key`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--name <name>`, `Key name. Max length: 128 chars.`) .requiredOption(`--scopes [scopes...]`, `Key scopes list. Maximum of 100 scopes are allowed.`) .option(`--expire <expire>`, `Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration.`) .action(actionRunner(projectsCreateKey)) projects - .command(`getKey`) + .command(`get-key`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) - .requiredOption(`--keyId <keyId>`, `Key unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) + .requiredOption(`--key-id <key-id>`, `Key unique ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(projectsGetKey)) projects - .command(`updateKey`) + .command(`update-key`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) - .requiredOption(`--keyId <keyId>`, `Key unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) + .requiredOption(`--key-id <key-id>`, `Key unique ID.`) .requiredOption(`--name <name>`, `Key name. Max length: 128 chars.`) .requiredOption(`--scopes [scopes...]`, `Key scopes list. Maximum of 100 events are allowed.`) .option(`--expire <expire>`, `Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration.`) .action(actionRunner(projectsUpdateKey)) projects - .command(`deleteKey`) + .command(`delete-key`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) - .requiredOption(`--keyId <keyId>`, `Key unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) + .requiredOption(`--key-id <key-id>`, `Key unique ID.`) .action(actionRunner(projectsDeleteKey)) projects - .command(`updateOAuth2`) + .command(`update-o-auth-2`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--provider <provider>`, `Provider Name`) - .option(`--appId <appId>`, `Provider app ID. Max length: 256 chars.`) + .option(`--app-id <app-id>`, `Provider app ID. Max length: 256 chars.`) .option(`--secret <secret>`, `Provider secret key. Max length: 512 chars.`) .option(`--enabled <enabled>`, `Provider status. Set to 'false' to disable new session creation.`, parseBool) .action(actionRunner(projectsUpdateOAuth2)) projects - .command(`listPlatforms`) + .command(`list-platforms`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(projectsListPlatforms)) projects - .command(`createPlatform`) + .command(`create-platform`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--type <type>`, `Platform type.`) .requiredOption(`--name <name>`, `Platform name. Max length: 128 chars.`) .option(`--key <key>`, `Package name for Android or bundle ID for iOS or macOS. Max length: 256 chars.`) @@ -2151,18 +2151,18 @@ projects .action(actionRunner(projectsCreatePlatform)) projects - .command(`getPlatform`) + .command(`get-platform`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) - .requiredOption(`--platformId <platformId>`, `Platform unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) + .requiredOption(`--platform-id <platform-id>`, `Platform unique ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(projectsGetPlatform)) projects - .command(`updatePlatform`) + .command(`update-platform`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) - .requiredOption(`--platformId <platformId>`, `Platform unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) + .requiredOption(`--platform-id <platform-id>`, `Platform unique ID.`) .requiredOption(`--name <name>`, `Platform name. Max length: 128 chars.`) .option(`--key <key>`, `Package name for android or bundle ID for iOS. Max length: 256 chars.`) .option(`--store <store>`, `App store or Google Play store ID. Max length: 256 chars.`) @@ -2170,35 +2170,35 @@ projects .action(actionRunner(projectsUpdatePlatform)) projects - .command(`deletePlatform`) + .command(`delete-platform`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) - .requiredOption(`--platformId <platformId>`, `Platform unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) + .requiredOption(`--platform-id <platform-id>`, `Platform unique ID.`) .action(actionRunner(projectsDeletePlatform)) projects - .command(`updateServiceStatus`) + .command(`update-service-status`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--service <service>`, `Service name.`) .requiredOption(`--status <status>`, `Service status.`, parseBool) .action(actionRunner(projectsUpdateServiceStatus)) projects - .command(`updateServiceStatusAll`) + .command(`update-service-status-all`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--status <status>`, `Service status.`, parseBool) .action(actionRunner(projectsUpdateServiceStatusAll)) projects - .command(`updateSmtp`) + .command(`update-smtp`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--enabled <enabled>`, `Enable custom SMTP service`, parseBool) - .option(`--senderName <senderName>`, `Name of the email sender`) - .option(`--senderEmail <senderEmail>`, `Email of the sender`) - .option(`--replyTo <replyTo>`, `Reply to email`) + .option(`--sender-name <sender-name>`, `Name of the email sender`) + .option(`--sender-email <sender-email>`, `Email of the sender`) + .option(`--reply-to <reply-to>`, `Reply to email`) .option(`--host <host>`, `SMTP server host name`) .option(`--port <port>`, `SMTP server port`, parseInteger) .option(`--username <username>`, `SMTP server username`) @@ -2207,14 +2207,14 @@ projects .action(actionRunner(projectsUpdateSmtp)) projects - .command(`createSmtpTest`) + .command(`create-smtp-test`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--emails [emails...]`, `Array of emails to send test email to. Maximum of 10 emails are allowed.`) - .requiredOption(`--senderName <senderName>`, `Name of the email sender`) - .requiredOption(`--senderEmail <senderEmail>`, `Email of the sender`) + .requiredOption(`--sender-name <sender-name>`, `Name of the email sender`) + .requiredOption(`--sender-email <sender-email>`, `Email of the sender`) .requiredOption(`--host <host>`, `SMTP server host name`) - .option(`--replyTo <replyTo>`, `Reply to email`) + .option(`--reply-to <reply-to>`, `Reply to email`) .option(`--port <port>`, `SMTP server port`, parseInteger) .option(`--username <username>`, `SMTP server username`) .option(`--password <password>`, `SMTP server password`) @@ -2222,120 +2222,120 @@ projects .action(actionRunner(projectsCreateSmtpTest)) projects - .command(`updateTeam`) + .command(`update-team`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) - .requiredOption(`--teamId <teamId>`, `Team ID of the team to transfer project to.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) + .requiredOption(`--team-id <team-id>`, `Team ID of the team to transfer project to.`) .action(actionRunner(projectsUpdateTeam)) projects - .command(`getEmailTemplate`) + .command(`get-email-template`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--type <type>`, `Template type`) .requiredOption(`--locale <locale>`, `Template locale`) .action(actionRunner(projectsGetEmailTemplate)) projects - .command(`updateEmailTemplate`) + .command(`update-email-template`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--type <type>`, `Template type`) .requiredOption(`--locale <locale>`, `Template locale`) .requiredOption(`--subject <subject>`, `Email Subject`) .requiredOption(`--message <message>`, `Template message`) - .option(`--senderName <senderName>`, `Name of the email sender`) - .option(`--senderEmail <senderEmail>`, `Email of the sender`) - .option(`--replyTo <replyTo>`, `Reply to email`) + .option(`--sender-name <sender-name>`, `Name of the email sender`) + .option(`--sender-email <sender-email>`, `Email of the sender`) + .option(`--reply-to <reply-to>`, `Reply to email`) .action(actionRunner(projectsUpdateEmailTemplate)) projects - .command(`deleteEmailTemplate`) + .command(`delete-email-template`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--type <type>`, `Template type`) .requiredOption(`--locale <locale>`, `Template locale`) .action(actionRunner(projectsDeleteEmailTemplate)) projects - .command(`getSmsTemplate`) + .command(`get-sms-template`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--type <type>`, `Template type`) .requiredOption(`--locale <locale>`, `Template locale`) .action(actionRunner(projectsGetSmsTemplate)) projects - .command(`updateSmsTemplate`) + .command(`update-sms-template`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--type <type>`, `Template type`) .requiredOption(`--locale <locale>`, `Template locale`) .requiredOption(`--message <message>`, `Template message`) .action(actionRunner(projectsUpdateSmsTemplate)) projects - .command(`deleteSmsTemplate`) + .command(`delete-sms-template`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--type <type>`, `Template type`) .requiredOption(`--locale <locale>`, `Template locale`) .action(actionRunner(projectsDeleteSmsTemplate)) projects - .command(`listWebhooks`) + .command(`list-webhooks`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(projectsListWebhooks)) projects - .command(`createWebhook`) + .command(`create-webhook`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) .requiredOption(`--name <name>`, `Webhook name. Max length: 128 chars.`) .requiredOption(`--events [events...]`, `Events list. Maximum of 100 events are allowed.`) .requiredOption(`--url <url>`, `Webhook URL.`) .requiredOption(`--security <security>`, `Certificate verification, false for disabled or true for enabled.`, parseBool) .option(`--enabled <enabled>`, `Enable or disable a webhook.`, parseBool) - .option(`--httpUser <httpUser>`, `Webhook HTTP user. Max length: 256 chars.`) - .option(`--httpPass <httpPass>`, `Webhook HTTP password. Max length: 256 chars.`) + .option(`--http-user <http-user>`, `Webhook HTTP user. Max length: 256 chars.`) + .option(`--http-pass <http-pass>`, `Webhook HTTP password. Max length: 256 chars.`) .action(actionRunner(projectsCreateWebhook)) projects - .command(`getWebhook`) + .command(`get-webhook`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) - .requiredOption(`--webhookId <webhookId>`, `Webhook unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) + .requiredOption(`--webhook-id <webhook-id>`, `Webhook unique ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(projectsGetWebhook)) projects - .command(`updateWebhook`) + .command(`update-webhook`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) - .requiredOption(`--webhookId <webhookId>`, `Webhook unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) + .requiredOption(`--webhook-id <webhook-id>`, `Webhook unique ID.`) .requiredOption(`--name <name>`, `Webhook name. Max length: 128 chars.`) .requiredOption(`--events [events...]`, `Events list. Maximum of 100 events are allowed.`) .requiredOption(`--url <url>`, `Webhook URL.`) .requiredOption(`--security <security>`, `Certificate verification, false for disabled or true for enabled.`, parseBool) .option(`--enabled <enabled>`, `Enable or disable a webhook.`, parseBool) - .option(`--httpUser <httpUser>`, `Webhook HTTP user. Max length: 256 chars.`) - .option(`--httpPass <httpPass>`, `Webhook HTTP password. Max length: 256 chars.`) + .option(`--http-user <http-user>`, `Webhook HTTP user. Max length: 256 chars.`) + .option(`--http-pass <http-pass>`, `Webhook HTTP password. Max length: 256 chars.`) .action(actionRunner(projectsUpdateWebhook)) projects - .command(`deleteWebhook`) + .command(`delete-webhook`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) - .requiredOption(`--webhookId <webhookId>`, `Webhook unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) + .requiredOption(`--webhook-id <webhook-id>`, `Webhook unique ID.`) .action(actionRunner(projectsDeleteWebhook)) projects - .command(`updateWebhookSignature`) + .command(`update-webhook-signature`) .description(``) - .requiredOption(`--projectId <projectId>`, `Project unique ID.`) - .requiredOption(`--webhookId <webhookId>`, `Webhook unique ID.`) + .requiredOption(`--project-id <project-id>`, `Project unique ID.`) + .requiredOption(`--webhook-id <webhook-id>`, `Webhook unique ID.`) .action(actionRunner(projectsUpdateWebhookSignature)) module.exports = { diff --git a/lib/commands/proxy.js b/lib/commands/proxy.js index 0c6eb08..9cc74fa 100644 --- a/lib/commands/proxy.js +++ b/lib/commands/proxy.js @@ -218,36 +218,36 @@ const proxyUpdateRuleVerification = async ({ruleId,parseOutput = true, overrideF } proxy - .command(`listRules`) + .command(`list-rules`) .description(`Get a list of all the proxy rules. You can use the query params to filter your results.`) .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: domain, resourceType, resourceId, url`) .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`) .action(actionRunner(proxyListRules)) proxy - .command(`createRule`) + .command(`create-rule`) .description(`Create a new proxy rule.`) .requiredOption(`--domain <domain>`, `Domain name.`) - .requiredOption(`--resourceType <resourceType>`, `Action definition for the rule. Possible values are "api", "function"`) - .option(`--resourceId <resourceId>`, `ID of resource for the action type. If resourceType is "api", leave empty. If resourceType is "function", provide ID of the function.`) + .requiredOption(`--resource-type <resource-type>`, `Action definition for the rule. Possible values are "api", "function"`) + .option(`--resource-id <resource-id>`, `ID of resource for the action type. If resourceType is "api", leave empty. If resourceType is "function", provide ID of the function.`) .action(actionRunner(proxyCreateRule)) proxy - .command(`getRule`) + .command(`get-rule`) .description(`Get a proxy rule by its unique ID.`) - .requiredOption(`--ruleId <ruleId>`, `Rule ID.`) + .requiredOption(`--rule-id <rule-id>`, `Rule ID.`) .action(actionRunner(proxyGetRule)) proxy - .command(`deleteRule`) + .command(`delete-rule`) .description(`Delete a proxy rule by its unique ID.`) - .requiredOption(`--ruleId <ruleId>`, `Rule ID.`) + .requiredOption(`--rule-id <rule-id>`, `Rule ID.`) .action(actionRunner(proxyDeleteRule)) proxy - .command(`updateRuleVerification`) + .command(`update-rule-verification`) .description(``) - .requiredOption(`--ruleId <ruleId>`, `Rule ID.`) + .requiredOption(`--rule-id <rule-id>`, `Rule ID.`) .action(actionRunner(proxyUpdateRuleVerification)) module.exports = { diff --git a/lib/commands/pull.js b/lib/commands/pull.js index d416f8e..a399aee 100644 --- a/lib/commands/pull.js +++ b/lib/commands/pull.js @@ -27,7 +27,7 @@ const pullResources = async () => { if (cliConfig.all) { for (let action of Object.values(actions)) { cliConfig.all = true; - await action(); + await action({ returnOnZero: true }); } } else { const answers = await inquirer.prompt(questionsPullResources[0]); @@ -92,7 +92,7 @@ const pullFunctions = async ({ code }) => { if (!fs.existsSync(func['path'])) { fs.mkdirSync(func['path'], { recursive: true }); } - + if(code === false) { warn("Source code download skipped."); } else if(!func['deployment']) { @@ -114,14 +114,14 @@ const pullFunctions = async ({ code }) => { overrideForCli: true, parseOutput: false }); - + tar.extract({ sync: true, cwd: func['path'], file: compressedFileName, strict: false, }); - + fs.rmSync(compressedFileName); } } diff --git a/lib/commands/push.js b/lib/commands/push.js index d516f8b..c0c8bfe 100644 --- a/lib/commands/push.js +++ b/lib/commands/push.js @@ -2,13 +2,13 @@ const chalk = require('chalk'); const inquirer = require("inquirer"); const JSONbig = require("json-bigint")({ storeAsString: false }); const { Command } = require("commander"); -const { localConfig, globalConfig } = require("../config"); +const { localConfig, globalConfig, KeysAttributes, KeysFunction, whitelistKeys, KeysTopics, KeysStorage, KeysTeams, } = require("../config"); const { Spinner, SPINNER_ARC, SPINNER_DOTS } = require('../spinner'); const { paginate } = require('../paginate'); -const { questionsPushBuckets, questionsPushTeams, questionsPushFunctions, questionsGetEntrypoint, questionsPushCollections, questionsConfirmPushCollections, questionsPushMessagingTopics, questionsPushResources } = require("../questions"); -const { cliConfig, actionRunner, success, warn, log, error, commandDescriptions, drawTable } = require("../parser"); +const { questionsPushBuckets, questionsPushTeams, questionsPushFunctions, questionsGetEntrypoint, questionsPushCollections, questionPushChanges, questionsPushMessagingTopics, questionsPushResources } = require("../questions"); +const { cliConfig, actionRunner, success, warn, log, hint, error, commandDescriptions, drawTable } = require("../parser"); const { proxyListRules } = require('./proxy'); -const { functionsGet, functionsCreate, functionsUpdate, functionsCreateDeployment, functionsUpdateDeployment, functionsGetDeployment, functionsListVariables, functionsDeleteVariable, functionsCreateVariable } = require('./functions'); +const { functionsGet, functionsCreate, functionsUpdate, functionsCreateDeployment, functionsGetDeployment, functionsListVariables, functionsDeleteVariable, functionsCreateVariable } = require('./functions'); const { databasesGet, databasesCreate, @@ -37,6 +37,7 @@ const { databasesUpdateRelationshipAttribute, databasesCreateRelationshipAttribute, databasesDeleteAttribute, + databasesDeleteIndex, databasesListAttributes, databasesListIndexes, databasesUpdateCollection @@ -53,6 +54,7 @@ const { teamsCreate } = require("./teams"); const { + projectsGet, projectsUpdate, projectsUpdateServiceStatus, projectsUpdateAuthStatus, @@ -68,8 +70,9 @@ const { checkDeployConditions } = require('../utils'); const STEP_SIZE = 100; // Resources const POLL_DEBOUNCE = 2000; // Milliseconds const POLL_MAX_DEBOUNCE = 1800; // Times of POLL_DEBOUNCE (1 hour) +const POLL_DEFAULT_VALUE = 30; -let pollMaxDebounces = 30; +let pollMaxDebounces = POLL_DEFAULT_VALUE; const changeableKeys = ['status', 'required', 'xdefault', 'elements', 'min', 'max', 'default', 'error']; @@ -90,11 +93,13 @@ const awaitPools = { return true; } - let steps = Math.max(1, Math.ceil(total / STEP_SIZE)); - if (steps > 1 && iteration === 1) { - pollMaxDebounces *= steps; + if (pollMaxDebounces === POLL_DEFAULT_VALUE) { + let steps = Math.max(1, Math.ceil(total / STEP_SIZE)); + if (steps > 1 && iteration === 1) { + pollMaxDebounces *= steps; - log('Found a large number of attributes, increasing timeout to ' + (pollMaxDebounces * POLL_DEBOUNCE / 1000 / 60) + ' minutes') + log('Found a large number of attributes, increasing timeout to ' + (pollMaxDebounces * POLL_DEBOUNCE / 1000 / 60) + ' minutes') + } } await new Promise(resolve => setTimeout(resolve, POLL_DEBOUNCE)); @@ -121,11 +126,13 @@ const awaitPools = { return true; } - let steps = Math.max(1, Math.ceil(total / STEP_SIZE)); - if (steps > 1 && iteration === 1) { - pollMaxDebounces *= steps; + if (pollMaxDebounces === POLL_DEFAULT_VALUE) { + let steps = Math.max(1, Math.ceil(total / STEP_SIZE)); + if (steps > 1 && iteration === 1) { + pollMaxDebounces *= steps; - log('Found a large number of indexes, increasing timeout to ' + (pollMaxDebounces * POLL_DEBOUNCE / 1000 / 60) + ' minutes') + log('Found a large number of indexes, increasing timeout to ' + (pollMaxDebounces * POLL_DEBOUNCE / 1000 / 60) + ' minutes') + } } await new Promise(resolve => setTimeout(resolve, POLL_DEBOUNCE)); @@ -151,11 +158,13 @@ const awaitPools = { return true; } - let steps = Math.max(1, Math.ceil(total / STEP_SIZE)); - if (steps > 1 && iteration === 1) { - pollMaxDebounces *= steps; + if (pollMaxDebounces === POLL_DEFAULT_VALUE) { + let steps = Math.max(1, Math.ceil(total / STEP_SIZE)); + if (steps > 1 && iteration === 1) { + pollMaxDebounces *= steps; - log('Found a large number of variables, increasing timeout to ' + (pollMaxDebounces * POLL_DEBOUNCE / 1000 / 60) + ' minutes') + log('Found a large number of variables, increasing timeout to ' + (pollMaxDebounces * POLL_DEBOUNCE / 1000 / 60) + ' minutes') + } } await new Promise(resolve => setTimeout(resolve, POLL_DEBOUNCE)); @@ -170,11 +179,13 @@ const awaitPools = { return false; } - let steps = Math.max(1, Math.ceil(attributeKeys.length / STEP_SIZE)); - if (steps > 1 && iteration === 1) { - pollMaxDebounces *= steps; + if (pollMaxDebounces === POLL_DEFAULT_VALUE) { + let steps = Math.max(1, Math.ceil(attributeKeys.length / STEP_SIZE)); + if (steps > 1 && iteration === 1) { + pollMaxDebounces *= steps; - log('Found a large number of attributes to be deleted. Increasing timeout to ' + (pollMaxDebounces * POLL_DEBOUNCE / 1000 / 60) + ' minutes') + log('Found a large number of attributes to be deleted. Increasing timeout to ' + (pollMaxDebounces * POLL_DEBOUNCE / 1000 / 60) + ' minutes') + } } const { attributes } = await paginate(databasesListAttributes, { @@ -203,11 +214,13 @@ const awaitPools = { return false; } - let steps = Math.max(1, Math.ceil(attributeKeys.length / STEP_SIZE)); - if (steps > 1 && iteration === 1) { - pollMaxDebounces *= steps; + if (pollMaxDebounces === POLL_DEFAULT_VALUE) { + let steps = Math.max(1, Math.ceil(attributeKeys.length / STEP_SIZE)); + if (steps > 1 && iteration === 1) { + pollMaxDebounces *= steps; - log('Creating a large number of attributes, increasing timeout to ' + (pollMaxDebounces * POLL_DEBOUNCE / 1000 / 60) + ' minutes') + log('Creating a large number of attributes, increasing timeout to ' + (pollMaxDebounces * POLL_DEBOUNCE / 1000 / 60) + ' minutes') + } } const { attributes } = await paginate(databasesListAttributes, { @@ -243,16 +256,53 @@ const awaitPools = { iteration + 1 ); }, + deleteIndexes: async (databaseId, collectionId, indexesKeys, iteration = 1) => { + if (iteration > pollMaxDebounces) { + return false; + } + + if (pollMaxDebounces === POLL_DEFAULT_VALUE) { + let steps = Math.max(1, Math.ceil(attributeKeys.length / STEP_SIZE)); + if (steps > 1 && iteration === 1) { + pollMaxDebounces *= steps; + + log('Found a large number of indexes to be deleted. Increasing timeout to ' + (pollMaxDebounces * POLL_DEBOUNCE / 1000 / 60) + ' minutes') + } + } + + const { indexes } = await paginate(databasesListIndexes, { + databaseId, + collectionId, + parseOutput: false + }, 100, 'indexes'); + + const ready = indexesKeys.filter(index => indexes.includes(index.key)); + + if (ready.length === 0) { + return true; + } + + await new Promise(resolve => setTimeout(resolve, POLL_DEBOUNCE)); + + return await awaitPools.expectIndexes( + databaseId, + collectionId, + indexesKeys, + iteration + 1 + ); + }, expectIndexes: async (databaseId, collectionId, indexKeys, iteration = 1) => { if (iteration > pollMaxDebounces) { return false; } - let steps = Math.max(1, Math.ceil(indexKeys.length / STEP_SIZE)); - if (steps > 1 && iteration === 1) { - pollMaxDebounces *= steps; + if (pollMaxDebounces === POLL_DEFAULT_VALUE) { + let steps = Math.max(1, Math.ceil(indexKeys.length / STEP_SIZE)); + if (steps > 1 && iteration === 1) { + pollMaxDebounces *= steps; - log('Creating a large number of indexes, increasing timeout to ' + (pollMaxDebounces * POLL_DEBOUNCE / 1000 / 60) + ' minutes') + log('Creating a large number of indexes, increasing timeout to ' + (pollMaxDebounces * POLL_DEBOUNCE / 1000 / 60) + ' minutes') + } } const { indexes } = await paginate(databasesListIndexes, { @@ -290,6 +340,73 @@ const awaitPools = { }, } +const approveChanges = async (resource, resourceGetFunction, keys, resourceName, resourcePlural) => { + log('Checking for changes'); + const changes = []; + + await Promise.all(resource.map(async (localResource) => { + try { + const remoteResource = await resourceGetFunction({ + [resourceName]: localResource['$id'], + parseOutput: false, + }); + + for (let [key, value] of Object.entries(whitelistKeys(remoteResource, keys))) { + if (Array.isArray(value) && Array.isArray(localResource[key])) { + if (JSON.stringify(value) !== JSON.stringify(localResource[key])) { + changes.push({ + id: localResource['$id'], + key, + remote: chalk.red(value.join('\n')), + local: chalk.green(localResource[key].join('\n')) + }) + } + } else if (value !== localResource[key]) { + changes.push({ + id: localResource['$id'], + key, + remote: chalk.red(value), + local: chalk.green(localResource[key]) + }) + } + } + } catch (e) { + if (Number(e.code) !== 404) { + throw e; + } + } + })); + + if (changes.length === 0) { + return true; + } + + drawTable(changes); + if (!cliConfig.force) { + const answers = await inquirer.prompt(questionPushChanges); + if (answers.changes.toLowerCase() === 'yes') { + return true; + } + } + + success(`Successfully pushed 0 ${resourcePlural}.`); + return false; +} + +const getObjectChanges = (remote, local, index, what) => { + const changes = []; + + if (remote[index] && local[index]) { + for (let [service, status] of Object.entries(remote[index])) { + if (status !== local[index][service]) { + changes.push({ group: what,setting: service, remote: chalk.red(status), local: chalk.green(local[index][service]) }) + } + } + } + + return changes; +} + const createAttribute = async (databaseId, collectionId, attribute) => { switch (attribute.type) { case 'string': @@ -523,8 +640,18 @@ const updateAttribute = async (databaseId, collectionId, attribute) => { }) } } -const deleteAttribute = async (collection, attribute) => { - log(`Deleting attribute ${attribute.key} of ${collection.name} ( ${collection['$id']} )`); +const deleteAttribute = async (collection, attribute, isIndex = false) => { + log(`Deleting ${isIndex ? 'index' : 'attribute'} ${attribute.key} of ${collection.name} ( ${collection['$id']} )`); + + if (isIndex) { + await databasesDeleteIndex({ + databaseId: collection['databaseId'], + collectionId: collection['$id'], + key: attribute.key, + parseOutput: false + }); + return; + } await databasesDeleteAttribute({ databaseId: collection['databaseId'], @@ -555,6 +682,10 @@ const checkAttributeChanges = (remote, local, collection, recraeting = true) => let attribute = remote; for (let key of Object.keys(remote)) { + if (!KeysAttributes.has(key)) { + continue; + } + if (changeableKeys.includes(key)) { if (!recraeting) { if (remote[key] !== local[key]) { @@ -570,7 +701,12 @@ const checkAttributeChanges = (remote, local, collection, recraeting = true) => continue; } - if (remote[key] !== local[key]) { + if (Array.isArray(remote[key]) && Array.isArray(local[key])) { + if (JSON.stringify(remote[key]) !== JSON.stringify(local[key])) { + const bol = reason === '' ? '' : '\n'; + reason += `${bol}${key} changed from ${chalk.red(remote[key])} to ${chalk.green(local[key])}`; + } + } else if (remote[key] !== local[key]) { const bol = reason === '' ? '' : '\n'; reason += `${bol}${key} changed from ${chalk.red(remote[key])} to ${chalk.green(local[key])}`; } @@ -590,7 +726,7 @@ const generateChangesObject = (attribute, collection, isAdding) => { return { key: `${chalk.yellow(attribute.key)} in ${collection.name} (${collection['$id']})`, attribute: attribute, - reason: isAdding ? 'Field doesn\'t exist on the remote server' : 'Field doesn\'t exist in appwrite.json file', + reason: isAdding ? 'Field isn\'t present on the remote server' : 'Field isn\'t present on the appwrite.json file', action: isAdding ? chalk.green('adding') : chalk.red('deleting') }; @@ -599,12 +735,9 @@ const generateChangesObject = (attribute, collection, isAdding) => { /** * Filter deleted and recreated attributes, * return list of attributes to create - * @param remoteAttributes - * @param localAttributes - * @param collection * @returns {Promise<*|*[]>} */ -const attributesToCreate = async (remoteAttributes, localAttributes, collection) => { +const attributesToCreate = async (remoteAttributes, localAttributes, collection, isIndex = false) => { const deleting = remoteAttributes.filter((attribute) => !attributesContains(attribute, localAttributes)).map((attr) => generateChangesObject(attr, collection, false)); const adding = localAttributes.filter((attribute) => !attributesContains(attribute, remoteAttributes)).map((attr) => generateChangesObject(attr, collection, true)); @@ -626,14 +759,14 @@ const attributesToCreate = async (remoteAttributes, localAttributes, collection) })); if (!cliConfig.force) { - if (deleting.length > 0) { + if (deleting.length > 0 && !isIndex) { log(`Attribute deletion will cause ${chalk.red('loss of data')}`); } - if (conflicts.length > 0) { + if (conflicts.length > 0 && !isIndex) { log(`Attribute recreation will cause ${chalk.red('loss of data')}`); } - const answers = await inquirer.prompt(questionsPushCollections[1]); + const answers = await inquirer.prompt(questionPushChanges); if (answers.changes.toLowerCase() !== 'yes') { return changedAttributes; @@ -642,17 +775,17 @@ const attributesToCreate = async (remoteAttributes, localAttributes, collection) if (conflicts.length > 0) { changedAttributes = conflicts.map((change) => change.attribute); - await Promise.all(changedAttributes.map((changed) => deleteAttribute(collection, changed))); + await Promise.all(changedAttributes.map((changed) => deleteAttribute(collection, changed, isIndex))); remoteAttributes = remoteAttributes.filter((attribute) => !attributesContains(attribute, changedAttributes)) } if (changes.length > 0) { changedAttributes = changes.map((change) => change.attribute); - await Promise.all(changedAttributes.map((changed) => updateAttribute(collection['databaseId'],collection['$id'], changed))); + await Promise.all(changedAttributes.map((changed) => updateAttribute(collection['databaseId'], collection['$id'], changed))); } const deletingAttributes = deleting.map((change) => change.attribute); - await Promise.all(deletingAttributes.map((attribute) => deleteAttribute(collection, attribute))); + await Promise.all(deletingAttributes.map((attribute) => deleteAttribute(collection, attribute, isIndex))); const attributeKeys = [...remoteAttributes.map(attribute => attribute.key), ...deletingAttributes.map(attribute => attribute.key)] if (attributeKeys.length) { @@ -737,6 +870,37 @@ const pushResources = async () => { }; const pushSettings = async () => { + checkDeployConditions(localConfig); + + try { + let response = await projectsGet({ + parseOutput: false, + projectId: localConfig.getProject().projectId + }); + + const remoteSettings = localConfig.createSettingsObject(response ?? {}); + const localSettings = localConfig.getProject().projectSettings ?? {}; + + log('Checking for changes'); + const changes = []; + + changes.push(...(getObjectChanges(remoteSettings, localSettings, 'services', 'Service'))); + changes.push(...(getObjectChanges(remoteSettings['auth'] ?? {}, localSettings['auth'] ?? {}, 'methods', 'Auth method'))); + changes.push(...(getObjectChanges(remoteSettings['auth'] ?? {}, localSettings['auth'] ?? {}, 'security', 'Auth security'))); + + if (changes.length > 0) { + drawTable(changes); + if (!cliConfig.force) { + const answers = await inquirer.prompt(questionPushChanges); + if (answers.changes.toLowerCase() !== 'yes') { + success(`Successfully pushed 0 project settings.`); + return; + } + } + } + } catch (e) { + } + try { log("Pushing project settings ..."); @@ -796,9 +960,7 @@ const pushSettings = async () => { } } -const pushFunction = async ({ functionId, async, returnOnZero } = { returnOnZero: false }) => { - let response = {}; - +const pushFunction = async ({ functionId, async, code } = { returnOnZero: false }) => { const functionIds = []; if (functionId) { @@ -806,11 +968,6 @@ const pushFunction = async ({ functionId, async, returnOnZero } = { returnOnZero } else if (cliConfig.all) { checkDeployConditions(localConfig); const functions = localConfig.getFunctions(); - if (functions.length === 0) { - log("No functions found."); - hint("Use 'appwrite pull functions' to synchronize existing one, or use 'appwrite init function' to create a new one."); - return; - } functionIds.push(...functions.map((func) => { return func.$id; })); @@ -818,7 +975,15 @@ const pushFunction = async ({ functionId, async, returnOnZero } = { returnOnZero if (functionIds.length <= 0) { const answers = await inquirer.prompt(questionsPushFunctions[0]); - functionIds.push(...answers.functions); + if (answers.functions) { + functionIds.push(...answers.functions); + } + } + + if (functionIds.length === 0) { + log("No functions found."); + hint("Use 'appwrite pull functions' to synchronize existing one, or use 'appwrite init function' to create a new one."); + return; } let functions = functionIds.map((id) => { @@ -844,6 +1009,10 @@ const pushFunction = async ({ functionId, async, returnOnZero } = { returnOnZero } } + if (!(await approveChanges(functions, functionsGet, KeysFunction, 'functionId', 'functions'))) { + return; + } + log('Pushing functions ...'); Spinner.start(false); @@ -852,6 +1021,8 @@ const pushFunction = async ({ functionId, async, returnOnZero } = { returnOnZero const failedDeployments = []; await Promise.all(functions.map(async (func) => { + let response = {}; + const ignore = func.ignore ? 'appwrite.json' : '.gitignore'; let functionExists = false; let deploymentCreated = false; @@ -859,7 +1030,6 @@ const pushFunction = async ({ functionId, async, returnOnZero } = { returnOnZero const updaterRow = new Spinner({ status: '', resource: func.name, id: func['$id'], end: `Ignoring using: ${ignore}` }); updaterRow.update({ status: 'Getting' }).startSpinner(SPINNER_DOTS); - try { response = await functionsGet({ functionId: func['$id'], @@ -930,6 +1100,14 @@ const pushFunction = async ({ functionId, async, returnOnZero } = { returnOnZero } } + if (code === false) { + successfullyPushed++; + successfullyDeployed++; + updaterRow.update({ status: 'Pushed' }); + updaterRow.stopSpinner(); + return; + } + try { updaterRow.update({ status: 'Pushing' }).replaceSpinner(SPINNER_ARC); response = await functionsCreateDeployment({ @@ -961,11 +1139,6 @@ const pushFunction = async ({ functionId, async, returnOnZero } = { returnOnZero let pollChecks = 0; while (true) { - if (pollChecks >= POLL_MAX_DEBOUNCE) { - updaterRow.update({ end: 'Deployment is taking too long. Please check the console for more details.' }) - break; - } - response = await functionsGetDeployment({ functionId: func['$id'], deploymentId: deploymentId, @@ -1004,7 +1177,7 @@ const pushFunction = async ({ functionId, async, returnOnZero } = { returnOnZero } pollChecks++; - await new Promise(resolve => setTimeout(resolve, POLL_DEBOUNCE)); + await new Promise(resolve => setTimeout(resolve, POLL_DEBOUNCE * 1.5)); } } catch (e) { updaterRow.fail({ errorMessage: e.message ?? 'Unknown error occurred. Please try again' }) @@ -1018,15 +1191,15 @@ const pushFunction = async ({ functionId, async, returnOnZero } = { returnOnZero failedDeployments.forEach((failed) => { const { name, deployment, $id } = failed; - const failUrl = `${globalConfig.getEndpoint().replace('/v1', '')}/console/project-${localConfig.getProject().projectId}/functions/function-${$id}/deployment-${deployment}`; + const failUrl = `${globalConfig.getEndpoint().slice(0, -3)}/console/project-${localConfig.getProject().projectId}/functions/function-${$id}/deployment-${deployment}`; error(`Deployment of ${name} has failed. Check at ${failUrl} for more details\n`); }); if (!async) { - if(successfullyPushed === 0) { + if (successfullyPushed === 0) { error('No functions were pushed.'); - } else if(successfullyDeployed != successfullyPushed) { + } else if (successfullyDeployed !== successfullyPushed) { warn(`Successfully pushed ${successfullyDeployed} of ${successfullyPushed} functions`) } else { success(`Successfully pushed ${successfullyPushed} functions.`); @@ -1036,28 +1209,36 @@ const pushFunction = async ({ functionId, async, returnOnZero } = { returnOnZero } } -const pushCollection = async ({ returnOnZero } = { returnOnZero: false }) => { +const pushCollection = async ({ returnOnZero, attempts } = { returnOnZero: false }) => { const collections = []; + if (attempts) { + pollMaxDebounces = attempts; + } + if (cliConfig.all) { checkDeployConditions(localConfig); - if (localConfig.getCollections().length === 0) { - log("No collections found."); - hint("Use 'appwrite pull collections' to synchronize existing one, or use 'appwrite init collection' to create a new one."); - return; - } collections.push(...localConfig.getCollections()); } else { - const answers = await inquirer.prompt(questionsPushCollections[0]) - const configCollections = new Map(); - localConfig.getCollections().forEach((c) => { - configCollections.set(`${c['databaseId']}|${c['$id']}`, c); - }); - answers.collections.forEach((a) => { - const collection = configCollections.get(a); - collections.push(collection); - }) + const answers = await inquirer.prompt(questionsPushCollections) + if (answers.collections) { + const configCollections = new Map(); + localConfig.getCollections().forEach((c) => { + configCollections.set(`${c['databaseId']}|${c['$id']}`, c); + }); + answers.collections.forEach((a) => { + const collection = configCollections.get(a); + collections.push(collection); + }) + } + } + + if (collections.length === 0) { + log("No collections found."); + hint("Use 'appwrite pull collections' to synchronize existing one, or use 'appwrite init collection' to create a new one."); + return; } + const databases = Array.from(new Set(collections.map(collection => collection['databaseId']))); log('Checking for changes ...'); @@ -1132,17 +1313,20 @@ const pushCollection = async ({ returnOnZero } = { returnOnZero: false }) => { } } })) - + let numberOfCollections = 0; // Serialize attribute actions for (let collection of collections) { let attributes = collection.attributes; + let indexes = collection.indexes; if (collection.isExisted) { attributes = await attributesToCreate(collection.remoteVersion.attributes, collection.attributes, collection); + indexes = await attributesToCreate(collection.remoteVersion.indexes, collection.indexes, collection, true); - if (Array.isArray(attributes) && attributes.length <= 0) { + if ((Array.isArray(attributes) && attributes.length <= 0) && (Array.isArray(indexes) && indexes.length <= 0)) { continue; } + } log(`Pushing collection ${collection.name} ( ${collection['databaseId']} - ${collection['$id']} ) attributes`) @@ -1154,13 +1338,15 @@ const pushCollection = async ({ returnOnZero } = { returnOnZero: false }) => { } try { - await createIndexes(collection.indexes, collection); + await createIndexes(indexes, collection); } catch (e) { throw e; } - + numberOfCollections++; success(`Pushed ${collection.name} ( ${collection['$id']} )`); } + + success(`Pushed ${numberOfCollections} collections`); } const pushBucket = async ({ returnOnZero } = { returnOnZero: false }) => { @@ -1171,17 +1357,20 @@ const pushBucket = async ({ returnOnZero } = { returnOnZero: false }) => { if (cliConfig.all) { checkDeployConditions(localConfig); - if (configBuckets.length === 0) { - log("No buckets found."); - hint("Use 'appwrite pull buckets' to synchronize existing one, or use 'appwrite init bucket' to create a new one."); - return; - } bucketIds.push(...configBuckets.map((b) => b.$id)); } if (bucketIds.length === 0) { const answers = await inquirer.prompt(questionsPushBuckets[0]) - bucketIds.push(...answers.buckets); + if (answers.buckets) { + bucketIds.push(...answers.buckets); + } + } + + if (bucketIds.length === 0) { + log("No buckets found."); + hint("Use 'appwrite pull buckets' to synchronize existing one, or use 'appwrite init bucket' to create a new one."); + return; } let buckets = []; @@ -1191,6 +1380,10 @@ const pushBucket = async ({ returnOnZero } = { returnOnZero: false }) => { buckets.push(...idBuckets); } + if (!(await approveChanges(buckets, storageGetBucket, KeysStorage, 'bucketId', 'buckets'))) { + return; + } + log('Pushing buckets ...'); for (let bucket of buckets) { @@ -1249,16 +1442,20 @@ const pushTeam = async ({ returnOnZero } = { returnOnZero: false }) => { if (cliConfig.all) { checkDeployConditions(localConfig); - if (configTeams.length === 0) { - log("No teams found."); - hint("Use 'appwrite pull teams' to synchronize existing one, or use 'appwrite init team' to create a new one."); - } teamIds.push(...configTeams.map((t) => t.$id)); } if (teamIds.length === 0) { const answers = await inquirer.prompt(questionsPushTeams[0]) - teamIds.push(...answers.teams); + if (answers.teams) { + teamIds.push(...answers.teams); + } + } + + if (teamIds.length === 0) { + log("No teams found."); + hint("Use 'appwrite pull teams' to synchronize existing one, or use 'appwrite init team' to create a new one."); + return; } let teams = []; @@ -1268,6 +1465,11 @@ const pushTeam = async ({ returnOnZero } = { returnOnZero: false }) => { teams.push(...idTeams); } + if (!(await approveChanges(teams, teamsGet, KeysTeams, 'teamId', 'teams'))) { + return; + } + + log('Pushing teams ...'); for (let team of teams) { @@ -1311,16 +1513,20 @@ const pushMessagingTopic = async ({ returnOnZero } = { returnOnZero: false }) => if (cliConfig.all) { checkDeployConditions(localConfig); - if (configTopics.length === 0) { - log("No topics found."); - hint("Use 'appwrite pull topics' to synchronize existing one, or use 'appwrite init topic' to create a new one."); - } topicsIds.push(...configTopics.map((b) => b.$id)); } if (topicsIds.length === 0) { const answers = await inquirer.prompt(questionsPushMessagingTopics[0]) - topicsIds.push(...answers.topics); + if (answers.topics) { + topicsIds.push(...answers.topics); + } + } + + if (topicsIds.length === 0) { + log("No topics found."); + hint("Use 'appwrite pull topics' to synchronize existing one, or use 'appwrite init topic' to create a new one."); + return; } let topics = []; @@ -1337,6 +1543,10 @@ const pushMessagingTopic = async ({ returnOnZero } = { returnOnZero: false }) => } } + if (!(await approveChanges(topics, messagingGetTopic, KeysTopics, 'topicId', 'topics'))) { + return; + } + log('Pushing topics ...'); for (let topic of topics) { @@ -1402,14 +1612,16 @@ push .command("function") .alias("functions") .description("Push functions in the current directory.") - .option(`-f, --functionId <functionId>`, `Function ID`) + .option(`-f, --function-id <function-id>`, `ID of function to run`) .option(`-A, --async`, `Don't wait for functions deployments status`) + .option("--no-code", "Don't push the function's code") .action(actionRunner(pushFunction)); push .command("collection") .alias("collections") .description("Push collections in the current project.") + .option(`-a, --attempts <numberOfAttempts>`, `Max number of attempts before timing out. default: 30.`) .action(actionRunner(pushCollection)); push diff --git a/lib/commands/run.js b/lib/commands/run.js index 0ea914a..a44eb11 100644 --- a/lib/commands/run.js +++ b/lib/commands/run.js @@ -1,4 +1,5 @@ const Tail = require('tail').Tail; +const { parse: parseDotenv } = require('dotenv'); const chalk = require('chalk'); const ignore = require("ignore"); const tar = require("tar"); @@ -80,6 +81,7 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } = entrypoint: func.entrypoint, path: func.path, commands: func.commands, + scopes: func.scopes ?? [] }; drawTable([settings]); @@ -110,7 +112,9 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } = fs.writeFileSync(errorsPath, ''); } + const userVariables = {}; const variables = {}; + if(!noVariables) { try { const { variables: remoteVariables } = await paginate(functionsListVariables, { @@ -120,12 +124,24 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } = remoteVariables.forEach((v) => { variables[v.key] = v.value; + userVariables[v.key] = v.value; }); } catch(err) { warn("Remote variables not fetched. Production environment variables will not be avaiable. Reason: " + err.message); } } + const functionPath = path.join(process.cwd(), func.path); + const envPath = path.join(functionPath, '.env'); + if(fs.existsSync(envPath)) { + const env = parseDotenv(fs.readFileSync(envPath).toString() ?? ''); + + Object.keys(env).forEach((key) => { + variables[key] = env[key]; + userVariables[key] = env[key]; + }); + } + variables['APPWRITE_FUNCTION_API_ENDPOINT'] = globalConfig.getFrom('endpoint'); variables['APPWRITE_FUNCTION_ID'] = func.$id; variables['APPWRITE_FUNCTION_NAME'] = func.name; @@ -148,6 +164,13 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } = headers['x-appwrite-user-jwt'] = JwtManager.userJwt ?? ''; variables['OPEN_RUNTIMES_HEADERS'] = JSON.stringify(headers); + if(Object.keys(userVariables).length > 0) { + drawTable(Object.keys(userVariables).map((key) => ({ + key, + value: userVariables[key].split("").filter((_, i) => i < 16).map(() => "*").join("") + }))); + } + await dockerPull(func); new Tail(logsPath).on("line", function(data) { @@ -158,10 +181,27 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } = }); if(!noReload) { + const ignorer = ignore(); + ignorer.add('.appwrite'); + ignorer.add('code.tar.gz'); + + if (func.ignore) { + ignorer.add(func.ignore); + } else if (fs.existsSync(path.join(functionPath, '.gitignore'))) { + ignorer.add(fs.readFileSync(path.join(functionPath, '.gitignore')).toString()); + } + chokidar.watch('.', { cwd: path.join(process.cwd(), func.path), ignoreInitial: true, - ignored: [ ...(func.ignore ?? []), 'code.tar.gz', '.appwrite', '.appwrite/', '.appwrite/*', '.appwrite/**', '.appwrite/*.*', '.appwrite/**/*.*' ] + ignored: (xpath) => { + const relativePath = path.relative(functionPath, xpath); + + if(!relativePath) { + return false; + } + return ignorer.ignores(relativePath); + } }).on('all', async (_event, filePath) => { Queue.push(filePath); }); @@ -187,7 +227,6 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } = } else { log('Hot-swapping function.. Files with change are ' + files.join(', ')); - const functionPath = path.join(process.cwd(), func.path); const hotSwapPath = path.join(functionPath, '.appwrite/hot-swap'); const buildPath = path.join(functionPath, '.appwrite/build.tar.gz'); @@ -201,6 +240,7 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } = await tar .extract({ + keep: true, gzip: true, sync: true, cwd: hotSwapPath, @@ -211,6 +251,8 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } = ignorer.add('.appwrite'); if (func.ignore) { ignorer.add(func.ignore); + } else if (fs.existsSync(path.join(functionPath, '.gitignore'))) { + ignorer.add(fs.readFileSync(path.join(functionPath, '.gitignore')).toString()); } const filesToCopy = getAllFiles(functionPath).map((file) => path.relative(functionPath, file)).filter((file) => !ignorer.ignores(file)); @@ -237,8 +279,6 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } = file: buildPath }, ['.']); - fs.rmSync(hotSwapPath, { recursive: true, force: true }); - await dockerStart(func, variables, port); } } catch(err) { @@ -278,11 +318,11 @@ run .command("function") .alias("functions") .description("Run functions in the current directory.") - .option(`--functionId <functionId>`, `Function ID`) + .option(`--function-id <function-id>`, `ID of function to run`) .option(`--port <port>`, `Local port`) - .option(`--userId <userId>`, `ID of user to impersonate`) - .option(`--noVariables`, `Prevent pulling variables from function settings`) - .option(`--noReload`, `Prevent live reloading of server when changes are made to function files`) + .option(`--user-id <user-id>`, `ID of user to impersonate`) + .option(`--no-variables`, `Prevent pulling variables from function settings`) + .option(`--no-reload`, `Prevent live reloading of server when changes are made to function files`) .action(actionRunner(runFunction)); module.exports = { diff --git a/lib/commands/storage.js b/lib/commands/storage.js index 4dca398..00102b4 100644 --- a/lib/commands/storage.js +++ b/lib/commands/storage.js @@ -838,7 +838,7 @@ const storageGetBucketUsage = async ({bucketId,range,parseOutput = true, overrid } storage - .command(`listBuckets`) + .command(`list-buckets`) .description(`Get a list of all the storage buckets. You can use the query params to filter your results.`) .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: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus`) .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`) @@ -846,110 +846,110 @@ storage .action(actionRunner(storageListBuckets)) storage - .command(`createBucket`) + .command(`create-bucket`) .description(`Create a new storage bucket.`) - .requiredOption(`--bucketId <bucketId>`, `Unique 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.`) + .requiredOption(`--bucket-id <bucket-id>`, `Unique 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.`) .requiredOption(`--name <name>`, `Bucket name`) .option(`--permissions [permissions...]`, `An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).`) - .option(`--fileSecurity <fileSecurity>`, `Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).`, parseBool) + .option(`--file-security <file-security>`, `Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).`, parseBool) .option(`--enabled <enabled>`, `Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.`, parseBool) - .option(`--maximumFileSize <maximumFileSize>`, `Maximum file size allowed in bytes. Maximum allowed value is 30MB.`, parseInteger) - .option(`--allowedFileExtensions [allowedFileExtensions...]`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`) + .option(`--maximum-file-size <maximum-file-size>`, `Maximum file size allowed in bytes. Maximum allowed value is 30MB.`, parseInteger) + .option(`--allowed-file-extensions [allowed-file-extensions...]`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`) .option(`--compression <compression>`, `Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled`) .option(`--encryption <encryption>`, `Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled`, parseBool) .option(`--antivirus <antivirus>`, `Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled`, parseBool) .action(actionRunner(storageCreateBucket)) storage - .command(`getBucket`) + .command(`get-bucket`) .description(`Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.`) - .requiredOption(`--bucketId <bucketId>`, `Bucket unique ID.`) + .requiredOption(`--bucket-id <bucket-id>`, `Bucket unique ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(storageGetBucket)) storage - .command(`updateBucket`) + .command(`update-bucket`) .description(`Update a storage bucket by its unique ID.`) - .requiredOption(`--bucketId <bucketId>`, `Bucket unique ID.`) + .requiredOption(`--bucket-id <bucket-id>`, `Bucket unique ID.`) .requiredOption(`--name <name>`, `Bucket name`) .option(`--permissions [permissions...]`, `An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`) - .option(`--fileSecurity <fileSecurity>`, `Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).`, parseBool) + .option(`--file-security <file-security>`, `Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).`, parseBool) .option(`--enabled <enabled>`, `Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.`, parseBool) - .option(`--maximumFileSize <maximumFileSize>`, `Maximum file size allowed in bytes. Maximum allowed value is 30MB.`, parseInteger) - .option(`--allowedFileExtensions [allowedFileExtensions...]`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`) + .option(`--maximum-file-size <maximum-file-size>`, `Maximum file size allowed in bytes. Maximum allowed value is 30MB.`, parseInteger) + .option(`--allowed-file-extensions [allowed-file-extensions...]`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`) .option(`--compression <compression>`, `Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled`) .option(`--encryption <encryption>`, `Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled`, parseBool) .option(`--antivirus <antivirus>`, `Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled`, parseBool) .action(actionRunner(storageUpdateBucket)) storage - .command(`deleteBucket`) + .command(`delete-bucket`) .description(`Delete a storage bucket by its unique ID.`) - .requiredOption(`--bucketId <bucketId>`, `Bucket unique ID.`) + .requiredOption(`--bucket-id <bucket-id>`, `Bucket unique ID.`) .action(actionRunner(storageDeleteBucket)) storage - .command(`listFiles`) + .command(`list-files`) .description(`Get a list of all the user files. You can use the query params to filter your results.`) - .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`) + .requiredOption(`--bucket-id <bucket-id>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`) .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, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded`) .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(storageListFiles)) storage - .command(`createFile`) + .command(`create-file`) .description(`Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console. Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of '5MB'. The 'content-range' header values should always be in bytes. When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in 'x-appwrite-id' header to allow the server to know that the partial upload is for the existing file and not for a new one. If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. `) - .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`) - .requiredOption(`--fileId <fileId>`, `File 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.`) + .requiredOption(`--bucket-id <bucket-id>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`) + .requiredOption(`--file-id <file-id>`, `File 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.`) .requiredOption(`--file <file>`, `Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file).`) .option(`--permissions [permissions...]`, `An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).`) .action(actionRunner(storageCreateFile)) storage - .command(`getFile`) + .command(`get-file`) .description(`Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.`) - .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`) - .requiredOption(`--fileId <fileId>`, `File ID.`) + .requiredOption(`--bucket-id <bucket-id>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`) + .requiredOption(`--file-id <file-id>`, `File ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(storageGetFile)) storage - .command(`updateFile`) + .command(`update-file`) .description(`Update a file by its unique ID. Only users with write permissions have access to update this resource.`) - .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`) - .requiredOption(`--fileId <fileId>`, `File unique ID.`) + .requiredOption(`--bucket-id <bucket-id>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`) + .requiredOption(`--file-id <file-id>`, `File unique ID.`) .option(`--name <name>`, `Name of the file`) .option(`--permissions [permissions...]`, `An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`) .action(actionRunner(storageUpdateFile)) storage - .command(`deleteFile`) + .command(`delete-file`) .description(`Delete a file by its unique ID. Only users with write permissions have access to delete this resource.`) - .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`) - .requiredOption(`--fileId <fileId>`, `File ID.`) + .requiredOption(`--bucket-id <bucket-id>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`) + .requiredOption(`--file-id <file-id>`, `File ID.`) .action(actionRunner(storageDeleteFile)) storage - .command(`getFileDownload`) + .command(`get-file-download`) .description(`Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.`) - .requiredOption(`--bucketId <bucketId>`, `Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`) - .requiredOption(`--fileId <fileId>`, `File ID.`) + .requiredOption(`--bucket-id <bucket-id>`, `Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`) + .requiredOption(`--file-id <file-id>`, `File ID.`) .requiredOption(`--destination <path>`, `output file path.`) .action(actionRunner(storageGetFileDownload)) storage - .command(`getFilePreview`) + .command(`get-file-preview`) .description(`Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB.`) - .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`) - .requiredOption(`--fileId <fileId>`, `File ID`) + .requiredOption(`--bucket-id <bucket-id>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`) + .requiredOption(`--file-id <file-id>`, `File ID`) .option(`--width <width>`, `Resize preview image width, Pass an integer between 0 to 4000.`, parseInteger) .option(`--height <height>`, `Resize preview image height, Pass an integer between 0 to 4000.`, parseInteger) .option(`--gravity <gravity>`, `Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right`) .option(`--quality <quality>`, `Preview image quality. Pass an integer between 0 to 100. Defaults to 100.`, parseInteger) - .option(`--borderWidth <borderWidth>`, `Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.`, parseInteger) - .option(`--borderColor <borderColor>`, `Preview image border color. Use a valid HEX color, no # is needed for prefix.`) - .option(`--borderRadius <borderRadius>`, `Preview image border radius in pixels. Pass an integer between 0 to 4000.`, parseInteger) + .option(`--border-width <border-width>`, `Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.`, parseInteger) + .option(`--border-color <border-color>`, `Preview image border color. Use a valid HEX color, no # is needed for prefix.`) + .option(`--border-radius <border-radius>`, `Preview image border radius in pixels. Pass an integer between 0 to 4000.`, parseInteger) .option(`--opacity <opacity>`, `Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.`, parseInteger) .option(`--rotation <rotation>`, `Preview image rotation in degrees. Pass an integer between -360 and 360.`, parseInteger) .option(`--background <background>`, `Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.`) @@ -958,23 +958,23 @@ storage .action(actionRunner(storageGetFilePreview)) storage - .command(`getFileView`) + .command(`get-file-view`) .description(`Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.`) - .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`) - .requiredOption(`--fileId <fileId>`, `File ID.`) + .requiredOption(`--bucket-id <bucket-id>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`) + .requiredOption(`--file-id <file-id>`, `File ID.`) .requiredOption(`--destination <path>`, `output file path.`) .action(actionRunner(storageGetFileView)) storage - .command(`getUsage`) + .command(`get-usage`) .description(``) .option(`--range <range>`, `Date range.`) .action(actionRunner(storageGetUsage)) storage - .command(`getBucketUsage`) + .command(`get-bucket-usage`) .description(``) - .requiredOption(`--bucketId <bucketId>`, `Bucket ID.`) + .requiredOption(`--bucket-id <bucket-id>`, `Bucket ID.`) .option(`--range <range>`, `Date range.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(storageGetBucketUsage)) diff --git a/lib/commands/teams.js b/lib/commands/teams.js index 39f1848..7ca5474 100644 --- a/lib/commands/teams.js +++ b/lib/commands/teams.js @@ -587,7 +587,7 @@ teams teams .command(`create`) .description(`Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team.`) - .requiredOption(`--teamId <teamId>`, `Team 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.`) + .requiredOption(`--team-id <team-id>`, `Team 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.`) .requiredOption(`--name <name>`, `Team name. Max length: 128 chars.`) .option(`--roles [roles...]`, `Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.`) .action(actionRunner(teamsCreate)) @@ -595,91 +595,91 @@ teams teams .command(`get`) .description(`Get a team by its ID. All team members have read access for this resource.`) - .requiredOption(`--teamId <teamId>`, `Team ID.`) + .requiredOption(`--team-id <team-id>`, `Team ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(teamsGet)) teams - .command(`updateName`) + .command(`update-name`) .description(`Update the team's name by its unique ID.`) - .requiredOption(`--teamId <teamId>`, `Team ID.`) + .requiredOption(`--team-id <team-id>`, `Team ID.`) .requiredOption(`--name <name>`, `New team name. Max length: 128 chars.`) .action(actionRunner(teamsUpdateName)) teams .command(`delete`) .description(`Delete a team using its ID. Only team members with the owner role can delete the team.`) - .requiredOption(`--teamId <teamId>`, `Team ID.`) + .requiredOption(`--team-id <team-id>`, `Team ID.`) .action(actionRunner(teamsDelete)) teams - .command(`listLogs`) + .command(`list-logs`) .description(`Get the team activity logs list by its unique ID.`) - .requiredOption(`--teamId <teamId>`, `Team ID.`) + .requiredOption(`--team-id <team-id>`, `Team ID.`) .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). Only supported methods are limit and offset`) .action(actionRunner(teamsListLogs)) teams - .command(`listMemberships`) + .command(`list-memberships`) .description(`Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint.`) - .requiredOption(`--teamId <teamId>`, `Team ID.`) + .requiredOption(`--team-id <team-id>`, `Team ID.`) .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: userId, teamId, invited, joined, confirm`) .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`) .action(actionRunner(teamsListMemberships)) teams - .command(`createMembership`) + .command(`create-membership`) .description(`Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team. You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters. Use the 'url' parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. `) - .requiredOption(`--teamId <teamId>`, `Team ID.`) + .requiredOption(`--team-id <team-id>`, `Team ID.`) .requiredOption(`--roles [roles...]`, `Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.`) .option(`--email <email>`, `Email of the new team member.`) - .option(`--userId <userId>`, `ID of the user to be added to a team.`) + .option(`--user-id <user-id>`, `ID of the user to be added to a team.`) .option(`--phone <phone>`, `Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.`) .option(`--url <url>`, `URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`) .option(`--name <name>`, `Name of the new team member. Max length: 128 chars.`) .action(actionRunner(teamsCreateMembership)) teams - .command(`getMembership`) + .command(`get-membership`) .description(`Get a team member by the membership unique id. All team members have read access for this resource.`) - .requiredOption(`--teamId <teamId>`, `Team ID.`) - .requiredOption(`--membershipId <membershipId>`, `Membership ID.`) + .requiredOption(`--team-id <team-id>`, `Team ID.`) + .requiredOption(`--membership-id <membership-id>`, `Membership ID.`) .action(actionRunner(teamsGetMembership)) teams - .command(`updateMembership`) + .command(`update-membership`) .description(`Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). `) - .requiredOption(`--teamId <teamId>`, `Team ID.`) - .requiredOption(`--membershipId <membershipId>`, `Membership ID.`) + .requiredOption(`--team-id <team-id>`, `Team ID.`) + .requiredOption(`--membership-id <membership-id>`, `Membership ID.`) .requiredOption(`--roles [roles...]`, `An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.`) .action(actionRunner(teamsUpdateMembership)) teams - .command(`deleteMembership`) + .command(`delete-membership`) .description(`This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted.`) - .requiredOption(`--teamId <teamId>`, `Team ID.`) - .requiredOption(`--membershipId <membershipId>`, `Membership ID.`) + .requiredOption(`--team-id <team-id>`, `Team ID.`) + .requiredOption(`--membership-id <membership-id>`, `Membership ID.`) .action(actionRunner(teamsDeleteMembership)) teams - .command(`updateMembershipStatus`) + .command(`update-membership-status`) .description(`Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user. If the request is successful, a session for the user is automatically created. `) - .requiredOption(`--teamId <teamId>`, `Team ID.`) - .requiredOption(`--membershipId <membershipId>`, `Membership ID.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--team-id <team-id>`, `Team ID.`) + .requiredOption(`--membership-id <membership-id>`, `Membership ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .requiredOption(`--secret <secret>`, `Secret key.`) .action(actionRunner(teamsUpdateMembershipStatus)) teams - .command(`getPrefs`) + .command(`get-prefs`) .description(`Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).`) - .requiredOption(`--teamId <teamId>`, `Team ID.`) + .requiredOption(`--team-id <team-id>`, `Team ID.`) .action(actionRunner(teamsGetPrefs)) teams - .command(`updatePrefs`) + .command(`update-prefs`) .description(`Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded.`) - .requiredOption(`--teamId <teamId>`, `Team ID.`) + .requiredOption(`--team-id <team-id>`, `Team ID.`) .requiredOption(`--prefs <prefs>`, `Prefs key-value JSON object.`) .action(actionRunner(teamsUpdatePrefs)) diff --git a/lib/commands/users.js b/lib/commands/users.js index 42f4ea3..9d13ed7 100644 --- a/lib/commands/users.js +++ b/lib/commands/users.js @@ -1717,7 +1717,7 @@ users users .command(`create`) .description(`Create a new user.`) - .requiredOption(`--userId <userId>`, `User 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.`) + .requiredOption(`--user-id <user-id>`, `User 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.`) .option(`--email <email>`, `User email.`) .option(`--phone <phone>`, `Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.`) .option(`--password <password>`, `Plain text user password. Must be at least 8 chars.`) @@ -1725,92 +1725,92 @@ users .action(actionRunner(usersCreate)) users - .command(`createArgon2User`) + .command(`create-argon-2-user`) .description(`Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.`) - .requiredOption(`--userId <userId>`, `User 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.`) + .requiredOption(`--user-id <user-id>`, `User 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.`) .requiredOption(`--email <email>`, `User email.`) .requiredOption(`--password <password>`, `User password hashed using Argon2.`) .option(`--name <name>`, `User name. Max length: 128 chars.`) .action(actionRunner(usersCreateArgon2User)) users - .command(`createBcryptUser`) + .command(`create-bcrypt-user`) .description(`Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.`) - .requiredOption(`--userId <userId>`, `User 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.`) + .requiredOption(`--user-id <user-id>`, `User 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.`) .requiredOption(`--email <email>`, `User email.`) .requiredOption(`--password <password>`, `User password hashed using Bcrypt.`) .option(`--name <name>`, `User name. Max length: 128 chars.`) .action(actionRunner(usersCreateBcryptUser)) users - .command(`listIdentities`) + .command(`list-identities`) .description(`Get identities for all users.`) .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: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry`) .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`) .action(actionRunner(usersListIdentities)) users - .command(`deleteIdentity`) + .command(`delete-identity`) .description(`Delete an identity by its unique ID.`) - .requiredOption(`--identityId <identityId>`, `Identity ID.`) + .requiredOption(`--identity-id <identity-id>`, `Identity ID.`) .action(actionRunner(usersDeleteIdentity)) users - .command(`createMD5User`) + .command(`create-md-5-user`) .description(`Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.`) - .requiredOption(`--userId <userId>`, `User 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.`) + .requiredOption(`--user-id <user-id>`, `User 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.`) .requiredOption(`--email <email>`, `User email.`) .requiredOption(`--password <password>`, `User password hashed using MD5.`) .option(`--name <name>`, `User name. Max length: 128 chars.`) .action(actionRunner(usersCreateMD5User)) users - .command(`createPHPassUser`) + .command(`create-ph-pass-user`) .description(`Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.`) - .requiredOption(`--userId <userId>`, `User ID. Choose a custom ID or pass the string 'ID.unique()'to auto generate it. 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.`) + .requiredOption(`--user-id <user-id>`, `User ID. Choose a custom ID or pass the string 'ID.unique()'to auto generate it. 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.`) .requiredOption(`--email <email>`, `User email.`) .requiredOption(`--password <password>`, `User password hashed using PHPass.`) .option(`--name <name>`, `User name. Max length: 128 chars.`) .action(actionRunner(usersCreatePHPassUser)) users - .command(`createScryptUser`) + .command(`create-scrypt-user`) .description(`Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.`) - .requiredOption(`--userId <userId>`, `User 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.`) + .requiredOption(`--user-id <user-id>`, `User 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.`) .requiredOption(`--email <email>`, `User email.`) .requiredOption(`--password <password>`, `User password hashed using Scrypt.`) - .requiredOption(`--passwordSalt <passwordSalt>`, `Optional salt used to hash password.`) - .requiredOption(`--passwordCpu <passwordCpu>`, `Optional CPU cost used to hash password.`, parseInteger) - .requiredOption(`--passwordMemory <passwordMemory>`, `Optional memory cost used to hash password.`, parseInteger) - .requiredOption(`--passwordParallel <passwordParallel>`, `Optional parallelization cost used to hash password.`, parseInteger) - .requiredOption(`--passwordLength <passwordLength>`, `Optional hash length used to hash password.`, parseInteger) + .requiredOption(`--password-salt <password-salt>`, `Optional salt used to hash password.`) + .requiredOption(`--password-cpu <password-cpu>`, `Optional CPU cost used to hash password.`, parseInteger) + .requiredOption(`--password-memory <password-memory>`, `Optional memory cost used to hash password.`, parseInteger) + .requiredOption(`--password-parallel <password-parallel>`, `Optional parallelization cost used to hash password.`, parseInteger) + .requiredOption(`--password-length <password-length>`, `Optional hash length used to hash password.`, parseInteger) .option(`--name <name>`, `User name. Max length: 128 chars.`) .action(actionRunner(usersCreateScryptUser)) users - .command(`createScryptModifiedUser`) + .command(`create-scrypt-modified-user`) .description(`Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.`) - .requiredOption(`--userId <userId>`, `User 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.`) + .requiredOption(`--user-id <user-id>`, `User 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.`) .requiredOption(`--email <email>`, `User email.`) .requiredOption(`--password <password>`, `User password hashed using Scrypt Modified.`) - .requiredOption(`--passwordSalt <passwordSalt>`, `Salt used to hash password.`) - .requiredOption(`--passwordSaltSeparator <passwordSaltSeparator>`, `Salt separator used to hash password.`) - .requiredOption(`--passwordSignerKey <passwordSignerKey>`, `Signer key used to hash password.`) + .requiredOption(`--password-salt <password-salt>`, `Salt used to hash password.`) + .requiredOption(`--password-salt-separator <password-salt-separator>`, `Salt separator used to hash password.`) + .requiredOption(`--password-signer-key <password-signer-key>`, `Signer key used to hash password.`) .option(`--name <name>`, `User name. Max length: 128 chars.`) .action(actionRunner(usersCreateScryptModifiedUser)) users - .command(`createSHAUser`) + .command(`create-sha-user`) .description(`Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.`) - .requiredOption(`--userId <userId>`, `User 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.`) + .requiredOption(`--user-id <user-id>`, `User 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.`) .requiredOption(`--email <email>`, `User email.`) .requiredOption(`--password <password>`, `User password hashed using SHA.`) - .option(`--passwordVersion <passwordVersion>`, `Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512'`) + .option(`--password-version <password-version>`, `Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512'`) .option(`--name <name>`, `User name. Max length: 128 chars.`) .action(actionRunner(usersCreateSHAUser)) users - .command(`getUsage`) + .command(`get-usage`) .description(``) .option(`--range <range>`, `Date range.`) .action(actionRunner(usersGetUsage)) @@ -1818,218 +1818,218 @@ users users .command(`get`) .description(`Get a user by its unique ID.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(usersGet)) users .command(`delete`) .description(`Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .action(actionRunner(usersDelete)) users - .command(`updateEmail`) + .command(`update-email`) .description(`Update the user email by its unique ID.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .requiredOption(`--email <email>`, `User email.`) .action(actionRunner(usersUpdateEmail)) users - .command(`createJWT`) + .command(`create-jwt`) .description(`Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted.`) - .requiredOption(`--userId <userId>`, `User ID.`) - .option(`--sessionId <sessionId>`, `Session ID. Use the string 'recent' to use the most recent session. Defaults to the most recent session.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) + .option(`--session-id <session-id>`, `Session ID. Use the string 'recent' to use the most recent session. Defaults to the most recent session.`) .option(`--duration <duration>`, `Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.`, parseInteger) .action(actionRunner(usersCreateJWT)) users - .command(`updateLabels`) + .command(`update-labels`) .description(`Update the user labels by its unique ID. Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .requiredOption(`--labels [labels...]`, `Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long.`) .action(actionRunner(usersUpdateLabels)) users - .command(`listLogs`) + .command(`list-logs`) .description(`Get the user activity logs list by its unique ID.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .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). Only supported methods are limit and offset`) .action(actionRunner(usersListLogs)) users - .command(`listMemberships`) + .command(`list-memberships`) .description(`Get the user membership list by its unique ID.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .action(actionRunner(usersListMemberships)) users - .command(`updateMfa`) + .command(`update-mfa`) .description(`Enable or disable MFA on a user account.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .requiredOption(`--mfa <mfa>`, `Enable or disable MFA.`, parseBool) .action(actionRunner(usersUpdateMfa)) users - .command(`deleteMfaAuthenticator`) + .command(`delete-mfa-authenticator`) .description(`Delete an authenticator app.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .requiredOption(`--type <type>`, `Type of authenticator.`) .action(actionRunner(usersDeleteMfaAuthenticator)) users - .command(`listMfaFactors`) + .command(`list-mfa-factors`) .description(`List the factors available on the account to be used as a MFA challange.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .action(actionRunner(usersListMfaFactors)) users - .command(`getMfaRecoveryCodes`) + .command(`get-mfa-recovery-codes`) .description(`Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .action(actionRunner(usersGetMfaRecoveryCodes)) users - .command(`updateMfaRecoveryCodes`) + .command(`update-mfa-recovery-codes`) .description(`Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .action(actionRunner(usersUpdateMfaRecoveryCodes)) users - .command(`createMfaRecoveryCodes`) + .command(`create-mfa-recovery-codes`) .description(`Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .action(actionRunner(usersCreateMfaRecoveryCodes)) users - .command(`updateName`) + .command(`update-name`) .description(`Update the user name by its unique ID.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .requiredOption(`--name <name>`, `User name. Max length: 128 chars.`) .action(actionRunner(usersUpdateName)) users - .command(`updatePassword`) + .command(`update-password`) .description(`Update the user password by its unique ID.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .requiredOption(`--password <password>`, `New user password. Must be at least 8 chars.`) .action(actionRunner(usersUpdatePassword)) users - .command(`updatePhone`) + .command(`update-phone`) .description(`Update the user phone by its unique ID.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .requiredOption(`--number <number>`, `User phone number.`) .action(actionRunner(usersUpdatePhone)) users - .command(`getPrefs`) + .command(`get-prefs`) .description(`Get the user preferences by its unique ID.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .action(actionRunner(usersGetPrefs)) users - .command(`updatePrefs`) + .command(`update-prefs`) .description(`Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .requiredOption(`--prefs <prefs>`, `Prefs key-value JSON object.`) .action(actionRunner(usersUpdatePrefs)) users - .command(`listSessions`) + .command(`list-sessions`) .description(`Get the user sessions list by its unique ID.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .option(`--console`, `Get the resource console url`) .action(actionRunner(usersListSessions)) users - .command(`createSession`) + .command(`create-session`) .description(`Creates a session for a user. Returns an immediately usable session object. If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint.`) - .requiredOption(`--userId <userId>`, `User 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.`) + .requiredOption(`--user-id <user-id>`, `User 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.`) .action(actionRunner(usersCreateSession)) users - .command(`deleteSessions`) + .command(`delete-sessions`) .description(`Delete all user's sessions by using the user's unique ID.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .action(actionRunner(usersDeleteSessions)) users - .command(`deleteSession`) + .command(`delete-session`) .description(`Delete a user sessions by its unique ID.`) - .requiredOption(`--userId <userId>`, `User ID.`) - .requiredOption(`--sessionId <sessionId>`, `Session ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) + .requiredOption(`--session-id <session-id>`, `Session ID.`) .action(actionRunner(usersDeleteSession)) users - .command(`updateStatus`) + .command(`update-status`) .description(`Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .requiredOption(`--status <status>`, `User Status. To activate the user pass 'true' and to block the user pass 'false'.`, parseBool) .action(actionRunner(usersUpdateStatus)) users - .command(`listTargets`) + .command(`list-targets`) .description(`List the messaging targets that are associated with a user.`) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels`) .action(actionRunner(usersListTargets)) users - .command(`createTarget`) + .command(`create-target`) .description(`Create a messaging target.`) - .requiredOption(`--userId <userId>`, `User ID.`) - .requiredOption(`--targetId <targetId>`, `Target 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.`) - .requiredOption(`--providerType <providerType>`, `The target provider type. Can be one of the following: 'email', 'sms' or 'push'.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) + .requiredOption(`--target-id <target-id>`, `Target 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.`) + .requiredOption(`--provider-type <provider-type>`, `The target provider type. Can be one of the following: 'email', 'sms' or 'push'.`) .requiredOption(`--identifier <identifier>`, `The target identifier (token, email, phone etc.)`) - .option(`--providerId <providerId>`, `Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.`) + .option(`--provider-id <provider-id>`, `Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.`) .option(`--name <name>`, `Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23.`) .action(actionRunner(usersCreateTarget)) users - .command(`getTarget`) + .command(`get-target`) .description(`Get a user's push notification target by ID.`) - .requiredOption(`--userId <userId>`, `User ID.`) - .requiredOption(`--targetId <targetId>`, `Target ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) + .requiredOption(`--target-id <target-id>`, `Target ID.`) .action(actionRunner(usersGetTarget)) users - .command(`updateTarget`) + .command(`update-target`) .description(`Update a messaging target.`) - .requiredOption(`--userId <userId>`, `User ID.`) - .requiredOption(`--targetId <targetId>`, `Target ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) + .requiredOption(`--target-id <target-id>`, `Target ID.`) .option(`--identifier <identifier>`, `The target identifier (token, email, phone etc.)`) - .option(`--providerId <providerId>`, `Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.`) + .option(`--provider-id <provider-id>`, `Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.`) .option(`--name <name>`, `Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23.`) .action(actionRunner(usersUpdateTarget)) users - .command(`deleteTarget`) + .command(`delete-target`) .description(`Delete a messaging target.`) - .requiredOption(`--userId <userId>`, `User ID.`) - .requiredOption(`--targetId <targetId>`, `Target ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) + .requiredOption(`--target-id <target-id>`, `Target ID.`) .action(actionRunner(usersDeleteTarget)) users - .command(`createToken`) + .command(`create-token`) .description(`Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. `) - .requiredOption(`--userId <userId>`, `User ID.`) + .requiredOption(`--user-id <user-id>`, `User ID.`) .option(`--length <length>`, `Token length in characters. The default length is 6 characters`, parseInteger) .option(`--expire <expire>`, `Token expiration period in seconds. The default expiration is 15 minutes.`, parseInteger) .action(actionRunner(usersCreateToken)) users - .command(`updateEmailVerification`) + .command(`update-email-verification`) .description(`Update the user email verification status by its unique ID.`) - .requiredOption(`--userId <userId>`, `User ID.`) - .requiredOption(`--emailVerification <emailVerification>`, `User email verification status.`, parseBool) + .requiredOption(`--user-id <user-id>`, `User ID.`) + .requiredOption(`--email-verification <email-verification>`, `User email verification status.`, parseBool) .action(actionRunner(usersUpdateEmailVerification)) users - .command(`updatePhoneVerification`) + .command(`update-phone-verification`) .description(`Update the user phone verification status by its unique ID.`) - .requiredOption(`--userId <userId>`, `User ID.`) - .requiredOption(`--phoneVerification <phoneVerification>`, `User phone verification status.`, parseBool) + .requiredOption(`--user-id <user-id>`, `User ID.`) + .requiredOption(`--phone-verification <phone-verification>`, `User phone verification status.`, parseBool) .action(actionRunner(usersUpdatePhoneVerification)) module.exports = { diff --git a/lib/commands/vcs.js b/lib/commands/vcs.js index 44ae4ce..f548870 100644 --- a/lib/commands/vcs.js +++ b/lib/commands/vcs.js @@ -396,75 +396,75 @@ const vcsDeleteInstallation = async ({installationId,parseOutput = true, overrid } vcs - .command(`listRepositories`) + .command(`list-repositories`) .description(``) - .requiredOption(`--installationId <installationId>`, `Installation Id`) + .requiredOption(`--installation-id <installation-id>`, `Installation Id`) .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`) .action(actionRunner(vcsListRepositories)) vcs - .command(`createRepository`) + .command(`create-repository`) .description(``) - .requiredOption(`--installationId <installationId>`, `Installation Id`) + .requiredOption(`--installation-id <installation-id>`, `Installation Id`) .requiredOption(`--name <name>`, `Repository name (slug)`) .requiredOption(`--xprivate <xprivate>`, `Mark repository public or private`, parseBool) .action(actionRunner(vcsCreateRepository)) vcs - .command(`getRepository`) + .command(`get-repository`) .description(``) - .requiredOption(`--installationId <installationId>`, `Installation Id`) - .requiredOption(`--providerRepositoryId <providerRepositoryId>`, `Repository Id`) + .requiredOption(`--installation-id <installation-id>`, `Installation Id`) + .requiredOption(`--provider-repository-id <provider-repository-id>`, `Repository Id`) .action(actionRunner(vcsGetRepository)) vcs - .command(`listRepositoryBranches`) + .command(`list-repository-branches`) .description(``) - .requiredOption(`--installationId <installationId>`, `Installation Id`) - .requiredOption(`--providerRepositoryId <providerRepositoryId>`, `Repository Id`) + .requiredOption(`--installation-id <installation-id>`, `Installation Id`) + .requiredOption(`--provider-repository-id <provider-repository-id>`, `Repository Id`) .action(actionRunner(vcsListRepositoryBranches)) vcs - .command(`getRepositoryContents`) + .command(`get-repository-contents`) .description(``) - .requiredOption(`--installationId <installationId>`, `Installation Id`) - .requiredOption(`--providerRepositoryId <providerRepositoryId>`, `Repository Id`) - .option(`--providerRootDirectory <providerRootDirectory>`, `Path to get contents of nested directory`) + .requiredOption(`--installation-id <installation-id>`, `Installation Id`) + .requiredOption(`--provider-repository-id <provider-repository-id>`, `Repository Id`) + .option(`--provider-root-directory <provider-root-directory>`, `Path to get contents of nested directory`) .action(actionRunner(vcsGetRepositoryContents)) vcs - .command(`createRepositoryDetection`) + .command(`create-repository-detection`) .description(``) - .requiredOption(`--installationId <installationId>`, `Installation Id`) - .requiredOption(`--providerRepositoryId <providerRepositoryId>`, `Repository Id`) - .option(`--providerRootDirectory <providerRootDirectory>`, `Path to Root Directory`) + .requiredOption(`--installation-id <installation-id>`, `Installation Id`) + .requiredOption(`--provider-repository-id <provider-repository-id>`, `Repository Id`) + .option(`--provider-root-directory <provider-root-directory>`, `Path to Root Directory`) .action(actionRunner(vcsCreateRepositoryDetection)) vcs - .command(`updateExternalDeployments`) + .command(`update-external-deployments`) .description(``) - .requiredOption(`--installationId <installationId>`, `Installation Id`) - .requiredOption(`--repositoryId <repositoryId>`, `VCS Repository Id`) - .requiredOption(`--providerPullRequestId <providerPullRequestId>`, `GitHub Pull Request Id`) + .requiredOption(`--installation-id <installation-id>`, `Installation Id`) + .requiredOption(`--repository-id <repository-id>`, `VCS Repository Id`) + .requiredOption(`--provider-pull-request-id <provider-pull-request-id>`, `GitHub Pull Request Id`) .action(actionRunner(vcsUpdateExternalDeployments)) vcs - .command(`listInstallations`) + .command(`list-installations`) .description(``) .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: provider, organization`) .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`) .action(actionRunner(vcsListInstallations)) vcs - .command(`getInstallation`) + .command(`get-installation`) .description(``) - .requiredOption(`--installationId <installationId>`, `Installation Id`) + .requiredOption(`--installation-id <installation-id>`, `Installation Id`) .action(actionRunner(vcsGetInstallation)) vcs - .command(`deleteInstallation`) + .command(`delete-installation`) .description(``) - .requiredOption(`--installationId <installationId>`, `Installation Id`) + .requiredOption(`--installation-id <installation-id>`, `Installation Id`) .action(actionRunner(vcsDeleteInstallation)) module.exports = { diff --git a/lib/config.js b/lib/config.js index 665e983..18ed09e 100644 --- a/lib/config.js +++ b/lib/config.js @@ -8,8 +8,9 @@ const KeysFunction = new Set(["path", "$id", "execute", "name", "enabled", "logg const KeysDatabase = new Set(["$id", "name", "enabled"]); const KeysCollection = new Set(["$id", "$permissions", "databaseId", "name", "enabled", "documentSecurity", "attributes", "indexes"]); const KeysStorage = new Set(["$id", "$permissions", "fileSecurity", "name", "enabled", "maximumFileSize", "allowedFileExtensions", "compression", "encryption", "antivirus"]); -const KeyTopics = new Set(["$id", "name", "subscribe"]); -const KeyAttributes = new Set([ +const KeysTopics = new Set(["$id", "name", "subscribe"]); +const KeysTeams = new Set(["$id", "name"]); +const KeysAttributes = new Set([ "key", "type", "required", @@ -17,7 +18,7 @@ const KeyAttributes = new Set([ "size", "default", // integer and float - "min", + "min", "max", // email, enum, URL, IP, and datetime "format", @@ -29,7 +30,10 @@ const KeyAttributes = new Set([ "twoWay", "twoWayKey", "onDelete", - "side" + "side", + // Indexes + "attributes", + "orders" ]); const KeyIndexes = new Set(["key", "type", "status", "attributes", "orders"]); @@ -193,7 +197,7 @@ class Local extends Config { addCollection(props) { props = whitelistKeys(props, KeysCollection, { - attributes: KeyAttributes, + attributes: KeysAttributes, indexes: KeyIndexes }); @@ -277,7 +281,7 @@ class Local extends Config { } addMessagingTopic(props) { - props = whitelistKeys(props, KeyTopics); + props = whitelistKeys(props, KeysTopics); if (!this.has("topics")) { this.set("topics", []); @@ -359,6 +363,7 @@ class Local extends Config { } addTeam(props) { + props = whitelistKeys(props, KeysTeams); if (!this.has("teams")) { this.set("teams", []); } @@ -398,7 +403,11 @@ class Local extends Config { return; } - const settings = { + this.set('settings', this.createSettingsObject(settings)); + } + + createSettingsObject(projectSettings) { + return { services: { account: projectSettings.serviceStatusForAccount, avatars: projectSettings.serviceStatusForAvatars, @@ -432,10 +441,7 @@ class Local extends Config { } } }; - - this.set('settings', settings) } - } class Global extends Config { @@ -604,4 +610,10 @@ class Global extends Config { module.exports = { localConfig: new Local(), globalConfig: new Global(), + KeysAttributes, + KeysFunction, + KeysTopics, + KeysStorage, + KeysTeams, + whitelistKeys }; diff --git a/lib/emulation/docker.js b/lib/emulation/docker.js index d93f280..b23cc10 100644 --- a/lib/emulation/docker.js +++ b/lib/emulation/docker.js @@ -1,10 +1,14 @@ +const tar = require("tar"); +const ignore = require("ignore"); +const net = require('net'); const chalk = require('chalk'); const childProcess = require('child_process'); const { localConfig } = require("../config"); const path = require('path'); const fs = require('fs'); -const { log, success, hint } = require("../parser"); +const { log, error, success, hint } = require("../parser"); const { openRuntimesVersion, systemTools, Queue } = require("./utils"); +const { getAllFiles } = require("../utils"); async function dockerStop(id) { const stopProcess = childProcess.spawn('docker', ['rm', '--force', id], { @@ -49,7 +53,7 @@ async function dockerBuild(func, variables) { const params = [ 'run' ]; params.push('--name', id); - params.push('-v', `${functionDir}/:/mnt/code:rw`); + params.push('-v', `${tmpBuildPath}/:/mnt/code:rw`); params.push('-e', 'APPWRITE_ENV=development'); params.push('-e', 'OPEN_RUNTIMES_ENV=development'); params.push('-e', 'OPEN_RUNTIMES_SECRET='); @@ -91,12 +95,11 @@ async function dockerBuild(func, variables) { await new Promise((res) => { buildProcess.on('close', res) }); - clearInterval(interval); - + clearInterval(killInterval); if(!Queue.isEmpty()) { return; } - + const copyPath = path.join(process.cwd(), func.path, '.appwrite', 'build.tar.gz'); const copyDir = path.dirname(copyPath); if (!fs.existsSync(copyDir)) { @@ -120,9 +123,39 @@ async function dockerBuild(func, variables) { if (fs.existsSync(tempPath)) { fs.rmSync(tempPath, { force: true }); } + + fs.rmSync(tmpBuildPath, { recursive: true, force: true }); } async function dockerStart(func, variables, port) { + // Pack function files + const functionDir = path.join(process.cwd(), func.path); + + const ignorer = ignore(); + ignorer.add('.appwrite'); + if (func.ignore) { + ignorer.add(func.ignore); + } else if (fs.existsSync(path.join(functionDir, '.gitignore'))) { + ignorer.add(fs.readFileSync(path.join(functionDir, '.gitignore')).toString()); + } + + const files = getAllFiles(functionDir).map((file) => path.relative(functionDir, file)).filter((file) => !ignorer.ignores(file)); + const tmpBuildPath = path.join(functionDir, '.appwrite/tmp-build'); + if (!fs.existsSync(tmpBuildPath)) { + fs.mkdirSync(tmpBuildPath, { recursive: true }); + } + + for(const f of files) { + const filePath = path.join(tmpBuildPath, f); + const fileDir = path.dirname(filePath); + if (!fs.existsSync(fileDir)) { + fs.mkdirSync(fileDir, { recursive: true }); + } + + const sourcePath = path.join(functionDir, f); + fs.copyFileSync(sourcePath, filePath); + } + const runtimeChunks = func.runtime.split("-"); const runtimeVersion = runtimeChunks.pop(); const runtimeName = runtimeChunks.join("-"); @@ -168,6 +201,13 @@ async function dockerStart(func, variables, port) { process.stdout.write(chalk.blackBright(data)); }); + try { + await waitUntilPortOpen(port); + } catch(err) { + error("Failed to start function with error: " + err.message ? err.message : err.toString()); + return; + } + success(`Visit http://localhost:${port}/ to execute your function.`); } @@ -186,6 +226,39 @@ async function dockerCleanup(functionId) { } } +function waitUntilPortOpen(port, iteration = 0) { + return new Promise((resolve, reject) => { + const client = new net.Socket(); + + client.once('connect', () => { + client.removeAllListeners('connect'); + client.removeAllListeners('error'); + client.end(); + client.destroy(); + client.unref(); + + resolve(); + }); + + client.once('error', async (err) => { + client.removeAllListeners('connect'); + client.removeAllListeners('error'); + client.end(); + client.destroy(); + client.unref(); + + if(iteration > 100) { + reject(err); + } else { + await new Promise((res) => setTimeout(res, 100)); + waitUntilPortOpen(port, iteration + 1).then(resolve).catch(reject); + } + }); + + client.connect({port, host: '127.0.0.1'}, function() {}); + }); +} + module.exports = { dockerPull, dockerBuild, diff --git a/lib/parser.js b/lib/parser.js index a679821..e93594e 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -90,20 +90,9 @@ const drawTable = (data) => { if (row[key] === null) { rowValues.push("-"); } else if (Array.isArray(row[key])) { - switch (row[key].length) { - case 1: - if (typeof row[key][0] === 'object') { - rowValues.push(`array(${row[key].length})`); - } else { - rowValues.push(row[key][0]); - } - break; - default: - rowValues.push(`array(${row[key].length})`); - break; - } + rowValues.push(JSON.stringify(row[key])); } else if (typeof row[key] === 'object') { - rowValues.push("object"); + rowValues.push(JSON.stringify(row[key])); } else { rowValues.push(row[key]); } @@ -131,7 +120,7 @@ const parseError = (err) => { } catch { } - const version = '6.0.0-rc.4'; + const version = '6.0.0-rc.5'; const stepsToReproduce = `Running \`appwrite ${cliConfig.reportData.data.args.join(' ')}\``; const yourEnvironment = `CLI version: ${version}\nOperation System: ${os.type()}\nAppwrite version: ${appwriteVersion}\nIs Cloud: ${isCloud}`; diff --git a/lib/questions.js b/lib/questions.js index 8798bd5..d5fdc29 100644 --- a/lib/questions.js +++ b/lib/questions.js @@ -247,11 +247,10 @@ const questionsPullFunctions = [ if (functions.length === 0) { throw "We couldn't find any functions in your Appwrite project"; } - return functions.map(func => { return { name: `${func.name} (${func.$id})`, - value: func + value: { ...func } } }); } @@ -634,12 +633,10 @@ const questionsPushFunctions = [ name: "functions", message: "Which functions would you like to push?", validate: (value) => validateRequired('function', value), + when: () => localConfig.getFunctions().length > 0, choices: () => { let functions = localConfig.getFunctions(); checkDeployConditions(localConfig) - if (functions.length === 0) { - throw new Error("No functions found Use 'appwrite pull functions' to synchronize existing one, or use 'appwrite init function' to create a new one."); - } let choices = functions.map((func, idx) => { return { name: `${func.name} (${func.$id})`, @@ -662,13 +659,11 @@ const questionsPushCollections = [ name: "collections", message: "Which collections would you like to push?", validate: (value) => validateRequired('collection', value), + when: () => localConfig.getCollections().length > 0, choices: () => { let collections = localConfig.getCollections(); checkDeployConditions(localConfig) - if (collections.length === 0) { - throw new Error("No collections found in the current directory. Use 'appwrite pull collections' to synchronize existing one, or use 'appwrite init collection' to create a new one."); - } return collections.map(collection => { return { name: `${collection.name} (${collection['databaseId']} - ${collection['$id']})`, @@ -676,13 +671,16 @@ const questionsPushCollections = [ } }); } - }, + } +]; + +const questionPushChanges = [ { type: "input", name: "changes", message: `Would you like to apply these changes? Type "YES" to confirm.` } -] +]; const questionsPushBuckets = [ { @@ -690,12 +688,11 @@ const questionsPushBuckets = [ name: "buckets", message: "Which buckets would you like to push?", validate: (value) => validateRequired('bucket', value), + when: () => localConfig.getBuckets().length > 0, choices: () => { let buckets = localConfig.getBuckets(); checkDeployConditions(localConfig) - if (buckets.length === 0) { - throw new Error("No buckets found in the current directory. Use 'appwrite pull buckets' to synchronize existing one, or use 'appwrite init bucket' to create a new one."); - } + return buckets.map(bucket => { return { name: `${bucket.name} (${bucket['$id']})`, @@ -711,11 +708,10 @@ const questionsPushMessagingTopics = [ type: "checkbox", name: "topics", message: "Which messaging topic would you like to push?", + when: () => localConfig.getMessagingTopics().length > 0, choices: () => { let topics = localConfig.getMessagingTopics(); - if (topics.length === 0) { - throw new Error("No topics found in the current directory. Use 'appwrite pull topics' to synchronize existing one, or use 'appwrite init topic' to create a new one."); - } + return topics.map(topic => { return { name: `${topic.name} (${topic['$id']})`, @@ -752,12 +748,11 @@ const questionsPushTeams = [ name: "teams", message: "Which teams would you like to push?", validate: (value) => validateRequired('team', value), + when: () => localConfig.getTeams().length > 0, choices: () => { let teams = localConfig.getTeams(); checkDeployConditions(localConfig); - if (teams.length === 0) { - throw new Error("No teams found in the current directory. Use 'appwrite pull teams' to synchronize existing one, or use 'appwrite init team' to create a new one."); - } + return teams.map(team => { return { name: `${team.name} (${team['$id']})`, @@ -866,5 +861,6 @@ module.exports = { questionsRunFunctions, questionGetEndpoint, questionsInitResources, - questionsCreateTeam + questionsCreateTeam, + questionPushChanges }; diff --git a/lib/spinner.js b/lib/spinner.js index 2f5b3ad..bcc7e6b 100644 --- a/lib/spinner.js +++ b/lib/spinner.js @@ -22,6 +22,7 @@ class Spinner { hideCursor, clearOnComplete, stopOnComplete: true, + linewrap: true, noTTYOutput: true }); } diff --git a/package.json b/package.json index cc47d7d..daac1ad 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "appwrite-cli", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API", - "version": "6.0.0-rc.4", + "version": "6.0.0-rc.5", "license": "BSD-3-Clause", "main": "index.js", "bin": { diff --git a/scoop/appwrite.json b/scoop/appwrite.json index 138de4b..46f0d71 100644 --- a/scoop/appwrite.json +++ b/scoop/appwrite.json @@ -1,12 +1,12 @@ { "$schema": "https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/schema.json", - "version": "6.0.0-rc.4", + "version": "6.0.0-rc.5", "description": "The Appwrite CLI is a command-line application that allows you to interact with Appwrite and perform server-side tasks using your terminal.", "homepage": "https://github.com/appwrite/sdk-for-cli", "license": "BSD-3-Clause", "architecture": { "64bit": { - "url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.4/appwrite-cli-win-x64.exe", + "url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.5/appwrite-cli-win-x64.exe", "bin": [ [ "appwrite-cli-win-x64.exe", @@ -15,7 +15,7 @@ ] }, "arm64": { - "url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.4/appwrite-cli-win-arm64.exe", + "url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.5/appwrite-cli-win-arm64.exe", "bin": [ [ "appwrite-cli-win-arm64.exe",