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

@primocaredentgroup/prescriptions-component

v0.1.19

Published

Convex component + React widget for prescriptions workflow integration.

Readme

Prescriptions Component (Convex Component + React Widget)

Pacchetto npm embeddabile in PrimoCore con:

  • Convex component (src/component)
  • client wrapper tipizzato (src/client)
  • React widget embeddabile (src/react)
  • host di esempio locale (example, solo sviluppo)

Installazione

npm install @primocore/prescriptions-component

Entry disponibili dal pacchetto

  • @primocore/prescriptions-component -> client typed
  • @primocore/prescriptions-component/react -> widget React
  • @primocore/prescriptions-component/component -> Convex component
  • @primocore/prescriptions-component/component/convex.config -> config registrazione Convex component
  • @primocore/prescriptions-component/styles.css -> stile opzionale widget

Registrazione Convex Component

Nel progetto host Convex, registra il componente puntando a:

  • @primocore/prescriptions-component/component
  • @primocore/prescriptions-component/component/convex.config

Gli endpoint dev-only (seed/migrazioni) non sono esportati dal surface pubblico del pacchetto.

Autorizzazione Embedded

In modalita embedded, il componente richiede solo un'identita valida (token) e non usa piula tabella internausers` come gate RBAC business.

  • RBAC e policy di accesso applicative sono demandate all'host (PrimoCore).
  • Il componente continua a registrare audit events con actor derivato dall'identita` host.
  • Se il token eassente o invalido, ritornaUNAUTHORIZED`.

Uso React Widget con Auth0 (getAccessToken)

import { PrescriptionsWidget } from "@primocore/prescriptions-component/react";
import type { ExternalContext } from "@primocore/prescriptions-component";
import { useAuth0 } from "@auth0/auth0-react";

function EmbeddedPrescriptions() {
  const { getAccessTokenSilently } = useAuth0();

  const externalContext: ExternalContext = {
    clinicId: "CLINIC-001",
    patientId: "PAT-001",
    doctorId: "DOC-001",
    pdcItemId: "PDC-001",
  };

  return (
    <PrescriptionsWidget
      convexUrl={import.meta.env.VITE_CONVEX_URL}
      getAccessToken={() =>
        getAccessTokenSilently({
          authorizationParams: {
            audience: "https://api.primocore.local",
          },
        })
      }
      externalContext={externalContext}
      mode="create"
    />
  );
}

Se vuoi importare esplicitamente lo stile:

import "@primocore/prescriptions-component/styles.css";

Build e pubblicazione

# build package (output in dist/)
npm run build

# verifica contenuto pacchetto pubblicabile
npm pack

# pubblicazione npm public (scope @primocore)
npm publish --access public

prepublishOnly esegue automaticamente npm run build e blocca la publish in caso di errore.

Test manuali embedded (checklist)

  • Host autenticato (token valido) senza record nella tabella users: createDraft deve completare con successo.
  • Token mancante/invalido: le mutation business devono fallire con UNAUTHORIZED.
  • Invarianti dominio invariati:
    • idempotenza createFromCalendar su idempotencyKey (seconda chiamata non crea duplicato),
    • vincolo "una sola prescrizione attiva per pdcItemId" ancora attivo.