Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
graphql_fragment_include
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
graphql_fragment_include
Commits
4508fb2c
Commit
4508fb2c
authored
4 years ago
by
Alberto Silva
Browse files
Options
Downloads
Patches
Plain Diff
Add support for persisted queries [Issue 3161807]
parent
c6590329
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/GraphQL/Execution/QueryProcessor.php
+21
-11
21 additions, 11 deletions
src/GraphQL/Execution/QueryProcessor.php
with
21 additions
and
11 deletions
src/GraphQL/Execution/QueryProcessor.php
+
21
−
11
View file @
4508fb2c
...
@@ -7,12 +7,18 @@ use Drupal\Core\Cache\Context\CacheContextsManager;
...
@@ -7,12 +7,18 @@ use Drupal\Core\Cache\Context\CacheContextsManager;
use
Drupal\graphql\GraphQL\Execution\QueryProcessor
as
BaseQueryProcessor
;
use
Drupal\graphql\GraphQL\Execution\QueryProcessor
as
BaseQueryProcessor
;
use
Drupal\graphql\Plugin\SchemaPluginManager
;
use
Drupal\graphql\Plugin\SchemaPluginManager
;
use
Drupal\graphql_fragment_include
\GraphQL\Fragment\GraphQLFragmentLoaderInterface
;
use
Drupal\graphql_fragment_include
\GraphQL\Fragment\GraphQLFragmentLoaderInterface
;
use
GraphQL\Executor\Promise\PromiseAdapter
;
use
GraphQL\Language\AST\DocumentNode
;
use
GraphQL\Server\OperationParams
;
use
GraphQL\Server\OperationParams
;
use
GraphQL\Server\ServerConfig
;
use
GraphQL\Server\ServerConfig
;
use
Symfony\Component\HttpFoundation\RequestStack
;
use
Symfony\Component\HttpFoundation\RequestStack
;
/**
/**
* QueryProcessor service overriding BaseQueryProcessor.
* QueryProcessor service overriding BaseQueryProcessor.
*
* This class overrides both executeCacheableOperation() and
* executeUncacheableOperation() to be able to support persisted and
* non-persisted querries.
*/
*/
class
QueryProcessor
extends
BaseQueryProcessor
{
class
QueryProcessor
extends
BaseQueryProcessor
{
...
@@ -49,23 +55,27 @@ class QueryProcessor extends BaseQueryProcessor {
...
@@ -49,23 +55,27 @@ class QueryProcessor extends BaseQueryProcessor {
}
}
/**
/**
* Preprocesses and execute a single query.
* {@inheritdoc}
*
*/
* @param \GraphQL\Server\ServerConfig $config
protected
function
executeCacheableOperation
(
PromiseAdapter
$adapter
,
ServerConfig
$config
,
OperationParams
$params
,
DocumentNode
$document
,
$validate
=
TRUE
)
{
* ServerConfig.
// Load GraphQL fragments.
* @param \GraphQL\Server\OperationParams $params
if
(
$params
->
query
)
{
* OperationParams.
$params
->
query
=
$this
->
graphQLFragmentLoader
->
loadFragments
(
$params
->
query
);
*
}
* @return mixed
* The result.
return
parent
::
executeCacheableOperation
(
$adapter
,
$config
,
$params
,
$document
,
$validate
);
}
/**
* {@inheritdoc}
*/
*/
p
ublic
function
execute
Single
(
ServerConfig
$config
,
OperationParams
$params
)
{
p
rotected
function
execute
UncachableOperation
(
PromiseAdapter
$adapter
,
ServerConfig
$config
,
OperationParams
$params
,
DocumentNode
$document
,
$validate
=
TRUE
)
{
// Load GraphQL fragments.
// Load GraphQL fragments.
if
(
$params
->
query
)
{
if
(
$params
->
query
)
{
$params
->
query
=
$this
->
graphQLFragmentLoader
->
loadFragments
(
$params
->
query
);
$params
->
query
=
$this
->
graphQLFragmentLoader
->
loadFragments
(
$params
->
query
);
}
}
return
parent
::
execute
Single
(
$config
,
$params
);
return
parent
::
execute
UncachableOperation
(
$adapter
,
$config
,
$params
,
$document
,
$validate
);
}
}
}
}
This diff is collapsed.
Click to expand it.
Alberto Silva
@asilgag
mentioned in commit
16b4e6f3
·
4 years ago
mentioned in commit
16b4e6f3
mentioned in commit 16b4e6f33396313e7dcffec4955888e4edc95e77
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment