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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@schemeless/event-store-types

v3.0.4

Published

Shared TypeScript definitions used by the event store runtime, adapters, and application code. Import these contracts when authoring event flows, observers, or custom persistence layers.

Readme

@schemeless/event-store-types

Shared TypeScript definitions used by the event store runtime, adapters, and application code. Import these contracts when authoring event flows, observers, or custom persistence layers.

Installation

yarn add @schemeless/event-store-types

Event primitives

The package defines the shape of event inputs, created events, and the lifecycle metadata that flows through the runtime.

import { BaseEventInput, CreatedEvent, EventFlow } from '@schemeless/event-store-types';

const draft: BaseEventInput<{ id: string }> = {
  payload: { id: '123' },
};

const eventFlow: EventFlow = {
  domain: 'user',
  type: 'registered',
  receive: (eventStore) => eventStore.receive(eventFlow),
};

CreatedEvent extends the base shape with generated identifiers and timestamps, while SideEffectsState, EventOutputState, and EventObserverState describe the possible outcomes emitted by the runtime.

Traceability IDs

The event store uses several ID fields to track causation and correlation across event chains:

  • correlationId – Groups all events originating from the same root command. The framework inherits this from parent events or creates it for root events. Developers can optionally pass this from external systems (e.g., HTTP request headers).
  • causationId – Links each event to its immediate parent. This field is managed exclusively by the framework via createConsequentEvents or sideEffect handlers.
  • identifier – Developer-provided field to record who or what triggered the event (e.g., user ID, service name).
  • trackingId – Developer-provided external reference for cross-system tracing.

Important: Do not manually set causationId in your event inputs. The framework automatically populates this field based on the event creation context to ensure chain integrity.

Repository contracts

Repo.types exposes the IEventStoreRepo and IEventStoreEntity interfaces. Adapters implement these to integrate with the core runtime.

import { IEventStoreRepo } from '@schemeless/event-store-types';

class CustomRepo implements IEventStoreRepo {
  async init() {}
  async getAllEvents(pageSize: number) {
    // return an async iterator of stored events
  }
  createEventEntity(event) {
    return event;
  }
  async storeEvents(events) {}
  async resetStore() {}
}

The iterator returned by getAllEvents yields arrays of IEventStoreEntity records. Each record includes identifiers, correlation/causation metadata, and the created timestamp so replays can process history in order.

Revert support

To enable revert operations, adapters should also implement two additional optional methods:

class CustomRepo implements IEventStoreRepo {
  // ... existing methods ...

  async getEventById(id: string) {
    // Return a single event by ID, or null if not found
  }

  async findByCausationId(causationId: string) {
    // Return all events where causationId equals the given value
    // Used to traverse the event tree during reverts
  }
}

Note: For DynamoDB adapters, consider adding a Global Secondary Index on causationId for better performance.

Revert types

The package exports types for the revert API:

import { CanRevertResult, PreviewRevertResult, RevertResult } from '@schemeless/event-store-types';
  • CanRevertResult – Indicates whether an event can be reverted, with reasons if not
  • PreviewRevertResult – Shows which events would be affected by a revert
  • RevertResult – Contains the outcome of a revert operation, including generated compensating events