capstone-database
raw JSON → 1.0.125 verified Sat Apr 25 auth: no javascript
capstone-database is a database repository package for the TKR Computers e-commerce application. Current stable version is 1.0.125. It is released on npm and requires @prisma/client >=5 as a peer dependency. This package provides database access and business logic for a computer products online store. Key differentiators include integration with Prisma ORM and a focus on e-commerce features like product catalogs, cart management, and secure checkout. It is designed for use with Node.js and TypeScript.
Common errors
error Error: Cannot find module 'capstone-database' ↓
cause Package not installed or missing from node_modules.
fix
Run
npm install capstone-database in your project directory. error TypeError: capstoneDatabase is not a function ↓
cause Default export is an object, not a function. Tried to invoke directly.
fix
Access methods on the imported object, e.g.,
capstoneDatabase.getProducts(). Warnings
breaking Requires @prisma/client version >=5. Versions below 5 are not supported and will cause runtime errors. ↓
fix Update @prisma/client to version 5 or higher.
deprecated The `getCart` method has been deprecated in favor of `fetchCart`. `getCart` will be removed in v2. ↓
fix Replace calls to `getCart` with `fetchCart`.
gotcha The package exposes a default export that is an object, not a class. Attempting to use `new` will throw an error. ↓
fix Use the default import directly without the `new` keyword.
Install
npm install capstone-database yarn add capstone-database pnpm add capstone-database Imports
- default wrong
const capstoneDatabase = require('capstone-database')correctimport capstoneDatabase from 'capstone-database' - PrismaClient wrong
import { PrismaClient } from 'capstone-database'correctimport { PrismaClient } from '@prisma/client' - type definitions
import type { Product, CartItem } from 'capstone-database'
Quickstart
import capstoneDatabase from 'capstone-database';
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function main() {
const products = await capstoneDatabase.getProducts(prisma);
console.log(products);
}
main().catch(console.error);