graphql-parse-resolve-info
Advanced tools
Comparing version 4.6.0-alpha.0 to 4.7.0
@@ -6,5 +6,5 @@ if (process.env.GRAPHILE_TURBO === "1") { | ||
} | ||
module.exports = require("./dist-turbo/index.js"); | ||
module.exports = require("./build-turbo/index.js"); | ||
} else { | ||
module.exports = require("./node8plus/index.js"); | ||
} |
import { GraphQLResolveInfo, GraphQLType } from "graphql"; | ||
declare type mixed = {} | string | number | boolean | undefined | null; | ||
export interface FieldsByTypeName { | ||
@@ -11,3 +12,3 @@ [str: string]: { | ||
args: { | ||
[str: string]: unknown; | ||
[str: string]: mixed; | ||
}; | ||
@@ -20,7 +21,4 @@ fieldsByTypeName: FieldsByTypeName; | ||
deep?: boolean; | ||
forceParse?: boolean; | ||
} | ||
export declare function parseResolveInfo(resolveInfo: GraphQLResolveInfo): ResolveTree | null; | ||
export declare function parseResolveInfo(resolveInfo: GraphQLResolveInfo, forceParse: true): ResolveTree; | ||
export declare function parseResolveInfo(resolveInfo: GraphQLResolveInfo, options: ParseOptions): ResolveTree | FieldsByTypeName | null | void; | ||
export declare function parseResolveInfo(resolveInfo: GraphQLResolveInfo, options?: ParseOptions): ResolveTree | FieldsByTypeName | null | void; | ||
export declare function simplifyParsedResolveInfoFragmentWithType(parsedResolveInfoFragment: ResolveTree, type: GraphQLType): { | ||
@@ -31,3 +29,3 @@ fields: {}; | ||
args: { | ||
[str: string]: unknown; | ||
[str: string]: mixed; | ||
}; | ||
@@ -39,2 +37,2 @@ fieldsByTypeName: FieldsByTypeName; | ||
export declare const getAlias: typeof getAliasFromResolveInfo; | ||
//# sourceMappingURL=index.d.ts.map | ||
export {}; |
@@ -56,8 +56,6 @@ "use strict"; | ||
exports.getAliasFromResolveInfo = getAliasFromResolveInfo; | ||
function parseResolveInfo(resolveInfo, inOptions = {}) { | ||
function parseResolveInfo(resolveInfo, options = {}) { | ||
const fieldNodes = | ||
// @ts-ignore Property 'fieldASTs' does not exist on type 'GraphQLResolveInfo'. | ||
resolveInfo.fieldNodes || resolveInfo.fieldASTs; | ||
const options = inOptions === true ? {} : inOptions; | ||
const forceParse = inOptions === true || inOptions.forceParse; | ||
const { parentType } = resolveInfo; | ||
@@ -77,5 +75,2 @@ if (!fieldNodes) { | ||
if (!typeKey) { | ||
if (forceParse) { | ||
throw new Error(`GraphQL schema issue: simplified parseResolveInfo failed (tree had no keys); perhaps you need to use the keepRoot option?`); | ||
} | ||
return null; | ||
@@ -86,5 +81,2 @@ } | ||
if (!fieldKey) { | ||
if (forceParse) { | ||
throw new Error(`GraphQL schema issue: simplified parseResolveInfo failed (could not get key from fields); perhaps you need to use the keepRoot option?`); | ||
} | ||
return null; | ||
@@ -91,0 +83,0 @@ } |
{ | ||
"name": "graphql-parse-resolve-info", | ||
"version": "4.6.0-alpha.0", | ||
"version": "4.7.0", | ||
"description": "Parse GraphQLResolveInfo (the 4th argument of resolve) into a simple tree", | ||
@@ -9,3 +9,4 @@ "main": "index.js", | ||
"test": "jest", | ||
"prepack": "tsc -b && tsc --target ES2019 --lib ES2018 --outDir dist-turbo --declarationDir dist-turbo" | ||
"prepack": "mkdir -p node8plus && tsc && tsc --target esnext --lib esnext --outDir build-turbo --declarationDir build-turbo", | ||
"watch": "mkdir -p node8plus && tsc --watch" | ||
}, | ||
@@ -42,3 +43,3 @@ "repository": { | ||
"ts-node": "^8.1.0", | ||
"typescript": "^3.7.2" | ||
"typescript": "^3.4.5" | ||
}, | ||
@@ -51,3 +52,3 @@ "dependencies": { | ||
"index.js", | ||
"dist-turbo" | ||
"build-turbo" | ||
], | ||
@@ -57,3 +58,3 @@ "engines": { | ||
}, | ||
"gitHead": "4f7f78ce99ef1bdd8be1330fc7fc68d607e878eb" | ||
"gitHead": "b3d7a1ea967f970936a2dcdd61f94a02dea3b7fe" | ||
} |
@@ -11,3 +11,3 @@ # graphql-parse-resolve-info | ||
requested to enable optimisations to your GraphQL schema (e.g. to determine | ||
which fields are required from the SQL database). | ||
which fields are required from the backend). | ||
@@ -33,7 +33,9 @@ Useful for optimising your GraphQL resolvers by allowing them to look ahead in | ||
<table><tr> | ||
<td align="center"><a href="http://chads.website/"><img src="https://www.graphile.org/images/sponsors/chadf.png" width="90" height="90" alt="Chad Furman" /><br />Chad Furman</a></td> | ||
<td align="center"><a href="https://storyscript.io/?utm_source=postgraphile"><img src="https://www.graphile.org/images/sponsors/storyscript.png" width="90" height="90" alt="Storyscript" /><br />Storyscript</a></td> | ||
<td align="center"><a href="http://p72.vc/"><img src="https://www.graphile.org/images/sponsors/p72.png" width="90" height="90" alt="Point72 Ventures" /><br />Point72 Ventures</a></td> | ||
<td align="center"><a href="http://chads.website"><img src="https://graphile.org/images/sponsors/chadf.png" width="90" height="90" alt="Chad Furman" /><br />Chad Furman</a> *</td> | ||
<td align="center"><a href="https://storyscript.io/?utm_source=postgraphile"><img src="https://graphile.org/images/sponsors/storyscript.png" width="90" height="90" alt="Storyscript" /><br />Storyscript</a> *</td> | ||
<td align="center"><a href="https://postlight.com/?utm_source=graphile"><img src="https://graphile.org/images/sponsors/postlight.png" width="90" height="90" alt="Postlight" /><br />Postlight</a> *</td> | ||
</tr></table> | ||
<em>\* Sponsors the entire Graphile suite</em> | ||
<!-- SPONSORS_END --> | ||
@@ -40,0 +42,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
375
56833
10
568