npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@verikit/prisma

v0.24.2

Published

Prisma ORM storage adapter for @verikit/server resources.

Readme

@verikit/prisma

Prisma ORM adapter for VeriKit server resources.

See the VeriKit documentation for setup and usage.

Consistent pagination

listTransaction is required: list()'s records and count queries always run through it, in the same transaction, so a concurrent write between them can never desync a page from meta.total. The adapter only ever sees a single model delegate, not the full Prisma client, so it has no way to open a transaction on its own pass one built from your PrismaClient:

createPrismaAdapter(resource, {
  model: prisma.post,
  fields: { title: "title" },
  id: { field: "id" },
  listTransaction: (operation) =>
    prisma.$transaction(
      (tx) => operation(tx.post),
      { isolationLevel: "RepeatableRead" },
    ),
});

## Conditional writes for protected resources

Update and delete on resources with permissions require an adapter implementing
`findForMutation`. The server authorizes its detached record snapshot and passes
its storage-authored `revision` to `update`/`delete` as `expectedRevision`. The
adapter must compare that revision **in the same database statement as the write**,
combine it with the ID and scope, and throw `ConflictError` (HTTP 409) when no row
matches. Missing/deleted rows and stale revisions produce the same conflict. There
is no automatic retry; retrying must repeat authorization and validation.

The in-memory adapter supports this automatically. Database adapters require a
migration adding a dedicated non-null integer revision column with default `0`,
excluded from the resource field map:

```ts
// Drizzle: revision: integer("revision").notNull().default(0)
const adapter = createDrizzleAdapter(db, resource, {
  versionColumn: table.revision,
});

// Prisma model: revision Int @default(0)
const adapter = createPrismaAdapter(resource, {
  // ...existing model, fields, id, and listTransaction options
  versionField: "revision",
});

Configured adapters increment revisions on every update, including empty updates and updates without an expected revision. Revisions never appear in API responses. All other writers must increment the same revision atomically, including jobs, custom actions, raw SQL, and other adapter instances. Do not reset revisions or reuse a deleted record's ID. Provision the column before enabling the option; this library does not run database migrations. Adapters without conditional-write support return HTTP 501 for protected update/delete; explicitly "open" resources retain unconditional writes.

Custom adapter wrappers must forward expectedRevision (fourth argument to update, third to delete). findForMutation must capture record and revision atomically and return a detached record. Revisions must be safe nonnegative integers with room to increment. This protects rules based on the target record; rules depending on other records or external services need application-level transactional coordination as well.