@makerx/graphql-core 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "main": "index.js",
3
3
  "types": "index.d.ts",
4
4
  "name": "@makerx/graphql-core",
5
- "version": "1.2.1",
5
+ "version": "1.3.0",
6
6
  "private": false,
7
7
  "description": "A set of core GraphQL utilities that MakerX uses to build GraphQL APIs",
8
8
  "author": "MakerX",
package/schema-util.d.ts CHANGED
@@ -6,5 +6,5 @@ import { GraphQLSchema } from 'graphql';
6
6
  * meaning any scalars that are falling back to the default resolver will fail.
7
7
  * @param schema A schema object, the result of calling `makeExecutableSchema` from `@graphql-tools/schema`
8
8
  */
9
- export declare function requireExplicitResolversForScalars(schema: GraphQLSchema): void;
9
+ export declare function requireExplicitResolversForScalars(schema: GraphQLSchema, ...scalarsToIgnore: string[]): void;
10
10
  //# sourceMappingURL=schema-util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema-util.d.ts","sourceRoot":"","sources":["../src/schema-util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,MAAM,SAAS,CAAA;AAE1D;;;;;;GAMG;AACH,wBAAgB,kCAAkC,CAAC,MAAM,EAAE,aAAa,QAevE"}
1
+ {"version":3,"file":"schema-util.d.ts","sourceRoot":"","sources":["../src/schema-util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,MAAM,SAAS,CAAA;AAE1D;;;;;;GAMG;AACH,wBAAgB,kCAAkC,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,eAAe,EAAE,MAAM,EAAE,QAgBrG"}
package/schema-util.js CHANGED
@@ -9,20 +9,21 @@ const graphql_1 = require("graphql");
9
9
  * meaning any scalars that are falling back to the default resolver will fail.
10
10
  * @param schema A schema object, the result of calling `makeExecutableSchema` from `@graphql-tools/schema`
11
11
  */
12
- function requireExplicitResolversForScalars(schema) {
12
+ function requireExplicitResolversForScalars(schema, ...scalarsToIgnore) {
13
13
  const testSymbol = Symbol('testSymbol');
14
14
  const scalars = Object.values(schema.getTypeMap()).filter((t) => t instanceof graphql_1.GraphQLScalarType);
15
15
  for (const scalar of scalars) {
16
- if (scalar.name === 'Void')
16
+ if (scalar.name === 'Void' || scalar.name === 'JSON' || scalarsToIgnore.includes(scalar.name))
17
17
  continue;
18
18
  try {
19
19
  scalar.parseValue(testSymbol);
20
20
  }
21
21
  catch {
22
- // We expect that a parser should not handle parsing a symbol
22
+ // We expect that a good parser should throw when parsing a random symbol
23
23
  continue;
24
24
  }
25
- throw new Error(`Scalar ${scalar.name} does not appear to have an explicit resolver, or is not performing sufficient validation when parsing input`);
25
+ throw new Error(`Scalar ${scalar.name} does not appear to have an explicit resolver, or is not performing sufficient validation when parsing input. ` +
26
+ "If you're satisfied with this scalar you can ignore it in the call to `requireExplicitResolversForScalars`.");
26
27
  }
27
28
  }
28
29
  exports.requireExplicitResolversForScalars = requireExplicitResolversForScalars;
@@ -1 +1 @@
1
- {"version":3,"file":"schema-util.js","sourceRoot":"","sources":["../src/schema-util.ts"],"names":[],"mappings":";;;AAAA,qCAA0D;AAE1D;;;;;;GAMG;AACH,SAAgB,kCAAkC,CAAC,MAAqB;IACtE,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;IACvC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAA0B,EAAE,CAAC,CAAC,YAAY,2BAAiB,CAAC,CAAA;IACxH,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;QAC5B,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM;YAAE,SAAQ;QACpC,IAAI;YACF,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;SAC9B;QAAC,MAAM;YACN,6DAA6D;YAC7D,SAAQ;SACT;QACD,MAAM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