How to use the sourced.Entity function in sourced

To help you get started, we’ve selected a few sourced 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 mateodelnorte / sourced-repo-mongo / test / index.js View on Github external
var Entity = require('sourced').Entity;
var log = require('debug')('sourced-repo-mongo');
var mongo = require('../mongo');
var sourcedRepoMongo = require('../index');
var Repository = sourcedRepoMongo.Repository;
var EventEmitter = require('events').EventEmitter;
var util = require('util');
var _ = require('lodash');

var should = require('should');

/* Market model/entity */
function Market () {
  this.orders = [];
  this.price = 0;
  Entity.apply(this, arguments);
}
github patrickleet / servicebus-microservice / __tests__ / unit / handlers / list.item.add.js View on Github external
jest.mock('models/TodoList', () => {
  let Entity = require('sourced').Entity
  class TodoList extends Entity {
    constructor () {
      super()
      this.items = []
      this.initialize = jest.fn()
      this.addItem = jest.fn()
    }
  }
  return { TodoList }
})
jest.mock('repos/todoListRepository', () => {

sourced

Tiny framework for building models with the event sourcing pattern (events and snapshots). Now with Typescript and browser support.

MIT
Latest version published 2 years ago

Package Health Score

46 / 100
Full package analysis