typia 9.7.0 → 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/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 +32 -0
- package/lib/tags/Constant.d.ts +32 -0
- package/lib/tags/ContentMediaType.d.mts +17 -0
- package/lib/tags/ContentMediaType.d.ts +17 -0
- package/lib/tags/Default.d.mts +30 -0
- package/lib/tags/Default.d.ts +30 -0
- package/lib/tags/Example.d.mts +32 -0
- package/lib/tags/Example.d.ts +32 -0
- package/lib/tags/Examples.d.mts +40 -0
- package/lib/tags/Examples.d.ts +40 -0
- package/lib/tags/ExclusiveMaximum.d.mts +21 -0
- package/lib/tags/ExclusiveMaximum.d.ts +21 -0
- package/lib/tags/ExclusiveMinimum.d.mts +21 -0
- package/lib/tags/ExclusiveMinimum.d.ts +21 -0
- package/lib/tags/Format.d.mts +28 -0
- package/lib/tags/Format.d.ts +28 -0
- package/lib/tags/JsonSchemaPlugin.d.mts +28 -0
- package/lib/tags/JsonSchemaPlugin.d.ts +28 -0
- package/lib/tags/MaxItems.d.mts +19 -0
- package/lib/tags/MaxItems.d.ts +19 -0
- package/lib/tags/MaxLength.d.mts +13 -0
- package/lib/tags/MaxLength.d.ts +13 -0
- package/lib/tags/Maximum.d.mts +20 -0
- package/lib/tags/Maximum.d.ts +20 -0
- package/lib/tags/MinItems.d.mts +19 -0
- package/lib/tags/MinItems.d.ts +19 -0
- package/lib/tags/MinLength.d.mts +13 -0
- package/lib/tags/MinLength.d.ts +13 -0
- package/lib/tags/Minimum.d.mts +20 -0
- package/lib/tags/Minimum.d.ts +20 -0
- package/lib/tags/MultipleOf.d.mts +21 -0
- package/lib/tags/MultipleOf.d.ts +21 -0
- package/lib/tags/Pattern.d.mts +18 -0
- package/lib/tags/Pattern.d.ts +18 -0
- package/lib/tags/Sequence.d.mts +27 -0
- package/lib/tags/Sequence.d.ts +27 -0
- package/lib/tags/TagBase.d.mts +38 -18
- package/lib/tags/TagBase.d.ts +38 -18
- package/lib/tags/Type.d.mts +27 -0
- package/lib/tags/Type.d.ts +27 -0
- package/lib/tags/UniqueItems.d.mts +20 -0
- package/lib/tags/UniqueItems.d.ts +20 -0
- 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 +114 -1
- package/lib/transformers/ImportTransformer.js.map +1 -1
- package/lib/transformers/ImportTransformer.mjs +114 -1
- 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 +57 -47
- 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/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 +32 -0
- package/src/tags/ContentMediaType.ts +17 -0
- package/src/tags/Default.ts +30 -0
- package/src/tags/Example.ts +32 -0
- package/src/tags/Examples.ts +40 -0
- package/src/tags/ExclusiveMaximum.ts +21 -0
- package/src/tags/ExclusiveMinimum.ts +21 -0
- package/src/tags/Format.ts +28 -0
- package/src/tags/JsonSchemaPlugin.ts +28 -0
- package/src/tags/MaxItems.ts +19 -0
- package/src/tags/MaxLength.ts +13 -0
- package/src/tags/Maximum.ts +20 -0
- package/src/tags/MinItems.ts +19 -0
- package/src/tags/MinLength.ts +13 -0
- package/src/tags/Minimum.ts +20 -0
- package/src/tags/MultipleOf.ts +21 -0
- package/src/tags/Pattern.ts +18 -0
- package/src/tags/Sequence.ts +27 -0
- package/src/tags/TagBase.ts +38 -18
- package/src/tags/Type.ts +27 -0
- package/src/tags/UniqueItems.ts +20 -0
- package/src/tags/internal/FormatCheatSheet.ts +1 -3
- package/src/transformers/ITransformOptions.ts +27 -19
- package/src/transformers/ImportTransformer.ts +173 -1
- package/src/transformers/NoTransformConfigurationError.ts +1 -3
- package/src/transformers/features/llm/LlmApplicationTransformer.ts +1 -3
- package/src/typings/Equal.ts +6 -6
package/lib/tags/Examples.d.mts
CHANGED
|
@@ -1,4 +1,44 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* Multiple examples tag that provides named example values for documentation.
|
|
4
|
+
*
|
|
5
|
+
* Unlike the Example tag which provides a single example, Examples allows you
|
|
6
|
+
* to provide multiple labeled examples. This is particularly useful when you
|
|
7
|
+
* want to show different scenarios or use cases for the same type.
|
|
8
|
+
*
|
|
9
|
+
* The examples are added to JSON Schema as an object where keys are descriptive
|
|
10
|
+
* names and values are the example data. This helps in API documentation and
|
|
11
|
+
* test case generation.
|
|
12
|
+
*
|
|
13
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* interface PaymentRequest {
|
|
17
|
+
* amount: number & Examples<{
|
|
18
|
+
* small: 10.50,
|
|
19
|
+
* medium: 99.99,
|
|
20
|
+
* large: 1000.00
|
|
21
|
+
* }>;
|
|
22
|
+
* }
|
|
23
|
+
* ```;
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* interface UserStatus {
|
|
28
|
+
* state: string & Examples<{
|
|
29
|
+
* active: "active",
|
|
30
|
+
* inactive: "inactive",
|
|
31
|
+
* suspended: "suspended"
|
|
32
|
+
* }>;
|
|
33
|
+
* profile: object & Examples<{
|
|
34
|
+
* basic: { name: "John", age: 25 },
|
|
35
|
+
* detailed: { name: "Jane", age: 30, bio: "Developer", verified: true }
|
|
36
|
+
* }>;
|
|
37
|
+
* }
|
|
38
|
+
* ```;
|
|
39
|
+
*
|
|
40
|
+
* @template Value A record object mapping example names to example values
|
|
41
|
+
*/
|
|
2
42
|
export type Examples<Value extends Record<string, boolean | bigint | number | string | object | Array<unknown> | null>> = TagBase<{
|
|
3
43
|
target: "boolean" | "bigint" | "number" | "string" | "array" | "object";
|
|
4
44
|
kind: "examples";
|
package/lib/tags/Examples.d.ts
CHANGED
|
@@ -1,4 +1,44 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* Multiple examples tag that provides named example values for documentation.
|
|
4
|
+
*
|
|
5
|
+
* Unlike the Example tag which provides a single example, Examples allows you
|
|
6
|
+
* to provide multiple labeled examples. This is particularly useful when you
|
|
7
|
+
* want to show different scenarios or use cases for the same type.
|
|
8
|
+
*
|
|
9
|
+
* The examples are added to JSON Schema as an object where keys are descriptive
|
|
10
|
+
* names and values are the example data. This helps in API documentation and
|
|
11
|
+
* test case generation.
|
|
12
|
+
*
|
|
13
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* interface PaymentRequest {
|
|
17
|
+
* amount: number & Examples<{
|
|
18
|
+
* small: 10.50,
|
|
19
|
+
* medium: 99.99,
|
|
20
|
+
* large: 1000.00
|
|
21
|
+
* }>;
|
|
22
|
+
* }
|
|
23
|
+
* ```;
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* interface UserStatus {
|
|
28
|
+
* state: string & Examples<{
|
|
29
|
+
* active: "active",
|
|
30
|
+
* inactive: "inactive",
|
|
31
|
+
* suspended: "suspended"
|
|
32
|
+
* }>;
|
|
33
|
+
* profile: object & Examples<{
|
|
34
|
+
* basic: { name: "John", age: 25 },
|
|
35
|
+
* detailed: { name: "Jane", age: 30, bio: "Developer", verified: true }
|
|
36
|
+
* }>;
|
|
37
|
+
* }
|
|
38
|
+
* ```;
|
|
39
|
+
*
|
|
40
|
+
* @template Value A record object mapping example names to example values
|
|
41
|
+
*/
|
|
2
42
|
export type Examples<Value extends Record<string, boolean | bigint | number | string | object | Array<unknown> | null>> = TagBase<{
|
|
3
43
|
target: "boolean" | "bigint" | "number" | "string" | "array" | "object";
|
|
4
44
|
kind: "examples";
|
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* Exclusive maximum value constraint tag.
|
|
4
|
+
*
|
|
5
|
+
* Enforces that a numeric value must be strictly less than the specified
|
|
6
|
+
* maximum (not equal). This constraint validates that the input value
|
|
7
|
+
* satisfies: input < maximum.
|
|
8
|
+
*
|
|
9
|
+
* Example usage:
|
|
10
|
+
*
|
|
11
|
+
* ```typescript
|
|
12
|
+
* type Discount = number & tags.ExclusiveMaximum<100>; // Must be < 100
|
|
13
|
+
* type ByteValue = bigint & tags.ExclusiveMaximum<256n>; // Must be < 256
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Note: This tag is mutually exclusive with Maximum. You cannot apply both
|
|
17
|
+
* ExclusiveMaximum and Maximum constraints to the same property.
|
|
18
|
+
*
|
|
19
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
20
|
+
* @template Value - The exclusive maximum value constraint (number or bigint
|
|
21
|
+
* literal)
|
|
22
|
+
*/
|
|
2
23
|
export type ExclusiveMaximum<Value extends number | bigint> = TagBase<{
|
|
3
24
|
target: Value extends bigint ? "bigint" : "number";
|
|
4
25
|
kind: "exclusiveMaximum";
|
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* Exclusive maximum value constraint tag.
|
|
4
|
+
*
|
|
5
|
+
* Enforces that a numeric value must be strictly less than the specified
|
|
6
|
+
* maximum (not equal). This constraint validates that the input value
|
|
7
|
+
* satisfies: input < maximum.
|
|
8
|
+
*
|
|
9
|
+
* Example usage:
|
|
10
|
+
*
|
|
11
|
+
* ```typescript
|
|
12
|
+
* type Discount = number & tags.ExclusiveMaximum<100>; // Must be < 100
|
|
13
|
+
* type ByteValue = bigint & tags.ExclusiveMaximum<256n>; // Must be < 256
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Note: This tag is mutually exclusive with Maximum. You cannot apply both
|
|
17
|
+
* ExclusiveMaximum and Maximum constraints to the same property.
|
|
18
|
+
*
|
|
19
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
20
|
+
* @template Value - The exclusive maximum value constraint (number or bigint
|
|
21
|
+
* literal)
|
|
22
|
+
*/
|
|
2
23
|
export type ExclusiveMaximum<Value extends number | bigint> = TagBase<{
|
|
3
24
|
target: Value extends bigint ? "bigint" : "number";
|
|
4
25
|
kind: "exclusiveMaximum";
|
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* Exclusive minimum value constraint tag.
|
|
4
|
+
*
|
|
5
|
+
* Enforces that a numeric value must be strictly greater than the specified
|
|
6
|
+
* minimum (not equal). This constraint validates that the input value
|
|
7
|
+
* satisfies: input > minimum.
|
|
8
|
+
*
|
|
9
|
+
* Example usage:
|
|
10
|
+
*
|
|
11
|
+
* ```typescript
|
|
12
|
+
* type PositiveNumber = number & tags.ExclusiveMinimum<0>; // Must be > 0
|
|
13
|
+
* type LargeCount = bigint & tags.ExclusiveMinimum<999n>; // Must be > 999
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Note: This tag is mutually exclusive with Minimum. You cannot apply both
|
|
17
|
+
* ExclusiveMinimum and Minimum constraints to the same property.
|
|
18
|
+
*
|
|
19
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
20
|
+
* @template Value - The exclusive minimum value constraint (number or bigint
|
|
21
|
+
* literal)
|
|
22
|
+
*/
|
|
2
23
|
export type ExclusiveMinimum<Value extends number | bigint> = TagBase<{
|
|
3
24
|
target: Value extends bigint ? "bigint" : "number";
|
|
4
25
|
kind: "exclusiveMinimum";
|
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* Exclusive minimum value constraint tag.
|
|
4
|
+
*
|
|
5
|
+
* Enforces that a numeric value must be strictly greater than the specified
|
|
6
|
+
* minimum (not equal). This constraint validates that the input value
|
|
7
|
+
* satisfies: input > minimum.
|
|
8
|
+
*
|
|
9
|
+
* Example usage:
|
|
10
|
+
*
|
|
11
|
+
* ```typescript
|
|
12
|
+
* type PositiveNumber = number & tags.ExclusiveMinimum<0>; // Must be > 0
|
|
13
|
+
* type LargeCount = bigint & tags.ExclusiveMinimum<999n>; // Must be > 999
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Note: This tag is mutually exclusive with Minimum. You cannot apply both
|
|
17
|
+
* ExclusiveMinimum and Minimum constraints to the same property.
|
|
18
|
+
*
|
|
19
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
20
|
+
* @template Value - The exclusive minimum value constraint (number or bigint
|
|
21
|
+
* literal)
|
|
22
|
+
*/
|
|
2
23
|
export type ExclusiveMinimum<Value extends number | bigint> = TagBase<{
|
|
3
24
|
target: Value extends bigint ? "bigint" : "number";
|
|
4
25
|
kind: "exclusiveMinimum";
|
package/lib/tags/Format.d.mts
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
import type { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* String format constraint tag.
|
|
4
|
+
*
|
|
5
|
+
* Validates strings against predefined formats for common use cases. This tag
|
|
6
|
+
* provides built-in validation for standard string formats without needing to
|
|
7
|
+
* write custom regular expressions.
|
|
8
|
+
*
|
|
9
|
+
* Examples:
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* Type Email = string & Format<"email">; // user@example.com
|
|
13
|
+
* Type WebURL = string & Format<"url">; // https://example.com
|
|
14
|
+
* Type DateTime = string & Format<"date-time">; // 2024-01-15T10:30:00Z
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* Supported formats include:
|
|
18
|
+
*
|
|
19
|
+
* - Network: email, url, hostname, ipv4, ipv6, uri
|
|
20
|
+
* - Identifiers: uuid, byte, password
|
|
21
|
+
* - Date/Time: date, time, date-time, duration
|
|
22
|
+
* - Data: json-pointer, regex
|
|
23
|
+
* - Internationalized: idn-email, idn-hostname, iri
|
|
24
|
+
*
|
|
25
|
+
* Note: This tag is mutually exclusive with the Pattern tag. You cannot use
|
|
26
|
+
* both Format and Pattern on the same type.
|
|
27
|
+
*
|
|
28
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
29
|
+
*/
|
|
2
30
|
export type Format<Value extends Format.Value> = TagBase<{
|
|
3
31
|
target: "string";
|
|
4
32
|
kind: "format";
|
package/lib/tags/Format.d.ts
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
import type { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* String format constraint tag.
|
|
4
|
+
*
|
|
5
|
+
* Validates strings against predefined formats for common use cases. This tag
|
|
6
|
+
* provides built-in validation for standard string formats without needing to
|
|
7
|
+
* write custom regular expressions.
|
|
8
|
+
*
|
|
9
|
+
* Examples:
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* Type Email = string & Format<"email">; // user@example.com
|
|
13
|
+
* Type WebURL = string & Format<"url">; // https://example.com
|
|
14
|
+
* Type DateTime = string & Format<"date-time">; // 2024-01-15T10:30:00Z
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* Supported formats include:
|
|
18
|
+
*
|
|
19
|
+
* - Network: email, url, hostname, ipv4, ipv6, uri
|
|
20
|
+
* - Identifiers: uuid, byte, password
|
|
21
|
+
* - Date/Time: date, time, date-time, duration
|
|
22
|
+
* - Data: json-pointer, regex
|
|
23
|
+
* - Internationalized: idn-email, idn-hostname, iri
|
|
24
|
+
*
|
|
25
|
+
* Note: This tag is mutually exclusive with the Pattern tag. You cannot use
|
|
26
|
+
* both Format and Pattern on the same type.
|
|
27
|
+
*
|
|
28
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
29
|
+
*/
|
|
2
30
|
export type Format<Value extends Format.Value> = TagBase<{
|
|
3
31
|
target: "string";
|
|
4
32
|
kind: "format";
|
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* Injects custom properties into generated JSON Schema.
|
|
4
|
+
*
|
|
5
|
+
* The JsonSchemaPlugin tag allows you to add vendor-specific extensions or
|
|
6
|
+
* custom metadata to the generated JSON Schema output. These properties are
|
|
7
|
+
* merged at the root level of the schema and are commonly used for
|
|
8
|
+
* documentation, tooling hints, or API-specific metadata. The custom properties
|
|
9
|
+
* only affect schema generation and do not impact runtime validation.
|
|
10
|
+
*
|
|
11
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // Add OpenAPI vendor extensions
|
|
15
|
+
* type UserId = string & JsonSchemaPlugin<{
|
|
16
|
+
* "x-internal-id": true,
|
|
17
|
+
* "x-deprecated": "Use UUID instead"
|
|
18
|
+
* }>;
|
|
19
|
+
*
|
|
20
|
+
* // Add custom documentation metadata
|
|
21
|
+
* type Price = number & JsonSchemaPlugin<{
|
|
22
|
+
* "x-format": "currency",
|
|
23
|
+
* "x-example": 19.99
|
|
24
|
+
* }>;
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @template Schema - Object containing custom properties to add to the JSON
|
|
28
|
+
* Schema
|
|
29
|
+
*/
|
|
2
30
|
export type JsonSchemaPlugin<Schema extends object> = TagBase<{
|
|
3
31
|
target: "string" | "boolean" | "bigint" | "number" | "array" | "object";
|
|
4
32
|
kind: "jsonPlugin";
|
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* Injects custom properties into generated JSON Schema.
|
|
4
|
+
*
|
|
5
|
+
* The JsonSchemaPlugin tag allows you to add vendor-specific extensions or
|
|
6
|
+
* custom metadata to the generated JSON Schema output. These properties are
|
|
7
|
+
* merged at the root level of the schema and are commonly used for
|
|
8
|
+
* documentation, tooling hints, or API-specific metadata. The custom properties
|
|
9
|
+
* only affect schema generation and do not impact runtime validation.
|
|
10
|
+
*
|
|
11
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // Add OpenAPI vendor extensions
|
|
15
|
+
* type UserId = string & JsonSchemaPlugin<{
|
|
16
|
+
* "x-internal-id": true,
|
|
17
|
+
* "x-deprecated": "Use UUID instead"
|
|
18
|
+
* }>;
|
|
19
|
+
*
|
|
20
|
+
* // Add custom documentation metadata
|
|
21
|
+
* type Price = number & JsonSchemaPlugin<{
|
|
22
|
+
* "x-format": "currency",
|
|
23
|
+
* "x-example": 19.99
|
|
24
|
+
* }>;
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @template Schema - Object containing custom properties to add to the JSON
|
|
28
|
+
* Schema
|
|
29
|
+
*/
|
|
2
30
|
export type JsonSchemaPlugin<Schema extends object> = TagBase<{
|
|
3
31
|
target: "string" | "boolean" | "bigint" | "number" | "array" | "object";
|
|
4
32
|
kind: "jsonPlugin";
|
package/lib/tags/MaxItems.d.mts
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* Maximum items validation tag for arrays.
|
|
4
|
+
*
|
|
5
|
+
* Enforces that an array contains at most the specified number of items. This
|
|
6
|
+
* tag is useful for limiting array sizes, such as restricting the number of
|
|
7
|
+
* uploaded files, limiting selections in a form, or capping the size of
|
|
8
|
+
* collections to prevent performance issues.
|
|
9
|
+
*
|
|
10
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
11
|
+
* @example
|
|
12
|
+
* // Allow maximum 5 file uploads
|
|
13
|
+
* type FileList = File[] & MaxItems<5>;
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // Limit tags to 10 items
|
|
17
|
+
* type ProductTags = string[] & MaxItems<10>;
|
|
18
|
+
*
|
|
19
|
+
* @template Value - The maximum number of items allowed
|
|
20
|
+
*/
|
|
2
21
|
export type MaxItems<Value extends number> = TagBase<{
|
|
3
22
|
target: "array";
|
|
4
23
|
kind: "maxItems";
|
package/lib/tags/MaxItems.d.ts
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* Maximum items validation tag for arrays.
|
|
4
|
+
*
|
|
5
|
+
* Enforces that an array contains at most the specified number of items. This
|
|
6
|
+
* tag is useful for limiting array sizes, such as restricting the number of
|
|
7
|
+
* uploaded files, limiting selections in a form, or capping the size of
|
|
8
|
+
* collections to prevent performance issues.
|
|
9
|
+
*
|
|
10
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
11
|
+
* @example
|
|
12
|
+
* // Allow maximum 5 file uploads
|
|
13
|
+
* type FileList = File[] & MaxItems<5>;
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // Limit tags to 10 items
|
|
17
|
+
* type ProductTags = string[] & MaxItems<10>;
|
|
18
|
+
*
|
|
19
|
+
* @template Value - The maximum number of items allowed
|
|
20
|
+
*/
|
|
2
21
|
export type MaxItems<Value extends number> = TagBase<{
|
|
3
22
|
target: "array";
|
|
4
23
|
kind: "maxItems";
|
package/lib/tags/MaxLength.d.mts
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* String maximum length constraint tag.
|
|
4
|
+
*
|
|
5
|
+
* Validates that a string's length is less than or equal to the specified
|
|
6
|
+
* value. This tag enforces an upper limit on the number of characters in a
|
|
7
|
+
* string.
|
|
8
|
+
*
|
|
9
|
+
* Examples: type ShortComment = string & MaxLength<200>; // Comment limited to
|
|
10
|
+
* 200 characters type ZipCode = string & MaxLength<10>; // Zip code with max 10
|
|
11
|
+
* characters
|
|
12
|
+
*
|
|
13
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
14
|
+
*/
|
|
2
15
|
export type MaxLength<Value extends number> = TagBase<{
|
|
3
16
|
target: "string";
|
|
4
17
|
kind: "maxLength";
|
package/lib/tags/MaxLength.d.ts
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* String maximum length constraint tag.
|
|
4
|
+
*
|
|
5
|
+
* Validates that a string's length is less than or equal to the specified
|
|
6
|
+
* value. This tag enforces an upper limit on the number of characters in a
|
|
7
|
+
* string.
|
|
8
|
+
*
|
|
9
|
+
* Examples: type ShortComment = string & MaxLength<200>; // Comment limited to
|
|
10
|
+
* 200 characters type ZipCode = string & MaxLength<10>; // Zip code with max 10
|
|
11
|
+
* characters
|
|
12
|
+
*
|
|
13
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
14
|
+
*/
|
|
2
15
|
export type MaxLength<Value extends number> = TagBase<{
|
|
3
16
|
target: "string";
|
|
4
17
|
kind: "maxLength";
|
package/lib/tags/Maximum.d.mts
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* Maximum value constraint tag.
|
|
4
|
+
*
|
|
5
|
+
* Enforces that a numeric value must be less than or equal to the specified
|
|
6
|
+
* maximum. This constraint validates that the input value satisfies: input <=
|
|
7
|
+
* maximum.
|
|
8
|
+
*
|
|
9
|
+
* Example usage:
|
|
10
|
+
*
|
|
11
|
+
* ```typescript
|
|
12
|
+
* type Percentage = number & tags.Maximum<100>; // Must be <= 100
|
|
13
|
+
* type SmallInt = bigint & tags.Maximum<255n>; // BigInt must be <= 255
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Note: This tag is mutually exclusive with ExclusiveMaximum. You cannot apply
|
|
17
|
+
* both Maximum and ExclusiveMaximum constraints to the same property.
|
|
18
|
+
*
|
|
19
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
20
|
+
* @template Value - The maximum value constraint (number or bigint literal)
|
|
21
|
+
*/
|
|
2
22
|
export type Maximum<Value extends number | bigint> = TagBase<{
|
|
3
23
|
target: Value extends bigint ? "bigint" : "number";
|
|
4
24
|
kind: "maximum";
|
package/lib/tags/Maximum.d.ts
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* Maximum value constraint tag.
|
|
4
|
+
*
|
|
5
|
+
* Enforces that a numeric value must be less than or equal to the specified
|
|
6
|
+
* maximum. This constraint validates that the input value satisfies: input <=
|
|
7
|
+
* maximum.
|
|
8
|
+
*
|
|
9
|
+
* Example usage:
|
|
10
|
+
*
|
|
11
|
+
* ```typescript
|
|
12
|
+
* type Percentage = number & tags.Maximum<100>; // Must be <= 100
|
|
13
|
+
* type SmallInt = bigint & tags.Maximum<255n>; // BigInt must be <= 255
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Note: This tag is mutually exclusive with ExclusiveMaximum. You cannot apply
|
|
17
|
+
* both Maximum and ExclusiveMaximum constraints to the same property.
|
|
18
|
+
*
|
|
19
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
20
|
+
* @template Value - The maximum value constraint (number or bigint literal)
|
|
21
|
+
*/
|
|
2
22
|
export type Maximum<Value extends number | bigint> = TagBase<{
|
|
3
23
|
target: Value extends bigint ? "bigint" : "number";
|
|
4
24
|
kind: "maximum";
|
package/lib/tags/MinItems.d.mts
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* Minimum items validation tag for arrays.
|
|
4
|
+
*
|
|
5
|
+
* Enforces that an array contains at least the specified number of items. This
|
|
6
|
+
* tag is useful for ensuring arrays have a minimum length requirement, such as
|
|
7
|
+
* requiring at least one item in a list or a minimum number of selections in a
|
|
8
|
+
* multi-choice field.
|
|
9
|
+
*
|
|
10
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
11
|
+
* @example
|
|
12
|
+
* // Require at least 1 item in the array
|
|
13
|
+
* type Tags = string[] & MinItems<1>;
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // Require at least 3 selections
|
|
17
|
+
* type MultipleChoice = number[] & MinItems<3>;
|
|
18
|
+
*
|
|
19
|
+
* @template Value - The minimum number of items required
|
|
20
|
+
*/
|
|
2
21
|
export type MinItems<Value extends number> = TagBase<{
|
|
3
22
|
target: "array";
|
|
4
23
|
kind: "minItems";
|
package/lib/tags/MinItems.d.ts
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* Minimum items validation tag for arrays.
|
|
4
|
+
*
|
|
5
|
+
* Enforces that an array contains at least the specified number of items. This
|
|
6
|
+
* tag is useful for ensuring arrays have a minimum length requirement, such as
|
|
7
|
+
* requiring at least one item in a list or a minimum number of selections in a
|
|
8
|
+
* multi-choice field.
|
|
9
|
+
*
|
|
10
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
11
|
+
* @example
|
|
12
|
+
* // Require at least 1 item in the array
|
|
13
|
+
* type Tags = string[] & MinItems<1>;
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // Require at least 3 selections
|
|
17
|
+
* type MultipleChoice = number[] & MinItems<3>;
|
|
18
|
+
*
|
|
19
|
+
* @template Value - The minimum number of items required
|
|
20
|
+
*/
|
|
2
21
|
export type MinItems<Value extends number> = TagBase<{
|
|
3
22
|
target: "array";
|
|
4
23
|
kind: "minItems";
|
package/lib/tags/MinLength.d.mts
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* String minimum length constraint tag.
|
|
4
|
+
*
|
|
5
|
+
* Validates that a string's length is greater than or equal to the specified
|
|
6
|
+
* value. This tag ensures that string values meet a minimum character count
|
|
7
|
+
* requirement.
|
|
8
|
+
*
|
|
9
|
+
* Examples: type Username = string & MinLength<3>; // Username must be at least
|
|
10
|
+
* 3 characters type Password = string & MinLength<8>; // Password must be at
|
|
11
|
+
* least 8 characters
|
|
12
|
+
*
|
|
13
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
14
|
+
*/
|
|
2
15
|
export type MinLength<Value extends number> = TagBase<{
|
|
3
16
|
target: "string";
|
|
4
17
|
kind: "minLength";
|
package/lib/tags/MinLength.d.ts
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* String minimum length constraint tag.
|
|
4
|
+
*
|
|
5
|
+
* Validates that a string's length is greater than or equal to the specified
|
|
6
|
+
* value. This tag ensures that string values meet a minimum character count
|
|
7
|
+
* requirement.
|
|
8
|
+
*
|
|
9
|
+
* Examples: type Username = string & MinLength<3>; // Username must be at least
|
|
10
|
+
* 3 characters type Password = string & MinLength<8>; // Password must be at
|
|
11
|
+
* least 8 characters
|
|
12
|
+
*
|
|
13
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
14
|
+
*/
|
|
2
15
|
export type MinLength<Value extends number> = TagBase<{
|
|
3
16
|
target: "string";
|
|
4
17
|
kind: "minLength";
|
package/lib/tags/Minimum.d.mts
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* Minimum value constraint tag.
|
|
4
|
+
*
|
|
5
|
+
* Enforces that a numeric value must be greater than or equal to the specified
|
|
6
|
+
* minimum. This constraint validates that the input value satisfies: input >=
|
|
7
|
+
* minimum.
|
|
8
|
+
*
|
|
9
|
+
* Example usage:
|
|
10
|
+
*
|
|
11
|
+
* ```typescript
|
|
12
|
+
* type Age = number & tags.Minimum<0>; // Age must be 0 or greater
|
|
13
|
+
* type Balance = bigint & tags.Minimum<0n>; // BigInt balance must be non-negative
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Note: This tag is mutually exclusive with ExclusiveMinimum. You cannot apply
|
|
17
|
+
* both Minimum and ExclusiveMinimum constraints to the same property.
|
|
18
|
+
*
|
|
19
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
20
|
+
* @template Value - The minimum value constraint (number or bigint literal)
|
|
21
|
+
*/
|
|
2
22
|
export type Minimum<Value extends number | bigint> = TagBase<{
|
|
3
23
|
target: Value extends bigint ? "bigint" : "number";
|
|
4
24
|
kind: "minimum";
|
package/lib/tags/Minimum.d.ts
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* Minimum value constraint tag.
|
|
4
|
+
*
|
|
5
|
+
* Enforces that a numeric value must be greater than or equal to the specified
|
|
6
|
+
* minimum. This constraint validates that the input value satisfies: input >=
|
|
7
|
+
* minimum.
|
|
8
|
+
*
|
|
9
|
+
* Example usage:
|
|
10
|
+
*
|
|
11
|
+
* ```typescript
|
|
12
|
+
* type Age = number & tags.Minimum<0>; // Age must be 0 or greater
|
|
13
|
+
* type Balance = bigint & tags.Minimum<0n>; // BigInt balance must be non-negative
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Note: This tag is mutually exclusive with ExclusiveMinimum. You cannot apply
|
|
17
|
+
* both Minimum and ExclusiveMinimum constraints to the same property.
|
|
18
|
+
*
|
|
19
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
20
|
+
* @template Value - The minimum value constraint (number or bigint literal)
|
|
21
|
+
*/
|
|
2
22
|
export type Minimum<Value extends number | bigint> = TagBase<{
|
|
3
23
|
target: Value extends bigint ? "bigint" : "number";
|
|
4
24
|
kind: "minimum";
|
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* Multiple of constraint tag.
|
|
4
|
+
*
|
|
5
|
+
* Enforces that a numeric value must be an exact multiple of the specified
|
|
6
|
+
* divisor. This constraint validates that the input value satisfies: input %
|
|
7
|
+
* divisor === 0.
|
|
8
|
+
*
|
|
9
|
+
* Example usage:
|
|
10
|
+
*
|
|
11
|
+
* ```typescript
|
|
12
|
+
* type EvenNumber = number & tags.MultipleOf<2>; // Must be even (2, 4, 6, ...)
|
|
13
|
+
* type DollarAmount = number & tags.MultipleOf<0.01>; // Must be in cents
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Common use cases include validating even/odd numbers, currency amounts, time
|
|
17
|
+
* intervals, or any value that must align to specific increments.
|
|
18
|
+
*
|
|
19
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
20
|
+
* @template Value - The divisor value that input must be a multiple of (number
|
|
21
|
+
* or bigint literal)
|
|
22
|
+
*/
|
|
2
23
|
export type MultipleOf<Value extends number | bigint> = TagBase<{
|
|
3
24
|
target: Value extends bigint ? "bigint" : "number";
|
|
4
25
|
kind: "multipleOf";
|
package/lib/tags/MultipleOf.d.ts
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
import { TagBase } from "./TagBase";
|
|
2
|
+
/**
|
|
3
|
+
* Multiple of constraint tag.
|
|
4
|
+
*
|
|
5
|
+
* Enforces that a numeric value must be an exact multiple of the specified
|
|
6
|
+
* divisor. This constraint validates that the input value satisfies: input %
|
|
7
|
+
* divisor === 0.
|
|
8
|
+
*
|
|
9
|
+
* Example usage:
|
|
10
|
+
*
|
|
11
|
+
* ```typescript
|
|
12
|
+
* type EvenNumber = number & tags.MultipleOf<2>; // Must be even (2, 4, 6, ...)
|
|
13
|
+
* type DollarAmount = number & tags.MultipleOf<0.01>; // Must be in cents
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Common use cases include validating even/odd numbers, currency amounts, time
|
|
17
|
+
* intervals, or any value that must align to specific increments.
|
|
18
|
+
*
|
|
19
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
20
|
+
* @template Value - The divisor value that input must be a multiple of (number
|
|
21
|
+
* or bigint literal)
|
|
22
|
+
*/
|
|
2
23
|
export type MultipleOf<Value extends number | bigint> = TagBase<{
|
|
3
24
|
target: Value extends bigint ? "bigint" : "number";
|
|
4
25
|
kind: "multipleOf";
|