Skip to content

Commit

Permalink
refactor(populate): fields-based populate (#2897)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock authored Jan 10, 2023
1 parent 1c6abec commit d667e36
Show file tree
Hide file tree
Showing 3 changed files with 503 additions and 395 deletions.
9 changes: 0 additions & 9 deletions exchanges/populate/src/helpers/node.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
import {
NameNode,
SelectionNode,
SelectionSetNode,
GraphQLOutputType,
isWrappingType,
GraphQLWrappingType,
Kind,
} from 'graphql';

export type SelectionSet = ReadonlyArray<SelectionNode>;
export type GraphQLFlatType = Exclude<GraphQLOutputType, GraphQLWrappingType>;

/** Returns the name of a given node */
export const getName = (node: { name: NameNode }): string => node.name.value;

/** Returns the SelectionSet for a given inline or defined fragment node */
export const getSelectionSet = (node: {
selectionSet?: SelectionSetNode;
}): SelectionSet =>
node.selectionSet !== undefined ? node.selectionSet.selections : [];

export const unwrapType = (
type: null | undefined | GraphQLOutputType
): GraphQLFlatType | null => {
Expand Down
Loading

0 comments on commit d667e36

Please sign in to comment.