-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
801 additions
and
817 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/graphql/src/Builder/Context/HandlerContextOperators.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace LastDragon_ru\LaraASP\GraphQL\Builder\Context; | ||
|
||
use LastDragon_ru\LaraASP\GraphQL\Builder\Operators; | ||
|
||
class HandlerContextOperators { | ||
public function __construct( | ||
public readonly Operators $value, | ||
) { | ||
// empty | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
packages/graphql/src/Builder/Directives/ExtendOperatorsDirective.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace LastDragon_ru\LaraASP\GraphQL\Builder\Directives; | ||
|
||
use GraphQL\Language\DirectiveLocation; | ||
use LastDragon_ru\LaraASP\Core\Utils\Cast; | ||
use Nuwave\Lighthouse\Schema\DirectiveLocator; | ||
use Nuwave\Lighthouse\Schema\Directives\BaseDirective; | ||
use Override; | ||
|
||
use function array_unique; | ||
use function implode; | ||
|
||
abstract class ExtendOperatorsDirective extends BaseDirective { | ||
public function __construct() { | ||
// empty | ||
} | ||
|
||
#[Override] | ||
public static function definition(): string { | ||
$name = DirectiveLocator::directiveName(static::class); | ||
$locations = implode(' | ', array_unique(static::getDirectiveLocations())); | ||
|
||
return <<<GRAPHQL | ||
""" | ||
Extends the list of operators by the operators from the specified | ||
`type` or from the config if `null`. | ||
""" | ||
directive @{$name}(type: String) on {$locations} | ||
GRAPHQL; | ||
} | ||
|
||
/** | ||
* @return non-empty-list<string> | ||
*/ | ||
protected static function getDirectiveLocations(): array { | ||
return [ | ||
DirectiveLocation::SCALAR, | ||
DirectiveLocation::ENUM, | ||
]; | ||
} | ||
|
||
public function getType(): ?string { | ||
return Cast::toStringNullable($this->directiveArgValue('type')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.