Skip to content

Commit 9845df6

Browse files
committed
add mirror and circuit breaker to persisted documents
1 parent be85e4a commit 9845df6

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/runtime/src/createGatewayRuntime.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ export function createGatewayRuntime<
232232
endpoint: config.persistedDocuments.endpoint,
233233
accessToken: config.persistedDocuments.token,
234234
},
235+
circuitBreaker: config.persistedDocuments.circuitBreaker,
235236
// @ts-expect-error - Hive Console plugin options are not compatible yet
236237
allowArbitraryDocuments: allowArbitraryDocumentsForPersistedDocuments,
237238
},

packages/runtime/src/types.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Plugin as EnvelopPlugin } from '@envelop/core';
22
import type { GenericAuthPluginOptions } from '@envelop/generic-auth';
3+
import { CircuitBreakerConfiguration } from '@graphql-hive/core';
34
import type { Logger, LogLevel } from '@graphql-hive/logger';
45
import type { PubSub } from '@graphql-hive/pubsub';
56
import type {
@@ -50,7 +51,6 @@ import { RequestIdOptions } from './plugins/useRequestId';
5051
import { SubgraphErrorPluginOptions } from './plugins/useSubgraphErrorPlugin';
5152
import { UpstreamRetryPluginOptions } from './plugins/useUpstreamRetry';
5253
import { UpstreamTimeoutPluginOptions } from './plugins/useUpstreamTimeout';
53-
import { CircuitBreakerConfiguration } from '@graphql-hive/core';
5454

5555
export type { UnifiedGraphHandler, UnifiedGraphPlugin };
5656
export type { TransportEntryAdditions, UnifiedGraphConfig };
@@ -441,7 +441,11 @@ export interface GatewayHivePersistedDocumentsOptions {
441441
/**
442442
* GraphQL Hive persisted documents CDN endpoint URL.
443443
*/
444-
endpoint: string;
444+
endpoint: string | [string, string];
445+
/**
446+
* Circuit Breaker configuration to customize CDN failures handling and switch to mirror endpoint.
447+
*/
448+
circuitBreaker?: CircuitBreakerConfiguration;
445449
/**
446450
* GraphQL Hive persisted documents CDN access token.
447451
*/

0 commit comments

Comments
 (0)