# @prats-tech/nestjs-static-injector

> Static injector for providers on nestjs

Latest version **1.0.2** (published 2021-07-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @prats-tech/nestjs-static-injector
pnpm add @prats-tech/nestjs-static-injector
yarn add @prats-tech/nestjs-static-injector
bun add @prats-tech/nestjs-static-injector
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2021-07-25 |
| First published | 2021-04-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 8 KB |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | gustavobertoirosa, vertexportus |
| Keywords | nestjs, static-injector, injector, nestjs-static-injector, prats |

## Links

- npm: https://www.npmjs.com/package/@prats-tech/nestjs-static-injector
- Repository: https://github.com/prats-tech/nestjs-static-injector
- npm.io page: https://npm.io/package/@prats-tech/nestjs-static-injector

## Dependencies (3)

- [rxjs](https://npm.io/package/rxjs.md) ^6.6.7
- [@nestjs/core](https://npm.io/package/@nestjs/core.md) ^7.6.15
- [@nestjs/common](https://npm.io/package/@nestjs/common.md) ^7.6.15

## Recent versions

- 1.0.2 (latest) — 2021-07-25
- 1.0.0 — 2021-07-25
- 0.0.5 — 2021-04-26
- 0.0.4 — 2021-04-26
- 0.0.3 — 2021-04-26
- 0.0.2 — 2021-04-26
- 0.0.1 — 2021-04-26

## README

<p align="center">
  <img src="./images/logo.png" alt="rx-channels" width="50%" />
</p>

<p align="center">
  <b>NestJS Static Injector - v1.0.0</b>
</p>

---

## Overview

This library solves a framework weakness of not having to statically access providers in the application, something that can be commonly used in decorators, as decorators are executed in the application compilation process and not during the code interpretation, that is, you cannot access providers by instance, this is one of the reasons for the existence of this library.

### Installation

```bash
# Using NPM
$ npm install @prats-tech/nestjs-static-injector

---

# Using Yarn
$ yarn add @prats-tech/nestjs-static-injector
```

### Examples/Reasons

```typescript
import { Module, MyService } from '@nestjs/common';

import { StaticModule } from '@prats-tech/nestjs-static-injector';

@Module({
  imports: [StaticModule],
  providers: [MyService],
  exports: [MyService],
})
class AppModule {}

@Injectable()
class MyService {
  execute() {
    // execute some logic
  }
}

function Decorator() {
  return function (target: any) {
    const service = StaticInjector.getInstance().get(MyService);
    service.execute();
  };
}

@Decorator()
class ClassThatWillUseTheDecorator {}
```

---

## License

MIT © [Prats](https://github.com/prats-tech)

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