lib/denormalizer.js
function (evt, callback) {
    if (!evt || !_.isObject(evt)) {
      var err = new Error('Please pass a valid event!');
      debug(err);
      throw err;
    }

    var res = false;

    var self = this;

    var evtName = dotty.get(evt, this.definitions.event.name);
    var evtPayload = dotty.get(evt, this.definitions.event.payload);

    if (evtName === this.options.commandRejectedEventName &&
      evtPayload && evtPayload.reason &&
      evtPayload.reason.name === 'AggregateDestroyedError') {

      res = true;

      var info = {
        aggregateId: evtPayload.reason.aggregateId,
        aggregateRevision: evtPayload.reason.aggregateRevision,
        aggregate: !!this.definitions.event.aggregate ? dotty.get(evt, this.definitions.event.aggregate) : undefined,
        context: !!this.definitions.event.context ? dotty.get(evt, this.definitions.event.context) : undefined
      };

      if (!this.definitions.event.revision || !dotty.exists(evt, this.definitions.event.revision) || !evtPayload.reason.aggregateId || (typeof evtPayload.reason.aggregateId !== 'string' && typeof evtPayload.reason.aggregateId !== 'number')) {
        this.onEventMissingHandle(info, evt);
        if (callback) {
          callback(null, evt, []);
        }
        return res;
      }

      this.revisionGuardStore.get(evtPayload.reason.aggregateId, function (err, rev) {
        if (err) {
          debug(err);
          if (callback) {
            callback([err])
          }
          return;
        }

        debug('revision in store is "' + rev + '" but domain says: "' + evtPayload.reason.aggregateRevision + '"')
        if (rev - 1 < evtPayload.reason.aggregateRevision) {
          info.guardRevision = rev;
          self.onEventMissingHandle(info, evt);
        } else if (rev - 1 > evtPayload.reason.aggregateRevision) {
          debug('strange: revision in store greater than revision in domain, replay?')
        }

        if (callback) {
          callback(null, evt, []);
        }
      });
      return res;
    }

    return res;
  }
function (evt, callback) {
    if (!evt || !_.isObject(evt)) {
      var err = new Error('Please pass a valid event!');
      debug(err);
      throw err;
    }

    var res = false;

    var self = this;

    var evtName = dotty.get(evt, this.definitions.event.name);
    var evtPayload = dotty.get(evt, this.definitions.event.payload);

    if (evtName === this.options.commandRejectedEventName &&
      evtPayload && evtPayload.reason &&
      evtPayload.reason.name === 'AggregateDestroyedError') {

      res = true;

      var info = {
        aggregateId: evtPayload.reason.aggregateId,
        aggregateRevision: evtPayload.reason.aggregateRevision,
        aggregate: !!this.definitions.event.aggregate ? dotty.get(evt, this.definitions.event.aggregate) : undefined,
        context: !!this.definitions.event.context ? dotty.get(evt, this.definitions.event.context) : undefined
      };

      if (!this.definitions.event.revision || !dotty.exists(evt, this.definitions.event.revision) || !evtPayload.reason.aggregateId || (typeof evtPayload.reason.aggregateId !== 'string' && typeof evtPayload.reason.aggregateId !== 'number')) {
        this.onEventMissingHandle(info, evt);
        if (callback) {
          callback(null, evt, []);
        }
        return res;
      }

      this.revisionGuardStore.get(evtPayload.reason.aggregateId, function (err, rev) {
        if (err) {
          debug(err);
          if (callback) {
            callback([err])
          }
          return;
        }

        debug('revision in store is "' + rev + '" but domain says: "' + evtPayload.reason.aggregateRevision + '"')
        if (rev - 1 < evtPayload.reason.aggregateRevision) {
          info.guardRevision = rev;
          self.onEventMissingHandle(info, evt);
        } else if (rev - 1 > evtPayload.reason.aggregateRevision) {
          debug('strange: revision in store greater than revision in domain, replay?')
        }

        if (callback) {
          callback(null, evt, []);
        }
      });
      return res;
    }

    return res;
  }
function ( evt , callback ) { if ( ! evt || ! _ . isObject ( evt ) ) { var err = new Error ( 'Please pass a valid event!' ) ; debug ( err ) ; throw err ; } var res = false ; var self = this ; var evtName = dotty . get ( evt , this . definitions . event . name ) ; var evtPayload = dotty . get ( evt , this . definitions . event . payload ) ; if ( evtName === this . options . commandRejectedEventName && evtPayload && evtPayload . reason && evtPayload . reason . name === 'AggregateDestroyedError' ) { res = true ; var info = { aggregateId : evtPayload . reason . aggregateId , aggregateRevision : evtPayload . reason . aggregateRevision , aggregate : ! ! this . definitions . event . aggregate ? dotty . get ( evt , this . definitions . event . aggregate ) : undefined , context : ! ! this . definitions . event . context ? dotty . get ( evt , this . definitions . event . context ) : undefined } ; if ( ! this . definitions . event . revision || ! dotty . exists ( evt , this . definitions . event . revision ) || ! evtPayload . reason . aggregateId || ( typeof evtPayload . reason . aggregateId !== 'string' && typeof evtPayload . reason . aggregateId !== 'number' ) ) { this . onEventMissingHandle ( info , evt ) ; if ( callback ) { callback ( null , evt , [ ] ) ; } return res ; } this . revisionGuardStore . get ( evtPayload . reason . aggregateId , function ( err , rev ) { if ( err ) { debug ( err ) ; if ( callback ) { callback ( [ err ] ) } return ; } debug ( 'revision in store is "' + rev + '" but domain says: "' + evtPayload . reason . aggregateRevision + '"' ) if ( rev - 1 < evtPayload . reason . aggregateRevision ) { info . guardRevision = rev ; self . onEventMissingHandle ( info , evt ) ; } else if ( rev - 1 > evtPayload . reason . aggregateRevision ) { debug ( 'strange: revision in store greater than revision in domain, replay?' ) } if ( callback ) { callback ( null , evt , [ ] ) ; } } ) ; return res ; } return res ; }
Returns true if the passed event is a command rejected event. Callbacks on its own!
@param {Object}   evt      The event object
@param {Function} callback The function that will be called when this action has finished [optional]
`function(errs, evt, notifications){}` notifications is of type Array
@returns {boolean}
Returns true if the passed event is a command rejected event . Callbacks on its own!