diff --git a/CHANGELOG.md b/CHANGELOG.md index 8964d059..000a7e09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## 10.0.0 + +* **Breaking:** Removed Avatars CLI command and all related subcommands; corresponding examples deleted +* **Feat:** Geo defaults now accept coordinate arrays for Databases and Tables DB, with automatic normalization +* **Feat:** Pull command skips deprecated resources by default and shows clearer totals/messages +* **Feat:** Updated CLI descriptions: Databases marked legacy; added tables-db, projects, and project +* Fix TypeScript type generation now quotes invalid property names to produce valid typings +* Update documentation: Removed Avatars CLI examples and updated help text to reflect new geo defaults and terminology + ## 8.3.0 * **Feat:** Add support for `appwrite.config.json` file diff --git a/README.md b/README.md index 1a19247d..c2f46619 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using ```sh $ appwrite -v -9.1.0 +10.0.0 ``` ### 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 -9.1.0 +10.0.0 ``` ## Getting Started diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md deleted file mode 100644 index b9dce0b9..00000000 --- a/docs/examples/avatars/get-browser.md +++ /dev/null @@ -1,2 +0,0 @@ -appwrite avatars get-browser \ - --code aa diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md deleted file mode 100644 index 0a8317a9..00000000 --- a/docs/examples/avatars/get-credit-card.md +++ /dev/null @@ -1,2 +0,0 @@ -appwrite avatars get-credit-card \ - --code amex diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md deleted file mode 100644 index c2f4c806..00000000 --- a/docs/examples/avatars/get-favicon.md +++ /dev/null @@ -1,2 +0,0 @@ -appwrite avatars get-favicon \ - --url https://example.com diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md deleted file mode 100644 index 15a3daf8..00000000 --- a/docs/examples/avatars/get-flag.md +++ /dev/null @@ -1,2 +0,0 @@ -appwrite avatars get-flag \ - --code af diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md deleted file mode 100644 index 942574ac..00000000 --- a/docs/examples/avatars/get-image.md +++ /dev/null @@ -1,2 +0,0 @@ -appwrite avatars get-image \ - --url https://example.com diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md deleted file mode 100644 index f9d51105..00000000 --- a/docs/examples/avatars/get-initials.md +++ /dev/null @@ -1 +0,0 @@ -appwrite avatars get-initials diff --git a/docs/examples/avatars/get-qr.md b/docs/examples/avatars/get-qr.md deleted file mode 100644 index 75fb094a..00000000 --- a/docs/examples/avatars/get-qr.md +++ /dev/null @@ -1,2 +0,0 @@ -appwrite avatars get-qr \ - --text diff --git a/index.js b/index.js index 16376979..4b2297d5 100644 --- a/index.js +++ b/index.js @@ -20,7 +20,6 @@ const { run } = require("./lib/commands/run"); const { push, deploy } = require("./lib/commands/push"); const { update } = require("./lib/commands/update"); const { account } = require("./lib/commands/account"); -const { avatars } = require("./lib/commands/avatars"); const { console } = require("./lib/commands/console"); const { databases } = require("./lib/commands/databases"); const { functions } = require("./lib/commands/functions"); @@ -124,7 +123,6 @@ program .addCommand(update) .addCommand(logout) .addCommand(account) - .addCommand(avatars) .addCommand(console) .addCommand(databases) .addCommand(functions) diff --git a/install.ps1 b/install.ps1 index 57b38410..edd74f2c 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/9.1.0/appwrite-cli-win-x64.exe" -$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/9.1.0/appwrite-cli-win-arm64.exe" +$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/10.0.0/appwrite-cli-win-x64.exe" +$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/10.0.0/appwrite-cli-win-arm64.exe" $APPWRITE_BINARY_NAME = "appwrite.exe" diff --git a/install.sh b/install.sh index d76d22a3..b225ca3c 100644 --- a/install.sh +++ b/install.sh @@ -97,7 +97,7 @@ printSuccess() { downloadBinary() { echo "[2/4] Downloading executable for $OS ($ARCH) ..." - GITHUB_LATEST_VERSION="9.1.0" + GITHUB_LATEST_VERSION="10.0.0" 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 ca621d05..76607b7d 100644 --- a/lib/client.js +++ b/lib/client.js @@ -16,8 +16,8 @@ class Client { 'x-sdk-name': 'Command Line', 'x-sdk-platform': 'console', 'x-sdk-language': 'cli', - 'x-sdk-version': '9.1.0', - 'user-agent' : `AppwriteCLI/9.1.0 (${os.type()} ${os.version()}; ${os.arch()})`, + 'x-sdk-version': '10.0.0', + 'user-agent' : `AppwriteCLI/10.0.0 (${os.type()} ${os.version()}; ${os.arch()})`, 'X-Appwrite-Response-Format' : '1.8.0', }; } diff --git a/lib/commands/avatars.js b/lib/commands/avatars.js deleted file mode 100644 index 79ddec4b..00000000 --- a/lib/commands/avatars.js +++ /dev/null @@ -1,484 +0,0 @@ -const fs = require('fs'); -const pathLib = require('path'); -const tar = require("tar"); -const ignore = require("ignore"); -const { promisify } = require('util'); -const libClient = require('../client.js'); -const { getAllFiles, showConsoleLink } = require('../utils.js'); -const { Command } = require('commander'); -const { sdkForProject, sdkForConsole } = require('../sdks') -const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log, warn } = require('../parser') -const { localConfig, globalConfig } = require("../config"); -const { File } = require('undici'); -const { ReadableStream } = require('stream/web'); - -/** - * @param {fs.ReadStream} readStream - * @returns {ReadableStream} - */ -function convertReadStreamToReadableStream(readStream) { - return new ReadableStream({ - start(controller) { - readStream.on("data", (chunk) => { - controller.enqueue(chunk); - }); - readStream.on("end", () => { - controller.close(); - }); - readStream.on("error", (err) => { - controller.error(err); - }); - }, - cancel() { - readStream.destroy(); - }, - }); -} - -const avatars = new Command("avatars").description(commandDescriptions['avatars'] ?? '').configureHelp({ - helpWidth: process.stdout.columns || 80 -}) - -/** - * @typedef {Object} AvatarsGetBrowserRequestParams - * @property {Browser} code Browser Code. - * @property {number} width Image width. Pass an integer between 0 to 2000. Defaults to 100. - * @property {number} height Image height. Pass an integer between 0 to 2000. Defaults to 100. - * @property {number} quality Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. - * @property {boolean} overrideForCli - * @property {boolean} parseOutput - * @property {libClient | undefined} sdk - * @property {string} destination - */ - -/** - * @param {AvatarsGetBrowserRequestParams} params - */ -const avatarsGetBrowser = async ({code,width,height,quality,parseOutput = true, overrideForCli = false, sdk = undefined, destination}) => { - let client = !sdk ? await sdkForProject() : - sdk; - let apiPath = '/avatars/browsers/{code}'.replace('{code}', code); - let payload = {}; - if (typeof width !== 'undefined') { - payload['width'] = width; - } - if (typeof height !== 'undefined') { - payload['height'] = height; - } - if (typeof quality !== 'undefined') { - payload['quality'] = quality; - } - if (!overrideForCli) { - payload['project'] = localConfig.getProject().projectId - payload['key'] = globalConfig.getKey(); - const queryParams = new URLSearchParams(payload); - apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`; - } - - let response = undefined; - - response = await client.call('get', apiPath, { - }, payload, 'arraybuffer'); - - if (overrideForCli) { - response = Buffer.from(response); - } - - fs.writeFileSync(destination, response); - if (parseOutput) { - parse(response) - } - - return response; - -} -/** - * @typedef {Object} AvatarsGetCreditCardRequestParams - * @property {CreditCard} code Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, unionpay, visa, mir, maestro, rupay. - * @property {number} width Image width. Pass an integer between 0 to 2000. Defaults to 100. - * @property {number} height Image height. Pass an integer between 0 to 2000. Defaults to 100. - * @property {number} quality Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. - * @property {boolean} overrideForCli - * @property {boolean} parseOutput - * @property {libClient | undefined} sdk - * @property {string} destination - */ - -/** - * @param {AvatarsGetCreditCardRequestParams} params - */ -const avatarsGetCreditCard = async ({code,width,height,quality,parseOutput = true, overrideForCli = false, sdk = undefined, destination}) => { - let client = !sdk ? await sdkForProject() : - sdk; - let apiPath = '/avatars/credit-cards/{code}'.replace('{code}', code); - let payload = {}; - if (typeof width !== 'undefined') { - payload['width'] = width; - } - if (typeof height !== 'undefined') { - payload['height'] = height; - } - if (typeof quality !== 'undefined') { - payload['quality'] = quality; - } - if (!overrideForCli) { - payload['project'] = localConfig.getProject().projectId - payload['key'] = globalConfig.getKey(); - const queryParams = new URLSearchParams(payload); - apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`; - } - - let response = undefined; - - response = await client.call('get', apiPath, { - }, payload, 'arraybuffer'); - - if (overrideForCli) { - response = Buffer.from(response); - } - - fs.writeFileSync(destination, response); - if (parseOutput) { - parse(response) - } - - return response; - -} -/** - * @typedef {Object} AvatarsGetFaviconRequestParams - * @property {string} url Website URL which you want to fetch the favicon from. - * @property {boolean} overrideForCli - * @property {boolean} parseOutput - * @property {libClient | undefined} sdk - * @property {string} destination - */ - -/** - * @param {AvatarsGetFaviconRequestParams} params - */ -const avatarsGetFavicon = async ({url,parseOutput = true, overrideForCli = false, sdk = undefined, destination}) => { - let client = !sdk ? await sdkForProject() : - sdk; - let apiPath = '/avatars/favicon'; - let payload = {}; - if (typeof url !== 'undefined') { - payload['url'] = url; - } - if (!overrideForCli) { - payload['project'] = localConfig.getProject().projectId - payload['key'] = globalConfig.getKey(); - const queryParams = new URLSearchParams(payload); - apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`; - } - - let response = undefined; - - response = await client.call('get', apiPath, { - }, payload, 'arraybuffer'); - - if (overrideForCli) { - response = Buffer.from(response); - } - - fs.writeFileSync(destination, response); - if (parseOutput) { - parse(response) - } - - return response; - -} -/** - * @typedef {Object} AvatarsGetFlagRequestParams - * @property {Flag} code Country Code. ISO Alpha-2 country code format. - * @property {number} width Image width. Pass an integer between 0 to 2000. Defaults to 100. - * @property {number} height Image height. Pass an integer between 0 to 2000. Defaults to 100. - * @property {number} quality Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. - * @property {boolean} overrideForCli - * @property {boolean} parseOutput - * @property {libClient | undefined} sdk - * @property {string} destination - */ - -/** - * @param {AvatarsGetFlagRequestParams} params - */ -const avatarsGetFlag = async ({code,width,height,quality,parseOutput = true, overrideForCli = false, sdk = undefined, destination}) => { - let client = !sdk ? await sdkForProject() : - sdk; - let apiPath = '/avatars/flags/{code}'.replace('{code}', code); - let payload = {}; - if (typeof width !== 'undefined') { - payload['width'] = width; - } - if (typeof height !== 'undefined') { - payload['height'] = height; - } - if (typeof quality !== 'undefined') { - payload['quality'] = quality; - } - if (!overrideForCli) { - payload['project'] = localConfig.getProject().projectId - payload['key'] = globalConfig.getKey(); - const queryParams = new URLSearchParams(payload); - apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`; - } - - let response = undefined; - - response = await client.call('get', apiPath, { - }, payload, 'arraybuffer'); - - if (overrideForCli) { - response = Buffer.from(response); - } - - fs.writeFileSync(destination, response); - if (parseOutput) { - parse(response) - } - - return response; - -} -/** - * @typedef {Object} AvatarsGetImageRequestParams - * @property {string} url Image URL which you want to crop. - * @property {number} width Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400. - * @property {number} height Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400. - * @property {boolean} overrideForCli - * @property {boolean} parseOutput - * @property {libClient | undefined} sdk - * @property {string} destination - */ - -/** - * @param {AvatarsGetImageRequestParams} params - */ -const avatarsGetImage = async ({url,width,height,parseOutput = true, overrideForCli = false, sdk = undefined, destination}) => { - let client = !sdk ? await sdkForProject() : - sdk; - let apiPath = '/avatars/image'; - let payload = {}; - if (typeof url !== 'undefined') { - payload['url'] = url; - } - if (typeof width !== 'undefined') { - payload['width'] = width; - } - if (typeof height !== 'undefined') { - payload['height'] = height; - } - if (!overrideForCli) { - payload['project'] = localConfig.getProject().projectId - payload['key'] = globalConfig.getKey(); - const queryParams = new URLSearchParams(payload); - apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`; - } - - let response = undefined; - - response = await client.call('get', apiPath, { - }, payload, 'arraybuffer'); - - if (overrideForCli) { - response = Buffer.from(response); - } - - fs.writeFileSync(destination, response); - if (parseOutput) { - parse(response) - } - - return response; - -} -/** - * @typedef {Object} AvatarsGetInitialsRequestParams - * @property {string} name Full Name. When empty, current user name or email will be used. Max length: 128 chars. - * @property {number} width Image width. Pass an integer between 0 to 2000. Defaults to 100. - * @property {number} height Image height. Pass an integer between 0 to 2000. Defaults to 100. - * @property {string} background Changes background color. By default a random color will be picked and stay will persistent to the given name. - * @property {boolean} overrideForCli - * @property {boolean} parseOutput - * @property {libClient | undefined} sdk - * @property {string} destination - */ - -/** - * @param {AvatarsGetInitialsRequestParams} params - */ -const avatarsGetInitials = async ({name,width,height,background,parseOutput = true, overrideForCli = false, sdk = undefined, destination}) => { - let client = !sdk ? await sdkForProject() : - sdk; - let apiPath = '/avatars/initials'; - let payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof width !== 'undefined') { - payload['width'] = width; - } - if (typeof height !== 'undefined') { - payload['height'] = height; - } - if (typeof background !== 'undefined') { - payload['background'] = background; - } - if (!overrideForCli) { - payload['project'] = localConfig.getProject().projectId - payload['key'] = globalConfig.getKey(); - const queryParams = new URLSearchParams(payload); - apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`; - } - - let response = undefined; - - response = await client.call('get', apiPath, { - }, payload, 'arraybuffer'); - - if (overrideForCli) { - response = Buffer.from(response); - } - - fs.writeFileSync(destination, response); - if (parseOutput) { - parse(response) - } - - return response; - -} -/** - * @typedef {Object} AvatarsGetQRRequestParams - * @property {string} text Plain text to be converted to QR code image. - * @property {number} size QR code size. Pass an integer between 1 to 1000. Defaults to 400. - * @property {number} margin Margin from edge. Pass an integer between 0 to 10. Defaults to 1. - * @property {boolean} download Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0. - * @property {boolean} overrideForCli - * @property {boolean} parseOutput - * @property {libClient | undefined} sdk - * @property {string} destination - */ - -/** - * @param {AvatarsGetQRRequestParams} params - */ -const avatarsGetQR = async ({text,size,margin,download,parseOutput = true, overrideForCli = false, sdk = undefined, destination}) => { - let client = !sdk ? await sdkForProject() : - sdk; - let apiPath = '/avatars/qr'; - let payload = {}; - if (typeof text !== 'undefined') { - payload['text'] = text; - } - if (typeof size !== 'undefined') { - payload['size'] = size; - } - if (typeof margin !== 'undefined') { - payload['margin'] = margin; - } - if (typeof download !== 'undefined') { - payload['download'] = download; - } - if (!overrideForCli) { - payload['project'] = localConfig.getProject().projectId - payload['key'] = globalConfig.getKey(); - const queryParams = new URLSearchParams(payload); - apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`; - } - - let response = undefined; - - response = await client.call('get', apiPath, { - }, payload, 'arraybuffer'); - - if (overrideForCli) { - response = Buffer.from(response); - } - - fs.writeFileSync(destination, response); - if (parseOutput) { - parse(response) - } - - return response; - -} -avatars - .command(`get-browser`) - .description(`You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings. When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px.`) - .requiredOption(`--code `, `Browser Code.`) - .option(`--width `, `Image width. Pass an integer between 0 to 2000. Defaults to 100.`, parseInteger) - .option(`--height `, `Image height. Pass an integer between 0 to 2000. Defaults to 100.`, parseInteger) - .option(`--quality `, `Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.`, parseInteger) - .requiredOption(`--destination `, `output file path.`) - .action(actionRunner(avatarsGetBrowser)) - -avatars - .command(`get-credit-card`) - .description(`The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings. When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. `) - .requiredOption(`--code `, `Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, unionpay, visa, mir, maestro, rupay.`) - .option(`--width `, `Image width. Pass an integer between 0 to 2000. Defaults to 100.`, parseInteger) - .option(`--height `, `Image height. Pass an integer between 0 to 2000. Defaults to 100.`, parseInteger) - .option(`--quality `, `Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.`, parseInteger) - .requiredOption(`--destination `, `output file path.`) - .action(actionRunner(avatarsGetCreditCard)) - -avatars - .command(`get-favicon`) - .description(`Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL. This endpoint does not follow HTTP redirects.`) - .requiredOption(`--url `, `Website URL which you want to fetch the favicon from.`) - .requiredOption(`--destination `, `output file path.`) - .action(actionRunner(avatarsGetFavicon)) - -avatars - .command(`get-flag`) - .description(`You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. `) - .requiredOption(`--code `, `Country Code. ISO Alpha-2 country code format.`) - .option(`--width `, `Image width. Pass an integer between 0 to 2000. Defaults to 100.`, parseInteger) - .option(`--height `, `Image height. Pass an integer between 0 to 2000. Defaults to 100.`, parseInteger) - .option(`--quality `, `Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.`, parseInteger) - .requiredOption(`--destination `, `output file path.`) - .action(actionRunner(avatarsGetFlag)) - -avatars - .command(`get-image`) - .description(`Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol. When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 400x400px. This endpoint does not follow HTTP redirects.`) - .requiredOption(`--url `, `Image URL which you want to crop.`) - .option(`--width `, `Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400.`, parseInteger) - .option(`--height `, `Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400.`, parseInteger) - .requiredOption(`--destination `, `output file path.`) - .action(actionRunner(avatarsGetImage)) - -avatars - .command(`get-initials`) - .description(`Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned. You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials. When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. `) - .option(`--name `, `Full Name. When empty, current user name or email will be used. Max length: 128 chars.`) - .option(`--width `, `Image width. Pass an integer between 0 to 2000. Defaults to 100.`, parseInteger) - .option(`--height `, `Image height. Pass an integer between 0 to 2000. Defaults to 100.`, parseInteger) - .option(`--background `, `Changes background color. By default a random color will be picked and stay will persistent to the given name.`) - .requiredOption(`--destination `, `output file path.`) - .action(actionRunner(avatarsGetInitials)) - -avatars - .command(`get-qr`) - .description(`Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image. `) - .requiredOption(`--text `, `Plain text to be converted to QR code image.`) - .option(`--size `, `QR code size. Pass an integer between 1 to 1000. Defaults to 400.`, parseInteger) - .option(`--margin `, `Margin from edge. Pass an integer between 0 to 10. Defaults to 1.`, parseInteger) - .option(`--download [value]`, `Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.`, (value) => value === undefined ? true : parseBool(value)) - .requiredOption(`--destination `, `output file path.`) - .action(actionRunner(avatarsGetQR)) - -module.exports = { - avatars, - avatarsGetBrowser, - avatarsGetCreditCard, - avatarsGetFavicon, - avatarsGetFlag, - avatarsGetImage, - avatarsGetInitials, - avatarsGetQR -}; diff --git a/lib/commands/databases.js b/lib/commands/databases.js index d4dbdbc7..0e2bf905 100644 --- a/lib/commands/databases.js +++ b/lib/commands/databases.js @@ -1185,7 +1185,7 @@ const databasesUpdateIpAttribute = async ({databaseId,collectionId,key,required, * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @property {string} key Attribute Key. * @property {boolean} required Is attribute required? - * @property {string} xdefault Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @property {any[]} xdefault Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. * @property {boolean} overrideForCli * @property {boolean} parseOutput * @property {libClient | undefined} sdk @@ -1205,6 +1205,7 @@ const databasesCreateLineAttribute = async ({databaseId,collectionId,key,require if (typeof required !== 'undefined') { payload['required'] = required; } + xdefault = xdefault === true ? [] : xdefault; if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } @@ -1228,7 +1229,7 @@ const databasesCreateLineAttribute = async ({databaseId,collectionId,key,require * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). * @property {string} key Attribute Key. * @property {boolean} required Is attribute required? - * @property {string} xdefault Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @property {any[]} xdefault Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. * @property {string} newKey New attribute key. * @property {boolean} overrideForCli * @property {boolean} parseOutput @@ -1246,6 +1247,7 @@ const databasesUpdateLineAttribute = async ({databaseId,collectionId,key,require if (typeof required !== 'undefined') { payload['required'] = required; } + xdefault = xdefault === true ? [] : xdefault; if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } @@ -1272,7 +1274,7 @@ const databasesUpdateLineAttribute = async ({databaseId,collectionId,key,require * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @property {string} key Attribute Key. * @property {boolean} required Is attribute required? - * @property {string} xdefault Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @property {any[]} xdefault Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. * @property {boolean} overrideForCli * @property {boolean} parseOutput * @property {libClient | undefined} sdk @@ -1292,6 +1294,7 @@ const databasesCreatePointAttribute = async ({databaseId,collectionId,key,requir if (typeof required !== 'undefined') { payload['required'] = required; } + xdefault = xdefault === true ? [] : xdefault; if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } @@ -1315,7 +1318,7 @@ const databasesCreatePointAttribute = async ({databaseId,collectionId,key,requir * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). * @property {string} key Attribute Key. * @property {boolean} required Is attribute required? - * @property {string} xdefault Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @property {any[]} xdefault Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. * @property {string} newKey New attribute key. * @property {boolean} overrideForCli * @property {boolean} parseOutput @@ -1333,6 +1336,7 @@ const databasesUpdatePointAttribute = async ({databaseId,collectionId,key,requir if (typeof required !== 'undefined') { payload['required'] = required; } + xdefault = xdefault === true ? [] : xdefault; if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } @@ -1359,7 +1363,7 @@ const databasesUpdatePointAttribute = async ({databaseId,collectionId,key,requir * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @property {string} key Attribute Key. * @property {boolean} required Is attribute required? - * @property {string} xdefault Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @property {any[]} xdefault Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. * @property {boolean} overrideForCli * @property {boolean} parseOutput * @property {libClient | undefined} sdk @@ -1379,6 +1383,7 @@ const databasesCreatePolygonAttribute = async ({databaseId,collectionId,key,requ if (typeof required !== 'undefined') { payload['required'] = required; } + xdefault = xdefault === true ? [] : xdefault; if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } @@ -1402,7 +1407,7 @@ const databasesCreatePolygonAttribute = async ({databaseId,collectionId,key,requ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). * @property {string} key Attribute Key. * @property {boolean} required Is attribute required? - * @property {string} xdefault Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required. + * @property {any[]} xdefault Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. * @property {string} newKey New attribute key. * @property {boolean} overrideForCli * @property {boolean} parseOutput @@ -1420,6 +1425,7 @@ const databasesUpdatePolygonAttribute = async ({databaseId,collectionId,key,requ if (typeof required !== 'undefined') { payload['required'] = required; } + xdefault = xdefault === true ? [] : xdefault; if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } @@ -2851,7 +2857,7 @@ databases .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value)) - .option(`--xdefault `, `Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.`) + .option(`--xdefault `, `Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required.`) .action(actionRunner(databasesCreateLineAttribute)) databases @@ -2861,18 +2867,18 @@ databases .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value)) - .option(`--xdefault `, `Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.`) + .option(`--xdefault `, `Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required.`) .option(`--new-key `, `New attribute key.`) .action(actionRunner(databasesUpdateLineAttribute)) databases .command(`create-point-attribute`) - .description(`[**DEPRECATED** - This command is deprecated. Please use 'tables-db create-point-column' instead] Create a geometric 2d point attribute.`) + .description(`[**DEPRECATED** - This command is deprecated. Please use 'tables-db create-point-column' instead] Create a geometric point attribute.`) .requiredOption(`--database-id `, `Database ID.`) .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value)) - .option(`--xdefault `, `Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.`) + .option(`--xdefault `, `Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required.`) .action(actionRunner(databasesCreatePointAttribute)) databases @@ -2882,7 +2888,7 @@ databases .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value)) - .option(`--xdefault `, `Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.`) + .option(`--xdefault `, `Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required.`) .option(`--new-key `, `New attribute key.`) .action(actionRunner(databasesUpdatePointAttribute)) @@ -2893,7 +2899,7 @@ databases .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value)) - .option(`--xdefault `, `Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.`) + .option(`--xdefault `, `Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required.`) .action(actionRunner(databasesCreatePolygonAttribute)) databases @@ -2903,7 +2909,7 @@ databases .requiredOption(`--collection-id `, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection).`) .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value)) - .option(`--xdefault `, `Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.`) + .option(`--xdefault `, `Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required.`) .option(`--new-key `, `New attribute key.`) .action(actionRunner(databasesUpdatePolygonAttribute)) diff --git a/lib/commands/pull.js b/lib/commands/pull.js index ac395aac..45444647 100644 --- a/lib/commands/pull.js +++ b/lib/commands/pull.js @@ -295,7 +295,8 @@ const pullSites = async ({ code, withVariables }) => { const pullCollection = async () => { warn("appwrite pull collection has been deprecated. Please consider using 'appwrite pull tables' instead"); log("Fetching collections ..."); - let total = 0; + let totalDatabases = 0; + let totalCollections = 0; const fetchResponse = await databasesList({ queries: [JSON.stringify({ method: 'limit', values: [1] })], @@ -303,7 +304,7 @@ const pullCollection = async () => { }); if (fetchResponse["databases"].length <= 0) { log("No collections found."); - success(`Successfully pulled ${chalk.bold(total)} collections.`); + success(`Successfully pulled ${chalk.bold(totalCollections)} collections from ${chalk.bold(totalDatabases)} databases.`); return; } @@ -323,7 +324,7 @@ const pullCollection = async () => { parseOutput: false }); - total++; + totalDatabases++; log(`Pulling all collections from ${chalk.bold(database['name'])} database ...`); localConfig.addDatabase(database); @@ -334,6 +335,7 @@ const pullCollection = async () => { }, 100, 'collections'); for (const collection of collections) { + totalCollections++; localConfig.addCollection({ ...collection, '$createdAt': undefined, @@ -342,12 +344,13 @@ const pullCollection = async () => { } } - success(`Successfully pulled ${chalk.bold(total)} collections.`); + success(`Successfully pulled ${chalk.bold(totalCollections)} collections from ${chalk.bold(totalDatabases)} databases.`); } const pullTable = async () => { log("Fetching tables ..."); - let total = 0; + let totalTablesDBs = 0; + let totalTables = 0; const fetchResponse = await tablesDBList({ queries: [JSON.stringify({ method: 'limit', values: [1] })], @@ -355,7 +358,7 @@ const pullTable = async () => { }); if (fetchResponse["databases"].length <= 0) { log("No tables found."); - success(`Successfully pulled ${chalk.bold(total)} tables.`); + success(`Successfully pulled ${chalk.bold(totalTables)} tables from ${chalk.bold(totalTablesDBs)} tables databases.`); return; } @@ -375,7 +378,7 @@ const pullTable = async () => { parseOutput: false }); - total++; + totalTablesDBs++; log(`Pulling all tables from ${chalk.bold(database['name'])} database ...`); localConfig.addTablesDB(database); @@ -386,6 +389,7 @@ const pullTable = async () => { }, 100, 'tables'); for (const table of tables) { + totalTables++; localConfig.addTable({ ...table, '$createdAt': undefined, @@ -394,7 +398,7 @@ const pullTable = async () => { } } - success(`Successfully pulled ${chalk.bold(total)} tables.`); + success(`Successfully pulled ${chalk.bold(totalTables)} tables from ${chalk.bold(totalTablesDBs)} tables databases.`); } const pullBucket = async () => { @@ -474,14 +478,16 @@ const pullMessagingTopic = async () => { const pull = new Command("pull") .description(commandDescriptions['pull']) - .action(actionRunner(pullResources)); + .action(actionRunner(() => pullResources({ skipDeprecated: true }))); pull .command("all") .description("Pull all resource.") .action(actionRunner(() => { cliConfig.all = true; - return pullResources(); + return pullResources({ + skipDeprecated: true + }); })); pull diff --git a/lib/commands/tables-db.js b/lib/commands/tables-db.js index 13259027..267e99bd 100644 --- a/lib/commands/tables-db.js +++ b/lib/commands/tables-db.js @@ -1185,7 +1185,7 @@ const tablesDBUpdateIpColumn = async ({databaseId,tableId,key,required,xdefault, * @property {string} tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). * @property {string} key Column Key. * @property {boolean} required Is column required? - * @property {string} xdefault Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @property {any[]} xdefault Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. * @property {boolean} overrideForCli * @property {boolean} parseOutput * @property {libClient | undefined} sdk @@ -1205,6 +1205,7 @@ const tablesDBCreateLineColumn = async ({databaseId,tableId,key,required,xdefaul if (typeof required !== 'undefined') { payload['required'] = required; } + xdefault = xdefault === true ? [] : xdefault; if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } @@ -1228,7 +1229,7 @@ const tablesDBCreateLineColumn = async ({databaseId,tableId,key,required,xdefaul * @property {string} tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). * @property {string} key Column Key. * @property {boolean} required Is column required? - * @property {string} xdefault Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @property {any[]} xdefault Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. * @property {string} newKey New Column Key. * @property {boolean} overrideForCli * @property {boolean} parseOutput @@ -1246,6 +1247,7 @@ const tablesDBUpdateLineColumn = async ({databaseId,tableId,key,required,xdefaul if (typeof required !== 'undefined') { payload['required'] = required; } + xdefault = xdefault === true ? [] : xdefault; if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } @@ -1272,7 +1274,7 @@ const tablesDBUpdateLineColumn = async ({databaseId,tableId,key,required,xdefaul * @property {string} tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). * @property {string} key Column Key. * @property {boolean} required Is column required? - * @property {string} xdefault Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @property {any[]} xdefault Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. * @property {boolean} overrideForCli * @property {boolean} parseOutput * @property {libClient | undefined} sdk @@ -1292,6 +1294,7 @@ const tablesDBCreatePointColumn = async ({databaseId,tableId,key,required,xdefau if (typeof required !== 'undefined') { payload['required'] = required; } + xdefault = xdefault === true ? [] : xdefault; if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } @@ -1315,7 +1318,7 @@ const tablesDBCreatePointColumn = async ({databaseId,tableId,key,required,xdefau * @property {string} tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). * @property {string} key Column Key. * @property {boolean} required Is column required? - * @property {string} xdefault Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @property {any[]} xdefault Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. * @property {string} newKey New Column Key. * @property {boolean} overrideForCli * @property {boolean} parseOutput @@ -1333,6 +1336,7 @@ const tablesDBUpdatePointColumn = async ({databaseId,tableId,key,required,xdefau if (typeof required !== 'undefined') { payload['required'] = required; } + xdefault = xdefault === true ? [] : xdefault; if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } @@ -1359,7 +1363,7 @@ const tablesDBUpdatePointColumn = async ({databaseId,tableId,key,required,xdefau * @property {string} tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). * @property {string} key Column Key. * @property {boolean} required Is column required? - * @property {string} xdefault Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @property {any[]} xdefault Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. * @property {boolean} overrideForCli * @property {boolean} parseOutput * @property {libClient | undefined} sdk @@ -1379,6 +1383,7 @@ const tablesDBCreatePolygonColumn = async ({databaseId,tableId,key,required,xdef if (typeof required !== 'undefined') { payload['required'] = required; } + xdefault = xdefault === true ? [] : xdefault; if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } @@ -1402,7 +1407,7 @@ const tablesDBCreatePolygonColumn = async ({databaseId,tableId,key,required,xdef * @property {string} tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). * @property {string} key Column Key. * @property {boolean} required Is column required? - * @property {string} xdefault Default value for column when not provided, as JSON string. Cannot be set when column is required. + * @property {any[]} xdefault Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. * @property {string} newKey New Column Key. * @property {boolean} overrideForCli * @property {boolean} parseOutput @@ -1420,6 +1425,7 @@ const tablesDBUpdatePolygonColumn = async ({databaseId,tableId,key,required,xdef if (typeof required !== 'undefined') { payload['required'] = required; } + xdefault = xdefault === true ? [] : xdefault; if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } @@ -2075,7 +2081,7 @@ const tablesDBCreateRow = async ({databaseId,tableId,rowId,data,permissions,pars * @typedef {Object} TablesDBCreateRowsRequestParams * @property {string} databaseId Database ID. * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). Make sure to define columns before creating rows. - * @property {object[]} rows Array of documents data as JSON objects. + * @property {object[]} rows Array of rows data as JSON objects. * @property {boolean} overrideForCli * @property {boolean} parseOutput * @property {libClient | undefined} sdk @@ -2829,64 +2835,64 @@ tablesDB tablesDB .command(`create-line-column`) - .description(`Create a geometric line attribute.`) + .description(`Create a geometric line column.`) .requiredOption(`--database-id `, `Database ID.`) .requiredOption(`--table-id `, `Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`) .requiredOption(`--key `, `Column Key.`) .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value)) - .option(`--xdefault `, `Default value for column when not provided, as JSON string. Cannot be set when column is required.`) + .option(`--xdefault `, `Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required.`) .action(actionRunner(tablesDBCreateLineColumn)) tablesDB .command(`update-line-column`) - .description(`Update a line column. Changing the 'default' value will not update already existing documents.`) + .description(`Update a line column. Changing the 'default' value will not update already existing rows.`) .requiredOption(`--database-id `, `Database ID.`) .requiredOption(`--table-id `, `Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`) .requiredOption(`--key `, `Column Key.`) .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value)) - .option(`--xdefault `, `Default value for column when not provided, as JSON string. Cannot be set when column is required.`) + .option(`--xdefault `, `Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required.`) .option(`--new-key `, `New Column Key.`) .action(actionRunner(tablesDBUpdateLineColumn)) tablesDB .command(`create-point-column`) - .description(`Create a geometric point attribute.`) + .description(`Create a geometric point column.`) .requiredOption(`--database-id `, `Database ID.`) .requiredOption(`--table-id `, `Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`) .requiredOption(`--key `, `Column Key.`) .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value)) - .option(`--xdefault `, `Default value for column when not provided, as JSON string. Cannot be set when column is required.`) + .option(`--xdefault `, `Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required.`) .action(actionRunner(tablesDBCreatePointColumn)) tablesDB .command(`update-point-column`) - .description(`Update a point column. Changing the 'default' value will not update already existing documents.`) + .description(`Update a point column. Changing the 'default' value will not update already existing rows.`) .requiredOption(`--database-id `, `Database ID.`) .requiredOption(`--table-id `, `Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`) .requiredOption(`--key `, `Column Key.`) .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value)) - .option(`--xdefault `, `Default value for column when not provided, as JSON string. Cannot be set when column is required.`) + .option(`--xdefault `, `Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required.`) .option(`--new-key `, `New Column Key.`) .action(actionRunner(tablesDBUpdatePointColumn)) tablesDB .command(`create-polygon-column`) - .description(`Create a geometric polygon attribute.`) + .description(`Create a geometric polygon column.`) .requiredOption(`--database-id `, `Database ID.`) .requiredOption(`--table-id `, `Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`) .requiredOption(`--key `, `Column Key.`) .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value)) - .option(`--xdefault `, `Default value for column when not provided, as JSON string. Cannot be set when column is required.`) + .option(`--xdefault `, `Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required.`) .action(actionRunner(tablesDBCreatePolygonColumn)) tablesDB .command(`update-polygon-column`) - .description(`Update a polygon column. Changing the 'default' value will not update already existing documents.`) + .description(`Update a polygon column. Changing the 'default' value will not update already existing rows.`) .requiredOption(`--database-id `, `Database ID.`) .requiredOption(`--table-id `, `Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate).`) .requiredOption(`--key `, `Column Key.`) .requiredOption(`--required [value]`, `Is column required?`, (value) => value === undefined ? true : parseBool(value)) - .option(`--xdefault `, `Default value for column when not provided, as JSON string. Cannot be set when column is required.`) + .option(`--xdefault `, `Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required.`) .option(`--new-key `, `New Column Key.`) .action(actionRunner(tablesDBUpdatePolygonColumn)) @@ -3047,7 +3053,7 @@ tablesDB .description(`Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) API or directly from your database console.`) .requiredOption(`--database-id `, `Database ID.`) .requiredOption(`--table-id `, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). Make sure to define columns before creating rows.`) - .requiredOption(`--rows [rows...]`, `Array of documents data as JSON objects.`) + .requiredOption(`--rows [rows...]`, `Array of rows data as JSON objects.`) .action(actionRunner(tablesDBCreateRows)) tablesDB diff --git a/lib/parser.js b/lib/parser.js index f9ea7f36..1d5191e2 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -122,7 +122,7 @@ const parseError = (err) => { } catch { } - const version = '9.1.0'; + const version = '10.0.0'; const stepsToReproduce = `Running \`appwrite ${cliConfig.reportData.data.args.join(' ')}\``; const yourEnvironment = `CLI version: ${version}\nOperation System: ${os.type()}\nAppwrite version: ${appwriteVersion}\nIs Cloud: ${isCloud()}`; @@ -205,7 +205,8 @@ 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 and query and filter lists of documents.`, + "databases": `(Legacy) The databases command allows you to create structured collections of documents and query and filter lists of documents.`, + 'tables-db': `The tables-db command allows you to create structured tables of columns and query and filter lists of rows.`, "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.`, @@ -218,6 +219,8 @@ const commandDescriptions = { "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.`, "update": `The update command allows you to update the Appwrite CLI to the latest version.`, "users": `The users command allows you to manage your project users.`, + "projects": `The projects command allows you to manage your projects, add platforms, manage API keys, Dev Keys etc.`, + "project": `The project command allows you to manage project related resources like usage, variables, etc.`, "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 log out of your Appwrite account.`, diff --git a/lib/type-generation/languages/typescript.js b/lib/type-generation/languages/typescript.js index 69285dda..d189d23e 100644 --- a/lib/type-generation/languages/typescript.js +++ b/lib/type-generation/languages/typescript.js @@ -90,7 +90,9 @@ export enum <%- toPascalCase(attribute.key) %> { <% for (const [index, collection] of Object.entries(collections)) { -%> export type <%- toPascalCase(collection.name) %> = Models.Row & { <% for (const attribute of collection.attributes) { -%> - <%- strict ? toCamelCase(attribute.key) : attribute.key %>: <%- getType(attribute, collections) %>; +<% const propertyName = strict ? toCamelCase(attribute.key) : attribute.key; -%> +<% const isValidIdentifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(propertyName); -%> + <% if (isValidIdentifier) { %><%- propertyName %><% } else { %>"<%- propertyName %>"<% } %>: <%- getType(attribute, collections) %>; <% } -%> }<% if (index < collections.length - 1) { %> <% } %> diff --git a/package.json b/package.json index d8c9089d..95cfc446 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": "9.1.0", + "version": "10.0.0", "license": "BSD-3-Clause", "main": "index.js", "bin": { diff --git a/scoop/appwrite.config.json b/scoop/appwrite.config.json index 165cd7af..8987c5b9 100644 --- a/scoop/appwrite.config.json +++ b/scoop/appwrite.config.json @@ -1,12 +1,12 @@ { "$schema": "https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/schema.json", - "version": "9.1.0", + "version": "10.0.0", "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/9.1.0/appwrite-cli-win-x64.exe", + "url": "https://github.com/appwrite/sdk-for-cli/releases/download/10.0.0/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/9.1.0/appwrite-cli-win-arm64.exe", + "url": "https://github.com/appwrite/sdk-for-cli/releases/download/10.0.0/appwrite-cli-win-arm64.exe", "bin": [ [ "appwrite-cli-win-arm64.exe",