@graphql-hive/gateway-runtime 2.4.0-alpha-475ccdfcc6961ea0cd7ea4755ea6696ff92f6b56 → 2.4.0-alpha-10edca19a47a0212f09bb75e24751faa4186544a
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 +25 -66
- package/dist/index.cjs +98 -133
- package/dist/index.d.cts +3 -9
- package/dist/index.d.ts +3 -9
- package/dist/index.js +102 -137
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,90 +1,49 @@
|
|
|
1
1
|
# @graphql-hive/gateway-runtime
|
|
2
2
|
|
|
3
|
-
## 2.4.0-alpha-
|
|
3
|
+
## 2.4.0-alpha-10edca19a47a0212f09bb75e24751faa4186544a
|
|
4
4
|
### Minor Changes
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
- [#
|
|
8
|
+
- [#1636](https://github.com/graphql-hive/gateway/pull/1636) [`f19b9ef`](https://github.com/graphql-hive/gateway/commit/f19b9ef6994fbabefa85f1f9e2527ca79223fb6a) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - Expose GraphQLError as OpenTelemetry Events.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
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
12
|
|
|
13
|
-
|
|
14
|
-
breaker handling CDN failure and how it switches to the CDN mirror.
|
|
13
|
+
This is aligned with the guidance of the Graphql OpenTelemetry working group.
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
It allows to add more graphql specific attributes to errors reported in a response:
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
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
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export const gatewayConfig = defineConfig({
|
|
25
|
-
supergraph: {
|
|
26
|
-
type: 'hive',
|
|
27
|
-
- endpoint: 'https://cdn.graphql-hive.com/artifacts/v1/...../supergraph',
|
|
28
|
-
+ endpoint: [
|
|
29
|
-
+ 'https://cdn.graphql-hive.com/artifacts/v1/...../supergraph',
|
|
30
|
-
+ 'https://cdn-mirror.graphql-hive.com/artifacts/v1/...../supergraph'
|
|
31
|
-
+ ]
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
persistedDocuments: {
|
|
35
|
-
- endpoint: 'https://cdn.graphql-hive.com/artifacts/v1/...',
|
|
36
|
-
+ endpoint: [
|
|
37
|
-
+ 'https://cdn.graphql-hive.com/artifacts/v1/...',
|
|
38
|
-
+ 'https://cdn-mirror.graphql-hive.com/artifacts/v1/...'
|
|
39
|
-
+ ]
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### Configuration
|
|
45
|
-
|
|
46
|
-
The circuit breaker has production ready default configuration, but you customize its behavior:
|
|
47
|
-
|
|
48
|
-
```ts
|
|
49
|
-
import { defineConfig, CircuitBreakerConfiguration } from '@graphql-hive/gateway';
|
|
50
|
-
|
|
51
|
-
const circuitBreaker: CircuitBreakerConfiguration = {
|
|
52
|
-
resetTimeout: 30_000; // 30s
|
|
53
|
-
errorThresholdPercentage: 50;
|
|
54
|
-
volumeThreshold: 5;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export const gatewayConfig = defineConfig({
|
|
58
|
-
supergraph: {
|
|
59
|
-
type: 'hive',
|
|
60
|
-
endpoint: [...],
|
|
61
|
-
circuitBreaker,
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
persistedDocuments: {
|
|
65
|
-
type: 'hive',
|
|
66
|
-
endpoint: [...],
|
|
67
|
-
circuitBreaker,
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
```
|
|
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.
|
|
71
25
|
|
|
72
26
|
### Patch Changes
|
|
73
27
|
|
|
74
28
|
|
|
75
29
|
|
|
30
|
+
- [#1636](https://github.com/graphql-hive/gateway/pull/1636) [`cc0feba`](https://github.com/graphql-hive/gateway/commit/cc0feba56c0bf379a3d5aed326b3db1abf7c4681) 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
|
+
|
|
34
|
+
|
|
76
35
|
- [#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:
|
|
77
36
|
|
|
78
37
|
- Updated dependency [`@graphql-hive/core@^0.15.1` ↗︎](https://www.npmjs.com/package/@graphql-hive/core/v/0.15.1) (from `^0.13.2`, in `dependencies`)
|
|
79
38
|
- Updated dependency [`@graphql-hive/yoga@^0.43.1` ↗︎](https://www.npmjs.com/package/@graphql-hive/yoga/v/0.43.1) (from `^0.42.4`, in `dependencies`)
|
|
80
|
-
- Updated dependencies [[`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)]:
|
|
81
|
-
- @graphql-mesh/fusion-runtime@1.6.0-alpha-
|
|
82
|
-
- @graphql-tools/wrap@11.1.0-alpha-
|
|
83
|
-
- @graphql-tools/delegate@12.0.0-alpha-
|
|
84
|
-
- @graphql-tools/stitch@10.1.4-alpha-
|
|
39
|
+
- Updated dependencies [[`cc0feba`](https://github.com/graphql-hive/gateway/commit/cc0feba56c0bf379a3d5aed326b3db1abf7c4681), [`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)]:
|
|
40
|
+
- @graphql-mesh/fusion-runtime@1.6.0-alpha-10edca19a47a0212f09bb75e24751faa4186544a
|
|
41
|
+
- @graphql-tools/wrap@11.1.0-alpha-10edca19a47a0212f09bb75e24751faa4186544a
|
|
42
|
+
- @graphql-tools/delegate@12.0.0-alpha-10edca19a47a0212f09bb75e24751faa4186544a
|
|
43
|
+
- @graphql-tools/stitch@10.1.4-alpha-10edca19a47a0212f09bb75e24751faa4186544a
|
|
85
44
|
- @graphql-mesh/hmac-upstream-signature@2.0.8
|
|
86
|
-
- @graphql-tools/federation@4.2.4-alpha-
|
|
87
|
-
- @graphql-tools/batch-delegate@10.0.6-alpha-
|
|
45
|
+
- @graphql-tools/federation@4.2.4-alpha-10edca19a47a0212f09bb75e24751faa4186544a
|
|
46
|
+
- @graphql-tools/batch-delegate@10.0.6-alpha-10edca19a47a0212f09bb75e24751faa4186544a
|
|
88
47
|
|
|
89
48
|
## 2.3.5
|
|
90
49
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -143,7 +143,8 @@ 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
|
|
146
|
+
signal: args.signal,
|
|
147
|
+
schemaCoordinateInErrors: args.schemaCoordinateInErrors
|
|
147
148
|
});
|
|
148
149
|
};
|
|
149
150
|
}
|
|
@@ -607,7 +608,6 @@ function getReportingPlugin(config, configContext, allowArbitraryDocuments = fal
|
|
|
607
608
|
endpoint: config.persistedDocuments.endpoint,
|
|
608
609
|
accessToken: config.persistedDocuments.token
|
|
609
610
|
},
|
|
610
|
-
circuitBreaker: config.persistedDocuments.circuitBreaker,
|
|
611
611
|
// Trick to satisfy the Hive Console plugin types
|
|
612
612
|
allowArbitraryDocuments
|
|
613
613
|
}
|
|
@@ -2043,7 +2043,6 @@ function createGatewayRuntime(config) {
|
|
|
2043
2043
|
endpoint: config.persistedDocuments.endpoint,
|
|
2044
2044
|
accessToken: config.persistedDocuments.token
|
|
2045
2045
|
},
|
|
2046
|
-
circuitBreaker: config.persistedDocuments.circuitBreaker,
|
|
2047
2046
|
// @ts-expect-error - Hive Console plugin options are not compatible yet
|
|
2048
2047
|
allowArbitraryDocuments: allowArbitraryDocumentsForPersistedDocuments
|
|
2049
2048
|
}
|
|
@@ -2063,7 +2062,7 @@ function createGatewayRuntime(config) {
|
|
|
2063
2062
|
clearTimeout(currentTimeout);
|
|
2064
2063
|
}
|
|
2065
2064
|
if (pollingInterval) {
|
|
2066
|
-
currentTimeout = setTimeout(schemaFetcher
|
|
2065
|
+
currentTimeout = setTimeout(schemaFetcher, pollingInterval);
|
|
2067
2066
|
}
|
|
2068
2067
|
}, pausePolling2 = function() {
|
|
2069
2068
|
if (currentTimeout) {
|
|
@@ -2087,99 +2086,81 @@ function createGatewayRuntime(config) {
|
|
|
2087
2086
|
let initialFetch$;
|
|
2088
2087
|
let schemaFetcher;
|
|
2089
2088
|
if (config.schema && typeof config.schema === "object" && "type" in config.schema) {
|
|
2090
|
-
const { endpoint, key
|
|
2091
|
-
const
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2089
|
+
const { endpoint, key } = config.schema;
|
|
2090
|
+
const fetcher = core$1.createSchemaFetcher({
|
|
2091
|
+
endpoint,
|
|
2092
|
+
key,
|
|
2093
|
+
logger: logger.LegacyLogger.from(
|
|
2094
|
+
configContext.log.child("[hiveSchemaFetcher] ")
|
|
2095
2095
|
)
|
|
2096
|
-
);
|
|
2097
|
-
const fetcher = core$1.createCDNArtifactFetcher({
|
|
2098
|
-
endpoint: endpoints,
|
|
2099
|
-
circuitBreaker,
|
|
2100
|
-
accessKey: key,
|
|
2101
|
-
logger: configContext.log.child("[hiveSchemaFetcher] ")
|
|
2102
2096
|
});
|
|
2103
|
-
schemaFetcher = {
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
return true;
|
|
2117
|
-
}
|
|
2118
|
-
);
|
|
2119
|
-
return initialFetch$;
|
|
2120
|
-
},
|
|
2121
|
-
dispose: () => fetcher.dispose()
|
|
2097
|
+
schemaFetcher = function fetchSchemaFromCDN() {
|
|
2098
|
+
pausePolling2();
|
|
2099
|
+
initialFetch$ = promiseHelpers.handleMaybePromise(fetcher, ({ sdl }) => {
|
|
2100
|
+
{
|
|
2101
|
+
unifiedGraph = graphql.buildSchema(sdl, {
|
|
2102
|
+
assumeValid: true,
|
|
2103
|
+
assumeValidSDL: true
|
|
2104
|
+
});
|
|
2105
|
+
}
|
|
2106
|
+
continuePolling2();
|
|
2107
|
+
return true;
|
|
2108
|
+
});
|
|
2109
|
+
return initialFetch$;
|
|
2122
2110
|
};
|
|
2123
2111
|
} else if (config.schema) {
|
|
2124
2112
|
if (!isDynamicUnifiedGraphSchema(config.schema)) {
|
|
2125
2113
|
delete config.pollingInterval;
|
|
2126
2114
|
}
|
|
2127
|
-
schemaFetcher = {
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
(schema)
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
});
|
|
2150
|
-
}
|
|
2151
|
-
continuePolling2();
|
|
2152
|
-
return true;
|
|
2115
|
+
schemaFetcher = function fetchSchema() {
|
|
2116
|
+
pausePolling2();
|
|
2117
|
+
initialFetch$ = promiseHelpers.handleMaybePromise(
|
|
2118
|
+
() => handleUnifiedGraphConfig(
|
|
2119
|
+
// @ts-expect-error TODO: what's up with type narrowing
|
|
2120
|
+
config.schema,
|
|
2121
|
+
configContext
|
|
2122
|
+
),
|
|
2123
|
+
(schema) => {
|
|
2124
|
+
if (graphql.isSchema(schema)) {
|
|
2125
|
+
unifiedGraph = schema;
|
|
2126
|
+
} else if (utils.isDocumentNode(schema)) {
|
|
2127
|
+
unifiedGraph = graphql.buildASTSchema(schema, {
|
|
2128
|
+
assumeValid: true,
|
|
2129
|
+
assumeValidSDL: true
|
|
2130
|
+
});
|
|
2131
|
+
} else {
|
|
2132
|
+
unifiedGraph = graphql.buildSchema(schema, {
|
|
2133
|
+
noLocation: true,
|
|
2134
|
+
assumeValid: true,
|
|
2135
|
+
assumeValidSDL: true
|
|
2136
|
+
});
|
|
2153
2137
|
}
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2138
|
+
continuePolling2();
|
|
2139
|
+
return true;
|
|
2140
|
+
}
|
|
2141
|
+
);
|
|
2142
|
+
return initialFetch$;
|
|
2157
2143
|
};
|
|
2158
2144
|
} else {
|
|
2159
|
-
schemaFetcher = {
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
);
|
|
2172
|
-
}
|
|
2145
|
+
schemaFetcher = function fetchSchemaWithExecutor() {
|
|
2146
|
+
pausePolling2();
|
|
2147
|
+
return promiseHelpers.handleMaybePromise(
|
|
2148
|
+
() => wrap.schemaFromExecutor(proxyExecutor, configContext, {
|
|
2149
|
+
assumeValid: true
|
|
2150
|
+
}),
|
|
2151
|
+
(schema) => {
|
|
2152
|
+
unifiedGraph = schema;
|
|
2153
|
+
continuePolling2();
|
|
2154
|
+
return true;
|
|
2155
|
+
}
|
|
2156
|
+
);
|
|
2173
2157
|
};
|
|
2174
2158
|
}
|
|
2175
|
-
const instrumentedFetcher = schemaFetcher
|
|
2176
|
-
schemaFetcher =
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
instrumentedFetcher
|
|
2181
|
-
)(...args)
|
|
2182
|
-
};
|
|
2159
|
+
const instrumentedFetcher = schemaFetcher;
|
|
2160
|
+
schemaFetcher = (...args) => core.getInstrumented(null).asyncFn(
|
|
2161
|
+
instrumentation?.schema,
|
|
2162
|
+
instrumentedFetcher
|
|
2163
|
+
)(...args);
|
|
2183
2164
|
getSchema = () => {
|
|
2184
2165
|
if (unifiedGraph != null) {
|
|
2185
2166
|
return unifiedGraph;
|
|
@@ -2190,21 +2171,21 @@ function createGatewayRuntime(config) {
|
|
|
2190
2171
|
() => unifiedGraph
|
|
2191
2172
|
);
|
|
2192
2173
|
}
|
|
2193
|
-
return promiseHelpers.handleMaybePromise(schemaFetcher
|
|
2174
|
+
return promiseHelpers.handleMaybePromise(schemaFetcher, () => unifiedGraph);
|
|
2194
2175
|
};
|
|
2195
2176
|
const shouldSkipValidation = "skipValidation" in config ? config.skipValidation : false;
|
|
2196
|
-
|
|
2177
|
+
const executorPlugin = {
|
|
2197
2178
|
onValidate({ params, setResult }) {
|
|
2198
2179
|
if (shouldSkipValidation || !params.schema) {
|
|
2199
2180
|
setResult([]);
|
|
2200
2181
|
}
|
|
2201
2182
|
},
|
|
2202
|
-
|
|
2183
|
+
onDispose() {
|
|
2203
2184
|
pausePolling2();
|
|
2204
|
-
|
|
2205
|
-
return schemaFetcher.dispose?.();
|
|
2185
|
+
return transportExecutorStack.disposeAsync();
|
|
2206
2186
|
}
|
|
2207
2187
|
};
|
|
2188
|
+
unifiedGraphPlugin = executorPlugin;
|
|
2208
2189
|
readinessChecker = () => promiseHelpers.handleMaybePromise(
|
|
2209
2190
|
() => proxyExecutor({
|
|
2210
2191
|
document: graphql.parse(`query ReadinessCheck { __typename }`, {
|
|
@@ -2215,7 +2196,7 @@ function createGatewayRuntime(config) {
|
|
|
2215
2196
|
);
|
|
2216
2197
|
schemaInvalidator = () => {
|
|
2217
2198
|
unifiedGraph = void 0;
|
|
2218
|
-
initialFetch$ = schemaFetcher
|
|
2199
|
+
initialFetch$ = schemaFetcher();
|
|
2219
2200
|
};
|
|
2220
2201
|
} else if ("subgraph" in config) {
|
|
2221
2202
|
let getSubschemaConfig2 = function() {
|
|
@@ -2430,40 +2411,31 @@ function createGatewayRuntime(config) {
|
|
|
2430
2411
|
let unifiedGraphFetcher;
|
|
2431
2412
|
if (typeof config.supergraph === "object" && "type" in config.supergraph) {
|
|
2432
2413
|
if (config.supergraph.type === "hive") {
|
|
2433
|
-
const { endpoint, key
|
|
2434
|
-
const
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
logger: configContext.log.child("[hiveSupergraphFetcher] "),
|
|
2414
|
+
const { endpoint, key } = config.supergraph;
|
|
2415
|
+
const fetcher = core$1.createSupergraphSDLFetcher({
|
|
2416
|
+
endpoint,
|
|
2417
|
+
key,
|
|
2418
|
+
logger: logger.LegacyLogger.from(
|
|
2419
|
+
configContext.log.child("[hiveSupergraphFetcher] ")
|
|
2420
|
+
),
|
|
2441
2421
|
// @ts-expect-error - MeshFetch is not compatible with `typeof fetch`
|
|
2442
|
-
|
|
2443
|
-
circuitBreaker,
|
|
2422
|
+
fetchImplementation: configContext.fetch,
|
|
2444
2423
|
name: "hive-gateway",
|
|
2445
2424
|
version: globalThis.__VERSION__
|
|
2446
2425
|
});
|
|
2447
|
-
unifiedGraphFetcher = {
|
|
2448
|
-
fetch: () => fetcher.fetch().then(({ contents }) => contents),
|
|
2449
|
-
dispose: () => fetcher.dispose()
|
|
2450
|
-
};
|
|
2426
|
+
unifiedGraphFetcher = () => fetcher().then(({ supergraphSdl }) => supergraphSdl);
|
|
2451
2427
|
} else if (config.supergraph.type === "graphos") {
|
|
2452
2428
|
const graphosFetcherContainer = createGraphOSFetcher({
|
|
2453
2429
|
graphosOpts: config.supergraph,
|
|
2454
2430
|
configContext,
|
|
2455
2431
|
pollingInterval: config.pollingInterval
|
|
2456
2432
|
});
|
|
2457
|
-
unifiedGraphFetcher =
|
|
2458
|
-
fetch: graphosFetcherContainer.unifiedGraphFetcher
|
|
2459
|
-
};
|
|
2433
|
+
unifiedGraphFetcher = graphosFetcherContainer.unifiedGraphFetcher;
|
|
2460
2434
|
} else {
|
|
2461
|
-
unifiedGraphFetcher = {
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
);
|
|
2466
|
-
}
|
|
2435
|
+
unifiedGraphFetcher = () => {
|
|
2436
|
+
throw new Error(
|
|
2437
|
+
`Unknown supergraph configuration: ${config.supergraph}`
|
|
2438
|
+
);
|
|
2467
2439
|
};
|
|
2468
2440
|
}
|
|
2469
2441
|
} else {
|
|
@@ -2475,25 +2447,20 @@ function createGatewayRuntime(config) {
|
|
|
2475
2447
|
`Polling interval not set for supergraph, if you want to get updates of supergraph, we recommend setting a polling interval`
|
|
2476
2448
|
);
|
|
2477
2449
|
}
|
|
2478
|
-
unifiedGraphFetcher =
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
)
|
|
2484
|
-
};
|
|
2450
|
+
unifiedGraphFetcher = () => handleUnifiedGraphConfig(
|
|
2451
|
+
// @ts-expect-error TODO: what's up with type narrowing
|
|
2452
|
+
config.supergraph,
|
|
2453
|
+
configContext
|
|
2454
|
+
);
|
|
2485
2455
|
}
|
|
2486
|
-
const instrumentedGraphFetcher = unifiedGraphFetcher
|
|
2487
|
-
unifiedGraphFetcher =
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
instrumentedGraphFetcher
|
|
2492
|
-
)(...args)
|
|
2493
|
-
};
|
|
2456
|
+
const instrumentedGraphFetcher = unifiedGraphFetcher;
|
|
2457
|
+
unifiedGraphFetcher = (...args) => core.getInstrumented(null).asyncFn(
|
|
2458
|
+
instrumentation?.schema,
|
|
2459
|
+
instrumentedGraphFetcher
|
|
2460
|
+
)(...args);
|
|
2494
2461
|
const unifiedGraphManager = new fusionRuntime.UnifiedGraphManager({
|
|
2495
2462
|
handleUnifiedGraph: config.unifiedGraphHandler,
|
|
2496
|
-
getUnifiedGraph: unifiedGraphFetcher
|
|
2463
|
+
getUnifiedGraph: unifiedGraphFetcher,
|
|
2497
2464
|
onUnifiedGraphChange(newUnifiedGraph) {
|
|
2498
2465
|
unifiedGraph = newUnifiedGraph;
|
|
2499
2466
|
replaceSchema(newUnifiedGraph);
|
|
@@ -2543,9 +2510,7 @@ function createGatewayRuntime(config) {
|
|
|
2543
2510
|
getExecutor = () => unifiedGraphManager.getExecutor();
|
|
2544
2511
|
unifiedGraphPlugin = {
|
|
2545
2512
|
onDispose() {
|
|
2546
|
-
return
|
|
2547
|
-
promiseHelpers.fakePromise(void 0).then(() => utils$1.dispose(unifiedGraphManager)).then(() => unifiedGraphFetcher.dispose?.())
|
|
2548
|
-
);
|
|
2513
|
+
return utils$1.dispose(unifiedGraphManager);
|
|
2549
2514
|
}
|
|
2550
2515
|
};
|
|
2551
2516
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -5,8 +5,6 @@ import { Plugin as Plugin$1 } from '@envelop/core';
|
|
|
5
5
|
export { withState } from '@envelop/core';
|
|
6
6
|
import { GenericAuthPluginOptions } from '@envelop/generic-auth';
|
|
7
7
|
export { ResolveUserFn, ValidateUserFn } from '@envelop/generic-auth';
|
|
8
|
-
import { HivePluginOptions, CircuitBreakerConfiguration } from '@graphql-hive/core';
|
|
9
|
-
export { CircuitBreakerConfiguration } from '@graphql-hive/core';
|
|
10
8
|
import { Logger, LogLevel } from '@graphql-hive/logger';
|
|
11
9
|
export * from '@graphql-hive/logger';
|
|
12
10
|
import { PubSub } from '@graphql-hive/pubsub';
|
|
@@ -24,6 +22,7 @@ import { UsePersistedOperationsOptions } from '@graphql-yoga/plugin-persisted-op
|
|
|
24
22
|
import { GraphQLResolveInfo } from 'graphql/type';
|
|
25
23
|
import { Agent } from 'node:http';
|
|
26
24
|
import { Agent as Agent$1 } from 'node:https';
|
|
25
|
+
import { HivePluginOptions } from '@graphql-hive/core';
|
|
27
26
|
import { FetchAPI } from '@whatwg-node/server';
|
|
28
27
|
export * from '@whatwg-node/disposablestack';
|
|
29
28
|
import { Context, ConnectionInitMessage, ServerOptions } from 'graphql-ws';
|
|
@@ -415,12 +414,11 @@ interface GatewayHiveCDNOptions {
|
|
|
415
414
|
/**
|
|
416
415
|
* GraphQL Hive CDN endpoint URL.
|
|
417
416
|
*/
|
|
418
|
-
endpoint: string
|
|
417
|
+
endpoint: string;
|
|
419
418
|
/**
|
|
420
419
|
* GraphQL Hive CDN access key.
|
|
421
420
|
*/
|
|
422
421
|
key: string;
|
|
423
|
-
circuitBreaker?: CircuitBreakerConfiguration;
|
|
424
422
|
}
|
|
425
423
|
interface GatewayHiveReportingOptions extends Omit<HiveConsolePluginOptions, 'experimental__persistedDocuments'> {
|
|
426
424
|
type: 'hive';
|
|
@@ -509,11 +507,7 @@ interface GatewayHivePersistedDocumentsOptions {
|
|
|
509
507
|
/**
|
|
510
508
|
* GraphQL Hive persisted documents CDN endpoint URL.
|
|
511
509
|
*/
|
|
512
|
-
endpoint: string
|
|
513
|
-
/**
|
|
514
|
-
* Circuit Breaker configuration to customize CDN failures handling and switch to mirror endpoint.
|
|
515
|
-
*/
|
|
516
|
-
circuitBreaker?: CircuitBreakerConfiguration;
|
|
510
|
+
endpoint: string;
|
|
517
511
|
/**
|
|
518
512
|
* GraphQL Hive persisted documents CDN access token.
|
|
519
513
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -5,8 +5,6 @@ import { Plugin as Plugin$1 } from '@envelop/core';
|
|
|
5
5
|
export { withState } from '@envelop/core';
|
|
6
6
|
import { GenericAuthPluginOptions } from '@envelop/generic-auth';
|
|
7
7
|
export { ResolveUserFn, ValidateUserFn } from '@envelop/generic-auth';
|
|
8
|
-
import { HivePluginOptions, CircuitBreakerConfiguration } from '@graphql-hive/core';
|
|
9
|
-
export { CircuitBreakerConfiguration } from '@graphql-hive/core';
|
|
10
8
|
import { Logger, LogLevel } from '@graphql-hive/logger';
|
|
11
9
|
export * from '@graphql-hive/logger';
|
|
12
10
|
import { PubSub } from '@graphql-hive/pubsub';
|
|
@@ -24,6 +22,7 @@ import { UsePersistedOperationsOptions } from '@graphql-yoga/plugin-persisted-op
|
|
|
24
22
|
import { GraphQLResolveInfo } from 'graphql/type';
|
|
25
23
|
import { Agent } from 'node:http';
|
|
26
24
|
import { Agent as Agent$1 } from 'node:https';
|
|
25
|
+
import { HivePluginOptions } from '@graphql-hive/core';
|
|
27
26
|
import { FetchAPI } from '@whatwg-node/server';
|
|
28
27
|
export * from '@whatwg-node/disposablestack';
|
|
29
28
|
import { Context, ConnectionInitMessage, ServerOptions } from 'graphql-ws';
|
|
@@ -415,12 +414,11 @@ interface GatewayHiveCDNOptions {
|
|
|
415
414
|
/**
|
|
416
415
|
* GraphQL Hive CDN endpoint URL.
|
|
417
416
|
*/
|
|
418
|
-
endpoint: string
|
|
417
|
+
endpoint: string;
|
|
419
418
|
/**
|
|
420
419
|
* GraphQL Hive CDN access key.
|
|
421
420
|
*/
|
|
422
421
|
key: string;
|
|
423
|
-
circuitBreaker?: CircuitBreakerConfiguration;
|
|
424
422
|
}
|
|
425
423
|
interface GatewayHiveReportingOptions extends Omit<HiveConsolePluginOptions, 'experimental__persistedDocuments'> {
|
|
426
424
|
type: 'hive';
|
|
@@ -509,11 +507,7 @@ interface GatewayHivePersistedDocumentsOptions {
|
|
|
509
507
|
/**
|
|
510
508
|
* GraphQL Hive persisted documents CDN endpoint URL.
|
|
511
509
|
*/
|
|
512
|
-
endpoint: string
|
|
513
|
-
/**
|
|
514
|
-
* Circuit Breaker configuration to customize CDN failures handling and switch to mirror endpoint.
|
|
515
|
-
*/
|
|
516
|
-
circuitBreaker?: CircuitBreakerConfiguration;
|
|
510
|
+
endpoint: string;
|
|
517
511
|
/**
|
|
518
512
|
* GraphQL Hive persisted documents CDN access token.
|
|
519
513
|
*/
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { isOriginalGraphQLError, getInstrumented as getInstrumented$1 } from '@e
|
|
|
2
2
|
export { withState } from '@envelop/core';
|
|
3
3
|
import { useDisableIntrospection } from '@envelop/disable-introspection';
|
|
4
4
|
import { useGenericAuth } from '@envelop/generic-auth';
|
|
5
|
-
import {
|
|
5
|
+
import { createSchemaFetcher, createSupergraphSDLFetcher } from '@graphql-hive/core';
|
|
6
6
|
import { Logger, LegacyLogger } from '@graphql-hive/logger';
|
|
7
7
|
export * from '@graphql-hive/logger';
|
|
8
8
|
import { millisecondsToStr, getOnSubgraphExecute, UnifiedGraphManager, restoreExtraDirectives, getTransportEntryMapUsingFusionAndFederationDirectives, getStitchingDirectivesTransformerForSubschema, handleFederationSubschema, handleResolveToDirectives } from '@graphql-mesh/fusion-runtime';
|
|
@@ -15,15 +15,15 @@ import { batchDelegateToSchema } from '@graphql-tools/batch-delegate';
|
|
|
15
15
|
import { getTypeInfo, EMPTY_OBJECT, delegateToSchema, defaultMergedResolver } from '@graphql-tools/delegate';
|
|
16
16
|
import { defaultPrintFn as defaultPrintFn$1 } from '@graphql-tools/executor-common';
|
|
17
17
|
import { getDirectiveExtensions, memoize1, mergeDeep, isValidPath, pathToArray, memoize3, getDirective, createGraphQLError, isAsyncIterable, mapAsyncIterator, createDeferred, isPromise, isDocumentNode, asArray, printSchemaWithDirectives, parseSelectionSet } from '@graphql-tools/utils';
|
|
18
|
-
import {
|
|
18
|
+
import { wrapSchema, schemaFromExecutor } from '@graphql-tools/wrap';
|
|
19
19
|
import { useCSRFPrevention } from '@graphql-yoga/plugin-csrf-prevention';
|
|
20
20
|
import { useDeferStream } from '@graphql-yoga/plugin-defer-stream';
|
|
21
21
|
import { usePersistedOperations } from '@graphql-yoga/plugin-persisted-operations';
|
|
22
22
|
import { AsyncDisposableStack } from '@whatwg-node/disposablestack';
|
|
23
23
|
export * from '@whatwg-node/disposablestack';
|
|
24
|
-
import { handleMaybePromise, iterateAsync
|
|
24
|
+
import { handleMaybePromise, iterateAsync } from '@whatwg-node/promise-helpers';
|
|
25
25
|
import { useCookies } from '@whatwg-node/server-plugin-cookies';
|
|
26
|
-
import { print, visit, visitWithTypeInfo, getArgumentValues, getNamedType, isIntrospectionType, isListType, isCompositeType, getOperationAST, isSchema, parse,
|
|
26
|
+
import { print, visit, visitWithTypeInfo, getArgumentValues, getNamedType, isIntrospectionType, isListType, isCompositeType, getOperationAST, isSchema, parse, buildASTSchema, buildSchema } from 'graphql';
|
|
27
27
|
import { isAsyncIterable as isAsyncIterable$1, useReadinessCheck, useExecutionCancellation, createYoga, chain, mergeSchemas } from 'graphql-yoga';
|
|
28
28
|
import { DEFAULT_UPLINKS, fetchSupergraphSdlFromManagedFederation } from '@graphql-tools/federation';
|
|
29
29
|
import { useApolloUsageReport } from '@graphql-yoga/plugin-apollo-usage-report';
|
|
@@ -142,7 +142,8 @@ const getExecuteFnFromExecutor = memoize1(
|
|
|
142
142
|
operationName: args.operationName ?? void 0,
|
|
143
143
|
rootValue: args.rootValue,
|
|
144
144
|
context: args.contextValue,
|
|
145
|
-
signal: args.signal
|
|
145
|
+
signal: args.signal,
|
|
146
|
+
schemaCoordinateInErrors: args.schemaCoordinateInErrors
|
|
146
147
|
});
|
|
147
148
|
};
|
|
148
149
|
}
|
|
@@ -606,7 +607,6 @@ function getReportingPlugin(config, configContext, allowArbitraryDocuments = fal
|
|
|
606
607
|
endpoint: config.persistedDocuments.endpoint,
|
|
607
608
|
accessToken: config.persistedDocuments.token
|
|
608
609
|
},
|
|
609
|
-
circuitBreaker: config.persistedDocuments.circuitBreaker,
|
|
610
610
|
// Trick to satisfy the Hive Console plugin types
|
|
611
611
|
allowArbitraryDocuments
|
|
612
612
|
}
|
|
@@ -2042,7 +2042,6 @@ function createGatewayRuntime(config) {
|
|
|
2042
2042
|
endpoint: config.persistedDocuments.endpoint,
|
|
2043
2043
|
accessToken: config.persistedDocuments.token
|
|
2044
2044
|
},
|
|
2045
|
-
circuitBreaker: config.persistedDocuments.circuitBreaker,
|
|
2046
2045
|
// @ts-expect-error - Hive Console plugin options are not compatible yet
|
|
2047
2046
|
allowArbitraryDocuments: allowArbitraryDocumentsForPersistedDocuments
|
|
2048
2047
|
}
|
|
@@ -2062,7 +2061,7 @@ function createGatewayRuntime(config) {
|
|
|
2062
2061
|
clearTimeout(currentTimeout);
|
|
2063
2062
|
}
|
|
2064
2063
|
if (pollingInterval) {
|
|
2065
|
-
currentTimeout = setTimeout(schemaFetcher
|
|
2064
|
+
currentTimeout = setTimeout(schemaFetcher, pollingInterval);
|
|
2066
2065
|
}
|
|
2067
2066
|
}, pausePolling2 = function() {
|
|
2068
2067
|
if (currentTimeout) {
|
|
@@ -2086,99 +2085,81 @@ function createGatewayRuntime(config) {
|
|
|
2086
2085
|
let initialFetch$;
|
|
2087
2086
|
let schemaFetcher;
|
|
2088
2087
|
if (config.schema && typeof config.schema === "object" && "type" in config.schema) {
|
|
2089
|
-
const { endpoint, key
|
|
2090
|
-
const
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2088
|
+
const { endpoint, key } = config.schema;
|
|
2089
|
+
const fetcher = createSchemaFetcher({
|
|
2090
|
+
endpoint,
|
|
2091
|
+
key,
|
|
2092
|
+
logger: LegacyLogger.from(
|
|
2093
|
+
configContext.log.child("[hiveSchemaFetcher] ")
|
|
2094
2094
|
)
|
|
2095
|
-
);
|
|
2096
|
-
const fetcher = createCDNArtifactFetcher({
|
|
2097
|
-
endpoint: endpoints,
|
|
2098
|
-
circuitBreaker,
|
|
2099
|
-
accessKey: key,
|
|
2100
|
-
logger: configContext.log.child("[hiveSchemaFetcher] ")
|
|
2101
2095
|
});
|
|
2102
|
-
schemaFetcher = {
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
return true;
|
|
2116
|
-
}
|
|
2117
|
-
);
|
|
2118
|
-
return initialFetch$;
|
|
2119
|
-
},
|
|
2120
|
-
dispose: () => fetcher.dispose()
|
|
2096
|
+
schemaFetcher = function fetchSchemaFromCDN() {
|
|
2097
|
+
pausePolling2();
|
|
2098
|
+
initialFetch$ = handleMaybePromise(fetcher, ({ sdl }) => {
|
|
2099
|
+
{
|
|
2100
|
+
unifiedGraph = buildSchema(sdl, {
|
|
2101
|
+
assumeValid: true,
|
|
2102
|
+
assumeValidSDL: true
|
|
2103
|
+
});
|
|
2104
|
+
}
|
|
2105
|
+
continuePolling2();
|
|
2106
|
+
return true;
|
|
2107
|
+
});
|
|
2108
|
+
return initialFetch$;
|
|
2121
2109
|
};
|
|
2122
2110
|
} else if (config.schema) {
|
|
2123
2111
|
if (!isDynamicUnifiedGraphSchema(config.schema)) {
|
|
2124
2112
|
delete config.pollingInterval;
|
|
2125
2113
|
}
|
|
2126
|
-
schemaFetcher = {
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
(schema)
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
});
|
|
2149
|
-
}
|
|
2150
|
-
continuePolling2();
|
|
2151
|
-
return true;
|
|
2114
|
+
schemaFetcher = function fetchSchema() {
|
|
2115
|
+
pausePolling2();
|
|
2116
|
+
initialFetch$ = handleMaybePromise(
|
|
2117
|
+
() => handleUnifiedGraphConfig(
|
|
2118
|
+
// @ts-expect-error TODO: what's up with type narrowing
|
|
2119
|
+
config.schema,
|
|
2120
|
+
configContext
|
|
2121
|
+
),
|
|
2122
|
+
(schema) => {
|
|
2123
|
+
if (isSchema(schema)) {
|
|
2124
|
+
unifiedGraph = schema;
|
|
2125
|
+
} else if (isDocumentNode(schema)) {
|
|
2126
|
+
unifiedGraph = buildASTSchema(schema, {
|
|
2127
|
+
assumeValid: true,
|
|
2128
|
+
assumeValidSDL: true
|
|
2129
|
+
});
|
|
2130
|
+
} else {
|
|
2131
|
+
unifiedGraph = buildSchema(schema, {
|
|
2132
|
+
noLocation: true,
|
|
2133
|
+
assumeValid: true,
|
|
2134
|
+
assumeValidSDL: true
|
|
2135
|
+
});
|
|
2152
2136
|
}
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2137
|
+
continuePolling2();
|
|
2138
|
+
return true;
|
|
2139
|
+
}
|
|
2140
|
+
);
|
|
2141
|
+
return initialFetch$;
|
|
2156
2142
|
};
|
|
2157
2143
|
} else {
|
|
2158
|
-
schemaFetcher = {
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
);
|
|
2171
|
-
}
|
|
2144
|
+
schemaFetcher = function fetchSchemaWithExecutor() {
|
|
2145
|
+
pausePolling2();
|
|
2146
|
+
return handleMaybePromise(
|
|
2147
|
+
() => schemaFromExecutor(proxyExecutor, configContext, {
|
|
2148
|
+
assumeValid: true
|
|
2149
|
+
}),
|
|
2150
|
+
(schema) => {
|
|
2151
|
+
unifiedGraph = schema;
|
|
2152
|
+
continuePolling2();
|
|
2153
|
+
return true;
|
|
2154
|
+
}
|
|
2155
|
+
);
|
|
2172
2156
|
};
|
|
2173
2157
|
}
|
|
2174
|
-
const instrumentedFetcher = schemaFetcher
|
|
2175
|
-
schemaFetcher =
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
instrumentedFetcher
|
|
2180
|
-
)(...args)
|
|
2181
|
-
};
|
|
2158
|
+
const instrumentedFetcher = schemaFetcher;
|
|
2159
|
+
schemaFetcher = (...args) => getInstrumented$1(null).asyncFn(
|
|
2160
|
+
instrumentation?.schema,
|
|
2161
|
+
instrumentedFetcher
|
|
2162
|
+
)(...args);
|
|
2182
2163
|
getSchema = () => {
|
|
2183
2164
|
if (unifiedGraph != null) {
|
|
2184
2165
|
return unifiedGraph;
|
|
@@ -2189,21 +2170,21 @@ function createGatewayRuntime(config) {
|
|
|
2189
2170
|
() => unifiedGraph
|
|
2190
2171
|
);
|
|
2191
2172
|
}
|
|
2192
|
-
return handleMaybePromise(schemaFetcher
|
|
2173
|
+
return handleMaybePromise(schemaFetcher, () => unifiedGraph);
|
|
2193
2174
|
};
|
|
2194
2175
|
const shouldSkipValidation = "skipValidation" in config ? config.skipValidation : false;
|
|
2195
|
-
|
|
2176
|
+
const executorPlugin = {
|
|
2196
2177
|
onValidate({ params, setResult }) {
|
|
2197
2178
|
if (shouldSkipValidation || !params.schema) {
|
|
2198
2179
|
setResult([]);
|
|
2199
2180
|
}
|
|
2200
2181
|
},
|
|
2201
|
-
|
|
2182
|
+
onDispose() {
|
|
2202
2183
|
pausePolling2();
|
|
2203
|
-
|
|
2204
|
-
return schemaFetcher.dispose?.();
|
|
2184
|
+
return transportExecutorStack.disposeAsync();
|
|
2205
2185
|
}
|
|
2206
2186
|
};
|
|
2187
|
+
unifiedGraphPlugin = executorPlugin;
|
|
2207
2188
|
readinessChecker = () => handleMaybePromise(
|
|
2208
2189
|
() => proxyExecutor({
|
|
2209
2190
|
document: parse(`query ReadinessCheck { __typename }`, {
|
|
@@ -2214,7 +2195,7 @@ function createGatewayRuntime(config) {
|
|
|
2214
2195
|
);
|
|
2215
2196
|
schemaInvalidator = () => {
|
|
2216
2197
|
unifiedGraph = void 0;
|
|
2217
|
-
initialFetch$ = schemaFetcher
|
|
2198
|
+
initialFetch$ = schemaFetcher();
|
|
2218
2199
|
};
|
|
2219
2200
|
} else if ("subgraph" in config) {
|
|
2220
2201
|
let getSubschemaConfig2 = function() {
|
|
@@ -2429,40 +2410,31 @@ function createGatewayRuntime(config) {
|
|
|
2429
2410
|
let unifiedGraphFetcher;
|
|
2430
2411
|
if (typeof config.supergraph === "object" && "type" in config.supergraph) {
|
|
2431
2412
|
if (config.supergraph.type === "hive") {
|
|
2432
|
-
const { endpoint, key
|
|
2433
|
-
const
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
logger: configContext.log.child("[hiveSupergraphFetcher] "),
|
|
2413
|
+
const { endpoint, key } = config.supergraph;
|
|
2414
|
+
const fetcher = createSupergraphSDLFetcher({
|
|
2415
|
+
endpoint,
|
|
2416
|
+
key,
|
|
2417
|
+
logger: LegacyLogger.from(
|
|
2418
|
+
configContext.log.child("[hiveSupergraphFetcher] ")
|
|
2419
|
+
),
|
|
2440
2420
|
// @ts-expect-error - MeshFetch is not compatible with `typeof fetch`
|
|
2441
|
-
|
|
2442
|
-
circuitBreaker,
|
|
2421
|
+
fetchImplementation: configContext.fetch,
|
|
2443
2422
|
name: "hive-gateway",
|
|
2444
2423
|
version: globalThis.__VERSION__
|
|
2445
2424
|
});
|
|
2446
|
-
unifiedGraphFetcher = {
|
|
2447
|
-
fetch: () => fetcher.fetch().then(({ contents }) => contents),
|
|
2448
|
-
dispose: () => fetcher.dispose()
|
|
2449
|
-
};
|
|
2425
|
+
unifiedGraphFetcher = () => fetcher().then(({ supergraphSdl }) => supergraphSdl);
|
|
2450
2426
|
} else if (config.supergraph.type === "graphos") {
|
|
2451
2427
|
const graphosFetcherContainer = createGraphOSFetcher({
|
|
2452
2428
|
graphosOpts: config.supergraph,
|
|
2453
2429
|
configContext,
|
|
2454
2430
|
pollingInterval: config.pollingInterval
|
|
2455
2431
|
});
|
|
2456
|
-
unifiedGraphFetcher =
|
|
2457
|
-
fetch: graphosFetcherContainer.unifiedGraphFetcher
|
|
2458
|
-
};
|
|
2432
|
+
unifiedGraphFetcher = graphosFetcherContainer.unifiedGraphFetcher;
|
|
2459
2433
|
} else {
|
|
2460
|
-
unifiedGraphFetcher = {
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
);
|
|
2465
|
-
}
|
|
2434
|
+
unifiedGraphFetcher = () => {
|
|
2435
|
+
throw new Error(
|
|
2436
|
+
`Unknown supergraph configuration: ${config.supergraph}`
|
|
2437
|
+
);
|
|
2466
2438
|
};
|
|
2467
2439
|
}
|
|
2468
2440
|
} else {
|
|
@@ -2474,25 +2446,20 @@ function createGatewayRuntime(config) {
|
|
|
2474
2446
|
`Polling interval not set for supergraph, if you want to get updates of supergraph, we recommend setting a polling interval`
|
|
2475
2447
|
);
|
|
2476
2448
|
}
|
|
2477
|
-
unifiedGraphFetcher =
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
)
|
|
2483
|
-
};
|
|
2449
|
+
unifiedGraphFetcher = () => handleUnifiedGraphConfig(
|
|
2450
|
+
// @ts-expect-error TODO: what's up with type narrowing
|
|
2451
|
+
config.supergraph,
|
|
2452
|
+
configContext
|
|
2453
|
+
);
|
|
2484
2454
|
}
|
|
2485
|
-
const instrumentedGraphFetcher = unifiedGraphFetcher
|
|
2486
|
-
unifiedGraphFetcher =
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
instrumentedGraphFetcher
|
|
2491
|
-
)(...args)
|
|
2492
|
-
};
|
|
2455
|
+
const instrumentedGraphFetcher = unifiedGraphFetcher;
|
|
2456
|
+
unifiedGraphFetcher = (...args) => getInstrumented$1(null).asyncFn(
|
|
2457
|
+
instrumentation?.schema,
|
|
2458
|
+
instrumentedGraphFetcher
|
|
2459
|
+
)(...args);
|
|
2493
2460
|
const unifiedGraphManager = new UnifiedGraphManager({
|
|
2494
2461
|
handleUnifiedGraph: config.unifiedGraphHandler,
|
|
2495
|
-
getUnifiedGraph: unifiedGraphFetcher
|
|
2462
|
+
getUnifiedGraph: unifiedGraphFetcher,
|
|
2496
2463
|
onUnifiedGraphChange(newUnifiedGraph) {
|
|
2497
2464
|
unifiedGraph = newUnifiedGraph;
|
|
2498
2465
|
replaceSchema(newUnifiedGraph);
|
|
@@ -2542,9 +2509,7 @@ function createGatewayRuntime(config) {
|
|
|
2542
2509
|
getExecutor = () => unifiedGraphManager.getExecutor();
|
|
2543
2510
|
unifiedGraphPlugin = {
|
|
2544
2511
|
onDispose() {
|
|
2545
|
-
return
|
|
2546
|
-
fakePromise(void 0).then(() => dispose(unifiedGraphManager)).then(() => unifiedGraphFetcher.dispose?.())
|
|
2547
|
-
);
|
|
2512
|
+
return dispose(unifiedGraphManager);
|
|
2548
2513
|
}
|
|
2549
2514
|
};
|
|
2550
2515
|
}
|
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-10edca19a47a0212f09bb75e24751faa4186544a",
|
|
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-10edca19a47a0212f09bb75e24751faa4186544a",
|
|
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-10edca19a47a0212f09bb75e24751faa4186544a",
|
|
65
|
+
"@graphql-tools/delegate": "12.0.0-alpha-10edca19a47a0212f09bb75e24751faa4186544a",
|
|
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-10edca19a47a0212f09bb75e24751faa4186544a",
|
|
69
|
+
"@graphql-tools/stitch": "10.1.4-alpha-10edca19a47a0212f09bb75e24751faa4186544a",
|
|
70
70
|
"@graphql-tools/utils": "^10.10.3",
|
|
71
|
-
"@graphql-tools/wrap": "11.1.0-alpha-
|
|
71
|
+
"@graphql-tools/wrap": "11.1.0-alpha-10edca19a47a0212f09bb75e24751faa4186544a",
|
|
72
72
|
"@graphql-yoga/plugin-apollo-usage-report": "^0.11.2",
|
|
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.17.0",
|
|
83
83
|
"tslib": "^2.8.1"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|