@typia/interface 12.0.0-dev.20260225

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 (311) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +23 -0
  3. package/lib/http/IHttpConnection.d.ts +163 -0
  4. package/lib/http/IHttpConnection.js +4 -0
  5. package/lib/http/IHttpConnection.js.map +1 -0
  6. package/lib/http/IHttpLlmApplication.d.ts +73 -0
  7. package/lib/http/IHttpLlmApplication.js +3 -0
  8. package/lib/http/IHttpLlmApplication.js.map +1 -0
  9. package/lib/http/IHttpLlmController.d.ts +86 -0
  10. package/lib/http/IHttpLlmController.js +3 -0
  11. package/lib/http/IHttpLlmController.js.map +1 -0
  12. package/lib/http/IHttpLlmFunction.d.ts +79 -0
  13. package/lib/http/IHttpLlmFunction.js +3 -0
  14. package/lib/http/IHttpLlmFunction.js.map +1 -0
  15. package/lib/http/IHttpMigrateApplication.d.ts +42 -0
  16. package/lib/http/IHttpMigrateApplication.js +3 -0
  17. package/lib/http/IHttpMigrateApplication.js.map +1 -0
  18. package/lib/http/IHttpMigrateRoute.d.ts +121 -0
  19. package/lib/http/IHttpMigrateRoute.js +3 -0
  20. package/lib/http/IHttpMigrateRoute.js.map +1 -0
  21. package/lib/http/IHttpResponse.d.ts +40 -0
  22. package/lib/http/IHttpResponse.js +3 -0
  23. package/lib/http/IHttpResponse.js.map +1 -0
  24. package/lib/http/index.d.ts +7 -0
  25. package/lib/http/index.js +24 -0
  26. package/lib/http/index.js.map +1 -0
  27. package/lib/index.d.ts +8 -0
  28. package/lib/index.js +48 -0
  29. package/lib/index.js.map +1 -0
  30. package/lib/metadata/IJsDocTagInfo.d.ts +23 -0
  31. package/lib/metadata/IJsDocTagInfo.js +3 -0
  32. package/lib/metadata/IJsDocTagInfo.js.map +1 -0
  33. package/lib/metadata/IMetadataComponents.d.ts +20 -0
  34. package/lib/metadata/IMetadataComponents.js +3 -0
  35. package/lib/metadata/IMetadataComponents.js.map +1 -0
  36. package/lib/metadata/IMetadataSchema.d.ts +219 -0
  37. package/lib/metadata/IMetadataSchema.js +3 -0
  38. package/lib/metadata/IMetadataSchema.js.map +1 -0
  39. package/lib/metadata/IMetadataSchemaCollection.d.ts +18 -0
  40. package/lib/metadata/IMetadataSchemaCollection.js +3 -0
  41. package/lib/metadata/IMetadataSchemaCollection.js.map +1 -0
  42. package/lib/metadata/IMetadataSchemaUnit.d.ts +18 -0
  43. package/lib/metadata/IMetadataSchemaUnit.js +3 -0
  44. package/lib/metadata/IMetadataSchemaUnit.js.map +1 -0
  45. package/lib/metadata/IMetadataTypeTag.d.ts +28 -0
  46. package/lib/metadata/IMetadataTypeTag.js +3 -0
  47. package/lib/metadata/IMetadataTypeTag.js.map +1 -0
  48. package/lib/metadata/index.d.ts +6 -0
  49. package/lib/metadata/index.js +23 -0
  50. package/lib/metadata/index.js.map +1 -0
  51. package/lib/openapi/OpenApi.d.ts +454 -0
  52. package/lib/openapi/OpenApi.js +3 -0
  53. package/lib/openapi/OpenApi.js.map +1 -0
  54. package/lib/openapi/OpenApiV3.d.ts +420 -0
  55. package/lib/openapi/OpenApiV3.js +3 -0
  56. package/lib/openapi/OpenApiV3.js.map +1 -0
  57. package/lib/openapi/OpenApiV3_1.d.ts +463 -0
  58. package/lib/openapi/OpenApiV3_1.js +3 -0
  59. package/lib/openapi/OpenApiV3_1.js.map +1 -0
  60. package/lib/openapi/SwaggerV2.d.ts +343 -0
  61. package/lib/openapi/SwaggerV2.js +3 -0
  62. package/lib/openapi/SwaggerV2.js.map +1 -0
  63. package/lib/openapi/index.d.ts +4 -0
  64. package/lib/openapi/index.js +21 -0
  65. package/lib/openapi/index.js.map +1 -0
  66. package/lib/protobuf/ProtobufWire.d.ts +46 -0
  67. package/lib/protobuf/ProtobufWire.js +3 -0
  68. package/lib/protobuf/ProtobufWire.js.map +1 -0
  69. package/lib/protobuf/index.d.ts +1 -0
  70. package/lib/protobuf/index.js +18 -0
  71. package/lib/protobuf/index.js.map +1 -0
  72. package/lib/schema/IJsonSchemaApplication.d.ts +232 -0
  73. package/lib/schema/IJsonSchemaApplication.js +3 -0
  74. package/lib/schema/IJsonSchemaApplication.js.map +1 -0
  75. package/lib/schema/IJsonSchemaAttribute.d.ts +152 -0
  76. package/lib/schema/IJsonSchemaAttribute.js +3 -0
  77. package/lib/schema/IJsonSchemaAttribute.js.map +1 -0
  78. package/lib/schema/IJsonSchemaCollection.d.ts +109 -0
  79. package/lib/schema/IJsonSchemaCollection.js +3 -0
  80. package/lib/schema/IJsonSchemaCollection.js.map +1 -0
  81. package/lib/schema/IJsonSchemaTransformError.d.ts +81 -0
  82. package/lib/schema/IJsonSchemaTransformError.js +3 -0
  83. package/lib/schema/IJsonSchemaTransformError.js.map +1 -0
  84. package/lib/schema/IJsonSchemaUnit.d.ts +106 -0
  85. package/lib/schema/IJsonSchemaUnit.js +3 -0
  86. package/lib/schema/IJsonSchemaUnit.js.map +1 -0
  87. package/lib/schema/ILlmApplication.d.ts +95 -0
  88. package/lib/schema/ILlmApplication.js +3 -0
  89. package/lib/schema/ILlmApplication.js.map +1 -0
  90. package/lib/schema/ILlmController.d.ts +53 -0
  91. package/lib/schema/ILlmController.js +3 -0
  92. package/lib/schema/ILlmController.js.map +1 -0
  93. package/lib/schema/ILlmFunction.d.ts +134 -0
  94. package/lib/schema/ILlmFunction.js +3 -0
  95. package/lib/schema/ILlmFunction.js.map +1 -0
  96. package/lib/schema/ILlmSchema.d.ts +412 -0
  97. package/lib/schema/ILlmSchema.js +3 -0
  98. package/lib/schema/ILlmSchema.js.map +1 -0
  99. package/lib/schema/IResult.d.ts +81 -0
  100. package/lib/schema/IResult.js +3 -0
  101. package/lib/schema/IResult.js.map +1 -0
  102. package/lib/schema/IValidation.d.ts +123 -0
  103. package/lib/schema/IValidation.js +3 -0
  104. package/lib/schema/IValidation.js.map +1 -0
  105. package/lib/schema/index.d.ts +11 -0
  106. package/lib/schema/index.js +28 -0
  107. package/lib/schema/index.js.map +1 -0
  108. package/lib/tags/Constant.d.ts +44 -0
  109. package/lib/tags/Constant.js +3 -0
  110. package/lib/tags/Constant.js.map +1 -0
  111. package/lib/tags/ContentMediaType.d.ts +39 -0
  112. package/lib/tags/ContentMediaType.js +3 -0
  113. package/lib/tags/ContentMediaType.js.map +1 -0
  114. package/lib/tags/Default.d.ts +42 -0
  115. package/lib/tags/Default.js +3 -0
  116. package/lib/tags/Default.js.map +1 -0
  117. package/lib/tags/Example.d.ts +38 -0
  118. package/lib/tags/Example.js +3 -0
  119. package/lib/tags/Example.js.map +1 -0
  120. package/lib/tags/Examples.d.ts +44 -0
  121. package/lib/tags/Examples.js +3 -0
  122. package/lib/tags/Examples.js.map +1 -0
  123. package/lib/tags/ExclusiveMaximum.d.ts +39 -0
  124. package/lib/tags/ExclusiveMaximum.js +3 -0
  125. package/lib/tags/ExclusiveMaximum.js.map +1 -0
  126. package/lib/tags/ExclusiveMinimum.d.ts +39 -0
  127. package/lib/tags/ExclusiveMinimum.js +3 -0
  128. package/lib/tags/ExclusiveMinimum.js.map +1 -0
  129. package/lib/tags/Format.d.ts +43 -0
  130. package/lib/tags/Format.js +3 -0
  131. package/lib/tags/Format.js.map +1 -0
  132. package/lib/tags/JsonSchemaPlugin.d.ts +44 -0
  133. package/lib/tags/JsonSchemaPlugin.js +3 -0
  134. package/lib/tags/JsonSchemaPlugin.js.map +1 -0
  135. package/lib/tags/MaxItems.d.ts +38 -0
  136. package/lib/tags/MaxItems.js +3 -0
  137. package/lib/tags/MaxItems.js.map +1 -0
  138. package/lib/tags/MaxLength.d.ts +36 -0
  139. package/lib/tags/MaxLength.js +3 -0
  140. package/lib/tags/MaxLength.js.map +1 -0
  141. package/lib/tags/Maximum.d.ts +41 -0
  142. package/lib/tags/Maximum.js +3 -0
  143. package/lib/tags/Maximum.js.map +1 -0
  144. package/lib/tags/MinItems.d.ts +38 -0
  145. package/lib/tags/MinItems.js +3 -0
  146. package/lib/tags/MinItems.js.map +1 -0
  147. package/lib/tags/MinLength.d.ts +36 -0
  148. package/lib/tags/MinLength.js +3 -0
  149. package/lib/tags/MinLength.js.map +1 -0
  150. package/lib/tags/Minimum.d.ts +41 -0
  151. package/lib/tags/Minimum.js +3 -0
  152. package/lib/tags/Minimum.js.map +1 -0
  153. package/lib/tags/MultipleOf.d.ts +49 -0
  154. package/lib/tags/MultipleOf.js +3 -0
  155. package/lib/tags/MultipleOf.js.map +1 -0
  156. package/lib/tags/Pattern.d.ts +51 -0
  157. package/lib/tags/Pattern.js +3 -0
  158. package/lib/tags/Pattern.js.map +1 -0
  159. package/lib/tags/Sequence.d.ts +42 -0
  160. package/lib/tags/Sequence.js +3 -0
  161. package/lib/tags/Sequence.js.map +1 -0
  162. package/lib/tags/TagBase.d.ts +109 -0
  163. package/lib/tags/TagBase.js +3 -0
  164. package/lib/tags/TagBase.js.map +1 -0
  165. package/lib/tags/Type.d.ts +53 -0
  166. package/lib/tags/Type.js +3 -0
  167. package/lib/tags/Type.js.map +1 -0
  168. package/lib/tags/UniqueItems.d.ts +41 -0
  169. package/lib/tags/UniqueItems.js +3 -0
  170. package/lib/tags/UniqueItems.js.map +1 -0
  171. package/lib/tags/index.d.ts +21 -0
  172. package/lib/tags/index.js +38 -0
  173. package/lib/tags/index.js.map +1 -0
  174. package/lib/typings/AssertionGuard.d.ts +12 -0
  175. package/lib/typings/AssertionGuard.js +3 -0
  176. package/lib/typings/AssertionGuard.js.map +1 -0
  177. package/lib/typings/Atomic.d.ts +19 -0
  178. package/lib/typings/Atomic.js +3 -0
  179. package/lib/typings/Atomic.js.map +1 -0
  180. package/lib/typings/CamelCase.d.ts +26 -0
  181. package/lib/typings/CamelCase.js +3 -0
  182. package/lib/typings/CamelCase.js.map +1 -0
  183. package/lib/typings/ClassProperties.d.ts +14 -0
  184. package/lib/typings/ClassProperties.js +3 -0
  185. package/lib/typings/ClassProperties.js.map +1 -0
  186. package/lib/typings/OmitNever.d.ts +11 -0
  187. package/lib/typings/OmitNever.js +3 -0
  188. package/lib/typings/OmitNever.js.map +1 -0
  189. package/lib/typings/PascalCase.d.ts +25 -0
  190. package/lib/typings/PascalCase.js +3 -0
  191. package/lib/typings/PascalCase.js.map +1 -0
  192. package/lib/typings/Primitive.d.ts +29 -0
  193. package/lib/typings/Primitive.js +3 -0
  194. package/lib/typings/Primitive.js.map +1 -0
  195. package/lib/typings/ProtobufAtomic.d.ts +15 -0
  196. package/lib/typings/ProtobufAtomic.js +3 -0
  197. package/lib/typings/ProtobufAtomic.js.map +1 -0
  198. package/lib/typings/Resolved.d.ts +23 -0
  199. package/lib/typings/Resolved.js +3 -0
  200. package/lib/typings/Resolved.js.map +1 -0
  201. package/lib/typings/SnakeCase.d.ts +31 -0
  202. package/lib/typings/SnakeCase.js +3 -0
  203. package/lib/typings/SnakeCase.js.map +1 -0
  204. package/lib/typings/SpecialFields.d.ts +13 -0
  205. package/lib/typings/SpecialFields.js +3 -0
  206. package/lib/typings/SpecialFields.js.map +1 -0
  207. package/lib/typings/ValidationPipe.d.ts +18 -0
  208. package/lib/typings/ValidationPipe.js +3 -0
  209. package/lib/typings/ValidationPipe.js.map +1 -0
  210. package/lib/typings/index.d.ts +12 -0
  211. package/lib/typings/index.js +29 -0
  212. package/lib/typings/index.js.map +1 -0
  213. package/lib/typings/internal/Equal.d.ts +11 -0
  214. package/lib/typings/internal/Equal.js +3 -0
  215. package/lib/typings/internal/Equal.js.map +1 -0
  216. package/lib/typings/internal/IsTuple.d.ts +13 -0
  217. package/lib/typings/internal/IsTuple.js +3 -0
  218. package/lib/typings/internal/IsTuple.js.map +1 -0
  219. package/lib/typings/internal/NativeClass.d.ts +9 -0
  220. package/lib/typings/internal/NativeClass.js +3 -0
  221. package/lib/typings/internal/NativeClass.js.map +1 -0
  222. package/lib/typings/internal/ValueOf.d.ts +15 -0
  223. package/lib/typings/internal/ValueOf.js +3 -0
  224. package/lib/typings/internal/ValueOf.js.map +1 -0
  225. package/lib/utils/IRandomGenerator.d.ts +68 -0
  226. package/lib/utils/IRandomGenerator.js +3 -0
  227. package/lib/utils/IRandomGenerator.js.map +1 -0
  228. package/lib/utils/IReadableURLSearchParams.d.ts +22 -0
  229. package/lib/utils/IReadableURLSearchParams.js +3 -0
  230. package/lib/utils/IReadableURLSearchParams.js.map +1 -0
  231. package/lib/utils/index.d.ts +2 -0
  232. package/lib/utils/index.js +19 -0
  233. package/lib/utils/index.js.map +1 -0
  234. package/package.json +79 -0
  235. package/src/http/IHttpConnection.ts +200 -0
  236. package/src/http/IHttpLlmApplication.ts +83 -0
  237. package/src/http/IHttpLlmController.ts +96 -0
  238. package/src/http/IHttpLlmFunction.ts +93 -0
  239. package/src/http/IHttpMigrateApplication.ts +48 -0
  240. package/src/http/IHttpMigrateRoute.ts +165 -0
  241. package/src/http/IHttpResponse.ts +42 -0
  242. package/src/http/index.ts +7 -0
  243. package/src/index.ts +9 -0
  244. package/src/metadata/IJsDocTagInfo.ts +25 -0
  245. package/src/metadata/IMetadataComponents.ts +24 -0
  246. package/src/metadata/IMetadataSchema.ts +293 -0
  247. package/src/metadata/IMetadataSchemaCollection.ts +20 -0
  248. package/src/metadata/IMetadataSchemaUnit.ts +20 -0
  249. package/src/metadata/IMetadataTypeTag.ts +39 -0
  250. package/src/metadata/index.ts +6 -0
  251. package/src/openapi/OpenApi.ts +643 -0
  252. package/src/openapi/OpenApiV3.ts +655 -0
  253. package/src/openapi/OpenApiV3_1.ts +735 -0
  254. package/src/openapi/SwaggerV2.ts +559 -0
  255. package/src/openapi/index.ts +4 -0
  256. package/src/protobuf/ProtobufWire.ts +51 -0
  257. package/src/protobuf/index.ts +1 -0
  258. package/src/schema/IJsonSchemaApplication.ts +274 -0
  259. package/src/schema/IJsonSchemaAttribute.ts +158 -0
  260. package/src/schema/IJsonSchemaCollection.ts +123 -0
  261. package/src/schema/IJsonSchemaTransformError.ts +86 -0
  262. package/src/schema/IJsonSchemaUnit.ts +120 -0
  263. package/src/schema/ILlmApplication.ts +103 -0
  264. package/src/schema/ILlmController.ts +57 -0
  265. package/src/schema/ILlmFunction.ts +144 -0
  266. package/src/schema/ILlmSchema.ts +484 -0
  267. package/src/schema/IResult.ts +84 -0
  268. package/src/schema/IValidation.ts +134 -0
  269. package/src/schema/index.ts +13 -0
  270. package/src/tags/Constant.ts +49 -0
  271. package/src/tags/ContentMediaType.ts +40 -0
  272. package/src/tags/Default.ts +50 -0
  273. package/src/tags/Example.ts +48 -0
  274. package/src/tags/Examples.ts +50 -0
  275. package/src/tags/ExclusiveMaximum.ts +46 -0
  276. package/src/tags/ExclusiveMinimum.ts +46 -0
  277. package/src/tags/Format.ts +76 -0
  278. package/src/tags/JsonSchemaPlugin.ts +45 -0
  279. package/src/tags/MaxItems.ts +39 -0
  280. package/src/tags/MaxLength.ts +37 -0
  281. package/src/tags/Maximum.ts +44 -0
  282. package/src/tags/MinItems.ts +39 -0
  283. package/src/tags/MinLength.ts +37 -0
  284. package/src/tags/Minimum.ts +44 -0
  285. package/src/tags/MultipleOf.ts +54 -0
  286. package/src/tags/Pattern.ts +59 -0
  287. package/src/tags/Sequence.ts +43 -0
  288. package/src/tags/TagBase.ts +131 -0
  289. package/src/tags/Type.ts +70 -0
  290. package/src/tags/UniqueItems.ts +44 -0
  291. package/src/tags/index.ts +21 -0
  292. package/src/typings/AssertionGuard.ts +12 -0
  293. package/src/typings/Atomic.ts +21 -0
  294. package/src/typings/CamelCase.ts +75 -0
  295. package/src/typings/ClassProperties.ts +15 -0
  296. package/src/typings/OmitNever.ts +12 -0
  297. package/src/typings/PascalCase.ts +71 -0
  298. package/src/typings/Primitive.ts +71 -0
  299. package/src/typings/ProtobufAtomic.ts +30 -0
  300. package/src/typings/Resolved.ts +58 -0
  301. package/src/typings/SnakeCase.ts +126 -0
  302. package/src/typings/SpecialFields.ts +13 -0
  303. package/src/typings/ValidationPipe.ts +20 -0
  304. package/src/typings/index.ts +13 -0
  305. package/src/typings/internal/Equal.ts +14 -0
  306. package/src/typings/internal/IsTuple.ts +17 -0
  307. package/src/typings/internal/NativeClass.ts +31 -0
  308. package/src/typings/internal/ValueOf.ts +29 -0
  309. package/src/utils/IRandomGenerator.ts +105 -0
  310. package/src/utils/IReadableURLSearchParams.ts +25 -0
  311. package/src/utils/index.ts +2 -0
@@ -0,0 +1,200 @@
1
+ /// <reference lib="dom" />
2
+
3
+ /**
4
+ * HTTP connection configuration for remote server communication.
5
+ *
6
+ * `IHttpConnection` defines connection settings required to communicate with
7
+ * remote HTTP servers. This interface is primarily used by `@nestia/fetcher`
8
+ * and generated SDK functions to establish HTTP connections.
9
+ *
10
+ * The {@link host} property specifies the base URL of the target server, while
11
+ * {@link headers} allows passing custom HTTP headers with each request. For
12
+ * fine-grained control over fetch behavior, use {@link options} to configure
13
+ * caching, CORS, credentials, and other fetch API settings.
14
+ *
15
+ * In Node.js versions prior to 20 (which lack native fetch), provide a polyfill
16
+ * like `node-fetch` via the {@link fetch} property.
17
+ *
18
+ * @author Jeongho Nam - https://github.com/samchon
19
+ * @author Seungjun We - https://github.com/SeungjunWe
20
+ */
21
+ export interface IHttpConnection {
22
+ /**
23
+ * Base URL of the remote HTTP server.
24
+ *
25
+ * Must include protocol (http:// or https://) and may include port. Example:
26
+ * `"https://api.example.com"` or `"http://localhost:3000"`.
27
+ */
28
+ host: string;
29
+
30
+ /**
31
+ * Custom HTTP headers to send with every request.
32
+ *
33
+ * Common use cases include authentication tokens, API keys, and content
34
+ * negotiation headers. Values can be primitives or arrays.
35
+ */
36
+ headers?: Record<string, IHttpConnection.HeaderValue>;
37
+
38
+ /**
39
+ * Additional fetch API options.
40
+ *
41
+ * Configure caching, CORS mode, credentials handling, and other
42
+ * fetch-specific behaviors. These options are passed directly to the
43
+ * underlying fetch call.
44
+ */
45
+ options?: IHttpConnection.IOptions;
46
+
47
+ /**
48
+ * Custom fetch function implementation.
49
+ *
50
+ * For Node.js versions before 20 that lack native fetch support, provide a
51
+ * polyfill such as `node-fetch`. This allows the same connection
52
+ * configuration to work across all Node.js versions.
53
+ *
54
+ * @example
55
+ * import fetch from "node-fetch";
56
+ *
57
+ * const connection: IHttpConnection = {
58
+ * host: "https://api.example.com",
59
+ * fetch: fetch as any,
60
+ * };
61
+ */
62
+ fetch?: typeof fetch;
63
+ }
64
+ export namespace IHttpConnection {
65
+ /**
66
+ * Fetch API request options.
67
+ *
68
+ * Subset of the standard `RequestInit` interface, excluding properties that
69
+ * are managed internally (body, headers, method). These options control
70
+ * caching, CORS, credentials, and request lifecycle behavior.
71
+ */
72
+ export interface IOptions {
73
+ /**
74
+ * Request cache mode.
75
+ *
76
+ * Controls how the request interacts with the browser's HTTP cache.
77
+ *
78
+ * - `"default"`: Standard browser caching behavior
79
+ * - `"no-store"`: Bypass cache completely, don't store response
80
+ * - `"reload"`: Bypass cache, but store response
81
+ * - `"no-cache"`: Validate with server before using cache
82
+ * - `"force-cache"`: Use cache even if stale
83
+ * - `"only-if-cached"`: Only use cache, fail if not cached
84
+ */
85
+ cache?:
86
+ | "default"
87
+ | "force-cache"
88
+ | "no-cache"
89
+ | "no-store"
90
+ | "only-if-cached"
91
+ | "reload";
92
+
93
+ /**
94
+ * Credentials inclusion mode.
95
+ *
96
+ * Controls whether cookies and HTTP authentication are sent.
97
+ *
98
+ * - `"omit"`: Never send credentials
99
+ * - `"same-origin"`: Send credentials only for same-origin requests
100
+ * - `"include"`: Always send credentials, even cross-origin
101
+ */
102
+ credentials?: "omit" | "same-origin" | "include";
103
+
104
+ /**
105
+ * Subresource integrity hash for verification.
106
+ *
107
+ * A cryptographic hash (e.g., `"sha256-abc123..."`) to verify the fetched
108
+ * resource hasn't been tampered with. The browser will reject responses
109
+ * that don't match the expected hash.
110
+ */
111
+ integrity?: string;
112
+
113
+ /**
114
+ * Whether to keep the connection alive after page unload.
115
+ *
116
+ * When `true`, the request can outlive the page that initiated it. Useful
117
+ * for analytics or logging requests that should complete even if the user
118
+ * navigates away.
119
+ */
120
+ keepalive?: boolean;
121
+
122
+ /**
123
+ * CORS (Cross-Origin Resource Sharing) mode.
124
+ *
125
+ * Controls cross-origin request behavior.
126
+ *
127
+ * - `"cors"`: Standard CORS request (requires server support)
128
+ * - `"no-cors"`: Limited cross-origin request (opaque response)
129
+ * - `"same-origin"`: Only allow same-origin requests
130
+ * - `"navigate"`: For navigation requests (used by browsers)
131
+ */
132
+ mode?: "cors" | "navigate" | "no-cors" | "same-origin";
133
+
134
+ /**
135
+ * HTTP redirect handling behavior.
136
+ *
137
+ * - `"follow"`: Automatically follow redirects (default)
138
+ * - `"error"`: Throw an error on redirect
139
+ * - `"manual"`: Return redirect response for manual handling
140
+ */
141
+ redirect?: "error" | "follow" | "manual";
142
+
143
+ /**
144
+ * Referrer URL to send with the request.
145
+ *
146
+ * Overrides the default referrer. Use empty string to suppress the referrer
147
+ * header entirely.
148
+ */
149
+ referrer?: string;
150
+
151
+ /**
152
+ * Policy for how much referrer information to include.
153
+ *
154
+ * Controls what referrer information is sent with requests. More
155
+ * restrictive policies improve privacy but may break some server-side
156
+ * analytics or security checks.
157
+ */
158
+ referrerPolicy?:
159
+ | ""
160
+ | "no-referrer"
161
+ | "no-referrer-when-downgrade"
162
+ | "origin"
163
+ | "origin-when-cross-origin"
164
+ | "same-origin"
165
+ | "strict-origin"
166
+ | "strict-origin-when-cross-origin"
167
+ | "unsafe-url";
168
+
169
+ /**
170
+ * AbortSignal for request cancellation.
171
+ *
172
+ * Connect to an AbortController to enable cancellation of in-flight
173
+ * requests. When the signal is aborted, the fetch promise rejects with an
174
+ * AbortError.
175
+ *
176
+ * @example
177
+ * const controller = new AbortController();
178
+ * const options = { signal: controller.signal };
179
+ * // Later: controller.abort();
180
+ */
181
+ signal?: AbortSignal | null;
182
+ }
183
+
184
+ /**
185
+ * Allowed types for HTTP header values.
186
+ *
187
+ * Supports primitive types (string, boolean, number, bigint) and arrays of
188
+ * primitives. Arrays are typically joined with commas when sent as HTTP
189
+ * headers.
190
+ */
191
+ export type HeaderValue =
192
+ | string
193
+ | boolean
194
+ | number
195
+ | bigint
196
+ | Array<boolean>
197
+ | Array<number>
198
+ | Array<bigint>
199
+ | Array<string>;
200
+ }
@@ -0,0 +1,83 @@
1
+ import { OpenApi } from "../openapi/OpenApi";
2
+ import { ILlmSchema } from "../schema/ILlmSchema";
3
+ import { IHttpLlmFunction } from "./IHttpLlmFunction";
4
+ import { IHttpMigrateRoute } from "./IHttpMigrateRoute";
5
+
6
+ /**
7
+ * LLM function calling application from OpenAPI document.
8
+ *
9
+ * `IHttpLlmApplication` is a collection of {@link IHttpLlmFunction} schemas
10
+ * converted from {@link OpenApi.IDocument} by `HttpLlm.application()`. Each
11
+ * OpenAPI operation becomes an LLM-callable function.
12
+ *
13
+ * Successful conversions go to {@link functions}, failed ones to {@link errors}
14
+ * with detailed error messages. Common failure causes:
15
+ *
16
+ * - Unsupported schema features (tuples, `oneOf` with incompatible types)
17
+ * - Missing required fields in OpenAPI document
18
+ * - Operations marked with `x-samchon-human: true`
19
+ *
20
+ * Configure behavior via {@link IHttpLlmApplication.IConfig}:
21
+ *
22
+ * - {@link IHttpLlmApplication.IConfig.separate}: Split LLM vs human parameters
23
+ * - {@link IHttpLlmApplication.IConfig.maxLength}: Function name length limit
24
+ * - {@link ILlmSchema.IConfig.strict}: OpenAI structured output mode
25
+ *
26
+ * @author Jeongho Nam - https://github.com/samchon
27
+ */
28
+ export interface IHttpLlmApplication {
29
+ /** Successfully converted LLM function schemas. */
30
+ functions: IHttpLlmFunction[];
31
+
32
+ /** Operations that failed conversion. */
33
+ errors: IHttpLlmApplication.IError[];
34
+
35
+ /** Configuration used for composition. */
36
+ config: IHttpLlmApplication.IConfig;
37
+ }
38
+ export namespace IHttpLlmApplication {
39
+ /** Configuration for HTTP LLM application composition. */
40
+ export interface IConfig extends ILlmSchema.IConfig {
41
+ /**
42
+ * Separates parameters into LLM and human parts.
43
+ *
44
+ * Use for file uploads or sensitive data that LLM cannot handle. Return
45
+ * `true` for human-composed, `false` for LLM-composed.
46
+ *
47
+ * @default null
48
+ */
49
+ separate: null | ((schema: ILlmSchema) => boolean);
50
+
51
+ /**
52
+ * Maximum function name length. Truncated or UUID if exceeded.
53
+ *
54
+ * @default 64
55
+ */
56
+ maxLength: number;
57
+
58
+ /**
59
+ * Whether to disallow superfluous properties.
60
+ *
61
+ * @default false
62
+ */
63
+ equals: boolean;
64
+ }
65
+
66
+ /** Composition error for an operation. */
67
+ export interface IError {
68
+ /** HTTP method of the failed operation. */
69
+ method: "get" | "post" | "put" | "patch" | "delete" | "head";
70
+
71
+ /** Path of the failed operation. */
72
+ path: string;
73
+
74
+ /** Error messages describing the failure. */
75
+ messages: string[];
76
+
77
+ /** Returns source {@link OpenApi.IOperation}. */
78
+ operation: () => OpenApi.IOperation;
79
+
80
+ /** Returns source route. Undefined if error occurred at migration level. */
81
+ route: () => IHttpMigrateRoute | undefined;
82
+ }
83
+ }
@@ -0,0 +1,96 @@
1
+ import { IHttpConnection } from "./IHttpConnection";
2
+ import { IHttpLlmApplication } from "./IHttpLlmApplication";
3
+ import { IHttpLlmFunction } from "./IHttpLlmFunction";
4
+ import { IHttpResponse } from "./IHttpResponse";
5
+
6
+ /**
7
+ * Controller of HTTP LLM function calling.
8
+ *
9
+ * `IHttpLlmController` is a controller for registering OpenAPI operations as
10
+ * LLM function calling tools. It contains {@link IHttpLlmApplication} with
11
+ * {@link IHttpLlmFunction function calling schemas}, {@link name identifier},
12
+ * and {@link connection} to the API server.
13
+ *
14
+ * You can create this controller with {@link HttpLlm.controller} function,
15
+ * and register it to MCP server with {@link registerMcpControllers}:
16
+ *
17
+ * ```typescript
18
+ * import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
19
+ * import { HttpLlm } from "@typia/utils";
20
+ * import { registerMcpControllers } from "@typia/mcp";
21
+ *
22
+ * const server = new McpServer({ name: "my-server", version: "1.0.0" });
23
+ * registerMcpControllers({
24
+ * server,
25
+ * controllers: [
26
+ * HttpLlm.controller({
27
+ * name: "shopping",
28
+ * document: await fetch(
29
+ * "https://shopping-be.wrtn.io/editor/swagger.json",
30
+ * ).then((r) => r.json()),
31
+ * connection: {
32
+ * host: "https://shopping-be.wrtn.io",
33
+ * headers: {
34
+ * Authorization: "Bearer ********",
35
+ * },
36
+ * },
37
+ * }),
38
+ * ],
39
+ * });
40
+ * ```
41
+ *
42
+ * For TypeScript class-based controller, use {@link ILlmController} instead.
43
+ *
44
+ * @author Jeongho Nam - https://github.com/samchon
45
+ */
46
+ export interface IHttpLlmController {
47
+ /** Protocol discriminator. */
48
+ protocol: "http";
49
+
50
+ /** Identifier name of the controller. */
51
+ name: string;
52
+
53
+ /** Application schema of function calling. */
54
+ application: IHttpLlmApplication;
55
+
56
+ /**
57
+ * Connection to the server.
58
+ *
59
+ * Connection to the API server including the URL and headers.
60
+ */
61
+ connection: IHttpConnection;
62
+
63
+ /**
64
+ * Executor of the API function.
65
+ *
66
+ * Default executor is {@link HttpLlm.execute} function, and you can override
67
+ * it with your own function.
68
+ *
69
+ * @param props Properties of the API function call
70
+ * @returns HTTP response of the API function call
71
+ */
72
+ execute?:
73
+ | undefined
74
+ | ((props: {
75
+ /** Connection to the server. */
76
+ connection: IHttpConnection;
77
+
78
+ /** Application schema. */
79
+ application: IHttpLlmApplication;
80
+
81
+ /** Function schema. */
82
+ function: IHttpLlmFunction;
83
+
84
+ /**
85
+ * Arguments of the function calling.
86
+ *
87
+ * It is an object of key-value pairs of the API function's parameters.
88
+ * The property keys are composed by below rules:
89
+ *
90
+ * - Parameter names
91
+ * - Query parameter as an object type if exists
92
+ * - Body parameter if exists
93
+ */
94
+ arguments: object;
95
+ }) => Promise<IHttpResponse>);
96
+ }
@@ -0,0 +1,93 @@
1
+ import { OpenApi } from "../openapi/OpenApi";
2
+ import { ILlmSchema } from "../schema/ILlmSchema";
3
+ import { IValidation } from "../schema/IValidation";
4
+ import { IHttpMigrateRoute } from "./IHttpMigrateRoute";
5
+
6
+ /**
7
+ * LLM function calling schema from OpenAPI operation.
8
+ *
9
+ * `IHttpLlmFunction` represents a single HTTP endpoint converted to LLM
10
+ * function calling format. Generated from {@link OpenApi.IOperation} as part of
11
+ * {@link IHttpLlmApplication}.
12
+ *
13
+ * Key properties:
14
+ *
15
+ * - {@link name}: Function name (max 64 chars for OpenAI compatibility)
16
+ * - {@link parameters}: Input schema with path/query/body merged
17
+ * - {@link output}: Response schema (undefined if void)
18
+ * - {@link description}: Critical for LLM function selection
19
+ * - {@link validate}: Built-in argument validator for error feedback
20
+ *
21
+ * The {@link validate} function is essential: LLMs make frequent type errors
22
+ * (e.g., `"123"` instead of `123`). Validate and retry improves success rate
23
+ * from ~50% to 99%.
24
+ *
25
+ * @author Jeongho Nam - https://github.com/samchon
26
+ */
27
+ export interface IHttpLlmFunction {
28
+ /** HTTP method of the endpoint. */
29
+ method: "get" | "post" | "patch" | "put" | "delete";
30
+
31
+ /** Path of the endpoint. */
32
+ path: string;
33
+
34
+ /**
35
+ * Function name composed from {@link IHttpMigrateRoute.accessor}.
36
+ *
37
+ * @maxLength 64
38
+ */
39
+ name: string;
40
+
41
+ /**
42
+ * Parameter schema.
43
+ *
44
+ * With keyword mode: single object with pathParameters, query, body merged.
45
+ * Without keyword mode: array of [pathParameters..., query?, body?].
46
+ */
47
+ parameters: ILlmSchema.IParameters;
48
+
49
+ /**
50
+ * Separated parameters when {@link IHttpLlmApplication.IConfig.separate} is
51
+ * set.
52
+ */
53
+ separated?: IHttpLlmFunction.ISeparated;
54
+
55
+ /** Return type schema. Undefined if void. */
56
+ output?: ILlmSchema | undefined;
57
+
58
+ /** Function description for LLM context. Critical for function selection. */
59
+ description?: string | undefined;
60
+
61
+ /** Whether the function is deprecated. */
62
+ deprecated?: boolean | undefined;
63
+
64
+ /** Category tags from {@link OpenApi.IOperation.tags}. */
65
+ tags?: string[];
66
+
67
+ /**
68
+ * Validates LLM-composed arguments.
69
+ *
70
+ * LLMs frequently make type errors. Use this to provide validation feedback
71
+ * and retry. Success rate improves from ~50% to 99% on retry.
72
+ */
73
+ validate: (args: unknown) => IValidation<unknown>;
74
+
75
+ /** Returns the source {@link OpenApi.IOperation}. */
76
+ operation: () => OpenApi.IOperation;
77
+
78
+ /** Returns the source {@link IHttpMigrateRoute}. */
79
+ route: () => IHttpMigrateRoute;
80
+ }
81
+ export namespace IHttpLlmFunction {
82
+ /** Collection of separated parameters. */
83
+ export interface ISeparated {
84
+ /** Parameters for LLM composition. Always at least empty object. */
85
+ llm: ILlmSchema.IParameters;
86
+
87
+ /** Parameters for human composition. */
88
+ human: ILlmSchema.IParameters | null;
89
+
90
+ /** Validates separated LLM arguments. */
91
+ validate?: ((args: unknown) => IValidation<unknown>) | undefined;
92
+ }
93
+ }
@@ -0,0 +1,48 @@
1
+ import { OpenApi } from "../openapi/OpenApi";
2
+ import { IHttpMigrateRoute } from "./IHttpMigrateRoute";
3
+
4
+ /**
5
+ * Migrated application from OpenAPI document.
6
+ *
7
+ * `IHttpMigrateApplication` converts OpenAPI operations into callable HTTP
8
+ * routes via `HttpMigration.application()`. Unlike {@link IHttpLlmApplication}
9
+ * which targets LLM function calling, this focuses on SDK/client code
10
+ * generation with full HTTP semantics.
11
+ *
12
+ * Each {@link IHttpMigrateRoute} represents a single API endpoint with:
13
+ *
14
+ * - Resolved path parameters (`:id` format)
15
+ * - Combined query/header schemas as objects
16
+ * - Request/response body with content type
17
+ * - Accessor path for RPC-style function naming
18
+ *
19
+ * Failed operations go to {@link errors} with detailed messages.
20
+ *
21
+ * @author Jeongho Nam - https://github.com/samchon
22
+ */
23
+ export interface IHttpMigrateApplication {
24
+ /** Successfully migrated routes. */
25
+ routes: IHttpMigrateRoute[];
26
+
27
+ /** Operations that failed migration. */
28
+ errors: IHttpMigrateApplication.IError[];
29
+
30
+ /** Returns source OpenAPI document. */
31
+ document: () => OpenApi.IDocument;
32
+ }
33
+ export namespace IHttpMigrateApplication {
34
+ /** Migration error for an operation. */
35
+ export interface IError {
36
+ /** Returns source operation. */
37
+ operation: () => OpenApi.IOperation;
38
+
39
+ /** HTTP method. */
40
+ method: "head" | "get" | "post" | "put" | "patch" | "delete";
41
+
42
+ /** Operation path. */
43
+ path: string;
44
+
45
+ /** Error messages. */
46
+ messages: string[];
47
+ }
48
+ }
@@ -0,0 +1,165 @@
1
+ import { OpenApi } from "../openapi/OpenApi";
2
+
3
+ /**
4
+ * HTTP route converted from OpenAPI operation.
5
+ *
6
+ * `IHttpMigrateRoute` represents a single API endpoint with all
7
+ * request/response schemas resolved and ready for code generation. Contains
8
+ * {@link parameters} for URL path variables, {@link query} for query strings,
9
+ * {@link headers}, {@link body} for request payload, and
10
+ * {@link success}/{@link exceptions} for responses.
11
+ *
12
+ * @author Jeongho Nam - https://github.com/samchon
13
+ */
14
+ export interface IHttpMigrateRoute {
15
+ /** HTTP method. Operations with other methods are ignored. */
16
+ method: "head" | "get" | "post" | "put" | "patch" | "delete";
17
+
18
+ /** Original path from OpenAPI document. */
19
+ path: string;
20
+
21
+ /** Emended path with `:param` format, always starts with `/`. */
22
+ emendedPath: string;
23
+
24
+ /**
25
+ * Accessor path for generated RPC function.
26
+ *
27
+ * Namespaces from static path segments, function name from method +
28
+ * parameters. `delete` becomes `erase` to avoid reserved keyword.
29
+ */
30
+ accessor: string[];
31
+
32
+ /** Path parameters only. */
33
+ parameters: IHttpMigrateRoute.IParameter[];
34
+
35
+ /** Combined headers as single object. Null if none. */
36
+ headers: IHttpMigrateRoute.IHeaders | null;
37
+
38
+ /** Combined query parameters as single object. Null if none. */
39
+ query: IHttpMigrateRoute.IQuery | null;
40
+
41
+ /** Request body metadata. Null if none. */
42
+ body: IHttpMigrateRoute.IBody | null;
43
+
44
+ /** Success response (200/201). Null if void return. */
45
+ success: IHttpMigrateRoute.ISuccess | null;
46
+
47
+ /** Exception responses keyed by status code. */
48
+ exceptions: Record<string, IHttpMigrateRoute.IException>;
49
+
50
+ /** Returns description comment for the RPC function. */
51
+ comment: () => string;
52
+
53
+ /** Returns source {@link OpenApi.IOperation}. */
54
+ operation: () => OpenApi.IOperation;
55
+ }
56
+ export namespace IHttpMigrateRoute {
57
+ /** Path parameter metadata. */
58
+ export interface IParameter {
59
+ /** Parameter name in path template. */
60
+ name: string;
61
+
62
+ /** Parameter variable key. */
63
+ key: string;
64
+
65
+ /** Parameter type schema. */
66
+ schema: OpenApi.IJsonSchema;
67
+
68
+ /** Returns source parameter definition. */
69
+ parameter: () => OpenApi.IOperation.IParameter;
70
+ }
71
+
72
+ /** Headers metadata. */
73
+ export interface IHeaders {
74
+ /** Combined headers parameter name. */
75
+ name: string;
76
+
77
+ /** Headers variable key. */
78
+ key: string;
79
+
80
+ /** Combined headers schema. */
81
+ schema: OpenApi.IJsonSchema;
82
+
83
+ /** Returns title. */
84
+ title: () => string | undefined;
85
+
86
+ /** Returns description. */
87
+ description: () => string | undefined;
88
+
89
+ /** Returns example value. */
90
+ example: () => any | undefined;
91
+
92
+ /** Returns named examples. */
93
+ examples: () => Record<string, any> | undefined;
94
+ }
95
+
96
+ /** Query parameters metadata. */
97
+ export interface IQuery {
98
+ /** Combined query parameter name. */
99
+ name: string;
100
+
101
+ /** Query variable key. */
102
+ key: string;
103
+
104
+ /** Combined query schema. */
105
+ schema: OpenApi.IJsonSchema;
106
+
107
+ /** Returns title. */
108
+ title: () => string | undefined;
109
+
110
+ /** Returns description. */
111
+ description: () => string | undefined;
112
+
113
+ /** Returns example value. */
114
+ example: () => any | undefined;
115
+
116
+ /** Returns named examples. */
117
+ examples: () => Record<string, any> | undefined;
118
+ }
119
+
120
+ /** Request body metadata. */
121
+ export interface IBody {
122
+ /** Body parameter name. */
123
+ name: string;
124
+
125
+ /** Body variable key. */
126
+ key: string;
127
+
128
+ /** Content media type. */
129
+ type:
130
+ | "text/plain"
131
+ | "application/json"
132
+ | "application/x-www-form-urlencoded"
133
+ | "multipart/form-data";
134
+
135
+ /** Body type schema. */
136
+ schema: OpenApi.IJsonSchema;
137
+
138
+ /** Returns description. */
139
+ description: () => string | undefined;
140
+
141
+ /** Returns source media type definition. */
142
+ media: () => OpenApi.IOperation.IMediaType;
143
+
144
+ /** Nestia encryption flag. */
145
+ "x-nestia-encrypted"?: boolean;
146
+ }
147
+
148
+ /** Success response metadata. */
149
+ export interface ISuccess extends IBody {
150
+ /** HTTP status code. */
151
+ status: string;
152
+ }
153
+
154
+ /** Exception response metadata. */
155
+ export interface IException {
156
+ /** Exception type schema. */
157
+ schema: OpenApi.IJsonSchema;
158
+
159
+ /** Returns source response definition. */
160
+ response: () => OpenApi.IOperation.IResponse;
161
+
162
+ /** Returns source media type definition. */
163
+ media: () => OpenApi.IOperation.IMediaType;
164
+ }
165
+ }