@nestia/core 2.5.8 → 2.5.9
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/README.md +9 -6
- package/lib/decorators/SwaggerCustomizer.d.ts +64 -0
- package/lib/decorators/SwaggerCustomizer.js +25 -0
- package/lib/decorators/SwaggerCustomizer.js.map +1 -0
- package/lib/module.d.ts +1 -0
- package/lib/module.js +1 -0
- package/lib/module.js.map +1 -1
- package/lib/structures/ISwagger.d.ts +72 -0
- package/lib/structures/ISwagger.js +3 -0
- package/lib/structures/ISwagger.js.map +1 -0
- package/lib/structures/ISwaggerComponents.d.ts +26 -0
- package/lib/structures/ISwaggerComponents.js +3 -0
- package/lib/structures/ISwaggerComponents.js.map +1 -0
- package/lib/structures/ISwaggerInfo.d.ts +71 -0
- package/lib/structures/ISwaggerInfo.js +3 -0
- package/lib/structures/ISwaggerInfo.js.map +1 -0
- package/lib/structures/ISwaggerRoute.d.ts +46 -0
- package/lib/structures/ISwaggerRoute.js +3 -0
- package/lib/structures/ISwaggerRoute.js.map +1 -0
- package/lib/structures/ISwaggerSecurityScheme.d.ts +56 -0
- package/lib/structures/ISwaggerSecurityScheme.js +3 -0
- package/lib/structures/ISwaggerSecurityScheme.js.map +1 -0
- package/package.json +3 -3
- package/src/decorators/EncryptedBody.ts +105 -105
- package/src/decorators/EncryptedModule.ts +96 -96
- package/src/decorators/PlainBody.ts +75 -75
- package/src/decorators/SwaggerCustomizer.ts +87 -0
- package/src/decorators/TypedBody.ts +62 -62
- package/src/decorators/TypedException.ts +90 -90
- package/src/decorators/TypedRoute.ts +144 -144
- package/src/decorators/internal/get_path_and_querify.ts +106 -106
- package/src/decorators/internal/load_controller.ts +51 -51
- package/src/decorators/internal/validate_request_body.ts +72 -72
- package/src/decorators/internal/validate_request_headers.ts +83 -83
- package/src/decorators/internal/validate_request_query.ts +71 -71
- package/src/module.ts +1 -0
- package/src/structures/ISwagger.ts +91 -0
- package/src/structures/ISwaggerComponents.ts +29 -0
- package/src/structures/ISwaggerInfo.ts +80 -0
- package/src/structures/ISwaggerRoute.ts +50 -0
- package/src/structures/ISwaggerSecurityScheme.ts +65 -0
- package/src/transformers/NodeTransformer.ts +16 -16
- package/src/transformers/TypedExceptionTransformer.ts +48 -48
- package/src/transformers/TypedRouteTransformer.ts +88 -88
- package/src/utils/Singleton.ts +20 -20
package/README.md
CHANGED
|
@@ -6,17 +6,19 @@
|
|
|
6
6
|
[](https://www.npmjs.com/package/@nestia/core)
|
|
7
7
|
[](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)
|
|
8
8
|
[](https://nestia.io/docs/)
|
|
9
|
+
[](https://discord.com/channels/520622812742811698/1181877086797967420)
|
|
9
10
|
|
|
10
11
|
Nestia is a set of helper libraries for NestJS, supporting below features:
|
|
11
12
|
|
|
12
|
-
- `@nestia/core`:
|
|
13
|
+
- `@nestia/core`: Super-fast decorators
|
|
13
14
|
- `@nestia/sdk`:
|
|
14
15
|
- Swagger generator evolved than ever
|
|
15
16
|
- SDK library generator for clients
|
|
16
17
|
- Mockup Simulator for client applications
|
|
17
18
|
- Automatic E2E test functions generator
|
|
18
|
-
- `@nestia/migrate`:
|
|
19
|
-
-
|
|
19
|
+
- `@nestia/migrate`: Migration from Swagger to NestJS
|
|
20
|
+
- `@nestia/editor`: Online TypeScript Swagger Editor
|
|
21
|
+
- `nestia`: Just CLI (command line interface) tool
|
|
20
22
|
|
|
21
23
|
> **Note**
|
|
22
24
|
>
|
|
@@ -25,8 +27,8 @@ Nestia is a set of helper libraries for NestJS, supporting below features:
|
|
|
25
27
|
> - Runtime validator is **20,000x faster** than `class-validator`
|
|
26
28
|
> - JSON serialization is **200x faster** than `class-transformer`
|
|
27
29
|
> - Software Development Kit
|
|
28
|
-
> -
|
|
29
|
-
> - Mockup simulator means embedded backend simulator in SDK
|
|
30
|
+
> - Collection of typed `fetch` functions with DTO structures like [tRPC](https://trpc.io/)
|
|
31
|
+
> - Mockup simulator means embedded backend simulator in the SDK
|
|
30
32
|
> - similar with [msw](https://mswjs.io/), but fully automated
|
|
31
33
|
|
|
32
34
|

|
|
@@ -59,7 +61,7 @@ Check out the document in the [website](https://nestia.io/docs/):
|
|
|
59
61
|
- [TypedRoute](https://nestia.io/docs/core/TypedRoute/)
|
|
60
62
|
- [TypedBody](https://nestia.io/docs/core/TypedBody/)
|
|
61
63
|
- [TypedParam](https://nestia.io/docs/core/TypedParam/)
|
|
62
|
-
- [TypedQuery](https://nestia.io/docs/core/
|
|
64
|
+
- [TypedQuery](https://nestia.io/docs/core/TypedQuery/)
|
|
63
65
|
- [TypedHeaders](https://nestia.io/docs/core/TypedHeaders/)
|
|
64
66
|
- [TypedException](https://nestia.io/docs/core/TypedException/)
|
|
65
67
|
- Generators
|
|
@@ -68,6 +70,7 @@ Check out the document in the [website](https://nestia.io/docs/):
|
|
|
68
70
|
- [E2E Functions](https://nestia.io/docs/sdk/e2e/)
|
|
69
71
|
- [Mockup Simulator](https://nestia.io/docs/sdk/simulator/)
|
|
70
72
|
- [Swagger to NestJS](https://nestia.io/docs/migrate/)
|
|
73
|
+
- [TypeScript Swagger Editor](https://nestia.io/docs/editor/)
|
|
71
74
|
|
|
72
75
|
### 🔗 Appendix
|
|
73
76
|
- [⇲ Benchmark Result](https://github.com/samchon/nestia/tree/master/benchmark/results/11th%20Gen%20Intel(R)%20Core(TM)%20i5-1135G7%20%40%202.40GHz)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ISwagger } from "../structures/ISwagger";
|
|
2
|
+
import { ISwaggerRoute } from "../structures/ISwaggerRoute";
|
|
3
|
+
/**
|
|
4
|
+
* Swagger customization decorator.
|
|
5
|
+
*
|
|
6
|
+
* `SwaggerCustomizer` is a method decorator function which can used for
|
|
7
|
+
* customizing the swagger data with `npx nestia swagger` command. Furthermore,
|
|
8
|
+
* it is possible to add plugin properties starting with `x-` characters.
|
|
9
|
+
*
|
|
10
|
+
* In other words, this decorator function does not affect to the runtime,
|
|
11
|
+
* but only for the swagger data customization.
|
|
12
|
+
*
|
|
13
|
+
* @param closure Callback function which can customize the swagger data
|
|
14
|
+
* @returns Method decorator
|
|
15
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
16
|
+
*/
|
|
17
|
+
export declare function SwaggerCustomizer(closure: (props: SwaggerCustomizer.IProps) => unknown): MethodDecorator;
|
|
18
|
+
export declare namespace SwaggerCustomizer {
|
|
19
|
+
/**
|
|
20
|
+
* Properties for the `SwaggerCustomizer` decorator.
|
|
21
|
+
*
|
|
22
|
+
* `SwaggerCustomizer.IProps` is a type for the `closure` parameter of the
|
|
23
|
+
* `SwaggerCustomizer` decorator. It's a callback function which can customize
|
|
24
|
+
* the swagger data.
|
|
25
|
+
*/
|
|
26
|
+
interface IProps {
|
|
27
|
+
/**
|
|
28
|
+
* Swagger data.
|
|
29
|
+
*/
|
|
30
|
+
swagger: ISwagger;
|
|
31
|
+
/**
|
|
32
|
+
* Method of the route.
|
|
33
|
+
*/
|
|
34
|
+
method: string;
|
|
35
|
+
/**
|
|
36
|
+
* Path of the route.
|
|
37
|
+
*/
|
|
38
|
+
path: string;
|
|
39
|
+
/**
|
|
40
|
+
* Route data.
|
|
41
|
+
*/
|
|
42
|
+
route: ISwaggerRoute;
|
|
43
|
+
/**
|
|
44
|
+
* Get neighbor route data.
|
|
45
|
+
*
|
|
46
|
+
* @param accessor Accessor for getting neighbor route data
|
|
47
|
+
* @returns Neighbor route data
|
|
48
|
+
*/
|
|
49
|
+
get(accessor: IAccessor): ISwaggerRoute | undefined;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Accessor for getting neighbor route data.
|
|
53
|
+
*/
|
|
54
|
+
interface IAccessor {
|
|
55
|
+
/**
|
|
56
|
+
* Path of the neighbor route.
|
|
57
|
+
*/
|
|
58
|
+
path: string;
|
|
59
|
+
/**
|
|
60
|
+
* Method of the neighbor route.
|
|
61
|
+
*/
|
|
62
|
+
method: string;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SwaggerCustomizer = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Swagger customization decorator.
|
|
6
|
+
*
|
|
7
|
+
* `SwaggerCustomizer` is a method decorator function which can used for
|
|
8
|
+
* customizing the swagger data with `npx nestia swagger` command. Furthermore,
|
|
9
|
+
* it is possible to add plugin properties starting with `x-` characters.
|
|
10
|
+
*
|
|
11
|
+
* In other words, this decorator function does not affect to the runtime,
|
|
12
|
+
* but only for the swagger data customization.
|
|
13
|
+
*
|
|
14
|
+
* @param closure Callback function which can customize the swagger data
|
|
15
|
+
* @returns Method decorator
|
|
16
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
17
|
+
*/
|
|
18
|
+
function SwaggerCustomizer(closure) {
|
|
19
|
+
return function SwaggerCustomizer(target, propertyKey, descriptor) {
|
|
20
|
+
Reflect.defineMetadata("nestia/SwaggerCustomizer", closure, target, propertyKey);
|
|
21
|
+
return descriptor;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
exports.SwaggerCustomizer = SwaggerCustomizer;
|
|
25
|
+
//# sourceMappingURL=SwaggerCustomizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwaggerCustomizer.js","sourceRoot":"","sources":["../../src/decorators/SwaggerCustomizer.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;GAaG;AACH,SAAgB,iBAAiB,CAC/B,OAAqD;IAErD,OAAO,SAAS,iBAAiB,CAC/B,MAAc,EACd,WAA4B,EAC5B,UAAwC;QAExC,OAAO,CAAC,cAAc,CACpB,0BAA0B,EAC1B,OAAO,EACP,MAAM,EACN,WAAW,CACZ,CAAC;QACF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AAhBD,8CAgBC"}
|
package/lib/module.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from "./decorators/EncryptedModule";
|
|
|
5
5
|
export * from "./decorators/EncryptedRoute";
|
|
6
6
|
export * from "./utils/ExceptionManager";
|
|
7
7
|
export * from "./decorators/PlainBody";
|
|
8
|
+
export * from "./decorators/SwaggerCustomizer";
|
|
8
9
|
export * from "./decorators/TypedBody";
|
|
9
10
|
export * from "./decorators/TypedException";
|
|
10
11
|
export * from "./decorators/TypedHeaders";
|
package/lib/module.js
CHANGED
|
@@ -21,6 +21,7 @@ __exportStar(require("./decorators/EncryptedModule"), exports);
|
|
|
21
21
|
__exportStar(require("./decorators/EncryptedRoute"), exports);
|
|
22
22
|
__exportStar(require("./utils/ExceptionManager"), exports);
|
|
23
23
|
__exportStar(require("./decorators/PlainBody"), exports);
|
|
24
|
+
__exportStar(require("./decorators/SwaggerCustomizer"), exports);
|
|
24
25
|
__exportStar(require("./decorators/TypedBody"), exports);
|
|
25
26
|
__exportStar(require("./decorators/TypedException"), exports);
|
|
26
27
|
__exportStar(require("./decorators/TypedHeaders"), exports);
|
package/lib/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,6DAA2C;AAC3C,mEAAiD;AACjD,+DAA6C;AAC7C,8DAA4C;AAC5C,2DAAyC;AACzC,yDAAuC;AACvC,yDAAuC;AACvC,8DAA4C;AAC5C,4DAA0C;AAC1C,6DAA2C;AAC3C,0DAAwC;AACxC,0DAAwC;AACxC,0DAAwC;AACxC,oEAAkD"}
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,6DAA2C;AAC3C,mEAAiD;AACjD,+DAA6C;AAC7C,8DAA4C;AAC5C,2DAAyC;AACzC,yDAAuC;AACvC,iEAA+C;AAC/C,yDAAuC;AACvC,8DAA4C;AAC5C,4DAA0C;AAC1C,6DAA2C;AAC3C,0DAAwC;AACxC,0DAAwC;AACxC,0DAAwC;AACxC,oEAAkD"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ISwaggerComponents } from "./ISwaggerComponents";
|
|
2
|
+
import { ISwaggerInfo } from "./ISwaggerInfo";
|
|
3
|
+
import { ISwaggerRoute } from "./ISwaggerRoute";
|
|
4
|
+
/**
|
|
5
|
+
* Swagger Document.
|
|
6
|
+
*
|
|
7
|
+
* `ISwagger` is a data structure representing content of `swagger.json` file
|
|
8
|
+
* generated by Nestia. Note that, this is not an universal structure, but a dedicated
|
|
9
|
+
* structure only for Nestia.
|
|
10
|
+
*
|
|
11
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
12
|
+
*/
|
|
13
|
+
export interface ISwagger {
|
|
14
|
+
/**
|
|
15
|
+
* The version of the OpenAPI document.
|
|
16
|
+
*
|
|
17
|
+
* Nestia always generate OpenAPI 3.0.x document.
|
|
18
|
+
*/
|
|
19
|
+
openapi: `3.0.${number}`;
|
|
20
|
+
/**
|
|
21
|
+
* List of servers that provide the API.
|
|
22
|
+
*/
|
|
23
|
+
servers: ISwagger.IServer[];
|
|
24
|
+
/**
|
|
25
|
+
* Information about the API.
|
|
26
|
+
*/
|
|
27
|
+
info: ISwaggerInfo;
|
|
28
|
+
/**
|
|
29
|
+
* The available paths and operations for the API.
|
|
30
|
+
*
|
|
31
|
+
* The 1st key is the path, and the 2nd key is the HTTP method.
|
|
32
|
+
*/
|
|
33
|
+
paths: Record<string, Record<string, ISwaggerRoute>>;
|
|
34
|
+
/**
|
|
35
|
+
* An object to hold reusable data structures.
|
|
36
|
+
*
|
|
37
|
+
* It stores both DTO schemas and security schemes.
|
|
38
|
+
*
|
|
39
|
+
* For reference, `nestia` defines every object and alias types as reusable DTO
|
|
40
|
+
* schemas. The alias type means that defined by `type` keyword in TypeScript.
|
|
41
|
+
*/
|
|
42
|
+
components: ISwaggerComponents;
|
|
43
|
+
}
|
|
44
|
+
export declare namespace ISwagger {
|
|
45
|
+
/**
|
|
46
|
+
* Remote server definition.
|
|
47
|
+
*/
|
|
48
|
+
interface IServer {
|
|
49
|
+
/**
|
|
50
|
+
* A URL to the target host.
|
|
51
|
+
*
|
|
52
|
+
* @format uri
|
|
53
|
+
*/
|
|
54
|
+
url: string;
|
|
55
|
+
/**
|
|
56
|
+
* An optional string describing the target server.
|
|
57
|
+
*/
|
|
58
|
+
description?: string;
|
|
59
|
+
}
|
|
60
|
+
interface IExternalDocs {
|
|
61
|
+
/**
|
|
62
|
+
* The URL for target documentation.
|
|
63
|
+
*
|
|
64
|
+
* @format uri
|
|
65
|
+
*/
|
|
66
|
+
url: string;
|
|
67
|
+
/**
|
|
68
|
+
* A short description of the target documentation.
|
|
69
|
+
*/
|
|
70
|
+
description?: string;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISwagger.js","sourceRoot":"","sources":["../../src/structures/ISwagger.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IJsonComponents } from "typia";
|
|
2
|
+
import { ISwaggerSecurityScheme } from "./ISwaggerSecurityScheme";
|
|
3
|
+
/**
|
|
4
|
+
* Reusable components in Swagger.
|
|
5
|
+
*
|
|
6
|
+
* `ISwaggerComponents` is a data structure representing content of `components` object
|
|
7
|
+
* in `swagger.json` file generated by Nestia. Note that, this is not an universal
|
|
8
|
+
* structure, but a dedicated structure only for Nestia.
|
|
9
|
+
*
|
|
10
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
11
|
+
*/
|
|
12
|
+
export interface ISwaggerComponents {
|
|
13
|
+
/**
|
|
14
|
+
* An object to hold reusable DTO schemas.
|
|
15
|
+
*
|
|
16
|
+
* For reference, `nestia` stores every object and alias types as reusable DTO
|
|
17
|
+
* schemas. The alias type means that defined by `type` keyword in TypeScript.
|
|
18
|
+
*/
|
|
19
|
+
schemas?: Record<string, IJsonComponents.IAlias>;
|
|
20
|
+
/**
|
|
21
|
+
* An object to hold reusable security schemes.
|
|
22
|
+
*
|
|
23
|
+
* This property be configured by user in `nestia.config.ts` file.
|
|
24
|
+
*/
|
|
25
|
+
securitySchemes?: Record<string, ISwaggerSecurityScheme>;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISwaggerComponents.js","sourceRoot":"","sources":["../../src/structures/ISwaggerComponents.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Information about the API.
|
|
3
|
+
*
|
|
4
|
+
* @author Samchon
|
|
5
|
+
*/
|
|
6
|
+
export interface ISwaggerInfo {
|
|
7
|
+
/**
|
|
8
|
+
* The title of the API.
|
|
9
|
+
*/
|
|
10
|
+
title: string;
|
|
11
|
+
/**
|
|
12
|
+
* A short description of the API.
|
|
13
|
+
*/
|
|
14
|
+
description?: string;
|
|
15
|
+
/**
|
|
16
|
+
* A URL to the Terms of Service for the API.
|
|
17
|
+
*
|
|
18
|
+
* @format uri
|
|
19
|
+
*/
|
|
20
|
+
termsOfService?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The contact information for the exposed API.
|
|
23
|
+
*/
|
|
24
|
+
contact?: ISwaggerInfo.IContact;
|
|
25
|
+
/**
|
|
26
|
+
* The license information for the exposed API.
|
|
27
|
+
*/
|
|
28
|
+
license?: ISwaggerInfo.ILicense;
|
|
29
|
+
/**
|
|
30
|
+
* Version of the API.
|
|
31
|
+
*/
|
|
32
|
+
version: string;
|
|
33
|
+
}
|
|
34
|
+
export declare namespace ISwaggerInfo {
|
|
35
|
+
/**
|
|
36
|
+
* Contact information for the exposed API.
|
|
37
|
+
*/
|
|
38
|
+
interface IContact {
|
|
39
|
+
/**
|
|
40
|
+
* The identifying name of the contact person/organization.
|
|
41
|
+
*/
|
|
42
|
+
name?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The URL pointing to the contact information.
|
|
45
|
+
*
|
|
46
|
+
* @format uri
|
|
47
|
+
*/
|
|
48
|
+
url?: string;
|
|
49
|
+
/**
|
|
50
|
+
* The email address of the contact person/organization.
|
|
51
|
+
*
|
|
52
|
+
* @format email
|
|
53
|
+
*/
|
|
54
|
+
email?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* License information for the exposed API.
|
|
58
|
+
*/
|
|
59
|
+
interface ILicense {
|
|
60
|
+
/**
|
|
61
|
+
* The license name used for the API.
|
|
62
|
+
*/
|
|
63
|
+
name: string;
|
|
64
|
+
/**
|
|
65
|
+
* A URL to the license used for the API.
|
|
66
|
+
*
|
|
67
|
+
* @format uri
|
|
68
|
+
*/
|
|
69
|
+
url?: string;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISwaggerInfo.js","sourceRoot":"","sources":["../../src/structures/ISwaggerInfo.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { IJsonSchema } from "typia";
|
|
2
|
+
export interface ISwaggerRoute {
|
|
3
|
+
deprecated?: boolean;
|
|
4
|
+
security?: Record<string, string[]>[];
|
|
5
|
+
operationId?: string;
|
|
6
|
+
tags: string[];
|
|
7
|
+
parameters: ISwaggerRoute.IParameter[];
|
|
8
|
+
requestBody?: ISwaggerRoute.IRequestBody;
|
|
9
|
+
responses: ISwaggerRoute.IResponseBody;
|
|
10
|
+
summary?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare namespace ISwaggerRoute {
|
|
14
|
+
interface IParameter {
|
|
15
|
+
name: string;
|
|
16
|
+
in: string;
|
|
17
|
+
schema: IJsonSchema;
|
|
18
|
+
required: boolean;
|
|
19
|
+
description?: string;
|
|
20
|
+
}
|
|
21
|
+
interface IRequestBody {
|
|
22
|
+
description?: string;
|
|
23
|
+
content: IContent;
|
|
24
|
+
required: true;
|
|
25
|
+
"x-nestia-encrypted"?: boolean;
|
|
26
|
+
}
|
|
27
|
+
type IResponseBody = Record<string, {
|
|
28
|
+
description: string;
|
|
29
|
+
content?: IContent;
|
|
30
|
+
"x-nestia-encrypted"?: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
interface IContent {
|
|
33
|
+
"application/x-www-form-urlencoded"?: {
|
|
34
|
+
schema: IJsonSchema;
|
|
35
|
+
};
|
|
36
|
+
"application/json"?: {
|
|
37
|
+
schema: IJsonSchema;
|
|
38
|
+
};
|
|
39
|
+
"text/plain"?: {
|
|
40
|
+
schema: IJsonSchema;
|
|
41
|
+
};
|
|
42
|
+
"multipart/form-data"?: {
|
|
43
|
+
schema: IJsonSchema;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISwaggerRoute.js","sourceRoot":"","sources":["../../src/structures/ISwaggerRoute.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security scheme of Swagger Documents.
|
|
3
|
+
*
|
|
4
|
+
* `ISwaggerSecurityScheme` is a data structure representing content of
|
|
5
|
+
* `securitySchemes` in `swagger.json` file. It is composed with 5 types of security
|
|
6
|
+
* schemes as an union type like below.
|
|
7
|
+
*
|
|
8
|
+
* @reference https://swagger.io/specification/#security-scheme-object
|
|
9
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
10
|
+
*/
|
|
11
|
+
export type ISwaggerSecurityScheme = ISwaggerSecurityScheme.IHttpBasic | ISwaggerSecurityScheme.IHttpBearer | ISwaggerSecurityScheme.IApiKey | ISwaggerSecurityScheme.IOpenId | ISwaggerSecurityScheme.IOAuth2;
|
|
12
|
+
export declare namespace ISwaggerSecurityScheme {
|
|
13
|
+
interface IHttpBasic {
|
|
14
|
+
type: "http";
|
|
15
|
+
scheme: "basic";
|
|
16
|
+
}
|
|
17
|
+
interface IHttpBearer {
|
|
18
|
+
type: "http";
|
|
19
|
+
scheme: "bearer";
|
|
20
|
+
bearerFormat?: string;
|
|
21
|
+
}
|
|
22
|
+
interface IApiKey {
|
|
23
|
+
type: "apiKey";
|
|
24
|
+
/**
|
|
25
|
+
* @default header
|
|
26
|
+
*/
|
|
27
|
+
in?: "header" | "query" | "cookie";
|
|
28
|
+
/**
|
|
29
|
+
* @default Authorization
|
|
30
|
+
*/
|
|
31
|
+
name?: string;
|
|
32
|
+
}
|
|
33
|
+
interface IOpenId {
|
|
34
|
+
type: "openIdConnect";
|
|
35
|
+
openIdConnectUrl: string;
|
|
36
|
+
}
|
|
37
|
+
interface IOAuth2 {
|
|
38
|
+
type: "oauth2";
|
|
39
|
+
flows: IOAuth2.IFlowSet;
|
|
40
|
+
description?: string;
|
|
41
|
+
}
|
|
42
|
+
namespace IOAuth2 {
|
|
43
|
+
interface IFlowSet {
|
|
44
|
+
authorizationCode?: IFlow;
|
|
45
|
+
implicit?: Omit<IFlow, "tokenUrl">;
|
|
46
|
+
password?: Omit<IFlow, "authorizationUrl">;
|
|
47
|
+
clientCredentials?: Omit<IFlow, "authorizationUrl">;
|
|
48
|
+
}
|
|
49
|
+
interface IFlow {
|
|
50
|
+
authorizationUrl: string;
|
|
51
|
+
tokenUrl: string;
|
|
52
|
+
refreshUrl: string;
|
|
53
|
+
scopes?: Record<string, string>;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISwaggerSecurityScheme.js","sourceRoot":"","sources":["../../src/structures/ISwaggerSecurityScheme.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestia/core",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.9",
|
|
4
4
|
"description": "Super-fast validation decorators of NestJS",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://nestia.io",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@nestia/fetcher": "^2.5.
|
|
39
|
+
"@nestia/fetcher": "^2.5.9",
|
|
40
40
|
"@nestjs/common": ">=7.0.1",
|
|
41
41
|
"@nestjs/core": ">=7.0.1",
|
|
42
42
|
"detect-ts-node": "^1.0.5",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"typia": "^5.4.5"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@nestia/fetcher": ">=2.5.
|
|
51
|
+
"@nestia/fetcher": ">=2.5.9",
|
|
52
52
|
"@nestjs/common": ">=7.0.1",
|
|
53
53
|
"@nestjs/core": ">=7.0.1",
|
|
54
54
|
"reflect-metadata": ">=0.1.12",
|