@@ -39,9 +39,9 @@ It have to be a function, which will be called each time the gateway have update
39
39
For example, if polling is enabled, this function will be called for each poll.
40
40
41
41
Most Hive Gateway plugins takes an object as a parameter, and expect some common components like a
42
- ` logger ` , a ` pubsub ` , etc... Those components are given in parameters to the ` plugins ` function. It
43
- is advised to spread the plugin's factory context into the plugins options, this way plugins will
44
- have access to all components they need.
42
+ ` log ` , a ` pubsub ` , etc... Those components are given in parameters to the ` plugins ` function. It is
43
+ advised to spread the plugin's factory context into the plugins options, this way plugins will have
44
+ access to all components they need.
45
45
46
46
``` ts filename="gateway.config.ts"
47
47
import { defineConfig } from ' @graphql-hive/gateway'
@@ -172,7 +172,7 @@ Possible usage examples of the hooks are:
172
172
| ` setFetchFn ` | Replace the ` fetch ` function that will be used to make the request. It should be compatible with standard ` fetch ` API. |
173
173
| ` executionRequest ` | Present only if the request is an upstream subgraph request. It contains all information about the upstream query, notably the target subgraph name. |
174
174
| ` requestId ` | A unique ID identifying the client request. This is used to correlate downstream and upstream requests across services. |
175
- | ` logger ` | The logger instance for the specific request that includes the details of the request and the response. |
175
+ | ` log ` | The [ Hive Logger ] ( /docs/ logger) instance for the specific request that includes the details of the request and the response. |
176
176
177
177
##### ` onFetchDone `
178
178
@@ -659,21 +659,21 @@ This hook has a before and after stage. You can return a function to hook into t
659
659
660
660
This hook is mostly used for monitoring and tracing purposes.
661
661
662
- | Field Name | Description |
663
- | -------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
664
- | ` supergraph ` | The GraphQL schema of the supergraph. |
665
- | ` subgraph ` | The name of the subgraph. |
666
- | ` sourceSubschema ` | The schema of the subgraph. |
667
- | ` typeName ` | The name of the type being planed. |
668
- | ` variables ` | The variables provided in the client request. |
669
- | ` fragments ` | The fragments provided in the client request. |
670
- | ` fieldNodes ` | The field nodes of selection set being planned. |
671
- | ` context ` | The GraphQL context object. |
672
- | ` requestId ` | A unique ID identifying the client request. This is used to correlate downstream and upstream requests across services. |
673
- | ` logger ` | The logger instance for the specific request that includes the details of the request and the response. |
674
- | ` info ` | The ` GraphQLResolveInfo ` object of the client query. |
675
- | ` delegationPlanBuilder ` | The delegation plan builder. |
676
- | ` setDelegationPlanBuilder ` | Function to replace the current delegation plan builder. |
662
+ | Field Name | Description |
663
+ | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
664
+ | ` supergraph ` | The GraphQL schema of the supergraph. |
665
+ | ` subgraph ` | The name of the subgraph. |
666
+ | ` sourceSubschema ` | The schema of the subgraph. |
667
+ | ` typeName ` | The name of the type being planed. |
668
+ | ` variables ` | The variables provided in the client request. |
669
+ | ` fragments ` | The fragments provided in the client request. |
670
+ | ` fieldNodes ` | The field nodes of selection set being planned. |
671
+ | ` context ` | The GraphQL context object. |
672
+ | ` requestId ` | A unique ID identifying the client request. This is used to correlate downstream and upstream requests across services. |
673
+ | ` log ` | The [ Hive Logger ] ( /docs/ logger) instance for the specific request that includes the details of the request and the response. |
674
+ | ` info ` | The ` GraphQLResolveInfo ` object of the client query. |
675
+ | ` delegationPlanBuilder ` | The delegation plan builder. |
676
+ | ` setDelegationPlanBuilder ` | Function to replace the current delegation plan builder. |
677
677
678
678
##### ` onDelegationPlanDone `
679
679
@@ -694,21 +694,21 @@ requires multiple stages to be fully resolved.
694
694
This hooks has a before and after stage. You can return a function to hook into the after stage (see
695
695
[ ` onDelegationStageExecuteDone ` ] ( #ondelegationstageexecutedone ) ).
696
696
697
- | Payload Field | Description |
698
- | -------------- | ----------------------------------------------------------------------------------------------------------------------- |
699
- | ` object ` | The object being resolved. |
700
- | ` context ` | The GraphQL context object. |
701
- | ` info ` | The ` GraphQLResolveInfo ` object. |
702
- | ` subgraph ` | The name of the subgraph. |
703
- | ` subschema ` | The schema of the current subgraph. |
704
- | ` selectionSet ` | The selection set node that will be queried. |
705
- | ` key ` | The key for the entity being resolved. |
706
- | ` type ` | The type of the entity being resolved. |
707
- | ` typeName ` | The name of the type being resolved. |
708
- | ` resolver ` | The resolver function for the merged type. |
709
- | ` setResolver ` | Function to set a new resolver for the merged type. |
710
- | ` requestId ` | A unique ID identifying the client request. This is used to correlate downstream and upstream requests across services. |
711
- | ` logger ` | The logger instance for the specific request that includes the details of the request and the response. |
697
+ | Payload Field | Description |
698
+ | -------------- | ---------------------------------------------------------------------------------------------------------------------------- |
699
+ | ` object ` | The object being resolved. |
700
+ | ` context ` | The GraphQL context object. |
701
+ | ` info ` | The ` GraphQLResolveInfo ` object. |
702
+ | ` subgraph ` | The name of the subgraph. |
703
+ | ` subschema ` | The schema of the current subgraph. |
704
+ | ` selectionSet ` | The selection set node that will be queried. |
705
+ | ` key ` | The key for the entity being resolved. |
706
+ | ` type ` | The type of the entity being resolved. |
707
+ | ` typeName ` | The name of the type being resolved. |
708
+ | ` resolver ` | The resolver function for the merged type. |
709
+ | ` setResolver ` | Function to set a new resolver for the merged type. |
710
+ | ` requestId ` | A unique ID identifying the client request. This is used to correlate downstream and upstream requests across services. |
711
+ | ` log ` | The [ Hive Logger ] ( /docs/ logger) instance for the specific request that includes the details of the request and the response. |
712
712
713
713
##### ` onDelegationStageExecuteDone `
714
714
@@ -733,17 +733,17 @@ This hook is invoked for ANY request that is sent to the subgraph.
733
733
You can see [ Prometheus plugin] ( /docs/gateway/authorization-authentication ) for an example of how to
734
734
use this hook.
735
735
736
- | Payload Field | Description |
737
- | --------------------- | ------------------------------------------------------------------------------------------------------- |
738
- | ` subgraph ` | The GraphQL schema of the subgraph. |
739
- | ` subgraphName ` | The name of the subgraph. |
740
- | ` transportEntry ` | The transport entry that will be used to resolve queries for this subgraph |
741
- | ` executionRequest ` | The execution request object containing details of the upstream GraphQL operation. |
742
- | ` setExecutionRequest ` | Function to replace the current execution request. |
743
- | ` executor ` | The executor function used to execute the upstream request. |
744
- | ` setExecutor ` | Function to replace the current executor. |
745
- | ` requestId ` | A unique ID identifying the client request. |
746
- | ` logger ` | The logger instance for the specific request that includes the details of the request and the response. |
736
+ | Payload Field | Description |
737
+ | --------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
738
+ | ` subgraph ` | The GraphQL schema of the subgraph. |
739
+ | ` subgraphName ` | The name of the subgraph. |
740
+ | ` transportEntry ` | The transport entry that will be used to resolve queries for this subgraph |
741
+ | ` executionRequest ` | The execution request object containing details of the upstream GraphQL operation. |
742
+ | ` setExecutionRequest ` | Function to replace the current execution request. |
743
+ | ` executor ` | The executor function used to execute the upstream request. |
744
+ | ` setExecutor ` | Function to replace the current executor. |
745
+ | ` requestId ` | A unique ID identifying the client request. |
746
+ | ` log ` | The [ Hive Logger ] ( /docs/ logger) instance for the specific request that includes the details of the request and the response. |
747
747
748
748
##### ` onSubgraphExecuteDone `
749
749
@@ -1040,7 +1040,7 @@ return a `Promise` if `wrapped()` returns a `Promise`.
1040
1040
1041
1041
### Plugin Context
1042
1042
1043
- Hive Gateway comes with ready-to-use ` logger ` , ` fetch ` , cache storage and etc that are shared across
1043
+ Hive Gateway comes with ready-to-use ` log ` , ` fetch ` , cache storage and etc that are shared across
1044
1044
different components. We'd highly recommend you to use those available context values instead of
1045
1045
creating your own for a specific plugin.
1046
1046
@@ -1050,13 +1050,13 @@ import { defineConfig } from '@graphql-hive/gateway'
1050
1050
export const gatewayConfig = defineConfig ({
1051
1051
plugins({
1052
1052
fetch , // WHATWG compatible Fetch implementation.
1053
- logger , // Logger instance used by Hive Gateway
1053
+ log , // Hive Logger instance used by Hive Gateway
1054
1054
cwd , // Current working directory
1055
1055
pubsub , // PubSub instance used by Hive Gateway
1056
1056
cache // Cache storage used by Hive Gateway
1057
1057
}) {
1058
1058
return [
1059
- useMyPlugin ({ logger , fetch }) // So the plugin can use the shared logger and fetch
1059
+ useMyPlugin ({ log , fetch }) // So the plugin can use the shared logger and fetch
1060
1060
]
1061
1061
}
1062
1062
})
0 commit comments