typia 9.7.1 → 10.0.0-dev.20251107

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