@typia/transform 12.0.0-dev.20260309 → 12.0.0-dev.20260310
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/package.json +4 -4
- package/src/CallExpressionTransformer.ts +579 -579
- package/src/FileTransformer.ts +143 -143
- package/src/ITransformProps.ts +20 -20
- package/src/ImportTransformer.ts +262 -262
- package/src/NodeTransformer.ts +25 -25
- package/src/TransformerError.ts +85 -85
- package/src/TypiaGenerator.ts +172 -172
- package/src/features/AssertTransformer.ts +24 -24
- package/src/features/CreateAssertTransformer.ts +24 -24
- package/src/features/CreateIsTransformer.ts +18 -18
- package/src/features/CreateRandomTransformer.ts +42 -42
- package/src/features/CreateValidateTransformer.ts +18 -18
- package/src/features/IsTransformer.ts +18 -18
- package/src/features/RandomTransformer.ts +40 -40
- package/src/features/ValidateTransformer.ts +18 -18
- package/src/features/functional/FunctionalGenericTransformer.ts +55 -55
- package/src/features/http/CreateHttpAssertFormDataTransformer.ts +13 -13
- package/src/features/http/CreateHttpAssertHeadersTransformer.ts +13 -13
- package/src/features/http/CreateHttpAssertQueryTransformer.ts +13 -13
- package/src/features/http/CreateHttpFormDataTransformer.ts +13 -13
- package/src/features/http/CreateHttpHeadersTransformer.ts +13 -13
- package/src/features/http/CreateHttpIsFormDataTransformer.ts +13 -13
- package/src/features/http/CreateHttpIsHeadersTransformer.ts +13 -13
- package/src/features/http/CreateHttpIsQueryTransformer.ts +13 -13
- package/src/features/http/CreateHttpParameterTransformer.ts +13 -13
- package/src/features/http/CreateHttpQueryTransformer.ts +13 -13
- package/src/features/http/CreateHttpValidateFormDataTransformer.ts +13 -13
- package/src/features/http/CreateHttpValidateHeadersTransformer.ts +13 -13
- package/src/features/http/CreateHttpValidateQueryTransformer.ts +13 -13
- package/src/features/http/HttpAssertFormDataTransformer.ts +13 -13
- package/src/features/http/HttpAssertHeadersTransformer.ts +13 -13
- package/src/features/http/HttpAssertQueryTransformer.ts +13 -13
- package/src/features/http/HttpFormDataTransformer.ts +13 -13
- package/src/features/http/HttpHeadersTransformer.ts +13 -13
- package/src/features/http/HttpIsFormDataTransformer.ts +13 -13
- package/src/features/http/HttpIsHeadersTransformer.ts +13 -13
- package/src/features/http/HttpIsQueryTransformer.ts +13 -13
- package/src/features/http/HttpParameterTransformer.ts +13 -13
- package/src/features/http/HttpQueryTransformer.ts +13 -13
- package/src/features/http/HttpValidateFormDataTransformer.ts +13 -13
- package/src/features/http/HttpValidateHeadersTransformer.ts +13 -13
- package/src/features/http/HttpValidateQueryTransformer.ts +13 -13
- package/src/features/json/JsonApplicationTransformer.ts +99 -99
- package/src/features/json/JsonAssertParseTransformer.ts +13 -13
- package/src/features/json/JsonAssertStringifyTransformer.ts +13 -13
- package/src/features/json/JsonCreateAssertParseTransformer.ts +13 -13
- package/src/features/json/JsonCreateAssertStringifyTransformer.ts +13 -13
- package/src/features/json/JsonCreateIsParseTransformer.ts +13 -13
- package/src/features/json/JsonCreateIsStringifyTransformer.ts +13 -13
- package/src/features/json/JsonCreateStringifyTransformer.ts +13 -13
- package/src/features/json/JsonCreateValidateParseTransformer.ts +13 -13
- package/src/features/json/JsonCreateValidateStringifyProgrammer.ts +13 -13
- package/src/features/json/JsonIsParseTransformer.ts +13 -13
- package/src/features/json/JsonIsStringifyTransformer.ts +13 -13
- package/src/features/json/JsonSchemaTransformer.ts +120 -120
- package/src/features/json/JsonSchemasTransformer.ts +130 -130
- package/src/features/json/JsonStringifyTransformer.ts +13 -13
- package/src/features/json/JsonValidateParseTransformer.ts +13 -13
- package/src/features/json/JsonValidateStringifyTransformer.ts +13 -13
- package/src/features/llm/LlmApplicationTransformer.ts +224 -224
- package/src/features/llm/LlmCoerceTransformer.ts +95 -95
- package/src/features/llm/LlmControllerTransformer.ts +81 -81
- package/src/features/llm/LlmCreateCoerceTransformer.ts +84 -84
- package/src/features/llm/LlmCreateParseTransformer.ts +84 -84
- package/src/features/llm/LlmParametersTransformer.ts +76 -76
- package/src/features/llm/LlmParseTransformer.ts +95 -95
- package/src/features/llm/LlmSchemaTransformer.ts +87 -87
- package/src/features/misc/MiscAssertCloneTransformer.ts +13 -13
- package/src/features/misc/MiscAssertPruneTransformer.ts +13 -13
- package/src/features/misc/MiscCloneTransformer.ts +13 -13
- package/src/features/misc/MiscCreateAssertCloneTransformer.ts +13 -13
- package/src/features/misc/MiscCreateAssertPruneTransformer.ts +13 -13
- package/src/features/misc/MiscCreateCloneTransformer.ts +13 -13
- package/src/features/misc/MiscCreateIsCloneTransformer.ts +13 -13
- package/src/features/misc/MiscCreateIsPruneTransformer.ts +13 -13
- package/src/features/misc/MiscCreatePruneTransformer.ts +13 -13
- package/src/features/misc/MiscCreateValidateCloneTransformer.ts +13 -13
- package/src/features/misc/MiscCreateValidatePruneTransformer.ts +13 -13
- package/src/features/misc/MiscIsCloneTransformer.ts +13 -13
- package/src/features/misc/MiscIsPruneTransformer.ts +13 -13
- package/src/features/misc/MiscLiteralsTransformer.ts +34 -34
- package/src/features/misc/MiscPruneTransformer.ts +13 -13
- package/src/features/misc/MiscValidateCloneTransformer.ts +13 -13
- package/src/features/misc/MiscValidatePruneTransformer.ts +13 -13
- package/src/features/notations/NotationAssertGeneralTransformer.ts +19 -19
- package/src/features/notations/NotationCreateAssertGeneralTransformer.ts +19 -19
- package/src/features/notations/NotationCreateGeneralTransformer.ts +19 -19
- package/src/features/notations/NotationCreateIsGeneralTransformer.ts +19 -19
- package/src/features/notations/NotationCreateValidateGeneralTransformer.ts +19 -19
- package/src/features/notations/NotationGeneralTransformer.ts +18 -18
- package/src/features/notations/NotationIsGeneralTransformer.ts +19 -19
- package/src/features/notations/NotationValidateGeneralTransformer.ts +19 -19
- package/src/features/protobuf/ProtobufAssertDecodeTransformer.ts +13 -13
- package/src/features/protobuf/ProtobufAssertEncodeTransformer.ts +13 -13
- package/src/features/protobuf/ProtobufCreateAssertDecodeTransformer.ts +13 -13
- package/src/features/protobuf/ProtobufCreateAssertEncodeTransformer.ts +13 -13
- package/src/features/protobuf/ProtobufCreateDecodeTransformer.ts +13 -13
- package/src/features/protobuf/ProtobufCreateEncodeTransformer.ts +13 -13
- package/src/features/protobuf/ProtobufCreateIsDecodeTransformer.ts +13 -13
- package/src/features/protobuf/ProtobufCreateIsEncodeTransformer.ts +13 -13
- package/src/features/protobuf/ProtobufCreateValidateDecodeTransformer.ts +13 -13
- package/src/features/protobuf/ProtobufCreateValidateEncodeTransformer.ts +13 -13
- package/src/features/protobuf/ProtobufDecodeTransformer.ts +13 -13
- package/src/features/protobuf/ProtobufEncodeTransformer.ts +13 -13
- package/src/features/protobuf/ProtobufIsDecodeTransformer.ts +13 -13
- package/src/features/protobuf/ProtobufIsEncodeTransformer.ts +13 -13
- package/src/features/protobuf/ProtobufMessageTransformer.ts +34 -34
- package/src/features/protobuf/ProtobufValidateDecodeTransformer.ts +13 -13
- package/src/features/protobuf/ProtobufValidateEncodeTransformer.ts +13 -13
- package/src/features/reflect/ReflectMetadataTransformer.ts +69 -69
- package/src/features/reflect/ReflectNameTransformer.ts +81 -81
- package/src/features/reflect/ReflectSchemaTransformer.ts +65 -65
- package/src/features/reflect/ReflectSchemasTransformer.ts +69 -69
- package/src/index.ts +7 -7
- package/src/internal/GenericTransformer.ts +101 -101
- package/src/transform.ts +68 -68
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LlmMetadataFactory,
|
|
3
|
-
LlmParseProgrammer,
|
|
4
|
-
MetadataCollection,
|
|
5
|
-
MetadataFactory,
|
|
6
|
-
MetadataSchema,
|
|
7
|
-
} from "@typia/core";
|
|
8
|
-
import { ILlmSchema, ValidationPipe } from "@typia/interface";
|
|
9
|
-
import ts from "typescript";
|
|
10
|
-
|
|
11
|
-
import { ITransformProps } from "../../ITransformProps";
|
|
12
|
-
import { TransformerError } from "../../TransformerError";
|
|
13
|
-
|
|
14
|
-
export namespace LlmParseTransformer {
|
|
15
|
-
export const transform = (props: ITransformProps): ts.Expression => {
|
|
16
|
-
// CHECK PARAMETER
|
|
17
|
-
if (props.expression.arguments.length === 0)
|
|
18
|
-
throw new TransformerError({
|
|
19
|
-
code: "typia.llm.parse",
|
|
20
|
-
message: "no input value.",
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
// GET GENERIC ARGUMENT
|
|
24
|
-
if (!props.expression.typeArguments?.length)
|
|
25
|
-
throw new TransformerError({
|
|
26
|
-
code: "typia.llm.parse",
|
|
27
|
-
message: "no generic argument.",
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const top: ts.Node = props.expression.typeArguments[0]!;
|
|
31
|
-
if (ts.isTypeNode(top) === false) return props.expression;
|
|
32
|
-
|
|
33
|
-
// GET TYPE AND CONFIG
|
|
34
|
-
const config: Partial<ILlmSchema.IConfig> = LlmMetadataFactory.getConfig({
|
|
35
|
-
context: props.context,
|
|
36
|
-
method: "parse",
|
|
37
|
-
node: props.expression.typeArguments[1],
|
|
38
|
-
}) as Partial<ILlmSchema.IConfig>;
|
|
39
|
-
|
|
40
|
-
const type: ts.Type = props.context.checker.getTypeFromTypeNode(top);
|
|
41
|
-
|
|
42
|
-
if (type.isTypeParameter())
|
|
43
|
-
throw new TransformerError({
|
|
44
|
-
code: "typia.llm.parse",
|
|
45
|
-
message: "non-specified generic argument.",
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// VALIDATE TYPE
|
|
49
|
-
const analyze = (validate: boolean): MetadataSchema => {
|
|
50
|
-
const result: ValidationPipe<MetadataSchema, MetadataFactory.IError> =
|
|
51
|
-
MetadataFactory.analyze({
|
|
52
|
-
checker: props.context.checker,
|
|
53
|
-
transformer: props.context.transformer,
|
|
54
|
-
options: {
|
|
55
|
-
absorb: validate,
|
|
56
|
-
escape: true,
|
|
57
|
-
constant: true,
|
|
58
|
-
validate:
|
|
59
|
-
validate === true
|
|
60
|
-
? (metadata, explore) =>
|
|
61
|
-
LlmParseProgrammer.validate({
|
|
62
|
-
config,
|
|
63
|
-
metadata,
|
|
64
|
-
explore,
|
|
65
|
-
})
|
|
66
|
-
: undefined,
|
|
67
|
-
},
|
|
68
|
-
components: new MetadataCollection({
|
|
69
|
-
replace: MetadataCollection.replace,
|
|
70
|
-
}),
|
|
71
|
-
type,
|
|
72
|
-
});
|
|
73
|
-
if (result.success === false)
|
|
74
|
-
throw TransformerError.from({
|
|
75
|
-
code: "typia.llm.parse",
|
|
76
|
-
errors: result.errors,
|
|
77
|
-
});
|
|
78
|
-
return result.data;
|
|
79
|
-
};
|
|
80
|
-
analyze(true);
|
|
81
|
-
|
|
82
|
-
// GENERATE CODE
|
|
83
|
-
return ts.factory.createCallExpression(
|
|
84
|
-
LlmParseProgrammer.write({
|
|
85
|
-
context: props.context,
|
|
86
|
-
modulo: props.modulo,
|
|
87
|
-
metadata: analyze(false),
|
|
88
|
-
name: (top as ts.TypeNode).getFullText().trim(),
|
|
89
|
-
config,
|
|
90
|
-
}),
|
|
91
|
-
undefined,
|
|
92
|
-
props.expression.arguments,
|
|
93
|
-
);
|
|
94
|
-
};
|
|
95
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
LlmMetadataFactory,
|
|
3
|
+
LlmParseProgrammer,
|
|
4
|
+
MetadataCollection,
|
|
5
|
+
MetadataFactory,
|
|
6
|
+
MetadataSchema,
|
|
7
|
+
} from "@typia/core";
|
|
8
|
+
import { ILlmSchema, ValidationPipe } from "@typia/interface";
|
|
9
|
+
import ts from "typescript";
|
|
10
|
+
|
|
11
|
+
import { ITransformProps } from "../../ITransformProps";
|
|
12
|
+
import { TransformerError } from "../../TransformerError";
|
|
13
|
+
|
|
14
|
+
export namespace LlmParseTransformer {
|
|
15
|
+
export const transform = (props: ITransformProps): ts.Expression => {
|
|
16
|
+
// CHECK PARAMETER
|
|
17
|
+
if (props.expression.arguments.length === 0)
|
|
18
|
+
throw new TransformerError({
|
|
19
|
+
code: "typia.llm.parse",
|
|
20
|
+
message: "no input value.",
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// GET GENERIC ARGUMENT
|
|
24
|
+
if (!props.expression.typeArguments?.length)
|
|
25
|
+
throw new TransformerError({
|
|
26
|
+
code: "typia.llm.parse",
|
|
27
|
+
message: "no generic argument.",
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const top: ts.Node = props.expression.typeArguments[0]!;
|
|
31
|
+
if (ts.isTypeNode(top) === false) return props.expression;
|
|
32
|
+
|
|
33
|
+
// GET TYPE AND CONFIG
|
|
34
|
+
const config: Partial<ILlmSchema.IConfig> = LlmMetadataFactory.getConfig({
|
|
35
|
+
context: props.context,
|
|
36
|
+
method: "parse",
|
|
37
|
+
node: props.expression.typeArguments[1],
|
|
38
|
+
}) as Partial<ILlmSchema.IConfig>;
|
|
39
|
+
|
|
40
|
+
const type: ts.Type = props.context.checker.getTypeFromTypeNode(top);
|
|
41
|
+
|
|
42
|
+
if (type.isTypeParameter())
|
|
43
|
+
throw new TransformerError({
|
|
44
|
+
code: "typia.llm.parse",
|
|
45
|
+
message: "non-specified generic argument.",
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// VALIDATE TYPE
|
|
49
|
+
const analyze = (validate: boolean): MetadataSchema => {
|
|
50
|
+
const result: ValidationPipe<MetadataSchema, MetadataFactory.IError> =
|
|
51
|
+
MetadataFactory.analyze({
|
|
52
|
+
checker: props.context.checker,
|
|
53
|
+
transformer: props.context.transformer,
|
|
54
|
+
options: {
|
|
55
|
+
absorb: validate,
|
|
56
|
+
escape: true,
|
|
57
|
+
constant: true,
|
|
58
|
+
validate:
|
|
59
|
+
validate === true
|
|
60
|
+
? (metadata, explore) =>
|
|
61
|
+
LlmParseProgrammer.validate({
|
|
62
|
+
config,
|
|
63
|
+
metadata,
|
|
64
|
+
explore,
|
|
65
|
+
})
|
|
66
|
+
: undefined,
|
|
67
|
+
},
|
|
68
|
+
components: new MetadataCollection({
|
|
69
|
+
replace: MetadataCollection.replace,
|
|
70
|
+
}),
|
|
71
|
+
type,
|
|
72
|
+
});
|
|
73
|
+
if (result.success === false)
|
|
74
|
+
throw TransformerError.from({
|
|
75
|
+
code: "typia.llm.parse",
|
|
76
|
+
errors: result.errors,
|
|
77
|
+
});
|
|
78
|
+
return result.data;
|
|
79
|
+
};
|
|
80
|
+
analyze(true);
|
|
81
|
+
|
|
82
|
+
// GENERATE CODE
|
|
83
|
+
return ts.factory.createCallExpression(
|
|
84
|
+
LlmParseProgrammer.write({
|
|
85
|
+
context: props.context,
|
|
86
|
+
modulo: props.modulo,
|
|
87
|
+
metadata: analyze(false),
|
|
88
|
+
name: (top as ts.TypeNode).getFullText().trim(),
|
|
89
|
+
config,
|
|
90
|
+
}),
|
|
91
|
+
undefined,
|
|
92
|
+
props.expression.arguments,
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
}
|
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LlmMetadataFactory,
|
|
3
|
-
LlmSchemaProgrammer,
|
|
4
|
-
MetadataCollection,
|
|
5
|
-
MetadataFactory,
|
|
6
|
-
MetadataSchema,
|
|
7
|
-
} from "@typia/core";
|
|
8
|
-
import { ILlmSchema, ValidationPipe } from "@typia/interface";
|
|
9
|
-
import ts from "typescript";
|
|
10
|
-
|
|
11
|
-
import { ITransformProps } from "../../ITransformProps";
|
|
12
|
-
import { TransformerError } from "../../TransformerError";
|
|
13
|
-
|
|
14
|
-
export namespace LlmSchemaTransformer {
|
|
15
|
-
export const transform = (props: ITransformProps): ts.Expression => {
|
|
16
|
-
// GET GENERIC ARGUMENT
|
|
17
|
-
if (!props.expression.typeArguments?.length)
|
|
18
|
-
throw new TransformerError({
|
|
19
|
-
code: "typia.llm.schema",
|
|
20
|
-
message: "no generic argument.",
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const top: ts.Node = props.expression.typeArguments[0]!;
|
|
24
|
-
if (ts.isTypeNode(top) === false) return props.expression;
|
|
25
|
-
|
|
26
|
-
// GET TYPE
|
|
27
|
-
const config: Partial<ILlmSchema.IConfig> = LlmMetadataFactory.getConfig({
|
|
28
|
-
context: props.context,
|
|
29
|
-
method: "schema",
|
|
30
|
-
node: props.expression.typeArguments[1],
|
|
31
|
-
}) as Partial<ILlmSchema.IConfig>;
|
|
32
|
-
|
|
33
|
-
const type: ts.Type = props.context.checker.getTypeFromTypeNode(top);
|
|
34
|
-
|
|
35
|
-
// VALIDATE TYPE
|
|
36
|
-
const analyze = (validate: boolean): MetadataSchema => {
|
|
37
|
-
const result: ValidationPipe<MetadataSchema, MetadataFactory.IError> =
|
|
38
|
-
MetadataFactory.analyze({
|
|
39
|
-
checker: props.context.checker,
|
|
40
|
-
transformer: props.context.transformer,
|
|
41
|
-
options: {
|
|
42
|
-
absorb: validate,
|
|
43
|
-
constant: true,
|
|
44
|
-
escape: true,
|
|
45
|
-
validate:
|
|
46
|
-
validate === true
|
|
47
|
-
? (metadata: MetadataSchema) =>
|
|
48
|
-
LlmSchemaProgrammer.validate({
|
|
49
|
-
config,
|
|
50
|
-
metadata,
|
|
51
|
-
})
|
|
52
|
-
: undefined,
|
|
53
|
-
},
|
|
54
|
-
components: new MetadataCollection({
|
|
55
|
-
replace: MetadataCollection.replace,
|
|
56
|
-
}),
|
|
57
|
-
type,
|
|
58
|
-
});
|
|
59
|
-
if (result.success === false)
|
|
60
|
-
throw TransformerError.from({
|
|
61
|
-
code: "typia.llm.schema",
|
|
62
|
-
errors: result.errors,
|
|
63
|
-
});
|
|
64
|
-
return result.data;
|
|
65
|
-
};
|
|
66
|
-
analyze(true);
|
|
67
|
-
|
|
68
|
-
// GENERATE LLM SCHEMA
|
|
69
|
-
const expr = LlmSchemaProgrammer.write({
|
|
70
|
-
context: props.context,
|
|
71
|
-
metadata: analyze(false),
|
|
72
|
-
config,
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// If user provided $defs argument and expression is a function, call it with $defs
|
|
76
|
-
if (
|
|
77
|
-
props.expression.arguments?.[0] !== undefined &&
|
|
78
|
-
ts.isArrowFunction(expr)
|
|
79
|
-
) {
|
|
80
|
-
return ts.factory.createCallExpression(expr, undefined, [
|
|
81
|
-
props.expression.arguments[0]!,
|
|
82
|
-
]);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return expr;
|
|
86
|
-
};
|
|
87
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
LlmMetadataFactory,
|
|
3
|
+
LlmSchemaProgrammer,
|
|
4
|
+
MetadataCollection,
|
|
5
|
+
MetadataFactory,
|
|
6
|
+
MetadataSchema,
|
|
7
|
+
} from "@typia/core";
|
|
8
|
+
import { ILlmSchema, ValidationPipe } from "@typia/interface";
|
|
9
|
+
import ts from "typescript";
|
|
10
|
+
|
|
11
|
+
import { ITransformProps } from "../../ITransformProps";
|
|
12
|
+
import { TransformerError } from "../../TransformerError";
|
|
13
|
+
|
|
14
|
+
export namespace LlmSchemaTransformer {
|
|
15
|
+
export const transform = (props: ITransformProps): ts.Expression => {
|
|
16
|
+
// GET GENERIC ARGUMENT
|
|
17
|
+
if (!props.expression.typeArguments?.length)
|
|
18
|
+
throw new TransformerError({
|
|
19
|
+
code: "typia.llm.schema",
|
|
20
|
+
message: "no generic argument.",
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const top: ts.Node = props.expression.typeArguments[0]!;
|
|
24
|
+
if (ts.isTypeNode(top) === false) return props.expression;
|
|
25
|
+
|
|
26
|
+
// GET TYPE
|
|
27
|
+
const config: Partial<ILlmSchema.IConfig> = LlmMetadataFactory.getConfig({
|
|
28
|
+
context: props.context,
|
|
29
|
+
method: "schema",
|
|
30
|
+
node: props.expression.typeArguments[1],
|
|
31
|
+
}) as Partial<ILlmSchema.IConfig>;
|
|
32
|
+
|
|
33
|
+
const type: ts.Type = props.context.checker.getTypeFromTypeNode(top);
|
|
34
|
+
|
|
35
|
+
// VALIDATE TYPE
|
|
36
|
+
const analyze = (validate: boolean): MetadataSchema => {
|
|
37
|
+
const result: ValidationPipe<MetadataSchema, MetadataFactory.IError> =
|
|
38
|
+
MetadataFactory.analyze({
|
|
39
|
+
checker: props.context.checker,
|
|
40
|
+
transformer: props.context.transformer,
|
|
41
|
+
options: {
|
|
42
|
+
absorb: validate,
|
|
43
|
+
constant: true,
|
|
44
|
+
escape: true,
|
|
45
|
+
validate:
|
|
46
|
+
validate === true
|
|
47
|
+
? (metadata: MetadataSchema) =>
|
|
48
|
+
LlmSchemaProgrammer.validate({
|
|
49
|
+
config,
|
|
50
|
+
metadata,
|
|
51
|
+
})
|
|
52
|
+
: undefined,
|
|
53
|
+
},
|
|
54
|
+
components: new MetadataCollection({
|
|
55
|
+
replace: MetadataCollection.replace,
|
|
56
|
+
}),
|
|
57
|
+
type,
|
|
58
|
+
});
|
|
59
|
+
if (result.success === false)
|
|
60
|
+
throw TransformerError.from({
|
|
61
|
+
code: "typia.llm.schema",
|
|
62
|
+
errors: result.errors,
|
|
63
|
+
});
|
|
64
|
+
return result.data;
|
|
65
|
+
};
|
|
66
|
+
analyze(true);
|
|
67
|
+
|
|
68
|
+
// GENERATE LLM SCHEMA
|
|
69
|
+
const expr = LlmSchemaProgrammer.write({
|
|
70
|
+
context: props.context,
|
|
71
|
+
metadata: analyze(false),
|
|
72
|
+
config,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// If user provided $defs argument and expression is a function, call it with $defs
|
|
76
|
+
if (
|
|
77
|
+
props.expression.arguments?.[0] !== undefined &&
|
|
78
|
+
ts.isArrowFunction(expr)
|
|
79
|
+
) {
|
|
80
|
+
return ts.factory.createCallExpression(expr, undefined, [
|
|
81
|
+
props.expression.arguments[0]!,
|
|
82
|
+
]);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return expr;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { MiscAssertCloneProgrammer } from "@typia/core";
|
|
2
|
-
|
|
3
|
-
import { ITransformProps } from "../../ITransformProps";
|
|
4
|
-
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
5
|
-
|
|
6
|
-
export namespace MiscAssertCloneTransformer {
|
|
7
|
-
export const transform = (props: ITransformProps) =>
|
|
8
|
-
GenericTransformer.scalar({
|
|
9
|
-
...props,
|
|
10
|
-
method: "misc.assertClone",
|
|
11
|
-
write: MiscAssertCloneProgrammer.write,
|
|
12
|
-
});
|
|
13
|
-
}
|
|
1
|
+
import { MiscAssertCloneProgrammer } from "@typia/core";
|
|
2
|
+
|
|
3
|
+
import { ITransformProps } from "../../ITransformProps";
|
|
4
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
5
|
+
|
|
6
|
+
export namespace MiscAssertCloneTransformer {
|
|
7
|
+
export const transform = (props: ITransformProps) =>
|
|
8
|
+
GenericTransformer.scalar({
|
|
9
|
+
...props,
|
|
10
|
+
method: "misc.assertClone",
|
|
11
|
+
write: MiscAssertCloneProgrammer.write,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { MiscAssertPruneProgrammer } from "@typia/core";
|
|
2
|
-
|
|
3
|
-
import { ITransformProps } from "../../ITransformProps";
|
|
4
|
-
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
5
|
-
|
|
6
|
-
export namespace MiscAssertPruneTransformer {
|
|
7
|
-
export const transform = (props: ITransformProps) =>
|
|
8
|
-
GenericTransformer.scalar({
|
|
9
|
-
...props,
|
|
10
|
-
method: "misc.assertPrune",
|
|
11
|
-
write: MiscAssertPruneProgrammer.write,
|
|
12
|
-
});
|
|
13
|
-
}
|
|
1
|
+
import { MiscAssertPruneProgrammer } from "@typia/core";
|
|
2
|
+
|
|
3
|
+
import { ITransformProps } from "../../ITransformProps";
|
|
4
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
5
|
+
|
|
6
|
+
export namespace MiscAssertPruneTransformer {
|
|
7
|
+
export const transform = (props: ITransformProps) =>
|
|
8
|
+
GenericTransformer.scalar({
|
|
9
|
+
...props,
|
|
10
|
+
method: "misc.assertPrune",
|
|
11
|
+
write: MiscAssertPruneProgrammer.write,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { MiscCloneProgrammer } from "@typia/core";
|
|
2
|
-
|
|
3
|
-
import { ITransformProps } from "../../ITransformProps";
|
|
4
|
-
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
5
|
-
|
|
6
|
-
export namespace MiscCloneTransformer {
|
|
7
|
-
export const transform = (props: ITransformProps) =>
|
|
8
|
-
GenericTransformer.scalar({
|
|
9
|
-
...props,
|
|
10
|
-
method: "misc.clone",
|
|
11
|
-
write: MiscCloneProgrammer.write,
|
|
12
|
-
});
|
|
13
|
-
}
|
|
1
|
+
import { MiscCloneProgrammer } from "@typia/core";
|
|
2
|
+
|
|
3
|
+
import { ITransformProps } from "../../ITransformProps";
|
|
4
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
5
|
+
|
|
6
|
+
export namespace MiscCloneTransformer {
|
|
7
|
+
export const transform = (props: ITransformProps) =>
|
|
8
|
+
GenericTransformer.scalar({
|
|
9
|
+
...props,
|
|
10
|
+
method: "misc.clone",
|
|
11
|
+
write: MiscCloneProgrammer.write,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { MiscAssertCloneProgrammer } from "@typia/core";
|
|
2
|
-
|
|
3
|
-
import { ITransformProps } from "../../ITransformProps";
|
|
4
|
-
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
5
|
-
|
|
6
|
-
export namespace MiscCreateAssertCloneTransformer {
|
|
7
|
-
export const transform = (props: ITransformProps) =>
|
|
8
|
-
GenericTransformer.factory({
|
|
9
|
-
...props,
|
|
10
|
-
method: "misc.createAssertClone",
|
|
11
|
-
write: MiscAssertCloneProgrammer.write,
|
|
12
|
-
});
|
|
13
|
-
}
|
|
1
|
+
import { MiscAssertCloneProgrammer } from "@typia/core";
|
|
2
|
+
|
|
3
|
+
import { ITransformProps } from "../../ITransformProps";
|
|
4
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
5
|
+
|
|
6
|
+
export namespace MiscCreateAssertCloneTransformer {
|
|
7
|
+
export const transform = (props: ITransformProps) =>
|
|
8
|
+
GenericTransformer.factory({
|
|
9
|
+
...props,
|
|
10
|
+
method: "misc.createAssertClone",
|
|
11
|
+
write: MiscAssertCloneProgrammer.write,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { MiscAssertPruneProgrammer } from "@typia/core";
|
|
2
|
-
|
|
3
|
-
import { ITransformProps } from "../../ITransformProps";
|
|
4
|
-
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
5
|
-
|
|
6
|
-
export namespace MiscCreateAssertPruneTransformer {
|
|
7
|
-
export const transform = (props: ITransformProps) =>
|
|
8
|
-
GenericTransformer.factory({
|
|
9
|
-
...props,
|
|
10
|
-
method: "misc.createAssertPrune",
|
|
11
|
-
write: MiscAssertPruneProgrammer.write,
|
|
12
|
-
});
|
|
13
|
-
}
|
|
1
|
+
import { MiscAssertPruneProgrammer } from "@typia/core";
|
|
2
|
+
|
|
3
|
+
import { ITransformProps } from "../../ITransformProps";
|
|
4
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
5
|
+
|
|
6
|
+
export namespace MiscCreateAssertPruneTransformer {
|
|
7
|
+
export const transform = (props: ITransformProps) =>
|
|
8
|
+
GenericTransformer.factory({
|
|
9
|
+
...props,
|
|
10
|
+
method: "misc.createAssertPrune",
|
|
11
|
+
write: MiscAssertPruneProgrammer.write,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { MiscCloneProgrammer } from "@typia/core";
|
|
2
|
-
|
|
3
|
-
import { ITransformProps } from "../../ITransformProps";
|
|
4
|
-
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
5
|
-
|
|
6
|
-
export namespace MiscCreateCloneTransformer {
|
|
7
|
-
export const transform = (props: ITransformProps) =>
|
|
8
|
-
GenericTransformer.factory({
|
|
9
|
-
...props,
|
|
10
|
-
method: "misc.createClone",
|
|
11
|
-
write: MiscCloneProgrammer.write,
|
|
12
|
-
});
|
|
13
|
-
}
|
|
1
|
+
import { MiscCloneProgrammer } from "@typia/core";
|
|
2
|
+
|
|
3
|
+
import { ITransformProps } from "../../ITransformProps";
|
|
4
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
5
|
+
|
|
6
|
+
export namespace MiscCreateCloneTransformer {
|
|
7
|
+
export const transform = (props: ITransformProps) =>
|
|
8
|
+
GenericTransformer.factory({
|
|
9
|
+
...props,
|
|
10
|
+
method: "misc.createClone",
|
|
11
|
+
write: MiscCloneProgrammer.write,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { MiscIsCloneProgrammer } from "@typia/core";
|
|
2
|
-
|
|
3
|
-
import { ITransformProps } from "../../ITransformProps";
|
|
4
|
-
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
5
|
-
|
|
6
|
-
export namespace MiscCreateIsCloneTransformer {
|
|
7
|
-
export const transform = (props: ITransformProps) =>
|
|
8
|
-
GenericTransformer.factory({
|
|
9
|
-
...props,
|
|
10
|
-
method: "misc.createIsClone",
|
|
11
|
-
write: MiscIsCloneProgrammer.write,
|
|
12
|
-
});
|
|
13
|
-
}
|
|
1
|
+
import { MiscIsCloneProgrammer } from "@typia/core";
|
|
2
|
+
|
|
3
|
+
import { ITransformProps } from "../../ITransformProps";
|
|
4
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
5
|
+
|
|
6
|
+
export namespace MiscCreateIsCloneTransformer {
|
|
7
|
+
export const transform = (props: ITransformProps) =>
|
|
8
|
+
GenericTransformer.factory({
|
|
9
|
+
...props,
|
|
10
|
+
method: "misc.createIsClone",
|
|
11
|
+
write: MiscIsCloneProgrammer.write,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { MiscIsPruneProgrammer } from "@typia/core";
|
|
2
|
-
|
|
3
|
-
import { ITransformProps } from "../../ITransformProps";
|
|
4
|
-
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
5
|
-
|
|
6
|
-
export namespace MiscCreateIsPruneTransformer {
|
|
7
|
-
export const transform = (props: ITransformProps) =>
|
|
8
|
-
GenericTransformer.factory({
|
|
9
|
-
...props,
|
|
10
|
-
method: "misc.createIsPrune",
|
|
11
|
-
write: MiscIsPruneProgrammer.write,
|
|
12
|
-
});
|
|
13
|
-
}
|
|
1
|
+
import { MiscIsPruneProgrammer } from "@typia/core";
|
|
2
|
+
|
|
3
|
+
import { ITransformProps } from "../../ITransformProps";
|
|
4
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
5
|
+
|
|
6
|
+
export namespace MiscCreateIsPruneTransformer {
|
|
7
|
+
export const transform = (props: ITransformProps) =>
|
|
8
|
+
GenericTransformer.factory({
|
|
9
|
+
...props,
|
|
10
|
+
method: "misc.createIsPrune",
|
|
11
|
+
write: MiscIsPruneProgrammer.write,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { MiscPruneProgrammer } from "@typia/core";
|
|
2
|
-
|
|
3
|
-
import { ITransformProps } from "../../ITransformProps";
|
|
4
|
-
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
5
|
-
|
|
6
|
-
export namespace MiscCreatePruneTransformer {
|
|
7
|
-
export const transform = (props: ITransformProps) =>
|
|
8
|
-
GenericTransformer.factory({
|
|
9
|
-
...props,
|
|
10
|
-
method: "misc.createPrune",
|
|
11
|
-
write: MiscPruneProgrammer.write,
|
|
12
|
-
});
|
|
13
|
-
}
|
|
1
|
+
import { MiscPruneProgrammer } from "@typia/core";
|
|
2
|
+
|
|
3
|
+
import { ITransformProps } from "../../ITransformProps";
|
|
4
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
5
|
+
|
|
6
|
+
export namespace MiscCreatePruneTransformer {
|
|
7
|
+
export const transform = (props: ITransformProps) =>
|
|
8
|
+
GenericTransformer.factory({
|
|
9
|
+
...props,
|
|
10
|
+
method: "misc.createPrune",
|
|
11
|
+
write: MiscPruneProgrammer.write,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { MiscValidateCloneProgrammer } from "@typia/core";
|
|
2
|
-
|
|
3
|
-
import { ITransformProps } from "../../ITransformProps";
|
|
4
|
-
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
5
|
-
|
|
6
|
-
export namespace MiscCreateValidateCloneTransformer {
|
|
7
|
-
export const transform = (props: ITransformProps) =>
|
|
8
|
-
GenericTransformer.factory({
|
|
9
|
-
...props,
|
|
10
|
-
method: "misc.createValidateClone",
|
|
11
|
-
write: MiscValidateCloneProgrammer.write,
|
|
12
|
-
});
|
|
13
|
-
}
|
|
1
|
+
import { MiscValidateCloneProgrammer } from "@typia/core";
|
|
2
|
+
|
|
3
|
+
import { ITransformProps } from "../../ITransformProps";
|
|
4
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
5
|
+
|
|
6
|
+
export namespace MiscCreateValidateCloneTransformer {
|
|
7
|
+
export const transform = (props: ITransformProps) =>
|
|
8
|
+
GenericTransformer.factory({
|
|
9
|
+
...props,
|
|
10
|
+
method: "misc.createValidateClone",
|
|
11
|
+
write: MiscValidateCloneProgrammer.write,
|
|
12
|
+
});
|
|
13
|
+
}
|