Skip to content

Commit 42393ef

Browse files
committed
Initial POC for logging events in WPGraphQL Event Lifecycle.
1 parent f3afa97 commit 42393ef

File tree

7 files changed

+498
-135
lines changed

7 files changed

+498
-135
lines changed

plugins/wpgraphql-logging/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"slevomat/coding-standard": "^8.0",
5454
"szepeviktor/phpstan-wordpress": "^2.0",
5555
"wp-cli/wp-cli-bundle": "^2.8.1",
56+
"wp-graphql/wp-graphql": "^2.3",
5657
"wp-graphql/wp-graphql-testcase": "^3.0.1"
5758
},
5859
"config": {

plugins/wpgraphql-logging/composer.lock

Lines changed: 257 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/wpgraphql-logging/phpcs.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
<exclude-pattern>*/languages/*</exclude-pattern>
1515
<exclude-pattern>*/phpunit.xml*</exclude-pattern>
1616
<exclude-pattern>**/tests/**</exclude-pattern>
17-
<exclude-pattern>*/vendor/*</exclude-pattern>
18-
<exclude-pattern>*/src/Events/QueryEventLifecycle.php</exclude-pattern>
17+
<exclude-pattern>*/vendor/*</exclude-pattern>`
1918

2019
<!-- ===================================== -->
2120
<!-- CLI Arguments & Version Config -->

plugins/wpgraphql-logging/phpstan.neon.dist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,3 @@ parameters:
3030
paths:
3131
- wpgraphql-logging.php
3232
- src/
33-
excludePaths:
34-
- src/Events/QueryEventLifecycle.php

plugins/wpgraphql-logging/psalm.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
<file name="deactivation.php"/>
1616
<file name="vendor/autoload.php"/>
1717
<directory name="src"/>
18-
<ignoreFiles>
19-
<file name="src/Events/QueryEventLifecycle.php"/>
20-
</ignoreFiles>
2118
</projectFiles>
2219

2320

plugins/wpgraphql-logging/src/Events/Events.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,38 @@
99
*/
1010
final class Events {
1111
/**
12+
* WPGraphQL action: do_graphql_request.
13+
*
1214
* Before the request is processed.
1315
*
1416
* @var string
1517
*/
16-
public const PRE_REQUEST = 'pre_request';
18+
public const PRE_REQUEST = 'do_graphql_request';
19+
20+
/**
21+
* WPGraphQL action: graphql_before_execute.
22+
*
23+
* @var string
24+
*/
25+
public const BEFORE_GRAPHQL_EXECUTION = 'graphql_before_execute';
26+
27+
/**
28+
* WPGraphQL action: graphql_execute
29+
*
30+
* After the request is processed.
31+
*
32+
* @var string
33+
*/
34+
public const AFTER_GRAPHQL_EXECUTION = 'graphql_execute';
35+
36+
/**
37+
* WPGraphQL action: graphql_return_response
38+
*
39+
* Before the response is returned to the client.
40+
*
41+
* @var string
42+
*/
43+
public const BEFORE_RESPONSE_RETURNED = 'graphql_return_response';
1744

1845
/**
1946
* After the request is processed.

0 commit comments

Comments
 (0)