@nestia/sdk 12.0.0-dev.20260521.6 → 12.0.0-dev.20260612.2

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 (209) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +93 -93
  3. package/assets/bundle/api/HttpError.ts +1 -1
  4. package/assets/bundle/api/IConnection.ts +1 -1
  5. package/assets/bundle/api/Primitive.ts +1 -1
  6. package/assets/bundle/api/Resolved.ts +1 -1
  7. package/assets/bundle/api/index.ts +4 -4
  8. package/assets/bundle/api/module.ts +6 -6
  9. package/assets/bundle/distribute/README.md +37 -37
  10. package/assets/bundle/distribute/package.json +28 -28
  11. package/assets/bundle/distribute/tsconfig.json +109 -109
  12. package/assets/bundle/e2e/index.ts +42 -42
  13. package/assets/config/nestia.config.ts +97 -97
  14. package/lib/NestiaSdkApplication.js +29 -7
  15. package/lib/NestiaSdkApplication.js.map +1 -1
  16. package/lib/NestiaSwaggerComposer.js +21 -13
  17. package/lib/NestiaSwaggerComposer.js.map +1 -1
  18. package/lib/analyses/AccessorAnalyzer.d.ts +4 -1
  19. package/lib/analyses/AccessorAnalyzer.js.map +1 -1
  20. package/lib/analyses/ConfigAnalyzer.js +1 -1
  21. package/lib/analyses/PathAnalyzer.d.ts +18 -3
  22. package/lib/analyses/PathAnalyzer.js +32 -0
  23. package/lib/analyses/PathAnalyzer.js.map +1 -1
  24. package/lib/analyses/ReflectControllerAnalyzer.js +3 -2
  25. package/lib/analyses/ReflectControllerAnalyzer.js.map +1 -1
  26. package/lib/analyses/ReflectHttpOperationAnalyzer.d.ts +1 -1
  27. package/lib/analyses/ReflectHttpOperationAnalyzer.js +1 -1
  28. package/lib/analyses/ReflectHttpOperationAnalyzer.js.map +1 -1
  29. package/lib/analyses/ReflectHttpOperationResponseAnalyzer.d.ts +1 -1
  30. package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js +53 -20
  31. package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js.map +1 -1
  32. package/lib/analyses/ReflectMcpOperationAnalyzer.d.ts +14 -0
  33. package/lib/analyses/ReflectMcpOperationAnalyzer.js +79 -0
  34. package/lib/analyses/ReflectMcpOperationAnalyzer.js.map +1 -0
  35. package/lib/analyses/TypedMcpRouteAnalyzer.d.ts +9 -0
  36. package/lib/analyses/TypedMcpRouteAnalyzer.js +31 -0
  37. package/lib/analyses/TypedMcpRouteAnalyzer.js.map +1 -0
  38. package/lib/executable/internal/NestiaConfigLoader.js +5 -1
  39. package/lib/executable/internal/NestiaConfigLoader.js.map +1 -1
  40. package/lib/executable/internal/NestiaSdkCommand.js +30 -14
  41. package/lib/executable/internal/NestiaSdkCommand.js.map +1 -1
  42. package/lib/executable/internal/NestiaSdkWatcher.d.ts +10 -0
  43. package/lib/executable/internal/NestiaSdkWatcher.js +322 -0
  44. package/lib/executable/internal/NestiaSdkWatcher.js.map +1 -0
  45. package/lib/executable/sdk.js +12 -12
  46. package/lib/executable/sdk.js.map +1 -1
  47. package/lib/generates/CloneGenerator.js +4 -2
  48. package/lib/generates/CloneGenerator.js.map +1 -1
  49. package/lib/generates/SdkGenerator.js +51 -42
  50. package/lib/generates/SdkGenerator.js.map +1 -1
  51. package/lib/generates/SwaggerGenerator.js +18 -2
  52. package/lib/generates/SwaggerGenerator.js.map +1 -1
  53. package/lib/generates/internal/E2eFileProgrammer.js +3 -1
  54. package/lib/generates/internal/E2eFileProgrammer.js.map +1 -1
  55. package/lib/generates/internal/ImportDictionary.d.ts +1 -0
  56. package/lib/generates/internal/ImportDictionary.js +9 -4
  57. package/lib/generates/internal/ImportDictionary.js.map +1 -1
  58. package/lib/generates/internal/SdkAliasCollection.d.ts +2 -0
  59. package/lib/generates/internal/SdkAliasCollection.js +11 -2
  60. package/lib/generates/internal/SdkAliasCollection.js.map +1 -1
  61. package/lib/generates/internal/SdkDistributionComposer.d.ts +1 -0
  62. package/lib/generates/internal/SdkDistributionComposer.js +3 -0
  63. package/lib/generates/internal/SdkDistributionComposer.js.map +1 -1
  64. package/lib/generates/internal/SdkFileProgrammer.js +4 -1
  65. package/lib/generates/internal/SdkFileProgrammer.js.map +1 -1
  66. package/lib/generates/internal/SdkHttpCloneReferencer.d.ts +1 -1
  67. package/lib/generates/internal/SdkHttpCloneReferencer.js +42 -9
  68. package/lib/generates/internal/SdkHttpCloneReferencer.js.map +1 -1
  69. package/lib/generates/internal/SdkHttpFunctionProgrammer.js +3 -4
  70. package/lib/generates/internal/SdkHttpFunctionProgrammer.js.map +1 -1
  71. package/lib/generates/internal/SdkHttpNamespaceProgrammer.js +2 -1
  72. package/lib/generates/internal/SdkHttpNamespaceProgrammer.js.map +1 -1
  73. package/lib/generates/internal/SdkHttpSimulationProgrammer.js +6 -3
  74. package/lib/generates/internal/SdkHttpSimulationProgrammer.js.map +1 -1
  75. package/lib/generates/internal/SdkMcpRouteProgrammer.d.ts +15 -0
  76. package/lib/generates/internal/SdkMcpRouteProgrammer.js +148 -0
  77. package/lib/generates/internal/SdkMcpRouteProgrammer.js.map +1 -0
  78. package/lib/generates/internal/SdkRouteDirectory.d.ts +2 -1
  79. package/lib/generates/internal/SdkRouteDirectory.js.map +1 -1
  80. package/lib/generates/internal/SdkWebSocketCloneProgrammer.d.ts +6 -0
  81. package/lib/generates/internal/SdkWebSocketCloneProgrammer.js +283 -0
  82. package/lib/generates/internal/SdkWebSocketCloneProgrammer.js.map +1 -0
  83. package/lib/generates/internal/SdkWebSocketRouteProgrammer.js +11 -9
  84. package/lib/generates/internal/SdkWebSocketRouteProgrammer.js.map +1 -1
  85. package/lib/generates/internal/SwaggerOperationParameterComposer.js +10 -2
  86. package/lib/generates/internal/SwaggerOperationParameterComposer.js.map +1 -1
  87. package/lib/generates/internal/SwaggerOperationResponseComposer.d.ts +1 -1
  88. package/lib/generates/internal/SwaggerOperationResponseComposer.js +6 -1
  89. package/lib/generates/internal/SwaggerOperationResponseComposer.js.map +1 -1
  90. package/lib/generates/internal/SwaggerReadonlyArrayEmender.d.ts +9 -0
  91. package/lib/generates/internal/SwaggerReadonlyArrayEmender.js +174 -0
  92. package/lib/generates/internal/SwaggerReadonlyArrayEmender.js.map +1 -0
  93. package/lib/structures/INestiaSdkInput.d.ts +9 -2
  94. package/lib/structures/IReflectController.d.ts +2 -1
  95. package/lib/structures/IReflectHttpOperationSuccess.d.ts +4 -2
  96. package/lib/structures/IReflectMcpOperation.d.ts +35 -0
  97. package/lib/structures/IReflectMcpOperation.js +3 -0
  98. package/lib/structures/IReflectMcpOperation.js.map +1 -0
  99. package/lib/structures/IReflectMcpOperationParameter.d.ts +19 -0
  100. package/lib/structures/IReflectMcpOperationParameter.js +3 -0
  101. package/lib/structures/IReflectMcpOperationParameter.js.map +1 -0
  102. package/lib/structures/ITypedApplication.d.ts +2 -1
  103. package/lib/structures/ITypedHttpRouteSuccess.d.ts +3 -1
  104. package/lib/structures/ITypedMcpRoute.d.ts +31 -0
  105. package/lib/structures/ITypedMcpRoute.js +3 -0
  106. package/lib/structures/ITypedMcpRoute.js.map +1 -0
  107. package/lib/utils/HttpResponseContentTypeUtil.d.ts +5 -0
  108. package/lib/utils/HttpResponseContentTypeUtil.js +22 -0
  109. package/lib/utils/HttpResponseContentTypeUtil.js.map +1 -0
  110. package/native/go.mod +52 -52
  111. package/native/go.sum +84 -54
  112. package/native/sdk/register.go +322 -165
  113. package/native/sdk/sdk.go +17 -17
  114. package/native/sdk/sdk_metadata_json.go +327 -327
  115. package/native/sdk/sdk_transform.go +1879 -1549
  116. package/package.json +11 -9
  117. package/src/INestiaConfig.ts +267 -267
  118. package/src/NestiaSdkApplication.ts +39 -8
  119. package/src/NestiaSwaggerComposer.ts +153 -142
  120. package/src/analyses/AccessorAnalyzer.ts +64 -67
  121. package/src/analyses/ConfigAnalyzer.ts +330 -330
  122. package/src/analyses/ImportAnalyzer.ts +92 -92
  123. package/src/analyses/PathAnalyzer.ts +130 -69
  124. package/src/analyses/ReflectControllerAnalyzer.ts +112 -105
  125. package/src/analyses/ReflectHttpOperationAnalyzer.ts +183 -183
  126. package/src/analyses/ReflectHttpOperationExceptionAnalyzer.ts +90 -90
  127. package/src/analyses/ReflectHttpOperationParameterAnalyzer.ts +350 -350
  128. package/src/analyses/ReflectHttpOperationResponseAnalyzer.ts +163 -130
  129. package/src/analyses/ReflectMcpOperationAnalyzer.ts +124 -0
  130. package/src/analyses/ReflectMetadataAnalyzer.ts +44 -44
  131. package/src/analyses/SecurityAnalyzer.ts +25 -25
  132. package/src/analyses/TypedMcpRouteAnalyzer.ts +34 -0
  133. package/src/decorators/OperationMetadata.ts +29 -29
  134. package/src/executable/internal/CommandParser.ts +15 -15
  135. package/src/executable/internal/NestiaConfigLoader.ts +451 -446
  136. package/src/executable/internal/NestiaSdkCommand.ts +124 -106
  137. package/src/executable/internal/NestiaSdkWatcher.ts +342 -0
  138. package/src/executable/sdk.ts +90 -88
  139. package/src/generates/CloneGenerator.ts +73 -66
  140. package/src/generates/E2eGenerator.ts +32 -32
  141. package/src/generates/SdkGenerator.ts +176 -160
  142. package/src/generates/SwaggerGenerator.ts +342 -310
  143. package/src/generates/internal/E2eFileProgrammer.ts +240 -233
  144. package/src/generates/internal/FilePrinter.ts +65 -65
  145. package/src/generates/internal/ImportDictionary.ts +209 -204
  146. package/src/generates/internal/SdkAliasCollection.ts +274 -261
  147. package/src/generates/internal/SdkDistributionComposer.ts +123 -116
  148. package/src/generates/internal/SdkFileProgrammer.ts +116 -112
  149. package/src/generates/internal/SdkHttpCloneProgrammer.ts +126 -126
  150. package/src/generates/internal/SdkHttpCloneReferencer.ts +131 -77
  151. package/src/generates/internal/SdkHttpFunctionProgrammer.ts +301 -301
  152. package/src/generates/internal/SdkHttpNamespaceProgrammer.ts +520 -510
  153. package/src/generates/internal/SdkHttpParameterProgrammer.ts +165 -165
  154. package/src/generates/internal/SdkHttpRouteProgrammer.ts +109 -109
  155. package/src/generates/internal/SdkHttpSimulationProgrammer.ts +331 -314
  156. package/src/generates/internal/SdkImportWizard.ts +62 -62
  157. package/src/generates/internal/SdkMcpRouteProgrammer.ts +452 -0
  158. package/src/generates/internal/SdkRouteDirectory.ts +21 -18
  159. package/src/generates/internal/SdkTypeTagProgrammer.ts +114 -114
  160. package/src/generates/internal/SdkWebSocketCloneProgrammer.ts +319 -0
  161. package/src/generates/internal/SdkWebSocketNamespaceProgrammer.ts +389 -389
  162. package/src/generates/internal/SdkWebSocketParameterProgrammer.ts +89 -89
  163. package/src/generates/internal/SdkWebSocketRouteProgrammer.ts +331 -323
  164. package/src/generates/internal/SwaggerDescriptionComposer.ts +64 -64
  165. package/src/generates/internal/SwaggerOperationComposer.ts +119 -119
  166. package/src/generates/internal/SwaggerOperationParameterComposer.ts +175 -162
  167. package/src/generates/internal/SwaggerOperationResponseComposer.ts +115 -110
  168. package/src/generates/internal/SwaggerReadonlyArrayEmender.ts +262 -0
  169. package/src/index.ts +4 -4
  170. package/src/internal/legacy.ts +492 -492
  171. package/src/module.ts +4 -4
  172. package/src/structures/INestiaProject.ts +10 -10
  173. package/src/structures/INestiaSdkInput.ts +27 -20
  174. package/src/structures/IOperationMetadata.ts +41 -41
  175. package/src/structures/IReflectController.ts +18 -15
  176. package/src/structures/IReflectHttpOperation.ts +26 -26
  177. package/src/structures/IReflectHttpOperationException.ts +18 -18
  178. package/src/structures/IReflectHttpOperationParameter.ts +79 -79
  179. package/src/structures/IReflectHttpOperationSuccess.ts +18 -21
  180. package/src/structures/IReflectImport.ts +6 -6
  181. package/src/structures/IReflectMcpOperation.ts +38 -0
  182. package/src/structures/IReflectMcpOperationParameter.ts +27 -0
  183. package/src/structures/IReflectOperationError.ts +26 -26
  184. package/src/structures/IReflectType.ts +4 -4
  185. package/src/structures/IReflectWebSocketOperation.ts +17 -17
  186. package/src/structures/ITypedApplication.ts +12 -11
  187. package/src/structures/ITypedHttpRoute.ts +41 -41
  188. package/src/structures/ITypedHttpRouteException.ts +15 -15
  189. package/src/structures/ITypedHttpRouteParameter.ts +41 -41
  190. package/src/structures/ITypedHttpRouteSuccess.ts +18 -22
  191. package/src/structures/ITypedMcpRoute.ts +33 -0
  192. package/src/structures/ITypedWebSocketRoute.ts +24 -24
  193. package/src/structures/ITypedWebSocketRouteParameter.ts +3 -3
  194. package/src/transform.ts +59 -59
  195. package/src/typings/get-function-location.d.ts +7 -7
  196. package/src/utils/ArrayUtil.ts +26 -26
  197. package/src/utils/EmittedJavaScriptPatcher.ts +88 -88
  198. package/src/utils/FileRetriever.ts +22 -22
  199. package/src/utils/HttpResponseContentTypeUtil.ts +30 -0
  200. package/src/utils/MapUtil.ts +14 -14
  201. package/src/utils/PathUtil.ts +10 -10
  202. package/src/utils/SourceFinder.ts +63 -63
  203. package/src/utils/StringUtil.ts +17 -17
  204. package/src/utils/TsConfigReader.ts +108 -108
  205. package/src/utils/TtscExecutor.ts +68 -68
  206. package/src/utils/VersioningStrategy.ts +28 -28
  207. package/src/validators/HttpHeadersValidator.ts +11 -11
  208. package/src/validators/HttpQueryValidator.ts +11 -11
  209. package/src/validators/TextPlainValidator.ts +17 -17
@@ -1,109 +1,109 @@
1
- {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig to read more about this file */
4
-
5
- /* Projects */
6
- // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
- // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
- // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
- // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
- // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
- // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
-
13
- /* Language and Environment */
14
- "target": "ES5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
- "lib": [
16
- "DOM",
17
- "ES2015"
18
- ], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
19
- // "jsx": "preserve", /* Specify what JSX code is generated. */
20
- // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
21
- // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
22
- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
23
- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
24
- // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
25
- // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
26
- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
27
- // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
28
- // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
29
-
30
- /* Modules */
31
- "module": "commonjs", /* Specify what module code is generated. */
32
- // "rootDir": "./", /* Specify the root folder within your source files. */
33
- // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
34
- // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
35
- // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
36
- // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
37
- // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
38
- // "types": [], /* Specify type package names to be included without being referenced in a source file. */
39
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
40
- // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
41
- // "resolveJsonModule": true, /* Enable importing .json files. */
42
- // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
43
-
44
- /* JavaScript Support */
45
- // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
46
- // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
47
- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
48
-
49
- /* Emit */
50
- "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
51
- // "declarationMap": true, /* Create sourcemaps for d.ts files. */
52
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
53
- "sourceMap": true, /* Create source map files for emitted JavaScript files. */
54
- // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
55
- "outDir": "./lib", /* Specify an output folder for all emitted files. */
56
- // "removeComments": true, /* Disable emitting comments. */
57
- // "noEmit": true, /* Disable emitting files from a compilation. */
58
- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
59
- // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
60
- "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
61
- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
62
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
63
- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
64
- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
65
- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
66
- "newLine": "lf", /* Set the newline character for emitting files. */
67
- // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
68
- // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
69
- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
70
- // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
71
- // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
72
- // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
73
-
74
- /* Interop Constraints */
75
- // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
76
- // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
77
- "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
78
- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
79
- "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
80
-
81
- /* Type Checking */
82
- "strict": true, /* Enable all strict type-checking options. */
83
- // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
84
- // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
85
- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
86
- // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
87
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
88
- // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
89
- // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
90
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
91
- // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
92
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
93
- // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
94
- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
95
- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
96
- // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
97
- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
98
- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
99
- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
100
- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
101
-
102
- /* Completeness */
103
- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
104
- "skipLibCheck": true, /* Skip type checking all .d.ts files. */
105
- },
106
- "include": [
107
- "${output}"
108
- ]
109
- }
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig to read more about this file */
4
+
5
+ /* Projects */
6
+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
+
13
+ /* Language and Environment */
14
+ "target": "ES5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
+ "lib": [
16
+ "DOM",
17
+ "ES2015"
18
+ ], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
19
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
20
+ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
21
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
22
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
23
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
24
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
25
+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
26
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
27
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
28
+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
29
+
30
+ /* Modules */
31
+ "module": "commonjs", /* Specify what module code is generated. */
32
+ // "rootDir": "./", /* Specify the root folder within your source files. */
33
+ // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
34
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
35
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
36
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
37
+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
38
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
39
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
40
+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
41
+ // "resolveJsonModule": true, /* Enable importing .json files. */
42
+ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
43
+
44
+ /* JavaScript Support */
45
+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
46
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
47
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
48
+
49
+ /* Emit */
50
+ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
51
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
52
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
53
+ "sourceMap": true, /* Create source map files for emitted JavaScript files. */
54
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
55
+ "outDir": "./lib", /* Specify an output folder for all emitted files. */
56
+ // "removeComments": true, /* Disable emitting comments. */
57
+ // "noEmit": true, /* Disable emitting files from a compilation. */
58
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
59
+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
60
+ "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
61
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
62
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
63
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
64
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
65
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
66
+ "newLine": "lf", /* Set the newline character for emitting files. */
67
+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
68
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
69
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
70
+ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
71
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
72
+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
73
+
74
+ /* Interop Constraints */
75
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
76
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
77
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
78
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
79
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
80
+
81
+ /* Type Checking */
82
+ "strict": true, /* Enable all strict type-checking options. */
83
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
84
+ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
85
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
86
+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
87
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
88
+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
89
+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
90
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
91
+ // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
92
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
93
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
94
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
95
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
96
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
97
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
98
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
99
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
100
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
101
+
102
+ /* Completeness */
103
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
104
+ "skipLibCheck": true, /* Skip type checking all .d.ts files. */
105
+ },
106
+ "include": [
107
+ "${output}"
108
+ ]
109
+ }
@@ -1,42 +1,42 @@
1
- import core from "@nestia/core";
2
- import { DynamicExecutor } from "@nestia/e2e";
3
-
4
- import { INestApplication } from "@nestjs/common";
5
- import { NestFactory } from "@nestjs/core";
6
-
7
- async function main(): Promise<void> {
8
- const server: INestApplication = await NestFactory.create(
9
- await core.DynamicModule.mount(
10
- ${input},
11
- ),
12
- );
13
- await server.listen(37_000);
14
-
15
- const report: DynamicExecutor.IReport = await DynamicExecutor.validate({
16
- extension: __filename.substring(__filename.length - 2),
17
- prefix: "test",
18
- parameters: () => [
19
- {
20
- host: "http://127.0.0.1:37000",
21
- },
22
- ],
23
- })(`${__dirname}/features`);
24
- await server.close();
25
-
26
- const exceptions: Error[] = report.executions
27
- .filter((exec) => exec.error !== null)
28
- .map((exec) => exec.error!);
29
- if (exceptions.length === 0) {
30
- console.log("Success");
31
- console.log("Elapsed time", report.time.toLocaleString(), `ms`);
32
- } else {
33
- for (const exp of exceptions) console.log(exp);
34
- console.log("Failed");
35
- console.log("Elapsed time", report.time.toLocaleString(), `ms`);
36
- process.exit(-1);
37
- }
38
- }
39
- main().catch((exp) => {
40
- console.log(exp);
41
- process.exit(-1);
42
- });
1
+ import core from "@nestia/core";
2
+ import { DynamicExecutor } from "@nestia/e2e";
3
+
4
+ import { INestApplication } from "@nestjs/common";
5
+ import { NestFactory } from "@nestjs/core";
6
+
7
+ async function main(): Promise<void> {
8
+ const server: INestApplication = await NestFactory.create(
9
+ await core.DynamicModule.mount(
10
+ ${input},
11
+ ),
12
+ );
13
+ await server.listen(37_000);
14
+
15
+ const report: DynamicExecutor.IReport = await DynamicExecutor.validate({
16
+ extension: __filename.substring(__filename.length - 2),
17
+ prefix: "test",
18
+ parameters: () => [
19
+ {
20
+ host: "http://127.0.0.1:37000",
21
+ },
22
+ ],
23
+ })(`${__dirname}/features`);
24
+ await server.close();
25
+
26
+ const exceptions: Error[] = report.executions
27
+ .filter((exec) => exec.error !== null)
28
+ .map((exec) => exec.error!);
29
+ if (exceptions.length === 0) {
30
+ console.log("Success");
31
+ console.log("Elapsed time", report.time.toLocaleString(), `ms`);
32
+ } else {
33
+ for (const exp of exceptions) console.log(exp);
34
+ console.log("Failed");
35
+ console.log("Elapsed time", report.time.toLocaleString(), `ms`);
36
+ process.exit(-1);
37
+ }
38
+ }
39
+ main().catch((exp) => {
40
+ console.log(exp);
41
+ process.exit(-1);
42
+ });
@@ -1,97 +1,97 @@
1
- import { INestiaConfig } from "@nestia/sdk";
2
- import { Module } from "@nestjs/common";
3
- import { NestFactory } from "@nestjs/core";
4
-
5
- // import { FastifyAdapter } from "@nestjs/platform-fastify";
6
-
7
- export const NESTIA_CONFIG: INestiaConfig = {
8
- /**
9
- * Accessor of controller classes.
10
- *
11
- * You can specify it within two ways.
12
- *
13
- * - Asynchronous function returning `INestApplication` instance
14
- * - Specify the path or directory of controller class files
15
- */
16
- // input: "src/controllers",
17
- // input: "src/**/*.controller.ts",
18
- input: async () => {
19
- // change this to your own module
20
- @Module({
21
- controllers: [],
22
- })
23
- class MyModule {}
24
- const app = await NestFactory.create(MyModule);
25
- // const app = await NestFactory.create(YourModule, new FastifyAdapter());
26
- // app.setGlobalPrefix("api");
27
- // app.enableVersioning({
28
- // type: VersioningType.URI,
29
- // prefix: "v",
30
- // })
31
- return app;
32
- },
33
-
34
- /**
35
- * Building `swagger.json` is also possible.
36
- *
37
- * If not specified, you can't build the `swagger.json`.
38
- */
39
- swagger: {
40
- /**
41
- * Output path of the `swagger.json`.
42
- *
43
- * If you've configured only directory, the file name would be the `swagger.json`.
44
- * Otherwise you've configured the full path with file name and extension, the
45
- * `swagger.json` file would be renamed to it.
46
- */
47
- output: "dist/swagger.json",
48
- },
49
-
50
- /**
51
- * Output directory that SDK would be placed in.
52
- *
53
- * If not configured, you can't build the SDK library.
54
- */
55
- output: "src/api",
56
-
57
- /**
58
- * Target directory that SDK distribution files would be placed in.
59
- *
60
- * If you configure this property and runs `npx nestia sdk` command,
61
- * distribution environments for the SDK library would be generated.
62
- *
63
- * After the SDK library generation, move to the `distribute` directory,
64
- * and runs `npm publish` command, then you can share SDK library with
65
- * other client (frontend) developers.
66
- */
67
- // distribute: "packages/api",
68
-
69
- /**
70
- * Whether to use propagation mode or not.
71
- *
72
- * If being configured, interaction functions of the SDK library would
73
- * perform the propagation mode. The propagation mode means that never
74
- * throwing exception even when status code is not 200 (or 201), but just
75
- * returning the {@link IPropagation} typed instance, which can specify its body
76
- * type through discriminated union determined by status code.
77
- *
78
- * @default false
79
- */
80
- // propagate: true,
81
-
82
- /**
83
- * Allow simulation mode.
84
- *
85
- * If you configure this property to be `true`, the SDK library would be contain
86
- * simulation mode. In the simulation mode, the SDK library would not communicate
87
- * with the real backend server, but just returns random mock-up data
88
- * with requestion data validation.
89
- *
90
- * For reference, random mock-up data would be generated by `typia.random<T>()`
91
- * function.
92
- *
93
- * @default false
94
- */
95
- // simulate: true,
96
- };
97
- export default NESTIA_CONFIG;
1
+ import { INestiaConfig } from "@nestia/sdk";
2
+ import { Module } from "@nestjs/common";
3
+ import { NestFactory } from "@nestjs/core";
4
+
5
+ // import { FastifyAdapter } from "@nestjs/platform-fastify";
6
+
7
+ export const NESTIA_CONFIG: INestiaConfig = {
8
+ /**
9
+ * Accessor of controller classes.
10
+ *
11
+ * You can specify it within two ways.
12
+ *
13
+ * - Asynchronous function returning `INestApplication` instance
14
+ * - Specify the path or directory of controller class files
15
+ */
16
+ // input: "src/controllers",
17
+ // input: "src/**/*.controller.ts",
18
+ input: async () => {
19
+ // change this to your own module
20
+ @Module({
21
+ controllers: [],
22
+ })
23
+ class MyModule {}
24
+ const app = await NestFactory.create(MyModule);
25
+ // const app = await NestFactory.create(YourModule, new FastifyAdapter());
26
+ // app.setGlobalPrefix("api");
27
+ // app.enableVersioning({
28
+ // type: VersioningType.URI,
29
+ // prefix: "v",
30
+ // })
31
+ return app;
32
+ },
33
+
34
+ /**
35
+ * Building `swagger.json` is also possible.
36
+ *
37
+ * If not specified, you can't build the `swagger.json`.
38
+ */
39
+ swagger: {
40
+ /**
41
+ * Output path of the `swagger.json`.
42
+ *
43
+ * If you've configured only directory, the file name would be the `swagger.json`.
44
+ * Otherwise you've configured the full path with file name and extension, the
45
+ * `swagger.json` file would be renamed to it.
46
+ */
47
+ output: "dist/swagger.json",
48
+ },
49
+
50
+ /**
51
+ * Output directory that SDK would be placed in.
52
+ *
53
+ * If not configured, you can't build the SDK library.
54
+ */
55
+ output: "src/api",
56
+
57
+ /**
58
+ * Target directory that SDK distribution files would be placed in.
59
+ *
60
+ * If you configure this property and runs `npx nestia sdk` command,
61
+ * distribution environments for the SDK library would be generated.
62
+ *
63
+ * After the SDK library generation, move to the `distribute` directory,
64
+ * and runs `npm publish` command, then you can share SDK library with
65
+ * other client (frontend) developers.
66
+ */
67
+ // distribute: "packages/api",
68
+
69
+ /**
70
+ * Whether to use propagation mode or not.
71
+ *
72
+ * If being configured, interaction functions of the SDK library would
73
+ * perform the propagation mode. The propagation mode means that never
74
+ * throwing exception even when status code is not 200 (or 201), but just
75
+ * returning the {@link IPropagation} typed instance, which can specify its body
76
+ * type through discriminated union determined by status code.
77
+ *
78
+ * @default false
79
+ */
80
+ // propagate: true,
81
+
82
+ /**
83
+ * Allow simulation mode.
84
+ *
85
+ * If you configure this property to be `true`, the SDK library would be contain
86
+ * simulation mode. In the simulation mode, the SDK library would not communicate
87
+ * with the real backend server, but just returns random mock-up data
88
+ * with requestion data validation.
89
+ *
90
+ * For reference, random mock-up data would be generated by `typia.random<T>()`
91
+ * function.
92
+ *
93
+ * @default false
94
+ */
95
+ // simulate: true,
96
+ };
97
+ export default NESTIA_CONFIG;
@@ -21,6 +21,7 @@ const ConfigAnalyzer_1 = require("./analyses/ConfigAnalyzer");
21
21
  const PathAnalyzer_1 = require("./analyses/PathAnalyzer");
22
22
  const ReflectControllerAnalyzer_1 = require("./analyses/ReflectControllerAnalyzer");
23
23
  const TypedHttpRouteAnalyzer_1 = require("./analyses/TypedHttpRouteAnalyzer");
24
+ const TypedMcpRouteAnalyzer_1 = require("./analyses/TypedMcpRouteAnalyzer");
24
25
  const TypedWebSocketRouteAnalyzer_1 = require("./analyses/TypedWebSocketRouteAnalyzer");
25
26
  const E2eGenerator_1 = require("./generates/E2eGenerator");
26
27
  const SdkGenerator_1 = require("./generates/SdkGenerator");
@@ -116,8 +117,8 @@ class NestiaSdkApplication {
116
117
  }
117
118
  generate(props) {
118
119
  return __awaiter(this, void 0, void 0, function* () {
119
- var _a;
120
- var _b, _c, _d;
120
+ var _a, _b;
121
+ var _c, _d, _e;
121
122
  //----
122
123
  // ANALYZE REFLECTS
123
124
  //----
@@ -146,16 +147,23 @@ class NestiaSdkApplication {
146
147
  const set = new tstl_1.HashSet();
147
148
  for (const controller of controllers)
148
149
  for (const controllerPath of controller.paths)
149
- for (const operation of controller.operations)
150
+ for (const operation of controller.operations) {
151
+ if (operation.protocol === "mcp") {
152
+ set.insert(new tstl_1.Pair(`mcp:${operation.toolName}`, "mcp"));
153
+ continue;
154
+ }
150
155
  for (const operationPath of operation.paths)
151
156
  set.insert(new tstl_1.Pair(`${controllerPath}/${operationPath}`, operation.protocol === "http" ? operation.method : ""));
157
+ }
152
158
  return set.size();
153
159
  })();
154
160
  console.log(` - controllers: #${controllers.length}`);
155
161
  console.log(` - paths: #${agg}`);
156
162
  console.log(` - routes: #${controllers
157
163
  .map((c) => c.paths.length *
158
- c.operations.map((f) => f.paths.length).reduce((a, b) => a + b, 0))
164
+ c.operations
165
+ .map((f) => (f.protocol === "mcp" ? 1 : f.paths.length))
166
+ .reduce((a, b) => a + b, 0))
159
167
  .reduce((a, b) => a + b, 0)}`);
160
168
  //----
161
169
  // ANALYZE TYPESCRIPT CODE
@@ -164,10 +172,16 @@ class NestiaSdkApplication {
164
172
  // METADATA COMPONENTS
165
173
  const sourceCollection = TypedHttpRouteAnalyzer_1.TypedHttpRouteAnalyzer.dictionary(controllers);
166
174
  // CONVERT TO TYPED OPERATIONS
167
- const globalPrefix = (_b = (_a = project.input.globalPrefix) === null || _a === void 0 ? void 0 : _a.prefix) !== null && _b !== void 0 ? _b : "";
168
175
  const routes = [];
169
176
  for (const c of controllers)
170
177
  for (const o of c.operations) {
178
+ if (o.protocol === "mcp") {
179
+ routes.push(...TypedMcpRouteAnalyzer_1.TypedMcpRouteAnalyzer.analyze({
180
+ controller: c,
181
+ operation: o,
182
+ }));
183
+ continue;
184
+ }
171
185
  const pathList = new Set();
172
186
  const versions = VersioningStrategy_1.VersioningStrategy.merge(project)([
173
187
  ...((_c = c.versions) !== null && _c !== void 0 ? _c : []),
@@ -176,8 +190,16 @@ class NestiaSdkApplication {
176
190
  for (const v of versions)
177
191
  for (const prefix of wrapPaths(c.prefixes))
178
192
  for (const cPath of wrapPaths(c.paths))
179
- for (const filePath of wrapPaths(o.paths))
180
- pathList.add(PathAnalyzer_1.PathAnalyzer.join(globalPrefix, v, prefix, cPath, filePath));
193
+ for (const filePath of wrapPaths(o.paths)) {
194
+ const localPath = PathAnalyzer_1.PathAnalyzer.join(prefix, cPath, filePath);
195
+ pathList.add(PathAnalyzer_1.PathAnalyzer.joinWithGlobalPrefix({
196
+ globalPrefix: (_e = (_a = project.input.globalPrefix) === null || _a === void 0 ? void 0 : _a.prefix) !== null && _e !== void 0 ? _e : "",
197
+ exclude: (_b = project.input.globalPrefix) === null || _b === void 0 ? void 0 : _b.exclude,
198
+ excludePath: localPath,
199
+ method: o.protocol === "http" ? o.method : "",
200
+ path: PathAnalyzer_1.PathAnalyzer.join(v, localPath),
201
+ }));
202
+ }
181
203
  if (o.protocol === "http")
182
204
  routes.push(...TypedHttpRouteAnalyzer_1.TypedHttpRouteAnalyzer.analyze({
183
205
  controller: c,