@graphql-tools/stitching-directives 3.1.0 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,6 @@ const utils_1 = require("@graphql-tools/utils");
7
7
  const defaultStitchingDirectiveOptions_js_1 = require("./defaultStitchingDirectiveOptions.js");
8
8
  const parseMergeArgsExpr_js_1 = require("./parseMergeArgsExpr.js");
9
9
  const properties_js_1 = require("./properties.js");
10
- const stitchingDirectivesValidator_js_1 = require("./stitchingDirectivesValidator.js");
11
10
  function stitchingDirectivesTransformer(options = {}) {
12
11
  const { keyDirectiveName, computedDirectiveName, mergeDirectiveName, canonicalDirectiveName, pathToDirectivesInExtensions, } = {
13
12
  ...defaultStitchingDirectiveOptions_js_1.defaultStitchingDirectiveOptions,
@@ -22,8 +21,6 @@ function stitchingDirectivesTransformer(options = {}) {
22
21
  const selectionSetsByTypeAndEntryField = Object.create(null);
23
22
  const mergedTypesResolversInfoByEntryField = Object.create(null);
24
23
  const schema = subschemaConfig.schema;
25
- // gateway should also run validation
26
- (0, stitchingDirectivesValidator_js_1.stitchingDirectivesValidator)(options)(schema);
27
24
  function setCanonicalDefinition(typeName, fieldName) {
28
25
  canonicalTypesInfo[typeName] = canonicalTypesInfo[typeName] || Object.create(null);
29
26
  if (fieldName) {
@@ -355,6 +352,15 @@ function stitchingDirectivesTransformer(options = {}) {
355
352
  }
356
353
  entryPoints.push(newEntryPoint);
357
354
  }
355
+ if (entryPoints.length === 1) {
356
+ const [entryPoint] = entryPoints;
357
+ const { fields, canonical } = newMergeConfig[typeName];
358
+ newMergeConfig[typeName] = {
359
+ ...entryPoint,
360
+ fields,
361
+ canonical,
362
+ };
363
+ }
358
364
  }
359
365
  return newSubschemaConfig;
360
366
  };
@@ -4,7 +4,6 @@ import { getDirective, getImplementingTypes, MapperKind, mapSchema, mergeDeep, p
4
4
  import { defaultStitchingDirectiveOptions } from './defaultStitchingDirectiveOptions.js';
5
5
  import { parseMergeArgsExpr } from './parseMergeArgsExpr.js';
6
6
  import { addProperty, getProperties, getProperty } from './properties.js';
7
- import { stitchingDirectivesValidator } from './stitchingDirectivesValidator.js';
8
7
  export function stitchingDirectivesTransformer(options = {}) {
9
8
  const { keyDirectiveName, computedDirectiveName, mergeDirectiveName, canonicalDirectiveName, pathToDirectivesInExtensions, } = {
10
9
  ...defaultStitchingDirectiveOptions,
@@ -19,8 +18,6 @@ export function stitchingDirectivesTransformer(options = {}) {
19
18
  const selectionSetsByTypeAndEntryField = Object.create(null);
20
19
  const mergedTypesResolversInfoByEntryField = Object.create(null);
21
20
  const schema = subschemaConfig.schema;
22
- // gateway should also run validation
23
- stitchingDirectivesValidator(options)(schema);
24
21
  function setCanonicalDefinition(typeName, fieldName) {
25
22
  canonicalTypesInfo[typeName] = canonicalTypesInfo[typeName] || Object.create(null);
26
23
  if (fieldName) {
@@ -352,6 +349,15 @@ export function stitchingDirectivesTransformer(options = {}) {
352
349
  }
353
350
  entryPoints.push(newEntryPoint);
354
351
  }
352
+ if (entryPoints.length === 1) {
353
+ const [entryPoint] = entryPoints;
354
+ const { fields, canonical } = newMergeConfig[typeName];
355
+ newMergeConfig[typeName] = {
356
+ ...entryPoint,
357
+ fields,
358
+ canonical,
359
+ };
360
+ }
355
361
  }
356
362
  return newSubschemaConfig;
357
363
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/stitching-directives",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "A set of utils for faster development of GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {