@graphql-hive/gateway-runtime 2.4.0-alpha-65ad5f97b6cf2a8dd5ad0a7bb8ea9cf3b540b497 → 2.4.0-alpha-b2b2f2862d2a13c2868dada93d42f78d08fa0e02

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @graphql-hive/gateway-runtime
2
2
 
3
- ## 2.4.0-alpha-65ad5f97b6cf2a8dd5ad0a7bb8ea9cf3b540b497
3
+ ## 2.4.0-alpha-b2b2f2862d2a13c2868dada93d42f78d08fa0e02
4
4
  ### Minor Changes
5
5
 
6
6
 
@@ -24,18 +24,18 @@
24
24
  export const gatewayConfig = defineConfig({
25
25
  supergraph: {
26
26
  type: 'hive',
27
- - endpoint: 'https://cdn.graphql-hive.com/artifacts/v1/...../supergraph',
27
+ - endpoint: 'https://cdn.graphql-hive.com/artifacts/v1/<target-id>/supergraph',
28
28
  + endpoint: [
29
- + 'https://cdn.graphql-hive.com/artifacts/v1/...../supergraph',
30
- + 'https://cdn-mirror.graphql-hive.com/artifacts/v1/...../supergraph'
29
+ + 'https://cdn.graphql-hive.com/artifacts/v1/<target-id>/supergraph',
30
+ + 'https://cdn-mirror.graphql-hive.com/artifacts/v1/<target-id>/supergraph'
31
31
  + ]
32
32
  },
33
33
 
34
34
  persistedDocuments: {
35
- - endpoint: 'https://cdn.graphql-hive.com/artifacts/v1/...',
35
+ - endpoint: 'https://cdn.graphql-hive.com/<target-id>',
36
36
  + endpoint: [
37
- + 'https://cdn.graphql-hive.com/artifacts/v1/...',
38
- + 'https://cdn-mirror.graphql-hive.com/artifacts/v1/...'
37
+ + 'https://cdn.graphql-hive.com/<target-id>',
38
+ + 'https://cdn-mirror.graphql-hive.com/<target-id>'
39
39
  + ]
40
40
  }
41
41
  })
@@ -78,13 +78,13 @@
78
78
  - Updated dependency [`@graphql-hive/core@^0.18.0` ↗︎](https://www.npmjs.com/package/@graphql-hive/core/v/0.18.0) (from `^0.15.1`, in `dependencies`)
79
79
  - Updated dependency [`@graphql-hive/yoga@^0.46.0` ↗︎](https://www.npmjs.com/package/@graphql-hive/yoga/v/0.46.0) (from `^0.43.1`, in `dependencies`)
80
80
  - Updated dependencies [[`da8b8e3`](https://github.com/graphql-hive/gateway/commit/da8b8e3f3545487249b11c6577e3889f68527249)]:
81
- - @graphql-tools/delegate@12.0.2-alpha-65ad5f97b6cf2a8dd5ad0a7bb8ea9cf3b540b497
81
+ - @graphql-tools/delegate@12.0.2-alpha-b2b2f2862d2a13c2868dada93d42f78d08fa0e02
82
82
  - @graphql-mesh/hmac-upstream-signature@2.0.8
83
- - @graphql-tools/batch-delegate@10.0.8-alpha-65ad5f97b6cf2a8dd5ad0a7bb8ea9cf3b540b497
84
- - @graphql-tools/federation@4.2.6-alpha-65ad5f97b6cf2a8dd5ad0a7bb8ea9cf3b540b497
85
- - @graphql-mesh/fusion-runtime@1.6.2-alpha-65ad5f97b6cf2a8dd5ad0a7bb8ea9cf3b540b497
86
- - @graphql-tools/stitch@10.1.6-alpha-65ad5f97b6cf2a8dd5ad0a7bb8ea9cf3b540b497
87
- - @graphql-tools/wrap@11.1.2-alpha-65ad5f97b6cf2a8dd5ad0a7bb8ea9cf3b540b497
83
+ - @graphql-tools/batch-delegate@10.0.8-alpha-b2b2f2862d2a13c2868dada93d42f78d08fa0e02
84
+ - @graphql-tools/federation@4.2.6-alpha-b2b2f2862d2a13c2868dada93d42f78d08fa0e02
85
+ - @graphql-mesh/fusion-runtime@1.6.2-alpha-b2b2f2862d2a13c2868dada93d42f78d08fa0e02
86
+ - @graphql-tools/stitch@10.1.6-alpha-b2b2f2862d2a13c2868dada93d42f78d08fa0e02
87
+ - @graphql-tools/wrap@11.1.2-alpha-b2b2f2862d2a13c2868dada93d42f78d08fa0e02
88
88
 
89
89
  ## 2.3.7
90
90
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -2088,15 +2088,19 @@ function createGatewayRuntime(config) {
2088
2088
  let initialFetch$;
2089
2089
  let schemaFetcher;
2090
2090
  if (config.schema && typeof config.schema === "object" && "type" in config.schema) {
2091
+ let ensureSdl2 = function(endpoint2) {
2092
+ endpoint2 = endpoint2.replace(/\/services$/, "/sdl");
2093
+ if (!/\/sdl(\.graphql)*$/.test(endpoint2)) {
2094
+ endpoint2 = core$1.joinUrl(endpoint2, "sdl");
2095
+ }
2096
+ return endpoint2;
2097
+ };
2091
2098
  const { endpoint, key, circuitBreaker } = config.schema;
2092
- const endpoints = (Array.isArray(endpoint) ? endpoint : [endpoint]).map(
2093
- (url) => url.endsWith("/sdl") ? url : core$1.joinUrl(
2094
- url.endsWith("/services") ? url.substring(0, url.length - 8) : url,
2095
- "sdl"
2096
- )
2097
- );
2098
2099
  const fetcher = core$1.createCDNArtifactFetcher({
2099
- endpoint: endpoints,
2100
+ endpoint: Array.isArray(endpoint) ? (
2101
+ // no endpoint.map just to make ts happy without casting
2102
+ [ensureSdl2(endpoint[0]), ensureSdl2(endpoint[1])]
2103
+ ) : ensureSdl2(endpoint),
2100
2104
  circuitBreaker,
2101
2105
  accessKey: key,
2102
2106
  logger: configContext.log.child("[hiveSchemaFetcher] ")
@@ -2200,10 +2204,12 @@ function createGatewayRuntime(config) {
2200
2204
  setResult([]);
2201
2205
  }
2202
2206
  },
2203
- async onDispose() {
2207
+ onDispose() {
2204
2208
  pausePolling2();
2205
- await transportExecutorStack.disposeAsync();
2206
- return schemaFetcher.dispose?.();
2209
+ return promiseHelpers.handleMaybePromise(
2210
+ () => transportExecutorStack.disposeAsync(),
2211
+ () => schemaFetcher.dispose?.()
2212
+ );
2207
2213
  }
2208
2214
  };
2209
2215
  readinessChecker = () => promiseHelpers.handleMaybePromise(
@@ -2431,12 +2437,18 @@ function createGatewayRuntime(config) {
2431
2437
  let unifiedGraphFetcher;
2432
2438
  if (typeof config.supergraph === "object" && "type" in config.supergraph) {
2433
2439
  if (config.supergraph.type === "hive") {
2440
+ let ensureSupergraph2 = function(endpoint2) {
2441
+ if (!/\/supergraph(\.graphql)*$/.test(endpoint2)) {
2442
+ endpoint2 = core$1.joinUrl(endpoint2, "supergraph");
2443
+ }
2444
+ return endpoint2;
2445
+ };
2434
2446
  const { endpoint, key, circuitBreaker } = config.supergraph;
2435
- const endpoints = (Array.isArray(endpoint) ? endpoint : [endpoint]).map(
2436
- (url) => url.endsWith("/supergraph") ? url : `${url}/supergraph`
2437
- );
2438
2447
  const fetcher = core$1.createCDNArtifactFetcher({
2439
- endpoint: endpoints,
2448
+ endpoint: Array.isArray(endpoint) ? (
2449
+ // no endpoint.map just to make ts happy without casting
2450
+ [ensureSupergraph2(endpoint[0]), ensureSupergraph2(endpoint[1])]
2451
+ ) : ensureSupergraph2(endpoint),
2440
2452
  accessKey: key,
2441
2453
  logger: configContext.log.child("[hiveSupergraphFetcher] "),
2442
2454
  // @ts-expect-error - MeshFetch is not compatible with `typeof fetch`
@@ -2544,8 +2556,9 @@ function createGatewayRuntime(config) {
2544
2556
  getExecutor = () => unifiedGraphManager.getExecutor();
2545
2557
  unifiedGraphPlugin = {
2546
2558
  onDispose() {
2547
- return promiseHelpers.unfakePromise(
2548
- promiseHelpers.fakePromise(void 0).then(() => utils$1.dispose(unifiedGraphManager)).then(() => unifiedGraphFetcher.dispose?.())
2559
+ return promiseHelpers.handleMaybePromise(
2560
+ () => utils$1.dispose(unifiedGraphManager),
2561
+ () => unifiedGraphFetcher.dispose?.()
2549
2562
  );
2550
2563
  }
2551
2564
  };
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 { joinUrl, createCDNArtifactFetcher } from '@graphql-hive/core';
5
+ import { createCDNArtifactFetcher, joinUrl } 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';
@@ -21,7 +21,7 @@ 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, unfakePromise, fakePromise } from '@whatwg-node/promise-helpers';
24
+ import { handleMaybePromise, iterateAsync } from '@whatwg-node/promise-helpers';
25
25
  import { useCookies } from '@whatwg-node/server-plugin-cookies';
26
26
  import { print, visit, visitWithTypeInfo, getArgumentValues, getNamedType, isIntrospectionType, isListType, isCompositeType, getOperationAST, isSchema, parse, buildSchema, buildASTSchema } from 'graphql';
27
27
  import { isAsyncIterable as isAsyncIterable$1, useReadinessCheck, useExecutionCancellation, createYoga, chain, mergeSchemas } from 'graphql-yoga';
@@ -2087,15 +2087,19 @@ function createGatewayRuntime(config) {
2087
2087
  let initialFetch$;
2088
2088
  let schemaFetcher;
2089
2089
  if (config.schema && typeof config.schema === "object" && "type" in config.schema) {
2090
+ let ensureSdl2 = function(endpoint2) {
2091
+ endpoint2 = endpoint2.replace(/\/services$/, "/sdl");
2092
+ if (!/\/sdl(\.graphql)*$/.test(endpoint2)) {
2093
+ endpoint2 = joinUrl(endpoint2, "sdl");
2094
+ }
2095
+ return endpoint2;
2096
+ };
2090
2097
  const { endpoint, key, circuitBreaker } = config.schema;
2091
- const endpoints = (Array.isArray(endpoint) ? endpoint : [endpoint]).map(
2092
- (url) => url.endsWith("/sdl") ? url : joinUrl(
2093
- url.endsWith("/services") ? url.substring(0, url.length - 8) : url,
2094
- "sdl"
2095
- )
2096
- );
2097
2098
  const fetcher = createCDNArtifactFetcher({
2098
- endpoint: endpoints,
2099
+ endpoint: Array.isArray(endpoint) ? (
2100
+ // no endpoint.map just to make ts happy without casting
2101
+ [ensureSdl2(endpoint[0]), ensureSdl2(endpoint[1])]
2102
+ ) : ensureSdl2(endpoint),
2099
2103
  circuitBreaker,
2100
2104
  accessKey: key,
2101
2105
  logger: configContext.log.child("[hiveSchemaFetcher] ")
@@ -2199,10 +2203,12 @@ function createGatewayRuntime(config) {
2199
2203
  setResult([]);
2200
2204
  }
2201
2205
  },
2202
- async onDispose() {
2206
+ onDispose() {
2203
2207
  pausePolling2();
2204
- await transportExecutorStack.disposeAsync();
2205
- return schemaFetcher.dispose?.();
2208
+ return handleMaybePromise(
2209
+ () => transportExecutorStack.disposeAsync(),
2210
+ () => schemaFetcher.dispose?.()
2211
+ );
2206
2212
  }
2207
2213
  };
2208
2214
  readinessChecker = () => handleMaybePromise(
@@ -2430,12 +2436,18 @@ function createGatewayRuntime(config) {
2430
2436
  let unifiedGraphFetcher;
2431
2437
  if (typeof config.supergraph === "object" && "type" in config.supergraph) {
2432
2438
  if (config.supergraph.type === "hive") {
2439
+ let ensureSupergraph2 = function(endpoint2) {
2440
+ if (!/\/supergraph(\.graphql)*$/.test(endpoint2)) {
2441
+ endpoint2 = joinUrl(endpoint2, "supergraph");
2442
+ }
2443
+ return endpoint2;
2444
+ };
2433
2445
  const { endpoint, key, circuitBreaker } = config.supergraph;
2434
- const endpoints = (Array.isArray(endpoint) ? endpoint : [endpoint]).map(
2435
- (url) => url.endsWith("/supergraph") ? url : `${url}/supergraph`
2436
- );
2437
2446
  const fetcher = createCDNArtifactFetcher({
2438
- endpoint: endpoints,
2447
+ endpoint: Array.isArray(endpoint) ? (
2448
+ // no endpoint.map just to make ts happy without casting
2449
+ [ensureSupergraph2(endpoint[0]), ensureSupergraph2(endpoint[1])]
2450
+ ) : ensureSupergraph2(endpoint),
2439
2451
  accessKey: key,
2440
2452
  logger: configContext.log.child("[hiveSupergraphFetcher] "),
2441
2453
  // @ts-expect-error - MeshFetch is not compatible with `typeof fetch`
@@ -2543,8 +2555,9 @@ function createGatewayRuntime(config) {
2543
2555
  getExecutor = () => unifiedGraphManager.getExecutor();
2544
2556
  unifiedGraphPlugin = {
2545
2557
  onDispose() {
2546
- return unfakePromise(
2547
- fakePromise(void 0).then(() => dispose(unifiedGraphManager)).then(() => unifiedGraphFetcher.dispose?.())
2558
+ return handleMaybePromise(
2559
+ () => dispose(unifiedGraphManager),
2560
+ () => unifiedGraphFetcher.dispose?.()
2548
2561
  );
2549
2562
  }
2550
2563
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-hive/gateway-runtime",
3
- "version": "2.4.0-alpha-65ad5f97b6cf2a8dd5ad0a7bb8ea9cf3b540b497",
3
+ "version": "2.4.0-alpha-b2b2f2862d2a13c2868dada93d42f78d08fa0e02",
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.46.0",
57
57
  "@graphql-mesh/cross-helpers": "^0.4.10",
58
- "@graphql-mesh/fusion-runtime": "1.6.2-alpha-65ad5f97b6cf2a8dd5ad0a7bb8ea9cf3b540b497",
58
+ "@graphql-mesh/fusion-runtime": "1.6.2-alpha-b2b2f2862d2a13c2868dada93d42f78d08fa0e02",
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.8-alpha-65ad5f97b6cf2a8dd5ad0a7bb8ea9cf3b540b497",
65
- "@graphql-tools/delegate": "12.0.2-alpha-65ad5f97b6cf2a8dd5ad0a7bb8ea9cf3b540b497",
64
+ "@graphql-tools/batch-delegate": "10.0.8-alpha-b2b2f2862d2a13c2868dada93d42f78d08fa0e02",
65
+ "@graphql-tools/delegate": "12.0.2-alpha-b2b2f2862d2a13c2868dada93d42f78d08fa0e02",
66
66
  "@graphql-tools/executor-common": "^1.0.5",
67
67
  "@graphql-tools/executor-http": "^3.0.7",
68
- "@graphql-tools/federation": "4.2.6-alpha-65ad5f97b6cf2a8dd5ad0a7bb8ea9cf3b540b497",
69
- "@graphql-tools/stitch": "10.1.6-alpha-65ad5f97b6cf2a8dd5ad0a7bb8ea9cf3b540b497",
68
+ "@graphql-tools/federation": "4.2.6-alpha-b2b2f2862d2a13c2868dada93d42f78d08fa0e02",
69
+ "@graphql-tools/stitch": "10.1.6-alpha-b2b2f2862d2a13c2868dada93d42f78d08fa0e02",
70
70
  "@graphql-tools/utils": "^10.10.3",
71
- "@graphql-tools/wrap": "11.1.2-alpha-65ad5f97b6cf2a8dd5ad0a7bb8ea9cf3b540b497",
71
+ "@graphql-tools/wrap": "11.1.2-alpha-b2b2f2862d2a13c2868dada93d42f78d08fa0e02",
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",