@arpinum/eventstore
TypeScript icon, indicating that this package has built-in type declarations

2.2.6 • Public • Published

@arpinum/eventstore Build Status

We won't really know what will happen until it happens.
Helen Thomas

@arpinum/eventstore contains a simple event store based on PostgreSQL.

The event store allows you to persist events in a database and query them with some criteria like type.

Installation

npm install @arpinum/eventstore --save

Example

const connectionString = "postgres://postgres@localhost:5432/eventstore";
const store = createEventStore({ connectionString });

await store.add({
  type: "UserSignedUp",
  date: new Date(),
  targetType: "User",
  targetId: "bf04b429-4c88-46de-a2ae-15624c75fd56",
  payload: {
    login: "johndoe",
  },
});

await store
  .find({ type: "UserSignedUp" })
  .on("data", (event) => console.log("Event found:", event));

More examples in examples.

Docs

License

MIT

Package Sidebar

Install

npm i @arpinum/eventstore

Weekly Downloads

6

Version

2.2.6

License

MIT

Unpacked Size

19.4 kB

Total Files

17

Last publish

Collaborators

  • michaelborde