Compare commits

...

109 Commits

Author SHA1 Message Date
Kamil Myśliwiec
de9664831c chore(@nestjs) publish v5.3.9 release 2018-09-24 15:17:18 +02:00
Kamil Myśliwiec
26eeeb598e chore(nestjs) publish 5.3.8 release 2018-09-24 15:14:09 +02:00
Kamil Myśliwiec
49f97cf72c chore(@nestjs) publish v5.3.8 release 2018-09-24 15:07:47 +02:00
Kamil Myśliwiec
15a6d890a5 Merge branch 'master' of https://github.com/nestjs/nest 2018-09-24 15:06:29 +02:00
Kamil Myśliwiec
a3c1bdc061 chore: update bundle 2018-09-24 15:06:26 +02:00
Kamil Myśliwiec
b75460b34f Merge pull request #1102 from nestjs/bugfix/1098-multiple-http
bugfix: multiple HttpModule collision
2018-09-24 15:06:11 +02:00
Kamil Myśliwiec
25a3684dcf chore(@nestjs) publish v5.3.7-postinstall-next release 2018-09-24 15:04:16 +02:00
Kamil Myśliwiec
9e322c1ed1 refactor(nestjs) fix invalid imports, refactor messages 2018-09-21 10:29:18 +02:00
Kamil Myśliwiec
767ccd3e92 Merge pull request #1103 from jbpionnier/refactor/enable_strict_mode
refactor(nestjs) enable strict mode
2018-09-21 09:27:26 +02:00
Kamil Myśliwiec
0368d5267c merge: resolve conflicts 2018-09-21 09:22:26 +02:00
Kamil Myśliwiec
005d16f447 refactor(nestjs) remove uncessary map calls 2018-09-21 09:21:50 +02:00
Jean-Baptiste Pionnier
d37ec239c4 refactor: clean code 2018-09-20 14:41:15 +02:00
Jean-Baptiste Pionnier
558e33f25c refactor: enable strict mode 2018-09-20 11:24:39 +02:00
Kamil Myśliwiec
5172ef3c49 bugfix(common) fix multiple HttpModule collision 2018-09-19 13:58:47 +02:00
Kamil Myśliwiec
cdccb8ed97 Merge pull request #1094 from jbpionnier/refactor/replace_index_of_methods
refactor(nestjs) replace indexOf methods & improvements
2018-09-19 13:36:55 +02:00
Kamil Myśliwiec
4d407ab239 Merge pull request #1091 from cschroeter/master
sample(prisma) update Prisma example
2018-09-19 13:27:33 +02:00
Kamil Myśliwiec
58120783d5 sample(mongoose) update packages 2018-09-19 12:18:04 +02:00
Jean-Baptiste Pionnier
9732e8a0f4 refactor: code improvement 2018-09-18 11:25:32 +02:00
Jean-Baptiste Pionnier
dabf8a24c7 refactor: replace indexOf method 2018-09-18 10:40:15 +02:00
Christian Schröter
447372a485 refactor: Extract GraphQL related configuration in a dedicated GraphqlOptions class 2018-09-14 15:10:37 +02:00
Christian Schröter
4b042af629 chore: Update graphql.schema.d.ts 2018-09-14 15:09:52 +02:00
Christian Schröter
ff828b9e86 feat: Implement all supoorted queries and mutations 2018-09-14 15:09:35 +02:00
Christian Schröter
806f079c2c chore: Remove duplicate typings 2018-09-14 14:54:42 +02:00
Christian Schröter
a2880d02bd chore: Update dependencies 2018-09-14 14:53:56 +02:00
Kamil Myśliwiec
ce498e8615 bugfix(core) revert stringify instead of hash 2018-09-13 12:21:54 +02:00
Kamil Myśliwiec
14f737f770 Merge branch 'master' of https://github.com/nestjs/nest 2018-09-13 11:46:29 +02:00
Kamil Myśliwiec
a9922dab23 bugfix(core) fix incorrent hash generated by token factory 2018-09-13 11:46:22 +02:00
Kamil Myśliwiec
b1f7096432 Merge pull request #1074 from cschroeter/master
sample(graphql) add prisma integration example
2018-09-13 11:45:33 +02:00
Kamil Myśliwiec
d5dca175d7 Merge pull request #1041 from jbpionnier/refactor/delete_resolve_factory_instance_method
refactor(core) delete resolve factory instance method
2018-09-13 11:44:29 +02:00
Kamil Myśliwiec
66c0b8cf5c sample(grpc) update packages to latest patch versions 2018-09-13 10:43:56 +02:00
Kamil Myśliwiec
e3356cf19e chore(@nestjs) publish v5.3.7 release 2018-09-13 10:42:35 +02:00
Kamil Myśliwiec
4b6ca2a3e0 bugfix(microservices) fix client with loader settings 2018-09-13 10:41:28 +02:00
Kamil Myśliwiec
137e8fd408 Merge branch 'master' of https://github.com/nestjs/nest 2018-09-13 10:20:32 +02:00
Kamil Myśliwiec
03f2832a2d sample(graphql) update graphql sample (add validation) 2018-09-13 10:20:24 +02:00
Christian Schröter
d9a9e7df2f chore: Update graphql schema definitions 2018-09-10 18:20:48 +02:00
Christian Schröter
a3fe26babf chore: Use decorators 2018-09-10 18:20:22 +02:00
Christian Schröter
71cc0dea61 chore: Get rid off obsolete jest configuration 2018-09-10 18:07:55 +02:00
Christian Schröter
6198204b0b chore(Update deps): 2018-09-10 18:07:29 +02:00
Jean-Baptiste Pionnier
32953148df Merge branch 'master' of github.com:nestjs/nest into refactor/delete_resolve_factory_instance_method 2018-09-10 17:08:58 +02:00
Christian Schröter
603ed2de28 feat: Add GraphQL-Prisma example 2018-09-10 16:44:35 +02:00
Kamil Myśliwiec
b272ec313b Update Readme.md 2018-09-09 23:23:26 +02:00
Kamil Myśliwiec
25588d83d0 test(core) fix broken unit tests (container) 2018-09-09 23:15:33 +02:00
Kamil Myśliwiec
d4c0969f1a feature(core) show more descriptive errors on barrel file issues 2018-09-09 22:56:36 +02:00
Kamil Myśliwiec
2d942a8405 test(nestjs) fix broken unit tests (context creator) 2018-09-09 18:29:56 +02:00
Kamil Myśliwiec
e0f5e1d5ca performance(nestjs) context creator improvements 2018-09-09 18:24:54 +02:00
Kamil Myśliwiec
e8c815d8ec sample(nestjs) update packages (apollo sample) 2018-09-09 17:59:11 +02:00
Kamil Myśliwiec
149176ae6f benchmarks(nestjs) use dashes instead of dots 2018-09-09 13:49:28 +02:00
Kamil Myśliwiec
fa3ee7e2aa chore(nestjs) push latest bundle 2018-09-09 13:42:04 +02:00
Kamil Myśliwiec
d5880506df chore(@nestjs) publish v5.3.6 release 2018-09-09 12:23:03 +02:00
Kamil Myśliwiec
dfd0d17126 chore(@nestjs) publish v5.3.5 release 2018-09-09 12:22:16 +02:00
Kamil Myśliwiec
9638c18020 performance(core) add headers check 2018-09-09 11:38:23 +02:00
Kamil Myśliwiec
9ef356b30f refactor(nestjs) cleanup, get rid of needless condition (interceptors) 2018-09-08 09:24:44 +02:00
Kamil Myśliwiec
1a7ab4e5f9 refactor(nestjs) microservices improvements, reduce memory usage 2018-09-08 09:24:06 +02:00
Kamil Myśliwiec
c5da005d81 sample(nestjs) update sample http cache interceptor 2018-09-05 11:40:34 +02:00
Kamil Myśliwiec
76beabe686 sample(nestjs) update sample http cache interceptor 2018-09-05 10:07:50 +02:00
Kamil Myśliwiec
e766ea72ba chore(nestjs) publish 5.3.5 release 2018-09-05 10:04:54 +02:00
Kamil Myśliwiec
2f535c33ae chore(@nestjs) publish v5.3.5 release 2018-09-05 10:04:15 +02:00
Kamil Myśliwiec
20dd9fc8ca bugfix(common) remove useless parts of cache interceptor 2018-09-05 10:03:28 +02:00
Kamil Myśliwiec
6110526402 chore(@nestjs) publish v5.3.4 release 2018-09-05 09:38:05 +02:00
Kamil Myśliwiec
0a1f44ac4d bugfix(common) export CACHE_MANAGER, fix trackBy method 2018-09-05 09:37:33 +02:00
Kamil Myśliwiec
d048f23ff8 improvement(microservices) ensure that connection is shared across promises 2018-09-05 09:37:09 +02:00
Kamil Myśliwiec
f5f8255a37 bugfix(core) check bootstrap lifecycle hook 2018-09-05 09:36:23 +02:00
Kamil Myśliwiec
cc4d91fcb3 chore(@nestjs) publish v5.3.3 release 2018-09-04 11:48:10 +02:00
Jean-Baptiste Pionnier
b296cabd35 refactor: resolve module path 2018-09-03 21:34:15 +02:00
Jean-Baptiste Pionnier
b8a66efbba refactor: delete unnecessary resolveFactoryInstance method 2018-09-03 21:31:16 +02:00
Kamil Myśliwiec
89c76a682e chore(nestjs) publish 5.3.2 release 2018-09-03 18:05:35 +02:00
Kamil Myśliwiec
63577b9986 chore(@nestjs) publish v5.3.2 release 2018-09-03 18:01:18 +02:00
Kamil Myśliwiec
713e97f6c3 chore(nestjs) publish 5.3.1 release 2018-09-03 17:10:59 +02:00
Kamil Myśliwiec
c392da09a6 Merge branch 'master' of https://github.com/nestjs/nest 2018-09-03 17:10:16 +02:00
Kamil Myśliwiec
02d4841d05 chore(@nestjs) publish v5.3.1 release 2018-09-03 17:09:48 +02:00
Kamil Myśliwiec
cbe9ed4980 Merge pull request #1036 from cschroeter/master
sample(nestjs) update GraphQL example
2018-09-03 12:52:59 +02:00
Kamil Myśliwiec
d654e5e84f deps(nestjs) replace generate-safe-id with uuid 2018-09-03 12:52:25 +02:00
Christian Schröter
9d2bd82173 Enable subscriptions in GraphQLModule 2018-09-03 12:25:53 +02:00
Christian Schröter
02affa5677 Update and clean up dependencies 2018-09-03 12:25:07 +02:00
Kamil Myśliwiec
71a023ebae Merge branch 'master' of https://github.com/nestjs/nest 2018-09-02 22:47:57 +02:00
Kamil Myśliwiec
aa75b52255 build(nestjs) fix package-lock.json 2018-09-02 22:47:47 +02:00
Kamil Myśliwiec
6cf7cdc2a6 Merge pull request #1008 from jbpionnier/refactor/unnecessary_instanceof_promise
refactor(nestjs) unnecessary instanceOf Promise deletion
2018-09-02 22:43:37 +02:00
Kamil Myśliwiec
5b804f5a35 tests(microservices) fix broken options unit tests 2018-09-02 22:42:05 +02:00
Kamil Myśliwiec
b348920d25 build(nestjs) update bundle, add opencollective 2018-09-02 22:31:39 +02:00
Kamil Myśliwiec
b6fe9b06cc refactor(microservices) remove unecessary options object 2018-09-02 22:31:11 +02:00
Kamil Myśliwiec
fde2041f17 sample(nestjs) update framework to 5.3.0 in all samples 2018-08-31 16:30:03 +02:00
Kamil Myśliwiec
7a4b0e64ad Merge branch '5.3.0' 2018-08-31 13:18:21 +02:00
Kamil Myśliwiec
afe9c4b5f4 sample(@nestjs) update auth and graphql sample 2018-08-31 13:18:02 +02:00
Kamil Myśliwiec
5e6694cb8b Merge pull request #1024 from nestjs/5.3.0
chore(nestjs) publish minor release 5.3.0
2018-08-31 13:09:39 +02:00
Kamil Myśliwiec
d20f6bb653 chore(nestjs) publish 5.3.0 minor release 2018-08-31 12:47:11 +02:00
Kamil Myśliwiec
e8032f37fc chore(@nestjs) publish v5.3.0 release 2018-08-31 12:46:22 +02:00
Kamil Myśliwiec
cae159e77c sample(@nestjs) update gateways and graphql sample 2018-08-31 12:24:50 +02:00
Kamil Myśliwiec
47812f5822 refactor(@nestsjs) replace underlying http server (express) 2018-08-31 12:24:29 +02:00
Kamil Myśliwiec
afa9903882 refactor(@nestjs/common) rename class serializer 2018-08-31 12:23:51 +02:00
Kamil Myśliwiec
a7d465bfa1 enhancement(@nestjs/core) injector improvements (circular dependencies) 2018-08-31 12:23:22 +02:00
Kamil Myśliwiec
95dfd59e4e sample(@nestjs) add class serializer sample 2018-08-27 16:58:39 +02:00
Kamil Myśliwiec
08e6278a77 sample(common) add cache module sample 2018-08-27 16:58:24 +02:00
Kamil Myśliwiec
fbf47a2825 feature(common) add class serializer interceptor 2018-08-27 16:57:46 +02:00
Kamil Myśliwiec
643e84c49a feature(common) cache module 2018-08-27 16:57:12 +02:00
Kamil Myśliwiec
25c7e8909e enhancement(common) add default options to MulterModule 2018-08-27 16:56:41 +02:00
Kamil Myśliwiec
0d5972c66b build(@nestjs) force compilation (new bundle) 2018-08-27 16:55:46 +02:00
Kamil Myśliwiec
394d7f23bf refactor(common) move multer module spec files 2018-08-27 12:25:29 +02:00
Kamil Myśliwiec
09d9c6597f refactor(common) move file interceptors to files module 2018-08-27 08:59:40 +02:00
Kamil Myśliwiec
1d8c8ee264 refactor(@nestjs) update dependencies 2018-08-27 08:59:15 +02:00
Kamil Myśliwiec
5a9d6d6d14 sample(nestjs) update auth sample 2018-08-27 00:01:57 +02:00
Kamil Myśliwiec
4d13ee8100 feature(common) add MulterModule 2018-08-27 00:00:51 +02:00
Kamil Myśliwiec
6b0ae0602c feature(websockets) support ack in socketio, enhancements 2018-08-26 23:59:30 +02:00
Kamil Myśliwiec
d0bd2f7b20 Update CONTRIBUTING.md 2018-08-26 23:59:10 +02:00
Jean-Baptiste Pionnier
5f965cf174 refactor: unnecessary instanceOf Promise deletion 2018-08-26 21:05:14 +02:00
Kamil Myśliwiec
504a10ce5e Merge branch 'master' of https://github.com/nestjs/nest 2018-08-25 15:48:03 +02:00
Kamil Myśliwiec
a9abd1c2ea sample(@nestjs) update graphql example, add integration test 2018-08-25 15:47:46 +02:00
Kamil Myśliwiec
e7e859adce Merge pull request #989 from BrunnerLivio/feature/add-im-a-teapot-exception
feature(@nestjs/common) add im a teapot exception
2018-08-25 14:44:08 +02:00
Kamil Myśliwiec
0c98a65e79 chore(@nestjs) publish 5.2.2 release 2018-08-24 12:43:03 +02:00
Livio Brunner
ba2eeeeac7 feature(@nestjs/common) add im a teapot exception
"It’s a reminder that the underlying
processes of computers
are still made by humans.
It'd be a real shame to see 418 go."
2018-08-21 13:43:50 +02:00
589 changed files with 35187 additions and 5743 deletions

View File

@@ -186,7 +186,7 @@ Samples: (even more [samples](https://github.com/nestjs/nest/commits/master))
docs(changelog) update change log to beta.5
```
```
bugfix(@nestjs/core) need to depend on latest rxjs and zone.js
bugfix(core) need to depend on latest rxjs and zone.js
The version in our package.json gets copied to the one we publish, and users need the latest of these.
```

View File

@@ -58,7 +58,8 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
#### Sponsors
<a href="https://scal.io"><img src="https://nestjs.com/img/scalio-logo.svg" width="110" /></a> &nbsp; <a href="http://angularity.io"><img src="http://angularity.io/media/logo.svg" height="30" /></a> &nbsp; <a href="http://gojob.com"><img src="https://gojob.com/w/wp-content/uploads/2017/02/cropped-Logo-web-home.png" height="40" /> &nbsp; <!--<a href="https://keycdn.com"><img src="https://nestjs.com/img/keycdn.svg" height="30" /></a> &nbsp;--> <a href="https://hostpresto.com"><img src="https://nestjs.com/img/hostpresto.png" height="30" /></a>
<a href="https://scal.io"><img src="https://nestjs.com/img/scalio-logo.svg" width="110" /></a> &nbsp; <a href="http://angularity.io"><img src="http://angularity.io/media/logo.svg" height="30" /></a> &nbsp; <a href="http://gojob.com"><img src="https://gojob.com/w/wp-content/uploads/2017/02/cropped-Logo-web-home.png" height="40" /> &nbsp; <!--<a href="https://keycdn.com"><img src="https://nestjs.com/img/keycdn.svg" height="30" /></a> &nbsp;--> <a href="https://hostpresto.com"><img src="https://nestjs.com/img/hostpresto.png" height="30" /></a> &nbsp; <a href="https://genuinebee.com/"><img src="https://nestjs.com/img/genuinebee.svg" height="34" /></a>
## Backers

48
benchmarks/all_output.txt Normal file
View File

@@ -0,0 +1,48 @@
-----------------------
express
-----------------------
Running 10s test @ http://localhost:3000
8 threads and 1024 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 47.78ms 19.09ms 212.47ms 66.94%
Req/Sec 1.31k 268.90 2.07k 72.38%
104687 requests in 10.02s, 21.47MB read
Socket errors: connect 0, read 877, write 0, timeout 0
Requests/sec: 10444.24
Transfer/sec: 2.14MB
-----------------------
fastify
-----------------------
Running 10s test @ http://localhost:3000
8 threads and 1024 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 21.80ms 8.73ms 78.12ms 55.78%
Req/Sec 2.99k 0.92k 5.67k 68.88%
238550 requests in 10.02s, 31.17MB read
Socket errors: connect 0, read 862, write 0, timeout 0
Requests/sec: 23795.79
Transfer/sec: 3.11MB
-----------------------
nest
-----------------------
Running 10s test @ http://localhost:3000
8 threads and 1024 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 54.00ms 22.33ms 200.25ms 62.23%
Req/Sec 1.15k 338.60 1.88k 66.12%
91348 requests in 10.05s, 18.82MB read
Socket errors: connect 0, read 983, write 0, timeout 0
Requests/sec: 9093.64
Transfer/sec: 1.87MB
-----------------------
nest-fastify
-----------------------
Running 10s test @ http://localhost:3000
8 threads and 1024 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 29.31ms 11.71ms 101.96ms 70.03%
Req/Sec 2.17k 0.93k 4.12k 63.13%
173241 requests in 10.05s, 22.80MB read
Socket errors: connect 0, read 934, write 0, timeout 0
Requests/sec: 17233.87
Transfer/sec: 2.27MB

7
benchmarks/express.js Normal file
View File

@@ -0,0 +1,7 @@
'use strict';
const express = require('express');
const app = express();
app.get('/', async (req, res) => res.send('Hello world'));
app.listen(3000);

5
benchmarks/fastify.js Normal file
View File

@@ -0,0 +1,5 @@
'use strict';
const fastify = require('fastify')();
fastify.get('/', async (req, reply) => reply.send('Hello world'));
fastify.listen(3000);

View File

@@ -0,0 +1,9 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const core_1 = require('@nestjs/core');
const app_module_1 = require('./nest/app.module');
core_1.NestFactory.create(app_module_1.AppModule, new core_1.FastifyAdapter(), {
logger: false,
bodyParser: false,
}).then(app => app.listen(3000));
//# sourceMappingURL=main.js.map

9
benchmarks/nest.js Normal file
View File

@@ -0,0 +1,9 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const core_1 = require('@nestjs/core');
const app_module_1 = require('./nest/app.module');
core_1.NestFactory.create(app_module_1.AppModule, {
logger: false,
bodyParser: false,
}).then(app => app.listen(3000));
//# sourceMappingURL=main.js.map

3
benchmarks/nest/app.controller.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
export declare class AppController {
root(): string;
}

View File

@@ -0,0 +1,28 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
const common_1 = require("@nestjs/common");
let AppController = class AppController {
root() {
return 'Hello world!';
}
};
__decorate([
common_1.Get(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", String)
], AppController.prototype, "root", null);
AppController = __decorate([
common_1.Controller()
], AppController);
exports.AppController = AppController;
//# sourceMappingURL=app.controller.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"app.controller.js","sourceRoot":"","sources":["../src/app.controller.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2CAAiD;AAGjD,IAAa,aAAa,GAA1B,MAAa,aAAa;IAExB,IAAI;QACF,OAAO,cAAc,CAAA;IACvB,CAAC;CACF,CAAA;AAHC;IADC,YAAG,EAAE;;;;yCAGL;AAJU,aAAa;IADzB,mBAAU,EAAE;GACA,aAAa,CAKzB;AALY,sCAAa"}

1
benchmarks/nest/app.module.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export declare class AppModule {}

View File

@@ -0,0 +1,20 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
const common_1 = require("@nestjs/common");
const app_controller_1 = require("./app.controller");
let AppModule = class AppModule {
};
AppModule = __decorate([
common_1.Module({
imports: [],
controllers: [app_controller_1.AppController],
})
], AppModule);
exports.AppModule = AppModule;
//# sourceMappingURL=app.module.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;AAAA,2CAAwC;AACxC,qDAAiD;AAMjD,IAAa,SAAS,GAAtB,MAAa,SAAS;CAAG,CAAA;AAAZ,SAAS;IAJrB,eAAM,CAAC;QACN,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,CAAC,8BAAa,CAAC;KAC7B,CAAC;GACW,SAAS,CAAG;AAAZ,8BAAS"}

1
benchmarks/nest/main.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1 @@
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,uCAA2C;AAC3C,6CAAyC;AAEzC,KAAK,UAAU,SAAS;IACtB,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAAC,sBAAS,CAAC,CAAC;IAChD,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AACD,SAAS,EAAE,CAAC"}

14
benchmarks/run.sh Normal file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
echo 'Library:' $1
node $1 &
pid=$!
sleep 2
wrk 'http://localhost:3000' \
-d 10 \
-c 1024 \
-t 8
kill $pid

23
benchmarks/run_all.sh Normal file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
: > all_output.txt
lib=(express fastify nest nest-fastify)
for item in ${lib[*]}
do
echo '-----------------------' >> all_output.txt
echo $item >> all_output.txt
echo '-----------------------' >> all_output.txt
node $item &
pid=$!
sleep 2
wrk 'http://localhost:3000' \
-d 10 \
-c 1024 \
-t 8 >> all_output.txt
kill $pid
done

View File

@@ -58,7 +58,8 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
#### Sponsors
<a href="https://scal.io"><img src="https://nestjs.com/img/scalio-logo.svg" width="110" /></a> &nbsp; <a href="http://angularity.io"><img src="http://angularity.io/media/logo.svg" height="30" /></a> &nbsp; <a href="http://gojob.com"><img src="https://gojob.com/w/wp-content/uploads/2017/02/cropped-Logo-web-home.png" height="40" /> &nbsp; <!--<a href="https://keycdn.com"><img src="https://nestjs.com/img/keycdn.svg" height="30" /></a> &nbsp;--> <a href="https://hostpresto.com"><img src="https://nestjs.com/img/hostpresto.png" height="30" /></a>
<a href="https://scal.io"><img src="https://nestjs.com/img/scalio-logo.svg" width="110" /></a> &nbsp; <a href="http://angularity.io"><img src="http://angularity.io/media/logo.svg" height="30" /></a> &nbsp; <a href="http://gojob.com"><img src="https://gojob.com/w/wp-content/uploads/2017/02/cropped-Logo-web-home.png" height="40" /> &nbsp; <!--<a href="https://keycdn.com"><img src="https://nestjs.com/img/keycdn.svg" height="30" /></a> &nbsp;--> <a href="https://hostpresto.com"><img src="https://nestjs.com/img/hostpresto.png" height="30" /></a> &nbsp; <a href="https://genuinebee.com/"><img src="https://nestjs.com/img/genuinebee.svg" height="34" /></a>
## Backers

View File

@@ -0,0 +1,3 @@
export declare const CACHE_MANAGER = "CACHE_MANAGER";
export declare const CACHE_MODULE_OPTIONS = "CACHE_MODULE_OPTIONS";
export declare const CACHE_KEY_METADATA = "cache_module:cache_key";

View File

@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CACHE_MANAGER = 'CACHE_MANAGER';
exports.CACHE_MODULE_OPTIONS = 'CACHE_MODULE_OPTIONS';
exports.CACHE_KEY_METADATA = 'cache_module:cache_key';

8
bundle/common/cache/cache.module.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
import { DynamicModule } from '../interfaces';
import { CacheModuleAsyncOptions, CacheModuleOptions } from './interfaces/cache-module.interface';
export declare class CacheModule {
static register(options?: CacheModuleOptions): DynamicModule;
static registerAsync(options: CacheModuleAsyncOptions): DynamicModule;
private static createAsyncProviders(options);
private static createAsyncOptionsProvider(options);
}

60
bundle/common/cache/cache.module.js vendored Normal file
View File

@@ -0,0 +1,60 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
const decorators_1 = require("../decorators");
const cache_constants_1 = require("./cache.constants");
const cache_providers_1 = require("./cache.providers");
let CacheModule = CacheModule_1 = class CacheModule {
static register(options = {}) {
return {
module: CacheModule_1,
providers: [{ provide: cache_constants_1.CACHE_MODULE_OPTIONS, useValue: options }],
};
}
static registerAsync(options) {
return {
module: CacheModule_1,
imports: options.imports,
providers: this.createAsyncProviders(options),
};
}
static createAsyncProviders(options) {
if (options.useExisting || options.useFactory) {
return [this.createAsyncOptionsProvider(options)];
}
return [
this.createAsyncOptionsProvider(options),
{
provide: options.useClass,
useClass: options.useClass,
},
];
}
static createAsyncOptionsProvider(options) {
if (options.useFactory) {
return {
provide: cache_constants_1.CACHE_MODULE_OPTIONS,
useFactory: options.useFactory,
inject: options.inject || [],
};
}
return {
provide: cache_constants_1.CACHE_MODULE_OPTIONS,
useFactory: async (optionsFactory) => await optionsFactory.createCacheOptions(),
inject: [options.useExisting || options.useClass],
};
}
};
CacheModule = CacheModule_1 = __decorate([
decorators_1.Module({
providers: [cache_providers_1.createCacheManager()],
exports: [cache_constants_1.CACHE_MANAGER],
})
], CacheModule);
exports.CacheModule = CacheModule;
var CacheModule_1;

View File

@@ -0,0 +1,2 @@
import { Provider } from '../interfaces';
export declare function createCacheManager(): Provider;

17
bundle/common/cache/cache.providers.js vendored Normal file
View File

@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const load_package_util_1 = require("../utils/load-package.util");
const cache_constants_1 = require("./cache.constants");
const default_options_1 = require("./default-options");
function createCacheManager() {
return {
provide: cache_constants_1.CACHE_MANAGER,
useFactory: (options) => {
const cacheManager = load_package_util_1.loadPackage('cache-manager', 'CacheModule');
const memoryCache = cacheManager.caching(Object.assign({}, default_options_1.defaultCacheOptions, (options || {})));
return memoryCache;
},
inject: [cache_constants_1.CACHE_MODULE_OPTIONS],
};
}
exports.createCacheManager = createCacheManager;

View File

@@ -0,0 +1 @@
export declare const CacheKey: (key: string) => (target: object, key?: any, descriptor?: any) => any;

View File

@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const decorators_1 = require("../../decorators");
const cache_constants_1 = require("../cache.constants");
exports.CacheKey = (key) => decorators_1.ReflectMetadata(cache_constants_1.CACHE_KEY_METADATA, key);

View File

@@ -0,0 +1 @@
export * from './cache-key.decorator';

View File

@@ -0,0 +1,6 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./cache-key.decorator"));

View File

@@ -0,0 +1,5 @@
export declare const defaultCacheOptions: {
ttl: number;
max: number;
store: string;
};

View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultCacheOptions = {
ttl: 5,
max: 100,
store: 'memory',
};

5
bundle/common/cache/index.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
export { CACHE_MANAGER } from './cache.constants';
export * from './cache.module';
export * from './decorators';
export * from './interceptors';
export * from './interfaces';

10
bundle/common/cache/index.js vendored Normal file
View File

@@ -0,0 +1,10 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
var cache_constants_1 = require("./cache.constants");
exports.CACHE_MANAGER = cache_constants_1.CACHE_MANAGER;
__export(require("./cache.module"));
__export(require("./decorators"));
__export(require("./interceptors"));

View File

@@ -0,0 +1,11 @@
import { Observable } from 'rxjs';
import { ExecutionContext, HttpServer, NestInterceptor } from '../../interfaces';
export declare class CacheInterceptor implements NestInterceptor {
protected readonly httpServer: HttpServer;
protected readonly cacheManager: any;
protected readonly reflector: any;
protected readonly isHttpApp: boolean;
constructor(httpServer: HttpServer, cacheManager: any, reflector: any);
intercept(context: ExecutionContext, call$: Observable<any>): Promise<Observable<any>>;
trackBy(context: ExecutionContext): string | undefined;
}

View File

@@ -0,0 +1,66 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
const rxjs_1 = require("rxjs");
const operators_1 = require("rxjs/operators");
const decorators_1 = require("../../decorators");
const cache_constants_1 = require("../cache.constants");
// NOTE (external)
// We need to deduplicate them here due to the circular dependency
// between core and common packages
const HTTP_SERVER_REF = 'HTTP_SERVER_REF';
const REFLECTOR = 'Reflector';
let CacheInterceptor = class CacheInterceptor {
constructor(httpServer, cacheManager, reflector) {
this.httpServer = httpServer;
this.cacheManager = cacheManager;
this.reflector = reflector;
this.isHttpApp = httpServer && !!httpServer.getRequestMethod;
}
async intercept(context, call$) {
const key = this.trackBy(context);
if (!key) {
return call$;
}
try {
const value = await this.cacheManager.get(key);
if (value) {
return rxjs_1.of(value);
}
return call$.pipe(operators_1.tap(response => this.cacheManager.set(key, response)));
}
catch (_a) {
return call$;
}
}
trackBy(context) {
if (!this.isHttpApp) {
return this.reflector.get(cache_constants_1.CACHE_KEY_METADATA, context.getHandler());
}
const request = context.getArgByIndex(0);
if (this.httpServer.getRequestMethod(request) !== 'GET') {
return undefined;
}
return this.httpServer.getRequestUrl(request);
}
};
CacheInterceptor = __decorate([
decorators_1.Injectable(),
__param(0, decorators_1.Optional()),
__param(0, decorators_1.Inject(HTTP_SERVER_REF)),
__param(1, decorators_1.Inject(cache_constants_1.CACHE_MANAGER)),
__param(2, decorators_1.Inject(REFLECTOR)),
__metadata("design:paramtypes", [Object, Object, Object])
], CacheInterceptor);
exports.CacheInterceptor = CacheInterceptor;

View File

@@ -0,0 +1 @@
export * from './cache.interceptor';

View File

@@ -0,0 +1,6 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./cache.interceptor"));

View File

@@ -0,0 +1,17 @@
export interface LiteralObject {
[key: string]: any;
}
export interface CacheStore {
set<T>(key: string, value: T): Promise<void> | void;
get<T>(key: string): Promise<void> | void;
del(key: string): void | Promise<void>;
}
export interface CacheStoreFactory {
create(args: LiteralObject): CacheStore;
}
export interface CacheManagerOptions {
store?: string | CacheStoreFactory;
ttl?: number;
max?: number;
isCacheableValue?: (value: any) => boolean;
}

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,14 @@
import { ModuleMetadata, Type } from '../../interfaces';
import { CacheManagerOptions } from './cache-manager.interface';
export interface CacheModuleOptions extends CacheManagerOptions {
[key: string]: any;
}
export interface CacheOptionsFactory {
createCacheOptions(): Promise<CacheModuleOptions> | CacheModuleOptions;
}
export interface CacheModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
useExisting?: Type<CacheOptionsFactory>;
useClass?: Type<CacheOptionsFactory>;
useFactory?: (...args: any[]) => Promise<CacheModuleOptions> | CacheModuleOptions;
inject?: any[];
}

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,2 @@
export * from './cache-manager.interface';
export * from './cache-module.interface';

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -1,4 +1,4 @@
export declare const metadata: {
export declare const METADATA: {
MODULES: string;
IMPORTS: string;
COMPONENTS: string;

View File

@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.metadata = {
exports.METADATA = {
MODULES: 'modules',
IMPORTS: 'imports',
COMPONENTS: 'components',

View File

@@ -1,6 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const deprecate = require("deprecate");
const uuid = require("uuid/v4");
/**
* Defines the injectable class. This class can inject dependencies through constructor.
* Those dependencies have to belong to the same module.
@@ -55,10 +56,9 @@ function Interceptor() {
return (target) => { };
}
exports.Interceptor = Interceptor;
let offset = Math.random() * 100;
function mixin(mixinClass) {
Object.defineProperty(mixinClass, 'name', {
value: JSON.stringify(offset++),
value: uuid(),
});
Injectable()(mixinClass);
return mixinClass;

View File

@@ -6,7 +6,7 @@ export declare type ParamDecoratorEnhancer = ParameterDecorator;
* Defines HTTP route param decorator
* @param factory
*/
export declare function createParamDecorator(factory: CustomParamFactory, enhancers?: ParamDecoratorEnhancer[]): (...dataOrPipes: (Type<PipeTransform> | PipeTransform | string)[]) => ParameterDecorator;
export declare function createParamDecorator(factory: CustomParamFactory, enhancers?: ParamDecoratorEnhancer[]): (...dataOrPipes: (Type<PipeTransform> | PipeTransform | any)[]) => ParameterDecorator;
/**
* Defines HTTP route param decorator
* @deprecated

View File

@@ -1,6 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const deprecate = require("deprecate");
const uuid = require("uuid/v4");
const constants_1 = require("../../constants");
const shared_utils_1 = require("../../utils/shared.utils");
const assignCustomMetadata = (args, paramtype, index, factory, data, ...pipes) => (Object.assign({}, args, { [`${paramtype}${constants_1.CUSTOM_ROUTE_AGRS_METADATA}:${index}`]: {
@@ -9,18 +10,17 @@ const assignCustomMetadata = (args, paramtype, index, factory, data, ...pipes) =
data,
pipes,
} }));
const randomString = () => Math.random()
.toString(36)
.substring(2, 15);
/**
* Defines HTTP route param decorator
* @param factory
*/
function createParamDecorator(factory, enhancers = []) {
const paramtype = randomString() + randomString();
const paramtype = uuid();
return (data, ...pipes) => (target, key, index) => {
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) || {};
const hasParamData = shared_utils_1.isNil(data) || shared_utils_1.isString(data);
const isPipe = pipe => pipe &&
((shared_utils_1.isFunction(pipe) && pipe.prototype) || shared_utils_1.isFunction(pipe.transform));
const hasParamData = shared_utils_1.isNil(data) || !isPipe(data);
const paramData = hasParamData ? data : undefined;
const paramPipes = hasParamData ? pipes : [data, ...pipes];
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignCustomMetadata(args, paramtype, index, factory, paramData, ...paramPipes), target.constructor, key);

View File

@@ -1,16 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("reflect-metadata");
const deprecate = require("deprecate");
require("reflect-metadata");
const constants_1 = require("../../constants");
const invalid_module_config_exception_1 = require("./exceptions/invalid-module-config.exception");
const metadataKeys = [
constants_1.metadata.MODULES,
constants_1.metadata.IMPORTS,
constants_1.metadata.EXPORTS,
constants_1.metadata.COMPONENTS,
constants_1.metadata.CONTROLLERS,
constants_1.metadata.PROVIDERS,
constants_1.METADATA.MODULES,
constants_1.METADATA.IMPORTS,
constants_1.METADATA.EXPORTS,
constants_1.METADATA.COMPONENTS,
constants_1.METADATA.CONTROLLERS,
constants_1.METADATA.PROVIDERS,
];
const validateKeys = (keys) => {
const isKeyInvalid = key => metadataKeys.findIndex(k => k === key) < 0;
@@ -54,8 +54,8 @@ function overrideModuleMetadata(moduleMetadata) {
: moduleMetadata.components;
}
function showDeprecatedWarnings(moduleMetadata) {
const modulesDeprecatedWarning = 'The "modules" key in the @Module() decorator is deprecated and will be removed within next major release. Use the "imports" key instead.';
const componentsDeprecatetWarning = 'The "components" key in the @Module() decorator is deprecated and will be removed within next major release. Use the "providers" key instead.';
moduleMetadata.modules && deprecate(modulesDeprecatedWarning);
moduleMetadata.components && deprecate(componentsDeprecatetWarning);
const MODULES_DEPRECATED_WARNING = 'The "modules" key in the @Module() decorator is deprecated and will be removed within next major release. Use the "imports" key instead.';
const COMPONENTS_DEPRECATED_WARNING = 'The "components" key in the @Module() decorator is deprecated and will be removed within next major release. Use the "providers" key instead.';
moduleMetadata.modules && deprecate(MODULES_DEPRECATED_WARNING);
moduleMetadata.components && deprecate(COMPONENTS_DEPRECATED_WARNING);
}

View File

@@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const http_exception_1 = require("./http.exception");
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_body_util_1 = require("./../utils/http-exception-body.util");
const http_exception_body_util_1 = require("../utils/http-exception-body.util");
class BadGatewayException extends http_exception_1.HttpException {
constructor(message, error = 'Bad Gateway') {
super(http_exception_body_util_1.createHttpExceptionBody(message, error, http_status_enum_1.HttpStatus.BAD_GATEWAY), http_status_enum_1.HttpStatus.BAD_GATEWAY);

View File

@@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const http_exception_1 = require("./http.exception");
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_body_util_1 = require("./../utils/http-exception-body.util");
const http_exception_body_util_1 = require("../utils/http-exception-body.util");
class BadRequestException extends http_exception_1.HttpException {
constructor(message, error = 'Bad Request') {
super(http_exception_body_util_1.createHttpExceptionBody(message, error, http_status_enum_1.HttpStatus.BAD_REQUEST), http_status_enum_1.HttpStatus.BAD_REQUEST);

View File

@@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const http_exception_1 = require("./http.exception");
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_body_util_1 = require("./../utils/http-exception-body.util");
const http_exception_body_util_1 = require("../utils/http-exception-body.util");
class ConflictException extends http_exception_1.HttpException {
constructor(message, error = 'Conflict') {
super(http_exception_body_util_1.createHttpExceptionBody(message, error, http_status_enum_1.HttpStatus.CONFLICT), http_status_enum_1.HttpStatus.CONFLICT);

View File

@@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const http_exception_1 = require("./http.exception");
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_body_util_1 = require("./../utils/http-exception-body.util");
const http_exception_body_util_1 = require("../utils/http-exception-body.util");
class ForbiddenException extends http_exception_1.HttpException {
constructor(message, error = 'Forbidden') {
super(http_exception_body_util_1.createHttpExceptionBody(message, error, http_status_enum_1.HttpStatus.FORBIDDEN), http_status_enum_1.HttpStatus.FORBIDDEN);

View File

@@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const http_exception_1 = require("./http.exception");
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_body_util_1 = require("./../utils/http-exception-body.util");
const http_exception_body_util_1 = require("../utils/http-exception-body.util");
class GatewayTimeoutException extends http_exception_1.HttpException {
constructor(message, error = 'Gateway Timeout') {
super(http_exception_body_util_1.createHttpExceptionBody(message, error, http_status_enum_1.HttpStatus.GATEWAY_TIMEOUT), http_status_enum_1.HttpStatus.GATEWAY_TIMEOUT);

View File

@@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const http_exception_1 = require("./http.exception");
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_body_util_1 = require("./../utils/http-exception-body.util");
const http_exception_body_util_1 = require("../utils/http-exception-body.util");
class GoneException extends http_exception_1.HttpException {
constructor(message, error = 'Gone') {
super(http_exception_body_util_1.createHttpExceptionBody(message, error, http_status_enum_1.HttpStatus.GONE), http_status_enum_1.HttpStatus.GONE);

View File

@@ -0,0 +1,10 @@
import { HttpException } from './http.exception';
/**
* Any attempt to brew coffee with a teapot should result in the error code "418 I'm a teapot".
* The resulting entity body MAY be short and stout.
*
* http://save418.com/
*/
export declare class ImATeapotException extends HttpException {
constructor(message?: string | object | any, error?: string);
}

View File

@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const http_exception_1 = require("./http.exception");
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_body_util_1 = require("../utils/http-exception-body.util");
/**
* Any attempt to brew coffee with a teapot should result in the error code "418 I'm a teapot".
* The resulting entity body MAY be short and stout.
*
* http://save418.com/
*/
class ImATeapotException extends http_exception_1.HttpException {
constructor(message, error = 'I\'m a teapot') {
super(http_exception_body_util_1.createHttpExceptionBody(message, error, http_status_enum_1.HttpStatus.I_AM_A_TEAPOT), http_status_enum_1.HttpStatus.I_AM_A_TEAPOT);
}
}
exports.ImATeapotException = ImATeapotException;

View File

@@ -16,3 +16,4 @@ export * from './not-implemented.exception';
export * from './bad-gateway.exception';
export * from './service-unavailable.exception';
export * from './gateway-timeout.exception';
export * from './im-a-teapot.exception';

View File

@@ -21,3 +21,4 @@ __export(require("./not-implemented.exception"));
__export(require("./bad-gateway.exception"));
__export(require("./service-unavailable.exception"));
__export(require("./gateway-timeout.exception"));
__export(require("./im-a-teapot.exception"));

View File

@@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const http_exception_1 = require("./http.exception");
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_body_util_1 = require("./../utils/http-exception-body.util");
const http_exception_body_util_1 = require("../utils/http-exception-body.util");
class InternalServerErrorException extends http_exception_1.HttpException {
constructor(message, error = 'Internal Server Error') {
super(http_exception_body_util_1.createHttpExceptionBody(message, error, http_status_enum_1.HttpStatus.INTERNAL_SERVER_ERROR), http_status_enum_1.HttpStatus.INTERNAL_SERVER_ERROR);

View File

@@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const http_exception_1 = require("./http.exception");
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_body_util_1 = require("./../utils/http-exception-body.util");
const http_exception_body_util_1 = require("../utils/http-exception-body.util");
class MethodNotAllowedException extends http_exception_1.HttpException {
constructor(message, error = 'Method Not Allowed') {
super(http_exception_body_util_1.createHttpExceptionBody(message, error, http_status_enum_1.HttpStatus.METHOD_NOT_ALLOWED), http_status_enum_1.HttpStatus.METHOD_NOT_ALLOWED);

View File

@@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const http_exception_1 = require("./http.exception");
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_body_util_1 = require("./../utils/http-exception-body.util");
const http_exception_body_util_1 = require("../utils/http-exception-body.util");
class NotAcceptableException extends http_exception_1.HttpException {
constructor(message, error = 'Not Acceptable') {
super(http_exception_body_util_1.createHttpExceptionBody(message, error, http_status_enum_1.HttpStatus.NOT_ACCEPTABLE), http_status_enum_1.HttpStatus.NOT_ACCEPTABLE);

View File

@@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const http_exception_1 = require("./http.exception");
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_body_util_1 = require("./../utils/http-exception-body.util");
const http_exception_body_util_1 = require("../utils/http-exception-body.util");
class NotFoundException extends http_exception_1.HttpException {
constructor(message, error = 'Not Found') {
super(http_exception_body_util_1.createHttpExceptionBody(message, error, http_status_enum_1.HttpStatus.NOT_FOUND), http_status_enum_1.HttpStatus.NOT_FOUND);

View File

@@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const http_exception_1 = require("./http.exception");
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_body_util_1 = require("./../utils/http-exception-body.util");
const http_exception_body_util_1 = require("../utils/http-exception-body.util");
class NotImplementedException extends http_exception_1.HttpException {
constructor(message, error = 'Not Implemented') {
super(http_exception_body_util_1.createHttpExceptionBody(message, error, http_status_enum_1.HttpStatus.NOT_IMPLEMENTED), http_status_enum_1.HttpStatus.NOT_IMPLEMENTED);

View File

@@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const http_exception_1 = require("./http.exception");
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_body_util_1 = require("./../utils/http-exception-body.util");
const http_exception_body_util_1 = require("../utils/http-exception-body.util");
class PayloadTooLargeException extends http_exception_1.HttpException {
constructor(message, error = 'Payload Too Large') {
super(http_exception_body_util_1.createHttpExceptionBody(message, error, http_status_enum_1.HttpStatus.PAYLOAD_TOO_LARGE), http_status_enum_1.HttpStatus.PAYLOAD_TOO_LARGE);

View File

@@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const http_exception_1 = require("./http.exception");
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_body_util_1 = require("./../utils/http-exception-body.util");
const http_exception_body_util_1 = require("../utils/http-exception-body.util");
class RequestTimeoutException extends http_exception_1.HttpException {
constructor(message, error = 'Request Timeout') {
super(http_exception_body_util_1.createHttpExceptionBody(message, error, http_status_enum_1.HttpStatus.REQUEST_TIMEOUT), http_status_enum_1.HttpStatus.REQUEST_TIMEOUT);

View File

@@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const http_exception_1 = require("./http.exception");
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_body_util_1 = require("./../utils/http-exception-body.util");
const http_exception_body_util_1 = require("../utils/http-exception-body.util");
class ServiceUnavailableException extends http_exception_1.HttpException {
constructor(message, error = 'Service Unavailable') {
super(http_exception_body_util_1.createHttpExceptionBody(message, error, http_status_enum_1.HttpStatus.SERVICE_UNAVAILABLE), http_status_enum_1.HttpStatus.SERVICE_UNAVAILABLE);

View File

@@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const http_exception_1 = require("./http.exception");
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_body_util_1 = require("./../utils/http-exception-body.util");
const http_exception_body_util_1 = require("../utils/http-exception-body.util");
class UnauthorizedException extends http_exception_1.HttpException {
constructor(message, error = 'Unauthorized') {
super(http_exception_body_util_1.createHttpExceptionBody(message, error, http_status_enum_1.HttpStatus.UNAUTHORIZED), http_status_enum_1.HttpStatus.UNAUTHORIZED);

View File

@@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const http_exception_1 = require("./http.exception");
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_body_util_1 = require("./../utils/http-exception-body.util");
const http_exception_body_util_1 = require("../utils/http-exception-body.util");
class UnprocessableEntityException extends http_exception_1.HttpException {
constructor(message, error = 'Unprocessable Entity') {
super(http_exception_body_util_1.createHttpExceptionBody(message, error, http_status_enum_1.HttpStatus.UNPROCESSABLE_ENTITY), http_status_enum_1.HttpStatus.UNPROCESSABLE_ENTITY);

View File

@@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const http_exception_1 = require("./http.exception");
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_body_util_1 = require("./../utils/http-exception-body.util");
const http_exception_body_util_1 = require("../utils/http-exception-body.util");
class UnsupportedMediaTypeException extends http_exception_1.HttpException {
constructor(message, error = 'Unsupported Media Type') {
super(http_exception_body_util_1.createHttpExceptionBody(message, error, http_status_enum_1.HttpStatus.UNSUPPORTED_MEDIA_TYPE), http_status_enum_1.HttpStatus.UNSUPPORTED_MEDIA_TYPE);

View File

@@ -0,0 +1 @@
export declare const MULTER_MODULE_OPTIONS = "MULTER_MODULE_OPTIONS";

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MULTER_MODULE_OPTIONS = 'MULTER_MODULE_OPTIONS';

3
bundle/common/files/index.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
export * from './interceptors';
export * from './interfaces';
export * from './multer.module';

View File

@@ -0,0 +1,7 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./interceptors"));
__export(require("./multer.module"));

View File

@@ -0,0 +1,2 @@
import { MulterField, MulterOptions } from '../../interfaces/external/multer-options.interface';
export declare function FileFieldsInterceptor(uploadFields: MulterField[], localOptions?: MulterOptions): any;

View File

@@ -0,0 +1,45 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
const multer = require("multer");
const decorators_1 = require("../../decorators");
const component_decorator_1 = require("../../decorators/core/component.decorator");
const files_constants_1 = require("../files.constants");
const multer_utils_1 = require("../multer/multer.utils");
function FileFieldsInterceptor(uploadFields, localOptions) {
let MixinInterceptor = class MixinInterceptor {
constructor(options = {}) {
this.upload = multer(Object.assign({}, options, localOptions));
}
async intercept(context, call$) {
const ctx = context.switchToHttp();
await new Promise((resolve, reject) => this.upload.fields(uploadFields)(ctx.getRequest(), ctx.getResponse(), err => {
if (err) {
const error = multer_utils_1.transformException(err);
return reject(error);
}
resolve();
}));
return call$;
}
};
MixinInterceptor = __decorate([
__param(0, decorators_1.Optional()),
__param(0, decorators_1.Inject(files_constants_1.MULTER_MODULE_OPTIONS)),
__metadata("design:paramtypes", [Object])
], MixinInterceptor);
const Interceptor = component_decorator_1.mixin(MixinInterceptor);
return Interceptor;
}
exports.FileFieldsInterceptor = FileFieldsInterceptor;

View File

@@ -0,0 +1,2 @@
import { MulterOptions } from '../../interfaces/external/multer-options.interface';
export declare function FileInterceptor(fieldName: string, localOptions?: MulterOptions): any;

View File

@@ -0,0 +1,45 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
const multer = require("multer");
const decorators_1 = require("../../decorators");
const component_decorator_1 = require("../../decorators/core/component.decorator");
const files_constants_1 = require("../files.constants");
const multer_utils_1 = require("../multer/multer.utils");
function FileInterceptor(fieldName, localOptions) {
let MixinInterceptor = class MixinInterceptor {
constructor(options = {}) {
this.upload = multer(Object.assign({}, options, localOptions));
}
async intercept(context, call$) {
const ctx = context.switchToHttp();
await new Promise((resolve, reject) => this.upload.single(fieldName)(ctx.getRequest(), ctx.getResponse(), err => {
if (err) {
const error = multer_utils_1.transformException(err);
return reject(error);
}
resolve();
}));
return call$;
}
};
MixinInterceptor = __decorate([
__param(0, decorators_1.Optional()),
__param(0, decorators_1.Inject(files_constants_1.MULTER_MODULE_OPTIONS)),
__metadata("design:paramtypes", [Object])
], MixinInterceptor);
const Interceptor = component_decorator_1.mixin(MixinInterceptor);
return Interceptor;
}
exports.FileInterceptor = FileInterceptor;

View File

@@ -0,0 +1,2 @@
import { MulterOptions } from '../../interfaces/external/multer-options.interface';
export declare function FilesInterceptor(fieldName: string, maxCount?: number, localOptions?: MulterOptions): any;

View File

@@ -0,0 +1,45 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
const multer = require("multer");
const decorators_1 = require("../../decorators");
const component_decorator_1 = require("../../decorators/core/component.decorator");
const files_constants_1 = require("../files.constants");
const multer_utils_1 = require("../multer/multer.utils");
function FilesInterceptor(fieldName, maxCount, localOptions) {
let MixinInterceptor = class MixinInterceptor {
constructor(options = {}) {
this.upload = multer(Object.assign({}, options, localOptions));
}
async intercept(context, call$) {
const ctx = context.switchToHttp();
await new Promise((resolve, reject) => this.upload.array(fieldName, maxCount)(ctx.getRequest(), ctx.getResponse(), err => {
if (err) {
const error = multer_utils_1.transformException(err);
return reject(error);
}
resolve();
}));
return call$;
}
};
MixinInterceptor = __decorate([
__param(0, decorators_1.Optional()),
__param(0, decorators_1.Inject(files_constants_1.MULTER_MODULE_OPTIONS)),
__metadata("design:paramtypes", [Object])
], MixinInterceptor);
const Interceptor = component_decorator_1.mixin(MixinInterceptor);
return Interceptor;
}
exports.FilesInterceptor = FilesInterceptor;

View File

@@ -0,0 +1,8 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./file-fields.interceptor"));
__export(require("./file.interceptor"));
__export(require("./files.interceptor"));

View File

@@ -0,0 +1,13 @@
import { ModuleMetadata, Type } from '@nestjs/common/interfaces';
import { MulterOptions } from '../../interfaces/external/multer-options.interface';
export interface MulterModuleOptions extends MulterOptions {
}
export interface MulterOptionsFactory {
createMulterOptions(): Promise<MulterModuleOptions> | MulterModuleOptions;
}
export interface MulterModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
useExisting?: Type<MulterOptionsFactory>;
useClass?: Type<MulterOptionsFactory>;
useFactory?: (...args: any[]) => Promise<MulterModuleOptions> | MulterModuleOptions;
inject?: any[];
}

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1 @@
export * from './files-upload-module.interface';

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,8 @@
import { DynamicModule } from '@nestjs/common';
import { MulterModuleAsyncOptions, MulterModuleOptions } from './interfaces/files-upload-module.interface';
export declare class MulterModule {
static register(options?: MulterModuleOptions): DynamicModule;
static registerAsync(options: MulterModuleAsyncOptions): DynamicModule;
private static createAsyncProviders(options);
private static createAsyncOptionsProvider(options);
}

View File

@@ -0,0 +1,58 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
const common_1 = require("@nestjs/common");
const files_constants_1 = require("./files.constants");
let MulterModule = MulterModule_1 = class MulterModule {
static register(options = {}) {
return {
module: MulterModule_1,
providers: [{ provide: files_constants_1.MULTER_MODULE_OPTIONS, useValue: options }],
exports: [files_constants_1.MULTER_MODULE_OPTIONS],
};
}
static registerAsync(options) {
return {
module: MulterModule_1,
imports: options.imports,
providers: this.createAsyncProviders(options),
exports: [files_constants_1.MULTER_MODULE_OPTIONS],
};
}
static createAsyncProviders(options) {
if (options.useExisting || options.useFactory) {
return [this.createAsyncOptionsProvider(options)];
}
return [
this.createAsyncOptionsProvider(options),
{
provide: options.useClass,
useClass: options.useClass,
},
];
}
static createAsyncOptionsProvider(options) {
if (options.useFactory) {
return {
provide: files_constants_1.MULTER_MODULE_OPTIONS,
useFactory: options.useFactory,
inject: options.inject || [],
};
}
return {
provide: files_constants_1.MULTER_MODULE_OPTIONS,
useFactory: async (optionsFactory) => await optionsFactory.createMulterOptions(),
inject: [options.useExisting || options.useClass],
};
}
};
MulterModule = MulterModule_1 = __decorate([
common_1.Module({})
], MulterModule);
exports.MulterModule = MulterModule;
var MulterModule_1;

View File

@@ -0,0 +1,9 @@
export declare const multerExceptions: {
LIMIT_PART_COUNT: string;
LIMIT_FILE_SIZE: string;
LIMIT_FILE_COUNT: string;
LIMIT_FIELD_KEY: string;
LIMIT_FIELD_VALUE: string;
LIMIT_FIELD_COUNT: string;
LIMIT_UNEXPECTED_FILE: string;
};

View File

@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.multerExceptions = {
LIMIT_PART_COUNT: 'Too many parts',
LIMIT_FILE_SIZE: 'File too large',
LIMIT_FILE_COUNT: 'Too many files',
LIMIT_FIELD_KEY: 'Field name too long',
LIMIT_FIELD_VALUE: 'Field value too long',
LIMIT_FIELD_COUNT: 'Too many fields',
LIMIT_UNEXPECTED_FILE: 'Unexpected field',
};

View File

@@ -0,0 +1,2 @@
import { BadRequestException, PayloadTooLargeException } from '../../exceptions';
export declare function transformException(error: Error | undefined): Error | BadRequestException | PayloadTooLargeException;

View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const exceptions_1 = require("../../exceptions");
const multer_constants_1 = require("./multer.constants");
function transformException(error) {
if (!error || error instanceof exceptions_1.HttpException) {
return error;
}
switch (error.message) {
case multer_constants_1.multerExceptions.LIMIT_FILE_SIZE:
return new exceptions_1.PayloadTooLargeException(error.message);
case multer_constants_1.multerExceptions.LIMIT_FILE_COUNT:
case multer_constants_1.multerExceptions.LIMIT_FIELD_KEY:
case multer_constants_1.multerExceptions.LIMIT_FIELD_VALUE:
case multer_constants_1.multerExceptions.LIMIT_FIELD_COUNT:
case multer_constants_1.multerExceptions.LIMIT_UNEXPECTED_FILE:
case multer_constants_1.multerExceptions.LIMIT_PART_COUNT:
return new exceptions_1.BadRequestException(error.message);
}
return error;
}
exports.transformException = transformException;

View File

@@ -1 +1,2 @@
export declare const AXIOS_INSTANCE_TOKEN = "AXIOS_INSTANCE_TOKEN";
export declare const HTTP_MODULE_ID = "HTTP_MODULE_ID";

View File

@@ -1,3 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AXIOS_INSTANCE_TOKEN = 'AXIOS_INSTANCE_TOKEN';
exports.HTTP_MODULE_ID = 'HTTP_MODULE_ID';

View File

@@ -8,25 +8,35 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
Object.defineProperty(exports, "__esModule", { value: true });
const axios_1 = require("axios");
const module_decorator_1 = require("../decorators/modules/module.decorator");
const random_string_generator_util_1 = require("../utils/random-string-generator.util");
const http_constants_1 = require("./http.constants");
const http_service_1 = require("./http.service");
let HttpModule = HttpModule_1 = class HttpModule {
static register(config) {
return {
module: HttpModule_1,
providers: [{
providers: [
{
provide: http_constants_1.AXIOS_INSTANCE_TOKEN,
useValue: axios_1.default.create(config),
}],
},
{
provide: http_constants_1.HTTP_MODULE_ID,
useValue: random_string_generator_util_1.randomStringGenerator(),
},
],
};
}
};
HttpModule = HttpModule_1 = __decorate([
module_decorator_1.Module({
providers: [http_service_1.HttpService, {
providers: [
http_service_1.HttpService,
{
provide: http_constants_1.AXIOS_INSTANCE_TOKEN,
useValue: axios_1.default,
}],
},
],
exports: [http_service_1.HttpService],
})
], HttpModule);

View File

@@ -1,9 +1,11 @@
export * from './cache';
export * from './decorators';
export * from './enums';
export * from './exceptions';
export * from './files';
export * from './http';
export * from './interceptors';
export { ArgumentMetadata, ArgumentsHost, CanActivate, DynamicModule, ExceptionFilter, ExecutionContext, ForwardReference, HttpServer, HttpServerFactory, INestApplication, INestApplicationContext, INestExpressApplication, INestFastifyApplication, INestMicroservice, MiddlewareConsumer, MiddlewareFunction, NestInterceptor, NestMiddleware, NestModule, OnModuleDestroy, OnModuleInit, Paramtype, PipeTransform, Provider, RpcExceptionFilter, Type, WebSocketAdapter, WsExceptionFilter } from './interfaces';
export { ArgumentMetadata, ArgumentsHost, CanActivate, DynamicModule, ExceptionFilter, ExecutionContext, ForwardReference, HttpServer, HttpServerFactory, INestApplication, INestApplicationContext, INestExpressApplication, INestFastifyApplication, INestMicroservice, MiddlewareConsumer, MiddlewareFunction, NestInterceptor, NestMiddleware, NestModule, OnApplicationBootstrap, OnModuleDestroy, OnModuleInit, Paramtype, PipeTransform, Provider, RpcExceptionFilter, Type, WebSocketAdapter, WsExceptionFilter } from './interfaces';
export * from './pipes';
export * from './serializer';
export * from './services/logger.service';
export * from './utils';

View File

@@ -9,11 +9,13 @@ function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./cache"));
__export(require("./decorators"));
__export(require("./enums"));
__export(require("./exceptions"));
__export(require("./files"));
__export(require("./http"));
__export(require("./interceptors"));
__export(require("./pipes"));
__export(require("./serializer"));
__export(require("./services/logger.service"));
__export(require("./utils"));

View File

@@ -1,4 +1,4 @@
import { ArgumentsHost } from './../features/arguments-host.interface';
import { ArgumentsHost } from '../features/arguments-host.interface';
export interface ExceptionFilter<T = any> {
catch(exception: T, host: ArgumentsHost): any;
}

View File

@@ -1,5 +1,5 @@
import { Observable } from 'rxjs';
import { ArgumentsHost } from './../features/arguments-host.interface';
import { ArgumentsHost } from '../features/arguments-host.interface';
export interface RpcExceptionFilter<T = any, R = any> {
catch(exception: T, host: ArgumentsHost): Observable<R>;
}

View File

@@ -1,4 +1,4 @@
import { ArgumentsHost } from './../features/arguments-host.interface';
import { ArgumentsHost } from '../features/arguments-host.interface';
export interface WsExceptionFilter<T = any> {
catch(exception: T, host: ArgumentsHost): any;
}

View File

@@ -0,0 +1,41 @@
/**
* Options to be passed during transformation.
* @see https://github.com/typestack/class-transformer
*/
export interface ClassTransformOptions {
/**
* Exclusion strategy. By default exposeAll is used, which means that it will expose all properties are transformed
* by default.
*/
strategy?: 'excludeAll' | 'exposeAll';
/**
* Only properties with given groups gonna be transformed.
*/
groups?: string[];
/**
* Only properties with "since" > version < "until" gonna be transformed.
*/
version?: number;
/**
* Excludes properties with the given prefixes. For example, if you mark your private properties with "_" and "__"
* you can set this option's value to ["_", "__"] and all private properties will be skipped.
* This works only for "exposeAll" strategy.
*/
excludePrefixes?: string[];
/**
* If set to true then class transformer will ignore all @Expose and @Exclude decorators and what inside them.
* This option is useful if you want to kinda clone your object but do not apply decorators affects.
*/
ignoreDecorators?: boolean;
/**
* Target maps allows to set a Types of the transforming object without using @Type decorator.
* This is useful when you are transforming external classes, or if you already have type metadata for
* objects and you don't want to set it up again.
*/
targetMaps?: any[];
/**
* If set to true then class transformer will perform a circular check. (circular check is turned off by default)
* This option is useful when you know for sure that your types might have a circular dependency.
*/
enableCircularCheck?: boolean;
}

Some files were not shown because too many files have changed in this diff Show More