# @trxn/nestjs-core

> Core module for nestjs backend

Latest version **3.0.0** (published 2023-08-17) · UNLICENSED license · 0 weekly downloads

## Install

```sh
npm install @trxn/nestjs-core
pnpm add @trxn/nestjs-core
yarn add @trxn/nestjs-core
bun add @trxn/nestjs-core
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2023-08-17 |
| First published | 2022-11-30 |
| Weekly downloads | 0 |
| License | UNLICENSED |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 108.8 KB |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 52 |
| Maintainers | floross, edouarddemotes, dt-tractr |

## Links

- npm: https://www.npmjs.com/package/@trxn/nestjs-core
- Repository: https://github.com/tractr/traxion
- Homepage: https://github.com/tractr/traxion#readme
- Issues: https://github.com/tractr/traxion/issues
- npm.io page: https://npm.io/package/@trxn/nestjs-core

## Dependencies (8)

- [rxjs](https://npm.io/package/rxjs.md) 7.8.0
- [lodash](https://npm.io/package/lodash.md) 4.17.21
- [graphql](https://npm.io/package/graphql.md) 16.6.0
- [ts-morph](https://npm.io/package/ts-morph.md) 17.0.1
- [supertest](https://npm.io/package/supertest.md) 6.3.3
- [query-string](https://npm.io/package/query-string.md) 7.1.3
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) 0.1.13
- [jest-mock-extended](https://npm.io/package/jest-mock-extended.md) 3.0.4

## Recent versions

- 3.0.0 (latest) — 2023-08-17
- 2.1.22-next.5 (next) — 2023-05-24
- 1.65.11-beta.3 (beta) — 2023-01-18
- 2.2.7 — 2023-07-18
- 2.2.5 — 2023-06-15
- 2.2.4 — 2023-06-02
- 2.2.3 — 2023-06-02
- 2.2.2 — 2023-06-02
- 2.2.1 — 2023-06-02
- 2.2.0 — 2023-05-29
- 2.1.22-next.4 — 2023-05-23
- 2.1.22-next.3 — 2023-05-22
- 2.1.22-next.2 — 2023-05-22
- 2.1.22-next.1 — 2023-05-14
- 2.1.22-next.0 — 2023-05-11
- … 59 more at https://npm.io/package/@trxn/nestjs-core/versions

## README

# Nest JS - Core

This library regroups some utilities that is used accross nestjs packages

## Logger

You can find a `LoggerModule` that export a `LoggerService`. This module use
the `Logger` token from `@nestjs/common` to let you access directly from your DI
at the nestjs logging system. Under the hood the LoggerService extends the Logger
of nestjs and format correctly your messages.

```ts
import { LoggerModule } from '@trxn/nestjs-common';

import { MyService } from './my-service.service';

@Module({
  imports: [LoggerModule],
  providers: [MyService],
})
export class MyApp {}
```

```ts
import { Injectable, Logger } from '@nestjs/common';

@Injectable()
export class MyService {
  constructor(private readonly logger: Logger) {}

  helloWorld() {
    this.logger.log('Hello World');
  }
}
```

If you need to access to more functionality of the `LoggerService` like the
`setContext` or `setMetadata` you will need to tell to typescript what interface
is used under the hood by the `Logger` token.

```ts
import { Inject, Injectable, Logger } from '@nestjs/common';

@Injectable()
export class MyService {
  constructor(@Inject(Logger) private readonly logger: LoggerService) {
    this.setContext(MyService.name);
    this.setMetadata({ foo: 'bar' })
  }

  helloWorld() {
    this.logger.log('Hello World');

    // Updating the context
    this.logger.log('Hello World', 'One time override context');

    // Updating the context and add more metadata
    this.logger.log('Hello World', { bar: 'foo' }, 'One time override context');

    // Override the metadata
    this.logger.log('Hello World', { foo: 'foo' });
  }
}
```

This logger is intended to work with the winston logger to be able to output
correctly into the console in development and in an `ecs` format in production.

@see `@trxn/nestjs-winston` library for more information.

---

TODO: write some documentation on what are inside this package

This package contains the core utilities for our nestjs backend.

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