# @nobrainerlabs/nest-utils

> Contains Nobrainer Labs commonly used code like postgres naming strategy, nest decorators, and pipes.

Latest version **0.2.0** (published 2021-10-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @nobrainerlabs/nest-utils
pnpm add @nobrainerlabs/nest-utils
yarn add @nobrainerlabs/nest-utils
bun add @nobrainerlabs/nest-utils
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2021-10-14 |
| First published | 2021-10-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 12 |
| Unpacked size | 42.9 KB |
| Known vulnerabilities | 0 (+14 in 6 direct dependencies) |
| Install scripts | no |
| Author | Nobrainer Labs |
| Maintainers | jaequery |

## Links

- npm: https://www.npmjs.com/package/@nobrainerlabs/nest-utils
- npm.io page: https://npm.io/package/@nobrainerlabs/nest-utils

## Dependencies (12)

- [rxjs](https://npm.io/package/rxjs.md) ^6.6.3
- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [convict](https://npm.io/package/convict.md) ^4.4.0
- [typeorm](https://npm.io/package/typeorm.md) ^0.2.16
- [typescript](https://npm.io/package/typescript.md) ^4.1.3
- [@nestjs/core](https://npm.io/package/@nestjs/core.md) ^7.5.1
- [@nestjs/common](https://npm.io/package/@nestjs/common.md) ^7.5.1
- [@nestjs/testing](https://npm.io/package/@nestjs/testing.md) ^7.5.1
- [@nestjs/typeorm](https://npm.io/package/@nestjs/typeorm.md) ^7.1.5
- [class-validator](https://npm.io/package/class-validator.md) ^0.8.5
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.1.12
- [class-transformer](https://npm.io/package/class-transformer.md) ^0.2.3

## Recent versions

- 0.2.0 (latest) — 2021-10-14

## README

# nest-utils

## Description

Contains Nobrainer Labs commonly used code like postgres naming strategy, nest decorators, and pipes.

## Requirements

Make sure to have the following installed

- `NodeJS / NPM` for application runtime
- `NestJS` for application framework

## Installation

To use the `nest-utils` node module:

```bash
$ npm login #make sure you request access to @nobrainerlabs
$ npm install --save @nobrainerlabs/nest-utils
```

## Postgres Naming Strategy

TypeORM by default retains camelCase naming convention for table and column names. Also, constraints, relations, primary keys, and foreign key names generated by TypeORM do not follow industry best practices. The `PostgresNamingStrategy` overrides TypeORM's default naming strategy.

To use, modify the NestJS module imports to include the `namingStrategy` property:

```javascript
TypeOrmModule.forRoot({
  ...
  namingStrategy: new PostgresNamingStrategy()
});
```

## Config Module based on ConvictJS

See [README here](src/config/README.md) for more details on setup and configuration.

## NestJS Decorators

> TODO:
>
> - Document `request-property.decorator`
> - Document `replace-relation-type.decorator`

## NestJS Pipes

> TODO:
>
> - Document `parse-entity.pipe`
> - Document `required.pipe`

## Contributing

To contribute to the `nest-utils` project please make sure to have the following configured in your development environment. Submit pull request to master after making sure all unit tests run successful.

- `tslint` for TypeScript linting (tslint in VSCode to automate linting)
- `jest` for unit testing

### Development environment setup

```bash
$ npm install
```

If you would like to develop/debug `nest-utils` in your source project you can npm link to symlink cross-dependency:

```bash
# Run npm link on this project
$ npm link

# Run npm link on your project
$ npm link @nobrainerlabs/nest-utils
```

### Test

All code changes should have supported unit tests.

```bash
# unit tests
$ npm run test

# test coverage
$ npm run test:cov
```

---
_Source: https://npm.io/package/@nobrainerlabs/nest-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
