Skip to content

Commit bea7739

Browse files
authored
Merge branch '1.9.x' into codex/disable-graphql-functional
2 parents 6d5968e + 76320d6 commit bea7739

9 files changed

Lines changed: 58 additions & 33 deletions

File tree

app/controllers/api/graphql.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ function execute(
231231
$validations = GraphQL::getStandardValidationRules();
232232

233233
if (System::getEnv('_APP_GRAPHQL_INTROSPECTION', 'enabled') === 'disabled') {
234-
$validations[] = new DisableIntrospection();
234+
$validations[] = new DisableIntrospection(DisableIntrospection::ENABLED);
235235
}
236236

237237
if (System::getEnv('_APP_OPTIONS_ABUSE', 'enabled') !== 'disabled') {

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"chillerlan/php-qrcode": "4.3.*",
9393
"adhocore/jwt": "1.1.*",
9494
"spomky-labs/otphp": "11.*",
95-
"webonyx/graphql-php": "14.11.*",
95+
"webonyx/graphql-php": "15.31.*",
9696
"league/csv": "9.14.*",
9797
"enshrined/svg-sanitize": "0.22.*"
9898
},

composer.lock

Lines changed: 34 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Appwrite/GraphQL/Promises/Adapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ abstract public function createRejected(mixed $reason): GQLPromise;
8181
/**
8282
* Create a new promise that resolves when all passed in promises resolve.
8383
*
84-
* @param array $promisesOrValues
84+
* @param iterable $promisesOrValues
8585
* @return GQLPromise
8686
*/
87-
abstract public function all(array $promisesOrValues): GQLPromise;
87+
abstract public function all(iterable $promisesOrValues): GQLPromise;
8888
}

src/Appwrite/GraphQL/Promises/Adapter/Swoole.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ public function createRejected($reason): GQLPromise
3535
return new GQLPromise($promise, $this);
3636
}
3737

38-
public function all(array $promisesOrValues): GQLPromise
38+
public function all(iterable $promisesOrValues): GQLPromise
3939
{
40+
if ($promisesOrValues instanceof \Traversable) {
41+
$promisesOrValues = \iterator_to_array($promisesOrValues);
42+
}
43+
4044
return new GQLPromise(SwoolePromise::all($promisesOrValues), $this);
4145
}
4246
}

src/Appwrite/GraphQL/Types/Assoc.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
namespace Appwrite\GraphQL\Types;
44

55
use GraphQL\Language\AST\Node;
6+
use GraphQL\Language\AST\StringValueNode;
67

78
// https://github.com/webonyx/graphql-php/issues/129#issuecomment-309366803
89
class Assoc extends Json
910
{
10-
public $name = 'Assoc';
11-
public $description = 'The `Assoc` scalar type represents associative array values.';
11+
public string $name = 'Assoc';
12+
public ?string $description = 'The `Assoc` scalar type represents associative array values.';
1213

1314
public function serialize($value)
1415
{
@@ -30,6 +31,10 @@ public function parseValue($value)
3031

3132
public function parseLiteral(Node $valueNode, ?array $variables = null)
3233
{
33-
return \json_decode($valueNode->value, true);
34+
if ($valueNode instanceof StringValueNode) {
35+
return \json_decode($valueNode->value, true);
36+
}
37+
38+
return parent::parseLiteral($valueNode, $variables);
3439
}
3540
}

src/Appwrite/GraphQL/Types/InputFile.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
class InputFile extends ScalarType
1010
{
11-
public $name = 'InputFile';
12-
public $description = 'The `InputFile` special type represents a file to be uploaded in the same HTTP request as specified by
11+
public string $name = 'InputFile';
12+
public ?string $description = 'The `InputFile` special type represents a file to be uploaded in the same HTTP request as specified by
1313
[graphql-multipart-request-spec](https://github.com/jaydenseric/graphql-multipart-request-spec).';
1414

1515
public function serialize($value)

src/Appwrite/GraphQL/Types/Json.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
// https://github.com/webonyx/graphql-php/issues/129#issuecomment-309366803
1515
class Json extends ScalarType
1616
{
17-
public $name = 'Json';
18-
public $description = 'The `JSON` scalar type represents JSON values as specified by
17+
public string $name = 'Json';
18+
public ?string $description = 'The `JSON` scalar type represents JSON values as specified by
1919
[ECMA-404](https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).';
2020

2121
public function serialize($value)

tests/unit/GraphQL/BuilderTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Appwrite\GraphQL\Types\Mapper;
66
use Appwrite\Utopia\Response;
7+
use GraphQL\Type\Definition\NamedType;
78
use PHPUnit\Framework\TestCase;
89
use Swoole\Http\Response as SwooleResponse;
910

@@ -24,6 +25,7 @@ public function testCreateTypeMapping()
2425
{
2526
$model = $this->response->getModel(Response::MODEL_TABLE);
2627
$type = Mapper::model(\ucfirst($model->getType()));
27-
$this->assertEquals('Table', $type->name);
28+
$this->assertInstanceOf(NamedType::class, $type);
29+
$this->assertEquals('Table', $type->name());
2830
}
2931
}

0 commit comments

Comments
 (0)