@graphql-hive/gateway-runtime 2.4.0-alpha-fbc61142c267103149e69b60daf77fcbe04389c9 → 2.4.0-alpha-c1d86e45362062c4112896e4bb5d2fab0aea0a3a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -30
- package/dist/index.cjs +54 -3
- package/dist/index.js +54 -3
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,35 +1,15 @@
|
|
|
1
1
|
# @graphql-hive/gateway-runtime
|
|
2
2
|
|
|
3
|
-
## 2.4.0-alpha-
|
|
3
|
+
## 2.4.0-alpha-c1d86e45362062c4112896e4bb5d2fab0aea0a3a
|
|
4
4
|
### Minor Changes
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
- [#
|
|
9
|
-
|
|
10
|
-
Errors contains in the result of a graphql operation are now reported as standalone OpenTelemetry
|
|
11
|
-
Events (name `graphql.error`) instead of OpenTelemetry Exceptions.
|
|
12
|
-
|
|
13
|
-
This is aligned with the guidance of the Graphql OpenTelemetry working group.
|
|
14
|
-
|
|
15
|
-
It allows to add more graphql specific attributes to errors reported in a response:
|
|
16
|
-
|
|
17
|
-
- `message`: The error message
|
|
18
|
-
- `path`: The path in the operation document from which the error originated
|
|
19
|
-
- `locations`: The list of related locations in the document source
|
|
20
|
-
- `coordinate`: The schema coordinate of the resolver which is the source of the error
|
|
21
|
-
|
|
22
|
-
This brings the experimental support of the `coordinate` error attribute in the Yoga Runtime. For
|
|
23
|
-
security reason, this attribute is purposefully not serialized, to avoid leaking schema information
|
|
24
|
-
to clients.
|
|
25
|
-
|
|
26
|
-
### Patch Changes
|
|
8
|
+
- [#1742](https://github.com/graphql-hive/gateway/pull/1742) [`2aa6bdb`](https://github.com/graphql-hive/gateway/commit/2aa6bdb47f26b1865de557b081ec414dcceda202) Thanks [@ardatan](https://github.com/ardatan)! - New `onQueryPlan` hook to handle query planning with Rust QP
|
|
27
9
|
|
|
28
10
|
|
|
11
|
+
### Patch Changes
|
|
29
12
|
|
|
30
|
-
- [#1636](https://github.com/graphql-hive/gateway/pull/1636) [`173556a`](https://github.com/graphql-hive/gateway/commit/173556ade3db9c2a959fb707edcc6289d2a989ab) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - dependencies updates:
|
|
31
|
-
|
|
32
|
-
- Updated dependency [`graphql-yoga@^5.17.0` ↗︎](https://www.npmjs.com/package/graphql-yoga/v/5.17.0) (from `^5.16.2`, in `dependencies`)
|
|
33
13
|
|
|
34
14
|
|
|
35
15
|
- [#1725](https://github.com/graphql-hive/gateway/pull/1725) [`0ded04f`](https://github.com/graphql-hive/gateway/commit/0ded04f56d9d9dea8c412e2e320fb89815108362) Thanks [@dependabot](https://github.com/apps/dependabot)! - dependencies updates:
|
|
@@ -46,14 +26,14 @@
|
|
|
46
26
|
- [#1740](https://github.com/graphql-hive/gateway/pull/1740) [`9cfe2a5`](https://github.com/graphql-hive/gateway/commit/9cfe2a555fcbc9a70ba04b32d6844a7a795de624) Thanks [@dependabot](https://github.com/apps/dependabot)! - dependencies updates:
|
|
47
27
|
|
|
48
28
|
- Updated dependency [`@graphql-yoga/plugin-apollo-usage-report@^0.12.0` ↗︎](https://www.npmjs.com/package/@graphql-yoga/plugin-apollo-usage-report/v/0.12.0) (from `^0.11.2`, in `dependencies`)
|
|
49
|
-
- Updated dependencies [[`
|
|
50
|
-
- @graphql-mesh/fusion-runtime@1.6.0-alpha-
|
|
51
|
-
- @graphql-tools/stitch@10.1.4-alpha-
|
|
52
|
-
- @graphql-tools/wrap@11.1.0-alpha-
|
|
53
|
-
- @graphql-tools/delegate@12.0.0-alpha-
|
|
29
|
+
- Updated dependencies [[`2aa6bdb`](https://github.com/graphql-hive/gateway/commit/2aa6bdb47f26b1865de557b081ec414dcceda202), [`55173a5`](https://github.com/graphql-hive/gateway/commit/55173a55344a07fdf9531efcbaa4cb142fff655e), [`bc6cddd`](https://github.com/graphql-hive/gateway/commit/bc6cddd1c53a012dd02a1d8a7217a28e65cc6ae9), [`bc6cddd`](https://github.com/graphql-hive/gateway/commit/bc6cddd1c53a012dd02a1d8a7217a28e65cc6ae9), [`1dbc653`](https://github.com/graphql-hive/gateway/commit/1dbc6536cb992a705cac7894acca6fe5431b72de), [`bc6cddd`](https://github.com/graphql-hive/gateway/commit/bc6cddd1c53a012dd02a1d8a7217a28e65cc6ae9)]:
|
|
30
|
+
- @graphql-mesh/fusion-runtime@1.6.0-alpha-c1d86e45362062c4112896e4bb5d2fab0aea0a3a
|
|
31
|
+
- @graphql-tools/stitch@10.1.4-alpha-c1d86e45362062c4112896e4bb5d2fab0aea0a3a
|
|
32
|
+
- @graphql-tools/wrap@11.1.0-alpha-c1d86e45362062c4112896e4bb5d2fab0aea0a3a
|
|
33
|
+
- @graphql-tools/delegate@12.0.0-alpha-c1d86e45362062c4112896e4bb5d2fab0aea0a3a
|
|
54
34
|
- @graphql-mesh/hmac-upstream-signature@2.0.8
|
|
55
|
-
- @graphql-tools/federation@4.2.4-alpha-
|
|
56
|
-
- @graphql-tools/batch-delegate@10.0.6-alpha-
|
|
35
|
+
- @graphql-tools/federation@4.2.4-alpha-c1d86e45362062c4112896e4bb5d2fab0aea0a3a
|
|
36
|
+
- @graphql-tools/batch-delegate@10.0.6-alpha-c1d86e45362062c4112896e4bb5d2fab0aea0a3a
|
|
57
37
|
|
|
58
38
|
## 2.3.5
|
|
59
39
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -143,8 +143,7 @@ const getExecuteFnFromExecutor = utils.memoize1(
|
|
|
143
143
|
operationName: args.operationName ?? void 0,
|
|
144
144
|
rootValue: args.rootValue,
|
|
145
145
|
context: args.contextValue,
|
|
146
|
-
signal: args.signal
|
|
147
|
-
schemaCoordinateInErrors: args.schemaCoordinateInErrors
|
|
146
|
+
signal: args.signal
|
|
148
147
|
});
|
|
149
148
|
};
|
|
150
149
|
}
|
|
@@ -1362,6 +1361,52 @@ function usePropagateHeaders(opts) {
|
|
|
1362
1361
|
};
|
|
1363
1362
|
}
|
|
1364
1363
|
|
|
1364
|
+
function useMaybeQueryPlanDebug({
|
|
1365
|
+
log
|
|
1366
|
+
}) {
|
|
1367
|
+
let activePlugin;
|
|
1368
|
+
return {
|
|
1369
|
+
onPluginInit({ plugins }) {
|
|
1370
|
+
let shouldLog = false;
|
|
1371
|
+
log.debug(() => shouldLog = true);
|
|
1372
|
+
if (shouldLog) {
|
|
1373
|
+
activePlugin = useQueryPlanDebug();
|
|
1374
|
+
plugins.push(
|
|
1375
|
+
// @ts-expect-error TODO: fix types
|
|
1376
|
+
activePlugin
|
|
1377
|
+
);
|
|
1378
|
+
} else if (activePlugin) {
|
|
1379
|
+
const index = plugins.indexOf(
|
|
1380
|
+
// @ts-expect-error TODO: fix types
|
|
1381
|
+
activePlugin
|
|
1382
|
+
);
|
|
1383
|
+
if (
|
|
1384
|
+
// must be
|
|
1385
|
+
index > -1
|
|
1386
|
+
) {
|
|
1387
|
+
plugins.splice(index, 1);
|
|
1388
|
+
}
|
|
1389
|
+
activePlugin = void 0;
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
};
|
|
1393
|
+
}
|
|
1394
|
+
function useQueryPlanDebug() {
|
|
1395
|
+
return {
|
|
1396
|
+
onQueryPlan({ executionRequest }) {
|
|
1397
|
+
return ({ queryPlan }) => {
|
|
1398
|
+
executionRequest.context?.log.debug(
|
|
1399
|
+
{
|
|
1400
|
+
queryPlan,
|
|
1401
|
+
operationName: executionRequest.operationName || "Anonymous"
|
|
1402
|
+
},
|
|
1403
|
+
`[useQueryPlanDebug] `
|
|
1404
|
+
);
|
|
1405
|
+
};
|
|
1406
|
+
}
|
|
1407
|
+
};
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1365
1410
|
const defaultGenerateRequestId = ({
|
|
1366
1411
|
fetchAPI = globalThis
|
|
1367
1412
|
}) => fetchAPI.crypto.randomUUID();
|
|
@@ -2011,6 +2056,7 @@ function createGatewayRuntime(config) {
|
|
|
2011
2056
|
const onDelegateHooks = [];
|
|
2012
2057
|
const onDelegationPlanHooks = [];
|
|
2013
2058
|
const onDelegationStageExecuteHooks = [];
|
|
2059
|
+
const onQueryPlanHooks = [];
|
|
2014
2060
|
let unifiedGraph;
|
|
2015
2061
|
let schemaInvalidator;
|
|
2016
2062
|
let getSchema = () => unifiedGraph;
|
|
@@ -2476,6 +2522,7 @@ function createGatewayRuntime(config) {
|
|
|
2476
2522
|
onSubgraphExecuteHooks,
|
|
2477
2523
|
onDelegationPlanHooks,
|
|
2478
2524
|
onDelegationStageExecuteHooks,
|
|
2525
|
+
onQueryPlanHooks,
|
|
2479
2526
|
additionalTypeDefs: config.additionalTypeDefs,
|
|
2480
2527
|
additionalResolvers: config.additionalResolvers,
|
|
2481
2528
|
instrumentation: () => instrumentation,
|
|
@@ -2563,6 +2610,9 @@ function createGatewayRuntime(config) {
|
|
|
2563
2610
|
if (plugin.onCacheDelete) {
|
|
2564
2611
|
onCacheDeleteHooks.push(plugin.onCacheDelete);
|
|
2565
2612
|
}
|
|
2613
|
+
if (plugin.onQueryPlan) {
|
|
2614
|
+
onQueryPlanHooks.push(plugin.onQueryPlan);
|
|
2615
|
+
}
|
|
2566
2616
|
}
|
|
2567
2617
|
}
|
|
2568
2618
|
};
|
|
@@ -2774,7 +2824,8 @@ function createGatewayRuntime(config) {
|
|
|
2774
2824
|
useSubgraphExecuteDebug(),
|
|
2775
2825
|
useFetchDebug(),
|
|
2776
2826
|
useMaybeDelegationPlanDebug({ log: configContext.log }),
|
|
2777
|
-
useCacheDebug({ log: configContext.log })
|
|
2827
|
+
useCacheDebug({ log: configContext.log }),
|
|
2828
|
+
useMaybeQueryPlanDebug({ log: configContext.log })
|
|
2778
2829
|
);
|
|
2779
2830
|
const yoga = graphqlYoga.createYoga({
|
|
2780
2831
|
// @ts-expect-error Types???
|
package/dist/index.js
CHANGED
|
@@ -142,8 +142,7 @@ const getExecuteFnFromExecutor = memoize1(
|
|
|
142
142
|
operationName: args.operationName ?? void 0,
|
|
143
143
|
rootValue: args.rootValue,
|
|
144
144
|
context: args.contextValue,
|
|
145
|
-
signal: args.signal
|
|
146
|
-
schemaCoordinateInErrors: args.schemaCoordinateInErrors
|
|
145
|
+
signal: args.signal
|
|
147
146
|
});
|
|
148
147
|
};
|
|
149
148
|
}
|
|
@@ -1361,6 +1360,52 @@ function usePropagateHeaders(opts) {
|
|
|
1361
1360
|
};
|
|
1362
1361
|
}
|
|
1363
1362
|
|
|
1363
|
+
function useMaybeQueryPlanDebug({
|
|
1364
|
+
log
|
|
1365
|
+
}) {
|
|
1366
|
+
let activePlugin;
|
|
1367
|
+
return {
|
|
1368
|
+
onPluginInit({ plugins }) {
|
|
1369
|
+
let shouldLog = false;
|
|
1370
|
+
log.debug(() => shouldLog = true);
|
|
1371
|
+
if (shouldLog) {
|
|
1372
|
+
activePlugin = useQueryPlanDebug();
|
|
1373
|
+
plugins.push(
|
|
1374
|
+
// @ts-expect-error TODO: fix types
|
|
1375
|
+
activePlugin
|
|
1376
|
+
);
|
|
1377
|
+
} else if (activePlugin) {
|
|
1378
|
+
const index = plugins.indexOf(
|
|
1379
|
+
// @ts-expect-error TODO: fix types
|
|
1380
|
+
activePlugin
|
|
1381
|
+
);
|
|
1382
|
+
if (
|
|
1383
|
+
// must be
|
|
1384
|
+
index > -1
|
|
1385
|
+
) {
|
|
1386
|
+
plugins.splice(index, 1);
|
|
1387
|
+
}
|
|
1388
|
+
activePlugin = void 0;
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1393
|
+
function useQueryPlanDebug() {
|
|
1394
|
+
return {
|
|
1395
|
+
onQueryPlan({ executionRequest }) {
|
|
1396
|
+
return ({ queryPlan }) => {
|
|
1397
|
+
executionRequest.context?.log.debug(
|
|
1398
|
+
{
|
|
1399
|
+
queryPlan,
|
|
1400
|
+
operationName: executionRequest.operationName || "Anonymous"
|
|
1401
|
+
},
|
|
1402
|
+
`[useQueryPlanDebug] `
|
|
1403
|
+
);
|
|
1404
|
+
};
|
|
1405
|
+
}
|
|
1406
|
+
};
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1364
1409
|
const defaultGenerateRequestId = ({
|
|
1365
1410
|
fetchAPI = globalThis
|
|
1366
1411
|
}) => fetchAPI.crypto.randomUUID();
|
|
@@ -2010,6 +2055,7 @@ function createGatewayRuntime(config) {
|
|
|
2010
2055
|
const onDelegateHooks = [];
|
|
2011
2056
|
const onDelegationPlanHooks = [];
|
|
2012
2057
|
const onDelegationStageExecuteHooks = [];
|
|
2058
|
+
const onQueryPlanHooks = [];
|
|
2013
2059
|
let unifiedGraph;
|
|
2014
2060
|
let schemaInvalidator;
|
|
2015
2061
|
let getSchema = () => unifiedGraph;
|
|
@@ -2475,6 +2521,7 @@ function createGatewayRuntime(config) {
|
|
|
2475
2521
|
onSubgraphExecuteHooks,
|
|
2476
2522
|
onDelegationPlanHooks,
|
|
2477
2523
|
onDelegationStageExecuteHooks,
|
|
2524
|
+
onQueryPlanHooks,
|
|
2478
2525
|
additionalTypeDefs: config.additionalTypeDefs,
|
|
2479
2526
|
additionalResolvers: config.additionalResolvers,
|
|
2480
2527
|
instrumentation: () => instrumentation,
|
|
@@ -2562,6 +2609,9 @@ function createGatewayRuntime(config) {
|
|
|
2562
2609
|
if (plugin.onCacheDelete) {
|
|
2563
2610
|
onCacheDeleteHooks.push(plugin.onCacheDelete);
|
|
2564
2611
|
}
|
|
2612
|
+
if (plugin.onQueryPlan) {
|
|
2613
|
+
onQueryPlanHooks.push(plugin.onQueryPlan);
|
|
2614
|
+
}
|
|
2565
2615
|
}
|
|
2566
2616
|
}
|
|
2567
2617
|
};
|
|
@@ -2773,7 +2823,8 @@ function createGatewayRuntime(config) {
|
|
|
2773
2823
|
useSubgraphExecuteDebug(),
|
|
2774
2824
|
useFetchDebug(),
|
|
2775
2825
|
useMaybeDelegationPlanDebug({ log: configContext.log }),
|
|
2776
|
-
useCacheDebug({ log: configContext.log })
|
|
2826
|
+
useCacheDebug({ log: configContext.log }),
|
|
2827
|
+
useMaybeQueryPlanDebug({ log: configContext.log })
|
|
2777
2828
|
);
|
|
2778
2829
|
const yoga = createYoga({
|
|
2779
2830
|
// @ts-expect-error Types???
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-hive/gateway-runtime",
|
|
3
|
-
"version": "2.4.0-alpha-
|
|
3
|
+
"version": "2.4.0-alpha-c1d86e45362062c4112896e4bb5d2fab0aea0a3a",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -55,20 +55,20 @@
|
|
|
55
55
|
"@graphql-hive/signal": "^2.0.0",
|
|
56
56
|
"@graphql-hive/yoga": "^0.43.1",
|
|
57
57
|
"@graphql-mesh/cross-helpers": "^0.4.10",
|
|
58
|
-
"@graphql-mesh/fusion-runtime": "1.6.0-alpha-
|
|
58
|
+
"@graphql-mesh/fusion-runtime": "1.6.0-alpha-c1d86e45362062c4112896e4bb5d2fab0aea0a3a",
|
|
59
59
|
"@graphql-mesh/hmac-upstream-signature": "^2.0.8",
|
|
60
60
|
"@graphql-mesh/plugin-response-cache": "^0.104.18",
|
|
61
61
|
"@graphql-mesh/transport-common": "^1.0.12",
|
|
62
62
|
"@graphql-mesh/types": "^0.104.16",
|
|
63
63
|
"@graphql-mesh/utils": "^0.104.16",
|
|
64
|
-
"@graphql-tools/batch-delegate": "10.0.6-alpha-
|
|
65
|
-
"@graphql-tools/delegate": "12.0.0-alpha-
|
|
64
|
+
"@graphql-tools/batch-delegate": "10.0.6-alpha-c1d86e45362062c4112896e4bb5d2fab0aea0a3a",
|
|
65
|
+
"@graphql-tools/delegate": "12.0.0-alpha-c1d86e45362062c4112896e4bb5d2fab0aea0a3a",
|
|
66
66
|
"@graphql-tools/executor-common": "^1.0.5",
|
|
67
67
|
"@graphql-tools/executor-http": "^3.0.7",
|
|
68
|
-
"@graphql-tools/federation": "4.2.4-alpha-
|
|
69
|
-
"@graphql-tools/stitch": "10.1.4-alpha-
|
|
68
|
+
"@graphql-tools/federation": "4.2.4-alpha-c1d86e45362062c4112896e4bb5d2fab0aea0a3a",
|
|
69
|
+
"@graphql-tools/stitch": "10.1.4-alpha-c1d86e45362062c4112896e4bb5d2fab0aea0a3a",
|
|
70
70
|
"@graphql-tools/utils": "^10.10.3",
|
|
71
|
-
"@graphql-tools/wrap": "11.1.0-alpha-
|
|
71
|
+
"@graphql-tools/wrap": "11.1.0-alpha-c1d86e45362062c4112896e4bb5d2fab0aea0a3a",
|
|
72
72
|
"@graphql-yoga/plugin-apollo-usage-report": "^0.12.0",
|
|
73
73
|
"@graphql-yoga/plugin-csrf-prevention": "^3.16.2",
|
|
74
74
|
"@graphql-yoga/plugin-defer-stream": "^3.16.2",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@whatwg-node/server": "^0.10.17",
|
|
80
80
|
"@whatwg-node/server-plugin-cookies": "^1.0.5",
|
|
81
81
|
"graphql-ws": "^6.0.6",
|
|
82
|
-
"graphql-yoga": "^5.
|
|
82
|
+
"graphql-yoga": "^5.16.2",
|
|
83
83
|
"tslib": "^2.8.1"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|