UNPKG

2.14 kBTypeScriptView Raw
1import { FieldDefinitionNode, GraphQLNamedType, GraphQLSchema } from 'graphql';
2/**
3 * Federation Spec
4 */
5export declare const federationSpec: import("graphql").DocumentNode;
6/**
7 * Adds `__resolveReference` in each ObjectType involved in Federation.
8 * @param schema
9 */
10export declare function addFederationReferencesToSchema(schema: GraphQLSchema): GraphQLSchema;
11/**
12 * Removes Federation Spec from GraphQL Schema
13 * @param schema
14 * @param config
15 */
16export declare function removeFederation(schema: GraphQLSchema): GraphQLSchema;
17export declare class ApolloFederation {
18 private enabled;
19 private schema;
20 private providesMap;
21 constructor({ enabled, schema }: {
22 enabled: boolean;
23 schema: GraphQLSchema;
24 });
25 /**
26 * Excludes types definde by Federation
27 * @param typeNames List of type names
28 */
29 filterTypeNames(typeNames: string[]): string[];
30 /**
31 * Excludes `__resolveReference` fields
32 * @param fieldNames List of field names
33 */
34 filterFieldNames(fieldNames: string[]): string[];
35 /**
36 * Decides if directive should not be generated
37 * @param name directive's name
38 */
39 skipDirective(name: string): boolean;
40 /**
41 * Decides if scalar should not be generated
42 * @param name directive's name
43 */
44 skipScalar(name: string): boolean;
45 /**
46 * Decides if field should not be generated
47 * @param data
48 */
49 skipField({ fieldNode, parentType }: {
50 fieldNode: FieldDefinitionNode;
51 parentType: GraphQLNamedType;
52 }): boolean;
53 isResolveReferenceField(fieldNode: FieldDefinitionNode): boolean;
54 /**
55 * Transforms ParentType signature in ObjectTypes involved in Federation
56 * @param data
57 */
58 transformParentType({ fieldNode, parentType, parentTypeSignature, }: {
59 fieldNode: FieldDefinitionNode;
60 parentType: GraphQLNamedType;
61 parentTypeSignature: string;
62 }): string;
63 private isExternalAndNotProvided;
64 private isExternal;
65 private hasProvides;
66 private translateFieldSet;
67 private extractFieldSet;
68 private createMapOfProvides;
69}