typia 5.3.12-dev.20240121 → 5.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/AssertionGuard.ts +1 -1
- package/src/CamelCase.ts +114 -114
- package/src/IRandomGenerator.ts +35 -35
- package/src/IValidation.ts +21 -21
- package/src/PascalCase.ts +114 -114
- package/src/Primitive.ts +135 -135
- package/src/Resolved.ts +116 -116
- package/src/SnakeCase.ts +156 -156
- package/src/TypeGuardError.ts +36 -36
- package/src/executable/TypiaGenerateWizard.ts +83 -83
- package/src/executable/TypiaPatchWizard.ts +42 -42
- package/src/executable/TypiaSetupWizard.ts +151 -151
- package/src/executable/setup/ArgumentParser.ts +43 -43
- package/src/executable/setup/CommandExecutor.ts +8 -8
- package/src/executable/setup/FileRetriever.ts +22 -22
- package/src/executable/setup/PackageManager.ts +71 -71
- package/src/executable/setup/PluginConfigurator.ts +69 -69
- package/src/executable/typia.ts +55 -55
- package/src/factories/CommentFactory.ts +79 -79
- package/src/factories/ExpressionFactory.ts +150 -150
- package/src/factories/IdentifierFactory.ts +70 -70
- package/src/factories/JsonMetadataFactory.ts +53 -53
- package/src/factories/LiteralFactory.ts +47 -47
- package/src/factories/MetadataCollection.ts +260 -260
- package/src/factories/MetadataCommentTagFactory.ts +601 -601
- package/src/factories/MetadataFactory.ts +267 -267
- package/src/factories/MetadataTypeTagFactory.ts +313 -313
- package/src/factories/NumericRangeFactory.ts +72 -72
- package/src/factories/ProtobufFactory.ts +259 -259
- package/src/factories/StatementFactory.ts +72 -72
- package/src/factories/TemplateFactory.ts +56 -56
- package/src/factories/TypeFactory.ts +118 -118
- package/src/factories/ValueFactory.ts +12 -12
- package/src/factories/internal/metadata/MetadataHelper.ts +15 -15
- package/src/factories/internal/metadata/emend_metadata_atomics.ts +37 -37
- package/src/factories/internal/metadata/emplace_metadata_alias.ts +41 -41
- package/src/factories/internal/metadata/emplace_metadata_array_type.ts +38 -38
- package/src/factories/internal/metadata/emplace_metadata_object.ts +175 -175
- package/src/factories/internal/metadata/emplace_metadata_tuple.ts +57 -57
- package/src/factories/internal/metadata/explore_metadata.ts +28 -28
- package/src/factories/internal/metadata/iterate_metadata.ts +94 -94
- package/src/factories/internal/metadata/iterate_metadata_alias.ts +34 -34
- package/src/factories/internal/metadata/iterate_metadata_array.ts +37 -37
- package/src/factories/internal/metadata/iterate_metadata_atomic.ts +62 -62
- package/src/factories/internal/metadata/iterate_metadata_coalesce.ts +33 -33
- package/src/factories/internal/metadata/iterate_metadata_collection.ts +131 -131
- package/src/factories/internal/metadata/iterate_metadata_comment_tags.ts +26 -26
- package/src/factories/internal/metadata/iterate_metadata_constant.ts +48 -48
- package/src/factories/internal/metadata/iterate_metadata_intersection.ts +230 -230
- package/src/factories/internal/metadata/iterate_metadata_map.ts +50 -50
- package/src/factories/internal/metadata/iterate_metadata_native.ts +208 -208
- package/src/factories/internal/metadata/iterate_metadata_object.ts +43 -43
- package/src/factories/internal/metadata/iterate_metadata_resolve.ts +52 -52
- package/src/factories/internal/metadata/iterate_metadata_set.ts +41 -41
- package/src/factories/internal/metadata/iterate_metadata_sort.ts +61 -61
- package/src/factories/internal/metadata/iterate_metadata_template.ts +44 -44
- package/src/factories/internal/metadata/iterate_metadata_tuple.ts +37 -37
- package/src/factories/internal/metadata/iterate_metadata_union.ts +27 -27
- package/src/functional/$HeadersReader/$HeadersReader.ts +26 -26
- package/src/functional/$HeadersReader/index.ts +1 -1
- package/src/functional/$ParameterReader/$ParameterReader.ts +29 -29
- package/src/functional/$ParameterReader/index.ts +1 -1
- package/src/functional/$ProtobufReader.ts +195 -195
- package/src/functional/$ProtobufSizer.ts +147 -147
- package/src/functional/$ProtobufWriter.ts +150 -150
- package/src/functional/$QueryReader/$QueryReader.ts +46 -46
- package/src/functional/$QueryReader/index.ts +1 -1
- package/src/functional/$any.ts +4 -4
- package/src/functional/$clone.ts +4 -4
- package/src/functional/$convention.ts +37 -37
- package/src/functional/$dictionary.ts +22 -22
- package/src/functional/$every.ts +11 -11
- package/src/functional/$guard.ts +35 -35
- package/src/functional/$is_between.ts +2 -2
- package/src/functional/$join.ts +46 -46
- package/src/functional/$number.ts +12 -12
- package/src/functional/$report.ts +13 -13
- package/src/functional/$rest.ts +3 -3
- package/src/functional/$stoll.ts +8 -8
- package/src/functional/$string.ts +50 -50
- package/src/functional/$strlen.ts +7 -7
- package/src/functional/$tail.ts +5 -5
- package/src/functional/$throws.ts +10 -10
- package/src/functional/$varint.ts +130 -130
- package/src/functional/$zigzag.ts +39 -39
- package/src/functional/IProtobufWriter.ts +18 -18
- package/src/functional/Namespace/http.ts +7 -7
- package/src/functional/Namespace/index.ts +75 -75
- package/src/functional/Namespace/json.ts +15 -15
- package/src/functional/Namespace/misc.ts +14 -14
- package/src/functional/Namespace/notations.ts +23 -23
- package/src/functional/Namespace/protobuf.ts +20 -20
- package/src/functional/is.ts +10 -10
- package/src/http.ts +1267 -1267
- package/src/index.ts +4 -4
- package/src/notations.ts +977 -977
- package/src/programmers/AssertProgrammer.ts +293 -293
- package/src/programmers/CheckerProgrammer.ts +1025 -1025
- package/src/programmers/FeatureProgrammer.ts +460 -460
- package/src/programmers/IsProgrammer.ts +232 -232
- package/src/programmers/RandomProgrammer.ts +825 -825
- package/src/programmers/TypiaProgrammer.ts +167 -167
- package/src/programmers/ValidateProgrammer.ts +307 -307
- package/src/programmers/helpers/AtomicPredicator.ts +25 -25
- package/src/programmers/helpers/CloneJoiner.ts +130 -130
- package/src/programmers/helpers/FunctionImporeter.ts +87 -87
- package/src/programmers/helpers/HttpMetadataUtil.ts +21 -21
- package/src/programmers/helpers/ICheckEntry.ts +13 -13
- package/src/programmers/helpers/IExpressionEntry.ts +12 -12
- package/src/programmers/helpers/NotationJoiner.ts +132 -132
- package/src/programmers/helpers/OptionPredicator.ts +15 -15
- package/src/programmers/helpers/ProtobufUtil.ts +125 -125
- package/src/programmers/helpers/ProtobufWire.ts +34 -34
- package/src/programmers/helpers/PruneJoiner.ts +141 -141
- package/src/programmers/helpers/RandomJoiner.ts +140 -140
- package/src/programmers/helpers/RandomRanger.ts +171 -171
- package/src/programmers/helpers/StringifyJoinder.ts +105 -105
- package/src/programmers/helpers/StringifyPredicator.ts +12 -12
- package/src/programmers/helpers/UnionExplorer.ts +269 -269
- package/src/programmers/helpers/UnionPredicator.ts +77 -77
- package/src/programmers/helpers/disable_function_importer_declare.ts +32 -32
- package/src/programmers/http/HttpAssertHeadersProgrammer.ts +77 -77
- package/src/programmers/http/HttpAssertQueryProgrammer.ts +75 -75
- package/src/programmers/http/HttpHeadersProgrammer.ts +314 -314
- package/src/programmers/http/HttpIsHeadersProgrammer.ts +84 -84
- package/src/programmers/http/HttpIsQueryProgrammer.ts +82 -82
- package/src/programmers/http/HttpParameterProgrammer.ts +97 -97
- package/src/programmers/http/HttpQueryProgrammer.ts +252 -252
- package/src/programmers/http/HttpValidateHeadersProgrammer.ts +77 -77
- package/src/programmers/http/HttpValidateQueryProgrammer.ts +75 -75
- package/src/programmers/internal/JSON_SCHEMA_PREFIX.ts +1 -1
- package/src/programmers/internal/application_alias.ts +74 -74
- package/src/programmers/internal/application_array.ts +59 -59
- package/src/programmers/internal/application_boolean.ts +35 -35
- package/src/programmers/internal/application_constant.ts +25 -25
- package/src/programmers/internal/application_default.ts +17 -17
- package/src/programmers/internal/application_default_string.ts +33 -33
- package/src/programmers/internal/application_escaped.ts +52 -52
- package/src/programmers/internal/application_native.ts +34 -34
- package/src/programmers/internal/application_number.ts +97 -97
- package/src/programmers/internal/application_object.ts +183 -183
- package/src/programmers/internal/application_schema.ts +165 -165
- package/src/programmers/internal/application_string.ts +61 -61
- package/src/programmers/internal/application_templates.ts +24 -24
- package/src/programmers/internal/application_tuple.ts +54 -54
- package/src/programmers/internal/check_array_length.ts +45 -45
- package/src/programmers/internal/check_bigint.ts +49 -49
- package/src/programmers/internal/check_dynamic_key.ts +175 -175
- package/src/programmers/internal/check_dynamic_properties.ts +198 -198
- package/src/programmers/internal/check_everything.ts +23 -23
- package/src/programmers/internal/check_native.ts +21 -21
- package/src/programmers/internal/check_number.ts +106 -106
- package/src/programmers/internal/check_object.ts +60 -60
- package/src/programmers/internal/check_string.ts +48 -48
- package/src/programmers/internal/check_template.ts +61 -61
- package/src/programmers/internal/check_union_array_like.ts +307 -307
- package/src/programmers/internal/decode_union_object.ts +78 -78
- package/src/programmers/internal/feature_object_entries.ts +58 -58
- package/src/programmers/internal/metadata_to_pattern.ts +33 -33
- package/src/programmers/internal/prune_object_properties.ts +60 -60
- package/src/programmers/internal/random_custom.ts +37 -37
- package/src/programmers/internal/stringify_dynamic_properties.ts +157 -157
- package/src/programmers/internal/stringify_native.ts +7 -7
- package/src/programmers/internal/stringify_regular_properties.ts +81 -81
- package/src/programmers/internal/template_to_pattern.ts +15 -15
- package/src/programmers/internal/wrap_metadata_rest_tuple.ts +20 -20
- package/src/programmers/json/JsonApplicationProgrammer.ts +49 -49
- package/src/programmers/json/JsonAssertParseProgrammer.ts +67 -67
- package/src/programmers/json/JsonAssertStringifyProgrammer.ts +61 -61
- package/src/programmers/json/JsonIsParseProgrammer.ts +73 -73
- package/src/programmers/json/JsonIsStringifyProgrammer.ts +75 -75
- package/src/programmers/json/JsonStringifyProgrammer.ts +893 -893
- package/src/programmers/json/JsonValidateParseProgrammer.ts +64 -64
- package/src/programmers/json/JsonValidateStringifyProgrammer.ts +83 -83
- package/src/programmers/misc/MiscAssertCloneProgrammer.ts +63 -63
- package/src/programmers/misc/MiscAssertPruneProgrammer.ts +60 -60
- package/src/programmers/misc/MiscCloneProgrammer.ts +713 -713
- package/src/programmers/misc/MiscIsCloneProgrammer.ts +70 -70
- package/src/programmers/misc/MiscIsPruneProgrammer.ts +66 -66
- package/src/programmers/misc/MiscLiteralsProgrammer.ts +72 -72
- package/src/programmers/misc/MiscPruneProgrammer.ts +523 -523
- package/src/programmers/misc/MiscValidateCloneProgrammer.ts +80 -80
- package/src/programmers/misc/MiscValidatePruneProgrammer.ts +73 -73
- package/src/programmers/notations/NotationAssertGeneralProgrammer.ts +64 -64
- package/src/programmers/notations/NotationGeneralProgrammer.ts +647 -647
- package/src/programmers/notations/NotationIsGeneralProgrammer.ts +71 -71
- package/src/programmers/notations/NotationValidateGeneralProgrammer.ts +81 -81
- package/src/programmers/protobuf/ProtobufAssertDecodeProgrammer.ts +75 -75
- package/src/programmers/protobuf/ProtobufAssertEncodeProgrammer.ts +61 -61
- package/src/programmers/protobuf/ProtobufDecodeProgrammer.ts +607 -607
- package/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +819 -819
- package/src/programmers/protobuf/ProtobufIsDecodeProgrammer.ts +82 -82
- package/src/programmers/protobuf/ProtobufIsEncodeProgrammer.ts +75 -75
- package/src/programmers/protobuf/ProtobufMessageProgrammer.ts +160 -160
- package/src/programmers/protobuf/ProtobufValidateDecodeProgrammer.ts +75 -75
- package/src/programmers/protobuf/ProtobufValidateEncodeProgrammer.ts +83 -83
- package/src/protobuf.ts +970 -970
- package/src/reflect.ts +57 -57
- package/src/schemas/json/IJsonApplication.ts +9 -9
- package/src/schemas/json/IJsonComponents.ts +19 -19
- package/src/schemas/json/IJsonSchema.ts +122 -122
- package/src/schemas/metadata/IJsDocTagInfo.ts +10 -10
- package/src/schemas/metadata/IMetadata.ts +34 -34
- package/src/schemas/metadata/IMetadataAlias.ts +12 -12
- package/src/schemas/metadata/IMetadataApplication.ts +7 -7
- package/src/schemas/metadata/IMetadataArray.ts +7 -7
- package/src/schemas/metadata/IMetadataArrayType.ts +10 -10
- package/src/schemas/metadata/IMetadataAtomic.ts +6 -6
- package/src/schemas/metadata/IMetadataComponents.ts +11 -11
- package/src/schemas/metadata/IMetadataConstant.ts +23 -23
- package/src/schemas/metadata/IMetadataDictionary.ts +11 -11
- package/src/schemas/metadata/IMetadataEntry.ts +6 -6
- package/src/schemas/metadata/IMetadataEscaped.ts +6 -6
- package/src/schemas/metadata/IMetadataObject.ts +13 -13
- package/src/schemas/metadata/IMetadataProperty.ts +9 -9
- package/src/schemas/metadata/IMetadataTuple.ts +7 -7
- package/src/schemas/metadata/IMetadataTupleType.ts +10 -10
- package/src/schemas/metadata/IMetadataTypeTag.ts +15 -15
- package/src/schemas/metadata/Metadata.ts +612 -612
- package/src/schemas/metadata/MetadataAlias.ts +61 -61
- package/src/schemas/metadata/MetadataApplication.ts +44 -44
- package/src/schemas/metadata/MetadataArray.ts +49 -49
- package/src/schemas/metadata/MetadataArrayType.ts +57 -57
- package/src/schemas/metadata/MetadataAtomic.ts +84 -84
- package/src/schemas/metadata/MetadataComponents.ts +98 -98
- package/src/schemas/metadata/MetadataConstant.ts +46 -46
- package/src/schemas/metadata/MetadataEscaped.ts +51 -51
- package/src/schemas/metadata/MetadataObject.ts +154 -154
- package/src/schemas/metadata/MetadataProperty.ts +56 -56
- package/src/schemas/metadata/MetadataTuple.ts +32 -32
- package/src/schemas/metadata/MetadataTupleType.ts +67 -67
- package/src/tags/Default.ts +15 -15
- package/src/tags/ExclusiveMaximum.ts +13 -13
- package/src/tags/ExclusiveMinimum.ts +13 -13
- package/src/tags/Format.ts +30 -30
- package/src/tags/MaxItems.ts +9 -9
- package/src/tags/MaxLength.ts +9 -9
- package/src/tags/Maximum.ts +13 -13
- package/src/tags/MinItems.ts +9 -9
- package/src/tags/MinLength.ts +9 -9
- package/src/tags/Minimum.ts +13 -13
- package/src/tags/MultipleOf.ts +15 -15
- package/src/tags/Pattern.ts +9 -9
- package/src/tags/TagBase.ts +68 -68
- package/src/tags/Type.ts +27 -27
- package/src/tags/index.ts +14 -14
- package/src/transform.ts +35 -35
- package/src/transformers/CallExpressionTransformer.ts +351 -351
- package/src/transformers/FileTransformer.ts +91 -91
- package/src/transformers/IProject.ts +15 -15
- package/src/transformers/ITransformOptions.ts +62 -62
- package/src/transformers/ImportTransformer.ts +66 -66
- package/src/transformers/NodeTransformer.ts +13 -13
- package/src/transformers/TransformerError.ts +55 -55
- package/src/transformers/features/AssertTransformer.ts +16 -16
- package/src/transformers/features/CreateAssertTransformer.ts +16 -16
- package/src/transformers/features/CreateIsTransformer.ts +10 -10
- package/src/transformers/features/CreateRandomTransformer.ts +40 -40
- package/src/transformers/features/CreateValidateTransformer.ts +13 -13
- package/src/transformers/features/IsTransformer.ts +10 -10
- package/src/transformers/features/RandomTransformer.ts +44 -44
- package/src/transformers/features/ValidateTransformer.ts +11 -11
- package/src/transformers/features/http/CreateHttpAssertHeadersTransformer.ts +11 -11
- package/src/transformers/features/http/CreateHttpAssertQueryTransformer.ts +9 -9
- package/src/transformers/features/http/CreateHttpHeadersTransformer.ts +9 -9
- package/src/transformers/features/http/CreateHttpIsHeadersTransformer.ts +9 -9
- package/src/transformers/features/http/CreateHttpIsQueryTransformer.ts +9 -9
- package/src/transformers/features/http/CreateHttpParameterTransformer.ts +9 -9
- package/src/transformers/features/http/CreateHttpQueryTransformer.ts +9 -9
- package/src/transformers/features/http/CreateHttpValidateHeadersTransformer.ts +12 -12
- package/src/transformers/features/http/CreateHttpValidateQueryTransformer.ts +11 -11
- package/src/transformers/features/http/HttpAssertHeadersTransformer.ts +9 -9
- package/src/transformers/features/http/HttpAssertQueryTransformer.ts +9 -9
- package/src/transformers/features/http/HttpHeadersTransformer.ts +9 -9
- package/src/transformers/features/http/HttpIsHeadersTransformer.ts +9 -9
- package/src/transformers/features/http/HttpIsQueryTransformer.ts +9 -9
- package/src/transformers/features/http/HttpParameterTransformer.ts +9 -9
- package/src/transformers/features/http/HttpQueryTransformer.ts +9 -9
- package/src/transformers/features/http/HttpValidateHeadersTransformer.ts +10 -10
- package/src/transformers/features/http/HttpValidateQueryTransformer.ts +9 -9
- package/src/transformers/features/json/JsonApplicationTransformer.ts +134 -134
- package/src/transformers/features/json/JsonAssertParseTransformer.ts +9 -9
- package/src/transformers/features/json/JsonAssertStringifyTransformer.ts +10 -10
- package/src/transformers/features/json/JsonCreateAssertParseTransformer.ts +9 -9
- package/src/transformers/features/json/JsonCreateAssertStringifyTransformer.ts +12 -12
- package/src/transformers/features/json/JsonCreateIsParseTransformer.ts +9 -9
- package/src/transformers/features/json/JsonCreateIsStringifyTransformer.ts +9 -9
- package/src/transformers/features/json/JsonCreateStringifyTransformer.ts +9 -9
- package/src/transformers/features/json/JsonCreateValidateParseTransformer.ts +11 -11
- package/src/transformers/features/json/JsonCreateValidateStringifyProgrammer.ts +12 -12
- package/src/transformers/features/json/JsonIsParseTransformer.ts +9 -9
- package/src/transformers/features/json/JsonIsStringifyTransformer.ts +9 -9
- package/src/transformers/features/json/JsonStringifyTransformer.ts +9 -9
- package/src/transformers/features/json/JsonValidateParseTransformer.ts +9 -9
- package/src/transformers/features/json/JsonValidateStringifyTransformer.ts +10 -10
- package/src/transformers/features/misc/MiscAssertCloneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscAssertPruneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscCloneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscCreateAssertCloneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscCreateAssertPruneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscCreateCloneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscCreateIsCloneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscCreateIsPruneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscCreatePruneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscCreateValidateCloneTransformer.ts +11 -11
- package/src/transformers/features/misc/MiscCreateValidatePruneTransformer.ts +11 -11
- package/src/transformers/features/misc/MiscIsCloneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscIsPruneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscLiteralsTransformer.ts +32 -32
- package/src/transformers/features/misc/MiscPruneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscValidateCloneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscValidatePruneTransformer.ts +9 -9
- package/src/transformers/features/notations/NotationAssertGeneralTransformer.ts +15 -15
- package/src/transformers/features/notations/NotationCreateAssertGeneralTransformer.ts +15 -15
- package/src/transformers/features/notations/NotationCreateGeneralTransformer.ts +15 -15
- package/src/transformers/features/notations/NotationCreateIsGeneralTransformer.ts +15 -15
- package/src/transformers/features/notations/NotationCreateValidateGeneralTransformer.ts +15 -15
- package/src/transformers/features/notations/NotationGeneralTransformer.ts +11 -11
- package/src/transformers/features/notations/NotationIsGeneralTransformer.ts +15 -15
- package/src/transformers/features/notations/NotationValidateGeneralTransformer.ts +15 -15
- package/src/transformers/features/protobuf/ProtobufAssertDecodeTransformer.ts +10 -10
- package/src/transformers/features/protobuf/ProtobufAssertEncodeTransformer.ts +10 -10
- package/src/transformers/features/protobuf/ProtobufCreateAssertDecodeTransformer.ts +12 -12
- package/src/transformers/features/protobuf/ProtobufCreateAssertEncodeTransformer.ts +12 -12
- package/src/transformers/features/protobuf/ProtobufCreateDecodeTransformer.ts +9 -9
- package/src/transformers/features/protobuf/ProtobufCreateEncodeTransformer.ts +9 -9
- package/src/transformers/features/protobuf/ProtobufCreateIsDecodeTransformer.ts +9 -9
- package/src/transformers/features/protobuf/ProtobufCreateIsEncodeTransformer.ts +9 -9
- package/src/transformers/features/protobuf/ProtobufCreateValidateDecodeTransformer.ts +12 -12
- package/src/transformers/features/protobuf/ProtobufCreateValidateEncodeTransformer.ts +12 -12
- package/src/transformers/features/protobuf/ProtobufDecodeTransformer.ts +9 -9
- package/src/transformers/features/protobuf/ProtobufEncodeTransformer.ts +9 -9
- package/src/transformers/features/protobuf/ProtobufIsDecodeTransformer.ts +9 -9
- package/src/transformers/features/protobuf/ProtobufIsEncodeTransformer.ts +9 -9
- package/src/transformers/features/protobuf/ProtobufMessageTransformer.ts +33 -33
- package/src/transformers/features/protobuf/ProtobufValidateDecodeTransformer.ts +10 -10
- package/src/transformers/features/protobuf/ProtobufValidateEncodeTransformer.ts +10 -10
- package/src/transformers/features/reflect/ReflectMetadataTransformer.ts +63 -63
- package/src/transformers/internal/GenericTransformer.ts +96 -96
- package/src/typings/Atomic.ts +13 -13
- package/src/typings/ClassProperties.ts +5 -5
- package/src/typings/Customizable.ts +5 -5
- package/src/typings/OmitNever.ts +3 -3
- package/src/typings/ProtobufAtomic.ts +19 -19
- package/src/typings/SpecialFields.ts +3 -3
- package/src/typings/ValidationPipe.ts +9 -9
- package/src/typings/Writable.ts +11 -11
- package/src/utils/ArrayUtil.ts +43 -43
- package/src/utils/Escaper.ts +46 -46
- package/src/utils/MapUtil.ts +12 -12
- package/src/utils/NameEncoder.ts +32 -32
- package/src/utils/NamingConvention/NamingConvention.ts +77 -77
- package/src/utils/NamingConvention/index.ts +1 -1
- package/src/utils/PatternUtil.ts +29 -29
- package/src/utils/RandomGenerator/RandomGenerator.ts +74 -74
- package/src/utils/RandomGenerator/index.ts +1 -1
- package/src/utils/Singleton.ts +16 -16
- package/src/utils/StringUtil/StringUtil.ts +2 -2
- package/src/utils/StringUtil/index.ts +1 -1
package/src/protobuf.ts
CHANGED
|
@@ -1,970 +1,970 @@
|
|
|
1
|
-
import * as Namespace from "./functional/Namespace";
|
|
2
|
-
|
|
3
|
-
import { IValidation } from "./IValidation";
|
|
4
|
-
import { Resolved } from "./Resolved";
|
|
5
|
-
|
|
6
|
-
/* ===========================================================
|
|
7
|
-
PROTOCOL BUFFER
|
|
8
|
-
- MESSAGE
|
|
9
|
-
- DECODE
|
|
10
|
-
- ENCODE
|
|
11
|
-
- FACTORY FUNCTIONS
|
|
12
|
-
==============================================================
|
|
13
|
-
SCHEMA
|
|
14
|
-
----------------------------------------------------------- */
|
|
15
|
-
/**
|
|
16
|
-
* > You must configure the generic argument `T`.
|
|
17
|
-
*
|
|
18
|
-
* Protocol Buffer Message Schema.
|
|
19
|
-
*
|
|
20
|
-
* Creates a Protocol Buffer Message Schema from a TypeScript type. The message
|
|
21
|
-
* schema would be returned as a string value, and it can be used to share with
|
|
22
|
-
* other developers/languages/frameworks.
|
|
23
|
-
*
|
|
24
|
-
* For reference, Protocol Buffer has lots of restrictions, so that expression power
|
|
25
|
-
* of Protocol Buffer is not enough strong to fully meet the TypeScript type specs.
|
|
26
|
-
* In such reason, if you put a TypeScript type that is not compatible with Protocol
|
|
27
|
-
* Buffer, this function would throw compilation errors.
|
|
28
|
-
*
|
|
29
|
-
* - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
|
|
30
|
-
*
|
|
31
|
-
* @template T Target type
|
|
32
|
-
* @returns Protocol Buffer Message Schema.
|
|
33
|
-
*
|
|
34
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
35
|
-
*/
|
|
36
|
-
export function message(): never;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Protocol Buffer Message Schema.
|
|
40
|
-
*
|
|
41
|
-
* Creates a Protocol Buffer Message Schema from a TypeScript type. The message
|
|
42
|
-
* schema would be returned as a string value, and it can be used to share with
|
|
43
|
-
* other developers/languages/frameworks.
|
|
44
|
-
*
|
|
45
|
-
* For reference, Protocol Buffer has lots of restrictions, so that expression power
|
|
46
|
-
* of Protocol Buffer is not enough strong to fully meet the TypeScript type specs.
|
|
47
|
-
* In such reason, if you put a TypeScript type that is not compatible with Protocol
|
|
48
|
-
* Buffer, this function would throw compilation errors.
|
|
49
|
-
*
|
|
50
|
-
* @template T Target type
|
|
51
|
-
* @returns Protocol Buffer Message Schema.
|
|
52
|
-
*
|
|
53
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
54
|
-
*/
|
|
55
|
-
export function message<T>(): string;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* @internal
|
|
59
|
-
*/
|
|
60
|
-
export function message(): never {
|
|
61
|
-
halt("message");
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/* -----------------------------------------------------------
|
|
65
|
-
DECODE
|
|
66
|
-
----------------------------------------------------------- */
|
|
67
|
-
/**
|
|
68
|
-
* > You must configure the generic argument `T`.
|
|
69
|
-
*
|
|
70
|
-
* Protocol Buffer Decoder.
|
|
71
|
-
*
|
|
72
|
-
* `typia.protobuf.decode()` is a function decoding a binary data of Protocol Buffer
|
|
73
|
-
* format to a TypeScript instance.
|
|
74
|
-
*
|
|
75
|
-
* For reference, as Protocol Buffer handles binary data directly, there's no way
|
|
76
|
-
* when `input` binary data was not encoded from the `T` typed value. In that case,
|
|
77
|
-
* unexpected behavior or internal error would be occured. Therefore, I recommend you
|
|
78
|
-
* to encode binary data of Protocol Buffer from type safe encode functions like below.
|
|
79
|
-
* Use {@link encode} function only when you can ensure it.
|
|
80
|
-
*
|
|
81
|
-
* - {@link assertEncode}
|
|
82
|
-
* - {@link isEncode}
|
|
83
|
-
* - {@link validateEncode}
|
|
84
|
-
*
|
|
85
|
-
* Also, `typia` is providing type safe decoders like {@link assertDecode}, but it
|
|
86
|
-
* is just for additional type validation like `number & Minimum<7>` or
|
|
87
|
-
* `string & Format<"uuid">` cases, that are represented by
|
|
88
|
-
* [custom tags](https://typia.io/docs/validators/tags). Thus, I repeat that,
|
|
89
|
-
* you've to ensure the type safety when using decoder functions.
|
|
90
|
-
*
|
|
91
|
-
* @template T Expected type of decoded value
|
|
92
|
-
* @param input Protobuf Buffer binary data
|
|
93
|
-
* @returns Decoded value
|
|
94
|
-
*
|
|
95
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
96
|
-
*/
|
|
97
|
-
function decode(input: Uint8Array): never;
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Protocol Buffer Decoder.
|
|
101
|
-
*
|
|
102
|
-
* `typia.protobuf.decode()` is a function decoding a binary data of Protocol Buffer
|
|
103
|
-
* format to a TypeScript instance.
|
|
104
|
-
*
|
|
105
|
-
* For reference, as Protocol Buffer handles binary data directly, there's no way
|
|
106
|
-
* when `input` binary data was not encoded from the `T` typed value. In that case,
|
|
107
|
-
* unexpected behavior or internal error would be occured. Therefore, I recommend you
|
|
108
|
-
* to encode binary data of Protocol Buffer from type safe encode functions like below.
|
|
109
|
-
* Use {@link encode} function only when you can ensure it.
|
|
110
|
-
*
|
|
111
|
-
* - {@link assertEncode}
|
|
112
|
-
* - {@link isEncode}
|
|
113
|
-
* - {@link validateEncode}
|
|
114
|
-
*
|
|
115
|
-
* Also, `typia` is providing type safe decoders like {@link assertDecode}, but it
|
|
116
|
-
* is just for additional type validation like `number & Minimum<7>` or
|
|
117
|
-
* `string & Format<"uuid">` cases, that are represented by
|
|
118
|
-
* [custom tags](https://typia.io/docs/validators/tags). Thus, I repeat that,
|
|
119
|
-
* you've to ensure the type safety when using decoder functions.
|
|
120
|
-
*
|
|
121
|
-
* @template T Expected type of decoded value
|
|
122
|
-
* @param input Protobuf Buffer binary data
|
|
123
|
-
* @returns Decoded value
|
|
124
|
-
*
|
|
125
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
126
|
-
*/
|
|
127
|
-
function decode<T>(input: Uint8Array): Resolved<T>;
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* @internal
|
|
131
|
-
*/
|
|
132
|
-
function decode(): never {
|
|
133
|
-
halt("decode");
|
|
134
|
-
}
|
|
135
|
-
const decodePure = /** @__PURE__ */ Object.assign<typeof decode, {}>(
|
|
136
|
-
decode,
|
|
137
|
-
/** @__PURE__ */ Namespace.protobuf.decode("decode"),
|
|
138
|
-
);
|
|
139
|
-
export { decodePure as decode };
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* > You must configure the generic argument `T`.
|
|
143
|
-
*
|
|
144
|
-
* Protocol Buffer Decoder wity type assertion, but not safe.
|
|
145
|
-
*
|
|
146
|
-
* `typia.protobuf.assertDecode()` is a combination function of {@link decode} and
|
|
147
|
-
* {@link assert} function. Therefore, it decodes a binary data of Protocol Buffer to
|
|
148
|
-
* a TypeScript instance, and performs type assertion process. If decoded value is
|
|
149
|
-
* following the type `T`, it returns the decoded value. Otherwise, it throws
|
|
150
|
-
* {@link TypeGuardError} instead.
|
|
151
|
-
*
|
|
152
|
-
* However, note that, this validation is not always safe. It just performs additional
|
|
153
|
-
* type assertion like `number & Minimum<7>` or `string & Format<"uuid">` cases,
|
|
154
|
-
* that are represented by [custom tags](https://typia.io/docs/validators/tags).
|
|
155
|
-
* Therefore, when using `typia.protobuf.assertDecode<T>()` function, you have to
|
|
156
|
-
* ensure the type safety by yourself.
|
|
157
|
-
*
|
|
158
|
-
* In such type safety reason, I recommend you to use type safe encode functions.
|
|
159
|
-
*
|
|
160
|
-
* - {@link assertEncode}
|
|
161
|
-
* - {@link isEncode}
|
|
162
|
-
* - {@link validateEncode}
|
|
163
|
-
*
|
|
164
|
-
* @template T Expected type of decoded value
|
|
165
|
-
* @param input Protobuf Buffer binary data
|
|
166
|
-
* @returns Decoded value
|
|
167
|
-
*
|
|
168
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
169
|
-
*/
|
|
170
|
-
function assertDecode(input: Uint8Array): never;
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Protocol Buffer Decoder wity type assertion, but not safe.
|
|
174
|
-
*
|
|
175
|
-
* `typia.protobuf.assertDecode()` is a combination function of {@link decode} and
|
|
176
|
-
* {@link assert} function. Therefore, it decodes a binary data of Protocol Buffer to
|
|
177
|
-
* a TypeScript instance, and performs type assertion process. If decoded value is
|
|
178
|
-
* following the type `T`, it returns the decoded value. Otherwise, it throws
|
|
179
|
-
* {@link TypeGuardError} instead.
|
|
180
|
-
*
|
|
181
|
-
* However, note that, this validation is not always safe. It just performs additional
|
|
182
|
-
* type assertion like `number & Minimum<7>` or `string & Format<"uuid">` cases,
|
|
183
|
-
* that are represented by [custom tags](https://typia.io/docs/validators/tags).
|
|
184
|
-
* Therefore, when using `typia.protobuf.assertDecode<T>()` function, you have to
|
|
185
|
-
* ensure the type safety by yourself.
|
|
186
|
-
*
|
|
187
|
-
* In such type safety reason, I recommend you to use type safe encode functions.
|
|
188
|
-
*
|
|
189
|
-
* - {@link assertEncode}
|
|
190
|
-
* - {@link isEncode}
|
|
191
|
-
* - {@link validateEncode}
|
|
192
|
-
*
|
|
193
|
-
* @template T Expected type of decoded value
|
|
194
|
-
* @param input Protobuf Buffer binary data
|
|
195
|
-
* @returns Decoded value
|
|
196
|
-
*
|
|
197
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
198
|
-
*/
|
|
199
|
-
function assertDecode<T>(input: Uint8Array): Resolved<T>;
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* @internal
|
|
203
|
-
*/
|
|
204
|
-
function assertDecode(): never {
|
|
205
|
-
halt("assertDecode");
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
const assertDecodePure = /** @__PURE__ */ Object.assign<
|
|
209
|
-
typeof assertDecode,
|
|
210
|
-
{},
|
|
211
|
-
{}
|
|
212
|
-
>(
|
|
213
|
-
assertDecode,
|
|
214
|
-
/** @__PURE__ */ Namespace.assert("protobuf.assertDecode"),
|
|
215
|
-
/** @__PURE__ */ Namespace.protobuf.decode("assertDecode"),
|
|
216
|
-
);
|
|
217
|
-
export { assertDecodePure as assertDecode };
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* > You must configure the generic argument `T`.
|
|
221
|
-
*
|
|
222
|
-
* Protocol Buffer Decoder wity type checking, but not safe.
|
|
223
|
-
*
|
|
224
|
-
* `typia.protobuf.isDecode()` is a combination function of {@link decode} and
|
|
225
|
-
* {@link is} function. Therefore, it decodes a binary data of Protocol Buffer to
|
|
226
|
-
* a TypeScript instance, and performs type checking process. If decoded value is
|
|
227
|
-
* following the type `T`, it returns the decoded value. Otherwise, it returns
|
|
228
|
-
* `null` value instead.
|
|
229
|
-
*
|
|
230
|
-
* However, note that, this validation is not always safe. It just performs additional
|
|
231
|
-
* type checking like `number & Minimum<7>` or `string & Format<"uuid">` cases,
|
|
232
|
-
* that are represented by [custom tags](https://typia.io/docs/validators/tags).
|
|
233
|
-
* Therefore, when using `typia.protobuf.isDecode<T>()` function, you have to
|
|
234
|
-
* ensure the type safety by yourself.
|
|
235
|
-
*
|
|
236
|
-
* In such type safety reason, I recommend you to use type safe encode functions.
|
|
237
|
-
*
|
|
238
|
-
* - {@link assertEncode}
|
|
239
|
-
* - {@link isEncode}
|
|
240
|
-
* - {@link validateEncode}
|
|
241
|
-
*
|
|
242
|
-
* @template T Expected type of decoded value
|
|
243
|
-
* @param input Protobuf Buffer binary data
|
|
244
|
-
* @returns Decoded value
|
|
245
|
-
*
|
|
246
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
247
|
-
*/
|
|
248
|
-
function isDecode(input: Uint8Array): never;
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Protocol Buffer Decoder wity type checking, but not safe.
|
|
252
|
-
*
|
|
253
|
-
* `typia.protobuf.isDecode()` is a combination function of {@link decode} and
|
|
254
|
-
* {@link is} function. Therefore, it decodes a binary data of Protocol Buffer to
|
|
255
|
-
* a TypeScript instance, and performs type checking process. If decoded value is
|
|
256
|
-
* following the type `T`, it returns the decoded value. Otherwise, it returns
|
|
257
|
-
* `null` value instead.
|
|
258
|
-
*
|
|
259
|
-
* However, note that, this validation is not always safe. It just performs additional
|
|
260
|
-
* type checking like `number & Minimum<7>` or `string & Format<"uuid">` cases,
|
|
261
|
-
* that are represented by [custom tags](https://typia.io/docs/validators/tags).
|
|
262
|
-
* Therefore, when using `typia.protobuf.isDecode<T>()` function, you have to
|
|
263
|
-
* ensure the type safety by yourself.
|
|
264
|
-
*
|
|
265
|
-
* In such type safety reason, I recommend you to use type safe encode functions.
|
|
266
|
-
*
|
|
267
|
-
* - {@link assertEncode}
|
|
268
|
-
* - {@link isEncode}
|
|
269
|
-
* - {@link validateEncode}
|
|
270
|
-
*
|
|
271
|
-
* @template T Expected type of decoded value
|
|
272
|
-
* @param input Protobuf Buffer binary data
|
|
273
|
-
* @returns Decoded value
|
|
274
|
-
*
|
|
275
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
276
|
-
*/
|
|
277
|
-
function isDecode<T>(input: Uint8Array): Resolved<T> | null;
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* @internal
|
|
281
|
-
*/
|
|
282
|
-
function isDecode(): never {
|
|
283
|
-
halt("isDecode");
|
|
284
|
-
}
|
|
285
|
-
const isDecodePure = /** @__PURE__ */ Object.assign<typeof isDecode, {}, {}>(
|
|
286
|
-
isDecode,
|
|
287
|
-
/** @__PURE__ */ Namespace.is(),
|
|
288
|
-
/** @__PURE__ */ Namespace.protobuf.decode("isDecode"),
|
|
289
|
-
);
|
|
290
|
-
export { isDecodePure as isDecode };
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* > You must configure the generic argument `T`.
|
|
294
|
-
*
|
|
295
|
-
* Protocol Buffer Decoder wity type validation, but not safe.
|
|
296
|
-
*
|
|
297
|
-
* `typia.protobuf.validateDecode()` is a combination function of {@link decode} and
|
|
298
|
-
* {@link validate} function. Therefore, it decodes a binary data of Protocol Buffer to
|
|
299
|
-
* a TypeScript instance, and performs type validation process. If decoded value is
|
|
300
|
-
* following the type `T`, it returns the decoded value with
|
|
301
|
-
* {@link IValidation.ISuccess} typed instance. Otherwise, it returns
|
|
302
|
-
* {@link IValidation.IFailure} value instead with detailed error reasons.
|
|
303
|
-
*
|
|
304
|
-
* However, note that, this validation is not always safe. It just performs additional
|
|
305
|
-
* type validation like `number & Minimum<7>` or `string & Format<"uuid">` cases,
|
|
306
|
-
* that are represented by [custom tags](https://typia.io/docs/validators/tags).
|
|
307
|
-
* Therefore, when using `typia.protobuf.validateDecode<T>()` function, you have to
|
|
308
|
-
* ensure the type safety by yourself.
|
|
309
|
-
*
|
|
310
|
-
* In such type safety reason, I recommend you to use type safe encode functions.
|
|
311
|
-
*
|
|
312
|
-
* - {@link assertEncode}
|
|
313
|
-
* - {@link isEncode}
|
|
314
|
-
* - {@link validateEncode}
|
|
315
|
-
*
|
|
316
|
-
* @template T Expected type of decoded value
|
|
317
|
-
* @param input Protobuf Buffer binary data
|
|
318
|
-
* @returns Decoded value
|
|
319
|
-
*
|
|
320
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
321
|
-
*/
|
|
322
|
-
function validateDecode(input: Uint8Array): never;
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* Protocol Buffer Decoder wity type validation, but not safe.
|
|
326
|
-
*
|
|
327
|
-
* `typia.protobuf.validateDecode()` is a combination function of {@link decode} and
|
|
328
|
-
* {@link validate} function. Therefore, it decodes a binary data of Protocol Buffer to
|
|
329
|
-
* a TypeScript instance, and performs type validation process. If decoded value is
|
|
330
|
-
* following the type `T`, it returns the decoded value with
|
|
331
|
-
* {@link IValidation.ISuccess} typed instance. Otherwise, it returns
|
|
332
|
-
* {@link IValidation.IFailure} value instead with detailed error reasons.
|
|
333
|
-
*
|
|
334
|
-
* However, note that, this validation is not always safe. It just performs additional
|
|
335
|
-
* type validation like `number & Minimum<7>` or `string & Format<"uuid">` cases,
|
|
336
|
-
* that are represented by [custom tags](https://typia.io/docs/validators/tags).
|
|
337
|
-
* Therefore, when using `typia.protobuf.validateDecode<T>()` function, you have to
|
|
338
|
-
* ensure the type safety by yourself.
|
|
339
|
-
*
|
|
340
|
-
* In such type safety reason, I recommend you to use type safe encode functions.
|
|
341
|
-
*
|
|
342
|
-
* - {@link assertEncode}
|
|
343
|
-
* - {@link isEncode}
|
|
344
|
-
* - {@link validateEncode}
|
|
345
|
-
*
|
|
346
|
-
* @template T Expected type of decoded value
|
|
347
|
-
* @param input Protobuf Buffer binary data
|
|
348
|
-
* @returns Decoded value
|
|
349
|
-
*
|
|
350
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
351
|
-
*/
|
|
352
|
-
function validateDecode<T>(input: Uint8Array): IValidation<Resolved<T>>;
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* @internal
|
|
356
|
-
*/
|
|
357
|
-
function validateDecode(): never {
|
|
358
|
-
halt("validateDecode");
|
|
359
|
-
}
|
|
360
|
-
const validateDecodePure = /** @__PURE__ */ Object.assign<
|
|
361
|
-
typeof validateDecode,
|
|
362
|
-
{},
|
|
363
|
-
{}
|
|
364
|
-
>(
|
|
365
|
-
validateDecode,
|
|
366
|
-
/** @__PURE__ */ Namespace.validate(),
|
|
367
|
-
/** @__PURE__ */ Namespace.protobuf.decode("validateDecode"),
|
|
368
|
-
);
|
|
369
|
-
export { validateDecodePure as validateDecode };
|
|
370
|
-
|
|
371
|
-
/* -----------------------------------------------------------
|
|
372
|
-
ENCODE
|
|
373
|
-
----------------------------------------------------------- */
|
|
374
|
-
/**
|
|
375
|
-
* Protocol Buffer Encoder.
|
|
376
|
-
*
|
|
377
|
-
* Converts an input value to a binary data of Protocol Buffer format.
|
|
378
|
-
*
|
|
379
|
-
* For reference, this `typia.protobuf.encode()` does not validate the `input` value.
|
|
380
|
-
* It just believes that the `input` value is valid and converts it to a binary data
|
|
381
|
-
* directly. Therefore, if you can't ensure the `input` value type, it would better to
|
|
382
|
-
* call one of below functions intead.
|
|
383
|
-
*
|
|
384
|
-
* - {@link assertEncode}
|
|
385
|
-
* - {@link isEncode}
|
|
386
|
-
* - {@link validateEncode}
|
|
387
|
-
*
|
|
388
|
-
* By the way, you know what? Expression power of Protocol Buffer is not enough strong
|
|
389
|
-
* to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
|
|
390
|
-
* type that is not compatible with Protocol Buffer, this function would throw
|
|
391
|
-
* compilation errors.
|
|
392
|
-
*
|
|
393
|
-
* - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
|
|
394
|
-
*
|
|
395
|
-
* @template T Type of the value input
|
|
396
|
-
* @param input A value to encode
|
|
397
|
-
* @returns Encoded binary data
|
|
398
|
-
*
|
|
399
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
400
|
-
*/
|
|
401
|
-
function encode<T>(input: T): Uint8Array;
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* @internal
|
|
405
|
-
*/
|
|
406
|
-
function encode(): never {
|
|
407
|
-
halt("encode");
|
|
408
|
-
}
|
|
409
|
-
const encodePure = /** @__PURE__ */ Object.assign<typeof encode, {}>(
|
|
410
|
-
encode,
|
|
411
|
-
/** @__PURE__ */ Namespace.protobuf.encode("encode"),
|
|
412
|
-
);
|
|
413
|
-
export { encodePure as encode };
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* Protocol Buffer Encoder with type assertion.
|
|
417
|
-
*
|
|
418
|
-
* `typia.protobuf.assertEncode()` is a combination function of {@link assert} and
|
|
419
|
-
* {@link encode}.
|
|
420
|
-
*
|
|
421
|
-
* Therefore, it converts an `input` value to a binary data of
|
|
422
|
-
* Protocol Buffer, with type assertion. If `input` value is not valid, it throws
|
|
423
|
-
* {@link TypeGuardError}. Otherwise, there's no problem on the `input` value,
|
|
424
|
-
* Protocol Buffer binary data would be returned.
|
|
425
|
-
*
|
|
426
|
-
* If you can trust `input` value, or want to perform other type of validation, use
|
|
427
|
-
* below functions intead.
|
|
428
|
-
*
|
|
429
|
-
* - {@link encode}
|
|
430
|
-
* - {@link isEncode}
|
|
431
|
-
* - {@link validateEncode}
|
|
432
|
-
*
|
|
433
|
-
* By the way, you know what? Expression power of Protocol Buffer is not enough strong
|
|
434
|
-
* to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
|
|
435
|
-
* type that is not compatible with Protocol Buffer, this function would throw
|
|
436
|
-
* compilation errors.
|
|
437
|
-
*
|
|
438
|
-
* - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
|
|
439
|
-
*
|
|
440
|
-
* @template T Type of the value input
|
|
441
|
-
* @param input A value to encode
|
|
442
|
-
* @returns Encoded binary data
|
|
443
|
-
*
|
|
444
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
445
|
-
*/
|
|
446
|
-
function assertEncode<T>(input: T): Uint8Array;
|
|
447
|
-
|
|
448
|
-
/**
|
|
449
|
-
* Protocol Buffer Encoder with type assertion.
|
|
450
|
-
*
|
|
451
|
-
* `typia.protobuf.assertEncode()` is a combination function of {@link assert} and
|
|
452
|
-
* {@link encode}.
|
|
453
|
-
*
|
|
454
|
-
* Therefore, it converts an `input` value to a binary data of
|
|
455
|
-
* Protocol Buffer, with type assertion. If `input` value is not valid, it throws
|
|
456
|
-
* {@link TypeGuardError}. Otherwise, there's no problem on the `input` value,
|
|
457
|
-
* Protocol Buffer binary data would be returned.
|
|
458
|
-
*
|
|
459
|
-
* If you can trust `input` value, or want to perform other type of validation, use
|
|
460
|
-
* below functions intead.
|
|
461
|
-
*
|
|
462
|
-
* - {@link encode}
|
|
463
|
-
* - {@link isEncode}
|
|
464
|
-
* - {@link validateEncode}
|
|
465
|
-
*
|
|
466
|
-
* By the way, you know what? Expression power of Protocol Buffer is not enough strong
|
|
467
|
-
* to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
|
|
468
|
-
* type that is not compatible with Protocol Buffer, this function would throw
|
|
469
|
-
* compilation errors.
|
|
470
|
-
*
|
|
471
|
-
* - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
|
|
472
|
-
*
|
|
473
|
-
* @template T Type of the value input
|
|
474
|
-
* @param input A value to encode
|
|
475
|
-
* @returns Encoded binary data
|
|
476
|
-
*
|
|
477
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
478
|
-
*/
|
|
479
|
-
function assertEncode<T>(input: unknown): Uint8Array;
|
|
480
|
-
|
|
481
|
-
/**
|
|
482
|
-
* @internal
|
|
483
|
-
*/
|
|
484
|
-
function assertEncode(): never {
|
|
485
|
-
halt("assertEncode");
|
|
486
|
-
}
|
|
487
|
-
const assertEncodePure = /** @__PURE__ */ Object.assign<
|
|
488
|
-
typeof assertEncode,
|
|
489
|
-
{},
|
|
490
|
-
{}
|
|
491
|
-
>(
|
|
492
|
-
assertEncode,
|
|
493
|
-
/** @__PURE__ */ Namespace.assert("protobuf.assertEncode"),
|
|
494
|
-
/** @__PURE__ */ Namespace.protobuf.encode("assertEncode"),
|
|
495
|
-
);
|
|
496
|
-
export { assertEncodePure as assertEncode };
|
|
497
|
-
|
|
498
|
-
/**
|
|
499
|
-
* Protocol Buffer Encoder with type checking.
|
|
500
|
-
*
|
|
501
|
-
* `typia.protobuf.isEncode()` is a combination function of {@link is} and
|
|
502
|
-
* {@link encode}.
|
|
503
|
-
*
|
|
504
|
-
* Therefore, it converts an `input` value to a binary data of
|
|
505
|
-
* Protocol Buffer, with type checking. If `input` value is not valid, it returns
|
|
506
|
-
* `null` value. Otherwise, there's no problem on the `input` value, Protocol
|
|
507
|
-
* Buffer binary data would be returned.
|
|
508
|
-
*
|
|
509
|
-
* If you can trust `input` value, or want to perform other type of validation, use
|
|
510
|
-
* below functions intead.
|
|
511
|
-
*
|
|
512
|
-
* - {@link encode}
|
|
513
|
-
* - {@link assertEncode}
|
|
514
|
-
* - {@link validateEncode}
|
|
515
|
-
*
|
|
516
|
-
* By the way, you know what? Expression power of Protocol Buffer is not enough strong
|
|
517
|
-
* to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
|
|
518
|
-
* type that is not compatible with Protocol Buffer, this function would throw
|
|
519
|
-
* compilation errors.
|
|
520
|
-
*
|
|
521
|
-
* - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
|
|
522
|
-
*
|
|
523
|
-
* @template T Type of the value input
|
|
524
|
-
* @param input A value to encode
|
|
525
|
-
* @returns Encoded binary data
|
|
526
|
-
*
|
|
527
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
528
|
-
*/
|
|
529
|
-
function isEncode<T>(input: T): Uint8Array | null;
|
|
530
|
-
|
|
531
|
-
/**
|
|
532
|
-
* Protocol Buffer Encoder with type checking.
|
|
533
|
-
*
|
|
534
|
-
* `typia.protobuf.isEncode()` is a combination function of {@link is} and
|
|
535
|
-
* {@link encode}.
|
|
536
|
-
*
|
|
537
|
-
* Therefore, it converts an `input` value to a binary data of
|
|
538
|
-
* Protocol Buffer, with type checking. If `input` value is not valid, it returns
|
|
539
|
-
* `null` value. Otherwise, there's no problem on the `input` value, Protocol
|
|
540
|
-
* Buffer binary data would be returned.
|
|
541
|
-
*
|
|
542
|
-
* If you can trust `input` value, or want to perform other type of validation, use
|
|
543
|
-
* below functions intead.
|
|
544
|
-
*
|
|
545
|
-
* - {@link encode}
|
|
546
|
-
* - {@link assertEncode}
|
|
547
|
-
* - {@link validateEncode}
|
|
548
|
-
*
|
|
549
|
-
* By the way, you know what? Expression power of Protocol Buffer is not enough strong
|
|
550
|
-
* to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
|
|
551
|
-
* type that is not compatible with Protocol Buffer, this function would throw
|
|
552
|
-
* compilation errors.
|
|
553
|
-
*
|
|
554
|
-
* - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
|
|
555
|
-
*
|
|
556
|
-
* @template T Type of the value input
|
|
557
|
-
* @param input A value to encode
|
|
558
|
-
* @returns Encoded binary data
|
|
559
|
-
*
|
|
560
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
561
|
-
*/
|
|
562
|
-
function isEncode<T>(input: unknown): Uint8Array | null;
|
|
563
|
-
|
|
564
|
-
/**
|
|
565
|
-
* @internal
|
|
566
|
-
*/
|
|
567
|
-
function isEncode(): never {
|
|
568
|
-
halt("isEncode");
|
|
569
|
-
}
|
|
570
|
-
const isEncodePure = /** @__PURE__ */ Object.assign<typeof isEncode, {}, {}>(
|
|
571
|
-
isEncode,
|
|
572
|
-
/** @__PURE__ */ Namespace.is(),
|
|
573
|
-
/** @__PURE__ */ Namespace.protobuf.encode("isEncode"),
|
|
574
|
-
);
|
|
575
|
-
export { isEncodePure as isEncode };
|
|
576
|
-
|
|
577
|
-
/**
|
|
578
|
-
* Protocol Buffer Encoder with type validation.
|
|
579
|
-
*
|
|
580
|
-
* `typia.protobuf.validateEncode()` is a combination function of
|
|
581
|
-
* {@link validation} and {@link encode}.
|
|
582
|
-
*
|
|
583
|
-
* Therefore, it converts an `input` value to a binary data of
|
|
584
|
-
* Protocol Buffer, with type validation. If `input` value is not valid, it returns
|
|
585
|
-
* {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
|
|
586
|
-
* no problem on the `input` value, Protocol Buffer binary data would be stored in
|
|
587
|
-
* `data` property of the output {@link IValidation.ISuccess} instance.
|
|
588
|
-
*
|
|
589
|
-
* If you can trust `input` value, or want to perform other type of validation, use
|
|
590
|
-
* below functions intead.
|
|
591
|
-
*
|
|
592
|
-
* - {@link encode}
|
|
593
|
-
* - {@link assertEncode}
|
|
594
|
-
* - {@link isEncode}
|
|
595
|
-
*
|
|
596
|
-
* By the way, you know what? Expression power of Protocol Buffer is not enough strong
|
|
597
|
-
* to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
|
|
598
|
-
* type that is not compatible with Protocol Buffer, this function would throw
|
|
599
|
-
* compilation errors.
|
|
600
|
-
*
|
|
601
|
-
* - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
|
|
602
|
-
*
|
|
603
|
-
* @template T Type of the value input
|
|
604
|
-
* @param input A value to encode
|
|
605
|
-
* @returns Encoded binary data
|
|
606
|
-
*
|
|
607
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
608
|
-
*/
|
|
609
|
-
function validateEncode<T>(input: T): IValidation<Uint8Array>;
|
|
610
|
-
|
|
611
|
-
/**
|
|
612
|
-
* Protocol Buffer Encoder with type validation.
|
|
613
|
-
*
|
|
614
|
-
* `typia.protobuf.validateEncode()` is a combination function of
|
|
615
|
-
* {@link validation} and {@link encode}.
|
|
616
|
-
*
|
|
617
|
-
* Therefore, it converts an `input` value to a binary data of
|
|
618
|
-
* Protocol Buffer, with type validation. If `input` value is not valid, it returns
|
|
619
|
-
* {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
|
|
620
|
-
* no problem on the `input` value, Protocol Buffer binary data would be stored in
|
|
621
|
-
* `data` property of the output {@link IValidation.ISuccess} instance.
|
|
622
|
-
*
|
|
623
|
-
* If you can trust `input` value, or want to perform other type of validation, use
|
|
624
|
-
* below functions intead.
|
|
625
|
-
*
|
|
626
|
-
* - {@link encode}
|
|
627
|
-
* - {@link assertEncode}
|
|
628
|
-
* - {@link isEncode}
|
|
629
|
-
*
|
|
630
|
-
* By the way, you know what? Expression power of Protocol Buffer is not enough strong
|
|
631
|
-
* to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
|
|
632
|
-
* type that is not compatible with Protocol Buffer, this function would throw
|
|
633
|
-
* compilation errors.
|
|
634
|
-
*
|
|
635
|
-
* - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
|
|
636
|
-
*
|
|
637
|
-
* @template T Type of the value input
|
|
638
|
-
* @param input A value to encode
|
|
639
|
-
* @returns Encoded binary data
|
|
640
|
-
*
|
|
641
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
642
|
-
*/
|
|
643
|
-
function validateEncode<T>(input: unknown): IValidation<Uint8Array>;
|
|
644
|
-
|
|
645
|
-
/**
|
|
646
|
-
* @internal
|
|
647
|
-
*/
|
|
648
|
-
function validateEncode(): never {
|
|
649
|
-
halt("validateEncode");
|
|
650
|
-
}
|
|
651
|
-
const validateEncodePure = /** @__PURE__ */ Object.assign<
|
|
652
|
-
typeof validateEncode,
|
|
653
|
-
{},
|
|
654
|
-
{}
|
|
655
|
-
>(
|
|
656
|
-
validateEncode,
|
|
657
|
-
/** @__PURE__ */ Namespace.validate(),
|
|
658
|
-
/** @__PURE__ */ Namespace.protobuf.encode("validateEncode"),
|
|
659
|
-
);
|
|
660
|
-
export { validateEncodePure as validateEncode };
|
|
661
|
-
|
|
662
|
-
/* -----------------------------------------------------------
|
|
663
|
-
FACTORY FUNCTIONS
|
|
664
|
-
----------------------------------------------------------- */
|
|
665
|
-
/**
|
|
666
|
-
* Creates a reusable {@link decode} function.
|
|
667
|
-
*
|
|
668
|
-
* @danger You must configure the generic argument `T`
|
|
669
|
-
* @returns Nothing until you configure the generic argument `T`
|
|
670
|
-
* @throws compile error
|
|
671
|
-
*
|
|
672
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
673
|
-
*/
|
|
674
|
-
function createDecode(): never;
|
|
675
|
-
|
|
676
|
-
/**
|
|
677
|
-
* Creates a reusable {@link decode} function.
|
|
678
|
-
*
|
|
679
|
-
* @template T Target type
|
|
680
|
-
* @returns A reusable `decode` function
|
|
681
|
-
*
|
|
682
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
683
|
-
*/
|
|
684
|
-
function createDecode<T>(): (input: Uint8Array) => Resolved<T>;
|
|
685
|
-
|
|
686
|
-
/**
|
|
687
|
-
* @internal
|
|
688
|
-
*/
|
|
689
|
-
function createDecode<T>(): (input: Uint8Array) => Resolved<T> {
|
|
690
|
-
halt("createDecode");
|
|
691
|
-
}
|
|
692
|
-
const createDecodePure = /** @__PURE__ */ Object.assign<
|
|
693
|
-
typeof createDecode,
|
|
694
|
-
{}
|
|
695
|
-
>(createDecode, /** @__PURE__ */ Namespace.protobuf.decode("createDecode"));
|
|
696
|
-
export { createDecodePure as createDecode };
|
|
697
|
-
|
|
698
|
-
/**
|
|
699
|
-
* Creates a reusable {@link isDecode} function.
|
|
700
|
-
*
|
|
701
|
-
* @danger You must configure the generic argument `T`
|
|
702
|
-
* @returns Nothing until you configure the generic argument `T`
|
|
703
|
-
* @throws compile error
|
|
704
|
-
*
|
|
705
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
706
|
-
*/
|
|
707
|
-
function createIsDecode(): never;
|
|
708
|
-
|
|
709
|
-
/**
|
|
710
|
-
* Creates a reusable {@link isDecode} function.
|
|
711
|
-
*
|
|
712
|
-
* @template T Target type
|
|
713
|
-
* @returns A reusable `isDecode` function
|
|
714
|
-
*
|
|
715
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
716
|
-
*/
|
|
717
|
-
function createIsDecode<T>(): (input: Uint8Array) => Resolved<T> | null;
|
|
718
|
-
|
|
719
|
-
/**
|
|
720
|
-
* @internal
|
|
721
|
-
*/
|
|
722
|
-
function createIsDecode<T>(): (input: Uint8Array) => Resolved<T> | null {
|
|
723
|
-
halt("createIsDecode");
|
|
724
|
-
}
|
|
725
|
-
const createIsDecodePure = /** @__PURE__ */ Object.assign<
|
|
726
|
-
typeof createIsDecode,
|
|
727
|
-
{},
|
|
728
|
-
{}
|
|
729
|
-
>(
|
|
730
|
-
createIsDecode,
|
|
731
|
-
/** @__PURE__ */ Namespace.is(),
|
|
732
|
-
/** @__PURE__ */ Namespace.protobuf.decode("createIsDecode"),
|
|
733
|
-
);
|
|
734
|
-
export { createIsDecodePure as createIsDecode };
|
|
735
|
-
|
|
736
|
-
/**
|
|
737
|
-
* Creates a reusable {@link assertDecode} function.
|
|
738
|
-
*
|
|
739
|
-
* @danger You must configure the generic argument `T`
|
|
740
|
-
* @returns Nothing until you configure the generic argument `T`
|
|
741
|
-
* @throws compile error
|
|
742
|
-
*
|
|
743
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
744
|
-
*/
|
|
745
|
-
function createAssertDecode(): never;
|
|
746
|
-
|
|
747
|
-
/**
|
|
748
|
-
* Creates a reusable {@link assertDecode} function.
|
|
749
|
-
*
|
|
750
|
-
* @template T Target type
|
|
751
|
-
* @returns A reusable `assertDecode` function
|
|
752
|
-
*
|
|
753
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
754
|
-
*/
|
|
755
|
-
function createAssertDecode<T>(): (input: Uint8Array) => Resolved<T>;
|
|
756
|
-
|
|
757
|
-
/**
|
|
758
|
-
* @internal
|
|
759
|
-
*/
|
|
760
|
-
function createAssertDecode<T>(): (input: Uint8Array) => Resolved<T> {
|
|
761
|
-
halt("createAssertDecode");
|
|
762
|
-
}
|
|
763
|
-
const createAssertDecodePure = /** @__PURE__ */ Object.assign<
|
|
764
|
-
typeof createAssertDecode,
|
|
765
|
-
{},
|
|
766
|
-
{}
|
|
767
|
-
>(
|
|
768
|
-
createAssertDecode,
|
|
769
|
-
/** @__PURE__ */ Namespace.assert("protobuf.createAssertDecode"),
|
|
770
|
-
/** @__PURE__ */ Namespace.protobuf.decode("createAssertDecode"),
|
|
771
|
-
);
|
|
772
|
-
export { createAssertDecodePure as createAssertDecode };
|
|
773
|
-
|
|
774
|
-
/**
|
|
775
|
-
* Creates a reusable {@link validateDecode} function.
|
|
776
|
-
*
|
|
777
|
-
* @danger You must configure the generic argument `T`
|
|
778
|
-
* @returns Nothing until you configure the generic argument `T`
|
|
779
|
-
* @throws compile error
|
|
780
|
-
*
|
|
781
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
782
|
-
*/
|
|
783
|
-
function createValidateDecode(): never;
|
|
784
|
-
|
|
785
|
-
/**
|
|
786
|
-
* Creates a reusable {@link validateDecode} function.
|
|
787
|
-
*
|
|
788
|
-
* @template T Target type
|
|
789
|
-
* @returns A reusable `validateDecode` function
|
|
790
|
-
*
|
|
791
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
792
|
-
*/
|
|
793
|
-
function createValidateDecode<T>(): (
|
|
794
|
-
input: Uint8Array,
|
|
795
|
-
) => IValidation<Resolved<T>>;
|
|
796
|
-
|
|
797
|
-
/**
|
|
798
|
-
* @internal
|
|
799
|
-
*/
|
|
800
|
-
function createValidateDecode<T>(): (
|
|
801
|
-
input: Uint8Array,
|
|
802
|
-
) => IValidation<Resolved<T>> {
|
|
803
|
-
halt("createValidateDecode");
|
|
804
|
-
}
|
|
805
|
-
const createValidateDecodePure = /** @__PURE__ */ Object.assign<
|
|
806
|
-
typeof createValidateDecode,
|
|
807
|
-
{},
|
|
808
|
-
{}
|
|
809
|
-
>(
|
|
810
|
-
createValidateDecode,
|
|
811
|
-
/** @__PURE__ */ Namespace.validate(),
|
|
812
|
-
/** @__PURE__ */ Namespace.protobuf.decode("createValidateDecode"),
|
|
813
|
-
);
|
|
814
|
-
export { createValidateDecodePure as createValidateDecode };
|
|
815
|
-
|
|
816
|
-
/**
|
|
817
|
-
* Creates a reusable {@link encode} function.
|
|
818
|
-
*
|
|
819
|
-
* @danger You must configure the generic argument `T`
|
|
820
|
-
* @returns Nothing until you configure the generic argument `T`
|
|
821
|
-
* @throws compile error
|
|
822
|
-
*
|
|
823
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
824
|
-
*/
|
|
825
|
-
function createEncode(): never;
|
|
826
|
-
|
|
827
|
-
/**
|
|
828
|
-
* Creates a reusable {@link encode} function.
|
|
829
|
-
*
|
|
830
|
-
* @template T Target type
|
|
831
|
-
* @returns A reusable `encode` function
|
|
832
|
-
*
|
|
833
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
834
|
-
*/
|
|
835
|
-
function createEncode<T>(): (input: T) => Uint8Array;
|
|
836
|
-
|
|
837
|
-
/**
|
|
838
|
-
* @internal
|
|
839
|
-
*/
|
|
840
|
-
function createEncode<T>(): (input: T) => Uint8Array {
|
|
841
|
-
halt("createEncode");
|
|
842
|
-
}
|
|
843
|
-
const createEncodePure = /** @__PURE__ */ Object.assign<
|
|
844
|
-
typeof createEncode,
|
|
845
|
-
{}
|
|
846
|
-
>(createEncode, /** @__PURE__ */ Namespace.protobuf.encode("createEncode"));
|
|
847
|
-
export { createEncodePure as createEncode };
|
|
848
|
-
|
|
849
|
-
/**
|
|
850
|
-
* Creates a reusable {@link isEncode} function.
|
|
851
|
-
*
|
|
852
|
-
* @danger You must configure the generic argument `T`
|
|
853
|
-
* @returns Nothing until you configure the generic argument `T`
|
|
854
|
-
* @throws compile error
|
|
855
|
-
*
|
|
856
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
857
|
-
*/
|
|
858
|
-
function createIsEncode(): never;
|
|
859
|
-
|
|
860
|
-
/**
|
|
861
|
-
* Creates a reusable {@link isEncode} function.
|
|
862
|
-
*
|
|
863
|
-
* @template T Target type
|
|
864
|
-
* @returns A reusable `isEncode` function
|
|
865
|
-
*
|
|
866
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
867
|
-
*/
|
|
868
|
-
function createIsEncode<T>(): (input: T) => Uint8Array | null;
|
|
869
|
-
|
|
870
|
-
/**
|
|
871
|
-
* @internal
|
|
872
|
-
*/
|
|
873
|
-
function createIsEncode<T>(): (input: T) => Uint8Array | null {
|
|
874
|
-
halt("createIsEncode");
|
|
875
|
-
}
|
|
876
|
-
const createIsEncodePure = /** @__PURE__ */ Object.assign<
|
|
877
|
-
typeof createIsEncode,
|
|
878
|
-
{},
|
|
879
|
-
{}
|
|
880
|
-
>(
|
|
881
|
-
createIsEncode,
|
|
882
|
-
/** @__PURE__ */ Namespace.is(),
|
|
883
|
-
/** @__PURE__ */ Namespace.protobuf.encode("createIsEncode"),
|
|
884
|
-
);
|
|
885
|
-
export { createIsEncodePure as createIsEncode };
|
|
886
|
-
|
|
887
|
-
/**
|
|
888
|
-
* Creates a reusable {@link assertEncode} function.
|
|
889
|
-
*
|
|
890
|
-
* @danger You must configure the generic argument `T`
|
|
891
|
-
* @returns Nothing until you configure the generic argument `T`
|
|
892
|
-
* @throws compile error
|
|
893
|
-
*
|
|
894
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
895
|
-
*/
|
|
896
|
-
function createAssertEncode(): never;
|
|
897
|
-
|
|
898
|
-
/**
|
|
899
|
-
* Creates a reusable {@link assertEncode} function.
|
|
900
|
-
*
|
|
901
|
-
* @template T Target type
|
|
902
|
-
* @returns A reusable `assertEncode` function
|
|
903
|
-
*
|
|
904
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
905
|
-
*/
|
|
906
|
-
function createAssertEncode<T>(): (input: T) => Uint8Array;
|
|
907
|
-
|
|
908
|
-
/**
|
|
909
|
-
* @internal
|
|
910
|
-
*/
|
|
911
|
-
function createAssertEncode<T>(): (input: T) => Uint8Array {
|
|
912
|
-
halt("createAssertEncode");
|
|
913
|
-
}
|
|
914
|
-
const createAssertEncodePure = /** @__PURE__ */ Object.assign<
|
|
915
|
-
typeof createAssertEncode,
|
|
916
|
-
{},
|
|
917
|
-
{}
|
|
918
|
-
>(
|
|
919
|
-
createAssertEncode,
|
|
920
|
-
/** @__PURE__ */ Namespace.assert("protobuf.createAssertEncode"),
|
|
921
|
-
/** @__PURE__ */ Namespace.protobuf.encode("createAssertEncode"),
|
|
922
|
-
);
|
|
923
|
-
export { createAssertEncodePure as createAssertEncode };
|
|
924
|
-
|
|
925
|
-
/**
|
|
926
|
-
* Creates a reusable {@link validateEncode} function.
|
|
927
|
-
*
|
|
928
|
-
* @danger You must configure the generic argument `T`
|
|
929
|
-
* @returns Nothing until you configure the generic argument `T`
|
|
930
|
-
* @throws compile error
|
|
931
|
-
*
|
|
932
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
933
|
-
*/
|
|
934
|
-
function createValidateEncode(): never;
|
|
935
|
-
|
|
936
|
-
/**
|
|
937
|
-
* Creates a reusable {@link validateEncode} function.
|
|
938
|
-
*
|
|
939
|
-
* @template T Target type
|
|
940
|
-
* @returns A reusable `validateEncode` function
|
|
941
|
-
*
|
|
942
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
943
|
-
*/
|
|
944
|
-
function createValidateEncode<T>(): (input: T) => IValidation<Uint8Array>;
|
|
945
|
-
|
|
946
|
-
/**
|
|
947
|
-
* @internal
|
|
948
|
-
*/
|
|
949
|
-
function createValidateEncode<T>(): (input: T) => IValidation<Uint8Array> {
|
|
950
|
-
halt("createValidateEncode");
|
|
951
|
-
}
|
|
952
|
-
const createValidateEncodePure = /** @__PURE__ */ Object.assign<
|
|
953
|
-
typeof createValidateEncode,
|
|
954
|
-
{},
|
|
955
|
-
{}
|
|
956
|
-
>(
|
|
957
|
-
createValidateEncode,
|
|
958
|
-
/** @__PURE__ */ Namespace.validate(),
|
|
959
|
-
/** @__PURE__ */ Namespace.protobuf.encode("createValidateEncode"),
|
|
960
|
-
);
|
|
961
|
-
export { createValidateEncodePure as createValidateEncode };
|
|
962
|
-
|
|
963
|
-
/**
|
|
964
|
-
* @internal
|
|
965
|
-
*/
|
|
966
|
-
function halt(name: string): never {
|
|
967
|
-
throw new Error(
|
|
968
|
-
`Error on typia.protobuf.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
|
|
969
|
-
);
|
|
970
|
-
}
|
|
1
|
+
import * as Namespace from "./functional/Namespace";
|
|
2
|
+
|
|
3
|
+
import { IValidation } from "./IValidation";
|
|
4
|
+
import { Resolved } from "./Resolved";
|
|
5
|
+
|
|
6
|
+
/* ===========================================================
|
|
7
|
+
PROTOCOL BUFFER
|
|
8
|
+
- MESSAGE
|
|
9
|
+
- DECODE
|
|
10
|
+
- ENCODE
|
|
11
|
+
- FACTORY FUNCTIONS
|
|
12
|
+
==============================================================
|
|
13
|
+
SCHEMA
|
|
14
|
+
----------------------------------------------------------- */
|
|
15
|
+
/**
|
|
16
|
+
* > You must configure the generic argument `T`.
|
|
17
|
+
*
|
|
18
|
+
* Protocol Buffer Message Schema.
|
|
19
|
+
*
|
|
20
|
+
* Creates a Protocol Buffer Message Schema from a TypeScript type. The message
|
|
21
|
+
* schema would be returned as a string value, and it can be used to share with
|
|
22
|
+
* other developers/languages/frameworks.
|
|
23
|
+
*
|
|
24
|
+
* For reference, Protocol Buffer has lots of restrictions, so that expression power
|
|
25
|
+
* of Protocol Buffer is not enough strong to fully meet the TypeScript type specs.
|
|
26
|
+
* In such reason, if you put a TypeScript type that is not compatible with Protocol
|
|
27
|
+
* Buffer, this function would throw compilation errors.
|
|
28
|
+
*
|
|
29
|
+
* - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
|
|
30
|
+
*
|
|
31
|
+
* @template T Target type
|
|
32
|
+
* @returns Protocol Buffer Message Schema.
|
|
33
|
+
*
|
|
34
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
35
|
+
*/
|
|
36
|
+
export function message(): never;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Protocol Buffer Message Schema.
|
|
40
|
+
*
|
|
41
|
+
* Creates a Protocol Buffer Message Schema from a TypeScript type. The message
|
|
42
|
+
* schema would be returned as a string value, and it can be used to share with
|
|
43
|
+
* other developers/languages/frameworks.
|
|
44
|
+
*
|
|
45
|
+
* For reference, Protocol Buffer has lots of restrictions, so that expression power
|
|
46
|
+
* of Protocol Buffer is not enough strong to fully meet the TypeScript type specs.
|
|
47
|
+
* In such reason, if you put a TypeScript type that is not compatible with Protocol
|
|
48
|
+
* Buffer, this function would throw compilation errors.
|
|
49
|
+
*
|
|
50
|
+
* @template T Target type
|
|
51
|
+
* @returns Protocol Buffer Message Schema.
|
|
52
|
+
*
|
|
53
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
54
|
+
*/
|
|
55
|
+
export function message<T>(): string;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
export function message(): never {
|
|
61
|
+
halt("message");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* -----------------------------------------------------------
|
|
65
|
+
DECODE
|
|
66
|
+
----------------------------------------------------------- */
|
|
67
|
+
/**
|
|
68
|
+
* > You must configure the generic argument `T`.
|
|
69
|
+
*
|
|
70
|
+
* Protocol Buffer Decoder.
|
|
71
|
+
*
|
|
72
|
+
* `typia.protobuf.decode()` is a function decoding a binary data of Protocol Buffer
|
|
73
|
+
* format to a TypeScript instance.
|
|
74
|
+
*
|
|
75
|
+
* For reference, as Protocol Buffer handles binary data directly, there's no way
|
|
76
|
+
* when `input` binary data was not encoded from the `T` typed value. In that case,
|
|
77
|
+
* unexpected behavior or internal error would be occured. Therefore, I recommend you
|
|
78
|
+
* to encode binary data of Protocol Buffer from type safe encode functions like below.
|
|
79
|
+
* Use {@link encode} function only when you can ensure it.
|
|
80
|
+
*
|
|
81
|
+
* - {@link assertEncode}
|
|
82
|
+
* - {@link isEncode}
|
|
83
|
+
* - {@link validateEncode}
|
|
84
|
+
*
|
|
85
|
+
* Also, `typia` is providing type safe decoders like {@link assertDecode}, but it
|
|
86
|
+
* is just for additional type validation like `number & Minimum<7>` or
|
|
87
|
+
* `string & Format<"uuid">` cases, that are represented by
|
|
88
|
+
* [custom tags](https://typia.io/docs/validators/tags). Thus, I repeat that,
|
|
89
|
+
* you've to ensure the type safety when using decoder functions.
|
|
90
|
+
*
|
|
91
|
+
* @template T Expected type of decoded value
|
|
92
|
+
* @param input Protobuf Buffer binary data
|
|
93
|
+
* @returns Decoded value
|
|
94
|
+
*
|
|
95
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
96
|
+
*/
|
|
97
|
+
function decode(input: Uint8Array): never;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Protocol Buffer Decoder.
|
|
101
|
+
*
|
|
102
|
+
* `typia.protobuf.decode()` is a function decoding a binary data of Protocol Buffer
|
|
103
|
+
* format to a TypeScript instance.
|
|
104
|
+
*
|
|
105
|
+
* For reference, as Protocol Buffer handles binary data directly, there's no way
|
|
106
|
+
* when `input` binary data was not encoded from the `T` typed value. In that case,
|
|
107
|
+
* unexpected behavior or internal error would be occured. Therefore, I recommend you
|
|
108
|
+
* to encode binary data of Protocol Buffer from type safe encode functions like below.
|
|
109
|
+
* Use {@link encode} function only when you can ensure it.
|
|
110
|
+
*
|
|
111
|
+
* - {@link assertEncode}
|
|
112
|
+
* - {@link isEncode}
|
|
113
|
+
* - {@link validateEncode}
|
|
114
|
+
*
|
|
115
|
+
* Also, `typia` is providing type safe decoders like {@link assertDecode}, but it
|
|
116
|
+
* is just for additional type validation like `number & Minimum<7>` or
|
|
117
|
+
* `string & Format<"uuid">` cases, that are represented by
|
|
118
|
+
* [custom tags](https://typia.io/docs/validators/tags). Thus, I repeat that,
|
|
119
|
+
* you've to ensure the type safety when using decoder functions.
|
|
120
|
+
*
|
|
121
|
+
* @template T Expected type of decoded value
|
|
122
|
+
* @param input Protobuf Buffer binary data
|
|
123
|
+
* @returns Decoded value
|
|
124
|
+
*
|
|
125
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
126
|
+
*/
|
|
127
|
+
function decode<T>(input: Uint8Array): Resolved<T>;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @internal
|
|
131
|
+
*/
|
|
132
|
+
function decode(): never {
|
|
133
|
+
halt("decode");
|
|
134
|
+
}
|
|
135
|
+
const decodePure = /** @__PURE__ */ Object.assign<typeof decode, {}>(
|
|
136
|
+
decode,
|
|
137
|
+
/** @__PURE__ */ Namespace.protobuf.decode("decode"),
|
|
138
|
+
);
|
|
139
|
+
export { decodePure as decode };
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* > You must configure the generic argument `T`.
|
|
143
|
+
*
|
|
144
|
+
* Protocol Buffer Decoder wity type assertion, but not safe.
|
|
145
|
+
*
|
|
146
|
+
* `typia.protobuf.assertDecode()` is a combination function of {@link decode} and
|
|
147
|
+
* {@link assert} function. Therefore, it decodes a binary data of Protocol Buffer to
|
|
148
|
+
* a TypeScript instance, and performs type assertion process. If decoded value is
|
|
149
|
+
* following the type `T`, it returns the decoded value. Otherwise, it throws
|
|
150
|
+
* {@link TypeGuardError} instead.
|
|
151
|
+
*
|
|
152
|
+
* However, note that, this validation is not always safe. It just performs additional
|
|
153
|
+
* type assertion like `number & Minimum<7>` or `string & Format<"uuid">` cases,
|
|
154
|
+
* that are represented by [custom tags](https://typia.io/docs/validators/tags).
|
|
155
|
+
* Therefore, when using `typia.protobuf.assertDecode<T>()` function, you have to
|
|
156
|
+
* ensure the type safety by yourself.
|
|
157
|
+
*
|
|
158
|
+
* In such type safety reason, I recommend you to use type safe encode functions.
|
|
159
|
+
*
|
|
160
|
+
* - {@link assertEncode}
|
|
161
|
+
* - {@link isEncode}
|
|
162
|
+
* - {@link validateEncode}
|
|
163
|
+
*
|
|
164
|
+
* @template T Expected type of decoded value
|
|
165
|
+
* @param input Protobuf Buffer binary data
|
|
166
|
+
* @returns Decoded value
|
|
167
|
+
*
|
|
168
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
169
|
+
*/
|
|
170
|
+
function assertDecode(input: Uint8Array): never;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Protocol Buffer Decoder wity type assertion, but not safe.
|
|
174
|
+
*
|
|
175
|
+
* `typia.protobuf.assertDecode()` is a combination function of {@link decode} and
|
|
176
|
+
* {@link assert} function. Therefore, it decodes a binary data of Protocol Buffer to
|
|
177
|
+
* a TypeScript instance, and performs type assertion process. If decoded value is
|
|
178
|
+
* following the type `T`, it returns the decoded value. Otherwise, it throws
|
|
179
|
+
* {@link TypeGuardError} instead.
|
|
180
|
+
*
|
|
181
|
+
* However, note that, this validation is not always safe. It just performs additional
|
|
182
|
+
* type assertion like `number & Minimum<7>` or `string & Format<"uuid">` cases,
|
|
183
|
+
* that are represented by [custom tags](https://typia.io/docs/validators/tags).
|
|
184
|
+
* Therefore, when using `typia.protobuf.assertDecode<T>()` function, you have to
|
|
185
|
+
* ensure the type safety by yourself.
|
|
186
|
+
*
|
|
187
|
+
* In such type safety reason, I recommend you to use type safe encode functions.
|
|
188
|
+
*
|
|
189
|
+
* - {@link assertEncode}
|
|
190
|
+
* - {@link isEncode}
|
|
191
|
+
* - {@link validateEncode}
|
|
192
|
+
*
|
|
193
|
+
* @template T Expected type of decoded value
|
|
194
|
+
* @param input Protobuf Buffer binary data
|
|
195
|
+
* @returns Decoded value
|
|
196
|
+
*
|
|
197
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
198
|
+
*/
|
|
199
|
+
function assertDecode<T>(input: Uint8Array): Resolved<T>;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @internal
|
|
203
|
+
*/
|
|
204
|
+
function assertDecode(): never {
|
|
205
|
+
halt("assertDecode");
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const assertDecodePure = /** @__PURE__ */ Object.assign<
|
|
209
|
+
typeof assertDecode,
|
|
210
|
+
{},
|
|
211
|
+
{}
|
|
212
|
+
>(
|
|
213
|
+
assertDecode,
|
|
214
|
+
/** @__PURE__ */ Namespace.assert("protobuf.assertDecode"),
|
|
215
|
+
/** @__PURE__ */ Namespace.protobuf.decode("assertDecode"),
|
|
216
|
+
);
|
|
217
|
+
export { assertDecodePure as assertDecode };
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* > You must configure the generic argument `T`.
|
|
221
|
+
*
|
|
222
|
+
* Protocol Buffer Decoder wity type checking, but not safe.
|
|
223
|
+
*
|
|
224
|
+
* `typia.protobuf.isDecode()` is a combination function of {@link decode} and
|
|
225
|
+
* {@link is} function. Therefore, it decodes a binary data of Protocol Buffer to
|
|
226
|
+
* a TypeScript instance, and performs type checking process. If decoded value is
|
|
227
|
+
* following the type `T`, it returns the decoded value. Otherwise, it returns
|
|
228
|
+
* `null` value instead.
|
|
229
|
+
*
|
|
230
|
+
* However, note that, this validation is not always safe. It just performs additional
|
|
231
|
+
* type checking like `number & Minimum<7>` or `string & Format<"uuid">` cases,
|
|
232
|
+
* that are represented by [custom tags](https://typia.io/docs/validators/tags).
|
|
233
|
+
* Therefore, when using `typia.protobuf.isDecode<T>()` function, you have to
|
|
234
|
+
* ensure the type safety by yourself.
|
|
235
|
+
*
|
|
236
|
+
* In such type safety reason, I recommend you to use type safe encode functions.
|
|
237
|
+
*
|
|
238
|
+
* - {@link assertEncode}
|
|
239
|
+
* - {@link isEncode}
|
|
240
|
+
* - {@link validateEncode}
|
|
241
|
+
*
|
|
242
|
+
* @template T Expected type of decoded value
|
|
243
|
+
* @param input Protobuf Buffer binary data
|
|
244
|
+
* @returns Decoded value
|
|
245
|
+
*
|
|
246
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
247
|
+
*/
|
|
248
|
+
function isDecode(input: Uint8Array): never;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Protocol Buffer Decoder wity type checking, but not safe.
|
|
252
|
+
*
|
|
253
|
+
* `typia.protobuf.isDecode()` is a combination function of {@link decode} and
|
|
254
|
+
* {@link is} function. Therefore, it decodes a binary data of Protocol Buffer to
|
|
255
|
+
* a TypeScript instance, and performs type checking process. If decoded value is
|
|
256
|
+
* following the type `T`, it returns the decoded value. Otherwise, it returns
|
|
257
|
+
* `null` value instead.
|
|
258
|
+
*
|
|
259
|
+
* However, note that, this validation is not always safe. It just performs additional
|
|
260
|
+
* type checking like `number & Minimum<7>` or `string & Format<"uuid">` cases,
|
|
261
|
+
* that are represented by [custom tags](https://typia.io/docs/validators/tags).
|
|
262
|
+
* Therefore, when using `typia.protobuf.isDecode<T>()` function, you have to
|
|
263
|
+
* ensure the type safety by yourself.
|
|
264
|
+
*
|
|
265
|
+
* In such type safety reason, I recommend you to use type safe encode functions.
|
|
266
|
+
*
|
|
267
|
+
* - {@link assertEncode}
|
|
268
|
+
* - {@link isEncode}
|
|
269
|
+
* - {@link validateEncode}
|
|
270
|
+
*
|
|
271
|
+
* @template T Expected type of decoded value
|
|
272
|
+
* @param input Protobuf Buffer binary data
|
|
273
|
+
* @returns Decoded value
|
|
274
|
+
*
|
|
275
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
276
|
+
*/
|
|
277
|
+
function isDecode<T>(input: Uint8Array): Resolved<T> | null;
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* @internal
|
|
281
|
+
*/
|
|
282
|
+
function isDecode(): never {
|
|
283
|
+
halt("isDecode");
|
|
284
|
+
}
|
|
285
|
+
const isDecodePure = /** @__PURE__ */ Object.assign<typeof isDecode, {}, {}>(
|
|
286
|
+
isDecode,
|
|
287
|
+
/** @__PURE__ */ Namespace.is(),
|
|
288
|
+
/** @__PURE__ */ Namespace.protobuf.decode("isDecode"),
|
|
289
|
+
);
|
|
290
|
+
export { isDecodePure as isDecode };
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* > You must configure the generic argument `T`.
|
|
294
|
+
*
|
|
295
|
+
* Protocol Buffer Decoder wity type validation, but not safe.
|
|
296
|
+
*
|
|
297
|
+
* `typia.protobuf.validateDecode()` is a combination function of {@link decode} and
|
|
298
|
+
* {@link validate} function. Therefore, it decodes a binary data of Protocol Buffer to
|
|
299
|
+
* a TypeScript instance, and performs type validation process. If decoded value is
|
|
300
|
+
* following the type `T`, it returns the decoded value with
|
|
301
|
+
* {@link IValidation.ISuccess} typed instance. Otherwise, it returns
|
|
302
|
+
* {@link IValidation.IFailure} value instead with detailed error reasons.
|
|
303
|
+
*
|
|
304
|
+
* However, note that, this validation is not always safe. It just performs additional
|
|
305
|
+
* type validation like `number & Minimum<7>` or `string & Format<"uuid">` cases,
|
|
306
|
+
* that are represented by [custom tags](https://typia.io/docs/validators/tags).
|
|
307
|
+
* Therefore, when using `typia.protobuf.validateDecode<T>()` function, you have to
|
|
308
|
+
* ensure the type safety by yourself.
|
|
309
|
+
*
|
|
310
|
+
* In such type safety reason, I recommend you to use type safe encode functions.
|
|
311
|
+
*
|
|
312
|
+
* - {@link assertEncode}
|
|
313
|
+
* - {@link isEncode}
|
|
314
|
+
* - {@link validateEncode}
|
|
315
|
+
*
|
|
316
|
+
* @template T Expected type of decoded value
|
|
317
|
+
* @param input Protobuf Buffer binary data
|
|
318
|
+
* @returns Decoded value
|
|
319
|
+
*
|
|
320
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
321
|
+
*/
|
|
322
|
+
function validateDecode(input: Uint8Array): never;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Protocol Buffer Decoder wity type validation, but not safe.
|
|
326
|
+
*
|
|
327
|
+
* `typia.protobuf.validateDecode()` is a combination function of {@link decode} and
|
|
328
|
+
* {@link validate} function. Therefore, it decodes a binary data of Protocol Buffer to
|
|
329
|
+
* a TypeScript instance, and performs type validation process. If decoded value is
|
|
330
|
+
* following the type `T`, it returns the decoded value with
|
|
331
|
+
* {@link IValidation.ISuccess} typed instance. Otherwise, it returns
|
|
332
|
+
* {@link IValidation.IFailure} value instead with detailed error reasons.
|
|
333
|
+
*
|
|
334
|
+
* However, note that, this validation is not always safe. It just performs additional
|
|
335
|
+
* type validation like `number & Minimum<7>` or `string & Format<"uuid">` cases,
|
|
336
|
+
* that are represented by [custom tags](https://typia.io/docs/validators/tags).
|
|
337
|
+
* Therefore, when using `typia.protobuf.validateDecode<T>()` function, you have to
|
|
338
|
+
* ensure the type safety by yourself.
|
|
339
|
+
*
|
|
340
|
+
* In such type safety reason, I recommend you to use type safe encode functions.
|
|
341
|
+
*
|
|
342
|
+
* - {@link assertEncode}
|
|
343
|
+
* - {@link isEncode}
|
|
344
|
+
* - {@link validateEncode}
|
|
345
|
+
*
|
|
346
|
+
* @template T Expected type of decoded value
|
|
347
|
+
* @param input Protobuf Buffer binary data
|
|
348
|
+
* @returns Decoded value
|
|
349
|
+
*
|
|
350
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
351
|
+
*/
|
|
352
|
+
function validateDecode<T>(input: Uint8Array): IValidation<Resolved<T>>;
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* @internal
|
|
356
|
+
*/
|
|
357
|
+
function validateDecode(): never {
|
|
358
|
+
halt("validateDecode");
|
|
359
|
+
}
|
|
360
|
+
const validateDecodePure = /** @__PURE__ */ Object.assign<
|
|
361
|
+
typeof validateDecode,
|
|
362
|
+
{},
|
|
363
|
+
{}
|
|
364
|
+
>(
|
|
365
|
+
validateDecode,
|
|
366
|
+
/** @__PURE__ */ Namespace.validate(),
|
|
367
|
+
/** @__PURE__ */ Namespace.protobuf.decode("validateDecode"),
|
|
368
|
+
);
|
|
369
|
+
export { validateDecodePure as validateDecode };
|
|
370
|
+
|
|
371
|
+
/* -----------------------------------------------------------
|
|
372
|
+
ENCODE
|
|
373
|
+
----------------------------------------------------------- */
|
|
374
|
+
/**
|
|
375
|
+
* Protocol Buffer Encoder.
|
|
376
|
+
*
|
|
377
|
+
* Converts an input value to a binary data of Protocol Buffer format.
|
|
378
|
+
*
|
|
379
|
+
* For reference, this `typia.protobuf.encode()` does not validate the `input` value.
|
|
380
|
+
* It just believes that the `input` value is valid and converts it to a binary data
|
|
381
|
+
* directly. Therefore, if you can't ensure the `input` value type, it would better to
|
|
382
|
+
* call one of below functions intead.
|
|
383
|
+
*
|
|
384
|
+
* - {@link assertEncode}
|
|
385
|
+
* - {@link isEncode}
|
|
386
|
+
* - {@link validateEncode}
|
|
387
|
+
*
|
|
388
|
+
* By the way, you know what? Expression power of Protocol Buffer is not enough strong
|
|
389
|
+
* to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
|
|
390
|
+
* type that is not compatible with Protocol Buffer, this function would throw
|
|
391
|
+
* compilation errors.
|
|
392
|
+
*
|
|
393
|
+
* - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
|
|
394
|
+
*
|
|
395
|
+
* @template T Type of the value input
|
|
396
|
+
* @param input A value to encode
|
|
397
|
+
* @returns Encoded binary data
|
|
398
|
+
*
|
|
399
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
400
|
+
*/
|
|
401
|
+
function encode<T>(input: T): Uint8Array;
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* @internal
|
|
405
|
+
*/
|
|
406
|
+
function encode(): never {
|
|
407
|
+
halt("encode");
|
|
408
|
+
}
|
|
409
|
+
const encodePure = /** @__PURE__ */ Object.assign<typeof encode, {}>(
|
|
410
|
+
encode,
|
|
411
|
+
/** @__PURE__ */ Namespace.protobuf.encode("encode"),
|
|
412
|
+
);
|
|
413
|
+
export { encodePure as encode };
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Protocol Buffer Encoder with type assertion.
|
|
417
|
+
*
|
|
418
|
+
* `typia.protobuf.assertEncode()` is a combination function of {@link assert} and
|
|
419
|
+
* {@link encode}.
|
|
420
|
+
*
|
|
421
|
+
* Therefore, it converts an `input` value to a binary data of
|
|
422
|
+
* Protocol Buffer, with type assertion. If `input` value is not valid, it throws
|
|
423
|
+
* {@link TypeGuardError}. Otherwise, there's no problem on the `input` value,
|
|
424
|
+
* Protocol Buffer binary data would be returned.
|
|
425
|
+
*
|
|
426
|
+
* If you can trust `input` value, or want to perform other type of validation, use
|
|
427
|
+
* below functions intead.
|
|
428
|
+
*
|
|
429
|
+
* - {@link encode}
|
|
430
|
+
* - {@link isEncode}
|
|
431
|
+
* - {@link validateEncode}
|
|
432
|
+
*
|
|
433
|
+
* By the way, you know what? Expression power of Protocol Buffer is not enough strong
|
|
434
|
+
* to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
|
|
435
|
+
* type that is not compatible with Protocol Buffer, this function would throw
|
|
436
|
+
* compilation errors.
|
|
437
|
+
*
|
|
438
|
+
* - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
|
|
439
|
+
*
|
|
440
|
+
* @template T Type of the value input
|
|
441
|
+
* @param input A value to encode
|
|
442
|
+
* @returns Encoded binary data
|
|
443
|
+
*
|
|
444
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
445
|
+
*/
|
|
446
|
+
function assertEncode<T>(input: T): Uint8Array;
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Protocol Buffer Encoder with type assertion.
|
|
450
|
+
*
|
|
451
|
+
* `typia.protobuf.assertEncode()` is a combination function of {@link assert} and
|
|
452
|
+
* {@link encode}.
|
|
453
|
+
*
|
|
454
|
+
* Therefore, it converts an `input` value to a binary data of
|
|
455
|
+
* Protocol Buffer, with type assertion. If `input` value is not valid, it throws
|
|
456
|
+
* {@link TypeGuardError}. Otherwise, there's no problem on the `input` value,
|
|
457
|
+
* Protocol Buffer binary data would be returned.
|
|
458
|
+
*
|
|
459
|
+
* If you can trust `input` value, or want to perform other type of validation, use
|
|
460
|
+
* below functions intead.
|
|
461
|
+
*
|
|
462
|
+
* - {@link encode}
|
|
463
|
+
* - {@link isEncode}
|
|
464
|
+
* - {@link validateEncode}
|
|
465
|
+
*
|
|
466
|
+
* By the way, you know what? Expression power of Protocol Buffer is not enough strong
|
|
467
|
+
* to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
|
|
468
|
+
* type that is not compatible with Protocol Buffer, this function would throw
|
|
469
|
+
* compilation errors.
|
|
470
|
+
*
|
|
471
|
+
* - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
|
|
472
|
+
*
|
|
473
|
+
* @template T Type of the value input
|
|
474
|
+
* @param input A value to encode
|
|
475
|
+
* @returns Encoded binary data
|
|
476
|
+
*
|
|
477
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
478
|
+
*/
|
|
479
|
+
function assertEncode<T>(input: unknown): Uint8Array;
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* @internal
|
|
483
|
+
*/
|
|
484
|
+
function assertEncode(): never {
|
|
485
|
+
halt("assertEncode");
|
|
486
|
+
}
|
|
487
|
+
const assertEncodePure = /** @__PURE__ */ Object.assign<
|
|
488
|
+
typeof assertEncode,
|
|
489
|
+
{},
|
|
490
|
+
{}
|
|
491
|
+
>(
|
|
492
|
+
assertEncode,
|
|
493
|
+
/** @__PURE__ */ Namespace.assert("protobuf.assertEncode"),
|
|
494
|
+
/** @__PURE__ */ Namespace.protobuf.encode("assertEncode"),
|
|
495
|
+
);
|
|
496
|
+
export { assertEncodePure as assertEncode };
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Protocol Buffer Encoder with type checking.
|
|
500
|
+
*
|
|
501
|
+
* `typia.protobuf.isEncode()` is a combination function of {@link is} and
|
|
502
|
+
* {@link encode}.
|
|
503
|
+
*
|
|
504
|
+
* Therefore, it converts an `input` value to a binary data of
|
|
505
|
+
* Protocol Buffer, with type checking. If `input` value is not valid, it returns
|
|
506
|
+
* `null` value. Otherwise, there's no problem on the `input` value, Protocol
|
|
507
|
+
* Buffer binary data would be returned.
|
|
508
|
+
*
|
|
509
|
+
* If you can trust `input` value, or want to perform other type of validation, use
|
|
510
|
+
* below functions intead.
|
|
511
|
+
*
|
|
512
|
+
* - {@link encode}
|
|
513
|
+
* - {@link assertEncode}
|
|
514
|
+
* - {@link validateEncode}
|
|
515
|
+
*
|
|
516
|
+
* By the way, you know what? Expression power of Protocol Buffer is not enough strong
|
|
517
|
+
* to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
|
|
518
|
+
* type that is not compatible with Protocol Buffer, this function would throw
|
|
519
|
+
* compilation errors.
|
|
520
|
+
*
|
|
521
|
+
* - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
|
|
522
|
+
*
|
|
523
|
+
* @template T Type of the value input
|
|
524
|
+
* @param input A value to encode
|
|
525
|
+
* @returns Encoded binary data
|
|
526
|
+
*
|
|
527
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
528
|
+
*/
|
|
529
|
+
function isEncode<T>(input: T): Uint8Array | null;
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Protocol Buffer Encoder with type checking.
|
|
533
|
+
*
|
|
534
|
+
* `typia.protobuf.isEncode()` is a combination function of {@link is} and
|
|
535
|
+
* {@link encode}.
|
|
536
|
+
*
|
|
537
|
+
* Therefore, it converts an `input` value to a binary data of
|
|
538
|
+
* Protocol Buffer, with type checking. If `input` value is not valid, it returns
|
|
539
|
+
* `null` value. Otherwise, there's no problem on the `input` value, Protocol
|
|
540
|
+
* Buffer binary data would be returned.
|
|
541
|
+
*
|
|
542
|
+
* If you can trust `input` value, or want to perform other type of validation, use
|
|
543
|
+
* below functions intead.
|
|
544
|
+
*
|
|
545
|
+
* - {@link encode}
|
|
546
|
+
* - {@link assertEncode}
|
|
547
|
+
* - {@link validateEncode}
|
|
548
|
+
*
|
|
549
|
+
* By the way, you know what? Expression power of Protocol Buffer is not enough strong
|
|
550
|
+
* to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
|
|
551
|
+
* type that is not compatible with Protocol Buffer, this function would throw
|
|
552
|
+
* compilation errors.
|
|
553
|
+
*
|
|
554
|
+
* - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
|
|
555
|
+
*
|
|
556
|
+
* @template T Type of the value input
|
|
557
|
+
* @param input A value to encode
|
|
558
|
+
* @returns Encoded binary data
|
|
559
|
+
*
|
|
560
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
561
|
+
*/
|
|
562
|
+
function isEncode<T>(input: unknown): Uint8Array | null;
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* @internal
|
|
566
|
+
*/
|
|
567
|
+
function isEncode(): never {
|
|
568
|
+
halt("isEncode");
|
|
569
|
+
}
|
|
570
|
+
const isEncodePure = /** @__PURE__ */ Object.assign<typeof isEncode, {}, {}>(
|
|
571
|
+
isEncode,
|
|
572
|
+
/** @__PURE__ */ Namespace.is(),
|
|
573
|
+
/** @__PURE__ */ Namespace.protobuf.encode("isEncode"),
|
|
574
|
+
);
|
|
575
|
+
export { isEncodePure as isEncode };
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* Protocol Buffer Encoder with type validation.
|
|
579
|
+
*
|
|
580
|
+
* `typia.protobuf.validateEncode()` is a combination function of
|
|
581
|
+
* {@link validation} and {@link encode}.
|
|
582
|
+
*
|
|
583
|
+
* Therefore, it converts an `input` value to a binary data of
|
|
584
|
+
* Protocol Buffer, with type validation. If `input` value is not valid, it returns
|
|
585
|
+
* {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
|
|
586
|
+
* no problem on the `input` value, Protocol Buffer binary data would be stored in
|
|
587
|
+
* `data` property of the output {@link IValidation.ISuccess} instance.
|
|
588
|
+
*
|
|
589
|
+
* If you can trust `input` value, or want to perform other type of validation, use
|
|
590
|
+
* below functions intead.
|
|
591
|
+
*
|
|
592
|
+
* - {@link encode}
|
|
593
|
+
* - {@link assertEncode}
|
|
594
|
+
* - {@link isEncode}
|
|
595
|
+
*
|
|
596
|
+
* By the way, you know what? Expression power of Protocol Buffer is not enough strong
|
|
597
|
+
* to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
|
|
598
|
+
* type that is not compatible with Protocol Buffer, this function would throw
|
|
599
|
+
* compilation errors.
|
|
600
|
+
*
|
|
601
|
+
* - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
|
|
602
|
+
*
|
|
603
|
+
* @template T Type of the value input
|
|
604
|
+
* @param input A value to encode
|
|
605
|
+
* @returns Encoded binary data
|
|
606
|
+
*
|
|
607
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
608
|
+
*/
|
|
609
|
+
function validateEncode<T>(input: T): IValidation<Uint8Array>;
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* Protocol Buffer Encoder with type validation.
|
|
613
|
+
*
|
|
614
|
+
* `typia.protobuf.validateEncode()` is a combination function of
|
|
615
|
+
* {@link validation} and {@link encode}.
|
|
616
|
+
*
|
|
617
|
+
* Therefore, it converts an `input` value to a binary data of
|
|
618
|
+
* Protocol Buffer, with type validation. If `input` value is not valid, it returns
|
|
619
|
+
* {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
|
|
620
|
+
* no problem on the `input` value, Protocol Buffer binary data would be stored in
|
|
621
|
+
* `data` property of the output {@link IValidation.ISuccess} instance.
|
|
622
|
+
*
|
|
623
|
+
* If you can trust `input` value, or want to perform other type of validation, use
|
|
624
|
+
* below functions intead.
|
|
625
|
+
*
|
|
626
|
+
* - {@link encode}
|
|
627
|
+
* - {@link assertEncode}
|
|
628
|
+
* - {@link isEncode}
|
|
629
|
+
*
|
|
630
|
+
* By the way, you know what? Expression power of Protocol Buffer is not enough strong
|
|
631
|
+
* to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
|
|
632
|
+
* type that is not compatible with Protocol Buffer, this function would throw
|
|
633
|
+
* compilation errors.
|
|
634
|
+
*
|
|
635
|
+
* - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
|
|
636
|
+
*
|
|
637
|
+
* @template T Type of the value input
|
|
638
|
+
* @param input A value to encode
|
|
639
|
+
* @returns Encoded binary data
|
|
640
|
+
*
|
|
641
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
642
|
+
*/
|
|
643
|
+
function validateEncode<T>(input: unknown): IValidation<Uint8Array>;
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* @internal
|
|
647
|
+
*/
|
|
648
|
+
function validateEncode(): never {
|
|
649
|
+
halt("validateEncode");
|
|
650
|
+
}
|
|
651
|
+
const validateEncodePure = /** @__PURE__ */ Object.assign<
|
|
652
|
+
typeof validateEncode,
|
|
653
|
+
{},
|
|
654
|
+
{}
|
|
655
|
+
>(
|
|
656
|
+
validateEncode,
|
|
657
|
+
/** @__PURE__ */ Namespace.validate(),
|
|
658
|
+
/** @__PURE__ */ Namespace.protobuf.encode("validateEncode"),
|
|
659
|
+
);
|
|
660
|
+
export { validateEncodePure as validateEncode };
|
|
661
|
+
|
|
662
|
+
/* -----------------------------------------------------------
|
|
663
|
+
FACTORY FUNCTIONS
|
|
664
|
+
----------------------------------------------------------- */
|
|
665
|
+
/**
|
|
666
|
+
* Creates a reusable {@link decode} function.
|
|
667
|
+
*
|
|
668
|
+
* @danger You must configure the generic argument `T`
|
|
669
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
670
|
+
* @throws compile error
|
|
671
|
+
*
|
|
672
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
673
|
+
*/
|
|
674
|
+
function createDecode(): never;
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Creates a reusable {@link decode} function.
|
|
678
|
+
*
|
|
679
|
+
* @template T Target type
|
|
680
|
+
* @returns A reusable `decode` function
|
|
681
|
+
*
|
|
682
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
683
|
+
*/
|
|
684
|
+
function createDecode<T>(): (input: Uint8Array) => Resolved<T>;
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* @internal
|
|
688
|
+
*/
|
|
689
|
+
function createDecode<T>(): (input: Uint8Array) => Resolved<T> {
|
|
690
|
+
halt("createDecode");
|
|
691
|
+
}
|
|
692
|
+
const createDecodePure = /** @__PURE__ */ Object.assign<
|
|
693
|
+
typeof createDecode,
|
|
694
|
+
{}
|
|
695
|
+
>(createDecode, /** @__PURE__ */ Namespace.protobuf.decode("createDecode"));
|
|
696
|
+
export { createDecodePure as createDecode };
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* Creates a reusable {@link isDecode} function.
|
|
700
|
+
*
|
|
701
|
+
* @danger You must configure the generic argument `T`
|
|
702
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
703
|
+
* @throws compile error
|
|
704
|
+
*
|
|
705
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
706
|
+
*/
|
|
707
|
+
function createIsDecode(): never;
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* Creates a reusable {@link isDecode} function.
|
|
711
|
+
*
|
|
712
|
+
* @template T Target type
|
|
713
|
+
* @returns A reusable `isDecode` function
|
|
714
|
+
*
|
|
715
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
716
|
+
*/
|
|
717
|
+
function createIsDecode<T>(): (input: Uint8Array) => Resolved<T> | null;
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* @internal
|
|
721
|
+
*/
|
|
722
|
+
function createIsDecode<T>(): (input: Uint8Array) => Resolved<T> | null {
|
|
723
|
+
halt("createIsDecode");
|
|
724
|
+
}
|
|
725
|
+
const createIsDecodePure = /** @__PURE__ */ Object.assign<
|
|
726
|
+
typeof createIsDecode,
|
|
727
|
+
{},
|
|
728
|
+
{}
|
|
729
|
+
>(
|
|
730
|
+
createIsDecode,
|
|
731
|
+
/** @__PURE__ */ Namespace.is(),
|
|
732
|
+
/** @__PURE__ */ Namespace.protobuf.decode("createIsDecode"),
|
|
733
|
+
);
|
|
734
|
+
export { createIsDecodePure as createIsDecode };
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* Creates a reusable {@link assertDecode} function.
|
|
738
|
+
*
|
|
739
|
+
* @danger You must configure the generic argument `T`
|
|
740
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
741
|
+
* @throws compile error
|
|
742
|
+
*
|
|
743
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
744
|
+
*/
|
|
745
|
+
function createAssertDecode(): never;
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Creates a reusable {@link assertDecode} function.
|
|
749
|
+
*
|
|
750
|
+
* @template T Target type
|
|
751
|
+
* @returns A reusable `assertDecode` function
|
|
752
|
+
*
|
|
753
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
754
|
+
*/
|
|
755
|
+
function createAssertDecode<T>(): (input: Uint8Array) => Resolved<T>;
|
|
756
|
+
|
|
757
|
+
/**
|
|
758
|
+
* @internal
|
|
759
|
+
*/
|
|
760
|
+
function createAssertDecode<T>(): (input: Uint8Array) => Resolved<T> {
|
|
761
|
+
halt("createAssertDecode");
|
|
762
|
+
}
|
|
763
|
+
const createAssertDecodePure = /** @__PURE__ */ Object.assign<
|
|
764
|
+
typeof createAssertDecode,
|
|
765
|
+
{},
|
|
766
|
+
{}
|
|
767
|
+
>(
|
|
768
|
+
createAssertDecode,
|
|
769
|
+
/** @__PURE__ */ Namespace.assert("protobuf.createAssertDecode"),
|
|
770
|
+
/** @__PURE__ */ Namespace.protobuf.decode("createAssertDecode"),
|
|
771
|
+
);
|
|
772
|
+
export { createAssertDecodePure as createAssertDecode };
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* Creates a reusable {@link validateDecode} function.
|
|
776
|
+
*
|
|
777
|
+
* @danger You must configure the generic argument `T`
|
|
778
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
779
|
+
* @throws compile error
|
|
780
|
+
*
|
|
781
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
782
|
+
*/
|
|
783
|
+
function createValidateDecode(): never;
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* Creates a reusable {@link validateDecode} function.
|
|
787
|
+
*
|
|
788
|
+
* @template T Target type
|
|
789
|
+
* @returns A reusable `validateDecode` function
|
|
790
|
+
*
|
|
791
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
792
|
+
*/
|
|
793
|
+
function createValidateDecode<T>(): (
|
|
794
|
+
input: Uint8Array,
|
|
795
|
+
) => IValidation<Resolved<T>>;
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* @internal
|
|
799
|
+
*/
|
|
800
|
+
function createValidateDecode<T>(): (
|
|
801
|
+
input: Uint8Array,
|
|
802
|
+
) => IValidation<Resolved<T>> {
|
|
803
|
+
halt("createValidateDecode");
|
|
804
|
+
}
|
|
805
|
+
const createValidateDecodePure = /** @__PURE__ */ Object.assign<
|
|
806
|
+
typeof createValidateDecode,
|
|
807
|
+
{},
|
|
808
|
+
{}
|
|
809
|
+
>(
|
|
810
|
+
createValidateDecode,
|
|
811
|
+
/** @__PURE__ */ Namespace.validate(),
|
|
812
|
+
/** @__PURE__ */ Namespace.protobuf.decode("createValidateDecode"),
|
|
813
|
+
);
|
|
814
|
+
export { createValidateDecodePure as createValidateDecode };
|
|
815
|
+
|
|
816
|
+
/**
|
|
817
|
+
* Creates a reusable {@link encode} function.
|
|
818
|
+
*
|
|
819
|
+
* @danger You must configure the generic argument `T`
|
|
820
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
821
|
+
* @throws compile error
|
|
822
|
+
*
|
|
823
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
824
|
+
*/
|
|
825
|
+
function createEncode(): never;
|
|
826
|
+
|
|
827
|
+
/**
|
|
828
|
+
* Creates a reusable {@link encode} function.
|
|
829
|
+
*
|
|
830
|
+
* @template T Target type
|
|
831
|
+
* @returns A reusable `encode` function
|
|
832
|
+
*
|
|
833
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
834
|
+
*/
|
|
835
|
+
function createEncode<T>(): (input: T) => Uint8Array;
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* @internal
|
|
839
|
+
*/
|
|
840
|
+
function createEncode<T>(): (input: T) => Uint8Array {
|
|
841
|
+
halt("createEncode");
|
|
842
|
+
}
|
|
843
|
+
const createEncodePure = /** @__PURE__ */ Object.assign<
|
|
844
|
+
typeof createEncode,
|
|
845
|
+
{}
|
|
846
|
+
>(createEncode, /** @__PURE__ */ Namespace.protobuf.encode("createEncode"));
|
|
847
|
+
export { createEncodePure as createEncode };
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* Creates a reusable {@link isEncode} function.
|
|
851
|
+
*
|
|
852
|
+
* @danger You must configure the generic argument `T`
|
|
853
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
854
|
+
* @throws compile error
|
|
855
|
+
*
|
|
856
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
857
|
+
*/
|
|
858
|
+
function createIsEncode(): never;
|
|
859
|
+
|
|
860
|
+
/**
|
|
861
|
+
* Creates a reusable {@link isEncode} function.
|
|
862
|
+
*
|
|
863
|
+
* @template T Target type
|
|
864
|
+
* @returns A reusable `isEncode` function
|
|
865
|
+
*
|
|
866
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
867
|
+
*/
|
|
868
|
+
function createIsEncode<T>(): (input: T) => Uint8Array | null;
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
* @internal
|
|
872
|
+
*/
|
|
873
|
+
function createIsEncode<T>(): (input: T) => Uint8Array | null {
|
|
874
|
+
halt("createIsEncode");
|
|
875
|
+
}
|
|
876
|
+
const createIsEncodePure = /** @__PURE__ */ Object.assign<
|
|
877
|
+
typeof createIsEncode,
|
|
878
|
+
{},
|
|
879
|
+
{}
|
|
880
|
+
>(
|
|
881
|
+
createIsEncode,
|
|
882
|
+
/** @__PURE__ */ Namespace.is(),
|
|
883
|
+
/** @__PURE__ */ Namespace.protobuf.encode("createIsEncode"),
|
|
884
|
+
);
|
|
885
|
+
export { createIsEncodePure as createIsEncode };
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* Creates a reusable {@link assertEncode} function.
|
|
889
|
+
*
|
|
890
|
+
* @danger You must configure the generic argument `T`
|
|
891
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
892
|
+
* @throws compile error
|
|
893
|
+
*
|
|
894
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
895
|
+
*/
|
|
896
|
+
function createAssertEncode(): never;
|
|
897
|
+
|
|
898
|
+
/**
|
|
899
|
+
* Creates a reusable {@link assertEncode} function.
|
|
900
|
+
*
|
|
901
|
+
* @template T Target type
|
|
902
|
+
* @returns A reusable `assertEncode` function
|
|
903
|
+
*
|
|
904
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
905
|
+
*/
|
|
906
|
+
function createAssertEncode<T>(): (input: T) => Uint8Array;
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* @internal
|
|
910
|
+
*/
|
|
911
|
+
function createAssertEncode<T>(): (input: T) => Uint8Array {
|
|
912
|
+
halt("createAssertEncode");
|
|
913
|
+
}
|
|
914
|
+
const createAssertEncodePure = /** @__PURE__ */ Object.assign<
|
|
915
|
+
typeof createAssertEncode,
|
|
916
|
+
{},
|
|
917
|
+
{}
|
|
918
|
+
>(
|
|
919
|
+
createAssertEncode,
|
|
920
|
+
/** @__PURE__ */ Namespace.assert("protobuf.createAssertEncode"),
|
|
921
|
+
/** @__PURE__ */ Namespace.protobuf.encode("createAssertEncode"),
|
|
922
|
+
);
|
|
923
|
+
export { createAssertEncodePure as createAssertEncode };
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* Creates a reusable {@link validateEncode} function.
|
|
927
|
+
*
|
|
928
|
+
* @danger You must configure the generic argument `T`
|
|
929
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
930
|
+
* @throws compile error
|
|
931
|
+
*
|
|
932
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
933
|
+
*/
|
|
934
|
+
function createValidateEncode(): never;
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* Creates a reusable {@link validateEncode} function.
|
|
938
|
+
*
|
|
939
|
+
* @template T Target type
|
|
940
|
+
* @returns A reusable `validateEncode` function
|
|
941
|
+
*
|
|
942
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
943
|
+
*/
|
|
944
|
+
function createValidateEncode<T>(): (input: T) => IValidation<Uint8Array>;
|
|
945
|
+
|
|
946
|
+
/**
|
|
947
|
+
* @internal
|
|
948
|
+
*/
|
|
949
|
+
function createValidateEncode<T>(): (input: T) => IValidation<Uint8Array> {
|
|
950
|
+
halt("createValidateEncode");
|
|
951
|
+
}
|
|
952
|
+
const createValidateEncodePure = /** @__PURE__ */ Object.assign<
|
|
953
|
+
typeof createValidateEncode,
|
|
954
|
+
{},
|
|
955
|
+
{}
|
|
956
|
+
>(
|
|
957
|
+
createValidateEncode,
|
|
958
|
+
/** @__PURE__ */ Namespace.validate(),
|
|
959
|
+
/** @__PURE__ */ Namespace.protobuf.encode("createValidateEncode"),
|
|
960
|
+
);
|
|
961
|
+
export { createValidateEncodePure as createValidateEncode };
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* @internal
|
|
965
|
+
*/
|
|
966
|
+
function halt(name: string): never {
|
|
967
|
+
throw new Error(
|
|
968
|
+
`Error on typia.protobuf.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
|
|
969
|
+
);
|
|
970
|
+
}
|