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