How to use the graphql-parse-resolve-info.parseResolveInfo function in graphql-parse-resolve-info

To help you get started, we’ve selected a few graphql-parse-resolve-info examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fullstack-build / fullstack-one / packages / graphql / dist / queryBuilder / sqlGenerator / read.js View on Github external
build(obj, args, context, info, isAuthenticated, match = null) {
        // Use PostGraphile parser to get nested query object
        const query = graphql_parse_resolve_info_1.parseResolveInfo(info);
        const costTree = {};
        // The first query is always a aggregation (array of objects) => Just like SQL you'll always get rows
        const { sql, counter, values, authRequired } = this.jsonAgg(0, query, [], isAuthenticated, match, costTree);
        const maxDepth = this.calculateMaxDepth(costTree[query.name]);
        const potentialHighCost = maxDepth >= this.minQueryDepthToCheckCostLimit;
        return { sql: `SELECT ${sql};`, values, query, authRequired, potentialHighCost, costTree, maxDepth };
    }
}
github fullstack-build / fullstack-one / packages / graphql / dist / queryBuilder / sqlGenerator / mutate.js View on Github external
build(obj, args, context, info) {
        // Use PostGraphile parser to get nested query object
        const query = graphql_parse_resolve_info_1.parseResolveInfo(info);
        // Get mutation information from generated Schema-data
        const mutation = this.resolverMeta.mutation[query.name];
        // Switch mutation type
        switch (mutation.type) {
            case "CREATE":
                return this.resolveCreateMutation(query, mutation);
            case "UPDATE":
                return this.resolveUpdateMutation(query, mutation);
            case "DELETE":
                return this.resolveDeleteMutation(query, mutation);
            default:
                throw new Error(`Mutation-Type does not exist: ${mutation.type}`);
        }
    }
}
github fullstack-build / fullstack-one / packages / graphql / lib / getDefaultResolvers / types.ts View on Github external
export function parseResolveInfo(info: GraphQLResolveInfo): IParsedResolveInfo {
  return graphQlParseResolveInfo(info);
}
github gql-dal / greldal / src / ResolveInfoVisitor.ts View on Github external
constructor(
        public originalResolveInfoRoot: GraphQLResolveInfo,
        public rootSource: TSrc,
        parsedResolveInfo?: ResolveTree,
        public parentSource?: TParentVisitor,
    ) {
        this.parsedResolveInfo =
            parsedResolveInfo ||
            //TODO: Remove any after version incompatibility with typings is resolved
            (parseResolveInfo(originalResolveInfoRoot as any) as any);
    }
github gql-dal / greldal / src / PaginatedResolveInfoVisitor.ts View on Github external
constructor(
        public originalResolveInfoRoot: GraphQLResolveInfo,
        public rootSource: TSrc,
        parsedResolveInfo?: ResolveTree,
        public parentSource?: TParentVisitor,
    ) {
        this.parsedResolveInfo =
            parsedResolveInfo ||
            //TODO: Remove any after version incompatibility with typings is resolved
            (parseResolveInfo(originalResolveInfoRoot as any) as any);
    }

graphql-parse-resolve-info

Parse GraphQLResolveInfo (the 4th argument of resolve) into a simple tree

MIT
Latest version published 1 year ago

Package Health Score

73 / 100
Full package analysis