@trofos-nus/common
v1.0.25
Published
Common utilities and Prisma clients shared across TROFOS services. This includes * Main Prisma client for the backend database * Additional Prisma client for the vector DB (pgvector) * Shared TypeScript types, constants, and helper functions
Readme
Common utilities and Prisma clients shared across TROFOS services. This includes
- Main Prisma client for the backend database
- Additional Prisma client for the vector DB (pgvector)
- Shared TypeScript types, constants, and helper functions
Installation
Ensure .env with DATABASE_URL and AI_DATABASE_URL for all packages which installs this. This is needed for postinstall.
pnpm add @trofos-nus/common@latestUsage
import { PrismaClient } from '@prisma/client';
import { PrismaClient as VectorClient } from '@trofos-nus/common/src/generated/pgvector_client';Publishing a New Version
- Run
pnpm run prisma-generate. This ensures that all generated Prisma clients are up to date. - Run
pnpm run build. This compiles the relevant files todist/ - Run
cp dist/src/* dist/. - Bump the package version in
package.json. - Run
npm publish --dry-runto simulate a publish and verify that the relevant files are included in the bundle. - Run
npm loginusing the credentials in TROFOS playbook. - Run
npm publish --access public.
Install the latest version using
pnpm add @trofos-nus/common@latestUpdating Dependent Services
pnpm -r update @trofos-nus/common@latestNote that this prisma generate should run automatically upon postinstall, generating the newest models.
Adding Migrations
- Follow normal Prisma procedures, e.g. create
.envwith the database URLs specified above. - Run the migration.
pnpm exec dotenv -e .env -- pnpm exec prisma migrate dev --create-only- Publish the new version and update dependent services.
