linforge-adapter-prisma
v0.1.1
Published
Prisma adapter for Linforge — production-ready Store implementations backed by Prisma ORM
Maintainers
Readme
linforge-adapter-prisma
Prisma adapter for Linforge — production-ready Store implementations backed by Prisma ORM.
Install
npm install linforge-adapter-prisma
# peer dependencies
npm install linforge @prisma/clientSetup
1. Add Prisma models
Copy the models from prisma/schema.prisma into your project's Prisma schema, then run:
npx prisma db push # or prisma migrate dev2. Use with linforgeMiddleware
import { linforgeMiddleware } from 'linforge/server';
import { createPrismaStores } from 'linforge-adapter-prisma';
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
app.use(linforgeMiddleware({
stateSchema: MyState,
nodes: [planner, tools],
stores: createPrismaStores(prisma),
}));3. Selective stores (optional)
// Only use GraphStore + RunStore, skip step recording and prompt management
const stores = createPrismaStores(prisma, {
stepPersister: false,
promptStore: false,
});Exports
| Export | Description |
|--------|------------|
| createPrismaStores(prisma, options?) | Factory — creates all 4 stores in one call |
| PrismaGraphStore | GraphStore implementation |
| PrismaRunStore | RunStore implementation |
| PrismaStepPersister | StepPersister implementation |
| PrismaPromptStore | PromptStore implementation |
| PrismaClientLike | Minimal PrismaClient type interface |
Database Support
The adapter uses JSON.stringify / JSON.parse for JSON fields, compatible with:
- PostgreSQL (native JSON/JSONB)
- MySQL (native JSON)
- SQLite (stored as TEXT)
