typia 5.0.0-dev.20230823 → 5.0.0-dev.20230824

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 (387) hide show
  1. package/lib/Primitive.d.ts +14 -12
  2. package/lib/Resolved.d.ts +46 -0
  3. package/lib/{schemas/metadata/IMetadataTag.js → Resolved.js} +1 -1
  4. package/lib/Resolved.js.map +1 -0
  5. package/lib/factories/ExpressionFactory.d.ts +2 -0
  6. package/lib/factories/ExpressionFactory.js +24 -0
  7. package/lib/factories/ExpressionFactory.js.map +1 -1
  8. package/lib/factories/IdentifierFactory.d.ts +2 -1
  9. package/lib/factories/IdentifierFactory.js +11 -0
  10. package/lib/factories/IdentifierFactory.js.map +1 -1
  11. package/lib/factories/MetadataCollection.d.ts +7 -7
  12. package/lib/factories/MetadataCollection.js +4 -4
  13. package/lib/factories/MetadataCollection.js.map +1 -1
  14. package/lib/factories/MetadataFactory.d.ts +1 -1
  15. package/lib/factories/MetadataTagFactory.d.ts +2 -2
  16. package/lib/factories/MetadataTagFactory.js +15 -13
  17. package/lib/factories/MetadataTagFactory.js.map +1 -1
  18. package/lib/factories/ProtobufFactory.js +11 -10
  19. package/lib/factories/ProtobufFactory.js.map +1 -1
  20. package/lib/factories/internal/metadata/emend_metadata_atomics.js +6 -6
  21. package/lib/factories/internal/metadata/emend_metadata_atomics.js.map +1 -1
  22. package/lib/factories/internal/metadata/emplace_metadata_array_type.d.ts +5 -0
  23. package/lib/factories/internal/metadata/{emplace_metadata_array.js → emplace_metadata_array_type.js} +4 -4
  24. package/lib/factories/internal/metadata/emplace_metadata_array_type.js.map +1 -0
  25. package/lib/factories/internal/metadata/emplace_metadata_tuple.d.ts +2 -2
  26. package/lib/factories/internal/metadata/explore_metadata.js +3 -3
  27. package/lib/factories/internal/metadata/explore_metadata.js.map +1 -1
  28. package/lib/factories/internal/metadata/iterate_metadata_array.js +7 -3
  29. package/lib/factories/internal/metadata/iterate_metadata_array.js.map +1 -1
  30. package/lib/factories/internal/metadata/iterate_metadata_atomic.js +1 -1
  31. package/lib/factories/internal/metadata/iterate_metadata_atomic.js.map +1 -1
  32. package/lib/factories/internal/metadata/iterate_metadata_collection.js +26 -18
  33. package/lib/factories/internal/metadata/iterate_metadata_collection.js.map +1 -1
  34. package/lib/factories/internal/metadata/iterate_metadata_comment_tags.d.ts +2 -0
  35. package/lib/factories/internal/metadata/{iterate_metadata_tag.js → iterate_metadata_comment_tags.js} +4 -4
  36. package/lib/factories/internal/metadata/iterate_metadata_comment_tags.js.map +1 -0
  37. package/lib/factories/internal/metadata/iterate_metadata_intersection.js +138 -16
  38. package/lib/factories/internal/metadata/iterate_metadata_intersection.js.map +1 -1
  39. package/lib/factories/internal/metadata/iterate_metadata_native.js +2 -10
  40. package/lib/factories/internal/metadata/iterate_metadata_native.js.map +1 -1
  41. package/lib/factories/internal/metadata/iterate_metadata_object.js +0 -7
  42. package/lib/factories/internal/metadata/iterate_metadata_object.js.map +1 -1
  43. package/lib/factories/internal/metadata/iterate_metadata_resolve.js +6 -6
  44. package/lib/factories/internal/metadata/iterate_metadata_resolve.js.map +1 -1
  45. package/lib/factories/internal/metadata/iterate_metadata_sort.js +4 -4
  46. package/lib/factories/internal/metadata/iterate_metadata_sort.js.map +1 -1
  47. package/lib/factories/internal/metadata/iterate_metadata_tuple.js +6 -2
  48. package/lib/factories/internal/metadata/iterate_metadata_tuple.js.map +1 -1
  49. package/lib/factories/internal/metadata/iterate_metadata_type_tags.d.ts +3 -0
  50. package/lib/factories/internal/metadata/iterate_metadata_type_tags.js +157 -0
  51. package/lib/factories/internal/metadata/iterate_metadata_type_tags.js.map +1 -0
  52. package/lib/functional/$ProtobufWriter.js.map +1 -1
  53. package/lib/functional/$any.js +2 -1
  54. package/lib/functional/$any.js.map +1 -1
  55. package/lib/functional/$clone.d.ts +2 -0
  56. package/lib/functional/$clone.js +8 -0
  57. package/lib/functional/$clone.js.map +1 -0
  58. package/lib/json.d.ts +15 -15
  59. package/lib/misc.d.ts +42 -42
  60. package/lib/module.d.ts +20 -56
  61. package/lib/module.js +4 -17
  62. package/lib/module.js.map +1 -1
  63. package/lib/programmers/AssertProgrammer.js +2 -4
  64. package/lib/programmers/AssertProgrammer.js.map +1 -1
  65. package/lib/programmers/CheckerProgrammer.js +39 -30
  66. package/lib/programmers/CheckerProgrammer.js.map +1 -1
  67. package/lib/programmers/FeatureProgrammer.d.ts +4 -4
  68. package/lib/programmers/FeatureProgrammer.js.map +1 -1
  69. package/lib/programmers/IsProgrammer.d.ts +1 -1
  70. package/lib/programmers/IsProgrammer.js +3 -5
  71. package/lib/programmers/IsProgrammer.js.map +1 -1
  72. package/lib/programmers/RandomProgrammer.js +328 -142
  73. package/lib/programmers/RandomProgrammer.js.map +1 -1
  74. package/lib/programmers/ValidateProgrammer.js +2 -4
  75. package/lib/programmers/ValidateProgrammer.js.map +1 -1
  76. package/lib/programmers/helpers/AtomicPredicator.js +2 -2
  77. package/lib/programmers/helpers/AtomicPredicator.js.map +1 -1
  78. package/lib/programmers/helpers/FunctionImporeter.d.ts +2 -0
  79. package/lib/programmers/helpers/FunctionImporeter.js +2 -1
  80. package/lib/programmers/helpers/FunctionImporeter.js.map +1 -1
  81. package/lib/programmers/helpers/ICheckEntry.d.ts +1 -1
  82. package/lib/programmers/helpers/ProtobufUtil.js +2 -2
  83. package/lib/programmers/helpers/ProtobufUtil.js.map +1 -1
  84. package/lib/programmers/helpers/RandomJoiner.d.ts +4 -4
  85. package/lib/programmers/helpers/RandomJoiner.js.map +1 -1
  86. package/lib/programmers/helpers/RandomRanger.d.ts +6 -6
  87. package/lib/programmers/helpers/RandomRanger.js.map +1 -1
  88. package/lib/programmers/helpers/StringifyPredicator.js +1 -2
  89. package/lib/programmers/helpers/StringifyPredicator.js.map +1 -1
  90. package/lib/programmers/helpers/UnionExplorer.d.ts +8 -8
  91. package/lib/programmers/helpers/UnionExplorer.js +40 -29
  92. package/lib/programmers/helpers/UnionExplorer.js.map +1 -1
  93. package/lib/programmers/helpers/disable_function_importer_declare.js +1 -0
  94. package/lib/programmers/helpers/disable_function_importer_declare.js.map +1 -1
  95. package/lib/programmers/internal/application_array.js +1 -1
  96. package/lib/programmers/internal/application_array.js.map +1 -1
  97. package/lib/programmers/internal/application_default_string.js +2 -2
  98. package/lib/programmers/internal/application_default_string.js.map +1 -1
  99. package/lib/programmers/internal/application_resolved.d.ts +2 -2
  100. package/lib/programmers/internal/application_resolved.js +2 -2
  101. package/lib/programmers/internal/application_resolved.js.map +1 -1
  102. package/lib/programmers/internal/application_schema.js +7 -7
  103. package/lib/programmers/internal/application_schema.js.map +1 -1
  104. package/lib/programmers/internal/application_string.js.map +1 -1
  105. package/lib/programmers/internal/application_tuple.js +10 -9
  106. package/lib/programmers/internal/application_tuple.js.map +1 -1
  107. package/lib/programmers/internal/check_array_length.js.map +1 -1
  108. package/lib/programmers/internal/check_array_tags.js +39 -0
  109. package/lib/programmers/internal/check_array_tags.js.map +1 -0
  110. package/lib/programmers/internal/check_bigint.js +88 -74
  111. package/lib/programmers/internal/check_bigint.js.map +1 -1
  112. package/lib/programmers/internal/check_number.js +142 -131
  113. package/lib/programmers/internal/check_number.js.map +1 -1
  114. package/lib/programmers/internal/check_string.js +30 -6
  115. package/lib/programmers/internal/check_string.js.map +1 -1
  116. package/lib/programmers/internal/check_string_tags.js.map +1 -1
  117. package/lib/programmers/internal/check_template.js +16 -49
  118. package/lib/programmers/internal/check_template.js.map +1 -1
  119. package/lib/programmers/internal/check_union_array_like.js +3 -2
  120. package/lib/programmers/internal/check_union_array_like.js.map +1 -1
  121. package/lib/programmers/internal/metadata_to_pattern.js +4 -4
  122. package/lib/programmers/internal/metadata_to_pattern.js.map +1 -1
  123. package/lib/programmers/internal/stringify_dynamic_properties.js +2 -1
  124. package/lib/programmers/internal/stringify_dynamic_properties.js.map +1 -1
  125. package/lib/programmers/internal/wrap_metadata_rest_tuple.js +9 -5
  126. package/lib/programmers/internal/wrap_metadata_rest_tuple.js.map +1 -1
  127. package/lib/programmers/json/JsonStringifyProgrammer.js +33 -27
  128. package/lib/programmers/json/JsonStringifyProgrammer.js.map +1 -1
  129. package/lib/programmers/misc/MiscAssertCloneProgrammer.js +1 -1
  130. package/lib/programmers/misc/MiscAssertCloneProgrammer.js.map +1 -1
  131. package/lib/programmers/misc/MiscCloneProgrammer.js +124 -43
  132. package/lib/programmers/misc/MiscCloneProgrammer.js.map +1 -1
  133. package/lib/programmers/misc/MiscIsCloneProgrammer.js +1 -1
  134. package/lib/programmers/misc/MiscIsCloneProgrammer.js.map +1 -1
  135. package/lib/programmers/misc/MiscLiteralsProgrammer.js +3 -3
  136. package/lib/programmers/misc/MiscLiteralsProgrammer.js.map +1 -1
  137. package/lib/programmers/misc/MiscPruneProgrammer.js +15 -15
  138. package/lib/programmers/misc/MiscPruneProgrammer.js.map +1 -1
  139. package/lib/programmers/misc/MiscValidateCloneProgrammer.js +1 -1
  140. package/lib/programmers/misc/MiscValidateCloneProgrammer.js.map +1 -1
  141. package/lib/programmers/protobuf/ProtobufAssertDecodeProgrammer.js +3 -3
  142. package/lib/programmers/protobuf/ProtobufAssertDecodeProgrammer.js.map +1 -1
  143. package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js +8 -8
  144. package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js.map +1 -1
  145. package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js +3 -3
  146. package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js.map +1 -1
  147. package/lib/programmers/protobuf/ProtobufIsDecodeProgrammer.js +2 -2
  148. package/lib/programmers/protobuf/ProtobufIsDecodeProgrammer.js.map +1 -1
  149. package/lib/programmers/protobuf/ProtobufMessageProgrammer.js +1 -1
  150. package/lib/programmers/protobuf/ProtobufMessageProgrammer.js.map +1 -1
  151. package/lib/programmers/protobuf/ProtobufValidateDecodeProgrammer.js +1 -1
  152. package/lib/programmers/protobuf/ProtobufValidateDecodeProgrammer.js.map +1 -1
  153. package/lib/protobuf.d.ts +631 -10
  154. package/lib/protobuf.js +13 -13
  155. package/lib/protobuf.js.map +1 -1
  156. package/lib/schemas/json/IJsonSchema.d.ts +2 -2
  157. package/lib/schemas/metadata/IMetadata.d.ts +13 -6
  158. package/lib/schemas/metadata/IMetadataAlias.d.ts +2 -2
  159. package/lib/schemas/metadata/IMetadataArray.d.ts +4 -6
  160. package/lib/schemas/metadata/IMetadataArrayType.d.ts +8 -0
  161. package/lib/{CustomValidatorMap.js → schemas/metadata/IMetadataArrayType.js} +1 -1
  162. package/lib/schemas/metadata/IMetadataArrayType.js.map +1 -0
  163. package/lib/schemas/metadata/IMetadataAtomic.d.ts +5 -0
  164. package/lib/schemas/metadata/{IMetadataResolved.js → IMetadataAtomic.js} +1 -1
  165. package/lib/schemas/metadata/IMetadataAtomic.js.map +1 -0
  166. package/lib/schemas/metadata/IMetadataCollection.d.ts +4 -4
  167. package/lib/schemas/metadata/{IMetadataTag.d.ts → IMetadataCommentTag.d.ts} +2 -2
  168. package/lib/schemas/metadata/IMetadataCommentTag.js +3 -0
  169. package/lib/schemas/metadata/IMetadataCommentTag.js.map +1 -0
  170. package/lib/schemas/metadata/{IMetadataResolved.d.ts → IMetadataEscaped.d.ts} +1 -1
  171. package/lib/schemas/metadata/IMetadataEscaped.js +3 -0
  172. package/lib/schemas/metadata/IMetadataEscaped.js.map +1 -0
  173. package/lib/schemas/metadata/IMetadataProperty.d.ts +2 -2
  174. package/lib/schemas/metadata/IMetadataTuple.d.ts +4 -6
  175. package/lib/schemas/metadata/IMetadataTupleType.d.ts +8 -0
  176. package/lib/schemas/metadata/IMetadataTupleType.js +3 -0
  177. package/lib/schemas/metadata/IMetadataTupleType.js.map +1 -0
  178. package/lib/schemas/metadata/IMetadataTypeTag.d.ts +6 -0
  179. package/lib/schemas/metadata/IMetadataTypeTag.js +3 -0
  180. package/lib/schemas/metadata/IMetadataTypeTag.js.map +1 -0
  181. package/lib/schemas/metadata/Metadata.d.ts +4 -4
  182. package/lib/schemas/metadata/Metadata.js +217 -157
  183. package/lib/schemas/metadata/Metadata.js.map +1 -1
  184. package/lib/schemas/metadata/MetadataAlias.d.ts +2 -2
  185. package/lib/schemas/metadata/MetadataArray.d.ts +6 -6
  186. package/lib/schemas/metadata/MetadataArray.js +5 -19
  187. package/lib/schemas/metadata/MetadataArray.js.map +1 -1
  188. package/lib/schemas/metadata/MetadataArrayType.d.ts +14 -0
  189. package/lib/schemas/metadata/MetadataArrayType.js +36 -0
  190. package/lib/schemas/metadata/MetadataArrayType.js.map +1 -0
  191. package/lib/schemas/metadata/{MetadataResolved.d.ts → MetadataEscaped.d.ts} +3 -3
  192. package/lib/schemas/metadata/{MetadataResolved.js → MetadataEscaped.js} +11 -11
  193. package/lib/schemas/metadata/MetadataEscaped.js.map +1 -0
  194. package/lib/schemas/metadata/MetadataProperty.d.ts +2 -2
  195. package/lib/schemas/metadata/MetadataTuple.d.ts +4 -6
  196. package/lib/schemas/metadata/MetadataTuple.js +5 -19
  197. package/lib/schemas/metadata/MetadataTuple.js.map +1 -1
  198. package/lib/schemas/metadata/MetadataTupleType.d.ts +13 -0
  199. package/lib/schemas/metadata/MetadataTupleType.js +40 -0
  200. package/lib/schemas/metadata/MetadataTupleType.js.map +1 -0
  201. package/lib/tags/ExclusiveMaximum.d.ts +8 -0
  202. package/lib/tags/ExclusiveMaximum.js +3 -0
  203. package/lib/tags/ExclusiveMaximum.js.map +1 -0
  204. package/lib/tags/ExclusiveMinimum.d.ts +8 -0
  205. package/lib/tags/ExclusiveMinimum.js +3 -0
  206. package/lib/tags/ExclusiveMinimum.js.map +1 -0
  207. package/lib/tags/Format.d.ts +8 -0
  208. package/lib/tags/Format.js +3 -0
  209. package/lib/tags/Format.js.map +1 -0
  210. package/lib/tags/MaxItems.d.ts +8 -0
  211. package/lib/tags/MaxItems.js +3 -0
  212. package/lib/tags/MaxItems.js.map +1 -0
  213. package/lib/tags/MaxLength.d.ts +8 -0
  214. package/lib/tags/MaxLength.js +3 -0
  215. package/lib/tags/MaxLength.js.map +1 -0
  216. package/lib/tags/Maximum.d.ts +8 -0
  217. package/lib/tags/Maximum.js +3 -0
  218. package/lib/tags/Maximum.js.map +1 -0
  219. package/lib/tags/MinItems.d.ts +8 -0
  220. package/lib/tags/MinItems.js +3 -0
  221. package/lib/tags/MinItems.js.map +1 -0
  222. package/lib/tags/MinLength.d.ts +8 -0
  223. package/lib/tags/MinLength.js +3 -0
  224. package/lib/tags/MinLength.js.map +1 -0
  225. package/lib/tags/Minimum.d.ts +8 -0
  226. package/lib/tags/Minimum.js +3 -0
  227. package/lib/tags/Minimum.js.map +1 -0
  228. package/lib/tags/MultipleOf.d.ts +8 -0
  229. package/lib/tags/MultipleOf.js +3 -0
  230. package/lib/tags/MultipleOf.js.map +1 -0
  231. package/lib/tags/Pattern.d.ts +8 -0
  232. package/lib/tags/Pattern.js +3 -0
  233. package/lib/tags/Pattern.js.map +1 -0
  234. package/lib/tags/TagBase.d.ts +10 -0
  235. package/lib/tags/TagBase.js +3 -0
  236. package/lib/tags/TagBase.js.map +1 -0
  237. package/lib/tags/Type.d.ts +13 -0
  238. package/lib/tags/Type.js +3 -0
  239. package/lib/tags/Type.js.map +1 -0
  240. package/lib/tags/index.d.ts +12 -0
  241. package/lib/tags/index.js +29 -0
  242. package/lib/tags/index.js.map +1 -0
  243. package/lib/transformers/FileTransformer.d.ts +1 -1
  244. package/lib/transformers/FileTransformer.js +12 -1
  245. package/lib/transformers/FileTransformer.js.map +1 -1
  246. package/lib/transformers/IProject.d.ts +1 -0
  247. package/lib/transformers/features/json/JsonApplicationTransformer.js +5 -3
  248. package/lib/transformers/features/json/JsonApplicationTransformer.js.map +1 -1
  249. package/lib/transformers/features/misc/MetadataTransformer.js +1 -1
  250. package/lib/transformers/features/misc/MetadataTransformer.js.map +1 -1
  251. package/lib/utils/RandomGenerator.js +3 -2
  252. package/lib/utils/RandomGenerator.js.map +1 -1
  253. package/package.json +2 -1
  254. package/src/Primitive.ts +19 -15
  255. package/src/Resolved.ts +116 -0
  256. package/src/factories/ExpressionFactory.ts +44 -0
  257. package/src/factories/IdentifierFactory.ts +15 -0
  258. package/src/factories/MetadataCollection.ts +18 -12
  259. package/src/factories/MetadataFactory.ts +1 -1
  260. package/src/factories/MetadataTagFactory.ts +28 -27
  261. package/src/factories/ProtobufFactory.ts +12 -10
  262. package/src/factories/internal/metadata/emend_metadata_atomics.ts +7 -5
  263. package/src/factories/internal/metadata/{emplace_metadata_array.ts → emplace_metadata_array_type.ts} +3 -3
  264. package/src/factories/internal/metadata/emplace_metadata_tuple.ts +2 -2
  265. package/src/factories/internal/metadata/explore_metadata.ts +3 -3
  266. package/src/factories/internal/metadata/iterate_metadata_array.ts +13 -5
  267. package/src/factories/internal/metadata/iterate_metadata_atomic.ts +6 -4
  268. package/src/factories/internal/metadata/iterate_metadata_collection.ts +29 -22
  269. package/src/factories/internal/metadata/{iterate_metadata_tag.ts → iterate_metadata_comment_tags.ts} +1 -1
  270. package/src/factories/internal/metadata/iterate_metadata_intersection.ts +109 -15
  271. package/src/factories/internal/metadata/iterate_metadata_native.ts +0 -9
  272. package/src/factories/internal/metadata/iterate_metadata_object.ts +10 -10
  273. package/src/factories/internal/metadata/iterate_metadata_resolve.ts +6 -6
  274. package/src/factories/internal/metadata/iterate_metadata_sort.ts +4 -4
  275. package/src/factories/internal/metadata/iterate_metadata_tuple.ts +12 -4
  276. package/src/factories/internal/metadata/iterate_metadata_type_tags.ts +183 -0
  277. package/src/functional/$any.ts +3 -1
  278. package/src/functional/$clone.ts +4 -0
  279. package/src/json.ts +15 -15
  280. package/src/misc.ts +42 -42
  281. package/src/module.ts +20 -72
  282. package/src/programmers/AssertProgrammer.ts +4 -2
  283. package/src/programmers/CheckerProgrammer.ts +81 -48
  284. package/src/programmers/FeatureProgrammer.ts +6 -6
  285. package/src/programmers/IsProgrammer.ts +5 -3
  286. package/src/programmers/RandomProgrammer.ts +360 -41
  287. package/src/programmers/ValidateProgrammer.ts +4 -2
  288. package/src/programmers/helpers/AtomicPredicator.ts +2 -2
  289. package/src/programmers/helpers/FunctionImporeter.ts +2 -0
  290. package/src/programmers/helpers/ICheckEntry.ts +1 -1
  291. package/src/programmers/helpers/ProtobufUtil.ts +1 -1
  292. package/src/programmers/helpers/RandomJoiner.ts +8 -4
  293. package/src/programmers/helpers/RandomRanger.ts +8 -8
  294. package/src/programmers/helpers/StringifyPredicator.ts +1 -2
  295. package/src/programmers/helpers/UnionExplorer.ts +48 -34
  296. package/src/programmers/helpers/disable_function_importer_declare.ts +6 -1
  297. package/src/programmers/internal/application_array.ts +5 -4
  298. package/src/programmers/internal/application_default_string.ts +6 -2
  299. package/src/programmers/internal/application_resolved.ts +4 -4
  300. package/src/programmers/internal/application_schema.ts +7 -7
  301. package/src/programmers/internal/application_string.ts +2 -2
  302. package/src/programmers/internal/application_tuple.ts +12 -11
  303. package/src/programmers/internal/check_array_length.ts +2 -2
  304. package/src/programmers/internal/check_array_tags.ts +45 -0
  305. package/src/programmers/internal/check_bigint.ts +45 -17
  306. package/src/programmers/internal/check_number.ts +97 -70
  307. package/src/programmers/internal/check_string.ts +43 -12
  308. package/src/programmers/internal/check_string_tags.ts +3 -3
  309. package/src/programmers/internal/check_template.ts +1 -12
  310. package/src/programmers/internal/check_union_array_like.ts +6 -5
  311. package/src/programmers/internal/metadata_to_pattern.ts +4 -4
  312. package/src/programmers/internal/stringify_dynamic_properties.ts +1 -1
  313. package/src/programmers/internal/wrap_metadata_rest_tuple.ts +9 -5
  314. package/src/programmers/json/JsonStringifyProgrammer.ts +47 -29
  315. package/src/programmers/misc/MiscAssertCloneProgrammer.ts +1 -1
  316. package/src/programmers/misc/MiscCloneProgrammer.ts +253 -55
  317. package/src/programmers/misc/MiscIsCloneProgrammer.ts +1 -1
  318. package/src/programmers/misc/MiscLiteralsProgrammer.ts +3 -3
  319. package/src/programmers/misc/MiscPruneProgrammer.ts +31 -19
  320. package/src/programmers/misc/MiscValidateCloneProgrammer.ts +1 -1
  321. package/src/programmers/protobuf/ProtobufAssertDecodeProgrammer.ts +18 -9
  322. package/src/programmers/protobuf/ProtobufDecodeProgrammer.ts +18 -14
  323. package/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +15 -15
  324. package/src/programmers/protobuf/ProtobufIsDecodeProgrammer.ts +12 -2
  325. package/src/programmers/protobuf/ProtobufMessageProgrammer.ts +6 -6
  326. package/src/programmers/protobuf/ProtobufValidateDecodeProgrammer.ts +2 -2
  327. package/src/protobuf.ts +663 -31
  328. package/src/schemas/json/IJsonSchema.ts +2 -2
  329. package/src/schemas/metadata/IMetadata.ts +13 -7
  330. package/src/schemas/metadata/IMetadataAlias.ts +2 -2
  331. package/src/schemas/metadata/IMetadataArray.ts +4 -7
  332. package/src/schemas/metadata/IMetadataArrayType.ts +10 -0
  333. package/src/schemas/metadata/IMetadataAtomic.ts +6 -0
  334. package/src/schemas/metadata/IMetadataCollection.ts +4 -4
  335. package/src/schemas/metadata/{IMetadataTag.ts → IMetadataCommentTag.ts} +17 -17
  336. package/src/schemas/metadata/IMetadataDictionary.ts +4 -4
  337. package/src/schemas/metadata/{IMetadataResolved.ts → IMetadataEscaped.ts} +1 -1
  338. package/src/schemas/metadata/IMetadataProperty.ts +2 -2
  339. package/src/schemas/metadata/IMetadataTuple.ts +4 -7
  340. package/src/schemas/metadata/IMetadataTupleType.ts +10 -0
  341. package/src/schemas/metadata/IMetadataTypeTag.ts +6 -0
  342. package/src/schemas/metadata/Metadata.ts +125 -63
  343. package/src/schemas/metadata/MetadataAlias.ts +2 -2
  344. package/src/schemas/metadata/MetadataArray.ts +10 -34
  345. package/src/schemas/metadata/MetadataArrayType.ts +57 -0
  346. package/src/schemas/metadata/{MetadataResolved.ts → MetadataEscaped.ts} +9 -9
  347. package/src/schemas/metadata/MetadataProperty.ts +2 -2
  348. package/src/schemas/metadata/MetadataTuple.ts +10 -37
  349. package/src/schemas/metadata/MetadataTupleType.ts +67 -0
  350. package/src/tags/ExclusiveMaximum.ts +8 -0
  351. package/src/tags/ExclusiveMinimum.ts +8 -0
  352. package/src/tags/Format.ts +29 -0
  353. package/src/tags/MaxItems.ts +8 -0
  354. package/src/tags/MaxLength.ts +8 -0
  355. package/src/tags/Maximum.ts +8 -0
  356. package/src/tags/MinItems.ts +8 -0
  357. package/src/tags/MinLength.ts +8 -0
  358. package/src/tags/Minimum.ts +8 -0
  359. package/src/tags/MultipleOf.ts +10 -0
  360. package/src/tags/Pattern.ts +8 -0
  361. package/src/tags/TagBase.ts +17 -0
  362. package/src/tags/Type.ts +30 -0
  363. package/src/tags/index.ts +12 -0
  364. package/src/transformers/FileTransformer.ts +2 -2
  365. package/src/transformers/IProject.ts +1 -0
  366. package/src/transformers/features/json/JsonApplicationTransformer.ts +4 -3
  367. package/src/transformers/features/misc/MetadataTransformer.ts +1 -1
  368. package/src/typings/Atomic.ts +1 -0
  369. package/src/utils/RandomGenerator.ts +4 -2
  370. package/lib/CustomValidatorMap.d.ts +0 -110
  371. package/lib/CustomValidatorMap.js.map +0 -1
  372. package/lib/factories/internal/metadata/emplace_metadata_array.d.ts +0 -5
  373. package/lib/factories/internal/metadata/emplace_metadata_array.js.map +0 -1
  374. package/lib/factories/internal/metadata/iterate_metadata_tag.d.ts +0 -2
  375. package/lib/factories/internal/metadata/iterate_metadata_tag.js.map +0 -1
  376. package/lib/programmers/internal/check_array.js +0 -44
  377. package/lib/programmers/internal/check_array.js.map +0 -1
  378. package/lib/programmers/internal/check_custom.d.ts +0 -1
  379. package/lib/programmers/internal/check_custom.js +0 -30
  380. package/lib/programmers/internal/check_custom.js.map +0 -1
  381. package/lib/schemas/metadata/IMetadataResolved.js.map +0 -1
  382. package/lib/schemas/metadata/IMetadataTag.js.map +0 -1
  383. package/lib/schemas/metadata/MetadataResolved.js.map +0 -1
  384. package/src/CustomValidatorMap.ts +0 -126
  385. package/src/programmers/internal/check_array.ts +0 -30
  386. package/src/programmers/internal/check_custom.ts +0 -31
  387. /package/lib/programmers/internal/{check_array.d.ts → check_array_tags.d.ts} +0 -0
package/src/protobuf.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Namespace } from "./functional/Namespace";
2
2
 
3
3
  import { IValidation } from "./IValidation";
4
+ import { Resolved } from "./Resolved";
4
5
 
5
6
  /* ===========================================================
6
7
  PROTOCOL BUFFER
@@ -11,8 +12,46 @@ import { IValidation } from "./IValidation";
11
12
  ==============================================================
12
13
  SCHEMA
13
14
  ----------------------------------------------------------- */
15
+ /**
16
+ * > You must configure the generic argument `T`.
17
+ *
18
+ * Protocol Buffer Message Schema.
19
+ *
20
+ * Creates a Protocol Buffer Message Schema from a TypeScript type. The message
21
+ * schema would be returned as a string value, and it can be used to share with
22
+ * other developers/languages/frameworks.
23
+ *
24
+ * For reference, Protocol Buffer has lots of restrictions, so that expression power
25
+ * of Protocol Buffer is not enough strong to fully meet the TypeScript type specs.
26
+ * In such reason, if you put a TypeScript type that is not compatible with Protocol
27
+ * Buffer, this function would throw a compilation error.
28
+ *
29
+ * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
30
+ *
31
+ * @template T Target type
32
+ * @returns Protocol Buffer Message Schema.
33
+ *
34
+ * @author Jeongho Nam - https://github.com/samchon
35
+ */
14
36
  export function message(): never;
15
37
 
38
+ /**
39
+ * Protocol Buffer Message Schema.
40
+ *
41
+ * Creates a Protocol Buffer Message Schema from a TypeScript type. The message
42
+ * schema would be returned as a string value, and it can be used to share with
43
+ * other developers/languages/frameworks.
44
+ *
45
+ * For reference, Protocol Buffer has lots of restrictions, so that expression power
46
+ * of Protocol Buffer is not enough strong to fully meet the TypeScript type specs.
47
+ * In such reason, if you put a TypeScript type that is not compatible with Protocol
48
+ * Buffer, this function would throw a compilation error.
49
+ *
50
+ * @template T Target type
51
+ * @returns Protocol Buffer Message Schema.
52
+ *
53
+ * @author Jeongho Nam - https://github.com/samchon
54
+ */
16
55
  export function message<T>(): string;
17
56
 
18
57
  /**
@@ -25,9 +64,67 @@ export function message(): never {
25
64
  /* -----------------------------------------------------------
26
65
  DECODE
27
66
  ----------------------------------------------------------- */
67
+ /**
68
+ * > You must configure the generic argument `T`.
69
+ *
70
+ * Protocol Buffer Decoder.
71
+ *
72
+ * `typia.protobuf.decode()` is a function decoding a binary data of Protocol Buffer
73
+ * format to a TypeScript instance.
74
+ *
75
+ * For reference, as Protocol Buffer handles binary data directly, there's no way
76
+ * when `input` binary data was not encoded from the `T` typed value. In that case,
77
+ * unexpected behavior or internal error would be occured. Therefore, I recommend you
78
+ * to encode binary data of Protocol Buffer from type safe encode function like below.
79
+ * Use {@link encode} function only when you can ensure it.
80
+ *
81
+ * - {@link assertEncode}
82
+ * - {@link isEncode}
83
+ * - {@link validateEncode}
84
+ *
85
+ * Also, `typia` is providing a type safe decoder like {@link assertDecode}, but it
86
+ * is just for additional validation like whether a string value meets constant
87
+ * restriction, or a numeric value is keepking its range limit, represented by
88
+ * [comment tags](https://typia.io/docs/validators/tags). Thus, I repeat that,
89
+ * you've to ensure the type safety when using decoder functions.
90
+ *
91
+ * @tempate Expected type of decoded value
92
+ * @param input Protobuf Buffer binary data
93
+ * @returns Decoded value
94
+ *
95
+ * @author Jeongho Nam - https://github.com/samchon
96
+ */
28
97
  export function decode(input: Uint8Array): never;
29
98
 
30
- export function decode<T>(input: Uint8Array): T;
99
+ /**
100
+ * Protocol Buffer Decoder.
101
+ *
102
+ * `typia.protobuf.decode()` is a function decoding a binary data of Protocol Buffer
103
+ * format to a TypeScript instance.
104
+ *
105
+ * For reference, as Protocol Buffer handles binary data directly, there's no way
106
+ * when `input` binary data was not encoded from the `T` typed value. In that case,
107
+ * unexpected behavior or internal error would be occured. Therefore, I recommend you
108
+ * to encode binary data of Protocol Buffer from type safe encode function like below.
109
+ * Use {@link encode} function only when you can ensure it.
110
+ *
111
+ * - {@link assertEncode}
112
+ * - {@link isEncode}
113
+ * - {@link validateEncode}
114
+ *
115
+ * Also, `typia` is providing a type safe decoder like {@link assertDecode}, but it
116
+ * is just for additional validation like whether a string value meets constant
117
+ * restriction, or a numeric value is keepking its range limit, represented by
118
+ * [comment tags](https://typia.io/docs/validators/tags). Thus, I repeat that,
119
+ * you've to ensure the type safety when using decoder functions.
120
+ *
121
+ * @tempate Expected type of decoded value
122
+ * @param input Protobuf Buffer binary data
123
+ * @returns Decoded value
124
+ *
125
+ * @author Jeongho Nam - https://github.com/samchon
126
+ */
127
+ export function decode<T>(input: Uint8Array): Resolved<T>;
31
128
 
32
129
  /**
33
130
  * @internal
@@ -37,22 +134,65 @@ export function decode(): never {
37
134
  }
38
135
  Object.assign(decode, Namespace.protobuf.decode("decode"));
39
136
 
40
- export function isDecode(input: Uint8Array): never;
41
-
42
- export function isDecode<T>(input: Uint8Array): T | null;
43
-
44
137
  /**
45
- * @internal
138
+ * > You must configure the generic argument `T`.
139
+ *
140
+ * Protocol Buffer Decoder wity type assertion, but not safe.
141
+ *
142
+ * `typia.protobuf.assertDecode()` is a combination function of {@link decode} and
143
+ * {@link assert} function. Therefore, it decodes a binary data of Protocol Buffer to
144
+ * a TypeScript instance, and performs type assertion process. If decoded value is
145
+ * following the type `T`, it returns the decoded value. Otherwise, it throws
146
+ * {@link TypeGuardError} instead.
147
+ *
148
+ * However, note that, this validation is not always safe. It just performs additional
149
+ * type checking like whether a string value meets constant restriction, or a
150
+ * numeric value is keepking its range limit, represented by
151
+ * [comment tags](https://typia.io/docs/validators/tags). Therefore, when using
152
+ * decode functions, you have to ensure the type safety by yourself.
153
+ *
154
+ * In such type safety reason, I recommend you to use type safe encode functions.
155
+ *
156
+ * - {@link assertEncode}
157
+ * - {@link isEncode}
158
+ * - {@link validateEncode}
159
+ *
160
+ * @tempate Expected type of decoded value
161
+ * @param input Protobuf Buffer binary data
162
+ * @returns Decoded value
163
+ *
164
+ * @author Jeongho Nam - https://github.com/samchon
46
165
  */
47
- export function isDecode(): never {
48
- halt("isDecode");
49
- }
50
- Object.assign(isDecode, Namespace.is());
51
- Object.assign(isDecode, Namespace.protobuf.decode("isDecode"));
52
-
53
166
  export function assertDecode(input: Uint8Array): never;
54
167
 
55
- export function assertDecode<T>(input: Uint8Array): T;
168
+ /**
169
+ * Protocol Buffer Decoder wity type assertion, but not safe.
170
+ *
171
+ * `typia.protobuf.assertDecode()` is a combination function of {@link decode} and
172
+ * {@link assert} function. Therefore, it decodes a binary data of Protocol Buffer to
173
+ * a TypeScript instance, and performs type assertion process. If decoded value is
174
+ * following the type `T`, it returns the decoded value. Otherwise, it throws
175
+ * {@link TypeGuardError} instead.
176
+ *
177
+ * However, note that, this validation is not always safe. It just performs additional
178
+ * type checking like whether a string value meets constant restriction, or a
179
+ * numeric value is keepking its range limit, represented by
180
+ * [comment tags](https://typia.io/docs/validators/tags). Therefore, when using
181
+ * decode functions, you have to ensure the type safety by yourself.
182
+ *
183
+ * In such type safety reason, I recommend you to use type safe encode functions.
184
+ *
185
+ * - {@link assertEncode}
186
+ * - {@link isEncode}
187
+ * - {@link validateEncode}
188
+ *
189
+ * @tempate Expected type of decoded value
190
+ * @param input Protobuf Buffer binary data
191
+ * @returns Decoded value
192
+ *
193
+ * @author Jeongho Nam - https://github.com/samchon
194
+ */
195
+ export function assertDecode<T>(input: Uint8Array): Resolved<T>;
56
196
 
57
197
  /**
58
198
  * @internal
@@ -63,9 +203,136 @@ export function assertDecode(): never {
63
203
  Object.assign(assertDecode, Namespace.assert("assertDecode"));
64
204
  Object.assign(assertDecode, Namespace.protobuf.decode("assertDecode"));
65
205
 
206
+ /**
207
+ * > You must configure the generic argument `T`.
208
+ *
209
+ * Protocol Buffer Decoder wity type checking, but not safe.
210
+ *
211
+ * `typia.protobuf.isDecode()` is a combination function of {@link decode} and
212
+ * {@link is} function. Therefore, it decodes a binary data of Protocol Buffer to
213
+ * a TypeScript instance, and performs type checking process. If decoded value is
214
+ * following the type `T`, it returns the decoded value. Otherwise, it returns
215
+ * `null` value instead.
216
+ *
217
+ * However, note that, this validation is not always safe. It just performs additional
218
+ * type checking like whether a string value meets constant restriction, or a
219
+ * numeric value is keepking its range limit, represented by
220
+ * [comment tags](https://typia.io/docs/validators/tags). Therefore, when using
221
+ * decode functions, you have to ensure the type safety by yourself.
222
+ *
223
+ * In such type safety reason, I recommend you to use type safe encode functions.
224
+ *
225
+ * - {@link assertEncode}
226
+ * - {@link isEncode}
227
+ * - {@link validateEncode}
228
+ *
229
+ * @tempate Expected type of decoded value
230
+ * @param input Protobuf Buffer binary data
231
+ * @returns Decoded value
232
+ *
233
+ * @author Jeongho Nam - https://github.com/samchon
234
+ */
235
+ export function isDecode(input: Uint8Array): never;
236
+
237
+ /**
238
+ * Protocol Buffer Decoder wity type checking, but not safe.
239
+ *
240
+ * `typia.protobuf.isDecode()` is a combination function of {@link decode} and
241
+ * {@link is} function. Therefore, it decodes a binary data of Protocol Buffer to
242
+ * a TypeScript instance, and performs type checking process. If decoded value is
243
+ * following the type `T`, it returns the decoded value. Otherwise, it returns
244
+ * `null` value instead.
245
+ *
246
+ * However, note that, this validation is not always safe. It just performs additional
247
+ * type checking like whether a string value meets constant restriction, or a
248
+ * numeric value is keepking its range limit, represented by
249
+ * [comment tags](https://typia.io/docs/validators/tags). Therefore, when using
250
+ * decode functions, you have to ensure the type safety by yourself.
251
+ *
252
+ * In such type safety reason, I recommend you to use type safe encode functions.
253
+ *
254
+ * - {@link assertEncode}
255
+ * - {@link isEncode}
256
+ * - {@link validateEncode}
257
+ *
258
+ * @tempate Expected type of decoded value
259
+ * @param input Protobuf Buffer binary data
260
+ * @returns Decoded value
261
+ *
262
+ * @author Jeongho Nam - https://github.com/samchon
263
+ */
264
+ export function isDecode<T>(input: Uint8Array): Resolved<T> | null;
265
+
266
+ /**
267
+ * @internal
268
+ */
269
+ export function isDecode(): never {
270
+ halt("isDecode");
271
+ }
272
+ Object.assign(isDecode, Namespace.is());
273
+ Object.assign(isDecode, Namespace.protobuf.decode("isDecode"));
274
+
275
+ /**
276
+ * > You must configure the generic argument `T`.
277
+ *
278
+ * Protocol Buffer Decoder wity type validation, but not safe.
279
+ *
280
+ * `typia.protobuf.validateDecode()` is a combination function of {@link decode} and
281
+ * {@link validate} function. Therefore, it decodes a binary data of Protocol Buffer to
282
+ * a TypeScript instance, and performs type validation process. If decoded value is
283
+ * following the type `T`, it returns the decoded value with
284
+ * {@link IValidation.ISuccess} typed instance. Otherwise, it returns
285
+ * {@link IValidation.IFailure} value instead with detailed error reasons.
286
+ *
287
+ * However, note that, this validation is not always safe. It just performs additional
288
+ * type checking like whether a string value meets constant restriction, or a
289
+ * numeric value is keepking its range limit, represented by
290
+ * [comment tags](https://typia.io/docs/validators/tags). Therefore, when using
291
+ * decode functions, you have to ensure the type safety by yourself.
292
+ *
293
+ * In such type safety reason, I recommend you to use type safe encode functions.
294
+ *
295
+ * - {@link assertEncode}
296
+ * - {@link isEncode}
297
+ * - {@link validateEncode}
298
+ *
299
+ * @tempate Expected type of decoded value
300
+ * @param input Protobuf Buffer binary data
301
+ * @returns Decoded value
302
+ *
303
+ * @author Jeongho Nam - https://github.com/samchon
304
+ */
66
305
  export function validateDecode(input: Uint8Array): never;
67
306
 
68
- export function validateDecode<T>(input: Uint8Array): IValidation<T>;
307
+ /**
308
+ * Protocol Buffer Decoder wity type validation, but not safe.
309
+ *
310
+ * `typia.protobuf.validateDecode()` is a combination function of {@link decode} and
311
+ * {@link validate} function. Therefore, it decodes a binary data of Protocol Buffer to
312
+ * a TypeScript instance, and performs type validation process. If decoded value is
313
+ * following the type `T`, it returns the decoded value with
314
+ * {@link IValidation.ISuccess} typed instance. Otherwise, it returns
315
+ * {@link IValidation.IFailure} value instead with detailed error reasons.
316
+ *
317
+ * However, note that, this validation is not always safe. It just performs additional
318
+ * type checking like whether a string value meets constant restriction, or a
319
+ * numeric value is keepking its range limit, represented by
320
+ * [comment tags](https://typia.io/docs/validators/tags). Therefore, when using
321
+ * decode functions, you have to ensure the type safety by yourself.
322
+ *
323
+ * In such type safety reason, I recommend you to use type safe encode functions.
324
+ *
325
+ * - {@link assertEncode}
326
+ * - {@link isEncode}
327
+ * - {@link validateEncode}
328
+ *
329
+ * @tempate Expected type of decoded value
330
+ * @param input Protobuf Buffer binary data
331
+ * @returns Decoded value
332
+ *
333
+ * @author Jeongho Nam - https://github.com/samchon
334
+ */
335
+ export function validateDecode<T>(input: Uint8Array): IValidation<Resolved<T>>;
69
336
 
70
337
  /**
71
338
  * @internal
@@ -79,6 +346,33 @@ Object.assign(validateDecode, Namespace.protobuf.decode("validateDecode"));
79
346
  /* -----------------------------------------------------------
80
347
  ENCODE
81
348
  ----------------------------------------------------------- */
349
+ /**
350
+ * Protocol Buffer Encoder.
351
+ *
352
+ * Converts an input value to a binary data of Protocol Buffer format.
353
+ *
354
+ * For reference, this `typia.protobuf.encode()` does not validate the `input` value.
355
+ * It just believes that the `input` value is valid and converts it to a binary data
356
+ * directly. Therefore, if you can't ensure the `input` value type, it would better to
357
+ * call one of below functions intead.
358
+ *
359
+ * - {@link assertEncode}
360
+ * - {@link isEncode}
361
+ * - {@link validateEncode}
362
+ *
363
+ * By the way, you know what? Expression power of Protocol Buffer is not enough strong
364
+ * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
365
+ * type that is not compatible with Protocol Buffer, this function would throw a
366
+ * compilation error.
367
+ *
368
+ * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
369
+ *
370
+ * @template T Type of the value input
371
+ * @param input A value to encode
372
+ * @returns Encoded binary data
373
+ *
374
+ * @author Jeongho Nam - https://github.com/samchon
375
+ */
82
376
  export function encode<T>(input: T): Uint8Array;
83
377
 
84
378
  /**
@@ -89,19 +383,72 @@ export function encode(): never {
89
383
  }
90
384
  Object.assign(encode, Namespace.protobuf.encode("encode"));
91
385
 
92
- export function isEncode<T>(input: T): Uint8Array | null;
93
-
94
386
  /**
95
- * @internal
387
+ * Protocol Buffer Encoder with type assertion.
388
+ *
389
+ * `typia.protobuf.assertEncode()` is a combination function of {@link assert} and
390
+ * {@link encode}.
391
+ *
392
+ * Therefore, it converts an `input` value to a binary data of
393
+ * Protocol Buffer, with type assertion. If `input` value is not valid, it throws
394
+ * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value,
395
+ * Protocol Buffer binary data would be returned.
396
+ *
397
+ * If you can trust `input` value, or want to perform other type of validation, use
398
+ * below functions intead.
399
+ *
400
+ * - {@link encode}
401
+ * - {@link isEncode}
402
+ * - {@link validateEncode}
403
+ *
404
+ * By the way, you know what? Expression power of Protocol Buffer is not enough strong
405
+ * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
406
+ * type that is not compatible with Protocol Buffer, this function would throw a
407
+ * compilation error.
408
+ *
409
+ * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
410
+ *
411
+ * @template T Type of the value input
412
+ * @param input A value to encode
413
+ * @returns Encoded binary data
414
+ *
415
+ * @author Jeongho Nam - https://github.com/samchon
96
416
  */
97
- export function isEncode(): never {
98
- halt("isEncode");
99
- }
100
- Object.assign(isEncode, Namespace.is());
101
- Object.assign(isEncode, Namespace.protobuf.encode("isEncode"));
102
-
103
417
  export function assertEncode<T>(input: T): Uint8Array;
104
418
 
419
+ /**
420
+ * Protocol Buffer Encoder with type assertion.
421
+ *
422
+ * `typia.protobuf.assertEncode()` is a combination function of {@link assert} and
423
+ * {@link encode}.
424
+ *
425
+ * Therefore, it converts an `input` value to a binary data of
426
+ * Protocol Buffer, with type assertion. If `input` value is not valid, it throws
427
+ * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value,
428
+ * Protocol Buffer binary data would be returned.
429
+ *
430
+ * If you can trust `input` value, or want to perform other type of validation, use
431
+ * below functions intead.
432
+ *
433
+ * - {@link encode}
434
+ * - {@link isEncode}
435
+ * - {@link validateEncode}
436
+ *
437
+ * By the way, you know what? Expression power of Protocol Buffer is not enough strong
438
+ * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
439
+ * type that is not compatible with Protocol Buffer, this function would throw a
440
+ * compilation error.
441
+ *
442
+ * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
443
+ *
444
+ * @template T Type of the value input
445
+ * @param input A value to encode
446
+ * @returns Encoded binary data
447
+ *
448
+ * @author Jeongho Nam - https://github.com/samchon
449
+ */
450
+ export function assertEncode<T>(input: unknown): Uint8Array;
451
+
105
452
  /**
106
453
  * @internal
107
454
  */
@@ -111,8 +458,149 @@ export function assertEncode(): never {
111
458
  Object.assign(assertEncode, Namespace.assert("assertEncode"));
112
459
  Object.assign(assertEncode, Namespace.protobuf.encode("assertEncode"));
113
460
 
461
+ /**
462
+ * Protocol Buffer Encoder with type checking.
463
+ *
464
+ * `typia.protobuf.isEncode()` is a combination function of {@link is} and
465
+ * {@link encode}.
466
+ *
467
+ * Therefore, it converts an `input` value to a binary data of
468
+ * Protocol Buffer, with type checking. If `input` value is not valid, it returns
469
+ * `null` value. Otherwise, there's no problem on the `input` value, Protocol
470
+ * Buffer binary data would be returned.
471
+ *
472
+ * If you can trust `input` value, or want to perform other type of validation, use
473
+ * below functions intead.
474
+ *
475
+ * - {@link encode}
476
+ * - {@link assertEncode}
477
+ * - {@link validateEncode}
478
+ *
479
+ * By the way, you know what? Expression power of Protocol Buffer is not enough strong
480
+ * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
481
+ * type that is not compatible with Protocol Buffer, this function would throw a
482
+ * compilation error.
483
+ *
484
+ * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
485
+ *
486
+ * @template T Type of the value input
487
+ * @param input A value to encode
488
+ * @returns Encoded binary data
489
+ *
490
+ * @author Jeongho Nam - https://github.com/samchon
491
+ */
492
+ export function isEncode<T>(input: T): Uint8Array | null;
493
+
494
+ /**
495
+ * Protocol Buffer Encoder with type checking.
496
+ *
497
+ * `typia.protobuf.isEncode()` is a combination function of {@link is} and
498
+ * {@link encode}.
499
+ *
500
+ * Therefore, it converts an `input` value to a binary data of
501
+ * Protocol Buffer, with type checking. If `input` value is not valid, it returns
502
+ * `null` value. Otherwise, there's no problem on the `input` value, Protocol
503
+ * Buffer binary data would be returned.
504
+ *
505
+ * If you can trust `input` value, or want to perform other type of validation, use
506
+ * below functions intead.
507
+ *
508
+ * - {@link encode}
509
+ * - {@link assertEncode}
510
+ * - {@link validateEncode}
511
+ *
512
+ * By the way, you know what? Expression power of Protocol Buffer is not enough strong
513
+ * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
514
+ * type that is not compatible with Protocol Buffer, this function would throw a
515
+ * compilation error.
516
+ *
517
+ * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
518
+ *
519
+ * @template T Type of the value input
520
+ * @param input A value to encode
521
+ * @returns Encoded binary data
522
+ *
523
+ * @author Jeongho Nam - https://github.com/samchon
524
+ */
525
+ export function isEncode<T>(input: unknown): Uint8Array | null;
526
+
527
+ /**
528
+ * @internal
529
+ */
530
+ export function isEncode(): never {
531
+ halt("isEncode");
532
+ }
533
+ Object.assign(isEncode, Namespace.is());
534
+ Object.assign(isEncode, Namespace.protobuf.encode("isEncode"));
535
+
536
+ /**
537
+ * Protocol Buffer Encoder with type validation.
538
+ *
539
+ * `typia.protobuf.validateEncode()` is a combination function of
540
+ * {@link validation} and {@link encode}.
541
+ *
542
+ * Therefore, it converts an `input` value to a binary data of
543
+ * Protocol Buffer, with type validation. If `input` value is not valid, it returns
544
+ * {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
545
+ * no problem on the `input` value, Protocol Buffer binary data would be stored in
546
+ * `data` property of the output {@link IValidation.ISuccess} instance.
547
+ *
548
+ * If you can trust `input` value, or want to perform other type of validation, use
549
+ * below functions intead.
550
+ *
551
+ * - {@link encode}
552
+ * - {@link assertEncode}
553
+ * - {@link isEncode}
554
+ *
555
+ * By the way, you know what? Expression power of Protocol Buffer is not enough strong
556
+ * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
557
+ * type that is not compatible with Protocol Buffer, this function would throw a
558
+ * compilation error.
559
+ *
560
+ * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
561
+ *
562
+ * @template T Type of the value input
563
+ * @param input A value to encode
564
+ * @returns Encoded binary data
565
+ *
566
+ * @author Jeongho Nam - https://github.com/samchon
567
+ */
114
568
  export function validateEncode<T>(input: T): IValidation<Uint8Array>;
115
569
 
570
+ /**
571
+ * Protocol Buffer Encoder with type validation.
572
+ *
573
+ * `typia.protobuf.validateEncode()` is a combination function of
574
+ * {@link validation} and {@link encode}.
575
+ *
576
+ * Therefore, it converts an `input` value to a binary data of
577
+ * Protocol Buffer, with type validation. If `input` value is not valid, it returns
578
+ * {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
579
+ * no problem on the `input` value, Protocol Buffer binary data would be stored in
580
+ * `data` property of the output {@link IValidation.ISuccess} instance.
581
+ *
582
+ * If you can trust `input` value, or want to perform other type of validation, use
583
+ * below functions intead.
584
+ *
585
+ * - {@link encode}
586
+ * - {@link assertEncode}
587
+ * - {@link isEncode}
588
+ *
589
+ * By the way, you know what? Expression power of Protocol Buffer is not enough strong
590
+ * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
591
+ * type that is not compatible with Protocol Buffer, this function would throw a
592
+ * compilation error.
593
+ *
594
+ * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
595
+ *
596
+ * @template T Type of the value input
597
+ * @param input A value to encode
598
+ * @returns Encoded binary data
599
+ *
600
+ * @author Jeongho Nam - https://github.com/samchon
601
+ */
602
+ export function validateEncode<T>(input: unknown): IValidation<Uint8Array>;
603
+
116
604
  /**
117
605
  * @internal
118
606
  */
@@ -125,36 +613,90 @@ Object.assign(validateEncode, Namespace.protobuf.encode("validateEncode"));
125
613
  /* -----------------------------------------------------------
126
614
  FACTORY FUNCTIONS
127
615
  ----------------------------------------------------------- */
616
+ /**
617
+ * Creates a reusable {@link decode} function.
618
+ *
619
+ * @danger You must configure the generic argument `T`
620
+ * @returns Nothing until you configure the generic argument `T`
621
+ * @throws compile error
622
+ *
623
+ * @author Jeongho Nam - https://github.com/samchon
624
+ */
128
625
  export function createDecode(): never;
129
- export function createDecode<T>(): (input: Uint8Array) => T;
626
+
627
+ /**
628
+ * Creates a reusable {@link decode} function.
629
+ *
630
+ * @template T Target type
631
+ * @returns A reusable `decode` function
632
+ *
633
+ * @author Jeongho Nam - https://github.com/samchon
634
+ */
635
+ export function createDecode<T>(): (input: Uint8Array) => Resolved<T>;
130
636
 
131
637
  /**
132
638
  * @internal
133
639
  */
134
- export function createDecode<T>(): (input: Uint8Array) => T {
640
+ export function createDecode<T>(): (input: Uint8Array) => Resolved<T> {
135
641
  halt("createDecode");
136
642
  }
137
643
  Object.assign(createDecode, Namespace.protobuf.decode("createDecode"));
138
644
 
645
+ /**
646
+ * Creates a reusable {@link isDecode} function.
647
+ *
648
+ * @danger You must configure the generic argument `T`
649
+ * @returns Nothing until you configure the generic argument `T`
650
+ * @throws compile error
651
+ *
652
+ * @author Jeongho Nam - https://github.com/samchon
653
+ */
139
654
  export function createIsDecode(): never;
140
- export function createIsDecode<T>(): (input: Uint8Array) => T | null;
655
+
656
+ /**
657
+ * Creates a reusable {@link isDecode} function.
658
+ *
659
+ * @template T Target type
660
+ * @returns A reusable `isDecode` function
661
+ *
662
+ * @author Jeongho Nam - https://github.com/samchon
663
+ */
664
+ export function createIsDecode<T>(): (input: Uint8Array) => Resolved<T> | null;
141
665
 
142
666
  /**
143
667
  * @internal
144
668
  */
145
- export function createIsDecode<T>(): (input: Uint8Array) => T | null {
669
+ export function createIsDecode<T>(): (input: Uint8Array) => Resolved<T> | null {
146
670
  halt("createIsDecode");
147
671
  }
148
672
  Object.assign(createIsDecode, Namespace.is());
149
673
  Object.assign(createIsDecode, Namespace.protobuf.decode("createIsDecode"));
150
674
 
675
+ /**
676
+ * Creates a reusable {@link assertDecode} function.
677
+ *
678
+ * @danger You must configure the generic argument `T`
679
+ * @returns Nothing until you configure the generic argument `T`
680
+ * @throws compile error
681
+ *
682
+ * @author Jeongho Nam - https://github.com/samchon
683
+ */
151
684
  export function createAssertDecode(): never;
152
- export function createAssertDecode<T>(): (input: Uint8Array) => T;
685
+
686
+ /**
687
+ * Creates a reusable {@link assertDecode} function.
688
+ *
689
+ * @template T Target type
690
+ * @returns A reusable `assertDecode` function
691
+ *
692
+ * @author Jeongho Nam - https://github.com/samchon
693
+ */
694
+ export function createAssertDecode<T>(): (input: Uint8Array) => Resolved<T>;
153
695
 
154
696
  /**
155
697
  * @internal
156
698
  */
157
- export function createAssertDecode<T>(): (input: Uint8Array) => T {
699
+ export function createAssertDecode<T>(): (input: Uint8Array) => Resolved<T> {
158
700
  halt("createAssertDecode");
159
701
  }
160
702
  Object.assign(createAssertDecode, Namespace.assert("createAssertDecode"));
@@ -163,17 +705,35 @@ Object.assign(
163
705
  Namespace.protobuf.decode("createAssertDecode"),
164
706
  );
165
707
 
708
+ /**
709
+ * Creates a reusable {@link validateDecode} function.
710
+ *
711
+ * @danger You must configure the generic argument `T`
712
+ * @returns Nothing until you configure the generic argument `T`
713
+ * @throws compile error
714
+ *
715
+ * @author Jeongho Nam - https://github.com/samchon
716
+ */
166
717
  export function createValidateDecode(): never;
718
+
719
+ /**
720
+ * Creates a reusable {@link validateDecode} function.
721
+ *
722
+ * @template T Target type
723
+ * @returns A reusable `validateDecode` function
724
+ *
725
+ * @author Jeongho Nam - https://github.com/samchon
726
+ */
167
727
  export function createValidateDecode<T>(): (
168
728
  input: Uint8Array,
169
- ) => IValidation<T>;
729
+ ) => IValidation<Resolved<T>>;
170
730
 
171
731
  /**
172
732
  * @internal
173
733
  */
174
734
  export function createValidateDecode<T>(): (
175
735
  input: Uint8Array,
176
- ) => IValidation<T> {
736
+ ) => IValidation<Resolved<T>> {
177
737
  halt("createValidateDecode");
178
738
  }
179
739
  Object.assign(createValidateDecode, Namespace.validate());
@@ -182,7 +742,25 @@ Object.assign(
182
742
  Namespace.protobuf.decode("createValidateDecode"),
183
743
  );
184
744
 
745
+ /**
746
+ * Creates a reusable {@link encode} function.
747
+ *
748
+ * @danger You must configure the generic argument `T`
749
+ * @returns Nothing until you configure the generic argument `T`
750
+ * @throws compile error
751
+ *
752
+ * @author Jeongho Nam - https://github.com/samchon
753
+ */
185
754
  export function createEncode(): never;
755
+
756
+ /**
757
+ * Creates a reusable {@link encode} function.
758
+ *
759
+ * @template T Target type
760
+ * @returns A reusable `encode` function
761
+ *
762
+ * @author Jeongho Nam - https://github.com/samchon
763
+ */
186
764
  export function createEncode<T>(): (input: T) => Uint8Array;
187
765
 
188
766
  /**
@@ -193,7 +771,25 @@ export function createEncode<T>(): (input: T) => Uint8Array {
193
771
  }
194
772
  Object.assign(createEncode, Namespace.protobuf.encode("createEncode"));
195
773
 
774
+ /**
775
+ * Creates a reusable {@link isEncode} function.
776
+ *
777
+ * @danger You must configure the generic argument `T`
778
+ * @returns Nothing until you configure the generic argument `T`
779
+ * @throws compile error
780
+ *
781
+ * @author Jeongho Nam - https://github.com/samchon
782
+ */
196
783
  export function createIsEncode(): never;
784
+
785
+ /**
786
+ * Creates a reusable {@link isEncode} function.
787
+ *
788
+ * @template T Target type
789
+ * @returns A reusable `isEncode` function
790
+ *
791
+ * @author Jeongho Nam - https://github.com/samchon
792
+ */
197
793
  export function createIsEncode<T>(): (input: T) => Uint8Array | null;
198
794
 
199
795
  /**
@@ -205,7 +801,25 @@ export function createIsEncode<T>(): (input: T) => Uint8Array | null {
205
801
  Object.assign(createIsEncode, Namespace.is());
206
802
  Object.assign(createIsEncode, Namespace.protobuf.encode("createIsEncode"));
207
803
 
804
+ /**
805
+ * Creates a reusable {@link assertEncode} function.
806
+ *
807
+ * @danger You must configure the generic argument `T`
808
+ * @returns Nothing until you configure the generic argument `T`
809
+ * @throws compile error
810
+ *
811
+ * @author Jeongho Nam - https://github.com/samchon
812
+ */
208
813
  export function createAssertEncode(): never;
814
+
815
+ /**
816
+ * Creates a reusable {@link assertEncode} function.
817
+ *
818
+ * @template T Target type
819
+ * @returns A reusable `assertEncode` function
820
+ *
821
+ * @author Jeongho Nam - https://github.com/samchon
822
+ */
209
823
  export function createAssertEncode<T>(): (input: T) => Uint8Array;
210
824
 
211
825
  /**
@@ -220,7 +834,25 @@ Object.assign(
220
834
  Namespace.protobuf.encode("createAssertEncode"),
221
835
  );
222
836
 
837
+ /**
838
+ * Creates a reusable {@link validateEncode} function.
839
+ *
840
+ * @danger You must configure the generic argument `T`
841
+ * @returns Nothing until you configure the generic argument `T`
842
+ * @throws compile error
843
+ *
844
+ * @author Jeongho Nam - https://github.com/samchon
845
+ */
223
846
  export function createValidateEncode(): never;
847
+
848
+ /**
849
+ * Creates a reusable {@link validateEncode} function.
850
+ *
851
+ * @template T Target type
852
+ * @returns A reusable `validateEncode` function
853
+ *
854
+ * @author Jeongho Nam - https://github.com/samchon
855
+ */
224
856
  export function createValidateEncode<T>(): (
225
857
  input: T,
226
858
  ) => IValidation<Uint8Array>;