Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
spawnia committed Dec 1, 2024
1 parent 9d1e54f commit 85bd42f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ You can find and compare releases at the [GitHub release page](https://github.co

## Unreleased

## v6.46.0

### Added

- Expose query complexity score in lifecycle event `BuildExtensionsResponse` https://github.com/nuwave/lighthouse/pull/2637

## v6.45.1

### Fixed
Expand Down
24 changes: 14 additions & 10 deletions docs/6/api-reference/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,31 +175,35 @@ class StartExecution
### BuildExtensionsResponse

```php
use GraphQL\Executor\ExecutionResult;

/**
* Fires after a query was resolved.
*
* Listeners may return a @see \Nuwave\Lighthouse\Execution\ExtensionsResponse
* to include in the response.
*/
class BuildExtensionsResponse {}
class BuildExtensionsResponse
{
public function __construct(
/** The result of resolving a single operation. */
public ExecutionResult $result,
/** The calculated query complexity score of the operation, only available if the validation rule is enabled. */
public ?int $queryComplexity,
) {}
}
```

```php
namespace Nuwave\Lighthouse\Execution;

/**
* May be returned from listeners of @see \Nuwave\Lighthouse\Events\BuildExtensionsResponse.
*/
/** May be returned from listeners of @see \Nuwave\Lighthouse\Events\BuildExtensionsResponse. */
class ExtensionsResponse
{
public function __construct(
/**
* Will be used as the key in the response map.
*/
/** Will be used as the key in the response map. */
public string $key,
/**
* JSON-encodable content of the extension.
*/
/** JSON-encodable content of the extension. */
public mixed $content,
) {}
}
Expand Down

0 comments on commit 85bd42f

Please sign in to comment.