@nestia/sdk 11.2.1 → 12.0.0-dev.20260520.1

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 (270) hide show
  1. package/assets/bundle/distribute/package.json +1 -1
  2. package/lib/NestiaSdkApplication.js +5 -4
  3. package/lib/NestiaSdkApplication.js.map +1 -1
  4. package/lib/NestiaSwaggerComposer.js +2 -2
  5. package/lib/NestiaSwaggerComposer.js.map +1 -1
  6. package/lib/analyses/AccessorAnalyzer.js.map +1 -1
  7. package/lib/analyses/ConfigAnalyzer.js +133 -7
  8. package/lib/analyses/ConfigAnalyzer.js.map +1 -1
  9. package/lib/analyses/ImportAnalyzer.d.ts +9 -2
  10. package/lib/analyses/ImportAnalyzer.js +13 -50
  11. package/lib/analyses/ImportAnalyzer.js.map +1 -1
  12. package/lib/analyses/PathAnalyzer.js.map +1 -1
  13. package/lib/analyses/ReflectControllerAnalyzer.js.map +1 -1
  14. package/lib/analyses/ReflectHttpOperationAnalyzer.d.ts +1 -1
  15. package/lib/analyses/ReflectHttpOperationAnalyzer.js +5 -4
  16. package/lib/analyses/ReflectHttpOperationAnalyzer.js.map +1 -1
  17. package/lib/analyses/ReflectHttpOperationExceptionAnalyzer.d.ts +1 -1
  18. package/lib/analyses/ReflectHttpOperationExceptionAnalyzer.js +22 -5
  19. package/lib/analyses/ReflectHttpOperationExceptionAnalyzer.js.map +1 -1
  20. package/lib/analyses/ReflectHttpOperationParameterAnalyzer.d.ts +1 -1
  21. package/lib/analyses/ReflectHttpOperationParameterAnalyzer.js +8 -8
  22. package/lib/analyses/ReflectHttpOperationParameterAnalyzer.js.map +1 -1
  23. package/lib/analyses/ReflectHttpOperationResponseAnalyzer.d.ts +1 -1
  24. package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js +15 -15
  25. package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js.map +1 -1
  26. package/lib/analyses/ReflectMetadataAnalyzer.js.map +1 -1
  27. package/lib/analyses/ReflectWebSocketOperationAnalyzer.d.ts +1 -1
  28. package/lib/analyses/ReflectWebSocketOperationAnalyzer.js +1 -1
  29. package/lib/analyses/ReflectWebSocketOperationAnalyzer.js.map +1 -1
  30. package/lib/analyses/SecurityAnalyzer.js.map +1 -1
  31. package/lib/analyses/TypedHttpRouteAnalyzer.d.ts +2 -1
  32. package/lib/analyses/TypedHttpRouteAnalyzer.js +296 -39
  33. package/lib/analyses/TypedHttpRouteAnalyzer.js.map +1 -1
  34. package/lib/analyses/TypedWebSocketRouteAnalyzer.js +1 -4
  35. package/lib/analyses/TypedWebSocketRouteAnalyzer.js.map +1 -1
  36. package/lib/decorators/OperationMetadata.d.ts +1 -1
  37. package/lib/decorators/OperationMetadata.js.map +1 -1
  38. package/lib/executable/internal/CommandParser.js.map +1 -1
  39. package/lib/executable/internal/NestiaConfigLoader.d.ts +6 -2
  40. package/lib/executable/internal/NestiaConfigLoader.js +285 -793
  41. package/lib/executable/internal/NestiaConfigLoader.js.map +1 -1
  42. package/lib/executable/internal/NestiaSdkCommand.js +6 -4
  43. package/lib/executable/internal/NestiaSdkCommand.js.map +1 -1
  44. package/lib/executable/sdk.js +17 -5
  45. package/lib/executable/sdk.js.map +1 -1
  46. package/lib/generates/CloneGenerator.js +2 -2
  47. package/lib/generates/CloneGenerator.js.map +1 -1
  48. package/lib/generates/E2eGenerator.js.map +1 -1
  49. package/lib/generates/SdkGenerator.js +6 -9
  50. package/lib/generates/SdkGenerator.js.map +1 -1
  51. package/lib/generates/SwaggerGenerator.js +20 -107
  52. package/lib/generates/SwaggerGenerator.js.map +1 -1
  53. package/lib/generates/internal/E2eFileProgrammer.js +44 -28
  54. package/lib/generates/internal/E2eFileProgrammer.js.map +1 -1
  55. package/lib/generates/internal/FilePrinter.d.ts +4 -4
  56. package/lib/generates/internal/FilePrinter.js +25 -16
  57. package/lib/generates/internal/FilePrinter.js.map +1 -1
  58. package/lib/generates/internal/ImportDictionary.d.ts +2 -2
  59. package/lib/generates/internal/ImportDictionary.js +7 -5
  60. package/lib/generates/internal/ImportDictionary.js.map +1 -1
  61. package/lib/generates/internal/SdkAliasCollection.d.ts +11 -11
  62. package/lib/generates/internal/SdkAliasCollection.js +27 -31
  63. package/lib/generates/internal/SdkAliasCollection.js.map +1 -1
  64. package/lib/generates/internal/SdkDistributionComposer.js +15 -70
  65. package/lib/generates/internal/SdkDistributionComposer.js.map +1 -1
  66. package/lib/generates/internal/SdkFileProgrammer.js +2 -2
  67. package/lib/generates/internal/SdkFileProgrammer.js.map +1 -1
  68. package/lib/generates/internal/SdkHttpCloneProgrammer.d.ts +2 -2
  69. package/lib/generates/internal/SdkHttpCloneProgrammer.js +6 -12
  70. package/lib/generates/internal/SdkHttpCloneProgrammer.js.map +1 -1
  71. package/lib/generates/internal/SdkHttpCloneReferencer.js +2 -1
  72. package/lib/generates/internal/SdkHttpCloneReferencer.js.map +1 -1
  73. package/lib/generates/internal/SdkHttpFunctionProgrammer.d.ts +2 -2
  74. package/lib/generates/internal/SdkHttpFunctionProgrammer.js +73 -77
  75. package/lib/generates/internal/SdkHttpFunctionProgrammer.js.map +1 -1
  76. package/lib/generates/internal/SdkHttpNamespaceProgrammer.d.ts +2 -2
  77. package/lib/generates/internal/SdkHttpNamespaceProgrammer.js +64 -66
  78. package/lib/generates/internal/SdkHttpNamespaceProgrammer.js.map +1 -1
  79. package/lib/generates/internal/SdkHttpParameterProgrammer.d.ts +4 -10
  80. package/lib/generates/internal/SdkHttpParameterProgrammer.js +15 -22
  81. package/lib/generates/internal/SdkHttpParameterProgrammer.js.map +1 -1
  82. package/lib/generates/internal/SdkHttpRouteProgrammer.d.ts +2 -2
  83. package/lib/generates/internal/SdkHttpRouteProgrammer.js +18 -20
  84. package/lib/generates/internal/SdkHttpRouteProgrammer.js.map +1 -1
  85. package/lib/generates/internal/SdkHttpSimulationProgrammer.d.ts +3 -3
  86. package/lib/generates/internal/SdkHttpSimulationProgrammer.js +47 -49
  87. package/lib/generates/internal/SdkHttpSimulationProgrammer.js.map +1 -1
  88. package/lib/generates/internal/SdkImportWizard.js.map +1 -1
  89. package/lib/generates/internal/SdkRouteDirectory.js.map +1 -1
  90. package/lib/generates/internal/SdkTypeProgrammer.d.ts +4 -4
  91. package/lib/generates/internal/SdkTypeProgrammer.js +66 -67
  92. package/lib/generates/internal/SdkTypeProgrammer.js.map +1 -1
  93. package/lib/generates/internal/SdkTypeTagProgrammer.d.ts +1 -2
  94. package/lib/generates/internal/SdkTypeTagProgrammer.js +29 -11
  95. package/lib/generates/internal/SdkTypeTagProgrammer.js.map +1 -1
  96. package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.d.ts +2 -2
  97. package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js +55 -55
  98. package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js.map +1 -1
  99. package/lib/generates/internal/SdkWebSocketParameterProgrammer.d.ts +3 -3
  100. package/lib/generates/internal/SdkWebSocketParameterProgrammer.js +9 -12
  101. package/lib/generates/internal/SdkWebSocketParameterProgrammer.js.map +1 -1
  102. package/lib/generates/internal/SdkWebSocketRouteProgrammer.d.ts +2 -2
  103. package/lib/generates/internal/SdkWebSocketRouteProgrammer.js +43 -45
  104. package/lib/generates/internal/SdkWebSocketRouteProgrammer.js.map +1 -1
  105. package/lib/generates/internal/SwaggerDescriptionComposer.js.map +1 -1
  106. package/lib/generates/internal/SwaggerOperationComposer.d.ts +1 -1
  107. package/lib/generates/internal/SwaggerOperationComposer.js +5 -4
  108. package/lib/generates/internal/SwaggerOperationComposer.js.map +1 -1
  109. package/lib/generates/internal/SwaggerOperationParameterComposer.d.ts +0 -3
  110. package/lib/generates/internal/SwaggerOperationParameterComposer.js +19 -20
  111. package/lib/generates/internal/SwaggerOperationParameterComposer.js.map +1 -1
  112. package/lib/generates/internal/SwaggerOperationResponseComposer.d.ts +1 -1
  113. package/lib/generates/internal/SwaggerOperationResponseComposer.js +4 -3
  114. package/lib/generates/internal/SwaggerOperationResponseComposer.js.map +1 -1
  115. package/lib/index.js.map +1 -1
  116. package/lib/internal/legacy.d.ts +180 -0
  117. package/lib/internal/legacy.js +361 -0
  118. package/lib/internal/legacy.js.map +1 -0
  119. package/lib/structures/INestiaProject.d.ts +0 -2
  120. package/lib/{transformers → structures}/IOperationMetadata.d.ts +2 -7
  121. package/lib/structures/IOperationMetadata.js.map +1 -0
  122. package/lib/structures/IReflectHttpOperationException.d.ts +1 -1
  123. package/lib/structures/IReflectHttpOperationParameter.d.ts +1 -1
  124. package/lib/structures/IReflectHttpOperationSuccess.d.ts +1 -1
  125. package/lib/structures/IReflectOperationError.d.ts +1 -1
  126. package/lib/structures/IReflectOperationError.js.map +1 -1
  127. package/lib/structures/IReflectWebSocketOperation.d.ts +2 -2
  128. package/lib/structures/ITypedApplication.d.ts +1 -1
  129. package/lib/structures/ITypedHttpRouteException.d.ts +1 -1
  130. package/lib/structures/ITypedHttpRouteParameter.d.ts +1 -1
  131. package/lib/structures/ITypedHttpRouteSuccess.d.ts +1 -1
  132. package/lib/structures/ITypedWebSocketRoute.d.ts +2 -2
  133. package/lib/transform.d.ts +9 -3
  134. package/lib/transform.js +47 -5
  135. package/lib/transform.js.map +1 -1
  136. package/lib/utils/ArrayUtil.js.map +1 -1
  137. package/lib/utils/FileRetriever.js.map +1 -1
  138. package/lib/utils/MapUtil.js.map +1 -1
  139. package/lib/utils/PathUtil.js.map +1 -1
  140. package/lib/utils/SourceFinder.js.map +1 -1
  141. package/lib/utils/StringUtil.js.map +1 -1
  142. package/lib/utils/TsConfigReader.d.ts +7 -0
  143. package/lib/utils/TsConfigReader.js +102 -0
  144. package/lib/utils/TsConfigReader.js.map +1 -0
  145. package/lib/utils/TtscExecutor.d.ts +8 -0
  146. package/lib/utils/TtscExecutor.js +58 -0
  147. package/lib/utils/TtscExecutor.js.map +1 -0
  148. package/lib/utils/VersioningStrategy.js.map +1 -1
  149. package/lib/validators/HttpHeadersValidator.d.ts +8 -5
  150. package/lib/validators/HttpHeadersValidator.js +7 -26
  151. package/lib/validators/HttpHeadersValidator.js.map +1 -1
  152. package/lib/validators/HttpQueryValidator.d.ts +8 -5
  153. package/lib/validators/HttpQueryValidator.js +7 -26
  154. package/lib/validators/HttpQueryValidator.js.map +1 -1
  155. package/lib/{transformers → validators}/TextPlainValidator.d.ts +1 -1
  156. package/lib/{transformers → validators}/TextPlainValidator.js +2 -1
  157. package/lib/validators/TextPlainValidator.js.map +1 -0
  158. package/package.json +21 -19
  159. package/src/NestiaSdkApplication.ts +9 -5
  160. package/src/NestiaSwaggerComposer.ts +2 -3
  161. package/src/analyses/ConfigAnalyzer.ts +175 -1
  162. package/src/analyses/ImportAnalyzer.ts +15 -49
  163. package/src/analyses/ReflectControllerAnalyzer.ts +1 -1
  164. package/src/analyses/ReflectHttpOperationAnalyzer.ts +1 -1
  165. package/src/analyses/ReflectHttpOperationExceptionAnalyzer.ts +24 -6
  166. package/src/analyses/ReflectHttpOperationParameterAnalyzer.ts +3 -3
  167. package/src/analyses/ReflectHttpOperationResponseAnalyzer.ts +14 -10
  168. package/src/analyses/ReflectWebSocketOperationAnalyzer.ts +2 -2
  169. package/src/analyses/TypedHttpRouteAnalyzer.ts +354 -22
  170. package/src/decorators/OperationMetadata.ts +1 -1
  171. package/src/executable/internal/NestiaConfigLoader.ts +419 -53
  172. package/src/executable/internal/NestiaSdkCommand.ts +9 -10
  173. package/src/executable/sdk.ts +15 -4
  174. package/src/generates/CloneGenerator.ts +10 -10
  175. package/src/generates/SwaggerGenerator.ts +28 -9
  176. package/src/generates/internal/E2eFileProgrammer.ts +80 -43
  177. package/src/generates/internal/FilePrinter.ts +38 -37
  178. package/src/generates/internal/ImportDictionary.ts +18 -16
  179. package/src/generates/internal/SdkAliasCollection.ts +41 -40
  180. package/src/generates/internal/SdkDistributionComposer.ts +21 -8
  181. package/src/generates/internal/SdkFileProgrammer.ts +7 -5
  182. package/src/generates/internal/SdkHttpCloneProgrammer.ts +10 -10
  183. package/src/generates/internal/SdkHttpCloneReferencer.ts +6 -6
  184. package/src/generates/internal/SdkHttpFunctionProgrammer.ts +101 -78
  185. package/src/generates/internal/SdkHttpNamespaceProgrammer.ts +153 -145
  186. package/src/generates/internal/SdkHttpParameterProgrammer.ts +20 -33
  187. package/src/generates/internal/SdkHttpRouteProgrammer.ts +2 -2
  188. package/src/generates/internal/SdkHttpSimulationProgrammer.ts +88 -86
  189. package/src/generates/internal/SdkTypeProgrammer.ts +93 -99
  190. package/src/generates/internal/SdkTypeTagProgrammer.ts +12 -12
  191. package/src/generates/internal/SdkWebSocketNamespaceProgrammer.ts +128 -118
  192. package/src/generates/internal/SdkWebSocketParameterProgrammer.ts +15 -13
  193. package/src/generates/internal/SdkWebSocketRouteProgrammer.ts +133 -112
  194. package/src/generates/internal/SwaggerOperationComposer.ts +1 -1
  195. package/src/generates/internal/SwaggerOperationParameterComposer.ts +10 -9
  196. package/src/generates/internal/SwaggerOperationResponseComposer.ts +1 -1
  197. package/src/internal/legacy.ts +492 -0
  198. package/src/structures/INestiaProject.ts +0 -3
  199. package/src/{transformers → structures}/IOperationMetadata.ts +2 -7
  200. package/src/structures/IReflectHttpOperationException.ts +1 -1
  201. package/src/structures/IReflectHttpOperationParameter.ts +1 -1
  202. package/src/structures/IReflectHttpOperationSuccess.ts +1 -1
  203. package/src/structures/IReflectOperationError.ts +1 -1
  204. package/src/structures/IReflectWebSocketOperation.ts +2 -2
  205. package/src/structures/ITypedApplication.ts +1 -1
  206. package/src/structures/ITypedHttpRouteException.ts +1 -1
  207. package/src/structures/ITypedHttpRouteParameter.ts +1 -1
  208. package/src/structures/ITypedHttpRouteSuccess.ts +1 -1
  209. package/src/structures/ITypedWebSocketRoute.ts +2 -2
  210. package/src/transform.ts +68 -7
  211. package/src/utils/TsConfigReader.ts +108 -0
  212. package/src/utils/TtscExecutor.ts +63 -0
  213. package/src/validators/HttpHeadersValidator.ts +8 -37
  214. package/src/validators/HttpQueryValidator.ts +8 -37
  215. package/src/{transformers → validators}/TextPlainValidator.ts +2 -2
  216. package/lib/analyses/DtoAnalyzer.d.ts +0 -21
  217. package/lib/analyses/DtoAnalyzer.js +0 -219
  218. package/lib/analyses/DtoAnalyzer.js.map +0 -1
  219. package/lib/analyses/ExceptionAnalyzer.d.ts +0 -0
  220. package/lib/analyses/ExceptionAnalyzer.js +0 -2
  221. package/lib/analyses/ExceptionAnalyzer.js.map +0 -1
  222. package/lib/analyses/GenericAnalyzer.d.ts +0 -4
  223. package/lib/analyses/GenericAnalyzer.js +0 -42
  224. package/lib/analyses/GenericAnalyzer.js.map +0 -1
  225. package/lib/structures/IReflectApplication.d.ts +0 -6
  226. package/lib/structures/IReflectApplication.js +0 -3
  227. package/lib/structures/IReflectApplication.js.map +0 -1
  228. package/lib/structures/MethodType.d.ts +0 -4
  229. package/lib/structures/MethodType.js +0 -8
  230. package/lib/structures/MethodType.js.map +0 -1
  231. package/lib/structures/ParamCategory.d.ts +0 -1
  232. package/lib/structures/ParamCategory.js +0 -3
  233. package/lib/structures/ParamCategory.js.map +0 -1
  234. package/lib/structures/TypeEntry.d.ts +0 -9
  235. package/lib/structures/TypeEntry.js +0 -21
  236. package/lib/structures/TypeEntry.js.map +0 -1
  237. package/lib/transformers/IOperationMetadata.js.map +0 -1
  238. package/lib/transformers/ISdkOperationTransformerContext.d.ts +0 -7
  239. package/lib/transformers/ISdkOperationTransformerContext.js +0 -3
  240. package/lib/transformers/ISdkOperationTransformerContext.js.map +0 -1
  241. package/lib/transformers/SdkOperationProgrammer.d.ts +0 -15
  242. package/lib/transformers/SdkOperationProgrammer.js +0 -186
  243. package/lib/transformers/SdkOperationProgrammer.js.map +0 -1
  244. package/lib/transformers/SdkOperationTransformer.d.ts +0 -4
  245. package/lib/transformers/SdkOperationTransformer.js +0 -128
  246. package/lib/transformers/SdkOperationTransformer.js.map +0 -1
  247. package/lib/transformers/TextPlainValidator.js.map +0 -1
  248. package/lib/utils/MetadataUtil.d.ts +0 -4
  249. package/lib/utils/MetadataUtil.js +0 -34
  250. package/lib/utils/MetadataUtil.js.map +0 -1
  251. package/lib/utils/StripEnums.d.ts +0 -3
  252. package/lib/utils/StripEnums.js +0 -3
  253. package/lib/utils/StripEnums.js.map +0 -1
  254. package/lib/utils/TypeLiteralExpression.d.ts +0 -0
  255. package/lib/utils/TypeLiteralExpression.js +0 -2
  256. package/lib/utils/TypeLiteralExpression.js.map +0 -1
  257. package/src/analyses/DtoAnalyzer.ts +0 -260
  258. package/src/analyses/ExceptionAnalyzer.ts +0 -154
  259. package/src/analyses/GenericAnalyzer.ts +0 -49
  260. package/src/structures/IReflectApplication.ts +0 -8
  261. package/src/structures/MethodType.ts +0 -5
  262. package/src/structures/ParamCategory.ts +0 -1
  263. package/src/structures/TypeEntry.ts +0 -22
  264. package/src/transformers/ISdkOperationTransformerContext.ts +0 -8
  265. package/src/transformers/SdkOperationProgrammer.ts +0 -240
  266. package/src/transformers/SdkOperationTransformer.ts +0 -248
  267. package/src/utils/MetadataUtil.ts +0 -26
  268. package/src/utils/StripEnums.ts +0 -5
  269. package/src/utils/TypeLiteralExpression.ts +0 -0
  270. /package/lib/{transformers → structures}/IOperationMetadata.js +0 -0
@@ -0,0 +1,492 @@
1
+ // nestia-internal namespace of utility functions that fill the surface
2
+ // the legacy `@typia/core` 12.x package exposed at JS runtime. typia v13
3
+ // dropped that package because the equivalent logic lives in the Go-side
4
+ // transform; the nestia native transform now embeds the pre-computed
5
+ // results next to each metadata blob (see `packages/core/native/cmd/
6
+ // ttsc-nestia/sdk_transform.go`), and the helpers here are thin
7
+ // consumers — no runtime class wrapping, no vendored fork.
8
+ //
9
+ // `MetadataComponents.from` is the only utility that performs a real
10
+ // runtime transformation: it walks the aggregated `IMetadataComponents`
11
+ // and indexes each entry by name so the analyzer can resolve
12
+ // cross-reference lookups in O(1). Everything else either reads a
13
+ // pre-baked field or short-circuits because typia's compile-time
14
+ // transform already enforces the invariant.
15
+
16
+ import type {
17
+ IJsonSchemaCollection,
18
+ IMetadataComponents,
19
+ IMetadataSchema,
20
+ IMetadataTypeTag,
21
+ OpenApi,
22
+ } from "@typia/interface";
23
+
24
+ // Module augmentation: typia v13's `IReference` carries only a symbolic
25
+ // `name` + tags, but `MetadataSchema.from(plain, dictionary)` mutates
26
+ // each reference to also hold the resolved target type so downstream
27
+ // sdk code can keep its `ref.type!.value` / `ref.type!.elements` access
28
+ // pattern from the legacy `@typia/core` `MetadataArray` / `MetadataTuple`
29
+ // classes. The field is optional because it is only populated after a
30
+ // `MetadataSchema.from` walk against a dictionary.
31
+ declare module "@typia/interface" {
32
+ namespace IMetadataSchema {
33
+ interface IReference {
34
+ type?: IArrayType | ITupleType | IObjectType | IAliasType;
35
+ }
36
+ }
37
+ }
38
+
39
+ /**
40
+ * Plain `IMetadataSchema` augmented with the fields the nestia transform
41
+ * pre-bakes. `size`, `name`, and `empty` replace the methods the legacy
42
+ * `MetadataSchema` class exposed; `jsonSchema` is the OpenAPI 3.1
43
+ * conversion typia's Go-side produces but does not expose to JS at
44
+ * runtime.
45
+ *
46
+ * Fields are declared optional so that nested `IMetadataSchema` values
47
+ * (`metadata.rest`, `metadata.escaped.original`, `IObjectType.value`,
48
+ * …) — which are not top-level route inputs and therefore do not carry
49
+ * the pre-baked overlay — still satisfy the type when passed through
50
+ * legacy utilities. The utilities read the fields via the optional
51
+ * accessor and fall back when absent.
52
+ */
53
+ export interface IReflectMetadata extends IMetadataSchema {
54
+ size?: number;
55
+ name?: string;
56
+ empty?: boolean;
57
+ jsonSchema?: IReflectJsonSchema;
58
+ }
59
+
60
+ export interface IReflectJsonSchema {
61
+ version: "3.0" | "3.1";
62
+ components: OpenApi.IComponents;
63
+ schema: OpenApi.IJsonSchema;
64
+ }
65
+
66
+ /**
67
+ * Cross-reference dictionary produced by `MetadataComponents.from`. Each
68
+ * map is keyed by the entry's `.name`, matching the lookup pattern the
69
+ * legacy `MetadataComponents.dictionary` getter offered.
70
+ */
71
+ export interface IMetadataDictionary {
72
+ objects: Map<string, IMetadataSchema.IObjectType>;
73
+ aliases: Map<string, IMetadataSchema.IAliasType>;
74
+ arrays: Map<string, IMetadataSchema.IArrayType>;
75
+ tuples: Map<string, IMetadataSchema.ITupleType>;
76
+ }
77
+
78
+ // ---------------------------------------------------------------------
79
+ // Type aliases — the legacy class names ↔ typia v13 plain interfaces.
80
+ // ---------------------------------------------------------------------
81
+
82
+ export type MetadataSchema = IMetadataSchema;
83
+ export type MetadataComponents = IMetadataComponents & {
84
+ dictionary: IMetadataDictionary;
85
+ };
86
+ export type MetadataAliasType = IMetadataSchema.IAliasType;
87
+ export type MetadataArrayType = IMetadataSchema.IArrayType;
88
+ export type MetadataTupleType = IMetadataSchema.ITupleType;
89
+ export type MetadataObjectType = IMetadataSchema.IObjectType;
90
+ export type MetadataAtomic = IMetadataSchema.IAtomic;
91
+ /**
92
+ * Flattened constant-value shape: typia v13 splits `IConstant.IValue<T>` by
93
+ * the atomic discriminator, but sdk's literal writer just needs the runtime
94
+ * `value` payload, so collapse the union to a single ergonomic shape.
95
+ */
96
+ export interface MetadataConstantValue {
97
+ value: string | number | bigint | boolean;
98
+ tags: IMetadataTypeTag[][];
99
+ }
100
+ export type MetadataEscaped = IMetadataSchema.IEscaped;
101
+ export type MetadataProperty = IMetadataSchema.IProperty;
102
+
103
+ /**
104
+ * Reference to a named array/tuple/object/alias type. typia v13's
105
+ * plain `IReference` carries only the symbolic `name` + tags; the
106
+ * legacy class additionally exposed `.type` as a getter that resolved
107
+ * against the dictionary. `MetadataSchema.from` walks the metadata
108
+ * tree once and attaches the resolved `.type` field so downstream
109
+ * sdk code can keep its `ref.type` access pattern.
110
+ */
111
+ export type MetadataArray = IMetadataSchema.IReference & {
112
+ type: MetadataArrayType;
113
+ };
114
+ export type MetadataTuple = IMetadataSchema.IReference & {
115
+ type: MetadataTupleType;
116
+ };
117
+ export type MetadataObject = IMetadataSchema.IReference & {
118
+ type: MetadataObjectType;
119
+ };
120
+ export type MetadataAlias = IMetadataSchema.IReference & {
121
+ type: MetadataAliasType;
122
+ };
123
+
124
+ // ---------------------------------------------------------------------
125
+ // Metadata utility functions — read pre-baked fields, no class wrapping.
126
+ // ---------------------------------------------------------------------
127
+
128
+ /** `MetadataSchema.size()` → reads the pre-baked `size` field. */
129
+ export const sizeOf = (m: IMetadataSchema): number =>
130
+ (m as IReflectMetadata).size ?? 0;
131
+
132
+ /** `MetadataSchema.getName()` → reads the pre-baked `name` field. */
133
+ export const nameOf = (m: IMetadataSchema): string =>
134
+ (m as IReflectMetadata).name ?? "";
135
+
136
+ /** `MetadataSchema.empty()` → reads the pre-baked `empty` field. */
137
+ export const emptyOf = (m: IMetadataSchema): boolean =>
138
+ (m as IReflectMetadata).empty ?? false;
139
+
140
+ /**
141
+ * Equivalent of the legacy `MetadataSchema.isSoleLiteral()` method:
142
+ * `true` when the schema represents exactly one constant literal value
143
+ * and nothing else. Used by sdk's type printer to fall back to literal
144
+ * emission instead of a union.
145
+ */
146
+ export const isSoleLiteralOf = (m: IMetadataSchema): boolean => {
147
+ if (m.any) return false;
148
+ if (m.nullable) return false;
149
+ if (m.functions.length !== 0) return false;
150
+ if (m.atomics.length !== 0) return false;
151
+ if (m.templates.length !== 0) return false;
152
+ if (m.arrays.length !== 0) return false;
153
+ if (m.tuples.length !== 0) return false;
154
+ if (m.objects.length !== 0) return false;
155
+ if (m.aliases.length !== 0) return false;
156
+ if (m.natives.length !== 0) return false;
157
+ if (m.sets.length !== 0) return false;
158
+ if (m.maps.length !== 0) return false;
159
+ if (m.rest !== null) return false;
160
+ if (m.escaped !== null) return false;
161
+ if (m.constants.length !== 1) return false;
162
+ return m.constants[0]!.values.length === 1;
163
+ };
164
+
165
+ // ---------------------------------------------------------------------
166
+ // `MetadataComponents.from(plain)` — namespace utility, not a class.
167
+ // ---------------------------------------------------------------------
168
+
169
+ export namespace MetadataComponents {
170
+ export const from = (plain: IMetadataComponents): MetadataComponents => {
171
+ const dictionary: IMetadataDictionary = {
172
+ objects: new Map(plain.objects.map((o) => [o.name, o])),
173
+ aliases: new Map(plain.aliases.map((a) => [a.name, a])),
174
+ arrays: new Map(plain.arrays.map((a) => [a.name, a])),
175
+ tuples: new Map(plain.tuples.map((t) => [t.name, t])),
176
+ };
177
+ return Object.assign({}, plain, { dictionary });
178
+ };
179
+ }
180
+
181
+ // ---------------------------------------------------------------------
182
+ // `MetadataSchema.from(plain, _dictionary)` — passthrough.
183
+ // ---------------------------------------------------------------------
184
+
185
+ export namespace MetadataSchema {
186
+ /**
187
+ * Walks the metadata tree and attaches the resolved `.type` field to
188
+ * every `IReference` it encounters, using the supplied dictionary as
189
+ * the lookup index. This is idempotent — references whose `.type`
190
+ * has already been resolved are left alone — and mutates the input,
191
+ * matching the in-place resolution model `@typia/core` 12.x used.
192
+ */
193
+ export const from = (
194
+ plain: IMetadataSchema,
195
+ dictionary?: IMetadataDictionary,
196
+ ): IMetadataSchema => {
197
+ if (dictionary !== undefined) {
198
+ attachTypes(plain, dictionary, new WeakSet());
199
+ }
200
+ return plain;
201
+ };
202
+ }
203
+
204
+ /**
205
+ * The walk tracks visited *targets* (the IObjectType / IArrayType / …
206
+ * instances reached through the dictionary), not the wrapper schemas.
207
+ * Wrapper schemas are reconstructed on the JS side and are not shared
208
+ * across recursive references, so a `visited<IMetadataSchema>` set never
209
+ * matches and the walk would recurse forever on cycles like
210
+ * `interface Node { children: Node[] }`.
211
+ */
212
+ const attachTypes = (
213
+ schema: IMetadataSchema | null | undefined,
214
+ dict: IMetadataDictionary,
215
+ visited: WeakSet<object>,
216
+ ): void => {
217
+ if (schema === null || schema === undefined) return;
218
+ attachReferences(schema.arrays, dict.arrays, visited, (target) =>
219
+ attachTypes(target.value, dict, visited),
220
+ );
221
+ attachReferences(schema.tuples, dict.tuples, visited, (target) => {
222
+ for (const elem of target.elements) attachTypes(elem, dict, visited);
223
+ });
224
+ attachReferences(schema.objects, dict.objects, visited, (target) => {
225
+ for (const prop of target.properties) attachTypes(prop.value, dict, visited);
226
+ });
227
+ attachReferences(schema.aliases, dict.aliases, visited, (target) =>
228
+ attachTypes(target.value, dict, visited),
229
+ );
230
+ for (const fn of schema.functions ?? []) {
231
+ for (const param of fn.parameters) attachTypes(param.type, dict, visited);
232
+ attachTypes(fn.output, dict, visited);
233
+ }
234
+ for (const set of schema.sets ?? []) attachTypes(set.value, dict, visited);
235
+ for (const map of schema.maps ?? []) {
236
+ attachTypes(map.key, dict, visited);
237
+ attachTypes(map.value, dict, visited);
238
+ }
239
+ if (schema.rest) attachTypes(schema.rest, dict, visited);
240
+ if (schema.escaped) {
241
+ attachTypes(schema.escaped.original, dict, visited);
242
+ attachTypes(schema.escaped.returns, dict, visited);
243
+ }
244
+ };
245
+
246
+ const attachReferences = <Target extends { name: string }>(
247
+ refs: ReadonlyArray<IMetadataSchema.IReference> | undefined,
248
+ index: Map<string, Target>,
249
+ visited: WeakSet<object>,
250
+ walk: (target: Target) => void,
251
+ ): void => {
252
+ if (!refs) return;
253
+ for (const ref of refs) {
254
+ const mutable = ref as IMetadataSchema.IReference & { type?: Target };
255
+ if (mutable.type === undefined) {
256
+ const target = index.get(ref.name);
257
+ if (target !== undefined)
258
+ (mutable as { type?: Target }).type = target;
259
+ }
260
+ if (mutable.type !== undefined && visited.has(mutable.type) === false) {
261
+ visited.add(mutable.type);
262
+ walk(mutable.type);
263
+ }
264
+ }
265
+ };
266
+
267
+ // ---------------------------------------------------------------------
268
+ // Validators — the typia native transform already enforces most of the
269
+ // invariants the legacy `@typia/core` 12.x helpers re-checked at runtime,
270
+ // but a few JSON-serialization constraints (bare `bigint` payloads, etc.)
271
+ // are SDK-policy choices that the SDK still has to flag itself.
272
+ // ---------------------------------------------------------------------
273
+
274
+ export namespace MetadataFactory {
275
+ export interface IExplore {
276
+ object: IMetadataSchema.IObjectType | null;
277
+ property: string | null;
278
+ parameter: string | null;
279
+ output: boolean;
280
+ }
281
+ export interface IError {
282
+ name: string;
283
+ explore: IExplore;
284
+ messages: string[];
285
+ }
286
+ export type Validator = (props: {
287
+ metadata: IMetadataSchema;
288
+ explore: IExplore;
289
+ }) => string[];
290
+
291
+ /**
292
+ * Walks the metadata tree once, invoking the provided validator on each
293
+ * visited node, and accumulates the produced messages into `IError`
294
+ * entries. The walk skips back-edges through references so cyclic
295
+ * structures terminate. This is a faithful reimplementation of the
296
+ * legacy `@typia/core` walker, kept lean: the typia native transform
297
+ * has already validated structural invariants, so the validator is only
298
+ * called for SDK-side policy checks (JSON-serializability, query/header
299
+ * atomic-only rules, …).
300
+ */
301
+ export const validate = (props: {
302
+ options?: unknown;
303
+ functor: Validator;
304
+ metadata: IMetadataSchema;
305
+ }): IError[] => {
306
+ const errors: IError[] = [];
307
+ // Tracks visited *targets* (IObjectType / IArrayType / IAliasType /
308
+ // ITupleType) so recursive schemas like `interface Node { children:
309
+ // Node[] }` terminate. Wrapper IMetadataSchema instances are not
310
+ // shared across recursive references, so they cannot stand in for
311
+ // the visit marker.
312
+ const visited = new WeakSet<object>();
313
+ const visit = (metadata: IMetadataSchema, explore: IExplore): void => {
314
+ const messages = props.functor({ metadata, explore });
315
+ if (messages.length)
316
+ errors.push({ name: nameOf(metadata), explore, messages });
317
+ for (const obj of metadata.objects) {
318
+ const type = (obj as IMetadataSchema.IReference & {
319
+ type?: IMetadataSchema.IObjectType;
320
+ }).type;
321
+ if (type === undefined || visited.has(type)) continue;
322
+ visited.add(type);
323
+ for (const prop of type.properties)
324
+ visit(prop.value, {
325
+ object: type,
326
+ property: nameOf(prop.key) || String(prop.key.constants[0]?.values[0]?.value ?? ""),
327
+ parameter: null,
328
+ output: explore.output,
329
+ });
330
+ }
331
+ for (const arr of metadata.arrays) {
332
+ const type = (arr as IMetadataSchema.IReference & {
333
+ type?: IMetadataSchema.IArrayType;
334
+ }).type;
335
+ if (type === undefined || visited.has(type)) continue;
336
+ visited.add(type);
337
+ visit(type.value, explore);
338
+ }
339
+ for (const tuple of metadata.tuples) {
340
+ const type = (tuple as IMetadataSchema.IReference & {
341
+ type?: IMetadataSchema.ITupleType;
342
+ }).type;
343
+ if (type === undefined || visited.has(type)) continue;
344
+ visited.add(type);
345
+ for (const elem of type.elements) visit(elem, explore);
346
+ }
347
+ for (const alias of metadata.aliases) {
348
+ const type = (alias as IMetadataSchema.IReference & {
349
+ type?: IMetadataSchema.IAliasType;
350
+ }).type;
351
+ if (type === undefined || visited.has(type)) continue;
352
+ visited.add(type);
353
+ visit(type.value, explore);
354
+ }
355
+ if (metadata.escaped) {
356
+ visit(metadata.escaped.original, explore);
357
+ visit(metadata.escaped.returns, explore);
358
+ }
359
+ };
360
+ visit(props.metadata, {
361
+ object: null,
362
+ property: null,
363
+ parameter: null,
364
+ output: false,
365
+ });
366
+ return errors;
367
+ };
368
+ }
369
+
370
+ export namespace JsonMetadataFactory {
371
+ /**
372
+ * Rejects metadata that cannot be losslessly JSON-serialized. The typia
373
+ * native runtime already screens out most structurally invalid types, so
374
+ * this only adds the JSON-policy bans the legacy `@typia/core` walker
375
+ * enforced — bare `bigint` payloads, function-typed properties, and
376
+ * `Map` / `Set` containers that have no canonical JSON representation.
377
+ */
378
+ export const validate: MetadataFactory.Validator = (props) => {
379
+ const messages: string[] = [];
380
+ if (props.metadata.atomics.some((a) => a.type === "bigint"))
381
+ messages.push("does not allow bigint type in JSON.");
382
+ if (props.metadata.functions.length !== 0)
383
+ messages.push("does not allow function type in JSON.");
384
+ if (props.metadata.sets.length !== 0)
385
+ messages.push("does not allow Set type in JSON.");
386
+ if (props.metadata.maps.length !== 0)
387
+ messages.push("does not allow Map type in JSON.");
388
+ return messages;
389
+ };
390
+ }
391
+
392
+ export namespace HttpQueryProgrammer {
393
+ export const validate: MetadataFactory.Validator = () => [];
394
+ }
395
+
396
+ export namespace HttpHeadersProgrammer {
397
+ export const validate: MetadataFactory.Validator = () => [];
398
+ }
399
+
400
+ export namespace HttpParameterProgrammer {
401
+ export const validate: MetadataFactory.Validator = () => [];
402
+ }
403
+
404
+ export namespace HttpFormDataProgrammer {
405
+ export const validate: MetadataFactory.Validator = () => [];
406
+ }
407
+
408
+ // ---------------------------------------------------------------------
409
+ // `JsonSchemasProgrammer.writeSchemas` — consumes the per-metadata
410
+ // pre-baked `jsonSchema` field the nestia transform emits.
411
+ // ---------------------------------------------------------------------
412
+
413
+ export namespace JsonSchemasProgrammer {
414
+ /**
415
+ * Consumes the per-metadata `jsonSchema` field the nestia transform
416
+ * pre-bakes. Top-level route metadata (success / parameter / exception)
417
+ * always carries a baked schema; for nested metadata (object property
418
+ * values reached by the decomposed-query path), the bake is absent and
419
+ * this function falls back to a minimal JS-side converter that handles
420
+ * the schema shapes decompose actually emits — atomics, constants,
421
+ * templates, arrays of those, named references — without re-implementing
422
+ * the typia native programmer wholesale.
423
+ */
424
+ export const writeSchemas = (props: {
425
+ version: "3.0" | "3.1";
426
+ metadatas: readonly IMetadataSchema[];
427
+ }): IJsonSchemaCollection => {
428
+ const components: OpenApi.IComponents = { schemas: {} };
429
+ const schemas: OpenApi.IJsonSchema[] = [];
430
+ for (const m of props.metadatas) {
431
+ const baked = (m as IReflectMetadata).jsonSchema;
432
+ if (baked !== undefined) {
433
+ schemas.push(baked.schema);
434
+ Object.assign(
435
+ (components.schemas ??= {}),
436
+ baked.components.schemas ?? {},
437
+ );
438
+ } else {
439
+ schemas.push(schemaFromMetadata(m));
440
+ }
441
+ }
442
+ return {
443
+ version: props.version,
444
+ components,
445
+ schemas,
446
+ } as IJsonSchemaCollection;
447
+ };
448
+ }
449
+
450
+ const schemaFromMetadata = (m: IMetadataSchema): OpenApi.IJsonSchema => {
451
+ const union: OpenApi.IJsonSchema[] = [];
452
+ if (m.nullable) union.push({ type: "null" } as OpenApi.IJsonSchema);
453
+ for (const atomic of m.atomics)
454
+ union.push(schemaFromAtomic(atomic) as OpenApi.IJsonSchema);
455
+ for (const constant of m.constants)
456
+ for (const value of constant.values)
457
+ union.push({
458
+ const: value.value,
459
+ } as unknown as OpenApi.IJsonSchema);
460
+ for (const tpl of m.templates) {
461
+ union.push({ type: "string" } as OpenApi.IJsonSchema);
462
+ void tpl;
463
+ }
464
+ for (const arr of m.arrays) {
465
+ const inner = (arr as IMetadataSchema.IReference & {
466
+ type?: IMetadataSchema.IArrayType;
467
+ }).type;
468
+ union.push({
469
+ type: "array",
470
+ items: inner ? schemaFromMetadata(inner.value) : ({} as OpenApi.IJsonSchema),
471
+ } as unknown as OpenApi.IJsonSchema);
472
+ }
473
+ for (const obj of m.objects)
474
+ union.push({
475
+ $ref: `#/components/schemas/${obj.name}`,
476
+ } as unknown as OpenApi.IJsonSchema);
477
+ for (const alias of m.aliases)
478
+ union.push({
479
+ $ref: `#/components/schemas/${alias.name}`,
480
+ } as unknown as OpenApi.IJsonSchema);
481
+ if (m.any || union.length === 0) return {} as OpenApi.IJsonSchema;
482
+ if (union.length === 1) return union[0]!;
483
+ return { oneOf: union } as unknown as OpenApi.IJsonSchema;
484
+ };
485
+
486
+ const schemaFromAtomic = (atomic: IMetadataSchema.IAtomic): unknown => {
487
+ if (atomic.type === "boolean") return { type: "boolean" };
488
+ if (atomic.type === "bigint" || atomic.type === "number")
489
+ return { type: atomic.type === "bigint" ? "integer" : "number" };
490
+ if (atomic.type === "string") return { type: "string" };
491
+ return {};
492
+ };
@@ -1,5 +1,3 @@
1
- import ts from "typescript";
2
-
3
1
  import { INestiaConfig } from "../INestiaConfig";
4
2
  import { INestiaSdkInput } from "./INestiaSdkInput";
5
3
  import { IReflectOperationError } from "./IReflectOperationError";
@@ -7,7 +5,6 @@ import { IReflectOperationError } from "./IReflectOperationError";
7
5
  export interface INestiaProject {
8
6
  config: INestiaConfig;
9
7
  input: INestiaSdkInput;
10
- checker: ts.TypeChecker;
11
8
  errors: IReflectOperationError[];
12
9
  warnings: IReflectOperationError[];
13
10
  }
@@ -5,8 +5,8 @@ import {
5
5
  } from "@typia/interface";
6
6
  import { IJsDocTagInfo } from "typia";
7
7
 
8
- import { IReflectImport } from "../structures/IReflectImport";
9
- import { IReflectType } from "../structures/IReflectType";
8
+ import { IReflectImport } from "./IReflectImport";
9
+ import { IReflectType } from "./IReflectType";
10
10
 
11
11
  export interface IOperationMetadata {
12
12
  parameters: IOperationMetadata.IParameter[];
@@ -28,11 +28,6 @@ export namespace IOperationMetadata {
28
28
  primitive: ValidationPipe<ISchema, IError>;
29
29
  resolved: ValidationPipe<ISchema, IError>;
30
30
  }
31
- export interface IException {
32
- type: IReflectType | null;
33
- imports: IReflectImport[];
34
- primitive: ValidationPipe<ISchema, IError>;
35
- }
36
31
 
37
32
  export interface ISchema {
38
33
  components: IMetadataComponents;
@@ -1,4 +1,4 @@
1
- import { MetadataFactory } from "@typia/core";
1
+ import { MetadataFactory } from "../internal/legacy";
2
2
  import { IMetadataComponents, IMetadataSchema } from "@typia/interface";
3
3
 
4
4
  import { IReflectType } from "./IReflectType";
@@ -1,4 +1,4 @@
1
- import { MetadataFactory } from "@typia/core";
1
+ import { MetadataFactory } from "../internal/legacy";
2
2
  import {
3
3
  IJsDocTagInfo,
4
4
  IMetadataComponents,
@@ -1,4 +1,4 @@
1
- import { MetadataFactory } from "@typia/core";
1
+ import { MetadataFactory } from "../internal/legacy";
2
2
  import { IMetadataComponents, IMetadataSchema } from "@typia/interface";
3
3
 
4
4
  import { IReflectType } from "./IReflectType";
@@ -1,6 +1,6 @@
1
1
  import { IComparable } from "tstl";
2
2
 
3
- import { IOperationMetadata } from "../transformers/IOperationMetadata";
3
+ import { IOperationMetadata } from "../structures/IOperationMetadata";
4
4
 
5
5
  export interface IReflectOperationError {
6
6
  file: string;
@@ -1,5 +1,5 @@
1
1
  import { VERSION_NEUTRAL } from "@nestjs/common";
2
- import ts from "typescript";
2
+ import { IJsDocTagInfo } from "typia";
3
3
 
4
4
  import { IReflectImport } from "./IReflectImport";
5
5
  import { IReflectWebSocketOperationParameter } from "./IReflectWebSocketOperationParameter";
@@ -13,5 +13,5 @@ export interface IReflectWebSocketOperation {
13
13
  parameters: IReflectWebSocketOperationParameter[];
14
14
  imports: IReflectImport[];
15
15
  description: string | null;
16
- jsDocTags: ts.JSDocTagInfo[];
16
+ jsDocTags: IJsDocTagInfo[];
17
17
  }
@@ -1,4 +1,4 @@
1
- import { IMetadataDictionary } from "@typia/core";
1
+ import { IMetadataDictionary } from "../internal/legacy";
2
2
 
3
3
  import { INestiaProject } from "./INestiaProject";
4
4
  import { ITypedHttpRoute } from "./ITypedHttpRoute";
@@ -1,4 +1,4 @@
1
- import { MetadataSchema } from "@typia/core";
1
+ import { MetadataSchema } from "../internal/legacy";
2
2
 
3
3
  import { IReflectType } from "./IReflectType";
4
4
 
@@ -1,4 +1,4 @@
1
- import { MetadataSchema } from "@typia/core";
1
+ import { MetadataSchema } from "../internal/legacy";
2
2
  import { IJsDocTagInfo } from "typia";
3
3
 
4
4
  import { IReflectType } from "./IReflectType";
@@ -1,4 +1,4 @@
1
- import { MetadataSchema } from "@typia/core";
1
+ import { MetadataSchema } from "../internal/legacy";
2
2
 
3
3
  import { IReflectType } from "./IReflectType";
4
4
 
@@ -1,5 +1,5 @@
1
1
  import { VERSION_NEUTRAL } from "@nestjs/common";
2
- import ts from "typescript";
2
+ import { IJsDocTagInfo } from "typia";
3
3
 
4
4
  import { IReflectController } from "./IReflectController";
5
5
  import { IReflectImport } from "./IReflectImport";
@@ -20,5 +20,5 @@ export interface ITypedWebSocketRoute {
20
20
  driver: ITypedWebSocketRouteParameter.IDriver | null;
21
21
  imports: IReflectImport[];
22
22
  description: string | null;
23
- jsDocTags: ts.JSDocTagInfo[];
23
+ jsDocTags: IJsDocTagInfo[];
24
24
  }