UNPKG

3.09 kBTypeScriptView Raw
1import { SelectionSetNode, FieldNode, FragmentSpreadNode, InlineFragmentNode, GraphQLNamedType, GraphQLSchema, SelectionNode, GraphQLObjectType } from 'graphql';
2import { NormalizedScalarsMap, ConvertNameFn, LoadedFragment, GetFragmentSuffixFn } from './types';
3import { BaseVisitorConvertOptions } from './base-visitor';
4import { ParsedDocumentsConfig } from './base-documents-visitor';
5import { LinkField, PrimitiveAliasedFields, PrimitiveField, BaseSelectionSetProcessor } from './selection-set-processor/base';
6export declare class SelectionSetToObject<Config extends ParsedDocumentsConfig = ParsedDocumentsConfig> {
7 protected _processor: BaseSelectionSetProcessor<any>;
8 protected _scalars: NormalizedScalarsMap;
9 protected _schema: GraphQLSchema;
10 protected _convertName: ConvertNameFn<BaseVisitorConvertOptions>;
11 protected _getFragmentSuffix: GetFragmentSuffixFn;
12 protected _loadedFragments: LoadedFragment[];
13 protected _config: Config;
14 protected _parentSchemaType?: GraphQLNamedType;
15 protected _selectionSet?: SelectionSetNode;
16 protected _primitiveFields: PrimitiveField[];
17 protected _primitiveAliasedFields: PrimitiveAliasedFields[];
18 protected _linksFields: LinkField[];
19 protected _queriedForTypename: boolean;
20 constructor(_processor: BaseSelectionSetProcessor<any>, _scalars: NormalizedScalarsMap, _schema: GraphQLSchema, _convertName: ConvertNameFn<BaseVisitorConvertOptions>, _getFragmentSuffix: GetFragmentSuffixFn, _loadedFragments: LoadedFragment[], _config: Config, _parentSchemaType?: GraphQLNamedType, _selectionSet?: SelectionSetNode);
21 createNext(parentSchemaType: GraphQLNamedType, selectionSet: SelectionSetNode): SelectionSetToObject;
22 /**
23 * traverse the inline fragment nodes recursively for colleting the selectionSets on each type
24 */
25 _collectInlineFragments(parentType: GraphQLNamedType, nodes: InlineFragmentNode[], types: Map<string, Array<SelectionNode | string>>): any;
26 protected _createInlineFragmentForFieldNodes(parentType: GraphQLNamedType, fieldNodes: FieldNode[]): InlineFragmentNode;
27 protected buildFragmentSpreadsUsage(spreads: FragmentSpreadNode[]): Record<string, string[]>;
28 protected flattenSelectionSet(selections: ReadonlyArray<SelectionNode>): Map<string, Array<SelectionNode | string>>;
29 private _appendToTypeMap;
30 protected _buildGroupedSelections(): Record<string, string[]>;
31 protected buildSelectionSetString(parentSchemaType: GraphQLObjectType, selectionNodes: Array<SelectionNode | string>): string;
32 protected isRootType(type: GraphQLObjectType): boolean;
33 protected buildTypeNameField(type: GraphQLObjectType, nonOptionalTypename?: boolean, addTypename?: boolean, queriedForTypename?: boolean, skipTypeNameForRoot?: boolean): {
34 name: string;
35 type: string;
36 };
37 transformSelectionSet(): string;
38 transformFragmentSelectionSetToTypes(fragmentName: string, fragmentSuffix: string, declarationBlockConfig: any): string;
39 protected buildFragmentTypeName(name: string, suffix: string, typeName?: string): string;
40}