lib/denormalizer.js
function (callback) {

    var self = this;

    var warnings = null;

    async.series([
      // load domain files...
      function (callback) {
        debug('load denormalizer files..');
        self.structureLoader(self.options.denormalizerPath, function (err, tree, warns) {
          if (err) {
            return callback(err);
          }
          warnings = warns;
          self.tree = attachLookupFunctions(tree);
          callback(null);
        });
      },

      // prepare infrastructure...
      function (callback) {
        debug('prepare infrastructure...');
        async.parallel([

          // prepare repository...
          function (callback) {
            debug('prepare repository...');

            self.repository.on('connect', function () {
              self.emit('connect');
            });

            self.repository.on('disconnect', function () {
              self.emit('disconnect');
            });

            self.repository.connect(callback);
          },

          // prepare revisionGuard...
          function (callback) {
            debug('prepare revisionGuard...');

            self.revisionGuardStore.on('connect', function () {
              self.emit('connect');
            });

            self.revisionGuardStore.on('disconnect', function () {
              self.emit('disconnect');
            });

            self.revisionGuardStore.connect(callback);
          }
        ], callback);
      },

      // inject all needed dependencies...
      function (callback) {
        debug('inject all needed dependencies...');

        self.revisionGuard = new RevisionGuard(self.revisionGuardStore, self.options.revisionGuard);
        self.revisionGuard.onEventMissing(function (info, evt) {
          self.onEventMissingHandle(info, evt);
        });

        self.eventDispatcher = new EventDispatcher(self.tree, self.definitions.event);
        self.tree.defineOptions(self.options)
          .defineEvent(self.definitions.event)
          .defineNotification(self.definitions.notification)
          .idGenerator(self.getNewId)
          .useRepository(self.repository);

        self.revisionGuard.defineEvent(self.definitions.event);

        self.replayHandler = new ReplayHandler(self.eventDispatcher, self.revisionGuardStore, self.definitions.event, self.options);

        callback(null);
      }
    ], function (err) {
      if (err) {
        debug(err);
      }
      if (callback) { callback(err, warnings); }
    });
  }
function (callback) {

    var self = this;

    var warnings = null;

    async.series([
      // load domain files...
      function (callback) {
        debug('load denormalizer files..');
        self.structureLoader(self.options.denormalizerPath, function (err, tree, warns) {
          if (err) {
            return callback(err);
          }
          warnings = warns;
          self.tree = attachLookupFunctions(tree);
          callback(null);
        });
      },

      // prepare infrastructure...
      function (callback) {
        debug('prepare infrastructure...');
        async.parallel([

          // prepare repository...
          function (callback) {
            debug('prepare repository...');

            self.repository.on('connect', function () {
              self.emit('connect');
            });

            self.repository.on('disconnect', function () {
              self.emit('disconnect');
            });

            self.repository.connect(callback);
          },

          // prepare revisionGuard...
          function (callback) {
            debug('prepare revisionGuard...');

            self.revisionGuardStore.on('connect', function () {
              self.emit('connect');
            });

            self.revisionGuardStore.on('disconnect', function () {
              self.emit('disconnect');
            });

            self.revisionGuardStore.connect(callback);
          }
        ], callback);
      },

      // inject all needed dependencies...
      function (callback) {
        debug('inject all needed dependencies...');

        self.revisionGuard = new RevisionGuard(self.revisionGuardStore, self.options.revisionGuard);
        self.revisionGuard.onEventMissing(function (info, evt) {
          self.onEventMissingHandle(info, evt);
        });

        self.eventDispatcher = new EventDispatcher(self.tree, self.definitions.event);
        self.tree.defineOptions(self.options)
          .defineEvent(self.definitions.event)
          .defineNotification(self.definitions.notification)
          .idGenerator(self.getNewId)
          .useRepository(self.repository);

        self.revisionGuard.defineEvent(self.definitions.event);

        self.replayHandler = new ReplayHandler(self.eventDispatcher, self.revisionGuardStore, self.definitions.event, self.options);

        callback(null);
      }
    ], function (err) {
      if (err) {
        debug(err);
      }
      if (callback) { callback(err, warnings); }
    });
  }
function ( callback ) { var self = this ; var warnings = null ; async . series ( [ // load domain files... function ( callback ) { debug ( 'load denormalizer files..' ) ; self . structureLoader ( self . options . denormalizerPath , function ( err , tree , warns ) { if ( err ) { return callback ( err ) ; } warnings = warns ; self . tree = attachLookupFunctions ( tree ) ; callback ( null ) ; } ) ; } , // prepare infrastructure... function ( callback ) { debug ( 'prepare infrastructure...' ) ; async . parallel ( [ // prepare repository... function ( callback ) { debug ( 'prepare repository...' ) ; self . repository . on ( 'connect' , function ( ) { self . emit ( 'connect' ) ; } ) ; self . repository . on ( 'disconnect' , function ( ) { self . emit ( 'disconnect' ) ; } ) ; self . repository . connect ( callback ) ; } , // prepare revisionGuard... function ( callback ) { debug ( 'prepare revisionGuard...' ) ; self . revisionGuardStore . on ( 'connect' , function ( ) { self . emit ( 'connect' ) ; } ) ; self . revisionGuardStore . on ( 'disconnect' , function ( ) { self . emit ( 'disconnect' ) ; } ) ; self . revisionGuardStore . connect ( callback ) ; } ] , callback ) ; } , // inject all needed dependencies... function ( callback ) { debug ( 'inject all needed dependencies...' ) ; self . revisionGuard = new RevisionGuard ( self . revisionGuardStore , self . options . revisionGuard ) ; self . revisionGuard . onEventMissing ( function ( info , evt ) { self . onEventMissingHandle ( info , evt ) ; } ) ; self . eventDispatcher = new EventDispatcher ( self . tree , self . definitions . event ) ; self . tree . defineOptions ( self . options ) . defineEvent ( self . definitions . event ) . defineNotification ( self . definitions . notification ) . idGenerator ( self . getNewId ) . useRepository ( self . repository ) ; self . revisionGuard . defineEvent ( self . definitions . event ) ; self . replayHandler = new ReplayHandler ( self . eventDispatcher , self . revisionGuardStore , self . definitions . event , self . options ) ; callback ( null ) ; } ] , function ( err ) { if ( err ) { debug ( err ) ; } if ( callback ) { callback ( err , warnings ) ; } } ) ; }
Call this function to initialize the denormalizer.
@param {Function} callback the function that will be called when this action has finished [optional]
`function(err){}`
Call this function to initialize the denormalizer .