lib/write.js
function beforeCommit(object, callback) {
  var self = this;
  async.waterfall([
    this.triggerTransformEvent.bind(this, 'prepare', object),
    this.triggerProgressionEvent.bind(this, 'validate'),
    this.triggerEvent.bind(this, 'beforeSave')
  ], function(err, object) {
    if (err) return callback(err);

    // run beforeCommit on all composed objects as well.
    transformComps.call(self, object, object, function(comp, object, i, cb) {
      if (comp.transient) return cb();
      beforeCommit.call(comp.model, object, cb);
    }, callback);
  });
}
function beforeCommit(object, callback) {
  var self = this;
  async.waterfall([
    this.triggerTransformEvent.bind(this, 'prepare', object),
    this.triggerProgressionEvent.bind(this, 'validate'),
    this.triggerEvent.bind(this, 'beforeSave')
  ], function(err, object) {
    if (err) return callback(err);

    // run beforeCommit on all composed objects as well.
    transformComps.call(self, object, object, function(comp, object, i, cb) {
      if (comp.transient) return cb();
      beforeCommit.call(comp.model, object, cb);
    }, callback);
  });
}
function beforeCommit ( object , callback ) { var self = this ; async . waterfall ( [ this . triggerTransformEvent . bind ( this , 'prepare' , object ) , this . triggerProgressionEvent . bind ( this , 'validate' ) , this . triggerEvent . bind ( this , 'beforeSave' ) ] , function ( err , object ) { if ( err ) return callback ( err ) ; // run beforeCommit on all composed objects as well. transformComps . call ( self , object , object , function ( comp , object , i , cb ) { if ( comp . transient ) return cb ( ) ; beforeCommit . call ( comp . model , object , cb ) ; } , callback ) ; } ) ; }
prepare, validate, beforeSave
prepare validate beforeSave