@@ -552,9 +552,12 @@ SchemaBuilderEntity.prototype.$make = function(obj) {
552552 if ( callback === undefined )
553553 callback = NOOP ;
554554 obj . $$async = [ ] ;
555+ obj . $$result = [ ] ;
555556 obj . $callback = callback ;
556557 setImmediate ( function ( ) {
557- obj . $$async . async ( callback ) ;
558+ obj . $$async . async ( function ( ) {
559+ callback ( null , obj . $$result ) ;
560+ } ) ;
558561 } ) ;
559562 return obj ;
560563 } ;
@@ -568,11 +571,15 @@ SchemaBuilderEntity.prototype.$make = function(obj) {
568571
569572 obj . $$async . push ( function ( next ) {
570573 self . save ( obj , helper , function ( err , result ) {
574+
575+ if ( obj . $$result )
576+ obj . $$result . push ( err ? null : result ) ;
577+
571578 if ( ! err )
572579 return next ( ) ;
573580 obj . $$async = null ;
574581 next = null ;
575- obj . $callback ( err ) ;
582+ obj . $callback ( err , obj . $$result ) ;
576583 } ) ;
577584 } ) ;
578585
@@ -588,11 +595,15 @@ SchemaBuilderEntity.prototype.$make = function(obj) {
588595
589596 obj . $$async . push ( function ( next ) {
590597 self . remove ( obj , helper , function ( err , result ) {
598+
599+ if ( obj . $$result )
600+ obj . $$result . push ( err ? null : result ) ;
601+
591602 if ( ! err )
592603 return next ( ) ;
593604 obj . $$async = null ;
594605 next = null ;
595- obj . $callback ( err ) ;
606+ obj . $callback ( err , obj . $$result ) ;
596607 } ) ;
597608 } ) ;
598609
@@ -616,11 +627,15 @@ SchemaBuilderEntity.prototype.$make = function(obj) {
616627
617628 obj . $$async . push ( function ( next ) {
618629 self . transform ( name , obj , helper , function ( err , result ) {
630+
631+ if ( obj . $$result )
632+ obj . $$result . push ( err ? null : result ) ;
633+
619634 if ( ! err )
620635 return next ( ) ;
621636 obj . $$async = null ;
622637 next = null ;
623- obj . $callback ( err ) ;
638+ obj . $callback ( err , obj . $$result ) ;
624639 } ) ;
625640 } ) ;
626641
@@ -636,11 +651,15 @@ SchemaBuilderEntity.prototype.$make = function(obj) {
636651
637652 obj . $$async . push ( function ( next ) {
638653 self . compose ( name , obj , helper , function ( err , result ) {
654+
655+ if ( obj . $$result )
656+ obj . $$result . push ( err ? null : result ) ;
657+
639658 if ( ! err )
640659 return next ( ) ;
641660 obj . $$async = null ;
642661 next = null ;
643- obj . $callback ( err ) ;
662+ obj . $callback ( err , obj . $$result ) ;
644663 } ) ;
645664 } ) ;
646665
@@ -656,11 +675,15 @@ SchemaBuilderEntity.prototype.$make = function(obj) {
656675
657676 obj . $$async . push ( function ( next ) {
658677 self . workflow ( name , obj , helper , function ( err , result ) {
678+
679+ if ( obj . $$result )
680+ obj . $$result . push ( err ? null : result ) ;
681+
659682 if ( ! err )
660683 return next ( ) ;
661684 obj . $$async = null ;
662685 next = null ;
663- obj . $callback ( err ) ;
686+ obj . $callback ( err , obj . $$result ) ;
664687 } ) ;
665688 } ) ;
666689
@@ -1321,6 +1344,7 @@ SchemaBuilderEntity.prototype.clean = function(m, isCopied) {
13211344
13221345 var self = this ;
13231346
1347+ delete model [ '$$result' ] ;
13241348 delete model [ '$$async' ] ;
13251349 delete model [ '$async' ] ;
13261350 delete model [ '$callback' ] ;
0 commit comments