@nestia/core 1.0.9 → 1.0.10

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.
Files changed (39) hide show
  1. package/README.md +20 -277
  2. package/lib/decorators/DynamicModule.d.ts +20 -1
  3. package/lib/decorators/DynamicModule.js +22 -3
  4. package/lib/decorators/DynamicModule.js.map +1 -1
  5. package/lib/decorators/EncryptedBody.d.ts +8 -7
  6. package/lib/decorators/EncryptedBody.js +8 -7
  7. package/lib/decorators/EncryptedBody.js.map +1 -1
  8. package/lib/decorators/EncryptedRoute.d.ts +7 -8
  9. package/lib/decorators/EncryptedRoute.js +9 -9
  10. package/lib/decorators/EncryptedRoute.js.map +1 -1
  11. package/lib/decorators/TypedBody.d.ts +8 -6
  12. package/lib/decorators/TypedBody.js +8 -6
  13. package/lib/decorators/TypedBody.js.map +1 -1
  14. package/lib/decorators/TypedParam.d.ts +5 -5
  15. package/lib/decorators/TypedParam.js +5 -5
  16. package/lib/decorators/TypedQuery.d.ts +14 -1
  17. package/lib/decorators/TypedQuery.js +18 -1
  18. package/lib/decorators/TypedQuery.js.map +1 -1
  19. package/lib/decorators/TypedRoute.d.ts +5 -5
  20. package/lib/decorators/TypedRoute.js +5 -5
  21. package/lib/decorators/TypedRoute.js.map +1 -1
  22. package/lib/decorators/internal/TransformError.d.ts +1 -0
  23. package/lib/decorators/internal/TransformError.js +11 -0
  24. package/lib/decorators/internal/TransformError.js.map +1 -0
  25. package/lib/decorators/internal/get_path_and_stringify.js +2 -1
  26. package/lib/decorators/internal/get_path_and_stringify.js.map +1 -1
  27. package/lib/decorators/internal/validate_request_body.js +2 -1
  28. package/lib/decorators/internal/validate_request_body.js.map +1 -1
  29. package/package.json +2 -1
  30. package/src/decorators/DynamicModule.ts +21 -2
  31. package/src/decorators/EncryptedBody.ts +12 -8
  32. package/src/decorators/EncryptedRoute.ts +10 -11
  33. package/src/decorators/TypedBody.ts +9 -6
  34. package/src/decorators/TypedParam.ts +6 -6
  35. package/src/decorators/TypedQuery.ts +22 -3
  36. package/src/decorators/TypedRoute.ts +6 -5
  37. package/src/decorators/internal/TransformError.ts +8 -0
  38. package/src/decorators/internal/get_path_and_stringify.ts +3 -4
  39. package/src/decorators/internal/validate_request_body.ts +3 -4
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Nestia Core
1
+ # Nestia Core Library
2
2
  [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)
3
3
  [![npm version](https://img.shields.io/npm/v/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)
4
4
  [![Downloads](https://img.shields.io/npm/dm/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)
@@ -81,60 +81,6 @@ npx @nestia/core setup --project tsconfig.test.json
81
81
  ### Manual Setup
82
82
  If you want to install and configure `@nestia/core` manually, read [Guide Documents - Setup](https://github.com/samchon/nestia/wiki/Setup).
83
83
 
84
- <!-- ### NPM Packages
85
- If you want to install and configure manually, install `@nestia/core` module first.
86
-
87
- Also, you need additional devDependencies to compile the TypeScript code with transformation. Therefore, install those all libraries `typescript`, `ttypescript` and `ts-node`. Inform that, `ttypescript` is not mis-writing. Do not forget to install the `ttypescript`.
88
-
89
- ```bash
90
- npm install --save @nestia/core
91
-
92
- # ENSURE THOSE PACKAGES ARE INSTALLED
93
- npm install --save-dev typescript
94
- npm install --save-dev ttypescript
95
- npm install --save-dev ts-node
96
- ```
97
-
98
- ### `tsconfig.json`
99
- After the installation, you've to configure `tsconfig.json` file like below.
100
-
101
- Add a property transform and its value as `@nestia/core/lib/transform` into `compilerOptions.plugins` array. Also, do same thing on `typia/lib/transform` value. When configuring, I recommend you to use the strict option, to enforce developers to distinguish whether each property is nullable or undefindable.
102
-
103
- ```json
104
- {
105
- "compilerOptions": {
106
- "strict": true,
107
- "plugins": [
108
- {
109
- "transform": "@nestia/core/lib/transform",
110
- // "validate": "assert", // "assert" | "is" | "validate"
111
- // "stringify": "is", // null | "stringify" | "assert" | "is" | "validate"
112
- },
113
- { "transform": "typia/lib/transform" }
114
- ]
115
- }
116
- }
117
- ```
118
-
119
- Also, you can configure additional properties like `validate` and `stringify`.
120
-
121
- Through the `validate` property, you can specialize which validation algorithm of [typia](https://github.com/samchon/typia) to be used. Default is `assert` function and if you choose `is` function instead, the validation speed would be extremely faster, but any reason why would be provided when wrong typed data comes. Otherwise you select `validate` function, its validation speed would be slower, but most detailed reasons would be provided.
122
-
123
- By specializing `stringify` property, you can specialize which JSON stringify function of [typia](https://github.com/samchon/typia) would be used. Default is `assert`, but if choose `null` instead, it would be replaced to `JSON.stringify()` function. Otherwise you configure it as `stringify`, fastest logic would be used, but unexpected behavior would be happend when wrong typed data comes.
124
-
125
- ```typescript
126
- // RUNTIME VALIDATORS
127
- export function is<T>(input: unknown | T): boolean; // returns boolean
128
- export function assert<T>(input: unknown | T): T; // throws TypeGuardError
129
- export function validate<T>(input: unknown | T): IValidation<T>; // detailed
130
-
131
- // FAST STRINGIFY FUNCTIONS
132
- export function stringify<T>(input: T): string; // unsafe, but very fast
133
- export function assertStringify<T>(input: T): string; // assert + stringify
134
- export function isStringify<T>(input: T): string | null; // is + stringify
135
- export function validateStringify<T>(input: T): IValidation<T>; // validate +
136
- ``` -->
137
-
138
84
 
139
85
 
140
86
 
@@ -153,229 +99,26 @@ export class BbsArticlesController {
153
99
  * @param inupt Content to store
154
100
  * @returns Newly archived article
155
101
  */
156
- @TypedRoute.Post() // 10x faster and safer JSON.stringify()
102
+ @TypedRoute.Put(":id") // 10x faster and safer JSON.stringify()
157
103
  public async store(
158
- @TypedBody() input: IBbsArticle.IStore // supoer-fast validator
159
- ): Promise<IBbsArticle>;
104
+ @TypedParam("section", "string") section: string,
105
+ @TypedParam("id", "uuid") id: string,
106
+ @TypedBody() input: IBbsArticle.IUpdate // super-fast validator
107
+ ): Promise<IBbsArticle.IContent>;
160
108
  }
161
109
  ```
162
110
 
163
- ### TypedBody
164
- `TypedBody()` is a decorator function of `application/json` typed request body.
165
-
166
- Also, it supports super-fast validation pipe, which is maximum **15,000x times faster** then `nest.Body()` function using `class-validator`.
167
-
168
- ### TypedRoute
169
- `TypedRoute` is a set of decorator functions for `application/json` typed response body.
170
-
171
- Also, it supports safe and fast JSON stringify function pipe, which is maximum 10x times faster than native `JSON.stringify()` function. Furthermore, it is **type safe** through validation.
172
-
173
- - `TypedRoute.Get()`
174
- - `TypedRoute.Post()`
175
- - `TypedRoute.Put()`
176
- - `TypedRoute.Patch()`
177
- - `TypedRoute.Delete()`
178
-
179
- ### TypedQuery
180
- `TypedQuery` is a decorator function for `URLSearchParams` of `path`.
181
-
182
- Also, it supports automatic type casting for property types and super-fast validation pipe.
183
-
184
- ```typescript
185
- interface SomeSearchParams {
186
- page: number; // automatic casting
187
- limit?: number; // does not allow null, but undefined does
188
-
189
- extension?: string; // only atomic or constant typed properties
190
- status: "alive" | "erased" | "both"; // properties are allowed
191
- }
192
-
193
- @Controller("some-path")
194
- export class SomeController {
195
- @TypedRoute.Get()
196
- public async index(
197
- // automatic type casting and validation
198
- @TypedQuery() query: SomeSearchParams
199
- ): Promise<SomeEntity[]>;
200
- }
201
- ```
202
-
203
- ### Encryption
204
- `@nestia/core` supports special decorator functions `EncryptedBody` and `EncryptedRout`. They're almost same with [TypedBody](#typedbody) and [TypedRoute](#typedroute), but there's only one thing different - it encrypts JSON data through AES-128/256 algorithm.
205
-
206
- - AES-128/256
207
- - CBC mode
208
- - PKCS #5 Padding
209
- - Base64 Encoding
210
-
211
- ### Comment Tags
212
- You can enhance DTO type validation by writing comment tags.
213
-
214
- If you want to know about it detaily, visit [Guide Documents of typia](https://github.com/samchon/typia/wiki/Runtime-Validators#comment-tags).
215
-
216
- ```typescript
217
- export interface IBbsArticle {
218
- /**
219
- * @format uuid
220
- */
221
- id: string;
222
-
223
- writer: IBbsArticle.IWriter;
224
-
225
- /**
226
- * @minItems 1
227
- */
228
- contents: IBbsArticle.IContent[];
229
- }
230
- export namespace IBbsArticle {
231
- export interface IWriter {
232
- /**
233
- * @minLength 3
234
- */
235
- name: string;
236
-
237
- /**
238
- * @format email
239
- */
240
- email: string;
241
-
242
- /**
243
- * @pattern ^0[0-9]{7,16}
244
- */
245
- mobile: string;
246
-
247
- /**
248
- * @minimum 18
249
- */
250
- age: number;
251
- }
252
- }
253
- ```
254
-
255
-
256
-
257
-
258
- ## Appendix
259
- ### Nestia SDK
260
- ```bash
261
- npx nestia swagger
262
- npx nestia sdk
263
- ```
264
-
265
- Automatic *SDK* and *Swagger* generator for `@nestia/core`.
266
-
267
- With `@nestia/core`, you can boost up validation speed maximum **15,000x times faster**. However, as `@nestjs/swagger` does not support `@nestia/core`, you can't generate swagger documents from `@nestjs/swagger` more.
268
-
269
- Instead, I provide you `@nestia/sdk` module, which can generate not only swagger documents, but also SDK (Software Development Kit) library.
270
-
271
- #### `BbsArticlesController.ts`
272
- ```typescript
273
- import { Controller } from "@nestjs/common";
274
- import { TypedBody, TypedRoute } from "@nestia/core";
275
-
276
- import { IBbsArticle } from "@bbs-api/structures/IBbsArticle";
277
-
278
- @Controller("bbs/articles")
279
- export class BbsArticlesController {
280
- /**
281
- * Store a new article.
282
- *
283
- * @param input content to store
284
- * @returns new article
285
- */
286
- @TypedRoute.Post()
287
- public async store(
288
- @TypedBody() input: IBbsArticle.IStore
289
- ): Promise<IBbsArticle>;
290
- }
291
- ```
292
-
293
- #### `src/functional/bbs/articles/index.ts`
294
- ```typescript
295
- import { Fetcher, IConnection } from "@nestia/fetcher";
296
- import { IBbsArticle } from "../../../structures/IBbsArticle";
297
-
298
- /**
299
- * Store a new content.
300
- *
301
- * @param input content to store
302
- * @returns new article
303
- */
304
- export function store(
305
- connection: api.IConnection,
306
- input: IBbsArticle.IStore
307
- ): Promise<IBbsArticle> {
308
- return Fetcher.fetch(
309
- connection,
310
- store.ENCRYPTED,
311
- store.METHOD,
312
- store.path(),
313
- input
314
- );
315
- }
316
- export namespace store {
317
- export const METHOD = "POST" as const;
318
- export function path(): string {
319
- return "/bbs/articles";
320
- }
321
- }
322
- ```
323
-
324
- #### SDK utilization code
325
- ```typescript
326
- import api from "@bbs-api";
327
- import typia from "typia";
328
-
329
- export async function test_bbs_article_store(connection: api.IConnection) {
330
- const article: IBbsArticle = await api.functional.bbs.articles.store(
331
- connection,
332
- {
333
- name: "John Doe",
334
- title: "some title",
335
- content: "some content",
336
- }
337
- );
338
- typia.assert(article);
339
- console.log(article);
340
- }
341
- ```
342
-
343
- ### Typia
344
- > https://github.com/samchon/typia
345
- >
346
- > `@nestia/core` is wrapping `typia` and the `typia` is:
347
-
348
- [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/typia/blob/master/LICENSE)
349
- [![npm version](https://img.shields.io/npm/v/typia.svg)](https://www.npmjs.com/package/typia)
350
- [![Downloads](https://img.shields.io/npm/dm/typia.svg)](https://www.npmjs.com/package/typia)
351
- [![Build Status](https://github.com/samchon/typia/workflows/build/badge.svg)](https://github.com/samchon/typia/actions?query=workflow%3Abuild)
352
- [![Guide Documents](https://img.shields.io/badge/wiki-documentation-forestgreen)](https://github.com/samchon/typia/wiki)
353
-
354
- ```typescript
355
- // RUNTIME VALIDATORS
356
- export function is<T>(input: unknown | T): input is T; // returns boolean
357
- export function assert<T>(input: unknown | T): T; // throws TypeGuardError
358
- export function validate<T>(input: unknown | T): IValidation<T>; // detailed
359
-
360
- // STRICT VALIDATORS
361
- export function equals<T>(input: unknown | T): input is T;
362
- export function assertEquals<T>(input: unknown | T): T;
363
- export function validateEquals<T>(input: unknown | T): IValidation<T>;
364
-
365
- // JSON
366
- export function application<T>(): IJsonApplication; // JSON schema
367
- export function assertParse<T>(input: string): T; // type safe parser
368
- export function assertStringify<T>(input: T): string; // safe and faster
369
- // +) isParse, validateParse
370
- // +) stringify, isStringify, validateStringify
371
- ```
372
-
373
- `typia` is a transformer library of TypeScript, supporting below features:
374
-
375
- - Super-fast Runtime Validators
376
- - Safe JSON parse and fast stringify functions
377
- - JSON schema generator
378
-
379
- All functions in `typia` require **only one line**. You don't need any extra dedication like JSON schema definitions or decorator function calls. Just call `typia` function with only one line like `typia.assert<T>(input)`.
380
-
381
- Also, as `typia` performs AOT (Ahead of Time) compilation skill, its performance is much faster than other competitive libaries. For an example, when comparing validate function `is()` with other competitive libraries, `typia` is maximum **15,000x times faster** than `class-validator`.
111
+ About detailed features, read [Guide Documents](https://github.com/samchon/nestia/wiki)
112
+
113
+ - Decorators
114
+ - [TypedRoute](https://github.com/samchon/nestia/wiki/Core-Library#typedroute)
115
+ - [TypedBody](https://github.com/samchon/nestia/wiki/Core-Library#typedbody)
116
+ - [TypedQuery](https://github.com/samchon/nestia/wiki/Core-Library#typedquery)
117
+ - [TypedParam](https://github.com/samchon/nestia/wiki/Core-Library#typedparam)
118
+ - Enhancements
119
+ - [Comment Tags](https://github.com/samchon/nestia/wiki/Core-Library#comment-tags)
120
+ - [Configuration](https://github.com/samchon/nestia/wiki/Core-Library#configuration)
121
+ - Advanced Usage
122
+ - [DynamicModule](https://github.com/samchon/nestia/wiki/Core-Library#dynamicmodule)
123
+ - [Encryption](https://github.com/samchon/nestia/wiki/Core-Library#encryption)
124
+ - [Inheritance](https://github.com/samchon/nestia/wiki/Core-Library#inheritance)
@@ -1,4 +1,23 @@
1
1
  import { ModuleMetadata } from "@nestjs/common/interfaces";
2
+ /**
3
+ * Dynamic module.
4
+ *
5
+ * `DynamicModule` is a namespace wrapping a convenient function, which can load
6
+ * controller classes dynamically just by specifying their directory path.
7
+ *
8
+ * @author Jeongho Nam - https://github.com/samchon
9
+ */
2
10
  export declare namespace DynamicModule {
3
- function mount(path: string, options?: Omit<ModuleMetadata, "controllers">): Promise<object>;
11
+ /**
12
+ * Mount dynamic module.
13
+ *
14
+ * Constructs a module instance with directory path of controller classes.
15
+ *
16
+ * Every controller classes in the target directory would be dynamically mounted.
17
+ *
18
+ * @param path Path of controllers
19
+ * @param metadata Addtional metadata except controllers
20
+ * @returns module instance
21
+ */
22
+ function mount(path: string, metadata?: Omit<ModuleMetadata, "controllers">): Promise<object>;
4
23
  }
@@ -56,10 +56,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
56
56
  exports.DynamicModule = void 0;
57
57
  var common_1 = require("@nestjs/common");
58
58
  var load_controller_1 = require("./internal/load_controller");
59
+ /**
60
+ * Dynamic module.
61
+ *
62
+ * `DynamicModule` is a namespace wrapping a convenient function, which can load
63
+ * controller classes dynamically just by specifying their directory path.
64
+ *
65
+ * @author Jeongho Nam - https://github.com/samchon
66
+ */
59
67
  var DynamicModule;
60
68
  (function (DynamicModule) {
61
- function mount(path, options) {
62
- if (options === void 0) { options = {}; }
69
+ /**
70
+ * Mount dynamic module.
71
+ *
72
+ * Constructs a module instance with directory path of controller classes.
73
+ *
74
+ * Every controller classes in the target directory would be dynamically mounted.
75
+ *
76
+ * @param path Path of controllers
77
+ * @param metadata Addtional metadata except controllers
78
+ * @returns module instance
79
+ */
80
+ function mount(path, metadata) {
81
+ if (metadata === void 0) { metadata = {}; }
63
82
  return __awaiter(this, void 0, void 0, function () {
64
83
  var controllers, NestiaModule;
65
84
  return __generator(this, function (_a) {
@@ -71,7 +90,7 @@ var DynamicModule;
71
90
  function NestiaModule() {
72
91
  }
73
92
  NestiaModule = __decorate([
74
- (0, common_1.Module)(__assign(__assign({}, options), { controllers: controllers }))
93
+ (0, common_1.Module)(__assign(__assign({}, metadata), { controllers: controllers }))
75
94
  ], NestiaModule);
76
95
  return NestiaModule;
77
96
  }());
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicModule.js","sourceRoot":"","sources":["../../src/decorators/DynamicModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAwC;AAIxC,8DAA8D;AAE9D,IAAiB,aAAa,CAa7B;AAbD,WAAiB,aAAa;IAC1B,SAAsB,KAAK,CACvB,IAAY,EACZ,OAAiD;QAAjD,wBAAA,EAAA,YAAiD;;;;;4BAGV,qBAAM,IAAA,kCAAgB,EAAC,IAAI,CAAC,EAAA;;wBAA7D,WAAW,GAAsB,SAA4B;;4BAInE;4BAAoB,CAAC;4BAAf,YAAY;gCADjB,IAAA,eAAM,wBAAM,OAAO,KAAE,WAAW,aAAA,IAAG;+BAC9B,YAAY,CAAG;4BAAD,mBAAC;yBAAA,AAArB;wBACA,sBAAO,YAAY,EAAC;;;;KACvB;IAXqB,mBAAK,QAW1B,CAAA;AACL,CAAC,EAbgB,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAa7B"}
1
+ {"version":3,"file":"DynamicModule.js","sourceRoot":"","sources":["../../src/decorators/DynamicModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAwC;AAIxC,8DAA8D;AAE9D;;;;;;;GAOG;AACH,IAAiB,aAAa,CAwB7B;AAxBD,WAAiB,aAAa;IAC1B;;;;;;;;;;OAUG;IACH,SAAsB,KAAK,CACvB,IAAY,EACZ,QAAkD;QAAlD,yBAAA,EAAA,aAAkD;;;;;4BAGX,qBAAM,IAAA,kCAAgB,EAAC,IAAI,CAAC,EAAA;;wBAA7D,WAAW,GAAsB,SAA4B;;4BAInE;4BAAoB,CAAC;4BAAf,YAAY;gCADjB,IAAA,eAAM,wBAAM,QAAQ,KAAE,WAAW,aAAA,IAAG;+BAC/B,YAAY,CAAG;4BAAD,mBAAC;yBAAA,AAArB;wBACA,sBAAO,YAAY,EAAC;;;;KACvB;IAXqB,mBAAK,QAW1B,CAAA;AACL,CAAC,EAxBgB,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAwB7B"}
@@ -2,14 +2,15 @@ import { IRequestBodyValidator } from "../options/IRequestBodyValidator";
2
2
  /**
3
3
  * Encrypted body decorator.
4
4
  *
5
- * `EncryptedBody` is a decorator function getting JSON data from HTTP request who've
6
- * been encrypted by AES-128/256 algorithm. Also, `EncyrptedBody` validates the JSON
7
- * data type through
8
- * [`typia.assert()`](https://github.com/samchon/typia#runtime-type-checkers)
9
- * function and throws `BadRequestException` error (status code: 400), if the JSON
10
- * data is not following the promised type.
5
+ * `EncryptedBody` is a decorator function getting `application/json` typed data from
6
+ * requeset body which has been encrypted by AES-128/256 algorithm. Also,
7
+ * `EncyrptedBody` validates the request body data type through
8
+ * [typia](https://github.com/samchon/typia) ad the validation speed is
9
+ * maximum 15,000x times faster than `class-validator`.
11
10
  *
12
- * For reference, `EncryptedRoute` decrypts request body usnig those options.
11
+ * For reference, when the request body data is not following the promised type `T`,
12
+ * `BadRequestException` error (status code: 400) would be thrown. Also,
13
+ * `EncryptedRoute` decrypts request body usnig those options.
13
14
  *
14
15
  * - AES-128/256
15
16
  * - CBC mode
@@ -51,14 +51,15 @@ var validate_request_body_1 = require("./internal/validate_request_body");
51
51
  /**
52
52
  * Encrypted body decorator.
53
53
  *
54
- * `EncryptedBody` is a decorator function getting JSON data from HTTP request who've
55
- * been encrypted by AES-128/256 algorithm. Also, `EncyrptedBody` validates the JSON
56
- * data type through
57
- * [`typia.assert()`](https://github.com/samchon/typia#runtime-type-checkers)
58
- * function and throws `BadRequestException` error (status code: 400), if the JSON
59
- * data is not following the promised type.
54
+ * `EncryptedBody` is a decorator function getting `application/json` typed data from
55
+ * requeset body which has been encrypted by AES-128/256 algorithm. Also,
56
+ * `EncyrptedBody` validates the request body data type through
57
+ * [typia](https://github.com/samchon/typia) ad the validation speed is
58
+ * maximum 15,000x times faster than `class-validator`.
60
59
  *
61
- * For reference, `EncryptedRoute` decrypts request body usnig those options.
60
+ * For reference, when the request body data is not following the promised type `T`,
61
+ * `BadRequestException` error (status code: 400) would be thrown. Also,
62
+ * `EncryptedRoute` decrypts request body usnig those options.
62
63
  *
63
64
  * - AES-128/256
64
65
  * - CBC mode
@@ -1 +1 @@
1
- {"version":3,"file":"EncryptedBody.js","sourceRoot":"","sources":["../../src/decorators/EncryptedBody.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;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O,CAAC,GAAG,EAAE,EAAE,IAAI,MAAA,EAAE,EAAE,IAAI,CAAC;gCAC3D,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;wBAGtB,IAAI,GAAQ,IAAI,CAAC,KAAK,CACxB,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC,CAC7D,CAAC;wBACF,OAAO,CAAC,IAAI,CAAC,CAAC;wBACd,sBAAO,IAAI,EAAC;;;;KACf,CAAC,EAAE,CAAC;AACT,CAAC;AAjDD,sCAiDC;AACD,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,cAAM,CAAC,CAAC;AACrC,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,UAAE,CAAC,CAAC;AACjC,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,gBAAQ,CAAC,CAAC;AAEvC;;GAEG;AACH,SAAS,OAAO,CAAC,IAAY,EAAE,GAAW,EAAE,EAAU;IAClD,IAAI;QACA,OAAO,kBAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;KAC1C;IAAC,OAAO,GAAG,EAAE;QACV,IAAI,GAAG,YAAY,KAAK;YACpB,MAAM,IAAI,4BAAmB,CACzB,qFAAqF,CACxF,CAAC;;YACD,MAAM,GAAG,CAAC;KAClB;AACL,CAAC"}
@@ -3,21 +3,20 @@ import { IResponseBodyStringifier } from "../options/IResponseBodyStringifier";
3
3
  * Encrypted router decorator functions.
4
4
  *
5
5
  * `EncryptedRoute` is a module containing router decorator functions which encrypts
6
- * response body data through AES-128/250 encryption. Also, those decorator functions
7
- * can boost up JSON string conversion speed about 5x times faster, through
8
- * [`typia.stringify()`](https://github.com/samchon/typia#fastest-json-string-conversion).
6
+ * response body data through AES-128/250 encryption. Furthermore, they can boost
7
+ * up JSON string conversion speed about 10x times faster, even type safe through
8
+ * [typia](https://github.com/samchon/typia).
9
9
  *
10
- * For reference, `EncryptedRoute` encrypts response body usnig those options.
10
+ * For reference, router functions of `EncryptedRoute` can convert custom error classes
11
+ * to regular {@link nest.HttpException} class automatically, through
12
+ * {@link ExceptionManager}. Also, `EncryptedRoute` encrypts response body usnig those
13
+ * options.
11
14
  *
12
15
  * - AES-128/256
13
16
  * - CBC mode
14
17
  * - PKCS #5 Padding
15
18
  * - Base64 Encoding
16
19
  *
17
- * Also, router functions in `EncryptedRoute` can convert custom error classes to the
18
- * regular {@link nest.HttpException} class automatically, through
19
- * {@link ExceptionManager}.
20
- *
21
20
  * @author Jeongho Nam - https://github.com/samchon
22
21
  */
23
22
  export declare namespace EncryptedRoute {
@@ -44,6 +44,7 @@ var rxjs_1 = require("rxjs");
44
44
  var typia_1 = require("typia");
45
45
  var Singleton_1 = require("../utils/Singleton");
46
46
  var EncryptedConstant_1 = require("./internal/EncryptedConstant");
47
+ var TransformError_1 = require("./internal/TransformError");
47
48
  var get_path_and_stringify_1 = require("./internal/get_path_and_stringify");
48
49
  var headers_to_object_1 = require("./internal/headers_to_object");
49
50
  var route_error_1 = require("./internal/route_error");
@@ -51,21 +52,20 @@ var route_error_1 = require("./internal/route_error");
51
52
  * Encrypted router decorator functions.
52
53
  *
53
54
  * `EncryptedRoute` is a module containing router decorator functions which encrypts
54
- * response body data through AES-128/250 encryption. Also, those decorator functions
55
- * can boost up JSON string conversion speed about 5x times faster, through
56
- * [`typia.stringify()`](https://github.com/samchon/typia#fastest-json-string-conversion).
55
+ * response body data through AES-128/250 encryption. Furthermore, they can boost
56
+ * up JSON string conversion speed about 10x times faster, even type safe through
57
+ * [typia](https://github.com/samchon/typia).
57
58
  *
58
- * For reference, `EncryptedRoute` encrypts response body usnig those options.
59
+ * For reference, router functions of `EncryptedRoute` can convert custom error classes
60
+ * to regular {@link nest.HttpException} class automatically, through
61
+ * {@link ExceptionManager}. Also, `EncryptedRoute` encrypts response body usnig those
62
+ * options.
59
63
  *
60
64
  * - AES-128/256
61
65
  * - CBC mode
62
66
  * - PKCS #5 Padding
63
67
  * - Base64 Encoding
64
68
  *
65
- * Also, router functions in `EncryptedRoute` can convert custom error classes to the
66
- * regular {@link nest.HttpException} class automatically, through
67
- * {@link ExceptionManager}.
68
- *
69
69
  * @author Jeongho Nam - https://github.com/samchon
70
70
  */
71
71
  var EncryptedRoute;
@@ -179,7 +179,7 @@ var EncryptedRouteInterceptor = /** @class */ (function () {
179
179
  return next.handle().pipe((0, rxjs_1.map)(function (value) {
180
180
  var param = Reflect.getMetadata(EncryptedConstant_1.ENCRYPTION_METADATA_KEY, context.getClass());
181
181
  if (!param)
182
- throw new Error("Error on nestia.core.EncryptedRoute.".concat(_this.method, "(): no encryption password is given."));
182
+ throw (0, TransformError_1.TransformError)("EncryptedRoute.".concat(_this.method));
183
183
  var headers = new Singleton_1.Singleton(function () {
184
184
  var request = http.getRequest();
185
185
  return (0, headers_to_object_1.headers_to_object)(request.headers);
@@ -1 +1 @@
1
- {"version":3,"file":"EncryptedRoute.js","sourceRoot":"","sources":["../../src/decorators/EncryptedRoute.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAgE;AAChE,yCAWwB;AAGxB,6BAAmD;AACnD,+BAKe;AAGf,gDAA+C;AAC/C,kEAAuE;AACvE,4EAA2E;AAC3E,kEAAiE;AACjE,sDAAqD;AAErD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,IAAiB,cAAc,CAgE9B;AAhED,WAAiB,cAAc;IAC3B;;;;;OAKG;IACU,kBAAG,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAEpC;;;;;OAKG;IACU,mBAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAEtC;;;;;OAKG;IACU,oBAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAExC;;;;;OAKG;IACU,kBAAG,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAEpC;;;;;O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C,GAAG,EAAE,EAAE,IAAI,MAAA,EAAE,EAChC,KAAK,CACR;oBACH,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAE5B,IAAM,QAAQ,GAAqB,IAAI,CAAC,WAAW,EAAE,CAAC;YACtD,QAAQ,CAAC,MAAM,CACX,cAAc,EACd,QAAQ,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,YAAY,CAC/C,CAAC;YAEF,IAAI,QAAQ,KAAK,IAAI;gBAAE,OAAO,IAAI,CAAC;iBAC9B,IAAI,IAAI,KAAK,SAAS;gBAAE,OAAO,IAAI,CAAC;YACzC,OAAO,kBAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC7D,CAAC,CAAC,EACF,IAAA,iBAAU,EAAC,UAAC,GAAG,IAAK,OAAA,IAAA,yBAAW,EAAC,IAAI,CAAC,UAAU,EAAE,EAAE,GAAG,CAAC,EAAnC,CAAmC,CAAC,CAC3D,CAAC;IACN,CAAC;IACL,gCAAC;AAAD,CAAC,AAxDD,IAwDC;AAED;;GAEG;AACH,IAAM,OAAO,GAAG;IACZ,GAAG,cAAA;IACH,IAAI,eAAA;IACJ,GAAG,cAAA;IACH,KAAK,gBAAA;IACL,MAAM,iBAAA;CACT,CAAC"}
@@ -1,12 +1,14 @@
1
1
  import { IRequestBodyValidator } from "../options/IRequestBodyValidator";
2
2
  /**
3
- * Safe body decorator.
3
+ * Type safe body decorator.
4
4
  *
5
- * `TypedBody` is a decorator function getting JSON data from HTTP request. Also,
6
- * it validates the JSON data type through
7
- * [`typia.assert()`](https://github.com/samchon/typia#runtime-type-checkers)
8
- * function and throws `BadRequestException` error (status code: 400), if the JSON
9
- * data is not following the promised type.
5
+ * `TypedBody` is a decoratur function getting `application/json` typed data from
6
+ * request body. Also, it validates the request body data type through
7
+ * [typia](https://github.com/samchon/typia) and the validation speed is
8
+ * maximum 15,000x times faster than `class-validator`.
9
+ *
10
+ * For reference, when the request body data is not following the promised type `T`,
11
+ * `BadRequestException` error (status code: 400) would be thrown.
10
12
  *
11
13
  * @param validator Custom validator if required. Default is `typia.assert()`
12
14
  * @author Jeongho Nam - https://github.com/samchon
@@ -45,13 +45,15 @@ var raw_body_1 = __importDefault(require("raw-body"));
45
45
  var typia_1 = require("typia");
46
46
  var validate_request_body_1 = require("./internal/validate_request_body");
47
47
  /**
48
- * Safe body decorator.
48
+ * Type safe body decorator.
49
49
  *
50
- * `TypedBody` is a decorator function getting JSON data from HTTP request. Also,
51
- * it validates the JSON data type through
52
- * [`typia.assert()`](https://github.com/samchon/typia#runtime-type-checkers)
53
- * function and throws `BadRequestException` error (status code: 400), if the JSON
54
- * data is not following the promised type.
50
+ * `TypedBody` is a decoratur function getting `application/json` typed data from
51
+ * request body. Also, it validates the request body data type through
52
+ * [typia](https://github.com/samchon/typia) and the validation speed is
53
+ * maximum 15,000x times faster than `class-validator`.
54
+ *
55
+ * For reference, when the request body data is not following the promised type `T`,
56
+ * `BadRequestException` error (status code: 400) would be thrown.
55
57
  *
56
58
  * @param validator Custom validator if required. Default is `typia.assert()`
57
59
  * @author Jeongho Nam - https://github.com/samchon
@@ -1 +1 @@
1
- {"version":3,"file":"TypedBody.js","sourceRoot":"","sources":["../../src/decorators/TypedBody.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAIwB;AAExB,sDAA2B;AAC3B,+BAA6C;AAG7C,0EAAyE;AAEzE;;;;;;;;;;;GAWG;AACH,SAAgB,SAAS,CACrB,SAAoC;IAEpC,IAAM,OAAO,GAAG,IAAA,6CAAqB,EAAC,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC;IAC9D,OAAO,IAAA,6BAAoB,EAAC,SAAe,SAAS,CAChD,QAAa,EACb,OAAyB;;;;;;wBAEnB,OAAO,GAAoB,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC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AC,kBAAkB,CAAC,EAAE;4BACjC,MAAM,IAAI,4BAAmB,CACzB,2CAA2C,CAC9C,CAAC;yBACL;6BACiB,OAAO,CAAC,IAAI,EAAZ,wBAAY;wBACxB,KAAA,OAAO,CAAC,IAAI,CAAA;;;wBACZ,KAAA,CAAA,KAAA,IAAI,CAAA,CAAC,KAAK,CAAA;wBAAE,qBAAM,IAAA,kBAAG,EAAC,OAAO,EAAE,MAAM,CAAC,EAAA;;wBAAtC,KAAA,cAAW,CAAC,SAA0B,CAAC,CAAC,IAAI,EAAE,EAAC,CAAA;;;wBAF/C,IAAI,KAE2C;wBACrD,OAAO,CAAC,IAAI,CAAC,CAAC;wBACd,sBAAO,IAAI,EAAC;;;;KACf,CAAC,EAAE,CAAC;AACT,CAAC;AApBD,8BAoBC;AAED,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,cAAM,CAAC,CAAC;AACjC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,UAAE,CAAC,CAAC;AAC7B,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,gBAAQ,CAAC,CAAC"}
@@ -1,10 +1,10 @@
1
1
  /**
2
- * URL parameter decorator with type.
2
+ * Type safe URL parameter decorator.
3
3
  *
4
- * `TypedParam` is a decorator function getting specific typed parameter from the HTTP
5
- * request URL. It's almost same with the {@link nest.Param}, but `TypedParam` can specify
6
- * the parameter type manually. Beside, the {@link nest.Param} always parses all of the
7
- * parameters as string type.
4
+ * `TypedParam` is a decorator function getting specific typed parameter from the
5
+ * HTTP request URL. It's almost same with the {@link nest.Param}, but `TypedParam`
6
+ * can specify the parameter type manually. Beside, the {@link nest.Param} always
7
+ * parses all of the parameters as string type.
8
8
  *
9
9
  * ```typescript
10
10
  * \@TypedRoute.Get("shopping/sales/:section/:id/:paused")
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TypedParam = void 0;
4
4
  var common_1 = require("@nestjs/common");
5
5
  /**
6
- * URL parameter decorator with type.
6
+ * Type safe URL parameter decorator.
7
7
  *
8
- * `TypedParam` is a decorator function getting specific typed parameter from the HTTP
9
- * request URL. It's almost same with the {@link nest.Param}, but `TypedParam` can specify
10
- * the parameter type manually. Beside, the {@link nest.Param} always parses all of the
11
- * parameters as string type.
8
+ * `TypedParam` is a decorator function getting specific typed parameter from the
9
+ * HTTP request URL. It's almost same with the {@link nest.Param}, but `TypedParam`
10
+ * can specify the parameter type manually. Beside, the {@link nest.Param} always
11
+ * parses all of the parameters as string type.
12
12
  *
13
13
  * ```typescript
14
14
  * \@TypedRoute.Get("shopping/sales/:section/:id/:paused")
@@ -1 +1,14 @@
1
- export declare function TypedQuery(decoder?: (params: URLSearchParams) => any): ParameterDecorator;
1
+ /**
2
+ * Type safe URL query decorator.
3
+ *
4
+ * `TypedQuery` is a decorator function that can parse URL query string. It is almost
5
+ * same with {@link nest.Query}, but it can automatically cast property type following
6
+ * its DTO definition. Also, `TypedQuery` performs type validation.
7
+ *
8
+ * For referecen, when URL query parameters are different with their promised
9
+ * type `T`, `BadRequestException` error (status code: 400) would be thrown.
10
+ *
11
+ * @returns Parameter decorator
12
+ * @author Jeongho Nam - https://github.com/samchon
13
+ */
14
+ export declare function TypedQuery<T>(decoder?: (params: URLSearchParams) => T): ParameterDecorator;
@@ -39,9 +39,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.TypedQuery = void 0;
40
40
  var common_1 = require("@nestjs/common");
41
41
  var typia_1 = require("typia");
42
+ var TransformError_1 = require("./internal/TransformError");
43
+ /**
44
+ * Type safe URL query decorator.
45
+ *
46
+ * `TypedQuery` is a decorator function that can parse URL query string. It is almost
47
+ * same with {@link nest.Query}, but it can automatically cast property type following
48
+ * its DTO definition. Also, `TypedQuery` performs type validation.
49
+ *
50
+ * For referecen, when URL query parameters are different with their promised
51
+ * type `T`, `BadRequestException` error (status code: 400) would be thrown.
52
+ *
53
+ * @returns Parameter decorator
54
+ * @author Jeongho Nam - https://github.com/samchon
55
+ */
42
56
  function TypedQuery(decoder) {
43
57
  if (decoder === undefined)
44
- throw new Error("Error on TypedQuery(): no decoder function provided.");
58
+ throw (0, TransformError_1.TransformError)("TypedQuery");
45
59
  return (0, common_1.createParamDecorator)(function TypedQuery(_unknown, ctx) {
46
60
  return __awaiter(this, void 0, void 0, function () {
47
61
  var request, params;
@@ -76,6 +90,9 @@ exports.TypedQuery = TypedQuery;
76
90
  TypedQuery.string = string;
77
91
  })(TypedQuery = exports.TypedQuery || (exports.TypedQuery = {}));
78
92
  Object.assign(TypedQuery, typia_1.assert);
93
+ /**
94
+ * @internal
95
+ */
79
96
  function tail(url) {
80
97
  var index = url.indexOf("?");
81
98
  return index === -1 ? "" : url.substring(index + 1);
@@ -1 +1 @@
1
- {"version":3,"file":"TypedQuery.js","sourceRoot":"","sources":["../../src/decorators/TypedQuery.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAwE;AAGxE,+BAA+B;AAE/B,SAAgB,UAAU,CAAC,OAA0C;IACjE,IAAI,OAAO,KAAK,SAAS;QACrB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAE5E,OAAO,IAAA,6BAAoB,EAAC,SAAe,UAAU,CACjD,QAAa,EACb,GAAqB;;;;gBAEf,OAAO,GAAoB,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;gBAC3D,MAAM,GAAoB,IAAI,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;gBACvE,sBAAO,OAAO,CAAC,MAAM,CAAC,EAAC;;;KAC1B,CAAC,EAAE,CAAC;AACT,CAAC;AAZD,gCAYC;AAED;;GAEG;AACH,WAAiB,UAAU;IACvB,SAAgB,OAAO,CAAC,GAAkB;QACtC,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACnD,CAAC;IAF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C,GAAG,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AACxD,CAAC"}
@@ -1,13 +1,13 @@
1
1
  import { IResponseBodyStringifier } from "../options/IResponseBodyStringifier";
2
2
  /**
3
- * Safe router decorator functions.
3
+ * Type safe router decorator functions.
4
4
  *
5
5
  * `TypedRoute` is a module containing router decorator functions which can boost up
6
- * JSON string conversion speed about 5x times faster, through
7
- * [`typia.stringify()`](https://github.com/samchon/typia#fastest-json-string-conversion).
6
+ * JSON string conversion speed about 10x times faster. Furthermore, such JSON string
7
+ * conversion is even type safe through [typia](https://github.com/samchon/typia).
8
8
  *
9
- * Also, router functions in `TypedRoute` can convert custom error classes to the
10
- * regular {@link nest.HttpException} class automatically, through
9
+ * For reference, router functions of `TypedRoute` can convert custom error classes to
10
+ * the regular {@link nest.HttpException} class automatically, through
11
11
  * {@link ExceptionManager}.
12
12
  *
13
13
  * @author Jeongho Nam - https://github.com/samchon
@@ -44,14 +44,14 @@ var typia_1 = require("typia");
44
44
  var get_path_and_stringify_1 = require("./internal/get_path_and_stringify");
45
45
  var route_error_1 = require("./internal/route_error");
46
46
  /**
47
- * Safe router decorator functions.
47
+ * Type safe router decorator functions.
48
48
  *
49
49
  * `TypedRoute` is a module containing router decorator functions which can boost up
50
- * JSON string conversion speed about 5x times faster, through
51
- * [`typia.stringify()`](https://github.com/samchon/typia#fastest-json-string-conversion).
50
+ * JSON string conversion speed about 10x times faster. Furthermore, such JSON string
51
+ * conversion is even type safe through [typia](https://github.com/samchon/typia).
52
52
  *
53
- * Also, router functions in `TypedRoute` can convert custom error classes to the
54
- * regular {@link nest.HttpException} class automatically, through
53
+ * For reference, router functions of `TypedRoute` can convert custom error classes to
54
+ * the regular {@link nest.HttpException} class automatically, through
55
55
  * {@link ExceptionManager}.
56
56
  *
57
57
  * @author Jeongho Nam - https://github.com/samchon
@@ -1 +1 @@
1
- {"version":3,"file":"TypedRoute.js","sourceRoot":"","sources":["../../src/decorators/TypedRoute.ts"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AC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TransformError = void 0;
4
+ /**
5
+ * @internal
6
+ */
7
+ function TransformError(method) {
8
+ return new Error("Error on nestia.core.".concat(method, "(): no transform has been configured. Configure \"tsconfig.json\" file following [Guide Documents](https://github.com/samchon/nestia/wiki/Setup#tsconfigjson)."));
9
+ }
10
+ exports.TransformError = TransformError;
11
+ //# sourceMappingURL=TransformError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransformError.js","sourceRoot":"","sources":["../../../src/decorators/internal/TransformError.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,SAAgB,cAAc,CAAC,MAAc;IACzC,OAAO,IAAI,KAAK,CACZ,+BAAwB,MAAM,mKAA8J,CAC/L,CAAC;AACN,CAAC;AAJD,wCAIC"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.get_path_and_stringify = void 0;
4
4
  var common_1 = require("@nestjs/common");
5
5
  var typia_1 = require("typia");
6
+ var TransformError_1 = require("./TransformError");
6
7
  var get_path_and_stringify = function (method) {
7
8
  return function () {
8
9
  var args = [];
@@ -22,7 +23,7 @@ exports.get_path_and_stringify = get_path_and_stringify;
22
23
  var take = function (method) {
23
24
  return function (functor) {
24
25
  if (functor === undefined)
25
- throw new Error("Error on nestia.core.".concat(method, "(): no stringify function provided."));
26
+ throw (0, TransformError_1.TransformError)(method);
26
27
  else if (functor === null)
27
28
  return JSON.stringify;
28
29
  else if (functor.type === "stringify")
@@ -1 +1 @@
1
- {"version":3,"file":"get_path_and_stringify.js","sourceRoot":"","sources":["../../../src/decorators/internal/get_path_and_stringify.ts"],"names":[],"mappings":";;;AAAA,yCAA8D;AAC9D,+BAAoD;AAI7C,IAAM,sBAAsB,GAC/B,UAAC,MAAc;IACf,OAAA;QACI,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAA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AAC;AAbD,CAaC,CAAC;AAEN,IAAM,MAAM,GACR,UAAI,OAA4B;IAChC,OAAA,UAAC,IAAO;QACJ,IAAI;YACA,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;SACxB;QAAC,OAAO,GAAG,EAAE;YACV,IAAI,GAAG,YAAY,sBAAc,EAAE;gBAC/B,MAAM,IAAI,qCAA4B,CAAC;oBACnC,IAAI,EAAE,GAAG,CAAC,IAAI;oBACd,MAAM,EAAE,GAAG,CAAC,OAAO;oBACnB,QAAQ,EAAE,GAAG,CAAC,QAAQ;oBACtB,KAAK,EAAE,GAAG,CAAC,KAAK;oBAChB,OAAO,EAAE,OAAO;iBACnB,CAAC,CAAC;aACN;YACD,MAAM,GAAG,CAAC;SACb;IACL,CAAC;AAfD,CAeC,CAAC;AAEN,IAAM,EAAE,GACJ,UAAI,OAAmC;IACvC,OAAA,UAAC,IAAO;QACJ,IAAM,MAAM,GAAkB,OAAO,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,MAAM,KAAK,IAAI;YAAE,MAAM,IAAI,qCAA4B,CAAC,OAAO,CAAC,CAAC;QACrE,OAAO,MAAM,CAAC;IAClB,CAAC;AAJD,CAIC,CAAC;AAEN,IAAM,QAAQ,GACV,UAAI,OAAyC;IAC7C,OAAA,UAAC,IAAO;QACJ,IAAM,MAAM,GAAwB,OAAO,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK;YACxB,MAAM,IAAI,qCAA4B,CAAC;gBACnC,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,OAAO,EAAE,OAAO;aACnB,CAAC,CAAC;QACP,OAAO,MAAM,CAAC,IAAI,CAAC;IACvB,CAAC;AARD,CAQC,CAAC;AAEN,IAAM,OAAO,GAAG,wDAAwD,CAAC"}
1
+ {"version":3,"file":"get_path_and_stringify.js","sourceRoot":"","sources":["../../../src/decorators/internal/get_path_and_stringify.ts"],"names":[],"mappings":";;;AAAA,yCAA8D;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AAC"}
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validate_request_body = void 0;
4
4
  var common_1 = require("@nestjs/common");
5
5
  var typia_1 = require("typia");
6
+ var TransformError_1 = require("./TransformError");
6
7
  var validate_request_body = function (method) {
7
8
  return function (validator) {
8
9
  if (!validator)
9
- throw new Error("Error on nestia.core.".concat(method, "(): no transformer."));
10
+ throw (0, TransformError_1.TransformError)(method);
10
11
  else if (validator.type === "assert")
11
12
  return assert(validator.assert);
12
13
  else if (validator.type === "is")
@@ -1 +1 @@
1
- {"version":3,"file":"validate_request_body.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_body.ts"],"names":[],"mappings":";;;AAAA,yCAAqD;AACrD,+BAAoD;AAI7C,IAAM,qBAAqB,GAC9B,UAAC,MAAc;IACf,OAAA,UAAI,SAAoC;QACpC,IAAI,CAAC,SAAS;YACV,MAAM,IAAI,KAAK,CACX,+BAAwB,MAAM,wBAAqB,CACtD,CAAC;aACD,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;aACjE,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI;YAAE,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;aACrD,IAAI,SAAS,CAAC,IAAI,KAAK,UAAU;YAClC,OAAO,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACxC,MAAM,IAAI,KAAK,CACX,+BAAwB,MAAM,iCAA8B,CAC/D,CAAC;IACN,CAAC;AAZD,CAYC,CAAC;AAdO,QAAA,qBAAqB,yBAc5B;AAEN,IAAM,MAAM,GACR,UAAI,OAAuB;IAC3B,OAAA,UAAC,IAAO;QACJ,IAAI;YACA,OAAO,CAAC,IAAI,CAAC,CAAC;SACjB;QAAC,OAAO,GAAG,EAAE;YACV,IAAI,GAAG,YAAY,sBAAc,EAAE;gBAC/B,MAAM,IAAI,4BAAmB,CAAC;oBAC1B,IAAI,EAAE,GAAG,CAAC,IAAI;oBACd,MAAM,EAAE,GAAG,CAAC,OAAO;oBACnB,QAAQ,EAAE,GAAG,CAAC,QAAQ;oBACtB,KAAK,EAAE,GAAG,CAAC,KAAK;oBAChB,OAAO,EAAE,OAAO;iBACnB,CAAC,CAAC;aACN;YACD,MAAM,GAAG,CAAC;SACb;IACL,CAAC;AAfD,CAeC,CAAC;AAEN,IAAM,EAAE,GACJ,UAAI,OAA6B;IACjC,OAAA,UAAC,IAAO;QACJ,IAAM,OAAO,GAAY,OAAO,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,OAAO,KAAK,KAAK;YAAE,MAAM,IAAI,4BAAmB,CAAC,OAAO,CAAC,CAAC;IAClE,CAAC;AAHD,CAGC,CAAC;AAEN,IAAM,QAAQ,GACV,UAAI,OAAoC;IACxC,OAAA,UAAC,IAAO;QACJ,IAAM,MAAM,GAAmB,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK;YACxB,MAAM,IAAI,4BAAmB,CAAC;gBAC1B,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,OAAO,EAAE,OAAO;aACnB,CAAC,CAAC;IACX,CAAC;AAPD,CAOC,CAAC;AAEN,IAAM,OAAO,GAAG,uDAAuD,CAAC"}
1
+ {"version":3,"file":"validate_request_body.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_body.ts"],"names":[],"mappings":";;;AAAA,yCAAqD;AAErD,+BAAoD;AAGpD,mDAAkD;AAE3C,IAAM,qBAAqB,GAC9B,UAAC,MAAc;IACf,OAAA,UAAI,SAAoC;QACpC,IAAI,CAAC,SAAS;YAAE,MAAM,IAAA,+BAAc,EAAC,MAAM,CAAC,CAAC;aACxC,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;aACjE,IAAI,SAAS,CAAC,IA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OAAO;aACnB,CAAC,CAAC;IACX,CAAC;AAPD,CAOC,CAAC;AAEN,IAAM,OAAO,GAAG,uDAAuD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestia/core",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "Super-fast validation decorators of NestJS",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -13,6 +13,7 @@
13
13
  "dev": "npm run build -- --watch",
14
14
  "eslint": "eslint ./**/*.ts",
15
15
  "eslint:fix": "eslint ./**/*.ts --fix",
16
+ "package": "npm publish --access public",
16
17
  "prettier": "prettier ./**/*.ts --write",
17
18
  "test": "node bin/test"
18
19
  },
@@ -4,16 +4,35 @@ import { ModuleMetadata } from "@nestjs/common/interfaces";
4
4
  import { Creator } from "../typings/Creator";
5
5
  import { load_controllers } from "./internal/load_controller";
6
6
 
7
+ /**
8
+ * Dynamic module.
9
+ *
10
+ * `DynamicModule` is a namespace wrapping a convenient function, which can load
11
+ * controller classes dynamically just by specifying their directory path.
12
+ *
13
+ * @author Jeongho Nam - https://github.com/samchon
14
+ */
7
15
  export namespace DynamicModule {
16
+ /**
17
+ * Mount dynamic module.
18
+ *
19
+ * Constructs a module instance with directory path of controller classes.
20
+ *
21
+ * Every controller classes in the target directory would be dynamically mounted.
22
+ *
23
+ * @param path Path of controllers
24
+ * @param metadata Addtional metadata except controllers
25
+ * @returns module instance
26
+ */
8
27
  export async function mount(
9
28
  path: string,
10
- options: Omit<ModuleMetadata, "controllers"> = {},
29
+ metadata: Omit<ModuleMetadata, "controllers"> = {},
11
30
  ): Promise<object> {
12
31
  // LOAD CONTROLLERS
13
32
  const controllers: Creator<object>[] = await load_controllers(path);
14
33
 
15
34
  // RETURN WITH DECORATING
16
- @Module({ ...options, controllers })
35
+ @Module({ ...metadata, controllers })
17
36
  class NestiaModule {}
18
37
  return NestiaModule;
19
38
  }
@@ -6,6 +6,7 @@ import {
6
6
  } from "@nestjs/common";
7
7
  import type express from "express";
8
8
  import raw from "raw-body";
9
+
9
10
  import { assert, is, validate } from "typia";
10
11
 
11
12
  import { IRequestBodyValidator } from "../options/IRequestBodyValidator";
@@ -17,14 +18,15 @@ import { validate_request_body } from "./internal/validate_request_body";
17
18
  /**
18
19
  * Encrypted body decorator.
19
20
  *
20
- * `EncryptedBody` is a decorator function getting JSON data from HTTP request who've
21
- * been encrypted by AES-128/256 algorithm. Also, `EncyrptedBody` validates the JSON
22
- * data type through
23
- * [`typia.assert()`](https://github.com/samchon/typia#runtime-type-checkers)
24
- * function and throws `BadRequestException` error (status code: 400), if the JSON
25
- * data is not following the promised type.
21
+ * `EncryptedBody` is a decorator function getting `application/json` typed data from
22
+ * requeset body which has been encrypted by AES-128/256 algorithm. Also,
23
+ * `EncyrptedBody` validates the request body data type through
24
+ * [typia](https://github.com/samchon/typia) ad the validation speed is
25
+ * maximum 15,000x times faster than `class-validator`.
26
26
  *
27
- * For reference, `EncryptedRoute` decrypts request body usnig those options.
27
+ * For reference, when the request body data is not following the promised type `T`,
28
+ * `BadRequestException` error (status code: 400) would be thrown. Also,
29
+ * `EncryptedRoute` decrypts request body usnig those options.
28
30
  *
29
31
  * - AES-128/256
30
32
  * - CBC mode
@@ -34,7 +36,9 @@ import { validate_request_body } from "./internal/validate_request_body";
34
36
  * @return Parameter decorator
35
37
  * @author Jeongho Nam - https://github.com/samchon
36
38
  */
37
- export function EncryptedBody<T>(validator?: IRequestBodyValidator<T>) {
39
+ export function EncryptedBody<T>(
40
+ validator?: IRequestBodyValidator<T>,
41
+ ): ParameterDecorator {
38
42
  const checker = validate_request_body("EncryptedBody")(validator);
39
43
  return createParamDecorator(async function EncryptedBody(
40
44
  _unknown: any,
@@ -14,6 +14,7 @@ import {
14
14
  import { HttpArgumentsHost } from "@nestjs/common/interfaces";
15
15
  import express from "express";
16
16
  import { Observable, catchError, map } from "rxjs";
17
+
17
18
  import {
18
19
  assertStringify,
19
20
  isStringify,
@@ -24,6 +25,7 @@ import {
24
25
  import { IResponseBodyStringifier } from "../options/IResponseBodyStringifier";
25
26
  import { Singleton } from "../utils/Singleton";
26
27
  import { ENCRYPTION_METADATA_KEY } from "./internal/EncryptedConstant";
28
+ import { TransformError } from "./internal/TransformError";
27
29
  import { get_path_and_stringify } from "./internal/get_path_and_stringify";
28
30
  import { headers_to_object } from "./internal/headers_to_object";
29
31
  import { route_error } from "./internal/route_error";
@@ -32,21 +34,20 @@ import { route_error } from "./internal/route_error";
32
34
  * Encrypted router decorator functions.
33
35
  *
34
36
  * `EncryptedRoute` is a module containing router decorator functions which encrypts
35
- * response body data through AES-128/250 encryption. Also, those decorator functions
36
- * can boost up JSON string conversion speed about 5x times faster, through
37
- * [`typia.stringify()`](https://github.com/samchon/typia#fastest-json-string-conversion).
37
+ * response body data through AES-128/250 encryption. Furthermore, they can boost
38
+ * up JSON string conversion speed about 10x times faster, even type safe through
39
+ * [typia](https://github.com/samchon/typia).
38
40
  *
39
- * For reference, `EncryptedRoute` encrypts response body usnig those options.
41
+ * For reference, router functions of `EncryptedRoute` can convert custom error classes
42
+ * to regular {@link nest.HttpException} class automatically, through
43
+ * {@link ExceptionManager}. Also, `EncryptedRoute` encrypts response body usnig those
44
+ * options.
40
45
  *
41
46
  * - AES-128/256
42
47
  * - CBC mode
43
48
  * - PKCS #5 Padding
44
49
  * - Base64 Encoding
45
50
  *
46
- * Also, router functions in `EncryptedRoute` can convert custom error classes to the
47
- * regular {@link nest.HttpException} class automatically, through
48
- * {@link ExceptionManager}.
49
- *
50
51
  * @author Jeongho Nam - https://github.com/samchon
51
52
  */
52
53
  export namespace EncryptedRoute {
@@ -155,9 +156,7 @@ class EncryptedRouteInterceptor implements NestInterceptor {
155
156
  context.getClass(),
156
157
  );
157
158
  if (!param)
158
- throw new Error(
159
- `Error on nestia.core.EncryptedRoute.${this.method}(): no encryption password is given.`,
160
- );
159
+ throw TransformError(`EncryptedRoute.${this.method}`);
161
160
 
162
161
  const headers: Singleton<Record<string, string>> =
163
162
  new Singleton(() => {
@@ -5,19 +5,22 @@ import {
5
5
  } from "@nestjs/common";
6
6
  import type express from "express";
7
7
  import raw from "raw-body";
8
+
8
9
  import { assert, is, validate } from "typia";
9
10
 
10
11
  import { IRequestBodyValidator } from "../options/IRequestBodyValidator";
11
12
  import { validate_request_body } from "./internal/validate_request_body";
12
13
 
13
14
  /**
14
- * Safe body decorator.
15
+ * Type safe body decorator.
16
+ *
17
+ * `TypedBody` is a decoratur function getting `application/json` typed data from
18
+ * request body. Also, it validates the request body data type through
19
+ * [typia](https://github.com/samchon/typia) and the validation speed is
20
+ * maximum 15,000x times faster than `class-validator`.
15
21
  *
16
- * `TypedBody` is a decorator function getting JSON data from HTTP request. Also,
17
- * it validates the JSON data type through
18
- * [`typia.assert()`](https://github.com/samchon/typia#runtime-type-checkers)
19
- * function and throws `BadRequestException` error (status code: 400), if the JSON
20
- * data is not following the promised type.
22
+ * For reference, when the request body data is not following the promised type `T`,
23
+ * `BadRequestException` error (status code: 400) would be thrown.
21
24
  *
22
25
  * @param validator Custom validator if required. Default is `typia.assert()`
23
26
  * @author Jeongho Nam - https://github.com/samchon
@@ -6,12 +6,12 @@ import {
6
6
  import type express from "express";
7
7
 
8
8
  /**
9
- * URL parameter decorator with type.
9
+ * Type safe URL parameter decorator.
10
10
  *
11
- * `TypedParam` is a decorator function getting specific typed parameter from the HTTP
12
- * request URL. It's almost same with the {@link nest.Param}, but `TypedParam` can specify
13
- * the parameter type manually. Beside, the {@link nest.Param} always parses all of the
14
- * parameters as string type.
11
+ * `TypedParam` is a decorator function getting specific typed parameter from the
12
+ * HTTP request URL. It's almost same with the {@link nest.Param}, but `TypedParam`
13
+ * can specify the parameter type manually. Beside, the {@link nest.Param} always
14
+ * parses all of the parameters as string type.
15
15
  *
16
16
  * ```typescript
17
17
  * \@TypedRoute.Get("shopping/sales/:section/:id/:paused")
@@ -33,7 +33,7 @@ export function TypedParam(
33
33
  name: string,
34
34
  type: "boolean" | "number" | "string" | "uuid" = "string",
35
35
  nullable: boolean = false,
36
- ) {
36
+ ): ParameterDecorator {
37
37
  return createParamDecorator(function TypedParam(
38
38
  {}: any,
39
39
  ctx: ExecutionContext,
@@ -3,9 +3,25 @@ import express from "express";
3
3
 
4
4
  import { assert } from "typia";
5
5
 
6
- export function TypedQuery(decoder?: (params: URLSearchParams) => any) {
7
- if (decoder === undefined)
8
- throw new Error("Error on TypedQuery(): no decoder function provided.");
6
+ import { TransformError } from "./internal/TransformError";
7
+
8
+ /**
9
+ * Type safe URL query decorator.
10
+ *
11
+ * `TypedQuery` is a decorator function that can parse URL query string. It is almost
12
+ * same with {@link nest.Query}, but it can automatically cast property type following
13
+ * its DTO definition. Also, `TypedQuery` performs type validation.
14
+ *
15
+ * For referecen, when URL query parameters are different with their promised
16
+ * type `T`, `BadRequestException` error (status code: 400) would be thrown.
17
+ *
18
+ * @returns Parameter decorator
19
+ * @author Jeongho Nam - https://github.com/samchon
20
+ */
21
+ export function TypedQuery<T>(
22
+ decoder?: (params: URLSearchParams) => T,
23
+ ): ParameterDecorator {
24
+ if (decoder === undefined) throw TransformError("TypedQuery");
9
25
 
10
26
  return createParamDecorator(async function TypedQuery(
11
27
  _unknown: any,
@@ -36,6 +52,9 @@ export namespace TypedQuery {
36
52
  }
37
53
  Object.assign(TypedQuery, assert);
38
54
 
55
+ /**
56
+ * @internal
57
+ */
39
58
  function tail(url: string): string {
40
59
  const index: number = url.indexOf("?");
41
60
  return index === -1 ? "" : url.substring(index + 1);
@@ -13,6 +13,7 @@ import {
13
13
  import { HttpArgumentsHost } from "@nestjs/common/interfaces";
14
14
  import express from "express";
15
15
  import { Observable, catchError, map } from "rxjs";
16
+
16
17
  import {
17
18
  assertStringify,
18
19
  isStringify,
@@ -25,14 +26,14 @@ import { get_path_and_stringify } from "./internal/get_path_and_stringify";
25
26
  import { route_error } from "./internal/route_error";
26
27
 
27
28
  /**
28
- * Safe router decorator functions.
29
+ * Type safe router decorator functions.
29
30
  *
30
31
  * `TypedRoute` is a module containing router decorator functions which can boost up
31
- * JSON string conversion speed about 5x times faster, through
32
- * [`typia.stringify()`](https://github.com/samchon/typia#fastest-json-string-conversion).
32
+ * JSON string conversion speed about 10x times faster. Furthermore, such JSON string
33
+ * conversion is even type safe through [typia](https://github.com/samchon/typia).
33
34
  *
34
- * Also, router functions in `TypedRoute` can convert custom error classes to the
35
- * regular {@link nest.HttpException} class automatically, through
35
+ * For reference, router functions of `TypedRoute` can convert custom error classes to
36
+ * the regular {@link nest.HttpException} class automatically, through
36
37
  * {@link ExceptionManager}.
37
38
  *
38
39
  * @author Jeongho Nam - https://github.com/samchon
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export function TransformError(method: string): Error {
5
+ return new Error(
6
+ `Error on nestia.core.${method}(): no transform has been configured. Configure "tsconfig.json" file following [Guide Documents](https://github.com/samchon/nestia/wiki/Setup#tsconfigjson).`,
7
+ );
8
+ }
@@ -1,7 +1,9 @@
1
1
  import { InternalServerErrorException } from "@nestjs/common";
2
+
2
3
  import { IValidation, TypeGuardError } from "typia";
3
4
 
4
5
  import { IResponseBodyStringifier } from "../../options/IResponseBodyStringifier";
6
+ import { TransformError } from "./TransformError";
5
7
 
6
8
  export const get_path_and_stringify =
7
9
  (method: string) =>
@@ -22,10 +24,7 @@ export const get_path_and_stringify =
22
24
  const take =
23
25
  (method: string) =>
24
26
  <T>(functor?: IResponseBodyStringifier<T> | null) => {
25
- if (functor === undefined)
26
- throw new Error(
27
- `Error on nestia.core.${method}(): no stringify function provided.`,
28
- );
27
+ if (functor === undefined) throw TransformError(method);
29
28
  else if (functor === null) return JSON.stringify;
30
29
  else if (functor.type === "stringify") return functor.stringify;
31
30
  else if (functor.type === "assert") return assert(functor.assert);
@@ -1,15 +1,14 @@
1
1
  import { BadRequestException } from "@nestjs/common";
2
+
2
3
  import { IValidation, TypeGuardError } from "typia";
3
4
 
4
5
  import { IRequestBodyValidator } from "../../options/IRequestBodyValidator";
6
+ import { TransformError } from "./TransformError";
5
7
 
6
8
  export const validate_request_body =
7
9
  (method: string) =>
8
10
  <T>(validator?: IRequestBodyValidator<T>) => {
9
- if (!validator)
10
- throw new Error(
11
- `Error on nestia.core.${method}(): no transformer.`,
12
- );
11
+ if (!validator) throw TransformError(method);
13
12
  else if (validator.type === "assert") return assert(validator.assert);
14
13
  else if (validator.type === "is") return is(validator.is);
15
14
  else if (validator.type === "validate")