UNPKG

@graphql-yoga/apollo-managed-federation

Version:

This plugin integrates Apollo Managed Federation into Yoga.

24 lines (23 loc) 1.17 kB
import type { Plugin } from 'graphql-yoga'; import { FetchError, SupergraphSchemaManager, SupergraphSchemaManagerOptions } from '@graphql-tools/federation'; export type ManagedFederationPluginOptions = ((SupergraphSchemaManagerOptions & { supergraphManager?: never; }) | { supergraphManager: SupergraphSchemaManager; }) & { /** * The manager to be used for fetching the schema and keeping it up to date * If not provided, on will be instantiated with the provided options */ supergraphManager?: SupergraphSchemaManager | never; /** * Allow to customize how a schema loading failure is handled. * A failure happens when the manager failed to load the schema more than the provided max retries * count. * By default, an error is logged and the polling is restarted. * @param error The error encountered during the last fetch tentative * @param delayInSeconds The delay in seconds indicated by GraphOS before a new try */ onFailure?: (error: FetchError | unknown, delayInSeconds: number) => void; }; export declare function useManagedFederation(options?: ManagedFederationPluginOptions): Plugin;