@@ -7801,11 +7801,11 @@ var QueryBuilder = /** @class */ (function () {
78017801 *
78027802 * Omits relations and id fields.
78037803 *
7804+ * @param model
78047805 * @param {Data } data
78057806 * @returns {Data }
78067807 */
7807- QueryBuilder . prototype . transformOutgoingData = function ( data ) {
7808- var model = this . getModel ( data . $self ( ) . entity ) ;
7808+ QueryBuilder . prototype . transformOutgoingData = function ( model , data ) {
78097809 var relations = model . getRelations ( ) ;
78107810 var returnValue = { } ;
78117811 Object . keys ( data ) . forEach ( function ( key ) {
@@ -8239,6 +8239,7 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod
82398239 if ( op [ 0 ] & 5 ) throw op [ 1 ] ; return { value : op [ 0 ] ? op [ 1 ] : void 0 , done : true } ;
82408240 }
82418241} ;
8242+ var inflection$3 = require ( 'inflection' ) ;
82428243/**
82438244 * Plugin class
82448245 */
@@ -8347,7 +8348,7 @@ var VuexORMApollo = /** @class */ (function () {
83478348 model = this . context . getModel ( state . $name ) ;
83488349 data = model . baseModel . getters ( 'find' ) ( id ) ;
83498350 args = args || { } ;
8350- args [ model . singularName ] = this . queryBuilder . transformOutgoingData ( data ) ;
8351+ args [ model . singularName ] = this . queryBuilder . transformOutgoingData ( model , data ) ;
83518352 mutationName = "create" + upcaseFirstLetter ( model . singularName ) ;
83528353 return [ 4 /*yield*/ , this . mutate ( mutationName , args , dispatch , model , false ) ] ;
83538354 case 1 :
@@ -8391,7 +8392,8 @@ var VuexORMApollo = /** @class */ (function () {
83918392 Object . keys ( args ) . forEach ( function ( key ) {
83928393 var value = args [ key ] ;
83938394 if ( value instanceof _this . context . components . Model ) {
8394- var transformedValue = _this . queryBuilder . transformOutgoingData ( value ) ;
8395+ var model_1 = _this . context . getModel ( inflection$3 . singularize ( value . $self ( ) . entity ) ) ;
8396+ var transformedValue = _this . queryBuilder . transformOutgoingData ( model_1 , value ) ;
83958397 _this . context . logger . log ( 'A' , key , 'model was found within the variables and will be transformed from' , value , 'to' , transformedValue ) ;
83968398 args [ key ] = transformedValue ;
83978399 }
@@ -8420,7 +8422,7 @@ var VuexORMApollo = /** @class */ (function () {
84208422 model = this . context . getModel ( state . $name ) ;
84218423 args = args || { } ;
84228424 args [ 'id' ] = data . id ;
8423- args [ model . singularName ] = this . queryBuilder . transformOutgoingData ( data ) ;
8425+ args [ model . singularName ] = this . queryBuilder . transformOutgoingData ( model , data ) ;
84248426 mutationName = "update" + upcaseFirstLetter ( model . singularName ) ;
84258427 return [ 4 /*yield*/ , this . mutate ( mutationName , args , dispatch , model , false ) ] ;
84268428 case 1 :
0 commit comments