typia 6.11.4 → 6.12.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.
- package/README.md +1 -0
- package/lib/executable/TypiaSetupWizard.js +8 -3
- package/lib/executable/TypiaSetupWizard.js.map +1 -1
- package/lib/executable/typia.js +17 -7
- package/lib/executable/typia.js.map +1 -1
- package/lib/functional/$FormDataReader/index.js +17 -7
- package/lib/functional/$FormDataReader/index.js.map +1 -1
- package/lib/functional/$HeadersReader/index.js +17 -7
- package/lib/functional/$HeadersReader/index.js.map +1 -1
- package/lib/functional/$ParameterReader/index.js +17 -7
- package/lib/functional/$ParameterReader/index.js.map +1 -1
- package/lib/functional/$QueryReader/index.js +17 -7
- package/lib/functional/$QueryReader/index.js.map +1 -1
- package/lib/functional/Namespace/index.js +17 -7
- package/lib/functional/Namespace/index.js.map +1 -1
- package/lib/functional/Namespace/llm.d.ts +1 -1
- package/lib/functional/Namespace/llm.js +1 -0
- package/lib/functional/Namespace/llm.js.map +1 -1
- package/lib/functional.js +17 -7
- package/lib/functional.js.map +1 -1
- package/lib/http.js +17 -7
- package/lib/http.js.map +1 -1
- package/lib/index.js +17 -7
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +1 -0
- package/lib/index.mjs.map +1 -1
- package/lib/json.js +17 -7
- package/lib/json.js.map +1 -1
- package/lib/llm.d.ts +2 -2
- package/lib/llm.js +17 -7
- package/lib/llm.js.map +1 -1
- package/lib/misc.js +17 -7
- package/lib/misc.js.map +1 -1
- package/lib/module.js +17 -7
- package/lib/module.js.map +1 -1
- package/lib/notations.js +17 -7
- package/lib/notations.js.map +1 -1
- package/lib/programmers/llm/LlmApplicationProgrammer.js +1 -0
- package/lib/programmers/llm/LlmApplicationProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmSchemaProgrammer.js +17 -10
- package/lib/programmers/llm/LlmSchemaProgrammer.js.map +1 -1
- package/lib/protobuf.js +17 -7
- package/lib/protobuf.js.map +1 -1
- package/lib/utils/NamingConvention/index.js +17 -7
- package/lib/utils/NamingConvention/index.js.map +1 -1
- package/lib/utils/RandomGenerator/index.js +17 -7
- package/lib/utils/RandomGenerator/index.js.map +1 -1
- package/lib/utils/StringUtil/index.js +17 -7
- package/lib/utils/StringUtil/index.js.map +1 -1
- package/package.json +4 -3
- package/src/executable/TypiaSetupWizard.ts +7 -2
- package/src/functional/Namespace/llm.ts +2 -1
- package/src/llm.ts +4 -2
- package/src/programmers/llm/LlmApplicationProgrammer.ts +1 -0
- package/src/programmers/llm/LlmSchemaProgrammer.ts +22 -13
- package/lib/programmers/internal/llm_schema_array.d.ts +0 -1
- package/lib/programmers/internal/llm_schema_array.js +0 -20
- package/lib/programmers/internal/llm_schema_array.js.map +0 -1
- package/lib/programmers/internal/llm_schema_escaped.d.ts +0 -1
- package/lib/programmers/internal/llm_schema_escaped.js +0 -56
- package/lib/programmers/internal/llm_schema_escaped.js.map +0 -1
- package/lib/programmers/internal/llm_schema_native.d.ts +0 -1
- package/lib/programmers/internal/llm_schema_native.js +0 -19
- package/lib/programmers/internal/llm_schema_native.js.map +0 -1
- package/lib/programmers/internal/llm_schema_object.d.ts +0 -1
- package/lib/programmers/internal/llm_schema_object.js +0 -134
- package/lib/programmers/internal/llm_schema_object.js.map +0 -1
- package/lib/programmers/internal/llm_schema_station.d.ts +0 -1
- package/lib/programmers/internal/llm_schema_station.js +0 -238
- package/lib/programmers/internal/llm_schema_station.js.map +0 -1
- package/lib/programmers/internal/llm_schema_tuple.d.ts +0 -1
- package/lib/programmers/internal/llm_schema_tuple.js +0 -33
- package/lib/programmers/internal/llm_schema_tuple.js.map +0 -1
- package/src/programmers/internal/llm_schema_array.ts +0 -22
- package/src/programmers/internal/llm_schema_escaped.ts +0 -61
- package/src/programmers/internal/llm_schema_native.ts +0 -17
- package/src/programmers/internal/llm_schema_object.ts +0 -129
- package/src/programmers/internal/llm_schema_station.ts +0 -185
- package/src/programmers/internal/llm_schema_tuple.ts +0 -31
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
|
|
3
|
-
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
4
|
-
import { MetadataEscaped } from "../../schemas/metadata/MetadataEscaped";
|
|
5
|
-
|
|
6
|
-
import { llm_schema_station } from "./llm_schema_station";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
export const llm_schema_escaped = (escaped: MetadataEscaped): ILlmSchema[] => {
|
|
12
|
-
const output: ILlmSchema | null = llm_schema_station({
|
|
13
|
-
metadata: escaped.returns,
|
|
14
|
-
blockNever: false,
|
|
15
|
-
attribute: {},
|
|
16
|
-
});
|
|
17
|
-
if (output === null) return [];
|
|
18
|
-
else if (is_date(new Set())(escaped.original)) {
|
|
19
|
-
const string: ILlmSchema.IString | undefined = is_string(output)
|
|
20
|
-
? output
|
|
21
|
-
: is_one_of(output)
|
|
22
|
-
? (output.oneOf.find(is_string) as ILlmSchema.IString)
|
|
23
|
-
: undefined;
|
|
24
|
-
if (
|
|
25
|
-
string !== undefined &&
|
|
26
|
-
string.format !== "date" &&
|
|
27
|
-
string.format !== "date-time"
|
|
28
|
-
)
|
|
29
|
-
string.format = "date-time";
|
|
30
|
-
}
|
|
31
|
-
return is_one_of(output) ? (output.oneOf as ILlmSchema[]) : [output];
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @internal
|
|
36
|
-
*/
|
|
37
|
-
const is_string = (elem: ILlmSchema): elem is ILlmSchema.IString =>
|
|
38
|
-
(elem as ILlmSchema.IString).type === "string";
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @internal
|
|
42
|
-
*/
|
|
43
|
-
const is_one_of = (elem: ILlmSchema): elem is ILlmSchema.IOneOf =>
|
|
44
|
-
Array.isArray((elem as ILlmSchema.IOneOf).oneOf);
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @internal
|
|
48
|
-
*/
|
|
49
|
-
const is_date =
|
|
50
|
-
(visited: Set<Metadata>) =>
|
|
51
|
-
(meta: Metadata): boolean => {
|
|
52
|
-
if (visited.has(meta)) return false;
|
|
53
|
-
visited.add(meta);
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
meta.natives.some((name) => name === "Date") ||
|
|
57
|
-
meta.arrays.some((array) => is_date(visited)(array.type.value)) ||
|
|
58
|
-
meta.tuples.some((tuple) => tuple.type.elements.some(is_date(visited))) ||
|
|
59
|
-
meta.aliases.some((alias) => is_date(visited)(alias.value))
|
|
60
|
-
);
|
|
61
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export const llm_schema_native = (
|
|
7
|
-
name: string,
|
|
8
|
-
): ILlmSchema.IString | ILlmSchema.IObject =>
|
|
9
|
-
name === "Blob" || name === "File"
|
|
10
|
-
? {
|
|
11
|
-
type: "string",
|
|
12
|
-
format: "binary",
|
|
13
|
-
}
|
|
14
|
-
: {
|
|
15
|
-
type: "object",
|
|
16
|
-
properties: {},
|
|
17
|
-
};
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
|
|
3
|
-
import { CommentFactory } from "../../factories/CommentFactory";
|
|
4
|
-
|
|
5
|
-
import { IJsDocTagInfo } from "../../schemas/metadata/IJsDocTagInfo";
|
|
6
|
-
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
7
|
-
import { MetadataObject } from "../../schemas/metadata/MetadataObject";
|
|
8
|
-
|
|
9
|
-
import { PatternUtil } from "../../utils/PatternUtil";
|
|
10
|
-
|
|
11
|
-
import { application_description } from "./application_description";
|
|
12
|
-
import { llm_schema_station } from "./llm_schema_station";
|
|
13
|
-
import { metadata_to_pattern } from "./metadata_to_pattern";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @internal
|
|
17
|
-
*/
|
|
18
|
-
export const llm_schema_object = (props: {
|
|
19
|
-
object: MetadataObject;
|
|
20
|
-
nullable: boolean;
|
|
21
|
-
}): ILlmSchema.IObject => {
|
|
22
|
-
// ITERATE PROPERTIES
|
|
23
|
-
const properties: Record<string, any> = {};
|
|
24
|
-
const extraMeta: ISuperfluous = {
|
|
25
|
-
patternProperties: {},
|
|
26
|
-
additionalProperties: undefined,
|
|
27
|
-
};
|
|
28
|
-
const required: string[] = [];
|
|
29
|
-
|
|
30
|
-
for (const property of props.object.properties) {
|
|
31
|
-
if (
|
|
32
|
-
// FUNCTIONAL TYPE
|
|
33
|
-
property.value.functions.length &&
|
|
34
|
-
property.value.nullable === false &&
|
|
35
|
-
property.value.isRequired() === true &&
|
|
36
|
-
property.value.size() === 0
|
|
37
|
-
)
|
|
38
|
-
continue;
|
|
39
|
-
else if (property.jsDocTags.find((tag) => tag.name === "hidden")) continue; // THE HIDDEN TAG
|
|
40
|
-
|
|
41
|
-
const key: string | null = property.key.getSoleLiteral();
|
|
42
|
-
const schema: ILlmSchema | null = llm_schema_station({
|
|
43
|
-
blockNever: true,
|
|
44
|
-
attribute: {
|
|
45
|
-
deprecated:
|
|
46
|
-
property.jsDocTags.some((tag) => tag.name === "deprecated") ||
|
|
47
|
-
undefined,
|
|
48
|
-
title: (() => {
|
|
49
|
-
const info: IJsDocTagInfo | undefined = property.jsDocTags.find(
|
|
50
|
-
(tag) => tag.name === "title",
|
|
51
|
-
);
|
|
52
|
-
if (info?.text?.length) return CommentFactory.merge(info.text);
|
|
53
|
-
else if (!property.description?.length) return undefined;
|
|
54
|
-
|
|
55
|
-
const index: number = property.description.indexOf("\n");
|
|
56
|
-
const top: string = (
|
|
57
|
-
index === -1
|
|
58
|
-
? property.description
|
|
59
|
-
: property.description.substring(0, index)
|
|
60
|
-
).trim();
|
|
61
|
-
return top.endsWith(".")
|
|
62
|
-
? top.substring(0, top.length - 1)
|
|
63
|
-
: undefined;
|
|
64
|
-
})(),
|
|
65
|
-
description: application_description(property),
|
|
66
|
-
},
|
|
67
|
-
metadata: property.value,
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
if (schema === null) continue;
|
|
71
|
-
if (key !== null) {
|
|
72
|
-
properties[key] = schema;
|
|
73
|
-
if (property.value.isRequired() === true) required.push(key);
|
|
74
|
-
} else {
|
|
75
|
-
const pattern: string = metadata_to_pattern(true)(property.key);
|
|
76
|
-
if (pattern === PatternUtil.STRING)
|
|
77
|
-
extraMeta.additionalProperties = [property.value, schema];
|
|
78
|
-
else extraMeta.patternProperties[pattern] = [property.value, schema];
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return {
|
|
83
|
-
type: "object",
|
|
84
|
-
properties,
|
|
85
|
-
nullable: props.nullable,
|
|
86
|
-
required: required.length ? required : undefined,
|
|
87
|
-
title: (() => {
|
|
88
|
-
const info: IJsDocTagInfo | undefined = props.object.jsDocTags.find(
|
|
89
|
-
(tag) => tag.name === "title",
|
|
90
|
-
);
|
|
91
|
-
return info?.text?.length ? CommentFactory.merge(info.text) : undefined;
|
|
92
|
-
})(),
|
|
93
|
-
description: application_description(props.object),
|
|
94
|
-
additionalProperties: join(extraMeta),
|
|
95
|
-
};
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* @internal
|
|
100
|
-
*/
|
|
101
|
-
const join = (extra: ISuperfluous): ILlmSchema | false => {
|
|
102
|
-
// LIST UP METADATA
|
|
103
|
-
const elements: [Metadata, ILlmSchema][] = Object.values(
|
|
104
|
-
extra.patternProperties || {},
|
|
105
|
-
);
|
|
106
|
-
if (extra.additionalProperties) elements.push(extra.additionalProperties);
|
|
107
|
-
|
|
108
|
-
// SHORT RETURN
|
|
109
|
-
if (elements.length === 0) return false;
|
|
110
|
-
else if (elements.length === 1) return elements[0]![1]!;
|
|
111
|
-
|
|
112
|
-
// MERGE METADATA AND GENERATE VULNERABLE SCHEMA
|
|
113
|
-
const meta: Metadata = elements
|
|
114
|
-
.map((tuple) => tuple[0])
|
|
115
|
-
.reduce((x, y) => Metadata.merge(x, y));
|
|
116
|
-
return llm_schema_station({
|
|
117
|
-
blockNever: true,
|
|
118
|
-
attribute: {},
|
|
119
|
-
metadata: meta,
|
|
120
|
-
});
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* @internal
|
|
125
|
-
*/
|
|
126
|
-
interface ISuperfluous {
|
|
127
|
-
additionalProperties?: undefined | [Metadata, ILlmSchema];
|
|
128
|
-
patternProperties: Record<string, [Metadata, ILlmSchema]>;
|
|
129
|
-
}
|
|
@@ -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
|
-
});
|