@typia/utils 12.0.0-dev.20260316 → 12.0.0

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.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 Jeongho Nam
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Jeongho Nam
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,85 +1,85 @@
1
- # `@typia/utils`
2
-
3
- ![Typia Logo](https://typia.io/logo.png)
4
-
5
- [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/typia/blob/master/LICENSE)
6
- [![NPM Version](https://img.shields.io/npm/v/typia.svg)](https://www.npmjs.com/package/typia)
7
- [![NPM Downloads](https://img.shields.io/npm/dm/typia.svg)](https://www.npmjs.com/package/typia)
8
- [![Build Status](https://github.com/samchon/typia/workflows/test/badge.svg)](https://github.com/samchon/typia/actions?query=workflow%3Atest)
9
- [![Guide Documents](https://img.shields.io/badge/Guide-Documents-forestgreen)](https://typia.io/docs/)
10
- [![Gurubase](https://img.shields.io/badge/Gurubase-Document%20Chatbot-006BFF)](https://gurubase.io/g/typia)
11
- [![Discord Badge](https://img.shields.io/badge/discord-samchon-d91965?style=flat&labelColor=5866f2&logo=discord&logoColor=white&link=https://discord.gg/E94XhzrUCZ)](https://discord.gg/E94XhzrUCZ)
12
-
13
- Utility functions and converters for the [`typia`](https://github.com/samchon/typia) ecosystem.
14
-
15
- Automatically installed as a dependency of `typia`.
16
-
17
- ## Key Exports
18
-
19
- | Module | Description |
20
- |--------|-------------|
21
- | `HttpLlm` | Create LLM controllers from OpenAPI documents and execute function calls |
22
- | `HttpMigration` | HTTP migration utilities |
23
- | `HttpError` | HTTP error type |
24
- | `OpenApiConverter` | Convert between OpenAPI versions |
25
- | `OpenApiTypeChecker` | Type checker for OpenAPI documents |
26
- | `LlmSchemaConverter` | Convert JSON Schema to LLM schema |
27
- | `LlmTypeChecker` | Type checker for LLM schemas |
28
- | `LlmJson` | Parse lenient JSON and format validation errors for LLM-friendly feedback |
29
-
30
- ## `LlmJson`
31
-
32
- Parse lenient JSON and format validation errors for LLM-friendly feedback:
33
-
34
- ```typescript
35
- import { IValidation } from "@typia/interface";
36
- import { LlmJson } from "@typia/utils";
37
-
38
- const validation: IValidation<unknown> = func.validate(llmArguments);
39
- if (validation.success === false) {
40
- console.log(LlmJson.stringify(validation));
41
- }
42
- ```
43
-
44
- Output:
45
-
46
- ```json
47
- {
48
- "x": "not a number", // ❌ expected: number
49
- "y": 5
50
- }
51
- ```
52
-
53
- ## `HttpLlm`
54
-
55
- Create LLM controllers from OpenAPI documents:
56
-
57
- ```typescript
58
- import { IHttpLlmController } from "@typia/interface";
59
- import { HttpLlm } from "@typia/utils";
60
-
61
- // any OpenAPI version (Swagger 2.0, OpenAPI 3.0/3.1) is accepted
62
- const controller: IHttpLlmController = HttpLlm.controller({
63
- name: "shopping",
64
- document: await fetch("https://shopping.example.com/swagger.json").then(r => r.json()),
65
- connection: {
66
- host: "https://shopping.example.com",
67
- headers: { Authorization: "Bearer ..." },
68
- },
69
- });
70
-
71
- // use with @typia/langchain, @typia/mcp, or @typia/vercel
72
- toLangChainTools({ controllers: [controller] });
73
- registerMcpControllers({ server, controllers: [controller] });
74
- toVercelTools({ controllers: [controller] });
75
- ```
76
-
77
- `OpenApiConverter` is used internally to normalize any OpenAPI version into a unified format. You can also use it directly:
78
-
79
- ```typescript
80
- import { OpenApi, OpenApiV3 } from "@typia/interface";
81
- import { OpenApiConverter } from "@typia/utils";
82
-
83
- const emended: OpenApi.IDocument = OpenApiConverter.upgradeDocument(swagger2doc); // Swagger 2.0 → OpenApi
84
- const downgraded: OpenApiV3.IDocument = OpenApiConverter.downgradeDocument(emended, "3.0"); // → OpenAPI 3.0
85
- ```
1
+ # `@typia/utils`
2
+
3
+ ![Typia Logo](https://typia.io/logo.png)
4
+
5
+ [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/typia/blob/master/LICENSE)
6
+ [![NPM Version](https://img.shields.io/npm/v/typia.svg)](https://www.npmjs.com/package/typia)
7
+ [![NPM Downloads](https://img.shields.io/npm/dm/typia.svg)](https://www.npmjs.com/package/typia)
8
+ [![Build Status](https://github.com/samchon/typia/workflows/test/badge.svg)](https://github.com/samchon/typia/actions?query=workflow%3Atest)
9
+ [![Guide Documents](https://img.shields.io/badge/Guide-Documents-forestgreen)](https://typia.io/docs/)
10
+ [![Gurubase](https://img.shields.io/badge/Gurubase-Document%20Chatbot-006BFF)](https://gurubase.io/g/typia)
11
+ [![Discord Badge](https://img.shields.io/badge/discord-samchon-d91965?style=flat&labelColor=5866f2&logo=discord&logoColor=white&link=https://discord.gg/E94XhzrUCZ)](https://discord.gg/E94XhzrUCZ)
12
+
13
+ Utility functions and converters for the [`typia`](https://github.com/samchon/typia) ecosystem.
14
+
15
+ Automatically installed as a dependency of `typia`.
16
+
17
+ ## Key Exports
18
+
19
+ | Module | Description |
20
+ |--------|-------------|
21
+ | `HttpLlm` | Create LLM controllers from OpenAPI documents and execute function calls |
22
+ | `HttpMigration` | HTTP migration utilities |
23
+ | `HttpError` | HTTP error type |
24
+ | `OpenApiConverter` | Convert between OpenAPI versions |
25
+ | `OpenApiTypeChecker` | Type checker for OpenAPI documents |
26
+ | `LlmSchemaConverter` | Convert JSON Schema to LLM schema |
27
+ | `LlmTypeChecker` | Type checker for LLM schemas |
28
+ | `LlmJson` | Parse lenient JSON and format validation errors for LLM-friendly feedback |
29
+
30
+ ## `LlmJson`
31
+
32
+ Parse lenient JSON and format validation errors for LLM-friendly feedback:
33
+
34
+ ```typescript
35
+ import { IValidation } from "@typia/interface";
36
+ import { LlmJson } from "@typia/utils";
37
+
38
+ const validation: IValidation<unknown> = func.validate(llmArguments);
39
+ if (validation.success === false) {
40
+ console.log(LlmJson.stringify(validation));
41
+ }
42
+ ```
43
+
44
+ Output:
45
+
46
+ ```json
47
+ {
48
+ "x": "not a number", // ❌ expected: number
49
+ "y": 5
50
+ }
51
+ ```
52
+
53
+ ## `HttpLlm`
54
+
55
+ Create LLM controllers from OpenAPI documents:
56
+
57
+ ```typescript
58
+ import { IHttpLlmController } from "@typia/interface";
59
+ import { HttpLlm } from "@typia/utils";
60
+
61
+ // any OpenAPI version (Swagger 2.0, OpenAPI 3.0/3.1) is accepted
62
+ const controller: IHttpLlmController = HttpLlm.controller({
63
+ name: "shopping",
64
+ document: await fetch("https://shopping.example.com/swagger.json").then(r => r.json()),
65
+ connection: {
66
+ host: "https://shopping.example.com",
67
+ headers: { Authorization: "Bearer ..." },
68
+ },
69
+ });
70
+
71
+ // use with @typia/langchain, @typia/mcp, or @typia/vercel
72
+ toLangChainTools({ controllers: [controller] });
73
+ registerMcpControllers({ server, controllers: [controller] });
74
+ toVercelTools({ controllers: [controller] });
75
+ ```
76
+
77
+ `OpenApiConverter` is used internally to normalize any OpenAPI version into a unified format. You can also use it directly:
78
+
79
+ ```typescript
80
+ import { OpenApi, OpenApiV3 } from "@typia/interface";
81
+ import { OpenApiConverter } from "@typia/utils";
82
+
83
+ const emended: OpenApi.IDocument = OpenApiConverter.upgradeDocument(swagger2doc); // Swagger 2.0 → OpenApi
84
+ const downgraded: OpenApiV3.IDocument = OpenApiConverter.downgradeDocument(emended, "3.0"); // → OpenAPI 3.0
85
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typia/utils",
3
- "version": "12.0.0-dev.20260316",
3
+ "version": "12.0.0",
4
4
  "description": "Superfast runtime validators with only one line",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "homepage": "https://typia.io",
24
24
  "dependencies": {
25
- "@typia/interface": "^12.0.0-dev.20260316"
25
+ "@typia/interface": "^12.0.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@rollup/plugin-commonjs": "^29.0.0",