diff --git a/README.md b/README.md index f3c09bd..792899e 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 -6.0.0 +6.0.1 ``` ### 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 +6.0.1 ``` ## Getting Started diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index d48c347..f5adb49 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -3,4 +3,5 @@ appwrite databases updateBooleanAttribute \ --collectionId \ --key '' \ --required false \ - --default false + --default false \ + diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index 9fc5637..fe4a462 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -3,4 +3,5 @@ appwrite databases updateDatetimeAttribute \ --collectionId \ --key '' \ --required false \ - --default '' + --default '' \ + diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index 9f7bffe..58510a6 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -3,4 +3,5 @@ appwrite databases updateEmailAttribute \ --collectionId \ --key '' \ --required false \ - --default email@example.com + --default email@example.com \ + diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index bf562a0..21d56d3 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -4,4 +4,5 @@ appwrite databases updateEnumAttribute \ --key '' \ --elements one two three \ --required false \ - --default + --default \ + diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index 097dfd3..353320d 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -5,4 +5,5 @@ appwrite databases updateFloatAttribute \ --required false \ --min null \ --max null \ - --default null + --default null \ + diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index 6a6b074..c170b7f 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -5,4 +5,5 @@ appwrite databases updateIntegerAttribute \ --required false \ --min null \ --max null \ - --default null + --default null \ + diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index 2439b5a..a400ead 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -3,4 +3,5 @@ appwrite databases updateIpAttribute \ --collectionId \ --key '' \ --required false \ - --default '' + --default '' \ + diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index be03a70..6e2dbd9 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -3,3 +3,4 @@ appwrite databases updateRelationshipAttribute \ --collectionId \ --key '' \ + diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index ebf4525..526ece0 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -3,4 +3,6 @@ appwrite databases updateStringAttribute \ --collectionId \ --key '' \ --required false \ - --default + --default \ + + diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index aa11a58..e6f401b 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -3,4 +3,5 @@ appwrite databases updateUrlAttribute \ --collectionId \ --key '' \ --required false \ - --default https://example.com + --default https://example.com \ + diff --git a/install.ps1 b/install.ps1 index 1ecfbf0..6444c7d 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/appwrite-cli-win-x64.exe" -$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0/appwrite-cli-win-arm64.exe" +$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.1/appwrite-cli-win-x64.exe" +$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.1/appwrite-cli-win-arm64.exe" $APPWRITE_BINARY_NAME = "appwrite.exe" diff --git a/install.sh b/install.sh index 3719a13..ae330ae 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" + GITHUB_LATEST_VERSION="6.0.1" 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 6bff12f..a382649 100644 --- a/lib/client.js +++ b/lib/client.js @@ -16,8 +16,8 @@ class Client { 'x-sdk-name': 'Command Line', 'x-sdk-platform': 'console', 'x-sdk-language': 'cli', - 'x-sdk-version': '6.0.0', - 'user-agent' : `AppwriteCLI/6.0.0 (${os.type()} ${os.version()}; ${os.arch()})`, + 'x-sdk-version': '6.0.1', + 'user-agent' : `AppwriteCLI/6.0.1 (${os.type()} ${os.version()}; ${os.arch()})`, 'X-Appwrite-Response-Format' : '1.6.0', }; } diff --git a/lib/commands/databases.js b/lib/commands/databases.js index 66b49e6..bf2df39 100644 --- a/lib/commands/databases.js +++ b/lib/commands/databases.js @@ -569,6 +569,7 @@ const databasesCreateBooleanAttribute = async ({databaseId,collectionId,key,requ * @property {string} key Attribute Key. * @property {boolean} required Is attribute required? * @property {boolean} xdefault Default value for attribute when not provided. Cannot be set when attribute is required. + * @property {string} newKey New attribute key. * @property {boolean} overrideForCli * @property {boolean} parseOutput * @property {libClient | undefined} sdk @@ -577,7 +578,7 @@ const databasesCreateBooleanAttribute = async ({databaseId,collectionId,key,requ /** * @param {DatabasesUpdateBooleanAttributeRequestParams} params */ -const databasesUpdateBooleanAttribute = async ({databaseId,collectionId,key,required,xdefault,parseOutput = true, overrideForCli = false, sdk = undefined}) => { +const databasesUpdateBooleanAttribute = async ({databaseId,collectionId,key,required,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => { let client = !sdk ? await sdkForProject() : sdk; let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); @@ -588,6 +589,9 @@ const databasesUpdateBooleanAttribute = async ({databaseId,collectionId,key,requ if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } let response = undefined; @@ -658,6 +662,7 @@ const databasesCreateDatetimeAttribute = async ({databaseId,collectionId,key,req * @property {string} key Attribute Key. * @property {boolean} required Is attribute required? * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required. + * @property {string} newKey New attribute key. * @property {boolean} overrideForCli * @property {boolean} parseOutput * @property {libClient | undefined} sdk @@ -666,7 +671,7 @@ const databasesCreateDatetimeAttribute = async ({databaseId,collectionId,key,req /** * @param {DatabasesUpdateDatetimeAttributeRequestParams} params */ -const databasesUpdateDatetimeAttribute = async ({databaseId,collectionId,key,required,xdefault,parseOutput = true, overrideForCli = false, sdk = undefined}) => { +const databasesUpdateDatetimeAttribute = async ({databaseId,collectionId,key,required,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => { let client = !sdk ? await sdkForProject() : sdk; let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); @@ -677,6 +682,9 @@ const databasesUpdateDatetimeAttribute = async ({databaseId,collectionId,key,req if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } let response = undefined; @@ -747,6 +755,7 @@ const databasesCreateEmailAttribute = async ({databaseId,collectionId,key,requir * @property {string} key Attribute Key. * @property {boolean} required Is attribute required? * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required. + * @property {string} newKey New attribute key. * @property {boolean} overrideForCli * @property {boolean} parseOutput * @property {libClient | undefined} sdk @@ -755,7 +764,7 @@ const databasesCreateEmailAttribute = async ({databaseId,collectionId,key,requir /** * @param {DatabasesUpdateEmailAttributeRequestParams} params */ -const databasesUpdateEmailAttribute = async ({databaseId,collectionId,key,required,xdefault,parseOutput = true, overrideForCli = false, sdk = undefined}) => { +const databasesUpdateEmailAttribute = async ({databaseId,collectionId,key,required,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => { let client = !sdk ? await sdkForProject() : sdk; let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); @@ -766,6 +775,9 @@ const databasesUpdateEmailAttribute = async ({databaseId,collectionId,key,requir if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } let response = undefined; @@ -842,6 +854,7 @@ const databasesCreateEnumAttribute = async ({databaseId,collectionId,key,element * @property {string[]} elements Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long. * @property {boolean} required Is attribute required? * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required. + * @property {string} newKey New attribute key. * @property {boolean} overrideForCli * @property {boolean} parseOutput * @property {libClient | undefined} sdk @@ -850,7 +863,7 @@ const databasesCreateEnumAttribute = async ({databaseId,collectionId,key,element /** * @param {DatabasesUpdateEnumAttributeRequestParams} params */ -const databasesUpdateEnumAttribute = async ({databaseId,collectionId,key,elements,required,xdefault,parseOutput = true, overrideForCli = false, sdk = undefined}) => { +const databasesUpdateEnumAttribute = async ({databaseId,collectionId,key,elements,required,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => { let client = !sdk ? await sdkForProject() : sdk; let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); @@ -865,6 +878,9 @@ const databasesUpdateEnumAttribute = async ({databaseId,collectionId,key,element if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } let response = undefined; @@ -945,6 +961,7 @@ const databasesCreateFloatAttribute = async ({databaseId,collectionId,key,requir * @property {number} min Minimum value to enforce on new documents * @property {number} max Maximum value to enforce on new documents * @property {number} xdefault Default value for attribute when not provided. Cannot be set when attribute is required. + * @property {string} newKey New attribute key. * @property {boolean} overrideForCli * @property {boolean} parseOutput * @property {libClient | undefined} sdk @@ -953,7 +970,7 @@ const databasesCreateFloatAttribute = async ({databaseId,collectionId,key,requir /** * @param {DatabasesUpdateFloatAttributeRequestParams} params */ -const databasesUpdateFloatAttribute = async ({databaseId,collectionId,key,required,min,max,xdefault,parseOutput = true, overrideForCli = false, sdk = undefined}) => { +const databasesUpdateFloatAttribute = async ({databaseId,collectionId,key,required,min,max,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => { let client = !sdk ? await sdkForProject() : sdk; let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); @@ -970,6 +987,9 @@ const databasesUpdateFloatAttribute = async ({databaseId,collectionId,key,requir if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } let response = undefined; @@ -1050,6 +1070,7 @@ const databasesCreateIntegerAttribute = async ({databaseId,collectionId,key,requ * @property {number} min Minimum value to enforce on new documents * @property {number} max Maximum value to enforce on new documents * @property {number} xdefault Default value for attribute when not provided. Cannot be set when attribute is required. + * @property {string} newKey New attribute key. * @property {boolean} overrideForCli * @property {boolean} parseOutput * @property {libClient | undefined} sdk @@ -1058,7 +1079,7 @@ const databasesCreateIntegerAttribute = async ({databaseId,collectionId,key,requ /** * @param {DatabasesUpdateIntegerAttributeRequestParams} params */ -const databasesUpdateIntegerAttribute = async ({databaseId,collectionId,key,required,min,max,xdefault,parseOutput = true, overrideForCli = false, sdk = undefined}) => { +const databasesUpdateIntegerAttribute = async ({databaseId,collectionId,key,required,min,max,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => { let client = !sdk ? await sdkForProject() : sdk; let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); @@ -1075,6 +1096,9 @@ const databasesUpdateIntegerAttribute = async ({databaseId,collectionId,key,requ if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } let response = undefined; @@ -1145,6 +1169,7 @@ const databasesCreateIpAttribute = async ({databaseId,collectionId,key,required, * @property {string} key Attribute Key. * @property {boolean} required Is attribute required? * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required. + * @property {string} newKey New attribute key. * @property {boolean} overrideForCli * @property {boolean} parseOutput * @property {libClient | undefined} sdk @@ -1153,7 +1178,7 @@ const databasesCreateIpAttribute = async ({databaseId,collectionId,key,required, /** * @param {DatabasesUpdateIpAttributeRequestParams} params */ -const databasesUpdateIpAttribute = async ({databaseId,collectionId,key,required,xdefault,parseOutput = true, overrideForCli = false, sdk = undefined}) => { +const databasesUpdateIpAttribute = async ({databaseId,collectionId,key,required,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => { let client = !sdk ? await sdkForProject() : sdk; let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); @@ -1164,6 +1189,9 @@ const databasesUpdateIpAttribute = async ({databaseId,collectionId,key,required, if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } let response = undefined; @@ -1298,6 +1326,8 @@ const databasesCreateStringAttribute = async ({databaseId,collectionId,key,size, * @property {string} key Attribute Key. * @property {boolean} required Is attribute required? * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required. + * @property {number} size Maximum size of the string attribute. + * @property {string} newKey New attribute key. * @property {boolean} overrideForCli * @property {boolean} parseOutput * @property {libClient | undefined} sdk @@ -1306,7 +1336,7 @@ const databasesCreateStringAttribute = async ({databaseId,collectionId,key,size, /** * @param {DatabasesUpdateStringAttributeRequestParams} params */ -const databasesUpdateStringAttribute = async ({databaseId,collectionId,key,required,xdefault,parseOutput = true, overrideForCli = false, sdk = undefined}) => { +const databasesUpdateStringAttribute = async ({databaseId,collectionId,key,required,xdefault,size,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => { let client = !sdk ? await sdkForProject() : sdk; let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); @@ -1317,6 +1347,12 @@ const databasesUpdateStringAttribute = async ({databaseId,collectionId,key,requi if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } let response = undefined; @@ -1387,6 +1423,7 @@ const databasesCreateUrlAttribute = async ({databaseId,collectionId,key,required * @property {string} key Attribute Key. * @property {boolean} required Is attribute required? * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required. + * @property {string} newKey New attribute key. * @property {boolean} overrideForCli * @property {boolean} parseOutput * @property {libClient | undefined} sdk @@ -1395,7 +1432,7 @@ const databasesCreateUrlAttribute = async ({databaseId,collectionId,key,required /** * @param {DatabasesUpdateUrlAttributeRequestParams} params */ -const databasesUpdateUrlAttribute = async ({databaseId,collectionId,key,required,xdefault,parseOutput = true, overrideForCli = false, sdk = undefined}) => { +const databasesUpdateUrlAttribute = async ({databaseId,collectionId,key,required,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => { let client = !sdk ? await sdkForProject() : sdk; let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); @@ -1406,6 +1443,9 @@ const databasesUpdateUrlAttribute = async ({databaseId,collectionId,key,required if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } let response = undefined; @@ -1493,6 +1533,7 @@ const databasesDeleteAttribute = async ({databaseId,collectionId,key,parseOutput * @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 {RelationMutate} onDelete Constraints option + * @property {string} newKey New attribute key. * @property {boolean} overrideForCli * @property {boolean} parseOutput * @property {libClient | undefined} sdk @@ -1501,7 +1542,7 @@ const databasesDeleteAttribute = async ({databaseId,collectionId,key,parseOutput /** * @param {DatabasesUpdateRelationshipAttributeRequestParams} params */ -const databasesUpdateRelationshipAttribute = async ({databaseId,collectionId,key,onDelete,parseOutput = true, overrideForCli = false, sdk = undefined}) => { +const databasesUpdateRelationshipAttribute = async ({databaseId,collectionId,key,onDelete,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => { let client = !sdk ? await sdkForProject() : sdk; let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); @@ -1509,6 +1550,9 @@ const databasesUpdateRelationshipAttribute = async ({databaseId,collectionId,key if (typeof onDelete !== 'undefined') { payload['onDelete'] = onDelete; } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } let response = undefined; @@ -2181,6 +2225,7 @@ databases .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .option(`--xdefault `, `Default value for attribute when not provided. Cannot be set when attribute is required.`, parseBool) + .option(`--new-key `, `New attribute key.`) .action(actionRunner(databasesUpdateBooleanAttribute)) databases @@ -2202,6 +2247,7 @@ databases .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .option(`--xdefault `, `Default value for attribute when not provided. Cannot be set when attribute is required.`) + .option(`--new-key `, `New attribute key.`) .action(actionRunner(databasesUpdateDatetimeAttribute)) databases @@ -2223,6 +2269,7 @@ databases .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .option(`--xdefault `, `Default value for attribute when not provided. Cannot be set when attribute is required.`) + .option(`--new-key `, `New attribute key.`) .action(actionRunner(databasesUpdateEmailAttribute)) databases @@ -2246,6 +2293,7 @@ databases .requiredOption(`--elements [elements...]`, `Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .option(`--xdefault `, `Default value for attribute when not provided. Cannot be set when attribute is required.`) + .option(`--new-key `, `New attribute key.`) .action(actionRunner(databasesUpdateEnumAttribute)) databases @@ -2271,6 +2319,7 @@ databases .requiredOption(`--min `, `Minimum value to enforce on new documents`, parseInteger) .requiredOption(`--max `, `Maximum value to enforce on new documents`, parseInteger) .option(`--xdefault `, `Default value for attribute when not provided. Cannot be set when attribute is required.`, parseInteger) + .option(`--new-key `, `New attribute key.`) .action(actionRunner(databasesUpdateFloatAttribute)) databases @@ -2296,6 +2345,7 @@ databases .requiredOption(`--min `, `Minimum value to enforce on new documents`, parseInteger) .requiredOption(`--max `, `Maximum value to enforce on new documents`, parseInteger) .option(`--xdefault `, `Default value for attribute when not provided. Cannot be set when attribute is required.`, parseInteger) + .option(`--new-key `, `New attribute key.`) .action(actionRunner(databasesUpdateIntegerAttribute)) databases @@ -2317,6 +2367,7 @@ databases .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .option(`--xdefault `, `Default value for attribute when not provided. Cannot be set when attribute is required.`) + .option(`--new-key `, `New attribute key.`) .action(actionRunner(databasesUpdateIpAttribute)) databases @@ -2353,6 +2404,8 @@ databases .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .option(`--xdefault `, `Default value for attribute when not provided. Cannot be set when attribute is required.`) + .option(`--size `, `Maximum size of the string attribute.`, parseInteger) + .option(`--new-key `, `New attribute key.`) .action(actionRunner(databasesUpdateStringAttribute)) databases @@ -2374,6 +2427,7 @@ databases .requiredOption(`--key `, `Attribute Key.`) .requiredOption(`--required `, `Is attribute required?`, parseBool) .option(`--xdefault `, `Default value for attribute when not provided. Cannot be set when attribute is required.`) + .option(`--new-key `, `New attribute key.`) .action(actionRunner(databasesUpdateUrlAttribute)) databases @@ -2399,6 +2453,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.`) .option(`--on-delete `, `Constraints option`) + .option(`--new-key `, `New attribute key.`) .action(actionRunner(databasesUpdateRelationshipAttribute)) databases diff --git a/lib/commands/functions.js b/lib/commands/functions.js index a5b9a7f..8346b25 100644 --- a/lib/commands/functions.js +++ b/lib/commands/functions.js @@ -1022,7 +1022,7 @@ const functionsListExecutions = async ({functionId,queries,search,parseOutput = /** * @typedef {Object} FunctionsCreateExecutionRequestParams * @property {string} functionId Function ID. - * @property {string} body HTTP body of execution. Default value is empty string. + * @property {payload} body HTTP body of execution. Default value is empty string. * @property {boolean} async Execute code in the background. Default value is false. * @property {string} xpath HTTP path of execution. Path can include query params. Default value is / * @property {ExecutionMethod} method HTTP method of execution. Default value is GET. @@ -1031,18 +1031,19 @@ const functionsListExecutions = async ({functionId,queries,search,parseOutput = * @property {boolean} overrideForCli * @property {boolean} parseOutput * @property {libClient | undefined} sdk + * @property {CallableFunction} onProgress */ /** * @param {FunctionsCreateExecutionRequestParams} params */ -const functionsCreateExecution = async ({functionId,body,async,xpath,method,headers,scheduledAt,parseOutput = true, overrideForCli = false, sdk = undefined}) => { +const functionsCreateExecution = async ({functionId,body,async,xpath,method,headers,scheduledAt,parseOutput = true, overrideForCli = false, sdk = undefined,onProgress = () => {}}) => { let client = !sdk ? await sdkForProject() : sdk; let apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId); let payload = {}; if (typeof body !== 'undefined') { - payload['body'] = body; + payload['body'] = body.toString(); } if (typeof async !== 'undefined') { payload['async'] = async; @@ -1060,18 +1061,6 @@ const functionsCreateExecution = async ({functionId,body,async,xpath,method,head payload['scheduledAt'] = scheduledAt; } - let response = undefined; - - response = await client.call('post', apiPath, { - 'content-type': 'application/json', - }, payload); - - if (parseOutput) { - parse(response) - } - - return response; - } /** diff --git a/lib/commands/generic.js b/lib/commands/generic.js index 407dd58..e58aa3c 100644 --- a/lib/commands/generic.js +++ b/lib/commands/generic.js @@ -13,7 +13,7 @@ const DEFAULT_ENDPOINT = 'https://cloud.appwrite.io/v1'; const loginCommand = async ({ email, password, endpoint, mfa, code }) => { const oldCurrent = globalConfig.getCurrentSession(); - const configEndpoint = endpoint ?? globalConfig.getEndpoint() ?? DEFAULT_ENDPOINT; + const configEndpoint = (endpoint ?? globalConfig.getEndpoint()) || DEFAULT_ENDPOINT; if (globalConfig.getCurrentSession() !== '') { log('You are currently signed in as ' + globalConfig.getEmail()); diff --git a/lib/commands/run.js b/lib/commands/run.js index fea72c3..1fae14f 100644 --- a/lib/commands/run.js +++ b/lib/commands/run.js @@ -97,8 +97,8 @@ const runFunction = async ({ port, functionId, withVariables, reload, userId } = process.exit(); }); - const logsPath = path.join(process.cwd(), func.path, '.appwrite/logs.txt'); - const errorsPath = path.join(process.cwd(), func.path, '.appwrite/errors.txt'); + const logsPath = path.join(localConfig.getDirname(), func.path, '.appwrite/logs.txt'); + const errorsPath = path.join(localConfig.getDirname(), func.path, '.appwrite/errors.txt'); if(!fs.existsSync(path.dirname(logsPath))) { fs.mkdirSync(path.dirname(logsPath), { recursive: true }); @@ -131,7 +131,7 @@ const runFunction = async ({ port, functionId, withVariables, reload, userId } = } } - const functionPath = path.join(process.cwd(), func.path); + const functionPath = path.join(localConfig.getDirname(), func.path); const envPath = path.join(functionPath, '.env'); if(fs.existsSync(envPath)) { const env = parseDotenv(fs.readFileSync(envPath).toString() ?? ''); @@ -192,7 +192,7 @@ const runFunction = async ({ port, functionId, withVariables, reload, userId } = } chokidar.watch('.', { - cwd: path.join(process.cwd(), func.path), + cwd: path.join(localConfig.getDirname(), func.path), ignoreInitial: true, ignored: (xpath) => { const relativePath = path.relative(functionPath, xpath); diff --git a/lib/config.js b/lib/config.js index 19190d7..d4ab0cc 100644 --- a/lib/config.js +++ b/lib/config.js @@ -145,6 +145,10 @@ class Local extends Config { this.configDirectoryPath =_path.dirname(absolutePath); } + getDirname() { + return _path.dirname(this.path) + } + getFunctions() { if (!this.has("functions")) { return []; diff --git a/lib/emulation/docker.js b/lib/emulation/docker.js index 41e39f5..0b774d8 100644 --- a/lib/emulation/docker.js +++ b/lib/emulation/docker.js @@ -47,7 +47,7 @@ async function dockerBuild(func, variables) { const runtimeName = runtimeChunks.join("-"); const imageName = `openruntimes/${runtimeName}:${openRuntimesVersion}-${runtimeVersion}`; - const functionDir = path.join(process.cwd(), func.path); + const functionDir = path.join(localConfig.getDirname(), func.path); const id = func.$id; @@ -124,7 +124,7 @@ async function dockerBuild(func, variables) { return; } - const copyPath = path.join(process.cwd(), func.path, '.appwrite', 'build.tar.gz'); + const copyPath = path.join(localConfig.getDirname(), func.path, '.appwrite', 'build.tar.gz'); const copyDir = path.dirname(copyPath); if (!fs.existsSync(copyDir)) { fs.mkdirSync(copyDir, { recursive: true }); @@ -143,7 +143,7 @@ async function dockerBuild(func, variables) { await dockerStop(id); - const tempPath = path.join(process.cwd(), func.path, 'code.tar.gz'); + const tempPath = path.join(localConfig.getDirname(), func.path, 'code.tar.gz'); if (fs.existsSync(tempPath)) { fs.rmSync(tempPath, { force: true }); } @@ -153,7 +153,7 @@ async function dockerBuild(func, variables) { async function dockerStart(func, variables, port) { // Pack function files - const functionDir = path.join(process.cwd(), func.path); + const functionDir = path.join(localConfig.getDirname(), func.path); const runtimeChunks = func.runtime.split("-"); const runtimeVersion = runtimeChunks.pop(); @@ -211,12 +211,12 @@ async function dockerCleanup(functionId) { await dockerStop(functionId); const func = localConfig.getFunction(functionId); - const appwritePath = path.join(process.cwd(), func.path, '.appwrite'); + const appwritePath = path.join(localConfig.getDirname(), func.path, '.appwrite'); if (fs.existsSync(appwritePath)) { fs.rmSync(appwritePath, { recursive: true, force: true }); } - const tempPath = path.join(process.cwd(), func.path, 'code.tar.gz'); + const tempPath = path.join(localConfig.getDirname(), func.path, 'code.tar.gz'); if (fs.existsSync(tempPath)) { fs.rmSync(tempPath, { force: true }); } diff --git a/lib/parser.js b/lib/parser.js index 6b53ec7..233d69d 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -120,7 +120,7 @@ const parseError = (err) => { } catch { } - const version = '6.0.0'; + const version = '6.0.1'; const stepsToReproduce = `Running \`appwrite ${cliConfig.reportData.data.args.join(' ')}\``; const yourEnvironment = `CLI version: ${version}\nOperation System: ${os.type()}\nAppwrite version: ${appwriteVersion}\nIs Cloud: ${isCloud}`; diff --git a/package.json b/package.json index fadfab4..f42b92b 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", + "version": "6.0.1", "license": "BSD-3-Clause", "main": "index.js", "bin": { diff --git a/scoop/appwrite.json b/scoop/appwrite.json index 7fc9b6f..730e70f 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", + "version": "6.0.1", "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/appwrite-cli-win-x64.exe", + "url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.1/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/appwrite-cli-win-arm64.exe", + "url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.1/appwrite-cli-win-arm64.exe", "bin": [ [ "appwrite-cli-win-arm64.exe",