nestia 3.1.6 → 4.0.0-dev.20221217

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 (123) hide show
  1. package/README.md +170 -612
  2. package/bin/CommandParser.d.ts +3 -0
  3. package/bin/CommandParser.js +21 -0
  4. package/bin/CommandParser.js.map +1 -0
  5. package/bin/NestiaSetupWizard.d.ts +5 -0
  6. package/bin/NestiaSetupWizard.js +90 -0
  7. package/bin/NestiaSetupWizard.js.map +1 -0
  8. package/bin/NestiaStarter.d.ts +3 -0
  9. package/{lib/executable/internal → bin}/NestiaStarter.js +25 -26
  10. package/bin/NestiaStarter.js.map +1 -0
  11. package/{lib/executable/nestia.d.ts → bin/index.d.ts} +0 -0
  12. package/bin/index.js +113 -0
  13. package/bin/index.js.map +1 -0
  14. package/package.json +38 -76
  15. package/CONTRIBUTING.md +0 -72
  16. package/bundle/HttpError.ts +0 -1
  17. package/bundle/IConnection.ts +0 -1
  18. package/bundle/Primitive.ts +0 -1
  19. package/bundle/__internal/AesPkcs5.ts +0 -1
  20. package/bundle/__internal/Fetcher.ts +0 -1
  21. package/lib/IConfiguration.d.ts +0 -110
  22. package/lib/IConfiguration.js +0 -3
  23. package/lib/IConfiguration.js.map +0 -1
  24. package/lib/NestiaApplication.d.ts +0 -11
  25. package/lib/NestiaApplication.js +0 -156
  26. package/lib/NestiaApplication.js.map +0 -1
  27. package/lib/analyses/ControllerAnalyzer.d.ts +0 -6
  28. package/lib/analyses/ControllerAnalyzer.js +0 -106
  29. package/lib/analyses/ControllerAnalyzer.js.map +0 -1
  30. package/lib/analyses/GenericAnalyzer.d.ts +0 -5
  31. package/lib/analyses/GenericAnalyzer.js +0 -41
  32. package/lib/analyses/GenericAnalyzer.js.map +0 -1
  33. package/lib/analyses/ImportAnalyzer.d.ts +0 -13
  34. package/lib/analyses/ImportAnalyzer.js +0 -86
  35. package/lib/analyses/ImportAnalyzer.js.map +0 -1
  36. package/lib/analyses/PathAnalyzer.d.ts +0 -5
  37. package/lib/analyses/PathAnalyzer.js +0 -51
  38. package/lib/analyses/PathAnalyzer.js.map +0 -1
  39. package/lib/analyses/ReflectAnalyzer.d.ts +0 -4
  40. package/lib/analyses/ReflectAnalyzer.js +0 -230
  41. package/lib/analyses/ReflectAnalyzer.js.map +0 -1
  42. package/lib/analyses/SourceFinder.d.ts +0 -4
  43. package/lib/analyses/SourceFinder.js +0 -70
  44. package/lib/analyses/SourceFinder.js.map +0 -1
  45. package/lib/executable/internal/CompilerOptions.d.ts +0 -11
  46. package/lib/executable/internal/CompilerOptions.js +0 -18
  47. package/lib/executable/internal/CompilerOptions.js.map +0 -1
  48. package/lib/executable/internal/NestiaCommand.d.ts +0 -4
  49. package/lib/executable/internal/NestiaCommand.js +0 -128
  50. package/lib/executable/internal/NestiaCommand.js.map +0 -1
  51. package/lib/executable/internal/NestiaConfig.d.ts +0 -4
  52. package/lib/executable/internal/NestiaConfig.js +0 -536
  53. package/lib/executable/internal/NestiaConfig.js.map +0 -1
  54. package/lib/executable/internal/NestiaStarter.d.ts +0 -3
  55. package/lib/executable/internal/NestiaStarter.js.map +0 -1
  56. package/lib/executable/internal/nestia.config.getter.d.ts +0 -1
  57. package/lib/executable/internal/nestia.config.getter.js +0 -24
  58. package/lib/executable/internal/nestia.config.getter.js.map +0 -1
  59. package/lib/executable/nestia.js +0 -86
  60. package/lib/executable/nestia.js.map +0 -1
  61. package/lib/generates/FileGenerator.d.ts +0 -5
  62. package/lib/generates/FileGenerator.js +0 -137
  63. package/lib/generates/FileGenerator.js.map +0 -1
  64. package/lib/generates/FunctionGenerator.d.ts +0 -5
  65. package/lib/generates/FunctionGenerator.js +0 -204
  66. package/lib/generates/FunctionGenerator.js.map +0 -1
  67. package/lib/generates/SdkGenerator.d.ts +0 -7
  68. package/lib/generates/SdkGenerator.js +0 -47
  69. package/lib/generates/SdkGenerator.js.map +0 -1
  70. package/lib/generates/SwaggerGenerator.d.ts +0 -6
  71. package/lib/generates/SwaggerGenerator.js +0 -244
  72. package/lib/generates/SwaggerGenerator.js.map +0 -1
  73. package/lib/index.d.ts +0 -2
  74. package/lib/index.js +0 -28
  75. package/lib/index.js.map +0 -1
  76. package/lib/module.d.ts +0 -2
  77. package/lib/module.js +0 -19
  78. package/lib/module.js.map +0 -1
  79. package/lib/structures/IController.d.ts +0 -23
  80. package/lib/structures/IController.js +0 -3
  81. package/lib/structures/IController.js.map +0 -1
  82. package/lib/structures/IRoute.d.ts +0 -24
  83. package/lib/structures/IRoute.js +0 -3
  84. package/lib/structures/IRoute.js.map +0 -1
  85. package/lib/structures/ISwagger.d.ts +0 -48
  86. package/lib/structures/ISwagger.js +0 -3
  87. package/lib/structures/ISwagger.js.map +0 -1
  88. package/lib/structures/ITypeTuple.d.ts +0 -5
  89. package/lib/structures/ITypeTuple.js +0 -3
  90. package/lib/structures/ITypeTuple.js.map +0 -1
  91. package/lib/structures/MethodType.d.ts +0 -4
  92. package/lib/structures/MethodType.js +0 -14
  93. package/lib/structures/MethodType.js.map +0 -1
  94. package/lib/structures/ParamCategory.d.ts +0 -1
  95. package/lib/structures/ParamCategory.js +0 -3
  96. package/lib/structures/ParamCategory.js.map +0 -1
  97. package/lib/structures/TypeEntry.d.ts +0 -9
  98. package/lib/structures/TypeEntry.js +0 -21
  99. package/lib/structures/TypeEntry.js.map +0 -1
  100. package/lib/test/TestBuilder.d.ts +0 -4
  101. package/lib/test/TestBuilder.js +0 -60
  102. package/lib/test/TestBuilder.js.map +0 -1
  103. package/lib/test/index.d.ts +0 -1
  104. package/lib/test/index.js +0 -62
  105. package/lib/test/index.js.map +0 -1
  106. package/lib/test/test.builder.executor.d.ts +0 -1
  107. package/lib/test/test.builder.executor.js +0 -24
  108. package/lib/test/test.builder.executor.js.map +0 -1
  109. package/lib/utils/ArrayUtil.d.ts +0 -5
  110. package/lib/utils/ArrayUtil.js +0 -39
  111. package/lib/utils/ArrayUtil.js.map +0 -1
  112. package/lib/utils/DirectoryUtil.d.ts +0 -5
  113. package/lib/utils/DirectoryUtil.js +0 -62
  114. package/lib/utils/DirectoryUtil.js.map +0 -1
  115. package/lib/utils/ImportDictionary.d.ts +0 -6
  116. package/lib/utils/ImportDictionary.js +0 -50
  117. package/lib/utils/ImportDictionary.js.map +0 -1
  118. package/lib/utils/MapUtil.d.ts +0 -3
  119. package/lib/utils/MapUtil.js +0 -16
  120. package/lib/utils/MapUtil.js.map +0 -1
  121. package/lib/utils/StripEnums.d.ts +0 -3
  122. package/lib/utils/StripEnums.js +0 -3
  123. package/lib/utils/StripEnums.js.map +0 -1
package/README.md CHANGED
@@ -1,76 +1,19 @@
1
1
  # Nestia
2
- Automatic `SDK` and `Swagger` generator for the `NestJS`, evolved than ever.
3
-
4
- [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)
5
- [![npm version](https://badge.fury.io/js/nestia.svg)](https://www.npmjs.com/package/nestia)
6
- [![Downloads](https://img.shields.io/npm/dm/nestia.svg)](https://www.npmjs.com/package/nestia)
7
- [![Build Status](https://github.com/samchon/nestia/workflows/build/badge.svg)](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)
2
+ [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)
3
+ [![Build Status](https://github.com/samchon/typia/workflows/build/badge.svg)](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)
8
4
  [![Guide Documents](https://img.shields.io/badge/wiki-documentation-forestgreen)](https://github.com/samchon/nestia/wiki)
9
5
 
10
- - Github: https://github.com/samchon/nestia
11
- - NPM: https://www.npmjs.com/package/nestia
12
- - Guide Documents: https://github.com/samchon/nestia/wiki
13
-
14
- `nestia` is an evolved `SDK` and `Swagger` generator, which analyzes your `NestJS` server code in the compilation level. With `nestia` and compilation level analyzer, you don't need to write any swagger or class-validator decorators. All you need to do is use the `nestia` CLI as shown below.
6
+ Nestia is a helper library set for NestJS, supporting below features:
15
7
 
16
- Reading below contents, feel how the "compilation level" makes `nestia` stronger.
8
+ - [`@nestia/core`](#nestiacore): **15,000x times faster** validation decorator using [typia](https://github.com/samchon/typia)
9
+ - [`@nestia/sdk`](#nestiasdk): evolved **SDK** and **Swagger** generator for `@nestia/core`
10
+ - `nestia`: just CLI (command line interface) tool
17
11
 
18
- Components | `nestia`::SDK | `nestia`::swagger | `@nestjs/swagger`
19
- -----------|---|---|---
20
- Pure DTO interface | ✔ | ✔ | ❌
21
- Description comments | ✔ | ✔ | ❌
22
- Simple structure | ✔ | ✔ | ✔
23
- Generic type | ✔ | ✔ | ❌
24
- Union type | ✔ | ✔ | ▲
25
- Intersection type | ✔ | ✔ | ▲
26
- Conditional type | ✔ | ▲ | ❌
27
- Auto completion | ✔ | ❌ | ❌
28
- Type hints | ✔ | ❌ | ❌
29
- 5x faster `JSON.stringify()` | ✔ | ❌ | ❌
30
- Ensure type safety | ✅ | ❌ | ❌
12
+ For reference, **15,000x times faster validation** means the difference in validation speed between `typia` used by `@nestia/core` and `class-validator` used by `NestJS`. If you visit `typia` repo and [read how it fast and stable](https://github.com/samchon/typia/wiki/Runtime-Validators#powerful-validator), you may understand why I've started this `nestia` project.
31
13
 
32
- ```typescript
33
- // IMPORT SDK LIBRARY GENERATED BY NESTIA
34
- import api from "@samchon/shopping-api";
35
- import { IPage } from "@samchon/shopping-api/lib/structures/IPage";
36
- import { ISale } from "@samchon/shopping-api/lib/structures/ISale";
37
- import { ISaleQuestion } from "@samchon/shopping-api/lib/structures/ISaleQuestion";
38
-
39
- export async function trace_sale_question_and_comment
40
- (connection: api.IConnection): Promise<void>
41
- {
42
- // LIST UP SALE SUMMARIES
43
- const index: IPage<ISale.ISummary> = await api.functional.shoppings.sales.index
44
- (
45
- connection,
46
- "general",
47
- { limit: 100, page: 1 }
48
- );
14
+ ![Is Function Benchmark](https://github.com/samchon/typia/raw/master/benchmark/results/11th%20Gen%20Intel(R)%20Core(TM)%20i5-1135G7%20%40%202.40GHz/images/is.svg)
49
15
 
50
- // PICK A SALE
51
- const sale: ISale = await api.functional.shoppings.sales.at
52
- (
53
- connection,
54
- "general",
55
- index.data[0].id
56
- );
57
- console.log("sale", sale);
58
-
59
- // WRITE A QUESTION
60
- const question: ISaleQuestion = await api.functional.shoppings.sales.questions.store
61
- (
62
- connection,
63
- "general",
64
- sale.id,
65
- {
66
- title: "How to use this product?",
67
- body: "The description is not fully enough. Can you introduce me more?",
68
- files: []
69
- }
70
- );
71
- console.log("question", question);
72
- }
73
- ```
16
+ > Measured on [Intel i5-1135g7, Surface Pro 8](https://github.com/samchon/typia/tree/master/benchmark/results/11th%20Gen%20Intel(R)%20Core(TM)%20i5-1135G7%20%40%202.40GHz#is)
74
17
 
75
18
 
76
19
 
@@ -81,642 +24,257 @@ export async function trace_sale_question_and_comment
81
24
  npx nestia start <directory>
82
25
  ```
83
26
 
84
- Just run the uppder command, then boilerplate project using `nestia` would be installed.
85
-
86
- When the installation has been completed, you can start NestJS backend development directly. and you also can generate SDK library or Swagger documents by running below command. You can get more information by reading [README](https://github.com/samchon/nestia-template) content of the boilderplate project.
27
+ Just run above command, then boilerplate project would be constructed.
87
28
 
29
+ ### Setup Wizard
88
30
  ```bash
89
- cd <directory>
90
- npm run build:sdk
91
- npm run build:swagger
31
+ npx nestia setup
92
32
  ```
93
33
 
94
- However, supported range of the boilerplate project is limited. It guides from "setting up nestia configuration" to "how to accomplish TDD through SDK", but nothing more. If you want more guidance like
95
- configuring DB or preparing non-distruptive update system, visit [samchon/backend](https://github.com/samchon/backend) and create a new repository from that.
96
-
97
- ### Manual Installation
98
- If you need to manual install, follow below step.
34
+ When you want to use `nestia` in orindary project, just type above command.
99
35
 
100
- At first, install those dependencies.
36
+ All installation and configuration processes would be automatically done.
101
37
 
102
- ```sh
103
- npm install --save nestia-helper
104
- npm install --save-dev nestia
38
+ Also, you can specify package manager by `--manage` argument like below:
105
39
 
106
- npm install --save-dev typescript
107
- npm install --save-dev ttypescript
108
- npm install --save-dev ts-node
40
+ ```bash
41
+ npx nestia setup --manager npm
42
+ npx nestia setup --manager pnpm
43
+ npx nestia setup --manager yarn
109
44
  ```
110
45
 
111
- After the installation, check the `tsconfig.json` file. When you're using nestia, your TypeScript project must be configured to using CommonJS module with strict mode. Also, if you configure plugins like below to using [nestia-helper](https://github.com/samchon/nestia-helper), you can get great benefit by using [pure DTO interface](#pure-dto-interface).
112
-
113
- ```json
114
- {
115
- "compilerOptions": {
116
- "module": "CommonJS",
117
- "strict": true,
118
- "plugins": [
119
- { "transform": "nestia-helper/lib/transform" }
120
- ]
121
- }
122
- }
123
- ```
46
+ After the setup, you can compile `@nestia/core` utilization code by using `ttsc` ([`ttypescript`](https://github.com/cevek/ttypescript)) command. If you want to run your TypeScript file directly through `ts-node`, add `-C ttypescript` argument like below:
124
47
 
125
- When all manual setup processes are completed, you can generate the `SDK` or `Swagger`.
48
+ ```bash
49
+ # COMPILE THROUGH TTYPESCRIPT
50
+ npx ttsc
126
51
 
127
- ```sh
128
- npx nestia sdk "src/**/*.controller" --out "src/api"
129
- npx nestia swagger "src/**/*.controller" --out "swagger.json"
52
+ # RUN TS-NODE WITH TTYPESCRIPT
53
+ npx ts-node -C ttypescript src/index.ts
130
54
  ```
131
55
 
132
- > If all of your controller files are gathered into one directory:
133
- >
134
- > ```sh
135
- > npx nestia sdk "src/controllers" --out "src/api"
136
- > npx nestia swagger "src/controllers" --out "swagger.json"
137
- > ```
138
- >
139
- > You can omit all of the parameters if you've configured the [nestia.config.ts](#configuration) file.
140
- >
141
- > ```sh
142
- > npx nestia sdk
143
- > npx nestia swagger
144
- > ```
56
+ ### Manual Setup
57
+ If you want to install and setup `nestia` manually, read [Guide Documents - Setup](https://github.com/samchon/nestia/wiki/Setup).
145
58
 
146
59
 
147
60
 
148
61
 
149
- ## Demonstrations
150
- ### Pure DTO Interface
151
- `nestia` can utilize pure interface type as DTO.
62
+ ## `@nestia/core`
63
+ [![npm version](https://img.shields.io/npm/v/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)
64
+ [![Downloads](https://img.shields.io/npm/dm/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)
152
65
 
153
- Unlike `@nestjs/swagger` which requires the DTO class with decorators, `nestia` can use the pure interface type directly. Also, `nestia` can utilize the pure descriptive comments, instead of using the `description` property of the decorators. Furthermore, `nestia` can even support generic types, union/intersection types and even conditional types.
66
+ super-fast validation decorators for NestJS.
154
67
 
155
- Look at the code below, you may see the difference between `nestia` and `@nestjs/swagger`, and thereby catch the meaning of the pure DTO interface.
68
+ `@nestia/core` is a transformer library of NestJS, supporting super-fast validation decorators, by wrapping [typia](https://github.com/samchon/typia). Comparing validation speed with `class-validator`, `typia` is maximum **15,000x times faster** and it even much safer.
156
69
 
157
- - Simple [`ISaleArticleComment`](https://github.com/samchon/nestia/tree/master/demo/safe/src/api/structures/ISaleArticleComment.ts)
158
- - Generic interfaces
159
- - grandparent interface, [`ISaleArticle<Content>`](https://github.com/samchon/nestia/tree/master/demo/generic/src/api/structures/ISaleArticle.ts)
160
- - parent interface, [`ISaleInquiry<Content>`](https://github.com/samchon/nestia/tree/master/demo/generic/src/api/structures/ISaleInquiry.ts)
161
- - 1st sub-type interface, [`ISaleQuestion`](https://github.com/samchon/nestia/tree/master/demo/generic/src/api/structures/ISaleQuestion.ts)
162
- - 2nd sub-type interface, [`ISaleReview`](https://github.com/samchon/nestia/tree/master/demo/generic/src/api/structures/ISaleReview.ts)
163
- - Union alias type [`ISaleEntireArticle`](https://github.com/samchon/nestia/tree/master/demo/union/src/api/structures/ISaleEntireArticle.ts)
70
+ Furthermore, `@nestia/core` can use pure interface typed DTO with **only one line**.
164
71
 
165
- ```typescript
166
- /**
167
- * Comment wrote on a sale related article.
168
- *
169
- * When an article of a sale has been enrolled, all of the participants like consumers and
170
- * sellers can write a comment on that article. However, when the writer is a consumer, the
171
- * consumer can hide its name through the annoymous option.
172
- *
173
- * Also, writing a reply comment for a specific comment is possible and in that case, the
174
- * {@link ISaleArticleComment.parent_id} property would be activated.
175
- *
176
- * @author Jeongho Nam - https://github.com/samchon
177
- */
178
- export interface ISaleArticleComment
179
- {
180
- /**
181
- * Primary Key.
182
- */
183
- id: number;
72
+ Therefore, it does not require any extra dedication like defining JSON schema (`@nestjs/swagger`) or using class definition with decorator function calls (`class-validator`). Just enjoy the **superfast** decorator with pure TypeScript type.
184
73
 
185
- /**
186
- * Parent comment ID.
187
- *
188
- * Only When this comment has been written as a reply.
189
- */
190
- parent_id: number | null;
191
-
192
- /**
193
- * Type of the writer.
194
- */
195
- writer_type: "seller" | "consumer";
74
+ ```typescript
75
+ import { Controller } from "@nestjs/common";
76
+ import { TypedBody, TypedRoute } from "@nestia/core";
196
77
 
197
- /**
198
- * Name of the writer.
199
- *
200
- * When this is a type of anonymous comment, writer name would be hidden.
201
- */
202
- writer_name: string | null;
78
+ import { IBbsArticle } from "@bbs-api/structures/IBbsArticle";
203
79
 
204
- /**
205
- * Contents of the comments.
80
+ @Controller("bbs/articles")
81
+ export class BbsArticlesController {
82
+ /**
83
+ * Store a new content.
206
84
  *
207
- * When the comment writer tries to modify content, it would not modify the comment
208
- * content but would be accumulated. Therefore, all of the people can read how
209
- * the content has been changed.
85
+ * @param inupt Content to store
86
+ * @returns Newly archived article
210
87
  */
211
- contents: ISaleArticleComment.IContent[];
212
-
213
- /**
214
- * Creation time.
215
- */
216
- created_at: string;
88
+ @TypedRoute.Post() // 10x faster and safer JSON.stringify()
89
+ public async store(
90
+ @TypedBody() input: IBbsArticle.IStore // supoer-fast validator
91
+ ): Promise<IBbsArticle>;
217
92
  }
218
93
  ```
219
94
 
95
+ ### TypedBody
96
+ `TypedBody()` is a decorator function of `application/json` typed request body.
220
97
 
98
+ Also, it supports super-fast validation pipe using, which is maximum 15,000x times faster then ordinary `nest.Body()` decorator using `class-validator`.
221
99
 
100
+ ### TypedRoute
101
+ `TypedRoute()` is a decorator function of `application/json` typed reponse body.
222
102
 
103
+ 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.
223
104
 
224
- ### Advanced Controller Class
225
- Controller also can use the generic arguments.
226
-
227
- In the previous [Pure DTO Interface](#pure-dto-interface) corner, we've learned that `nestia` can use the pure interface type as DTO. Also, we've learned that utilizing generic, union/intersection and even conditional typed interfaces are also possible.
228
-
229
- In the Controller case, it's same with the upper DTO story. With `nestia`, defining a generic typed controller class is also possible, too. By defining a generic typed controller class as a super-type class, you can reduce both duplicated code and description comments.
230
-
231
- Look at the below code and feel how powerful `nestia` is.
232
-
233
- - Simple [`CustomerSaleArticleCommentsController`](https://github.com/samchon/nestia/blob/master/demo/safe/src/controllers/ConsumerSaleArticleCommentsController.ts)
234
- - Generic controllers
235
- - abstract controller, [`SaleInquiriesController<Content, Store, Json>`](https://github.com/samchon/nestia/tree/master/demo/generic/src/controllers/SaleInquiriesController.ts)
236
- - 1st sub-type controller, [`ConsumerSaleQuestionsController`](https://github.com/samchon/nestia/tree/master/demo/generic/src/controllers/ConsumerSaleQuestionsController.ts)
237
- - 2nd sub-type controller, [`ConsumerSaleQuestionsController`](https://github.com/samchon/nestia/tree/master/demo/generic/src/controllers/ConsumerSaleQuestionsController.ts)
238
- - Union controller, [`ConsumerSaleEntireArticlesController`](https://github.com/samchon/nestia/tree/master/demo/union/src/controllers/ConsumerSaleEntireArticlesController.ts)
105
+ ### Comment Tags
106
+ You can enhance DTO type validation by writing comment tags.
239
107
 
240
- Also, you can validate request body data from client automatically, by using [nestia-helper](https://github.com/samchon/nestia-helper) and its `TypedBody()` decorator, which is maximum 1,000x times faster than other. Furthermore, `nestia-helper` boosts up JSON string conversion speed about 5x times faster through its `TypedRoute()` component.
241
-
242
- ![typescript-json benchmark](https://user-images.githubusercontent.com/13158709/194713658-62fb0716-c24e-41f9-be0d-01edeabb1dd6.png)
108
+ If you want to know about it detaily, visit [Guide Documents of typia](https://github.com/samchon/typia/wiki/Runtime-Validators#comment-tags).
243
109
 
244
110
  ```typescript
245
- import express from "express";
246
- import { Controller, Param, Request } from "@nestjs/common";
247
- import { TypedBody, TypedRoute } from "nestia-helper";
111
+ export interface IBbsArticle {
112
+ /**
113
+ * @format uuid
114
+ */
115
+ id: string;
248
116
 
249
- import { ISaleArticleComment } from "../api/structures/ISaleArticleComment";
117
+ writer: IBbsArticle.IWriter;
250
118
 
251
- @Controller("consumers/:section/sales/:saleId/articles/:articleId/comments")
252
- export class ConsumerSaleArticleCommentsController {
253
119
  /**
254
- * Store a new comment.
255
- *
256
- * Write a comment on a sale article. If you configure the comment to be
257
- * `anonymous`, only administrator, you and seller of the sale can read
258
- * the content.
259
- *
260
- * @param request Instance of the Express.Request
261
- * @param sectionCode Code of the target section
262
- * @param saleId ID of the target sale
263
- * @param articleId ID of the target article
264
- * @param body Content to write
265
- * @return Newly archived comment
266
- *
267
- * @throw 400 bad request error when type of the input data is not valid
268
- * @throw 401 unauthorized error when you've not logged in yet
269
- * @throw 403 forbidden error when you're a seller and the sale is not yours
270
- * @throw 404 not found error when unable to find the matched record
120
+ * @minItems 1
271
121
  */
272
- @TypedRoute.Post() // 5x faster JSON.stringify()
273
- public async store(
274
- @Request() request: express.Request,
275
- @Param("section") sectionCode: string,
276
- @Param("saleId") saleId: string,
277
- @Param("articleId") articleId: string,
278
- @TypedBody() body: ISaleArticleComment.IStore, // auto validation
279
- ): Promise<ISaleArticleComment>;
122
+ contents: IBbsArticle.IContent[];
280
123
  }
281
- ```
282
-
283
-
284
-
285
-
286
- ### Software Development Kit
287
- > `Swagger` is torturing client developers.
288
- >
289
- > If you're a backend developer and you deliver a `Swagger` to your companion client developers, they should analyze the `Swagger` and implement duplicated router functions with DTO interfaces by themselves. During those jobs, if a client developer takes a mistake by mis-reading the `Swagger`, it becomes a critical runtime error directly.
290
- >
291
- > Why are you torturing the client developers such like that? If you deliver an SDK (Software Development Kit) instead of the `Swagger`, the client developers don't need to read the `Swagger` file. They never need to implement the duplicated DTO interfaces with router functions, either.
292
- >
293
- > Therefore, just build the SDK through this `nestia` and deliver the SDK. Your client developers would be anticipated from the long time torturing and become happy. Your solution would be much more reliable and efficient, too.
294
-
295
- Looking at the SDK library file, generated by `nestia`, it is perfect.
296
-
297
- Route method, path and parameters are well-formed and DTO structures are correctly imported. Also, descriptive comments are fully revived in the SDK library, regardless of where they are written.
298
-
299
- Furthermore, there's not any problem even when a generic typed controller class comes. `nestia` will specialize the generic arguments exactly, by analyzing your `NestJS` server code, in the compilation level.
300
-
301
- - [simple/.../comments/index.ts](https://github.com/samchon/nestia/blob/master/demo/safe/src/api/functional/consumers/sales/articles/comments/index.ts)
302
- - [generic/.../questions/index.ts](https://github.com/samchon/nestia/tree/master/demo/generic/src/api/functional/consumers/sales/questions/index.ts)
303
- - [generic/.../reviews/index.ts](https://github.com/samchon/nestia/tree/master/demo/generic/src/api/functional/consumers/sales/reviews/index.ts)
304
- - [union/.../entire_articles/index.ts](https://github.com/samchon/nestia/tree/master/demo/union/src/api/functional/consumers/sales/entire_articles/index.ts)
305
-
306
- ```typescript
307
- /**
308
- * @packageDocumentation
309
- * @module api.functional.consumers.sales.reviews
310
- * @nestia Generated by Nestia - https://github.com/samchon/nestia
311
- */
312
- //================================================================
313
- import { Fetcher, Primitive } from "nestia-fetcher";
314
- import type { IConnection } from "nestia-fetcher";
315
- import TSON from "typescript-json";
316
-
317
- import type { ISaleReview } from "./../../../../structures/ISaleReview";
318
- import type { ISaleInquiry } from "./../../../../structures/ISaleInquiry";
124
+ export namespace IBbsArticle {
125
+ export interface IWriter {
126
+ /**
127
+ * @minLength 3
128
+ */
129
+ name: string;
319
130
 
320
- /**
321
- * Store a new inquiry.
322
- *
323
- * Write a new article inquirying about a sale.
324
- *
325
- * @param connection connection Information of the remote HTTP(s) server with headers (+encryption password)
326
- * @param request Instance of the Express.Request
327
- * @param section Code of the target section
328
- * @param saleId ID of the target sale
329
- * @param input Content to archive
330
- * @return Newly archived inquiry
331
- * @throw 400 bad request error when type of the input data is not valid
332
- * @throw 401 unauthorized error when you've not logged in yet
333
- *
334
- * @controller ConsumerSaleReviewsController.store()
335
- * @path POST /consumers/:section/sales/:saleId/reviews
336
- * @nestia Generated by Nestia - https://github.com/samchon/nestia
337
- */
338
- export function store
339
- (
340
- connection: IConnection,
341
- section: string,
342
- saleId: string,
343
- input: Primitive<store.Input>
344
- ): Promise<store.Output>
345
- {
346
- return Fetcher.fetch
347
- (
348
- connection,
349
- store.ENCRYPTED,
350
- store.METHOD,
351
- store.path(section, saleId),
352
- input,
353
- store.stringify
354
- );
355
- }
356
- export namespace store
357
- {
358
- export type Input = Primitive<ISaleReview.IStore>;
359
- export type Output = Primitive<ISaleInquiry<ISaleReview.IContent>>;
131
+ /**
132
+ * @format email
133
+ */
134
+ email: string;
360
135
 
361
- export const METHOD = "POST" as const;
362
- export const PATH: string = "/consumers/:section/sales/:saleId/reviews";
363
- export const ENCRYPTED: Fetcher.IEncrypted = {
364
- request: false,
365
- response: false,
366
- };
367
-
368
- export function path(section: string, saleId: string): string
369
- {
370
- return `/consumers/${section}/sales/${saleId}/reviews`;
371
- }
372
- export const stringify = (input: Input) => TSON.stringify(input);
373
- }
136
+ /**
137
+ * @pattern ^0[0-9]{7,16}
138
+ */
139
+ mobile: string;
374
140
 
375
- /**
376
- * Update an inquiry.
377
- *
378
- * Update ordinary inquiry article. However, it would not modify the content reocrd
379
- * {@link ISaleInquiry.IContent}, but be accumulated into the {@link ISaleInquiry.contents}.
380
- * Therefore, all of the poeple can read how the content has been changed.
381
- *
382
- * @param connection connection Information of the remote HTTP(s) server with headers (+encryption password)
383
- * @param request Instance of the Express.Request
384
- * @param section Code of the target section
385
- * @param saleId ID of the target sale
386
- * @param id ID of the target article to be updated
387
- * @param input New content to be overwritten
388
- * @return The newly created content record
389
- * @throw 400 bad request error when type of the input data is not valid
390
- * @throw 401 unauthorized error when you've not logged in yet
391
- * @throw 403 forbidden error when the article is not yours
392
- *
393
- * @controller ConsumerSaleReviewsController.update()
394
- * @path PUT /consumers/:section/sales/:saleId/reviews/:id
395
- * @nestia Generated by Nestia - https://github.com/samchon/nestia
396
- */
397
- export function update
398
- (
399
- connection: IConnection,
400
- section: string,
401
- saleId: string,
402
- id: number,
403
- input: Primitive<update.Input>
404
- ): Promise<update.Output>
405
- {
406
- return Fetcher.fetch
407
- (
408
- connection,
409
- update.ENCRYPTED,
410
- update.METHOD,
411
- update.path(section, saleId, id),
412
- input,
413
- update.stringify
414
- );
415
- }
416
- export namespace update
417
- {
418
- export type Input = Primitive<ISaleReview.IStore>;
419
- export type Output = Primitive<ISaleInquiry<ISaleReview.IContent>>;
420
-
421
- export const METHOD = "PUT" as const;
422
- export const PATH: string = "/consumers/:section/sales/:saleId/reviews/:id";
423
- export const ENCRYPTED: Fetcher.IEncrypted = {
424
- request: false,
425
- response: false,
426
- };
427
-
428
- export function path(section: string, saleId: string, id: number): string
429
- {
430
- return `/consumers/${section}/sales/${saleId}/reviews/${id}`;
141
+ /**
142
+ * @minimum 18
143
+ */
144
+ age: number;
431
145
  }
432
- export const stringify = (input: Input) => TSON.stringify(input);
433
146
  }
434
147
  ```
435
148
 
436
149
 
437
150
 
438
151
 
439
- ### Swagger
440
- Building `Swagger` is also possible and even much powerful.
441
-
442
- Looking at the [simple/swagger.json](https://editor.swagger.io/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fsamchon%2Fnestia%2Fmaster%2Fdemo%2Fsimple%2Fswagger.json) file, generated by `nestia`, everything is perfect. Route method, path and parameters are well-formed. Also, schema definitions are exactly matched with the pure interface type `ISaleArticleComment`. Of course, descriptive comments are perfectly resurrected in the `description` properties of the `swagger.json` file.
443
-
444
- Looking at the another file [generic/swagger.json](https://editor.swagger.io/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fsamchon%2Fnestia%2Fmaster%2Fdemo%2Fgeneric%2Fswagger.json), you can find that there isn't any problem even when a generic typed DTO and controller come. The last file [union/swagger.json](https://editor.swagger.io/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fsamchon%2Fnestia%2Fmaster%2Fdemo%2Funion%2Fswagger.json), there's no problem on the union type, either.
445
-
446
- - View in the `Swagger Editor`
447
- - [simple/swagger.json](https://editor.swagger.io/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fsamchon%2Fnestia%2Fmaster%2Fdemo%2Fsafe%2Fswagger.json)
448
- - [generic/swagger.json](https://editor.swagger.io/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fsamchon%2Fnestia%2Fmaster%2Fdemo%2Fgeneric%2Fswagger.json)
449
- - [union/swagger.json](https://editor.swagger.io/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fsamchon%2Fnestia%2Fmaster%2Fdemo%2Funion%2Fswagger.json)
152
+ ## `@nestia/sdk`
153
+ [![npm version](https://img.shields.io/npm/v/@nestia/sdk.svg)](https://www.npmjs.com/package/@nestia/sdk)
154
+ [![Downloads](https://img.shields.io/npm/dm/@nestia/sdk.svg)](https://www.npmjs.com/package/@nestia/sdk)
450
155
 
451
- ![Swagger Editor](https://github.com/samchon/nestia/wiki/images/swagger-editor-comment.png)
156
+ Automatic *SDK* and *Swagger* generator for [@nestia/core](#nestiacore).
452
157
 
158
+ With [@nestia/core](#nestiacore), you can boost up validation speed maximum **15,000x times faster**. However, as `@nestjs/swagger` does not support [@nestia/core](#nestiacore), you can't generate swagger documents from `@nestjs/swagger` more.
453
159
 
160
+ Instead, I provide you `@nestia/sdk` module, which can generate not only swagger documents, but also SDK (Software Development Kit) library.
454
161
 
455
-
456
- ## Configuration
457
- Components | `nestia.config.ts` | `CLI` | `@nestjs/swagger`
458
- -----------------------------|--------------------|-------|------------------
459
- Swagger Generation | ✔ | ✔ | ✔
460
- SDK Generation | ✔ | ✔ | ❌
461
- 5x faster `JSON.stringify()` | ✔ | ❌ | ❌
462
- Type check in runtime | ✔ | ❌ | ❌
463
- Custom compiler options | ✔ | ❌ | ❌
464
-
465
- `nestia` can configure generator options by two ways: CLI and configuration file.
466
-
467
- At first, the CLI (Command Line Interface) is convenient, but does not support detailed options.
468
-
469
- ```sh
162
+ ### Usage
163
+ ```bash
470
164
  # BASIC COMMAND
471
165
  npx nestia <sdk|swagger> <source_directories_or_patterns> \
472
166
  --exclude <exclude_directory_or_pattern> \
473
167
  --out <output_directory_or_file>
474
168
 
475
169
  # EXAMPLES
476
- npx nestia sdk "src/controllers" --out "src/api"
477
- npx nestia swagger "src/**/*.controller.ts" --out "swagger.json"
478
- npx nestia swagger "src/main/controllers" "src/sub/controllers" \
479
- --exclude "src/main/test" \
480
- --out "composite.swagger.json"
170
+ npx nestia sdk "src/**/*.controller.ts" --out "src/api"
171
+ npx nestia swagger "src/controllers" --out "dist/swagger.json"
172
+ ```
481
173
 
482
- # ONLY WHEN NESTIA.CONFIG.TS EXISTS
174
+ You can generate sdk or swagger documents by above commands.
175
+
176
+ If you've configured `nestia.config.ts` file, you can omit all options like below. About the `nestia.config.ts` file, read [Guide Documents - Configuration](https://github.com/samchon/nestia/wiki/Configuration)
177
+
178
+ ```bash
483
179
  npx nestia sdk
484
180
  npx nestia swagger
485
181
  ```
486
182
 
487
- Besides, the configuration file `nestia.config.ts` supports much detailed options.
488
-
489
- The detailed options are listed up to the `IConfiguration` interface. You can utilize the `IConfiguration` type like below. If you want to know more about those options, please check the [Guide Documents](https://github.com/samchon/nestia/wiki/Configuration).
490
-
491
- <details>
492
- <summary> Read <code>IConfiguration</code> </summary>
183
+ ### Demonstration
184
+ When you generate SDK library through `npx nestia sdk` command, `@nestia/sdk` will generate below code, by analyzing your backend source code in the compilation level.
493
185
 
494
186
  ```typescript
495
- import ts from "typescript";
496
- import type { StripEnums } from "./utils/StripEnums";
187
+ import { Fetcher, IConnection } from "@nestia/fetcher";
188
+ import { IBbsArticle } from "../../../structures/IBbsArticle";
497
189
 
498
190
  /**
499
- * Definition for the `nestia.config.ts` file.
500
- *
501
- * @author Jeongho Nam - https://github.com/samchon
191
+ * Store a new content.
192
+ *
193
+ * @param input Content to store
194
+ * @returns Newly archived article
502
195
  */
503
- export interface IConfiguration {
504
- /**
505
- * List of files or directories containing the NestJS controller classes.
506
- */
507
- input: string | string[] | IConfiguration.IInput;
508
-
509
- /**
510
- * Output directory that SDK would be placed in.
511
- *
512
- * If not configured, you can't build the SDK library.
513
- */
514
- output?: string;
515
-
516
- /**
517
- * Compiler options for the TypeScript.
518
- *
519
- * If you've omitted this property or the assigned property cannot fully cover the
520
- * `tsconfig.json`, the properties from the `tsconfig.json` would be assigned to here.
521
- * Otherwise, this property has been configured and it's detailed values are different
522
- * with the `tsconfig.json`, this property values would be used instead.
523
- *
524
- * ```typescript
525
- * import ts from "typescript";
526
- *
527
- * const tsconfig: ts.TsConfig;
528
- * const nestiaConfig: IConfiguration;
529
- *
530
- * const compilerOptions: ts.CompilerOptions = {
531
- * ...tsconfig.compilerOptions,
532
- * ...(nestiaConfig.compilerOptions || {})
533
- * }
534
- * ```
535
- */
536
- compilerOptions?: StripEnums<ts.CompilerOptions>;
537
-
538
- /**
539
- * Whether to assert parameter types or not.
540
- *
541
- * If you configure this property to be `true`, all of the function parameters would be
542
- * checked through the [typescript-json](https://github.com/samchon/typescript-json#runtime-type-checkers).
543
- * This option would make your SDK library slower, but would enahcne the type safety even
544
- * in the runtime level.
545
- *
546
- * @default false
547
- */
548
- assert?: boolean;
549
-
550
- /**
551
- * Whether to optimize JSON string conversion 2x faster or not.
552
- *
553
- * If you configure this property to be `true`, the SDK library would utilize the
554
- * [typescript-json](https://github.com/samchon/typescript-json#fastest-json-string-converter)
555
- * and the JSON string conversion speed really be 2x faster.
556
- *
557
- * @default false
558
- */
559
- json?: boolean;
560
-
561
- /**
562
- * Whether to wrap DTO by primitive type.
563
- *
564
- * If you don't configure this property as `false`, all of DTOs in the
565
- * SDK library would be automatically wrapped by {@link Primitive} type.
566
- *
567
- * For refenrece, if a DTO type be capsuled by the {@link Primitive} type,
568
- * all of methods in the DTO type would be automatically erased. Also, if
569
- * the DTO has a `toJSON()` method, the DTO type would be automatically
570
- * converted to return type of the `toJSON()` method.
571
- *
572
- * @default true
573
- */
574
- primitive?: boolean;
575
-
576
- /**
577
- * Building `swagger.json` is also possible.
578
- *
579
- * If not specified, you can't build the `swagger.json`.
580
- */
581
- swagger?: IConfiguration.ISwagger;
196
+ export function store(
197
+ connection: api.IConnection,
198
+ input: IBbsArticle.IStore
199
+ ): Promise<IBbsArticle> {
200
+ return Fetcher.fetch(
201
+ connection,
202
+ store.ENCRYPTED,
203
+ store.METHOD,
204
+ store.path(),
205
+ input
206
+ );
582
207
  }
583
- export namespace IConfiguration {
584
- /**
585
- * List of files or directories to include or exclude to specifying the NestJS
586
- * controllers.
587
- */
588
- export interface IInput {
589
- /**
590
- * List of files or directories containing the NestJS controller classes.
591
- */
592
- include: string[];
593
-
594
- /**
595
- * List of files or directories to be excluded.
596
- */
597
- exclude?: string[];
598
- }
599
-
600
- /**
601
- * Building `swagger.json` is also possible.
602
- */
603
- export interface ISwagger {
604
- /**
605
- * Output path of the `swagger.json`.
606
- *
607
- * If you've configured only directory, the file name would be the `swagger.json`.
608
- * Otherwise you've configured the full path with file name and extension, the
609
- * `swagger.json` file would be renamed to it.
610
- */
611
- output: string;
208
+ export namespace store {
209
+ export const METHOD = "POST" as const;
210
+ export function path(): string {
211
+ return "/bbs/articles";
612
212
  }
613
213
  }
614
-
615
- ```
616
- </details>
617
-
618
- ```typescript
619
- import type { IConfiguration } from "nestia";
620
-
621
- export const NESTIA_CONFIG: IConfiguration = {
622
- input: "./src/controllers",
623
- output: "./src/api",
624
- json: true,
625
- swagger: {
626
- output: "./public/swagger.json"
627
- }
628
- };
629
- export default NESTIA_CONFIG;
630
214
  ```
631
215
 
216
+ With SDK library, client developers would get take advantages of TypeScript like below.
632
217
 
218
+ If you want to learn how to distribute SDK library, visit and read [Guide Documents - Distribution](https://github.com/samchon/nestia/wiki/Distribution).
633
219
 
220
+ ```typescript
221
+ import api from "@bbs-api";
222
+ import typia from "typia";
634
223
 
635
- ## Appendix
636
- ### Dependencies of the SDK
637
- An SDK library generated by `nestia` requires [nestia-fetcher](https://github.com/samchon/nestia-fetcher) module. Also, [typescript-json](https://github.com/samchon/typescript-json) module can be required following your `nestia.config.ts` configuration file.
638
-
639
- The `npx nestia install` command installs those dependencies with the `package.json` configuration.
640
-
641
- ```bash
642
- # MOVE TO THE DISTRIBUTION DIRECTORY
643
- cd packages/api
644
-
645
- # INSTALL DEPENDENCIES OF THE SDK
646
- npx nestia install
224
+ export async function test_bbs_article_store(connection: api.IConnection) {
225
+ const article: IBbsArticle = await api.functional.bbs.articles.store(
226
+ connection,
227
+ {
228
+ name: "John Doe",
229
+ title: "some title",
230
+ content: "some content",
231
+ }
232
+ );
233
+ typia.assert(article);
234
+ console.log(article);
235
+ }
647
236
  ```
648
237
 
649
- ### Nestia-Helper
650
- https://github.com/samchon/nestia-helper
651
238
 
652
- If you utilize `nestia` with [nestia-helper](https://github.com/samchon/nestia-helper), you can automatically validatea pure DTO interace without any extra dedication. It analyzes your backend server code in the compilation level and add request body validation code automatically.
653
239
 
654
- ```typescript
655
- import helper from "nestia-helper";
656
- import { Controller } from "@nestjs/common";
657
240
 
658
- @Controller("bbs/articles")
659
- export class BbsArticlesController {
660
- //----
661
- // `TSON.stringify()` for `IBbsArticle`
662
- // Boost up JSON conversion speed about 5x times faster
663
- //----
664
- // `TSON.assert()` for `IBbsArticle.IStore`
665
- // If client request body is not following type type,
666
- // `BadRequestException` (status code: 400) would be thrown
667
- //----
668
- @helper.TypedRoute.Post()
669
- public async store(
670
- // automatic validation
671
- @helper.TypedBody() input: IBbsArticle.IStore
672
- ): Promise<IBbsArticle> {
673
- const article: BbsArticle = await BbsArticeProvider.store(input);
674
- const json: IBbsArticle = await BbsArticleProvider.json().getOne(article);
675
-
676
- // 5x times faster JSON conversion
677
- return Paginator.paginate(stmt, input);
678
- }
679
- }
680
- ```
241
+ ## Appendix
242
+ ### Typia
243
+ > https://github.com/samchon/typia
244
+ >
245
+ > `@nestia/core` is wrapping `typia` and the `typia` is:
681
246
 
682
- ### TypeScript-JSON
683
- https://github.com/samchon/typescript-json
247
+ [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/typia/blob/master/LICENSE)
248
+ [![npm version](https://img.shields.io/npm/v/typia.svg)](https://www.npmjs.com/package/typia)
249
+ [![Downloads](https://img.shields.io/npm/dm/typia.svg)](https://www.npmjs.com/package/typia)
250
+ [![Build Status](https://github.com/samchon/typia/workflows/build/badge.svg)](https://github.com/samchon/typia/actions?query=workflow%3Abuild)
251
+ [![Guide Documents](https://img.shields.io/badge/wiki-documentation-forestgreen)](https://github.com/samchon/typia/wiki)
684
252
 
685
253
  ```typescript
686
- import TSON from "typescript-json";
687
-
688
- //----
689
254
  // RUNTIME VALIDATORS
690
- //----
691
- // ALLOW SUPERFLUOUS PROPERTIES
692
- TSON.assert<T>(input); // throws exception
693
- TSON.is<T>(input); // returns boolean value
694
- TSON.validate<T>(input); // archives all errors
695
-
696
- // DO NOT ALLOW SUPERFLUOUS PROPERTIES
697
- TSON.equals<T>(input); // returns boolean value
698
- TSON.assert<T>(input); // throws exception
699
- TSON.validateEquals<T>(input); // archives all errors
700
-
701
- //----
702
- // APPENDIX FUNCTIONS
703
- //----
704
- TSON.stringify<T>(input); // 5x faster JSON.stringify()
705
- TSON.application<[T, U, V], "swagger">(); // JSON schema application generator
706
- TSON.create<T>(input); // 2x faster object creator (only one-time construction)
255
+ export function is<T>(input: unknown | T): input is T; // returns boolean
256
+ export function assert<T>(input: unknown | T): T; // throws TypeGuardError
257
+ export function validate<T>(input: unknown | T): IValidation<T>; // detailed
258
+
259
+ // STRICT VALIDATORS
260
+ export function equals<T>(input: unknown | T): input is T;
261
+ export function assertEquals<T>(input: unknown | T): T;
262
+ export function validateEquals<T>(input: unknown | T): IValidation<T>;
263
+
264
+ // JSON
265
+ export function application<T>(): IJsonApplication; // JSON schema
266
+ export function assertParse<T>(input: string): T; // type safe parser
267
+ export function assertStringify<T>(input: T): string; // safe and faster
268
+ // +) isParse, validateParse
269
+ // +) stringify, isStringify, validateStringify
707
270
  ```
708
271
 
709
- `typescript-json` is a transformer library providing JSON related functions.
272
+ `typia` is a transformer library of TypeScript, supporting below features:
710
273
 
711
- - Powerful Runtime type checkers:
712
- - Performed by only one line, `TSON.assert<T>(input)`
713
- - Only one library which can validate union type
714
- - Maximum 9,000x faster than other libraries
715
- - 5x faster `JSON.stringify()` function:
716
- - Performed by only one line: `TSON.stringify<T>(input)`
717
- - Only one library which can stringify union type
718
- - 10,000x faster optimizer construction time than similar libraries
274
+ - Super-fast Runtime Validators
275
+ - Safe JSON parse and fast stringify functions
276
+ - JSON schema generator
719
277
 
720
- [typescript-json](https://github.com/samchon/typescript-json) analyzes TypeScript source code and generates optimized validators and JSON string converters in the compilation level. It is the reason why `nestia` can generate SDK library is by analyzing NestJS code and how [nestia-helper](https://github.com/samchon/nestia-helper) validates request body data automatically.
278
+ 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)`.
721
279
 
722
- Also, its performance enhancement is much greater than other libraries. For example, validator function `TSON.is<T>(input: T): boolean` is maximum 9,000x times faster than other validator libraries.
280
+ 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`.