open-index/open-npm huggingface dataset:
npm package: @nodaomg/gulp-cssstats
Description: Gulp plugin for CSS Stats
Author: Brent Jackson
Latest version: 1.0.2

# Gulp CSS Statistics

Gulp plugin version of http://cssstats.com

## Usage

```js
var gulp = require('gulp');
var cssstats = require('gulp-cssstats');

gulp.task('cssstats', function() {
  gulp.src('./base.css')
    .pipe(cssstats())
    .pipe(gulp.dest('./'));
});
```
npm package: @nodaomg/postcss-cssstats
Description: A PostCSS plugin for cssstats.
Author: John Otander
Latest version: 1.1.1

# postcss-cssstats [![Build Status](https://secure.travis-ci.org/cssstats/postcss-cssstats.png?branch=master)](https://travis-ci.org/cssstats/postcss-cssstats)

A PostCSS plugin for [cssstats](https://github.com/cssstats/cssstats).

## Installation

```bash
npm install --save postcss-cssstats
```

## Usage

This plugin will return a cssstats object in the callback which can
be used for css analysis. For more information on the stats object see
the [cssstats documentation](https://github.com/cssstats/css-statistics#returned-object).

```javascript
var postcss = require('postcss');
var cssstats = require('postcss-cssstats');

var output = postcss([
  cssstats(function(stats) {
    console.log(stats);
  })
]).process(css);
```

### Usage with Gulp.js

```js
gulp.task('cssstats', function() {
    var cssstats = require('postcss-cssstats');
    var postcss = require('gulp-postcss');
    return gulp
        .src('app/_design/less/index.css')
        .pipe(
            postcss([
                cssstats(
                    function(stats) {
                        console.log(stats);
                    }
                )
            ])
        );
});
```

## License

MIT

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Crafted with <3 by John Otander ([@4lpine](https://twitter.com/4lpine)).

***

> This package was initially generated with [yeoman](http://yeoman.io) and the [p generator](https://github.com/johnotander/generator-p.git).
npm package: @nodaomg/style9
Description: CSS-in-JS compiler
Author: Cosimo
Latest version: 0.10.4

# style9

CSS-in-JS compiler inspired by Facebook's [stylex][stylex], with near-zero runtime, atomic CSS extraction and TypeScript support. Framework agnostic.

## Basic usage

*For a complete walkthrough of the API, see [Usage guide](docs/Usage-guide.md).*

```javascript
import style9 from 'style9';

const styles = style9.create({
  blue: {
    color: 'blue',
  },
  red: {
    color: 'red'
  }
});

document.body.className = styles('blue', isRed && 'red');
```

For the above input, the compiler will generate the following output:

```javascript
/* JavaScript */
document.body.className = isRed ? 'cyyg6ey ' : 'c1r9f2e5 ';

/* CSS */
.c1r9f2e5 { color: blue }
.cyyg6ey { color: red }
```

## Installation

```sh
# Yarn
yarn add style9

# npm
npm install style9
```

## Compiler setup - required

The following is the minimally required Webpack setup for extracting styles to a CSS file. For Webpack options and Rollup, Next.js, Gatsby, and Babel plugins, see [Bundler plugins](docs/Bundler-plugins.md).

```javascript
const Style9Plugin = require('style9/webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');

module.exports = {
  // Collect all styles in a single file - required
  optimization: {
    splitChunks: {
      cacheGroups: {
        styles: {
          name: 'styles',
          type: 'css/mini-extract',
          // For webpack@4 remove type and uncomment the line below
          // test: /\.css$/,
          chunks: 'all',
          enforce: true,
        }
      }
    }
  },
  module: {
    rules: [
      {
        test: /\.(tsx|ts|js|mjs|jsx)$/,
        use: Style9Plugin.loader,
      },
      {
        test: /\.css$/i,
        use: [MiniCssExtractPlugin.loader, 'css-loader']
      }
    ]
  },
  plugins: [
    new Style9Plugin(),
    new MiniCssExtractPlugin()
  ]
};
```

## Documentation

1. [Background](docs/Background.md)
1. [Usage guide](docs/Usage-guide.md)
1. [Bundler plugins](docs/Bundler-plugins.md)
1. [TypeScript](docs/TypeScript.md)
1. [Ecosystem](docs/Ecosystem.md)
1. [How it works](docs/How-it-works.md)
1. [FAQ](docs/FAQ.md)
1. [Example apps](examples)

## Have a question?

Look at the [FAQ](docs/FAQ.md), [search][search] the repo, or ask in [discussions][discussions].

[stylex]: https://www.youtube.com/watch?v=9JZHodNR184
[search]: https://github.com/johanholmerin/style9/search
[discussions]: https://github.com/johanholmerin/style9/discussions
npm package: @nodary/testnet-usdc
Description: Testnet USDC contract that can be minted with signed Nodary data
Latest version: 0.1.1

# Testnet USDC

> Testnet USDC contract that can be minted with signed Nodary data

_Adapted from [@alikonuk1](https://github.com/alikonuk1)'s [initial version](https://github.com/alikonuk1/sepolia-usdc)_
npm package: @nodary/utilities
Description: Utility functions for Nodary services
Latest version: 7.0.0

# @nodary/utilities

Utility helpers & metadata for interacting with the **Nodary** services.

## Install

```bash
npm i @nodary/utilities   # or `yarn add @nodary/utilities`
```

## Quick start

```js
const {
  nodaryChainIds,
  computeFeedId,
  computeSponsorWalletAddress,
} = require("@nodary/utilities");

console.log(nodaryChainIds()); // → [1, 56, 137, 42161, ...]
console.log(computeFeedId("BTC/USD")); // 0xd888b92f9d71afedd0a012622c0d1d5368fc0dc0ff1d30bb16266afcd49c2c17
console.log(computeSponsorWalletAddress("BTC/USD", 1000000, 0, 86400)); // 0x82D117e7AdEd3fC8A9266252899B21C843dDC4B2 for 1% deviation threshold, 0 deviation reference, 1 day heartbeat interval
```

## API surface

• Constants: `nodaryAirnodeAddress`, `nodaryXPub`, `nodaryFeeds`  
• `nodaryChainIds()` – list of EVM chain IDs served by Nodary.  
• `computeEndpointId(endpointName)`  
• `computeTemplateId(feedName)`  
• `computeFeedId(feedName)`  
• `computeSponsorWalletAddress(feedName, deviationThreshold, deviationReference, heartbeatInterval)`
npm package: @noddde/cli
Description: CLI tool for scaffolding noddde DDD aggregates, projections, and sagas
Author: Nidhal Dogga
Latest version: 0.3.4

# @noddde/cli

CLI tool for scaffolding noddde DDD aggregates, projections, and sagas.

**[Documentation](https://noddde.dev)** | **[GitHub](https://github.com/dogganidhal/noddde)**

## Install

```bash
# Run directly with npx
npx @noddde/cli new aggregate

# Or install globally
npm install -g @noddde/cli
```

## Usage

The CLI scaffolds new domain modules with the correct folder structure, types, and handler signatures.

```bash
# Scaffold a new aggregate
noddde new aggregate

# Scaffold a new projection
noddde new projection

# Scaffold a new saga
noddde new saga
```

The interactive prompts guide you through naming and configuration. Generated files follow noddde conventions: pure functions, typed events and commands, and the Decider pattern.

## Related Packages

| Package                                                          | Description                                 |
| :--------------------------------------------------------------- | :------------------------------------------ |
| [`@noddde/core`](https://www.npmjs.com/package/@noddde/core)     | Types, interfaces, and definition functions |
| [`@noddde/engine`](https://www.npmjs.com/package/@noddde/engine) | Runtime engine with domain orchestration    |

## License

MIT
npm package: @noddde/drizzle
Description: Drizzle ORM persistence adapter for noddde
Author: Nidhal Dogga
Latest version: 0.3.4

# @noddde/drizzle

Drizzle ORM persistence adapter for noddde. Supports PostgreSQL, MySQL, and SQLite.

**[Documentation](https://noddde.dev)** | **[GitHub](https://github.com/dogganidhal/noddde)**

## Install

```bash
yarn add @noddde/drizzle drizzle-orm
# or
npm install @noddde/drizzle drizzle-orm
```

## What's Inside

- **`DrizzleAdapter`** &mdash; Full persistence adapter for `wireDomain`: event-sourced aggregates, state-stored aggregates, sagas, snapshots, and outbox
- **`DrizzleAdvisoryLocker`** &mdash; Distributed pessimistic locking (PostgreSQL/MySQL)
- **`DrizzleSnapshotStore`** / **`DrizzleOutboxStore`** &mdash; Optional stores
- **Built-in schemas** via `@noddde/drizzle/pg`, `@noddde/drizzle/sqlite`, `@noddde/drizzle/mysql`

The dialect is auto-detected from your Drizzle `db` instance.

## Usage

```typescript
import { drizzle } from "drizzle-orm/node-postgres";
import { DrizzleAdapter } from "@noddde/drizzle";
import { wireDomain } from "@noddde/engine";
import * as schema from "./schema";

const db = drizzle(connectionString, { schema });

const adapter = new DrizzleAdapter(db);

const domain = await wireDomain(definition, {
  persistenceAdapter: adapter,
});
```

### With Convenience Schemas

```typescript
// PostgreSQL
import { nodddeSchema } from "@noddde/drizzle/pg";
// SQLite
import { nodddeSchema } from "@noddde/drizzle/sqlite";
// MySQL
import { nodddeSchema } from "@noddde/drizzle/mysql";
```

### Dedicated State Tables

For state-stored aggregates with custom table shapes:

```typescript
const adapter = new DrizzleAdapter(db);

adapter.stateStored(usersTable, {
  aggregateId: "id",
  state: "data",
  version: "version",
});
```

## Peer Dependencies

- `drizzle-orm` >= 0.30.0

## Related Packages

| Package                                                            | Description                                 |
| :----------------------------------------------------------------- | :------------------------------------------ |
| [`@noddde/core`](https://www.npmjs.com/package/@noddde/core)       | Types, interfaces, and definition functions |
| [`@noddde/engine`](https://www.npmjs.com/package/@noddde/engine)   | Runtime engine with domain orchestration    |
| [`@noddde/prisma`](https://www.npmjs.com/package/@noddde/prisma)   | Prisma persistence adapter                  |
| [`@noddde/typeorm`](https://www.npmjs.com/package/@noddde/typeorm) | TypeORM persistence adapter                 |

## License

MIT
npm package: @noddde/engine
Description: Runtime engine for noddde: domain orchestration and in-memory implementations for DDD, CQRS, and Event Sourcing
Author: Nidhal Dogga
Latest version: 0.3.4

# @noddde/engine

Runtime engine for noddde: domain orchestration and in-memory implementations for DDD, CQRS, and Event Sourcing.

**[Documentation](https://noddde.dev)** | **[GitHub](https://github.com/dogganidhal/noddde)**

## Install

```bash
yarn add @noddde/core @noddde/engine
# or
npm install @noddde/core @noddde/engine
```

## What's Inside

`@noddde/engine` provides:

- **Domain orchestration** (`defineDomain`, `wireDomain`) to compose aggregates, projections, and sagas into a running domain
- **In-memory implementations** for all infrastructure contracts: command bus, query bus, event bus, aggregate persistence, saga persistence, snapshot store, outbox store, unit of work, locking, and idempotency
- **Outbox relay** for reliable event publishing
- **Logger** with pluggable backends

The in-memory implementations are useful for development, testing, and prototyping. For production, swap them out with a persistence adapter (`@noddde/drizzle`, `@noddde/prisma`, or `@noddde/typeorm`).

## Usage

```typescript
import { defineDomain, wireDomain } from "@noddde/engine";
import { BankAccount } from "./aggregates/bank-account";
import { BalanceProjection } from "./projections/balance";

const definition = defineDomain({
  writeModel: {
    aggregates: { BankAccount },
  },
  readModel: {
    projections: { BalanceProjection },
  },
});

// Wire with in-memory backends (no adapter needed)
const domain = await wireDomain(definition);

// Dispatch commands
await domain.commandBus.dispatch({
  name: "Deposit",
  targetAggregateId: "acc-1",
  payload: { amount: 100 },
});
```

### With a Persistence Adapter

```typescript
import { DrizzleAdapter } from "@noddde/drizzle";

const adapter = new DrizzleAdapter(db);

const domain = await wireDomain(definition, {
  persistenceAdapter: adapter,
});
```

## Related Packages

| Package                                                            | Description                                                    |
| :----------------------------------------------------------------- | :------------------------------------------------------------- |
| [`@noddde/core`](https://www.npmjs.com/package/@noddde/core)       | Types, interfaces, and definition functions                    |
| [`@noddde/testing`](https://www.npmjs.com/package/@noddde/testing) | Test harnesses for aggregates, sagas, projections, and domains |
| [`@noddde/drizzle`](https://www.npmjs.com/package/@noddde/drizzle) | Drizzle ORM persistence adapter                                |
| [`@noddde/prisma`](https://www.npmjs.com/package/@noddde/prisma)   | Prisma persistence adapter                                     |
| [`@noddde/typeorm`](https://www.npmjs.com/package/@noddde/typeorm) | TypeORM persistence adapter                                    |

## License

MIT
npm package: @noddde/kafka
Description: Kafka EventBus adapter for noddde
Author: Nidhal Dogga
Latest version: 0.3.4

# @noddde/kafka

Kafka event bus adapter for noddde. Provides scalable event streaming with consumer groups, partition-based ordering, and at-least-once delivery guarantees.

**[Documentation](https://noddde.dev)** | **[GitHub](https://github.com/dogganidhal/noddde)**

## Install

```bash
yarn add @noddde/kafka kafkajs
# or
npm install @noddde/kafka kafkajs
```

## What's Inside

- **`KafkaEventBus`** &mdash; Topic-based event publishing with consumer group fan-out, manual offset commits, configurable partition key strategy, and delivery retry tracking
- Partition key defaults to `aggregateId` for ordered processing per aggregate
- Session timeout and heartbeat configuration

## Usage

```typescript
import { KafkaEventBus } from "@noddde/kafka";
import { wireDomain } from "@noddde/engine";

const eventBus = new KafkaEventBus({
  brokers: ["localhost:9092"],
  clientId: "my-service",
  groupId: "my-service-group",
});

await eventBus.connect();

const domain = await wireDomain(definition, {
  eventBus,
});

// Clean shutdown
await eventBus.close();
```

### Configuration

```typescript
const eventBus = new KafkaEventBus({
  brokers: ["localhost:9092"],
  clientId: "my-service",
  groupId: "my-service-group",
  topicPrefix: "myapp", // Optional topic namespace
  sessionTimeout: 30000,
  heartbeatInterval: 3000,
  resilience: {
    maxRetries: 5,
    retryDelay: 1000,
  },
});
```

## Peer Dependencies

- `kafkajs` >= 2.0.0

## Related Packages

| Package                                                              | Description                                 |
| :------------------------------------------------------------------- | :------------------------------------------ |
| [`@noddde/core`](https://www.npmjs.com/package/@noddde/core)         | Types, interfaces, and definition functions |
| [`@noddde/engine`](https://www.npmjs.com/package/@noddde/engine)     | Runtime engine with domain orchestration    |
| [`@noddde/rabbitmq`](https://www.npmjs.com/package/@noddde/rabbitmq) | RabbitMQ event bus adapter                  |
| [`@noddde/nats`](https://www.npmjs.com/package/@noddde/nats)         | NATS event bus adapter                      |

## License

MIT
npm package: @noddde/nats
Description: NATS EventBus adapter for noddde
Author: Nidhal Dogga
Latest version: 0.3.4

# @noddde/nats

NATS event bus adapter for noddde. Provides high-performance distributed event publishing and subscription using JetStream with at-least-once delivery guarantees.

**[Documentation](https://noddde.dev)** | **[GitHub](https://github.com/dogganidhal/noddde)**

## Install

```bash
yarn add @noddde/nats nats
# or
npm install @noddde/nats nats
```

## What's Inside

- **`NatsEventBus`** &mdash; JetStream-based event publishing with durable consumers, subject-based routing, manual acknowledgment, and consumer group support
- Built-in resilience via NATS native reconnection
- Configurable subject prefix for multi-tenant environments

## Usage

```typescript
import { NatsEventBus } from "@noddde/nats";
import { wireDomain } from "@noddde/engine";

const eventBus = new NatsEventBus({
  servers: "nats://localhost:4222",
  stream: "my-domain-events",
  consumerGroup: "my-service",
});

await eventBus.connect();

const domain = await wireDomain(definition, {
  eventBus,
});

// Clean shutdown
await eventBus.close();
```

### Configuration

```typescript
const eventBus = new NatsEventBus({
  servers: "nats://localhost:4222",
  stream: "my-domain-events",
  consumerGroup: "my-service", // Durable consumer group
  subjectPrefix: "myapp", // Optional subject namespace
  resilience: {
    maxRetries: 5,
    retryDelay: 1000,
  },
});
```

## Peer Dependencies

- `nats` >= 2.0.0

## Related Packages

| Package                                                              | Description                                 |
| :------------------------------------------------------------------- | :------------------------------------------ |
| [`@noddde/core`](https://www.npmjs.com/package/@noddde/core)         | Types, interfaces, and definition functions |
| [`@noddde/engine`](https://www.npmjs.com/package/@noddde/engine)     | Runtime engine with domain orchestration    |
| [`@noddde/rabbitmq`](https://www.npmjs.com/package/@noddde/rabbitmq) | RabbitMQ event bus adapter                  |
| [`@noddde/kafka`](https://www.npmjs.com/package/@noddde/kafka)       | Kafka event bus adapter                     |

## License

MIT
npm package: @noddde/prisma
Description: Prisma persistence adapter for noddde
Author: Nidhal Dogga
Latest version: 0.3.4

# @noddde/prisma

Prisma persistence adapter for noddde. Works with any Prisma-supported database.

**[Documentation](https://noddde.dev)** | **[GitHub](https://github.com/dogganidhal/noddde)**

## Install

```bash
yarn add @noddde/prisma @prisma/client
# or
npm install @noddde/prisma @prisma/client
```

## What's Inside

- **`PrismaAdapter`** &mdash; Full persistence adapter for `wireDomain`: event-sourced aggregates, state-stored aggregates, sagas, snapshots, and outbox
- **`PrismaAdvisoryLocker`** &mdash; Distributed pessimistic locking (PostgreSQL/MySQL)
- **Individual persistence classes** if you need fine-grained control: `PrismaEventSourcedAggregatePersistence`, `PrismaStateStoredAggregatePersistence`, `PrismaSagaPersistence`, `PrismaSnapshotStore`, `PrismaOutboxStore`
- **`PrismaUnitOfWork`** &mdash; ACID transaction context

## Usage

```typescript
import { PrismaClient } from "@prisma/client";
import { PrismaAdapter } from "@noddde/prisma";
import { wireDomain } from "@noddde/engine";

const prisma = new PrismaClient();

const adapter = new PrismaAdapter(prisma, { dialect: "pg" });

const domain = await wireDomain(definition, {
  persistenceAdapter: adapter,
});
```

### Dedicated State Models

For state-stored aggregates with custom Prisma models:

```typescript
const adapter = new PrismaAdapter(prisma);

adapter.stateStored("order", {
  aggregateId: "id",
  state: "data",
  version: "rev",
});
```

## Peer Dependencies

- `@prisma/client` >= 5.0.0

## Related Packages

| Package                                                            | Description                                 |
| :----------------------------------------------------------------- | :------------------------------------------ |
| [`@noddde/core`](https://www.npmjs.com/package/@noddde/core)       | Types, interfaces, and definition functions |
| [`@noddde/engine`](https://www.npmjs.com/package/@noddde/engine)   | Runtime engine with domain orchestration    |
| [`@noddde/drizzle`](https://www.npmjs.com/package/@noddde/drizzle) | Drizzle ORM persistence adapter             |
| [`@noddde/typeorm`](https://www.npmjs.com/package/@noddde/typeorm) | TypeORM persistence adapter                 |

## License

MIT
npm package: @noddde/rabbitmq
Description: RabbitMQ EventBus adapter for noddde
Author: Nidhal Dogga
Latest version: 0.3.4

# @noddde/rabbitmq

RabbitMQ event bus adapter for noddde. Provides distributed event publishing and subscription with at-least-once delivery guarantees.

**[Documentation](https://noddde.dev)** | **[GitHub](https://github.com/dogganidhal/noddde)**

## Install

```bash
yarn add @noddde/rabbitmq amqplib
# or
npm install @noddde/rabbitmq amqplib
```

## What's Inside

- **`RabbitMqEventBus`** &mdash; Exchange-based event publishing with topic routing, durable queues, manual acknowledgment, and exponential backoff reconnection
- Prefetch-based backpressure control
- Configurable retry policies per handler

## Usage

```typescript
import { RabbitMqEventBus } from "@noddde/rabbitmq";
import { wireDomain } from "@noddde/engine";

const eventBus = new RabbitMqEventBus({
  url: "amqp://localhost:5672",
  exchange: "my-domain-events",
});

await eventBus.connect();

const domain = await wireDomain(definition, {
  eventBus,
});

// Clean shutdown
await eventBus.close();
```

### Configuration

```typescript
const eventBus = new RabbitMqEventBus({
  url: "amqp://localhost:5672",
  exchange: "my-domain-events",
  queue: "my-service", // Consumer queue name
  prefetch: 10, // Backpressure control
  resilience: {
    maxRetries: 5,
    retryDelay: 1000, // Base delay in ms (exponential backoff)
  },
});
```

## Peer Dependencies

- `amqplib` >= 0.10.0

## Related Packages

| Package                                                          | Description                                 |
| :--------------------------------------------------------------- | :------------------------------------------ |
| [`@noddde/core`](https://www.npmjs.com/package/@noddde/core)     | Types, interfaces, and definition functions |
| [`@noddde/engine`](https://www.npmjs.com/package/@noddde/engine) | Runtime engine with domain orchestration    |
| [`@noddde/nats`](https://www.npmjs.com/package/@noddde/nats)     | NATS event bus adapter                      |
| [`@noddde/kafka`](https://www.npmjs.com/package/@noddde/kafka)   | Kafka event bus adapter                     |

## License

MIT
npm package: @noddde/testing
Description: Testing utilities and harnesses for noddde domains
Author: Nidhal Dogga
Latest version: 0.3.4

# @noddde/testing

Test harnesses and utilities for noddde domains: Given / When / Then style testing for aggregates, projections, sagas, and full domain integration tests.

**[Documentation](https://noddde.dev)** | **[GitHub](https://github.com/dogganidhal/noddde)**

## Install

```bash
yarn add --dev @noddde/testing
# or
npm install --save-dev @noddde/testing
```

## What's Inside

- **`testAggregate`** / **`evolveAggregate`** &mdash; Unit test aggregate decide and evolve handlers
- **`testProjection`** &mdash; Unit test projection reducers
- **`testSaga`** &mdash; Unit test saga handlers and returned commands
- **`testDomain`** &mdash; Integration test a full domain with command dispatch and event flow
- **Metadata utilities** &mdash; `stripMetadata`, `expectValidMetadata`, `expectSameCorrelation`, `expectCausationChain`

No database or broker setup required. All harnesses run entirely in-memory.

## Usage

### Aggregate Testing

```typescript
import { testAggregate } from "@noddde/testing";
import { BankAccount } from "../aggregates/bank-account";

const result = await testAggregate(BankAccount)
  .given(
    { name: "AccountCreated", payload: { id: "acc-1" } },
    { name: "DepositMade", payload: { amount: 1000 } },
  )
  .when({
    name: "Withdraw",
    targetAggregateId: "acc-1",
    payload: { amount: 200 },
  })
  .execute();

expect(result.events[0].name).toBe("WithdrawalMade");
expect(result.state.balance).toBe(800);
```

### Saga Testing

```typescript
import { testSaga } from "@noddde/testing";
import { OrderFulfillmentSaga } from "../sagas/order-fulfillment";

const result = await testSaga(OrderFulfillmentSaga)
  .given({ orderId: "order-1", status: "pending" })
  .when({
    name: "PaymentCompleted",
    payload: { orderId: "order-1", shipmentId: "ship-1" },
  })
  .execute();

expect(result.commands).toHaveLength(2);
expect(result.state.status).toBe("awaiting_shipment");
```

### Domain Integration Testing

```typescript
import { testDomain } from "@noddde/testing";

const { commandBus, queryBus, spy } = await testDomain(domainDefinition);

await commandBus.dispatch({
  name: "Deposit",
  targetAggregateId: "acc-1",
  payload: { amount: 100 },
});

expect(spy.publishedEvents).toContainEqual(
  expect.objectContaining({ name: "DepositMade" }),
);
```

## Related Packages

| Package                                                          | Description                                 |
| :--------------------------------------------------------------- | :------------------------------------------ |
| [`@noddde/core`](https://www.npmjs.com/package/@noddde/core)     | Types, interfaces, and definition functions |
| [`@noddde/engine`](https://www.npmjs.com/package/@noddde/engine) | Runtime engine with domain orchestration    |

## License

MIT
npm package: @noddde/typeorm
Description: TypeORM persistence adapter for noddde
Author: Nidhal Dogga
Latest version: 0.3.4

# @noddde/typeorm

TypeORM persistence adapter for noddde. Works with PostgreSQL, MySQL, MariaDB, MSSQL, and SQLite.

**[Documentation](https://noddde.dev)** | **[GitHub](https://github.com/dogganidhal/noddde)**

## Install

```bash
yarn add @noddde/typeorm typeorm
# or
npm install @noddde/typeorm typeorm
```

## What's Inside

- **`TypeORMAdapter`** &mdash; Full persistence adapter for `wireDomain`: event-sourced aggregates, state-stored aggregates, sagas, snapshots, and outbox
- **`TypeORMAdvisoryLocker`** &mdash; Distributed pessimistic locking (auto-detected from DataSource)
- **Built-in entities** &mdash; `NodddeEventEntity`, `NodddeAggregateStateEntity`, `NodddeSagaStateEntity`, `NodddeSnapshotEntity`, `NodddeOutboxEntryEntity`
- **Individual persistence classes** for fine-grained control
- **`TypeORMUnitOfWork`** &mdash; ACID transaction context

## Usage

```typescript
import { DataSource } from "typeorm";
import {
  TypeORMAdapter,
  NodddeEventEntity,
  NodddeAggregateStateEntity,
  NodddeSagaStateEntity,
} from "@noddde/typeorm";
import { wireDomain } from "@noddde/engine";

const dataSource = new DataSource({
  type: "postgres",
  url: process.env.DATABASE_URL,
  entities: [
    NodddeEventEntity,
    NodddeAggregateStateEntity,
    NodddeSagaStateEntity,
  ],
  synchronize: true,
});

await dataSource.initialize();

const adapter = new TypeORMAdapter(dataSource);

const domain = await wireDomain(definition, {
  persistenceAdapter: adapter,
});
```

### Dedicated State Entities

For state-stored aggregates with custom TypeORM entities:

```typescript
const adapter = new TypeORMAdapter(dataSource);

adapter.stateStored(OrderStateEntity, {
  aggregateId: "id",
  state: "data",
  version: "rev",
});
```

## Peer Dependencies

- `typeorm` >= 0.3.0

## Related Packages

| Package                                                            | Description                                 |
| :----------------------------------------------------------------- | :------------------------------------------ |
| [`@noddde/core`](https://www.npmjs.com/package/@noddde/core)       | Types, interfaces, and definition functions |
| [`@noddde/engine`](https://www.npmjs.com/package/@noddde/engine)   | Runtime engine with domain orchestration    |
| [`@noddde/drizzle`](https://www.npmjs.com/package/@noddde/drizzle) | Drizzle ORM persistence adapter             |
| [`@noddde/prisma`](https://www.npmjs.com/package/@noddde/prisma)   | Prisma persistence adapter                  |

## License

MIT