diff --git a/README.md b/README.md index 76cbd44..8c1f9d6 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![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 latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-cli/releases).** +**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).** 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.6 +6.0.0-rc.7 ``` ### 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.6 +6.0.0-rc.7 ``` ## Getting Started diff --git a/docs/examples/functions/download-deployment.md b/docs/examples/functions/get-deployment-download.md similarity index 63% rename from docs/examples/functions/download-deployment.md rename to docs/examples/functions/get-deployment-download.md index aa440b5..2cbb2bd 100644 --- a/docs/examples/functions/download-deployment.md +++ b/docs/examples/functions/get-deployment-download.md @@ -1,3 +1,3 @@ -appwrite functions downloadDeployment \ +appwrite functions getDeploymentDownload \ --functionId \ --deploymentId diff --git a/docs/examples/functions/get-template.md b/docs/examples/functions/get-template.md new file mode 100644 index 0000000..15c6068 --- /dev/null +++ b/docs/examples/functions/get-template.md @@ -0,0 +1,2 @@ +appwrite functions getTemplate \ + --templateId diff --git a/docs/examples/functions/list-templates.md b/docs/examples/functions/list-templates.md new file mode 100644 index 0000000..b48bab5 --- /dev/null +++ b/docs/examples/functions/list-templates.md @@ -0,0 +1,5 @@ +appwrite functions listTemplates \ + + + + diff --git a/index.js b/index.js index 58b9dcd..fa7067f 100644 --- a/index.js +++ b/index.js @@ -41,15 +41,16 @@ program .description(commandDescriptions['main']) .configureHelp({ helpWidth: process.stdout.columns || 80, - sortSubcommands: true + sortSubcommands: true, }) - .version(version, "-v, --version") + .helpOption('-h, --help', "Display help for command") + .version(version, "-v, --version", "Output the version number") .option("-V, --verbose", "Show complete error log") .option("-j, --json", "Output in JSON format") .hook('preAction', migrate) .option("-f,--force", "Flag to confirm all warnings") .option("-a,--all", "Flag to push all resources") - .option("--id [id...]", "Flag to pass list of ids for a giving action") + .option("--id [id...]", "Flag to pass a list of ids for a given action") .option("--report", "Enable reporting in case of CLI errors") .on("option:json", () => { cliConfig.json = true; diff --git a/install.ps1 b/install.ps1 index 4e07dc4..e251235 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.6/appwrite-cli-win-x64.exe" -$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.6/appwrite-cli-win-arm64.exe" +$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.7/appwrite-cli-win-x64.exe" +$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.7/appwrite-cli-win-arm64.exe" $APPWRITE_BINARY_NAME = "appwrite.exe" diff --git a/install.sh b/install.sh index 881b4f8..e6a452b 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.6" + GITHUB_LATEST_VERSION="6.0.0-rc.7" 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 e5953e9..87b7329 100644 --- a/lib/client.js +++ b/lib/client.js @@ -16,9 +16,9 @@ class Client { 'x-sdk-name': 'Command Line', 'x-sdk-platform': 'console', 'x-sdk-language': 'cli', - 'x-sdk-version': '6.0.0-rc.6', - 'user-agent' : `AppwriteCLI/6.0.0-rc.6 (${os.type()} ${os.version()}; ${os.arch()})`, - 'X-Appwrite-Response-Format' : '1.5.0', + 'x-sdk-version': '6.0.0-rc.7', + 'user-agent' : `AppwriteCLI/6.0.0-rc.7 (${os.type()} ${os.version()}; ${os.arch()})`, + 'X-Appwrite-Response-Format' : '1.6.0', }; } diff --git a/lib/commands/account.js b/lib/commands/account.js index 5df93fa..4c45f43 100644 --- a/lib/commands/account.js +++ b/lib/commands/account.js @@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) { }); } -const account = new Command("account").description(commandDescriptions['account']).configureHelp({ +const account = new Command("account").description(commandDescriptions['account'] ?? '').configureHelp({ helpWidth: process.stdout.columns || 80 }) @@ -66,7 +66,6 @@ const accountGet = async ({parseOutput = true, overrideForCli = false, sdk = und showConsoleLink('account', 'get'); } else { parse(response) - success() } } @@ -114,7 +113,6 @@ const accountCreate = async ({userId,email,password,name,parseOutput = true, ove if (parseOutput) { parse(response) - success() } return response; @@ -145,7 +143,6 @@ const accountDelete = async ({parseOutput = true, overrideForCli = false, sdk = if (parseOutput) { parse(response) - success() } return response; @@ -184,7 +181,6 @@ const accountUpdateEmail = async ({email,password,parseOutput = true, overrideFo if (parseOutput) { parse(response) - success() } return response; @@ -219,7 +215,6 @@ const accountListIdentities = async ({queries,parseOutput = true, overrideForCli if (parseOutput) { parse(response) - success() } return response; @@ -251,7 +246,6 @@ const accountDeleteIdentity = async ({identityId,parseOutput = true, overrideFor if (parseOutput) { parse(response) - success() } return response; @@ -282,7 +276,6 @@ const accountCreateJWT = async ({parseOutput = true, overrideForCli = false, sdk if (parseOutput) { parse(response) - success() } return response; @@ -317,7 +310,6 @@ const accountListLogs = async ({queries,parseOutput = true, overrideForCli = fal if (parseOutput) { parse(response) - success() } return response; @@ -352,7 +344,6 @@ const accountUpdateMFA = async ({mfa,parseOutput = true, overrideForCli = false, if (parseOutput) { parse(response) - success() } return response; @@ -384,7 +375,6 @@ const accountCreateMfaAuthenticator = async ({type,parseOutput = true, overrideF if (parseOutput) { parse(response) - success() } return response; @@ -420,7 +410,6 @@ const accountUpdateMfaAuthenticator = async ({type,otp,parseOutput = true, overr if (parseOutput) { parse(response) - success() } return response; @@ -452,7 +441,6 @@ const accountDeleteMfaAuthenticator = async ({type,parseOutput = true, overrideF if (parseOutput) { parse(response) - success() } return response; @@ -487,7 +475,6 @@ const accountCreateMfaChallenge = async ({factor,parseOutput = true, overrideFor if (parseOutput) { parse(response) - success() } return response; @@ -526,7 +513,6 @@ const accountUpdateMfaChallenge = async ({challengeId,otp,parseOutput = true, ov if (parseOutput) { parse(response) - success() } return response; @@ -557,7 +543,6 @@ const accountListMfaFactors = async ({parseOutput = true, overrideForCli = false if (parseOutput) { parse(response) - success() } return response; @@ -588,7 +573,6 @@ const accountGetMfaRecoveryCodes = async ({parseOutput = true, overrideForCli = if (parseOutput) { parse(response) - success() } return response; @@ -619,7 +603,6 @@ const accountCreateMfaRecoveryCodes = async ({parseOutput = true, overrideForCli if (parseOutput) { parse(response) - success() } return response; @@ -650,7 +633,6 @@ const accountUpdateMfaRecoveryCodes = async ({parseOutput = true, overrideForCli if (parseOutput) { parse(response) - success() } return response; @@ -685,7 +667,6 @@ const accountUpdateName = async ({name,parseOutput = true, overrideForCli = fals if (parseOutput) { parse(response) - success() } return response; @@ -724,7 +705,6 @@ const accountUpdatePassword = async ({password,oldPassword,parseOutput = true, o if (parseOutput) { parse(response) - success() } return response; @@ -763,7 +743,6 @@ const accountUpdatePhone = async ({phone,password,parseOutput = true, overrideFo if (parseOutput) { parse(response) - success() } return response; @@ -794,7 +773,6 @@ const accountGetPrefs = async ({parseOutput = true, overrideForCli = false, sdk if (parseOutput) { parse(response) - success() } return response; @@ -829,7 +807,6 @@ const accountUpdatePrefs = async ({prefs,parseOutput = true, overrideForCli = fa if (parseOutput) { parse(response) - success() } return response; @@ -868,7 +845,6 @@ const accountCreateRecovery = async ({email,url,parseOutput = true, overrideForC if (parseOutput) { parse(response) - success() } return response; @@ -911,7 +887,6 @@ const accountUpdateRecovery = async ({userId,secret,password,parseOutput = true, if (parseOutput) { parse(response) - success() } return response; @@ -945,7 +920,6 @@ const accountListSessions = async ({parseOutput = true, overrideForCli = false, showConsoleLink('account', 'listSessions'); } else { parse(response) - success() } } @@ -977,7 +951,6 @@ const accountDeleteSessions = async ({parseOutput = true, overrideForCli = false if (parseOutput) { parse(response) - success() } return response; @@ -1008,7 +981,6 @@ const accountCreateAnonymousSession = async ({parseOutput = true, overrideForCli if (parseOutput) { parse(response) - success() } return response; @@ -1047,7 +1019,6 @@ const accountCreateEmailPasswordSession = async ({email,password,parseOutput = t if (parseOutput) { parse(response) - success() } return response; @@ -1086,7 +1057,6 @@ const accountUpdateMagicURLSession = async ({userId,secret,parseOutput = true, o if (parseOutput) { parse(response) - success() } return response; @@ -1130,7 +1100,6 @@ const accountCreateOAuth2Session = async ({provider,success,failure,scopes,parse if (parseOutput) { parse(response) - success() } return response; @@ -1169,7 +1138,6 @@ const accountUpdatePhoneSession = async ({userId,secret,parseOutput = true, over if (parseOutput) { parse(response) - success() } return response; @@ -1208,7 +1176,6 @@ const accountCreateSession = async ({userId,secret,parseOutput = true, overrideF if (parseOutput) { parse(response) - success() } return response; @@ -1240,7 +1207,6 @@ const accountGetSession = async ({sessionId,parseOutput = true, overrideForCli = if (parseOutput) { parse(response) - success() } return response; @@ -1272,7 +1238,6 @@ const accountUpdateSession = async ({sessionId,parseOutput = true, overrideForCl if (parseOutput) { parse(response) - success() } return response; @@ -1304,7 +1269,6 @@ const accountDeleteSession = async ({sessionId,parseOutput = true, overrideForCl if (parseOutput) { parse(response) - success() } return response; @@ -1335,7 +1299,6 @@ const accountUpdateStatus = async ({parseOutput = true, overrideForCli = false, if (parseOutput) { parse(response) - success() } return response; @@ -1378,7 +1341,6 @@ const accountCreatePushTarget = async ({targetId,identifier,providerId,parseOutp if (parseOutput) { parse(response) - success() } return response; @@ -1414,7 +1376,6 @@ const accountUpdatePushTarget = async ({targetId,identifier,parseOutput = true, if (parseOutput) { parse(response) - success() } return response; @@ -1446,7 +1407,6 @@ const accountDeletePushTarget = async ({targetId,parseOutput = true, overrideFor if (parseOutput) { parse(response) - success() } return response; @@ -1489,7 +1449,6 @@ const accountCreateEmailToken = async ({userId,email,phrase,parseOutput = true, if (parseOutput) { parse(response) - success() } return response; @@ -1536,7 +1495,6 @@ const accountCreateMagicURLToken = async ({userId,email,url,phrase,parseOutput = if (parseOutput) { parse(response) - success() } return response; @@ -1580,7 +1538,6 @@ const accountCreateOAuth2Token = async ({provider,success,failure,scopes,parseOu if (parseOutput) { parse(response) - success() } return response; @@ -1619,7 +1576,6 @@ const accountCreatePhoneToken = async ({userId,phone,parseOutput = true, overrid if (parseOutput) { parse(response) - success() } return response; @@ -1654,7 +1610,6 @@ const accountCreateVerification = async ({url,parseOutput = true, overrideForCli if (parseOutput) { parse(response) - success() } return response; @@ -1693,7 +1648,6 @@ const accountUpdateVerification = async ({userId,secret,parseOutput = true, over if (parseOutput) { parse(response) - success() } return response; @@ -1724,7 +1678,6 @@ const accountCreatePhoneVerification = async ({parseOutput = true, overrideForCl if (parseOutput) { parse(response) - success() } return response; @@ -1763,7 +1716,6 @@ const accountUpdatePhoneVerification = async ({userId,secret,parseOutput = true, if (parseOutput) { parse(response) - success() } return response; diff --git a/lib/commands/assistant.js b/lib/commands/assistant.js index 3a1da8a..16a17ec 100644 --- a/lib/commands/assistant.js +++ b/lib/commands/assistant.js @@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) { }); } -const assistant = new Command("assistant").description(commandDescriptions['assistant']).configureHelp({ +const assistant = new Command("assistant").description(commandDescriptions['assistant'] ?? '').configureHelp({ helpWidth: process.stdout.columns || 80 }) @@ -67,7 +67,6 @@ const assistantChat = async ({prompt,parseOutput = true, overrideForCli = false, if (parseOutput) { parse(response) - success() } return response; diff --git a/lib/commands/avatars.js b/lib/commands/avatars.js index c0649d8..0468eb8 100644 --- a/lib/commands/avatars.js +++ b/lib/commands/avatars.js @@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) { }); } -const avatars = new Command("avatars").description(commandDescriptions['avatars']).configureHelp({ +const avatars = new Command("avatars").description(commandDescriptions['avatars'] ?? '').configureHelp({ helpWidth: process.stdout.columns || 80 }) @@ -88,7 +88,6 @@ const avatarsGetBrowser = async ({code,width,height,quality,parseOutput = true, fs.writeFileSync(destination, response); if (parseOutput) { parse(response) - success() } return response; @@ -144,7 +143,6 @@ const avatarsGetCreditCard = async ({code,width,height,quality,parseOutput = tru fs.writeFileSync(destination, response); if (parseOutput) { parse(response) - success() } return response; @@ -191,7 +189,6 @@ const avatarsGetFavicon = async ({url,parseOutput = true, overrideForCli = false fs.writeFileSync(destination, response); if (parseOutput) { parse(response) - success() } return response; @@ -247,7 +244,6 @@ const avatarsGetFlag = async ({code,width,height,quality,parseOutput = true, ove fs.writeFileSync(destination, response); if (parseOutput) { parse(response) - success() } return response; @@ -302,7 +298,6 @@ const avatarsGetImage = async ({url,width,height,parseOutput = true, overrideFor fs.writeFileSync(destination, response); if (parseOutput) { parse(response) - success() } return response; @@ -361,7 +356,6 @@ const avatarsGetInitials = async ({name,width,height,background,parseOutput = tr fs.writeFileSync(destination, response); if (parseOutput) { parse(response) - success() } return response; @@ -420,7 +414,6 @@ const avatarsGetQR = async ({text,size,margin,download,parseOutput = true, overr fs.writeFileSync(destination, response); if (parseOutput) { parse(response) - success() } return response; diff --git a/lib/commands/console.js b/lib/commands/console.js index ef46397..180c38a 100644 --- a/lib/commands/console.js +++ b/lib/commands/console.js @@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) { }); } -const console = new Command("console").description(commandDescriptions['console']).configureHelp({ +const console = new Command("console").description(commandDescriptions['console'] ?? '').configureHelp({ helpWidth: process.stdout.columns || 80 }) @@ -63,7 +63,6 @@ const consoleVariables = async ({parseOutput = true, overrideForCli = false, sdk if (parseOutput) { parse(response) - success() } return response; diff --git a/lib/commands/databases.js b/lib/commands/databases.js index 3174403..66b49e6 100644 --- a/lib/commands/databases.js +++ b/lib/commands/databases.js @@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) { }); } -const databases = new Command("databases").description(commandDescriptions['databases']).configureHelp({ +const databases = new Command("databases").description(commandDescriptions['databases'] ?? '').configureHelp({ helpWidth: process.stdout.columns || 80 }) @@ -74,7 +74,6 @@ const databasesList = async ({queries,search,parseOutput = true, overrideForCli showConsoleLink('databases', 'list'); } else { parse(response) - success() } } @@ -118,7 +117,6 @@ const databasesCreate = async ({databaseId,name,enabled,parseOutput = true, over if (parseOutput) { parse(response) - success() } return response; @@ -153,7 +151,6 @@ const databasesGetUsage = async ({range,parseOutput = true, overrideForCli = fal if (parseOutput) { parse(response) - success() } return response; @@ -188,7 +185,6 @@ const databasesGet = async ({databaseId,parseOutput = true, overrideForCli = fal showConsoleLink('databases', 'get', databaseId); } else { parse(response) - success() } } @@ -229,7 +225,6 @@ const databasesUpdate = async ({databaseId,name,enabled,parseOutput = true, over if (parseOutput) { parse(response) - success() } return response; @@ -261,7 +256,6 @@ const databasesDelete = async ({databaseId,parseOutput = true, overrideForCli = if (parseOutput) { parse(response) - success() } return response; @@ -304,7 +298,6 @@ const databasesListCollections = async ({databaseId,queries,search,parseOutput = showConsoleLink('databases', 'listCollections', databaseId); } else { parse(response) - success() } } @@ -358,7 +351,6 @@ const databasesCreateCollection = async ({databaseId,collectionId,name,permissio if (parseOutput) { parse(response) - success() } return response; @@ -394,7 +386,6 @@ const databasesGetCollection = async ({databaseId,collectionId,parseOutput = tru showConsoleLink('databases', 'getCollection', databaseId, collectionId); } else { parse(response) - success() } } @@ -445,7 +436,6 @@ const databasesUpdateCollection = async ({databaseId,collectionId,name,permissio if (parseOutput) { parse(response) - success() } return response; @@ -478,7 +468,6 @@ const databasesDeleteCollection = async ({databaseId,collectionId,parseOutput = if (parseOutput) { parse(response) - success() } return response; @@ -518,7 +507,6 @@ const databasesListAttributes = async ({databaseId,collectionId,queries,parseOut showConsoleLink('databases', 'listAttributes', databaseId, collectionId); } else { parse(response) - success() } } @@ -568,7 +556,6 @@ const databasesCreateBooleanAttribute = async ({databaseId,collectionId,key,requ if (parseOutput) { parse(response) - success() } return response; @@ -610,7 +597,6 @@ const databasesUpdateBooleanAttribute = async ({databaseId,collectionId,key,requ if (parseOutput) { parse(response) - success() } return response; @@ -659,7 +645,6 @@ const databasesCreateDatetimeAttribute = async ({databaseId,collectionId,key,req if (parseOutput) { parse(response) - success() } return response; @@ -701,7 +686,6 @@ const databasesUpdateDatetimeAttribute = async ({databaseId,collectionId,key,req if (parseOutput) { parse(response) - success() } return response; @@ -750,7 +734,6 @@ const databasesCreateEmailAttribute = async ({databaseId,collectionId,key,requir if (parseOutput) { parse(response) - success() } return response; @@ -792,7 +775,6 @@ const databasesUpdateEmailAttribute = async ({databaseId,collectionId,key,requir if (parseOutput) { parse(response) - success() } return response; @@ -846,7 +828,6 @@ const databasesCreateEnumAttribute = async ({databaseId,collectionId,key,element if (parseOutput) { parse(response) - success() } return response; @@ -893,7 +874,6 @@ const databasesUpdateEnumAttribute = async ({databaseId,collectionId,key,element if (parseOutput) { parse(response) - success() } return response; @@ -950,7 +930,6 @@ const databasesCreateFloatAttribute = async ({databaseId,collectionId,key,requir if (parseOutput) { parse(response) - success() } return response; @@ -1000,7 +979,6 @@ const databasesUpdateFloatAttribute = async ({databaseId,collectionId,key,requir if (parseOutput) { parse(response) - success() } return response; @@ -1057,7 +1035,6 @@ const databasesCreateIntegerAttribute = async ({databaseId,collectionId,key,requ if (parseOutput) { parse(response) - success() } return response; @@ -1107,7 +1084,6 @@ const databasesUpdateIntegerAttribute = async ({databaseId,collectionId,key,requ if (parseOutput) { parse(response) - success() } return response; @@ -1156,7 +1132,6 @@ const databasesCreateIpAttribute = async ({databaseId,collectionId,key,required, if (parseOutput) { parse(response) - success() } return response; @@ -1198,7 +1173,6 @@ const databasesUpdateIpAttribute = async ({databaseId,collectionId,key,required, if (parseOutput) { parse(response) - success() } return response; @@ -1255,7 +1229,6 @@ const databasesCreateRelationshipAttribute = async ({databaseId,collectionId,rel if (parseOutput) { parse(response) - success() } return response; @@ -1312,7 +1285,6 @@ const databasesCreateStringAttribute = async ({databaseId,collectionId,key,size, if (parseOutput) { parse(response) - success() } return response; @@ -1354,7 +1326,6 @@ const databasesUpdateStringAttribute = async ({databaseId,collectionId,key,requi if (parseOutput) { parse(response) - success() } return response; @@ -1403,7 +1374,6 @@ const databasesCreateUrlAttribute = async ({databaseId,collectionId,key,required if (parseOutput) { parse(response) - success() } return response; @@ -1445,7 +1415,6 @@ const databasesUpdateUrlAttribute = async ({databaseId,collectionId,key,required if (parseOutput) { parse(response) - success() } return response; @@ -1479,7 +1448,6 @@ const databasesGetAttribute = async ({databaseId,collectionId,key,parseOutput = if (parseOutput) { parse(response) - success() } return response; @@ -1513,7 +1481,6 @@ const databasesDeleteAttribute = async ({databaseId,collectionId,key,parseOutput if (parseOutput) { parse(response) - success() } return response; @@ -1551,7 +1518,6 @@ const databasesUpdateRelationshipAttribute = async ({databaseId,collectionId,key if (parseOutput) { parse(response) - success() } return response; @@ -1591,7 +1557,6 @@ const databasesListDocuments = async ({databaseId,collectionId,queries,parseOutp showConsoleLink('databases', 'listDocuments', databaseId, collectionId); } else { parse(response) - success() } } @@ -1638,7 +1603,6 @@ const databasesCreateDocument = async ({databaseId,collectionId,documentId,data, if (parseOutput) { parse(response) - success() } return response; @@ -1679,7 +1643,6 @@ const databasesGetDocument = async ({databaseId,collectionId,documentId,queries, showConsoleLink('databases', 'getDocument', databaseId, collectionId, documentId); } else { parse(response) - success() } } @@ -1723,7 +1686,6 @@ const databasesUpdateDocument = async ({databaseId,collectionId,documentId,data, if (parseOutput) { parse(response) - success() } return response; @@ -1757,7 +1719,6 @@ const databasesDeleteDocument = async ({databaseId,collectionId,documentId,parse if (parseOutput) { parse(response) - success() } return response; @@ -1795,7 +1756,6 @@ const databasesListDocumentLogs = async ({databaseId,collectionId,documentId,que if (parseOutput) { parse(response) - success() } return response; @@ -1835,7 +1795,6 @@ const databasesListIndexes = async ({databaseId,collectionId,queries,parseOutput showConsoleLink('databases', 'listIndexes', databaseId, collectionId); } else { parse(response) - success() } } @@ -1887,7 +1846,6 @@ const databasesCreateIndex = async ({databaseId,collectionId,key,type,attributes if (parseOutput) { parse(response) - success() } return response; @@ -1921,7 +1879,6 @@ const databasesGetIndex = async ({databaseId,collectionId,key,parseOutput = true if (parseOutput) { parse(response) - success() } return response; @@ -1955,7 +1912,6 @@ const databasesDeleteIndex = async ({databaseId,collectionId,key,parseOutput = t if (parseOutput) { parse(response) - success() } return response; @@ -1992,7 +1948,6 @@ const databasesListCollectionLogs = async ({databaseId,collectionId,queries,pars if (parseOutput) { parse(response) - success() } return response; @@ -2029,7 +1984,6 @@ const databasesGetCollectionUsage = async ({databaseId,collectionId,range,parseO if (parseOutput) { parse(response) - success() } return response; @@ -2065,7 +2019,6 @@ const databasesListLogs = async ({databaseId,queries,parseOutput = true, overrid if (parseOutput) { parse(response) - success() } return response; @@ -2104,7 +2057,6 @@ const databasesGetDatabaseUsage = async ({databaseId,range,parseOutput = true, o showConsoleLink('databases', 'getDatabaseUsage', databaseId); } else { parse(response) - success() } } diff --git a/lib/commands/functions.js b/lib/commands/functions.js index 7f82da9..f44b979 100644 --- a/lib/commands/functions.js +++ b/lib/commands/functions.js @@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) { }); } -const functions = new Command("functions").description(commandDescriptions['functions']).configureHelp({ +const functions = new Command("functions").description(commandDescriptions['functions'] ?? '').configureHelp({ helpWidth: process.stdout.columns || 80 }) @@ -74,7 +74,6 @@ const functionsList = async ({queries,search,parseOutput = true, overrideForCli showConsoleLink('functions', 'list'); } else { parse(response) - success() } } @@ -193,7 +192,6 @@ const functionsCreate = async ({functionId,name,runtime,execute,events,schedule, if (parseOutput) { parse(response) - success() } return response; @@ -224,7 +222,91 @@ const functionsListRuntimes = async ({parseOutput = true, overrideForCli = false if (parseOutput) { parse(response) - success() + } + + return response; + +} + +/** + * @typedef {Object} FunctionsListTemplatesRequestParams + * @property {string[]} runtimes List of runtimes allowed for filtering function templates. Maximum of 100 runtimes are allowed. + * @property {string[]} useCases List of use cases allowed for filtering function templates. Maximum of 100 use cases are allowed. + * @property {number} limit Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000. + * @property {number} offset Offset the list of returned templates. Maximum offset is 5000. + * @property {boolean} overrideForCli + * @property {boolean} parseOutput + * @property {libClient | undefined} sdk + */ + +/** + * @param {FunctionsListTemplatesRequestParams} params + */ +const functionsListTemplates = async ({runtimes,useCases,limit,offset,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => { + let client = !sdk ? await sdkForProject() : + sdk; + let apiPath = '/functions/templates'; + let payload = {}; + if (typeof runtimes !== 'undefined') { + payload['runtimes'] = runtimes; + } + if (typeof useCases !== 'undefined') { + payload['useCases'] = useCases; + } + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + + let response = undefined; + + response = await client.call('get', apiPath, { + 'content-type': 'application/json', + }, payload); + + if (parseOutput) { + if(console) { + showConsoleLink('functions', 'listTemplates'); + } else { + parse(response) + } + } + + return response; + +} + +/** + * @typedef {Object} FunctionsGetTemplateRequestParams + * @property {string} templateId Template ID. + * @property {boolean} overrideForCli + * @property {boolean} parseOutput + * @property {libClient | undefined} sdk + */ + +/** + * @param {FunctionsGetTemplateRequestParams} params + */ +const functionsGetTemplate = async ({templateId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => { + let client = !sdk ? await sdkForProject() : + sdk; + let apiPath = '/functions/templates/{templateId}'.replace('{templateId}', templateId); + let payload = {}; + + let response = undefined; + + response = await client.call('get', apiPath, { + 'content-type': 'application/json', + }, payload); + + if (parseOutput) { + if(console) { + showConsoleLink('functions', 'getTemplate', templateId); + } else { + parse(response) + } } return response; @@ -259,7 +341,6 @@ const functionsGetUsage = async ({range,parseOutput = true, overrideForCli = fal if (parseOutput) { parse(response) - success() } return response; @@ -294,7 +375,6 @@ const functionsGet = async ({functionId,parseOutput = true, overrideForCli = fal showConsoleLink('functions', 'get', functionId); } else { parse(response) - success() } } @@ -394,7 +474,6 @@ const functionsUpdate = async ({functionId,name,runtime,execute,events,schedule, if (parseOutput) { parse(response) - success() } return response; @@ -426,7 +505,6 @@ const functionsDelete = async ({functionId,parseOutput = true, overrideForCli = if (parseOutput) { parse(response) - success() } return response; @@ -469,7 +547,6 @@ const functionsListDeployments = async ({functionId,queries,search,parseOutput = showConsoleLink('functions', 'listDeployments', functionId); } else { parse(response) - success() } } @@ -523,15 +600,17 @@ const functionsCreateDeployment = async ({functionId,code,activate,entrypoint,co const files = getAllFiles(code).map((file) => pathLib.relative(code, file)).filter((file) => !ignorer.ignores(file)); + const archiveFileName = `${functionId}-code.tar.gz`; + await tar .create({ gzip: true, sync: true, cwd: folderPath, - file: 'code.tar.gz' + file: archiveFileName }, files); - let archivePath = fs.realpathSync('code.tar.gz') + let archivePath = fs.realpathSync(archiveFileName) if (typeof archivePath !== 'undefined') { payload['code'] = archivePath; code = archivePath; @@ -634,7 +713,6 @@ const functionsCreateDeployment = async ({functionId,code,activate,entrypoint,co if (parseOutput) { parse(response) - success() } return response; @@ -669,7 +747,6 @@ const functionsGetDeployment = async ({functionId,deploymentId,parseOutput = tru showConsoleLink('functions', 'getDeployment', functionId, deploymentId); } else { parse(response) - success() } } @@ -703,7 +780,6 @@ const functionsUpdateDeployment = async ({functionId,deploymentId,parseOutput = if (parseOutput) { parse(response) - success() } return response; @@ -736,7 +812,6 @@ const functionsDeleteDeployment = async ({functionId,deploymentId,parseOutput = if (parseOutput) { parse(response) - success() } return response; @@ -773,7 +848,6 @@ const functionsCreateBuild = async ({functionId,deploymentId,buildId,parseOutput if (parseOutput) { parse(response) - success() } return response; @@ -806,7 +880,6 @@ const functionsUpdateDeploymentBuild = async ({functionId,deploymentId,parseOutp if (parseOutput) { parse(response) - success() } return response; @@ -814,7 +887,7 @@ const functionsUpdateDeploymentBuild = async ({functionId,deploymentId,parseOutp } /** - * @typedef {Object} FunctionsDownloadDeploymentRequestParams + * @typedef {Object} FunctionsGetDeploymentDownloadRequestParams * @property {string} functionId Function ID. * @property {string} deploymentId Deployment ID. * @property {boolean} overrideForCli @@ -824,9 +897,9 @@ const functionsUpdateDeploymentBuild = async ({functionId,deploymentId,parseOutp */ /** - * @param {FunctionsDownloadDeploymentRequestParams} params + * @param {FunctionsGetDeploymentDownloadRequestParams} params */ -const functionsDownloadDeployment = async ({functionId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined, destination}) => { +const functionsGetDeploymentDownload = async ({functionId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined, destination, console}) => { let client = !sdk ? await sdkForProject() : sdk; let apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); @@ -850,8 +923,11 @@ const functionsDownloadDeployment = async ({functionId,deploymentId,parseOutput fs.writeFileSync(destination, response); if (parseOutput) { - parse(response) - success() + if(console) { + showConsoleLink('functions', 'getDeploymentDownload', functionId, deploymentId); + } else { + parse(response) + } } return response; @@ -894,7 +970,6 @@ const functionsListExecutions = async ({functionId,queries,search,parseOutput = showConsoleLink('functions', 'listExecutions', functionId); } else { parse(response) - success() } } @@ -951,7 +1026,6 @@ const functionsCreateExecution = async ({functionId,body,async,xpath,method,head if (parseOutput) { parse(response) - success() } return response; @@ -987,7 +1061,6 @@ const functionsGetExecution = async ({functionId,executionId,parseOutput = true, showConsoleLink('functions', 'getExecution', functionId, executionId); } else { parse(response) - success() } } @@ -1021,7 +1094,6 @@ const functionsDeleteExecution = async ({functionId,executionId,parseOutput = tr if (parseOutput) { parse(response) - success() } return response; @@ -1060,7 +1132,6 @@ const functionsGetFunctionUsage = async ({functionId,range,parseOutput = true, o showConsoleLink('functions', 'getFunctionUsage', functionId); } else { parse(response) - success() } } @@ -1093,7 +1164,6 @@ const functionsListVariables = async ({functionId,parseOutput = true, overrideFo if (parseOutput) { parse(response) - success() } return response; @@ -1133,7 +1203,6 @@ const functionsCreateVariable = async ({functionId,key,value,parseOutput = true, if (parseOutput) { parse(response) - success() } return response; @@ -1166,7 +1235,6 @@ const functionsGetVariable = async ({functionId,variableId,parseOutput = true, o if (parseOutput) { parse(response) - success() } return response; @@ -1207,7 +1275,6 @@ const functionsUpdateVariable = async ({functionId,variableId,key,value,parseOut if (parseOutput) { parse(response) - success() } return response; @@ -1240,7 +1307,6 @@ const functionsDeleteVariable = async ({functionId,variableId,parseOutput = true if (parseOutput) { parse(response) - success() } return response; @@ -1286,6 +1352,23 @@ functions .description(`Get a list of all runtimes that are currently active on your instance.`) .action(actionRunner(functionsListRuntimes)) +functions + .command(`list-templates`) + .description(`List available function templates. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method.`) + .option(`--runtimes [runtimes...]`, `List of runtimes allowed for filtering function templates. Maximum of 100 runtimes are allowed.`) + .option(`--use-cases [use-cases...]`, `List of use cases allowed for filtering function templates. Maximum of 100 use cases are allowed.`) + .option(`--limit `, `Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000.`, parseInteger) + .option(`--offset `, `Offset the list of returned templates. Maximum offset is 5000.`, parseInteger) + .option(`--console`, `Get the resource console url`) + .action(actionRunner(functionsListTemplates)) + +functions + .command(`get-template`) + .description(`Get a function template using ID. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method.`) + .requiredOption(`--template-id `, `Template ID.`) + .option(`--console`, `Get the resource console url`) + .action(actionRunner(functionsGetTemplate)) + functions .command(`get-usage`) .description(``) @@ -1384,12 +1467,13 @@ functions .action(actionRunner(functionsUpdateDeploymentBuild)) functions - .command(`download-deployment`) + .command(`get-deployment-download`) .description(`Get a Deployment's contents by its unique ID. This endpoint supports range requests for partial or streaming file download.`) .requiredOption(`--function-id `, `Function ID.`) .requiredOption(`--deployment-id `, `Deployment ID.`) .requiredOption(`--destination `, `output file path.`) - .action(actionRunner(functionsDownloadDeployment)) + .option(`--console`, `Get the resource console url`) + .action(actionRunner(functionsGetDeploymentDownload)) functions .command(`list-executions`) @@ -1477,6 +1561,8 @@ module.exports = { functionsList, functionsCreate, functionsListRuntimes, + functionsListTemplates, + functionsGetTemplate, functionsGetUsage, functionsGet, functionsUpdate, @@ -1488,7 +1574,7 @@ module.exports = { functionsDeleteDeployment, functionsCreateBuild, functionsUpdateDeploymentBuild, - functionsDownloadDeployment, + functionsGetDeploymentDownload, functionsListExecutions, functionsCreateExecution, functionsGetExecution, diff --git a/lib/commands/generic.js b/lib/commands/generic.js index 691ff85..6b6e5df 100644 --- a/lib/commands/generic.js +++ b/lib/commands/generic.js @@ -6,7 +6,7 @@ const { globalConfig, localConfig } = require("../config"); const { actionRunner, success, parseBool, commandDescriptions, error, parse, hint, log, drawTable, cliConfig } = require("../parser"); const ID = require("../id"); const { questionsLogin, questionsLogout, questionsListFactors, questionsMfaChallenge } = require("../questions"); -const { accountUpdateMfaChallenge, accountCreateMfaChallenge, accountGet, accountCreateEmailPasswordSession, accountDeleteSession } = require("./account"); +const { accountUpdateMfaChallenge, accountCreateMfaChallenge, accountGet, accountCreateEmailPasswordSession, accountDeleteSession } = require("./account"); const DEFAULT_ENDPOINT = 'https://cloud.appwrite.io/v1'; @@ -14,17 +14,17 @@ const loginCommand = async ({ email, password, endpoint, mfa, code }) => { const oldCurrent = globalConfig.getCurrentSession(); let configEndpoint = endpoint ?? DEFAULT_ENDPOINT; - if(globalConfig.getCurrentSession() !== '') { + if (globalConfig.getCurrentSession() !== '') { log('You are currently signed in as ' + globalConfig.getEmail()); - if(globalConfig.getSessions().length === 1) { + if (globalConfig.getSessions().length === 1) { hint('You can sign in and manage multiple accounts with Appwrite CLI'); } } const answers = email && password ? { email, password } : await inquirer.prompt(questionsLogin); - if(!answers.method) { + if (!answers.method) { answers.method = 'login'; } @@ -92,7 +92,7 @@ const loginCommand = async ({ email, password, endpoint, mfa, code }) => { } else { globalConfig.removeSession(id); globalConfig.setCurrentSession(oldCurrent); - if(endpoint !== DEFAULT_ENDPOINT && error.response === 'user_invalid_credentials'){ + if (endpoint !== DEFAULT_ENDPOINT && error.response === 'user_invalid_credentials') { log('Use the --endpoint option for self-hosted instances') } throw error; @@ -135,7 +135,7 @@ const whoami = new Command("whoami") } ]; - if(cliConfig.json) { + if (cliConfig.json) { console.log(data); return; } @@ -193,7 +193,7 @@ const logout = new Command("logout") } if (sessions.length === 1) { await deleteSession(current); - success(); + success("Logging out"); return; } @@ -207,16 +207,16 @@ const logout = new Command("logout") } } - const remainingSessions = globalConfig.getSessions(); + const remainingSessions = globalConfig.getSessions(); - if (remainingSessions .length > 0 && remainingSessions .filter(session => session.id === current).length !== 1) { + if (remainingSessions.length > 0 && remainingSessions.filter(session => session.id === current).length !== 1) { const accountId = remainingSessions [0].id; globalConfig.setCurrentSession(accountId); success(`Current account is ${accountId}`); } - success(); + success("Logging out"); })); const client = new Command("client") @@ -292,7 +292,7 @@ const client = new Command("client") } } - success() + success("Setting client") })); const migrate = async () => { diff --git a/lib/commands/graphql.js b/lib/commands/graphql.js index 8c6a90b..c3c6c0c 100644 --- a/lib/commands/graphql.js +++ b/lib/commands/graphql.js @@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) { }); } -const graphql = new Command("graphql").description(commandDescriptions['graphql']).configureHelp({ +const graphql = new Command("graphql").description(commandDescriptions['graphql'] ?? '').configureHelp({ helpWidth: process.stdout.columns || 80 }) @@ -68,7 +68,6 @@ const graphqlQuery = async ({query,parseOutput = true, overrideForCli = false, s if (parseOutput) { parse(response) - success() } return response; @@ -104,7 +103,6 @@ const graphqlMutation = async ({query,parseOutput = true, overrideForCli = false if (parseOutput) { parse(response) - success() } return response; diff --git a/lib/commands/health.js b/lib/commands/health.js index 70a291b..99f6896 100644 --- a/lib/commands/health.js +++ b/lib/commands/health.js @@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) { }); } -const health = new Command("health").description(commandDescriptions['health']).configureHelp({ +const health = new Command("health").description(commandDescriptions['health'] ?? '').configureHelp({ helpWidth: process.stdout.columns || 80 }) @@ -63,7 +63,6 @@ const healthGet = async ({parseOutput = true, overrideForCli = false, sdk = unde if (parseOutput) { parse(response) - success() } return response; @@ -94,7 +93,6 @@ const healthGetAntivirus = async ({parseOutput = true, overrideForCli = false, s if (parseOutput) { parse(response) - success() } return response; @@ -125,7 +123,6 @@ const healthGetCache = async ({parseOutput = true, overrideForCli = false, sdk = if (parseOutput) { parse(response) - success() } return response; @@ -160,7 +157,6 @@ const healthGetCertificate = async ({domain,parseOutput = true, overrideForCli = if (parseOutput) { parse(response) - success() } return response; @@ -191,7 +187,6 @@ const healthGetDB = async ({parseOutput = true, overrideForCli = false, sdk = un if (parseOutput) { parse(response) - success() } return response; @@ -222,7 +217,6 @@ const healthGetPubSub = async ({parseOutput = true, overrideForCli = false, sdk if (parseOutput) { parse(response) - success() } return response; @@ -253,7 +247,6 @@ const healthGetQueue = async ({parseOutput = true, overrideForCli = false, sdk = if (parseOutput) { parse(response) - success() } return response; @@ -288,7 +281,6 @@ const healthGetQueueBuilds = async ({threshold,parseOutput = true, overrideForCl if (parseOutput) { parse(response) - success() } return response; @@ -323,7 +315,6 @@ const healthGetQueueCertificates = async ({threshold,parseOutput = true, overrid if (parseOutput) { parse(response) - success() } return response; @@ -362,7 +353,6 @@ const healthGetQueueDatabases = async ({name,threshold,parseOutput = true, overr if (parseOutput) { parse(response) - success() } return response; @@ -397,7 +387,6 @@ const healthGetQueueDeletes = async ({threshold,parseOutput = true, overrideForC if (parseOutput) { parse(response) - success() } return response; @@ -433,7 +422,6 @@ const healthGetFailedJobs = async ({name,threshold,parseOutput = true, overrideF if (parseOutput) { parse(response) - success() } return response; @@ -468,7 +456,6 @@ const healthGetQueueFunctions = async ({threshold,parseOutput = true, overrideFo if (parseOutput) { parse(response) - success() } return response; @@ -503,7 +490,6 @@ const healthGetQueueLogs = async ({threshold,parseOutput = true, overrideForCli if (parseOutput) { parse(response) - success() } return response; @@ -538,7 +524,6 @@ const healthGetQueueMails = async ({threshold,parseOutput = true, overrideForCli if (parseOutput) { parse(response) - success() } return response; @@ -573,7 +558,6 @@ const healthGetQueueMessaging = async ({threshold,parseOutput = true, overrideFo if (parseOutput) { parse(response) - success() } return response; @@ -608,7 +592,6 @@ const healthGetQueueMigrations = async ({threshold,parseOutput = true, overrideF if (parseOutput) { parse(response) - success() } return response; @@ -643,7 +626,6 @@ const healthGetQueueUsage = async ({threshold,parseOutput = true, overrideForCli if (parseOutput) { parse(response) - success() } return response; @@ -678,7 +660,6 @@ const healthGetQueueUsageDump = async ({threshold,parseOutput = true, overrideFo if (parseOutput) { parse(response) - success() } return response; @@ -713,7 +694,6 @@ const healthGetQueueWebhooks = async ({threshold,parseOutput = true, overrideFor if (parseOutput) { parse(response) - success() } return response; @@ -744,7 +724,6 @@ const healthGetStorage = async ({parseOutput = true, overrideForCli = false, sdk if (parseOutput) { parse(response) - success() } return response; @@ -775,7 +754,6 @@ const healthGetStorageLocal = async ({parseOutput = true, overrideForCli = false if (parseOutput) { parse(response) - success() } return response; @@ -806,7 +784,6 @@ const healthGetTime = async ({parseOutput = true, overrideForCli = false, sdk = if (parseOutput) { parse(response) - success() } return response; diff --git a/lib/commands/init.js b/lib/commands/init.js index 69e34c1..4f2b6a3 100644 --- a/lib/commands/init.js +++ b/lib/commands/init.js @@ -129,7 +129,7 @@ const initBucket = async () => { fileSecurity: answers.fileSecurity.toLowerCase() === 'yes', enabled: true, }); - success(); + success("Initialing bucket"); log("Next you can use 'appwrite push bucket' to deploy the changes."); }; @@ -141,7 +141,7 @@ const initTeam = async () => { name: answers.bucket, }); - success(); + success("Initialing team"); log("Next you can use 'appwrite push team' to deploy the changes."); }; @@ -174,7 +174,7 @@ const initCollection = async () => { enabled: true, }); - success(); + success("Initialing collection"); log("Next you can use 'appwrite push collection' to deploy the changes."); }; @@ -187,7 +187,7 @@ const initTopic = async () => { }); - success(); + success("Initialing topic"); log("Next you can use 'appwrite push topic' to deploy the changes."); }; @@ -223,21 +223,7 @@ const initFunction = async () => { fs.mkdirSync(templatesDir, "777"); const repo = "https://github.com/appwrite/templates"; const api = `https://api.github.com/repos/appwrite/templates/contents/${answers.runtime.name}` - let selected = undefined; - - if(answers.template === 'starter') { - selected = { template: 'starter' }; - } else { - try { - const res = await fetch(api); - const templates = []; - templates.push(...(await res.json()).map((template) => template.name)); - selected = await inquirer.prompt(questionsCreateFunctionSelectTemplate(templates)); - } catch { - // Not a problem will go with directory pulling - log('Loading templates...'); - } - } + let selected = { template: 'starter' }; const sparse = (selected ? `${answers.runtime.name}/${selected.template}` : answers.runtime.name).toLowerCase(); @@ -312,6 +298,7 @@ const initFunction = async () => { runtime: answers.runtime.id, execute: [], events: [], + scopes: [], schedule: "", timeout: 15, enabled: true, @@ -323,7 +310,7 @@ const initFunction = async () => { }; localConfig.addFunction(data); - success(); + success("Initialing function"); log("Next you can use 'appwrite run function' to develop a function locally. To deploy the function, use 'appwrite push function'"); } diff --git a/lib/commands/locale.js b/lib/commands/locale.js index 1382b96..a23dafa 100644 --- a/lib/commands/locale.js +++ b/lib/commands/locale.js @@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) { }); } -const locale = new Command("locale").description(commandDescriptions['locale']).configureHelp({ +const locale = new Command("locale").description(commandDescriptions['locale'] ?? '').configureHelp({ helpWidth: process.stdout.columns || 80 }) @@ -63,7 +63,6 @@ const localeGet = async ({parseOutput = true, overrideForCli = false, sdk = unde if (parseOutput) { parse(response) - success() } return response; @@ -94,7 +93,6 @@ const localeListCodes = async ({parseOutput = true, overrideForCli = false, sdk if (parseOutput) { parse(response) - success() } return response; @@ -125,7 +123,6 @@ const localeListContinents = async ({parseOutput = true, overrideForCli = false, if (parseOutput) { parse(response) - success() } return response; @@ -156,7 +153,6 @@ const localeListCountries = async ({parseOutput = true, overrideForCli = false, if (parseOutput) { parse(response) - success() } return response; @@ -187,7 +183,6 @@ const localeListCountriesEU = async ({parseOutput = true, overrideForCli = false if (parseOutput) { parse(response) - success() } return response; @@ -218,7 +213,6 @@ const localeListCountriesPhones = async ({parseOutput = true, overrideForCli = f if (parseOutput) { parse(response) - success() } return response; @@ -249,7 +243,6 @@ const localeListCurrencies = async ({parseOutput = true, overrideForCli = false, if (parseOutput) { parse(response) - success() } return response; @@ -280,7 +273,6 @@ const localeListLanguages = async ({parseOutput = true, overrideForCli = false, if (parseOutput) { parse(response) - success() } return response; diff --git a/lib/commands/messaging.js b/lib/commands/messaging.js index b775315..0004554 100644 --- a/lib/commands/messaging.js +++ b/lib/commands/messaging.js @@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) { }); } -const messaging = new Command("messaging").description(commandDescriptions['messaging']).configureHelp({ +const messaging = new Command("messaging").description(commandDescriptions['messaging'] ?? '').configureHelp({ helpWidth: process.stdout.columns || 80 }) @@ -74,7 +74,6 @@ const messagingListMessages = async ({queries,search,parseOutput = true, overrid showConsoleLink('messaging', 'listMessages'); } else { parse(response) - success() } } @@ -160,7 +159,6 @@ const messagingCreateEmail = async ({messageId,subject,content,topics,users,targ if (parseOutput) { parse(response) - success() } return response; @@ -242,7 +240,6 @@ const messagingUpdateEmail = async ({messageId,topics,users,targets,subject,cont if (parseOutput) { parse(response) - success() } return response; @@ -340,7 +337,6 @@ const messagingCreatePush = async ({messageId,title,body,topics,users,targets,da if (parseOutput) { parse(response) - success() } return response; @@ -435,7 +431,6 @@ const messagingUpdatePush = async ({messageId,topics,users,targets,title,body,da if (parseOutput) { parse(response) - success() } return response; @@ -497,7 +492,6 @@ const messagingCreateSms = async ({messageId,content,topics,users,targets,draft, if (parseOutput) { parse(response) - success() } return response; @@ -556,7 +550,6 @@ const messagingUpdateSms = async ({messageId,topics,users,targets,content,draft, if (parseOutput) { parse(response) - success() } return response; @@ -591,7 +584,6 @@ const messagingGetMessage = async ({messageId,parseOutput = true, overrideForCli showConsoleLink('messaging', 'getMessage', messageId); } else { parse(response) - success() } } @@ -624,7 +616,6 @@ const messagingDelete = async ({messageId,parseOutput = true, overrideForCli = f if (parseOutput) { parse(response) - success() } return response; @@ -663,7 +654,6 @@ const messagingListMessageLogs = async ({messageId,queries,parseOutput = true, o showConsoleLink('messaging', 'listMessageLogs', messageId); } else { parse(response) - success() } } @@ -700,7 +690,6 @@ const messagingListTargets = async ({messageId,queries,parseOutput = true, overr if (parseOutput) { parse(response) - success() } return response; @@ -742,7 +731,6 @@ const messagingListProviders = async ({queries,search,parseOutput = true, overri showConsoleLink('messaging', 'listProviders'); } else { parse(response) - success() } } @@ -806,7 +794,6 @@ const messagingCreateApnsProvider = async ({providerId,name,authKey,authKeyId,te if (parseOutput) { parse(response) - success() } return response; @@ -866,7 +853,6 @@ const messagingUpdateApnsProvider = async ({providerId,name,enabled,authKey,auth if (parseOutput) { parse(response) - success() } return response; @@ -913,7 +899,6 @@ const messagingCreateFcmProvider = async ({providerId,name,serviceAccountJSON,en if (parseOutput) { parse(response) - success() } return response; @@ -957,7 +942,6 @@ const messagingUpdateFcmProvider = async ({providerId,name,enabled,serviceAccoun if (parseOutput) { parse(response) - success() } return response; @@ -1028,7 +1012,6 @@ const messagingCreateMailgunProvider = async ({providerId,name,apiKey,domain,isE if (parseOutput) { parse(response) - success() } return response; @@ -1096,7 +1079,6 @@ const messagingUpdateMailgunProvider = async ({providerId,name,apiKey,domain,isE if (parseOutput) { parse(response) - success() } return response; @@ -1151,7 +1133,6 @@ const messagingCreateMsg91Provider = async ({providerId,name,templateId,senderId if (parseOutput) { parse(response) - success() } return response; @@ -1203,7 +1184,6 @@ const messagingUpdateMsg91Provider = async ({providerId,name,enabled,templateId, if (parseOutput) { parse(response) - success() } return response; @@ -1266,7 +1246,6 @@ const messagingCreateSendgridProvider = async ({providerId,name,apiKey,fromName, if (parseOutput) { parse(response) - success() } return response; @@ -1326,7 +1305,6 @@ const messagingUpdateSendgridProvider = async ({providerId,name,enabled,apiKey,f if (parseOutput) { parse(response) - success() } return response; @@ -1413,7 +1391,6 @@ const messagingCreateSmtpProvider = async ({providerId,name,host,port,username,p if (parseOutput) { parse(response) - success() } return response; @@ -1497,7 +1474,6 @@ const messagingUpdateSmtpProvider = async ({providerId,name,host,port,username,p if (parseOutput) { parse(response) - success() } return response; @@ -1552,7 +1528,6 @@ const messagingCreateTelesignProvider = async ({providerId,name,from,customerId, if (parseOutput) { parse(response) - success() } return response; @@ -1604,7 +1579,6 @@ const messagingUpdateTelesignProvider = async ({providerId,name,enabled,customer if (parseOutput) { parse(response) - success() } return response; @@ -1659,7 +1633,6 @@ const messagingCreateTextmagicProvider = async ({providerId,name,from,username,a if (parseOutput) { parse(response) - success() } return response; @@ -1711,7 +1684,6 @@ const messagingUpdateTextmagicProvider = async ({providerId,name,enabled,usernam if (parseOutput) { parse(response) - success() } return response; @@ -1766,7 +1738,6 @@ const messagingCreateTwilioProvider = async ({providerId,name,from,accountSid,au if (parseOutput) { parse(response) - success() } return response; @@ -1818,7 +1789,6 @@ const messagingUpdateTwilioProvider = async ({providerId,name,enabled,accountSid if (parseOutput) { parse(response) - success() } return response; @@ -1873,7 +1843,6 @@ const messagingCreateVonageProvider = async ({providerId,name,from,apiKey,apiSec if (parseOutput) { parse(response) - success() } return response; @@ -1925,7 +1894,6 @@ const messagingUpdateVonageProvider = async ({providerId,name,enabled,apiKey,api if (parseOutput) { parse(response) - success() } return response; @@ -1960,7 +1928,6 @@ const messagingGetProvider = async ({providerId,parseOutput = true, overrideForC showConsoleLink('messaging', 'getProvider', providerId); } else { parse(response) - success() } } @@ -1993,7 +1960,6 @@ const messagingDeleteProvider = async ({providerId,parseOutput = true, overrideF if (parseOutput) { parse(response) - success() } return response; @@ -2029,7 +1995,6 @@ const messagingListProviderLogs = async ({providerId,queries,parseOutput = true, if (parseOutput) { parse(response) - success() } return response; @@ -2065,7 +2030,6 @@ const messagingListSubscriberLogs = async ({subscriberId,queries,parseOutput = t if (parseOutput) { parse(response) - success() } return response; @@ -2107,7 +2071,6 @@ const messagingListTopics = async ({queries,search,parseOutput = true, overrideF showConsoleLink('messaging', 'listTopics'); } else { parse(response) - success() } } @@ -2152,7 +2115,6 @@ const messagingCreateTopic = async ({topicId,name,subscribe,parseOutput = true, if (parseOutput) { parse(response) - success() } return response; @@ -2187,7 +2149,6 @@ const messagingGetTopic = async ({topicId,parseOutput = true, overrideForCli = f showConsoleLink('messaging', 'getTopic', topicId); } else { parse(response) - success() } } @@ -2229,7 +2190,6 @@ const messagingUpdateTopic = async ({topicId,name,subscribe,parseOutput = true, if (parseOutput) { parse(response) - success() } return response; @@ -2261,7 +2221,6 @@ const messagingDeleteTopic = async ({topicId,parseOutput = true, overrideForCli if (parseOutput) { parse(response) - success() } return response; @@ -2297,7 +2256,6 @@ const messagingListTopicLogs = async ({topicId,queries,parseOutput = true, overr if (parseOutput) { parse(response) - success() } return response; @@ -2340,7 +2298,6 @@ const messagingListSubscribers = async ({topicId,queries,search,parseOutput = tr showConsoleLink('messaging', 'listSubscribers', topicId); } else { parse(response) - success() } } @@ -2381,7 +2338,6 @@ const messagingCreateSubscriber = async ({topicId,subscriberId,targetId,parseOut if (parseOutput) { parse(response) - success() } return response; @@ -2414,7 +2370,6 @@ const messagingGetSubscriber = async ({topicId,subscriberId,parseOutput = true, if (parseOutput) { parse(response) - success() } return response; @@ -2447,7 +2402,6 @@ const messagingDeleteSubscriber = async ({topicId,subscriberId,parseOutput = tru if (parseOutput) { parse(response) - success() } return response; diff --git a/lib/commands/migrations.js b/lib/commands/migrations.js index 3b80874..043cad4 100644 --- a/lib/commands/migrations.js +++ b/lib/commands/migrations.js @@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) { }); } -const migrations = new Command("migrations").description(commandDescriptions['migrations']).configureHelp({ +const migrations = new Command("migrations").description(commandDescriptions['migrations'] ?? '').configureHelp({ helpWidth: process.stdout.columns || 80 }) @@ -71,7 +71,6 @@ const migrationsList = async ({queries,search,parseOutput = true, overrideForCli if (parseOutput) { parse(response) - success() } return response; @@ -119,7 +118,6 @@ const migrationsCreateAppwriteMigration = async ({resources,endpoint,projectId,a if (parseOutput) { parse(response) - success() } return response; @@ -166,7 +164,6 @@ const migrationsGetAppwriteReport = async ({resources,endpoint,projectID,key,par if (parseOutput) { parse(response) - success() } return response; @@ -206,7 +203,6 @@ const migrationsCreateFirebaseMigration = async ({resources,serviceAccount,parse if (parseOutput) { parse(response) - success() } return response; @@ -237,7 +233,6 @@ const migrationsDeleteFirebaseAuth = async ({parseOutput = true, overrideForCli if (parseOutput) { parse(response) - success() } return response; @@ -277,7 +272,6 @@ const migrationsCreateFirebaseOAuthMigration = async ({resources,projectId,parse if (parseOutput) { parse(response) - success() } return response; @@ -308,7 +302,6 @@ const migrationsListFirebaseProjects = async ({parseOutput = true, overrideForCl if (parseOutput) { parse(response) - success() } return response; @@ -347,7 +340,6 @@ const migrationsGetFirebaseReport = async ({resources,serviceAccount,parseOutput if (parseOutput) { parse(response) - success() } return response; @@ -386,7 +378,6 @@ const migrationsGetFirebaseReportOAuth = async ({resources,projectId,parseOutput if (parseOutput) { parse(response) - success() } return response; @@ -450,7 +441,6 @@ const migrationsCreateNHostMigration = async ({resources,subdomain,region,adminS if (parseOutput) { parse(response) - success() } return response; @@ -513,7 +503,6 @@ const migrationsGetNHostReport = async ({resources,subdomain,region,adminSecret, if (parseOutput) { parse(response) - success() } return response; @@ -573,7 +562,6 @@ const migrationsCreateSupabaseMigration = async ({resources,endpoint,apiKey,data if (parseOutput) { parse(response) - success() } return response; @@ -632,7 +620,6 @@ const migrationsGetSupabaseReport = async ({resources,endpoint,apiKey,databaseHo if (parseOutput) { parse(response) - success() } return response; @@ -664,7 +651,6 @@ const migrationsGet = async ({migrationId,parseOutput = true, overrideForCli = f if (parseOutput) { parse(response) - success() } return response; @@ -696,7 +682,6 @@ const migrationsRetry = async ({migrationId,parseOutput = true, overrideForCli = if (parseOutput) { parse(response) - success() } return response; @@ -728,7 +713,6 @@ const migrationsDelete = async ({migrationId,parseOutput = true, overrideForCli if (parseOutput) { parse(response) - success() } return response; diff --git a/lib/commands/project.js b/lib/commands/project.js index c81e2b5..1630ee5 100644 --- a/lib/commands/project.js +++ b/lib/commands/project.js @@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) { }); } -const project = new Command("project").description(commandDescriptions['project']).configureHelp({ +const project = new Command("project").description(commandDescriptions['project'] ?? '').configureHelp({ helpWidth: process.stdout.columns || 80 }) @@ -75,7 +75,6 @@ const projectGetUsage = async ({startDate,endDate,period,parseOutput = true, ove if (parseOutput) { parse(response) - success() } return response; @@ -106,7 +105,6 @@ const projectListVariables = async ({parseOutput = true, overrideForCli = false, if (parseOutput) { parse(response) - success() } return response; @@ -145,7 +143,6 @@ const projectCreateVariable = async ({key,value,parseOutput = true, overrideForC if (parseOutput) { parse(response) - success() } return response; @@ -177,7 +174,6 @@ const projectGetVariable = async ({variableId,parseOutput = true, overrideForCli if (parseOutput) { parse(response) - success() } return response; @@ -217,7 +213,6 @@ const projectUpdateVariable = async ({variableId,key,value,parseOutput = true, o if (parseOutput) { parse(response) - success() } return response; @@ -249,7 +244,6 @@ const projectDeleteVariable = async ({variableId,parseOutput = true, overrideFor if (parseOutput) { parse(response) - success() } return response; diff --git a/lib/commands/projects.js b/lib/commands/projects.js index 4623d2e..243f762 100644 --- a/lib/commands/projects.js +++ b/lib/commands/projects.js @@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) { }); } -const projects = new Command("projects").description(commandDescriptions['projects']).configureHelp({ +const projects = new Command("projects").description(commandDescriptions['projects'] ?? '').configureHelp({ helpWidth: process.stdout.columns || 80 }) @@ -74,7 +74,6 @@ const projectsList = async ({queries,search,parseOutput = true, overrideForCli = showConsoleLink('projects', 'list'); } else { parse(response) - success() } } @@ -158,7 +157,6 @@ const projectsCreate = async ({projectId,name,teamId,region,description,logo,url if (parseOutput) { parse(response) - success() } return response; @@ -193,7 +191,6 @@ const projectsGet = async ({projectId,parseOutput = true, overrideForCli = false showConsoleLink('projects', 'get', projectId); } else { parse(response) - success() } } @@ -266,7 +263,6 @@ const projectsUpdate = async ({projectId,name,description,logo,url,legalName,leg if (parseOutput) { parse(response) - success() } return response; @@ -298,7 +294,6 @@ const projectsDelete = async ({projectId,parseOutput = true, overrideForCli = fa if (parseOutput) { parse(response) - success() } return response; @@ -338,7 +333,6 @@ const projectsUpdateApiStatus = async ({projectId,api,status,parseOutput = true, if (parseOutput) { parse(response) - success() } return response; @@ -374,7 +368,6 @@ const projectsUpdateApiStatusAll = async ({projectId,status,parseOutput = true, if (parseOutput) { parse(response) - success() } return response; @@ -410,7 +403,6 @@ const projectsUpdateAuthDuration = async ({projectId,duration,parseOutput = true if (parseOutput) { parse(response) - success() } return response; @@ -446,7 +438,6 @@ const projectsUpdateAuthLimit = async ({projectId,limit,parseOutput = true, over if (parseOutput) { parse(response) - success() } return response; @@ -482,7 +473,6 @@ const projectsUpdateAuthSessionsLimit = async ({projectId,limit,parseOutput = tr if (parseOutput) { parse(response) - success() } return response; @@ -519,7 +509,6 @@ const projectsUpdateMockNumbers = async ({projectId,numbers,parseOutput = true, if (parseOutput) { parse(response) - success() } return response; @@ -555,7 +544,6 @@ const projectsUpdateAuthPasswordDictionary = async ({projectId,enabled,parseOutp if (parseOutput) { parse(response) - success() } return response; @@ -591,7 +579,6 @@ const projectsUpdateAuthPasswordHistory = async ({projectId,limit,parseOutput = if (parseOutput) { parse(response) - success() } return response; @@ -627,7 +614,6 @@ const projectsUpdatePersonalDataCheck = async ({projectId,enabled,parseOutput = if (parseOutput) { parse(response) - success() } return response; @@ -663,7 +649,6 @@ const projectsUpdateSessionAlerts = async ({projectId,alerts,parseOutput = true, if (parseOutput) { parse(response) - success() } return response; @@ -700,7 +685,6 @@ const projectsUpdateAuthStatus = async ({projectId,method,status,parseOutput = t if (parseOutput) { parse(response) - success() } return response; @@ -741,7 +725,6 @@ const projectsCreateJWT = async ({projectId,scopes,duration,parseOutput = true, if (parseOutput) { parse(response) - success() } return response; @@ -776,7 +759,6 @@ const projectsListKeys = async ({projectId,parseOutput = true, overrideForCli = showConsoleLink('projects', 'listKeys', projectId); } else { parse(response) - success() } } @@ -822,7 +804,6 @@ const projectsCreateKey = async ({projectId,name,scopes,expire,parseOutput = tru if (parseOutput) { parse(response) - success() } return response; @@ -858,7 +839,6 @@ const projectsGetKey = async ({projectId,keyId,parseOutput = true, overrideForCl showConsoleLink('projects', 'getKey', projectId, keyId); } else { parse(response) - success() } } @@ -905,7 +885,6 @@ const projectsUpdateKey = async ({projectId,keyId,name,scopes,expire,parseOutput if (parseOutput) { parse(response) - success() } return response; @@ -938,7 +917,6 @@ const projectsDeleteKey = async ({projectId,keyId,parseOutput = true, overrideFo if (parseOutput) { parse(response) - success() } return response; @@ -986,7 +964,6 @@ const projectsUpdateOAuth2 = async ({projectId,provider,appId,secret,enabled,par if (parseOutput) { parse(response) - success() } return response; @@ -1021,7 +998,6 @@ const projectsListPlatforms = async ({projectId,parseOutput = true, overrideForC showConsoleLink('projects', 'listPlatforms', projectId); } else { parse(response) - success() } } @@ -1074,7 +1050,6 @@ const projectsCreatePlatform = async ({projectId,type,name,key,store,hostname,pa if (parseOutput) { parse(response) - success() } return response; @@ -1110,7 +1085,6 @@ const projectsGetPlatform = async ({projectId,platformId,parseOutput = true, ove showConsoleLink('projects', 'getPlatform', projectId, platformId); } else { parse(response) - success() } } @@ -1160,7 +1134,6 @@ const projectsUpdatePlatform = async ({projectId,platformId,name,key,store,hostn if (parseOutput) { parse(response) - success() } return response; @@ -1193,7 +1166,6 @@ const projectsDeletePlatform = async ({projectId,platformId,parseOutput = true, if (parseOutput) { parse(response) - success() } return response; @@ -1233,7 +1205,6 @@ const projectsUpdateServiceStatus = async ({projectId,service,status,parseOutput if (parseOutput) { parse(response) - success() } return response; @@ -1269,7 +1240,6 @@ const projectsUpdateServiceStatusAll = async ({projectId,status,parseOutput = tr if (parseOutput) { parse(response) - success() } return response; @@ -1337,7 +1307,6 @@ const projectsUpdateSmtp = async ({projectId,enabled,senderName,senderEmail,repl if (parseOutput) { parse(response) - success() } return response; @@ -1406,7 +1375,6 @@ const projectsCreateSmtpTest = async ({projectId,emails,senderName,senderEmail,h if (parseOutput) { parse(response) - success() } return response; @@ -1442,7 +1410,6 @@ const projectsUpdateTeam = async ({projectId,teamId,parseOutput = true, override if (parseOutput) { parse(response) - success() } return response; @@ -1476,7 +1443,6 @@ const projectsGetEmailTemplate = async ({projectId,type,locale,parseOutput = tru if (parseOutput) { parse(response) - success() } return response; @@ -1530,7 +1496,6 @@ const projectsUpdateEmailTemplate = async ({projectId,type,locale,subject,messag if (parseOutput) { parse(response) - success() } return response; @@ -1564,7 +1529,6 @@ const projectsDeleteEmailTemplate = async ({projectId,type,locale,parseOutput = if (parseOutput) { parse(response) - success() } return response; @@ -1598,7 +1562,6 @@ const projectsGetSmsTemplate = async ({projectId,type,locale,parseOutput = true, if (parseOutput) { parse(response) - success() } return response; @@ -1636,7 +1599,6 @@ const projectsUpdateSmsTemplate = async ({projectId,type,locale,message,parseOut if (parseOutput) { parse(response) - success() } return response; @@ -1670,7 +1632,6 @@ const projectsDeleteSmsTemplate = async ({projectId,type,locale,parseOutput = tr if (parseOutput) { parse(response) - success() } return response; @@ -1705,7 +1666,6 @@ const projectsListWebhooks = async ({projectId,parseOutput = true, overrideForCl showConsoleLink('projects', 'listWebhooks', projectId); } else { parse(response) - success() } } @@ -1767,7 +1727,6 @@ const projectsCreateWebhook = async ({projectId,name,events,url,security,enabled if (parseOutput) { parse(response) - success() } return response; @@ -1803,7 +1762,6 @@ const projectsGetWebhook = async ({projectId,webhookId,parseOutput = true, overr showConsoleLink('projects', 'getWebhook', projectId, webhookId); } else { parse(response) - success() } } @@ -1866,7 +1824,6 @@ const projectsUpdateWebhook = async ({projectId,webhookId,name,events,url,securi if (parseOutput) { parse(response) - success() } return response; @@ -1899,7 +1856,6 @@ const projectsDeleteWebhook = async ({projectId,webhookId,parseOutput = true, ov if (parseOutput) { parse(response) - success() } return response; @@ -1932,7 +1888,6 @@ const projectsUpdateWebhookSignature = async ({projectId,webhookId,parseOutput = if (parseOutput) { parse(response) - success() } return response; diff --git a/lib/commands/proxy.js b/lib/commands/proxy.js index 9cc74fa..beffbda 100644 --- a/lib/commands/proxy.js +++ b/lib/commands/proxy.js @@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) { }); } -const proxy = new Command("proxy").description(commandDescriptions['proxy']).configureHelp({ +const proxy = new Command("proxy").description(commandDescriptions['proxy'] ?? '').configureHelp({ helpWidth: process.stdout.columns || 80 }) @@ -71,7 +71,6 @@ const proxyListRules = async ({queries,search,parseOutput = true, overrideForCli if (parseOutput) { parse(response) - success() } return response; @@ -114,7 +113,6 @@ const proxyCreateRule = async ({domain,resourceType,resourceId,parseOutput = tru if (parseOutput) { parse(response) - success() } return response; @@ -146,7 +144,6 @@ const proxyGetRule = async ({ruleId,parseOutput = true, overrideForCli = false, if (parseOutput) { parse(response) - success() } return response; @@ -178,7 +175,6 @@ const proxyDeleteRule = async ({ruleId,parseOutput = true, overrideForCli = fals if (parseOutput) { parse(response) - success() } return response; @@ -210,7 +206,6 @@ const proxyUpdateRuleVerification = async ({ruleId,parseOutput = true, overrideF if (parseOutput) { parse(response) - success() } return response; diff --git a/lib/commands/pull.js b/lib/commands/pull.js index a399aee..ba9d405 100644 --- a/lib/commands/pull.js +++ b/lib/commands/pull.js @@ -6,7 +6,7 @@ const inquirer = require("inquirer"); const { messagingListTopics } = require("./messaging"); const { teamsList } = require("./teams"); const { projectsGet } = require("./projects"); -const { functionsList, functionsDownloadDeployment } = require("./functions"); +const { functionsList, functionsGetDeploymentDownload, functionsListDeployments } = require("./functions"); const { databasesGet, databasesListCollections, databasesList } = require("./databases"); const { storageListBuckets } = require("./storage"); const { localConfig } = require("../config"); @@ -56,7 +56,7 @@ const pullSettings = async () => { } } -const pullFunctions = async ({ code }) => { +const pullFunctions = async ({ code, withVariables }) => { log("Fetching functions ..."); let total = 0; @@ -83,47 +83,84 @@ const pullFunctions = async ({ code }) => { const localFunction = localConfig.getFunction(func.$id); func['path'] = localFunction['path']; - if(!localFunction['path']) { + if (!localFunction['path']) { func['path'] = `functions/${func.$id}`; } - + if (!withVariables) { + delete func['vars']; + } localConfig.addFunction(func); if (!fs.existsSync(func['path'])) { fs.mkdirSync(func['path'], { recursive: true }); } - if(code === false) { + if (code === false) { warn("Source code download skipped."); - } else if(!func['deployment']) { - warn("Source code download skipped because function doesn't have active deployment."); - } else { - if(allowCodePull === null) { - const codeAnswer = await inquirer.prompt(questionsPullFunctionsCode); - allowCodePull = codeAnswer.override; + continue; + } + + if (allowCodePull === null) { + const codeAnswer = await inquirer.prompt(questionsPullFunctionsCode); + allowCodePull = codeAnswer.override; + } + + if (!allowCodePull) { + continue; + } + + let deploymentId = null; + + try { + const fetchResponse = await functionsListDeployments({ + functionId: func['$id'], + queries: [ + JSON.stringify({ method: 'limit', values: [1] }), + JSON.stringify({ method: 'orderDesc', values: ['$id'] }) + ], + parseOutput: false + }); + + if (fetchResponse['total'] > 0) { + deploymentId = fetchResponse['deployments'][0]['$id']; } - if(allowCodePull) { - log("Pulling active deployment's code ..."); - - const compressedFileName = `${func['$id']}-${+new Date()}.tar.gz` - await functionsDownloadDeployment({ - functionId: func['$id'], - deploymentId: func['deployment'], - destination: compressedFileName, - overrideForCli: true, - parseOutput: false - }); - - tar.extract({ - sync: true, - cwd: func['path'], - file: compressedFileName, - strict: false, - }); - - fs.rmSync(compressedFileName); + } catch { + } + + if (deploymentId === null) { + log("Source code download skipped because function doesn't have any available deployment"); + continue; + } + + log("Pulling latest deployment code ..."); + + const compressedFileName = `${func['$id']}-${+new Date()}.tar.gz` + await functionsGetDeploymentDownload({ + functionId: func['$id'], + deploymentId, + destination: compressedFileName, + overrideForCli: true, + parseOutput: false + }); + + tar.extract({ + sync: true, + cwd: func['path'], + file: compressedFileName, + strict: false, + }); + + fs.rmSync(compressedFileName); + + if (withVariables) { + const envFileLocation = `${func['path']}/.env` + try { + fs.rmSync(envFileLocation); + } catch { } + + fs.writeFileSync(envFileLocation, func['vars'].map(r => `${r.key}=${r.value}\n`).join('')) } } @@ -170,7 +207,7 @@ const pullCollection = async () => { parseOutput: false }, 100, 'collections'); - for(const collection of collections) { + for (const collection of collections) { localConfig.addCollection({ ...collection, '$createdAt': undefined, @@ -198,7 +235,7 @@ const pullBucket = async () => { const { buckets } = await paginate(storageListBuckets, { parseOutput: false }, 100, 'buckets'); - for(const bucket of buckets) { + for (const bucket of buckets) { total++; log(`Pulling bucket ${chalk.bold(bucket['name'])} ...`); localConfig.addBucket(bucket); @@ -223,7 +260,7 @@ const pullTeam = async () => { const { teams } = await paginate(teamsList, { parseOutput: false }, 100, 'teams'); - for(const team of teams) { + for (const team of teams) { total++; log(`Pulling team ${chalk.bold(team['name'])} ...`); localConfig.addTeam(team); @@ -248,7 +285,7 @@ const pullMessagingTopic = async () => { const { topics } = await paginate(messagingListTopics, { parseOutput: false }, 100, 'topics'); - for(const topic of topics) { + for (const topic of topics) { total++; log(`Pulling topic ${chalk.bold(topic['name'])} ...`); localConfig.addMessagingTopic(topic); @@ -279,6 +316,7 @@ pull .alias("functions") .description("Pulling your Appwrite cloud function") .option("--no-code", "Don't pull the function's code") + .option("--with-variables", `Pull function variables. ${chalk.red('recommend for testing purposes only')}`) .action(actionRunner(pullFunctions)) pull diff --git a/lib/commands/push.js b/lib/commands/push.js index ea3dd21..d265cfa 100644 --- a/lib/commands/push.js +++ b/lib/commands/push.js @@ -2,10 +2,10 @@ const chalk = require('chalk'); const inquirer = require("inquirer"); const JSONbig = require("json-bigint")({ storeAsString: false }); const { Command } = require("commander"); -const { localConfig, globalConfig, KeysAttributes, KeysFunction, whitelistKeys, KeysTopics, KeysStorage, KeysTeams, } = require("../config"); +const { localConfig, globalConfig, KeysAttributes, KeysFunction, whitelistKeys, KeysTopics, KeysStorage, KeysTeams, KeysCollection } = require("../config"); const { Spinner, SPINNER_ARC, SPINNER_DOTS } = require('../spinner'); const { paginate } = require('../paginate'); -const { questionsPushBuckets, questionsPushTeams, questionsPushFunctions, questionsGetEntrypoint, questionsPushCollections, questionPushChanges, questionsPushMessagingTopics, questionsPushResources } = require("../questions"); +const { questionsPushBuckets, questionsPushTeams, questionsPushFunctions, questionsGetEntrypoint, questionsPushCollections, questionPushChanges, questionPushChangesConfirmation, 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, functionsGetDeployment, functionsListVariables, functionsDeleteVariable, functionsCreateVariable } = require('./functions'); @@ -340,18 +340,56 @@ const awaitPools = { }, } -const approveChanges = async (resource, resourceGetFunction, keys, resourceName, resourcePlural) => { +const getConfirmation = async () => { + if (cliConfig.force) { + return true; + } + + async function fixConfirmation() { + const answers = await inquirer.prompt(questionPushChangesConfirmation); + if (answers.changes !== 'YES' && answers.changes !== 'NO') { + return await fixConfirmation(); + } + + return answers.changes; + } + + let answers = await inquirer.prompt(questionPushChanges); + + if (answers.changes !== 'YES' && answers.changes !== 'NO') { + answers.changes = await fixConfirmation(); + } + + if (answers.changes === 'YES') { + return true; + } + + warn('Skipping push action. Changes were not applied.'); + return false; + +}; + +const approveChanges = async (resource, resourceGetFunction, keys, resourceName, resourcePlural, skipKeys = [], secondId = '', secondResourceName = '') => { log('Checking for changes ...'); const changes = []; await Promise.all(resource.map(async (localResource) => { try { - const remoteResource = await resourceGetFunction({ + const options = { [resourceName]: localResource['$id'], parseOutput: false, - }); + }; + + if (secondId !== '' && secondResourceName !== '') { + options[secondResourceName] = localResource[secondId] + } + + const remoteResource = await resourceGetFunction(options); for (let [key, value] of Object.entries(whitelistKeys(remoteResource, keys))) { + if (skipKeys.includes(key)) { + continue; + } if (Array.isArray(value) && Array.isArray(localResource[key])) { if (JSON.stringify(value) !== JSON.stringify(localResource[key])) { changes.push({ @@ -382,11 +420,8 @@ const approveChanges = async (resource, resourceGetFunction, keys, resourceName, } drawTable(changes); - if (!cliConfig.force) { - const answers = await inquirer.prompt(questionPushChanges); - if (answers.changes.toLowerCase() === 'yes') { - return true; - } + if ((await getConfirmation()) === true) { + return true; } success(`Successfully pushed 0 ${resourcePlural}.`); @@ -399,7 +434,7 @@ const getObjectChanges = (remote, local, index, what) => { 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]) }) + changes.push({ group: what, setting: service, remote: chalk.red(status), local: chalk.green(local[index][service]) }) } } } @@ -661,6 +696,20 @@ const deleteAttribute = async (collection, attribute, isIndex = false) => { }); } +const compareAttribute = (remote, local, reason, key) => { + if (Array.isArray(remote) && Array.isArray(local)) { + if (JSON.stringify(remote) !== JSON.stringify(local)) { + const bol = reason === '' ? '' : '\n'; + reason += `${bol}${key} changed from ${chalk.red(remote)} to ${chalk.green(local)}`; + } + } else if (remote !== local) { + const bol = reason === '' ? '' : '\n'; + reason += `${bol}${key} changed from ${chalk.red(remote)} to ${chalk.green(local)}`; + } + + return reason +} + /** * Check if attribute non-changeable fields has been changed @@ -688,11 +737,7 @@ const checkAttributeChanges = (remote, local, collection, recraeting = true) => if (changeableKeys.includes(key)) { if (!recraeting) { - if (remote[key] !== local[key]) { - const bol = reason === '' ? '' : '\n'; - reason += `${bol}${key} changed from ${chalk.red(remote[key])} to ${chalk.green(local[key])}`; - attribute = local; - } + reason += compareAttribute(remote[key], local[key], reason, key) } continue; } @@ -701,15 +746,7 @@ const checkAttributeChanges = (remote, local, collection, recraeting = true) => continue; } - 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])}`; - } + reason += compareAttribute(remote[key], local[key], reason, key) } return reason === '' ? undefined : { key: keyName, attribute, reason, action }; @@ -766,9 +803,7 @@ const attributesToCreate = async (remoteAttributes, localAttributes, collection, log(`Attribute recreation will cause ${chalk.red('loss of data')}`); } - const answers = await inquirer.prompt(questionPushChanges); - - if (answers.changes.toLowerCase() !== 'yes') { + if ((await getConfirmation()) !== true) { return changedAttributes; } } @@ -890,12 +925,9 @@ const pushSettings = async () => { 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; - } + if ((await getConfirmation()) !== true) { + success(`Successfully pushed 0 project settings.`); + return; } } } catch (e) { @@ -960,7 +992,7 @@ const pushSettings = async () => { } } -const pushFunction = async ({ functionId, async, code } = { returnOnZero: false }) => { +const pushFunction = async ({ functionId, async, code, withVariables } = { returnOnZero: false }) => { const functionIds = []; if (functionId) { @@ -1009,7 +1041,7 @@ const pushFunction = async ({ functionId, async, code } = { returnOnZero: false } } - if (!(await approveChanges(functions, functionsGet, KeysFunction, 'functionId', 'functions'))) { + if (!(await approveChanges(functions, functionsGet, KeysFunction, 'functionId', 'functions', ['vars']))) { return; } @@ -1019,6 +1051,7 @@ const pushFunction = async ({ functionId, async, code } = { returnOnZero: false let successfullyPushed = 0; let successfullyDeployed = 0; const failedDeployments = []; + const errors = []; await Promise.all(functions.map(async (func) => { let response = {}; @@ -1068,6 +1101,7 @@ const pushFunction = async ({ functionId, async, code } = { returnOnZero: false if (Number(e.code) === 404) { functionExists = false; } else { + errors.push(e); updaterRow.fail({ errorMessage: e.message ?? 'General error occurs please try again' }); return; } @@ -1095,11 +1129,45 @@ const pushFunction = async ({ functionId, async, code } = { returnOnZero: false updaterRow.update({ status: 'Created' }); } catch (e) { + errors.push(e) updaterRow.fail({ errorMessage: e.message ?? 'General error occurs please try again' }); return; } } + if (withVariables) { + updaterRow.update({ status: 'Updating variables' }).replaceSpinner(SPINNER_ARC); + + const { variables } = await paginate(functionsListVariables, { + functionId: func['$id'], + parseOutput: false + }, 100, 'variables'); + + await Promise.all(variables.map(async variable => { + await functionsDeleteVariable({ + functionId: func['$id'], + variableId: variable['$id'], + parseOutput: false + }); + })); + + let result = await awaitPools.wipeVariables(func['$id']); + if (!result) { + updaterRow.fail({ errorMessage: `Variable deletion timed out.` }) + return; + } + + // Deploy local variables + await Promise.all((func['vars'] ?? []).map(async variable => { + await functionsCreateVariable({ + functionId: func['$id'], + key: variable['key'], + value: variable['value'], + parseOutput: false + }); + })); + } + if (code === false) { successfullyPushed++; successfullyDeployed++; @@ -1123,6 +1191,8 @@ const pushFunction = async ({ functionId, async, code } = { returnOnZero: false deploymentCreated = true; successfullyPushed++; } catch (e) { + errors.push(e); + switch (e.code) { case 'ENOENT': updaterRow.fail({ errorMessage: 'Not found in the current directory. Skipping...' }) @@ -1180,6 +1250,7 @@ const pushFunction = async ({ functionId, async, code } = { returnOnZero: false await new Promise(resolve => setTimeout(resolve, POLL_DEBOUNCE * 1.5)); } } catch (e) { + errors.push(e); updaterRow.fail({ errorMessage: e.message ?? 'Unknown error occurred. Please try again' }) } } @@ -1207,6 +1278,12 @@ const pushFunction = async ({ functionId, async, code } = { returnOnZero: false } else { success(`Successfully pushed ${successfullyPushed} functions.`); } + + if (cliConfig.verbose) { + errors.forEach(e => { + console.error(e); + }) + } } const pushCollection = async ({ returnOnZero, attempts } = { returnOnZero: false }) => { @@ -1241,8 +1318,6 @@ const pushCollection = async ({ returnOnZero, attempts } = { returnOnZero: false const databases = Array.from(new Set(collections.map(collection => collection['databaseId']))); - log('Checking for changes ...'); - // Parallel db actions await Promise.all(databases.map(async (databaseId) => { const localDatabase = localConfig.getDatabase(databaseId); @@ -1273,6 +1348,10 @@ const pushCollection = async ({ returnOnZero, attempts } = { returnOnZero: false } })); + + if (!(await approveChanges(collections, databasesGetCollection, KeysCollection, 'collectionId', 'collections', ['attributes', 'indexes'], 'databaseId', 'databaseId',))) { + return; + } // Parallel collection actions await Promise.all(collections.map(async (collection) => { try { @@ -1343,10 +1422,10 @@ const pushCollection = async ({ returnOnZero, attempts } = { returnOnZero: false throw e; } numberOfCollections++; - success(`Pushed ${collection.name} ( ${collection['$id']} )`); + success(`Successfully pushed ${collection.name} ( ${collection['$id']} )`); } - success(`Pushed ${numberOfCollections} collections`); + success(`Successfully pushed ${numberOfCollections} collections`); } const pushBucket = async ({ returnOnZero } = { returnOnZero: false }) => { @@ -1509,7 +1588,6 @@ const pushMessagingTopic = async ({ returnOnZero } = { returnOnZero: false }) => let topicsIds = []; const configTopics = localConfig.getMessagingTopics(); - let overrideExisting = cliConfig.force; if (cliConfig.all) { checkDeployConditions(localConfig); @@ -1536,13 +1614,6 @@ const pushMessagingTopic = async ({ returnOnZero } = { returnOnZero: false }) => topics.push(...idTopic); } - if (!cliConfig.force) { - const answers = await inquirer.prompt(questionsPushMessagingTopics[1]) - if (answers.override.toLowerCase() === "yes") { - overrideExisting = true; - } - } - if (!(await approveChanges(topics, messagingGetTopic, KeysTopics, 'topicId', 'topics'))) { return; } @@ -1559,11 +1630,6 @@ const pushMessagingTopic = async ({ returnOnZero } = { returnOnZero: false }) => }) log(`Topic ${topic.name} ( ${topic['$id']} ) already exists.`); - if (!overrideExisting) { - log(`Skipping ${topic.name} ( ${topic['$id']} )`); - continue; - } - await messagingUpdateTopic({ topicId: topic['$id'], name: topic.name, @@ -1615,6 +1681,7 @@ push .option(`-f, --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") + .option("--with-variables", `Push function variables.`) .action(actionRunner(pushFunction)); push diff --git a/lib/commands/run.js b/lib/commands/run.js index 71baf0c..fea72c3 100644 --- a/lib/commands/run.js +++ b/lib/commands/run.js @@ -17,9 +17,7 @@ const { systemHasCommand, isPortTaken, getAllFiles } = require('../utils'); const { runtimeNames, systemTools, JwtManager, Queue } = require('../emulation/utils'); const { dockerStop, dockerCleanup, dockerStart, dockerBuild, dockerPull } = require('../emulation/docker'); -const runFunction = async ({ port, functionId, variables, reload, userId } = {}) => { - console.log(variables); - console.log(reload); +const runFunction = async ({ port, functionId, withVariables, reload, userId } = {}) => { // Selection if(!functionId) { const answers = await inquirer.prompt(questionsRunFunctions[0]); @@ -117,7 +115,7 @@ const runFunction = async ({ port, functionId, variables, reload, userId } = {}) const userVariables = {}; const allVariables = {}; - if(variables) { + if(withVariables) { try { const { variables: remoteVariables } = await paginate(functionsListVariables, { functionId: func['$id'], @@ -129,7 +127,7 @@ const runFunction = async ({ port, functionId, variables, reload, userId } = {}) userVariables[v.key] = v.value; }); } catch(err) { - warn("Remote variables not fetched. Production environment variables will not be avaiable. Reason: " + err.message); + warn("Remote variables not fetched. Production environment variables will not be available. Reason: " + err.message); } } @@ -186,7 +184,7 @@ const runFunction = async ({ port, functionId, variables, reload, userId } = {}) 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'))) { @@ -218,14 +216,14 @@ const runFunction = async ({ port, functionId, variables, reload, userId } = {}) const dependencyFile = files.find((filePath) => tool.dependencyFiles.includes(filePath)); if(tool.isCompiled || dependencyFile) { log(`Rebuilding the function due to file changes ...`); - await dockerBuild(func, variables); + await dockerBuild(func, allVariables); if(!Queue.isEmpty()) { Queue.unlock(); return; } - await dockerStart(func, variables, port); + await dockerStart(func, allVariables, port); } else { log('Hot-swapping function.. Files with change are ' + files.join(', ')); @@ -281,7 +279,7 @@ const runFunction = async ({ port, functionId, variables, reload, userId } = {}) file: buildPath }, ['.']); - await dockerStart(func, variables, port); + await dockerStart(func, allVariables, port); } } catch(err) { console.error(err); @@ -293,7 +291,7 @@ const runFunction = async ({ port, functionId, variables, reload, userId } = {}) Queue.lock(); log('Building function using Docker ...'); - await dockerBuild(func, variables); + await dockerBuild(func, allVariables); if(!Queue.isEmpty()) { Queue.unlock(); @@ -302,7 +300,7 @@ const runFunction = async ({ port, functionId, variables, reload, userId } = {}) log('Starting function using Docker ...'); hint('Function automatically restarts when you edit your code.'); - await dockerStart(func, variables, port); + await dockerStart(func, allVariables, port); Queue.unlock(); } @@ -323,7 +321,7 @@ run .option(`--function-id `, `ID of function to run`) .option(`--port `, `Local port`) .option(`--user-id `, `ID of user to impersonate`) - .option(`--no-variables`, `Prevent pulling variables from function settings`) + .option(`--with-variables`, `Run with function variables from function settings`) .option(`--no-reload`, `Prevent live reloading of server when changes are made to function files`) .action(actionRunner(runFunction)); diff --git a/lib/commands/storage.js b/lib/commands/storage.js index 00102b4..16c2f74 100644 --- a/lib/commands/storage.js +++ b/lib/commands/storage.js @@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) { }); } -const storage = new Command("storage").description(commandDescriptions['storage']).configureHelp({ +const storage = new Command("storage").description(commandDescriptions['storage'] ?? '').configureHelp({ helpWidth: process.stdout.columns || 80 }) @@ -74,7 +74,6 @@ const storageListBuckets = async ({queries,search,parseOutput = true, overrideFo showConsoleLink('storage', 'listBuckets'); } else { parse(response) - success() } } @@ -148,7 +147,6 @@ const storageCreateBucket = async ({bucketId,name,permissions,fileSecurity,enabl if (parseOutput) { parse(response) - success() } return response; @@ -183,7 +181,6 @@ const storageGetBucket = async ({bucketId,parseOutput = true, overrideForCli = f showConsoleLink('storage', 'getBucket', bucketId); } else { parse(response) - success() } } @@ -254,7 +251,6 @@ const storageUpdateBucket = async ({bucketId,name,permissions,fileSecurity,enabl if (parseOutput) { parse(response) - success() } return response; @@ -286,7 +282,6 @@ const storageDeleteBucket = async ({bucketId,parseOutput = true, overrideForCli if (parseOutput) { parse(response) - success() } return response; @@ -329,7 +324,6 @@ const storageListFiles = async ({bucketId,queries,search,parseOutput = true, ove showConsoleLink('storage', 'listFiles', bucketId); } else { parse(response) - success() } } @@ -465,7 +459,6 @@ const storageCreateFile = async ({bucketId,fileId,file,permissions,parseOutput = if (parseOutput) { parse(response) - success() } return response; @@ -500,7 +493,6 @@ const storageGetFile = async ({bucketId,fileId,parseOutput = true, overrideForCl showConsoleLink('storage', 'getFile', bucketId, fileId); } else { parse(response) - success() } } @@ -543,7 +535,6 @@ const storageUpdateFile = async ({bucketId,fileId,name,permissions,parseOutput = if (parseOutput) { parse(response) - success() } return response; @@ -576,7 +567,6 @@ const storageDeleteFile = async ({bucketId,fileId,parseOutput = true, overrideFo if (parseOutput) { parse(response) - success() } return response; @@ -621,7 +611,6 @@ const storageGetFileDownload = async ({bucketId,fileId,parseOutput = true, overr fs.writeFileSync(destination, response); if (parseOutput) { parse(response) - success() } return response; @@ -710,7 +699,6 @@ const storageGetFilePreview = async ({bucketId,fileId,width,height,gravity,quali fs.writeFileSync(destination, response); if (parseOutput) { parse(response) - success() } return response; @@ -755,7 +743,6 @@ const storageGetFileView = async ({bucketId,fileId,parseOutput = true, overrideF fs.writeFileSync(destination, response); if (parseOutput) { parse(response) - success() } return response; @@ -790,7 +777,6 @@ const storageGetUsage = async ({range,parseOutput = true, overrideForCli = false if (parseOutput) { parse(response) - success() } return response; @@ -829,7 +815,6 @@ const storageGetBucketUsage = async ({bucketId,range,parseOutput = true, overrid showConsoleLink('storage', 'getBucketUsage', bucketId); } else { parse(response) - success() } } diff --git a/lib/commands/teams.js b/lib/commands/teams.js index 7ca5474..dda741a 100644 --- a/lib/commands/teams.js +++ b/lib/commands/teams.js @@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) { }); } -const teams = new Command("teams").description(commandDescriptions['teams']).configureHelp({ +const teams = new Command("teams").description(commandDescriptions['teams'] ?? '').configureHelp({ helpWidth: process.stdout.columns || 80 }) @@ -74,7 +74,6 @@ const teamsList = async ({queries,search,parseOutput = true, overrideForCli = fa showConsoleLink('teams', 'list'); } else { parse(response) - success() } } @@ -119,7 +118,6 @@ const teamsCreate = async ({teamId,name,roles,parseOutput = true, overrideForCli if (parseOutput) { parse(response) - success() } return response; @@ -154,7 +152,6 @@ const teamsGet = async ({teamId,parseOutput = true, overrideForCli = false, sdk showConsoleLink('teams', 'get', teamId); } else { parse(response) - success() } } @@ -191,7 +188,6 @@ const teamsUpdateName = async ({teamId,name,parseOutput = true, overrideForCli = if (parseOutput) { parse(response) - success() } return response; @@ -223,7 +219,6 @@ const teamsDelete = async ({teamId,parseOutput = true, overrideForCli = false, s if (parseOutput) { parse(response) - success() } return response; @@ -259,7 +254,6 @@ const teamsListLogs = async ({teamId,queries,parseOutput = true, overrideForCli if (parseOutput) { parse(response) - success() } return response; @@ -299,7 +293,6 @@ const teamsListMemberships = async ({teamId,queries,search,parseOutput = true, o if (parseOutput) { parse(response) - success() } return response; @@ -356,7 +349,6 @@ const teamsCreateMembership = async ({teamId,roles,email,userId,phone,url,name,p if (parseOutput) { parse(response) - success() } return response; @@ -389,7 +381,6 @@ const teamsGetMembership = async ({teamId,membershipId,parseOutput = true, overr if (parseOutput) { parse(response) - success() } return response; @@ -427,7 +418,6 @@ const teamsUpdateMembership = async ({teamId,membershipId,roles,parseOutput = tr if (parseOutput) { parse(response) - success() } return response; @@ -460,7 +450,6 @@ const teamsDeleteMembership = async ({teamId,membershipId,parseOutput = true, ov if (parseOutput) { parse(response) - success() } return response; @@ -501,7 +490,6 @@ const teamsUpdateMembershipStatus = async ({teamId,membershipId,userId,secret,pa if (parseOutput) { parse(response) - success() } return response; @@ -533,7 +521,6 @@ const teamsGetPrefs = async ({teamId,parseOutput = true, overrideForCli = false, if (parseOutput) { parse(response) - success() } return response; @@ -569,7 +556,6 @@ const teamsUpdatePrefs = async ({teamId,prefs,parseOutput = true, overrideForCli if (parseOutput) { parse(response) - success() } return response; diff --git a/lib/commands/users.js b/lib/commands/users.js index 9d13ed7..1de7a59 100644 --- a/lib/commands/users.js +++ b/lib/commands/users.js @@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) { }); } -const users = new Command("users").description(commandDescriptions['users']).configureHelp({ +const users = new Command("users").description(commandDescriptions['users'] ?? '').configureHelp({ helpWidth: process.stdout.columns || 80 }) @@ -74,7 +74,6 @@ const usersList = async ({queries,search,parseOutput = true, overrideForCli = fa showConsoleLink('users', 'list'); } else { parse(response) - success() } } @@ -126,7 +125,6 @@ const usersCreate = async ({userId,email,phone,password,name,parseOutput = true, if (parseOutput) { parse(response) - success() } return response; @@ -173,7 +171,6 @@ const usersCreateArgon2User = async ({userId,email,password,name,parseOutput = t if (parseOutput) { parse(response) - success() } return response; @@ -220,7 +217,6 @@ const usersCreateBcryptUser = async ({userId,email,password,name,parseOutput = t if (parseOutput) { parse(response) - success() } return response; @@ -259,7 +255,6 @@ const usersListIdentities = async ({queries,search,parseOutput = true, overrideF if (parseOutput) { parse(response) - success() } return response; @@ -291,7 +286,6 @@ const usersDeleteIdentity = async ({identityId,parseOutput = true, overrideForCl if (parseOutput) { parse(response) - success() } return response; @@ -338,7 +332,6 @@ const usersCreateMD5User = async ({userId,email,password,name,parseOutput = true if (parseOutput) { parse(response) - success() } return response; @@ -385,7 +378,6 @@ const usersCreatePHPassUser = async ({userId,email,password,name,parseOutput = t if (parseOutput) { parse(response) - success() } return response; @@ -452,7 +444,6 @@ const usersCreateScryptUser = async ({userId,email,password,passwordSalt,passwor if (parseOutput) { parse(response) - success() } return response; @@ -511,7 +502,6 @@ const usersCreateScryptModifiedUser = async ({userId,email,password,passwordSalt if (parseOutput) { parse(response) - success() } return response; @@ -562,7 +552,6 @@ const usersCreateSHAUser = async ({userId,email,password,passwordVersion,name,pa if (parseOutput) { parse(response) - success() } return response; @@ -597,7 +586,6 @@ const usersGetUsage = async ({range,parseOutput = true, overrideForCli = false, if (parseOutput) { parse(response) - success() } return response; @@ -632,7 +620,6 @@ const usersGet = async ({userId,parseOutput = true, overrideForCli = false, sdk showConsoleLink('users', 'get', userId); } else { parse(response) - success() } } @@ -665,7 +652,6 @@ const usersDelete = async ({userId,parseOutput = true, overrideForCli = false, s if (parseOutput) { parse(response) - success() } return response; @@ -701,7 +687,6 @@ const usersUpdateEmail = async ({userId,email,parseOutput = true, overrideForCli if (parseOutput) { parse(response) - success() } return response; @@ -741,7 +726,6 @@ const usersCreateJWT = async ({userId,sessionId,duration,parseOutput = true, ove if (parseOutput) { parse(response) - success() } return response; @@ -778,7 +762,6 @@ const usersUpdateLabels = async ({userId,labels,parseOutput = true, overrideForC if (parseOutput) { parse(response) - success() } return response; @@ -814,7 +797,6 @@ const usersListLogs = async ({userId,queries,parseOutput = true, overrideForCli if (parseOutput) { parse(response) - success() } return response; @@ -846,7 +828,6 @@ const usersListMemberships = async ({userId,parseOutput = true, overrideForCli = if (parseOutput) { parse(response) - success() } return response; @@ -882,7 +863,6 @@ const usersUpdateMfa = async ({userId,mfa,parseOutput = true, overrideForCli = f if (parseOutput) { parse(response) - success() } return response; @@ -915,7 +895,6 @@ const usersDeleteMfaAuthenticator = async ({userId,type,parseOutput = true, over if (parseOutput) { parse(response) - success() } return response; @@ -947,7 +926,6 @@ const usersListMfaFactors = async ({userId,parseOutput = true, overrideForCli = if (parseOutput) { parse(response) - success() } return response; @@ -979,7 +957,6 @@ const usersGetMfaRecoveryCodes = async ({userId,parseOutput = true, overrideForC if (parseOutput) { parse(response) - success() } return response; @@ -1011,7 +988,6 @@ const usersUpdateMfaRecoveryCodes = async ({userId,parseOutput = true, overrideF if (parseOutput) { parse(response) - success() } return response; @@ -1043,7 +1019,6 @@ const usersCreateMfaRecoveryCodes = async ({userId,parseOutput = true, overrideF if (parseOutput) { parse(response) - success() } return response; @@ -1079,7 +1054,6 @@ const usersUpdateName = async ({userId,name,parseOutput = true, overrideForCli = if (parseOutput) { parse(response) - success() } return response; @@ -1115,7 +1089,6 @@ const usersUpdatePassword = async ({userId,password,parseOutput = true, override if (parseOutput) { parse(response) - success() } return response; @@ -1151,7 +1124,6 @@ const usersUpdatePhone = async ({userId,number,parseOutput = true, overrideForCl if (parseOutput) { parse(response) - success() } return response; @@ -1183,7 +1155,6 @@ const usersGetPrefs = async ({userId,parseOutput = true, overrideForCli = false, if (parseOutput) { parse(response) - success() } return response; @@ -1219,7 +1190,6 @@ const usersUpdatePrefs = async ({userId,prefs,parseOutput = true, overrideForCli if (parseOutput) { parse(response) - success() } return response; @@ -1254,7 +1224,6 @@ const usersListSessions = async ({userId,parseOutput = true, overrideForCli = fa showConsoleLink('users', 'listSessions', userId); } else { parse(response) - success() } } @@ -1287,7 +1256,6 @@ const usersCreateSession = async ({userId,parseOutput = true, overrideForCli = f if (parseOutput) { parse(response) - success() } return response; @@ -1319,7 +1287,6 @@ const usersDeleteSessions = async ({userId,parseOutput = true, overrideForCli = if (parseOutput) { parse(response) - success() } return response; @@ -1352,7 +1319,6 @@ const usersDeleteSession = async ({userId,sessionId,parseOutput = true, override if (parseOutput) { parse(response) - success() } return response; @@ -1388,7 +1354,6 @@ const usersUpdateStatus = async ({userId,status,parseOutput = true, overrideForC if (parseOutput) { parse(response) - success() } return response; @@ -1424,7 +1389,6 @@ const usersListTargets = async ({userId,queries,parseOutput = true, overrideForC if (parseOutput) { parse(response) - success() } return response; @@ -1476,7 +1440,6 @@ const usersCreateTarget = async ({userId,targetId,providerType,identifier,provid if (parseOutput) { parse(response) - success() } return response; @@ -1509,7 +1472,6 @@ const usersGetTarget = async ({userId,targetId,parseOutput = true, overrideForCl if (parseOutput) { parse(response) - success() } return response; @@ -1554,7 +1516,6 @@ const usersUpdateTarget = async ({userId,targetId,identifier,providerId,name,par if (parseOutput) { parse(response) - success() } return response; @@ -1587,7 +1548,6 @@ const usersDeleteTarget = async ({userId,targetId,parseOutput = true, overrideFo if (parseOutput) { parse(response) - success() } return response; @@ -1627,7 +1587,6 @@ const usersCreateToken = async ({userId,length,expire,parseOutput = true, overri if (parseOutput) { parse(response) - success() } return response; @@ -1663,7 +1622,6 @@ const usersUpdateEmailVerification = async ({userId,emailVerification,parseOutpu if (parseOutput) { parse(response) - success() } return response; @@ -1699,7 +1657,6 @@ const usersUpdatePhoneVerification = async ({userId,phoneVerification,parseOutpu if (parseOutput) { parse(response) - success() } return response; diff --git a/lib/commands/vcs.js b/lib/commands/vcs.js index f548870..a903cae 100644 --- a/lib/commands/vcs.js +++ b/lib/commands/vcs.js @@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) { }); } -const vcs = new Command("vcs").description(commandDescriptions['vcs']).configureHelp({ +const vcs = new Command("vcs").description(commandDescriptions['vcs'] ?? '').configureHelp({ helpWidth: process.stdout.columns || 80 }) @@ -68,7 +68,6 @@ const vcsListRepositories = async ({installationId,search,parseOutput = true, ov if (parseOutput) { parse(response) - success() } return response; @@ -108,7 +107,6 @@ const vcsCreateRepository = async ({installationId,name,xprivate,parseOutput = t if (parseOutput) { parse(response) - success() } return response; @@ -141,7 +139,6 @@ const vcsGetRepository = async ({installationId,providerRepositoryId,parseOutput if (parseOutput) { parse(response) - success() } return response; @@ -174,7 +171,6 @@ const vcsListRepositoryBranches = async ({installationId,providerRepositoryId,pa if (parseOutput) { parse(response) - success() } return response; @@ -211,7 +207,6 @@ const vcsGetRepositoryContents = async ({installationId,providerRepositoryId,pro if (parseOutput) { parse(response) - success() } return response; @@ -248,7 +243,6 @@ const vcsCreateRepositoryDetection = async ({installationId,providerRepositoryId if (parseOutput) { parse(response) - success() } return response; @@ -285,7 +279,6 @@ const vcsUpdateExternalDeployments = async ({installationId,repositoryId,provide if (parseOutput) { parse(response) - success() } return response; @@ -324,7 +317,6 @@ const vcsListInstallations = async ({queries,search,parseOutput = true, override if (parseOutput) { parse(response) - success() } return response; @@ -356,7 +348,6 @@ const vcsGetInstallation = async ({installationId,parseOutput = true, overrideFo if (parseOutput) { parse(response) - success() } return response; @@ -388,7 +379,6 @@ const vcsDeleteInstallation = async ({installationId,parseOutput = true, overrid if (parseOutput) { parse(response) - success() } return response; diff --git a/lib/config.js b/lib/config.js index 18ed09e..49f70df 100644 --- a/lib/config.js +++ b/lib/config.js @@ -4,7 +4,8 @@ const _path = require("path"); const process = require("process"); const JSONbig = require("json-bigint")({ storeAsString: false }); -const KeysFunction = new Set(["path", "$id", "execute", "name", "enabled", "logging", "runtime", "scopes", "events", "schedule", "timeout", "entrypoint", "commands"]); +const KeysVars = new Set(["key", "value"]); +const KeysFunction = new Set(["path", "$id", "execute", "name", "enabled", "logging", "runtime", "scopes", "events", "schedule", "timeout", "entrypoint", "commands", "vars"]); 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"]); @@ -38,10 +39,10 @@ const KeysAttributes = new Set([ const KeyIndexes = new Set(["key", "type", "status", "attributes", "orders"]); function whitelistKeys(value, keys, nestedKeys = {}) { - if(Array.isArray(value)) { + if (Array.isArray(value)) { const newValue = []; - for(const item of value) { + for (const item of value) { newValue.push(whitelistKeys(item, keys, nestedKeys)); } @@ -50,8 +51,8 @@ function whitelistKeys(value, keys, nestedKeys = {}) { const newValue = {}; Object.keys(value).forEach((key) => { - if(keys.has(key)) { - if(nestedKeys[key]) { + if (keys.has(key)) { + if (nestedKeys[key]) { newValue[key] = whitelistKeys(value[key], nestedKeys[key]); } else { newValue[key] = value[key]; @@ -151,7 +152,9 @@ class Local extends Config { } addFunction(props) { - props = whitelistKeys(props, KeysFunction); + props = whitelistKeys(props, KeysFunction, { + vars: KeysVars + }); if (!this.has("functions")) { this.set("functions", []); @@ -403,7 +406,7 @@ class Local extends Config { return; } - this.set('settings', this.createSettingsObject(settings)); + this.set('settings', this.createSettingsObject(projectSettings)); } createSettingsObject(projectSettings) { @@ -615,5 +618,6 @@ module.exports = { KeysTopics, KeysStorage, KeysTeams, + KeysCollection, whitelistKeys }; diff --git a/lib/emulation/docker.js b/lib/emulation/docker.js index 179d905..41e39f5 100644 --- a/lib/emulation/docker.js +++ b/lib/emulation/docker.js @@ -79,7 +79,6 @@ async function dockerBuild(func, variables) { const params = [ 'run' ]; params.push('--name', id); 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='); params.push('-e', `OPEN_RUNTIMES_ENTRYPOINT=${func.entrypoint}`); @@ -169,7 +168,6 @@ async function dockerStart(func, variables, port) { params.push('--rm'); params.push('--name', id); params.push('-p', `${port}:3000`); - params.push('-e', 'APPWRITE_ENV=development'); params.push('-e', 'OPEN_RUNTIMES_ENV=development'); params.push('-e', 'OPEN_RUNTIMES_SECRET='); @@ -254,7 +252,7 @@ function waitUntilPortOpen(port, iteration = 0) { }); client.connect({port, host: '127.0.0.1'}, function() {}); - }); + }); } module.exports = { diff --git a/lib/paginate.js b/lib/paginate.js index c78814a..1d511e5 100644 --- a/lib/paginate.js +++ b/lib/paginate.js @@ -1,14 +1,16 @@ -const paginate = async (action, args = {}, limit = 100, wrapper = '') => { +const paginate = async (action, args = {}, limit = 100, wrapper = '', queries = []) => { let pageNumber = 0; let results = []; let total = 0; while (true) { const offset = pageNumber * limit; + // Merge the limit and offset into the args const response = await action({ ...args, queries: [ + ...queries, JSON.stringify({ method: 'limit', values: [limit] }), JSON.stringify({ method: 'offset', values: [offset] }) ] diff --git a/lib/parser.js b/lib/parser.js index c32fdf6..8a459bd 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -120,7 +120,7 @@ const parseError = (err) => { } catch { } - const version = '6.0.0-rc.6'; + const version = '6.0.0-rc.7'; const stepsToReproduce = `Running \`appwrite ${cliConfig.reportData.data.args.join(' ')}\``; const yourEnvironment = `CLI version: ${version}\nOperation System: ${os.type()}\nAppwrite version: ${appwriteVersion}\nIs Cloud: ${isCloud}`; @@ -203,29 +203,26 @@ const commandDescriptions = { "account": `The account command allows you to authenticate and manage a user account.`, "graphql": `The graphql command allows you to query and mutate any resource type on your Appwrite server.`, "avatars": `The avatars command aims to help you complete everyday tasks related to your app image, icons, and avatars.`, - "databases": `The databases command allows you to create structured collections of documents, query and filter lists of documents.`, - "init": `The init command provides a convenient wrapper for creating and initializing project, functions, collections, buckets, teams and messaging in Appwrite.`, - "push": `The push command provides a convenient wrapper for pushing your functions, collections, buckets, teams and messaging.`, - "run": `The run command allows you to run project locally to allow easy development and quick debugging.`, - "functions": `The functions command allows you view, create and manage your Cloud Functions.`, + "databases": `The databases command allows you to create structured collections of documents and query and filter lists of documents.`, + "init": `The init command provides a convenient wrapper for creating and initializing projects, functions, collections, buckets, teams, and messaging-topics in Appwrite.`, + "push": `The push command provides a convenient wrapper for pushing your functions, collections, buckets, teams, and messaging-topics.`, + "run": `The run command allows you to run the project locally to allow easy development and quick debugging.`, + "functions": `The functions command allows you to view, create, and manage your Cloud Functions.`, "health": `The health command allows you to both validate and monitor your Appwrite server's health.`, - "pull": `The pull command helps you pull your Appwrite project, functions, collections, buckets, teams and messaging`, + "pull": `The pull command helps you pull your Appwrite project, functions, collections, buckets, teams, and messaging-topics`, "locale": `The locale command allows you to customize your app based on your users' location.`, - "projects": `The projects command allows you to view, create and manage your Appwrite projects.`, "storage": `The storage command allows you to manage your project files.`, - "teams": `The teams command allows you to group users of your project and to enable them to share read and write access to your project resources`, + "teams": `The teams command allows you to group users of your project to enable them to share read and write access to your project resources.`, "users": `The users command allows you to manage your project users.`, "client": `The client command allows you to configure your CLI`, "login": `The login command allows you to authenticate and manage a user account.`, - "logout": `The logout command allows you to logout of your Appwrite account.`, - "whoami": `The whoami command gives information about the currently signed in user.`, + "logout": `The logout command allows you to log out of your Appwrite account.`, + "whoami": `The whomai command gives information about the currently logged-in user.`, "register": `Outputs the link to create an Appwrite account.`, - "console" : `The console command allows gives you access to the APIs used by the Appwrite console.`, + "console" : `The console command gives you access to the APIs used by the Appwrite Console.`, "assistant": `The assistant command allows you to interact with the Appwrite Assistant AI`, - "messaging": `The messaging command allows you to send messages.`, + "messaging": `The messaging command allows you to manage topics and targets and send messages.`, "migrations": `The migrations command allows you to migrate data between services.`, - "project": `The project command is for overall project administration.`, - "proxy": `The proxy command allows you to configure behavior for your attached domains.`, "vcs": `The vcs command allows you to interact with VCS providers and manage your code repositories.`, "main": chalk.redBright(`${logo}${description}`), } diff --git a/lib/questions.js b/lib/questions.js index d5fdc29..ce5c306 100644 --- a/lib/questions.js +++ b/lib/questions.js @@ -189,11 +189,11 @@ const questionsInitProject = [ message: "Choose your Appwrite project.", choices: async (answers) => { const queries = [ - JSON.stringify({ method: 'equal', attribute: 'teamId', values: [answers.organization.id] }), - JSON.stringify({ method: 'orderDesc', attribute: 'Id' }) + JSON.stringify({ method: 'equal', attribute: 'teamId', values: [answers.organization] }), + JSON.stringify({ method: 'orderDesc', attribute: '$id' }) ] - const { projects } = await paginate(projectsList, { parseOutput: false, queries, }, 100, 'projects'); + const { projects } = await paginate(projectsList, { parseOutput: false }, 100, 'projects', queries); let choices = projects.map((project) => { return { @@ -301,22 +301,7 @@ const questionsCreateFunction = [ }) return choices; }, - }, - { - type: "list", - name: "template", - message: "How would you like to start your function code?", - choices: [ - { - name: `Start from scratch ${chalk.blackBright(`(starter)`)}`, - value: "starter" - }, - { - name: "Pick a template", - value: "custom" - } - ] - }, + } ]; const questionsCreateFunctionSelectTemplate = (templates) => { @@ -646,11 +631,6 @@ const questionsPushFunctions = [ return choices; } }, - { - type: "input", - name: "override", - message: 'Are you sure you want to override this function\'s variables? This can lead to loss of secrets! Type "YES" to confirm.' - }, ] const questionsPushCollections = [ @@ -678,7 +658,15 @@ const questionPushChanges = [ { type: "input", name: "changes", - message: `Would you like to apply these changes? Type "YES" to confirm.` + message: `Are you sure you want to apply these changes? (YES/NO)` + } +]; + +const questionPushChangesConfirmation = [ + { + type: "input", + name: "changes", + message: `Please type 'YES' or 'NO':` } ]; @@ -708,6 +696,7 @@ const questionsPushMessagingTopics = [ type: "checkbox", name: "topics", message: "Which messaging topic would you like to push?", + validate: (value) => validateRequired('topics', value), when: () => localConfig.getMessagingTopics().length > 0, choices: () => { let topics = localConfig.getMessagingTopics(); @@ -719,11 +708,6 @@ const questionsPushMessagingTopics = [ } }); } - }, - { - type: "input", - name: "override", - message: 'Would you like to override existing topics? This can lead to loss of data! Type "YES" to confirm.' } ] @@ -862,5 +846,6 @@ module.exports = { questionGetEndpoint, questionsInitResources, questionsCreateTeam, - questionPushChanges + questionPushChanges, + questionPushChangesConfirmation }; diff --git a/package.json b/package.json index 5b6e155..3ca648f 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.6", + "version": "6.0.0-rc.7", "license": "BSD-3-Clause", "main": "index.js", "bin": { @@ -35,7 +35,7 @@ "ignore": "^5.2.0", "chokidar": "^3.6.0", "tail": "^2.2.6", - "dotenv": "^16.3.1" + "dotenv": "^16.4.5" }, "devDependencies": { "pkg": "5.8.1" diff --git a/scoop/appwrite.json b/scoop/appwrite.json index 841122f..79b2b78 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.6", + "version": "6.0.0-rc.7", "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.6/appwrite-cli-win-x64.exe", + "url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.7/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.6/appwrite-cli-win-arm64.exe", + "url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0-rc.7/appwrite-cli-win-arm64.exe", "bin": [ [ "appwrite-cli-win-arm64.exe",