This commit is contained in:
Kilian Hofmann
2021-06-01 19:55:55 +02:00
parent 052cbe3038
commit d8c489c714
328 changed files with 36645 additions and 0 deletions
@@ -0,0 +1,15 @@
<?php
namespace Nuwave\Lighthouse\Events;
/**
* Fires after a query was resolved.
*
* Listeners of this event may return an instance of
* @see \Nuwave\Lighthouse\Execution\ExtensionsResponse
* that is then added to the response.
*/
class BuildExtensionsResponse
{
//
}
@@ -0,0 +1,32 @@
<?php
namespace Nuwave\Lighthouse\Events;
/**
* Fires before building the AST from the user-defined schema string.
*
* Listeners may return a schema string,
* which is added to the user schema.
*
* Only fires once if schema caching is active.
*/
class BuildSchemaString
{
/**
* The root schema that was defined by the user.
*
* @var string
*/
public $userSchema;
/**
* BuildSchemaString constructor.
*
* @param string $userSchema
* @return void
*/
public function __construct(string $userSchema)
{
$this->userSchema = $userSchema;
}
}
+34
View File
@@ -0,0 +1,34 @@
<?php
namespace Nuwave\Lighthouse\Events;
use Nuwave\Lighthouse\Schema\AST\DocumentAST;
/**
* Fires after the AST was built but before the executable schema is built.
*
* Listeners may mutate the $documentAST and make programmatic
* changes to the schema.
*
* Only fires once if schema caching is active.
*/
class ManipulateAST
{
/**
* The AST that can be manipulated.
*
* @var \Nuwave\Lighthouse\Schema\AST\DocumentAST
*/
public $documentAST;
/**
* BuildSchemaString constructor.
*
* @param \Nuwave\Lighthouse\Schema\AST\DocumentAST $documentAST
* @return void
*/
public function __construct(DocumentAST &$documentAST)
{
$this->documentAST = $documentAST;
}
}
@@ -0,0 +1,32 @@
<?php
namespace Nuwave\Lighthouse\Events;
use GraphQL\Executor\ExecutionResult;
/**
* Fires after resolving each individual query.
*
* This gives listeners an easy way to manipulate the query
* result without worrying about batched execution.
*/
class ManipulateResult
{
/**
* The result of resolving an individual query.
*
* @var \GraphQL\Executor\ExecutionResult
*/
public $result;
/**
* ManipulateResult constructor.
*
* @param \GraphQL\Executor\ExecutionResult $result
* @return void
*/
public function __construct(ExecutionResult &$result)
{
$this->result = $result;
}
}
@@ -0,0 +1,16 @@
<?php
namespace Nuwave\Lighthouse\Events;
/**
* Fires when the directive factory is constructed.
*
* Listeners may return one or more strings that are used as the base
* namespace for locating directives.
*
* @see \Nuwave\Lighthouse\Schema\Factories\DirectiveFactory
*/
class RegisterDirectiveNamespaces
{
//
}
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace Nuwave\Lighthouse\Events;
use Carbon\Carbon;
/**
* Fires right before resolving an individual query.
*
* Might happen multiple times in a single request if
* query batching is used.
*/
class StartExecution
{
/**
* The point in time when the query execution started.
*
* @var \Carbon\Carbon
*/
public $moment;
/**
* StartRequest constructor.
*
* @return void
*/
public function __construct()
{
$this->moment = Carbon::now();
}
}
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace Nuwave\Lighthouse\Events;
use Carbon\Carbon;
use Nuwave\Lighthouse\Execution\GraphQLRequest;
/**
* Fires right after a request reaches the GraphQLController.
*
* Can be used for logging or for measuring and monitoring
* the time a request takes to resolve.
*
* @see \Nuwave\Lighthouse\Support\Http\Controllers\GraphQLController
*/
class StartRequest
{
/**
* GraphQL request instance.
*
* @var \Nuwave\Lighthouse\Execution\GraphQLRequest
*/
public $request;
/**
* The point in time when the request started.
*
* @var \Carbon\Carbon
*/
public $moment;
/**
* StartRequest constructor.
*
* @param \Nuwave\Lighthouse\Execution\GraphQLRequest $request
* @return void
*/
public function __construct(GraphQLRequest $request)
{
$this->request = $request;
$this->moment = Carbon::now();
}
}