How to use graphql-parse-resolve-info - 6 common examples

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);
    }
github graphile / graphile-engine / packages / graphile-build / src / makeNewBuild.ts View on Github external
function getSafeAliasFromResolveInfo(
  resolveInfo: import("graphql").GraphQLResolveInfo
) {
  const alias = rawGetAliasFromResolveInfo(resolveInfo);
  return getSafeAliasFromAlias(alias);
}

graphql-parse-resolve-info

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

MIT
Latest version published 2 years ago

Package Health Score

66 / 100
Full package analysis