xcally-nest-library 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.js +22 -0
- package/.nvmrc +1 -0
- package/.prettierrc +5 -0
- package/.vscode/settings.json +6 -0
- package/README.md +73 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/src/config/env.validation.d.ts +21 -0
- package/dist/src/config/env.validation.js +80 -0
- package/dist/src/config/env.validation.js.map +1 -0
- package/dist/src/db/typeorm/generic.repository.d.ts +18 -0
- package/dist/src/db/typeorm/generic.repository.js +43 -0
- package/dist/src/db/typeorm/generic.repository.js.map +1 -0
- package/dist/src/decorators/utils.decorators.d.ts +2 -0
- package/dist/src/decorators/utils.decorators.js +15 -0
- package/dist/src/decorators/utils.decorators.js.map +1 -0
- package/dist/src/interceptors/log-request.interceptor.d.ts +8 -0
- package/dist/src/interceptors/log-request.interceptor.js +42 -0
- package/dist/src/interceptors/log-request.interceptor.js.map +1 -0
- package/dist/src/interceptors/serialize.interceptor.d.ts +12 -0
- package/dist/src/interceptors/serialize.interceptor.js +24 -0
- package/dist/src/interceptors/serialize.interceptor.js.map +1 -0
- package/dist/src/modules/logger/winston.decorator.d.ts +1 -0
- package/dist/src/modules/logger/winston.decorator.js +17 -0
- package/dist/src/modules/logger/winston.decorator.js.map +1 -0
- package/dist/src/modules/logger/winston.interface.d.ts +21 -0
- package/dist/src/modules/logger/winston.interface.js +3 -0
- package/dist/src/modules/logger/winston.interface.js.map +1 -0
- package/dist/src/modules/logger/winston.module.d.ts +4 -0
- package/dist/src/modules/logger/winston.module.js +95 -0
- package/dist/src/modules/logger/winston.module.js.map +1 -0
- package/dist/src/modules/logger/winston.service.d.ts +23 -0
- package/dist/src/modules/logger/winston.service.js +113 -0
- package/dist/src/modules/logger/winston.service.js.map +1 -0
- package/dist/src/modules/tracer/tracer.middleware.d.ts +24 -0
- package/dist/src/modules/tracer/tracer.middleware.js +41 -0
- package/dist/src/modules/tracer/tracer.middleware.js.map +1 -0
- package/dist/src/modules/tracer/tracer.module.d.ts +7 -0
- package/dist/src/modules/tracer/tracer.module.js +36 -0
- package/dist/src/modules/tracer/tracer.module.js.map +1 -0
- package/dist/src/types/auth.d.ts +8 -0
- package/dist/src/types/auth.js +9 -0
- package/dist/src/types/auth.js.map +1 -0
- package/dist/src/types/index.d.ts +1 -0
- package/dist/src/types/index.js +18 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/index.ts +9 -0
- package/nest-cli.json +8 -0
- package/package.json +89 -0
- package/src/config/env.validation.ts +59 -0
- package/src/db/typeorm/generic.repository.ts +43 -0
- package/src/decorators/utils.decorators.ts +28 -0
- package/src/interceptors/log-request.interceptor.ts +30 -0
- package/src/interceptors/serialize.interceptor.ts +27 -0
- package/src/modules/logger/winston.decorator.ts +14 -0
- package/src/modules/logger/winston.interface.ts +22 -0
- package/src/modules/logger/winston.module.ts +105 -0
- package/src/modules/logger/winston.service.ts +60 -0
- package/src/modules/tracer/tracer.middleware.ts +40 -0
- package/src/modules/tracer/tracer.module.ts +18 -0
- package/src/types/auth.ts +9 -0
- package/src/types/index.ts +1 -0
- package/test/jest-e2e.json +9 -0
- package/tsconfig.build.json +4 -0
- package/tsconfig.json +21 -0
package/.eslintrc.js
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
module.exports = {
|
2
|
+
parser: '@typescript-eslint/parser',
|
3
|
+
parserOptions: {
|
4
|
+
project: 'tsconfig.json',
|
5
|
+
tsconfigRootDir: __dirname,
|
6
|
+
sourceType: 'module',
|
7
|
+
},
|
8
|
+
plugins: ['@typescript-eslint/eslint-plugin'],
|
9
|
+
extends: ['plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
|
10
|
+
root: true,
|
11
|
+
env: {
|
12
|
+
node: true,
|
13
|
+
jest: true,
|
14
|
+
},
|
15
|
+
ignorePatterns: ['.eslintrc.js'],
|
16
|
+
rules: {
|
17
|
+
'@typescript-eslint/interface-name-prefix': 'off',
|
18
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
19
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
20
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
21
|
+
},
|
22
|
+
};
|
package/.nvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
v20
|
package/.prettierrc
ADDED
package/README.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
<p align="center">
|
2
|
+
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="200" alt="Nest Logo" /></a>
|
3
|
+
</p>
|
4
|
+
|
5
|
+
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
|
6
|
+
[circleci-url]: https://circleci.com/gh/nestjs/nest
|
7
|
+
|
8
|
+
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
|
9
|
+
<p align="center">
|
10
|
+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
11
|
+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
12
|
+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
|
13
|
+
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
|
14
|
+
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
|
15
|
+
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
16
|
+
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
17
|
+
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
18
|
+
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
|
19
|
+
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
|
20
|
+
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
|
21
|
+
</p>
|
22
|
+
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
|
23
|
+
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
|
24
|
+
|
25
|
+
## Description
|
26
|
+
|
27
|
+
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
|
28
|
+
|
29
|
+
## Installation
|
30
|
+
|
31
|
+
```bash
|
32
|
+
$ pnpm install
|
33
|
+
```
|
34
|
+
|
35
|
+
## Running the app
|
36
|
+
|
37
|
+
```bash
|
38
|
+
# development
|
39
|
+
$ pnpm run start
|
40
|
+
|
41
|
+
# watch mode
|
42
|
+
$ pnpm run start:dev
|
43
|
+
|
44
|
+
# production mode
|
45
|
+
$ pnpm run start:prod
|
46
|
+
```
|
47
|
+
|
48
|
+
## Test
|
49
|
+
|
50
|
+
```bash
|
51
|
+
# unit tests
|
52
|
+
$ pnpm run test
|
53
|
+
|
54
|
+
# e2e tests
|
55
|
+
$ pnpm run test:e2e
|
56
|
+
|
57
|
+
# test coverage
|
58
|
+
$ pnpm run test:cov
|
59
|
+
```
|
60
|
+
|
61
|
+
## Support
|
62
|
+
|
63
|
+
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
64
|
+
|
65
|
+
## Stay in touch
|
66
|
+
|
67
|
+
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
|
68
|
+
- Website - [https://nestjs.com](https://nestjs.com/)
|
69
|
+
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
70
|
+
|
71
|
+
## License
|
72
|
+
|
73
|
+
Nest is [MIT licensed](LICENSE).
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
export * from './src/types';
|
2
|
+
export * from './src/interceptors/log-request.interceptor';
|
3
|
+
export * from './src/interceptors/serialize.interceptor';
|
4
|
+
export * from './src/modules/logger/winston.service';
|
5
|
+
export * from './src/modules/logger/winston.module';
|
6
|
+
export * from './src/modules/tracer/tracer.module';
|
7
|
+
export * from './src/db/typeorm/generic.repository';
|
8
|
+
export * from './src/decorators/utils.decorators';
|
9
|
+
export * from './src/config/env.validation';
|
package/dist/index.js
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./src/types"), exports);
|
18
|
+
__exportStar(require("./src/interceptors/log-request.interceptor"), exports);
|
19
|
+
__exportStar(require("./src/interceptors/serialize.interceptor"), exports);
|
20
|
+
__exportStar(require("./src/modules/logger/winston.service"), exports);
|
21
|
+
__exportStar(require("./src/modules/logger/winston.module"), exports);
|
22
|
+
__exportStar(require("./src/modules/tracer/tracer.module"), exports);
|
23
|
+
__exportStar(require("./src/db/typeorm/generic.repository"), exports);
|
24
|
+
__exportStar(require("./src/decorators/utils.decorators"), exports);
|
25
|
+
__exportStar(require("./src/config/env.validation"), exports);
|
26
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,6EAA2D;AAC3D,2EAAyD;AACzD,uEAAqD;AACrD,sEAAoD;AACpD,qEAAmD;AACnD,sEAAoD;AACpD,oEAAkD;AAClD,8DAA4C"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
declare enum EnvironmentType {
|
2
|
+
Dev = "development",
|
3
|
+
Prod = "production",
|
4
|
+
Test = "test",
|
5
|
+
Staging = "staging"
|
6
|
+
}
|
7
|
+
declare class EnvironmentVariables {
|
8
|
+
NODE_ENV: EnvironmentType;
|
9
|
+
MYSQL_HOST: string;
|
10
|
+
MYSQL_PORT: number;
|
11
|
+
MYSQL_DATABASE: string;
|
12
|
+
MYSQL_USERNAME: string;
|
13
|
+
MYSQL_PASSWORD: string;
|
14
|
+
MYSQL_SYNCHRONIZE: boolean;
|
15
|
+
HTTP_TIMEOUT: number;
|
16
|
+
HTTP_MAX_REDIRECTS: number;
|
17
|
+
BASE_MOTION_URL: string;
|
18
|
+
ACTOR_SERVICE_URL: string;
|
19
|
+
}
|
20
|
+
export declare function validate(configuration: Record<string, unknown>): EnvironmentVariables;
|
21
|
+
export {};
|
@@ -0,0 +1,80 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.validate = void 0;
|
13
|
+
const class_transformer_1 = require("class-transformer");
|
14
|
+
const class_validator_1 = require("class-validator");
|
15
|
+
var EnvironmentType;
|
16
|
+
(function (EnvironmentType) {
|
17
|
+
EnvironmentType["Dev"] = "development";
|
18
|
+
EnvironmentType["Prod"] = "production";
|
19
|
+
EnvironmentType["Test"] = "test";
|
20
|
+
EnvironmentType["Staging"] = "staging";
|
21
|
+
})(EnvironmentType || (EnvironmentType = {}));
|
22
|
+
class EnvironmentVariables {
|
23
|
+
}
|
24
|
+
__decorate([
|
25
|
+
(0, class_validator_1.IsEnum)(EnvironmentType),
|
26
|
+
__metadata("design:type", String)
|
27
|
+
], EnvironmentVariables.prototype, "NODE_ENV", void 0);
|
28
|
+
__decorate([
|
29
|
+
(0, class_validator_1.IsString)(),
|
30
|
+
__metadata("design:type", String)
|
31
|
+
], EnvironmentVariables.prototype, "MYSQL_HOST", void 0);
|
32
|
+
__decorate([
|
33
|
+
(0, class_validator_1.IsNumber)(),
|
34
|
+
__metadata("design:type", Number)
|
35
|
+
], EnvironmentVariables.prototype, "MYSQL_PORT", void 0);
|
36
|
+
__decorate([
|
37
|
+
(0, class_validator_1.IsString)(),
|
38
|
+
(0, class_validator_1.NotContains)(' '),
|
39
|
+
__metadata("design:type", String)
|
40
|
+
], EnvironmentVariables.prototype, "MYSQL_DATABASE", void 0);
|
41
|
+
__decorate([
|
42
|
+
(0, class_validator_1.IsString)(),
|
43
|
+
__metadata("design:type", String)
|
44
|
+
], EnvironmentVariables.prototype, "MYSQL_USERNAME", void 0);
|
45
|
+
__decorate([
|
46
|
+
(0, class_validator_1.IsString)(),
|
47
|
+
__metadata("design:type", String)
|
48
|
+
], EnvironmentVariables.prototype, "MYSQL_PASSWORD", void 0);
|
49
|
+
__decorate([
|
50
|
+
(0, class_validator_1.IsBoolean)(),
|
51
|
+
__metadata("design:type", Boolean)
|
52
|
+
], EnvironmentVariables.prototype, "MYSQL_SYNCHRONIZE", void 0);
|
53
|
+
__decorate([
|
54
|
+
(0, class_validator_1.IsNumber)(),
|
55
|
+
__metadata("design:type", Number)
|
56
|
+
], EnvironmentVariables.prototype, "HTTP_TIMEOUT", void 0);
|
57
|
+
__decorate([
|
58
|
+
(0, class_validator_1.IsNumber)(),
|
59
|
+
__metadata("design:type", Number)
|
60
|
+
], EnvironmentVariables.prototype, "HTTP_MAX_REDIRECTS", void 0);
|
61
|
+
__decorate([
|
62
|
+
(0, class_validator_1.IsString)(),
|
63
|
+
__metadata("design:type", String)
|
64
|
+
], EnvironmentVariables.prototype, "BASE_MOTION_URL", void 0);
|
65
|
+
__decorate([
|
66
|
+
(0, class_validator_1.IsString)(),
|
67
|
+
__metadata("design:type", String)
|
68
|
+
], EnvironmentVariables.prototype, "ACTOR_SERVICE_URL", void 0);
|
69
|
+
function validate(configuration) {
|
70
|
+
const finalConfig = (0, class_transformer_1.plainToClass)(EnvironmentVariables, configuration, {
|
71
|
+
enableImplicitConversion: true,
|
72
|
+
});
|
73
|
+
const errors = (0, class_validator_1.validateSync)(finalConfig, { skipMissingProperties: true });
|
74
|
+
if (errors.length > 0) {
|
75
|
+
throw new Error(errors.toString());
|
76
|
+
}
|
77
|
+
return finalConfig;
|
78
|
+
}
|
79
|
+
exports.validate = validate;
|
80
|
+
//# sourceMappingURL=env.validation.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"env.validation.js","sourceRoot":"","sources":["../../../src/config/env.validation.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAiD;AACjD,qDAAmG;AAEnG,IAAK,eAKJ;AALD,WAAK,eAAe;IAClB,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;IACnB,gCAAa,CAAA;IACb,sCAAmB,CAAA;AACrB,CAAC,EALI,eAAe,KAAf,eAAe,QAKnB;AAED,MAAM,oBAAoB;CAkCzB;AAhCC;IADC,IAAA,wBAAM,EAAC,eAAe,CAAC;;sDACE;AAG1B;IADC,IAAA,0BAAQ,GAAE;;wDACQ;AAGnB;IADC,IAAA,0BAAQ,GAAE;;wDACQ;AAInB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,6BAAW,EAAC,GAAG,CAAC;;4DACM;AAGvB;IADC,IAAA,0BAAQ,GAAE;;4DACY;AAGvB;IADC,IAAA,0BAAQ,GAAE;;4DACY;AAGvB;IADC,IAAA,2BAAS,GAAE;;+DACe;AAG3B;IADC,IAAA,0BAAQ,GAAE;;0DACU;AAGrB;IADC,IAAA,0BAAQ,GAAE;;gEACgB;AAG3B;IADC,IAAA,0BAAQ,GAAE;;6DACa;AAGxB;IADC,IAAA,0BAAQ,GAAE;;+DACe;AAG5B,SAAgB,QAAQ,CAAC,aAAsC;IAC7D,MAAM,WAAW,GAAG,IAAA,gCAAY,EAAC,oBAAoB,EAAE,aAAa,EAAE;QACpE,wBAAwB,EAAE,IAAI;KAC/B,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,IAAA,8BAAY,EAAC,WAAW,EAAE,EAAE,qBAAqB,EAAE,IAAI,EAAE,CAAC,CAAC;IAE1E,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAZD,4BAYC"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { Repository, EntityTarget, EntityManager, FindOptionsWhere, ObjectLiteral, DeepPartial } from 'typeorm';
|
2
|
+
interface IId {
|
3
|
+
id: number;
|
4
|
+
}
|
5
|
+
interface IGenericRepository<E> {
|
6
|
+
save<T extends DeepPartial<E>>(entity: T): Promise<E>;
|
7
|
+
update<T extends DeepPartial<E> & IId>(entity: T): Promise<E>;
|
8
|
+
count(options: FindOptionsWhere<E>): Promise<number>;
|
9
|
+
}
|
10
|
+
export declare class GenericRepository<E extends ObjectLiteral> implements IGenericRepository<E> {
|
11
|
+
readonly entityManager: EntityManager;
|
12
|
+
protected repository: Repository<E>;
|
13
|
+
constructor(entityManager: EntityManager, entity: EntityTarget<E>);
|
14
|
+
save<T extends DeepPartial<E>>(entity: T): Promise<E>;
|
15
|
+
update<T extends DeepPartial<E> & IId>(dto: T): Promise<E>;
|
16
|
+
count(options: FindOptionsWhere<E>): Promise<number>;
|
17
|
+
}
|
18
|
+
export {};
|
@@ -0,0 +1,43 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.GenericRepository = void 0;
|
13
|
+
const typeorm_1 = require("typeorm");
|
14
|
+
const common_1 = require("@nestjs/common");
|
15
|
+
let GenericRepository = class GenericRepository {
|
16
|
+
constructor(entityManager, entity) {
|
17
|
+
this.entityManager = entityManager;
|
18
|
+
this.repository = entityManager.getRepository(entity);
|
19
|
+
}
|
20
|
+
save(entity) {
|
21
|
+
const res = this.repository.create({ ...entity });
|
22
|
+
return this.repository.save(res);
|
23
|
+
}
|
24
|
+
async update(dto) {
|
25
|
+
const entity = await this.repository.findOneBy({
|
26
|
+
id: (0, typeorm_1.Equal)(dto.id),
|
27
|
+
});
|
28
|
+
if (!entity) {
|
29
|
+
throw new Error('Entity not found');
|
30
|
+
}
|
31
|
+
const entityUpdated = await this.repository.save({ id: entity.id, ...dto });
|
32
|
+
return Object.assign(entity, entityUpdated);
|
33
|
+
}
|
34
|
+
count(options) {
|
35
|
+
return this.repository.count(options);
|
36
|
+
}
|
37
|
+
};
|
38
|
+
exports.GenericRepository = GenericRepository;
|
39
|
+
exports.GenericRepository = GenericRepository = __decorate([
|
40
|
+
(0, common_1.Injectable)(),
|
41
|
+
__metadata("design:paramtypes", [typeorm_1.EntityManager, Object])
|
42
|
+
], GenericRepository);
|
43
|
+
//# sourceMappingURL=generic.repository.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"generic.repository.js","sourceRoot":"","sources":["../../../../src/db/typeorm/generic.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAuH;AACvH,2CAA4C;AAarC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAG5B,YACW,aAA4B,EACrC,MAAuB;QADd,kBAAa,GAAb,aAAa,CAAe;QAGrC,IAAI,CAAC,UAAU,GAAG,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;IACD,IAAI,CAA2B,MAAS;QACtC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,MAAM,CAAiC,GAAM;QACjD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;YAC7C,EAAE,EAAE,IAAA,eAAK,EAAC,GAAG,CAAC,EAAE,CAAC;SACgB,CAAC,CAAC;QACrC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QACD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,GAAG,GAAG,EAAE,CAAC,CAAC;QAC5E,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,OAA4B;QAChC,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;CACF,CAAA;AA5BY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;qCAKe,uBAAa;GAJ5B,iBAAiB,CA4B7B"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.GetTraceId = exports.GetMeta = void 0;
|
4
|
+
const common_1 = require("@nestjs/common");
|
5
|
+
exports.GetMeta = (0, common_1.createParamDecorator)((data, ctx) => {
|
6
|
+
const context = ctx.switchToRpc();
|
7
|
+
return context.getContext();
|
8
|
+
});
|
9
|
+
exports.GetTraceId = (0, common_1.createParamDecorator)((data, ctx) => {
|
10
|
+
const context = ctx.switchToRpc();
|
11
|
+
const metadata = context.getContext();
|
12
|
+
const traceId = metadata.get('traceId')[0];
|
13
|
+
return traceId;
|
14
|
+
});
|
15
|
+
//# sourceMappingURL=utils.decorators.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"utils.decorators.js","sourceRoot":"","sources":["../../../src/decorators/utils.decorators.ts"],"names":[],"mappings":";;;AAAA,2CAAwE;AAS3D,QAAA,OAAO,GAAG,IAAA,6BAAoB,EAAC,CAAC,IAAa,EAAE,GAAqB,EAAE,EAAE;IACnF,MAAM,OAAO,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;IAClC,OAAO,OAAO,CAAC,UAAU,EAAE,CAAC;AAC9B,CAAC,CAAC,CAAC;AAUU,QAAA,UAAU,GAAG,IAAA,6BAAoB,EAAC,CAAC,IAAa,EAAE,GAAqB,EAAE,EAAE;IACtF,MAAM,OAAO,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;IAClC,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IACtC,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC,CAAC"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common';
|
2
|
+
import { Observable } from 'rxjs';
|
3
|
+
import { WinstonLoggerService } from '../modules/logger/winston.service';
|
4
|
+
export declare class LogRequestInterceptor implements NestInterceptor {
|
5
|
+
private readonly logger;
|
6
|
+
constructor(logger: WinstonLoggerService);
|
7
|
+
intercept(context: ExecutionContext, next: CallHandler): Observable<any>;
|
8
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.LogRequestInterceptor = void 0;
|
13
|
+
const common_1 = require("@nestjs/common");
|
14
|
+
const operators_1 = require("rxjs/operators");
|
15
|
+
const winston_service_1 = require("../modules/logger/winston.service");
|
16
|
+
let LogRequestInterceptor = class LogRequestInterceptor {
|
17
|
+
constructor(logger) {
|
18
|
+
this.logger = logger;
|
19
|
+
}
|
20
|
+
intercept(context, next) {
|
21
|
+
const req = context.switchToHttp().getRequest();
|
22
|
+
this.logger.info('Before Middleware...', {
|
23
|
+
traceId: req?.local?.traceId,
|
24
|
+
className: 'LogRequestInterceptor',
|
25
|
+
});
|
26
|
+
const now = Date.now();
|
27
|
+
if (req) {
|
28
|
+
const method = req.method;
|
29
|
+
const url = req.url;
|
30
|
+
return next.handle().pipe((0, operators_1.tap)(() => this.logger.info(`After Middleware... ${method} ${url} ${Date.now() - now}ms`, {
|
31
|
+
traceId: req?.local?.traceId,
|
32
|
+
className: 'LogRequestInterceptor',
|
33
|
+
})));
|
34
|
+
}
|
35
|
+
}
|
36
|
+
};
|
37
|
+
exports.LogRequestInterceptor = LogRequestInterceptor;
|
38
|
+
exports.LogRequestInterceptor = LogRequestInterceptor = __decorate([
|
39
|
+
(0, common_1.Injectable)(),
|
40
|
+
__metadata("design:paramtypes", [winston_service_1.WinstonLoggerService])
|
41
|
+
], LogRequestInterceptor);
|
42
|
+
//# sourceMappingURL=log-request.interceptor.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"log-request.interceptor.js","sourceRoot":"","sources":["../../../src/interceptors/log-request.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4F;AAE5F,8CAAqC;AACrC,uEAAyE;AAGlE,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAChC,YAA6B,MAA4B;QAA5B,WAAM,GAAN,MAAM,CAAsB;IAAG,CAAC;IAC7D,SAAS,CAAC,OAAyB,EAAE,IAAiB;QACpD,MAAM,GAAG,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;QAChD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,EAAE;YACvC,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO;YAC5B,SAAS,EAAE,uBAAuB;SACnC,CAAC,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAEvB,IAAI,GAAG,EAAE,CAAC;YACR,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;YAC1B,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC;YACpB,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CACvB,IAAA,eAAG,EAAC,GAAG,EAAE,CACP,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAuB,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,EAAE;gBAC7E,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO;gBAC5B,SAAS,EAAE,uBAAuB;aACnC,CAAC,CACH,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AAvBY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;qCAE0B,sCAAoB;GAD9C,qBAAqB,CAuBjC"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common';
|
2
|
+
import { Observable } from 'rxjs';
|
3
|
+
interface ClassConstructor {
|
4
|
+
new (...args: any[]): {};
|
5
|
+
}
|
6
|
+
export declare function Serialize(dto: ClassConstructor): MethodDecorator & ClassDecorator;
|
7
|
+
export declare class SerializeInterceptor implements NestInterceptor {
|
8
|
+
private dto;
|
9
|
+
constructor(dto: any);
|
10
|
+
intercept(context: ExecutionContext, handler: CallHandler): Observable<any>;
|
11
|
+
}
|
12
|
+
export {};
|
@@ -0,0 +1,24 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.SerializeInterceptor = exports.Serialize = void 0;
|
4
|
+
const common_1 = require("@nestjs/common");
|
5
|
+
const operators_1 = require("rxjs/operators");
|
6
|
+
const class_transformer_1 = require("class-transformer");
|
7
|
+
function Serialize(dto) {
|
8
|
+
return (0, common_1.UseInterceptors)(new SerializeInterceptor(dto));
|
9
|
+
}
|
10
|
+
exports.Serialize = Serialize;
|
11
|
+
class SerializeInterceptor {
|
12
|
+
constructor(dto) {
|
13
|
+
this.dto = dto;
|
14
|
+
}
|
15
|
+
intercept(context, handler) {
|
16
|
+
return handler.handle().pipe((0, operators_1.map)((data) => {
|
17
|
+
return (0, class_transformer_1.plainToInstance)(this.dto, data, {
|
18
|
+
excludeExtraneousValues: true,
|
19
|
+
});
|
20
|
+
}));
|
21
|
+
}
|
22
|
+
}
|
23
|
+
exports.SerializeInterceptor = SerializeInterceptor;
|
24
|
+
//# sourceMappingURL=serialize.interceptor.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"serialize.interceptor.js","sourceRoot":"","sources":["../../../src/interceptors/serialize.interceptor.ts"],"names":[],"mappings":";;;AAAA,2CAAiG;AAEjG,8CAAqC;AACrC,yDAAoD;AAOpD,SAAgB,SAAS,CAAC,GAAqB;IAC7C,OAAO,IAAA,wBAAe,EAAC,IAAI,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC;AACxD,CAAC;AAFD,8BAEC;AAED,MAAa,oBAAoB;IAC/B,YAAoB,GAAQ;QAAR,QAAG,GAAH,GAAG,CAAK;IAAG,CAAC;IAEhC,SAAS,CAAC,OAAyB,EAAE,OAAoB;QACvD,OAAO,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAC1B,IAAA,eAAG,EAAC,CAAC,IAAS,EAAE,EAAE;YAChB,OAAO,IAAA,mCAAe,EAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE;gBACrC,uBAAuB,EAAE,IAAI;aAC9B,CAAC,CAAC;QACL,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF;AAZD,oDAYC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const TraceLog: () => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.TraceLog = void 0;
|
4
|
+
const TraceLog = () => {
|
5
|
+
return function (target, propertyKey, descriptor) {
|
6
|
+
const originalMethod = descriptor.value;
|
7
|
+
descriptor.value = function (message, meta) {
|
8
|
+
const traceId = meta?.traceId || 'unknown-trace-id';
|
9
|
+
const className = meta.className;
|
10
|
+
meta = { ...meta, traceId, className };
|
11
|
+
originalMethod.call(this, message, meta);
|
12
|
+
};
|
13
|
+
return descriptor;
|
14
|
+
};
|
15
|
+
};
|
16
|
+
exports.TraceLog = TraceLog;
|
17
|
+
//# sourceMappingURL=winston.decorator.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"winston.decorator.js","sourceRoot":"","sources":["../../../../src/modules/logger/winston.decorator.ts"],"names":[],"mappings":";;;AAAO,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,OAAO,UAAU,MAAW,EAAE,WAAmB,EAAE,UAA8B;QAC/E,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,UAAU,CAAC,KAAK,GAAG,UAAU,OAAe,EAAE,IAAS;YACrD,MAAM,OAAO,GAAG,IAAI,EAAE,OAAO,IAAI,kBAAkB,CAAC;YACpD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;YACjC,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;YACvC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QAC3C,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,QAAQ,YAanB"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { ElasticsearchTransportOptions } from 'winston-elasticsearch';
|
2
|
+
import { DatadogTransportOptions } from 'datadog-winston';
|
3
|
+
export interface IWinstonLogger {
|
4
|
+
info(message: string, meta?: Record<string, any>): void;
|
5
|
+
error(message: string, meta?: Record<string, any>): void;
|
6
|
+
warn(message: string, meta?: Record<string, any>): void;
|
7
|
+
help(message: string, meta?: Record<string, any>): void;
|
8
|
+
data(message: string, meta?: Record<string, any>): void;
|
9
|
+
debug(message: string, meta?: Record<string, any>): void;
|
10
|
+
prompt(message: string, meta?: Record<string, any>): void;
|
11
|
+
http(message: string, meta?: Record<string, any>): void;
|
12
|
+
verbose(message: string, meta?: Record<string, any>): void;
|
13
|
+
input(message: string, meta?: Record<string, any>): void;
|
14
|
+
silly(message: string, meta?: Record<string, any>): void;
|
15
|
+
}
|
16
|
+
export interface WinstonLoggerModuleOptions {
|
17
|
+
transportFile?: boolean;
|
18
|
+
transportConsole?: boolean;
|
19
|
+
transportElasticsearch?: ElasticsearchTransportOptions;
|
20
|
+
transportDatadog?: DatadogTransportOptions;
|
21
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"winston.interface.js","sourceRoot":"","sources":["../../../../src/modules/logger/winston.interface.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,95 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var WinstonModule_1;
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
+
exports.WinstonModule = void 0;
|
11
|
+
const common_1 = require("@nestjs/common");
|
12
|
+
const winston_1 = require("winston");
|
13
|
+
const config_1 = require("@nestjs/config");
|
14
|
+
const winston_service_1 = require("./winston.service");
|
15
|
+
const winston_elasticsearch_1 = require("winston-elasticsearch");
|
16
|
+
const DatadogWinston = require("datadog-winston");
|
17
|
+
const myFormat = winston_1.format.printf(({ level = 'info', message, timestamp, err, ...metadata }) => {
|
18
|
+
return `${timestamp} [${level}]: ${message} ${err ? err.stack : ''} ${JSON.stringify(metadata)} `;
|
19
|
+
});
|
20
|
+
let WinstonModule = WinstonModule_1 = class WinstonModule {
|
21
|
+
static forRoot() {
|
22
|
+
const winstonProvider = {
|
23
|
+
provide: 'WINSTON_LOGGER',
|
24
|
+
useFactory: (configService) => {
|
25
|
+
const transportType = configService.getOrThrow('LOG_TRANSPORTS');
|
26
|
+
const transportsArray = transportType.split(',');
|
27
|
+
if (transportsArray.length === 0 || transportsArray.every((item) => item.trim() === '')) {
|
28
|
+
throw new Error('LOG_TRANSPORTS must contain at least one transport method.');
|
29
|
+
}
|
30
|
+
const selectedTransport = [];
|
31
|
+
for (const iterator of transportsArray) {
|
32
|
+
if (iterator === 'elasticsearch') {
|
33
|
+
selectedTransport.push(new winston_elasticsearch_1.ElasticsearchTransport({
|
34
|
+
clientOpts: {
|
35
|
+
node: configService.getOrThrow('ELASTICSEARCH_sURL'),
|
36
|
+
},
|
37
|
+
}));
|
38
|
+
}
|
39
|
+
if (iterator === 'datadog') {
|
40
|
+
selectedTransport.push(new DatadogWinston({
|
41
|
+
apiKey: configService.getOrThrow('DATADOG_APIKEY'),
|
42
|
+
hostname: configService.getOrThrow('DATADOG_HOSTNAME'),
|
43
|
+
service: configService.getOrThrow('DATADOG_SERVICE'),
|
44
|
+
ddsource: configService.getOrThrow('DATADOG_DDSOURCE'),
|
45
|
+
ddtags: configService.getOrThrow('DATADOG_DDTAGS'),
|
46
|
+
intakeRegion: configService.getOrThrow('DATADOG_INTAKEREGION'),
|
47
|
+
}));
|
48
|
+
}
|
49
|
+
if (iterator === 'file') {
|
50
|
+
selectedTransport.push(new winston_1.transports.File({
|
51
|
+
filename: 'logs/error.log',
|
52
|
+
level: 'error',
|
53
|
+
format: winston_1.format.combine(winston_1.format.timestamp(), winston_1.format.json()),
|
54
|
+
}), new winston_1.transports.File({
|
55
|
+
filename: 'logs/combined.log',
|
56
|
+
format: winston_1.format.combine(winston_1.format.timestamp(), winston_1.format.json(), myFormat),
|
57
|
+
}));
|
58
|
+
}
|
59
|
+
if (iterator === 'console') {
|
60
|
+
selectedTransport.push(new winston_1.transports.Console({
|
61
|
+
format: winston_1.format.combine(winston_1.format.colorize(), winston_1.format.splat(), winston_1.format.errors({ stack: true }), winston_1.format.json(), winston_1.format.timestamp({
|
62
|
+
format: 'YYYY-MM-DD HH:mm:ss',
|
63
|
+
}), myFormat),
|
64
|
+
}));
|
65
|
+
}
|
66
|
+
}
|
67
|
+
return (0, winston_1.createLogger)({
|
68
|
+
level: configService.get('LOG_LEVEL') || 'info',
|
69
|
+
defaultMeta: {
|
70
|
+
service: configService.getOrThrow('NAME_SERVICE'),
|
71
|
+
},
|
72
|
+
transports: selectedTransport,
|
73
|
+
});
|
74
|
+
},
|
75
|
+
inject: [config_1.ConfigService],
|
76
|
+
};
|
77
|
+
const loggerServiceProvider = {
|
78
|
+
provide: winston_service_1.WinstonLoggerService,
|
79
|
+
useFactory: (logger) => new winston_service_1.WinstonLoggerService(logger),
|
80
|
+
inject: ['WINSTON_LOGGER'],
|
81
|
+
};
|
82
|
+
return {
|
83
|
+
module: WinstonModule_1,
|
84
|
+
imports: [config_1.ConfigModule],
|
85
|
+
providers: [winstonProvider, loggerServiceProvider],
|
86
|
+
exports: [winstonProvider, loggerServiceProvider],
|
87
|
+
};
|
88
|
+
}
|
89
|
+
};
|
90
|
+
exports.WinstonModule = WinstonModule;
|
91
|
+
exports.WinstonModule = WinstonModule = WinstonModule_1 = __decorate([
|
92
|
+
(0, common_1.Global)(),
|
93
|
+
(0, common_1.Module)({})
|
94
|
+
], WinstonModule);
|
95
|
+
//# sourceMappingURL=winston.module.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"winston.module.js","sourceRoot":"","sources":["../../../../src/modules/logger/winston.module.ts"],"names":[],"mappings":";;;;;;;;;;AACA,2CAA+D;AAC/D,qCAAmE;AAEnE,2CAA6D;AAC7D,uDAAyD;AACzD,iEAA+D;AAC/D,kDAAmD;AAEnD,MAAM,QAAQ,GAAG,gBAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,QAAQ,EAAE,EAAE,EAAE;IAC1F,OAAO,GAAG,SAAS,KAAK,KAAK,MAAM,OAAO,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC;AACpG,CAAC,CAAC,CAAC;AAII,IAAM,aAAa,qBAAnB,MAAM,aAAa;IACxB,MAAM,CAAC,OAAO;QACZ,MAAM,eAAe,GAAG;YACtB,OAAO,EAAE,gBAAgB;YACzB,UAAU,EAAE,CAAC,aAA4B,EAAU,EAAE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