@pothos/plugin-sub-graph
Advanced tools
Comparing version 3.6.0 to 3.7.0
# Change Log | ||
## 3.7.0 | ||
### Minor Changes | ||
- 1769afd1: Fix compatibility with Errors and Relay plugins | ||
## 3.6.0 | ||
@@ -4,0 +10,0 @@ |
/* eslint-disable prefer-destructuring */ import './global-types.js'; | ||
import { GraphQLEnumType, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLObjectType, GraphQLScalarType, GraphQLSchema, GraphQLUnionType } from 'graphql'; | ||
import { getNamedType, GraphQLEnumType, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLObjectType, GraphQLScalarType, GraphQLSchema, GraphQLUnionType } from 'graphql'; | ||
import SchemaBuilder, { BasePlugin } from '@pothos/core'; | ||
@@ -23,5 +23,2 @@ import { replaceType } from './util.js'; | ||
return new GraphQLSchema({ | ||
types: [ | ||
...newTypes.values() | ||
], | ||
directives: config.directives, | ||
@@ -93,3 +90,3 @@ extensions: config.extensions, | ||
const newArguments = {}; | ||
if (!intersect(((ref = fieldConfig.extensions) === null || ref === void 0 ? void 0 : ref.subGraphs) || [], subGraphs)) { | ||
if (!intersect(((ref = fieldConfig.extensions) === null || ref === void 0 ? void 0 : ref.subGraphs) || [], subGraphs) || !newTypes.has(getNamedType(fieldConfig.type).name)) { | ||
return; | ||
@@ -96,0 +93,0 @@ } |
@@ -76,5 +76,2 @@ /* eslint-disable prefer-destructuring */ "use strict"; | ||
return new _graphql.GraphQLSchema({ | ||
types: [ | ||
...newTypes.values() | ||
], | ||
directives: config.directives, | ||
@@ -142,3 +139,3 @@ extensions: config.extensions, | ||
const newArguments = {}; | ||
if (!intersect(((ref = fieldConfig.extensions) === null || ref === void 0 ? void 0 : ref.subGraphs) || [], subGraphs)) { | ||
if (!intersect(((ref = fieldConfig.extensions) === null || ref === void 0 ? void 0 : ref.subGraphs) || [], subGraphs) || !newTypes.has((0, _graphql.getNamedType)(fieldConfig.type).name)) { | ||
return; | ||
@@ -145,0 +142,0 @@ } |
{ | ||
"name": "@pothos/plugin-sub-graph", | ||
"version": "3.6.0", | ||
"version": "3.7.0", | ||
"description": "A Pothos plugin for creating multiple variants or sub-selections of the same graph", | ||
@@ -42,2 +42,4 @@ "main": "./lib/index.js", | ||
"@pothos/core": "3.13.0", | ||
"@pothos/plugin-errors": "3.5.0", | ||
"@pothos/plugin-relay": "3.18.0", | ||
"@pothos/test-utils": "1.3.0", | ||
@@ -44,0 +46,0 @@ "graphql": "16.5.0", |
@@ -63,5 +63,3 @@ # SubGraph Plugin for Pothos | ||
- `subGraphs.fieldsInheritFromTypes`: defaults to `false`. When true, fields on a type will default | ||
to being part of the same sub-graph as their parent type. Only applies when type does not have | ||
`defaultSubGraphsForFields` set. | ||
@@ -68,0 +66,0 @@ |
/* eslint-disable prefer-destructuring */ | ||
import './global-types'; | ||
import { | ||
getNamedType, | ||
GraphQLEnumType, | ||
@@ -46,3 +47,2 @@ GraphQLFieldConfigArgumentMap, | ||
return new GraphQLSchema({ | ||
types: [...newTypes.values()], | ||
directives: config.directives, | ||
@@ -151,3 +151,7 @@ extensions: config.extensions, | ||
if ( | ||
!intersect((fieldConfig.extensions?.subGraphs as string[] | undefined) || [], subGraphs) | ||
!intersect( | ||
(fieldConfig.extensions?.subGraphs as string[] | undefined) || [], | ||
subGraphs, | ||
) || | ||
!newTypes.has(getNamedType(fieldConfig.type).name) | ||
) { | ||
@@ -154,0 +158,0 @@ return; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
137559
6
1101
102