open-index/open-npm huggingface dataset:
npm package: @schemeless/dynamodb-orm
Description: Utility helpers for building DynamoDB repositories with the AWS Data Mapper. The package keeps table metadata on your entity classes, exposes a cached manager that bootstraps tables on first use, and ships a reusable `DateType` marshaller for ISO string p
Author: akinoniku
Latest version: 3.2.2

# @schemeless/dynamodb-orm

Utility helpers for building DynamoDB repositories with the AWS Data Mapper. The package keeps table metadata on your entity classes, exposes a cached manager that bootstraps tables on first use, and ships a reusable `DateType` marshaller for ISO string persistence.

## Installation

```bash
yarn add @schemeless/dynamodb-orm @aws/dynamodb-data-mapper aws-sdk
```

`aws-sdk` is a peer dependency so you can control credentials and region resolution.

## Define an entity

Use your regular Data Mapper annotations and add the provided `repo` decorator so the helper knows which table and create options to use when initialising the repository.

```ts
import { attribute, hashKey, table } from '@aws/dynamodb-data-mapper-annotations';
import { repo, DateType } from '@schemeless/dynamodb-orm';

@table('user-events')
@repo('user-events', {
  readCapacityUnits: 5,
  writeCapacityUnits: 5,
})
class UserEvent {
  @hashKey()
  id!: string;

  @attribute(DateType)
  created!: Date;

  @attribute()
  payload!: Record<string, unknown>;
}
```

The decorator stores the table name and creation settings on the entity prototype, and the exported `DateType` converts between JavaScript `Date` objects and ISO8601 strings when writing to DynamoDB.

## Create and reuse a manager

`makeGetDynamoDbManager` wires the AWS client configuration, table prefix, and entity metadata together. The returned function lazily creates a `DynamodbManager` per entity, ensures the table exists, and caches the instance for later calls so subsequent requests reuse the same mapper and repo.

```ts
import { DynamoDB } from 'aws-sdk';
import { makeGetDynamoDbManager } from '@schemeless/dynamodb-orm';

const getManager = makeGetDynamoDbManager('dev-', { region: 'us-east-1' });

async function saveEvent(event: UserEvent) {
  const manager = await getManager(UserEvent);
  await manager.repo.put(event);
}
```

Each `DynamodbManager` exposes a Data Mapper client and the strongly-typed repository wrapper with convenience methods such as `put`, `get`, `query`, and `ensureTableExists` so you can focus on domain logic instead of boilerplate persistence code.
npm package: @schemeless/event-store-adapter-dynamodb
Description: A production-ready DynamoDB-backed implementation of the `IEventStoreRepo` contract. It pairs AWS SDK v3 with optional S3 offloading and an efficient time-bucketed iteration strategy.
Author: akinoniku
Latest version: 5.0.0

# @schemeless/event-store-adapter-dynamodb

A production-ready DynamoDB-backed implementation of the `IEventStoreRepo` contract. It pairs AWS SDK v3 with optional S3 offloading and an efficient time-bucketed iteration strategy.

## Installation

```bash
yarn add @schemeless/event-store-adapter-dynamodb @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb @aws-sdk/client-s3 @aws-sdk/lib-storage
```

## Usage

```ts
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
import { S3Client } from '@aws-sdk/client-s3';
import { EventStoreRepo as EventStoreDynamoRepo } from '@schemeless/event-store-adapter-dynamodb';
import { makeEventStore } from '@schemeless/event-store';

const dynamodbClient = new DynamoDBClient({ region: 'us-east-1' });
const s3Client = new S3Client({ region: 'us-east-1' });

const repo = new EventStoreDynamoRepo(dynamodbClient, s3Client, {
  tableNamePrefix: 'prod-',
  s3BucketName: 'my-event-archive',
  eventStoreTableReadCapacityUnits: 20,
  eventStoreTableWriteCapacityUnits: 10,
});

const buildStore = makeEventStore(repo);
const eventStore = await buildStore(eventFlows);
```

### Breaking Changes in v2.0.0+ (Released in 2.8.1)
> [!WARNING]
> **Schema Change**: This version introduces a new indexing strategy. Existing DynamoDB tables are not compatible.
> - **Primary Key**: `EventID` (id) remains unchanged.
> - **New GSIs**: Added `timeBucketIndex` and `causationIndex`.
> - **Conditional Writes**: Now uses `attribute_not_exists(id)` to ensure event id uniqueness and prevent accidental overwrites.

When `init` runs, the repository ensures the DynamoDB table and the new Global Secondary Indexes exist. Persisted events larger than ~350KB are automatically serialised to S3 and replaced with a bucket/key reference.

## Event streaming

`getAllEvents` returns an async iterator that uses **Time Bucketing** (partitioned by month). Instead of scanning the entire table, it queries specific time buckets, making it safe to replay millions of events without excessive memory consumption or timing out.

The iterator includes:
- **Automatic retry with exponential backoff** for transient DynamoDB errors
- **UnprocessedKeys handling** to ensure no data is lost during BatchGet throttling
- **Parallel S3 fetching** for events with large payloads stored in S3

## Capability declaration

This adapter currently declares:

```ts
repo.capabilities.aggregate === false
```

So `eventStore.getAggregate(...)` is not supported with this adapter version.
Use projection/CQRS reads for validation, or implement a stream-query index + `getStreamEvents` in a custom adapter.

## Resetting state

Call `resetStore` to drop and recreate the DynamoDB table. This is handy for integration tests where you need a clean slate.
npm package: @schemeless/event-store-adapter-expo-sqlite
Description: Expo SQLite adapter for the V6 event-store contracts.
Latest version: 6.0.0-rc.2

# @schemeless/event-store-adapter-expo-sqlite

Expo SQLite adapter for the V6 event-store contracts.

## Provides

- `append(events)`
- `getAllEvents(pageSize?, startFromId?)`
- `getStreamEvents(domain, identifier, fromSequence?)`
- `appendToStream(events, expectedVersion)`
- `getSnapshot(domain, identifier)`
- `saveSnapshot(snapshot)`
- `reset()` for tests and import replacement flows

## Install

```bash
yarn add @schemeless/event-store-adapter-expo-sqlite expo-sqlite
```

## Usage

```ts
import { openDatabaseAsync } from 'expo-sqlite';
import { ExpoSqliteEventStoreAdapter } from '@schemeless/event-store-adapter-expo-sqlite';

const db = await openDatabaseAsync('events.db');
const adapter = new ExpoSqliteEventStoreAdapter(db);

await adapter.init();
```
npm package: @schemeless/event-store-adapter-null
Description: A no-op `IEventStoreRepo` implementation. Use it when you want to exercise event flows without touching a database—for example in unit tests or command handlers that you are validating in isolation.
Author: akinoniku
Latest version: 5.0.0

# @schemeless/event-store-adapter-null

A no-op `IEventStoreRepo` implementation. Use it when you want to exercise event flows without touching a database—for example in unit tests or command handlers that you are validating in isolation.

## Installation

```bash
yarn add @schemeless/event-store-adapter-null
```

## Usage

```ts
import { EventStoreRepo as NullRepo } from '@schemeless/event-store-adapter-null';
import { makeEventStore } from '@schemeless/event-store';

const repo = new NullRepo();
const eventStore = await makeEventStore(repo)(eventFlows);

await eventStore.receive(flow)({ payload: { /* ... */ } });
```

The repository exposes the same API surface as the production adapters, but `storeEvents` is a no-op and `resetStore` simply logs that no action is required. Because nothing is persisted you should only use this adapter in tests or ephemeral environments.
npm package: @schemeless/event-store-adapter-pg
Description: PostgreSQL adapter for the V6 event-store contracts.
Author: akinoniku
Latest version: 6.0.0-rc.2

# @schemeless/event-store-adapter-pg

PostgreSQL adapter for the V6 event-store contracts.

## Provides

- `append(events)`
- `getAllEvents(pageSize?, startFromId?)`
- `getStreamEvents(domain, identifier, fromSequence?)`
- `appendToStream(events, expectedVersion)`
- `getSnapshot(domain, identifier)`
- `saveSnapshot(snapshot)`
- `reset()` for tests and import replacement flows

## Install

```bash
yarn add @schemeless/event-store-adapter-pg pg
```

## Usage

```ts
import { PgEventStoreAdapter } from '@schemeless/event-store-adapter-pg';

const adapter = new PgEventStoreAdapter({
  host: 'localhost',
  port: 5432,
  user: 'postgres',
  password: 'postgres',
  database: 'event_store',
});

await adapter.init();
```
npm package: @schemeless/event-store-adapter-prisma
Description: Official Prisma adapter for the Schemeless Event Store. This package lets you use a Prisma Client instance as the persistence layer behind `@schemeless/event-store`, embracing Prisma's schema-first workflow while reusing the existing event sourcing APIs.
Author: akinoniku
Latest version: 5.0.0

# `@schemeless/event-store-adapter-prisma`

Official Prisma adapter for the Schemeless Event Store. This package lets you use a Prisma Client instance as the persistence layer behind `@schemeless/event-store`, embracing Prisma's schema-first workflow while reusing the existing event sourcing APIs.

## Installation

```bash
yarn add @schemeless/event-store-adapter-prisma @prisma/client
yarn add -D prisma
```

## Setup

1. Add the `EventStoreEntity` model to your `prisma/schema.prisma` file. A ready-to-copy example lives at [`schema.prisma.example`](./schema.prisma.example) and is also exported from [`src/schema.prisma.example`](./src/schema.prisma.example) for programmatic access.
2. Run Prisma migrations to apply the schema to your database:
   - During development: `npx prisma migrate dev`
   - In production: `npx prisma migrate deploy`
3. Generate the Prisma Client that this adapter expects:

```bash
npx prisma generate
```

After these steps the generated client will include the `eventStoreEntity` model used by the adapter.

## Usage

```ts
import { PrismaClient } from '@prisma/client';
import { makeEventStore } from '@schemeless/event-store';
import { EventStoreRepo } from '@schemeless/event-store-adapter-prisma';

const prisma = new PrismaClient();
const repo = new EventStoreRepo(prisma);

await repo.init(); // ensures the Prisma client is connected

const eventStore = await makeEventStore({
  repo,
});

// Store new events through the Event Store APIs as usual
```

The adapter never runs migrations or schema updates for you. Make sure your deployment pipeline runs the appropriate `prisma migrate` or `prisma db push` commands before the application starts.

## API

`EventStoreRepo` implements the shared `IEventStoreRepo` interface and exposes the following methods:

- `constructor(prismaClient)` – Accepts an existing `PrismaClient` instance so you can share connection pooling with the rest of your application.
- `init()` – Calls `prisma.$connect()` to ensure the adapter has an active database connection before persisting events.
- `storeEvents(events)` – Persists the provided events inside a Prisma interactive transaction, maintaining write ordering.
- `getAllEvents(pageSize, startFromId?)` – Returns an async iterator that replays events ordered by creation time and identifier.
- `resetStore()` – Clears all persisted events via `deleteMany`, useful for tests.
npm package: @schemeless/event-store-adapter-typeorm
Description: A SQL persistence adapter built on top of TypeORM. It stores events in a simple table, keeps JSON payloads/meta serialised as text, and exposes the `IEventStoreRepo` contract so you can plug it straight into the core runtime.
Author: akinoniku
Latest version: 5.0.0

# @schemeless/event-store-adapter-typeorm

A SQL persistence adapter built on top of TypeORM. It stores events in a simple table, keeps JSON payloads/meta serialised as text, and exposes the `IEventStoreRepo` contract so you can plug it straight into the core runtime.

## Installation

```bash
yarn add @schemeless/event-store-adapter-typeorm typeorm
```

Install the database driver you intend to use (for example `sqlite3`, `mysql2`, or `pg`) because TypeORM relies on peer dependencies for transport.

## Usage

```ts
import { EventStoreRepo as TypeOrmRepo } from '@schemeless/event-store-adapter-typeorm';
import { makeEventStore } from '@schemeless/event-store';

const repo = new TypeOrmRepo({
  type: 'postgres',
  host: 'localhost',
  port: 5432,
  username: 'postgres',
  password: 'postgres',
  database: 'event_store',
});

const eventStore = await makeEventStore(repo)(eventFlows, successObservers);
```

On initialisation the repository creates (or reuses) a TypeORM connection, choosing a slightly different entity shape when targeting SQLite so timestamp precision is preserved. Incoming events are converted into entity instances, payload/meta fields are stringified, and every record is persisted inside a transaction to guarantee consistency.

## Streaming events

`getAllEvents` returns an async iterator that pages through events ordered by `created` and `id`. An optional `startFromId` lets you resume from a checkpoint, and every page is parsed back into plain JavaScript objects before being yielded to the replay subsystem.

## Resetting the store

`resetStore` drops and recreates the schema using TypeORM’s `synchronize(true)` call. For MySQL it also ensures the database exists and uses UTF-8 collation, which keeps integration tests and local development ergonomic.
npm package: @schemeless/event-store-adapter-typeorm-v3
Description: A SQL persistence adapter built on top of TypeORM. It stores events in a simple table, keeps JSON payloads/meta serialised as text, and exposes the `IEventStoreRepo` contract so you can plug it straight into the core runtime.
Author: akinoniku
Latest version: 5.0.0

# @schemeless/event-store-adapter-typeorm

A SQL persistence adapter built on top of TypeORM. It stores events in a simple table, keeps JSON payloads/meta serialised as text, and exposes the `IEventStoreRepo` contract so you can plug it straight into the core runtime.

## Installation

```bash
yarn add @schemeless/event-store-adapter-typeorm typeorm
```

Install the database driver you intend to use (for example `sqlite3`, `mysql2`, or `pg`) because TypeORM relies on peer dependencies for transport.

## Usage

```ts
import { EventStoreRepo as TypeOrmRepo } from '@schemeless/event-store-adapter-typeorm';
import { makeEventStore } from '@schemeless/event-store';

const repo = new TypeOrmRepo({
  type: 'postgres',
  host: 'localhost',
  port: 5432,
  username: 'postgres',
  password: 'postgres',
  database: 'event_store',
});

const eventStore = await makeEventStore(repo)(eventFlows, successObservers);
```

On initialisation the repository creates (or reuses) a TypeORM connection, choosing a slightly different entity shape when targeting SQLite so timestamp precision is preserved. Incoming events are converted into entity instances, payload/meta fields are stringified, and every record is persisted inside a transaction to guarantee consistency.

## Streaming events

`getAllEvents` returns an async iterator that pages through events ordered by `created` and `id`. An optional `startFromId` lets you resume from a checkpoint, and every page is parsed back into plain JavaScript objects before being yielded to the replay subsystem.

## Resetting the store

`resetStore` drops and recreates the schema using TypeORM’s `synchronize(true)` call. For MySQL it also ensures the database exists and uses UTF-8 collation, which keeps integration tests and local development ergonomic.
npm package: @schemeless/event-store-cash-account-example
Description: Reference aggregate for the v6 redesign.
Latest version: 6.0.0-rc.2

# Cash Account Reference

Reference aggregate for the v6 redesign.

It demonstrates:

- command handling via `event-store-aggregate`
- read-model rebuild via `event-store-core`
- snapshot-assisted hydrate
- OCC failure on concurrent writes
npm package: @schemeless/event-store-core
Description: Pure event-log infrastructure for appending, scanning, streaming, exporting, importing, and rebuilding read models from persisted events.
Author: akinoniku
Latest version: 6.0.0-rc.2

# @schemeless/event-store-core

Pure event-log infrastructure for appending, scanning, streaming, exporting, importing, and rebuilding read models from persisted events.

This package does not expose aggregate runtime concepts. Observers receive persisted events only.

```ts
import { makeEventStoreCore } from '@schemeless/event-store-core';

const core = makeEventStoreCore(repo);

await core.append(events);
const streamEvents = await core.stream('orders', 'order-1');
await core.rebuildReadModels({ observers });
```
npm package: @schemeless/event-store-react-native
Description: > [!IMPORTANT] > **DEPRECATED**: This package is now deprecated. Please use the core [`@schemeless/event-store`](../event-store) package instead. > > As of version 3.1.0, the core `@schemeless/event-store` package no longer depends on Node.js-specific nat
Author: akinoniku
Latest version: 3.2.2
Deprecated: This package is no longer needed. Please use @schemeless/event-store instead, which is now fully compatible with React Native.

# @schemeless/event-store-react-native

> [!IMPORTANT] > **DEPRECATED**: This package is now deprecated. Please use the core [`@schemeless/event-store`](../event-store) package instead.
>
> As of version 3.1.0, the core `@schemeless/event-store` package no longer depends on Node.js-specific native modules and is fully compatible with React Native environments out of the box.

React Native compatible build of the [`@schemeless/event-store`](../event-store) runtime.

## Usage

Install the package from npm and initialise it the same way you would the Node.js runtime:

```ts
import { makeEventStore } from '@schemeless/event-store-react-native';
```

All public APIs match the original package, so existing event flows and adapters can be reused. The only difference is the queue dependency, which now targets React Native environments.

### React Native prerequisites

Some consumers rely on `crypto.getRandomValues` (for example the `uuid` package). React Native apps should polyfill it with [`react-native-get-random-values`](https://github.com/Luka967/react-native-get-random-values):

```sh
npm install react-native-get-random-values
npx pod-install
```

If you use the Expo managed workflow you will see "CocoaPods is not supported in this project"—that is expected and safe to ignore.

Then import the polyfill once at the root of your app (e.g. `index.js`):

```js
import 'react-native-get-random-values';
```

After this, libraries that depend on `crypto.getRandomValues` (such as `uuid`) continue to work as expected.

## Development

This package is generated from the Node.js implementation and will be kept in sync as part of the monorepo. Build scripts and test commands mirror the original package:

```bash
yarn workspace @schemeless/event-store-react-native compile
yarn workspace @schemeless/event-store-react-native test
```

For upgrading from `2.8.x`, see [`MIGRATION.md`](./MIGRATION.md).

### Alignment notes

- Runtime behavior is aligned with `@schemeless/event-store`, except for queue internals that must use `react-native-better-queue`.
- Queue IDs use ULID slices instead of `uuid` to avoid forcing `crypto.getRandomValues` polyfills for internal queue naming.
- Some stress/integration suites are intentionally maintained only in the Node package (`snapshot`, `shutdown`, `revert`, sharded concurrency/stress), because they depend on Node-centric adapter and load characteristics.

## License

MIT
npm package: @schemeless/event-store-types
Description: Shared TypeScript contracts for the V6 architecture.
Author: akinoniku
Latest version: 6.0.0-rc.2

# @schemeless/event-store-types

Shared TypeScript contracts for the V6 architecture.

Primary consumers:

- `@schemeless/event-store-core`
- `@schemeless/event-store-aggregate`
- adapter packages

This package is the canonical home for:

- persisted event types
- snapshot types
- adapter capability contracts
- concurrency and snapshot errors

## Installation

```bash
yarn add @schemeless/event-store-types
```

## Main contracts

```ts
import type {
  PersistedEvent,
  Snapshot,
  EventStoreAdapter,
  StreamEventStoreAdapter,
} from '@schemeless/event-store-types';
```

## Design note

New code should target the V6 split architecture. This package only carries shared contracts and storage-facing types.