diff --git a/.env b/.env index b9aa42e2f5..e8427cab7c 100644 --- a/.env +++ b/.env @@ -81,8 +81,8 @@ _APP_COMPUTE_RUNTIMES_NETWORK=runtimes _APP_EXECUTOR_SECRET=your-secret-key _APP_EXECUTOR_HOST=http://exc1/v1 _APP_FUNCTIONS_RUNTIMES=php-8.0,node-18.0,python-3.9,ruby-3.1 -_APP_SITES_RUNTIMES=static-1,node-22,flutter-3.24 -_APP_SITES_FRAMEWORKS=sveltekit,nextjs,nuxt,astro,remix,flutter,other,react,vue,analog,angular +_APP_SITES_RUNTIMES=static-1,node-22,flutter-3.29 +_APP_SITES_FRAMEWORKS=sveltekit,nextjs,nuxt,astro,remix,flutter,other,react,vue,analog,angular,vite _APP_MAINTENANCE_INTERVAL=86400 _APP_MAINTENANCE_DELAY= _APP_MAINTENANCE_RETENTION_CACHE=2592000 diff --git a/app/cli.php b/app/cli.php index 360b5478c5..c92d2c2e6d 100644 --- a/app/cli.php +++ b/app/cli.php @@ -26,7 +26,7 @@ use Utopia\Registry\Registry; use Utopia\System\System; // overwriting runtimes to be architectur agnostic for CLI -Config::setParam('runtimes', (new Runtimes('v4rc'))->getAll(supported: false)); +Config::setParam('runtimes', (new Runtimes('v5'))->getAll(supported: false)); // require controllers after overwriting runtimes require_once __DIR__ . '/controllers/general.php'; diff --git a/app/config/collections/projects.php b/app/config/collections/projects.php index 7ea750f2b3..52f7f271a6 100644 --- a/app/config/collections/projects.php +++ b/app/config/collections/projects.php @@ -569,7 +569,7 @@ return [ 'filters' => [], ], [ - '$id' => ID::custom('deployment'), + '$id' => ID::custom('deploymentId'), 'type' => Database::VAR_STRING, 'format' => '', 'size' => Database::LENGTH_KEY, @@ -674,7 +674,7 @@ return [ 'size' => 8, 'signed' => true, 'required' => false, - 'default' => 'v4', + 'default' => 'v5', 'array' => false, 'filters' => [], ], @@ -788,9 +788,9 @@ return [ 'orders' => [Database::ORDER_ASC], ], [ - '$id' => ID::custom('_key_deployment'), + '$id' => ID::custom('_key_deploymentId'), 'type' => Database::INDEX_KEY, - 'attributes' => ['deployment'], + 'attributes' => ['deploymentId'], 'lengths' => [], 'orders' => [Database::ORDER_ASC], ] diff --git a/app/config/frameworks.php b/app/config/frameworks.php index 355ead1bfc..e1b31a28ec 100644 --- a/app/config/frameworks.php +++ b/app/config/frameworks.php @@ -221,7 +221,7 @@ return [ 'flutter' => [ 'key' => 'flutter', 'name' => 'Flutter', - 'buildRuntime' => 'flutter-3.24', + 'buildRuntime' => 'flutter-3.29', 'runtimes' => getVersions($templateRuntimes['FLUTTER']['versions'], 'flutter'), 'adapters' => [ 'static' => [ @@ -233,6 +233,21 @@ return [ ], ], ], + 'vite' => [ + 'key' => 'vite', + 'name' => 'Vite', + 'buildRuntime' => 'node-22', + 'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), + 'adapters' => [ + 'static' => [ + 'key' => 'static', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'outputDirectory' => './dist', + 'startCommand' => 'sh helpers/server.sh', + ], + ] + ], 'other' => [ 'key' => 'other', 'name' => 'Other', diff --git a/app/config/runtimes.php b/app/config/runtimes.php index 4260655342..dbd33dac4b 100644 --- a/app/config/runtimes.php +++ b/app/config/runtimes.php @@ -6,4 +6,4 @@ use Appwrite\Runtimes\Runtimes; -return (new Runtimes('v4rc'))->getAll(); +return (new Runtimes('v5'))->getAll(); diff --git a/app/config/specs/open-api3-latest-client.json b/app/config/specs/open-api3-latest-client.json index 426e85c709..852974b217 100644 --- a/app/config/specs/open-api3-latest-client.json +++ b/app/config/specs/open-api3-latest-client.json @@ -4813,17 +4813,6 @@ "default": [] }, "in": "query" - }, - { - "name": "search", - "description": "Search term to filter your list results. Max length: 256 chars.", - "required": false, - "schema": { - "type": "string", - "x-example": "", - "default": "" - }, - "in": "query" } ] }, diff --git a/app/config/specs/open-api3-latest-console.json b/app/config/specs/open-api3-latest-console.json index f1ea9de50e..32bf94c6c1 100644 --- a/app/config/specs/open-api3-latest-console.json +++ b/app/config/specs/open-api3-latest-console.json @@ -4360,7 +4360,7 @@ "deprecated": false, "demo": "console\/get-resource.md", "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/masterCheck if a resource ID is available.", - "rate-limit": 10, + "rate-limit": 120, "rate-time": 60, "rate-key": "userId:{userId}, url:{url}", "scope": "rules.read", @@ -9082,7 +9082,7 @@ "parameters": [ { "name": "queries", - "description": "Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https:\/\/appwrite.io\/docs\/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deployment, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId", + "description": "Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https:\/\/appwrite.io\/docs\/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId", "required": false, "schema": { "type": "array", @@ -9232,7 +9232,9 @@ "bun-1.1", "go-1.23", "static-1", - "flutter-3.24" + "flutter-3.24", + "flutter-3.27", + "flutter-3.29" ], "x-enum-name": null, "x-enum-keys": [] @@ -9851,7 +9853,9 @@ "bun-1.1", "go-1.23", "static-1", - "flutter-3.24" + "flutter-3.24", + "flutter-3.27", + "flutter-3.29" ], "x-enum-name": null, "x-enum-keys": [] @@ -10894,17 +10898,6 @@ "default": [] }, "in": "query" - }, - { - "name": "search", - "description": "Search term to filter your list results. Max length: 256 chars.", - "required": false, - "schema": { - "type": "string", - "x-example": "", - "default": "" - }, - "in": "query" } ] }, @@ -24718,8 +24711,10 @@ "framework": { "type": "string", "description": "Sites framework.", - "x-example": "nextjs", + "x-example": "analog", "enum": [ + "analog", + "angular", "nextjs", "react", "nuxt", @@ -24728,6 +24723,7 @@ "astro", "remix", "flutter", + "vite", "other" ], "x-enum-name": null, @@ -24823,7 +24819,9 @@ "bun-1.1", "go-1.23", "static-1", - "flutter-3.24" + "flutter-3.24", + "flutter-3.27", + "flutter-3.29" ], "x-enum-name": null, "x-enum-keys": [] @@ -25343,8 +25341,10 @@ "framework": { "type": "string", "description": "Sites framework.", - "x-example": "nextjs", + "x-example": "analog", "enum": [ + "analog", + "angular", "nextjs", "react", "nuxt", @@ -25353,6 +25353,7 @@ "astro", "remix", "flutter", + "vite", "other" ], "x-enum-name": null, @@ -25448,7 +25449,9 @@ "bun-1.1", "go-1.23", "static-1", - "flutter-3.24" + "flutter-3.24", + "flutter-3.27", + "flutter-3.29" ], "x-enum-name": null, "x-enum-keys": [] @@ -26447,17 +26450,6 @@ "default": [] }, "in": "query" - }, - { - "name": "search", - "description": "Search term to filter your list results. Max length: 256 chars.", - "required": false, - "schema": { - "type": "string", - "x-example": "", - "default": "" - }, - "in": "query" } ] } @@ -37187,7 +37179,7 @@ "description": "Function execution and build runtime.", "x-example": "python-3.8" }, - "deployment": { + "deploymentId": { "type": "string", "description": "Function's active deployment ID.", "x-example": "5e5ea5c16897e" @@ -37283,7 +37275,7 @@ "live", "logging", "runtime", - "deployment", + "deploymentId", "scopes", "vars", "events", diff --git a/app/config/specs/open-api3-latest-server.json b/app/config/specs/open-api3-latest-server.json index e524c0c8a7..84179be2cd 100644 --- a/app/config/specs/open-api3-latest-server.json +++ b/app/config/specs/open-api3-latest-server.json @@ -8168,7 +8168,7 @@ "parameters": [ { "name": "queries", - "description": "Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https:\/\/appwrite.io\/docs\/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deployment, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId", + "description": "Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https:\/\/appwrite.io\/docs\/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId", "required": false, "schema": { "type": "array", @@ -8319,7 +8319,9 @@ "bun-1.1", "go-1.23", "static-1", - "flutter-3.24" + "flutter-3.24", + "flutter-3.27", + "flutter-3.29" ], "x-enum-name": null, "x-enum-keys": [] @@ -8713,7 +8715,9 @@ "bun-1.1", "go-1.23", "static-1", - "flutter-3.24" + "flutter-3.24", + "flutter-3.27", + "flutter-3.29" ], "x-enum-name": null, "x-enum-keys": [] @@ -9769,17 +9773,6 @@ "default": [] }, "in": "query" - }, - { - "name": "search", - "description": "Search term to filter your list results. Max length: 256 chars.", - "required": false, - "schema": { - "type": "string", - "x-example": "", - "default": "" - }, - "in": "query" } ] }, @@ -16815,8 +16808,10 @@ "framework": { "type": "string", "description": "Sites framework.", - "x-example": "nextjs", + "x-example": "analog", "enum": [ + "analog", + "angular", "nextjs", "react", "nuxt", @@ -16825,6 +16820,7 @@ "astro", "remix", "flutter", + "vite", "other" ], "x-enum-name": null, @@ -16920,7 +16916,9 @@ "bun-1.1", "go-1.23", "static-1", - "flutter-3.24" + "flutter-3.24", + "flutter-3.27", + "flutter-3.29" ], "x-enum-name": null, "x-enum-keys": [] @@ -17215,8 +17213,10 @@ "framework": { "type": "string", "description": "Sites framework.", - "x-example": "nextjs", + "x-example": "analog", "enum": [ + "analog", + "angular", "nextjs", "react", "nuxt", @@ -17225,6 +17225,7 @@ "astro", "remix", "flutter", + "vite", "other" ], "x-enum-name": null, @@ -17320,7 +17321,9 @@ "bun-1.1", "go-1.23", "static-1", - "flutter-3.24" + "flutter-3.24", + "flutter-3.27", + "flutter-3.29" ], "x-enum-name": null, "x-enum-keys": [] @@ -18331,17 +18334,6 @@ "default": [] }, "in": "query" - }, - { - "name": "search", - "description": "Search term to filter your list results. Max length: 256 chars.", - "required": false, - "schema": { - "type": "string", - "x-example": "", - "default": "" - }, - "in": "query" } ] } @@ -27584,7 +27576,7 @@ "description": "Function execution and build runtime.", "x-example": "python-3.8" }, - "deployment": { + "deploymentId": { "type": "string", "description": "Function's active deployment ID.", "x-example": "5e5ea5c16897e" @@ -27680,7 +27672,7 @@ "live", "logging", "runtime", - "deployment", + "deploymentId", "scopes", "vars", "events", diff --git a/app/config/specs/swagger2-latest-client.json b/app/config/specs/swagger2-latest-client.json index c419af3260..ce79f11758 100644 --- a/app/config/specs/swagger2-latest-client.json +++ b/app/config/specs/swagger2-latest-client.json @@ -4976,15 +4976,6 @@ }, "default": [], "in": "query" - }, - { - "name": "search", - "description": "Search term to filter your list results. Max length: 256 chars.", - "required": false, - "type": "string", - "x-example": "", - "default": "", - "in": "query" } ] }, diff --git a/app/config/specs/swagger2-latest-console.json b/app/config/specs/swagger2-latest-console.json index d1ff74f8cf..4eec95c22d 100644 --- a/app/config/specs/swagger2-latest-console.json +++ b/app/config/specs/swagger2-latest-console.json @@ -4569,7 +4569,7 @@ "deprecated": false, "demo": "console\/get-resource.md", "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/masterCheck if a resource ID is available.", - "rate-limit": 10, + "rate-limit": 120, "rate-time": 60, "rate-key": "userId:{userId}, url:{url}", "scope": "rules.read", @@ -9231,7 +9231,7 @@ "parameters": [ { "name": "queries", - "description": "Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https:\/\/appwrite.io\/docs\/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deployment, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId", + "description": "Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https:\/\/appwrite.io\/docs\/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId", "required": false, "type": "array", "collectionFormat": "multi", @@ -9384,7 +9384,9 @@ "bun-1.1", "go-1.23", "static-1", - "flutter-3.24" + "flutter-3.24", + "flutter-3.27", + "flutter-3.29" ], "x-enum-name": null, "x-enum-keys": [] @@ -10018,7 +10020,9 @@ "bun-1.1", "go-1.23", "static-1", - "flutter-3.24" + "flutter-3.24", + "flutter-3.27", + "flutter-3.29" ], "x-enum-name": null, "x-enum-keys": [] @@ -11071,15 +11075,6 @@ }, "default": [], "in": "query" - }, - { - "name": "search", - "description": "Search term to filter your list results. Max length: 256 chars.", - "required": false, - "type": "string", - "x-example": "", - "default": "", - "in": "query" } ] }, @@ -25219,8 +25214,10 @@ "type": "string", "description": "Sites framework.", "default": null, - "x-example": "nextjs", + "x-example": "analog", "enum": [ + "analog", + "angular", "nextjs", "react", "nuxt", @@ -25229,6 +25226,7 @@ "astro", "remix", "flutter", + "vite", "other" ], "x-enum-name": null, @@ -25330,7 +25328,9 @@ "bun-1.1", "go-1.23", "static-1", - "flutter-3.24" + "flutter-3.24", + "flutter-3.27", + "flutter-3.29" ], "x-enum-name": null, "x-enum-keys": [] @@ -25858,8 +25858,10 @@ "type": "string", "description": "Sites framework.", "default": null, - "x-example": "nextjs", + "x-example": "analog", "enum": [ + "analog", + "angular", "nextjs", "react", "nuxt", @@ -25868,6 +25870,7 @@ "astro", "remix", "flutter", + "vite", "other" ], "x-enum-name": null, @@ -25969,7 +25972,9 @@ "bun-1.1", "go-1.23", "static-1", - "flutter-3.24" + "flutter-3.24", + "flutter-3.27", + "flutter-3.29" ], "x-enum-name": null, "x-enum-keys": [] @@ -26976,15 +26981,6 @@ }, "default": [], "in": "query" - }, - { - "name": "search", - "description": "Search term to filter your list results. Max length: 256 chars.", - "required": false, - "type": "string", - "x-example": "", - "default": "", - "in": "query" } ] } @@ -37766,7 +37762,7 @@ "description": "Function execution and build runtime.", "x-example": "python-3.8" }, - "deployment": { + "deploymentId": { "type": "string", "description": "Function's active deployment ID.", "x-example": "5e5ea5c16897e" @@ -37863,7 +37859,7 @@ "live", "logging", "runtime", - "deployment", + "deploymentId", "scopes", "vars", "events", diff --git a/app/config/specs/swagger2-latest-server.json b/app/config/specs/swagger2-latest-server.json index bb49b13792..74bf68b1df 100644 --- a/app/config/specs/swagger2-latest-server.json +++ b/app/config/specs/swagger2-latest-server.json @@ -8314,7 +8314,7 @@ "parameters": [ { "name": "queries", - "description": "Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https:\/\/appwrite.io\/docs\/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deployment, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId", + "description": "Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https:\/\/appwrite.io\/docs\/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId", "required": false, "type": "array", "collectionFormat": "multi", @@ -8468,7 +8468,9 @@ "bun-1.1", "go-1.23", "static-1", - "flutter-3.24" + "flutter-3.24", + "flutter-3.27", + "flutter-3.29" ], "x-enum-name": null, "x-enum-keys": [] @@ -8881,7 +8883,9 @@ "bun-1.1", "go-1.23", "static-1", - "flutter-3.24" + "flutter-3.24", + "flutter-3.27", + "flutter-3.29" ], "x-enum-name": null, "x-enum-keys": [] @@ -9947,15 +9951,6 @@ }, "default": [], "in": "query" - }, - { - "name": "search", - "description": "Search term to filter your list results. Max length: 256 chars.", - "required": false, - "type": "string", - "x-example": "", - "default": "", - "in": "query" } ] }, @@ -17282,8 +17277,10 @@ "type": "string", "description": "Sites framework.", "default": null, - "x-example": "nextjs", + "x-example": "analog", "enum": [ + "analog", + "angular", "nextjs", "react", "nuxt", @@ -17292,6 +17289,7 @@ "astro", "remix", "flutter", + "vite", "other" ], "x-enum-name": null, @@ -17393,7 +17391,9 @@ "bun-1.1", "go-1.23", "static-1", - "flutter-3.24" + "flutter-3.24", + "flutter-3.27", + "flutter-3.29" ], "x-enum-name": null, "x-enum-keys": [] @@ -17700,8 +17700,10 @@ "type": "string", "description": "Sites framework.", "default": null, - "x-example": "nextjs", + "x-example": "analog", "enum": [ + "analog", + "angular", "nextjs", "react", "nuxt", @@ -17710,6 +17712,7 @@ "astro", "remix", "flutter", + "vite", "other" ], "x-enum-name": null, @@ -17811,7 +17814,9 @@ "bun-1.1", "go-1.23", "static-1", - "flutter-3.24" + "flutter-3.24", + "flutter-3.27", + "flutter-3.29" ], "x-enum-name": null, "x-enum-keys": [] @@ -18830,15 +18835,6 @@ }, "default": [], "in": "query" - }, - { - "name": "search", - "description": "Search term to filter your list results. Max length: 256 chars.", - "required": false, - "type": "string", - "x-example": "", - "default": "", - "in": "query" } ] } @@ -28132,7 +28128,7 @@ "description": "Function execution and build runtime.", "x-example": "python-3.8" }, - "deployment": { + "deploymentId": { "type": "string", "description": "Function's active deployment ID.", "x-example": "5e5ea5c16897e" @@ -28229,7 +28225,7 @@ "live", "logging", "runtime", - "deployment", + "deploymentId", "scopes", "vars", "events", diff --git a/app/config/templates/site.php b/app/config/templates/site.php index 9954af2bbb..e90b27d97e 100644 --- a/app/config/templates/site.php +++ b/app/config/templates/site.php @@ -73,7 +73,7 @@ const TEMPLATE_FRAMEWORKS = [ 'installCommand' => '', 'buildCommand' => 'flutter build web', 'outputDirectory' => './build/web', - 'buildRuntime' => 'flutter-3.24', + 'buildRuntime' => 'flutter-3.29', 'adapter' => 'static', 'fallbackFile' => '', ], @@ -86,6 +86,15 @@ const TEMPLATE_FRAMEWORKS = [ 'adapter' => 'static', 'fallbackFile' => 'index.html', ], + 'VITE' => [ + 'key' => 'vite', + 'name' => 'Vite', + 'installCommand' => 'npm install', + 'buildCommand' => 'npm run build', + 'buildRuntime' => 'node-22', + 'adapter' => 'static', + 'outputDirectory' => './dist', + ], 'REACT' => [ 'key' => 'react', 'name' => 'React', @@ -145,6 +154,49 @@ return [ 'providerVersion' => '0.1.*', 'variables' => [] ], + [ + 'key' => 'starter-for-flutter', + 'name' => 'Flutter starter', + 'useCases' => ['starter'], + 'screenshotDark' => $url . '/images/sites/templates/starter-for-flutter-dark.png', + 'screenshotLight' => $url . '/images/sites/templates/starter-for-flutter-light.png', + 'frameworks' => [ + getFramework('FLUTTER', [ + 'providerRootDirectory' => './', + 'buildCommand' => 'sh build.sh', + ]), + ], + 'vcsProvider' => 'github', + 'providerRepositoryId' => 'starter-for-flutter', + 'providerOwner' => 'appwrite', + 'providerVersion' => '0.1.*', + 'variables' => [ + [ + 'name' => 'APPWRITE_PUBLIC_ENDPOINT', + 'description' => 'Endpoint of Appwrite server', + 'value' => '{apiEndpoint}', + 'placeholder' => '{apiEndpoint}', + 'required' => true, + 'type' => 'text' + ], + [ + 'name' => 'APPWRITE_PROJECT_ID', + 'description' => 'Your Appwrite project ID', + 'value' => '{projectId}', + 'placeholder' => '{projectId}', + 'required' => true, + 'type' => 'text' + ], + [ + 'name' => 'APPWRITE_PROJECT_NAME', + 'description' => 'Your Appwrite project name', + 'value' => '{projectName}', + 'placeholder' => '{projectName}', + 'required' => true, + 'type' => 'text' + ], + ] + ], [ 'key' => 'starter-for-js', 'name' => 'JavaScript starter', @@ -152,11 +204,8 @@ return [ 'screenshotDark' => $url . '/images/sites/templates/starter-for-js-dark.png', 'screenshotLight' => $url . '/images/sites/templates/starter-for-js-light.png', 'frameworks' => [ - getFramework('OTHER', [ - 'installCommand' => 'npm install', - 'buildCommand' => 'npm run build', + getFramework('VITE', [ 'providerRootDirectory' => './', - 'outputDirectory' => './dist', ]), ], 'vcsProvider' => 'github', diff --git a/app/controllers/general.php b/app/controllers/general.php index f28409567e..81edd1445b 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -20,10 +20,12 @@ use Appwrite\Utopia\Request; use Appwrite\Utopia\Request\Filters\V16 as RequestV16; use Appwrite\Utopia\Request\Filters\V17 as RequestV17; use Appwrite\Utopia\Request\Filters\V18 as RequestV18; +use Appwrite\Utopia\Request\Filters\V19 as RequestV19; use Appwrite\Utopia\Response; use Appwrite\Utopia\Response\Filters\V16 as ResponseV16; use Appwrite\Utopia\Response\Filters\V17 as ResponseV17; use Appwrite\Utopia\Response\Filters\V18 as ResponseV18; +use Appwrite\Utopia\Response\Filters\V19 as ResponseV19; use Appwrite\Utopia\View; use Executor\Executor; use MaxMind\Db\Reader; @@ -245,7 +247,7 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw $version = match ($type) { 'function' => $resource->getAttribute('version', 'v2'), - 'site' => 'v4', + 'site' => 'v5', }; $runtimes = Config::getParam($version === 'v2' ? 'runtimes-v2' : 'runtimes', []); @@ -416,7 +418,7 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw try { $version = match ($type) { 'function' => $resource->getAttribute('version', 'v2'), - 'site' => 'v4', + 'site' => 'v5', }; $entrypoint = match ($type) { 'function' => $deployment->getAttribute('entrypoint', ''), @@ -689,6 +691,9 @@ App::init() if (version_compare($requestFormat, '1.6.0', '<')) { $request->addFilter(new RequestV18()); } + if (version_compare($requestFormat, '1.7.0', '<')) { + $request->addFilter(new RequestV19()); + } } $domain = $request->getHostname(); @@ -838,6 +843,9 @@ App::init() if (version_compare($responseFormat, '1.6.0', '<')) { $response->addFilter(new ResponseV18()); } + if (version_compare($responseFormat, '1.7.0', '<')) { + $response->addFilter(new ResponseV19()); + } if (version_compare($responseFormat, APP_VERSION_STABLE, '>')) { $response->addHeader('X-Appwrite-Warning', "The current SDK is built for Appwrite " . $responseFormat . ". However, the current Appwrite server version is " . APP_VERSION_STABLE . ". Please downgrade your SDK to match the Appwrite version: https://appwrite.io/docs/sdks"); } diff --git a/composer.lock b/composer.lock index 4fc58cf873..da69c2bb0b 100644 --- a/composer.lock +++ b/composer.lock @@ -157,16 +157,16 @@ }, { "name": "appwrite/php-runtimes", - "version": "0.18.0", + "version": "0.18.1", "source": { "type": "git", "url": "https://github.com/appwrite/runtimes.git", - "reference": "f1ddcc567325659ad79506bc9684a4fc2009dc42" + "reference": "97b5d97ae2c0fc9a2a374769eadff024f95783aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/runtimes/zipball/f1ddcc567325659ad79506bc9684a4fc2009dc42", - "reference": "f1ddcc567325659ad79506bc9684a4fc2009dc42", + "url": "https://api.github.com/repos/appwrite/runtimes/zipball/97b5d97ae2c0fc9a2a374769eadff024f95783aa", + "reference": "97b5d97ae2c0fc9a2a374769eadff024f95783aa", "shasum": "" }, "require": { @@ -206,9 +206,9 @@ ], "support": { "issues": "https://github.com/appwrite/runtimes/issues", - "source": "https://github.com/appwrite/runtimes/tree/0.18.0" + "source": "https://github.com/appwrite/runtimes/tree/0.18.1" }, - "time": "2025-03-07T14:30:31+00:00" + "time": "2025-03-11T14:05:46+00:00" }, { "name": "beberlei/assert", @@ -5085,16 +5085,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "0.40.2", + "version": "0.40.6", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "56f09482d9e2f223911277ab887f197402708049" + "reference": "d8816209a07e7d64ef62dbcaf8ad4aa1262f58b9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/56f09482d9e2f223911277ab887f197402708049", - "reference": "56f09482d9e2f223911277ab887f197402708049", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/d8816209a07e7d64ef62dbcaf8ad4aa1262f58b9", + "reference": "d8816209a07e7d64ef62dbcaf8ad4aa1262f58b9", "shasum": "" }, "require": { @@ -5130,9 +5130,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/0.40.2" + "source": "https://github.com/appwrite/sdk-generator/tree/0.40.6" }, - "time": "2025-03-06T16:31:03+00:00" + "time": "2025-03-10T19:04:24+00:00" }, { "name": "doctrine/annotations", @@ -5404,16 +5404,16 @@ }, { "name": "laravel/pint", - "version": "v1.21.0", + "version": "v1.21.1", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "531fa0871fbde719c51b12afa3a443b8f4e4b425" + "reference": "c44bffbb2334e90fba560933c45948fa4a3f3e86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/531fa0871fbde719c51b12afa3a443b8f4e4b425", - "reference": "531fa0871fbde719c51b12afa3a443b8f4e4b425", + "url": "https://api.github.com/repos/laravel/pint/zipball/c44bffbb2334e90fba560933c45948fa4a3f3e86", + "reference": "c44bffbb2334e90fba560933c45948fa4a3f3e86", "shasum": "" }, "require": { @@ -5424,9 +5424,9 @@ "php": "^8.2.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.68.5", - "illuminate/view": "^11.42.0", - "larastan/larastan": "^3.0.4", + "friendsofphp/php-cs-fixer": "^3.70.2", + "illuminate/view": "^11.44.1", + "larastan/larastan": "^3.1.0", "laravel-zero/framework": "^11.36.1", "mockery/mockery": "^1.6.12", "nunomaduro/termwind": "^2.3", @@ -5466,7 +5466,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2025-02-18T03:18:57+00:00" + "time": "2025-03-11T03:22:21+00:00" }, { "name": "matthiasmullie/minify", diff --git a/docker-compose.yml b/docker-compose.yml index 547374eb5f..5d1d7678dd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -206,7 +206,7 @@ services: appwrite-console: <<: *x-logging container_name: appwrite-console - image: appwrite/console:5.3.0-sites-rc.20 + image: appwrite/console:5.3.0-sites-rc.21 restart: unless-stopped networks: - appwrite @@ -953,7 +953,7 @@ services: appwrite-browser: container_name: appwrite-browser - image: appwrite/browser:0.2.1 + image: appwrite/browser:0.2.2 networks: - appwrite @@ -962,7 +962,7 @@ services: hostname: exc1 <<: *x-logging stop_signal: SIGINT - image: openruntimes/executor:0.7.9 + image: openruntimes/executor:0.7.10 restart: unless-stopped networks: - appwrite @@ -985,7 +985,7 @@ services: - OPR_EXECUTOR_ENV=$_APP_ENV - OPR_EXECUTOR_RUNTIMES=$_APP_FUNCTIONS_RUNTIMES,$_APP_SITES_RUNTIMES - OPR_EXECUTOR_SECRET=$_APP_EXECUTOR_SECRET - - OPR_EXECUTOR_RUNTIME_VERSIONS=v2,v4,v4rc + - OPR_EXECUTOR_RUNTIME_VERSIONS=v2,v5 - OPR_EXECUTOR_LOGGING_CONFIG=$_APP_LOGGING_CONFIG - OPR_EXECUTOR_STORAGE_DEVICE=$_APP_STORAGE_DEVICE - OPR_EXECUTOR_STORAGE_S3_ACCESS_KEY=$_APP_STORAGE_S3_ACCESS_KEY diff --git a/public/images/sites/templates/starter-for-flutter-dark.png b/public/images/sites/templates/starter-for-flutter-dark.png new file mode 100644 index 0000000000..760cd8d341 Binary files /dev/null and b/public/images/sites/templates/starter-for-flutter-dark.png differ diff --git a/public/images/sites/templates/starter-for-flutter-light.png b/public/images/sites/templates/starter-for-flutter-light.png new file mode 100644 index 0000000000..760cd8d341 Binary files /dev/null and b/public/images/sites/templates/starter-for-flutter-light.png differ diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php index c02c470980..81474742ce 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php @@ -89,9 +89,9 @@ class Delete extends Action } } - if ($function->getAttribute('deployment') === $deployment->getId()) { // Reset function deployment + if ($function->getAttribute('deploymentId') === $deployment->getId()) { // Reset function deployment $function = $dbForProject->updateDocument('functions', $function->getId(), new Document(array_merge($function->getArrayCopy(), [ - 'deployment' => '', + 'deploymentId' => '', 'deploymentInternalId' => '', ]))); } diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php index 422b5f767f..dd580bc365 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php @@ -146,7 +146,7 @@ class Create extends Base throw new Exception(Exception::FUNCTION_RUNTIME_UNSUPPORTED, 'Runtime "' . $function->getAttribute('runtime', '') . '" is not supported'); } - $deployment = Authorization::skip(fn () => $dbForProject->getDocument('deployments', $function->getAttribute('deployment', ''))); + $deployment = Authorization::skip(fn () => $dbForProject->getDocument('deployments', $function->getAttribute('deploymentId', ''))); if ($deployment->getAttribute('resourceId') !== $function->getId()) { throw new Exception(Exception::DEPLOYMENT_NOT_FOUND, 'Deployment not found. Create a deployment before trying to execute a function'); diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php index b8959ab5bc..b458645eb7 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php @@ -159,7 +159,7 @@ class Create extends Base 'name' => $name, 'runtime' => $runtime, 'deploymentInternalId' => '', - 'deployment' => '', + 'deploymentId' => '', 'events' => $events, 'schedule' => $schedule, 'scheduleInternalId' => '', @@ -169,7 +169,7 @@ class Create extends Base 'commands' => $commands, 'scopes' => $scopes, 'search' => implode(' ', [$functionId, $name, $runtime]), - 'version' => 'v4', + 'version' => 'v5', 'installationId' => $installation->getId(), 'installationInternalId' => $installation->getInternalId(), 'providerRepositoryId' => $providerRepositoryId, diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php index 9b5d7c5f9f..450f0fec04 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php @@ -85,7 +85,7 @@ class Update extends Base $function = $dbForProject->updateDocument('functions', $function->getId(), new Document(array_merge($function->getArrayCopy(), [ 'deploymentInternalId' => $deployment->getInternalId(), - 'deployment' => $deployment->getId(), + 'deploymentId' => $deployment->getId(), ]))); // Inform scheduler if function is still active @@ -93,7 +93,7 @@ class Update extends Base $schedule ->setAttribute('resourceUpdatedAt', DateTime::now()) ->setAttribute('schedule', $function->getAttribute('schedule')) - ->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deployment'))); + ->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deploymentId'))); Authorization::skip(fn () => $dbForPlatform->updateDocument('schedules', $schedule->getId(), $schedule)); $queries = [ diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php index 550cc2aa51..d1f5f8eaf7 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php @@ -207,10 +207,10 @@ class Update extends Base } // Enforce Cold Start if spec limits change. - if ($function->getAttribute('specification') !== $specification && !empty($function->getAttribute('deployment'))) { + if ($function->getAttribute('specification') !== $specification && !empty($function->getAttribute('deploymentId'))) { $executor = new Executor(App::getEnv('_APP_EXECUTOR_HOST')); try { - $executor->deleteRuntime($project->getId(), $function->getAttribute('deployment')); + $executor->deleteRuntime($project->getId(), $function->getAttribute('deploymentId')); } catch (\Throwable $th) { // Don't throw if the deployment doesn't exist if ($th->getCode() !== 404) { @@ -254,7 +254,7 @@ class Update extends Base $schedule ->setAttribute('resourceUpdatedAt', DateTime::now()) ->setAttribute('schedule', $function->getAttribute('schedule')) - ->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deployment'))); + ->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deploymentId'))); Authorization::skip(fn () => $dbForPlatform->updateDocument('schedules', $schedule->getId(), $schedule)); $queueForEvents->setParam('functionId', $function->getId()); diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Create.php index ba48a5c4bc..5cfd5e8a95 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Create.php @@ -105,7 +105,7 @@ class Create extends Base $schedule ->setAttribute('resourceUpdatedAt', DateTime::now()) ->setAttribute('schedule', $function->getAttribute('schedule')) - ->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deployment'))); + ->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deploymentId'))); Authorization::skip(fn () => $dbForPlatform->updateDocument('schedules', $schedule->getId(), $schedule)); $response diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Delete.php b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Delete.php index 650eaf4010..996e0026ac 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Delete.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Delete.php @@ -85,7 +85,7 @@ class Delete extends Base $schedule ->setAttribute('resourceUpdatedAt', DateTime::now()) ->setAttribute('schedule', $function->getAttribute('schedule')) - ->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deployment'))); + ->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deploymentId'))); Authorization::skip(fn () => $dbForPlatform->updateDocument('schedules', $schedule->getId(), $schedule)); $response->noContent(); diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Update.php index 8911dc8abb..5cd277ca8f 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Update.php @@ -103,7 +103,7 @@ class Update extends Base $schedule ->setAttribute('resourceUpdatedAt', DateTime::now()) ->setAttribute('schedule', $function->getAttribute('schedule')) - ->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deployment'))); + ->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deploymentId'))); Authorization::skip(fn () => $dbForPlatform->updateDocument('schedules', $schedule->getId(), $schedule)); $response->dynamic($variable, Response::MODEL_VARIABLE); diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 3e1fdf86d1..be7b1de991 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -67,8 +67,7 @@ class Builds extends Action ->inject('isResourceBlocked') ->inject('deviceForFiles') ->inject('log') - ->callback(fn ($message, Document $project, Database $dbForPlatform, Event $queueForEvents, Func $queueForFunctions, StatsUsage $usage, Cache $cache, Database $dbForProject, Device $deviceForFunctions, Device $deviceForSites, callable $isResourceBlocked, Device $deviceForFiles, Log $log) => - $this->action($message, $project, $dbForPlatform, $queueForEvents, $queueForFunctions, $usage, $cache, $dbForProject, $deviceForFunctions, $deviceForSites, $isResourceBlocked, $deviceForFiles, $log)); + ->callback([$this, 'action']); } /** @@ -793,6 +792,13 @@ class Builds extends Action 'x-appwrite-key' => API_KEY_DYNAMIC . '_' . $apiKey ]); + $config['sleep'] = 3000; // 3 seconds + + $isDevelopment = System::getEnv('_APP_ENV', 'development') === 'development'; + if ($isDevelopment) { + $config['timeout'] = 10000; // 10 seconds + } + $response = $client->fetch( url: 'http://appwrite-browser:3000/v1/screenshots', method: 'POST', @@ -860,7 +866,7 @@ class Builds extends Action case 'functions': $oldDeploymentInternalId = $resource->getAttribute('deploymentInternalId', ''); - $resource->setAttribute('deployment', $deployment->getId()); + $resource->setAttribute('deploymentId', $deployment->getId()); $resource->setAttribute('deploymentInternalId', $deployment->getInternalId()); $resource = $dbForProject->updateDocument('functions', $resource->getId(), $resource); @@ -980,7 +986,7 @@ class Builds extends Action $schedule ->setAttribute('resourceUpdatedAt', DateTime::now()) ->setAttribute('schedule', $resource->getAttribute('schedule')) - ->setAttribute('active', !empty($resource->getAttribute('schedule')) && !empty($resource->getAttribute('deployment'))); + ->setAttribute('active', !empty($resource->getAttribute('schedule')) && !empty($resource->getAttribute('deploymentId'))); Authorization::skip(fn () => $dbForPlatform->updateDocument('schedules', $schedule->getId(), $schedule)); } } catch (\Throwable $th) { @@ -1108,7 +1114,7 @@ class Builds extends Action { return match ($resource->getCollection()) { 'functions' => $resource->getAttribute('version', 'v2'), - 'sites' => 'v4', + 'sites' => 'v5', }; } diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php index 5f3d6382d5..fea02ddde9 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php @@ -108,7 +108,7 @@ class Create extends Action throw new Exception(Exception::RULE_RESOURCE_NOT_FOUND); } - $deployment = $dbForProject->getDocument('deployments', $function->getAttribute('deployment', '')); + $deployment = $dbForProject->getDocument('deployments', $function->getAttribute('deploymentId', '')); // TODO: @christyjacob remove once we migrate the rules in 1.7.x $ruleId = System::getEnv('_APP_RULES_FORMAT') === 'md5' ? md5($domain->get()) : ID::unique(); diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php index 7065ac1917..458d758d93 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php @@ -89,7 +89,7 @@ class Delete extends Action } } - if ($site->getAttribute('deployment') === $deployment->getId()) { // Reset site deployment + if ($site->getAttribute('deploymentId') === $deployment->getId()) { // Reset site deployment $site = $dbForProject->updateDocument('sites', $site->getId(), new Document(array_merge($site->getArrayCopy(), [ 'deploymentId' => '', 'deploymentInternalId' => '', diff --git a/src/Appwrite/Platform/Tasks/Doctor.php b/src/Appwrite/Platform/Tasks/Doctor.php index c8d8c881b4..a9d0a6220c 100644 --- a/src/Appwrite/Platform/Tasks/Doctor.php +++ b/src/Appwrite/Platform/Tasks/Doctor.php @@ -28,7 +28,7 @@ class Doctor extends Action $this ->desc('Validate server health') ->inject('register') - ->callback(fn (Registry $register) => $this->action($register)); + ->callback([$this, 'action']); } public function action(Registry $register): void diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index 4abd267684..c7b1f72453 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -31,7 +31,7 @@ class Install extends Action ->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true) ->param('interactive', 'Y', new Text(1), 'Run an interactive session', true) ->param('no-start', false, new Boolean(true), 'Run an interactive session', true) - ->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart)); + ->callback([$this, 'action']); } public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart): void diff --git a/src/Appwrite/Platform/Tasks/Maintenance.php b/src/Appwrite/Platform/Tasks/Maintenance.php index 2d37bdbf70..b202a39d74 100644 --- a/src/Appwrite/Platform/Tasks/Maintenance.php +++ b/src/Appwrite/Platform/Tasks/Maintenance.php @@ -26,7 +26,7 @@ class Maintenance extends Action ->inject('dbForPlatform') ->inject('queueForCertificates') ->inject('queueForDeletes') - ->callback(fn (Database $dbForPlatform, Certificate $queueForCertificates, Delete $queueForDeletes) => $this->action($dbForPlatform, $queueForCertificates, $queueForDeletes)); + ->callback([$this, 'action']); } public function action(Database $dbForPlatform, Certificate $queueForCertificates, Delete $queueForDeletes): void diff --git a/src/Appwrite/Platform/Tasks/Migrate.php b/src/Appwrite/Platform/Tasks/Migrate.php index 4efa78ed4b..4bc640639f 100644 --- a/src/Appwrite/Platform/Tasks/Migrate.php +++ b/src/Appwrite/Platform/Tasks/Migrate.php @@ -33,11 +33,7 @@ class Migrate extends Action ->inject('dbForPlatform') ->inject('getProjectDB') ->inject('register') - ->callback(function ($version, $dbForPlatform, $getProjectDB, Registry $register) { - \Co\run(function () use ($version, $dbForPlatform, $getProjectDB, $register) { - $this->action($version, $dbForPlatform, $getProjectDB, $register); - }); - }); + ->callback([$this, 'action']); } private function clearProjectsCache(Document $project) diff --git a/src/Appwrite/Platform/Tasks/QueueRetry.php b/src/Appwrite/Platform/Tasks/QueueRetry.php index 9fe4aed799..f8099dcb00 100644 --- a/src/Appwrite/Platform/Tasks/QueueRetry.php +++ b/src/Appwrite/Platform/Tasks/QueueRetry.php @@ -24,7 +24,7 @@ class QueueRetry extends Action ->param('name', '', new Text(100), 'Queue name') ->param('limit', 0, new Wildcard(), 'jobs limit', true) ->inject('publisher') - ->callback(fn ($name, $limit, $publisher) => $this->action($name, $limit, $publisher)); + ->callback([$this, 'action']); } /** diff --git a/src/Appwrite/Platform/Tasks/SSL.php b/src/Appwrite/Platform/Tasks/SSL.php index 5af0cb6cd8..ae1c93a360 100644 --- a/src/Appwrite/Platform/Tasks/SSL.php +++ b/src/Appwrite/Platform/Tasks/SSL.php @@ -24,7 +24,7 @@ class SSL extends Action ->param('domain', System::getEnv('_APP_DOMAIN', ''), new Hostname(), 'Domain to generate certificate for. If empty, main domain will be used.', true) ->param('skip-check', true, new Boolean(true), 'If DNS and renew check should be skipped. Defaults to true, and when true, all jobs will result in certificate generation attempt.', true) ->inject('queueForCertificates') - ->callback(fn (string $domain, bool|string $skipCheck, Certificate $queueForCertificates) => $this->action($domain, $skipCheck, $queueForCertificates)); + ->callback([$this, 'action']); } public function action(string $domain, bool|string $skipCheck, Certificate $queueForCertificates): void diff --git a/src/Appwrite/Platform/Tasks/ScheduleBase.php b/src/Appwrite/Platform/Tasks/ScheduleBase.php index dad2db0d9a..2c082a7ce4 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleBase.php +++ b/src/Appwrite/Platform/Tasks/ScheduleBase.php @@ -37,7 +37,7 @@ abstract class ScheduleBase extends Action ->inject('pools') ->inject('dbForPlatform') ->inject('getProjectDB') - ->callback(fn (Group $pools, Database $dbForPlatform, callable $getProjectDB) => $this->action($pools, $dbForPlatform, $getProjectDB)); + ->callback([$this, 'action']); } protected function updateProjectAccess(Document $project, Database $dbForPlatform): void diff --git a/src/Appwrite/Platform/Tasks/Screenshot.php b/src/Appwrite/Platform/Tasks/Screenshot.php index 9224d88633..918ce60e11 100644 --- a/src/Appwrite/Platform/Tasks/Screenshot.php +++ b/src/Appwrite/Platform/Tasks/Screenshot.php @@ -21,7 +21,7 @@ class Screenshot extends Action $this ->desc('Create Site template screenshot') ->param('templateId', '', new Text(128), 'Template ID.') - ->callback(fn (string $templateId) => $this->action($templateId)); + ->callback([$this, 'action']); } public function action(string $templateId): void diff --git a/src/Appwrite/Platform/Tasks/Specs.php b/src/Appwrite/Platform/Tasks/Specs.php index 4d7fd5d695..1db018ce9d 100644 --- a/src/Appwrite/Platform/Tasks/Specs.php +++ b/src/Appwrite/Platform/Tasks/Specs.php @@ -50,7 +50,7 @@ class Specs extends Action ->param('version', 'latest', new Text(16), 'Spec version', true) ->param('mode', 'normal', new WhiteList(['normal', 'mocks']), 'Spec Mode', true) ->inject('register') - ->callback(fn (string $version, string $mode, Registry $register) => $this->action($version, $mode, $register)); + ->callback([$this, 'action']); } public function action(string $version, string $mode, Registry $register): void diff --git a/src/Appwrite/Platform/Tasks/Upgrade.php b/src/Appwrite/Platform/Tasks/Upgrade.php index 341ce42fc4..dfd10d347e 100644 --- a/src/Appwrite/Platform/Tasks/Upgrade.php +++ b/src/Appwrite/Platform/Tasks/Upgrade.php @@ -23,7 +23,7 @@ class Upgrade extends Install ->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true) ->param('interactive', 'Y', new Text(1), 'Run an interactive session', true) ->param('no-start', false, new Boolean(true), 'Run an interactive session', true) - ->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart)); + ->callback([$this, 'action']); } public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart): void diff --git a/src/Appwrite/Platform/Tasks/Vars.php b/src/Appwrite/Platform/Tasks/Vars.php index 499f8b15ec..70ae550ef9 100644 --- a/src/Appwrite/Platform/Tasks/Vars.php +++ b/src/Appwrite/Platform/Tasks/Vars.php @@ -18,7 +18,7 @@ class Vars extends Action { $this ->desc('List all the server environment variables') - ->callback(fn () => $this->action()); + ->callback([$this, 'action']); } public function action(): void diff --git a/src/Appwrite/Platform/Workers/Audits.php b/src/Appwrite/Platform/Workers/Audits.php index f1ae46eea7..d94e184bab 100644 --- a/src/Appwrite/Platform/Workers/Audits.php +++ b/src/Appwrite/Platform/Workers/Audits.php @@ -47,7 +47,7 @@ class Audits extends Action ->desc('Audits worker') ->inject('message') ->inject('dbForProject') - ->callback(fn ($message, $dbForProject) => $this->action($message, $dbForProject)); + ->callback([$this, 'action']); $this->lastTriggeredTime = time(); } diff --git a/src/Appwrite/Platform/Workers/Certificates.php b/src/Appwrite/Platform/Workers/Certificates.php index 7e220b2734..84665fea65 100644 --- a/src/Appwrite/Platform/Workers/Certificates.php +++ b/src/Appwrite/Platform/Workers/Certificates.php @@ -49,10 +49,7 @@ class Certificates extends Action ->inject('queueForFunctions') ->inject('log') ->inject('certificates') - ->callback( - fn (Message $message, Database $dbForPlatform, Mail $queueForMails, Event $queueForEvents, Func $queueForFunctions, Log $log, CertificatesAdapter $certificates) => - $this->action($message, $dbForPlatform, $queueForMails, $queueForEvents, $queueForFunctions, $log, $certificates) - ); + ->callback([$this, 'action']); } /** diff --git a/src/Appwrite/Platform/Workers/Databases.php b/src/Appwrite/Platform/Workers/Databases.php index 0f400e0107..ccc928a3df 100644 --- a/src/Appwrite/Platform/Workers/Databases.php +++ b/src/Appwrite/Platform/Workers/Databases.php @@ -38,7 +38,7 @@ class Databases extends Action ->inject('dbForPlatform') ->inject('dbForProject') ->inject('log') - ->callback(fn (Message $message, Document $project, Database $dbForPlatform, Database $dbForProject, Log $log) => $this->action($message, $project, $dbForPlatform, $dbForProject, $log)); + ->callback([$this, 'action']); } /** diff --git a/src/Appwrite/Platform/Workers/Deletes.php b/src/Appwrite/Platform/Workers/Deletes.php index c985513073..91e1fe95d6 100644 --- a/src/Appwrite/Platform/Workers/Deletes.php +++ b/src/Appwrite/Platform/Workers/Deletes.php @@ -58,10 +58,7 @@ class Deletes extends Action ->inject('executionRetention') ->inject('auditRetention') ->inject('log') - ->callback( - fn ($message, Document $project, Database $dbForPlatform, callable $getProjectDB, callable $timelimit, Device $deviceForFiles, Device $deviceForFunctions, Device $deviceForSites, Device $deviceForBuilds, Device $deviceForCache, CertificatesAdapter $certificates, string $executionRetention, string $auditRetention, Log $log) => - $this->action($message, $project, $dbForPlatform, $getProjectDB, $timelimit, $deviceForFiles, $deviceForFunctions, $deviceForSites, $deviceForBuilds, $deviceForCache, $certificates, $executionRetention, $auditRetention, $log) - ); + ->callback([$this, 'action']); } /** diff --git a/src/Appwrite/Platform/Workers/Functions.php b/src/Appwrite/Platform/Workers/Functions.php index 1c952bc7a8..dfe82e22df 100644 --- a/src/Appwrite/Platform/Workers/Functions.php +++ b/src/Appwrite/Platform/Workers/Functions.php @@ -49,7 +49,7 @@ class Functions extends Action ->inject('queueForStatsUsage') ->inject('log') ->inject('isResourceBlocked') - ->callback(fn (Document $project, Message $message, Database $dbForProject, Func $queueForFunctions, Event $queueForEvents, StatsUsage $queueForStatsUsage, Log $log, callable $isResourceBlocked) => $this->action($project, $message, $dbForProject, $queueForFunctions, $queueForEvents, $queueForStatsUsage, $log, $isResourceBlocked)); + ->callback([$this, 'action']); } public function action(Document $project, Message $message, Database $dbForProject, Func $queueForFunctions, Event $queueForEvents, StatsUsage $queueForStatsUsage, Log $log, callable $isResourceBlocked): void @@ -325,7 +325,7 @@ class Functions extends Action ): void { $user ??= new Document(); $functionId = $function->getId(); - $deploymentId = $function->getAttribute('deployment', ''); + $deploymentId = $function->getAttribute('deploymentId', ''); $spec = Config::getParam('specifications')[$function->getAttribute('specification', APP_COMPUTE_SPECIFICATION_DEFAULT)]; $log->addTag('deploymentId', $deploymentId); diff --git a/src/Appwrite/Platform/Workers/Mails.php b/src/Appwrite/Platform/Workers/Mails.php index e48f96ea90..3a15182e51 100644 --- a/src/Appwrite/Platform/Workers/Mails.php +++ b/src/Appwrite/Platform/Workers/Mails.php @@ -29,7 +29,7 @@ class Mails extends Action ->inject('message') ->inject('register') ->inject('log') - ->callback(fn (Message $message, Registry $register, Log $log) => $this->action($message, $register, $log)); + ->callback([$this, 'action']); } /** diff --git a/src/Appwrite/Platform/Workers/Messaging.php b/src/Appwrite/Platform/Workers/Messaging.php index cf2b8bfc84..6f94764bbf 100644 --- a/src/Appwrite/Platform/Workers/Messaging.php +++ b/src/Appwrite/Platform/Workers/Messaging.php @@ -71,7 +71,7 @@ class Messaging extends Action ->inject('dbForProject') ->inject('deviceForFiles') ->inject('queueForStatsUsage') - ->callback(fn (Message $message, Document $project, Log $log, Database $dbForProject, Device $deviceForFiles, StatsUsage $queueForStatsUsage) => $this->action($message, $project, $log, $dbForProject, $deviceForFiles, $queueForStatsUsage)); + ->callback([$this, 'action']); } /** diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 3bf8e06356..6ea6adec57 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -54,7 +54,7 @@ class Migrations extends Action ->inject('dbForProject') ->inject('dbForPlatform') ->inject('logError') - ->callback(fn (Message $message, Document $project, Database $dbForProject, Database $dbForPlatform, callable $logError) => $this->action($message, $project, $dbForProject, $dbForPlatform, $logError)); + ->callback([$this, 'action']); } /** diff --git a/src/Appwrite/Platform/Workers/Usage.php b/src/Appwrite/Platform/Workers/Usage.php index 3687eeab67..5c7a8b081e 100644 --- a/src/Appwrite/Platform/Workers/Usage.php +++ b/src/Appwrite/Platform/Workers/Usage.php @@ -37,9 +37,7 @@ class Usage extends Action ->inject('project') ->inject('getProjectDB') ->inject('queueForUsageDump') - ->callback(function (Message $message, Document $project, callable $getProjectDB, UsageDump $queueForUsageDump) { - $this->action($message, $project, $getProjectDB, $queueForUsageDump); - }); + ->callback([$this, 'action']); $this->aggregationInterval = (int) System::getEnv('_APP_USAGE_AGGREGATION_INTERVAL', '20'); $this->lastTriggeredTime = time(); diff --git a/src/Appwrite/Platform/Workers/UsageDump.php b/src/Appwrite/Platform/Workers/UsageDump.php index 2f1d13f29a..cf756a3de5 100644 --- a/src/Appwrite/Platform/Workers/UsageDump.php +++ b/src/Appwrite/Platform/Workers/UsageDump.php @@ -38,9 +38,7 @@ class UsageDump extends Action $this ->inject('message') ->inject('getProjectDB') - ->callback(function (Message $message, callable $getProjectDB) { - $this->action($message, $getProjectDB); - }); + ->callback([$this, 'action']); } /** diff --git a/src/Appwrite/Platform/Workers/Webhooks.php b/src/Appwrite/Platform/Workers/Webhooks.php index c903dafdae..2066f690ac 100644 --- a/src/Appwrite/Platform/Workers/Webhooks.php +++ b/src/Appwrite/Platform/Workers/Webhooks.php @@ -37,7 +37,7 @@ class Webhooks extends Action ->inject('queueForMails') ->inject('queueForStatsUsage') ->inject('log') - ->callback(fn (Message $message, Document $project, Database $dbForPlatform, Mail $queueForMails, StatsUsage $queueForStatsUsage, Log $log) => $this->action($message, $project, $dbForPlatform, $queueForMails, $queueForStatsUsage, $log)); + ->callback([$this, 'action']); } /** diff --git a/src/Appwrite/Utopia/Database/Validator/Queries/Functions.php b/src/Appwrite/Utopia/Database/Validator/Queries/Functions.php index 89f5d52c81..894ee26e3f 100644 --- a/src/Appwrite/Utopia/Database/Validator/Queries/Functions.php +++ b/src/Appwrite/Utopia/Database/Validator/Queries/Functions.php @@ -8,7 +8,7 @@ class Functions extends Base 'name', 'enabled', 'runtime', - 'deployment', + 'deploymentId', 'schedule', 'scheduleNext', 'schedulePrevious', diff --git a/src/Appwrite/Utopia/Request/Filters/V19.php b/src/Appwrite/Utopia/Request/Filters/V19.php new file mode 100644 index 0000000000..041c126a69 --- /dev/null +++ b/src/Appwrite/Utopia/Request/Filters/V19.php @@ -0,0 +1,24 @@ + $this->parseFunction($content), + Response::MODEL_FUNCTION_LIST => $this->handleList($content, 'functions', fn ($item) => $this->parseFunction($item)), + default => $parsedResponse, + }; + + return $parsedResponse; + } + + protected function parseFunction(array $content) + { + $content['deployment'] = $content['deploymentId'] ?? ''; + unset($content['deploymentId']); + return $content; + } +} diff --git a/src/Appwrite/Utopia/Response/Model/Func.php b/src/Appwrite/Utopia/Response/Model/Func.php index 3bfc24c82e..bf16f91b59 100644 --- a/src/Appwrite/Utopia/Response/Model/Func.php +++ b/src/Appwrite/Utopia/Response/Model/Func.php @@ -65,7 +65,7 @@ class Func extends Model 'default' => '', 'example' => 'python-3.8', ]) - ->addRule('deployment', [ + ->addRule('deploymentId', [ 'type' => self::TYPE_STRING, 'description' => 'Function\'s active deployment ID.', 'default' => '', @@ -119,7 +119,7 @@ class Func extends Model ->addRule('version', [ 'type' => self::TYPE_STRING, 'description' => 'Version of Open Runtimes used for the function.', - 'default' => 'v4', + 'default' => 'v5', 'example' => 'v2', ]) ->addRule('installationId', [ diff --git a/src/Executor/Executor.php b/src/Executor/Executor.php index 9702db43de..c0596fd272 100644 --- a/src/Executor/Executor.php +++ b/src/Executor/Executor.php @@ -74,8 +74,8 @@ class Executor $route = "/runtimes"; // Remove after migration - if ($version == 'v3') { - $version = 'v4'; + if ($version === 'v3' || $version === 'v4') { + $version = 'v5'; } $params = [ @@ -201,8 +201,8 @@ class Executor $route = '/runtimes/' . $runtimeId . '/executions'; // Remove after migration - if ($version == 'v3') { - $version = 'v4'; + if ($version === 'v3' || $version === 'v4') { + $version = 'v5'; } $params = [ diff --git a/tests/e2e/General/UsageTest.php b/tests/e2e/General/UsageTest.php index a74101f50d..0609ea9fed 100644 --- a/tests/e2e/General/UsageTest.php +++ b/tests/e2e/General/UsageTest.php @@ -930,7 +930,7 @@ class UsageTest extends Scope $this->assertEquals(true, (new DatetimeValidator())->isValid($response['body']['$createdAt'])); $this->assertEquals(true, (new DatetimeValidator())->isValid($response['body']['$updatedAt'])); - $this->assertEquals($deploymentId, $response['body']['deployment']); + $this->assertEquals($deploymentId, $response['body']['deploymentId']); $response = $this->client->call( Client::METHOD_POST, diff --git a/tests/e2e/Services/Functions/FunctionsBase.php b/tests/e2e/Services/Functions/FunctionsBase.php index 2d0975181c..2d82de22f2 100644 --- a/tests/e2e/Services/Functions/FunctionsBase.php +++ b/tests/e2e/Services/Functions/FunctionsBase.php @@ -59,7 +59,7 @@ trait FunctionsBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'], ])); - $this->assertEquals($deploymentId, $function['body']['deployment'], 'Deployment is not activated, deployment: ' . json_encode($function['body'], JSON_PRETTY_PRINT)); + $this->assertEquals($deploymentId, $function['body']['deploymentId'], 'Deployment is not activated, deployment: ' . json_encode($function['body'], JSON_PRETTY_PRINT)); }, 100000, 500); } @@ -351,7 +351,7 @@ trait FunctionsBase $this->assertEventually(function () use ($functionId, $deploymentId) { $function = $this->getFunction($functionId); - $this->assertEquals($deploymentId, $function['body']['deployment'], 'Deployment is not activated, deployment: ' . json_encode($function['body'], JSON_PRETTY_PRINT)); + $this->assertEquals($deploymentId, $function['body']['deploymentId'], 'Deployment is not activated, deployment: ' . json_encode($function['body'], JSON_PRETTY_PRINT)); }, 100000, 500); return $deploymentId; diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 6671c57c90..2830427deb 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -83,7 +83,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals('php-8.0', $function['body']['runtime']); $this->assertEquals(true, $dateValidator->isValid($function['body']['$createdAt'])); $this->assertEquals(true, $dateValidator->isValid($function['body']['$updatedAt'])); - $this->assertEquals('', $function['body']['deployment']); + $this->assertEquals('', $function['body']['deploymentId']); $this->assertEquals([ 'buckets.*.create', 'buckets.*.delete', @@ -298,7 +298,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals('Test1', $function['body']['name']); $this->assertEquals(true, $dateValidator->isValid($function['body']['$createdAt'])); $this->assertEquals(true, $dateValidator->isValid($function['body']['$updatedAt'])); - $this->assertEquals('', $function['body']['deployment']); + $this->assertEquals('', $function['body']['deploymentId']); $this->assertEquals([ 'users.*.update.name', 'users.*.update.email', @@ -431,7 +431,7 @@ class FunctionsCustomServerTest extends Scope $function = $this->getFunction($functionId); $this->assertEquals(200, $function['headers']['status-code']); - $this->assertEquals($deploymentId, $function['body']['deployment']); + $this->assertEquals($deploymentId, $function['body']['deploymentId']); // Test starter code is used and that dynamic keys work $execution = $this->createExecution($functionId, [ @@ -531,8 +531,8 @@ class FunctionsCustomServerTest extends Scope $function = $this->getFunction($functionId); $this->assertEquals(200, $function['headers']['status-code']); - $this->assertEquals($deploymentIdActive, $function['body']['deployment']); - $this->assertNotEquals($deploymentIdInactive, $function['body']['deployment']); + $this->assertEquals($deploymentIdActive, $function['body']['deploymentId']); + $this->assertNotEquals($deploymentIdInactive, $function['body']['deploymentId']); $deployment = $this->client->call(Client::METHOD_DELETE, '/functions/' . $functionId . '/deployments/' . $deploymentIdInactive, array_merge([ 'content-type' => 'application/json', @@ -670,7 +670,7 @@ class FunctionsCustomServerTest extends Scope $this->assertNotEmpty($response['body']['$id']); $this->assertEquals(true, $dateValidator->isValid($response['body']['$createdAt'])); $this->assertEquals(true, $dateValidator->isValid($response['body']['$updatedAt'])); - $this->assertEquals($data['deploymentId'], $response['body']['deployment']); + $this->assertEquals($data['deploymentId'], $response['body']['deploymentId']); return $data; } @@ -1268,7 +1268,7 @@ class FunctionsCustomServerTest extends Scope return [ ['folder' => 'php-fn', 'name' => 'php-8.0', 'entrypoint' => 'index.php', 'runtimeName' => 'PHP', 'runtimeVersion' => '8.0'], ['folder' => 'node', 'name' => 'node-18.0', 'entrypoint' => 'index.js', 'runtimeName' => 'Node.js', 'runtimeVersion' => '18.0'], - // TODO: Re-enable; temporarly disabled due to OPR v4rc issues + // TODO: Re-enable; temporarly disabled due to OPR v5 issues // ['folder' => 'python', 'name' => 'python-3.9', 'entrypoint' => 'main.py', 'runtimeName' => 'Python', 'runtimeVersion' => '3.9'], ['folder' => 'ruby', 'name' => 'ruby-3.1', 'entrypoint' => 'main.rb', 'runtimeName' => 'Ruby', 'runtimeVersion' => '3.1'], // Swift and Dart disabled on purpose, as it's very slow. @@ -2079,15 +2079,15 @@ class FunctionsCustomServerTest extends Scope $function = $this->getFunction($functionId); $this->assertEquals(200, $function['headers']['status-code']); - $this->assertEquals($deploymentId2, $function['body']['deployment']); + $this->assertEquals($deploymentId2, $function['body']['deploymentId']); $function = $this->updateFunctionDeployment($functionId, $deploymentId1); $this->assertEquals(200, $function['headers']['status-code']); - $this->assertEquals($deploymentId1, $function['body']['deployment']); + $this->assertEquals($deploymentId1, $function['body']['deploymentId']); $function = $this->getFunction($functionId); $this->assertEquals(200, $function['headers']['status-code']); - $this->assertEquals($deploymentId1, $function['body']['deployment']); + $this->assertEquals($deploymentId1, $function['body']['deploymentId']); $execution = $this->createExecution($functionId, [ 'headers' => [ 'cookie' => 'cookieName=cookieValue' ] diff --git a/tests/e2e/Services/Proxy/ProxyBase.php b/tests/e2e/Services/Proxy/ProxyBase.php index 40f16b5f8e..44e015b751 100644 --- a/tests/e2e/Services/Proxy/ProxyBase.php +++ b/tests/e2e/Services/Proxy/ProxyBase.php @@ -255,7 +255,7 @@ trait ProxyBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'], ])); - $this->assertEquals($deploymentId, $function['body']['deployment'], 'Deployment is not activated, deployment: ' . json_encode($function['body'], JSON_PRETTY_PRINT)); + $this->assertEquals($deploymentId, $function['body']['deploymentId'], 'Deployment is not activated, deployment: ' . json_encode($function['body'], JSON_PRETTY_PRINT)); }, 100000, 500); return ['functionId' => $functionId, 'deploymentId' => $deploymentId];