Skip to content
This repository has been archived by the owner on Jul 8, 2021. It is now read-only.

Commit

Permalink
fix types; add warning about maintanance status
Browse files Browse the repository at this point in the history
  • Loading branch information
mentos1386 committed Mar 10, 2021
1 parent a38e782 commit e98d403
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
<a href="https://github.com/mentos1386/nest-morgan/actions/workflows/test.yaml"><img src="https://github.com/mentos1386/nest-morgan/actions/workflows/test.yaml/badge.svg?branch=master" alt="Github Actions - Test" /></a>
</p>

### Not activly maintained!

This module is not activly maintainer. Any PR's will be reviewd/merged/released. But i don't
plan to work on, or add any new functionality to this module.

## Description

This's a [Morgan](https://github.com/expressjs/morgan) module for [Nest](https://github.com/nestjs/nest).
Expand Down
8 changes: 4 additions & 4 deletions lib/morgan.interceptor.abstract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import {
CallHandler,
} from "@nestjs/common";
import { Observable } from "rxjs";
import * as morgan from "morgan";
import { Options, FormatFn, Morgan } from "morgan";
import { MORGAN_PROVIDER } from "./morgan.constants";

@Injectable()
export abstract class AbstractMorganInterceptor implements NestInterceptor {
protected abstract readonly options: morgan.Options<any, any>;
protected abstract readonly format: string | morgan.FormatFn;
protected abstract readonly options: Options<any, any>;
protected abstract readonly format: string | FormatFn;

constructor(
@Inject(MORGAN_PROVIDER) private morganInstance: morgan.Morgan<any, any>
@Inject(MORGAN_PROVIDER) private morganInstance: Morgan<any, any>
) {}

intercept(
Expand Down
6 changes: 3 additions & 3 deletions lib/morgan.interceptor.mixin.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { mixin } from "@nestjs/common";
import * as morgan from "morgan";
import { FormatFn, Options } from "morgan";
import { AbstractMorganInterceptor } from "./morgan.interceptor.abstract";

// tslint:disable-next-line:function-name
export function MorganInterceptor(
format: string | morgan.FormatFn,
options: morgan.Options<any, any> = {}
format: string | FormatFn,
options: Options<any, any> = {}
) {
return mixin(
class extends AbstractMorganInterceptor {
Expand Down
5 changes: 3 additions & 2 deletions lib/morgan.providers.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { MORGAN_PROVIDER } from "./morgan.constants";
import * as morgan from "morgan";
import { Morgan } from "morgan";
import morgan = require("morgan");

export const morganProviders = [
{
provide: MORGAN_PROVIDER,
useFactory: (): morgan.Morgan<any, any> => {
useFactory: (): Morgan<any, any> => {
return morgan;
},
},
Expand Down

0 comments on commit e98d403

Please sign in to comment.