UNPKG

1.76 kBTypeScriptView Raw
1import { ScalarsMap, ConvertNameFn, AvoidOptionalsConfig } from '../types.js';
2import { GraphQLObjectType, GraphQLInterfaceType, GraphQLOutputType, GraphQLNamedType } from 'graphql';
3export declare type PrimitiveField = {
4 isConditional: boolean;
5 fieldName: string;
6};
7export declare type PrimitiveAliasedFields = {
8 alias: string;
9 fieldName: string;
10};
11export declare type LinkField = {
12 alias: string;
13 name: string;
14 type: string;
15 selectionSet: string;
16};
17export declare type NameAndType = {
18 name: string;
19 type: string;
20};
21export declare type ProcessResult = null | Array<NameAndType | string>;
22export declare type SelectionSetProcessorConfig = {
23 namespacedImportName: string | null;
24 convertName: ConvertNameFn<any>;
25 enumPrefix: boolean | null;
26 scalars: ScalarsMap;
27 formatNamedField(name: string, type?: GraphQLOutputType | GraphQLNamedType | null, isConditional?: boolean): string;
28 wrapTypeWithModifiers(baseType: string, type: GraphQLOutputType | GraphQLNamedType): string;
29 avoidOptionals?: AvoidOptionalsConfig;
30};
31export declare class BaseSelectionSetProcessor<Config extends SelectionSetProcessorConfig> {
32 config: Config;
33 constructor(config: Config);
34 buildFieldsIntoObject(allObjectsMerged: string[]): string;
35 buildSelectionSetFromStrings(pieces: string[]): string;
36 transformPrimitiveFields(_schemaType: GraphQLObjectType | GraphQLInterfaceType, _fields: PrimitiveField[]): ProcessResult;
37 transformAliasesPrimitiveFields(_schemaType: GraphQLObjectType | GraphQLInterfaceType, _fields: PrimitiveAliasedFields[]): ProcessResult;
38 transformLinkFields(_fields: LinkField[]): ProcessResult;
39 transformTypenameField(_type: string, _name: string): ProcessResult;
40}