@noddde/prisma
v0.3.9
Published
Prisma persistence adapter for noddde
Downloads
593
Maintainers
Readme
@noddde/prisma
Prisma persistence adapter for noddde. Works with any Prisma-supported database.
Install
yarn add @noddde/prisma @prisma/client
# or
npm install @noddde/prisma @prisma/clientWhat's Inside
PrismaAdapter— Full persistence adapter forwireDomain: event-sourced aggregates, state-stored aggregates, sagas, snapshots, and outboxPrismaAdvisoryLocker— Distributed pessimistic locking (PostgreSQL/MySQL)- Individual persistence classes if you need fine-grained control:
PrismaEventSourcedAggregatePersistence,PrismaStateStoredAggregatePersistence,PrismaSagaPersistence,PrismaSnapshotStore,PrismaOutboxStore PrismaUnitOfWork— ACID transaction context
Usage
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:
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 | Types, interfaces, and definition functions |
| @noddde/engine | Runtime engine with domain orchestration |
| @noddde/drizzle | Drizzle ORM persistence adapter |
| @noddde/typeorm | TypeORM persistence adapter |
License
MIT
