From aac46cd5fe13867d4c1bf8fbb77e71def31b53a6 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 6 Sep 2023 19:59:42 +0000 Subject: [PATCH 01/16] fix: migration issues --- CHANGES.md | 9 ++++----- src/Appwrite/Migration/Version/V19.php | 27 +++++++++++++------------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 84448c7685..f7ebdb358d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,8 +4,8 @@ ## Changes -* Fix create phone session abuse key by @stnguyen90 in https://github.com/appwrite/appwrite/pull/6134 -* Fix CLI backwards compatibility by @stnguyen90 in https://github.com/appwrite/appwrite/pull/6125 +- Fix create phone session abuse key by @stnguyen90 in https://github.com/appwrite/appwrite/pull/6134 +- Fix CLI backwards compatibility by @stnguyen90 in https://github.com/appwrite/appwrite/pull/6125 * Override forEachDocument() to skip the cache collection by @stnguyen90 in https://github.com/appwrite/appwrite/pull/6144 * Fix Not Found error when deploying function from git by @stnguyen90 in https://github.com/appwrite/appwrite/pull/6133 * Add required params for scheduled functions by @stnguyen90 in https://github.com/appwrite/appwrite/pull/6148 @@ -15,12 +15,11 @@ * Fix create execution request filter from previous SDK version by @stnguyen90 in https://github.com/appwrite/appwrite/pull/6146 * Fix: AI Assistant by @Meldiron in https://github.com/appwrite/appwrite/pull/6153 * Make URL optional for Create Membership API and Serverside Requests by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/6157 -* Fix: v2 functions by @Meldiron in https://github.com/appwrite/appwrite/pull/6142 +* Support for v2 functions [#6142](https://github.com/appwrite/appwrite/pull/6142) * Fix migrations worker by @abnegate in https://github.com/appwrite/appwrite/pull/6116 -* Fix: Global variables by @Meldiron in https://github.com/appwrite/appwrite/pull/6150 +* Fix: Global variables by [#6150](https://github.com/appwrite/appwrite/pull/6150) * Fix webhook secret validation and executor path validation by @vermakhushboo in https://github.com/appwrite/appwrite/pull/6162 * Fix: Untrusted custom domains + auto-ssl by @Meldiron in https://github.com/appwrite/appwrite/pull/6155 -* Update composer.lock by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/6161 # Version 1.4.1 diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index 896fc816a8..418fd68d85 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -651,7 +651,7 @@ class V19 extends Migration switch ($document->getCollection()) { case 'attributes': case 'indexes': - $status = $document->getAttribute('status', ''); + $status = $document->getAttribute('status', $document->getAttribute('status', '')); if ($status === 'failed') { $document->setAttribute('error', 'Unknown problem'); } @@ -663,10 +663,10 @@ class V19 extends Migration $stdout = $document->getAttribute('stdout', ''); $stderr = $document->getAttribute('stderr', ''); - $document->setAttribute('logs', $stdout . PHP_EOL . $stderr); + $document->setAttribute('logs', $document->getAttribute('logs', $stdout . PHP_EOL . $stderr)); break; case 'databases': - $document->setAttribute('enabled', true); + $document->setAttribute('enabled', $document->getAttribute('enabled', true)); break; case 'deployments': $resourceId = $document->getAttribute('resourceId'); @@ -680,9 +680,8 @@ class V19 extends Migration } $commands = $this->getFunctionCommands($function); - $document->setAttribute('commands', $commands); - - $document->setAttribute('type', 'manual'); + $document->setAttribute('commands', $document->getAttribute('commands', $commands)); + $document->setAttribute('type', $document->getAttribute('type', 'manual')); break; case 'executions': $functionId = $document->getAttribute('functionId'); @@ -694,9 +693,9 @@ class V19 extends Migration $document->setAttribute('deploymentInternalId', $deployment->getInternalId()); break; case 'functions': - $document->setAttribute('live', true); - $document->setAttribute('logging', true); - $document->setAttribute('version', 'v2'); + $document->setAttribute('live', $document->getAttribute('live', true)); + $document->setAttribute('logging', $document->getAttribute('logging', true)); + $document->setAttribute('version', $document->getAttribute('version', 'v2')); $deploymentId = $document->getAttribute('deployment'); if (!empty($deploymentId)) { @@ -706,7 +705,7 @@ class V19 extends Migration } $commands = $this->getFunctionCommands($document); - $document->setAttribute('commands', $commands); + $document->setAttribute('commands', $document->getAttribute('commands', $commands)); $schedule = $this->consoleDB->createDocument('schedules', new Document([ 'region' => App::getEnv('_APP_REGION', 'default'), // Todo replace with projects region @@ -728,13 +727,13 @@ class V19 extends Migration $databases = Config::getParam('pools-database', []); $database = $databases[0]; - $document->setAttribute('database', $database); - $document->setAttribute('smtp', []); - $document->setAttribute('templates', []); + $document->setAttribute('database', $document->getAttribute('live', $database)); + $document->setAttribute('smtp', $document->getAttribute('smtp', [])); + $document->setAttribute('templates', $document->getAttribute('templates', [])); break; case 'variables': - $document->setAttribute('resourceType', 'function'); + $document->setAttribute('resourceType', $document->getAttribute('resourceType', 'function')); break; default: break; From 430ec73a98efb75b02c54b601b493e7d49c35ce5 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 6 Sep 2023 20:01:43 +0000 Subject: [PATCH 02/16] fix: incorrect attribute name --- src/Appwrite/Migration/Version/V19.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index 418fd68d85..d7dae3635f 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -727,7 +727,7 @@ class V19 extends Migration $databases = Config::getParam('pools-database', []); $database = $databases[0]; - $document->setAttribute('database', $document->getAttribute('live', $database)); + $document->setAttribute('database', $document->getAttribute('database', $database)); $document->setAttribute('smtp', $document->getAttribute('smtp', [])); $document->setAttribute('templates', $document->getAttribute('templates', [])); From ec9ecb6cd46f8ec4ff48a12fe323ccaa718c2e1b Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 6 Sep 2023 20:08:07 +0000 Subject: [PATCH 03/16] chore: linter --- src/Appwrite/Migration/Version/V19.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index d7dae3635f..5abf91ed62 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -56,15 +56,15 @@ class V19 extends Migration if ($domain->getAttribute('verification', false)) { $status = 'verified'; } - + $projectId = $domain->getAttribute('projectId'); $projectInternalId = $domain->getAttribute('projectInternalId'); - + if (empty($projectId) || empty($projectInternalId)) { Console::warning("Error migrating domain {$domain->getAttribute('domain')}: Missing projectId or projectInternalId"); continue; } - + $ruleDocument = new Document([ 'projectId' => $domain->getAttribute('projectId'), 'projectInternalId' => $domain->getAttribute('projectInternalId'), @@ -75,7 +75,7 @@ class V19 extends Migration 'status' => $status, 'certificateId' => $domain->getAttribute('certificateId'), ]); - + try { $this->consoleDB->createDocument('rules', $ruleDocument); } catch (\Throwable $th) { From 26d8eb60acdf8e67c606a28082b11a5ef0c5afe8 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 6 Sep 2023 20:15:33 +0000 Subject: [PATCH 04/16] chore: update changelog --- CHANGES.md | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index f7ebdb358d..01b505ab71 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,22 +4,21 @@ ## Changes -- Fix create phone session abuse key by @stnguyen90 in https://github.com/appwrite/appwrite/pull/6134 -- Fix CLI backwards compatibility by @stnguyen90 in https://github.com/appwrite/appwrite/pull/6125 -* Override forEachDocument() to skip the cache collection by @stnguyen90 in https://github.com/appwrite/appwrite/pull/6144 -* Fix Not Found error when deploying function from git by @stnguyen90 in https://github.com/appwrite/appwrite/pull/6133 -* Add required params for scheduled functions by @stnguyen90 in https://github.com/appwrite/appwrite/pull/6148 -* Update the error message for router_domain_not_configured by @stnguyen90 in https://github.com/appwrite/appwrite/pull/6145 -* Fix _APP_EXECUTOR_HOST for upgrades by @stnguyen90 in https://github.com/appwrite/appwrite/pull/6141 -* Change executor hostname back to appwrite-executor by @stnguyen90 in https://github.com/appwrite/appwrite/pull/6160 -* Fix create execution request filter from previous SDK version by @stnguyen90 in https://github.com/appwrite/appwrite/pull/6146 -* Fix: AI Assistant by @Meldiron in https://github.com/appwrite/appwrite/pull/6153 -* Make URL optional for Create Membership API and Serverside Requests by @PineappleIOnic in https://github.com/appwrite/appwrite/pull/6157 +- Fix create phone session abuse key [#6134][https://github.com/appwrite/appwrite/pull/6134] +- Fix CLI backwards compatibility [#6125](https://github.com/appwrite/appwrite/pull/6125) +* Override forEachDocument() to skip the cache collection [#6144](https://github.com/appwrite/appwrite/pull/6144) +* Fix Not Found error when deploying function from git [#6133](https://github.com/appwrite/appwrite/pull/6133) +* Add required params for scheduled functions [#6148](https://github.com/appwrite/appwrite/pull/6148) +* Update the error message for router_domain_not_configured [#6145](https://github.com/appwrite/appwrite/pull/6145) +* Fix _APP_EXECUTOR_HOST for upgrades [#6141](https://github.com/appwrite/appwrite/pull/6141) +* Change executor hostname back to appwrite-executor [#6160](https://github.com/appwrite/appwrite/pull/6160) +* Fix create execution request filter from previous SDK version [#6146](https://github.com/appwrite/appwrite/pull/6146) +* Make URL optional for Create Membership API and Serverside Requests [#6157](https://github.com/appwrite/appwrite/pull/6157) * Support for v2 functions [#6142](https://github.com/appwrite/appwrite/pull/6142) -* Fix migrations worker by @abnegate in https://github.com/appwrite/appwrite/pull/6116 +* Fix migrations worker [#6116](https://github.com/appwrite/appwrite/pull/6116) * Fix: Global variables by [#6150](https://github.com/appwrite/appwrite/pull/6150) -* Fix webhook secret validation and executor path validation by @vermakhushboo in https://github.com/appwrite/appwrite/pull/6162 -* Fix: Untrusted custom domains + auto-ssl by @Meldiron in https://github.com/appwrite/appwrite/pull/6155 +* Fix webhook secret validation and executor path validation [#6162](https://github.com/appwrite/appwrite/pull/6162) +* Fix: Untrusted custom domains + auto-ssl [#6155](https://github.com/appwrite/appwrite/pull/6155) # Version 1.4.1 From a1aa51aa2fa5d8d1cdc74e85f0d9ef7e54cdefdd Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 6 Sep 2023 21:14:03 +0000 Subject: [PATCH 05/16] chore: downgrade database versiong --- composer.json | 2 +- composer.lock | 153 ++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 112 insertions(+), 43 deletions(-) diff --git a/composer.json b/composer.json index fba885f951..76f815a5a7 100644 --- a/composer.json +++ b/composer.json @@ -49,7 +49,7 @@ "utopia-php/cache": "0.8.*", "utopia-php/cli": "0.15.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "0.43.*", + "utopia-php/database": "0.43.0", "utopia-php/domains": "0.3.*", "utopia-php/dsn": "0.1.*", "utopia-php/framework": "0.31.0", diff --git a/composer.lock b/composer.lock index efbaa7cde6..e26897e903 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "bc47430e5cb3430f354b4eee6fd8c9c7", + "content-hash": "d165291f1be92644ba081f9c39050602", "packages": [ { "name": "adhocore/jwt", @@ -386,6 +386,79 @@ }, "time": "2023-04-18T15:34:23+00:00" }, + { + "name": "composer/package-versions-deprecated", + "version": "1.11.99.5", + "source": { + "type": "git", + "url": "https://github.com/composer/package-versions-deprecated.git", + "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b4f54f74ef3453349c24a845d22392cd31e65f1d", + "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.1.0 || ^2.0", + "php": "^7 || ^8" + }, + "replace": { + "ocramius/package-versions": "1.11.99" + }, + "require-dev": { + "composer/composer": "^1.9.3 || ^2.0@dev", + "ext-zip": "^1.13", + "phpunit/phpunit": "^6.5 || ^7" + }, + "type": "composer-plugin", + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "PackageVersions\\": "src/PackageVersions" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" + } + ], + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "support": { + "issues": "https://github.com/composer/package-versions-deprecated/issues", + "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.5" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-01-17T14:14:24+00:00" + }, { "name": "dragonmantank/cron-expression", "version": "v3.3.2", @@ -841,28 +914,24 @@ }, { "name": "jean85/pretty-package-versions", - "version": "2.0.5", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/Jean85/pretty-package-versions.git", - "reference": "ae547e455a3d8babd07b96966b17d7fd21d9c6af" + "reference": "1e0104b46f045868f11942aea058cd7186d6c303" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/ae547e455a3d8babd07b96966b17d7fd21d9c6af", - "reference": "ae547e455a3d8babd07b96966b17d7fd21d9c6af", + "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/1e0104b46f045868f11942aea058cd7186d6c303", + "reference": "1e0104b46f045868f11942aea058cd7186d6c303", "shasum": "" }, "require": { - "composer-runtime-api": "^2.0.0", - "php": "^7.1|^8.0" + "composer/package-versions-deprecated": "^1.8.0", + "php": "^7.0|^8.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.17", - "jean85/composer-provided-replaced-stub-package": "^1.0", - "phpstan/phpstan": "^0.12.66", - "phpunit/phpunit": "^7.5|^8.5|^9.4", - "vimeo/psalm": "^4.3" + "phpunit/phpunit": "^6.0|^8.5|^9.2" }, "type": "library", "extra": { @@ -885,7 +954,7 @@ "email": "alessandro.lai85@gmail.com" } ], - "description": "A library to get pretty versions strings of installed dependencies", + "description": "A wrapper for ocramius/package-versions to get pretty versions strings", "keywords": [ "composer", "package", @@ -894,9 +963,9 @@ ], "support": { "issues": "https://github.com/Jean85/pretty-package-versions/issues", - "source": "https://github.com/Jean85/pretty-package-versions/tree/2.0.5" + "source": "https://github.com/Jean85/pretty-package-versions/tree/1.6.0" }, - "time": "2021-10-08T21:21:46+00:00" + "time": "2021-02-04T16:20:16+00:00" }, { "name": "laravel/pint", @@ -1119,35 +1188,34 @@ }, { "name": "mongodb/mongodb", - "version": "1.10.0", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/mongodb/mongo-php-library.git", - "reference": "b0bbd657f84219212487d01a8ffe93a789e1e488" + "reference": "953dbc19443aa9314c44b7217a16873347e6840d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/b0bbd657f84219212487d01a8ffe93a789e1e488", - "reference": "b0bbd657f84219212487d01a8ffe93a789e1e488", + "url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/953dbc19443aa9314c44b7217a16873347e6840d", + "reference": "953dbc19443aa9314c44b7217a16873347e6840d", "shasum": "" }, "require": { "ext-hash": "*", "ext-json": "*", - "ext-mongodb": "^1.11.0", - "jean85/pretty-package-versions": "^1.2 || ^2.0.1", - "php": "^7.1 || ^8.0", + "ext-mongodb": "^1.8.1", + "jean85/pretty-package-versions": "^1.2", + "php": "^7.0 || ^8.0", "symfony/polyfill-php80": "^1.19" }, "require-dev": { - "doctrine/coding-standard": "^9.0", - "squizlabs/php_codesniffer": "^3.6", - "symfony/phpunit-bridge": "^5.2" + "squizlabs/php_codesniffer": "^3.5, <3.5.5", + "symfony/phpunit-bridge": "5.x-dev" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.10.x-dev" + "dev-master": "1.8.x-dev" } }, "autoload": { @@ -1182,9 +1250,9 @@ ], "support": { "issues": "https://github.com/mongodb/mongo-php-library/issues", - "source": "https://github.com/mongodb/mongo-php-library/tree/1.10.0" + "source": "https://github.com/mongodb/mongo-php-library/tree/1.8.0" }, - "time": "2021-10-20T22:22:37+00:00" + "time": "2020-11-25T12:26:02+00:00" }, { "name": "mustangostang/spyc", @@ -2152,16 +2220,16 @@ }, { "name": "utopia-php/database", - "version": "0.43.1", + "version": "0.43.0", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "cc0247f4f0c402b39f663bf9f77b29d69b95f9d6" + "reference": "fb96fc6c94d5efcd43913c34bece62daba76a5e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/cc0247f4f0c402b39f663bf9f77b29d69b95f9d6", - "reference": "cc0247f4f0c402b39f663bf9f77b29d69b95f9d6", + "url": "https://api.github.com/repos/utopia-php/database/zipball/fb96fc6c94d5efcd43913c34bece62daba76a5e9", + "reference": "fb96fc6c94d5efcd43913c34bece62daba76a5e9", "shasum": "" }, "require": { @@ -2170,11 +2238,12 @@ "php": ">=8.0", "utopia-php/cache": "0.8.*", "utopia-php/framework": "0.*.*", - "utopia-php/mongo": "0.3.*" + "utopia-php/mongo": "0.2.*" }, "require-dev": { "fakerphp/faker": "^1.14", "laravel/pint": "1.4.*", + "mongodb/mongodb": "1.8.0", "pcov/clobber": "^2.0", "phpstan/phpstan": "1.10.*", "phpunit/phpunit": "^9.4", @@ -2202,9 +2271,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.43.1" + "source": "https://github.com/utopia-php/database/tree/0.43.0" }, - "time": "2023-09-01T20:38:36+00:00" + "time": "2023-08-29T10:18:39+00:00" }, { "name": "utopia-php/domains", @@ -2622,21 +2691,21 @@ }, { "name": "utopia-php/mongo", - "version": "0.3.1", + "version": "0.2.0", "source": { "type": "git", "url": "https://github.com/utopia-php/mongo.git", - "reference": "52326a9a43e2d27ff0c15c48ba746dacbe9a7aee" + "reference": "b6dfb31b93c07c59b8bbd62a3b52e3b97a407c09" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/mongo/zipball/52326a9a43e2d27ff0c15c48ba746dacbe9a7aee", - "reference": "52326a9a43e2d27ff0c15c48ba746dacbe9a7aee", + "url": "https://api.github.com/repos/utopia-php/mongo/zipball/b6dfb31b93c07c59b8bbd62a3b52e3b97a407c09", + "reference": "b6dfb31b93c07c59b8bbd62a3b52e3b97a407c09", "shasum": "" }, "require": { "ext-mongodb": "*", - "mongodb/mongodb": "1.10.0", + "mongodb/mongodb": "1.8.0", "php": ">=8.0" }, "require-dev": { @@ -2676,9 +2745,9 @@ ], "support": { "issues": "https://github.com/utopia-php/mongo/issues", - "source": "https://github.com/utopia-php/mongo/tree/0.3.1" + "source": "https://github.com/utopia-php/mongo/tree/0.2.0" }, - "time": "2023-09-01T17:25:28+00:00" + "time": "2023-03-22T10:44:29+00:00" }, { "name": "utopia-php/orchestration", From 1a0054890df09d8522963ac78864642e9fcc9340 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 6 Sep 2023 22:02:14 +0000 Subject: [PATCH 06/16] chore: bug fix with scopes --- app/config/roles.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/roles.php b/app/config/roles.php index 41c313ff33..444b478d2a 100644 --- a/app/config/roles.php +++ b/app/config/roles.php @@ -95,6 +95,6 @@ return [ ], Auth::USER_ROLE_APPS => [ 'label' => 'Applications', - 'scopes' => ['global', 'health.read', 'graphql'], + 'scopes' => ['public', 'health.read', 'graphql'], ], ]; From d96a6d7883546306de3f3a6032637926e5d2728e Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 6 Sep 2023 18:06:31 -0400 Subject: [PATCH 07/16] Apply suggestions from code review Co-authored-by: Steven Nguyen <1477010+stnguyen90@users.noreply.github.com> --- src/Appwrite/Migration/Version/V19.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index 5abf91ed62..ccdcd28f44 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -651,9 +651,9 @@ class V19 extends Migration switch ($document->getCollection()) { case 'attributes': case 'indexes': - $status = $document->getAttribute('status', $document->getAttribute('status', '')); + $status = $document->getAttribute('status'); if ($status === 'failed') { - $document->setAttribute('error', 'Unknown problem'); + $document->setAttribute('error', $document->getAttribute('error', 'Unknown problem')); } break; case 'builds': From c439202d3caa873e4c1114e2dc8da9ceeeca769d Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 6 Sep 2023 22:08:26 +0000 Subject: [PATCH 08/16] chore: review comments --- CHANGES.md | 17 ++++++++------- src/Appwrite/Migration/Version/V19.php | 29 ++++++++++++++------------ 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 01b505ab71..6f0543254a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,23 +2,24 @@ ## Fixes -## Changes - - Fix create phone session abuse key [#6134][https://github.com/appwrite/appwrite/pull/6134] - Fix CLI backwards compatibility [#6125](https://github.com/appwrite/appwrite/pull/6125) -* Override forEachDocument() to skip the cache collection [#6144](https://github.com/appwrite/appwrite/pull/6144) * Fix Not Found error when deploying function from git [#6133](https://github.com/appwrite/appwrite/pull/6133) -* Add required params for scheduled functions [#6148](https://github.com/appwrite/appwrite/pull/6148) -* Update the error message for router_domain_not_configured [#6145](https://github.com/appwrite/appwrite/pull/6145) * Fix _APP_EXECUTOR_HOST for upgrades [#6141](https://github.com/appwrite/appwrite/pull/6141) -* Change executor hostname back to appwrite-executor [#6160](https://github.com/appwrite/appwrite/pull/6160) * Fix create execution request filter from previous SDK version [#6146](https://github.com/appwrite/appwrite/pull/6146) -* Make URL optional for Create Membership API and Serverside Requests [#6157](https://github.com/appwrite/appwrite/pull/6157) -* Support for v2 functions [#6142](https://github.com/appwrite/appwrite/pull/6142) * Fix migrations worker [#6116](https://github.com/appwrite/appwrite/pull/6116) * Fix: Global variables by [#6150](https://github.com/appwrite/appwrite/pull/6150) * Fix webhook secret validation and executor path validation [#6162](https://github.com/appwrite/appwrite/pull/6162) * Fix: Untrusted custom domains + auto-ssl [#6155](https://github.com/appwrite/appwrite/pull/6155) +* Fix: AI Assistant [#6153](https://github.com/appwrite/appwrite/pull/6153) + +## Changes +* Add required params for scheduled functions [#6148](https://github.com/appwrite/appwrite/pull/6148) +* Update the error message for router_domain_not_configured [#6145](https://github.com/appwrite/appwrite/pull/6145) +* Override forEachDocument() to skip the cache collection [#6144](https://github.com/appwrite/appwrite/pull/6144) +* Support for v2 functions [#6142](https://github.com/appwrite/appwrite/pull/6142) +* Change executor hostname back to appwrite-executor [#6160](https://github.com/appwrite/appwrite/pull/6160) +* Make URL optional for Create Membership API and Serverside Requests [#6157](https://github.com/appwrite/appwrite/pull/6157) # Version 1.4.1 diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index 5abf91ed62..1310d11496 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -707,19 +707,22 @@ class V19 extends Migration $commands = $this->getFunctionCommands($document); $document->setAttribute('commands', $document->getAttribute('commands', $commands)); - $schedule = $this->consoleDB->createDocument('schedules', new Document([ - 'region' => App::getEnv('_APP_REGION', 'default'), // Todo replace with projects region - 'resourceType' => 'function', - 'resourceId' => $document->getId(), - 'resourceInternalId' => $document->getInternalId(), - 'resourceUpdatedAt' => DateTime::now(), - 'projectId' => $this->project->getId(), - 'schedule' => $document->getAttribute('schedule'), - 'active' => !empty($document->getAttribute('schedule')) && !empty($document->getAttribute('deployment')), - ])); - - $document->setAttribute('scheduleId', $schedule->getId()); - $document->setAttribute('scheduleInternalId', $schedule->getInternalId()); + if ($document->getAttribute('schedule') && !$document->getAttribute('scheduleId', null)) { + $schedule = $this->consoleDB->createDocument('schedules', new Document([ + 'region' => App::getEnv('_APP_REGION', 'default'), // Todo replace with projects region + 'resourceType' => 'function', + 'resourceId' => $document->getId(), + 'resourceInternalId' => $document->getInternalId(), + 'resourceUpdatedAt' => DateTime::now(), + 'projectId' => $this->project->getId(), + 'schedule' => $document->getAttribute('schedule'), + 'active' => !empty($document->getAttribute('schedule')) && !empty($document->getAttribute('deployment')), + ])); + + $document->setAttribute('scheduleId', $schedule->getId()); + $document->setAttribute('scheduleInternalId', $schedule->getInternalId()); + } + break; case 'projects': $document->setAttribute('version', '1.4.0'); From 732a2b4a98310f982fcf29d600e18c043009fa70 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 6 Sep 2023 22:10:43 +0000 Subject: [PATCH 09/16] chore: linter --- src/Appwrite/Migration/Version/V19.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index abce72912c..0df5b8a4d3 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -718,11 +718,11 @@ class V19 extends Migration 'schedule' => $document->getAttribute('schedule'), 'active' => !empty($document->getAttribute('schedule')) && !empty($document->getAttribute('deployment')), ])); - + $document->setAttribute('scheduleId', $schedule->getId()); $document->setAttribute('scheduleInternalId', $schedule->getInternalId()); } - + break; case 'projects': $document->setAttribute('version', '1.4.0'); From 4b31411a5f9a3cb0200bce1c85af67e4d6a23dcb Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 6 Sep 2023 23:04:44 +0000 Subject: [PATCH 10/16] fix: remove public scope from app role --- app/config/roles.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/roles.php b/app/config/roles.php index 444b478d2a..04ee7bb29f 100644 --- a/app/config/roles.php +++ b/app/config/roles.php @@ -95,6 +95,6 @@ return [ ], Auth::USER_ROLE_APPS => [ 'label' => 'Applications', - 'scopes' => ['public', 'health.read', 'graphql'], + 'scopes' => ['health.read', 'graphql'], ], ]; From 329889e3172a6a843cf95cd00739934e360a2c19 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 6 Sep 2023 23:15:15 +0000 Subject: [PATCH 11/16] chore: add runtime versions variable --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 326bd62e00..d9ea0f5ddf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -714,6 +714,7 @@ services: - OPR_EXECUTOR_ENV=$_APP_ENV - OPR_EXECUTOR_RUNTIMES=$_APP_FUNCTIONS_RUNTIMES - OPR_EXECUTOR_SECRET=$_APP_EXECUTOR_SECRET + - OPR_EXECUTOR_RUNTIME_VERSIONS=v2,v3 - OPR_EXECUTOR_LOGGING_PROVIDER=$_APP_LOGGING_PROVIDER - OPR_EXECUTOR_LOGGING_CONFIG=$_APP_LOGGING_CONFIG - OPR_EXECUTOR_STORAGE_DEVICE=$_APP_STORAGE_DEVICE From 438e7b66d14ac8b02c89e54b536a99600788183c Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 6 Sep 2023 23:32:42 +0000 Subject: [PATCH 12/16] chore: only fetch required runtimes --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 6ef35b57c1..189095e9e5 100644 --- a/.env +++ b/.env @@ -71,7 +71,7 @@ _APP_FUNCTIONS_MAINTENANCE_INTERVAL=600 _APP_FUNCTIONS_RUNTIMES_NETWORK=runtimes _APP_EXECUTOR_SECRET=your-secret-key _APP_EXECUTOR_HOST=http://proxy/v1 -_APP_FUNCTIONS_RUNTIMES= +_APP_FUNCTIONS_RUNTIMES=php-8.0,node-18.0,python-3.9,ruby-3.1 _APP_MAINTENANCE_INTERVAL=86400 _APP_MAINTENANCE_RETENTION_CACHE=2592000 _APP_MAINTENANCE_RETENTION_EXECUTION=1209600 From b9675f736bd3a25db9560e008ae7585666eb0db2 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 6 Sep 2023 23:32:49 -0400 Subject: [PATCH 13/16] Update src/Appwrite/Migration/Version/V19.php Co-authored-by: Steven Nguyen <1477010+stnguyen90@users.noreply.github.com> --- src/Appwrite/Migration/Version/V19.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index 0df5b8a4d3..b9ccf3c302 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -707,7 +707,7 @@ class V19 extends Migration $commands = $this->getFunctionCommands($document); $document->setAttribute('commands', $document->getAttribute('commands', $commands)); - if ($document->getAttribute('schedule') && !$document->getAttribute('scheduleId', null)) { + if (empty($document->getAttribute('scheduleId', null))) { $schedule = $this->consoleDB->createDocument('schedules', new Document([ 'region' => App::getEnv('_APP_REGION', 'default'), // Todo replace with projects region 'resourceType' => 'function', From 47427972bf020a54c740a401a0d354922df366be Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Thu, 7 Sep 2023 00:57:23 -0400 Subject: [PATCH 14/16] fix: test failures --- .env | 2 +- app/config/roles.php | 4 +++- app/controllers/general.php | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.env b/.env index 6ef35b57c1..189095e9e5 100644 --- a/.env +++ b/.env @@ -71,7 +71,7 @@ _APP_FUNCTIONS_MAINTENANCE_INTERVAL=600 _APP_FUNCTIONS_RUNTIMES_NETWORK=runtimes _APP_EXECUTOR_SECRET=your-secret-key _APP_EXECUTOR_HOST=http://proxy/v1 -_APP_FUNCTIONS_RUNTIMES= +_APP_FUNCTIONS_RUNTIMES=php-8.0,node-18.0,python-3.9,ruby-3.1 _APP_MAINTENANCE_INTERVAL=86400 _APP_MAINTENANCE_RETENTION_CACHE=2592000 _APP_MAINTENANCE_RETENTION_EXECUTION=1209600 diff --git a/app/config/roles.php b/app/config/roles.php index 444b478d2a..a4f05808fd 100644 --- a/app/config/roles.php +++ b/app/config/roles.php @@ -3,6 +3,7 @@ use Appwrite\Auth\Auth; $member = [ + 'global', 'public', 'home', 'console', @@ -24,6 +25,7 @@ $member = [ ]; $admins = [ + 'global', 'graphql', 'teams.read', 'teams.write', @@ -95,6 +97,6 @@ return [ ], Auth::USER_ROLE_APPS => [ 'label' => 'Applications', - 'scopes' => ['public', 'health.read', 'graphql'], + 'scopes' => ['global', 'health.read', 'graphql'], ], ]; diff --git a/app/controllers/general.php b/app/controllers/general.php index abb39a1b78..d47b863574 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -814,7 +814,7 @@ include_once __DIR__ . '/shared/api/auth.php'; App::wildcard() ->groups(['api']) - ->label('scope', 'public') + ->label('scope', 'global') ->action(function () { throw new AppwriteException(AppwriteException::GENERAL_ROUTE_NOT_FOUND); }); From 713eb68c8a1d637b0edd46530b38e16970733901 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Thu, 7 Sep 2023 01:18:06 -0400 Subject: [PATCH 15/16] fix: test failures --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index d9ea0f5ddf..326bd62e00 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -714,7 +714,6 @@ services: - OPR_EXECUTOR_ENV=$_APP_ENV - OPR_EXECUTOR_RUNTIMES=$_APP_FUNCTIONS_RUNTIMES - OPR_EXECUTOR_SECRET=$_APP_EXECUTOR_SECRET - - OPR_EXECUTOR_RUNTIME_VERSIONS=v2,v3 - OPR_EXECUTOR_LOGGING_PROVIDER=$_APP_LOGGING_PROVIDER - OPR_EXECUTOR_LOGGING_CONFIG=$_APP_LOGGING_CONFIG - OPR_EXECUTOR_STORAGE_DEVICE=$_APP_STORAGE_DEVICE From defe0f2e9fbef03b155e5af2fd0e853d0ae32f97 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Thu, 7 Sep 2023 02:04:36 -0400 Subject: [PATCH 16/16] fix: enable ci trigger --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 326bd62e00..d9ea0f5ddf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -714,6 +714,7 @@ services: - OPR_EXECUTOR_ENV=$_APP_ENV - OPR_EXECUTOR_RUNTIMES=$_APP_FUNCTIONS_RUNTIMES - OPR_EXECUTOR_SECRET=$_APP_EXECUTOR_SECRET + - OPR_EXECUTOR_RUNTIME_VERSIONS=v2,v3 - OPR_EXECUTOR_LOGGING_PROVIDER=$_APP_LOGGING_PROVIDER - OPR_EXECUTOR_LOGGING_CONFIG=$_APP_LOGGING_CONFIG - OPR_EXECUTOR_STORAGE_DEVICE=$_APP_STORAGE_DEVICE