@@ -78,16 +78,12 @@ export default class AutoPaginationTransform implements MeshTransform {
78
78
}
79
79
}
80
80
81
- transformSchema (
82
- schema : GraphQLSchema ,
83
- subschemaConfig : SubschemaConfig < any , any , any , any > ,
84
- transformedSchema : GraphQLSchema | undefined ,
85
- ) {
81
+ transformSchema ( schema : GraphQLSchema , subschemaConfig : SubschemaConfig < any , any , any , any > ) {
86
82
if ( this . config . validateSchema ) {
87
- validateSchema ( schema , this . config )
83
+ validateSchema ( subschemaConfig . schema , this . config )
88
84
}
89
- if ( transformedSchema != null ) {
90
- const queryType = transformedSchema . getQueryType ( )
85
+ if ( schema != null ) {
86
+ const queryType = schema . getQueryType ( )
91
87
if ( queryType != null ) {
92
88
const queryFields = queryType . getFields ( )
93
89
for ( const fieldName in queryFields ) {
@@ -114,7 +110,8 @@ export default class AutoPaginationTransform implements MeshTransform {
114
110
const askedRecords = Math . min ( remainingRecords , this . config . skipArgumentLimit )
115
111
_ . set ( newArgs , this . config . firstArgumentName , askedRecords )
116
112
const result = await delegateToSchema ( {
117
- schema : transformedSchema ,
113
+ schema,
114
+ fieldName,
118
115
args : newArgs ,
119
116
context,
120
117
info,
@@ -244,7 +241,8 @@ export default class AutoPaginationTransform implements MeshTransform {
244
241
const finalData = { }
245
242
for ( const fullAliasName in originalResult . data ) {
246
243
if ( fullAliasName . startsWith ( 'splitted_' ) ) {
247
- const [ , , aliasName ] = fullAliasName . split ( '_' )
244
+ const [ , , ...rest ] = fullAliasName . split ( '_' )
245
+ const aliasName = rest . join ( '_' )
248
246
finalData [ aliasName ] = finalData [ aliasName ] || [ ]
249
247
for ( const record of originalResult . data [ fullAliasName ] ) {
250
248
finalData [ aliasName ] . push ( record )
0 commit comments