lib/eventstore.js
function (query, revMin, revMax, callback) {
    if (typeof revMin === 'function') {
      callback = revMin;
      revMin = 0;
      revMax = -1;
    } else if (typeof revMax === 'function') {
      callback = revMax;
      revMax = -1;
    }

    if (typeof query === 'string') {
      query = { aggregateId: query };
    }

    if (!query.aggregateId) {
      var err = new Error('An aggregateId should be passed!');
      debug(err);
      if (callback) callback(err);
      return;
    }

    var self = this;

    this.getEventsByRevision(query, revMin, revMax, function(err, evts) {
      if (err) {
        return callback(err);
      }
      callback(null, new EventStream(self, query, evts));
    });
  }
function (query, revMin, revMax, callback) {
    if (typeof revMin === 'function') {
      callback = revMin;
      revMin = 0;
      revMax = -1;
    } else if (typeof revMax === 'function') {
      callback = revMax;
      revMax = -1;
    }

    if (typeof query === 'string') {
      query = { aggregateId: query };
    }

    if (!query.aggregateId) {
      var err = new Error('An aggregateId should be passed!');
      debug(err);
      if (callback) callback(err);
      return;
    }

    var self = this;

    this.getEventsByRevision(query, revMin, revMax, function(err, evts) {
      if (err) {
        return callback(err);
      }
      callback(null, new EventStream(self, query, evts));
    });
  }
function ( query , revMin , revMax , callback ) { if ( typeof revMin === 'function' ) { callback = revMin ; revMin = 0 ; revMax = - 1 ; } else if ( typeof revMax === 'function' ) { callback = revMax ; revMax = - 1 ; } if ( typeof query === 'string' ) { query = { aggregateId : query } ; } if ( ! query . aggregateId ) { var err = new Error ( 'An aggregateId should be passed!' ) ; debug ( err ) ; if ( callback ) callback ( err ) ; return ; } var self = this ; this . getEventsByRevision ( query , revMin , revMax , function ( err , evts ) { if ( err ) { return callback ( err ) ; } callback ( null , new EventStream ( self , query , evts ) ) ; } ) ; }
loads the event stream
@param {Object || String} query    the query object
@param {Number}           revMin   revision start point [optional]
@param {Number}           revMax   revision end point (hint: -1 = to end) [optional]
@param {Function}         callback the function that will be called when this action has finished
`function(err, eventstream){}`
loads the event stream