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

@activescott/auth-store-prisma

v0.1.0

Published

Prisma IdentityStore for @activescott/auth

Readme

@activescott/auth-store-prisma

Prisma IdentityStore for @activescott/auth.

Every app that keeps identities in Prisma writes the same adapter: map rows to Identity, coerce the JSON column into a providerState object, write it back on create and update. This package is that adapter. UserStore stays in your app, since your user table is yours.

Zero runtime dependencies, and no dependency on @prisma/client: the model is typed structurally, so it works with whatever client version you generated.

Install

npm install @activescott/auth-store-prisma

Schema

The model needs these fields (column names can differ via @map) and the compound unique on provider and identifier:

model Identity {
  id         String    @id @default(uuid())
  userId     String    @map("user_id")
  provider   String
  identifier String
  metadata   Json?
  createdAt  DateTime  @default(now()) @map("created_at")
  verifiedAt DateTime? @map("verified_at")

  user User @relation(fields: [userId], references: [id], onDelete: Cascade)

  @@unique([provider, identifier])
  @@map("identities")
}

The JSON column that holds providerState can have any name; metadata here is the name schemas from before @activescott/auth v5 already use.

Usage

import { Auth } from "@activescott/auth"
import { createPrismaIdentityStore } from "@activescott/auth-store-prisma"
import { prisma } from "./database.server"

const auth = new Auth({
  // ...session, providers
  identityStore: createPrismaIdentityStore({
    model: prisma.identity,
    providerStateField: "metadata",
  }),
  userStore,
})

providerStateField is checked against the model's fields, so a typo fails to compile.

Account merge

By default reassignByUserId moves the identities with one updateMany. When a merge must also move your own per-user data all-or-nothing, pass your own and run the whole merge in one transaction there (see the account-merge docs in the @activescott/auth README):

createPrismaIdentityStore({
  model: prisma.identity,
  providerStateField: "metadata",
  reassignByUserId: (fromUserId, toUserId) =>
    prisma.$transaction(async (tx) => {
      await tx.identity.updateMany({
        where: { userId: fromUserId },
        data: { userId: toUserId },
      })
      // ...move app data, delete the absorbed user row
    }),
})

To refuse merges outright, pass one that throws.

Behavior

| Method | Notes | | ----------------------------- | ----------------------------------------------------------------- | | findByProviderAndIdentifier | findUnique on the provider_identifier compound key | | findByUserId | Newest first | | findByUserIds | One query for all users, newest first; no query for an empty list | | create / update | update leaves fields it was not given unchanged | | delete | Deleting an identity that is already gone is a no-op |

A null or non-object JSON value reads back as an empty providerState. The same coercion is exported as toProviderState for code that reads identity rows directly.

License

MIT