fix: connection plugin (#569)
fixes #402 fixes #450 Fixes: - Global connection field extensions were never executed - Typings of global connection field extension (root, args and the resolver return type was wrong) - Typings of local connection field extension (everything was any)
This commit is contained in:
parent
980920a72a
commit
de7cdfd396
|
|
@ -109,6 +109,58 @@ export interface NexusGenFieldTypes {
|
|||
}
|
||||
}
|
||||
|
||||
export interface NexusGenFieldTypeNames {
|
||||
Launch: {
|
||||
// field return type name
|
||||
id: 'ID'
|
||||
isBooked: 'Boolean'
|
||||
mission: 'Mission'
|
||||
rocket: 'Rocket'
|
||||
site: 'String'
|
||||
}
|
||||
LaunchConnection: {
|
||||
// field return type name
|
||||
cursor: 'String'
|
||||
hasMore: 'Boolean'
|
||||
launches: 'Launch'
|
||||
}
|
||||
Mission: {
|
||||
// field return type name
|
||||
missionPatch: 'String'
|
||||
name: 'String'
|
||||
}
|
||||
Mutation: {
|
||||
// field return type name
|
||||
bookTrips: 'TripUpdateResponse'
|
||||
cancelTrip: 'TripUpdateResponse'
|
||||
login: 'String'
|
||||
}
|
||||
Query: {
|
||||
// field return type name
|
||||
launch: 'Launch'
|
||||
launches: 'LaunchConnection'
|
||||
me: 'User'
|
||||
}
|
||||
Rocket: {
|
||||
// field return type name
|
||||
id: 'ID'
|
||||
name: 'String'
|
||||
type: 'String'
|
||||
}
|
||||
TripUpdateResponse: {
|
||||
// field return type name
|
||||
launches: 'Launch'
|
||||
message: 'String'
|
||||
success: 'Boolean'
|
||||
}
|
||||
User: {
|
||||
// field return type name
|
||||
email: 'String'
|
||||
id: 'ID'
|
||||
trips: 'Launch'
|
||||
}
|
||||
}
|
||||
|
||||
export interface NexusGenArgTypes {
|
||||
Mission: {
|
||||
missionPatch: {
|
||||
|
|
@ -174,6 +226,7 @@ export interface NexusGenTypes {
|
|||
rootTypes: NexusGenRootTypes
|
||||
argTypes: NexusGenArgTypes
|
||||
fieldTypes: NexusGenFieldTypes
|
||||
fieldTypeNames: NexusGenFieldTypeNames
|
||||
allTypes: NexusGenAllTypes
|
||||
inheritedFields: NexusGenInheritedFields
|
||||
objectNames: NexusGenObjectNames
|
||||
|
|
|
|||
|
|
@ -130,6 +130,61 @@ export interface NexusGenFieldTypes {
|
|||
}
|
||||
}
|
||||
|
||||
export interface NexusGenFieldTypeNames {
|
||||
Comment: {
|
||||
// field return type name
|
||||
content: 'String'
|
||||
createdAt: 'Float'
|
||||
id: 'Int'
|
||||
postedBy: 'User'
|
||||
repoName: 'String'
|
||||
}
|
||||
Entry: {
|
||||
// field return type name
|
||||
commentCount: 'Int'
|
||||
comments: 'Comment'
|
||||
createdAt: 'Float'
|
||||
hotScore: 'Float'
|
||||
id: 'Int'
|
||||
postedBy: 'User'
|
||||
repository: 'Repository'
|
||||
score: 'Int'
|
||||
vote: 'Vote'
|
||||
}
|
||||
Mutation: {
|
||||
// field return type name
|
||||
submitComment: 'Comment'
|
||||
submitRepository: 'Entry'
|
||||
vote: 'Entry'
|
||||
}
|
||||
Query: {
|
||||
// field return type name
|
||||
currentUser: 'User'
|
||||
entry: 'Entry'
|
||||
feed: 'Entry'
|
||||
}
|
||||
Repository: {
|
||||
// field return type name
|
||||
description: 'String'
|
||||
full_name: 'String'
|
||||
html_url: 'String'
|
||||
name: 'String'
|
||||
open_issues_count: 'Int'
|
||||
owner: 'User'
|
||||
stargazers_count: 'Int'
|
||||
}
|
||||
User: {
|
||||
// field return type name
|
||||
avatar_url: 'String'
|
||||
html_url: 'String'
|
||||
login: 'String'
|
||||
}
|
||||
Vote: {
|
||||
// field return type name
|
||||
vote_value: 'Int'
|
||||
}
|
||||
}
|
||||
|
||||
export interface NexusGenArgTypes {
|
||||
Entry: {
|
||||
comments: {
|
||||
|
|
@ -190,6 +245,7 @@ export interface NexusGenTypes {
|
|||
rootTypes: NexusGenRootTypes
|
||||
argTypes: NexusGenArgTypes
|
||||
fieldTypes: NexusGenFieldTypes
|
||||
fieldTypeNames: NexusGenFieldTypeNames
|
||||
allTypes: NexusGenAllTypes
|
||||
inheritedFields: NexusGenInheritedFields
|
||||
objectNames: NexusGenObjectNames
|
||||
|
|
|
|||
|
|
@ -98,6 +98,9 @@ input NestedType {
|
|||
veryNested: String
|
||||
}
|
||||
|
||||
"""
|
||||
A "Node" is an Object with a required ID field (id), per the https://relay.dev/docs/en/graphql-server-specification
|
||||
"""
|
||||
interface Node {
|
||||
id: ID!
|
||||
}
|
||||
|
|
@ -250,12 +253,13 @@ type SomeItem {
|
|||
id: ID
|
||||
}
|
||||
|
||||
type TestObj implements Bar & Baz {
|
||||
type TestObj implements Bar & Baz & Node {
|
||||
"""
|
||||
'A' description
|
||||
"""
|
||||
a: Bar
|
||||
argsTest(a: InputType = { answer: 2, key: "one" }): Boolean
|
||||
id: ID!
|
||||
item: String
|
||||
ok: Boolean
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export const NodePlugin = plugin({
|
|||
return interfaceType({
|
||||
name: 'Node',
|
||||
description:
|
||||
'A "Node" is a field with a required ID field (id), per the https://relay.dev/docs/en/graphql-server-specification',
|
||||
'A "Node" is an Object with a required ID field (id), per the https://relay.dev/docs/en/graphql-server-specification',
|
||||
definition(t) {
|
||||
t.id('id', {
|
||||
nullable: false,
|
||||
|
|
@ -52,8 +52,9 @@ export const NodePlugin = plugin({
|
|||
},
|
||||
})
|
||||
t.resolveType((t) => {
|
||||
if (t.__typename) {
|
||||
return t.__typename
|
||||
// https://github.com/graphql-nexus/schema/issues/188
|
||||
if ((t as any).__typename) {
|
||||
return (t as any).__typename
|
||||
}
|
||||
throw new Error('__typename missing for resolving Node')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ export interface NexusGenRootTypes {
|
|||
}
|
||||
Bar: NexusGenRootTypes['Foo'] | NexusGenRootTypes['TestObj']
|
||||
Baz: NexusGenRootTypes['TestObj']
|
||||
Node: any
|
||||
Node: NexusGenRootTypes['TestObj']
|
||||
UnusedInterface: UnusedInterfaceTypeDef
|
||||
TestUnion: NexusGenRootTypes['Foo']
|
||||
}
|
||||
|
|
@ -221,6 +221,7 @@ export interface NexusGenFieldTypes {
|
|||
// field return type
|
||||
a: NexusGenRootTypes['Bar'] | null // Bar
|
||||
argsTest: boolean | null // Boolean
|
||||
id: string // ID!
|
||||
item: string | null // String
|
||||
ok: boolean | null // Boolean
|
||||
}
|
||||
|
|
@ -259,11 +260,120 @@ export interface NexusGenFieldTypes {
|
|||
}
|
||||
}
|
||||
|
||||
export interface NexusGenFieldTypeNames {
|
||||
BooleanConnection: {
|
||||
// field return type name
|
||||
edges: 'BooleanEdge'
|
||||
pageInfo: 'PageInfo'
|
||||
}
|
||||
BooleanEdge: {
|
||||
// field return type name
|
||||
cursor: 'String'
|
||||
node: 'Boolean'
|
||||
}
|
||||
ComplexObject: {
|
||||
// field return type name
|
||||
id: 'ID'
|
||||
}
|
||||
DateConnection: {
|
||||
// field return type name
|
||||
edges: 'DateEdge'
|
||||
pageInfo: 'PageInfo'
|
||||
}
|
||||
DateEdge: {
|
||||
// field return type name
|
||||
cursor: 'String'
|
||||
node: 'Date'
|
||||
}
|
||||
Foo: {
|
||||
// field return type name
|
||||
argsTest: 'Boolean'
|
||||
name: 'String'
|
||||
ok: 'Boolean'
|
||||
}
|
||||
Mutation: {
|
||||
// field return type name
|
||||
ok: 'Boolean'
|
||||
someMutationField: 'Foo'
|
||||
}
|
||||
PageInfo: {
|
||||
// field return type name
|
||||
endCursor: 'String'
|
||||
hasNextPage: 'Boolean'
|
||||
hasPreviousPage: 'Boolean'
|
||||
startCursor: 'String'
|
||||
}
|
||||
Query: {
|
||||
// field return type name
|
||||
asArgExample: 'String'
|
||||
bar: 'TestObj'
|
||||
booleanConnection: 'BooleanConnection'
|
||||
complexQuery: 'ComplexObject'
|
||||
dateAsList: 'Date'
|
||||
extended: 'SomeItem'
|
||||
getNumberOrNull: 'Int'
|
||||
guardedConnection: 'DateConnection'
|
||||
inlineArgs: 'String'
|
||||
inputAsArgExample: 'String'
|
||||
protectedField: 'Int'
|
||||
userConnectionAdditionalArgs: 'UserConnection'
|
||||
userConnectionBackwardOnly: 'UserConnection'
|
||||
userConnectionForwardOnly: 'UserConnection'
|
||||
usersConnectionNodes: 'UserConnection'
|
||||
usersConnectionResolve: 'UserConnection'
|
||||
}
|
||||
SomeItem: {
|
||||
// field return type name
|
||||
id: 'ID'
|
||||
}
|
||||
TestObj: {
|
||||
// field return type name
|
||||
a: 'Bar'
|
||||
argsTest: 'Boolean'
|
||||
id: 'ID'
|
||||
item: 'String'
|
||||
ok: 'Boolean'
|
||||
}
|
||||
User: {
|
||||
// field return type name
|
||||
id: 'ID'
|
||||
name: 'String'
|
||||
}
|
||||
UserConnection: {
|
||||
// field return type name
|
||||
edges: 'UserEdge'
|
||||
pageInfo: 'PageInfo'
|
||||
}
|
||||
UserEdge: {
|
||||
// field return type name
|
||||
cursor: 'String'
|
||||
node: 'User'
|
||||
}
|
||||
Bar: {
|
||||
// field return type name
|
||||
argsTest: 'Boolean'
|
||||
ok: 'Boolean'
|
||||
}
|
||||
Baz: {
|
||||
// field return type name
|
||||
a: 'Bar'
|
||||
ok: 'Boolean'
|
||||
}
|
||||
Node: {
|
||||
// field return type name
|
||||
id: 'ID'
|
||||
}
|
||||
UnusedInterface: {
|
||||
// field return type name
|
||||
ok: 'Boolean'
|
||||
}
|
||||
}
|
||||
|
||||
export interface NexusGenArgTypes {
|
||||
Foo: {
|
||||
argsTest: {
|
||||
// args
|
||||
a?: NexusGenInputs['InputType'] | null // InputType
|
||||
a: NexusGenInputs['InputType'] | null // InputType
|
||||
}
|
||||
}
|
||||
Mutation: {
|
||||
|
|
@ -338,13 +448,13 @@ export interface NexusGenArgTypes {
|
|||
TestObj: {
|
||||
argsTest: {
|
||||
// args
|
||||
a?: NexusGenInputs['InputType'] | null // InputType
|
||||
a: NexusGenInputs['InputType'] | null // InputType
|
||||
}
|
||||
}
|
||||
Bar: {
|
||||
argsTest: {
|
||||
// args
|
||||
a?: NexusGenInputs['InputType'] | null // InputType
|
||||
a: NexusGenInputs['InputType'] | null // InputType
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -353,6 +463,7 @@ export interface NexusGenAbstractResolveReturnTypes {
|
|||
TestUnion: 'Foo'
|
||||
Bar: 'Foo' | 'TestObj'
|
||||
Baz: 'TestObj'
|
||||
Node: 'TestObj'
|
||||
}
|
||||
|
||||
export interface NexusGenInheritedFields {}
|
||||
|
|
@ -389,6 +500,7 @@ export interface NexusGenTypes {
|
|||
rootTypes: NexusGenRootTypes
|
||||
argTypes: NexusGenArgTypes
|
||||
fieldTypes: NexusGenFieldTypes
|
||||
fieldTypeNames: NexusGenFieldTypeNames
|
||||
allTypes: NexusGenAllTypes
|
||||
inheritedFields: NexusGenInheritedFields
|
||||
objectNames: NexusGenObjectNames
|
||||
|
|
|
|||
|
|
@ -73,6 +73,38 @@ export interface NexusGenFieldTypes {
|
|||
}
|
||||
}
|
||||
|
||||
export interface NexusGenFieldTypeNames {
|
||||
Droid: {
|
||||
// field return type name
|
||||
appearsIn: 'Episode'
|
||||
friends: 'Character'
|
||||
id: 'String'
|
||||
name: 'String'
|
||||
primaryFunction: 'String'
|
||||
}
|
||||
Human: {
|
||||
// field return type name
|
||||
appearsIn: 'Episode'
|
||||
friends: 'Character'
|
||||
homePlanet: 'String'
|
||||
id: 'String'
|
||||
name: 'String'
|
||||
}
|
||||
Query: {
|
||||
// field return type name
|
||||
droid: 'Droid'
|
||||
hero: 'Character'
|
||||
human: 'Human'
|
||||
}
|
||||
Character: {
|
||||
// field return type name
|
||||
appearsIn: 'Episode'
|
||||
friends: 'Character'
|
||||
id: 'String'
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
|
||||
export interface NexusGenArgTypes {
|
||||
Droid: {
|
||||
appearsIn: {
|
||||
|
|
@ -132,6 +164,7 @@ export interface NexusGenTypes {
|
|||
rootTypes: NexusGenRootTypes
|
||||
argTypes: NexusGenArgTypes
|
||||
fieldTypes: NexusGenFieldTypes
|
||||
fieldTypeNames: NexusGenFieldTypeNames
|
||||
allTypes: NexusGenAllTypes
|
||||
inheritedFields: NexusGenInheritedFields
|
||||
objectNames: NexusGenObjectNames
|
||||
|
|
|
|||
|
|
@ -1060,6 +1060,937 @@ export interface NexusGenFieldTypes {
|
|||
}
|
||||
}
|
||||
|
||||
export interface NexusGenFieldTypeNames {
|
||||
ArrayTypeNode: {
|
||||
// field return type name
|
||||
elementType: 'Node'
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
BindingPattern: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
CallSignatureDeclaration: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
ClassDeclaration: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
jsDoc: 'JSDoc'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
members: 'Node'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
ComputedPropertyName: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
ConditionalTypeNode: {
|
||||
// field return type name
|
||||
checkType: 'Node'
|
||||
end: 'Int'
|
||||
extendsType: 'Node'
|
||||
falseType: 'Node'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
trueType: 'Node'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
ConstructSignatureDeclaration: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
ConstructorDeclaration: {
|
||||
// field return type name
|
||||
asteriskToken: 'Token'
|
||||
end: 'Int'
|
||||
exclamationToken: 'Token'
|
||||
flags: 'NodeFlags'
|
||||
jsDoc: 'JSDoc'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parameters: 'ParameterDeclaration'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
questionToken: 'Token'
|
||||
rawText: 'String'
|
||||
type: 'Node'
|
||||
typeName: 'DeclarationName'
|
||||
typeParameters: 'TypeParameterDeclaration'
|
||||
}
|
||||
ConstructorTypeNode: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
type: 'Node'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
EnumDeclaration: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
jsDoc: 'JSDoc'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
members: 'Node'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
ExportAssignment: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
ExportDeclaration: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
FunctionDeclaration: {
|
||||
// field return type name
|
||||
asteriskToken: 'Token'
|
||||
end: 'Int'
|
||||
exclamationToken: 'Token'
|
||||
flags: 'NodeFlags'
|
||||
jsDoc: 'JSDoc'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parameters: 'ParameterDeclaration'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
questionToken: 'Token'
|
||||
rawText: 'String'
|
||||
type: 'Node'
|
||||
typeName: 'DeclarationName'
|
||||
typeParameters: 'TypeParameterDeclaration'
|
||||
}
|
||||
FunctionTypeNode: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
type: 'Node'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
GetAccessorDeclaration: {
|
||||
// field return type name
|
||||
asteriskToken: 'Token'
|
||||
end: 'Int'
|
||||
exclamationToken: 'Token'
|
||||
flags: 'NodeFlags'
|
||||
jsDoc: 'JSDoc'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parameters: 'ParameterDeclaration'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
questionToken: 'Token'
|
||||
rawText: 'String'
|
||||
type: 'Node'
|
||||
typeName: 'DeclarationName'
|
||||
typeParameters: 'TypeParameterDeclaration'
|
||||
}
|
||||
Identifier: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
text: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
ImportDeclaration: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
ImportEqualsDeclaration: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
ImportTypeNode: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
IndexSignatureDeclaration: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
jsDoc: 'JSDoc'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
IndexedAccessTypeNode: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
InferTypeNode: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
typeParameter: 'Node'
|
||||
}
|
||||
InterfaceDeclaration: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
jsDoc: 'JSDoc'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
IntersectionTypeNode: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
types: 'Node'
|
||||
}
|
||||
JSDoc: {
|
||||
// field return type name
|
||||
comment: 'String'
|
||||
tags: 'JSDocTag'
|
||||
}
|
||||
JSDocAugmentsTag: {
|
||||
// field return type name
|
||||
comment: 'String'
|
||||
tagName: 'String'
|
||||
}
|
||||
JSDocClassTag: {
|
||||
// field return type name
|
||||
comment: 'String'
|
||||
tagName: 'String'
|
||||
}
|
||||
JSDocEnumTag: {
|
||||
// field return type name
|
||||
comment: 'String'
|
||||
tagName: 'String'
|
||||
}
|
||||
JSDocNamespaceDeclaration: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
JSDocReturnTag: {
|
||||
// field return type name
|
||||
comment: 'String'
|
||||
tagName: 'String'
|
||||
}
|
||||
JSDocTemplateTag: {
|
||||
// field return type name
|
||||
comment: 'String'
|
||||
tagName: 'String'
|
||||
}
|
||||
JSDocThisTag: {
|
||||
// field return type name
|
||||
comment: 'String'
|
||||
tagName: 'String'
|
||||
}
|
||||
JSDocTypeTag: {
|
||||
// field return type name
|
||||
comment: 'String'
|
||||
tagName: 'String'
|
||||
}
|
||||
JSDocUnknownTag: {
|
||||
// field return type name
|
||||
comment: 'String'
|
||||
tagName: 'String'
|
||||
}
|
||||
KeywordTypeNode: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
LiteralType: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
MappedTypeNode: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
MethodDeclaration: {
|
||||
// field return type name
|
||||
asteriskToken: 'Token'
|
||||
end: 'Int'
|
||||
exclamationToken: 'Token'
|
||||
flags: 'NodeFlags'
|
||||
jsDoc: 'JSDoc'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parameters: 'ParameterDeclaration'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
questionToken: 'Token'
|
||||
rawText: 'String'
|
||||
type: 'Node'
|
||||
typeName: 'DeclarationName'
|
||||
typeParameters: 'TypeParameterDeclaration'
|
||||
}
|
||||
MissingDeclaration: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
ModuleDeclaration: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
jsDoc: 'JSDoc'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
NamespaceDeclaration: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
jsDoc: 'JSDoc'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
NamespaceExportDeclaration: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
NumericLiteral: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
OptionalTypeNode: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
type: 'Node'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
ParameterDeclaration: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
jsDoc: 'JSDoc'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
type: 'Node'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
ParenthesizedType: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
type: 'Node'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
PropertyDeclaration: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
jsDoc: 'JSDoc'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
questionToken: 'Token'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
PropertyLikeDeclaration: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
PropertySignature: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
jsDoc: 'JSDoc'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
questionToken: 'Token'
|
||||
rawText: 'String'
|
||||
type: 'Node'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
QualifiedName: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
Query: {
|
||||
// field return type name
|
||||
parseFile: 'SourceFile'
|
||||
}
|
||||
RestTypeNode: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
type: 'Node'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
SetAccessorDeclaration: {
|
||||
// field return type name
|
||||
asteriskToken: 'Token'
|
||||
end: 'Int'
|
||||
exclamationToken: 'Token'
|
||||
flags: 'NodeFlags'
|
||||
jsDoc: 'JSDoc'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parameters: 'ParameterDeclaration'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
questionToken: 'Token'
|
||||
rawText: 'String'
|
||||
type: 'Node'
|
||||
typeName: 'DeclarationName'
|
||||
typeParameters: 'TypeParameterDeclaration'
|
||||
}
|
||||
SourceFile: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
statements: 'Node'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
StringLiteral: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
StringLiteralLike: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
ThisTypeNode: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
Token: {
|
||||
// field return type name
|
||||
kind: 'SyntaxKind'
|
||||
}
|
||||
TupleTypeNode: {
|
||||
// field return type name
|
||||
elementTypes: 'Node'
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
TypeAliasDeclaration: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
jsDoc: 'JSDoc'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
type: 'Node'
|
||||
typeName: 'DeclarationName'
|
||||
typeParameters: 'TypeParameterDeclaration'
|
||||
}
|
||||
TypeLiteral: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
TypeParameterDeclaration: {
|
||||
// field return type name
|
||||
constraint: 'Node'
|
||||
default: 'Node'
|
||||
end: 'Int'
|
||||
expression: 'Node'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
TypeReference: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
text: 'String'
|
||||
typeArguments: 'Node'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
UNKNOWN_NODE: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
UnionType: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
types: 'Node'
|
||||
}
|
||||
UnnamedNode: {
|
||||
// field return type name
|
||||
text: 'String'
|
||||
}
|
||||
VariableDeclaration: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
HasJSDoc: {
|
||||
// field return type name
|
||||
jsDoc: 'JSDoc'
|
||||
}
|
||||
JSDocTag: {
|
||||
// field return type name
|
||||
comment: 'String'
|
||||
tagName: 'String'
|
||||
}
|
||||
MaybeOptional: {
|
||||
// field return type name
|
||||
questionToken: 'Token'
|
||||
}
|
||||
Node: {
|
||||
// field return type name
|
||||
end: 'Int'
|
||||
flags: 'NodeFlags'
|
||||
kind: 'SyntaxKind'
|
||||
kindCode: 'Int'
|
||||
modifiers: 'Token'
|
||||
name: 'DeclarationName'
|
||||
nameText: 'String'
|
||||
parent: 'Node'
|
||||
pos: 'Int'
|
||||
rawText: 'String'
|
||||
typeName: 'DeclarationName'
|
||||
}
|
||||
}
|
||||
|
||||
export interface NexusGenArgTypes {
|
||||
ArrayTypeNode: {
|
||||
modifiers: {
|
||||
|
|
@ -1938,6 +2869,7 @@ export interface NexusGenTypes {
|
|||
rootTypes: NexusGenRootTypes
|
||||
argTypes: NexusGenArgTypes
|
||||
fieldTypes: NexusGenFieldTypes
|
||||
fieldTypeNames: NexusGenFieldTypeNames
|
||||
allTypes: NexusGenAllTypes
|
||||
inheritedFields: NexusGenInheritedFields
|
||||
objectNames: NexusGenObjectNames
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { dynamicOutputMethod } from '../dynamicMethod'
|
|||
import { completeValue, plugin } from '../plugin'
|
||||
import {
|
||||
ArgsValue,
|
||||
FieldTypeName,
|
||||
GetGen,
|
||||
MaybePromise,
|
||||
MaybePromiseDeep,
|
||||
|
|
@ -193,7 +194,7 @@ export type ConnectionFieldConfig<TypeName extends string = any, FieldName exten
|
|||
* This will cause the resulting type to be prefix'ed with the name of the type/field it is branched off of,
|
||||
* so as not to conflict with any non-extended connections.
|
||||
*/
|
||||
extendConnection?: (def: ObjectDefinitionBlock<any>) => void
|
||||
extendConnection?: (def: ObjectDefinitionBlock<FieldTypeName<TypeName, FieldName>>) => void
|
||||
/**
|
||||
* Dynamically adds additional fields to the connection "edge" when it is defined.
|
||||
* This will cause the resulting type to be prefix'ed with the name of the type/field it is branched off of,
|
||||
|
|
@ -353,7 +354,7 @@ export const connectionPlugin = (connectionPluginConfig?: ConnectionPluginConfig
|
|||
// field definition.
|
||||
if (pluginExtendConnection) {
|
||||
eachObj(pluginExtendConnection, (val, key) => {
|
||||
dynamicConfig.push(`${key}: core.SubFieldResolver<TypeName, FieldName, "${key}">`)
|
||||
dynamicConfig.push(`${key}: core.FieldResolver<core.FieldTypeName<TypeName, FieldName>, "${key}">`)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -417,8 +418,11 @@ export const connectionPlugin = (connectionPluginConfig?: ConnectionPluginConfig
|
|||
})
|
||||
}
|
||||
if (pluginExtendConnection) {
|
||||
eachObj(pluginExtendConnection, (val, key) => {
|
||||
t2.field(key, val)
|
||||
eachObj(pluginExtendConnection, (extensionFieldConfig, extensionFieldName) => {
|
||||
t2.field(extensionFieldName, {
|
||||
...extensionFieldConfig,
|
||||
resolve: (fieldConfig as any)[extensionFieldName],
|
||||
})
|
||||
})
|
||||
}
|
||||
if (fieldConfig.extendConnection instanceof Function) {
|
||||
|
|
@ -628,7 +632,7 @@ export function makeResolveFn(
|
|||
nodes: any[]
|
||||
}>
|
||||
|
||||
// Get all the nodes, before any pagination sliciing
|
||||
// Get all the nodes, before any pagination slicing
|
||||
const resolveAllNodes = () => {
|
||||
if (cachedNodes !== undefined) {
|
||||
return cachedNodes
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import * as fs from 'fs'
|
||||
import {
|
||||
getNamedType,
|
||||
GraphQLArgument,
|
||||
GraphQLEnumType,
|
||||
GraphQLField,
|
||||
|
|
@ -85,7 +86,8 @@ export class TypegenPrinter {
|
|||
this.printScalarTypeMap(),
|
||||
this.printRootTypeMap(),
|
||||
this.printAllTypesMap(),
|
||||
this.printReturnTypeMap(),
|
||||
this.printFieldTypesMap(),
|
||||
this.printFieldTypeNamesMap(),
|
||||
this.printArgTypeMap(),
|
||||
this.printAbstractResolveReturnTypeMap(),
|
||||
this.printInheritedFieldMap(),
|
||||
|
|
@ -124,6 +126,7 @@ export class TypegenPrinter {
|
|||
` rootTypes: NexusGenRootTypes;`,
|
||||
` argTypes: NexusGenArgTypes;`,
|
||||
` fieldTypes: NexusGenFieldTypes;`,
|
||||
` fieldTypeNames: NexusGenFieldTypeNames;`,
|
||||
` allTypes: NexusGenAllTypes;`,
|
||||
` inheritedFields: NexusGenInheritedFields;`,
|
||||
` objectNames: NexusGenObjectNames;`,
|
||||
|
|
@ -523,6 +526,21 @@ export class TypegenPrinter {
|
|||
return returnTypeMap
|
||||
}
|
||||
|
||||
buildReturnTypeNamesMap() {
|
||||
const returnTypeMap: TypeFieldMapping = {}
|
||||
const hasFields: (GraphQLInterfaceType | GraphQLObjectType)[] = []
|
||||
hasFields
|
||||
.concat(this.groupedTypes.object)
|
||||
.concat(this.groupedTypes.interface)
|
||||
.forEach((type) => {
|
||||
eachObj(type.getFields(), (field) => {
|
||||
returnTypeMap[type.name] = returnTypeMap[type.name] || {}
|
||||
returnTypeMap[type.name][field.name] = [':', `'${getNamedType(field.type).name}'`]
|
||||
})
|
||||
})
|
||||
return returnTypeMap
|
||||
}
|
||||
|
||||
printOutputType(type: GraphQLOutputType) {
|
||||
const returnType = this.typeToArr(type)
|
||||
function combine(item: any[]): string {
|
||||
|
|
@ -561,10 +579,18 @@ export class TypegenPrinter {
|
|||
return typing
|
||||
}
|
||||
|
||||
printReturnTypeMap() {
|
||||
printFieldTypesMap() {
|
||||
return this.printTypeFieldInterface('NexusGenFieldTypes', this.buildReturnTypeMap(), 'field return type')
|
||||
}
|
||||
|
||||
printFieldTypeNamesMap() {
|
||||
return this.printTypeFieldInterface(
|
||||
'NexusGenFieldTypeNames',
|
||||
this.buildReturnTypeNamesMap(),
|
||||
'field return type name'
|
||||
)
|
||||
}
|
||||
|
||||
normalizeArg(arg: GraphQLInputField | GraphQLArgument): [string, string] {
|
||||
return [this.argSeparator(arg.type, Boolean(arg.defaultValue)), this.argTypeRepresentation(arg.type)]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,6 +100,12 @@ export type FieldResolver<TypeName extends string, FieldName extends string> = (
|
|||
info: GraphQLResolveInfo
|
||||
) => MaybePromise<ResultValue<TypeName, FieldName>> | MaybePromiseDeep<ResultValue<TypeName, FieldName>>
|
||||
|
||||
export type FieldTypeName<TypeName extends string, FieldName extends string> = GetGen3<
|
||||
'fieldTypeNames',
|
||||
TypeName,
|
||||
FieldName
|
||||
>
|
||||
|
||||
export type SubFieldResolver<
|
||||
TypeName extends string,
|
||||
FieldName extends string,
|
||||
|
|
@ -130,6 +136,7 @@ export type GenTypesShapeKeys =
|
|||
| 'rootTypes'
|
||||
| 'argTypes'
|
||||
| 'fieldTypes'
|
||||
| 'fieldTypeNames'
|
||||
| 'allTypes'
|
||||
| 'inheritedFields'
|
||||
| 'objectNames'
|
||||
|
|
|
|||
|
|
@ -62,6 +62,12 @@ export interface NexusGenFieldTypes {
|
|||
}
|
||||
}
|
||||
|
||||
export interface NexusGenFieldTypeNames {
|
||||
Query: { // field return type name
|
||||
ok: 'Boolean'
|
||||
}
|
||||
}
|
||||
|
||||
export interface NexusGenArgTypes {
|
||||
}
|
||||
|
||||
|
|
@ -88,6 +94,7 @@ export interface NexusGenTypes {
|
|||
rootTypes: NexusGenRootTypes;
|
||||
argTypes: NexusGenArgTypes;
|
||||
fieldTypes: NexusGenFieldTypes;
|
||||
fieldTypeNames: NexusGenFieldTypeNames;
|
||||
allTypes: NexusGenAllTypes;
|
||||
inheritedFields: NexusGenInheritedFields;
|
||||
objectNames: NexusGenObjectNames;
|
||||
|
|
|
|||
|
|
@ -238,6 +238,37 @@ export interface NexusGenFieldTypes {
|
|||
}
|
||||
}
|
||||
|
||||
export interface NexusGenFieldTypeNames {
|
||||
Mutation: { // field return type name
|
||||
createPost: 'Post'
|
||||
registerClick: 'Query'
|
||||
someList: 'String'
|
||||
}
|
||||
Post: { // field return type name
|
||||
author: 'User'
|
||||
geo: 'Float'
|
||||
id: 'ID'
|
||||
messyGeo: 'Float'
|
||||
uuid: 'UUID'
|
||||
}
|
||||
Query: { // field return type name
|
||||
posts: 'Post'
|
||||
unionField: 'ExampleUnion'
|
||||
user: 'User'
|
||||
}
|
||||
User: { // field return type name
|
||||
email: 'String'
|
||||
id: 'ID'
|
||||
name: 'String'
|
||||
outEnum: 'SomeEnum'
|
||||
phone: 'String'
|
||||
posts: 'Post'
|
||||
}
|
||||
Node: { // field return type name
|
||||
id: 'ID'
|
||||
}
|
||||
}
|
||||
|
||||
export interface NexusGenArgTypes {
|
||||
Mutation: {
|
||||
createPost: { // args
|
||||
|
|
@ -290,6 +321,7 @@ export interface NexusGenTypes {
|
|||
rootTypes: NexusGenRootTypes;
|
||||
argTypes: NexusGenArgTypes;
|
||||
fieldTypes: NexusGenFieldTypes;
|
||||
fieldTypeNames: NexusGenFieldTypeNames;
|
||||
allTypes: NexusGenAllTypes;
|
||||
inheritedFields: NexusGenInheritedFields;
|
||||
objectNames: NexusGenObjectNames;
|
||||
|
|
|
|||
|
|
@ -96,6 +96,40 @@ export interface NexusGenFieldTypes {
|
|||
}
|
||||
}
|
||||
|
||||
export interface NexusGenFieldTypeNames {
|
||||
Mutation: {
|
||||
// field return type name
|
||||
createUser: 'User'
|
||||
}
|
||||
Post: {
|
||||
// field return type name
|
||||
body: 'String'
|
||||
title: 'String'
|
||||
}
|
||||
Query: {
|
||||
// field return type name
|
||||
foo: 'String'
|
||||
searchPosts: 'Post'
|
||||
user: 'User'
|
||||
}
|
||||
Subscription: {
|
||||
// field return type name
|
||||
someBoolean: 'Boolean'
|
||||
someField: 'Int'
|
||||
someFields: 'Int'
|
||||
someFloat: 'Float'
|
||||
someID: 'ID'
|
||||
someInt: 'Int'
|
||||
someInts: 'Int'
|
||||
someString: 'String'
|
||||
}
|
||||
User: {
|
||||
// field return type name
|
||||
firstName: 'String'
|
||||
lastName: 'String'
|
||||
}
|
||||
}
|
||||
|
||||
export interface NexusGenArgTypes {
|
||||
Mutation: {
|
||||
createUser: {
|
||||
|
|
@ -138,6 +172,7 @@ export interface NexusGenTypes {
|
|||
rootTypes: NexusGenRootTypes
|
||||
argTypes: NexusGenArgTypes
|
||||
fieldTypes: NexusGenFieldTypes
|
||||
fieldTypeNames: NexusGenFieldTypeNames
|
||||
allTypes: NexusGenAllTypes
|
||||
inheritedFields: NexusGenInheritedFields
|
||||
objectNames: NexusGenObjectNames
|
||||
|
|
|
|||
|
|
@ -90,6 +90,12 @@ export interface NexusGenFieldTypes {
|
|||
}
|
||||
}
|
||||
|
||||
export interface NexusGenFieldTypeNames {
|
||||
Query: { // field return type name
|
||||
ok: 'Boolean'
|
||||
}
|
||||
}
|
||||
|
||||
export interface NexusGenArgTypes {
|
||||
}
|
||||
|
||||
|
|
@ -116,6 +122,7 @@ export interface NexusGenTypes {
|
|||
rootTypes: NexusGenRootTypes;
|
||||
argTypes: NexusGenArgTypes;
|
||||
fieldTypes: NexusGenFieldTypes;
|
||||
fieldTypeNames: NexusGenFieldTypeNames;
|
||||
allTypes: NexusGenAllTypes;
|
||||
inheritedFields: NexusGenInheritedFields;
|
||||
objectNames: NexusGenObjectNames;
|
||||
|
|
|
|||
|
|
@ -48,6 +48,12 @@ export interface NexusGenFieldTypes {
|
|||
}
|
||||
}
|
||||
|
||||
export interface NexusGenFieldTypeNames {
|
||||
Query: { // field return type name
|
||||
ok: 'Boolean'
|
||||
}
|
||||
}
|
||||
|
||||
export interface NexusGenArgTypes {
|
||||
}
|
||||
|
||||
|
|
@ -74,6 +80,7 @@ export interface NexusGenTypes {
|
|||
rootTypes: NexusGenRootTypes;
|
||||
argTypes: NexusGenArgTypes;
|
||||
fieldTypes: NexusGenFieldTypes;
|
||||
fieldTypeNames: NexusGenFieldTypeNames;
|
||||
allTypes: NexusGenAllTypes;
|
||||
inheritedFields: NexusGenInheritedFields;
|
||||
objectNames: NexusGenObjectNames;
|
||||
|
|
|
|||
|
|
@ -93,6 +93,42 @@ export interface NexusGenFieldTypes {
|
|||
}
|
||||
}
|
||||
|
||||
export interface NexusGenFieldTypeNames {
|
||||
Mutation: {
|
||||
// field return type name
|
||||
createPost: 'Post'
|
||||
registerClick: 'Query'
|
||||
someList: 'String'
|
||||
}
|
||||
Post: {
|
||||
// field return type name
|
||||
author: 'User'
|
||||
geo: 'Float'
|
||||
id: 'ID'
|
||||
messyGeo: 'Float'
|
||||
uuid: 'UUID'
|
||||
}
|
||||
Query: {
|
||||
// field return type name
|
||||
posts: 'Post'
|
||||
unionField: 'ExampleUnion'
|
||||
user: 'User'
|
||||
}
|
||||
User: {
|
||||
// field return type name
|
||||
email: 'String'
|
||||
id: 'ID'
|
||||
name: 'String'
|
||||
outEnum: 'SomeEnum'
|
||||
phone: 'String'
|
||||
posts: 'Post'
|
||||
}
|
||||
Node: {
|
||||
// field return type name
|
||||
id: 'ID'
|
||||
}
|
||||
}
|
||||
|
||||
export interface NexusGenArgTypes {
|
||||
Mutation: {
|
||||
createPost: {
|
||||
|
|
@ -151,6 +187,7 @@ export interface NexusGenTypes {
|
|||
rootTypes: NexusGenRootTypes
|
||||
argTypes: NexusGenArgTypes
|
||||
fieldTypes: NexusGenFieldTypes
|
||||
fieldTypeNames: NexusGenFieldTypeNames
|
||||
allTypes: NexusGenAllTypes
|
||||
inheritedFields: NexusGenInheritedFields
|
||||
objectNames: NexusGenObjectNames
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ describe('typegenPrinter', () => {
|
|||
})
|
||||
|
||||
it('should print a return type map', () => {
|
||||
expect(typegen.printReturnTypeMap()).toMatchSnapshot()
|
||||
expect(typegen.printFieldTypesMap()).toMatchSnapshot()
|
||||
})
|
||||
|
||||
it('should print the full output', () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue