typia 7.0.0-dev.20241126 → 7.0.0-dev.20241127
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 +7 -3
- package/lib/executable/TypiaSetupWizard.js.map +1 -1
- package/lib/executable/typia.js +7 -17
- package/lib/executable/typia.js.map +1 -1
- package/lib/index.js +7 -17
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +3 -3
- package/lib/index.mjs.map +1 -1
- package/lib/internal/_llmApplicationFinalize.d.ts +2 -2
- package/lib/json.d.ts +31 -43
- package/lib/json.js +4 -4
- package/lib/json.js.map +1 -1
- package/lib/llm.d.ts +5 -5
- package/lib/llm.js.map +1 -1
- package/lib/module.js +7 -17
- package/lib/module.js.map +1 -1
- package/lib/programmers/ImportProgrammer.js +3 -1
- package/lib/programmers/ImportProgrammer.js.map +1 -1
- package/lib/programmers/json/JsonApplicationProgrammer.d.ts +2 -2
- package/lib/programmers/json/JsonApplicationProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmApplicationProgrammer.d.ts +3 -3
- package/lib/programmers/llm/LlmApplicationProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmParametersProgrammer.d.ts +4 -4
- package/lib/programmers/llm/LlmParametersProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmSchemaProgrammer.d.ts +6 -6
- package/lib/programmers/llm/LlmSchemaProgrammer.js.map +1 -1
- package/lib/schemas/json/IJsonApplication.d.ts +12 -35
- package/lib/schemas/json/IJsonApplication.js +55 -0
- package/lib/schemas/json/IJsonApplication.js.map +1 -1
- package/lib/schemas/json/IJsonSchemaCollection.d.ts +7 -0
- package/lib/schemas/json/__IJsonApplication.d.ts +35 -0
- package/lib/schemas/json/__IJsonApplication.js +3 -0
- package/lib/schemas/json/__IJsonApplication.js.map +1 -0
- package/lib/transformers/CallExpressionTransformer.js +3 -2
- package/lib/transformers/CallExpressionTransformer.js.map +1 -1
- package/lib/transformers/features/json/JsonApplicationTransformer.d.ts +0 -5
- package/lib/transformers/features/json/JsonApplicationTransformer.js +92 -85
- package/lib/transformers/features/json/JsonApplicationTransformer.js.map +1 -1
- package/lib/transformers/features/json/JsonSchemasTransformer.js +8 -1
- package/lib/transformers/features/json/JsonSchemasTransformer.js.map +1 -1
- package/lib/transformers/features/llm/LlmApplicationTransformer.js +9 -2
- package/lib/transformers/features/llm/LlmApplicationTransformer.js.map +1 -1
- package/lib/transformers/features/llm/LlmParametersTransformer.js +8 -1
- package/lib/transformers/features/llm/LlmParametersTransformer.js.map +1 -1
- package/lib/transformers/features/llm/LlmSchemaTransformer.js +17 -4
- package/lib/transformers/features/llm/LlmSchemaTransformer.js.map +1 -1
- package/package.json +3 -3
- package/src/executable/TypiaSetupWizard.ts +7 -2
- package/src/internal/_llmApplicationFinalize.ts +2 -2
- package/src/json.ts +82 -27
- package/src/llm.ts +8 -11
- package/src/programmers/ImportProgrammer.ts +3 -1
- package/src/programmers/json/JsonApplicationProgrammer.ts +13 -13
- package/src/programmers/llm/LlmApplicationProgrammer.ts +21 -21
- package/src/programmers/llm/LlmParametersProgrammer.ts +6 -6
- package/src/programmers/llm/LlmSchemaProgrammer.ts +9 -9
- package/src/schemas/json/IJsonApplication.ts +68 -56
- package/src/schemas/json/IJsonSchemaCollection.ts +7 -0
- package/src/schemas/json/__IJsonApplication.ts +63 -0
- package/src/transformers/CallExpressionTransformer.ts +3 -2
- package/src/transformers/features/json/JsonApplicationTransformer.ts +92 -92
- package/src/transformers/features/json/JsonSchemasTransformer.ts +16 -1
- package/src/transformers/features/llm/LlmApplicationTransformer.ts +28 -14
- package/src/transformers/features/llm/LlmParametersTransformer.ts +26 -12
- package/src/transformers/features/llm/LlmSchemaTransformer.ts +38 -16
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ILlmSchema } from "@samchon/openapi";
|
|
2
2
|
import { LlmSchemaConverter } from "@samchon/openapi/lib/converters/LlmSchemaConverter";
|
|
3
3
|
import { ILlmFunction } from "@samchon/openapi/lib/structures/ILlmFunction";
|
|
4
4
|
import ts from "typescript";
|
|
@@ -32,16 +32,15 @@ export namespace LlmParametersTransformer {
|
|
|
32
32
|
if (ts.isTypeNode(top) === false) return props.expression;
|
|
33
33
|
|
|
34
34
|
// GET MODEL
|
|
35
|
-
const model:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
})(props.expression.typeArguments[1]);
|
|
35
|
+
const model: ILlmSchema.Model = getTemplateArgument<ILlmSchema.Model>({
|
|
36
|
+
checker: props.context.checker,
|
|
37
|
+
name: "Model",
|
|
38
|
+
is: (value) =>
|
|
39
|
+
LlmSchemaConverter.defaultConfig(value as ILlmSchema.Model) !==
|
|
40
|
+
undefined,
|
|
41
|
+
cast: (value) => value as ILlmSchema.Model,
|
|
42
|
+
default: () => "3.1",
|
|
43
|
+
})(props.expression.typeArguments[1]);
|
|
45
44
|
|
|
46
45
|
// GET TYPE
|
|
47
46
|
const type: ts.Type = props.context.checker.getTypeFromTypeNode(top);
|
|
@@ -72,7 +71,22 @@ export namespace LlmParametersTransformer {
|
|
|
72
71
|
model,
|
|
73
72
|
metadata: result.data,
|
|
74
73
|
});
|
|
75
|
-
return
|
|
74
|
+
return ts.factory.createAsExpression(
|
|
75
|
+
LiteralFactory.write(out),
|
|
76
|
+
ts.factory.createTypeReferenceNode(
|
|
77
|
+
props.context.importer.instance({
|
|
78
|
+
name: "ILlmSchema",
|
|
79
|
+
file: "@samchon/openapi",
|
|
80
|
+
type: true,
|
|
81
|
+
alias: "__ILlmSchema",
|
|
82
|
+
}).text + ".IParameters",
|
|
83
|
+
[
|
|
84
|
+
ts.factory.createLiteralTypeNode(
|
|
85
|
+
ts.factory.createStringLiteral(model),
|
|
86
|
+
),
|
|
87
|
+
],
|
|
88
|
+
),
|
|
89
|
+
);
|
|
76
90
|
};
|
|
77
91
|
|
|
78
92
|
const getTemplateArgument =
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ILlmSchema } from "@samchon/openapi";
|
|
2
2
|
import { LlmSchemaConverter } from "@samchon/openapi/lib/converters/LlmSchemaConverter";
|
|
3
3
|
import ts from "typescript";
|
|
4
4
|
|
|
@@ -31,16 +31,15 @@ export namespace LlmSchemaTransformer {
|
|
|
31
31
|
if (ts.isTypeNode(top) === false) return props.expression;
|
|
32
32
|
|
|
33
33
|
// GET MODEL
|
|
34
|
-
const model:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
})(props.expression.typeArguments[1]);
|
|
34
|
+
const model: ILlmSchema.Model = getTemplateArgument<ILlmSchema.Model>({
|
|
35
|
+
checker: props.context.checker,
|
|
36
|
+
name: "Model",
|
|
37
|
+
is: (value) =>
|
|
38
|
+
LlmSchemaConverter.defaultConfig(value as ILlmSchema.Model) !==
|
|
39
|
+
undefined,
|
|
40
|
+
cast: (value) => value as ILlmSchema.Model,
|
|
41
|
+
default: () => "3.1",
|
|
42
|
+
})(props.expression.typeArguments[1]);
|
|
44
43
|
|
|
45
44
|
// GET TYPE
|
|
46
45
|
const type: ts.Type = props.context.checker.getTypeFromTypeNode(top);
|
|
@@ -71,8 +70,20 @@ export namespace LlmSchemaTransformer {
|
|
|
71
70
|
model,
|
|
72
71
|
metadata: result.data,
|
|
73
72
|
});
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
const schemaTypeNode = ts.factory.createTypeReferenceNode(
|
|
74
|
+
props.context.importer.instance({
|
|
75
|
+
name: "ILlmSchema",
|
|
76
|
+
file: "@samchon/openapi",
|
|
77
|
+
type: true,
|
|
78
|
+
alias: "__ILlmSchema",
|
|
79
|
+
}).text,
|
|
80
|
+
[ts.factory.createLiteralTypeNode(ts.factory.createStringLiteral(model))],
|
|
81
|
+
);
|
|
82
|
+
const literal = ts.factory.createAsExpression(
|
|
83
|
+
LiteralFactory.write(out.schema),
|
|
84
|
+
schemaTypeNode,
|
|
85
|
+
);
|
|
86
|
+
if (Object.keys(out.$defs).length === 0) return literal;
|
|
76
87
|
return ts.factory.createCallExpression(
|
|
77
88
|
ts.factory.createArrowFunction(
|
|
78
89
|
undefined,
|
|
@@ -80,7 +91,10 @@ export namespace LlmSchemaTransformer {
|
|
|
80
91
|
[
|
|
81
92
|
IdentifierFactory.parameter(
|
|
82
93
|
"$defs",
|
|
83
|
-
ts.factory.createTypeReferenceNode("Record
|
|
94
|
+
ts.factory.createTypeReferenceNode("Record", [
|
|
95
|
+
ts.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),
|
|
96
|
+
schemaTypeNode,
|
|
97
|
+
]),
|
|
84
98
|
undefined,
|
|
85
99
|
),
|
|
86
100
|
],
|
|
@@ -94,11 +108,19 @@ export namespace LlmSchemaTransformer {
|
|
|
94
108
|
undefined,
|
|
95
109
|
[
|
|
96
110
|
ts.factory.createIdentifier("$defs"),
|
|
97
|
-
|
|
111
|
+
ts.factory.createAsExpression(
|
|
112
|
+
LiteralFactory.write(out.$defs),
|
|
113
|
+
ts.factory.createTypeReferenceNode("Record", [
|
|
114
|
+
ts.factory.createKeywordTypeNode(
|
|
115
|
+
ts.SyntaxKind.StringKeyword,
|
|
116
|
+
),
|
|
117
|
+
schemaTypeNode,
|
|
118
|
+
]),
|
|
119
|
+
),
|
|
98
120
|
],
|
|
99
121
|
),
|
|
100
122
|
),
|
|
101
|
-
ts.factory.createReturnStatement(
|
|
123
|
+
ts.factory.createReturnStatement(literal),
|
|
102
124
|
],
|
|
103
125
|
true,
|
|
104
126
|
),
|