Merge branch '1.6.x' of https://github.com/appwrite/appwrite into fix-flaky-tests

This commit is contained in:
loks0n 2024-10-02 11:54:42 +01:00
commit ff174238e8
24 changed files with 81 additions and 55 deletions

View file

@ -9405,7 +9405,7 @@
"responseBody": {
"type": "string",
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
"x-example": "Developers are awesome."
"x-example": ""
},
"responseHeaders": {
"type": "array",

View file

@ -35589,7 +35589,7 @@
"responseBody": {
"type": "string",
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
"x-example": "Developers are awesome."
"x-example": ""
},
"responseHeaders": {
"type": "array",

View file

@ -25966,7 +25966,7 @@
"responseBody": {
"type": "string",
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
"x-example": "Developers are awesome."
"x-example": ""
},
"responseHeaders": {
"type": "array",

View file

@ -9405,7 +9405,7 @@
"responseBody": {
"type": "string",
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
"x-example": "Developers are awesome."
"x-example": ""
},
"responseHeaders": {
"type": "array",

View file

@ -35589,7 +35589,7 @@
"responseBody": {
"type": "string",
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
"x-example": "Developers are awesome."
"x-example": ""
},
"responseHeaders": {
"type": "array",

View file

@ -25966,7 +25966,7 @@
"responseBody": {
"type": "string",
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
"x-example": "Developers are awesome."
"x-example": ""
},
"responseHeaders": {
"type": "array",

View file

@ -9589,9 +9589,9 @@
"format": "int32"
},
"responseBody": {
"type": "string",
"type": "payload",
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
"x-example": "Developers are awesome."
"x-example": ""
},
"responseHeaders": {
"type": "array",

View file

@ -36104,9 +36104,9 @@
"format": "int32"
},
"responseBody": {
"type": "string",
"type": "payload",
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
"x-example": "Developers are awesome."
"x-example": ""
},
"responseHeaders": {
"type": "array",

View file

@ -26458,9 +26458,9 @@
"format": "int32"
},
"responseBody": {
"type": "string",
"type": "payload",
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
"x-example": "Developers are awesome."
"x-example": ""
},
"responseHeaders": {
"type": "array",

View file

@ -9589,9 +9589,9 @@
"format": "int32"
},
"responseBody": {
"type": "string",
"type": "payload",
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
"x-example": "Developers are awesome."
"x-example": ""
},
"responseHeaders": {
"type": "array",

View file

@ -36104,9 +36104,9 @@
"format": "int32"
},
"responseBody": {
"type": "string",
"type": "payload",
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
"x-example": "Developers are awesome."
"x-example": ""
},
"responseHeaders": {
"type": "array",

View file

@ -26458,9 +26458,9 @@
"format": "int32"
},
"responseBody": {
"type": "string",
"type": "payload",
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
"x-example": "Developers are awesome."
"x-example": ""
},
"responseHeaders": {
"type": "array",

View file

@ -6,6 +6,8 @@ return [
'image/gif',
'image/png',
'image/webp',
// 'image/heic',
'image/avif',
// Video Files
'video/mp4',

View file

@ -6,4 +6,7 @@ return [ // Accepted outputs files
'gif' => 'image/gif',
'png' => 'image/png',
'webp' => 'image/webp',
// 'heic' => 'image/heic',
// 'heics' => 'image/heic',
'avif' => 'image/avif'
];

View file

@ -889,10 +889,6 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview')
throw new Exception(Exception::STORAGE_FILE_NOT_FOUND);
}
if ((\strpos($request->getAccept(), 'image/webp') === false) && ('webp' === $output)) { // Fallback webp to jpeg when no browser support
$output = 'jpg';
}
$inputs = Config::getParam('storage-inputs');
$outputs = Config::getParam('storage-outputs');
$fileLogos = Config::getParam('storage-logos');

View file

@ -56,7 +56,7 @@
"utopia-php/dsn": "0.2.1",
"utopia-php/framework": "0.33.*",
"utopia-php/fetch": "0.2.*",
"utopia-php/image": "0.6.*",
"utopia-php/image": "0.7.*",
"utopia-php/locale": "0.4.*",
"utopia-php/logger": "0.6.*",
"utopia-php/messaging": "0.12.*",

16
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "1981099f3c47f5536298222ba9b0b994",
"content-hash": "66e31af1f7d0d1617694a1c5a975f887",
"packages": [
{
"name": "adhocore/jwt",
@ -1970,21 +1970,21 @@
},
{
"name": "utopia-php/image",
"version": "0.6.1",
"version": "0.7.0",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/image.git",
"reference": "2d74c27e69e65a93cf94a16586598a04fe435bf0"
"reference": "fcea143edbad524bf871ddbebe801d981f91f181"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/image/zipball/2d74c27e69e65a93cf94a16586598a04fe435bf0",
"reference": "2d74c27e69e65a93cf94a16586598a04fe435bf0",
"url": "https://api.github.com/repos/utopia-php/image/zipball/fcea143edbad524bf871ddbebe801d981f91f181",
"reference": "fcea143edbad524bf871ddbebe801d981f91f181",
"shasum": ""
},
"require": {
"ext-imagick": "*",
"php": ">=8.0"
"php": ">=8.1"
},
"require-dev": {
"laravel/pint": "1.2.*",
@ -2012,9 +2012,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/image/issues",
"source": "https://github.com/utopia-php/image/tree/0.6.1"
"source": "https://github.com/utopia-php/image/tree/0.7.0"
},
"time": "2024-02-05T13:31:44+00:00"
"time": "2024-10-02T05:45:38+00:00"
},
{
"name": "utopia-php/locale",

View file

@ -50,6 +50,7 @@ class Mapper
$defaults = [
'boolean' => Type::boolean(),
'string' => Type::string(),
'payload' => Type::string(),
'integer' => Type::int(),
'double' => Type::float(),
'datetime' => Type::string(),

View file

@ -489,11 +489,29 @@ class Messaging extends Action
return match ($provider->getAttribute('provider')) {
'mock' => new Mock('username', 'password'),
'twilio' => new Twilio($credentials['accountSid'], $credentials['authToken'], null, isset($credentials['messagingServiceSid']) ? $credentials['messagingServiceSid'] : null),
'textmagic' => new TextMagic($credentials['username'], $credentials['apiKey']),
'telesign' => new Telesign($credentials['customerId'], $credentials['apiKey']),
'msg91' => new Msg91($credentials['senderId'], $credentials['authKey'], $credentials['templateId']),
'vonage' => new Vonage($credentials['apiKey'], $credentials['apiSecret']),
'twilio' => new Twilio(
$credentials['accountSid'] ?? '',
$credentials['authToken'] ?? '',
null,
$credentials['messagingServiceSid'] ?? null
),
'textmagic' => new TextMagic(
$credentials['username'] ?? '',
$credentials['apiKey'] ?? ''
),
'telesign' => new Telesign(
$credentials['customerId'] ?? '',
$credentials['apiKey'] ?? ''
),
'msg91' => new Msg91(
$credentials['senderId'] ?? '',
$credentials['authKey'] ?? '',
$credentials['templateId'] ?? ''
),
'vonage' => new Vonage(
$credentials['apiKey'] ?? '',
$credentials['apiSecret'] ?? ''
),
default => null
};
}
@ -506,11 +524,11 @@ class Messaging extends Action
return match ($provider->getAttribute('provider')) {
'mock' => new Mock('username', 'password'),
'apns' => new APNS(
$credentials['authKey'],
$credentials['authKeyId'],
$credentials['teamId'],
$credentials['bundleId'],
$options['sandbox']
$credentials['authKey'] ?? '',
$credentials['authKeyId'] ?? '',
$credentials['teamId'] ?? '',
$credentials['bundleId'] ?? '',
$options['sandbox'] ?? false
),
'fcm' => new FCM(\json_encode($credentials['serviceAccountJSON'])),
default => null
@ -521,24 +539,25 @@ class Messaging extends Action
{
$credentials = $provider->getAttribute('credentials', []);
$options = $provider->getAttribute('options', []);
$apiKey = $credentials['apiKey'] ?? '';
return match ($provider->getAttribute('provider')) {
'mock' => new Mock('username', 'password'),
'smtp' => new SMTP(
$credentials['host'],
$credentials['port'],
$credentials['username'],
$credentials['password'],
$options['encryption'],
$options['autoTLS'],
$options['mailer'],
$credentials['host'] ?? '',
$credentials['port'] ?? 25,
$credentials['username'] ?? '',
$credentials['password'] ?? '',
$options['encryption'] ?? '',
$options['autoTLS'] ?? false,
$options['mailer'] ?? '',
),
'mailgun' => new Mailgun(
$credentials['apiKey'],
$credentials['domain'],
$credentials['isEuRegion']
$apiKey,
$credentials['domain'] ?? '',
$credentials['isEuRegion'] ?? false
),
'sendgrid' => new Sendgrid($credentials['apiKey']),
'sendgrid' => new Sendgrid($apiKey),
default => null
};
}

View file

@ -549,6 +549,7 @@ class OpenAPI3 extends Format
switch ($rule['type']) {
case 'string':
case 'datetime':
case 'payload':
$type = 'string';
break;

View file

@ -585,6 +585,10 @@ class Swagger2 extends Format
$type = 'boolean';
break;
case 'payload':
$type = 'payload';
break;
default:
$type = 'object';
$rule['type'] = ($rule['type']) ?: 'none';

View file

@ -14,6 +14,7 @@ abstract class Model
public const TYPE_DATETIME = 'datetime';
public const TYPE_DATETIME_EXAMPLE = '2020-10-15T06:38:00.000+00:00';
public const TYPE_RELATIONSHIP = 'relationship';
public const TYPE_PAYLOAD = 'payload';
/**
* @var bool

View file

@ -81,10 +81,9 @@ class Execution extends Model
'example' => 200,
])
->addRule('responseBody', [
'type' => self::TYPE_STRING,
'type' => self::TYPE_PAYLOAD,
'description' => 'HTTP response body. This will return empty unless execution is created as synchronous.',
'default' => '',
'example' => 'Developers are awesome.',
])
->addRule('responseHeaders', [
'type' => Response::MODEL_HEADERS,

View file

@ -133,7 +133,7 @@ class HTTPTest extends Scope
$this->assertEquals(200, $response['headers']['status-code']);
// looks like recent change in the validator
$this->assertTrue(empty($response['body']['schemaValidationMessages']));
$this->assertEmpty($response['body']['schemaValidationMessages'], 'Schema validation failed for ' . $file . ': ' . json_encode($response['body']['schemaValidationMessages'], JSON_PRETTY_PRINT));
}
}