typia 13.0.0-dev.20260430 → 13.0.0-dev.20260502-2
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/lib/executable/TypiaGenerateWizard.js +55 -8
- package/lib/executable/TypiaGenerateWizard.js.map +1 -1
- package/lib/executable/TypiaGenerateWizard2.mjs +55 -8
- package/lib/executable/TypiaGenerateWizard2.mjs.map +1 -1
- package/lib/executable/generate/ttsc.js.map +1 -1
- package/lib/executable/setup/PluginConfigurator.js.map +1 -1
- package/lib/internal/_randomInteger.js.map +1 -1
- package/lib/internal/_validateReport.js.map +1 -1
- package/lib/transform.d.ts +2 -13
- package/lib/transform.js +4 -11
- package/lib/transform.js.map +1 -1
- package/lib/transform2.mjs +6 -14
- package/lib/transform2.mjs.map +1 -1
- package/native/adapter/adapter.go +128 -128
- package/native/adapter/cleanup.go +155 -172
- package/native/adapter/imports.go +80 -80
- package/native/adapter/visit.go +142 -142
- package/native/cmd/ttsc-typia/build.go +223 -223
- package/native/cmd/ttsc-typia/main.go +57 -57
- package/native/cmd/ttsc-typia/transform.go +421 -254
- package/native/cmd/ttsc-typia/transform_test.go +40 -0
- package/native/core/context/IProgrammerProps.go +7 -7
- package/native/core/context/ITransformOptions.go +5 -5
- package/native/core/context/ITypiaContext.go +13 -13
- package/native/core/context/TransformerError.go +81 -81
- package/native/core/factories/CommentFactory.go +9 -9
- package/native/core/factories/ExpressionFactory.go +254 -254
- package/native/core/factories/FormatCheatSheet.go +23 -23
- package/native/core/factories/IdentifierFactory.go +130 -130
- package/native/core/factories/JsonMetadataFactory.go +129 -129
- package/native/core/factories/LiteralFactory.go +195 -182
- package/native/core/factories/MetadataCommentTagFactory.go +379 -379
- package/native/core/factories/MetadataFactory.go +462 -462
- package/native/core/factories/MetadataTypeTagFactory.go +498 -498
- package/native/core/factories/MetadataTypeTagSchemaFactory.go +102 -102
- package/native/core/factories/NumericRangeFactory.go +84 -84
- package/native/core/factories/ProtobufFactory.go +933 -933
- package/native/core/factories/StatementFactory.go +72 -72
- package/native/core/factories/TemplateFactory.go +57 -57
- package/native/core/factories/TypeFactory.go +125 -125
- package/native/core/factories/ValueFactory.go +12 -12
- package/native/core/factories/internal/metadata/IMetadataIteratorProps.go +35 -35
- package/native/core/factories/internal/metadata/MetadataHelper.go +176 -176
- package/native/core/factories/internal/metadata/emend_metadata_atomics.go +69 -69
- package/native/core/factories/internal/metadata/emplace_metadata_alias.go +27 -27
- package/native/core/factories/internal/metadata/emplace_metadata_array_type.go +33 -33
- package/native/core/factories/internal/metadata/emplace_metadata_object.go +209 -209
- package/native/core/factories/internal/metadata/emplace_metadata_tuple.go +50 -50
- package/native/core/factories/internal/metadata/explore_metadata.go +29 -29
- package/native/core/factories/internal/metadata/iterate_metadata.go +46 -46
- package/native/core/factories/internal/metadata/iterate_metadata_alias.go +25 -25
- package/native/core/factories/internal/metadata/iterate_metadata_array.go +65 -65
- package/native/core/factories/internal/metadata/iterate_metadata_atomic.go +49 -49
- package/native/core/factories/internal/metadata/iterate_metadata_coalesce.go +22 -22
- package/native/core/factories/internal/metadata/iterate_metadata_collection.go +228 -228
- package/native/core/factories/internal/metadata/iterate_metadata_comment_tags.go +12 -12
- package/native/core/factories/internal/metadata/iterate_metadata_constant.go +71 -71
- package/native/core/factories/internal/metadata/iterate_metadata_escape.go +48 -48
- package/native/core/factories/internal/metadata/iterate_metadata_function.go +82 -82
- package/native/core/factories/internal/metadata/iterate_metadata_intersection.go +319 -319
- package/native/core/factories/internal/metadata/iterate_metadata_map.go +51 -51
- package/native/core/factories/internal/metadata/iterate_metadata_native.go +85 -85
- package/native/core/factories/internal/metadata/iterate_metadata_object.go +27 -27
- package/native/core/factories/internal/metadata/iterate_metadata_set.go +37 -37
- package/native/core/factories/internal/metadata/iterate_metadata_sort.go +137 -137
- package/native/core/factories/internal/metadata/iterate_metadata_template.go +33 -33
- package/native/core/factories/internal/metadata/iterate_metadata_tuple.go +16 -16
- package/native/core/factories/internal/metadata/iterate_metadata_union.go +18 -18
- package/native/core/programmers/AssertProgrammer.go +389 -389
- package/native/core/programmers/ImportProgrammer.go +196 -196
- package/native/core/programmers/IsProgrammer.go +293 -293
- package/native/core/programmers/RandomProgrammer.go +1094 -1094
- package/native/core/programmers/ValidateProgrammer.go +369 -369
- package/native/core/programmers/functional/FunctionalAssertFunctionProgrammer.go +133 -133
- package/native/core/programmers/functional/FunctionalAssertParametersProgrammer.go +104 -104
- package/native/core/programmers/functional/FunctionalAssertReturnProgrammer.go +100 -100
- package/native/core/programmers/functional/FunctionalIsFunctionProgrammer.go +79 -79
- package/native/core/programmers/functional/FunctionalIsParametersProgrammer.go +159 -159
- package/native/core/programmers/functional/FunctionalIsReturnProgrammer.go +99 -99
- package/native/core/programmers/functional/FunctionalValidateFunctionProgrammer.go +138 -138
- package/native/core/programmers/functional/FunctionalValidateParametersProgrammer.go +222 -222
- package/native/core/programmers/functional/FunctionalValidateReturnProgrammer.go +116 -116
- package/native/core/programmers/functional/internal/FunctionalGeneralProgrammer.go +36 -36
- package/native/core/programmers/helpers/AtomicPredicator.go +35 -35
- package/native/core/programmers/helpers/CloneJoiner.go +217 -217
- package/native/core/programmers/helpers/FunctionProgrammer.go +79 -79
- package/native/core/programmers/helpers/HttpMetadataUtil.go +17 -17
- package/native/core/programmers/helpers/ICheckEntry.go +5 -5
- package/native/core/programmers/helpers/IExpressionEntry.go +6 -6
- package/native/core/programmers/helpers/NotationJoiner.go +159 -159
- package/native/core/programmers/helpers/OptionPredicator.go +4 -4
- package/native/core/programmers/helpers/ProtobufUtil.go +231 -231
- package/native/core/programmers/helpers/ProtobufWire.go +6 -6
- package/native/core/programmers/helpers/PruneJoiner.go +227 -227
- package/native/core/programmers/helpers/RandomJoiner.go +155 -155
- package/native/core/programmers/helpers/StringifyJoinder.go +331 -331
- package/native/core/programmers/helpers/StringifyPredicator.go +10 -10
- package/native/core/programmers/helpers/UnionExplorer.go +835 -835
- package/native/core/programmers/helpers/UnionPredicator.go +78 -78
- package/native/core/programmers/helpers/disable_function_programmer_declare.go +6 -6
- package/native/core/programmers/http/HttpAssertFormDataProgrammer.go +93 -93
- package/native/core/programmers/http/HttpAssertHeadersProgrammer.go +42 -42
- package/native/core/programmers/http/HttpAssertQueryProgrammer.go +51 -51
- package/native/core/programmers/http/HttpFormDataProgrammer.go +351 -351
- package/native/core/programmers/http/HttpHeadersProgrammer.go +370 -370
- package/native/core/programmers/http/HttpIsFormDataProgrammer.go +109 -109
- package/native/core/programmers/http/HttpIsHeadersProgrammer.go +36 -36
- package/native/core/programmers/http/HttpIsQueryProgrammer.go +45 -45
- package/native/core/programmers/http/HttpParameterProgrammer.go +158 -158
- package/native/core/programmers/http/HttpQueryProgrammer.go +422 -422
- package/native/core/programmers/http/HttpValidateFormDataProgrammer.go +87 -87
- package/native/core/programmers/http/HttpValidateHeadersProgrammer.go +39 -39
- package/native/core/programmers/http/HttpValidateQueryProgrammer.go +48 -48
- package/native/core/programmers/internal/CheckerProgrammer.go +1490 -1490
- package/native/core/programmers/internal/FeatureProgrammer.go +589 -589
- package/native/core/programmers/iterate/check_array_length.go +46 -46
- package/native/core/programmers/iterate/check_bigint.go +52 -52
- package/native/core/programmers/iterate/check_dynamic_key.go +220 -220
- package/native/core/programmers/iterate/check_dynamic_properties.go +245 -245
- package/native/core/programmers/iterate/check_everything.go +21 -21
- package/native/core/programmers/iterate/check_native.go +25 -25
- package/native/core/programmers/iterate/check_number.go +135 -135
- package/native/core/programmers/iterate/check_object.go +66 -66
- package/native/core/programmers/iterate/check_string.go +52 -52
- package/native/core/programmers/iterate/check_template.go +57 -57
- package/native/core/programmers/iterate/check_union_array_like.go +372 -372
- package/native/core/programmers/iterate/decode_union_object.go +118 -118
- package/native/core/programmers/iterate/feature_object_entries.go +134 -134
- package/native/core/programmers/iterate/json_schema_alias.go +52 -52
- package/native/core/programmers/iterate/json_schema_array.go +52 -52
- package/native/core/programmers/iterate/json_schema_bigint.go +8 -8
- package/native/core/programmers/iterate/json_schema_boolean.go +8 -8
- package/native/core/programmers/iterate/json_schema_constant.go +38 -38
- package/native/core/programmers/iterate/json_schema_description.go +12 -12
- package/native/core/programmers/iterate/json_schema_discriminator.go +47 -47
- package/native/core/programmers/iterate/json_schema_escaped.go +58 -58
- package/native/core/programmers/iterate/json_schema_jsDocTags.go +34 -34
- package/native/core/programmers/iterate/json_schema_native.go +43 -43
- package/native/core/programmers/iterate/json_schema_number.go +8 -8
- package/native/core/programmers/iterate/json_schema_object.go +149 -149
- package/native/core/programmers/iterate/json_schema_plugin.go +35 -35
- package/native/core/programmers/iterate/json_schema_station.go +211 -211
- package/native/core/programmers/iterate/json_schema_string.go +8 -8
- package/native/core/programmers/iterate/json_schema_template.go +53 -53
- package/native/core/programmers/iterate/json_schema_title.go +16 -16
- package/native/core/programmers/iterate/json_schema_tuple.go +34 -34
- package/native/core/programmers/iterate/metadata_to_pattern.go +53 -53
- package/native/core/programmers/iterate/postfix_of_tuple.go +5 -5
- package/native/core/programmers/iterate/prune_object_properties.go +85 -85
- package/native/core/programmers/iterate/stringify_dynamic_properties.go +193 -193
- package/native/core/programmers/iterate/stringify_native.go +1 -1
- package/native/core/programmers/iterate/stringify_regular_properties.go +84 -84
- package/native/core/programmers/iterate/template_to_pattern.go +20 -20
- package/native/core/programmers/iterate/wrap_metadata_rest_tuple.go +13 -13
- package/native/core/programmers/json/JsonApplicationProgrammer.go +323 -323
- package/native/core/programmers/json/JsonAssertParseProgrammer.go +100 -100
- package/native/core/programmers/json/JsonAssertStringifyProgrammer.go +88 -88
- package/native/core/programmers/json/JsonIsParseProgrammer.go +130 -130
- package/native/core/programmers/json/JsonIsStringifyProgrammer.go +92 -92
- package/native/core/programmers/json/JsonSchemaProgrammer.go +65 -65
- package/native/core/programmers/json/JsonSchemasProgrammer.go +116 -116
- package/native/core/programmers/json/JsonStringifyProgrammer.go +1245 -1245
- package/native/core/programmers/json/JsonValidateParseProgrammer.go +89 -89
- package/native/core/programmers/json/JsonValidateStringifyProgrammer.go +106 -106
- package/native/core/programmers/llm/LlmApplicationProgrammer.go +449 -437
- package/native/core/programmers/llm/LlmCoerceProgrammer.go +79 -79
- package/native/core/programmers/llm/LlmControllerProgrammer.go +35 -35
- package/native/core/programmers/llm/LlmMetadataFactory.go +74 -74
- package/native/core/programmers/llm/LlmParametersProgrammer.go +105 -132
- package/native/core/programmers/llm/LlmParseProgrammer.go +88 -88
- package/native/core/programmers/llm/LlmSchemaProgrammer.go +780 -423
- package/native/core/programmers/llm/LlmStructuredOutputProgrammer.go +123 -123
- package/native/core/programmers/misc/MiscAssertCloneProgrammer.go +82 -82
- package/native/core/programmers/misc/MiscAssertPruneProgrammer.go +97 -97
- package/native/core/programmers/misc/MiscCloneProgrammer.go +1056 -1056
- package/native/core/programmers/misc/MiscIsCloneProgrammer.go +94 -94
- package/native/core/programmers/misc/MiscIsPruneProgrammer.go +86 -86
- package/native/core/programmers/misc/MiscLiteralsProgrammer.go +99 -99
- package/native/core/programmers/misc/MiscPruneProgrammer.go +700 -700
- package/native/core/programmers/misc/MiscValidateCloneProgrammer.go +103 -103
- package/native/core/programmers/misc/MiscValidatePruneProgrammer.go +94 -94
- package/native/core/programmers/notations/NotationAssertGeneralProgrammer.go +85 -85
- package/native/core/programmers/notations/NotationGeneralProgrammer.go +1188 -1188
- package/native/core/programmers/notations/NotationIsGeneralProgrammer.go +90 -90
- package/native/core/programmers/notations/NotationValidateGeneralProgrammer.go +109 -109
- package/native/core/programmers/protobuf/ProtobufAssertDecodeProgrammer.go +99 -99
- package/native/core/programmers/protobuf/ProtobufAssertEncodeProgrammer.go +114 -114
- package/native/core/programmers/protobuf/ProtobufDecodeProgrammer.go +697 -697
- package/native/core/programmers/protobuf/ProtobufEncodeProgrammer.go +1039 -1039
- package/native/core/programmers/protobuf/ProtobufIsDecodeProgrammer.go +99 -99
- package/native/core/programmers/protobuf/ProtobufIsEncodeProgrammer.go +93 -93
- package/native/core/programmers/protobuf/ProtobufMessageProgrammer.go +228 -228
- package/native/core/programmers/protobuf/ProtobufValidateDecodeProgrammer.go +88 -88
- package/native/core/programmers/protobuf/ProtobufValidateEncodeProgrammer.go +120 -120
- package/native/core/schemas/metadata/IMetadataDictionary.go +4 -4
- package/native/core/schemas/metadata/MetadataAlias.go +15 -15
- package/native/core/schemas/metadata/MetadataAliasType.go +36 -36
- package/native/core/schemas/metadata/MetadataApplication.go +25 -25
- package/native/core/schemas/metadata/MetadataArray.go +15 -15
- package/native/core/schemas/metadata/MetadataArrayType.go +31 -31
- package/native/core/schemas/metadata/MetadataAtomic.go +45 -45
- package/native/core/schemas/metadata/MetadataCollection.go +380 -380
- package/native/core/schemas/metadata/MetadataComponents.go +95 -95
- package/native/core/schemas/metadata/MetadataConstant.go +31 -31
- package/native/core/schemas/metadata/MetadataConstantValue.go +63 -63
- package/native/core/schemas/metadata/MetadataEscaped.go +17 -17
- package/native/core/schemas/metadata/MetadataFunction.go +30 -30
- package/native/core/schemas/metadata/MetadataMap.go +21 -21
- package/native/core/schemas/metadata/MetadataNative.go +48 -48
- package/native/core/schemas/metadata/MetadataObject.go +15 -15
- package/native/core/schemas/metadata/MetadataObjectType.go +116 -116
- package/native/core/schemas/metadata/MetadataParameter.go +28 -28
- package/native/core/schemas/metadata/MetadataProperty.go +32 -32
- package/native/core/schemas/metadata/MetadataSchema.go +766 -766
- package/native/core/schemas/metadata/MetadataSet.go +17 -17
- package/native/core/schemas/metadata/MetadataTemplate.go +43 -43
- package/native/core/schemas/metadata/MetadataTuple.go +10 -10
- package/native/core/schemas/metadata/MetadataTupleType.go +38 -38
- package/native/core/schemas/protobuf/IProtobufProperty.go +2 -2
- package/native/core/schemas/protobuf/IProtobufPropertyType.go +18 -18
- package/native/core/schemas/protobuf/IProtobufSchema.go +17 -17
- package/native/core/typings/Writable.go +1 -1
- package/native/core/utils/PatternUtil.go +38 -38
- package/native/core/utils/ProtobufNameEncoder.go +28 -28
- package/native/shim/printer/shim.go +213 -213
- package/native/third_party/ttsc/driver/host.go +7 -7
- package/native/third_party/ttsc/driver/program.go +275 -275
- package/native/third_party/ttsc/driver/rewrite.go +219 -219
- package/native/third_party/ttsc/shim/ast/lint.go +171 -171
- package/native/third_party/ttsc/shim/ast/shim.go +83 -83
- package/native/third_party/ttsc/shim/bundled/shim.go +5 -1
- package/native/third_party/ttsc/shim/checker/shim.go +79 -79
- package/native/third_party/ttsc/shim/compiler/shim.go +16 -1
- package/native/third_party/ttsc/shim/core/shim.go +10 -10
- package/native/third_party/ttsc/shim/diagnosticwriter/lint.go +79 -79
- package/native/third_party/ttsc/shim/diagnosticwriter/shim.go +19 -19
- package/native/third_party/ttsc/shim/parser/shim.go +7 -1
- package/native/third_party/ttsc/shim/scanner/shim.go +39 -1
- package/native/third_party/ttsc/shim/tsoptions/shim.go +51 -1
- package/native/third_party/ttsc/shim/tspath/shim.go +72 -1
- package/native/third_party/ttsc/shim/vfs/cachedvfs/shim.go +1 -1
- package/native/third_party/ttsc/shim/vfs/osvfs/shim.go +1 -1
- package/native/third_party/ttsc/shim/vfs/shim.go +4 -1
- package/native/transform/CallExpressionTransformer.go +556 -556
- package/native/transform/FileTransformer.go +123 -123
- package/native/transform/ImportTransformer.go +224 -224
- package/native/transform/NodeTransformer.go +11 -11
- package/native/transform/TypiaGenerator.go +136 -136
- package/native/transform/features/AssertTransformer.go +28 -28
- package/native/transform/features/CreateAssertTransformer.go +28 -28
- package/native/transform/features/CreateIsTransformer.go +24 -24
- package/native/transform/features/CreateRandomTransformer.go +35 -35
- package/native/transform/features/CreateValidateTransformer.go +24 -24
- package/native/transform/features/IsTransformer.go +24 -24
- package/native/transform/features/RandomTransformer.go +37 -37
- package/native/transform/features/ValidateTransformer.go +24 -24
- package/native/transform/features/functional/FunctionalGenericTransformer.go +48 -48
- package/native/transform/features/http/CreateHttpAssertFormDataTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpAssertHeadersTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpAssertQueryTransformer.go +17 -17
- package/native/transform/features/http/CreateHttpFormDataTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpHeadersTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpIsFormDataTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpIsHeadersTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpIsQueryTransformer.go +17 -17
- package/native/transform/features/http/CreateHttpParameterTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpQueryTransformer.go +17 -17
- package/native/transform/features/http/CreateHttpValidateFormDataTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpValidateHeadersTransformer.go +11 -11
- package/native/transform/features/http/CreateHttpValidateQueryTransformer.go +17 -17
- package/native/transform/features/http/HttpAssertFormDataTransformer.go +11 -11
- package/native/transform/features/http/HttpAssertHeadersTransformer.go +11 -11
- package/native/transform/features/http/HttpAssertQueryTransformer.go +17 -17
- package/native/transform/features/http/HttpFormDataTransformer.go +11 -11
- package/native/transform/features/http/HttpHeadersTransformer.go +11 -11
- package/native/transform/features/http/HttpIsFormDataTransformer.go +11 -11
- package/native/transform/features/http/HttpIsHeadersTransformer.go +11 -11
- package/native/transform/features/http/HttpIsQueryTransformer.go +17 -17
- package/native/transform/features/http/HttpParameterTransformer.go +11 -11
- package/native/transform/features/http/HttpQueryTransformer.go +17 -17
- package/native/transform/features/http/HttpValidateFormDataTransformer.go +11 -11
- package/native/transform/features/http/HttpValidateHeadersTransformer.go +11 -11
- package/native/transform/features/http/HttpValidateQueryTransformer.go +17 -17
- package/native/transform/features/json/JsonApplicationTransformer.go +61 -61
- package/native/transform/features/json/JsonAssertParseTransformer.go +11 -11
- package/native/transform/features/json/JsonAssertStringifyTransformer.go +11 -11
- package/native/transform/features/json/JsonCreateAssertParseTransformer.go +11 -11
- package/native/transform/features/json/JsonCreateAssertStringifyTransformer.go +11 -11
- package/native/transform/features/json/JsonCreateIsParseTransformer.go +11 -11
- package/native/transform/features/json/JsonCreateIsStringifyTransformer.go +11 -11
- package/native/transform/features/json/JsonCreateStringifyTransformer.go +11 -11
- package/native/transform/features/json/JsonCreateValidateParseTransformer.go +11 -11
- package/native/transform/features/json/JsonCreateValidateStringifyProgrammer.go +11 -11
- package/native/transform/features/json/JsonIsParseTransformer.go +11 -11
- package/native/transform/features/json/JsonIsStringifyTransformer.go +11 -11
- package/native/transform/features/json/JsonSchemaTransformer.go +148 -148
- package/native/transform/features/json/JsonSchemasTransformer.go +94 -94
- package/native/transform/features/json/JsonStringifyTransformer.go +11 -11
- package/native/transform/features/json/JsonValidateParseTransformer.go +11 -11
- package/native/transform/features/json/JsonValidateStringifyTransformer.go +11 -11
- package/native/transform/features/llm/LlmApplicationTransformer.go +43 -43
- package/native/transform/features/llm/LlmCoerceTransformer.go +50 -50
- package/native/transform/features/llm/LlmControllerTransformer.go +48 -48
- package/native/transform/features/llm/LlmCreateCoerceTransformer.go +43 -43
- package/native/transform/features/llm/LlmCreateParseTransformer.go +43 -43
- package/native/transform/features/llm/LlmParametersTransformer.go +38 -38
- package/native/transform/features/llm/LlmParseTransformer.go +50 -50
- package/native/transform/features/llm/LlmSchemaTransformer.go +129 -129
- package/native/transform/features/llm/LlmStructuredOutputTransformer.go +44 -44
- package/native/transform/features/misc/MiscAssertCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscAssertPruneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreateAssertCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreateAssertPruneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreateCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreateIsCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreateIsPruneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreatePruneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreateValidateCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscCreateValidatePruneTransformer.go +11 -11
- package/native/transform/features/misc/MiscIsCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscIsPruneTransformer.go +11 -11
- package/native/transform/features/misc/MiscLiteralsTransformer.go +21 -21
- package/native/transform/features/misc/MiscPruneTransformer.go +11 -11
- package/native/transform/features/misc/MiscValidateCloneTransformer.go +11 -11
- package/native/transform/features/misc/MiscValidatePruneTransformer.go +11 -11
- package/native/transform/features/notations/NotationAssertGeneralTransformer.go +16 -16
- package/native/transform/features/notations/NotationCreateAssertGeneralTransformer.go +16 -16
- package/native/transform/features/notations/NotationCreateGeneralTransformer.go +16 -16
- package/native/transform/features/notations/NotationCreateIsGeneralTransformer.go +16 -16
- package/native/transform/features/notations/NotationCreateValidateGeneralTransformer.go +16 -16
- package/native/transform/features/notations/NotationGeneralTransformer.go +21 -21
- package/native/transform/features/notations/NotationIsGeneralTransformer.go +16 -16
- package/native/transform/features/notations/NotationValidateGeneralTransformer.go +16 -16
- package/native/transform/features/protobuf/ProtobufAssertDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufAssertEncodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateAssertDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateAssertEncodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateEncodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateIsDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateIsEncodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateValidateDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufCreateValidateEncodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufEncodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufIsDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufIsEncodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufMessageTransformer.go +20 -20
- package/native/transform/features/protobuf/ProtobufValidateDecodeTransformer.go +11 -11
- package/native/transform/features/protobuf/ProtobufValidateEncodeTransformer.go +11 -11
- package/native/transform/features/reflect/ReflectMetadataTransformer.go +59 -59
- package/native/transform/features/reflect/ReflectNameTransformer.go +78 -78
- package/native/transform/features/reflect/ReflectSchemaTransformer.go +121 -121
- package/native/transform/features/reflect/ReflectSchemasTransformer.go +55 -55
- package/native/transform/internal/GenericTransformer.go +173 -173
- package/native/transform/transform.go +32 -32
- package/package.json +4 -4
- package/src/executable/TypiaGenerateWizard.ts +78 -9
- package/src/executable/generate/ttsc.ts +2 -3
- package/src/executable/setup/PluginConfigurator.ts +2 -3
- package/src/internal/_randomInteger.ts +5 -5
- package/src/internal/_validateReport.ts +1 -2
- package/src/transform.ts +6 -11
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
package llm
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
"fmt"
|
|
5
|
+
"regexp"
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
shimast "github.com/microsoft/typescript-go/shim/ast"
|
|
8
|
+
nativecontext "github.com/samchon/typia/packages/typia/native/core/context"
|
|
9
|
+
nativefactories "github.com/samchon/typia/packages/typia/native/core/factories"
|
|
10
|
+
nativeprogrammers "github.com/samchon/typia/packages/typia/native/core/programmers"
|
|
11
|
+
nativeiterate "github.com/samchon/typia/packages/typia/native/core/programmers/iterate"
|
|
12
|
+
nativejson "github.com/samchon/typia/packages/typia/native/core/programmers/json"
|
|
13
|
+
schemametadata "github.com/samchon/typia/packages/typia/native/core/schemas/metadata"
|
|
14
14
|
)
|
|
15
15
|
|
|
16
16
|
type llmApplicationProgrammerNamespace struct{}
|
|
@@ -18,483 +18,495 @@ type llmApplicationProgrammerNamespace struct{}
|
|
|
18
18
|
var LlmApplicationProgrammer = llmApplicationProgrammerNamespace{}
|
|
19
19
|
|
|
20
20
|
type LlmApplicationProgrammer_IProps struct {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
Context nativecontext.ITypiaContext
|
|
22
|
+
Modulo *shimast.Node
|
|
23
|
+
Type any
|
|
24
|
+
Name *string
|
|
25
|
+
Init *shimast.Node
|
|
26
|
+
Config map[string]any
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
type LlmApplicationProgrammer_IWriteProps struct {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
Context nativecontext.ITypiaContext
|
|
31
|
+
Modulo *shimast.Node
|
|
32
|
+
Metadata *schemametadata.MetadataSchema
|
|
33
|
+
Config map[string]any
|
|
34
|
+
Name *string
|
|
35
|
+
ConfigArgument *shimast.Node
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
var llmApplicationProgrammer_factory = shimast.NewNodeFactory(shimast.NodeFactoryHooks{})
|
|
39
39
|
|
|
40
40
|
func (llmApplicationProgrammerNamespace) Write(props LlmApplicationProgrammer_IWriteProps) *shimast.Node {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
41
|
+
application := LlmApplicationProgrammer.WriteApplication(struct {
|
|
42
|
+
Context nativecontext.ITypiaContext
|
|
43
|
+
Modulo *shimast.Node
|
|
44
|
+
Metadata *schemametadata.MetadataSchema
|
|
45
|
+
Config map[string]any
|
|
46
|
+
Name *string
|
|
47
|
+
}{
|
|
48
|
+
Context: props.Context,
|
|
49
|
+
Modulo: props.Modulo,
|
|
50
|
+
Metadata: props.Metadata,
|
|
51
|
+
Config: props.Config,
|
|
52
|
+
Name: props.Name,
|
|
53
|
+
})
|
|
54
|
+
var arguments []*shimast.TypeNode
|
|
55
|
+
if props.Name != nil {
|
|
56
|
+
arguments = []*shimast.TypeNode{llmProgrammer_type_reference(*props.Name)}
|
|
57
|
+
}
|
|
58
|
+
typeNode := llmProgrammer_import_type(props.Context, nativeprogrammers.ImportProgrammer_TypeProps{
|
|
59
|
+
File: "typia",
|
|
60
|
+
Name: "ILlmApplication.__IPrimitive",
|
|
61
|
+
Arguments: arguments,
|
|
62
|
+
})
|
|
63
|
+
args := []*shimast.Node{
|
|
64
|
+
llmApplicationProgrammer_factory.NewAsExpression(
|
|
65
|
+
llmApplicationProgrammer_factory.NewSatisfiesExpression(nativefactories.LiteralFactory.Write(application), typeNode),
|
|
66
|
+
typeNode,
|
|
67
|
+
),
|
|
68
|
+
}
|
|
69
|
+
if props.ConfigArgument != nil {
|
|
70
|
+
args = append(args, props.ConfigArgument)
|
|
71
|
+
}
|
|
72
|
+
var typeArguments *shimast.NodeList
|
|
73
|
+
if props.Name != nil {
|
|
74
|
+
typeArguments = llmApplicationProgrammer_factory.NewNodeList([]*shimast.Node{llmProgrammer_type_reference(*props.Name)})
|
|
75
|
+
}
|
|
76
|
+
return llmApplicationProgrammer_factory.NewCallExpression(
|
|
77
|
+
llmProgrammer_internal(props.Context, "llmApplicationFinalize"),
|
|
78
|
+
nil,
|
|
79
|
+
typeArguments,
|
|
80
|
+
llmApplicationProgrammer_factory.NewNodeList(args),
|
|
81
|
+
shimast.NodeFlagsNone,
|
|
82
|
+
)
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
func (llmApplicationProgrammerNamespace) Validate(props struct {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
Config map[string]any
|
|
87
|
+
Metadata *schemametadata.MetadataSchema
|
|
88
|
+
Explore nativefactories.MetadataFactory_IExplore
|
|
89
|
+
Top *schemametadata.MetadataSchema
|
|
90
90
|
}) []string {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
91
|
+
if props.Explore.Top == false {
|
|
92
|
+
if props.Top != nil &&
|
|
93
|
+
len(props.Top.Objects) != 0 &&
|
|
94
|
+
props.Explore.Object == props.Top.Objects[0].Type {
|
|
95
|
+
if _, ok := props.Explore.Property.(string); ok &&
|
|
96
|
+
props.Metadata.Size() == 1 &&
|
|
97
|
+
props.Metadata.Nullable == false &&
|
|
98
|
+
props.Metadata.IsRequired() == true &&
|
|
99
|
+
len(props.Metadata.Functions) == 1 {
|
|
100
|
+
return llmApplicationProgrammer_validateFunction(fmt.Sprint(props.Explore.Property), props.Metadata.Functions[0])
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return LlmSchemaProgrammer.Validate(struct {
|
|
104
|
+
Config map[string]any
|
|
105
|
+
Metadata *schemametadata.MetadataSchema
|
|
106
|
+
Explore nativefactories.MetadataFactory_IExplore
|
|
107
|
+
}{Config: props.Config, Metadata: props.Metadata, Explore: props.Explore})
|
|
108
|
+
}
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
110
|
+
output := []string{}
|
|
111
|
+
isValidType := props.Metadata.Size() == 1 &&
|
|
112
|
+
len(props.Metadata.Objects) == 1 &&
|
|
113
|
+
props.Metadata.IsRequired() == true &&
|
|
114
|
+
props.Metadata.Nullable == false
|
|
115
|
+
if isValidType == false {
|
|
116
|
+
output = append(output, "LLM application's generic argument must be a class/interface type.")
|
|
117
|
+
}
|
|
118
|
+
var object *schemametadata.MetadataObjectType
|
|
119
|
+
if len(props.Metadata.Objects) != 0 {
|
|
120
|
+
object = props.Metadata.Objects[0].Type
|
|
121
|
+
}
|
|
122
|
+
if object != nil {
|
|
123
|
+
for _, property := range object.Properties {
|
|
124
|
+
if property.Key.IsSoleLiteral() == false {
|
|
125
|
+
output = append(output, "LLM application does not allow dynamic keys on class/interface type.")
|
|
126
|
+
break
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
least := false
|
|
130
|
+
for _, property := range object.Properties {
|
|
131
|
+
rawName := property.Key.GetSoleLiteral()
|
|
132
|
+
if rawName == nil {
|
|
133
|
+
continue
|
|
134
|
+
}
|
|
135
|
+
value := property.Value
|
|
136
|
+
if len(value.Functions) == 0 {
|
|
137
|
+
continue
|
|
138
|
+
}
|
|
139
|
+
least = true
|
|
140
|
+
name := fmt.Sprintf("%q", *rawName)
|
|
141
|
+
if isValidType == false {
|
|
142
|
+
if len(value.Functions) != 1 || value.Size() != 1 {
|
|
143
|
+
output = append(output, "LLM application's function ("+name+") type does not allow union type.")
|
|
144
|
+
}
|
|
145
|
+
if value.IsRequired() == false {
|
|
146
|
+
output = append(output, "LLM application's function ("+name+") type must be required.")
|
|
147
|
+
}
|
|
148
|
+
if value.Nullable {
|
|
149
|
+
output = append(output, "LLM application's function ("+name+") type must not be nullable.")
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
prefix := "LLM application's function (" + name + ")"
|
|
153
|
+
output = append(output, llmApplicationProgrammer_validateName(prefix, *rawName)...)
|
|
154
|
+
description := llmApplicationProgrammer_propertyDescription(property)
|
|
155
|
+
if description != nil && len(*description) > 1024 {
|
|
156
|
+
output = append(output, "LLM application's function ("+name+") description must not exceed 1,024 characters.")
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if least == false {
|
|
160
|
+
output = append(output, "LLM application's target type must have at least a function type.")
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return output
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
func (llmApplicationProgrammerNamespace) WriteApplication(props struct {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
167
|
+
Context nativecontext.ITypiaContext
|
|
168
|
+
Modulo *shimast.Node
|
|
169
|
+
Metadata *schemametadata.MetadataSchema
|
|
170
|
+
Config map[string]any
|
|
171
|
+
Name *string
|
|
172
172
|
}) map[string]any {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
173
|
+
metadata := schemametadata.MetadataSchema_unalias(props.Metadata)
|
|
174
|
+
functionParameters := map[string]*schemametadata.MetadataParameter{}
|
|
175
|
+
if len(metadata.Objects) != 0 {
|
|
176
|
+
for _, property := range metadata.Objects[0].Type.Properties {
|
|
177
|
+
if property.Key.IsSoleLiteral() == false ||
|
|
178
|
+
property.Value.Size() != 1 ||
|
|
179
|
+
property.Value.Nullable ||
|
|
180
|
+
property.Value.IsRequired() == false {
|
|
181
|
+
continue
|
|
182
|
+
}
|
|
183
|
+
unaliased := schemametadata.MetadataSchema_unalias(property.Value)
|
|
184
|
+
if len(unaliased.Functions) != 1 || llmApplicationProgrammer_hidden(property.JsDocTags) {
|
|
185
|
+
continue
|
|
186
|
+
}
|
|
187
|
+
key := property.Key.GetSoleLiteral()
|
|
188
|
+
if key == nil || len(unaliased.Functions[0].Parameters) == 0 {
|
|
189
|
+
continue
|
|
190
|
+
}
|
|
191
|
+
functionParameters[*key] = unaliased.Functions[0].Parameters[0]
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
application := nativejson.JsonApplicationProgrammer.WriteApplication(struct {
|
|
195
|
+
Version string
|
|
196
|
+
Metadata *schemametadata.MetadataSchema
|
|
197
|
+
Filter func(prop *schemametadata.MetadataProperty) bool
|
|
198
|
+
}{
|
|
199
|
+
Version: "3.1",
|
|
200
|
+
Metadata: metadata,
|
|
201
|
+
Filter: func(prop *schemametadata.MetadataProperty) bool {
|
|
202
|
+
for _, tag := range prop.JsDocTags {
|
|
203
|
+
if tag.Name == "human" {
|
|
204
|
+
return false
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return true
|
|
208
|
+
},
|
|
209
|
+
})
|
|
210
|
+
components, _ := application["components"].(*nativeiterate.OpenApi_IComponents)
|
|
211
|
+
rawFunctions, _ := application["functions"].([]any)
|
|
212
|
+
functions := []any{}
|
|
213
|
+
for _, raw := range rawFunctions {
|
|
214
|
+
fn, ok := raw.(map[string]any)
|
|
215
|
+
if ok == false {
|
|
216
|
+
continue
|
|
217
|
+
}
|
|
218
|
+
name, _ := fn["name"].(string)
|
|
219
|
+
written := llmApplicationProgrammer_writeFunction(struct {
|
|
220
|
+
Context nativecontext.ITypiaContext
|
|
221
|
+
Modulo *shimast.Node
|
|
222
|
+
Components *nativeiterate.OpenApi_IComponents
|
|
223
|
+
Function map[string]any
|
|
224
|
+
Parameter *schemametadata.MetadataParameter
|
|
225
|
+
ClassName *string
|
|
226
|
+
Config map[string]any
|
|
227
|
+
}{
|
|
228
|
+
Context: props.Context,
|
|
229
|
+
Modulo: props.Modulo,
|
|
230
|
+
Components: components,
|
|
231
|
+
Function: fn,
|
|
232
|
+
Parameter: functionParameters[name],
|
|
233
|
+
ClassName: props.Name,
|
|
234
|
+
Config: props.Config,
|
|
235
|
+
})
|
|
236
|
+
if written != nil {
|
|
237
|
+
functions = append(functions, written)
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return map[string]any{"functions": functions}
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
func llmApplicationProgrammer_writeFunction(props struct {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
244
|
+
Context nativecontext.ITypiaContext
|
|
245
|
+
Modulo *shimast.Node
|
|
246
|
+
Components *nativeiterate.OpenApi_IComponents
|
|
247
|
+
Function map[string]any
|
|
248
|
+
Parameter *schemametadata.MetadataParameter
|
|
249
|
+
ClassName *string
|
|
250
|
+
Config map[string]any
|
|
251
251
|
}) map[string]any {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
252
|
+
name, _ := props.Function["name"].(string)
|
|
253
|
+
parameters := llmApplicationProgrammer_writeParameters(struct {
|
|
254
|
+
Context nativecontext.ITypiaContext
|
|
255
|
+
Components *nativeiterate.OpenApi_IComponents
|
|
256
|
+
Function map[string]any
|
|
257
|
+
Config map[string]any
|
|
258
|
+
}{
|
|
259
|
+
Context: props.Context,
|
|
260
|
+
Components: props.Components,
|
|
261
|
+
Function: props.Function,
|
|
262
|
+
Config: props.Config,
|
|
263
|
+
})
|
|
264
|
+
var output any
|
|
265
|
+
if raw, ok := props.Function["output"].(map[string]any); ok {
|
|
266
|
+
if schema, ok := raw["schema"].(nativeiterate.JsonSchema); ok {
|
|
267
|
+
output = llmApplicationProgrammer_writeOutput(struct {
|
|
268
|
+
Context nativecontext.ITypiaContext
|
|
269
|
+
Components *nativeiterate.OpenApi_IComponents
|
|
270
|
+
Schema nativeiterate.JsonSchema
|
|
271
|
+
Output map[string]any
|
|
272
|
+
Config map[string]any
|
|
273
|
+
}{Context: props.Context, Components: props.Components, Schema: schema, Output: raw, Config: props.Config})
|
|
274
|
+
} else if schema, ok := raw["schema"].(map[string]any); ok {
|
|
275
|
+
output = llmApplicationProgrammer_writeOutput(struct {
|
|
276
|
+
Context nativecontext.ITypiaContext
|
|
277
|
+
Components *nativeiterate.OpenApi_IComponents
|
|
278
|
+
Schema nativeiterate.JsonSchema
|
|
279
|
+
Output map[string]any
|
|
280
|
+
Config map[string]any
|
|
281
|
+
}{Context: props.Context, Components: props.Components, Schema: nativeiterate.JsonSchema(schema), Output: raw, Config: props.Config})
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
result := map[string]any{
|
|
285
|
+
"name": name,
|
|
286
|
+
"parameters": parameters,
|
|
287
|
+
"validate": llmApplicationProgrammer_writeValidator(struct {
|
|
288
|
+
Context nativecontext.ITypiaContext
|
|
289
|
+
Modulo *shimast.Node
|
|
290
|
+
Parameter *schemametadata.MetadataParameter
|
|
291
|
+
Name string
|
|
292
|
+
Equals bool
|
|
293
|
+
ClassName *string
|
|
294
|
+
}{
|
|
295
|
+
Context: props.Context,
|
|
296
|
+
Modulo: props.Modulo,
|
|
297
|
+
Parameter: props.Parameter,
|
|
298
|
+
Name: name,
|
|
299
|
+
Equals: llmApplicationProgrammer_equals(props.Config),
|
|
300
|
+
ClassName: props.ClassName,
|
|
301
|
+
}),
|
|
302
|
+
}
|
|
303
|
+
if output != nil {
|
|
304
|
+
result["output"] = output
|
|
305
|
+
}
|
|
306
|
+
if summary, ok := props.Function["summary"].(string); ok {
|
|
307
|
+
if description, ok := props.Function["description"].(string); ok {
|
|
308
|
+
result["description"] = *llmProgrammer_concat_description(&summary, &description)
|
|
309
|
+
} else {
|
|
310
|
+
result["description"] = summary
|
|
311
|
+
}
|
|
312
|
+
} else if description, ok := props.Function["description"].(string); ok {
|
|
313
|
+
result["description"] = description
|
|
314
|
+
}
|
|
315
|
+
if deprecated, ok := props.Function["deprecated"].(bool); ok && deprecated {
|
|
316
|
+
result["deprecated"] = true
|
|
317
|
+
}
|
|
318
|
+
if tags, ok := props.Function["tags"].([]any); ok && len(tags) != 0 {
|
|
319
|
+
result["tags"] = tags
|
|
320
|
+
}
|
|
321
|
+
return result
|
|
322
322
|
}
|
|
323
323
|
|
|
324
324
|
func llmApplicationProgrammer_writeParameters(props struct {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
325
|
+
Context nativecontext.ITypiaContext
|
|
326
|
+
Components *nativeiterate.OpenApi_IComponents
|
|
327
|
+
Function map[string]any
|
|
328
|
+
Config map[string]any
|
|
329
329
|
}) any {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
return llmParametersProgrammer_write_parameters_expression(props.Context, props.Components, schema, props.Config)
|
|
330
|
+
rawParameters, _ := props.Function["parameters"].([]any)
|
|
331
|
+
if len(rawParameters) == 0 {
|
|
332
|
+
return llmApplicationProgrammer_convertParameters(
|
|
333
|
+
props.Components,
|
|
334
|
+
nativeiterate.JsonSchema{"type": "object", "properties": map[string]any{}, "additionalProperties": false, "required": []any{}},
|
|
335
|
+
props.Config,
|
|
336
|
+
)
|
|
337
|
+
}
|
|
338
|
+
param, _ := rawParameters[0].(map[string]any)
|
|
339
|
+
var schema nativeiterate.JsonSchema
|
|
340
|
+
if raw, ok := param["schema"].(nativeiterate.JsonSchema); ok {
|
|
341
|
+
schema = raw
|
|
342
|
+
} else if raw, ok := param["schema"].(map[string]any); ok {
|
|
343
|
+
schema = nativeiterate.JsonSchema(raw)
|
|
344
|
+
} else {
|
|
345
|
+
schema = nativeiterate.JsonSchema{"type": "object", "properties": map[string]any{}, "additionalProperties": false, "required": []any{}}
|
|
346
|
+
}
|
|
347
|
+
if _, ok := schema["title"]; ok == false {
|
|
348
|
+
if title, ok := param["title"]; ok {
|
|
349
|
+
schema["title"] = title
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
if _, ok := schema["description"]; ok == false {
|
|
353
|
+
if description, ok := param["description"]; ok {
|
|
354
|
+
schema["description"] = description
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return llmApplicationProgrammer_convertParameters(props.Components, schema, props.Config)
|
|
359
358
|
}
|
|
360
359
|
|
|
361
360
|
func llmApplicationProgrammer_writeOutput(props struct {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
361
|
+
Context nativecontext.ITypiaContext
|
|
362
|
+
Components *nativeiterate.OpenApi_IComponents
|
|
363
|
+
Schema nativeiterate.JsonSchema
|
|
364
|
+
Output map[string]any
|
|
365
|
+
Config map[string]any
|
|
367
366
|
}) any {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
367
|
+
if _, exists := props.Schema["description"]; exists == false {
|
|
368
|
+
if desc, ok := props.Output["description"].(string); ok && desc != "" {
|
|
369
|
+
props.Schema["description"] = desc
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
return llmApplicationProgrammer_convertParameters(props.Components, props.Schema, props.Config)
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
func llmApplicationProgrammer_convertParameters(
|
|
376
|
+
components *nativeiterate.OpenApi_IComponents,
|
|
377
|
+
schema nativeiterate.JsonSchema,
|
|
378
|
+
config map[string]any,
|
|
379
|
+
) map[string]any {
|
|
380
|
+
defs := map[string]any{}
|
|
381
|
+
target := llmParametersProgrammer_dereference_schema(schema, components)
|
|
382
|
+
output := llmSchemaProgrammer_convert_schema_config(target, components, defs, config)
|
|
383
|
+
output["additionalProperties"] = false
|
|
384
|
+
output["$defs"] = defs
|
|
385
|
+
return output
|
|
374
386
|
}
|
|
375
387
|
|
|
376
388
|
func llmApplicationProgrammer_writeValidator(props struct {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
389
|
+
Context nativecontext.ITypiaContext
|
|
390
|
+
Modulo *shimast.Node
|
|
391
|
+
Parameter *schemametadata.MetadataParameter
|
|
392
|
+
Name string
|
|
393
|
+
Equals bool
|
|
394
|
+
ClassName *string
|
|
383
395
|
}) *shimast.Node {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
396
|
+
if props.Parameter == nil || props.Parameter.TsType == nil {
|
|
397
|
+
typ := props.Context.Checker.GetAnyType()
|
|
398
|
+
return nativeprogrammers.ValidateProgrammer.Write(nativeprogrammers.ValidateProgrammer_IProps{
|
|
399
|
+
Context: props.Context,
|
|
400
|
+
Modulo: props.Modulo,
|
|
401
|
+
Type: typ,
|
|
402
|
+
Name: nil,
|
|
403
|
+
Config: nativeprogrammers.ValidateProgrammer_IConfig{Equals: props.Equals},
|
|
404
|
+
})
|
|
405
|
+
}
|
|
406
|
+
var name *string
|
|
407
|
+
if props.ClassName != nil {
|
|
408
|
+
text := fmt.Sprintf("Parameters<%s[%q]>[0]", *props.ClassName, props.Name)
|
|
409
|
+
name = &text
|
|
410
|
+
}
|
|
411
|
+
return nativeprogrammers.ValidateProgrammer.Write(nativeprogrammers.ValidateProgrammer_IProps{
|
|
412
|
+
Context: props.Context,
|
|
413
|
+
Modulo: props.Modulo,
|
|
414
|
+
Type: props.Parameter.TsType,
|
|
415
|
+
Name: name,
|
|
416
|
+
Config: nativeprogrammers.ValidateProgrammer_IConfig{Equals: props.Equals},
|
|
417
|
+
})
|
|
406
418
|
}
|
|
407
419
|
|
|
408
420
|
func llmApplicationProgrammer_validateObjectSchema(prefix string, label string, schema *schemametadata.MetadataSchema) []string {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
421
|
+
errors := []string{}
|
|
422
|
+
if schema.IsRequired() == false {
|
|
423
|
+
errors = append(errors, prefix+" "+label+" cannot be optional (union with undefined).")
|
|
424
|
+
}
|
|
425
|
+
if schema.Nullable {
|
|
426
|
+
errors = append(errors, prefix+" "+label+" cannot be nullable.")
|
|
427
|
+
}
|
|
428
|
+
if schema.Size() != 1 || len(schema.Objects) != 1 {
|
|
429
|
+
errors = append(errors, prefix+" "+label+" must be a single object type.")
|
|
430
|
+
} else {
|
|
431
|
+
for _, property := range schema.Objects[0].Type.Properties {
|
|
432
|
+
if property.Key.IsSoleLiteral() == false {
|
|
433
|
+
errors = append(errors, prefix+" "+label+" cannot have dynamic property keys.")
|
|
434
|
+
break
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
return errors
|
|
427
439
|
}
|
|
428
440
|
|
|
429
441
|
func llmApplicationProgrammer_validateFunction(name string, fn *schemametadata.MetadataFunction) []string {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
442
|
+
messages := []string{}
|
|
443
|
+
prefix := fmt.Sprintf("LLM application's function (%q)", name)
|
|
444
|
+
messages = append(messages, llmApplicationProgrammer_validateName(prefix, name)...)
|
|
445
|
+
if fn.Output != nil && fn.Output.Size() != 0 {
|
|
446
|
+
messages = append(messages, llmApplicationProgrammer_validateObjectSchema(prefix, "return type", fn.Output)...)
|
|
447
|
+
}
|
|
448
|
+
if len(fn.Parameters) != 0 && len(fn.Parameters) != 1 {
|
|
449
|
+
messages = append(messages, prefix+" must have exactly one parameter or no parameters.")
|
|
450
|
+
}
|
|
451
|
+
if len(fn.Parameters) != 0 {
|
|
452
|
+
messages = append(messages, llmApplicationProgrammer_validateObjectSchema(prefix, "parameter", fn.Parameters[0].Type)...)
|
|
453
|
+
}
|
|
454
|
+
return messages
|
|
443
455
|
}
|
|
444
456
|
|
|
445
457
|
func llmApplicationProgrammer_validateName(prefix string, name string) []string {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
458
|
+
output := []string{}
|
|
459
|
+
if len(name) != 0 && regexp.MustCompile(`^[0-9]`).MatchString(name[:1]) {
|
|
460
|
+
output = append(output, prefix+" name cannot start with a number.")
|
|
461
|
+
}
|
|
462
|
+
if regexp.MustCompile(`^[a-zA-Z0-9_-]+$`).MatchString(name) == false {
|
|
463
|
+
output = append(output, prefix+" name must contain only alphanumeric characters, underscores, or hyphens.")
|
|
464
|
+
}
|
|
465
|
+
if len(name) > 64 {
|
|
466
|
+
output = append(output, prefix+" name cannot exceed 64 characters.")
|
|
467
|
+
}
|
|
468
|
+
return output
|
|
457
469
|
}
|
|
458
470
|
|
|
459
471
|
func llmApplicationProgrammer_propertyDescription(property *schemametadata.MetadataProperty) *string {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
472
|
+
description := property.Description
|
|
473
|
+
if description == nil {
|
|
474
|
+
for _, tag := range property.JsDocTags {
|
|
475
|
+
if tag.Name == "description" && len(tag.Text) != 0 {
|
|
476
|
+
text := tag.Text[0].Text
|
|
477
|
+
description = &text
|
|
478
|
+
break
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
desc := nativejson.JsonApplicationProgrammer.WriteDescription(struct {
|
|
483
|
+
Description *string
|
|
484
|
+
JsDocTags []schemametadata.IJsDocTagInfo
|
|
485
|
+
Kind string
|
|
486
|
+
}{Description: description, JsDocTags: property.JsDocTags, Kind: "summary"})
|
|
487
|
+
var summary *string
|
|
488
|
+
if s, ok := desc["summary"].(string); ok {
|
|
489
|
+
summary = &s
|
|
490
|
+
}
|
|
491
|
+
if d, ok := desc["description"].(string); ok {
|
|
492
|
+
description = &d
|
|
493
|
+
}
|
|
494
|
+
return llmProgrammer_concat_description(summary, description)
|
|
483
495
|
}
|
|
484
496
|
|
|
485
497
|
func llmApplicationProgrammer_hidden(tags []schemametadata.IJsDocTagInfo) bool {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
498
|
+
for _, tag := range tags {
|
|
499
|
+
if tag.Name == "hidden" || tag.Name == "ignore" || tag.Name == "internal" {
|
|
500
|
+
return true
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
return false
|
|
492
504
|
}
|
|
493
505
|
|
|
494
506
|
func llmApplicationProgrammer_equals(config map[string]any) bool {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
507
|
+
if config == nil {
|
|
508
|
+
return false
|
|
509
|
+
}
|
|
510
|
+
value, _ := config["equals"].(bool)
|
|
511
|
+
return value
|
|
500
512
|
}
|