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/http.ts
CHANGED
|
@@ -1,1267 +1,1267 @@
|
|
|
1
|
-
import * as Namespace from "./functional/Namespace";
|
|
2
|
-
|
|
3
|
-
import { Atomic } from "./typings/Atomic";
|
|
4
|
-
|
|
5
|
-
import { IValidation } from "./IValidation";
|
|
6
|
-
import { Resolved } from "./Resolved";
|
|
7
|
-
|
|
8
|
-
/* ===========================================================
|
|
9
|
-
HTTP
|
|
10
|
-
- QUERY
|
|
11
|
-
- HEADERS
|
|
12
|
-
- PARAMETER
|
|
13
|
-
- FACTORY FUNCTIONS
|
|
14
|
-
==============================================================
|
|
15
|
-
QUERY
|
|
16
|
-
----------------------------------------------------------- */
|
|
17
|
-
/**
|
|
18
|
-
* > You must configure the generic argument `T`.
|
|
19
|
-
*
|
|
20
|
-
* URL query decoder.
|
|
21
|
-
*
|
|
22
|
-
* `typia.http.query()` is a function decoding a query string or an `URLSearchParams`
|
|
23
|
-
* instance, with automatic type casting to the expected type. When property type be
|
|
24
|
-
* defined as `boolean` or `number` type, `typia.http.query()` will cast the value to
|
|
25
|
-
* the expected type when decoding.
|
|
26
|
-
*
|
|
27
|
-
* By the way, as URL query is not enough to express complex data structures,
|
|
28
|
-
* `typia.http.query()` function has some limitations. If target type `T` is not
|
|
29
|
-
* following those restrictions, compilation errors would be occured.
|
|
30
|
-
*
|
|
31
|
-
* 1. Type `T` must be an object type
|
|
32
|
-
* 2. Do not allow dynamic property
|
|
33
|
-
* 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
34
|
-
* 4. By the way, union type never be not allowed
|
|
35
|
-
*
|
|
36
|
-
* Also, `typia.http.query()` function does not perform validation about the decoded
|
|
37
|
-
* value. Therefore, if you can't sure that input data is following the `T` type,
|
|
38
|
-
* it would better to call one of below functions intead.
|
|
39
|
-
*
|
|
40
|
-
* - {@link assertQuery}
|
|
41
|
-
* - {@link isQuery}
|
|
42
|
-
* - {@link validateQuery}
|
|
43
|
-
*
|
|
44
|
-
* @template T Expected type of decoded value
|
|
45
|
-
* @param input Query string or URLSearchParams instance
|
|
46
|
-
* @returns Decoded query object
|
|
47
|
-
*
|
|
48
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
49
|
-
*/
|
|
50
|
-
function query(): never;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* URL query decoder.
|
|
54
|
-
*
|
|
55
|
-
* `typia.http.query()` is a function decoding a query string or an `URLSearchParams`
|
|
56
|
-
* instance, with automatic type casting to the expected type. When property type be
|
|
57
|
-
* defined as `boolean` or `number` type, `typia.http.query()` will cast the value to
|
|
58
|
-
* the expected type when decoding.
|
|
59
|
-
*
|
|
60
|
-
* By the way, as URL query is not enough to express complex data structures,
|
|
61
|
-
* `typia.http.query()` function has some limitations. If target type `T` is not
|
|
62
|
-
* following those restrictions, compilation errors would be occured.
|
|
63
|
-
*
|
|
64
|
-
* 1. Type `T` must be an object type
|
|
65
|
-
* 2. Do not allow dynamic property
|
|
66
|
-
* 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
67
|
-
* 4. By the way, union type never be not allowed
|
|
68
|
-
*
|
|
69
|
-
* Also, `typia.http.query()` function does not perform validation about the decoded
|
|
70
|
-
* value. Therefore, if you can't sure that input data is following the `T` type,
|
|
71
|
-
* it would better to call one of below functions intead.
|
|
72
|
-
*
|
|
73
|
-
* - {@link assertQuery}
|
|
74
|
-
* - {@link isQuery}
|
|
75
|
-
* - {@link validateQuery}
|
|
76
|
-
*
|
|
77
|
-
* @template T Expected type of decoded value
|
|
78
|
-
* @param input Query string or URLSearchParams instance
|
|
79
|
-
* @returns Decoded query object
|
|
80
|
-
*
|
|
81
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
82
|
-
*/
|
|
83
|
-
function query<T extends object>(input: string | URLSearchParams): Resolved<T>;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* @internal
|
|
87
|
-
*/
|
|
88
|
-
function query(): never {
|
|
89
|
-
halt("query");
|
|
90
|
-
}
|
|
91
|
-
const queryPure = /** @__PURE__ */ Object.assign<typeof query, {}>(
|
|
92
|
-
query,
|
|
93
|
-
/** @__PURE__ */ Namespace.http.query(),
|
|
94
|
-
);
|
|
95
|
-
export { queryPure as query };
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* > You must configure the generic argument `T`.
|
|
99
|
-
*
|
|
100
|
-
* URL query decoder with type assertion.
|
|
101
|
-
*
|
|
102
|
-
* `typia.http.assertQuery()` is a function decoding a query string or an
|
|
103
|
-
* `URLSearchParams` instance, with automatic type casting to the expected type.
|
|
104
|
-
* When property type be defined as `boolean` or `number` type,
|
|
105
|
-
* `typia.http.assertQuery()` will cast the value to the expected type when decoding.
|
|
106
|
-
*
|
|
107
|
-
* Also, after decoding, `typia.http.assertQuery()` performs type assertion to the
|
|
108
|
-
* decoded value by combining with {@link assert} function. Therefore, when the
|
|
109
|
-
* decoded value is not following the `T` type, {@link TypeGuardError} would be
|
|
110
|
-
* thrown.
|
|
111
|
-
*
|
|
112
|
-
* By the way, as URL query is not enough to express complex data structures,
|
|
113
|
-
* `typia.http.assertQuery()` function has some limitations. If target type `T` is
|
|
114
|
-
* notfollowing those restrictions, compilation errors would be occured.
|
|
115
|
-
*
|
|
116
|
-
* 1. Type `T` must be an object type
|
|
117
|
-
* 2. Do not allow dynamic property
|
|
118
|
-
* 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
119
|
-
* 4. By the way, union type never be not allowed
|
|
120
|
-
*
|
|
121
|
-
* @template T Expected type of decoded value
|
|
122
|
-
* @param input Query string or URLSearchParams instance
|
|
123
|
-
* @returns Decoded query object
|
|
124
|
-
*
|
|
125
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
126
|
-
*/
|
|
127
|
-
function assertQuery(): never;
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* URL query decoder with type assertion.
|
|
131
|
-
*
|
|
132
|
-
* `typia.http.assertQuery()` is a function decoding a query string or an
|
|
133
|
-
* `URLSearchParams` instance, with automatic type casting to the expected type.
|
|
134
|
-
* When property type be defined as `boolean` or `number` type,
|
|
135
|
-
* `typia.http.assertQuery()` will cast the value to the expected type when decoding.
|
|
136
|
-
*
|
|
137
|
-
* Also, after decoding, `typia.http.assertQuery()` performs type assertion to the
|
|
138
|
-
* decoded value by combining with {@link assert} function. Therefore, when the
|
|
139
|
-
* decoded value is not following the `T` type, {@link TypeGuardError} would be
|
|
140
|
-
* thrown.
|
|
141
|
-
*
|
|
142
|
-
* By the way, as URL query is not enough to express complex data structures,
|
|
143
|
-
* `typia.http.assertQuery()` function has some limitations. If target type `T` is
|
|
144
|
-
* notfollowing those restrictions, compilation errors would be occured.
|
|
145
|
-
*
|
|
146
|
-
* 1. Type `T` must be an object type
|
|
147
|
-
* 2. Do not allow dynamic property
|
|
148
|
-
* 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
149
|
-
* 4. By the way, union type never be not allowed
|
|
150
|
-
*
|
|
151
|
-
* @template T Expected type of decoded value
|
|
152
|
-
* @param input Query string or URLSearchParams instance
|
|
153
|
-
* @returns Decoded query object
|
|
154
|
-
*
|
|
155
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
156
|
-
*/
|
|
157
|
-
function assertQuery<T extends object>(
|
|
158
|
-
input: string | URLSearchParams,
|
|
159
|
-
): Resolved<T>;
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* @internal
|
|
163
|
-
*/
|
|
164
|
-
function assertQuery(): never {
|
|
165
|
-
halt("assertQuery");
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const assertQueryPure = /** @__PURE__ */ Object.assign<
|
|
169
|
-
typeof assertQuery,
|
|
170
|
-
{},
|
|
171
|
-
{}
|
|
172
|
-
>(
|
|
173
|
-
assertQuery,
|
|
174
|
-
/** @__PURE__ */ Namespace.http.query(),
|
|
175
|
-
/** @__PURE__ */ Namespace.assert("http.assertQuery"),
|
|
176
|
-
);
|
|
177
|
-
export { assertQueryPure as assertQuery };
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* > You must configure the generic argument `T`.
|
|
181
|
-
*
|
|
182
|
-
* URL query decoder with type checking.
|
|
183
|
-
*
|
|
184
|
-
* `typia.http.isQuery()` is a function decoding a query string or an
|
|
185
|
-
* `URLSearchParams` instance, with automatic type casting to the expected type.
|
|
186
|
-
* When property type be defined as `boolean` or `number` type,
|
|
187
|
-
* `typia.http.isQuery()` will cast the value to the expected type when decoding.
|
|
188
|
-
*
|
|
189
|
-
* Also, after decoding, `typia.http.isQuery()` performs type checking to the
|
|
190
|
-
* decoded value by combining with {@link is} function. Therefore, when the
|
|
191
|
-
* decoded value is not following the `T` type, `null` value would be returned.
|
|
192
|
-
*
|
|
193
|
-
* By the way, as URL query is not enough to express complex data structures,
|
|
194
|
-
* `typia.http.isQuery()` function has some limitations. If target type `T` is
|
|
195
|
-
* notfollowing those restrictions, compilation errors would be occured.
|
|
196
|
-
*
|
|
197
|
-
* 1. Type `T` must be an object type
|
|
198
|
-
* 2. Do not allow dynamic property
|
|
199
|
-
* 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
200
|
-
* 4. By the way, union type never be not allowed
|
|
201
|
-
*
|
|
202
|
-
* @template T Expected type of decoded value
|
|
203
|
-
* @param input Query string or URLSearchParams instance
|
|
204
|
-
* @returns Decoded query object or `null` value
|
|
205
|
-
*
|
|
206
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
207
|
-
*/
|
|
208
|
-
function isQuery(): never;
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* URL query decoder with type checking.
|
|
212
|
-
*
|
|
213
|
-
* `typia.http.isQuery()` is a function decoding a query string or an
|
|
214
|
-
* `URLSearchParams` instance, with automatic type casting to the expected type.
|
|
215
|
-
* When property type be defined as `boolean` or `number` type,
|
|
216
|
-
* `typia.http.isQuery()` will cast the value to the expected type when decoding.
|
|
217
|
-
*
|
|
218
|
-
* Also, after decoding, `typia.http.isQuery()` performs type checking to the
|
|
219
|
-
* decoded value by combining with {@link is} function. Therefore, when the
|
|
220
|
-
* decoded value is not following the `T` type, `null` value would be returned.
|
|
221
|
-
*
|
|
222
|
-
* By the way, as URL query is not enough to express complex data structures,
|
|
223
|
-
* `typia.http.isQuery()` function has some limitations. If target type `T` is
|
|
224
|
-
* notfollowing those restrictions, compilation errors would be occured.
|
|
225
|
-
*
|
|
226
|
-
* 1. Type `T` must be an object type
|
|
227
|
-
* 2. Do not allow dynamic property
|
|
228
|
-
* 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
229
|
-
* 4. By the way, union type never be not allowed
|
|
230
|
-
*
|
|
231
|
-
* @template T Expected type of decoded value
|
|
232
|
-
* @param input Query string or URLSearchParams instance
|
|
233
|
-
* @returns Decoded query object or `null` value
|
|
234
|
-
*
|
|
235
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
236
|
-
*/
|
|
237
|
-
function isQuery<T extends object>(
|
|
238
|
-
input: string | URLSearchParams,
|
|
239
|
-
): Resolved<T> | null;
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* @internal
|
|
243
|
-
*/
|
|
244
|
-
function isQuery(): never {
|
|
245
|
-
halt("isQuery");
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
const isQueryPure = /** @__PURE__ */ Object.assign<typeof isQuery, {}, {}>(
|
|
249
|
-
isQuery,
|
|
250
|
-
/** @__PURE__ */ Namespace.http.query(),
|
|
251
|
-
/** @__PURE__ */ Namespace.is(),
|
|
252
|
-
);
|
|
253
|
-
export { isQueryPure as isQuery };
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* > You must configure the generic argument `T`.
|
|
257
|
-
*
|
|
258
|
-
* URL query decoder with type validation.
|
|
259
|
-
*
|
|
260
|
-
* `typia.http.validateQuery()` is a function decoding a query string or an
|
|
261
|
-
* `URLSearchParams` instance, with automatic type casting to the expected type.
|
|
262
|
-
* When property type be defined as `boolean` or `number` type,
|
|
263
|
-
* `typia.http.validateQuery()` will cast the value to the expected type when decoding.
|
|
264
|
-
*
|
|
265
|
-
* Also, after decoding, `typia.http.validateQuery()` performs type validation to the
|
|
266
|
-
* decoded value by combining with {@link validate} function. Therefore, when the
|
|
267
|
-
* decoded value is not following the `T` type, {@link IValidation.IFailure} would
|
|
268
|
-
* be returned. Otherwise, {@link IValidation.ISuccess} would be returned.
|
|
269
|
-
*
|
|
270
|
-
* By the way, as URL query is not enough to express complex data structures,
|
|
271
|
-
* `typia.http.validateQuery()` function has some limitations. If target type `T` is
|
|
272
|
-
* notfollowing those restrictions, compilation errors would be occured.
|
|
273
|
-
*
|
|
274
|
-
* 1. Type `T` must be an object type
|
|
275
|
-
* 2. Do not allow dynamic property
|
|
276
|
-
* 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
277
|
-
* 4. By the way, union type never be not allowed
|
|
278
|
-
*
|
|
279
|
-
* @template T Expected type of decoded value
|
|
280
|
-
* @param input Query string or URLSearchParams instance
|
|
281
|
-
* @returns Validation result with decoded query object
|
|
282
|
-
*
|
|
283
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
284
|
-
*/
|
|
285
|
-
function validateQuery(): never;
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* URL query decoder with type validation.
|
|
289
|
-
*
|
|
290
|
-
* `typia.http.validateQuery()` is a function decoding a query string or an
|
|
291
|
-
* `URLSearchParams` instance, with automatic type casting to the expected type.
|
|
292
|
-
* When property type be defined as `boolean` or `number` type,
|
|
293
|
-
* `typia.http.validateQuery()` will cast the value to the expected type when decoding.
|
|
294
|
-
*
|
|
295
|
-
* Also, after decoding, `typia.http.validateQuery()` performs type validation to the
|
|
296
|
-
* decoded value by combining with {@link validate} function. Therefore, when the
|
|
297
|
-
* decoded value is not following the `T` type, {@link IValidation.IFailure} would
|
|
298
|
-
* be returned. Otherwise, {@link IValidation.ISuccess} would be returned.
|
|
299
|
-
*
|
|
300
|
-
* By the way, as URL query is not enough to express complex data structures,
|
|
301
|
-
* `typia.http.validateQuery()` function has some limitations. If target type `T` is
|
|
302
|
-
* notfollowing those restrictions, compilation errors would be occured.
|
|
303
|
-
*
|
|
304
|
-
* 1. Type `T` must be an object type
|
|
305
|
-
* 2. Do not allow dynamic property
|
|
306
|
-
* 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
307
|
-
* 4. By the way, union type never be not allowed
|
|
308
|
-
*
|
|
309
|
-
* @template T Expected type of decoded value
|
|
310
|
-
* @param input Query string or URLSearchParams instance
|
|
311
|
-
* @returns Validation result with decoded query object
|
|
312
|
-
*
|
|
313
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
314
|
-
*/
|
|
315
|
-
function validateQuery<T extends object>(
|
|
316
|
-
input: string | URLSearchParams,
|
|
317
|
-
): IValidation<Resolved<T>>;
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* @internal
|
|
321
|
-
*/
|
|
322
|
-
function validateQuery(): never {
|
|
323
|
-
halt("validateQuery");
|
|
324
|
-
}
|
|
325
|
-
const validateQueryPure = /** @__PURE__ */ Object.assign<
|
|
326
|
-
typeof validateQuery,
|
|
327
|
-
{},
|
|
328
|
-
{}
|
|
329
|
-
>(
|
|
330
|
-
validateQuery,
|
|
331
|
-
/** @__PURE__ */ Namespace.http.query(),
|
|
332
|
-
/** @__PURE__ */ Namespace.validate(),
|
|
333
|
-
);
|
|
334
|
-
export { validateQueryPure as validateQuery };
|
|
335
|
-
|
|
336
|
-
/* -----------------------------------------------------------
|
|
337
|
-
HEADERS
|
|
338
|
-
----------------------------------------------------------- */
|
|
339
|
-
/**
|
|
340
|
-
* > You must configure the generic argument `T`.
|
|
341
|
-
*
|
|
342
|
-
* Headers decoder (for express and fastify).
|
|
343
|
-
*
|
|
344
|
-
* `typia.http.headers()` is a function decoding an header instance, with automatic
|
|
345
|
-
* type casting to the expected type. When property type be defined as `boolean` or
|
|
346
|
-
* `number` type, `typia.http.headers()` will cast the value to the expected type.
|
|
347
|
-
*
|
|
348
|
-
* By the way, as HTTP headers are not enough to express complex data structures,
|
|
349
|
-
* `typia.http.headers()` function has some limitations. If target type `T` is not
|
|
350
|
-
* following those restrictions, compilation errors would be occured.
|
|
351
|
-
*
|
|
352
|
-
* 1. Type `T` must be an object type
|
|
353
|
-
* 2. Do not allow dynamic property
|
|
354
|
-
* 3. Property key must be lower case
|
|
355
|
-
* 4. Property value cannot be `null`, but `undefined` is possible
|
|
356
|
-
* 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
357
|
-
* 6. By the way, union type never be not allowed
|
|
358
|
-
* 7. Property `set-cookie` must be array type
|
|
359
|
-
* 8. Those properties cannot be array type
|
|
360
|
-
* - age
|
|
361
|
-
* - authorization
|
|
362
|
-
* - content-length
|
|
363
|
-
* - content-type
|
|
364
|
-
* - etag
|
|
365
|
-
* - expires
|
|
366
|
-
* - from
|
|
367
|
-
* - host
|
|
368
|
-
* - if-modified-since
|
|
369
|
-
* - if-unmodified-since
|
|
370
|
-
* - last-modified
|
|
371
|
-
* - location
|
|
372
|
-
* - max-forwards
|
|
373
|
-
* - proxy-authorization
|
|
374
|
-
* - referer
|
|
375
|
-
* - retry-after
|
|
376
|
-
* - server
|
|
377
|
-
* - user-agent
|
|
378
|
-
*
|
|
379
|
-
* Also, `typia.http.headers()` function does not perform validation about the decoded
|
|
380
|
-
* value. Therefore, if you can't sure that input data is following the `T` type,
|
|
381
|
-
* it would better to call one of below functions intead.
|
|
382
|
-
*
|
|
383
|
-
* - {@link assertHeaders}
|
|
384
|
-
* - {@link isHeaders}
|
|
385
|
-
* - {@link validateHeaders}
|
|
386
|
-
*
|
|
387
|
-
* @template T Expected type of decoded value
|
|
388
|
-
* @param input Query string or URLSearchParams instance
|
|
389
|
-
* @returns Decoded headers object
|
|
390
|
-
*
|
|
391
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
392
|
-
*/
|
|
393
|
-
function headers(): never;
|
|
394
|
-
|
|
395
|
-
/**
|
|
396
|
-
* Headers decoder (for express and fastify).
|
|
397
|
-
*
|
|
398
|
-
* `typia.http.headers()` is a function decoding an header instance, with automatic
|
|
399
|
-
* type casting to the expected type. When property type be defined as `boolean` or
|
|
400
|
-
* `number` type, `typia.http.headers()` will cast the value to the expected type.
|
|
401
|
-
*
|
|
402
|
-
* By the way, as HTTP headers are not enough to express complex data structures,
|
|
403
|
-
* `typia.http.headers()` function has some limitations. If target type `T` is not
|
|
404
|
-
* following those restrictions, compilation errors would be occured.
|
|
405
|
-
*
|
|
406
|
-
* 1. Type `T` must be an object type
|
|
407
|
-
* 2. Do not allow dynamic property
|
|
408
|
-
* 3. Property key must be lower case
|
|
409
|
-
* 4. Property value cannot be `null`, but `undefined` is possible
|
|
410
|
-
* 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
411
|
-
* 6. By the way, union type never be not allowed
|
|
412
|
-
* 7. Property `set-cookie` must be array type
|
|
413
|
-
* 8. Those properties cannot be array type
|
|
414
|
-
* - age
|
|
415
|
-
* - authorization
|
|
416
|
-
* - content-length
|
|
417
|
-
* - content-type
|
|
418
|
-
* - etag
|
|
419
|
-
* - expires
|
|
420
|
-
* - from
|
|
421
|
-
* - host
|
|
422
|
-
* - if-modified-since
|
|
423
|
-
* - if-unmodified-since
|
|
424
|
-
* - last-modified
|
|
425
|
-
* - location
|
|
426
|
-
* - max-forwards
|
|
427
|
-
* - proxy-authorization
|
|
428
|
-
* - referer
|
|
429
|
-
* - retry-after
|
|
430
|
-
* - server
|
|
431
|
-
* - user-agent
|
|
432
|
-
*
|
|
433
|
-
* Also, `typia.http.headers()` function does not perform validation about the decoded
|
|
434
|
-
* value. Therefore, if you can't sure that input data is following the `T` type,
|
|
435
|
-
* it would better to call one of below functions intead.
|
|
436
|
-
*
|
|
437
|
-
* - {@link assertHeaders}
|
|
438
|
-
* - {@link isHeaders}
|
|
439
|
-
* - {@link validateHeaders}
|
|
440
|
-
*
|
|
441
|
-
* @template T Expected type of decoded value
|
|
442
|
-
* @param input Query string or URLSearchParams instance
|
|
443
|
-
* @returns Decoded headers object
|
|
444
|
-
*
|
|
445
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
446
|
-
*/
|
|
447
|
-
function headers<T extends object>(
|
|
448
|
-
input: Record<string, string | string[] | undefined>,
|
|
449
|
-
): Resolved<T>;
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* @internal
|
|
453
|
-
*/
|
|
454
|
-
function headers(): never {
|
|
455
|
-
halt("headers");
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
const headersPure = /** @__PURE__ */ Object.assign<typeof headers, {}>(
|
|
459
|
-
headers,
|
|
460
|
-
/** @__PURE__ */ Namespace.http.headers(),
|
|
461
|
-
);
|
|
462
|
-
export { headersPure as headers };
|
|
463
|
-
|
|
464
|
-
/**
|
|
465
|
-
* > You must configure the generic argument `T`.
|
|
466
|
-
*
|
|
467
|
-
* Headers decoder with type assertion (for express and fastify).
|
|
468
|
-
*
|
|
469
|
-
* `typia.http.assertHeaders()` is a function decoding an header instance, with
|
|
470
|
-
* automatic type casting to the expected type. When property type be defined as
|
|
471
|
-
* `boolean` or `number` type, `typia.http.headers()` will cast the value to the
|
|
472
|
-
* expected type.
|
|
473
|
-
*
|
|
474
|
-
* Also, after decoding, `typia.http.assertHeaders()` performs type assertion to the
|
|
475
|
-
* decoded value by combining with {@link assert} function. Therefore, when the
|
|
476
|
-
* decoded value is not following the `T` type, {@link TypeGuardError} would be
|
|
477
|
-
* thrown.
|
|
478
|
-
*
|
|
479
|
-
* By the way, as HTTP headers are not enough to express complex data structures,
|
|
480
|
-
* `typia.http.headers()` function has some limitations. If target type `T` is not
|
|
481
|
-
* following those restrictions, compilation errors would be occured.
|
|
482
|
-
*
|
|
483
|
-
* 1. Type `T` must be an object type
|
|
484
|
-
* 2. Do not allow dynamic property
|
|
485
|
-
* 3. Property key must be lower case
|
|
486
|
-
* 4. Property value cannot be `null`, but `undefined` is possible
|
|
487
|
-
* 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
488
|
-
* 6. By the way, union type never be not allowed
|
|
489
|
-
* 7. Property `set-cookie` must be array type
|
|
490
|
-
* 8. Those properties cannot be array type
|
|
491
|
-
* - age
|
|
492
|
-
* - authorization
|
|
493
|
-
* - content-length
|
|
494
|
-
* - content-type
|
|
495
|
-
* - etag
|
|
496
|
-
* - expires
|
|
497
|
-
* - from
|
|
498
|
-
* - host
|
|
499
|
-
* - if-modified-since
|
|
500
|
-
* - if-unmodified-since
|
|
501
|
-
* - last-modified
|
|
502
|
-
* - location
|
|
503
|
-
* - max-forwards
|
|
504
|
-
* - proxy-authorization
|
|
505
|
-
* - referer
|
|
506
|
-
* - retry-after
|
|
507
|
-
* - server
|
|
508
|
-
* - user-agent
|
|
509
|
-
*
|
|
510
|
-
* @template T Expected type of decoded value
|
|
511
|
-
* @param input Query string or URLSearchParams instance
|
|
512
|
-
* @returns Decoded headers object
|
|
513
|
-
*
|
|
514
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
515
|
-
*/
|
|
516
|
-
function assertHeaders(): never;
|
|
517
|
-
|
|
518
|
-
/**
|
|
519
|
-
* Headers decoder with type assertion (for express and fastify).
|
|
520
|
-
*
|
|
521
|
-
* `typia.http.assertHeaders()` is a function decoding an header instance, with
|
|
522
|
-
* automatic type casting to the expected type. When property type be defined as
|
|
523
|
-
* `boolean` or `number` type, `typia.http.headers()` will cast the value to the
|
|
524
|
-
* expected type.
|
|
525
|
-
*
|
|
526
|
-
* Also, after decoding, `typia.http.assertHeaders()` performs type assertion to the
|
|
527
|
-
* decoded value by combining with {@link assert} function. Therefore, when the
|
|
528
|
-
* decoded value is not following the `T` type, {@link TypeGuardError} would be
|
|
529
|
-
* thrown.
|
|
530
|
-
*
|
|
531
|
-
* By the way, as HTTP headers are not enough to express complex data structures,
|
|
532
|
-
* `typia.http.headers()` function has some limitations. If target type `T` is not
|
|
533
|
-
* following those restrictions, compilation errors would be occured.
|
|
534
|
-
*
|
|
535
|
-
* 1. Type `T` must be an object type
|
|
536
|
-
* 2. Do not allow dynamic property
|
|
537
|
-
* 3. Property key must be lower case
|
|
538
|
-
* 4. Property value cannot be `null`, but `undefined` is possible
|
|
539
|
-
* 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
540
|
-
* 6. By the way, union type never be not allowed
|
|
541
|
-
* 7. Property `set-cookie` must be array type
|
|
542
|
-
* 8. Those properties cannot be array type
|
|
543
|
-
* - age
|
|
544
|
-
* - authorization
|
|
545
|
-
* - content-length
|
|
546
|
-
* - content-type
|
|
547
|
-
* - etag
|
|
548
|
-
* - expires
|
|
549
|
-
* - from
|
|
550
|
-
* - host
|
|
551
|
-
* - if-modified-since
|
|
552
|
-
* - if-unmodified-since
|
|
553
|
-
* - last-modified
|
|
554
|
-
* - location
|
|
555
|
-
* - max-forwards
|
|
556
|
-
* - proxy-authorization
|
|
557
|
-
* - referer
|
|
558
|
-
* - retry-after
|
|
559
|
-
* - server
|
|
560
|
-
* - user-agent
|
|
561
|
-
*
|
|
562
|
-
* @template T Expected type of decoded value
|
|
563
|
-
* @param input Query string or URLSearchParams instance
|
|
564
|
-
* @returns Decoded headers object
|
|
565
|
-
*
|
|
566
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
567
|
-
*/
|
|
568
|
-
function assertHeaders<T extends object>(
|
|
569
|
-
input: Record<string, string | string[] | undefined>,
|
|
570
|
-
): Resolved<T>;
|
|
571
|
-
|
|
572
|
-
/**
|
|
573
|
-
* @internal
|
|
574
|
-
*/
|
|
575
|
-
function assertHeaders(): never {
|
|
576
|
-
halt("assertHeaders");
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
const assertHeadersPure = /** @__PURE__ */ Object.assign<
|
|
580
|
-
typeof assertHeaders,
|
|
581
|
-
{},
|
|
582
|
-
{}
|
|
583
|
-
>(
|
|
584
|
-
assertHeaders,
|
|
585
|
-
/** @__PURE__ */ Namespace.http.headers(),
|
|
586
|
-
/** @__PURE__ */ Namespace.assert("http.assertHeaders"),
|
|
587
|
-
);
|
|
588
|
-
export { assertHeadersPure as assertHeaders };
|
|
589
|
-
|
|
590
|
-
/**
|
|
591
|
-
* > You must configure the generic argument `T`.
|
|
592
|
-
*
|
|
593
|
-
* Headers decoder with type checking (for express and fastify).
|
|
594
|
-
*
|
|
595
|
-
* `typia.http.isHeaders()` is a function decoding an header instance, with
|
|
596
|
-
* automatic type casting to the expected type. When property type be defined as
|
|
597
|
-
* `boolean` or `number` type, `typia.http.headers()` will cast the value to the
|
|
598
|
-
* expected type.
|
|
599
|
-
*
|
|
600
|
-
* Also, after decoding, `typia.http.isHeaders()` performs type checking to the
|
|
601
|
-
* decoded value by combining with {@link is} function. Therefore, when the
|
|
602
|
-
* decoded value is not following the `T` type, `null` value would be returned.
|
|
603
|
-
*
|
|
604
|
-
* By the way, as HTTP headers are not enough to express complex data structures,
|
|
605
|
-
* `typia.http.headers()` function has some limitations. If target type `T` is not
|
|
606
|
-
* following those restrictions, compilation errors would be occured.
|
|
607
|
-
*
|
|
608
|
-
* 1. Type `T` must be an object type
|
|
609
|
-
* 2. Do not allow dynamic property
|
|
610
|
-
* 3. Property key must be lower case
|
|
611
|
-
* 4. Property value cannot be `null`, but `undefined` is possible
|
|
612
|
-
* 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
613
|
-
* 6. By the way, union type never be not allowed
|
|
614
|
-
* 7. Property `set-cookie` must be array type
|
|
615
|
-
* 8. Those properties cannot be array type
|
|
616
|
-
* - age
|
|
617
|
-
* - authorization
|
|
618
|
-
* - content-length
|
|
619
|
-
* - content-type
|
|
620
|
-
* - etag
|
|
621
|
-
* - expires
|
|
622
|
-
* - from
|
|
623
|
-
* - host
|
|
624
|
-
* - if-modified-since
|
|
625
|
-
* - if-unmodified-since
|
|
626
|
-
* - last-modified
|
|
627
|
-
* - location
|
|
628
|
-
* - max-forwards
|
|
629
|
-
* - proxy-authorization
|
|
630
|
-
* - referer
|
|
631
|
-
* - retry-after
|
|
632
|
-
* - server
|
|
633
|
-
* - user-agent
|
|
634
|
-
*
|
|
635
|
-
* @template T Expected type of decoded value
|
|
636
|
-
* @param input Query string or URLSearchParams instance
|
|
637
|
-
* @returns Decoded headers object or `null` value
|
|
638
|
-
*
|
|
639
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
640
|
-
*/
|
|
641
|
-
function isHeaders(): never;
|
|
642
|
-
|
|
643
|
-
/**
|
|
644
|
-
* > You must configure the generic argument `T`.
|
|
645
|
-
*
|
|
646
|
-
* Headers decoder with type checking (for express and fastify).
|
|
647
|
-
*
|
|
648
|
-
* `typia.http.isHeaders()` is a function decoding an header instance, with
|
|
649
|
-
* automatic type casting to the expected type. When property type be defined as
|
|
650
|
-
* `boolean` or `number` type, `typia.http.headers()` will cast the value to the
|
|
651
|
-
* expected type.
|
|
652
|
-
*
|
|
653
|
-
* Also, after decoding, `typia.http.isHeaders()` performs type checking to the
|
|
654
|
-
* decoded value by combining with {@link is} function. Therefore, when the
|
|
655
|
-
* decoded value is not following the `T` type, `null` value would be returned.
|
|
656
|
-
*
|
|
657
|
-
* By the way, as HTTP headers are not enough to express complex data structures,
|
|
658
|
-
* `typia.http.headers()` function has some limitations. If target type `T` is not
|
|
659
|
-
* following those restrictions, compilation errors would be occured.
|
|
660
|
-
*
|
|
661
|
-
* 1. Type `T` must be an object type
|
|
662
|
-
* 2. Do not allow dynamic property
|
|
663
|
-
* 3. Property key must be lower case
|
|
664
|
-
* 4. Property value cannot be `null`, but `undefined` is possible
|
|
665
|
-
* 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
666
|
-
* 6. By the way, union type never be not allowed
|
|
667
|
-
* 7. Property `set-cookie` must be array type
|
|
668
|
-
* 8. Those properties cannot be array type
|
|
669
|
-
* - age
|
|
670
|
-
* - authorization
|
|
671
|
-
* - content-length
|
|
672
|
-
* - content-type
|
|
673
|
-
* - etag
|
|
674
|
-
* - expires
|
|
675
|
-
* - from
|
|
676
|
-
* - host
|
|
677
|
-
* - if-modified-since
|
|
678
|
-
* - if-unmodified-since
|
|
679
|
-
* - last-modified
|
|
680
|
-
* - location
|
|
681
|
-
* - max-forwards
|
|
682
|
-
* - proxy-authorization
|
|
683
|
-
* - referer
|
|
684
|
-
* - retry-after
|
|
685
|
-
* - server
|
|
686
|
-
* - user-agent
|
|
687
|
-
*
|
|
688
|
-
* @template T Expected type of decoded value
|
|
689
|
-
* @param input Query string or URLSearchParams instance
|
|
690
|
-
* @returns Decoded headers object or `null` value
|
|
691
|
-
*
|
|
692
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
693
|
-
*/
|
|
694
|
-
function isHeaders<T extends object>(
|
|
695
|
-
input: Record<string, string | string[] | undefined>,
|
|
696
|
-
): Resolved<T> | null;
|
|
697
|
-
|
|
698
|
-
/**
|
|
699
|
-
* @internal
|
|
700
|
-
*/
|
|
701
|
-
function isHeaders(): never {
|
|
702
|
-
halt("isHeaders");
|
|
703
|
-
}
|
|
704
|
-
const isHeadersPure = /** @__PURE__ */ Object.assign<typeof isHeaders, {}, {}>(
|
|
705
|
-
isHeaders,
|
|
706
|
-
/** @__PURE__ */ Namespace.http.headers(),
|
|
707
|
-
/** @__PURE__ */ Namespace.is(),
|
|
708
|
-
);
|
|
709
|
-
export { isHeadersPure as isHeaders };
|
|
710
|
-
|
|
711
|
-
/**
|
|
712
|
-
* > You must configure the generic argument `T`.
|
|
713
|
-
*
|
|
714
|
-
* Headers decoder with type validation (for express and fastify).
|
|
715
|
-
*
|
|
716
|
-
* `typia.http.validateHeaders()` is a function decoding an header instance, with
|
|
717
|
-
* automatic type casting to the expected type. When property type be defined as
|
|
718
|
-
* `boolean` or `number` type, `typia.http.headers()` will cast the value to the
|
|
719
|
-
* expected type.
|
|
720
|
-
*
|
|
721
|
-
* Also, after decoding, `typia.http.validateHeaders()` performs type assertion to the
|
|
722
|
-
* decoded value by combining with {@link validate} function. Therefore, when the
|
|
723
|
-
* decoded value is not following the `T` type, {@link IValidation.IError} would be
|
|
724
|
-
* returned. Otherwise, {@link IValidation.ISuccess} be returned.
|
|
725
|
-
*
|
|
726
|
-
* By the way, as HTTP headers are not enough to express complex data structures,
|
|
727
|
-
* `typia.http.headers()` function has some limitations. If target type `T` is not
|
|
728
|
-
* following those restrictions, compilation errors would be occured.
|
|
729
|
-
*
|
|
730
|
-
* 1. Type `T` must be an object type
|
|
731
|
-
* 2. Do not allow dynamic property
|
|
732
|
-
* 3. Property key must be lower case
|
|
733
|
-
* 4. Property value cannot be `null`, but `undefined` is possible
|
|
734
|
-
* 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
735
|
-
* 6. By the way, union type never be not allowed
|
|
736
|
-
* 7. Property `set-cookie` must be array type
|
|
737
|
-
* 8. Those properties cannot be array type
|
|
738
|
-
* - age
|
|
739
|
-
* - authorization
|
|
740
|
-
* - content-length
|
|
741
|
-
* - content-type
|
|
742
|
-
* - etag
|
|
743
|
-
* - expires
|
|
744
|
-
* - from
|
|
745
|
-
* - host
|
|
746
|
-
* - if-modified-since
|
|
747
|
-
* - if-unmodified-since
|
|
748
|
-
* - last-modified
|
|
749
|
-
* - location
|
|
750
|
-
* - max-forwards
|
|
751
|
-
* - proxy-authorization
|
|
752
|
-
* - referer
|
|
753
|
-
* - retry-after
|
|
754
|
-
* - server
|
|
755
|
-
* - user-agent
|
|
756
|
-
*
|
|
757
|
-
* @template T Expected type of decoded value
|
|
758
|
-
* @param input Query string or URLSearchParams instance
|
|
759
|
-
* @returns Decoded headers object
|
|
760
|
-
*
|
|
761
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
762
|
-
*/
|
|
763
|
-
function validateHeaders(): never;
|
|
764
|
-
|
|
765
|
-
/**
|
|
766
|
-
* Headers decoder with type validation (for express and fastify).
|
|
767
|
-
*
|
|
768
|
-
* `typia.http.validateHeaders()` is a function decoding an header instance, with
|
|
769
|
-
* automatic type casting to the expected type. When property type be defined as
|
|
770
|
-
* `boolean` or `number` type, `typia.http.headers()` will cast the value to the
|
|
771
|
-
* expected type.
|
|
772
|
-
*
|
|
773
|
-
* Also, after decoding, `typia.http.validateHeaders()` performs type assertion to the
|
|
774
|
-
* decoded value by combining with {@link validate} function. Therefore, when the
|
|
775
|
-
* decoded value is not following the `T` type, {@link IValidation.IError} would be
|
|
776
|
-
* returned. Otherwise, {@link IValidation.ISuccess} be returned.
|
|
777
|
-
*
|
|
778
|
-
* By the way, as HTTP headers are not enough to express complex data structures,
|
|
779
|
-
* `typia.http.headers()` function has some limitations. If target type `T` is not
|
|
780
|
-
* following those restrictions, compilation errors would be occured.
|
|
781
|
-
*
|
|
782
|
-
* 1. Type `T` must be an object type
|
|
783
|
-
* 2. Do not allow dynamic property
|
|
784
|
-
* 3. Property key must be lower case
|
|
785
|
-
* 4. Property value cannot be `null`, but `undefined` is possible
|
|
786
|
-
* 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
787
|
-
* 6. By the way, union type never be not allowed
|
|
788
|
-
* 7. Property `set-cookie` must be array type
|
|
789
|
-
* 8. Those properties cannot be array type
|
|
790
|
-
* - age
|
|
791
|
-
* - authorization
|
|
792
|
-
* - content-length
|
|
793
|
-
* - content-type
|
|
794
|
-
* - etag
|
|
795
|
-
* - expires
|
|
796
|
-
* - from
|
|
797
|
-
* - host
|
|
798
|
-
* - if-modified-since
|
|
799
|
-
* - if-unmodified-since
|
|
800
|
-
* - last-modified
|
|
801
|
-
* - location
|
|
802
|
-
* - max-forwards
|
|
803
|
-
* - proxy-authorization
|
|
804
|
-
* - referer
|
|
805
|
-
* - retry-after
|
|
806
|
-
* - server
|
|
807
|
-
* - user-agent
|
|
808
|
-
*
|
|
809
|
-
* @template T Expected type of decoded value
|
|
810
|
-
* @param input Query string or URLSearchParams instance
|
|
811
|
-
* @returns Decoded headers object
|
|
812
|
-
*
|
|
813
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
814
|
-
*/
|
|
815
|
-
function validateHeaders<T extends object>(
|
|
816
|
-
input: Record<string, string | string[] | undefined>,
|
|
817
|
-
): IValidation<Resolved<T>>;
|
|
818
|
-
|
|
819
|
-
/**
|
|
820
|
-
* @internal
|
|
821
|
-
*/
|
|
822
|
-
function validateHeaders(): never {
|
|
823
|
-
halt("validateHeaders");
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
const validateHeadersPure = /** @__PURE__ */ Object.assign<
|
|
827
|
-
typeof validateHeaders,
|
|
828
|
-
{},
|
|
829
|
-
{}
|
|
830
|
-
>(
|
|
831
|
-
validateHeaders,
|
|
832
|
-
/** @__PURE__ */ Namespace.http.headers(),
|
|
833
|
-
/** @__PURE__ */ Namespace.validate(),
|
|
834
|
-
);
|
|
835
|
-
export { validateHeadersPure as validateHeaders };
|
|
836
|
-
|
|
837
|
-
/* -----------------------------------------------------------
|
|
838
|
-
PARAMETER
|
|
839
|
-
----------------------------------------------------------- */
|
|
840
|
-
/**
|
|
841
|
-
* > You must configure the generic argument `T`.
|
|
842
|
-
*
|
|
843
|
-
* URL path parameter decoder.
|
|
844
|
-
*
|
|
845
|
-
* `typia.http.parameter()` is a function decoding a path parameter, with automatic
|
|
846
|
-
* type casting to the expected type. When type `T` has beeen defined as `boolean` or
|
|
847
|
-
* `number` type, `typia.http.parameter()` will cast the value to the expected type.
|
|
848
|
-
*
|
|
849
|
-
* Also, `typia.http.parameter()` performs type assertion to the decoded value by
|
|
850
|
-
* combining with {@link assert} function. Therefore, when the decoded value is not
|
|
851
|
-
* following the `T` type, {@link TypeGuardError} would be thrown.
|
|
852
|
-
*
|
|
853
|
-
* @template T Expected type of decoded value
|
|
854
|
-
* @param input Path parameter string
|
|
855
|
-
* @returns Decoded path parameter value
|
|
856
|
-
*/
|
|
857
|
-
function parameter(): never;
|
|
858
|
-
|
|
859
|
-
/**
|
|
860
|
-
* URL path parameter decoder.
|
|
861
|
-
*
|
|
862
|
-
* `typia.http.parameter()` is a function decoding a path parameter, with automatic
|
|
863
|
-
* type casting to the expected type. When type `T` has beeen defined as `boolean` or
|
|
864
|
-
* `number` type, `typia.http.parameter()` will cast the value to the expected type.
|
|
865
|
-
*
|
|
866
|
-
* Also, `typia.http.parameter()` performs type assertion to the decoded value by
|
|
867
|
-
* combining with {@link assert} function. Therefore, when the decoded value is not
|
|
868
|
-
* following the `T` type, {@link TypeGuardError} would be thrown.
|
|
869
|
-
*
|
|
870
|
-
* @template T Expected type of decoded value
|
|
871
|
-
* @param input Path parameter string
|
|
872
|
-
* @returns Decoded path parameter value
|
|
873
|
-
*/
|
|
874
|
-
function parameter<T extends Atomic.Type | null>(input: string): Resolved<T>;
|
|
875
|
-
|
|
876
|
-
/**
|
|
877
|
-
* @internal
|
|
878
|
-
*/
|
|
879
|
-
function parameter(): never {
|
|
880
|
-
halt("parameter");
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
const parameterPure = /** @__PURE__ */ Object.assign<typeof parameter, {}, {}>(
|
|
884
|
-
parameter,
|
|
885
|
-
/** @__PURE__ */ Namespace.http.parameter(),
|
|
886
|
-
/** @__PURE__ */ Namespace.assert("http.parameter"),
|
|
887
|
-
);
|
|
888
|
-
export { parameterPure as parameter };
|
|
889
|
-
|
|
890
|
-
/* -----------------------------------------------------------
|
|
891
|
-
FACTORY FUNCTIONS
|
|
892
|
-
----------------------------------------------------------- */
|
|
893
|
-
/**
|
|
894
|
-
* Creates a reusable {@link query} function.
|
|
895
|
-
*
|
|
896
|
-
* @danger You must configure the generic argument `T`
|
|
897
|
-
* @template T The type of the query object
|
|
898
|
-
* @throws compile error
|
|
899
|
-
*
|
|
900
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
901
|
-
*/
|
|
902
|
-
function createQuery(): never;
|
|
903
|
-
|
|
904
|
-
/**
|
|
905
|
-
* Creates a reusable {@link query} function.
|
|
906
|
-
*
|
|
907
|
-
* @template T The type of the query object
|
|
908
|
-
* @returns A reusable `query` function
|
|
909
|
-
*
|
|
910
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
911
|
-
*/
|
|
912
|
-
function createQuery<T extends object>(): (
|
|
913
|
-
input: string | URLSearchParams,
|
|
914
|
-
) => T;
|
|
915
|
-
|
|
916
|
-
/**
|
|
917
|
-
* @internal
|
|
918
|
-
*/
|
|
919
|
-
function createQuery<T>(): (input: string | URLSearchParams) => T {
|
|
920
|
-
halt("createQuery");
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
const createQueryPure = /** @__PURE__ */ Object.assign<typeof createQuery, {}>(
|
|
924
|
-
createQuery,
|
|
925
|
-
/** @__PURE__ */ Namespace.http.query(),
|
|
926
|
-
);
|
|
927
|
-
export { createQueryPure as createQuery };
|
|
928
|
-
|
|
929
|
-
/**
|
|
930
|
-
* Creates a reusable {@link assertQuery} function.
|
|
931
|
-
*
|
|
932
|
-
* @danger You must configure the generic argument `T`
|
|
933
|
-
* @template T The type of the query object
|
|
934
|
-
* @throws compile error
|
|
935
|
-
*
|
|
936
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
937
|
-
*/
|
|
938
|
-
function createAssertQuery(): never;
|
|
939
|
-
|
|
940
|
-
/**
|
|
941
|
-
* Creates a reusable {@link assertQuery} function.
|
|
942
|
-
*
|
|
943
|
-
* @template T The type of the query object
|
|
944
|
-
* @returns A reusable `assertQuery` function
|
|
945
|
-
*
|
|
946
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
947
|
-
*/
|
|
948
|
-
function createAssertQuery<T extends object>(): (
|
|
949
|
-
input: string | URLSearchParams,
|
|
950
|
-
) => T;
|
|
951
|
-
|
|
952
|
-
/**
|
|
953
|
-
* @internal
|
|
954
|
-
*/
|
|
955
|
-
function createAssertQuery<T>(): (input: string | URLSearchParams) => T {
|
|
956
|
-
halt("createAssertQuery");
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
const createAssertQueryPure = /** @__PURE__ */ Object.assign<
|
|
960
|
-
typeof createAssertQuery,
|
|
961
|
-
{},
|
|
962
|
-
{}
|
|
963
|
-
>(
|
|
964
|
-
createAssertQuery,
|
|
965
|
-
/** @__PURE__ */ Namespace.http.query(),
|
|
966
|
-
/** @__PURE__ */ Namespace.assert("http.createAssertQuery"),
|
|
967
|
-
);
|
|
968
|
-
export { createAssertQueryPure as createAssertQuery };
|
|
969
|
-
|
|
970
|
-
/**
|
|
971
|
-
* Creates a reusable {@link isQuery} function.
|
|
972
|
-
*
|
|
973
|
-
* @danger You must configure the generic argument `T`
|
|
974
|
-
* @template T The type of the query object
|
|
975
|
-
* @throws compile error
|
|
976
|
-
*
|
|
977
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
978
|
-
*/
|
|
979
|
-
function createIsQuery(): never;
|
|
980
|
-
|
|
981
|
-
/**
|
|
982
|
-
* Creates a reusable {@link isQuery} function.
|
|
983
|
-
*
|
|
984
|
-
* @template T The type of the query object
|
|
985
|
-
* @returns A reusable `isQuery` function
|
|
986
|
-
*
|
|
987
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
988
|
-
*/
|
|
989
|
-
function createIsQuery<T extends object>(): (
|
|
990
|
-
input: string | URLSearchParams,
|
|
991
|
-
) => T | null;
|
|
992
|
-
|
|
993
|
-
/**
|
|
994
|
-
* @internal
|
|
995
|
-
*/
|
|
996
|
-
function createIsQuery<T>(): (input: string | URLSearchParams) => T | null {
|
|
997
|
-
halt("createIsQuery");
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
const createIsQueryPure = /** @__PURE__ */ Object.assign<
|
|
1001
|
-
typeof createIsQuery,
|
|
1002
|
-
{},
|
|
1003
|
-
{}
|
|
1004
|
-
>(
|
|
1005
|
-
createIsQuery,
|
|
1006
|
-
/** @__PURE__ */ Namespace.http.query(),
|
|
1007
|
-
/** @__PURE__ */ Namespace.is(),
|
|
1008
|
-
);
|
|
1009
|
-
export { createIsQueryPure as createIsQuery };
|
|
1010
|
-
|
|
1011
|
-
/**
|
|
1012
|
-
* Creates a reusable {@link validateQuery} function.
|
|
1013
|
-
*
|
|
1014
|
-
* @danger You must configure the generic argument `T`
|
|
1015
|
-
* @template T The type of the query object
|
|
1016
|
-
* @throws compile error
|
|
1017
|
-
*
|
|
1018
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
1019
|
-
*/
|
|
1020
|
-
function createValidateQuery(): never;
|
|
1021
|
-
|
|
1022
|
-
/**
|
|
1023
|
-
* Creates a reusable {@link validateQuery} function.
|
|
1024
|
-
*
|
|
1025
|
-
* @template T The type of the query object
|
|
1026
|
-
* @returns A reusable `validateQuery` function
|
|
1027
|
-
*
|
|
1028
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
1029
|
-
*/
|
|
1030
|
-
function createValidateQuery<T extends object>(): (
|
|
1031
|
-
input: string | URLSearchParams,
|
|
1032
|
-
) => IValidation<Resolved<T>>;
|
|
1033
|
-
|
|
1034
|
-
/**
|
|
1035
|
-
* @internal
|
|
1036
|
-
*/
|
|
1037
|
-
function createValidateQuery<T>(): (
|
|
1038
|
-
input: string | URLSearchParams,
|
|
1039
|
-
) => IValidation<Resolved<T>> {
|
|
1040
|
-
halt("createValidateQuery");
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
|
-
const createValidateQueryPure = /** @__PURE__ */ Object.assign<
|
|
1044
|
-
typeof createValidateQuery,
|
|
1045
|
-
{},
|
|
1046
|
-
{}
|
|
1047
|
-
>(
|
|
1048
|
-
createValidateQuery,
|
|
1049
|
-
/** @__PURE__ */ Namespace.http.query(),
|
|
1050
|
-
/** @__PURE__ */ Namespace.validate(),
|
|
1051
|
-
);
|
|
1052
|
-
export { createValidateQueryPure as createValidateQuery };
|
|
1053
|
-
|
|
1054
|
-
/**
|
|
1055
|
-
* Creates a reusable {@link headers} function.
|
|
1056
|
-
*
|
|
1057
|
-
* @danger You must configure the generic argument `T`
|
|
1058
|
-
* @template T The type of the headers object
|
|
1059
|
-
* @throws compile error
|
|
1060
|
-
*
|
|
1061
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
1062
|
-
*/
|
|
1063
|
-
function createHeaders(): never;
|
|
1064
|
-
|
|
1065
|
-
/**
|
|
1066
|
-
* Creates a reusable {@link headers} function.
|
|
1067
|
-
*
|
|
1068
|
-
* @template T The type of the headers object
|
|
1069
|
-
* @returns A reusable `headers` function
|
|
1070
|
-
*
|
|
1071
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
1072
|
-
*/
|
|
1073
|
-
function createHeaders<T extends object>(): (
|
|
1074
|
-
input: Record<string, string | string[] | undefined>,
|
|
1075
|
-
) => T;
|
|
1076
|
-
|
|
1077
|
-
/**
|
|
1078
|
-
* @internal
|
|
1079
|
-
*/
|
|
1080
|
-
function createHeaders<T>(): (
|
|
1081
|
-
input: Record<string, string | string[] | undefined>,
|
|
1082
|
-
) => T {
|
|
1083
|
-
halt("createHeaders");
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
const createHeadersPure = /** @__PURE__ */ Object.assign<
|
|
1087
|
-
typeof createHeaders,
|
|
1088
|
-
{}
|
|
1089
|
-
>(createHeaders, /** @__PURE__ */ Namespace.http.headers());
|
|
1090
|
-
export { createHeadersPure as createHeaders };
|
|
1091
|
-
|
|
1092
|
-
/**
|
|
1093
|
-
* Creates a reusable {@link assertHeaders} function.
|
|
1094
|
-
*
|
|
1095
|
-
* @danger You must configure the generic argument `T`
|
|
1096
|
-
* @template T The type of the headers object
|
|
1097
|
-
* @throws compile error
|
|
1098
|
-
*
|
|
1099
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
1100
|
-
*/
|
|
1101
|
-
function createAssertHeaders(): never;
|
|
1102
|
-
|
|
1103
|
-
/**
|
|
1104
|
-
* Creates a reusable {@link assertHeaders} function.
|
|
1105
|
-
*
|
|
1106
|
-
* @template T The type of the headers object
|
|
1107
|
-
* @returns A reusable `assertHeaders` function
|
|
1108
|
-
*
|
|
1109
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
1110
|
-
*/
|
|
1111
|
-
function createAssertHeaders<T extends object>(): (
|
|
1112
|
-
input: Record<string, string | string[] | undefined>,
|
|
1113
|
-
) => T;
|
|
1114
|
-
|
|
1115
|
-
/**
|
|
1116
|
-
* @internal
|
|
1117
|
-
*/
|
|
1118
|
-
function createAssertHeaders<T>(): (
|
|
1119
|
-
input: Record<string, string | string[] | undefined>,
|
|
1120
|
-
) => T {
|
|
1121
|
-
halt("createAssertHeaders");
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
const createAssertHeadersPure = /** @__PURE__ */ Object.assign<
|
|
1125
|
-
typeof createAssertHeaders,
|
|
1126
|
-
{},
|
|
1127
|
-
{}
|
|
1128
|
-
>(
|
|
1129
|
-
createAssertHeaders,
|
|
1130
|
-
/** @__PURE__ */ Namespace.http.headers(),
|
|
1131
|
-
/** @__PURE__ */ Namespace.assert("http.createAssertHeaders"),
|
|
1132
|
-
);
|
|
1133
|
-
export { createAssertHeadersPure as createAssertHeaders };
|
|
1134
|
-
|
|
1135
|
-
/**
|
|
1136
|
-
* Creates a reusable {@link isHeaders} function.
|
|
1137
|
-
*
|
|
1138
|
-
* @danger You must configure the generic argument `T`
|
|
1139
|
-
* @template T The type of the headers object
|
|
1140
|
-
* @throws compile error
|
|
1141
|
-
*
|
|
1142
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
1143
|
-
*/
|
|
1144
|
-
function createIsHeaders(): never;
|
|
1145
|
-
|
|
1146
|
-
/**
|
|
1147
|
-
* Creates a reusable {@link isHeaders} function.
|
|
1148
|
-
*
|
|
1149
|
-
* @template T The type of the headers object
|
|
1150
|
-
* @returns A reusable `isHeaders` function
|
|
1151
|
-
*
|
|
1152
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
1153
|
-
*/
|
|
1154
|
-
function createIsHeaders<T extends object>(): (
|
|
1155
|
-
input: Record<string, string | string[] | undefined>,
|
|
1156
|
-
) => T | null;
|
|
1157
|
-
|
|
1158
|
-
/**
|
|
1159
|
-
* @internal
|
|
1160
|
-
*/
|
|
1161
|
-
function createIsHeaders<T>(): (
|
|
1162
|
-
input: Record<string, string | string[] | undefined>,
|
|
1163
|
-
) => T | null {
|
|
1164
|
-
halt("createIsHeaders");
|
|
1165
|
-
}
|
|
1166
|
-
|
|
1167
|
-
const createIsHeadersPure = /** @__PURE__ */ Object.assign<
|
|
1168
|
-
typeof createIsHeaders,
|
|
1169
|
-
{},
|
|
1170
|
-
{}
|
|
1171
|
-
>(
|
|
1172
|
-
createIsHeaders,
|
|
1173
|
-
/** @__PURE__ */ Namespace.http.headers(),
|
|
1174
|
-
/** @__PURE__ */ Namespace.is(),
|
|
1175
|
-
);
|
|
1176
|
-
export { createIsHeadersPure as createIsHeaders };
|
|
1177
|
-
|
|
1178
|
-
/**
|
|
1179
|
-
* Creates a reusable {@link validateHeaders} function.
|
|
1180
|
-
*
|
|
1181
|
-
* @danger You must configure the generic argument `T`
|
|
1182
|
-
* @template T The type of the headers object
|
|
1183
|
-
* @throws compile error
|
|
1184
|
-
*
|
|
1185
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
1186
|
-
*/
|
|
1187
|
-
function createValidateHeaders(): never;
|
|
1188
|
-
|
|
1189
|
-
/**
|
|
1190
|
-
* Creates a reusable {@link validateHeaders} function.
|
|
1191
|
-
*
|
|
1192
|
-
* @template T The type of the headers object
|
|
1193
|
-
* @returns A reusable `validateHeaders` function
|
|
1194
|
-
*
|
|
1195
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
1196
|
-
*/
|
|
1197
|
-
function createValidateHeaders<T extends object>(): (
|
|
1198
|
-
input: Record<string, string | string[] | undefined>,
|
|
1199
|
-
) => IValidation<Resolved<T>>;
|
|
1200
|
-
|
|
1201
|
-
/**
|
|
1202
|
-
* @internal
|
|
1203
|
-
*/
|
|
1204
|
-
function createValidateHeaders<T>(): (
|
|
1205
|
-
input: Record<string, string | string[] | undefined>,
|
|
1206
|
-
) => IValidation<Resolved<T>> {
|
|
1207
|
-
halt("createValidateHeaders");
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
const createValidateHeadersPure = /** @__PURE__ */ Object.assign<
|
|
1211
|
-
typeof createValidateHeaders,
|
|
1212
|
-
{},
|
|
1213
|
-
{}
|
|
1214
|
-
>(
|
|
1215
|
-
createValidateHeaders,
|
|
1216
|
-
/** @__PURE__ */ Namespace.http.headers(),
|
|
1217
|
-
/** @__PURE__ */ Namespace.validate(),
|
|
1218
|
-
);
|
|
1219
|
-
export { createValidateHeadersPure as createValidateHeaders };
|
|
1220
|
-
|
|
1221
|
-
/**
|
|
1222
|
-
* Creates a reusable {@link parameter} function.
|
|
1223
|
-
*
|
|
1224
|
-
* @danger You must configure the generic argument `T`
|
|
1225
|
-
* @template T The type of the parameter value
|
|
1226
|
-
* @throws compile error
|
|
1227
|
-
*
|
|
1228
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
1229
|
-
*/
|
|
1230
|
-
function createParameter(): never;
|
|
1231
|
-
|
|
1232
|
-
/**
|
|
1233
|
-
* Creates a reusable {@link parameter} function.
|
|
1234
|
-
*
|
|
1235
|
-
* @template T The type of the parameter value
|
|
1236
|
-
* @returns A reusable `parameter` function
|
|
1237
|
-
*
|
|
1238
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
1239
|
-
*/
|
|
1240
|
-
function createParameter<T extends Atomic.Type | null>(): (input: string) => T;
|
|
1241
|
-
|
|
1242
|
-
/**
|
|
1243
|
-
* @internal
|
|
1244
|
-
*/
|
|
1245
|
-
function createParameter<T extends Atomic.Type | null>(): (input: string) => T {
|
|
1246
|
-
halt("createParameter");
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
const createParameterPure = /** @__PURE__ */ Object.assign<
|
|
1250
|
-
typeof createParameter,
|
|
1251
|
-
{},
|
|
1252
|
-
{}
|
|
1253
|
-
>(
|
|
1254
|
-
createParameter,
|
|
1255
|
-
/** @__PURE__ */ Namespace.http.parameter(),
|
|
1256
|
-
/** @__PURE__ */ Namespace.assert("http.createParameter"),
|
|
1257
|
-
);
|
|
1258
|
-
export { createParameterPure as createParameter };
|
|
1259
|
-
|
|
1260
|
-
/**
|
|
1261
|
-
* @internal
|
|
1262
|
-
*/
|
|
1263
|
-
function halt(name: string): never {
|
|
1264
|
-
throw new Error(
|
|
1265
|
-
`Error on typia.http.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
|
|
1266
|
-
);
|
|
1267
|
-
}
|
|
1
|
+
import * as Namespace from "./functional/Namespace";
|
|
2
|
+
|
|
3
|
+
import { Atomic } from "./typings/Atomic";
|
|
4
|
+
|
|
5
|
+
import { IValidation } from "./IValidation";
|
|
6
|
+
import { Resolved } from "./Resolved";
|
|
7
|
+
|
|
8
|
+
/* ===========================================================
|
|
9
|
+
HTTP
|
|
10
|
+
- QUERY
|
|
11
|
+
- HEADERS
|
|
12
|
+
- PARAMETER
|
|
13
|
+
- FACTORY FUNCTIONS
|
|
14
|
+
==============================================================
|
|
15
|
+
QUERY
|
|
16
|
+
----------------------------------------------------------- */
|
|
17
|
+
/**
|
|
18
|
+
* > You must configure the generic argument `T`.
|
|
19
|
+
*
|
|
20
|
+
* URL query decoder.
|
|
21
|
+
*
|
|
22
|
+
* `typia.http.query()` is a function decoding a query string or an `URLSearchParams`
|
|
23
|
+
* instance, with automatic type casting to the expected type. When property type be
|
|
24
|
+
* defined as `boolean` or `number` type, `typia.http.query()` will cast the value to
|
|
25
|
+
* the expected type when decoding.
|
|
26
|
+
*
|
|
27
|
+
* By the way, as URL query is not enough to express complex data structures,
|
|
28
|
+
* `typia.http.query()` function has some limitations. If target type `T` is not
|
|
29
|
+
* following those restrictions, compilation errors would be occured.
|
|
30
|
+
*
|
|
31
|
+
* 1. Type `T` must be an object type
|
|
32
|
+
* 2. Do not allow dynamic property
|
|
33
|
+
* 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
34
|
+
* 4. By the way, union type never be not allowed
|
|
35
|
+
*
|
|
36
|
+
* Also, `typia.http.query()` function does not perform validation about the decoded
|
|
37
|
+
* value. Therefore, if you can't sure that input data is following the `T` type,
|
|
38
|
+
* it would better to call one of below functions intead.
|
|
39
|
+
*
|
|
40
|
+
* - {@link assertQuery}
|
|
41
|
+
* - {@link isQuery}
|
|
42
|
+
* - {@link validateQuery}
|
|
43
|
+
*
|
|
44
|
+
* @template T Expected type of decoded value
|
|
45
|
+
* @param input Query string or URLSearchParams instance
|
|
46
|
+
* @returns Decoded query object
|
|
47
|
+
*
|
|
48
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
49
|
+
*/
|
|
50
|
+
function query(): never;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* URL query decoder.
|
|
54
|
+
*
|
|
55
|
+
* `typia.http.query()` is a function decoding a query string or an `URLSearchParams`
|
|
56
|
+
* instance, with automatic type casting to the expected type. When property type be
|
|
57
|
+
* defined as `boolean` or `number` type, `typia.http.query()` will cast the value to
|
|
58
|
+
* the expected type when decoding.
|
|
59
|
+
*
|
|
60
|
+
* By the way, as URL query is not enough to express complex data structures,
|
|
61
|
+
* `typia.http.query()` function has some limitations. If target type `T` is not
|
|
62
|
+
* following those restrictions, compilation errors would be occured.
|
|
63
|
+
*
|
|
64
|
+
* 1. Type `T` must be an object type
|
|
65
|
+
* 2. Do not allow dynamic property
|
|
66
|
+
* 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
67
|
+
* 4. By the way, union type never be not allowed
|
|
68
|
+
*
|
|
69
|
+
* Also, `typia.http.query()` function does not perform validation about the decoded
|
|
70
|
+
* value. Therefore, if you can't sure that input data is following the `T` type,
|
|
71
|
+
* it would better to call one of below functions intead.
|
|
72
|
+
*
|
|
73
|
+
* - {@link assertQuery}
|
|
74
|
+
* - {@link isQuery}
|
|
75
|
+
* - {@link validateQuery}
|
|
76
|
+
*
|
|
77
|
+
* @template T Expected type of decoded value
|
|
78
|
+
* @param input Query string or URLSearchParams instance
|
|
79
|
+
* @returns Decoded query object
|
|
80
|
+
*
|
|
81
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
82
|
+
*/
|
|
83
|
+
function query<T extends object>(input: string | URLSearchParams): Resolved<T>;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @internal
|
|
87
|
+
*/
|
|
88
|
+
function query(): never {
|
|
89
|
+
halt("query");
|
|
90
|
+
}
|
|
91
|
+
const queryPure = /** @__PURE__ */ Object.assign<typeof query, {}>(
|
|
92
|
+
query,
|
|
93
|
+
/** @__PURE__ */ Namespace.http.query(),
|
|
94
|
+
);
|
|
95
|
+
export { queryPure as query };
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* > You must configure the generic argument `T`.
|
|
99
|
+
*
|
|
100
|
+
* URL query decoder with type assertion.
|
|
101
|
+
*
|
|
102
|
+
* `typia.http.assertQuery()` is a function decoding a query string or an
|
|
103
|
+
* `URLSearchParams` instance, with automatic type casting to the expected type.
|
|
104
|
+
* When property type be defined as `boolean` or `number` type,
|
|
105
|
+
* `typia.http.assertQuery()` will cast the value to the expected type when decoding.
|
|
106
|
+
*
|
|
107
|
+
* Also, after decoding, `typia.http.assertQuery()` performs type assertion to the
|
|
108
|
+
* decoded value by combining with {@link assert} function. Therefore, when the
|
|
109
|
+
* decoded value is not following the `T` type, {@link TypeGuardError} would be
|
|
110
|
+
* thrown.
|
|
111
|
+
*
|
|
112
|
+
* By the way, as URL query is not enough to express complex data structures,
|
|
113
|
+
* `typia.http.assertQuery()` function has some limitations. If target type `T` is
|
|
114
|
+
* notfollowing those restrictions, compilation errors would be occured.
|
|
115
|
+
*
|
|
116
|
+
* 1. Type `T` must be an object type
|
|
117
|
+
* 2. Do not allow dynamic property
|
|
118
|
+
* 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
119
|
+
* 4. By the way, union type never be not allowed
|
|
120
|
+
*
|
|
121
|
+
* @template T Expected type of decoded value
|
|
122
|
+
* @param input Query string or URLSearchParams instance
|
|
123
|
+
* @returns Decoded query object
|
|
124
|
+
*
|
|
125
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
126
|
+
*/
|
|
127
|
+
function assertQuery(): never;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* URL query decoder with type assertion.
|
|
131
|
+
*
|
|
132
|
+
* `typia.http.assertQuery()` is a function decoding a query string or an
|
|
133
|
+
* `URLSearchParams` instance, with automatic type casting to the expected type.
|
|
134
|
+
* When property type be defined as `boolean` or `number` type,
|
|
135
|
+
* `typia.http.assertQuery()` will cast the value to the expected type when decoding.
|
|
136
|
+
*
|
|
137
|
+
* Also, after decoding, `typia.http.assertQuery()` performs type assertion to the
|
|
138
|
+
* decoded value by combining with {@link assert} function. Therefore, when the
|
|
139
|
+
* decoded value is not following the `T` type, {@link TypeGuardError} would be
|
|
140
|
+
* thrown.
|
|
141
|
+
*
|
|
142
|
+
* By the way, as URL query is not enough to express complex data structures,
|
|
143
|
+
* `typia.http.assertQuery()` function has some limitations. If target type `T` is
|
|
144
|
+
* notfollowing those restrictions, compilation errors would be occured.
|
|
145
|
+
*
|
|
146
|
+
* 1. Type `T` must be an object type
|
|
147
|
+
* 2. Do not allow dynamic property
|
|
148
|
+
* 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
149
|
+
* 4. By the way, union type never be not allowed
|
|
150
|
+
*
|
|
151
|
+
* @template T Expected type of decoded value
|
|
152
|
+
* @param input Query string or URLSearchParams instance
|
|
153
|
+
* @returns Decoded query object
|
|
154
|
+
*
|
|
155
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
156
|
+
*/
|
|
157
|
+
function assertQuery<T extends object>(
|
|
158
|
+
input: string | URLSearchParams,
|
|
159
|
+
): Resolved<T>;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @internal
|
|
163
|
+
*/
|
|
164
|
+
function assertQuery(): never {
|
|
165
|
+
halt("assertQuery");
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const assertQueryPure = /** @__PURE__ */ Object.assign<
|
|
169
|
+
typeof assertQuery,
|
|
170
|
+
{},
|
|
171
|
+
{}
|
|
172
|
+
>(
|
|
173
|
+
assertQuery,
|
|
174
|
+
/** @__PURE__ */ Namespace.http.query(),
|
|
175
|
+
/** @__PURE__ */ Namespace.assert("http.assertQuery"),
|
|
176
|
+
);
|
|
177
|
+
export { assertQueryPure as assertQuery };
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* > You must configure the generic argument `T`.
|
|
181
|
+
*
|
|
182
|
+
* URL query decoder with type checking.
|
|
183
|
+
*
|
|
184
|
+
* `typia.http.isQuery()` is a function decoding a query string or an
|
|
185
|
+
* `URLSearchParams` instance, with automatic type casting to the expected type.
|
|
186
|
+
* When property type be defined as `boolean` or `number` type,
|
|
187
|
+
* `typia.http.isQuery()` will cast the value to the expected type when decoding.
|
|
188
|
+
*
|
|
189
|
+
* Also, after decoding, `typia.http.isQuery()` performs type checking to the
|
|
190
|
+
* decoded value by combining with {@link is} function. Therefore, when the
|
|
191
|
+
* decoded value is not following the `T` type, `null` value would be returned.
|
|
192
|
+
*
|
|
193
|
+
* By the way, as URL query is not enough to express complex data structures,
|
|
194
|
+
* `typia.http.isQuery()` function has some limitations. If target type `T` is
|
|
195
|
+
* notfollowing those restrictions, compilation errors would be occured.
|
|
196
|
+
*
|
|
197
|
+
* 1. Type `T` must be an object type
|
|
198
|
+
* 2. Do not allow dynamic property
|
|
199
|
+
* 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
200
|
+
* 4. By the way, union type never be not allowed
|
|
201
|
+
*
|
|
202
|
+
* @template T Expected type of decoded value
|
|
203
|
+
* @param input Query string or URLSearchParams instance
|
|
204
|
+
* @returns Decoded query object or `null` value
|
|
205
|
+
*
|
|
206
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
207
|
+
*/
|
|
208
|
+
function isQuery(): never;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* URL query decoder with type checking.
|
|
212
|
+
*
|
|
213
|
+
* `typia.http.isQuery()` is a function decoding a query string or an
|
|
214
|
+
* `URLSearchParams` instance, with automatic type casting to the expected type.
|
|
215
|
+
* When property type be defined as `boolean` or `number` type,
|
|
216
|
+
* `typia.http.isQuery()` will cast the value to the expected type when decoding.
|
|
217
|
+
*
|
|
218
|
+
* Also, after decoding, `typia.http.isQuery()` performs type checking to the
|
|
219
|
+
* decoded value by combining with {@link is} function. Therefore, when the
|
|
220
|
+
* decoded value is not following the `T` type, `null` value would be returned.
|
|
221
|
+
*
|
|
222
|
+
* By the way, as URL query is not enough to express complex data structures,
|
|
223
|
+
* `typia.http.isQuery()` function has some limitations. If target type `T` is
|
|
224
|
+
* notfollowing those restrictions, compilation errors would be occured.
|
|
225
|
+
*
|
|
226
|
+
* 1. Type `T` must be an object type
|
|
227
|
+
* 2. Do not allow dynamic property
|
|
228
|
+
* 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
229
|
+
* 4. By the way, union type never be not allowed
|
|
230
|
+
*
|
|
231
|
+
* @template T Expected type of decoded value
|
|
232
|
+
* @param input Query string or URLSearchParams instance
|
|
233
|
+
* @returns Decoded query object or `null` value
|
|
234
|
+
*
|
|
235
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
236
|
+
*/
|
|
237
|
+
function isQuery<T extends object>(
|
|
238
|
+
input: string | URLSearchParams,
|
|
239
|
+
): Resolved<T> | null;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* @internal
|
|
243
|
+
*/
|
|
244
|
+
function isQuery(): never {
|
|
245
|
+
halt("isQuery");
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
const isQueryPure = /** @__PURE__ */ Object.assign<typeof isQuery, {}, {}>(
|
|
249
|
+
isQuery,
|
|
250
|
+
/** @__PURE__ */ Namespace.http.query(),
|
|
251
|
+
/** @__PURE__ */ Namespace.is(),
|
|
252
|
+
);
|
|
253
|
+
export { isQueryPure as isQuery };
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* > You must configure the generic argument `T`.
|
|
257
|
+
*
|
|
258
|
+
* URL query decoder with type validation.
|
|
259
|
+
*
|
|
260
|
+
* `typia.http.validateQuery()` is a function decoding a query string or an
|
|
261
|
+
* `URLSearchParams` instance, with automatic type casting to the expected type.
|
|
262
|
+
* When property type be defined as `boolean` or `number` type,
|
|
263
|
+
* `typia.http.validateQuery()` will cast the value to the expected type when decoding.
|
|
264
|
+
*
|
|
265
|
+
* Also, after decoding, `typia.http.validateQuery()` performs type validation to the
|
|
266
|
+
* decoded value by combining with {@link validate} function. Therefore, when the
|
|
267
|
+
* decoded value is not following the `T` type, {@link IValidation.IFailure} would
|
|
268
|
+
* be returned. Otherwise, {@link IValidation.ISuccess} would be returned.
|
|
269
|
+
*
|
|
270
|
+
* By the way, as URL query is not enough to express complex data structures,
|
|
271
|
+
* `typia.http.validateQuery()` function has some limitations. If target type `T` is
|
|
272
|
+
* notfollowing those restrictions, compilation errors would be occured.
|
|
273
|
+
*
|
|
274
|
+
* 1. Type `T` must be an object type
|
|
275
|
+
* 2. Do not allow dynamic property
|
|
276
|
+
* 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
277
|
+
* 4. By the way, union type never be not allowed
|
|
278
|
+
*
|
|
279
|
+
* @template T Expected type of decoded value
|
|
280
|
+
* @param input Query string or URLSearchParams instance
|
|
281
|
+
* @returns Validation result with decoded query object
|
|
282
|
+
*
|
|
283
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
284
|
+
*/
|
|
285
|
+
function validateQuery(): never;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* URL query decoder with type validation.
|
|
289
|
+
*
|
|
290
|
+
* `typia.http.validateQuery()` is a function decoding a query string or an
|
|
291
|
+
* `URLSearchParams` instance, with automatic type casting to the expected type.
|
|
292
|
+
* When property type be defined as `boolean` or `number` type,
|
|
293
|
+
* `typia.http.validateQuery()` will cast the value to the expected type when decoding.
|
|
294
|
+
*
|
|
295
|
+
* Also, after decoding, `typia.http.validateQuery()` performs type validation to the
|
|
296
|
+
* decoded value by combining with {@link validate} function. Therefore, when the
|
|
297
|
+
* decoded value is not following the `T` type, {@link IValidation.IFailure} would
|
|
298
|
+
* be returned. Otherwise, {@link IValidation.ISuccess} would be returned.
|
|
299
|
+
*
|
|
300
|
+
* By the way, as URL query is not enough to express complex data structures,
|
|
301
|
+
* `typia.http.validateQuery()` function has some limitations. If target type `T` is
|
|
302
|
+
* notfollowing those restrictions, compilation errors would be occured.
|
|
303
|
+
*
|
|
304
|
+
* 1. Type `T` must be an object type
|
|
305
|
+
* 2. Do not allow dynamic property
|
|
306
|
+
* 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
307
|
+
* 4. By the way, union type never be not allowed
|
|
308
|
+
*
|
|
309
|
+
* @template T Expected type of decoded value
|
|
310
|
+
* @param input Query string or URLSearchParams instance
|
|
311
|
+
* @returns Validation result with decoded query object
|
|
312
|
+
*
|
|
313
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
314
|
+
*/
|
|
315
|
+
function validateQuery<T extends object>(
|
|
316
|
+
input: string | URLSearchParams,
|
|
317
|
+
): IValidation<Resolved<T>>;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* @internal
|
|
321
|
+
*/
|
|
322
|
+
function validateQuery(): never {
|
|
323
|
+
halt("validateQuery");
|
|
324
|
+
}
|
|
325
|
+
const validateQueryPure = /** @__PURE__ */ Object.assign<
|
|
326
|
+
typeof validateQuery,
|
|
327
|
+
{},
|
|
328
|
+
{}
|
|
329
|
+
>(
|
|
330
|
+
validateQuery,
|
|
331
|
+
/** @__PURE__ */ Namespace.http.query(),
|
|
332
|
+
/** @__PURE__ */ Namespace.validate(),
|
|
333
|
+
);
|
|
334
|
+
export { validateQueryPure as validateQuery };
|
|
335
|
+
|
|
336
|
+
/* -----------------------------------------------------------
|
|
337
|
+
HEADERS
|
|
338
|
+
----------------------------------------------------------- */
|
|
339
|
+
/**
|
|
340
|
+
* > You must configure the generic argument `T`.
|
|
341
|
+
*
|
|
342
|
+
* Headers decoder (for express and fastify).
|
|
343
|
+
*
|
|
344
|
+
* `typia.http.headers()` is a function decoding an header instance, with automatic
|
|
345
|
+
* type casting to the expected type. When property type be defined as `boolean` or
|
|
346
|
+
* `number` type, `typia.http.headers()` will cast the value to the expected type.
|
|
347
|
+
*
|
|
348
|
+
* By the way, as HTTP headers are not enough to express complex data structures,
|
|
349
|
+
* `typia.http.headers()` function has some limitations. If target type `T` is not
|
|
350
|
+
* following those restrictions, compilation errors would be occured.
|
|
351
|
+
*
|
|
352
|
+
* 1. Type `T` must be an object type
|
|
353
|
+
* 2. Do not allow dynamic property
|
|
354
|
+
* 3. Property key must be lower case
|
|
355
|
+
* 4. Property value cannot be `null`, but `undefined` is possible
|
|
356
|
+
* 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
357
|
+
* 6. By the way, union type never be not allowed
|
|
358
|
+
* 7. Property `set-cookie` must be array type
|
|
359
|
+
* 8. Those properties cannot be array type
|
|
360
|
+
* - age
|
|
361
|
+
* - authorization
|
|
362
|
+
* - content-length
|
|
363
|
+
* - content-type
|
|
364
|
+
* - etag
|
|
365
|
+
* - expires
|
|
366
|
+
* - from
|
|
367
|
+
* - host
|
|
368
|
+
* - if-modified-since
|
|
369
|
+
* - if-unmodified-since
|
|
370
|
+
* - last-modified
|
|
371
|
+
* - location
|
|
372
|
+
* - max-forwards
|
|
373
|
+
* - proxy-authorization
|
|
374
|
+
* - referer
|
|
375
|
+
* - retry-after
|
|
376
|
+
* - server
|
|
377
|
+
* - user-agent
|
|
378
|
+
*
|
|
379
|
+
* Also, `typia.http.headers()` function does not perform validation about the decoded
|
|
380
|
+
* value. Therefore, if you can't sure that input data is following the `T` type,
|
|
381
|
+
* it would better to call one of below functions intead.
|
|
382
|
+
*
|
|
383
|
+
* - {@link assertHeaders}
|
|
384
|
+
* - {@link isHeaders}
|
|
385
|
+
* - {@link validateHeaders}
|
|
386
|
+
*
|
|
387
|
+
* @template T Expected type of decoded value
|
|
388
|
+
* @param input Query string or URLSearchParams instance
|
|
389
|
+
* @returns Decoded headers object
|
|
390
|
+
*
|
|
391
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
392
|
+
*/
|
|
393
|
+
function headers(): never;
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Headers decoder (for express and fastify).
|
|
397
|
+
*
|
|
398
|
+
* `typia.http.headers()` is a function decoding an header instance, with automatic
|
|
399
|
+
* type casting to the expected type. When property type be defined as `boolean` or
|
|
400
|
+
* `number` type, `typia.http.headers()` will cast the value to the expected type.
|
|
401
|
+
*
|
|
402
|
+
* By the way, as HTTP headers are not enough to express complex data structures,
|
|
403
|
+
* `typia.http.headers()` function has some limitations. If target type `T` is not
|
|
404
|
+
* following those restrictions, compilation errors would be occured.
|
|
405
|
+
*
|
|
406
|
+
* 1. Type `T` must be an object type
|
|
407
|
+
* 2. Do not allow dynamic property
|
|
408
|
+
* 3. Property key must be lower case
|
|
409
|
+
* 4. Property value cannot be `null`, but `undefined` is possible
|
|
410
|
+
* 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
411
|
+
* 6. By the way, union type never be not allowed
|
|
412
|
+
* 7. Property `set-cookie` must be array type
|
|
413
|
+
* 8. Those properties cannot be array type
|
|
414
|
+
* - age
|
|
415
|
+
* - authorization
|
|
416
|
+
* - content-length
|
|
417
|
+
* - content-type
|
|
418
|
+
* - etag
|
|
419
|
+
* - expires
|
|
420
|
+
* - from
|
|
421
|
+
* - host
|
|
422
|
+
* - if-modified-since
|
|
423
|
+
* - if-unmodified-since
|
|
424
|
+
* - last-modified
|
|
425
|
+
* - location
|
|
426
|
+
* - max-forwards
|
|
427
|
+
* - proxy-authorization
|
|
428
|
+
* - referer
|
|
429
|
+
* - retry-after
|
|
430
|
+
* - server
|
|
431
|
+
* - user-agent
|
|
432
|
+
*
|
|
433
|
+
* Also, `typia.http.headers()` function does not perform validation about the decoded
|
|
434
|
+
* value. Therefore, if you can't sure that input data is following the `T` type,
|
|
435
|
+
* it would better to call one of below functions intead.
|
|
436
|
+
*
|
|
437
|
+
* - {@link assertHeaders}
|
|
438
|
+
* - {@link isHeaders}
|
|
439
|
+
* - {@link validateHeaders}
|
|
440
|
+
*
|
|
441
|
+
* @template T Expected type of decoded value
|
|
442
|
+
* @param input Query string or URLSearchParams instance
|
|
443
|
+
* @returns Decoded headers object
|
|
444
|
+
*
|
|
445
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
446
|
+
*/
|
|
447
|
+
function headers<T extends object>(
|
|
448
|
+
input: Record<string, string | string[] | undefined>,
|
|
449
|
+
): Resolved<T>;
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* @internal
|
|
453
|
+
*/
|
|
454
|
+
function headers(): never {
|
|
455
|
+
halt("headers");
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
const headersPure = /** @__PURE__ */ Object.assign<typeof headers, {}>(
|
|
459
|
+
headers,
|
|
460
|
+
/** @__PURE__ */ Namespace.http.headers(),
|
|
461
|
+
);
|
|
462
|
+
export { headersPure as headers };
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* > You must configure the generic argument `T`.
|
|
466
|
+
*
|
|
467
|
+
* Headers decoder with type assertion (for express and fastify).
|
|
468
|
+
*
|
|
469
|
+
* `typia.http.assertHeaders()` is a function decoding an header instance, with
|
|
470
|
+
* automatic type casting to the expected type. When property type be defined as
|
|
471
|
+
* `boolean` or `number` type, `typia.http.headers()` will cast the value to the
|
|
472
|
+
* expected type.
|
|
473
|
+
*
|
|
474
|
+
* Also, after decoding, `typia.http.assertHeaders()` performs type assertion to the
|
|
475
|
+
* decoded value by combining with {@link assert} function. Therefore, when the
|
|
476
|
+
* decoded value is not following the `T` type, {@link TypeGuardError} would be
|
|
477
|
+
* thrown.
|
|
478
|
+
*
|
|
479
|
+
* By the way, as HTTP headers are not enough to express complex data structures,
|
|
480
|
+
* `typia.http.headers()` function has some limitations. If target type `T` is not
|
|
481
|
+
* following those restrictions, compilation errors would be occured.
|
|
482
|
+
*
|
|
483
|
+
* 1. Type `T` must be an object type
|
|
484
|
+
* 2. Do not allow dynamic property
|
|
485
|
+
* 3. Property key must be lower case
|
|
486
|
+
* 4. Property value cannot be `null`, but `undefined` is possible
|
|
487
|
+
* 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
488
|
+
* 6. By the way, union type never be not allowed
|
|
489
|
+
* 7. Property `set-cookie` must be array type
|
|
490
|
+
* 8. Those properties cannot be array type
|
|
491
|
+
* - age
|
|
492
|
+
* - authorization
|
|
493
|
+
* - content-length
|
|
494
|
+
* - content-type
|
|
495
|
+
* - etag
|
|
496
|
+
* - expires
|
|
497
|
+
* - from
|
|
498
|
+
* - host
|
|
499
|
+
* - if-modified-since
|
|
500
|
+
* - if-unmodified-since
|
|
501
|
+
* - last-modified
|
|
502
|
+
* - location
|
|
503
|
+
* - max-forwards
|
|
504
|
+
* - proxy-authorization
|
|
505
|
+
* - referer
|
|
506
|
+
* - retry-after
|
|
507
|
+
* - server
|
|
508
|
+
* - user-agent
|
|
509
|
+
*
|
|
510
|
+
* @template T Expected type of decoded value
|
|
511
|
+
* @param input Query string or URLSearchParams instance
|
|
512
|
+
* @returns Decoded headers object
|
|
513
|
+
*
|
|
514
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
515
|
+
*/
|
|
516
|
+
function assertHeaders(): never;
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Headers decoder with type assertion (for express and fastify).
|
|
520
|
+
*
|
|
521
|
+
* `typia.http.assertHeaders()` is a function decoding an header instance, with
|
|
522
|
+
* automatic type casting to the expected type. When property type be defined as
|
|
523
|
+
* `boolean` or `number` type, `typia.http.headers()` will cast the value to the
|
|
524
|
+
* expected type.
|
|
525
|
+
*
|
|
526
|
+
* Also, after decoding, `typia.http.assertHeaders()` performs type assertion to the
|
|
527
|
+
* decoded value by combining with {@link assert} function. Therefore, when the
|
|
528
|
+
* decoded value is not following the `T` type, {@link TypeGuardError} would be
|
|
529
|
+
* thrown.
|
|
530
|
+
*
|
|
531
|
+
* By the way, as HTTP headers are not enough to express complex data structures,
|
|
532
|
+
* `typia.http.headers()` function has some limitations. If target type `T` is not
|
|
533
|
+
* following those restrictions, compilation errors would be occured.
|
|
534
|
+
*
|
|
535
|
+
* 1. Type `T` must be an object type
|
|
536
|
+
* 2. Do not allow dynamic property
|
|
537
|
+
* 3. Property key must be lower case
|
|
538
|
+
* 4. Property value cannot be `null`, but `undefined` is possible
|
|
539
|
+
* 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
540
|
+
* 6. By the way, union type never be not allowed
|
|
541
|
+
* 7. Property `set-cookie` must be array type
|
|
542
|
+
* 8. Those properties cannot be array type
|
|
543
|
+
* - age
|
|
544
|
+
* - authorization
|
|
545
|
+
* - content-length
|
|
546
|
+
* - content-type
|
|
547
|
+
* - etag
|
|
548
|
+
* - expires
|
|
549
|
+
* - from
|
|
550
|
+
* - host
|
|
551
|
+
* - if-modified-since
|
|
552
|
+
* - if-unmodified-since
|
|
553
|
+
* - last-modified
|
|
554
|
+
* - location
|
|
555
|
+
* - max-forwards
|
|
556
|
+
* - proxy-authorization
|
|
557
|
+
* - referer
|
|
558
|
+
* - retry-after
|
|
559
|
+
* - server
|
|
560
|
+
* - user-agent
|
|
561
|
+
*
|
|
562
|
+
* @template T Expected type of decoded value
|
|
563
|
+
* @param input Query string or URLSearchParams instance
|
|
564
|
+
* @returns Decoded headers object
|
|
565
|
+
*
|
|
566
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
567
|
+
*/
|
|
568
|
+
function assertHeaders<T extends object>(
|
|
569
|
+
input: Record<string, string | string[] | undefined>,
|
|
570
|
+
): Resolved<T>;
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* @internal
|
|
574
|
+
*/
|
|
575
|
+
function assertHeaders(): never {
|
|
576
|
+
halt("assertHeaders");
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
const assertHeadersPure = /** @__PURE__ */ Object.assign<
|
|
580
|
+
typeof assertHeaders,
|
|
581
|
+
{},
|
|
582
|
+
{}
|
|
583
|
+
>(
|
|
584
|
+
assertHeaders,
|
|
585
|
+
/** @__PURE__ */ Namespace.http.headers(),
|
|
586
|
+
/** @__PURE__ */ Namespace.assert("http.assertHeaders"),
|
|
587
|
+
);
|
|
588
|
+
export { assertHeadersPure as assertHeaders };
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* > You must configure the generic argument `T`.
|
|
592
|
+
*
|
|
593
|
+
* Headers decoder with type checking (for express and fastify).
|
|
594
|
+
*
|
|
595
|
+
* `typia.http.isHeaders()` is a function decoding an header instance, with
|
|
596
|
+
* automatic type casting to the expected type. When property type be defined as
|
|
597
|
+
* `boolean` or `number` type, `typia.http.headers()` will cast the value to the
|
|
598
|
+
* expected type.
|
|
599
|
+
*
|
|
600
|
+
* Also, after decoding, `typia.http.isHeaders()` performs type checking to the
|
|
601
|
+
* decoded value by combining with {@link is} function. Therefore, when the
|
|
602
|
+
* decoded value is not following the `T` type, `null` value would be returned.
|
|
603
|
+
*
|
|
604
|
+
* By the way, as HTTP headers are not enough to express complex data structures,
|
|
605
|
+
* `typia.http.headers()` function has some limitations. If target type `T` is not
|
|
606
|
+
* following those restrictions, compilation errors would be occured.
|
|
607
|
+
*
|
|
608
|
+
* 1. Type `T` must be an object type
|
|
609
|
+
* 2. Do not allow dynamic property
|
|
610
|
+
* 3. Property key must be lower case
|
|
611
|
+
* 4. Property value cannot be `null`, but `undefined` is possible
|
|
612
|
+
* 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
613
|
+
* 6. By the way, union type never be not allowed
|
|
614
|
+
* 7. Property `set-cookie` must be array type
|
|
615
|
+
* 8. Those properties cannot be array type
|
|
616
|
+
* - age
|
|
617
|
+
* - authorization
|
|
618
|
+
* - content-length
|
|
619
|
+
* - content-type
|
|
620
|
+
* - etag
|
|
621
|
+
* - expires
|
|
622
|
+
* - from
|
|
623
|
+
* - host
|
|
624
|
+
* - if-modified-since
|
|
625
|
+
* - if-unmodified-since
|
|
626
|
+
* - last-modified
|
|
627
|
+
* - location
|
|
628
|
+
* - max-forwards
|
|
629
|
+
* - proxy-authorization
|
|
630
|
+
* - referer
|
|
631
|
+
* - retry-after
|
|
632
|
+
* - server
|
|
633
|
+
* - user-agent
|
|
634
|
+
*
|
|
635
|
+
* @template T Expected type of decoded value
|
|
636
|
+
* @param input Query string or URLSearchParams instance
|
|
637
|
+
* @returns Decoded headers object or `null` value
|
|
638
|
+
*
|
|
639
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
640
|
+
*/
|
|
641
|
+
function isHeaders(): never;
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* > You must configure the generic argument `T`.
|
|
645
|
+
*
|
|
646
|
+
* Headers decoder with type checking (for express and fastify).
|
|
647
|
+
*
|
|
648
|
+
* `typia.http.isHeaders()` is a function decoding an header instance, with
|
|
649
|
+
* automatic type casting to the expected type. When property type be defined as
|
|
650
|
+
* `boolean` or `number` type, `typia.http.headers()` will cast the value to the
|
|
651
|
+
* expected type.
|
|
652
|
+
*
|
|
653
|
+
* Also, after decoding, `typia.http.isHeaders()` performs type checking to the
|
|
654
|
+
* decoded value by combining with {@link is} function. Therefore, when the
|
|
655
|
+
* decoded value is not following the `T` type, `null` value would be returned.
|
|
656
|
+
*
|
|
657
|
+
* By the way, as HTTP headers are not enough to express complex data structures,
|
|
658
|
+
* `typia.http.headers()` function has some limitations. If target type `T` is not
|
|
659
|
+
* following those restrictions, compilation errors would be occured.
|
|
660
|
+
*
|
|
661
|
+
* 1. Type `T` must be an object type
|
|
662
|
+
* 2. Do not allow dynamic property
|
|
663
|
+
* 3. Property key must be lower case
|
|
664
|
+
* 4. Property value cannot be `null`, but `undefined` is possible
|
|
665
|
+
* 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
666
|
+
* 6. By the way, union type never be not allowed
|
|
667
|
+
* 7. Property `set-cookie` must be array type
|
|
668
|
+
* 8. Those properties cannot be array type
|
|
669
|
+
* - age
|
|
670
|
+
* - authorization
|
|
671
|
+
* - content-length
|
|
672
|
+
* - content-type
|
|
673
|
+
* - etag
|
|
674
|
+
* - expires
|
|
675
|
+
* - from
|
|
676
|
+
* - host
|
|
677
|
+
* - if-modified-since
|
|
678
|
+
* - if-unmodified-since
|
|
679
|
+
* - last-modified
|
|
680
|
+
* - location
|
|
681
|
+
* - max-forwards
|
|
682
|
+
* - proxy-authorization
|
|
683
|
+
* - referer
|
|
684
|
+
* - retry-after
|
|
685
|
+
* - server
|
|
686
|
+
* - user-agent
|
|
687
|
+
*
|
|
688
|
+
* @template T Expected type of decoded value
|
|
689
|
+
* @param input Query string or URLSearchParams instance
|
|
690
|
+
* @returns Decoded headers object or `null` value
|
|
691
|
+
*
|
|
692
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
693
|
+
*/
|
|
694
|
+
function isHeaders<T extends object>(
|
|
695
|
+
input: Record<string, string | string[] | undefined>,
|
|
696
|
+
): Resolved<T> | null;
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* @internal
|
|
700
|
+
*/
|
|
701
|
+
function isHeaders(): never {
|
|
702
|
+
halt("isHeaders");
|
|
703
|
+
}
|
|
704
|
+
const isHeadersPure = /** @__PURE__ */ Object.assign<typeof isHeaders, {}, {}>(
|
|
705
|
+
isHeaders,
|
|
706
|
+
/** @__PURE__ */ Namespace.http.headers(),
|
|
707
|
+
/** @__PURE__ */ Namespace.is(),
|
|
708
|
+
);
|
|
709
|
+
export { isHeadersPure as isHeaders };
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* > You must configure the generic argument `T`.
|
|
713
|
+
*
|
|
714
|
+
* Headers decoder with type validation (for express and fastify).
|
|
715
|
+
*
|
|
716
|
+
* `typia.http.validateHeaders()` is a function decoding an header instance, with
|
|
717
|
+
* automatic type casting to the expected type. When property type be defined as
|
|
718
|
+
* `boolean` or `number` type, `typia.http.headers()` will cast the value to the
|
|
719
|
+
* expected type.
|
|
720
|
+
*
|
|
721
|
+
* Also, after decoding, `typia.http.validateHeaders()` performs type assertion to the
|
|
722
|
+
* decoded value by combining with {@link validate} function. Therefore, when the
|
|
723
|
+
* decoded value is not following the `T` type, {@link IValidation.IError} would be
|
|
724
|
+
* returned. Otherwise, {@link IValidation.ISuccess} be returned.
|
|
725
|
+
*
|
|
726
|
+
* By the way, as HTTP headers are not enough to express complex data structures,
|
|
727
|
+
* `typia.http.headers()` function has some limitations. If target type `T` is not
|
|
728
|
+
* following those restrictions, compilation errors would be occured.
|
|
729
|
+
*
|
|
730
|
+
* 1. Type `T` must be an object type
|
|
731
|
+
* 2. Do not allow dynamic property
|
|
732
|
+
* 3. Property key must be lower case
|
|
733
|
+
* 4. Property value cannot be `null`, but `undefined` is possible
|
|
734
|
+
* 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
735
|
+
* 6. By the way, union type never be not allowed
|
|
736
|
+
* 7. Property `set-cookie` must be array type
|
|
737
|
+
* 8. Those properties cannot be array type
|
|
738
|
+
* - age
|
|
739
|
+
* - authorization
|
|
740
|
+
* - content-length
|
|
741
|
+
* - content-type
|
|
742
|
+
* - etag
|
|
743
|
+
* - expires
|
|
744
|
+
* - from
|
|
745
|
+
* - host
|
|
746
|
+
* - if-modified-since
|
|
747
|
+
* - if-unmodified-since
|
|
748
|
+
* - last-modified
|
|
749
|
+
* - location
|
|
750
|
+
* - max-forwards
|
|
751
|
+
* - proxy-authorization
|
|
752
|
+
* - referer
|
|
753
|
+
* - retry-after
|
|
754
|
+
* - server
|
|
755
|
+
* - user-agent
|
|
756
|
+
*
|
|
757
|
+
* @template T Expected type of decoded value
|
|
758
|
+
* @param input Query string or URLSearchParams instance
|
|
759
|
+
* @returns Decoded headers object
|
|
760
|
+
*
|
|
761
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
762
|
+
*/
|
|
763
|
+
function validateHeaders(): never;
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* Headers decoder with type validation (for express and fastify).
|
|
767
|
+
*
|
|
768
|
+
* `typia.http.validateHeaders()` is a function decoding an header instance, with
|
|
769
|
+
* automatic type casting to the expected type. When property type be defined as
|
|
770
|
+
* `boolean` or `number` type, `typia.http.headers()` will cast the value to the
|
|
771
|
+
* expected type.
|
|
772
|
+
*
|
|
773
|
+
* Also, after decoding, `typia.http.validateHeaders()` performs type assertion to the
|
|
774
|
+
* decoded value by combining with {@link validate} function. Therefore, when the
|
|
775
|
+
* decoded value is not following the `T` type, {@link IValidation.IError} would be
|
|
776
|
+
* returned. Otherwise, {@link IValidation.ISuccess} be returned.
|
|
777
|
+
*
|
|
778
|
+
* By the way, as HTTP headers are not enough to express complex data structures,
|
|
779
|
+
* `typia.http.headers()` function has some limitations. If target type `T` is not
|
|
780
|
+
* following those restrictions, compilation errors would be occured.
|
|
781
|
+
*
|
|
782
|
+
* 1. Type `T` must be an object type
|
|
783
|
+
* 2. Do not allow dynamic property
|
|
784
|
+
* 3. Property key must be lower case
|
|
785
|
+
* 4. Property value cannot be `null`, but `undefined` is possible
|
|
786
|
+
* 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
|
|
787
|
+
* 6. By the way, union type never be not allowed
|
|
788
|
+
* 7. Property `set-cookie` must be array type
|
|
789
|
+
* 8. Those properties cannot be array type
|
|
790
|
+
* - age
|
|
791
|
+
* - authorization
|
|
792
|
+
* - content-length
|
|
793
|
+
* - content-type
|
|
794
|
+
* - etag
|
|
795
|
+
* - expires
|
|
796
|
+
* - from
|
|
797
|
+
* - host
|
|
798
|
+
* - if-modified-since
|
|
799
|
+
* - if-unmodified-since
|
|
800
|
+
* - last-modified
|
|
801
|
+
* - location
|
|
802
|
+
* - max-forwards
|
|
803
|
+
* - proxy-authorization
|
|
804
|
+
* - referer
|
|
805
|
+
* - retry-after
|
|
806
|
+
* - server
|
|
807
|
+
* - user-agent
|
|
808
|
+
*
|
|
809
|
+
* @template T Expected type of decoded value
|
|
810
|
+
* @param input Query string or URLSearchParams instance
|
|
811
|
+
* @returns Decoded headers object
|
|
812
|
+
*
|
|
813
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
814
|
+
*/
|
|
815
|
+
function validateHeaders<T extends object>(
|
|
816
|
+
input: Record<string, string | string[] | undefined>,
|
|
817
|
+
): IValidation<Resolved<T>>;
|
|
818
|
+
|
|
819
|
+
/**
|
|
820
|
+
* @internal
|
|
821
|
+
*/
|
|
822
|
+
function validateHeaders(): never {
|
|
823
|
+
halt("validateHeaders");
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
const validateHeadersPure = /** @__PURE__ */ Object.assign<
|
|
827
|
+
typeof validateHeaders,
|
|
828
|
+
{},
|
|
829
|
+
{}
|
|
830
|
+
>(
|
|
831
|
+
validateHeaders,
|
|
832
|
+
/** @__PURE__ */ Namespace.http.headers(),
|
|
833
|
+
/** @__PURE__ */ Namespace.validate(),
|
|
834
|
+
);
|
|
835
|
+
export { validateHeadersPure as validateHeaders };
|
|
836
|
+
|
|
837
|
+
/* -----------------------------------------------------------
|
|
838
|
+
PARAMETER
|
|
839
|
+
----------------------------------------------------------- */
|
|
840
|
+
/**
|
|
841
|
+
* > You must configure the generic argument `T`.
|
|
842
|
+
*
|
|
843
|
+
* URL path parameter decoder.
|
|
844
|
+
*
|
|
845
|
+
* `typia.http.parameter()` is a function decoding a path parameter, with automatic
|
|
846
|
+
* type casting to the expected type. When type `T` has beeen defined as `boolean` or
|
|
847
|
+
* `number` type, `typia.http.parameter()` will cast the value to the expected type.
|
|
848
|
+
*
|
|
849
|
+
* Also, `typia.http.parameter()` performs type assertion to the decoded value by
|
|
850
|
+
* combining with {@link assert} function. Therefore, when the decoded value is not
|
|
851
|
+
* following the `T` type, {@link TypeGuardError} would be thrown.
|
|
852
|
+
*
|
|
853
|
+
* @template T Expected type of decoded value
|
|
854
|
+
* @param input Path parameter string
|
|
855
|
+
* @returns Decoded path parameter value
|
|
856
|
+
*/
|
|
857
|
+
function parameter(): never;
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* URL path parameter decoder.
|
|
861
|
+
*
|
|
862
|
+
* `typia.http.parameter()` is a function decoding a path parameter, with automatic
|
|
863
|
+
* type casting to the expected type. When type `T` has beeen defined as `boolean` or
|
|
864
|
+
* `number` type, `typia.http.parameter()` will cast the value to the expected type.
|
|
865
|
+
*
|
|
866
|
+
* Also, `typia.http.parameter()` performs type assertion to the decoded value by
|
|
867
|
+
* combining with {@link assert} function. Therefore, when the decoded value is not
|
|
868
|
+
* following the `T` type, {@link TypeGuardError} would be thrown.
|
|
869
|
+
*
|
|
870
|
+
* @template T Expected type of decoded value
|
|
871
|
+
* @param input Path parameter string
|
|
872
|
+
* @returns Decoded path parameter value
|
|
873
|
+
*/
|
|
874
|
+
function parameter<T extends Atomic.Type | null>(input: string): Resolved<T>;
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* @internal
|
|
878
|
+
*/
|
|
879
|
+
function parameter(): never {
|
|
880
|
+
halt("parameter");
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
const parameterPure = /** @__PURE__ */ Object.assign<typeof parameter, {}, {}>(
|
|
884
|
+
parameter,
|
|
885
|
+
/** @__PURE__ */ Namespace.http.parameter(),
|
|
886
|
+
/** @__PURE__ */ Namespace.assert("http.parameter"),
|
|
887
|
+
);
|
|
888
|
+
export { parameterPure as parameter };
|
|
889
|
+
|
|
890
|
+
/* -----------------------------------------------------------
|
|
891
|
+
FACTORY FUNCTIONS
|
|
892
|
+
----------------------------------------------------------- */
|
|
893
|
+
/**
|
|
894
|
+
* Creates a reusable {@link query} function.
|
|
895
|
+
*
|
|
896
|
+
* @danger You must configure the generic argument `T`
|
|
897
|
+
* @template T The type of the query object
|
|
898
|
+
* @throws compile error
|
|
899
|
+
*
|
|
900
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
901
|
+
*/
|
|
902
|
+
function createQuery(): never;
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* Creates a reusable {@link query} function.
|
|
906
|
+
*
|
|
907
|
+
* @template T The type of the query object
|
|
908
|
+
* @returns A reusable `query` function
|
|
909
|
+
*
|
|
910
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
911
|
+
*/
|
|
912
|
+
function createQuery<T extends object>(): (
|
|
913
|
+
input: string | URLSearchParams,
|
|
914
|
+
) => T;
|
|
915
|
+
|
|
916
|
+
/**
|
|
917
|
+
* @internal
|
|
918
|
+
*/
|
|
919
|
+
function createQuery<T>(): (input: string | URLSearchParams) => T {
|
|
920
|
+
halt("createQuery");
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
const createQueryPure = /** @__PURE__ */ Object.assign<typeof createQuery, {}>(
|
|
924
|
+
createQuery,
|
|
925
|
+
/** @__PURE__ */ Namespace.http.query(),
|
|
926
|
+
);
|
|
927
|
+
export { createQueryPure as createQuery };
|
|
928
|
+
|
|
929
|
+
/**
|
|
930
|
+
* Creates a reusable {@link assertQuery} function.
|
|
931
|
+
*
|
|
932
|
+
* @danger You must configure the generic argument `T`
|
|
933
|
+
* @template T The type of the query object
|
|
934
|
+
* @throws compile error
|
|
935
|
+
*
|
|
936
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
937
|
+
*/
|
|
938
|
+
function createAssertQuery(): never;
|
|
939
|
+
|
|
940
|
+
/**
|
|
941
|
+
* Creates a reusable {@link assertQuery} function.
|
|
942
|
+
*
|
|
943
|
+
* @template T The type of the query object
|
|
944
|
+
* @returns A reusable `assertQuery` function
|
|
945
|
+
*
|
|
946
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
947
|
+
*/
|
|
948
|
+
function createAssertQuery<T extends object>(): (
|
|
949
|
+
input: string | URLSearchParams,
|
|
950
|
+
) => T;
|
|
951
|
+
|
|
952
|
+
/**
|
|
953
|
+
* @internal
|
|
954
|
+
*/
|
|
955
|
+
function createAssertQuery<T>(): (input: string | URLSearchParams) => T {
|
|
956
|
+
halt("createAssertQuery");
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
const createAssertQueryPure = /** @__PURE__ */ Object.assign<
|
|
960
|
+
typeof createAssertQuery,
|
|
961
|
+
{},
|
|
962
|
+
{}
|
|
963
|
+
>(
|
|
964
|
+
createAssertQuery,
|
|
965
|
+
/** @__PURE__ */ Namespace.http.query(),
|
|
966
|
+
/** @__PURE__ */ Namespace.assert("http.createAssertQuery"),
|
|
967
|
+
);
|
|
968
|
+
export { createAssertQueryPure as createAssertQuery };
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* Creates a reusable {@link isQuery} function.
|
|
972
|
+
*
|
|
973
|
+
* @danger You must configure the generic argument `T`
|
|
974
|
+
* @template T The type of the query object
|
|
975
|
+
* @throws compile error
|
|
976
|
+
*
|
|
977
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
978
|
+
*/
|
|
979
|
+
function createIsQuery(): never;
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* Creates a reusable {@link isQuery} function.
|
|
983
|
+
*
|
|
984
|
+
* @template T The type of the query object
|
|
985
|
+
* @returns A reusable `isQuery` function
|
|
986
|
+
*
|
|
987
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
988
|
+
*/
|
|
989
|
+
function createIsQuery<T extends object>(): (
|
|
990
|
+
input: string | URLSearchParams,
|
|
991
|
+
) => T | null;
|
|
992
|
+
|
|
993
|
+
/**
|
|
994
|
+
* @internal
|
|
995
|
+
*/
|
|
996
|
+
function createIsQuery<T>(): (input: string | URLSearchParams) => T | null {
|
|
997
|
+
halt("createIsQuery");
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
const createIsQueryPure = /** @__PURE__ */ Object.assign<
|
|
1001
|
+
typeof createIsQuery,
|
|
1002
|
+
{},
|
|
1003
|
+
{}
|
|
1004
|
+
>(
|
|
1005
|
+
createIsQuery,
|
|
1006
|
+
/** @__PURE__ */ Namespace.http.query(),
|
|
1007
|
+
/** @__PURE__ */ Namespace.is(),
|
|
1008
|
+
);
|
|
1009
|
+
export { createIsQueryPure as createIsQuery };
|
|
1010
|
+
|
|
1011
|
+
/**
|
|
1012
|
+
* Creates a reusable {@link validateQuery} function.
|
|
1013
|
+
*
|
|
1014
|
+
* @danger You must configure the generic argument `T`
|
|
1015
|
+
* @template T The type of the query object
|
|
1016
|
+
* @throws compile error
|
|
1017
|
+
*
|
|
1018
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
1019
|
+
*/
|
|
1020
|
+
function createValidateQuery(): never;
|
|
1021
|
+
|
|
1022
|
+
/**
|
|
1023
|
+
* Creates a reusable {@link validateQuery} function.
|
|
1024
|
+
*
|
|
1025
|
+
* @template T The type of the query object
|
|
1026
|
+
* @returns A reusable `validateQuery` function
|
|
1027
|
+
*
|
|
1028
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
1029
|
+
*/
|
|
1030
|
+
function createValidateQuery<T extends object>(): (
|
|
1031
|
+
input: string | URLSearchParams,
|
|
1032
|
+
) => IValidation<Resolved<T>>;
|
|
1033
|
+
|
|
1034
|
+
/**
|
|
1035
|
+
* @internal
|
|
1036
|
+
*/
|
|
1037
|
+
function createValidateQuery<T>(): (
|
|
1038
|
+
input: string | URLSearchParams,
|
|
1039
|
+
) => IValidation<Resolved<T>> {
|
|
1040
|
+
halt("createValidateQuery");
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
const createValidateQueryPure = /** @__PURE__ */ Object.assign<
|
|
1044
|
+
typeof createValidateQuery,
|
|
1045
|
+
{},
|
|
1046
|
+
{}
|
|
1047
|
+
>(
|
|
1048
|
+
createValidateQuery,
|
|
1049
|
+
/** @__PURE__ */ Namespace.http.query(),
|
|
1050
|
+
/** @__PURE__ */ Namespace.validate(),
|
|
1051
|
+
);
|
|
1052
|
+
export { createValidateQueryPure as createValidateQuery };
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* Creates a reusable {@link headers} function.
|
|
1056
|
+
*
|
|
1057
|
+
* @danger You must configure the generic argument `T`
|
|
1058
|
+
* @template T The type of the headers object
|
|
1059
|
+
* @throws compile error
|
|
1060
|
+
*
|
|
1061
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
1062
|
+
*/
|
|
1063
|
+
function createHeaders(): never;
|
|
1064
|
+
|
|
1065
|
+
/**
|
|
1066
|
+
* Creates a reusable {@link headers} function.
|
|
1067
|
+
*
|
|
1068
|
+
* @template T The type of the headers object
|
|
1069
|
+
* @returns A reusable `headers` function
|
|
1070
|
+
*
|
|
1071
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
1072
|
+
*/
|
|
1073
|
+
function createHeaders<T extends object>(): (
|
|
1074
|
+
input: Record<string, string | string[] | undefined>,
|
|
1075
|
+
) => T;
|
|
1076
|
+
|
|
1077
|
+
/**
|
|
1078
|
+
* @internal
|
|
1079
|
+
*/
|
|
1080
|
+
function createHeaders<T>(): (
|
|
1081
|
+
input: Record<string, string | string[] | undefined>,
|
|
1082
|
+
) => T {
|
|
1083
|
+
halt("createHeaders");
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
const createHeadersPure = /** @__PURE__ */ Object.assign<
|
|
1087
|
+
typeof createHeaders,
|
|
1088
|
+
{}
|
|
1089
|
+
>(createHeaders, /** @__PURE__ */ Namespace.http.headers());
|
|
1090
|
+
export { createHeadersPure as createHeaders };
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
* Creates a reusable {@link assertHeaders} function.
|
|
1094
|
+
*
|
|
1095
|
+
* @danger You must configure the generic argument `T`
|
|
1096
|
+
* @template T The type of the headers object
|
|
1097
|
+
* @throws compile error
|
|
1098
|
+
*
|
|
1099
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
1100
|
+
*/
|
|
1101
|
+
function createAssertHeaders(): never;
|
|
1102
|
+
|
|
1103
|
+
/**
|
|
1104
|
+
* Creates a reusable {@link assertHeaders} function.
|
|
1105
|
+
*
|
|
1106
|
+
* @template T The type of the headers object
|
|
1107
|
+
* @returns A reusable `assertHeaders` function
|
|
1108
|
+
*
|
|
1109
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
1110
|
+
*/
|
|
1111
|
+
function createAssertHeaders<T extends object>(): (
|
|
1112
|
+
input: Record<string, string | string[] | undefined>,
|
|
1113
|
+
) => T;
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* @internal
|
|
1117
|
+
*/
|
|
1118
|
+
function createAssertHeaders<T>(): (
|
|
1119
|
+
input: Record<string, string | string[] | undefined>,
|
|
1120
|
+
) => T {
|
|
1121
|
+
halt("createAssertHeaders");
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
const createAssertHeadersPure = /** @__PURE__ */ Object.assign<
|
|
1125
|
+
typeof createAssertHeaders,
|
|
1126
|
+
{},
|
|
1127
|
+
{}
|
|
1128
|
+
>(
|
|
1129
|
+
createAssertHeaders,
|
|
1130
|
+
/** @__PURE__ */ Namespace.http.headers(),
|
|
1131
|
+
/** @__PURE__ */ Namespace.assert("http.createAssertHeaders"),
|
|
1132
|
+
);
|
|
1133
|
+
export { createAssertHeadersPure as createAssertHeaders };
|
|
1134
|
+
|
|
1135
|
+
/**
|
|
1136
|
+
* Creates a reusable {@link isHeaders} function.
|
|
1137
|
+
*
|
|
1138
|
+
* @danger You must configure the generic argument `T`
|
|
1139
|
+
* @template T The type of the headers object
|
|
1140
|
+
* @throws compile error
|
|
1141
|
+
*
|
|
1142
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
1143
|
+
*/
|
|
1144
|
+
function createIsHeaders(): never;
|
|
1145
|
+
|
|
1146
|
+
/**
|
|
1147
|
+
* Creates a reusable {@link isHeaders} function.
|
|
1148
|
+
*
|
|
1149
|
+
* @template T The type of the headers object
|
|
1150
|
+
* @returns A reusable `isHeaders` function
|
|
1151
|
+
*
|
|
1152
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
1153
|
+
*/
|
|
1154
|
+
function createIsHeaders<T extends object>(): (
|
|
1155
|
+
input: Record<string, string | string[] | undefined>,
|
|
1156
|
+
) => T | null;
|
|
1157
|
+
|
|
1158
|
+
/**
|
|
1159
|
+
* @internal
|
|
1160
|
+
*/
|
|
1161
|
+
function createIsHeaders<T>(): (
|
|
1162
|
+
input: Record<string, string | string[] | undefined>,
|
|
1163
|
+
) => T | null {
|
|
1164
|
+
halt("createIsHeaders");
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
const createIsHeadersPure = /** @__PURE__ */ Object.assign<
|
|
1168
|
+
typeof createIsHeaders,
|
|
1169
|
+
{},
|
|
1170
|
+
{}
|
|
1171
|
+
>(
|
|
1172
|
+
createIsHeaders,
|
|
1173
|
+
/** @__PURE__ */ Namespace.http.headers(),
|
|
1174
|
+
/** @__PURE__ */ Namespace.is(),
|
|
1175
|
+
);
|
|
1176
|
+
export { createIsHeadersPure as createIsHeaders };
|
|
1177
|
+
|
|
1178
|
+
/**
|
|
1179
|
+
* Creates a reusable {@link validateHeaders} function.
|
|
1180
|
+
*
|
|
1181
|
+
* @danger You must configure the generic argument `T`
|
|
1182
|
+
* @template T The type of the headers object
|
|
1183
|
+
* @throws compile error
|
|
1184
|
+
*
|
|
1185
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
1186
|
+
*/
|
|
1187
|
+
function createValidateHeaders(): never;
|
|
1188
|
+
|
|
1189
|
+
/**
|
|
1190
|
+
* Creates a reusable {@link validateHeaders} function.
|
|
1191
|
+
*
|
|
1192
|
+
* @template T The type of the headers object
|
|
1193
|
+
* @returns A reusable `validateHeaders` function
|
|
1194
|
+
*
|
|
1195
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
1196
|
+
*/
|
|
1197
|
+
function createValidateHeaders<T extends object>(): (
|
|
1198
|
+
input: Record<string, string | string[] | undefined>,
|
|
1199
|
+
) => IValidation<Resolved<T>>;
|
|
1200
|
+
|
|
1201
|
+
/**
|
|
1202
|
+
* @internal
|
|
1203
|
+
*/
|
|
1204
|
+
function createValidateHeaders<T>(): (
|
|
1205
|
+
input: Record<string, string | string[] | undefined>,
|
|
1206
|
+
) => IValidation<Resolved<T>> {
|
|
1207
|
+
halt("createValidateHeaders");
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
const createValidateHeadersPure = /** @__PURE__ */ Object.assign<
|
|
1211
|
+
typeof createValidateHeaders,
|
|
1212
|
+
{},
|
|
1213
|
+
{}
|
|
1214
|
+
>(
|
|
1215
|
+
createValidateHeaders,
|
|
1216
|
+
/** @__PURE__ */ Namespace.http.headers(),
|
|
1217
|
+
/** @__PURE__ */ Namespace.validate(),
|
|
1218
|
+
);
|
|
1219
|
+
export { createValidateHeadersPure as createValidateHeaders };
|
|
1220
|
+
|
|
1221
|
+
/**
|
|
1222
|
+
* Creates a reusable {@link parameter} function.
|
|
1223
|
+
*
|
|
1224
|
+
* @danger You must configure the generic argument `T`
|
|
1225
|
+
* @template T The type of the parameter value
|
|
1226
|
+
* @throws compile error
|
|
1227
|
+
*
|
|
1228
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
1229
|
+
*/
|
|
1230
|
+
function createParameter(): never;
|
|
1231
|
+
|
|
1232
|
+
/**
|
|
1233
|
+
* Creates a reusable {@link parameter} function.
|
|
1234
|
+
*
|
|
1235
|
+
* @template T The type of the parameter value
|
|
1236
|
+
* @returns A reusable `parameter` function
|
|
1237
|
+
*
|
|
1238
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
1239
|
+
*/
|
|
1240
|
+
function createParameter<T extends Atomic.Type | null>(): (input: string) => T;
|
|
1241
|
+
|
|
1242
|
+
/**
|
|
1243
|
+
* @internal
|
|
1244
|
+
*/
|
|
1245
|
+
function createParameter<T extends Atomic.Type | null>(): (input: string) => T {
|
|
1246
|
+
halt("createParameter");
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
const createParameterPure = /** @__PURE__ */ Object.assign<
|
|
1250
|
+
typeof createParameter,
|
|
1251
|
+
{},
|
|
1252
|
+
{}
|
|
1253
|
+
>(
|
|
1254
|
+
createParameter,
|
|
1255
|
+
/** @__PURE__ */ Namespace.http.parameter(),
|
|
1256
|
+
/** @__PURE__ */ Namespace.assert("http.createParameter"),
|
|
1257
|
+
);
|
|
1258
|
+
export { createParameterPure as createParameter };
|
|
1259
|
+
|
|
1260
|
+
/**
|
|
1261
|
+
* @internal
|
|
1262
|
+
*/
|
|
1263
|
+
function halt(name: string): never {
|
|
1264
|
+
throw new Error(
|
|
1265
|
+
`Error on typia.http.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
|
|
1266
|
+
);
|
|
1267
|
+
}
|