This repository was archived by the owner on Jan 4, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -607,7 +607,9 @@ var GraphQLFactoryBaseBackend = function () {
607
607
} , {
608
608
key : 'isNested' ,
609
609
value : function isNested ( info ) {
610
- return _ . get ( info , 'path' , [ ] ) . length > 1 ;
610
+ // support for current and previous graphql info objects
611
+ var infoPath = _ . get ( info , 'path' , [ ] ) ;
612
+ return _ . isArray ( infoPath ) ? infoPath . length > 1 : infoPath . prev !== undefined ;
611
613
}
612
614
613
615
// get parent type
@@ -623,7 +625,9 @@ var GraphQLFactoryBaseBackend = function () {
623
625
} , {
624
626
key : 'getCurrentPath' ,
625
627
value : function getCurrentPath ( info ) {
626
- return _ . last ( _ . get ( info , 'path' ) ) ;
628
+ // support for current and previous graphql info objects
629
+ var infoPath = _ . get ( info , 'path' ) ;
630
+ return _ . isArray ( infoPath ) ? _ . last ( infoPath ) : infoPath . key ;
627
631
}
628
632
629
633
// get type definition
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " graphql-factory-backend" ,
3
- "version" : " 0.1.0 " ,
3
+ "version" : " 0.1.1 " ,
4
4
"description" : " Backend plugin for graphql-factory" ,
5
5
"license" : " MIT" ,
6
6
"main" : " index.js" ,
Original file line number Diff line number Diff line change @@ -150,7 +150,9 @@ export class GraphQLFactoryBaseBackend {
150
150
151
151
// determine if the resolve is nested
152
152
isNested ( info ) {
153
- return _ . get ( info , 'path' , [ ] ) . length > 1
153
+ // support for current and previous graphql info objects
154
+ let infoPath = _ . get ( info , 'path' , [ ] )
155
+ return _ . isArray ( infoPath ) ? infoPath . length > 1 : infoPath . prev !== undefined
154
156
}
155
157
156
158
// get parent type
@@ -160,7 +162,9 @@ export class GraphQLFactoryBaseBackend {
160
162
161
163
// current path
162
164
getCurrentPath ( info ) {
163
- return _ . last ( _ . get ( info , 'path' ) )
165
+ // support for current and previous graphql info objects
166
+ let infoPath = _ . get ( info , 'path' )
167
+ return _ . isArray ( infoPath ) ? _ . last ( infoPath ) : infoPath . key
164
168
}
165
169
166
170
// get type definition
You can’t perform that action at this time.
0 commit comments