typia 5.0.0-dev.2023084 → 5.0.0

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.
Files changed (584) hide show
  1. package/README.md +1 -2
  2. package/lib/IRandomGenerator.d.ts +4 -3
  3. package/lib/Resolved.d.ts +1 -1
  4. package/lib/executable/TypiaGenerateWizard.js +1 -1
  5. package/lib/executable/TypiaGenerateWizard.js.map +1 -1
  6. package/lib/executable/TypiaSetupWizard.js +1 -1
  7. package/lib/executable/TypiaSetupWizard.js.map +1 -1
  8. package/lib/executable/setup/PackageManager.js +1 -1
  9. package/lib/executable/setup/PackageManager.js.map +1 -1
  10. package/lib/executable/setup/PluginConfigurator.js +2 -2
  11. package/lib/executable/setup/PluginConfigurator.js.map +1 -1
  12. package/lib/factories/ExpressionFactory.d.ts +3 -1
  13. package/lib/factories/ExpressionFactory.js +25 -1
  14. package/lib/factories/ExpressionFactory.js.map +1 -1
  15. package/lib/factories/IdentifierFactory.d.ts +2 -1
  16. package/lib/factories/IdentifierFactory.js +11 -0
  17. package/lib/factories/IdentifierFactory.js.map +1 -1
  18. package/lib/factories/JsonMetadataFactory.d.ts +7 -0
  19. package/lib/factories/JsonMetadataFactory.js +38 -0
  20. package/lib/factories/JsonMetadataFactory.js.map +1 -0
  21. package/lib/factories/LiteralFactory.js +6 -2
  22. package/lib/factories/LiteralFactory.js.map +1 -1
  23. package/lib/factories/MetadataCollection.d.ts +7 -7
  24. package/lib/factories/MetadataCollection.js +4 -6
  25. package/lib/factories/MetadataCollection.js.map +1 -1
  26. package/lib/factories/MetadataCommentTagFactory.js +543 -0
  27. package/lib/factories/MetadataCommentTagFactory.js.map +1 -0
  28. package/lib/factories/MetadataFactory.d.ts +22 -2
  29. package/lib/factories/MetadataFactory.js +248 -17
  30. package/lib/factories/MetadataFactory.js.map +1 -1
  31. package/lib/factories/MetadataTypeTagFactory.d.ts +7 -0
  32. package/lib/factories/MetadataTypeTagFactory.js +280 -0
  33. package/lib/factories/MetadataTypeTagFactory.js.map +1 -0
  34. package/lib/factories/NumericRangeFactory.d.ts +6 -0
  35. package/lib/factories/NumericRangeFactory.js +34 -0
  36. package/lib/factories/NumericRangeFactory.js.map +1 -0
  37. package/lib/factories/ProtobufFactory.js +137 -91
  38. package/lib/factories/ProtobufFactory.js.map +1 -1
  39. package/lib/factories/TypeFactory.d.ts +0 -1
  40. package/lib/factories/TypeFactory.js +0 -5
  41. package/lib/factories/TypeFactory.js.map +1 -1
  42. package/lib/factories/internal/metadata/emend_metadata_atomics.js +7 -1
  43. package/lib/factories/internal/metadata/emend_metadata_atomics.js.map +1 -1
  44. package/lib/factories/internal/metadata/emplace_metadata_alias.d.ts +1 -1
  45. package/lib/factories/internal/metadata/emplace_metadata_alias.js +20 -19
  46. package/lib/factories/internal/metadata/emplace_metadata_alias.js.map +1 -1
  47. package/lib/factories/internal/metadata/emplace_metadata_array_type.d.ts +5 -0
  48. package/lib/factories/internal/metadata/emplace_metadata_array_type.js +51 -0
  49. package/lib/factories/internal/metadata/emplace_metadata_array_type.js.map +1 -0
  50. package/lib/factories/internal/metadata/emplace_metadata_object.d.ts +1 -1
  51. package/lib/factories/internal/metadata/emplace_metadata_object.js +100 -85
  52. package/lib/factories/internal/metadata/emplace_metadata_object.js.map +1 -1
  53. package/lib/factories/internal/metadata/emplace_metadata_tuple.d.ts +2 -2
  54. package/lib/factories/internal/metadata/emplace_metadata_tuple.js +34 -21
  55. package/lib/factories/internal/metadata/emplace_metadata_tuple.js.map +1 -1
  56. package/lib/factories/internal/metadata/explore_metadata.d.ts +1 -1
  57. package/lib/factories/internal/metadata/explore_metadata.js +12 -12
  58. package/lib/factories/internal/metadata/explore_metadata.js.map +1 -1
  59. package/lib/factories/internal/metadata/iterate_metadata.d.ts +1 -1
  60. package/lib/factories/internal/metadata/iterate_metadata.js +39 -19
  61. package/lib/factories/internal/metadata/iterate_metadata.js.map +1 -1
  62. package/lib/factories/internal/metadata/iterate_metadata_alias.d.ts +1 -1
  63. package/lib/factories/internal/metadata/iterate_metadata_alias.js +12 -10
  64. package/lib/factories/internal/metadata/iterate_metadata_alias.js.map +1 -1
  65. package/lib/factories/internal/metadata/iterate_metadata_array.d.ts +1 -1
  66. package/lib/factories/internal/metadata/iterate_metadata_array.js +13 -7
  67. package/lib/factories/internal/metadata/iterate_metadata_array.js.map +1 -1
  68. package/lib/factories/internal/metadata/iterate_metadata_atomic.js +2 -1
  69. package/lib/factories/internal/metadata/iterate_metadata_atomic.js.map +1 -1
  70. package/lib/factories/internal/metadata/iterate_metadata_collection.d.ts +2 -1
  71. package/lib/factories/internal/metadata/iterate_metadata_collection.js +66 -56
  72. package/lib/factories/internal/metadata/iterate_metadata_collection.js.map +1 -1
  73. package/lib/factories/internal/metadata/iterate_metadata_comment_tags.d.ts +3 -0
  74. package/lib/factories/internal/metadata/iterate_metadata_comment_tags.js +45 -0
  75. package/lib/factories/internal/metadata/iterate_metadata_comment_tags.js.map +1 -0
  76. package/lib/factories/internal/metadata/iterate_metadata_intersection.d.ts +1 -1
  77. package/lib/factories/internal/metadata/iterate_metadata_intersection.js +175 -41
  78. package/lib/factories/internal/metadata/iterate_metadata_intersection.js.map +1 -1
  79. package/lib/factories/internal/metadata/iterate_metadata_map.d.ts +1 -1
  80. package/lib/factories/internal/metadata/iterate_metadata_map.js +28 -15
  81. package/lib/factories/internal/metadata/iterate_metadata_map.js.map +1 -1
  82. package/lib/factories/internal/metadata/iterate_metadata_object.d.ts +1 -1
  83. package/lib/factories/internal/metadata/iterate_metadata_object.js +16 -21
  84. package/lib/factories/internal/metadata/iterate_metadata_object.js.map +1 -1
  85. package/lib/factories/internal/metadata/iterate_metadata_resolve.d.ts +1 -1
  86. package/lib/factories/internal/metadata/iterate_metadata_resolve.js +28 -15
  87. package/lib/factories/internal/metadata/iterate_metadata_resolve.js.map +1 -1
  88. package/lib/factories/internal/metadata/iterate_metadata_set.d.ts +1 -1
  89. package/lib/factories/internal/metadata/iterate_metadata_set.js +24 -11
  90. package/lib/factories/internal/metadata/iterate_metadata_set.js.map +1 -1
  91. package/lib/factories/internal/metadata/iterate_metadata_sort.js +2 -2
  92. package/lib/factories/internal/metadata/iterate_metadata_sort.js.map +1 -1
  93. package/lib/factories/internal/metadata/iterate_metadata_template.d.ts +1 -1
  94. package/lib/factories/internal/metadata/iterate_metadata_template.js +28 -15
  95. package/lib/factories/internal/metadata/iterate_metadata_template.js.map +1 -1
  96. package/lib/factories/internal/metadata/iterate_metadata_tuple.d.ts +1 -1
  97. package/lib/factories/internal/metadata/iterate_metadata_tuple.js +12 -6
  98. package/lib/factories/internal/metadata/iterate_metadata_tuple.js.map +1 -1
  99. package/lib/factories/internal/metadata/iterate_metadata_union.d.ts +1 -1
  100. package/lib/factories/internal/metadata/iterate_metadata_union.js +20 -7
  101. package/lib/factories/internal/metadata/iterate_metadata_union.js.map +1 -1
  102. package/lib/functional/$any.js +2 -1
  103. package/lib/functional/$any.js.map +1 -1
  104. package/lib/functional/$clone.d.ts +2 -0
  105. package/lib/functional/$clone.js +8 -0
  106. package/lib/functional/$clone.js.map +1 -0
  107. package/lib/functional/Namespace.js +0 -16
  108. package/lib/functional/Namespace.js.map +1 -1
  109. package/lib/module.d.ts +2 -39
  110. package/lib/module.js +3 -17
  111. package/lib/module.js.map +1 -1
  112. package/lib/programmers/AssertProgrammer.js +28 -10
  113. package/lib/programmers/AssertProgrammer.js.map +1 -1
  114. package/lib/programmers/CheckerProgrammer.js +97 -70
  115. package/lib/programmers/CheckerProgrammer.js.map +1 -1
  116. package/lib/programmers/FeatureProgrammer.d.ts +3 -5
  117. package/lib/programmers/FeatureProgrammer.js +7 -7
  118. package/lib/programmers/FeatureProgrammer.js.map +1 -1
  119. package/lib/programmers/IsProgrammer.d.ts +1 -1
  120. package/lib/programmers/IsProgrammer.js +33 -22
  121. package/lib/programmers/IsProgrammer.js.map +1 -1
  122. package/lib/programmers/RandomProgrammer.js +196 -160
  123. package/lib/programmers/RandomProgrammer.js.map +1 -1
  124. package/lib/programmers/TypiaProgrammer.js +87 -28
  125. package/lib/programmers/TypiaProgrammer.js.map +1 -1
  126. package/lib/programmers/ValidateProgrammer.js +28 -10
  127. package/lib/programmers/ValidateProgrammer.js.map +1 -1
  128. package/lib/programmers/helpers/CloneJoiner.js +10 -2
  129. package/lib/programmers/helpers/CloneJoiner.js.map +1 -1
  130. package/lib/programmers/helpers/ICheckEntry.d.ts +4 -3
  131. package/lib/programmers/helpers/ProtobufUtil.d.ts +6 -2
  132. package/lib/programmers/helpers/ProtobufUtil.js +175 -17
  133. package/lib/programmers/helpers/ProtobufUtil.js.map +1 -1
  134. package/lib/programmers/helpers/RandomJoiner.d.ts +3 -5
  135. package/lib/programmers/helpers/RandomJoiner.js +7 -10
  136. package/lib/programmers/helpers/RandomJoiner.js.map +1 -1
  137. package/lib/programmers/helpers/RandomRanger.d.ts +5 -6
  138. package/lib/programmers/helpers/RandomRanger.js +13 -33
  139. package/lib/programmers/helpers/RandomRanger.js.map +1 -1
  140. package/lib/programmers/helpers/UnionExplorer.d.ts +7 -8
  141. package/lib/programmers/helpers/UnionExplorer.js +46 -35
  142. package/lib/programmers/helpers/UnionExplorer.js.map +1 -1
  143. package/lib/programmers/internal/application_alias.js +0 -1
  144. package/lib/programmers/internal/application_alias.js.map +1 -1
  145. package/lib/programmers/internal/application_array.js +60 -20
  146. package/lib/programmers/internal/application_array.js.map +1 -1
  147. package/lib/programmers/internal/application_escaped.d.ts +4 -0
  148. package/lib/programmers/internal/{application_resolved.js → application_escaped.js} +6 -6
  149. package/lib/programmers/internal/application_escaped.js.map +1 -0
  150. package/lib/programmers/internal/application_number.js +95 -69
  151. package/lib/programmers/internal/application_number.js.map +1 -1
  152. package/lib/programmers/internal/application_object.js +0 -3
  153. package/lib/programmers/internal/application_object.js.map +1 -1
  154. package/lib/programmers/internal/application_schema.js +41 -24
  155. package/lib/programmers/internal/application_schema.js.map +1 -1
  156. package/lib/programmers/internal/application_string.js +56 -22
  157. package/lib/programmers/internal/application_string.js.map +1 -1
  158. package/lib/programmers/internal/application_tuple.js +10 -9
  159. package/lib/programmers/internal/application_tuple.js.map +1 -1
  160. package/lib/programmers/internal/check_array_length.js +25 -25
  161. package/lib/programmers/internal/check_array_length.js.map +1 -1
  162. package/lib/programmers/internal/check_bigint.js +20 -109
  163. package/lib/programmers/internal/check_bigint.js.map +1 -1
  164. package/lib/programmers/internal/check_dynamic_properties.js +1 -1
  165. package/lib/programmers/internal/check_dynamic_properties.js.map +1 -1
  166. package/lib/programmers/internal/check_number.js +57 -147
  167. package/lib/programmers/internal/check_number.js.map +1 -1
  168. package/lib/programmers/internal/check_string.js +21 -33
  169. package/lib/programmers/internal/check_string.js.map +1 -1
  170. package/lib/programmers/internal/check_template.js +31 -49
  171. package/lib/programmers/internal/check_template.js.map +1 -1
  172. package/lib/programmers/internal/check_union_array_like.js +7 -6
  173. package/lib/programmers/internal/check_union_array_like.js.map +1 -1
  174. package/lib/programmers/internal/feature_object_entries.js +1 -1
  175. package/lib/programmers/internal/feature_object_entries.js.map +1 -1
  176. package/lib/programmers/internal/random_custom.js +8 -2
  177. package/lib/programmers/internal/random_custom.js.map +1 -1
  178. package/lib/programmers/internal/wrap_metadata_rest_tuple.js +9 -5
  179. package/lib/programmers/internal/wrap_metadata_rest_tuple.js.map +1 -1
  180. package/lib/programmers/json/JsonApplicationProgrammer.js +5 -1
  181. package/lib/programmers/json/JsonApplicationProgrammer.js.map +1 -1
  182. package/lib/programmers/json/JsonAssertParseProgrammer.js +2 -0
  183. package/lib/programmers/json/JsonAssertParseProgrammer.js.map +1 -1
  184. package/lib/programmers/json/JsonIsParseProgrammer.js +2 -0
  185. package/lib/programmers/json/JsonIsParseProgrammer.js.map +1 -1
  186. package/lib/programmers/json/JsonStringifyProgrammer.js +48 -85
  187. package/lib/programmers/json/JsonStringifyProgrammer.js.map +1 -1
  188. package/lib/programmers/json/JsonValidateParseProgrammer.js +2 -0
  189. package/lib/programmers/json/JsonValidateParseProgrammer.js.map +1 -1
  190. package/lib/programmers/misc/MiscCloneProgrammer.js +34 -25
  191. package/lib/programmers/misc/MiscCloneProgrammer.js.map +1 -1
  192. package/lib/programmers/{IsPruneProgrammer.d.ts → misc/MiscIsPruneProgrammer.d.ts} +2 -2
  193. package/lib/programmers/{IsPruneProgrammer.js → misc/MiscIsPruneProgrammer.js} +11 -11
  194. package/lib/programmers/misc/MiscIsPruneProgrammer.js.map +1 -0
  195. package/lib/programmers/misc/MiscLiteralsProgrammer.js +10 -5
  196. package/lib/programmers/misc/MiscLiteralsProgrammer.js.map +1 -1
  197. package/lib/programmers/misc/MiscPruneProgrammer.js +34 -25
  198. package/lib/programmers/misc/MiscPruneProgrammer.js.map +1 -1
  199. package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js +48 -48
  200. package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js.map +1 -1
  201. package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js +152 -69
  202. package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js.map +1 -1
  203. package/lib/programmers/protobuf/ProtobufMessageProgrammer.js +80 -85
  204. package/lib/programmers/protobuf/ProtobufMessageProgrammer.js.map +1 -1
  205. package/lib/protobuf.d.ts +34 -34
  206. package/lib/schemas/json/IJsonSchema.d.ts +10 -38
  207. package/lib/schemas/metadata/IMetadata.d.ts +9 -2
  208. package/lib/schemas/metadata/IMetadataAlias.d.ts +0 -2
  209. package/lib/schemas/metadata/IMetadataArray.d.ts +4 -6
  210. package/lib/schemas/metadata/IMetadataArrayType.d.ts +8 -0
  211. package/lib/{CustomValidatorMap.js → schemas/metadata/IMetadataArrayType.js} +1 -1
  212. package/lib/schemas/metadata/IMetadataArrayType.js.map +1 -0
  213. package/lib/schemas/metadata/IMetadataAtomic.d.ts +3 -10
  214. package/lib/schemas/metadata/IMetadataCollection.d.ts +4 -4
  215. package/lib/schemas/metadata/IMetadataProperty.d.ts +0 -2
  216. package/lib/schemas/metadata/IMetadataTuple.d.ts +4 -6
  217. package/lib/schemas/metadata/IMetadataTupleType.d.ts +8 -0
  218. package/lib/schemas/metadata/IMetadataTupleType.js +3 -0
  219. package/lib/schemas/metadata/IMetadataTupleType.js.map +1 -0
  220. package/lib/schemas/metadata/IMetadataTypeTag.d.ts +8 -0
  221. package/lib/schemas/metadata/IMetadataTypeTag.js +3 -0
  222. package/lib/schemas/metadata/IMetadataTypeTag.js.map +1 -0
  223. package/lib/schemas/metadata/Metadata.d.ts +2 -2
  224. package/lib/schemas/metadata/Metadata.js +177 -122
  225. package/lib/schemas/metadata/Metadata.js.map +1 -1
  226. package/lib/schemas/metadata/MetadataAlias.d.ts +0 -2
  227. package/lib/schemas/metadata/MetadataAlias.js +0 -3
  228. package/lib/schemas/metadata/MetadataAlias.js.map +1 -1
  229. package/lib/schemas/metadata/MetadataArray.d.ts +8 -6
  230. package/lib/schemas/metadata/MetadataArray.js +48 -19
  231. package/lib/schemas/metadata/MetadataArray.js.map +1 -1
  232. package/lib/schemas/metadata/MetadataArrayType.d.ts +14 -0
  233. package/lib/schemas/metadata/MetadataArrayType.js +36 -0
  234. package/lib/schemas/metadata/MetadataArrayType.js.map +1 -0
  235. package/lib/schemas/metadata/MetadataAtomic.d.ts +9 -0
  236. package/lib/schemas/metadata/MetadataAtomic.js +59 -0
  237. package/lib/schemas/metadata/MetadataAtomic.js.map +1 -0
  238. package/lib/schemas/metadata/MetadataProperty.d.ts +0 -2
  239. package/lib/schemas/metadata/MetadataProperty.js +0 -3
  240. package/lib/schemas/metadata/MetadataProperty.js.map +1 -1
  241. package/lib/schemas/metadata/MetadataTuple.d.ts +8 -8
  242. package/lib/schemas/metadata/MetadataTuple.js +4 -19
  243. package/lib/schemas/metadata/MetadataTuple.js.map +1 -1
  244. package/lib/schemas/metadata/MetadataTupleType.d.ts +13 -0
  245. package/lib/schemas/metadata/MetadataTupleType.js +40 -0
  246. package/lib/schemas/metadata/MetadataTupleType.js.map +1 -0
  247. package/lib/tags/ExclusiveMaximum.d.ts +10 -8
  248. package/lib/tags/ExclusiveMinimum.d.ts +10 -8
  249. package/lib/tags/Format.d.ts +8 -8
  250. package/lib/tags/MaxItems.d.ts +8 -8
  251. package/lib/tags/MaxLength.d.ts +8 -8
  252. package/lib/tags/Maximum.d.ts +10 -8
  253. package/lib/tags/MinItems.d.ts +8 -8
  254. package/lib/tags/MinLength.d.ts +8 -8
  255. package/lib/tags/Minimum.d.ts +10 -8
  256. package/lib/tags/MultipleOf.d.ts +10 -8
  257. package/lib/tags/Pattern.d.ts +7 -8
  258. package/lib/tags/TagBase.d.ts +52 -6
  259. package/lib/tags/Type.d.ts +14 -13
  260. package/lib/tags/index.d.ts +1 -0
  261. package/lib/tags/index.js +1 -0
  262. package/lib/tags/index.js.map +1 -1
  263. package/lib/transform.d.ts +2 -1
  264. package/lib/transform.js +11 -3
  265. package/lib/transform.js.map +1 -1
  266. package/lib/transformers/CallExpressionTransformer.d.ts +1 -1
  267. package/lib/transformers/CallExpressionTransformer.js +2 -1
  268. package/lib/transformers/CallExpressionTransformer.js.map +1 -1
  269. package/lib/transformers/FileTransformer.d.ts +1 -1
  270. package/lib/transformers/FileTransformer.js +30 -7
  271. package/lib/transformers/FileTransformer.js.map +1 -1
  272. package/lib/transformers/IProject.d.ts +4 -0
  273. package/lib/transformers/NodeTransformer.d.ts +1 -1
  274. package/lib/transformers/TransformerError.d.ts +12 -0
  275. package/lib/transformers/TransformerError.js +66 -0
  276. package/lib/transformers/TransformerError.js.map +1 -0
  277. package/lib/transformers/features/AssertTransformer.d.ts +1 -0
  278. package/lib/transformers/features/CreateAssertTransformer.d.ts +1 -0
  279. package/lib/transformers/features/CreateIsTransformer.d.ts +1 -0
  280. package/lib/transformers/features/CreateRandomTransformer.js +9 -4
  281. package/lib/transformers/features/CreateRandomTransformer.js.map +1 -1
  282. package/lib/transformers/features/CreateValidateTransformer.d.ts +1 -0
  283. package/lib/transformers/features/IsTransformer.d.ts +1 -0
  284. package/lib/transformers/features/RandomTransformer.js +9 -4
  285. package/lib/transformers/features/RandomTransformer.js.map +1 -1
  286. package/lib/transformers/features/ValidateTransformer.d.ts +1 -0
  287. package/lib/transformers/features/json/JsonApplicationTransformer.js +79 -17
  288. package/lib/transformers/features/json/JsonApplicationTransformer.js.map +1 -1
  289. package/lib/transformers/features/json/JsonAssertParseTransformer.d.ts +1 -0
  290. package/lib/transformers/features/json/JsonAssertStringifyTransformer.d.ts +1 -0
  291. package/lib/transformers/features/json/JsonCreateAssertParseTransformer.d.ts +1 -0
  292. package/lib/transformers/features/json/JsonCreateAssertStringifyTransformer.d.ts +1 -0
  293. package/lib/transformers/features/json/JsonCreateIsParseTransformer.d.ts +1 -0
  294. package/lib/transformers/features/json/JsonCreateIsStringifyTransformer.d.ts +1 -0
  295. package/lib/transformers/features/json/JsonCreateStringifyTransformer.d.ts +1 -0
  296. package/lib/transformers/features/json/JsonCreateValidateParseTransformer.d.ts +1 -0
  297. package/lib/transformers/features/json/JsonCreateValidateStringifyProgrammer.d.ts +1 -0
  298. package/lib/transformers/features/json/JsonIsParseTransformer.d.ts +1 -0
  299. package/lib/transformers/features/json/JsonIsStringifyTransformer.d.ts +1 -0
  300. package/lib/transformers/features/json/JsonStringifyTransformer.d.ts +1 -0
  301. package/lib/transformers/features/json/JsonValidateParseTransformer.d.ts +1 -0
  302. package/lib/transformers/features/json/JsonValidateStringifyTransformer.d.ts +1 -0
  303. package/lib/transformers/features/misc/MetadataTransformer.js +13 -5
  304. package/lib/transformers/features/misc/MetadataTransformer.js.map +1 -1
  305. package/lib/transformers/features/misc/MiscAssertCloneTransformer.d.ts +1 -0
  306. package/lib/transformers/features/misc/MiscAssertPruneTransformer.d.ts +1 -0
  307. package/lib/transformers/features/misc/MiscCloneTransformer.d.ts +1 -0
  308. package/lib/transformers/features/misc/MiscCreateAssertCloneTransformer.d.ts +1 -0
  309. package/lib/transformers/features/misc/MiscCreateAssertPruneTransformer.d.ts +1 -0
  310. package/lib/transformers/features/misc/MiscCreateCloneTransformer.d.ts +1 -0
  311. package/lib/transformers/features/misc/MiscCreateIsCloneTransformer.d.ts +1 -0
  312. package/lib/transformers/features/misc/MiscCreateIsPruneTransformer.d.ts +1 -0
  313. package/lib/transformers/features/misc/MiscCreateIsPruneTransformer.js +2 -2
  314. package/lib/transformers/features/misc/MiscCreateIsPruneTransformer.js.map +1 -1
  315. package/lib/transformers/features/misc/MiscCreatePruneTransformer.d.ts +1 -0
  316. package/lib/transformers/features/misc/MiscCreateValidateCloneTransformer.d.ts +1 -0
  317. package/lib/transformers/features/misc/MiscCreateValidatePruneTransformer.d.ts +1 -0
  318. package/lib/transformers/features/misc/MiscIsCloneTransformer.d.ts +1 -0
  319. package/lib/transformers/features/misc/MiscIsPruneTransformer.d.ts +1 -0
  320. package/lib/transformers/features/misc/MiscIsPruneTransformer.js +2 -2
  321. package/lib/transformers/features/misc/MiscIsPruneTransformer.js.map +1 -1
  322. package/lib/transformers/features/misc/MiscLiteralsTransformer.js +9 -4
  323. package/lib/transformers/features/misc/MiscLiteralsTransformer.js.map +1 -1
  324. package/lib/transformers/features/misc/MiscPruneTransformer.d.ts +1 -0
  325. package/lib/transformers/features/misc/MiscValidateCloneTransformer.d.ts +1 -0
  326. package/lib/transformers/features/misc/MiscValidatePruneTransformer.d.ts +1 -0
  327. package/lib/transformers/features/protobuf/CreateProtobufAssertDecodeTransformer.d.ts +1 -0
  328. package/lib/transformers/features/protobuf/CreateProtobufAssertEncodeTransformer.d.ts +1 -0
  329. package/lib/transformers/features/protobuf/CreateProtobufDecodeTransformer.d.ts +1 -0
  330. package/lib/transformers/features/protobuf/CreateProtobufEncodeTransformer.d.ts +1 -0
  331. package/lib/transformers/features/protobuf/CreateProtobufIsDecodeTransformer.d.ts +1 -0
  332. package/lib/transformers/features/protobuf/CreateProtobufIsEncodeTransformer.d.ts +1 -0
  333. package/lib/transformers/features/protobuf/CreateProtobufValidateDecodeTransformer.d.ts +1 -0
  334. package/lib/transformers/features/protobuf/CreateProtobufValidateEncodeTransformer.d.ts +1 -0
  335. package/lib/transformers/features/protobuf/ProtobufAssertDecodeTransformer.d.ts +1 -0
  336. package/lib/transformers/features/protobuf/ProtobufAssertEncodeTransformer.d.ts +1 -0
  337. package/lib/transformers/features/protobuf/ProtobufDecodeTransformer.d.ts +1 -0
  338. package/lib/transformers/features/protobuf/ProtobufEncodeTransformer.d.ts +1 -0
  339. package/lib/transformers/features/protobuf/ProtobufIsDecodeTransformer.d.ts +1 -0
  340. package/lib/transformers/features/protobuf/ProtobufIsEncodeTransformer.d.ts +1 -0
  341. package/lib/transformers/features/protobuf/ProtobufMessageTransformer.js +9 -2
  342. package/lib/transformers/features/protobuf/ProtobufMessageTransformer.js.map +1 -1
  343. package/lib/transformers/features/protobuf/ProtobufValidateDecodeTransformer.d.ts +1 -0
  344. package/lib/transformers/features/protobuf/ProtobufValidateEncodeTransformer.d.ts +1 -0
  345. package/lib/transformers/internal/GenericTransformer.js +17 -4
  346. package/lib/transformers/internal/GenericTransformer.js.map +1 -1
  347. package/lib/typings/ProtobufAtomic.d.ts +5 -0
  348. package/lib/{schemas/metadata/ICommentTag.js → typings/ProtobufAtomic.js} +1 -1
  349. package/lib/typings/ProtobufAtomic.js.map +1 -0
  350. package/lib/typings/ValidationPipe.d.ts +7 -0
  351. package/lib/{schemas/metadata/IMetadataTag.js → typings/ValidationPipe.js} +1 -1
  352. package/lib/typings/ValidationPipe.js.map +1 -0
  353. package/package.json +6 -2
  354. package/src/IRandomGenerator.ts +4 -3
  355. package/src/Primitive.ts +135 -135
  356. package/src/Resolved.ts +116 -116
  357. package/src/executable/TypiaGenerateWizard.ts +1 -1
  358. package/src/executable/TypiaSetupWizard.ts +1 -1
  359. package/src/executable/setup/PackageManager.ts +1 -1
  360. package/src/executable/setup/PluginConfigurator.ts +2 -2
  361. package/src/factories/ExpressionFactory.ts +46 -2
  362. package/src/factories/IdentifierFactory.ts +15 -0
  363. package/src/factories/JsonMetadataFactory.ts +43 -0
  364. package/src/factories/LiteralFactory.ts +11 -3
  365. package/src/factories/MetadataCollection.ts +18 -18
  366. package/src/factories/MetadataCommentTagFactory.ts +629 -0
  367. package/src/factories/MetadataFactory.ts +214 -46
  368. package/src/factories/MetadataTypeTagFactory.ts +313 -0
  369. package/src/factories/NumericRangeFactory.ts +33 -0
  370. package/src/factories/ProtobufFactory.ts +272 -268
  371. package/src/factories/TypeFactory.ts +0 -5
  372. package/src/factories/internal/metadata/emend_metadata_atomics.ts +40 -35
  373. package/src/factories/internal/metadata/emplace_metadata_alias.ts +12 -11
  374. package/src/factories/internal/metadata/{emplace_metadata_array.ts → emplace_metadata_array_type.ts} +14 -7
  375. package/src/factories/internal/metadata/emplace_metadata_object.ts +20 -6
  376. package/src/factories/internal/metadata/emplace_metadata_tuple.ts +13 -3
  377. package/src/factories/internal/metadata/explore_metadata.ts +32 -38
  378. package/src/factories/internal/metadata/iterate_metadata.ts +44 -24
  379. package/src/factories/internal/metadata/iterate_metadata_alias.ts +7 -2
  380. package/src/factories/internal/metadata/iterate_metadata_array.ts +19 -6
  381. package/src/factories/internal/metadata/iterate_metadata_atomic.ts +62 -63
  382. package/src/factories/internal/metadata/iterate_metadata_collection.ts +141 -133
  383. package/src/factories/internal/metadata/iterate_metadata_comment_tags.ts +26 -0
  384. package/src/factories/internal/metadata/iterate_metadata_intersection.ts +141 -28
  385. package/src/factories/internal/metadata/iterate_metadata_map.ts +20 -4
  386. package/src/factories/internal/metadata/iterate_metadata_native.ts +210 -210
  387. package/src/factories/internal/metadata/iterate_metadata_object.ts +12 -11
  388. package/src/factories/internal/metadata/iterate_metadata_resolve.ts +52 -49
  389. package/src/factories/internal/metadata/iterate_metadata_set.ts +11 -2
  390. package/src/factories/internal/metadata/iterate_metadata_sort.ts +69 -69
  391. package/src/factories/internal/metadata/iterate_metadata_template.ts +12 -3
  392. package/src/factories/internal/metadata/iterate_metadata_tuple.ts +18 -5
  393. package/src/factories/internal/metadata/iterate_metadata_union.ts +10 -7
  394. package/src/functional/$ProtobufWriter.ts +151 -151
  395. package/src/functional/$any.ts +3 -1
  396. package/src/functional/$clone.ts +4 -0
  397. package/src/functional/Namespace.ts +0 -16
  398. package/src/json.ts +648 -648
  399. package/src/misc.ts +651 -651
  400. package/src/module.ts +656 -709
  401. package/src/programmers/AssertProgrammer.ts +317 -281
  402. package/src/programmers/CheckerProgrammer.ts +1137 -1174
  403. package/src/programmers/FeatureProgrammer.ts +13 -32
  404. package/src/programmers/IsProgrammer.ts +252 -241
  405. package/src/programmers/RandomProgrammer.ts +878 -874
  406. package/src/programmers/TypiaProgrammer.ts +36 -2
  407. package/src/programmers/ValidateProgrammer.ts +346 -307
  408. package/src/programmers/helpers/AtomicPredicator.ts +31 -31
  409. package/src/programmers/helpers/CloneJoiner.ts +57 -20
  410. package/src/programmers/helpers/FunctionImporeter.ts +91 -91
  411. package/src/programmers/helpers/ICheckEntry.ts +4 -3
  412. package/src/programmers/helpers/ProtobufUtil.ts +125 -29
  413. package/src/programmers/helpers/RandomJoiner.ts +11 -33
  414. package/src/programmers/helpers/RandomRanger.ts +16 -51
  415. package/src/programmers/helpers/StringifyPredicator.ts +12 -12
  416. package/src/programmers/helpers/UnionExplorer.ts +46 -51
  417. package/src/programmers/helpers/disable_function_importer_declare.ts +32 -32
  418. package/src/programmers/internal/application_alias.ts +0 -1
  419. package/src/programmers/internal/application_array.ts +33 -10
  420. package/src/programmers/internal/application_default_string.ts +37 -37
  421. package/src/programmers/internal/{application_resolved.ts → application_escaped.ts} +55 -55
  422. package/src/programmers/internal/application_number.ts +76 -70
  423. package/src/programmers/internal/application_object.ts +0 -3
  424. package/src/programmers/internal/application_schema.ts +175 -157
  425. package/src/programmers/internal/application_string.ts +33 -27
  426. package/src/programmers/internal/application_tuple.ts +12 -11
  427. package/src/programmers/internal/check_array_length.ts +34 -28
  428. package/src/programmers/internal/check_bigint.ts +26 -91
  429. package/src/programmers/internal/check_dynamic_properties.ts +1 -2
  430. package/src/programmers/internal/check_number.ts +83 -236
  431. package/src/programmers/internal/check_string.ts +37 -17
  432. package/src/programmers/internal/check_template.ts +17 -12
  433. package/src/programmers/internal/check_union_array_like.ts +4 -18
  434. package/src/programmers/internal/feature_object_entries.ts +12 -18
  435. package/src/programmers/internal/metadata_to_pattern.ts +34 -34
  436. package/src/programmers/internal/random_custom.ts +11 -3
  437. package/src/programmers/internal/stringify_dynamic_properties.ts +171 -171
  438. package/src/programmers/internal/wrap_metadata_rest_tuple.ts +9 -5
  439. package/src/programmers/json/JsonApplicationProgrammer.ts +6 -3
  440. package/src/programmers/json/JsonAssertParseProgrammer.ts +7 -2
  441. package/src/programmers/json/JsonIsParseProgrammer.ts +7 -2
  442. package/src/programmers/json/JsonStringifyProgrammer.ts +964 -995
  443. package/src/programmers/json/JsonValidateParseProgrammer.ts +7 -2
  444. package/src/programmers/json/JsonValidateStringifyProgrammer.ts +1 -1
  445. package/src/programmers/misc/MiscAssertCloneProgrammer.ts +71 -71
  446. package/src/programmers/misc/MiscCloneProgrammer.ts +774 -775
  447. package/src/programmers/misc/MiscIsCloneProgrammer.ts +78 -78
  448. package/src/programmers/{IsPruneProgrammer.ts → misc/MiscIsPruneProgrammer.ts} +7 -7
  449. package/src/programmers/misc/MiscLiteralsProgrammer.ts +69 -64
  450. package/src/programmers/misc/MiscPruneProgrammer.ts +550 -544
  451. package/src/programmers/misc/MiscValidateCloneProgrammer.ts +85 -85
  452. package/src/programmers/protobuf/ProtobufAssertDecodeProgrammer.ts +75 -75
  453. package/src/programmers/protobuf/ProtobufDecodeProgrammer.ts +655 -673
  454. package/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +883 -814
  455. package/src/programmers/protobuf/ProtobufIsDecodeProgrammer.ts +85 -85
  456. package/src/programmers/protobuf/ProtobufMessageProgrammer.ts +23 -36
  457. package/src/programmers/protobuf/ProtobufValidateDecodeProgrammer.ts +75 -75
  458. package/src/protobuf.ts +881 -881
  459. package/src/schemas/json/IJsonSchema.ts +11 -38
  460. package/src/schemas/metadata/IMetadata.ts +34 -27
  461. package/src/schemas/metadata/IMetadataAlias.ts +0 -2
  462. package/src/schemas/metadata/IMetadataArray.ts +4 -7
  463. package/src/schemas/metadata/IMetadataArrayType.ts +10 -0
  464. package/src/schemas/metadata/IMetadataAtomic.ts +3 -10
  465. package/src/schemas/metadata/IMetadataCollection.ts +4 -4
  466. package/src/schemas/metadata/IMetadataDictionary.ts +4 -4
  467. package/src/schemas/metadata/IMetadataEscaped.ts +6 -6
  468. package/src/schemas/metadata/IMetadataProperty.ts +0 -2
  469. package/src/schemas/metadata/IMetadataTuple.ts +4 -7
  470. package/src/schemas/metadata/IMetadataTupleType.ts +10 -0
  471. package/src/schemas/metadata/IMetadataTypeTag.ts +8 -0
  472. package/src/schemas/metadata/Metadata.ts +685 -643
  473. package/src/schemas/metadata/MetadataAlias.ts +0 -5
  474. package/src/schemas/metadata/MetadataArray.ts +28 -34
  475. package/src/schemas/metadata/MetadataArrayType.ts +57 -0
  476. package/src/schemas/metadata/MetadataAtomic.ts +42 -0
  477. package/src/schemas/metadata/MetadataEscaped.ts +51 -51
  478. package/src/schemas/metadata/MetadataProperty.ts +0 -5
  479. package/src/schemas/metadata/MetadataTuple.ts +9 -35
  480. package/src/schemas/metadata/MetadataTupleType.ts +67 -0
  481. package/src/tags/ExclusiveMaximum.ts +13 -8
  482. package/src/tags/ExclusiveMinimum.ts +13 -8
  483. package/src/tags/Format.ts +21 -20
  484. package/src/tags/MaxItems.ts +9 -8
  485. package/src/tags/MaxLength.ts +9 -8
  486. package/src/tags/Maximum.ts +13 -8
  487. package/src/tags/MinItems.ts +9 -8
  488. package/src/tags/MinLength.ts +9 -8
  489. package/src/tags/Minimum.ts +13 -8
  490. package/src/tags/MultipleOf.ts +15 -10
  491. package/src/tags/Pattern.ts +8 -8
  492. package/src/tags/TagBase.ts +64 -13
  493. package/src/tags/Type.ts +26 -29
  494. package/src/tags/index.ts +1 -0
  495. package/src/transform.ts +13 -5
  496. package/src/transformers/CallExpressionTransformer.ts +6 -3
  497. package/src/transformers/FileTransformer.ts +23 -13
  498. package/src/transformers/IProject.ts +4 -0
  499. package/src/transformers/NodeTransformer.ts +1 -1
  500. package/src/transformers/TransformerError.ts +55 -0
  501. package/src/transformers/features/CreateRandomTransformer.ts +11 -7
  502. package/src/transformers/features/RandomTransformer.ts +11 -7
  503. package/src/transformers/features/json/JsonApplicationTransformer.ts +116 -111
  504. package/src/transformers/features/misc/MetadataTransformer.ts +61 -53
  505. package/src/transformers/features/misc/MiscCreateIsPruneTransformer.ts +2 -2
  506. package/src/transformers/features/misc/MiscIsPruneTransformer.ts +2 -2
  507. package/src/transformers/features/misc/MiscLiteralsTransformer.ts +11 -7
  508. package/src/transformers/features/protobuf/ProtobufMessageTransformer.ts +9 -7
  509. package/src/transformers/internal/GenericTransformer.ts +17 -10
  510. package/src/typings/Atomic.ts +1 -0
  511. package/src/typings/ProtobufAtomic.ts +19 -0
  512. package/src/typings/ValidationPipe.ts +9 -0
  513. package/src/utils/RandomGenerator.ts +83 -83
  514. package/lib/CustomValidatorMap.d.ts +0 -110
  515. package/lib/CustomValidatorMap.js.map +0 -1
  516. package/lib/factories/MetadataTagFactory.d.ts +0 -6
  517. package/lib/factories/MetadataTagFactory.js +0 -312
  518. package/lib/factories/MetadataTagFactory.js.map +0 -1
  519. package/lib/factories/internal/metadata/emplace_metadata_array.d.ts +0 -5
  520. package/lib/factories/internal/metadata/emplace_metadata_array.js +0 -38
  521. package/lib/factories/internal/metadata/emplace_metadata_array.js.map +0 -1
  522. package/lib/factories/internal/metadata/iterate_metadata_tag.d.ts +0 -2
  523. package/lib/factories/internal/metadata/iterate_metadata_tag.js +0 -50
  524. package/lib/factories/internal/metadata/iterate_metadata_tag.js.map +0 -1
  525. package/lib/functional/$is_custom.d.ts +0 -2
  526. package/lib/functional/$is_custom.js +0 -13
  527. package/lib/functional/$is_custom.js.map +0 -1
  528. package/lib/functional/$is_date.d.ts +0 -1
  529. package/lib/functional/$is_date.js +0 -7
  530. package/lib/functional/$is_date.js.map +0 -1
  531. package/lib/functional/$is_datetime.d.ts +0 -1
  532. package/lib/functional/$is_datetime.js +0 -8
  533. package/lib/functional/$is_datetime.js.map +0 -1
  534. package/lib/functional/$is_email.d.ts +0 -1
  535. package/lib/functional/$is_email.js +0 -7
  536. package/lib/functional/$is_email.js.map +0 -1
  537. package/lib/functional/$is_ipv4.d.ts +0 -1
  538. package/lib/functional/$is_ipv4.js +0 -7
  539. package/lib/functional/$is_ipv4.js.map +0 -1
  540. package/lib/functional/$is_ipv6.d.ts +0 -1
  541. package/lib/functional/$is_ipv6.js +0 -7
  542. package/lib/functional/$is_ipv6.js.map +0 -1
  543. package/lib/functional/$is_url.d.ts +0 -1
  544. package/lib/functional/$is_url.js +0 -7
  545. package/lib/functional/$is_url.js.map +0 -1
  546. package/lib/functional/$is_uuid.d.ts +0 -1
  547. package/lib/functional/$is_uuid.js +0 -7
  548. package/lib/functional/$is_uuid.js.map +0 -1
  549. package/lib/programmers/IsPruneProgrammer.js.map +0 -1
  550. package/lib/programmers/internal/application_resolved.d.ts +0 -4
  551. package/lib/programmers/internal/application_resolved.js.map +0 -1
  552. package/lib/programmers/internal/check_array.js +0 -44
  553. package/lib/programmers/internal/check_array.js.map +0 -1
  554. package/lib/programmers/internal/check_custom.d.ts +0 -1
  555. package/lib/programmers/internal/check_custom.js +0 -30
  556. package/lib/programmers/internal/check_custom.js.map +0 -1
  557. package/lib/programmers/internal/check_string_tags.d.ts +0 -1
  558. package/lib/programmers/internal/check_string_tags.js +0 -89
  559. package/lib/programmers/internal/check_string_tags.js.map +0 -1
  560. package/lib/programmers/internal/get_comment_tags.d.ts +0 -1
  561. package/lib/programmers/internal/get_comment_tags.js +0 -25
  562. package/lib/programmers/internal/get_comment_tags.js.map +0 -1
  563. package/lib/schemas/metadata/ICommentTag.d.ts +0 -4
  564. package/lib/schemas/metadata/ICommentTag.js.map +0 -1
  565. package/lib/schemas/metadata/IMetadataTag.d.ts +0 -63
  566. package/lib/schemas/metadata/IMetadataTag.js.map +0 -1
  567. package/src/CustomValidatorMap.ts +0 -126
  568. package/src/factories/MetadataTagFactory.ts +0 -366
  569. package/src/factories/internal/metadata/iterate_metadata_tag.ts +0 -31
  570. package/src/functional/$is_custom.ts +0 -14
  571. package/src/functional/$is_date.ts +0 -3
  572. package/src/functional/$is_datetime.ts +0 -2
  573. package/src/functional/$is_email.ts +0 -4
  574. package/src/functional/$is_ipv4.ts +0 -4
  575. package/src/functional/$is_ipv6.ts +0 -4
  576. package/src/functional/$is_url.ts +0 -4
  577. package/src/functional/$is_uuid.ts +0 -4
  578. package/src/programmers/internal/check_array.ts +0 -30
  579. package/src/programmers/internal/check_custom.ts +0 -31
  580. package/src/programmers/internal/check_string_tags.ts +0 -67
  581. package/src/programmers/internal/get_comment_tags.ts +0 -23
  582. package/src/schemas/metadata/ICommentTag.ts +0 -4
  583. package/src/schemas/metadata/IMetadataTag.ts +0 -112
  584. /package/lib/{programmers/internal/check_array.d.ts → factories/MetadataCommentTagFactory.d.ts} +0 -0
package/src/module.ts CHANGED
@@ -1,709 +1,656 @@
1
- import { $dictionary } from "./functional/$dictionary";
2
- import { Namespace } from "./functional/Namespace";
3
-
4
- import { IMetadataApplication } from "./schemas/metadata/IMetadataApplication";
5
-
6
- import { MapUtil } from "./utils/MapUtil";
7
-
8
- import { CustomValidatorMap } from "./CustomValidatorMap";
9
- import { IRandomGenerator } from "./IRandomGenerator";
10
- import { IValidation } from "./IValidation";
11
- import { Resolved } from "./Resolved";
12
-
13
- export * as json from "./json";
14
- export * as protobuf from "./protobuf";
15
- export * as misc from "./misc";
16
-
17
- export * from "./schemas/json/IJsonApplication";
18
- export * from "./schemas/json/IJsonComponents";
19
- export * from "./schemas/json/IJsonSchema";
20
- export * from "./IRandomGenerator";
21
- export * from "./IValidation";
22
- export * from "./Primitive";
23
- export * from "./Resolved";
24
- export * from "./TypeGuardError";
25
-
26
- /**
27
- * Custom validators.
28
- *
29
- * If you want to add a custom validation logic utilizing comment tags,
30
- * add a closure function with its tag and type name. Below example code
31
- * would helpful to understand how to use this instance.
32
- *
33
- * ```ts
34
- * typia.customValidators.insert("powerOf")("number")(
35
- * (text: string) => {
36
- * const denominator: number = Math.log(Number(text));
37
- * return (value: number) => {
38
- * value = Math.log(value) / denominator;
39
- * return value === Math.floor(value);
40
- * };
41
- * }
42
- * );
43
- * typia.customValidators.insert("dollar")("string")(
44
- * () => (value: string) => value.startsWith("$"),
45
- * );
46
- *
47
- * interface TagCustom {
48
- * /**
49
- * * @powerOf 10
50
- * *\/
51
- * powerOf: number;
52
- *
53
- * /**
54
- * * @dollar
55
- * *\/
56
- * dollar: string;
57
- * }
58
- * ```
59
- *
60
- * @author Jeongho Nam - https://github.com/samchon
61
- */
62
- export const customValidators: CustomValidatorMap = {
63
- size: (name?: string) =>
64
- name ? $dictionary.get(name)?.size ?? 0 : $dictionary.size,
65
- has: (name) => (type) => $dictionary.get(name)?.has(type) ?? false,
66
- get: (name) => (type) => $dictionary.get(name)?.get(type),
67
- insert: (name) => (type) => (closure) => {
68
- const internal = MapUtil.take($dictionary)(name, () => new Map());
69
- if (internal.has(type)) return false;
70
- internal.set(type, closure);
71
- return true;
72
- },
73
- erase: (name) => (type) => $dictionary.get(name)?.delete(type) ?? false,
74
- };
75
-
76
- /* -----------------------------------------------------------
77
- BASIC VALIDATORS
78
- ----------------------------------------------------------- */
79
- /**
80
- * Asserts a value type.
81
- *
82
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
83
- * reason, if the parametric value is not following the type `T`. Otherwise, the
84
- * value is following the type `T`, just input parameter would be returned.
85
- *
86
- * If what you want is not asserting but just knowing whether the parametric value is
87
- * following the type `T` or not, you can choose the {@link is} function instead.
88
- * Otherwise you want to know all the errors, {@link validate} is the way to go.
89
- *
90
- * On the other and, if you don't want to allow any superfluous property that is not
91
- * enrolled to the type `T`, you can use {@link assertEquals} function instead.
92
- *
93
- * @template T Type of the input value
94
- * @param input A value to be asserted
95
- * @returns Parametric input value
96
- * @throws A {@link TypeGuardError} instance with detailed reason
97
- *
98
- * @author Jeongho Nam - https://github.com/samchon
99
- */
100
- export function assert<T>(input: T): T;
101
-
102
- /**
103
- * Asserts a value type.
104
- *
105
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
106
- * reason, if the parametric value is not following the type `T`. Otherwise, the
107
- * value is following the type `T`, just input parameter would be returned.
108
- *
109
- * If what you want is not asserting but just knowing whether the parametric value is
110
- * following the type `T` or not, you can choose the {@link is} function instead.
111
- * Otherwise, you want to know all the errors, {@link validate} is the way to go.
112
- *
113
- * On the other and, if you don't want to allow any superfluous property that is not
114
- * enrolled to the type `T`, you can use {@link assertEquals} function instead.
115
- *
116
- * @template T Type of the input value
117
- * @param input A value to be asserted
118
- * @returns Parametric input value casted as `T`
119
- * @throws A {@link TypeGuardError} instance with detailed reason
120
- *
121
- * @author Jeongho Nam - https://github.com/samchon
122
- */
123
- export function assert<T>(input: unknown): T;
124
-
125
- /**
126
- * @internal
127
- */
128
- export function assert(): never {
129
- halt("assert");
130
- }
131
- Object.assign(assert, Namespace.assert("assert"));
132
-
133
- /**
134
- * Tests a value type.
135
- *
136
- * Tests a parametric value type and returns whether it's following the type `T` or not.
137
- * If the parametric value is matched with the type `T`, `true` value would be returned.
138
- * Otherwise, the parametric value is not following the type `T`, `false` value would be
139
- * returned.
140
- *
141
- * If what you want is not just knowing whether the parametric value is following the
142
- * type `T` or not, but throwing an exception with detailed reason, you can choose
143
- * {@link assert} function instead. Also, if you want to know all the errors with
144
- * detailed reasons, {@link validate} function would be useful.
145
- *
146
- * On the other and, if you don't want to allow any superfluous property that is not
147
- * enrolled to the type `T`, you can use {@link equals} function instead.
148
- *
149
- * @template T Type of the input value
150
- * @param input A value to be tested
151
- * @returns Whether the parametric value is following the type `T` or not
152
- *
153
- * @author Jeongho Nam - https://github.com/samchon
154
- */
155
- export function is<T>(input: T): input is T;
156
-
157
- /**
158
- * Tests a value type.
159
- *
160
- * Tests a parametric value type and returns whether it's following the type `T` or not.
161
- * If the parametric value is matched with the type `T`, `true` value would be returned.
162
- * Otherwise, the parametric value is not following the type `T`, `false` value would be
163
- * returned.
164
- *
165
- * If what you want is not just knowing whether the parametric value is following the
166
- * type `T` or not, but throwing an exception with detailed reason, you can choose
167
- * {@link assert} function instead. Also, if you want to know all the errors with
168
- * detailed reasons, {@link validate} function would be useful.
169
- *
170
- * On the other and, if you don't want to allow any superfluous property that is not
171
- * enrolled to the type `T`, you can use {@link equals} function instead.
172
- *
173
- * @template T Type of the input value
174
- * @param input A value to be tested
175
- * @returns Whether the parametric value is following the type `T` or not
176
- *
177
- * @author Jeongho Nam - https://github.com/samchon
178
- */
179
- export function is<T>(input: unknown): input is T;
180
-
181
- /**
182
- * @internal
183
- */
184
- export function is(): never {
185
- halt("is");
186
- }
187
- Object.assign(is, Namespace.assert("is"));
188
-
189
- /**
190
- * Validates a value type.
191
- *
192
- * Validates a parametric value type and archives all the type errors into an
193
- * {@link IValidation.errors} array, if the parametric value is not following the
194
- * type `T`. Of course, if the parametric value is following the type `T`, the
195
- * {@link IValidation.errors} array would be empty and {@link IValidation.success}
196
- * would have the `true` value.
197
- *
198
- * If what you want is not finding all the error, but asserting the parametric value
199
- * type with exception throwing, you can choose {@link assert} function instead.
200
- * Otherwise, you just want to know whether the parametric value is matched with the
201
- * type `T`, {@link is} function is the way to go.
202
- *
203
- * On the other and, if you don't want to allow any superfluous property that is not
204
- * enrolled to the type `T`, you can use {@link validateEquals} function instead.
205
- *
206
- * @template Type of the input value
207
- * @param input A value to be validated
208
- * @returns Validation result
209
- *
210
- * @author Jeongho Nam - https://github.com/samchon
211
- */
212
- export function validate<T>(input: T): IValidation<T>;
213
-
214
- /**
215
- * Validates a value type.
216
- *
217
- * Validates a parametric value type and archives all the type errors into an
218
- * {@link IValidation.errors} array, if the parametric value is not following the
219
- * type `T`. Of course, if the parametric value is following the type `T`, the
220
- * {@link IValidation.errors} array would be empty and {@link IValidation.success}
221
- * would have the `true` value.
222
- *
223
- * If what you want is not finding all the error, but asserting the parametric value
224
- * type with exception throwing, you can choose {@link assert} function instead.
225
- * Otherwise, you just want to know whether the parametric value is matched with the
226
- * type `T`, {@link is} function is the way to go.
227
- *
228
- * On the other and, if you don't want to allow any superfluous property that is not
229
- * enrolled to the type `T`, you can use {@link validateEquals} function instead.
230
- *
231
- * @template Type of the input value
232
- * @param input A value to be validated
233
- * @returns Validation result
234
- *
235
- * @author Jeongho Nam - https://github.com/samchon
236
- */
237
- export function validate<T>(input: unknown): IValidation<T>;
238
-
239
- /**
240
- * @internal
241
- */
242
- export function validate(): never {
243
- halt("validate");
244
- }
245
- Object.assign(validate, Namespace.validate());
246
-
247
- /* -----------------------------------------------------------
248
- STRICT VALIDATORS
249
- ----------------------------------------------------------- */
250
- /**
251
- * Asserts equality between a value and its type.
252
- *
253
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
254
- * reason, if the parametric value is not following the type `T` or some superfluous
255
- * property that is not listed on the type `T` has been found. Otherwise, the value is
256
- * following the type `T` without any superfluous property, just input parameter would
257
- * be returned.
258
- *
259
- * If what you want is not asserting but just knowing whether the parametric value is
260
- * following the type `T` or not, you can choose the {@link equals} function instead.
261
- * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
262
- *
263
- * On the other hand, if you want to allow superfluous property that is not enrolled
264
- * to the type `T`, you can use {@link assert} function instead.
265
- *
266
- * @template T Type of the input value
267
- * @param input A value to be asserted
268
- * @returns Parametric input value
269
- * @throws A {@link TypeGuardError} instance with detailed reason
270
- *
271
- * @author Jeongho Nam - https://github.com/samchon
272
- */
273
- export function assertEquals<T>(input: T): T;
274
-
275
- /**
276
- * Asserts equality between a value and its type.
277
- *
278
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
279
- * reason, if the parametric value is not following the type `T` or some superfluous
280
- * property that is not listed on the type `T` has been found. Otherwise, the value is
281
- * following the type `T` without any superfluous property, just input parameter would
282
- * be returned.
283
- *
284
- * If what you want is not asserting but just knowing whether the parametric value is
285
- * following the type `T` or not, you can choose the {@link equals} function instead.
286
- * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
287
- *
288
- * On the other hand, if you want to allow superfluous property that is not enrolled
289
- * to the type `T`, you can use {@link assert} function instead.
290
- *
291
- * @template T Type of the input value
292
- * @param input A value to be asserted
293
- * @returns Parametric input value casted as `T`
294
- * @throws A {@link TypeGuardError} instance with detailed reason
295
- *
296
- * @author Jeongho Nam - https://github.com/samchon
297
- */
298
- export function assertEquals<T>(input: unknown): T;
299
-
300
- /**
301
- * @internal
302
- */
303
- export function assertEquals(): never {
304
- halt("assertEquals");
305
- }
306
- Object.assign(assertEquals, Namespace.assert("assertEquals"));
307
-
308
- /**
309
- * Tests equality between a value and its type.
310
- *
311
- * Tests a parametric value type and returns whether it's equivalent to the type `T`
312
- * or not. If the parametric value is matched with the type `T` and there's not any
313
- * superfluous property that is not listed on the type `T`, `true` value would be
314
- * returned. Otherwise, the parametric value is not following the type `T` or some
315
- * superfluous property exists, `false` value would be returned.
316
- *
317
- * If what you want is not just knowing whether the parametric value is following the
318
- * type `T` or not, but throwing an exception with detailed reason, you can choose
319
- * {@link assertEquals} function instead. Also, if you want to know all the errors with
320
- * detailed reasons, {@link validateEquals} function would be useful.
321
- *
322
- * On the other hand, if you want to allow superfluous property that is not enrolled
323
- * to the type `T`, you can use {@link is} function instead.
324
- *
325
- * @template T Type of the input value
326
- * @param input A value to be tested
327
- * @returns Whether the parametric value is equivalent to the type `T` or not
328
- *
329
- * @author Jeongho Nam - https://github.com/samchon
330
- */
331
- export function equals<T>(input: T): input is T;
332
-
333
- /**
334
- * Tests equality between a value and its type.
335
- *
336
- * Tests a parametric value type and returns whether it's equivalent to the type `T`
337
- * or not. If the parametric value is matched with the type `T` and there's not any
338
- * superfluous property that is not listed on the type `T`, `true` value would be
339
- * returned. Otherwise, the parametric value is not following the type `T` or some
340
- * superfluous property exists, `false` value would be returned.
341
- *
342
- * If what you want is not just knowing whether the parametric value is following the
343
- * type `T` or not, but throwing an exception with detailed reason, you can choose
344
- * {@link assertEquals} function instead. Also, if you want to know all the errors with
345
- * detailed reasons, {@link validateEquals} function would be useful.
346
- *
347
- * On the other hand, if you want to allow superfluous property that is not enrolled
348
- * to the type `T`, you can use {@link is} function instead.
349
- *
350
- * @template T Type of the input value
351
- * @param input A value to be tested
352
- * @returns Whether the parametric value is equivalent to the type `T` or not
353
- *
354
- * @author Jeongho Nam - https://github.com/samchon
355
- */
356
- export function equals<T>(input: unknown): input is T;
357
-
358
- /**
359
- * @internal
360
- */
361
- export function equals(): never {
362
- halt("equals");
363
- }
364
- Object.assign(equals, Namespace.is());
365
-
366
- /**
367
- * Validates equality between a value and its type.
368
- *
369
- * Validates a parametric value type and archives all the type errors into an
370
- * {@link IValidation.errors} array, if the parametric value is not following the
371
- * type `T` or some superfluous property that is not listed on the type `T` has been
372
- * found. Of course, if the parametric value is following the type `T` and no
373
- * superfluous property exists, the {@link IValidation.errors} array would be empty
374
- * and {@link IValidation.success} would have the `true` value.
375
- *
376
- * If what you want is not finding all the error, but asserting the parametric value
377
- * type with exception throwing, you can choose {@link assert} function instead.
378
- * Otherwise, you just want to know whether the parametric value is matched with the
379
- * type `T`, {@link is} function is the way to go.
380
- *
381
- * On the other and, if you don't want to allow any superfluous property that is not
382
- * enrolled to the type `T`, you can use {@link validateEquals} function instead.
383
- *
384
- * @template Type of the input value
385
- * @param input A value to be validated
386
- * @returns Validation result
387
- *
388
- * @author Jeongho Nam - https://github.com/samchon
389
- */
390
- export function validateEquals<T>(input: T): IValidation<T>;
391
-
392
- /**
393
- * Validates equality between a value and its type.
394
- *
395
- * Validates a parametric value type and archives all the type errors into an
396
- * {@link IValidation.errors} array, if the parametric value is not following the
397
- * type `T` or some superfluous property that is not listed on the type `T` has been
398
- * found. Of course, if the parametric value is following the type `T` and no
399
- * superfluous property exists, the {@link IValidation.errors} array would be empty
400
- * and {@link IValidation.success} would have the `true` value.
401
- *
402
- * If what you want is not finding all the error, but asserting the parametric value
403
- * type with exception throwing, you can choose {@link assert} function instead.
404
- * Otherwise, you just want to know whether the parametric value is matched with the
405
- * type `T`, {@link is} function is the way to go.
406
- *
407
- * On the other and, if you don't want to allow any superfluous property that is not
408
- * enrolled to the type `T`, you can use {@link validateEquals} function instead.
409
- *
410
- * @template Type of the input value
411
- * @param input A value to be validated
412
- * @returns Validation result
413
- *
414
- * @author Jeongho Nam - https://github.com/samchon
415
- */
416
- export function validateEquals<T>(input: unknown): IValidation<T>;
417
-
418
- /**
419
- * @internal
420
- */
421
- export function validateEquals(): never {
422
- halt("validateEquals");
423
- }
424
- Object.assign(validateEquals, Namespace.validate());
425
-
426
- /* -----------------------------------------------------------
427
- RANDOM
428
- ----------------------------------------------------------- */
429
- /**
430
- * > You must configure the generic argument `T`.
431
- *
432
- * Generate random data.
433
- *
434
- * Generates a random data following type the `T`.
435
- *
436
- * For reference, this `typia.random()` function generates only primitive type.
437
- * If there're some methods in the type `T` or its nested instances, those would
438
- * be ignored. Also, when the type `T` has a `toJSON()` method, its return type
439
- * would be generated instead.
440
- *
441
- * @template T Type of data to generate
442
- * @param generator Random data generator
443
- * @return Randomly generated data
444
- *
445
- * @author Jeongho Nam - https://github.com/samchon
446
- */
447
- export function random(generator?: Partial<IRandomGenerator>): never;
448
-
449
- /**
450
- * Generate random data.
451
- *
452
- * Generates a random data following type the `T`.
453
- *
454
- * For reference, this `typia.random()` function generates only primitive type.
455
- * If there're some methods in the type `T` or its nested instances, those would
456
- * be ignored. Also, when the type `T` has a `toJSON()` method, its return type
457
- * would be generated instead.
458
- *
459
- * @template T Type of data to generate
460
- * @param generator Random data generator
461
- * @return Randomly generated data
462
- *
463
- * @author Jeongho Nam - https://github.com/samchon
464
- */
465
- export function random<T>(generator?: Partial<IRandomGenerator>): Resolved<T>;
466
-
467
- /**
468
- * @internal
469
- */
470
- export function random(): never {
471
- halt("random");
472
- }
473
- Object.assign(random, Namespace.random());
474
-
475
- /**
476
- * @internal
477
- */
478
- export function metadata(): never;
479
-
480
- /**
481
- * @internal
482
- */
483
- export function metadata<Types extends unknown[]>(): IMetadataApplication;
484
-
485
- /**
486
- * @internal
487
- */
488
- export function metadata(): never {
489
- halt("metadata");
490
- }
491
-
492
- /* -----------------------------------------------------------
493
- FACTORY FUNCTIONS
494
- ----------------------------------------------------------- */
495
- /**
496
- * Creates a reusable {@link assert} function.
497
- *
498
- * @danger You must configure the generic argument `T`
499
- * @returns Nothing until you configure the generic argument `T`
500
- * @throws compile error
501
- *
502
- * @author Jeongho Nam - https://github.com/samchon
503
- */
504
- export function createAssert(): never;
505
-
506
- /**
507
- * Creates a reusable {@link assert} function.
508
- *
509
- * @template T Type of the input value
510
- * @returns A reusable `assert` function
511
- *
512
- * @author Jeongho Nam - https://github.com/samchon
513
- */
514
- export function createAssert<T>(): (input: unknown) => T;
515
-
516
- /**
517
- * @internal
518
- */
519
- export function createAssert<T>(): (input: unknown) => T {
520
- halt("createAssert");
521
- }
522
- Object.assign(createAssert, assert);
523
-
524
- /**
525
- * Creates a reusable {@link is} function.
526
- *
527
- * @danger You must configure the generic argument `T`
528
- * @returns Nothing until you configure the generic argument `T`
529
- * @throws compile error
530
- *
531
- * @author Jeongho Nam - https://github.com/samchon
532
- */
533
- export function createIs(): never;
534
-
535
- /**
536
- * Creates a reusable {@link is} function.
537
- *
538
- * @template T Type of the input value
539
- * @returns A reusable `is` function
540
- *
541
- * @author Jeongho Nam - https://github.com/samchon
542
- */
543
- export function createIs<T>(): (input: unknown) => input is T;
544
-
545
- /**
546
- * @internal
547
- */
548
- export function createIs<T>(): (input: unknown) => input is T {
549
- halt("createIs");
550
- }
551
- Object.assign(createIs, is);
552
-
553
- /**
554
- * Creates a reusable {@link validate} function.
555
- *
556
- * @danger You must configure the generic argument `T`
557
- * @returns Nothing until you configure the generic argument `T`
558
- * @throws compile error
559
- *
560
- * @author Jeongho Nam - https://github.com/samchon
561
- */
562
- export function createValidate(): never;
563
-
564
- /**
565
- * Creates a reusable {@link validate} function.
566
- *
567
- * @template T Type of the input value
568
- * @returns A reusable `validate` function
569
- *
570
- * @author Jeongho Nam - https://github.com/samchon
571
- */
572
- export function createValidate<T>(): (input: unknown) => IValidation<T>;
573
-
574
- /**
575
- * @internal
576
- */
577
- export function createValidate(): (input: unknown) => IValidation {
578
- halt("createValidate");
579
- }
580
- Object.assign(createValidate, validate);
581
-
582
- /**
583
- * Creates a reusable {@link assertEquals} function.
584
- *
585
- * @danger You must configure the generic argument `T`
586
- * @returns Nothing until you configure the generic argument `T`
587
- * @throws compile error
588
- *
589
- * @author Jeongho Nam - https://github.com/samchon
590
- */
591
- export function createAssertEquals(): never;
592
-
593
- /**
594
- * Creates a reusable {@link assertEquals} function.
595
- *
596
- * @template T Type of the input value
597
- * @returns A reusable `assertEquals` function
598
- *
599
- * @author Jeongho Nam - https://github.com/samchon
600
- */
601
- export function createAssertEquals<T>(): (input: unknown) => T;
602
-
603
- /**
604
- * @internal
605
- */
606
- export function createAssertEquals<T>(): (input: unknown) => T {
607
- halt("createAssertEquals");
608
- }
609
- Object.assign(createAssertEquals, assertEquals);
610
-
611
- /**
612
- * Creates a reusable {@link equals} function.
613
- *
614
- * @danger You must configure the generic argument `T`
615
- * @returns Nothing until you configure the generic argument `T`
616
- * @throws compile error
617
- *
618
- * @author Jeongho Nam - https://github.com/samchon
619
- */
620
- export function createEquals(): never;
621
-
622
- /**
623
- * Creates a reusable {@link equals} function.
624
- *
625
- * @template T Type of the input value
626
- * @returns A reusable `equals` function
627
- *
628
- * @author Jeongho Nam - https://github.com/samchon
629
- */
630
- export function createEquals<T>(): (input: unknown) => input is T;
631
-
632
- /**
633
- * @internal
634
- */
635
- export function createEquals<T>(): (input: unknown) => input is T {
636
- halt("createEquals");
637
- }
638
- Object.assign(createEquals, equals);
639
-
640
- /**
641
- * Creates a reusable {@link validateEquals} function.
642
- *
643
- * @danger You must configure the generic argument `T`
644
- * @returns Nothing until you configure the generic argument `T`
645
- * @throws compile error
646
- *
647
- * @author Jeongho Nam - https://github.com/samchon
648
- */
649
- export function createValidateEquals(): never;
650
-
651
- /**
652
- * Creates a reusable {@link validateEquals} function.
653
- *
654
- * @template T Type of the input value
655
- * @returns A reusable `validateEquals` function
656
- *
657
- * @author Jeongho Nam - https://github.com/samchon
658
- */
659
- export function createValidateEquals<T>(): (input: unknown) => IValidation<T>;
660
-
661
- /**
662
- * @internal
663
- */
664
- export function createValidateEquals(): (input: unknown) => IValidation {
665
- halt("createValidateEquals");
666
- }
667
- Object.assign(createValidateEquals, validateEquals);
668
-
669
- /**
670
- * Creates a reusable {@link random} function.
671
- *
672
- * @danger You must configure the generic argument `T`
673
- * @param generator Random data generator
674
- * @returns Nothing until you configure the generic argument `T`
675
- * @throws compile error
676
- *
677
- * @author Jeongho Nam - https://github.com/samchon
678
- */
679
- export function createRandom(generator?: Partial<IRandomGenerator>): never;
680
-
681
- /**
682
- * Creates a resuable {@link random} function.
683
- *
684
- * @template T Type of the input value
685
- * @param generator Random data generator
686
- * @returns A reusable `random` function
687
- *
688
- * @author Jeongho Nam - https://github.com/samchon
689
- */
690
- export function createRandom<T>(
691
- generator?: Partial<IRandomGenerator>,
692
- ): () => Resolved<T>;
693
-
694
- /**
695
- * @internal
696
- */
697
- export function createRandom(): never {
698
- halt("createRandom");
699
- }
700
- Object.assign(createRandom, random);
701
-
702
- /**
703
- * @internal
704
- */
705
- function halt(name: string): never {
706
- throw new Error(
707
- `Error on typia.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
708
- );
709
- }
1
+ import { Namespace } from "./functional/Namespace";
2
+
3
+ import { IMetadataApplication } from "./schemas/metadata/IMetadataApplication";
4
+
5
+ import { IRandomGenerator } from "./IRandomGenerator";
6
+ import { IValidation } from "./IValidation";
7
+ import { Resolved } from "./Resolved";
8
+
9
+ export * as json from "./json";
10
+ export * as misc from "./misc";
11
+ export * as protobuf from "./protobuf";
12
+ export * as tags from "./tags";
13
+
14
+ export * from "./schemas/json/IJsonApplication";
15
+ export * from "./schemas/json/IJsonComponents";
16
+ export * from "./schemas/json/IJsonSchema";
17
+ export * from "./IRandomGenerator";
18
+ export * from "./IValidation";
19
+ export * from "./Primitive";
20
+ export * from "./Resolved";
21
+ export * from "./TypeGuardError";
22
+
23
+ /* -----------------------------------------------------------
24
+ BASIC VALIDATORS
25
+ ----------------------------------------------------------- */
26
+ /**
27
+ * Asserts a value type.
28
+ *
29
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
30
+ * reason, if the parametric value is not following the type `T`. Otherwise, the
31
+ * value is following the type `T`, just input parameter would be returned.
32
+ *
33
+ * If what you want is not asserting but just knowing whether the parametric value is
34
+ * following the type `T` or not, you can choose the {@link is} function instead.
35
+ * Otherwise you want to know all the errors, {@link validate} is the way to go.
36
+ *
37
+ * On the other and, if you don't want to allow any superfluous property that is not
38
+ * enrolled to the type `T`, you can use {@link assertEquals} function instead.
39
+ *
40
+ * @template T Type of the input value
41
+ * @param input A value to be asserted
42
+ * @returns Parametric input value
43
+ * @throws A {@link TypeGuardError} instance with detailed reason
44
+ *
45
+ * @author Jeongho Nam - https://github.com/samchon
46
+ */
47
+ export function assert<T>(input: T): T;
48
+
49
+ /**
50
+ * Asserts a value type.
51
+ *
52
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
53
+ * reason, if the parametric value is not following the type `T`. Otherwise, the
54
+ * value is following the type `T`, just input parameter would be returned.
55
+ *
56
+ * If what you want is not asserting but just knowing whether the parametric value is
57
+ * following the type `T` or not, you can choose the {@link is} function instead.
58
+ * Otherwise, you want to know all the errors, {@link validate} is the way to go.
59
+ *
60
+ * On the other and, if you don't want to allow any superfluous property that is not
61
+ * enrolled to the type `T`, you can use {@link assertEquals} function instead.
62
+ *
63
+ * @template T Type of the input value
64
+ * @param input A value to be asserted
65
+ * @returns Parametric input value casted as `T`
66
+ * @throws A {@link TypeGuardError} instance with detailed reason
67
+ *
68
+ * @author Jeongho Nam - https://github.com/samchon
69
+ */
70
+ export function assert<T>(input: unknown): T;
71
+
72
+ /**
73
+ * @internal
74
+ */
75
+ export function assert(): never {
76
+ halt("assert");
77
+ }
78
+ Object.assign(assert, Namespace.assert("assert"));
79
+
80
+ /**
81
+ * Tests a value type.
82
+ *
83
+ * Tests a parametric value type and returns whether it's following the type `T` or not.
84
+ * If the parametric value is matched with the type `T`, `true` value would be returned.
85
+ * Otherwise, the parametric value is not following the type `T`, `false` value would be
86
+ * returned.
87
+ *
88
+ * If what you want is not just knowing whether the parametric value is following the
89
+ * type `T` or not, but throwing an exception with detailed reason, you can choose
90
+ * {@link assert} function instead. Also, if you want to know all the errors with
91
+ * detailed reasons, {@link validate} function would be useful.
92
+ *
93
+ * On the other and, if you don't want to allow any superfluous property that is not
94
+ * enrolled to the type `T`, you can use {@link equals} function instead.
95
+ *
96
+ * @template T Type of the input value
97
+ * @param input A value to be tested
98
+ * @returns Whether the parametric value is following the type `T` or not
99
+ *
100
+ * @author Jeongho Nam - https://github.com/samchon
101
+ */
102
+ export function is<T>(input: T): input is T;
103
+
104
+ /**
105
+ * Tests a value type.
106
+ *
107
+ * Tests a parametric value type and returns whether it's following the type `T` or not.
108
+ * If the parametric value is matched with the type `T`, `true` value would be returned.
109
+ * Otherwise, the parametric value is not following the type `T`, `false` value would be
110
+ * returned.
111
+ *
112
+ * If what you want is not just knowing whether the parametric value is following the
113
+ * type `T` or not, but throwing an exception with detailed reason, you can choose
114
+ * {@link assert} function instead. Also, if you want to know all the errors with
115
+ * detailed reasons, {@link validate} function would be useful.
116
+ *
117
+ * On the other and, if you don't want to allow any superfluous property that is not
118
+ * enrolled to the type `T`, you can use {@link equals} function instead.
119
+ *
120
+ * @template T Type of the input value
121
+ * @param input A value to be tested
122
+ * @returns Whether the parametric value is following the type `T` or not
123
+ *
124
+ * @author Jeongho Nam - https://github.com/samchon
125
+ */
126
+ export function is<T>(input: unknown): input is T;
127
+
128
+ /**
129
+ * @internal
130
+ */
131
+ export function is(): never {
132
+ halt("is");
133
+ }
134
+ Object.assign(is, Namespace.assert("is"));
135
+
136
+ /**
137
+ * Validates a value type.
138
+ *
139
+ * Validates a parametric value type and archives all the type errors into an
140
+ * {@link IValidation.errors} array, if the parametric value is not following the
141
+ * type `T`. Of course, if the parametric value is following the type `T`, the
142
+ * {@link IValidation.errors} array would be empty and {@link IValidation.success}
143
+ * would have the `true` value.
144
+ *
145
+ * If what you want is not finding all the error, but asserting the parametric value
146
+ * type with exception throwing, you can choose {@link assert} function instead.
147
+ * Otherwise, you just want to know whether the parametric value is matched with the
148
+ * type `T`, {@link is} function is the way to go.
149
+ *
150
+ * On the other and, if you don't want to allow any superfluous property that is not
151
+ * enrolled to the type `T`, you can use {@link validateEquals} function instead.
152
+ *
153
+ * @template Type of the input value
154
+ * @param input A value to be validated
155
+ * @returns Validation result
156
+ *
157
+ * @author Jeongho Nam - https://github.com/samchon
158
+ */
159
+ export function validate<T>(input: T): IValidation<T>;
160
+
161
+ /**
162
+ * Validates a value type.
163
+ *
164
+ * Validates a parametric value type and archives all the type errors into an
165
+ * {@link IValidation.errors} array, if the parametric value is not following the
166
+ * type `T`. Of course, if the parametric value is following the type `T`, the
167
+ * {@link IValidation.errors} array would be empty and {@link IValidation.success}
168
+ * would have the `true` value.
169
+ *
170
+ * If what you want is not finding all the error, but asserting the parametric value
171
+ * type with exception throwing, you can choose {@link assert} function instead.
172
+ * Otherwise, you just want to know whether the parametric value is matched with the
173
+ * type `T`, {@link is} function is the way to go.
174
+ *
175
+ * On the other and, if you don't want to allow any superfluous property that is not
176
+ * enrolled to the type `T`, you can use {@link validateEquals} function instead.
177
+ *
178
+ * @template Type of the input value
179
+ * @param input A value to be validated
180
+ * @returns Validation result
181
+ *
182
+ * @author Jeongho Nam - https://github.com/samchon
183
+ */
184
+ export function validate<T>(input: unknown): IValidation<T>;
185
+
186
+ /**
187
+ * @internal
188
+ */
189
+ export function validate(): never {
190
+ halt("validate");
191
+ }
192
+ Object.assign(validate, Namespace.validate());
193
+
194
+ /* -----------------------------------------------------------
195
+ STRICT VALIDATORS
196
+ ----------------------------------------------------------- */
197
+ /**
198
+ * Asserts equality between a value and its type.
199
+ *
200
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
201
+ * reason, if the parametric value is not following the type `T` or some superfluous
202
+ * property that is not listed on the type `T` has been found. Otherwise, the value is
203
+ * following the type `T` without any superfluous property, just input parameter would
204
+ * be returned.
205
+ *
206
+ * If what you want is not asserting but just knowing whether the parametric value is
207
+ * following the type `T` or not, you can choose the {@link equals} function instead.
208
+ * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
209
+ *
210
+ * On the other hand, if you want to allow superfluous property that is not enrolled
211
+ * to the type `T`, you can use {@link assert} function instead.
212
+ *
213
+ * @template T Type of the input value
214
+ * @param input A value to be asserted
215
+ * @returns Parametric input value
216
+ * @throws A {@link TypeGuardError} instance with detailed reason
217
+ *
218
+ * @author Jeongho Nam - https://github.com/samchon
219
+ */
220
+ export function assertEquals<T>(input: T): T;
221
+
222
+ /**
223
+ * Asserts equality between a value and its type.
224
+ *
225
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
226
+ * reason, if the parametric value is not following the type `T` or some superfluous
227
+ * property that is not listed on the type `T` has been found. Otherwise, the value is
228
+ * following the type `T` without any superfluous property, just input parameter would
229
+ * be returned.
230
+ *
231
+ * If what you want is not asserting but just knowing whether the parametric value is
232
+ * following the type `T` or not, you can choose the {@link equals} function instead.
233
+ * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
234
+ *
235
+ * On the other hand, if you want to allow superfluous property that is not enrolled
236
+ * to the type `T`, you can use {@link assert} function instead.
237
+ *
238
+ * @template T Type of the input value
239
+ * @param input A value to be asserted
240
+ * @returns Parametric input value casted as `T`
241
+ * @throws A {@link TypeGuardError} instance with detailed reason
242
+ *
243
+ * @author Jeongho Nam - https://github.com/samchon
244
+ */
245
+ export function assertEquals<T>(input: unknown): T;
246
+
247
+ /**
248
+ * @internal
249
+ */
250
+ export function assertEquals(): never {
251
+ halt("assertEquals");
252
+ }
253
+ Object.assign(assertEquals, Namespace.assert("assertEquals"));
254
+
255
+ /**
256
+ * Tests equality between a value and its type.
257
+ *
258
+ * Tests a parametric value type and returns whether it's equivalent to the type `T`
259
+ * or not. If the parametric value is matched with the type `T` and there's not any
260
+ * superfluous property that is not listed on the type `T`, `true` value would be
261
+ * returned. Otherwise, the parametric value is not following the type `T` or some
262
+ * superfluous property exists, `false` value would be returned.
263
+ *
264
+ * If what you want is not just knowing whether the parametric value is following the
265
+ * type `T` or not, but throwing an exception with detailed reason, you can choose
266
+ * {@link assertEquals} function instead. Also, if you want to know all the errors with
267
+ * detailed reasons, {@link validateEquals} function would be useful.
268
+ *
269
+ * On the other hand, if you want to allow superfluous property that is not enrolled
270
+ * to the type `T`, you can use {@link is} function instead.
271
+ *
272
+ * @template T Type of the input value
273
+ * @param input A value to be tested
274
+ * @returns Whether the parametric value is equivalent to the type `T` or not
275
+ *
276
+ * @author Jeongho Nam - https://github.com/samchon
277
+ */
278
+ export function equals<T>(input: T): input is T;
279
+
280
+ /**
281
+ * Tests equality between a value and its type.
282
+ *
283
+ * Tests a parametric value type and returns whether it's equivalent to the type `T`
284
+ * or not. If the parametric value is matched with the type `T` and there's not any
285
+ * superfluous property that is not listed on the type `T`, `true` value would be
286
+ * returned. Otherwise, the parametric value is not following the type `T` or some
287
+ * superfluous property exists, `false` value would be returned.
288
+ *
289
+ * If what you want is not just knowing whether the parametric value is following the
290
+ * type `T` or not, but throwing an exception with detailed reason, you can choose
291
+ * {@link assertEquals} function instead. Also, if you want to know all the errors with
292
+ * detailed reasons, {@link validateEquals} function would be useful.
293
+ *
294
+ * On the other hand, if you want to allow superfluous property that is not enrolled
295
+ * to the type `T`, you can use {@link is} function instead.
296
+ *
297
+ * @template T Type of the input value
298
+ * @param input A value to be tested
299
+ * @returns Whether the parametric value is equivalent to the type `T` or not
300
+ *
301
+ * @author Jeongho Nam - https://github.com/samchon
302
+ */
303
+ export function equals<T>(input: unknown): input is T;
304
+
305
+ /**
306
+ * @internal
307
+ */
308
+ export function equals(): never {
309
+ halt("equals");
310
+ }
311
+ Object.assign(equals, Namespace.is());
312
+
313
+ /**
314
+ * Validates equality between a value and its type.
315
+ *
316
+ * Validates a parametric value type and archives all the type errors into an
317
+ * {@link IValidation.errors} array, if the parametric value is not following the
318
+ * type `T` or some superfluous property that is not listed on the type `T` has been
319
+ * found. Of course, if the parametric value is following the type `T` and no
320
+ * superfluous property exists, the {@link IValidation.errors} array would be empty
321
+ * and {@link IValidation.success} would have the `true` value.
322
+ *
323
+ * If what you want is not finding all the error, but asserting the parametric value
324
+ * type with exception throwing, you can choose {@link assert} function instead.
325
+ * Otherwise, you just want to know whether the parametric value is matched with the
326
+ * type `T`, {@link is} function is the way to go.
327
+ *
328
+ * On the other and, if you don't want to allow any superfluous property that is not
329
+ * enrolled to the type `T`, you can use {@link validateEquals} function instead.
330
+ *
331
+ * @template Type of the input value
332
+ * @param input A value to be validated
333
+ * @returns Validation result
334
+ *
335
+ * @author Jeongho Nam - https://github.com/samchon
336
+ */
337
+ export function validateEquals<T>(input: T): IValidation<T>;
338
+
339
+ /**
340
+ * Validates equality between a value and its type.
341
+ *
342
+ * Validates a parametric value type and archives all the type errors into an
343
+ * {@link IValidation.errors} array, if the parametric value is not following the
344
+ * type `T` or some superfluous property that is not listed on the type `T` has been
345
+ * found. Of course, if the parametric value is following the type `T` and no
346
+ * superfluous property exists, the {@link IValidation.errors} array would be empty
347
+ * and {@link IValidation.success} would have the `true` value.
348
+ *
349
+ * If what you want is not finding all the error, but asserting the parametric value
350
+ * type with exception throwing, you can choose {@link assert} function instead.
351
+ * Otherwise, you just want to know whether the parametric value is matched with the
352
+ * type `T`, {@link is} function is the way to go.
353
+ *
354
+ * On the other and, if you don't want to allow any superfluous property that is not
355
+ * enrolled to the type `T`, you can use {@link validateEquals} function instead.
356
+ *
357
+ * @template Type of the input value
358
+ * @param input A value to be validated
359
+ * @returns Validation result
360
+ *
361
+ * @author Jeongho Nam - https://github.com/samchon
362
+ */
363
+ export function validateEquals<T>(input: unknown): IValidation<T>;
364
+
365
+ /**
366
+ * @internal
367
+ */
368
+ export function validateEquals(): never {
369
+ halt("validateEquals");
370
+ }
371
+ Object.assign(validateEquals, Namespace.validate());
372
+
373
+ /* -----------------------------------------------------------
374
+ RANDOM
375
+ ----------------------------------------------------------- */
376
+ /**
377
+ * > You must configure the generic argument `T`.
378
+ *
379
+ * Generate random data.
380
+ *
381
+ * Generates a random data following type the `T`.
382
+ *
383
+ * For reference, this `typia.random()` function generates only primitive type.
384
+ * If there're some methods in the type `T` or its nested instances, those would
385
+ * be ignored. Also, when the type `T` has a `toJSON()` method, its return type
386
+ * would be generated instead.
387
+ *
388
+ * @template T Type of data to generate
389
+ * @param generator Random data generator
390
+ * @return Randomly generated data
391
+ *
392
+ * @author Jeongho Nam - https://github.com/samchon
393
+ */
394
+ export function random(generator?: Partial<IRandomGenerator>): never;
395
+
396
+ /**
397
+ * Generate random data.
398
+ *
399
+ * Generates a random data following type the `T`.
400
+ *
401
+ * For reference, this `typia.random()` function generates only primitive type.
402
+ * If there're some methods in the type `T` or its nested instances, those would
403
+ * be ignored. Also, when the type `T` has a `toJSON()` method, its return type
404
+ * would be generated instead.
405
+ *
406
+ * @template T Type of data to generate
407
+ * @param generator Random data generator
408
+ * @return Randomly generated data
409
+ *
410
+ * @author Jeongho Nam - https://github.com/samchon
411
+ */
412
+ export function random<T>(generator?: Partial<IRandomGenerator>): Resolved<T>;
413
+
414
+ /**
415
+ * @internal
416
+ */
417
+ export function random(): never {
418
+ halt("random");
419
+ }
420
+ Object.assign(random, Namespace.random());
421
+
422
+ /**
423
+ * @internal
424
+ */
425
+ export function metadata(): never;
426
+
427
+ /**
428
+ * @internal
429
+ */
430
+ export function metadata<Types extends unknown[]>(): IMetadataApplication;
431
+
432
+ /**
433
+ * @internal
434
+ */
435
+ export function metadata(): never {
436
+ halt("metadata");
437
+ }
438
+
439
+ /* -----------------------------------------------------------
440
+ FACTORY FUNCTIONS
441
+ ----------------------------------------------------------- */
442
+ /**
443
+ * Creates a reusable {@link assert} function.
444
+ *
445
+ * @danger You must configure the generic argument `T`
446
+ * @returns Nothing until you configure the generic argument `T`
447
+ * @throws compile error
448
+ *
449
+ * @author Jeongho Nam - https://github.com/samchon
450
+ */
451
+ export function createAssert(): never;
452
+
453
+ /**
454
+ * Creates a reusable {@link assert} function.
455
+ *
456
+ * @template T Type of the input value
457
+ * @returns A reusable `assert` function
458
+ *
459
+ * @author Jeongho Nam - https://github.com/samchon
460
+ */
461
+ export function createAssert<T>(): (input: unknown) => T;
462
+
463
+ /**
464
+ * @internal
465
+ */
466
+ export function createAssert<T>(): (input: unknown) => T {
467
+ halt("createAssert");
468
+ }
469
+ Object.assign(createAssert, assert);
470
+
471
+ /**
472
+ * Creates a reusable {@link is} function.
473
+ *
474
+ * @danger You must configure the generic argument `T`
475
+ * @returns Nothing until you configure the generic argument `T`
476
+ * @throws compile error
477
+ *
478
+ * @author Jeongho Nam - https://github.com/samchon
479
+ */
480
+ export function createIs(): never;
481
+
482
+ /**
483
+ * Creates a reusable {@link is} function.
484
+ *
485
+ * @template T Type of the input value
486
+ * @returns A reusable `is` function
487
+ *
488
+ * @author Jeongho Nam - https://github.com/samchon
489
+ */
490
+ export function createIs<T>(): (input: unknown) => input is T;
491
+
492
+ /**
493
+ * @internal
494
+ */
495
+ export function createIs<T>(): (input: unknown) => input is T {
496
+ halt("createIs");
497
+ }
498
+ Object.assign(createIs, is);
499
+
500
+ /**
501
+ * Creates a reusable {@link validate} function.
502
+ *
503
+ * @danger You must configure the generic argument `T`
504
+ * @returns Nothing until you configure the generic argument `T`
505
+ * @throws compile error
506
+ *
507
+ * @author Jeongho Nam - https://github.com/samchon
508
+ */
509
+ export function createValidate(): never;
510
+
511
+ /**
512
+ * Creates a reusable {@link validate} function.
513
+ *
514
+ * @template T Type of the input value
515
+ * @returns A reusable `validate` function
516
+ *
517
+ * @author Jeongho Nam - https://github.com/samchon
518
+ */
519
+ export function createValidate<T>(): (input: unknown) => IValidation<T>;
520
+
521
+ /**
522
+ * @internal
523
+ */
524
+ export function createValidate(): (input: unknown) => IValidation {
525
+ halt("createValidate");
526
+ }
527
+ Object.assign(createValidate, validate);
528
+
529
+ /**
530
+ * Creates a reusable {@link assertEquals} function.
531
+ *
532
+ * @danger You must configure the generic argument `T`
533
+ * @returns Nothing until you configure the generic argument `T`
534
+ * @throws compile error
535
+ *
536
+ * @author Jeongho Nam - https://github.com/samchon
537
+ */
538
+ export function createAssertEquals(): never;
539
+
540
+ /**
541
+ * Creates a reusable {@link assertEquals} function.
542
+ *
543
+ * @template T Type of the input value
544
+ * @returns A reusable `assertEquals` function
545
+ *
546
+ * @author Jeongho Nam - https://github.com/samchon
547
+ */
548
+ export function createAssertEquals<T>(): (input: unknown) => T;
549
+
550
+ /**
551
+ * @internal
552
+ */
553
+ export function createAssertEquals<T>(): (input: unknown) => T {
554
+ halt("createAssertEquals");
555
+ }
556
+ Object.assign(createAssertEquals, assertEquals);
557
+
558
+ /**
559
+ * Creates a reusable {@link equals} function.
560
+ *
561
+ * @danger You must configure the generic argument `T`
562
+ * @returns Nothing until you configure the generic argument `T`
563
+ * @throws compile error
564
+ *
565
+ * @author Jeongho Nam - https://github.com/samchon
566
+ */
567
+ export function createEquals(): never;
568
+
569
+ /**
570
+ * Creates a reusable {@link equals} function.
571
+ *
572
+ * @template T Type of the input value
573
+ * @returns A reusable `equals` function
574
+ *
575
+ * @author Jeongho Nam - https://github.com/samchon
576
+ */
577
+ export function createEquals<T>(): (input: unknown) => input is T;
578
+
579
+ /**
580
+ * @internal
581
+ */
582
+ export function createEquals<T>(): (input: unknown) => input is T {
583
+ halt("createEquals");
584
+ }
585
+ Object.assign(createEquals, equals);
586
+
587
+ /**
588
+ * Creates a reusable {@link validateEquals} function.
589
+ *
590
+ * @danger You must configure the generic argument `T`
591
+ * @returns Nothing until you configure the generic argument `T`
592
+ * @throws compile error
593
+ *
594
+ * @author Jeongho Nam - https://github.com/samchon
595
+ */
596
+ export function createValidateEquals(): never;
597
+
598
+ /**
599
+ * Creates a reusable {@link validateEquals} function.
600
+ *
601
+ * @template T Type of the input value
602
+ * @returns A reusable `validateEquals` function
603
+ *
604
+ * @author Jeongho Nam - https://github.com/samchon
605
+ */
606
+ export function createValidateEquals<T>(): (input: unknown) => IValidation<T>;
607
+
608
+ /**
609
+ * @internal
610
+ */
611
+ export function createValidateEquals(): (input: unknown) => IValidation {
612
+ halt("createValidateEquals");
613
+ }
614
+ Object.assign(createValidateEquals, validateEquals);
615
+
616
+ /**
617
+ * Creates a reusable {@link random} function.
618
+ *
619
+ * @danger You must configure the generic argument `T`
620
+ * @param generator Random data generator
621
+ * @returns Nothing until you configure the generic argument `T`
622
+ * @throws compile error
623
+ *
624
+ * @author Jeongho Nam - https://github.com/samchon
625
+ */
626
+ export function createRandom(generator?: Partial<IRandomGenerator>): never;
627
+
628
+ /**
629
+ * Creates a resuable {@link random} function.
630
+ *
631
+ * @template T Type of the input value
632
+ * @param generator Random data generator
633
+ * @returns A reusable `random` function
634
+ *
635
+ * @author Jeongho Nam - https://github.com/samchon
636
+ */
637
+ export function createRandom<T>(
638
+ generator?: Partial<IRandomGenerator>,
639
+ ): () => Resolved<T>;
640
+
641
+ /**
642
+ * @internal
643
+ */
644
+ export function createRandom(): never {
645
+ halt("createRandom");
646
+ }
647
+ Object.assign(createRandom, random);
648
+
649
+ /**
650
+ * @internal
651
+ */
652
+ function halt(name: string): never {
653
+ throw new Error(
654
+ `Error on typia.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
655
+ );
656
+ }