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 internal
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
"fmt"
|
|
5
|
+
"sort"
|
|
6
|
+
|
|
7
|
+
shimast "github.com/microsoft/typescript-go/shim/ast"
|
|
8
|
+
shimchecker "github.com/microsoft/typescript-go/shim/checker"
|
|
9
|
+
nativecontext "github.com/samchon/typia/packages/typia/native/core/context"
|
|
10
|
+
nativefactories "github.com/samchon/typia/packages/typia/native/core/factories"
|
|
11
|
+
nativehelpers "github.com/samchon/typia/packages/typia/native/core/programmers/helpers"
|
|
12
|
+
nativeiterate "github.com/samchon/typia/packages/typia/native/core/programmers/iterate"
|
|
13
|
+
nativemetadata "github.com/samchon/typia/packages/typia/native/core/schemas/metadata"
|
|
14
14
|
)
|
|
15
15
|
|
|
16
16
|
type featureProgrammerNamespace struct{}
|
|
@@ -18,732 +18,732 @@ type featureProgrammerNamespace struct{}
|
|
|
18
18
|
var FeatureProgrammer = featureProgrammerNamespace{}
|
|
19
19
|
|
|
20
20
|
type FeatureProgrammer_IConfig struct {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
Types FeatureProgrammer_IConfig_ITypes
|
|
22
|
+
Prefix string
|
|
23
|
+
Path bool
|
|
24
|
+
Trace bool
|
|
25
|
+
Addition func(collection *nativemetadata.MetadataCollection) []*shimast.Node
|
|
26
|
+
Initializer func(props FeatureProgrammer_InitializerProps) FeatureProgrammer_InitializerOutput
|
|
27
|
+
Decoder func(props FeatureProgrammer_DecoderProps) *shimast.Node
|
|
28
|
+
Objector FeatureProgrammer_IConfig_IObjector
|
|
29
|
+
Generator FeatureProgrammer_IConfig_IGenerator
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
type FeatureProgrammer_IConfig_ITypes struct {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
Input func(t *shimchecker.Type, name *string) *shimast.TypeNode
|
|
34
|
+
Output func(t *shimchecker.Type, name *string) *shimast.TypeNode
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
type FeatureProgrammer_IConfig_IObjector struct {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
Checker func(props FeatureProgrammer_ObjectorCheckerProps) *shimast.Node
|
|
39
|
+
Decoder func(props FeatureProgrammer_ObjectorDecoderProps) *shimast.Node
|
|
40
|
+
Joiner func(props FeatureProgrammer_ObjectorJoinerProps) *shimast.Node
|
|
41
|
+
Unionizer func(props FeatureProgrammer_ObjectorUnionizerProps) *shimast.Node
|
|
42
|
+
Failure func(props FeatureProgrammer_ObjectorFailureProps) *shimast.Node
|
|
43
|
+
Is func(exp *shimast.Expression) *shimast.Node
|
|
44
|
+
Required func(exp *shimast.Expression) *shimast.Node
|
|
45
|
+
Full func(props FeatureProgrammer_ObjectorFullProps) *shimast.Node
|
|
46
|
+
Type *shimast.TypeNode
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
type FeatureProgrammer_IConfig_IGenerator struct {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
Objects func(collection *nativemetadata.MetadataCollection) []*shimast.Node
|
|
51
|
+
Unions func(collection *nativemetadata.MetadataCollection) []*shimast.Node
|
|
52
|
+
Arrays func(collection *nativemetadata.MetadataCollection) []*shimast.Node
|
|
53
|
+
Tuples func(collection *nativemetadata.MetadataCollection) []*shimast.Node
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
type FeatureProgrammer_IExplore = nativehelpers.UnionExplorer_IExplore
|
|
57
57
|
|
|
58
58
|
type FeatureProgrammer_InitializerProps struct {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
Context nativecontext.ITypiaContext
|
|
60
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
61
|
+
Type *shimchecker.Type
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
type FeatureProgrammer_InitializerOutput struct {
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
Collection *nativemetadata.MetadataCollection
|
|
66
|
+
Metadata *nativemetadata.MetadataSchema
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
type FeatureProgrammer_DecoderProps struct {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
Metadata *nativemetadata.MetadataSchema
|
|
71
|
+
Input *shimast.Expression
|
|
72
|
+
Explore FeatureProgrammer_IExplore
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
type FeatureProgrammer_ObjectorCheckerProps struct {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
Metadata *nativemetadata.MetadataSchema
|
|
77
|
+
Input *shimast.Expression
|
|
78
|
+
Explore FeatureProgrammer_IExplore
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
type FeatureProgrammer_ObjectorDecoderProps struct {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
Input *shimast.Expression
|
|
83
|
+
Object *nativemetadata.MetadataObjectType
|
|
84
|
+
Explore FeatureProgrammer_IExplore
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
type FeatureProgrammer_ObjectorJoinerProps struct {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
Entries []nativehelpers.IExpressionEntry
|
|
89
|
+
Input *shimast.Expression
|
|
90
|
+
Object *nativemetadata.MetadataObjectType
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
type FeatureProgrammer_ObjectorUnionizerProps struct {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
Objects []*nativemetadata.MetadataObjectType
|
|
95
|
+
Input *shimast.Expression
|
|
96
|
+
Explore FeatureProgrammer_IExplore
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
type FeatureProgrammer_ObjectorFailureProps struct {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
Input *shimast.Expression
|
|
101
|
+
Expected string
|
|
102
|
+
Explore *FeatureProgrammer_IExplore
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
type FeatureProgrammer_ObjectorFullProps struct {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
Condition *shimast.Expression
|
|
107
|
+
Input *shimast.Expression
|
|
108
|
+
Expected string
|
|
109
|
+
Explore FeatureProgrammer_IExplore
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
type FeatureProgrammer_Decoder[T any] func(props struct {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
Input *shimast.Expression
|
|
114
|
+
Definition T
|
|
115
|
+
Explore FeatureProgrammer_IExplore
|
|
116
116
|
}) *shimast.Node
|
|
117
117
|
|
|
118
118
|
type FeatureProgrammer_IComposed struct {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
Body *shimast.Node
|
|
120
|
+
Parameters []*shimast.Node
|
|
121
|
+
Functions map[string]*shimast.Node
|
|
122
|
+
Statements []*shimast.Node
|
|
123
|
+
Response *shimast.TypeNode
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
type FeatureProgrammer_IDecomposed struct {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
Functions map[string]*shimast.Node
|
|
128
|
+
Statements []*shimast.Node
|
|
129
|
+
Arrow *shimast.Node
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
type FeatureProgrammer_ComposeProps struct {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
133
|
+
Context nativecontext.ITypiaContext
|
|
134
|
+
Config FeatureProgrammer_IConfig
|
|
135
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
136
|
+
Type *shimchecker.Type
|
|
137
|
+
Name *string
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
type FeatureProgrammer_WriteDecomposedProps struct {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
141
|
+
Modulo *shimast.Expression
|
|
142
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
143
|
+
Result FeatureProgrammer_IDecomposed
|
|
144
|
+
ReturnWrapper func(arrow *shimast.Node) *shimast.Node
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
type FeatureProgrammer_WriteProps struct {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
148
|
+
Context nativecontext.ITypiaContext
|
|
149
|
+
Config FeatureProgrammer_IConfig
|
|
150
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
151
|
+
Type *shimchecker.Type
|
|
152
|
+
Name *string
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
type FeatureProgrammer_WriteObjectFunctionsProps struct {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
Config FeatureProgrammer_IConfig
|
|
157
|
+
Context nativecontext.ITypiaContext
|
|
158
|
+
Collection *nativemetadata.MetadataCollection
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
type FeatureProgrammer_WriteUnionFunctionsProps struct {
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
Config FeatureProgrammer_IConfig
|
|
163
|
+
Collection *nativemetadata.MetadataCollection
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
type FeatureProgrammer_DecodeArrayConfig struct {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
167
|
+
Trace bool
|
|
168
|
+
Path bool
|
|
169
|
+
Decoder func(props FeatureProgrammer_DecoderProps) *shimast.Node
|
|
170
|
+
Prefix string
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
type FeatureProgrammer_DecodeArrayProps struct {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
174
|
+
Config FeatureProgrammer_DecodeArrayConfig
|
|
175
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
176
|
+
Combiner func(next struct {
|
|
177
|
+
Input *shimast.Expression
|
|
178
|
+
Arrow *shimast.Node
|
|
179
|
+
}) *shimast.Node
|
|
180
|
+
Array *nativemetadata.MetadataArray
|
|
181
|
+
Input *shimast.Expression
|
|
182
|
+
Explore FeatureProgrammer_IExplore
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
type FeatureProgrammer_DecodeObjectConfig struct {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
Trace bool
|
|
187
|
+
Path bool
|
|
188
|
+
Prefix string
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
type FeatureProgrammer_DecodeObjectProps struct {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
192
|
+
Config FeatureProgrammer_DecodeObjectConfig
|
|
193
|
+
Functor *nativehelpers.FunctionProgrammer
|
|
194
|
+
Object *nativemetadata.MetadataObjectType
|
|
195
|
+
Input *shimast.Expression
|
|
196
|
+
Explore FeatureProgrammer_IExplore
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
type FeatureProgrammer_IndexProps struct {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
200
|
+
Start *int
|
|
201
|
+
Postfix string
|
|
202
|
+
Rand string
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
type FeatureProgrammer_ArgumentsArrayProps struct {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
206
|
+
Config FeatureProgrammer_ArgumentsArrayConfig
|
|
207
|
+
Input *shimast.Expression
|
|
208
|
+
Explore FeatureProgrammer_IExplore
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
type FeatureProgrammer_ArgumentsArrayConfig struct {
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
Path bool
|
|
213
|
+
Trace bool
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
type FeatureProgrammer_ParameterDeclarationsProps struct {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
Config FeatureProgrammer_ParameterConfig
|
|
218
|
+
Type *shimast.TypeNode
|
|
219
|
+
Input *shimast.Node
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
type FeatureProgrammer_ParameterConfig struct {
|
|
223
|
-
|
|
224
|
-
|
|
223
|
+
Path bool
|
|
224
|
+
Trace bool
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
var featureProgrammer_factory = shimast.NewNodeFactory(shimast.NodeFactoryHooks{})
|
|
228
228
|
|
|
229
229
|
func (featureProgrammerNamespace) Compose(props FeatureProgrammer_ComposeProps) FeatureProgrammer_IComposed {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
230
|
+
initialized := props.Config.Initializer(FeatureProgrammer_InitializerProps{
|
|
231
|
+
Context: props.Context,
|
|
232
|
+
Functor: props.Functor,
|
|
233
|
+
Type: props.Type,
|
|
234
|
+
})
|
|
235
|
+
featureProgrammer_register_schema_unions(initialized.Collection, initialized.Metadata, map[*nativemetadata.MetadataSchema]bool{})
|
|
236
|
+
body := props.Config.Decoder(FeatureProgrammer_DecoderProps{
|
|
237
|
+
Input: nativefactories.ValueFactory.INPUT(),
|
|
238
|
+
Metadata: initialized.Metadata,
|
|
239
|
+
Explore: FeatureProgrammer_IExplore{
|
|
240
|
+
Tracable: props.Config.Path || props.Config.Trace,
|
|
241
|
+
Source: "top",
|
|
242
|
+
From: "top",
|
|
243
|
+
Postfix: "\"\"",
|
|
244
|
+
},
|
|
245
|
+
})
|
|
246
|
+
statements := []*shimast.Node{}
|
|
247
|
+
if props.Config.Addition != nil {
|
|
248
|
+
statements = props.Config.Addition(initialized.Collection)
|
|
249
|
+
}
|
|
250
|
+
functions := map[string]*shimast.Node{}
|
|
251
|
+
for i, v := range featureProgrammer_object_functions(props, initialized.Collection) {
|
|
252
|
+
functions[fmt.Sprintf("%so%d", props.Config.Prefix, i)] = v
|
|
253
|
+
}
|
|
254
|
+
for i, v := range featureProgrammer_union_functions(props.Config, initialized.Collection) {
|
|
255
|
+
functions[fmt.Sprintf("%su%d", props.Config.Prefix, i)] = v
|
|
256
|
+
}
|
|
257
|
+
for i, v := range props.Config.Generator.Arrays(initialized.Collection) {
|
|
258
|
+
functions[fmt.Sprintf("%sa%d", props.Config.Prefix, i)] = v
|
|
259
|
+
}
|
|
260
|
+
for i, v := range props.Config.Generator.Tuples(initialized.Collection) {
|
|
261
|
+
functions[fmt.Sprintf("%st%d", props.Config.Prefix, i)] = v
|
|
262
|
+
}
|
|
263
|
+
return FeatureProgrammer_IComposed{
|
|
264
|
+
Body: body,
|
|
265
|
+
Statements: statements,
|
|
266
|
+
Functions: functions,
|
|
267
|
+
Parameters: FeatureProgrammer.ParameterDeclarations(FeatureProgrammer_ParameterDeclarationsProps{
|
|
268
|
+
Config: FeatureProgrammer_ParameterConfig{Path: props.Config.Path, Trace: props.Config.Trace},
|
|
269
|
+
Type: props.Config.Types.Input(props.Type, props.Name),
|
|
270
|
+
Input: nativefactories.ValueFactory.INPUT(),
|
|
271
|
+
}),
|
|
272
|
+
Response: props.Config.Types.Output(props.Type, props.Name),
|
|
273
|
+
}
|
|
274
274
|
}
|
|
275
275
|
|
|
276
276
|
func (featureProgrammerNamespace) WriteDecomposed(props FeatureProgrammer_WriteDecomposedProps) *shimast.Node {
|
|
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
|
-
|
|
277
|
+
statements := []*shimast.Node{}
|
|
278
|
+
statements = append(statements, props.Functor.Declare()...)
|
|
279
|
+
keys := make([]string, 0, len(props.Result.Functions))
|
|
280
|
+
for key := range props.Result.Functions {
|
|
281
|
+
keys = append(keys, key)
|
|
282
|
+
}
|
|
283
|
+
sort.Strings(keys)
|
|
284
|
+
for _, key := range keys {
|
|
285
|
+
statements = append(statements, props.Result.Functions[key])
|
|
286
|
+
}
|
|
287
|
+
statements = append(statements, props.Result.Statements...)
|
|
288
|
+
response := props.Result.Arrow
|
|
289
|
+
if props.ReturnWrapper != nil {
|
|
290
|
+
response = props.ReturnWrapper(props.Result.Arrow)
|
|
291
|
+
}
|
|
292
|
+
statements = append(statements, featureProgrammer_factory.NewReturnStatement(response))
|
|
293
|
+
return featureProgrammer_factory.NewCallExpression(
|
|
294
|
+
featureProgrammer_factory.NewArrowFunction(
|
|
295
|
+
nil,
|
|
296
|
+
nil,
|
|
297
|
+
featureProgrammer_factory.NewNodeList(nil),
|
|
298
|
+
nil,
|
|
299
|
+
nil,
|
|
300
|
+
featureProgrammer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
301
|
+
featureProgrammer_factory.NewBlock(featureProgrammer_factory.NewNodeList(statements), true),
|
|
302
|
+
),
|
|
303
|
+
nil,
|
|
304
|
+
nil,
|
|
305
|
+
nil,
|
|
306
|
+
shimast.NodeFlagsNone,
|
|
307
|
+
)
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
func (featureProgrammerNamespace) Write(props FeatureProgrammer_WriteProps) *shimast.Node {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
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
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
311
|
+
initialized := props.Config.Initializer(FeatureProgrammer_InitializerProps{
|
|
312
|
+
Context: props.Context,
|
|
313
|
+
Functor: props.Functor,
|
|
314
|
+
Type: props.Type,
|
|
315
|
+
})
|
|
316
|
+
featureProgrammer_register_schema_unions(initialized.Collection, initialized.Metadata, map[*nativemetadata.MetadataSchema]bool{})
|
|
317
|
+
output := props.Config.Decoder(FeatureProgrammer_DecoderProps{
|
|
318
|
+
Metadata: initialized.Metadata,
|
|
319
|
+
Input: nativefactories.ValueFactory.INPUT(),
|
|
320
|
+
Explore: FeatureProgrammer_IExplore{
|
|
321
|
+
Tracable: props.Config.Path || props.Config.Trace,
|
|
322
|
+
Source: "top",
|
|
323
|
+
From: "top",
|
|
324
|
+
Postfix: "\"\"",
|
|
325
|
+
},
|
|
326
|
+
})
|
|
327
|
+
|
|
328
|
+
objects := featureProgrammer_object_functions(FeatureProgrammer_ComposeProps{
|
|
329
|
+
Config: props.Config,
|
|
330
|
+
Context: props.Context,
|
|
331
|
+
Functor: props.Functor,
|
|
332
|
+
Type: props.Type,
|
|
333
|
+
Name: props.Name,
|
|
334
|
+
}, initialized.Collection)
|
|
335
|
+
unions := featureProgrammer_union_functions(props.Config, initialized.Collection)
|
|
336
|
+
arrays := props.Config.Generator.Arrays(initialized.Collection)
|
|
337
|
+
tuples := props.Config.Generator.Tuples(initialized.Collection)
|
|
338
|
+
|
|
339
|
+
added := []*shimast.Node{}
|
|
340
|
+
if props.Config.Addition != nil {
|
|
341
|
+
added = props.Config.Addition(initialized.Collection)
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
statements := append([]*shimast.Node{}, added...)
|
|
345
|
+
for _, v := range objects {
|
|
346
|
+
statements = append(statements, v)
|
|
347
|
+
}
|
|
348
|
+
for _, v := range unions {
|
|
349
|
+
statements = append(statements, v)
|
|
350
|
+
}
|
|
351
|
+
for _, v := range arrays {
|
|
352
|
+
statements = append(statements, v)
|
|
353
|
+
}
|
|
354
|
+
for _, v := range tuples {
|
|
355
|
+
statements = append(statements, v)
|
|
356
|
+
}
|
|
357
|
+
if output != nil && output.Kind == shimast.KindBlock {
|
|
358
|
+
statements = append(statements, output.Statements()...)
|
|
359
|
+
} else {
|
|
360
|
+
statements = append(statements, featureProgrammer_factory.NewReturnStatement(output))
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
return featureProgrammer_factory.NewArrowFunction(
|
|
364
|
+
nil,
|
|
365
|
+
nil,
|
|
366
|
+
featureProgrammer_factory.NewNodeList(FeatureProgrammer.ParameterDeclarations(FeatureProgrammer_ParameterDeclarationsProps{
|
|
367
|
+
Config: FeatureProgrammer_ParameterConfig{Path: props.Config.Path, Trace: props.Config.Trace},
|
|
368
|
+
Type: props.Config.Types.Input(props.Type, props.Name),
|
|
369
|
+
Input: nativefactories.ValueFactory.INPUT(),
|
|
370
|
+
})),
|
|
371
|
+
props.Config.Types.Output(props.Type, props.Name),
|
|
372
|
+
nil,
|
|
373
|
+
featureProgrammer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
374
|
+
featureProgrammer_factory.NewBlock(featureProgrammer_factory.NewNodeList(statements), true),
|
|
375
|
+
)
|
|
376
376
|
}
|
|
377
377
|
|
|
378
378
|
func (featureProgrammerNamespace) Write_object_functions(props FeatureProgrammer_WriteObjectFunctionsProps) []*shimast.Node {
|
|
379
|
-
|
|
379
|
+
return featureProgrammer_write_object_functions(props.Config, props.Context, props.Collection)
|
|
380
380
|
}
|
|
381
381
|
|
|
382
382
|
func (featureProgrammerNamespace) Write_union_functions(props FeatureProgrammer_WriteUnionFunctionsProps) []*shimast.Node {
|
|
383
|
-
|
|
383
|
+
return featureProgrammer_write_union_functions(props.Config, props.Collection)
|
|
384
384
|
}
|
|
385
385
|
|
|
386
386
|
func (featureProgrammerNamespace) Decode_array(props FeatureProgrammer_DecodeArrayProps) *shimast.Node {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
387
|
+
rand := fmt.Sprint(props.Functor.Increment())
|
|
388
|
+
tail := []*shimast.Node{}
|
|
389
|
+
if props.Config.Path || props.Config.Trace {
|
|
390
|
+
tail = append(tail, nativefactories.IdentifierFactory.Parameter("_index"+rand, nativefactories.TypeFactory.Keyword("number"), nil))
|
|
391
|
+
}
|
|
392
|
+
parameters := []*shimast.Node{
|
|
393
|
+
nativefactories.IdentifierFactory.Parameter("elem", nativefactories.TypeFactory.Keyword("any"), nil),
|
|
394
|
+
}
|
|
395
|
+
parameters = append(parameters, tail...)
|
|
396
|
+
arrow := featureProgrammer_factory.NewArrowFunction(
|
|
397
|
+
nil,
|
|
398
|
+
nil,
|
|
399
|
+
featureProgrammer_factory.NewNodeList(parameters),
|
|
400
|
+
nil,
|
|
401
|
+
nil,
|
|
402
|
+
featureProgrammer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
403
|
+
props.Config.Decoder(FeatureProgrammer_DecoderProps{
|
|
404
|
+
Input: nativefactories.ValueFactory.INPUT("elem"),
|
|
405
|
+
Metadata: props.Array.Type.Value,
|
|
406
|
+
Explore: FeatureProgrammer_IExplore{
|
|
407
|
+
Tracable: props.Explore.Tracable,
|
|
408
|
+
Source: props.Explore.Source,
|
|
409
|
+
From: "array",
|
|
410
|
+
Postfix: FeatureProgrammer.Index(FeatureProgrammer_IndexProps{
|
|
411
|
+
Start: props.Explore.Start,
|
|
412
|
+
Postfix: props.Explore.Postfix,
|
|
413
|
+
Rand: rand,
|
|
414
|
+
}),
|
|
415
|
+
},
|
|
416
|
+
}),
|
|
417
|
+
)
|
|
418
|
+
return props.Combiner(struct {
|
|
419
|
+
Input *shimast.Expression
|
|
420
|
+
Arrow *shimast.Node
|
|
421
|
+
}{Input: props.Input, Arrow: arrow})
|
|
422
422
|
}
|
|
423
423
|
|
|
424
424
|
func (featureProgrammerNamespace) Decode_object(props FeatureProgrammer_DecodeObjectProps) *shimast.Node {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
425
|
+
return featureProgrammer_factory.NewCallExpression(
|
|
426
|
+
featureProgrammer_factory.NewIdentifier(
|
|
427
|
+
props.Functor.UseLocal(fmt.Sprintf("%so%d", props.Config.Prefix, props.Object.Index)),
|
|
428
|
+
),
|
|
429
|
+
nil,
|
|
430
|
+
nil,
|
|
431
|
+
featureProgrammer_factory.NewNodeList(FeatureProgrammer.ArgumentsArray(FeatureProgrammer_ArgumentsArrayProps{
|
|
432
|
+
Config: FeatureProgrammer_ArgumentsArrayConfig{Path: props.Config.Path, Trace: props.Config.Trace},
|
|
433
|
+
Input: props.Input,
|
|
434
|
+
Explore: props.Explore,
|
|
435
|
+
})),
|
|
436
|
+
shimast.NodeFlagsNone,
|
|
437
|
+
)
|
|
438
438
|
}
|
|
439
439
|
|
|
440
440
|
func (featureProgrammerNamespace) Index(props FeatureProgrammer_IndexProps) string {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
441
|
+
tail := "\"[\" + _index" + props.Rand + " + \"]\""
|
|
442
|
+
if props.Start != nil {
|
|
443
|
+
tail = "\"[\" + (" + fmt.Sprint(*props.Start) + " + _index" + props.Rand + ") + \"]\""
|
|
444
|
+
}
|
|
445
|
+
if props.Postfix == "" {
|
|
446
|
+
return tail
|
|
447
|
+
}
|
|
448
|
+
if props.Postfix[len(props.Postfix)-1:] == "\"" {
|
|
449
|
+
return props.Postfix[:len(props.Postfix)-1] + tail[1:]
|
|
450
|
+
}
|
|
451
|
+
return props.Postfix + " + " + tail
|
|
452
452
|
}
|
|
453
453
|
|
|
454
454
|
func (featureProgrammerNamespace) ArgumentsArray(props FeatureProgrammer_ArgumentsArrayProps) []*shimast.Node {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
455
|
+
tail := []*shimast.Node{}
|
|
456
|
+
if props.Config.Path == false && props.Config.Trace == false {
|
|
457
|
+
tail = []*shimast.Node{}
|
|
458
|
+
} else if props.Config.Path && props.Config.Trace {
|
|
459
|
+
path := "_path"
|
|
460
|
+
if props.Explore.Postfix != "" {
|
|
461
|
+
path = "_path + " + props.Explore.Postfix
|
|
462
|
+
}
|
|
463
|
+
tail = append(tail, featureProgrammer_factory.NewIdentifier(path))
|
|
464
|
+
if props.Explore.Source == "function" {
|
|
465
|
+
tail = append(tail, featureProgrammer_factory.NewIdentifier(fmt.Sprintf("%t && _exceptionable", props.Explore.Tracable)))
|
|
466
|
+
} else if props.Explore.Tracable {
|
|
467
|
+
tail = append(tail, featureProgrammer_factory.NewKeywordExpression(shimast.KindTrueKeyword))
|
|
468
|
+
} else {
|
|
469
|
+
tail = append(tail, featureProgrammer_factory.NewKeywordExpression(shimast.KindFalseKeyword))
|
|
470
|
+
}
|
|
471
|
+
} else if props.Config.Path {
|
|
472
|
+
path := "_path"
|
|
473
|
+
if props.Explore.Postfix != "" {
|
|
474
|
+
path = "_path + " + props.Explore.Postfix
|
|
475
|
+
}
|
|
476
|
+
tail = append(tail, featureProgrammer_factory.NewIdentifier(path))
|
|
477
|
+
} else {
|
|
478
|
+
if props.Explore.Source == "function" {
|
|
479
|
+
tail = append(tail, featureProgrammer_factory.NewIdentifier(fmt.Sprintf("%t && _exceptionable", props.Explore.Tracable)))
|
|
480
|
+
} else if props.Explore.Tracable {
|
|
481
|
+
tail = append(tail, featureProgrammer_factory.NewKeywordExpression(shimast.KindTrueKeyword))
|
|
482
|
+
} else {
|
|
483
|
+
tail = append(tail, featureProgrammer_factory.NewKeywordExpression(shimast.KindFalseKeyword))
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
return append([]*shimast.Node{props.Input}, tail...)
|
|
487
487
|
}
|
|
488
488
|
|
|
489
489
|
func (featureProgrammerNamespace) ParameterDeclarations(props FeatureProgrammer_ParameterDeclarationsProps) []*shimast.Node {
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
490
|
+
tail := []*shimast.Node{}
|
|
491
|
+
if props.Config.Path {
|
|
492
|
+
tail = append(tail, nativefactories.IdentifierFactory.Parameter("_path", nativefactories.TypeFactory.Keyword("string"), nil))
|
|
493
|
+
}
|
|
494
|
+
if props.Config.Trace {
|
|
495
|
+
tail = append(tail, nativefactories.IdentifierFactory.Parameter(
|
|
496
|
+
"_exceptionable",
|
|
497
|
+
nativefactories.TypeFactory.Keyword("boolean"),
|
|
498
|
+
featureProgrammer_factory.NewKeywordExpression(shimast.KindTrueKeyword),
|
|
499
|
+
))
|
|
500
|
+
}
|
|
501
|
+
return append([]*shimast.Node{
|
|
502
|
+
nativefactories.IdentifierFactory.Parameter(props.Input, props.Type, nil),
|
|
503
|
+
}, tail...)
|
|
504
504
|
}
|
|
505
505
|
|
|
506
506
|
func featureProgrammer_object_functions(props FeatureProgrammer_ComposeProps, collection *nativemetadata.MetadataCollection) []*shimast.Node {
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
507
|
+
if props.Config.Generator.Objects != nil {
|
|
508
|
+
return props.Config.Generator.Objects(collection)
|
|
509
|
+
}
|
|
510
|
+
return featureProgrammer_write_object_functions(props.Config, props.Context, collection)
|
|
511
511
|
}
|
|
512
512
|
|
|
513
513
|
func featureProgrammer_union_functions(config FeatureProgrammer_IConfig, collection *nativemetadata.MetadataCollection) []*shimast.Node {
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
514
|
+
if config.Generator.Unions != nil {
|
|
515
|
+
if generated := config.Generator.Unions(collection); generated != nil {
|
|
516
|
+
return generated
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
return featureProgrammer_write_union_functions(config, collection)
|
|
520
520
|
}
|
|
521
521
|
|
|
522
522
|
func featureProgrammer_register_schema_unions(collection *nativemetadata.MetadataCollection, metadata *nativemetadata.MetadataSchema, visited map[*nativemetadata.MetadataSchema]bool) {
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
523
|
+
if collection == nil || metadata == nil || visited[metadata] {
|
|
524
|
+
return
|
|
525
|
+
}
|
|
526
|
+
visited[metadata] = true
|
|
527
|
+
|
|
528
|
+
if len(metadata.Objects) > 1 {
|
|
529
|
+
index := collection.GetUnionIndex(metadata)
|
|
530
|
+
metadata.Union_index = &index
|
|
531
|
+
}
|
|
532
|
+
if metadata.Escaped != nil {
|
|
533
|
+
featureProgrammer_register_schema_unions(collection, metadata.Escaped.Returns, visited)
|
|
534
|
+
}
|
|
535
|
+
if metadata.Rest != nil {
|
|
536
|
+
featureProgrammer_register_schema_unions(collection, metadata.Rest, visited)
|
|
537
|
+
}
|
|
538
|
+
for _, alias := range metadata.Aliases {
|
|
539
|
+
if alias.Type != nil {
|
|
540
|
+
featureProgrammer_register_schema_unions(collection, alias.Type.Value, visited)
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
for _, array := range metadata.Arrays {
|
|
544
|
+
if array.Type != nil {
|
|
545
|
+
featureProgrammer_register_schema_unions(collection, array.Type.Value, visited)
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
for _, tuple := range metadata.Tuples {
|
|
549
|
+
if tuple.Type != nil {
|
|
550
|
+
for _, element := range tuple.Type.Elements {
|
|
551
|
+
featureProgrammer_register_schema_unions(collection, element, visited)
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
for _, object := range metadata.Objects {
|
|
556
|
+
if object.Type != nil {
|
|
557
|
+
for _, property := range object.Type.Properties {
|
|
558
|
+
featureProgrammer_register_schema_unions(collection, property.Value, visited)
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
for _, set := range metadata.Sets {
|
|
563
|
+
featureProgrammer_register_schema_unions(collection, set.Value, visited)
|
|
564
|
+
}
|
|
565
|
+
for _, item := range metadata.Maps {
|
|
566
|
+
featureProgrammer_register_schema_unions(collection, item.Key, visited)
|
|
567
|
+
featureProgrammer_register_schema_unions(collection, item.Value, visited)
|
|
568
|
+
}
|
|
569
569
|
}
|
|
570
570
|
|
|
571
571
|
func featureProgrammer_write_object_functions(config FeatureProgrammer_IConfig, context nativecontext.ITypiaContext, collection *nativemetadata.MetadataCollection) []*shimast.Node {
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
572
|
+
objects := collection.Objects()
|
|
573
|
+
output := make([]*shimast.Node, 0, len(objects))
|
|
574
|
+
for _, object := range objects {
|
|
575
|
+
input := featureProgrammer_factory.NewIdentifier("input")
|
|
576
|
+
objectType := config.Objector.Type
|
|
577
|
+
if objectType == nil {
|
|
578
|
+
objectType = nativefactories.TypeFactory.Keyword("any")
|
|
579
|
+
}
|
|
580
|
+
output = append(output, nativefactories.StatementFactory.Constant(nativefactories.StatementFactory_ConstantProps{
|
|
581
|
+
Name: fmt.Sprintf("%so%d", config.Prefix, object.Index),
|
|
582
|
+
Value: featureProgrammer_factory.NewArrowFunction(
|
|
583
|
+
nil,
|
|
584
|
+
nil,
|
|
585
|
+
featureProgrammer_factory.NewNodeList(FeatureProgrammer.ParameterDeclarations(FeatureProgrammer_ParameterDeclarationsProps{
|
|
586
|
+
Config: FeatureProgrammer_ParameterConfig{Path: config.Path, Trace: config.Trace},
|
|
587
|
+
Type: nativefactories.TypeFactory.Keyword("any"),
|
|
588
|
+
Input: nativefactories.ValueFactory.INPUT(),
|
|
589
|
+
})),
|
|
590
|
+
objectType,
|
|
591
|
+
nil,
|
|
592
|
+
featureProgrammer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
593
|
+
config.Objector.Joiner(FeatureProgrammer_ObjectorJoinerProps{
|
|
594
|
+
Input: input,
|
|
595
|
+
Entries: nativeiterate.Feature_object_entries(nativeiterate.Feature_object_entriesProps{
|
|
596
|
+
Config: nativeiterate.Feature_object_entriesConfig{
|
|
597
|
+
Path: config.Path,
|
|
598
|
+
Trace: config.Trace,
|
|
599
|
+
Decoder: func(next nativeiterate.Feature_object_entriesDecoderProps) *shimast.Node {
|
|
600
|
+
return config.Decoder(FeatureProgrammer_DecoderProps{
|
|
601
|
+
Input: next.Input,
|
|
602
|
+
Metadata: next.Metadata,
|
|
603
|
+
Explore: featureProgrammer_from_iterate_explore(next.Explore),
|
|
604
|
+
})
|
|
605
|
+
},
|
|
606
|
+
},
|
|
607
|
+
Context: context,
|
|
608
|
+
Input: input,
|
|
609
|
+
Object: object,
|
|
610
|
+
}),
|
|
611
|
+
Object: object,
|
|
612
|
+
}),
|
|
613
|
+
),
|
|
614
|
+
}))
|
|
615
|
+
}
|
|
616
|
+
return output
|
|
617
617
|
}
|
|
618
618
|
|
|
619
619
|
func featureProgrammer_write_union_functions(config FeatureProgrammer_IConfig, collection *nativemetadata.MetadataCollection) []*shimast.Node {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
620
|
+
unions := collection.Unions()
|
|
621
|
+
output := make([]*shimast.Node, 0, len(unions))
|
|
622
|
+
for i, union := range unions {
|
|
623
|
+
output = append(output, nativefactories.StatementFactory.Constant(nativefactories.StatementFactory_ConstantProps{
|
|
624
|
+
Name: fmt.Sprintf("%su%d", config.Prefix, i),
|
|
625
|
+
Value: featureProgrammer_write_union(struct {
|
|
626
|
+
Config FeatureProgrammer_IConfig
|
|
627
|
+
Objects []*nativemetadata.MetadataObjectType
|
|
628
|
+
}{Config: config, Objects: union}),
|
|
629
|
+
}))
|
|
630
|
+
}
|
|
631
|
+
return output
|
|
632
632
|
}
|
|
633
633
|
|
|
634
634
|
func featureProgrammer_write_union(props struct {
|
|
635
|
-
|
|
636
|
-
|
|
635
|
+
Config FeatureProgrammer_IConfig
|
|
636
|
+
Objects []*nativemetadata.MetadataObjectType
|
|
637
637
|
}) *shimast.Node {
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
638
|
+
return featureProgrammer_factory.NewArrowFunction(
|
|
639
|
+
nil,
|
|
640
|
+
nil,
|
|
641
|
+
featureProgrammer_factory.NewNodeList(FeatureProgrammer.ParameterDeclarations(FeatureProgrammer_ParameterDeclarationsProps{
|
|
642
|
+
Config: FeatureProgrammer_ParameterConfig{Path: props.Config.Path, Trace: props.Config.Trace},
|
|
643
|
+
Type: nativefactories.TypeFactory.Keyword("any"),
|
|
644
|
+
Input: nativefactories.ValueFactory.INPUT(),
|
|
645
|
+
})),
|
|
646
|
+
nativefactories.TypeFactory.Keyword("any"),
|
|
647
|
+
nil,
|
|
648
|
+
featureProgrammer_factory.NewToken(shimast.KindEqualsGreaterThanToken),
|
|
649
|
+
nativehelpers.UnionExplorer.Object(nativehelpers.UnionExplorer_ObjectProps{
|
|
650
|
+
Config: nativehelpers.UnionExplorer_ObjectConfig{
|
|
651
|
+
Objector: featureProgrammer_union_objector(props.Config.Objector),
|
|
652
|
+
},
|
|
653
|
+
Objects: props.Objects,
|
|
654
|
+
Input: nativefactories.ValueFactory.INPUT(),
|
|
655
|
+
Explore: FeatureProgrammer_IExplore{
|
|
656
|
+
Tracable: props.Config.Path || props.Config.Trace,
|
|
657
|
+
Source: "function",
|
|
658
|
+
From: "object",
|
|
659
|
+
Postfix: "",
|
|
660
|
+
},
|
|
661
|
+
}),
|
|
662
|
+
)
|
|
663
663
|
}
|
|
664
664
|
|
|
665
665
|
func featureProgrammer_union_objector(objector FeatureProgrammer_IConfig_IObjector) nativehelpers.UnionExplorer_IObjector {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
666
|
+
return nativehelpers.UnionExplorer_IObjector{
|
|
667
|
+
Checker: func(props nativehelpers.UnionExplorer_ObjectorCheckerProps) *shimast.Node {
|
|
668
|
+
return objector.Checker(FeatureProgrammer_ObjectorCheckerProps{
|
|
669
|
+
Metadata: props.Metadata,
|
|
670
|
+
Input: props.Input,
|
|
671
|
+
Explore: featureProgrammer_as_explore(props.Explore),
|
|
672
|
+
})
|
|
673
|
+
},
|
|
674
|
+
Decoder: func(props nativehelpers.UnionExplorer_ObjectorDecoderProps) *shimast.Node {
|
|
675
|
+
return objector.Decoder(FeatureProgrammer_ObjectorDecoderProps{
|
|
676
|
+
Input: props.Input,
|
|
677
|
+
Object: props.Object,
|
|
678
|
+
Explore: featureProgrammer_as_explore(props.Explore),
|
|
679
|
+
})
|
|
680
|
+
},
|
|
681
|
+
Unionizer: func(props nativehelpers.UnionExplorer_ObjectorUnionizerProps) *shimast.Node {
|
|
682
|
+
return objector.Unionizer(FeatureProgrammer_ObjectorUnionizerProps{
|
|
683
|
+
Objects: props.Objects,
|
|
684
|
+
Input: props.Input,
|
|
685
|
+
Explore: featureProgrammer_as_explore(props.Explore),
|
|
686
|
+
})
|
|
687
|
+
},
|
|
688
|
+
Failure: func(props nativehelpers.UnionExplorer_ObjectorFailureProps) *shimast.Node {
|
|
689
|
+
explore := featureProgrammer_as_explore(props.Explore)
|
|
690
|
+
return objector.Failure(FeatureProgrammer_ObjectorFailureProps{
|
|
691
|
+
Input: props.Input,
|
|
692
|
+
Expected: props.Expected,
|
|
693
|
+
Explore: &explore,
|
|
694
|
+
})
|
|
695
|
+
},
|
|
696
|
+
Is: objector.Is,
|
|
697
|
+
Required: objector.Required,
|
|
698
|
+
Full: func(props nativehelpers.UnionExplorer_ObjectorFullProps) *shimast.Node {
|
|
699
|
+
if objector.Full == nil {
|
|
700
|
+
return props.Condition
|
|
701
|
+
}
|
|
702
|
+
return objector.Full(FeatureProgrammer_ObjectorFullProps{
|
|
703
|
+
Condition: props.Condition,
|
|
704
|
+
Input: props.Input,
|
|
705
|
+
Expected: props.Expected,
|
|
706
|
+
Explore: featureProgrammer_as_explore(props.Explore),
|
|
707
|
+
})
|
|
708
|
+
},
|
|
709
|
+
Type: objector.Type,
|
|
710
|
+
}
|
|
711
711
|
}
|
|
712
712
|
|
|
713
713
|
func featureProgrammer_from_iterate_explore(input nativeiterate.Feature_object_entriesExplore) FeatureProgrammer_IExplore {
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
714
|
+
return FeatureProgrammer_IExplore{
|
|
715
|
+
Tracable: input.Tracable,
|
|
716
|
+
Source: input.Source,
|
|
717
|
+
From: input.From,
|
|
718
|
+
Postfix: input.Postfix,
|
|
719
|
+
}
|
|
720
720
|
}
|
|
721
721
|
|
|
722
722
|
func featureProgrammer_as_explore(input any) FeatureProgrammer_IExplore {
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
723
|
+
switch value := input.(type) {
|
|
724
|
+
case FeatureProgrammer_IExplore:
|
|
725
|
+
return value
|
|
726
|
+
case *FeatureProgrammer_IExplore:
|
|
727
|
+
return *value
|
|
728
|
+
case map[string]any:
|
|
729
|
+
output := FeatureProgrammer_IExplore{}
|
|
730
|
+
if v, ok := value["tracable"].(bool); ok {
|
|
731
|
+
output.Tracable = v
|
|
732
|
+
}
|
|
733
|
+
if v, ok := value["source"].(string); ok {
|
|
734
|
+
output.Source = v
|
|
735
|
+
}
|
|
736
|
+
if v, ok := value["from"].(string); ok {
|
|
737
|
+
output.From = v
|
|
738
|
+
}
|
|
739
|
+
if v, ok := value["postfix"].(string); ok {
|
|
740
|
+
output.Postfix = v
|
|
741
|
+
}
|
|
742
|
+
if v, ok := value["start"].(int); ok {
|
|
743
|
+
output.Start = &v
|
|
744
|
+
}
|
|
745
|
+
return output
|
|
746
|
+
default:
|
|
747
|
+
return FeatureProgrammer_IExplore{}
|
|
748
|
+
}
|
|
749
749
|
}
|