typia 5.0.0-dev.20230711 → 5.0.0-dev.20230713
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/functional/$number.js +2 -2
- package/lib/functional/$number.js.map +1 -1
- package/lib/json.d.ts +455 -0
- package/lib/json.js +85 -0
- package/lib/json.js.map +1 -0
- package/lib/misc.d.ts +442 -0
- package/lib/misc.js +98 -0
- package/lib/misc.js.map +1 -0
- package/lib/module.d.ts +132 -1024
- package/lib/module.js +32 -189
- package/lib/module.js.map +1 -1
- package/lib/programmers/IsPruneProgrammer.js +2 -2
- package/lib/programmers/IsPruneProgrammer.js.map +1 -1
- package/lib/programmers/internal/application_alias.d.ts +2 -2
- package/lib/programmers/internal/application_alias.js.map +1 -1
- package/lib/programmers/internal/application_array.js.map +1 -1
- package/lib/programmers/internal/application_native.js.map +1 -1
- package/lib/programmers/internal/application_object.js.map +1 -1
- package/lib/programmers/internal/application_resolved.d.ts +2 -2
- package/lib/programmers/internal/application_resolved.js.map +1 -1
- package/lib/programmers/internal/application_schema.js.map +1 -1
- package/lib/programmers/internal/application_tuple.js.map +1 -1
- package/lib/programmers/json/JsonApplicationProgrammer.d.ts +8 -0
- package/lib/programmers/{ApplicationProgrammer.js → json/JsonApplicationProgrammer.js} +8 -8
- package/lib/programmers/json/JsonApplicationProgrammer.js.map +1 -0
- package/lib/programmers/{AssertStringifyProgrammer.d.ts → json/JsonAssertParseProgrammer.d.ts} +2 -2
- package/lib/programmers/{AssertParseProgrammer.js → json/JsonAssertParseProgrammer.js} +10 -10
- package/lib/programmers/json/JsonAssertParseProgrammer.js.map +1 -0
- package/lib/programmers/json/JsonAssertStringifyProgrammer.d.ts +5 -0
- package/lib/programmers/{AssertStringifyProgrammer.js → json/JsonAssertStringifyProgrammer.js} +12 -12
- package/lib/programmers/json/JsonAssertStringifyProgrammer.js.map +1 -0
- package/lib/programmers/{IsCloneProgrammer.d.ts → json/JsonIsParseProgrammer.d.ts} +2 -2
- package/lib/programmers/{IsParseProgrammer.js → json/JsonIsParseProgrammer.js} +10 -10
- package/lib/programmers/json/JsonIsParseProgrammer.js.map +1 -0
- package/lib/programmers/{IsStringifyProgrammer.d.ts → json/JsonIsStringifyProgrammer.d.ts} +1 -1
- package/lib/programmers/{IsStringifyProgrammer.js → json/JsonIsStringifyProgrammer.js} +7 -7
- package/lib/programmers/json/JsonIsStringifyProgrammer.js.map +1 -0
- package/lib/programmers/{StringifyProgrammer.d.ts → json/JsonStringifyProgrammer.d.ts} +2 -2
- package/lib/programmers/{StringifyProgrammer.js → json/JsonStringifyProgrammer.js} +30 -30
- package/lib/programmers/json/JsonStringifyProgrammer.js.map +1 -0
- package/lib/programmers/json/JsonValidateParseProgrammer.d.ts +5 -0
- package/lib/programmers/{ValidateParseProgrammer.js → json/JsonValidateParseProgrammer.js} +10 -10
- package/lib/programmers/json/JsonValidateParseProgrammer.js.map +1 -0
- package/lib/programmers/json/JsonValidateStringifyProgrammer.d.ts +5 -0
- package/lib/programmers/{ValidateStringifyProgrammer.js → json/JsonValidateStringifyProgrammer.js} +12 -12
- package/lib/programmers/json/JsonValidateStringifyProgrammer.js.map +1 -0
- package/lib/programmers/{AssertPruneProgrammer.d.ts → misc/MiscAssertCloneProgrammer.d.ts} +2 -2
- package/lib/programmers/{AssertCloneProgrammer.js → misc/MiscAssertCloneProgrammer.js} +12 -12
- package/lib/programmers/misc/MiscAssertCloneProgrammer.js.map +1 -0
- package/lib/programmers/{AssertCloneProgrammer.d.ts → misc/MiscAssertPruneProgrammer.d.ts} +2 -2
- package/lib/programmers/{AssertPruneProgrammer.js → misc/MiscAssertPruneProgrammer.js} +12 -12
- package/lib/programmers/misc/MiscAssertPruneProgrammer.js.map +1 -0
- package/lib/programmers/{CloneProgrammer.d.ts → misc/MiscCloneProgrammer.d.ts} +2 -2
- package/lib/programmers/{CloneProgrammer.js → misc/MiscCloneProgrammer.js} +20 -20
- package/lib/programmers/misc/MiscCloneProgrammer.js.map +1 -0
- package/lib/programmers/{AssertParseProgrammer.d.ts → misc/MiscIsCloneProgrammer.d.ts} +2 -2
- package/lib/programmers/{IsCloneProgrammer.js → misc/MiscIsCloneProgrammer.js} +12 -12
- package/lib/programmers/misc/MiscIsCloneProgrammer.js.map +1 -0
- package/lib/programmers/{LiteralsProgrammer.d.ts → misc/MiscLiteralsProgrammer.d.ts} +2 -2
- package/lib/programmers/{LiteralsProgrammer.js → misc/MiscLiteralsProgrammer.js} +12 -11
- package/lib/programmers/misc/MiscLiteralsProgrammer.js.map +1 -0
- package/lib/programmers/{PruneProgrammer.d.ts → misc/MiscPruneProgrammer.d.ts} +2 -2
- package/lib/programmers/{PruneProgrammer.js → misc/MiscPruneProgrammer.js} +20 -20
- package/lib/programmers/misc/MiscPruneProgrammer.js.map +1 -0
- package/lib/programmers/misc/MiscValidateCloneProgrammer.d.ts +5 -0
- package/lib/programmers/{ValidateCloneProgrammer.js → misc/MiscValidateCloneProgrammer.js} +12 -12
- package/lib/programmers/misc/MiscValidateCloneProgrammer.js.map +1 -0
- package/lib/programmers/misc/MiscValidatePruneProgrammer.d.ts +5 -0
- package/lib/programmers/{ValidatePruneProgrammer.js → misc/MiscValidatePruneProgrammer.js} +12 -12
- package/lib/programmers/misc/MiscValidatePruneProgrammer.js.map +1 -0
- package/lib/programmers/{MessageProgrammer.d.ts → protobuf/ProtobufMessageProgrammer.d.ts} +2 -2
- package/lib/programmers/{MessageProgrammer.js → protobuf/ProtobufMessageProgrammer.js} +11 -11
- package/lib/programmers/protobuf/ProtobufMessageProgrammer.js.map +1 -0
- package/lib/protobuf.d.ts +2 -0
- package/lib/protobuf.js +11 -0
- package/lib/protobuf.js.map +1 -0
- package/lib/transformers/CallExpressionTransformer.js +122 -103
- package/lib/transformers/CallExpressionTransformer.js.map +1 -1
- package/lib/transformers/features/AssertTransformer.d.ts +3 -0
- package/lib/transformers/features/{validators/AssertTransformer.js → AssertTransformer.js} +2 -2
- package/lib/transformers/features/AssertTransformer.js.map +1 -0
- package/lib/transformers/features/CreateAssertTransformer.d.ts +3 -0
- package/lib/transformers/features/{validators/CreateAssertTransformer.js → CreateAssertTransformer.js} +2 -2
- package/lib/transformers/features/CreateAssertTransformer.js.map +1 -0
- package/lib/transformers/features/CreateIsTransformer.d.ts +3 -0
- package/lib/transformers/features/{validators/CreateIsTransformer.js → CreateIsTransformer.js} +2 -2
- package/lib/transformers/features/CreateIsTransformer.js.map +1 -0
- package/lib/transformers/features/{miscellaneous/CreateRandomTransformer.d.ts → CreateRandomTransformer.d.ts} +1 -1
- package/lib/transformers/features/{miscellaneous/CreateRandomTransformer.js → CreateRandomTransformer.js} +1 -1
- package/lib/transformers/features/CreateRandomTransformer.js.map +1 -0
- package/lib/transformers/features/CreateValidateTransformer.d.ts +3 -0
- package/lib/transformers/features/{validators/CreateValidateTransformer.js → CreateValidateTransformer.js} +2 -2
- package/lib/transformers/features/CreateValidateTransformer.js.map +1 -0
- package/lib/transformers/features/IsTransformer.d.ts +3 -0
- package/lib/transformers/features/{validators/IsTransformer.js → IsTransformer.js} +2 -2
- package/lib/transformers/features/IsTransformer.js.map +1 -0
- package/lib/transformers/features/{miscellaneous/RandomTransformer.d.ts → RandomTransformer.d.ts} +1 -1
- package/lib/transformers/features/{miscellaneous/RandomTransformer.js → RandomTransformer.js} +1 -1
- package/lib/transformers/features/RandomTransformer.js.map +1 -0
- package/lib/transformers/features/ValidateTransformer.d.ts +3 -0
- package/lib/transformers/features/{validators/ValidateTransformer.js → ValidateTransformer.js} +2 -2
- package/lib/transformers/features/ValidateTransformer.js.map +1 -0
- package/lib/transformers/features/{parsers → json}/AssertParseTransformer.js +4 -2
- package/lib/transformers/features/json/AssertParseTransformer.js.map +1 -0
- package/lib/transformers/features/{stringifiers → json}/AssertStringifyTransformer.js +2 -2
- package/lib/transformers/features/json/AssertStringifyTransformer.js.map +1 -0
- package/lib/transformers/features/{parsers → json}/CreateAssertParseTransformer.js +4 -2
- package/lib/transformers/features/json/CreateAssertParseTransformer.js.map +1 -0
- package/lib/transformers/features/{stringifiers → json}/CreateAssertStringifyTransformer.js +2 -2
- package/lib/transformers/features/json/CreateAssertStringifyTransformer.js.map +1 -0
- package/lib/transformers/features/{parsers → json}/CreateIsParseTransformer.js +2 -2
- package/lib/transformers/features/json/CreateIsParseTransformer.js.map +1 -0
- package/lib/transformers/features/{stringifiers → json}/CreateIsStringifyTransformer.js +2 -2
- package/lib/transformers/features/json/CreateIsStringifyTransformer.js.map +1 -0
- package/lib/transformers/features/{stringifiers → json}/CreateStringifyTransformer.js +2 -2
- package/lib/transformers/features/json/CreateStringifyTransformer.js.map +1 -0
- package/lib/transformers/features/{parsers → json}/CreateValidateParseTransformer.js +4 -2
- package/lib/transformers/features/json/CreateValidateParseTransformer.js.map +1 -0
- package/lib/transformers/features/{stringifiers → json}/CreateValidateStringifyProgrammer.js +2 -2
- package/lib/transformers/features/json/CreateValidateStringifyProgrammer.js.map +1 -0
- package/lib/transformers/features/{parsers → json}/IsParseTransformer.js +2 -2
- package/lib/transformers/features/json/IsParseTransformer.js.map +1 -0
- package/lib/transformers/features/{stringifiers → json}/IsStringifyTransformer.js +2 -2
- package/lib/transformers/features/json/IsStringifyTransformer.js.map +1 -0
- package/lib/transformers/features/{stringifiers → json}/StringifyTransformer.js +2 -2
- package/lib/transformers/features/json/StringifyTransformer.js.map +1 -0
- package/lib/transformers/features/{parsers → json}/ValidateParseTransformer.js +4 -2
- package/lib/transformers/features/json/ValidateParseTransformer.js.map +1 -0
- package/lib/transformers/features/{stringifiers → json}/ValidateStringifyTransformer.js +2 -2
- package/lib/transformers/features/json/ValidateStringifyTransformer.js.map +1 -0
- package/lib/transformers/features/{miscellaneous → misc}/ApplicationTransformer.js +2 -2
- package/lib/transformers/features/misc/ApplicationTransformer.js.map +1 -0
- package/lib/transformers/features/{miscellaneous → misc}/AssertCloneTransformer.js +4 -2
- package/lib/transformers/features/misc/AssertCloneTransformer.js.map +1 -0
- package/lib/transformers/features/{miscellaneous → misc}/AssertPruneTransformer.js +4 -2
- package/lib/transformers/features/misc/AssertPruneTransformer.js.map +1 -0
- package/lib/transformers/features/{miscellaneous → misc}/CloneTransformer.js +2 -2
- package/lib/transformers/features/misc/CloneTransformer.js.map +1 -0
- package/lib/transformers/features/{miscellaneous → misc}/CreateAssertCloneTransformer.js +4 -2
- package/lib/transformers/features/misc/CreateAssertCloneTransformer.js.map +1 -0
- package/lib/transformers/features/{miscellaneous → misc}/CreateAssertPruneTransformer.js +4 -2
- package/lib/transformers/features/misc/CreateAssertPruneTransformer.js.map +1 -0
- package/lib/transformers/features/{miscellaneous → misc}/CreateCloneTransformer.js +2 -2
- package/lib/transformers/features/misc/CreateCloneTransformer.js.map +1 -0
- package/lib/transformers/features/{miscellaneous → misc}/CreateIsCloneTransformer.js +2 -2
- package/lib/transformers/features/misc/CreateIsCloneTransformer.js.map +1 -0
- package/lib/transformers/features/misc/CreateIsPruneTransformer.js.map +1 -0
- package/lib/transformers/features/{miscellaneous → misc}/CreatePruneTransformer.js +2 -2
- package/lib/transformers/features/misc/CreatePruneTransformer.js.map +1 -0
- package/lib/transformers/features/{miscellaneous → misc}/CreateValidateCloneTransformer.js +4 -2
- package/lib/transformers/features/misc/CreateValidateCloneTransformer.js.map +1 -0
- package/lib/transformers/features/{miscellaneous → misc}/CreateValidatePruneTransformer.js +4 -2
- package/lib/transformers/features/misc/CreateValidatePruneTransformer.js.map +1 -0
- package/lib/transformers/features/{miscellaneous → misc}/IsCloneTransformer.js +2 -2
- package/lib/transformers/features/misc/IsCloneTransformer.js.map +1 -0
- package/lib/transformers/features/misc/IsPruneTransformer.js.map +1 -0
- package/lib/transformers/features/{miscellaneous → misc}/LiteralsTransformer.js +2 -2
- package/lib/transformers/features/misc/LiteralsTransformer.js.map +1 -0
- package/lib/transformers/features/misc/MetadataTransformer.js.map +1 -0
- package/lib/transformers/features/{miscellaneous → misc}/PruneTransformer.js +2 -2
- package/lib/transformers/features/misc/PruneTransformer.js.map +1 -0
- package/lib/transformers/features/{miscellaneous → misc}/ValidateCloneTransformer.js +4 -2
- package/lib/transformers/features/misc/ValidateCloneTransformer.js.map +1 -0
- package/lib/transformers/features/{miscellaneous → misc}/ValidatePruneTransformer.js +4 -2
- package/lib/transformers/features/misc/ValidatePruneTransformer.js.map +1 -0
- package/lib/transformers/features/{protocols → protobuf}/MessageTransformer.js +2 -2
- package/lib/transformers/features/protobuf/MessageTransformer.js.map +1 -0
- package/package.json +1 -1
- package/src/factories/MetadataTagFactory.ts +362 -362
- package/src/factories/ProtocolFactory.ts +80 -80
- package/src/factories/internal/protocols/ProtocolMetadataUtil.ts +180 -180
- package/src/factories/internal/protocols/emplace_protocol_object.ts +25 -25
- package/src/factories/internal/protocols/emplace_protocol_property.ts +12 -12
- package/src/factories/internal/protocols/iterate_protocol_atomic.ts +34 -34
- package/src/factories/internal/protocols/iterate_protocol_constant.ts +27 -27
- package/src/factories/internal/protocols/iterate_protocol_main.ts +19 -19
- package/src/factories/internal/protocols/iterate_protocol_map.ts +58 -58
- package/src/factories/internal/protocols/iterate_protocol_metadata.ts +96 -96
- package/src/factories/internal/protocols/iterate_protocol_native.ts +34 -34
- package/src/factories/internal/protocols/iterate_protocol_never.ts +1 -1
- package/src/factories/internal/protocols/iterate_protocol_object.ts +110 -110
- package/src/factories/internal/protocols/iterate_protocol_repeated.ts +34 -34
- package/src/factories/internal/protocols/iterate_protocol_tuple.ts +29 -29
- package/src/functional/$number.ts +3 -2
- package/src/functional/$proto_bytes.ts +25 -25
- package/src/functional/$proto_field.ts +30 -30
- package/src/functional/$proto_float.ts +37 -37
- package/src/functional/$proto_i32.ts +29 -29
- package/src/functional/$proto_i64.ts +37 -37
- package/src/functional/$proto_size.ts +82 -82
- package/src/functional/$proto_string.ts +24 -24
- package/src/functional/$varint.ts +130 -130
- package/src/functional/$zigzag.ts +39 -39
- package/src/json.ts +648 -0
- package/src/messages/IProtocolMap.ts +5 -5
- package/src/messages/IProtocolMessage.ts +6 -6
- package/src/messages/IProtocolProperty.ts +13 -13
- package/src/metadata/IMetadataTag.ts +113 -113
- package/src/metadata/Metadata.ts +606 -606
- package/src/misc.ts +651 -0
- package/src/module.ts +781 -2049
- package/src/programmers/IsPruneProgrammer.ts +2 -2
- package/src/programmers/internal/application_alias.ts +2 -2
- package/src/programmers/internal/application_array.ts +2 -2
- package/src/programmers/internal/application_native.ts +2 -2
- package/src/programmers/internal/application_number.ts +77 -77
- package/src/programmers/internal/application_object.ts +3 -3
- package/src/programmers/internal/application_resolved.ts +2 -2
- package/src/programmers/internal/application_schema.ts +2 -2
- package/src/programmers/internal/application_tuple.ts +2 -2
- package/src/programmers/{ApplicationProgrammer.ts → json/JsonApplicationProgrammer.ts} +6 -6
- package/src/programmers/{AssertParseProgrammer.ts → json/JsonAssertParseProgrammer.ts} +6 -6
- package/src/programmers/{AssertStringifyProgrammer.ts → json/JsonAssertStringifyProgrammer.ts} +8 -8
- package/src/programmers/{IsParseProgrammer.ts → json/JsonIsParseProgrammer.ts} +6 -6
- package/src/programmers/{IsStringifyProgrammer.ts → json/JsonIsStringifyProgrammer.ts} +7 -7
- package/src/programmers/{StringifyProgrammer.ts → json/JsonStringifyProgrammer.ts} +40 -39
- package/src/programmers/{ValidateParseProgrammer.ts → json/JsonValidateParseProgrammer.ts} +6 -6
- package/src/programmers/{ValidateStringifyProgrammer.ts → json/JsonValidateStringifyProgrammer.ts} +8 -8
- package/src/programmers/{AssertCloneProgrammer.ts → misc/MiscAssertCloneProgrammer.ts} +8 -8
- package/src/programmers/{AssertPruneProgrammer.ts → misc/MiscAssertPruneProgrammer.ts} +8 -8
- package/src/programmers/{CloneProgrammer.ts → misc/MiscCloneProgrammer.ts} +24 -24
- package/src/programmers/{IsCloneProgrammer.ts → misc/MiscIsCloneProgrammer.ts} +8 -8
- package/src/programmers/{LiteralsProgrammer.ts → misc/MiscLiteralsProgrammer.ts} +63 -62
- package/src/programmers/{PruneProgrammer.ts → misc/MiscPruneProgrammer.ts} +24 -24
- package/src/programmers/{ValidateCloneProgrammer.ts → misc/MiscValidateCloneProgrammer.ts} +8 -8
- package/src/programmers/{ValidatePruneProgrammer.ts → misc/MiscValidatePruneProgrammer.ts} +8 -8
- package/src/programmers/{MessageProgrammer.ts → protobuf/ProtobufMessageProgrammer.ts} +126 -126
- package/src/protobuf.ts +18 -0
- package/src/transformers/CallExpressionTransformer.ts +196 -186
- package/src/transformers/features/{validators/AssertTransformer.ts → AssertTransformer.ts} +2 -2
- package/src/transformers/features/{validators/CreateAssertTransformer.ts → CreateAssertTransformer.ts} +2 -2
- package/src/transformers/features/{validators/CreateIsTransformer.ts → CreateIsTransformer.ts} +2 -2
- package/src/transformers/features/{miscellaneous/CreateRandomTransformer.ts → CreateRandomTransformer.ts} +2 -2
- package/src/transformers/features/{validators/CreateValidateTransformer.ts → CreateValidateTransformer.ts} +2 -2
- package/src/transformers/features/{validators/IsTransformer.ts → IsTransformer.ts} +2 -2
- package/src/transformers/features/{miscellaneous/RandomTransformer.ts → RandomTransformer.ts} +2 -2
- package/src/transformers/features/{validators/ValidateTransformer.ts → ValidateTransformer.ts} +2 -2
- package/src/transformers/features/{parsers → json}/AssertParseTransformer.ts +3 -2
- package/src/transformers/features/{stringifiers → json}/AssertStringifyTransformer.ts +2 -2
- package/src/transformers/features/{parsers → json}/CreateAssertParseTransformer.ts +3 -2
- package/src/transformers/features/{stringifiers → json}/CreateAssertStringifyTransformer.ts +2 -2
- package/src/transformers/features/{parsers → json}/CreateIsParseTransformer.ts +2 -2
- package/src/transformers/features/{stringifiers → json}/CreateIsStringifyTransformer.ts +1 -1
- package/src/transformers/features/{stringifiers → json}/CreateStringifyTransformer.ts +2 -2
- package/src/transformers/features/{parsers → json}/CreateValidateParseTransformer.ts +3 -2
- package/src/transformers/features/{stringifiers → json}/CreateValidateStringifyProgrammer.ts +2 -2
- package/src/transformers/features/{parsers → json}/IsParseTransformer.ts +2 -2
- package/src/transformers/features/{stringifiers → json}/IsStringifyTransformer.ts +1 -1
- package/src/transformers/features/{stringifiers → json}/StringifyTransformer.ts +2 -2
- package/src/transformers/features/{parsers → json}/ValidateParseTransformer.ts +3 -2
- package/src/transformers/features/{stringifiers → json}/ValidateStringifyTransformer.ts +2 -2
- package/src/transformers/features/{miscellaneous → misc}/ApplicationTransformer.ts +102 -102
- package/src/transformers/features/{miscellaneous → misc}/AssertCloneTransformer.ts +3 -2
- package/src/transformers/features/{miscellaneous → misc}/AssertPruneTransformer.ts +3 -2
- package/src/transformers/features/{miscellaneous → misc}/CloneTransformer.ts +2 -2
- package/src/transformers/features/{miscellaneous → misc}/CreateAssertCloneTransformer.ts +3 -2
- package/src/transformers/features/{miscellaneous → misc}/CreateAssertPruneTransformer.ts +3 -2
- package/src/transformers/features/{miscellaneous → misc}/CreateCloneTransformer.ts +2 -2
- package/src/transformers/features/{miscellaneous → misc}/CreateIsCloneTransformer.ts +2 -2
- package/src/transformers/features/{miscellaneous → misc}/CreatePruneTransformer.ts +2 -2
- package/src/transformers/features/{miscellaneous → misc}/CreateValidateCloneTransformer.ts +3 -2
- package/src/transformers/features/{miscellaneous → misc}/CreateValidatePruneTransformer.ts +3 -2
- package/src/transformers/features/{miscellaneous → misc}/IsCloneTransformer.ts +2 -2
- package/src/transformers/features/{miscellaneous → misc}/LiteralsTransformer.ts +2 -2
- package/src/transformers/features/{miscellaneous → misc}/PruneTransformer.ts +2 -2
- package/src/transformers/features/{miscellaneous → misc}/ValidateCloneTransformer.ts +3 -2
- package/src/transformers/features/{miscellaneous → misc}/ValidatePruneTransformer.ts +3 -2
- package/src/transformers/features/{protocols → protobuf}/MessageTransformer.ts +31 -31
- package/src/utils/Escaper.ts +46 -46
- package/src/utils/NameEncoder.ts +32 -32
- package/lib/programmers/ApplicationProgrammer.d.ts +0 -8
- package/lib/programmers/ApplicationProgrammer.js.map +0 -1
- package/lib/programmers/AssertCloneProgrammer.js.map +0 -1
- package/lib/programmers/AssertParseProgrammer.js.map +0 -1
- package/lib/programmers/AssertPruneProgrammer.js.map +0 -1
- package/lib/programmers/AssertStringifyProgrammer.js.map +0 -1
- package/lib/programmers/CloneProgrammer.js.map +0 -1
- package/lib/programmers/IsCloneProgrammer.js.map +0 -1
- package/lib/programmers/IsParseProgrammer.d.ts +0 -5
- package/lib/programmers/IsParseProgrammer.js.map +0 -1
- package/lib/programmers/IsStringifyProgrammer.js.map +0 -1
- package/lib/programmers/LiteralsProgrammer.js.map +0 -1
- package/lib/programmers/MessageProgrammer.js.map +0 -1
- package/lib/programmers/PruneProgrammer.js.map +0 -1
- package/lib/programmers/StringifyProgrammer.js.map +0 -1
- package/lib/programmers/ValidateCloneProgrammer.d.ts +0 -5
- package/lib/programmers/ValidateCloneProgrammer.js.map +0 -1
- package/lib/programmers/ValidateParseProgrammer.d.ts +0 -5
- package/lib/programmers/ValidateParseProgrammer.js.map +0 -1
- package/lib/programmers/ValidatePruneProgrammer.d.ts +0 -5
- package/lib/programmers/ValidatePruneProgrammer.js.map +0 -1
- package/lib/programmers/ValidateStringifyProgrammer.d.ts +0 -5
- package/lib/programmers/ValidateStringifyProgrammer.js.map +0 -1
- package/lib/transformers/features/miscellaneous/ApplicationTransformer.js.map +0 -1
- package/lib/transformers/features/miscellaneous/AssertCloneTransformer.js.map +0 -1
- package/lib/transformers/features/miscellaneous/AssertPruneTransformer.js.map +0 -1
- package/lib/transformers/features/miscellaneous/CloneTransformer.js.map +0 -1
- package/lib/transformers/features/miscellaneous/CreateAssertCloneTransformer.js.map +0 -1
- package/lib/transformers/features/miscellaneous/CreateAssertPruneTransformer.js.map +0 -1
- package/lib/transformers/features/miscellaneous/CreateCloneTransformer.js.map +0 -1
- package/lib/transformers/features/miscellaneous/CreateIsCloneTransformer.js.map +0 -1
- package/lib/transformers/features/miscellaneous/CreateIsPruneTransformer.js.map +0 -1
- package/lib/transformers/features/miscellaneous/CreatePruneTransformer.js.map +0 -1
- package/lib/transformers/features/miscellaneous/CreateRandomTransformer.js.map +0 -1
- package/lib/transformers/features/miscellaneous/CreateValidateCloneTransformer.js.map +0 -1
- package/lib/transformers/features/miscellaneous/CreateValidatePruneTransformer.js.map +0 -1
- package/lib/transformers/features/miscellaneous/IsCloneTransformer.js.map +0 -1
- package/lib/transformers/features/miscellaneous/IsPruneTransformer.js.map +0 -1
- package/lib/transformers/features/miscellaneous/LiteralsTransformer.js.map +0 -1
- package/lib/transformers/features/miscellaneous/MetadataTransformer.js.map +0 -1
- package/lib/transformers/features/miscellaneous/PruneTransformer.js.map +0 -1
- package/lib/transformers/features/miscellaneous/RandomTransformer.js.map +0 -1
- package/lib/transformers/features/miscellaneous/ValidateCloneTransformer.js.map +0 -1
- package/lib/transformers/features/miscellaneous/ValidatePruneTransformer.js.map +0 -1
- package/lib/transformers/features/parsers/AssertParseTransformer.js.map +0 -1
- package/lib/transformers/features/parsers/CreateAssertParseTransformer.js.map +0 -1
- package/lib/transformers/features/parsers/CreateIsParseTransformer.js.map +0 -1
- package/lib/transformers/features/parsers/CreateValidateParseTransformer.js.map +0 -1
- package/lib/transformers/features/parsers/IsParseTransformer.js.map +0 -1
- package/lib/transformers/features/parsers/ValidateParseTransformer.js.map +0 -1
- package/lib/transformers/features/protocols/MessageTransformer.js.map +0 -1
- package/lib/transformers/features/stringifiers/AssertStringifyTransformer.js.map +0 -1
- package/lib/transformers/features/stringifiers/CreateAssertStringifyTransformer.js.map +0 -1
- package/lib/transformers/features/stringifiers/CreateIsStringifyTransformer.js.map +0 -1
- package/lib/transformers/features/stringifiers/CreateStringifyTransformer.js.map +0 -1
- package/lib/transformers/features/stringifiers/CreateValidateStringifyProgrammer.js.map +0 -1
- package/lib/transformers/features/stringifiers/IsStringifyTransformer.js.map +0 -1
- package/lib/transformers/features/stringifiers/StringifyTransformer.js.map +0 -1
- package/lib/transformers/features/stringifiers/ValidateStringifyTransformer.js.map +0 -1
- package/lib/transformers/features/validators/AssertTransformer.d.ts +0 -3
- package/lib/transformers/features/validators/AssertTransformer.js.map +0 -1
- package/lib/transformers/features/validators/CreateAssertTransformer.d.ts +0 -3
- package/lib/transformers/features/validators/CreateAssertTransformer.js.map +0 -1
- package/lib/transformers/features/validators/CreateIsTransformer.d.ts +0 -3
- package/lib/transformers/features/validators/CreateIsTransformer.js.map +0 -1
- package/lib/transformers/features/validators/CreateValidateTransformer.d.ts +0 -3
- package/lib/transformers/features/validators/CreateValidateTransformer.js.map +0 -1
- package/lib/transformers/features/validators/IsTransformer.d.ts +0 -3
- package/lib/transformers/features/validators/IsTransformer.js.map +0 -1
- package/lib/transformers/features/validators/ValidateTransformer.d.ts +0 -3
- package/lib/transformers/features/validators/ValidateTransformer.js.map +0 -1
- /package/lib/transformers/features/{parsers → json}/AssertParseTransformer.d.ts +0 -0
- /package/lib/transformers/features/{stringifiers → json}/AssertStringifyTransformer.d.ts +0 -0
- /package/lib/transformers/features/{parsers → json}/CreateAssertParseTransformer.d.ts +0 -0
- /package/lib/transformers/features/{stringifiers → json}/CreateAssertStringifyTransformer.d.ts +0 -0
- /package/lib/transformers/features/{parsers → json}/CreateIsParseTransformer.d.ts +0 -0
- /package/lib/transformers/features/{stringifiers → json}/CreateIsStringifyTransformer.d.ts +0 -0
- /package/lib/transformers/features/{stringifiers → json}/CreateStringifyTransformer.d.ts +0 -0
- /package/lib/transformers/features/{parsers → json}/CreateValidateParseTransformer.d.ts +0 -0
- /package/lib/transformers/features/{stringifiers → json}/CreateValidateStringifyProgrammer.d.ts +0 -0
- /package/lib/transformers/features/{parsers → json}/IsParseTransformer.d.ts +0 -0
- /package/lib/transformers/features/{stringifiers → json}/IsStringifyTransformer.d.ts +0 -0
- /package/lib/transformers/features/{stringifiers → json}/StringifyTransformer.d.ts +0 -0
- /package/lib/transformers/features/{parsers → json}/ValidateParseTransformer.d.ts +0 -0
- /package/lib/transformers/features/{stringifiers → json}/ValidateStringifyTransformer.d.ts +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/ApplicationTransformer.d.ts +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/AssertCloneTransformer.d.ts +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/AssertPruneTransformer.d.ts +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/CloneTransformer.d.ts +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/CreateAssertCloneTransformer.d.ts +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/CreateAssertPruneTransformer.d.ts +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/CreateCloneTransformer.d.ts +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/CreateIsCloneTransformer.d.ts +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/CreateIsPruneTransformer.d.ts +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/CreateIsPruneTransformer.js +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/CreatePruneTransformer.d.ts +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/CreateValidateCloneTransformer.d.ts +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/CreateValidatePruneTransformer.d.ts +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/IsCloneTransformer.d.ts +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/IsPruneTransformer.d.ts +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/IsPruneTransformer.js +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/LiteralsTransformer.d.ts +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/MetadataTransformer.d.ts +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/MetadataTransformer.js +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/PruneTransformer.d.ts +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/ValidateCloneTransformer.d.ts +0 -0
- /package/lib/transformers/features/{miscellaneous → misc}/ValidatePruneTransformer.d.ts +0 -0
- /package/lib/transformers/features/{protocols → protobuf}/MessageTransformer.d.ts +0 -0
- /package/src/transformers/features/{miscellaneous → misc}/CreateIsPruneTransformer.ts +0 -0
- /package/src/transformers/features/{miscellaneous → misc}/IsPruneTransformer.ts +0 -0
- /package/src/transformers/features/{miscellaneous → misc}/MetadataTransformer.ts +0 -0
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { Metadata } from "../metadata/Metadata";
|
|
4
|
-
|
|
5
|
-
import { IProtocolMessage } from "../messages/IProtocolMessage";
|
|
6
|
-
import { MetadataCollection } from "./MetadataCollection";
|
|
7
|
-
import { MetadataFactory } from "./MetadataFactory";
|
|
8
|
-
import { emplace_protocol_object } from "./internal/protocols/emplace_protocol_object";
|
|
9
|
-
import { iterate_protocol_main } from "./internal/protocols/iterate_protocol_main";
|
|
10
|
-
|
|
11
|
-
export namespace ProtocolFactory {
|
|
12
|
-
export const metadata =
|
|
13
|
-
(checker: ts.TypeChecker) =>
|
|
14
|
-
(collection: MetadataCollection) =>
|
|
15
|
-
(type: ts.Type) =>
|
|
16
|
-
MetadataFactory.analyze(checker)({
|
|
17
|
-
resolve: false,
|
|
18
|
-
constant: true,
|
|
19
|
-
absorb: true,
|
|
20
|
-
validate: (meta) => {
|
|
21
|
-
if (meta.any) throw new Error(ErrorMessages.NO_ANY);
|
|
22
|
-
else if (meta.functional && meta.size() !== 1)
|
|
23
|
-
throw new Error(ErrorMessages.NO_FUNCTIONAL);
|
|
24
|
-
else if (meta.objects.find((o) => o.name === "__Main"))
|
|
25
|
-
throw new Error(ErrorMessages.NO_MAIN);
|
|
26
|
-
else if (meta.objects.find((o) => o.name === "__Timestamp"))
|
|
27
|
-
throw new Error(ErrorMessages.NO_TIMESTAMP);
|
|
28
|
-
else if (
|
|
29
|
-
meta.objects.some((o) =>
|
|
30
|
-
o.properties.some((p) => !is_atomic_key(p.key)),
|
|
31
|
-
) ||
|
|
32
|
-
meta.maps.some((m) => !is_atomic_key(m.key))
|
|
33
|
-
)
|
|
34
|
-
throw new Error(ErrorMessages.NOT_ALLOWED_KEY);
|
|
35
|
-
},
|
|
36
|
-
})(collection)(type);
|
|
37
|
-
|
|
38
|
-
export const generate =
|
|
39
|
-
(collection: MetadataCollection) =>
|
|
40
|
-
(dict: Map<string, IProtocolMessage>) =>
|
|
41
|
-
(meta: Metadata) => {
|
|
42
|
-
// EMPLACE OBJECTS
|
|
43
|
-
for (const obj of collection.objects())
|
|
44
|
-
emplace_protocol_object(dict)(obj);
|
|
45
|
-
|
|
46
|
-
// WHEN NOT OBJECT, WRAP IT INTO A FAKE MAIN OBJECT
|
|
47
|
-
iterate_protocol_main(dict)(meta);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const is_atomic_key = (key: Metadata) => {
|
|
51
|
-
if (
|
|
52
|
-
key.required &&
|
|
53
|
-
key.nullable === false &&
|
|
54
|
-
key.functional === false &&
|
|
55
|
-
key.resolved === null &&
|
|
56
|
-
key.size() ===
|
|
57
|
-
key.atomics.length +
|
|
58
|
-
key.constants
|
|
59
|
-
.map((c) => c.values.length)
|
|
60
|
-
.reduce((a, b) => a + b, 0) +
|
|
61
|
-
key.templates.length
|
|
62
|
-
) {
|
|
63
|
-
const set: Set<string> = new Set();
|
|
64
|
-
for (const atomic of key.atomics) set.add(atomic);
|
|
65
|
-
for (const constant of key.constants) set.add(constant.type);
|
|
66
|
-
if (key.templates.length) set.add("string");
|
|
67
|
-
|
|
68
|
-
return set.size === 1;
|
|
69
|
-
}
|
|
70
|
-
return false;
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const enum ErrorMessages {
|
|
75
|
-
NO_ANY = `Error on typia.message(): any type is not supported in protocol buffer.`,
|
|
76
|
-
NO_FUNCTIONAL = `Error on typia.message(): functional type is not supported in protocol buffer.`,
|
|
77
|
-
NO_MAIN = `Error on typia.message(): reserved type "__Main" has been detected.`,
|
|
78
|
-
NO_TIMESTAMP = `Error on typia.message(): reserved type "__Timestamp" has been detected.`,
|
|
79
|
-
NOT_ALLOWED_KEY = `Error on typia.message(): only atomic key type is supported in protocol buffer.`,
|
|
80
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { Metadata } from "../metadata/Metadata";
|
|
4
|
+
|
|
5
|
+
import { IProtocolMessage } from "../messages/IProtocolMessage";
|
|
6
|
+
import { MetadataCollection } from "./MetadataCollection";
|
|
7
|
+
import { MetadataFactory } from "./MetadataFactory";
|
|
8
|
+
import { emplace_protocol_object } from "./internal/protocols/emplace_protocol_object";
|
|
9
|
+
import { iterate_protocol_main } from "./internal/protocols/iterate_protocol_main";
|
|
10
|
+
|
|
11
|
+
export namespace ProtocolFactory {
|
|
12
|
+
export const metadata =
|
|
13
|
+
(checker: ts.TypeChecker) =>
|
|
14
|
+
(collection: MetadataCollection) =>
|
|
15
|
+
(type: ts.Type) =>
|
|
16
|
+
MetadataFactory.analyze(checker)({
|
|
17
|
+
resolve: false,
|
|
18
|
+
constant: true,
|
|
19
|
+
absorb: true,
|
|
20
|
+
validate: (meta) => {
|
|
21
|
+
if (meta.any) throw new Error(ErrorMessages.NO_ANY);
|
|
22
|
+
else if (meta.functional && meta.size() !== 1)
|
|
23
|
+
throw new Error(ErrorMessages.NO_FUNCTIONAL);
|
|
24
|
+
else if (meta.objects.find((o) => o.name === "__Main"))
|
|
25
|
+
throw new Error(ErrorMessages.NO_MAIN);
|
|
26
|
+
else if (meta.objects.find((o) => o.name === "__Timestamp"))
|
|
27
|
+
throw new Error(ErrorMessages.NO_TIMESTAMP);
|
|
28
|
+
else if (
|
|
29
|
+
meta.objects.some((o) =>
|
|
30
|
+
o.properties.some((p) => !is_atomic_key(p.key)),
|
|
31
|
+
) ||
|
|
32
|
+
meta.maps.some((m) => !is_atomic_key(m.key))
|
|
33
|
+
)
|
|
34
|
+
throw new Error(ErrorMessages.NOT_ALLOWED_KEY);
|
|
35
|
+
},
|
|
36
|
+
})(collection)(type);
|
|
37
|
+
|
|
38
|
+
export const generate =
|
|
39
|
+
(collection: MetadataCollection) =>
|
|
40
|
+
(dict: Map<string, IProtocolMessage>) =>
|
|
41
|
+
(meta: Metadata) => {
|
|
42
|
+
// EMPLACE OBJECTS
|
|
43
|
+
for (const obj of collection.objects())
|
|
44
|
+
emplace_protocol_object(dict)(obj);
|
|
45
|
+
|
|
46
|
+
// WHEN NOT OBJECT, WRAP IT INTO A FAKE MAIN OBJECT
|
|
47
|
+
iterate_protocol_main(dict)(meta);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const is_atomic_key = (key: Metadata) => {
|
|
51
|
+
if (
|
|
52
|
+
key.required &&
|
|
53
|
+
key.nullable === false &&
|
|
54
|
+
key.functional === false &&
|
|
55
|
+
key.resolved === null &&
|
|
56
|
+
key.size() ===
|
|
57
|
+
key.atomics.length +
|
|
58
|
+
key.constants
|
|
59
|
+
.map((c) => c.values.length)
|
|
60
|
+
.reduce((a, b) => a + b, 0) +
|
|
61
|
+
key.templates.length
|
|
62
|
+
) {
|
|
63
|
+
const set: Set<string> = new Set();
|
|
64
|
+
for (const atomic of key.atomics) set.add(atomic);
|
|
65
|
+
for (const constant of key.constants) set.add(constant.type);
|
|
66
|
+
if (key.templates.length) set.add("string");
|
|
67
|
+
|
|
68
|
+
return set.size === 1;
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const enum ErrorMessages {
|
|
75
|
+
NO_ANY = `Error on typia.message(): any type is not supported in protocol buffer.`,
|
|
76
|
+
NO_FUNCTIONAL = `Error on typia.message(): functional type is not supported in protocol buffer.`,
|
|
77
|
+
NO_MAIN = `Error on typia.message(): reserved type "__Main" has been detected.`,
|
|
78
|
+
NO_TIMESTAMP = `Error on typia.message(): reserved type "__Timestamp" has been detected.`,
|
|
79
|
+
NOT_ALLOWED_KEY = `Error on typia.message(): only atomic key type is supported in protocol buffer.`,
|
|
80
|
+
}
|
|
@@ -1,180 +1,180 @@
|
|
|
1
|
-
import { IMetadataTag } from "../../../metadata/IMetadataTag";
|
|
2
|
-
import { Metadata } from "../../../metadata/Metadata";
|
|
3
|
-
import { MetadataArray } from "../../../metadata/MetadataArray";
|
|
4
|
-
import { MetadataObject } from "../../../metadata/MetadataObject";
|
|
5
|
-
import { MetadataProperty } from "../../../metadata/MetadataProperty";
|
|
6
|
-
|
|
7
|
-
import { Atomic } from "../../../typings/Atomic";
|
|
8
|
-
|
|
9
|
-
export namespace ProtocolMetadataUtil {
|
|
10
|
-
export function size(meta: Metadata): number {
|
|
11
|
-
return (
|
|
12
|
-
meta.atomics.length +
|
|
13
|
-
meta.constants.filter(
|
|
14
|
-
(c) =>
|
|
15
|
-
meta.atomics.find((type) => c.type === type) === undefined,
|
|
16
|
-
).length +
|
|
17
|
-
(meta.templates.length !== 0 &&
|
|
18
|
-
meta.atomics.find((type) => type === "string") === undefined &&
|
|
19
|
-
meta.constants.find((c) => c.type === "string") === undefined
|
|
20
|
-
? 1
|
|
21
|
-
: 0) +
|
|
22
|
-
meta.tuples.length +
|
|
23
|
-
meta.arrays.length +
|
|
24
|
-
meta.sets.length +
|
|
25
|
-
meta.maps.length +
|
|
26
|
-
meta.objects.length +
|
|
27
|
-
meta.natives.filter((n) => n === "Date").length +
|
|
28
|
-
(meta.natives.filter((n) => n !== "Date").length ? 1 : 0)
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function standalone(meta: Metadata): boolean {
|
|
33
|
-
return (
|
|
34
|
-
size(meta) === 1 &&
|
|
35
|
-
meta.required === true &&
|
|
36
|
-
meta.nullable === false &&
|
|
37
|
-
meta.tuples.length === 0 &&
|
|
38
|
-
meta.arrays.length === 0 &&
|
|
39
|
-
meta.sets.length === 0 &&
|
|
40
|
-
meta.maps.length === 0 &&
|
|
41
|
-
meta.objects.every((obj) =>
|
|
42
|
-
obj.properties.every((p) => p.key.isSoleLiteral()),
|
|
43
|
-
)
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function regular(obj: MetadataObject): boolean {
|
|
48
|
-
return obj.properties.every((p) => p.key.isSoleLiteral());
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function object(name: string, index: number): MetadataObject {
|
|
52
|
-
return MetadataObject.create({
|
|
53
|
-
name,
|
|
54
|
-
index,
|
|
55
|
-
properties: [],
|
|
56
|
-
description: undefined,
|
|
57
|
-
jsDocTags: [],
|
|
58
|
-
validated: false,
|
|
59
|
-
recursive: false,
|
|
60
|
-
nullables: [false],
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export function property(
|
|
65
|
-
key: string,
|
|
66
|
-
value: Metadata,
|
|
67
|
-
tags: IMetadataTag[],
|
|
68
|
-
): MetadataProperty {
|
|
69
|
-
return MetadataProperty.create({
|
|
70
|
-
key: (() => {
|
|
71
|
-
const meta: Metadata = Metadata.initialize();
|
|
72
|
-
meta.constants.push({
|
|
73
|
-
type: "string",
|
|
74
|
-
values: [key],
|
|
75
|
-
});
|
|
76
|
-
return meta;
|
|
77
|
-
})(),
|
|
78
|
-
value: value,
|
|
79
|
-
description: null,
|
|
80
|
-
tags,
|
|
81
|
-
jsDocTags: [],
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export function array(meta: Metadata): Metadata {
|
|
86
|
-
return Metadata.create({
|
|
87
|
-
any: false,
|
|
88
|
-
required: true,
|
|
89
|
-
optional: false,
|
|
90
|
-
nullable: false,
|
|
91
|
-
functional: false,
|
|
92
|
-
resolved: null,
|
|
93
|
-
aliases: [],
|
|
94
|
-
atomics: [],
|
|
95
|
-
constants: [],
|
|
96
|
-
templates: [],
|
|
97
|
-
rest: null,
|
|
98
|
-
arrays: [
|
|
99
|
-
MetadataArray.create({
|
|
100
|
-
name: meta.getName(),
|
|
101
|
-
value: meta,
|
|
102
|
-
nullables: [false],
|
|
103
|
-
recursive: false,
|
|
104
|
-
index: null,
|
|
105
|
-
}),
|
|
106
|
-
],
|
|
107
|
-
tuples: [],
|
|
108
|
-
objects: [],
|
|
109
|
-
natives: [],
|
|
110
|
-
sets: [],
|
|
111
|
-
maps: [],
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export function atomic(type: Atomic.Literal): Metadata {
|
|
116
|
-
return Metadata.create({
|
|
117
|
-
any: false,
|
|
118
|
-
required: true,
|
|
119
|
-
optional: false,
|
|
120
|
-
nullable: false,
|
|
121
|
-
functional: false,
|
|
122
|
-
resolved: null,
|
|
123
|
-
aliases: [],
|
|
124
|
-
atomics: [type],
|
|
125
|
-
constants: [],
|
|
126
|
-
templates: [],
|
|
127
|
-
rest: null,
|
|
128
|
-
arrays: [],
|
|
129
|
-
tuples: [],
|
|
130
|
-
objects: [],
|
|
131
|
-
natives: [],
|
|
132
|
-
sets: [],
|
|
133
|
-
maps: [],
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export function reference(obj: MetadataObject): Metadata {
|
|
138
|
-
return Metadata.create({
|
|
139
|
-
any: false,
|
|
140
|
-
required: true,
|
|
141
|
-
optional: false,
|
|
142
|
-
nullable: false,
|
|
143
|
-
functional: false,
|
|
144
|
-
resolved: null,
|
|
145
|
-
aliases: [],
|
|
146
|
-
atomics: [],
|
|
147
|
-
constants: [],
|
|
148
|
-
templates: [],
|
|
149
|
-
rest: null,
|
|
150
|
-
arrays: [],
|
|
151
|
-
tuples: [],
|
|
152
|
-
objects: [obj],
|
|
153
|
-
natives: [],
|
|
154
|
-
sets: [],
|
|
155
|
-
maps: [],
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export function map(elem: Metadata.Entry): Metadata {
|
|
160
|
-
return Metadata.create({
|
|
161
|
-
any: false,
|
|
162
|
-
required: true,
|
|
163
|
-
optional: false,
|
|
164
|
-
nullable: false,
|
|
165
|
-
functional: false,
|
|
166
|
-
resolved: null,
|
|
167
|
-
aliases: [],
|
|
168
|
-
atomics: [],
|
|
169
|
-
constants: [],
|
|
170
|
-
templates: [],
|
|
171
|
-
rest: null,
|
|
172
|
-
arrays: [],
|
|
173
|
-
tuples: [],
|
|
174
|
-
objects: [],
|
|
175
|
-
natives: [],
|
|
176
|
-
sets: [],
|
|
177
|
-
maps: [elem],
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
}
|
|
1
|
+
import { IMetadataTag } from "../../../metadata/IMetadataTag";
|
|
2
|
+
import { Metadata } from "../../../metadata/Metadata";
|
|
3
|
+
import { MetadataArray } from "../../../metadata/MetadataArray";
|
|
4
|
+
import { MetadataObject } from "../../../metadata/MetadataObject";
|
|
5
|
+
import { MetadataProperty } from "../../../metadata/MetadataProperty";
|
|
6
|
+
|
|
7
|
+
import { Atomic } from "../../../typings/Atomic";
|
|
8
|
+
|
|
9
|
+
export namespace ProtocolMetadataUtil {
|
|
10
|
+
export function size(meta: Metadata): number {
|
|
11
|
+
return (
|
|
12
|
+
meta.atomics.length +
|
|
13
|
+
meta.constants.filter(
|
|
14
|
+
(c) =>
|
|
15
|
+
meta.atomics.find((type) => c.type === type) === undefined,
|
|
16
|
+
).length +
|
|
17
|
+
(meta.templates.length !== 0 &&
|
|
18
|
+
meta.atomics.find((type) => type === "string") === undefined &&
|
|
19
|
+
meta.constants.find((c) => c.type === "string") === undefined
|
|
20
|
+
? 1
|
|
21
|
+
: 0) +
|
|
22
|
+
meta.tuples.length +
|
|
23
|
+
meta.arrays.length +
|
|
24
|
+
meta.sets.length +
|
|
25
|
+
meta.maps.length +
|
|
26
|
+
meta.objects.length +
|
|
27
|
+
meta.natives.filter((n) => n === "Date").length +
|
|
28
|
+
(meta.natives.filter((n) => n !== "Date").length ? 1 : 0)
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function standalone(meta: Metadata): boolean {
|
|
33
|
+
return (
|
|
34
|
+
size(meta) === 1 &&
|
|
35
|
+
meta.required === true &&
|
|
36
|
+
meta.nullable === false &&
|
|
37
|
+
meta.tuples.length === 0 &&
|
|
38
|
+
meta.arrays.length === 0 &&
|
|
39
|
+
meta.sets.length === 0 &&
|
|
40
|
+
meta.maps.length === 0 &&
|
|
41
|
+
meta.objects.every((obj) =>
|
|
42
|
+
obj.properties.every((p) => p.key.isSoleLiteral()),
|
|
43
|
+
)
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function regular(obj: MetadataObject): boolean {
|
|
48
|
+
return obj.properties.every((p) => p.key.isSoleLiteral());
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function object(name: string, index: number): MetadataObject {
|
|
52
|
+
return MetadataObject.create({
|
|
53
|
+
name,
|
|
54
|
+
index,
|
|
55
|
+
properties: [],
|
|
56
|
+
description: undefined,
|
|
57
|
+
jsDocTags: [],
|
|
58
|
+
validated: false,
|
|
59
|
+
recursive: false,
|
|
60
|
+
nullables: [false],
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function property(
|
|
65
|
+
key: string,
|
|
66
|
+
value: Metadata,
|
|
67
|
+
tags: IMetadataTag[],
|
|
68
|
+
): MetadataProperty {
|
|
69
|
+
return MetadataProperty.create({
|
|
70
|
+
key: (() => {
|
|
71
|
+
const meta: Metadata = Metadata.initialize();
|
|
72
|
+
meta.constants.push({
|
|
73
|
+
type: "string",
|
|
74
|
+
values: [key],
|
|
75
|
+
});
|
|
76
|
+
return meta;
|
|
77
|
+
})(),
|
|
78
|
+
value: value,
|
|
79
|
+
description: null,
|
|
80
|
+
tags,
|
|
81
|
+
jsDocTags: [],
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function array(meta: Metadata): Metadata {
|
|
86
|
+
return Metadata.create({
|
|
87
|
+
any: false,
|
|
88
|
+
required: true,
|
|
89
|
+
optional: false,
|
|
90
|
+
nullable: false,
|
|
91
|
+
functional: false,
|
|
92
|
+
resolved: null,
|
|
93
|
+
aliases: [],
|
|
94
|
+
atomics: [],
|
|
95
|
+
constants: [],
|
|
96
|
+
templates: [],
|
|
97
|
+
rest: null,
|
|
98
|
+
arrays: [
|
|
99
|
+
MetadataArray.create({
|
|
100
|
+
name: meta.getName(),
|
|
101
|
+
value: meta,
|
|
102
|
+
nullables: [false],
|
|
103
|
+
recursive: false,
|
|
104
|
+
index: null,
|
|
105
|
+
}),
|
|
106
|
+
],
|
|
107
|
+
tuples: [],
|
|
108
|
+
objects: [],
|
|
109
|
+
natives: [],
|
|
110
|
+
sets: [],
|
|
111
|
+
maps: [],
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function atomic(type: Atomic.Literal): Metadata {
|
|
116
|
+
return Metadata.create({
|
|
117
|
+
any: false,
|
|
118
|
+
required: true,
|
|
119
|
+
optional: false,
|
|
120
|
+
nullable: false,
|
|
121
|
+
functional: false,
|
|
122
|
+
resolved: null,
|
|
123
|
+
aliases: [],
|
|
124
|
+
atomics: [type],
|
|
125
|
+
constants: [],
|
|
126
|
+
templates: [],
|
|
127
|
+
rest: null,
|
|
128
|
+
arrays: [],
|
|
129
|
+
tuples: [],
|
|
130
|
+
objects: [],
|
|
131
|
+
natives: [],
|
|
132
|
+
sets: [],
|
|
133
|
+
maps: [],
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function reference(obj: MetadataObject): Metadata {
|
|
138
|
+
return Metadata.create({
|
|
139
|
+
any: false,
|
|
140
|
+
required: true,
|
|
141
|
+
optional: false,
|
|
142
|
+
nullable: false,
|
|
143
|
+
functional: false,
|
|
144
|
+
resolved: null,
|
|
145
|
+
aliases: [],
|
|
146
|
+
atomics: [],
|
|
147
|
+
constants: [],
|
|
148
|
+
templates: [],
|
|
149
|
+
rest: null,
|
|
150
|
+
arrays: [],
|
|
151
|
+
tuples: [],
|
|
152
|
+
objects: [obj],
|
|
153
|
+
natives: [],
|
|
154
|
+
sets: [],
|
|
155
|
+
maps: [],
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function map(elem: Metadata.Entry): Metadata {
|
|
160
|
+
return Metadata.create({
|
|
161
|
+
any: false,
|
|
162
|
+
required: true,
|
|
163
|
+
optional: false,
|
|
164
|
+
nullable: false,
|
|
165
|
+
functional: false,
|
|
166
|
+
resolved: null,
|
|
167
|
+
aliases: [],
|
|
168
|
+
atomics: [],
|
|
169
|
+
constants: [],
|
|
170
|
+
templates: [],
|
|
171
|
+
rest: null,
|
|
172
|
+
arrays: [],
|
|
173
|
+
tuples: [],
|
|
174
|
+
objects: [],
|
|
175
|
+
natives: [],
|
|
176
|
+
sets: [],
|
|
177
|
+
maps: [elem],
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { MetadataObject } from "../../../metadata/MetadataObject";
|
|
2
|
-
|
|
3
|
-
import { IProtocolMessage } from "../../../messages/IProtocolMessage";
|
|
4
|
-
import { emplace_protocol_property } from "./emplace_protocol_property";
|
|
5
|
-
|
|
6
|
-
export const emplace_protocol_object =
|
|
7
|
-
(dict: Map<string, IProtocolMessage>) => (object: MetadataObject) => {
|
|
8
|
-
if (dict.has(object.name)) return;
|
|
9
|
-
|
|
10
|
-
const regular = object.properties.filter((p) => p.key.isSoleLiteral());
|
|
11
|
-
const dynamic = object.properties.filter((p) => !p.key.isSoleLiteral());
|
|
12
|
-
|
|
13
|
-
if (dynamic.length) return;
|
|
14
|
-
|
|
15
|
-
const output: IProtocolMessage = {
|
|
16
|
-
name: object.name,
|
|
17
|
-
properties: [],
|
|
18
|
-
};
|
|
19
|
-
dict.set(object.name, output);
|
|
20
|
-
|
|
21
|
-
output.properties.push(
|
|
22
|
-
...regular.map((prop) => emplace_protocol_property(dict)(prop)),
|
|
23
|
-
);
|
|
24
|
-
return output;
|
|
25
|
-
};
|
|
1
|
+
import { MetadataObject } from "../../../metadata/MetadataObject";
|
|
2
|
+
|
|
3
|
+
import { IProtocolMessage } from "../../../messages/IProtocolMessage";
|
|
4
|
+
import { emplace_protocol_property } from "./emplace_protocol_property";
|
|
5
|
+
|
|
6
|
+
export const emplace_protocol_object =
|
|
7
|
+
(dict: Map<string, IProtocolMessage>) => (object: MetadataObject) => {
|
|
8
|
+
if (dict.has(object.name)) return;
|
|
9
|
+
|
|
10
|
+
const regular = object.properties.filter((p) => p.key.isSoleLiteral());
|
|
11
|
+
const dynamic = object.properties.filter((p) => !p.key.isSoleLiteral());
|
|
12
|
+
|
|
13
|
+
if (dynamic.length) return;
|
|
14
|
+
|
|
15
|
+
const output: IProtocolMessage = {
|
|
16
|
+
name: object.name,
|
|
17
|
+
properties: [],
|
|
18
|
+
};
|
|
19
|
+
dict.set(object.name, output);
|
|
20
|
+
|
|
21
|
+
output.properties.push(
|
|
22
|
+
...regular.map((prop) => emplace_protocol_property(dict)(prop)),
|
|
23
|
+
);
|
|
24
|
+
return output;
|
|
25
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { MetadataProperty } from "../../../metadata/MetadataProperty";
|
|
2
|
-
|
|
3
|
-
import { IProtocolMessage } from "../../../messages/IProtocolMessage";
|
|
4
|
-
import { IProtocolProperty } from "../../../messages/IProtocolProperty";
|
|
5
|
-
import { iterate_protocol_metadata } from "./iterate_protocol_metadata";
|
|
6
|
-
|
|
7
|
-
export const emplace_protocol_property =
|
|
8
|
-
(dict: Map<string, IProtocolMessage>) =>
|
|
9
|
-
(property: MetadataProperty): IProtocolProperty => ({
|
|
10
|
-
key: property.key.getSoleLiteral()!,
|
|
11
|
-
...iterate_protocol_metadata(dict)(property.value)(property.tags),
|
|
12
|
-
});
|
|
1
|
+
import { MetadataProperty } from "../../../metadata/MetadataProperty";
|
|
2
|
+
|
|
3
|
+
import { IProtocolMessage } from "../../../messages/IProtocolMessage";
|
|
4
|
+
import { IProtocolProperty } from "../../../messages/IProtocolProperty";
|
|
5
|
+
import { iterate_protocol_metadata } from "./iterate_protocol_metadata";
|
|
6
|
+
|
|
7
|
+
export const emplace_protocol_property =
|
|
8
|
+
(dict: Map<string, IProtocolMessage>) =>
|
|
9
|
+
(property: MetadataProperty): IProtocolProperty => ({
|
|
10
|
+
key: property.key.getSoleLiteral()!,
|
|
11
|
+
...iterate_protocol_metadata(dict)(property.value)(property.tags),
|
|
12
|
+
});
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { IMetadataTag } from "../../../metadata/IMetadataTag";
|
|
2
|
-
|
|
3
|
-
import { Atomic } from "../../../typings/Atomic";
|
|
4
|
-
|
|
5
|
-
export const iterate_protocol_atomic =
|
|
6
|
-
(tags: IMetadataTag[]) => (type: Atomic.Literal) => {
|
|
7
|
-
if (type === "boolean") return "bool";
|
|
8
|
-
else if (type === "number") return number(tags);
|
|
9
|
-
else if (type === "bigint") return bigint(tags);
|
|
10
|
-
else return "string";
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const number = (tagList: IMetadataTag[]) => {
|
|
14
|
-
const filtered: IMetadataTag.INumberType[] = tagList.filter(
|
|
15
|
-
(tag) => tag.kind === "type",
|
|
16
|
-
) as IMetadataTag.INumberType[];
|
|
17
|
-
|
|
18
|
-
for (const { value } of filtered)
|
|
19
|
-
if (value === "int") return "int32";
|
|
20
|
-
else if (value === "uint") return "uint32";
|
|
21
|
-
return "double";
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const bigint = (tagList: IMetadataTag[]) => {
|
|
25
|
-
const filtered: IMetadataTag.INumberType[] = tagList.filter(
|
|
26
|
-
(tag) =>
|
|
27
|
-
tag.kind === "type" &&
|
|
28
|
-
(tag.value === "int64" || tag.value === "uint64"),
|
|
29
|
-
) as IMetadataTag.INumberType[];
|
|
30
|
-
|
|
31
|
-
for (const { value } of filtered)
|
|
32
|
-
if (value === "int64" || value === "uint64") return value;
|
|
33
|
-
return "int64";
|
|
34
|
-
};
|
|
1
|
+
import { IMetadataTag } from "../../../metadata/IMetadataTag";
|
|
2
|
+
|
|
3
|
+
import { Atomic } from "../../../typings/Atomic";
|
|
4
|
+
|
|
5
|
+
export const iterate_protocol_atomic =
|
|
6
|
+
(tags: IMetadataTag[]) => (type: Atomic.Literal) => {
|
|
7
|
+
if (type === "boolean") return "bool";
|
|
8
|
+
else if (type === "number") return number(tags);
|
|
9
|
+
else if (type === "bigint") return bigint(tags);
|
|
10
|
+
else return "string";
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const number = (tagList: IMetadataTag[]) => {
|
|
14
|
+
const filtered: IMetadataTag.INumberType[] = tagList.filter(
|
|
15
|
+
(tag) => tag.kind === "type",
|
|
16
|
+
) as IMetadataTag.INumberType[];
|
|
17
|
+
|
|
18
|
+
for (const { value } of filtered)
|
|
19
|
+
if (value === "int") return "int32";
|
|
20
|
+
else if (value === "uint") return "uint32";
|
|
21
|
+
return "double";
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const bigint = (tagList: IMetadataTag[]) => {
|
|
25
|
+
const filtered: IMetadataTag.INumberType[] = tagList.filter(
|
|
26
|
+
(tag) =>
|
|
27
|
+
tag.kind === "type" &&
|
|
28
|
+
(tag.value === "int64" || tag.value === "uint64"),
|
|
29
|
+
) as IMetadataTag.INumberType[];
|
|
30
|
+
|
|
31
|
+
for (const { value } of filtered)
|
|
32
|
+
if (value === "int64" || value === "uint64") return value;
|
|
33
|
+
return "int64";
|
|
34
|
+
};
|