@makerx/graphql-core 1.2.1 → 1.4.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/README.md CHANGED
@@ -223,6 +223,16 @@ This library includes a `subscriptions` module to provide simple setup using the
223
223
 
224
224
  The testing submodule exports utility functions for easily constructing ApolloClient instances for integration testing on NodeJS. The `errorPolicy` is set to `all` so that returned errors can be checked.
225
225
 
226
+ ### Setup
227
+
228
+ If you use this module, you need to install `@apollo/client`:
229
+
230
+ ```
231
+ npm install --save-dev @apollo/client
232
+ ```
233
+
234
+ ### Usage
235
+
226
236
  - `createTestClient` accepts a url and optional accessToken.
227
237
  - `createTestClientWithClientCredentials` accepts a url and client credentials config and will fetch and attach an access token to each request.
228
238
 
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.4.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",
@@ -24,13 +24,17 @@
24
24
  "lodash.pick": "^4.4.0"
25
25
  },
26
26
  "peerDependencies": {
27
- "graphql-shield": "*",
27
+ "@apollo/client": "*",
28
28
  "express": "*",
29
- "graphql": "*",
29
+ "graphql-shield": "*",
30
30
  "graphql-ws": "*",
31
+ "graphql": "*",
31
32
  "ws": "*"
32
33
  },
33
34
  "peerDependenciesMeta": {
35
+ "@apollo/client": {
36
+ "optional": true
37
+ },
34
38
  "graphql-ws": {
35
39
  "optional": true
36
40
  },
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,IAAI,KAAK,CACb,UAAU,MAAM,CAAC,IAAI,8GAA8G,CACpI,CAAA;KACF;AACH,CAAC;AAfD,gFAeC"}
1
+ {"version":3,"file":"schema-util.js","sourceRoot":"","sources":["../src/schema-util.ts"],"names":[],"mappings":";;;AAAA,qCAA0D;AAE1D;;;;;;GAMG;AACH,SAAgB,kCAAkC,CAAC,MAAqB,EAAE,GAAG,eAAyB;IACpG,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,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,IAAI,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;YAAE,SAAQ;QACvG,IAAI;YACF,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;SAC9B;QAAC,MAAM;YACN,yEAAyE;YACzE,SAAQ;SACT;QACD,MAAM,IAAI,KAAK,CACb,UAAU,MAAM,CAAC,IAAI,gHAAgH;YACnI,6GAA6G,CAChH,CAAA;KACF;AACH,CAAC;AAhBD,gFAgBC"}