@nestia/core 1.0.9 → 1.0.11

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 (66) hide show
  1. package/README.md +34 -285
  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 +6 -5
  20. package/lib/decorators/TypedRoute.js +6 -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/lib/executable/core.js +45 -23
  30. package/lib/executable/core.js.map +1 -1
  31. package/lib/executable/internal/ArgumentParser.d.ts +9 -0
  32. package/lib/executable/internal/ArgumentParser.js +269 -0
  33. package/lib/executable/internal/ArgumentParser.js.map +1 -0
  34. package/lib/executable/internal/CommandExecutor.d.ts +3 -0
  35. package/lib/executable/internal/CommandExecutor.js +17 -0
  36. package/lib/executable/internal/CommandExecutor.js.map +1 -0
  37. package/lib/executable/internal/PackageManager.d.ts +27 -0
  38. package/lib/executable/internal/PackageManager.js +140 -0
  39. package/lib/executable/internal/PackageManager.js.map +1 -0
  40. package/lib/executable/internal/PluginConfigurator.d.ts +5 -0
  41. package/lib/executable/internal/PluginConfigurator.js +168 -0
  42. package/lib/executable/internal/PluginConfigurator.js.map +1 -0
  43. package/package.json +8 -3
  44. package/src/decorators/DynamicModule.ts +21 -2
  45. package/src/decorators/EncryptedBody.ts +12 -8
  46. package/src/decorators/EncryptedRoute.ts +10 -11
  47. package/src/decorators/TypedBody.ts +9 -6
  48. package/src/decorators/TypedParam.ts +6 -6
  49. package/src/decorators/TypedQuery.ts +22 -3
  50. package/src/decorators/TypedRoute.ts +7 -5
  51. package/src/decorators/internal/TransformError.ts +8 -0
  52. package/src/decorators/internal/get_path_and_stringify.ts +3 -4
  53. package/src/decorators/internal/validate_request_body.ts +3 -4
  54. package/src/executable/core.ts +39 -18
  55. package/src/executable/internal/ArgumentParser.ts +144 -0
  56. package/src/executable/internal/CommandExecutor.ts +8 -0
  57. package/src/executable/internal/PackageManager.ts +99 -0
  58. package/src/executable/internal/PluginConfigurator.ts +128 -0
  59. package/lib/executable/internal/CommandParser.d.ts +0 -3
  60. package/lib/executable/internal/CommandParser.js +0 -21
  61. package/lib/executable/internal/CommandParser.js.map +0 -1
  62. package/lib/executable/internal/CoreSetupWizard.d.ts +0 -8
  63. package/lib/executable/internal/CoreSetupWizard.js +0 -271
  64. package/lib/executable/internal/CoreSetupWizard.js.map +0 -1
  65. package/src/executable/internal/CommandParser.ts +0 -15
  66. package/src/executable/internal/CoreSetupWizard.ts +0 -225
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)
@@ -58,83 +58,35 @@ npx nestia setup
58
58
  npx @nestia/core setup
59
59
  ```
60
60
 
61
- When you run `npx nestia setup` command, all installation and configuration processes would be automatically done. If you want to setup `@nestia/core` only, run `npx @nestia/core setup` command instead.
61
+ Just type `npx nestia setup`, that's all.
62
62
 
63
- After the setup has been fully completed, you can compile your backend server code by using `ttsc` command. If you want to run your TypeScript file directly through `ts-node`, add `-C ttypescript` argument like below:
63
+ If you've installed [ttypescript](https://github.com/cevek/ttypescript) during setup, you should compile `@nestia/core` utilization code through `ttsc` command, instead of `tsc`.
64
64
 
65
65
  ```bash
66
+ # COMPILE THROUGH TTYPESCRIPT
66
67
  npx ttsc
68
+
69
+ # RUN TS-NODE WITH TTYPESCRIPT
67
70
  npx ts-node -C ttypescript src/index.ts
68
71
  ```
69
72
 
70
- Also, you can specify package manager or target `tsconfig.json` file like below:
73
+ Otherwise, you've chosen [ts-patch](https://github.com/nonara/ts-patch), you can use original `tsc` command. However, [ts-patch](https://github.com/nonara/ts-patch) hacks `node_modules/typescript` source code. Also, whenever update `typescript` version, you've to run `npm run prepare` command repeatedly.
74
+
75
+ By the way, when using `@nest/cli`, you must just choose [ts-patch](https://github.com/nonara/ts-patch).
71
76
 
72
77
  ```bash
73
- npx @nestia/core setup --manager npm
74
- npx @nestia/core setup --manager pnpm
75
- npx @nestia/core setup --manager yarn
78
+ # USE ORIGINAL TSC COMMAND
79
+ tsc
80
+ npx ts-node src/index.ts
76
81
 
77
- npx @nestia/core setup --project tsconfig.json
78
- npx @nestia/core setup --project tsconfig.test.json
82
+ # HOWEVER, WHENVER UPDATE
83
+ npm install --save-dev typescript@latest
84
+ npm run prepare
79
85
  ```
80
86
 
81
87
  ### Manual Setup
82
88
  If you want to install and configure `@nestia/core` manually, read [Guide Documents - Setup](https://github.com/samchon/nestia/wiki/Setup).
83
89
 
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
90
 
139
91
 
140
92
 
@@ -153,229 +105,26 @@ export class BbsArticlesController {
153
105
  * @param inupt Content to store
154
106
  * @returns Newly archived article
155
107
  */
156
- @TypedRoute.Post() // 10x faster and safer JSON.stringify()
108
+ @TypedRoute.Put(":id") // 50x faster and safer JSON.stringify()
157
109
  public async store(
158
- @TypedBody() input: IBbsArticle.IStore // supoer-fast validator
159
- ): Promise<IBbsArticle>;
160
- }
161
- ```
162
-
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[]>;
110
+ @TypedParam("section", "string") section: string,
111
+ @TypedParam("id", "uuid") id: string,
112
+ @TypedBody() input: IBbsArticle.IUpdate // super-fast validator
113
+ ): Promise<IBbsArticle.IContent>;
200
114
  }
201
115
  ```
202
116
 
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`.
117
+ About detailed features, read [Guide Documents](https://github.com/samchon/nestia/wiki)
118
+
119
+ - Decorators
120
+ - [TypedRoute](https://github.com/samchon/nestia/wiki/Core-Library#typedroute)
121
+ - [TypedBody](https://github.com/samchon/nestia/wiki/Core-Library#typedbody)
122
+ - [TypedQuery](https://github.com/samchon/nestia/wiki/Core-Library#typedquery)
123
+ - [TypedParam](https://github.com/samchon/nestia/wiki/Core-Library#typedparam)
124
+ - Enhancements
125
+ - [Comment Tags](https://github.com/samchon/nestia/wiki/Core-Library#comment-tags)
126
+ - [Configuration](https://github.com/samchon/nestia/wiki/Core-Library#configuration)
127
+ - Advanced Usage
128
+ - [DynamicModule](https://github.com/samchon/nestia/wiki/Core-Library#dynamicmodule)
129
+ - [Encryption](https://github.com/samchon/nestia/wiki/Core-Library#encryption)
130
+ - [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 using 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 using 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAgE;AAChE,yCAIwB;AAExB,sDAA2B;AAC3B,+BAA6C;AAG7C,gDAA+C;AAC/C,kEAAuE;AACvE,kEAAiE;AACjE,0EAAyE;AAEzE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,aAAa,CAAI,SAAoC;IACjE,IAAM,OAAO,GAAG,IAAA,6CAAqB,EAAC,eAAe,CAAC,CAAC,SAAS,CAAC,CAAC;IAClE,OAAO,IAAA,6BAAoB,EAAC,SAAe,aAAa,CACpD,QAAa,EACb,GAAqB;;;;;;wBAEf,OAAO,GAAoB,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;wBACjE,IAAI,OAAO,CAAC,QAAQ,KAAK,KAAK;4BAC1B,MAAM,IAAI,4BAAmB,CACzB,qCAAqC,CACxC,CAAC;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C,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/256 encryption. Furthermore, they can boost
7
+ * up JSON string conversion speed about 50x times faster than `class-transformer`,
8
+ * even type safe through [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 using 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/256 encryption. Furthermore, they can boost
56
+ * up JSON string conversion speed about 50x times faster than `class-transformer`,
57
+ * even type safe through [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 using 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;;;;;OAKG;IACU,qBAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;IAE1C,SAAS,SAAS,CAAC,MAAmD;QAUlE,SAAS,KAAK;YAAC,cAAc;iBAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;gBAAd,yBAAc;;YACnB,IAAA,KAAA,OAAoB,IAAA,+CAAsB,EAC5C,yBAAkB,MAAM,CAAE,CAC7B,wCAAI,IAAI,cAAC,EAFH,IAAI,QAAA,EAAE,SAAS,QAEZ,CAAC;YACX,OAAO,IAAA,wBAAe,EAClB,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EACrB,IAAA,wBAAe,EACX,IAAI,yBAAyB,CAAC,MAAM,EAAE,SAAS,CAAC,CACnD,CACJ,CAAC;QACN,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;A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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;wBACrE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,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,C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