npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jointly/event-versionator

v1.0.3

Published

This is a library for versioning given events. It's used to ensure that we are able to monitor the number of iterations of a given event and to ensure that we can re-build the original order.

Downloads

2

Readme

What is it?

This is a library for versioning given events. It's used to ensure that we are able to monitor the number of iterations of a given event and to ensure that we can re-build the original order.

How do I install it?

You can install it by using the following command:

npm install @jointly/event-versionator

Tests

You can run the tests by using the following command:

npm test

How does it work?

Just call the getVersionedEvent function with the event you want to version and it will return a new event with the versioning information.
the function expects to receive an object with the following properties:

  • event - the event you want to version
  • payload - the payload of the event

The return value is an object with the following properties:

  • event - the given event
  • version - the version of the event
  • payload - the payload of the event
  • createdAt - the date when the specific event version was created
const { getVersionedEvent } = require('@jointly/event-versionator');
getVersionedEvent({ event: 'ev1', payload: 'ev1-1' }); // { event: 'ev1', version: 1, payload: 'ev1-1', createdAt: '1970-01-01T14:00:00.000Z' }
getVersionedEvent({ event: 'ev1', payload: 'ev1-2' }); // { event: 'ev1', version: 2, payload: 'ev1-2', createdAt: '1970-01-01T14:00:03.123Z' }
getVersionedEvent({ event: 'ev1', payload: 'ev1-3' }); // { event: 'ev1', version: 3, payload: 'ev1-3', createdAt: '1970-01-01T14:00:06.246Z' }
getVersionedEvent({ event: 'ev2', payload: 'ev2-1' }); // { event: 'ev2', version: 1, payload: 'ev2-1', createdAt: '1970-01-01T14:00:09.369Z' }
getVersionedEvent({ event: 'ev2', payload: 'ev2-2' }); // { event: 'ev2', version: 2, payload: 'ev2-2', createdAt: '1970-01-01T14:00:12.492Z' }

Other Info

You can also call the getNextEventVersion function to get the next version of a given event.
By passing a false as the second argument, you can get the next version of the event without committing (saving it) in the function internal state.
You can also call the getNextEventVersion passing the EVENT_VERSIONING_RESET_STRING exported constant as the first argument to reset the internal state of the function and consequently resetting all saved version values.