@@ -10,7 +10,6 @@ import {
1010 singularize
1111} from "../support/utils" ;
1212import { ConnectionMode } from "../adapters/adapter" ;
13- import { GraphQLType , GraphQLField } from "../support/interfaces" ;
1413
1514/**
1615 * This class provides methods to transform incoming data from GraphQL in to a format Vuex-ORM understands and
@@ -33,15 +32,13 @@ export default class Transformer {
3332 model : Model ,
3433 data : Data ,
3534 read : boolean ,
36- inputType ?: GraphQLType ,
3735 whitelist ?: Array < String > ,
3836 outgoingRecords ?: Map < string , Array < string > > ,
3937 recursiveCall ?: boolean
4038 ) : Data {
4139 const context = Context . getInstance ( ) ;
4240 const relations : Map < string , Relation > = model . getRelations ( ) ;
4341 const returnValue : Data = { } as Data ;
44- const inputFields = inputType ? inputType . inputFields : undefined ;
4542 if ( outgoingRecords === undefined ) outgoingRecords = new Map < string , Array < string > > ( ) ;
4643 if ( recursiveCall === undefined ) recursiveCall = false ;
4744
@@ -67,8 +64,7 @@ export default class Transformer {
6764 key ,
6865 value ,
6966 model ,
70- whitelist ,
71- inputFields
67+ whitelist
7268 )
7369 ) {
7470 let relatedModel = Model . getRelatedModel ( relations . get ( key ) ! ) ;
@@ -85,7 +81,6 @@ export default class Transformer {
8581 v ,
8682 read ,
8783 undefined ,
88- undefined ,
8984 outgoingRecords ,
9085 true
9186 ) ;
@@ -107,7 +102,6 @@ export default class Transformer {
107102 value ,
108103 read ,
109104 undefined ,
110- undefined ,
111105 outgoingRecords ,
112106 true
113107 ) ;
@@ -182,12 +176,6 @@ export default class Transformer {
182176 result [ key ] = parseFloat ( data [ key ] ) ;
183177 } else if ( key . endsWith ( "Type" ) && model . isTypeFieldOfPolymorphicRelation ( key ) ) {
184178 result [ key ] = pluralize ( downcaseFirstLetter ( data [ key ] ) ) ;
185- } else if ( Array . isArray ( data [ key ] ) ) {
186- const relation : Relation | undefined = model . getRelations ( ) . get ( key ) ;
187- if ( relation ) {
188- const related : Model | null = Model . getRelatedModel ( relation ) ! ;
189- result [ key ] = this . transformIncomingData ( data [ key ] , related , mutation , true ) ;
190- }
191179 } else {
192180 result [ key ] = data [ key ] ;
193181 }
@@ -213,16 +201,14 @@ export default class Transformer {
213201 * @param {any } value Value of the field.
214202 * @param {Model } model Model class which contains the field.
215203 * @param {Array<String>|undefined } whitelist Contains a list of fields which should always be included.
216- * @param {Array<GraphQLField>|undefined } schemaFields Contains a list of schema fields which are defined in the model input type for the mutation.
217204 * @returns {boolean }
218205 */
219206 public static shouldIncludeOutgoingField (
220207 forFilter : boolean ,
221208 fieldName : string ,
222209 value : any ,
223210 model : Model ,
224- whitelist ?: Array < String > ,
225- schemaFields ?: Array < GraphQLField >
211+ whitelist ?: Array < String >
226212 ) : boolean {
227213 // Always add fields on the whitelist.
228214 if ( whitelist && whitelist . includes ( fieldName ) ) return true ;
@@ -233,9 +219,6 @@ export default class Transformer {
233219 // Ignore empty fields
234220 if ( value === null || value === undefined ) return false ;
235221
236- // Is the field in the mutation type field list, if provided?
237- if ( schemaFields && ! schemaFields . find ( f => f . name === fieldName ) ) return false ;
238-
239222 // Include all eager save connections
240223 if ( model . getRelations ( ) . has ( fieldName ) ) {
241224 // We never add relations to filters.
0 commit comments