typia 10.0.0-dev.20251107-4 → 10.0.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 (172) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +155 -153
  3. package/lib/index.mjs +2 -2
  4. package/lib/json.d.mts +108 -21
  5. package/lib/json.d.ts +108 -21
  6. package/lib/json.js +8 -3
  7. package/lib/json.js.map +1 -1
  8. package/lib/json.mjs +7 -3
  9. package/lib/module.d.mts +1 -1
  10. package/lib/module.d.ts +1 -1
  11. package/lib/module.js +1 -1
  12. package/lib/module.js.map +1 -1
  13. package/lib/programmers/json/JsonApplicationProgrammer.d.mts +2 -2
  14. package/lib/programmers/json/JsonApplicationProgrammer.d.ts +2 -2
  15. package/lib/programmers/json/JsonApplicationProgrammer.js.map +1 -1
  16. package/lib/programmers/json/JsonAssertStringifyProgrammer.js +1 -1
  17. package/lib/programmers/json/JsonAssertStringifyProgrammer.js.map +1 -1
  18. package/lib/programmers/json/JsonAssertStringifyProgrammer.mjs +1 -1
  19. package/lib/programmers/json/JsonIsStringifyProgrammer.js +1 -1
  20. package/lib/programmers/json/JsonIsStringifyProgrammer.js.map +1 -1
  21. package/lib/programmers/json/JsonIsStringifyProgrammer.mjs +1 -1
  22. package/lib/programmers/json/JsonValidateStringifyProgrammer.js +1 -1
  23. package/lib/programmers/json/JsonValidateStringifyProgrammer.js.map +1 -1
  24. package/lib/programmers/json/JsonValidateStringifyProgrammer.mjs +1 -1
  25. package/lib/programmers/protobuf/ProtobufAssertEncodeProgrammer.js +1 -1
  26. package/lib/programmers/protobuf/ProtobufAssertEncodeProgrammer.js.map +1 -1
  27. package/lib/programmers/protobuf/ProtobufAssertEncodeProgrammer.mjs +1 -1
  28. package/lib/programmers/protobuf/ProtobufIsEncodeProgrammer.js +1 -1
  29. package/lib/programmers/protobuf/ProtobufIsEncodeProgrammer.js.map +1 -1
  30. package/lib/programmers/protobuf/ProtobufIsEncodeProgrammer.mjs +1 -1
  31. package/lib/programmers/protobuf/ProtobufValidateEncodeProgrammer.js +1 -1
  32. package/lib/programmers/protobuf/ProtobufValidateEncodeProgrammer.js.map +1 -1
  33. package/lib/programmers/protobuf/ProtobufValidateEncodeProgrammer.mjs +1 -1
  34. package/lib/schemas/json/{__IJsonApplication.d.mts → IJsonSchemaApplication.d.mts} +4 -4
  35. package/lib/schemas/json/{__IJsonApplication.d.ts → IJsonSchemaApplication.d.ts} +4 -4
  36. package/lib/schemas/json/{__IJsonApplication.js → IJsonSchemaApplication.js} +1 -1
  37. package/lib/schemas/json/IJsonSchemaApplication.js.map +1 -0
  38. package/lib/schemas/json/IJsonSchemaApplication.mjs +2 -0
  39. package/lib/schemas/json/IJsonSchemaApplication.mjs.map +1 -0
  40. package/lib/transformers/CallExpressionTransformer.js +3 -1
  41. package/lib/transformers/CallExpressionTransformer.js.map +1 -1
  42. package/lib/transformers/CallExpressionTransformer.mjs +3 -1
  43. package/lib/transformers/features/json/JsonApplicationTransformer.d.mts +5 -0
  44. package/lib/transformers/features/json/JsonApplicationTransformer.d.ts +5 -0
  45. package/lib/transformers/features/json/JsonApplicationTransformer.js +85 -92
  46. package/lib/transformers/features/json/JsonApplicationTransformer.js.map +1 -1
  47. package/lib/transformers/features/json/JsonApplicationTransformer.mjs +81 -0
  48. package/lib/transformers/features/llm/LlmSchemaTransformer.js +4 -2
  49. package/lib/transformers/features/llm/LlmSchemaTransformer.js.map +1 -1
  50. package/lib/transformers/features/llm/LlmSchemaTransformer.mjs +3 -1
  51. package/package.json +121 -121
  52. package/src/AssertionGuard.ts +41 -41
  53. package/src/CamelCase.ts +75 -75
  54. package/src/IRandomGenerator.ts +337 -337
  55. package/src/IReadableURLSearchParams.ts +9 -9
  56. package/src/PascalCase.ts +71 -71
  57. package/src/Primitive.ts +90 -90
  58. package/src/Resolved.ts +72 -72
  59. package/src/SnakeCase.ts +127 -127
  60. package/src/TypeGuardError.ts +216 -216
  61. package/src/factories/MetadataCollection.ts +270 -270
  62. package/src/factories/MetadataCommentTagFactory.ts +632 -632
  63. package/src/factories/MetadataFactory.ts +402 -402
  64. package/src/factories/ProtobufFactory.ts +873 -873
  65. package/src/functional.ts +705 -705
  66. package/src/http.ts +972 -972
  67. package/src/internal/_ProtobufReader.ts +188 -188
  68. package/src/internal/_ProtobufSizer.ts +137 -137
  69. package/src/internal/_ProtobufWriter.ts +135 -135
  70. package/src/internal/_jsonStringifyString.ts +42 -42
  71. package/src/json.ts +740 -643
  72. package/src/llm.ts +615 -615
  73. package/src/misc.ts +594 -594
  74. package/src/module.ts +889 -889
  75. package/src/notations.ts +751 -751
  76. package/src/programmers/FeatureProgrammer.ts +605 -605
  77. package/src/programmers/ImportProgrammer.ts +179 -179
  78. package/src/programmers/RandomProgrammer.ts +1195 -1195
  79. package/src/programmers/helpers/ProtobufWire.ts +34 -34
  80. package/src/programmers/internal/check_array_length.ts +43 -43
  81. package/src/programmers/internal/check_bigint.ts +46 -46
  82. package/src/programmers/internal/check_dynamic_key.ts +197 -197
  83. package/src/programmers/internal/check_dynamic_properties.ts +231 -231
  84. package/src/programmers/internal/check_everything.ts +21 -21
  85. package/src/programmers/internal/check_native.ts +23 -23
  86. package/src/programmers/internal/check_number.ts +108 -108
  87. package/src/programmers/internal/check_object.ts +72 -72
  88. package/src/programmers/internal/check_string.ts +46 -46
  89. package/src/programmers/internal/check_template.ts +46 -46
  90. package/src/programmers/internal/check_union_array_like.ts +331 -331
  91. package/src/programmers/internal/decode_union_object.ts +110 -110
  92. package/src/programmers/internal/feature_object_entries.ts +59 -59
  93. package/src/programmers/internal/json_schema_escaped.ts +78 -78
  94. package/src/programmers/internal/json_schema_object.ts +150 -150
  95. package/src/programmers/internal/metadata_to_pattern.ts +40 -40
  96. package/src/programmers/internal/postfix_of_tuple.ts +3 -3
  97. package/src/programmers/internal/prune_object_properties.ts +69 -69
  98. package/src/programmers/internal/stringify_dynamic_properties.ts +158 -158
  99. package/src/programmers/internal/stringify_native.ts +5 -5
  100. package/src/programmers/internal/stringify_regular_properties.ts +77 -77
  101. package/src/programmers/internal/template_to_pattern.ts +21 -21
  102. package/src/programmers/internal/wrap_metadata_rest_tuple.ts +21 -21
  103. package/src/programmers/json/JsonApplicationProgrammer.ts +17 -14
  104. package/src/programmers/json/JsonAssertStringifyProgrammer.ts +1 -1
  105. package/src/programmers/json/JsonIsStringifyProgrammer.ts +1 -1
  106. package/src/programmers/json/JsonStringifyProgrammer.ts +1124 -1124
  107. package/src/programmers/json/JsonValidateStringifyProgrammer.ts +1 -1
  108. package/src/programmers/llm/LlmApplicationProgrammer.ts +4 -4
  109. package/src/programmers/protobuf/ProtobufAssertEncodeProgrammer.ts +1 -1
  110. package/src/programmers/protobuf/ProtobufIsEncodeProgrammer.ts +1 -1
  111. package/src/programmers/protobuf/ProtobufValidateEncodeProgrammer.ts +1 -1
  112. package/src/protobuf.ts +820 -820
  113. package/src/reflect.ts +46 -46
  114. package/src/schemas/json/{__IJsonApplication.ts → IJsonSchemaApplication.ts} +7 -5
  115. package/src/schemas/json/IJsonSchemaCollection.ts +212 -212
  116. package/src/schemas/json/IJsonSchemaUnit.ts +263 -263
  117. package/src/schemas/metadata/IMetadataTypeTag.ts +14 -14
  118. package/src/schemas/metadata/Metadata.ts +669 -669
  119. package/src/schemas/metadata/MetadataAliasType.ts +57 -57
  120. package/src/schemas/metadata/MetadataApplication.ts +40 -40
  121. package/src/schemas/metadata/MetadataArray.ts +47 -47
  122. package/src/schemas/metadata/MetadataArrayType.ts +51 -51
  123. package/src/schemas/metadata/MetadataAtomic.ts +85 -85
  124. package/src/schemas/metadata/MetadataEscaped.ts +45 -45
  125. package/src/schemas/metadata/MetadataFunction.ts +45 -45
  126. package/src/schemas/metadata/MetadataObject.ts +46 -46
  127. package/src/schemas/metadata/MetadataObjectType.ts +137 -137
  128. package/src/schemas/metadata/MetadataParameter.ts +52 -52
  129. package/src/schemas/metadata/MetadataProperty.ts +53 -53
  130. package/src/schemas/metadata/MetadataTemplate.ts +78 -78
  131. package/src/schemas/metadata/MetadataTuple.ts +28 -28
  132. package/src/schemas/metadata/MetadataTupleType.ts +61 -61
  133. package/src/tags/Constant.ts +47 -47
  134. package/src/tags/ContentMediaType.ts +27 -27
  135. package/src/tags/Default.ts +52 -52
  136. package/src/tags/Example.ts +56 -56
  137. package/src/tags/Examples.ts +56 -56
  138. package/src/tags/ExclusiveMaximum.ts +44 -44
  139. package/src/tags/ExclusiveMinimum.ts +44 -44
  140. package/src/tags/Format.ts +78 -78
  141. package/src/tags/JsonSchemaPlugin.ts +36 -36
  142. package/src/tags/MaxItems.ts +31 -31
  143. package/src/tags/MaxLength.ts +25 -25
  144. package/src/tags/Maximum.ts +39 -39
  145. package/src/tags/MinItems.ts +31 -31
  146. package/src/tags/MinLength.ts +25 -25
  147. package/src/tags/Minimum.ts +39 -39
  148. package/src/tags/MultipleOf.ts +42 -42
  149. package/src/tags/Pattern.ts +49 -49
  150. package/src/tags/Sequence.ts +37 -37
  151. package/src/tags/TagBase.ts +102 -102
  152. package/src/tags/Type.ts +64 -64
  153. package/src/tags/UniqueItems.ts +34 -34
  154. package/src/tags/internal/FormatCheatSheet.ts +71 -71
  155. package/src/transformers/CallExpressionTransformer.ts +3 -1
  156. package/src/transformers/ITransformOptions.ts +70 -70
  157. package/src/transformers/ImportTransformer.ts +253 -253
  158. package/src/transformers/NoTransformConfigurationError.ts +16 -16
  159. package/src/transformers/features/json/JsonApplicationTransformer.ts +92 -92
  160. package/src/transformers/features/llm/LlmApplicationTransformer.ts +224 -224
  161. package/src/transformers/features/llm/LlmSchemaTransformer.ts +3 -1
  162. package/src/typings/Equal.ts +18 -18
  163. package/lib/schemas/json/IJsonApplication.d.mts +0 -16
  164. package/lib/schemas/json/IJsonApplication.d.ts +0 -16
  165. package/lib/schemas/json/IJsonApplication.js +0 -58
  166. package/lib/schemas/json/IJsonApplication.js.map +0 -1
  167. package/lib/schemas/json/IJsonApplication.mjs +0 -2
  168. package/lib/schemas/json/IJsonApplication.mjs.map +0 -1
  169. package/lib/schemas/json/__IJsonApplication.js.map +0 -1
  170. package/lib/schemas/json/__IJsonApplication.mjs +0 -2
  171. package/lib/schemas/json/__IJsonApplication.mjs.map +0 -1
  172. package/src/schemas/json/IJsonApplication.ts +0 -77
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,153 +1,155 @@
1
- # Typia
2
- ![Typia Logo](https://typia.io/logo.png)
3
-
4
- [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/typia/blob/master/LICENSE)
5
- [![NPM Version](https://img.shields.io/npm/v/typia.svg)](https://www.npmjs.com/package/typia)
6
- [![NPM Downloads](https://img.shields.io/npm/dm/typia.svg)](https://www.npmjs.com/package/typia)
7
- [![Build Status](https://github.com/samchon/typia/workflows/build/badge.svg)](https://github.com/samchon/typia/actions?query=workflow%3Abuild)
8
- [![Guide Documents](https://img.shields.io/badge/Guide-Documents-forestgreen)](https://typia.io/docs/)
9
- [![Gurubase](https://img.shields.io/badge/Gurubase-Document%20Chatbot-006BFF)](https://gurubase.io/g/typia)
10
- [![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)
11
-
12
- ```typescript
13
- // RUNTIME VALIDATORS
14
- export function is<T>(input: unknown): input is T; // returns boolean
15
- export function assert<T>(input: unknown): T; // throws TypeGuardError
16
- export function assertGuard<T>(input: unknown): asserts input is T;
17
- export function validate<T>(input: unknown): IValidation<T>; // detailed
18
-
19
- // JSON FUNCTIONS
20
- export namespace json {
21
- export function application<T>(): IJsonApplication; // JSON schema
22
- export function assertParse<T>(input: string): T; // type safe parser
23
- export function assertStringify<T>(input: T): string; // safe and faster
24
- }
25
-
26
- // AI FUNCTION CALLING SCHEMA
27
- export namespace llm {
28
- // collection of function calling schemas
29
- export function application<Class, Model>(): ILlmApplication<Class>;
30
- export function controller<Class, Model>(
31
- name: string,
32
- execute: Class,
33
- ): ILlmController<Model>; // +executor
34
- // structured output
35
- export function parameters<P, Model>(): ILlmSchema.IParameters<Model>;
36
- export function schema<T, Model>(): ILlmSchema<Model>; // type schema
37
- }
38
-
39
- // PROTOCOL BUFFER
40
- export namespace protobuf {
41
- export function message<T>(): string; // Protocol Buffer message
42
- export function assertDecode<T>(buffer: Uint8Array): T; // safe decoder
43
- export function assertEncode<T>(input: T): Uint8Array; // safe encoder
44
- }
45
-
46
- // RANDOM GENERATOR
47
- export function random<T>(g?: Partial<IRandomGenerator>): T;
48
- ```
49
-
50
- `typia` is a transformer library supporting below features:
51
-
52
- - Super-fast Runtime Validators
53
- - Enhanced JSON schema and serde functions
54
- - LLM function calling schema and structured output
55
- - Protocol Buffer encoder and decoder
56
- - Random data generator
57
-
58
- > [!NOTE]
59
- >
60
- > - **Only one line** required, with pure TypeScript type
61
- > - Runtime validator is **20,000x faster** than `class-validator`
62
- > - JSON serialization is **200x faster** than `class-transformer`
63
-
64
-
65
-
66
-
67
- ## Transformation
68
- If you call `typia` function, it would be compiled like below.
69
-
70
- This is the key concept of `typia`, transforming TypeScript type to a runtime function. The `typia.is<T>()` function is transformed to a dedicated type checker by analyzing the target type `T` in the compilation level.
71
-
72
- This feature enables developers to ensure type safety in their applications, leveraging TypeScript's static typing while also providing runtime validation. Instead of defining additional schemas, you can simply utilize the pure TypeScript type itself.
73
-
74
- ```typescript
75
- //----
76
- // examples/checkString.ts
77
- //----
78
- import typia, { tags } from "typia";
79
- export const checkString = typia.createIs<string>();
80
-
81
- //----
82
- // examples/checkString.js
83
- //----
84
- import typia from "typia";
85
- export const checkString = (() => {
86
- return (input) => "string" === typeof input;
87
- })();
88
- ```
89
-
90
-
91
-
92
- ## Sponsors
93
- Thanks for your support.
94
-
95
- Your donation encourages `typia` development.
96
-
97
- Also, `typia` is re-distributing half of donations to core contributors of `typia`.
98
-
99
- - [`nonara/ts-patch`](https://github.com/nonara/ts-patch)
100
- - [`ryoppippi/unplugin-typia`](https://github.com/ryoppippi/unplugin-typia)
101
-
102
- [![Sponsors](https://opencollective.com/typia/badge.svg?avatarHeight=75&width=600)](https://opencollective.com/typia)
103
-
104
-
105
-
106
-
107
- ## Playground
108
- You can experience how typia works by [playground website](https://typia.io/playground):
109
-
110
- - 💻 https://typia.io/playground
111
-
112
-
113
-
114
-
115
- ## Guide Documents
116
- Check out the document in the [website](https://typia.io/docs/):
117
-
118
- ### 🏠 Home
119
- - [Introduction](https://typia.io/docs/)
120
- - [Setup](https://typia.io/docs/setup/)
121
- - [Pure TypeScript](https://typia.io/docs/pure/)
122
-
123
- ### 📖 Features
124
- - Runtime Validators
125
- - [`assert()` function](https://typia.io/docs/validators/assert/)
126
- - [`is()` function](https://typia.io/docs/validators/is/)
127
- - [`validate()` function](https://typia.io/docs/validators/validate/)
128
- - [Functional Module](https://typia.io/docs/validators/functional)
129
- - [Special Tags](https://typia.io/docs/validators/tags/)
130
- - Enhanced JSON
131
- - [JSON Schema](https://typia.io/docs/json/schema/)
132
- - [`stringify()` functions](https://typia.io/docs/json/stringify/)
133
- - [`parse()` functions](https://typia.io/docs/json/parse/)
134
- - LLM Function Calling
135
- - [`application()` function](https://typia.io/docs/llm/application/)
136
- - [`parameters()` function](https://typia.io/docs/llm/parameters/)
137
- - [`schema()` function](https://typia.io/docs/llm/schema/)
138
- - [AI Chatbot Development](https://typia.io/docs/llm/chat/)
139
- - [Documentation Strategy](https://typia.io/docs/llm/strategy/)
140
- - Protocol Buffer
141
- - [Message Schema](https://typia.io/docs/protobuf/message)
142
- - [`decode()` functions](https://typia.io/docs/protobuf/decode/)
143
- - [`encode()` functions](https://typia.io/docs/protobuf/encode/)
144
- - [Random Generator](https://typia.io/docs/random/)
145
- - [Miscellaneous](https://typia.io/docs/misc/)
146
-
147
- ### 🔗 Appendix
148
- - [API Documents](https://typia.io/api)
149
- - Utilization Cases
150
- - [NestJS](https://typia.io/docs/utilization/nestjs/)
151
- - [tRPC](https://typia.io/docs/utilization/trpc/)
152
- - [⇲ Benchmark Result](https://github.com/samchon/typia/tree/master/benchmark/results/11th%20Gen%20Intel(R)%20Core(TM)%20i5-1135G7%20%40%202.40GHz)
153
- - [⇲ `dev.to` Articles](https://dev.to/samchon/series/22474)
1
+ # Typia
2
+ ![Typia Logo](https://typia.io/logo.png)
3
+
4
+ [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/typia/blob/master/LICENSE)
5
+ [![NPM Version](https://img.shields.io/npm/v/typia.svg)](https://www.npmjs.com/package/typia)
6
+ [![NPM Downloads](https://img.shields.io/npm/dm/typia.svg)](https://www.npmjs.com/package/typia)
7
+ [![Build Status](https://github.com/samchon/typia/workflows/build/badge.svg)](https://github.com/samchon/typia/actions?query=workflow%3Abuild)
8
+ [![Guide Documents](https://img.shields.io/badge/Guide-Documents-forestgreen)](https://typia.io/docs/)
9
+ [![Gurubase](https://img.shields.io/badge/Gurubase-Document%20Chatbot-006BFF)](https://gurubase.io/g/typia)
10
+ [![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)
11
+
12
+ ```typescript
13
+ // RUNTIME VALIDATORS
14
+ export function is<T>(input: unknown): input is T; // returns boolean
15
+ export function assert<T>(input: unknown): T; // throws TypeGuardError
16
+ export function assertGuard<T>(input: unknown): asserts input is T;
17
+ export function validate<T>(input: unknown): IValidation<T>; // detailed
18
+
19
+ // JSON FUNCTIONS
20
+ export namespace json {
21
+ export function schema<T>(): IJsonSchemaUnit<T>; // JSON schema
22
+ export function assertParse<T>(input: string): T; // type safe parser
23
+ export function assertStringify<T>(input: T): string; // safe and faster
24
+ }
25
+
26
+ // AI FUNCTION CALLING SCHEMA
27
+ export namespace llm {
28
+ // collection of function calling schemas
29
+ export function application<Class, Model>(): ILlmApplication<Class>;
30
+ export function controller<Class, Model>(
31
+ name: string,
32
+ execute: Class,
33
+ ): ILlmController<Model>; // +executor
34
+ // structured output
35
+ export function parameters<P, Model>(): ILlmSchema.IParameters<Model>;
36
+ export function schema<T, Model>(
37
+ $defs: Record<string, ILlmSchema<Model>>,
38
+ ): ILlmSchema<Model>; // type schema
39
+ }
40
+
41
+ // PROTOCOL BUFFER
42
+ export namespace protobuf {
43
+ export function message<T>(): string; // Protocol Buffer message
44
+ export function assertDecode<T>(buffer: Uint8Array): T; // safe decoder
45
+ export function assertEncode<T>(input: T): Uint8Array; // safe encoder
46
+ }
47
+
48
+ // RANDOM GENERATOR
49
+ export function random<T>(g?: Partial<IRandomGenerator>): T;
50
+ ```
51
+
52
+ `typia` is a transformer library supporting below features:
53
+
54
+ - Super-fast Runtime Validators
55
+ - Enhanced JSON schema and serde functions
56
+ - LLM function calling schema and structured output
57
+ - Protocol Buffer encoder and decoder
58
+ - Random data generator
59
+
60
+ > [!NOTE]
61
+ >
62
+ > - **Only one line** required, with pure TypeScript type
63
+ > - Runtime validator is **20,000x faster** than `class-validator`
64
+ > - JSON serialization is **200x faster** than `class-transformer`
65
+
66
+
67
+
68
+
69
+ ## Transformation
70
+ If you call `typia` function, it would be compiled like below.
71
+
72
+ This is the key concept of `typia`, transforming TypeScript type to a runtime function. The `typia.is<T>()` function is transformed to a dedicated type checker by analyzing the target type `T` in the compilation level.
73
+
74
+ This feature enables developers to ensure type safety in their applications, leveraging TypeScript's static typing while also providing runtime validation. Instead of defining additional schemas, you can simply utilize the pure TypeScript type itself.
75
+
76
+ ```typescript
77
+ //----
78
+ // examples/checkString.ts
79
+ //----
80
+ import typia, { tags } from "typia";
81
+ export const checkString = typia.createIs<string>();
82
+
83
+ //----
84
+ // examples/checkString.js
85
+ //----
86
+ import typia from "typia";
87
+ export const checkString = (() => {
88
+ return (input) => "string" === typeof input;
89
+ })();
90
+ ```
91
+
92
+
93
+
94
+ ## Sponsors
95
+ Thanks for your support.
96
+
97
+ Your donation encourages `typia` development.
98
+
99
+ Also, `typia` is re-distributing half of donations to core contributors of `typia`.
100
+
101
+ - [`nonara/ts-patch`](https://github.com/nonara/ts-patch)
102
+ - [`ryoppippi/unplugin-typia`](https://github.com/ryoppippi/unplugin-typia)
103
+
104
+ [![Sponsors](https://opencollective.com/typia/badge.svg?avatarHeight=75&width=600)](https://opencollective.com/typia)
105
+
106
+
107
+
108
+
109
+ ## Playground
110
+ You can experience how typia works by [playground website](https://typia.io/playground):
111
+
112
+ - 💻 https://typia.io/playground
113
+
114
+
115
+
116
+
117
+ ## Guide Documents
118
+ Check out the document in the [website](https://typia.io/docs/):
119
+
120
+ ### 🏠 Home
121
+ - [Introduction](https://typia.io/docs/)
122
+ - [Setup](https://typia.io/docs/setup/)
123
+ - [Pure TypeScript](https://typia.io/docs/pure/)
124
+
125
+ ### 📖 Features
126
+ - Runtime Validators
127
+ - [`assert()` function](https://typia.io/docs/validators/assert/)
128
+ - [`is()` function](https://typia.io/docs/validators/is/)
129
+ - [`validate()` function](https://typia.io/docs/validators/validate/)
130
+ - [Functional Module](https://typia.io/docs/validators/functional)
131
+ - [Special Tags](https://typia.io/docs/validators/tags/)
132
+ - Enhanced JSON
133
+ - [JSON Schema](https://typia.io/docs/json/schema/)
134
+ - [`stringify()` functions](https://typia.io/docs/json/stringify/)
135
+ - [`parse()` functions](https://typia.io/docs/json/parse/)
136
+ - LLM Function Calling
137
+ - [`application()` function](https://typia.io/docs/llm/application/)
138
+ - [`parameters()` function](https://typia.io/docs/llm/parameters/)
139
+ - [`schema()` function](https://typia.io/docs/llm/schema/)
140
+ - [AI Chatbot Development](https://typia.io/docs/llm/chat/)
141
+ - [Documentation Strategy](https://typia.io/docs/llm/strategy/)
142
+ - Protocol Buffer
143
+ - [Message Schema](https://typia.io/docs/protobuf/message)
144
+ - [`decode()` functions](https://typia.io/docs/protobuf/decode/)
145
+ - [`encode()` functions](https://typia.io/docs/protobuf/encode/)
146
+ - [Random Generator](https://typia.io/docs/random/)
147
+ - [Miscellaneous](https://typia.io/docs/misc/)
148
+
149
+ ### 🔗 Appendix
150
+ - [API Documents](https://typia.io/api)
151
+ - Utilization Cases
152
+ - [NestJS](https://typia.io/docs/utilization/nestjs/)
153
+ - [tRPC](https://typia.io/docs/utilization/trpc/)
154
+ - [⇲ Benchmark Result](https://github.com/samchon/typia/tree/master/benchmark/results/11th%20Gen%20Intel(R)%20Core(TM)%20i5-1135G7%20%40%202.40GHz)
155
+ - [⇲ `dev.to` Articles](https://dev.to/samchon/series/22474)
package/lib/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import * as module from './module.mjs';
1
+ import * as module$1 from './module.mjs';
2
2
  export { assert, assertEquals, assertGuard, assertGuardEquals, createAssert, createAssertEquals, createAssertGuard, createAssertGuardEquals, createEquals, createIs, createRandom, createValidate, createValidateEquals, equals, is, random, validate, validateEquals } from './module.mjs';
3
3
  import * as functional from './functional.mjs';
4
4
  export { functional };
@@ -22,5 +22,5 @@ export { TypeGuardError } from './TypeGuardError.mjs';
22
22
 
23
23
 
24
24
 
25
- export { module as default };
25
+ export { module$1 as default };
26
26
  //# sourceMappingURL=index.mjs.map
package/lib/json.d.mts CHANGED
@@ -1,8 +1,47 @@
1
+ import { IJsonSchemaApplication } from "./schemas/json/IJsonSchemaApplication";
1
2
  import { IJsonSchemaCollection } from "./schemas/json/IJsonSchemaCollection";
2
3
  import { IJsonSchemaUnit } from "./schemas/json/IJsonSchemaUnit";
3
4
  import { IValidation } from "./IValidation";
4
5
  import { Primitive } from "./Primitive";
5
6
  import { TypeGuardError } from "./TypeGuardError";
7
+ /**
8
+ * > You must configure the generic argument `Type`.
9
+ *
10
+ * JSON schema generator.
11
+ *
12
+ * Creates a JSON schema unit which contains a main JSON schema and its
13
+ * components. Note that, all of the named types are stored in the
14
+ * {@link IJsonSchemaUnit.components} property for the `$ref` referencing.
15
+ *
16
+ * Also, you can specify the OpenAPI version by configuring the second generic
17
+ * argument `Version`. For reference, the default version is `"3.1"`, and key
18
+ * different of `"3.0"` and `"3.1"` is whether supporting the tuple type or
19
+ * not.
20
+ *
21
+ * @author Jeongho Nam - https://github.com/samchon
22
+ * @template Type Target type
23
+ * @template Version Version of OpenAPI specification. Default is 3.1
24
+ * @returns JSON schema unit
25
+ */
26
+ export declare function schema(): never;
27
+ /**
28
+ * JSON schema generator.
29
+ *
30
+ * Creates a JSON schema unit which contains a main JSON schema and its
31
+ * components. Note that, all of the named types are stored in the
32
+ * {@link IJsonSchemaUnit.components} property for the `$ref` referencing.
33
+ *
34
+ * Also, you can specify the OpenAPI version by configuring the second generic
35
+ * argument `Version`. For reference, the default version is `"3.1"`, and key
36
+ * different of `"3.0"` and `"3.1"` is whether supporting the tuple type or
37
+ * not.
38
+ *
39
+ * @author Jeongho Nam - https://github.com/samchon
40
+ * @template Type Target type
41
+ * @template Version Version of OpenAPI specification. Default is 3.1
42
+ * @returns JSON schema unit
43
+ */
44
+ export declare function schema<Type extends unknown, Version extends "3.0" | "3.1" = "3.1">(): IJsonSchemaUnit<Version, Type>;
6
45
  /**
7
46
  * > You must configure the generic argument `Types`.
8
47
  *
@@ -42,43 +81,91 @@ export declare function schemas(): never;
42
81
  */
43
82
  export declare function schemas<Types extends unknown[], Version extends "3.0" | "3.1" = "3.1">(): IJsonSchemaCollection<Version, Types>;
44
83
  /**
45
- * > You must configure the generic argument `Type`.
84
+ * > You must configure the generic argument `Class`.
46
85
  *
47
- * JSON schema generator.
86
+ * TypeScript class to JSON function schema application.
48
87
  *
49
- * Creates a JSON schema unit which contains a main JSON schema and its
50
- * components. Note that, all of the named types are stored in the
51
- * {@link IJsonSchemaUnit.components} property for the `$ref` referencing.
88
+ * Creates a JSON function schema application from a TypeScript class or
89
+ * interface type containing the target functions. This is an intermediate-level
90
+ * function designed for professional developers who want to build custom LLM
91
+ * function calling schemas or need to transform class methods into structured
92
+ * JSON schema representations.
93
+ *
94
+ * Unlike {@link schema} which creates a schema for a single type, this function
95
+ * analyzes an entire class/interface and generates JSON schemas for all its
96
+ * methods, their parameters, and return types. The returned
97
+ * {@link IJsonSchemaApplication} contains:
98
+ *
99
+ * - {@link IJsonSchemaApplication.functions}: Array of function metadata with
100
+ * parameter and return type schemas
101
+ * - {@link IJsonSchemaApplication.components}: Shared schema components for `$ref`
102
+ * referencing
103
+ *
104
+ * This function serves as the underlying implementation for
105
+ * {@link llm.application}, and can be used when you need to:
106
+ *
107
+ * - Create your own custom LLM function calling schema format
108
+ * - Transform class methods into structured JSON schema format
109
+ * - Build API documentation or code generation tools
110
+ * - Develop alternative LLM integrations beyond the built-in providers
111
+ *
112
+ * For direct LLM function calling implementations, consider using
113
+ * {@link llm.application} instead, which provides provider-specific schemas for
114
+ * ChatGPT, Claude, Gemini, and other LLM providers.
52
115
  *
53
116
  * Also, you can specify the OpenAPI version by configuring the second generic
54
- * argument `Version`. For reference, the default version is `"3.1"`, and key
55
- * different of `"3.0"` and `"3.1"` is whether supporting the tuple type or
56
- * not.
117
+ * argument `Version`. For reference, the default version is `"3.1"`, and the
118
+ * key difference between `"3.0"` and `"3.1"` is whether supporting the tuple
119
+ * type or not.
57
120
  *
58
121
  * @author Jeongho Nam - https://github.com/samchon
59
- * @template Type Target type
122
+ * @template Class Target class or interface type containing the functions
60
123
  * @template Version Version of OpenAPI specification. Default is 3.1
61
- * @returns JSON schema unit
124
+ * @returns JSON function schema application
62
125
  */
63
- export declare function schema(): never;
126
+ export declare function application(): never;
64
127
  /**
65
- * JSON schema generator.
128
+ * TypeScript class to JSON function schema application.
66
129
  *
67
- * Creates a JSON schema unit which contains a main JSON schema and its
68
- * components. Note that, all of the named types are stored in the
69
- * {@link IJsonSchemaUnit.components} property for the `$ref` referencing.
130
+ * Creates a JSON function schema application from a TypeScript class or
131
+ * interface type containing the target functions. This is an intermediate-level
132
+ * function designed for professional developers who want to build custom LLM
133
+ * function calling schemas or need to transform class methods into structured
134
+ * JSON schema representations.
135
+ *
136
+ * Unlike {@link schema} which creates a schema for a single type, this function
137
+ * analyzes an entire class/interface and generates JSON schemas for all its
138
+ * methods, their parameters, and return types. The returned
139
+ * {@link IJsonSchemaApplication} contains:
140
+ *
141
+ * - {@link IJsonSchemaApplication.functions}: Array of function metadata with
142
+ * parameter and return type schemas
143
+ * - {@link IJsonSchemaApplication.components}: Shared schema components for `$ref`
144
+ * referencing
145
+ *
146
+ * This function serves as the underlying implementation for
147
+ * {@link llm.application}, and can be used when you need to:
148
+ *
149
+ * - Create your own custom LLM function calling schema format
150
+ * - Transform class methods into structured JSON schema format
151
+ * - Build API documentation or code generation tools
152
+ * - Develop alternative LLM integrations beyond the built-in providers
153
+ *
154
+ * For direct LLM function calling implementations, consider using
155
+ * {@link llm.application} instead, which provides provider-specific schemas for
156
+ * ChatGPT, Claude, Gemini, and other LLM providers.
70
157
  *
71
158
  * Also, you can specify the OpenAPI version by configuring the second generic
72
- * argument `Version`. For reference, the default version is `"3.1"`, and key
73
- * different of `"3.0"` and `"3.1"` is whether supporting the tuple type or
74
- * not.
159
+ * argument `Version`. For reference, the default version is `"3.1"`, and the
160
+ * key difference between `"3.0"` and `"3.1"` is whether supporting the tuple
161
+ * type or not.
75
162
  *
76
163
  * @author Jeongho Nam - https://github.com/samchon
77
- * @template Type Target type
164
+ * @template Class Target class or interface type containing the functions
78
165
  * @template Version Version of OpenAPI specification. Default is 3.1
79
- * @returns JSON schema unit
166
+ * @returns JSON function schema application
80
167
  */
81
- export declare function schema<Type extends unknown, Version extends "3.0" | "3.1" = "3.1">(): IJsonSchemaUnit<Version, Type>;
168
+ export declare function application<Class extends object, Version extends "3.0" | "3.1" = "3.1">(): IJsonSchemaApplication<Version, Class>;
82
169
  /**
83
170
  * > You must configure the generic argument `T`.
84
171
  *