typia 6.11.3 → 6.12.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.
Files changed (43) hide show
  1. package/lib/functional/Namespace/llm.d.ts +1 -1
  2. package/lib/functional/Namespace/llm.js +1 -0
  3. package/lib/functional/Namespace/llm.js.map +1 -1
  4. package/lib/index.mjs +1 -0
  5. package/lib/index.mjs.map +1 -1
  6. package/lib/llm.d.ts +2 -2
  7. package/lib/llm.js.map +1 -1
  8. package/lib/programmers/internal/application_array.js +9 -6
  9. package/lib/programmers/internal/application_array.js.map +1 -1
  10. package/lib/programmers/llm/LlmApplicationProgrammer.js +1 -0
  11. package/lib/programmers/llm/LlmApplicationProgrammer.js.map +1 -1
  12. package/lib/programmers/llm/LlmSchemaProgrammer.js +17 -10
  13. package/lib/programmers/llm/LlmSchemaProgrammer.js.map +1 -1
  14. package/package.json +2 -2
  15. package/src/functional/Namespace/llm.ts +2 -1
  16. package/src/llm.ts +4 -2
  17. package/src/programmers/internal/application_array.ts +8 -5
  18. package/src/programmers/llm/LlmApplicationProgrammer.ts +1 -0
  19. package/src/programmers/llm/LlmSchemaProgrammer.ts +22 -13
  20. package/lib/programmers/internal/llm_schema_array.d.ts +0 -1
  21. package/lib/programmers/internal/llm_schema_array.js +0 -20
  22. package/lib/programmers/internal/llm_schema_array.js.map +0 -1
  23. package/lib/programmers/internal/llm_schema_escaped.d.ts +0 -1
  24. package/lib/programmers/internal/llm_schema_escaped.js +0 -56
  25. package/lib/programmers/internal/llm_schema_escaped.js.map +0 -1
  26. package/lib/programmers/internal/llm_schema_native.d.ts +0 -1
  27. package/lib/programmers/internal/llm_schema_native.js +0 -19
  28. package/lib/programmers/internal/llm_schema_native.js.map +0 -1
  29. package/lib/programmers/internal/llm_schema_object.d.ts +0 -1
  30. package/lib/programmers/internal/llm_schema_object.js +0 -134
  31. package/lib/programmers/internal/llm_schema_object.js.map +0 -1
  32. package/lib/programmers/internal/llm_schema_station.d.ts +0 -1
  33. package/lib/programmers/internal/llm_schema_station.js +0 -238
  34. package/lib/programmers/internal/llm_schema_station.js.map +0 -1
  35. package/lib/programmers/internal/llm_schema_tuple.d.ts +0 -1
  36. package/lib/programmers/internal/llm_schema_tuple.js +0 -33
  37. package/lib/programmers/internal/llm_schema_tuple.js.map +0 -1
  38. package/src/programmers/internal/llm_schema_array.ts +0 -22
  39. package/src/programmers/internal/llm_schema_escaped.ts +0 -61
  40. package/src/programmers/internal/llm_schema_native.ts +0 -17
  41. package/src/programmers/internal/llm_schema_object.ts +0 -129
  42. package/src/programmers/internal/llm_schema_station.ts +0 -185
  43. package/src/programmers/internal/llm_schema_tuple.ts +0 -31
@@ -1,185 +0,0 @@
1
- import { ILlmSchema } from "@samchon/openapi";
2
-
3
- import { Metadata } from "../../schemas/metadata/Metadata";
4
- import { MetadataAtomic } from "../../schemas/metadata/MetadataAtomic";
5
-
6
- import { AtomicPredicator } from "../helpers/AtomicPredicator";
7
- import { application_bigint } from "./application_bigint";
8
- import { application_boolean } from "./application_boolean";
9
- import { application_number } from "./application_number";
10
- import { application_string } from "./application_string";
11
- import { application_templates } from "./application_templates";
12
- import { application_v30_constant } from "./application_v30_constant";
13
- import { llm_schema_array } from "./llm_schema_array";
14
- import { llm_schema_escaped } from "./llm_schema_escaped";
15
- import { llm_schema_native } from "./llm_schema_native";
16
- import { llm_schema_object } from "./llm_schema_object";
17
- import { llm_schema_tuple } from "./llm_schema_tuple";
18
-
19
- /**
20
- * @internal
21
- */
22
- export const llm_schema_station = (props: {
23
- metadata: Metadata;
24
- blockNever: boolean;
25
- attribute: ILlmSchema.__IAttribute;
26
- }): ILlmSchema => {
27
- // VULNERABLE CASE
28
- if (props.metadata.any === true)
29
- return {
30
- ...props.attribute,
31
- type: undefined,
32
- };
33
- else if (props.metadata.nullable === true && props.metadata.empty() === true)
34
- return {
35
- ...props.attribute,
36
- type: "null",
37
- };
38
-
39
- //----
40
- // GATHER UNION SCHEMAS
41
- //----
42
- const union: ILlmSchema[] = [];
43
- const insert = props.metadata.nullable
44
- ? (schema: ILlmSchema) =>
45
- union.push({
46
- ...schema,
47
- nullable: (schema as ILlmSchema.__ISignificant<any>).type
48
- ? true
49
- : undefined,
50
- } as ILlmSchema)
51
- : (schema: ILlmSchema) => union.push(schema);
52
-
53
- // toJSON() METHOD
54
- if (props.metadata.escaped !== null)
55
- llm_schema_escaped(props.metadata.escaped).forEach(insert);
56
-
57
- // ATOMIC TYPES
58
- if (
59
- props.metadata.templates.length &&
60
- AtomicPredicator.template(props.metadata)
61
- )
62
- application_templates<"3.0">(props.metadata).forEach(insert);
63
- for (const constant of props.metadata.constants)
64
- if (AtomicPredicator.constant(props.metadata)(constant.type) === false)
65
- continue;
66
- else insert(application_v30_constant(constant));
67
- for (const a of props.metadata.atomics)
68
- if (a.type === "boolean") application_boolean<"3.0">(a).forEach(insert);
69
- else if (a.type === "bigint") application_bigint<"3.0">(a).forEach(insert);
70
- else if (a.type === "number") application_number<"3.0">(a).forEach(insert);
71
- else if (a.type === "string") application_string<"3.0">(a).forEach(insert);
72
-
73
- // ARRAY
74
- for (const array of props.metadata.arrays)
75
- if (array.type.recursive)
76
- throw new Error(
77
- "Error on LlmSchemaProgrammer.write(): LLM schema does not allow recursive array type.",
78
- );
79
- else llm_schema_array(array).forEach(insert);
80
-
81
- // TUPLE
82
- for (const tuple of props.metadata.tuples)
83
- if (tuple.type.recursive)
84
- throw new Error(
85
- "Error on LlmSchemaProgrammer.write(): LLM schema does not allow recursive tuple type.",
86
- );
87
- else
88
- insert(
89
- llm_schema_tuple({
90
- tuple,
91
- attribute: props.attribute,
92
- }),
93
- );
94
-
95
- // NATIVES
96
- for (const native of props.metadata.natives)
97
- if (AtomicPredicator.native(native)) {
98
- const type: string = native.toLowerCase();
99
- if (props.metadata.atomics.some((a) => a.type === type)) continue;
100
- else if (type === "boolean")
101
- insert(
102
- application_boolean<"3.0">(
103
- MetadataAtomic.create({
104
- type: "boolean",
105
- tags: [],
106
- }),
107
- )[0]!,
108
- );
109
- else if (type === "bigint")
110
- insert(
111
- application_bigint(
112
- MetadataAtomic.create({
113
- type: "bigint",
114
- tags: [],
115
- }),
116
- )[0]!,
117
- );
118
- else if (type === "number")
119
- insert(
120
- application_number(
121
- MetadataAtomic.create({
122
- type: "number",
123
- tags: [],
124
- }),
125
- )[0]!,
126
- );
127
- else if (type === "string")
128
- insert(
129
- application_string(
130
- MetadataAtomic.create({
131
- type: "string",
132
- tags: [],
133
- }),
134
- )[0]!,
135
- );
136
- } else insert(llm_schema_native(native));
137
- if (props.metadata.sets.length) insert(llm_schema_native("Set"));
138
- if (props.metadata.maps.length) insert(llm_schema_native("Map"));
139
-
140
- // OBJECT
141
- for (const object of props.metadata.objects)
142
- if (object.recursive)
143
- throw new Error(
144
- "Error on LlmSchemaProgrammer.write(): LLM schema does not allow recursive object type.",
145
- );
146
- else
147
- insert(
148
- llm_schema_object({
149
- object,
150
- nullable: props.metadata.nullable,
151
- }),
152
- );
153
-
154
- // ALIASES
155
- for (const alias of props.metadata.aliases)
156
- if (alias.recursive)
157
- throw new Error(
158
- "Error on LlmSchemaProgrammer.write(): LLM schema does not allow recursive alias type.",
159
- );
160
- else
161
- insert(
162
- llm_schema_station({
163
- ...props,
164
- metadata: alias.value,
165
- }),
166
- );
167
-
168
- //----
169
- // RETURNS
170
- //----
171
- if (union.length === 0 && props.blockNever === true) return null!;
172
- const schema: ILlmSchema =
173
- union.length === 0
174
- ? { type: undefined }
175
- : union.length === 1
176
- ? union[0]!
177
- : { oneOf: union };
178
- return {
179
- ...schema,
180
- ...props.attribute,
181
- title: props.attribute.title ?? schema.title,
182
- description: props.attribute.description ?? schema.description,
183
- deprecated: props.attribute.deprecated ?? schema.deprecated,
184
- };
185
- };
@@ -1,31 +0,0 @@
1
- import { ILlmSchema } from "@samchon/openapi";
2
-
3
- import { Metadata } from "../../schemas/metadata/Metadata";
4
- import { MetadataTuple } from "../../schemas/metadata/MetadataTuple";
5
-
6
- import { llm_schema_station } from "./llm_schema_station";
7
-
8
- /**
9
- * @internal
10
- */
11
- export const llm_schema_tuple = (props: {
12
- tuple: MetadataTuple;
13
- attribute: ILlmSchema.__IAttribute;
14
- }): ILlmSchema.IArray => ({
15
- ...props.attribute,
16
- type: "array",
17
- items: llm_schema_station({
18
- blockNever: false,
19
- attribute: props.attribute,
20
- metadata: props.tuple.type.elements.reduce(
21
- (x, y) => Metadata.merge(x.rest ?? x, y.rest ?? y),
22
- Metadata.initialize(),
23
- ),
24
- }),
25
- minItems: !!props.tuple.type.elements.at(-1)?.rest
26
- ? props.tuple.type.elements.length - 1
27
- : props.tuple.type.elements.filter((x) => !x.optional).length,
28
- maxItems: !!props.tuple.type.elements.at(-1)?.rest
29
- ? undefined!
30
- : props.tuple.type.elements.length,
31
- });