@nestia/sdk 2.6.4 → 3.0.0-dev.20240412

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/lib/INestiaConfig.d.ts +5 -8
  2. package/lib/analyses/ExceptionAnalyzer.js +2 -2
  3. package/lib/analyses/ExceptionAnalyzer.js.map +1 -1
  4. package/lib/analyses/PathAnalyzer.d.ts +0 -2
  5. package/lib/executable/internal/NestiaConfigLoader.js +190 -132
  6. package/lib/executable/internal/NestiaConfigLoader.js.map +1 -1
  7. package/lib/generates/SwaggerGenerator.d.ts +2 -2
  8. package/lib/generates/SwaggerGenerator.js +15 -15
  9. package/lib/generates/SwaggerGenerator.js.map +1 -1
  10. package/lib/generates/internal/SdkAliasCollection.js +1 -1
  11. package/lib/generates/internal/SdkFunctionProgrammer.js +2 -2
  12. package/lib/generates/internal/SdkNamespaceProgrammer.js +2 -2
  13. package/lib/generates/internal/SdkTypeProgrammer.js +10 -10
  14. package/lib/generates/internal/SdkTypeProgrammer.js.map +1 -1
  15. package/lib/generates/internal/SwaggerSchemaGenerator.d.ts +4 -4
  16. package/lib/generates/internal/SwaggerSchemaGenerator.js +3 -3
  17. package/lib/generates/internal/SwaggerSchemaGenerator.js.map +1 -1
  18. package/lib/structures/ISwaggerLazyProperty.d.ts +2 -2
  19. package/lib/structures/ISwaggerLazySchema.d.ts +2 -2
  20. package/package.json +6 -5
  21. package/src/INestiaConfig.ts +258 -261
  22. package/src/analyses/ExceptionAnalyzer.ts +2 -2
  23. package/src/generates/SwaggerGenerator.ts +35 -38
  24. package/src/generates/internal/SdkTypeProgrammer.ts +12 -11
  25. package/src/generates/internal/SwaggerSchemaGenerator.ts +22 -23
  26. package/src/structures/ISwaggerError.ts +8 -8
  27. package/src/structures/ISwaggerLazyProperty.ts +7 -7
  28. package/src/structures/ISwaggerLazySchema.ts +7 -7
  29. package/lib/structures/ISwagger.d.ts +0 -49
  30. package/lib/structures/ISwagger.js +0 -3
  31. package/lib/structures/ISwagger.js.map +0 -1
  32. package/lib/structures/ISwaggerComponents.d.ts +0 -26
  33. package/lib/structures/ISwaggerComponents.js +0 -3
  34. package/lib/structures/ISwaggerComponents.js.map +0 -1
  35. package/lib/structures/ISwaggerInfo.d.ts +0 -71
  36. package/lib/structures/ISwaggerInfo.js +0 -3
  37. package/lib/structures/ISwaggerInfo.js.map +0 -1
  38. package/lib/structures/ISwaggerRoute.d.ts +0 -50
  39. package/lib/structures/ISwaggerRoute.js +0 -3
  40. package/lib/structures/ISwaggerRoute.js.map +0 -1
  41. package/lib/structures/ISwaggerSecurityScheme.d.ts +0 -56
  42. package/lib/structures/ISwaggerSecurityScheme.js +0 -3
  43. package/lib/structures/ISwaggerSecurityScheme.js.map +0 -1
  44. package/lib/structures/ISwaggerServer.d.ts +0 -15
  45. package/lib/structures/ISwaggerServer.js +0 -3
  46. package/lib/structures/ISwaggerServer.js.map +0 -1
  47. package/lib/structures/ISwaggerTag.d.ts +0 -9
  48. package/lib/structures/ISwaggerTag.js +0 -3
  49. package/lib/structures/ISwaggerTag.js.map +0 -1
  50. package/src/structures/ISwagger.ts +0 -66
  51. package/src/structures/ISwaggerComponents.ts +0 -29
  52. package/src/structures/ISwaggerInfo.ts +0 -80
  53. package/src/structures/ISwaggerRoute.ts +0 -54
  54. package/src/structures/ISwaggerSecurityScheme.ts +0 -65
  55. package/src/structures/ISwaggerServer.ts +0 -16
  56. package/src/structures/ISwaggerTag.ts +0 -9
@@ -1,50 +0,0 @@
1
- import { IJsonSchema } from "typia";
2
- import { IJsDocTagInfo } from "typia/lib/schemas/metadata/IJsDocTagInfo";
3
- export interface ISwaggerRoute {
4
- deprecated?: boolean;
5
- security?: Record<string, string[]>[];
6
- operationId?: string;
7
- tags: string[];
8
- parameters: ISwaggerRoute.IParameter[];
9
- requestBody?: ISwaggerRoute.IRequestBody;
10
- responses: ISwaggerRoute.IResponseBody;
11
- summary?: string;
12
- description?: string;
13
- "x-nestia-method"?: string;
14
- "x-nestia-namespace"?: string;
15
- "x-nestia-jsDocTags"?: IJsDocTagInfo[];
16
- }
17
- export declare namespace ISwaggerRoute {
18
- interface IParameter {
19
- name: string;
20
- in: string;
21
- schema: IJsonSchema;
22
- required: boolean;
23
- description?: string;
24
- }
25
- interface IRequestBody {
26
- description?: string;
27
- content: IContent;
28
- required: true;
29
- "x-nestia-encrypted"?: boolean;
30
- }
31
- type IResponseBody = Record<string, {
32
- description: string;
33
- content?: IContent;
34
- "x-nestia-encrypted"?: boolean;
35
- }>;
36
- interface IContent {
37
- "application/x-www-form-urlencoded"?: {
38
- schema: IJsonSchema;
39
- };
40
- "application/json"?: {
41
- schema: IJsonSchema;
42
- };
43
- "text/plain"?: {
44
- schema: IJsonSchema;
45
- };
46
- "multipart/form-data"?: {
47
- schema: IJsonSchema;
48
- };
49
- }
50
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=ISwaggerRoute.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ISwaggerRoute.js","sourceRoot":"","sources":["../../src/structures/ISwaggerRoute.ts"],"names":[],"mappings":""}
@@ -1,56 +0,0 @@
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
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=ISwaggerSecurityScheme.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ISwaggerSecurityScheme.js","sourceRoot":"","sources":["../../src/structures/ISwaggerSecurityScheme.ts"],"names":[],"mappings":""}
@@ -1,15 +0,0 @@
1
- /**
2
- * Remote server definition.
3
- */
4
- export interface ISwaggerServer {
5
- /**
6
- * A URL to the target host.
7
- *
8
- * @format uri
9
- */
10
- url: string;
11
- /**
12
- * An optional string describing the target server.
13
- */
14
- description?: string;
15
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=ISwaggerServer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ISwaggerServer.js","sourceRoot":"","sources":["../../src/structures/ISwaggerServer.ts"],"names":[],"mappings":""}
@@ -1,9 +0,0 @@
1
- /**
2
- * Tag name and description.
3
- *
4
- * @author Jeongho Nam - https://github.com/samchon
5
- */
6
- export interface ISwaggerTag {
7
- name: string;
8
- description?: string;
9
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=ISwaggerTag.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ISwaggerTag.js","sourceRoot":"","sources":["../../src/structures/ISwaggerTag.ts"],"names":[],"mappings":""}
@@ -1,66 +0,0 @@
1
- import { ISwaggerComponents } from "./ISwaggerComponents";
2
- import { ISwaggerInfo } from "./ISwaggerInfo";
3
- import { ISwaggerRoute } from "./ISwaggerRoute";
4
- import { ISwaggerServer } from "./ISwaggerServer";
5
- import { ISwaggerTag } from "./ISwaggerTag";
6
-
7
- /**
8
- * Swagger Document.
9
- *
10
- * `ISwagger` is a data structure representing content of `swagger.json` file
11
- * generated by Nestia. Note that, this is not an universal structure, but a dedicated
12
- * structure only for Nestia.
13
- *
14
- * @author Jeongho Nam - https://github.com/samchon
15
- */
16
- export interface ISwagger {
17
- /**
18
- * The version of the OpenAPI document.
19
- *
20
- * Nestia always generate OpenAPI 3.0.x document.
21
- */
22
- openapi: `3.0.${number}`;
23
-
24
- /**
25
- * List of servers that provide the API.
26
- */
27
- servers: ISwaggerServer[];
28
-
29
- /**
30
- * Information about the API.
31
- */
32
- info: ISwaggerInfo;
33
-
34
- /**
35
- * The available paths and operations for the API.
36
- *
37
- * The 1st key is the path, and the 2nd key is the HTTP method.
38
- */
39
- paths: Record<string, Record<string, ISwaggerRoute>>;
40
-
41
- /**
42
- * An object to hold reusable data structures.
43
- *
44
- * It stores both DTO schemas and security schemes.
45
- *
46
- * For reference, `nestia` defines every object and alias types as reusable DTO
47
- * schemas. The alias type means that defined by `type` keyword in TypeScript.
48
- */
49
- components: ISwaggerComponents;
50
-
51
- /**
52
- * List of tags.
53
- */
54
- tags: ISwaggerTag[];
55
-
56
- // /**
57
- // * A declaration of which security mechanisms can be used across the API.
58
- // *
59
- // * When this property be configured, it would be overwritten in every API routes.
60
- // *
61
- // * For reference, key means the name of security scheme and value means the `scopes`.
62
- // * The `scopes` can be used only when target security scheme is `oauth2` type,
63
- // * especially for {@link ISwaggerSecurityScheme.IOAuth2.IFlow.scopes} property.
64
- // */
65
- // security?: Record<string, string[]>[];
66
- }
@@ -1,29 +0,0 @@
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 +0,0 @@
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,54 +0,0 @@
1
- import { IJsonSchema } from "typia";
2
- import { IJsDocTagInfo } from "typia/lib/schemas/metadata/IJsDocTagInfo";
3
-
4
- export interface ISwaggerRoute {
5
- deprecated?: boolean;
6
- security?: Record<string, string[]>[];
7
- operationId?: string;
8
- tags: string[];
9
- parameters: ISwaggerRoute.IParameter[];
10
- requestBody?: ISwaggerRoute.IRequestBody;
11
- responses: ISwaggerRoute.IResponseBody;
12
- summary?: string;
13
- description?: string;
14
- "x-nestia-method"?: string;
15
- "x-nestia-namespace"?: string;
16
- "x-nestia-jsDocTags"?: IJsDocTagInfo[];
17
- }
18
- export namespace ISwaggerRoute {
19
- export interface IParameter {
20
- name: string;
21
- in: string;
22
- schema: IJsonSchema;
23
- required: boolean;
24
- description?: string;
25
- }
26
- export interface IRequestBody {
27
- description?: string;
28
- content: IContent;
29
- required: true;
30
- "x-nestia-encrypted"?: boolean;
31
- }
32
- export type IResponseBody = Record<
33
- string,
34
- {
35
- description: string;
36
- content?: IContent;
37
- "x-nestia-encrypted"?: boolean;
38
- }
39
- >;
40
- export interface IContent {
41
- "application/x-www-form-urlencoded"?: {
42
- schema: IJsonSchema;
43
- };
44
- "application/json"?: {
45
- schema: IJsonSchema;
46
- };
47
- "text/plain"?: {
48
- schema: IJsonSchema;
49
- };
50
- "multipart/form-data"?: {
51
- schema: IJsonSchema;
52
- };
53
- }
54
- }
@@ -1,65 +0,0 @@
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,16 +0,0 @@
1
- /**
2
- * Remote server definition.
3
- */
4
- export interface ISwaggerServer {
5
- /**
6
- * A URL to the target host.
7
- *
8
- * @format uri
9
- */
10
- url: string;
11
-
12
- /**
13
- * An optional string describing the target server.
14
- */
15
- description?: string;
16
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Tag name and description.
3
- *
4
- * @author Jeongho Nam - https://github.com/samchon
5
- */
6
- export interface ISwaggerTag {
7
- name: string;
8
- description?: string;
9
- }