@typia/interface 12.0.0-dev.20260312-4 → 12.0.0-dev.20260313

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.
@@ -63,7 +63,7 @@ export declare namespace IJsonParseResult {
63
63
  * Contains whatever could be recovered from the malformed JSON. May be
64
64
  * incomplete or have missing properties.
65
65
  */
66
- data: DeepPartial<T>;
66
+ data: DeepPartial<T> | undefined;
67
67
  /**
68
68
  * The original input string that was parsed.
69
69
  *
@@ -117,6 +117,6 @@ export declare namespace IJsonParseResult {
117
117
  * @example
118
118
  * missing opening quote for 'hello'
119
119
  */
120
- value: unknown;
120
+ description: unknown;
121
121
  }
122
122
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typia/interface",
3
- "version": "12.0.0-dev.20260312-4",
3
+ "version": "12.0.0-dev.20260313",
4
4
  "description": "Superfast runtime validators with only one line",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
@@ -1,134 +1,134 @@
1
- import { DeepPartial } from "../typings/DeepPartial";
2
-
3
- /**
4
- * Result of lenient JSON parsing.
5
- *
6
- * `IJsonParseResult<T>` represents the result of parsing JSON that may be
7
- * incomplete, malformed, or contain non-standard syntax (e.g., unquoted keys,
8
- * trailing commas, missing quotes).
9
- *
10
- * Unlike standard JSON parsing which fails on any syntax error, lenient parsing
11
- * attempts to recover as much data as possible while reporting issues.
12
- *
13
- * Check the {@link IJsonParseResult.success} discriminator:
14
- *
15
- * - `true` → {@link IJsonParseResult.ISuccess} with parsed
16
- * {@link IJsonParseResult.ISuccess.data}
17
- * - `false` → {@link IJsonParseResult.IFailure} with partial
18
- * {@link IJsonParseResult.IFailure.data} and
19
- * {@link IJsonParseResult.IFailure.errors}
20
- *
21
- * @author Jeongho Nam - https://github.com/samchon
22
- * @template T The expected type after successful parsing
23
- */
24
- export type IJsonParseResult<T = unknown> =
25
- | IJsonParseResult.ISuccess<T>
26
- | IJsonParseResult.IFailure<T>;
27
-
28
- export namespace IJsonParseResult {
29
- /**
30
- * Successful parsing result.
31
- *
32
- * Indicates the JSON was parsed without any errors. The data may still have
33
- * been recovered from non-standard syntax (e.g., unquoted keys, trailing
34
- * commas), but no information was lost.
35
- *
36
- * @template T The parsed type
37
- */
38
- export interface ISuccess<T = unknown> {
39
- /**
40
- * Success discriminator.
41
- *
42
- * Always `true` for successful parsing.
43
- */
44
- success: true;
45
-
46
- /** The parsed data with correct type. */
47
- data: T;
48
- }
49
-
50
- /**
51
- * Failed parsing result with partial data and errors.
52
- *
53
- * Indicates the JSON had syntax errors that could not be fully recovered. The
54
- * {@link data} contains whatever could be parsed, and {@link errors} describes
55
- * what went wrong.
56
- *
57
- * @template T The expected type (data may be partial)
58
- */
59
- export interface IFailure<T = unknown> {
60
- /**
61
- * Success discriminator.
62
- *
63
- * Always `false` for failed parsing.
64
- */
65
- success: false;
66
-
67
- /**
68
- * Partially parsed data.
69
- *
70
- * Contains whatever could be recovered from the malformed JSON. May be
71
- * incomplete or have missing properties.
72
- */
73
- data: DeepPartial<T>;
74
-
75
- /**
76
- * The original input string that was parsed.
77
- *
78
- * Preserved for debugging or error correction purposes.
79
- */
80
- input: string;
81
-
82
- /**
83
- * Array of parsing errors encountered.
84
- *
85
- * Each error describes a specific issue found during parsing, with location
86
- * and suggested fix.
87
- */
88
- errors: IError[];
89
- }
90
-
91
- /** Detailed information about a parsing error. */
92
- export interface IError {
93
- /**
94
- * Property path to the error location.
95
- *
96
- * A dot-notation path from the root to the error location. Uses `$input` as
97
- * the root.
98
- *
99
- * @example
100
- * $input.user.email;
101
- *
102
- * @example
103
- * $input.items[0].price;
104
- */
105
- path: string;
106
-
107
- /**
108
- * What was expected at this location.
109
- *
110
- * @example
111
- * JSON value (string, number, boolean, null, object, or array)
112
- *
113
- * @example
114
- * quoted string
115
- *
116
- * @example
117
- * ":";
118
- */
119
- expected: string;
120
-
121
- /**
122
- * Description of what was actually found.
123
- *
124
- * Human/AI-readable message explaining the issue.
125
- *
126
- * @example
127
- * unquoted string 'abc' - did you forget quotes?
128
- *
129
- * @example
130
- * missing opening quote for 'hello'
131
- */
132
- value: unknown;
133
- }
134
- }
1
+ import { DeepPartial } from "../typings/DeepPartial";
2
+
3
+ /**
4
+ * Result of lenient JSON parsing.
5
+ *
6
+ * `IJsonParseResult<T>` represents the result of parsing JSON that may be
7
+ * incomplete, malformed, or contain non-standard syntax (e.g., unquoted keys,
8
+ * trailing commas, missing quotes).
9
+ *
10
+ * Unlike standard JSON parsing which fails on any syntax error, lenient parsing
11
+ * attempts to recover as much data as possible while reporting issues.
12
+ *
13
+ * Check the {@link IJsonParseResult.success} discriminator:
14
+ *
15
+ * - `true` → {@link IJsonParseResult.ISuccess} with parsed
16
+ * {@link IJsonParseResult.ISuccess.data}
17
+ * - `false` → {@link IJsonParseResult.IFailure} with partial
18
+ * {@link IJsonParseResult.IFailure.data} and
19
+ * {@link IJsonParseResult.IFailure.errors}
20
+ *
21
+ * @author Jeongho Nam - https://github.com/samchon
22
+ * @template T The expected type after successful parsing
23
+ */
24
+ export type IJsonParseResult<T = unknown> =
25
+ | IJsonParseResult.ISuccess<T>
26
+ | IJsonParseResult.IFailure<T>;
27
+
28
+ export namespace IJsonParseResult {
29
+ /**
30
+ * Successful parsing result.
31
+ *
32
+ * Indicates the JSON was parsed without any errors. The data may still have
33
+ * been recovered from non-standard syntax (e.g., unquoted keys, trailing
34
+ * commas), but no information was lost.
35
+ *
36
+ * @template T The parsed type
37
+ */
38
+ export interface ISuccess<T = unknown> {
39
+ /**
40
+ * Success discriminator.
41
+ *
42
+ * Always `true` for successful parsing.
43
+ */
44
+ success: true;
45
+
46
+ /** The parsed data with correct type. */
47
+ data: T;
48
+ }
49
+
50
+ /**
51
+ * Failed parsing result with partial data and errors.
52
+ *
53
+ * Indicates the JSON had syntax errors that could not be fully recovered. The
54
+ * {@link data} contains whatever could be parsed, and {@link errors} describes
55
+ * what went wrong.
56
+ *
57
+ * @template T The expected type (data may be partial)
58
+ */
59
+ export interface IFailure<T = unknown> {
60
+ /**
61
+ * Success discriminator.
62
+ *
63
+ * Always `false` for failed parsing.
64
+ */
65
+ success: false;
66
+
67
+ /**
68
+ * Partially parsed data.
69
+ *
70
+ * Contains whatever could be recovered from the malformed JSON. May be
71
+ * incomplete or have missing properties.
72
+ */
73
+ data: DeepPartial<T> | undefined;
74
+
75
+ /**
76
+ * The original input string that was parsed.
77
+ *
78
+ * Preserved for debugging or error correction purposes.
79
+ */
80
+ input: string;
81
+
82
+ /**
83
+ * Array of parsing errors encountered.
84
+ *
85
+ * Each error describes a specific issue found during parsing, with location
86
+ * and suggested fix.
87
+ */
88
+ errors: IError[];
89
+ }
90
+
91
+ /** Detailed information about a parsing error. */
92
+ export interface IError {
93
+ /**
94
+ * Property path to the error location.
95
+ *
96
+ * A dot-notation path from the root to the error location. Uses `$input` as
97
+ * the root.
98
+ *
99
+ * @example
100
+ * $input.user.email;
101
+ *
102
+ * @example
103
+ * $input.items[0].price;
104
+ */
105
+ path: string;
106
+
107
+ /**
108
+ * What was expected at this location.
109
+ *
110
+ * @example
111
+ * JSON value (string, number, boolean, null, object, or array)
112
+ *
113
+ * @example
114
+ * quoted string
115
+ *
116
+ * @example
117
+ * ":";
118
+ */
119
+ expected: string;
120
+
121
+ /**
122
+ * Description of what was actually found.
123
+ *
124
+ * Human/AI-readable message explaining the issue.
125
+ *
126
+ * @example
127
+ * unquoted string 'abc' - did you forget quotes?
128
+ *
129
+ * @example
130
+ * missing opening quote for 'hello'
131
+ */
132
+ description: unknown;
133
+ }
134
+ }
@@ -1,98 +1,98 @@
1
- import { ILlmFunction } from "./ILlmFunction";
2
- import { ILlmSchema } from "./ILlmSchema";
3
- import { IValidation } from "./IValidation";
4
-
5
- /**
6
- * LLM function calling application.
7
- *
8
- * `ILlmApplication` is a collection of {@link ILlmFunction} schemas generated
9
- * from a TypeScript class or interface by `typia.llm.application<App>()`. Each
10
- * public method becomes an {@link ILlmFunction} that LLM agents can invoke.
11
- *
12
- * Configure behavior via {@link ILlmApplication.IConfig}:
13
- *
14
- * - {@link ILlmApplication.IConfig.validate}: Custom validation per method
15
- * - {@link ILlmSchema.IConfig.strict}: OpenAI structured output mode
16
- *
17
- * @author Jeongho Nam - https://github.com/samchon
18
- * @template Class Source class/interface type
19
- */
20
- export interface ILlmApplication<Class extends object = any> {
21
- /**
22
- * Array of callable function schemas.
23
- *
24
- * Each function represents a method from the source class that the LLM can
25
- * invoke. Functions include parameter schemas, descriptions, and validation
26
- * logic for type-safe function calling.
27
- */
28
- functions: ILlmFunction[];
29
-
30
- /**
31
- * Configuration used to generate this application.
32
- *
33
- * Contains the settings that were applied during schema generation, including
34
- * strict mode and any custom validation hooks.
35
- */
36
- config: ILlmApplication.IConfig<Class>;
37
-
38
- /**
39
- * Phantom property for TypeScript generic type preservation.
40
- *
41
- * This property exists only in the type system to preserve the `Class`
42
- * generic parameter at compile time. It is always `undefined` at runtime and
43
- * should not be accessed or used in application code.
44
- *
45
- * This pattern enables type inference to recover the original class type from
46
- * an `ILlmApplication` instance, useful for type-safe function routing.
47
- */
48
- __class?: Class | undefined;
49
- }
50
- export namespace ILlmApplication {
51
- /**
52
- * Configuration for LLM application generation.
53
- *
54
- * Extends {@link ILlmSchema.IConfig} with application-specific options for
55
- * custom validation. These settings control how the application schema is
56
- * generated from the source class.
57
- */
58
- export interface IConfig<Class extends object = any>
59
- extends ILlmSchema.IConfig {
60
- /**
61
- * Custom validation functions per method name.
62
- *
63
- * Allows overriding the default type-based validation with custom business
64
- * logic. Useful for complex validation rules that cannot be expressed in
65
- * JSON Schema.
66
- *
67
- * @default null (use default type validation)
68
- */
69
- validate: null | Partial<ILlmApplication.IValidationHook<Class>>;
70
- }
71
-
72
- /**
73
- * Type-safe mapping of method names to custom validators.
74
- *
75
- * Maps each method name to a validation function that receives the raw input
76
- * and returns a validation result. The type inference ensures validators
77
- * match the expected argument types.
78
- *
79
- * @template Class - The source class type for type inference
80
- */
81
- export type IValidationHook<Class extends object> = {
82
- [K in keyof Class]?: Class[K] extends (args: infer Argument) => unknown
83
- ? (input: unknown) => IValidation<Argument>
84
- : never;
85
- };
86
-
87
- /**
88
- * Internal type for typia transformer.
89
- *
90
- * @ignore
91
- */
92
- export interface __IPrimitive<Class extends object = any> extends Omit<
93
- ILlmApplication<Class>,
94
- "config" | "functions"
95
- > {
96
- functions: Omit<ILlmFunction, "parse" | "coerce">[];
97
- }
98
- }
1
+ import { ILlmFunction } from "./ILlmFunction";
2
+ import { ILlmSchema } from "./ILlmSchema";
3
+ import { IValidation } from "./IValidation";
4
+
5
+ /**
6
+ * LLM function calling application.
7
+ *
8
+ * `ILlmApplication` is a collection of {@link ILlmFunction} schemas generated
9
+ * from a TypeScript class or interface by `typia.llm.application<App>()`. Each
10
+ * public method becomes an {@link ILlmFunction} that LLM agents can invoke.
11
+ *
12
+ * Configure behavior via {@link ILlmApplication.IConfig}:
13
+ *
14
+ * - {@link ILlmApplication.IConfig.validate}: Custom validation per method
15
+ * - {@link ILlmSchema.IConfig.strict}: OpenAI structured output mode
16
+ *
17
+ * @author Jeongho Nam - https://github.com/samchon
18
+ * @template Class Source class/interface type
19
+ */
20
+ export interface ILlmApplication<Class extends object = any> {
21
+ /**
22
+ * Array of callable function schemas.
23
+ *
24
+ * Each function represents a method from the source class that the LLM can
25
+ * invoke. Functions include parameter schemas, descriptions, and validation
26
+ * logic for type-safe function calling.
27
+ */
28
+ functions: ILlmFunction[];
29
+
30
+ /**
31
+ * Configuration used to generate this application.
32
+ *
33
+ * Contains the settings that were applied during schema generation, including
34
+ * strict mode and any custom validation hooks.
35
+ */
36
+ config: ILlmApplication.IConfig<Class>;
37
+
38
+ /**
39
+ * Phantom property for TypeScript generic type preservation.
40
+ *
41
+ * This property exists only in the type system to preserve the `Class`
42
+ * generic parameter at compile time. It is always `undefined` at runtime and
43
+ * should not be accessed or used in application code.
44
+ *
45
+ * This pattern enables type inference to recover the original class type from
46
+ * an `ILlmApplication` instance, useful for type-safe function routing.
47
+ */
48
+ __class?: Class | undefined;
49
+ }
50
+ export namespace ILlmApplication {
51
+ /**
52
+ * Configuration for LLM application generation.
53
+ *
54
+ * Extends {@link ILlmSchema.IConfig} with application-specific options for
55
+ * custom validation. These settings control how the application schema is
56
+ * generated from the source class.
57
+ */
58
+ export interface IConfig<Class extends object = any>
59
+ extends ILlmSchema.IConfig {
60
+ /**
61
+ * Custom validation functions per method name.
62
+ *
63
+ * Allows overriding the default type-based validation with custom business
64
+ * logic. Useful for complex validation rules that cannot be expressed in
65
+ * JSON Schema.
66
+ *
67
+ * @default null (use default type validation)
68
+ */
69
+ validate: null | Partial<ILlmApplication.IValidationHook<Class>>;
70
+ }
71
+
72
+ /**
73
+ * Type-safe mapping of method names to custom validators.
74
+ *
75
+ * Maps each method name to a validation function that receives the raw input
76
+ * and returns a validation result. The type inference ensures validators
77
+ * match the expected argument types.
78
+ *
79
+ * @template Class - The source class type for type inference
80
+ */
81
+ export type IValidationHook<Class extends object> = {
82
+ [K in keyof Class]?: Class[K] extends (args: infer Argument) => unknown
83
+ ? (input: unknown) => IValidation<Argument>
84
+ : never;
85
+ };
86
+
87
+ /**
88
+ * Internal type for typia transformer.
89
+ *
90
+ * @ignore
91
+ */
92
+ export interface __IPrimitive<Class extends object = any> extends Omit<
93
+ ILlmApplication<Class>,
94
+ "config" | "functions"
95
+ > {
96
+ functions: Omit<ILlmFunction, "parse" | "coerce">[];
97
+ }
98
+ }