@nestia/core 2.5.9-dev.20240223 → 2.5.10-dev.20240223

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.
@@ -1,16 +1,64 @@
1
1
  import { ISwagger } from "../structures/ISwagger";
2
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
+ */
3
17
  export declare function SwaggerCustomizer(closure: (props: SwaggerCustomizer.IProps) => unknown): MethodDecorator;
4
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
+ */
5
26
  interface IProps {
27
+ /**
28
+ * Swagger data.
29
+ */
6
30
  swagger: ISwagger;
31
+ /**
32
+ * Method of the route.
33
+ */
7
34
  method: string;
35
+ /**
36
+ * Path of the route.
37
+ */
8
38
  path: string;
39
+ /**
40
+ * Route data.
41
+ */
9
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
+ */
10
49
  get(accessor: IAccessor): ISwaggerRoute | undefined;
11
50
  }
51
+ /**
52
+ * Accessor for getting neighbor route data.
53
+ */
12
54
  interface IAccessor {
55
+ /**
56
+ * Path of the neighbor route.
57
+ */
13
58
  path: string;
59
+ /**
60
+ * Method of the neighbor route.
61
+ */
14
62
  method: string;
15
63
  }
16
64
  }
@@ -1,6 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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
+ */
4
18
  function SwaggerCustomizer(closure) {
5
19
  return function SwaggerCustomizer(target, propertyKey, descriptor) {
6
20
  Reflect.defineMetadata("nestia/SwaggerCustomizer", closure, target, propertyKey);
@@ -1 +1 @@
1
- {"version":3,"file":"SwaggerCustomizer.js","sourceRoot":"","sources":["../../src/decorators/SwaggerCustomizer.ts"],"names":[],"mappings":";;;AAGA,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"}
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestia/core",
3
- "version": "2.5.9-dev.20240223",
3
+ "version": "2.5.10-dev.20240223",
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.9-dev.20240223",
39
+ "@nestia/fetcher": "^2.5.10-dev.20240223",
40
40
  "@nestjs/common": ">=7.0.1",
41
41
  "@nestjs/core": ">=7.0.1",
42
42
  "detect-ts-node": "^1.0.5",
@@ -45,15 +45,15 @@
45
45
  "raw-body": "^2.0.0",
46
46
  "reflect-metadata": ">=0.1.12",
47
47
  "rxjs": ">=6.0.0",
48
- "typia": "^5.4.5"
48
+ "typia": "^5.4.12"
49
49
  },
50
50
  "peerDependencies": {
51
- "@nestia/fetcher": ">=2.5.9-dev.20240223",
51
+ "@nestia/fetcher": ">=2.5.10-dev.20240223",
52
52
  "@nestjs/common": ">=7.0.1",
53
53
  "@nestjs/core": ">=7.0.1",
54
54
  "reflect-metadata": ">=0.1.12",
55
55
  "rxjs": ">=6.0.0",
56
- "typia": ">=5.4.5 <6.0.0"
56
+ "typia": ">=5.4.12 <6.0.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@fastify/multipart": "^8.1.0",
@@ -1,6 +1,20 @@
1
1
  import { ISwagger } from "../structures/ISwagger";
2
2
  import { ISwaggerRoute } from "../structures/ISwaggerRoute";
3
3
 
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
+ */
4
18
  export function SwaggerCustomizer(
5
19
  closure: (props: SwaggerCustomizer.IProps) => unknown,
6
20
  ): MethodDecorator {
@@ -19,15 +33,55 @@ export function SwaggerCustomizer(
19
33
  };
20
34
  }
21
35
  export namespace SwaggerCustomizer {
36
+ /**
37
+ * Properties for the `SwaggerCustomizer` decorator.
38
+ *
39
+ * `SwaggerCustomizer.IProps` is a type for the `closure` parameter of the
40
+ * `SwaggerCustomizer` decorator. It's a callback function which can customize
41
+ * the swagger data.
42
+ */
22
43
  export interface IProps {
44
+ /**
45
+ * Swagger data.
46
+ */
23
47
  swagger: ISwagger;
48
+
49
+ /**
50
+ * Method of the route.
51
+ */
24
52
  method: string;
53
+
54
+ /**
55
+ * Path of the route.
56
+ */
25
57
  path: string;
58
+
59
+ /**
60
+ * Route data.
61
+ */
26
62
  route: ISwaggerRoute;
63
+
64
+ /**
65
+ * Get neighbor route data.
66
+ *
67
+ * @param accessor Accessor for getting neighbor route data
68
+ * @returns Neighbor route data
69
+ */
27
70
  get(accessor: IAccessor): ISwaggerRoute | undefined;
28
71
  }
72
+
73
+ /**
74
+ * Accessor for getting neighbor route data.
75
+ */
29
76
  export interface IAccessor {
77
+ /**
78
+ * Path of the neighbor route.
79
+ */
30
80
  path: string;
81
+
82
+ /**
83
+ * Method of the neighbor route.
84
+ */
31
85
  method: string;
32
86
  }
33
87
  }
@@ -1,29 +1,29 @@
1
- import { IJsonComponents } from "typia";
2
-
3
- import { ISwaggerSecurityScheme } from "./ISwaggerSecurityScheme";
4
-
5
- /**
6
- * Reusable components in Swagger.
7
- *
8
- * `ISwaggerComponents` is a data structure representing content of `components` object
9
- * in `swagger.json` file generated by Nestia. Note that, this is not an universal
10
- * structure, but a dedicated structure only for Nestia.
11
- *
12
- * @author Jeongho Nam - https://github.com/samchon
13
- */
14
- export interface ISwaggerComponents {
15
- /**
16
- * An object to hold reusable DTO schemas.
17
- *
18
- * For reference, `nestia` stores every object and alias types as reusable DTO
19
- * schemas. The alias type means that defined by `type` keyword in TypeScript.
20
- */
21
- schemas?: Record<string, IJsonComponents.IAlias>;
22
-
23
- /**
24
- * An object to hold reusable security schemes.
25
- *
26
- * This property be configured by user in `nestia.config.ts` file.
27
- */
28
- securitySchemes?: Record<string, ISwaggerSecurityScheme>;
29
- }
1
+ import { IJsonComponents } from "typia";
2
+
3
+ import { ISwaggerSecurityScheme } from "./ISwaggerSecurityScheme";
4
+
5
+ /**
6
+ * Reusable components in Swagger.
7
+ *
8
+ * `ISwaggerComponents` is a data structure representing content of `components` object
9
+ * in `swagger.json` file generated by Nestia. Note that, this is not an universal
10
+ * structure, but a dedicated structure only for Nestia.
11
+ *
12
+ * @author Jeongho Nam - https://github.com/samchon
13
+ */
14
+ export interface ISwaggerComponents {
15
+ /**
16
+ * An object to hold reusable DTO schemas.
17
+ *
18
+ * For reference, `nestia` stores every object and alias types as reusable DTO
19
+ * schemas. The alias type means that defined by `type` keyword in TypeScript.
20
+ */
21
+ schemas?: Record<string, IJsonComponents.IAlias>;
22
+
23
+ /**
24
+ * An object to hold reusable security schemes.
25
+ *
26
+ * This property be configured by user in `nestia.config.ts` file.
27
+ */
28
+ securitySchemes?: Record<string, ISwaggerSecurityScheme>;
29
+ }
@@ -1,80 +1,80 @@
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
- /**
13
- * A short description of the API.
14
- */
15
- description?: string;
16
-
17
- /**
18
- * A URL to the Terms of Service for the API.
19
- *
20
- * @format uri
21
- */
22
- termsOfService?: string;
23
-
24
- /**
25
- * The contact information for the exposed API.
26
- */
27
- contact?: ISwaggerInfo.IContact;
28
-
29
- /**
30
- * The license information for the exposed API.
31
- */
32
- license?: ISwaggerInfo.ILicense;
33
-
34
- /**
35
- * Version of the API.
36
- */
37
- version: string;
38
- }
39
- export namespace ISwaggerInfo {
40
- /**
41
- * Contact information for the exposed API.
42
- */
43
- export interface IContact {
44
- /**
45
- * The identifying name of the contact person/organization.
46
- */
47
- name?: string;
48
-
49
- /**
50
- * The URL pointing to the contact information.
51
- *
52
- * @format uri
53
- */
54
- url?: string;
55
-
56
- /**
57
- * The email address of the contact person/organization.
58
- *
59
- * @format email
60
- */
61
- email?: string;
62
- }
63
-
64
- /**
65
- * License information for the exposed API.
66
- */
67
- export interface ILicense {
68
- /**
69
- * The license name used for the API.
70
- */
71
- name: string;
72
-
73
- /**
74
- * A URL to the license used for the API.
75
- *
76
- * @format uri
77
- */
78
- url?: string;
79
- }
80
- }
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
+ /**
13
+ * A short description of the API.
14
+ */
15
+ description?: string;
16
+
17
+ /**
18
+ * A URL to the Terms of Service for the API.
19
+ *
20
+ * @format uri
21
+ */
22
+ termsOfService?: string;
23
+
24
+ /**
25
+ * The contact information for the exposed API.
26
+ */
27
+ contact?: ISwaggerInfo.IContact;
28
+
29
+ /**
30
+ * The license information for the exposed API.
31
+ */
32
+ license?: ISwaggerInfo.ILicense;
33
+
34
+ /**
35
+ * Version of the API.
36
+ */
37
+ version: string;
38
+ }
39
+ export namespace ISwaggerInfo {
40
+ /**
41
+ * Contact information for the exposed API.
42
+ */
43
+ export interface IContact {
44
+ /**
45
+ * The identifying name of the contact person/organization.
46
+ */
47
+ name?: string;
48
+
49
+ /**
50
+ * The URL pointing to the contact information.
51
+ *
52
+ * @format uri
53
+ */
54
+ url?: string;
55
+
56
+ /**
57
+ * The email address of the contact person/organization.
58
+ *
59
+ * @format email
60
+ */
61
+ email?: string;
62
+ }
63
+
64
+ /**
65
+ * License information for the exposed API.
66
+ */
67
+ export interface ILicense {
68
+ /**
69
+ * The license name used for the API.
70
+ */
71
+ name: string;
72
+
73
+ /**
74
+ * A URL to the license used for the API.
75
+ *
76
+ * @format uri
77
+ */
78
+ url?: string;
79
+ }
80
+ }
@@ -1,65 +1,65 @@
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 =
12
- | ISwaggerSecurityScheme.IHttpBasic
13
- | ISwaggerSecurityScheme.IHttpBearer
14
- | ISwaggerSecurityScheme.IApiKey
15
- | ISwaggerSecurityScheme.IOpenId
16
- | ISwaggerSecurityScheme.IOAuth2;
17
- export namespace ISwaggerSecurityScheme {
18
- export interface IHttpBasic {
19
- type: "http";
20
- scheme: "basic";
21
- }
22
- export interface IHttpBearer {
23
- type: "http";
24
- scheme: "bearer";
25
- bearerFormat?: string;
26
- }
27
- export interface IApiKey {
28
- type: "apiKey";
29
-
30
- /**
31
- * @default header
32
- */
33
- in?: "header" | "query" | "cookie";
34
-
35
- /**
36
- * @default Authorization
37
- */
38
- name?: string;
39
- }
40
-
41
- export interface IOpenId {
42
- type: "openIdConnect";
43
- openIdConnectUrl: string;
44
- }
45
-
46
- export interface IOAuth2 {
47
- type: "oauth2";
48
- flows: IOAuth2.IFlowSet;
49
- description?: string;
50
- }
51
- export namespace IOAuth2 {
52
- export interface IFlowSet {
53
- authorizationCode?: IFlow;
54
- implicit?: Omit<IFlow, "tokenUrl">;
55
- password?: Omit<IFlow, "authorizationUrl">;
56
- clientCredentials?: Omit<IFlow, "authorizationUrl">;
57
- }
58
- export interface IFlow {
59
- authorizationUrl: string;
60
- tokenUrl: string;
61
- refreshUrl: string;
62
- scopes?: Record<string, string>;
63
- }
64
- }
65
- }
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 =
12
+ | ISwaggerSecurityScheme.IHttpBasic
13
+ | ISwaggerSecurityScheme.IHttpBearer
14
+ | ISwaggerSecurityScheme.IApiKey
15
+ | ISwaggerSecurityScheme.IOpenId
16
+ | ISwaggerSecurityScheme.IOAuth2;
17
+ export namespace ISwaggerSecurityScheme {
18
+ export interface IHttpBasic {
19
+ type: "http";
20
+ scheme: "basic";
21
+ }
22
+ export interface IHttpBearer {
23
+ type: "http";
24
+ scheme: "bearer";
25
+ bearerFormat?: string;
26
+ }
27
+ export interface IApiKey {
28
+ type: "apiKey";
29
+
30
+ /**
31
+ * @default header
32
+ */
33
+ in?: "header" | "query" | "cookie";
34
+
35
+ /**
36
+ * @default Authorization
37
+ */
38
+ name?: string;
39
+ }
40
+
41
+ export interface IOpenId {
42
+ type: "openIdConnect";
43
+ openIdConnectUrl: string;
44
+ }
45
+
46
+ export interface IOAuth2 {
47
+ type: "oauth2";
48
+ flows: IOAuth2.IFlowSet;
49
+ description?: string;
50
+ }
51
+ export namespace IOAuth2 {
52
+ export interface IFlowSet {
53
+ authorizationCode?: IFlow;
54
+ implicit?: Omit<IFlow, "tokenUrl">;
55
+ password?: Omit<IFlow, "authorizationUrl">;
56
+ clientCredentials?: Omit<IFlow, "authorizationUrl">;
57
+ }
58
+ export interface IFlow {
59
+ authorizationUrl: string;
60
+ tokenUrl: string;
61
+ refreshUrl: string;
62
+ scopes?: Record<string, string>;
63
+ }
64
+ }
65
+ }