How to use the resolve-command.default function in resolve-command

To help you get started, we’ve selected a few resolve-command examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github davidnussio / moleculer-cqrs / src / cqrs-event-sourcing.js View on Github external
this.aggregateName = this.name;
      }

      const publishEvent = ctx => event => {
        ctx.broker.broadcast(event.type, event);
      };

      this.eventStore = createEventStore({
        storage: this.storage,
        publishEvent: publishEvent(this),
      });

      if (this.settings.aggregate) {
        this.aggregate = this.settings.aggregate;
        delete this.settings.aggregate;
        this.commandHandler = commandHandler({
          eventStore: this.eventStore,
          aggregates: [this.aggregate],
          // snapshotAdapter
        });
        this.metadata.aggregate = true;
        this.metadata.commands = Object.keys(this.aggregate.commands).map(
          name => name
        );
        this.metadata.projection = Object.keys(this.aggregate.projection).map(
          name => name
        );
        this.metadata.events = Object.keys(this.aggregate.events).map(
          name => this.aggregate.events[name]
        );
      }
    },

resolve-command

Creates a function that handles commands in a reSolve application.

MIT
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis

Popular resolve-command functions