@iamnnort/nestjs-serializer 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +77 -0
- package/dist/index.d.mts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +75 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +75 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +63 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 mingchuno
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
## Info
|
|
2
|
+
|
|
3
|
+
Request module for NestJS - Simple - Informative - Pretty
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
yarn install @iamnnort/nestjs-serializer
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
// app.controller.ts
|
|
15
|
+
import { Controller, Get } from '@nestjs/common';
|
|
16
|
+
import { RequestService } from '@iamnnort/nestjs-serializer';
|
|
17
|
+
|
|
18
|
+
@Controller('demo')
|
|
19
|
+
export class AppController {
|
|
20
|
+
constructor(private requestService: RequestService<{ id: number }>) {}
|
|
21
|
+
|
|
22
|
+
@Get()
|
|
23
|
+
demo() {
|
|
24
|
+
return this.requestService.get(1);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// app.ts
|
|
29
|
+
import { Module } from '@nestjs/common';
|
|
30
|
+
import { RequestModule } from '@iamnnort/nestjs-serializer';
|
|
31
|
+
import { AppController } from './app.controller';
|
|
32
|
+
|
|
33
|
+
@Module({
|
|
34
|
+
imports: [
|
|
35
|
+
RequestModule.register({
|
|
36
|
+
name: 'Demo Api',
|
|
37
|
+
baseUrl: 'https://jsonplaceholder.typicode.com',
|
|
38
|
+
url: '/todos',
|
|
39
|
+
logger: true,
|
|
40
|
+
}),
|
|
41
|
+
],
|
|
42
|
+
controllers: [AppController],
|
|
43
|
+
})
|
|
44
|
+
export class AppModule {}
|
|
45
|
+
|
|
46
|
+
// index.ts
|
|
47
|
+
import { NestFactory } from '@nestjs/core';
|
|
48
|
+
import { LoggerService } from '@iamnnort/nestjs-logger';
|
|
49
|
+
import { AppModule } from './app';
|
|
50
|
+
|
|
51
|
+
async function bootstrap() {
|
|
52
|
+
const app = await NestFactory.create(AppModule, {
|
|
53
|
+
bufferLogs: true,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
app.useLogger(new LoggerService());
|
|
57
|
+
|
|
58
|
+
await app.listen(3000);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
bootstrap();
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Output
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
[System] Application is starting...
|
|
68
|
+
[System] Application started.
|
|
69
|
+
[System] [Request] GET /demo
|
|
70
|
+
[Demo Api] [Request] GET /todos/1
|
|
71
|
+
[Demo Api] [Response] GET /todos/1 200 OK {"userId":1,"id":1,"title":"delectus aut autem","completed":false}
|
|
72
|
+
[System] [Response] GET /demo 200 OK
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as _nestjs_common from '@nestjs/common';
|
|
2
|
+
|
|
3
|
+
type SerializerConfig = {
|
|
4
|
+
local: boolean;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
declare const ConfigurableModuleClass: _nestjs_common.ConfigurableModuleCls<SerializerConfig, "register", "create", {}>;
|
|
8
|
+
|
|
9
|
+
declare class SerializerModule extends ConfigurableModuleClass {
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare class SerializerService {
|
|
13
|
+
config: SerializerConfig;
|
|
14
|
+
constructor(config: SerializerConfig);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { type SerializerConfig, SerializerModule, SerializerService };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as _nestjs_common from '@nestjs/common';
|
|
2
|
+
|
|
3
|
+
type SerializerConfig = {
|
|
4
|
+
local: boolean;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
declare const ConfigurableModuleClass: _nestjs_common.ConfigurableModuleCls<SerializerConfig, "register", "create", {}>;
|
|
8
|
+
|
|
9
|
+
declare class SerializerModule extends ConfigurableModuleClass {
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare class SerializerService {
|
|
13
|
+
config: SerializerConfig;
|
|
14
|
+
constructor(config: SerializerConfig);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { type SerializerConfig, SerializerModule, SerializerService };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/module.ts
|
|
5
|
+
var _common = require('@nestjs/common');
|
|
6
|
+
|
|
7
|
+
// src/module-definition.ts
|
|
8
|
+
|
|
9
|
+
var { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN } = new (0, _common.ConfigurableModuleBuilder)().build();
|
|
10
|
+
|
|
11
|
+
// src/service.ts
|
|
12
|
+
|
|
13
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
14
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
16
|
+
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;
|
|
17
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18
|
+
}
|
|
19
|
+
__name(_ts_decorate, "_ts_decorate");
|
|
20
|
+
function _ts_metadata(k, v) {
|
|
21
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
|
+
}
|
|
23
|
+
__name(_ts_metadata, "_ts_metadata");
|
|
24
|
+
function _ts_param(paramIndex, decorator) {
|
|
25
|
+
return function(target, key) {
|
|
26
|
+
decorator(target, key, paramIndex);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
__name(_ts_param, "_ts_param");
|
|
30
|
+
var SerializerService = class {
|
|
31
|
+
static {
|
|
32
|
+
__name(this, "SerializerService");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
constructor(config) {
|
|
36
|
+
this.config = config;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
SerializerService = exports.SerializerService = _ts_decorate([
|
|
40
|
+
_common.Injectable.call(void 0, ),
|
|
41
|
+
_ts_param(0, _common.Inject.call(void 0, MODULE_OPTIONS_TOKEN)),
|
|
42
|
+
_ts_metadata("design:type", Function),
|
|
43
|
+
_ts_metadata("design:paramtypes", [
|
|
44
|
+
typeof SerializerConfig === "undefined" ? Object : SerializerConfig
|
|
45
|
+
])
|
|
46
|
+
], SerializerService);
|
|
47
|
+
|
|
48
|
+
// src/module.ts
|
|
49
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
50
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
51
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
52
|
+
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;
|
|
53
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
54
|
+
}
|
|
55
|
+
__name(_ts_decorate2, "_ts_decorate");
|
|
56
|
+
var SerializerModule = class extends ConfigurableModuleClass {
|
|
57
|
+
static {
|
|
58
|
+
__name(this, "SerializerModule");
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
SerializerModule = exports.SerializerModule = _ts_decorate2([
|
|
62
|
+
_common.Module.call(void 0, {
|
|
63
|
+
providers: [
|
|
64
|
+
SerializerService
|
|
65
|
+
],
|
|
66
|
+
exports: [
|
|
67
|
+
SerializerService
|
|
68
|
+
]
|
|
69
|
+
})
|
|
70
|
+
], SerializerModule);
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
exports.SerializerModule = SerializerModule; exports.SerializerService = SerializerService;
|
|
75
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/nikitapavets/projects/nestjs-serializer/dist/index.js","../src/module.ts","../src/module-definition.ts","../src/service.ts"],"names":["ConfigurableModuleClass","MODULE_OPTIONS_TOKEN","ConfigurableModuleBuilder","build","SerializerService","constructor","config","SerializerModule","providers","exports"],"mappings":"AAAA,6EAAI,UAAU,EAAE,MAAM,CAAC,cAAc;AACrC,IAAI,OAAO,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;AACxF;AACA;ACHA,wCAAuB;ADKvB;AACA;AENA;AAGO,IAAM,EAAEA,uBAAAA,EAAyBC,qBAAoB,EAAA,EAC1D,IAAIC,sCAAAA,CAAAA,CAAAA,CAA8CC,KAAAA,CAAK,CAAA;AFKzD;AACA;AGVA;AHYA,SAAS,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE;AACrD,EAAE,IAAI,EAAE,EAAE,SAAS,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC;AAC9H,EAAE,GAAG,CAAC,OAAO,QAAQ,IAAI,SAAS,GAAG,OAAO,OAAO,CAAC,SAAS,IAAI,UAAU,EAAE,EAAE,EAAE,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC;AAChI,EAAE,KAAK,IAAI,CAAC,IAAI,EAA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AAE,GAAG,EAAE,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;AAC/D;AACA,MAAM,CAAC,aAAa,EAAE,cAAc,CAAC;AC9C9B,IAAMC,iBAAAA,EAAN,MAAA,QAA+BP,wBAAAA;ADgDtC,EAAE,OChDoCA;ADiDtC,IAAI,MAAM,CAAC,IAAI,EAAE,kBAAkB,CAAC;AACpC,EAAE;AClD6D,CAAA;ADoD/D,iBAAiB,6BAAE,aAAa,CAAC;AACjC,EAAE,4BAAM;AACR,ICzDEQ,SAAAA,EAAW;AD0Db,MC1DcJ;AD2Dd,IAAI,CAAC;AACL,IC3DEK,OAAAA,EAAS;AD4DX,MC5DYL;AD6DZ,IAAI;AACJ,EAAE,CAAC;AACH,CAAC,EAAE,gBAAgB,CAAC;AACpB;AACE;AACA;AACF,2FAAC","file":"/Users/nikitapavets/projects/nestjs-serializer/dist/index.js","sourcesContent":[null,"import { Module } from '@nestjs/common';\nimport { ConfigurableModuleClass } from './module-definition';\nimport { SerializerService } from './service';\n\n@Module({\n providers: [SerializerService],\n exports: [SerializerService],\n})\nexport class SerializerModule extends ConfigurableModuleClass {}\n","import { ConfigurableModuleBuilder } from '@nestjs/common';\nimport type { SerializerConfig } from './types';\n\nexport const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN } =\n new ConfigurableModuleBuilder<SerializerConfig>().build();\n","import { Inject, Injectable } from '@nestjs/common';\nimport { MODULE_OPTIONS_TOKEN } from './module-definition';\nimport type { SerializerConfig } from './types';\n\n@Injectable()\nexport class SerializerService {\n constructor(\n @Inject(MODULE_OPTIONS_TOKEN)\n public config: SerializerConfig,\n ) {}\n}\n"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/module.ts
|
|
5
|
+
import { Module } from "@nestjs/common";
|
|
6
|
+
|
|
7
|
+
// src/module-definition.ts
|
|
8
|
+
import { ConfigurableModuleBuilder } from "@nestjs/common";
|
|
9
|
+
var { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN } = new ConfigurableModuleBuilder().build();
|
|
10
|
+
|
|
11
|
+
// src/service.ts
|
|
12
|
+
import { Inject, Injectable } from "@nestjs/common";
|
|
13
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
14
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
16
|
+
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;
|
|
17
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18
|
+
}
|
|
19
|
+
__name(_ts_decorate, "_ts_decorate");
|
|
20
|
+
function _ts_metadata(k, v) {
|
|
21
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
|
+
}
|
|
23
|
+
__name(_ts_metadata, "_ts_metadata");
|
|
24
|
+
function _ts_param(paramIndex, decorator) {
|
|
25
|
+
return function(target, key) {
|
|
26
|
+
decorator(target, key, paramIndex);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
__name(_ts_param, "_ts_param");
|
|
30
|
+
var SerializerService = class {
|
|
31
|
+
static {
|
|
32
|
+
__name(this, "SerializerService");
|
|
33
|
+
}
|
|
34
|
+
config;
|
|
35
|
+
constructor(config) {
|
|
36
|
+
this.config = config;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
SerializerService = _ts_decorate([
|
|
40
|
+
Injectable(),
|
|
41
|
+
_ts_param(0, Inject(MODULE_OPTIONS_TOKEN)),
|
|
42
|
+
_ts_metadata("design:type", Function),
|
|
43
|
+
_ts_metadata("design:paramtypes", [
|
|
44
|
+
typeof SerializerConfig === "undefined" ? Object : SerializerConfig
|
|
45
|
+
])
|
|
46
|
+
], SerializerService);
|
|
47
|
+
|
|
48
|
+
// src/module.ts
|
|
49
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
50
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
51
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
52
|
+
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;
|
|
53
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
54
|
+
}
|
|
55
|
+
__name(_ts_decorate2, "_ts_decorate");
|
|
56
|
+
var SerializerModule = class extends ConfigurableModuleClass {
|
|
57
|
+
static {
|
|
58
|
+
__name(this, "SerializerModule");
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
SerializerModule = _ts_decorate2([
|
|
62
|
+
Module({
|
|
63
|
+
providers: [
|
|
64
|
+
SerializerService
|
|
65
|
+
],
|
|
66
|
+
exports: [
|
|
67
|
+
SerializerService
|
|
68
|
+
]
|
|
69
|
+
})
|
|
70
|
+
], SerializerModule);
|
|
71
|
+
export {
|
|
72
|
+
SerializerModule,
|
|
73
|
+
SerializerService
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/module.ts","../src/module-definition.ts","../src/service.ts"],"sourcesContent":["import { Module } from '@nestjs/common';\nimport { ConfigurableModuleClass } from './module-definition';\nimport { SerializerService } from './service';\n\n@Module({\n providers: [SerializerService],\n exports: [SerializerService],\n})\nexport class SerializerModule extends ConfigurableModuleClass {}\n","import { ConfigurableModuleBuilder } from '@nestjs/common';\nimport type { SerializerConfig } from './types';\n\nexport const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN } =\n new ConfigurableModuleBuilder<SerializerConfig>().build();\n","import { Inject, Injectable } from '@nestjs/common';\nimport { MODULE_OPTIONS_TOKEN } from './module-definition';\nimport type { SerializerConfig } from './types';\n\n@Injectable()\nexport class SerializerService {\n constructor(\n @Inject(MODULE_OPTIONS_TOKEN)\n public config: SerializerConfig,\n ) {}\n}\n"],"mappings":";;;;AAAA,SAASA,cAAc;;;ACAvB,SAASC,iCAAiC;AAGnC,IAAM,EAAEC,yBAAyBC,qBAAoB,IAC1D,IAAIF,0BAAAA,EAA8CG,MAAK;;;ACJzD,SAASC,QAAQC,kBAAkB;;;;;;;;;;;;;;;;;;AAK5B,IAAMC,oBAAN,MAAMA;SAAAA;;;;EACXC,YAESC,QACP;SADOA,SAAAA;EACN;AACL;;;;;;;;;;;;;;;;;;AFFO,IAAMC,mBAAN,cAA+BC,wBAAAA;SAAAA;;;AAAyB;;;IAH7DC,WAAW;MAACC;;IACZC,SAAS;MAACD;;;;","names":["Module","ConfigurableModuleBuilder","ConfigurableModuleClass","MODULE_OPTIONS_TOKEN","build","Inject","Injectable","SerializerService","constructor","config","SerializerModule","ConfigurableModuleClass","providers","SerializerService","exports"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@iamnnort/nestjs-serializer",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Serialization module for NestJS - Efficient - Flexible - Streamlined",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"nestjs",
|
|
7
|
+
"serialization",
|
|
8
|
+
"deserialization",
|
|
9
|
+
"transform",
|
|
10
|
+
"dto",
|
|
11
|
+
"mapping",
|
|
12
|
+
"serializer"
|
|
13
|
+
],
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"module": "./dist/index.mjs",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=18.0.0"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"start": "ts-node ./example",
|
|
25
|
+
"build": "tsup",
|
|
26
|
+
"format": "prettier --write '**/*.{ts,js,json}'",
|
|
27
|
+
"lint": "eslint --fix",
|
|
28
|
+
"test": "yarn lint",
|
|
29
|
+
"prepare": "husky"
|
|
30
|
+
},
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "git+https://github.com/iamnnort/nestjs-serializer.git"
|
|
34
|
+
},
|
|
35
|
+
"author": "Nikita Pavets",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/iamnnort/nestjs-serializer/issues"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/iamnnort/nestjs-serializer#readme",
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@nestjs/common": "^10.4.4"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@nestjs/core": "^10.4.4",
|
|
46
|
+
"@nestjs/platform-express": "^10.4.4",
|
|
47
|
+
"@swc/core": "^1.7.35",
|
|
48
|
+
"@tsconfig/node18": "^18.2.4",
|
|
49
|
+
"@types/express": "^5.0.0",
|
|
50
|
+
"@typescript-eslint/parser": "^8.8.1",
|
|
51
|
+
"eslint": "^9.12.0",
|
|
52
|
+
"eslint-config-prettier": "^9.1.0",
|
|
53
|
+
"husky": "^9.1.6",
|
|
54
|
+
"lint-staged": "^15.2.10",
|
|
55
|
+
"prettier": "^3.3.3",
|
|
56
|
+
"reflect-metadata": "^0.2.2",
|
|
57
|
+
"rxjs": "^7.8.1",
|
|
58
|
+
"ts-node": "^10.9.2",
|
|
59
|
+
"tsup": "^8.3.0",
|
|
60
|
+
"typescript": "5.5.4",
|
|
61
|
+
"typescript-eslint": "^8.8.1"
|
|
62
|
+
}
|
|
63
|
+
}
|