@nestia/sdk 3.1.0-dev.20240426 → 3.1.0-dev.20240430

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 (58) hide show
  1. package/lib/analyses/TypedWebSocketOperationAnalyzer.js +1 -1
  2. package/lib/analyses/TypedWebSocketOperationAnalyzer.js.map +1 -1
  3. package/lib/executable/sdk.js +11 -11
  4. package/lib/generates/SwaggerGenerator.js +1 -1
  5. package/lib/generates/SwaggerGenerator.js.map +1 -1
  6. package/lib/generates/internal/SdkHttpFunctionProgrammer.js +18 -20
  7. package/lib/generates/internal/SdkHttpFunctionProgrammer.js.map +1 -1
  8. package/lib/generates/internal/SdkWebSocketRouteProgrammer.js +30 -1
  9. package/lib/generates/internal/SdkWebSocketRouteProgrammer.js.map +1 -1
  10. package/lib/structures/ITypedWebSocketRoute.d.ts +1 -0
  11. package/package.json +4 -4
  12. package/src/NestiaSdkApplication.ts +257 -257
  13. package/src/analyses/AccessorAnalyzer.ts +67 -67
  14. package/src/analyses/ConfigAnalyzer.ts +147 -147
  15. package/src/analyses/GenericAnalyzer.ts +51 -51
  16. package/src/analyses/PathAnalyzer.ts +69 -69
  17. package/src/analyses/SecurityAnalyzer.ts +25 -25
  18. package/src/analyses/TypedWebSocketOperationAnalyzer.ts +1 -0
  19. package/src/executable/internal/CommandParser.ts +15 -15
  20. package/src/executable/internal/NestiaConfigLoader.ts +67 -67
  21. package/src/executable/internal/NestiaSdkCommand.ts +60 -60
  22. package/src/executable/sdk.ts +73 -73
  23. package/src/generates/CloneGenerator.ts +64 -64
  24. package/src/generates/E2eGenerator.ts +64 -64
  25. package/src/generates/SdkGenerator.ts +91 -91
  26. package/src/generates/SwaggerGenerator.ts +1 -1
  27. package/src/generates/internal/E2eFileProgrammer.ts +178 -178
  28. package/src/generates/internal/FilePrinter.ts +53 -53
  29. package/src/generates/internal/SdkAliasCollection.ts +157 -157
  30. package/src/generates/internal/SdkDistributionComposer.ts +100 -100
  31. package/src/generates/internal/SdkFileProgrammer.ts +119 -119
  32. package/src/generates/internal/SdkHttpCloneProgrammer.ts +154 -154
  33. package/src/generates/internal/SdkHttpFunctionProgrammer.ts +298 -299
  34. package/src/generates/internal/SdkHttpNamespaceProgrammer.ts +505 -505
  35. package/src/generates/internal/SdkHttpRouteProgrammer.ts +82 -82
  36. package/src/generates/internal/SdkHttpSimulationProgrammer.ts +363 -363
  37. package/src/generates/internal/SdkImportWizard.ts +55 -55
  38. package/src/generates/internal/SdkRouteDirectory.ts +18 -18
  39. package/src/generates/internal/SdkWebSocketRouteProgrammer.ts +42 -1
  40. package/src/generates/internal/SwaggerSchemaValidator.ts +198 -198
  41. package/src/index.ts +4 -4
  42. package/src/module.ts +2 -2
  43. package/src/structures/IErrorReport.ts +6 -6
  44. package/src/structures/INestiaProject.ts +13 -13
  45. package/src/structures/INormalizedInput.ts +20 -20
  46. package/src/structures/IReflectController.ts +17 -17
  47. package/src/structures/ITypeTuple.ts +6 -6
  48. package/src/structures/ITypedHttpRoute.ts +55 -55
  49. package/src/structures/ITypedWebSocketRoute.ts +1 -0
  50. package/src/structures/MethodType.ts +5 -5
  51. package/src/structures/ParamCategory.ts +1 -1
  52. package/src/utils/ArrayUtil.ts +26 -26
  53. package/src/utils/FileRetriever.ts +22 -22
  54. package/src/utils/MapUtil.ts +14 -14
  55. package/src/utils/PathUtil.ts +10 -10
  56. package/src/utils/SourceFinder.ts +66 -66
  57. package/src/utils/StringUtil.ts +6 -6
  58. package/src/utils/StripEnums.ts +5 -5
@@ -1,82 +1,82 @@
1
- import ts from "typescript";
2
- import { IJsDocTagInfo } from "typia";
3
-
4
- import { INestiaProject } from "../../structures/INestiaProject";
5
- import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
6
- import { FilePrinter } from "./FilePrinter";
7
- import { ImportDictionary } from "./ImportDictionary";
8
- import { SdkHttpFunctionProgrammer } from "./SdkHttpFunctionProgrammer";
9
- import { SdkHttpNamespaceProgrammer } from "./SdkHttpNamespaceProgrammer";
10
-
11
- export namespace SdkHttpRouteProgrammer {
12
- export const write =
13
- (project: INestiaProject) =>
14
- (importer: ImportDictionary) =>
15
- (route: ITypedHttpRoute): ts.Statement[] => {
16
- const props = {
17
- headers: route.parameters.find(
18
- (p) => p.category === "headers" && p.field === undefined,
19
- ),
20
- query: route.parameters.find(
21
- (p) => p.category === "query" && p.field === undefined,
22
- ),
23
- input: route.parameters.find((p) => p.category === "body"),
24
- };
25
- return [
26
- FilePrinter.description(
27
- SdkHttpFunctionProgrammer.write(project)(importer)(route, props),
28
- describe(route),
29
- ),
30
- SdkHttpNamespaceProgrammer.write(project)(importer)(route, props),
31
- ];
32
- };
33
-
34
- const describe = (route: ITypedHttpRoute): string => {
35
- // MAIN DESCRIPTION
36
- const comments: string[] = route.description
37
- ? route.description.split("\n")
38
- : [];
39
-
40
- // COMMENT TAGS
41
- const tags: IJsDocTagInfo[] = route.jsDocTags.filter(
42
- (tag) =>
43
- tag.name !== "param" ||
44
- route.parameters
45
- .filter((p) => p.category !== "headers")
46
- .some((p) => p.name === tag.text?.[0]?.text),
47
- );
48
- if (tags.length !== 0) {
49
- const content: string[] = tags.map((t) =>
50
- t.text?.length
51
- ? `@${t.name} ${t.text.map((e) => e.text).join("")}`
52
- : `@${t.name}`,
53
- );
54
- comments.push("", ...new Set(content));
55
- }
56
-
57
- // EXCEPTIONS
58
- for (const [key, value] of Object.entries(route.exceptions)) {
59
- if (
60
- comments.some(
61
- (str) =>
62
- str.startsWith(`@throw ${key}`) || str.startsWith(`@throws ${key}`),
63
- )
64
- )
65
- continue;
66
- comments.push(
67
- value.description?.length
68
- ? `@throws ${key} ${value.description.split("\n")[0]}`
69
- : `@throws ${key}`,
70
- );
71
- }
72
-
73
- // POSTFIX
74
- if (!!comments.length) comments.push("");
75
- comments.push(
76
- `@controller ${route.controller.name}.${route.name}`,
77
- `@path ${route.method} ${route.path}`,
78
- `@nestia Generated by Nestia - https://github.com/samchon/nestia`,
79
- );
80
- return comments.join("\n");
81
- };
82
- }
1
+ import ts from "typescript";
2
+ import { IJsDocTagInfo } from "typia";
3
+
4
+ import { INestiaProject } from "../../structures/INestiaProject";
5
+ import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
6
+ import { FilePrinter } from "./FilePrinter";
7
+ import { ImportDictionary } from "./ImportDictionary";
8
+ import { SdkHttpFunctionProgrammer } from "./SdkHttpFunctionProgrammer";
9
+ import { SdkHttpNamespaceProgrammer } from "./SdkHttpNamespaceProgrammer";
10
+
11
+ export namespace SdkHttpRouteProgrammer {
12
+ export const write =
13
+ (project: INestiaProject) =>
14
+ (importer: ImportDictionary) =>
15
+ (route: ITypedHttpRoute): ts.Statement[] => {
16
+ const props = {
17
+ headers: route.parameters.find(
18
+ (p) => p.category === "headers" && p.field === undefined,
19
+ ),
20
+ query: route.parameters.find(
21
+ (p) => p.category === "query" && p.field === undefined,
22
+ ),
23
+ input: route.parameters.find((p) => p.category === "body"),
24
+ };
25
+ return [
26
+ FilePrinter.description(
27
+ SdkHttpFunctionProgrammer.write(project)(importer)(route, props),
28
+ describe(route),
29
+ ),
30
+ SdkHttpNamespaceProgrammer.write(project)(importer)(route, props),
31
+ ];
32
+ };
33
+
34
+ const describe = (route: ITypedHttpRoute): string => {
35
+ // MAIN DESCRIPTION
36
+ const comments: string[] = route.description
37
+ ? route.description.split("\n")
38
+ : [];
39
+
40
+ // COMMENT TAGS
41
+ const tags: IJsDocTagInfo[] = route.jsDocTags.filter(
42
+ (tag) =>
43
+ tag.name !== "param" ||
44
+ route.parameters
45
+ .filter((p) => p.category !== "headers")
46
+ .some((p) => p.name === tag.text?.[0]?.text),
47
+ );
48
+ if (tags.length !== 0) {
49
+ const content: string[] = tags.map((t) =>
50
+ t.text?.length
51
+ ? `@${t.name} ${t.text.map((e) => e.text).join("")}`
52
+ : `@${t.name}`,
53
+ );
54
+ comments.push("", ...new Set(content));
55
+ }
56
+
57
+ // EXCEPTIONS
58
+ for (const [key, value] of Object.entries(route.exceptions)) {
59
+ if (
60
+ comments.some(
61
+ (str) =>
62
+ str.startsWith(`@throw ${key}`) || str.startsWith(`@throws ${key}`),
63
+ )
64
+ )
65
+ continue;
66
+ comments.push(
67
+ value.description?.length
68
+ ? `@throws ${key} ${value.description.split("\n")[0]}`
69
+ : `@throws ${key}`,
70
+ );
71
+ }
72
+
73
+ // POSTFIX
74
+ if (!!comments.length) comments.push("");
75
+ comments.push(
76
+ `@controller ${route.controller.name}.${route.name}`,
77
+ `@path ${route.method} ${route.path}`,
78
+ `@nestia Generated by Nestia - https://github.com/samchon/nestia`,
79
+ );
80
+ return comments.join("\n");
81
+ };
82
+ }