@nestia/sdk 1.0.7 → 1.0.8
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/LICENSE +21 -0
- package/assets/config/nestia.config.ts +70 -70
- package/lib/executable/sdk.js +16 -16
- package/package.json +2 -2
- package/src/INestiaConfig.ts +147 -147
- package/src/NestiaSdkApplication.ts +183 -183
- package/src/analyses/ControllerAnalyzer.ts +223 -223
- package/src/analyses/GenericAnalyzer.ts +53 -53
- package/src/analyses/ImportAnalyzer.ts +143 -143
- package/src/analyses/PathAnalyzer.ts +58 -58
- package/src/analyses/ReflectAnalyzer.ts +287 -287
- package/src/analyses/SourceFinder.ts +59 -59
- package/src/executable/internal/CommandParser.ts +15 -15
- package/src/executable/internal/NestiaConfigCompilerOptions.ts +18 -18
- package/src/executable/internal/NestiaSdkCommand.ts +174 -174
- package/src/executable/internal/nestia.config.getter.ts +12 -12
- package/src/executable/sdk.ts +74 -74
- package/src/generates/FileGenerator.ts +156 -156
- package/src/generates/SdkGenerator.ts +50 -50
- package/src/module.ts +2 -2
- package/src/structures/IController.ts +27 -27
- package/src/structures/IRoute.ts +33 -33
- package/src/structures/ISwaggerDocument.ts +119 -119
- package/src/structures/ITypeTuple.ts +6 -6
- package/src/structures/MethodType.ts +11 -11
- package/src/structures/ParamCategory.ts +1 -1
- package/src/structures/TypeEntry.ts +22 -22
- package/src/utils/ArrayUtil.ts +26 -26
- package/src/utils/ImportDictionary.ts +56 -56
- package/src/utils/MapUtil.ts +14 -14
- package/src/utils/StripEnums.ts +10 -10
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Jeongho Nam
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import { INestiaSdkConfiguration } from "@nestia/sdk";
|
|
2
|
-
|
|
3
|
-
export const NESTIA_CONFIG: INestiaSdkConfiguration = {
|
|
4
|
-
/**
|
|
5
|
-
* List of files or directories containing the NestJS controller classes.
|
|
6
|
-
*/
|
|
7
|
-
input: "src/controllers",
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Output directory that SDK would be placed in.
|
|
11
|
-
*
|
|
12
|
-
* If not configured, you can't build the SDK library.
|
|
13
|
-
*/
|
|
14
|
-
output: "src/api",
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Whether to assert parameter types or not.
|
|
18
|
-
*
|
|
19
|
-
* If you configure this property to be `true`, all of the function parameters would be
|
|
20
|
-
* checked through the [typia](https://github.com/samchon/typia#runtime-type-checkers).
|
|
21
|
-
* This option would make your SDK library slower, but would enahcne the type safety even
|
|
22
|
-
* in the runtime level.
|
|
23
|
-
*
|
|
24
|
-
* @default false
|
|
25
|
-
*/
|
|
26
|
-
// assert: true,
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Whether to optimize JSON string conversion 2x faster or not.
|
|
30
|
-
*
|
|
31
|
-
* If you configure this property to be `true`, the SDK library would utilize the
|
|
32
|
-
* [typia](https://github.com/samchon/typia#fastest-json-string-converter)
|
|
33
|
-
* and the JSON string conversion speed really be 2x faster.
|
|
34
|
-
*
|
|
35
|
-
* @default false
|
|
36
|
-
*/
|
|
37
|
-
// json: true,
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Whether to wrap DTO by primitive type.
|
|
41
|
-
*
|
|
42
|
-
* If you don't configure this property as `false`, all of DTOs in the
|
|
43
|
-
* SDK library would be automatically wrapped by {@link Primitive} type.
|
|
44
|
-
*
|
|
45
|
-
* For refenrece, if a DTO type be capsuled by the {@link Primitive} type,
|
|
46
|
-
* all of methods in the DTO type would be automatically erased. Also, if
|
|
47
|
-
* the DTO has a `toJSON()` method, the DTO type would be automatically
|
|
48
|
-
* converted to return type of the `toJSON()` method.
|
|
49
|
-
*
|
|
50
|
-
* @default true
|
|
51
|
-
*/
|
|
52
|
-
// primitive: false,
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Building `swagger.json` is also possible.
|
|
56
|
-
*
|
|
57
|
-
* If not specified, you can't build the `swagger.json`.
|
|
58
|
-
*/
|
|
59
|
-
swagger: {
|
|
60
|
-
/**
|
|
61
|
-
* Output path of the `swagger.json`.
|
|
62
|
-
*
|
|
63
|
-
* If you've configured only directory, the file name would be the `swagger.json`.
|
|
64
|
-
* Otherwise you've configured the full path with file name and extension, the
|
|
65
|
-
* `swagger.json` file would be renamed to it.
|
|
66
|
-
*/
|
|
67
|
-
output: "dist/swagger.json",
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
export default NESTIA_CONFIG;
|
|
1
|
+
import { INestiaSdkConfiguration } from "@nestia/sdk";
|
|
2
|
+
|
|
3
|
+
export const NESTIA_CONFIG: INestiaSdkConfiguration = {
|
|
4
|
+
/**
|
|
5
|
+
* List of files or directories containing the NestJS controller classes.
|
|
6
|
+
*/
|
|
7
|
+
input: "src/controllers",
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Output directory that SDK would be placed in.
|
|
11
|
+
*
|
|
12
|
+
* If not configured, you can't build the SDK library.
|
|
13
|
+
*/
|
|
14
|
+
output: "src/api",
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Whether to assert parameter types or not.
|
|
18
|
+
*
|
|
19
|
+
* If you configure this property to be `true`, all of the function parameters would be
|
|
20
|
+
* checked through the [typia](https://github.com/samchon/typia#runtime-type-checkers).
|
|
21
|
+
* This option would make your SDK library slower, but would enahcne the type safety even
|
|
22
|
+
* in the runtime level.
|
|
23
|
+
*
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
// assert: true,
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Whether to optimize JSON string conversion 2x faster or not.
|
|
30
|
+
*
|
|
31
|
+
* If you configure this property to be `true`, the SDK library would utilize the
|
|
32
|
+
* [typia](https://github.com/samchon/typia#fastest-json-string-converter)
|
|
33
|
+
* and the JSON string conversion speed really be 2x faster.
|
|
34
|
+
*
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
// json: true,
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Whether to wrap DTO by primitive type.
|
|
41
|
+
*
|
|
42
|
+
* If you don't configure this property as `false`, all of DTOs in the
|
|
43
|
+
* SDK library would be automatically wrapped by {@link Primitive} type.
|
|
44
|
+
*
|
|
45
|
+
* For refenrece, if a DTO type be capsuled by the {@link Primitive} type,
|
|
46
|
+
* all of methods in the DTO type would be automatically erased. Also, if
|
|
47
|
+
* the DTO has a `toJSON()` method, the DTO type would be automatically
|
|
48
|
+
* converted to return type of the `toJSON()` method.
|
|
49
|
+
*
|
|
50
|
+
* @default true
|
|
51
|
+
*/
|
|
52
|
+
// primitive: false,
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Building `swagger.json` is also possible.
|
|
56
|
+
*
|
|
57
|
+
* If not specified, you can't build the `swagger.json`.
|
|
58
|
+
*/
|
|
59
|
+
swagger: {
|
|
60
|
+
/**
|
|
61
|
+
* Output path of the `swagger.json`.
|
|
62
|
+
*
|
|
63
|
+
* If you've configured only directory, the file name would be the `swagger.json`.
|
|
64
|
+
* Otherwise you've configured the full path with file name and extension, the
|
|
65
|
+
* `swagger.json` file would be renamed to it.
|
|
66
|
+
*/
|
|
67
|
+
output: "dist/swagger.json",
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
export default NESTIA_CONFIG;
|
package/lib/executable/sdk.js
CHANGED
|
@@ -40,22 +40,22 @@ const child_process_1 = __importDefault(require("child_process"));
|
|
|
40
40
|
const fs_1 = __importDefault(require("fs"));
|
|
41
41
|
const process_1 = __importDefault(require("process"));
|
|
42
42
|
const CommandParser_1 = require("./internal/CommandParser");
|
|
43
|
-
const USAGE = `Wrong command has been detected. Use like below:
|
|
44
|
-
|
|
45
|
-
npx @nestia/sdk [command] [options?]
|
|
46
|
-
|
|
47
|
-
1. npx @nestia/sdk dependencies --manager (npm|pnpm|yarn)
|
|
48
|
-
- npx @nestia/sdk dependencies
|
|
49
|
-
- npx @nestia/sdk dependencies --manager pnpm
|
|
50
|
-
2. npx @nestia/sdk init
|
|
51
|
-
3. npx @nestia/sdk sdk <input> --out <output>
|
|
52
|
-
- npx @nestia/sdk sdk # when "nestia.config.ts" be configured
|
|
53
|
-
- npx @nestia/sdk sdk src/controllers --out src/api
|
|
54
|
-
- npx @nestia/sdk sdk src/**/*.controller.ts --out src/api
|
|
55
|
-
4. npx @nestia/sdk swagger <input> --out <output>
|
|
56
|
-
- npx @nestia/sdk swagger # when "nestia.config.ts" be configured
|
|
57
|
-
- npx @nestia/sdk swagger src/controllers --out src/api
|
|
58
|
-
- npx @nestia/sdk swagger src/**/*.controller.ts --out src/api
|
|
43
|
+
const USAGE = `Wrong command has been detected. Use like below:
|
|
44
|
+
|
|
45
|
+
npx @nestia/sdk [command] [options?]
|
|
46
|
+
|
|
47
|
+
1. npx @nestia/sdk dependencies --manager (npm|pnpm|yarn)
|
|
48
|
+
- npx @nestia/sdk dependencies
|
|
49
|
+
- npx @nestia/sdk dependencies --manager pnpm
|
|
50
|
+
2. npx @nestia/sdk init
|
|
51
|
+
3. npx @nestia/sdk sdk <input> --out <output>
|
|
52
|
+
- npx @nestia/sdk sdk # when "nestia.config.ts" be configured
|
|
53
|
+
- npx @nestia/sdk sdk src/controllers --out src/api
|
|
54
|
+
- npx @nestia/sdk sdk src/**/*.controller.ts --out src/api
|
|
55
|
+
4. npx @nestia/sdk swagger <input> --out <output>
|
|
56
|
+
- npx @nestia/sdk swagger # when "nestia.config.ts" be configured
|
|
57
|
+
- npx @nestia/sdk swagger src/controllers --out src/api
|
|
58
|
+
- npx @nestia/sdk swagger src/**/*.controller.ts --out src/api
|
|
59
59
|
`;
|
|
60
60
|
function halt(desc) {
|
|
61
61
|
console.error(desc);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestia/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Nestia SDK and Swagger generator",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"tsconfck": "^2.0.1",
|
|
62
62
|
"tsconfig-paths": "^4.1.1",
|
|
63
63
|
"tstl": "^2.5.13",
|
|
64
|
-
"typia": "^3.
|
|
64
|
+
"typia": "^3.5.5"
|
|
65
65
|
},
|
|
66
66
|
"files": [
|
|
67
67
|
"assets",
|
package/src/INestiaConfig.ts
CHANGED
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { ISwaggerDocument } from "./structures/ISwaggerDocument";
|
|
4
|
-
import type { StripEnums } from "./utils/StripEnums";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Definition for the `nestia.config.ts` file.
|
|
8
|
-
*
|
|
9
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
10
|
-
*/
|
|
11
|
-
export interface INestiaConfig {
|
|
12
|
-
/**
|
|
13
|
-
* List of files or directories containing the NestJS controller classes.
|
|
14
|
-
*/
|
|
15
|
-
input: string | string[] | INestiaConfig.IInput;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Output directory that SDK would be placed in.
|
|
19
|
-
*
|
|
20
|
-
* If not configured, you can't build the SDK library.
|
|
21
|
-
*/
|
|
22
|
-
output?: string;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Compiler options for the TypeScript.
|
|
26
|
-
*
|
|
27
|
-
* If you've omitted this property or the assigned property cannot fully cover the
|
|
28
|
-
* `tsconfig.json`, the properties from the `tsconfig.json` would be assigned to here.
|
|
29
|
-
* Otherwise, this property has been configured and it's detailed values are different
|
|
30
|
-
* with the `tsconfig.json`, this property values would be used instead.
|
|
31
|
-
*
|
|
32
|
-
* ```typescript
|
|
33
|
-
* import ts from "typescript";
|
|
34
|
-
*
|
|
35
|
-
* const tsconfig: ts.TsConfig;
|
|
36
|
-
* const nestiaConfig: IConfiguration;
|
|
37
|
-
*
|
|
38
|
-
* const compilerOptions: ts.CompilerOptions = {
|
|
39
|
-
* ...tsconfig.compilerOptions,
|
|
40
|
-
* ...(nestiaConfig.compilerOptions || {})
|
|
41
|
-
* }
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
compilerOptions?: StripEnums<ts.CompilerOptions>;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Whether to assert parameter types or not.
|
|
48
|
-
*
|
|
49
|
-
* If you configure this property to be `true`, all of the function parameters
|
|
50
|
-
* would be checked through [typia](https://github.com/samchon/typia#runtime-validators).
|
|
51
|
-
* This option would make your SDK library slower, but would enahcne the type safety
|
|
52
|
-
* even in the runtime level.
|
|
53
|
-
*
|
|
54
|
-
* @default false
|
|
55
|
-
*/
|
|
56
|
-
assert?: boolean;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Whether to optimize JSON string conversion 10x faster or not.
|
|
60
|
-
*
|
|
61
|
-
* If you configure this property to be `true`, the SDK library would utilize the
|
|
62
|
-
* [typia](https://github.com/samchon/typia#enhanced-json)
|
|
63
|
-
* and the JSON string conversion speed really be 10x faster.
|
|
64
|
-
*
|
|
65
|
-
* @default false
|
|
66
|
-
*/
|
|
67
|
-
json?: boolean;
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Whether to wrap DTO by primitive type.
|
|
71
|
-
*
|
|
72
|
-
* If you don't configure this property as `false`, all of DTOs in the
|
|
73
|
-
* SDK library would be automatically wrapped by {@link Primitive} type.
|
|
74
|
-
*
|
|
75
|
-
* For refenrece, if a DTO type be capsuled by the {@link Primitive} type,
|
|
76
|
-
* all of methods in the DTO type would be automatically erased. Also, if
|
|
77
|
-
* the DTO has a `toJSON()` method, the DTO type would be automatically
|
|
78
|
-
* converted to return type of the `toJSON()` method.
|
|
79
|
-
*
|
|
80
|
-
* @default true
|
|
81
|
-
*/
|
|
82
|
-
primitive?: boolean;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Building `swagger.json` is also possible.
|
|
86
|
-
*
|
|
87
|
-
* If not specified, you can't build the `swagger.json`.
|
|
88
|
-
*/
|
|
89
|
-
swagger?: INestiaConfig.ISwaggerConfig;
|
|
90
|
-
}
|
|
91
|
-
export namespace INestiaConfig {
|
|
92
|
-
/**
|
|
93
|
-
* List of files or directories to include or exclude to specifying the NestJS
|
|
94
|
-
* controllers.
|
|
95
|
-
*/
|
|
96
|
-
export interface IInput {
|
|
97
|
-
/**
|
|
98
|
-
* List of files or directories containing the NestJS controller classes.
|
|
99
|
-
*/
|
|
100
|
-
include: string[];
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* List of files or directories to be excluded.
|
|
104
|
-
*/
|
|
105
|
-
exclude?: string[];
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Building `swagger.json` is also possible.
|
|
110
|
-
*/
|
|
111
|
-
export interface ISwaggerConfig {
|
|
112
|
-
/**
|
|
113
|
-
* Output path of the `swagger.json`.
|
|
114
|
-
*
|
|
115
|
-
* If you've configured only directory, the file name would be the `swagger.json`.
|
|
116
|
-
* Otherwise you've configured the full path with file name and extension, the
|
|
117
|
-
* `swagger.json` file would be renamed to it.
|
|
118
|
-
*/
|
|
119
|
-
output: string;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Security schemes.
|
|
123
|
-
*/
|
|
124
|
-
security?: Record<string, ISwaggerConfig.ISecurityScheme>;
|
|
125
|
-
}
|
|
126
|
-
export namespace ISwaggerConfig {
|
|
127
|
-
export type ISecurityScheme =
|
|
128
|
-
| IApiKey
|
|
129
|
-
| Exclude<
|
|
130
|
-
ISwaggerDocument.ISecurityScheme,
|
|
131
|
-
ISwaggerDocument.ISecurityScheme.IApiKey
|
|
132
|
-
>;
|
|
133
|
-
export interface IApiKey {
|
|
134
|
-
type: "apiKey";
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* @default header
|
|
138
|
-
*/
|
|
139
|
-
in?: "header" | "query" | "cookie";
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* @default Authorization
|
|
143
|
-
*/
|
|
144
|
-
name?: string;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { ISwaggerDocument } from "./structures/ISwaggerDocument";
|
|
4
|
+
import type { StripEnums } from "./utils/StripEnums";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Definition for the `nestia.config.ts` file.
|
|
8
|
+
*
|
|
9
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
10
|
+
*/
|
|
11
|
+
export interface INestiaConfig {
|
|
12
|
+
/**
|
|
13
|
+
* List of files or directories containing the NestJS controller classes.
|
|
14
|
+
*/
|
|
15
|
+
input: string | string[] | INestiaConfig.IInput;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Output directory that SDK would be placed in.
|
|
19
|
+
*
|
|
20
|
+
* If not configured, you can't build the SDK library.
|
|
21
|
+
*/
|
|
22
|
+
output?: string;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Compiler options for the TypeScript.
|
|
26
|
+
*
|
|
27
|
+
* If you've omitted this property or the assigned property cannot fully cover the
|
|
28
|
+
* `tsconfig.json`, the properties from the `tsconfig.json` would be assigned to here.
|
|
29
|
+
* Otherwise, this property has been configured and it's detailed values are different
|
|
30
|
+
* with the `tsconfig.json`, this property values would be used instead.
|
|
31
|
+
*
|
|
32
|
+
* ```typescript
|
|
33
|
+
* import ts from "typescript";
|
|
34
|
+
*
|
|
35
|
+
* const tsconfig: ts.TsConfig;
|
|
36
|
+
* const nestiaConfig: IConfiguration;
|
|
37
|
+
*
|
|
38
|
+
* const compilerOptions: ts.CompilerOptions = {
|
|
39
|
+
* ...tsconfig.compilerOptions,
|
|
40
|
+
* ...(nestiaConfig.compilerOptions || {})
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
compilerOptions?: StripEnums<ts.CompilerOptions>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Whether to assert parameter types or not.
|
|
48
|
+
*
|
|
49
|
+
* If you configure this property to be `true`, all of the function parameters
|
|
50
|
+
* would be checked through [typia](https://github.com/samchon/typia#runtime-validators).
|
|
51
|
+
* This option would make your SDK library slower, but would enahcne the type safety
|
|
52
|
+
* even in the runtime level.
|
|
53
|
+
*
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
assert?: boolean;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Whether to optimize JSON string conversion 10x faster or not.
|
|
60
|
+
*
|
|
61
|
+
* If you configure this property to be `true`, the SDK library would utilize the
|
|
62
|
+
* [typia](https://github.com/samchon/typia#enhanced-json)
|
|
63
|
+
* and the JSON string conversion speed really be 10x faster.
|
|
64
|
+
*
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
json?: boolean;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Whether to wrap DTO by primitive type.
|
|
71
|
+
*
|
|
72
|
+
* If you don't configure this property as `false`, all of DTOs in the
|
|
73
|
+
* SDK library would be automatically wrapped by {@link Primitive} type.
|
|
74
|
+
*
|
|
75
|
+
* For refenrece, if a DTO type be capsuled by the {@link Primitive} type,
|
|
76
|
+
* all of methods in the DTO type would be automatically erased. Also, if
|
|
77
|
+
* the DTO has a `toJSON()` method, the DTO type would be automatically
|
|
78
|
+
* converted to return type of the `toJSON()` method.
|
|
79
|
+
*
|
|
80
|
+
* @default true
|
|
81
|
+
*/
|
|
82
|
+
primitive?: boolean;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Building `swagger.json` is also possible.
|
|
86
|
+
*
|
|
87
|
+
* If not specified, you can't build the `swagger.json`.
|
|
88
|
+
*/
|
|
89
|
+
swagger?: INestiaConfig.ISwaggerConfig;
|
|
90
|
+
}
|
|
91
|
+
export namespace INestiaConfig {
|
|
92
|
+
/**
|
|
93
|
+
* List of files or directories to include or exclude to specifying the NestJS
|
|
94
|
+
* controllers.
|
|
95
|
+
*/
|
|
96
|
+
export interface IInput {
|
|
97
|
+
/**
|
|
98
|
+
* List of files or directories containing the NestJS controller classes.
|
|
99
|
+
*/
|
|
100
|
+
include: string[];
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* List of files or directories to be excluded.
|
|
104
|
+
*/
|
|
105
|
+
exclude?: string[];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Building `swagger.json` is also possible.
|
|
110
|
+
*/
|
|
111
|
+
export interface ISwaggerConfig {
|
|
112
|
+
/**
|
|
113
|
+
* Output path of the `swagger.json`.
|
|
114
|
+
*
|
|
115
|
+
* If you've configured only directory, the file name would be the `swagger.json`.
|
|
116
|
+
* Otherwise you've configured the full path with file name and extension, the
|
|
117
|
+
* `swagger.json` file would be renamed to it.
|
|
118
|
+
*/
|
|
119
|
+
output: string;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Security schemes.
|
|
123
|
+
*/
|
|
124
|
+
security?: Record<string, ISwaggerConfig.ISecurityScheme>;
|
|
125
|
+
}
|
|
126
|
+
export namespace ISwaggerConfig {
|
|
127
|
+
export type ISecurityScheme =
|
|
128
|
+
| IApiKey
|
|
129
|
+
| Exclude<
|
|
130
|
+
ISwaggerDocument.ISecurityScheme,
|
|
131
|
+
ISwaggerDocument.ISecurityScheme.IApiKey
|
|
132
|
+
>;
|
|
133
|
+
export interface IApiKey {
|
|
134
|
+
type: "apiKey";
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @default header
|
|
138
|
+
*/
|
|
139
|
+
in?: "header" | "query" | "cookie";
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @default Authorization
|
|
143
|
+
*/
|
|
144
|
+
name?: string;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|