@aneuhold/core-ts-db-lib
TypeScript icon, indicating that this package has built-in type declarations

2.0.4 • Public • Published

Personal Core Database Library

JSR NPM

This is used to export types used in various places for database interactions in personal projects.

📦 Installation

To add to a repo, follow the instructions below for your environment:

For Node using NPM

Run yarn add @aneuhold/core-ts-db-lib

For Node using JSR

The below instructions still allow for things like Renovate to work, and normal commands with yarn such as yarn up.

  1. Add the required JSR configuration to a .yarnrc.yml file if not there already:
    npmScopes:
      jsr:
        npmRegistryServer: 'https://npm.jsr.io'
  2. Add the package with yarn add @jsr/aneuhold__core-ts-db-lib

For Deno

Run deno add jsr:@aneuhold/core-ts-db-lib

🟢 Usage

Pull in one of the services and use it like so:

import { DocumentService } from '@aneuhold/core-ts-db-lib';
// If using Node with JSR
// import { DocumentService } from '@jsr/aneuhold__core-ts-db-lib';

export default function deepCopy() {
  DocumentService.deepCopy({ someProperty: 'someString' });
}

See full documentation on usage at JSR!

🛠️ Development

Document structure

Project-specific documents can be held in a single collection. So those should inherit from the BaseDocumentWithType class.

When different document types are held under a specific collection, they should get their own folder.

Guidelines

Note that documents cannot have really special types or classes with functions. For example Set cannot be used.

Updating an existing document

If a property is being moved or a new required property is added, then take the following steps

  1. Update the document
  2. Update the validator
  3. Push the changes to NPM
  4. Go to be-ts-db-lib and update the versions there with yarn upgrade:core
  5. Update the migration service in that repo and double check it looks okay
  6. Run the migration with yarn migrate:dry then yarn migrate
  7. Run validation to ensure everything is alright with yarn validate:dry then yarn validate if needed
  8. Run tests
  9. Update tests if needed then re-validate
  10. Push a new version of the be-ts-db-lib to NPM
  11. Pull the new versions into digital-ocean-functions and deploy
  12. Pull the new versions into core-ts-api-lib and push to NPM
  13. Pull the new versions into any relevant frontends and deploy
  14. Test out the frontends to make sure it works okay and double check MongoDB directly

Package Sidebar

Install

npm i @aneuhold/core-ts-db-lib

Weekly Downloads

102

Version

2.0.4

License

MIT

Unpacked Size

328 kB

Total Files

126

Last publish

Collaborators

  • aneuhold