@aihu-plugin/drizzle
v0.1.1
Published
Drizzle ORM data adapter for aihu — typed createResource fetchers and defineLoader helpers (Postgres / SQLite / libSQL).
Readme
@aihu-plugin/drizzle
Aihu — agentic discovery and interaction, for human purpose.
Drizzle ORM data adapter for aihu — typed createResource fetchers and defineLoader helpers (Postgres / SQLite / libSQL).
Held-private workspace package. Not yet published to npm.
Status: Held private — not yet published to npm. See v1.1 roadmap for ratification gating (e.g. RFC #56 live-binding for
@aihu/pluginenforcement).
Server-only. Wraps a Drizzle query into the two data-access shapes aihu uses:
import { drizzle } from 'drizzle-orm/libsql'
import { eq } from 'drizzle-orm'
import { createResource } from '@aihu-plugin/data'
import { defineRoute } from '@aihu/server'
import { createDrizzleResource, drizzleLoader } from '@aihu-plugin/drizzle'
const db = drizzle(client)
// 1. A createResource-compatible fetcher: (key: string) => Promise<T>
const fetchUser = createDrizzleResource(
db,
(db, id: number) => db.select().from(users).where(eq(users.id, id)),
{ parseKey: Number },
)
const user = createResource(idSignal, fetchUser)
// 2. A defineLoader for SSR routes
const userLoader = drizzleLoader(db, (db, ctx) =>
db.select().from(users).where(eq(users.id, Number(ctx.params.id))),
)
export const userRoute = defineRoute('/users/:id', handler, { loader: userLoader })drizzle-orm and its drivers (postgres, @libsql/client) are optional peer dependencies referenced via import type only — importing this package never breaks when no Drizzle peer is installed. You supply the db handle; the adapter only awaits the query.
Install
npm install @aihu-plugin/drizzle
# or
bun add @aihu-plugin/drizzleAuto-generated against @aihu-plugin/[email protected].
Package facts
| | |
|---|---|
| Version | 0.1.1 |
| Tier | E — Held private (unmapped tier) |
| Published files | 3 entries |
| License | MIT |
Auto-generated against @aihu-plugin/[email protected].
Exports
| Subpath | ESM | CJS |
|---|---|---|
| . | ./dist/index.js | — |
Auto-generated against @aihu-plugin/[email protected].
Dependencies
Dependencies:
@aihu/server—workspace:*
Peer dependencies:
drizzle-orm—>=0.29.0
Auto-generated against @aihu-plugin/[email protected].
See also
Auto-generated against @aihu-plugin/[email protected].
License
MIT — see LICENSE.
Auto-generated against @aihu-plugin/[email protected].
