Merge branch 'feat-sites' into chore-add-invalid-ssr-site-test

This commit is contained in:
Khushboo Verma 2025-03-12 17:16:03 +05:30
commit 5549cd8900
59 changed files with 330 additions and 256 deletions

4
.env
View file

@ -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

View file

@ -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';

View file

@ -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],
]

View file

@ -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',

View file

@ -6,4 +6,4 @@
use Appwrite\Runtimes\Runtimes;
return (new Runtimes('v4rc'))->getAll();
return (new Runtimes('v5'))->getAll();

View file

@ -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": "<SEARCH>",
"default": ""
},
"in": "query"
}
]
},

View file

@ -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": "<SEARCH>",
"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": "<SEARCH>",
"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",

View file

@ -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": "<SEARCH>",
"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": "<SEARCH>",
"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",

View file

@ -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": "<SEARCH>",
"default": "",
"in": "query"
}
]
},

View file

@ -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": "<SEARCH>",
"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": "<SEARCH>",
"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",

View file

@ -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": "<SEARCH>",
"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": "<SEARCH>",
"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",

View file

@ -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',

View file

@ -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");
}

40
composer.lock generated
View file

@ -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",

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

View file

@ -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' => '',
])));
}

View file

@ -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');

View file

@ -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,

View file

@ -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 = [

View file

@ -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());

View file

@ -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

View file

@ -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();

View file

@ -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);

View file

@ -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',
};
}

View file

@ -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();

View file

@ -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' => '',

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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']);
}
/**

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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();
}

View file

@ -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']);
}
/**

View file

@ -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']);
}
/**

View file

@ -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']);
}
/**

View file

@ -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);

View file

@ -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']);
}
/**

View file

@ -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']);
}
/**

View file

@ -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']);
}
/**

View file

@ -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();

View file

@ -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']);
}
/**

View file

@ -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']);
}
/**

View file

@ -8,7 +8,7 @@ class Functions extends Base
'name',
'enabled',
'runtime',
'deployment',
'deploymentId',
'schedule',
'scheduleNext',
'schedulePrevious',

View file

@ -0,0 +1,24 @@
<?php
namespace Appwrite\Utopia\Request\Filters;
use Appwrite\Utopia\Request\Filter;
class V19 extends Filter
{
// Convert 1.6 params to 1.7
public function parse(array $content, string $model): array
{
/*
Uncomment with first request filter; current is just a copy of V18
switch ($model) {
case 'functions.create':
$content['something'] = $content['somethingElse'] ?? "";
unset($content['something']);
break;
}
*/
return $content;
}
}

View file

@ -0,0 +1,30 @@
<?php
namespace Appwrite\Utopia\Response\Filters;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Filter;
class V19 extends Filter
{
// Convert 1.7 Data format to 1.6 format
public function parse(array $content, string $model): array
{
$parsedResponse = $content;
$parsedResponse = match($model) {
Response::MODEL_FUNCTION => $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;
}
}

View file

@ -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', [

View file

@ -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 = [

View file

@ -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,

View file

@ -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;

View file

@ -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' ]

View file

@ -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];