nestia 2.1.0 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CONTRIBUTING.md CHANGED
@@ -42,7 +42,7 @@ If you succeeded to compile, but failed to pass the test-automation, then *debug
42
42
  ### Adding a Test
43
43
  As this `nestia` is not a typical library who being used by the `import` statement but a executable program generating the SDK (Software Development Kit), adding a test means that adding a demonstration project.
44
44
 
45
- I know that adding a demonstration project is much difficult than adding a test function, but there's no way if newly contributed code requires a new type of testing tool. Looking at the [src/test/demonstratios](src/test/demonstrations) directory and traveling the demonstration projects, create a new demonstration project following their structures and styles.
45
+ I know that adding a demonstration project is much difficult than adding a test function, but there's no way if newly contributed code requires a new type of testing tool. Looking at the [src/test/demonstratios](demo) directory and traveling the demonstration projects, create a new demonstration project following their structures and styles.
46
46
 
47
47
  Of course, if your contribution code does not require a test new project, don't mind this.
48
48
 
package/README.md CHANGED
@@ -20,15 +20,16 @@ npx nestia sdk "src/**/*.controller.ts" --out "src/api"
20
20
  npx nestia swagger "src/controller" -- out "swagger.json"
21
21
  ```
22
22
 
23
- Don't write any `swagger` comment and DTO decorator. Just run the **Nestia** up.
23
+ Don't write any `swagger` comment and DTO decorator. Just run the [nestia](https://github.com/samchon/nestia) up.
24
24
 
25
25
  - No swagger comment/decorator
26
26
  - No DTO comment/decorator
27
27
  - Only pure NestJS code is required
28
+ - [Guide Documents (Wiki)](https://github.com/samchon/nestia/wiki), if you want to know more
28
29
 
29
30
  When you're developing a backend server using the `NestJS`, you don't need any extra dedication, for delivering the Rest API to the client developers, like writing the `swagger` comments or DTO decorators.
30
31
 
31
- You just run this **Nestia** up, then **Nestia** would generate the SDK automatically, by analyzing your controller classes in the compliation and runtime level. With the automatically generated SDK through this **Nestia**, client developer also does not need any extra work, like reading `swagger` and writing the duplicated interaction code. Client developer only needs to import the SDK and calls matched function with the `await` symbol.
32
+ You just run this [nestia](https://github.com/samchon/nestia) up, then [nestia](https://github.com/samchon/nestia) would generate the SDK automatically, by analyzing your controller classes in the compliation and runtime level. With the automatically generated SDK through this [nestia](https://github.com/samchon/nestia), client developer also does not need any extra work, like reading `swagger` and writing the duplicated interaction code. Client developer only needs to import the SDK and calls matched function with the `await` symbol.
32
33
 
33
34
  > Even generating the `swagger.json` without any swagger comment and DTO decorator is also possible. When generating the `swagger.json`, no DTO comment and decorator is required, either. Use only the pure interface definitions.
34
35
 
@@ -67,7 +68,7 @@ export async function test_article_read(connection: api.IConnection): Promise<vo
67
68
  npm install --save-dev nestia
68
69
  ```
69
70
 
70
- Installing the **Nestia** is very easy.
71
+ Installing the [nestia](https://github.com/samchon/nestia) is very easy.
71
72
 
72
73
  Just type the `npm install --save-dev nestia` command in your NestJS backend project.
73
74
 
@@ -81,7 +82,7 @@ npx nestia sdk "src/controllers/consumers" "src/controllers/sellers" --out "src/
81
82
  npx nestia sdk "src/controllers" --exclude "src/**/Fake*.ts" --out "src/api"
82
83
  ```
83
84
 
84
- To generate a SDK library through the **Nestia** is very easy.
85
+ To generate a SDK library through the [nestia](https://github.com/samchon/nestia) is very easy.
85
86
 
86
87
  Just type the `nestia sdk <input> --out <output>` command in the console. When there're multiple source directories containing the NestJS controller classes, type all of them separating by a `space` word. If you want to exclude some directories or files from the SDK generation, the `--exclude` option would be useful.
87
88
 
@@ -97,7 +98,7 @@ npx nestia swagger "src/consumers" "src/sellers" --out "actors.json"
97
98
  npx nestia swagger "src/controllers" --exclude "src/**/Fake*.ts" -out "./"
98
99
  ```
99
100
 
100
- The **Nestia** even supports the `swagger.json` generation and it's also extermely easy.
101
+ The [nestia](https://github.com/samchon/nestia) even supports the `swagger.json` generation and it's also extermely easy.
101
102
 
102
103
  Jsut type the `nestia swagger <input> --out <output>` command in the console. When there're multiple source directories containing the NestJS controller classes, type all of them separating by a `space` word. If you want to exclude some directories or files from the `swagger.json` generation, the `--exclude` option would be useful.
103
104
 
@@ -108,7 +109,7 @@ Also, when generating a SDK using the cli options, `compilerOptions` would follo
108
109
  npx nestia install
109
110
  ```
110
111
 
111
- SDK library generated by the **Nestia** requires the [nestia-fetcher](https://github.com/samchon/nestia-fetcher) module. Also, the [typescript-is](https://github.com/woutervh-/typescript-is) and [typescript-json](https://github.com/samchon/typescript-json) modules can be required following your [nestia.config.ts](#nestiaconfigts) options.
112
+ SDK library generated by the [nestia](https://github.com/samchon/nestia) requires the [nestia-fetcher](https://github.com/samchon/nestia-fetcher) module. Also, the [typescript-is](https://github.com/woutervh-/typescript-is) and [typescript-json](https://github.com/samchon/typescript-json) modules can be required following your [nestia.config.ts](#nestiaconfigts) options.
112
113
 
113
114
  The `npx nestia install` command installs those dependencies with `package.json` configuration.
114
115
 
@@ -242,9 +243,9 @@ export default config;
242
243
 
243
244
 
244
245
  ### Recommended Structures
245
- When developing a NestJS backend server with this **Nestia**, I recommend you to follow below directory structure. The key princinple of below structure is to gathering all of the DTO interface structures into the `src/api/structures` directory and gather all of the controller classes into the `src/controllers` directory.
246
+ When developing a NestJS backend server with this [nestia](https://github.com/samchon/nestia), I recommend you to follow below directory structure. The key princinple of below structure is to gathering all of the DTO interface structures into the `src/api/structures` directory and gather all of the controller classes into the `src/controllers` directory.
246
247
 
247
- If you place the SDK onto the `src/api` directory and gather all of the DTO interface structures into the `src/api/structures` directory, you can publish the SDK library very easily without any special configuration. Also when you're develop the test automation program, you can implement the API testing features very convenienty through the automatically generated SDK through this **Nestia**.
248
+ If you place the SDK onto the `src/api` directory and gather all of the DTO interface structures into the `src/api/structures` directory, you can publish the SDK library very easily without any special configuration. Also when you're develop the test automation program, you can implement the API testing features very convenienty through the automatically generated SDK through this [nestia](https://github.com/samchon/nestia).
248
249
 
249
250
  - src
250
251
  - api
@@ -258,7 +259,7 @@ If you place the SDK onto the `src/api` directory and gather all of the DTO inte
258
259
  - tsconfig.json
259
260
  - nestia.config.ts
260
261
 
261
- For your deep understanding about this directory structure with this **Nestia**, I've prepared an example backend project. Looking around the example repository and reading the [README.md](https://github.com/samchon/backend#13-directories) of it, you can feel that such directory structure is how convenient for SDK publishing and test automation program implementation.
262
+ For your deep understanding about this directory structure with this [nestia](https://github.com/samchon/nestia), I've prepared an example backend project. Looking around the example repository and reading the [README.md](https://github.com/samchon/backend#13-directories) of it, you can feel that such directory structure is how convenient for SDK publishing and test automation program implementation.
262
263
 
263
264
  - https://github.com/samchon/backend
264
265
 
@@ -266,33 +267,30 @@ For your deep understanding about this directory structure with this **Nestia**,
266
267
 
267
268
 
268
269
  ## Demonstration
269
- To demonstrate which SDK codes would be generated by this **Nestia**:
270
+ To demonstrate which SDK codes would be generated by this [nestia](https://github.com/samchon/nestia):
270
271
 
271
272
  - Representative files
272
- - [DTO interface used in the RestAPI](https://github.com/samchon/nestia/tree/master/src/test/demonstrations/default/src/api/structures/sales/articles/ISaleArticle.ts)
273
- - [Controllers of the NestJS](https://github.com/samchon/nestia/tree/master/src/test/demonstrations/default/src/controllers/base/SaleCommentsController.ts)
274
- - [SDK generated by this **Nestia**](https://github.com/samchon/nestia/tree/master/src/test/demonstrations/default/src/api/functional/consumers/sales/reviews/index.ts)
273
+ - [DTO interface used in the RestAPI](https://github.com/samchon/nestia/tree/master/demo/simple/src/api/structures/ISaleArticleComment.ts)
274
+ - [Controllers of the NestJS](https://github.com/samchon/nestia/tree/master/demo/simple/src/controllers/ConsumerSaleArticleCommentsController.ts)
275
+ - [SDK generated by this **nestia**](https://github.com/samchon/nestia/tree/master/demo/simple/src/api/functional/consumers/sales/articles/comments/index.ts)
276
+ - [`swagger.json` generated by this **nestia**](https://github.com/samchon/nestia/tree/master/demo/simple/swagger.json)
275
277
  - Demonstration Projects
276
- - [absolute](https://github.com/samchon/nestia/tree/master/src/test/demonstrations/absolute): Absolute path with the `baseUrl` option
277
- - [alias@api](https://github.com/samchon/nestia/tree/master/src/test/demonstrations/alias@api): The `src/api` directory has been aliased by `paths` option
278
- - [alias@src](https://github.com/samchon/nestia/tree/master/src/test/demonstrations/alias@src): Entire `src` directory has been aliased by `paths` option
279
- - [default](https://github.com/samchon/nestia/tree/master/src/test/demonstrations/default): No `tsconfig.json` and `nestia.config.ts`
280
- - [esnext](https://github.com/samchon/nestia/tree/master/src/test/demonstrations/esnext): ECMAScript target version is `ESNEXT`
281
- - [exclude](https://github.com/samchon/nestia/tree/master/src/test/demonstrations/exclude): Exclude option using the `--exclude` commad
282
- - [nestia.config.ts](https://github.com/samchon/nestia/tree/master/src/test/demonstrations/nestia.config.ts): Configured `nestia.config.ts` with `assert` mode
283
- - [reference](https://github.com/samchon/nestia/tree/master/src/test/demonstrations/reference): Configured input files as `src/**/*.controller.ts`
284
- - [tsconfig.json](https://github.com/samchon/nestia/tree/master/src/test/demonstrations/tsconfig.json): Special configuration through the `tsconfig.json`
278
+ - [encrypt](https://github.com/samchon/nestia/tree/master/demo/encrypt): Request and response body are fully encrypted
279
+ - [generic](https://github.com/samchon/nestia/tree/master/demo/generic): Generic typed controller classes
280
+ - [recursive](https://github.com/samchon/nestia/tree/master/demo/recursive): Recursive DTO interface, [swagger editor](https://editor.swagger.io) can't expresss it
281
+ - [simple](https://github.com/samchon/nestia/tree/master/demo/simple): Simple DTO interface and controller class
282
+ - [union](https://github.com/samchon/nestia/tree/master/demo/union): Only [nestia](https://github.com/samchon/nestia) can handle the union typed DTO interface
285
283
 
286
284
  ### DTO
287
- As you can see from the below code, the **Nestia** can use the interface directory.
285
+ Using pure interface type as DTO is possible.
288
286
 
289
- You dont' need to define any extra comment or decorator function to make the DTO (Data Transfer Object). Just define the DTO as a pure interface structure, then **Nestia** will do everything instead of you.
287
+ You dont' need to define any extra comment or decorator function to make the DTO (Data Transfer Object). Just define the DTO as a pure interface structure, then [nestia](https://github.com/samchon/nestia) will do everything instead of you.
290
288
 
291
289
  If you're afraiding because your type is union or intersection, I can say that it does not matter. Even when generic or conditional type comes, it does not matter. Just enjoy the pure TypeScript type.
292
290
 
293
291
  ```typescript
294
292
  /**
295
- * Comment wrote on an article.
293
+ * Comment wrote on a sale related article.
296
294
  *
297
295
  * @author Jeongho Nam - https://github.com/samchon
298
296
  */
@@ -355,7 +353,7 @@ export namespace ISaleComment
355
353
  ```
356
354
 
357
355
  ### Controller
358
- If you've decided to adapt this **Nestia** and you want to generate the SDK directly, you don't need any extra work. Just keep you controller class down and do noting. The only one exceptional case that you need an extra dedication is, when you want to explain about the API function to the client developers through the comments.
356
+ If you've decided to adapt this [nestia](https://github.com/samchon/nestia) and you want to generate the SDK directly, you don't need any extra work. Just keep you controller class down and do noting. The only one exceptional case that you need an extra dedication is, when you want to explain about the API function to the client developers through the comments.
359
357
 
360
358
  ```typescript
361
359
  @nest.Controller("consumers/:section/sales/:saleId/questions")
@@ -385,7 +383,7 @@ export class ConsumerSaleQuestionsController
385
383
  ```
386
384
 
387
385
  ### SDK
388
- When you run the **Nestia** up using the upper controller class `ConsumerSaleQuestionsController`, the **Nestia** would generate below function for the client developers, by analyzing the `ConsumerSaleQuestionsController` class in the compilation and runtime level.
386
+ When you run the [nestia](https://github.com/samchon/nestia) up using the upper controller class `ConsumerSaleQuestionsController`, the [nestia](https://github.com/samchon/nestia) would generate below function for the client developers, by analyzing the `ConsumerSaleQuestionsController` class in the compilation and runtime level.
389
387
 
390
388
  As you can see, the comments from the `ConsumerSaleQuestionsController.store()` are fully copied to the SDK function. Therefore, if you want to deliver detailed description about the API function, writing the detailed comment would be tne best choice.
391
389
 
@@ -445,7 +443,7 @@ export namespace store
445
443
  ### `swagger.json`
446
444
  Even the `swagger.json` generation does not require any swagger comment and DTO decorator.
447
445
 
448
- The **Nestia** will generate the perfect `swagger.json` automatically, by analyzing your source code (DTO interface and controller class) in the compilation and runtime level. Furthermore, your descriptive comments would be automatically assigned into the adequate `description` property in the `swagger.json`.
446
+ The [nestia](https://github.com/samchon/nestia) will generate the perfect `swagger.json` automatically, by analyzing your source code (DTO interface and controller class) in the compilation and runtime level. Furthermore, your descriptive comments would be automatically assigned into the adequate `description` property in the `swagger.json`.
449
447
 
450
448
  ```json
451
449
  {
@@ -617,20 +615,20 @@ The **Nestia** will generate the perfect `swagger.json` automatically, by analyz
617
615
  ### Template Project
618
616
  https://github.com/samchon/backend
619
617
 
620
- I support template backend project using this **Nestia*** library, [backend](https://github.com/samchon/backend).
618
+ I support template backend project using this [nestia](https://github.com/samchon/nestia) library, [backend](https://github.com/samchon/backend).
621
619
 
622
- Reading the README content of the [backend](https://github.com/samchon/backend) template repository, you can find lots of example backend projects who've been generated from the [backend](https://github.com/samchon/backend). Furthermore, those example projects guide how to generate SDK library from the **Nestia** and how to distribute the SDK library thorugh the NPM module.
620
+ Reading the README content of the [backend](https://github.com/samchon/backend) template repository, you can find lots of example backend projects who've been generated from the [backend](https://github.com/samchon/backend). Furthermore, those example projects guide how to generate SDK library from the [nestia](https://github.com/samchon/nestia) and how to distribute the SDK library thorugh the NPM module.
623
621
 
624
- Therefore, if you're planning to compose your own backend project using this **Nestia**, I recommend you to create the repository and learn from the [backend](https://github.com/samchon/backend) template project.
622
+ Therefore, if you're planning to compose your own backend project using this [nestia](https://github.com/samchon/nestia), I recommend you to create the repository and learn from the [backend](https://github.com/samchon/backend) template project.
625
623
 
626
624
  ### Nestia-Helper
627
625
  https://github.com/samchon/nestia-helper
628
626
 
629
- Helper library of the `NestJS` with **Nestia**.
627
+ Helper library of the `NestJS` with [nestia](https://github.com/samchon/nestia).
630
628
 
631
- [nestia-helper](https://github.com/samchon/nestia-helper) is a type of helper library for `Nestia` by enhancing decorator functions. Also, all of the decorator functions provided by this [nestia-helper](https://github.com/samchon/nestia-helper) are all fully compatible with the **Nestia**, who can generate SDK library by analyzing NestJS controller classes in the compilation level.
629
+ [nestia-helper](https://github.com/samchon/nestia-helper) is a type of helper library for `Nestia` by enhancing decorator functions. Also, all of the decorator functions provided by this [nestia-helper](https://github.com/samchon/nestia-helper) are all fully compatible with the [nestia](https://github.com/samchon/nestia), who can generate SDK library by analyzing NestJS controller classes in the compilation level.
632
630
 
633
- Of course, this [nestia-helper](https://github.com/samchon/nestia-helper) is not essential for utilizing the `NestJS` and **Nestia**. You can generate SDK library of your NestJS developed backend server without this [nestia-helper](https://github.com/samchon/nestia-helper). However, as decorator functions of this [nestia-helper](https://github.com/samchon/nestia-helper) is enough strong, I recommend you to adapt this [nestia-helper](https://github.com/samchon/nestia-helper) when using `NestJS` and **Nestia**.
631
+ Of course, this [nestia-helper](https://github.com/samchon/nestia-helper) is not essential for utilizing the `NestJS` and [nestia](https://github.com/samchon/nestia). You can generate SDK library of your NestJS developed backend server without this [nestia-helper](https://github.com/samchon/nestia-helper). However, as decorator functions of this [nestia-helper](https://github.com/samchon/nestia-helper) is enough strong, I recommend you to adapt this [nestia-helper](https://github.com/samchon/nestia-helper) when using `NestJS` and [nestia](https://github.com/samchon/nestia).
634
632
 
635
633
  - Supported decorator functions
636
634
  - [EncryptedController](https://github.com/samchon/nestia-helper#encryptedcontroller), [EncryptedModule](https://github.com/samchon/nestia-helper#encryptedmodule)
@@ -643,7 +641,7 @@ https://github.com/samchon/safe-typeorm
643
641
 
644
642
  [safe-typeorm](https://github.com/samchon/safe-typeorm) is another library that what I've developed, helping `TypeORM` in the compilation level and optimizes DB performance automatically without any extra dedication.
645
643
 
646
- Therefore, this **Nestia** makes you to be much convenient in the API interaction level and safe-typeorm helps you to be much convenient in the DB interaction level. With those **Nestia** and [safe-typeorm](https://github.com/samchon/safe-typeorm), let's implement the backend server much easily and conveniently.
644
+ Therefore, this [nestia](https://github.com/samchon/nestia) makes you to be much convenient in the API interaction level and safe-typeorm helps you to be much convenient in the DB interaction level. With those [nestia](https://github.com/samchon/nestia) and [safe-typeorm](https://github.com/samchon/safe-typeorm), let's implement the backend server much easily and conveniently.
647
645
 
648
646
  - When writing [**SQL query**](https://github.com/samchon/safe-typeorm#safe-query-builder),
649
647
  - Errors would be detected in the **compilation** level
@@ -658,11 +656,11 @@ Therefore, this **Nestia** makes you to be much convenient in the API interactio
658
656
  - Sequence of tables would be automatically sorted by analyzing dependencies
659
657
  - The **performance** would be **automatically tuned**
660
658
 
661
- ![Safe-TypeORM Demo](https://raw.githubusercontent.com/samchon/safe-typeorm/master/assets/demonstrations/safe-query-builder.gif)
659
+ ![Safe-TypeORM Demo](https://raw.githubusercontent.com/samchon/safe-typeorm/master/assets/demo/safe-query-builder.gif)
662
660
 
663
661
  ### Archidraw
664
662
  https://www.archisketch.com/
665
663
 
666
664
  I have special thanks to the Archidraw, where I'm working for.
667
665
 
668
- The Archidraw is a great IT company developing 3D interior editor and lots of solutions based on the 3D assets. Also, the Archidraw is the first company who had adopted this **Nestia** on their commercial backend project, even this **Nestia** was in the alpha level.
666
+ The Archidraw is a great IT company developing 3D interior editor and lots of solutions based on the 3D assets. Also, the Archidraw is the first company who had adopted this [nestia](https://github.com/samchon/nestia) on their commercial backend project, even this [nestia](https://github.com/samchon/nestia) was in the alpha level.
@@ -11,31 +11,52 @@ export interface IConfiguration {
11
11
  input: string | string[] | IConfiguration.IInput;
12
12
  /**
13
13
  * Output directory that SDK would be placed in.
14
+ *
15
+ * If not configured, you can't build the SDK library.
14
16
  */
15
17
  output?: string;
16
18
  /**
17
19
  * Compiler options for the TypeScript.
18
20
  *
19
- * If omitted, the configuration would follow the `tsconfig.json`.
21
+ * If you've omitted this property or the assigned property cannot fully cover the
22
+ * `tsconfig.json`, the properties from the `tsconfig.json` would be assigned to here.
23
+ * Otherwise, this property has been configured and it's detailed values are different
24
+ * with the `tsconfig.json`, this property values would be used instead.
25
+ *
26
+ * ```typescript
27
+ * import ts from "typescript";
28
+ *
29
+ * const tsconfig: ts.TsConfig;
30
+ * const nestiaConfig: IConfiguration;
31
+ *
32
+ * const compilerOptions: ts.CompilerOptions = {
33
+ * ...tsconfig.compilerOptions,
34
+ * ...(nestiaConfig.compilerOptions || {})
35
+ * }
36
+ * ```
20
37
  */
21
38
  compilerOptions?: ts.CompilerOptions;
22
39
  /**
23
40
  * Whether to assert parameter types or not.
24
41
  *
25
- * If you configure this option to be `true`, all of the function parameters would be
26
- * checked through the [typescript-is](https://github.com/woutervh-/typescript-is).
42
+ * If you configure this property to be `true`, all of the function parameters would be
43
+ * checked through the [typescript-is](https://github.com/woutervh-/typescript-is). This
44
+ * option would make your SDK library slower, but would enahcne the type safety even in
45
+ * the runtime level.
27
46
  */
28
47
  assert?: boolean;
29
48
  /**
30
49
  * Whether to optimize JSON string conversion 2x faster or not.
31
50
  *
32
- * If you configure this option to be `true`, the SDK library would utilize the
51
+ * If you configure this property to be `true`, the SDK library would utilize the
33
52
  * [typescript-json](https://github.com/samchon/typescript-json) and the JSON string
34
53
  * conversion speed really be 2x faster.
35
54
  */
36
55
  json?: boolean;
37
56
  /**
38
57
  * Building `swagger.json` is also possible.
58
+ *
59
+ * If not specified, you can't build the `swagger.json`.
39
60
  */
40
61
  swagger?: IConfiguration.ISwagger;
41
62
  }
@@ -61,9 +82,9 @@ export declare namespace IConfiguration {
61
82
  /**
62
83
  * Output path of the `swagger.json`.
63
84
  *
64
- * If you've configure only directory, the file name would be `swagger.json`.
65
- * Otherwise you configure file name and extension, the `swagger.json` file would
66
- * be renamed to what you've configured.
85
+ * If you've configured only directory, the file name would be the `swagger.json`.
86
+ * Otherwise you've configured the full path with file name and extension, the
87
+ * `swagger.json` file would be renamed to it.
67
88
  */
68
89
  output: string;
69
90
  }
@@ -1 +1 @@
1
- {"version":3,"file":"IConfiguration.d.ts","sourceRoot":"","sources":["../src/IConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAE3B;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,cAAc,CAAC,MAAM,CAAC;IAEjD;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,eAAe,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC;IAErC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC;CACrC;AACD,yBAAiB,cAAc,CAC/B;IACI;;;OAGG;IACH,UAAiB,MAAM;QAEnB;;WAEG;QACH,OAAO,EAAE,MAAM,EAAE,CAAC;QAElB;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;KACtB;IAED;;OAEG;IACH,UAAiB,QAAQ;QAErB;;;;;;WAMG;QACH,MAAM,EAAE,MAAM,CAAC;KAClB;CACJ"}
1
+ {"version":3,"file":"IConfiguration.d.ts","sourceRoot":"","sources":["../src/IConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAE3B;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,cAAc,CAAC,MAAM,CAAC;IAEjD;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,eAAe,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC;IAErC;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;;;OAIG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC;CACrC;AACD,yBAAiB,cAAc,CAC/B;IACI;;;OAGG;IACH,UAAiB,MAAM;QAEnB;;WAEG;QACH,OAAO,EAAE,MAAM,EAAE,CAAC;QAElB;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;KACtB;IAED;;OAEG;IACH,UAAiB,QAAQ;QAErB;;;;;;WAMG;QACH,MAAM,EAAE,MAAM,CAAC;KAClB;CACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"ControllerAnalyzer.d.ts","sourceRoot":"","sources":["../../src/analyses/ControllerAnalyzer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAM9C,yBAAiB,kBAAkB,CACnC;IACI,SAAgB,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,GAAG,MAAM,EAAE,CAc7G;CA2IJ"}
1
+ {"version":3,"file":"ControllerAnalyzer.d.ts","sourceRoot":"","sources":["../../src/analyses/ControllerAnalyzer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAM9C,yBAAiB,kBAAkB,CACnC;IACI,SAAgB,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,GAAG,MAAM,EAAE,CAc7G;CAqJJ"}
@@ -76,47 +76,36 @@ var ControllerAnalyzer;
76
76
  CLASS
77
77
  --------------------------------------------------------- */
78
78
  function _Analyze_controller(checker, controller, classNode) {
79
- var e_1, _a, e_2, _b;
80
- var ret = [];
79
+ var e_1, _a;
81
80
  var classType = checker.getTypeAtLocation(classNode);
82
81
  var genericDict = GenericAnalyzer_1.GenericAnalyzer.analyze(checker, classNode);
82
+ var ret = [];
83
+ var _loop_1 = function (property) {
84
+ // GET METHOD DECLARATION
85
+ var declaration = (property.declarations || [])[0];
86
+ if (!declaration || !typescript_1.default.isMethodDeclaration(declaration))
87
+ return "continue";
88
+ // IDENTIFIER MUST BE
89
+ var identifier = declaration.name;
90
+ if (!typescript_1.default.isIdentifier(identifier))
91
+ return "continue";
92
+ // ANALYZED WITH THE REFLECTED-FUNCTION
93
+ var runtime = controller.functions.find(function (f) { return f.name === identifier.escapedText; });
94
+ if (runtime === undefined)
95
+ return "continue";
96
+ var route = _Analyze_function(checker, controller, genericDict, runtime, property);
97
+ ret.push(route);
98
+ };
83
99
  try {
84
- for (var _c = __values(classType.getProperties()), _d = _c.next(); !_d.done; _d = _c.next()) {
85
- var property = _d.value;
86
- if (property.declarations) {
87
- var _loop_1 = function (declaration) {
88
- // TARGET ONLY METHOD
89
- if (!typescript_1.default.isMethodDeclaration(declaration))
90
- return "continue";
91
- // IT MUST BE
92
- var identifier = declaration.name;
93
- if (!typescript_1.default.isIdentifier(identifier))
94
- return "continue";
95
- // ANALYZED WITH THE REFLECTED-FUNCTION
96
- var func = controller.functions.find(function (f) { return f.name === identifier.escapedText; });
97
- if (func !== undefined)
98
- ret.push(_Analyze_function(checker, controller, genericDict, func, declaration));
99
- };
100
- try {
101
- for (var _e = (e_2 = void 0, __values(property.declarations)), _f = _e.next(); !_f.done; _f = _e.next()) {
102
- var declaration = _f.value;
103
- _loop_1(declaration);
104
- }
105
- }
106
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
107
- finally {
108
- try {
109
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
110
- }
111
- finally { if (e_2) throw e_2.error; }
112
- }
113
- }
100
+ for (var _b = __values(classType.getProperties()), _c = _b.next(); !_c.done; _c = _b.next()) {
101
+ var property = _c.value;
102
+ _loop_1(property);
114
103
  }
115
104
  }
116
105
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
117
106
  finally {
118
107
  try {
119
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
108
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
120
109
  }
121
110
  finally { if (e_1) throw e_1.error; }
122
111
  }
@@ -125,15 +114,16 @@ var ControllerAnalyzer;
125
114
  /* ---------------------------------------------------------
126
115
  FUNCTION
127
116
  --------------------------------------------------------- */
128
- function _Analyze_function(checker, controller, genericDict, func, declaration) {
117
+ function _Analyze_function(checker, controller, genericDict, func, symbol) {
129
118
  // PREPARE ASSETS
130
- var signature = checker.getSignatureFromDeclaration(declaration);
119
+ var type = checker.getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration);
120
+ var signature = checker.getSignaturesOfType(type, typescript_1.default.SignatureKind.Call)[0];
131
121
  if (signature === undefined)
132
- throw new Error("Error on ControllerAnalyzer._Analyze_function(): unable to get the ignature from the ".concat(controller.name, ".").concat(func.name, "()."));
122
+ throw new Error("Error on ControllerAnalyzer._Analyze_function(): unable to get the signature from the ".concat(controller.name, ".").concat(func.name, "()."));
133
123
  var importDict = new HashMap_1.HashMap();
134
124
  // EXPLORE CHILDREN TYPES
135
- var parameters = func.parameters.map(function (param) { return _Analyze_parameter(checker, genericDict, importDict, controller, func.name, param, declaration.parameters[param.index]); });
136
- var output = ImportAnalyzer_1.ImportAnalyzer.analyze(checker, genericDict, importDict, checker.getReturnTypeOfSignature(signature));
125
+ var parameters = func.parameters.map(function (param) { return _Analyze_parameter(checker, genericDict, importDict, controller, func.name, param, signature.getParameters()[param.index]); });
126
+ var output = ImportAnalyzer_1.ImportAnalyzer.analyze(checker, genericDict, importDict, signature.getReturnType());
137
127
  var imports = importDict
138
128
  .toJSON()
139
129
  .map(function (pair) { return [pair.first, pair.second.toJSON()]; });
@@ -154,9 +144,8 @@ var ControllerAnalyzer;
154
144
  /* ---------------------------------------------------------
155
145
  PARAMETER
156
146
  --------------------------------------------------------- */
157
- function _Analyze_parameter(checker, genericDict, importDict, controller, funcName, param, declaration) {
158
- var symbol = checker.getSymbolAtLocation(declaration.name);
159
- var type = checker.getTypeOfSymbolAtLocation(symbol, declaration);
147
+ function _Analyze_parameter(checker, genericDict, importDict, controller, funcName, param, symbol) {
148
+ var type = checker.getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration);
160
149
  var name = symbol.getEscapedName().toString();
161
150
  // VALIDATE PARAMETERS
162
151
  if ((param.category === "query" || param.category === "body") && param.field !== undefined)
@@ -1 +1 @@
1
- {"version":3,"file":"MetadataFactory.d.ts","sourceRoot":"","sources":["../../src/factories/MetadataFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,yBAAiB,eAAe,CAChC;IACI,MAAM,QAAQ,UAAU,GAAG,kBAAkB,CAAC;IAE9C,SAAgB,QAAQ,CAEhB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,IAAI,EACpB,UAAU,GAAE,UAAiC,GAC9C,SAAS,CAAC,YAAY,GAAG,IAAI,CAenC;CA6NJ"}
1
+ {"version":3,"file":"MetadataFactory.d.ts","sourceRoot":"","sources":["../../src/factories/MetadataFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,yBAAiB,eAAe,CAChC;IACI,MAAM,QAAQ,UAAU,GAAG,kBAAkB,CAAC;IAE9C,SAAgB,QAAQ,CAEhB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,IAAI,EACpB,UAAU,GAAE,UAAiC,GAC9C,SAAS,CAAC,YAAY,GAAG,IAAI,CAenC;CA0NJ"}
@@ -43,7 +43,6 @@ exports.MetadataFactory = void 0;
43
43
  var crypto_1 = __importDefault(require("crypto"));
44
44
  var typescript_1 = __importDefault(require("typescript"));
45
45
  var Singleton_1 = require("tstl/thread/Singleton");
46
- var CommentFactory_1 = require("./CommentFactory");
47
46
  var MetadataCollection_1 = require("./MetadataCollection");
48
47
  var TypeFactry_1 = require("./TypeFactry");
49
48
  var MetadataFactory;
@@ -208,11 +207,8 @@ var MetadataFactory;
208
207
  var type = checker.getTypeOfSymbolAtLocation(prop, node);
209
208
  // CHILD METADATA BY ADDITIONAL EXPLORATION
210
209
  var child = explore(collection, checker, type);
211
- if (child) {
212
- if (node.questionToken)
213
- child.required = false;
214
- child.description = CommentFactory_1.CommentFactory.generate(prop.getDocumentationComment(checker));
215
- }
210
+ if (child && node.questionToken)
211
+ child.required = false;
216
212
  object.properties[key] = child;
217
213
  }
218
214
  }
@@ -43,7 +43,7 @@ var TypeFactory;
43
43
  }
44
44
  function full_name(checker, type) {
45
45
  // PRIMITIVE
46
- var symbol = type.getSymbol() || type.aliasSymbol;
46
+ var symbol = type.aliasSymbol || type.getSymbol();
47
47
  if (symbol === undefined)
48
48
  return checker.typeToString(type, undefined, undefined);
49
49
  // UNION OR INTERSECT
@@ -1 +1 @@
1
- {"version":3,"file":"SwaggerGenerator.d.ts","sourceRoot":"","sources":["../../src/generates/SwaggerGenerator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAU9C,yBAAiB,gBAAgB,CACjC;IACI,SAAsB,QAAQ,CAEtB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,MAAM,EAAE,cAAc,CAAC,QAAQ,EAC/B,SAAS,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,IAAI,CAAC,CAsCnB;CA0NJ"}
1
+ {"version":3,"file":"SwaggerGenerator.d.ts","sourceRoot":"","sources":["../../src/generates/SwaggerGenerator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAU9C,yBAAiB,gBAAgB,CACjC;IACI,SAAsB,QAAQ,CAEtB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,MAAM,EAAE,cAAc,CAAC,QAAQ,EAC/B,SAAS,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,IAAI,CAAC,CAsCnB;CA8NJ"}
@@ -158,7 +158,7 @@ var SwaggerGenerator;
158
158
  return [3 /*break*/, 3];
159
159
  case 2:
160
160
  _a = {
161
- openapi: "3.0",
161
+ openapi: "3.0.1",
162
162
  info: {
163
163
  version: "0.1.0",
164
164
  title: "Generated by nestia - https://github.com/samchon/nestia"
@@ -206,8 +206,12 @@ var SwaggerGenerator;
206
206
  }) !== undefined;
207
207
  })
208
208
  .map(function (tag) { return tag.text.find(function (elem) { return elem.kind === "text"; }).text; });
209
+ var encrypted = route.encrypted === true
210
+ || !!route.parameters.find(function (param) { return param.encrypted === true; });
209
211
  return {
210
212
  tags: tags,
213
+ deprecated: encrypted ? true : undefined,
214
+ summary: encrypted ? "encrypted" : undefined,
211
215
  parameters: route.parameters
212
216
  .filter(function (param) { return param.category !== "body"; })
213
217
  .map(function (param) { return generate_parameter(checker, collection, route, param); }),
@@ -12,6 +12,8 @@ export declare namespace ISwagger {
12
12
  parameters: IParameter[];
13
13
  responses: IResponseBody;
14
14
  requestBody?: IRequestBody;
15
+ deprecated?: boolean;
16
+ summary?: string;
15
17
  }
16
18
  interface IInfo {
17
19
  version: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ISwagger.d.ts","sourceRoot":"","sources":["../../src/structures/ISwagger.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IAErB,OAAO,EAAE,KAAK,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AACD,yBAAiB,QAAQ,CACzB;IACI,KAAY,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,UAAiB,MAAM;QAEnB,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,UAAU,EAAE,UAAU,EAAE,CAAC;QACzB,SAAS,EAAE,aAAa,CAAC;QACzB,WAAW,CAAC,EAAE,YAAY,CAAC;KAC9B;IAED,UAAiB,KAAK;QAElB,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;KACjB;IACD,UAAiB,UAAU;QAEvB,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,IAAI,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;KACvB;IACD,UAAiB,YAAY;QAEzB,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,YAAY,CAAC;QACtB,QAAQ,EAAE,IAAI,CAAC;KAClB;IACD,KAAY,aAAa,GAAG,MAAM,CAAC,MAAM,EACzC;QACI,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,YAAY,CAAC;KAC1B,CAAC,CAAC;IAEH,UAAiB,YAAY;QAEzB,kBAAkB,EAAE;YAChB,MAAM,EAAE,MAAM,CAAC;SAClB,CAAC;KACL;CAEJ"}
1
+ {"version":3,"file":"ISwagger.d.ts","sourceRoot":"","sources":["../../src/structures/ISwagger.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IAErB,OAAO,EAAE,KAAK,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AACD,yBAAiB,QAAQ,CACzB;IACI,KAAY,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,UAAiB,MAAM;QAEnB,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,UAAU,EAAE,UAAU,EAAE,CAAC;QACzB,SAAS,EAAE,aAAa,CAAC;QACzB,WAAW,CAAC,EAAE,YAAY,CAAC;QAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;KACpB;IAED,UAAiB,KAAK;QAElB,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;KACjB;IACD,UAAiB,UAAU;QAEvB,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,IAAI,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;KACvB;IACD,UAAiB,YAAY;QAEzB,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,YAAY,CAAC;QACtB,QAAQ,EAAE,IAAI,CAAC;KAClB;IACD,KAAY,aAAa,GAAG,MAAM,CAAC,MAAM,EACzC;QACI,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,YAAY,CAAC;KAC1B,CAAC,CAAC;IAEH,UAAiB,YAAY;QAEzB,kBAAkB,EAAE;YAChB,MAAM,EAAE,MAAM,CAAC;SAClB,CAAC;KACL;CAEJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nestia",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Automatic SDK and Document generator for the NestJS",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",