1
0
Fork 0
mirror of synced 2024-09-29 17:01:37 +13:00

Merge remote-tracking branch 'origin/migrations-backups' into migrations-backups

This commit is contained in:
fogelito 2024-09-01 13:13:16 +03:00
commit ff702d774f
6 changed files with 35 additions and 21 deletions

View file

@ -1,9 +1,5 @@
<?php <?php
const APP_PLATFORM_SERVER = 'server';
const APP_PLATFORM_CLIENT = 'client';
const APP_PLATFORM_CONSOLE = 'console';
return [ return [
APP_PLATFORM_CLIENT => [ APP_PLATFORM_CLIENT => [
'key' => APP_PLATFORM_CLIENT, 'key' => APP_PLATFORM_CLIENT,

View file

@ -142,6 +142,9 @@ const APP_SOCIAL_DEV = 'https://dev.to/appwrite';
const APP_SOCIAL_STACKSHARE = 'https://stackshare.io/appwrite'; const APP_SOCIAL_STACKSHARE = 'https://stackshare.io/appwrite';
const APP_SOCIAL_YOUTUBE = 'https://www.youtube.com/c/appwrite?sub_confirmation=1'; const APP_SOCIAL_YOUTUBE = 'https://www.youtube.com/c/appwrite?sub_confirmation=1';
const APP_HOSTNAME_INTERNAL = 'appwrite'; const APP_HOSTNAME_INTERNAL = 'appwrite';
const APP_PLATFORM_SERVER = 'server';
const APP_PLATFORM_CLIENT = 'client';
const APP_PLATFORM_CONSOLE = 'console';
// Database Reconnect // Database Reconnect
const DATABASE_RECONNECT_SLEEP = 2; const DATABASE_RECONNECT_SLEEP = 2;

View file

@ -82,7 +82,7 @@
}, },
"require-dev": { "require-dev": {
"ext-fileinfo": "*", "ext-fileinfo": "*",
"appwrite/sdk-generator": "0.38.*", "appwrite/sdk-generator": "0.39.*",
"phpunit/phpunit": "9.5.20", "phpunit/phpunit": "9.5.20",
"swoole/ide-helper": "5.1.2", "swoole/ide-helper": "5.1.2",
"textalk/websocket": "1.5.7", "textalk/websocket": "1.5.7",

14
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "b737874b23ae7480c9579c5ee28ad46f", "content-hash": "0e770d4489dbe657c00281b1afd3c0ee",
"packages": [ "packages": [
{ {
"name": "adhocore/jwt", "name": "adhocore/jwt",
@ -3001,16 +3001,16 @@
"packages-dev": [ "packages-dev": [
{ {
"name": "appwrite/sdk-generator", "name": "appwrite/sdk-generator",
"version": "0.38.8", "version": "0.39.18",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/appwrite/sdk-generator.git", "url": "https://github.com/appwrite/sdk-generator.git",
"reference": "6367c57ddbcf7b88cacb900c4fe7ef3f28bf38ef" "reference": "3f12532d3a41f6e3e7528f41c0e79a6d473c4a4c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/6367c57ddbcf7b88cacb900c4fe7ef3f28bf38ef", "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/3f12532d3a41f6e3e7528f41c0e79a6d473c4a4c",
"reference": "6367c57ddbcf7b88cacb900c4fe7ef3f28bf38ef", "reference": "3f12532d3a41f6e3e7528f41c0e79a6d473c4a4c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3046,9 +3046,9 @@
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
"support": { "support": {
"issues": "https://github.com/appwrite/sdk-generator/issues", "issues": "https://github.com/appwrite/sdk-generator/issues",
"source": "https://github.com/appwrite/sdk-generator/tree/0.38.8" "source": "https://github.com/appwrite/sdk-generator/tree/0.39.18"
}, },
"time": "2024-06-17T00:42:27+00:00" "time": "2024-08-27T11:22:14+00:00"
}, },
{ {
"name": "doctrine/deprecations", "name": "doctrine/deprecations",

View file

@ -5,9 +5,11 @@ namespace Appwrite\Platform\Tasks;
use Appwrite\Specification\Format\OpenAPI3; use Appwrite\Specification\Format\OpenAPI3;
use Appwrite\Specification\Format\Swagger2; use Appwrite\Specification\Format\Swagger2;
use Appwrite\Specification\Specification; use Appwrite\Specification\Specification;
use Appwrite\Utopia\Response; use Appwrite\Utopia\Request as AppwriteRequest;
use Appwrite\Utopia\Response as AppwriteResponse;
use Exception; use Exception;
use Swoole\Http\Response as HttpResponse; use Swoole\Http\Request as SwooleRequest;
use Swoole\Http\Response as SwooleResponse;
use Utopia\App; use Utopia\App;
use Utopia\Cache\Adapter\None; use Utopia\Cache\Adapter\None;
use Utopia\Cache\Cache; use Utopia\Cache\Cache;
@ -17,7 +19,8 @@ use Utopia\Database\Adapter\MySQL;
use Utopia\Database\Database; use Utopia\Database\Database;
use Utopia\Platform\Action; use Utopia\Platform\Action;
use Utopia\Registry\Registry; use Utopia\Registry\Registry;
use Utopia\Request; use Utopia\Request as UtopiaRequest;
use Utopia\Response as UtopiaResponse;
use Utopia\System\System; use Utopia\System\System;
use Utopia\Validator\Text; use Utopia\Validator\Text;
use Utopia\Validator\WhiteList; use Utopia\Validator\WhiteList;
@ -29,6 +32,16 @@ class Specs extends Action
return 'specs'; return 'specs';
} }
public function getRequest(): UtopiaRequest
{
return new AppwriteRequest(new SwooleRequest());
}
public function getResponse(): UtopiaResponse
{
return new AppwriteResponse(new SwooleResponse());
}
public function __construct() public function __construct()
{ {
$this $this
@ -42,11 +55,11 @@ class Specs extends Action
public function action(string $version, string $mode, Registry $register): void public function action(string $version, string $mode, Registry $register): void
{ {
$appRoutes = App::getRoutes(); $appRoutes = App::getRoutes();
$response = new Response(new HttpResponse()); $response = $this->getResponse();
$mocks = ($mode === 'mocks'); $mocks = ($mode === 'mocks');
// Mock dependencies // Mock dependencies
App::setResource('request', fn () => new Request()); App::setResource('request', fn () => $this->getRequest());
App::setResource('response', fn () => $response); App::setResource('response', fn () => $response);
App::setResource('dbForConsole', fn () => new Database(new MySQL(''), new Cache(new None()))); App::setResource('dbForConsole', fn () => new Database(new MySQL(''), new Cache(new None())));
App::setResource('dbForProject', fn () => new Database(new MySQL(''), new Cache(new None()))); App::setResource('dbForProject', fn () => new Database(new MySQL(''), new Cache(new None())));
@ -183,10 +196,8 @@ class Specs extends Action
case APP_AUTH_TYPE_SESSION: case APP_AUTH_TYPE_SESSION:
$sdkPlatforms[] = APP_PLATFORM_CLIENT; $sdkPlatforms[] = APP_PLATFORM_CLIENT;
break; break;
case APP_AUTH_TYPE_KEY:
$sdkPlatforms[] = APP_PLATFORM_SERVER;
break;
case APP_AUTH_TYPE_JWT: case APP_AUTH_TYPE_JWT:
case APP_AUTH_TYPE_KEY:
$sdkPlatforms[] = APP_PLATFORM_SERVER; $sdkPlatforms[] = APP_PLATFORM_SERVER;
break; break;
case APP_AUTH_TYPE_ADMIN: case APP_AUTH_TYPE_ADMIN:

View file

@ -122,7 +122,11 @@ class Request extends UtopiaRequest
*/ */
public function getHeaders(): array public function getHeaders(): array
{ {
$headers = $this->generateHeaders(); try {
$headers = $this->generateHeaders();
} catch (\Throwable) {
$headers = [];
}
if (empty($this->swoole->cookie)) { if (empty($this->swoole->cookie)) {
return $headers; return $headers;