@aneuhold/be-ts-db-lib
v4.2.2
Published
A backend database library meant to actually interact with various databases in personal projects
Maintainers
Readme
Personal Backend Database Library
This is used to actually interact with databases in personal projects.
📦 Installation
To add to a repo, follow the instructions below for your environment:
For Node using NPM
Run pnpm add @aneuhold/be-ts-db-lib
For Node using JSR
The below instructions still allow for things like Renovate to work, and normal commands with pnpm such as pnpm up.
- Add the required JSR configuration to a
.npmrcfile if not there already:@jsr:registry=https://npm.jsr.io - Add the package with
pnpm add @jsr/aneuhold__be-ts-db-lib
For Deno
Run deno add jsr:@aneuhold/be-ts-db-lib
🟢 Usage
Pull in one of the services and use it like so:
import { DocumentService } from '@aneuhold/be-ts-db-lib';
// If using Node with JSR
// import { DocumentService } from '@jsr/aneuhold__be-ts-db-lib';
export default function deepCopy() {
DocumentService.deepCopy({ someProperty: 'someString' });
}See full documentation on usage at JSR!
🛠️ Development
Possible next tasks:
- Make the validators have an updateMany validation that is more performant.
Creating a new Repository
- Copy an existing one over
- Create an associated validator
- Make sure the validator is registered in the DbSchemaUpdater so the DB can be validated when needed.
Schema Validation for DB
If any of the base document types are updated, make sure to run pnpm validate to ensure that the DB is up-to-date as well.
Manual Database Operations
Go ahead and run these as code in a test in the BaseRepository.spec.ts file.
