mirror of
https://github.com/appwrite/appwrite
synced 2026-04-21 13:37:16 +00:00
Merge remote-tracking branch 'origin/1.7.x' into 1.8.x
# Conflicts: # .coderabbit.yaml
This commit is contained in:
commit
89f0c28e26
14 changed files with 115 additions and 40 deletions
|
|
@ -9,4 +9,9 @@ reviews:
|
|||
- main
|
||||
- 1.6.x
|
||||
- 1.7.x
|
||||
- 1.8.x
|
||||
- 1.8.x
|
||||
high_level_summary: false
|
||||
poem: false
|
||||
sequence_diagrams: false
|
||||
collapse_walkthrough: true
|
||||
changed_files_summary: false
|
||||
|
|
|
|||
|
|
@ -4492,6 +4492,29 @@
|
|||
}
|
||||
],
|
||||
"description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console."
|
||||
},
|
||||
{
|
||||
"name": "createDocuments",
|
||||
"auth": {
|
||||
"Key": []
|
||||
},
|
||||
"parameters": [
|
||||
"databaseId",
|
||||
"collectionId",
|
||||
"documents"
|
||||
],
|
||||
"required": [
|
||||
"databaseId",
|
||||
"collectionId",
|
||||
"documents"
|
||||
],
|
||||
"responses": [
|
||||
{
|
||||
"code": 201,
|
||||
"model": "#\/components\/schemas\/documentList"
|
||||
}
|
||||
],
|
||||
"description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console."
|
||||
}
|
||||
],
|
||||
"auth": {
|
||||
|
|
|
|||
|
|
@ -35112,6 +35112,17 @@
|
|||
"default": ""
|
||||
},
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"name": "providerReference",
|
||||
"description": "Git reference (branch, tag, commit) to get contents from",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"x-example": "<PROVIDER_REFERENCE>",
|
||||
"default": ""
|
||||
},
|
||||
"in": "query"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4638,6 +4638,29 @@
|
|||
}
|
||||
],
|
||||
"description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console."
|
||||
},
|
||||
{
|
||||
"name": "createDocuments",
|
||||
"auth": {
|
||||
"Key": []
|
||||
},
|
||||
"parameters": [
|
||||
"databaseId",
|
||||
"collectionId",
|
||||
"documents"
|
||||
],
|
||||
"required": [
|
||||
"databaseId",
|
||||
"collectionId",
|
||||
"documents"
|
||||
],
|
||||
"responses": [
|
||||
{
|
||||
"code": 201,
|
||||
"model": "#\/definitions\/documentList"
|
||||
}
|
||||
],
|
||||
"description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console."
|
||||
}
|
||||
],
|
||||
"auth": {
|
||||
|
|
|
|||
|
|
@ -35319,6 +35319,15 @@
|
|||
"x-example": "<PROVIDER_ROOT_DIRECTORY>",
|
||||
"default": "",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"name": "providerReference",
|
||||
"description": "Git reference (branch, tag, commit) to get contents from",
|
||||
"required": false,
|
||||
"type": "string",
|
||||
"x-example": "<PROVIDER_REFERENCE>",
|
||||
"default": "",
|
||||
"in": "query"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3880,7 +3880,7 @@ App::patch('/v1/account/mfa')
|
|||
if ($user->getAttribute('phone', false) && $user->getAttribute('phoneVerification', false)) {
|
||||
$factors[] = Type::PHONE;
|
||||
}
|
||||
$factors = \array_unique($factors);
|
||||
$factors = \array_values(\array_unique($factors));
|
||||
|
||||
$session->setAttribute('factors', $factors);
|
||||
$dbForProject->updateDocument('sessions', $session->getId(), $session);
|
||||
|
|
@ -4065,7 +4065,7 @@ App::put('/v1/account/mfa/authenticators/:type')
|
|||
|
||||
$factors = $session->getAttribute('factors', []);
|
||||
$factors[] = $type;
|
||||
$factors = \array_unique($factors);
|
||||
$factors = \array_values(\array_unique($factors));
|
||||
|
||||
$session->setAttribute('factors', $factors);
|
||||
$dbForProject->updateDocument('sessions', $session->getId(), $session);
|
||||
|
|
@ -4549,7 +4549,7 @@ App::put('/v1/account/mfa/challenge')
|
|||
|
||||
$factors = $session->getAttribute('factors', []);
|
||||
$factors[] = $type;
|
||||
$factors = \array_unique($factors);
|
||||
$factors = \array_values(\array_unique($factors));
|
||||
|
||||
$session
|
||||
->setAttribute('factors', $factors)
|
||||
|
|
|
|||
|
|
@ -605,11 +605,12 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories/:pro
|
|||
->param('installationId', '', new Text(256), 'Installation Id')
|
||||
->param('providerRepositoryId', '', new Text(256), 'Repository Id')
|
||||
->param('providerRootDirectory', '', new Text(256, 0), 'Path to get contents of nested directory', true)
|
||||
->param('providerReference', '', new Text(256, 0), 'Git reference (branch, tag, commit) to get contents from', true)
|
||||
->inject('gitHub')
|
||||
->inject('response')
|
||||
->inject('project')
|
||||
->inject('dbForPlatform')
|
||||
->action(function (string $installationId, string $providerRepositoryId, string $providerRootDirectory, GitHub $github, Response $response, Document $project, Database $dbForPlatform) {
|
||||
->action(function (string $installationId, string $providerRepositoryId, string $providerRootDirectory, string $providerReference, GitHub $github, Response $response, Document $project, Database $dbForPlatform) {
|
||||
$installation = $dbForPlatform->getDocument('installations', $installationId);
|
||||
|
||||
if ($installation->isEmpty()) {
|
||||
|
|
@ -631,7 +632,7 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories/:pro
|
|||
throw new Exception(Exception::PROVIDER_REPOSITORY_NOT_FOUND);
|
||||
}
|
||||
|
||||
$contents = $github->listRepositoryContents($owner, $repositoryName, $providerRootDirectory);
|
||||
$contents = $github->listRepositoryContents($owner, $repositoryName, $providerRootDirectory, $providerReference);
|
||||
|
||||
$vcsContents = [];
|
||||
foreach ($contents as $content) {
|
||||
|
|
|
|||
|
|
@ -511,28 +511,27 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw
|
|||
'function' => $deployment->getAttribute('entrypoint', ''),
|
||||
'site' => '',
|
||||
};
|
||||
$source = $deployment->getAttribute('buildPath', '');
|
||||
$extension = str_ends_with($source, '.tar') ? 'tar' : 'tar.gz';
|
||||
|
||||
if ($type === 'function') {
|
||||
$runtimeEntrypoint = match ($version) {
|
||||
'v2' => '',
|
||||
default => 'cp /tmp/code.tar.gz /mnt/code/code.tar.gz && nohup helpers/start.sh "' . $runtime['startCommand'] . '"'
|
||||
};
|
||||
} elseif ($type === 'site') {
|
||||
$startCommand = $runtime['startCommand'];
|
||||
if ($type === 'site') {
|
||||
$frameworks = Config::getParam('frameworks', []);
|
||||
$framework = $frameworks[$resource->getAttribute('framework', '')] ?? null;
|
||||
|
||||
$startCommand = $runtime['startCommand'];
|
||||
|
||||
if (!is_null($framework)) {
|
||||
$adapter = ($framework['adapters'] ?? [])[$deployment->getAttribute('adapter', '')] ?? null;
|
||||
if (!is_null($adapter) && isset($adapter['startCommand'])) {
|
||||
$startCommand = $adapter['startCommand'];
|
||||
}
|
||||
}
|
||||
|
||||
$runtimeEntrypoint = 'cp /tmp/code.tar.gz /mnt/code/code.tar.gz && nohup helpers/start.sh "' . $startCommand . '"';
|
||||
}
|
||||
|
||||
$runtimeEntrypoint = match ($version) {
|
||||
'v2' => '',
|
||||
default => "cp /tmp/code.$extension /mnt/code/code.$extension && nohup helpers/start.sh \"$startCommand\"",
|
||||
};
|
||||
|
||||
$entrypoint = match ($type) {
|
||||
'function' => $deployment->getAttribute('entrypoint', ''),
|
||||
'site' => '',
|
||||
|
|
@ -545,7 +544,7 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw
|
|||
variables: $vars,
|
||||
timeout: $resource->getAttribute('timeout', 30),
|
||||
image: $runtime['image'],
|
||||
source: $deployment->getAttribute('buildPath', ''),
|
||||
source: $source,
|
||||
entrypoint: $entrypoint,
|
||||
version: $version,
|
||||
path: $path,
|
||||
|
|
|
|||
|
|
@ -841,7 +841,7 @@ $image = $this->getParam('image', '');
|
|||
- _APP_DB_PASS
|
||||
|
||||
appwrite-assistant:
|
||||
image: appwrite/assistant:0.4.0
|
||||
image: appwrite/assistant:0.8.3
|
||||
container_name: appwrite-assistant
|
||||
<<: *x-logging
|
||||
restart: unless-stopped
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ services:
|
|||
appwrite-console:
|
||||
<<: *x-logging
|
||||
container_name: appwrite-console
|
||||
image: appwrite/console:6.0.32
|
||||
image: appwrite/console:6.0.41
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- appwrite
|
||||
|
|
@ -934,7 +934,7 @@ services:
|
|||
|
||||
appwrite-assistant:
|
||||
container_name: appwrite-assistant
|
||||
image: appwrite/assistant:0.7.0
|
||||
image: appwrite/assistant:0.8.3
|
||||
networks:
|
||||
- appwrite
|
||||
environment:
|
||||
|
|
|
|||
|
|
@ -386,7 +386,9 @@ class Create extends Base
|
|||
try {
|
||||
$version = $function->getAttribute('version', 'v2');
|
||||
$command = $runtime['startCommand'];
|
||||
$command = $version === 'v2' ? '' : 'cp /tmp/code.tar.gz /mnt/code/code.tar.gz && nohup helpers/start.sh "' . $command . '"';
|
||||
$source = $deployment->getAttribute('buildPath', '');
|
||||
$extension = str_ends_with($source, '.tar') ? 'tar' : 'tar.gz';
|
||||
$command = $version === 'v2' ? '' : "cp /tmp/code.$extension /mnt/code/code.$extension && nohup helpers/start.sh \"$command\"";
|
||||
$executionResponse = $executor->createExecution(
|
||||
projectId: $project->getId(),
|
||||
deploymentId: $deployment->getId(),
|
||||
|
|
@ -394,7 +396,7 @@ class Create extends Base
|
|||
variables: $vars,
|
||||
timeout: $function->getAttribute('timeout', 0),
|
||||
image: $runtime['image'],
|
||||
source: $deployment->getAttribute('buildPath', ''),
|
||||
source: $source,
|
||||
entrypoint: $deployment->getAttribute('entrypoint', ''),
|
||||
version: $version,
|
||||
path: $path,
|
||||
|
|
|
|||
|
|
@ -495,7 +495,7 @@ class Deletes extends Action
|
|||
* @throws Authorization
|
||||
* @throws DatabaseException
|
||||
*/
|
||||
private function deleteProject(Database $dbForPlatform, callable $getProjectDB, Device $deviceForFiles, Device $deviceForSites, Device $deviceForFunctions, Device $deviceForBuilds, Device $deviceForCache, CertificatesAdapter $certificates, Document $document): void
|
||||
protected function deleteProject(Database $dbForPlatform, callable $getProjectDB, Device $deviceForFiles, Device $deviceForSites, Device $deviceForFunctions, Device $deviceForBuilds, Device $deviceForCache, CertificatesAdapter $certificates, Document $document): void
|
||||
{
|
||||
$projectInternalId = $document->getSequence();
|
||||
$projectId = $document->getId();
|
||||
|
|
|
|||
|
|
@ -519,7 +519,9 @@ class Functions extends Action
|
|||
try {
|
||||
$version = $function->getAttribute('version', 'v2');
|
||||
$command = $runtime['startCommand'];
|
||||
$command = $version === 'v2' ? '' : 'cp /tmp/code.tar.gz /mnt/code/code.tar.gz && nohup helpers/start.sh "' . $command . '"';
|
||||
$source = $deployment->getAttribute('buildPath', '');
|
||||
$extension = str_ends_with($source, '.tar') ? 'tar' : 'tar.gz';
|
||||
$command = $version === 'v2' ? '' : "cp /tmp/code.$extension /mnt/code/code.$extension && nohup helpers/start.sh \"$command\"";
|
||||
$executionResponse = $executor->createExecution(
|
||||
projectId: $project->getId(),
|
||||
deploymentId: $deploymentId,
|
||||
|
|
@ -527,7 +529,7 @@ class Functions extends Action
|
|||
variables: $vars,
|
||||
timeout: $function->getAttribute('timeout', 0),
|
||||
image: $runtime['image'],
|
||||
source: $deployment->getAttribute('buildPath', ''),
|
||||
source: $source,
|
||||
entrypoint: $deployment->getAttribute('entrypoint', ''),
|
||||
version: $version,
|
||||
path: $path,
|
||||
|
|
|
|||
|
|
@ -477,7 +477,7 @@ class SitesCustomServerTest extends Scope
|
|||
$this->assertNotEmpty($domain);
|
||||
|
||||
$deploymentId = $this->setupDeployment($siteId, [
|
||||
'code' => $this->packageSite('static'),
|
||||
'code' => $this->packageSite('static-single-file'),
|
||||
'activate' => 'true'
|
||||
]);
|
||||
$this->assertNotEmpty($deploymentId);
|
||||
|
|
@ -856,7 +856,7 @@ class SitesCustomServerTest extends Scope
|
|||
|
||||
$deployment = $this->createDeployment($siteId, [
|
||||
'siteId' => $siteId,
|
||||
'code' => $this->packageSite('static'),
|
||||
'code' => $this->packageSite('static-single-file'),
|
||||
'activate' => true,
|
||||
]);
|
||||
|
||||
|
|
@ -874,7 +874,7 @@ class SitesCustomServerTest extends Scope
|
|||
}, 50000, 500);
|
||||
|
||||
$deployment = $this->createDeployment($siteId, [
|
||||
'code' => $this->packageSite('static'),
|
||||
'code' => $this->packageSite('static-single-file'),
|
||||
'activate' => 'false'
|
||||
]);
|
||||
|
||||
|
|
@ -917,7 +917,7 @@ class SitesCustomServerTest extends Scope
|
|||
$this->assertNotNull($siteId);
|
||||
|
||||
$deployment = $this->createDeployment($siteId, [
|
||||
'code' => $this->packageSite('static'),
|
||||
'code' => $this->packageSite('static-single-file'),
|
||||
'activate' => 'false'
|
||||
]);
|
||||
|
||||
|
|
@ -969,7 +969,7 @@ class SitesCustomServerTest extends Scope
|
|||
$this->assertNotNull($siteId);
|
||||
|
||||
$deployment = $this->createDeployment($siteId, [
|
||||
'code' => $this->packageSite('static'),
|
||||
'code' => $this->packageSite('static-single-file'),
|
||||
'activate' => 'false'
|
||||
]);
|
||||
|
||||
|
|
@ -1014,7 +1014,7 @@ class SitesCustomServerTest extends Scope
|
|||
$this->assertNotNull($siteId);
|
||||
|
||||
$deployment = $this->createDeployment($siteId, [
|
||||
'code' => $this->packageSite('static'),
|
||||
'code' => $this->packageSite('static-single-file'),
|
||||
'activate' => 'false'
|
||||
]);
|
||||
|
||||
|
|
@ -1022,7 +1022,7 @@ class SitesCustomServerTest extends Scope
|
|||
$this->assertEquals(202, $deployment['headers']['status-code']);
|
||||
|
||||
$deployment = $this->createDeployment($siteId, [
|
||||
'code' => $this->packageSite('static'),
|
||||
'code' => $this->packageSite('static-single-file'),
|
||||
'activate' => 'false'
|
||||
]);
|
||||
|
||||
|
|
@ -1193,7 +1193,7 @@ class SitesCustomServerTest extends Scope
|
|||
$this->assertNotNull($siteId);
|
||||
|
||||
$deployment = $this->createDeployment($siteId, [
|
||||
'code' => $this->packageSite('static'),
|
||||
'code' => $this->packageSite('static-single-file'),
|
||||
'activate' => 'false'
|
||||
]);
|
||||
|
||||
|
|
@ -1318,7 +1318,7 @@ class SitesCustomServerTest extends Scope
|
|||
$this->assertNotNull($siteId);
|
||||
|
||||
$deployment = $this->createDeployment($siteId, [
|
||||
'code' => $this->packageSite('static'),
|
||||
'code' => $this->packageSite('static-single-file'),
|
||||
'activate' => 'false'
|
||||
]);
|
||||
|
||||
|
|
@ -1818,7 +1818,7 @@ class SitesCustomServerTest extends Scope
|
|||
]);
|
||||
|
||||
$deploymentId = $this->setupDeployment($siteId, [
|
||||
'code' => $this->packageSite('static'),
|
||||
'code' => $this->packageSite('static-single-file'),
|
||||
'activate' => true
|
||||
]);
|
||||
|
||||
|
|
@ -2435,7 +2435,7 @@ class SitesCustomServerTest extends Scope
|
|||
$this->assertNotEmpty($siteId);
|
||||
|
||||
$deploymentId = $this->setupDeployment($siteId, [
|
||||
'code' => $this->packageSite('static'),
|
||||
'code' => $this->packageSite('static-single-file'),
|
||||
'activate' => 'true'
|
||||
]);
|
||||
|
||||
|
|
@ -2477,7 +2477,7 @@ class SitesCustomServerTest extends Scope
|
|||
|
||||
// test canceled deployment error page
|
||||
$deployment = $this->createDeployment($siteId, [
|
||||
'code' => $this->packageSite('static'),
|
||||
'code' => $this->packageSite('static-single-file'),
|
||||
'activate' => 'true'
|
||||
]);
|
||||
$deploymentId = $deployment['body']['$id'] ?? '';
|
||||
|
|
@ -2517,7 +2517,7 @@ class SitesCustomServerTest extends Scope
|
|||
$this->assertStringContainsString('View deployments', $response['body']);
|
||||
|
||||
$deployment = $this->createDeployment($siteId, [
|
||||
'code' => $this->packageSite('astro'),
|
||||
'code' => $this->packageSite('static-single-file'),
|
||||
'activate' => 'true'
|
||||
]);
|
||||
|
||||
|
|
@ -2606,7 +2606,7 @@ class SitesCustomServerTest extends Scope
|
|||
$this->assertNotEmpty($siteId);
|
||||
|
||||
$deployment = $this->createDeployment($siteId, [
|
||||
'code' => $this->packageSite('static'),
|
||||
'code' => $this->packageSite('static-single-file'),
|
||||
'activate' => true
|
||||
]);
|
||||
$this->assertEquals(202, $deployment['headers']['status-code']);
|
||||
|
|
@ -2635,7 +2635,7 @@ class SitesCustomServerTest extends Scope
|
|||
$this->assertNotEmpty($siteId);
|
||||
|
||||
$deployment = $this->createDeployment($siteId, [
|
||||
'code' => $this->packageSite('static'),
|
||||
'code' => $this->packageSite('static-single-file'),
|
||||
'activate' => true
|
||||
]);
|
||||
$this->assertEquals(202, $deployment['headers']['status-code']);
|
||||
|
|
|
|||
Loading…
Reference in a new issue