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,15 +1,15 @@
|
|
|
1
1
|
package factories
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
"fmt"
|
|
5
|
+
"math"
|
|
6
|
+
"sort"
|
|
7
|
+
"strings"
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
shimchecker "github.com/microsoft/typescript-go/shim/checker"
|
|
10
|
+
nativecontext "github.com/samchon/typia/packages/typia/native/core/context"
|
|
11
|
+
schemametadata "github.com/samchon/typia/packages/typia/native/core/schemas/metadata"
|
|
12
|
+
nativeprotobuf "github.com/samchon/typia/packages/typia/native/core/schemas/protobuf"
|
|
13
13
|
)
|
|
14
14
|
|
|
15
15
|
type protobufFactoryNamespace struct{}
|
|
@@ -17,1052 +17,1052 @@ type protobufFactoryNamespace struct{}
|
|
|
17
17
|
var ProtobufFactory = protobufFactoryNamespace{}
|
|
18
18
|
|
|
19
19
|
type ProtobufFactory_IProps struct {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
Method string
|
|
21
|
+
Checker *shimchecker.Checker
|
|
22
|
+
Transformer any
|
|
23
|
+
Components *schemametadata.MetadataCollection
|
|
24
|
+
Type *shimchecker.Type
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
func (protobufFactoryNamespace) Metadata(props ProtobufFactory_IProps) *schemametadata.MetadataSchema {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
28
|
+
result := MetadataFactory.Analyze(MetadataFactory_IProps{
|
|
29
|
+
Checker: props.Checker,
|
|
30
|
+
Transformer: props.Transformer,
|
|
31
|
+
Options: MetadataFactory_IOptions{
|
|
32
|
+
Escape: false,
|
|
33
|
+
Constant: true,
|
|
34
|
+
Absorb: true,
|
|
35
|
+
Validate: protobufFactory_validate(),
|
|
36
|
+
},
|
|
37
|
+
Components: props.Components,
|
|
38
|
+
Type: props.Type,
|
|
39
|
+
})
|
|
40
|
+
if result.Success == false {
|
|
41
|
+
panic(nativecontext.TransformerError_from(struct {
|
|
42
|
+
Code string
|
|
43
|
+
Errors []nativecontext.TransformerError_MetadataFactory_IError
|
|
44
|
+
}{
|
|
45
|
+
Code: "typia.protobuf." + props.Method,
|
|
46
|
+
Errors: protobufFactory_errors(result.Errors),
|
|
47
|
+
}))
|
|
48
|
+
}
|
|
49
|
+
return result.Data
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
func (protobufFactoryNamespace) EmplaceObject(object *schemametadata.MetadataObjectType) {
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
53
|
+
for _, property := range object.Properties {
|
|
54
|
+
protobufFactory_emplaceProperty(property)
|
|
55
|
+
}
|
|
56
|
+
properties := []*nativeprotobuf.IProtobufProperty{}
|
|
57
|
+
for _, property := range object.Properties {
|
|
58
|
+
if property.Of_protobuf_ != nil {
|
|
59
|
+
properties = append(properties, property.Of_protobuf_)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
unique := map[int]bool{}
|
|
63
|
+
for _, property := range properties {
|
|
64
|
+
if property.Fixed == false {
|
|
65
|
+
continue
|
|
66
|
+
}
|
|
67
|
+
for _, union := range property.Union {
|
|
68
|
+
if index := protobufFactory_propertyIndex(union); index != nil {
|
|
69
|
+
unique[*index] = true
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
index := 1
|
|
74
|
+
for _, schema := range properties {
|
|
75
|
+
if schema.Fixed {
|
|
76
|
+
for _, union := range schema.Union {
|
|
77
|
+
if next := protobufFactory_propertyIndex(union); next != nil && *next >= index {
|
|
78
|
+
index = *next + 1
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
continue
|
|
82
|
+
}
|
|
83
|
+
for _, union := range schema.Union {
|
|
84
|
+
for unique[index] {
|
|
85
|
+
index++
|
|
86
|
+
}
|
|
87
|
+
protobufFactory_setPropertyIndex(union, index)
|
|
88
|
+
unique[index] = true
|
|
89
|
+
}
|
|
90
|
+
index++
|
|
91
|
+
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
func protobufFactory_emplaceProperty(prop *schemametadata.MetadataProperty) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
|
|
95
|
+
union := []nativeprotobuf.IProtobufPropertyType{}
|
|
96
|
+
for _, native := range prop.Value.Natives {
|
|
97
|
+
if native.Name == "Uint8Array" {
|
|
98
|
+
union = append(union, &nativeprotobuf.IProtobufPropertyType_IByte{
|
|
99
|
+
IProtobufSchema_IByte: nativeprotobuf.IProtobufSchema_IByte{Type: "bytes"},
|
|
100
|
+
Index: protobufFactory_getSequence(protobufFactory_firstTagRow(native.Tags)),
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
union = append(union, protobufFactory_emplaceAtomic(prop.Value)...)
|
|
105
|
+
for _, array := range prop.Value.Arrays {
|
|
106
|
+
union = append(union, &nativeprotobuf.IProtobufPropertyType_IArray{
|
|
107
|
+
IProtobufSchema_IArray: nativeprotobuf.IProtobufSchema_IArray{
|
|
108
|
+
Type: "array",
|
|
109
|
+
Array: array.Type,
|
|
110
|
+
Value: protobufFactory_emplaceSchema(array.Type.Value),
|
|
111
|
+
},
|
|
112
|
+
Index: protobufFactory_getSequence(protobufFactory_firstTagRow(array.Tags)),
|
|
113
|
+
})
|
|
114
|
+
}
|
|
115
|
+
for _, obj := range prop.Value.Objects {
|
|
116
|
+
if protobufFactory_isDynamicObject(obj.Type) {
|
|
117
|
+
union = append(union, &nativeprotobuf.IProtobufPropertyType_IMap{
|
|
118
|
+
IProtobufSchema_IMap: nativeprotobuf.IProtobufSchema_IMap{
|
|
119
|
+
Type: "map",
|
|
120
|
+
Map: obj.Type,
|
|
121
|
+
Key: protobufFactory_emplaceSchema(obj.Type.Properties[0].Key),
|
|
122
|
+
Value: protobufFactory_emplaceSchema(obj.Type.Properties[0].Value),
|
|
123
|
+
},
|
|
124
|
+
Index: protobufFactory_getSequence(protobufFactory_firstTagRow(obj.Tags)),
|
|
125
|
+
})
|
|
126
|
+
} else {
|
|
127
|
+
union = append(union, &nativeprotobuf.IProtobufPropertyType_IObject{
|
|
128
|
+
IProtobufSchema_IObject: nativeprotobuf.IProtobufSchema_IObject{Type: "object", Object: obj.Type},
|
|
129
|
+
Index: protobufFactory_getSequence(protobufFactory_firstTagRow(obj.Tags)),
|
|
130
|
+
})
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
for _, entry := range prop.Value.Maps {
|
|
134
|
+
union = append(union, &nativeprotobuf.IProtobufPropertyType_IMap{
|
|
135
|
+
IProtobufSchema_IMap: nativeprotobuf.IProtobufSchema_IMap{
|
|
136
|
+
Type: "map",
|
|
137
|
+
Map: entry,
|
|
138
|
+
Key: protobufFactory_emplaceSchema(entry.Key),
|
|
139
|
+
Value: protobufFactory_emplaceSchema(entry.Value),
|
|
140
|
+
},
|
|
141
|
+
Index: protobufFactory_getSequence(protobufFactory_firstTagRow(entry.Tags)),
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
fixed := true
|
|
145
|
+
for _, elem := range union {
|
|
146
|
+
if protobufFactory_propertyIndex(elem) == nil {
|
|
147
|
+
fixed = false
|
|
148
|
+
break
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
prop.Of_protobuf_ = &nativeprotobuf.IProtobufProperty{
|
|
152
|
+
Union: union,
|
|
153
|
+
Fixed: fixed,
|
|
154
|
+
}
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
func protobufFactory_emplaceSchema(metadata *schemametadata.MetadataSchema) nativeprotobuf.IProtobufSchema {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
158
|
+
for _, native := range metadata.Natives {
|
|
159
|
+
if native.Name == "Uint8Array" {
|
|
160
|
+
return nativeprotobuf.IProtobufSchema_IByte{Type: "bytes"}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
atomic := protobufFactory_emplaceAtomic(metadata)
|
|
164
|
+
if len(atomic) != 0 {
|
|
165
|
+
return atomic[0]
|
|
166
|
+
}
|
|
167
|
+
for _, array := range metadata.Arrays {
|
|
168
|
+
return nativeprotobuf.IProtobufSchema_IArray{
|
|
169
|
+
Type: "array",
|
|
170
|
+
Array: array.Type,
|
|
171
|
+
Value: protobufFactory_emplaceSchema(array.Type.Value),
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
for _, obj := range metadata.Objects {
|
|
175
|
+
if protobufFactory_isDynamicObject(obj.Type) {
|
|
176
|
+
return nativeprotobuf.IProtobufSchema_IMap{
|
|
177
|
+
Type: "map",
|
|
178
|
+
Map: obj.Type,
|
|
179
|
+
Key: protobufFactory_emplaceSchema(obj.Type.Properties[0].Key),
|
|
180
|
+
Value: protobufFactory_emplaceSchema(obj.Type.Properties[0].Value),
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return nativeprotobuf.IProtobufSchema_IObject{Type: "object", Object: obj.Type}
|
|
184
|
+
}
|
|
185
|
+
for _, entry := range metadata.Maps {
|
|
186
|
+
return nativeprotobuf.IProtobufSchema_IMap{
|
|
187
|
+
Type: "map",
|
|
188
|
+
Map: entry,
|
|
189
|
+
Key: protobufFactory_emplaceSchema(entry.Key),
|
|
190
|
+
Value: protobufFactory_emplaceSchema(entry.Value),
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
panic("Error on ProtobufFactory.emplaceSchema(): any type detected.")
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
func protobufFactory_emplaceAtomic(meta *schemametadata.MetadataSchema) []nativeprotobuf.IProtobufPropertyType {
|
|
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
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
197
|
+
values := map[string]nativeprotobuf.IProtobufPropertyType{}
|
|
198
|
+
for _, constant := range meta.Constants {
|
|
199
|
+
if constant.Type == "boolean" {
|
|
200
|
+
values["bool"] = &nativeprotobuf.IProtobufPropertyType_IBoolean{
|
|
201
|
+
IProtobufSchema_IBoolean: nativeprotobuf.IProtobufSchema_IBoolean{Type: "bool"},
|
|
202
|
+
Index: protobufFactory_getSequence(protobufFactory_firstTags(constant.Values)),
|
|
203
|
+
}
|
|
204
|
+
} else if constant.Type == "bigint" {
|
|
205
|
+
init := protobufFactory_getBigintType(protobufFactory_constantValues(constant.Values))
|
|
206
|
+
for _, value := range constant.Values {
|
|
207
|
+
protobufFactory_emplaceBigint(values, value.Tags, init)
|
|
208
|
+
}
|
|
209
|
+
} else if constant.Type == "number" {
|
|
210
|
+
init := protobufFactory_getNumberType(protobufFactory_constantValues(constant.Values))
|
|
211
|
+
for _, value := range constant.Values {
|
|
212
|
+
protobufFactory_emplaceNumber(values, value.Tags, init)
|
|
213
|
+
}
|
|
214
|
+
} else if constant.Type == "string" {
|
|
215
|
+
values["string"] = &nativeprotobuf.IProtobufPropertyType_IString{
|
|
216
|
+
IProtobufSchema_IString: nativeprotobuf.IProtobufSchema_IString{Type: "string"},
|
|
217
|
+
Index: protobufFactory_getSequence(protobufFactory_firstTags(constant.Values)),
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if len(meta.Templates) != 0 {
|
|
222
|
+
values["string"] = &nativeprotobuf.IProtobufPropertyType_IString{
|
|
223
|
+
IProtobufSchema_IString: nativeprotobuf.IProtobufSchema_IString{Type: "string"},
|
|
224
|
+
Index: protobufFactory_getSequence(protobufFactory_firstTagRow(meta.Templates[0].Tags)),
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
for _, atomic := range meta.Atomics {
|
|
228
|
+
if atomic.Type == "boolean" {
|
|
229
|
+
values["bool"] = &nativeprotobuf.IProtobufPropertyType_IBoolean{
|
|
230
|
+
IProtobufSchema_IBoolean: nativeprotobuf.IProtobufSchema_IBoolean{Type: "bool"},
|
|
231
|
+
Index: protobufFactory_getSequence(protobufFactory_firstTagRow(atomic.Tags)),
|
|
232
|
+
}
|
|
233
|
+
} else if atomic.Type == "bigint" {
|
|
234
|
+
protobufFactory_emplaceBigint(values, atomic.Tags, "int64")
|
|
235
|
+
} else if atomic.Type == "number" {
|
|
236
|
+
protobufFactory_emplaceNumber(values, atomic.Tags, "double")
|
|
237
|
+
} else if atomic.Type == "string" {
|
|
238
|
+
values["string"] = &nativeprotobuf.IProtobufPropertyType_IString{
|
|
239
|
+
IProtobufSchema_IString: nativeprotobuf.IProtobufSchema_IString{Type: "string"},
|
|
240
|
+
Index: protobufFactory_getSequence(protobufFactory_firstTagRow(atomic.Tags)),
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
keys := make([]string, 0, len(values))
|
|
245
|
+
for key := range values {
|
|
246
|
+
keys = append(keys, key)
|
|
247
|
+
}
|
|
248
|
+
sort.Slice(keys, func(i, j int) bool {
|
|
249
|
+
return protobufFactory_compare(keys[i], keys[j]) < 0
|
|
250
|
+
})
|
|
251
|
+
output := make([]nativeprotobuf.IProtobufPropertyType, 0, len(keys))
|
|
252
|
+
for _, key := range keys {
|
|
253
|
+
output = append(output, values[key])
|
|
254
|
+
}
|
|
255
|
+
return output
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
func protobufFactory_emplaceBigint(output map[string]nativeprotobuf.IProtobufPropertyType, tags [][]schemametadata.IMetadataTypeTag, init string) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
259
|
+
if len(tags) == 0 {
|
|
260
|
+
output[init] = &nativeprotobuf.IProtobufPropertyType_IBigint{
|
|
261
|
+
IProtobufSchema_IBigint: nativeprotobuf.IProtobufSchema_IBigint{Type: "bigint", Name: init},
|
|
262
|
+
Index: nil,
|
|
263
|
+
}
|
|
264
|
+
return
|
|
265
|
+
}
|
|
266
|
+
for _, row := range tags {
|
|
267
|
+
value := init
|
|
268
|
+
for _, tag := range row {
|
|
269
|
+
if tag.Kind == "type" && (tag.Value == "int64" || tag.Value == "uint64") {
|
|
270
|
+
value = fmt.Sprint(tag.Value)
|
|
271
|
+
break
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
output[init] = &nativeprotobuf.IProtobufPropertyType_IBigint{
|
|
275
|
+
IProtobufSchema_IBigint: nativeprotobuf.IProtobufSchema_IBigint{Type: "bigint", Name: value},
|
|
276
|
+
Index: protobufFactory_getSequence(row),
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
func protobufFactory_emplaceNumber(output map[string]nativeprotobuf.IProtobufPropertyType, tags [][]schemametadata.IMetadataTypeTag, init string) {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
282
|
+
if len(tags) == 0 {
|
|
283
|
+
output[init] = &nativeprotobuf.IProtobufPropertyType_INumber{
|
|
284
|
+
IProtobufSchema_INumber: nativeprotobuf.IProtobufSchema_INumber{Type: "number", Name: init},
|
|
285
|
+
Index: nil,
|
|
286
|
+
}
|
|
287
|
+
return
|
|
288
|
+
}
|
|
289
|
+
for _, row := range tags {
|
|
290
|
+
value := init
|
|
291
|
+
for _, tag := range row {
|
|
292
|
+
if tag.Kind != "type" {
|
|
293
|
+
continue
|
|
294
|
+
}
|
|
295
|
+
str := fmt.Sprint(tag.Value)
|
|
296
|
+
if str == "int32" || str == "uint32" || str == "int64" || str == "uint64" || str == "float" || str == "double" {
|
|
297
|
+
value = str
|
|
298
|
+
break
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
output[value] = &nativeprotobuf.IProtobufPropertyType_INumber{
|
|
302
|
+
IProtobufSchema_INumber: nativeprotobuf.IProtobufSchema_INumber{Type: "number", Name: value},
|
|
303
|
+
Index: protobufFactory_getSequence(row),
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
306
|
}
|
|
307
307
|
|
|
308
308
|
func protobufFactory_validate() MetadataFactory_Validator {
|
|
309
|
-
|
|
310
|
-
|
|
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
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
309
|
+
visited := map[*schemametadata.MetadataObjectType]bool{}
|
|
310
|
+
return func(props struct {
|
|
311
|
+
Metadata *schemametadata.MetadataSchema
|
|
312
|
+
Explore MetadataFactory_IExplore
|
|
313
|
+
Top *schemametadata.MetadataSchema
|
|
314
|
+
}) []string {
|
|
315
|
+
errors := []string{}
|
|
316
|
+
insert := func(msg string) { errors = append(errors, msg) }
|
|
317
|
+
if props.Explore.Top == true {
|
|
318
|
+
onlyObject := props.Metadata.Size() == 1 &&
|
|
319
|
+
len(props.Metadata.Objects) == 1 &&
|
|
320
|
+
props.Metadata.IsRequired() == true &&
|
|
321
|
+
props.Metadata.Nullable == false
|
|
322
|
+
if onlyObject && len(props.Metadata.Objects) != 0 {
|
|
323
|
+
for _, property := range props.Metadata.Objects[0].Type.Properties {
|
|
324
|
+
if property.Key.IsSoleLiteral() == false {
|
|
325
|
+
onlyObject = false
|
|
326
|
+
break
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
if onlyObject == false {
|
|
331
|
+
insert("target type must be a sole and static object type")
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
for _, obj := range props.Metadata.Objects {
|
|
335
|
+
if visited[obj.Type] {
|
|
336
|
+
continue
|
|
337
|
+
}
|
|
338
|
+
visited[obj.Type] = true
|
|
339
|
+
protobufFactory_validateObject(obj.Type, &errors)
|
|
340
|
+
func() {
|
|
341
|
+
defer func() { _ = recover() }()
|
|
342
|
+
ProtobufFactory.EmplaceObject(obj.Type)
|
|
343
|
+
}()
|
|
344
|
+
}
|
|
345
|
+
noSupport := func(msg string) { insert("does not support " + msg) }
|
|
346
|
+
if props.Metadata.Any {
|
|
347
|
+
noSupport("any type")
|
|
348
|
+
}
|
|
349
|
+
if len(props.Metadata.Functions) != 0 {
|
|
350
|
+
noSupport("functional type")
|
|
351
|
+
}
|
|
352
|
+
if len(props.Metadata.Tuples) != 0 {
|
|
353
|
+
noSupport("tuple type")
|
|
354
|
+
}
|
|
355
|
+
if len(props.Metadata.Sets) != 0 {
|
|
356
|
+
noSupport("Set type")
|
|
357
|
+
}
|
|
358
|
+
for _, native := range props.Metadata.Natives {
|
|
359
|
+
if native.Name == "Uint8Array" {
|
|
360
|
+
continue
|
|
361
|
+
}
|
|
362
|
+
if instead, ok := protobufFactory_BANNED_NATIVE_TYPES[native.Name]; ok {
|
|
363
|
+
noSupport(native.Name + " type. Use " + instead + " type instead.")
|
|
364
|
+
} else {
|
|
365
|
+
noSupport(native.Name + " type")
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
if len(props.Metadata.Atomics) != 0 {
|
|
369
|
+
numbers := protobufFactory_getNumbers(props.Metadata)
|
|
370
|
+
bigints := protobufFactory_getBigints(props.Metadata)
|
|
371
|
+
for _, typ := range []string{"int64", "uint64"} {
|
|
372
|
+
if _, ok := numbers[typ]; ok {
|
|
373
|
+
if _, found := bigints[typ]; found {
|
|
374
|
+
insert("tags.Type<\"" + typ + "\"> cannot be used in both number and bigint types. Recommend to remove from number type")
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
protobufFactory_validateShape(props.Metadata, noSupport)
|
|
380
|
+
return errors
|
|
381
|
+
}
|
|
382
382
|
}
|
|
383
383
|
|
|
384
384
|
func protobufFactory_validateShape(metadata *schemametadata.MetadataSchema, noSupport func(string)) {
|
|
385
|
-
|
|
386
|
-
|
|
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
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
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
|
-
|
|
385
|
+
if len(metadata.Arrays) != 0 {
|
|
386
|
+
for _, array := range metadata.Arrays {
|
|
387
|
+
if len(array.Type.Value.Arrays) != 0 {
|
|
388
|
+
noSupport("over two dimensional array type")
|
|
389
|
+
break
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
for _, array := range metadata.Arrays {
|
|
393
|
+
if array.Type.Value.IsRequired() == false || array.Type.Value.Nullable {
|
|
394
|
+
noSupport("optional type in array")
|
|
395
|
+
break
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
for _, array := range metadata.Arrays {
|
|
399
|
+
if array.Type.Value.Size() > 1 && len(array.Type.Value.Constants) != 1 {
|
|
400
|
+
noSupport("union type in array")
|
|
401
|
+
break
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
for _, array := range metadata.Arrays {
|
|
405
|
+
if len(array.Type.Value.Maps) != 0 {
|
|
406
|
+
noSupport("dynamic object in array")
|
|
407
|
+
break
|
|
408
|
+
}
|
|
409
|
+
for _, obj := range array.Type.Value.Objects {
|
|
410
|
+
if protobufFactory_isStaticObject(obj.Type) == false {
|
|
411
|
+
noSupport("dynamic object in array")
|
|
412
|
+
break
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
if metadata.Size() > 1 {
|
|
417
|
+
noSupport("union type with array type")
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
if len(metadata.Objects) != 0 {
|
|
421
|
+
for _, obj := range metadata.Objects {
|
|
422
|
+
if len(obj.Type.Properties) == 0 {
|
|
423
|
+
noSupport("empty object type")
|
|
424
|
+
break
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
for _, obj := range metadata.Objects {
|
|
428
|
+
dynamic := 0
|
|
429
|
+
static := 0
|
|
430
|
+
for _, property := range obj.Type.Properties {
|
|
431
|
+
if property.Key.IsSoleLiteral() {
|
|
432
|
+
static++
|
|
433
|
+
} else {
|
|
434
|
+
dynamic++
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
if dynamic > 1 {
|
|
438
|
+
noSupport("object type with multiple dynamic key typed properties. Keep only one.")
|
|
439
|
+
}
|
|
440
|
+
if static != 0 && dynamic != 0 {
|
|
441
|
+
noSupport("object type with mixed static and dynamic key typed properties. Keep statics or dynamic only.")
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
if protobufFactory_isDynamicObject(metadata.Objects[0].Type) {
|
|
445
|
+
for _, property := range metadata.Objects[0].Type.Properties {
|
|
446
|
+
if len(property.Value.Arrays) != 0 {
|
|
447
|
+
noSupport("dynamic object with array value type")
|
|
448
|
+
break
|
|
449
|
+
}
|
|
450
|
+
if protobufFactory_isUnion(property.Value) {
|
|
451
|
+
noSupport("union type in dynamic property")
|
|
452
|
+
break
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
if metadata.Size() > 1 {
|
|
456
|
+
noSupport("union type with dynamic object type")
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
if len(metadata.Maps) != 0 {
|
|
461
|
+
for _, entry := range metadata.Maps {
|
|
462
|
+
if protobufFactory_isUnion(entry.Key) {
|
|
463
|
+
noSupport("union key typed map")
|
|
464
|
+
}
|
|
465
|
+
if len(protobufFactory_getAtomics(entry.Key)) != 1 {
|
|
466
|
+
noSupport("non-atomic key typed map")
|
|
467
|
+
}
|
|
468
|
+
if entry.Key.IsRequired() == false || entry.Key.Nullable {
|
|
469
|
+
noSupport("optional key typed map")
|
|
470
|
+
}
|
|
471
|
+
if len(entry.Value.Arrays) != 0 {
|
|
472
|
+
noSupport("map type with array value type")
|
|
473
|
+
}
|
|
474
|
+
if protobufFactory_isUnion(entry.Value) {
|
|
475
|
+
noSupport("union type in map value type")
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
if metadata.Size() > 1 {
|
|
479
|
+
noSupport("union type with map type")
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
482
|
}
|
|
483
483
|
|
|
484
484
|
func protobufFactory_validateObject(object *schemametadata.MetadataObjectType, errors *[]string) {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
485
|
+
for _, property := range object.Properties {
|
|
486
|
+
protobufFactory_validateProperty(property.Value, errors)
|
|
487
|
+
}
|
|
488
|
+
entire := map[int]string{}
|
|
489
|
+
for _, property := range object.Properties {
|
|
490
|
+
local := map[int]bool{}
|
|
491
|
+
tagger := func(matrix [][]schemametadata.IMetadataTypeTag) {
|
|
492
|
+
for _, tags := range matrix {
|
|
493
|
+
if value := protobufFactory_getSequence(tags); value != nil {
|
|
494
|
+
local[*value] = true
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
for _, c := range property.Value.Constants {
|
|
499
|
+
for _, v := range c.Values {
|
|
500
|
+
tagger(v.Tags)
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
for _, a := range property.Value.Atomics {
|
|
504
|
+
tagger(a.Tags)
|
|
505
|
+
}
|
|
506
|
+
for _, t := range property.Value.Templates {
|
|
507
|
+
tagger(t.Tags)
|
|
508
|
+
}
|
|
509
|
+
for _, o := range property.Value.Objects {
|
|
510
|
+
tagger(o.Tags)
|
|
511
|
+
}
|
|
512
|
+
for _, a := range property.Value.Arrays {
|
|
513
|
+
tagger(a.Tags)
|
|
514
|
+
}
|
|
515
|
+
for sequence := range local {
|
|
516
|
+
name := ""
|
|
517
|
+
if property.Key.GetSoleLiteral() != nil {
|
|
518
|
+
name = *property.Key.GetSoleLiteral()
|
|
519
|
+
}
|
|
520
|
+
if prev, ok := entire[sequence]; ok {
|
|
521
|
+
*errors = append(*errors, fmt.Sprintf("The Sequence<%d> tag is duplicated in two properties (%q and %q)", sequence, prev, name))
|
|
522
|
+
} else {
|
|
523
|
+
entire[sequence] = name
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
527
|
}
|
|
528
528
|
|
|
529
529
|
func protobufFactory_validateProperty(metadata *schemametadata.MetadataSchema, errors *[]string) {
|
|
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
|
-
|
|
530
|
+
sequences := map[int]bool{}
|
|
531
|
+
add := func(value int) bool {
|
|
532
|
+
if sequences[value] {
|
|
533
|
+
return false
|
|
534
|
+
}
|
|
535
|
+
sequences[value] = true
|
|
536
|
+
return true
|
|
537
|
+
}
|
|
538
|
+
protobufFactory_validateBooleanSequence(metadata, errors, add)
|
|
539
|
+
protobufFactory_validateNumericSequences(metadata, errors, add, "bigint", "int64", protobufFactory_BIGINT_TYPES)
|
|
540
|
+
protobufFactory_validateNumericSequences(metadata, errors, add, "number", "double", protobufFactory_NUMBER_TYPES)
|
|
541
|
+
protobufFactory_validateStringSequence(metadata, errors, add)
|
|
542
|
+
for _, array := range metadata.Arrays {
|
|
543
|
+
protobufFactory_validateInstanceSequence("array", array.Tags, errors, add)
|
|
544
|
+
}
|
|
545
|
+
for _, object := range metadata.Objects {
|
|
546
|
+
protobufFactory_validateInstanceSequence("object", object.Tags, errors, add)
|
|
547
|
+
}
|
|
548
|
+
for _, entry := range metadata.Maps {
|
|
549
|
+
protobufFactory_validateInstanceSequence("map", entry.Tags, errors, add)
|
|
550
|
+
}
|
|
551
|
+
for _, native := range metadata.Natives {
|
|
552
|
+
if native.Name == "Uint8Array" {
|
|
553
|
+
protobufFactory_validateInstanceSequence("Uint8Array", native.Tags, errors, add)
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
556
|
}
|
|
557
557
|
|
|
558
558
|
func protobufFactory_validateBooleanSequence(metadata *schemametadata.MetadataSchema, errors *[]string, add func(int) bool) {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
559
|
+
unique, expected, actual := map[int]bool{}, 0, 0
|
|
560
|
+
emplace := func(matrix [][]schemametadata.IMetadataTypeTag) {
|
|
561
|
+
for _, tags := range matrix {
|
|
562
|
+
for _, tag := range tags {
|
|
563
|
+
if sequence := protobufFactory_getSequence([]schemametadata.IMetadataTypeTag{tag}); sequence != nil {
|
|
564
|
+
unique[*sequence] = true
|
|
565
|
+
actual++
|
|
566
|
+
}
|
|
567
|
+
expected++
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
for _, atomic := range metadata.Atomics {
|
|
572
|
+
if atomic.Type == "boolean" {
|
|
573
|
+
emplace(atomic.Tags)
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
for _, constant := range metadata.Constants {
|
|
577
|
+
if constant.Type == "boolean" {
|
|
578
|
+
for _, value := range constant.Values {
|
|
579
|
+
emplace(value.Tags)
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
protobufFactory_validateUniqueSequence("boolean type", unique, expected, actual, errors, add)
|
|
584
584
|
}
|
|
585
585
|
|
|
586
586
|
func protobufFactory_validateNumericSequences(metadata *schemametadata.MetadataSchema, errors *[]string, add func(int) bool, typ string, def string, categories map[string]bool) {
|
|
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
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
587
|
+
foundCategories := map[string]bool{}
|
|
588
|
+
getType := func(tags []schemametadata.IMetadataTypeTag) string {
|
|
589
|
+
for _, tag := range tags {
|
|
590
|
+
if tag.Kind == "type" && categories[fmt.Sprint(tag.Value)] {
|
|
591
|
+
return fmt.Sprint(tag.Value)
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
return def
|
|
595
|
+
}
|
|
596
|
+
for _, atomic := range metadata.Atomics {
|
|
597
|
+
if atomic.Type == typ {
|
|
598
|
+
for _, tags := range atomic.Tags {
|
|
599
|
+
foundCategories[getType(tags)] = true
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
for _, constant := range metadata.Constants {
|
|
604
|
+
if constant.Type == typ {
|
|
605
|
+
for _, value := range constant.Values {
|
|
606
|
+
for _, tags := range value.Tags {
|
|
607
|
+
foundCategories[getType(tags)] = true
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
for category := range foundCategories {
|
|
613
|
+
unique, expected, actual := map[int]bool{}, 0, 0
|
|
614
|
+
emplace := func(tags []schemametadata.IMetadataTypeTag) {
|
|
615
|
+
if sequence := protobufFactory_getSequence(tags); sequence != nil {
|
|
616
|
+
unique[*sequence] = true
|
|
617
|
+
actual++
|
|
618
|
+
}
|
|
619
|
+
expected++
|
|
620
|
+
}
|
|
621
|
+
for _, atomic := range metadata.Atomics {
|
|
622
|
+
if atomic.Type == typ {
|
|
623
|
+
for _, tags := range atomic.Tags {
|
|
624
|
+
if getType(tags) == category {
|
|
625
|
+
emplace(tags)
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
for _, constant := range metadata.Constants {
|
|
631
|
+
if constant.Type == typ {
|
|
632
|
+
for _, value := range constant.Values {
|
|
633
|
+
for _, tags := range value.Tags {
|
|
634
|
+
if getType(tags) == category {
|
|
635
|
+
emplace(tags)
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
protobufFactory_validateUniqueSequence(typ+" type", unique, expected, actual, errors, add)
|
|
642
|
+
}
|
|
643
643
|
}
|
|
644
644
|
|
|
645
645
|
func protobufFactory_validateStringSequence(metadata *schemametadata.MetadataSchema, errors *[]string, add func(int) bool) {
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
646
|
+
unique, expected, actual := map[int]bool{}, 0, 0
|
|
647
|
+
emplace := func(matrix [][]schemametadata.IMetadataTypeTag) {
|
|
648
|
+
for _, tags := range matrix {
|
|
649
|
+
for _, tag := range tags {
|
|
650
|
+
if sequence := protobufFactory_getSequence([]schemametadata.IMetadataTypeTag{tag}); sequence != nil {
|
|
651
|
+
unique[*sequence] = true
|
|
652
|
+
actual++
|
|
653
|
+
}
|
|
654
|
+
expected++
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
for _, atomic := range metadata.Atomics {
|
|
659
|
+
if atomic.Type == "string" {
|
|
660
|
+
emplace(atomic.Tags)
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
for _, constant := range metadata.Constants {
|
|
664
|
+
if constant.Type == "string" {
|
|
665
|
+
for _, value := range constant.Values {
|
|
666
|
+
emplace(value.Tags)
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
for _, template := range metadata.Templates {
|
|
671
|
+
emplace(template.Tags)
|
|
672
|
+
}
|
|
673
|
+
protobufFactory_validateUniqueSequence("string type", unique, expected, actual, errors, add)
|
|
674
674
|
}
|
|
675
675
|
|
|
676
676
|
func protobufFactory_validateInstanceSequence(typ string, tags [][]schemametadata.IMetadataTypeTag, errors *[]string, add func(int) bool) {
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
677
|
+
unique := map[int]bool{}
|
|
678
|
+
count := 0
|
|
679
|
+
for _, row := range tags {
|
|
680
|
+
if value := protobufFactory_getSequence(row); value != nil {
|
|
681
|
+
unique[*value] = true
|
|
682
|
+
count++
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
if len(unique) != 0 && count != len(tags) {
|
|
686
|
+
*errors = append(*errors, "The sequence tag must be declared in every union type members")
|
|
687
|
+
} else if len(unique) > 1 {
|
|
688
|
+
label := "object"
|
|
689
|
+
if typ == "array" {
|
|
690
|
+
label = "an array"
|
|
691
|
+
}
|
|
692
|
+
*errors = append(*errors, "The sequence tag value must be the same in "+label+" type.")
|
|
693
|
+
} else if len(unique) == 1 {
|
|
694
|
+
for value := range unique {
|
|
695
|
+
if add(value) == false {
|
|
696
|
+
*errors = append(*errors, fmt.Sprintf("The sequence tag value %d in %s type is duplicated with other types", value, typ))
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
700
|
}
|
|
701
701
|
|
|
702
702
|
func protobufFactory_validateUniqueSequence(label string, unique map[int]bool, expected int, actual int, errors *[]string, add func(int) bool) {
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
703
|
+
if len(unique) != 0 && actual != expected {
|
|
704
|
+
*errors = append(*errors, "The sequence tag must be declared in every union type members")
|
|
705
|
+
} else if len(unique) > 1 {
|
|
706
|
+
*errors = append(*errors, "The sequence tag value must be the same in "+label+" (including literal types)")
|
|
707
|
+
} else if len(unique) == 1 {
|
|
708
|
+
for value := range unique {
|
|
709
|
+
if add(value) == false {
|
|
710
|
+
*errors = append(*errors, fmt.Sprintf("The sequence tag value %d in %s is duplicated with other types", value, label))
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
714
|
}
|
|
715
715
|
|
|
716
716
|
func protobufFactory_propertyIndex(prop nativeprotobuf.IProtobufPropertyType) *int {
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
717
|
+
switch v := prop.(type) {
|
|
718
|
+
case *nativeprotobuf.IProtobufPropertyType_IByte:
|
|
719
|
+
return v.Index
|
|
720
|
+
case *nativeprotobuf.IProtobufPropertyType_IBoolean:
|
|
721
|
+
return v.Index
|
|
722
|
+
case *nativeprotobuf.IProtobufPropertyType_IBigint:
|
|
723
|
+
return v.Index
|
|
724
|
+
case *nativeprotobuf.IProtobufPropertyType_INumber:
|
|
725
|
+
return v.Index
|
|
726
|
+
case *nativeprotobuf.IProtobufPropertyType_IString:
|
|
727
|
+
return v.Index
|
|
728
|
+
case *nativeprotobuf.IProtobufPropertyType_IArray:
|
|
729
|
+
return v.Index
|
|
730
|
+
case *nativeprotobuf.IProtobufPropertyType_IObject:
|
|
731
|
+
return v.Index
|
|
732
|
+
case *nativeprotobuf.IProtobufPropertyType_IMap:
|
|
733
|
+
return v.Index
|
|
734
|
+
}
|
|
735
|
+
return nil
|
|
736
736
|
}
|
|
737
737
|
|
|
738
738
|
func protobufFactory_setPropertyIndex(prop nativeprotobuf.IProtobufPropertyType, index int) {
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
739
|
+
switch v := prop.(type) {
|
|
740
|
+
case *nativeprotobuf.IProtobufPropertyType_IByte:
|
|
741
|
+
v.Index = &index
|
|
742
|
+
case *nativeprotobuf.IProtobufPropertyType_IBoolean:
|
|
743
|
+
v.Index = &index
|
|
744
|
+
case *nativeprotobuf.IProtobufPropertyType_IBigint:
|
|
745
|
+
v.Index = &index
|
|
746
|
+
case *nativeprotobuf.IProtobufPropertyType_INumber:
|
|
747
|
+
v.Index = &index
|
|
748
|
+
case *nativeprotobuf.IProtobufPropertyType_IString:
|
|
749
|
+
v.Index = &index
|
|
750
|
+
case *nativeprotobuf.IProtobufPropertyType_IArray:
|
|
751
|
+
v.Index = &index
|
|
752
|
+
case *nativeprotobuf.IProtobufPropertyType_IObject:
|
|
753
|
+
v.Index = &index
|
|
754
|
+
case *nativeprotobuf.IProtobufPropertyType_IMap:
|
|
755
|
+
v.Index = &index
|
|
756
|
+
}
|
|
757
757
|
}
|
|
758
758
|
|
|
759
759
|
func protobufFactory_firstTagRow(tags [][]schemametadata.IMetadataTypeTag) []schemametadata.IMetadataTypeTag {
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
760
|
+
if len(tags) == 0 {
|
|
761
|
+
return []schemametadata.IMetadataTypeTag{}
|
|
762
|
+
}
|
|
763
|
+
return tags[0]
|
|
764
764
|
}
|
|
765
765
|
|
|
766
766
|
func protobufFactory_getSequence(tags []schemametadata.IMetadataTypeTag) *int {
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
767
|
+
for _, tag := range tags {
|
|
768
|
+
if tag.Kind != "sequence" {
|
|
769
|
+
continue
|
|
770
|
+
}
|
|
771
|
+
schema, ok := tag.Schema.(map[string]any)
|
|
772
|
+
if ok == false {
|
|
773
|
+
continue
|
|
774
|
+
}
|
|
775
|
+
raw, ok := schema["x-protobuf-sequence"]
|
|
776
|
+
if ok == false {
|
|
777
|
+
continue
|
|
778
|
+
}
|
|
779
|
+
switch value := raw.(type) {
|
|
780
|
+
case int:
|
|
781
|
+
return &value
|
|
782
|
+
case int64:
|
|
783
|
+
next := int(value)
|
|
784
|
+
return &next
|
|
785
|
+
case float64:
|
|
786
|
+
next := int(value)
|
|
787
|
+
return &next
|
|
788
|
+
case string:
|
|
789
|
+
next := 0
|
|
790
|
+
if _, err := fmt.Sscan(value, &next); err == nil {
|
|
791
|
+
return &next
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
return nil
|
|
796
796
|
}
|
|
797
797
|
|
|
798
798
|
func protobufFactory_isStaticObject(obj *schemametadata.MetadataObjectType) bool {
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
799
|
+
if obj == nil || len(obj.Properties) == 0 {
|
|
800
|
+
return false
|
|
801
|
+
}
|
|
802
|
+
for _, property := range obj.Properties {
|
|
803
|
+
if property.Key.IsSoleLiteral() == false {
|
|
804
|
+
return false
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
return true
|
|
808
808
|
}
|
|
809
809
|
|
|
810
810
|
func protobufFactory_isUnion(meta *schemametadata.MetadataSchema) bool {
|
|
811
|
-
|
|
811
|
+
return protobufFactory_size(meta) > 1
|
|
812
812
|
}
|
|
813
813
|
|
|
814
814
|
func protobufFactory_size(meta *schemametadata.MetadataSchema) int {
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
815
|
+
if meta == nil {
|
|
816
|
+
return 0
|
|
817
|
+
}
|
|
818
|
+
return len(protobufFactory_getAtomics(meta)) +
|
|
819
|
+
len(meta.Arrays) +
|
|
820
|
+
len(meta.Tuples) +
|
|
821
|
+
len(meta.Natives) +
|
|
822
|
+
len(meta.Objects) +
|
|
823
|
+
len(meta.Maps)
|
|
824
824
|
}
|
|
825
825
|
|
|
826
826
|
func protobufFactory_getAtomics(meta *schemametadata.MetadataSchema) map[string]*int {
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
827
|
+
output := map[string]*int{}
|
|
828
|
+
for _, constant := range meta.Constants {
|
|
829
|
+
if constant.Type == "boolean" {
|
|
830
|
+
output["bool"] = protobufFactory_getSequence(protobufFactory_firstTags(constant.Values))
|
|
831
|
+
} else if constant.Type == "bigint" {
|
|
832
|
+
init := protobufFactory_getBigintType(protobufFactory_constantValues(constant.Values))
|
|
833
|
+
protobufFactory_decodeBigint(output, constant.Values, init)
|
|
834
|
+
} else if constant.Type == "number" {
|
|
835
|
+
init := protobufFactory_getNumberType(protobufFactory_constantValues(constant.Values))
|
|
836
|
+
protobufFactory_decodeNumber(output, constant.Values, init)
|
|
837
|
+
} else if constant.Type == "string" {
|
|
838
|
+
output["string"] = protobufFactory_getSequence(protobufFactory_firstTags(constant.Values))
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
if len(meta.Templates) != 0 {
|
|
842
|
+
output["string"] = protobufFactory_getSequence(protobufFactory_firstTagRow(meta.Templates[0].Tags))
|
|
843
|
+
}
|
|
844
|
+
for _, atomic := range meta.Atomics {
|
|
845
|
+
if atomic.Type == "boolean" {
|
|
846
|
+
output["bool"] = protobufFactory_getSequence(protobufFactory_firstTagRow(atomic.Tags))
|
|
847
|
+
} else if atomic.Type == "bigint" {
|
|
848
|
+
protobufFactory_decodeBigintTags(output, atomic.Tags, "int64")
|
|
849
|
+
} else if atomic.Type == "number" {
|
|
850
|
+
protobufFactory_decodeNumberTags(output, atomic.Tags, "double")
|
|
851
|
+
} else if atomic.Type == "string" {
|
|
852
|
+
output["string"] = protobufFactory_getSequence(protobufFactory_firstTagRow(atomic.Tags))
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
return output
|
|
856
856
|
}
|
|
857
857
|
|
|
858
858
|
func protobufFactory_getNumbers(meta *schemametadata.MetadataSchema) map[string]*int {
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
859
|
+
output := map[string]*int{}
|
|
860
|
+
for _, constant := range meta.Constants {
|
|
861
|
+
if constant.Type == "number" {
|
|
862
|
+
init := protobufFactory_getNumberType(protobufFactory_constantValues(constant.Values))
|
|
863
|
+
protobufFactory_decodeNumber(output, constant.Values, init)
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
for _, atomic := range meta.Atomics {
|
|
867
|
+
if atomic.Type == "number" {
|
|
868
|
+
protobufFactory_decodeNumberTags(output, atomic.Tags, "double")
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
return output
|
|
872
872
|
}
|
|
873
873
|
|
|
874
874
|
func protobufFactory_getBigints(meta *schemametadata.MetadataSchema) map[string]*int {
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
875
|
+
output := map[string]*int{}
|
|
876
|
+
for _, constant := range meta.Constants {
|
|
877
|
+
if constant.Type == "bigint" {
|
|
878
|
+
init := protobufFactory_getBigintType(protobufFactory_constantValues(constant.Values))
|
|
879
|
+
protobufFactory_decodeBigint(output, constant.Values, init)
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
for _, atomic := range meta.Atomics {
|
|
883
|
+
if atomic.Type == "bigint" {
|
|
884
|
+
protobufFactory_decodeBigintTags(output, atomic.Tags, "int64")
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
return output
|
|
888
888
|
}
|
|
889
889
|
|
|
890
890
|
func protobufFactory_decodeBigint(output map[string]*int, values []*schemametadata.MetadataConstantValue, init string) {
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
891
|
+
for _, value := range values {
|
|
892
|
+
protobufFactory_decodeBigintTags(output, value.Tags, init)
|
|
893
|
+
}
|
|
894
894
|
}
|
|
895
895
|
|
|
896
896
|
func protobufFactory_decodeNumber(output map[string]*int, values []*schemametadata.MetadataConstantValue, init string) {
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
897
|
+
for _, value := range values {
|
|
898
|
+
protobufFactory_decodeNumberTags(output, value.Tags, init)
|
|
899
|
+
}
|
|
900
900
|
}
|
|
901
901
|
|
|
902
902
|
func protobufFactory_decodeBigintTags(output map[string]*int, tags [][]schemametadata.IMetadataTypeTag, init string) {
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
903
|
+
if len(tags) == 0 {
|
|
904
|
+
output[init] = nil
|
|
905
|
+
return
|
|
906
|
+
}
|
|
907
|
+
for _, row := range tags {
|
|
908
|
+
value := init
|
|
909
|
+
for _, tag := range row {
|
|
910
|
+
if tag.Kind == "type" && (tag.Value == "int64" || tag.Value == "uint64") {
|
|
911
|
+
value = fmt.Sprint(tag.Value)
|
|
912
|
+
break
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
output[value] = protobufFactory_getSequence(row)
|
|
916
|
+
}
|
|
917
917
|
}
|
|
918
918
|
|
|
919
919
|
func protobufFactory_decodeNumberTags(output map[string]*int, tags [][]schemametadata.IMetadataTypeTag, init string) {
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
920
|
+
if len(tags) == 0 {
|
|
921
|
+
output[init] = nil
|
|
922
|
+
return
|
|
923
|
+
}
|
|
924
|
+
for _, row := range tags {
|
|
925
|
+
value := init
|
|
926
|
+
for _, tag := range row {
|
|
927
|
+
if tag.Kind != "type" {
|
|
928
|
+
continue
|
|
929
|
+
}
|
|
930
|
+
str := fmt.Sprint(tag.Value)
|
|
931
|
+
if protobufFactory_NUMBER_TYPES[str] {
|
|
932
|
+
value = str
|
|
933
|
+
break
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
output[value] = protobufFactory_getSequence(row)
|
|
937
|
+
}
|
|
938
938
|
}
|
|
939
939
|
|
|
940
940
|
func protobufFactory_compare(x string, y string) int {
|
|
941
|
-
|
|
941
|
+
return protobufFactory_ATOMIC_ORDER[x] - protobufFactory_ATOMIC_ORDER[y]
|
|
942
942
|
}
|
|
943
943
|
|
|
944
944
|
func protobufFactory_firstTags(values []*schemametadata.MetadataConstantValue) []schemametadata.IMetadataTypeTag {
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
945
|
+
if len(values) == 0 {
|
|
946
|
+
return []schemametadata.IMetadataTypeTag{}
|
|
947
|
+
}
|
|
948
|
+
return protobufFactory_firstTagRow(values[0].Tags)
|
|
949
949
|
}
|
|
950
950
|
|
|
951
951
|
func protobufFactory_constantValues(values []*schemametadata.MetadataConstantValue) []any {
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
952
|
+
output := make([]any, 0, len(values))
|
|
953
|
+
for _, value := range values {
|
|
954
|
+
output = append(output, value.Value)
|
|
955
|
+
}
|
|
956
|
+
return output
|
|
957
957
|
}
|
|
958
958
|
|
|
959
959
|
func protobufFactory_getBigintType(values []any) string {
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
960
|
+
for _, value := range values {
|
|
961
|
+
if strings.HasPrefix(fmt.Sprint(value), "-") {
|
|
962
|
+
return "int64"
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
return "uint64"
|
|
966
966
|
}
|
|
967
967
|
|
|
968
968
|
func protobufFactory_getNumberType(values []any) string {
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
969
|
+
integers := true
|
|
970
|
+
int32s := true
|
|
971
|
+
for _, value := range values {
|
|
972
|
+
number := protobufFactory_toFloat(value)
|
|
973
|
+
if math.Floor(number) != number {
|
|
974
|
+
integers = false
|
|
975
|
+
break
|
|
976
|
+
}
|
|
977
|
+
if -2147483648 <= number && number <= 2147483647 {
|
|
978
|
+
continue
|
|
979
|
+
}
|
|
980
|
+
int32s = false
|
|
981
|
+
}
|
|
982
|
+
if integers == false {
|
|
983
|
+
return "double"
|
|
984
|
+
}
|
|
985
|
+
if int32s {
|
|
986
|
+
return "int32"
|
|
987
|
+
}
|
|
988
|
+
return "int64"
|
|
989
989
|
}
|
|
990
990
|
|
|
991
991
|
func protobufFactory_toFloat(value any) float64 {
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
992
|
+
switch v := value.(type) {
|
|
993
|
+
case float64:
|
|
994
|
+
return v
|
|
995
|
+
case float32:
|
|
996
|
+
return float64(v)
|
|
997
|
+
case int:
|
|
998
|
+
return float64(v)
|
|
999
|
+
case int64:
|
|
1000
|
+
return float64(v)
|
|
1001
|
+
case uint64:
|
|
1002
|
+
return float64(v)
|
|
1003
|
+
default:
|
|
1004
|
+
var out float64
|
|
1005
|
+
fmt.Sscan(fmt.Sprint(value), &out)
|
|
1006
|
+
return out
|
|
1007
|
+
}
|
|
1008
1008
|
}
|
|
1009
1009
|
|
|
1010
1010
|
func protobufFactory_isDynamicObject(obj *schemametadata.MetadataObjectType) bool {
|
|
1011
|
-
|
|
1011
|
+
return obj != nil && len(obj.Properties) != 0 && obj.Properties[0].Key.IsSoleLiteral() == false
|
|
1012
1012
|
}
|
|
1013
1013
|
|
|
1014
1014
|
func protobufFactory_errors(errors []MetadataFactory_IError) []nativecontext.TransformerError_MetadataFactory_IError {
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1015
|
+
output := make([]nativecontext.TransformerError_MetadataFactory_IError, 0, len(errors))
|
|
1016
|
+
for _, err := range errors {
|
|
1017
|
+
output = append(output, nativecontext.TransformerError_MetadataFactory_IError{
|
|
1018
|
+
Name: err.Name,
|
|
1019
|
+
Explore: nativecontext.TransformerError_MetadataFactory_IExplore{
|
|
1020
|
+
Object: err.Explore.Object,
|
|
1021
|
+
Property: err.Explore.Property,
|
|
1022
|
+
Parameter: err.Explore.Parameter,
|
|
1023
|
+
Output: err.Explore.Output,
|
|
1024
|
+
},
|
|
1025
|
+
Messages: append([]string{}, err.Messages...),
|
|
1026
|
+
})
|
|
1027
|
+
}
|
|
1028
|
+
return output
|
|
1029
1029
|
}
|
|
1030
1030
|
|
|
1031
1031
|
var protobufFactory_BANNED_NATIVE_TYPES = map[string]string{
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1032
|
+
"Date": "string",
|
|
1033
|
+
"Boolean": "boolean",
|
|
1034
|
+
"BigInt": "bigint",
|
|
1035
|
+
"Number": "number",
|
|
1036
|
+
"String": "string",
|
|
1037
|
+
"Buffer": "Uint8Array",
|
|
1038
|
+
"Uint8ClampedArray": "Uint8Array",
|
|
1039
|
+
"Uint16Array": "Uint8Array",
|
|
1040
|
+
"Uint32Array": "Uint8Array",
|
|
1041
|
+
"BigUint64Array": "Uint8Array",
|
|
1042
|
+
"Int8Array": "Uint8Array",
|
|
1043
|
+
"Int16Array": "Uint8Array",
|
|
1044
|
+
"Int32Array": "Uint8Array",
|
|
1045
|
+
"BigInt64Array": "Uint8Array",
|
|
1046
|
+
"Float32Array": "Uint8Array",
|
|
1047
|
+
"Float64Array": "Uint8Array",
|
|
1048
|
+
"DataView": "Uint8Array",
|
|
1049
|
+
"ArrayBuffer": "Uint8Array",
|
|
1050
|
+
"SharedArrayBuffer": "Uint8Array",
|
|
1051
|
+
"WeakSet": "Array",
|
|
1052
|
+
"WeakMap": "Map",
|
|
1053
1053
|
}
|
|
1054
1054
|
|
|
1055
1055
|
var protobufFactory_NUMBER_TYPES = map[string]bool{
|
|
1056
|
-
|
|
1056
|
+
"int32": true, "uint32": true, "int64": true, "uint64": true, "float": true, "double": true,
|
|
1057
1057
|
}
|
|
1058
1058
|
var protobufFactory_BIGINT_TYPES = map[string]bool{"int64": true, "uint64": true}
|
|
1059
1059
|
var protobufFactory_ATOMIC_ORDER = map[string]int{
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1060
|
+
"bool": 0,
|
|
1061
|
+
"int32": 1,
|
|
1062
|
+
"uint32": 2,
|
|
1063
|
+
"int64": 3,
|
|
1064
|
+
"uint64": 4,
|
|
1065
|
+
"float": 5,
|
|
1066
|
+
"double": 6,
|
|
1067
|
+
"string": 7,
|
|
1068
1068
|
}
|