typia 9.7.1 → 9.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AssertionGuard.d.mts +27 -25
- package/lib/AssertionGuard.d.ts +27 -25
- package/lib/CamelCase.d.mts +1 -1
- package/lib/CamelCase.d.ts +1 -1
- package/lib/IRandomGenerator.d.mts +44 -42
- package/lib/IRandomGenerator.d.ts +44 -42
- package/lib/IReadableURLSearchParams.d.mts +2 -2
- package/lib/IReadableURLSearchParams.d.ts +2 -2
- package/lib/PascalCase.d.mts +1 -1
- package/lib/PascalCase.d.ts +1 -1
- package/lib/Primitive.d.mts +20 -22
- package/lib/Primitive.d.ts +20 -22
- package/lib/Resolved.d.mts +16 -18
- package/lib/Resolved.d.ts +16 -18
- package/lib/SnakeCase.d.mts +3 -2
- package/lib/SnakeCase.d.ts +3 -2
- package/lib/TypeGuardError.d.mts +88 -61
- package/lib/TypeGuardError.d.ts +88 -61
- package/lib/TypeGuardError.js +40 -29
- package/lib/TypeGuardError.js.map +1 -1
- package/lib/TypeGuardError.mjs +70 -48
- package/lib/factories/MetadataCollection.js +4 -12
- package/lib/factories/MetadataCollection.js.map +1 -1
- package/lib/factories/MetadataCollection.mjs +4 -12
- package/lib/factories/MetadataCommentTagFactory.js +5 -15
- package/lib/factories/MetadataCommentTagFactory.js.map +1 -1
- package/lib/factories/MetadataCommentTagFactory.mjs +5 -15
- package/lib/factories/MetadataFactory.js +1 -3
- package/lib/factories/MetadataFactory.js.map +1 -1
- package/lib/factories/MetadataFactory.mjs +1 -3
- package/lib/factories/ProtobufFactory.js +1 -3
- package/lib/factories/ProtobufFactory.js.map +1 -1
- package/lib/factories/ProtobufFactory.mjs +1 -3
- package/lib/functional.d.mts +196 -195
- package/lib/functional.d.ts +196 -195
- package/lib/functional.js +18 -54
- package/lib/functional.js.map +1 -1
- package/lib/functional.mjs +18 -54
- package/lib/http.d.mts +303 -319
- package/lib/http.d.ts +303 -319
- package/lib/http.js +26 -78
- package/lib/http.js.map +1 -1
- package/lib/http.mjs +26 -78
- package/lib/internal/_ProtobufReader.d.mts +3 -9
- package/lib/internal/_ProtobufReader.d.ts +3 -9
- package/lib/internal/_ProtobufReader.js.map +1 -1
- package/lib/internal/_ProtobufReader.mjs +3 -9
- package/lib/internal/_ProtobufSizer.d.mts +4 -12
- package/lib/internal/_ProtobufSizer.d.ts +4 -12
- package/lib/internal/_ProtobufSizer.js.map +1 -1
- package/lib/internal/_ProtobufSizer.mjs +4 -12
- package/lib/internal/_ProtobufWriter.d.mts +5 -15
- package/lib/internal/_ProtobufWriter.d.ts +5 -15
- package/lib/internal/_ProtobufWriter.js.map +1 -1
- package/lib/internal/_ProtobufWriter.mjs +5 -15
- package/lib/internal/_jsonStringifyString.d.mts +4 -4
- package/lib/internal/_jsonStringifyString.d.ts +4 -4
- package/lib/internal/_jsonStringifyString.js +4 -4
- package/lib/internal/_jsonStringifyString.mjs +4 -4
- package/lib/json.d.mts +174 -195
- package/lib/json.d.ts +174 -195
- package/lib/json.js +16 -48
- package/lib/json.js.map +1 -1
- package/lib/json.mjs +16 -48
- package/lib/llm.d.mts +275 -192
- package/lib/llm.d.ts +275 -192
- package/lib/llm.js +4 -12
- package/lib/llm.js.map +1 -1
- package/lib/llm.mjs +4 -12
- package/lib/misc.d.mts +149 -172
- package/lib/misc.d.ts +149 -172
- package/lib/misc.js +17 -51
- package/lib/misc.js.map +1 -1
- package/lib/misc.mjs +17 -51
- package/lib/module.d.mts +263 -275
- package/lib/module.d.ts +263 -275
- package/lib/module.js +18 -54
- package/lib/module.js.map +1 -1
- package/lib/module.mjs +18 -54
- package/lib/notations.d.mts +153 -174
- package/lib/notations.d.ts +153 -174
- package/lib/notations.js +24 -72
- package/lib/notations.js.map +1 -1
- package/lib/notations.mjs +24 -72
- package/lib/programmers/FeatureProgrammer.d.mts +19 -41
- package/lib/programmers/FeatureProgrammer.d.ts +19 -41
- package/lib/programmers/FeatureProgrammer.js.map +1 -1
- package/lib/programmers/ImportProgrammer.js +3 -9
- package/lib/programmers/ImportProgrammer.js.map +1 -1
- package/lib/programmers/ImportProgrammer.mjs +3 -9
- package/lib/programmers/RandomProgrammer.js +6 -0
- package/lib/programmers/RandomProgrammer.js.map +1 -1
- package/lib/programmers/RandomProgrammer.mjs +6 -0
- package/lib/programmers/helpers/ProtobufWire.d.mts +13 -13
- package/lib/programmers/helpers/ProtobufWire.d.ts +13 -13
- package/lib/programmers/internal/check_array_length.js +2 -6
- package/lib/programmers/internal/check_array_length.js.map +1 -1
- package/lib/programmers/internal/check_array_length.mjs +2 -6
- package/lib/programmers/internal/check_bigint.js +2 -6
- package/lib/programmers/internal/check_bigint.js.map +1 -1
- package/lib/programmers/internal/check_bigint.mjs +2 -6
- package/lib/programmers/internal/check_dynamic_key.js +2 -6
- package/lib/programmers/internal/check_dynamic_key.js.map +1 -1
- package/lib/programmers/internal/check_dynamic_key.mjs +2 -6
- package/lib/programmers/internal/check_dynamic_properties.js +3 -9
- package/lib/programmers/internal/check_dynamic_properties.js.map +1 -1
- package/lib/programmers/internal/check_dynamic_properties.mjs +3 -9
- package/lib/programmers/internal/check_everything.js +1 -3
- package/lib/programmers/internal/check_everything.js.map +1 -1
- package/lib/programmers/internal/check_everything.mjs +1 -3
- package/lib/programmers/internal/check_native.js +2 -6
- package/lib/programmers/internal/check_native.js.map +1 -1
- package/lib/programmers/internal/check_native.mjs +2 -6
- package/lib/programmers/internal/check_number.js +2 -6
- package/lib/programmers/internal/check_number.js.map +1 -1
- package/lib/programmers/internal/check_number.mjs +2 -6
- package/lib/programmers/internal/check_object.js +2 -6
- package/lib/programmers/internal/check_object.js.map +1 -1
- package/lib/programmers/internal/check_object.mjs +2 -6
- package/lib/programmers/internal/check_string.js +2 -6
- package/lib/programmers/internal/check_string.js.map +1 -1
- package/lib/programmers/internal/check_string.mjs +2 -6
- package/lib/programmers/internal/check_template.js +1 -3
- package/lib/programmers/internal/check_template.js.map +1 -1
- package/lib/programmers/internal/check_template.mjs +1 -3
- package/lib/programmers/internal/check_union_array_like.js +1 -3
- package/lib/programmers/internal/check_union_array_like.js.map +1 -1
- package/lib/programmers/internal/check_union_array_like.mjs +1 -3
- package/lib/programmers/internal/decode_union_object.js +2 -6
- package/lib/programmers/internal/decode_union_object.js.map +1 -1
- package/lib/programmers/internal/decode_union_object.mjs +2 -6
- package/lib/programmers/internal/feature_object_entries.js +1 -3
- package/lib/programmers/internal/feature_object_entries.js.map +1 -1
- package/lib/programmers/internal/feature_object_entries.mjs +1 -3
- package/lib/programmers/internal/json_schema_escaped.js +2 -6
- package/lib/programmers/internal/json_schema_escaped.js.map +1 -1
- package/lib/programmers/internal/json_schema_escaped.mjs +2 -6
- package/lib/programmers/internal/json_schema_object.js +3 -9
- package/lib/programmers/internal/json_schema_object.js.map +1 -1
- package/lib/programmers/internal/json_schema_object.mjs +3 -9
- package/lib/programmers/internal/metadata_to_pattern.js +1 -3
- package/lib/programmers/internal/metadata_to_pattern.js.map +1 -1
- package/lib/programmers/internal/metadata_to_pattern.mjs +1 -3
- package/lib/programmers/internal/postfix_of_tuple.js +1 -3
- package/lib/programmers/internal/postfix_of_tuple.js.map +1 -1
- package/lib/programmers/internal/postfix_of_tuple.mjs +1 -3
- package/lib/programmers/internal/prune_object_properties.js +1 -3
- package/lib/programmers/internal/prune_object_properties.js.map +1 -1
- package/lib/programmers/internal/prune_object_properties.mjs +1 -3
- package/lib/programmers/internal/stringify_dynamic_properties.js +2 -6
- package/lib/programmers/internal/stringify_dynamic_properties.js.map +1 -1
- package/lib/programmers/internal/stringify_dynamic_properties.mjs +2 -6
- package/lib/programmers/internal/stringify_native.js +1 -3
- package/lib/programmers/internal/stringify_native.js.map +1 -1
- package/lib/programmers/internal/stringify_native.mjs +1 -3
- package/lib/programmers/internal/stringify_regular_properties.js +2 -6
- package/lib/programmers/internal/stringify_regular_properties.js.map +1 -1
- package/lib/programmers/internal/stringify_regular_properties.mjs +2 -6
- package/lib/programmers/internal/template_to_pattern.js +1 -3
- package/lib/programmers/internal/template_to_pattern.js.map +1 -1
- package/lib/programmers/internal/template_to_pattern.mjs +1 -3
- package/lib/programmers/internal/wrap_metadata_rest_tuple.js +1 -3
- package/lib/programmers/internal/wrap_metadata_rest_tuple.js.map +1 -1
- package/lib/programmers/internal/wrap_metadata_rest_tuple.mjs +1 -3
- package/lib/programmers/json/JsonStringifyProgrammer.js +2 -2
- package/lib/programmers/json/JsonStringifyProgrammer.js.map +1 -1
- package/lib/programmers/json/JsonStringifyProgrammer.mjs +2 -2
- package/lib/protobuf.d.mts +290 -297
- package/lib/protobuf.d.ts +290 -297
- package/lib/protobuf.js +17 -51
- package/lib/protobuf.js.map +1 -1
- package/lib/protobuf.mjs +17 -51
- package/lib/reflect.d.mts +2 -4
- package/lib/reflect.d.ts +2 -4
- package/lib/reflect.js +1 -3
- package/lib/reflect.js.map +1 -1
- package/lib/reflect.mjs +1 -3
- package/lib/schemas/json/IJsonApplication.d.mts +4 -4
- package/lib/schemas/json/IJsonApplication.d.ts +4 -4
- package/lib/schemas/json/IJsonSchemaCollection.d.mts +73 -56
- package/lib/schemas/json/IJsonSchemaCollection.d.ts +73 -56
- package/lib/schemas/json/IJsonSchemaUnit.d.mts +83 -70
- package/lib/schemas/json/IJsonSchemaUnit.d.ts +83 -70
- package/lib/schemas/metadata/Metadata.d.mts +1 -3
- package/lib/schemas/metadata/Metadata.d.ts +1 -3
- package/lib/schemas/metadata/Metadata.js +9 -27
- package/lib/schemas/metadata/Metadata.js.map +1 -1
- package/lib/schemas/metadata/Metadata.mjs +9 -27
- package/lib/schemas/metadata/MetadataAliasType.d.mts +1 -3
- package/lib/schemas/metadata/MetadataAliasType.d.ts +1 -3
- package/lib/schemas/metadata/MetadataAliasType.js +3 -9
- package/lib/schemas/metadata/MetadataAliasType.js.map +1 -1
- package/lib/schemas/metadata/MetadataAliasType.mjs +3 -9
- package/lib/schemas/metadata/MetadataApplication.d.mts +1 -3
- package/lib/schemas/metadata/MetadataApplication.d.ts +1 -3
- package/lib/schemas/metadata/MetadataApplication.js +2 -6
- package/lib/schemas/metadata/MetadataApplication.js.map +1 -1
- package/lib/schemas/metadata/MetadataApplication.mjs +2 -6
- package/lib/schemas/metadata/MetadataArray.d.mts +1 -3
- package/lib/schemas/metadata/MetadataArray.d.ts +1 -3
- package/lib/schemas/metadata/MetadataArray.js +1 -3
- package/lib/schemas/metadata/MetadataArray.js.map +1 -1
- package/lib/schemas/metadata/MetadataArray.mjs +1 -3
- package/lib/schemas/metadata/MetadataArrayType.d.mts +1 -3
- package/lib/schemas/metadata/MetadataArrayType.d.ts +1 -3
- package/lib/schemas/metadata/MetadataArrayType.js +3 -9
- package/lib/schemas/metadata/MetadataArrayType.js.map +1 -1
- package/lib/schemas/metadata/MetadataArrayType.mjs +3 -9
- package/lib/schemas/metadata/MetadataAtomic.js +1 -3
- package/lib/schemas/metadata/MetadataAtomic.js.map +1 -1
- package/lib/schemas/metadata/MetadataAtomic.mjs +1 -3
- package/lib/schemas/metadata/MetadataEscaped.d.mts +1 -3
- package/lib/schemas/metadata/MetadataEscaped.d.ts +1 -3
- package/lib/schemas/metadata/MetadataEscaped.js +3 -9
- package/lib/schemas/metadata/MetadataEscaped.js.map +1 -1
- package/lib/schemas/metadata/MetadataEscaped.mjs +3 -9
- package/lib/schemas/metadata/MetadataFunction.d.mts +1 -3
- package/lib/schemas/metadata/MetadataFunction.d.ts +1 -3
- package/lib/schemas/metadata/MetadataFunction.js +2 -6
- package/lib/schemas/metadata/MetadataFunction.js.map +1 -1
- package/lib/schemas/metadata/MetadataFunction.mjs +2 -6
- package/lib/schemas/metadata/MetadataObject.d.mts +1 -3
- package/lib/schemas/metadata/MetadataObject.d.ts +1 -3
- package/lib/schemas/metadata/MetadataObject.js +1 -3
- package/lib/schemas/metadata/MetadataObject.js.map +1 -1
- package/lib/schemas/metadata/MetadataObject.mjs +1 -3
- package/lib/schemas/metadata/MetadataObjectType.d.mts +1 -3
- package/lib/schemas/metadata/MetadataObjectType.d.ts +1 -3
- package/lib/schemas/metadata/MetadataObjectType.js +5 -15
- package/lib/schemas/metadata/MetadataObjectType.js.map +1 -1
- package/lib/schemas/metadata/MetadataObjectType.mjs +6 -18
- package/lib/schemas/metadata/MetadataParameter.js +1 -3
- package/lib/schemas/metadata/MetadataParameter.js.map +1 -1
- package/lib/schemas/metadata/MetadataParameter.mjs +1 -3
- package/lib/schemas/metadata/MetadataProperty.d.mts +1 -3
- package/lib/schemas/metadata/MetadataProperty.d.ts +1 -3
- package/lib/schemas/metadata/MetadataProperty.js +3 -9
- package/lib/schemas/metadata/MetadataProperty.js.map +1 -1
- package/lib/schemas/metadata/MetadataProperty.mjs +3 -9
- package/lib/schemas/metadata/MetadataTemplate.js +1 -3
- package/lib/schemas/metadata/MetadataTemplate.js.map +1 -1
- package/lib/schemas/metadata/MetadataTemplate.mjs +1 -3
- package/lib/schemas/metadata/MetadataTuple.d.mts +1 -3
- package/lib/schemas/metadata/MetadataTuple.d.ts +1 -3
- package/lib/schemas/metadata/MetadataTuple.js +2 -6
- package/lib/schemas/metadata/MetadataTuple.js.map +1 -1
- package/lib/schemas/metadata/MetadataTuple.mjs +2 -6
- package/lib/schemas/metadata/MetadataTupleType.js +2 -6
- package/lib/schemas/metadata/MetadataTupleType.js.map +1 -1
- package/lib/schemas/metadata/MetadataTupleType.mjs +3 -9
- package/lib/tags/Constant.d.mts +16 -16
- package/lib/tags/Constant.d.ts +16 -16
- package/lib/tags/ContentMediaType.d.mts +7 -7
- package/lib/tags/ContentMediaType.d.ts +7 -7
- package/lib/tags/Default.d.mts +19 -19
- package/lib/tags/Default.d.ts +19 -19
- package/lib/tags/Example.d.mts +18 -18
- package/lib/tags/Example.d.ts +18 -18
- package/lib/tags/Examples.d.mts +23 -23
- package/lib/tags/Examples.d.ts +23 -23
- package/lib/tags/ExclusiveMaximum.d.mts +8 -5
- package/lib/tags/ExclusiveMaximum.d.ts +8 -5
- package/lib/tags/ExclusiveMinimum.d.mts +8 -5
- package/lib/tags/ExclusiveMinimum.d.ts +8 -5
- package/lib/tags/Format.d.mts +12 -8
- package/lib/tags/Format.d.ts +12 -8
- package/lib/tags/JsonSchemaPlugin.d.mts +20 -18
- package/lib/tags/JsonSchemaPlugin.d.ts +20 -18
- package/lib/tags/MaxItems.d.mts +9 -9
- package/lib/tags/MaxItems.d.ts +9 -9
- package/lib/tags/MaxLength.d.mts +6 -5
- package/lib/tags/MaxLength.d.ts +6 -5
- package/lib/tags/Maximum.d.mts +9 -7
- package/lib/tags/Maximum.d.ts +9 -7
- package/lib/tags/MinItems.d.mts +9 -9
- package/lib/tags/MinItems.d.ts +9 -9
- package/lib/tags/MinLength.d.mts +6 -5
- package/lib/tags/MinLength.d.ts +6 -5
- package/lib/tags/Minimum.d.mts +9 -7
- package/lib/tags/Minimum.d.ts +9 -7
- package/lib/tags/MultipleOf.d.mts +10 -7
- package/lib/tags/MultipleOf.d.ts +10 -7
- package/lib/tags/Pattern.d.mts +7 -4
- package/lib/tags/Pattern.d.ts +7 -4
- package/lib/tags/Sequence.d.mts +19 -17
- package/lib/tags/Sequence.d.ts +19 -17
- package/lib/tags/TagBase.d.mts +21 -28
- package/lib/tags/TagBase.d.ts +21 -28
- package/lib/tags/Type.d.mts +12 -11
- package/lib/tags/Type.d.ts +12 -11
- package/lib/tags/UniqueItems.d.mts +10 -9
- package/lib/tags/UniqueItems.d.ts +10 -9
- package/lib/tags/internal/FormatCheatSheet.d.mts +1 -3
- package/lib/tags/internal/FormatCheatSheet.d.ts +1 -3
- package/lib/tags/internal/FormatCheatSheet.js +1 -3
- package/lib/tags/internal/FormatCheatSheet.js.map +1 -1
- package/lib/tags/internal/FormatCheatSheet.mjs +1 -3
- package/lib/transformers/ITransformOptions.d.mts +27 -19
- package/lib/transformers/ITransformOptions.d.ts +27 -19
- package/lib/transformers/ImportTransformer.js +5 -10
- package/lib/transformers/ImportTransformer.js.map +1 -1
- package/lib/transformers/ImportTransformer.mjs +5 -10
- package/lib/transformers/NoTransformConfigurationError.js +1 -3
- package/lib/transformers/NoTransformConfigurationError.js.map +1 -1
- package/lib/transformers/NoTransformConfigurationError.mjs +1 -3
- package/lib/transformers/features/llm/LlmApplicationTransformer.js +1 -3
- package/lib/transformers/features/llm/LlmApplicationTransformer.js.map +1 -1
- package/lib/transformers/features/llm/LlmApplicationTransformer.mjs +1 -3
- package/lib/typings/Equal.d.mts +6 -6
- package/lib/typings/Equal.d.ts +6 -6
- package/package.json +2 -1
- package/src/AssertionGuard.ts +27 -25
- package/src/CamelCase.ts +1 -1
- package/src/IRandomGenerator.ts +44 -42
- package/src/IReadableURLSearchParams.ts +2 -2
- package/src/PascalCase.ts +1 -1
- package/src/Primitive.ts +20 -22
- package/src/Resolved.ts +16 -18
- package/src/SnakeCase.ts +3 -2
- package/src/TypeGuardError.ts +101 -64
- package/src/factories/MetadataCollection.ts +4 -12
- package/src/factories/MetadataCommentTagFactory.ts +8 -24
- package/src/factories/MetadataFactory.ts +1 -3
- package/src/factories/ProtobufFactory.ts +1 -3
- package/src/functional.ts +214 -249
- package/src/http.ts +329 -397
- package/src/internal/_ProtobufReader.ts +3 -9
- package/src/internal/_ProtobufSizer.ts +4 -12
- package/src/internal/_ProtobufWriter.ts +5 -15
- package/src/internal/_jsonStringifyString.ts +4 -4
- package/src/json.ts +190 -243
- package/src/llm.ts +279 -204
- package/src/misc.ts +166 -223
- package/src/module.ts +281 -329
- package/src/notations.ts +177 -246
- package/src/programmers/FeatureProgrammer.ts +19 -41
- package/src/programmers/ImportProgrammer.ts +3 -9
- package/src/programmers/RandomProgrammer.ts +6 -1
- package/src/programmers/helpers/ProtobufWire.ts +13 -13
- package/src/programmers/internal/check_array_length.ts +2 -6
- package/src/programmers/internal/check_bigint.ts +2 -6
- package/src/programmers/internal/check_dynamic_key.ts +2 -6
- package/src/programmers/internal/check_dynamic_properties.ts +3 -9
- package/src/programmers/internal/check_everything.ts +1 -3
- package/src/programmers/internal/check_native.ts +2 -6
- package/src/programmers/internal/check_number.ts +2 -6
- package/src/programmers/internal/check_object.ts +3 -9
- package/src/programmers/internal/check_string.ts +2 -6
- package/src/programmers/internal/check_template.ts +1 -3
- package/src/programmers/internal/check_union_array_like.ts +2 -6
- package/src/programmers/internal/decode_union_object.ts +3 -9
- package/src/programmers/internal/feature_object_entries.ts +1 -3
- package/src/programmers/internal/json_schema_escaped.ts +2 -6
- package/src/programmers/internal/json_schema_object.ts +4 -12
- package/src/programmers/internal/metadata_to_pattern.ts +1 -3
- package/src/programmers/internal/postfix_of_tuple.ts +1 -3
- package/src/programmers/internal/prune_object_properties.ts +1 -3
- package/src/programmers/internal/stringify_dynamic_properties.ts +2 -6
- package/src/programmers/internal/stringify_native.ts +1 -3
- package/src/programmers/internal/stringify_regular_properties.ts +2 -6
- package/src/programmers/internal/template_to_pattern.ts +1 -3
- package/src/programmers/internal/wrap_metadata_rest_tuple.ts +1 -3
- package/src/programmers/json/JsonStringifyProgrammer.ts +2 -2
- package/src/protobuf.ts +307 -348
- package/src/reflect.ts +3 -7
- package/src/schemas/json/IJsonApplication.ts +4 -4
- package/src/schemas/json/IJsonSchemaCollection.ts +73 -56
- package/src/schemas/json/IJsonSchemaUnit.ts +83 -70
- package/src/schemas/metadata/IMetadataTypeTag.ts +1 -3
- package/src/schemas/metadata/Metadata.ts +9 -27
- package/src/schemas/metadata/MetadataAliasType.ts +3 -9
- package/src/schemas/metadata/MetadataApplication.ts +2 -6
- package/src/schemas/metadata/MetadataArray.ts +1 -3
- package/src/schemas/metadata/MetadataArrayType.ts +3 -9
- package/src/schemas/metadata/MetadataAtomic.ts +1 -3
- package/src/schemas/metadata/MetadataEscaped.ts +3 -9
- package/src/schemas/metadata/MetadataFunction.ts +2 -6
- package/src/schemas/metadata/MetadataObject.ts +1 -3
- package/src/schemas/metadata/MetadataObjectType.ts +6 -18
- package/src/schemas/metadata/MetadataParameter.ts +1 -3
- package/src/schemas/metadata/MetadataProperty.ts +3 -9
- package/src/schemas/metadata/MetadataTemplate.ts +1 -3
- package/src/schemas/metadata/MetadataTuple.ts +2 -6
- package/src/schemas/metadata/MetadataTupleType.ts +3 -9
- package/src/tags/Constant.ts +16 -16
- package/src/tags/ContentMediaType.ts +7 -7
- package/src/tags/Default.ts +19 -19
- package/src/tags/Example.ts +18 -18
- package/src/tags/Examples.ts +23 -23
- package/src/tags/ExclusiveMaximum.ts +8 -5
- package/src/tags/ExclusiveMinimum.ts +8 -5
- package/src/tags/Format.ts +12 -8
- package/src/tags/JsonSchemaPlugin.ts +20 -18
- package/src/tags/MaxItems.ts +9 -9
- package/src/tags/MaxLength.ts +6 -5
- package/src/tags/Maximum.ts +9 -7
- package/src/tags/MinItems.ts +9 -9
- package/src/tags/MinLength.ts +6 -5
- package/src/tags/Minimum.ts +9 -7
- package/src/tags/MultipleOf.ts +10 -7
- package/src/tags/Pattern.ts +7 -4
- package/src/tags/Sequence.ts +19 -17
- package/src/tags/TagBase.ts +21 -28
- package/src/tags/Type.ts +12 -11
- package/src/tags/UniqueItems.ts +10 -9
- package/src/tags/internal/FormatCheatSheet.ts +1 -3
- package/src/transformers/ITransformOptions.ts +27 -19
- package/src/transformers/ImportTransformer.ts +5 -10
- package/src/transformers/NoTransformConfigurationError.ts +1 -3
- package/src/transformers/features/llm/LlmApplicationTransformer.ts +1 -3
- package/src/typings/Equal.ts +6 -6
|
@@ -3,20 +3,23 @@ import { TagBase } from "./TagBase";
|
|
|
3
3
|
/**
|
|
4
4
|
* Exclusive maximum value constraint tag.
|
|
5
5
|
*
|
|
6
|
-
* Enforces that a numeric value must be strictly less than the specified
|
|
7
|
-
* This constraint validates that the input value
|
|
6
|
+
* Enforces that a numeric value must be strictly less than the specified
|
|
7
|
+
* maximum (not equal). This constraint validates that the input value
|
|
8
|
+
* satisfies: input < maximum.
|
|
8
9
|
*
|
|
9
10
|
* Example usage:
|
|
11
|
+
*
|
|
10
12
|
* ```typescript
|
|
11
|
-
* type Discount = number & tags.ExclusiveMaximum<100>;
|
|
12
|
-
* type ByteValue = bigint & tags.ExclusiveMaximum<256n>;
|
|
13
|
+
* type Discount = number & tags.ExclusiveMaximum<100>; // Must be < 100
|
|
14
|
+
* type ByteValue = bigint & tags.ExclusiveMaximum<256n>; // Must be < 256
|
|
13
15
|
* ```
|
|
14
16
|
*
|
|
15
17
|
* Note: This tag is mutually exclusive with Maximum. You cannot apply both
|
|
16
18
|
* ExclusiveMaximum and Maximum constraints to the same property.
|
|
17
19
|
*
|
|
18
|
-
* @template Value - The exclusive maximum value constraint (number or bigint literal)
|
|
19
20
|
* @author Jeongho Nam - https://github.com/samchon
|
|
21
|
+
* @template Value - The exclusive maximum value constraint (number or bigint
|
|
22
|
+
* literal)
|
|
20
23
|
*/
|
|
21
24
|
export type ExclusiveMaximum<Value extends number | bigint> = TagBase<{
|
|
22
25
|
target: Value extends bigint ? "bigint" : "number";
|
|
@@ -3,20 +3,23 @@ import { TagBase } from "./TagBase";
|
|
|
3
3
|
/**
|
|
4
4
|
* Exclusive minimum value constraint tag.
|
|
5
5
|
*
|
|
6
|
-
* Enforces that a numeric value must be strictly greater than the specified
|
|
7
|
-
* This constraint validates that the input value
|
|
6
|
+
* Enforces that a numeric value must be strictly greater than the specified
|
|
7
|
+
* minimum (not equal). This constraint validates that the input value
|
|
8
|
+
* satisfies: input > minimum.
|
|
8
9
|
*
|
|
9
10
|
* Example usage:
|
|
11
|
+
*
|
|
10
12
|
* ```typescript
|
|
11
|
-
* type PositiveNumber = number & tags.ExclusiveMinimum<0>;
|
|
12
|
-
* type LargeCount = bigint & tags.ExclusiveMinimum<999n>;
|
|
13
|
+
* type PositiveNumber = number & tags.ExclusiveMinimum<0>; // Must be > 0
|
|
14
|
+
* type LargeCount = bigint & tags.ExclusiveMinimum<999n>; // Must be > 999
|
|
13
15
|
* ```
|
|
14
16
|
*
|
|
15
17
|
* Note: This tag is mutually exclusive with Minimum. You cannot apply both
|
|
16
18
|
* ExclusiveMinimum and Minimum constraints to the same property.
|
|
17
19
|
*
|
|
18
|
-
* @template Value - The exclusive minimum value constraint (number or bigint literal)
|
|
19
20
|
* @author Jeongho Nam - https://github.com/samchon
|
|
21
|
+
* @template Value - The exclusive minimum value constraint (number or bigint
|
|
22
|
+
* literal)
|
|
20
23
|
*/
|
|
21
24
|
export type ExclusiveMinimum<Value extends number | bigint> = TagBase<{
|
|
22
25
|
target: Value extends bigint ? "bigint" : "number";
|
package/src/tags/Format.ts
CHANGED
|
@@ -3,24 +3,28 @@ import type { TagBase } from "./TagBase";
|
|
|
3
3
|
/**
|
|
4
4
|
* String format constraint tag.
|
|
5
5
|
*
|
|
6
|
-
* Validates strings against predefined formats for common use cases.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* Validates strings against predefined formats for common use cases. This tag
|
|
7
|
+
* provides built-in validation for standard string formats without needing to
|
|
8
|
+
* write custom regular expressions.
|
|
9
9
|
*
|
|
10
10
|
* Examples:
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* Type Email = string & Format<"email">; // user@example.com
|
|
14
|
+
* Type WebURL = string & Format<"url">; // https://example.com
|
|
15
|
+
* Type DateTime = string & Format<"date-time">; // 2024-01-15T10:30:00Z
|
|
16
|
+
* ```
|
|
14
17
|
*
|
|
15
18
|
* Supported formats include:
|
|
19
|
+
*
|
|
16
20
|
* - Network: email, url, hostname, ipv4, ipv6, uri
|
|
17
21
|
* - Identifiers: uuid, byte, password
|
|
18
22
|
* - Date/Time: date, time, date-time, duration
|
|
19
23
|
* - Data: json-pointer, regex
|
|
20
24
|
* - Internationalized: idn-email, idn-hostname, iri
|
|
21
25
|
*
|
|
22
|
-
* Note: This tag is mutually exclusive with the Pattern tag. You cannot use
|
|
23
|
-
* Format and Pattern on the same type.
|
|
26
|
+
* Note: This tag is mutually exclusive with the Pattern tag. You cannot use
|
|
27
|
+
* both Format and Pattern on the same type.
|
|
24
28
|
*
|
|
25
29
|
* @author Jeongho Nam - https://github.com/samchon
|
|
26
30
|
*/
|
|
@@ -3,28 +3,30 @@ import { TagBase } from "./TagBase";
|
|
|
3
3
|
/**
|
|
4
4
|
* Injects custom properties into generated JSON Schema.
|
|
5
5
|
*
|
|
6
|
-
* The JsonSchemaPlugin tag allows you to add vendor-specific extensions or
|
|
7
|
-
* to the generated JSON Schema output. These properties are
|
|
8
|
-
* the schema and are commonly used for
|
|
9
|
-
*
|
|
6
|
+
* The JsonSchemaPlugin tag allows you to add vendor-specific extensions or
|
|
7
|
+
* custom metadata to the generated JSON Schema output. These properties are
|
|
8
|
+
* merged at the root level of the schema and are commonly used for
|
|
9
|
+
* documentation, tooling hints, or API-specific metadata. The custom properties
|
|
10
|
+
* only affect schema generation and do not impact runtime validation.
|
|
10
11
|
*
|
|
12
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
11
13
|
* @example
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // Add OpenAPI vendor extensions
|
|
16
|
+
* type UserId = string & JsonSchemaPlugin<{
|
|
17
|
+
* "x-internal-id": true,
|
|
18
|
+
* "x-deprecated": "Use UUID instead"
|
|
19
|
+
* }>;
|
|
18
20
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
21
|
+
* // Add custom documentation metadata
|
|
22
|
+
* type Price = number & JsonSchemaPlugin<{
|
|
23
|
+
* "x-format": "currency",
|
|
24
|
+
* "x-example": 19.99
|
|
25
|
+
* }>;
|
|
26
|
+
* ```
|
|
25
27
|
*
|
|
26
|
-
* @template Schema - Object containing custom properties to add to the JSON
|
|
27
|
-
*
|
|
28
|
+
* @template Schema - Object containing custom properties to add to the JSON
|
|
29
|
+
* Schema
|
|
28
30
|
*/
|
|
29
31
|
export type JsonSchemaPlugin<Schema extends object> = TagBase<{
|
|
30
32
|
target: "string" | "boolean" | "bigint" | "number" | "array" | "object";
|
package/src/tags/MaxItems.ts
CHANGED
|
@@ -3,21 +3,21 @@ import { TagBase } from "./TagBase";
|
|
|
3
3
|
/**
|
|
4
4
|
* Maximum items validation tag for arrays.
|
|
5
5
|
*
|
|
6
|
-
* Enforces that an array contains at most the specified number of items.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* Enforces that an array contains at most the specified number of items. This
|
|
7
|
+
* tag is useful for limiting array sizes, such as restricting the number of
|
|
8
|
+
* uploaded files, limiting selections in a form, or capping the size of
|
|
9
|
+
* collections to prevent performance issues.
|
|
10
10
|
*
|
|
11
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
11
12
|
* @example
|
|
12
|
-
*
|
|
13
|
-
*
|
|
13
|
+
* // Allow maximum 5 file uploads
|
|
14
|
+
* type FileList = File[] & MaxItems<5>;
|
|
14
15
|
*
|
|
15
16
|
* @example
|
|
16
|
-
*
|
|
17
|
-
*
|
|
17
|
+
* // Limit tags to 10 items
|
|
18
|
+
* type ProductTags = string[] & MaxItems<10>;
|
|
18
19
|
*
|
|
19
20
|
* @template Value - The maximum number of items allowed
|
|
20
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
21
21
|
*/
|
|
22
22
|
export type MaxItems<Value extends number> = TagBase<{
|
|
23
23
|
target: "array";
|
package/src/tags/MaxLength.ts
CHANGED
|
@@ -3,12 +3,13 @@ import { TagBase } from "./TagBase";
|
|
|
3
3
|
/**
|
|
4
4
|
* String maximum length constraint tag.
|
|
5
5
|
*
|
|
6
|
-
* Validates that a string's length is less than or equal to the specified
|
|
7
|
-
* This tag enforces an upper limit on the number of characters in a
|
|
6
|
+
* Validates that a string's length is less than or equal to the specified
|
|
7
|
+
* value. This tag enforces an upper limit on the number of characters in a
|
|
8
|
+
* string.
|
|
8
9
|
*
|
|
9
|
-
* Examples:
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* Examples: type ShortComment = string & MaxLength<200>; // Comment limited to
|
|
11
|
+
* 200 characters type ZipCode = string & MaxLength<10>; // Zip code with max 10
|
|
12
|
+
* characters
|
|
12
13
|
*
|
|
13
14
|
* @author Jeongho Nam - https://github.com/samchon
|
|
14
15
|
*/
|
package/src/tags/Maximum.ts
CHANGED
|
@@ -3,20 +3,22 @@ import { TagBase } from "./TagBase";
|
|
|
3
3
|
/**
|
|
4
4
|
* Maximum value constraint tag.
|
|
5
5
|
*
|
|
6
|
-
* Enforces that a numeric value must be less than or equal to the specified
|
|
7
|
-
* This constraint validates that the input value satisfies: input <=
|
|
6
|
+
* Enforces that a numeric value must be less than or equal to the specified
|
|
7
|
+
* maximum. This constraint validates that the input value satisfies: input <=
|
|
8
|
+
* maximum.
|
|
8
9
|
*
|
|
9
10
|
* Example usage:
|
|
11
|
+
*
|
|
10
12
|
* ```typescript
|
|
11
|
-
* type Percentage = number & tags.Maximum<100>;
|
|
12
|
-
* type SmallInt = bigint & tags.Maximum<255n>;
|
|
13
|
+
* type Percentage = number & tags.Maximum<100>; // Must be <= 100
|
|
14
|
+
* type SmallInt = bigint & tags.Maximum<255n>; // BigInt must be <= 255
|
|
13
15
|
* ```
|
|
14
16
|
*
|
|
15
|
-
* Note: This tag is mutually exclusive with ExclusiveMaximum. You cannot apply
|
|
16
|
-
* Maximum and ExclusiveMaximum constraints to the same property.
|
|
17
|
+
* Note: This tag is mutually exclusive with ExclusiveMaximum. You cannot apply
|
|
18
|
+
* both Maximum and ExclusiveMaximum constraints to the same property.
|
|
17
19
|
*
|
|
18
|
-
* @template Value - The maximum value constraint (number or bigint literal)
|
|
19
20
|
* @author Jeongho Nam - https://github.com/samchon
|
|
21
|
+
* @template Value - The maximum value constraint (number or bigint literal)
|
|
20
22
|
*/
|
|
21
23
|
export type Maximum<Value extends number | bigint> = TagBase<{
|
|
22
24
|
target: Value extends bigint ? "bigint" : "number";
|
package/src/tags/MinItems.ts
CHANGED
|
@@ -3,21 +3,21 @@ import { TagBase } from "./TagBase";
|
|
|
3
3
|
/**
|
|
4
4
|
* Minimum items validation tag for arrays.
|
|
5
5
|
*
|
|
6
|
-
* Enforces that an array contains at least the specified number of items.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* Enforces that an array contains at least the specified number of items. This
|
|
7
|
+
* tag is useful for ensuring arrays have a minimum length requirement, such as
|
|
8
|
+
* requiring at least one item in a list or a minimum number of selections in a
|
|
9
|
+
* multi-choice field.
|
|
10
10
|
*
|
|
11
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
11
12
|
* @example
|
|
12
|
-
*
|
|
13
|
-
*
|
|
13
|
+
* // Require at least 1 item in the array
|
|
14
|
+
* type Tags = string[] & MinItems<1>;
|
|
14
15
|
*
|
|
15
16
|
* @example
|
|
16
|
-
*
|
|
17
|
-
*
|
|
17
|
+
* // Require at least 3 selections
|
|
18
|
+
* type MultipleChoice = number[] & MinItems<3>;
|
|
18
19
|
*
|
|
19
20
|
* @template Value - The minimum number of items required
|
|
20
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
21
21
|
*/
|
|
22
22
|
export type MinItems<Value extends number> = TagBase<{
|
|
23
23
|
target: "array";
|
package/src/tags/MinLength.ts
CHANGED
|
@@ -3,12 +3,13 @@ import { TagBase } from "./TagBase";
|
|
|
3
3
|
/**
|
|
4
4
|
* String minimum length constraint tag.
|
|
5
5
|
*
|
|
6
|
-
* Validates that a string's length is greater than or equal to the specified
|
|
7
|
-
* This tag ensures that string values meet a minimum character count
|
|
6
|
+
* Validates that a string's length is greater than or equal to the specified
|
|
7
|
+
* value. This tag ensures that string values meet a minimum character count
|
|
8
|
+
* requirement.
|
|
8
9
|
*
|
|
9
|
-
* Examples:
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* Examples: type Username = string & MinLength<3>; // Username must be at least
|
|
11
|
+
* 3 characters type Password = string & MinLength<8>; // Password must be at
|
|
12
|
+
* least 8 characters
|
|
12
13
|
*
|
|
13
14
|
* @author Jeongho Nam - https://github.com/samchon
|
|
14
15
|
*/
|
package/src/tags/Minimum.ts
CHANGED
|
@@ -3,20 +3,22 @@ import { TagBase } from "./TagBase";
|
|
|
3
3
|
/**
|
|
4
4
|
* Minimum value constraint tag.
|
|
5
5
|
*
|
|
6
|
-
* Enforces that a numeric value must be greater than or equal to the specified
|
|
7
|
-
* This constraint validates that the input value satisfies: input >=
|
|
6
|
+
* Enforces that a numeric value must be greater than or equal to the specified
|
|
7
|
+
* minimum. This constraint validates that the input value satisfies: input >=
|
|
8
|
+
* minimum.
|
|
8
9
|
*
|
|
9
10
|
* Example usage:
|
|
11
|
+
*
|
|
10
12
|
* ```typescript
|
|
11
|
-
* type Age = number & tags.Minimum<0>;
|
|
12
|
-
* type Balance = bigint & tags.Minimum<0n>;
|
|
13
|
+
* type Age = number & tags.Minimum<0>; // Age must be 0 or greater
|
|
14
|
+
* type Balance = bigint & tags.Minimum<0n>; // BigInt balance must be non-negative
|
|
13
15
|
* ```
|
|
14
16
|
*
|
|
15
|
-
* Note: This tag is mutually exclusive with ExclusiveMinimum. You cannot apply
|
|
16
|
-
* Minimum and ExclusiveMinimum constraints to the same property.
|
|
17
|
+
* Note: This tag is mutually exclusive with ExclusiveMinimum. You cannot apply
|
|
18
|
+
* both Minimum and ExclusiveMinimum constraints to the same property.
|
|
17
19
|
*
|
|
18
|
-
* @template Value - The minimum value constraint (number or bigint literal)
|
|
19
20
|
* @author Jeongho Nam - https://github.com/samchon
|
|
21
|
+
* @template Value - The minimum value constraint (number or bigint literal)
|
|
20
22
|
*/
|
|
21
23
|
export type Minimum<Value extends number | bigint> = TagBase<{
|
|
22
24
|
target: Value extends bigint ? "bigint" : "number";
|
package/src/tags/MultipleOf.ts
CHANGED
|
@@ -3,20 +3,23 @@ import { TagBase } from "./TagBase";
|
|
|
3
3
|
/**
|
|
4
4
|
* Multiple of constraint tag.
|
|
5
5
|
*
|
|
6
|
-
* Enforces that a numeric value must be an exact multiple of the specified
|
|
7
|
-
* This constraint validates that the input value satisfies: input %
|
|
6
|
+
* Enforces that a numeric value must be an exact multiple of the specified
|
|
7
|
+
* divisor. This constraint validates that the input value satisfies: input %
|
|
8
|
+
* divisor === 0.
|
|
8
9
|
*
|
|
9
10
|
* Example usage:
|
|
11
|
+
*
|
|
10
12
|
* ```typescript
|
|
11
|
-
* type EvenNumber = number & tags.MultipleOf<2>;
|
|
12
|
-
* type DollarAmount = number & tags.MultipleOf<0.01>;
|
|
13
|
+
* type EvenNumber = number & tags.MultipleOf<2>; // Must be even (2, 4, 6, ...)
|
|
14
|
+
* type DollarAmount = number & tags.MultipleOf<0.01>; // Must be in cents
|
|
13
15
|
* ```
|
|
14
16
|
*
|
|
15
|
-
* Common use cases include validating even/odd numbers, currency amounts,
|
|
16
|
-
*
|
|
17
|
+
* Common use cases include validating even/odd numbers, currency amounts, time
|
|
18
|
+
* intervals, or any value that must align to specific increments.
|
|
17
19
|
*
|
|
18
|
-
* @template Value - The divisor value that input must be a multiple of (number or bigint literal)
|
|
19
20
|
* @author Jeongho Nam - https://github.com/samchon
|
|
21
|
+
* @template Value - The divisor value that input must be a multiple of (number
|
|
22
|
+
* or bigint literal)
|
|
20
23
|
*/
|
|
21
24
|
export type MultipleOf<Value extends number | bigint> = TagBase<{
|
|
22
25
|
target: Value extends bigint ? "bigint" : "number";
|
package/src/tags/Pattern.ts
CHANGED
|
@@ -3,12 +3,15 @@ import { TagBase } from "./TagBase";
|
|
|
3
3
|
/**
|
|
4
4
|
* String pattern (regular expression) constraint tag.
|
|
5
5
|
*
|
|
6
|
-
* Validates that a string matches a specified regular expression pattern.
|
|
7
|
-
*
|
|
6
|
+
* Validates that a string matches a specified regular expression pattern. Use
|
|
7
|
+
* this tag to enforce custom string formats through regex validation.
|
|
8
8
|
*
|
|
9
9
|
* Examples:
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* type PhoneNumber = string & Pattern<"^\d{3}-\d{3}-\d{4}$">; // 123-456-7890
|
|
13
|
+
* type HexColor = string & Pattern<"^#[0-9A-Fa-f]{6}$">; // #FF5733
|
|
14
|
+
* ```
|
|
12
15
|
*
|
|
13
16
|
* Note: This tag is mutually exclusive with the Format tag. You cannot use both
|
|
14
17
|
* Pattern and Format on the same type.
|
package/src/tags/Sequence.ts
CHANGED
|
@@ -3,27 +3,29 @@ import { TagBase } from "./TagBase";
|
|
|
3
3
|
/**
|
|
4
4
|
* Assigns unique field numbers for Protocol Buffer serialization.
|
|
5
5
|
*
|
|
6
|
-
* In Protocol Buffer encoding, each field in a message must have a unique
|
|
7
|
-
* The Sequence tag assigns these field numbers to
|
|
8
|
-
* Protocol Buffer serialization and
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* In Protocol Buffer encoding, each field in a message must have a unique
|
|
7
|
+
* numeric identifier. The Sequence tag assigns these field numbers to
|
|
8
|
+
* TypeScript properties, enabling proper Protocol Buffer serialization and
|
|
9
|
+
* deserialization. Field numbers 1-15 require only one byte to encode, making
|
|
10
|
+
* them ideal for frequently used fields. Numbers 19000-19999 are reserved by
|
|
11
|
+
* the Protocol Buffer specification and should not be used.
|
|
11
12
|
*
|
|
13
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
12
14
|
* @example
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
15
|
+
* ```typescript
|
|
16
|
+
* interface User {
|
|
17
|
+
* id: string & Sequence<1>; // Most frequent field uses 1
|
|
18
|
+
* email: string & Sequence<2>; // Common fields use low numbers
|
|
19
|
+
* createdAt: number & Sequence<3>;
|
|
20
|
+
* metadata?: object & Sequence<10>; // Optional fields work too
|
|
21
|
+
* }
|
|
20
22
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
23
|
+
* // Generate Protocol Buffer message
|
|
24
|
+
* const message = typia.protobuf.message<User>();
|
|
25
|
+
* ```
|
|
24
26
|
*
|
|
25
|
-
* @template N - Field number (positive integer from 1 to 536,870,911, excluding
|
|
26
|
-
*
|
|
27
|
+
* @template N - Field number (positive integer from 1 to 536,870,911, excluding
|
|
28
|
+
* 19000-19999)
|
|
27
29
|
*/
|
|
28
30
|
export type Sequence<N extends number> = TagBase<{
|
|
29
31
|
target: "boolean" | "bigint" | "number" | "string" | "array" | "object";
|
package/src/tags/TagBase.ts
CHANGED
|
@@ -2,23 +2,22 @@
|
|
|
2
2
|
* Base type for all validation tags in typia.
|
|
3
3
|
*
|
|
4
4
|
* TagBase provides the foundation for all typia's validation tags. It attaches
|
|
5
|
-
* metadata to TypeScript types that typia's transformer processes at
|
|
6
|
-
* to generate optimized runtime validation code.
|
|
7
|
-
*
|
|
8
|
-
* @template Props - Tag properties that define validation behavior
|
|
5
|
+
* metadata to TypeScript types that typia's transformer processes at
|
|
6
|
+
* compile-time to generate optimized runtime validation code.
|
|
9
7
|
*
|
|
8
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
10
9
|
* @example
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // Custom tag example
|
|
12
|
+
* type MyCustomTag<Value extends number> = TagBase<{
|
|
14
13
|
* target: "number";
|
|
15
14
|
* kind: "MyCustom";
|
|
16
15
|
* value: Value;
|
|
17
16
|
* validate: `$input === ${Value}`;
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* }>;
|
|
18
|
+
* ```
|
|
20
19
|
*
|
|
21
|
-
* @
|
|
20
|
+
* @template Props - Tag properties that define validation behavior
|
|
22
21
|
*/
|
|
23
22
|
export type TagBase<
|
|
24
23
|
Props extends TagBase.IProps<any, any, any, any, any, any>,
|
|
@@ -57,30 +56,26 @@ export namespace TagBase {
|
|
|
57
56
|
/**
|
|
58
57
|
* Target type.
|
|
59
58
|
*
|
|
60
|
-
* If user tries to adapt this tag to a different type, it would be a
|
|
61
|
-
* error.
|
|
59
|
+
* If user tries to adapt this tag to a different type, it would be a
|
|
60
|
+
* compile error.
|
|
62
61
|
*
|
|
63
|
-
* For example, you've configured target type as `string`, but user adapted
|
|
64
|
-
* onto a `number` type (`number & YourCustomTag<Value>`), then it would
|
|
65
|
-
* blocked by TypeScript compiler.
|
|
62
|
+
* For example, you've configured target type as `string`, but user adapted
|
|
63
|
+
* it onto a `number` type (`number & YourCustomTag<Value>`), then it would
|
|
64
|
+
* be blocked by TypeScript compiler.
|
|
66
65
|
*/
|
|
67
66
|
target: Target;
|
|
68
67
|
|
|
69
|
-
/**
|
|
70
|
-
* What kind of tag is this?
|
|
71
|
-
*/
|
|
68
|
+
/** What kind of tag is this? */
|
|
72
69
|
kind: Kind;
|
|
73
70
|
|
|
74
|
-
/**
|
|
75
|
-
* Value to be configured by user.
|
|
76
|
-
*/
|
|
71
|
+
/** Value to be configured by user. */
|
|
77
72
|
value: Value;
|
|
78
73
|
|
|
79
74
|
/**
|
|
80
75
|
* Validation script.
|
|
81
76
|
*
|
|
82
|
-
* This script would be inserted into the generated validation function.
|
|
83
|
-
*
|
|
77
|
+
* This script would be inserted into the generated validation function. In
|
|
78
|
+
* here script, target variable name must be `$input`. The variable name
|
|
84
79
|
* `$input` would be transformed to the suitable when compilation.
|
|
85
80
|
*
|
|
86
81
|
* Also, If you've take a mistake on this script, compile error would be
|
|
@@ -94,16 +89,14 @@ export namespace TagBase {
|
|
|
94
89
|
*
|
|
95
90
|
* If this property configured as `true`, same {@link kind} tag cannot be
|
|
96
91
|
* duplicated in the target type. Otherwise, if you've configured this
|
|
97
|
-
* property as string array, all of the {@link kind} value assigned
|
|
98
|
-
*
|
|
92
|
+
* property as string array, all of the {@link kind} value assigned tags
|
|
93
|
+
* cannot be compatible in the target type.
|
|
99
94
|
*
|
|
100
95
|
* @default false
|
|
101
96
|
*/
|
|
102
97
|
exclusive?: Exclusive | string[];
|
|
103
98
|
|
|
104
|
-
/**
|
|
105
|
-
* Additional schema info assigned to the {@link IJsonSchema} object.
|
|
106
|
-
*/
|
|
99
|
+
/** Additional schema info assigned to the {@link IJsonSchema} object. */
|
|
107
100
|
schema?: Schema;
|
|
108
101
|
}
|
|
109
102
|
}
|
package/src/tags/Type.ts
CHANGED
|
@@ -3,10 +3,12 @@ import { TagBase } from "./TagBase";
|
|
|
3
3
|
/**
|
|
4
4
|
* Type tag for specifying numeric bit-width representations.
|
|
5
5
|
*
|
|
6
|
-
* Constrains numeric types to specific bit-width formats used in systems
|
|
7
|
-
* and protocol buffers. Ensures numbers conform to
|
|
6
|
+
* Constrains numeric types to specific bit-width formats used in systems
|
|
7
|
+
* programming and protocol buffers. Ensures numbers conform to
|
|
8
|
+
* platform-specific representations.
|
|
8
9
|
*
|
|
9
10
|
* Supported types:
|
|
11
|
+
*
|
|
10
12
|
* - `int32`: 32-bit signed integer (-2^31 to 2^31-1)
|
|
11
13
|
* - `uint32`: 32-bit unsigned integer (0 to 2^32-1)
|
|
12
14
|
* - `int64`: 64-bit signed integer (supports both bigint and number)
|
|
@@ -14,17 +16,16 @@ import { TagBase } from "./TagBase";
|
|
|
14
16
|
* - `float`: 32-bit floating point (single precision)
|
|
15
17
|
* - `double`: 64-bit floating point (double precision, default JS number)
|
|
16
18
|
*
|
|
17
|
-
* @
|
|
18
|
-
*
|
|
19
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
19
20
|
* @example
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
21
|
+
* ```typescript
|
|
22
|
+
* type Score = number & Type<"int32">; // -2,147,483,648 to 2,147,483,647
|
|
23
|
+
* type UserId = number & Type<"uint32">; // 0 to 4,294,967,295
|
|
24
|
+
* type FileSize = bigint & Type<"int64">; // Large file sizes
|
|
25
|
+
* type Coordinate = number & Type<"double">; // High precision coordinates
|
|
26
|
+
* ```
|
|
26
27
|
*
|
|
27
|
-
* @
|
|
28
|
+
* @template Value - The numeric type representation
|
|
28
29
|
*/
|
|
29
30
|
export type Type<
|
|
30
31
|
Value extends "int32" | "uint32" | "int64" | "uint64" | "float" | "double",
|
package/src/tags/UniqueItems.ts
CHANGED
|
@@ -4,20 +4,21 @@ import { TagBase } from "./TagBase";
|
|
|
4
4
|
* Unique items validation tag for arrays.
|
|
5
5
|
*
|
|
6
6
|
* Enforces that all items in an array are unique, preventing duplicate values.
|
|
7
|
-
* Uniqueness is determined using strict equality (===) for primitives and
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* Uniqueness is determined using strict equality (===) for primitives and deep
|
|
8
|
+
* structural comparison for objects and arrays. This means two objects with the
|
|
9
|
+
* same properties and values are considered duplicates.
|
|
10
10
|
*
|
|
11
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
11
12
|
* @example
|
|
12
|
-
*
|
|
13
|
-
*
|
|
13
|
+
* // Ensure all IDs are unique
|
|
14
|
+
* type UserIds = number[] & UniqueItems;
|
|
14
15
|
*
|
|
15
16
|
* @example
|
|
16
|
-
*
|
|
17
|
-
*
|
|
17
|
+
* // Prevent duplicate email addresses
|
|
18
|
+
* type EmailList = string[] & UniqueItems;
|
|
18
19
|
*
|
|
19
|
-
* @template Value - Boolean flag to enable/disable uniqueness validation
|
|
20
|
-
*
|
|
20
|
+
* @template Value - Boolean flag to enable/disable uniqueness validation
|
|
21
|
+
* (defaults to true)
|
|
21
22
|
*/
|
|
22
23
|
export type UniqueItems<Value extends boolean = true> = TagBase<{
|
|
23
24
|
target: "array";
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
const RegexCall = <Text extends string>(text: Text) =>
|
|
2
2
|
`${text}.test($input)` as const;
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* @reference https://github.dev/ajv-validator/ajv-formats/blob/master/src/formats.ts
|
|
6
|
-
*/
|
|
4
|
+
/** @reference https://github.dev/ajv-validator/ajv-formats/blob/master/src/formats.ts */
|
|
7
5
|
export const FormatCheatSheet = {
|
|
8
6
|
// SPECIAL CHARACTERS
|
|
9
7
|
byte: RegexCall(
|